UNPKG

v-viewer-picture

Version:

Image viewer component for vue, supports rotation, scale, zoom and so on, based on viewer.js

1,410 lines (1,409 loc) 70.2 kB
import { h as Xt, render as Ut, watch as vt, nextTick as gt, defineComponent as Je, ref as Qe, onMounted as ti, onUnmounted as ei, openBlock as ii, createElementBlock as ni, renderSlot as ri } from "vue"; var ai = typeof global == "object" && global && global.Object === Object && global; const Pe = ai; var oi = typeof self == "object" && self && self.Object === Object && self, si = Pe || oi || Function("return this")(); const Et = si; var li = Et.Symbol; const wt = li; var ze = Object.prototype, ui = ze.hasOwnProperty, ci = ze.toString, nt = wt ? wt.toStringTag : void 0; function hi(e) { var t = ui.call(e, nt), i = e[nt]; try { e[nt] = void 0; var n = !0; } catch { } var r = ci.call(e); return n && (t ? e[nt] = i : delete e[nt]), r; } var fi = Object.prototype, di = fi.toString; function vi(e) { return di.call(e); } var gi = "[object Null]", mi = "[object Undefined]", Ht = wt ? wt.toStringTag : void 0; function Ot(e) { return e == null ? e === void 0 ? mi : gi : Ht && Ht in Object(e) ? hi(e) : vi(e); } function St(e) { return e != null && typeof e == "object"; } var pi = "[object Symbol]"; function bi(e) { return typeof e == "symbol" || St(e) && Ot(e) == pi; } var wi = Array.isArray; const yi = wi; var Ti = /\s/; function Ei(e) { for (var t = e.length; t-- && Ti.test(e.charAt(t)); ) ; return t; } var Oi = /^\s+/; function Si(e) { return e && e.slice(0, Ei(e) + 1).replace(Oi, ""); } function q(e) { var t = typeof e; return e != null && (t == "object" || t == "function"); } var Bt = 0 / 0, xi = /^[-+]0x[0-9a-f]+$/i, Ai = /^0b[01]+$/i, Ii = /^0o[0-7]+$/i, _i = parseInt; function qt(e) { if (typeof e == "number") return e; if (bi(e)) return Bt; if (q(e)) { var t = typeof e.valueOf == "function" ? e.valueOf() : e; e = q(t) ? t + "" : t; } if (typeof e != "string") return e === 0 ? e : +e; e = Si(e); var i = Ai.test(e); return i || Ii.test(e) ? _i(e.slice(2), i ? 2 : 8) : xi.test(e) ? Bt : +e; } function ke(e) { return e; } var Di = "[object AsyncFunction]", Ni = "[object Function]", Ci = "[object GeneratorFunction]", Li = "[object Proxy]"; function $e(e) { if (!q(e)) return !1; var t = Ot(e); return t == Ni || t == Ci || t == Di || t == Li; } var Pi = Et["__core-js_shared__"]; const Dt = Pi; var Kt = function() { var e = /[^.]+$/.exec(Dt && Dt.keys && Dt.keys.IE_PROTO || ""); return e ? "Symbol(src)_1." + e : ""; }(); function zi(e) { return !!Kt && Kt in e; } var ki = Function.prototype, $i = ki.toString; function Mi(e) { if (e != null) { try { return $i.call(e); } catch { } try { return e + ""; } catch { } } return ""; } var Ri = /[\\^$.*+?()[\]{}|]/g, Vi = /^\[object .+?Constructor\]$/, ji = Function.prototype, Fi = Object.prototype, Wi = ji.toString, Yi = Fi.hasOwnProperty, Xi = RegExp( "^" + Wi.call(Yi).replace(Ri, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function Ui(e) { if (!q(e) || zi(e)) return !1; var t = $e(e) ? Xi : Vi; return t.test(Mi(e)); } function Hi(e, t) { return e == null ? void 0 : e[t]; } function Bi(e, t) { var i = Hi(e, t); return Ui(i) ? i : void 0; } function qi(e, t, i) { switch (i.length) { case 0: return e.call(t); case 1: return e.call(t, i[0]); case 2: return e.call(t, i[0], i[1]); case 3: return e.call(t, i[0], i[1], i[2]); } return e.apply(t, i); } var Ki = 800, Gi = 16, Zi = Date.now; function Ji(e) { var t = 0, i = 0; return function() { var n = Zi(), r = Gi - (n - i); if (i = n, r > 0) { if (++t >= Ki) return arguments[0]; } else t = 0; return e.apply(void 0, arguments); }; } function Qi(e) { return function() { return e; }; } var tn = function() { try { var e = Bi(Object, "defineProperty"); return e({}, "", {}), e; } catch { } }(); const yt = tn; var en = yt ? function(e, t) { return yt(e, "toString", { configurable: !0, enumerable: !1, value: Qi(t), writable: !0 }); } : ke; const nn = en; var rn = Ji(nn); const an = rn; var on = 9007199254740991, sn = /^(?:0|[1-9]\d*)$/; function Me(e, t) { var i = typeof e; return t = t == null ? on : t, !!t && (i == "number" || i != "symbol" && sn.test(e)) && e > -1 && e % 1 == 0 && e < t; } function Re(e, t, i) { t == "__proto__" && yt ? yt(e, t, { configurable: !0, enumerable: !0, value: i, writable: !0 }) : e[t] = i; } function Mt(e, t) { return e === t || e !== e && t !== t; } var ln = Object.prototype, un = ln.hasOwnProperty; function Ve(e, t, i) { var n = e[t]; (!(un.call(e, t) && Mt(n, i)) || i === void 0 && !(t in e)) && Re(e, t, i); } function cn(e, t, i, n) { var r = !i; i || (i = {}); for (var a = -1, o = t.length; ++a < o; ) { var l = t[a], c = n ? n(i[l], e[l], l, i, e) : void 0; c === void 0 && (c = e[l]), r ? Re(i, l, c) : Ve(i, l, c); } return i; } var Gt = Math.max; function hn(e, t, i) { return t = Gt(t === void 0 ? e.length - 1 : t, 0), function() { for (var n = arguments, r = -1, a = Gt(n.length - t, 0), o = Array(a); ++r < a; ) o[r] = n[t + r]; r = -1; for (var l = Array(t + 1); ++r < t; ) l[r] = n[r]; return l[t] = i(o), qi(e, this, l); }; } function je(e, t) { return an(hn(e, t, ke), e + ""); } var fn = 9007199254740991; function Fe(e) { return typeof e == "number" && e > -1 && e % 1 == 0 && e <= fn; } function xt(e) { return e != null && Fe(e.length) && !$e(e); } function We(e, t, i) { if (!q(i)) return !1; var n = typeof t; return (n == "number" ? xt(i) && Me(t, i.length) : n == "string" && t in i) ? Mt(i[t], e) : !1; } function dn(e) { return je(function(t, i) { var n = -1, r = i.length, a = r > 1 ? i[r - 1] : void 0, o = r > 2 ? i[2] : void 0; for (a = e.length > 3 && typeof a == "function" ? (r--, a) : void 0, o && We(i[0], i[1], o) && (a = r < 3 ? void 0 : a, r = 1), t = Object(t); ++n < r; ) { var l = i[n]; l && e(t, l, n, a); } return t; }); } var vn = Object.prototype; function Rt(e) { var t = e && e.constructor, i = typeof t == "function" && t.prototype || vn; return e === i; } function gn(e, t) { for (var i = -1, n = Array(e); ++i < e; ) n[i] = t(i); return n; } var mn = "[object Arguments]"; function Zt(e) { return St(e) && Ot(e) == mn; } var Ye = Object.prototype, pn = Ye.hasOwnProperty, bn = Ye.propertyIsEnumerable, wn = Zt(function() { return arguments; }()) ? Zt : function(e) { return St(e) && pn.call(e, "callee") && !bn.call(e, "callee"); }; const yn = wn; function Tn() { return !1; } var Xe = typeof exports == "object" && exports && !exports.nodeType && exports, Jt = Xe && typeof module == "object" && module && !module.nodeType && module, En = Jt && Jt.exports === Xe, Qt = En ? Et.Buffer : void 0, On = Qt ? Qt.isBuffer : void 0, Sn = On || Tn; const xn = Sn; var An = "[object Arguments]", In = "[object Array]", _n = "[object Boolean]", Dn = "[object Date]", Nn = "[object Error]", Cn = "[object Function]", Ln = "[object Map]", Pn = "[object Number]", zn = "[object Object]", kn = "[object RegExp]", $n = "[object Set]", Mn = "[object String]", Rn = "[object WeakMap]", Vn = "[object ArrayBuffer]", jn = "[object DataView]", Fn = "[object Float32Array]", Wn = "[object Float64Array]", Yn = "[object Int8Array]", Xn = "[object Int16Array]", Un = "[object Int32Array]", Hn = "[object Uint8Array]", Bn = "[object Uint8ClampedArray]", qn = "[object Uint16Array]", Kn = "[object Uint32Array]", S = {}; S[Fn] = S[Wn] = S[Yn] = S[Xn] = S[Un] = S[Hn] = S[Bn] = S[qn] = S[Kn] = !0; S[An] = S[In] = S[Vn] = S[_n] = S[jn] = S[Dn] = S[Nn] = S[Cn] = S[Ln] = S[Pn] = S[zn] = S[kn] = S[$n] = S[Mn] = S[Rn] = !1; function Gn(e) { return St(e) && Fe(e.length) && !!S[Ot(e)]; } function Zn(e) { return function(t) { return e(t); }; } var Ue = typeof exports == "object" && exports && !exports.nodeType && exports, ot = Ue && typeof module == "object" && module && !module.nodeType && module, Jn = ot && ot.exports === Ue, Nt = Jn && Pe.process, Qn = function() { try { var e = ot && ot.require && ot.require("util").types; return e || Nt && Nt.binding && Nt.binding("util"); } catch { } }(); const te = Qn; var ee = te && te.isTypedArray, tr = ee ? Zn(ee) : Gn; const er = tr; var ir = Object.prototype, nr = ir.hasOwnProperty; function He(e, t) { var i = yi(e), n = !i && yn(e), r = !i && !n && xn(e), a = !i && !n && !r && er(e), o = i || n || r || a, l = o ? gn(e.length, String) : [], c = l.length; for (var s in e) (t || nr.call(e, s)) && !(o && (s == "length" || r && (s == "offset" || s == "parent") || a && (s == "buffer" || s == "byteLength" || s == "byteOffset") || Me(s, c))) && l.push(s); return l; } function rr(e, t) { return function(i) { return e(t(i)); }; } var ar = rr(Object.keys, Object); const or = ar; var sr = Object.prototype, lr = sr.hasOwnProperty; function ur(e) { if (!Rt(e)) return or(e); var t = []; for (var i in Object(e)) lr.call(e, i) && i != "constructor" && t.push(i); return t; } function cr(e) { return xt(e) ? He(e) : ur(e); } var hr = Object.prototype, fr = hr.hasOwnProperty, dr = dn(function(e, t) { if (Rt(t) || xt(t)) { cn(t, cr(t), e); return; } for (var i in t) fr.call(t, i) && Ve(e, i, t[i]); }); const vr = dr; function gr(e) { var t = []; if (e != null) for (var i in Object(e)) t.push(i); return t; } var mr = Object.prototype, pr = mr.hasOwnProperty; function br(e) { if (!q(e)) return gr(e); var t = Rt(e), i = []; for (var n in e) n == "constructor" && (t || !pr.call(e, n)) || i.push(n); return i; } function wr(e) { return xt(e) ? He(e, !0) : br(e); } var yr = function() { return Et.Date.now(); }; const Ct = yr; var Tr = "Expected a function", Er = Math.max, Or = Math.min; function Sr(e, t, i) { var n, r, a, o, l, c, s = 0, h = !1, u = !1, f = !0; if (typeof e != "function") throw new TypeError(Tr); t = qt(t) || 0, q(i) && (h = !!i.leading, u = "maxWait" in i, a = u ? Er(qt(i.maxWait) || 0, t) : a, f = "trailing" in i ? !!i.trailing : f); function d(O) { var k = n, P = r; return n = r = void 0, s = O, o = e.apply(P, k), o; } function p(O) { return s = O, l = setTimeout(z, t), h ? d(O) : o; } function b(O) { var k = O - c, P = O - s, W = t - k; return u ? Or(W, a - P) : W; } function C(O) { var k = O - c, P = O - s; return c === void 0 || k >= t || k < 0 || u && P >= a; } function z() { var O = Ct(); if (C(O)) return L(O); l = setTimeout(z, b(O)); } function L(O) { return l = void 0, f && n ? d(O) : (n = r = void 0, o); } function _() { l !== void 0 && clearTimeout(l), s = 0, n = c = r = l = void 0; } function D() { return l === void 0 ? o : L(Ct()); } function x() { var O = Ct(), k = C(O); if (n = arguments, r = this, c = O, k) { if (l === void 0) return p(c); if (u) return clearTimeout(l), l = setTimeout(z, t), d(c); } return l === void 0 && (l = setTimeout(z, t)), o; } return x.cancel = _, x.flush = D, x; } var Be = Object.prototype, xr = Be.hasOwnProperty, Ar = je(function(e, t) { e = Object(e); var i = -1, n = t.length, r = n > 2 ? t[2] : void 0; for (r && We(t[0], t[1], r) && (n = 1); ++i < n; ) for (var a = t[i], o = wr(a), l = -1, c = o.length; ++l < c; ) { var s = o[l], h = e[s]; (h === void 0 || Mt(h, Be[s]) && !xr.call(e, s)) && (e[s] = a[s]); } return e; }); const Ir = Ar; /*! * ViewerVue.js v1.1.8 * https://alibaba4184hub.github.io/viewerjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * * Date: 2025-05-28T03:41:22.274Z */ function _r(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); } function ie(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, qe(n.key), n); } } function Dr(e, t, i) { return t && ie(e.prototype, t), i && ie(e, i), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function Nr(e, t, i) { return (t = qe(t)) in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e; } function ne(e, t) { var i = Object.keys(e); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); t && (n = n.filter(function(r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), i.push.apply(i, n); } return i; } function Vt(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t] != null ? arguments[t] : {}; t % 2 ? ne(Object(i), !0).forEach(function(n) { Nr(e, n, i[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(i)) : ne(Object(i)).forEach(function(n) { Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(i, n)); }); } return e; } function Cr(e, t) { if (typeof e != "object" || !e) return e; var i = e[Symbol.toPrimitive]; if (i !== void 0) { var n = i.call(e, t || "default"); if (typeof n != "object") return n; throw new TypeError("@@toPrimitive must return a primitive value."); } return (t === "string" ? String : Number)(e); } function qe(e) { var t = Cr(e, "string"); return typeof t == "symbol" ? t : t + ""; } function Pt(e) { return Pt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) { return typeof t; } : function(t) { return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; }, Pt(e); } var re = { backdrop: !0, button: !0, navbar: !0, title: !0, toolbar: !0, className: "", container: "body", filter: null, fullscreen: !0, inheritedAttributes: ["crossOrigin", "decoding", "isMap", "loading", "referrerPolicy", "sizes", "srcset", "useMap"], initialCoverage: 0.9, initialViewIndex: 0, inline: !1, interval: 5e3, keyboard: !0, focus: !0, loading: !0, loop: !0, minWidth: 200, minHeight: 100, movable: !0, rotatable: !0, scalable: !0, zoomable: !0, zoomOnTouch: !0, zoomOnWheel: !0, slideOnTouch: !0, toggleOnDblclick: !0, tooltip: !0, transition: !0, zIndex: 2015, zIndexInline: 0, zoomRatio: 0.1, minZoomRatio: 0.01, maxZoomRatio: 100, url: "src", ready: null, show: null, shown: null, hide: null, hidden: null, view: null, viewed: null, move: null, moved: null, rotate: null, rotated: null, scale: null, scaled: null, zoom: null, zoomed: null, play: null, stop: null }, Lr = '<div class="viewer-container" tabindex="-1" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title viewer-relative"><span class="viewer-title-tooltip"></span><span class="viewer-title-bubble"></span></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list" role="navigation"></ul></div></div><div class="viewer-tooltip" role="alert" aria-hidden="true"></div><div class="viewer-button" data-viewer-action="mix" role="button"></div><div class="viewer-player"></div></div>', At = typeof window < "u" && typeof window.document < "u", X = At ? window : {}, Q = At && X.document.documentElement ? "ontouchstart" in X.document.documentElement : !1, jt = At ? "PointerEvent" in X : !1, m = "viewer", mt = "move", Ke = "switch", at = "zoom", ht = "".concat(m, "-active"), ae = "".concat(m, "-close"), pt = "".concat(m, "-fade"), zt = "".concat(m, "-fixed"), oe = "".concat(m, "-fullscreen-exit"), Y = "".concat(m, "-hide"), Pr = "".concat(m, "-hide-md-down"), zr = "".concat(m, "-hide-sm-down"), kr = "".concat(m, "-hide-xs-down"), M = "".concat(m, "-in"), st = "".concat(m, "-invisible"), tt = "".concat(m, "-loading"), $r = "".concat(m, "-move"), se = "".concat(m, "-open"), U = "".concat(m, "-show"), I = "".concat(m, "-transition"), H = "click", kt = "dblclick", le = "dragstart", ue = "focusin", ce = "keydown", R = "load", B = "error", Mr = Q ? "touchend touchcancel" : "mouseup", Rr = Q ? "touchmove" : "mousemove", Vr = Q ? "touchstart" : "mousedown", he = jt ? "pointerdown" : Vr, fe = jt ? "pointermove" : Rr, de = jt ? "pointerup pointercancel" : Mr, ve = "resize", j = "transitionend", ge = "wheel", me = "ready", pe = "show", be = "shown", we = "hide", ye = "hidden", Te = "view", lt = "viewed", Ee = "move", Oe = "moved", Se = "rotate", xe = "rotated", Ae = "scale", Ie = "scaled", _e = "zoom", De = "zoomed", Ne = "play", Ce = "stop", Tt = "".concat(m, "Action"), Ft = /\s\s*/, rt = ["zoom-in", "zoom-out", "one-to-one", "reset", "prev", "play", "next", "rotate-left", "rotate-right", "flip-horizontal", "flip-vertical", "full-screen-modal", "download"], jr = { "zoom-in": "\u653E\u5927", "zoom-out": "\u7F29\u5C0F", "one-to-one": "100%\u663E\u793A", reset: "\u91CD\u7F6E", prev: "\u4E0A\u4E00\u5F20", play: "\u4EE5\u5E7B\u706F\u7247\u5F62\u5F0F\u64AD\u653E", next: "\u4E0B\u4E00\u5F20", "rotate-left": "\u5411\u5DE6\u65CB\u8F6C90\xB0", "rotate-right": "\u5411\u53F3\u65CB\u8F6C90\xB0", "flip-horizontal": "\u6C34\u5E73\u7FFB\u8F6C", "flip-vertical": "\u5782\u76F4\u7FFB\u8F6C", "full-screen-modal": "\u5168\u5C4F", download: "\u4E0B\u8F7D" }; function ut(e) { return typeof e == "string"; } var Fr = Number.isNaN || X.isNaN; function A(e) { return typeof e == "number" && !Fr(e); } function G(e) { return typeof e > "u"; } function et(e) { return Pt(e) === "object" && e !== null; } var Wr = Object.prototype.hasOwnProperty; function Z(e) { if (!et(e)) return !1; try { var t = e.constructor, i = t.prototype; return t && i && Wr.call(i, "isPrototypeOf"); } catch { return !1; } } function y(e) { return typeof e == "function"; } function E(e, t) { if (e && y(t)) if (Array.isArray(e) || A(e.length)) { var i = e.length, n; for (n = 0; n < i && t.call(e, e[n], n, e) !== !1; n += 1) ; } else et(e) && Object.keys(e).forEach(function(r) { t.call(e, e[r], r, e); }); return e; } var $ = Object.assign || function(t) { for (var i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), r = 1; r < i; r++) n[r - 1] = arguments[r]; return et(t) && n.length > 0 && n.forEach(function(a) { et(a) && Object.keys(a).forEach(function(o) { t[o] = a[o]; }); }), t; }, Yr = /^(?:width|height|left|top|marginLeft|marginTop)$/; function F(e, t) { var i = e.style; E(t, function(n, r) { Yr.test(r) && A(n) && (n += "px"), i[r] = n; }); } function Le(e) { return ut(e) ? e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : e; } function K(e, t) { return !e || !t ? !1 : e.classList ? e.classList.contains(t) : e.className.indexOf(t) > -1; } function v(e, t) { if (!(!e || !t)) { if (A(e.length)) { E(e, function(n) { v(n, t); }); return; } if (e.classList) { e.classList.add(t); return; } var i = e.className.trim(); i ? i.indexOf(t) < 0 && (e.className = "".concat(i, " ").concat(t)) : e.className = t; } } function w(e, t) { if (!(!e || !t)) { if (A(e.length)) { E(e, function(i) { w(i, t); }); return; } if (e.classList) { e.classList.remove(t); return; } e.className.indexOf(t) >= 0 && (e.className = e.className.replace(t, "")); } } function ct(e, t, i) { if (!!t) { if (A(e.length)) { E(e, function(n) { ct(n, t, i); }); return; } i ? v(e, t) : w(e, t); } } var Xr = /([a-z\d])([A-Z])/g; function Wt(e) { return e.replace(Xr, "$1-$2").toLowerCase(); } function J(e, t) { return et(e[t]) ? e[t] : e.dataset ? e.dataset[t] : e.getAttribute("data-".concat(Wt(t))); } function $t(e, t, i) { et(i) ? e[t] = i : e.dataset ? e.dataset[t] = i : e.setAttribute("data-".concat(Wt(t)), i); } var Ge = function() { var e = !1; if (At) { var t = !1, i = function() { }, n = Object.defineProperty({}, "once", { get: function() { return e = !0, t; }, set: function(a) { t = a; } }); X.addEventListener("test", i, n), X.removeEventListener("test", i, n); } return e; }(); function T(e, t, i) { var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, r = i; t.trim().split(Ft).forEach(function(a) { if (!Ge) { var o = e.listeners; o && o[a] && o[a][i] && (r = o[a][i], delete o[a][i], Object.keys(o[a]).length === 0 && delete o[a], Object.keys(o).length === 0 && delete e.listeners); } e.removeEventListener(a, r, n); }); } function g(e, t, i) { var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, r = i; t.trim().split(Ft).forEach(function(a) { if (n.once && !Ge) { var o = e.listeners, l = o === void 0 ? {} : o; r = function() { delete l[a][i], e.removeEventListener(a, r, n); for (var s = arguments.length, h = new Array(s), u = 0; u < s; u++) h[u] = arguments[u]; i.apply(e, h); }, l[a] || (l[a] = {}), l[a][i] && e.removeEventListener(a, l[a][i], n), l[a][i] = r, e.listeners = l; } e.addEventListener(a, r, n); }); } function N(e, t, i, n) { var r; return y(Event) && y(CustomEvent) ? r = new CustomEvent(t, Vt({ bubbles: !0, cancelable: !0, detail: i }, n)) : (r = document.createEvent("CustomEvent"), r.initCustomEvent(t, !0, !0, i)), e.dispatchEvent(r); } function Ur(e) { var t = e.getBoundingClientRect(); return { left: t.left + (window.pageXOffset - document.documentElement.clientLeft), top: t.top + (window.pageYOffset - document.documentElement.clientTop) }; } function bt(e) { var t = e.rotate, i = e.scaleX, n = e.scaleY, r = e.translateX, a = e.translateY, o = []; A(r) && r !== 0 && o.push("translateX(".concat(r, "px)")), A(a) && a !== 0 && o.push("translateY(".concat(a, "px)")), A(t) && t !== 0 && o.push("rotate(".concat(t, "deg)")), A(i) && i !== 1 && o.push("scaleX(".concat(i, ")")), A(n) && n !== 1 && o.push("scaleY(".concat(n, ")")); var l = o.length ? o.join(" ") : "none"; return { WebkitTransform: l, msTransform: l, transform: l }; } function Hr(e) { return ut(e) ? decodeURIComponent(e.replace(/^.*\//, "").replace(/[?&#].*$/, "")) : ""; } var Lt = X.navigator && /Version\/\d+(\.\d+)+?\s+Safari/i.test(X.navigator.userAgent); function Ze(e, t, i) { var n = document.createElement("img"); if (e.naturalWidth && !Lt) return i(e.naturalWidth, e.naturalHeight), n; var r = document.body || document.documentElement; return n.onload = function() { i(n.width, n.height), Lt || r.removeChild(n); }, E(t.inheritedAttributes, function(a) { var o = e.getAttribute(a); o !== null && n.setAttribute(a, o); }), n.src = e.src, Lt || (n.style.cssText = "left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;", r.appendChild(n)), n; } function ft(e) { switch (e) { case 2: return kr; case 3: return zr; case 4: return Pr; default: return ""; } } function Br(e) { var t = Vt({}, e), i = []; return E(e, function(n, r) { delete t[r], E(t, function(a) { var o = Math.abs(n.startX - a.startX), l = Math.abs(n.startY - a.startY), c = Math.abs(n.endX - a.endX), s = Math.abs(n.endY - a.endY), h = Math.sqrt(o * o + l * l), u = Math.sqrt(c * c + s * s), f = (u - h) / h; i.push(f); }); }), i.sort(function(n, r) { return Math.abs(n) < Math.abs(r); }), i[0]; } function dt(e, t) { var i = e.pageX, n = e.pageY, r = { endX: i, endY: n }; return t ? r : Vt({ timeStamp: Date.now(), startX: i, startY: n }, r); } function qr(e) { var t = 0, i = 0, n = 0; return E(e, function(r) { var a = r.startX, o = r.startY; t += a, i += o, n += 1; }), t /= n, i /= n, { pageX: t, pageY: i }; } function Kr(e) { var t = document, i = t.activeElement; if (!i) return !1; if (i.tagName === "INPUT" || i.tagName === "TEXTAREA" || i.isContentEditable) return !0; for (var n = e.target; n; ) { if (n.tagName === "INPUT" || n.tagName === "TEXTAREA" || n.isContentEditable) return !0; n = n.parentElement; } return !1; } var Gr = { render: function() { this.initContainer(), this.initViewer(), this.initList(), this.renderViewer(); }, initBody: function() { var t = this.element.ownerDocument, i = t.body || t.documentElement; this.body = i, this.scrollbarWidth = window.innerWidth - t.documentElement.clientWidth, this.initialBodyPaddingRight = i.style.paddingRight, this.initialBodyComputedPaddingRight = window.getComputedStyle(i).paddingRight; }, initContainer: function() { this.containerData = { width: window.innerWidth, height: window.innerHeight }; }, initViewer: function() { var t = this.options, i = this.parent, n; t.inline && (n = { width: Math.max(i.offsetWidth, t.minWidth), height: Math.max(i.offsetHeight, t.minHeight) }, this.parentData = n), !t.inline && (this.fulled || !n) && (n = this.containerData), this.viewerData = $({}, n); }, renderViewer: function() { this.options.inline && !this.fulled && F(this.viewer, this.viewerData); }, initList: function() { var t = this, i = this.element, n = this.options, r = this.list, a = []; r.innerHTML = "", E(this.images, function(o, l) { var c = o.src, s = o.alt || Hr(c), h = t.getImageURL(o); if (c || h) { var u = document.createElement("li"), f = document.createElement("img"); E(n.inheritedAttributes, function(d) { var p = o.getAttribute(d); p !== null && f.setAttribute(d, p); }), n.navbar && (f.src = c || h), f.alt = s, f.setAttribute("data-original-url", h || c), u.setAttribute("data-index", l), u.setAttribute("data-viewer-action", "view"), u.setAttribute("role", "button"), n.keyboard && u.setAttribute("tabindex", 0), u.appendChild(f), r.appendChild(u), a.push(u); } }), this.items = a, E(a, function(o) { var l = o.firstElementChild, c, s; $t(l, "filled", !0), n.loading && v(o, tt), g(l, R, c = function(u) { T(l, B, s), n.loading && w(o, tt), t.loadImage(u); }, { once: !0 }), g(l, B, s = function() { T(l, R, c), n.loading && w(o, tt); }, { once: !0 }); }), n.transition && g(i, lt, function() { v(r, I); }, { once: !0 }); }, renderList: function() { var t = this.index, i = this.items[t]; if (!!i) { var n = i.nextElementSibling, r = parseInt(window.getComputedStyle(n || i).marginLeft, 10), a = i.offsetWidth, o = a + r; F(this.list, $({ width: o * this.length - r }, bt({ translateX: (this.viewerData.width - a) / 2 - o * t }))); } }, resetList: function() { var t = this.list; t.innerHTML = "", w(t, I), F(t, $({ width: 0 }, bt({ translateX: 0 }))); }, initImage: function(t) { var i = this, n = this.options, r = this.image, a = this.viewerData, o = this.footer.offsetHeight, l = a.width, c = Math.max(a.height - o, o), s = this.imageData || {}, h; this.imageInitializing = { abort: function() { h.onload = null; } }, h = Ze(r, n, function(u, f) { var d = u / f, p = Math.max(0, Math.min(1, n.initialCoverage)), b = l, C = c; i.imageInitializing = !1, c * d > l ? C = l / d : b = c * d, p = A(p) ? p : 0.9, b = Math.min(b * p, u), C = Math.min(C * p, f); var z = (l - b) / 2, L = (c - C) / 2, _ = { left: z, top: L, x: z, y: L, width: b, height: C, oldRatio: 1, ratio: b / u, aspectRatio: d, naturalWidth: u, naturalHeight: f }, D = $({}, _); n.rotatable && (_.rotate = s.rotate || 0, D.rotate = 0), n.scalable && (_.scaleX = s.scaleX || 1, _.scaleY = s.scaleY || 1, D.scaleX = 1, D.scaleY = 1), i.imageData = _, i.initialImageData = D, t && t(); }); }, renderImage: function(t) { var i = this, n = this.image, r = this.imageData; if (F(n, $({ width: r.width, height: r.height, marginLeft: r.x, marginTop: r.y }, bt(r))), t) if ((this.viewing || this.moving || this.rotating || this.scaling || this.zooming) && this.options.transition && K(n, I)) { var a = function() { i.imageRendering = !1, t(); }; this.imageRendering = { abort: function() { T(n, j, a); } }, g(n, j, a, { once: !0 }); } else t(); }, resetImage: function() { var t = this.image; t && (this.viewing && this.viewing.abort(), t.parentNode.removeChild(t), this.image = null, this.title.innerHTML = ""); } }, Zr = { bind: function() { var t = this.options, i = this.viewer, n = this.canvas, r = this.element.ownerDocument; g(i, H, this.onClick = this.click.bind(this)), g(i, le, this.onDragStart = this.dragstart.bind(this)), g(n, he, this.onPointerDown = this.pointerdown.bind(this)), g(r, fe, this.onPointerMove = this.pointermove.bind(this)), g(r, de, this.onPointerUp = this.pointerup.bind(this)), g(r, ce, this.onKeyDown = this.keydown.bind(this)), g(window, ve, this.onResize = this.resize.bind(this)), t.zoomable && t.zoomOnWheel && g(i, ge, this.onWheel = this.wheel.bind(this), { passive: !1, capture: !0 }), t.toggleOnDblclick && g(n, kt, this.onDblclick = this.dblclick.bind(this)); }, unbind: function() { var t = this.options, i = this.viewer, n = this.canvas, r = this.element.ownerDocument; T(i, H, this.onClick), T(i, le, this.onDragStart), T(n, he, this.onPointerDown), T(r, fe, this.onPointerMove), T(r, de, this.onPointerUp), T(r, ce, this.onKeyDown), T(window, ve, this.onResize), t.zoomable && t.zoomOnWheel && T(i, ge, this.onWheel, { passive: !1, capture: !0 }), t.toggleOnDblclick && T(n, kt, this.onDblclick); } }, Jr = { click: function(t) { var i = this.options, n = this.imageData, r = t.target, a = J(r, Tt); switch (!a && r.localName === "img" && r.parentElement.localName === "li" && (r = r.parentElement, a = J(r, Tt)), Q && t.isTrusted && r === this.canvas && clearTimeout(this.clickCanvasTimeout), a) { case "mix": this.played ? this.stop() : i.inline ? this.hide(!0) : this.hide(); break; case "hide": this.pointerMoved || this.hide(); break; case "view": this.view(J(r, "index")); break; case "zoom-in": this.zoom(0.1, !0); break; case "zoom-out": this.zoom(-0.1, !0); break; case "one-to-one": this.toggle(); break; case "reset": this.reset(); break; case "prev": this.prev(i.loop); break; case "play": this.play(i.fullscreen); break; case "next": this.next(i.loop); break; case "rotate-left": this.rotate(-90); break; case "rotate-right": this.rotate(90); break; case "flip-horizontal": this.scaleX(-n.scaleX || -1); break; case "flip-vertical": this.scaleY(-n.scaleY || -1); break; case "fullscreen-modal": this.play(i.toolbar.fullscreenModal); break; case "download": this.download(); break; default: this.played && this.stop(); } }, dblclick: function(t) { t.preventDefault(), this.viewed && t.target === this.image && (Q && t.isTrusted && clearTimeout(this.doubleClickImageTimeout), this.toggle(t.isTrusted ? t : t.detail && t.detail.originalEvent)); }, load: function() { var t = this; this.timeout && (clearTimeout(this.timeout), this.timeout = !1); var i = this.element, n = this.options, r = this.image, a = this.index, o = this.viewerData; w(r, st), n.loading && w(this.canvas, tt), r.style.cssText = "height:0;" + "margin-left:".concat(o.width / 2, "px;") + "margin-top:".concat(o.height / 2, "px;") + "max-width:none!important;position:relative;width:0;", this.initImage(function() { ct(r, $r, n.movable), ct(r, I, n.transition), t.renderImage(function() { t.viewed = !0, t.viewing = !1, y(n.viewed) && g(i, lt, n.viewed, { once: !0 }), N(i, lt, { originalImage: t.images[a], index: a, image: r }, { cancelable: !1 }); }); }); }, loadImage: function(t) { var i = t.target, n = i.parentNode, r = n.offsetWidth || 30, a = n.offsetHeight || 50, o = !!J(i, "filled"); Ze(i, this.options, function(l, c) { var s = l / c, h = r, u = a; a * s > r ? o ? h = a * s : u = r / s : o ? u = r / s : h = a * s, F(i, $({ width: h, height: u }, bt({ translateX: (r - h) / 2, translateY: (a - u) / 2 }))); }); }, keydown: function(t) { var i = this.options; if (!!i.keyboard && !Kr(t)) { var n = t.keyCode || t.which || t.charCode; switch (n) { case 13: this.viewer.contains(t.target) && this.click(t); break; } if (!!this.fulled) switch (n) { case 27: this.played ? this.stop() : i.inline ? this.fulled && this.exit() : this.hide(); break; case 32: this.played && this.stop(); break; case 37: this.played && this.playing ? this.playing.prev() : this.prev(i.loop); break; case 38: t.preventDefault(), this.zoom(i.zoomRatio, !0); break; case 39: this.played && this.playing ? this.playing.next() : this.next(i.loop); break; case 40: t.preventDefault(), this.zoom(-i.zoomRatio, !0); break; case 48: case 49: t.ctrlKey && (t.preventDefault(), this.toggle()); break; } } }, dragstart: function(t) { t.target.localName === "img" && t.preventDefault(); }, pointerdown: function(t) { var i = this.options, n = this.pointers, r = t.buttons, a = t.button; if (this.pointerMoved = !1, !(!this.viewed || this.showing || this.viewing || this.hiding || (t.type === "mousedown" || t.type === "pointerdown" && t.pointerType === "mouse") && (A(r) && r !== 1 || A(a) && a !== 0 || t.ctrlKey))) { t.preventDefault(), t.changedTouches ? E(t.changedTouches, function(l) { n[l.identifier] = dt(l); }) : n[t.pointerId || 0] = dt(t); var o = i.movable ? mt : !1; i.zoomOnTouch && i.zoomable && Object.keys(n).length > 1 ? o = at : i.slideOnTouch && (t.pointerType === "touch" || t.type === "touchstart") && this.isSwitchable() && (o = Ke), i.transition && (o === mt || o === at) && w(this.image, I), this.action = o; } }, pointermove: function(t) { var i = this.pointers, n = this.action; !this.viewed || !n || (t.preventDefault(), t.changedTouches ? E(t.changedTouches, function(r) { $(i[r.identifier] || {}, dt(r, !0)); }) : $(i[t.pointerId || 0] || {}, dt(t, !0)), this.change(t)); }, pointerup: function(t) { var i = this, n = this.options, r = this.action, a = this.pointers, o; t.changedTouches ? E(t.changedTouches, function(l) { o = a[l.identifier], delete a[l.identifier]; }) : (o = a[t.pointerId || 0], delete a[t.pointerId || 0]), r && (t.preventDefault(), n.transition && (r === mt || r === at) && v(this.image, I), this.action = !1, Q && r !== at && o && Date.now() - o.timeStamp < 500 && (clearTimeout(this.clickCanvasTimeout), clearTimeout(this.doubleClickImageTimeout), n.toggleOnDblclick && this.viewed && t.target === this.image ? this.imageClicked ? (this.imageClicked = !1, this.doubleClickImageTimeout = setTimeout(function() { N(i.image, kt, { originalEvent: t }); }, 50)) : (this.imageClicked = !0, this.doubleClickImageTimeout = setTimeout(function() { i.imageClicked = !1; }, 500)) : (this.imageClicked = !1, n.backdrop && n.backdrop !== "static" && t.target === this.canvas && (this.clickCanvasTimeout = setTimeout(function() { N(i.canvas, H, { originalEvent: t }); }, 50))))); }, resize: function() { var t = this; if (!(!this.isShown || this.hiding) && (this.fulled && (this.close(), this.initBody(), this.open()), this.initContainer(), this.initViewer(), this.renderViewer(), this.renderList(), this.viewed && this.initImage(function() { t.renderImage(); }), this.played)) { if (this.options.fullscreen && this.fulled && !(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement)) { this.stop(); return; } E(this.player.getElementsByTagName("img"), function(i) { g(i, R, t.loadImage.bind(t), { once: !0 }), N(i, R); }); } }, wheel: function(t) { var i = this; if (!!this.viewed && (t.preventDefault(), !this.wheeling)) { this.wheeling = !0, setTimeout(function() { i.wheeling = !1; }, 50); var n = Number(this.options.zoomRatio) || 0.1, r = 1; t.deltaY ? r = t.deltaY > 0 ? 1 : -1 : t.wheelDelta ? r = -t.wheelDelta / 120 : t.detail && (r = t.detail > 0 ? 1 : -1), this.zoom(-r * n, !0, null, t); } } }, Qr = { show: function() { var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.element, n = this.options; if (this.showing || this.isShown || this.showing) return this; if (!this.ready) return this.build(), this.ready && this.show(t), this; if (y(n.show) && g(i, pe, n.show, { once: !0 }), N(i, pe) === !1 || !this.ready) return this; this.hiding && this.transitioning.abort(), this.showing = !0, this.open(); var r = this.viewer; if (w(r, Y), r.setAttribute("role", "dialog"), r.setAttribute("aria-labelledby", this.title.id), r.setAttribute("aria-modal", !0), r.removeAttribute("aria-hidden"), n.transition && !t) { var a = this.shown.bind(this); this.transitioning = { abort: function() { T(r, j, a), w(r, M); } }, v(r, I), r.initialOffsetWidth = r.offsetWidth, g(r, j, a, { once: !0 }), v(r, M); } else v(r, M), this.shown(); return this; }, hide: function() { var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, n = this.element, r = this.options; if (this.hiding || !(this.isShown || this.showing)) return this; if (y(r.hide) && g(n, we, r.hide, { once: !0 }), N(n, we) === !1) return this; this.showing && this.transitioning.abort(), this.hiding = !0, this.played ? this.stop() : this.viewing && this.viewing.abort(); var a = this.viewer, o = this.image, l = function() { w(a, M), t.hidden(); }; if (r.transition && !i) { var c = function(u) { u && u.target === a && (T(a, j, c), t.hidden()); }, s = function() { K(a, I) ? (g(a, j, c), w(a, M)) : l(); }; this.transitioning = { abort: function() { t.viewed && K(o, I) ? T(o, j, s) : K(a, I) && T(a, j, c); } }, this.viewed && K(o, I) ? (g(o, j, s, { once: !0 }), this.zoomTo(0, !1, null, null, !0)) : s(); } else l(); return this; }, view: function() { var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.initialViewIndex; if (i = Number(i) || 0, this.hiding || this.played || i < 0 || i >= this.length || this.viewed && i === this.index) return this; if (!this.isShown) { this.index = i; var n = this.options.inline; return this.show(n); } this.viewing && this.viewing.abort(); var r = this.element, a = this.options, o = this.title, l = this.titleBubble, c = this.canvas, s = this.items[i], h = s.querySelector("img"), u = J(h, "originalUrl"), f = h.getAttribute("alt"), d = document.createElement("img"); if (E(a.inheritedAttributes, function(L) { var _ = h.getAttribute(L); _ !== null && d.setAttribute(L, _); }), d.src = u, d.alt = f, y(a.view) && g(r, Te, a.view, { once: !0 }), N(r, Te, { originalImage: this.images[i], index: i, image: d }) === !1 || !this.isShown || this.hiding || this.played) return this; var p = this.items[this.index]; p && (w(p, ht), p.removeAttribute("aria-selected")), v(s, ht), s.setAttribute("aria-selected", !0), a.focus && s.focus(), this.image = d, this.viewed = !1, this.index = i, this.imageData = {}, v(d, st), a.loading && v(c, tt), c.innerHTML = "", c.appendChild(d), this.renderList(), o.innerHTML = ""; var b = function() { var _ = t.imageData, D = Array.isArray(a.title) ? a.title[1] : a.title; l.innerHTML = Le(y(D) ? D.call(t, d, _) : "".concat(f)), o.innerHTML = Le(y(D) ? D.call(t, d, _) : "".concat(f)); }, C, z; return g(r, lt, b, { once: !0 }), this.viewing = { abort: function() { T(r, lt, b), d.complete ? t.imageRendering ? t.imageRendering.abort() : t.imageInitializing && t.imageInitializing.abort() : (d.src = "", T(d, R, C), t.timeout && clearTimeout(t.timeout)); } }, d.complete ? this.load() : (g(d, R, C = function() { T(d, B, z), t.load(); }, { once: !0 }), g(d, B, z = function() { T(d, R, C), t.timeout && (clearTimeout(t.timeout), t.timeout = !1), w(d, st), a.loading && w(t.canvas, tt); }, { once: !0 }), this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(function() { w(d, st), t.timeout = !1; }, 1e3)), this; }, prev: function() { var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.index - 1; return i < 0 && (i = t ? this.length - 1 : 0), this.view(i), this; }, next: function() { var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.length - 1, n = this.index + 1; return n > i && (n = t ? 0 : i), this.view(n), this; }, move: function(t) { var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, n = this.imageData; return this.moveTo(G(t) ? t : n.x + Number(t), G(i) ? i : n.y + Number(i)), this; }, moveTo: function(t) { var i = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, a = this.element, o = this.options, l = this.imageData; if (t = Number(t), n = Number(n), this.viewed && !this.played && o.movable) { var c = l.x, s = l.y, h = !1; if (A(t) ? h = !0 : t = c, A(n) ? h = !0 : n = s, h) { if (y(o.move) && g(a, Ee, o.move, { once: !0 }), N(a, Ee, { x: t, y: n, oldX: c, oldY: s, originalEvent: r }) === !1) return this; l.x = t, l.y = n, l.left = t, l.top = n, this.moving = !0, this.renderImage(function() { i.moving = !1, y(o.moved) && g(a, Oe, o.moved, { once: !0 }), N(a, Oe, { x: t, y: n, oldX: c, oldY: s, originalEvent: r }, { cancelable: !1 }); }); } } return this; }, rotate: function(t) { return this.rotateTo((this.imageData.rotate || 0) + Number(t)), this; }, rotateTo: function(t) { var i = this, n = this.element, r = this.options, a = this.imageData; if (t = Number(t), A(t) && this.viewed && !this.played && r.rotatable) { var o = a.rotate; if (y(r.rotate) && g(n, Se, r.rotate, { once: !0 }), N(n, Se, { degree: t, oldDegree: o }) === !1) return this; a.rotate = t, this.rotating = !0, this.renderImage(function() { i.rotating = !1, y(r.rotated) && g(n, xe, r.rotated, { once: !0 }), N(n, xe, { degree: t, oldDegree: o }, { cancelable: !1 }); }); } return this; }, scaleX: function(t) { return this.scale(t, this.imageData.scaleY), this; }, scaleY: function(t) { return this.scale(this.imageData.scaleX, t), this; }, scale: function(t) { var i = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, r = this.element, a = this.options, o = this.imageData; if (t = Number(t), n = Number(n), this.viewed && !this.played && a.scalable) { var l = o.scaleX, c = o.scaleY, s = !1; if (A(t) ? s = !0 : t = l, A(n) ? s = !0 : n = c, s) { if (y(a.scale) && g(r, Ae, a.scale, { once: !0 }), N(r, Ae, { scaleX: t, scaleY: n, oldScaleX: l, oldScaleY: c }) === !1) return this; o.scaleX = t, o.scaleY = n, this.scaling = !0, this.renderImage(function() { i.scaling = !1, y(a.scaled) && g(r, Ie, a.scaled, { once: !0 }), N(r, Ie, { scaleX: t, scaleY: n, oldScaleX: l, oldScaleY: c }, { cancelable: !1 }); }); } } return this; }, zoom: function(t) { var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, a = this.imageData; return t = Number(t), t < 0 ? t = 1 / (1 - t) : t = 1 + t, this.zoomTo(a.width * t / a.naturalWidth, i, n, r), this; }, zoomTo: function(t) { var i = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1, l = this.element, c = this.options, s = this.pointers, h = this.imageData, u = h.x, f = h.y, d = h.width, p = h.height, b = h.naturalWidth, C = h.naturalHeight; if (t = Math.max(0, t), A(t) && this.viewed && !this.played && (o || c.zoomable)) { if (!o) { var z = Math.max(0.01, c.minZoomRatio), L = Math.min(100, c.maxZoomRatio); t = Math.min(Math.max(t, z), L); } if (a) switch (a.type) { case "wheel": c.zoomRatio >= 0.055 && t > 0.95 && t < 1.05 && (t = 1); break; case "pointermove": case "touchmove": case "mousemove": t > 0.99 && t < 1.01 && (t = 1); break; } var _ = b * t, D = C * t, x = _ - d, O = D - p, k = h.ratio; if (y(c.zoom) && g(l, _e, c.zoom, { once: !0 }), N(l, _e, { ratio: t, oldRatio: k, originalEvent: a }) === !1) return this; if (this.zooming = !0, a) { var P = Ur(this.viewer), W = s && Object.keys(s).length > 0 ? qr(s) : { pageX: a.pageX, pageY: a.pageY }; h.x -= x * ((W.pageX - P.left - u) / d), h.y -= O * ((W.pageY - P.top - f) / p); } else Z(r) && A(r.x) && A(r.y) ? (h.x -= x * ((r.x - u) / d), h.y -= O * ((r.y - f) / p)) : (h.x -= x / 2, h.y -= O / 2); h.left = h.x, h.top = h.y, h.width = _, h.height = D, h.oldRatio = k, h.ratio = t, this.renderImage(function() { i.zooming = !1, y(c.zoomed) && g(l, De, c.zoomed, { once: !0 }), N(l, De, { ratio: t, oldRatio: k, originalEvent: a }, { cancelable: !1 }); }), n && this.tooltip(); } return this; }, play: function() { var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1; if (!this.isShown || this.played) return this; var n = this.element, r = this.options; if (y(r.play) && g(n, Ne, r.play, { once: !0 }), N(n, Ne) === !1) return this; var a = this.player, o = this.loadImage.bind(this), l = [], c = 0, s = 0; if (this.played = !0, this.onLoadWhenPlay = o, i && this.requestFullscreen(i), v(a, U), E(this.items, function(f, d) { var p = f.querySelector("img"), b = document.createElement("img"); b.src = J(p, "originalUrl"), b.alt = p.getAttribute("alt"), b.referrerPolicy = p.referrerPolicy, c += 1, v(b, pt), ct(b, I, r.transition), K(f, ht) && (v(b, M), s = d), l.push(b), g(b, R, o, { once: !0 }), a.appendChild(b); }), A(r.interval) && r.interval > 0) { var h = function() { clearTimeout(t.playing.timeout), w(l[s], M), s -= 1, s = s >= 0 ? s : c - 1, v(l[s], M), t.playing.timeout = setTimeout(h, r.interval); }, u = function() { clearTimeout(t.playing.timeout), w(l[s], M), s += 1, s = s < c ? s : 0, v(l[s], M), t.playing.timeout = setTimeout(u, r.interval); }; c > 1 && (this.playing = { prev: h, next: u, timeout: setTimeout(u, r.interval) }); } return this; }, stop: function() { var t = this; if (!this.played) return this; var i = this.element, n = this.options;