Files
prod/frontend/dist/assets/Follower-BDY1V0Th.js
2026-10-27 22:40:37 +07:00

1 line
11 KiB
JavaScript

import{Bt as e,Cn as t,It as n,Kt as r,Mt as i,Pt as a,Ut as o,X as s,Xt as c,Y as l,an as u,dt as d,jt as f,ln as p,yn as m}from"./client-Be0b5AZU.js";import{c as h,s as g}from"./Scrollbar-LRArvNxj.js";import{C as _,_ as v,f as y,g as b,h as x,p as S,v as C,x as w}from"./Suffix-LrhQ5FSC.js";import{at as T,it as E}from"./index-DpxjEbFc.js";var D=[],O=new WeakMap;function k(){D.forEach(e=>e(...O.get(e))),D=[]}function A(e,...t){O.set(e,t),!D.includes(e)&&D.push(e)===1&&requestAnimationFrame(k)}var j=_?document?.fonts?.ready:void 0,M=!1;j===void 0?M=!0:j.then(()=>{M=!0});function N(e){if(M)return;let t=!1;r(()=>{M||j?.then(()=>{t||e()})}),o(()=>{t=!0})}var P=s(`n-internal-select-menu`),F=s(`n-internal-select-menu-body`),I=`__disabled__`;function L(e){let t=n(C,null),i=n(w,null),a=n(v,null),s=n(F,null),c=m();if(typeof document<`u`){c.value=document.fullscreenElement;let e=()=>{c.value=document.fullscreenElement};r(()=>{h(`fullscreenchange`,document,e)}),o(()=>{g(`fullscreenchange`,document,e)})}return T(()=>{let{to:n}=e;return n===void 0?t?.value?t.value.$el??t.value:i?.value?i.value:a?.value?a.value:s?.value?s.value:n??(c.value||`body`):n===!1?I:n===!0?c.value||`body`:n})}L.tdkey=I,L.propTo={type:[String,Object,Boolean],default:void 0};var R=null;function z(){if(R===null&&(R=document.getElementById(`v-binder-view-measurer`),R===null)){R=document.createElement(`div`),R.id=`v-binder-view-measurer`;let{style:e}=R;e.position=`fixed`,e.left=`0`,e.right=`0`,e.top=`0`,e.bottom=`0`,e.pointerEvents=`none`,e.visibility=`hidden`,document.body.appendChild(R)}return R.getBoundingClientRect()}function B(e,t){let n=z();return{top:t,left:e,height:0,width:0,right:n.width-e,bottom:n.height-t}}function V(e){let t=e.getBoundingClientRect(),n=z();return{left:t.left-n.left,top:t.top-n.top,bottom:n.height+n.top-t.bottom,right:n.width+n.left-t.right,width:t.width,height:t.height}}function H(e){return e.nodeType===9?null:e.parentNode}function U(e){if(e===null)return null;let t=H(e);if(t===null)return null;if(t.nodeType===9)return document;if(t.nodeType===1){let{overflow:e,overflowX:n,overflowY:r}=getComputedStyle(t);if(/(auto|scroll|overlay)/.test(e+r+n))return t}return U(t)}var W=f({name:`Binder`,props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(e){c(`VBinder`,i()?.proxy);let t=n(`VBinder`,null),r=m(null),a=n=>{r.value=n,t&&e.syncTargetWithParent&&t.setTargetRef(n)},s=[],l=()=>{let e=r.value;for(;e=U(e),e!==null;)s.push(e);for(let e of s)h(`scroll`,e,_,!0)},u=()=>{for(let e of s)g(`scroll`,e,_,!0);s=[]},d=new Set,f=e=>{d.size===0&&l(),d.has(e)||d.add(e)},p=e=>{d.has(e)&&d.delete(e),d.size===0&&u()},_=()=>{A(v)},v=()=>{d.forEach(e=>e())},y=new Set,b=e=>{y.size===0&&h(`resize`,window,S),y.has(e)||y.add(e)},x=e=>{y.has(e)&&y.delete(e),y.size===0&&g(`resize`,window,S)},S=()=>{y.forEach(e=>e())};return o(()=>{g(`resize`,window,S),u()}),{targetRef:r,setTargetRef:a,addScrollListener:f,removeScrollListener:p,addResizeListener:b,removeResizeListener:x}},render(){return b(`binder`,this.$slots)}}),G=f({name:`Target`,setup(){let{setTargetRef:e,syncTarget:t}=n(`VBinder`);return{syncTarget:t,setTargetDirective:{mounted:e,updated:e}}},render(){let{syncTarget:e,setTargetDirective:t}=this;return e?p(x(`follower`,this.$slots),[[t]]):x(`follower`,this.$slots)}}),{c:K}=d(),q=`vueuc-style`,J={top:`bottom`,bottom:`top`,left:`right`,right:`left`},Y={start:`end`,center:`center`,end:`start`},X={top:`height`,bottom:`height`,left:`width`,right:`width`},Z={"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`},ee={"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`},te={"bottom-start":`right`,"bottom-end":`left`,"top-start":`right`,"top-end":`left`,"right-start":`bottom`,"right-end":`top`,"left-start":`bottom`,"left-end":`top`},Q={top:!0,bottom:!1,left:!0,right:!1},$={top:`end`,bottom:`start`,left:`end`,right:`start`};function ne(e,t,n,r,i,a){if(!i||a)return{placement:e,top:0,left:0};let[o,s]=e.split(`-`),c=s??`center`,l={top:0,left:0},u=(e,i,a)=>{let o=0,s=0,c=n[e]-t[i]-t[e];return c>0&&r&&(a?s=Q[i]?c:-c:o=Q[i]?c:-c),{left:o,top:s}},d=o===`left`||o===`right`;if(c!==`center`){let r=te[e],i=J[r],a=X[r];if(n[a]>t[a]){if(t[r]+t[a]<n[a]){let e=(n[a]-t[a])/2;t[r]<e||t[i]<e?t[r]<t[i]?(c=Y[s],l=u(a,i,d)):l=u(a,r,d):c=`center`}}else n[a]<t[a]&&t[i]<0&&t[r]>t[i]&&(c=Y[s])}else{let e=o===`bottom`||o===`top`?`left`:`top`,r=J[e],i=X[e],a=(n[i]-t[i])/2;(t[e]<a||t[r]<a)&&(t[e]>t[r]?(c=$[e],l=u(i,e,d)):(c=$[r],l=u(i,r,d)))}let f=o;return t[o]<n[X[o]]&&t[o]<t[J[o]]&&(f=J[o]),{placement:c===`center`?f:`${f}-${c}`,left:l.left,top:l.top}}function re(e,t){return t?ee[e]:Z[e]}function ie(e,t,n,r,i,a){if(a)switch(e){case`bottom-start`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left)}px`,transform:`translateY(-100%)`};case`bottom-end`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%) translateY(-100%)`};case`top-start`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left)}px`,transform:``};case`top-end`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%)`};case`right-start`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%)`};case`right-end`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%) translateY(-100%)`};case`left-start`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left)}px`,transform:``};case`left-end`:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left)}px`,transform:`translateY(-100%)`};case`top`:return{top:`${Math.round(n.top-t.top)}px`,left:`${Math.round(n.left-t.left+n.width/2)}px`,transform:`translateX(-50%)`};case`right`:return{top:`${Math.round(n.top-t.top+n.height/2)}px`,left:`${Math.round(n.left-t.left+n.width)}px`,transform:`translateX(-100%) translateY(-50%)`};case`left`:return{top:`${Math.round(n.top-t.top+n.height/2)}px`,left:`${Math.round(n.left-t.left)}px`,transform:`translateY(-50%)`};default:return{top:`${Math.round(n.top-t.top+n.height)}px`,left:`${Math.round(n.left-t.left+n.width/2)}px`,transform:`translateX(-50%) translateY(-100%)`}}switch(e){case`bottom-start`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:``};case`bottom-end`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateX(-100%)`};case`top-start`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateY(-100%)`};case`top-end`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateX(-100%) translateY(-100%)`};case`right-start`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:``};case`right-end`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateY(-100%)`};case`left-start`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateX(-100%)`};case`left-end`:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateX(-100%) translateY(-100%)`};case`top`:return{top:`${Math.round(n.top-t.top+r)}px`,left:`${Math.round(n.left-t.left+n.width/2+i)}px`,transform:`translateY(-100%) translateX(-50%)`};case`right`:return{top:`${Math.round(n.top-t.top+n.height/2+r)}px`,left:`${Math.round(n.left-t.left+n.width+i)}px`,transform:`translateY(-50%)`};case`left`:return{top:`${Math.round(n.top-t.top+n.height/2+r)}px`,left:`${Math.round(n.left-t.left+i)}px`,transform:`translateY(-50%) translateX(-100%)`};default:return{top:`${Math.round(n.top-t.top+n.height+r)}px`,left:`${Math.round(n.left-t.left+n.width/2+i)}px`,transform:`translateX(-50%)`}}}var ae=K([K(`.v-binder-follower-container`,{position:`absolute`,left:`0`,right:`0`,top:`0`,height:`0`,pointerEvents:`none`,zIndex:`auto`}),K(`.v-binder-follower-content`,{position:`absolute`,zIndex:`auto`},[K(`> *`,{pointerEvents:`all`})])]),oe=f({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(i){let a=n(`VBinder`),s=T(()=>i.enabled===void 0?i.show:i.enabled),c=m(null),d=m(null),f=()=>{let{syncTrigger:e}=i;e.includes(`scroll`)&&a.addScrollListener(g),e.includes(`resize`)&&a.addResizeListener(g)},p=()=>{a.removeScrollListener(g),a.removeResizeListener(g)};r(()=>{s.value&&(g(),f())});let h=l();ae.mount({id:`vueuc/binder`,head:!0,anchorMetaName:q,ssr:h}),o(()=>{p()}),N(()=>{s.value&&g()});let g=()=>{if(!s.value)return;let e=c.value;if(e===null)return;let t=a.targetRef,{x:n,y:r,overlap:o}=i,l=n!==void 0&&r!==void 0?B(n,r):V(t);e.style.setProperty(`--v-target-width`,`${Math.round(l.width)}px`),e.style.setProperty(`--v-target-height`,`${Math.round(l.height)}px`);let{width:u,minWidth:f,placement:p,internalShift:m,flip:h}=i;e.setAttribute(`v-placement`,p),o?e.setAttribute(`v-overlap`,``):e.removeAttribute(`v-overlap`);let{style:g}=e;u===`target`?g.width=`${l.width}px`:u===void 0?g.width=``:g.width=u,f===`target`?g.minWidth=`${l.width}px`:f===void 0?g.minWidth=``:g.minWidth=f;let _=V(e),v=V(d.value),{left:y,top:b,placement:x}=ne(p,l,_,m,h,o),S=re(x,o),{left:C,top:w,transform:T}=ie(x,v,l,b,y,o);e.setAttribute(`v-placement`,x),e.style.setProperty(`--v-offset-left`,`${Math.round(y)}px`),e.style.setProperty(`--v-offset-top`,`${Math.round(b)}px`),e.style.transform=`translateX(${C}) translateY(${w}) ${T}`,e.style.setProperty(`--v-transform-origin`,S),e.style.transformOrigin=S};u(s,e=>{e?(f(),_()):p()});let _=()=>{e().then(g).catch(e=>console.error(e))};[`placement`,`x`,`y`,`internalShift`,`flip`,`width`,`overlap`,`minWidth`].forEach(e=>{u(t(i,e),g)}),[`teleportDisabled`].forEach(e=>{u(t(i,e),_)}),u(t(i,`syncTrigger`),e=>{e.includes(`resize`)?a.addResizeListener(g):a.removeResizeListener(g),e.includes(`scroll`)?a.addScrollListener(g):a.removeScrollListener(g)});let v=E();return{VBinder:a,mergedEnabled:s,offsetContainerRef:d,followerRef:c,mergedTo:T(()=>{let{to:e}=i;if(e!==void 0)return e;v.value}),syncPosition:g}},render(){return a(y,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var e;let t=a(`div`,{class:[`v-binder-follower-container`,this.containerClass],ref:`offsetContainerRef`},[a(`div`,{class:`v-binder-follower-content`,ref:`followerRef`},(e=this.$slots).default?.call(e))]);return this.zindexable?p(t,[[S,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):t}})}});export{W as a,P as c,G as i,N as l,K as n,L as o,q as r,F as s,oe as t,A as u};