index-legacy.863b202f.js 8.0 KB

1
  1. !function(){function t(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var a,n,r=[],o=!0,c=!1;try{for(i=i.call(t);!(o=(a=i.next()).done)&&(r.push(a.value),!e||r.length!==e);o=!0);}catch(u){c=!0,n=u}finally{try{o||null==i.return||i.return()}finally{if(c)throw n}}return r}(t,i)||function(t,i){if(!t)return;if("string"==typeof t)return e(t,i);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return e(t,i)}(t,i)||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 i=0,a=new Array(e);i<e;i++)a[i]=t[i];return a}var i=document.createElement("style");i.innerHTML=":root{--van-swipe-indicator-size: .16rem;--van-swipe-indicator-margin: var(--van-padding-sm);--van-swipe-indicator-active-opacity: 1;--van-swipe-indicator-inactive-opacity: .3;--van-swipe-indicator-active-background-color: var(--van-primary-color);--van-swipe-indicator-inactive-background-color: var(--van-border-color)}.van-swipe{position:relative;overflow:hidden;transform:translateZ(0);cursor:-webkit-grab;cursor:grab;-webkit-user-select:none;user-select:none}.van-swipe__track{display:flex;height:100%}.van-swipe__track--vertical{flex-direction:column}.van-swipe__indicators{position:absolute;bottom:var(--van-swipe-indicator-margin);left:50%;display:flex;transform:translate(-50%)}.van-swipe__indicators--vertical{top:50%;bottom:auto;left:var(--van-swipe-indicator-margin);flex-direction:column;transform:translateY(-50%)}.van-swipe__indicators--vertical .van-swipe__indicator:not(:last-child){margin-bottom:var(--van-swipe-indicator-size)}.van-swipe__indicator{width:var(--van-swipe-indicator-size);height:var(--van-swipe-indicator-size);background-color:var(--van-swipe-indicator-inactive-background-color);border-radius:100%;opacity:var(--van-swipe-indicator-inactive-opacity);transition:opacity var(--van-animation-duration-fast),background-color var(--van-animation-duration-fast)}.van-swipe__indicator:not(:last-child){margin-right:var(--van-swipe-indicator-size)}.van-swipe__indicator--active{background-color:var(--van-swipe-indicator-active-background-color);opacity:var(--van-swipe-indicator-active-opacity)}.van-swipe-item{position:relative;flex-shrink:0;width:100%;height:100%}\n",document.head.appendChild(i),System.register(["./index-legacy.53298efe.js","./index-legacy.7ef67fdb.js"],(function(e){"use strict";var i,a,n,r,o,c,u,l,v,s,f,d,p,h,w,g,m,y,b,_,x,k,z,S,C,M,T,A;return{setters:[function(t){i=t.c,a=t.t,n=t.n,r=t.b,o=t.x,c=t.f,u=t.e,l=t.y,v=t.o,s=t.i,f=t.z,d=t.A,p=t.w},function(t){h=t.d,w=t.r,g=t.n,m=t.R,y=t.y,b=t.w,_=t.V,x=t.o,k=t.L,z=t.D,S=t.E,C=t.c,M=t.J,T=t.W,A=t.U}],execute:function(){var I=t(i("swipe"),2),O=I[0],j=I[1],Y={loop:a,width:n,height:n,vertical:Boolean,autoplay:r(0),duration:r(500),touchable:a,lazyRender:Boolean,initialSwipe:r(0),indicatorColor:String,showIndicators:a,stopPropagation:a},D=Symbol(O),E=h({name:O,props:Y,emits:["change"],setup:function(t,e){var i,a,n=e.emit,r=e.slots,p=w(),h=g({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),A=o(),I=m(D),O=I.children,Y=I.linkChildren,E=y((function(){return O.length})),X=y((function(){return h[t.vertical?"height":"width"]})),R=y((function(){return t.vertical?A.deltaY.value:A.deltaX.value})),B=y((function(){return h.rect?(t.vertical?h.rect.height:h.rect.width)-X.value*E.value:0})),H=y((function(){return Math.ceil(Math.abs(B.value)/X.value)})),L=y((function(){return E.value*X.value})),P=y((function(){return(h.active+E.value)%E.value})),U=y((function(){var e=t.vertical?"vertical":"horizontal";return A.direction.value===e})),W=y((function(){var e={transitionDuration:"".concat(h.swiping?0:t.duration,"ms"),transform:"translate".concat(t.vertical?"Y":"X","(").concat(h.offset,"px)")};if(X.value){var i=t.vertical?"height":"width",a=t.vertical?"width":"height";e[i]="".concat(L.value,"px"),e[a]=t[a]?"".concat(t[a],"px"):""}return e})),J=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=e*X.value;t.loop||(a=Math.min(a,-B.value));var n=i-a;return t.loop||(n=d(n,B.value,0)),n},V=function(e){var i=e.pace,a=void 0===i?0:i,r=e.offset,o=void 0===r?0:r,c=e.emitChange;if(!(E.value<=1)){var u=h.active,l=function(e){var i=h.active;return e?t.loop?d(i+e,-1,E.value):d(i+e,0,H.value):i}(a),v=J(l,o);if(t.loop){if(O[0]&&v!==B.value){var s=v<B.value;O[0].setOffset(s?L.value:0)}if(O[E.value-1]&&0!==v){var f=v>0;O[E.value-1].setOffset(f?-L.value:0)}}h.active=l,h.offset=v,c&&l!==u&&n("change",P.value)}},Z=function(){h.swiping=!0,h.active<=-1?V({pace:E.value}):h.active>=E.value&&V({pace:-E.value})},$=function(){Z(),A.reset(),T((function(){h.swiping=!1,V({pace:1,emitChange:!0})}))},q=function(){return clearTimeout(i)},F=function e(){q(),t.autoplay>0&&E.value>1&&(i=setTimeout((function(){$(),e()}),+t.autoplay))},G=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:+t.initialSwipe;if(p.value){var i=function(){var i,a;if(!s(p)){var n={width:p.value.offsetWidth,height:p.value.offsetHeight};h.rect=n,h.width=+(null!=(i=t.width)?i:n.width),h.height=+(null!=(a=t.height)?a:n.height)}E.value&&(e=Math.min(E.value-1,e)),h.active=e,h.swiping=!0,h.offset=J(e),O.forEach((function(t){t.setOffset(0)})),F()};s(p)?M().then(i):i()}},K=function(){return G(h.active)},N=function(e){t.touchable&&(A.start(e),a=Date.now(),q(),Z())},Q=function(e){t.touchable&&h.swiping&&(A.move(e),U.value&&(f(e,t.stopPropagation),V({offset:R.value})))},tt=function(){if(t.touchable&&h.swiping){var e=Date.now()-a,i=R.value/e;if((Math.abs(i)>.25||Math.abs(R.value)>X.value/2)&&U.value){var n=t.vertical?A.offsetY.value:A.offsetX.value,r=0;r=t.loop?n>0?R.value>0?-1:1:0:-Math[R.value>0?"ceil":"floor"](R.value/X.value),V({pace:r,emitChange:!0})}else R.value&&V({pace:0});h.swiping=!1,F()}},et=function(e,i){var a=i===P.value,n=a?{backgroundColor:t.indicatorColor}:void 0;return C("i",{style:n,class:j("indicator",{active:a})},null)};return c({prev:function(){Z(),A.reset(),T((function(){h.swiping=!1,V({pace:-1,emitChange:!0})}))},next:$,state:h,resize:K,swipeTo:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Z(),A.reset(),T((function(){var a;a=t.loop&&e===E.value?0===h.active?0:e:e%E.value,i.immediate?T((function(){h.swiping=!1})):h.swiping=!1,V({pace:a-h.active,emitChange:!0})}))}}),Y({size:X,props:t,count:E,activeIndicator:P}),b((function(){return t.initialSwipe}),(function(t){return G(+t)})),b(E,(function(){return G(h.active)})),b((function(){return t.autoplay}),F),b([u,l],K),b(_(),(function(t){"visible"===t?F():q()})),x(G),k((function(){return G(h.active)})),v((function(){return G(h.active)})),z(q),S(q),function(){var e;return C("div",{ref:p,class:j()},[C("div",{style:W.value,class:j("track",{vertical:t.vertical}),onTouchstart:N,onTouchmove:Q,onTouchend:tt,onTouchcancel:tt},[null==(e=r.default)?void 0:e.call(r)]),r.indicator?r.indicator({active:P.value,total:E.value}):t.showIndicators&&E.value>1?C("div",{class:j("indicators",{vertical:t.vertical})},[Array(E.value).fill("").map(et)]):void 0])}}}),X=(e("S",p(E)),t(i("swipe-item"),2)),R=X[0],B=X[1],H=h({name:R,setup:function(t,e){var i,a=e.slots,n=g({offset:0,inited:!1,mounted:!1}),r=A(D),o=r.parent,u=r.index;if(o){var l=y((function(){var t={},e=o.props.vertical;return o.size.value&&(t[e?"height":"width"]="".concat(o.size.value,"px")),n.offset&&(t.transform="translate".concat(e?"Y":"X","(").concat(n.offset,"px)")),t})),v=y((function(){var t=o.props,e=t.loop;if(!t.lazyRender||i)return!0;if(!n.mounted)return!1;var a=o.activeIndicator.value,r=o.count.value-1,c=0===a&&e?r:a-1,l=a===r&&e?0:a+1;return i=u.value===a||u.value===c||u.value===l}));return x((function(){M((function(){n.mounted=!0}))})),c({setOffset:function(t){n.offset=t}}),function(){var t;return C("div",{class:B(),style:l.value},[v.value?null==(t=a.default)?void 0:t.call(a):null])}}}});e("a",p(H))}}}))}();