(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[191],{70902:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/plugins/[...slug]",function(){return t(88597)}])},88597:function(n,e,t){"use strict";t.r(e),t.d(e,{default:function(){return c}});var r=t(85893),l=t(67294),i=t(9008),u=t.n(i),s=t(11163),o=t(55739),a=t(23800);function c(){let n=(0,s.useRouter)(),e=(0,l.useRef)(null),[t,i]=(0,l.useState)(null),c=function(n){var e;let t=function(n){if(!n)return null;let e=(Array.isArray(n)?n:[n]).filter(Boolean);return e.length?"/plugins/".concat(e.join("/")):null}(null==n?void 0:null===(e=n.query)||void 0===e?void 0:e.slug);if(t)return t;let r=null==n?void 0:n.asPath;if(!r||"string"!=typeof r)return null;let l=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e)return n;if(n===e)return"/";if(n.startsWith(e)){let t=n.slice(e.length);return t.startsWith("/")?t:"/".concat(t)}return n}(r.split("?")[0],(null==n?void 0:n.basePath)||"");return l&&l.startsWith("/plugins")?l:null}(n),d=(0,a.t6)(c),h=c&&c.startsWith("/plugins/")?c.slice(8):null,f=(0,a.t6)(h),g=d||f;(0,l.useEffect)(()=>{let n;let t=e.current;if(g&&t){i(null);try{n=g.mount({container:t,route:g})}catch(n){console.error("[SkyDashboardPlugin] Failed to mount plugin route:",g.id,n),i("Failed to render the plugin page. Check the browser console for details.")}return()=>{if("function"==typeof n)try{n()}catch(n){console.warn("[SkyDashboardPlugin] Error during plugin route cleanup:",n)}else if(g.unmount)try{g.unmount({container:t,route:g})}catch(n){console.warn("[SkyDashboardPlugin] Error during plugin unmount:",n)}t&&(t.innerHTML="")}}},[g,c]);let p=(null==g?void 0:g.title)?"".concat(g.title," | SkyPilot Dashboard"):"Plugin | SkyPilot Dashboard";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u(),{children:(0,r.jsx)("title",{children:p})}),(0,r.jsx)("div",{className:"min-h-[50vh]",children:t?(0,r.jsx)("div",{className:"max-w-3xl mx-auto p-6 bg-red-50 text-red-700 rounded-lg border border-red-200",children:t}):(0,r.jsxs)(r.Fragment,{children:[!g&&(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(o.Z,{size:20}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:n.isReady?"Loading plugin resources...":"Preparing plugin route..."})]}),(0,r.jsx)("div",{ref:e})]})})]})}},9008:function(n,e,t){n.exports=t(37219)}},function(n){n.O(0,[739,888,774,179],function(){return n(n.s=70902)}),_N_E=n.O()}]);