Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

viewerjs

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viewerjs - npm Package Compare versions

Comparing version 1.0.0-rc to 1.0.0-rc.1

6

CHANGELOG.md
# Changelog
## 1.0.0-rc.1 (Mar 13, 2018)
- Fix the wrong image switching behavior in iOS browsers.
- Fix a `TypeError` in strict mode (#149).
- Fix type definitions issue of the `show` and `hide` methods.
## 1.0.0-rc (Mar 10, 2018)

@@ -4,0 +10,0 @@

6

dist/viewer.min.js
/*!
* Viewer.js v1.0.0-rc
* Viewer.js v1.0.0-rc.1
* https://github.com/fengyuanchen/viewerjs

@@ -8,4 +8,4 @@ *

*
* Date: 2018-03-10T13:05:00.762Z
* Date: 2018-03-13T14:06:27.179Z
*/
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Viewer=i()}(this,function(){"use strict";var n={inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,interval:5e3,keyboard:!0,backdrop:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,zIndex:2015,zIndexInline:0,url:"src",container:"body",filter:null,ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null},t="undefined"!=typeof window?window:{},p="viewer",l="move",d="switch",c="zoom",m=p+"-active",w=p+"-fade",b=p+"-fixed",o=p+"-fullscreen-exit",y=p+"-hide",i=p+"-hide-md-down",e=p+"-hide-sm-down",s=p+"-hide-xs-down",u=p+"-in",x=p+"-invisible",f=p+"-loading",a=p+"-open",g=p+"-show",v=p+"-transition",D="ready",r="show",h="shown",z="hide",k="hidden",E="view",S="viewed",I="click",T="dragstart",L="keydown",C="load",M=t.PointerEvent?"pointerdown":"touchstart mousedown",N=t.PointerEvent?"pointermove":"mousemove touchmove",Y=t.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",X="resize",R="transitionend",q="wheel mousewheel DOMMouseScroll",F=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"],O="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},W=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},P=function(){function n(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&n(t.prototype,i),e&&n(t,e),t}}();function A(t){return"string"==typeof t}var H=Number.isNaN||t.isNaN;function j(t){return"number"==typeof t&&!H(t)}function B(t){return void 0===t}function V(t){return"object"===(void 0===t?"undefined":O(t))&&null!==t}var K=Object.prototype.hasOwnProperty;function U(t){if(!V(t))return!1;try{var i=t.constructor,e=i.prototype;return i&&e&&K.call(e,"isPrototypeOf")}catch(t){return!1}}function Z(t){return"function"==typeof t}function $(i,e){if(i&&Z(e))if(Array.isArray(i)||j(i.length)){var t=i.length,n=void 0;for(n=0;n<t&&!1!==e.call(i,i[n],n,i);n+=1);}else V(i)&&Object.keys(i).forEach(function(t){e.call(i,i[t],t,i)});return i}var _=Object.assign||function(e){for(var t=arguments.length,i=Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return V(e)&&0<i.length&&i.forEach(function(i){V(i)&&Object.keys(i).forEach(function(t){e[t]=i[t]})}),e},G=/^(?:width|height|left|top|marginLeft|marginTop)$/;function J(t,i){var e=t.style;$(i,function(t,i){G.test(i)&&j(t)&&(t+="px"),e[i]=t})}function Q(t,i){return t.classList?t.classList.contains(i):-1<t.className.indexOf(i)}function tt(t,i){if(i)if(j(t.length))$(t,function(t){tt(t,i)});else if(t.classList)t.classList.add(i);else{var e=t.className.trim();e?e.indexOf(i)<0&&(t.className=e+" "+i):t.className=i}}function it(t,i){i&&(j(t.length)?$(t,function(t){it(t,i)}):t.classList?t.classList.remove(i):0<=t.className.indexOf(i)&&(t.className=t.className.replace(i,"")))}function et(t,i,e){i&&(j(t.length)?$(t,function(t){et(t,i,e)}):e?tt(t,i):it(t,i))}var nt=/([a-z\d])([A-Z])/g;function st(t){return t.replace(nt,"$1-$2").toLowerCase()}function ot(t,i){return V(t[i])?t[i]:t.dataset?t.dataset[i]:t.getAttribute("data-"+st(i))}function at(t,i,e){V(e)?t[i]=e:t.dataset?t.dataset[i]=e:t.setAttribute("data-"+st(i),e)}var rt,ht,lt,dt=/\s\s*/,ct=(rt=!1,ht=function(){},lt=Object.defineProperty({},"once",{get:function(){return rt=!0}}),t.addEventListener("test",ht,lt),t.removeEventListener("test",ht,lt),rt);function ut(e,t,n){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},o=n;t.trim().split(dt).forEach(function(t){if(!ct){var i=e.listeners;i&&i[t]&&i[t][n]&&(o=i[t][n],delete i[t][n],0===Object.keys(i[t]).length&&delete i[t],0===Object.keys(i).length&&delete e.listeners)}e.removeEventListener(t,o,s)})}function mt(o,t,a){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},h=a;t.trim().split(dt).forEach(function(n){if(r.once&&!ct){var t=o.listeners,s=void 0===t?{}:t;h=function(){for(var t=arguments.length,i=Array(t),e=0;e<t;e++)i[e]=arguments[e];delete s[n][a],o.removeEventListener(n,h,r),a.apply(o,i)},s[n]||(s[n]={}),s[n][a]&&o.removeEventListener(n,s[n][a],r),s[n][a]=h,o.listeners=s}o.addEventListener(n,h,r)})}function ft(t,i,e){var n=void 0;return Z(Event)&&Z(CustomEvent)?n=new CustomEvent(i,{detail:e,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(i,!0,!0,e),t.dispatchEvent(n)}function gt(t){var i=t.rotate,e=t.scaleX,n=t.scaleY,s=t.translateX,o=t.translateY,a=[];j(s)&&0!==s&&a.push("translateX("+s+"px)"),j(o)&&0!==o&&a.push("translateY("+o+"px)"),j(i)&&0!==i&&a.push("rotate("+i+"deg)"),j(e)&&1!==e&&a.push("scaleX("+e+")"),j(n)&&1!==n&&a.push("scaleY("+n+")");var r=a.length?a.join(" "):"none";return{WebkitTransform:r,msTransform:r,transform:r}}var vt=t.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(t.navigator.userAgent);function pt(t,i){var e=document.createElement("img");if(t.naturalWidth&&!vt)return i(t.naturalWidth,t.naturalHeight),e;var n=document.body||document.documentElement;return e.onload=function(){i(e.width,e.height),vt||n.removeChild(e)},e.src=t.src,vt||(e.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",n.appendChild(e)),e}function wt(t){switch(t){case 2:return s;case 3:return e;case 4:return i;default:return""}}function bt(t,i){var e=t.pageX,n=t.pageY,s={endX:e,endY:n};return i?s:_({startX:e,startY:n},s)}var yt={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var t=this.options,i=this.parent,e=void 0;t.inline&&(e={width:Math.max(i.offsetWidth,t.minWidth),height:Math.max(i.offsetHeight,t.minHeight)},this.parentData=e),!this.fulled&&e||(e=this.containerData),this.viewerData=_({},e)},renderViewer:function(){this.options.inline&&!this.fulled&&J(this.viewer,this.viewerData)},initList:function(){var a=this,t=this.element,r=this.options,i=this.list,h=[];$(this.images,function(t,i){var e,n=t.src,s=t.alt||(A(e=n)?e.replace(/^.*\//,"").replace(/[?&#].*$/,""):""),o=r.url;A(o)?o=t.getAttribute(o):Z(o)&&(o=o.call(a,t)),(n||o)&&h.push('<li><img src="'+(n||o)+'" role="button" data-action="view" data-index="'+i+'" data-original-url="'+(o||n)+'" alt="'+s+'"></li>')}),i.innerHTML=h.join(""),this.items=i.getElementsByTagName("li"),$(this.items,function(i){var t=i.firstElementChild;at(t,"filled",!0),r.loading&&tt(i,f),mt(t,C,function(t){r.loading&&it(i,f),a.loadImage(t)},{once:!0})}),r.transition&&mt(t,S,function(){tt(i,v)},{once:!0})},renderList:function(t){var i=t||this.index,e=this.items[i].offsetWidth||30,n=e+1;J(this.list,_({width:n*this.length},gt({translateX:(this.viewerData.width-e)/2-n*i})))},resetList:function(){var t=this.list;t.innerHTML="",it(t,v),J(t,gt({translateX:0}))},initImage:function(r){var h=this,l=this.options,t=this.image,i=this.viewerData,e=this.footer.offsetHeight,d=i.width,c=Math.max(i.height-e,e),u=this.imageData||{},n=void 0;this.imageInitializing={abort:function(){n.onload=null}},n=pt(t,function(t,i){var e=t/i,n=d,s=c;h.imageInitializing=!1,d<c*e?s=d/e:n=c*e;var o={naturalWidth:t,naturalHeight:i,aspectRatio:e,ratio:(n=Math.min(.9*n,t))/t,width:n,height:s=Math.min(.9*s,i),left:(d-n)/2,top:(c-s)/2},a=_({},o);l.rotatable&&(o.rotate=u.rotate||0,a.rotate=0),l.scalable&&(o.scaleX=u.scaleX||1,o.scaleY=u.scaleY||1,a.scaleX=1,a.scaleY=1),h.imageData=o,h.initialImageData=a,r&&r()})},renderImage:function(t){var i=this,e=this.image,n=this.imageData;if(J(e,_({width:n.width,height:n.height,marginLeft:n.left,marginTop:n.top},gt(n))),t)if(this.viewing&&this.options.transition){var s=function(){i.imageRendering=!1,t()};this.imageRendering={abort:function(){ut(e,R,s)}},mt(e,R,s,{once:!0})}else t()},resetImage:function(){if(this.viewing||this.viewed){var t=this.image;this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null}}},xt={bind:function(){var t=this.element,i=this.viewer;mt(i,I,this.onClick=this.click.bind(this)),mt(i,q,this.onWheel=this.wheel.bind(this)),mt(i,T,this.onDragStart=this.dragstart.bind(this)),mt(this.canvas,M,this.onPointerDown=this.pointerdown.bind(this)),mt(t.ownerDocument,N,this.onPointerMove=this.pointermove.bind(this)),mt(t.ownerDocument,Y,this.onPointerUp=this.pointerup.bind(this)),mt(t.ownerDocument,L,this.onKeyDown=this.keydown.bind(this)),mt(window,X,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.viewer;ut(i,I,this.onClick),ut(i,q,this.onWheel),ut(i,T,this.onDragStart),ut(this.canvas,M,this.onPointerDown),ut(t.ownerDocument,N,this.onPointerMove),ut(t.ownerDocument,Y,this.onPointerUp),ut(t.ownerDocument,L,this.onKeyDown),ut(window,X,this.onResize)}},Dt={click:function(t){var i=t.target,e=this.options,n=this.imageData;switch(ot(i,"action")){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(ot(i,"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(-n.scaleX||-1);break;case"flip-vertical":this.scaleY(-n.scaleY||-1);break;default:this.played&&this.stop()}},load:function(){var t=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var i=this.element,e=this.options,n=this.image,s=this.index,o=this.viewerData;it(n,x),e.loading&&it(this.canvas,f),n.style.cssText="height:0;margin-left:"+o.width/2+"px;margin-top:"+o.height/2+"px;max-width:none!important;position:absolute;width:0;",this.initImage(function(){et(n,"viewer-move",e.movable),et(n,v,e.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,Z(e.viewed)&&mt(i,S,e.viewed,{once:!0}),ft(i,S,{originalImage:t.images[s],index:s,image:n})})})},loadImage:function(t){var o=t.target,i=o.parentNode,a=i.offsetWidth||30,r=i.offsetHeight||50,h=!!ot(o,"filled");pt(o,function(t,i){var e=t/i,n=a,s=r;a<r*e?h?n=r*e:s=a/e:h?s=a/e:n=r*e,J(o,_({width:n,height:s},gt({translateX:(a-n)/2,translateY:(r-s)/2})))})},keydown:function(t){var i=this.options;if(this.fulled&&i.keyboard)switch(t.keyCode||t.which||t.charCode){case 27:this.played?this.stop():i.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.prev(i.loop);break;case 38:t.preventDefault(),this.zoom(i.zoomRatio,!0);break;case 39:this.next(i.loop);break;case 40:t.preventDefault(),this.zoom(-i.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle())}},dragstart:function(t){"img"===t.target.tagName.toLowerCase()&&t.preventDefault()},pointerdown:function(t){var i=this.options,e=this.pointers;if(this.viewed&&!this.showing&&!this.viewing&&!this.hiding){t.changedTouches?$(t.changedTouches,function(t){e[t.identifier]=bt(t)}):e[t.pointerId||0]=bt(t);var n=!!i.movable&&l;1<Object.keys(e).length?n=c:"touch"!==t.pointerType&&"touchstart"!==t.type||!this.isSwitchable()||(n=d),this.action=n}},pointermove:function(t){var i=this.options,e=this.pointers,n=this.action,s=this.image;this.viewed&&n&&(t.preventDefault(),t.changedTouches?$(t.changedTouches,function(t){_(e[t.identifier],bt(t,!0))}):_(e[t.pointerId||0],bt(t,!0)),n===l&&i.transition&&Q(s,v)&&it(s,v),this.change(t))},pointerup:function(t){var i=this.action,e=this.pointers;t.changedTouches?$(t.changedTouches,function(t){delete e[t.identifier]}):delete e[t.pointerId||0],i&&(i===l&&this.options.transition&&tt(this.image,v),this.action=!1)},resize:function(){var i=this;if(this.isShown&&!this.hiding&&(this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){i.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement)return void this.stop();$(this.player.getElementsByTagName("img"),function(t){mt(t,C,i.loadImage.bind(i),{once:!0}),ft(t,C)})}},wheel:function(t){var i=this;if(this.viewed&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var e=Number(this.options.zoomRatio)||.1,n=1;t.deltaY?n=0<t.deltaY?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=0<t.detail?1:-1),this.zoom(-n*e,!0,t)}}},zt={show:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if(Z(e.show)&&mt(i,r,e.show,{once:!0}),!1===ft(i,r)||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var n=this.viewer;if(it(n,y),e.transition&&!t){var s=this.shown.bind(this);this.transitioning={abort:function(){ut(n,R,s),it(n,u)}},tt(n,v),n.offsetWidth,mt(n,R,s,{once:!0}),tt(n,u)}else tt(n,u),this.shown();return this},hide:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.hiding||!this.isShown&&!this.showing)return this;if(Z(e.hide)&&mt(i,z,e.hide,{once:!0}),!1===ft(i,z))return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var n=this.viewer;if(e.transition&&!t){var s=this.hidden.bind(this),o=function(){mt(n,R,s,{once:!0}),it(n,u)};this.transitioning={abort:function(){this.viewed?ut(this.image,R,o):ut(n,R,s)}},this.viewed?(mt(this.image,R,o,{once:!0}),this.zoomTo(0,!1,!1,!0)):o()}else it(n,u),this.hidden();return this},view:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(t=Number(t)||0,!this.isShown)return this.index=t,this.show();if(this.hiding||this.played||t<0||t>=this.length||this.viewed&&t===this.index)return this;this.viewing&&this.viewing.abort();var e=this.element,n=this.options,s=this.title,o=this.canvas,a=this.items[t],r=a.querySelector("img"),h=ot(r,"originalUrl"),l=r.getAttribute("alt"),d=document.createElement("img");if(d.src=h,d.alt=l,Z(n.view)&&mt(e,E,n.view,{once:!0}),!1===ft(e,E,{originalImage:this.images[t],index:t,image:d})||!this.isShown||this.hiding||this.played)return this;this.image=d,it(this.items[this.index],m),tt(a,m),this.viewed=!1,this.index=t,this.imageData={},tt(d,x),n.loading&&tt(o,f),o.innerHTML="",o.appendChild(d),this.renderList(),s.innerHTML="";var c=function(){var t=i.imageData;s.textContent=l+" ("+t.naturalWidth+" × "+t.naturalHeight+")"},u=void 0;return mt(e,S,c,{once:!0}),this.viewing={abort:function(){ut(e,S,c),d.complete?this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort():(ut(d,C,u),this.timeout&&clearTimeout(this.timeout))}},d.complete?this.load():(mt(d,C,u=this.load.bind(this),{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){it(d,x),i.timeout=!1},1e3)),this},prev:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.index-1;return i<0&&(i=t?this.length-1:0),this.view(i),this},next:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.length-1,e=this.index+1;return i<e&&(e=t?0:i),this.view(e),this},move:function(t,i){var e=this.imageData;return this.moveTo(B(t)?t:e.left+Number(t),B(i)?i:e.top+Number(i)),this},moveTo:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.movable){var n=!1;j(t)&&(e.left=t,n=!0),j(i)&&(e.top=i,n=!0),n&&this.renderImage()}return this},zoom:function(t){var i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=this.imageData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(n.width*t/n.naturalWidth,i,e),this},zoomTo:function(t){var n,s,o,i,e,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,h=3<arguments.length&&void 0!==arguments[3]&&arguments[3],l=this.options,d=this.pointers,c=this.imageData;if(j(t=Math.max(0,t))&&this.viewed&&!this.played&&(h||l.zoomable)){if(!h){var u=Math.max(.01,l.minZoomRatio),m=Math.min(100,l.maxZoomRatio);t=Math.min(Math.max(t,u),m)}r&&.95<t&&t<1.05&&(t=1);var f=c.naturalWidth*t,g=c.naturalHeight*t;if(r){var v=(i=this.viewer,{left:(e=i.getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}),p=d&&Object.keys(d).length?(o=s=n=0,$(d,function(t){var i=t.startX,e=t.startY;n+=i,s+=e,o+=1}),{pageX:n/=o,pageY:s/=o}):{pageX:r.pageX,pageY:r.pageY};c.left-=(f-c.width)*((p.pageX-v.left-c.left)/c.width),c.top-=(g-c.height)*((p.pageY-v.top-c.top)/c.height)}else c.left-=(f-c.width)/2,c.top-=(g-c.height)/2;c.width=f,c.height=g,c.ratio=t,this.renderImage(),a&&this.tooltip()}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var i=this.imageData;return j(t=Number(t))&&this.viewed&&!this.played&&this.options.rotatable&&(i.rotate=t,this.renderImage()),this},scaleX:function(t){return this.scale(t,this.imageData.scaleY),this},scaleY:function(t){return this.scale(this.imageData.scaleX,t),this},scale:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.scalable){var n=!1;j(t)&&(e.scaleX=t,n=!0),j(i)&&(e.scaleY=i,n=!0),n&&this.renderImage()}return this},play:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(!this.isShown||this.played)return this;var s=this.options,o=this.player,a=this.loadImage.bind(this),r=[],h=0,l=0;if(this.played=!0,this.onLoadWhenPlay=a,t&&this.requestFullscreen(),tt(o,g),$(this.items,function(t,i){var e=t.querySelector("img"),n=document.createElement("img");n.src=ot(e,"originalUrl"),n.alt=e.getAttribute("alt"),h+=1,tt(n,w),et(n,v,s.transition),Q(t,m)&&(tt(n,u),l=i),r.push(n),mt(n,C,a,{once:!0}),o.appendChild(n)}),j(s.interval)&&0<s.interval){var e=function t(){i.playing=setTimeout(function(){it(r[l],u),tt(r[l=(l+=1)<h?l:0],u),t()},s.interval)};1<h&&e()}return this},stop:function(){var i=this;if(!this.played)return this;var t=this.player;return this.played=!1,clearTimeout(this.playing),$(t.getElementsByTagName("img"),function(t){ut(t,C,i.onLoadWhenPlay)}),it(t,g),t.innerHTML="",this.exitFullscreen(),this},full:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return!this.isShown||this.played||this.fulled||!i.inline||(this.fulled=!0,this.open(),tt(this.button,o),i.transition&&(it(s,v),this.viewed&&it(n,v)),tt(e,b),e.setAttribute("style",""),J(e,{zIndex:i.zIndex}),this.initContainer(),this.viewerData=_({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){tt(n,v),tt(s,v)},0)})})),this},exit:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return this.isShown&&!this.played&&this.fulled&&i.inline&&(this.fulled=!1,this.close(),it(this.button,o),i.transition&&(it(s,v),this.viewed&&it(n,v)),it(e,b),J(e,{zIndex:i.zIndexInline}),this.viewerData=_({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){tt(n,v),tt(s,v)},0)})})),this},tooltip:function(){var t=this,i=this.options,e=this.tooltipBox,n=this.imageData;return this.viewed&&!this.played&&i.tooltip&&(e.textContent=Math.round(100*n.ratio)+"%",this.tooltipping?clearTimeout(this.tooltipping):i.transition?(this.fading&&ft(e,R),tt(e,g),tt(e,w),tt(e,v),e.offsetWidth,tt(e,u)):tt(e,g),this.tooltipping=setTimeout(function(){i.transition?(mt(e,R,function(){it(e,g),it(e,w),it(e,v),t.fading=!1},{once:!0}),it(e,u),t.fading=!0):it(e,g),t.tooltipping=!1},1e3)),this},toggle:function(){return 1===this.imageData.ratio?this.zoomTo(this.initialImageData.ratio,!0):this.zoomTo(1,!0),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=_({},this.initialImageData),this.renderImage()),this},update:function(){var t=this.element,i=this.options,e=this.isImg,s=[];if(e&&!t.parentNode)return this.destroy();var o=[];if($(e?[t]:t.querySelectorAll("img"),function(t){i.filter?i.filter(t)&&o.push(t):o.push(t)}),this.images=o,this.length=o.length,this.ready&&($(this.items,function(t,i){var e=t.querySelector("img"),n=o[i];n?n.src!==e.src&&s.push(i):s.push(i)}),J(this.list,{width:"auto"}),this.initList(),this.isShown))if(this.length){if(this.viewed){var n=s.indexOf(this.index);0<=n?(this.viewed=!1,this.view(Math.max(this.index-(n+1),0))):tt(this.items[this.index],m)}}else this.image=null,this.viewed=!1,this.index=0,this.imageData=null,this.canvas.innerHTML="",this.title.innerHTML="";return this},destroy:function(){var t=this.element,i=this.options;return ot(t,p)&&(this.destroyed=!0,this.ready?(this.played&&this.stop(),i.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):i.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),i.inline||ut(t,I,this.onStart),function(i,e){if(V(i[e]))try{delete i[e]}catch(t){i[e]=void 0}else if(i.dataset)try{delete i.dataset[e]}catch(t){i.dataset[e]=void 0}else i.removeAttribute("data-"+st(e))}(t,p)),this}},kt={open:function(){var t=this.body;tt(t,a),t.style.paddingRight=this.scrollbarWidth+(parseFloat(this.initialBodyPaddingRight)||0)+"px"},close:function(){var t=this.body;it(t,a),t.style.paddingRight=this.initialBodyPaddingRight},shown:function(){var t=this.element,i=this.options;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,Z(i.shown)&&mt(t,h,i.shown,{once:!0}),!1!==ft(t,h)&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,i=this.options;this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),tt(this.viewer,y),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||(Z(i.hidden)&&mt(t,k,i.hidden,{once:!0}),ft(t,k))},requestFullscreen:function(){var t=this.element.ownerDocument;if(this.fulled&&!t.fullscreenElement&&!t.mozFullScreenElement&&!t.webkitFullscreenElement&&!t.msFullscreenElement){var i=t.documentElement;i.requestFullscreen?i.requestFullscreen():i.msRequestFullscreen?i.msRequestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen&&i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}},exitFullscreen:function(){if(this.fulled){var t=this.element.ownerDocument;t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}},change:function(t){var i,e,h,n=this.options,s=this.pointers,o=s[Object.keys(s)[0]],a=o.endX-o.startX,r=o.endY-o.startY;switch(this.action){case l:this.move(a,r);break;case c:this.zoom((e=_({},i=s),h=[],$(i,function(r,t){delete e[t],$(e,function(t){var i=Math.abs(r.startX-t.startX),e=Math.abs(r.startY-t.startY),n=Math.abs(r.endX-t.endX),s=Math.abs(r.endY-t.endY),o=Math.sqrt(i*i+e*e),a=(Math.sqrt(n*n+s*s)-o)/o;h.push(a)})}),h.sort(function(t,i){return Math.abs(t)<Math.abs(i)}),h[0]),!1,t);break;case d:this.action="switched",Math.abs(a)>Math.abs(r)&&(1<a?this.prev(n.loop):a<-1&&this.next(n.loop))}$(s,function(t){t.startX=t.endX,t.startY=t.endY})},isSwitchable:function(){var t=this.imageData,i=this.viewerData;return 1<this.length&&0<=t.left&&0<=t.top&&t.width<=i.width&&t.height<=i.height}},Et=t.Viewer,St=function(){function e(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(W(this,e),!t||1!==t.nodeType)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=_({},n,U(i)&&i),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.index=0,this.isImg=!1,this.length=0,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.isShown=!1,this.wheeling=!1,this.init()}return P(e,[{key:"init",value:function(){var e=this,t=this.element,i=this.options;if(!ot(t,p)){at(t,p,this);var n="img"===t.tagName.toLowerCase(),s=[];if($(n?[t]:t.querySelectorAll("img"),function(t){Z(i.filter)?i.filter.call(e,t)&&s.push(t):s.push(t)}),s.length){this.isImg=n,this.length=s.length,this.images=s;var o=t.ownerDocument,a=o.body||o.documentElement;if(this.body=a,this.scrollbarWidth=window.innerWidth-o.documentElement.clientWidth,this.initialBodyPaddingRight=window.getComputedStyle(a).paddingRight,B(document.createElement(p).style.transition)&&(i.transition=!1),i.inline){var r=0,h=function(){if((r+=1)===e.length){var t=void 0;e.initializing=!1,e.delaying={abort:function(){clearTimeout(t)}},t=setTimeout(function(){e.delaying=!1,e.build()},0)}};this.initializing={abort:function(){$(s,function(t){t.complete||ut(t,C,h)})}},$(s,function(t){t.complete?h():mt(t,C,h,{once:!0})})}else mt(t,I,this.onStart=function(t){var i=t.target;"img"===i.tagName.toLowerCase()&&e.view(e.images.indexOf(i))})}}}},{key:"build",value:function(){if(!this.ready){var t=this.element,h=this.options,i=t.parentNode,e=document.createElement("div");e.innerHTML='<div class="viewer-container" 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"></ul></div></div><div class="viewer-tooltip"></div><div role="button" class="viewer-button" data-action="mix"></div><div class="viewer-player"></div></div>';var n=e.querySelector("."+p+"-container"),s=n.querySelector("."+p+"-title"),o=n.querySelector("."+p+"-toolbar"),a=n.querySelector("."+p+"-navbar"),r=n.querySelector("."+p+"-button"),l=n.querySelector("."+p+"-canvas");if(this.parent=i,this.viewer=n,this.title=s,this.toolbar=o,this.navbar=a,this.button=r,this.canvas=l,this.footer=n.querySelector("."+p+"-footer"),this.tooltipBox=n.querySelector("."+p+"-tooltip"),this.player=n.querySelector("."+p+"-player"),this.list=n.querySelector("."+p+"-list"),tt(s,h.title?wt(h.title):y),tt(a,h.navbar?wt(h.navbar):y),et(r,y,!h.button),h.backdrop&&(tt(n,p+"-backdrop"),h.inline||!0!==h.backdrop||at(l,"action","hide")),h.toolbar){var d=document.createElement("ul"),c=U(h.toolbar),u=F.slice(0,3),m=F.slice(7,9),f=F.slice(9);c||tt(o,wt(h.toolbar)),$(c?h.toolbar:F,function(t,i){var e=c&&U(t),n=c?st(i):t,s=e&&!B(t.show)?t.show:t;if(s&&(h.zoomable||-1===u.indexOf(n))&&(h.rotatable||-1===m.indexOf(n))&&(h.scalable||-1===f.indexOf(n))){var o=e&&!B(t.size)?t.size:t,a=e&&!B(t.click)?t.click:t,r=document.createElement("li");r.setAttribute("role","button"),tt(r,p+"-"+n),Z(a)||at(r,"action",n),j(s)&&tt(r,wt(s)),-1!==["small","large"].indexOf(o)?tt(r,p+"-"+o):"play"===n&&tt(r,p+"-large"),Z(a)&&mt(r,I,a),d.appendChild(r)}}),o.appendChild(d)}else tt(o,y);if(!h.rotatable){var g=o.querySelectorAll('li[class*="rotate"]');tt(g,x),$(g,function(t){o.appendChild(t)})}if(h.inline)tt(r,"viewer-fullscreen"),J(n,{zIndex:h.zIndexInline}),"static"===window.getComputedStyle(i).position&&J(i,{position:"relative"}),i.insertBefore(n,t.nextSibling);else{tt(r,"viewer-close"),tt(n,b),tt(n,w),tt(n,y),J(n,{zIndex:h.zIndex});var v=h.container;A(v)&&(v=t.ownerDocument.querySelector(v)),v||(v=this.body),v.appendChild(n)}h.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Z(h.ready)&&mt(t,D,h.ready,{once:!0}),!1!==ft(t,D)?this.ready&&h.inline&&this.view():this.ready=!1}}}],[{key:"noConflict",value:function(){return window.Viewer=Et,e}},{key:"setDefaults",value:function(t){_(n,U(t)&&t)}}]),e}();return _(St.prototype,yt,xt,Dt,zt,kt),St});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Viewer=i()}(this,function(){"use strict";var n={inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,interval:5e3,keyboard:!0,backdrop:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,zIndex:2015,zIndexInline:0,url:"src",container:"body",filter:null,ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null},t="undefined"!=typeof window?window:{},p="viewer",l="move",d="switch",c="zoom",m=p+"-active",w=p+"-fade",b=p+"-fixed",o=p+"-fullscreen-exit",y=p+"-hide",i=p+"-hide-md-down",e=p+"-hide-sm-down",s=p+"-hide-xs-down",u=p+"-in",x=p+"-invisible",f=p+"-loading",a=p+"-open",g=p+"-show",v=p+"-transition",D="ready",r="show",h="shown",z="hide",k="hidden",E="view",S="viewed",I="click",T="dragstart",L="keydown",C="load",M=t.PointerEvent?"pointerdown":"touchstart mousedown",N=t.PointerEvent?"pointermove":"touchmove mousemove",Y=t.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",X="resize",R="transitionend",q="wheel mousewheel DOMMouseScroll",F=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"],O="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},W=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},P=function(){function n(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&n(t.prototype,i),e&&n(t,e),t}}();function A(t){return"string"==typeof t}var H=Number.isNaN||t.isNaN;function j(t){return"number"==typeof t&&!H(t)}function B(t){return void 0===t}function V(t){return"object"===(void 0===t?"undefined":O(t))&&null!==t}var K=Object.prototype.hasOwnProperty;function U(t){if(!V(t))return!1;try{var i=t.constructor,e=i.prototype;return i&&e&&K.call(e,"isPrototypeOf")}catch(t){return!1}}function Z(t){return"function"==typeof t}function $(i,e){if(i&&Z(e))if(Array.isArray(i)||j(i.length)){var t=i.length,n=void 0;for(n=0;n<t&&!1!==e.call(i,i[n],n,i);n+=1);}else V(i)&&Object.keys(i).forEach(function(t){e.call(i,i[t],t,i)});return i}var _=Object.assign||function(e){for(var t=arguments.length,i=Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return V(e)&&0<i.length&&i.forEach(function(i){V(i)&&Object.keys(i).forEach(function(t){e[t]=i[t]})}),e},G=/^(?:width|height|left|top|marginLeft|marginTop)$/;function J(t,i){var e=t.style;$(i,function(t,i){G.test(i)&&j(t)&&(t+="px"),e[i]=t})}function Q(t,i){return t.classList?t.classList.contains(i):-1<t.className.indexOf(i)}function tt(t,i){if(i)if(j(t.length))$(t,function(t){tt(t,i)});else if(t.classList)t.classList.add(i);else{var e=t.className.trim();e?e.indexOf(i)<0&&(t.className=e+" "+i):t.className=i}}function it(t,i){i&&(j(t.length)?$(t,function(t){it(t,i)}):t.classList?t.classList.remove(i):0<=t.className.indexOf(i)&&(t.className=t.className.replace(i,"")))}function et(t,i,e){i&&(j(t.length)?$(t,function(t){et(t,i,e)}):e?tt(t,i):it(t,i))}var nt=/([a-z\d])([A-Z])/g;function st(t){return t.replace(nt,"$1-$2").toLowerCase()}function ot(t,i){return V(t[i])?t[i]:t.dataset?t.dataset[i]:t.getAttribute("data-"+st(i))}function at(t,i,e){V(e)?t[i]=e:t.dataset?t.dataset[i]=e:t.setAttribute("data-"+st(i),e)}var rt,ht,lt,dt,ct=/\s\s*/,ut=(ht=rt=!1,lt=function(){},dt=Object.defineProperty({},"once",{get:function(){return rt=!0,ht},set:function(t){ht=t}}),t.addEventListener("test",lt,dt),t.removeEventListener("test",lt,dt),rt);function mt(e,t,n){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},o=n;t.trim().split(ct).forEach(function(t){if(!ut){var i=e.listeners;i&&i[t]&&i[t][n]&&(o=i[t][n],delete i[t][n],0===Object.keys(i[t]).length&&delete i[t],0===Object.keys(i).length&&delete e.listeners)}e.removeEventListener(t,o,s)})}function ft(o,t,a){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},h=a;t.trim().split(ct).forEach(function(n){if(r.once&&!ut){var t=o.listeners,s=void 0===t?{}:t;h=function(){for(var t=arguments.length,i=Array(t),e=0;e<t;e++)i[e]=arguments[e];delete s[n][a],o.removeEventListener(n,h,r),a.apply(o,i)},s[n]||(s[n]={}),s[n][a]&&o.removeEventListener(n,s[n][a],r),s[n][a]=h,o.listeners=s}o.addEventListener(n,h,r)})}function gt(t,i,e){var n=void 0;return Z(Event)&&Z(CustomEvent)?n=new CustomEvent(i,{detail:e,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(i,!0,!0,e),t.dispatchEvent(n)}function vt(t){var i=t.rotate,e=t.scaleX,n=t.scaleY,s=t.translateX,o=t.translateY,a=[];j(s)&&0!==s&&a.push("translateX("+s+"px)"),j(o)&&0!==o&&a.push("translateY("+o+"px)"),j(i)&&0!==i&&a.push("rotate("+i+"deg)"),j(e)&&1!==e&&a.push("scaleX("+e+")"),j(n)&&1!==n&&a.push("scaleY("+n+")");var r=a.length?a.join(" "):"none";return{WebkitTransform:r,msTransform:r,transform:r}}var pt=t.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(t.navigator.userAgent);function wt(t,i){var e=document.createElement("img");if(t.naturalWidth&&!pt)return i(t.naturalWidth,t.naturalHeight),e;var n=document.body||document.documentElement;return e.onload=function(){i(e.width,e.height),pt||n.removeChild(e)},e.src=t.src,pt||(e.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",n.appendChild(e)),e}function bt(t){switch(t){case 2:return s;case 3:return e;case 4:return i;default:return""}}function yt(t,i){var e=t.pageX,n=t.pageY,s={endX:e,endY:n};return i?s:_({startX:e,startY:n},s)}var xt={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var t=this.options,i=this.parent,e=void 0;t.inline&&(e={width:Math.max(i.offsetWidth,t.minWidth),height:Math.max(i.offsetHeight,t.minHeight)},this.parentData=e),!this.fulled&&e||(e=this.containerData),this.viewerData=_({},e)},renderViewer:function(){this.options.inline&&!this.fulled&&J(this.viewer,this.viewerData)},initList:function(){var a=this,t=this.element,r=this.options,i=this.list,h=[];$(this.images,function(t,i){var e,n=t.src,s=t.alt||(A(e=n)?e.replace(/^.*\//,"").replace(/[?&#].*$/,""):""),o=r.url;A(o)?o=t.getAttribute(o):Z(o)&&(o=o.call(a,t)),(n||o)&&h.push('<li><img src="'+(n||o)+'" role="button" data-action="view" data-index="'+i+'" data-original-url="'+(o||n)+'" alt="'+s+'"></li>')}),i.innerHTML=h.join(""),this.items=i.getElementsByTagName("li"),$(this.items,function(i){var t=i.firstElementChild;at(t,"filled",!0),r.loading&&tt(i,f),ft(t,C,function(t){r.loading&&it(i,f),a.loadImage(t)},{once:!0})}),r.transition&&ft(t,S,function(){tt(i,v)},{once:!0})},renderList:function(t){var i=t||this.index,e=this.items[i].offsetWidth||30,n=e+1;J(this.list,_({width:n*this.length},vt({translateX:(this.viewerData.width-e)/2-n*i})))},resetList:function(){var t=this.list;t.innerHTML="",it(t,v),J(t,vt({translateX:0}))},initImage:function(r){var h=this,l=this.options,t=this.image,i=this.viewerData,e=this.footer.offsetHeight,d=i.width,c=Math.max(i.height-e,e),u=this.imageData||{},n=void 0;this.imageInitializing={abort:function(){n.onload=null}},n=wt(t,function(t,i){var e=t/i,n=d,s=c;h.imageInitializing=!1,d<c*e?s=d/e:n=c*e;var o={naturalWidth:t,naturalHeight:i,aspectRatio:e,ratio:(n=Math.min(.9*n,t))/t,width:n,height:s=Math.min(.9*s,i),left:(d-n)/2,top:(c-s)/2},a=_({},o);l.rotatable&&(o.rotate=u.rotate||0,a.rotate=0),l.scalable&&(o.scaleX=u.scaleX||1,o.scaleY=u.scaleY||1,a.scaleX=1,a.scaleY=1),h.imageData=o,h.initialImageData=a,r&&r()})},renderImage:function(t){var i=this,e=this.image,n=this.imageData;if(J(e,_({width:n.width,height:n.height,marginLeft:n.left,marginTop:n.top},vt(n))),t)if(this.viewing&&this.options.transition){var s=function(){i.imageRendering=!1,t()};this.imageRendering={abort:function(){mt(e,R,s)}},ft(e,R,s,{once:!0})}else t()},resetImage:function(){if(this.viewing||this.viewed){var t=this.image;this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null}}},Dt={bind:function(){var t=this.element,i=this.viewer;ft(i,I,this.onClick=this.click.bind(this)),ft(i,q,this.onWheel=this.wheel.bind(this)),ft(i,T,this.onDragStart=this.dragstart.bind(this)),ft(this.canvas,M,this.onPointerDown=this.pointerdown.bind(this)),ft(t.ownerDocument,N,this.onPointerMove=this.pointermove.bind(this)),ft(t.ownerDocument,Y,this.onPointerUp=this.pointerup.bind(this)),ft(t.ownerDocument,L,this.onKeyDown=this.keydown.bind(this)),ft(window,X,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.viewer;mt(i,I,this.onClick),mt(i,q,this.onWheel),mt(i,T,this.onDragStart),mt(this.canvas,M,this.onPointerDown),mt(t.ownerDocument,N,this.onPointerMove),mt(t.ownerDocument,Y,this.onPointerUp),mt(t.ownerDocument,L,this.onKeyDown),mt(window,X,this.onResize)}},zt={click:function(t){var i=t.target,e=this.options,n=this.imageData;switch(ot(i,"action")){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(ot(i,"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(-n.scaleX||-1);break;case"flip-vertical":this.scaleY(-n.scaleY||-1);break;default:this.played&&this.stop()}},load:function(){var t=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var i=this.element,e=this.options,n=this.image,s=this.index,o=this.viewerData;it(n,x),e.loading&&it(this.canvas,f),n.style.cssText="height:0;margin-left:"+o.width/2+"px;margin-top:"+o.height/2+"px;max-width:none!important;position:absolute;width:0;",this.initImage(function(){et(n,"viewer-move",e.movable),et(n,v,e.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,Z(e.viewed)&&ft(i,S,e.viewed,{once:!0}),gt(i,S,{originalImage:t.images[s],index:s,image:n})})})},loadImage:function(t){var o=t.target,i=o.parentNode,a=i.offsetWidth||30,r=i.offsetHeight||50,h=!!ot(o,"filled");wt(o,function(t,i){var e=t/i,n=a,s=r;a<r*e?h?n=r*e:s=a/e:h?s=a/e:n=r*e,J(o,_({width:n,height:s},vt({translateX:(a-n)/2,translateY:(r-s)/2})))})},keydown:function(t){var i=this.options;if(this.fulled&&i.keyboard)switch(t.keyCode||t.which||t.charCode){case 27:this.played?this.stop():i.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.prev(i.loop);break;case 38:t.preventDefault(),this.zoom(i.zoomRatio,!0);break;case 39:this.next(i.loop);break;case 40:t.preventDefault(),this.zoom(-i.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle())}},dragstart:function(t){"img"===t.target.tagName.toLowerCase()&&t.preventDefault()},pointerdown:function(t){var i=this.options,e=this.pointers;if(this.viewed&&!this.showing&&!this.viewing&&!this.hiding){t.changedTouches?$(t.changedTouches,function(t){e[t.identifier]=yt(t)}):e[t.pointerId||0]=yt(t);var n=!!i.movable&&l;1<Object.keys(e).length?n=c:"touch"!==t.pointerType&&"touchstart"!==t.type||!this.isSwitchable()||(n=d),this.action=n}},pointermove:function(t){var i=this.options,e=this.pointers,n=this.action,s=this.image;this.viewed&&n&&(t.preventDefault(),t.changedTouches?$(t.changedTouches,function(t){_(e[t.identifier],yt(t,!0))}):_(e[t.pointerId||0],yt(t,!0)),n===l&&i.transition&&Q(s,v)&&it(s,v),this.change(t))},pointerup:function(t){var i=this.action,e=this.pointers;t.changedTouches?$(t.changedTouches,function(t){delete e[t.identifier]}):delete e[t.pointerId||0],i&&(i===l&&this.options.transition&&tt(this.image,v),this.action=!1)},resize:function(){var i=this;if(this.isShown&&!this.hiding&&(this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){i.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement)return void this.stop();$(this.player.getElementsByTagName("img"),function(t){ft(t,C,i.loadImage.bind(i),{once:!0}),gt(t,C)})}},wheel:function(t){var i=this;if(this.viewed&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var e=Number(this.options.zoomRatio)||.1,n=1;t.deltaY?n=0<t.deltaY?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=0<t.detail?1:-1),this.zoom(-n*e,!0,t)}}},kt={show:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if(Z(e.show)&&ft(i,r,e.show,{once:!0}),!1===gt(i,r)||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var n=this.viewer;if(it(n,y),e.transition&&!t){var s=this.shown.bind(this);this.transitioning={abort:function(){mt(n,R,s),it(n,u)}},tt(n,v),n.offsetWidth,ft(n,R,s,{once:!0}),tt(n,u)}else tt(n,u),this.shown();return this},hide:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.hiding||!this.isShown&&!this.showing)return this;if(Z(e.hide)&&ft(i,z,e.hide,{once:!0}),!1===gt(i,z))return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var n=this.viewer;if(e.transition&&!t){var s=this.hidden.bind(this),o=function(){ft(n,R,s,{once:!0}),it(n,u)};this.transitioning={abort:function(){this.viewed?mt(this.image,R,o):mt(n,R,s)}},this.viewed?(ft(this.image,R,o,{once:!0}),this.zoomTo(0,!1,!1,!0)):o()}else it(n,u),this.hidden();return this},view:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(t=Number(t)||0,!this.isShown)return this.index=t,this.show();if(this.hiding||this.played||t<0||t>=this.length||this.viewed&&t===this.index)return this;this.viewing&&this.viewing.abort();var e=this.element,n=this.options,s=this.title,o=this.canvas,a=this.items[t],r=a.querySelector("img"),h=ot(r,"originalUrl"),l=r.getAttribute("alt"),d=document.createElement("img");if(d.src=h,d.alt=l,Z(n.view)&&ft(e,E,n.view,{once:!0}),!1===gt(e,E,{originalImage:this.images[t],index:t,image:d})||!this.isShown||this.hiding||this.played)return this;this.image=d,it(this.items[this.index],m),tt(a,m),this.viewed=!1,this.index=t,this.imageData={},tt(d,x),n.loading&&tt(o,f),o.innerHTML="",o.appendChild(d),this.renderList(),s.innerHTML="";var c=function(){var t=i.imageData;s.textContent=l+" ("+t.naturalWidth+" × "+t.naturalHeight+")"},u=void 0;return ft(e,S,c,{once:!0}),this.viewing={abort:function(){mt(e,S,c),d.complete?this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort():(mt(d,C,u),this.timeout&&clearTimeout(this.timeout))}},d.complete?this.load():(ft(d,C,u=this.load.bind(this),{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){it(d,x),i.timeout=!1},1e3)),this},prev:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.index-1;return i<0&&(i=t?this.length-1:0),this.view(i),this},next:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.length-1,e=this.index+1;return i<e&&(e=t?0:i),this.view(e),this},move:function(t,i){var e=this.imageData;return this.moveTo(B(t)?t:e.left+Number(t),B(i)?i:e.top+Number(i)),this},moveTo:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.movable){var n=!1;j(t)&&(e.left=t,n=!0),j(i)&&(e.top=i,n=!0),n&&this.renderImage()}return this},zoom:function(t){var i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=this.imageData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(n.width*t/n.naturalWidth,i,e),this},zoomTo:function(t){var n,s,o,i,e,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,h=3<arguments.length&&void 0!==arguments[3]&&arguments[3],l=this.options,d=this.pointers,c=this.imageData;if(j(t=Math.max(0,t))&&this.viewed&&!this.played&&(h||l.zoomable)){if(!h){var u=Math.max(.01,l.minZoomRatio),m=Math.min(100,l.maxZoomRatio);t=Math.min(Math.max(t,u),m)}r&&.95<t&&t<1.05&&(t=1);var f=c.naturalWidth*t,g=c.naturalHeight*t;if(r){var v=(i=this.viewer,{left:(e=i.getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}),p=d&&Object.keys(d).length?(o=s=n=0,$(d,function(t){var i=t.startX,e=t.startY;n+=i,s+=e,o+=1}),{pageX:n/=o,pageY:s/=o}):{pageX:r.pageX,pageY:r.pageY};c.left-=(f-c.width)*((p.pageX-v.left-c.left)/c.width),c.top-=(g-c.height)*((p.pageY-v.top-c.top)/c.height)}else c.left-=(f-c.width)/2,c.top-=(g-c.height)/2;c.width=f,c.height=g,c.ratio=t,this.renderImage(),a&&this.tooltip()}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var i=this.imageData;return j(t=Number(t))&&this.viewed&&!this.played&&this.options.rotatable&&(i.rotate=t,this.renderImage()),this},scaleX:function(t){return this.scale(t,this.imageData.scaleY),this},scaleY:function(t){return this.scale(this.imageData.scaleX,t),this},scale:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.scalable){var n=!1;j(t)&&(e.scaleX=t,n=!0),j(i)&&(e.scaleY=i,n=!0),n&&this.renderImage()}return this},play:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(!this.isShown||this.played)return this;var s=this.options,o=this.player,a=this.loadImage.bind(this),r=[],h=0,l=0;if(this.played=!0,this.onLoadWhenPlay=a,t&&this.requestFullscreen(),tt(o,g),$(this.items,function(t,i){var e=t.querySelector("img"),n=document.createElement("img");n.src=ot(e,"originalUrl"),n.alt=e.getAttribute("alt"),h+=1,tt(n,w),et(n,v,s.transition),Q(t,m)&&(tt(n,u),l=i),r.push(n),ft(n,C,a,{once:!0}),o.appendChild(n)}),j(s.interval)&&0<s.interval){var e=function t(){i.playing=setTimeout(function(){it(r[l],u),tt(r[l=(l+=1)<h?l:0],u),t()},s.interval)};1<h&&e()}return this},stop:function(){var i=this;if(!this.played)return this;var t=this.player;return this.played=!1,clearTimeout(this.playing),$(t.getElementsByTagName("img"),function(t){mt(t,C,i.onLoadWhenPlay)}),it(t,g),t.innerHTML="",this.exitFullscreen(),this},full:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return!this.isShown||this.played||this.fulled||!i.inline||(this.fulled=!0,this.open(),tt(this.button,o),i.transition&&(it(s,v),this.viewed&&it(n,v)),tt(e,b),e.setAttribute("style",""),J(e,{zIndex:i.zIndex}),this.initContainer(),this.viewerData=_({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){tt(n,v),tt(s,v)},0)})})),this},exit:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return this.isShown&&!this.played&&this.fulled&&i.inline&&(this.fulled=!1,this.close(),it(this.button,o),i.transition&&(it(s,v),this.viewed&&it(n,v)),it(e,b),J(e,{zIndex:i.zIndexInline}),this.viewerData=_({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){tt(n,v),tt(s,v)},0)})})),this},tooltip:function(){var t=this,i=this.options,e=this.tooltipBox,n=this.imageData;return this.viewed&&!this.played&&i.tooltip&&(e.textContent=Math.round(100*n.ratio)+"%",this.tooltipping?clearTimeout(this.tooltipping):i.transition?(this.fading&&gt(e,R),tt(e,g),tt(e,w),tt(e,v),e.offsetWidth,tt(e,u)):tt(e,g),this.tooltipping=setTimeout(function(){i.transition?(ft(e,R,function(){it(e,g),it(e,w),it(e,v),t.fading=!1},{once:!0}),it(e,u),t.fading=!0):it(e,g),t.tooltipping=!1},1e3)),this},toggle:function(){return 1===this.imageData.ratio?this.zoomTo(this.initialImageData.ratio,!0):this.zoomTo(1,!0),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=_({},this.initialImageData),this.renderImage()),this},update:function(){var t=this.element,i=this.options,e=this.isImg,s=[];if(e&&!t.parentNode)return this.destroy();var o=[];if($(e?[t]:t.querySelectorAll("img"),function(t){i.filter?i.filter(t)&&o.push(t):o.push(t)}),this.images=o,this.length=o.length,this.ready&&($(this.items,function(t,i){var e=t.querySelector("img"),n=o[i];n?n.src!==e.src&&s.push(i):s.push(i)}),J(this.list,{width:"auto"}),this.initList(),this.isShown))if(this.length){if(this.viewed){var n=s.indexOf(this.index);0<=n?(this.viewed=!1,this.view(Math.max(this.index-(n+1),0))):tt(this.items[this.index],m)}}else this.image=null,this.viewed=!1,this.index=0,this.imageData=null,this.canvas.innerHTML="",this.title.innerHTML="";return this},destroy:function(){var t=this.element,i=this.options;return ot(t,p)&&(this.destroyed=!0,this.ready?(this.played&&this.stop(),i.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):i.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),i.inline||mt(t,I,this.onStart),function(i,e){if(V(i[e]))try{delete i[e]}catch(t){i[e]=void 0}else if(i.dataset)try{delete i.dataset[e]}catch(t){i.dataset[e]=void 0}else i.removeAttribute("data-"+st(e))}(t,p)),this}},Et={open:function(){var t=this.body;tt(t,a),t.style.paddingRight=this.scrollbarWidth+(parseFloat(this.initialBodyPaddingRight)||0)+"px"},close:function(){var t=this.body;it(t,a),t.style.paddingRight=this.initialBodyPaddingRight},shown:function(){var t=this.element,i=this.options;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,Z(i.shown)&&ft(t,h,i.shown,{once:!0}),!1!==gt(t,h)&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,i=this.options;this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),tt(this.viewer,y),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||(Z(i.hidden)&&ft(t,k,i.hidden,{once:!0}),gt(t,k))},requestFullscreen:function(){var t=this.element.ownerDocument;if(this.fulled&&!t.fullscreenElement&&!t.mozFullScreenElement&&!t.webkitFullscreenElement&&!t.msFullscreenElement){var i=t.documentElement;i.requestFullscreen?i.requestFullscreen():i.msRequestFullscreen?i.msRequestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen&&i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}},exitFullscreen:function(){if(this.fulled){var t=this.element.ownerDocument;t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}},change:function(t){var i,e,h,n=this.options,s=this.pointers,o=s[Object.keys(s)[0]],a=o.endX-o.startX,r=o.endY-o.startY;switch(this.action){case l:this.move(a,r);break;case c:this.zoom((e=_({},i=s),h=[],$(i,function(r,t){delete e[t],$(e,function(t){var i=Math.abs(r.startX-t.startX),e=Math.abs(r.startY-t.startY),n=Math.abs(r.endX-t.endX),s=Math.abs(r.endY-t.endY),o=Math.sqrt(i*i+e*e),a=(Math.sqrt(n*n+s*s)-o)/o;h.push(a)})}),h.sort(function(t,i){return Math.abs(t)<Math.abs(i)}),h[0]),!1,t);break;case d:this.action="switched",this.pointers={},Math.abs(a)>Math.abs(r)&&(1<a?this.prev(n.loop):a<-1&&this.next(n.loop))}$(s,function(t){t.startX=t.endX,t.startY=t.endY})},isSwitchable:function(){var t=this.imageData,i=this.viewerData;return 1<this.length&&0<=t.left&&0<=t.top&&t.width<=i.width&&t.height<=i.height}},St=t.Viewer,It=function(){function e(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(W(this,e),!t||1!==t.nodeType)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=_({},n,U(i)&&i),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.index=0,this.isImg=!1,this.length=0,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.isShown=!1,this.wheeling=!1,this.init()}return P(e,[{key:"init",value:function(){var e=this,t=this.element,i=this.options;if(!ot(t,p)){at(t,p,this);var n="img"===t.tagName.toLowerCase(),s=[];if($(n?[t]:t.querySelectorAll("img"),function(t){Z(i.filter)?i.filter.call(e,t)&&s.push(t):s.push(t)}),s.length){this.isImg=n,this.length=s.length,this.images=s;var o=t.ownerDocument,a=o.body||o.documentElement;if(this.body=a,this.scrollbarWidth=window.innerWidth-o.documentElement.clientWidth,this.initialBodyPaddingRight=window.getComputedStyle(a).paddingRight,B(document.createElement(p).style.transition)&&(i.transition=!1),i.inline){var r=0,h=function(){if((r+=1)===e.length){var t=void 0;e.initializing=!1,e.delaying={abort:function(){clearTimeout(t)}},t=setTimeout(function(){e.delaying=!1,e.build()},0)}};this.initializing={abort:function(){$(s,function(t){t.complete||mt(t,C,h)})}},$(s,function(t){t.complete?h():ft(t,C,h,{once:!0})})}else ft(t,I,this.onStart=function(t){var i=t.target;"img"===i.tagName.toLowerCase()&&e.view(e.images.indexOf(i))})}}}},{key:"build",value:function(){if(!this.ready){var t=this.element,h=this.options,i=t.parentNode,e=document.createElement("div");e.innerHTML='<div class="viewer-container" 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"></ul></div></div><div class="viewer-tooltip"></div><div role="button" class="viewer-button" data-action="mix"></div><div class="viewer-player"></div></div>';var n=e.querySelector("."+p+"-container"),s=n.querySelector("."+p+"-title"),o=n.querySelector("."+p+"-toolbar"),a=n.querySelector("."+p+"-navbar"),r=n.querySelector("."+p+"-button"),l=n.querySelector("."+p+"-canvas");if(this.parent=i,this.viewer=n,this.title=s,this.toolbar=o,this.navbar=a,this.button=r,this.canvas=l,this.footer=n.querySelector("."+p+"-footer"),this.tooltipBox=n.querySelector("."+p+"-tooltip"),this.player=n.querySelector("."+p+"-player"),this.list=n.querySelector("."+p+"-list"),tt(s,h.title?bt(h.title):y),tt(a,h.navbar?bt(h.navbar):y),et(r,y,!h.button),h.backdrop&&(tt(n,p+"-backdrop"),h.inline||!0!==h.backdrop||at(l,"action","hide")),h.toolbar){var d=document.createElement("ul"),c=U(h.toolbar),u=F.slice(0,3),m=F.slice(7,9),f=F.slice(9);c||tt(o,bt(h.toolbar)),$(c?h.toolbar:F,function(t,i){var e=c&&U(t),n=c?st(i):t,s=e&&!B(t.show)?t.show:t;if(s&&(h.zoomable||-1===u.indexOf(n))&&(h.rotatable||-1===m.indexOf(n))&&(h.scalable||-1===f.indexOf(n))){var o=e&&!B(t.size)?t.size:t,a=e&&!B(t.click)?t.click:t,r=document.createElement("li");r.setAttribute("role","button"),tt(r,p+"-"+n),Z(a)||at(r,"action",n),j(s)&&tt(r,bt(s)),-1!==["small","large"].indexOf(o)?tt(r,p+"-"+o):"play"===n&&tt(r,p+"-large"),Z(a)&&ft(r,I,a),d.appendChild(r)}}),o.appendChild(d)}else tt(o,y);if(!h.rotatable){var g=o.querySelectorAll('li[class*="rotate"]');tt(g,x),$(g,function(t){o.appendChild(t)})}if(h.inline)tt(r,"viewer-fullscreen"),J(n,{zIndex:h.zIndexInline}),"static"===window.getComputedStyle(i).position&&J(i,{position:"relative"}),i.insertBefore(n,t.nextSibling);else{tt(r,"viewer-close"),tt(n,b),tt(n,w),tt(n,y),J(n,{zIndex:h.zIndex});var v=h.container;A(v)&&(v=t.ownerDocument.querySelector(v)),v||(v=this.body),v.appendChild(n)}h.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Z(h.ready)&&ft(t,D,h.ready,{once:!0}),!1!==gt(t,D)?this.ready&&h.inline&&this.view():this.ready=!1}}}],[{key:"noConflict",value:function(){return window.Viewer=St,e}},{key:"setDefaults",value:function(t){_(n,U(t)&&t)}}]),e}();return _(It.prototype,xt,Dt,zt,kt,Et),It});
{
"name": "viewerjs",
"description": "JavaScript image viewer.",
"version": "1.0.0-rc",
"version": "1.0.0-rc.1",
"main": "dist/viewer.common.js",

@@ -82,4 +82,4 @@ "module": "dist/viewer.esm.js",

"stylefmt": "^6.0.0",
"uglify-js": "^3.3.13"
"uglify-js": "^3.3.14"
}
}

@@ -8,2 +8,3 @@ # Viewer.js

- [Website](https://fengyuanchen.github.io/viewerjs)
- [jquery-viewer](https://github.com/fengyuanchen/jquery-viewer) - A jQuery plugin wrapper for Viewer.js.

@@ -53,3 +54,3 @@ ## Table of contents

### Install
### Installation

@@ -93,3 +94,3 @@ ```shell

<ul id="images">
<li><img src="picture.jpg" alt="Picture"></li>
<li><img src="picture-1.jpg" alt="Picture 1"></li>
<li><img src="picture-2.jpg" alt="Picture 2"></li>

@@ -102,7 +103,11 @@ <li><img src="picture-3.jpg" alt="Picture 3"></li>

```js
// View one image
var viewer = new Viewer(document.getElementById('image'), options);
var viewer = new Viewer(document.getElementById('image'), {
inline: true,
viewed: function() {
viewer.zoomTo(1);
}
});
// View some images
var viewer = new Viewer(document.getElementById('images'), options);
// View a list of images
var viewer = new Viewer(document.getElementById('images'));
```

@@ -109,0 +114,0 @@

@@ -41,3 +41,3 @@ export const WINDOW = typeof window !== 'undefined' ? window : {};

export const EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
export const EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'mousemove touchmove';
export const EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
export const EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup';

@@ -44,0 +44,0 @@ export const EVENT_RESIZE = 'resize';

@@ -139,2 +139,5 @@ import {

// Empty `pointers` as `touchend` event will not be fired after swiped in iOS browsers.
this.pointers = {};
if (Math.abs(offsetX) > Math.abs(offsetY)) {

@@ -141,0 +144,0 @@ if (offsetX > 1) {

@@ -312,2 +312,3 @@ import {

let supported = false;
let once = false;
const listener = () => {};

@@ -317,4 +318,13 @@ const options = Object.defineProperty({}, 'once', {

supported = true;
return true;
return once;
},
/**
* This setter can fix a `TypeError` in strict mode
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
* @param {boolean} value - The value to set
*/
set(value) {
once = value;
},
});

@@ -321,0 +331,0 @@

@@ -79,3 +79,3 @@ declare namespace Viewer {

full(): Viewer;
hide(immediate: boolean): Viewer;
hide(immediate?: boolean): Viewer;
move(offsetX: number, offsetY?: number): Viewer;

@@ -92,3 +92,3 @@ moveTo(x: number, y?: number): Viewer;

scaleY(scaleY: number): Viewer;
show(immediate: boolean): Viewer;
show(immediate?: boolean): Viewer;
stop(): Viewer;

@@ -95,0 +95,0 @@ toggle(): Viewer;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc