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)return;var n,i,r=[],u=!0,o=!1;try{for(a=a.call(t);!(u=(n=a.next()).done)&&(r.push(n.value),!e||r.length!==e);u=!0);}catch(l){o=!0,i=l}finally{try{u||null==a.return||a.return()}finally{if(o)throw i}}return r}(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.47bc1690.js"],(function(e){"use strict";var a,n,i,r,u,o,l,c,v,f,s,h,p,d,g,m,w,y,b,S,x,C,z,A,M,T,I,O,Y;return{setters:[function(t){a=t.t,n=t.v,i=t.z,r=t.w,u=t.d,o=t.R,l=t.r,c=t.aq,v=t.x,f=t.y,s=t.W,h=t.Z,p=t.aN,d=t.au,g=t.aY,m=t.$,w=t.aO,y=t.aP,b=t.aZ,S=t.ab,x=t.a0,C=t.c,z=t.aA,A=t._,M=t.a4,T=t.aT,I=t.aU,O=t.D,Y=t.C}],execute:function(){var j=t(a("swipe"),2),D=j[0],P=j[1],X={loop:n,width:i,height:i,vertical:Boolean,autoplay:r(0),duration:r(500),touchable:n,lazyRender:Boolean,initialSwipe:r(0),indicatorColor:String,showIndicators:n,stopPropagation:n},k=Symbol(D),R=u({name:D,props:X,emits:["change"],setup:function(t,e){var a,n,i=e.emit,r=e.slots,u=o(),O=o(),Y=l({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),j=c(),D=v(k),X=D.children,R=D.linkChildren,B=f((function(){return X.length})),E=f((function(){return Y[t.vertical?"height":"width"]})),U=f((function(){return t.vertical?j.deltaY.value:j.deltaX.value})),W=f((function(){return Y.rect?(t.vertical?Y.rect.height:Y.rect.width)-E.value*B.value:0})),Z=f((function(){return E.value?Math.ceil(Math.abs(W.value)/E.value):B.value})),$=f((function(){return B.value*E.value})),q=f((function(){return(Y.active+B.value)%B.value})),H=f((function(){var e=t.vertical?"vertical":"horizontal";return j.direction.value===e})),N=f((function(){var e={transitionDuration:"".concat(Y.swiping?0:t.duration,"ms"),transform:"translate".concat(t.vertical?"Y":"X","(").concat(Y.offset,"px)")};if(E.value){var a=t.vertical?"height":"width",n=t.vertical?"width":"height";e[a]="".concat($.value,"px"),e[n]=t[n]?"".concat(t[n],"px"):""}return e})),_=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e*E.value;t.loop||(n=Math.min(n,-W.value));var i=a-n;return t.loop||(i=I(i,W.value,0)),i},F=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(!(B.value<=1)){var l=Y.active,c=function(e){var a=Y.active;return e?t.loop?I(a+e,-1,B.value):I(a+e,0,Z.value):a}(n),v=_(c,u);if(t.loop){if(X[0]&&v!==W.value){var f=v<W.value;X[0].setOffset(f?$.value:0)}if(X[B.value-1]&&0!==v){var s=v>0;X[B.value-1].setOffset(s?-$.value:0)}}Y.active=c,Y.offset=v,o&&c!==l&&i("change",q.value)}},G=function(){Y.swiping=!0,Y.active<=-1?F({pace:B.value}):Y.active>=B.value&&F({pace:-B.value})},J=function(){G(),j.reset(),T((function(){Y.swiping=!1,F({pace:1,emitChange:!0})}))},K=function(){return clearTimeout(a)},L=function e(){K(),t.autoplay>0&&B.value>1&&(a=setTimeout((function(){J(),e()}),+t.autoplay))},Q=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:+t.initialSwipe;if(u.value){var a=function(){var a,n;if(!z(u)){var i={width:u.value.offsetWidth,height:u.value.offsetHeight};Y.rect=i,Y.width=+(null!=(a=t.width)?a:i.width),Y.height=+(null!=(n=t.height)?n:i.height)}B.value&&(e=Math.min(B.value-1,e)),Y.active=e,Y.swiping=!0,Y.offset=_(e),X.forEach((function(t){t.setOffset(0)})),L()};z(u)?A().then(a):a()}},V=function(){return Q(Y.active)},tt=function(e){t.touchable&&(j.start(e),n=Date.now(),K(),G())},et=function(){if(t.touchable&&Y.swiping){var e=Date.now()-n,a=U.value/e;if((Math.abs(a)>.25||Math.abs(U.value)>E.value/2)&&H.value){var i=t.vertical?j.offsetY.value:j.offsetX.value,r=0;r=t.loop?i>0?U.value>0?-1:1:0:-Math[U.value>0?"ceil":"floor"](U.value/E.value),F({pace:r,emitChange:!0})}else U.value&&F({pace:0});Y.swiping=!1,L()}},at=function(e,a){var n=a===q.value,i=n?{backgroundColor:t.indicatorColor}:void 0;return C("i",{style:i,class:P("indicator",{active:n})},null)};return s({prev:function(){G(),j.reset(),T((function(){Y.swiping=!1,F({pace:-1,emitChange:!0})}))},next:J,state:Y,resize:V,swipeTo:function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};G(),j.reset(),T((function(){var n;n=t.loop&&e===B.value?0===Y.active?0:e:e%B.value,a.immediate?T((function(){Y.swiping=!1})):Y.swiping=!1,F({pace:n-Y.active,emitChange:!0})}))}}),R({size:E,props:t,count:B,activeIndicator:q}),h((function(){return t.initialSwipe}),(function(t){return Q(+t)})),h(B,(function(){return Q(Y.active)})),h((function(){return t.autoplay}),L),h([p,d],V),h(g(),(function(t){"visible"===t?L():K()})),m(Q),w((function(){return Q(Y.active)})),y((function(){return Q(Y.active)})),b(K),S(K),x("touchmove",(function(e){t.touchable&&Y.swiping&&(j.move(e),H.value&&(!t.loop&&(0===Y.active&&U.value>0||Y.active===B.value-1&&U.value<0)||(M(e,t.stopPropagation),F({offset:U.value}))))}),{target:O}),function(){var e;return C("div",{ref:u,class:P()},[C("div",{ref:O,style:N.value,class:P("track",{vertical:t.vertical}),onTouchstartPassive:tt,onTouchend:et,onTouchcancel:et},[null==(e=r.default)?void 0:e.call(r)]),r.indicator?r.indicator({active:q.value,total:B.value}):t.showIndicators&&B.value>1?C("div",{class:P("indicators",{vertical:t.vertical})},[Array(B.value).fill("").map(at)]):void 0])}}}),B=(e("S",O(R)),t(a("swipe-item"),2)),E=B[0],U=B[1],W=u({name:E,setup:function(t,e){var a,n=e.slots,i=l({offset:0,inited:!1,mounted:!1}),r=Y(k),u=r.parent,o=r.index;if(u){var c=f((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=f((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 m((function(){A((function(){i.mounted=!0}))})),s({setOffset:function(t){i.offset=t}}),function(){var t;return C("div",{class:U(),style:c.value},[v.value?null==(t=n.default)?void 0:t.call(n):null])}}}});e("a",O(W))}}}))}();
|