"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7849],{54368(f,x,t){t.r(x),t.d(x,{SoloPanelPage:()=>j,SoloPanelRenderer:()=>P,default:()=>R});var n=t(74848),i=t(22803),d=t(96540),M=t(54148),S=t(92745),b=t(2484),$=t(31286),H=t(34999),v=t(63142),E=t(11098),z=t(1506),I=t(6262),N=t(32215),y=t(96691),A=t(12326),D=t(71542);function F(e){if(e==null)return!1;if(e===!0)return!0;if(e===!1)return!1;const s=(Array.isArray(e)?String(e[0]??""):String(e)).trim().toLowerCase();return s!=="false"&&s!=="0"}function L({containerRef:e,isHovered:o,hideLogo:s}){const l=F(s),[a,c]=(0,d.useState)(1),r=(0,v.of)(O),p=(0,v.$j)().isDark?D:A;return(0,d.useEffect)(()=>{const u=()=>{if(!e.current)return;const{width:h,height:m}=e.current.getBoundingClientRect(),W=Math.min(h,m),k=Math.max(.6,Math.min(1,.6+(W-200)/600)),G=Math.max(.6,Math.min(1,.6+(h-200)/800)),K=Math.min(1,(k+G)/2);c(K)};u();const g=new ResizeObserver(u);return e.current&&g.observe(e.current),()=>{g.disconnect()}},[e]),l?null:(0,n.jsxs)("div",{className:(0,i.cx)(r.logoContainer,o&&r.logoHidden),style:{fontSize:`${a*100}%`,top:`${8*a}px`,right:`${8*a}px`,padding:`${8*a}px ${8*a}px`},children:[(0,n.jsx)("span",{className:r.text,children:(0,n.jsx)(S.x6,{i18nKey:"embedded-panel.powered-by",children:"Powered by"})}),(0,n.jsx)("img",{src:p,alt:"Grafana",className:r.logo,style:{height:`${16*a}px`,marginLeft:"0.25em"}})]})}const O=e=>{const o=(0,i.css)({position:"absolute",backgroundColor:e.colors.background.primary,borderRadius:e.shape.radius.default,opacity:.9,pointerEvents:"none",zIndex:1e3,display:"flex",alignItems:"center",boxShadow:e.shadows.z3,border:`1px solid ${e.colors.border.weak}`,fontSize:e.typography.body.fontSize,lineHeight:1.2,[e.transitions.handleMotion("no-preference","reduce")]:{transition:"opacity 0.2s ease-in-out"}}),s=(0,i.css)({opacity:0}),l=(0,i.css)({color:e.colors.text.secondary,lineHeight:1.2,display:"block"}),a=(0,i.css)({display:"block",flexShrink:0});return{logoContainer:o,logoHidden:s,text:l,logo:a}};function j({queryParams:e}){const o=(0,N.sP)(),{dashboard:s,loadError:l}=o.useState(),{uid:a="",type:c,slug:r}=(0,M.g)();return(0,d.useEffect)(()=>(o.loadDashboard({uid:a,type:c,slug:r,route:I.Z4.Embedded}),()=>o.clearState()),[o,a,c,r]),e.panelId?l?(0,n.jsx)($.a,{justifyContent:"center",alignItems:"center",display:"flex",height:"100%",children:(0,n.jsx)(H.F,{severity:"error",title:(0,S.t)("dashboard.errors.failed-to-load","Failed to load dashboard"),children:l.message})}):s?(0,n.jsx)(b.$L,{scene:s,updateUrlOnInit:!0,children:(0,n.jsx)(P,{dashboard:s,panelId:e.panelId,hideLogo:e.hideLogo})}):(0,n.jsx)(E.A,{}):(0,n.jsx)(z.L,{entity:"Panel"})}const R=j;function P({dashboard:e,panelId:o,hideLogo:s}){const{controls:l,body:a}=e.useState(),c=l?.useState()?.refreshPicker,r=(0,v.of)(U),C=(0,y.XF)(o),[p,u]=(0,d.useState)(!1),g=(0,d.useRef)(null);return(0,d.useEffect)(()=>{const h=e.activate(),m=c?.activate();return()=>{h(),m?.()}},[e,c]),(0,n.jsxs)("div",{ref:g,className:r.container,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[(0,n.jsx)(L,{containerRef:g,isHovered:p,hideLogo:s}),B(e),(0,n.jsx)("div",{className:r.panelWrapper,children:(0,n.jsx)(y.Ob,{value:C,dashboard:e,singleMatch:!0,children:(0,n.jsx)(a.Component,{model:a})})})]})}function B(e){if(!e.state.$variables)return null;const o=e.state.$variables.state.variables;return(0,n.jsx)(n.Fragment,{children:o.map(s=>s.UNSAFE_renderAsHidden?(0,n.jsx)(s.Component,{model:s},s.state.key):null)})}const U=e=>{const o=(0,i.css)({width:"100%",height:"100%"});return{container:(0,i.css)({position:"fixed",bottom:0,right:0,margin:0,left:0,top:0,width:"100%",height:"100%"}),panelWrapper:o}}},12326(f,x,t){f.exports=t.p+"static/img/grafana_text_logo_dark.70a1e5ee.svg"},71542(f,x,t){f.exports=t.p+"static/img/grafana_text_logo_light.467e047c.svg"}}]);

//# sourceMappingURL=SoloPanelPage.55d2568a5fab949912c3.js.map