AIBOOKVIZ / assets /js /dflip_edited.min.js
shethjenil's picture
Upload folder using huggingface_hub
382b405 verified
!function() {
var e = {
101: function() {
var e, t, i;
function n(e, t) {
return null != t && "undefined" != typeof Symbol && t[Symbol.hasInstance] ? !!t[Symbol.hasInstance](e) : e instanceof t
}
(t = t || (e = [],
{
getAll: function() {
return e
},
removeAll: function() {
e = []
},
add: function(t) {
e.push(t)
},
remove: function(t) {
var i = e.indexOf(t);
-1 !== i && e.splice(i, 1)
},
update: function(t) {
if (0 === e.length)
return !1;
var i = 0;
for (t = null != t ? t : window.performance.now(); i < e.length; )
e[i].update(t) ? i++ : e.splice(i, 1);
return !0
}
})).Tween = function(e) {
var i = {}
, o = {}
, a = {}
, s = 1e3
, r = 0
, l = !1
, h = !1
, u = !1
, p = 0
, c = null
, d = t.Easing.Linear.None
, f = t.Interpolation.Linear
, g = []
, v = null
, m = !1
, y = null
, b = null
, w = null;
for (var P in e)
i[P] = parseFloat(e[P], 10);
this.to = function(e, t) {
return null != t && (s = t),
o = e,
this
}
,
this.start = function(s) {
for (var r in t.add(this),
h = !0,
m = !1,
c = (null != s ? s : window.performance.now()) + p,
o) {
if (n(o[r], Array)) {
if (0 === o[r].length)
continue;
o[r] = [e[r]].concat(o[r])
}
null != i[r] && (i[r] = e[r],
!1 === n(i[r], Array) && (i[r] *= 1),
a[r] = i[r] || 0)
}
return this
}
,
this.stop = function() {
return h && (t.remove(this),
h = !1,
null != w && w.call(e),
this.stopChainedTweens()),
this
}
,
this.stopChainedTweens = function() {
for (var e = 0, t = g.length; e < t; e++)
g[e].stop()
}
,
this.complete = function() {
return h && (t.remove(this),
h = !1,
null != b && b.call(e),
this.completeChainedTweens()),
this
}
,
this.completeChainedTweens = function() {
for (var e = 0, t = g.length; e < t; e++)
g[e].complete()
}
,
this.delay = function(e) {
return p = e,
this
}
,
this.repeat = function(e) {
return r = e,
this
}
,
this.yoyo = function(e) {
return l = e,
this
}
,
this.easing = function(e) {
return d = null == e ? d : e,
this
}
,
this.interpolation = function(e) {
return f = e,
this
}
,
this.chain = function() {
return g = arguments,
this
}
,
this.onStart = function(e) {
return v = e,
this
}
,
this.onUpdate = function(e) {
return y = e,
this
}
,
this.onComplete = function(e) {
return b = e,
this
}
,
this.onStop = function(e) {
return w = e,
this
}
,
this.update = function(t) {
if (t < c)
return !0;
for (h in !1 === m && (null != v && v.call(e),
m = !0),
w = (w = (t - c) / s) > 1 ? 1 : w,
P = d(w),
o)
if (null != i[h]) {
var h, w, P, S = i[h] || 0, C = o[h];
n(C, Array) ? e[h] = f(C, P) : ("string" == typeof C && (C = C.startsWith("+") || C.startsWith("-") ? S + parseFloat(C, 10) : parseFloat(C, 10)),
"number" == typeof C && (e[h] = S + (C - S) * P))
}
if (null != y && y.call(e, P),
1 === w) {
if (r > 0) {
for (h in isFinite(r) && r--,
a) {
if ("string" == typeof o[h] && (a[h] = a[h] + parseFloat(o[h], 10)),
l) {
var x = a[h];
a[h] = o[h],
o[h] = x
}
i[h] = a[h]
}
l && (u = !u),
c = t + p
} else {
null != b && b.call(e);
for (var T = 0, k = g.length; T < k; T++)
g[T].start(c + s);
return !1
}
}
return !0
}
}
,
t.Easing = {
Linear: {
None: function(e) {
return e
}
},
Quadratic: {
In: function(e) {
return e * e
},
Out: function(e) {
return e * (2 - e)
},
InOut: function(e) {
return (e *= 2) < 1 ? .5 * e * e : -.5 * (--e * (e - 2) - 1)
}
},
Quartic: {
In: function(e) {
return e * e * e * e
},
Out: function(e) {
return 1 - --e * e * e * e
},
InOut: function(e) {
return (e *= 2) < 1 ? .5 * e * e * e * e : -.5 * ((e -= 2) * e * e * e - 2)
}
},
Sinusoidal: {
In: function(e) {
return 1 - Math.cos(e * Math.PI / 2)
},
Out: function(e) {
return Math.sin(e * Math.PI / 2)
},
InOut: function(e) {
return .5 * (1 - Math.cos(Math.PI * e))
}
},
Cubic: {
In: function(e) {
return e * e * e
},
Out: function(e) {
return --e * e * e + 1
},
InOut: function(e) {
return (e *= 2) < 1 ? .5 * e * e * e : .5 * ((e -= 2) * e * e + 2)
}
}
},
t.Interpolation = {
Linear: function(e, i) {
var n = e.length - 1
, o = n * i
, a = Math.floor(o)
, s = t.Interpolation.Utils.Linear;
return i < 0 ? s(e[0], e[1], o) : i > 1 ? s(e[n], e[n - 1], n - o) : s(e[a], e[a + 1 > n ? n : a + 1], o - a)
},
Bezier: function(e, i) {
for (var n = 0, o = e.length - 1, a = Math.pow, s = t.Interpolation.Utils.Bernstein, r = 0; r <= o; r++)
n += a(1 - i, o - r) * a(i, r) * e[r] * s(o, r);
return n
},
Utils: {
Linear: function(e, t, i) {
return (t - e) * i + e
},
Bernstein: function(e, i) {
var n = t.Interpolation.Utils.Factorial;
return n(e) / n(i) / n(e - i)
},
Factorial: (i = [1],
function(e) {
var t = 1;
if (i[e])
return i[e];
for (var n = e; n > 1; n--)
t *= n;
return i[e] = t,
t
}
),
CatmullRom: function(e, t, i, n, o) {
var a = (i - e) * .5
, s = (n - t) * .5
, r = o * o;
return o * r * (2 * t - 2 * i + a + s) + (-3 * t + 3 * i - 2 * a - s) * r + a * o + t
}
}
},
window.TWEEN = t
}
}
, t = {};
function i(n) {
var o = t[n];
if (void 0 !== o)
return o.exports;
var a = t[n] = {
exports: {}
};
return e[n](a, a.exports, i),
a.exports
}
i.amdO = {},
function() {
"use strict";
var e, t, n = {
jQuery: jQuery,
version: "2.3.48",
autoDetectLocation: !0,
slug: void 0,
locationVar: "dearViewerLocation",
locationFile: void 0,
MOUSE_CLICK_ACTIONS: {
NONE: "none",
NAV: "nav"
},
ARROW_KEYS_ACTIONS: {
NONE: "none",
NAV: "nav"
},
MOUSE_DBL_CLICK_ACTIONS: {
NONE: "none",
ZOOM: "zoom"
},
MOUSE_SCROLL_ACTIONS: {
NONE: "none",
ZOOM: "zoom",
NAV: "nav"
},
PAGE_SCALE: {
PAGE_FIT: "fit",
PAGE_WIDTH: "width",
AUTO: "auto",
ACTUAL: "actual",
MANUAL: "manual"
},
READ_DIRECTION: {
LTR: "ltr",
RTL: "rtl"
},
TURN_DIRECTION: {
LEFT: "left",
RIGHT: "right",
NONE: "none"
},
INFO_TYPE: {
INFO: "info",
ERROR: "error"
},
FLIPBOOK_PAGE_MODE: {
SINGLE: "single",
DOUBLE: "double",
AUTO: "auto"
},
FLIPBOOK_SINGLE_PAGE_MODE: {
ZOOM: "zoom",
BOOKLET: "booklet",
AUTO: "auto"
},
FLIPBOOK_PAGE_SIZE: {
AUTO: "auto",
SINGLE: "single",
DOUBLE_INTERNAL: "dbl_int",
DOUBLE: "dbl",
DOUBLE_COVER_BACK: "dbl_cover_back"
},
LINK_TARGET: {
NONE: 0,
SELF: 1,
BLANK: 2,
PARENT: 3,
TOP: 4
},
CONTROLS_POSITION: {
HIDDEN: "hidden",
TOP: "top",
BOTTOM: "bottom"
},
TURN_CORNER: {
TL: "tl",
TR: "tr",
BL: "bl",
BR: "br",
L: "l",
R: "r",
NONE: "none"
},
REQUEST_STATUS: {
OFF: "none",
ON: "pending",
COUNT: "counting"
},
TEXTURE_TARGET: {
THUMB: 0,
VIEWER: 1,
ZOOM: 2
},
FLIPBOOK_CENTER_SHIFT: {
RIGHT: 1,
LEFT: -1,
NONE: 0
},
FLIPBOOK_COVER_TYPE: {
NONE: "none",
PLAIN: "plain",
BASIC: "basic",
RIDGE: "ridge"
}
};
function o(e, t) {
(null == t || t > e.length) && (t = e.length);
for (var i = 0, n = Array(t); i < t; i++)
n[i] = e[i];
return n
}
n._defaults = {
is3D: !0,
has3DShadow: !0,
color3DCover: "#aaaaaa",
color3DSheets: "#fff",
cover3DType: n.FLIPBOOK_COVER_TYPE.NONE,
flexibility: .9,
drag3D: !1,
height: "auto",
autoOpenOutline: !1,
autoOpenThumbnail: !1,
showDownloadControl: !0,
showSearchControl: 0,
showPrintControl: 0,
enableSound: !0,
duration: 800,
pageRotation: 0,
flipbook3DTiltAngleUp: 0,
flipbook3DTiltAngleLeft: 0,
readDirection: n.READ_DIRECTION.LTR,
pageMode: n.FLIPBOOK_PAGE_MODE.SINGLE,
singlePageMode: n.FLIPBOOK_SINGLE_PAGE_MODE.AUTO,
flipbookFitPages: !1,
backgroundColor: "transparent",
flipbookHardPages: "none",
openPage: 1,
annotationClass: "",
maxTextureSize: 3200,
minTextureSize: 256,
rangeChunkSize: 524288,
disableAutoFetch: !0,
disableStream: !0,
disableFontFace: !1,
icons: {
altnext: "df-icon-arrow-right1",
altprev: "df-icon-arrow-left1",
next: "df-icon-arrow-right1",
prev: "df-icon-arrow-left1",
end: "df-icon-last-page",
start: "df-icon-first-page",
share: "df-icon-share",
"outline-open": "df-icon-arrow-right",
"outline-close": "df-icon-arrow-down",
help: "df-icon-help",
more: "df-icon-more",
download: "df-icon-download",
zoomin: "df-icon-add-circle",
zoomout: "df-icon-minus-circle",
resetzoom: "df-icon-minus-circle",
fullscreen: "df-icon-fullscreen",
"fullscreen-off": "df-icon-fit-screen",
fitscreen: "df-icon-fit-screen",
thumbnail: "df-icon-grid-view",
outline: "df-icon-list",
close: "df-icon-close",
doublepage: "df-icon-double-page",
singlepage: "df-icon-file",
print: "df-icon-print",
play: "df-icon-play",
pause: "df-icon-pause",
search: "df-icon-search",
sound: "df-icon-volume",
"sound-off": "df-icon-volume",
facebook: "df-icon-facebook",
google: "df-icon-google",
twitter: "df-icon-twitter",
whatsapp: "df-icon-whatsapp",
linkedin: "df-icon-linkedin",
pinterest: "df-icon-pinterest",
mail: "df-icon-mail"
},
text: {
toggleSound: "Turn on/off Sound",
toggleThumbnails: "Toggle Thumbnails",
toggleOutline: "Toggle Outline/Bookmark",
previousPage: "Previous Page",
nextPage: "Next Page",
toggleFullscreen: "Toggle Fullscreen",
zoomIn: "Zoom In",
zoomOut: "Zoom Out",
resetZoom: "Reset Zoom",
pageFit: "Fit Page",
widthFit: "Fit Width",
toggleHelp: "Toggle Help",
search: "Search in PDF",
singlePageMode: "Single Page Mode",
doublePageMode: "Double Page Mode",
downloadPDFFile: "Download PDF File",
gotoFirstPage: "Goto First Page",
gotoLastPage: "Goto Last Page",
print: "Print",
play: "Start AutoPlay",
pause: "Pause AutoPlay",
share: "Share",
close: "Close",
mailSubject: "Check out this FlipBook",
mailBody: "Check out this site {{url}}",
loading: "Loading",
thumbTitle: "Thumbnails",
outlineTitle: "Table of Contents",
searchTitle: "Search",
searchPlaceHolder: "Search",
analyticsEventCategory: "DearFlip",
analyticsViewerReady: "Document Ready",
analyticsViewerOpen: "Document Opened",
analyticsViewerClose: "Document Closed",
analyticsFirstPageChange: "First Page Changed"
},
share: {
facebook: "https://www.facebook.com/sharer/sharer.php?u={{url}}&t={{mailsubject}}",
twitter: "https://twitter.com/share?url={{url}}&text={{mailsubject}}",
mail: void 0,
whatsapp: "https://api.whatsapp.com/send/?text={{mailsubject}}+{{url}}&type=custom_url&app_absent=0",
linkedin: "https://www.linkedin.com/shareArticle?url={{url}}&title={{mailsubject}}",
pinterest: "https://www.pinterest.com/pin/create/button/?url={{url}}&media=&description={{mailsubject}}"
},
allControls: "altPrev,pageNumber,altNext,play,outline,thumbnail,zoomIn,zoomOut,zoom,fullScreen,share,download,search,pageMode,startPage,endPage,sound,search,print,more",
moreControls: "download,pageMode,pageFit,startPage,endPage,sound",
leftControls: "outline,thumbnail",
rightControls: "fullScreen,share,download,more",
hideControls: "share",
hideShareControls: "",
controlsPosition: n.CONTROLS_POSITION.BOTTOM,
paddingTop: 0,
paddingLeft: 0,
paddingRight: 0,
paddingBottom: 0,
enableAnalytics: !1,
zoomRatio: 2,
maxDPI: 2,
fakeZoom: 1,
pageScale: n.PAGE_SCALE.PAGE_FIT,
controlsFloating: !0,
sideMenuOverlay: !0,
enableAnnotation: !0,
enableAutoLinks: !0,
arrowKeysAction: n.ARROW_KEYS_ACTIONS.NAV,
clickAction: n.MOUSE_CLICK_ACTIONS.NAV,
dblClickAction: n.MOUSE_DBL_CLICK_ACTIONS.NONE,
mouseScrollAction: n.MOUSE_SCROLL_ACTIONS.NONE,
linkTarget: n.LINK_TARGET.BLANK,
soundFile: "sound/turn2.mp3",
imagesLocation: "images",
imageResourcesPath: "images/pdfjs/",
popupThumbPlaceholder: "data:image/svg+xml," + escape('<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 210 297"><rect width="210" height="297" style="fill:#f1f2f2"/><circle cx="143" cy="95" r="12" style="fill:#e3e8ed"/><polygon points="131 138 120 149 95 124 34 184 176 185 131 138" style="fill:#e3e8ed"/></svg>'),
cMapUrl: "js/libs/cmaps/",
logo: "",
logoUrl: "",
sharePrefix: "",
pageSize: n.FLIPBOOK_PAGE_SIZE.AUTO,
backgroundImage: "images/background.jpg",
pixelRatio: window.devicePixelRatio || 1,
spotLightIntensity: .22,
ambientLightColor: "#fff",
ambientLightIntensity: .8,
shadowOpacity: .1,
slug: void 0,
headerElementSelector: void 0,
onReady: function(e) {},
onPageChanged: function(e) {},
beforePageChanged: function(e) {},
onCreate: function(e) {},
onCreateUI: function(e) {},
onFlip: function(e) {},
beforeFlip: function(e) {},
autoPDFLinktoViewer: !1,
autoLightBoxFullscreen: !1,
thumbLayout: "book-title-hover",
cleanupAfterRender: !0,
canvasWillReadFrequently: !0,
providerType: "pdf",
loadMoreCount: -1,
autoPlay: !1,
autoPlayDuration: 1e3,
autoPlayStart: !1,
popupBackGroundColor: "#eee",
mockupMode: !1,
instantTextureProcess: !1,
cachePDFTexture: !1,
pdfVersion: "default"
},
n.defaults = {},
n.jQuery.extend(!0, n.defaults, n._defaults),
n.viewers = {},
n.providers = {},
n.openFileOptions = {},
n.executeCallback = function() {}
;
var a = n.jQuery
, s = "WebKitCSSMatrix"in window || document.body && "MozPerspective"in document.body.style
, r = "onmousedown"in window
, l = n.utils = {
mouseEvents: r ? {
type: "mouse",
start: "mousedown",
move: "mousemove",
end: "mouseup"
} : {
type: "touch",
start: "touchstart",
move: "touchmove",
end: "touchend"
},
html: {
div: "<div></div>",
a: "<a>",
input: "<input type='text'/>",
select: "<select></select>"
},
getSharePrefix: function() {
return l.getSharePrefixes()[0]
},
getSharePrefixes: function() {
return (n.defaults.sharePrefix + ",dflip-,flipbook-,dearflip-,dearpdf-").split(",").map(function(e) {
return e.trim()
})
},
toRad: function(e) {
return e * Math.PI / 180
},
toDeg: function(e) {
return 180 * e / Math.PI
},
ifdef: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
return null == e ? t : e
},
createBtn: function(e, t, i) {
var n = a(l.html.div, {
class: "df-ui-btn df-ui-" + e,
title: i,
html: void 0 !== i ? "<span>" + i + "</span>" : ""
});
return void 0 !== t && t.indexOf("<svg") > -1 ? n.html(t.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg" ')) : n.addClass(t),
n
},
transition: function(e, t) {
return e ? t / 1e3 + "s ease-out" : "0s none"
},
display: function(e) {
return e ? "block" : "none"
},
resetTranslate: function() {
return l.translateStr(0, 0)
},
bgImage: function(e) {
return null == e || "blank" === e ? "" : ' url("' + e + '")'
},
translateStr: function(e, t) {
return s ? " translate3d(" + e + "px," + t + "px, 0px) " : " translate(" + e + "px, " + t + "px) "
},
httpsCorrection: function(e) {
try {
if (null == e)
return null;
if ("string" != typeof e)
return e;
var t = window.location;
if (t.href.split(".")[0] === e.split(".")[0])
return e;
e.split("://")[1].split("/")[0].replace("www.", "") === t.hostname.replace("www.", "") && e.indexOf(t.hostname.replace("www.", "")) > -1 && (t.href.indexOf("https://") > -1 ? e = e.replace("http://", "https://") : t.href.indexOf("http://") > -1 && (e = e.replace("https://", "http://")),
t.href.indexOf("://www.") > -1 && -1 === e.indexOf("://www.") && (e = e.replace("://", "://www.")),
-1 === t.href.indexOf("://www.") && e.indexOf("://www.") > -1 && (e = e.replace("://www.", "://")))
} catch (t) {
console.log("Skipping URL correction: " + e)
}
return e
},
rotateStr: function(e) {
return " rotateZ(" + e + "deg) "
},
lowerPowerOfTwo: function(e) {
return Math.pow(2, Math.floor(Math.log(e) / Math.LN2))
},
nearestPowerOfTwo: function(e, t) {
return Math.min(t || 2048, Math.pow(2, Math.ceil(Math.log(e) / Math.LN2)))
},
getFullscreenElement: function() {
return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement
},
hasFullscreenEnabled: function() {
return document.fullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled
},
fixMouseEvent: function(e) {
if (!e)
return e;
var t = e.originalEvent || e;
if (!t.changedTouches || !(t.changedTouches.length > 0))
return e;
var i = a.event.fix(e)
, n = t.changedTouches[0];
return i.clientX = n.clientX,
i.clientY = n.clientY,
i.pageX = n.pageX,
i.touches = t.touches,
i.pageY = n.pageY,
i.movementX = n.movementX,
i.movementY = n.movementY,
i
},
limitAt: function(e, t, i) {
return e < t ? t : e > i ? i : e
},
distOrigin: function(e, t) {
return l.distPoints(0, 0, e, t)
},
distPoints: function(e, t, i, n) {
return Math.sqrt(Math.pow(i - e, 2) + Math.pow(n - t, 2))
},
angleByDistance: function(e, t) {
var i = t / 2
, n = l.limitAt(e, 0, t);
return n < i ? l.toDeg(Math.asin(n / i)) : 90 + l.toDeg(Math.asin((n - i) / i))
},
calculateScale: function(e, t) {
var i = l.distPoints(e[0].x, e[0].y, e[1].x, e[1].y);
return l.distPoints(t[0].x, t[0].y, t[1].x, t[1].y) / i
},
getVectorAvg: function(e) {
return {
x: e.map(function(e) {
return e.x
}).reduce(l.sum) / e.length,
y: e.map(function(e) {
return e.y
}).reduce(l.sum) / e.length
}
},
sum: function(e, t) {
return e + t
},
getTouches: function(e, t) {
return t = t || {
left: 0,
top: 0
},
Array.prototype.slice.call(e.touches).map(function(e) {
return {
x: e.pageX - t.left,
y: e.pageY - t.top
}
})
},
getScriptCallbacks: [],
getScript: function(e, t, i, n) {
var o, s = l.getScriptCallbacks[e];
function r() {
o.removeEventListener("load", h, !1),
o.removeEventListener("readystatechange", h, !1),
o.removeEventListener("complete", h, !1),
o.removeEventListener("error", u, !1),
o.onload = o.onreadystatechange = null,
o = null,
o = null
}
function h(e, t) {
if (null != o && (t || !o.readyState || /loaded|complete/.test(o.readyState))) {
if (!t) {
for (var n = 0; n < s.length; n++)
s[n] && s[n](),
s[n] = null;
i = null
}
r()
}
}
function u() {
i(),
r(),
i = null
}
if (0 === a("script[src='" + e + "']").length) {
(s = l.getScriptCallbacks[e] = []).push(t),
o = document.createElement("script");
var p = document.body.getElementsByTagName("script")[0];
o.async = !0,
o.setAttribute("data-cfasync", "false"),
!0 === n && o.setAttribute("type", "module"),
null != p ? (p.parentNode.insertBefore(o, p),
p = null) : document.body.appendChild(o),
o.addEventListener("load", h, !1),
o.addEventListener("readystatechange", h, !1),
o.addEventListener("complete", h, !1),
i && o.addEventListener("error", u, !1),
o.src = e + ("MS" === l.prefix.dom ? "?" + Math.random() : "")
} else
s.push(t)
},
detectScriptLocation: function() {
if (void 0 === window[n.locationVar])
a("script").each(function() {
var e = a(this)[0].src;
if ((e.indexOf("/" + n.locationFile + ".js") > -1 || e.indexOf("/" + n.locationFile + ".min.js") > -1 || e.indexOf("js/" + n.locationFile + ".") > -1) && (e.indexOf("https://") > -1 || e.indexOf("http://") > -1)) {
var t = e.split("/");
window[n.locationVar] = t.slice(0, -2).join("/")
}
});
else if (-1 == window[n.locationVar].indexOf(":")) {
var e = document.createElement("a");
e.href = window[n.locationVar],
window[n.locationVar] = e.href,
e = null
}
void 0 !== window[n.locationVar] && window[n.locationVar].length > 2 && "/" !== window[n.locationVar].slice(-1) && (window.window[n.locationVar] += "/")
},
disposeObject: function(e) {
return e && e.dispose && e.dispose(),
e = null
},
log: function() {
for (var e, t = arguments.length, i = Array(t), a = 0; a < t; a++)
i[a] = arguments[a];
!0 === n.defaults.enableDebugLog && window.console && (e = console).log.apply(e, function(e) {
if (Array.isArray(e))
return o(e)
}(i) || function(e) {
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"])
return Array.from(e)
}(i) || function(e, t) {
if (e) {
if ("string" == typeof e)
return o(e, void 0);
var i = Object.prototype.toString.call(e).slice(8, -1);
if ("Object" === i && e.constructor && (i = e.constructor.name),
"Map" === i || "Set" === i)
return Array.from(i);
if ("Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))
return o(e, void 0)
}
}(i) || function() {
throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}())
},
color: {
getBrightness: function(e) {
var t = e.replace("#", "").match(/.{1,2}/g).map(function(e) {
return parseInt(e, 16)
});
return .299 * t[0] + .587 * t[1] + .114 * t[2]
},
isLight: function(e) {
return !l.color.isDark(e)
},
isDark: function(e) {
return 128 > l.color.getBrightness(e)
}
},
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
isIOS: /(iPad|iPhone|iPod)/g.test(navigator.userAgent),
isIPad: "iPad" === navigator.platform || void 0 !== navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /Mac/.test(navigator.platform),
isMac: navigator.platform.toUpperCase().indexOf("MAC") >= 0,
isSafari: /constructor/i.test(window.HTMLElement) || "[object SafariRemoteNotification]" === (!window.safari || window.safari.pushNotification).toString(),
isIEUnsupported: !!navigator.userAgent.match(/(MSIE|Trident)/),
isSafariWindows: function() {
return !l.isMac && l.isSafari
},
hasWebgl: function() {
try {
var e = document.createElement("canvas");
return !!(window.WebGLRenderingContext && (e.getContext("webgl") || e.getContext("experimental-webgl")))
} catch (e) {
return !1
}
}(),
hasES2022: void 0 !== Array.prototype.at,
canSupport3D: function() {
var e = !0;
try {
if (!1 == l.hasWebgl)
e = !1,
console.log("Proper Support for Canvas webgl 3D not detected!");
else if (!1 == l.hasES2022)
e = !1,
console.log("Proper Support for 3D not extpected in older browser!");
else if (-1 !== navigator.userAgent.indexOf("MSIE") || navigator.appVersion.indexOf("Trident/") > 0)
e = !1,
console.log("Proper Support for 3D not detected for IE!");
else if (l.isSafariWindows())
e = !1,
console.log("Proper Support for 3D not detected for Safari!");
else {
var t = navigator.userAgent.toString().toLowerCase().match(/android\s([0-9\.]*)/i);
(t = t ? t[1] : void 0) && (t = parseInt(t, 10),
!isNaN(t) && t < 9 && (e = !1,
console.log("Proper Support for 3D not detected for Android below 9.0!")))
}
} catch (e) {}
return e
},
prefix: (e = window.getComputedStyle(document.documentElement, ""),
t = Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)[1],
{
dom: "WebKit|Moz|MS".match(RegExp("(" + t + ")", "i"))[1],
lowercase: t,
css: "-" + t + "-",
js: t[0].toUpperCase() + t.substr(1)
}),
scrollIntoView: function(e, t, i) {
(t = t || e.parentNode).scrollTop = e.offsetTop + (!1 === i ? e.offsetHeight - t.offsetHeight : 0),
t.scrollLeft = e.offsetLeft - t.offsetLeft
},
getVisibleElements: function(e) {
var t = e.container
, i = e.elements
, n = e.visible || []
, o = t.scrollTop
, a = o + t.clientHeight;
if (0 == a)
return n;
var s = 0
, r = i.length - 1
, l = i[s]
, h = l.offsetTop + l.clientTop + l.clientHeight;
if (h < o)
for (; s < r; ) {
var u = s + r >> 1;
(h = (l = i[u]).offsetTop + l.clientTop + l.clientHeight) > o ? r = u : s = u + 1
}
for (var p = s; p < i.length; p++)
if ((l = i[p]).offsetTop + l.clientTop <= a)
n.push(p + 1);
else
break;
return n
},
getMouseDelta: function(e) {
var t = 0;
return null != e.wheelDelta ? t = e.wheelDelta : null != e.detail && (t = -e.detail),
t
},
pan: function(e, t) {
var i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]
, n = e.startPoint
, o = e.app.zoomValue
, a = e.left + (!0 === i ? 0 : t.raw.x - n.raw.x)
, s = e.top + (!0 === i ? 0 : t.raw.y - n.raw.y);
e.left = Math.ceil(l.limitAt(a, -e.shiftWidth, e.shiftWidth)),
e.top = Math.ceil(l.limitAt(s, -e.shiftHeight, e.shiftHeight)),
1 === o && (e.left = 0,
e.top = 0),
!1 === i && (e.startPoint = t)
}
};
l.isChromeExtension = function() {
return 0 === window.location.href.indexOf("chrome-extension://")
}
;
var h = /\x00+/g
, u = /[\x01-\x1F]/g;
l.removeNullCharacters = function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
return "string" != typeof e ? (warn("The argument for removeNullCharacters must be a string."),
e) : (t && (e = e.replace(u, " ")),
e.replace(h, ""))
}
,
n.hashFocusBookFound = !1,
l.detectHash = function() {
n.preParseHash = window.location.hash;
var e = l.getSharePrefixes();
-1 == e.indexOf("") && e.push(""),
Array.prototype.forEach.call(e, function(e) {
var t = n.preParseHash;
if (t && t.indexOf(e) >= 0 && !1 === n.hashFocusBookFound) {
e.length > 0 && (t = t.split(e)[1]);
var i = t.split("/")[0].replace("#", "");
if (i.length > 0) {
var o, s = t.split("/")[1];
if (null != s && (s = s.split("/")[0]),
0 === (o = a("[data-df-slug=" + i + "]")).length && (o = a("[data-slug=" + i + "]")),
0 === o.length && (o = a("#df-" + i + ",#" + i)),
0 === o.length && (o = a("[data-_slug=" + i + "]")),
o.length > 0 && o.is("._df_thumb,._df_button,._df_custom,._df_link,._df_book,.df-element,.dp-element")) {
o = a(o[0]),
n.hashFocusBookFound = !0,
s = parseInt(s, 10),
l.focusHash(o);
var r = n.activeLightBox && n.activeLightBox.app || o.data("df-app");
if (null != r)
return r.gotoPage(s),
r.hashNavigationEnabled = !0,
l.focusHash(r.element),
!1;
null != s && o.attr("data-hash-page", s),
o.addClass("df-hash-focused", !0),
null != o.data("lightbox") || null != o.data("df-lightbox") ? o.trigger("click") : null != o.attr("href") && o.attr("href").indexOf(".pdf") > -1 && o.trigger("click")
}
}
}
})
}
,
l.focusHash = function(e) {
var t, i;
null === (t = (i = e[0]).scrollIntoView) || void 0 === t || t.call(i, {
behavior: "smooth",
block: "nearest",
inline: "nearest"
})
}
,
l.contain = function(e, t, i, n) {
var o = Math.min(i / e, n / t);
return {
width: e * o,
height: t * o
}
}
,
l.containUnStretched = function(e, t, i, n) {
var o = Math.min(1, i / e, n / t);
return {
width: e * o,
height: t * o
}
}
,
l.fallbackOptions = function(e) {
return void 0 === e.share.mail && (e.share.mail = "mailto:?subject=" + e.text.mailSubject + "&body=" + e.text.mailBody),
e.openPage && (e.openPage = parseInt(e.openPage, 10)),
e
}
;
var p = function(e) {
var t = {}
, i = {
id: "",
thumb: "",
openPage: "data-hash-page,df-page,data-df-page,data-page,page",
target: "",
height: "",
showDownloadControl: "data-download",
source: "pdf-source,df-source,source",
is3D: "webgl,is3d",
viewerType: "viewertype,viewer-type",
pagemode: ""
};
for (var n in i)
for (var o = (n + "," + i[n]).split(","), a = 0; a < o.length; a++) {
var s = o[a];
if ("" !== s) {
var r = e.data(s);
if (null !== r && "" !== r && void 0 !== r || null !== (r = e.attr(s)) && "" !== r && void 0 !== r) {
t[n] = r;
break
}
}
}
return e.removeAttr("data-hash-page"),
t
};
l.getOptions = function(e) {
void 0 == (e = a(e)).data("df-option") & void 0 == e.data("option") && e.data("df-option", "option_" + e.attr("id")),
void 0 !== e.attr("source") && e.data("df-source", e.attr("source"));
var t = e.data("df-option") || e.data("option")
, i = void 0;
i = (void 0 === t ? "undefined" : t && "undefined" != typeof Symbol && t.constructor === Symbol ? "symbol" : typeof t) == "object" ? t : null == t || "" === t || null == window[t] ? {} : window[t];
var n = p(e);
return a.extend(!0, {}, i, n)
}
,
l.isTrue = function(e) {
return "true" === e || !0 === e
}
,
l.parseInt = function(e) {
return parseInt(e, 10)
}
,
l.parseFloat = function(e) {
return parseFloat(e)
}
,
l.parseIntIfExists = function(e) {
return void 0 !== e && (e = parseInt(e, 10)),
e
}
,
l.parseFloatIfExists = function(e) {
return void 0 !== e && (e = parseFloat(e)),
e
}
,
l.parseBoolIfExists = function(e) {
return void 0 !== e && (e = l.isTrue(e)),
e
}
,
l.getCurveAngle = function(e, t) {
var i, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
return e ? (i = t > 135 ? 180 - (180 - t) * 2 : t > 45 ? t - 45 : 0,
i = l.limitAt(i, n, 180)) : (i = t < 45 ? 2 * t : t < 135 ? t + 45 : 180,
i = l.limitAt(i, 0, 180 - n)),
i
}
,
l.sanitizeOptions = function(e) {
var t, i;
if (e.showDownloadControl = l.parseBoolIfExists(e.showDownloadControl),
e.showSearchControl = l.parseBoolIfExists(e.showSearchControl),
e.showPrintControl = l.parseBoolIfExists(e.showPrintControl),
e.flipbook3DTiltAngleLeft = l.parseIntIfExists(e.flipbook3DTiltAngleLeft),
e.flipbook3DTiltAngleUp = l.parseIntIfExists(e.flipbook3DTiltAngleUp),
e.paddingLeft = l.parseIntIfExists(e.paddingLeft),
e.paddingRight = l.parseIntIfExists(e.paddingRight),
e.paddingTop = l.parseIntIfExists(e.paddingTop),
e.paddingBottom = l.parseIntIfExists(e.paddingBottom),
e.duration = l.parseIntIfExists(e.duration),
e.rangeChunkSize = l.parseIntIfExists(e.rangeChunkSize),
e.maxTextureSize = l.parseIntIfExists(e.maxTextureSize),
e.linkTarget = l.parseIntIfExists(e.linkTarget),
e.zoomRatio = l.parseFloatIfExists(e.zoomRatio),
e.enableAnalytics = l.parseBoolIfExists(e.enableAnalytics),
e.autoPlay = l.parseBoolIfExists(e.autoPlay),
e.autoPlayStart = l.parseBoolIfExists(e.autoPlayStart),
e.autoPlayDuration = l.parseIntIfExists(e.autoPlayDuration),
void 0 !== e.loadMoreCount && (e.loadMoreCount = l.parseInt(e.loadMoreCount),
(isNaN(e.loadMoreCount) || 0 === e.loadMoreCount) && (e.loadMoreCount = -1)),
null != e.source && (Array === e.source.constructor || Array.isArray(e.source) || (t = e.source,
null != (i = Array) && "undefined" != typeof Symbol && i[Symbol.hasInstance] ? !!i[Symbol.hasInstance](t) : t instanceof i)))
for (var n = 0; n < e.source.length; n++)
e.source[n] = l.httpsCorrection(e.source[n]);
else
e.source = l.httpsCorrection(e.source);
return e
}
,
l.finalizeOptions = function(e) {
return e
}
,
l.urlify = function(e) {
for (var t, i, n = /[a-zA-Z0-9][^\s,]{3,}\.[^\s,]+[a-zA-Z0-9]/gi, o = []; t = n.exec(e); ) {
var a = t[0];
1 == (a.match(/@/g) || []).length ? a.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+/gi) && o.push({
index: t.index,
length: a.length,
text: a
}) : a.match(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b[-a-zA-Z0-9@:%_\+.~#?&//=]*/g) && (0 === (i = a.toLowerCase()).indexOf("http:") || 0 === i.indexOf("https:") || 0 === i.indexOf("www.")) && o.push({
index: t.index,
length: a.length,
text: a
})
}
return o
}
,
l.oldurlify = function(e) {
return e.replace(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)/g, function(e, t, i, n, o) {
var a = e = e.toLowerCase();
if (e.indexOf(":") > 0 && -1 === e.indexOf("http:") && -1 === e.indexOf("https:"))
return l.log("AutoLink Rejected: " + a + " for " + e),
e;
if (0 === e.indexOf("www."))
a = "http://" + e;
else if (0 === e.indexOf("http://") || 0 === e.indexOf("https://"))
;
else if (0 === e.indexOf("mailto:"))
;
else if (e.indexOf("@") > 0 && (a = "mailto:" + e,
null === e.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)))
return l.log("AutoLink Rejected: " + a + " for " + e),
e;
return l.log("AutoLink: " + a + " for " + e),
'<a href="' + a + '" class="df-autolink" target="_blank">' + e + "</a>"
})
}
,
l.supportsPassive = !1;
try {
var c = Object.defineProperty({}, "passive", {
get: function() {
l.supportsPassive = !0
}
});
window.addEventListener("testPassive", null, c),
window.removeEventListener("testPassive", null, c)
} catch (e) {}
n.parseCSSElements = function() {
a(".dvcss").each(function() {
var e, t = a(this), i = function(e) {
for (var t, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "dvcss_e_", n = e.classList, o = 0; o < n.length; o++)
if (0 === (t = n[o]).indexOf(i))
return t;
return null
}(t[0]);
t.removeClass(i).removeClass("dvcss"),
i = i.replace("dvcss_e_", "");
try {
e = JSON.parse(atob(i))
} catch (e) {}
if (e) {
var n = "df_option_" + e.id;
window[n] = a.extend(!0, {}, window[n], e),
t.addClass("df-element"),
"none" !== e.lightbox && (t.attr("data-df-lightbox", void 0 === e.lightbox ? "custom" : e.lightbox),
"thumb" == e.lightbox && t.attr("data-df-thumb", e.pdfThumb),
e.thumbLayout && t.attr("data-df-thumb-layout", e.thumbLayout),
e.apl && t.attr("apl", e.apl)),
t.data("df-option", n),
t.attr("data-df-slug", e.slug),
t.attr("id", "df_" + e.id)
}
})
}
,
n.parseThumbs = function(e) {
e.element.html(""),
(null == e.thumbURL || "" == e.thumbURL.toString().trim()) && (e.element.addClass("df-thumb-not-found"),
e.thumbURL = n.defaults.popupThumbPlaceholder);
var t = a("<span class='df-book-title'>").html(e.title)
, i = a("<div class='df-book-wrapper'>").appendTo(e.element);
i.append(a("<div class='df-book-page1'>")),
i.append(a("<div class='df-book-page2'>"));
var o = a("<div class='df-book-cover'>").append(t).appendTo(i)
, s = a('<img width="210px" height="297px" class="df-lazy" alt="' + e.title + '"/>');
s.attr("data-src", e.thumbURL),
s.attr("src", n.defaults.popupThumbPlaceholder),
o.prepend(s),
n.addLazyElement(s[0]),
!0 === n.defaults.displayLightboxPlayIcon && o.addClass("df-icon-play-popup"),
"book-title-top" === e.thumbLayout ? t.prependTo(e.element) : ("book-title-bottom" === e.thumbLayout || "cover-title" === e.thumbLayout) && (e.hasShelf ? e.thumbLayout = "book-title-fixed" : t.appendTo(e.element),
!0 === n.defaults.displayLightboxPlayIcon && (e.element.removeClass("df-icon-play-popup"),
i.addClass("df-icon-play-popup"))),
e.element.addClass("df-tl-" + e.thumbLayout),
e.element.attr("title", e.title)
}
,
n.initId = 10,
n.embeds = [],
n.activeEmbeds = [],
n.removeEmbeds = [],
n.removeEmbedsLimit = l.isMobile ? 1 : 2,
n.parseNormalElements = function() {
a(".df-posts").each(function() {
if (!1 !== n.defaults.loadMoreCount && -1 !== n.defaults.loadMoreCount) {
var e = a(this);
if ("true" !== e.data("df-parsed")) {
e.data("df-parsed", "true"),
e.attr("df-parsed", "true");
var t = 0
, i = e.find(".df-element")
, o = i.length;
i.each(function() {
++t > n.defaults.loadMoreCount && a(this).attr("skip-parse", "true")
}),
o > n.defaults.loadMoreCount && e.append("<div class='df-load-more-button-wrapper'><div class='df-load-more-button'>Load More..</div></div>")
}
}
}),
n.triggerId = 10,
a(".df-element").each(function() {
var e = a(this);
if ("true" !== e.attr("skip-parse") && "true" !== e.data("df-parsed")) {
e.data("df-parsed", "true"),
e.attr("df-parsed", "true");
var t = e.data("df-lightbox") || e.data("lightbox");
if (void 0 === t)
e.addClass("df-lazy-embed"),
n.addLazyElement(e[0]);
else if (e.addClass("df-popup-" + t),
"thumb" === t) {
var i = e.data("df-thumb-layout") || n.defaults.thumbLayout
, o = l.httpsCorrection(e.data("df-thumb"));
e.removeAttr("data-thumb").removeAttr("data-thumb-layout");
var s = e.html().trim();
(void 0 === s || "" === s) && (s = "Click to Open");
var r = e.parent().hasClass("df-has-shelf");
n.parseThumbs({
element: e,
thumbURL: o,
title: s,
thumbLayout: i,
hasShelf: r
}),
r && e.after(a("<df-post-shelf>"))
} else
"button" === t && n.defaults.buttonClass && e.addClass(n.defaults.buttonClass);
var h = e.attr("data-trigger");
null != h && h.length > 1 && (h = h.split(","),
n.triggerId++,
h.forEach(function(t) {
e.attr("df-trigger-id", n.triggerId),
a("#" + t).addClass("df-trigger").attr("df-trigger", n.triggerId)
}))
}
}),
n.handleLazy = function() {
var e;
if (n.removeEmbeds.length > n.removeEmbedsLimit && (e = n.removeEmbeds.shift())) {
var t = a("[initID='" + e + "']");
if (t.length > 0) {
var i = t.data("df-app");
if (i) {
t.attr("data-df-page", i.currentPageNumber),
l.log("Removed app id " + e),
i.dispose(),
i = null;
var o = n.activeEmbeds.indexOf(e);
o > -1 && n.activeEmbeds.splice(o, 1)
}
}
}
if (e = n.embeds.shift()) {
var s = a("[initID='" + e + "']");
if (s.length > 0) {
if (s.is("img"))
s.hasClass("df-lazy") ? (s.attr("src", s.attr("data-src")),
s.removeAttr("data-src"),
s.removeClass("df-lazy"),
n.lazyObserver.unobserve(s[0])) : l.log("Prevent this"),
n.handleLazy();
else {
var r = s.data("df-app");
null == r ? s.dearviewer() : r.softInit(),
l.log("Created app id " + e),
n.activeEmbeds.push(e)
}
}
}
n.removeEmbeds.length <= n.removeEmbedsLimit && 0 == n.embeds.length && (n.checkRequestQueue = null)
}
}
,
n.lazyObserver = {
observe: function(e) {
(e = a(e)).is("img") ? e.hasClass("df-lazy") && (e.attr("src", e.attr("data-src")),
e.removeAttr("data-src"),
e.removeClass("df-lazy")) : e.dearviewer()
}
},
"function" == typeof IntersectionObserver && (n.lazyObserver = new IntersectionObserver(function(e, t) {
e.forEach(function(e) {
var t, i = a(e.target), o = i.attr("initID");
e.isIntersecting ? (!i.attr("initID") && (i.attr("initID", n.initId),
o = n.initId.toString(),
n.initId++),
(t = n.removeEmbeds.indexOf(o)) > -1 ? (n.removeEmbeds.splice(t, 1),
l.log("Removed id " + o + "from Removal list")) : -1 == (t = n.embeds.indexOf(o)) && (n.embeds.push(o),
l.log("Added id " + o + "to Add list"))) : o && ((t = n.embeds.indexOf(o)) > -1 ? (n.embeds.splice(t, 1),
l.log("Removed id " + o + " from Add list")) : -1 == (t = n.removeEmbeds.indexOf(o)) && (n.removeEmbeds.push(o),
l.log("Added id " + o + " to Removal list"))),
d = 0,
(n.removeEmbeds.length > n.removeEmbedsLimit || n.embeds.length > 0) && null == n.checkRequestQueue && (n.checkRequestQueue = function() {
d++,
n.checkRequestQueue && requestAnimationFrame(function() {
n && n.checkRequestQueue && n.checkRequestQueue()
}),
d > 20 && (d = 0,
n.handleLazy())
}
,
n.checkRequestQueue())
})
}
));
var d = 0;
n.addLazyElement = function(e) {
n.lazyObserver.observe(e)
}
,
n.parseElements = l.parseElements = function() {
n.parseCSSElements(),
n.parseNormalElements()
}
,
n.initUtils = function() {
l.detectScriptLocation();
var e = a("body");
(l.isSafari || l.isIOS) && e.addClass("df-ios"),
e.on("click", function() {}),
e.on("click", ".df-posts .df-load-more-button", function() {
var e = a(this).closest(".df-posts");
if (e.length > 0) {
var t = 0;
e.find(".df-element").each(function() {
var e = a(this);
"true" === e.attr("skip-parse") && (t < n.defaults.loadMoreCount && e.removeAttr("skip-parse"),
t++)
}),
n.parseNormalElements()
}
}),
n.defaults.shelfImage && "" != n.defaults.shelfImage && e.append("<style>.df-has-shelf df-post-shelf:before, .df-has-shelf df-post-shelf:after{background-image: url('" + n.defaults.shelfImage + "');}</style>")
}
;
var f = n.utils
, g = /*#__PURE__*/
function() {
var e;
function t(e, i) {
(function(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
)(this, t),
this.pages = [],
this.app = i,
this.parentElement = this.app.viewerContainer;
var n = "df-viewer " + (e.viewerClass || "");
this.element = jQuery("<div>", {
class: n
}),
this.parentElement.append(this.element),
this.wrapper = jQuery("<div>", {
class: "df-viewer-wrapper"
}),
this.element.append(this.wrapper),
this.oldBasePageNumber = 0,
this.pages = [],
this.minZoom = 1,
this.maxZoom = 4,
this.swipeThreshold = 20,
this.stageDOM = null,
this.events = {},
this.arrowKeysAction = e.arrowKeysAction,
this.clickAction = e.clickAction,
this.scrollAction = e.scrollAction,
this.dblClickAction = e.dblClickAction,
this.pageBuffer = [],
this.pageBufferSize = 10
}
return e = [{
key: "init",
value: function() {}
}, {
key: "softDispose",
value: function() {}
}, {
key: "updateBuffer",
value: function(e) {}
}, {
key: "pageResetCallback",
value: function(e) {}
}, {
key: "initCustomControls",
value: function() {}
}, {
key: "_getInnerWidth",
value: function() {
return this.app.dimensions.containerWidth - this.app.dimensions.padding.width - this.app.dimensions.offset.width
}
}, {
key: "_getInnerHeight",
value: function() {
return this.app.dimensions.maxHeight - this.app.dimensions.padding.height
}
}, {
key: "_getOuterHeight",
value: function(e) {
return e
}
}, {
key: "dispose",
value: function() {
this.stageDOM && (this.stageDOM.removeEventListener("mousemove", this.events.mousemove, !1),
this.stageDOM.removeEventListener("mousedown", this.events.mousedown, !1),
this.stageDOM.removeEventListener("mouseup", this.events.mouseup, !1),
this.stageDOM.removeEventListener("touchmove", this.events.mousemove, !1),
this.stageDOM.removeEventListener("touchstart", this.events.mousedown, !1),
this.stageDOM.removeEventListener("touchend", this.events.mouseup, !1),
this.stageDOM.removeEventListener("dblclick", this.events.dblclick, !1),
this.stageDOM.removeEventListener("scroll", this.events.scroll, !1),
this.stageDOM.removeEventListener("mousewheel", this.events.mousewheel, !1),
this.stageDOM.removeEventListener("DOMMouseScroll", this.events.mousewheel, !1)),
this.events = null,
this.stageDOM = null,
this.element.remove()
}
}, {
key: "checkDocumentPageSizes",
value: function() {}
}, {
key: "getViewerPageNumber",
value: function(e) {
return e
}
}, {
key: "getDocumentPageNumber",
value: function(e) {
return e
}
}, {
key: "getRenderContext",
value: function(e, t) {
var i = this.app
, o = i.provider
, a = t.pageNumber
, s = f.ifdef(t.textureTarget, n.TEXTURE_TARGET.VIEWER);
i.dimensions.pageFit;
var r = o.viewPorts[a]
, l = i.viewer.getTextureSize(t)
, h = null;
if (h = s === n.TEXTURE_TARGET.THUMB ? i.thumbSize : Math.floor(l.height),
void 0 === o.getCache(a, h)) {
var u = l.height / r.height
, p = document.createElement("canvas")
, c = this.filterViewPort(e.getViewport({
scale: u,
rotation: e._pageInfo.rotate + i.options.pageRotation
}), a);
s === n.TEXTURE_TARGET.THUMB && (u = c.width / c.height > 180 / i.thumbSize ? 180 * u / c.width : u * i.thumbSize / c.height,
c = this.filterViewPort(e.getViewport({
scale: u,
rotation: e._pageInfo.rotate + i.options.pageRotation
}), a)),
p.height = Math.floor(c.height),
p.width = Math.floor(c.width);
var d = Math.abs(p.width - l.width) / l.width * 100;
return d > .001 && d < 2 && (p.width = Math.floor(l.width),
p.height = Math.floor(l.height)),
i.viewer.filterViewPortCanvas(c, p, a),
{
canvas: p,
canvasContext: p.getContext("2d", {
willReadFrequently: !0 === n.defaults.canvasWillReadFrequently
}),
viewport: c
}
}
}
}, {
key: "filterViewPort",
value: function(e, t) {
return e
}
}, {
key: "getViewPort",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = this.app.provider.viewPorts[e];
return t ? null != i ? i : this.app.provider.defaultPage.viewPort : i
}
}, {
key: "pagesReady",
value: function() {}
}, {
key: "onReady",
value: function() {}
}, {
key: "filterViewPortCanvas",
value: function(e) {}
}, {
key: "finalizeAnnotations",
value: function() {}
}, {
key: "finalizeTextContent",
value: function() {}
}, {
key: "updateTextContent",
value: function(e) {
void 0 == e && (e = this.getBasePage(e)),
this.app.provider.processTextContent(e, this.getTextElement(e, !0))
}
}, {
key: "isActivePage",
value: function(e) {
return e === this.app.currentPageNumber
}
}, {
key: "initEvents",
value: function() {
var e = this.stageDOM = f.ifdef(this.stageDOM, this.parentElement[0]);
e && (e.addEventListener("mousemove", this.events.mousemove = this.mouseMove.bind(this), !1),
e.addEventListener("mousedown", this.events.mousedown = this.mouseDown.bind(this), !1),
e.addEventListener("mouseup", this.events.mouseup = this.mouseUp.bind(this), !1),
e.addEventListener("touchmove", this.events.mousemove = this.mouseMove.bind(this), !1),
e.addEventListener("touchstart", this.events.mousedown = this.mouseDown.bind(this), !1),
e.addEventListener("touchend", this.events.mouseup = this.mouseUp.bind(this), !1),
e.addEventListener("dblclick", this.events.dblclick = this.dblclick.bind(this), !1),
e.addEventListener("scroll", this.events.scroll = this.onScroll.bind(this), !1),
e.addEventListener("mousewheel", this.events.mousewheel = this.mouseWheel.bind(this), !1),
e.addEventListener("DOMMouseScroll", this.events.mousewheel = this.mouseWheel.bind(this), !1)),
this.startTouches = null,
this.lastScale = null,
this.startPoint = null
}
}, {
key: "refresh",
value: function() {}
}, {
key: "reset",
value: function() {}
}, {
key: "eventToPoint",
value: function(e) {
var t = {
x: e.clientX,
y: e.clientY
};
return t.x = t.x - this.app.viewerContainer[0].getBoundingClientRect().left,
t.y = t.y - this.app.viewerContainer[0].getBoundingClientRect().top,
{
raw: t
}
}
}, {
key: "mouseMove",
value: function(e) {
e = f.fixMouseEvent(e),
this.pinchMove(e),
!0 === this.pinchZoomDirty && e.preventDefault(),
this.startPoint && !0 != this.pinchZoomDirty && (this.pan(this.eventToPoint(e)),
e.preventDefault())
}
}, {
key: "mouseDown",
value: function(e) {
e = f.fixMouseEvent(e),
this.pinchDown(e),
this.startPoint = this.eventToPoint(e)
}
}, {
key: "mouseUp",
value: function(e) {
e = f.fixMouseEvent(e),
!0 === this.pinchZoomDirty && e.preventDefault();
var t = this.eventToPoint(e)
, i = e.target || e.originalTarget
, n = this.startPoint && t.x === this.startPoint.x && t.y === this.startPoint.y && "A" !== i.nodeName;
!0 === e.ctrlKey && n && this.zoomOnPoint(t),
this.pinchUp(e),
this.startPoint = null
}
}, {
key: "pinchDown",
value: function(e) {}
}, {
key: "pinchUp",
value: function(e) {}
}, {
key: "pinchMove",
value: function(e) {}
}, {
key: "updateTemporaryScale",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
if (!0 === e)
this.parentElement[0].style.transform = "none";
else if (this.app.viewer.zoomCenter) {
var t = this.app.viewer.pinchZoomUpdateScale;
this.parentElement[0].style.transformOrigin = this.app.viewer.zoomCenter.x + "px " + this.app.viewer.zoomCenter.y + "px",
this.parentElement[0].style.transform = "scale3d(" + t + "," + t + ",1)"
}
}
}, {
key: "pan",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
this.panRequestStatus = n.REQUEST_STATUS.ON,
f.pan(this, e, t)
}
}, {
key: "updatePan",
value: function() {
this.element.css({
transform: "translate3d(" + this.left + "px," + this.top + "px,0)"
})
}
}, {
key: "dblclick",
value: function(e) {}
}, {
key: "onScroll",
value: function(e) {}
}, {
key: "mouseWheel",
value: function(e) {
var t = this.app
, i = f.getMouseDelta(e)
, o = !0 === e.ctrlKey
, a = t.options.mouseScrollAction === n.MOUSE_SCROLL_ACTIONS.ZOOM && (!0 === t.options.isLightBox || !0 === t.isFullscreen);
o || a ? (i > 0 || i < 0) && (e.preventDefault(),
t.viewer.zoomCenter = this.eventToPoint(e).raw,
t.zoom(i),
t.ui.update()) : t.options.mouseScrollAction === n.MOUSE_SCROLL_ACTIONS.NAV && (i > 0 ? t.next() : i < 0 && t.prev())
}
}, {
key: "zoomOnPoint",
value: function(e) {
this.app.viewer.zoomCenter = e.raw,
this.app.zoom(1)
}
}, {
key: "getVisiblePages",
value: function() {
return this.visiblePagesCache = [],
{
main: this.visiblePagesCache,
buffer: []
}
}
}, {
key: "getBasePage",
value: function() {
return this.app.currentPageNumber
}
}, {
key: "isFirstPage",
value: function(e) {
return void 0 === e && (e = this.app.currentPageNumber),
1 === e
}
}, {
key: "isLastPage",
value: function(e) {
return void 0 === e && (e = this.app.currentPageNumber),
e === this.app.pageCount
}
}, {
key: "isEdgePage",
value: function(e) {
return void 0 === e && (e = this.app.currentPageNumber),
1 === e || e === this.app.pageCount
}
}, {
key: "checkRequestQueue",
value: function() {
var e = n.REQUEST_STATUS;
this.panRequestStatus === e.ON && (this.updatePan(),
this.panRequestStatus = e.OFF),
this.app.viewer.pinchZoomRequestStatus === e.ON && (this.app.viewer.updateTemporaryScale(),
this.app.viewer.pinchZoomRequestStatus = e.OFF)
}
}, {
key: "isAnimating",
value: function() {
return !1
}
}, {
key: "updatePendingStatusClass",
value: function(e) {
void 0 === e && (e = this.isAnimating()),
this.app.container.toggleClass("df-pending", e)
}
}, {
key: "initPages",
value: function() {}
}, {
key: "resize",
value: function() {}
}, {
key: "determinePageMode",
value: function() {}
}, {
key: "zoom",
value: function() {}
}, {
key: "gotoPageCallBack",
value: function() {
this.requestRefresh()
}
}, {
key: "requestRefresh",
value: function() {
var e = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0];
this.app.refreshRequestStatus = !0 === e ? n.REQUEST_STATUS.ON : n.REQUEST_STATUS.OFF
}
}, {
key: "getPageByNumber",
value: function(e) {
var t = this.pages
, i = void 0;
if (this.app.isValidPage(e)) {
for (var n = 0; n < t.length; n++)
if (e === t[n].pageNumber) {
i = t[n];
break
}
}
return i
}
}, {
key: "changeAnnotation",
value: function() {
return !1
}
}, {
key: "getAnnotationElement",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = this.getPageByNumber(e);
if (void 0 !== i)
return void 0 === i.annotationElement && (i.annotationElement = jQuery("<div class='df-link-content'>"),
i.contentLayer.append(i.annotationElement)),
!0 === t && i.annotationElement.html(""),
i.annotationElement[0]
}
}, {
key: "getTextElement",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = this.getPageByNumber(e);
if (void 0 !== i)
return void 0 === i.textElement && (i.textElement = jQuery("<div class='df-text-content'>"),
i.contentLayer.append(i.textElement)),
!0 === t && (i.textElement.html(""),
i.textElement.siblings(".df-auto-link-content").html("")),
i.textElement[0]
}
}, {
key: "render",
value: function() {}
}, {
key: "textureLoadedCallback",
value: function(e) {}
}, {
key: "handleZoom",
value: function() {}
}, {
key: "getTextureSize",
value: function(e) {
console.error("Texture calculation missing!")
}
}, {
key: "textureHeightLimit",
value: function(e) {
return f.limitAt(e, 1, this.app.dimensions.maxTextureHeight)
}
}, {
key: "textureWidthLimit",
value: function(e) {
return f.limitAt(e, 1, this.app.dimensions.maxTextureWidth)
}
}, {
key: "setPage",
value: function(e) {
f.log("Set Page detected", e.pageNumber);
var t = this.getPageByNumber(e.pageNumber);
return !!t && (e.callback = this.textureLoadedCallback.bind(this),
t.loadTexture(e),
this.updateBuffer(t),
!0)
}
}, {
key: "cleanPage",
value: function(e) {
return !0
}
}, {
key: "validatePageChange",
value: function(e) {
return e !== this.app.currentPageNumber
}
}, {
key: "afterControlUpdate",
value: function() {}
}, {
key: "searchPage",
value: function(e) {
return {
include: !0,
label: this.app.provider.getLabelforPage(e)
}
}
}],
function(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}(t.prototype, e),
t
}();
function v(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function m(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function y(e, t, i) {
return t && m(e.prototype, t),
i && m(e, i),
e
}
function b(e) {
return (b = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function w(e, t) {
return (w = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
var P = n.utils
, S = /*#__PURE__*/
function(e) {
!function(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && w(e, t)
}(n, e);
var t, i = (t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}(),
function() {
var e, i = b(n);
return e = t ? Reflect.construct(i, arguments, b(this).constructor) : i.apply(this, arguments),
e && ("object" == (e && "undefined" != typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e) || "function" == typeof e) ? e : function(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}(this)
}
);
function n(e) {
var t;
return v(this, n),
(t = i.call(this)).canvasMode = null,
e && e.parentElement && (t.parentElement = e.parentElement),
t.init(),
t
}
return y(n, [{
key: "init",
value: function() {
var e = this.element = jQuery("<div>", {
class: "df-page"
});
e[0].appendChild(this.contentLayer[0]),
this.texture = new Image,
this.parentElement && this.parentElement[0].append(e[0])
}
}, {
key: "resetContent",
value: function() {
void 0 !== this.annotationElement && this.annotationElement.html(""),
void 0 !== this.textElement && this.textElement.html("")
}
}, {
key: "setLoading",
value: function() {
this.element.toggleClass("df-loading", !0 !== this.textureLoaded)
}
}, {
key: "loadTexture",
value: function(e) {
var t = this
, i = e.texture
, n = e.callback;
function o() {
t.textureSrc = i,
t.element.css({
backgroundImage: P.bgImage(i)
}),
t.updateTextureLoadStatus(!0),
"function" == typeof n && n(e)
}
null === t.canvasMode && i && "CANVAS" === i.nodeName && (t.canvasMode = !0),
!0 === t.canvasMode ? (t.element.find(">canvas").remove(),
i !== t.textureLoadFallback && (t.textureSrc = i,
t.element.append(jQuery(i))),
t.updateTextureLoadStatus(!0),
"function" == typeof n && n(e)) : i === t.textureLoadFallback ? o() : (t.texture.onload = o,
t.texture.src = i)
}
}, {
key: "updateCSS",
value: function(e) {
this.element.css(e)
}
}, {
key: "resetCSS",
value: function() {
this.element.css({
transform: "",
boxShadow: "",
display: "block"
})
}
}]),
n
}(/*#__PURE__*/
function() {
function e() {
v(this, e),
this.textureLoadFallback = "images/load.png",
this.textureStamp = "-1",
this.textureLoaded = !1,
this.texture = "blank",
this.textureSrc = "blank",
this.pageNumber = void 0,
this.contentLayer = jQuery("<div>", {
class: "df-page-content"
})
}
return y(e, [{
key: "reset",
value: function() {
this.resetTexture(),
this.resetContent()
}
}, {
key: "resetTexture",
value: function() {
this.textureLoaded = !1,
this.textureStamp = "-1",
this.loadTexture({
texture: this.textureLoadFallback
}),
this.contentLayer.removeClass("df-content-loaded")
}
}, {
key: "clearTexture",
value: function() {
this.loadTexture({
texture: this.textureLoadFallback
})
}
}, {
key: "resetContent",
value: function() {}
}, {
key: "loadTexture",
value: function(e) {}
}, {
key: "getTexture",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
, t = this.textureSrc;
return !0 === e && t && t.cloneNode && (t = t.cloneNode()).getContext && t.getContext("2d").drawImage(this.textureSrc, 0, 0),
t
}
}, {
key: "setLoading",
value: function() {}
}, {
key: "updateTextureLoadStatus",
value: function(e) {
this.textureLoaded = !0 === e,
P.log((!0 === this.textureLoaded ? "Loaded " : "Loading ") + this.textureStamp + " for " + this.pageNumber),
this.contentLayer.toggleClass("df-content-loaded", !0 === e),
this.setLoading()
}
}, {
key: "changeTexture",
value: function(e, t) {
var i = e + "|" + t;
return this.textureStamp !== i && (P.log("Page " + e + " : texture changed from - " + this.textureStamp + " to " + i),
this.textureLoaded = !1,
this.textureStamp = i,
this.updateTextureLoadStatus(!1),
!0)
}
}]),
e
}());
function C(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function x(e, t, i) {
return (x = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, i) {
var n = function(e, t) {
for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = T(e)); )
;
return e
}(e, t);
if (n) {
var o = Object.getOwnPropertyDescriptor(n, t);
return o.get ? o.get.call(i || e) : o.value
}
}
)(e, t, i || e)
}
function T(e) {
return (T = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function k(e, t) {
return (k = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
var E = n.utils
, O = /*#__PURE__*/
function(e) {
!function(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && k(e, t)
}(a, e);
var t, i, o = (t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}(),
function() {
var e, i = T(a);
return e = t ? Reflect.construct(i, arguments, T(this).constructor) : i.apply(this, arguments),
e && ("object" == (e && "undefined" != typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e) || "function" == typeof e) ? e : C(this)
}
);
function a(e, t) {
var i;
return function(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}(this, a),
e.viewerClass = "df-reader",
t.options.mouseScrollAction = n.MOUSE_SCROLL_ACTIONS.NONE,
(i = o.call(this, e, t)).app.jumpStep = 1,
i.minZoom = .25,
i.stackCount = i.app.pageCount,
i.app.options.paddingLeft = 0,
i.app.options.paddingRight = 0,
i.app.options.paddingTop = 10,
i.app.options.paddingBottom = !0 === i.app.options.controlsFloating ? 20 : 10,
i.app.pageScaling = i.app.options.pageScale,
i.acceptAppMouseEvents = !0,
i.scrollStatus = n.REQUEST_STATUS.OFF,
i.deltaPanX = 0,
i.deltaPanY = 0,
t._viewerPrepared(),
i.zoomViewer = C(i),
i
}
return i = [{
key: "init",
value: function() {
x(T(a.prototype), "init", this).call(this),
this.initEvents(),
this.initPages(),
this.initScrollBar()
}
}, {
key: "initEvents",
value: function() {
this.stageDOM = this.element[0],
x(T(a.prototype), "initEvents", this).call(this)
}
}, {
key: "initPages",
value: function() {
this.stackCount = this.app.pageCount;
for (var e = 0; e < this.stackCount; e++) {
var t = new S({
parentElement: this.wrapper
});
t.index = e,
t.viewer = this,
this.pages.push(t)
}
}
}, {
key: "initScrollBar",
value: function() {
this.scrollBar = jQuery("<div class='df-reader-scrollbar'>"),
this.scrollBar.appendTo(this.app.container),
this.scrollPageNumber = jQuery("<div class='df-reader-scroll-page-number'>").appendTo(this.app.container)
}
}, {
key: "afterControlUpdate",
value: function() {
void 0 !== this.scrollBar && (this.scrollBar[0].innerHTML = this.app.getCurrentLabel(),
this.app.provider.pageLabels ? this.scrollPageNumber[0].innerHTML = this.app.getCurrentLabel() + "<div>(" + this.app.currentPageNumber + " of " + this.app.pageCount + ")</div>" : this.scrollPageNumber[0].innerHTML = this.app.getCurrentLabel() + "<div>of " + this.app.pageCount + "</div>")
}
}, {
key: "updateBuffer",
value: function(e) {
if ("-1" !== e.textureStamp && void 0 !== e.pageNumber) {
for (var t = e.pageNumber, i = e.pageNumber, n = 0, o = 0; o < this.pageBuffer.length; o++) {
var a = this.pageBuffer[o].pageNumber;
if (t === a) {
E.log("Page " + t + " already in buffer, skipping");
return
}
Math.abs(this.app.currentPageNumber - a) > Math.abs(this.app.currentPageNumber - i) && (i = a,
n = o)
}
this.pageBuffer.push(e),
this.pageBuffer.length > this.pageBufferSize && (E.log("Farthest buffer: " + i),
this.pageBuffer[n].reset(),
this.pageBuffer.splice(n, 1))
}
}
}, {
key: "initCustomControls",
value: function() {
var e = this.app.ui.controls;
e.openRight.hide(),
e.openLeft.hide()
}
}, {
key: "dispose",
value: function() {
x(T(a.prototype), "dispose", this).call(this),
this.scrollBar && this.scrollBar.remove(),
this.scrollPageNumber && this.scrollPageNumber.remove(),
this.element.remove()
}
}, {
key: "_getInnerHeight",
value: function() {
x(T(a.prototype), "_getInnerHeight", this).call(this);
var e = this.app.dimensions.maxHeight - this.app.dimensions.padding.height
, t = this.app.dimensions.defaultPage.viewPort
, i = this.app.dimensions.containerWidth - 20 - this.app.dimensions.padding.width;
this.app.pageScaling === n.PAGE_SCALE.ACTUAL && (i = 1 * this.app.provider.defaultPage.viewPort.width);
var o = e;
return this.app.pageScaling === n.PAGE_SCALE.PAGE_WIDTH ? o = 100 * t.height : this.app.pageScaling === n.PAGE_SCALE.AUTO ? o = 1.5 * t.height : this.app.pageScaling === n.PAGE_SCALE.ACTUAL && (o = 1 * t.height),
o -= 2,
this._containCover = E.contain(t.width, t.height, i, o),
o = Math.min(e, this._containCover.height + 2),
this.app.pageScaleValue = this._containCover.height / t.height,
this.app.dimensions.isFixedHeight ? e : o
}
}, {
key: "handleZoom",
value: function() {
var e = this.app
, t = this.maxZoom = 4
, i = e.zoomValue;
!0 === e.pendingZoom && null != e.zoomDelta ? i = e.zoomDelta > 0 ? i * e.options.zoomRatio : i / e.options.zoomRatio : null != this.lastScale && (i *= this.lastScale,
this.lastScale = null),
i = E.limitAt(i, this.minZoom, t),
e.zoomValueChange = i / e.zoomValue,
e.zoomChanged = e.zoomValue !== i,
e.zoomValue = i
}
}, {
key: "resize",
value: function() {
var e = this.app;
e.dimensions;
var t = e.dimensions.padding
, i = this.shiftHeight = 0;
this.element.css({
top: -i,
bottom: -i,
right: -0,
left: -0,
paddingTop: t.top,
paddingRight: t.right,
paddingBottom: t.bottom,
paddingLeft: t.left
});
for (var n = this.getVisiblePages().main[0] - 1, o = (n = this.pages[n].element[0]).getBoundingClientRect(), a = this.parentElement[0].getBoundingClientRect(), s = 0; s < this.pages.length; s++) {
var r = this.pages[s]
, l = this.getViewPort(s + 1, !0)
, h = r.element[0].style;
h.height = Math.floor(l.height * e.pageScaleValue * e.zoomValue) + "px",
h.width = Math.floor(l.width * e.pageScaleValue * e.zoomValue) + "px"
}
if (this.oldScrollHeight != this.element[0].scrollHeight && void 0 !== this.oldScrollHeight) {
var u, p = this.element[0].scrollHeight / this.oldScrollHeight;
this.skipScrollCheck = !0;
var c = n.offsetTop + n.clientTop - (o.top - a.top + n.clientTop) * p
, d = n.offsetLeft + n.clientLeft - (o.left - a.left + n.clientLeft) * p;
c += (p - 1) * 10 / 2,
d += (p - 1) * 10 / 2,
this.zoomCenter = null !== (u = this.zoomCenter) && void 0 !== u ? u : {
x: 0,
y: 0
},
c += (p - 1) * this.zoomCenter.y,
d += (p - 1) * this.zoomCenter.x,
this.zoomCenter = null,
this.element[0].scrollTop = c,
this.element[0].scrollLeft = d,
this.skipScrollCheck = !1
}
this.oldScrollHeight = this.element[0].scrollHeight,
this.scrollBar[0].style.transform = "none",
this.updateScrollBar()
}
}, {
key: "onReady",
value: function() {
this.gotoPageCallBack(),
this.oldScrollHeight = this.element[0].scrollHeight
}
}, {
key: "refresh",
value: function() {
for (var e = this.app, t = this.getVisiblePages().main, i = 0; i < t.length; i++) {
var o = void 0
, a = t[i];
o = this.pages[a - 1],
a !== o.pageNumber && (o.resetTexture(),
this.app.textureRequestStatus = n.REQUEST_STATUS.ON),
o.element.attr("number", a),
o.pageNumber = a
}
this.requestRefresh(!1),
e.textureRequestStatus = n.REQUEST_STATUS.ON
}
}, {
key: "isAnimating",
value: function() {
return this.scrollStatus === n.REQUEST_STATUS.ON || this.scrollStatus === n.REQUEST_STATUS.COUNT
}
}, {
key: "checkRequestQueue",
value: function() {
x(T(a.prototype), "checkRequestQueue", this).call(this),
this.scrollStatus === n.REQUEST_STATUS.ON && (this.scrollStatus = n.REQUEST_STATUS.OFF),
this.scrollStatus === n.REQUEST_STATUS.COUNT && (this.scrollStatus = n.REQUEST_STATUS.ON)
}
}, {
key: "isActivePage",
value: function(e) {
return void 0 !== this.visiblePagesCache && this.visiblePagesCache.includes(e)
}
}, {
key: "getVisiblePages",
value: function() {
var e = E.getVisibleElements({
container: this.element[0],
elements: this.wrapper[0].children
});
return e = 0 === e.length ? [this.app.currentPageNumber] : e.splice(0, this.pageBufferSize),
this.visiblePagesCache = e,
{
main: e,
buffer: []
}
}
}, {
key: "getPageByNumber",
value: function(e) {
var t = this.pages[e - 1];
return void 0 === t && E.log("Page Not found for: " + e),
t
}
}, {
key: "onScroll",
value: function(e) {
for (var t = this.element[0].scrollTop + this.app.dimensions.containerHeight / 2, i = this.getVisiblePages().main, o = i[0], a = 0; a < i.length; a++) {
o = i[a];
var s = this.pages[o - 1].element[0]
, r = s.offsetTop + s.clientTop;
if (r <= t && s.clientHeight + r >= t)
break;
if (a > 0 && r > t && s.clientHeight + r >= t) {
o = i[a - 1];
break
}
}
this.skipScrollIntoView = !0,
this.app.gotoPage(o),
this.skipScrollIntoView = !1,
this.updateScrollBar(),
e.preventDefault && e.preventDefault(),
e.stopPropagation(),
this.requestRefresh(),
this.scrollStatus = n.REQUEST_STATUS.COUNT,
n.handlePopup(this.element, !1)
}
}, {
key: "updateScrollBar",
value: function() {
var e = this.element[0];
this.app.container[0],
e.scrollLeft;
var t = 60 + (e.offsetHeight - 40 - 60 - 60) * e.scrollTop / (e.scrollHeight - e.offsetHeight);
isNaN(t) && (t = 60),
this.scrollBar.lastY = t,
this.scrollBar[0].style.transform = "translateY(" + t + "px)"
}
}, {
key: "validatePageChange",
value: function(e) {}
}, {
key: "gotoPageCallBack",
value: function() {
if (!0 !== this.skipScrollIntoView) {
var e = this.getPageByNumber(this.app.currentPageNumber);
null != e && E.scrollIntoView(e.element[0], this.element[0])
}
this.skipScrollIntoView = !1,
this.requestRefresh()
}
}, {
key: "getTextureSize",
value: function(e) {
var t = this.app.provider.viewPorts[1];
this.app.provider.viewPorts[e.pageNumber] && (t = this.app.provider.viewPorts[e.pageNumber]);
var i = this.app.options.pixelRatio;
return {
height: t.height * this.app.zoomValue * this.app.pageScaleValue * i,
width: t.width * this.app.zoomValue * this.app.pageScaleValue * i
}
}
}, {
key: "textureLoadedCallback",
value: function(e) {
var t = this.getPageByNumber(e.pageNumber)
, i = this.app
, n = this.getViewPort(e.pageNumber, !0);
t.element.height(Math.floor(n.height * i.pageScaleValue * i.zoomValue)).width(Math.floor(n.width * i.pageScaleValue * i.zoomValue))
}
}, {
key: "pan",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = this.startPoint
, o = e.raw.y - i.raw.y
, a = e.raw.x - i.raw.x;
this.deltaPanY += o,
this.deltaPanX += a,
this.panRequestStatus = n.REQUEST_STATUS.ON,
!1 === t && (this.startPoint = e)
}
}, {
key: "updatePan",
value: function() {
this.element[0].scrollTop = this.element[0].scrollTop - this.deltaPanY,
this.element[0].scrollLeft = this.element[0].scrollLeft - this.deltaPanX,
this.deltaPanY = 0,
this.deltaPanX = 0
}
}, {
key: "mouseMove",
value: function(e) {
if (this.startPoint && this.isScrollBarPressed) {
var t = E.fixMouseEvent(e)
, i = this.eventToPoint(t)
, n = this.element[0]
, o = this.scrollBar.lastY - (this.startPoint.raw.y - i.raw.y);
this.scrollBar.lastY = o,
n.scrollTop = (o - 60) * (n.scrollHeight - n.offsetHeight) / (n.offsetHeight - 40 - 60 - 60),
this.startPoint = i,
e.preventDefault();
return
}
e.touches && e.touches.length < 2 || x(T(a.prototype), "mouseMove", this).call(this, e)
}
}, {
key: "mouseDown",
value: function(e) {
x(T(a.prototype), "mouseDown", this).call(this, e),
e.srcElement === this.scrollBar[0] && (this.isScrollBarPressed = !0,
this.scrollBar.addClass("df-active"),
this.scrollPageNumber.addClass("df-active"))
}
}, {
key: "mouseUp",
value: function(e) {
x(T(a.prototype), "mouseUp", this).call(this, e),
(this.isScrollBarPressed = this.scrollBar) && (this.isScrollBarPressed = !1,
this.scrollBar.removeClass("df-active"),
this.scrollPageNumber.removeClass("df-active"))
}
}],
function(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}(a.prototype, i),
a
}(g);
function R(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function L(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function N(e, t, i) {
return t && L(e.prototype, t),
i && L(e, i),
e
}
function I(e, t, i) {
return (I = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, i) {
var n = function(e, t) {
for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = _(e)); )
;
return e
}(e, t);
if (n) {
var o = Object.getOwnPropertyDescriptor(n, t);
return o.get ? o.get.call(i || e) : o.value
}
}
)(e, t, i || e)
}
function _(e) {
return (_ = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function A(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && M(e, t)
}
function M(e, t) {
return (M = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
function D(e) {
var t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}();
return function() {
var i, n = _(e);
return i = t ? Reflect.construct(n, arguments, _(this).constructor) : n.apply(this, arguments),
i && ("object" == (i && "undefined" != typeof Symbol && i.constructor === Symbol ? "symbol" : typeof i) || "function" == typeof i) ? i : function(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}(this)
}
}
var F = n.utils
, z = /*#__PURE__*/
function(e) {
A(i, e);
var t = D(i);
function i(e, o) {
var a, s;
return R(this, i),
e.viewerClass = "df-flipbook " + (e.viewerClass || ""),
(a = t.call(this, e, o)).isFlipBook = !0,
a.sheets = [],
a.isRTL = a.app.isRTL,
a.foldSense = 50,
a.isOneSided = !1,
a.stackCount = null !== (s = e.stackCount) && void 0 !== s ? s : 6,
a.annotedPage = null,
a.pendingAnnotations = [],
a.seamPosition = 0,
a.dragSheet = null,
a.drag = null,
a.soundOn = !0 === e.enableSound,
a.soundFile = null,
a.minZoom = 1,
a.maxZoom = 4,
a.pureMaxZoom = 4,
(a.app.options.pageSize === n.FLIPBOOK_PAGE_SIZE.AUTO || a.app.options.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL) && (a.app.checkSecondPage = !0),
a.app.pageScaling = n.PAGE_SCALE.PAGE_FIT,
e.viewerClass = "",
a.zoomViewer = new B(e,o),
a
}
return N(i, [{
key: "init",
value: function() {
I(_(i.prototype), "init", this).call(this),
this.initSound();
var e = this.app;
this.pageMode = e.options.pageMode === n.FLIPBOOK_PAGE_MODE.AUTO ? F.isMobile || e.pageCount <= 2 ? n.FLIPBOOK_PAGE_MODE.SINGLE : n.FLIPBOOK_PAGE_MODE.DOUBLE : e.options.pageMode,
this.singlePageMode = e.options.singlePageMode || (F.isMobile ? n.FLIPBOOK_SINGLE_PAGE_MODE.BOOKLET : n.FLIPBOOK_SINGLE_PAGE_MODE.ZOOM),
this.updatePageMode(),
this.rightSheetHeight = this.leftSheetHeight = this._defaultPageSize.height,
this.leftSheetWidth = this.rightSheetWidth = this._defaultPageSize.width,
this.leftSheetTop = this.rightSheetTop = (this.availablePageHeight() - this._defaultPageSize.height) / 2,
this.zoomViewer.rightSheetHeight = this.zoomViewer.leftSheetHeight = this._defaultPageSize.height,
this.zoomViewer.leftSheetWidth = this.zoomViewer.rightSheetWidth = this._defaultPageSize.width
}
}, {
key: "determineHeight",
value: function() {}
}, {
key: "initCustomControls",
value: function() {
I(_(i.prototype), "initCustomControls", this).call(this);
var e = this
, t = this.app
, n = t.ui
, o = n.controls
, a = t.options.text
, s = t.options.icons;
o.sound = F.createBtn("sound", s.sound, a.toggleSound).on("click", function() {
e.soundOn = !e.soundOn,
n.updateSound()
}),
n.updateSound = function() {
!1 === e.soundOn ? o.sound.addClass("disabled") : o.sound.removeClass("disabled")
}
,
n.updateSound()
}
}, {
key: "dispose",
value: function() {
I(_(i.prototype), "dispose", this).call(this);
for (var e = 0; e < this.sheets.length; e++) {
var t = this.sheets[e];
t && t.currentTween && (t.currentTween.stop(),
t.currentTween = null)
}
this.zoomViewer.dispose(),
this.soundFile = null
}
}, {
key: "determinePageMode",
value: function() {
var e = this.app
, t = this.pageMode;
if (this.app.pageCount < 3)
this.pageMode = n.FLIPBOOK_PAGE_MODE.SINGLE;
else if (this.app.options.pageMode === n.FLIPBOOK_PAGE_MODE.AUTO && !0 != this.pageModeChangedManually) {
if (!0 === F.isMobile) {
if (this.app.dimensions.isAutoHeight && !1 == this.app.dimensions.isFixedHeight) {
var i = this._calculateInnerHeight(!0)
, o = this._calculateInnerHeight(!1)
, a = e.dimensions.stage.innerWidth + (!0 != e.options.sideMenuOverlay && e.isSideMenuOpen ? 220 : 0);
this.pageMode = i > 1.1 * o && a < 768 ? n.FLIPBOOK_PAGE_MODE.SINGLE : n.FLIPBOOK_PAGE_MODE.DOUBLE,
this._calculateInnerHeight()
} else {
var s = e.dimensions.stage.innerWidth + (!0 != e.options.sideMenuOverlay && e.isSideMenuOpen ? 220 : 0);
this.pageMode = e.dimensions.stage.innerHeight > 1.1 * s && s < 768 ? n.FLIPBOOK_PAGE_MODE.SINGLE : n.FLIPBOOK_PAGE_MODE.DOUBLE
}
}
this.pageMode != t && this.setPageMode({
isSingle: this.pageMode == n.FLIPBOOK_PAGE_MODE.SINGLE
})
}
}
}, {
key: "initSound",
value: function() {
this.soundFile = document.createElement("audio"),
this.soundFile.setAttribute("src", this.app.options.soundFile + "?ver=" + n.version),
this.soundFile.setAttribute("type", "audio/mpeg")
}
}, {
key: "playSound",
value: function() {
try {
!0 === this.app.userHasInteracted && !0 === this.soundOn && (this.soundFile.currentTime = 0,
this.soundFile.play())
} catch (e) {}
}
}, {
key: "checkDocumentPageSizes",
value: function() {
var e = this.app.provider;
e.pageSize === n.FLIPBOOK_PAGE_SIZE.AUTO && (e._page2Ratio && e._page2Ratio > 1.5 * e.defaultPage.pageRatio ? e.pageSize = n.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL : e.pageSize = n.FLIPBOOK_PAGE_SIZE.SINGLE),
e.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL && (e.pageCount = 1 === e.numPages ? 1 : 2 * e.numPages - 2),
(e.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_COVER_BACK || e.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE) && (e.pageCount = 2 * e.numPages)
}
}, {
key: "getViewerPageNumber",
value: function(e) {
return this.app.provider.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL && e > 2 && (e = 2 * e - 1),
this.app.provider.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_COVER_BACK && e > 2 && (e = 2 * e - 1),
e
}
}, {
key: "getDocumentPageNumber",
value: function(e) {
return this.app.provider.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL && e > 2 ? Math.ceil((e - 1) / 2) + 1 : this.app.provider.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_COVER_BACK && e > 1 ? e === this.app.pageCount ? 1 : Math.ceil((e - 1) / 2) + 1 : e
}
}, {
key: "getViewPort",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, n = arguments.length > 2 ? arguments[2] : void 0;
return this.filterViewPort(I(_(i.prototype), "getViewPort", this).call(this, e, t), e, n)
}
}, {
key: "isDoubleInternal",
value: function() {
return this.app.provider.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL
}
}, {
key: "isDoubleCoverBack",
value: function() {
return this.app.provider.pageSize === n.FLIPBOOK_PAGE_SIZE.DOUBLE_COVER_BACK
}
}, {
key: "isDoubleInternalPage",
value: function(e) {
return this.isDoubleInternal() && e > 1 && e < this.app.provider.pageCount
}
}, {
key: "getDoublePageWidthFix",
value: function(e) {
return this.isDoubleInternalPage(e) || this.isDoubleCoverBack() ? 2 : 1
}
}, {
key: "isDoublePageFix",
value: function(e) {
var t = !1;
return (this.isDoubleCoverBack() || this.isDoubleInternalPage(e)) && (this.app.isRTL ? e % 2 == 0 && (t = !0) : e % 2 == 1 && (t = !0)),
t
}
}, {
key: "finalizeAnnotations",
value: function(e, t) {}
}, {
key: "finalizeTextContent",
value: function(e, t) {
this.app.zoomValue > this.app.viewer.pureMaxZoom && (this.zoomViewer.leftViewPort && this.zoomViewer.leftPage.contentLayer[0].style.setProperty("--scale-factor", this.zoomViewer.leftSheetHeight / this.zoomViewer.leftViewPort.height),
this.zoomViewer.rightViewPort && this.zoomViewer.rightPage.contentLayer[0].style.setProperty("--scale-factor", this.zoomViewer.rightSheetHeight / this.zoomViewer.rightViewPort.height))
}
}, {
key: "isActivePage",
value: function(e) {
return void 0 !== this.visiblePagesCache && this.visiblePagesCache.includes(e)
}
}, {
key: "isSheetCover",
value: function(e) {
var t = this.isBooklet;
return 0 === e || t && 1 === e || e === Math.ceil(this.app.pageCount / (t ? 1 : 2)) - (t ? 0 : 1)
}
}, {
key: "isSheetHard",
value: function(e) {
var t = this.app.options.flipbookHardPages;
if (this.isBooklet,
"cover" === t)
return this.isSheetCover(e);
if ("all" === t)
return !0;
var i = ("," + t + ",").indexOf("," + (2 * e + 1) + ",") > -1
, n = ("," + t + ",").indexOf("," + (2 * e + 2) + ",") > -1;
return i || n
}
}, {
key: "sheetsIndexShift",
value: function(e, t, i) {
e > t ? (this.sheets[i - 1].skipFlip = !0,
this.sheets.unshift(this.sheets.pop())) : e < t && (this.sheets[0].skipFlip = !0,
this.sheets.push(this.sheets.shift()))
}
}, {
key: "checkSwipe",
value: function(e, t) {
if (!0 !== this.pinchZoomDirty && 1 === this.app.zoomValue && !0 === this.canSwipe) {
var i = "vertical" == this.orientation ? e.y - this.lastPosY : e.x - this.lastPosX;
Math.abs(i) > this.swipeThreshold && (i < 0 ? this.app.openRight() : this.app.openLeft(),
this.canSwipe = !1,
t.preventDefault()),
this.lastPosX = e.x,
this.lastPosY = e.y
}
}
}, {
key: "checkCenter",
value: function() {
var e, t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], i = this.app, o = n.FLIPBOOK_CENTER_SHIFT, a = i.currentPageNumber % 2 == 0, s = this.getBasePage(), r = this.isRTL, l = this.isSingle;
e = 0 === s || this.isBooklet ? this.isRTL ? o.RIGHT : o.LEFT : s === i.pageCount ? r ? o.LEFT : o.RIGHT : l ? r ? a ? o.LEFT : o.RIGHT : a ? o.RIGHT : o.LEFT : o.NONE,
!0 !== this.centerNeedsUpdate && (this.centerNeedsUpdate = this.centerShift !== e),
this.centerNeedsUpdate && (this.centerShift = e,
this.updateCenter(t),
this.centerNeedsUpdate = !1)
}
}, {
key: "updateCenter",
value: function() {
console.log("UpdateCenter: missing implementation.")
}
}, {
key: "reset",
value: function() {
for (var e, t = 0; t < this.sheets.length; t++)
(e = this.sheets[t]).reset(),
e.pageNumber = -1,
e.frontPage && (e.frontPage.pageNumber = -1),
e.backPage && (e.backPage.pageNumber = -1),
e.resetTexture();
this.annotedPage = null,
this.oldBasePageNumber = -1,
this.centerShift = null,
this.refresh()
}
}, {
key: "handleZoom",
value: function() {
var e = this.app;
e.dimensions;
var t = this.getLeftPageTextureSize({
zoom: !1,
isAnnotation: !0
})
, i = this.getRightPageTextureSize({
zoom: !1,
isAnnotation: !0
});
this.maxZoom,
e.zoomValue,
this.pureMaxZoom = e.dimensions.maxTextureSize / Math.max(t.height, t.width, i.height, i.width);
var n = this.maxZoom = e.options.fakeZoom * this.pureMaxZoom
, o = e.zoomValue
, a = !1
, s = !1;
n < this.minZoom && (n = this.maxZoom = this.minZoom),
!0 === e.pendingZoom && null != e.zoomDelta ? o = e.zoomDelta > 0 ? o * e.options.zoomRatio : o / e.options.zoomRatio : null != this.lastScale && (o *= this.lastScale,
this.lastScale = null),
o = F.limitAt(o, this.minZoom, n),
e.zoomValueChange = o / e.zoomValue,
(e.zoomChanged = e.zoomValue !== o) && (1 === o || 1 === e.zoomValue) && (a = 1 === o,
s = 1 === e.zoomValue),
e.zoomValue = o,
(s || a) && (e.container.toggleClass("df-zoom-active", 1 !== o),
s && this.enterZoom(),
a && this.exitZoom())
}
}, {
key: "refresh",
value: function() {
var e = this.app
, t = this.stackCount
, i = this.isRTL
, o = this.isBooklet
, a = this.getBasePage()
, s = o ? 1 : 2;
i && (a = e.pageCount - a);
var r, l = this.oldBasePageNumber, h = Math.ceil(e.pageCount / s), u = Math.floor(t / 2);
a !== this.oldBasePageNumber && (this.pageNumberChanged = !0,
this.updatePendingStatusClass(!0),
this.zoomViewer.reset()),
this.sheetsIndexShift(l, a, t);
var p = Math.ceil(a / s);
for (r = 0; r < t; r++) {
var c = void 0
, d = p - u + r;
if (i && (d = h - d - 1),
null != (c = this.sheets[r])) {
c.targetSide = r < u ? n.TURN_DIRECTION.LEFT : n.TURN_DIRECTION.RIGHT;
var f = c.side !== c.targetSide
, g = d !== c.pageNumber
, v = f && !1 === c.skipFlip && 1 === e.zoomValue;
!f && g && c.isFlipping && c.currentTween && c.currentTween.stop(),
c.isHard = this.isSheetHard(d),
c.isCover = this.isSheetCover(d),
g && (c.resetTexture(),
(this.app.isRTL ? c.backPage : c.frontPage).pageNumber = this.isBooklet ? d : 2 * d + 1,
(this.app.isRTL ? c.frontPage : c.backPage).pageNumber = this.isBooklet ? -1 : 2 * d + 2,
e.textureRequestStatus = n.REQUEST_STATUS.ON),
c.pageNumber = d,
this.refreshSheet({
sheet: c,
sheetNumber: d,
totalSheets: h,
zIndex: this.stackCount + (r < u ? r - u : u - r),
visible: o ? i ? r < u || c.isFlipping || v : r >= u || c.isFlipping || v : d >= 0 && d < h || o && d === h,
index: r,
needsFlip: v,
midPoint: u
})
}
}
this.requestRefresh(!1),
e.textureRequestStatus = n.REQUEST_STATUS.ON,
this.oldBasePageNumber = a,
this.checkCenter(),
this.zoomViewer.refresh(),
this.pageNumberChanged = !1
}
}, {
key: "validatePageChange",
value: function(e) {
if (e === this.app.currentPageNumber)
return !1;
var t = this.app
, i = !this.isFlipping() || void 0 === t.oldPageNumber;
return (i = i || t.currentPageNumber < e && t.oldPageNumber < t.currentPageNumber) || t.currentPageNumber > e && t.oldPageNumber > t.currentPageNumber
}
}, {
key: "getVisiblePages",
value: function() {
for (var e = [], t = this.getBasePage(), i = this.app.zoomValue > 1 ? 1 : this.isBooklet && F.isMobile ? Math.min(this.stackCount / 2, 2) : this.stackCount / 2, n = 0; n < i; n++)
e.push(t - n),
e.push(t + n + 1);
return this.visiblePagesCache = e,
{
main: e,
buffer: []
}
}
}, {
key: "getBasePage",
value: function(e) {
return (void 0 === e && (e = this.app.currentPageNumber),
this.isBooklet) ? e : 2 * Math.floor(e / 2)
}
}, {
key: "getRightPageNumber",
value: function() {
return this.getBasePage() + (this.isBooklet ? 0 : this.isRTL ? 0 : 1)
}
}, {
key: "getLeftPageNumber",
value: function() {
return this.getBasePage() + (this.isBooklet ? 0 : this.isRTL ? 1 : 0)
}
}, {
key: "afterFlip",
value: function() {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
!0 !== this.isAnimating() && (this.pagesReady(),
this.updatePendingStatusClass())
}
}, {
key: "isFlipping",
value: function() {
var e = !1;
return this.sheets.forEach(function(t) {
!0 === t.isFlipping && (e = !0)
}),
e
}
}, {
key: "isAnimating",
value: function() {
return this.isFlipping()
}
}, {
key: "mouseWheel",
value: function(e) {
this.app.options.mouseScrollAction === n.MOUSE_SCROLL_ACTIONS.ZOOM ? this.zoomViewer.mouseWheel(e) : I(_(i.prototype), "mouseWheel", this).call(this, e)
}
}, {
key: "checkRequestQueue",
value: function() {
this.app.zoomValue > 1 ? this.zoomViewer.checkRequestQueue() : I(_(i.prototype), "checkRequestQueue", this).call(this)
}
}, {
key: "updatePan",
value: function() {}
}, {
key: "resetPageTween",
value: function() {}
}, {
key: "gotoPageCallBack",
value: function() {
this.resetPageTween(),
1 !== this.app.zoomValue && !0 === this.app.options.resetZoomBeforeFlip && this.app.resetZoom(),
this.beforeFlip(),
this.requestRefresh()
}
}, {
key: "beforeFlip",
value: function() {
this.app.executeCallback("beforeFlip"),
1 === this.app.zoomValue && this.playSound()
}
}, {
key: "onFlip",
value: function() {
this.app.executeCallback("onFlip")
}
}, {
key: "getAnnotationElement",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]
, o = void 0;
return (o = this.app.zoomValue > 1 || !0 === n ? this.zoomViewer.getAnnotationElement(e, t) : I(_(i.prototype), "getAnnotationElement", this).call(this, e, t)) && (o.parentNode.classList.toggle("df-double-internal", this.isDoubleInternalPage(e)),
o.parentNode.classList.toggle("df-double-internal-fix", this.isDoublePageFix(e))),
o
}
}, {
key: "getTextElement",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
return this.app.zoomValue > 1 || !0 === n ? this.zoomViewer.getTextElement(e, t) : I(_(i.prototype), "getTextElement", this).call(this, e, t)
}
}, {
key: "enterZoom",
value: function() {
this.exchangeTexture(this, this.zoomViewer)
}
}, {
key: "exitZoom",
value: function() {
this.exchangeTexture(this.zoomViewer, this)
}
}, {
key: "exchangeTexture",
value: function(e, t) {
var i = this.getBasePage()
, n = e.getPageByNumber(i)
, o = t.getPageByNumber(i);
if (o && "-1" === o.textureStamp ? (o.textureStamp = n.textureStamp,
o.loadTexture({
texture: n.getTexture(!0)
}),
F.log("Texture Exchanging at " + i)) : F.log("Texture Exchanging Bypassed at " + i),
!this.isBooklet) {
var a = e.getPageByNumber(i + 1)
, s = t.getPageByNumber(i + 1);
s && "-1" === s.textureStamp ? (s.textureStamp = a.textureStamp,
s.loadTexture({
texture: a.getTexture(!0)
}),
F.log("Texture Exchanging at " + (i + 1))) : F.log("Texture Exchanging Bypassed at " + (i + 1))
}
t.pagesReady()
}
}, {
key: "setPageMode",
value: function(e) {
var t = this.app
, i = !0 === e.isSingle;
this.pageMode = i ? n.FLIPBOOK_PAGE_MODE.SINGLE : n.FLIPBOOK_PAGE_MODE.DOUBLE,
this.updatePageMode(),
t.resizeRequestStart(),
t.viewer.pageMode === n.FLIPBOOK_PAGE_MODE.DOUBLE && t.ui.controls.pageMode ? t.ui.controls.pageMode.removeClass(t.options.icons.doublepage).addClass(t.options.icons.singlepage).attr("title", t.options.text.singlePageMode).html("<span>" + t.options.text.singlePageMode + "</span>") : t.ui.controls.pageMode.addClass(t.options.icons.doublepage).removeClass(t.options.icons.singlepage).attr("title", t.options.text.doublePageMode).html("<span>" + t.options.text.doublePageMode + "</span>")
}
}, {
key: "updatePageMode",
value: function() {
this.app.pageCount < 3 && (this.pageMode = n.FLIPBOOK_PAGE_MODE.SINGLE),
this.isSingle = this.pageMode === n.FLIPBOOK_PAGE_MODE.SINGLE,
this.isBooklet = this.isSingle && this.singlePageMode === n.FLIPBOOK_SINGLE_PAGE_MODE.BOOKLET,
this.app.jumpStep = this.isSingle ? 1 : 2,
this.totalSheets = Math.ceil(this.app.pageCount / (this.isBooklet ? 1 : 2)),
this.sheets.length > 0 && this.reset()
}
}, {
key: "setPage",
value: function(e) {
return e.textureTarget === n.TEXTURE_TARGET.ZOOM ? this.zoomViewer.setPage(e) : I(_(i.prototype), "setPage", this).call(this, e)
}
}, {
key: "_calculateInnerHeight",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0;
void 0 === e && (e = this.pageMode === n.FLIPBOOK_PAGE_MODE.SINGLE);
var t = this.app.dimensions.defaultPage.viewPort
, i = this.availablePageWidth(!1, !0, e)
, o = this.app.dimensions.maxHeight - this.app.dimensions.padding.height;
"vertical" == this.orientation && !1 == e && (o /= 2),
this._defaultPageSize = F.contain(t.width, t.height, i, o),
this._pageFitArea = {
width: i,
height: o
};
var a = this.app.dimensions.isFixedHeight ? o : this._pageFitArea.height;
return this.app.dimensions.isAutoHeight && !1 == this.app.dimensions.isFixedHeight && (a = Math.floor(this._defaultPageSize.height)),
a
}
}, {
key: "_getInnerHeight",
value: function() {
var e = this._calculateInnerHeight();
return this.app.dimensions.stage.width = this.app.dimensions.stage.innerWidth + this.app.dimensions.padding.width,
this.app.dimensions.stage.height = e + this.app.dimensions.padding.height,
e
}
}, {
key: "availablePageWidth",
value: function() {
var e = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0]
, t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
void 0 === i && (i = this.pageMode === n.FLIPBOOK_PAGE_MODE.SINGLE);
var o = !0 === t ? this.app.dimensions.offset.width : 0
, a = this.app.dimensions.stage.innerWidth + o;
return Math.floor((a /= !0 === i || "vertical" == this.orientation ? 1 : 2) * (e ? this.app.zoomValue : 1))
}
}, {
key: "availablePageHeight",
value: function() {
var e = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0]
, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0;
void 0 === t && (t = this.pageMode === n.FLIPBOOK_PAGE_MODE.SINGLE);
var i = this.app.dimensions.stage.innerHeight;
return !1 === t && "vertical" == this.orientation && (i /= 2),
Math.floor(i * (e ? this.app.zoomValue : 1))
}
}, {
key: "getTextureSize",
value: function(e) {
var t = this.getViewPort(e.pageNumber, !0)
, i = this.app.options.pixelRatio
, n = F.contain(t.width, t.height, i * this.availablePageWidth(e.zoom), i * this.availablePageHeight(e.zoom));
return {
height: (n = F.containUnStretched(n.width, n.height, this.app.options.maxTextureSize, this.app.options.maxTextureSize)).height,
width: n.width
}
}
}, {
key: "getLeftPageTextureSize",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return e.pageNumber = this.getLeftPageNumber(),
this.getTextureSize(e)
}
}, {
key: "getRightPageTextureSize",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
return e.pageNumber = this.getRightPageNumber(),
this.getTextureSize(e)
}
}, {
key: "filterViewPort",
value: function(e, t) {
var i = !(arguments.length > 2) || void 0 === arguments[2] || arguments[2];
if (void 0 !== e) {
if (!0 != i)
return e;
var n = e.clone();
return n.width = n.width / this.getDoublePageWidthFix(t),
n
}
}
}, {
key: "filterViewPortCanvas",
value: function(e, t, i) {
this.isDoublePageFix(i) && (e.transform[4] = e.transform[4] - Math.floor(Math.min(t.width, 2 * e.width - t.width))),
e.widthFix = this.isDoubleInternalPage(i) ? 2 : 1
}
}, {
key: "isClosedPage",
value: function(e) {
return void 0 === e && (e = this.app.currentPageNumber),
1 === e || e === this.app.jumpStep * Math.ceil(this.app.pageCount / this.app.jumpStep) && !this.isBooklet
}
}, {
key: "isLeftPage",
value: function(e) {
return (void 0 === e && (e = this.app.currentPageNumber),
this.isBooklet) ? this.isRTL : e % 2 == (this.isRTL ? 1 : 0)
}
}, {
key: "cleanPage",
value: function(e) {
if (!this.isDoubleInternalPage(e))
return I(_(i.prototype), "cleanPage", this).call(this, e);
var t = e + (e % 2 == 1 ? -1 : 1);
return !1 === this.app.provider.requestedPages[e] && !1 === this.app.provider.requestedPages[t]
}
}, {
key: "onReady",
value: function() {
I(_(i.prototype), "onReady", this).call(this)
}
}, {
key: "searchPage",
value: function(e) {
return {
include: !this.isDoublePageFix(e),
label: this.app.provider.getLabelforPage(e) + (this.isDoubleInternalPage(e) ? "-" + this.app.provider.getLabelforPage(e + 1) : "")
}
}
}]),
i
}(g)
, B = /*#__PURE__*/
function(e) {
A(i, e);
var t = D(i);
function i(e, n) {
var o;
return R(this, i),
e.viewerClass = "df-zoomview " + (e.viewerClass || ""),
(o = t.call(this, e, n)).viewer = o.app.viewer,
o.events = {},
o.init(),
o.initEvents(),
o.left = 0,
o.top = 0,
o
}
return N(i, [{
key: "init",
value: function() {
this.leftPage = new S,
this.rightPage = new S,
this.pages.push(this.leftPage),
this.pages.push(this.rightPage),
this.leftPage.element.addClass("df-page-back"),
this.rightPage.element.addClass("df-page-front"),
this.wrapper.append(this.leftPage.element),
this.wrapper.append(this.rightPage.element),
this.bookShadow = jQuery("<div>", {
class: "df-book-shadow"
}),
this.wrapper.append(this.bookShadow),
this.wrapper.addClass("df-sheet")
}
}, {
key: "initEvents",
value: function() {
this.stageDOM = this.element[0],
I(_(i.prototype), "initEvents", this).call(this)
}
}, {
key: "dispose",
value: function() {
this.element.remove()
}
}, {
key: "resize",
value: function() {
var e = this.app.dimensions
, t = e.padding
, i = this.app.viewer.availablePageHeight()
, o = this.app.viewer.availablePageWidth()
, a = this.fullWidth = o * (this.app.viewer.pageMode === n.FLIPBOOK_PAGE_MODE.SINGLE ? 1 : 2)
, s = e.stage.innerWidth
, r = e.stage.innerHeight
, l = this.shiftHeight = Math.ceil(F.limitAt((i - r) / 2, 0, i))
, h = this.shiftWidth = Math.ceil(F.limitAt((a - s) / 2, 0, a));
1 === this.app.zoomValue && (this.left = 0,
this.top = 0),
this.element.css({
top: -l,
bottom: -l,
right: -h,
left: -h,
paddingTop: t.top,
paddingRight: t.right,
paddingBottom: t.bottom,
paddingLeft: t.left,
transform: "translate3d(" + this.left + "px," + this.top + "px,0)"
}),
this.wrapper.css({
width: a,
height: i,
marginTop: e.height - i - t.height > 0 ? (e.height - t.height - i) / 2 : 0
}),
this.wrapper.height(i).width(a - a % 2),
!0 === this.app.pendingZoom && this.zoom(),
this.app.viewer.annotedPage = null,
this.pagesReady()
}
}, {
key: "zoom",
value: function() {
var e = this.app;
if (e.zoomChanged) {
var t = e.dimensions.origin
, i = e.zoomValueChange;
if (1 === e.zoomValue)
this.left = 0,
this.top = 0;
else {
this.left *= i,
this.top *= i,
e.viewer.zoomCenter || (e.viewer.zoomCenter = {
x: t.x,
y: t.y
});
var n = {
raw: e.viewer.zoomCenter
}
, o = {
raw: {}
}
, a = (n.raw.x - t.x) * i
, s = (n.raw.y - t.y) * i;
o.raw.x = t.x + a,
o.raw.y = t.y + s,
this.startPoint = o,
this.pan(n),
this.startPoint = null
}
}
e.viewer.zoomCenter = null
}
}, {
key: "reset",
value: function() {
this.leftPage.resetTexture(),
this.rightPage.resetTexture()
}
}, {
key: "refresh",
value: function() {
var e = this.app
, t = e.viewer
, i = t.getBasePage()
, n = t.isBooklet ? !e.isRTL : e.isRTL
, o = n ? this.rightPage : this.leftPage
, a = n ? this.leftPage : this.rightPage;
o.pageNumber = i,
a.pageNumber = i + 1,
o.updateCSS({
display: 0 === i ? "none" : "block"
}),
a.updateCSS({
display: a.pageNumber > e.pageCount || t.isBooklet ? "none" : "block"
})
}
}, {
key: "updateCenter",
value: function() {
if (null !== this && null !== this.app.viewer) {
var e = this.app.viewer.centerShift
, t = this.app.viewer.isRTL
, i = !t && this.app.currentPageNumber > 1 || t && this.app.currentPageNumber < this.app.pageCount ? this.leftSheetWidth : this.rightSheetWidth;
this.wrapper[0].style.left = e * i / 2 + "px"
}
}
}, {
key: "isDoubleInternalPage",
value: function(e) {
return this.app.viewer.isDoubleInternalPage(e)
}
}, {
key: "pagesReady",
value: function() {
if (!this.app.viewer.isFlipping() && (1 !== this.app.zoomValue && this.app.viewer.updatePendingStatusClass(!1),
!1 === this.app.options.flipbookFitPages)) {
var e = this.app.viewer.getBasePage()
, t = this.leftViewPort = this.app.viewer.getViewPort(e + (this.app.viewer.isBooklet ? 0 : this.app.viewer.isRTL ? 1 : 0))
, i = this.rightViewPort = this.app.viewer.getViewPort(e + (this.app.viewer.isBooklet ? 0 : this.app.viewer.isRTL ? 0 : 1));
if (t) {
var n = F.contain(t.width, t.height, this.app.viewer.availablePageWidth(), this.app.viewer.availablePageHeight());
this.leftSheetWidth = Math.floor(n.width),
this.leftSheetHeight = Math.floor(n.height),
this.leftSheetTop = (this.app.viewer.availablePageHeight() - this.leftSheetHeight) / 2,
this.app.zoomValue > this.app.viewer.pureMaxZoom && this.leftPage.contentLayer[0].style.setProperty("--scale-factor", this.leftSheetHeight / t.height)
}
if (i) {
var o = F.contain(i.width, i.height, this.app.viewer.availablePageWidth(), this.app.viewer.availablePageHeight());
this.rightSheetWidth = Math.floor(o.width),
this.rightSheetHeight = Math.floor(o.height),
this.rightSheetTop = (this.app.viewer.availablePageHeight() - this.rightSheetHeight) / 2,
this.app.zoomValue > this.app.viewer.pureMaxZoom && this.rightPage.contentLayer[0].style.setProperty("--scale-factor", this.rightSheetHeight / i.height)
}
(void 0 != t || void 0 != i) && (this.totalSheetsWidth = this.leftSheetWidth + this.rightSheetWidth,
this.leftPage.element.height(Math.floor(this.leftSheetHeight)).width(Math.floor(this.leftSheetWidth)).css({
transform: "translateY(" + Math.floor(this.leftSheetTop) + "px)"
}),
this.rightPage.element.height(Math.floor(this.rightSheetHeight)).width(Math.floor(this.rightSheetWidth)).css({
transform: "translateY(" + Math.floor(this.rightSheetTop) + "px)"
}))
}
}
}, {
key: "textureLoadedCallback",
value: function(e) {
this.getPageByNumber(e.pageNumber),
this.pagesReady()
}
}]),
i
}(g)
, H = /*#__PURE__*/
function() {
function e(t) {
R(this, e),
this.parentElement = t.parentElement,
this.isFlipping = !1,
this.isOneSided = !1,
this.viewer = t.viewer,
this.frontPage = null,
this.backPage = null,
this.pageNumber = void 0,
this.animateToReset = null
}
return N(e, [{
key: "init",
value: function() {}
}, {
key: "flip",
value: function() {}
}, {
key: "frontImage",
value: function(e) {
this.frontPage.loadTexture({
texture: e.texture,
callback: e.callback
})
}
}, {
key: "backImage",
value: function(e) {
this.backPage.loadTexture({
texture: e.texture,
callback: e.callback
})
}
}, {
key: "resetTexture",
value: function() {
this.frontPage.resetTexture(),
this.backPage.resetTexture()
}
}, {
key: "reset",
value: function() {
this.animateToReset = null,
this.isFlipping = !1,
this.currentTween = null,
this.pendingPoint = null,
this.magnetic = !1,
this.skipFlip = !0,
this.animateToReset = null,
this.viewer.dragPage = null,
this.viewer.flipPage = null,
this.viewer.corner = n.TURN_CORNER.NONE
}
}]),
e
}();
function U(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function V(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function j(e, t, i) {
return t && V(e.prototype, t),
i && V(e, i),
e
}
function W(e, t, i) {
return (W = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, i) {
var n = function(e, t) {
for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = G(e)); )
;
return e
}(e, t);
if (n) {
var o = Object.getOwnPropertyDescriptor(n, t);
return o.get ? o.get.call(i || e) : o.value
}
}
)(e, t, i || e)
}
function G(e) {
return (G = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function q(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Z(e, t)
}
function Z(e, t) {
return (Z = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
function K(e) {
var t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}();
return function() {
var i, n = G(e);
return i = t ? Reflect.construct(n, arguments, G(this).constructor) : n.apply(this, arguments),
i && ("object" == (i && "undefined" != typeof Symbol && i.constructor === Symbol ? "symbol" : typeof i) || "function" == typeof i) ? i : function(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}(this)
}
}
var Q = n.utils
, X = /*#__PURE__*/
function(e) {
q(i, e);
var t = K(i);
function i(e) {
var n;
return U(this, i),
(n = t.call(this, e)).init(),
n
}
return j(i, [{
key: "init",
value: function() {
var e = "<div>"
, t = this.element = jQuery(e, {
class: "df-sheet"
})
, i = this.frontPage = new S;
i.element.addClass("df-page-front");
var n = this.backPage = new S;
n.element.addClass("df-page-back");
var o = this.wrapper = jQuery(e, {
class: "df-sheet-wrapper"
})
, a = this.foldInnerShadow = jQuery(e, {
class: "df-sheet-fold-inner-shadow"
})
, s = this.foldOuterShadow = jQuery(e, {
class: "df-sheet-fold-outer-shadow"
});
this.parentElement.append(t),
t.append(o),
t.append(s),
o.append(i.element),
o.append(n.element),
o.append(a)
}
}, {
key: "updateCSS",
value: function(e) {
this.element.css(e)
}
}, {
key: "resetCSS",
value: function() {
this.wrapper.css({
transform: ""
}),
this.frontPage.resetCSS(),
this.backPage.resetCSS()
}
}, {
key: "updateSize",
value: function(e, t, i) {
e = Math.floor(e),
t = Math.floor(t),
i = Math.floor(i),
this.wrapper[0].style.height = this.wrapper[0].style.width = Math.ceil(Q.distOrigin(e, t) * this.viewer.app.zoomValue) + "px",
this.element[0].style.height = this.frontPage.element[0].style.height = this.backPage.element[0].style.height = this.foldInnerShadow[0].style.height = t + "px",
this.element[0].style.width = this.frontPage.element[0].style.width = this.backPage.element[0].style.width = this.foldInnerShadow[0].style.width = e + "px",
this.element[0].style.transform = "translateY(" + i + "px)"
}
}, {
key: "flip",
value: function(e) {
var t = this;
if (e = e || t.pendingPoint,
null != t && null != t.viewer) {
t.isFlipping = !0,
t.viewer.flipPage = t;
var i, o, a = t.viewer.isBooklet, s = t.side === n.TURN_DIRECTION.RIGHT, r = t.viewer.isRTL, l = t.viewer.corner === n.TURN_CORNER.BL || t.viewer.corner === n.TURN_CORNER.BR ? t.element.height() : 0, h = t.viewer.leftSheetWidth + t.viewer.rightSheetWidth, u = 0;
o = t.end = t && !0 === t.animateToReset ? {
x: s ? h : 0,
y: l
} : {
x: s ? 0 : h,
y: l
},
t.flipEasing = t.isHard ? TWEEN.Easing.Quadratic.InOut : TWEEN.Easing.Linear.None;
var p = t.viewer.app.options.duration;
!0 === t.isHard ? (null != e && (u = Q.angleByDistance(e.distance, e.fullWidth)),
i = t.init = {
angle: u * (s ? -1 : 1)
},
o = t.end = t && !0 === t.animateToReset ? {
angle: s ? 0 : -0
} : {
angle: s ? -180 : 180
}) : null == e ? i = t.init = t && !0 === t.animateToReset ? {
x: s ? 0 : h,
y: 0
} : {
x: s ? h : 0,
y: 0
} : (i = t.init = {
x: e.x,
y: e.y,
opacity: 1
},
p = t.viewer.app.options.duration * Q.distPoints(i.x, i.y, o.x, o.y) / t.viewer.fullWidth,
p = Q.limitAt(p, t.viewer.app.options.duration / 3, t.viewer.duration)),
i.index = 0,
o.index = 1,
t.isFlipping = !0,
a && (!s && !r || s && r) && (t.element[0].style.opacity = 0),
!0 === t.isHard ? t.currentTween = new TWEEN.Tween(i).delay(0).to(o, t.viewer.app.options.duration).onUpdate(function() {
t.updateTween(this)
}).easing(t.flipEasing).onComplete(t.completeTween.bind(t)).start() : null == e ? t.currentTween = new TWEEN.Tween(i).delay(0).to(o, t.viewer.app.options.duration).onUpdate(function() {
t.updateTween(this)
}).easing(TWEEN.Easing.Sinusoidal.Out).onComplete(t.completeTween.bind(t)).start() : t.currentTween = new TWEEN.Tween(i).delay(0).to(o, p).onUpdate(function() {
t.updateTween(this)
}).easing(TWEEN.Easing.Sinusoidal.Out).onComplete(t.completeTween.bind(t)).start()
}
}
}, {
key: "updatePoint",
value: function(e) {
if (null != e) {
var t = this.element.width()
, i = this.element.height()
, o = this.viewer.corner !== n.TURN_CORNER.NONE ? this.viewer.corner : e.corner
, a = n.TURN_CORNER
, s = this.side === n.TURN_DIRECTION.RIGHT
, r = o === a.BL || o === a.BR;
e.rx = !0 === s ? this.viewer.leftSheetWidth + t - e.x : e.x,
e.ry = !0 === r ? i - e.y : e.y;
var l = Math.atan2(e.ry, e.rx);
l = Math.PI / 2 - Q.limitAt(l, 0, Q.toRad(90));
var h = t - e.rx / 2
, u = e.ry / 2
, p = Math.max(0, Math.sin(l - Math.atan2(u, h)) * Q.distOrigin(h, u))
, c = .5 * Q.distOrigin(e.rx, e.ry)
, d = Math.ceil(t - p * Math.sin(l))
, f = Math.ceil(p * Math.cos(l))
, g = Q.toDeg(l)
, v = r ? s ? 180 + (90 - g) : 180 + g : s ? g : 90 - g
, m = r ? s ? 180 + (90 - g) : g : s ? g + 180 : v
, y = r ? s ? 90 - g : g + 90 : s ? v - 90 : v + 180
, b = s ? t - d : d
, w = r ? i + f : -f
, P = s ? -d : d - t
, S = r ? -i - f : f
, C = Q.limitAt(.5 * e.distance / t, 0, .5)
, x = Q.limitAt((this.viewer.leftSheetWidth + t - e.rx) * .5 / t, .05, .3);
this.element.addClass("df-folding");
var T = s ? this.backPage.element : this.frontPage.element
, k = s ? this.frontPage.element : this.backPage.element
, E = this.foldOuterShadow
, O = this.foldInnerShadow;
this.wrapper.css({
transform: Q.translateStr(b, w) + Q.rotateStr(v)
}),
k.css({
transform: Q.rotateStr(-v) + Q.translateStr(-b, -w)
}),
T.css({
transform: Q.rotateStr(m) + Q.translateStr(P, S),
boxShadow: "rgba(0, 0, 0, " + C + ") 0px 0px 20px"
}),
O.css({
transform: Q.rotateStr(m) + Q.translateStr(P, S),
opacity: x / 2,
backgroundImage: Q.prefix.css + "linear-gradient( " + y + "deg, rgba(0, 0, 0, 0.25) , rgb(0, 0, 0) " + .7 * c + "px, rgb(255, 255, 255) " + c + "px)"
}),
E.css({
opacity: x / 2,
left: s ? "auto" : 0,
right: s ? 0 : "auto",
backgroundImage: Q.prefix.css + "linear-gradient( " + (-y + 180) + "deg, rgba(0, 0, 0,0) " + c / 3 + "px, rgb(0, 0, 0) " + c + "px)"
})
}
}
}, {
key: "updateAngle",
value: function(e, t) {
var i = 5 * this.element.width();
this.wrapper.css({
perspective: i,
perspectiveOrigin: !0 === t ? "0% 50%" : "100% 50%"
}),
this.element.addClass("df-folding"),
this.backPage.updateCSS({
display: !0 === t ? e <= -90 ? "block" : "none" : e < 90 ? "block" : "none",
transform: ("MfS" !== Q.prefix.dom ? "" : "perspective(" + i + "px) ") + (!0 === t ? "translateX(-100%) " : "") + "rotateY(" + ((!0 === t ? 180 : 0) + e) + "deg)"
}),
this.frontPage.updateCSS({
display: !0 === t ? e > -90 ? "block" : "none" : e >= 90 ? "block" : "none",
transform: ("MSd" !== Q.prefix.dom ? "" : "perspective(" + i + "px) ") + (!1 === t ? "translateX(100%) " : "") + "rotateY(" + ((!1 === t ? -180 : 0) + e) + "deg)"
})
}
}, {
key: "updateTween",
value: function(e) {
var t = this.viewer.isBooklet
, i = this.side === n.TURN_DIRECTION.RIGHT
, o = this.viewer.isRTL
, a = !0 === this.animateToReset;
!0 === this.isHard ? (this.updateAngle(e.angle, i),
this.angle = e.angle) : (this.updatePoint({
x: e.x,
y: e.y
}),
this.x = e.x,
this.y = e.y),
t && !a && (this.element[0].style.opacity = i && !o || !i && o ? e.index > .5 ? 2 * (1 - e.index) : 1 : e.index < .5 ? 2 * e.index : 1)
}
}, {
key: "completeTween",
value: function() {
!0 === this.isHard ? (this.updateAngle(this.end.angle),
this.backPage.element.css({
display: "block"
}),
this.frontPage.element.css({
display: "block"
})) : this.updatePoint({
x: this.end.x,
y: this.end.y
}),
this.element[0].style.opacity = 1,
!0 !== this.animateToReset && (this.side = this.targetSide),
this.reset(),
this.viewer.onFlip(),
this.viewer.afterFlip(),
this.viewer.requestRefresh()
}
}]),
i
}(H)
, Y = /*#__PURE__*/
function(e) {
q(i, e);
var t = K(i);
function i(e, o) {
var a, s;
return U(this, i),
e.viewerClass = null !== (s = e.viewerClass) && void 0 !== s ? s : "df-flipbook-2d",
e.skipViewerLoaded = !0,
(a = t.call(this, e, o)).bookShadow = jQuery("<div>", {
class: "df-book-shadow"
}),
a.wrapper.append(a.bookShadow),
a.corner = n.TURN_CORNER.NONE,
o._viewerPrepared(),
a
}
return j(i, [{
key: "init",
value: function() {
W(G(i.prototype), "init", this).call(this),
this.initEvents(),
this.initPages()
}
}, {
key: "initEvents",
value: function() {
this.stageDOM = this.element[0],
W(G(i.prototype), "initEvents", this).call(this)
}
}, {
key: "dispose",
value: function() {
W(G(i.prototype), "dispose", this).call(this),
this.element.remove()
}
}, {
key: "initPages",
value: function() {
for (var e = 0; e < this.stackCount; e++) {
var t = new X({
parentElement: this.wrapper
});
t.index = e,
t.viewer = this,
this.sheets.push(t),
this.pages.push(t.frontPage),
this.pages.push(t.backPage)
}
}
}, {
key: "resize",
value: function() {
W(G(i.prototype), "resize", this).call(this);
var e = this.app.dimensions
, t = e.padding
, n = this.availablePageHeight()
, o = this.availablePageWidth()
, a = this.fullWidth = 2 * o
, s = e.width
, r = e.height
, l = this.shiftHeight = Math.ceil(Q.limitAt((n - r + t.height) / 2, 0, n))
, h = this.shiftWidth = Math.ceil(Q.limitAt((a - s + t.width) / 2, 0, a));
1 === this.app.zoomValue && (this.left = 0,
this.top = 0),
this.element.css({
top: -l,
bottom: -l,
right: -h,
left: -h,
paddingTop: t.top,
paddingRight: t.right,
paddingBottom: t.bottom,
paddingLeft: t.left,
transform: "translate3d(" + this.left + "px," + this.top + "px,0)"
}),
this.wrapper.css({
marginTop: Math.max(e.height - n - t.height) / 2,
height: n,
width: a - a % 2
}),
this.zoomViewer.resize(),
this.centerNeedsUpdate = !0,
this.checkCenter(!0),
this.pagesReady()
}
}, {
key: "updateCenter",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
, t = this.centerShift * (this.isRTL,
this.isLeftPage() ? this.leftSheetWidth : this.rightSheetWidth) / 2;
this.seamPosition = (-this.app.dimensions.offset.width + this.app.dimensions.containerWidth) / 2 + t,
this.wrapperShift = (this.isSingle ? -this.app.dimensions.stage.innerWidth / 2 : 0) + t,
this.wrapper[0].style.left = this.wrapperShift + "px",
this.wrapper[0].style.transition = e ? "none" : "",
this.zoomViewer.updateCenter()
}
}, {
key: "refreshSheet",
value: function(e) {
var t = e.sheet
, i = e.sheetNumber;
!1 === t.isFlipping && (e.needsFlip ? (t.element.addClass("df-flipping"),
t.flip()) : (t.skipFlip = !1,
t.element.removeClass("df-flipping df-quick-turn df-folding df-left-side df-right-side"),
t.element.addClass(t.targetSide === n.TURN_DIRECTION.LEFT ? "df-left-side" : "df-right-side"),
t.side = t.targetSide,
t.targetSide === n.TURN_DIRECTION.LEFT ? t.updateSize(this.leftSheetWidth, this.leftSheetHeight, this.leftSheetTop) : t.updateSize(this.rightSheetWidth, this.rightSheetHeight, this.rightSheetTop))),
t.visible = e.visible,
t.isHard ? t.element.addClass("df-hard-sheet") : (t.element.removeClass("df-hard-sheet"),
t.frontPage.updateCSS({
display: "block"
}),
t.backPage.updateCSS({
display: "block"
})),
t.updateCSS({
display: !0 === t.visible ? "block" : "none",
zIndex: e.zIndex
}),
null == t.pendingPoint && !1 === t.isFlipping && t.resetCSS(),
i !== t.pageNumber && (t.element.attr("number", i),
t.backPage.element.attr("pagenumber", t.backPage.pageNumber),
t.frontPage.element.attr("pagenumber", t.frontPage.pageNumber))
}
}, {
key: "eventToPoint",
value: function(e) {
e = Q.fixMouseEvent(e);
var t, i, o, a, s, r, l, h, u, p = this.wrapper[0].getBoundingClientRect(), c = this.is3D, d = this.sheets, f = (this.app.dimensions,
{
x: e.clientX,
y: e.clientY
}), g = this.parentElement[0].getBoundingClientRect();
f.x = f.x - g.left,
f.y = f.y - g.top,
t = (u = this.dragSheet ? this.dragSheet.side === n.TURN_DIRECTION.RIGHT : f.x > this.seamPosition) ? this.rightSheetWidth : this.leftSheetWidth,
o = u ? this.rightSheetHeight : this.leftSheetHeight,
i = this.rightSheetWidth + this.leftSheetWidth,
s = u ? this.rightSheetTop : this.leftSheetTop,
a = f.x - (this.seamPosition - this.leftSheetWidth),
s = f.y - (p.top - g.top) - s,
r = this.drag === n.TURN_DIRECTION.NONE ? a < t ? a : i - a : this.drag === n.TURN_DIRECTION.LEFT ? a : i - a,
l = u ? d[this.stackCount / 2] : d[this.stackCount / 2 - 1],
h = a < this.foldSense ? n.TURN_DIRECTION.LEFT : a > i - this.foldSense ? n.TURN_DIRECTION.RIGHT : n.TURN_DIRECTION.NONE;
var v, m = s, y = this.foldSense;
return v = a >= 0 && a < y ? m >= 0 && m <= y ? n.TURN_CORNER.TL : m >= o - y && m <= o ? n.TURN_CORNER.BL : m > y && m < o - y ? n.TURN_CORNER.L : n.TURN_CORNER.NONE : a >= i - y && a <= i ? m >= 0 && m <= y ? n.TURN_CORNER.TR : m >= o - y && m <= o ? n.TURN_CORNER.BR : m > y && m < o - y ? n.TURN_CORNER.R : n.TURN_CORNER.NONE : n.TURN_CORNER.NONE,
{
isInsideSheet: a >= 0 && a <= i && m >= 0 && m <= o,
isInsideCorner: v !== n.TURN_CORNER.NONE && v !== n.TURN_CORNER.L && v !== n.TURN_CORNER.R,
x: c ? f.x : a,
y: c ? f.y : s,
fullWidth: i,
sheetWidth: t,
sheetHeight: o,
rawDistance: i - a,
distance: r,
sheet: l,
drag: h,
foldSense: this.foldSense,
event: e,
raw: f,
corner: v
}
}
}, {
key: "pan",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
Q.pan(this, e, t)
}
}, {
key: "mouseMove",
value: function(e) {
var t = this.eventToPoint(e);
if (null != e.touches && 2 == e.touches.length) {
this.pinchMove(e);
return
}
1 !== this.app.zoomValue && null != this.startPoint && !0 === this.canSwipe && (this.pan(t),
e.preventDefault());
var i = this.dragSheet || t.sheet;
if (null == this.flipPage && (null != this.dragSheet || !0 === t.isInsideCorner)) {
null != this.dragSheet || (t.y = Q.limitAt(t.y, 1, this.availablePageHeight() - 1),
t.x = Q.limitAt(t.x, 1, t.fullWidth - 1));
var o = null != this.dragSheet ? this.corner : t.corner;
if (i.isHard) {
var a = o === n.TURN_CORNER.BR || o === n.TURN_CORNER.TR
, s = Q.angleByDistance(t.distance, t.fullWidth);
i.updateAngle(s * (a ? -1 : 1), a)
} else
i.updatePoint(t);
i.magnetic = !0,
i.magneticCorner = t.corner,
e.preventDefault()
}
null == this.dragSheet && null != i && !1 === t.isInsideCorner && !0 === i.magnetic && (i.pendingPoint = t,
i.animateToReset = !0,
i.magnetic = !1,
this.corner = i.magneticCorner,
i.flip(i.pendingPoint),
i.pendingPoint = null),
this.checkSwipe(t, e)
}
}, {
key: "mouseUp",
value: function(e) {
if (null != this.startPoint && (e.touches || 0 === e.button)) {
if (null == this.dragSheet && null != e.touches && 0 == e.touches.length) {
this.pinchUp(e);
return
}
var t = this.eventToPoint(e)
, i = e.target || e.originalTarget
, o = 1 === this.app.zoomValue && t.x === this.startPoint.x && t.y === this.startPoint.y && "A" !== i.nodeName;
if (!0 === e.ctrlKey && o)
this.zoomOnPoint(t);
else if (this.dragSheet) {
e.preventDefault();
var a = this.dragSheet;
if (a.pendingPoint = t,
this.drag = t.drag,
o && (!0 === t.isInsideCorner || t.isInsideSheet && this.clickAction === n.MOUSE_CLICK_ACTIONS.NAV))
t.corner.indexOf("l") > -1 ? this.app.openLeft() : this.app.openRight();
else {
var s = this.getBasePage();
t.distance > t.sheetWidth / 2 && (t.sheet.side === n.TURN_DIRECTION.LEFT ? this.app.openLeft() : this.app.openRight()),
s === this.getBasePage() && (a.animateToReset = !0,
a.flip(t))
}
this.dragSheet = null,
a.magnetic = !1
} else
o && !t.sheet.isFlipping && t.isInsideSheet && this.clickAction === n.MOUSE_CLICK_ACTIONS.NAV && ("left" === t.sheet.side ? this.app.openLeft() : this.app.openRight());
this.startPoint = null,
this.canSwipe = !1,
this.drag = n.TURN_DIRECTION.NONE
}
}
}, {
key: "mouseDown",
value: function(e) {
if (e.touches || 0 === e.button) {
if (null != e.touches && 2 == e.touches.length) {
this.pinchDown(e);
return
}
var t = this.eventToPoint(e);
this.startPoint = t,
this.lastPosX = t.x,
this.lastPosY = t.y,
t.isInsideCorner && null == this.flipPage ? (this.dragSheet = t.sheet,
this.drag = t.drag,
this.corner = t.corner,
0 === t.sheet.pageNumber ? this.bookShadow.css({
width: "50%",
left: this.app.isRTL ? 0 : "50%",
transitionDelay: ""
}) : t.sheet.pageNumber === Math.ceil(this.app.pageCount / 2) - 1 && this.bookShadow.css({
width: "50%",
left: this.app.isRTL ? "50%" : 0,
transitionDelay: ""
})) : this.canSwipe = !0
}
}
}, {
key: "onScroll",
value: function(e) {}
}, {
key: "resetPageTween",
value: function() {
for (var e = 0; e < this.stackCount; e++) {
var t = this.sheets[e];
t.currentTween && t.currentTween.complete(!0)
}
this.requestRefresh()
}
}, {
key: "pagesReady",
value: function() {
if (!this.isFlipping()) {
if (!1 === this.app.options.flipbookFitPages) {
var e = this.app.viewer.getBasePage()
, t = this.leftViewport = this.getViewPort(e + (this.isBooklet ? 0 : this.isRTL ? 1 : 0))
, i = this.rightViewPort = this.getViewPort(e + (this.isBooklet ? 0 : this.isRTL ? 0 : 1));
if (t) {
var o = Q.contain(t.width, t.height, this.availablePageWidth(), this.availablePageHeight());
this.leftSheetWidth = Math.floor(o.width),
this.leftSheetHeight = Math.floor(o.height),
this.leftSheetTop = (this.availablePageHeight() - this.leftSheetHeight) / 2
}
if (i) {
var a = Q.contain(i.width, i.height, this.availablePageWidth(), this.availablePageHeight());
this.rightSheetWidth = Math.floor(a.width),
this.rightSheetHeight = Math.floor(a.height),
this.rightSheetTop = (this.availablePageHeight() - this.rightSheetHeight) / 2
}
this.totalSheetsWidth = this.leftSheetWidth + this.rightSheetWidth;
for (var s = 0; s < this.sheets.length; s++) {
var r = this.sheets[s];
r.side === n.TURN_DIRECTION.LEFT ? r.updateSize(this.leftSheetWidth, this.leftSheetHeight, this.leftSheetTop) : r.updateSize(this.rightSheetWidth, this.rightSheetHeight, this.rightSheetTop)
}
}
this.updateCenter(),
this.updatePendingStatusClass()
}
}
}, {
key: "textureLoadedCallback",
value: function(e) {
this.getPageByNumber(e.pageNumber),
this.pagesReady()
}
}]),
i
}(z);
function J(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function $(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function ee(e, t, i) {
return t && $(e.prototype, t),
i && $(e, i),
e
}
function et(e, t, i) {
return (et = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, i) {
var n = function(e, t) {
for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = ei(e)); )
;
return e
}(e, t);
if (n) {
var o = Object.getOwnPropertyDescriptor(n, t);
return o.get ? o.get.call(i || e) : o.value
}
}
)(e, t, i || e)
}
function ei(e) {
return (ei = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function en(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && eo(e, t)
}
function eo(e, t) {
return (eo = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
function ea(e) {
var t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}();
return function() {
var i, n = ei(e);
return i = t ? Reflect.construct(n, arguments, ei(this).constructor) : n.apply(this, arguments),
i && ("object" == (i && "undefined" != typeof Symbol && i.constructor === Symbol ? "symbol" : typeof i) || "function" == typeof i) ? i : function(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}(this)
}
}
var es = n.utils
, er = /*#__PURE__*/
function(e) {
en(i, e);
var t = ea(i);
function i() {
return J(this, i),
t.apply(this, arguments)
}
return ee(i, [{
key: "init",
value: function() {
var e = this.element = jQuery("<div>", {
class: "df-sheet"
});
(this.frontPage = new S).element.addClass("df-page-front").appendTo(this.element),
(this.backPage = new S).element.addClass("df-page-back").appendTo(this.element),
this.parentElement.append(e),
this.frontPage.sheet = this.backPage.sheet = this
}
}, {
key: "completeTween",
value: function() {
this.isFlipping = !1,
this.viewer.onFlip(),
this.viewer.afterFlip(),
this.viewer.requestRefresh(),
this.element[0].style.opacity = 1
}
}, {
key: "flip",
value: function(e) {
this.side = this.targetSide,
this.completeTween()
}
}, {
key: "updateSize",
value: function(e, t, i) {
e = Math.floor(e),
t = Math.floor(t),
i = Math.floor(i),
this.element[0].style.height = this.frontPage.element[0].style.height = t + "px",
this.element[0].style.width = this.frontPage.element[0].style.width = e + "px",
this.element[0].style.transform = "translateX(" + this.positionX + "px) translateY(" + i + "px)"
}
}]),
i
}(X)
, el = /*#__PURE__*/
function(e) {
en(i, e);
var t = ea(i);
function i(e, o) {
var a;
return J(this, i),
e.viewerClass = "df-slider",
e.pageMode = n.FLIPBOOK_PAGE_MODE.SINGLE,
e.singlePageMode = n.FLIPBOOK_SINGLE_PAGE_MODE.BOOKLET,
e.pageSize = n.FLIPBOOK_PAGE_SIZE.SINGLE,
(a = t.call(this, e, o)).stackCount = 10,
a.soundOn = !1,
a.foldSense = 0,
o._viewerPrepared(),
a
}
return ee(i, [{
key: "initPages",
value: function() {
for (var e = 0; e < this.stackCount; e++) {
var t = new er({
parentElement: this.wrapper
});
t.index = e,
t.viewer = this,
this.sheets.push(t),
this.pages.push(t.frontPage),
this.pages.push(t.backPage)
}
}
}, {
key: "resize",
value: function() {
et(ei(i.prototype), "resize", this).call(this),
this.skipTransition = !0
}
}, {
key: "refreshSheet",
value: function(e) {
var t = e.sheet
, i = e.sheetNumber;
t.element.toggleClass("df-no-transition", t.skipFlip || this.skipTransition),
!1 === t.isFlipping && (e.needsFlip ? t.flip() : (t.skipFlip = !1,
t.element.removeClass("df-flipping df-quick-turn df-folding df-left-side df-right-side"),
t.element.addClass(t.targetSide === n.TURN_DIRECTION.LEFT ? "df-left-side" : "df-right-side"),
t.side = t.targetSide)),
t.visible = e.visible,
t.updateCSS({
display: e.sheetNumber > 0 && e.sheetNumber <= this.app.pageCount ? "block" : "none",
zIndex: e.zIndex
}),
i !== t.pageNumber && (t.element.attr("number", i),
t.backPage.element.attr("pagenumber", t.backPage.pageNumber),
t.frontPage.element.attr("pagenumber", t.frontPage.pageNumber))
}
}, {
key: "refresh",
value: function() {
et(ei(i.prototype), "refresh", this).call(this),
this.skipTransition = !1
}
}, {
key: "eventToPoint",
value: function(e) {
var t = et(ei(i.prototype), "eventToPoint", this).call(this, e);
return t.isInsideSheet = jQuery(e.srcElement).closest(".df-page").length > 0,
t.isInsideCorner = !1,
t
}
}, {
key: "initCustomControls",
value: function() {
var e = this.app.ui.controls;
e.pageMode && e.pageMode.hide()
}
}, {
key: "setPageMode",
value: function(e) {
e.isSingle = !0,
et(ei(i.prototype), "setPageMode", this).call(this, e)
}
}, {
key: "pagesReady",
value: function() {
if (!this.isFlipping()) {
var e = 0
, t = 0
, i = this.app;
this.stackCount;
for (var n = [], o = i.currentPageNumber, a = 0; a < this.stackCount / 2; a++)
n.push(o + a),
n.push(o - a - 1);
for (var s = 0; s < this.stackCount; s++) {
var r = n[s];
if (this.getPageByNumber(r)) {
var l = this.getPageByNumber(r).sheet
, h = this.getViewPort(l.pageNumber, !0)
, u = es.contain(h.width, h.height, this.availablePageWidth(), this.availablePageHeight());
i.currentPageNumber === l.pageNumber && (this.leftSheetWidth = this.rightSheetWidth = Math.floor(u.width)),
i.currentPageNumber > l.pageNumber ? (e -= Math.floor(u.width) + 10,
l.positionX = e) : (l.positionX = t,
t += Math.floor(u.width) + 10);
var p = (this.availablePageHeight() - u.height) / 2;
l.updateSize(Math.floor(u.width * i.zoomValue), Math.floor(u.height * i.zoomValue), p)
}
}
this.updateCenter(),
this.updatePendingStatusClass()
}
}
}]),
i
}(Y);
function eh(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function eu(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function ep(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function ec(e, t, i) {
return t && ep(e.prototype, t),
i && ep(e, i),
e
}
function ed(e) {
return (ed = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function ef(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && ev(e, t)
}
function eg(e, t) {
return null != t && "undefined" != typeof Symbol && t[Symbol.hasInstance] ? !!t[Symbol.hasInstance](e) : e instanceof t
}
function ev(e, t) {
return (ev = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
function em(e) {
var t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}();
return function() {
var i, n = ed(e);
return i = t ? Reflect.construct(n, arguments, ed(this).constructor) : n.apply(this, arguments),
i && ("object" == (i && "undefined" != typeof Symbol && i.constructor === Symbol ? "symbol" : typeof i) || "function" == typeof i) ? i : eh(this)
}
}
var ey = {};
function eb(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function ew(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function eP(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function eS(e, t, i) {
return t && eP(e.prototype, t),
i && eP(e, i),
e
}
function eC(e, t, i) {
return (eC = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, i) {
var n = function(e, t) {
for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = ex(e)); )
;
return e
}(e, t);
if (n) {
var o = Object.getOwnPropertyDescriptor(n, t);
return o.get ? o.get.call(i || e) : o.value
}
}
)(e, t, i || e)
}
function ex(e) {
return (ex = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function eT(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && ek(e, t)
}
function ek(e, t) {
return (ek = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
function eE(e) {
var t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}();
return function() {
var i, n = ex(e);
return i = t ? Reflect.construct(n, arguments, ex(this).constructor) : n.apply(this, arguments),
i && ("object" == (i && "undefined" != typeof Symbol && i.constructor === Symbol ? "symbol" : typeof i) || "function" == typeof i) ? i : eb(this)
}
}
ey.init = function() {
if (!0 !== ey.initialized) {
var e = window.THREE;
ey = {
init: function() {},
initialized: !0,
GEOMETRY_TYPE: {
PLANE: 0,
BOX: 1,
MODEL: 2
},
MATERIAL_FACE: {
FRONT: 5,
BACK: 4
},
WHITE_COLOR: new e.Color("white"),
defaults: {
anisotropy: 8,
maxTextureSize: 2048,
groundTexture: "blank",
color: 16777215,
shininess: 15,
width: 210,
height: 297,
depth: .2,
segments: 150,
textureLoadFallback: "blank"
},
textureLoader: new e.TextureLoader,
clearChild: function(e) {
var t, i = e.material;
if (e.parent.remove(e),
e = l.disposeObject(e),
null != i) {
if (null == i.length)
i.map && (t = i.map,
i.dispose(),
t.dispose()),
i.bumpMap && (t = i.bumpMap,
i.dispose(),
t.dispose()),
i.normalMap && (t = i.normalMap,
i.dispose(),
t.dispose());
else
for (var n = 0; n < i.length; n++)
i[n] && (i[n].map && (t = i[n].map,
i[n].dispose(),
t.dispose()),
i[n].bumpMap && (t = i[n].bumpMap,
i[n].dispose(),
t.dispose()),
i[n].normalMap && (t = i[n].normalMap,
i[n].dispose(),
t.dispose())),
i[n] = null;
i = null,
t = null
}
},
loadImage: function(t, i, n, o, a) {
if (null == i) {
var s = null == t.material[n] ? null : t.material[n][o] ? t.material[n][o].sourceFile : null;
return null == s ? null : s.indexOf("data:image") > -1 ? null : s
}
var r = null;
return "CANVAS" === i.nodeName || "IMG" === i.nodeName ? ((r = new e.Texture(i)).needsUpdate = !0,
ey.loadTexture(r, t, o, n),
"function" == typeof a && a(t, r)) : "blank" !== i ? (r = null == i ? null : ey.textureLoader.load(i, function(e) {
e.sourceFile = i,
ey.loadTexture(e, t, o, n),
"function" == typeof a && a(t, e)
}, void 0, function() {
null == r.image && ey.loadImage(t, ey.defaults.textureLoadFallback, n, o),
ey.loadTextureFailed()
})) && (r.mapping = e.UVMapping) : (ey.loadTexture(null, t, o, n),
"function" == typeof a && a(t, r)),
0
},
loadTexture: function(t, i, n, o) {
if (t) {
var a = t.image;
t.naturalWidth = a.naturalWidth,
t.naturalHeight = a.naturalHeight,
t.needsUpdate = !0,
void 0 != i.textureRotation && (t.rotation = e.MathUtils.degToRad(i.textureRotation),
t.center = i.textureCenter)
}
null !== t && "map" === n && (t.anisotropy = 0,
ey.defaults.anisotropy > 0 && (t.anisotropy = ey.defaults.anisotropy),
!0 === e.skipPowerOfTwo && (t.minFilter = e.LinearFilter,
t.magFilter = e.LinearFilter),
t.name = new Date().toTimeString()),
ey.clearTexture(i.material[o][n]),
i.material[o][n] = t,
"bumpMap" === n && (i.material[o].bumpScale = i.sheet.getBumpScale(o)),
i.material[o].needsUpdate = !0
},
loadTextureFailed: function() {
return null
},
clearTexture: function(e) {
e && (e.image && "CANVAS" === e.image.nodeName && (e.image.remove && e.image.remove(),
delete e.image),
e = l.disposeObject(e))
}
},
e.skipPowerOfTwo = !0;
var t = /*#__PURE__*/
function(t) {
ef(n, t);
var i = em(n);
function n(t) {
eu(this, n);
var o, a = t.width || ey.defaults.width, s = t.height || ey.defaults.height, r = t.color || ey.defaults.color, l = t.segments || ey.defaults.segments, h = t.depth || ey.defaults.depth, u = {
color: r,
flatShading: !1,
shininess: t.shininess || ey.defaults.shininess
}, p = new e.MeshPhongMaterial(u), c = [p, p, p, p, new e.MeshPhongMaterial(u), new e.MeshPhongMaterial(u)];
return (o = i.call(this, new e.BoxGeometry(a,s,h,l,1,1), c)).material[5].transparent = !0,
o.material[4].transparent = !0,
o.baseType = "Paper",
o.type = "Paper",
o.castShadow = !0,
o.receiveShadow = !0,
t.parent3D.add(eh(o)),
o
}
return ec(n, [{
key: "loadImage",
value: function(e, t, i) {
ey.loadImage(this, e, t, "map", i)
}
}, {
key: "frontImage",
value: function(e, t) {
ey.loadImage(this, e, ey.MATERIAL_FACE.FRONT, "map", t)
}
}, {
key: "backImage",
value: function(e, t) {
ey.loadImage(this, e, ey.MATERIAL_FACE.BACK, "map", t)
}
}, {
key: "loadBump",
value: function(e) {
ey.loadImage(this, e, ey.MATERIAL_FACE.FRONT, "bumpMap", null),
ey.loadImage(this, e, ey.MATERIAL_FACE.BACK, "bumpMap", null)
}
}, {
key: "loadNormalMap",
value: function(e, t) {
if (void 0 !== t) {
ey.loadImage(this, e, t, "normalMap", null);
return
}
ey.loadImage(this, e, ey.MATERIAL_FACE.FRONT, "normalMap", null),
ey.loadImage(this, e, ey.MATERIAL_FACE.BACK, "normalMap", null)
}
}]),
n
}(e.Mesh)
, i = /*#__PURE__*/
function(e) {
ef(i, e);
var t = em(i);
function i(e) {
var n;
return eu(this, i),
(n = t.call(this, e)).receiveShadow = !0,
n.frontImage(ey.defaults.groundTexture),
n.backImage(ey.defaults.groundTexture),
n.type = "Ground",
n
}
return i
}(t)
, n = /*#__PURE__*/
function(t) {
ef(o, t);
var n = em(o);
function o(t) {
eu(this, o);
var a, s = eh(a = n.call(this));
s.canvas = t.canvas || document.createElement("canvas"),
s.canvas = jQuery(a.canvas),
s.camera = new e.PerspectiveCamera(20,s.width / s.height,4,5e4),
s.renderer = new e.WebGLRenderer({
canvas: s.canvas[0],
antialias: !0,
alpha: !0
}),
s.renderer.setPixelRatio(t.pixelRatio),
s.renderer.setSize(s.width, s.height),
s.renderer.setClearColor(16777215, 0),
s.renderer.shadowMap.enabled = !0,
s.renderer.shadowMap.type = 1,
s.ground = new i({
color: 16777215,
height: s.camera.far / 10,
width: s.camera.far / 10,
segments: 2,
parent3D: s
}),
s.ambientLight = new e.AmbientLight(4473924),
s.add(s.ambientLight);
var r = s.spotLight = new e.DirectionalLight(16777215,.25);
return r.position.set(0, 1, 0),
!1 !== t.castShadow && (r.castShadow = !0,
r.shadow.camera.near = 200,
r.shadow.camera.far = 2e3,
r.shadow.camera.top = 1350,
r.shadow.camera.bottom = -1350,
r.shadow.camera.left = -1350,
r.shadow.camera.right = 1350,
r.shadow.radius = 2,
r.shadow.mapSize.width = 1024,
r.shadow.mapSize.height = 1024,
r.shadow.needsUpdate = !0),
s.add(r),
s.animateCount = 0,
s.renderCount = 0,
s.camera.position.set(-300, 300, 300),
s.camera.lookAt(new e.Vector3(0,0,0)),
a
}
return ec(o, [{
key: "resizeCanvas",
value: function(e, t) {
this.renderer.setSize(e, t),
this.camera.aspect = e / t,
this.camera.updateProjectionMatrix()
}
}, {
key: "render",
value: function() {
this.animateCount++,
this.renderer.render(this, this.camera),
null != this.stats && this.stats.update()
}
}, {
key: "clearMaterials",
value: function() {
for (var e = this.children.length, t = e - 1; t >= 0; t--) {
var i = this.children[t];
if (i.baseType && "Paper" === i.baseType && i.material) {
if (i.material.length)
for (var n = 0; n < i.material.length; n++)
i.material[n].needsUpdate = !0;
else
i.material.needsUpdate = !0
}
}
}
}, {
key: "clearChild",
value: function() {
this.spotLight.shadow.map = l.disposeObject(this.spotLight.shadow.map),
this.spotLight.castShadow = !1,
this.clearMaterials();
for (var e = this.children.length, t = e - 1; t >= 0; t--) {
var i = this.children[t];
if (i.children && i.children.length > 0)
for (var n = i.children.length - 1; n >= 0; n--)
ey.clearChild(i.children[n]);
ey.clearChild(i),
i = null
}
this.render()
}
}]),
o
}(e.Scene);
ey.Paper = t,
ey.Stage = n;
var o = /*#__PURE__*/
function(e) {
ef(i, e);
var t = em(i);
function i(e) {
var n;
return eu(this, i),
(n = t.call(this)).element = e,
n.element.style.position = "absolute",
n.addEventListener("removed", function() {
null !== this.element.parentNode && this.element.parentNode.removeChild(this.element)
}),
n
}
return i
}(e.Object3D);
e.CSS3DObject = o;
var a = /*#__PURE__*/
function(e) {
ef(i, e);
var t = em(i);
function i(e) {
return eu(this, i),
t.call(this, e)
}
return i
}(e.CSS3DObject);
e.CSS3DSprite = a,
e.MathUtils && (e.Math = e.MathUtils),
e.CSS3DRenderer = function() {
l.log("THREE.CSS3DRenderer", e.REVISION);
var t, i, n, o, a = new e.Matrix4, s = {
camera: {
fov: 0,
style: ""
},
objects: {}
}, r = document.createElement("div");
r.style.overflow = "hidden",
r.style.WebkitTransformStyle = "preserve-3d",
r.style.MozTransformStyle = "preserve-3d",
r.style.oTransformStyle = "preserve-3d",
r.style.transformStyle = "preserve-3d",
this.domElement = r;
var h = document.createElement("div");
h.style.WebkitTransformStyle = "preserve-3d",
h.style.MozTransformStyle = "preserve-3d",
h.style.oTransformStyle = "preserve-3d",
h.style.transformStyle = "preserve-3d",
r.appendChild(h),
this.setClearColor = function() {}
,
this.getSize = function() {
return {
width: t,
height: i
}
}
,
this.setSize = function(e, a) {
t = e,
i = a,
n = t / 2,
o = i / 2,
r.style.width = e + "px",
r.style.height = a + "px",
h.style.width = e + "px",
h.style.height = a + "px"
}
;
var u = function(e) {
return Math.abs(e) < Number.EPSILON ? 0 : e
}
, p = function(e) {
var t = e.elements;
return "matrix3d(" + u(t[0]) + "," + u(-t[1]) + "," + u(t[2]) + "," + u(t[3]) + "," + u(t[4]) + "," + u(-t[5]) + "," + u(t[6]) + "," + u(t[7]) + "," + u(t[8]) + "," + u(-t[9]) + "," + u(t[10]) + "," + u(t[11]) + "," + u(t[12]) + "," + u(-t[13]) + "," + u(t[14]) + "," + u(t[15]) + ")"
}
, c = function(e) {
var t = e.elements;
return "translate3d(-50%,-50%,0) matrix3d(" + u(t[0]) + "," + u(t[1]) + "," + u(t[2]) + "," + u(t[3]) + "," + u(-t[4]) + "," + u(-t[5]) + "," + u(-t[6]) + "," + u(-t[7]) + "," + u(t[8]) + "," + u(t[9]) + "," + u(t[10]) + "," + u(t[11]) + "," + u(t[12]) + "," + u(t[13]) + "," + u(t[14]) + "," + u(t[15]) + ")"
}
, d = function(t, i) {
if (eg(t, e.CSS3DObject)) {
eg(t, e.CSS3DSprite) ? (a.copy(i.matrixWorldInverse),
a.transpose(),
a.copyPosition(t.matrixWorld),
a.scale(t.scale),
a.elements[3] = 0,
a.elements[7] = 0,
a.elements[11] = 0,
a.elements[15] = 1,
n = c(a)) : n = c(t.matrixWorld);
var n, o = t.element, r = s.objects[t.id];
(void 0 === r || r !== n) && (o.style.WebkitTransform = n,
o.style.MozTransform = n,
o.style.oTransform = n,
o.style.transform = n,
s.objects[t.id] = n),
o.parentNode !== h && h.appendChild(o)
}
for (var l = 0, u = t.children.length; l < u; l++)
d(t.children[l], i)
};
this.render = function(t, a) {
var l = .5 / Math.tan(e.Math.degToRad(.5 * a.fov)) * i;
s.camera.fov !== l && (r.style.WebkitPerspective = l + "px",
r.style.MozPerspective = l + "px",
r.style.oPerspective = l + "px",
r.style.perspective = l + "px",
s.camera.fov = l),
t.updateMatrixWorld(),
null === a.parent && a.updateMatrixWorld(),
a.matrixWorldInverse.invert ? a.matrixWorldInverse.copy(a.matrixWorld).invert() : a.matrixWorldInverse.getInverse(a.matrixWorld);
var u = "translate3d(0,0," + l + "px)" + p(a.matrixWorldInverse) + " translate3d(" + n + "px," + o + "px, 0)";
s.camera.style !== u && (h.style.WebkitTransform = u,
h.style.MozTransform = u,
h.style.oTransform = u,
h.style.transform = u,
s.camera.style = u),
d(t, a)
}
}
}
}
;
var eO = n.utils
, eR = /*#__PURE__*/
function(e) {
eT(i, e);
var t = eE(i);
function i(e) {
var n;
return ew(this, i),
(n = t.call(this, e)).flexibility = e.flexibility,
n.sheetAngle = 180,
n.curveAngle = 0,
n.parent3D = e.parent3D,
n.segments = e.segments || 50,
n.width = e.width || 100,
n.height = e.height || 100,
n.depth = e.depth || .5,
n.matColor = "white",
n.fallbackMatColor = ey.WHITE_COLOR,
n.init(),
n.bumpScale = [0, 0, 0, 0, 1, 1],
n
}
return eS(i, [{
key: "init",
value: function() {
this.element = new ey.Paper({
parent3D: this.parent3D,
segments: this.segments,
depth: this.depth,
height: this.height,
width: this.width,
flatShading: 0 === this.flexibility
}),
this.element.sheet = this,
this.frontPage = new eN({
sheet: this,
face: 5
}),
this.backPage = new eN({
sheet: this,
face: 4
}),
this.reset(),
this.updateAngle()
}
}, {
key: "setMatColor",
value: function(e, t) {
if (this.matColor = new THREE.Color(e),
void 0 === t)
for (var i = 0; i < 6; i++)
this.element.material[i].color = this.matColor;
else
this.element.material[t].color = this.matColor
}
}, {
key: "getBumpScale",
value: function(e) {
return this.bumpScale[e]
}
}, {
key: "resetMatColor",
value: function(e, t) {
this.element.material[e].color = t ? this.matColor : this.fallbackMatColor
}
}, {
key: "frontImage",
value: function(e, t) {
this.element.frontImage(e, t)
}
}, {
key: "backImage",
value: function(e, t) {
this.element.backImage(e, t)
}
}, {
key: "updateAngle",
value: function() {
if (void 0 !== this.viewer && null !== this.viewer) {
var e = !0 === this.isHard ? 0 : this.flexibility
, t = ("vertical" === this.viewer.orientation ? this.height : this.width) * (1 - Math.sin(e / 2 * (e / 2)) / 2 - e / 20);
this.element.scale.y = ("vertical" === this.viewer.orientation ? this.width : this.height) / this.element.geometry.parameters.height;
var i = this.segments
, n = t / 1
, o = n * e
, a = []
, s = []
, r = []
, l = []
, h = []
, u = []
, p = this.depth
, c = 0
, d = [];
d.push(c),
h[0] = [],
u[0] = [];
var f = this.sheetAngle * Math.PI / 180;
"vertical" !== this.viewer.orientation && (this.element.position.x = -Math.cos(f) * this.viewer.pageOffset),
"vertical" === this.viewer.orientation && (this.element.position.y = Math.cos(f) * this.viewer.pageOffset);
var g = !0 === this.isHard ? f : this.curveAngle * Math.PI / 180
, v = this.sheetAngle * Math.PI / 180
, m = v - Math.PI / 2
, y = Math.sin(m) * p / 2;
h[0][0] = h[0][1] = new THREE.Vector3(-n * Math.cos(f),0,Math.sin(f) * n - y),
u[0][0] = u[0][1] = new THREE.Vector3(h[0][0].x - Math.cos(m) * p,0,h[0][0].z + 2 * y),
h[0][1] = new THREE.Vector3(-n / 2 * Math.cos(g),0,n / 2 * Math.sin(g) - y),
u[0][1] = new THREE.Vector3(h[0][1].x - Math.cos(m) * p,0,h[0][1].z + 2 * y),
v = (45 + this.sheetAngle / 2) * Math.PI / 180,
h[0][2] = new THREE.Vector3(-Math.cos(v) * o / 2,0,Math.sin(v) * o - y),
u[0][2] = new THREE.Vector3(h[0][2].x + Math.cos(m) * p,0,h[0][2].z + 2 * y),
5e-4 > Math.abs(u[0][2].x - 0) && (u[0][2].x = 0),
h[0][3] = new THREE.Vector3(0,0,-y),
u[0][3] = new THREE.Vector3(h[0][3].x - Math.cos(m) * p,0,h[0][3].z + 2 * y),
5e-4 > Math.abs(u[0][3].x - 0) && (u[0][3].x = 0);
for (var b = 0; b < 1; b++) {
var w = Math.max(this.segments - 1, 1);
a[b] = new THREE.CubicBezierCurve3(h[b][0],h[b][1],h[b][2],h[b][3]),
r[b] = a[b].getPoints(w),
w > 2 && r[b].push(new THREE.Vector3().copy(r[b][w]));
for (var P = void 0, S = r[b][0], C = 1; C < r[b].length; C++)
c += (P = r[b][C]).distanceTo(S),
d.push(c),
S = P;
s[b] = new THREE.CubicBezierCurve3(u[b][0],u[b][1],u[b][2],u[b][3]),
l[b] = s[b].getPoints(w),
w > 2 && l[b].push(new THREE.Vector3().copy(l[b][w]))
}
var x = this.element.geometry;
if (void 0 !== x.attributes) {
var T = x.attributes.position
, k = x.attributes.uv
, E = i + 1;
T.setZ(0, r[0][i].z),
T.setZ(2, r[0][i].z),
T.setX(0, r[0][i].x),
T.setX(2, r[0][i].x),
T.setZ(1, l[0][i].z),
T.setZ(3, l[0][i].z),
T.setX(1, l[0][i].x),
T.setX(3, l[0][i].x),
T.setZ(5, r[0][0].z),
T.setZ(7, r[0][0].z),
T.setX(5, r[0][0].x),
T.setX(7, r[0][0].x),
T.setZ(4, l[0][0].z),
T.setZ(6, l[0][0].z),
T.setX(4, l[0][0].x),
T.setX(6, l[0][0].x);
for (var O = 0; O < 1; O++)
for (var R = 0; R < E; R++)
T.setZ(8 + 0 * E + R, r[0][R].z),
T.setX(8 + 0 * E + R, r[0][R].x),
T.setZ(8 + 1 * E + R, l[0][R].z),
T.setX(8 + 1 * E + R, l[0][R].x),
T.setZ(8 + 2 * E + R, r[0][R].z),
T.setX(8 + 2 * E + R, r[0][R].x),
T.setZ(8 + 3 * E + R, l[0][R].z),
T.setX(8 + 3 * E + R, l[0][R].x),
T.setZ(8 + 4 * E + R, r[0][R].z),
T.setX(8 + 4 * E + R, r[0][R].x),
T.setZ(8 + 5 * E + R, r[0][R].z),
T.setX(8 + 5 * E + R, r[0][R].x),
k.setX(8 + 4 * E + R, d[R] / c),
k.setX(8 + 5 * E + R, d[R] / c),
T.setZ(8 + 6 * E + R, l[0][i - R].z),
T.setX(8 + 6 * E + R, l[0][i - R].x),
T.setZ(8 + 7 * E + R, l[0][i - R].z),
T.setX(8 + 7 * E + R, l[0][i - R].x),
k.setX(8 + 6 * E + R, 1 - d[i - R] / c),
k.setX(8 + 7 * E + R, 1 - d[i - R] / c);
x.computeBoundingBox(),
this.element.scale.x = 1 * n / c,
x.computeBoundingSphere(),
T.needsUpdate = !0,
k.needsUpdate = !0,
x.computeVertexNormals()
} else {
var L = x.vertices
, N = i - 1
, I = 8;
L[0].z = L[2].z = r[0][i].z,
L[0].x = L[2].x = r[0][i].x,
L[1].z = L[3].z = l[0][i].z,
L[1].x = L[3].x = l[0][i].x,
L[5].z = L[7].z = r[0][0].z,
L[5].x = L[7].x = r[0][0].x,
L[4].z = L[6].z = l[0][0].z,
L[4].x = L[6].x = l[0][0].x;
for (var _ = 0; _ < 1; _++)
for (var A = 1; A < i; A++)
L[I].z = L[I + 3 * N].z = l[0][A].z,
L[I].x = L[I + 3 * N].x = l[0][A].x,
L[I + N].z = L[I + 2 * N].z = r[0][A].z,
L[I + N].x = L[I + 2 * N].x = r[0][A].x,
I++;
for (var M = x.faceVertexUvs[0], D = x.faces, F = 0, z = 0; z < M.length; z++)
if (D[z].materialIndex === ey.MATERIAL_FACE.BACK) {
var B = d[F] / c;
z % 2 == 0 ? (M[z][0].x = M[z][1].x = M[z + 1][0].x = B,
F++) : M[z - 1][2].x = M[z][1].x = M[z][2].x = B
} else if (D[z].materialIndex === ey.MATERIAL_FACE.FRONT) {
var H = 1 - d[F] / c;
z % 2 == 0 ? (M[z][0].x = M[z][1].x = M[z + 1][0].x = H,
F--) : M[z - 1][2].x = M[z][1].x = M[z][2].x = H
}
x.computeBoundingBox(),
this.element.scale.x = 1 * n / c,
x.computeBoundingSphere(),
x.verticesNeedUpdate = !0,
x.computeFaceNormals(),
x.computeVertexNormals(),
x.uvsNeedUpdate = !0,
x.normalsNeedUpdate = !0
}
a.forEach(function(e) {}),
s.forEach(function(e) {}),
l.forEach(function(e) {}),
r.forEach(function(e) {})
}
}
}, {
key: "flip",
value: function(e, t) {
var i = this
, n = i.viewer.isBooklet;
!0 === i.isCover && (0 === e && (e = 2.5 * i.viewer.flexibility),
180 === e && (e -= 2.5 * i.viewer.flexibility));
var o = t - e
, a = e > 90
, s = i.viewer.isRTL
, r = a ? i.backPage.pageNumber : i.frontPage.pageNumber
, l = this.viewer.getViewPort(r);
l && (l = eO.contain(l.width, l.height, i.viewer.availablePageWidth(), i.viewer.availablePageHeight()));
var h = -(i.viewer.has3DCover && i.viewer.isClosedPage() ? i.viewer.coverExtraWidth : 0)
, u = -(i.viewer.has3DCover && i.viewer.isClosedPage() ? i.viewer.coverExtraHeight : 0);
i.init = {
angle: e,
height: a ? i.viewer.rightSheetHeight : i.viewer.leftSheetHeight,
width: a ? i.viewer.rightSheetWidth : i.viewer.leftSheetWidth,
index: a && !s || !a && s ? 1 : 0,
_index: 0
},
i.first = {
angle: e + o / 4,
index: a && !s || !a && s ? 1 : .25
},
i.mid = {
angle: e + 2 * o / 4,
index: .5
},
i.mid2 = {
angle: e + 3 * o / 4,
index: a && !s || !a && s ? .25 : 1
},
i.end = {
angle: t,
index: a && !s || !a && s ? 0 : 1,
height: u + (l ? l.height : i.height),
width: h + (l ? l.width : i.width)
},
i.isFlipping = !0;
var p = function(e) {
i.sheetAngle = e.angle,
i.curveAngle = i.isHard ? e.angle : eO.getCurveAngle(a, e.angle),
!0 === i.isHard ? (i.flexibility = 0,
i.isCover && i.viewer.flipCover(i)) : i.flexibility = e.angle < 90 ? i.leftFlexibility : i.rightFlexibility,
i.element.position.z = (e.angle < 90 ? i.leftPos : i.rightPos) + i.depth,
n && (i.element.material[5].opacity = i.element.material[4].opacity = e.index,
i.element.castShadow = e.index > .5),
i.height = e.height,
i.width = e.width,
i.updateAngle(!0)
};
n && (!a && !s || a && s) && (i.element.material[5].opacity = i.element.material[4].opacity = 0,
i.element.castShadow = !1),
i.currentTween = new TWEEN.Tween(i.init).to({
angle: [i.first.angle, i.mid.angle, i.mid2.angle, i.end.angle],
index: [i.first.index, i.mid.index, i.mid2.index, i.end.index],
_index: 1,
height: i.end.height,
width: i.end.width
}, i.viewer.app.options.duration * Math.abs(o) / 180).onUpdate(function(e) {
p(this, e)
}).easing(TWEEN.Easing.Sinusoidal.Out).onStop(function() {
i.currentTween = null,
i.isFlipping = !1,
i.isCover && (i.viewer.leftCover.isFlipping = !1,
i.viewer.rightCover.isFlipping = !1),
i.element.material[5].opacity = i.element.material[4].opacity = 1
}).onComplete(function() {
i.updateAngle(),
i.element.material[5].opacity = i.element.material[4].opacity = 1,
i.element.castShadow = !0,
i.isFlipping = !1,
i.isCover && (i.viewer.leftCover.isFlipping = !1,
i.viewer.rightCover.isFlipping = !1),
i.side = i.targetSide,
i.viewer.onFlip(),
i.viewer.afterFlip(),
i.currentTween = null,
i.viewer && i.viewer.requestRefresh && i.viewer.requestRefresh()
}).start(),
i.currentTween.update(window.performance.now())
}
}]),
i
}(H)
, eL = /*#__PURE__*/
function(e) {
eT(i, e);
var t = eE(i);
function i(e, n) {
var o, a, s, r, l;
return ew(this, i),
e.viewerClass = "df-flipbook-3d",
(o = t.call(this, e, n)).pageOffset = 5,
o.spiralCount = 20,
o.groundDistance = null !== (a = e.groundDistance) && void 0 !== a ? a : 2,
o.hasSpiral = "true" === e.hasSpiral || !0 === e.hasSpiral,
o.flexibility = eO.limitAt(null !== (s = e.flexibility) && void 0 !== s ? s : .9, 0, 10),
o.hasSpiral && (o.flexibility = 0),
0 === o.flexibility && (e.sheetSegments = 8),
o.drag3D = eO.isTrue(e.drag3D),
o.texturePowerOfTwo = !eO.isMobile && (null === (r = e.texturePowerOfTwo) || void 0 === r || r),
o.color3DSheets = null !== (l = o.app.options.color3DSheets) && void 0 !== l ? l : "white",
o.midPosition = 0,
o.initMOCKUP(function() {
n._viewerPrepared()
}),
o
}
return eS(i, [{
key: "initMOCKUP",
value: function(e) {
var t = this.app;
"undefined" == typeof THREE ? (t.updateInfo(t.options.text.loading + " WEBGL 3D ..."),
"function" == typeof window.define && window.define.amd && window.requirejs ? (window.requirejs.config({
paths: {
three: t.options.threejsSrc.replace(".js", "")
},
shim: {
three: {
exports: "THREE"
}
}
}),
window.require(["three"], function(t) {
return window.THREE = t,
ey.init(),
"function" == typeof e && e(),
t
})) : "function" == typeof window.define && window.define.amd ? window.require(["three", t.options.threejsSrc.replace(".js", "")], function(t) {
t(function() {
ey.init(),
"function" == typeof e && e()
})
}) : eO.getScript(t.options.threejsSrc + "?ver=" + n.version, function() {
ey.init(),
"function" == typeof e && e()
}, function() {
t.updateInfo("Unable to load THREE.js...")
})) : (ey.init(),
"function" == typeof e && e())
}
}, {
key: "init",
value: function() {
var e = this.app;
eC(ex(i.prototype), "init", this).call(this),
e.provider.defaultPage.pageRatio,
this.pageScaleX = 1,
this.initDepth(),
this.initStage(),
this.initPages(),
this.initEvents(),
this.render()
}
}, {
key: "updatePageMode",
value: function() {
eC(ex(i.prototype), "updatePageMode", this).call(this);
var e = this.app;
this.has3DCover = e.options.cover3DType !== n.FLIPBOOK_COVER_TYPE.NONE && e.pageCount > 7 && !this.isBooklet,
this.has3DCover && "none" === e.options.flipbookHardPages && (e.options.flipbookHardPages = "cover")
}
}, {
key: "initDepth",
value: function() {
var e, t;
this.sheetDepth = this.pageScaleX * (null !== (e = this.app.options.sheetDepth) && void 0 !== e ? e : .5),
this.sheetSegments = null !== (t = this.app.options.sheetSegments) && void 0 !== t ? t : 20,
this.coverDepth = 2 * this.sheetDepth,
this.sheetsDepth = Math.min(10, this.app.pageCount / 4) * this.sheetDepth
}
}, {
key: "initStage",
value: function() {
var e = this.stage = new ey.Stage({
pixelRatio: this.app.options.pixelRatio
});
(e.canvas = jQuery(e.renderer.domElement).addClass("df-3dcanvas")).appendTo(this.element),
e.camera.position.set(0, 0, 600),
e.camera.lookAt(new THREE.Vector3(0,0,0)),
this.camera = e.camera,
e.spotLight.position.set(-220, 220, 550),
e.spotLight.castShadow = !eO.isMobile && this.app.options.has3DShadow,
e.spotLight.shadow && (e.spotLight.shadow.bias = -.005),
e.ambientLight.color = new THREE.Color("#fff"),
e.ambientLight.intensity = .82;
var t = new THREE.ShadowMaterial;
t.opacity = this.app.options.shadowOpacity,
e.ground.oldMaterial = e.ground.material,
e.ground.material = t,
e.ground.position.z = this.has3DCover ? -6 : -4,
e.selectiveRendering = !0;
var i = e.cssRenderer = new THREE.CSS3DRenderer;
jQuery(i.domElement).css({
position: "absolute",
top: 0,
pointerEvents: "none"
}).addClass("df-3dcanvas df-csscanvas"),
this.element[0].appendChild(i.domElement),
e.cssScene = new THREE.Scene,
this.wrapper.remove(),
this.wrapper = new THREE.Group,
this.stage.add(this.wrapper),
this.wrapper.add(e.ground),
this.bookWrapper = new THREE.Group,
this.bookWrapper.name = "bookwrapper",
this.wrapper.add(this.bookWrapper),
this.bookHelper = e.bookHelper = new THREE.BoxHelper(this.bookWrapper,16776960),
e.add(this.bookHelper),
this.bookHelper.visible = !1,
this.cameraWrapper = new THREE.Group,
this.cameraWrapper.add(e.camera),
e.add(this.cameraWrapper),
this.app.renderRequestStatus = n.REQUEST_STATUS.ON
}
}, {
key: "initPages",
value: function() {
for (var e = {
parent3D: this.bookWrapper,
viewer: this,
segments: this.sheetSegments,
depth: this.sheetDepth,
flexibility: this.flexibility
}, t = 0; t < this.stackCount; t++) {
var i = new eR(e);
i.index = t,
i.viewer = this,
this.sheets.push(i),
i.setMatColor(this.color3DSheets),
this.pages.push(i.frontPage),
this.pages.push(i.backPage),
this.stage.cssScene.add(i.frontPage.cssPage),
this.stage.cssScene.add(i.backPage.cssPage)
}
e.depth = this.sheetsDepth,
e.segments = 1,
e.flexibility = 0,
this.leftSheets = new eR(e),
this.rightSheets = new eR(e),
this.leftSheets.setMatColor(this.color3DSheets),
this.rightSheets.setMatColor(this.color3DSheets),
e.depth = this.coverDepth,
this.leftCover = new eR(e),
this.rightCover = new eR(e),
this.leftCover.isHard = !0,
this.rightCover.isHard = !0,
this.set3DCoverNormal(),
this.setcolor3DCover(this.app.options.color3DCover),
this.stage.cssScene.add(this.leftCover.frontPage.cssPage),
this.stage.cssScene.add(this.rightCover.backPage.cssPage),
this.zoomViewer.leftPage.element.css({
backgroundColor: this.color3DSheets
}),
this.zoomViewer.rightPage.element.css({
backgroundColor: this.color3DSheets
}),
"vertical" === this.orientation && this.bookWrapper.children.forEach(function(e) {
e.rotateZ(THREE.MathUtils.degToRad(-90)),
e.textureCenter = new THREE.Vector2(.5,.5),
e.textureRotation = 90
}),
this.initSpiral()
}
}, {
key: "initSpiral",
value: function() {
this.hasSpiral = !1
}
}, {
key: "set3DCoverNormal",
value: function() {}
}, {
key: "setcolor3DCover",
value: function() {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
}
}, {
key: "initEvents",
value: function() {
this.stageDOM = this.element[0],
eC(ex(i.prototype), "initEvents", this).call(this)
}
}, {
key: "dispose",
value: function() {
eC(ex(i.prototype), "dispose", this).call(this),
this.stage && (this.stage.clearChild(),
this.stage.cssRenderer.domElement.parentNode.removeChild(this.stage.cssRenderer.domElement),
this.stage.cssRenderer = null,
this.stage.orbitControl = eO.disposeObject(this.stage.orbitControl),
this.stage.renderer = eO.disposeObject(this.stage.renderer),
jQuery(this.stage.canvas).remove(),
this.stage.canvas = null,
this.stage = eO.disposeObject(this.stage)),
this.centerTween && this.centerTween.stop && this.centerTween.stop()
}
}, {
key: "render",
value: function() {
this.stage.render(),
this.stage.cssRenderer.render(this.stage.cssScene, this.stage.camera)
}
}, {
key: "resize",
value: function() {
eC(ex(i.prototype), "resize", this).call(this);
var e = this
, t = e.app
, n = e.stage
, o = t.dimensions;
o.padding,
e.isSingle;
var a = this.availablePageWidth()
, s = this.availablePageHeight();
n.resizeCanvas(o.stage.width, o.stage.height),
n.cssRenderer.setSize(o.stage.width, o.stage.height),
this.pageScaleX = Math.max(Math.max(a, s) / 400, 1),
this.initDepth(),
this.sheets.forEach(function(t) {
t.depth = e.sheetDepth
}),
t.refreshRequestStart();
var r = this.refSize = Math.min(s, a);
this.coverExtraWidth = ("vertical" == e.orientation ? 2 : 1) * r * .025,
this.coverExtraHeight = ("vertical" == e.orientation ? 1 : 2) * r * .025,
!0 !== this.has3DCover && (this.coverExtraWidth = 0,
this.coverExtraHeight = 0),
e.zoomViewer.resize(),
e.cameraPositionDirty = !0,
e.centerNeedsUpdate = !0,
e.checkCenter(!0),
e.pagesReady(),
this.pageOffset = (this.hasSpiral ? 6 : 0) * Math.min(this._defaultPageSize.width, this._defaultPageSize.height) / 1e3
}
}, {
key: "fitCameraToCenteredObject",
value: function(e, t, i, n) {
var o = new THREE.Box3;
o.setFromObject(t),
new THREE.Vector3;
var a = new THREE.Vector3;
o.getSize(a);
var s = this.coverExtraHeight
, r = 2 * this.coverExtraWidth;
this.isClosedPage() && (r = 0,
s = 0),
a.x = a.x - r + this.app.dimensions.padding.width,
a.y = a.y - s + this.app.dimensions.padding.height;
var l = e.fov * (Math.PI / 180)
, h = 2 * Math.atan(Math.tan(l / 2) * e.aspect)
, u = Math.max(a.z / 2 + Math.abs(a.x / 2 / Math.tan(h / 2)), a.z / 2 + Math.abs(a.y / 2 / Math.tan(l / 2)));
void 0 !== i && 0 !== i && (u *= i),
e.position.set(0, 0, u);
var p = o.min.z
, c = p < 0 ? -p + u : u - p;
e.far = 3 * c,
e.updateProjectionMatrix(),
void 0 !== n && (n.target = new THREE.Vector3(0,0,0),
n.maxDistance = 2 * c)
}
}, {
key: "updateShadowSize",
value: function() {}
}, {
key: "refresh",
value: function() {
var e = this.app
, t = this.getBasePage();
this.refreshRequested = !0;
var n = 1 / e.pageCount * t
, o = this.isRTL ? 1 - n : n
, a = Math.min(this.stackCount, this.totalSheets)
, s = eO.limitAt(this.totalSheets, this.stackCount, 2 * this.stackCount)
, r = this.isBooklet ? 0 : this.flexibility / s;
this.leftFlexibility = r * (1 - o),
this.rightFlexibility = r * o,
this.midPosition = .5 * a * this.sheetDepth,
eC(ex(i.prototype), "refresh", this).call(this);
var l = !0 === this.has3DCover;
this.leftCover.element.visible = this.rightCover.element.visible = this.leftSheets.element.visible = this.rightSheets.element.visible = l,
this.wrapper.position.z = -this.midPosition;
var h = 0
, u = 0
, p = this.isRTL
, c = this.isFirstPage()
, d = this.isLastPage()
, f = this.isLeftClosed = this.isClosedPage() && (p && d || !p && c)
, g = this.isRightClosed = this.isClosedPage() && (!p && d || p && c);
if (l) {
this.leftSheets.depth = p ? this.sheetsDepth * (1 - this.getBasePage() / e.pageCount) : this.sheetsDepth * t / e.pageCount,
this.leftSheets.element.visible = p ? e.pageCount - this.getBasePage() > 2 : t > 2,
h -= this.leftSheets.depth / 2,
this.leftSheets.element.position.z = h,
h -= this.coverDepth + (this.leftSheets.element.visible ? this.leftSheets.depth / 2 : 0) + 3 * this.coverDepth,
this.leftCover.depth = this.rightCover.depth = this.coverDepth;
var v = Math.max(this.leftSheetHeight, this.rightSheetHeight);
g && (v = this.leftSheetHeight),
f && (v = this.rightSheetHeight),
!0 !== this.leftCover.isFlipping && (this.leftCover.element.position.z = f ? this.midPosition + this.coverDepth : h + this.coverDepth / 2,
this.leftCover.element.position.z = Math.max(this.leftCover.element.position.z, -(.05 * this.refSize)),
this.leftCover.element.position.x = 0,
this.leftSheets.sheetAngle = this.leftCover.sheetAngle = f ? 180 : 0,
this.leftSheets.curveAngle = this.leftCover.curveAngle = f ? 180 : 0,
!0 === this.rightCover.isFlipping || (this.leftCover.height = v,
this.leftCover.width = this.leftCover.sheetAngle < 90 ? this.leftSheetWidth : this.rightSheetWidth,
this.isClosedPage() || (this.leftCover.width += this.coverExtraWidth,
this.leftCover.height += this.coverExtraHeight)),
this.leftSheets.updateAngle(),
this.leftCover.updateAngle()),
this.rightSheets.depth = this.sheetsDepth - this.leftSheets.depth,
this.rightSheets.element.visible = p ? t > 2 : e.pageCount - this.getBasePage() > 2,
u -= this.rightSheets.depth / 2,
this.rightSheets.element.position.z = u,
u -= this.coverDepth + (this.rightSheets.element.visible ? this.rightSheets.depth / 2 : 0) + 3 * this.coverDepth,
!0 !== this.rightCover.isFlipping && (this.rightCover.element.position.z = g ? this.midPosition + this.coverDepth : u + this.coverDepth / 2,
this.rightCover.element.position.z = Math.max(this.rightCover.element.position.z, -(.05 * this.refSize)),
this.rightCover.element.position.x = 0,
this.rightSheets.sheetAngle = this.rightCover.sheetAngle = g ? 0 : 180,
this.rightSheets.curveAngle = this.rightCover.curveAngle = g ? 0 : 180,
!0 === this.leftCover.isFlipping || (this.rightCover.height = v,
this.rightCover.width = this.rightCover.sheetAngle < 90 ? this.leftSheetWidth : this.rightSheetWidth,
this.isClosedPage() || (this.rightCover.width += this.coverExtraWidth,
this.rightCover.height += this.coverExtraHeight)),
this.rightSheets.updateAngle(),
this.rightCover.updateAngle()),
this.updateSheets(),
this.stage.ground.position.z = Math.min(h, u) - this.refSize * this.groundDistance / 100,
this.stage.ground.position.z = Math.max(this.stage.ground.position.z, -(.1 * this.refSize))
} else
this.stage.ground.position.z = -this.midPosition - 15 * this.sheetDepth;
!0 === this.cameraPositionDirty && this.updateCameraPosition(),
this.refreshSpiral()
}
}, {
key: "refreshSpiral",
value: function() {}
}, {
key: "updateCameraPosition",
value: function() {
var e = this.app
, t = this.stage
, i = e.dimensions
, o = i.padding
, a = 1 / (2 * Math.tan(Math.PI * t.camera.fov * .5 / 180) / (i.stage.height / e.zoomValue)) + 2.2;
this.updateShadowSize(),
this.stage.spotLight.position.x = -(330 * this.pageScaleX),
this.stage.spotLight.position.y = 330 * this.pageScaleX,
this.stage.spotLight.position.z = 550 * this.pageScaleX,
this.stage.spotLight.shadow.camera.far = 1200 * this.pageScaleX,
this.stage.spotLight.shadow.camera.updateProjectionMatrix();
var s = (o.top - o.bottom) / e.zoomValue / 2
, r = -(o.left - o.right) / e.zoomValue / 2;
t.camera.position.z !== a && !0 === e.pendingZoom && (t.camera.position.z = a),
1 === e.zoomValue && (this.bookWrapper.rotation.set(0, 0, 0),
this.bookHelper.rotation.set(0, 0, 0),
this.cameraWrapper.rotation.set(0, 0, 0),
0 !== e.options.flipbook3DTiltAngleUp || 0 !== e.options.flipbook3DTiltAngleLeft ? (t.camera.aspect = i.stage.width / i.stage.height,
t.camera.updateProjectionMatrix(),
this.bookWrapper.rotateZ(THREE.Math.degToRad(-e.options.flipbook3DTiltAngleLeft)),
this.bookWrapper.rotateX(THREE.Math.degToRad(-e.options.flipbook3DTiltAngleUp)),
"vertical" == this.orientation ? this.bookWrapper.scale.y = 1 / (this.isSingle ? 2 : 1) : this.bookWrapper.scale.x = 1 / (this.isSingle ? 2 : 1),
this.bookHelper.update(),
this.fitCameraToCenteredObject(t.camera, this.bookWrapper),
this.bookWrapper.rotation.set(0, 0, 0),
this.bookWrapper.scale.x = 1,
this.bookWrapper.scale.y = 1,
t.camera.position.set(r, s, t.camera.position.z + t.ground.position.z),
this.camera.aspect = i.stage.width / i.stage.height,
this.camera.updateProjectionMatrix(),
this.cameraWrapper.rotateX(THREE.Math.degToRad(e.options.flipbook3DTiltAngleUp)),
this.cameraWrapper.rotateZ(THREE.Math.degToRad(e.options.flipbook3DTiltAngleLeft))) : t.camera.position.set(r, s, a)),
t.camera.updateProjectionMatrix(),
this.app.renderRequestStatus = n.REQUEST_STATUS.ON,
this.cameraPositionDirty = !1
}
}, {
key: "refreshSheet",
value: function(e) {
var t, i = e.sheet, o = e.index, a = i.sheetAngle, s = !(i.isHard || 0 === this.flexibility);
i.leftFlexibility = s ? this.leftFlexibility : 0,
i.rightFlexibility = s ? this.rightFlexibility : 0,
i.leftPos = this.midPosition + (o - e.midPoint + 1) * this.sheetDepth - this.sheetDepth / 2,
i.rightPos = this.midPosition - (o - e.midPoint) * this.sheetDepth - this.sheetDepth / 2,
t = i.targetSide === n.TURN_DIRECTION.LEFT ? 0 : 180,
!1 === i.isFlipping && (e.needsFlip ? (i.isFlipping = !0,
i.isCover && 0 === e.sheetNumber && (this.isRTL ? this.rightCover.isFlipping = !0 : this.leftCover.isFlipping = !0),
i.isCover && this.totalSheets - e.sheetNumber == 1 && (this.isRTL ? this.leftCover.isFlipping = !0 : this.rightCover.isFlipping = !0),
i.element.position.z = Math.max(a < 90 ? i.leftPos : i.rightPos, this.midPosition) + this.sheetDepth,
i.flexibility = a < 90 ? i.leftFlexibility : i.rightFlexibility,
i.flip(a, t)) : (i.skipFlip = !1,
i.sheetAngle = i.curveAngle = t,
i.flexibility = t < 90 ? i.leftFlexibility : i.rightFlexibility,
i.element.position.z = t < 90 ? i.leftPos : i.rightPos,
i.side = i.targetSide,
i.height = t < 90 ? this.leftSheetHeight : this.rightSheetHeight,
i.width = t < 90 ? this.leftSheetWidth : this.rightSheetWidth),
i.updateAngle(),
this.app.renderRequestStatus = n.REQUEST_STATUS.ON),
i.element.visible = e.visible
}
}, {
key: "updateCenter",
value: function() {
var e = this
, t = this.app
, i = "vertical" == this.orientation ? e.wrapper.position.y : e.wrapper.position.x
, o = ("vertical" === this.orientation ? -1 : 1) * e.centerShift * (this.isLeftPage() ? "vertical" == this.orientation ? this.leftSheetHeight : this.leftSheetWidth : "vertical" == this.orientation ? this.rightSheetHeight : this.rightSheetWidth) / 2;
e.seamPosition = (-t.dimensions.offset.width + t.dimensions.containerWidth) / 2 + o,
o !== e.centerEnd && (e.centerTween && e.centerTween.stop && e.centerTween.stop(),
e.onCenterStartAnimation(this),
e.centerTween = new TWEEN.Tween({
x: i
}).delay(0).to({
x: o
}, 1 === t.zoomValue && !0 !== e.skipCenterAnimation ? e.app.options.duration : 1).onStart(function() {}).onUpdate(function() {
e.onCenterUpdateAnimation(this)
}).onComplete(function() {
e.onCenterCompleteAnimation(this)
}).onStop(function() {
e.onCenterStopAnimation(this)
}).easing(TWEEN.Easing.Cubic.InOut).start(),
this.updatePendingStatusClass(),
e.skipCenterAnimation = !1,
e.centerEnd = o),
e.renderRequestStatus = n.REQUEST_STATUS.ON,
this.zoomViewer.updateCenter()
}
}, {
key: "onCenterUpdateAnimation",
value: function(e) {
"vertical" == this.orientation ? (this.wrapper.position.y = e.x,
this.stage && this.stage.cssScene && (this.stage.cssScene.position.y = e.x)) : (this.wrapper.position.x = e.x,
this.stage && this.stage.cssScene && (this.stage.cssScene.position.x = e.x))
}
}, {
key: "onCenterStartAnimation",
value: function(e) {}
}, {
key: "onCenterStopAnimation",
value: function(e) {}
}, {
key: "onCenterCompleteAnimation",
value: function(e) {}
}, {
key: "flipCover",
value: function(e) {
var t, i, n = null;
0 === e.pageNumber || this.isBooklet && 1 === e.pageNumber ? (n = this.isRTL ? this.rightCover : this.leftCover,
t = this.isRTL ? 1 : -1) : e.pageNumber === this.totalSheets - 1 && (n = this.isRTL ? this.leftCover : this.rightCover,
t = this.isRTL ? -1 : 1),
null !== n && (i = n.depth + e.depth + 1,
n.sheetAngle = e.sheetAngle,
n.curveAngle = e.curveAngle,
this.rightCover.height = this.leftCover.height = e.height + this.coverExtraHeight,
this.rightCover.width = this.leftCover.width = e.width + this.coverExtraWidth,
n.flexibility = e.flexibility,
this.rightCover.updateAngle(),
this.leftCover.updateAngle(),
n.element.position.x = e.element.position.x + t * Math.sin(e.sheetAngle * Math.PI / 180) * i,
n.element.position.z = e.element.position.z + t * Math.cos(e.sheetAngle * Math.PI / 180) * i)
}
}, {
key: "pagesReady",
value: function() {
if (!this.isAnimating() && !0 === this.refreshRequested) {
if (!1 === this.app.options.flipbookFitPages) {
var e = this.app.viewer.getBasePage()
, t = this.leftViewport = this.getViewPort(e + (this.isBooklet ? 0 : this.isRTL ? 1 : 0))
, i = this.rightViewPort = this.getViewPort(e + (this.isBooklet ? 0 : this.isRTL ? 0 : 1));
if (t) {
var o = eO.contain(t.width, t.height, this.availablePageWidth(), this.availablePageHeight());
(this.leftSheetWidth != Math.floor(o.width) || this.leftSheetHeight != Math.floor(o.height)) && (this.cameraPositionDirty = !0),
this.leftSheetWidth = Math.floor(o.width),
this.leftSheetHeight = Math.floor(o.height)
}
if (i) {
var a = eO.contain(i.width, i.height, this.availablePageWidth(), this.availablePageHeight());
(this.rightSheetWidth != Math.floor(a.width) || this.rightSheetWidth != Math.floor(a.height)) && (this.cameraPositionDirty = !0),
this.rightSheetWidth = Math.floor(a.width),
this.rightSheetHeight = Math.floor(a.height)
}
for (var s = 0; s < this.sheets.length; s++) {
var r = this.sheets[s];
r.side === n.TURN_DIRECTION.LEFT ? (r.height = this.leftSheetHeight,
r.width = this.leftSheetWidth) : (r.height = this.rightSheetHeight,
r.width = this.rightSheetWidth),
r.updateAngle()
}
if (this.isClosedPage()) {
var l = this.isRTL && this.isLastPage() || !this.isRTL && this.isFirstPage();
this.leftCover.width = this.rightCover.width = l ? this.rightSheetWidth : this.leftSheetWidth,
this.leftCover.height = this.rightCover.height = l ? this.rightSheetHeight : this.leftSheetHeight
} else
this.leftCover.height = this.rightCover.height = this.coverExtraHeight + Math.max(this.leftSheetHeight, this.rightSheetHeight),
this.leftCover.width = this.coverExtraWidth + this.leftSheetWidth,
this.rightCover.width = this.coverExtraWidth + this.rightSheetWidth;
this.leftSheets.width = this.leftSheetWidth,
this.leftSheets.height = this.leftSheetHeight,
this.rightSheets.height = this.rightSheetHeight,
this.rightSheets.width = this.rightSheetWidth,
this.leftCover.updateAngle(),
this.leftSheets.updateAngle(),
this.rightCover.updateAngle(),
this.rightSheets.updateAngle(),
this.updateSheets(!0)
}
this.updateCenter(),
this.updateCSSLayer(),
this.updatePendingStatusClass(),
this.refreshSpiral(),
!0 === this.cameraPositionDirty && this.updateCameraPosition()
}
}
}, {
key: "updateSheets",
value: function(e) {
if (!0 !== this.isClosedPage()) {
var t = this.getPageByNumber(this.getRightPageNumber());
if (!0 !== this.rightCover.isFlipping && t && t.sheet.element.geometry.attributes) {
var i = this.rightSheets.element.geometry.attributes.position
, n = e ? t.sheet.element.geometry.boundingBox.max.x * t.sheet.element.scale.x : this.rightSheets.lastSlopeX;
i.setX(21, n),
i.setX(23, n),
i.setX(4, n),
i.setX(6, n),
i.setX(10, n),
i.setX(14, n),
i.needsUpdate = !0,
this.rightSheets.element.geometry.attributes.uv.needsUpdate = !0,
this.rightSheets.element.geometry.computeVertexNormals(),
e && (this.rightSheets.lastSlopeX = n)
}
var o = this.getPageByNumber(this.getLeftPageNumber());
if (!0 !== this.leftCover.isFlipping && o && o.sheet.element.geometry.attributes) {
var a = this.leftSheets.element.geometry.attributes.position
, s = e ? o.sheet.element.geometry.boundingBox.min.x * o.sheet.element.scale.x : this.leftSheets.lastSlopeX;
a.setX(16, s),
a.setX(18, s),
a.setX(5, s),
a.setX(7, s),
a.setX(8, s),
a.setX(12, s),
a.needsUpdate = !0,
this.leftSheets.element.geometry.attributes.uv.needsUpdate = !0,
this.leftSheets.element.geometry.computeVertexNormals(),
e && (this.leftSheets.lastSlopeX = s)
}
}
}
}, {
key: "updateCSSLayer",
value: function() {}
}, {
key: "mouseMove",
value: function(e) {
if (e = eO.fixMouseEvent(e),
this.app.renderRequestStatus = n.REQUEST_STATUS.ON,
null != e.touches && 2 === e.touches.length) {
this.pinchMove(e);
return
}
var t = this.eventToPoint(e);
if (null !== this.dragSheet && !1 !== this.drag3D && Math.abs(t.x - this.startPoint.x) > 2) {
!0 !== this.isDragging && (this.updatePendingStatusClass(!0),
this.isDragging = !0);
var i = this.dragSheet.width
, o = t.x - (this.app.dimensions.origin.x + this.centerEnd - i)
, a = eO.limitAt(1 - o / i, -1, 1)
, s = eO.toDeg(Math.acos(a))
, r = this.dragSheet
, l = this.drag === n.TURN_DIRECTION.LEFT;
r.sheetAngle = s;
var h = eO.getCurveAngle(l, s, 45);
r.isCover && r.viewer.flipCover(r),
r.curveAngle = r.isHard ? s : h,
r.updateAngle()
}
this.checkSwipe(t, e)
}
}, {
key: "mouseUp",
value: function(e) {
if ((e = eO.fixMouseEvent(e)).touches || 0 === e.button) {
if (null == this.dragSheet && null != e.touches && 0 === e.touches.length) {
this.pinchUp(e);
return
}
var t = this.eventToPoint(e);
if (1 === this.app.zoomValue) {
if (null !== this.dragSheet) {
var i = t.x - this.startPoint.x;
Math.abs(i) > 2 * this.swipeThreshold && (this.drag === n.TURN_DIRECTION.LEFT && i > 0 ? this.app.openLeft() : this.drag === n.TURN_DIRECTION.RIGHT && i < 0 && this.app.openRight()),
this.requestRefresh(),
this.updatePendingStatusClass()
}
var o = e.target || e.originalTarget
, a = this.startPoint && t.x === this.startPoint.x && t.y === this.startPoint.y && "A" !== o.nodeName;
!0 === e.ctrlKey && a ? this.zoomOnPoint(t) : a && t.sheet && this.clickAction === n.MOUSE_CLICK_ACTIONS.NAV && (t.sheet.sheetAngle > 90 ? this.app.openRight() : this.app.openLeft())
}
this.dragSheet = null,
this.drag = null,
!0 === this.isDragging && (this.isDragging = !1),
this.startPoint = null,
this.canSwipe = !1,
this.app.renderRequestStatus = n.REQUEST_STATUS.ON
}
}
}, {
key: "raycastCLick",
value: function(e) {
this.mouse = new THREE.Vector2,
this.raycaster = new THREE.Raycaster,
this.mouse.x = e.offsetX / this.app.dimensions.stage.width * 2 - 1,
this.mouse.y = 1 - e.offsetY / this.app.dimensions.stage.height * 2,
this.raycaster.setFromCamera(this.mouse, this.camera);
var t = this.raycaster.intersectObjects(this.bookWrapper.children, !0);
if (t.length > 0) {
var i, n = 0;
do {
if ((i = null != t[n] ? t[n].object : null).sheet && i.sheet.index && !0 !== i.sheet.isFlipping)
return i;
n++
} while (n < t.length)
}
}
}, {
key: "mouseDown",
value: function(e) {
if ((e = eO.fixMouseEvent(e)).touches || 0 === e.button) {
if (null != e.touches && 2 === e.touches.length)
this.pinchDown(e);
else {
e = eO.fixMouseEvent(e);
var t = this.eventToPoint(e);
this.startPoint = t,
this.lastPosX = t.x,
this.lastPosY = t.y;
var i = this.raycastCLick(e)
, o = t.sheet ? t.sheet.width - Math.abs(t.x - (this.app.dimensions.origin.x + this.centerEnd)) : 0;
t.sheet && i && t.isInsideSheet && o < t.sheet.width / 2 ? (this.dragSheet = i.sheet,
this.drag = t.sheet.sheetAngle < 90 ? n.TURN_DIRECTION.LEFT : n.TURN_DIRECTION.RIGHT) : this.canSwipe = !0
}
}
}
}, {
key: "eventToPoint",
value: function(e) {
var t = this.app.dimensions
, i = {
x: (e = eO.fixMouseEvent(e)).clientX,
y: e.clientY
};
i.x = i.x - this.parentElement[0].getBoundingClientRect().left,
i.y = i.y - this.parentElement[0].getBoundingClientRect().top;
var n = (-t.offset.width + t.containerWidth) / 2 - t.stage.width / 2
, o = (-t.offset.width + t.containerWidth) / 2 + t.stage.width / 2
, a = t.padding.top
, s = t.padding.top + this.availablePageHeight()
, r = i.x < this.seamPosition
, l = this.getBasePage() + (r ? 0 : 1)
, h = this.getPageByNumber(l);
h && (h = h.sheet);
var u = i.x > n && i.x < o && i.y > a && i.y < s;
return {
isInsideSheet: u,
isInsideDragZone: u && i.x - n < this.foldSense || o - i.x < this.foldSense,
x: i.x,
y: i.y,
left: n,
top: a,
right: o,
bottom: s,
raw: i,
isLeftSheet: r,
sheet: h
}
}
}, {
key: "checkPageLoading",
value: function() {
for (var e = !0, t = this.getVisiblePages().main, i = 0; i < (this.isBooklet ? 1 : 2); i++) {
var n = this.getPageByNumber(t[i]);
n && (e = n.textureLoaded && e)
}
this.element.toggleClass("df-loading", !e)
}
}, {
key: "textureLoadedCallback",
value: function(e) {
this.app.renderRequestStart(),
this.pagesReady()
}
}, {
key: "getTextureSize",
value: function(e) {
var t = eC(ex(i.prototype), "getTextureSize", this).call(this, e);
if (1 !== this.app.zoomValue || !0 === e.isAnnotation)
return t;
var n = eO.nearestPowerOfTwo(t.height)
, o = t.width * n / t.height;
return this.texturePowerOfTwo ? {
height: n,
width: o
} : t
}
}, {
key: "getPageByNumber",
value: function(e) {
if (this.has3DCover) {
var t = !this.isBooklet && e === this.app.pageCount && e % 2 == 0
, n = 1 === e;
if (!this.isRTL && n || this.isRTL && t)
return this.leftCover.frontPage;
if (!this.isRTL && t || this.isRTL && n)
return this.rightCover.backPage
}
return eC(ex(i.prototype), "getPageByNumber", this).call(this, e)
}
}, {
key: "setPage",
value: function(e) {
return eC(ex(i.prototype), "setPage", this).call(this, e)
}
}, {
key: "beforeFlip",
value: function() {
eC(ex(i.prototype), "beforeFlip", this).call(this)
}
}]),
i
}(z)
, eN = /*#__PURE__*/
function(e) {
eT(i, e);
var t = eE(i);
function i(e) {
ew(this, i);
var n, o = eb(n = t.call(this, e));
return o.element = null,
o.face = e.face,
o.parent3D = e.sheet,
o.sheet = e.sheet,
o.cssPage = new THREE.CSS3DObject(o.contentLayer[0]),
n
}
return eS(i, [{
key: "setLoading",
value: function() {
this.sheet.viewer.checkPageLoading()
}
}, {
key: "clearMap",
value: function() {
this.sheet.element.material[this.face].map = null,
this.sheet.element.material[this.face].needsUpdate = !0
}
}, {
key: "loadTexture",
value: function(e) {
var t = this
, i = e.texture
, o = e.callback;
function a(i, n) {
t.updateTextureLoadStatus(!0),
t.sheet.resetMatColor(t.face, e.texture === t.textureLoadFallback),
"function" == typeof o && o(e)
}
t.textureSrc = i,
"function" == typeof n.defaults.beforeLoadTexture && n.defaults.beforeLoadTexture({
texture: i,
page: t
}),
4 === this.face ? this.sheet.backImage(i, a) : this.sheet.frontImage(i, a)
}
}]),
i
}(S);
function eI(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function e_(e, t, i) {
return (e_ = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, i) {
var n = function(e, t) {
for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = eA(e)); )
;
return e
}(e, t);
if (n) {
var o = Object.getOwnPropertyDescriptor(n, t);
return o.get ? o.get.call(i || e) : o.value
}
}
)(e, t, i || e)
}
function eA(e) {
return (eA = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function eM(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && eD(e, t)
}
function eD(e, t) {
return (eD = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
function eF(e) {
var t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}();
return function() {
var i, n = eA(e);
return i = t ? Reflect.construct(n, arguments, eA(this).constructor) : n.apply(this, arguments),
i && ("object" == (i && "undefined" != typeof Symbol && i.constructor === Symbol ? "symbol" : typeof i) || "function" == typeof i) ? i : function(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}(this)
}
}
var ez = n.utils;
g.prototype.pinchDown = function(e) {
null != e.touches && 2 == e.touches.length && null == this.startTouches && (this.startTouches = ez.getTouches(e),
this.app.viewer.zoomCenter = ez.getVectorAvg(ez.getTouches(e, this.parentElement.offset())),
this.lastScale = 1)
}
,
g.prototype.pinchUp = function(e) {
null != e.touches && e.touches.length < 2 && !0 == this.pinchZoomDirty && (this.app.viewer.lastScale = this.lastScale,
this.app.container.removeClass("df-pinch-zoom"),
this.updateTemporaryScale(!0),
this.app.zoom(),
this.lastScale = null,
this.app.viewer.canSwipe = !1,
this.pinchZoomDirty = !1,
this.app.viewer._pinchZoomLastScale = null,
this.startTouches = null)
}
,
g.prototype.pinchMove = function(e) {
if (null != e.touches && 2 == e.touches.length && null != this.startTouches) {
this.pinchZoomDirty = !0,
this.app.container.addClass("df-pinch-zoom");
var t = ez.calculateScale(this.startTouches, ez.getTouches(e));
this.lastScale,
this.lastScale = t,
this.app.viewer.pinchZoomUpdateScale = ez.limitAt(t, this.app.viewer.minZoom / this.app.zoomValue, this.app.viewer.maxZoom / this.app.zoomValue),
this.app.viewer._pinchZoomLastScale != this.app.viewer.pinchZoomUpdateScale && (this.app.viewer.pinchZoomRequestStatus = n.REQUEST_STATUS.ON,
this.app.viewer._pinchZoomLastScale = this.app.viewer.pinchZoomUpdateScale),
e.preventDefault();
return
}
}
,
eL.prototype.resizeAnnotations = function(e) {
var t = this.getAnnotationElement(e);
if ((!t || "" === t.style.width) && 1 === this.app.zoomValue) {
var i = this.getPageByNumber(e)
, n = z.prototype.getViewPort.call(this, e);
if (i && n) {
n = n.clone({
dontFlip: !0
});
var o = e + "|" + this.rightSheetHeight
, a = i.cssPage;
if (a.lastStamp !== o) {
a.lastStamp = o;
var s = i.sheet.element.geometry.boundingBox
, r = Math.abs(s.max.x - s.min.x) * i.sheet.element.scale.x
, l = this.getDoublePageWidthFix(e) * r / n.width
, h = i.sheet.height / n.height
, u = a.element.querySelectorAll("section");
u.length > 0 && u.forEach(function(e) {
e.style.transform = "matrix(" + l + ", 0, 0, " + h + "," + n.transform[4] * l + "," + n.transform[5] * h + ")"
}),
this.app.provider.processTextContent(e, this.getTextElement(e, !0))
}
}
}
}
,
eL.prototype.finalizeAnnotations = function(e, t) {
z.prototype.finalizeAnnotations.call(this, e, t),
this.resizeAnnotations(t)
}
,
eL.prototype.updateCSSLayer = function() {
var e, t, i = this.getBasePage(), n = i + (this.isBooklet ? 0 : this.isRTL ? 1 : 0), o = i + (this.isBooklet ? 0 : this.isRTL ? 0 : 1), a = !this.isRTL && this.isBooklet ? void 0 : this.getPageByNumber(n), s = this.isRTL && this.isBooklet ? void 0 : this.getPageByNumber(o);
jQuery(this.stage.cssRenderer.domElement).find(".df-page-content").css({
display: "none"
});
var r = "vertical" == this.orientation;
if (this.leftViewport && null != a && a.sheet.element.visible) {
var l = a.cssPage;
if (null != l) {
var h = a.sheet.element.geometry.boundingBox;
e = Math.abs(h.max.x - h.min.x) * a.sheet.element.scale.x,
t = Math.abs(h.max.y - h.min.y) * a.sheet.element.scale.y,
l.rotation.y = 0,
l.position.z = 0,
l.position.x = 0,
jQuery(l.element).css({
width: r ? t : e,
height: r ? e : t,
top: r ? this.pageOffset + e / 2 : 0,
left: r ? 0 : -this.pageOffset - e / 2,
display: "block"
}),
this.resizeAnnotations(n)
}
}
if (this.rightViewPort && null != s && s.sheet.element.visible) {
var u = s.cssPage;
if (null != u) {
var p = s.sheet.element.geometry.boundingBox;
e = Math.abs(p.max.x - p.min.x) * s.sheet.element.scale.x,
t = Math.abs(p.max.y - p.min.y) * s.sheet.element.scale.y,
u.rotation.y = 0,
u.position.z = 0,
u.position.x = 0,
jQuery(u.element).css({
width: r ? t : e,
height: r ? e : t,
top: r ? -this.pageOffset - e / 2 : 0,
left: r ? 0 : this.pageOffset + e / 2,
display: "block"
}),
this.resizeAnnotations(o)
}
}
}
,
eL.prototype.initSpiral = function() {
if (this.app.pageCount < 3 && (this.hasSpiral = !1),
!0 === this.hasSpiral) {
this.spirals = new THREE.Group,
this.leftHoles = new THREE.Group,
this.rightHoles = new THREE.Group,
this.spiralGroup = new THREE.Group;
var e, t = new THREE.TorusGeometry(30,2,6,20), i = new THREE.MeshPhongMaterial({
color: null !== (e = this.app.options.spiralColor) && void 0 !== e ? e : 8947848
}), n = new THREE.Mesh(t,i);
n.castShadow = !0,
n.rotateX(-THREE.MathUtils.degToRad(-90));
for (var o = new THREE.Mesh(new THREE.BoxGeometry(8,15,5,1,1,1),new THREE.MeshBasicMaterial({
color: 4473924
})), a = new THREE.Mesh(new THREE.BoxGeometry(8,15,5,1,1,1),new THREE.MeshBasicMaterial({
color: 4473924
})), s = 0; s < this.spiralCount; s++) {
var r = -467.5 + 935 * s / this.spiralCount + 935 / this.spiralCount / 2
, l = n.clone();
l.position.y = r - 4,
this.spirals.add(l),
(l = n.clone()).position.y = r + 4,
this.spirals.add(l),
(l = o.clone()).position.y = r,
l.position.x = -28,
this.leftHoles.add(l),
(l = a.clone()).position.y = r,
l.position.x = 28,
this.rightHoles.add(l)
}
this.spiralGroup.add(this.spirals),
this.spiralGroup.add(this.leftHoles),
this.spiralGroup.add(this.rightHoles),
this.bookWrapper.add(this.spiralGroup),
"vertical" === this.orientation && this.spiralGroup.rotateZ(THREE.MathUtils.degToRad(-90)),
this.spiralGroup.scale.set(.1, .1, .1)
}
}
,
eL.prototype.set3DCoverNormal = function() {
var e = this.app.options.cover3DType;
if (e !== n.FLIPBOOK_COVER_TYPE.PLAIN) {
var t, i = e == n.FLIPBOOK_COVER_TYPE.RIDGE;
this.hasSpiral && !0 == i && (i = !1),
this.leftCover.fallbackMatColor = new THREE.Color("#f7f7f7"),
this.rightCover.fallbackMatColor = new THREE.Color("#f7f7f7"),
this.leftCover.setMatColor(this.color3DSheets, 5),
this.rightCover.setMatColor(this.color3DSheets, 4);
var o = "rgb(127,127,255)"
, a = document.createElement("canvas");
a.height = 128,
a.width = 128;
var s = a.getContext("2d");
s.fillStyle = o,
s.fillRect(0, 0, 128, 128),
(t = s.createLinearGradient(0, 0, 1.92, 0)).addColorStop(0, o),
t.addColorStop(1, "rgb(127,255,255)"),
s.fillStyle = t,
s.beginPath(),
s.moveTo(0, 0),
s.lineTo(1.92, 1.92),
s.lineTo(1.92, 126.08),
s.lineTo(0, 126.08),
s.closePath(),
s.fill(),
i && ((t = s.createLinearGradient(1.92, 0, 7.68, 0)).addColorStop(0, "rgb(127,127,255)"),
t.addColorStop(.25, "rgb(255,127,255)"),
t.addColorStop(.5, "rgb(0,127,255)"),
t.addColorStop(.75, "rgb(127,127,255)"),
t.addColorStop(1, "rgb(127,127,255)"),
s.fillStyle = t,
s.fillRect(1.92, 0, 7.68, 128)),
(t = s.createLinearGradient(0, 1.92, 0, 0)).addColorStop(0, o),
t.addColorStop(1, "rgb(127,255,255)"),
s.fillStyle = t,
s.beginPath(),
s.moveTo(i ? 5.76 : 1.92, 0),
s.lineTo(128, 0),
s.lineTo(126.08, 1.92),
s.lineTo(i ? 7.68 : 1.92, 1.92),
s.closePath(),
s.fill(),
(t = s.createLinearGradient(126.08, 0, 128, 0)).addColorStop(0, o),
t.addColorStop(1, "rgb(255,127,255)"),
s.fillStyle = t,
s.beginPath(),
s.moveTo(126.08, 1.92),
s.lineTo(128, 0),
s.lineTo(128, 128),
s.lineTo(126.08, 126.08),
s.closePath(),
s.fill(),
(t = s.createLinearGradient(0, 126.08, 0, 128)).addColorStop(0, o),
t.addColorStop(1, "rgb(127,0,255)"),
s.fillStyle = t,
s.beginPath(),
s.moveTo(i ? 7.68 : 1.92, 126.08),
s.lineTo(126.08, 126.08),
s.lineTo(128, 128),
s.lineTo(i ? 5.76 : 1.92, 128),
s.closePath(),
s.fill(),
this.leftCover.element.loadNormalMap(a, ey.MATERIAL_FACE.FRONT);
var r = document.createElement("canvas");
r.height = 128,
r.width = 128;
var l = r.getContext("2d");
l.fillStyle = o,
l.fillRect(0, 0, 128, 128),
(t = l.createLinearGradient(126.08, 0, 128, 0)).addColorStop(0, o),
t.addColorStop(1, "rgb(255,127,255)"),
l.fillStyle = t,
l.beginPath(),
l.moveTo(126.08, 1.92),
l.lineTo(128, 0),
l.lineTo(128, 128),
l.lineTo(126.08, 126.08),
l.closePath(),
l.fill(),
i && ((t = l.createLinearGradient(120.32, 0, 126.08, 0)).addColorStop(0, "rgb(127,127,255)"),
t.addColorStop(.25, "rgb(127,127,255)"),
t.addColorStop(.5, "rgb(255,127,255)"),
t.addColorStop(.75, "rgb(0,127,255)"),
t.addColorStop(1, "rgb(127,127,255)"),
l.fillStyle = t,
l.fillRect(120.32, 0, 5.76, 128)),
(t = l.createLinearGradient(0, 1.92, 0, 0)).addColorStop(0, o),
t.addColorStop(1, "rgb(127,255,255)"),
l.fillStyle = t,
l.beginPath(),
l.moveTo(0, 0),
l.lineTo(128 - 1.92 * (i ? 3 : 0), 0),
l.lineTo(128 - 1.92 * (i ? 4 : 1), 1.92),
l.lineTo(1.92, 1.92),
l.closePath(),
l.fill(),
(t = l.createLinearGradient(0, 0, 1.92, 0)).addColorStop(0, o),
t.addColorStop(1, "rgb(127,255,255)"),
l.fillStyle = t,
l.beginPath(),
l.moveTo(0, 0),
l.lineTo(1.92, 1.92),
l.lineTo(1.92, 126.08),
l.lineTo(0, 126.08),
l.closePath(),
l.fill(),
(t = l.createLinearGradient(0, 126.08, 0, 128)).addColorStop(0, o),
t.addColorStop(1, "rgb(127,0,255)"),
l.fillStyle = t,
l.beginPath(),
l.moveTo(1.92, 126.08),
l.lineTo(128 - 1.92 * (i ? 4 : 1), 126.08),
l.lineTo(128 - 1.92 * (i ? 3 : 0), 128),
l.lineTo(0, 128),
l.closePath(),
l.fill(),
this.rightCover.element.loadNormalMap(r, ey.MATERIAL_FACE.BACK)
}
}
,
eL.prototype.setcolor3DCover = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
0 == (e = e.trim()).indexOf("#") && 4 === e.length && (e = e.split("").map(function(e) {
return "#" == e ? e : e + e
}).join(""));
var t = ez.color.getBrightness(e);
isNaN(t) && (console.log("Improper Color code value. Needs a hex value! Using default 0.25"),
t = .25);
var i = (255 - t) / 255
, o = 1024
, a = document.createElement("canvas");
a.height = o,
a.width = o;
var s = a.getContext("2d");
if (s.fillStyle = e,
s.fillRect(0, 0, o, o),
s.strokeStyle = "rgba(50,50,50," + (i / 2 + .4) + ")",
s.strokeRect(.1 * o, .05 * o, o * (this.hasSpiral ? .9 : .85), .9 * o),
s.beginPath(),
s.strokeStyle = "rgba(50,50,50," + (i / 2 + .3) + ")",
s.lineWidth = 2,
s.moveTo(0, 0),
s.lineTo(.1 * o, .05 * o),
s.stroke(),
s.beginPath(),
s.strokeStyle = "rgba(50,50,50," + (i / 2 + .4) + ")",
s.moveTo(0, o),
s.lineTo(.1 * o, .95 * o),
s.stroke(),
s.beginPath(),
s.strokeStyle = "rgba(255,255,255,0.3)",
s.lineWidth = 4,
s.moveTo(0, 0),
s.lineTo(0, o),
s.moveTo(0, 0),
s.lineTo(o, 0),
s.stroke(),
s.beginPath(),
s.strokeStyle = "rgba(50,50,50," + (i / 2 + .3) + ")",
s.lineWidth = 4,
s.moveTo(0, o),
s.lineTo(o, o),
s.stroke(),
!1 === this.hasSpiral) {
s.beginPath();
var r = s.createLinearGradient(.95 * o, 0, o, 0);
r.addColorStop(0, "rgba(30,30,30," + (i + .3) + ")"),
r.addColorStop(1, "rgba(60,60,60," + (i + .3) + ")"),
s.fillStyle = r,
s.fillRect(.95 * o, 0, .05 * o, o),
s.beginPath(),
s.lineWidth = 1,
s.strokeStyle = "rgba(40,40,40," + (i + .3) + ")";
for (var l = 0; l < 17; l++)
s.moveTo(o - 3 * l, 0),
s.lineTo(o - 3 * l, o);
s.stroke()
} else
s.beginPath(),
s.strokeStyle = "rgba(50,50,50,0.2)",
s.lineWidth = 4,
s.moveTo(o, 0),
s.lineTo(o, o),
s.stroke();
this.leftCover.backImage(a);
var h = document.createElement("canvas");
h.height = o,
h.width = o;
var u = h.getContext("2d");
if (u.fillStyle = e,
u.fillRect(0, 0, o, o),
u.strokeStyle = "rgba(50,50,50," + (i / 2 + .5) + ")",
u.strokeRect(o * (this.hasSpiral ? 0 : .05), .05 * o, o * (this.hasSpiral ? .9 : .85), .9 * o),
u.beginPath(),
u.strokeStyle = "rgba(50,50,50," + (i / 2 + .3) + ")",
u.lineWidth = 2,
u.moveTo(o, 0),
u.lineTo(.9 * o, .05 * o),
u.stroke(),
u.beginPath(),
u.strokeStyle = "rgba(50,50,50," + (i / 2 + .5) + ")",
u.moveTo(o, o),
u.lineTo(.9 * o, .95 * o),
u.stroke(),
u.beginPath(),
u.strokeStyle = "rgba(255,255,255,0.3)",
u.lineWidth = 4,
u.moveTo(0, 0),
u.lineTo(o, 0),
u.stroke(),
u.beginPath(),
u.strokeStyle = "rgba(50,50,50," + (i / 2 + .3) + ")",
u.lineWidth = 4,
u.moveTo(o, 0),
u.lineTo(o, o),
u.moveTo(0, o),
u.lineTo(o, o),
u.stroke(),
!1 === this.hasSpiral) {
u.beginPath();
var p = u.createLinearGradient(0, 0, .05 * o, 0);
p.addColorStop(0, "rgba(0,0,0," + (i + .3) + ")"),
p.addColorStop(.2, "rgba(10,10,10," + (i + .3) + ")"),
p.addColorStop(1, "rgba(80,80,80," + (i + .3) + ")"),
u.fillStyle = p,
u.fillRect(0, 0, .05 * o, o),
u.beginPath(),
u.lineWidth = 1,
u.strokeStyle = "rgba(40,40,40," + (i + .3) + ")";
for (var c = 0; c < 17; c++)
u.moveTo(3 * c, 0),
u.lineTo(3 * c, o);
u.stroke()
} else
u.beginPath(),
u.strokeStyle = "rgba(255,255,255,0.2)",
u.lineWidth = 4,
u.moveTo(0, 0),
u.lineTo(0, o),
u.stroke();
this.rightCover.frontImage(h);
var d = document.createElement("canvas");
o = 128,
d.height = o,
d.width = o;
var f = d.getContext("2d");
f.fillStyle = "#ffffff",
f.fillRect(0, 0, o, o),
f.strokeStyle = "#cccccc",
f.lineWidth = 1;
for (var g = 0; g < o / 4; g++)
f.moveTo(4 * g, 0),
f.lineTo(4 * g, o);
f.stroke(),
this.leftSheets.element.loadImage(d, 1, null),
this.rightSheets.element.loadImage(d, 3, null),
this.app.renderRequestStatus = n.REQUEST_STATUS.ON
}
,
eL.prototype.refreshSpiral = function() {
if (!0 === this.hasSpiral) {
var e = this.midPosition + this.sheetDepth;
this.bookWrapper.children.forEach(function(t) {
t && t.sheetAngle && t.position.z + t.depth / 2 > e && (e = t.position.z + t.depth / 2)
}),
this.leftHoles.visible = this.isBooklet ? this.isRTL : !1 == this.isLeftClosed && !1 == this.leftCover.isFlipping,
this.rightHoles.visible = this.isBooklet ? !this.isRTL : !1 == this.isRightClosed && !1 == this.rightCover.isFlipping;
var t = "vertical" === this.orientation ? Math.max(this.leftHoles.visible ? this.leftSheetWidth : 0, this.rightHoles.visible ? this.rightSheetWidth : 0) : Math.max(this.leftHoles.visible ? this.leftSheetHeight : 0, this.rightHoles.visible ? this.rightSheetHeight : 0);
t /= 1e3,
this.leftHoles.position.z = this.rightHoles.position.z = e + 2 / t + (this.isClosedPage() ? 2 * this.leftCover.depth : 0) / t,
this.spiralGroup.scale.set(t, t, t)
}
}
;
var eB = /*#__PURE__*/
function(e) {
eM(o, e);
var t, i = eF(o);
function o(e, t) {
return eI(this, o),
e.flipbook3DTiltAngleUp = 0,
e.flipbook3DTiltAngleLeft = 0,
e.hasSpiral = !1,
e.flexibility = 0,
(e.cover3DType === n.FLIPBOOK_COVER_TYPE.RIDGE || e.cover3DType === n.FLIPBOOK_COVER_TYPE.BASIC) && (e.cover3DType = n.FLIPBOOK_COVER_TYPE.PLAIN),
i.call(this, e, t)
}
return t = [{
key: "init",
value: function() {
e_(eA(o.prototype), "init", this).call(this),
this.texturePowerOfTwo = !1,
this.app.container.addClass("df-hybrid-viewer df-pending")
}
}, {
key: "getAnnotationElement",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
return e_(eA(o.prototype), "getAnnotationElement", this).call(this, e, t, !0)
}
}, {
key: "getTextElement",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
return e_(eA(o.prototype), "getTextElement", this).call(this, e, t, !0)
}
}, {
key: "isAnimating",
value: function() {
return this.isFlipping()
}
}, {
key: "onCenterStartAnimation",
value: function(e) {
this.app.container.addClass("df-hide-zoomview")
}
}, {
key: "onCenterStopAnimation",
value: function(e) {
this.finalizeCenterAnimation()
}
}, {
key: "onCenterCompleteAnimation",
value: function(e) {
this.zoomViewer.updateCenter(),
this.finalizeCenterAnimation()
}
}, {
key: "finalizeCenterAnimation",
value: function() {
this.app.container.removeClass("df-hide-zoomview")
}
}, {
key: "afterFlip",
value: function() {
arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
!0 !== this.isAnimating() && (this.pagesReady(),
this.updatePendingStatusClass(),
this.updateZoomViewerTexture({
pageNumber: this.getBasePage()
}),
this.updateZoomViewerTexture({
pageNumber: this.getBasePage() + 1
}))
}
}, {
key: "exchangeTexture",
value: function(e, t) {
this.skipCenterAnimation = !0,
e_(eA(o.prototype), "exchangeTexture", this).call(this, e, t),
this.updateZoomViewerTextContent({
pageNumber: this.getBasePage()
}),
this.updateZoomViewerTextContent({
pageNumber: this.getBasePage() + 1
})
}
}, {
key: "updateZoomViewerTexture",
value: function(e) {
var t = this.zoomViewer.getPageByNumber(e.pageNumber);
t && "-1" === t.textureStamp && this.zoomViewer.setPage({
pageNumber: t.pageNumber,
texture: this.getPageByNumber(t.pageNumber).getTexture()
}) && this.updateZoomViewerTextContent(e)
}
}, {
key: "updateZoomViewerTextContent",
value: function(e) {
this.app.provider.processAnnotations(e.pageNumber, this.app.viewer.getAnnotationElement(e.pageNumber, !0)),
this.app.provider.processTextContent(e.pageNumber, this.app.viewer.getTextElement(e.pageNumber, !0))
}
}, {
key: "textureLoadedCallback",
value: function(e) {
this.app.renderRequestStart(),
this.updateZoomViewerTexture(e),
this.pagesReady()
}
}, {
key: "resizeAnnotations",
value: function(e) {}
}],
function(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}(o.prototype, t),
o
}(eL)
, eH = /*#__PURE__*/
function(e) {
eM(i, e);
var t = eF(i);
function i(e, n) {
var o;
return eI(this, i),
(o = t.call(this, e, n)).orientation = "vertical",
o
}
return i
}(eL);
function eU(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function eV(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function ej(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function eW(e, t, i) {
return t && ej(e.prototype, t),
i && ej(e, i),
e
}
function eG(e) {
return (eG = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function eq(e, t) {
return null != t && "undefined" != typeof Symbol && t[Symbol.hasInstance] ? !!t[Symbol.hasInstance](e) : e instanceof t
}
function eZ(e, t) {
return (eZ = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
function eK(e) {
return e && "undefined" != typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e
}
n.viewers = n.viewers || {},
n.viewers.flipbook = function e(t, i) {
return (eI(this, e),
(!1 == n.utils.canSupport3D() || void 0 === t.is3D) && (t.is3D = !1),
"flat3D" === t.is3D) ? (t.flexibility = 0,
new eB(t,i)) : "calendar3D" === t.is3D ? new eH(t,i) : ez.isTrue(t.is3D) ? new eL(t,i) : new Y(t,i)
}
,
n.viewers.default = n.viewers.reader = O,
n.viewers.slider = el;
var eQ = n.utils
, eX = /*#__PURE__*/
function() {
function e() {
eV(this, e),
this.baseUrl = null,
this.pdfDocument = null,
this.pdfApp = null,
this.pdfHistory = null,
this.externalLinkRel = null,
this.externalLinkEnabled = !0,
this._pagesRefCache = null
}
return eW(e, [{
key: "dispose",
value: function() {
this.baseUrl = null,
this.pdfDocument = null,
this.pdfApp = null,
this.pdfHistory = null,
this._pagesRefCache = null
}
}, {
key: "setDocument",
value: function(e, t) {
this.baseUrl = t,
this.pdfDocument = e,
this._pagesRefCache = Object.create(null)
}
}, {
key: "setViewer",
value: function(e) {
this.pdfApp = e,
this.externalLinkTarget = e.options.linkTarget
}
}, {
key: "setHistory",
value: function(e) {
this.pdfHistory = e
}
}, {
key: "pagesCount",
get: function() {
return this.pdfDocument.numPages
}
}, {
key: "page",
get: function() {
return this.pdfApp.currentPageNumber
},
set: function(e) {
this.pdfApp.gotoPage(e)
}
}, {
key: "navigateTo",
value: function(e) {
this.goToDestination(e)
}
}, {
key: "addLinkAttributes",
value: function(e, t) {
arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
var i = this.externalLinkTarget
, o = this.externalLinkRel
, a = this.externalLinkEnabled;
if (!t || "string" != typeof t)
throw Error('A valid "url" parameter must provided.');
var s = (0,
eQ.removeNullCharacters)(t);
a ? e.href = e.title = s : (e.href = "",
e.title = "Disabled: ".concat(s),
e.onclick = function() {
return !1
}
);
var r = "";
switch (i) {
case n.LINK_TARGET.NONE:
break;
case n.LINK_TARGET.SELF:
r = "_self";
break;
case n.LINK_TARGET.BLANK:
r = "_blank";
break;
case n.LINK_TARGET.PARENT:
r = "_parent";
break;
case n.LINK_TARGET.TOP:
r = "_top"
}
e.target = r,
e.rel = "string" == typeof o ? o : "noopener noreferrer nofollow"
}
}, {
key: "goToDestination",
value: function(e) {
var t, i = "", n = this, o = function(t) {
eQ.log("Requested: ", t);
var a = eq(t, Object) ? n._pagesRefCache[t.num + " " + t.gen + " R"] : t + 1;
a ? ((a = n.pdfApp.viewer.getViewerPageNumber(a)) > n.pdfApp.pageCount && (a = n.pdfApp.pageCount),
eQ.log("Loading for:", t, " at page ", a),
n.pdfApp.requestDestRefKey === t.num + " " + t.gen + " R" ? (n.pdfApp.gotoPage(a),
n.pdfHistory && n.pdfHistory.push({
dest: e,
hash: i,
page: a
})) : eQ.log("Expired Request for ", a, " with ", t)) : (n.pdfApp.container.addClass("df-fetch-pdf"),
n.pdfDocument.getPageIndex(t).then(function(e) {
var i = t.num + " " + t.gen + " R";
n._pagesRefCache[i] = e + 1,
o(t)
}))
};
"string" == typeof e ? (i = e,
t = this.pdfDocument.getDestination(e)) : t = Promise.resolve(e),
t.then(function(t) {
eQ.log("Started:", t),
e = t,
eq(t, Array) && (n.pdfApp.requestDestRefKey = t[0].num + " " + t[0].gen + " R",
o(t[0]))
})
}
}, {
key: "customNavigateTo",
value: function(e) {
if ("" !== e && null != e && "null" !== e) {
var t = null;
if (isNaN(Math.floor(e))) {
if ("string" == typeof e && isNaN(t = parseInt(e.replace("#", ""), 10))) {
window.open(e, this.pdfApp.options.linkTarget === n.LINK_TARGET.SELF ? "_self" : "_blank");
return
}
} else
t = e;
null != t && this.pdfApp.gotoPage(t)
}
}
}, {
key: "getDestinationHash",
value: function(e) {
if ("string" == typeof e)
return this.getAnchorUrl("#" + escape(e));
if (eq(e, Array)) {
var t = e[0]
, i = eq(t, Object) ? this._pagesRefCache[t.num + " " + t.gen + " R"] : t + 1;
if (i) {
var n = this.getAnchorUrl("#page=" + i)
, o = e[1];
if ((void 0 === o ? "undefined" : eK(o)) === "object" && "name"in o && "XYZ" === o.name) {
var a = e[4] || this.pdfApp.pageScaleValue
, s = parseFloat(a);
s && (a = 100 * s),
n += "&zoom=" + a,
(e[2] || e[3]) && (n += "," + (e[2] || 0) + "," + (e[3] || 0))
}
return n
}
}
return this.getAnchorUrl("")
}
}, {
key: "getCustomDestinationHash",
value: function(e) {
return "#" + escape(e)
}
}, {
key: "getAnchorUrl",
value: function(e) {
return (this.baseUrl || "") + e
}
}, {
key: "executeNamedAction",
value: function(e) {
switch (e) {
case "GoBack":
this.pdfHistory && this.pdfHistory.back();
break;
case "GoForward":
this.pdfHistory && this.pdfHistory.forward();
break;
case "NextPage":
this.page++;
break;
case "PrevPage":
this.page--;
break;
case "LastPage":
this.page = this.pagesCount;
break;
case "FirstPage":
this.page = 1
}
var t = document.createEvent("CustomEvent");
t.initCustomEvent("namedaction", !0, !0, {
action: e
}),
this.pdfApp.container.dispatchEvent(t)
}
}, {
key: "cachePageRef",
value: function(e, t) {
var i = t.num + " " + t.gen + " R";
this._pagesRefCache[i] = e
}
}]),
e
}()
, eY = /*#__PURE__*/
function() {
function e(t, i) {
eV(this, e),
this.props = t,
this.app = i,
this.textureCache = [],
this.pageCount = 0,
this.numPages = 0,
this.outline = [],
this.viewPorts = [],
this.requestedPages = "",
this.requestIndex = 0,
this.pagesToClean = [],
this.defaultPage = void 0,
this.pageSize = this.app.options.pageSize,
this._page1Pass = !1,
this._page2Pass = !1,
this.pageLabels = void 0,
this.textSearchLength = 0,
this.textSearch = "",
this.textContentSearch = [],
this.textContentJoinedSearch = [],
this.textOffsetSearch = [],
this.textContent = [],
this.textContentJoined = [],
this.textOffset = [],
this.autoLinkItemsCache = [],
this.autoLinkHitsCache = [],
this.searchHitItemsCache = [],
this.searchHits = [],
this.PDFLinkItemsCache = [],
this.canPrint = !0,
this.textPostion = []
}
return eW(e, [{
key: "finalize",
value: function() {}
}, {
key: "dispose",
value: function() {}
}, {
key: "softDispose",
value: function() {}
}, {
key: "setCache",
value: function(e, t, i) {
i && (void 0 === this.textureCache[i] && (this.textureCache[i] = []),
this.textureCache[i][e] = t)
}
}, {
key: "getCache",
value: function(e, t) {
return void 0 === this.textureCache[t] ? void 0 : this.textureCache[t][e]
}
}, {
key: "_isValidPage",
value: function(e) {
return e > 0 && e <= this.pageCount
}
}, {
key: "getLabelforPage",
value: function(e) {
return this.pageLabels && void 0 !== this.pageLabels[e - 1] ? this.pageLabels[e - 1] : e
}
}, {
key: "getThumbLabel",
value: function(e) {
var t = this.getLabelforPage(e);
return t !== e ? t + " (" + e + ")" : e
}
}, {
key: "getPageNumberForLabel",
value: function(e) {
if (!this.pageLabels)
return e;
var t = this.pageLabels.indexOf(e);
return t < 0 ? null : t + 1
}
}, {
key: "processPage",
value: function(e) {}
}, {
key: "cleanUpPages",
value: function() {}
}, {
key: "checkRequestQueue",
value: function() {}
}, {
key: "processAnnotations",
value: function() {}
}, {
key: "processTextContent",
value: function() {}
}, {
key: "loadDocument",
value: function() {}
}, {
key: "pagesLoaded",
value: function() {
this._page1Pass && this._page2Pass && (this.app.viewer.checkDocumentPageSizes(),
this.finalize())
}
}, {
key: "_documentLoaded",
value: function() {
this.finalizeOutLine(),
this.app && this.app.dimensions && void 0 === this.app.dimensions.pageFit && eQ.log("Provider needs to initialize page properties for the app"),
this.app._documentLoaded()
}
}, {
key: "finalizeOutLine",
value: function() {
if (null !== this.app && null !== this.app.options) {
var e = this.app.options.outline;
if (e)
for (var t = 0; t < e.length; t++)
e[t].custom = !0,
this.outline.push(e[t])
}
}
}, {
key: "search",
value: function() {}
}]),
e
}()
, eJ = /*#__PURE__*/
function(e) {
!function(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && eZ(e, t)
}(a, e);
var t, o = (t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}(),
function() {
var e, i = eG(a);
return e = t ? Reflect.construct(i, arguments, eG(this).constructor) : i.apply(this, arguments),
e && ("object" === eK(e) || "function" == typeof e) ? e : eU(this)
}
);
function a(e, t) {
eV(this, a);
var s, r, l = function(e) {
h.updateInfo(h.options.text.loading + " PDF Worker ...");
var t = document.createElement("a");
t.href = h.options.pdfjsWorkerSrc + u.cacheBustParameters,
t.hostname !== window.location.hostname && !0 === n.loadCorsPdfjsWorker ? (h.updateInfo(h.options.text.loading + " PDF Worker CORS ..."),
jQuery.ajax({
url: h.options.pdfjsWorkerSrc + u.cacheBustParameters,
cache: !0,
success: function(t) {
h.options.pdfjsWorkerSrc = eQ.createObjectURL(t, "text/javascript"),
"function" == typeof e && e()
}
})) : "function" == typeof e && e()
}, h = (s = o.call(this, e, t)).app, u = eU(s);
return u.pdfDocument = void 0,
u._page2Ratio = void 0,
u.cacheBustParameters = "?ver=" + n.version + "&pdfver=" + h.options.pdfVersion,
r = function() {
pdfjsLib.GlobalWorkerOptions.workerSrc = h.options.pdfjsWorkerSrc + u.cacheBustParameters,
pdfjsLib.canvasWillReadFrequently = n.defaults.canvasWillReadFrequently,
u.loadDocument()
}
,
"undefined" == typeof pdfjsLib ? (h.updateInfo(h.options.text.loading + " PDF Service ..."),
eQ.getScript(h.options.pdfjsSrc + u.cacheBustParameters, function() {
"function" == typeof define && i.amdO && window.requirejs && window.require && window.require.config ? (h.updateInfo(h.options.text.loading + " PDF Service (require) ..."),
window.require.config({
paths: {
"pdfjs-dist/build/pdf.worker": h.options.pdfjsWorkerSrc.replace(".js", "")
}
}),
window.require(["pdfjs-dist/build/pdf"], function(e) {
window.pdfjsLib = e,
l(r)
})) : l(r)
}, function() {
h.updateInfo("Unable to load PDF service.."),
u.dispose()
}, h.options.pdfjsSrc.indexOf("pdfjs-4") > 1)) : "function" == typeof r && r(),
s
}
return eW(a, [{
key: "dispose",
value: function() {
this.pdfDocument && this.pdfDocument.destroy(),
this.linkService = eQ.disposeObject(this.linkService),
this.pdfLoadProgress && this.pdfLoadProgress.destroy(),
this.pdfLoadProgress = null,
this.pdfDocument = null
}
}, {
key: "loadDocument",
value: function() {
var e = this.app
, t = this.app.options
, i = this
, n = t.pdfParameters || {};
if (n.url = eQ.httpsCorrection(n.url || t.source),
n.rangeChunkSize = t.rangeChunkSize,
n.cMapPacked = !0,
n.disableAutoFetch = t.disableAutoFetch,
n.disableStream = t.disableStream,
n.disableRange = !0 === t.disableRange,
n.disableFontFace = t.disableFontFace,
n.isEvalSupported = !1,
n.cMapUrl = t.cMapUrl,
n.imagesLocation = t.imagesLocation,
n.imageResourcesPath = t.imageResourcesPath,
!n.url && !n.data && !n.range) {
e.updateInfo("ERROR : No PDF File provided! ", "df-error");
return
}
var o = i.pdfLoadProgress = pdfjsLib.getDocument(n);
o._worker.promise.then(function(t) {
e.updateInfo(e.options.text.loading + " PDF ...")
}),
o.onPassword = function(e, t) {
switch (t) {
case pdfjsLib.PasswordResponses.NEED_PASSWORD:
var i = prompt("Enter the password to open the PDF file.");
if (null === i)
throw Error("No password givsen.");
e(i);
break;
case pdfjsLib.PasswordResponses.INCORRECT_PASSWORD:
var i = prompt("Invalid password. Please try again.");
if (!i)
throw Error("No password givaen.");
e(i)
}
}
,
o.promise.then(function(n) {
i.pdfDocument = n,
n.getPage(1).then(function(o) {
i.defaultPage = o;
var a, s = i.defaultPage.viewPort = o.getViewport({
scale: 1,
rotation: o._pageInfo.rotate + e.options.pageRotation
}), r = i.defaultPage.pageRatio = s.width / s.height;
i.viewPorts[1] = s,
e.dimensions.defaultPage = {
ratio: r,
viewPort: s,
width: s.width,
height: s.height
},
e.dimensions.maxTextureHeight = (null !== (a = t.maxTextureSize) && void 0 !== a ? a : 3200) / (r > 1 ? r : 1),
e.dimensions.maxTextureWidth = e.dimensions.maxTextureHeight * r,
e.dimensions.autoHeightRatio = 1 / r,
i.pageCount = n.numPages,
i.numPages = n.numPages,
i._page1Pass = !0,
i.pagesLoaded()
}),
n.numPages > 1 && !0 === e.checkSecondPage ? n.getPage(2).then(function(t) {
var n = t.getViewport({
scale: 1,
rotation: t._pageInfo.rotate + e.options.pageRotation
});
i._page2Ratio = n.width / n.height,
i.viewPorts[2] = n,
i._page2Pass = !0,
i.pagesLoaded()
}) : (i._page2Pass = !0,
i.pagesLoaded())
}).catch(function(t) {
if (null !== e && null != e.options) {
var n, o = "", a = document.createElement("a");
a.href = e.options.source,
a.hostname === window.location.hostname || -1 !== a.href.indexOf("file://") || eQ.isChromeExtension() || -1 !== a.href.indexOf("blob:") || (o = "<strong>CROSS ORIGIN!! </strong>");
var s = (null === (n = e.options) || void 0 === n ? void 0 : n.fileName) || a.href;
e.updateInfo(o + "<strong>Error: Cannot access file! </strong>" + s + "<br><br>" + t.message, "df-error"),
console.log(t),
e.container.removeClass("df-loading").addClass("df-error"),
i.dispose()
}
}),
o.getTotalLength = function() {
return i.pdfLoadProgress._transport._networkStream._fullRequestReader.contentLength
}
,
o.onProgress = function(t) {
if (null !== e) {
var i = 100 * t.loaded / o.getTotalLength();
isNaN(i) ? t && t.loaded ? (void 0 === o.lastLoaded || o.lastLoaded + 25e4 < t.loaded) && (o.lastLoaded = t.loaded,
e.updateInfo(e.options.text.loading + " PDF " + (Math.ceil(t.loaded / 1e4) / 100).toFixed(2).toString() + "MB ...")) : e.updateInfo(e.options.text.loading + " PDF ...") : e.updateInfo(e.options.text.loading + " PDF " + Math.ceil(Math.min(100, i)).toString().split(".")[0] + "% ...")
}
}
}
}, {
key: "pdfFetchStarted",
value: function() {
this.pdfFetchStatusCount = 0,
this.app.container.addClass("df-fetch-pdf"),
this.pdfFetchStatus = n.REQUEST_STATUS.COUNT
}
}, {
key: "checkRequestQueue",
value: function() {}
}, {
key: "finalize",
value: function() {
var e = this.app
, t = this;
null !== e && null !== e.options && (t.linkService = new eX,
t.linkService.setDocument(t.pdfDocument, null),
t.linkService.setViewer(e),
t.pdfDocument.getOutline().then(function(i) {
!0 === e.options.overwritePDFOutline && (i = []),
i = i || [],
t.outline = i
}).finally(function() {
t._getLabels()
}))
}
}, {
key: "_getLabels",
value: function() {
var e = this.app
, t = this;
t.pdfDocument.getPageLabels().then(function(i) {
if (i && !0 !== e.options.disablePageLabels) {
for (var n = i.length, o = 0, a = 0, s = 0; s < n; s++) {
var r = i[s];
if (r === (s + 1).toString())
o++;
else if ("" === r)
a++;
else
break
}
o >= n || a >= n || (t.pageLabels = i)
}
}).finally(function() {
t._getPermissions()
})
}
}, {
key: "_getPermissions",
value: function() {
var e = this.app
, t = this;
t.pdfDocument.getPermissions().then(function(i) {
null !== i && Array.isArray(i) && (t.canPrint = i.indexOf(pdfjsLib.PermissionFlag.PRINT) > -1,
!1 == t.canPrint && (console.log("PDF printing is disabled."),
e.options.showPrintControl = e.options.showPrintControl && t.canPrint))
}).finally(function() {
t._documentLoaded()
})
}
}, {
key: "processPage",
value: function(e) {
var t = this.app
, i = this
, n = e.pageNumber
, o = performance.now()
, a = t.viewer.getTextureSize(e);
if (!0 === DEARFLIP.defaults.cachePDFTexture && void 0 !== this.getCache(n, a.height)) {
t.applyTexture(this.getCache(n, a.height), e),
eQ.log("Texture loaded from cache for : " + n);
return
}
var s = t.viewer.getDocumentPageNumber(n);
eQ.log("Requesting PDF Page:" + s),
i.pdfDocument.getPage(s).then(function(r) {
i.viewPorts[n] || (e.isFreshPage = !0,
i.viewPorts[n] = r.getViewport({
scale: 1,
rotation: r._pageInfo.rotate + t.options.pageRotation
}));
var l, h = t.viewer.getRenderContext(r, e);
e.isFreshPage && (null === (l = t.viewer.getPageByNumber(e.pageNumber)) || void 0 === l || l.changeTexture(e.pageNumber, h.canvas.height)),
eQ.log("Page " + n + " rendering - " + h.canvas.width + "x" + h.canvas.height),
e.trace = i.requestIndex++,
i.requestedPages += "," + e.trace + "[" + s + "|" + h.canvas.height + "]",
r.cleanupAfterRender = !1,
r.render(h).promise.then(function() {
if (t.applyTexture(h.canvas, e),
!0 === DEARFLIP.defaults.cachePDFTexture && i.setCache(e.pageNumber, h.canvas, a.height),
!0 === t.options.cleanupAfterRender) {
var l = "," + e.trace + "[" + s + "|" + h.canvas.height + "]";
eQ.log("CleanUp Requesting for (" + n + ") actual " + s),
i.requestedPages.indexOf(l) > -1 && (i.requestedPages = i.requestedPages.replace(l, ""),
-1 == i.requestedPages.indexOf("[" + s + "|") ? (eQ.log("CleanUp Passed for (" + n + ") actual " + s),
i.pagesToClean.push(r),
i.pagesToClean.length > 0 && i.cleanUpPages()) : eQ.log("CleanUp Cancelled waiting for (" + n + ") actual " + s + " : " + i.requestedPages))
}
h = null,
eQ.log("Rendered " + n + " in " + (performance.now() - o) + " milliseconds")
}).catch(function(e) {
console.log(e)
})
}).catch(function(e) {
console.log(e)
})
}
}, {
key: "cleanUpPages",
value: function() {
for (; this.pagesToClean.length > 0; ) {
var e = this.pagesToClean.splice(-1)[0];
eQ.log("Cleanup Completed for PDF page: " + (e._pageIndex + 1)),
e.cleanup()
}
}
}, {
key: "clearSearch",
value: function() {
this.searchHits = [],
this.searchHitItemsCache = [],
this.totalHits = 0,
this.app.searchResults.html(""),
this.app.container.removeClass("df-search-open"),
this.textSearch = "",
this.app.container.find(".df-search-hits").remove()
}
}, {
key: "search",
value: function(e) {
if (this.textSearch !== e) {
if (this.clearSearch(),
e.length < 3 && "" != e) {
this.app.updateSearchInfo("Minimum 3 letters required.");
return
}
this.textSearch = e,
this.textSearchLength = e.length,
this.app.searchContainer.addClass("df-searching"),
this.app.container.addClass("df-fetch-pdf"),
this._search(e, 1)
}
}
}, {
key: "_search",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1
, i = this;
i.app.updateSearchInfo("Searching Page: " + t),
i.searchPage(t).then(function(n) {
for (var o, a = RegExp(e, "gi"), s = []; o = a.exec(n); )
s.push({
index: o.index,
length: i.textSearchLength
});
if (i.searchHits[t] = s,
s.length > 0) {
var r = i.app.viewer.searchPage(t);
!0 === r.include && (i.totalHits += s.length,
i.app.searchResults.append('<div class="df-search-result ' + (i.app.currentPageNumber === t ? "df-active" : "") + '" data-df-page="' + t + '"><span>Page ' + r.label + "</span><span>" + s.length + " " + (s.length > 1 ? "results" : "result") + "</span></div>"))
}
i.app.viewer.isActivePage(t) && (i.processTextContent(t, i.app.viewer.getTextElement(t, !0)),
i.app.ui.update()),
i._search(e, t + 1)
}).catch(function() {}).finally(function() {
0 == i.totalHits ? i.app.updateSearchInfo("No results Found!") : i.app.updateSearchInfo(i.totalHits + " results found"),
i.app.searchContainer.removeClass("df-searching"),
i.app.container.removeClass("df-fetch-pdf")
})
}
}, {
key: "prepareTextContent",
value: function(e, t) {
var i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]
, n = this;
if (void 0 == n.textContentJoinedSearch[t] || i) {
var o, n = this, a = 0, s = 0, r = 0;
n.textContentSearch[t] = [],
n.textContent[t] = [],
n.textOffsetSearch[t] = [],
n.textOffset[t] = [],
n.textContentJoinedSearch[t] = [],
n.textContentJoined[t] = [];
for (var l = 0; l < e.items.length; l++)
o = e.items[l],
n.textContentSearch[t].push(!0 === o.hasEOL ? o.str + " " : o.str),
n.textContent[t].push(o.str + " "),
s += r = (o.str.length || 0) + (!0 === o.hasEOL ? 1 : 0),
n.textOffsetSearch[t].push({
length: r,
offset: s - r
}),
a += r = (o.str.length || 0) + 1,
n.textOffset[t].push({
length: r,
offset: a - r
});
n.textContentJoinedSearch[t] = n.textContentSearch[t].join(""),
n.textContentJoined[t] = n.textContent[t].join("")
}
}
}, {
key: "searchPage",
value: function(e) {
var t = this;
return new Promise(function(i, n) {
if (t._isValidPage(e))
try {
var o = t.app.viewer.getDocumentPageNumber(e);
void 0 == t.textContentJoinedSearch[o] ? t.pdfDocument.getPage(o).then(function(e) {
e.getTextContent().then(function(e) {
t.prepareTextContent(e, o),
i(t.textContentJoinedSearch[o])
})
}) : i(t.textContentJoinedSearch[o])
} catch (e) {
eQ.log(e),
n(e)
}
else
n()
}
)
}
}]),
a
}(eY);
function e$(e) {
if (void 0 === e)
throw ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function e0(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function e1(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function e2(e, t, i) {
return t && e1(e.prototype, t),
i && e1(e, i),
e
}
function e3(e) {
return (e3 = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
)(e)
}
function e5(e, t) {
return (e5 = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
)(e, t)
}
n.providers.pdf = eJ;
var e8 = n.utils
, e9 = /*#__PURE__*/
function() {
function e(t) {
e0(this, e),
this._viewPort = new e7(0,0),
this._pageInfo = {
rotate: 0
},
this.src = t.src
}
return e2(e, [{
key: "getViewport",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
scale: 1
};
return new e7(this._viewPort.height * e.scale,this._viewPort.width * e.scale,e.scale)
}
}]),
e
}()
, e4 = /*#__PURE__*/
function() {
function e(t) {
e0(this, e),
this.source = [],
this.pages = [],
this.numPages = t.length;
for (var i = 0; i < t.length; i++)
this.source[i] = e8.httpsCorrection(t[i].toString()),
this.pages.push(new e9({
src: this.source[i]
}))
}
return e2(e, [{
key: "getPage",
value: function(e) {
var t = this;
return new Promise(function(i, n) {
try {
jQuery("<img/>").attr("src", t.source[e - 1]).prop("crossOrigin", "Anonymous").on("load", function() {
jQuery(this).off();
var e = new e9({
src: this.src
});
e._viewPort.height = this.height,
e._viewPort.width = this.width,
e._viewPort.scale = 1,
e.image = this,
i(e)
})
} catch (e) {
n(e)
}
}
)
}
}]),
e
}()
, e7 = /*#__PURE__*/
function() {
function e(t, i) {
var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
e0(this, e),
this.scale = n,
this.height = t,
this.width = i,
this.scale = n,
this.transform = [0, 0, 0, 0, 0, this.height]
}
return e2(e, [{
key: "clone",
value: function() {
return new e(this.height,this.width,this.scale)
}
}]),
e
}()
, e6 = /*#__PURE__*/
function(e) {
!function(e, t) {
if ("function" != typeof t && null !== t)
throw TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && e5(e, t)
}(n, e);
var t, i = (t = function() {
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
!0
} catch (e) {
return !1
}
}(),
function() {
var e, i = e3(n);
return e = t ? Reflect.construct(i, arguments, e3(this).constructor) : i.apply(this, arguments),
e && ("object" == (e && "undefined" != typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e) || "function" == typeof e) ? e : e$(this)
}
);
function n(e, t) {
e0(this, n);
var o, a = (o = i.call(this, e, t)).app, s = e$(o);
return s.document = new e4(a.options.source),
s.pageCount = s.document.numPages,
s.numPages = s.document.numPages,
s.loadDocument(),
o
}
return e2(n, [{
key: "dispose",
value: function() {}
}, {
key: "loadDocument",
value: function() {
var e = this.app
, t = this.app.options
, i = this;
i.document.getPage(1).then(function(n) {
i.defaultPage = n;
var o, a = i.defaultPage.viewPort = n._viewPort, s = i.defaultPage.pageRatio = a.width / a.height;
i.viewPorts[1] = a,
e.dimensions.defaultPage = {
ratio: s,
viewPort: a,
width: a.width,
height: a.height
},
e.dimensions.maxTextureHeight = (null !== (o = t.maxTextureSize) && void 0 !== o ? o : 3200) / (s > 1 ? s : 1),
e.dimensions.maxTextureWidth = e.dimensions.maxTextureHeight * s,
e.dimensions.autoHeightRatio = 1 / s,
i._page1Pass = !0,
i.pagesLoaded()
}),
i.pageCount > 1 && !0 === e.checkSecondPage ? i.document.getPage(2).then(function(e) {
var t = e._viewPort;
i._page2Ratio = t.width / t.height,
i.viewPorts[2] = t,
i._page2Pass = !0,
i.pagesLoaded()
}) : (i._page2Pass = !0,
i.pagesLoaded())
}
}, {
key: "finalize",
value: function() {
var e = this.app;
null !== e && null !== e.options && (this.linkService = new eX,
this.linkService.setViewer(e),
this._documentLoaded())
}
}, {
key: "processPage",
value: function(e) {
var t = this.app
, i = this
, n = e.pageNumber
, o = performance.now()
, a = t.viewer.getDocumentPageNumber(n);
e8.log("Requesting PDF Page:" + a),
i.document.getPage(a).then(function(a) {
i.viewPorts[n] || (e.isFreshPage = !0,
i.viewPorts[n] = a._viewPort);
var s, r, l = t.viewer.getRenderContext(a, e);
(e.isFreshPage && (null === (s = t.viewer.getPageByNumber(e.pageNumber)) || void 0 === s || s.changeTexture(e.pageNumber, l.canvas.height)),
e.preferCanvas = !0,
!0 === e.preferCanvas) ? (l.canvas.getContext("2d").drawImage(a.image, l.viewport.transform[4], 0, l.canvas.width * (null !== (r = l.viewport.widthFix) && void 0 !== r ? r : 1), l.canvas.height),
t.applyTexture(l.canvas, e)) : t.applyTexture({
src: a.src,
height: l.canvas.height,
width: l.canvas.width
}, e),
e8.log("Rendered " + n + " in " + (performance.now() - o) + " milliseconds")
})
}
}]),
n
}(eY);
function te(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
function tt(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}
function ti(e, t, i) {
return t && tt(e.prototype, t),
i && tt(e, i),
e
}
function tn(e) {
return e && "undefined" != typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e
}
n.providers.image = e6,
i(101);
var to = n.jQuery
, ta = n.utils
, ts = n.REQUEST_STATUS
, tr = /*#__PURE__*/
function() {
function e(t, i) {
te(this, e),
this.options = t,
this.app = i,
this.parentElement = this.app.container,
this.element = to("<div>", {
class: "df-ui"
}),
this.leftElement = to("<div>", {
class: "df-ui-left"
}).appendTo(this.element),
this.centerElement = to("<div>", {
class: "df-ui-center"
}).appendTo(this.element),
this.rightElement = to("<div>", {
class: "df-ui-right"
}).appendTo(this.element),
this.parentElement.append(this.element),
this.events = {},
this.controls = {}
}
return ti(e, [{
key: "init",
value: function() {
var e = this
, t = "<div>"
, i = this.app
, o = this.controls
, a = i.options.text
, s = i.options.icons;
e.createLogo(),
this.openRight = o.openRight = to(t, {
class: "df-ui-nav df-ui-next",
title: i.isRTL ? a.previousPage : a.nextPage,
html: '<div class="df-ui-btn ' + s.next + '"></div>'
}).on("click", function() {
i.openRight()
}),
this.openLeft = o.openLeft = to(t, {
class: "df-ui-nav df-ui-prev",
title: i.isRTL ? a.nextPage : a.previousPage,
html: '<div class="df-ui-btn ' + s.prev + '"></div>'
}).on("click", function() {
i.openLeft()
}),
!0 == i.options.autoPlay && (this.play = o.play = ta.createBtn("play", s.play, a.play).on("click", function() {
var e = to(this);
i.setAutoPlay(!e.hasClass(i.options.icons.pause))
}),
i.setAutoPlay(i.options.autoPlayStart)),
this.pageNumber = o.pageNumber = ta.createBtn("page").on("change", function() {
i.gotoPageLabel(o.pageInput.val())
}).on("keyup", function(e) {
13 === e.keyCode && i.gotoPageLabel(o.pageInput.val())
});
var r = "df_book_page_number_" + Math.ceil(performance.now() / 10);
this.pageInput = o.pageInput = to('<input id="' + r + '" type="text"/>').appendTo(o.pageNumber),
this.pageLabel = o.pageLabel = to('<label for="' + r + '"></label>').appendTo(o.pageNumber),
this.thumbnail = o.thumbnail = ta.createBtn("thumbnail", s.thumbnail, a.toggleThumbnails),
o.thumbnail.on("click", function() {
var t = to(this);
null == i.thumblist && i.initThumbs(),
i.thumbContainer.toggleClass("df-sidemenu-visible"),
t.toggleClass("df-active"),
t.hasClass("df-active") && (t.siblings(".df-active").trigger("click"),
i.thumbRequestStatus = ts.ON),
e.update(),
!1 === i.options.sideMenuOverlay && i.resizeRequestStart()
}).addClass("df-sidemenu-trigger"),
i.hasOutline() && (this.outline = o.outline = ta.createBtn("outline", s.outline, a.toggleOutline),
o.outline.on("click", function() {
var t = to(this);
if (null == i.outlineViewer && i.initOutline(),
i.outlineContainer) {
var n = i.outlineContainer;
t.toggleClass("df-active"),
n.toggleClass("df-sidemenu-visible"),
t.hasClass("df-active") && t.siblings(".df-active").trigger("click"),
e.update(),
!1 === i.options.sideMenuOverlay && i.resizeRequestStart()
}
}).addClass("df-sidemenu-trigger")),
!0 === i.options.showSearchControl && !0 !== ta.isMobile && "string" == typeof i.options.source && (o.search = ta.createBtn("search", s.search, a.search),
o.search.on("click", function() {
var t = to(this);
if (null == i.searchContainer && i.initSearch(),
i.searchContainer) {
var n = i.searchContainer;
t.toggleClass("df-active"),
n.toggleClass("df-sidemenu-visible"),
t.hasClass("df-active") && (t.siblings(".df-active").trigger("click"),
i.searchBox.focus()),
e.update(),
!1 === i.options.sideMenuOverlay && i.resizeRequestStart()
}
}).addClass("df-sidemenu-trigger"));
var l = e.element;
if (this.zoomIn = o.zoomIn = ta.createBtn("zoomin", s.zoomin, a.zoomIn).on("click", function() {
i.zoom(1),
e.update()
}),
this.zoomOut = o.zoomOut = ta.createBtn("zoomout", s.zoomout, a.zoomOut).on("click", function() {
i.zoom(-1),
e.update()
}),
this.resetZoom = o.resetZoom = ta.createBtn("resetzoom", s.resetzoom, a.resetZoom).on("click", function() {
i.resetZoom(-1),
e.update()
}),
i.viewer.isFlipBook) {
if (i.pageCount > 2) {
var h = i.viewer.pageMode === n.FLIPBOOK_PAGE_MODE.SINGLE;
this.pageMode = o.pageMode = ta.createBtn("pagemode", s[h ? "doublepage" : "singlepage"], h ? a.doublePageMode : a.singlePageMode).on("click", function() {
var e = to(this);
i.viewer.setPageMode({
isSingle: !e.hasClass(s.doublepage)
}),
i.viewer.pageModeChangedManually = !0
})
}
} else
this.pageFit = o.pageFit = ta.createBtn("pagefit", s.pagefit, a.pageFit).on("click", function() {
var e = o.pageFit;
!0 == !e.hasClass(s.widthfit) ? (e.addClass(s.widthfit),
e.html("<span>" + a.widthFit + "</span>"),
e.attr("title", a.widthFit)) : (e.removeClass(s.widthfit),
e.html("<span>" + a.pageFit + "</span>"),
e.attr("title", a.pageFit))
});
if (e.shareBox = new tl(i.container,i.options),
this.share = o.share = ta.createBtn("share", s.share, a.share).on("click", function() {
!0 === e.shareBox.isOpen ? e.shareBox.close() : (e.shareBox.update(i.getURLHash()),
e.shareBox.show())
}),
this.more = o.more = ta.createBtn("more", s.more).on("click", function(t) {
!0 !== e.moreContainerOpen && (to(this).addClass("df-active"),
e.moreContainerOpen = !0,
t.stopPropagation())
}),
this.startPage = o.startPage = ta.createBtn("start", s.start, a.gotoFirstPage).on("click", function() {
i.start()
}),
this.endPage = o.endPage = ta.createBtn("end", s.end, a.gotoLastPage).on("click", function() {
i.end()
}),
!0 === i.options.showPrintControl && !0 !== ta.isMobile && "string" == typeof i.options.source && (this.print = o.print = ta.createBtn("print", s.print, a.print).on("click", function() {
n.printHandler = n.printHandler || new tu,
n.printHandler.printPDF(i.options.source)
})),
!0 === i.options.showDownloadControl && "string" == typeof i.options.source) {
var u = "df-ui-btn df-ui-download " + s.download;
this.download = o.download = to('<a download target="_blank" class="' + u + '"><span>' + a.downloadPDFFile + "</span></a>"),
o.download.attr("href", ta.httpsCorrection(i.options.source)).attr("title", a.downloadPDFFile)
}
e.moreContainer = to(t, {
class: "df-more-container"
}),
o.more.append(e.moreContainer),
!0 === i.options.isLightBox && !0 !== i.fullscreenSupported || (this.fullScreen = o.fullScreen = ta.createBtn("fullscreen", s.fullscreen, a.toggleFullscreen).on("click", i.switchFullscreen.bind(i))),
i.viewer.initCustomControls();
var p = i.options.allControls.replace(/ /g, "").split(",")
, c = "," + i.options.moreControls.replace(/ /g, "") + ","
, d = "," + i.options.hideControls.replace(/ /g, "") + ",";
i.options.leftControls.replace(/ /g, ""),
i.options.rightControls.replace(/ /g, ""),
d += ",";
for (var f = 0; f < p.length; f++) {
var g = p[f];
if (0 > d.indexOf("," + g + ",")) {
var v = o[g];
null != v && (void 0 === v ? "undefined" : tn(v)) == "object" && (c.indexOf("," + g + ",") > -1 && "more" !== g && "pageNumber" !== g ? e.moreContainer.append(v) : !0 == i.options.controlsFloating ? l.append(v) : this.centerElement.append(v))
}
}
0 == e.moreContainer.children().length && this.more.addClass("df-hidden"),
i.container.append(l),
i.container.append(o.openLeft),
i.container.append(this.controls.openRight),
window.addEventListener("click", e.events.closePanels = e.closePanels.bind(e), !1),
window.addEventListener("keyup", e.events.keyup = e.keyUp.bind(e), !1),
document.addEventListener("fullscreenchange", e.events.fullscreenChange = e.fullscreenChange.bind(e), !1),
!0 === i.options.autoOpenThumbnail && e.controls.thumbnail.trigger("click"),
i.hasOutline() && !0 === i.options.autoOpenOutline && e.controls.outline.trigger("click"),
i.executeCallback("onCreateUI")
}
}, {
key: "closePanels",
value: function(e) {
if (!0 === this.moreContainerOpen) {
var t;
null === (t = this.controls.more) || void 0 === t || t.removeClass("df-active"),
this.moreContainerOpen = !1
}
}
}, {
key: "fullscreenChange",
value: function(e) {
void 0 === ta.getFullscreenElement() && !0 === this.app.isFullscreen && this.app.switchFullscreen()
}
}, {
key: "keyUp",
value: function(e) {
var t = this.app;
if ("INPUT" !== e.target.nodeName) {
var i = !1;
switch (t.options.arrowKeysAction === n.ARROW_KEYS_ACTIONS.NAV && ((!0 === t.isFullscreen || !0 === t.options.isLightBox) && (i = !0),
!0 != t.options.isLightBox && n.activeEmbeds.length < 2 && !1 === to("body").hasClass("df-lightbox-open") && (i = !0)),
e.keyCode) {
case 27:
n.activeLightBox && n.activeLightBox.app && !ta.isChromeExtension() && n.activeLightBox.closeButton.trigger("click");
break;
case 37:
i && t.openLeft();
break;
case 39:
i && t.openRight()
}
}
}
}, {
key: "createLogo",
value: function() {
var e = this.app
, t = null;
e.options.logo.indexOf("<") > -1 ? t = to(e.options.logo).addClass("df-logo df-logo-html") : e.options.logo.trim().length > 2 && (t = to('<a class="df-logo df-logo-img" target="_blank" href="' + e.options.logoUrl + '"><img alt="" src="' + e.options.logo + '"/>')),
this.element.append(t)
}
}, {
key: "dispose",
value: function() {
for (var e in this.controls)
if (this.controls.hasOwnProperty(e)) {
var t = this.controls[e];
null !== t && (void 0 === t ? "undefined" : tn(t)) == "object" && t.off().remove()
}
this.element.remove(),
this.shareBox = ta.disposeObject(this.shareBox),
window.removeEventListener("click", this.events.closePanels, !1),
window.removeEventListener("keyup", this.events.keyup, !1),
document.removeEventListener("fullscreenchange", this.events.fullscreenChange, !1)
}
}, {
key: "update",
value: function() {
var e = this.app
, t = this.controls;
!0 !== this._pageLabelWidthSet && (this.pageLabel.width(""),
e.provider.pageLabels ? this.pageLabel.html("88888888888888888".substring(0, 3 * e.pageCount.toString().length + 4)) : this.pageLabel.html("88888888888".substring(0, 2 * e.pageCount.toString().length + 3)),
this.pageNumber.width(this.pageLabel.width()),
this.pageLabel.width(this.pageLabel.width()),
this.pageLabel.html(""),
this._pageLabelWidthSet = !0);
var i = e.getCurrentLabel();
i.toString() !== e.currentPageNumber.toString() ? t.pageLabel.html(i + "(" + e.currentPageNumber + "/" + e.pageCount + ")") : t.pageLabel.html(i + "/" + e.pageCount),
t.pageInput.val(i),
e.container.toggleClass("df-sidemenu-open", e.container.find(".df-sidemenu-visible").length > 0);
var n = e.provider.totalHits > 0 && e.container.find(".df-sidemenu-visible.df-search-container").length > 0;
if (e.container.toggleClass("df-search-open", n),
n) {
var o = e.searchContainer.find(".df-search-result[data-df-page=" + e.currentPageNumber + "]");
if (e.searchContainer.find(".df-search-result.df-active").removeClass("df-active"),
o.length > 0 && !o.hasClass(".df-active")) {
o.addClass("df-active");
var a = e.searchResults[0]
, s = a.scrollTop;
s + a.getBoundingClientRect().height < (o = o[0]).offsetTop + o.scrollHeight ? ta.scrollIntoView(o, null, !1) : s > o.offsetTop && ta.scrollIntoView(o)
}
}
t.zoomIn.toggleClass("disabled", e.zoomValue === e.viewer.maxZoom),
t.zoomOut.toggleClass("disabled", e.zoomValue === e.viewer.minZoom);
var r = e.isRTL
, l = e.currentPageNumber === e.startPage
, h = e.currentPageNumber === e.endPage
, u = l && !r || h && r
, p = h && !r || l && r;
t.openRight.toggleClass("df-hidden", p),
t.openLeft.toggleClass("df-hidden", u),
e.viewer.afterControlUpdate()
}
}]),
e
}()
, tl = /*#__PURE__*/
function() {
function e(t, i) {
te(this, e),
this.isOpen = !1,
this.shareUrl = "",
this.init(t, i)
}
return ti(e, [{
key: "init",
value: function(e, t) {
var i = this;
for (var n in i.wrapper = to('<div class="df-share-wrapper" style="display: none;">').on("click", function() {
i.close()
}),
i.box = to('<div class="df-share-box">'),
i.box.on("click", function(e) {
e.preventDefault(),
e.stopPropagation()
}),
i.box.appendTo(i.wrapper).html('<span class="df-share-title">' + t.text.share + "</span>"),
i.urlInput = to('<textarea name="df-share-url" class="df-share-url">').on("click", function() {
to(this).select()
}),
i.box.append(i.urlInput),
t.share)
!function(e) {
if (t.share.hasOwnProperty(e) && 0 > t.hideShareControls.indexOf(e)) {
var n = t.share[e];
null !== n && (i[e] = to("<div>", {
class: "df-share-button df-share-" + e + " " + t.icons[e]
}).on("click", function(e) {
e.preventDefault(),
window.open(n.replace("{{url}}", encodeURIComponent(i.shareUrl)).replace("{{mailsubject}}", t.text.mailSubject), "Sharer", "width=500,height=400"),
e.stopPropagation()
}),
i.box.append(i[e]))
}
}(n);
to(e).append(i.wrapper)
}
}, {
key: "show",
value: function() {
this.wrapper.fadeIn(300),
this.urlInput.val(this.shareUrl),
this.urlInput.trigger("click"),
this.isOpen = !0
}
}, {
key: "dispose",
value: function() {
for (var e in this)
this.hasOwnProperty(e) && this[e] && this[e].off && this[e].off();
this.wrapper.remove()
}
}, {
key: "close",
value: function() {
this.wrapper.fadeOut(300),
this.isOpen = !1
}
}, {
key: "update",
value: function(e) {
this.shareUrl = e
}
}]),
e
}()
, th = /*#__PURE__*/
function() {
function e(t) {
te(this, e),
this.duration = 300;
var i = this;
return i.lightboxWrapper = to("<div>").addClass("df-lightbox-wrapper"),
i.backGround = to("<div>").addClass("df-lightbox-bg").appendTo(i.lightboxWrapper),
i.element = to("<div>").addClass("df-app").appendTo(i.lightboxWrapper),
i.controls = to("<div>").addClass("df-lightbox-controls").appendTo(i.lightboxWrapper),
i.closeButton = to("<div>").addClass("df-lightbox-close df-ui-btn " + n.defaults.icons.close).on("click", function() {
i.close(t)
}).appendTo(i.controls),
i.lightboxWrapper.append(i.element),
i
}
return ti(e, [{
key: "show",
value: function(e) {
return 0 === this.lightboxWrapper.parent().length && to("body").append(this.lightboxWrapper),
to("html,body").addClass("df-lightbox-open"),
this.lightboxWrapper.fadeIn(this.duration),
"function" == typeof e && e(),
this
}
}, {
key: "close",
value: function(e) {
return this.lightboxWrapper.fadeOut(this.duration),
Array.prototype.forEach.call(n.utils.getSharePrefixes(), function(e) {
0 === window.location.hash.indexOf("#" + e) && history.replaceState(void 0, void 0, "#_")
}),
"function" == typeof e && setTimeout(e, this.duration),
to("html,body").removeClass("df-lightbox-open"),
this.element.attr("class", "df-app").attr("style", ""),
this.lightboxWrapper.attr("class", "df-lightbox-wrapper").attr("style", ""),
this.backGround.attr("style", ""),
this
}
}]),
e
}()
, tu = /*#__PURE__*/
function() {
function e() {
te(this, e);
var t = this;
return t.frame = to('<iframe id="df-print-frame" style="display:none">').appendTo(to("body")),
t.frame.on("load", function() {
try {
t.frame[0].contentWindow.print()
} catch (e) {
console.log(e)
}
}),
t
}
return ti(e, [{
key: "printPDF",
value: function(e) {
this.frame[0].src = e
}
}]),
e
}()
, tp = /*#__PURE__*/
function() {
function e(t, i) {
te(this, e),
this.options = t,
this.app = i,
this.parentElement = t.parentElement,
this.element = to("<div>", {
class: "df-sidemenu-wrapper"
}),
this.parentElement.append(this.element),
this.buttons = to("<div>", {
class: "df-sidemenu-buttons df-ui-wrapper"
}).appendTo(this.element),
this.close = ta.createBtn("close", i.options.icons.close, i.options.text.close),
this.buttons.append(this.close)
}
return ti(e, [{
key: "dispose",
value: function() {
this.element.remove()
}
}]),
e
}()
, tc = /*#__PURE__*/
function() {
function e(t) {
te(this, e),
this.outline = null,
this.lastToggleIsShow = !0,
this.container = t.container,
this.linkService = t.linkService,
this.outlineItemClass = t.outlineItemClass || "outlineItem",
this.outlineToggleClass = t.outlineToggleClass || "outlineItemToggler",
this.outlineToggleHiddenClass = t.outlineToggleHiddenClass || "outlineItemsHidden"
}
return ti(e, [{
key: "dispose",
value: function() {
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container),
this.linkService = null
}
}, {
key: "reset",
value: function() {
this.outline = null,
this.lastToggleIsShow = !0;
for (var e = this.container; e.firstChild; )
e.removeChild(e.firstChild)
}
}, {
key: "_dispatchEvent",
value: function(e) {
var t = document.createEvent("CustomEvent");
t.initCustomEvent("outlineloaded", !0, !0, {
outlineCount: e
}),
this.container.dispatchEvent(t)
}
}, {
key: "_bindLink",
value: function(e, t) {
var i = this.linkService;
if (!0 === t.custom)
e.href = i.getCustomDestinationHash(t.dest),
e.onclick = function() {
return i.customNavigateTo(t.dest),
!1
}
;
else {
if (t.url) {
pdfjsLib.addLinkAttributes(e, {
url: t.url
});
return
}
e.href = i.getDestinationHash(t.dest),
e.onclick = function() {
return i.navigateTo(t.dest),
!1
}
}
}
}, {
key: "_addToggleButton",
value: function(e) {
var t = this
, i = document.createElement("div");
i.className = this.outlineToggleClass + " " + this.outlineToggleHiddenClass,
i.onclick = (function(n) {
if (n.stopPropagation(),
i.classList.toggle(this.outlineToggleHiddenClass),
n.shiftKey) {
var o = !i.classList.contains(this.outlineToggleHiddenClass);
t._toggleOutlineItem(e, o)
}
}
).bind(this),
e.insertBefore(i, e.firstChild)
}
}, {
key: "_toggleOutlineItem",
value: function(e, t) {
this.lastToggleIsShow = t;
for (var i = e.querySelectorAll("." + this.outlineToggleClass), n = 0, o = i.length; n < o; ++n)
i[n].classList[t ? "remove" : "add"](this.outlineToggleHiddenClass)
}
}, {
key: "render",
value: function(e) {
var t = e && e.outline || null
, i = 0;
if (this.outline && this.reset(),
this.outline = t,
t) {
for (var n = document.createDocumentFragment(), o = [{
parent: n,
items: this.outline,
custom: !1
}], a = !1; o.length > 0; )
for (var s = o.shift(), r = s.custom, l = 0, h = s.items.length; l < h; l++) {
var u = s.items[l]
, p = document.createElement("div");
p.className = this.outlineItemClass;
var c = document.createElement("a");
if (null == u.custom && null != r && (u.custom = r),
this._bindLink(c, u),
c.textContent = u.title.replace(/\x00/g, ""),
p.appendChild(c),
u.items && u.items.length > 0) {
a = !0,
this._addToggleButton(p);
var d = document.createElement("div");
d.className = this.outlineItemClass + "s",
p.appendChild(d),
o.push({
parent: d,
custom: u.custom,
items: u.items
})
}
s.parent.appendChild(p),
i++
}
a && (null != this.container.classList ? this.container.classList.add(this.outlineItemClass + "s") : null != this.container.className && (this.container.className += " picWindow")),
this.container.appendChild(n),
this._dispatchEvent(i)
}
}
}]),
e
}()
, td = /*#__PURE__*/
function() {
function e(t) {
te(this, e);
var i = function() {
a.thumbRequestCount = 0,
a.thumbRequestStatus = ts.COUNT
}
, n = this.itemHeight = t.itemHeight
, o = this.itemWidth = t.itemWidth
, a = this.app = t.app;
this.items = t.items,
this.generatorFn = t.generatorFn,
this.totalRows = t.totalRows || t.items && t.items.length,
this.addFn = t.addFn,
this.scrollFn = t.scrollFn,
this.container = document.createElement("div");
for (var s = this, r = 0; r < this.totalRows; r++) {
var l = document.createElement("div")
, h = r + 1;
l.id = "df-thumb" + h;
var u = document.createElement("div")
, p = document.createElement("div")
, c = document.createElement("div");
c.className = "df-wrapper",
p.className = "df-thumb-number",
l.className = "df-thumb",
u.className = "df-bg-image",
c.style.height = n + "px",
c.style.width = o + "px",
p.innerText = a.provider.getLabelforPage(h),
l.appendChild(c),
c.appendChild(p),
c.appendChild(u),
this.container.appendChild(l)
}
s.dispose = function() {
s.container && s.container.parentNode && s.container.parentNode.removeChild(s.container),
s.container.removeEventListener("scroll", i)
}
,
s.container.addEventListener("scroll", i)
}
return ti(e, [{
key: "processThumbRequest",
value: function() {
ta.log("Thumb Request Initiated");
var e = this.app;
if (e.thumbRequestStatus = ts.OFF,
e.activeThumb !== e.currentPageNumber && null != e.thumbContainer && e.thumbContainer.hasClass("df-sidemenu-visible")) {
var t = e.thumblist.container
, i = t.scrollTop
, o = t.getBoundingClientRect().height
, a = e.thumbContainer.find("#df-thumb" + e.currentPageNumber);
a.length > 0 ? (e.thumbContainer.find(".df-selected").removeClass("df-selected"),
a.addClass("df-selected"),
i + o < (a = a[0]).offsetTop + a.scrollHeight ? ta.scrollIntoView(a, null, !1) : i > a.offsetTop && ta.scrollIntoView(a),
e.activeThumb = e.currentPageNumber) : (to(t).scrollTop(124 * e.currentPageNumber),
e.thumbRequestStatus = ts.ON)
}
if (0 === e.thumblist.container.getElementsByClassName("df-thumb-requested").length) {
var s = ta.getVisibleElements({
container: e.thumblist.container,
elements: e.thumblist.container.children
});
to.inArray(s) && s.unshift(e.activeThumb);
for (var r = 0; r < s.length; r++) {
var l = e.thumblist.container.children[s[r] - 1];
if (void 0 !== l && !1 === l.classList.contains("df-thumb-loaded") && !1 === l.classList.contains("df-thumb-requested"))
return l.classList.add("df-thumb-requested"),
ta.log("Thumb Requested for " + s[r]),
e.provider.processPage({
pageNumber: s[r],
textureTarget: n.TEXTURE_TARGET.THUMB
}),
!1
}
}
}
}, {
key: "setPage",
value: function(e) {
var t = this.app
, i = e.pageNumber
, o = e.texture;
if (e.textureTarget === n.TEXTURE_TARGET.THUMB) {
var a = t.container.find("#df-thumb" + i);
a.find(".df-wrapper").css({
height: e.height,
width: e.width
}),
a.find(".df-bg-image").css({
backgroundImage: ta.bgImage(o)
}),
a.addClass("df-thumb-loaded").removeClass("df-thumb-requested")
}
ta.log("Thumbnail set for " + e.pageNumber),
t.thumbRequestStatus = ts.ON
}
}]),
e
}();
function tf() {
if (void 0 === n.openLocalFileInput) {
var e = n.openLocalFileInput = to('<input type="file" accept=".pdf" style="display:none">').appendTo(to("body")).data("df-option", n.openFileOptions);
e.change(function() {
var t, i = e[0].files;
i.length && (t = i[0],
e.val(""),
n.openFile(t))
})
}
}
n.openLightBox = function(e) {
n.activeLightBox || (n.activeLightBox = new th(function() {
n.activeLightBox.app && (n.activeLightBox.app.closeRequested = !0,
n.activeLightBox.app.analytics({
eventAction: n.activeLightBox.app.options.analyticsViewerClose,
options: n.activeLightBox.app.options
})),
n.activeLightBox.app = ta.disposeObject(n.activeLightBox.app)
}
)),
n.activeLightBox.duration = 300,
(void 0 === n.activeLightBox.app || null === n.activeLightBox.app || !0 === n.activeLightBox.app.closeRequested || n.openLocalFileInput == e) && (n.activeLightBox.app = ta.disposeObject(n.activeLightBox.app),
null === n.activeLightBox.app && n.activeLightBox.show(function() {
n.activeLightBox.app = to(n.activeLightBox.element).dearviewer({
transparent: !1,
isLightBox: !0,
hashNavigationEnabled: !0,
height: "100%",
dataElement: e
}),
history.pushState({}, null, "#"),
n.activeLightBox.lightboxWrapper.toggleClass("df-lightbox-padded", !1 === n.activeLightBox.app.options.popupFullsize),
n.activeLightBox.lightboxWrapper.toggleClass("df-rtl", n.activeLightBox.app.options.readDirection === n.READ_DIRECTION.RTL),
n.activeLightBox.backGround.css({
backgroundColor: "transparent" === n.activeLightBox.app.options.backgroundColor ? n.defaults.popupBackGroundColor : n.activeLightBox.app.options.backgroundColor
})
}))
}
,
n.checkBrowserURLforDefaults = function() {
if (!ta.isIEUnsupported) {
var e = new URL(location.href).searchParams.get("viewer-type") || new URL(location.href).searchParams.get("viewertype")
, t = new URL(location.href).searchParams.get("is-3d") || new URL(location.href).searchParams.get("is3d");
e && (n.defaults.viewerType = e),
("true" === t || "false" === t) && (n.defaults.is3D = "true" === t)
}
}
,
n.checkBrowserURLforPDF = function() {
var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
if (!ta.isIEUnsupported) {
var t = new URL(location.href).searchParams.get("pdf-source");
return t && (t = decodeURI(t),
e && n.openURL(t)),
t
}
}
,
n.fileDropHandler = function(e, t) {
var i = e[0];
"application/pdf" === i.type && (t.preventDefault(),
t.stopPropagation(),
n.openFile(i))
}
,
n.openFile = function(e) {
if (e) {
var t;
n.oldLocalFileObjectURL && window.URL.revokeObjectURL(n.oldLocalFileObjectURL),
n.oldLocalFileObjectURL = window.URL.createObjectURL(e),
null === (t = n.openFileSelected) || void 0 === t || t.call(n, {
url: n.oldLocalFileObjectURL,
file: e
}),
n.openURL(n.oldLocalFileObjectURL)
} else
n.openURL()
}
,
n.openURL = function(e) {
tf(),
e && (n.openFileOptions.source = e,
n.openFileOptions.pdfParameters = null),
n.openLightBox(n.openLocalFileInput)
}
,
n.openBase64 = function(e) {
n.openFileOptions.source = null,
n.openFileOptions.pdfParameters = {
data: atob(e)
},
n.openURL()
}
,
n.openLocalFile = function() {
tf(),
n.openLocalFileInput.click()
}
,
n.initControls = function() {
var e = to("body");
if (!1 !== n.defaults.autoPDFLinktoViewer && e.on("click", 'a[href$=".pdf"]', function(e) {
var t = to(this);
void 0 !== t.attr("download") || "_blank" === t.attr("target") || t.hasClass("df-ui-btn") || t.parents(".df-app").length > 0 || (e.preventDefault(),
t.data("df-source", t.attr("href")),
n.openLightBox(t))
}),
window.addEventListener("popstate", function(e) {
n.activeLightBox && n.activeLightBox.app && !ta.isChromeExtension() && n.activeLightBox.closeButton.trigger("click")
}),
e.on("click", ".df-open-local-file", function(e) {
n.openLocalFile()
}),
e.on("click", ".df-sidemenu-buttons .df-ui-close", function() {
to(this).closest(".df-app").find(".df-ui-btn.df-active").trigger("click")
}),
e.on("mouseout", ".df-link-content section.squareAnnotation, .df-link-content section.textAnnotation, .df-link-content section.freeTextAnnotation", function() {
var e = to(this);
n.handlePopup(e, !1)
}),
e.on("mouseover", ".df-link-content section.squareAnnotation, .df-link-content section.textAnnotation, .df-link-content section.freeTextAnnotation", function() {
var e = to(this);
n.handlePopup(e, !0)
}),
n.handlePopup = function(e) {
var t = !(arguments.length > 1) || void 0 === arguments[1] || arguments[1]
, i = e.closest(".df-container")
, n = i.find(".df-comment-popup");
if (n.toggleClass("df-active", t),
t) {
var o = e[0].getBoundingClientRect()
, a = i[0].getBoundingClientRect()
, s = e.find(".popupWrapper").first();
if (e.hasClass("popupTriggerArea")) {
var r = e.data("annotation-id");
void 0 !== r && (s = e.siblings("[data-annotation-id=popup_" + r + "]"))
}
n.html(s.html());
var l = o.left - a.left;
l + 360 > a.width ? l = a.width - 360 - 10 : l < 10 && (l = 10);
var h = o.top - a.top + o.height + 5;
h + n.height() > a.height ? h = o.top - n.height() - o.height - 10 : h < 10 && (h = 10),
n.css({
left: l,
top: h
})
}
}
,
void 0 != n.fileDropElement) {
var t = to(n.fileDropElement);
t.length > 0 && (t.on("dragover", function(e) {
e.preventDefault(),
e.stopPropagation(),
to(this).addClass("df-dragging")
}),
t.on("dragleave", function(e) {
e.preventDefault(),
e.stopPropagation(),
to(this).removeClass("df-dragging")
}),
t.on("drop", function(e) {
var t = e.originalEvent.dataTransfer.files;
t.length && n.fileDropHandler(t, e)
}))
}
}
;
var tg = n.jQuery
, tv = n.REQUEST_STATUS
, tm = n.utils
, ty = /*#__PURE__*/
function() {
var e;
function t(e) {
var i, o, a;
(function(e, t) {
if (!(e instanceof t))
throw TypeError("Cannot call a class as a function")
}
)(this, t),
this.options = e,
this.viewerType = this.options.viewerType,
this.startPage = 1,
this.endPage = 1,
this.element = tg(this.options.element),
e.maxTextureSize = null !== (i = e.maxTextureSize) && void 0 !== i ? i : 2048,
tm.isMobile && (e.maxTextureSize = 4096 === e.maxTextureSize ? 3200 : e.maxTextureSize),
this.dimensions = {
padding: {},
offset: {},
pageFit: {},
stage: {},
isAutoHeight: "auto" === e.height,
maxTextureSize: e.maxTextureSize
},
this.is3D = e.is3D,
this.options.pixelRatio = tm.limitAt(this.options.pixelRatio, 1, this.options.maxDPI),
this.options.fakeZoom = null !== (o = this.options.fakeZoom) && void 0 !== o ? o : 1,
this.events = {},
this.links = e.links,
this.thumbSize = 128,
this.pendingZoom = !0,
this.currentPageNumber = this.options.openPage || this.startPage,
this.hashNavigationEnabled = !0 === this.options.hashNavigationEnabled,
this.pendingZoom = !0,
this.zoomValue = 1,
this.pageScaling = n.PAGE_SCALE.MANUAL,
this.isRTL = e.readDirection === n.READ_DIRECTION.RTL,
this.jumpStep = 1,
this.resizeRequestStatus = tv.OFF,
this.refreshRequestStatus = tv.OFF,
this.refreshRequestCount = 0,
this.resizeRequestCount = 0,
this.fullscreenSupported = tm.hasFullscreenEnabled(),
this.thumbRequestCount = 0,
this.isExternalReady = null === (a = this.options.isExternalReady) || void 0 === a || a,
this.init(),
!0 === this.options.autoLightBoxFullscreen && !0 === this.options.isLightBox && this.switchFullscreen(),
this.executeCallback("onCreate"),
this.target = this
}
return e = [{
key: "init",
value: function() {
var e = this.options;
if (this.initDOM(),
this.initResourcesLocation(),
this.initInfo(),
(null == e.source || 0 === e.source.length) && null == e.pdfParameters) {
this.updateInfo("ERROR: Set a Valid Document Source.", n.INFO_TYPE.ERROR),
this.container.removeClass("df-loading").addClass("df-error");
return
}
if (tm.isIEUnsupported) {
this.updateInfo("Your browser (Internet Explorer) is out of date! <br><a href='https://browsehappy.com/'>Upgrade to a new browser.</a>", "df-old-browser"),
this.container.removeClass("df-loading").addClass("df-error");
return
}
this.commentPopup = tg('<div class="df-comment-popup">').appendTo(this.container),
this.viewer = new this.viewerType(e,this),
this.sideMenu = new tp({
parentElement: this.container
},this),
this.provider = new n.providers[e.providerType](e,this),
this.state = "loading",
this.checkRequestQueue()
n.extrafeatures = this; // to use this DFLIP.extrafeatures.gotoPage(15);this is expose extra features
console.log("edited by jenil")
}
}, {
key: "initDOM",
value: function() {
this.element.addClass("df-app").removeClass("df-container df-loading"),
this.container = tg("<div>").appendTo(this.element),
this.container.addClass("df-container df-loading df-init df-controls-" + this.options.controlsPosition + (!0 === this.options.controlsFloating ? " df-float" : " df-float-off") + ("transparent" === this.options.backgroundColor ? " df-transparent" : "") + (!0 === this.isRTL ? " df-rtl" : "") + (!0 === tm.isIOS || !0 === tm.isIPad ? " df-ios" : "")),
this._offsetParent = this.container[0].offsetParent,
this.backGround = tg("<div class='df-bg'>").appendTo(this.container).css({
backgroundColor: this.options.backgroundColor,
backgroundImage: this.options.backgroundImage ? "url('" + this.options.backgroundImage + "')" : ""
}),
this.viewerContainer = tg("<div>").appendTo(this.container),
this.viewerContainer.addClass("df-viewer-container")
}
}, {
key: "initResourcesLocation",
value: function() {
var e = this.options;
if (void 0 !== window[n.locationVar]) {
if (e.pdfjsSrc = window[n.locationVar] + "js/libs/pdf.min.js",
e.threejsSrc = window[n.locationVar] + "js/libs/three.min.js",
e.pdfjsWorkerSrc = window[n.locationVar] + "js/libs/pdf.worker.min.js",
e.soundFile = window[n.locationVar] + e.soundFile,
e.imagesLocation = window[n.locationVar] + e.imagesLocation,
e.imageResourcesPath = window[n.locationVar] + e.imageResourcesPath,
e.cMapUrl = window[n.locationVar] + e.cMapUrl,
void 0 !== e.pdfVersion) {
var t = "";
"latest" == e.pdfVersion || "beta" == e.pdfVersion ? t = "latest" : "stable" == e.pdfVersion && (t = "stable"),
("latest" == e.pdfVersion || "default" == e.pdfVersion) && (Array.prototype.at,
void 0 === Array.prototype.at && (t = "stable",
console.log("Proper Support for Latest version PDF.js 3.7 not available. Switching to PDF.js 2.5!"))),
"default" !== t && "" !== t && (e.pdfjsSrc = window[n.locationVar] + "js/libs/pdfjs/" + t + "/pdf.min.js",
e.pdfjsWorkerSrc = window[n.locationVar] + "js/libs/pdfjs/" + t + "/pdf.worker.min.js"),
"stable" === t && (this.options.fakeZoom = 1)
}
} else
console.warn("DEARVIEWER locationVar not found!");
this.executeCallback("onInitResourcesLocation")
}
}, {
key: "initEvents",
value: function() {
var e = this.container[0];
window.addEventListener("resize", this.events.resize = this.resetResizeRequest.bind(this), !1),
e.addEventListener("mousemove", this.events.mousemove = this.mouseMove.bind(this), !1),
e.addEventListener("mousedown", this.events.mousedown = this.mouseDown.bind(this), !1),
window.addEventListener("mouseup", this.events.mouseup = this.mouseUp.bind(this), !1),
e.addEventListener("touchmove", this.events.touchmove = this.mouseMove.bind(this), !1),
e.addEventListener("touchstart", this.events.touchstart = this.mouseDown.bind(this), !1),
window.addEventListener("touchend", this.events.touchend = this.mouseUp.bind(this), !1)
}
}, {
key: "mouseMove",
value: function(e) {
e.touches && e.touches.length > 1 && e.preventDefault(),
!0 === this.viewer.acceptAppMouseEvents && this.viewer.mouseMove(e)
}
}, {
key: "mouseDown",
value: function(e) {
this.userHasInteracted = !0,
!0 === this.viewer.acceptAppMouseEvents && 0 === tg(e.srcElement).closest(".df-sidemenu").length && this.viewer.mouseDown(e)
}
}, {
key: "mouseUp",
value: function(e) {
this.viewer && !0 === this.viewer.acceptAppMouseEvents && this.viewer.mouseUp(e)
}
}, {
key: "softDispose",
value: function() {
this.softDisposed = !0,
this.provider.dispose(),
this.viewer.dispose()
}
}, {
key: "softInit",
value: function() {
this.viewer = new this.viewerType(this.options,this),
this.provider = new n.providers[this.options.providerType](this.options,this),
this.softDisposed = !1
}
}, {
key: "dispose",
value: function() {
var e, t, i, n, o, a = this.container[0];
clearInterval(this.autoPlayTimer),
this.autoPlayTimer = null,
this.autoPlayFunction = null,
this.provider = tm.disposeObject(this.provider),
this.contentProvider = null,
this.target = null,
this.viewer = tm.disposeObject(this.viewer),
this.sideMenu = tm.disposeObject(this.sideMenu),
this.ui = tm.disposeObject(this.ui),
this.thumblist = tm.disposeObject(this.thumblist),
this.outlineViewer = tm.disposeObject(this.outlineViewer),
this.events && (window.removeEventListener("resize", this.events.resize, !1),
a.removeEventListener("mousemove", this.events.mousemove, !1),
a.removeEventListener("mousedown", this.events.mousedown, !1),
window.removeEventListener("mouseup", this.events.mouseup, !1),
a.removeEventListener("touchmove", this.events.touchmove, !1),
a.removeEventListener("touchstart", this.events.touchstart, !1),
window.removeEventListener("touchend", this.events.touchend, !1)),
this.events = null,
this.options = null,
this.element.removeClass("df-app"),
this.viewerType = null,
this.checkRequestQueue = null,
null === (e = this.info) || void 0 === e || e.remove(),
this.info = null,
null === (t = this.loadingIcon) || void 0 === t || t.remove(),
this.loadingIcon = null,
null === (i = this.backGround) || void 0 === i || i.remove(),
this.backGround = null,
null === (n = this.outlineContainer) || void 0 === n || n.remove(),
this.outlineContainer = null,
null === (o = this.commentPopup) || void 0 === o || o.remove(),
this.commentPopup = null,
this.viewerContainer.off(),
this.viewerContainer.remove(),
this.viewerContainer = null,
this.container.off(),
this.container.remove(),
this.container = null,
this.element.off(),
this.element.data("df-app", null),
this.element = null,
this._offsetParent = null,
this.dimensions = null
}
}, {
key: "resetResizeRequest",
value: function() {
this.resizeRequestStatus = tv.COUNT,
this.resizeRequestCount = 0,
this.container.addClass("df-pendingresize"),
this.pendingResize = !0
}
}, {
key: "initInfo",
value: function() {
this.info = tg("<div>", {
class: "df-loading-info"
}),
this.container.append(this.info),
this.info.html(this.options.text.loading + "..."),
this.loadingIcon = tg("<div>", {
class: "df-loading-icon"
}).appendTo(this.container)
}
}, {
key: "updateInfo",
value: function(e, t) {
tm.log(e),
void 0 !== this.info && this.info.html(e)
}
}, {
key: "_documentLoaded",
value: function() {
tm.log("Document Loaded"),
this.isDocumentReady = !0,
this.contentProvider = this.provider,
this.executeCallback("onDocumentLoad"),
this.endPage = this.pageCount = this.provider.pageCount,
this.currentPageNumber = this.getValidPage(this.currentPageNumber)
}
}, {
key: "_viewerPrepared",
value: function() {
tm.log("Viewer Prepared"),
this.isViewerPrepared = !0,
this.executeCallback("onViewerLoad")
}
}, {
key: "requestFinalize",
value: function() {
!0 === this.isDocumentReady && !0 === this.isViewerPrepared && !0 === this.isExternalReady && !0 !== this.finalizeRequested && (this.finalizeRequested = !0,
this.finalize())
}
}, {
key: "finalizeComponents",
value: function() {
this.ui = new tr({},this),
this.ui.init(),
this.calculateLayout(),
this.viewer.init()
}
}, {
key: "finalize",
value: function() {
this.resize(),
this.ui.update(),
this.initEvents(),
!0 == this.options.isLightBox && this.analytics({
eventAction: this.options.analyticsViewerOpen,
options: this.options
}),
this.container.removeClass("df-loading df-init"),
this.viewer.onReady(),
this.analytics({
eventAction: this.options.analyticsViewerReady,
options: this.options
}),
this.executeCallback("onReady"),
!0 === this.options.dataElement.hasClass("df-hash-focused") && (tm.focusHash(this.options.dataElement),
this.options.dataElement.removeClass("df-hash-focused")),
!0 === this.hashNavigationEnabled && this.getURLHash(),
tm.log("App Finalized")
}
}, {
key: "initOutline",
value: function() {
var e = tg("<div>").addClass("df-outline-container df-sidemenu");
e.append('<div class="df-sidemenu-title">' + this.options.text.outlineTitle + "</div>");
var t = tg("<div>").addClass("df-wrapper");
e.append(t),
this.sideMenu.element.append(e),
this.outlineContainer = e,
this.outlineViewer = new tc({
container: t[0],
linkService: this.provider.linkService,
outlineItemClass: "df-outline-item",
outlineToggleClass: "df-outline-toggle",
outlineToggleHiddenClass: "df-outlines-hidden"
}),
this.outlineViewer.render({
outline: this.provider.outline
})
}
}, {
key: "initThumbs",
value: function() {
var e = this;
e.thumblist = new td({
app: e,
addFn: function(e) {},
scrollFn: function() {
e.thumbRequestStatus = tv.ON
},
itemHeight: e.thumbSize,
itemWidth: tm.limitAt(Math.floor(e.dimensions.defaultPage.ratio * e.thumbSize), 32, 180),
totalRows: e.pageCount
}),
e.thumblist.lastScrolled = Date.now(),
e.thumbRequestStatus = tv.ON;
var t = tg("<div>").addClass("df-thumb-container df-sidemenu");
t.append('<div class="df-sidemenu-title">' + this.options.text.thumbTitle + "</div>"),
t.append(tg(e.thumblist.container).addClass("df-wrapper")),
e.thumbContainer = t,
e.sideMenu.element.append(t),
e.container.on("click", ".df-thumb-container .df-thumb", function(t) {
t.stopPropagation();
var i = tg(this).attr("id").replace("df-thumb", "");
e.gotoPage(parseInt(i, 10))
})
}
}, {
key: "initSearch",
value: function() {
var e = this
, t = tg("<div>").addClass("df-search-container df-sidemenu");
t.append('<div class="df-sidemenu-title">' + this.options.text.searchTitle + "</div>"),
e.searchForm = tg('<div class="df-search-form">').appendTo(t),
e.searchBox = tg('<input type="text" class="df-search-text" placeholder="' + this.options.text.searchPlaceHolder + '">').on("keyup", function(t) {
13 === t.keyCode && e.search()
}).appendTo(e.searchForm),
e.searchButton = tg('<div class="df-ui-btn df-search-btn df-icon-search">').on("click", function(t) {
e.search()
}).appendTo(e.searchForm),
e.clearButton = tg('<a class="df-search-clear">Clear</a>').on("click", function(t) {
e.clearSearch()
}).appendTo(e.searchForm),
e.searchInfo = tg('<div class="df-search-info">').appendTo(t),
e.searchResults = tg('<div class="df-wrapper df-search-results">').appendTo(t),
e.searchContainer = t,
e.sideMenu.element.append(t),
e.container.on("click", ".df-search-result", function(t) {
t.stopPropagation();
var i = tg(this).data("df-page");
e.gotoPage(parseInt(i, 10))
})
}
}, {
key: "search",
value: function(e) {
void 0 == e && (e = this.searchBox.val()),
this.provider.search(e.trim())
}
}, {
key: "clearSearch",
value: function() {
this.searchBox.val(""),
this.searchInfo.html(""),
this.provider.clearSearch()
}
}, {
key: "updateSearchInfo",
value: function(e) {
tm.log(e),
void 0 !== this.searchInfo && this.searchInfo.html(e)
}
}, {
key: "checkRequestQueue",
value: function() {
var e = this;
if (e.checkRequestQueue && requestAnimationFrame(function() {
e && e.checkRequestQueue && e.checkRequestQueue()
}),
!e.softDisposed) {
if ("ready" != e.state) {
"loading" === e.state && !0 === this.isDocumentReady && !0 === this.isViewerPrepared && !0 === this.isExternalReady && (e.state = "finalizing",
this.finalizeComponents()),
"finalizing" === e.state && (e.state = "ready",
e.finalize());
return
}
e.container && e.container[0] && e._offsetParent !== e.container[0].offsetParent && (e._offsetParent = e.container[0].offsetParent,
null !== e._offsetParent && (e.resize(),
e.resizeRequestStatus = tv.OFF),
tm.log("Visibility Resize Detected")),
(null !== e._offsetParent || e.isFullscreen) && (TWEEN.getAll().length > 0 && (TWEEN.update(),
e.renderRequestStatus = tv.ON),
e.resizeRequestStatus === tv.ON ? (e.resizeRequestStatus = tv.OFF,
e.resize()) : e.resizeRequestStatus === tv.COUNT && (e.resizeRequestCount++,
e.resizeRequestCount > 10 && (e.resizeRequestCount = 0,
e.resizeRequestStatus = tv.ON)),
e.refreshRequestStatus === tv.ON ? (e.refreshRequestStatus = tv.OFF,
e.pendingResize = !1,
e.viewer.refresh(),
this.container.removeClass("df-pendingresize")) : e.refreshRequestStatus === tv.COUNT && (e.refreshRequestCount++,
e.refreshRequestCount > 3 && (e.refreshRequestCount = 0,
e.refreshRequestStatus = tv.ON)),
e.textureRequestStatus === tv.ON && e.processTextureRequest(),
e.thumbRequestStatus === tv.ON ? e.processThumbRequest() : e.thumbRequestStatus === tv.COUNT && (e.thumbRequestCount++,
e.thumbRequestCount > 3 && (e.thumbRequestCount = 0,
e.thumbRequestStatus = tv.ON)),
e.renderRequestStatus === tv.ON && (e.viewer.render(),
e.renderRequestStatus = tv.OFF),
e.provider.checkRequestQueue(),
e.viewer.checkRequestQueue())
}
}
}, {
key: "processTextureRequest",
value: function() {
var e, t, i = this.viewer, o = this.provider, a = i.getVisiblePages().main, s = 0, r = this.zoomValue > 1;
if (i.isAnimating() && !0 !== DEARFLIP.defaults.instantTextureProcess)
this.textureRequestStatus = tv.ON;
else {
tm.log("Texture Request Working");
for (var l = 0; l < a.length; l++) {
s = 0;
var h = a[l];
if (h > 0 && h <= this.pageCount && ((e = r ? i.zoomViewer.getPageByNumber(h) : i.getPageByNumber(h)) && (t = i.getTextureSize({
pageNumber: h
}),
e.changeTexture(h, Math.floor(t.height)) && (o.processPage({
pageNumber: h,
textureTarget: r ? n.TEXTURE_TARGET.ZOOM : n.TEXTURE_TARGET.VIEWER
}),
s++,
this.viewer.getAnnotationElement(h, !0))),
s > 0))
break
}
0 === s && (this.textureRequestStatus = tv.OFF)
}
}
}, {
key: "applyTexture",
value: function(e, t) {
var i = void 0 !== e.toDataURL;
if (t.textureTarget === n.TEXTURE_TARGET.THUMB) {
if (t.height = e.height,
t.width = e.width,
i) {
var o = e.toDataURL("image/png");
this.provider.setCache(t.pageNumber, o, this.thumbSize),
t.texture = o
} else
t.texture = e.src;
this.thumblist.setPage(t)
} else
t.texture = i ? e : e.src,
!0 === this.viewer.setPage(t) && (this.provider.processAnnotations(t.pageNumber, this.viewer.getAnnotationElement(t.pageNumber, !0)),
this.provider.processTextContent(t.pageNumber, this.viewer.getTextElement(t.pageNumber, !0)))
}
}, {
key: "processThumbRequest",
value: function() {
null !== this.thumblist && void 0 !== this.thumblist && this.thumblist.processThumbRequest()
}
}, {
key: "refreshRequestStart",
value: function() {
this.refreshRequestStatus = tv.COUNT,
this.refreshRequestCount = 0
}
}, {
key: "renderRequestStart",
value: function() {
this.renderRequestStatus = tv.ON
}
}, {
key: "resizeRequestStart",
value: function() {
this.resizeRequestStatus = tv.ON
}
}, {
key: "zoom",
value: function(e) {
this.pendingZoom = !0,
this.zoomDelta = e,
this.resize()
}
}, {
key: "resetZoom",
value: function() {
1 !== this.zoomValue && (this.zoomValue = 1.001,
this.zoom(-1))
}
}, {
key: "calculateLayout",
value: function() {
var e, t, i = this.isSideMenuOpen = this.container.hasClass("df-sidemenu-open"), o = this.dimensions, a = this.dimensions.padding, s = tg(window).height();
o.offset = {
top: 0,
left: this.options.sideMenuOverlay || !i || this.isRTL ? 0 : 220,
right: !this.options.sideMenuOverlay && i && this.isRTL ? 220 : 0,
bottom: 0,
width: !this.options.sideMenuOverlay && i ? 220 : 0
},
this.viewerContainer.css({
left: o.offset.left,
right: o.offset.right
});
var r = o.controlsHeight = this.container.find(".df-ui").height();
if (a.top = this.options.paddingTop + (this.options.controlsPosition === n.CONTROLS_POSITION.TOP ? r : 0),
a.left = this.options.paddingLeft,
a.right = this.options.paddingRight,
a.bottom = this.options.paddingBottom + (this.options.controlsPosition === n.CONTROLS_POSITION.BOTTOM ? r : 0),
a.height = a.top + a.bottom,
a.width = a.left + a.right,
a.heightDiff = a.top - a.bottom,
a.widthDiff = a.left - a.right,
o.isFullSize = !0 === this.isFullscreen,
o.isFixedHeight = o.isFullSize || !o.isAutoHeight,
o.containerWidth = o.isFullSize ? tg(window).width() : this.element.width(),
this.container.toggleClass("df-xs", o.containerWidth < 400).toggleClass("df-xss", o.containerWidth < 320),
o.maxHeight = s - (o.containerWidth > 600 && null !== (t = tg(null !== (e = this.options.headerElementSelector) && void 0 !== e ? e : "#wpadminbar").height()) && void 0 !== t ? t : 0),
o.isFixedHeight) {
if (o.isFullSize)
o.maxHeight = s;
else {
this.element.height(this.options.height);
var l = this.element.height();
o.maxHeight = Math.min(l, o.maxHeight)
}
}
o.width,
o.stage.innerWidth = this.viewer._getInnerWidth();
var h = o.stage.innerHeight = this.viewer._getInnerHeight()
, u = this.viewer._getOuterHeight(h + o.padding.height);
o.containerHeight = o.isFullSize ? s : u,
this.element.height(o.containerHeight);
var p = this.element.height();
o.isFullSize || p == o.containerHeight || (o.containerHeight = p,
o.stage.innerHeight = p - o.padding.height,
o.stage.height = p),
o.origin = {
x: (a.widthDiff + o.containerWidth - o.offset.left - o.offset.right) / 2,
y: (a.heightDiff + o.containerHeight) / 2
},
this.viewer.determinePageMode()
}
}, {
key: "resize",
value: function() {
var e = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0];
tm.log("Resize Request Initiated"),
this.calculateLayout(),
this.viewer.handleZoom(),
this.viewer.resize(),
!1 !== e && (this.pendingZoom ? (this.viewer.refresh(),
tm.log("Pending Zoom updated")) : this.refreshRequestStart(),
this.ui.update(),
this.renderRequestStatus = tv.ON,
this.zoomChanged = !1,
this.pendingZoom = !1,
this.executeCallback("afterResize"))
}
}, {
key: "hasOutline",
value: function() {
if (this.provider.outline.length > 0)
return !0
}
}, {
key: "switchFullscreen",
value: function() {
var e, t, i = this, n = i.container[0];
if (i.container.toggleClass("df-fullscreen", !0 !== i.isFullscreen),
(null == i ? void 0 : null === (t = i.ui) || void 0 === t ? void 0 : null === (e = t.controls) || void 0 === e ? void 0 : e.fullscreen) && i.ui.controls.fullScreen.toggleClass(i.options.icons["fullscreen-off"], !0 !== i.isFullscreen),
!0 !== i.isFullscreen) {
var o = null;
n.requestFullscreen ? o = n.requestFullscreen() : n.msRequestFullscreen ? o = n.msRequestFullscreen() : n.mozRequestFullScreen ? o = n.mozRequestFullScreen() : n.webkitRequestFullscreen && (o = n.webkitRequestFullscreen()),
o && o.then && o.then(function() {
i.refreshRequestStatus,
tv.ON,
i.resize()
}),
i.isFullscreen = !0
} else
i.isFullscreen = !1,
document.exitFullscreen ? document.fullscreenElement && document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(),
tm.hasFullscreenEnabled() || i.container[0].scrollIntoView();
tm.hasFullscreenEnabled() || (i.resizeRequestStatus = tv.ON)
}
}, {
key: "next",
value: function() {
this.jumpBy(this.jumpStep)
}
}, {
key: "prev",
value: function() {
this.jumpBy(-this.jumpStep)
}
}, {
key: "jumpBy",
value: function(e) {
var t = this.currentPageNumber + e;
t = tm.limitAt(t, this.startPage, this.endPage),
!0 != this.anyFirstPageChanged && (this.analytics({
eventAction: this.options.analyticsFirstPageChange,
options: this.options
}),
this.anyFirstPageChanged = !0),
this.gotoPage(t),
this.ui.update()
}
}, {
key: "openRight",
value: function() {
this.isRTL ? this.prev() : this.next()
}
}, {
key: "openLeft",
value: function() {
this.isRTL ? this.next() : this.prev()
}
}, {
key: "start",
value: function() {
this.gotoPage(this.startPage)
}
}, {
key: "end",
value: function() {
this.gotoPage(this.endPage)
}
}, {
key: "gotoPage",
value: function(e) {
e = this.getValidPage(parseInt(e, 10)),
null !== this.viewer && !1 !== this.viewer.validatePageChange(e) && (this.executeCallback("beforePageChanged"),
this.requestDestRefKey = void 0,
this.container.removeClass("df-fetch-pdf"),
this.oldPageNumber = this.currentPageNumber,
this.currentPageNumber = e,
this.thumbRequestStatus = tv.ON,
this.viewer.gotoPageCallBack && this.viewer.gotoPageCallBack(),
this.ui.update(),
!0 == this.autoPlay && this.setAutoPlay(this.autoPlay),
!0 === this.hashNavigationEnabled && this.getURLHash(),
this.executeCallback("onPageChanged"))
}
}, {
key: "gotoPageLabel",
value: function(e) {
this.gotoPage(this.provider.getPageNumberForLabel(e.toString().trim()))
}
}, {
key: "getCurrentLabel",
value: function() {
return this.provider.getLabelforPage(this.currentPageNumber)
}
}, {
key: "autoPlayFunction",
value: function() {
this && this.autoPlay && (tm.limitAt(this.currentPageNumber + this.jumpStep, this.startPage, this.endPage) !== this.currentPageNumber ? this.next() : this.setAutoPlay(!1))
}
}, {
key: "setAutoPlay",
value: function(e) {
if (this.options.autoPlay) {
var t = (e = !0 == e) ? this.options.text.pause : this.options.text.play;
this.ui.controls.play.toggleClass(this.options.icons.pause, e),
this.ui.controls.play.html("<span>" + t + "</span>"),
this.ui.controls.play.attr("title", t),
clearInterval(this.autoPlayTimer),
e && (this.autoPlayTimer = setInterval(this.autoPlayFunction.bind(this), this.options.autoPlayDuration)),
this.autoPlay = e
}
}
}, {
key: "isValidPage",
value: function(e) {
return this.provider._isValidPage(e)
}
}, {
key: "getValidPage",
value: function(e) {
return isNaN(e) ? e = this.currentPageNumber : e < 1 ? e = 1 : e > this.pageCount && (e = this.pageCount),
e
}
}, {
key: "getURLHash",
value: function() {
if (null != this.options.id) {
var e = tm.getSharePrefix(this.options.sharePrefix) + (null != this.options.slug ? this.options.slug : this.options.id) + "/";
null != this.currentPageNumber && (e += this.currentPageNumber + "/"),
history.replaceState(void 0, void 0, "#" + e)
}
return window.location.href
}
}, {
key: "executeCallback",
value: function(e) {}
}, {
key: "analytics",
value: function(e) {}
}],
function(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value"in n && (n.writable = !0),
Object.defineProperty(e, n.key, n)
}
}(t.prototype, e),
t
}();
function tb(e, t, i) {
for (var n = [], o = !1, a = 0, s = 0, r = 0, l = void 0, h = 0, u = 0; u < e.length; u++) {
var p, c, d, f, g = function(e) {
for (var t = 1; t < arguments.length; t++) {
var i = null != arguments[t] ? arguments[t] : {}
, n = Object.keys(i);
"function" == typeof Object.getOwnPropertySymbols && (n = n.concat(Object.getOwnPropertySymbols(i).filter(function(e) {
return Object.getOwnPropertyDescriptor(i, e).enumerable
}))),
n.forEach(function(t) {
var n;
n = i[t],
t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
})
}
return e
}({}, e[u]);
for (r = (s = t[u].offset) + t[u].length,
!1 == o && (l = null === (p = i[h]) || void 0 === p ? void 0 : p.index,
a = null === (c = i[h]) || void 0 === c ? void 0 : c.length); l >= s && l < r; )
g.searchHits || (g.searchHits = []),
g.searchHits.push({
start: l - s,
length: a,
text: i[h].text
}),
1 == g.searchHits.length && n.push(g),
l + a > r ? (a = l + a - r,
l = r,
o = !0) : (o = !1,
l = null === (d = i[++h]) || void 0 === d ? void 0 : d.index,
a = null === (f = i[h]) || void 0 === f ? void 0 : f.length)
}
return n
}
n.prepareOptions = function(e) {
t = e.element,
(null != tg && "undefined" != typeof Symbol && tg[Symbol.hasInstance] ? tg[Symbol.hasInstance](t) : t instanceof tg) || (e.element = tg(e.element));
var t, i = e.element;
null == e.dataElement && (e.dataElement = i);
var o = e.dataElement
, a = n.utils.getOptions(o)
, s = tg.extend(!0, {}, n.defaults, e, a);
s = tm.fallbackOptions(s),
tm.log(s);
var r = tg.extend(!0, {}, n._defaults, s);
return tm.isMobile && "function" == typeof n.viewers[r.mobileViewerType] && (r.viewerType = r.mobileViewerType),
"function" != typeof n.viewers[r.viewerType] ? (console.warn("Invalid Viewer Type! " + r.viewerType + " | Using default Viewer!"),
r.viewerType = n.viewers.default) : r.viewerType = n.viewers[r.viewerType],
r = tm.finalizeOptions(tm.sanitizeOptions(r))
}
,
n.Application = function(e) {
var t = n.prepareOptions(e)
, i = new ty(t);
return e.element.data("df-app", i),
null != t.id && !0 !== t.isLightBox && (window[t.id.toString()] = i),
i
}
,
tg.fn.extend({
dearviewer_options: function(e) {
return null == e && (e = {}),
e.element = tg(this),
new n.prepareOptions(e)
},
dearviewer: function(e) {
return null == e && (e = {}),
e.element = tg(this),
new n.Application(e)
}
}),
n.defaults.search = !0,
ty.prototype.executeCallback = function(e) {
this.options && "function" == typeof this.options[e] && this.options[e](this)
}
,
ty.prototype.analytics = function(e) {
if (!0 == this.options.enableAnalytics)
try {
var t = e.options
, i = void 0;
t && (i = t.bookTitle || t.slug || t.id);
var n = window.gtag;
n ? n("event", e.eventAction, {
event_category: t.analyticsEventCategory,
event_label: i
}) : (window.ga || window.__gaTracker)("send", {
hitType: "event",
eventCategory: t.analyticsEventCategory,
eventAction: e.eventAction,
eventLabel: i
})
} catch (e) {}
}
,
n.executeCallback = function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : window;
"function" == typeof t[e] && t[e]()
}
,
n.openAttachmentLightBoxes = function() {
var e = jQuery("body .df-auto-open-lightbox");
e.length > 0 && jQuery(e[0]).trigger("click"),
jQuery(window).on("hashchange", function(e) {
var t = location.hash;
t && t.length > 5 && (n.hashFocusBookFound = !1,
l.detectHash())
})
}
,
eY.prototype.processCustomLinks = function(e, t) {
var i = this
, n = this.app;
if (!1 !== n.options.enableAnnotation && i._isValidPage(e) && null != t) {
var o = n.viewer.getDocumentPageNumber(e)
, a = n.options.links;
if (null != a && null != a[o])
for (var s = a[o], r = 0; r < s.length; r++) {
var l = s[r]
, h = void 0;
l.dest && l.dest.indexOf && 0 == l.dest.indexOf("[html]") ? ((h = document.createElement("div")).innerHTML = l.dest.substr(6),
h.className = "customHtmlAnnotation") : ((h = document.createElement("a")).setAttribute("dest", l.dest),
h.className = "customLinkAnnotation",
h.href = "#" + l.dest,
h.onclick = function() {
var e = this.getAttribute("dest");
return e && i.linkService.customNavigateTo(e),
!1
}
),
h.style.left = l.x + "%",
h.style.top = l.y + "%",
h.style.width = l.w + "%",
h.style.height = l.h + "%",
t.appendChild(h)
}
}
}
,
eJ.prototype.processTextContent = function(e, t) {
var i = this
, n = this.app;
if (i._isValidPage(e) && null != t) {
var o = !0 === n.options.enableAnnotation && !0 === n.options.enableAutoLinks;
if (o || !1 !== n.options.showSearchControl) {
var a = n.viewer.getDocumentPageNumber(e);
t.innerHTML = "",
i.pdfDocument.getPage(a).then(function(s) {
var r = s.getViewport({
scale: 1,
rotation: s._pageInfo.rotate + n.options.pageRotation
});
r = s.getViewport({
scale: n.viewer.getTextureSize({
pageNumber: e,
isAnnotation: !0
}).height / (r.height * n.options.pixelRatio),
rotation: s._pageInfo.rotate + n.options.pageRotation
}),
t.parentNode.style.setProperty("--scale-factor", r.scale),
s.getTextContent().then(function(s) {
i.prepareTextContent(s, a);
var h, u = i.autoLinkItemsCache[a], p = i.autoLinkHitsCache[a], c = i.searchHitItemsCache[a], d = i.searchHits[e], f = i.textOffset[a];
if (!0 === o && void 0 == u) {
u = [],
p = l.urlify(i.textContentJoined[a]);
var g = i.PDFLinkItemsCache[a];
g && g.length < 5 && (g = void 0),
u = tb(s.items, f, p),
i.autoLinkItemsCache[a] = u,
i.autoLinkHitsCache[a] = p
}
void 0 == c && void 0 != i.textOffsetSearch[a] && d && d.length > 0 && (c = tb(s.items, i.textOffsetSearch[a], d),
i.searchHitItemsCache[a] = c),
i.renderAutoLinks(u, s, t, r),
i.renderSearchHits(c, s, t, r),
null == n || null === (h = n.viewer) || void 0 === h || h.finalizeTextContent(t, e)
})
})
}
}
}
,
eJ.prototype.renderAutoLinks = function(e, t, i, n) {
if (e && e.length > 0) {
var o, a, s = jQuery(i).siblings(".df-auto-link-content");
0 === s.length && (s = jQuery('<div class="df-auto-link-content">'),
jQuery(i).parent().prepend(s)),
s.html(""),
t.items = e,
pdfjsLib.TextLayer ? a = (o = new pdfjsLib.TextLayer({
textContentSource: t,
viewport: n,
container: s[0]
})).render() : a = (o = pdfjsLib.renderTextLayer({
textContentSource: t,
textContent: t,
container: s[0],
viewport: n,
textDivs: []
})).promise;
var r = 0;
a.then(function(e) {
var i;
(null !== (i = o.textDivs) && void 0 !== i ? i : o._textDivs).forEach(function(e) {
var i = t.items[r]
, n = ""
, o = 0
, a = 0
, s = 0
, h = ""
, u = "";
for (s = 0; s < i.searchHits.length; s++)
n += i.str.substring(o, i.searchHits[s].start),
o = i.searchHits[s].start,
a = i.searchHits[s].length,
h = i.str.substring(o, o + a),
void 0 !== (u = i.searchHits[s].text) && (h.indexOf("@") > 0 ? (u = u.toLowerCase()).indexOf(!1) && (u = "mailto:" + h) : 0 === u.indexOf("www.") && (u = "http://" + u),
n += '<a href="' + u + '" class="df-autolink" target="_blank">' + h + "</a>",
l.log("AutoLink: " + u + " for " + h),
o += a);
n += i.str.substring(o, i.str.length),
r++,
e.innerHTML = n
})
})
}
}
,
eJ.prototype.renderSearchHits = function(e, t, i, n) {
if (e && e.length > 0) {
t.items = e,
pdfjsLib.TextLayer ? a = (o = new pdfjsLib.TextLayer({
textContentSource: t,
viewport: n,
container: i
})).render() : a = (o = pdfjsLib.renderTextLayer({
textContentSource: t,
textContent: t,
container: i,
viewport: n,
textDivs: []
})).promise;
var o, a, s = 0;
a.then(function() {
var e;
(null !== (e = o.textDivs) && void 0 !== e ? e : o._textDivs).forEach(function(e) {
var i = t.items[s]
, n = ""
, o = 0
, a = 0
, r = 0;
for (r = 0; r < i.searchHits.length; r++)
n += i.str.substring(o, i.searchHits[r].start),
o = i.searchHits[r].start,
a = i.searchHits[r].length,
n += '<span class="df-search-highlight">' + i.str.substring(o, o + a) + "</span>",
o += a;
n += i.str.substring(o, i.str.length),
s++,
e.innerHTML = n,
e.classList += " df-search-hits"
})
})
}
}
,
eJ.prototype.processAnnotations = function(e, t) {
var i = this
, n = this.app;
if (!1 !== n.options.enableAnnotation && i._isValidPage(e) && null != t) {
var o = n.viewer.getDocumentPageNumber(e);
i.pdfDocument.getPage(o).then(function(a) {
var s = a.getViewport({
scale: 1,
rotation: a._pageInfo.rotate + n.options.pageRotation
});
s = a.getViewport({
scale: n.viewer.getTextureSize({
pageNumber: e,
isAnnotation: !0
}).height / (s.height * n.options.pixelRatio),
rotation: a._pageInfo.rotate + n.options.pageRotation
}),
a.getAnnotations().then(function(r) {
if (null !== n.options && null !== n.viewer && 0 != r.length) {
var l = {
annotations: r,
div: t,
page: a,
viewport: s = s.clone({
dontFlip: !0
}),
imageResourcesPath: n.options.imageResourcesPath,
linkService: i.linkService
};
pdfjsLib.AnnotationLayer.hasOwnProperty("render") ? pdfjsLib.AnnotationLayer.render(l) : new pdfjsLib.AnnotationLayer(l).render(l),
n.options.annotationClass && "" !== n.options.annotationClass && jQuery(t).find(" > section").addClass(n.options.annotationClass),
void 0 == i.PDFLinkItemsCache[o] && jQuery(t).find("a:not([href^='#'])").map(function() {
return jQuery(this).attr("href")
}).get().join(","),
i.processCustomLinks(e, t),
n.viewer.finalizeAnnotations(t, e)
}
})
})
}
}
,
e6.prototype.processAnnotations = function(e, t) {
this.processCustomLinks(e, t),
this.app.viewer.finalizeAnnotations(t, e)
}
,
n.getPDFThumb = function(e) {
var t = {};
t.url = l.httpsCorrection(e.pdfURL),
t.rangeChunkSize = 524288,
t.cMapPacked = !0,
t.disableAutoFetch = !0,
t.disableStream = !0,
t.disableFontFace = n.defaults.disableFontFace,
t.isEvalSupported = !1,
t.cMapUrl = n.defaults.cMapUrl,
t.imagesLocation = n.defaults.imagesLocation,
t.imageResourcesPath = n.defaults.imageResourcesPath;
var i = pdfjsLib.getDocument(t)
, o = i.promise.then(function(t) {
t.getPage(1).then(function(t) {
var n = 1
, a = document.createElement("canvas")
, s = t.getViewport({
scale: n
});
n = s.width > s.height ? 400 * n / s.width : 400 * n / s.height,
s = t.getViewport({
scale: n
}),
a.height = Math.floor(s.height),
a.width = Math.floor(s.width),
t.render({
canvas: a,
canvasContext: a.getContext("2d"),
viewport: s
}).promise.then(function() {
var t, n = a.toDataURL("image/jpeg", .9);
null === (t = e.callback) || void 0 === t || t.call(e, n),
o.destroy && o.destroy(),
i.destroy && i.destroy(),
o = null,
i = null
})
})
});
i.onProgress = function(t) {
var i = 100 * t.loaded / t.total;
isNaN(i) ? t && t.loaded ? e.updateInfo("Loading PDF " + (Math.ceil(t.loaded / 1e4) / 100).toFixed(2).toString() + "MB ...") : e.updateInfo("Loading PDF ...") : e.updateInfo("Loading PDF " + Math.ceil(i).toString().split(".")[0] + "% ...")
}
}
;
var tw = n.jQuery
, tP = window.DFLIP = window.DEARFLIP = n;
tP.defaults.viewerType = "flipbook",
tP.defaults.analyticsEventCategory = "Flipbook",
tP.defaults.analyticsViewerReady = "Book Ready",
tP.defaults.analyticsViewerOpen = "Open Book",
tP.defaults.analyticsViewerClose = "Book Closed",
tP.defaults.analyticsFirstPageChange = "First Page Flip",
tP.slug = "dflip",
tP.locationVar = "dFlipLocation",
tP.locationFile = "dflip_edited",
tP.PAGE_MODE = {
SINGLE: 1,
DOUBLE: 2,
AUTO: null
},
tP.SINGLE_PAGE_MODE = {
ZOOM: 1,
BOOKLET: 2,
AUTO: null
},
tP.CONTROLSPOSITION = {
HIDDEN: "hide",
TOP: "top",
BOTTOM: "bottom"
},
tP.DIRECTION = {
LTR: 1,
RTL: 2
},
tP.PAGE_SIZE = {
AUTO: 0,
SINGLE: 1,
DOUBLEINTERNAL: 2
},
tP.ConvertPageLinks = function() {
for (var e, t = arguments[0] / 100, i = arguments[1] / 100, n = function(e, n, o, a, s) {
return {
x: e / t,
y: n / i,
w: o / t,
h: a / i,
dest: s
}
}, o = [], a = 2; a < arguments.length; a++)
e = arguments[a],
o[a - 2] = n.apply(this, e);
return o
}
,
tP.parseLinks = function(e) {
var t;
if (null != e && e.length > 0)
for (var i = 0; i < e.length; i++)
null != (t = e[i]) && null != t[0] && null == t[0].dest && (t = tP.ConvertPageLinks.apply(this, t),
e[i] = t);
return e
}
,
tP.parseFallBack = function() {
tw(".df-posts").addClass("dflip-books"),
tw(".dflip-books").addClass("df-posts"),
tw("._df_button, ._df_thumb, ._df_custom, ._df_book, ._df_hidden, ._df_link").each(function() {
var e = tw(this);
"true" !== e.data("df-parsed") && (e.addClass("df-element"),
e.hasClass("_df_book") || (e.hasClass("_df_thumb") ? (e.attr("data-df-lightbox", "thumb"),
void 0 !== e.attr("thumb") && e.data("df-thumb", e.attr("thumb"))) : e.hasClass("_df_button") ? e.attr("data-df-lightbox", "button") : e.hasClass("_df_hidden") ? e.attr("data-df-lightbox", "hidden") : e.hasClass("_df_link") ? e.attr("data-df-lightbox", "link") : e.attr("data-df-lightbox", "custom")))
})
}
,
tP.parseBooks = function() {
tP.parseFallBack(),
tP.parseElements()
}
;
var tS = function(e) {
var t, i;
if (null != e.source && (Array === e.source.constructor || Array.isArray(e.source) || (t = e.source,
null != (i = Array) && "undefined" != typeof Symbol && i[Symbol.hasInstance] ? !!i[Symbol.hasInstance](t) : t instanceof i)) && (e.providerType = "image"),
null != e.cover3DType && (!0 == e.cover3DType || "true" == e.cover3DType ? e.cover3DType = tP.FLIPBOOK_COVER_TYPE.BASIC : (!1 == e.cover3DType || "false" == e.cover3DType) && (e.cover3DType = tP.FLIPBOOK_COVER_TYPE.NONE)),
void 0 !== e.pageSize && ("1" === e.pageSize || 1 === e.pageSize || e.pageSize === tP.FLIPBOOK_PAGE_SIZE.SINGLE ? e.pageSize = tP.FLIPBOOK_PAGE_SIZE.SINGLE : "2" === e.pageSize || 2 === e.pageSize || e.pageSize === tP.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL ? e.pageSize = tP.FLIPBOOK_PAGE_SIZE.DOUBLE_INTERNAL : e.pageSize === tP.FLIPBOOK_PAGE_SIZE.DOUBLE_COVER_BACK || (e.pageSize = tP.FLIPBOOK_PAGE_SIZE.AUTO)),
void 0 !== e.pageMode && ("1" === e.pageMode || 1 === e.pageMode || e.pageMode === tP.FLIPBOOK_PAGE_MODE.SINGLE ? e.pageMode = tP.FLIPBOOK_PAGE_MODE.SINGLE : "2" === e.pageMode || 2 === e.pageMode || e.pageMode === tP.FLIPBOOK_PAGE_MODE.DOUBLE ? e.pageMode = tP.FLIPBOOK_PAGE_MODE.DOUBLE : e.pageMode = tP.FLIPBOOK_PAGE_MODE.AUTO),
void 0 !== e.singlePageMode && ("1" === e.singlePageMode || 1 === e.singlePageMode || e.singlePageMode === tP.FLIPBOOK_SINGLE_PAGE_MODE.ZOOM ? e.singlePageMode = tP.FLIPBOOK_SINGLE_PAGE_MODE.ZOOM : "2" === e.singlePageMode || 2 === e.singlePageMode || e.singlePageMode === tP.FLIPBOOK_SINGLE_PAGE_MODE.BOOKLET ? e.singlePageMode = tP.FLIPBOOK_SINGLE_PAGE_MODE.BOOKLET : e.singlePageMode = tP.FLIPBOOK_SINGLE_PAGE_MODE.AUTO),
void 0 !== e.controlsPosition && "hide" === e.controlsPosition && (e.controlsPosition = tP.CONTROLS_POSITION.HIDDEN),
void 0 !== e.overwritePDFOutline && (e.overwritePDFOutline = l.isTrue(e.overwritePDFOutline)),
void 0 !== e.webgl && (e.is3D = e.webgl = e.webgl,
delete e.webgl),
void 0 !== e.webglShadow && (e.has3DShadow = l.isTrue(e.webglShadow),
delete e.webglShadow),
void 0 !== e.scrollWheel && (l.isTrue(e.scrollWheel) && (e.mouseScrollAction = tP.MOUSE_SCROLL_ACTIONS.ZOOM),
delete e.scrollWheel),
void 0 !== e.stiffness && delete e.stiffness,
void 0 !== e.soundEnable && (e.enableSound = l.isTrue(e.soundEnable),
delete e.soundEnable),
void 0 !== e.enableDownload && (e.showDownloadControl = l.isTrue(e.enableDownload),
delete e.enableDownload),
void 0 !== e.autoEnableOutline && (e.autoOpenOutline = l.isTrue(e.autoEnableOutline),
delete e.autoEnableOutline),
void 0 !== e.autoEnableThumbnail && (e.autoOpenThumbnail = l.isTrue(e.autoEnableThumbnail),
delete e.autoEnableThumbnail),
void 0 !== e.direction && ("2" === e.direction || 2 === e.direction || e.direction === tP.READ_DIRECTION.RTL ? e.readDirection = tP.READ_DIRECTION.RTL : e.readDirection = tP.READ_DIRECTION.LTR,
delete e.direction),
void 0 !== e.hard && (e.flipbookHardPages = e.hard,
"hard" === e.flipbookHardPages && (e.flipbookHardPages = "all"),
delete e.hard),
void 0 !== e.forceFit && delete e.forceFit,
"undefined" != typeof dFlipWPGlobal && "true" === e.wpOptions) {
if (!0 !== e.linksparsed) {
e.linksparsed = !0;
var n = [];
try {
for (var o in e.links) {
for (var a = e.links[o], s = [100, 100], r = 0; r < a.length; r++) {
for (var h = a[r].substr(1).slice(0, -1).split(","), u = [], p = 0; p < 5; p++)
u[p] = h[p];
s.push(u)
}
n[parseInt(o, 10) + 1] = s
}
} catch (e) {
console.error(e.stack)
}
e.links = tP.parseLinks(n)
}
} else
e.links = tP.parseLinks(e.links);
return l.sanitizeOptions(e)
};
tw.fn.extend({
flipBook: function(e, t) {
return null == t && (t = {}),
t.source = e,
t.element = tw(this),
new n.Application(t)
}
}),
tw(document).ready(function() {
var e = tw("body");
tP.executeCallback("beforeDearFlipInit"),
void 0 !== window.dFlipWPGlobal && tw.extend(!0, tP.defaults, tS(window.dFlipWPGlobal)),
tP.initUtils(),
tP.initControls(),
e.on("click", ".df-element[data-df-lightbox],.df-element[data-lightbox]", function(e) {
var t = tw(this)
, i = t.attr("target")
, n = t.attr("href")
, o = !1;
"#" === n || void 0 === n || t.hasClass("df-hash-focused") ? o = !0 : "_self" === i || "_blank" === i || (void 0 == i && "_self" === tP.defaults.targetWindow ? t.attr("target", "_self") : void 0 == i && "_blank" === tP.defaults.targetWindow ? t.attr("target", "_blank") : o = !0),
o && (e.preventDefault(),
e.stopPropagation(),
tP.openLightBox(t))
}),
e.on("click", ".df-trigger", function(e) {
var t = tw(this).attr("df-trigger");
tw("[df-trigger-id=" + t + "]").trigger("click")
}),
tP.checkBrowserURLforDefaults(),
tP.parseCSSElements(),
tP.parseFallBack(),
l.detectHash(),
tP.parseNormalElements(),
tP.checkBrowserURLforPDF(!0),
tP.openAttachmentLightBoxes(),
tP.executeCallback("afterDearFlipInit")
}),
l.finalizeOptions = function(e) {
return tS(e)
}
,
e6.prototype.processAnnotations = function(e, t) {
this.processCustomLinks(e, t),
this.app.viewer.finalizeAnnotations(t, e)
}
,
tP.executeCallback("onDearFlipLoad")
}()
}();