import{a7 as K,bm as A,bn as O,bo as x,aZ as c,b9 as _,q as j,bp as k,bq as S,p as T,aS as N,br as I,bs as m,bt as R,bu as L,bv as q,bw as w,bx as B,aR as C,F,at as E,by as V,bz as z}from"./dgiRuePs.js";const Z=K({props:{vnode:{type:Object,required:!0},route:{type:Object,required:!0},vnodeRef:Object,renderKey:String,trackRootNodes:Boolean},setup(e){const o=e.renderKey,a=e.route,r={};for(const n in e.route)Object.defineProperty(r,n,{get:()=>o===e.renderKey?e.route[n]:a[n],enumerable:!0});return A(x,O(r)),()=>c(e.vnode,{ref:e.vnodeRef})}}),Q=K({name:"NuxtPage",inheritAttrs:!1,props:{name:{type:String},transition:{type:[Boolean,Object],default:void 0},keepalive:{type:[Boolean,Object],default:void 0},route:{type:Object},pageKey:{type:[Function,String],default:null}},setup(e,{attrs:o,slots:a,expose:r}){const n=_(),i=j(),d=k(x,null);let l;r({pageRef:i});const s=k(S,null);let u;const g=n.deferHydration();if(n.isHydrating){const t=n.hooks.hookOnce("app:error",g);T().beforeEach(t)}return e.pageKey&&N(()=>e.pageKey,(t,v)=>{t!==v&&n.callHook("page:loading:start")}),()=>c(I,{name:e.name,route:e.route,...o},{default:t=>{const v=G(d,t.route,t.Component),b=d&&d.matched.length===t.route.matched.length;if(!t.Component){if(u&&!b)return u;g();return}if(u&&s&&!s.isCurrent(t.route))return u;if(v&&d&&(!s||s!=null&&s.isCurrent(d)))return b?u:null;const f=m(t,e.pageKey);!n.isHydrating&&!J(d,t.route,t.Component)&&l===f&&n.callHook("page:loading:end"),l=f;const y=!!(e.transition??t.route.meta.pageTransition??R),H=y&&D([e.transition,t.route.meta.pageTransition,R,{onAfterLeave:()=>{n.callHook("page:transition:finish",t.Component)}}].filter(Boolean)),h=e.keepalive??t.route.meta.keepalive??L;return u=q(E,y&&H,w(h,c(B,{suspensible:!0,onPending:()=>n.callHook("page:start",t.Component),onResolve:()=>{C(()=>n.callHook("page:finish",t.Component).then(()=>n.callHook("page:loading:end")).finally(g))}},{default:()=>{const p=c(Z,{key:f||void 0,vnode:a.default?c(F,void 0,a.default(t)):t.Component,route:t.route,renderKey:f||void 0,trackRootNodes:y,vnodeRef:i});return h&&(p.type.name=t.Component.type.name||t.Component.type.__name||"RouteProvider"),p}}))).default(),u}})}});function D(e){const o=e.map(a=>({...a,onAfterLeave:a.onAfterLeave?V(a.onAfterLeave):void 0}));return z(...o)}function G(e,o,a){if(!e)return!1;const r=o.matched.findIndex(n=>{var i;return((i=n.components)==null?void 0:i.default)===(a==null?void 0:a.type)});return!r||r===-1?!1:o.matched.slice(0,r).some((n,i)=>{var d,l,s;return((d=n.components)==null?void 0:d.default)!==((s=(l=e.matched[i])==null?void 0:l.components)==null?void 0:s.default)})||a&&m({route:o,Component:a})!==m({route:e,Component:a})}function J(e,o,a){return e?o.matched.findIndex(n=>{var i;return((i=n.components)==null?void 0:i.default)===(a==null?void 0:a.type)})<o.matched.length-1:!1}export{Q as _};
//# sourceMappingURL=B9o9UQpI.js.map