import{d as Ee,r as Ve,w as yt,o as Fe,h as Me,p as wt,a as ft,b as St,e as Ye,y as We,z as Xe,A as qe,u as Tt,n as He,F as Ue,_ as Be}from"./index-0fd2d185.js";/*! * Viewer.js v1.11.3 * https://fengyuanchen.github.io/viewerjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * * Date: 2023-03-05T07:01:17.741Z */function jt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),i.push.apply(i,r)}return i}function Ct(e){for(var t=1;t
',pt=typeof window<"u"&&typeof window.document<"u",V=pt?window:{},G=pt&&V.document.documentElement?"ontouchstart"in V.document.documentElement:!1,Lt=pt?"PointerEvent"in V:!1,v="viewer",dt="move",Se="switch",it="zoom",ot="".concat(v,"-active"),ti="".concat(v,"-close"),vt="".concat(v,"-fade"),It="".concat(v,"-fixed"),ei="".concat(v,"-fullscreen"),Mt="".concat(v,"-fullscreen-exit"),Y="".concat(v,"-hide"),ii="".concat(v,"-hide-md-down"),ri="".concat(v,"-hide-sm-down"),ni="".concat(v,"-hide-xs-down"),L="".concat(v,"-in"),rt="".concat(v,"-invisible"),Z="".concat(v,"-loading"),ai="".concat(v,"-move"),Yt="".concat(v,"-open"),q="".concat(v,"-show"),O="".concat(v,"-transition"),J="click",At="dblclick",Wt="dragstart",Xt="focusin",qt="keydown",$="load",W="error",si=G?"touchend touchcancel":"mouseup",oi=G?"touchmove":"mousemove",li=G?"touchstart":"mousedown",Ht=Lt?"pointerdown":li,Ut=Lt?"pointermove":oi,Bt=Lt?"pointerup pointercancel":si,Kt="resize",k="transitionend",Gt="wheel",Zt="ready",Jt="show",Qt="shown",te="hide",ee="hidden",ie="view",nt="viewed",re="move",ne="moved",ae="rotate",se="rotated",oe="scale",le="scaled",ue="zoom",he="zoomed",ce="play",fe="stop",mt="".concat(v,"Action"),$t=/\s\s*/,lt=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function at(e){return typeof e=="string"}var ui=Number.isNaN||V.isNaN;function _(e){return typeof e=="number"&&!ui(e)}function U(e){return typeof e>"u"}function Q(e){return Ot(e)==="object"&&e!==null}var hi=Object.prototype.hasOwnProperty;function B(e){if(!Q(e))return!1;try{var t=e.constructor,i=t.prototype;return t&&i&&hi.call(i,"isPrototypeOf")}catch{return!1}}function p(e){return typeof e=="function"}function y(e,t){if(e&&p(t))if(Array.isArray(e)||_(e.length)){var i=e.length,r;for(r=0;r1?i-1:0),n=1;n0&&r.forEach(function(a){Q(a)&&Object.keys(a).forEach(function(s){t[s]=a[s]})}),t},ci=/^(?:width|height|left|top|marginLeft|marginTop)$/;function z(e,t){var i=e.style;y(t,function(r,n){ci.test(n)&&_(r)&&(r+="px"),i[n]=r})}function fi(e){return at(e)?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"):e}function H(e,t){return!e||!t?!1:e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function f(e,t){if(!(!e||!t)){if(_(e.length)){y(e,function(r){f(r,t)});return}if(e.classList){e.classList.add(t);return}var i=e.className.trim();i?i.indexOf(t)<0&&(e.className="".concat(i," ").concat(t)):e.className=t}}function m(e,t){if(!(!e||!t)){if(_(e.length)){y(e,function(i){m(i,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,""))}}function st(e,t,i){if(t){if(_(e.length)){y(e,function(r){st(r,t,i)});return}i?f(e,t):m(e,t)}}var di=/([a-z\d])([A-Z])/g;function kt(e){return e.replace(di,"$1-$2").toLowerCase()}function K(e,t){return Q(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(kt(t)))}function xt(e,t,i){Q(i)?e[t]=i:e.dataset?e.dataset[t]=i:e.setAttribute("data-".concat(kt(t)),i)}var Oe=function(){var e=!1;if(pt){var t=!1,i=function(){},r=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(a){t=a}});V.addEventListener("test",i,r),V.removeEventListener("test",i,r)}return e}();function b(e,t,i){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=i;t.trim().split($t).forEach(function(a){if(!Oe){var s=e.listeners;s&&s[a]&&s[a][i]&&(n=s[a][i],delete s[a][i],Object.keys(s[a]).length===0&&delete s[a],Object.keys(s).length===0&&delete e.listeners)}e.removeEventListener(a,n,r)})}function d(e,t,i){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=i;t.trim().split($t).forEach(function(a){if(r.once&&!Oe){var s=e.listeners,l=s===void 0?{}:s;n=function(){delete l[a][i],e.removeEventListener(a,n,r);for(var o=arguments.length,u=new Array(o),c=0;cl?x=l/I:E=h*I,S=_(S)?S:.9,E=Math.min(E*S,c),x=Math.min(x*S,g);var D=(l-E)/2,N=(h-x)/2,T={left:D,top:N,x:D,y:N,width:E,height:x,oldRatio:1,ratio:E/c,aspectRatio:I,naturalWidth:c,naturalHeight:g},R=C({},T);r.rotatable&&(T.rotate=o.rotate||0,R.rotate=0),r.scalable&&(T.scaleX=o.scaleX||1,T.scaleY=o.scaleY||1,R.scaleX=1,R.scaleY=1),i.imageData=T,i.initialImageData=R,t&&t()})},renderImage:function(t){var i=this,r=this.image,n=this.imageData;if(z(r,C({width:n.width,height:n.height,marginLeft:n.x,marginTop:n.y},gt(n))),t)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&H(r,O)){var a=function(){i.imageRendering=!1,t()};this.imageRendering={abort:function(){b(r,k,a)}},d(r,k,a,{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}}},yi={bind:function(){var t=this.options,i=this.viewer,r=this.canvas,n=this.element.ownerDocument;d(i,J,this.onClick=this.click.bind(this)),d(i,Wt,this.onDragStart=this.dragstart.bind(this)),d(r,Ht,this.onPointerDown=this.pointerdown.bind(this)),d(n,Ut,this.onPointerMove=this.pointermove.bind(this)),d(n,Bt,this.onPointerUp=this.pointerup.bind(this)),d(n,qt,this.onKeyDown=this.keydown.bind(this)),d(window,Kt,this.onResize=this.resize.bind(this)),t.zoomable&&t.zoomOnWheel&&d(i,Gt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleOnDblclick&&d(r,At,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var t=this.options,i=this.viewer,r=this.canvas,n=this.element.ownerDocument;b(i,J,this.onClick),b(i,Wt,this.onDragStart),b(r,Ht,this.onPointerDown),b(n,Ut,this.onPointerMove),b(n,Bt,this.onPointerUp),b(n,qt,this.onKeyDown),b(window,Kt,this.onResize),t.zoomable&&t.zoomOnWheel&&b(i,Gt,this.onWheel,{passive:!1,capture:!0}),t.toggleOnDblclick&&b(r,At,this.onDblclick)}},wi={click:function(t){var i=this.options,r=this.imageData,n=t.target,a=K(n,mt);switch(!a&&n.localName==="img"&&n.parentElement.localName==="li"&&(n=n.parentElement,a=K(n,mt)),G&&t.isTrusted&&n===this.canvas&&clearTimeout(this.clickCanvasTimeout),a){case"mix":this.played?this.stop():i.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(K(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(i.loop);break;case"play":this.play(i.fullscreen);break;case"next":this.next(i.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-r.scaleX||-1);break;case"flip-vertical":this.scaleY(-r.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(t){t.preventDefault(),this.viewed&&t.target===this.image&&(G&&t.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(t.isTrusted?t:t.detail&&t.detail.originalEvent))},load:function(){var t=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var i=this.element,r=this.options,n=this.image,a=this.index,s=this.viewerData;m(n,rt),r.loading&&m(this.canvas,Z),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(){st(n,ai,r.movable),st(n,O,r.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,p(r.viewed)&&d(i,nt,r.viewed,{once:!0}),A(i,nt,{originalImage:t.images[a],index:a,image:n},{cancelable:!1})})})},loadImage:function(t){var i=t.target,r=i.parentNode,n=r.offsetWidth||30,a=r.offsetHeight||50,s=!!K(i,"filled");Ie(i,this.options,function(l,h){var o=l/h,u=n,c=a;a*o>n?s?u=a*o:c=n/o:s?c=n/o:u=a*o,z(i,C({width:u,height:c},gt({translateX:(n-u)/2,translateY:(a-c)/2})))})},keydown:function(t){var i=this.options;if(i.keyboard){var r=t.keyCode||t.which||t.charCode;switch(r){case 13:this.viewer.contains(t.target)&&this.click(t);break}if(this.fulled)switch(r){case 27:this.played?this.stop():i.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.played&&this.playing?this.playing.prev():this.prev(i.loop);break;case 38:t.preventDefault(),this.zoom(i.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(i.loop);break;case 40:t.preventDefault(),this.zoom(-i.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle());break}}},dragstart:function(t){t.target.localName==="img"&&t.preventDefault()},pointerdown:function(t){var i=this.options,r=this.pointers,n=t.buttons,a=t.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(_(n)&&n!==1||_(a)&&a!==0||t.ctrlKey))){t.preventDefault(),t.changedTouches?y(t.changedTouches,function(l){r[l.identifier]=ht(l)}):r[t.pointerId||0]=ht(t);var s=i.movable?dt:!1;i.zoomOnTouch&&i.zoomable&&Object.keys(r).length>1?s=it:i.slideOnTouch&&(t.pointerType==="touch"||t.type==="touchstart")&&this.isSwitchable()&&(s=Se),i.transition&&(s===dt||s===it)&&m(this.image,O),this.action=s}},pointermove:function(t){var i=this.pointers,r=this.action;!this.viewed||!r||(t.preventDefault(),t.changedTouches?y(t.changedTouches,function(n){C(i[n.identifier]||{},ht(n,!0))}):C(i[t.pointerId||0]||{},ht(t,!0)),this.change(t))},pointerup:function(t){var i=this,r=this.options,n=this.action,a=this.pointers,s;t.changedTouches?y(t.changedTouches,function(l){s=a[l.identifier],delete a[l.identifier]}):(s=a[t.pointerId||0],delete a[t.pointerId||0]),n&&(t.preventDefault(),r.transition&&(n===dt||n===it)&&f(this.image,O),this.action=!1,G&&n!==it&&s&&Date.now()-s.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),r.toggleOnDblclick&&this.viewed&&t.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){A(i.image,At,{originalEvent:t})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){i.imageClicked=!1},500)):(this.imageClicked=!1,r.backdrop&&r.backdrop!=="static"&&t.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){A(i.canvas,J,{originalEvent:t})},50)))))},resize:function(){var t=this;if(!(!this.isShown||this.hiding)&&(this.fulled&&(this.close(),this.initBody(),this.open()),this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}y(this.player.getElementsByTagName("img"),function(i){d(i,$,t.loadImage.bind(t),{once:!0}),A(i,$)})}},wheel:function(t){var i=this;if(this.viewed&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var r=Number(this.options.zoomRatio)||.1,n=1;t.deltaY?n=t.deltaY>0?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=t.detail>0?1:-1),this.zoom(-n*r,!0,null,t)}}},Ti={show:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.element,r=this.options;if(r.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if(p(r.show)&&d(i,Jt,r.show,{once:!0}),A(i,Jt)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var n=this.viewer;if(m(n,Y),n.setAttribute("role","dialog"),n.setAttribute("aria-labelledby",this.title.id),n.setAttribute("aria-modal",!0),n.removeAttribute("aria-hidden"),r.transition&&!t){var a=this.shown.bind(this);this.transitioning={abort:function(){b(n,k,a),m(n,L)}},f(n,O),n.initialOffsetWidth=n.offsetWidth,d(n,k,a,{once:!0}),f(n,L)}else f(n,L),this.shown();return this},hide:function(){var t=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=this.element,n=this.options;if(n.inline||this.hiding||!(this.isShown||this.showing))return this;if(p(n.hide)&&d(r,te,n.hide,{once:!0}),A(r,te)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var a=this.viewer,s=this.image,l=function(){m(a,L),t.hidden()};if(n.transition&&!i){var h=function u(c){c&&c.target===a&&(b(a,k,u),t.hidden())},o=function(){H(a,O)?(d(a,k,h),m(a,L)):l()};this.transitioning={abort:function(){t.viewed&&H(s,O)?b(s,k,o):H(a,O)&&b(a,k,h)}},this.viewed&&H(s,O)?(d(s,k,o,{once:!0}),this.zoomTo(0,!1,null,null,!0)):o()}else l();return this},view:function(){var t=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(i=Number(i)||0,this.hiding||this.played||i<0||i>=this.length||this.viewed&&i===this.index)return this;if(!this.isShown)return this.index=i,this.show();this.viewing&&this.viewing.abort();var r=this.element,n=this.options,a=this.title,s=this.canvas,l=this.items[i],h=l.querySelector("img"),o=K(h,"originalUrl"),u=h.getAttribute("alt"),c=document.createElement("img");if(y(n.inheritedAttributes,function(x){var D=h.getAttribute(x);D!==null&&c.setAttribute(x,D)}),c.src=o,c.alt=u,p(n.view)&&d(r,ie,n.view,{once:!0}),A(r,ie,{originalImage:this.images[i],index:i,image:c})===!1||!this.isShown||this.hiding||this.played)return this;var g=this.items[this.index];g&&(m(g,ot),g.removeAttribute("aria-selected")),f(l,ot),l.setAttribute("aria-selected",!0),n.focus&&l.focus(),this.image=c,this.viewed=!1,this.index=i,this.imageData={},f(c,rt),n.loading&&f(s,Z),s.innerHTML="",s.appendChild(c),this.renderList(),a.innerHTML="";var I=function(){var D=t.imageData,N=Array.isArray(n.title)?n.title[1]:n.title;a.innerHTML=fi(p(N)?N.call(t,c,D):"".concat(u," (").concat(D.naturalWidth," × ").concat(D.naturalHeight,")"))},S,E;return d(r,nt,I,{once:!0}),this.viewing={abort:function(){b(r,nt,I),c.complete?t.imageRendering?t.imageRendering.abort():t.imageInitializing&&t.imageInitializing.abort():(c.src="",b(c,$,S),t.timeout&&clearTimeout(t.timeout))}},c.complete?this.load():(d(c,$,S=function(){b(c,W,E),t.load()},{once:!0}),d(c,W,E=function(){b(c,$,S),t.timeout&&(clearTimeout(t.timeout),t.timeout=!1),m(c,rt),n.loading&&m(t.canvas,Z)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){m(c,rt),t.timeout=!1},1e3)),this},prev:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.index-1;return i<0&&(i=t?this.length-1:0),this.view(i),this},next:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.length-1,r=this.index+1;return r>i&&(r=t?0:i),this.view(r),this},move:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,r=this.imageData;return this.moveTo(U(t)?t:r.x+Number(t),U(i)?i:r.y+Number(i)),this},moveTo:function(t){var i=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=this.element,s=this.options,l=this.imageData;if(t=Number(t),r=Number(r),this.viewed&&!this.played&&s.movable){var h=l.x,o=l.y,u=!1;if(_(t)?u=!0:t=h,_(r)?u=!0:r=o,u){if(p(s.move)&&d(a,re,s.move,{once:!0}),A(a,re,{x:t,y:r,oldX:h,oldY:o,originalEvent:n})===!1)return this;l.x=t,l.y=r,l.left=t,l.top=r,this.moving=!0,this.renderImage(function(){i.moving=!1,p(s.moved)&&d(a,ne,s.moved,{once:!0}),A(a,ne,{x:t,y:r,oldX:h,oldY:o,originalEvent:n},{cancelable:!1})})}}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var i=this,r=this.element,n=this.options,a=this.imageData;if(t=Number(t),_(t)&&this.viewed&&!this.played&&n.rotatable){var s=a.rotate;if(p(n.rotate)&&d(r,ae,n.rotate,{once:!0}),A(r,ae,{degree:t,oldDegree:s})===!1)return this;a.rotate=t,this.rotating=!0,this.renderImage(function(){i.rotating=!1,p(n.rotated)&&d(r,se,n.rotated,{once:!0}),A(r,se,{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 i=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,n=this.element,a=this.options,s=this.imageData;if(t=Number(t),r=Number(r),this.viewed&&!this.played&&a.scalable){var l=s.scaleX,h=s.scaleY,o=!1;if(_(t)?o=!0:t=l,_(r)?o=!0:r=h,o){if(p(a.scale)&&d(n,oe,a.scale,{once:!0}),A(n,oe,{scaleX:t,scaleY:r,oldScaleX:l,oldScaleY:h})===!1)return this;s.scaleX=t,s.scaleY=r,this.scaling=!0,this.renderImage(function(){i.scaling=!1,p(a.scaled)&&d(n,le,a.scaled,{once:!0}),A(n,le,{scaleX:t,scaleY:r,oldScaleX:l,oldScaleY:h},{cancelable:!1})})}}return this},zoom:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=this.imageData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(a.width*t/a.naturalWidth,i,r,n),this},zoomTo:function(t){var i=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,l=this.element,h=this.options,o=this.pointers,u=this.imageData,c=u.x,g=u.y,I=u.width,S=u.height,E=u.naturalWidth,x=u.naturalHeight;if(t=Math.max(0,t),_(t)&&this.viewed&&!this.played&&(s||h.zoomable)){if(!s){var D=Math.max(.01,h.minZoomRatio),N=Math.min(100,h.maxZoomRatio);t=Math.min(Math.max(t,D),N)}if(a)switch(a.type){case"wheel":h.zoomRatio>=.055&&t>.95&&t<1.05&&(t=1);break;case"pointermove":case"touchmove":case"mousemove":t>.99&&t<1.01&&(t=1);break}var T=E*t,R=x*t,F=T-I,P=R-S,M=u.ratio;if(p(h.zoom)&&d(l,ue,h.zoom,{once:!0}),A(l,ue,{ratio:t,oldRatio:M,originalEvent:a})===!1)return this;if(this.zooming=!0,a){var tt=vi(this.viewer),X=o&&Object.keys(o).length>0?pi(o):{pageX:a.pageX,pageY:a.pageY};u.x-=F*((X.pageX-tt.left-c)/I),u.y-=P*((X.pageY-tt.top-g)/S)}else B(n)&&_(n.x)&&_(n.y)?(u.x-=F*((n.x-c)/I),u.y-=P*((n.y-g)/S)):(u.x-=F/2,u.y-=P/2);u.left=u.x,u.top=u.y,u.width=T,u.height=R,u.oldRatio=M,u.ratio=t,this.renderImage(function(){i.zooming=!1,p(h.zoomed)&&d(l,he,h.zoomed,{once:!0}),A(l,he,{ratio:t,oldRatio:M,originalEvent:a},{cancelable:!1})}),r&&this.tooltip()}return this},play:function(){var t=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var r=this.element,n=this.options;if(p(n.play)&&d(r,ce,n.play,{once:!0}),A(r,ce)===!1)return this;var a=this.player,s=this.loadImage.bind(this),l=[],h=0,o=0;if(this.played=!0,this.onLoadWhenPlay=s,i&&this.requestFullscreen(i),f(a,q),y(this.items,function(g,I){var S=g.querySelector("img"),E=document.createElement("img");E.src=K(S,"originalUrl"),E.alt=S.getAttribute("alt"),E.referrerPolicy=S.referrerPolicy,h+=1,f(E,vt),st(E,O,n.transition),H(g,ot)&&(f(E,L),o=I),l.push(E),d(E,$,s,{once:!0}),a.appendChild(E)}),_(n.interval)&&n.interval>0){var u=function g(){clearTimeout(t.playing.timeout),m(l[o],L),o-=1,o=o>=0?o:h-1,f(l[o],L),t.playing.timeout=setTimeout(g,n.interval)},c=function g(){clearTimeout(t.playing.timeout),m(l[o],L),o+=1,o=o1&&(this.playing={prev:u,next:c,timeout:setTimeout(c,n.interval)})}return this},stop:function(){var t=this;if(!this.played)return this;var i=this.element,r=this.options;if(p(r.stop)&&d(i,fe,r.stop,{once:!0}),A(i,fe)===!1)return this;var n=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,y(n.getElementsByTagName("img"),function(a){b(a,$,t.onLoadWhenPlay)}),m(n,q),n.innerHTML="",this.exitFullscreen(),this},full:function(){var t=this,i=this.options,r=this.viewer,n=this.image,a=this.list;return!this.isShown||this.played||this.fulled||!i.inline?this:(this.fulled=!0,this.open(),f(this.button,Mt),i.transition&&(m(a,O),this.viewed&&m(n,O)),f(r,It),r.setAttribute("role","dialog"),r.setAttribute("aria-labelledby",this.title.id),r.setAttribute("aria-modal",!0),r.removeAttribute("style"),z(r,{zIndex:i.zIndex}),i.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=C({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){f(n,O),f(a,O)},0)})}),this)},exit:function(){var t=this,i=this.options,r=this.viewer,n=this.image,a=this.list;return!this.isShown||this.played||!this.fulled||!i.inline?this:(this.fulled=!1,this.close(),m(this.button,Mt),i.transition&&(m(a,O),this.viewed&&m(n,O)),i.focus&&this.clearEnforceFocus(),r.removeAttribute("role"),r.removeAttribute("aria-labelledby"),r.removeAttribute("aria-modal"),m(r,It),z(r,{zIndex:i.zIndexInline}),this.viewerData=C({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){f(n,O),f(a,O)},0)})}),this)},tooltip:function(){var t=this,i=this.options,r=this.tooltipBox,n=this.imageData;return!this.viewed||this.played||!i.tooltip?this:(r.textContent="".concat(Math.round(n.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):i.transition?(this.fading&&A(r,k),f(r,q),f(r,vt),f(r,O),r.removeAttribute("aria-hidden"),r.initialOffsetWidth=r.offsetWidth,f(r,L)):(f(r,q),r.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){i.transition?(d(r,k,function(){m(r,q),m(r,vt),m(r,O),r.setAttribute("aria-hidden",!0),t.fading=!1},{once:!0}),m(r,L),t.fading=!0):(m(r,q),r.setAttribute("aria-hidden",!0)),t.tooltipping=!1},1e3),this)},toggle:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,t):this.zoomTo(1,!0,null,t),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=C({},this.initialImageData),this.renderImage()),this},update:function(){var t=this,i=this.element,r=this.options,n=this.isImg;if(n&&!i.parentNode)return this.destroy();var a=[];if(y(n?[i]:i.querySelectorAll("img"),function(o){p(r.filter)?r.filter.call(t,o)&&a.push(o):t.getImageURL(o)&&a.push(o)}),!a.length)return this;if(this.images=a,this.length=a.length,this.ready){var s=[];if(y(this.items,function(o,u){var c=o.querySelector("img"),g=a[u];g&&c?(g.src!==c.src||g.alt!==c.alt)&&s.push(u):s.push(u)}),z(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var l=s.indexOf(this.index);if(l>=0)this.viewed=!1,this.view(Math.max(Math.min(this.index-l,this.length-1),0));else{var h=this.items[this.index];f(h,ot),h.setAttribute("aria-selected",!0)}}}else this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""}else this.build();return this},destroy:function(){var t=this.element,i=this.options;return t[v]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),i.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):i.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),i.inline||b(t,J,this.onStart),t[v]=void 0,this):this}},Ei={getImageURL:function(t){var i=this.options.url;return at(i)?i=t.getAttribute(i):p(i)?i=i.call(this,t):i="",i},enforceFocus:function(){var t=this;this.clearEnforceFocus(),d(document,Xt,this.onFocusin=function(i){var r=t.viewer,n=i.target;if(!(n===document||n===r||r.contains(n))){for(;n;){if(n.getAttribute("tabindex")!==null||n.getAttribute("aria-modal")==="true")return;n=n.parentElement}r.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(b(document,Xt,this.onFocusin),this.onFocusin=null)},open:function(){var t=this.body;f(t,Yt),this.scrollbarWidth>0&&(t.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var t=this.body;m(t,Yt),this.scrollbarWidth>0&&(t.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var t=this.element,i=this.options,r=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,i.focus&&(r.focus(),this.enforceFocus()),p(i.shown)&&d(t,Qt,i.shown,{once:!0}),A(t,Qt)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,i=this.options,r=this.viewer;i.fucus&&this.clearEnforceFocus(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),f(r,Y),r.removeAttribute("role"),r.removeAttribute("aria-labelledby"),r.removeAttribute("aria-modal"),r.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||(p(i.hidden)&&d(t,ee,i.hidden,{once:!0}),A(t,ee,null,{cancelable:!1}))},requestFullscreen:function(t){var i=this.element.ownerDocument;if(this.fulled&&!(i.fullscreenElement||i.webkitFullscreenElement||i.mozFullScreenElement||i.msFullscreenElement)){var r=i.documentElement;r.requestFullscreen?B(t)?r.requestFullscreen(t):r.requestFullscreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):r.mozRequestFullScreen?r.mozRequestFullScreen():r.msRequestFullscreen&&r.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 i=this.options,r=this.pointers,n=r[Object.keys(r)[0]];if(n){var a=n.endX-n.startX,s=n.endY-n.startY;switch(this.action){case dt:(a!==0||s!==0)&&(this.pointerMoved=!0,this.move(a,s,t));break;case it:this.zoom(mi(r),!1,null,t);break;case Se:{this.action="switched";var l=Math.abs(a);l>1&&l>Math.abs(s)&&(this.pointers={},a>1?this.prev(i.loop):a<-1&&this.next(i.loop));break}}y(r,function(h){h.startX=h.endX,h.startY=h.endY})}},isSwitchable:function(){var t=this.imageData,i=this.viewerData;return this.length>1&&t.x>=0&&t.y>=0&&t.width<=i.width&&t.height<=i.height}},_i=V.Viewer,Si=function(e){return function(){return e+=1,e}}(-1),Ae=function(){function e(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Ke(this,e),!t||t.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=C({},Ft,B(i)&&i),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.imageClicked=!1,this.imageData={},this.index=this.options.initialViewIndex,this.isImg=!1,this.isShown=!1,this.length=0,this.moving=!1,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.rotating=!1,this.scaling=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.wheeling=!1,this.zooming=!1,this.pointerMoved=!1,this.id=Si(),this.init()}return Ge(e,[{key:"init",value:function(){var i=this,r=this.element,n=this.options;if(!r[v]){r[v]=this,n.focus&&!n.keyboard&&(n.focus=!1);var a=r.localName==="img",s=[];if(y(a?[r]:r.querySelectorAll("img"),function(o){p(n.filter)?n.filter.call(i,o)&&s.push(o):i.getImageURL(o)&&s.push(o)}),this.isImg=a,this.length=s.length,this.images=s,this.initBody(),U(document.createElement(v).style.transition)&&(n.transition=!1),n.inline){var l=0,h=function(){if(l+=1,l===i.length){var u;i.initializing=!1,i.delaying={abort:function(){clearTimeout(u)}},u=setTimeout(function(){i.delaying=!1,i.build()},0)}};this.initializing={abort:function(){y(s,function(u){u.complete||(b(u,$,h),b(u,W,h))})}},y(s,function(o){if(o.complete)h();else{var u,c;d(o,$,u=function(){b(o,W,c),h()},{once:!0}),d(o,W,c=function(){b(o,$,u),h()},{once:!0})}})}else d(r,J,this.onStart=function(o){var u=o.target;u.localName==="img"&&(!p(n.filter)||n.filter.call(i,u))&&i.view(i.images.indexOf(u))})}}},{key:"build",value:function(){if(!this.ready){var i=this.element,r=this.options,n=i.parentNode,a=document.createElement("div");a.innerHTML=Qe;var s=a.querySelector(".".concat(v,"-container")),l=s.querySelector(".".concat(v,"-title")),h=s.querySelector(".".concat(v,"-toolbar")),o=s.querySelector(".".concat(v,"-navbar")),u=s.querySelector(".".concat(v,"-button")),c=s.querySelector(".".concat(v,"-canvas"));if(this.parent=n,this.viewer=s,this.title=l,this.toolbar=h,this.navbar=o,this.button=u,this.canvas=c,this.footer=s.querySelector(".".concat(v,"-footer")),this.tooltipBox=s.querySelector(".".concat(v,"-tooltip")),this.player=s.querySelector(".".concat(v,"-player")),this.list=s.querySelector(".".concat(v,"-list")),s.id="".concat(v).concat(this.id),l.id="".concat(v,"Title").concat(this.id),f(l,r.title?ut(Array.isArray(r.title)?r.title[0]:r.title):Y),f(o,r.navbar?ut(r.navbar):Y),st(u,Y,!r.button),r.keyboard&&u.setAttribute("tabindex",0),r.backdrop&&(f(s,"".concat(v,"-backdrop")),!r.inline&&r.backdrop!=="static"&&xt(c,mt,"hide")),at(r.className)&&r.className&&r.className.split($t).forEach(function(T){f(s,T)}),r.toolbar){var g=document.createElement("ul"),I=B(r.toolbar),S=lt.slice(0,3),E=lt.slice(7,9),x=lt.slice(9);I||f(h,ut(r.toolbar)),y(I?r.toolbar:lt,function(T,R){var F=I&&B(T),P=I?kt(R):T,M=F&&!U(T.show)?T.show:T;if(!(!M||!r.zoomable&&S.indexOf(P)!==-1||!r.rotatable&&E.indexOf(P)!==-1||!r.scalable&&x.indexOf(P)!==-1)){var tt=F&&!U(T.size)?T.size:T,X=F&&!U(T.click)?T.click:T,j=document.createElement("li");r.keyboard&&j.setAttribute("tabindex",0),j.setAttribute("role","button"),f(j,"".concat(v,"-").concat(P)),p(X)||xt(j,mt,P),_(M)&&f(j,ut(M)),["small","large"].indexOf(tt)!==-1?f(j,"".concat(v,"-").concat(tt)):P==="play"&&f(j,"".concat(v,"-large")),p(X)&&d(j,J,X),g.appendChild(j)}}),h.appendChild(g)}else f(h,Y);if(!r.rotatable){var D=h.querySelectorAll('li[class*="rotate"]');f(D,rt),y(D,function(T){h.appendChild(T)})}if(r.inline)f(u,ei),z(s,{zIndex:r.zIndexInline}),window.getComputedStyle(n).position==="static"&&z(n,{position:"relative"}),n.insertBefore(s,i.nextSibling);else{f(u,ti),f(s,It),f(s,vt),f(s,Y),z(s,{zIndex:r.zIndex});var N=r.container;at(N)&&(N=i.ownerDocument.querySelector(N)),N||(N=this.body),N.appendChild(s)}if(r.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,p(r.ready)&&d(i,Zt,r.ready,{once:!0}),A(i,Zt)===!1){this.ready=!1;return}this.ready&&r.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=_i,e}},{key:"setDefaults",value:function(i){C(Ft,B(i)&&i)}}]),e}();C(Ae.prototype,bi,yi,wi,Ti,Ei);/*! * v-viewer v3.0.11 * https://github.com/mirari/v-viewer#readme * * Copyright 2022 mirari * Released under the MIT license * * Date: 2022-10-25T08:49:33.301Z */var ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oi(e){return e}var xe=Oi;function Ii(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var Ai=Ii,xi=Ai,de=Math.max;function Di(e,t,i){return t=de(t===void 0?e.length-1:t,0),function(){for(var r=arguments,n=-1,a=de(r.length-t,0),s=Array(a);++n0){if(++t>=Mr)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var qr=Xr,Hr=Fr,Ur=qr,Br=Ur(Hr),Kr=Br,Gr=xe,Zr=Ni,Jr=Kr;function Qr(e,t){return Jr(Zr(e,t,Gr),e+"")}var tn=Qr;function en(e,t){return e===t||e!==e&&t!==t}var $e=en,rn=9007199254740991;function nn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rn}var ke=nn,an=Le,sn=ke;function on(e){return e!=null&&sn(e.length)&&!an(e)}var ze=on,ln=9007199254740991,un=/^(?:0|[1-9]\d*)$/;function hn(e,t){var i=typeof e;return t=t??ln,!!t&&(i=="number"||i!="symbol"&&un.test(e))&&e>-1&&e%1==0&&e2?t[2]:void 0;for(n&&Xa(t[0],t[1],n)&&(r=1);++i0}}),!0):!1}var Ka=(e,t)=>{const i=e.__vccOpts||e;for(const[r,n]of t)i[r]=n;return i};const Ga=Ee({name:"Viewer",props:{images:{type:Array,default:()=>[]},rebuild:{type:Boolean,default:!1},trigger:{type:Object,default:null},options:{type:Object,default:()=>null}},emits:["inited"],setup(e,{emit:t}){let i;const r=Ve();function n(){i=new Ae(r.value,e.options),t("inited",i)}function a(){i&&i.destroy()}function s(){a(),n()}function l(){i?(i.update(),t("inited",i)):n()}function h(){e.rebuild?s():l()}const o={deep:!0};return yt(()=>e.images,()=>wt(()=>h()),o),yt(()=>e.trigger,()=>wt(()=>h()),o),yt(()=>e.options,()=>wt(()=>s()),o),Fe(()=>n()),Me(()=>a()),{root:r,createViewer:n,rebuildViewer:s,updateViewer:l,destroyViewer:a}}}),Za={ref:"root"};function Ja(e,t,i,r,n,a){return ft(),St("div",Za,[Ye(e.$slots,"default",{images:e.images,options:e.options})],512)}var Qa=Ka(Ga,[["render",Ja]]);const ts=["src"],es=Ee({__name:"ImageViewer",props:{image:null},setup(e){const t=e,i=We(()=>t.image?[{src:t.image,index:0}]:[]);return(r,n)=>(ft(),Xe(Tt(Qa),{images:Tt(i),style:{height:"800px"}},{default:qe(()=>[(ft(!0),St(Ue,null,He(Tt(i),a=>(ft(),St("img",{alt:"图片",src:a.src,key:a.index,class:"image"},null,8,ts))),128))]),_:1},8,["images"]))}});const rs=Be(es,[["__scopeId","data-v-b4c7568a"]]);export{rs as default};