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