import{a4 as M,bd as N,be as j,bf as B,a6 as D,l as E,ag as k,bg as P,i as V,aa as I,r as L,n as O}from"./cbulnwf4.js";import{q,k as C,u as x,r as R,D as $,p as W,w as _,H as S,O as U,a0 as n,R as u,a1 as y,P as r,a8 as w,a7 as A,v as T,ac as F,a2 as G}from"./vendor/json-editor-vue-huf8dypo.js";import{_ as H}from"./launch-page.vue-ji858ejl.js";import"./vendor/unocss-e7oqigho.js";import"./vendor/shiki-jv02kgzv.js";import"./nmarkdown.vue-io3ubke7.js";import"./client-bqg1k5yt.js";const h=new Map,X=q({__name:"IframeView",props:{tab:{}},setup(f){const m=f,c=M(),d=C(),i=x(()=>m.tab.name),e=C(),t=R(N(d));$(()=>{const o=m.tab.view,l=o.persistent!==!1,b=["clipboard-write","clipboard-read"];if(h.get(i.value)&&l)e.value=h.get(i.value),e.value.style.visibility="visible";else{e.value=document.createElement("iframe"),e.value.setAttribute("allow",b.join("; ")),e.value.setAttribute("aria-label","Nuxt Devtools"),l&&h.set(i.value,e.value),e.value.src=o.src;try{e.value.style.opacity="0.01",e.value.onload=()=>{v(),s(),e.value.style.opacity="1"}}catch{e.value.style.opacity="1"}document.body.appendChild(e.value),W(p)}setTimeout(s,100)}),_(p),_(s),_(v),S(()=>{e.value&&(e.value.style.visibility="hidden")});function s(){if(!(!e.value||!e.value.contentWindow))try{const o=e.value.contentWindow.document.querySelector("html");o?.classList.toggle("dark",c.value==="dark"),o?.classList.toggle("light",c.value==="dark"),new MutationObserver(()=>{c.value=e.value?.contentWindow?.document.querySelector("html")?.classList.contains("dark")?"dark":"light"}).observe(o,{attributes:!0,attributeFilter:["class"]})}catch{}}const a=j();function v(){if(!(!e.value||!e.value.contentWindow))try{e.value.contentWindow.__NUXT_DEVTOOLS__=a.value}catch{}}function p(){e.value&&Object.assign(e.value.style,{position:"fixed",left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,outline:"none"})}return(o,l)=>(n(),U("div",{ref_key:"anchor",ref:d,"h-full":"","w-full":""},null,512))}}),z={flex:"~ col gap2",mxa:"","items-center":""},J={"text-xl":""},K={"text-rose":""},ne=q({__name:"custom-[name]",props:{name:{}},setup(f){const m=f,c=B(),d=D(),i=x(()=>m.name??c.params.name),e=E(),t=x(()=>e.value.find(s=>s.name===i.value));return $(()=>{t.value?t.value.requireAuth&&!k.value&&P():setTimeout(()=>{t.value||d.push("/modules/overview")},2e3)}),(s,a)=>{const v=V,p=I,o=X,l=H,b=O;return t.value?t.value.requireAuth&&!T(k)?(n(),u(p,{key:1})):t.value.view.type==="iframe"?(n(),u(o,{key:2,tab:t.value},null,8,["tab"])):t.value.view.type==="vnode"?(n(),u(F(t.value.view.vnode),{key:3})):t.value.view.type==="launch"?(n(),u(l,{key:4,name:`custom-${t.value.name}`,icon:t.value.view.icon||t.value.icon,title:t.value.view.title||t.value.title,description:t.value.view.description,actions:t.value.view.actions,onAction:a[0]||(a[0]=g=>T(L).customTabAction(t.value.name,g))},null,8,["name","icon","title","description","actions"])):(n(),u(v,{key:5},{default:y(()=>[G(b,{flex:"~ col","h-full":"","items-center":"","justify-center":""},{default:y(()=>[w(" Unknown tab type "+A(t.value.view),1)]),_:1})]),_:1})):(n(),u(v,{key:0},{default:y(()=>[r("div",z,[a[3]||(a[3]=r("div",{"i-carbon-queued":"",mb2:"","text-5xl":"",op50:""},null,-1)),r("p",J,[a[1]||(a[1]=w(" Tab ")),r("code",K,A(i.value),1),a[2]||(a[2]=w(" not found "))]),a[4]||(a[4]=r("p",{op50:""}," It might because the module contributing this tab is not installed or enabled ",-1)),a[5]||(a[5]=r("p",{mt8:"","animate-pulse":""}," Redirecting to overview page... ",-1))])]),_:1}))}}});export{ne as default};
