1 |
- !function(){function t(t,a){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var n,i,r,u,o=[],l=!0,c=!1;try{if(r=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;l=!1}else for(;!(l=(n=r.call(a)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(v){c=!0,i=v}finally{try{if(!l&&null!=a.return&&(u=a.return(),Object(u)!==u))return}finally{if(c)throw i}}return o}}(t,a)||function(t,a){if(!t)return;if("string"==typeof t)return e(t,a);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,a)}(t,a)||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(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=new Array(e);a<e;a++)n[a]=t[a];return n}System.register(["./index-legacy-35f9ff3a.js"],(function(e,a){"use strict";var n,i,r,u,o,l,c,v,f,s,h,d,p,g,m,w,y,b,S,x,C,M,O,z,A,I,T,j,X;return{setters:[function(t){n=t.c,i=t.t,r=t.n,u=t.b,o=t.d,l=t.r,c=t.q,v=t.u,f=t.a4,s=t.e,h=t.X,d=t.w,p=t.aX,g=t.aY,m=t.bd,w=t.x,y=t.aC,b=t.aQ,S=t.aD,x=t.av,C=t.Y,M=t.a,O=t.bo,z=t.y,A=t.a9,I=t.p,T=t._,j=t.k,X=t.a7}],execute:function(){var a=t(n("swipe"),2),Y=a[0],k=a[1],D={loop:i,width:r,height:r,vertical:Boolean,autoplay:u(0),duration:u(500),touchable:i,lazyRender:Boolean,initialSwipe:u(0),indicatorColor:String,showIndicators:i,stopPropagation:i},E=Symbol(Y),P=o({name:Y,props:D,emits:["change","dragStart","dragEnd"],setup:function(t,e){var a,n,i=e.emit,r=e.slots,u=l(),o=l(),j=c({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),X=!1,Y=v(),D=f(E),P=D.children,B=D.linkChildren,R=s((function(){return P.length})),q=s((function(){return j[t.vertical?"height":"width"]})),H=s((function(){return t.vertical?Y.deltaY.value:Y.deltaX.value})),Q=s((function(){return j.rect?(t.vertical?j.rect.height:j.rect.width)-q.value*R.value:0})),U=s((function(){return q.value?Math.ceil(Math.abs(Q.value)/q.value):R.value})),W=s((function(){return R.value*q.value})),$=s((function(){return(j.active+R.value)%R.value})),_=s((function(){var e=t.vertical?"vertical":"horizontal";return Y.direction.value===e})),F=s((function(){var e={transitionDuration:"".concat(j.swiping?0:t.duration,"ms"),transform:"translate".concat(t.vertical?"Y":"X","(").concat(j.offset,"px)")};if(q.value){var a=t.vertical?"height":"width",n=t.vertical?"width":"height";e[a]="".concat(W.value,"px"),e[n]=t[n]?"".concat(t[n],"px"):""}return e})),G=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e*q.value;t.loop||(n=Math.min(n,-Q.value));var i=a-n;return t.loop||(i=T(i,Q.value,0)),i},J=function(e){var a=e.pace,n=void 0===a?0:a,r=e.offset,u=void 0===r?0:r,o=e.emitChange;if(!(R.value<=1)){var l=j.active,c=function(e){var a=j.active;return e?t.loop?T(a+e,-1,R.value):T(a+e,0,U.value):a}(n),v=G(c,u);if(t.loop){if(P[0]&&v!==Q.value){var f=v<Q.value;P[0].setOffset(f?W.value:0)}if(P[R.value-1]&&0!==v){var s=v>0;P[R.value-1].setOffset(s?-W.value:0)}}j.active=c,j.offset=v,o&&c!==l&&i("change",$.value)}},K=function(){j.swiping=!0,j.active<=-1?J({pace:R.value}):j.active>=R.value&&J({pace:-R.value})},L=function(){K(),Y.reset(),A((function(){j.swiping=!1,J({pace:1,emitChange:!0})}))},N=function(){return clearTimeout(a)},V=function e(){N(),+t.autoplay>0&&R.value>1&&(a=setTimeout((function(){L(),e()}),+t.autoplay))},Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:+t.initialSwipe;if(u.value){var a=function(){var a,n;if(!O(u)){var i={width:u.value.offsetWidth,height:u.value.offsetHeight};j.rect=i,j.width=+(null!=(a=t.width)?a:i.width),j.height=+(null!=(n=t.height)?n:i.height)}R.value&&-1===(e=Math.min(R.value-1,e))&&(e=R.value-1),j.active=e,j.swiping=!0,j.offset=G(e),P.forEach((function(t){t.setOffset(0)})),V()};O(u)?z().then(a):a()}},tt=function(){return Z(j.active)},et=function(e){!t.touchable||e.touches.length>1||(Y.start(e),X=!1,n=Date.now(),N(),K())},at=function(){if(t.touchable&&j.swiping){var e=Date.now()-n,a=H.value/e;if((Math.abs(a)>.25||Math.abs(H.value)>q.value/2)&&_.value){var r=t.vertical?Y.offsetY.value:Y.offsetX.value,u=0;u=t.loop?r>0?H.value>0?-1:1:0:-Math[H.value>0?"ceil":"floor"](H.value/q.value),J({pace:u,emitChange:!0})}else H.value&&J({pace:0});X=!1,j.swiping=!1,i("dragEnd",{index:$.value}),V()}},nt=function(e,a){var n=a===$.value,i=n?{backgroundColor:t.indicatorColor}:void 0;return M("i",{style:i,class:k("indicator",{active:n})},null)};return h({prev:function(){K(),Y.reset(),A((function(){j.swiping=!1,J({pace:-1,emitChange:!0})}))},next:L,state:j,resize:tt,swipeTo:function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};K(),Y.reset(),A((function(){var n;n=t.loop&&e===R.value?0===j.active?0:e:e%R.value,a.immediate?A((function(){j.swiping=!1})):j.swiping=!1,J({pace:n-j.active,emitChange:!0})}))}}),B({size:q,props:t,count:R,activeIndicator:$}),d((function(){return t.initialSwipe}),(function(t){return Z(+t)})),d(R,(function(){return Z(j.active)})),d((function(){return t.autoplay}),V),d([p,g],tt),d(m(),(function(t){"visible"===t?V():N()})),w(Z),y((function(){return Z(j.active)})),b((function(){return Z(j.active)})),S(N),x(N),C("touchmove",(function(e){t.touchable&&j.swiping&&(Y.move(e),_.value&&(!t.loop&&(0===j.active&&H.value>0||j.active===R.value-1&&H.value<0)||(I(e,t.stopPropagation),J({offset:H.value}),X||(i("dragStart",{index:$.value}),X=!0))))}),{target:o}),function(){var e;return M("div",{ref:u,class:k()},[M("div",{ref:o,style:F.value,class:k("track",{vertical:t.vertical}),onTouchstartPassive:et,onTouchend:at,onTouchcancel:at},[null==(e=r.default)?void 0:e.call(r)]),r.indicator?r.indicator({active:$.value,total:R.value}):t.showIndicators&&R.value>1?M("div",{class:k("indicators",{vertical:t.vertical})},[Array(R.value).fill("").map(nt)]):void 0])}}}),B=(e("S",j(P)),t(n("swipe-item"),2)),R=B[0],q=B[1],H=o({name:R,setup:function(t,e){var a,n=e.slots,i=c({offset:0,inited:!1,mounted:!1}),r=X(E),u=r.parent,o=r.index;if(u){var l=s((function(){var t={},e=u.props.vertical;return u.size.value&&(t[e?"height":"width"]="".concat(u.size.value,"px")),i.offset&&(t.transform="translate".concat(e?"Y":"X","(").concat(i.offset,"px)")),t})),v=s((function(){var t=u.props,e=t.loop;if(!t.lazyRender||a)return!0;if(!i.mounted)return!1;var n=u.activeIndicator.value,r=u.count.value-1,l=0===n&&e?r:n-1,c=n===r&&e?0:n+1;return a=o.value===n||o.value===l||o.value===c}));return w((function(){z((function(){i.mounted=!0}))})),h({setOffset:function(t){i.offset=t}}),function(){var t;return M("div",{class:q(),style:l.value},[v.value?null==(t=n.default)?void 0:t.call(n):null])}}}});e("a",j(H))}}}))}();
|