import{D as e,Ht as t,Ut as n,ct as r,g as i,it as a,k as o,pt as s,tt as c,xn as l}from"./runtime-core.esm-bundler-DkysjgTd.js";import{r as u}from"./en_US-Cv9hrLhb.js";import{A as d,G as f,M as p,k as m}from"./useConfigInject-z_xeO0pP.js";import{t as h}from"./raf-CR9Bw2Uc.js";import{t as g}from"./vue-types-CFReUAWV.js";import{t as _}from"./Portal-jWUJieln.js";var v=!1;try{let e=Object.defineProperty({},"passive",{get(){v=!0}});window.addEventListener(`testPassive`,null,e),window.removeEventListener(`testPassive`,null,e)}catch(e){}var y=v;function b(e,t,n,r){if(e&&e.addEventListener){let i=r;i===void 0&&y&&(t===`touchstart`||t===`touchmove`||t===`wheel`)&&(i={passive:!1}),e.addEventListener(t,n,i)}return{remove:()=>{e&&e.removeEventListener&&e.removeEventListener(t,n)}}}var x;function S(e){if(typeof document>`u`)return 0;if(e||x===void 0){let e=document.createElement(`div`);e.style.width=`100%`,e.style.height=`200px`;let t=document.createElement(`div`),n=t.style;n.position=`absolute`,n.top=`0`,n.left=`0`,n.pointerEvents=`none`,n.visibility=`hidden`,n.width=`200px`,n.height=`150px`,n.overflow=`hidden`,t.appendChild(e),document.body.appendChild(t);let r=e.offsetWidth;t.style.overflow=`scroll`;let i=e.offsetWidth;r===i&&(i=t.clientWidth),document.body.removeChild(t),x=r-i}return x}function C(e){let t=e.match(/^(.*)px$/),n=Number(t==null?void 0:t[1]);return Number.isNaN(n)?S():n}function w(e){if(typeof document>`u`||!e||!(e instanceof Element))return{width:0,height:0};let{width:t,height:n}=getComputedStyle(e,`::-webkit-scrollbar`);return{width:C(t),height:C(n)}}var T=`vc-util-locker-${Date.now()}`,E=0;function D(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}function O(e){let t=i(()=>!!e&&!!e.value);E+=1;let r=`${T}_${E}`;n(e=>{if(p()){if(t.value){let e=S(),t=D();d(` html body { overflow-y: hidden; ${t?`width: calc(100% - ${e}px);`:``} }`,r)}else m(r);e(()=>{m(r)})}},{flush:`post`})}var k=0,A=p(),j=e=>{if(!A)return null;if(e){if(typeof e==`string`)return document.querySelectorAll(e)[0];if(typeof e==`function`)return e();if(typeof e==`object`&&e instanceof window.HTMLElement)return e}return document.body},M=o({compatConfig:{MODE:3},name:`PortalWrapper`,inheritAttrs:!1,props:{wrapperClassName:String,forceRender:{type:Boolean,default:void 0},getContainer:g.any,visible:{type:Boolean,default:void 0},autoLock:f(),didUpdate:Function},setup(n,o){let{slots:u}=o,d=l(),f=l(),m=l(),g=l(1),v=p()&&document.createElement(`div`),y=()=>{var e,t;d.value===v&&((t=(e=d.value)==null?void 0:e.parentNode)==null||t.removeChild(d.value)),d.value=null},b=null,x=function(){return arguments.length>0&&arguments[0]!==void 0&&arguments[0]||d.value&&!d.value.parentNode?(b=j(n.getContainer),b?(b.appendChild(d.value),!0):!1):!0},S=()=>A?(d.value||(d.value=v,x(!0)),C(),d.value):null,C=()=>{let{wrapperClassName:e}=n;d.value&&e&&e!==d.value.className&&(d.value.className=e)};return s(()=>{C(),x()}),O(i(()=>n.autoLock&&n.visible&&p()&&(d.value===document.body||d.value===v))),r(()=>{let e=!1;t([()=>n.visible,()=>n.getContainer],(t,r)=>{let[i,a]=t,[o,s]=r;A&&(b=j(n.getContainer),b===document.body&&(i&&!o?k+=1:e&&--k)),e&&(typeof a==`function`&&typeof s==`function`?a.toString()!==s.toString():a!==s)&&y(),e=!0},{immediate:!0,flush:`post`}),c(()=>{x()||(m.value=h(()=>{g.value+=1}))})}),a(()=>{let{visible:e}=n;A&&b===document.body&&(k=e&&k?k-1:k),y(),h.cancel(m.value)}),()=>{let{forceRender:t,visible:r}=n,i=null,a={getOpenCount:()=>k,getContainer:S};return g.value&&(t||r||f.value)&&(i=e(_,{getContainer:S,ref:f,didUpdate:n.didUpdate},{default:()=>{var e;return(e=u.default)==null?void 0:e.call(u,a)}})),i}}}),N=e=>({animationDuration:e,animationFillMode:`both`}),P=e=>({animationDuration:e,animationFillMode:`both`}),F=function(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0&&arguments[4]?`&`:``;return{[` ${i}${e}-enter, ${i}${e}-appear `]:u(u({},N(r)),{animationPlayState:`paused`}),[`${i}${e}-leave`]:u(u({},P(r)),{animationPlayState:`paused`}),[` ${i}${e}-enter${e}-enter-active, ${i}${e}-appear${e}-appear-active `]:{animationName:t,animationPlayState:`running`},[`${i}${e}-leave${e}-leave-active`]:{animationName:n,animationPlayState:`running`,pointerEvents:`none`}}};export{b as a,w as i,M as n,y as o,S as r,F as t};