import{a as q,o as se}from"./evtd-CI_DDEu_.js";import{k as Me,d as ce,p as G,e as Ce,g as Le}from"./seemly-B7f2tHrf.js";import{A as He,F as Se,C as Ve,d as k,p as Xe,g as Te,i as fe,H as I,G as R,P as ze,N as Z,c as _,h as A,X as Ye,b as K,E as U,n as Ee,v as Ae,I as De,J as Ne,O as _e}from"./@vue-CQsYufSu.js";import{u as ee}from"./@css-render-CQdyXCYJ.js";import{h as Pe,u as ue,o as je,i as Ue}from"./vooks-BQzJqMzq.js";import{z as qe}from"./vdirs-DL8EOfHr.js";import{R as Ke}from"./@juggle-C8OzoCMD.js";import{C as Ge}from"./css-render-Ct37b3-v.js";function ae(n,e,t="default"){const o=e[t];if(o===void 0)throw new Error(`[vueuc/${n}]: slot[${t}] is empty.`);return o()}function de(n,e=!0,t=[]){return n.forEach(o=>{if(o!==null){if(typeof o!="object"){(typeof o=="string"||typeof o=="number")&&t.push(He(String(o)));return}if(Array.isArray(o)){de(o,e,t);return}if(o.type===Se){if(o.children===null)return;Array.isArray(o.children)&&de(o.children,e,t)}else o.type!==Ve&&t.push(o)}}),t}function he(n,e,t="default"){const o=e[t];if(o===void 0)throw new Error(`[vueuc/${n}]: slot[${t}] is empty.`);const r=de(o());if(r.length===1)return r[0];throw new Error(`[vueuc/${n}]: slot[${t}] should have exactly one child.`)}let X=null;function Fe(){if(X===null&&(X=document.getElementById("v-binder-view-measurer"),X===null)){X=document.createElement("div"),X.id="v-binder-view-measurer";const{style:n}=X;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(X)}return X.getBoundingClientRect()}function Je(n,e){const t=Fe();return{top:e,left:n,height:0,width:0,right:t.width-n,bottom:t.height-e}}function re(n){const e=n.getBoundingClientRect(),t=Fe();return{left:e.left-t.left,top:e.top-t.top,bottom:t.height+t.top-e.bottom,right:t.width+t.left-e.right,width:e.width,height:e.height}}function Qe(n){return n.nodeType===9?null:n.parentNode}function Be(n){if(n===null)return null;const e=Qe(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:t,overflowX:o,overflowY:r}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(t+r+o))return e}return Be(e)}const Ze=k({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(n){var e;Xe("VBinder",(e=Te())===null||e===void 0?void 0:e.proxy);const t=fe("VBinder",null),o=I(null),r=i=>{o.value=i,t&&n.syncTargetWithParent&&t.setTargetRef(i)};let l=[];const v=()=>{let i=o.value;for(;i=Be(i),i!==null;)l.push(i);for(const y of l)se("scroll",y,M,!0)},m=()=>{for(const i of l)q("scroll",i,M,!0);l=[]},d=new Set,g=i=>{d.size===0&&v(),d.has(i)||d.add(i)},w=i=>{d.has(i)&&d.delete(i),d.size===0&&m()},M=()=>{Me(a)},a=()=>{d.forEach(i=>i())},c=new Set,p=i=>{c.size===0&&se("resize",window,s),c.has(i)||c.add(i)},h=i=>{c.has(i)&&c.delete(i),c.size===0&&q("resize",window,s)},s=()=>{c.forEach(i=>i())};return R(()=>{q("resize",window,s),m()}),{targetRef:o,setTargetRef:r,addScrollListener:g,removeScrollListener:w,addResizeListener:p,removeResizeListener:h}},render(){return ae("binder",this.$slots)}}),$t=Ze,Mt=k({name:"Target",setup(){const{setTargetRef:n,syncTarget:e}=fe("VBinder");return{syncTarget:e,setTargetDirective:{mounted:n,updated:n}}},render(){const{syncTarget:n,setTargetDirective:e}=this;return n?ze(he("follower",this.$slots),[[e]]):he("follower",this.$slots)}});function pe(n,e){console.error(`[vueuc/${n}]: ${e}`)}const{c:O}=Ge(),te="vueuc-style";function me(n){return n&-n}class Re{constructor(e,t){this.l=e,this.min=t;const o=new Array(e+1);for(let r=0;rr)throw new Error("[FinweckTree.sum]: `i` is larger than length.");let l=e*o;for(;e>0;)l+=t[e],e-=me(e);return l}getBound(e){let t=0,o=this.l;for(;o>t;){const r=Math.floor((t+o)/2),l=this.sum(r);if(l>e){o=r;continue}else if(l{const{to:e}=n;return e??"body"})}},render(){return this.showTeleport?this.disabled?ae("lazy-teleport",this.$slots):A(Ye,{disabled:this.disabled,to:this.mergedTo},ae("lazy-teleport",this.$slots)):null}}),J={top:"bottom",bottom:"top",left:"right",right:"left"},be={start:"end",center:"center",end:"start"},ie={top:"height",bottom:"height",left:"width",right:"width"},tt={"bottom-start":"top left",bottom:"top center","bottom-end":"top right","top-start":"bottom left",top:"bottom center","top-end":"bottom right","right-start":"top left",right:"center left","right-end":"bottom left","left-start":"top right",left:"center right","left-end":"bottom right"},nt={"bottom-start":"bottom left",bottom:"bottom center","bottom-end":"bottom right","top-start":"top left",top:"top center","top-end":"top right","right-start":"top right",right:"center right","right-end":"bottom right","left-start":"top left",left:"center left","left-end":"bottom left"},ot={"bottom-start":"right","bottom-end":"left","top-start":"right","top-end":"left","right-start":"bottom","right-end":"top","left-start":"bottom","left-end":"top"},ge={top:!0,bottom:!1,left:!0,right:!1},we={top:"end",bottom:"start",left:"end",right:"start"};function rt(n,e,t,o,r,l){if(!r||l)return{placement:n,top:0,left:0};const[v,m]=n.split("-");let d=m??"center",g={top:0,left:0};const w=(c,p,h)=>{let s=0,i=0;const y=t[c]-e[p]-e[c];return y>0&&o&&(h?i=ge[p]?y:-y:s=ge[p]?y:-y),{left:s,top:i}},M=v==="left"||v==="right";if(d!=="center"){const c=ot[n],p=J[c],h=ie[c];if(t[h]>e[h]){if(e[c]+e[h]e[p]&&(d=be[m])}else{const c=v==="bottom"||v==="top"?"left":"top",p=J[c],h=ie[c],s=(t[h]-e[h])/2;(e[c]e[p]?(d=we[c],g=w(h,c,M)):(d=we[p],g=w(h,p,M)))}let a=v;return e[v] *",{pointerEvents:"all"})])]),St=k({name:"Follower",inheritAttrs:!1,props:{show:Boolean,enabled:{type:Boolean,default:void 0},placement:{type:String,default:"bottom"},syncTrigger:{type:Array,default:["resize","scroll"]},to:[String,Object],flip:{type:Boolean,default:!0},internalShift:Boolean,x:Number,y:Number,width:String,minWidth:String,containerClass:String,teleportDisabled:Boolean,zindexable:{type:Boolean,default:!0},zIndex:Number,overlap:Boolean},setup(n){const e=fe("VBinder"),t=ue(()=>n.enabled!==void 0?n.enabled:n.show),o=I(null),r=I(null),l=()=>{const{syncTrigger:a}=n;a.includes("scroll")&&e.addScrollListener(d),a.includes("resize")&&e.addResizeListener(d)},v=()=>{e.removeScrollListener(d),e.removeResizeListener(d)};K(()=>{t.value&&(d(),l())});const m=ee();st.mount({id:"vueuc/binder",head:!0,anchorMetaName:te,ssr:m}),R(()=>{v()}),je(()=>{t.value&&d()});const d=()=>{if(!t.value)return;const a=o.value;if(a===null)return;const c=e.targetRef,{x:p,y:h,overlap:s}=n,i=p!==void 0&&h!==void 0?Je(p,h):re(c);a.style.setProperty("--v-target-width",`${Math.round(i.width)}px`),a.style.setProperty("--v-target-height",`${Math.round(i.height)}px`);const{width:y,minWidth:x,placement:B,internalShift:C,flip:N}=n;a.setAttribute("v-placement",B),s?a.setAttribute("v-overlap",""):a.removeAttribute("v-overlap");const{style:E}=a;y==="target"?E.width=`${i.width}px`:y!==void 0?E.width=y:E.width="",x==="target"?E.minWidth=`${i.width}px`:x!==void 0?E.minWidth=x:E.minWidth="";const Y=re(a),L=re(r.value),{left:H,top:u,placement:f}=rt(B,i,Y,C,N,s),b=it(f,s),{left:$,top:S,transform:z}=lt(f,L,i,u,H,s);a.setAttribute("v-placement",f),a.style.setProperty("--v-offset-left",`${Math.round(H)}px`),a.style.setProperty("--v-offset-top",`${Math.round(u)}px`),a.style.transform=`translateX(${$}) translateY(${S}) ${z}`,a.style.setProperty("--v-transform-origin",b),a.style.transformOrigin=b};U(t,a=>{a?(l(),g()):v()});const g=()=>{Ee().then(d).catch(a=>console.error(a))};["placement","x","y","internalShift","flip","width","overlap","minWidth"].forEach(a=>{U(Z(n,a),d)}),["teleportDisabled"].forEach(a=>{U(Z(n,a),g)}),U(Z(n,"syncTrigger"),a=>{a.includes("resize")?e.addResizeListener(d):e.removeResizeListener(d),a.includes("scroll")?e.addScrollListener(d):e.removeScrollListener(d)});const w=Ue(),M=ue(()=>{const{to:a}=n;if(a!==void 0)return a;w.value});return{VBinder:e,mergedEnabled:t,offsetContainerRef:r,followerRef:o,mergedTo:M,syncPosition:d}},render(){return A(et,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var n,e;const t=A("div",{class:["v-binder-follower-container",this.containerClass],ref:"offsetContainerRef"},[A("div",{class:"v-binder-follower-content",ref:"followerRef"},(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n))]);return this.zindexable?ze(t,[[qe,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):t}})}});class ut{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new(typeof window<"u"&&window.ResizeObserver||Ke)(this.handleResize),this.elHandlersMap=new Map}handleResize(e){for(const t of e){const o=this.elHandlersMap.get(t.target);o!==void 0&&o(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))}}const ye=new ut,xe=k({name:"ResizeObserver",props:{onResize:Function},setup(n){let e=!1;const t=Te().proxy;function o(r){const{onResize:l}=n;l!==void 0&&l(r)}K(()=>{const r=t.$el;if(r===void 0){pe("resize-observer","$el does not exist.");return}if(r.nextElementSibling!==r.nextSibling&&r.nodeType===3&&r.nodeValue!==""){pe("resize-observer","$el can not be observed (it may be a text node).");return}r.nextElementSibling!==null&&(ye.registerHandler(r.nextElementSibling,o),e=!0)}),R(()=>{e&&ye.unregisterHandler(t.$el.nextElementSibling)})},render(){return Ae(this.$slots,"default")}});let Q;function at(){return typeof document>"u"?!1:(Q===void 0&&("matchMedia"in window?Q=window.matchMedia("(pointer:coarse)").matches:Q=!1),Q)}let le;function $e(){return typeof document>"u"?1:(le===void 0&&(le="chrome"in window?window.devicePixelRatio:1),le)}const dt=O(".v-vl",{maxHeight:"inherit",height:"100%",overflow:"auto",minWidth:"1px"},[O("&:not(.v-vl--show-scrollbar)",{scrollbarWidth:"none"},[O("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",{width:0,height:0,display:"none"})])]),Tt=k({name:"VirtualList",inheritAttrs:!1,props:{showScrollbar:{type:Boolean,default:!0},items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(n){const e=ee();dt.mount({id:"vueuc/virtual-list",head:!0,anchorMetaName:te,ssr:e}),K(()=>{const{defaultScrollIndex:u,defaultScrollKey:f}=n;u!=null?p({index:u}):f!=null&&p({key:f})});let t=!1,o=!1;De(()=>{if(t=!1,!o){o=!0;return}p({top:M.value,left:w})}),Ne(()=>{t=!0,o||(o=!0)});const r=_(()=>{const u=new Map,{keyField:f}=n;return n.items.forEach((b,$)=>{u.set(b[f],$)}),u}),l=I(null),v=I(void 0),m=new Map,d=_(()=>{const{items:u,itemSize:f,keyField:b}=n,$=new Re(u.length,f);return u.forEach((S,z)=>{const T=S[b],F=m.get(T);F!==void 0&&$.add(z,F)}),$}),g=I(0);let w=0;const M=I(0),a=ue(()=>Math.max(d.value.getBound(M.value-ce(n.paddingTop))-1,0)),c=_(()=>{const{value:u}=v;if(u===void 0)return[];const{items:f,itemSize:b}=n,$=a.value,S=Math.min($+Math.ceil(u/b+1),f.length-1),z=[];for(let T=$;T<=S;++T)z.push(f[T]);return z}),p=(u,f)=>{if(typeof u=="number"){y(u,f,"auto");return}const{left:b,top:$,index:S,key:z,position:T,behavior:F,debounce:V=!0}=u;if(b!==void 0||$!==void 0)y(b,$,F);else if(S!==void 0)i(S,F,V);else if(z!==void 0){const ne=r.value.get(z);ne!==void 0&&i(ne,F,V)}else T==="bottom"?y(0,Number.MAX_SAFE_INTEGER,F):T==="top"&&y(0,0,F)};let h,s=null;function i(u,f,b){const{value:$}=d,S=$.sum(u)+ce(n.paddingTop);if(!b)l.value.scrollTo({left:0,top:S,behavior:f});else{h=u,s!==null&&window.clearTimeout(s),s=window.setTimeout(()=>{h=void 0,s=null},16);const{scrollTop:z,offsetHeight:T}=l.value;if(S>z){const F=$.get(u);S+F<=z+T||l.value.scrollTo({left:0,top:S+F-T,behavior:f})}else l.value.scrollTo({left:0,top:S,behavior:f})}}function y(u,f,b){l.value.scrollTo({left:u,top:f,behavior:b})}function x(u,f){var b,$,S;if(t||n.ignoreItemResize||H(f.target))return;const{value:z}=d,T=r.value.get(u),F=z.get(T),V=(S=($=(b=f.borderBoxSize)===null||b===void 0?void 0:b[0])===null||$===void 0?void 0:$.blockSize)!==null&&S!==void 0?S:f.contentRect.height;if(V===F)return;V-n.itemSize===0?m.delete(u):m.set(u,V-n.itemSize);const P=V-F;if(P===0)return;z.add(T,P);const D=l.value;if(D!=null){if(h===void 0){const oe=z.sum(T);D.scrollTop>oe&&D.scrollBy(0,P)}else if(TD.scrollTop+D.offsetHeight&&D.scrollBy(0,P)}L()}g.value++}const B=!at();let C=!1;function N(u){var f;(f=n.onScroll)===null||f===void 0||f.call(n,u),(!B||!C)&&L()}function E(u){var f;if((f=n.onWheel)===null||f===void 0||f.call(n,u),B){const b=l.value;if(b!=null){if(u.deltaX===0&&(b.scrollTop===0&&u.deltaY<=0||b.scrollTop+b.offsetHeight>=b.scrollHeight&&u.deltaY>=0))return;u.preventDefault(),b.scrollTop+=u.deltaY/$e(),b.scrollLeft+=u.deltaX/$e(),L(),C=!0,Me(()=>{C=!1})}}}function Y(u){if(t||H(u.target)||u.contentRect.height===v.value)return;v.value=u.contentRect.height;const{onResize:f}=n;f!==void 0&&f(u)}function L(){const{value:u}=l;u!=null&&(M.value=u.scrollTop,w=u.scrollLeft)}function H(u){let f=u;for(;f!==null;){if(f.style.display==="none")return!0;f=f.parentElement}return!1}return{listHeight:v,listStyle:{overflow:"auto"},keyToIndex:r,itemsStyle:_(()=>{const{itemResizable:u}=n,f=G(d.value.sum());return g.value,[n.itemsStyle,{boxSizing:"content-box",height:u?"":f,minHeight:u?f:"",paddingTop:G(n.paddingTop),paddingBottom:G(n.paddingBottom)}]}),visibleItemsStyle:_(()=>(g.value,{transform:`translateY(${G(d.value.sum(a.value))})`})),viewportItems:c,listElRef:l,itemsElRef:I(null),scrollTo:p,handleListResize:Y,handleListScroll:N,handleListWheel:E,handleItemResize:x}},render(){const{itemResizable:n,keyField:e,keyToIndex:t,visibleItemsTag:o}=this;return A(xe,{onResize:this.handleListResize},{default:()=>{var r,l;return A("div",_e(this.$attrs,{class:["v-vl",this.showScrollbar&&"v-vl--show-scrollbar"],onScroll:this.handleListScroll,onWheel:this.handleListWheel,ref:"listElRef"}),[this.items.length!==0?A("div",{ref:"itemsElRef",class:"v-vl-items",style:this.itemsStyle},[A(o,Object.assign({class:"v-vl-visible-items",style:this.visibleItemsStyle},this.visibleItemsProps),{default:()=>this.viewportItems.map(v=>{const m=v[e],d=t.get(m),g=this.$slots.default({item:v,index:d})[0];return n?A(xe,{key:m,onResize:w=>this.handleItemResize(m,w)},{default:()=>g}):(g.key=m,g)})})]):(l=(r=this.$slots).empty)===null||l===void 0?void 0:l.call(r)])}})}}),ft=O(".v-x-scroll",{overflow:"auto",scrollbarWidth:"none"},[O("&::-webkit-scrollbar",{width:0,height:0})]),zt=k({name:"XScroll",props:{disabled:Boolean,onScroll:Function},setup(){const n=I(null);function e(r){!(r.currentTarget.offsetWidtha){const{updateCounter:N}=n;for(let E=x;E>=0;--E){const Y=i-1-E;N!==void 0?N(Y):w.textContent=`${Y}`;const L=w.offsetWidth;if(h-=c[E],h+L<=a||E===0){s=!0,x=E-1,p&&(x===-1?(p.style.maxWidth=`${a-L}px`,p.style.boxSizing="border-box"):p.style.maxWidth="");const{onUpdateCount:H}=n;H&&H(Y);break}}}}const{onUpdateOverflow:y}=n;s?y!==void 0&&y(!0):(y!==void 0&&y(!1),w.setAttribute(W,""))}const l=ee();return ct.mount({id:"vueuc/overflow",head:!0,anchorMetaName:te,ssr:l}),K(()=>r({showAllItemsBeforeCalculate:!1})),{selfRef:t,counterRef:o,sync:r}},render(){const{$slots:n}=this;return Ee(()=>this.sync({showAllItemsBeforeCalculate:!1})),A("div",{class:"v-overflow",ref:"selfRef"},[Ae(n,"default"),n.counter?n.counter():A("span",{style:{display:"inline-block"},ref:"counterRef"}),n.tail?n.tail():null])}});function Ie(n){return n instanceof HTMLElement}function Oe(n){for(let e=0;e=0;e--){const t=n.childNodes[e];if(Ie(t)&&(ke(t)||We(t)))return!0}return!1}function ke(n){if(!ht(n))return!1;try{n.focus({preventScroll:!0})}catch{}return document.activeElement===n}function ht(n){if(n.tabIndex>0||n.tabIndex===0&&n.getAttribute("tabIndex")!==null)return!0;if(n.getAttribute("disabled"))return!1;switch(n.nodeName){case"A":return!!n.href&&n.rel!=="ignore";case"INPUT":return n.type!=="hidden"&&n.type!=="file";case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}}let j=[];const At=k({name:"FocusTrap",props:{disabled:Boolean,active:Boolean,autoFocus:{type:Boolean,default:!0},onEsc:Function,initialFocusTo:String,finalFocusTo:String,returnFocusOnDeactivated:{type:Boolean,default:!0}},setup(n){const e=Ce(),t=I(null),o=I(null);let r=!1,l=!1;const v=typeof document>"u"?null:document.activeElement;function m(){return j[j.length-1]===e}function d(s){var i;s.code==="Escape"&&m()&&((i=n.onEsc)===null||i===void 0||i.call(n,s))}K(()=>{U(()=>n.active,s=>{s?(M(),se("keydown",document,d)):(q("keydown",document,d),r&&a())},{immediate:!0})}),R(()=>{q("keydown",document,d),r&&a()});function g(s){if(!l&&m()){const i=w();if(i===null||i.contains(Le(s)))return;c("first")}}function w(){const s=t.value;if(s===null)return null;let i=s;for(;i=i.nextSibling,!(i===null||i instanceof Element&&i.tagName==="DIV"););return i}function M(){var s;if(!n.disabled){if(j.push(e),n.autoFocus){const{initialFocusTo:i}=n;i===void 0?c("first"):(s=ve(i))===null||s===void 0||s.focus({preventScroll:!0})}r=!0,document.addEventListener("focus",g,!0)}}function a(){var s;if(n.disabled||(document.removeEventListener("focus",g,!0),j=j.filter(y=>y!==e),m()))return;const{finalFocusTo:i}=n;i!==void 0?(s=ve(i))===null||s===void 0||s.focus({preventScroll:!0}):n.returnFocusOnDeactivated&&v instanceof HTMLElement&&(l=!0,v.focus({preventScroll:!0}),l=!1)}function c(s){if(m()&&n.active){const i=t.value,y=o.value;if(i!==null&&y!==null){const x=w();if(x==null||x===y){l=!0,i.focus({preventScroll:!0}),l=!1;return}l=!0;const B=s==="first"?Oe(x):We(x);l=!1,B||(l=!0,i.focus({preventScroll:!0}),l=!1)}}}function p(s){if(l)return;const i=w();i!==null&&(s.relatedTarget!==null&&i.contains(s.relatedTarget)?c("last"):c("first"))}function h(s){l||(s.relatedTarget!==null&&s.relatedTarget===t.value?c("last"):c("first"))}return{focusableStartRef:t,focusableEndRef:o,focusableStyle:"position: absolute; height: 0; width: 0;",handleStartFocus:p,handleEndFocus:h}},render(){const{default:n}=this.$slots;if(n===void 0)return null;if(this.disabled)return n();const{active:e,focusableStyle:t}=this;return A(Se,null,[A("div",{"aria-hidden":"true",tabindex:e?"0":"-1",ref:"focusableStartRef",style:t,onFocus:this.handleStartFocus}),n(),A("div",{"aria-hidden":"true",style:t,ref:"focusableEndRef",tabindex:e?"0":"-1",onFocus:this.handleEndFocus})])}});export{At as F,et as L,xe as V,Tt as a,St as b,Mt as c,$t as d,Et as e,zt as f,ye as r};