import{_ as S}from"./N39meiv8.js";import{d as N,r as $,a as g,o as d,m as h,k as t,v as l,G as p,f as n,F as y,n as T,t as _,a9 as F,aL as B,i as m,aM as V,am as D,h as H,j as w,p as C}from"./CAAfHP_R.js";import{_ as P}from"./DrETHS_h.js";import{_ as j}from"./C90a2Mbv.js";import"./SV1FZgNA.js";const E={"w-full":""},L={border:"b base"},O={"select-none":"","ws-nowrap":"",p1:"","text-right":"","font-bold":""},z={colspan:"2",p1:"",pl5:"","text-left":"","font-bold":""},A={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},Y={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},G={"ws-nowrap":"",p1:"","text-right":"","font-bold":""},M={"w-0":"","ws-nowrap":"","text-center":"","text-sm":"",op25:""},R={"text-sm":""},U={"ws-nowrap":""},q={"text-sm":""},J={"w-0":"","text-center":"","text-sm":""},K={"w-0":"","text-center":"","text-sm":""},Q={"w-0":"","text-right":"","text-sm":""},W=N({__name:"HooksTable",props:{hooks:{}},setup(x){const c=x,a=$("duration"),s=$("asc"),k={duration:(e,o)=>(o.duration??Number.POSITIVE_INFINITY)-(e.duration??Number.POSITIVE_INFINITY),name:(e,o)=>e.name.localeCompare(o.name),listener:(e,o)=>o.listeners-e.listeners,start:(e,o)=>o.start-e.start,executions:(e,o)=>o.executions.length-e.executions.length},v=g(()=>c.hooks.map(e=>e.start).sort((e,o)=>e-o)),b=g(()=>{const e=k[a.value],o=[...c.hooks].sort(e);return s.value==="desc"&&o.reverse(),o});function u(e){const o=e.split(":");return o.length===1?"":`${o[0]}:`}function f(e){const o=e.split(":");return o.length===1?e:o.slice(1).join(":")}function i(e){a.value===e?s.value=s.value==="asc"?"desc":"asc":a.value=e}return(e,o)=>{const I=S;return d(),h("table",E,[t("thead",L,[t("tr",null,[t("th",O,[t("button",{onClick:o[0]||(o[0]=r=>i("start"))},[l(" Order "),t("div",{"ml--1":"","text-xs":"",class:p([n(a)==="start"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),t("th",z,[t("button",{onClick:o[1]||(o[1]=r=>i("name"))},[l(" Hook name "),t("div",{"ml--1":"","text-xs":"",class:p([n(a)==="name"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),t("th",A,[t("button",{onClick:o[2]||(o[2]=r=>i("listener"))},[l(" Listeners "),t("div",{"ml--1":"","text-xs":"",class:p([n(a)==="listener"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),t("th",Y,[t("button",{onClick:o[3]||(o[3]=r=>i("executions"))},[l(" Executions "),t("div",{"ml--1":"","text-xs":"",class:p([n(a)==="executions"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),t("th",G,[t("button",{onClick:o[4]||(o[4]=r=>i("duration"))},[l(" Duration "),t("div",{"ml--1":"","text-xs":"",class:p([n(a)==="duration"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])])])]),t("tbody",null,[(d(!0),h(y,null,T(n(b),r=>(d(),h("tr",{key:r.name,border:"b dashed transparent hover:base"},[t("td",M,_(n(v).indexOf(r.start)),1),t("td",{"w-0":"","ws-nowrap":"","text-right":"",style:F({color:("getHashColorFromString"in e?e.getHashColorFromString:n(B))(u(r.name))})},[t("code",R,_(u(r.name)),1)],4),t("td",U,[t("code",q,_(f(r.name)),1)]),t("td",J,_(r.listeners),1),t("td",K,_(r.executions.length+1),1),t("td",Q,[m(I,{duration:r.duration},null,8,["duration"])])]))),128))])])}}}),X={class:"markdown-body"},Z=t("h1",null,"Hooks",-1),tt=t("p",null,[l("Hooks are an advanced API which can be used for module development or other advanced use cases. The hooking API can be used to expand almost every aspect of Nuxt. Under the hood it is powered by "),t("a",{href:"https://github.com/unjs/hookable",target:"_blank",rel:"noopener"},"unjs/hookable"),l(".")],-1),ot=t("p",null,[t("a",{href:"https://nuxt.com/docs/guide/going-further/hooks",target:"_blank",rel:"noopener"},"Learn more about hooks"),l(".")],-1),et=[Z,tt,ot],nt={__name:"hooks",setup(x,{expose:c}){return c({frontmatter:{}}),(s,k)=>(d(),h("div",X,et))}},st=nt,dt=N({__name:"hooks",setup(x){const c=V(),a=D(),s=g(()=>a.value?.metrics.clientHooks());return(k,v)=>{const b=W,u=P,f=st,i=j;return d(),h(y,null,[t("div",null,[n(s)?.length?(d(),H(u,{key:0,icon:"carbon-ibm-cloud-direct-link-1-dedicated-hosting",text:"Client Hooks",description:`Total hooks: ${n(s).length}`,padding:"pl4 pr6"},{default:w(()=>[m(b,{hooks:n(s)},null,8,["hooks"])]),_:1},8,["description"])):C("",!0),n(c)?.length?(d(),H(u,{key:1,icon:"carbon-ibm-cloud-direct-link-2-dedicated",text:"Server Hooks",description:`Total hooks: ${n(c)?.length}`,padding:"pl4 pr6"},{default:w(()=>[m(b,{hooks:n(c)},null,8,["hooks"])]),_:1},8,["description"])):C("",!0)]),m(i,null,{default:w(()=>[m(f)]),_:1})],64)}}});export{dt as default};
