@web-utils/component 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/element-dialog/index.js +3 -2
- package/dist/components/iframe-window/index.js +21 -60
- package/dist/components/iframe-window/style.css +1 -1
- package/dist/components/image-viewer/index.js +1348 -0
- package/dist/components/image-viewer/style.css +9 -0
- package/dist/index.css +418 -3
- package/dist/index.es.js +3608 -2300
- package/package.json +163 -162
- package/web-types.json +53 -2
|
@@ -0,0 +1,1348 @@
|
|
|
1
|
+
import { n as ne } from "../../chunks/5d4282fb.js";
|
|
2
|
+
/*!
|
|
3
|
+
* Viewer.js v1.11.1
|
|
4
|
+
* https://fengyuanchen.github.io/viewerjs
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2015-present Chen Fengyuan
|
|
7
|
+
* Released under the MIT license
|
|
8
|
+
*
|
|
9
|
+
* Date: 2022-11-06T05:18:19.939Z
|
|
10
|
+
*/
|
|
11
|
+
function St(n, t) {
|
|
12
|
+
var i = Object.keys(n);
|
|
13
|
+
if (Object.getOwnPropertySymbols) {
|
|
14
|
+
var e = Object.getOwnPropertySymbols(n);
|
|
15
|
+
t && (e = e.filter(function(a) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(n, a).enumerable;
|
|
17
|
+
})), i.push.apply(i, e);
|
|
18
|
+
}
|
|
19
|
+
return i;
|
|
20
|
+
}
|
|
21
|
+
function wt(n) {
|
|
22
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
23
|
+
var i = arguments[t] != null ? arguments[t] : {};
|
|
24
|
+
t % 2 ? St(Object(i), !0).forEach(function(e) {
|
|
25
|
+
se(n, e, i[e]);
|
|
26
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(i)) : St(Object(i)).forEach(function(e) {
|
|
27
|
+
Object.defineProperty(n, e, Object.getOwnPropertyDescriptor(i, e));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return n;
|
|
31
|
+
}
|
|
32
|
+
function gt(n) {
|
|
33
|
+
return gt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
34
|
+
return typeof t;
|
|
35
|
+
} : function(t) {
|
|
36
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
37
|
+
}, gt(n);
|
|
38
|
+
}
|
|
39
|
+
function ae(n, t) {
|
|
40
|
+
if (!(n instanceof t))
|
|
41
|
+
throw new TypeError("Cannot call a class as a function");
|
|
42
|
+
}
|
|
43
|
+
function Dt(n, t) {
|
|
44
|
+
for (var i = 0; i < t.length; i++) {
|
|
45
|
+
var e = t[i];
|
|
46
|
+
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(n, e.key, e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function re(n, t, i) {
|
|
50
|
+
return t && Dt(n.prototype, t), i && Dt(n, i), Object.defineProperty(n, "prototype", {
|
|
51
|
+
writable: !1
|
|
52
|
+
}), n;
|
|
53
|
+
}
|
|
54
|
+
function se(n, t, i) {
|
|
55
|
+
return t in n ? Object.defineProperty(n, t, {
|
|
56
|
+
value: i,
|
|
57
|
+
enumerable: !0,
|
|
58
|
+
configurable: !0,
|
|
59
|
+
writable: !0
|
|
60
|
+
}) : n[t] = i, n;
|
|
61
|
+
}
|
|
62
|
+
var xt = {
|
|
63
|
+
backdrop: !0,
|
|
64
|
+
button: !0,
|
|
65
|
+
navbar: !0,
|
|
66
|
+
title: !0,
|
|
67
|
+
toolbar: !0,
|
|
68
|
+
className: "",
|
|
69
|
+
container: "body",
|
|
70
|
+
filter: null,
|
|
71
|
+
fullscreen: !0,
|
|
72
|
+
inheritedAttributes: ["crossOrigin", "decoding", "isMap", "loading", "referrerPolicy", "sizes", "srcset", "useMap"],
|
|
73
|
+
initialCoverage: 0.9,
|
|
74
|
+
initialViewIndex: 0,
|
|
75
|
+
inline: !1,
|
|
76
|
+
interval: 5e3,
|
|
77
|
+
keyboard: !0,
|
|
78
|
+
focus: !0,
|
|
79
|
+
loading: !0,
|
|
80
|
+
loop: !0,
|
|
81
|
+
minWidth: 200,
|
|
82
|
+
minHeight: 100,
|
|
83
|
+
movable: !0,
|
|
84
|
+
rotatable: !0,
|
|
85
|
+
scalable: !0,
|
|
86
|
+
zoomable: !0,
|
|
87
|
+
zoomOnTouch: !0,
|
|
88
|
+
zoomOnWheel: !0,
|
|
89
|
+
slideOnTouch: !0,
|
|
90
|
+
toggleOnDblclick: !0,
|
|
91
|
+
tooltip: !0,
|
|
92
|
+
transition: !0,
|
|
93
|
+
zIndex: 2015,
|
|
94
|
+
zIndexInline: 0,
|
|
95
|
+
zoomRatio: 0.1,
|
|
96
|
+
minZoomRatio: 0.01,
|
|
97
|
+
maxZoomRatio: 100,
|
|
98
|
+
url: "src",
|
|
99
|
+
ready: null,
|
|
100
|
+
show: null,
|
|
101
|
+
shown: null,
|
|
102
|
+
hide: null,
|
|
103
|
+
hidden: null,
|
|
104
|
+
view: null,
|
|
105
|
+
viewed: null,
|
|
106
|
+
move: null,
|
|
107
|
+
moved: null,
|
|
108
|
+
rotate: null,
|
|
109
|
+
rotated: null,
|
|
110
|
+
scale: null,
|
|
111
|
+
scaled: null,
|
|
112
|
+
zoom: null,
|
|
113
|
+
zoomed: null,
|
|
114
|
+
play: null,
|
|
115
|
+
stop: null
|
|
116
|
+
}, oe = '<div class="viewer-container" tabindex="-1" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></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>', dt = typeof window < "u" && typeof window.document < "u", M = dt ? window : {}, Z = dt && M.document.documentElement ? "ontouchstart" in M.document.documentElement : !1, yt = dt ? "PointerEvent" in M : !1, m = "viewer", ht = "move", Qt = "switch", tt = "zoom", rt = "".concat(m, "-active"), le = "".concat(m, "-close"), ut = "".concat(m, "-fade"), vt = "".concat(m, "-fixed"), he = "".concat(m, "-fullscreen"), It = "".concat(m, "-fullscreen-exit"), W = "".concat(m, "-hide"), ue = "".concat(m, "-hide-md-down"), ce = "".concat(m, "-hide-sm-down"), fe = "".concat(m, "-hide-xs-down"), C = "".concat(m, "-in"), et = "".concat(m, "-invisible"), $ = "".concat(m, "-loading"), de = "".concat(m, "-move"), _t = "".concat(m, "-open"), q = "".concat(m, "-show"), D = "".concat(m, "-transition"), G = "click", pt = "dblclick", At = "dragstart", Nt = "focusin", Ot = "keydown", z = "load", X = "error", me = Z ? "touchend touchcancel" : "mouseup", ge = Z ? "touchmove" : "mousemove", ve = Z ? "touchstart" : "mousedown", Ct = yt ? "pointerdown" : ve, zt = yt ? "pointermove" : ge, kt = yt ? "pointerup pointercancel" : me, Lt = "resize", k = "transitionend", Rt = "wheel", Vt = "ready", Ft = "show", Mt = "shown", Pt = "hide", Yt = "hidden", Wt = "view", it = "viewed", Xt = "move", Ht = "moved", qt = "rotate", Ut = "rotated", Bt = "scale", jt = "scaled", Kt = "zoom", Zt = "zoomed", $t = "play", Gt = "stop", ft = "".concat(m, "Action"), Et = /\s\s*/, st = ["zoom-in", "zoom-out", "one-to-one", "reset", "prev", "play", "next", "rotate-left", "rotate-right", "flip-horizontal", "flip-vertical"];
|
|
117
|
+
function nt(n) {
|
|
118
|
+
return typeof n == "string";
|
|
119
|
+
}
|
|
120
|
+
var pe = Number.isNaN || M.isNaN;
|
|
121
|
+
function T(n) {
|
|
122
|
+
return typeof n == "number" && !pe(n);
|
|
123
|
+
}
|
|
124
|
+
function B(n) {
|
|
125
|
+
return typeof n > "u";
|
|
126
|
+
}
|
|
127
|
+
function J(n) {
|
|
128
|
+
return gt(n) === "object" && n !== null;
|
|
129
|
+
}
|
|
130
|
+
var be = Object.prototype.hasOwnProperty;
|
|
131
|
+
function j(n) {
|
|
132
|
+
if (!J(n))
|
|
133
|
+
return !1;
|
|
134
|
+
try {
|
|
135
|
+
var t = n.constructor, i = t.prototype;
|
|
136
|
+
return t && i && be.call(i, "isPrototypeOf");
|
|
137
|
+
} catch {
|
|
138
|
+
return !1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function p(n) {
|
|
142
|
+
return typeof n == "function";
|
|
143
|
+
}
|
|
144
|
+
function w(n, t) {
|
|
145
|
+
if (n && p(t))
|
|
146
|
+
if (Array.isArray(n) || T(n.length)) {
|
|
147
|
+
var i = n.length, e;
|
|
148
|
+
for (e = 0; e < i && t.call(n, n[e], e, n) !== !1; e += 1)
|
|
149
|
+
;
|
|
150
|
+
} else
|
|
151
|
+
J(n) && Object.keys(n).forEach(function(a) {
|
|
152
|
+
t.call(n, n[a], a, n);
|
|
153
|
+
});
|
|
154
|
+
return n;
|
|
155
|
+
}
|
|
156
|
+
var O = Object.assign || function(t) {
|
|
157
|
+
for (var i = arguments.length, e = new Array(i > 1 ? i - 1 : 0), a = 1; a < i; a++)
|
|
158
|
+
e[a - 1] = arguments[a];
|
|
159
|
+
return J(t) && e.length > 0 && e.forEach(function(r) {
|
|
160
|
+
J(r) && Object.keys(r).forEach(function(s) {
|
|
161
|
+
t[s] = r[s];
|
|
162
|
+
});
|
|
163
|
+
}), t;
|
|
164
|
+
}, we = /^(?:width|height|left|top|marginLeft|marginTop)$/;
|
|
165
|
+
function L(n, t) {
|
|
166
|
+
var i = n.style;
|
|
167
|
+
w(t, function(e, a) {
|
|
168
|
+
we.test(a) && T(e) && (e += "px"), i[a] = e;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function ye(n) {
|
|
172
|
+
return nt(n) ? n.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">") : n;
|
|
173
|
+
}
|
|
174
|
+
function U(n, t) {
|
|
175
|
+
return !n || !t ? !1 : n.classList ? n.classList.contains(t) : n.className.indexOf(t) > -1;
|
|
176
|
+
}
|
|
177
|
+
function f(n, t) {
|
|
178
|
+
if (!(!n || !t)) {
|
|
179
|
+
if (T(n.length)) {
|
|
180
|
+
w(n, function(e) {
|
|
181
|
+
f(e, t);
|
|
182
|
+
});
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (n.classList) {
|
|
186
|
+
n.classList.add(t);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
var i = n.className.trim();
|
|
190
|
+
i ? i.indexOf(t) < 0 && (n.className = "".concat(i, " ").concat(t)) : n.className = t;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function v(n, t) {
|
|
194
|
+
if (!(!n || !t)) {
|
|
195
|
+
if (T(n.length)) {
|
|
196
|
+
w(n, function(i) {
|
|
197
|
+
v(i, t);
|
|
198
|
+
});
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (n.classList) {
|
|
202
|
+
n.classList.remove(t);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
n.className.indexOf(t) >= 0 && (n.className = n.className.replace(t, ""));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function at(n, t, i) {
|
|
209
|
+
if (t) {
|
|
210
|
+
if (T(n.length)) {
|
|
211
|
+
w(n, function(e) {
|
|
212
|
+
at(e, t, i);
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
i ? f(n, t) : v(n, t);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
var Ee = /([a-z\d])([A-Z])/g;
|
|
220
|
+
function Tt(n) {
|
|
221
|
+
return n.replace(Ee, "$1-$2").toLowerCase();
|
|
222
|
+
}
|
|
223
|
+
function K(n, t) {
|
|
224
|
+
return J(n[t]) ? n[t] : n.dataset ? n.dataset[t] : n.getAttribute("data-".concat(Tt(t)));
|
|
225
|
+
}
|
|
226
|
+
function bt(n, t, i) {
|
|
227
|
+
J(i) ? n[t] = i : n.dataset ? n.dataset[t] = i : n.setAttribute("data-".concat(Tt(t)), i);
|
|
228
|
+
}
|
|
229
|
+
var te = function() {
|
|
230
|
+
var n = !1;
|
|
231
|
+
if (dt) {
|
|
232
|
+
var t = !1, i = function() {
|
|
233
|
+
}, e = Object.defineProperty({}, "once", {
|
|
234
|
+
get: function() {
|
|
235
|
+
return n = !0, t;
|
|
236
|
+
},
|
|
237
|
+
set: function(r) {
|
|
238
|
+
t = r;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
M.addEventListener("test", i, e), M.removeEventListener("test", i, e);
|
|
242
|
+
}
|
|
243
|
+
return n;
|
|
244
|
+
}();
|
|
245
|
+
function b(n, t, i) {
|
|
246
|
+
var e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, a = i;
|
|
247
|
+
t.trim().split(Et).forEach(function(r) {
|
|
248
|
+
if (!te) {
|
|
249
|
+
var s = n.listeners;
|
|
250
|
+
s && s[r] && s[r][i] && (a = s[r][i], delete s[r][i], Object.keys(s[r]).length === 0 && delete s[r], Object.keys(s).length === 0 && delete n.listeners);
|
|
251
|
+
}
|
|
252
|
+
n.removeEventListener(r, a, e);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function d(n, t, i) {
|
|
256
|
+
var e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, a = i;
|
|
257
|
+
t.trim().split(Et).forEach(function(r) {
|
|
258
|
+
if (e.once && !te) {
|
|
259
|
+
var s = n.listeners, l = s === void 0 ? {} : s;
|
|
260
|
+
a = function() {
|
|
261
|
+
delete l[r][i], n.removeEventListener(r, a, e);
|
|
262
|
+
for (var h = arguments.length, o = new Array(h), c = 0; c < h; c++)
|
|
263
|
+
o[c] = arguments[c];
|
|
264
|
+
i.apply(n, o);
|
|
265
|
+
}, l[r] || (l[r] = {}), l[r][i] && n.removeEventListener(r, l[r][i], e), l[r][i] = a, n.listeners = l;
|
|
266
|
+
}
|
|
267
|
+
n.addEventListener(r, a, e);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function I(n, t, i, e) {
|
|
271
|
+
var a;
|
|
272
|
+
return p(Event) && p(CustomEvent) ? a = new CustomEvent(t, wt({
|
|
273
|
+
bubbles: !0,
|
|
274
|
+
cancelable: !0,
|
|
275
|
+
detail: i
|
|
276
|
+
}, e)) : (a = document.createEvent("CustomEvent"), a.initCustomEvent(t, !0, !0, i)), n.dispatchEvent(a);
|
|
277
|
+
}
|
|
278
|
+
function Te(n) {
|
|
279
|
+
var t = n.getBoundingClientRect();
|
|
280
|
+
return {
|
|
281
|
+
left: t.left + (window.pageXOffset - document.documentElement.clientLeft),
|
|
282
|
+
top: t.top + (window.pageYOffset - document.documentElement.clientTop)
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function ct(n) {
|
|
286
|
+
var t = n.rotate, i = n.scaleX, e = n.scaleY, a = n.translateX, r = n.translateY, s = [];
|
|
287
|
+
T(a) && a !== 0 && s.push("translateX(".concat(a, "px)")), T(r) && r !== 0 && s.push("translateY(".concat(r, "px)")), T(t) && t !== 0 && s.push("rotate(".concat(t, "deg)")), T(i) && i !== 1 && s.push("scaleX(".concat(i, ")")), T(e) && e !== 1 && s.push("scaleY(".concat(e, ")"));
|
|
288
|
+
var l = s.length ? s.join(" ") : "none";
|
|
289
|
+
return {
|
|
290
|
+
WebkitTransform: l,
|
|
291
|
+
msTransform: l,
|
|
292
|
+
transform: l
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function Se(n) {
|
|
296
|
+
return nt(n) ? decodeURIComponent(n.replace(/^.*\//, "").replace(/[?&#].*$/, "")) : "";
|
|
297
|
+
}
|
|
298
|
+
var mt = M.navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(M.navigator.userAgent);
|
|
299
|
+
function ee(n, t, i) {
|
|
300
|
+
var e = document.createElement("img");
|
|
301
|
+
if (n.naturalWidth && !mt)
|
|
302
|
+
return i(n.naturalWidth, n.naturalHeight), e;
|
|
303
|
+
var a = document.body || document.documentElement;
|
|
304
|
+
return e.onload = function() {
|
|
305
|
+
i(e.width, e.height), mt || a.removeChild(e);
|
|
306
|
+
}, w(t.inheritedAttributes, function(r) {
|
|
307
|
+
var s = n.getAttribute(r);
|
|
308
|
+
s !== null && e.setAttribute(r, s);
|
|
309
|
+
}), e.src = n.src, mt || (e.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;", a.appendChild(e)), e;
|
|
310
|
+
}
|
|
311
|
+
function ot(n) {
|
|
312
|
+
switch (n) {
|
|
313
|
+
case 2:
|
|
314
|
+
return fe;
|
|
315
|
+
case 3:
|
|
316
|
+
return ce;
|
|
317
|
+
case 4:
|
|
318
|
+
return ue;
|
|
319
|
+
default:
|
|
320
|
+
return "";
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function De(n) {
|
|
324
|
+
var t = wt({}, n), i = [];
|
|
325
|
+
return w(n, function(e, a) {
|
|
326
|
+
delete t[a], w(t, function(r) {
|
|
327
|
+
var s = Math.abs(e.startX - r.startX), l = Math.abs(e.startY - r.startY), u = Math.abs(e.endX - r.endX), h = Math.abs(e.endY - r.endY), o = Math.sqrt(s * s + l * l), c = Math.sqrt(u * u + h * h), g = (c - o) / o;
|
|
328
|
+
i.push(g);
|
|
329
|
+
});
|
|
330
|
+
}), i.sort(function(e, a) {
|
|
331
|
+
return Math.abs(e) < Math.abs(a);
|
|
332
|
+
}), i[0];
|
|
333
|
+
}
|
|
334
|
+
function lt(n, t) {
|
|
335
|
+
var i = n.pageX, e = n.pageY, a = {
|
|
336
|
+
endX: i,
|
|
337
|
+
endY: e
|
|
338
|
+
};
|
|
339
|
+
return t ? a : wt({
|
|
340
|
+
timeStamp: Date.now(),
|
|
341
|
+
startX: i,
|
|
342
|
+
startY: e
|
|
343
|
+
}, a);
|
|
344
|
+
}
|
|
345
|
+
function xe(n) {
|
|
346
|
+
var t = 0, i = 0, e = 0;
|
|
347
|
+
return w(n, function(a) {
|
|
348
|
+
var r = a.startX, s = a.startY;
|
|
349
|
+
t += r, i += s, e += 1;
|
|
350
|
+
}), t /= e, i /= e, {
|
|
351
|
+
pageX: t,
|
|
352
|
+
pageY: i
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
var Ie = {
|
|
356
|
+
render: function() {
|
|
357
|
+
this.initContainer(), this.initViewer(), this.initList(), this.renderViewer();
|
|
358
|
+
},
|
|
359
|
+
initBody: function() {
|
|
360
|
+
var t = this.element.ownerDocument, i = t.body || t.documentElement;
|
|
361
|
+
this.body = i, this.scrollbarWidth = window.innerWidth - t.documentElement.clientWidth, this.initialBodyPaddingRight = i.style.paddingRight, this.initialBodyComputedPaddingRight = window.getComputedStyle(i).paddingRight;
|
|
362
|
+
},
|
|
363
|
+
initContainer: function() {
|
|
364
|
+
this.containerData = {
|
|
365
|
+
width: window.innerWidth,
|
|
366
|
+
height: window.innerHeight
|
|
367
|
+
};
|
|
368
|
+
},
|
|
369
|
+
initViewer: function() {
|
|
370
|
+
var t = this.options, i = this.parent, e;
|
|
371
|
+
t.inline && (e = {
|
|
372
|
+
width: Math.max(i.offsetWidth, t.minWidth),
|
|
373
|
+
height: Math.max(i.offsetHeight, t.minHeight)
|
|
374
|
+
}, this.parentData = e), (this.fulled || !e) && (e = this.containerData), this.viewerData = O({}, e);
|
|
375
|
+
},
|
|
376
|
+
renderViewer: function() {
|
|
377
|
+
this.options.inline && !this.fulled && L(this.viewer, this.viewerData);
|
|
378
|
+
},
|
|
379
|
+
initList: function() {
|
|
380
|
+
var t = this, i = this.element, e = this.options, a = this.list, r = [];
|
|
381
|
+
a.innerHTML = "", w(this.images, function(s, l) {
|
|
382
|
+
var u = s.src, h = s.alt || Se(u), o = t.getImageURL(s);
|
|
383
|
+
if (u || o) {
|
|
384
|
+
var c = document.createElement("li"), g = document.createElement("img");
|
|
385
|
+
w(e.inheritedAttributes, function(x) {
|
|
386
|
+
var S = s.getAttribute(x);
|
|
387
|
+
S !== null && g.setAttribute(x, S);
|
|
388
|
+
}), e.navbar && (g.src = u || o), g.alt = h, g.setAttribute("data-original-url", o || u), c.setAttribute("data-index", l), c.setAttribute("data-viewer-action", "view"), c.setAttribute("role", "button"), e.keyboard && c.setAttribute("tabindex", 0), c.appendChild(g), a.appendChild(c), r.push(c);
|
|
389
|
+
}
|
|
390
|
+
}), this.items = r, w(r, function(s) {
|
|
391
|
+
var l = s.firstElementChild, u, h;
|
|
392
|
+
bt(l, "filled", !0), e.loading && f(s, $), d(l, z, u = function(c) {
|
|
393
|
+
b(l, X, h), e.loading && v(s, $), t.loadImage(c);
|
|
394
|
+
}, {
|
|
395
|
+
once: !0
|
|
396
|
+
}), d(l, X, h = function() {
|
|
397
|
+
b(l, z, u), e.loading && v(s, $);
|
|
398
|
+
}, {
|
|
399
|
+
once: !0
|
|
400
|
+
});
|
|
401
|
+
}), e.transition && d(i, it, function() {
|
|
402
|
+
f(a, D);
|
|
403
|
+
}, {
|
|
404
|
+
once: !0
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
renderList: function() {
|
|
408
|
+
var t = this.index, i = this.items[t];
|
|
409
|
+
if (i) {
|
|
410
|
+
var e = i.nextElementSibling, a = parseInt(window.getComputedStyle(e || i).marginLeft, 10), r = i.offsetWidth, s = r + a;
|
|
411
|
+
L(this.list, O({
|
|
412
|
+
width: s * this.length - a
|
|
413
|
+
}, ct({
|
|
414
|
+
translateX: (this.viewerData.width - r) / 2 - s * t
|
|
415
|
+
})));
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
resetList: function() {
|
|
419
|
+
var t = this.list;
|
|
420
|
+
t.innerHTML = "", v(t, D), L(t, ct({
|
|
421
|
+
translateX: 0
|
|
422
|
+
}));
|
|
423
|
+
},
|
|
424
|
+
initImage: function(t) {
|
|
425
|
+
var i = this, e = this.options, a = this.image, r = this.viewerData, s = this.footer.offsetHeight, l = r.width, u = Math.max(r.height - s, s), h = this.imageData || {}, o;
|
|
426
|
+
this.imageInitializing = {
|
|
427
|
+
abort: function() {
|
|
428
|
+
o.onload = null;
|
|
429
|
+
}
|
|
430
|
+
}, o = ee(a, e, function(c, g) {
|
|
431
|
+
var x = c / g, S = Math.max(0, Math.min(1, e.initialCoverage)), E = l, _ = u;
|
|
432
|
+
i.imageInitializing = !1, u * x > l ? _ = l / x : E = u * x, S = T(S) ? S : 0.9, E = Math.min(E * S, c), _ = Math.min(_ * S, g);
|
|
433
|
+
var A = (l - E) / 2, N = (u - _) / 2, y = {
|
|
434
|
+
left: A,
|
|
435
|
+
top: N,
|
|
436
|
+
x: A,
|
|
437
|
+
y: N,
|
|
438
|
+
width: E,
|
|
439
|
+
height: _,
|
|
440
|
+
oldRatio: 1,
|
|
441
|
+
ratio: E / c,
|
|
442
|
+
aspectRatio: x,
|
|
443
|
+
naturalWidth: c,
|
|
444
|
+
naturalHeight: g
|
|
445
|
+
}, V = O({}, y);
|
|
446
|
+
e.rotatable && (y.rotate = h.rotate || 0, V.rotate = 0), e.scalable && (y.scaleX = h.scaleX || 1, y.scaleY = h.scaleY || 1, V.scaleX = 1, V.scaleY = 1), i.imageData = y, i.initialImageData = V, t && t();
|
|
447
|
+
});
|
|
448
|
+
},
|
|
449
|
+
renderImage: function(t) {
|
|
450
|
+
var i = this, e = this.image, a = this.imageData;
|
|
451
|
+
if (L(e, O({
|
|
452
|
+
width: a.width,
|
|
453
|
+
height: a.height,
|
|
454
|
+
marginLeft: a.x,
|
|
455
|
+
marginTop: a.y
|
|
456
|
+
}, ct(a))), t)
|
|
457
|
+
if ((this.viewing || this.moving || this.rotating || this.scaling || this.zooming) && this.options.transition && U(e, D)) {
|
|
458
|
+
var r = function() {
|
|
459
|
+
i.imageRendering = !1, t();
|
|
460
|
+
};
|
|
461
|
+
this.imageRendering = {
|
|
462
|
+
abort: function() {
|
|
463
|
+
b(e, k, r);
|
|
464
|
+
}
|
|
465
|
+
}, d(e, k, r, {
|
|
466
|
+
once: !0
|
|
467
|
+
});
|
|
468
|
+
} else
|
|
469
|
+
t();
|
|
470
|
+
},
|
|
471
|
+
resetImage: function() {
|
|
472
|
+
if (this.viewing || this.viewed) {
|
|
473
|
+
var t = this.image;
|
|
474
|
+
this.viewing && this.viewing.abort(), t.parentNode.removeChild(t), this.image = null;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}, _e = {
|
|
478
|
+
bind: function() {
|
|
479
|
+
var t = this.options, i = this.viewer, e = this.canvas, a = this.element.ownerDocument;
|
|
480
|
+
d(i, G, this.onClick = this.click.bind(this)), d(i, At, this.onDragStart = this.dragstart.bind(this)), d(e, Ct, this.onPointerDown = this.pointerdown.bind(this)), d(a, zt, this.onPointerMove = this.pointermove.bind(this)), d(a, kt, this.onPointerUp = this.pointerup.bind(this)), d(a, Ot, this.onKeyDown = this.keydown.bind(this)), d(window, Lt, this.onResize = this.resize.bind(this)), t.zoomable && t.zoomOnWheel && d(i, Rt, this.onWheel = this.wheel.bind(this), {
|
|
481
|
+
passive: !1,
|
|
482
|
+
capture: !0
|
|
483
|
+
}), t.toggleOnDblclick && d(e, pt, this.onDblclick = this.dblclick.bind(this));
|
|
484
|
+
},
|
|
485
|
+
unbind: function() {
|
|
486
|
+
var t = this.options, i = this.viewer, e = this.canvas, a = this.element.ownerDocument;
|
|
487
|
+
b(i, G, this.onClick), b(i, At, this.onDragStart), b(e, Ct, this.onPointerDown), b(a, zt, this.onPointerMove), b(a, kt, this.onPointerUp), b(a, Ot, this.onKeyDown), b(window, Lt, this.onResize), t.zoomable && t.zoomOnWheel && b(i, Rt, this.onWheel, {
|
|
488
|
+
passive: !1,
|
|
489
|
+
capture: !0
|
|
490
|
+
}), t.toggleOnDblclick && b(e, pt, this.onDblclick);
|
|
491
|
+
}
|
|
492
|
+
}, Ae = {
|
|
493
|
+
click: function(t) {
|
|
494
|
+
var i = this.options, e = this.imageData, a = t.target, r = K(a, ft);
|
|
495
|
+
switch (!r && a.localName === "img" && a.parentElement.localName === "li" && (a = a.parentElement, r = K(a, ft)), Z && t.isTrusted && a === this.canvas && clearTimeout(this.clickCanvasTimeout), r) {
|
|
496
|
+
case "mix":
|
|
497
|
+
this.played ? this.stop() : i.inline ? this.fulled ? this.exit() : this.full() : this.hide();
|
|
498
|
+
break;
|
|
499
|
+
case "hide":
|
|
500
|
+
this.hide();
|
|
501
|
+
break;
|
|
502
|
+
case "view":
|
|
503
|
+
this.view(K(a, "index"));
|
|
504
|
+
break;
|
|
505
|
+
case "zoom-in":
|
|
506
|
+
this.zoom(0.1, !0);
|
|
507
|
+
break;
|
|
508
|
+
case "zoom-out":
|
|
509
|
+
this.zoom(-0.1, !0);
|
|
510
|
+
break;
|
|
511
|
+
case "one-to-one":
|
|
512
|
+
this.toggle();
|
|
513
|
+
break;
|
|
514
|
+
case "reset":
|
|
515
|
+
this.reset();
|
|
516
|
+
break;
|
|
517
|
+
case "prev":
|
|
518
|
+
this.prev(i.loop);
|
|
519
|
+
break;
|
|
520
|
+
case "play":
|
|
521
|
+
this.play(i.fullscreen);
|
|
522
|
+
break;
|
|
523
|
+
case "next":
|
|
524
|
+
this.next(i.loop);
|
|
525
|
+
break;
|
|
526
|
+
case "rotate-left":
|
|
527
|
+
this.rotate(-90);
|
|
528
|
+
break;
|
|
529
|
+
case "rotate-right":
|
|
530
|
+
this.rotate(90);
|
|
531
|
+
break;
|
|
532
|
+
case "flip-horizontal":
|
|
533
|
+
this.scaleX(-e.scaleX || -1);
|
|
534
|
+
break;
|
|
535
|
+
case "flip-vertical":
|
|
536
|
+
this.scaleY(-e.scaleY || -1);
|
|
537
|
+
break;
|
|
538
|
+
default:
|
|
539
|
+
this.played && this.stop();
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
dblclick: function(t) {
|
|
543
|
+
t.preventDefault(), this.viewed && t.target === this.image && (Z && t.isTrusted && clearTimeout(this.doubleClickImageTimeout), this.toggle(t.isTrusted ? t : t.detail && t.detail.originalEvent));
|
|
544
|
+
},
|
|
545
|
+
load: function() {
|
|
546
|
+
var t = this;
|
|
547
|
+
this.timeout && (clearTimeout(this.timeout), this.timeout = !1);
|
|
548
|
+
var i = this.element, e = this.options, a = this.image, r = this.index, s = this.viewerData;
|
|
549
|
+
v(a, et), e.loading && v(this.canvas, $), a.style.cssText = "height:0;" + "margin-left:".concat(s.width / 2, "px;") + "margin-top:".concat(s.height / 2, "px;") + "max-width:none!important;position:relative;width:0;", this.initImage(function() {
|
|
550
|
+
at(a, de, e.movable), at(a, D, e.transition), t.renderImage(function() {
|
|
551
|
+
t.viewed = !0, t.viewing = !1, p(e.viewed) && d(i, it, e.viewed, {
|
|
552
|
+
once: !0
|
|
553
|
+
}), I(i, it, {
|
|
554
|
+
originalImage: t.images[r],
|
|
555
|
+
index: r,
|
|
556
|
+
image: a
|
|
557
|
+
}, {
|
|
558
|
+
cancelable: !1
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
},
|
|
563
|
+
loadImage: function(t) {
|
|
564
|
+
var i = t.target, e = i.parentNode, a = e.offsetWidth || 30, r = e.offsetHeight || 50, s = !!K(i, "filled");
|
|
565
|
+
ee(i, this.options, function(l, u) {
|
|
566
|
+
var h = l / u, o = a, c = r;
|
|
567
|
+
r * h > a ? s ? o = r * h : c = a / h : s ? c = a / h : o = r * h, L(i, O({
|
|
568
|
+
width: o,
|
|
569
|
+
height: c
|
|
570
|
+
}, ct({
|
|
571
|
+
translateX: (a - o) / 2,
|
|
572
|
+
translateY: (r - c) / 2
|
|
573
|
+
})));
|
|
574
|
+
});
|
|
575
|
+
},
|
|
576
|
+
keydown: function(t) {
|
|
577
|
+
var i = this.options;
|
|
578
|
+
if (i.keyboard) {
|
|
579
|
+
var e = t.keyCode || t.which || t.charCode;
|
|
580
|
+
switch (e) {
|
|
581
|
+
case 13:
|
|
582
|
+
this.viewer.contains(t.target) && this.click(t);
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
if (this.fulled)
|
|
586
|
+
switch (e) {
|
|
587
|
+
case 27:
|
|
588
|
+
this.played ? this.stop() : i.inline ? this.fulled && this.exit() : this.hide();
|
|
589
|
+
break;
|
|
590
|
+
case 32:
|
|
591
|
+
this.played && this.stop();
|
|
592
|
+
break;
|
|
593
|
+
case 37:
|
|
594
|
+
this.played && this.playing ? this.playing.prev() : this.prev(i.loop);
|
|
595
|
+
break;
|
|
596
|
+
case 38:
|
|
597
|
+
t.preventDefault(), this.zoom(i.zoomRatio, !0);
|
|
598
|
+
break;
|
|
599
|
+
case 39:
|
|
600
|
+
this.played && this.playing ? this.playing.next() : this.next(i.loop);
|
|
601
|
+
break;
|
|
602
|
+
case 40:
|
|
603
|
+
t.preventDefault(), this.zoom(-i.zoomRatio, !0);
|
|
604
|
+
break;
|
|
605
|
+
case 48:
|
|
606
|
+
case 49:
|
|
607
|
+
t.ctrlKey && (t.preventDefault(), this.toggle());
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
dragstart: function(t) {
|
|
613
|
+
t.target.localName === "img" && t.preventDefault();
|
|
614
|
+
},
|
|
615
|
+
pointerdown: function(t) {
|
|
616
|
+
var i = this.options, e = this.pointers, a = t.buttons, r = t.button;
|
|
617
|
+
if (!(!this.viewed || this.showing || this.viewing || this.hiding || (t.type === "mousedown" || t.type === "pointerdown" && t.pointerType === "mouse") && (T(a) && a !== 1 || T(r) && r !== 0 || t.ctrlKey))) {
|
|
618
|
+
t.preventDefault(), t.changedTouches ? w(t.changedTouches, function(l) {
|
|
619
|
+
e[l.identifier] = lt(l);
|
|
620
|
+
}) : e[t.pointerId || 0] = lt(t);
|
|
621
|
+
var s = i.movable ? ht : !1;
|
|
622
|
+
i.zoomOnTouch && i.zoomable && Object.keys(e).length > 1 ? s = tt : i.slideOnTouch && (t.pointerType === "touch" || t.type === "touchstart") && this.isSwitchable() && (s = Qt), i.transition && (s === ht || s === tt) && v(this.image, D), this.action = s;
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
pointermove: function(t) {
|
|
626
|
+
var i = this.pointers, e = this.action;
|
|
627
|
+
!this.viewed || !e || (t.preventDefault(), t.changedTouches ? w(t.changedTouches, function(a) {
|
|
628
|
+
O(i[a.identifier] || {}, lt(a, !0));
|
|
629
|
+
}) : O(i[t.pointerId || 0] || {}, lt(t, !0)), this.change(t));
|
|
630
|
+
},
|
|
631
|
+
pointerup: function(t) {
|
|
632
|
+
var i = this, e = this.options, a = this.action, r = this.pointers, s;
|
|
633
|
+
t.changedTouches ? w(t.changedTouches, function(l) {
|
|
634
|
+
s = r[l.identifier], delete r[l.identifier];
|
|
635
|
+
}) : (s = r[t.pointerId || 0], delete r[t.pointerId || 0]), a && (t.preventDefault(), e.transition && (a === ht || a === tt) && f(this.image, D), this.action = !1, Z && a !== tt && s && Date.now() - s.timeStamp < 500 && (clearTimeout(this.clickCanvasTimeout), clearTimeout(this.doubleClickImageTimeout), e.toggleOnDblclick && this.viewed && t.target === this.image ? this.imageClicked ? (this.imageClicked = !1, this.doubleClickImageTimeout = setTimeout(function() {
|
|
636
|
+
I(i.image, pt, {
|
|
637
|
+
originalEvent: t
|
|
638
|
+
});
|
|
639
|
+
}, 50)) : (this.imageClicked = !0, this.doubleClickImageTimeout = setTimeout(function() {
|
|
640
|
+
i.imageClicked = !1;
|
|
641
|
+
}, 500)) : (this.imageClicked = !1, e.backdrop && e.backdrop !== "static" && t.target === this.canvas && (this.clickCanvasTimeout = setTimeout(function() {
|
|
642
|
+
I(i.canvas, G, {
|
|
643
|
+
originalEvent: t
|
|
644
|
+
});
|
|
645
|
+
}, 50)))));
|
|
646
|
+
},
|
|
647
|
+
resize: function() {
|
|
648
|
+
var t = this;
|
|
649
|
+
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() {
|
|
650
|
+
t.renderImage();
|
|
651
|
+
}), this.played)) {
|
|
652
|
+
if (this.options.fullscreen && this.fulled && !(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement)) {
|
|
653
|
+
this.stop();
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
w(this.player.getElementsByTagName("img"), function(i) {
|
|
657
|
+
d(i, z, t.loadImage.bind(t), {
|
|
658
|
+
once: !0
|
|
659
|
+
}), I(i, z);
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
wheel: function(t) {
|
|
664
|
+
var i = this;
|
|
665
|
+
if (this.viewed && (t.preventDefault(), !this.wheeling)) {
|
|
666
|
+
this.wheeling = !0, setTimeout(function() {
|
|
667
|
+
i.wheeling = !1;
|
|
668
|
+
}, 50);
|
|
669
|
+
var e = Number(this.options.zoomRatio) || 0.1, a = 1;
|
|
670
|
+
t.deltaY ? a = t.deltaY > 0 ? 1 : -1 : t.wheelDelta ? a = -t.wheelDelta / 120 : t.detail && (a = t.detail > 0 ? 1 : -1), this.zoom(-a * e, !0, null, t);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}, Ne = {
|
|
674
|
+
show: function() {
|
|
675
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.element, e = this.options;
|
|
676
|
+
if (e.inline || this.showing || this.isShown || this.showing)
|
|
677
|
+
return this;
|
|
678
|
+
if (!this.ready)
|
|
679
|
+
return this.build(), this.ready && this.show(t), this;
|
|
680
|
+
if (p(e.show) && d(i, Ft, e.show, {
|
|
681
|
+
once: !0
|
|
682
|
+
}), I(i, Ft) === !1 || !this.ready)
|
|
683
|
+
return this;
|
|
684
|
+
this.hiding && this.transitioning.abort(), this.showing = !0, this.open();
|
|
685
|
+
var a = this.viewer;
|
|
686
|
+
if (v(a, W), a.setAttribute("role", "dialog"), a.setAttribute("aria-labelledby", this.title.id), a.setAttribute("aria-modal", !0), a.removeAttribute("aria-hidden"), e.transition && !t) {
|
|
687
|
+
var r = this.shown.bind(this);
|
|
688
|
+
this.transitioning = {
|
|
689
|
+
abort: function() {
|
|
690
|
+
b(a, k, r), v(a, C);
|
|
691
|
+
}
|
|
692
|
+
}, f(a, D), a.initialOffsetWidth = a.offsetWidth, d(a, k, r, {
|
|
693
|
+
once: !0
|
|
694
|
+
}), f(a, C);
|
|
695
|
+
} else
|
|
696
|
+
f(a, C), this.shown();
|
|
697
|
+
return this;
|
|
698
|
+
},
|
|
699
|
+
hide: function() {
|
|
700
|
+
var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.element, a = this.options;
|
|
701
|
+
if (a.inline || this.hiding || !(this.isShown || this.showing))
|
|
702
|
+
return this;
|
|
703
|
+
if (p(a.hide) && d(e, Pt, a.hide, {
|
|
704
|
+
once: !0
|
|
705
|
+
}), I(e, Pt) === !1)
|
|
706
|
+
return this;
|
|
707
|
+
this.showing && this.transitioning.abort(), this.hiding = !0, this.played ? this.stop() : this.viewing && this.viewing.abort();
|
|
708
|
+
var r = this.viewer, s = this.image, l = function() {
|
|
709
|
+
v(r, C), t.hidden();
|
|
710
|
+
};
|
|
711
|
+
if (a.transition && !i) {
|
|
712
|
+
var u = function o(c) {
|
|
713
|
+
c && c.target === r && (b(r, k, o), t.hidden());
|
|
714
|
+
}, h = function() {
|
|
715
|
+
U(r, D) ? (d(r, k, u), v(r, C)) : l();
|
|
716
|
+
};
|
|
717
|
+
this.transitioning = {
|
|
718
|
+
abort: function() {
|
|
719
|
+
t.viewed && U(s, D) ? b(s, k, h) : U(r, D) && b(r, k, u);
|
|
720
|
+
}
|
|
721
|
+
}, this.viewed && U(s, D) ? (d(s, k, h, {
|
|
722
|
+
once: !0
|
|
723
|
+
}), this.zoomTo(0, !1, null, null, !0)) : h();
|
|
724
|
+
} else
|
|
725
|
+
l();
|
|
726
|
+
return this;
|
|
727
|
+
},
|
|
728
|
+
view: function() {
|
|
729
|
+
var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.initialViewIndex;
|
|
730
|
+
if (i = Number(i) || 0, this.hiding || this.played || i < 0 || i >= this.length || this.viewed && i === this.index)
|
|
731
|
+
return this;
|
|
732
|
+
if (!this.isShown)
|
|
733
|
+
return this.index = i, this.show();
|
|
734
|
+
this.viewing && this.viewing.abort();
|
|
735
|
+
var e = this.element, a = this.options, r = this.title, s = this.canvas, l = this.items[i], u = l.querySelector("img"), h = K(u, "originalUrl"), o = u.getAttribute("alt"), c = document.createElement("img");
|
|
736
|
+
if (w(a.inheritedAttributes, function(_) {
|
|
737
|
+
var A = u.getAttribute(_);
|
|
738
|
+
A !== null && c.setAttribute(_, A);
|
|
739
|
+
}), c.src = h, c.alt = o, p(a.view) && d(e, Wt, a.view, {
|
|
740
|
+
once: !0
|
|
741
|
+
}), I(e, Wt, {
|
|
742
|
+
originalImage: this.images[i],
|
|
743
|
+
index: i,
|
|
744
|
+
image: c
|
|
745
|
+
}) === !1 || !this.isShown || this.hiding || this.played)
|
|
746
|
+
return this;
|
|
747
|
+
var g = this.items[this.index];
|
|
748
|
+
g && (v(g, rt), g.removeAttribute("aria-selected")), f(l, rt), l.setAttribute("aria-selected", !0), a.focus && l.focus(), this.image = c, this.viewed = !1, this.index = i, this.imageData = {}, f(c, et), a.loading && f(s, $), s.innerHTML = "", s.appendChild(c), this.renderList(), r.innerHTML = "";
|
|
749
|
+
var x = function() {
|
|
750
|
+
var A = t.imageData, N = Array.isArray(a.title) ? a.title[1] : a.title;
|
|
751
|
+
r.innerHTML = ye(p(N) ? N.call(t, c, A) : "".concat(o, " (").concat(A.naturalWidth, " × ").concat(A.naturalHeight, ")"));
|
|
752
|
+
}, S, E;
|
|
753
|
+
return d(e, it, x, {
|
|
754
|
+
once: !0
|
|
755
|
+
}), this.viewing = {
|
|
756
|
+
abort: function() {
|
|
757
|
+
b(e, it, x), c.complete ? t.imageRendering ? t.imageRendering.abort() : t.imageInitializing && t.imageInitializing.abort() : (c.src = "", b(c, z, S), t.timeout && clearTimeout(t.timeout));
|
|
758
|
+
}
|
|
759
|
+
}, c.complete ? this.load() : (d(c, z, S = function() {
|
|
760
|
+
b(c, X, E), t.load();
|
|
761
|
+
}, {
|
|
762
|
+
once: !0
|
|
763
|
+
}), d(c, X, E = function() {
|
|
764
|
+
b(c, z, S), t.timeout && (clearTimeout(t.timeout), t.timeout = !1), v(c, et), a.loading && v(t.canvas, $);
|
|
765
|
+
}, {
|
|
766
|
+
once: !0
|
|
767
|
+
}), this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(function() {
|
|
768
|
+
v(c, et), t.timeout = !1;
|
|
769
|
+
}, 1e3)), this;
|
|
770
|
+
},
|
|
771
|
+
prev: function() {
|
|
772
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.index - 1;
|
|
773
|
+
return i < 0 && (i = t ? this.length - 1 : 0), this.view(i), this;
|
|
774
|
+
},
|
|
775
|
+
next: function() {
|
|
776
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.length - 1, e = this.index + 1;
|
|
777
|
+
return e > i && (e = t ? 0 : i), this.view(e), this;
|
|
778
|
+
},
|
|
779
|
+
move: function(t) {
|
|
780
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, e = this.imageData;
|
|
781
|
+
return this.moveTo(B(t) ? t : e.x + Number(t), B(i) ? i : e.y + Number(i)), this;
|
|
782
|
+
},
|
|
783
|
+
moveTo: function(t) {
|
|
784
|
+
var i = this, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, r = this.element, s = this.options, l = this.imageData;
|
|
785
|
+
if (t = Number(t), e = Number(e), this.viewed && !this.played && s.movable) {
|
|
786
|
+
var u = l.x, h = l.y, o = !1;
|
|
787
|
+
if (T(t) ? o = !0 : t = u, T(e) ? o = !0 : e = h, o) {
|
|
788
|
+
if (p(s.move) && d(r, Xt, s.move, {
|
|
789
|
+
once: !0
|
|
790
|
+
}), I(r, Xt, {
|
|
791
|
+
x: t,
|
|
792
|
+
y: e,
|
|
793
|
+
oldX: u,
|
|
794
|
+
oldY: h,
|
|
795
|
+
originalEvent: a
|
|
796
|
+
}) === !1)
|
|
797
|
+
return this;
|
|
798
|
+
l.x = t, l.y = e, l.left = t, l.top = e, this.moving = !0, this.renderImage(function() {
|
|
799
|
+
i.moving = !1, p(s.moved) && d(r, Ht, s.moved, {
|
|
800
|
+
once: !0
|
|
801
|
+
}), I(r, Ht, {
|
|
802
|
+
x: t,
|
|
803
|
+
y: e,
|
|
804
|
+
oldX: u,
|
|
805
|
+
oldY: h,
|
|
806
|
+
originalEvent: a
|
|
807
|
+
}, {
|
|
808
|
+
cancelable: !1
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return this;
|
|
814
|
+
},
|
|
815
|
+
rotate: function(t) {
|
|
816
|
+
return this.rotateTo((this.imageData.rotate || 0) + Number(t)), this;
|
|
817
|
+
},
|
|
818
|
+
rotateTo: function(t) {
|
|
819
|
+
var i = this, e = this.element, a = this.options, r = this.imageData;
|
|
820
|
+
if (t = Number(t), T(t) && this.viewed && !this.played && a.rotatable) {
|
|
821
|
+
var s = r.rotate;
|
|
822
|
+
if (p(a.rotate) && d(e, qt, a.rotate, {
|
|
823
|
+
once: !0
|
|
824
|
+
}), I(e, qt, {
|
|
825
|
+
degree: t,
|
|
826
|
+
oldDegree: s
|
|
827
|
+
}) === !1)
|
|
828
|
+
return this;
|
|
829
|
+
r.rotate = t, this.rotating = !0, this.renderImage(function() {
|
|
830
|
+
i.rotating = !1, p(a.rotated) && d(e, Ut, a.rotated, {
|
|
831
|
+
once: !0
|
|
832
|
+
}), I(e, Ut, {
|
|
833
|
+
degree: t,
|
|
834
|
+
oldDegree: s
|
|
835
|
+
}, {
|
|
836
|
+
cancelable: !1
|
|
837
|
+
});
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
return this;
|
|
841
|
+
},
|
|
842
|
+
scaleX: function(t) {
|
|
843
|
+
return this.scale(t, this.imageData.scaleY), this;
|
|
844
|
+
},
|
|
845
|
+
scaleY: function(t) {
|
|
846
|
+
return this.scale(this.imageData.scaleX, t), this;
|
|
847
|
+
},
|
|
848
|
+
scale: function(t) {
|
|
849
|
+
var i = this, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, a = this.element, r = this.options, s = this.imageData;
|
|
850
|
+
if (t = Number(t), e = Number(e), this.viewed && !this.played && r.scalable) {
|
|
851
|
+
var l = s.scaleX, u = s.scaleY, h = !1;
|
|
852
|
+
if (T(t) ? h = !0 : t = l, T(e) ? h = !0 : e = u, h) {
|
|
853
|
+
if (p(r.scale) && d(a, Bt, r.scale, {
|
|
854
|
+
once: !0
|
|
855
|
+
}), I(a, Bt, {
|
|
856
|
+
scaleX: t,
|
|
857
|
+
scaleY: e,
|
|
858
|
+
oldScaleX: l,
|
|
859
|
+
oldScaleY: u
|
|
860
|
+
}) === !1)
|
|
861
|
+
return this;
|
|
862
|
+
s.scaleX = t, s.scaleY = e, this.scaling = !0, this.renderImage(function() {
|
|
863
|
+
i.scaling = !1, p(r.scaled) && d(a, jt, r.scaled, {
|
|
864
|
+
once: !0
|
|
865
|
+
}), I(a, jt, {
|
|
866
|
+
scaleX: t,
|
|
867
|
+
scaleY: e,
|
|
868
|
+
oldScaleX: l,
|
|
869
|
+
oldScaleY: u
|
|
870
|
+
}, {
|
|
871
|
+
cancelable: !1
|
|
872
|
+
});
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
return this;
|
|
877
|
+
},
|
|
878
|
+
zoom: function(t) {
|
|
879
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, r = this.imageData;
|
|
880
|
+
return t = Number(t), t < 0 ? t = 1 / (1 - t) : t = 1 + t, this.zoomTo(r.width * t / r.naturalWidth, i, e, a), this;
|
|
881
|
+
},
|
|
882
|
+
zoomTo: function(t) {
|
|
883
|
+
var i = this, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1, l = this.element, u = this.options, h = this.pointers, o = this.imageData, c = o.x, g = o.y, x = o.width, S = o.height, E = o.naturalWidth, _ = o.naturalHeight;
|
|
884
|
+
if (t = Math.max(0, t), T(t) && this.viewed && !this.played && (s || u.zoomable)) {
|
|
885
|
+
if (!s) {
|
|
886
|
+
var A = Math.max(0.01, u.minZoomRatio), N = Math.min(100, u.maxZoomRatio);
|
|
887
|
+
t = Math.min(Math.max(t, A), N);
|
|
888
|
+
}
|
|
889
|
+
if (r)
|
|
890
|
+
switch (r.type) {
|
|
891
|
+
case "wheel":
|
|
892
|
+
u.zoomRatio >= 0.055 && t > 0.95 && t < 1.05 && (t = 1);
|
|
893
|
+
break;
|
|
894
|
+
case "pointermove":
|
|
895
|
+
case "touchmove":
|
|
896
|
+
case "mousemove":
|
|
897
|
+
t > 0.99 && t < 1.01 && (t = 1);
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
var y = E * t, V = _ * t, P = y - x, R = V - S, Y = o.ratio;
|
|
901
|
+
if (p(u.zoom) && d(l, Kt, u.zoom, {
|
|
902
|
+
once: !0
|
|
903
|
+
}), I(l, Kt, {
|
|
904
|
+
ratio: t,
|
|
905
|
+
oldRatio: Y,
|
|
906
|
+
originalEvent: r
|
|
907
|
+
}) === !1)
|
|
908
|
+
return this;
|
|
909
|
+
if (this.zooming = !0, r) {
|
|
910
|
+
var Q = Te(this.viewer), H = h && Object.keys(h).length > 0 ? xe(h) : {
|
|
911
|
+
pageX: r.pageX,
|
|
912
|
+
pageY: r.pageY
|
|
913
|
+
};
|
|
914
|
+
o.x -= P * ((H.pageX - Q.left - c) / x), o.y -= R * ((H.pageY - Q.top - g) / S);
|
|
915
|
+
} else
|
|
916
|
+
j(a) && T(a.x) && T(a.y) ? (o.x -= P * ((a.x - c) / x), o.y -= R * ((a.y - g) / S)) : (o.x -= P / 2, o.y -= R / 2);
|
|
917
|
+
o.left = o.x, o.top = o.y, o.width = y, o.height = V, o.oldRatio = Y, o.ratio = t, this.renderImage(function() {
|
|
918
|
+
i.zooming = !1, p(u.zoomed) && d(l, Zt, u.zoomed, {
|
|
919
|
+
once: !0
|
|
920
|
+
}), I(l, Zt, {
|
|
921
|
+
ratio: t,
|
|
922
|
+
oldRatio: Y,
|
|
923
|
+
originalEvent: r
|
|
924
|
+
}, {
|
|
925
|
+
cancelable: !1
|
|
926
|
+
});
|
|
927
|
+
}), e && this.tooltip();
|
|
928
|
+
}
|
|
929
|
+
return this;
|
|
930
|
+
},
|
|
931
|
+
play: function() {
|
|
932
|
+
var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
|
|
933
|
+
if (!this.isShown || this.played)
|
|
934
|
+
return this;
|
|
935
|
+
var e = this.element, a = this.options;
|
|
936
|
+
if (p(a.play) && d(e, $t, a.play, {
|
|
937
|
+
once: !0
|
|
938
|
+
}), I(e, $t) === !1)
|
|
939
|
+
return this;
|
|
940
|
+
var r = this.player, s = this.loadImage.bind(this), l = [], u = 0, h = 0;
|
|
941
|
+
if (this.played = !0, this.onLoadWhenPlay = s, i && this.requestFullscreen(i), f(r, q), w(this.items, function(g, x) {
|
|
942
|
+
var S = g.querySelector("img"), E = document.createElement("img");
|
|
943
|
+
E.src = K(S, "originalUrl"), E.alt = S.getAttribute("alt"), E.referrerPolicy = S.referrerPolicy, u += 1, f(E, ut), at(E, D, a.transition), U(g, rt) && (f(E, C), h = x), l.push(E), d(E, z, s, {
|
|
944
|
+
once: !0
|
|
945
|
+
}), r.appendChild(E);
|
|
946
|
+
}), T(a.interval) && a.interval > 0) {
|
|
947
|
+
var o = function g() {
|
|
948
|
+
clearTimeout(t.playing.timeout), v(l[h], C), h -= 1, h = h >= 0 ? h : u - 1, f(l[h], C), t.playing.timeout = setTimeout(g, a.interval);
|
|
949
|
+
}, c = function g() {
|
|
950
|
+
clearTimeout(t.playing.timeout), v(l[h], C), h += 1, h = h < u ? h : 0, f(l[h], C), t.playing.timeout = setTimeout(g, a.interval);
|
|
951
|
+
};
|
|
952
|
+
u > 1 && (this.playing = {
|
|
953
|
+
prev: o,
|
|
954
|
+
next: c,
|
|
955
|
+
timeout: setTimeout(c, a.interval)
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
return this;
|
|
959
|
+
},
|
|
960
|
+
stop: function() {
|
|
961
|
+
var t = this;
|
|
962
|
+
if (!this.played)
|
|
963
|
+
return this;
|
|
964
|
+
var i = this.element, e = this.options;
|
|
965
|
+
if (p(e.stop) && d(i, Gt, e.stop, {
|
|
966
|
+
once: !0
|
|
967
|
+
}), I(i, Gt) === !1)
|
|
968
|
+
return this;
|
|
969
|
+
var a = this.player;
|
|
970
|
+
return clearTimeout(this.playing.timeout), this.playing = !1, this.played = !1, w(a.getElementsByTagName("img"), function(r) {
|
|
971
|
+
b(r, z, t.onLoadWhenPlay);
|
|
972
|
+
}), v(a, q), a.innerHTML = "", this.exitFullscreen(), this;
|
|
973
|
+
},
|
|
974
|
+
full: function() {
|
|
975
|
+
var t = this, i = this.options, e = this.viewer, a = this.image, r = this.list;
|
|
976
|
+
return !this.isShown || this.played || this.fulled || !i.inline ? this : (this.fulled = !0, this.open(), f(this.button, It), i.transition && (v(r, D), this.viewed && v(a, D)), f(e, vt), e.setAttribute("role", "dialog"), e.setAttribute("aria-labelledby", this.title.id), e.setAttribute("aria-modal", !0), e.removeAttribute("style"), L(e, {
|
|
977
|
+
zIndex: i.zIndex
|
|
978
|
+
}), i.focus && this.enforceFocus(), this.initContainer(), this.viewerData = O({}, this.containerData), this.renderList(), this.viewed && this.initImage(function() {
|
|
979
|
+
t.renderImage(function() {
|
|
980
|
+
i.transition && setTimeout(function() {
|
|
981
|
+
f(a, D), f(r, D);
|
|
982
|
+
}, 0);
|
|
983
|
+
});
|
|
984
|
+
}), this);
|
|
985
|
+
},
|
|
986
|
+
exit: function() {
|
|
987
|
+
var t = this, i = this.options, e = this.viewer, a = this.image, r = this.list;
|
|
988
|
+
return !this.isShown || this.played || !this.fulled || !i.inline ? this : (this.fulled = !1, this.close(), v(this.button, It), i.transition && (v(r, D), this.viewed && v(a, D)), i.focus && this.clearEnforceFocus(), e.removeAttribute("role"), e.removeAttribute("aria-labelledby"), e.removeAttribute("aria-modal"), v(e, vt), L(e, {
|
|
989
|
+
zIndex: i.zIndexInline
|
|
990
|
+
}), this.viewerData = O({}, this.parentData), this.renderViewer(), this.renderList(), this.viewed && this.initImage(function() {
|
|
991
|
+
t.renderImage(function() {
|
|
992
|
+
i.transition && setTimeout(function() {
|
|
993
|
+
f(a, D), f(r, D);
|
|
994
|
+
}, 0);
|
|
995
|
+
});
|
|
996
|
+
}), this);
|
|
997
|
+
},
|
|
998
|
+
tooltip: function() {
|
|
999
|
+
var t = this, i = this.options, e = this.tooltipBox, a = this.imageData;
|
|
1000
|
+
return !this.viewed || this.played || !i.tooltip ? this : (e.textContent = "".concat(Math.round(a.ratio * 100), "%"), this.tooltipping ? clearTimeout(this.tooltipping) : i.transition ? (this.fading && I(e, k), f(e, q), f(e, ut), f(e, D), e.removeAttribute("aria-hidden"), e.initialOffsetWidth = e.offsetWidth, f(e, C)) : (f(e, q), e.removeAttribute("aria-hidden")), this.tooltipping = setTimeout(function() {
|
|
1001
|
+
i.transition ? (d(e, k, function() {
|
|
1002
|
+
v(e, q), v(e, ut), v(e, D), e.setAttribute("aria-hidden", !0), t.fading = !1;
|
|
1003
|
+
}, {
|
|
1004
|
+
once: !0
|
|
1005
|
+
}), v(e, C), t.fading = !0) : (v(e, q), e.setAttribute("aria-hidden", !0)), t.tooltipping = !1;
|
|
1006
|
+
}, 1e3), this);
|
|
1007
|
+
},
|
|
1008
|
+
toggle: function() {
|
|
1009
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
1010
|
+
return this.imageData.ratio === 1 ? this.zoomTo(this.imageData.oldRatio, !0, null, t) : this.zoomTo(1, !0, null, t), this;
|
|
1011
|
+
},
|
|
1012
|
+
reset: function() {
|
|
1013
|
+
return this.viewed && !this.played && (this.imageData = O({}, this.initialImageData), this.renderImage()), this;
|
|
1014
|
+
},
|
|
1015
|
+
update: function() {
|
|
1016
|
+
var t = this, i = this.element, e = this.options, a = this.isImg;
|
|
1017
|
+
if (a && !i.parentNode)
|
|
1018
|
+
return this.destroy();
|
|
1019
|
+
var r = [];
|
|
1020
|
+
if (w(a ? [i] : i.querySelectorAll("img"), function(h) {
|
|
1021
|
+
p(e.filter) ? e.filter.call(t, h) && r.push(h) : t.getImageURL(h) && r.push(h);
|
|
1022
|
+
}), !r.length)
|
|
1023
|
+
return this;
|
|
1024
|
+
if (this.images = r, this.length = r.length, this.ready) {
|
|
1025
|
+
var s = [];
|
|
1026
|
+
if (w(this.items, function(h, o) {
|
|
1027
|
+
var c = h.querySelector("img"), g = r[o];
|
|
1028
|
+
g && c ? (g.src !== c.src || g.alt !== c.alt) && s.push(o) : s.push(o);
|
|
1029
|
+
}), L(this.list, {
|
|
1030
|
+
width: "auto"
|
|
1031
|
+
}), this.initList(), this.isShown)
|
|
1032
|
+
if (this.length) {
|
|
1033
|
+
if (this.viewed) {
|
|
1034
|
+
var l = s.indexOf(this.index);
|
|
1035
|
+
if (l >= 0)
|
|
1036
|
+
this.viewed = !1, this.view(Math.max(Math.min(this.index - l, this.length - 1), 0));
|
|
1037
|
+
else {
|
|
1038
|
+
var u = this.items[this.index];
|
|
1039
|
+
f(u, rt), u.setAttribute("aria-selected", !0);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
} else
|
|
1043
|
+
this.image = null, this.viewed = !1, this.index = 0, this.imageData = {}, this.canvas.innerHTML = "", this.title.innerHTML = "";
|
|
1044
|
+
} else
|
|
1045
|
+
this.build();
|
|
1046
|
+
return this;
|
|
1047
|
+
},
|
|
1048
|
+
destroy: function() {
|
|
1049
|
+
var t = this.element, i = this.options;
|
|
1050
|
+
return t[m] ? (this.destroyed = !0, this.ready ? (this.played && this.stop(), i.inline ? (this.fulled && this.exit(), this.unbind()) : this.isShown ? (this.viewing && (this.imageRendering ? this.imageRendering.abort() : this.imageInitializing && this.imageInitializing.abort()), this.hiding && this.transitioning.abort(), this.hidden()) : this.showing && (this.transitioning.abort(), this.hidden()), this.ready = !1, this.viewer.parentNode.removeChild(this.viewer)) : i.inline && (this.delaying ? this.delaying.abort() : this.initializing && this.initializing.abort()), i.inline || b(t, G, this.onStart), t[m] = void 0, this) : this;
|
|
1051
|
+
}
|
|
1052
|
+
}, Oe = {
|
|
1053
|
+
getImageURL: function(t) {
|
|
1054
|
+
var i = this.options.url;
|
|
1055
|
+
return nt(i) ? i = t.getAttribute(i) : p(i) ? i = i.call(this, t) : i = "", i;
|
|
1056
|
+
},
|
|
1057
|
+
enforceFocus: function() {
|
|
1058
|
+
var t = this;
|
|
1059
|
+
this.clearEnforceFocus(), d(document, Nt, this.onFocusin = function(i) {
|
|
1060
|
+
var e = t.viewer, a = i.target;
|
|
1061
|
+
if (!(a === document || a === e || e.contains(a))) {
|
|
1062
|
+
for (; a; ) {
|
|
1063
|
+
if (a.getAttribute("tabindex") !== null || a.getAttribute("aria-modal") === "true")
|
|
1064
|
+
return;
|
|
1065
|
+
a = a.parentElement;
|
|
1066
|
+
}
|
|
1067
|
+
e.focus();
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
},
|
|
1071
|
+
clearEnforceFocus: function() {
|
|
1072
|
+
this.onFocusin && (b(document, Nt, this.onFocusin), this.onFocusin = null);
|
|
1073
|
+
},
|
|
1074
|
+
open: function() {
|
|
1075
|
+
var t = this.body;
|
|
1076
|
+
f(t, _t), this.scrollbarWidth > 0 && (t.style.paddingRight = "".concat(this.scrollbarWidth + (parseFloat(this.initialBodyComputedPaddingRight) || 0), "px"));
|
|
1077
|
+
},
|
|
1078
|
+
close: function() {
|
|
1079
|
+
var t = this.body;
|
|
1080
|
+
v(t, _t), this.scrollbarWidth > 0 && (t.style.paddingRight = this.initialBodyPaddingRight);
|
|
1081
|
+
},
|
|
1082
|
+
shown: function() {
|
|
1083
|
+
var t = this.element, i = this.options, e = this.viewer;
|
|
1084
|
+
this.fulled = !0, this.isShown = !0, this.render(), this.bind(), this.showing = !1, i.focus && (e.focus(), this.enforceFocus()), p(i.shown) && d(t, Mt, i.shown, {
|
|
1085
|
+
once: !0
|
|
1086
|
+
}), I(t, Mt) !== !1 && this.ready && this.isShown && !this.hiding && this.view(this.index);
|
|
1087
|
+
},
|
|
1088
|
+
hidden: function() {
|
|
1089
|
+
var t = this.element, i = this.options, e = this.viewer;
|
|
1090
|
+
i.fucus && this.clearEnforceFocus(), this.fulled = !1, this.viewed = !1, this.isShown = !1, this.close(), this.unbind(), f(e, W), e.removeAttribute("role"), e.removeAttribute("aria-labelledby"), e.removeAttribute("aria-modal"), e.setAttribute("aria-hidden", !0), this.resetList(), this.resetImage(), this.hiding = !1, this.destroyed || (p(i.hidden) && d(t, Yt, i.hidden, {
|
|
1091
|
+
once: !0
|
|
1092
|
+
}), I(t, Yt, null, {
|
|
1093
|
+
cancelable: !1
|
|
1094
|
+
}));
|
|
1095
|
+
},
|
|
1096
|
+
requestFullscreen: function(t) {
|
|
1097
|
+
var i = this.element.ownerDocument;
|
|
1098
|
+
if (this.fulled && !(i.fullscreenElement || i.webkitFullscreenElement || i.mozFullScreenElement || i.msFullscreenElement)) {
|
|
1099
|
+
var e = i.documentElement;
|
|
1100
|
+
e.requestFullscreen ? j(t) ? e.requestFullscreen(t) : e.requestFullscreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.msRequestFullscreen && e.msRequestFullscreen();
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
exitFullscreen: function() {
|
|
1104
|
+
var t = this.element.ownerDocument;
|
|
1105
|
+
this.fulled && (t.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement) && (t.exitFullscreen ? t.exitFullscreen() : t.webkitExitFullscreen ? t.webkitExitFullscreen() : t.mozCancelFullScreen ? t.mozCancelFullScreen() : t.msExitFullscreen && t.msExitFullscreen());
|
|
1106
|
+
},
|
|
1107
|
+
change: function(t) {
|
|
1108
|
+
var i = this.options, e = this.pointers, a = e[Object.keys(e)[0]];
|
|
1109
|
+
if (a) {
|
|
1110
|
+
var r = a.endX - a.startX, s = a.endY - a.startY;
|
|
1111
|
+
switch (this.action) {
|
|
1112
|
+
case ht:
|
|
1113
|
+
this.move(r, s, t);
|
|
1114
|
+
break;
|
|
1115
|
+
case tt:
|
|
1116
|
+
this.zoom(De(e), !1, null, t);
|
|
1117
|
+
break;
|
|
1118
|
+
case Qt: {
|
|
1119
|
+
this.action = "switched";
|
|
1120
|
+
var l = Math.abs(r);
|
|
1121
|
+
l > 1 && l > Math.abs(s) && (this.pointers = {}, r > 1 ? this.prev(i.loop) : r < -1 && this.next(i.loop));
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
w(e, function(u) {
|
|
1126
|
+
u.startX = u.endX, u.startY = u.endY;
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
isSwitchable: function() {
|
|
1131
|
+
var t = this.imageData, i = this.viewerData;
|
|
1132
|
+
return this.length > 1 && t.x >= 0 && t.y >= 0 && t.width <= i.width && t.height <= i.height;
|
|
1133
|
+
}
|
|
1134
|
+
}, Ce = M.Viewer, ze = function(n) {
|
|
1135
|
+
return function() {
|
|
1136
|
+
return n += 1, n;
|
|
1137
|
+
};
|
|
1138
|
+
}(-1), ie = /* @__PURE__ */ function() {
|
|
1139
|
+
function n(t) {
|
|
1140
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1141
|
+
if (ae(this, n), !t || t.nodeType !== 1)
|
|
1142
|
+
throw new Error("The first argument is required and must be an element.");
|
|
1143
|
+
this.element = t, this.options = O({}, xt, j(i) && i), this.action = !1, this.fading = !1, this.fulled = !1, this.hiding = !1, this.imageClicked = !1, this.imageData = {}, this.index = this.options.initialViewIndex, this.isImg = !1, this.isShown = !1, this.length = 0, this.moving = !1, this.played = !1, this.playing = !1, this.pointers = {}, this.ready = !1, this.rotating = !1, this.scaling = !1, this.showing = !1, this.timeout = !1, this.tooltipping = !1, this.viewed = !1, this.viewing = !1, this.wheeling = !1, this.zooming = !1, this.id = ze(), this.init();
|
|
1144
|
+
}
|
|
1145
|
+
return re(n, [{
|
|
1146
|
+
key: "init",
|
|
1147
|
+
value: function() {
|
|
1148
|
+
var i = this, e = this.element, a = this.options;
|
|
1149
|
+
if (!e[m]) {
|
|
1150
|
+
e[m] = this, a.focus && !a.keyboard && (a.focus = !1);
|
|
1151
|
+
var r = e.localName === "img", s = [];
|
|
1152
|
+
if (w(r ? [e] : e.querySelectorAll("img"), function(h) {
|
|
1153
|
+
p(a.filter) ? a.filter.call(i, h) && s.push(h) : i.getImageURL(h) && s.push(h);
|
|
1154
|
+
}), this.isImg = r, this.length = s.length, this.images = s, this.initBody(), B(document.createElement(m).style.transition) && (a.transition = !1), a.inline) {
|
|
1155
|
+
var l = 0, u = function() {
|
|
1156
|
+
if (l += 1, l === i.length) {
|
|
1157
|
+
var o;
|
|
1158
|
+
i.initializing = !1, i.delaying = {
|
|
1159
|
+
abort: function() {
|
|
1160
|
+
clearTimeout(o);
|
|
1161
|
+
}
|
|
1162
|
+
}, o = setTimeout(function() {
|
|
1163
|
+
i.delaying = !1, i.build();
|
|
1164
|
+
}, 0);
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
this.initializing = {
|
|
1168
|
+
abort: function() {
|
|
1169
|
+
w(s, function(o) {
|
|
1170
|
+
o.complete || (b(o, z, u), b(o, X, u));
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
}, w(s, function(h) {
|
|
1174
|
+
if (h.complete)
|
|
1175
|
+
u();
|
|
1176
|
+
else {
|
|
1177
|
+
var o, c;
|
|
1178
|
+
d(h, z, o = function() {
|
|
1179
|
+
b(h, X, c), u();
|
|
1180
|
+
}, {
|
|
1181
|
+
once: !0
|
|
1182
|
+
}), d(h, X, c = function() {
|
|
1183
|
+
b(h, z, o), u();
|
|
1184
|
+
}, {
|
|
1185
|
+
once: !0
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
});
|
|
1189
|
+
} else
|
|
1190
|
+
d(e, G, this.onStart = function(h) {
|
|
1191
|
+
var o = h.target;
|
|
1192
|
+
o.localName === "img" && (!p(a.filter) || a.filter.call(i, o)) && i.view(i.images.indexOf(o));
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}, {
|
|
1197
|
+
key: "build",
|
|
1198
|
+
value: function() {
|
|
1199
|
+
if (!this.ready) {
|
|
1200
|
+
var i = this.element, e = this.options, a = i.parentNode, r = document.createElement("div");
|
|
1201
|
+
r.innerHTML = oe;
|
|
1202
|
+
var s = r.querySelector(".".concat(m, "-container")), l = s.querySelector(".".concat(m, "-title")), u = s.querySelector(".".concat(m, "-toolbar")), h = s.querySelector(".".concat(m, "-navbar")), o = s.querySelector(".".concat(m, "-button")), c = s.querySelector(".".concat(m, "-canvas"));
|
|
1203
|
+
if (this.parent = a, this.viewer = s, this.title = l, this.toolbar = u, this.navbar = h, this.button = o, this.canvas = c, this.footer = s.querySelector(".".concat(m, "-footer")), this.tooltipBox = s.querySelector(".".concat(m, "-tooltip")), this.player = s.querySelector(".".concat(m, "-player")), this.list = s.querySelector(".".concat(m, "-list")), s.id = "".concat(m).concat(this.id), l.id = "".concat(m, "Title").concat(this.id), f(l, e.title ? ot(Array.isArray(e.title) ? e.title[0] : e.title) : W), f(h, e.navbar ? ot(e.navbar) : W), at(o, W, !e.button), e.keyboard && o.setAttribute("tabindex", 0), e.backdrop && (f(s, "".concat(m, "-backdrop")), !e.inline && e.backdrop !== "static" && bt(c, ft, "hide")), nt(e.className) && e.className && e.className.split(Et).forEach(function(y) {
|
|
1204
|
+
f(s, y);
|
|
1205
|
+
}), e.toolbar) {
|
|
1206
|
+
var g = document.createElement("ul"), x = j(e.toolbar), S = st.slice(0, 3), E = st.slice(7, 9), _ = st.slice(9);
|
|
1207
|
+
x || f(u, ot(e.toolbar)), w(x ? e.toolbar : st, function(y, V) {
|
|
1208
|
+
var P = x && j(y), R = x ? Tt(V) : y, Y = P && !B(y.show) ? y.show : y;
|
|
1209
|
+
if (!(!Y || !e.zoomable && S.indexOf(R) !== -1 || !e.rotatable && E.indexOf(R) !== -1 || !e.scalable && _.indexOf(R) !== -1)) {
|
|
1210
|
+
var Q = P && !B(y.size) ? y.size : y, H = P && !B(y.click) ? y.click : y, F = document.createElement("li");
|
|
1211
|
+
e.keyboard && F.setAttribute("tabindex", 0), F.setAttribute("role", "button"), f(F, "".concat(m, "-").concat(R)), p(H) || bt(F, ft, R), T(Y) && f(F, ot(Y)), ["small", "large"].indexOf(Q) !== -1 ? f(F, "".concat(m, "-").concat(Q)) : R === "play" && f(F, "".concat(m, "-large")), p(H) && d(F, G, H), g.appendChild(F);
|
|
1212
|
+
}
|
|
1213
|
+
}), u.appendChild(g);
|
|
1214
|
+
} else
|
|
1215
|
+
f(u, W);
|
|
1216
|
+
if (!e.rotatable) {
|
|
1217
|
+
var A = u.querySelectorAll('li[class*="rotate"]');
|
|
1218
|
+
f(A, et), w(A, function(y) {
|
|
1219
|
+
u.appendChild(y);
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
if (e.inline)
|
|
1223
|
+
f(o, he), L(s, {
|
|
1224
|
+
zIndex: e.zIndexInline
|
|
1225
|
+
}), window.getComputedStyle(a).position === "static" && L(a, {
|
|
1226
|
+
position: "relative"
|
|
1227
|
+
}), a.insertBefore(s, i.nextSibling);
|
|
1228
|
+
else {
|
|
1229
|
+
f(o, le), f(s, vt), f(s, ut), f(s, W), L(s, {
|
|
1230
|
+
zIndex: e.zIndex
|
|
1231
|
+
});
|
|
1232
|
+
var N = e.container;
|
|
1233
|
+
nt(N) && (N = i.ownerDocument.querySelector(N)), N || (N = this.body), N.appendChild(s);
|
|
1234
|
+
}
|
|
1235
|
+
if (e.inline && (this.render(), this.bind(), this.isShown = !0), this.ready = !0, p(e.ready) && d(i, Vt, e.ready, {
|
|
1236
|
+
once: !0
|
|
1237
|
+
}), I(i, Vt) === !1) {
|
|
1238
|
+
this.ready = !1;
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1241
|
+
this.ready && e.inline && this.view(this.index);
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}], [{
|
|
1245
|
+
key: "noConflict",
|
|
1246
|
+
value: function() {
|
|
1247
|
+
return window.Viewer = Ce, n;
|
|
1248
|
+
}
|
|
1249
|
+
}, {
|
|
1250
|
+
key: "setDefaults",
|
|
1251
|
+
value: function(i) {
|
|
1252
|
+
O(xt, j(i) && i);
|
|
1253
|
+
}
|
|
1254
|
+
}]), n;
|
|
1255
|
+
}();
|
|
1256
|
+
O(ie.prototype, Ie, _e, Ae, Ne, Oe);
|
|
1257
|
+
var ke = function() {
|
|
1258
|
+
var n = this, t = n.$createElement, i = n._self._c || t;
|
|
1259
|
+
return i("div", {
|
|
1260
|
+
directives: [{
|
|
1261
|
+
name: "show",
|
|
1262
|
+
rawName: "v-show",
|
|
1263
|
+
value: !n.lazy,
|
|
1264
|
+
expression: "!lazy"
|
|
1265
|
+
}],
|
|
1266
|
+
ref: "wrapper",
|
|
1267
|
+
staticClass: "image-viewer"
|
|
1268
|
+
}, [n._t("default", function() {
|
|
1269
|
+
return n._l(n.images, function(e) {
|
|
1270
|
+
return i("img", {
|
|
1271
|
+
key: e.src,
|
|
1272
|
+
staticClass: "image-item",
|
|
1273
|
+
style: {
|
|
1274
|
+
backgroundImage: `url('${e.src}')`
|
|
1275
|
+
},
|
|
1276
|
+
attrs: {
|
|
1277
|
+
"data-src": e.src,
|
|
1278
|
+
alt: e.alt
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
});
|
|
1282
|
+
})], 2);
|
|
1283
|
+
}, Le = [];
|
|
1284
|
+
const Re = {
|
|
1285
|
+
name: "ImageViewer",
|
|
1286
|
+
props: {
|
|
1287
|
+
images: Array,
|
|
1288
|
+
url: {
|
|
1289
|
+
type: String,
|
|
1290
|
+
default: "data-src"
|
|
1291
|
+
},
|
|
1292
|
+
lazy: Boolean
|
|
1293
|
+
},
|
|
1294
|
+
mounted() {
|
|
1295
|
+
this.lazy || this.init({
|
|
1296
|
+
container: this.$refs.wrapper,
|
|
1297
|
+
options: {
|
|
1298
|
+
navbar: !1,
|
|
1299
|
+
backdrop: "static",
|
|
1300
|
+
url: this.url
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
},
|
|
1304
|
+
updated() {
|
|
1305
|
+
var n;
|
|
1306
|
+
this.lazy || (n = this.gallery) == null || n.update();
|
|
1307
|
+
},
|
|
1308
|
+
beforeDestroy() {
|
|
1309
|
+
this.lazy || this.gallery.destroy();
|
|
1310
|
+
},
|
|
1311
|
+
methods: {
|
|
1312
|
+
init({ container: n, options: t }) {
|
|
1313
|
+
this.gallery = new ie(n, t);
|
|
1314
|
+
},
|
|
1315
|
+
show({ container: n, options: t, index: i } = {}) {
|
|
1316
|
+
n = n || this.$refs.wrapper, t = t || {
|
|
1317
|
+
navbar: !1,
|
|
1318
|
+
backdrop: "static",
|
|
1319
|
+
url: this.url,
|
|
1320
|
+
loop: !1,
|
|
1321
|
+
initialViewIndex: i || 0,
|
|
1322
|
+
hidden: () => {
|
|
1323
|
+
this.gallery.destroy(), this.gallery = null;
|
|
1324
|
+
}
|
|
1325
|
+
}, this.gallery || (this.init({ container: n, options: t }), this.gallery.show());
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}, Jt = {};
|
|
1329
|
+
var Ve = /* @__PURE__ */ ne(
|
|
1330
|
+
Re,
|
|
1331
|
+
ke,
|
|
1332
|
+
Le,
|
|
1333
|
+
!1,
|
|
1334
|
+
Fe,
|
|
1335
|
+
null,
|
|
1336
|
+
null,
|
|
1337
|
+
null
|
|
1338
|
+
);
|
|
1339
|
+
function Fe(n) {
|
|
1340
|
+
for (let t in Jt)
|
|
1341
|
+
this[t] = Jt[t];
|
|
1342
|
+
}
|
|
1343
|
+
const Pe = /* @__PURE__ */ function() {
|
|
1344
|
+
return Ve.exports;
|
|
1345
|
+
}();
|
|
1346
|
+
export {
|
|
1347
|
+
Pe as default
|
|
1348
|
+
};
|