import{o as e}from"./nuxt-l2zm4y7d.js";import{C as t,Ct as n,Mt as r,Qt as i,S as a,T as o,W as s,Y as c,_ as l,dt as u,ft as d,g as f,h as p,m,p as h,s as g,tn as _}from"./vendor/json-editor-vue-9tyg6b65.js";import{At as v,lt as y}from"./ready-e441jhq2.js";import{_ as b,g as x}from"./utils-ivfwadyv.js";import{A as S,h as C,k as w,l as T}from"./client-kfvz1zfh.js";import{t as E}from"./_plugin-vue_export-helper-d9irwgla.js";import{t as D}from"./nbutton-g8ropw1z.js";import{r as O}from"./state-routes-pcpgumo2.js";import{t as k}from"./telemetry-c1eueoux.js";import{t as A}from"./npanel-grids-es6yvxa6.js";import{t as j}from"./ntext-input-hwoiw74g.js";import{c as M,f as N,o as P,p as F,t as I,w as L}from"#entry";import{t as R}from"./ncode-block-cfw508sn.js";import{t as z}from"./pages-dm1j9w83.js";import{t as B}from"./ncheckbox-oir9zn2f.js";import{t as V}from"./filepath-item-evfn93g6.js";import{t as H}from"./help-fab-myoje00l.js";var U={"h-full":``,grid:`~ rows-[max-content_1fr]`},W={flex:`~ wrap`,"w-full":``},G=[`onClick`],K={key:0,flex:`~ col gap-4 items-center justify-center`,p4:``},q={grid:`~ cols-[30px_1fr] gap-x-2 gap-y-3 items-center justify-center`,"w-100":``},J=`/__nuxt_devtools__/client`,Y=Object.assign(o({__name:`BuildAnalyzeDetails`,props:{current:{},prev:{}},setup(o){let p=o,y=`${e().app.baseURL.replace(J,`/`)}/__nuxt_devtools__/analyze/`.replace(/\/+/g,`/`),b=h(()=>{let e=[{name:`Overview`,id:`overview`}];return p.current.features.bundleClient&&e.push({name:`Client Bundle`,id:`bundle-client`}),p.current.features.bundleNitro&&e.push({name:`Nitro Bundle`,id:`bundle-nitro`}),p.current.features.viteInspect&&e.push({name:`Vite Inspect`,id:`vite-inspect`}),e}),x=n(b.value[0]);function w(e){return`${((e.endTime-e.startTime)/1e3).toFixed(1)}s`}function E(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:e<1073741824?`${(e/1024/1024).toFixed(1)}MB`:`${(e/1024/1024/1024).toFixed(1)}GB`}async function O(e){return C.clearAnalyzeBuilds(await T(),[e])}return(e,n)=>{let p=V,h=D;return s(),l(`div`,U,[m(`div`,W,[(s(!0),l(g,null,c(b.value,(e,t)=>(s(),l(`button`,{key:t,px4:``,py2:``,border:`r base`,hover:`bg-active`,class:i(e.id===x.value?.id?``:`border-b`),onClick:t=>x.value=e},[m(`div`,{class:i(e.id===x.value?.id?``:`op30`)},_(e.name),3)],10,G))),128)),n[1]||=m(`div`,{border:`b base`,"flex-auto":``},null,-1)]),x.value?.id===`overview`?(s(),l(`div`,K,[n[15]||=m(`div`,{"flex-auto":``},null,-1),m(`div`,q,[n[10]||=m(`div`,{"i-carbon-commit":``,"text-xl":``},null,-1),m(`div`,null,[n[2]||=m(`div`,{"text-sm":``,op50:``},` Name `,-1),m(`div`,null,_(o.current.name),1)]),n[11]||=m(`div`,{"i-carbon-time":``,"text-xl":``},null,-1),m(`div`,null,[n[3]||=m(`div`,{"text-sm":``,op50:``},` Build duration `,-1),m(`div`,null,_(w(o.current)),1)]),o.current.size?.clientBundle?(s(),l(g,{key:0},[n[5]||=m(`div`,{"i-carbon-cics-program":``,"text-xl":``},null,-1),m(`div`,null,[n[4]||=m(`div`,{"text-sm":``,op50:``},` Client bundle size `,-1),m(`div`,null,_(E(o.current.size.clientBundle)),1)])],64)):f(``,!0),o.current.size?.nitroBundle?(s(),l(g,{key:1},[n[7]||=m(`div`,{"i-carbon-bare-metal-server":``,"text-xl":``},null,-1),m(`div`,null,[n[6]||=m(`div`,{"text-sm":``,op50:``},` Nitro bundle size `,-1),m(`div`,null,_(E(o.current.size.nitroBundle)),1)])],64)):f(``,!0),n[12]||=m(`div`,{"i-carbon-edge-node":``,"text-xl":``},null,-1),m(`div`,null,[n[8]||=m(`div`,{"text-sm":``,op50:``},` Built `,-1),m(`div`,null,_(r(S)(new Date(o.current.endTime))),1)]),n[13]||=m(`div`,{"i-carbon:folder-parent":``,"text-xl":``},null,-1),m(`div`,null,[n[9]||=m(`div`,{"text-sm":``,op50:``},` Report Path `,-1),t(p,{filepath:o.current.analyzeDir},null,8,[`filepath`])])]),n[16]||=m(`div`,{"flex-auto":``},null,-1),t(h,{n:`rose`,icon:`carbon-delete`,onClick:n[0]||=e=>O(o.current.name)},{default:u(()=>[...n[14]||=[a(` Delete this report `,-1)]]),_:1})])):f(``,!0),n._lazyshow1||x.value?.id===`bundle-client`?(n._lazyshow1=!0,s(),l(g,null,[d(m(`iframe`,{src:`${r(y)}${o.current.slug}/client.html`,"h-full":``,"w-full":``},null,8,[`src`]),[[v,x.value?.id===`bundle-client`]])],64)):f(`v-show-if`,!0),n._lazyshow2||x.value?.id===`bundle-nitro`?(n._lazyshow2=!0,s(),l(g,null,[d(m(`iframe`,{src:`${r(y)}${o.current.slug}/nitro.html`,"h-full":``,"w-full":``},null,8,[`src`]),[[v,x.value?.id===`bundle-nitro`]])],64)):f(`v-show-if`,!0),n._lazyshow3||x.value?.id===`vite-inspect`?(n._lazyshow3=!0,s(),l(g,null,[d(m(`iframe`,{src:`${r(y)}${o.current.slug}/.vite-inspect/`,"h-full":``,"w-full":``},null,8,[`src`]),[[v,x.value?.id===`vite-inspect`]])],64)):f(`v-show-if`,!0)])}}}),{__name:`BuildAnalyzeDetails`}),X={},Z={class:`markdown-body`};function Q(e,t){return s(),l(`div`,Z,[...t[0]||=[m(`template`,null,[m(`div`,{class:`markdown-body`},[m(`h1`,null,`Build Analyze`),m(`p`,null,[a(`DevTools provides a build analyze tool to help you understand the size of your app in production. Whenever you start a new build, it runs the command `),m(`code`,{"v-pre":``},`nuxt build --analyze`),a(` and present the output data directly in DevTools for easy browsing and comparing.`)])])],-1)]])}var $=E(X,[[`render`,Q]]),ee={flex:`~ col`},te=[`onClick`],ne={flex:`~ gap-1 items-center wrap`,"w-full":``,"text-sm":``,op60:``},re={flex:`~ items-center justify-center wrap`,p4:``},ie={flex:`~ col gap-1`,"w-250":``,p4:``},ae={flex:`~ gap-3`,mt2:``,"justify-end":``},oe=o({__name:`analyze-build`,setup(e){z({icon:`carbon-edge-node`,title:`Build Analyze`,layout:`full`,category:`analyze`,show(){return L(`^3.5.0`)}});let o=w(),d=b(),v=y(),E=x(`analyze-build:slug`,``),V=h(()=>d.value?.builds.find(e=>e.slug===E.value)??d.value?.builds[0]),U=n(!1),W=n(``),G=h(()=>d.value?.builds.some(e=>e.name===W.value.trim()));async function K(){W.value=await C.generateAnalyzeBuildName(),await o.start()&&(k(`analyze-build:start`),I.value={name:W.value,processId:await C.startAnalyzeBuild(await T(),W.value)},U.value&&X())}let q=O();function J(e){return`${((e.endTime-e.startTime)/1e3).toFixed(1)}s`}function X(){I.value?.processId&&(q.value=I.value.processId,v.push(`/modules/terminals`))}return P(()=>[{id:`action:analyze-build: start`,title:`Start a new analyze build`,icon:`i-carbon-edge-node`,action:K}]),(e,n)=>{let h=D,v=Y,y=A,b=M,x=j,C=F,w=R,T=B,O=N,k=$,P=H;return s(),l(g,null,[t(b,{"left-size":30},{left:u(()=>[m(`div`,ee,[(s(!0),l(g,null,c(r(d)?.builds,e=>(s(),l(g,{key:e.slug},[m(`button`,{flex:`~ col gap1`,p3:``,"hover:bg-active":``,class:i(e.slug===V.value?.slug?`text-primary bg-active`:``),onClick:t=>E.value=e.slug},[m(`code`,null,_(e.name),1),m(`div`,ne,[n[4]||=m(`div`,{"i-carbon-time":``},null,-1),m(`span`,null,_(J(e)),1),n[5]||=m(`div`,{"flex-auto":``},null,-1),m(`span`,null,_(r(S)(new Date(e.endTime))),1)])],10,te),n[6]||=m(`div`,{"x-divider":``},null,-1)],64))),128)),m(`div`,re,[r(I)?(s(),p(h,{key:1,n:`primary`,icon:`carbon-circle-dash animate-spin`,onClick:n[1]||=e=>X()},{default:u(()=>[...n[8]||=[a(` Building... `,-1)]]),_:1})):(s(),p(h,{key:0,n:`primary`,icon:`carbon-edge-node`,onClick:n[0]||=e=>K()},{default:u(()=>[...n[7]||=[a(` Start a new build `,-1)]]),_:1}))])])]),right:u(()=>[V.value?(s(),p(v,{key:0,current:V.value},null,8,[`current`])):(s(),p(y,{key:1}))]),_:1}),t(r(o),null,{default:u(({resolve:e})=>[t(O,{"model-value":!0,onClose:t=>e(!1)},{default:u(()=>[m(`div`,ie,[n[13]||=m(`h3`,{class:`text-lg font-medium leading-6`,mb2:``},` Start analyze build? `,-1),n[14]||=m(`p`,{op50:``},` Enter the name of the build: `,-1),t(x,{modelValue:W.value,"onUpdate:modelValue":n[2]||=e=>W.value=e,placeholder:`Build name`},null,8,[`modelValue`]),G.value?(s(),p(C,{key:0,"n-orange":``},{default:u(()=>[...n[9]||=[a(` A build with the same name already exists, continue would overrides the previous build result. `,-1)]]),_:1})):f(``,!0),n[15]||=m(`div`,{my3:``,"x-divider":``},null,-1),n[16]||=m(`p`,{op50:``},` The following command will be executed in your terminal: `,-1),t(w,{code:`npx nuxi analyze --no-serve --name=${W.value}`,lang:`bash`,px4:``,py2:``,border:`~ base rounded`,lines:!1},null,8,[`code`]),t(T,{modelValue:U.value,"onUpdate:modelValue":n[3]||=e=>U.value=e,mt2:``,n:`primary`},{default:u(()=>[...n[10]||=[a(` Navigate to terminal `,-1)]]),_:1},8,[`modelValue`]),m(`div`,ae,[t(h,{onClick:t=>e(!1)},{default:u(()=>[...n[11]||=[a(` Cancel `,-1)]]),_:1},8,[`onClick`]),t(h,{n:`solid primary`,onClick:t=>e(!0)},{default:u(()=>[...n[12]||=[a(` Start `,-1)]]),_:1},8,[`onClick`])])])]),_:2},1032,[`onClose`])]),_:1}),t(P,null,{default:u(()=>[t(k)]),_:1})],64)}}});export{oe as default};