1import{B as O,m as S,C as U,n as C}from"./DvzaZcYS.js";import{e as d,f as E,af as P,c as b,n as w,d as x,t as D,a8 as F,ag as L}from"./BvEF26Sq.js";function _(r,e){const o=d(r);function f(c){return e[o.value][c]??o.value}return{state:o,dispatch:c=>{o.value=f(c)}}}function R(r,e){var T;const o=d({}),f=d("none"),h=d(r),c=r.value?"mounted":"unmounted";let l;const i=((T=e.value)==null?void 0:T.ownerDocument.defaultView)??O,{state:m,dispatch:u}=_(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),s=t=>{var n;if(S){const p=new CustomEvent(t,{bubbles:!1,cancelable:!1});(n=e.value)==null||n.dispatchEvent(p)}};E(r,async(t,n)=>{var A;const p=n!==t;if(await w(),p){const M=f.value,v=y(e.value);t?(u("MOUNT"),s("enter"),v==="none"&&s("after-enter")):v==="none"||v==="undefined"||((A=o.value)==null?void 0:A.display)==="none"?(u("UNMOUNT"),s("leave"),s("after-leave")):n&&M!==v?(u("ANIMATION_OUT"),s("leave")):(u("UNMOUNT"),s("after-leave"))}},{immediate:!0});const a=t=>{const n=y(e.value),p=n.includes(t.animationName),A=m.value==="mounted"?"enter":"leave";if(t.target===e.value&&p&&(s(`after-${A}`),u("ANIMATION_END"),!h.value)){const M=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",l=i==null?void 0:i.setTimeout(()=>{var v;((v=e.value)==null?void 0:v.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=M)})}t.target===e.value&&n==="none"&&u("ANIMATION_END")},N=t=>{t.target===e.value&&(f.value=y(e.value))},g=E(e,(t,n)=>{t?(o.value=getComputedStyle(t),t.addEventListener("animationstart",N),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a)):(u("ANIMATION_END"),l!==void 0&&(i==null||i.clearTimeout(l)),n==null||n.removeEventListener("animationstart",N),n==null||n.removeEventListener("animationcancel",a),n==null||n.removeEventListener("animationend",a))},{immediate:!0}),I=E(m,()=>{const t=y(e.value);f.value=m.value==="mounted"?t:"none"});return P(()=>{g(),I()}),{isPresent:b(()=>["mounted","unmountSuspended"].includes(m.value))}}function y(r){return r&&getComputedStyle(r).animationName||"none"}const V=x({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(r,{slots:e,expose:o}){var u;const{present:f,forceMount:h}=D(r),c=d(),{isPresent:l}=R(f,c);o({present:l});let i=e.default({present:l.value});i=U(i||[]);const m=F();if(i&&(i==null?void 0:i.length)>1){const s=(u=m==null?void 0:m.parent)!=null&&u.type.name?`<${m.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${s}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(a=>` - ${a}`).join(` 2`)].join(` 3`))}return()=>h.value||f.value||l.value?L(e.default({present:l.value})[0],{ref:s=>{const a=C(s);return typeof(a==null?void 0:a.hasAttribute)>"u"||(a!=null&&a.hasAttribute("data-reka-popper-content-wrapper")?c.value=a.firstElementChild:c.value=a),a}}):null}});export{V as P};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.