index-legacy.4107d2fe.js 6.6 KB

1
  1. !function(){function r(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function e(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==t)return;var a,n,i=[],o=!0,l=!1;try{for(t=t.call(r);!(o=(a=t.next()).done)&&(i.push(a.value),!e||i.length!==e);o=!0);}catch(u){l=!0,n=u}finally{try{o||null==t.return||t.return()}finally{if(l)throw n}}return i}(r,e)||function(r,e){if(!r)return;if("string"==typeof r)return t(r,e);var a=Object.prototype.toString.call(r).slice(8,-1);"Object"===a&&r.constructor&&(a=r.constructor.name);if("Map"===a||"Set"===a)return Array.from(r);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(r,e)}(r,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 t(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,a=new Array(e);t<e;t++)a[t]=r[t];return a}var a=document.createElement("style");a.innerHTML=':root{--van-slider-active-background-color: var(--van-primary-color);--van-slider-inactive-background-color: var(--van-gray-3);--van-slider-disabled-opacity: var(--van-disabled-opacity);--van-slider-bar-height: .05333rem;--van-slider-button-width: .64rem;--van-slider-button-height: .64rem;--van-slider-button-border-radius: 50%;--van-slider-button-background-color: var(--van-white);--van-slider-button-box-shadow: 0 .02667rem .05333rem rgba(0, 0, 0, .5)}.van-slider{position:relative;width:100%;height:var(--van-slider-bar-height);background:var(--van-slider-inactive-background-color);border-radius:var(--van-border-radius-max);cursor:pointer}.van-slider:before{position:absolute;top:calc(var(--van-padding-xs) * -1);right:0;bottom:calc(var(--van-padding-xs) * -1);left:0;content:""}.van-slider__bar{position:absolute;width:100%;height:100%;background:var(--van-slider-active-background-color);border-radius:inherit;transition:all var(--van-animation-duration-fast)}.van-slider__button{width:var(--van-slider-button-width);height:var(--van-slider-button-height);background:var(--van-slider-button-background-color);border-radius:var(--van-slider-button-border-radius);box-shadow:var(--van-slider-button-box-shadow)}.van-slider__button-wrapper{position:absolute;cursor:grab;top:50%}.van-slider__button-wrapper--right{right:0;transform:translate(50%,-50%)}.van-slider__button-wrapper--left{left:0;transform:translate(-50%,-50%)}.van-slider--disabled{cursor:not-allowed;opacity:var(--van-slider-disabled-opacity)}.van-slider--disabled .van-slider__button-wrapper{cursor:not-allowed}.van-slider--vertical{display:inline-block;width:var(--van-slider-bar-height);height:100%}.van-slider--vertical .van-slider__button-wrapper--right{top:auto;right:50%;bottom:0;transform:translate(50%,50%)}.van-slider--vertical .van-slider__button-wrapper--left{top:0;right:50%;left:auto;transform:translate(50%,-50%)}.van-slider--vertical:before{top:0;right:calc(var(--van-padding-xs) * -1);bottom:0;left:calc(var(--van-padding-xs) * -1)}\n',document.head.appendChild(a),System.register(["./ResizeObserver.es-legacy.44b91b4c.js"],(function(t){"use strict";var a,n,i,o,l,u,d,v,s,c,b,f,m,g,h,p,y;return{setters:[function(r){a=r.E,n=r.ab,i=r.G,o=r.d,l=r.U,u=r.ai,d=r.W,v=r.a2,s=r.bf,c=r.j,b=r.Y,f=r.bu,m=r.bg,g=r.aq,h=r.be,p=r.as,y=r.O}],execute:function(){var w=e(a("slider"),2),x=w[0],_=w[1],k={min:n(0),max:n(100),step:n(1),range:Boolean,reverse:Boolean,disabled:Boolean,readonly:Boolean,vertical:Boolean,barHeight:i,buttonSize:i,activeColor:String,inactiveColor:String,modelValue:{type:[Number,Array],default:0}},S=o({name:x,props:k,emits:["change","drag-end","drag-start","update:modelValue"],setup:function(t,a){var n,i,o,y=a.emit,w=a.slots,x=l(),k=l(),S=u(),V=d((function(){return Number(t.max)-Number(t.min)})),N=d((function(){var e=t.vertical?"width":"height";return r({background:t.inactiveColor},e,v(t.barHeight))})),A=function(r){return t.range&&Array.isArray(r)},C=d((function(){var e,a,n,i=(r(e={},t.vertical?"height":"width",(a=t.modelValue,n=t.min,A(a)?"".concat(100*(a[1]-a[0])/V.value,"%"):"".concat(100*(a-Number(n))/V.value,"%"))),r(e,"background",t.activeColor),e);k.value&&(i.transition="none");return i[t.vertical?t.reverse?"bottom":"top":t.reverse?"right":"left"]=function(){var r=t.modelValue,e=t.min;return A(r)?"".concat(100*(r[0]-Number(e))/V.value,"%"):"0%"}(),i})),O=function(r){var e=+t.min,a=+t.max,n=+t.step;r=p(r,e,a);var i=Math.round((r-e)/n)*n;return m(e,i)},j=function(r,e){return JSON.stringify(r)===JSON.stringify(e)},T=function(r,e){r=A(r)?function(r){var e,a,n=null!=(e=r[0])?e:Number(t.min),i=null!=(a=r[1])?a:Number(t.max);return n>i?[i,n]:[n,i]}(r).map(O):O(r),j(r,t.modelValue)||y("update:modelValue",r),e&&!j(r,o)&&y("change",r)},B=function(r){if(r.stopPropagation(),!t.disabled&&!t.readonly){var a=t.min,n=t.reverse,i=t.vertical,o=t.modelValue,l=b(x),u=i?l.height:l.width,d=Number(a)+(i?n?l.bottom-r.clientY:r.clientY-l.top:n?l.right-r.clientX:r.clientX-l.left)/u*V.value;if(A(o)){var v=e(o,2),s=v[0],c=v[1];T(d<=(s+c)/2?[d,c]:[s,d],!0)}else T(d,!0)}},z=function(r){if(!t.disabled&&!t.readonly){"start"===k.value&&y("drag-start",r),g(r,!0),S.move(r),k.value="dragging";var e=b(x),a=(t.vertical?S.deltaY.value:S.deltaX.value)/(t.vertical?e.height:e.width)*V.value;if(t.reverse&&(a=-a),A(o)){var l=t.reverse?1-n:n;i[l]=o[l]+a}else i=o+a;T(i)}},Y=function(r){t.disabled||t.readonly||("dragging"===k.value&&(T(i,!0),y("drag-end",r)),k.value="")},E=function(r){if("number"==typeof r){return _("button-wrapper",["left","right"][r])}return _("button-wrapper",t.reverse?"left":"right")},H=function(r,e){if("number"==typeof e){var a=w[0===e?"left-button":"right-button"];if(a)return a({value:r})}return w.button?w.button({value:r}):c("div",{class:_("button"),style:h(t.buttonSize)},null)},I=function(r){var e="number"==typeof r?t.modelValue[r]:t.modelValue;return c("div",{role:"slider",class:E(r),tabindex:t.disabled?void 0:0,"aria-valuemin":t.min,"aria-valuenow":e,"aria-valuemax":t.max,"aria-disabled":t.disabled||void 0,"aria-readonly":t.readonly||void 0,"aria-orientation":t.vertical?"vertical":"horizontal",onTouchstart:function(e){"number"==typeof r&&(n=r),function(r){t.disabled||t.readonly||(S.start(r),i=t.modelValue,o=A(i)?i.map(O):O(i),k.value="start")}(e)},onTouchmove:z,onTouchend:Y,onTouchcancel:Y,onClick:f},[H(e,r)])};return T(t.modelValue),s((function(){return t.modelValue})),function(){return c("div",{ref:x,style:N.value,class:_({vertical:t.vertical,disabled:t.disabled}),onClick:B},[c("div",{class:_("bar"),style:C.value},[t.range?[I(0),I(1)]:I()])])}}});t("S",y(S))}}}))}();