import{C as e,Ct as t,E as n,Mt as r,Qt as i,W as a,Y as o,_ as s,c,dt as l,en as u,g as d,h as f,m as p,tn as m,v as h,w as g}from"./vendor/json-editor-vue-ddj4xtqm.js";import"./vendor/shiki-kunkft64.js";import{It as _,N as v,ct as y}from"#entry";import{t as b}from"./composables-g8w9dpc0.js";import{t as x}from"./help-fab-bhtk9hzf.js";import"./nicon-title-hrj2h1mn.js";import{t as S}from"./nsection-block-kp1wt3o4.js";import{t as C}from"./color-k274hmrf.js";import{t as w}from"./duration-display-dhj2ifr1.js";var T={"w-full":``},E={border:`b base`},D={"select-none":``,"ws-nowrap":``,p1:``,"text-right":``,"font-bold":``},O={colspan:`2`,p1:``,pl5:``,"text-left":``,"font-bold":``},k={"ws-nowrap":``,p1:``,"text-center":``,"font-bold":``},A={"ws-nowrap":``,p1:``,"text-center":``,"font-bold":``},j={"ws-nowrap":``,p1:``,"text-right":``,"font-bold":``},M={"w-0":``,"ws-nowrap":``,"text-center":``,"text-sm":``,op25:``},N={"text-sm":``},P={"ws-nowrap":``},F={"text-sm":``},I={"w-0":``,"text-center":``,"text-sm":``},L={"w-0":``,"text-center":``,"text-sm":``},R={"w-0":``,"text-right":``,"text-sm":``},z=n({__name:`HooksTable`,props:{hooks:{}},setup(n){let s=n,l=t(`duration`),d=t(`asc`),_={duration:(e,t)=>(t.duration??1/0)-(e.duration??1/0),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},v=p(()=>s.hooks.map(e=>e.start).sort((e,t)=>e-t)),y=p(()=>{let e=_[l.value],t=[...s.hooks].sort(e);return d.value===`desc`&&t.reverse(),t});function b(e){let t=e.split(`:`);return t.length===1?``:`${t[0]}:`}function x(e){let t=e.split(`:`);return t.length===1?e:t.slice(1).join(`:`)}function S(e){l.value===e?d.value=d.value===`asc`?`desc`:`asc`:l.value=e}return(t,n)=>{let s=w;return a(),h(`table`,T,[f(`thead`,E,[f(`tr`,null,[f(`th`,D,[f(`button`,{onClick:n[0]||=e=>S(`start`)},[n[5]||=e(` Order `,-1),f(`div`,{"ml--1":``,"text-xs":``,class:i([l.value===`start`?`op50`:`op0`,d.value===`asc`?`carbon-arrow-down`:`carbon-arrow-up`])},null,2)])]),f(`th`,O,[f(`button`,{onClick:n[1]||=e=>S(`name`)},[n[6]||=e(` Hook name `,-1),f(`div`,{"ml--1":``,"text-xs":``,class:i([l.value===`name`?`op50`:`op0`,d.value===`asc`?`carbon-arrow-down`:`carbon-arrow-up`])},null,2)])]),f(`th`,k,[f(`button`,{onClick:n[2]||=e=>S(`listener`)},[n[7]||=e(` Listeners `,-1),f(`div`,{"ml--1":``,"text-xs":``,class:i([l.value===`listener`?`op50`:`op0`,d.value===`asc`?`carbon-arrow-down`:`carbon-arrow-up`])},null,2)])]),f(`th`,A,[f(`button`,{onClick:n[3]||=e=>S(`executions`)},[n[8]||=e(` Executions `,-1),f(`div`,{"ml--1":``,"text-xs":``,class:i([l.value===`executions`?`op50`:`op0`,d.value===`asc`?`carbon-arrow-down`:`carbon-arrow-up`])},null,2)])]),f(`th`,j,[f(`button`,{onClick:n[4]||=e=>S(`duration`)},[n[9]||=e(` Duration `,-1),f(`div`,{"ml--1":``,"text-xs":``,class:i([l.value===`duration`?`op50`:`op0`,d.value===`asc`?`carbon-arrow-down`:`carbon-arrow-up`])},null,2)])])])]),f(`tbody`,null,[(a(!0),h(c,null,o(y.value,e=>(a(),h(`tr`,{key:e.name,border:`b dashed transparent hover:base`},[f(`td`,M,m(v.value.indexOf(e.start)),1),f(`td`,{"w-0":``,"ws-nowrap":``,"text-right":``,style:u({color:(`getHslColorFromStringHash`in t?t.getHslColorFromStringHash:r(C))(b(e.name))})},[f(`code`,N,m(b(e.name)),1)],4),f(`td`,P,[f(`code`,F,m(x(e.name)),1)]),f(`td`,I,m(e.listeners),1),f(`td`,L,m(e.executions.length+1),1),f(`td`,R,[g(s,{duration:e.duration},null,8,[`duration`])])]))),128))])])}}}),B=Object.assign(z,{__name:`HooksTable`}),V={},H={class:`markdown-body`};function U(t,n){return a(),h(`div`,H,[...n[0]||=[f(`template`,null,[f(`div`,{class:`markdown-body`},[f(`h1`,null,`Hooks`),f(`p`,null,[e(`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 `),f(`a`,{href:`https://github.com/unjs/hookable`,target:`_blank`,rel:`noopener`},`unjs/hookable`),e(`.`)]),f(`p`,null,[f(`a`,{href:`https://nuxt.com/docs/guide/going-further/hooks`,target:`_blank`,rel:`noopener`},`Learn more about hooks`),e(`.`)])])],-1)]])}var W=v(V,[[`render`,U]]),G=n({__name:`hooks`,setup(e){let t=y(),n=_(),i=p(()=>n.value?.metrics.clientHooks());return(e,n)=>{let o=B,u=S,p=W,m=x;return a(),h(c,null,[f(`div`,null,[i.value?.length?(a(),d(u,{key:0,icon:`carbon-ibm-cloud-direct-link-1-dedicated-hosting`,text:`Client Hooks`,description:`Total hooks: ${i.value.length}`,padding:`pl4 pr6`},{default:l(()=>[g(o,{hooks:i.value},null,8,[`hooks`])]),_:1},8,[`description`])):s(``,!0),r(t)?.length?(a(),d(u,{key:1,icon:`carbon-ibm-cloud-direct-link-2-dedicated`,text:`Server Hooks`,description:`Total hooks: ${r(t)?.length}`,padding:`pl4 pr6`},{default:l(()=>[g(o,{hooks:r(t)},null,8,[`hooks`])]),_:1},8,[`description`])):s(``,!0)]),g(m,null,{default:l(()=>[g(p)]),_:1})],64)}}});export{G as default};