import{_ as S}from"./duration-display.vue-h9fie5qa.js";import{a6 as T,a7 as F,Q as B}from"./er2hcepb.js";import{k as $,b as H,l as w,Q as u,S as h,U as o,a6 as l,Y as p,F as y,ab as V,a5 as m,X as D,u as k,a0 as _,M as C,$ as f,W as N}from"./vendor/json-editor-vue-gv8v06ez.js";import{_ as P}from"./nsection-block-f8z83agf.js";import{_ as E}from"./help-fab.vue-d5mgp1hs.js";import"./vendor/unocss-f0kk6o39.js";import"./vendor/shiki-ml6g43ls.js";import"./nicon-title.vue-lmnsr02i.js";const O={"w-full":""},j={border:"b base"},L={"select-none":"","ws-nowrap":"",p1:"","text-right":"","font-bold":""},Y={colspan:"2",p1:"",pl5:"","text-left":"","font-bold":""},z={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},A={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},Q={"ws-nowrap":"",p1:"","text-right":"","font-bold":""},U={"w-0":"","ws-nowrap":"","text-center":"","text-sm":"",op25:""},M={"text-sm":""},R={"ws-nowrap":""},W={"text-sm":""},X={"w-0":"","text-center":"","text-sm":""},q={"w-0":"","text-center":"","text-sm":""},G={"w-0":"","text-right":"","text-sm":""},J=$({__name:"HooksTable",props:{hooks:{}},setup(x){const a=x,r=H("duration"),n=H("asc"),d={duration:(e,t)=>(t.duration??Number.POSITIVE_INFINITY)-(e.duration??Number.POSITIVE_INFINITY),name:(e,t)=>e.name.localeCompare(t.name),listener:(e,t)=>t.listeners-e.listeners,start:(e,t)=>t.start-e.start,executions:(e,t)=>t.executions.length-e.executions.length},g=w(()=>a.hooks.map(e=>e.start).sort((e,t)=>e-t)),b=w(()=>{const e=d[r.value],t=[...a.hooks].sort(e);return n.value==="desc"&&t.reverse(),t});function c(e){const t=e.split(":");return t.length===1?"":`${t[0]}:`}function v(e){const t=e.split(":");return t.length===1?e:t.slice(1).join(":")}function i(e){r.value===e?n.value=n.value==="asc"?"desc":"asc":r.value=e}return(e,t)=>{const I=S;return u(),h("table",O,[o("thead",j,[o("tr",null,[o("th",L,[o("button",{onClick:t[0]||(t[0]=s=>i("start"))},[t[5]||(t[5]=l(" Order ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="start"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",Y,[o("button",{onClick:t[1]||(t[1]=s=>i("name"))},[t[6]||(t[6]=l(" Hook name ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="name"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",z,[o("button",{onClick:t[2]||(t[2]=s=>i("listener"))},[t[7]||(t[7]=l(" Listeners ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="listener"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",A,[o("button",{onClick:t[3]||(t[3]=s=>i("executions"))},[t[8]||(t[8]=l(" Executions ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="executions"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",Q,[o("button",{onClick:t[4]||(t[4]=s=>i("duration"))},[t[9]||(t[9]=l(" Duration ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="duration"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])])])]),o("tbody",null,[(u(!0),h(y,null,V(b.value,s=>(u(),h("tr",{key:s.name,border:"b dashed transparent hover:base"},[o("td",U,m(g.value.indexOf(s.start)),1),o("td",{"w-0":"","ws-nowrap":"","text-right":"",style:D({color:("getHashColorFromString"in e?e.getHashColorFromString:k(T))(c(s.name))})},[o("code",M,m(c(s.name)),1)],4),o("td",R,[o("code",W,m(v(s.name)),1)]),o("td",X,m(s.listeners),1),o("td",q,m(s.executions.length+1),1),o("td",G,[_(I,{duration:s.duration},null,8,["duration"])])]))),128))])])}}}),K={class:"markdown-body"},Z={__name:"hooks",setup(x,{expose:a}){return a({frontmatter:{}}),(n,d)=>(u(),h("div",K,d[0]||(d[0]=[o("h1",null,"Hooks",-1),o("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 "),o("a",{href:"https://github.com/unjs/hookable",target:"_blank",rel:"noopener"},"unjs/hookable"),l(".")],-1),o("p",null,[o("a",{href:"https://nuxt.com/docs/guide/going-further/hooks",target:"_blank",rel:"noopener"},"Learn more about hooks"),l(".")],-1)])))}},it=$({__name:"hooks",setup(x){const a=F(),r=B(),n=w(()=>r.value?.metrics.clientHooks());return(d,g)=>{const b=J,c=P,v=Z,i=E;return u(),h(y,null,[o("div",null,[n.value?.length?(u(),C(c,{key:0,icon:"carbon-ibm-cloud-direct-link-1-dedicated-hosting",text:"Client Hooks",description:`Total hooks: ${n.value.length}`,padding:"pl4 pr6"},{default:f(()=>[_(b,{hooks:n.value},null,8,["hooks"])]),_:1},8,["description"])):N("",!0),k(a)?.length?(u(),C(c,{key:1,icon:"carbon-ibm-cloud-direct-link-2-dedicated",text:"Server Hooks",description:`Total hooks: ${k(a)?.length}`,padding:"pl4 pr6"},{default:f(()=>[_(b,{hooks:k(a)},null,8,["hooks"])]),_:1},8,["description"])):N("",!0)]),_(i,null,{default:f(()=>[_(v)]),_:1})],64)}}});export{it as default};
