| 1 |
- !function(){function o(o,t){return function(o){if(Array.isArray(o))return o}(o)||function(o,e){var t=null==o?null:"undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(null==t)return;var n,a,i=[],r=!0,c=!1;try{for(t=t.call(o);!(r=(n=t.next()).done)&&(i.push(n.value),!e||i.length!==e);r=!0);}catch(s){c=!0,a=s}finally{try{r||null==t.return||t.return()}finally{if(c)throw a}}return i}(o,t)||function(o,t){if(!o)return;if("string"==typeof o)return e(o,t);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(o,t)}(o,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(o,e){(null==e||e>o.length)&&(e=o.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=o[t];return n}System.register(["./index-legacy.55a2579f.js","./index-legacy.153a3b8d.js","./index-legacy.76c33d64.js"],(function(e){"use strict";var t,n,a,i,r,c,s,l,u,m,v,f,g,h,d,p,w,y,x,b,P,I,X,S,Y,Z,z,C,W,H,R,T,j,A,M;return{setters:[function(o){t=o.t,n=o.d,a=o.av,i=o.z,r=o.r,c=o.ao,s=o.R,l=o.y,u=o.Z,m=o.a0,v=o.c,f=o.a4,g=o.au,h=o.L,d=o.bc,p=o.v,w=o.aw,y=o.w,x=o.O,b=o.u,P=o.W,I=o.$,X=o.aI,S=o.aR,Y=o._,Z=o.E,z=o.al,C=o.P,W=o.am,H=o.ay,R=o.a5,T=o.aN},function(o){j=o.a,A=o.S},function(o){M=o.I}],execute:function(){var N=function(o){return Math.sqrt(Math.pow(o[0].clientX-o[1].clientX,2)+Math.pow(o[0].clientY-o[1].clientY,2))},O=t("image-preview")[1],D=n({props:{src:String,show:Boolean,active:Number,minZoom:a(i),maxZoom:a(i),rootWidth:a(Number),rootHeight:a(Number)},emits:["scale","close","longPress"],setup:function(o,e){var t,n,a,i,p,w,y,x=e.emit,b=e.slots,P=r({scale:1,moveX:0,moveY:0,moving:!1,zooming:!1,imageRatio:0,displayWidth:0,displayHeight:0}),I=c(),X=s(),S=l((function(){var e=o.rootWidth,t=o.rootHeight/e;return P.imageRatio>t})),Y=l((function(){var o=P.scale,e=P.moveX,t=P.moveY,n=P.moving,a={transitionDuration:P.zooming||n?"0s":".3s"};if(1!==o){var i=e/o,r=t/o;a.transform="scale(".concat(o,", ").concat(o,") translate(").concat(i,"px, ").concat(r,"px)")}return a})),Z=l((function(){if(P.imageRatio){var e=o.rootWidth,t=o.rootHeight,n=S.value?t/P.imageRatio:e;return Math.max(0,(P.scale*n-e)/2)}return 0})),z=l((function(){if(P.imageRatio){var e=o.rootWidth,t=o.rootHeight,n=S.value?t:e*P.imageRatio;return Math.max(0,(P.scale*n-t)/2)}return 0})),C=function(e){(e=g(e,+o.minZoom,+o.maxZoom+1))!==P.scale&&(P.scale=e,x("scale",{scale:e,index:o.active}))},W=function(){C(1),P.moveX=0,P.moveY=0},H=function(o){var e=o.touches,r=I.offsetX;I.start(o),t=e.length,n=P.moveX,a=P.moveY,y=Date.now(),P.moving=1===t&&1!==P.scale,P.zooming=2===t&&!r.value,P.zooming&&(i=P.scale,p=N(o.touches))},R=function(){if(!(t>1)){var o,e=I.offsetX,n=I.offsetY,a=Date.now()-y;e.value<5&&n.value<5&&(a<250?w?(clearTimeout(w),w=null,o=P.scale>1?1:2,C(o),P.moveX=0,P.moveY=0):w=setTimeout((function(){x("close"),w=null}),250):a>d&&x("longPress"))}},T=function(e){var t=!1;(P.moving||P.zooming)&&(t=!0,P.moving&&n===P.moveX&&a===P.moveY&&(t=!1),e.touches.length||(P.zooming&&(P.moveX=g(P.moveX,-Z.value,Z.value),P.moveY=g(P.moveY,-z.value,z.value),P.zooming=!1),P.moving=!1,n=0,a=0,i=1,P.scale<1&&W(),P.scale>o.maxZoom&&(P.scale=+o.maxZoom))),f(e,t),R(),I.reset()},A=function(o){var e=o.target,t=e.naturalWidth,n=e.naturalHeight;P.imageRatio=n/t};return u((function(){return o.active}),W),u((function(){return o.show}),(function(o){o||W()})),m("touchmove",(function(o){var e=o.touches;if(I.move(o),(P.moving||P.zooming)&&f(o,!0),P.moving){var t=I.deltaX,r=I.deltaY,c=t.value+n,s=r.value+a;P.moveX=g(c,-Z.value,Z.value),P.moveY=g(s,-z.value,z.value)}if(P.zooming&&2===e.length){var l=N(e);C(i*l/p)}}),{target:l((function(){var o;return null==(o=X.value)?void 0:o.$el}))}),function(){var e={loading:function(){return v(h,{type:"spinner"},null)}};return v(j,{ref:X,class:O("swipe-item"),onTouchstartPassive:H,onTouchend:T,onTouchcancel:T},{default:function(){return[b.image?v("div",{class:O("image-wrap")},[b.image({src:o.src})]):v(M,{src:o.src,fit:"contain",class:O("image",{vertical:S.value}),style:Y.value,onLoad:A},e)]}})}}}),B=o(t("image-preview"),2),$=B[0],L=B[1],E=["show","transition","overlayStyle","closeOnPopstate"],U={show:Boolean,loop:p,images:w(),minZoom:y(1/3),maxZoom:y(3),overlay:p,closeable:Boolean,showIndex:p,className:x,closeIcon:b("clear"),transition:String,beforeClose:Function,overlayClass:x,overlayStyle:Object,swipeDuration:y(300),startPosition:y(0),showIndicators:Boolean,closeOnPopstate:p,closeIconPosition:b("top-right")};e("s",n({name:$,props:U,emits:["scale","close","closed","change","longPress","update:show"],setup:function(o,e){var t=e.emit,n=e.slots,a=s(),i=r({active:0,rootWidth:0,rootHeight:0}),c=function(){if(a.value){var o=W(a.value.$el);i.rootWidth=o.width,i.rootHeight=o.height,a.value.resize()}},l=function(o){return t("scale",o)},m=function(o){return t("update:show",o)},f=function(){T(o.beforeClose,{args:[i.active],done:function(){return m(!1)}})},g=function(o){o!==i.active&&(i.active=o,t("change",o))},h=function(){if(o.showIndex)return v("div",{class:L("index")},[n.index?n.index({index:i.active}):"".concat(i.active+1," / ").concat(o.images.length)])},d=function(){if(n.cover)return v("div",{class:L("cover")},[n.cover()])},p=function(){if(o.closeable)return v(R,{role:"button",name:o.closeIcon,class:[L("close-icon",o.closeIconPosition),H],onClick:f},null)},w=function(){return t("closed")},y=function(o,e){var t;return null==(t=a.value)?void 0:t.swipeTo(o,e)};return P({swipeTo:y}),I(c),u([X,S],c),u((function(){return o.startPosition}),(function(o){return g(+o)})),u((function(){return o.show}),(function(e){var n=o.images,a=o.startPosition;e?(g(+a),Y((function(){c(),y(+a,{immediate:!0})}))):t("close",{index:i.active,url:n[i.active]})})),function(){return v(C,Z({class:[L(),o.className],overlayClass:[L("overlay"),o.overlayClass],onClosed:w,"onUpdate:show":m},z(o,E)),{default:function(){return[p(),v(A,{ref:a,lazyRender:!0,loop:o.loop,class:L("swipe"),duration:o.swipeDuration,initialSwipe:o.startPosition,showIndicators:o.showIndicators,indicatorColor:"white",onChange:g},{default:function(){return[o.images.map((function(e,a){return v(D,{src:e,show:o.show,active:i.active,maxZoom:o.maxZoom,minZoom:o.minZoom,rootWidth:i.rootWidth,rootHeight:i.rootHeight,onScale:l,onClose:f,onLongPress:function(){return t("longPress",{index:a})}},{image:n.image})}))]}}),h(),d()]}})}}}))}}}))}();
|