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,ft 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-eojr4v24.js";import{A as _,_ as v}from"./ready-dadbdj5i.js";import{a as y}from"./nuxt-otp6bp04.js";import{_ as b,g as x}from"./utils-jupbrzo6.js";import{_ as S,l as C,v as w}from"./client-nwyjxodt.js";import{n as T}from"./dev-auth-he0eye7r.js";import"./vendor/shiki-lqo1hg2n.js";import"./storage-options-nzog3hhp.js";import"./nuxt-link-bumooa9d.js";import{t as E}from"./_plugin-vue_export-helper-n58akrbk.js";import"./nicon-m1crov2l.js";import{t as D}from"./nbutton-gygn07c2.js";import"./ncard-ludmyw2u.js";import{r as O}from"./state-routes-jownks2o.js";import{t as k}from"./telemetry-c77tnag3.js";import"./state-tabs-mtxv3h6t.js";import{t as A}from"./npanel-grids-onrho735.js";import{t as j}from"./ntext-input-e8iut2en.js";import{D as M,c as N,f as P,o as F,p as I,t as L}from"#entry";import"./client-im47u3kz.js";import{t as R}from"./ncode-block-figzf35k.js";import{t as z}from"./composables-b2ccklz4.js";import{t as B}from"./ncheckbox-ep01n5y1.js";import{t as V}from"./filepath-item-h3i1tz3s.js";import{t as H}from"./help-fab-oeo4c53s.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=n({__name:`BuildAnalyzeDetails`,props:{current:{},prev:{}},setup(n){let d=n,v=`${y().app.baseURL.replace(J,`/`)}/__nuxt_devtools__/analyze/`.replace(/\/+/g,`/`),b=p(()=>{let e=[{name:`Overview`,id:`overview`}];return d.current.features.bundleClient&&e.push({name:`Client Bundle`,id:`bundle-client`}),d.current.features.bundleNitro&&e.push({name:`Nitro Bundle`,id:`bundle-nitro`}),d.current.features.viteInspect&&e.push({name:`Vite Inspect`,id:`vite-inspect`}),e}),x=t(b.value[0]);function S(e){return`${((e.endTime-e.startTime)/1e3).toFixed(1)}s`}function E(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)}MB`:`${(e/1024/1024/1024).toFixed(1)}GB`}async function O(e){return C.clearAnalyzeBuilds(await T(),[e])}return(t,d)=>{let p=V,y=D;return a(),h(`div`,U,[f(`div`,W,[(a(!0),h(c,null,o(b.value,(e,t)=>(a(),h(`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},[f(`div`,{class:i(e.id===x.value?.id?``:`op30`)},m(e.name),3)],10,G))),128)),d[1]||=f(`div`,{border:`b base`,"flex-auto":``},null,-1)]),x.value?.id===`overview`?(a(),h(`div`,K,[d[15]||=f(`div`,{"flex-auto":``},null,-1),f(`div`,q,[d[10]||=f(`div`,{"i-carbon-commit":``,"text-xl":``},null,-1),f(`div`,null,[d[2]||=f(`div`,{"text-sm":``,op50:``},` Name `,-1),f(`div`,null,m(n.current.name),1)]),d[11]||=f(`div`,{"i-carbon-time":``,"text-xl":``},null,-1),f(`div`,null,[d[3]||=f(`div`,{"text-sm":``,op50:``},` Build duration `,-1),f(`div`,null,m(S(n.current)),1)]),n.current.size?.clientBundle?(a(),h(c,{key:0},[d[5]||=f(`div`,{"i-carbon-cics-program":``,"text-xl":``},null,-1),f(`div`,null,[d[4]||=f(`div`,{"text-sm":``,op50:``},` Client bundle size `,-1),f(`div`,null,m(E(n.current.size.clientBundle)),1)])],64)):s(``,!0),n.current.size?.nitroBundle?(a(),h(c,{key:1},[d[7]||=f(`div`,{"i-carbon-bare-metal-server":``,"text-xl":``},null,-1),f(`div`,null,[d[6]||=f(`div`,{"text-sm":``,op50:``},` Nitro bundle size `,-1),f(`div`,null,m(E(n.current.size.nitroBundle)),1)])],64)):s(``,!0),d[12]||=f(`div`,{"i-carbon-edge-node":``,"text-xl":``},null,-1),f(`div`,null,[d[8]||=f(`div`,{"text-sm":``,op50:``},` Built `,-1),f(`div`,null,m(r(w)(new Date(n.current.endTime))),1)]),d[13]||=f(`div`,{"i-carbon:folder-parent":``,"text-xl":``},null,-1),f(`div`,null,[d[9]||=f(`div`,{"text-sm":``,op50:``},` Report Path `,-1),g(p,{filepath:n.current.analyzeDir},null,8,[`filepath`])])]),d[16]||=f(`div`,{"flex-auto":``},null,-1),g(y,{n:`rose`,icon:`carbon-delete`,onClick:d[0]||=e=>O(n.current.name)},{default:l(()=>[...d[14]||=[e(` Delete this report `,-1)]]),_:1})])):s(``,!0),d._lazyshow1||x.value?.id===`bundle-client`?(d._lazyshow1=!0,a(),h(c,null,[u(f(`iframe`,{src:`${r(v)}${n.current.slug}/client.html`,"h-full":``,"w-full":``},null,8,[`src`]),[[_,x.value?.id===`bundle-client`]])],64)):s(`v-show-if`,!0),d._lazyshow2||x.value?.id===`bundle-nitro`?(d._lazyshow2=!0,a(),h(c,null,[u(f(`iframe`,{src:`${r(v)}${n.current.slug}/nitro.html`,"h-full":``,"w-full":``},null,8,[`src`]),[[_,x.value?.id===`bundle-nitro`]])],64)):s(`v-show-if`,!0),d._lazyshow3||x.value?.id===`vite-inspect`?(d._lazyshow3=!0,a(),h(c,null,[u(f(`iframe`,{src:`${r(v)}${n.current.slug}/.vite-inspect/`,"h-full":``,"w-full":``},null,8,[`src`]),[[_,x.value?.id===`vite-inspect`]])],64)):s(`v-show-if`,!0)])}}}),X=Object.assign(Y,{__name:`BuildAnalyzeDetails`}),Z={},Q={class:`markdown-body`};function $(t,n){return a(),h(`div`,Q,[...n[0]||=[f(`template`,null,[f(`div`,{class:`markdown-body`},[f(`h1`,null,`Build Analyze`),f(`p`,null,[e(`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 `),f(`code`,{"v-pre":``},`nuxt build --analyze`),e(` and present the output data directly in DevTools for easy browsing and comparing.`)])])],-1)]])}var ee=E(Z,[[`render`,$]]),te={flex:`~ col`},ne=[`onClick`],re={flex:`~ gap-1 items-center wrap`,"w-full":``,"text-sm":``,op60:``},ie={flex:`~ items-center justify-center wrap`,p4:``},ae={flex:`~ col gap-1`,"w-250":``,p4:``},oe={flex:`~ gap-3`,mt2:``,"justify-end":``},se=n({__name:`analyze-build`,setup(n){z({icon:`carbon-edge-node`,title:`Build Analyze`,layout:`full`,category:`analyze`,show(){return M(`^3.5.0`)}});let u=S(),_=b(),y=v(),E=x(`analyze-build:slug`,``),V=p(()=>_.value?.builds.find(e=>e.slug===E.value)??_.value?.builds[0]),U=t(!1),W=t(``),G=p(()=>_.value?.builds.some(e=>e.name===W.value.trim()));async function K(){W.value=await C.generateAnalyzeBuildName(),await u.start()&&(k(`analyze-build:start`),L.value={name:W.value,processId:await C.startAnalyzeBuild(await T(),W.value)},U.value&&Y())}let q=O();function J(e){return`${((e.endTime-e.startTime)/1e3).toFixed(1)}s`}function Y(){L.value?.processId&&(q.value=L.value.processId,y.push(`/modules/terminals`))}return F(()=>[{id:`action:analyze-build: start`,title:`Start a new analyze build`,icon:`i-carbon-edge-node`,action:K}]),(t,n)=>{let p=D,v=X,y=A,b=N,x=j,S=I,C=R,T=B,O=P,k=ee,M=H;return a(),h(c,null,[g(b,{"left-size":30},{left:l(()=>[f(`div`,te,[(a(!0),h(c,null,o(r(_)?.builds,e=>(a(),h(c,{key:e.slug},[f(`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},[f(`code`,null,m(e.name),1),f(`div`,re,[n[4]||=f(`div`,{"i-carbon-time":``},null,-1),f(`span`,null,m(J(e)),1),n[5]||=f(`div`,{"flex-auto":``},null,-1),f(`span`,null,m(r(w)(new Date(e.endTime))),1)])],10,ne),n[6]||=f(`div`,{"x-divider":``},null,-1)],64))),128)),f(`div`,ie,[r(L)?(a(),d(p,{key:1,n:`primary`,icon:`carbon-circle-dash animate-spin`,onClick:n[1]||=e=>Y()},{default:l(()=>[...n[8]||=[e(` Building... `,-1)]]),_:1})):(a(),d(p,{key:0,n:`primary`,icon:`carbon-edge-node`,onClick:n[0]||=e=>K()},{default:l(()=>[...n[7]||=[e(` Start a new build `,-1)]]),_:1}))])])]),right:l(()=>[V.value?(a(),d(v,{key:0,current:V.value},null,8,[`current`])):(a(),d(y,{key:1}))]),_:1}),g(r(u),null,{default:l(({resolve:t})=>[g(O,{"model-value":!0,onClose:e=>t(!1)},{default:l(()=>[f(`div`,ae,[n[13]||=f(`h3`,{class:`text-lg font-medium leading-6`,mb2:``},` Start analyze build? `,-1),n[14]||=f(`p`,{op50:``},` Enter the name of the build: `,-1),g(x,{modelValue:W.value,"onUpdate:modelValue":n[2]||=e=>W.value=e,placeholder:`Build name`},null,8,[`modelValue`]),G.value?(a(),d(S,{key:0,"n-orange":``},{default:l(()=>[...n[9]||=[e(` A build with the same name already exists, continue would overrides the previous build result. `,-1)]]),_:1})):s(``,!0),n[15]||=f(`div`,{my3:``,"x-divider":``},null,-1),n[16]||=f(`p`,{op50:``},` The following command will be executed in your terminal: `,-1),g(C,{code:`npx nuxi analyze --no-serve --name=${W.value}`,lang:`bash`,px4:``,py2:``,border:`~ base rounded`,lines:!1},null,8,[`code`]),g(T,{modelValue:U.value,"onUpdate:modelValue":n[3]||=e=>U.value=e,mt2:``,n:`primary`},{default:l(()=>[...n[10]||=[e(` Navigate to terminal `,-1)]]),_:1},8,[`modelValue`]),f(`div`,oe,[g(p,{onClick:e=>t(!1)},{default:l(()=>[...n[11]||=[e(` Cancel `,-1)]]),_:1},8,[`onClick`]),g(p,{n:`solid primary`,onClick:e=>t(!0)},{default:l(()=>[...n[12]||=[e(` Start `,-1)]]),_:1},8,[`onClick`])])])]),_:2},1032,[`onClose`])]),_:1}),g(M,null,{default:l(()=>[g(k)]),_:1})],64)}}});export{se as default};