viewerjs 1.11.0 → 1.11.2
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/viewer.common.js +58 -21
- package/dist/viewer.css +2 -2
- package/dist/viewer.esm.js +58 -21
- package/dist/viewer.js +58 -21
- package/dist/viewer.min.css +2 -2
- package/dist/viewer.min.js +3 -3
- package/package.json +18 -18
- package/src/js/handlers.js +6 -1
- package/src/js/viewer.js +1 -0
- package/types/index.d.ts +8 -2
package/dist/viewer.common.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Viewer.js v1.11.
|
|
2
|
+
* Viewer.js v1.11.2
|
|
3
3
|
* https://fengyuanchen.github.io/viewerjs
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*
|
|
8
|
-
* Date:
|
|
8
|
+
* Date: 2023-01-01T10:14:49.638Z
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
@@ -51,7 +51,7 @@ function _defineProperties(target, props) {
|
|
|
51
51
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
52
52
|
descriptor.configurable = true;
|
|
53
53
|
if ("value" in descriptor) descriptor.writable = true;
|
|
54
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
54
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -63,6 +63,7 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
63
63
|
return Constructor;
|
|
64
64
|
}
|
|
65
65
|
function _defineProperty(obj, key, value) {
|
|
66
|
+
key = _toPropertyKey(key);
|
|
66
67
|
if (key in obj) {
|
|
67
68
|
Object.defineProperty(obj, key, {
|
|
68
69
|
value: value,
|
|
@@ -75,6 +76,20 @@ function _defineProperty(obj, key, value) {
|
|
|
75
76
|
}
|
|
76
77
|
return obj;
|
|
77
78
|
}
|
|
79
|
+
function _toPrimitive(input, hint) {
|
|
80
|
+
if (typeof input !== "object" || input === null) return input;
|
|
81
|
+
var prim = input[Symbol.toPrimitive];
|
|
82
|
+
if (prim !== undefined) {
|
|
83
|
+
var res = prim.call(input, hint || "default");
|
|
84
|
+
if (typeof res !== "object") return res;
|
|
85
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
86
|
+
}
|
|
87
|
+
return (hint === "string" ? String : Number)(input);
|
|
88
|
+
}
|
|
89
|
+
function _toPropertyKey(arg) {
|
|
90
|
+
var key = _toPrimitive(arg, "string");
|
|
91
|
+
return typeof key === "symbol" ? key : String(key);
|
|
92
|
+
}
|
|
78
93
|
|
|
79
94
|
var DEFAULTS = {
|
|
80
95
|
/**
|
|
@@ -646,7 +661,8 @@ var onceSupported = function () {
|
|
|
646
661
|
* This setter can fix a `TypeError` in strict mode
|
|
647
662
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
|
|
648
663
|
* @param {boolean} value - The value to set
|
|
649
|
-
*/
|
|
664
|
+
*/
|
|
665
|
+
set: function set(value) {
|
|
650
666
|
once = value;
|
|
651
667
|
}
|
|
652
668
|
});
|
|
@@ -1258,7 +1274,9 @@ var handlers = {
|
|
|
1258
1274
|
}
|
|
1259
1275
|
break;
|
|
1260
1276
|
case 'hide':
|
|
1261
|
-
this.
|
|
1277
|
+
if (!this.pointerMoved) {
|
|
1278
|
+
this.hide();
|
|
1279
|
+
}
|
|
1262
1280
|
break;
|
|
1263
1281
|
case 'view':
|
|
1264
1282
|
this.view(getData(target, 'index'));
|
|
@@ -1479,6 +1497,7 @@ var handlers = {
|
|
|
1479
1497
|
pointers = this.pointers;
|
|
1480
1498
|
var buttons = event.buttons,
|
|
1481
1499
|
button = event.button;
|
|
1500
|
+
this.pointerMoved = false;
|
|
1482
1501
|
if (!this.viewed || this.showing || this.viewing || this.hiding
|
|
1483
1502
|
|
|
1484
1503
|
// Handle mouse event and pointer event and ignore touch event
|
|
@@ -1518,6 +1537,7 @@ var handlers = {
|
|
|
1518
1537
|
return;
|
|
1519
1538
|
}
|
|
1520
1539
|
event.preventDefault();
|
|
1540
|
+
this.pointerMoved = true;
|
|
1521
1541
|
if (event.changedTouches) {
|
|
1522
1542
|
forEach(event.changedTouches, function (touch) {
|
|
1523
1543
|
assign(pointers[touch.identifier] || {}, getPointer(touch, true));
|
|
@@ -1650,7 +1670,8 @@ var methods = {
|
|
|
1650
1670
|
/** Show the viewer (only available in modal mode)
|
|
1651
1671
|
* @param {boolean} [immediate=false] - Indicates if show the viewer immediately or not.
|
|
1652
1672
|
* @returns {Viewer} this
|
|
1653
|
-
*/
|
|
1673
|
+
*/
|
|
1674
|
+
show: function show() {
|
|
1654
1675
|
var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1655
1676
|
var element = this.element,
|
|
1656
1677
|
options = this.options;
|
|
@@ -1709,7 +1730,8 @@ var methods = {
|
|
|
1709
1730
|
* Hide the viewer (only available in modal mode)
|
|
1710
1731
|
* @param {boolean} [immediate=false] - Indicates if hide the viewer immediately or not.
|
|
1711
1732
|
* @returns {Viewer} this
|
|
1712
|
-
*/
|
|
1733
|
+
*/
|
|
1734
|
+
hide: function hide() {
|
|
1713
1735
|
var _this = this;
|
|
1714
1736
|
var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1715
1737
|
var element = this.element,
|
|
@@ -1786,7 +1808,8 @@ var methods = {
|
|
|
1786
1808
|
* View one of the images with image's index
|
|
1787
1809
|
* @param {number} index - The index of the image to view.
|
|
1788
1810
|
* @returns {Viewer} this
|
|
1789
|
-
*/
|
|
1811
|
+
*/
|
|
1812
|
+
view: function view() {
|
|
1790
1813
|
var _this2 = this;
|
|
1791
1814
|
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.initialViewIndex;
|
|
1792
1815
|
index = Number(index) || 0;
|
|
@@ -1925,7 +1948,8 @@ var methods = {
|
|
|
1925
1948
|
* @param {boolean} [loop=false] - Indicate if view the last one
|
|
1926
1949
|
* when it is the first one at present.
|
|
1927
1950
|
* @returns {Viewer} this
|
|
1928
|
-
*/
|
|
1951
|
+
*/
|
|
1952
|
+
prev: function prev() {
|
|
1929
1953
|
var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1930
1954
|
var index = this.index - 1;
|
|
1931
1955
|
if (index < 0) {
|
|
@@ -1939,7 +1963,8 @@ var methods = {
|
|
|
1939
1963
|
* @param {boolean} [loop=false] - Indicate if view the first one
|
|
1940
1964
|
* when it is the last one at present.
|
|
1941
1965
|
* @returns {Viewer} this
|
|
1942
|
-
*/
|
|
1966
|
+
*/
|
|
1967
|
+
next: function next() {
|
|
1943
1968
|
var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1944
1969
|
var maxIndex = this.length - 1;
|
|
1945
1970
|
var index = this.index + 1;
|
|
@@ -1954,7 +1979,8 @@ var methods = {
|
|
|
1954
1979
|
* @param {number} x - The moving distance in the horizontal direction.
|
|
1955
1980
|
* @param {number} [y=x] The moving distance in the vertical direction.
|
|
1956
1981
|
* @returns {Viewer} this
|
|
1957
|
-
*/
|
|
1982
|
+
*/
|
|
1983
|
+
move: function move(x) {
|
|
1958
1984
|
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
|
|
1959
1985
|
var imageData = this.imageData;
|
|
1960
1986
|
this.moveTo(isUndefined(x) ? x : imageData.x + Number(x), isUndefined(y) ? y : imageData.y + Number(y));
|
|
@@ -1966,7 +1992,8 @@ var methods = {
|
|
|
1966
1992
|
* @param {number} [y=x] - The new position in the vertical direction.
|
|
1967
1993
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
1968
1994
|
* @returns {Viewer} this
|
|
1969
|
-
*/
|
|
1995
|
+
*/
|
|
1996
|
+
moveTo: function moveTo(x) {
|
|
1970
1997
|
var _this3 = this;
|
|
1971
1998
|
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
|
|
1972
1999
|
var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -2034,7 +2061,8 @@ var methods = {
|
|
|
2034
2061
|
* Rotate the image with a relative degree.
|
|
2035
2062
|
* @param {number} degree - The rotate degree.
|
|
2036
2063
|
* @returns {Viewer} this
|
|
2037
|
-
*/
|
|
2064
|
+
*/
|
|
2065
|
+
rotate: function rotate(degree) {
|
|
2038
2066
|
this.rotateTo((this.imageData.rotate || 0) + Number(degree));
|
|
2039
2067
|
return this;
|
|
2040
2068
|
},
|
|
@@ -2042,7 +2070,8 @@ var methods = {
|
|
|
2042
2070
|
* Rotate the image to an absolute degree.
|
|
2043
2071
|
* @param {number} degree - The rotate degree.
|
|
2044
2072
|
* @returns {Viewer} this
|
|
2045
|
-
*/
|
|
2073
|
+
*/
|
|
2074
|
+
rotateTo: function rotateTo(degree) {
|
|
2046
2075
|
var _this4 = this;
|
|
2047
2076
|
var element = this.element,
|
|
2048
2077
|
options = this.options,
|
|
@@ -2084,7 +2113,8 @@ var methods = {
|
|
|
2084
2113
|
* Scale the image on the x-axis.
|
|
2085
2114
|
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
2086
2115
|
* @returns {Viewer} this
|
|
2087
|
-
*/
|
|
2116
|
+
*/
|
|
2117
|
+
scaleX: function scaleX(_scaleX) {
|
|
2088
2118
|
this.scale(_scaleX, this.imageData.scaleY);
|
|
2089
2119
|
return this;
|
|
2090
2120
|
},
|
|
@@ -2092,7 +2122,8 @@ var methods = {
|
|
|
2092
2122
|
* Scale the image on the y-axis.
|
|
2093
2123
|
* @param {number} scaleY - The scale ratio on the y-axis.
|
|
2094
2124
|
* @returns {Viewer} this
|
|
2095
|
-
*/
|
|
2125
|
+
*/
|
|
2126
|
+
scaleY: function scaleY(_scaleY) {
|
|
2096
2127
|
this.scale(this.imageData.scaleX, _scaleY);
|
|
2097
2128
|
return this;
|
|
2098
2129
|
},
|
|
@@ -2101,7 +2132,8 @@ var methods = {
|
|
|
2101
2132
|
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
2102
2133
|
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
|
|
2103
2134
|
* @returns {Viewer} this
|
|
2104
|
-
*/
|
|
2135
|
+
*/
|
|
2136
|
+
scale: function scale(scaleX) {
|
|
2105
2137
|
var _this5 = this;
|
|
2106
2138
|
var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
|
|
2107
2139
|
var element = this.element,
|
|
@@ -2167,7 +2199,8 @@ var methods = {
|
|
|
2167
2199
|
* @param {Object} [pivot] - The pivot point coordinate for zooming.
|
|
2168
2200
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2169
2201
|
* @returns {Viewer} this
|
|
2170
|
-
*/
|
|
2202
|
+
*/
|
|
2203
|
+
zoom: function zoom(ratio) {
|
|
2171
2204
|
var showTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2172
2205
|
var pivot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2173
2206
|
var _originalEvent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
@@ -2189,7 +2222,8 @@ var methods = {
|
|
|
2189
2222
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2190
2223
|
* @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not.
|
|
2191
2224
|
* @returns {Viewer} this
|
|
2192
|
-
*/
|
|
2225
|
+
*/
|
|
2226
|
+
zoomTo: function zoomTo(ratio) {
|
|
2193
2227
|
var _this6 = this;
|
|
2194
2228
|
var showTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2195
2229
|
var pivot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -2295,7 +2329,8 @@ var methods = {
|
|
|
2295
2329
|
* Play the images
|
|
2296
2330
|
* @param {boolean|FullscreenOptions} [fullscreen=false] - Indicate if request fullscreen or not.
|
|
2297
2331
|
* @returns {Viewer} this
|
|
2298
|
-
*/
|
|
2332
|
+
*/
|
|
2333
|
+
play: function play() {
|
|
2299
2334
|
var _this7 = this;
|
|
2300
2335
|
var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2301
2336
|
if (!this.isShown || this.played) {
|
|
@@ -2544,7 +2579,8 @@ var methods = {
|
|
|
2544
2579
|
* Toggle the image size between its current size and natural size
|
|
2545
2580
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2546
2581
|
* @returns {Viewer} this
|
|
2547
|
-
*/
|
|
2582
|
+
*/
|
|
2583
|
+
toggle: function toggle() {
|
|
2548
2584
|
var _originalEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2549
2585
|
if (this.imageData.ratio === 1) {
|
|
2550
2586
|
this.zoomTo(this.imageData.oldRatio, true, null, _originalEvent);
|
|
@@ -2926,6 +2962,7 @@ var Viewer = /*#__PURE__*/function () {
|
|
|
2926
2962
|
this.viewing = false;
|
|
2927
2963
|
this.wheeling = false;
|
|
2928
2964
|
this.zooming = false;
|
|
2965
|
+
this.pointerMoved = false;
|
|
2929
2966
|
this.id = getUniqueID();
|
|
2930
2967
|
this.init();
|
|
2931
2968
|
}
|
package/dist/viewer.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Viewer.js v1.11.
|
|
2
|
+
* Viewer.js v1.11.2
|
|
3
3
|
* https://fengyuanchen.github.io/viewerjs
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*
|
|
8
|
-
* Date:
|
|
8
|
+
* Date: 2023-01-01T10:14:47.694Z
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
.viewer-zoom-in::before, .viewer-zoom-out::before, .viewer-one-to-one::before, .viewer-reset::before, .viewer-prev::before, .viewer-play::before, .viewer-next::before, .viewer-rotate-left::before, .viewer-rotate-right::before, .viewer-flip-horizontal::before, .viewer-flip-vertical::before, .viewer-fullscreen::before, .viewer-fullscreen-exit::before, .viewer-close::before {
|
package/dist/viewer.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Viewer.js v1.11.
|
|
2
|
+
* Viewer.js v1.11.2
|
|
3
3
|
* https://fengyuanchen.github.io/viewerjs
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*
|
|
8
|
-
* Date:
|
|
8
|
+
* Date: 2023-01-01T10:14:49.638Z
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
function ownKeys(object, enumerableOnly) {
|
|
@@ -49,7 +49,7 @@ function _defineProperties(target, props) {
|
|
|
49
49
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
50
50
|
descriptor.configurable = true;
|
|
51
51
|
if ("value" in descriptor) descriptor.writable = true;
|
|
52
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
52
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -61,6 +61,7 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
61
61
|
return Constructor;
|
|
62
62
|
}
|
|
63
63
|
function _defineProperty(obj, key, value) {
|
|
64
|
+
key = _toPropertyKey(key);
|
|
64
65
|
if (key in obj) {
|
|
65
66
|
Object.defineProperty(obj, key, {
|
|
66
67
|
value: value,
|
|
@@ -73,6 +74,20 @@ function _defineProperty(obj, key, value) {
|
|
|
73
74
|
}
|
|
74
75
|
return obj;
|
|
75
76
|
}
|
|
77
|
+
function _toPrimitive(input, hint) {
|
|
78
|
+
if (typeof input !== "object" || input === null) return input;
|
|
79
|
+
var prim = input[Symbol.toPrimitive];
|
|
80
|
+
if (prim !== undefined) {
|
|
81
|
+
var res = prim.call(input, hint || "default");
|
|
82
|
+
if (typeof res !== "object") return res;
|
|
83
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
84
|
+
}
|
|
85
|
+
return (hint === "string" ? String : Number)(input);
|
|
86
|
+
}
|
|
87
|
+
function _toPropertyKey(arg) {
|
|
88
|
+
var key = _toPrimitive(arg, "string");
|
|
89
|
+
return typeof key === "symbol" ? key : String(key);
|
|
90
|
+
}
|
|
76
91
|
|
|
77
92
|
var DEFAULTS = {
|
|
78
93
|
/**
|
|
@@ -644,7 +659,8 @@ var onceSupported = function () {
|
|
|
644
659
|
* This setter can fix a `TypeError` in strict mode
|
|
645
660
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
|
|
646
661
|
* @param {boolean} value - The value to set
|
|
647
|
-
*/
|
|
662
|
+
*/
|
|
663
|
+
set: function set(value) {
|
|
648
664
|
once = value;
|
|
649
665
|
}
|
|
650
666
|
});
|
|
@@ -1256,7 +1272,9 @@ var handlers = {
|
|
|
1256
1272
|
}
|
|
1257
1273
|
break;
|
|
1258
1274
|
case 'hide':
|
|
1259
|
-
this.
|
|
1275
|
+
if (!this.pointerMoved) {
|
|
1276
|
+
this.hide();
|
|
1277
|
+
}
|
|
1260
1278
|
break;
|
|
1261
1279
|
case 'view':
|
|
1262
1280
|
this.view(getData(target, 'index'));
|
|
@@ -1477,6 +1495,7 @@ var handlers = {
|
|
|
1477
1495
|
pointers = this.pointers;
|
|
1478
1496
|
var buttons = event.buttons,
|
|
1479
1497
|
button = event.button;
|
|
1498
|
+
this.pointerMoved = false;
|
|
1480
1499
|
if (!this.viewed || this.showing || this.viewing || this.hiding
|
|
1481
1500
|
|
|
1482
1501
|
// Handle mouse event and pointer event and ignore touch event
|
|
@@ -1516,6 +1535,7 @@ var handlers = {
|
|
|
1516
1535
|
return;
|
|
1517
1536
|
}
|
|
1518
1537
|
event.preventDefault();
|
|
1538
|
+
this.pointerMoved = true;
|
|
1519
1539
|
if (event.changedTouches) {
|
|
1520
1540
|
forEach(event.changedTouches, function (touch) {
|
|
1521
1541
|
assign(pointers[touch.identifier] || {}, getPointer(touch, true));
|
|
@@ -1648,7 +1668,8 @@ var methods = {
|
|
|
1648
1668
|
/** Show the viewer (only available in modal mode)
|
|
1649
1669
|
* @param {boolean} [immediate=false] - Indicates if show the viewer immediately or not.
|
|
1650
1670
|
* @returns {Viewer} this
|
|
1651
|
-
*/
|
|
1671
|
+
*/
|
|
1672
|
+
show: function show() {
|
|
1652
1673
|
var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1653
1674
|
var element = this.element,
|
|
1654
1675
|
options = this.options;
|
|
@@ -1707,7 +1728,8 @@ var methods = {
|
|
|
1707
1728
|
* Hide the viewer (only available in modal mode)
|
|
1708
1729
|
* @param {boolean} [immediate=false] - Indicates if hide the viewer immediately or not.
|
|
1709
1730
|
* @returns {Viewer} this
|
|
1710
|
-
*/
|
|
1731
|
+
*/
|
|
1732
|
+
hide: function hide() {
|
|
1711
1733
|
var _this = this;
|
|
1712
1734
|
var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1713
1735
|
var element = this.element,
|
|
@@ -1784,7 +1806,8 @@ var methods = {
|
|
|
1784
1806
|
* View one of the images with image's index
|
|
1785
1807
|
* @param {number} index - The index of the image to view.
|
|
1786
1808
|
* @returns {Viewer} this
|
|
1787
|
-
*/
|
|
1809
|
+
*/
|
|
1810
|
+
view: function view() {
|
|
1788
1811
|
var _this2 = this;
|
|
1789
1812
|
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.initialViewIndex;
|
|
1790
1813
|
index = Number(index) || 0;
|
|
@@ -1923,7 +1946,8 @@ var methods = {
|
|
|
1923
1946
|
* @param {boolean} [loop=false] - Indicate if view the last one
|
|
1924
1947
|
* when it is the first one at present.
|
|
1925
1948
|
* @returns {Viewer} this
|
|
1926
|
-
*/
|
|
1949
|
+
*/
|
|
1950
|
+
prev: function prev() {
|
|
1927
1951
|
var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1928
1952
|
var index = this.index - 1;
|
|
1929
1953
|
if (index < 0) {
|
|
@@ -1937,7 +1961,8 @@ var methods = {
|
|
|
1937
1961
|
* @param {boolean} [loop=false] - Indicate if view the first one
|
|
1938
1962
|
* when it is the last one at present.
|
|
1939
1963
|
* @returns {Viewer} this
|
|
1940
|
-
*/
|
|
1964
|
+
*/
|
|
1965
|
+
next: function next() {
|
|
1941
1966
|
var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1942
1967
|
var maxIndex = this.length - 1;
|
|
1943
1968
|
var index = this.index + 1;
|
|
@@ -1952,7 +1977,8 @@ var methods = {
|
|
|
1952
1977
|
* @param {number} x - The moving distance in the horizontal direction.
|
|
1953
1978
|
* @param {number} [y=x] The moving distance in the vertical direction.
|
|
1954
1979
|
* @returns {Viewer} this
|
|
1955
|
-
*/
|
|
1980
|
+
*/
|
|
1981
|
+
move: function move(x) {
|
|
1956
1982
|
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
|
|
1957
1983
|
var imageData = this.imageData;
|
|
1958
1984
|
this.moveTo(isUndefined(x) ? x : imageData.x + Number(x), isUndefined(y) ? y : imageData.y + Number(y));
|
|
@@ -1964,7 +1990,8 @@ var methods = {
|
|
|
1964
1990
|
* @param {number} [y=x] - The new position in the vertical direction.
|
|
1965
1991
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
1966
1992
|
* @returns {Viewer} this
|
|
1967
|
-
*/
|
|
1993
|
+
*/
|
|
1994
|
+
moveTo: function moveTo(x) {
|
|
1968
1995
|
var _this3 = this;
|
|
1969
1996
|
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
|
|
1970
1997
|
var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -2032,7 +2059,8 @@ var methods = {
|
|
|
2032
2059
|
* Rotate the image with a relative degree.
|
|
2033
2060
|
* @param {number} degree - The rotate degree.
|
|
2034
2061
|
* @returns {Viewer} this
|
|
2035
|
-
*/
|
|
2062
|
+
*/
|
|
2063
|
+
rotate: function rotate(degree) {
|
|
2036
2064
|
this.rotateTo((this.imageData.rotate || 0) + Number(degree));
|
|
2037
2065
|
return this;
|
|
2038
2066
|
},
|
|
@@ -2040,7 +2068,8 @@ var methods = {
|
|
|
2040
2068
|
* Rotate the image to an absolute degree.
|
|
2041
2069
|
* @param {number} degree - The rotate degree.
|
|
2042
2070
|
* @returns {Viewer} this
|
|
2043
|
-
*/
|
|
2071
|
+
*/
|
|
2072
|
+
rotateTo: function rotateTo(degree) {
|
|
2044
2073
|
var _this4 = this;
|
|
2045
2074
|
var element = this.element,
|
|
2046
2075
|
options = this.options,
|
|
@@ -2082,7 +2111,8 @@ var methods = {
|
|
|
2082
2111
|
* Scale the image on the x-axis.
|
|
2083
2112
|
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
2084
2113
|
* @returns {Viewer} this
|
|
2085
|
-
*/
|
|
2114
|
+
*/
|
|
2115
|
+
scaleX: function scaleX(_scaleX) {
|
|
2086
2116
|
this.scale(_scaleX, this.imageData.scaleY);
|
|
2087
2117
|
return this;
|
|
2088
2118
|
},
|
|
@@ -2090,7 +2120,8 @@ var methods = {
|
|
|
2090
2120
|
* Scale the image on the y-axis.
|
|
2091
2121
|
* @param {number} scaleY - The scale ratio on the y-axis.
|
|
2092
2122
|
* @returns {Viewer} this
|
|
2093
|
-
*/
|
|
2123
|
+
*/
|
|
2124
|
+
scaleY: function scaleY(_scaleY) {
|
|
2094
2125
|
this.scale(this.imageData.scaleX, _scaleY);
|
|
2095
2126
|
return this;
|
|
2096
2127
|
},
|
|
@@ -2099,7 +2130,8 @@ var methods = {
|
|
|
2099
2130
|
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
2100
2131
|
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
|
|
2101
2132
|
* @returns {Viewer} this
|
|
2102
|
-
*/
|
|
2133
|
+
*/
|
|
2134
|
+
scale: function scale(scaleX) {
|
|
2103
2135
|
var _this5 = this;
|
|
2104
2136
|
var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
|
|
2105
2137
|
var element = this.element,
|
|
@@ -2165,7 +2197,8 @@ var methods = {
|
|
|
2165
2197
|
* @param {Object} [pivot] - The pivot point coordinate for zooming.
|
|
2166
2198
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2167
2199
|
* @returns {Viewer} this
|
|
2168
|
-
*/
|
|
2200
|
+
*/
|
|
2201
|
+
zoom: function zoom(ratio) {
|
|
2169
2202
|
var showTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2170
2203
|
var pivot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2171
2204
|
var _originalEvent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
@@ -2187,7 +2220,8 @@ var methods = {
|
|
|
2187
2220
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2188
2221
|
* @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not.
|
|
2189
2222
|
* @returns {Viewer} this
|
|
2190
|
-
*/
|
|
2223
|
+
*/
|
|
2224
|
+
zoomTo: function zoomTo(ratio) {
|
|
2191
2225
|
var _this6 = this;
|
|
2192
2226
|
var showTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2193
2227
|
var pivot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -2293,7 +2327,8 @@ var methods = {
|
|
|
2293
2327
|
* Play the images
|
|
2294
2328
|
* @param {boolean|FullscreenOptions} [fullscreen=false] - Indicate if request fullscreen or not.
|
|
2295
2329
|
* @returns {Viewer} this
|
|
2296
|
-
*/
|
|
2330
|
+
*/
|
|
2331
|
+
play: function play() {
|
|
2297
2332
|
var _this7 = this;
|
|
2298
2333
|
var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2299
2334
|
if (!this.isShown || this.played) {
|
|
@@ -2542,7 +2577,8 @@ var methods = {
|
|
|
2542
2577
|
* Toggle the image size between its current size and natural size
|
|
2543
2578
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2544
2579
|
* @returns {Viewer} this
|
|
2545
|
-
*/
|
|
2580
|
+
*/
|
|
2581
|
+
toggle: function toggle() {
|
|
2546
2582
|
var _originalEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2547
2583
|
if (this.imageData.ratio === 1) {
|
|
2548
2584
|
this.zoomTo(this.imageData.oldRatio, true, null, _originalEvent);
|
|
@@ -2924,6 +2960,7 @@ var Viewer = /*#__PURE__*/function () {
|
|
|
2924
2960
|
this.viewing = false;
|
|
2925
2961
|
this.wheeling = false;
|
|
2926
2962
|
this.zooming = false;
|
|
2963
|
+
this.pointerMoved = false;
|
|
2927
2964
|
this.id = getUniqueID();
|
|
2928
2965
|
this.init();
|
|
2929
2966
|
}
|
package/dist/viewer.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Viewer.js v1.11.
|
|
2
|
+
* Viewer.js v1.11.2
|
|
3
3
|
* https://fengyuanchen.github.io/viewerjs
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*
|
|
8
|
-
* Date:
|
|
8
|
+
* Date: 2023-01-01T10:14:49.638Z
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function (global, factory) {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
56
56
|
descriptor.configurable = true;
|
|
57
57
|
if ("value" in descriptor) descriptor.writable = true;
|
|
58
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
58
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
return Constructor;
|
|
68
68
|
}
|
|
69
69
|
function _defineProperty(obj, key, value) {
|
|
70
|
+
key = _toPropertyKey(key);
|
|
70
71
|
if (key in obj) {
|
|
71
72
|
Object.defineProperty(obj, key, {
|
|
72
73
|
value: value,
|
|
@@ -79,6 +80,20 @@
|
|
|
79
80
|
}
|
|
80
81
|
return obj;
|
|
81
82
|
}
|
|
83
|
+
function _toPrimitive(input, hint) {
|
|
84
|
+
if (typeof input !== "object" || input === null) return input;
|
|
85
|
+
var prim = input[Symbol.toPrimitive];
|
|
86
|
+
if (prim !== undefined) {
|
|
87
|
+
var res = prim.call(input, hint || "default");
|
|
88
|
+
if (typeof res !== "object") return res;
|
|
89
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
90
|
+
}
|
|
91
|
+
return (hint === "string" ? String : Number)(input);
|
|
92
|
+
}
|
|
93
|
+
function _toPropertyKey(arg) {
|
|
94
|
+
var key = _toPrimitive(arg, "string");
|
|
95
|
+
return typeof key === "symbol" ? key : String(key);
|
|
96
|
+
}
|
|
82
97
|
|
|
83
98
|
var DEFAULTS = {
|
|
84
99
|
/**
|
|
@@ -650,7 +665,8 @@
|
|
|
650
665
|
* This setter can fix a `TypeError` in strict mode
|
|
651
666
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
|
|
652
667
|
* @param {boolean} value - The value to set
|
|
653
|
-
*/
|
|
668
|
+
*/
|
|
669
|
+
set: function set(value) {
|
|
654
670
|
once = value;
|
|
655
671
|
}
|
|
656
672
|
});
|
|
@@ -1262,7 +1278,9 @@
|
|
|
1262
1278
|
}
|
|
1263
1279
|
break;
|
|
1264
1280
|
case 'hide':
|
|
1265
|
-
this.
|
|
1281
|
+
if (!this.pointerMoved) {
|
|
1282
|
+
this.hide();
|
|
1283
|
+
}
|
|
1266
1284
|
break;
|
|
1267
1285
|
case 'view':
|
|
1268
1286
|
this.view(getData(target, 'index'));
|
|
@@ -1483,6 +1501,7 @@
|
|
|
1483
1501
|
pointers = this.pointers;
|
|
1484
1502
|
var buttons = event.buttons,
|
|
1485
1503
|
button = event.button;
|
|
1504
|
+
this.pointerMoved = false;
|
|
1486
1505
|
if (!this.viewed || this.showing || this.viewing || this.hiding
|
|
1487
1506
|
|
|
1488
1507
|
// Handle mouse event and pointer event and ignore touch event
|
|
@@ -1522,6 +1541,7 @@
|
|
|
1522
1541
|
return;
|
|
1523
1542
|
}
|
|
1524
1543
|
event.preventDefault();
|
|
1544
|
+
this.pointerMoved = true;
|
|
1525
1545
|
if (event.changedTouches) {
|
|
1526
1546
|
forEach(event.changedTouches, function (touch) {
|
|
1527
1547
|
assign(pointers[touch.identifier] || {}, getPointer(touch, true));
|
|
@@ -1654,7 +1674,8 @@
|
|
|
1654
1674
|
/** Show the viewer (only available in modal mode)
|
|
1655
1675
|
* @param {boolean} [immediate=false] - Indicates if show the viewer immediately or not.
|
|
1656
1676
|
* @returns {Viewer} this
|
|
1657
|
-
*/
|
|
1677
|
+
*/
|
|
1678
|
+
show: function show() {
|
|
1658
1679
|
var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1659
1680
|
var element = this.element,
|
|
1660
1681
|
options = this.options;
|
|
@@ -1713,7 +1734,8 @@
|
|
|
1713
1734
|
* Hide the viewer (only available in modal mode)
|
|
1714
1735
|
* @param {boolean} [immediate=false] - Indicates if hide the viewer immediately or not.
|
|
1715
1736
|
* @returns {Viewer} this
|
|
1716
|
-
*/
|
|
1737
|
+
*/
|
|
1738
|
+
hide: function hide() {
|
|
1717
1739
|
var _this = this;
|
|
1718
1740
|
var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1719
1741
|
var element = this.element,
|
|
@@ -1790,7 +1812,8 @@
|
|
|
1790
1812
|
* View one of the images with image's index
|
|
1791
1813
|
* @param {number} index - The index of the image to view.
|
|
1792
1814
|
* @returns {Viewer} this
|
|
1793
|
-
*/
|
|
1815
|
+
*/
|
|
1816
|
+
view: function view() {
|
|
1794
1817
|
var _this2 = this;
|
|
1795
1818
|
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.initialViewIndex;
|
|
1796
1819
|
index = Number(index) || 0;
|
|
@@ -1929,7 +1952,8 @@
|
|
|
1929
1952
|
* @param {boolean} [loop=false] - Indicate if view the last one
|
|
1930
1953
|
* when it is the first one at present.
|
|
1931
1954
|
* @returns {Viewer} this
|
|
1932
|
-
*/
|
|
1955
|
+
*/
|
|
1956
|
+
prev: function prev() {
|
|
1933
1957
|
var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1934
1958
|
var index = this.index - 1;
|
|
1935
1959
|
if (index < 0) {
|
|
@@ -1943,7 +1967,8 @@
|
|
|
1943
1967
|
* @param {boolean} [loop=false] - Indicate if view the first one
|
|
1944
1968
|
* when it is the last one at present.
|
|
1945
1969
|
* @returns {Viewer} this
|
|
1946
|
-
*/
|
|
1970
|
+
*/
|
|
1971
|
+
next: function next() {
|
|
1947
1972
|
var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1948
1973
|
var maxIndex = this.length - 1;
|
|
1949
1974
|
var index = this.index + 1;
|
|
@@ -1958,7 +1983,8 @@
|
|
|
1958
1983
|
* @param {number} x - The moving distance in the horizontal direction.
|
|
1959
1984
|
* @param {number} [y=x] The moving distance in the vertical direction.
|
|
1960
1985
|
* @returns {Viewer} this
|
|
1961
|
-
*/
|
|
1986
|
+
*/
|
|
1987
|
+
move: function move(x) {
|
|
1962
1988
|
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
|
|
1963
1989
|
var imageData = this.imageData;
|
|
1964
1990
|
this.moveTo(isUndefined(x) ? x : imageData.x + Number(x), isUndefined(y) ? y : imageData.y + Number(y));
|
|
@@ -1970,7 +1996,8 @@
|
|
|
1970
1996
|
* @param {number} [y=x] - The new position in the vertical direction.
|
|
1971
1997
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
1972
1998
|
* @returns {Viewer} this
|
|
1973
|
-
*/
|
|
1999
|
+
*/
|
|
2000
|
+
moveTo: function moveTo(x) {
|
|
1974
2001
|
var _this3 = this;
|
|
1975
2002
|
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
|
|
1976
2003
|
var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -2038,7 +2065,8 @@
|
|
|
2038
2065
|
* Rotate the image with a relative degree.
|
|
2039
2066
|
* @param {number} degree - The rotate degree.
|
|
2040
2067
|
* @returns {Viewer} this
|
|
2041
|
-
*/
|
|
2068
|
+
*/
|
|
2069
|
+
rotate: function rotate(degree) {
|
|
2042
2070
|
this.rotateTo((this.imageData.rotate || 0) + Number(degree));
|
|
2043
2071
|
return this;
|
|
2044
2072
|
},
|
|
@@ -2046,7 +2074,8 @@
|
|
|
2046
2074
|
* Rotate the image to an absolute degree.
|
|
2047
2075
|
* @param {number} degree - The rotate degree.
|
|
2048
2076
|
* @returns {Viewer} this
|
|
2049
|
-
*/
|
|
2077
|
+
*/
|
|
2078
|
+
rotateTo: function rotateTo(degree) {
|
|
2050
2079
|
var _this4 = this;
|
|
2051
2080
|
var element = this.element,
|
|
2052
2081
|
options = this.options,
|
|
@@ -2088,7 +2117,8 @@
|
|
|
2088
2117
|
* Scale the image on the x-axis.
|
|
2089
2118
|
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
2090
2119
|
* @returns {Viewer} this
|
|
2091
|
-
*/
|
|
2120
|
+
*/
|
|
2121
|
+
scaleX: function scaleX(_scaleX) {
|
|
2092
2122
|
this.scale(_scaleX, this.imageData.scaleY);
|
|
2093
2123
|
return this;
|
|
2094
2124
|
},
|
|
@@ -2096,7 +2126,8 @@
|
|
|
2096
2126
|
* Scale the image on the y-axis.
|
|
2097
2127
|
* @param {number} scaleY - The scale ratio on the y-axis.
|
|
2098
2128
|
* @returns {Viewer} this
|
|
2099
|
-
*/
|
|
2129
|
+
*/
|
|
2130
|
+
scaleY: function scaleY(_scaleY) {
|
|
2100
2131
|
this.scale(this.imageData.scaleX, _scaleY);
|
|
2101
2132
|
return this;
|
|
2102
2133
|
},
|
|
@@ -2105,7 +2136,8 @@
|
|
|
2105
2136
|
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
2106
2137
|
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
|
|
2107
2138
|
* @returns {Viewer} this
|
|
2108
|
-
*/
|
|
2139
|
+
*/
|
|
2140
|
+
scale: function scale(scaleX) {
|
|
2109
2141
|
var _this5 = this;
|
|
2110
2142
|
var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
|
|
2111
2143
|
var element = this.element,
|
|
@@ -2171,7 +2203,8 @@
|
|
|
2171
2203
|
* @param {Object} [pivot] - The pivot point coordinate for zooming.
|
|
2172
2204
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2173
2205
|
* @returns {Viewer} this
|
|
2174
|
-
*/
|
|
2206
|
+
*/
|
|
2207
|
+
zoom: function zoom(ratio) {
|
|
2175
2208
|
var showTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2176
2209
|
var pivot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2177
2210
|
var _originalEvent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
@@ -2193,7 +2226,8 @@
|
|
|
2193
2226
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2194
2227
|
* @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not.
|
|
2195
2228
|
* @returns {Viewer} this
|
|
2196
|
-
*/
|
|
2229
|
+
*/
|
|
2230
|
+
zoomTo: function zoomTo(ratio) {
|
|
2197
2231
|
var _this6 = this;
|
|
2198
2232
|
var showTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2199
2233
|
var pivot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -2299,7 +2333,8 @@
|
|
|
2299
2333
|
* Play the images
|
|
2300
2334
|
* @param {boolean|FullscreenOptions} [fullscreen=false] - Indicate if request fullscreen or not.
|
|
2301
2335
|
* @returns {Viewer} this
|
|
2302
|
-
*/
|
|
2336
|
+
*/
|
|
2337
|
+
play: function play() {
|
|
2303
2338
|
var _this7 = this;
|
|
2304
2339
|
var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2305
2340
|
if (!this.isShown || this.played) {
|
|
@@ -2548,7 +2583,8 @@
|
|
|
2548
2583
|
* Toggle the image size between its current size and natural size
|
|
2549
2584
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
2550
2585
|
* @returns {Viewer} this
|
|
2551
|
-
*/
|
|
2586
|
+
*/
|
|
2587
|
+
toggle: function toggle() {
|
|
2552
2588
|
var _originalEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2553
2589
|
if (this.imageData.ratio === 1) {
|
|
2554
2590
|
this.zoomTo(this.imageData.oldRatio, true, null, _originalEvent);
|
|
@@ -2930,6 +2966,7 @@
|
|
|
2930
2966
|
this.viewing = false;
|
|
2931
2967
|
this.wheeling = false;
|
|
2932
2968
|
this.zooming = false;
|
|
2969
|
+
this.pointerMoved = false;
|
|
2933
2970
|
this.id = getUniqueID();
|
|
2934
2971
|
this.init();
|
|
2935
2972
|
}
|
package/dist/viewer.min.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Viewer.js v1.11.
|
|
2
|
+
* Viewer.js v1.11.2
|
|
3
3
|
* https://fengyuanchen.github.io/viewerjs
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*
|
|
8
|
-
* Date:
|
|
8
|
+
* Date: 2023-01-01T10:14:47.694Z
|
|
9
9
|
*/.viewer-close:before,.viewer-flip-horizontal:before,.viewer-flip-vertical:before,.viewer-fullscreen-exit:before,.viewer-fullscreen:before,.viewer-next:before,.viewer-one-to-one:before,.viewer-play:before,.viewer-prev:before,.viewer-reset:before,.viewer-rotate-left:before,.viewer-rotate-right:before,.viewer-zoom-in:before,.viewer-zoom-out:before{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAAUCAYAAABWOyJDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAQPSURBVHic7Zs/iFxVFMa/0U2UaJGksUgnIVhYxVhpjDbZCBmLdAYECxsRFBTUamcXUiSNncgKQbSxsxH8gzAP3FU2jY0kKKJNiiiIghFlccnP4p3nPCdv3p9778vsLOcHB2bfveeb7955c3jvvNkBIMdxnD64a94GHMfZu3iBcRynN7zAOI7TG15gHCeeNUkr8zaxG2lbYDYsdgMbktBsP03jdQwljSXdtBhLOmtjowC9Mg9L+knSlcD8TNKpSA9lBpK2JF2VdDSR5n5J64m0qli399hNFMUlpshQii5jbXTbHGviB0nLNeNDSd9VO4A2UdB2fp+x0eCnaXxWXGA2X0au/3HgN9P4LFCjIANOJdrLr0zzZ+BEpNYDwKbpnQMeAw4m8HjQtM6Z9qa917zPQwFr3M5KgA6J5rTJCdFZJj9/lyvGhsDvwFNVuV2MhhjrK6b9bFiE+j1r87eBl4HDwCF7/U/k+ofAX5b/EXBv5JoLMuILzf3Ap6Z3EzgdqHMCuF7hcQf4HDgeoHnccncqdK/TvSDWffFXI/exICY/xZyqc6XLWF1UFZna4gJ7q8BsRvgd2/xXpo6P+D9dfT7PpECtA3cnWPM0GXGFZh/wgWltA+cDNC7X+AP4GzjZQe+k5dRxuYPeiuXU7e1qwLpDz7dFjXKRaSwuMLvAlG8zZlG+YmiK1HoFqT7wP2z+4Q45TfEGcMt01xLoNZEBTwRqD4BLpnMLeC1A41UmVxsXgXeBayV/Wx20rpTyrpnWRft7p6O/FdqzGrDukPNtkaMoMo3FBdBSQMOnYBCReyf05s126fU9ytfX98+mY54Kxnp7S9K3kj6U9KYdG0h6UdLbkh7poFXMfUnSOyVvL0h6VtIXHbS6nOP+s/Zm9mvyXW1uuC9ohZ72E9uDmXWLJOB1GxsH+DxPftsB8B6wlGDN02TAkxG6+4D3TWsbeC5CS8CDFce+AW500LhhOW2020TRjK3b21HEmgti9m0RonxbdMZeVzV+/4tF3cBpP7E9mKHNL5q8h5g0eYsCMQz0epq8gQrwMXAgcs0FGXGFRcB9wCemF9PkbYqM/Bas7fxLwNeJPdTdpo4itQti8lPMqTpXuozVRVXPpbHI3KkNTB1NfkL81j2mvhDp91HgV9MKuRIqrykj3WPq4rHyL+axj8/qGPmTqi6F9YDlHOvJU6oYcTsh/TYSzWmTE6JT19CtLTJt32D6CmHe0eQn1O8z5AXgT4sx4Vcu0/EQecMydB8z0hUWkTd2t4CrwNEePqMBcAR4mrBbwyXLPWJa8zrXmmLEhNBmfpkuY2102xxrih+pb+ieAb6vGhuA97UcJ5KR8gZ77K+99xxeYBzH6Q3/Z0fHcXrDC4zjOL3hBcZxnN74F+zlvXFWXF9PAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-size:280px;color:transparent;display:block;font-size:0;height:20px;line-height:0;width:20px}.viewer-zoom-in:before{background-position:0 0;content:"Zoom In"}.viewer-zoom-out:before{background-position:-20px 0;content:"Zoom Out"}.viewer-one-to-one:before{background-position:-40px 0;content:"One to One"}.viewer-reset:before{background-position:-60px 0;content:"Reset"}.viewer-prev:before{background-position:-80px 0;content:"Previous"}.viewer-play:before{background-position:-100px 0;content:"Play"}.viewer-next:before{background-position:-120px 0;content:"Next"}.viewer-rotate-left:before{background-position:-140px 0;content:"Rotate Left"}.viewer-rotate-right:before{background-position:-160px 0;content:"Rotate Right"}.viewer-flip-horizontal:before{background-position:-180px 0;content:"Flip Horizontal"}.viewer-flip-vertical:before{background-position:-200px 0;content:"Flip Vertical"}.viewer-fullscreen:before{background-position:-220px 0;content:"Enter Full Screen"}.viewer-fullscreen-exit:before{background-position:-240px 0;content:"Exit Full Screen"}.viewer-close:before{background-position:-260px 0;content:"Close"}.viewer-container{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;bottom:0;direction:ltr;font-size:0;left:0;line-height:0;overflow:hidden;position:absolute;right:0;top:0;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.viewer-container ::-moz-selection,.viewer-container::-moz-selection{background-color:transparent}.viewer-container ::selection,.viewer-container::selection{background-color:transparent}.viewer-container:focus{outline:0}.viewer-container img{display:block;height:auto;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.viewer-canvas{bottom:0;left:0;overflow:hidden;position:absolute;right:0;top:0}.viewer-canvas>img{height:auto;margin:15px auto;max-width:90%!important;width:auto}.viewer-footer{bottom:0;left:0;overflow:hidden;position:absolute;right:0;text-align:center}.viewer-navbar{background-color:rgba(0,0,0,.5);overflow:hidden}.viewer-list{box-sizing:content-box;height:50px;margin:0;overflow:hidden;padding:1px 0}.viewer-list>li{color:transparent;cursor:pointer;float:left;font-size:0;height:50px;line-height:0;opacity:.5;overflow:hidden;transition:opacity .15s;width:30px}.viewer-list>li:focus,.viewer-list>li:hover{opacity:.75}.viewer-list>li:focus{outline:0}.viewer-list>li+li{margin-left:1px}.viewer-list>.viewer-loading{position:relative}.viewer-list>.viewer-loading:after{border-width:2px;height:20px;margin-left:-10px;margin-top:-10px;width:20px}.viewer-list>.viewer-active,.viewer-list>.viewer-active:focus,.viewer-list>.viewer-active:hover{opacity:1}.viewer-player{background-color:#000;bottom:0;cursor:none;display:none;right:0;z-index:1}.viewer-player,.viewer-player>img{left:0;position:absolute;top:0}.viewer-toolbar>ul{display:inline-block;margin:0 auto 5px;overflow:hidden;padding:6px 3px}.viewer-toolbar>ul>li{background-color:rgba(0,0,0,.5);border-radius:50%;cursor:pointer;float:left;height:24px;overflow:hidden;transition:background-color .15s;width:24px}.viewer-toolbar>ul>li:focus,.viewer-toolbar>ul>li:hover{background-color:rgba(0,0,0,.8)}.viewer-toolbar>ul>li:focus{box-shadow:0 0 3px #fff;outline:0;position:relative;z-index:1}.viewer-toolbar>ul>li:before{margin:2px}.viewer-toolbar>ul>li+li{margin-left:1px}.viewer-toolbar>ul>.viewer-small{height:18px;margin-bottom:3px;margin-top:3px;width:18px}.viewer-toolbar>ul>.viewer-small:before{margin:-1px}.viewer-toolbar>ul>.viewer-large{height:30px;margin-bottom:-3px;margin-top:-3px;width:30px}.viewer-toolbar>ul>.viewer-large:before{margin:5px}.viewer-tooltip{background-color:rgba(0,0,0,.8);border-radius:10px;color:#fff;display:none;font-size:12px;height:20px;left:50%;line-height:20px;margin-left:-25px;margin-top:-10px;position:absolute;text-align:center;top:50%;width:50px}.viewer-title{color:#ccc;display:inline-block;font-size:12px;line-height:1.2;margin:5px 5%;max-width:90%;min-height:14px;opacity:.8;overflow:hidden;text-overflow:ellipsis;transition:opacity .15s;white-space:nowrap}.viewer-title:hover{opacity:1}.viewer-button{-webkit-app-region:no-drag;background-color:rgba(0,0,0,.5);border-radius:50%;cursor:pointer;height:80px;overflow:hidden;position:absolute;right:-40px;top:-40px;transition:background-color .15s;width:80px}.viewer-button:focus,.viewer-button:hover{background-color:rgba(0,0,0,.8)}.viewer-button:focus{box-shadow:0 0 3px #fff;outline:0}.viewer-button:before{bottom:15px;left:15px;position:absolute}.viewer-fixed{position:fixed}.viewer-open{overflow:hidden}.viewer-show{display:block}.viewer-hide{display:none}.viewer-backdrop{background-color:rgba(0,0,0,.5)}.viewer-invisible{visibility:hidden}.viewer-move{cursor:move;cursor:grab}.viewer-fade{opacity:0}.viewer-in{opacity:1}.viewer-transition{transition:all .3s}@keyframes viewer-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.viewer-loading:after{animation:viewer-spinner 1s linear infinite;border:4px solid hsla(0,0%,100%,.1);border-left-color:hsla(0,0%,100%,.5);border-radius:50%;content:"";display:inline-block;height:40px;left:50%;margin-left:-20px;margin-top:-20px;position:absolute;top:50%;width:40px;z-index:1}@media (max-width:767px){.viewer-hide-xs-down{display:none}}@media (max-width:991px){.viewer-hide-sm-down{display:none}}@media (max-width:1199px){.viewer-hide-md-down{display:none}}
|
package/dist/viewer.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Viewer.js v1.11.
|
|
2
|
+
* Viewer.js v1.11.2
|
|
3
3
|
* https://fengyuanchen.github.io/viewerjs
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*
|
|
8
|
-
* Date:
|
|
8
|
+
* Date: 2023-01-01T10:14:49.638Z
|
|
9
9
|
*/
|
|
10
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Viewer=e()}(this,function(){"use strict";function s(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function q(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach(function(t){var e,i;e=n,i=o[t=t],t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var l={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:.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:.1,minZoomRatio:.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},t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{},a=!(!t||!e.document.documentElement)&&"ontouchstart"in e.document.documentElement,i=t&&"PointerEvent"in e,g="viewer",h="move",W="switch",c="zoom",f="".concat(g,"-active"),j="".concat(g,"-close"),H="".concat(g,"-fade"),B="".concat(g,"-fixed"),V="".concat(g,"-fullscreen"),U="".concat(g,"-fullscreen-exit"),v="".concat(g,"-hide"),K="".concat(g,"-hide-md-down"),Z="".concat(g,"-hide-sm-down"),$="".concat(g,"-hide-xs-down"),u="".concat(g,"-in"),p="".concat(g,"-invisible"),b="".concat(g,"-loading"),_="".concat(g,"-move"),G="".concat(g,"-open"),d="".concat(g,"-show"),m="".concat(g,"-transition"),w="click",J="dblclick",Q="dragstart",tt="focusin",et="keydown",y="load",x="error",it=i?"pointerdown":a?"touchstart":"mousedown",nt=i?"pointermove":a?"touchmove":"mousemove",ot=i?"pointerup pointercancel":a?"touchend touchcancel":"mouseup",st="resize",k="transitionend",at="wheel",rt="ready",lt="show",z="viewed",ht="rotated",ct="".concat(g,"Action"),ut=/\s\s*/,dt=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function T(t){return"string"==typeof t}var mt=Number.isNaN||e.isNaN;function E(t){return"number"==typeof t&&!mt(t)}function D(t){return void 0===t}function o(t){return"object"===n(t)&&null!==t}var gt=Object.prototype.hasOwnProperty;function I(t){if(!o(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&>.call(i,"isPrototypeOf")}catch(t){return!1}}function A(t){return"function"==typeof t}function S(e,i){if(e&&A(i))if(Array.isArray(e)||E(e.length))for(var t=e.length,n=0;n<t&&!1!==i.call(e,e[n],n,e);n+=1);else o(e)&&Object.keys(e).forEach(function(t){i.call(e,e[t],t,e)})}var O=Object.assign||function(i){for(var t=arguments.length,e=new Array(1<t?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return o(i)&&0<e.length&&e.forEach(function(e){o(e)&&Object.keys(e).forEach(function(t){i[t]=e[t]})}),i},ft=/^(?:width|height|left|top|marginLeft|marginTop)$/;function C(t,e){var i=t.style;S(e,function(t,e){ft.test(e)&&E(t)&&(t+="px"),i[e]=t})}function L(t,e){return t&&e&&(t.classList?t.classList.contains(e):-1<t.className.indexOf(e))}function R(t,e){var i;t&&e&&(E(t.length)?S(t,function(t){R(t,e)}):t.classList?t.classList.add(e):(i=t.className.trim())?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e)}function F(t,e){t&&e&&(E(t.length)?S(t,function(t){F(t,e)}):t.classList?t.classList.remove(e):0<=t.className.indexOf(e)&&(t.className=t.className.replace(e,"")))}function N(t,e,i){e&&(E(t.length)?S(t,function(t){N(t,e,i)}):(i?R:F)(t,e))}var vt=/([a-z\d])([A-Z])/g;function pt(t){return t.replace(vt,"$1-$2").toLowerCase()}function Y(t,e){return o(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(pt(e)))}function bt(t,e,i){o(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(pt(e)),i)}yt=!1,t&&(wt=!1,i=function(){},t=Object.defineProperty({},"once",{get:function(){return yt=!0,wt},set:function(t){wt=t}}),e.addEventListener("test",i,t),e.removeEventListener("test",i,t));var wt,yt,xt=yt;function M(i,t,n,e){var o=3<arguments.length&&void 0!==e?e:{},s=n;t.trim().split(ut).forEach(function(t){var e;xt||(e=i.listeners)&&e[t]&&e[t][n]&&(s=e[t][n],delete e[t][n],0===Object.keys(e[t]).length&&delete e[t],0===Object.keys(e).length&&delete i.listeners),i.removeEventListener(t,s,o)})}function X(s,t,a,e){var r=3<arguments.length&&void 0!==e?e:{},l=a;t.trim().split(ut).forEach(function(n){var t,o;r.once&&!xt&&(t=s.listeners,l=function(){delete o[n][a],s.removeEventListener(n,l,r);for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];a.apply(s,e)},(o=void 0===t?{}:t)[n]||(o[n]={}),o[n][a]&&s.removeEventListener(n,o[n][a],r),o[n][a]=l,s.listeners=o),s.addEventListener(n,l,r)})}function P(t,e,i,n){var o;return A(Event)&&A(CustomEvent)?o=new CustomEvent(e,q({bubbles:!0,cancelable:!0,detail:i},n)):(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(o)}function kt(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,o=t.translateX,t=t.translateY,s=[],o=(E(o)&&0!==o&&s.push("translateX(".concat(o,"px)")),E(t)&&0!==t&&s.push("translateY(".concat(t,"px)")),E(e)&&0!==e&&s.push("rotate(".concat(e,"deg)")),E(i)&&1!==i&&s.push("scaleX(".concat(i,")")),E(n)&&1!==n&&s.push("scaleY(".concat(n,")")),s.length?s.join(" "):"none");return{WebkitTransform:o,msTransform:o,transform:o}}var zt=e.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(e.navigator.userAgent);function Tt(i,t,e){var n,o=document.createElement("img");return i.naturalWidth&&!zt?e(i.naturalWidth,i.naturalHeight):(n=document.body||document.documentElement,o.onload=function(){e(o.width,o.height),zt||n.removeChild(o)},S(t.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&o.setAttribute(t,e)}),o.src=i.src,zt||(o.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;",n.appendChild(o))),o}function Et(t){switch(t){case 2:return $;case 3:return Z;case 4:return K;default:return""}}function Dt(t,e){var i=t.pageX,t=t.pageY,n={endX:i,endY:t};return e?n:q({timeStamp:Date.now(),startX:i,startY:t},n)}var It,i={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var t=this.element.ownerDocument,e=t.body||t.documentElement;this.body=e,this.scrollbarWidth=window.innerWidth-t.documentElement.clientWidth,this.initialBodyPaddingRight=e.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(e).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var t,e=this.options,i=this.parent;e.inline&&(t={width:Math.max(i.offsetWidth,e.minWidth),height:Math.max(i.offsetHeight,e.minHeight)},this.parentData=t),!this.fulled&&t||(t=this.containerData),this.viewerData=O({},t)},renderViewer:function(){this.options.inline&&!this.fulled&&C(this.viewer,this.viewerData)},initList:function(){var r=this,t=this.element,l=this.options,h=this.list,c=[];h.innerHTML="",S(this.images,function(i,t){var e,n,o=i.src,s=i.alt||(T(s=o)?decodeURIComponent(s.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""),a=r.getImageURL(i);(o||a)&&(e=document.createElement("li"),n=document.createElement("img"),S(l.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&n.setAttribute(t,e)}),l.navbar&&(n.src=o||a),n.alt=s,n.setAttribute("data-original-url",a||o),e.setAttribute("data-index",t),e.setAttribute("data-viewer-action","view"),e.setAttribute("role","button"),l.keyboard&&e.setAttribute("tabindex",0),e.appendChild(n),h.appendChild(e),c.push(e))}),S(this.items=c,function(e){var t,i,n=e.firstElementChild;bt(n,"filled",!0),l.loading&&R(e,b),X(n,y,t=function(t){M(n,x,i),l.loading&&F(e,b),r.loadImage(t)},{once:!0}),X(n,x,i=function(){M(n,y,t),l.loading&&F(e,b)},{once:!0})}),l.transition&&X(t,z,function(){R(h,m)},{once:!0})},renderList:function(){var t,e,i=this.index,n=this.items[i];n&&(t=n.nextElementSibling,t=parseInt(window.getComputedStyle(t||n).marginLeft,10),n=n.offsetWidth,C(this.list,O({width:(e=n+t)*this.length-t},kt({translateX:(this.viewerData.width-n)/2-e*i}))))},resetList:function(){var t=this.list;t.innerHTML="",F(t,m),C(t,kt({translateX:0}))},initImage:function(r){var t,l=this,h=this.options,e=this.image,i=this.viewerData,n=this.footer.offsetHeight,c=i.width,u=Math.max(i.height-n,n),d=this.imageData||{};this.imageInitializing={abort:function(){t.onload=null}},t=Tt(e,h,function(t,e){var i=t/e,n=Math.max(0,Math.min(1,h.initialCoverage)),o=c,s=u,n=(l.imageInitializing=!1,c<u*i?s=c/i:o=u*i,n=E(n)?n:.9,o=Math.min(o*n,t),s=Math.min(s*n,e),(c-o)/2),a=(u-s)/2,n={left:n,top:a,x:n,y:a,width:o,height:s,oldRatio:1,ratio:o/t,aspectRatio:i,naturalWidth:t,naturalHeight:e},a=O({},n);h.rotatable&&(n.rotate=d.rotate||0,a.rotate=0),h.scalable&&(n.scaleX=d.scaleX||1,n.scaleY=d.scaleY||1,a.scaleX=1,a.scaleY=1),l.imageData=n,l.initialImageData=a,r&&r()})},renderImage:function(t){var e,i=this,n=this.image,o=this.imageData;C(n,O({width:o.width,height:o.height,marginLeft:o.x,marginTop:o.y},kt(o))),t&&((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&L(n,m)?(e=function(){i.imageRendering=!1,t()},this.imageRendering={abort:function(){M(n,k,e)}},X(n,k,e,{once:!0})):t())},resetImage:function(){var t;(this.viewing||this.viewed)&&(t=this.image,this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null)}},t={bind:function(){var t=this.options,e=this.viewer,i=this.canvas,n=this.element.ownerDocument;X(e,w,this.onClick=this.click.bind(this)),X(e,Q,this.onDragStart=this.dragstart.bind(this)),X(i,it,this.onPointerDown=this.pointerdown.bind(this)),X(n,nt,this.onPointerMove=this.pointermove.bind(this)),X(n,ot,this.onPointerUp=this.pointerup.bind(this)),X(n,et,this.onKeyDown=this.keydown.bind(this)),X(window,st,this.onResize=this.resize.bind(this)),t.zoomable&&t.zoomOnWheel&&X(e,at,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleOnDblclick&&X(i,J,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var t=this.options,e=this.viewer,i=this.canvas,n=this.element.ownerDocument;M(e,w,this.onClick),M(e,Q,this.onDragStart),M(i,it,this.onPointerDown),M(n,nt,this.onPointerMove),M(n,ot,this.onPointerUp),M(n,et,this.onKeyDown),M(window,st,this.onResize),t.zoomable&&t.zoomOnWheel&&M(e,at,this.onWheel,{passive:!1,capture:!0}),t.toggleOnDblclick&&M(i,J,this.onDblclick)}},At={click:function(t){var e=this.options,i=this.imageData,n=t.target,o=Y(n,ct);switch(o||"img"!==n.localName||"li"!==n.parentElement.localName||(o=Y(n=n.parentElement,ct)),a&&t.isTrusted&&n===this.canvas&&clearTimeout(this.clickCanvasTimeout),o){case"mix":this.played?this.stop():e.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.hide();break;case"view":this.view(Y(n,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(e.loop);break;case"play":this.play(e.fullscreen);break;case"next":this.next(e.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-i.scaleX||-1);break;case"flip-vertical":this.scaleY(-i.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(t){t.preventDefault(),this.viewed&&t.target===this.image&&(a&&t.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(t.isTrusted?t:t.detail&&t.detail.originalEvent))},load:function(){var t=this,e=(this.timeout&&(clearTimeout(this.timeout),this.timeout=!1),this.element),i=this.options,n=this.image,o=this.index,s=this.viewerData;F(n,p),i.loading&&F(this.canvas,b),n.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(){N(n,_,i.movable),N(n,m,i.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,A(i.viewed)&&X(e,z,i.viewed,{once:!0}),P(e,z,{originalImage:t.images[o],index:o,image:n},{cancelable:!1})})})},loadImage:function(t){var n=t.target,t=n.parentNode,o=t.offsetWidth||30,s=t.offsetHeight||50,a=!!Y(n,"filled");Tt(n,this.options,function(t,e){var t=t/e,e=o,i=s;o<s*t?a?e=s*t:i=o/t:a?i=o/t:e=s*t,C(n,O({width:e,height:i},kt({translateX:(o-e)/2,translateY:(s-i)/2})))})},keydown:function(t){var e=this.options;if(e.keyboard){var i=t.keyCode||t.which||t.charCode;if(13===i&&this.viewer.contains(t.target)&&this.click(t),this.fulled)switch(i){case 27:this.played?this.stop():e.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(e.loop);break;case 38:t.preventDefault(),this.zoom(e.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(e.loop);break;case 40:t.preventDefault(),this.zoom(-e.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle())}}},dragstart:function(t){"img"===t.target.localName&&t.preventDefault()},pointerdown:function(t){var e=this.options,i=this.pointers,n=t.buttons,o=t.button;!this.viewed||this.showing||this.viewing||this.hiding||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(E(n)&&1!==n||E(o)&&0!==o||t.ctrlKey)||(t.preventDefault(),t.changedTouches?S(t.changedTouches,function(t){i[t.identifier]=Dt(t)}):i[t.pointerId||0]=Dt(t),n=!!e.movable&&h,e.zoomOnTouch&&e.zoomable&&1<Object.keys(i).length?n=c:e.slideOnTouch&&("touch"===t.pointerType||"touchstart"===t.type)&&this.isSwitchable()&&(n=W),!e.transition||n!==h&&n!==c||F(this.image,m),this.action=n)},pointermove:function(t){var e=this.pointers,i=this.action;this.viewed&&i&&(t.preventDefault(),t.changedTouches?S(t.changedTouches,function(t){O(e[t.identifier]||{},Dt(t,!0))}):O(e[t.pointerId||0]||{},Dt(t,!0)),this.change(t))},pointerup:function(t){var e,i=this,n=this.options,o=this.action,s=this.pointers;t.changedTouches?S(t.changedTouches,function(t){e=s[t.identifier],delete s[t.identifier]}):(e=s[t.pointerId||0],delete s[t.pointerId||0]),o&&(t.preventDefault(),!n.transition||o!==h&&o!==c||R(this.image,m),this.action=!1,a&&o!==c&&e&&Date.now()-e.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(){P(i.image,J,{originalEvent:t})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){i.imageClicked=!1},500)):(this.imageClicked=!1,n.backdrop&&"static"!==n.backdrop&&t.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){P(i.canvas,w,{originalEvent:t})},50)))))},resize:function(){var e=this;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(){e.renderImage()}),this.played&&(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)?this.stop():S(this.player.getElementsByTagName("img"),function(t){X(t,y,e.loadImage.bind(e),{once:!0}),P(t,y)})))},wheel:function(t){var e,i,n=this;this.viewed&&(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout(function(){n.wheeling=!1},50),e=Number(this.options.zoomRatio)||.1,i=1,t.deltaY?i=0<t.deltaY?1:-1:t.wheelDelta?i=-t.wheelDelta/120:t.detail&&(i=0<t.detail?1:-1),this.zoom(-i*e,!0,null,t)))}},St={show:function(){var t,e,i=0<arguments.length&&void 0!==arguments[0]&&arguments[0],n=this.element,o=this.options;return o.inline||this.showing||this.isShown||this.showing||(this.ready?(A(o.show)&&X(n,lt,o.show,{once:!0}),!1!==P(n,lt)&&this.ready&&(this.hiding&&this.transitioning.abort(),this.showing=!0,this.open(),F(t=this.viewer,v),t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",this.title.id),t.setAttribute("aria-modal",!0),t.removeAttribute("aria-hidden"),o.transition&&!i?(e=this.shown.bind(this),this.transitioning={abort:function(){M(t,k,e),F(t,u)}},R(t,m),t.initialOffsetWidth=t.offsetWidth,X(t,k,e,{once:!0}),R(t,u)):(R(t,u),this.shown()))):(this.build(),this.ready&&this.show(i))),this},hide:function(){var i,t,e,n,o,s=this,a=0<arguments.length&&void 0!==arguments[0]&&arguments[0],r=this.element,l=this.options;return l.inline||this.hiding||!this.isShown&&!this.showing||(A(l.hide)&&X(r,"hide",l.hide,{once:!0}),!1!==P(r,"hide")&&(this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort(),i=this.viewer,t=this.image,e=function(){F(i,u),s.hidden()},l.transition&&!a?(n=function t(e){e&&e.target===i&&(M(i,k,t),s.hidden())},o=function(){L(i,m)?(X(i,k,n),F(i,u)):e()},this.transitioning={abort:function(){s.viewed&&L(t,m)?M(t,k,o):L(i,m)&&M(i,k,n)}},this.viewed&&L(t,m)?(X(t,k,o,{once:!0}),this.zoomTo(0,!1,null,null,!0)):o()):e())),this},view:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.options.initialViewIndex,t=Number(t)||0;if(!(this.hiding||this.played||t<0||t>=this.length||this.viewed&&t===this.index)){if(!this.isShown)return this.index=t,this.show();this.viewing&&this.viewing.abort();var e,n,o,s=this.element,a=this.options,r=this.title,l=this.canvas,h=this.items[t],c=h.querySelector("img"),u=Y(c,"originalUrl"),d=c.getAttribute("alt"),m=document.createElement("img");S(a.inheritedAttributes,function(t){var e=c.getAttribute(t);null!==e&&m.setAttribute(t,e)}),m.src=u,m.alt=d,A(a.view)&&X(s,"view",a.view,{once:!0}),!1===P(s,"view",{originalImage:this.images[t],index:t,image:m})||!this.isShown||this.hiding||this.played||((u=this.items[this.index])&&(F(u,f),u.removeAttribute("aria-selected")),R(h,f),h.setAttribute("aria-selected",!0),a.focus&&h.focus(),this.image=m,this.viewed=!1,this.index=t,this.imageData={},R(m,p),a.loading&&R(l,b),l.innerHTML="",l.appendChild(m),this.renderList(),r.innerHTML="",X(s,z,e=function(){var t=i.imageData,e=Array.isArray(a.title)?a.title[1]:a.title;r.innerHTML=T(e=A(e)?e.call(i,m,t):"".concat(d," (").concat(t.naturalWidth," × ").concat(t.naturalHeight,")"))?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"):e},{once:!0}),this.viewing={abort:function(){M(s,z,e),m.complete?i.imageRendering?i.imageRendering.abort():i.imageInitializing&&i.imageInitializing.abort():(m.src="",M(m,y,n),i.timeout&&clearTimeout(i.timeout))}},m.complete?this.load():(X(m,y,n=function(){M(m,x,o),i.load()},{once:!0}),X(m,x,o=function(){M(m,y,n),i.timeout&&(clearTimeout(i.timeout),i.timeout=!1),F(m,p),a.loading&&F(i.canvas,b)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){F(m,p),i.timeout=!1},1e3)))}return this},prev:function(){var t=this.index-1;return t<0&&(t=0<arguments.length&&void 0!==arguments[0]&&arguments[0]?this.length-1:0),this.view(t),this},next:function(){var t=this.length-1,e=this.index+1;return this.view(e=t<e?0<arguments.length&&void 0!==arguments[0]&&arguments[0]?0:t:e),this},move:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData;return this.moveTo(D(t)?t:i.x+Number(t),D(e)?e:i.y+Number(e)),this},moveTo:function(t){var e=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,o=this.element,s=this.options,a=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&s.movable){var r=a.x,l=a.y,h=!1;if(E(t)?h=!0:t=r,E(i)?h=!0:i=l,h){if(A(s.move)&&X(o,"move",s.move,{once:!0}),!1===P(o,"move",{x:t,y:i,oldX:r,oldY:l,originalEvent:n}))return this;a.x=t,a.y=i,a.left=t,a.top=i,this.moving=!0,this.renderImage(function(){e.moving=!1,A(s.moved)&&X(o,"moved",s.moved,{once:!0}),P(o,"moved",{x:t,y:i,oldX:r,oldY:l,originalEvent:n},{cancelable:!1})})}}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var e=this,i=this.element,n=this.options,o=this.imageData;if(E(t=Number(t))&&this.viewed&&!this.played&&n.rotatable){var s=o.rotate;if(A(n.rotate)&&X(i,"rotate",n.rotate,{once:!0}),!1===P(i,"rotate",{degree:t,oldDegree:s}))return this;o.rotate=t,this.rotating=!0,this.renderImage(function(){e.rotating=!1,A(n.rotated)&&X(i,ht,n.rotated,{once:!0}),P(i,ht,{degree:t,oldDegree:s},{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 e=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=this.element,o=this.options,s=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&o.scalable){var a=s.scaleX,r=s.scaleY,l=!1;if(E(t)?l=!0:t=a,E(i)?l=!0:i=r,l){if(A(o.scale)&&X(n,"scale",o.scale,{once:!0}),!1===P(n,"scale",{scaleX:t,scaleY:i,oldScaleX:a,oldScaleY:r}))return this;s.scaleX=t,s.scaleY=i,this.scaling=!0,this.renderImage(function(){e.scaling=!1,A(o.scaled)&&X(n,"scaled",o.scaled,{once:!0}),P(n,"scaled",{scaleX:t,scaleY:i,oldScaleX:a,oldScaleY:r},{cancelable:!1})})}}return this},zoom:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,o=this.imageData;return t=Number(t),this.zoomTo(o.width*(t=t<0?1/(1-t):1+t)/o.naturalWidth,e,i,n),this},zoomTo:function(t){var i,n,o,e=this,s=1<arguments.length&&void 0!==arguments[1]&&arguments[1],a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,l=4<arguments.length&&void 0!==arguments[4]&&arguments[4],h=this.element,c=this.options,u=this.pointers,d=this.imageData,m=d.x,g=d.y,f=d.width,v=d.height,p=d.naturalWidth,b=d.naturalHeight;if(E(t=Math.max(0,t))&&this.viewed&&!this.played&&(l||c.zoomable)){if(l||(l=Math.max(.01,c.minZoomRatio),y=Math.min(100,c.maxZoomRatio),t=Math.min(Math.max(t,l),y)),r)switch(r.type){case"wheel":.055<=c.zoomRatio&&.95<t&&t<1.05&&(t=1);break;case"pointermove":case"touchmove":case"mousemove":.99<t&&t<1.01&&(t=1)}var w,l=p*t,y=b*t,p=l-f,b=y-v,x=d.ratio;if(A(c.zoom)&&X(h,"zoom",c.zoom,{once:!0}),!1===P(h,"zoom",{ratio:t,oldRatio:x,originalEvent:r}))return this;this.zooming=!0,r?(w={left:(w=(w=this.viewer).getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:w.top+(window.pageYOffset-document.documentElement.clientTop)},u=u&&0<Object.keys(u).length?(o=n=i=0,S(u,function(t){var e=t.startX,t=t.startY;i+=e,n+=t,o+=1}),{pageX:i/=o,pageY:n/=o}):{pageX:r.pageX,pageY:r.pageY},d.x-=(u.pageX-w.left-m)/f*p,d.y-=(u.pageY-w.top-g)/v*b):I(a)&&E(a.x)&&E(a.y)?(d.x-=p*((a.x-m)/f),d.y-=b*((a.y-g)/v)):(d.x-=p/2,d.y-=b/2),d.left=d.x,d.top=d.y,d.width=l,d.height=y,d.oldRatio=x,d.ratio=t,this.renderImage(function(){e.zooming=!1,A(c.zoomed)&&X(h,"zoomed",c.zoomed,{once:!0}),P(h,"zoomed",{ratio:t,oldRatio:x,originalEvent:r},{cancelable:!1})}),s&&this.tooltip()}return this},play:function(){var o,s,a,r,l,h,t,e=this,i=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this.isShown&&!this.played&&(t=this.element,A((o=this.options).play)&&X(t,"play",o.play,{once:!0}),!1!==P(t,"play")&&(s=this.player,a=this.loadImage.bind(this),r=[],h=l=0,this.played=!0,this.onLoadWhenPlay=a,i&&this.requestFullscreen(i),R(s,d),S(this.items,function(t,e){var i=t.querySelector("img"),n=document.createElement("img");n.src=Y(i,"originalUrl"),n.alt=i.getAttribute("alt"),n.referrerPolicy=i.referrerPolicy,l+=1,R(n,H),N(n,m,o.transition),L(t,f)&&(R(n,u),h=e),r.push(n),X(n,y,a,{once:!0}),s.appendChild(n)}),E(o.interval)&&0<o.interval&&(t=function t(){clearTimeout(e.playing.timeout),F(r[h],u),R(r[h=(h+=1)<l?h:0],u),e.playing.timeout=setTimeout(t,o.interval)},1<l&&(this.playing={prev:function t(){clearTimeout(e.playing.timeout),F(r[h],u),R(r[h=0<=--h?h:l-1],u),e.playing.timeout=setTimeout(t,o.interval)},next:t,timeout:setTimeout(t,o.interval)})))),this},stop:function(){var t,e,i=this;return this.played&&(t=this.element,A((e=this.options).stop)&&X(t,"stop",e.stop,{once:!0}),!1!==P(t,"stop")&&(e=this.player,clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,S(e.getElementsByTagName("img"),function(t){M(t,y,i.onLoadWhenPlay)}),F(e,d),e.innerHTML="",this.exitFullscreen())),this},full:function(){var t=this,e=this.options,i=this.viewer,n=this.image,o=this.list;return this.isShown&&!this.played&&!this.fulled&&e.inline&&(this.fulled=!0,this.open(),R(this.button,U),e.transition&&(F(o,m),this.viewed&&F(n,m)),R(i,B),i.setAttribute("role","dialog"),i.setAttribute("aria-labelledby",this.title.id),i.setAttribute("aria-modal",!0),i.removeAttribute("style"),C(i,{zIndex:e.zIndex}),e.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=O({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){e.transition&&setTimeout(function(){R(n,m),R(o,m)},0)})})),this},exit:function(){var t=this,e=this.options,i=this.viewer,n=this.image,o=this.list;return this.isShown&&!this.played&&this.fulled&&e.inline&&(this.fulled=!1,this.close(),F(this.button,U),e.transition&&(F(o,m),this.viewed&&F(n,m)),e.focus&&this.clearEnforceFocus(),i.removeAttribute("role"),i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-modal"),F(i,B),C(i,{zIndex:e.zIndexInline}),this.viewerData=O({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){e.transition&&setTimeout(function(){R(n,m),R(o,m)},0)})})),this},tooltip:function(){var t=this,e=this.options,i=this.tooltipBox,n=this.imageData;return this.viewed&&!this.played&&e.tooltip&&(i.textContent="".concat(Math.round(100*n.ratio),"%"),this.tooltipping?clearTimeout(this.tooltipping):e.transition?(this.fading&&P(i,k),R(i,d),R(i,H),R(i,m),i.removeAttribute("aria-hidden"),i.initialOffsetWidth=i.offsetWidth,R(i,u)):(R(i,d),i.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){e.transition?(X(i,k,function(){F(i,d),F(i,H),F(i,m),i.setAttribute("aria-hidden",!0),t.fading=!1},{once:!0}),F(i,u),t.fading=!0):(F(i,d),i.setAttribute("aria-hidden",!0)),t.tooltipping=!1},1e3)),this},toggle:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;return 1===this.imageData.ratio?this.zoomTo(this.imageData.oldRatio,!0,null,t):this.zoomTo(1,!0,null,t),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=O({},this.initialImageData),this.renderImage()),this},update:function(){var n,o,e=this,t=this.element,i=this.options,s=this.isImg;return s&&!t.parentNode?this.destroy():(n=[],S(s?[t]:t.querySelectorAll("img"),function(t){A(i.filter)?i.filter.call(e,t)&&n.push(t):e.getImageURL(t)&&n.push(t)}),n.length&&(this.images=n,this.length=n.length,this.ready?(o=[],S(this.items,function(t,e){var t=t.querySelector("img"),i=n[e];i&&t&&i.src===t.src&&i.alt===t.alt||o.push(e)}),C(this.list,{width:"auto"}),this.initList(),this.isShown&&(this.length?this.viewed&&(0<=(s=o.indexOf(this.index))?(this.viewed=!1,this.view(Math.max(Math.min(this.index-s,this.length-1),0))):(R(t=this.items[this.index],f),t.setAttribute("aria-selected",!0))):(this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""))):this.build()),this)},destroy:function(){var t=this.element,e=this.options;return t[g]&&(this.destroyed=!0,this.ready?(this.played&&this.stop(),e.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)):e.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),e.inline||M(t,w,this.onStart),t[g]=void 0),this}},Ot={getImageURL:function(t){var e=this.options.url;return e=T(e)?t.getAttribute(e):A(e)?e.call(this,t):""},enforceFocus:function(){var n=this;this.clearEnforceFocus(),X(document,tt,this.onFocusin=function(t){var e=n.viewer,i=t.target;if(i!==document&&i!==e&&!e.contains(i)){for(;i;){if(null!==i.getAttribute("tabindex")||"true"===i.getAttribute("aria-modal"))return;i=i.parentElement}e.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(M(document,tt,this.onFocusin),this.onFocusin=null)},open:function(){var t=this.body;R(t,G),0<this.scrollbarWidth&&(t.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var t=this.body;F(t,G),0<this.scrollbarWidth&&(t.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var t=this.element,e=this.options,i=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,e.focus&&(i.focus(),this.enforceFocus()),A(e.shown)&&X(t,"shown",e.shown,{once:!0}),!1!==P(t,"shown")&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,e=this.options,i=this.viewer;e.fucus&&this.clearEnforceFocus(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),R(i,v),i.removeAttribute("role"),i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-modal"),i.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||(A(e.hidden)&&X(t,"hidden",e.hidden,{once:!0}),P(t,"hidden",null,{cancelable:!1}))},requestFullscreen:function(t){var e=this.element.ownerDocument;this.fulled&&!(e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement||e.msFullscreenElement)&&((e=e.documentElement).requestFullscreen?I(t)?e.requestFullscreen(t):e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},exitFullscreen:function(){var t=this.element.ownerDocument;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())},change:function(t){var e=this.options,i=this.pointers,n=i[Object.keys(i)[0]];if(n){var s,a,o=n.endX-n.startX,r=n.endY-n.startY;switch(this.action){case h:this.move(o,r,t);break;case c:this.zoom((s=q({},l=i),a=[],S(l,function(o,t){delete s[t],S(s,function(t){var e=Math.abs(o.startX-t.startX),i=Math.abs(o.startY-t.startY),n=Math.abs(o.endX-t.endX),t=Math.abs(o.endY-t.endY),e=Math.sqrt(e*e+i*i),i=Math.sqrt(n*n+t*t);a.push((i-e)/e)})}),a.sort(function(t,e){return Math.abs(t)<Math.abs(e)}),a[0]),!1,null,t);break;case W:this.action="switched";var l=Math.abs(o);1<l&&l>Math.abs(r)&&(this.pointers={},1<o?this.prev(e.loop):o<-1&&this.next(e.loop))}S(i,function(t){t.startX=t.endX,t.startY=t.endY})}},isSwitchable:function(){var t=this.imageData,e=this.viewerData;return 1<this.length&&0<=t.x&&0<=t.y&&t.width<=e.width&&t.height<=e.height}},Ct=e.Viewer,Lt=(It=-1,function(){return It+=1}),e=function(){function o(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this,n=o;if(!(i instanceof n))throw new TypeError("Cannot call a class as a function");if(!t||1!==t.nodeType)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=O({},l,I(e)&&e),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=Lt(),this.init()}var t,e,i;return t=o,i=[{key:"noConflict",value:function(){return window.Viewer=Ct,o}},{key:"setDefaults",value:function(t){O(l,I(t)&&t)}}],(e=[{key:"init",value:function(){var t,e,i,n,o=this,s=this.element,a=this.options;s[g]||(s[g]=this,a.focus&&!a.keyboard&&(a.focus=!1),t="img"===s.localName,e=[],S(t?[s]:s.querySelectorAll("img"),function(t){A(a.filter)?a.filter.call(o,t)&&e.push(t):o.getImageURL(t)&&e.push(t)}),this.isImg=t,this.length=e.length,this.images=e,this.initBody(),D(document.createElement(g).style.transition)&&(a.transition=!1),a.inline?(i=0,n=function(){var t;(i+=1)===o.length&&(o.initializing=!1,o.delaying={abort:function(){clearTimeout(t)}},t=setTimeout(function(){o.delaying=!1,o.build()},0))},this.initializing={abort:function(){S(e,function(t){t.complete||(M(t,y,n),M(t,x,n))})}},S(e,function(t){var e,i;t.complete?n():(X(t,y,e=function(){M(t,x,i),n()},{once:!0}),X(t,x,i=function(){M(t,y,e),n()},{once:!0}))})):X(s,w,this.onStart=function(t){t=t.target;"img"!==t.localName||A(a.filter)&&!a.filter.call(o,t)||o.view(o.images.indexOf(t))}))}},{key:"build",value:function(){var t,s,e,i,n,o,a,r,l,h,c,u,d,m;this.ready||(t=this.element,s=this.options,e=t.parentNode,(d=document.createElement("div")).innerHTML='<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>',d=(i=d.querySelector(".".concat(g,"-container"))).querySelector(".".concat(g,"-title")),n=i.querySelector(".".concat(g,"-toolbar")),m=i.querySelector(".".concat(g,"-navbar")),o=i.querySelector(".".concat(g,"-button")),a=i.querySelector(".".concat(g,"-canvas")),this.parent=e,this.viewer=i,this.title=d,this.toolbar=n,this.navbar=m,this.button=o,this.canvas=a,this.footer=i.querySelector(".".concat(g,"-footer")),this.tooltipBox=i.querySelector(".".concat(g,"-tooltip")),this.player=i.querySelector(".".concat(g,"-player")),this.list=i.querySelector(".".concat(g,"-list")),i.id="".concat(g).concat(this.id),d.id="".concat(g,"Title").concat(this.id),R(d,s.title?Et(Array.isArray(s.title)?s.title[0]:s.title):v),R(m,s.navbar?Et(s.navbar):v),N(o,v,!s.button),s.keyboard&&o.setAttribute("tabindex",0),s.backdrop&&(R(i,"".concat(g,"-backdrop")),s.inline||"static"===s.backdrop||bt(a,ct,"hide")),T(s.className)&&s.className&&s.className.split(ut).forEach(function(t){R(i,t)}),s.toolbar?(r=document.createElement("ul"),l=I(s.toolbar),h=dt.slice(0,3),c=dt.slice(7,9),u=dt.slice(9),l||R(n,Et(s.toolbar)),S(l?s.toolbar:dt,function(t,e){var i,n=l&&I(t),e=l?pt(e):t,o=n&&!D(t.show)?t.show:t;!o||!s.zoomable&&-1!==h.indexOf(e)||!s.rotatable&&-1!==c.indexOf(e)||!s.scalable&&-1!==u.indexOf(e)||(i=n&&!D(t.size)?t.size:t,n=n&&!D(t.click)?t.click:t,t=document.createElement("li"),s.keyboard&&t.setAttribute("tabindex",0),t.setAttribute("role","button"),R(t,"".concat(g,"-").concat(e)),A(n)||bt(t,ct,e),E(o)&&R(t,Et(o)),-1!==["small","large"].indexOf(i)?R(t,"".concat(g,"-").concat(i)):"play"===e&&R(t,"".concat(g,"-large")),A(n)&&X(t,w,n),r.appendChild(t))}),n.appendChild(r)):R(n,v),s.rotatable||(R(d=n.querySelectorAll('li[class*="rotate"]'),p),S(d,function(t){n.appendChild(t)})),s.inline?(R(o,V),C(i,{zIndex:s.zIndexInline}),"static"===window.getComputedStyle(e).position&&C(e,{position:"relative"}),e.insertBefore(i,t.nextSibling)):(R(o,j),R(i,B),R(i,H),R(i,v),C(i,{zIndex:s.zIndex}),(m=(m=T(m=s.container)?t.ownerDocument.querySelector(m):m)||this.body).appendChild(i)),s.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,A(s.ready)&&X(t,rt,s.ready,{once:!0}),!1===P(t,rt)?this.ready=!1:this.ready&&s.inline&&this.view(this.index))}}])&&r(t.prototype,e),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),o}();return O(e.prototype,i,t,At,St,Ot),e});
|
|
10
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Viewer=e()}(this,function(){"use strict";function s(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function q(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach(function(t){var e,i;e=n,i=o[t=t],(t=l(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);if("object"!=typeof(i=i.call(t,e||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}var W={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:.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:.1,minZoomRatio:.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},t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{},a=!(!t||!e.document.documentElement)&&"ontouchstart"in e.document.documentElement,i=t&&"PointerEvent"in e,g="viewer",h="move",j="switch",c="zoom",f="".concat(g,"-active"),H="".concat(g,"-close"),B="".concat(g,"-fade"),V="".concat(g,"-fixed"),U="".concat(g,"-fullscreen"),K="".concat(g,"-fullscreen-exit"),v="".concat(g,"-hide"),Z="".concat(g,"-hide-md-down"),$="".concat(g,"-hide-sm-down"),_="".concat(g,"-hide-xs-down"),u="".concat(g,"-in"),p="".concat(g,"-invisible"),b="".concat(g,"-loading"),G="".concat(g,"-move"),J="".concat(g,"-open"),d="".concat(g,"-show"),m="".concat(g,"-transition"),w="click",Q="dblclick",tt="dragstart",et="focusin",it="keydown",y="load",x="error",nt=i?"pointerdown":a?"touchstart":"mousedown",ot=i?"pointermove":a?"touchmove":"mousemove",st=i?"pointerup pointercancel":a?"touchend touchcancel":"mouseup",at="resize",k="transitionend",rt="wheel",z="viewed",lt="rotated",ht="".concat(g,"Action"),ct=/\s\s*/,ut=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function T(t){return"string"==typeof t}var dt=Number.isNaN||e.isNaN;function E(t){return"number"==typeof t&&!dt(t)}function D(t){return void 0===t}function o(t){return"object"===n(t)&&null!==t}var mt=Object.prototype.hasOwnProperty;function S(t){if(!o(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&mt.call(i,"isPrototypeOf")}catch(t){return!1}}function I(t){return"function"==typeof t}function A(e,i){if(e&&I(i))if(Array.isArray(e)||E(e.length))for(var t=e.length,n=0;n<t&&!1!==i.call(e,e[n],n,e);n+=1);else o(e)&&Object.keys(e).forEach(function(t){i.call(e,e[t],t,e)})}var O=Object.assign||function(i){for(var t=arguments.length,e=new Array(1<t?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return o(i)&&0<e.length&&e.forEach(function(e){o(e)&&Object.keys(e).forEach(function(t){i[t]=e[t]})}),i},gt=/^(?:width|height|left|top|marginLeft|marginTop)$/;function C(t,e){var i=t.style;A(e,function(t,e){gt.test(e)&&E(t)&&(t+="px"),i[e]=t})}function L(t,e){return t&&e&&(t.classList?t.classList.contains(e):-1<t.className.indexOf(e))}function R(t,e){var i;t&&e&&(E(t.length)?A(t,function(t){R(t,e)}):t.classList?t.classList.add(e):(i=t.className.trim())?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e)}function M(t,e){t&&e&&(E(t.length)?A(t,function(t){M(t,e)}):t.classList?t.classList.remove(e):0<=t.className.indexOf(e)&&(t.className=t.className.replace(e,"")))}function F(t,e,i){e&&(E(t.length)?A(t,function(t){F(t,e,i)}):(i?R:M)(t,e))}var ft=/([a-z\d])([A-Z])/g;function vt(t){return t.replace(ft,"$1-$2").toLowerCase()}function N(t,e){return o(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(vt(e)))}function pt(t,e,i){o(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(vt(e)),i)}wt=!1,t&&(bt=!1,i=function(){},t=Object.defineProperty({},"once",{get:function(){return wt=!0,bt},set:function(t){bt=t}}),e.addEventListener("test",i,t),e.removeEventListener("test",i,t));var bt,wt,yt=wt;function Y(i,t,n,e){var o=3<arguments.length&&void 0!==e?e:{},s=n;t.trim().split(ct).forEach(function(t){var e;yt||(e=i.listeners)&&e[t]&&e[t][n]&&(s=e[t][n],delete e[t][n],0===Object.keys(e[t]).length&&delete e[t],0===Object.keys(e).length)&&delete i.listeners,i.removeEventListener(t,s,o)})}function X(s,t,a,e){var r=3<arguments.length&&void 0!==e?e:{},l=a;t.trim().split(ct).forEach(function(n){var t,o;r.once&&!yt&&(t=s.listeners,l=function(){delete o[n][a],s.removeEventListener(n,l,r);for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];a.apply(s,e)},(o=void 0===t?{}:t)[n]||(o[n]={}),o[n][a]&&s.removeEventListener(n,o[n][a],r),o[n][a]=l,s.listeners=o),s.addEventListener(n,l,r)})}function P(t,e,i,n){var o;return I(Event)&&I(CustomEvent)?o=new CustomEvent(e,q({bubbles:!0,cancelable:!0,detail:i},n)):(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(o)}function xt(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,o=t.translateX,t=t.translateY,s=[],o=(E(o)&&0!==o&&s.push("translateX(".concat(o,"px)")),E(t)&&0!==t&&s.push("translateY(".concat(t,"px)")),E(e)&&0!==e&&s.push("rotate(".concat(e,"deg)")),E(i)&&1!==i&&s.push("scaleX(".concat(i,")")),E(n)&&1!==n&&s.push("scaleY(".concat(n,")")),s.length?s.join(" "):"none");return{WebkitTransform:o,msTransform:o,transform:o}}var kt=e.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(e.navigator.userAgent);function zt(i,t,e){var n,o=document.createElement("img");return i.naturalWidth&&!kt?e(i.naturalWidth,i.naturalHeight):(n=document.body||document.documentElement,o.onload=function(){e(o.width,o.height),kt||n.removeChild(o)},A(t.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&o.setAttribute(t,e)}),o.src=i.src,kt||(o.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;",n.appendChild(o))),o}function Tt(t){switch(t){case 2:return _;case 3:return $;case 4:return Z;default:return""}}function Et(t,e){var i=t.pageX,t=t.pageY,n={endX:i,endY:t};return e?n:q({timeStamp:Date.now(),startX:i,startY:t},n)}var Dt,i={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var t=this.element.ownerDocument,e=t.body||t.documentElement;this.body=e,this.scrollbarWidth=window.innerWidth-t.documentElement.clientWidth,this.initialBodyPaddingRight=e.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(e).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var t,e=this.options,i=this.parent;e.inline&&(t={width:Math.max(i.offsetWidth,e.minWidth),height:Math.max(i.offsetHeight,e.minHeight)},this.parentData=t),!this.fulled&&t||(t=this.containerData),this.viewerData=O({},t)},renderViewer:function(){this.options.inline&&!this.fulled&&C(this.viewer,this.viewerData)},initList:function(){var r=this,t=this.element,l=this.options,h=this.list,c=[];h.innerHTML="",A(this.images,function(i,t){var e,n,o=i.src,s=i.alt||(T(s=o)?decodeURIComponent(s.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""),a=r.getImageURL(i);(o||a)&&(e=document.createElement("li"),n=document.createElement("img"),A(l.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&n.setAttribute(t,e)}),l.navbar&&(n.src=o||a),n.alt=s,n.setAttribute("data-original-url",a||o),e.setAttribute("data-index",t),e.setAttribute("data-viewer-action","view"),e.setAttribute("role","button"),l.keyboard&&e.setAttribute("tabindex",0),e.appendChild(n),h.appendChild(e),c.push(e))}),A(this.items=c,function(e){var t,i,n=e.firstElementChild;pt(n,"filled",!0),l.loading&&R(e,b),X(n,y,t=function(t){Y(n,x,i),l.loading&&M(e,b),r.loadImage(t)},{once:!0}),X(n,x,i=function(){Y(n,y,t),l.loading&&M(e,b)},{once:!0})}),l.transition&&X(t,z,function(){R(h,m)},{once:!0})},renderList:function(){var t,e,i=this.index,n=this.items[i];n&&(t=n.nextElementSibling,t=parseInt(window.getComputedStyle(t||n).marginLeft,10),n=n.offsetWidth,C(this.list,O({width:(e=n+t)*this.length-t},xt({translateX:(this.viewerData.width-n)/2-e*i}))))},resetList:function(){var t=this.list;t.innerHTML="",M(t,m),C(t,xt({translateX:0}))},initImage:function(r){var t,l=this,h=this.options,e=this.image,i=this.viewerData,n=this.footer.offsetHeight,c=i.width,u=Math.max(i.height-n,n),d=this.imageData||{};this.imageInitializing={abort:function(){t.onload=null}},t=zt(e,h,function(t,e){var i=t/e,n=Math.max(0,Math.min(1,h.initialCoverage)),o=c,s=u,n=(l.imageInitializing=!1,c<u*i?s=c/i:o=u*i,n=E(n)?n:.9,o=Math.min(o*n,t),s=Math.min(s*n,e),(c-o)/2),a=(u-s)/2,n={left:n,top:a,x:n,y:a,width:o,height:s,oldRatio:1,ratio:o/t,aspectRatio:i,naturalWidth:t,naturalHeight:e},a=O({},n);h.rotatable&&(n.rotate=d.rotate||0,a.rotate=0),h.scalable&&(n.scaleX=d.scaleX||1,n.scaleY=d.scaleY||1,a.scaleX=1,a.scaleY=1),l.imageData=n,l.initialImageData=a,r&&r()})},renderImage:function(t){var e,i=this,n=this.image,o=this.imageData;C(n,O({width:o.width,height:o.height,marginLeft:o.x,marginTop:o.y},xt(o))),t&&((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&L(n,m)?(e=function(){i.imageRendering=!1,t()},this.imageRendering={abort:function(){Y(n,k,e)}},X(n,k,e,{once:!0})):t())},resetImage:function(){var t;(this.viewing||this.viewed)&&(t=this.image,this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null)}},t={bind:function(){var t=this.options,e=this.viewer,i=this.canvas,n=this.element.ownerDocument;X(e,w,this.onClick=this.click.bind(this)),X(e,tt,this.onDragStart=this.dragstart.bind(this)),X(i,nt,this.onPointerDown=this.pointerdown.bind(this)),X(n,ot,this.onPointerMove=this.pointermove.bind(this)),X(n,st,this.onPointerUp=this.pointerup.bind(this)),X(n,it,this.onKeyDown=this.keydown.bind(this)),X(window,at,this.onResize=this.resize.bind(this)),t.zoomable&&t.zoomOnWheel&&X(e,rt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleOnDblclick&&X(i,Q,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var t=this.options,e=this.viewer,i=this.canvas,n=this.element.ownerDocument;Y(e,w,this.onClick),Y(e,tt,this.onDragStart),Y(i,nt,this.onPointerDown),Y(n,ot,this.onPointerMove),Y(n,st,this.onPointerUp),Y(n,it,this.onKeyDown),Y(window,at,this.onResize),t.zoomable&&t.zoomOnWheel&&Y(e,rt,this.onWheel,{passive:!1,capture:!0}),t.toggleOnDblclick&&Y(i,Q,this.onDblclick)}},St={click:function(t){var e=this.options,i=this.imageData,n=t.target,o=N(n,ht);switch(o||"img"!==n.localName||"li"!==n.parentElement.localName||(o=N(n=n.parentElement,ht)),a&&t.isTrusted&&n===this.canvas&&clearTimeout(this.clickCanvasTimeout),o){case"mix":this.played?this.stop():e.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(N(n,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(e.loop);break;case"play":this.play(e.fullscreen);break;case"next":this.next(e.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-i.scaleX||-1);break;case"flip-vertical":this.scaleY(-i.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(t){t.preventDefault(),this.viewed&&t.target===this.image&&(a&&t.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(t.isTrusted?t:t.detail&&t.detail.originalEvent))},load:function(){var t=this,e=(this.timeout&&(clearTimeout(this.timeout),this.timeout=!1),this.element),i=this.options,n=this.image,o=this.index,s=this.viewerData;M(n,p),i.loading&&M(this.canvas,b),n.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(){F(n,G,i.movable),F(n,m,i.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,I(i.viewed)&&X(e,z,i.viewed,{once:!0}),P(e,z,{originalImage:t.images[o],index:o,image:n},{cancelable:!1})})})},loadImage:function(t){var n=t.target,t=n.parentNode,o=t.offsetWidth||30,s=t.offsetHeight||50,a=!!N(n,"filled");zt(n,this.options,function(t,e){var t=t/e,e=o,i=s;o<s*t?a?e=s*t:i=o/t:a?i=o/t:e=s*t,C(n,O({width:e,height:i},xt({translateX:(o-e)/2,translateY:(s-i)/2})))})},keydown:function(t){var e=this.options;if(e.keyboard){var i=t.keyCode||t.which||t.charCode;if(13===i&&this.viewer.contains(t.target)&&this.click(t),this.fulled)switch(i){case 27:this.played?this.stop():e.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(e.loop);break;case 38:t.preventDefault(),this.zoom(e.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(e.loop);break;case 40:t.preventDefault(),this.zoom(-e.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle())}}},dragstart:function(t){"img"===t.target.localName&&t.preventDefault()},pointerdown:function(t){var e=this.options,i=this.pointers,n=t.buttons,o=t.button;this.pointerMoved=!1,!this.viewed||this.showing||this.viewing||this.hiding||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(E(n)&&1!==n||E(o)&&0!==o||t.ctrlKey)||(t.preventDefault(),t.changedTouches?A(t.changedTouches,function(t){i[t.identifier]=Et(t)}):i[t.pointerId||0]=Et(t),n=!!e.movable&&h,e.zoomOnTouch&&e.zoomable&&1<Object.keys(i).length?n=c:e.slideOnTouch&&("touch"===t.pointerType||"touchstart"===t.type)&&this.isSwitchable()&&(n=j),!e.transition||n!==h&&n!==c||M(this.image,m),this.action=n)},pointermove:function(t){var e=this.pointers,i=this.action;this.viewed&&i&&(t.preventDefault(),this.pointerMoved=!0,t.changedTouches?A(t.changedTouches,function(t){O(e[t.identifier]||{},Et(t,!0))}):O(e[t.pointerId||0]||{},Et(t,!0)),this.change(t))},pointerup:function(t){var e,i=this,n=this.options,o=this.action,s=this.pointers;t.changedTouches?A(t.changedTouches,function(t){e=s[t.identifier],delete s[t.identifier]}):(e=s[t.pointerId||0],delete s[t.pointerId||0]),o&&(t.preventDefault(),!n.transition||o!==h&&o!==c||R(this.image,m),this.action=!1,a)&&o!==c&&e&&Date.now()-e.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(){P(i.image,Q,{originalEvent:t})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){i.imageClicked=!1},500)):(this.imageClicked=!1,n.backdrop&&"static"!==n.backdrop&&t.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){P(i.canvas,w,{originalEvent:t})},50))))},resize:function(){var e=this;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(){e.renderImage()}),this.played)&&(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)?this.stop():A(this.player.getElementsByTagName("img"),function(t){X(t,y,e.loadImage.bind(e),{once:!0}),P(t,y)}))},wheel:function(t){var e,i,n=this;this.viewed&&(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout(function(){n.wheeling=!1},50),e=Number(this.options.zoomRatio)||.1,i=1,t.deltaY?i=0<t.deltaY?1:-1:t.wheelDelta?i=-t.wheelDelta/120:t.detail&&(i=0<t.detail?1:-1),this.zoom(-i*e,!0,null,t)))}},It={show:function(){var t,e,i=0<arguments.length&&void 0!==arguments[0]&&arguments[0],n=this.element,o=this.options;return o.inline||this.showing||this.isShown||this.showing||(this.ready?(I(o.show)&&X(n,"show",o.show,{once:!0}),!1!==P(n,"show")&&this.ready&&(this.hiding&&this.transitioning.abort(),this.showing=!0,this.open(),M(t=this.viewer,v),t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",this.title.id),t.setAttribute("aria-modal",!0),t.removeAttribute("aria-hidden"),o.transition&&!i?(e=this.shown.bind(this),this.transitioning={abort:function(){Y(t,k,e),M(t,u)}},R(t,m),t.initialOffsetWidth=t.offsetWidth,X(t,k,e,{once:!0}),R(t,u)):(R(t,u),this.shown()))):(this.build(),this.ready&&this.show(i))),this},hide:function(){var i,t,e,n,o,s=this,a=0<arguments.length&&void 0!==arguments[0]&&arguments[0],r=this.element,l=this.options;return l.inline||this.hiding||!this.isShown&&!this.showing||(I(l.hide)&&X(r,"hide",l.hide,{once:!0}),!1!==P(r,"hide")&&(this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort(),i=this.viewer,t=this.image,e=function(){M(i,u),s.hidden()},l.transition&&!a?(n=function t(e){e&&e.target===i&&(Y(i,k,t),s.hidden())},o=function(){L(i,m)?(X(i,k,n),M(i,u)):e()},this.transitioning={abort:function(){s.viewed&&L(t,m)?Y(t,k,o):L(i,m)&&Y(i,k,n)}},this.viewed&&L(t,m)?(X(t,k,o,{once:!0}),this.zoomTo(0,!1,null,null,!0)):o()):e())),this},view:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.options.initialViewIndex,t=Number(t)||0;if(!(this.hiding||this.played||t<0||t>=this.length||this.viewed&&t===this.index)){if(!this.isShown)return this.index=t,this.show();this.viewing&&this.viewing.abort();var e,n,o,s=this.element,a=this.options,r=this.title,l=this.canvas,h=this.items[t],c=h.querySelector("img"),u=N(c,"originalUrl"),d=c.getAttribute("alt"),m=document.createElement("img");A(a.inheritedAttributes,function(t){var e=c.getAttribute(t);null!==e&&m.setAttribute(t,e)}),m.src=u,m.alt=d,I(a.view)&&X(s,"view",a.view,{once:!0}),!1===P(s,"view",{originalImage:this.images[t],index:t,image:m})||!this.isShown||this.hiding||this.played||((u=this.items[this.index])&&(M(u,f),u.removeAttribute("aria-selected")),R(h,f),h.setAttribute("aria-selected",!0),a.focus&&h.focus(),this.image=m,this.viewed=!1,this.index=t,this.imageData={},R(m,p),a.loading&&R(l,b),l.innerHTML="",l.appendChild(m),this.renderList(),r.innerHTML="",X(s,z,e=function(){var t=i.imageData,e=Array.isArray(a.title)?a.title[1]:a.title;r.innerHTML=T(e=I(e)?e.call(i,m,t):"".concat(d," (").concat(t.naturalWidth," × ").concat(t.naturalHeight,")"))?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"):e},{once:!0}),this.viewing={abort:function(){Y(s,z,e),m.complete?i.imageRendering?i.imageRendering.abort():i.imageInitializing&&i.imageInitializing.abort():(m.src="",Y(m,y,n),i.timeout&&clearTimeout(i.timeout))}},m.complete?this.load():(X(m,y,n=function(){Y(m,x,o),i.load()},{once:!0}),X(m,x,o=function(){Y(m,y,n),i.timeout&&(clearTimeout(i.timeout),i.timeout=!1),M(m,p),a.loading&&M(i.canvas,b)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){M(m,p),i.timeout=!1},1e3)))}return this},prev:function(){var t=this.index-1;return t<0&&(t=0<arguments.length&&void 0!==arguments[0]&&arguments[0]?this.length-1:0),this.view(t),this},next:function(){var t=this.length-1,e=this.index+1;return this.view(e=t<e?0<arguments.length&&void 0!==arguments[0]&&arguments[0]?0:t:e),this},move:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData;return this.moveTo(D(t)?t:i.x+Number(t),D(e)?e:i.y+Number(e)),this},moveTo:function(t){var e=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,o=this.element,s=this.options,a=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&s.movable){var r=a.x,l=a.y,h=!1;if(E(t)?h=!0:t=r,E(i)?h=!0:i=l,h){if(I(s.move)&&X(o,"move",s.move,{once:!0}),!1===P(o,"move",{x:t,y:i,oldX:r,oldY:l,originalEvent:n}))return this;a.x=t,a.y=i,a.left=t,a.top=i,this.moving=!0,this.renderImage(function(){e.moving=!1,I(s.moved)&&X(o,"moved",s.moved,{once:!0}),P(o,"moved",{x:t,y:i,oldX:r,oldY:l,originalEvent:n},{cancelable:!1})})}}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var e=this,i=this.element,n=this.options,o=this.imageData;if(E(t=Number(t))&&this.viewed&&!this.played&&n.rotatable){var s=o.rotate;if(I(n.rotate)&&X(i,"rotate",n.rotate,{once:!0}),!1===P(i,"rotate",{degree:t,oldDegree:s}))return this;o.rotate=t,this.rotating=!0,this.renderImage(function(){e.rotating=!1,I(n.rotated)&&X(i,lt,n.rotated,{once:!0}),P(i,lt,{degree:t,oldDegree:s},{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 e=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=this.element,o=this.options,s=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&o.scalable){var a=s.scaleX,r=s.scaleY,l=!1;if(E(t)?l=!0:t=a,E(i)?l=!0:i=r,l){if(I(o.scale)&&X(n,"scale",o.scale,{once:!0}),!1===P(n,"scale",{scaleX:t,scaleY:i,oldScaleX:a,oldScaleY:r}))return this;s.scaleX=t,s.scaleY=i,this.scaling=!0,this.renderImage(function(){e.scaling=!1,I(o.scaled)&&X(n,"scaled",o.scaled,{once:!0}),P(n,"scaled",{scaleX:t,scaleY:i,oldScaleX:a,oldScaleY:r},{cancelable:!1})})}}return this},zoom:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,o=this.imageData;return t=Number(t),this.zoomTo(o.width*(t=t<0?1/(1-t):1+t)/o.naturalWidth,e,i,n),this},zoomTo:function(t){var i,n,o,e=this,s=1<arguments.length&&void 0!==arguments[1]&&arguments[1],a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,l=4<arguments.length&&void 0!==arguments[4]&&arguments[4],h=this.element,c=this.options,u=this.pointers,d=this.imageData,m=d.x,g=d.y,f=d.width,v=d.height,p=d.naturalWidth,b=d.naturalHeight;if(E(t=Math.max(0,t))&&this.viewed&&!this.played&&(l||c.zoomable)){if(l||(l=Math.max(.01,c.minZoomRatio),y=Math.min(100,c.maxZoomRatio),t=Math.min(Math.max(t,l),y)),r)switch(r.type){case"wheel":.055<=c.zoomRatio&&.95<t&&t<1.05&&(t=1);break;case"pointermove":case"touchmove":case"mousemove":.99<t&&t<1.01&&(t=1)}var w,l=p*t,y=b*t,p=l-f,b=y-v,x=d.ratio;if(I(c.zoom)&&X(h,"zoom",c.zoom,{once:!0}),!1===P(h,"zoom",{ratio:t,oldRatio:x,originalEvent:r}))return this;this.zooming=!0,r?(w={left:(w=(w=this.viewer).getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:w.top+(window.pageYOffset-document.documentElement.clientTop)},u=u&&0<Object.keys(u).length?(o=n=i=0,A(u,function(t){var e=t.startX,t=t.startY;i+=e,n+=t,o+=1}),{pageX:i/=o,pageY:n/=o}):{pageX:r.pageX,pageY:r.pageY},d.x-=(u.pageX-w.left-m)/f*p,d.y-=(u.pageY-w.top-g)/v*b):S(a)&&E(a.x)&&E(a.y)?(d.x-=p*((a.x-m)/f),d.y-=b*((a.y-g)/v)):(d.x-=p/2,d.y-=b/2),d.left=d.x,d.top=d.y,d.width=l,d.height=y,d.oldRatio=x,d.ratio=t,this.renderImage(function(){e.zooming=!1,I(c.zoomed)&&X(h,"zoomed",c.zoomed,{once:!0}),P(h,"zoomed",{ratio:t,oldRatio:x,originalEvent:r},{cancelable:!1})}),s&&this.tooltip()}return this},play:function(){var t,o,s,a,r,l,h,e,i=this,n=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this.isShown&&!this.played&&(t=this.element,I((o=this.options).play)&&X(t,"play",o.play,{once:!0}),!1!==P(t,"play")&&(s=this.player,a=this.loadImage.bind(this),r=[],h=l=0,this.played=!0,this.onLoadWhenPlay=a,n&&this.requestFullscreen(n),R(s,d),A(this.items,function(t,e){var i=t.querySelector("img"),n=document.createElement("img");n.src=N(i,"originalUrl"),n.alt=i.getAttribute("alt"),n.referrerPolicy=i.referrerPolicy,l+=1,R(n,B),F(n,m,o.transition),L(t,f)&&(R(n,u),h=e),r.push(n),X(n,y,a,{once:!0}),s.appendChild(n)}),E(o.interval))&&0<o.interval&&(e=function t(){clearTimeout(i.playing.timeout),M(r[h],u),R(r[h=(h+=1)<l?h:0],u),i.playing.timeout=setTimeout(t,o.interval)},1<l))&&(this.playing={prev:function t(){clearTimeout(i.playing.timeout),M(r[h],u),R(r[h=0<=--h?h:l-1],u),i.playing.timeout=setTimeout(t,o.interval)},next:e,timeout:setTimeout(e,o.interval)}),this},stop:function(){var t,e,i=this;return this.played&&(t=this.element,I((e=this.options).stop)&&X(t,"stop",e.stop,{once:!0}),!1!==P(t,"stop"))&&(e=this.player,clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,A(e.getElementsByTagName("img"),function(t){Y(t,y,i.onLoadWhenPlay)}),M(e,d),e.innerHTML="",this.exitFullscreen()),this},full:function(){var t=this,e=this.options,i=this.viewer,n=this.image,o=this.list;return this.isShown&&!this.played&&!this.fulled&&e.inline&&(this.fulled=!0,this.open(),R(this.button,K),e.transition&&(M(o,m),this.viewed)&&M(n,m),R(i,V),i.setAttribute("role","dialog"),i.setAttribute("aria-labelledby",this.title.id),i.setAttribute("aria-modal",!0),i.removeAttribute("style"),C(i,{zIndex:e.zIndex}),e.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=O({},this.containerData),this.renderList(),this.viewed)&&this.initImage(function(){t.renderImage(function(){e.transition&&setTimeout(function(){R(n,m),R(o,m)},0)})}),this},exit:function(){var t=this,e=this.options,i=this.viewer,n=this.image,o=this.list;return this.isShown&&!this.played&&this.fulled&&e.inline&&(this.fulled=!1,this.close(),M(this.button,K),e.transition&&(M(o,m),this.viewed)&&M(n,m),e.focus&&this.clearEnforceFocus(),i.removeAttribute("role"),i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-modal"),M(i,V),C(i,{zIndex:e.zIndexInline}),this.viewerData=O({},this.parentData),this.renderViewer(),this.renderList(),this.viewed)&&this.initImage(function(){t.renderImage(function(){e.transition&&setTimeout(function(){R(n,m),R(o,m)},0)})}),this},tooltip:function(){var t=this,e=this.options,i=this.tooltipBox,n=this.imageData;return this.viewed&&!this.played&&e.tooltip&&(i.textContent="".concat(Math.round(100*n.ratio),"%"),this.tooltipping?clearTimeout(this.tooltipping):e.transition?(this.fading&&P(i,k),R(i,d),R(i,B),R(i,m),i.removeAttribute("aria-hidden"),i.initialOffsetWidth=i.offsetWidth,R(i,u)):(R(i,d),i.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){e.transition?(X(i,k,function(){M(i,d),M(i,B),M(i,m),i.setAttribute("aria-hidden",!0),t.fading=!1},{once:!0}),M(i,u),t.fading=!0):(M(i,d),i.setAttribute("aria-hidden",!0)),t.tooltipping=!1},1e3)),this},toggle:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;return 1===this.imageData.ratio?this.zoomTo(this.imageData.oldRatio,!0,null,t):this.zoomTo(1,!0,null,t),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=O({},this.initialImageData),this.renderImage()),this},update:function(){var n,o,e=this,t=this.element,i=this.options,s=this.isImg;return s&&!t.parentNode?this.destroy():(n=[],A(s?[t]:t.querySelectorAll("img"),function(t){I(i.filter)?i.filter.call(e,t)&&n.push(t):e.getImageURL(t)&&n.push(t)}),n.length&&(this.images=n,this.length=n.length,this.ready?(o=[],A(this.items,function(t,e){var t=t.querySelector("img"),i=n[e];i&&t&&i.src===t.src&&i.alt===t.alt||o.push(e)}),C(this.list,{width:"auto"}),this.initList(),this.isShown&&(this.length?this.viewed&&(0<=(s=o.indexOf(this.index))?(this.viewed=!1,this.view(Math.max(Math.min(this.index-s,this.length-1),0))):(R(t=this.items[this.index],f),t.setAttribute("aria-selected",!0))):(this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""))):this.build()),this)},destroy:function(){var t=this.element,e=this.options;return t[g]&&(this.destroyed=!0,this.ready?(this.played&&this.stop(),e.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)):e.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),e.inline||Y(t,w,this.onStart),t[g]=void 0),this}},At={getImageURL:function(t){var e=this.options.url;return e=T(e)?t.getAttribute(e):I(e)?e.call(this,t):""},enforceFocus:function(){var n=this;this.clearEnforceFocus(),X(document,et,this.onFocusin=function(t){var e=n.viewer,i=t.target;if(i!==document&&i!==e&&!e.contains(i)){for(;i;){if(null!==i.getAttribute("tabindex")||"true"===i.getAttribute("aria-modal"))return;i=i.parentElement}e.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Y(document,et,this.onFocusin),this.onFocusin=null)},open:function(){var t=this.body;R(t,J),0<this.scrollbarWidth&&(t.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var t=this.body;M(t,J),0<this.scrollbarWidth&&(t.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var t=this.element,e=this.options,i=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,e.focus&&(i.focus(),this.enforceFocus()),I(e.shown)&&X(t,"shown",e.shown,{once:!0}),!1!==P(t,"shown")&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,e=this.options,i=this.viewer;e.fucus&&this.clearEnforceFocus(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),R(i,v),i.removeAttribute("role"),i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-modal"),i.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||(I(e.hidden)&&X(t,"hidden",e.hidden,{once:!0}),P(t,"hidden",null,{cancelable:!1}))},requestFullscreen:function(t){var e=this.element.ownerDocument;this.fulled&&!(e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement||e.msFullscreenElement)&&((e=e.documentElement).requestFullscreen?S(t)?e.requestFullscreen(t):e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},exitFullscreen:function(){var t=this.element.ownerDocument;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())},change:function(t){var e=this.options,i=this.pointers,n=i[Object.keys(i)[0]];if(n){var s,a,o=n.endX-n.startX,r=n.endY-n.startY;switch(this.action){case h:this.move(o,r,t);break;case c:this.zoom((s=q({},l=i),a=[],A(l,function(o,t){delete s[t],A(s,function(t){var e=Math.abs(o.startX-t.startX),i=Math.abs(o.startY-t.startY),n=Math.abs(o.endX-t.endX),t=Math.abs(o.endY-t.endY),e=Math.sqrt(e*e+i*i),i=Math.sqrt(n*n+t*t);a.push((i-e)/e)})}),a.sort(function(t,e){return Math.abs(t)<Math.abs(e)}),a[0]),!1,null,t);break;case j:this.action="switched";var l=Math.abs(o);1<l&&l>Math.abs(r)&&(this.pointers={},1<o?this.prev(e.loop):o<-1&&this.next(e.loop))}A(i,function(t){t.startX=t.endX,t.startY=t.endY})}},isSwitchable:function(){var t=this.imageData,e=this.viewerData;return 1<this.length&&0<=t.x&&0<=t.y&&t.width<=e.width&&t.height<=e.height}},Ot=e.Viewer,Ct=(Dt=-1,function(){return Dt+=1}),e=function(){function o(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this,n=o;if(!(i instanceof n))throw new TypeError("Cannot call a class as a function");if(!t||1!==t.nodeType)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=O({},W,S(e)&&e),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.pointerMoved=!1,this.id=Ct(),this.init()}var t,e,i;return t=o,i=[{key:"noConflict",value:function(){return window.Viewer=Ot,o}},{key:"setDefaults",value:function(t){O(W,S(t)&&t)}}],(e=[{key:"init",value:function(){var t,e,i,n,o=this,s=this.element,a=this.options;s[g]||(s[g]=this,a.focus&&!a.keyboard&&(a.focus=!1),t="img"===s.localName,e=[],A(t?[s]:s.querySelectorAll("img"),function(t){I(a.filter)?a.filter.call(o,t)&&e.push(t):o.getImageURL(t)&&e.push(t)}),this.isImg=t,this.length=e.length,this.images=e,this.initBody(),D(document.createElement(g).style.transition)&&(a.transition=!1),a.inline?(i=0,n=function(){var t;(i+=1)===o.length&&(o.initializing=!1,o.delaying={abort:function(){clearTimeout(t)}},t=setTimeout(function(){o.delaying=!1,o.build()},0))},this.initializing={abort:function(){A(e,function(t){t.complete||(Y(t,y,n),Y(t,x,n))})}},A(e,function(t){var e,i;t.complete?n():(X(t,y,e=function(){Y(t,x,i),n()},{once:!0}),X(t,x,i=function(){Y(t,y,e),n()},{once:!0}))})):X(s,w,this.onStart=function(t){t=t.target;"img"!==t.localName||I(a.filter)&&!a.filter.call(o,t)||o.view(o.images.indexOf(t))}))}},{key:"build",value:function(){var t,s,e,i,n,o,a,r,l,h,c,u,d,m;this.ready||(t=this.element,s=this.options,e=t.parentNode,(d=document.createElement("div")).innerHTML='<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>',d=(i=d.querySelector(".".concat(g,"-container"))).querySelector(".".concat(g,"-title")),n=i.querySelector(".".concat(g,"-toolbar")),m=i.querySelector(".".concat(g,"-navbar")),o=i.querySelector(".".concat(g,"-button")),a=i.querySelector(".".concat(g,"-canvas")),this.parent=e,this.viewer=i,this.title=d,this.toolbar=n,this.navbar=m,this.button=o,this.canvas=a,this.footer=i.querySelector(".".concat(g,"-footer")),this.tooltipBox=i.querySelector(".".concat(g,"-tooltip")),this.player=i.querySelector(".".concat(g,"-player")),this.list=i.querySelector(".".concat(g,"-list")),i.id="".concat(g).concat(this.id),d.id="".concat(g,"Title").concat(this.id),R(d,s.title?Tt(Array.isArray(s.title)?s.title[0]:s.title):v),R(m,s.navbar?Tt(s.navbar):v),F(o,v,!s.button),s.keyboard&&o.setAttribute("tabindex",0),s.backdrop&&(R(i,"".concat(g,"-backdrop")),s.inline||"static"===s.backdrop||pt(a,ht,"hide")),T(s.className)&&s.className&&s.className.split(ct).forEach(function(t){R(i,t)}),s.toolbar?(r=document.createElement("ul"),l=S(s.toolbar),h=ut.slice(0,3),c=ut.slice(7,9),u=ut.slice(9),l||R(n,Tt(s.toolbar)),A(l?s.toolbar:ut,function(t,e){var i,n=l&&S(t),e=l?vt(e):t,o=n&&!D(t.show)?t.show:t;!o||!s.zoomable&&-1!==h.indexOf(e)||!s.rotatable&&-1!==c.indexOf(e)||!s.scalable&&-1!==u.indexOf(e)||(i=n&&!D(t.size)?t.size:t,n=n&&!D(t.click)?t.click:t,t=document.createElement("li"),s.keyboard&&t.setAttribute("tabindex",0),t.setAttribute("role","button"),R(t,"".concat(g,"-").concat(e)),I(n)||pt(t,ht,e),E(o)&&R(t,Tt(o)),-1!==["small","large"].indexOf(i)?R(t,"".concat(g,"-").concat(i)):"play"===e&&R(t,"".concat(g,"-large")),I(n)&&X(t,w,n),r.appendChild(t))}),n.appendChild(r)):R(n,v),s.rotatable||(R(d=n.querySelectorAll('li[class*="rotate"]'),p),A(d,function(t){n.appendChild(t)})),s.inline?(R(o,U),C(i,{zIndex:s.zIndexInline}),"static"===window.getComputedStyle(e).position&&C(e,{position:"relative"}),e.insertBefore(i,t.nextSibling)):(R(o,H),R(i,V),R(i,B),R(i,v),C(i,{zIndex:s.zIndex}),(m=(m=T(m=s.container)?t.ownerDocument.querySelector(m):m)||this.body).appendChild(i)),s.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,I(s.ready)&&X(t,"ready",s.ready,{once:!0}),!1===P(t,"ready")?this.ready=!1:this.ready&&s.inline&&this.view(this.index))}}])&&r(t.prototype,e),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),o}();return O(e.prototype,i,t,St,It,At),e});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewerjs",
|
|
3
3
|
"description": "JavaScript image viewer.",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.2",
|
|
5
5
|
"main": "dist/viewer.common.js",
|
|
6
6
|
"module": "dist/viewer.esm.js",
|
|
7
7
|
"browser": "dist/viewer.js",
|
|
@@ -57,23 +57,23 @@
|
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://fengyuanchen.github.io/viewerjs",
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/core": "^7.
|
|
61
|
-
"@babel/preset-env": "^7.
|
|
62
|
-
"@commitlint/cli": "^17.
|
|
63
|
-
"@commitlint/config-conventional": "^17.
|
|
60
|
+
"@babel/core": "^7.20.7",
|
|
61
|
+
"@babel/preset-env": "^7.20.2",
|
|
62
|
+
"@commitlint/cli": "^17.3.0",
|
|
63
|
+
"@commitlint/config-conventional": "^17.3.0",
|
|
64
64
|
"@rollup/plugin-babel": "^5.3.1",
|
|
65
65
|
"babel-plugin-istanbul": "^6.1.1",
|
|
66
|
-
"chai": "^4.3.
|
|
66
|
+
"chai": "^4.3.7",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"codecov": "^3.8.3",
|
|
69
69
|
"cpy-cli": "^4.2.0",
|
|
70
70
|
"create-banner": "^2.0.0",
|
|
71
|
-
"cssnano": "^5.1.
|
|
71
|
+
"cssnano": "^5.1.14",
|
|
72
72
|
"del-cli": "^5.0.0",
|
|
73
|
-
"eslint": "^8.
|
|
73
|
+
"eslint": "^8.31.0",
|
|
74
74
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
75
75
|
"eslint-plugin-import": "^2.26.0",
|
|
76
|
-
"husky": "^8.0.
|
|
76
|
+
"husky": "^8.0.2",
|
|
77
77
|
"karma": "^6.4.1",
|
|
78
78
|
"karma-chai": "^0.1.0",
|
|
79
79
|
"karma-chrome-launcher": "^3.1.1",
|
|
@@ -81,20 +81,20 @@
|
|
|
81
81
|
"karma-mocha": "^2.0.1",
|
|
82
82
|
"karma-mocha-reporter": "^2.2.5",
|
|
83
83
|
"karma-rollup-preprocessor": "^7.0.8",
|
|
84
|
-
"lint-staged": "^13.0
|
|
84
|
+
"lint-staged": "^13.1.0",
|
|
85
85
|
"mocha": "^9.2.2",
|
|
86
86
|
"npm-run-all": "^4.1.5",
|
|
87
|
-
"postcss": "^8.4.
|
|
88
|
-
"postcss-cli": "^10.
|
|
89
|
-
"postcss-header": "^3.0.
|
|
90
|
-
"postcss-import": "^15.
|
|
91
|
-
"postcss-preset-env": "^7.8.
|
|
87
|
+
"postcss": "^8.4.20",
|
|
88
|
+
"postcss-cli": "^10.1.0",
|
|
89
|
+
"postcss-header": "^3.0.3",
|
|
90
|
+
"postcss-import": "^15.1.0",
|
|
91
|
+
"postcss-preset-env": "^7.8.3",
|
|
92
92
|
"postcss-url": "^10.1.3",
|
|
93
|
-
"puppeteer": "^19.
|
|
93
|
+
"puppeteer": "^19.4.1",
|
|
94
94
|
"rollup": "^2.79.1",
|
|
95
|
-
"stylelint": "^14.
|
|
95
|
+
"stylelint": "^14.16.1",
|
|
96
96
|
"stylelint-config-standard-scss": "^5.0.0",
|
|
97
97
|
"stylelint-order": "^5.0.0",
|
|
98
|
-
"uglify-js": "^3.17.
|
|
98
|
+
"uglify-js": "^3.17.4"
|
|
99
99
|
}
|
|
100
100
|
}
|
package/src/js/handlers.js
CHANGED
|
@@ -63,7 +63,9 @@ export default {
|
|
|
63
63
|
break;
|
|
64
64
|
|
|
65
65
|
case 'hide':
|
|
66
|
-
this.
|
|
66
|
+
if (!this.pointerMoved) {
|
|
67
|
+
this.hide();
|
|
68
|
+
}
|
|
67
69
|
break;
|
|
68
70
|
|
|
69
71
|
case 'view':
|
|
@@ -335,6 +337,8 @@ export default {
|
|
|
335
337
|
const { options, pointers } = this;
|
|
336
338
|
const { buttons, button } = event;
|
|
337
339
|
|
|
340
|
+
this.pointerMoved = false;
|
|
341
|
+
|
|
338
342
|
if (
|
|
339
343
|
!this.viewed
|
|
340
344
|
|| this.showing
|
|
@@ -391,6 +395,7 @@ export default {
|
|
|
391
395
|
}
|
|
392
396
|
|
|
393
397
|
event.preventDefault();
|
|
398
|
+
this.pointerMoved = true;
|
|
394
399
|
|
|
395
400
|
if (event.changedTouches) {
|
|
396
401
|
forEach(event.changedTouches, (touch) => {
|
package/src/js/viewer.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ declare namespace Viewer {
|
|
|
24
24
|
[x: string]: ToolbarOption;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export interface Pivot {
|
|
28
|
+
x: Number;
|
|
29
|
+
y: Number;
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
export interface MoveEventData {
|
|
28
33
|
x: number;
|
|
29
34
|
y: number;
|
|
@@ -93,6 +98,7 @@ declare namespace Viewer {
|
|
|
93
98
|
hidden?(event: CustomEvent): void;
|
|
94
99
|
hide?(event: CustomEvent): void;
|
|
95
100
|
inheritedAttributes?: string[];
|
|
101
|
+
initialCoverage?: number;
|
|
96
102
|
initialViewIndex?: number;
|
|
97
103
|
inline?: boolean;
|
|
98
104
|
interval?: number;
|
|
@@ -161,8 +167,8 @@ declare class Viewer {
|
|
|
161
167
|
tooltip(): Viewer;
|
|
162
168
|
update(): Viewer;
|
|
163
169
|
view(index?: number): Viewer;
|
|
164
|
-
zoom(ratio: number, hasTooltip?: boolean): Viewer;
|
|
165
|
-
zoomTo(ratio: number, hasTooltip?: boolean): Viewer;
|
|
170
|
+
zoom(ratio: number, hasTooltip?: boolean, pivot?: Viewer.Pivot): Viewer;
|
|
171
|
+
zoomTo(ratio: number, hasTooltip?: boolean, pivot?: Viewer.Pivot): Viewer;
|
|
166
172
|
static noConflict(): Viewer;
|
|
167
173
|
static setDefaults(options: Viewer.Options): void;
|
|
168
174
|
}
|