viewerjs 1.10.4 → 1.11.0
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/README.md +32 -7
- package/dist/viewer.common.js +311 -682
- package/dist/viewer.css +18 -28
- package/dist/viewer.esm.js +311 -682
- package/dist/viewer.js +311 -682
- package/dist/viewer.min.css +3 -3
- package/dist/viewer.min.js +3 -3
- package/package.json +26 -26
- package/src/css/viewer.css +3 -1
- package/src/css/viewer.scss +3 -1
- package/src/js/defaults.js +7 -1
- package/src/js/handlers.js +11 -3
- package/src/js/methods.js +42 -19
- package/src/js/others.js +21 -11
- package/src/js/render.js +9 -3
- package/src/js/viewer.js +15 -1
package/dist/viewer.min.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Viewer.js v1.
|
|
2
|
+
* Viewer.js v1.11.0
|
|
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: 2022-
|
|
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:
|
|
8
|
+
* Date: 2022-10-16T06:41:23.145Z
|
|
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.
|
|
2
|
+
* Viewer.js v1.11.0
|
|
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: 2022-
|
|
8
|
+
* Date: 2022-10-16T06:41:28.706Z
|
|
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 e(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 l(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?e(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)):e(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function i(t){return(i="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 n(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 s={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"],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,o=t?window:{},a=!(!t||!o.document.documentElement)&&"ontouchstart"in o.document.documentElement,r=t&&"PointerEvent"in o,g="viewer",c="move",d="switch",m="zoom",b="".concat(g,"-active"),w="".concat(g,"-close"),y="".concat(g,"-fade"),E="".concat(g,"-fixed"),I="".concat(g,"-fullscreen"),h="".concat(g,"-fullscreen-exit"),A="".concat(g,"-hide"),S="".concat(g,"-hide-md-down"),O="".concat(g,"-hide-sm-down"),C="".concat(g,"-hide-xs-down"),L="".concat(g,"-in"),R="".concat(g,"-invisible"),F="".concat(g,"-loading"),N="".concat(g,"-move"),Y="".concat(g,"-open"),X="".concat(g,"-show"),u="".concat(g,"-transition"),M="click",P="dblclick",q="dragstart",W="focusin",j="keydown",H="load",B="error",V=r?"pointerdown":a?"touchstart":"mousedown",U=r?"pointermove":a?"touchmove":"mousemove",K=r?"pointerup pointercancel":a?"touchend touchcancel":"mouseup",Z="resize",$="transitionend",_="wheel",G="ready",J="show",Q="viewed",tt="rotated",et="".concat(g,"Action"),it=/\s\s*/,nt=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function ot(t){return"string"==typeof t}var st=Number.isNaN||o.isNaN;function x(t){return"number"==typeof t&&!st(t)}function at(t){return void 0===t}function rt(t){return"object"===i(t)&&null!==t}var ht=Object.prototype.hasOwnProperty;function lt(t){if(!rt(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&ht.call(i,"isPrototypeOf")}catch(t){return!1}}function k(t){return"function"==typeof t}function z(e,i){if(e&&k(i))if(Array.isArray(e)||x(e.length))for(var t=e.length,n=0;n<t&&!1!==i.call(e,e[n],n,e);n+=1);else rt(e)&&Object.keys(e).forEach(function(t){i.call(e,e[t],t,e)});return e}var ct=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 rt(i)&&0<e.length&&e.forEach(function(e){rt(e)&&Object.keys(e).forEach(function(t){i[t]=e[t]})}),i},ut=/^(?:width|height|left|top|marginLeft|marginTop)$/;function dt(t,e){var i=t.style;z(e,function(t,e){ut.test(e)&&x(t)&&(t+="px"),i[e]=t})}function mt(t,e){return t&&e&&(t.classList?t.classList.contains(e):-1<t.className.indexOf(e))}function f(t,e){var i;t&&e&&(x(t.length)?z(t,function(t){f(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 v(t,e){t&&e&&(x(t.length)?z(t,function(t){v(t,e)}):t.classList?t.classList.remove(e):0<=t.className.indexOf(e)&&(t.className=t.className.replace(e,"")))}function gt(t,e,i){e&&(x(t.length)?z(t,function(t){gt(t,e,i)}):(i?f:v)(t,e))}var ft=/([a-z\d])([A-Z])/g;function vt(t){return t.replace(ft,"$1-$2").toLowerCase()}function pt(t,e){return rt(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(vt(e)))}function bt(t,e,i){rt(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(vt(e)),i)}yt=!1,t&&(wt=!1,r=function(){},t=Object.defineProperty({},"once",{get:function(){return yt=!0,wt},set:function(t){wt=t}}),o.addEventListener("test",r,t),o.removeEventListener("test",r,t));var wt,yt,xt=yt;function p(i,t,n,e){var o=3<arguments.length&&void 0!==e?e:{},s=n;t.trim().split(it).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 T(s,t,a,e){var r=3<arguments.length&&void 0!==e?e:{},h=a;t.trim().split(it).forEach(function(n){var t,o;r.once&&!xt&&(t=s.listeners,h=function(){delete o[n][a],s.removeEventListener(n,h,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]=h,s.listeners=o),s.addEventListener(n,h,r)})}function D(t,e,i,n){var o;return k(Event)&&k(CustomEvent)?o=new CustomEvent(e,l({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=(x(o)&&0!==o&&s.push("translateX(".concat(o,"px)")),x(t)&&0!==t&&s.push("translateY(".concat(t,"px)")),x(e)&&0!==e&&s.push("rotate(".concat(e,"deg)")),x(i)&&1!==i&&s.push("scaleX(".concat(i,")")),x(n)&&1!==n&&s.push("scaleY(".concat(n,")")),s.length?s.join(" "):"none");return{WebkitTransform:o,msTransform:o,transform:o}}var zt=o.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(o.navigator.userAgent);function Tt(i,t,e){var n=document.createElement("img");if(i.naturalWidth&&!zt)return e(i.naturalWidth,i.naturalHeight),n;var o=document.body||document.documentElement;return n.onload=function(){e(n.width,n.height),zt||o.removeChild(n)},z(t.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&n.setAttribute(t,e)}),n.src=i.src,zt||(n.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",o.appendChild(n)),n}function Dt(t){switch(t){case 2:return C;case 3:return O;case 4:return S;default:return""}}function Et(t,e){var i=t.pageX,t=t.pageY,n={endX:i,endY:t};return e?n:l({timeStamp:Date.now(),startX:i,startY:t},n)}var It,r={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=ct({},t)},renderViewer:function(){this.options.inline&&!this.fulled&&dt(this.viewer,this.viewerData)},initList:function(){var r=this,t=this.element,h=this.options,l=this.list,c=[];l.innerHTML="",z(this.images,function(i,t){var e,n,o=i.src,s=i.alt||(ot(s=o)?decodeURIComponent(s.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""),a=r.getImageURL(i);(o||a)&&(e=document.createElement("li"),n=document.createElement("img"),z(h.inheritedAttributes,function(t){var e=i.getAttribute(t);null!==e&&n.setAttribute(t,e)}),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"),h.keyboard&&e.setAttribute("tabindex",0),e.appendChild(n),l.appendChild(e),c.push(e))}),z(this.items=c,function(e){var t,i,n=e.firstElementChild;bt(n,"filled",!0),h.loading&&f(e,F),T(n,H,t=function(t){p(n,B,i),h.loading&&v(e,F),r.loadImage(t)},{once:!0}),T(n,B,i=function(){p(n,H,t),h.loading&&v(e,F)},{once:!0})}),h.transition&&T(t,Q,function(){f(l,u)},{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,dt(this.list,ct({width:(e=n+t)*this.length-t},kt({translateX:(this.viewerData.width-n)/2-e*i}))))},resetList:function(){var t=this.list;t.innerHTML="",v(t,u),dt(t,kt({translateX:0}))},initImage:function(r){var t,h=this,l=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,l,function(t,e){var i=t/e,n=c,o=u,s=(h.imageInitializing=!1,c<u*i?o=c/i:n=u*i,n=Math.min(.9*n,t),o=Math.min(.9*o,e),(c-n)/2),a=(u-o)/2,s={left:s,top:a,x:s,y:a,width:n,height:o,oldRatio:1,ratio:n/t,aspectRatio:i,naturalWidth:t,naturalHeight:e},a=ct({},s);l.rotatable&&(s.rotate=d.rotate||0,a.rotate=0),l.scalable&&(s.scaleX=d.scaleX||1,s.scaleY=d.scaleY||1,a.scaleX=1,a.scaleY=1),h.imageData=s,h.initialImageData=a,r&&r()})},renderImage:function(t){var e,i=this,n=this.image,o=this.imageData;dt(n,ct({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&&mt(n,u)?(e=function(){i.imageRendering=!1,t()},this.imageRendering={abort:function(){p(n,$,e)}},T(n,$,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;T(e,M,this.onClick=this.click.bind(this)),T(e,q,this.onDragStart=this.dragstart.bind(this)),T(i,V,this.onPointerDown=this.pointerdown.bind(this)),T(n,U,this.onPointerMove=this.pointermove.bind(this)),T(n,K,this.onPointerUp=this.pointerup.bind(this)),T(n,j,this.onKeyDown=this.keydown.bind(this)),T(window,Z,this.onResize=this.resize.bind(this)),t.zoomable&&t.zoomOnWheel&&T(e,_,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleOnDblclick&&T(i,P,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var t=this.options,e=this.viewer,i=this.canvas,n=this.element.ownerDocument;p(e,M,this.onClick),p(e,q,this.onDragStart),p(i,V,this.onPointerDown),p(n,U,this.onPointerMove),p(n,K,this.onPointerUp),p(n,j,this.onKeyDown),p(window,Z,this.onResize),t.zoomable&&t.zoomOnWheel&&p(e,_,this.onWheel,{passive:!1,capture:!0}),t.toggleOnDblclick&&p(i,P,this.onDblclick)}},At={click:function(t){var e=this.options,i=this.imageData,n=t.target,o=pt(n,et);switch(o||"img"!==n.localName||"li"!==n.parentElement.localName||(o=pt(n=n.parentElement,et)),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(pt(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;v(n,R),i.loading&&v(this.canvas,F),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(){gt(n,N,i.movable),gt(n,u,i.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,k(i.viewed)&&T(e,Q,i.viewed,{once:!0}),D(e,Q,{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=!!pt(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,dt(n,ct({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.prev(e.loop);break;case 38:t.preventDefault(),this.zoom(e.zoomRatio,!0);break;case 39: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)&&(x(n)&&1!==n||x(o)&&0!==o||t.ctrlKey)||(t.preventDefault(),t.changedTouches?z(t.changedTouches,function(t){i[t.identifier]=Et(t)}):i[t.pointerId||0]=Et(t),n=!!e.movable&&c,e.zoomOnTouch&&e.zoomable&&1<Object.keys(i).length?n=m:e.slideOnTouch&&("touch"===t.pointerType||"touchstart"===t.type)&&this.isSwitchable()&&(n=d),!e.transition||n!==c&&n!==m||v(this.image,u),this.action=n)},pointermove:function(t){var e=this.pointers,i=this.action;this.viewed&&i&&(t.preventDefault(),t.changedTouches?z(t.changedTouches,function(t){ct(e[t.identifier]||{},Et(t,!0))}):ct(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?z(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!==c&&o!==m||f(this.image,u),this.action=!1,a&&o!==m&&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(){D(i.image,P,{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(){D(i.canvas,M,{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?z(this.player.getElementsByTagName("img"),function(t){T(t,H,e.loadImage.bind(e),{once:!0}),D(t,H)}):this.stop()))},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,t)))}},St={show:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.element,i=this.options;if(i.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if(k(i.show)&&T(e,J,i.show,{once:!0}),!1===D(e,J)||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var n,o=this.viewer;return v(o,A),o.setAttribute("role","dialog"),o.setAttribute("aria-labelledby",this.title.id),o.setAttribute("aria-modal",!0),o.removeAttribute("aria-hidden"),i.transition&&!t?(n=this.shown.bind(this),this.transitioning={abort:function(){p(o,$,n),v(o,L)}},f(o,u),o.initialOffsetWidth=o.offsetWidth,T(o,$,n,{once:!0}),f(o,L)):(f(o,L),this.shown()),this},hide:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.element,n=this.options;if(n.inline||this.hiding||!this.isShown&&!this.showing)return this;if(k(n.hide)&&T(e,"hide",n.hide,{once:!0}),!1===D(e,"hide"))return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var o,s,a=this.viewer,r=this.image,h=function(){v(a,L),i.hidden()};return n.transition&&!t?(o=function t(e){e&&e.target===a&&(p(a,$,t),i.hidden())},s=function(){mt(a,u)?(T(a,$,o),v(a,L)):h()},this.transitioning={abort:function(){i.viewed&&mt(r,u)?p(r,$,s):mt(a,u)&&p(a,$,o)}},this.viewed&&mt(r,u)?(T(r,$,s,{once:!0}),this.zoomTo(0,!1,null,!0)):s()):h(),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)return this;if(!this.isShown)return this.index=t,this.show();this.viewing&&this.viewing.abort();var e=this.element,n=this.options,l=this.title,o=this.canvas,s=this.items[t],a=s.querySelector("img"),r=pt(a,"originalUrl"),c=a.getAttribute("alt"),h=document.createElement("img");if(z(n.inheritedAttributes,function(t){var e=a.getAttribute(t);null!==e&&h.setAttribute(t,e)}),h.src=r,h.alt=c,k(n.view)&&T(e,"view",n.view,{once:!0}),!1===D(e,"view",{originalImage:this.images[t],index:t,image:h})||!this.isShown||this.hiding||this.played)return this;function u(){var t=i.imageData,e=Array.isArray(n.title)?n.title[1]:n.title;l.innerHTML=ot(e=k(e)?e.call(i,h,t):"".concat(c," (").concat(t.naturalWidth," × ").concat(t.naturalHeight,")"))?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"):e}var d,m,r=this.items[this.index];r&&(v(r,b),r.removeAttribute("aria-selected")),f(s,b),s.setAttribute("aria-selected",!0),n.focus&&s.focus(),this.image=h,this.viewed=!1,this.index=t,this.imageData={},f(h,R),n.loading&&f(o,F),o.innerHTML="",o.appendChild(h),this.renderList(),l.innerHTML="";return T(e,Q,u,{once:!0}),this.viewing={abort:function(){p(e,Q,u),h.complete?i.imageRendering?i.imageRendering.abort():i.imageInitializing&&i.imageInitializing.abort():(h.src="",p(h,H,d),i.timeout&&clearTimeout(i.timeout))}},h.complete?this.load():(T(h,H,d=function(){p(h,B,m),i.load()},{once:!0}),T(h,B,m=function(){p(h,H,d),i.timeout&&(clearTimeout(i.timeout),i.timeout=!1),v(h,R),n.loading&&v(i.canvas,F)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){v(h,R),i.timeout=!1},1e3)),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(at(t)?t:i.x+Number(t),at(e)?e:i.y+Number(e)),this},moveTo:function(t){var l=this,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=this.element,o=this.options,s=this.imageData;if(t=Number(t),e=Number(e),this.viewed&&!this.played&&o.movable){var a=s.x,r=s.y,h=!1;if(x(t)?h=!0:t=a,x(e)?h=!0:e=r,h){if(k(o.move)&&T(n,"move",o.move,{once:!0}),!1===D(n,"move",{x:t,y:e,oldX:a,oldY:r,originalEvent:i}))return this;s.x=t,s.y=e,s.left=t,s.top=e,this.moving=!0,this.renderImage(function(){l.moving=!1,k(o.moved)&&T(n,"moved",o.moved,{once:!0}),D(n,"moved",{x:t,y:e,oldX:a,oldY:r,originalEvent:i},{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(x(t=Number(t))&&this.viewed&&!this.played&&n.rotatable){var s=o.rotate;if(k(n.rotate)&&T(i,"rotate",n.rotate,{once:!0}),!1===D(i,"rotate",{degree:t,oldDegree:s}))return this;o.rotate=t,this.rotating=!0,this.renderImage(function(){e.rotating=!1,k(n.rotated)&&T(i,tt,n.rotated,{once:!0}),D(i,tt,{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,h=!1;if(x(t)?h=!0:t=a,x(i)?h=!0:i=r,h){if(k(o.scale)&&T(n,"scale",o.scale,{once:!0}),!1===D(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,k(o.scaled)&&T(n,"scaled",o.scaled,{once:!0}),D(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=this.imageData;return t=Number(t),this.zoomTo(n.width*(t=t<0?1/(1-t):1+t)/n.naturalWidth,e,i),this},zoomTo:function(t){var l,c,i,u=this,d=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=3<arguments.length&&void 0!==arguments[3]&&arguments[3],o=this.element,s=this.options,a=this.pointers,r=this.imageData,m=r.x,g=r.y,f=r.width,v=r.height,p=r.naturalWidth,b=r.naturalHeight;if(x(t=Math.max(0,t))&&this.viewed&&!this.played&&(n||s.zoomable)){if(n||(n=Math.max(.01,s.minZoomRatio),w=Math.min(100,s.maxZoomRatio),t=Math.min(Math.max(t,n),w)),e)switch(e.type){case"wheel":.055<=s.zoomRatio&&.95<t&&t<1.05&&(t=1);break;case"pointermove":case"touchmove":case"mousemove":.99<t&&t<1.01&&(t=1)}var h,n=p*t,w=b*t,p=n-f,b=w-v,y=r.ratio;if(k(s.zoom)&&T(o,"zoom",s.zoom,{once:!0}),!1===D(o,"zoom",{ratio:t,oldRatio:y,originalEvent:e}))return this;this.zooming=!0,e?(h={left:(h=(h=this.viewer).getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:h.top+(window.pageYOffset-document.documentElement.clientTop)},a=a&&0<Object.keys(a).length?(i=c=l=0,z(a,function(t){var e=t.startX,t=t.startY;l+=e,c+=t,i+=1}),{pageX:l/=i,pageY:c/=i}):{pageX:e.pageX,pageY:e.pageY},r.x-=(a.pageX-h.left-m)/f*p,r.y-=(a.pageY-h.top-g)/v*b):(r.x-=p/2,r.y-=b/2),r.left=r.x,r.top=r.y,r.width=n,r.height=w,r.oldRatio=y,r.ratio=t,this.renderImage(function(){u.zooming=!1,k(s.zoomed)&&T(o,"zoomed",s.zoomed,{once:!0}),D(o,"zoomed",{ratio:t,oldRatio:y,originalEvent:e},{cancelable:!1})}),d&&this.tooltip()}return this},play:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(!this.isShown||this.played)return this;var i=this.element,o=this.options;if(k(o.play)&&T(i,"play",o.play,{once:!0}),!1===D(i,"play"))return this;var s=this.player,a=this.loadImage.bind(this),r=[],h=0,l=0;return this.played=!0,this.onLoadWhenPlay=a,t&&this.requestFullscreen(t),f(s,X),z(this.items,function(t,e){var i=t.querySelector("img"),n=document.createElement("img");n.src=pt(i,"originalUrl"),n.alt=i.getAttribute("alt"),n.referrerPolicy=i.referrerPolicy,h+=1,f(n,y),gt(n,u,o.transition),mt(t,b)&&(f(n,L),l=e),r.push(n),T(n,H,a,{once:!0}),s.appendChild(n)}),x(o.interval)&&0<o.interval&&1<h&&function t(){e.playing=setTimeout(function(){v(r[l],L),f(r[l=(l+=1)<h?l:0],L),t()},o.interval)}(),this},stop:function(){var e=this;if(!this.played)return this;var t=this.element,i=this.options;if(k(i.stop)&&T(t,"stop",i.stop,{once:!0}),!1===D(t,"stop"))return this;i=this.player;return this.played=!1,clearTimeout(this.playing),z(i.getElementsByTagName("img"),function(t){p(t,H,e.onLoadWhenPlay)}),v(i,X),i.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(),f(this.button,h),e.transition&&(v(o,u),this.viewed&&v(n,u)),f(i,E),i.setAttribute("role","dialog"),i.setAttribute("aria-labelledby",this.title.id),i.setAttribute("aria-modal",!0),i.removeAttribute("style"),dt(i,{zIndex:e.zIndex}),e.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=ct({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){e.transition&&setTimeout(function(){f(n,u),f(o,u)},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(),v(this.button,h),e.transition&&(v(o,u),this.viewed&&v(n,u)),e.focus&&this.clearEnforceFocus(),i.removeAttribute("role"),i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-modal"),v(i,E),dt(i,{zIndex:e.zIndexInline}),this.viewerData=ct({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){e.transition&&setTimeout(function(){f(n,u),f(o,u)},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&&D(i,$),f(i,X),f(i,y),f(i,u),i.removeAttribute("aria-hidden"),i.initialOffsetWidth=i.offsetWidth,f(i,L)):(f(i,X),i.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){e.transition?(T(i,$,function(){v(i,X),v(i,y),v(i,u),i.setAttribute("aria-hidden",!0),t.fading=!1},{once:!0}),v(i,L),t.fading=!0):(v(i,X),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,t):this.zoomTo(1,!0,t),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=ct({},this.initialImageData),this.renderImage()),this},update:function(){var e=this,t=this.element,i=this.options,n=this.isImg;if(n&&!t.parentNode)return this.destroy();var o,s=[];return z(n?[t]:t.querySelectorAll("img"),function(t){k(i.filter)?i.filter.call(e,t)&&s.push(t):e.getImageURL(t)&&s.push(t)}),s.length&&(this.images=s,this.length=s.length,this.ready?(o=[],z(this.items,function(t,e){var t=t.querySelector("img"),i=s[e];i&&t&&i.src===t.src&&i.alt===t.alt||o.push(e)}),dt(this.list,{width:"auto"}),this.initList(),this.isShown&&(this.length?this.viewed&&(0<=(n=o.indexOf(this.index))?(this.viewed=!1,this.view(Math.max(Math.min(this.index-n,this.length-1),0))):(f(t=this.items[this.index],b),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||p(t,M,this.onStart),t[g]=void 0),this}},Ot={getImageURL:function(t){var e=this.options.url;return e=ot(e)?t.getAttribute(e):k(e)?e.call(this,t):""},enforceFocus:function(){var i=this;this.clearEnforceFocus(),T(document,W,this.onFocusin=function(t){var e=i.viewer,t=t.target;t===document||t===e||e.contains(t)||null!==t.getAttribute("tabindex")&&"true"===t.getAttribute("aria-modal")||e.focus()})},clearEnforceFocus:function(){this.onFocusin&&(p(document,W,this.onFocusin),this.onFocusin=null)},open:function(){var t=this.body;f(t,Y),t.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px")},close:function(){var t=this.body;v(t,Y),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()),k(e.shown)&&T(t,"shown",e.shown,{once:!0}),!1!==D(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(),f(i,A),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||(k(e.hidden)&&T(t,"hidden",e.hidden,{once:!0}),D(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?lt(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 c:this.move(o,r,t);break;case m:this.zoom((s=l({},h=i),a=[],z(h,function(o,t){delete s[t],z(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,t);break;case d:this.action="switched";var h=Math.abs(o);1<h&&h>Math.abs(r)&&(this.pointers={},1<o?this.prev(e.loop):o<-1&&this.next(e.loop))}z(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=o.Viewer,Lt=(It=-1,function(){return It+=1}),o=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=ct({},s,lt(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){ct(s,lt(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=[],z(t?[s]:s.querySelectorAll("img"),function(t){k(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(),at(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(){z(e,function(t){t.complete||p(t,H,n)})}},z(e,function(t){t.complete?n():T(t,H,n,{once:!0})})):T(s,M,this.onStart=function(t){t=t.target;"img"!==t.localName||k(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,c,r,u,d,m,h,l;this.ready||(t=this.element,s=this.options,e=t.parentNode,(h=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>',h=(i=h.querySelector(".".concat(g,"-container"))).querySelector(".".concat(g,"-title")),n=i.querySelector(".".concat(g,"-toolbar")),l=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=h,this.toolbar=n,this.navbar=l,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),h.id="".concat(g,"Title").concat(this.id),f(h,s.title?Dt(Array.isArray(s.title)?s.title[0]:s.title):A),f(l,s.navbar?Dt(s.navbar):A),gt(o,A,!s.button),s.keyboard&&o.setAttribute("tabindex",0),s.backdrop&&(f(i,"".concat(g,"-backdrop")),s.inline||"static"===s.backdrop||bt(a,et,"hide")),ot(s.className)&&s.className&&s.className.split(it).forEach(function(t){f(i,t)}),s.toolbar?(c=document.createElement("ul"),r=lt(s.toolbar),u=nt.slice(0,3),d=nt.slice(7,9),m=nt.slice(9),r||f(n,Dt(s.toolbar)),z(r?s.toolbar:nt,function(t,e){var i,n=r&<(t),e=r?vt(e):t,o=n&&!at(t.show)?t.show:t;!o||!s.zoomable&&-1!==u.indexOf(e)||!s.rotatable&&-1!==d.indexOf(e)||!s.scalable&&-1!==m.indexOf(e)||(i=n&&!at(t.size)?t.size:t,n=n&&!at(t.click)?t.click:t,t=document.createElement("li"),s.keyboard&&t.setAttribute("tabindex",0),t.setAttribute("role","button"),f(t,"".concat(g,"-").concat(e)),k(n)||bt(t,et,e),x(o)&&f(t,Dt(o)),-1!==["small","large"].indexOf(i)?f(t,"".concat(g,"-").concat(i)):"play"===e&&f(t,"".concat(g,"-large")),k(n)&&T(t,M,n),c.appendChild(t))}),n.appendChild(c)):f(n,A),s.rotatable||(f(h=n.querySelectorAll('li[class*="rotate"]'),R),z(h,function(t){n.appendChild(t)})),s.inline?(f(o,I),dt(i,{zIndex:s.zIndexInline}),"static"===window.getComputedStyle(e).position&&dt(e,{position:"relative"}),e.insertBefore(i,t.nextSibling)):(f(o,w),f(i,E),f(i,y),f(i,A),dt(i,{zIndex:s.zIndex}),(l=(l=ot(l=s.container)?t.ownerDocument.querySelector(l):l)||this.body).appendChild(i)),s.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,k(s.ready)&&T(t,G,s.ready,{once:!0}),!1!==D(t,G)?this.ready&&s.inline&&this.view(this.index):this.ready=!1)}}])&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),o}();return ct(o.prototype,r,t,At,St,Ot),o});
|
|
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});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewerjs",
|
|
3
3
|
"description": "JavaScript image viewer.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.0",
|
|
5
5
|
"main": "dist/viewer.common.js",
|
|
6
6
|
"module": "dist/viewer.esm.js",
|
|
7
7
|
"browser": "dist/viewer.js",
|
|
@@ -57,44 +57,44 @@
|
|
|
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": "^
|
|
63
|
-
"@commitlint/config-conventional": "^
|
|
64
|
-
"@rollup/plugin-babel": "^5.3.
|
|
60
|
+
"@babel/core": "^7.19.3",
|
|
61
|
+
"@babel/preset-env": "^7.19.4",
|
|
62
|
+
"@commitlint/cli": "^17.1.2",
|
|
63
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
64
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
65
65
|
"babel-plugin-istanbul": "^6.1.1",
|
|
66
66
|
"chai": "^4.3.6",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"codecov": "^3.8.3",
|
|
69
|
-
"cpy-cli": "^
|
|
69
|
+
"cpy-cli": "^4.2.0",
|
|
70
70
|
"create-banner": "^2.0.0",
|
|
71
|
-
"cssnano": "^5.
|
|
72
|
-
"del-cli": "^
|
|
73
|
-
"eslint": "^8.
|
|
71
|
+
"cssnano": "^5.1.13",
|
|
72
|
+
"del-cli": "^5.0.0",
|
|
73
|
+
"eslint": "^8.25.0",
|
|
74
74
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
75
|
-
"eslint-plugin-import": "^2.
|
|
76
|
-
"husky": "^
|
|
77
|
-
"karma": "^6.
|
|
75
|
+
"eslint-plugin-import": "^2.26.0",
|
|
76
|
+
"husky": "^8.0.1",
|
|
77
|
+
"karma": "^6.4.1",
|
|
78
78
|
"karma-chai": "^0.1.0",
|
|
79
|
-
"karma-chrome-launcher": "^3.1.
|
|
79
|
+
"karma-chrome-launcher": "^3.1.1",
|
|
80
80
|
"karma-coverage-istanbul-reporter": "^3.0.3",
|
|
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": "^
|
|
85
|
-
"mocha": "^9.2.
|
|
84
|
+
"lint-staged": "^13.0.3",
|
|
85
|
+
"mocha": "^9.2.2",
|
|
86
86
|
"npm-run-all": "^4.1.5",
|
|
87
|
-
"postcss": "^8.4.
|
|
88
|
-
"postcss-cli": "^
|
|
89
|
-
"postcss-header": "^3.0.
|
|
90
|
-
"postcss-import": "^
|
|
91
|
-
"postcss-preset-env": "^7.
|
|
87
|
+
"postcss": "^8.4.18",
|
|
88
|
+
"postcss-cli": "^10.0.0",
|
|
89
|
+
"postcss-header": "^3.0.2",
|
|
90
|
+
"postcss-import": "^15.0.0",
|
|
91
|
+
"postcss-preset-env": "^7.8.2",
|
|
92
92
|
"postcss-url": "^10.1.3",
|
|
93
|
-
"puppeteer": "^
|
|
94
|
-
"rollup": "^2.
|
|
95
|
-
"stylelint": "^14.
|
|
96
|
-
"stylelint-config-standard-scss": "^
|
|
93
|
+
"puppeteer": "^19.0.0",
|
|
94
|
+
"rollup": "^2.79.1",
|
|
95
|
+
"stylelint": "^14.14.0",
|
|
96
|
+
"stylelint-config-standard-scss": "^5.0.0",
|
|
97
97
|
"stylelint-order": "^5.0.0",
|
|
98
|
-
"uglify-js": "^3.
|
|
98
|
+
"uglify-js": "^3.17.3"
|
|
99
99
|
}
|
|
100
100
|
}
|
package/src/css/viewer.css
CHANGED
|
@@ -314,8 +314,9 @@
|
|
|
314
314
|
display: inline-block;
|
|
315
315
|
font-size: 12px;
|
|
316
316
|
line-height: 1.2;
|
|
317
|
-
margin:
|
|
317
|
+
margin: 5px 5%;
|
|
318
318
|
max-width: 90%;
|
|
319
|
+
min-height: 14px;
|
|
319
320
|
opacity: 0.8;
|
|
320
321
|
overflow: hidden;
|
|
321
322
|
text-overflow: ellipsis;
|
|
@@ -338,6 +339,7 @@
|
|
|
338
339
|
top: -40px;
|
|
339
340
|
transition: background-color 0.15s;
|
|
340
341
|
width: 80px;
|
|
342
|
+
-webkit-app-region: no-drag;
|
|
341
343
|
|
|
342
344
|
&:focus,
|
|
343
345
|
&:hover {
|
package/src/css/viewer.scss
CHANGED
|
@@ -317,8 +317,9 @@
|
|
|
317
317
|
display: inline-block;
|
|
318
318
|
font-size: 12px;
|
|
319
319
|
line-height: 1.2;
|
|
320
|
-
margin:
|
|
320
|
+
margin: 5px 5%;
|
|
321
321
|
max-width: 90%;
|
|
322
|
+
min-height: 14px;
|
|
322
323
|
opacity: 0.8;
|
|
323
324
|
overflow: hidden;
|
|
324
325
|
text-overflow: ellipsis;
|
|
@@ -341,6 +342,7 @@
|
|
|
341
342
|
top: -40px;
|
|
342
343
|
transition: background-color 0.15s;
|
|
343
344
|
width: 80px;
|
|
345
|
+
-webkit-app-region: no-drag;
|
|
344
346
|
|
|
345
347
|
&:focus,
|
|
346
348
|
&:hover {
|
package/src/js/defaults.js
CHANGED
|
@@ -71,7 +71,13 @@ export default {
|
|
|
71
71
|
],
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* Define the initial
|
|
74
|
+
* Define the initial coverage of the viewing image.
|
|
75
|
+
* @type {number}
|
|
76
|
+
*/
|
|
77
|
+
initialCoverage: 0.9,
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Define the initial index of the image for viewing.
|
|
75
81
|
* @type {number}
|
|
76
82
|
*/
|
|
77
83
|
initialViewIndex: 0,
|
package/src/js/handlers.js
CHANGED
|
@@ -273,7 +273,11 @@ export default {
|
|
|
273
273
|
|
|
274
274
|
// ArrowLeft
|
|
275
275
|
case 37:
|
|
276
|
-
this.
|
|
276
|
+
if (this.played && this.playing) {
|
|
277
|
+
this.playing.prev();
|
|
278
|
+
} else {
|
|
279
|
+
this.prev(options.loop);
|
|
280
|
+
}
|
|
277
281
|
break;
|
|
278
282
|
|
|
279
283
|
// ArrowUp
|
|
@@ -287,7 +291,11 @@ export default {
|
|
|
287
291
|
|
|
288
292
|
// ArrowRight
|
|
289
293
|
case 39:
|
|
290
|
-
this.
|
|
294
|
+
if (this.played && this.playing) {
|
|
295
|
+
this.playing.next();
|
|
296
|
+
} else {
|
|
297
|
+
this.next(options.loop);
|
|
298
|
+
}
|
|
291
299
|
break;
|
|
292
300
|
|
|
293
301
|
// ArrowDown
|
|
@@ -535,6 +543,6 @@ export default {
|
|
|
535
543
|
delta = event.detail > 0 ? 1 : -1;
|
|
536
544
|
}
|
|
537
545
|
|
|
538
|
-
this.zoom(-delta * ratio, true, event);
|
|
546
|
+
this.zoom(-delta * ratio, true, null, event);
|
|
539
547
|
},
|
|
540
548
|
};
|
package/src/js/methods.js
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
hasClass,
|
|
43
43
|
isFunction,
|
|
44
44
|
isNumber,
|
|
45
|
+
isPlainObject,
|
|
45
46
|
isUndefined,
|
|
46
47
|
removeClass,
|
|
47
48
|
removeListener,
|
|
@@ -196,7 +197,7 @@ export default {
|
|
|
196
197
|
addListener(image, EVENT_TRANSITION_END, onImageTransitionEnd, {
|
|
197
198
|
once: true,
|
|
198
199
|
});
|
|
199
|
-
this.zoomTo(0, false, null, true);
|
|
200
|
+
this.zoomTo(0, false, null, null, true);
|
|
200
201
|
} else {
|
|
201
202
|
onImageTransitionEnd();
|
|
202
203
|
}
|
|
@@ -663,11 +664,12 @@ export default {
|
|
|
663
664
|
/**
|
|
664
665
|
* Zoom the image with a relative ratio.
|
|
665
666
|
* @param {number} ratio - The target ratio.
|
|
666
|
-
* @param {boolean} [
|
|
667
|
+
* @param {boolean} [showTooltip=false] - Indicates whether to show the tooltip.
|
|
668
|
+
* @param {Object} [pivot] - The pivot point coordinate for zooming.
|
|
667
669
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
668
670
|
* @returns {Viewer} this
|
|
669
671
|
*/
|
|
670
|
-
zoom(ratio,
|
|
672
|
+
zoom(ratio, showTooltip = false, pivot = null, _originalEvent = null) {
|
|
671
673
|
const { imageData } = this;
|
|
672
674
|
|
|
673
675
|
ratio = Number(ratio);
|
|
@@ -678,7 +680,12 @@ export default {
|
|
|
678
680
|
ratio = 1 + ratio;
|
|
679
681
|
}
|
|
680
682
|
|
|
681
|
-
this.zoomTo(
|
|
683
|
+
this.zoomTo(
|
|
684
|
+
(imageData.width * ratio) / imageData.naturalWidth,
|
|
685
|
+
showTooltip,
|
|
686
|
+
pivot,
|
|
687
|
+
_originalEvent,
|
|
688
|
+
);
|
|
682
689
|
|
|
683
690
|
return this;
|
|
684
691
|
},
|
|
@@ -686,12 +693,13 @@ export default {
|
|
|
686
693
|
/**
|
|
687
694
|
* Zoom the image to an absolute ratio.
|
|
688
695
|
* @param {number} ratio - The target ratio.
|
|
689
|
-
* @param {boolean} [
|
|
696
|
+
* @param {boolean} [showTooltip] - Indicates whether to show the tooltip.
|
|
697
|
+
* @param {Object} [pivot] - The pivot point coordinate for zooming.
|
|
690
698
|
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
691
699
|
* @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not.
|
|
692
700
|
* @returns {Viewer} this
|
|
693
701
|
*/
|
|
694
|
-
zoomTo(ratio,
|
|
702
|
+
zoomTo(ratio, showTooltip = false, pivot = null, _originalEvent = null, _zoomable = false) {
|
|
695
703
|
const {
|
|
696
704
|
element,
|
|
697
705
|
options,
|
|
@@ -771,6 +779,9 @@ export default {
|
|
|
771
779
|
// Zoom from the triggering point of the event
|
|
772
780
|
imageData.x -= offsetWidth * (((center.pageX - offset.left) - x) / width);
|
|
773
781
|
imageData.y -= offsetHeight * (((center.pageY - offset.top) - y) / height);
|
|
782
|
+
} else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
|
|
783
|
+
imageData.x -= offsetWidth * ((pivot.x - x) / width);
|
|
784
|
+
imageData.y -= offsetHeight * ((pivot.y - y) / height);
|
|
774
785
|
} else {
|
|
775
786
|
// Zoom from the center of the image
|
|
776
787
|
imageData.x -= offsetWidth / 2;
|
|
@@ -801,7 +812,7 @@ export default {
|
|
|
801
812
|
});
|
|
802
813
|
});
|
|
803
814
|
|
|
804
|
-
if (
|
|
815
|
+
if (showTooltip) {
|
|
805
816
|
this.tooltip();
|
|
806
817
|
}
|
|
807
818
|
}
|
|
@@ -869,18 +880,29 @@ export default {
|
|
|
869
880
|
});
|
|
870
881
|
|
|
871
882
|
if (isNumber(options.interval) && options.interval > 0) {
|
|
872
|
-
const
|
|
873
|
-
this.playing
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
883
|
+
const prev = () => {
|
|
884
|
+
clearTimeout(this.playing.timeout);
|
|
885
|
+
removeClass(list[index], CLASS_IN);
|
|
886
|
+
index -= 1;
|
|
887
|
+
index = index >= 0 ? index : total - 1;
|
|
888
|
+
addClass(list[index], CLASS_IN);
|
|
889
|
+
this.playing.timeout = setTimeout(prev, options.interval);
|
|
890
|
+
};
|
|
891
|
+
const next = () => {
|
|
892
|
+
clearTimeout(this.playing.timeout);
|
|
893
|
+
removeClass(list[index], CLASS_IN);
|
|
894
|
+
index += 1;
|
|
895
|
+
index = index < total ? index : 0;
|
|
896
|
+
addClass(list[index], CLASS_IN);
|
|
897
|
+
this.playing.timeout = setTimeout(next, options.interval);
|
|
880
898
|
};
|
|
881
899
|
|
|
882
900
|
if (total > 1) {
|
|
883
|
-
|
|
901
|
+
this.playing = {
|
|
902
|
+
prev,
|
|
903
|
+
next,
|
|
904
|
+
timeout: setTimeout(next, options.interval),
|
|
905
|
+
};
|
|
884
906
|
}
|
|
885
907
|
}
|
|
886
908
|
|
|
@@ -907,8 +929,9 @@ export default {
|
|
|
907
929
|
|
|
908
930
|
const { player } = this;
|
|
909
931
|
|
|
932
|
+
clearTimeout(this.playing.timeout);
|
|
933
|
+
this.playing = false;
|
|
910
934
|
this.played = false;
|
|
911
|
-
clearTimeout(this.playing);
|
|
912
935
|
forEach(player.getElementsByTagName('img'), (image) => {
|
|
913
936
|
removeListener(image, EVENT_LOAD, this.onLoadWhenPlay);
|
|
914
937
|
});
|
|
@@ -1098,9 +1121,9 @@ export default {
|
|
|
1098
1121
|
*/
|
|
1099
1122
|
toggle(_originalEvent = null) {
|
|
1100
1123
|
if (this.imageData.ratio === 1) {
|
|
1101
|
-
this.zoomTo(this.imageData.oldRatio, true, _originalEvent);
|
|
1124
|
+
this.zoomTo(this.imageData.oldRatio, true, null, _originalEvent);
|
|
1102
1125
|
} else {
|
|
1103
|
-
this.zoomTo(1, true, _originalEvent);
|
|
1126
|
+
this.zoomTo(1, true, null, _originalEvent);
|
|
1104
1127
|
}
|
|
1105
1128
|
|
|
1106
1129
|
return this;
|
package/src/js/others.js
CHANGED
|
@@ -40,17 +40,22 @@ export default {
|
|
|
40
40
|
this.clearEnforceFocus();
|
|
41
41
|
addListener(document, EVENT_FOCUSIN, (this.onFocusin = (event) => {
|
|
42
42
|
const { viewer } = this;
|
|
43
|
-
|
|
43
|
+
let { target } = event;
|
|
44
44
|
|
|
45
|
-
if (target
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
if (target === document || target === viewer || viewer.contains(target)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
while (target) {
|
|
50
|
+
// Avoid conflicts with other modals (#474, #540)
|
|
51
|
+
if ((target.getAttribute('tabindex') !== null || target.getAttribute('aria-modal') === 'true')) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
&& (target.getAttribute('tabindex') === null || target.getAttribute('aria-modal') !== 'true')
|
|
51
|
-
) {
|
|
52
|
-
viewer.focus();
|
|
55
|
+
target = target.parentElement;
|
|
53
56
|
}
|
|
57
|
+
|
|
58
|
+
viewer.focus();
|
|
54
59
|
}));
|
|
55
60
|
},
|
|
56
61
|
|
|
@@ -66,14 +71,19 @@ export default {
|
|
|
66
71
|
|
|
67
72
|
addClass(body, CLASS_OPEN);
|
|
68
73
|
|
|
69
|
-
|
|
74
|
+
if (this.scrollbarWidth > 0) {
|
|
75
|
+
body.style.paddingRight = `${this.scrollbarWidth + (parseFloat(this.initialBodyComputedPaddingRight) || 0)}px`;
|
|
76
|
+
}
|
|
70
77
|
},
|
|
71
78
|
|
|
72
79
|
close() {
|
|
73
80
|
const { body } = this;
|
|
74
81
|
|
|
75
82
|
removeClass(body, CLASS_OPEN);
|
|
76
|
-
|
|
83
|
+
|
|
84
|
+
if (this.scrollbarWidth > 0) {
|
|
85
|
+
body.style.paddingRight = this.initialBodyPaddingRight;
|
|
86
|
+
}
|
|
77
87
|
},
|
|
78
88
|
|
|
79
89
|
shown() {
|
|
@@ -210,7 +220,7 @@ export default {
|
|
|
210
220
|
|
|
211
221
|
// Zoom the current image
|
|
212
222
|
case ACTION_ZOOM:
|
|
213
|
-
this.zoom(getMaxZoomRatio(pointers), false, event);
|
|
223
|
+
this.zoom(getMaxZoomRatio(pointers), false, null, event);
|
|
214
224
|
break;
|
|
215
225
|
|
|
216
226
|
case ACTION_SWITCH: {
|