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