66 lines
25 KiB
JavaScript
66 lines
25 KiB
JavaScript
import{Gt as e,Kt as t,Mt as n,Pt as r,Qt as i,U as a,Ut as o,Vt as s,W as c,_ as l,at as u,gt as d,jt as f,m as p,nt as m,on as h,ot as g,rt as _,xt as v,yn as y,zt as b}from"./client-Be0b5AZU.js";import{a as x,c as S,s as C}from"./ui-DePKLhY8.js";import{t as w}from"./fade-in.cssr-DaPLfaec.js";import{t as T}from"./light-lXN2lNp7.js";import{lt as E}from"./index-DpxjEbFc.js";function D(e){return e.composedPath()[0]||null}function O(e){return e.composedPath()[0]}var k={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function A(e,t,n){if(e===`mousemoveoutside`){let e=e=>{t.contains(O(e))||n(e)};return{mousemove:e,touchstart:e}}else if(e===`clickoutside`){let e=!1,r=n=>{e=!t.contains(O(n))},i=r=>{e&&(t.contains(O(r))||n(r))};return{mousedown:r,mouseup:i,touchstart:r,touchend:i}}return console.error(`[evtd/create-trap-handler]: name \`${e}\` is invalid. This could be a bug of evtd.`),{}}function j(e,t,n){let r=k[e],i=r.get(t);i===void 0&&r.set(t,i=new WeakMap);let a=i.get(n);return a===void 0&&i.set(n,a=A(e,t,n)),a}function ee(e,t,n,r){if(e===`mousemoveoutside`||e===`clickoutside`){let i=j(e,t,n);return Object.keys(i).forEach(e=>{N(e,document,i[e],r)}),!0}return!1}function te(e,t,n,r){if(e===`mousemoveoutside`||e===`clickoutside`){let i=j(e,t,n);return Object.keys(i).forEach(e=>{P(e,document,i[e],r)}),!0}return!1}function M(){if(typeof window>`u`)return{on:()=>{},off:()=>{}};let e=new WeakMap,t=new WeakMap;function n(){e.set(this,!0)}function r(){e.set(this,!0),t.set(this,!0)}function i(e,t,n){let r=e[t];return e[t]=function(){return n.apply(e,arguments),r.apply(e,arguments)},e}function a(e,t){e[t]=Event.prototype[t]}let o=new WeakMap,s=Object.getOwnPropertyDescriptor(Event.prototype,`currentTarget`);function c(){return o.get(this)??null}function l(e,t){s!==void 0&&Object.defineProperty(e,"currentTarget",{configurable:!0,enumerable:!0,get:t??s.get})}let u={bubble:{},capture:{}},d={};function f(){let s=function(s){let{type:d,eventPhase:f,bubbles:p}=s,m=O(s);if(f===2)return;let h=f===1?`capture`:`bubble`,g=m,_=[];for(;g===null&&(g=window),_.push(g),g!==window;)g=g.parentNode||null;let v=u.capture[d],y=u.bubble[d];if(i(s,`stopPropagation`,n),i(s,`stopImmediatePropagation`,r),l(s,c),h===`capture`){if(v===void 0)return;for(let n=_.length-1;n>=0&&!e.has(s);--n){let e=_[n],r=v.get(e);if(r!==void 0){o.set(s,e);for(let e of r){if(t.has(s))break;e(s)}}if(n===0&&!p&&y!==void 0){let n=y.get(e);if(n!==void 0)for(let e of n){if(t.has(s))break;e(s)}}}}else if(h===`bubble`){if(y===void 0)return;for(let n=0;n<_.length&&!e.has(s);++n){let e=_[n],r=y.get(e);if(r!==void 0){o.set(s,e);for(let e of r){if(t.has(s))break;e(s)}}}}a(s,`stopPropagation`),a(s,`stopImmediatePropagation`),l(s)};return s.displayName=`evtdUnifiedHandler`,s}function p(){let e=function(e){let{type:t,eventPhase:n}=e;if(n!==2)return;let r=d[t];r!==void 0&&r.forEach(t=>t(e))};return e.displayName=`evtdUnifiedWindowEventHandler`,e}let m=f(),h=p();function g(e,t){let n=u[e];return n[t]===void 0&&(n[t]=new Map,window.addEventListener(t,m,e===`capture`)),n[t]}function _(e){return d[e]===void 0&&(d[e]=new Set,window.addEventListener(e,h)),d[e]}function v(e,t){let n=e.get(t);return n===void 0&&e.set(t,n=new Set),n}function y(e,t,n,r){let i=u[t][n];if(i!==void 0){let t=i.get(e);if(t!==void 0&&t.has(r))return!0}return!1}function b(e,t){let n=d[e];return!!(n!==void 0&&n.has(t))}function x(e,t,n,r){let i;if(i=typeof r==`object`&&r.once===!0?a=>{S(e,t,i,r),n(a)}:n,ee(e,t,i,r))return;let a=v(g(r===!0||typeof r==`object`&&r.capture===!0?`capture`:`bubble`,e),t);if(a.has(i)||a.add(i),t===window){let t=_(e);t.has(i)||t.add(i)}}function S(e,t,n,r){if(te(e,t,n,r))return;let i=r===!0||typeof r==`object`&&r.capture===!0,a=i?`capture`:`bubble`,o=g(a,e),s=v(o,t);if(t===window&&!y(t,i?`bubble`:`capture`,e,n)&&b(e,n)){let t=d[e];t.delete(n),t.size===0&&(window.removeEventListener(e,h),d[e]=void 0)}s.has(n)&&s.delete(n),s.size===0&&o.delete(t),o.size===0&&(window.removeEventListener(e,m,a===`capture`),u[a][e]=void 0)}return{on:x,off:S}}var{on:N,off:P}=M(),F=(typeof window>`u`?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1)&&!window.MSStream;function ne(){return F}function re(t){let n={isDeactivated:!1},r=!1;return s(()=>{if(n.isDeactivated=!1,!r){r=!0;return}t()}),e(()=>{n.isDeactivated=!0,r||=!0}),n}function I(e,t){console.error(`[vueuc/${e}]: ${t}`)}var L=[],ie=function(){return L.some(function(e){return e.activeTargets.length>0})},ae=function(){return L.some(function(e){return e.skippedTargets.length>0})},oe=`ResizeObserver loop completed with undelivered notifications.`,se=function(){var e;typeof ErrorEvent==`function`?e=new ErrorEvent(`error`,{message:oe}):(e=document.createEvent(`Event`),e.initEvent(`error`,!1,!1),e.message=oe),window.dispatchEvent(e)},R;(function(e){e.BORDER_BOX=`border-box`,e.CONTENT_BOX=`content-box`,e.DEVICE_PIXEL_CONTENT_BOX=`device-pixel-content-box`})(R||={});var z=function(e){return Object.freeze(e)},ce=function(){function e(e,t){this.inlineSize=e,this.blockSize=t,z(this)}return e}(),B=function(){function e(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,z(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),le=function(e){return e instanceof SVGElement&&`getBBox`in e},ue=function(e){if(le(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var i=e,a=i.offsetWidth,o=i.offsetHeight;return!(a||o||e.getClientRects().length)},de=function(e){if(e instanceof Element)return!0;var t=e?.ownerDocument?.defaultView;return!!(t&&e instanceof t.Element)},fe=function(e){switch(e.tagName){case`INPUT`:if(e.type!==`image`)break;case`VIDEO`:case`AUDIO`:case`EMBED`:case`OBJECT`:case`CANVAS`:case`IFRAME`:case`IMG`:return!0}return!1},V=typeof window<`u`?window:{},H=new WeakMap,U=/auto|scroll/,pe=/^tb|vertical/,me=/msie|trident/i.test(V.navigator&&V.navigator.userAgent),W=function(e){return parseFloat(e||`0`)},G=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new ce((n?t:e)||0,(n?e:t)||0)},K=z({devicePixelContentBoxSize:G(),borderBoxSize:G(),contentBoxSize:G(),contentRect:new B(0,0,0,0)}),he=function(e,t){if(t===void 0&&(t=!1),H.has(e)&&!t)return H.get(e);if(ue(e))return H.set(e,K),K;var n=getComputedStyle(e),r=le(e)&&e.ownerSVGElement&&e.getBBox(),i=!me&&n.boxSizing===`border-box`,a=pe.test(n.writingMode||``),o=!r&&U.test(n.overflowY||``),s=!r&&U.test(n.overflowX||``),c=r?0:W(n.paddingTop),l=r?0:W(n.paddingRight),u=r?0:W(n.paddingBottom),d=r?0:W(n.paddingLeft),f=r?0:W(n.borderTopWidth),p=r?0:W(n.borderRightWidth),m=r?0:W(n.borderBottomWidth),h=r?0:W(n.borderLeftWidth),g=d+l,_=c+u,v=h+p,y=f+m,b=s?e.offsetHeight-y-e.clientHeight:0,x=o?e.offsetWidth-v-e.clientWidth:0,S=i?g+v:0,C=i?_+y:0,w=r?r.width:W(n.width)-S-x,T=r?r.height:W(n.height)-C-b,E=w+g+x+v,D=T+_+b+y,O=z({devicePixelContentBoxSize:G(Math.round(w*devicePixelRatio),Math.round(T*devicePixelRatio),a),borderBoxSize:G(E,D,a),contentBoxSize:G(w,T,a),contentRect:new B(d,c,w,T)});return H.set(e,O),O},ge=function(e,t,n){var r=he(e,n),i=r.borderBoxSize,a=r.contentBoxSize,o=r.devicePixelContentBoxSize;switch(t){case R.DEVICE_PIXEL_CONTENT_BOX:return o;case R.BORDER_BOX:return i;default:return a}},_e=function(){function e(e){var t=he(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=z([t.borderBoxSize]),this.contentBoxSize=z([t.contentBoxSize]),this.devicePixelContentBoxSize=z([t.devicePixelContentBoxSize])}return e}(),ve=function(e){if(ue(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},q=function(){var e=1/0,t=[];L.forEach(function(n){if(n.activeTargets.length!==0){var r=[];n.activeTargets.forEach(function(t){var n=new _e(t.target),i=ve(t.target);r.push(n),t.lastReportedSize=ge(t.target,t.observedBox),i<e&&(e=i)}),t.push(function(){n.callback.call(n.observer,r,n.observer)}),n.activeTargets.splice(0,n.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var i=r[n];i()}return e},ye=function(e){L.forEach(function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach(function(n){n.isActive()&&(ve(n.target)>e?t.activeTargets.push(n):t.skippedTargets.push(n))})})},be=function(){var e=0;for(ye(e);ie();)e=q(),ye(e);return ae()&&se(),e>0},J,xe=[],Se=function(){return xe.splice(0).forEach(function(e){return e()})},Ce=function(e){if(!J){var t=0,n=document.createTextNode(``);new MutationObserver(function(){return Se()}).observe(n,{characterData:!0}),J=function(){n.textContent=`${t?t--:t++}`}}xe.push(e),J()},we=function(e){Ce(function(){requestAnimationFrame(e)})},Y=0,Te=function(){return!!Y},Ee=250,De={attributes:!0,characterData:!0,childList:!0,subtree:!0},X=[`resize`,`load`,`transitionend`,`animationend`,`animationstart`,`animationiteration`,`keyup`,`keydown`,`mouseup`,`mousedown`,`mouseover`,`mouseout`,`blur`,`focus`],Oe=function(e){return e===void 0&&(e=0),Date.now()+e},ke=!1,Z=new(function(){function e(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return e.prototype.run=function(e){var t=this;if(e===void 0&&(e=Ee),!ke){ke=!0;var n=Oe(e);we(function(){var r=!1;try{r=be()}finally{if(ke=!1,e=n-Oe(),!Te())return;r?t.run(1e3):e>0?t.run(e):t.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var e=this,t=function(){return e.observer&&e.observer.observe(document.body,De)};document.body?t():V.addEventListener(`DOMContentLoaded`,t)},e.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),X.forEach(function(t){return V.addEventListener(t,e.listener,!0)}))},e.prototype.stop=function(){var e=this;this.stopped||=(this.observer&&this.observer.disconnect(),X.forEach(function(t){return V.removeEventListener(t,e.listener,!0)}),!0)},e}()),Ae=function(e){!Y&&e>0&&Z.start(),Y+=e,!Y&&Z.stop()},je=function(e){return!le(e)&&!fe(e)&&getComputedStyle(e).display===`inline`},Q=function(){function e(e,t){this.target=e,this.observedBox=t||R.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var e=ge(this.target,this.observedBox,!0);return je(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},e}(),Me=function(){function e(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t}return e}(),$=new WeakMap,Ne=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Pe=function(){function e(){}return e.connect=function(e,t){var n=new Me(e,t);$.set(e,n)},e.observe=function(e,t,n){var r=$.get(e),i=r.observationTargets.length===0;Ne(r.observationTargets,t)<0&&(i&&L.push(r),r.observationTargets.push(new Q(t,n&&n.box)),Ae(1),Z.schedule())},e.unobserve=function(e,t){var n=$.get(e),r=Ne(n.observationTargets,t),i=n.observationTargets.length===1;r>=0&&(i&&L.splice(L.indexOf(n),1),n.observationTargets.splice(r,1),Ae(-1))},e.disconnect=function(e){var t=this,n=$.get(e);n.observationTargets.slice().forEach(function(n){return t.unobserve(e,n.target)}),n.activeTargets.splice(0,n.activeTargets.length)},e}(),Fe=function(){function e(e){if(arguments.length===0)throw TypeError(`Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.`);if(typeof e!=`function`)throw TypeError(`Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.`);Pe.connect(this,e)}return e.prototype.observe=function(e,t){if(arguments.length===0)throw TypeError(`Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.`);if(!de(e))throw TypeError(`Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element`);Pe.observe(this,e,t)},e.prototype.unobserve=function(e){if(arguments.length===0)throw TypeError(`Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.`);if(!de(e))throw TypeError(`Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element`);Pe.unobserve(this,e)},e.prototype.disconnect=function(){Pe.disconnect(this)},e.toString=function(){return`function ResizeObserver () { [polyfill code] }`},e}(),Ie=new class{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new(typeof window<`u`&&window.ResizeObserver||Fe)(this.handleResize),this.elHandlersMap=new Map}handleResize(e){for(let t of e){let e=this.elHandlersMap.get(t.target);e!==void 0&&e(t)}}registerHandler(e,t){this.elHandlersMap.set(e,t),this.observer.observe(e)}unregisterHandler(e){this.elHandlersMap.has(e)&&(this.elHandlersMap.delete(e),this.observer.unobserve(e))}},Le=f({name:`ResizeObserver`,props:{onResize:Function},setup(e){let r=!1,i=n().proxy;function a(t){let{onResize:n}=e;n!==void 0&&n(t)}t(()=>{let e=i.$el;if(e===void 0){I(`resize-observer`,`$el does not exist.`);return}if(e.nextElementSibling!==e.nextSibling&&e.nodeType===3&&e.nodeValue!==``){I(`resize-observer`,`$el can not be observed (it may be a text node).`);return}e.nextElementSibling!==null&&(Ie.registerHandler(e.nextElementSibling,a),r=!0)}),o(()=>{r&&Ie.unregisterHandler(i.$el.nextElementSibling)})},render(){return i(this.$slots,`default`)}});function Re(e){let{left:t,right:n,top:r,bottom:i}=C(e);return`${r} ${t} ${i} ${n}`}function ze(e){return Object.keys(e)}var Be=f({render(){var e;return(e=this.$slots).default?.call(e)}}),Ve=_(`scrollbar`,`
|
|
overflow: hidden;
|
|
position: relative;
|
|
z-index: auto;
|
|
height: 100%;
|
|
width: 100%;
|
|
`,[m(`>`,[_(`scrollbar-container`,`
|
|
width: 100%;
|
|
overflow: scroll;
|
|
height: 100%;
|
|
min-height: inherit;
|
|
max-height: inherit;
|
|
scrollbar-width: none;
|
|
`,[m(`&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb`,`
|
|
width: 0;
|
|
height: 0;
|
|
display: none;
|
|
`),m(`>`,[_(`scrollbar-content`,`
|
|
box-sizing: border-box;
|
|
min-width: 100%;
|
|
`)])])]),m(`>, +`,[_(`scrollbar-rail`,`
|
|
position: absolute;
|
|
pointer-events: none;
|
|
user-select: none;
|
|
background: var(--n-scrollbar-rail-color);
|
|
-webkit-user-select: none;
|
|
`,[g(`horizontal`,`
|
|
height: var(--n-scrollbar-height);
|
|
`,[m(`>`,[u(`scrollbar`,`
|
|
height: var(--n-scrollbar-height);
|
|
border-radius: var(--n-scrollbar-border-radius);
|
|
right: 0;
|
|
`)])]),g(`horizontal--top`,`
|
|
top: var(--n-scrollbar-rail-top-horizontal-top);
|
|
right: var(--n-scrollbar-rail-right-horizontal-top);
|
|
bottom: var(--n-scrollbar-rail-bottom-horizontal-top);
|
|
left: var(--n-scrollbar-rail-left-horizontal-top);
|
|
`),g(`horizontal--bottom`,`
|
|
top: var(--n-scrollbar-rail-top-horizontal-bottom);
|
|
right: var(--n-scrollbar-rail-right-horizontal-bottom);
|
|
bottom: var(--n-scrollbar-rail-bottom-horizontal-bottom);
|
|
left: var(--n-scrollbar-rail-left-horizontal-bottom);
|
|
`),g(`vertical`,`
|
|
width: var(--n-scrollbar-width);
|
|
`,[m(`>`,[u(`scrollbar`,`
|
|
width: var(--n-scrollbar-width);
|
|
border-radius: var(--n-scrollbar-border-radius);
|
|
bottom: 0;
|
|
`)])]),g(`vertical--left`,`
|
|
top: var(--n-scrollbar-rail-top-vertical-left);
|
|
right: var(--n-scrollbar-rail-right-vertical-left);
|
|
bottom: var(--n-scrollbar-rail-bottom-vertical-left);
|
|
left: var(--n-scrollbar-rail-left-vertical-left);
|
|
`),g(`vertical--right`,`
|
|
top: var(--n-scrollbar-rail-top-vertical-right);
|
|
right: var(--n-scrollbar-rail-right-vertical-right);
|
|
bottom: var(--n-scrollbar-rail-bottom-vertical-right);
|
|
left: var(--n-scrollbar-rail-left-vertical-right);
|
|
`),g(`disabled`,[m(`>`,[u(`scrollbar`,`pointer-events: none;`)])]),m(`>`,[u(`scrollbar`,`
|
|
z-index: 1;
|
|
position: absolute;
|
|
cursor: pointer;
|
|
pointer-events: all;
|
|
background-color: var(--n-scrollbar-color);
|
|
transition: background-color .2s var(--n-scrollbar-bezier);
|
|
`,[w(),m(`&:hover`,`background-color: var(--n-scrollbar-color-hover);`)])])])])]),He=f({name:`Scrollbar`,props:Object.assign(Object.assign({},p.props),{duration:{type:Number,default:0},scrollable:{type:Boolean,default:!0},xScrollable:Boolean,trigger:{type:String,default:`hover`},useUnifiedContainer:Boolean,triggerDisplayManually:Boolean,container:Function,content:Function,containerClass:String,containerStyle:[String,Object],contentClass:[String,Array],contentStyle:[String,Object],horizontalRailStyle:[String,Object],verticalRailStyle:[String,Object],onScroll:Function,onWheel:Function,onResize:Function,internalOnUpdateScrollLeft:Function,internalHoistYRail:Boolean,internalExposeWidthCssVar:Boolean,yPlacement:{type:String,default:`right`},xPlacement:{type:String,default:`bottom`}}),inheritAttrs:!1,setup(e){let{mergedClsPrefixRef:n,inlineThemeDisabled:r,mergedRtlRef:i}=c(e),s=l(`Scrollbar`,i,n),u=y(null),d=y(null),f=y(null),m=y(null),g=y(null),_=y(null),b=y(null),S=y(null),w=y(null),E=y(null),O=y(null),k=y(0),A=y(0),j=y(!1),ee=y(!1),te=!1,M=!1,F,I,L=0,ie=0,ae=0,oe=0,se=ne(),R=p(`Scrollbar`,`-scrollbar`,Ve,T,e,n),z=v(()=>{let{value:e}=S,{value:t}=_,{value:n}=E;return e===null||t===null||n===null?0:Math.min(e,n*e/t+x(R.value.self.width)*1.5)}),ce=v(()=>`${z.value}px`),B=v(()=>{let{value:e}=w,{value:t}=b,{value:n}=O;return e===null||t===null||n===null?0:n*e/t+x(R.value.self.height)*1.5}),le=v(()=>`${B.value}px`),ue=v(()=>{let{value:e}=S,{value:t}=k,{value:n}=_,{value:r}=E;if(e===null||n===null||r===null)return 0;{let i=n-e;return i?t/i*(r-z.value):0}}),de=v(()=>`${ue.value}px`),fe=v(()=>{let{value:e}=w,{value:t}=A,{value:n}=b,{value:r}=O;if(e===null||n===null||r===null)return 0;{let i=n-e;return i?t/i*(r-B.value):0}}),V=v(()=>`${fe.value}px`),H=v(()=>{let{value:e}=S,{value:t}=_;return e!==null&&t!==null&&t>e}),U=v(()=>{let{value:e}=w,{value:t}=b;return e!==null&&t!==null&&t>e}),pe=v(()=>{let{trigger:t}=e;return t===`none`||j.value}),me=v(()=>{let{trigger:t}=e;return t===`none`||ee.value}),W=v(()=>{let{container:t}=e;return t?t():d.value}),G=v(()=>{let{content:t}=e;return t?t():f.value}),K=(t,n)=>{if(!e.scrollable)return;if(typeof t==`number`){q(t,n??0,0,!1,`auto`);return}let{left:r,top:i,index:a,elSize:o,position:s,behavior:c,el:l,debounce:u=!0}=t;(r!==void 0||i!==void 0)&&q(r??0,i??0,0,!1,c),l===void 0?a!==void 0&&o!==void 0?q(0,a*o,o,u,c):s===`bottom`?q(0,2**53-1,0,!1,c):s===`top`&&q(0,0,0,!1,c):q(0,l.offsetTop,l.offsetHeight,u,c)},he=re(()=>{e.container||K({top:k.value,left:A.value})}),ge=()=>{he.isDeactivated||X()},_e=t=>{if(he.isDeactivated)return;let{onResize:n}=e;n&&n(t),X()},ve=(t,n)=>{if(!e.scrollable)return;let{value:r}=W;r&&(typeof t==`object`?r.scrollBy(t):r.scrollBy(t,n||0))};function q(e,t,n,r,i){let{value:a}=W;if(a){if(r){let{scrollTop:r,offsetHeight:o}=a;if(t>r){t+n<=r+o||a.scrollTo({left:e,top:t+n-o,behavior:i});return}}a.scrollTo({left:e,top:t,behavior:i})}}function ye(){Ce(),we(),X()}function be(){J()}function J(){xe(),Se()}function xe(){I!==void 0&&window.clearTimeout(I),I=window.setTimeout(()=>{ee.value=!1},e.duration)}function Se(){F!==void 0&&window.clearTimeout(F),F=window.setTimeout(()=>{j.value=!1},e.duration)}function Ce(){F!==void 0&&window.clearTimeout(F),j.value=!0}function we(){I!==void 0&&window.clearTimeout(I),ee.value=!0}function Y(t){let{onScroll:n}=e;n&&n(t),Te()}function Te(){let{value:e}=W;e&&(k.value=e.scrollTop,A.value=e.scrollLeft*(s?.value?-1:1))}function Ee(){let{value:e}=G;e&&(_.value=e.offsetHeight,b.value=e.offsetWidth);let{value:t}=W;t&&(S.value=t.offsetHeight,w.value=t.offsetWidth);let{value:n}=g,{value:r}=m;n&&(O.value=n.offsetWidth),r&&(E.value=r.offsetHeight)}function De(){let{value:e}=W;e&&(k.value=e.scrollTop,A.value=e.scrollLeft*(s?.value?-1:1),S.value=e.offsetHeight,w.value=e.offsetWidth,_.value=e.scrollHeight,b.value=e.scrollWidth);let{value:t}=g,{value:n}=m;t&&(O.value=t.offsetWidth),n&&(E.value=n.offsetHeight)}function X(){e.scrollable&&(e.useUnifiedContainer?De():(Ee(),Te()))}function Oe(e){return!u.value?.contains(D(e))}function ke(e){e.preventDefault(),e.stopPropagation(),M=!0,N(`mousemove`,window,Z,!0),N(`mouseup`,window,Ae,!0),ie=A.value,ae=s?.value?window.innerWidth-e.clientX:e.clientX}function Z(t){if(!M)return;F!==void 0&&window.clearTimeout(F),I!==void 0&&window.clearTimeout(I);let{value:n}=w,{value:r}=b,{value:i}=B;if(n===null||r===null)return;let a=(s?.value?window.innerWidth-t.clientX-ae:t.clientX-ae)*(r-n)/(n-i),o=r-n,c=ie+a;c=Math.min(o,c),c=Math.max(c,0);let{value:l}=W;if(l){l.scrollLeft=c*(s?.value?-1:1);let{internalOnUpdateScrollLeft:t}=e;t&&t(c)}}function Ae(e){e.preventDefault(),e.stopPropagation(),P(`mousemove`,window,Z,!0),P(`mouseup`,window,Ae,!0),M=!1,X(),Oe(e)&&J()}function je(e){e.preventDefault(),e.stopPropagation(),te=!0,N(`mousemove`,window,Q,!0),N(`mouseup`,window,Me,!0),L=k.value,oe=e.clientY}function Q(e){if(!te)return;F!==void 0&&window.clearTimeout(F),I!==void 0&&window.clearTimeout(I);let{value:t}=S,{value:n}=_,{value:r}=z;if(t===null||n===null)return;let i=(e.clientY-oe)*(n-t)/(t-r),a=n-t,o=L+i;o=Math.min(a,o),o=Math.max(o,0);let{value:s}=W;s&&(s.scrollTop=o)}function Me(e){e.preventDefault(),e.stopPropagation(),P(`mousemove`,window,Q,!0),P(`mouseup`,window,Me,!0),te=!1,X(),Oe(e)&&J()}h(()=>{let{value:e}=U,{value:t}=H,{value:r}=n,{value:i}=g,{value:a}=m;i&&(e?i.classList.remove(`${r}-scrollbar-rail--disabled`):i.classList.add(`${r}-scrollbar-rail--disabled`)),a&&(t?a.classList.remove(`${r}-scrollbar-rail--disabled`):a.classList.add(`${r}-scrollbar-rail--disabled`))}),t(()=>{e.container||X()}),o(()=>{F!==void 0&&window.clearTimeout(F),I!==void 0&&window.clearTimeout(I),P(`mousemove`,window,Q,!0),P(`mouseup`,window,Me,!0)});let $=v(()=>{let{common:{cubicBezierEaseInOut:e},self:{color:t,colorHover:n,height:r,width:i,borderRadius:a,railInsetHorizontalTop:o,railInsetHorizontalBottom:c,railInsetVerticalRight:l,railInsetVerticalLeft:u,railColor:d}}=R.value,{top:f,right:p,bottom:m,left:h}=C(o),{top:g,right:_,bottom:v,left:y}=C(c),{top:b,right:x,bottom:S,left:w}=C(s?.value?Re(l):l),{top:T,right:E,bottom:D,left:O}=C(s?.value?Re(u):u);return{"--n-scrollbar-bezier":e,"--n-scrollbar-color":t,"--n-scrollbar-color-hover":n,"--n-scrollbar-border-radius":a,"--n-scrollbar-width":i,"--n-scrollbar-height":r,"--n-scrollbar-rail-top-horizontal-top":f,"--n-scrollbar-rail-right-horizontal-top":p,"--n-scrollbar-rail-bottom-horizontal-top":m,"--n-scrollbar-rail-left-horizontal-top":h,"--n-scrollbar-rail-top-horizontal-bottom":g,"--n-scrollbar-rail-right-horizontal-bottom":_,"--n-scrollbar-rail-bottom-horizontal-bottom":v,"--n-scrollbar-rail-left-horizontal-bottom":y,"--n-scrollbar-rail-top-vertical-right":b,"--n-scrollbar-rail-right-vertical-right":x,"--n-scrollbar-rail-bottom-vertical-right":S,"--n-scrollbar-rail-left-vertical-right":w,"--n-scrollbar-rail-top-vertical-left":T,"--n-scrollbar-rail-right-vertical-left":E,"--n-scrollbar-rail-bottom-vertical-left":D,"--n-scrollbar-rail-left-vertical-left":O,"--n-scrollbar-rail-color":d}}),Ne=r?a(`scrollbar`,void 0,$,e):void 0;return Object.assign(Object.assign({},{scrollTo:K,scrollBy:ve,sync:X,syncUnifiedContainer:De,handleMouseEnterWrapper:ye,handleMouseLeaveWrapper:be}),{mergedClsPrefix:n,rtlEnabled:s,containerScrollTop:k,wrapperRef:u,containerRef:d,contentRef:f,yRailRef:m,xRailRef:g,needYBar:H,needXBar:U,yBarSizePx:ce,xBarSizePx:le,yBarTopPx:de,xBarLeftPx:V,isShowXBar:pe,isShowYBar:me,isIos:se,handleScroll:Y,handleContentResize:ge,handleContainerResize:_e,handleYScrollMouseDown:je,handleXScrollMouseDown:ke,containerWidth:w,cssVars:r?void 0:$,themeClass:Ne?.themeClass,onRender:Ne?.onRender})},render(){let{$slots:e,mergedClsPrefix:t,triggerDisplayManually:n,rtlEnabled:i,internalHoistYRail:a,yPlacement:o,xPlacement:s,xScrollable:c}=this;if(!this.scrollable)return e.default?.call(e);let l=this.trigger===`none`,u=(e,n)=>r(`div`,{ref:`yRailRef`,class:[`${t}-scrollbar-rail`,`${t}-scrollbar-rail--vertical`,`${t}-scrollbar-rail--vertical--${o}`,e],"data-scrollbar-rail":!0,style:[n||``,this.verticalRailStyle],"aria-hidden":!0},r(l?Be:E,l?null:{name:`fade-in-transition`},{default:()=>this.needYBar&&this.isShowYBar&&!this.isIos?r(`div`,{class:`${t}-scrollbar-rail__scrollbar`,style:{height:this.yBarSizePx,top:this.yBarTopPx},onMousedown:this.handleYScrollMouseDown}):null})),f=()=>{var o;return(o=this.onRender)==null||o.call(this),r(`div`,b(this.$attrs,{role:`none`,ref:`wrapperRef`,class:[`${t}-scrollbar`,this.themeClass,i&&`${t}-scrollbar--rtl`],style:this.cssVars,onMouseenter:n?void 0:this.handleMouseEnterWrapper,onMouseleave:n?void 0:this.handleMouseLeaveWrapper}),[this.container?e.default?.call(e):r(`div`,{role:`none`,ref:`containerRef`,class:[`${t}-scrollbar-container`,this.containerClass],style:[this.containerStyle,this.internalExposeWidthCssVar?{"--n-scrollbar-current-width":S(this.containerWidth)}:void 0],onScroll:this.handleScroll,onWheel:this.onWheel},r(Le,{onResize:this.handleContentResize},{default:()=>r(`div`,{ref:`contentRef`,role:`none`,style:[{width:this.xScrollable?`fit-content`:null},this.contentStyle],class:[`${t}-scrollbar-content`,this.contentClass]},e)})),a?null:u(void 0,void 0),c&&r(`div`,{ref:`xRailRef`,class:[`${t}-scrollbar-rail`,`${t}-scrollbar-rail--horizontal`,`${t}-scrollbar-rail--horizontal--${s}`],style:this.horizontalRailStyle,"data-scrollbar-rail":!0,"aria-hidden":!0},r(l?Be:E,l?null:{name:`fade-in-transition`},{default:()=>this.needXBar&&this.isShowXBar&&!this.isIos?r(`div`,{class:`${t}-scrollbar-rail__scrollbar`,style:{width:this.xBarSizePx,right:i?this.xBarLeftPx:void 0,left:i?void 0:this.xBarLeftPx},onMousedown:this.handleXScrollMouseDown}):null}))])},p=this.container?f():r(Le,{onResize:this.handleContainerResize},{default:f});return a?r(d,null,p,u(this.themeClass,this.cssVars)):p}}),Ue=He;export{Le as a,N as c,ze as i,D as l,Ue as n,Ie as o,Be as r,P as s,He as t}; |