U.annotations),G];throw new Error("Only recording and alerting ruler rules can be hashed")}function j(U){const z=!(0,i.wS)(),G=N(U,z);return S(JSON.stringify(G)).toString()}function N(U,K){const z=K?V(U.query):"",G=w(U.labels);if(l.R$.recordingRule(U))return[U.name,c.JS.Recording,z,G];if(l.R$.alertingRule(U))return[U.name,c.JS.Alerting,z,w(U.annotations),G];throw new Error("Only recording and alerting rules can be hashed")}function V(U){return U=U.split(` `).map(K=>K.trim()).filter(K=>K&&!K.startsWith("#")).join(` `),U.length>1&&U[0]==="("&&U[U.length-1]===")"&&(U=U.slice(1,-1)),U=U.replace(/\s|\n/g,""),U=U.replace(/\\"/g,'"'),U=U.replace(/`([^`]*)`/g,'"$1"'),U=U.replace(/['"()\[\]\\`]/g,""),U.split("").sort().join("")}function w(U){return JSON.stringify(Object.entries(U||{}).sort((K,z)=>K[0].localeCompare(z[0])))}function M(U){return(0,l.A4)(U)?o.hY:U.ruleSourceName}function O(U){const{pathname:K=""}=a.Ny.getLocation(),{id:z}=U;return z?(0,t.nth)(K.split("/"),-2):void 0}},45311(ne,A,e){"use strict";e.d(A,{U:()=>a});var t=e(2543),n=e.n(t);function a(c){const r=(0,t.pick)(c,["alerting","pending","inactive","recording","recovering"]);return(0,t.sum)(Object.values(r))}},29609(ne,A,e){"use strict";e.d(A,{$7:()=>j,A4:()=>N,BL:()=>pe,H2:()=>ze,I2:()=>Se,KC:()=>F,Mj:()=>M,Mu:()=>he,Nv:()=>U,O9:()=>fe,OF:()=>be,Om:()=>ee,R$:()=>R,RI:()=>L,Rh:()=>te,TU:()=>Q,Tm:()=>J,Wy:()=>oe,X4:()=>V,XI:()=>k,YN:()=>B,aw:()=>O,bL:()=>K,dS:()=>q,f6:()=>G,fC:()=>W,hC:()=>m,j_:()=>je,jg:()=>de,nf:()=>w,oI:()=>z,p:()=>S,pq:()=>Ue,qz:()=>ie,s_:()=>Ie,uo:()=>Z,vE:()=>Ne,x6:()=>b,xE:()=>ke});var t,n=e(2543),a=e.n(n),c=e(76190),r=e(43173),i=e(24619),o=e(56369),l=e(67817),f=e(95443),h=e(52161),d=e(39659),s=e(15629);function g(Ee){return typeof Ee=="object"&&"grafana_alert"in Ee}function v(Ee){return g(Ee)&&!x(Ee)}function x(Ee){return g(Ee)&&"record"in Ee.grafana_alert}function m(Ee){return!!Ee.grafana_alert.is_paused}function p(Ee){return typeof Ee=="object"&&"alert"in Ee}function y(Ee){return typeof Ee=="object"&&!g(Ee)}function E(Ee){return typeof Ee=="object"&&"record"in Ee}function b(Ee){return Ee.rules.every(Ae=>y(Ae))}function u(Ee){return typeof Ee=="object"&&Ee.type===i.JS.Alerting}function D(Ee){return typeof Ee=="object"&&Ee.type===i.JS.Recording}function P(Ee){return u(Ee)&&"folderUid"in Ee&&"uid"in Ee}function C(Ee){return D(Ee)&&"folderUid"in Ee&&"uid"in Ee}const S={grafana:{rule:g,alertingRule:v,recordingRule:x},dataSource:{rule:y,alertingRule:p,recordingRule:E},any:{rule:Ee=>y(Ee)||g(Ee),recordingRule:Ee=>E(Ee)||x(Ee),alertingRule:Ee=>p(Ee)||v(Ee)}},R={rule:Ee=>u(Ee)||D(Ee),alertingRule:u,recordingRule:D,grafana:{rule:Ee=>P(Ee)||C(Ee),alertingRule:P,recordingRule:C}};function L(Ee){return JSON.stringify(Ee.labels)}function j(Ee){return Ee.error&&Ee.error?.message?.includes(f.UU)}function N(Ee){return"uid"in Ee}function V(Ee){return"rulerRuleHash"in Ee}function w(Ee){return Object.values(i.JS).includes(Ee)}function M(Ee){return"ruleHash"in Ee}function O(Ee){return N(Ee)||V(Ee)}function U(Ee){return g(Ee)&&!!Ee.grafana_alert.provenance}function K(Ee){return R.grafana.rule(Ee)&&!!Ee.provenance}function z(Ee){return Ee.rules.some(Ae=>U(Ae))}function G(Ee){switch(Ee){case"ok":return o.Jc.Ok;case"nodata":return o.Jc.NoData;case"error":case"err":return o.Jc.Error;case"unknown":return o.Jc.Unknown;default:return}}function F(Ee){if(Ee==="grafana")return o.Eg.Grafana;if(Ee==="datasource")return o.Eg.DataSource}function W(Ee){if(!S.any.recordingRule(Ee.rulerRule)){if(p(Ee.rulerRule))return Ee.rulerRule.for;if(u(Ee.promRule)){const Ae=(Ee.promRule.duration??0)*1e3;return(0,s.an)(Ae)}}}function H(Ee){return S.any.alertingRule(Ee)?Ee.for:void 0}function Y(Ee){if(!S.any.recordingRule(Ee.rulerRule)&&v(Ee.rulerRule))return Ee.rulerRule.keep_firing_for}function te(Ee){return Ee?.annotations??{}}function Z(Ee){if(!Ee)return;const Ae=Ee.labels?.[d.lL];if(!Ae)return;const $e=Ae.match(/^plugin\/(?.+)$/);if(!$e?.groups)return;const Fe=$e.groups.pluginId;if(se(Fe))return{pluginId:Fe}}function se(Ee){return!!r.$.apps[Ee]}function ae(Ee){return Ee.rules.some(Ae=>J(Ae))}function J(Ee){return!!Z(Ee)}function k(Ee){return Ee===i.cF.Inactive?"Normal":(0,n.capitalize)(Ee)}const _=Ee=>Ee.reduce((Ae,{dataSourceName:$e,name:Fe,groups:We})=>(We.forEach(({name:Ge,rules:me})=>{me.forEach(De=>{u(De)&&Ae.push({dataSourceName:$e,namespaceName:Fe,groupName:Ge,rule:De})})}),Ae),[]),Q=Ee=>u(Ee.promRule)?Ee.promRule:null,q=Ee=>Ee.reduce((Ae,{rulesSource:$e,name:Fe,groups:We})=>(We.forEach(({name:Ge,rules:me})=>{me.forEach(De=>{De.promRule&&u(De.promRule)&&Ae.push({dataSourceName:(0,h.EV)($e),namespaceName:Fe,groupName:Ge,...De,namespace:{...De.namespace,uid:De.promRule.folderUid}})})}),Ae),[]);function oe(Ee){let Ae;return Object.values(c.O).includes(Ee)?Ae=Ee:Ae=(0,i.lh)(Ee),re[Ae]}const re={[i.cF.Inactive]:"good",[i.cF.Firing]:"bad",[i.cF.Pending]:"warning",[i.cF.Recovering]:"warning",[i.Gi.Alerting]:"bad",[i.Gi.Error]:"bad",[i.Gi.NoData]:"info",[i.Gi.Normal]:"good",[i.Gi.Pending]:"warning",[i.Gi.Recovering]:"warning",[c.O.NoData]:"info",[c.O.Paused]:"warning",[c.O.Alerting]:"bad",[c.O.OK]:"good",[c.O.Unknown]:"info"};function ee(Ee){return Ee?.alerts?Ee.alerts.reduce((Ae,$e)=>{const Fe=(0,i.lh)($e.state)!==i.Gi.Normal;if($e.activeAt&&Fe){const We=new Date($e.activeAt);if(Ae===null||Ae.getTime()>We.getTime())return We}return Ae},null):null}function B(Ee){return Array.isArray(Ee.source_tenants)}function ie(Ee){return S.grafana.rule(Ee)?Ee.grafana_alert.title:S.dataSource.alertingRule(Ee)?Ee.alert:S.dataSource.recordingRule(Ee)?Ee.record:""}const de=(Ee,Ae)=>{const $e={alertName:"",forDuration:"0s",evaluationsToFire:0};return g(Ee)?{alertName:Ee.grafana_alert.title,forDuration:Ee.for,evaluationsToFire:Ee.for?fe(Ee.for,Ae):null}:p(Ee)?{alertName:Ee.alert,forDuration:Ee.for??"0s",evaluationsToFire:fe(Ee.for??"0s",Ae)}:$e},fe=(Ee,Ae)=>{const $e=(0,s.P8)(Ae),Fe=(0,s.P8)(Ee);return Fe===0&&$e!==0?1:$e===0||Fe/$e<1?0:Math.ceil(Fe/$e)+1};function ce(Ee,Ae){return Ee===0?1:Ae===0||Ee/Ae<1?0:Math.ceil(Ee/Ae)+1}function ve(Ee){const Ae=t(Ee.namespace.rulesSource)?Ee.namespace.rulesSource:Ee.namespace.rulesSource.name,$e=g(Ee.rulerRule)?Ee.rulerRule.grafana_alert.namespace_uid:Ee.namespace.name;return{dataSourceName:Ae,namespaceName:$e,groupName:Ee.group.name}}function Se(Ee){const Ae=Ee.ruleSourceName,$e=g(Ee.rule)?Ee.rule.grafana_alert.namespace_uid:Ee.namespace,Fe=Ee.group.name;return{dataSourceName:Ae,namespaceName:$e,groupName:Fe}}function je(Ee){const Ae=Ee.dataSourceName,$e=Ee.folder?.uid??Ee.namespace,Fe=Ee.group;if(!Ae)throw new Error("no datasource name in form values");return{dataSourceName:Ae,namespaceName:$e,groupName:Fe}}function Ve(Ee){return t(Ee)?Ee:Ee.name}function he(Ee){return Ee===l.Z.grafana}function Ue(Ee){return Ee===l.Z.grafanaRecording}function pe(Ee){return Ee===l.Z.cloudAlerting}function be(Ee){return Ee===l.Z.cloudRecording}function ze(Ee){return he(Ee)||Ue(Ee)}function Ne(Ee){return Ue(Ee)||be(Ee)}function Ie(Ee){return pe(Ee)||be(Ee)}function ke(Ee){if(!Ee)return;let Ae;return"grafana_alert"in Ee&&S.grafana.rule(Ee)?Ae=Ee.grafana_alert.uid:"uid"in Ee&&R.grafana.rule(Ee)&&(Ae=Ee.uid),Ae}},42801(ne,A,e){"use strict";e.d(A,{a:()=>c,o:()=>a});var t=e(2543),n=e.n(t);function a(r,i){let o=i.trim();if(!o.match(/\{\{\s*define/)){const l=o.split(` `).map(f=>" "+f).join(` `);o=`{{ define "${r}" }} ${l} {{ end }}`}return o}function c(r){const i=(o,l)=>`{{ define "${l}_NEW_${(0,t.now)()}" }}`;return r.replace(/\{\{\s*define\s*\"(?.*)\"\s*\}\}/g,i)}},15629(ne,A,e){"use strict";e.d(A,{M9:()=>h,P1:()=>a,P8:()=>s,TN:()=>i,an:()=>d,mo:()=>g,sc:()=>r,yl:()=>v});var t,n=e(72649);function a(x){const m=x.match(/(\d+)(\w+)/);if(m)return[Number(m[1]),m[2]];throw new Error(`Invalid interval description: ${x}`)}function c(x){const{sec:m,count:p}=t.describeInterval(x);return m*p}const r=Object.entries(n.y).map(([x,m])=>({label:x[0].toUpperCase()+x.slice(1),value:m}));function i(x){try{return h(x),!0}catch{return!1}}const o={ms:1,s:1e3,m:60*1e3,h:3600*1e3,d:1440*60*1e3,w:10080*60*1e3,y:365*24*60*60*1e3},l=new RegExp(/^(?:(?\d+)(?ms|s|m|h|d|w|y))|0$/),f=new Error(`Must be of format "(number)(unit)", for example "1m", or just "0". Available units: ${Object.values(n.y).join(", ")}`);function h(x){let m=x;const p=[];function y(b){const u=l.exec(b),D=u?.groups?.value&&u?.groups?.type;if(!u||!D)throw f;u&&u.groups?.value&&u.groups?.type&&(m=m.replace(u[0],""),p.push([Number(u.groups.value),u.groups.type])),m&&y(m)}if(y(x),!p.length)throw f;return p.reduce((b,[u,D])=>{const P=u*o[D];return b+P},0)}function d(x){const m=Math.floor(x/1e3),p=Math.floor(m/60),y=Math.floor(p/60),E=Math.floor(y/24),b=Math.floor(E/7),u=Math.floor(E/365);return x===0?"0s":[[u,"y"],[b%52,"w"],[E%365-7*(b%52),"d"],[y%24,"h"],[p%60,"m"],[m%60,"s"],[x%1e3,"ms"]].filter(([P])=>P>0).map(([P,C])=>P+C).join("")}const s=x=>{try{return h(x)}catch{return 0}},g=x=>x.includes("0001-01-01T00");function v(x){return x%(1e3*60*60)===0?x/(1e3*60*60)+"h":x%(1e3*60)===0?x/(1e3*60)+"m":x%1e3===0?x/1e3+"s":x.toFixed()+"ms"}},92367(ne,A,e){"use strict";e.d(A,{G:()=>n,z:()=>a});var t=e(43173);function n(c,r,i={skipSubPath:!1}){const l=new URLSearchParams(r).toString();return`${i.skipSubPath?"":t.$.appSubUrl}${c}${l?`?${l}`:""}`}function a(c,r){const o=new URLSearchParams(r).toString();try{return`${new URL(t.$.appSubUrl+c,t.$.appUrl).href}${o?`?${o}`:""}`}catch{return n(c,r)}}},88547(ne,A,e){"use strict";e.d(A,{S:()=>a});var t=e(36303),n=e(74268);function a(c,r={}){return(0,t.Xc)(c,{...r,style:"page",errorLogger:n.vV})}},78767(ne,A,e){"use strict";e.d(A,{l:()=>r});var t=e(41119),n=e(68143);class a{query(o,l){return(0,n.AI)().get("/api/annotations",o,l).then(f=>(0,t.Vc)(f))}forAlert(o){return(0,n.AI)().get("/api/annotations",{alertUID:o})}save(o){return(0,n.AI)().post("/api/annotations",o)}update(o){return(0,n.AI)().put(`/api/annotations/${o.id}`,o)}delete(o){return(0,n.AI)().delete(`/api/annotations/${o.id}`)}async tags(){return(await(0,n.AI)().get("/api/annotations/tags?limit=1000")).result.tags.map(({tag:l,count:f})=>({term:l,count:f}))}}let c=null;function r(){return c||(c=new a),c}},66808(ne,A,e){"use strict";e.d(A,{A:()=>M});var t=e(74848),n=e(96540),a=e(75505),c=e(28105),r=e(62392),i=e(51898),o=e(92745),l=e(35137),f=e(68079),h=e(45861),d=e(34999),s=e(22429),g=e(75421),v=e(82612),x=e(87033),m=e(90696),p=e(46933),y=e(1906),E=e(78282);function b(O,U){let K=O.target;return O.query&&O.query.spec&&(K=O.query.spec),{...{...U.annotations?.getDefaultQuery?.(),...K??{refId:"Anno"}},datasource:O.datasource}}async function u(O,U){const K={name:O.name,enable:O.enable,hide:O.hide,iconColor:O.iconColor,mappings:O.mappings,filter:O.filter,type:O.type,builtIn:O.builtIn,datasource:U.datasource};try{const z=await(0,E.l)().get(U.datasource);let G=U;if((0,p.Ee)(z)&&(0,p.FL)(z)){const Z=await z.exportToAbstractQueries([U]),se=await z.importFromAbstractQueries(Z);if(se.length>0){const ae={...z.getDefaultQuery?.(y.Jk.Dashboard),datasource:U.datasource,refId:"Anno"};G={...U,...ae,...se[0],refId:"Anno"}}}else G={...U,refId:"Anno"};const{datasource:F,...W}=G,H={...K,target:W},Y={...m.CU,...z.annotations};let te;return Y.prepareAnnotation?te=Y.prepareAnnotation(H):te=H,O.query?.spec&&(te.query={...O.query,spec:{...te.target}}),te}catch(z){console.warn("Could not prepare annotation with new datasource:",z);const{datasource:G,...F}=U;return{...K,target:F}}}var D=e(41654),P=e(30419);function C({children:O,annotation:U,datasource:K,onQueryReplace:z}){const{renderSavedQueryButtons:G}=(0,P.Y)(),F=G(b(U,K),y.Jk.Dashboard,void 0,z);return(0,t.jsxs)(D.B,{direction:"column",gap:1,children:[(0,t.jsx)(D.B,{justifyContent:"flex-end",children:F}),O]})}var S=e(16515),R=e(88907),L=e(55386),j=e(45967),N=e(30703),V=e(18857);class w extends n.PureComponent{constructor(U){super(U),this.updateFields=()=>{const K=this.props.response?.panelData,z=K?.series?.[0]??K?.annotations?.[0];if(z&&z.fields){const G=z.fields.map(F=>{const W=(0,S.Ct)(F,z);let H="";for(let Y=0;Y0&&(H+=", "),Y>2){H+="...";break}H+=F.values[Y]}return H.length>50&&(H=H.substring(0,50)+"..."),{label:`${W} (${F.type})`,value:W,description:H}});this.setState({fieldNames:G})}},this.onFieldSourceChange=(K,z)=>{const G=this.props.mappings||{},F=G[K]||{};this.props.change({...G,[K]:{...F,source:z.value||R.V.Field}})},this.onFieldNameChange=(K,z)=>{const G=this.props.mappings||{};if(!z){const W={...this.props.mappings};delete W[K],this.props.change(W);return}const F=G[K]||{};this.props.change({...G,[K]:{...F,value:z.value,source:R.V.Field}})},this.state={fieldNames:[]}}componentDidMount(){this.updateFields()}componentDidUpdate(U){U.response!==this.props.response&&this.updateFields()}renderRow(U,K,z){const{fieldNames:G}=this.state;let F=[...G];const W=K.value;let H=G.find(te=>W===te.value);W&&!H&&F.push({label:W,value:W});let Y=z?z[U.key]:"";if(Y&&U.key.startsWith("time")){const te=(0,L.j_)("dateTimeAsIso");Y=(0,L.cN)(te(Y))}return Y==null&&(Y=""),(0,t.jsxs)("tr",{children:[(0,t.jsxs)("td",{children:[U.label||U.key," ",U.help&&(0,t.jsx)(j.m,{content:U.help,children:(0,t.jsx)(N.I,{name:"info-circle"})})]}),(0,t.jsx)("td",{children:(0,t.jsx)(V.l6,{value:H,options:F,placeholder:U.placeholder||U.key,onChange:te=>{this.onFieldNameChange(U.key,te)},noOptionsMessage:(0,o.t)("annotations.annotation-field-mapper.noOptionsMessage-unknown-field-names","Unknown field names"),allowCustomValue:!0,isClearable:!0})}),(0,t.jsx)("td",{children:`${Y}`})]},U.key)}render(){const U=this.props.response?.events?.[0],K=this.props.mappings||{};return(0,t.jsxs)("table",{className:"filter-table",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(o.x6,{i18nKey:"annotations.annotation-field-mapper.annotation",children:"Annotation"})}),(0,t.jsx)("th",{children:(0,t.jsx)(o.x6,{i18nKey:"annotations.annotation-field-mapper.from",children:"From"})}),(0,t.jsx)("th",{children:(0,t.jsx)(o.x6,{i18nKey:"annotations.annotation-field-mapper.first-value",children:"First value"})})]})}),(0,t.jsx)("tbody",{children:(0,m.g6)().map(z=>this.renderRow(z,K[z.key]||{},U))})]})}}class M extends n.PureComponent{constructor(){super(...arguments),this.state={},this.onRunQuery=async()=>{const{datasource:U,annotation:K}=this.props;if((0,m.E7)(U))return;const z=(0,s.UA)().getCurrent();if(!z)return;this.setState({running:!0});const G=await(0,a.s)((0,x.b)({range:(0,g.jG)().timeRange(),panel:new v.a9({}),dashboard:z},U,K));this.setState({running:!1,response:G})},this.onQueryChange=U=>{this.props.annotation.query&&this.props.annotation.query.spec&&(U={...this.props.annotation.query.spec,...U}),this.props.onChange({...this.props.annotation,target:U,...this.props.annotation.query&&{query:{kind:this.props.annotation.query.kind,spec:{...U}}},...this.props.annotation.legacyOptions?{legacyOptions:this.props.annotation.legacyOptions}:{}})},this.onMappingChange=U=>{this.props.onChange({...this.props.annotation,mappings:U})},this.onAnnotationChange=U=>{this.props.onChange({...U,...this.props.annotation.legacyOptions?{legacyOptions:this.props.annotation.legacyOptions}:{}})},this.onQueryReplace=async U=>{const{annotation:K,onChange:z}=this.props;try{const G=await u(K,U);this.setState({skipNextVerification:!0}),z(G)}catch(G){console.error("Failed to replace annotation query:",G)}}}componentDidMount(){this.verifyDataSource()}componentDidUpdate(U){this.props.annotation!==U.annotation&&!(0,m.E7)(this.props.datasource)&&this.verifyDataSource()}verifyDataSource(){const{datasource:U,annotation:K}=this.props;if(this.state.skipNextVerification){this.setState({skipNextVerification:!1}),this.onRunQuery();return}const G={...m.CU,...U.annotations}.prepareAnnotation(K);G!==K?this.props.onChange(G):this.onRunQuery()}getStatusSeverity(U){const{events:K,panelData:z}=U;return z?.errors||z?.error?"error":K?.length?"success":"warning"}renderStatusText(U,K){const{events:z,panelData:G}=U;if(K||U?.panelData?.state===c.Gu.Loading||!U)return(0,t.jsx)("p",{children:"loading..."});if(G?.errors)return(0,t.jsx)(t.Fragment,{children:G.errors.map((Y,te)=>(0,t.jsx)("p",{children:Y.message},te))});if(G?.error)return(0,t.jsx)("p",{children:G.error.message??"There was an error fetching data"});if(!z?.length)return(0,t.jsx)("p",{children:(0,t.jsx)(o.x6,{i18nKey:"annotations.standard-annotation-query-editor.no-events-found",children:"No events found"})});const F=G?.series?.[0]??G?.annotations?.[0],W=z.length,H=F?.fields.length;return(0,t.jsx)("p",{children:(0,t.jsxs)(o.x6,{i18nKey:"annotations.standard-annotation-query-editor.events-found",children:[{numEvents:W}," events (from ",{numFields:H}," fields)"]})})}renderStatus(){const{response:U,running:K}=this.state;return U?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.$,{v:2}),(0,t.jsx)("div",{children:K?(0,t.jsx)(f.y,{}):(0,t.jsx)(h.$n,{"data-testid":i.Tp.components.Annotations.editor.testButton,variant:"secondary",size:"xs",onClick:this.onRunQuery,children:(0,t.jsx)(o.x6,{i18nKey:"annotations.standard-annotation-query-editor.test-annotation-query",children:"Test annotation query"})})}),(0,t.jsx)(l.$,{v:2,layout:"block"}),(0,t.jsx)(d.F,{"data-testid":i.Tp.components.Annotations.editor.resultContainer,severity:this.getStatusSeverity(U),title:(0,o.t)("annotations.standard-annotation-query-editor.title-query-result","Query result"),children:this.renderStatusText(U,K)})]}):null}render(){const{datasource:U,annotation:K,datasourceInstanceSettings:z}=this.props,{response:G}=this.state;let F=U.annotations?.QueryEditor||U.components?.QueryEditor;if(!F)return(0,t.jsx)("div",{children:(0,t.jsx)(o.x6,{i18nKey:"annotations.standard-annotation-query-editor.no-query-editor",children:"Annotations are not supported. This datasource needs to export a QueryEditor"})});let W=K.target;K.query&&K.query.spec&&(W={...K.query.spec});let H={...U.annotations?.getDefaultQuery?.(),...W??{refId:"Anno"}},Y=K;return K.query&&K.legacyOptions&&(Y={...K.legacyOptions,...K}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.p,{instanceSettings:z,children:(0,t.jsx)(C,{annotation:K,datasource:U,onQueryReplace:this.onQueryReplace,children:(0,t.jsx)(F,{query:H,datasource:U,onChange:this.onQueryChange,onRunQuery:this.onRunQuery,data:G?.panelData,range:(0,g.jG)().timeRange(),annotation:Y,onAnnotationChange:this.onAnnotationChange},U?.name)})}),(0,m.JX)(U)&&(0,t.jsxs)(t.Fragment,{children:[this.renderStatus(),(0,t.jsx)(w,{response:G,mappings:K.mappings,change:this.onMappingChange})]})]})}}},87033(ne,A,e){"use strict";e.d(A,{b:()=>h});var t=e(62467),n=e(81160),a=e(69862),c=e(17548),r=e(1906),i=e(71393),o=e(90696);let l=100;function f(){return"AQ"+l++}function h(d,s,g){const v={...o.CU,...s.annotations},x={...v.getDefaultQuery?.(),...g},m=v.prepareAnnotation(x);if(!m)return(0,t.of)({});const p=v.prepareQuery(m);if(!p)return(0,t.of)({});const y=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,E=c.calculateInterval(d.range,y,s.interval),b={__interval:{text:E.interval,value:E.interval},__interval_ms:{text:E.intervalMs.toString(),value:E.intervalMs},__annotation:{text:m.name,value:m}},u={startTime:Date.now(),requestId:f(),range:d.range,maxDataPoints:y,scopedVars:b,...E,app:r.Jk.Dashboard,timezone:d.dashboard.timezone,targets:[{...p,refId:"Anno"}]};return(0,i.BN)(s,u).pipe((0,a.Z)(D=>{const P=D?.series.length?D.series:D.annotations;return P?.length?v.processEvents(m,P).pipe((0,n.T)(C=>({panelData:D,events:C}))):(0,t.of)({panelData:D,events:[]})}))}},90696(ne,A,e){"use strict";e.d(A,{CU:()=>s,E7:()=>b,JX:()=>E,g6:()=>v});var t=e(2543),n=e.n(t),a=e(62467),c=e(81160),r=e(69862),i=e(16515),o=e(52645),l=e(88907),f=e(95004),h=e(92745),d=e(65642);const s={prepareAnnotation:u=>{if((0,t.isString)(u?.query)){const{query:D,...P}=u;return{...P,target:{refId:"annotation_query",query:D},mappings:{}}}return u},prepareQuery:u=>u.target,processEvents:(u,D)=>p(D,u.mappings)};function g(){return u=>u.pipe((0,r.Z)(D=>{if(!D?.length)return(0,a.of)(void 0);if(D.length===1)return(0,a.of)(D[0]);const P={interpolate:C=>C};return(0,a.of)(D).pipe(o.c.mergeTransformer.operator({},P),(0,c.T)(C=>C[0]))}))}const v=()=>[{key:"time",field:u=>u.fields.find(D=>D.type===f.PU.time),placeholder:(0,h.t)("annotations.get-annotation-event-names.placeholder.time-or-the-first-field","{{defaultField}}, or the first time field",{defaultField:"time"})},{key:"timeEnd",help:(0,h.t)("annotations.get-annotation-event-names.help.annotation-treated-as-range","When this field is defined, the annotation will be treated as a range")},{key:"title"},{key:"text",field:u=>u.fields.find(D=>D.type===f.PU.string),placeholder:(0,h.t)("annotations.get-annotation-event-names.placeholder.text-or-the-first-field","{{defaultField}}, or the first text field",{defaultField:"text"})},{key:"tags",split:",",help:(0,h.t)("annotations.get-annotation-event-names.help.results-split-on-comma","The results will be split on comma (,)")},{key:"id"}],x=[{key:"color"},{key:"isRegion"},{key:"source"}],m=[...d.$W.publicDashboardAccessToken?x:[],...v(),{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];function p(u,D){return(0,a.of)(u).pipe(g(),(0,c.T)(P=>{if(!P?.length)return[];let C=!1,S=!1;const R={};for(const N of P.fields){const V=(0,i.Ct)(N,P);R[V.toLowerCase()]=N}D||(D={});const L=[];for(const N of m){const V=D[N.key]||{};if(V.source===l.V.Skip)continue;const w={key:N.key,split:N.split};if(V.source===l.V.Text)w.text=V.value;else{const M=(V.value||N.key).toLowerCase();w.field=R[M],!w.field&&N.field&&(w.field=N.field(P))}(w.field||w.text)&&(L.push(w),w.key==="time"?C=!0:w.key==="text"&&(S=!0))}if(!C||!S)return console.error("Cannot process annotation fields. No time or text present."),[];const j=[];for(let N=0;Nm,ws:()=>v});var t=e(65474),n=e(66847),a=e(16126),c=e(81160),r=e(69862),i=e(33160),o=e(38619),l=e(68143),f=e(43173),h=e(33184),d=e(73427),s=e(85618),g=e(75735);class v{constructor(E,b=!0){this.parseListOptionsSelector=p;const u=b?`namespaces/${(0,s.Ge)()}/`:"";this.gvr=E,this.url=`/apis/${E.group}/${E.version}/${u}${E.resource}`}async get(E){return(0,l.AI)().get(`${this.url}/${E}`)}watch(E){const b={watch:!0,labelSelector:this.parseListOptionsSelector(E?.labelSelector),fieldSelector:this.parseListOptionsSelector(E?.fieldSelector)};if(E?.name&&(b.fieldSelector=`metadata.name=${E.name}`),this.gvr.group==="provisioning.grafana.app"){let D="";return b.fieldSelector?.startsWith("metadata.name=")&&(D=b.fieldSelector.substring(13)),(0,h.oF)().getStream({scope:o.qD.Watch,namespace:this.gvr.group,path:`${this.gvr.version}/${this.gvr.resource}${D}/${d.TP.user.uid}`}).pipe((0,a.p)(P=>(0,o.Z7)(P)),(0,c.T)(P=>P.message))}const u=new TextDecoder;return(0,l.AI)().chunked({url:this.url,params:b,method:"GET"}).pipe((0,a.p)(D=>D.ok&&D.data instanceof Uint8Array),(0,c.T)(D=>u.decode(D.data).split(` `)),(0,r.Z)(D=>(0,t.H)(D)),(0,a.p)(D=>D.length>0),(0,c.T)(D=>{try{return JSON.parse(D)}catch(P){return console.warn("Invalid JSON in watch stream:",P,D),null}}),(0,a.p)(D=>D!==null),(0,i.L)({count:3,delay:1e3}),(0,n.W)(D=>{throw console.error("Watch stream error:",D),D}))}async subresource(E,b,u){return(0,l.AI)().get(`${this.url}/${E}/${b}`,u)}async list(E){const b=E||{};return b.labelSelector=this.parseListOptionsSelector(b?.labelSelector),b.fieldSelector=this.parseListOptionsSelector(b?.fieldSelector),(0,l.AI)().get(this.url,E)}async create(E,b){if(!E.metadata.name&&!E.metadata.generateName){const u=d.TP.user.login,D=u?u.replace(/[^a-zA-Z]/g,"").slice(0,2):"";E.metadata.generateName=D||"g"}return x(E.metadata),(0,l.AI)().post(this.url,E,{params:b})}async update(E,b){x(E.metadata);const u=`${this.url}/${E.metadata.name}`;return(0,l.AI)().put(u,E,{params:b})}async delete(E,b){return(0,l.AI)().delete(`${this.url}/${E}`,void 0,{showSuccessAlert:b})}}function x(y){y.annotations||(y.annotations={}),y.annotations[g.Pd]=f.$.buildInfo.versionString}class m{async get(E){if(this.apiVersions)return this.apiVersions[E];const b=await(0,l.AI)().get("/apis"),u={};return b.groups.forEach(D=>{if(D.name.includes("datasource.grafana.app")){const P=D.name.split(".")[0];u[P]=D.preferredVersion.version,P.endsWith("-datasource")||(P.includes("-")?u[`${P}-datasource`]=D.preferredVersion.version:u[`grafana-${P}-datasource`]=D.preferredVersion.version)}}),this.apiVersions=u,u[E]}}const p=y=>Array.isArray(y)?y.map(E=>{const b=String(E.key),u=E.operator;switch(u){case"=":case"!=":return`${b}${u}${E.value}`;case"in":case"notin":return`${b} ${u} (${E.value.join(",")})`;case"":case"!":return`${u}${b}`;default:return null}}).filter(Boolean).join(","):y},66402(ne,A,e){"use strict";e.d(A,{F:()=>a,N:()=>n});function t(c){return c!==null&&typeof c=="object"}function n(c){if(!t(c))return!1;const r=c.metadata;return t(r)?typeof r.name=="string"&&typeof r.resourceVersion=="string"&&typeof r.creationTimestamp=="string"&&t(c.spec):!1}function a(c){if(!t(c))return!1;const r=c.metadata;return t(r)?typeof r.resourceVersion=="string"&&Array.isArray(c.items):!1}},75735(ne,A,e){"use strict";e.d(A,{AI:()=>v,D1:()=>b,IC:()=>u,Jw:()=>l,LH:()=>o,Ms:()=>f,Pd:()=>g,Qu:()=>a,Sf:()=>i,UL:()=>p,Y5:()=>P,Y_:()=>h,ew:()=>c,fW:()=>D,fY:()=>r,hX:()=>x,hc:()=>t,hm:()=>y,qw:()=>m,w2:()=>E,xU:()=>n});const t="grafana.app/createdBy",n="grafana.app/updatedTimestamp",a="grafana.app/updatedBy",c="grafana.app/folder",r="grafana.app/message";var i=(C=>(C.Repo="repo",C.Terraform="terraform",C.Kubectl="kubectl",C.Plugin="plugin",C))(i||{});const o="grafana.app/managedBy",l="grafana.app/managerId",f="grafana.app/managerAllowsEdits",h="grafana.app/sourcePath",d="grafana.app/sourceChecksum",s="grafana.app/sourceTimestamp",g="grafana.app/saved-from-ui",v="grafana.app/grant-permissions",x="grafana.app/slug",m="grafana.app/dashboard-is-snapshot",p="grafana.app/dashboard-snapshot-original-url",y="grafana.app/dashboard-gnet-id",E="grafana.app/folderTitle",b="grafana.app/folderUrl",u="grafana.app/embedded",D="grafana.app/reloadOnParamsChange",P="grafana.app/deprecatedInternalID"},69874(ne,A,e){"use strict";e.d(A,{$m:()=>s,Q2:()=>d,Th:()=>l});var t=e(65642),n=e(73427),a=e(83873),c=e(11257);const r=[],i={};function o(v,x){r.find(m=>m.id===v.id)||(r.push(v),x&&(i[v.id]=x))}function l(){return r}function f(v){return r.find(x=>x.id===v)}function h(v){const x=[];for(const[m,p]of Object.entries(v)){const y=r.find(E=>`auth.${E.id}`===m);if(y){const E={...p,providerId:y.id,displayName:p.name||y.displayName};x.push(E)}}return x}async function d(v){if(i[v]){const x=i[v];return x()}return{configured:!1,enabled:!1}}function s(){if(t.Ay.featureToggles.ssoSettingsLDAP)return;o({id:"ldap",type:"LDAP",protocol:"LDAP",displayName:"LDAP",configPath:"ldap"},g)}async function g(){if(n.TP.hasPermission(c.w.SettingsRead)){const x=(await(0,a.AI)().get("/api/admin/settings"))["auth.ldap"]||{};return{configured:x.enabled==="true",enabled:x.enabled==="true",hide:x.enabled!=="true"}}return{configured:!1,enabled:!1}}},44256(ne,A,e){"use strict";e.d(A,{Ay:()=>v,MH:()=>o,Nh:()=>l,Oy:()=>s,SH:()=>f,TO:()=>r,jA:()=>c,sr:()=>i});var t=e(65307);const n={settings:{},providerStatuses:{},isLoading:!1,providers:[]},a=(0,t.Z0)({name:"authConfig",initialState:n,reducers:{settingsUpdated:(x,m)=>({...x,settings:m.payload}),providerStatusesLoaded:(x,m)=>({...x,providerStatuses:m.payload}),loadingBegin:x=>({...x,isLoading:!0}),loadingEnd:x=>({...x,isLoading:!1}),setError:(x,m)=>({...x,updateError:m.payload}),resetError:x=>({...x,updateError:void 0}),setWarning:(x,m)=>({...x,warning:m.payload}),resetWarning:x=>({...x,warning:void 0}),providersLoaded:(x,m)=>({...x,providers:m.payload})}}),{settingsUpdated:c,providerStatusesLoaded:r,loadingBegin:i,loadingEnd:o,setError:l,resetError:f,setWarning:h,resetWarning:d,providersLoaded:s}=a.actions,v={authConfig:a.reducer}},15203(ne,A,e){"use strict";e.d(A,{G2:()=>V,Ko:()=>L,Vc:()=>z,aF:()=>O,cU:()=>S,e8:()=>G,h5:()=>j,iB:()=>F,kH:()=>w,lv:()=>U,tk:()=>K,vR:()=>W,vZ:()=>R,vd:()=>N});var t=e(75816),n=e(59553),a=e(73659),c=e(85594),r=e(92138),i=e(32899),o=e(92745),l=e(68143),f=e(43173),h=e(36490),d=e(90297),s=e(45229),g=e(73427),v=e(38206),x=e(75735),m=e(13956),p=e(60171),y=e(79718),E=e(8535),b=e(32215),u=e(42361),D=e(44220),P=e(68528),C=e(27044);const S=(0,t.xP)({tagTypes:["getFolder"],reducerPath:"browseDashboardsAPI",baseQuery:(0,a.W)({baseURL:"/api"}),endpoints:Y=>({listFolders:Y.query({providesTags:te=>te&&te.length>0?te.map(Z=>({type:"getFolder",id:Z.uid})):[{type:"getFolder",id:"EMPTY_RESULT"}],query:({parentUid:te,limit:Z,page:se,permission:ae})=>({url:"/folders",params:{parentUid:te,limit:Z,page:se,permission:ae}})}),getFolder:Y.query({providesTags:(te,Z,se)=>[{type:"getFolder",id:se}],query:te=>({url:`/folders/${te}`,params:{accesscontrol:!0}})}),newFolder:Y.mutation({invalidatesTags:["getFolder"],query:({title:te,parentUid:Z})=>({method:"POST",url:"/folders",body:{title:te,parentUid:Z}}),onQueryStarted:({parentUid:te},{queryFulfilled:Z,dispatch:se})=>{Z.then(async({data:ae})=>{se((0,D.bw)({parentUID:te,pageSize:C.md}))})}}),saveFolder:Y.mutation({invalidatesTags:["getFolder"],query:({uid:te,title:Z,version:se})=>({method:"PUT",url:`/folders/${te}`,body:{title:Z,version:se}}),onQueryStarted:({parentUid:te},{queryFulfilled:Z,dispatch:se})=>{Z.then(()=>{se((0,D.bw)({parentUID:te,pageSize:C.md}))})}}),moveFolder:Y.mutation({invalidatesTags:["getFolder"],query:({folderUID:te,destinationUID:Z})=>({url:`/folders/${te}/move`,method:"POST",body:{parentUID:Z}}),onQueryStarted:({folderUID:te,destinationUID:Z},{queryFulfilled:se,dispatch:ae})=>{se.then(()=>{ae((0,D.Zw)([te])),ae((0,D.bw)({parentUID:Z,pageSize:C.md}))})}}),deleteFolder:Y.mutation({invalidatesTags:["getFolder"],query:({uid:te})=>({url:`/folders/${te}`,method:"DELETE",params:{forceDeleteRules:!1}}),onQueryStarted:({parentUid:te},{queryFulfilled:Z,dispatch:se})=>{Z.then(()=>{se((0,D.bw)({parentUID:te,pageSize:C.md}))})}}),getAffectedItems:Y.query({keepUnusedDataFor:0,queryFn:async({folderUIDs:te,dashboardUIDs:Z})=>{try{const se=te.map(k=>(0,l.AI)().get(`/api/folders/${k}/counts`)),ae=await Promise.all(se),J={folders:te.length,dashboards:Z.length,library_elements:0,alertrules:0};for(const k of ae)J.folders+=k.folder,J.dashboards+=k.dashboard,J.alertrules+=k.alertrule,J.library_elements+=k.librarypanel;return{data:J}}catch(se){return{error:se}}}}),moveDashboards:Y.mutation({invalidatesTags:["getFolder"],queryFn:async({dashboardUIDs:te,destinationUID:Z},se,ae,J)=>{for(const k of te){const _=await(0,m.n)().getDashboardDTO(k),Q=(0,p.HG)(_)?_.spec:_.dashboard,q=(0,p.HG)(_)?_.metadata:void 0;if(f.$.featureToggles.provisioning&&(0,P.j)(_)){s.A.publish({type:i.r1.alertWarning.name,payload:["Cannot move provisioned dashboard"]});continue}await(0,m.n)().saveDashboard({dashboard:Q,folderUid:Z,overwrite:!1,message:"",k8s:q})}return{data:void 0}},onQueryStarted:({destinationUID:te,dashboardUIDs:Z},{queryFulfilled:se,dispatch:ae})=>{se.then(()=>{ae((0,D.bw)({parentUID:te,pageSize:C.md})),ae((0,D.Zw)(Z))})}}),moveFolders:Y.mutation({invalidatesTags:["getFolder"],queryFn:async({folderUIDs:te,destinationUID:Z},se,ae,J)=>{for(const k of te)await(0,d.x)(E.JD,k,{warning:(0,o.t)("folders.api.folder-move-error-provisioned","Cannot move provisioned folder. To move it, move it in the repository and synchronise to apply the changes.")})||await J({url:`/folders/${k}/move`,method:"POST",body:{parentUID:Z}});return{data:void 0}},onQueryStarted:({destinationUID:te,folderUIDs:Z},{queryFulfilled:se,dispatch:ae})=>{se.then(()=>{ae((0,D.bw)({parentUID:te,pageSize:C.md})),ae((0,D.Zw)(Z))})}}),deleteFolders:Y.mutation({invalidatesTags:["getFolder"],queryFn:async({folderUIDs:te},Z,se,ae)=>{for(const J of te)await(0,d.x)(E.JD,J)||await ae({url:`/folders/${J}`,method:"DELETE",params:{forceDeleteRules:!1}});return{data:void 0}},onQueryStarted:({folderUIDs:te},{queryFulfilled:Z,dispatch:se})=>{Z.then(()=>{se((0,D.Zw)(te)),u.v.clear()})}}),deleteDashboards:Y.mutation({invalidatesTags:["getFolder"],queryFn:async({dashboardUIDs:te})=>{const Z=(0,b.sP)();for(const se of te){if(f.$.featureToggles.provisioning){const ae=await(0,m.n)().getDashboardDTO(se);if((0,P.j)(ae)){s.A.publish({type:i.r1.alertWarning.name,payload:["Cannot delete provisioned dashboard. To remove it, delete it from the repository and synchronise to apply the changes."]});continue}}await(0,m.n)().deleteDashboard(se,!0),Z.clearDashboardCache(),Z.removeSceneCache(se),u.v.clear(),f.$.featureToggles.kubernetesDashboards&&s.A.publish({type:i.r1.alertSuccess.name,payload:["Dashboard deleted"]})}return{data:void 0}},onQueryStarted:({dashboardUIDs:te},{queryFulfilled:Z,getState:se})=>{Z.then(()=>{(0,E.JD)((0,D.Zw)(te)),(0,E.JD)(c.qR.util.invalidateTags(["dashboardStars"]));for(const ae of te)(0,E.JD)((0,v.ci)({id:ae,title:"",url:"",isStarred:!1}))})}}),saveDashboard:Y.mutation({queryFn:async te=>{try{if((0,p.mi)(te))return{data:await(0,m.n)("v2").saveDashboard(te)};if((0,p.rL)(te))return{data:await(0,m.n)().saveDashboard(te)};throw new Error("Invalid dashboard version")}catch(Z){return(0,n.ss)(Z)}},onQueryStarted:({folderUid:te},{queryFulfilled:Z,dispatch:se})=>{y.t.ignoreNextSave(),Z.then(async()=>{await g.TP.fetchUserPermissions(),se((0,D.bw)({parentUID:te,pageSize:C.md}))})}}),importDashboard:Y.mutation({query:({dashboard:te,overwrite:Z,inputs:se,folderUid:ae})=>({method:"POST",url:"/dashboards/import",body:{dashboard:te,overwrite:Z,inputs:se,folderUid:ae}}),onQueryStarted:async({dashboard:te,folderUid:Z},{queryFulfilled:se,dispatch:ae})=>{let J;if(te.uid)try{const k=await(0,m.n)().getDashboardDTO(te.uid);J=(0,p.HG)(k)?k.metadata?.name:k.meta?.folderUid}catch(k){(0,l.NF)(k)&&(k.status!==404?console.error("Error fetching dashboard",k):k.isHandled=!0)}se.then(async k=>{ae((0,D.bw)({parentUID:Z,pageSize:C.md})),J&&J!==Z&&ae((0,D.bw)({parentUID:J,pageSize:C.md}));const _=r.I.stripBaseFromUrl(k.data.importedUrl);h.Ny.push(_)})}}),listDeletedDashboards:Y.query({providesTags:["getFolder"],queryFn:async()=>{try{return{data:await(0,m.n)().listDeletedDashboards({})}}catch(te){return(0,n.ss)(te)}}}),restoreDashboard:Y.mutation({invalidatesTags:["getFolder"],queryFn:async({dashboard:te})=>{try{const se=await(0,m.n)().restoreDashboard(te),ae=se.spec.title||"",J=se.metadata?.annotations?.[x.ew];return(0,E.JD)((0,D.bw)({parentUID:J,pageSize:C.md})),{data:{name:ae}}}catch(Z){return(0,n.ss)(Z)}}})})}),{endpoints:R,useDeleteFolderMutation:L,useDeleteFoldersMutation:j,useDeleteDashboardsMutation:N,useGetAffectedItemsQuery:V,useGetFolderQuery:w,useLazyGetFolderQuery:M,useMoveFolderMutation:O,useMoveDashboardsMutation:U,useMoveFoldersMutation:K,useNewFolderMutation:z,useSaveDashboardMutation:G,useSaveFolderMutation:F,useRestoreDashboardMutation:W,useListDeletedDashboardsQuery:H}=S},68528(ne,A,e){"use strict";e.d(A,{j:()=>n,x:()=>a});var t=e(75735);function n(c){return("meta"in c?c.meta.k8s?.annotations:c.metadata.annotations)?.[t.LH]===t.Sf.Repo}function a(c){return c.metadata.annotations?.[t.LH]===t.Sf.Repo}},27044(ne,A,e){"use strict";e.d(A,{aw:()=>h,md:()=>l,uT:()=>f});var t=e(68143),n=e(99090),a=e(55860),c=e(93854),r=e(11257),i=e(73427),o=e(62963);const l=50;async function f(d,s,g=1,v=l){const x=(0,t.AI)();let m=[];return i.TP.hasPermission(r.w.FoldersRead)&&(m=await x.get("/api/folders",{parentUid:d,page:g,limit:v})),m.map(p=>({kind:"folder",uid:p.uid,title:p.title,parentTitle:s,parentUID:d,managedBy:p.managedBy,url:(0,o.I2)(p.uid)?void 0:(0,o._0)(p.uid)}))}async function h(d,s=1,g=l){const x=await(0,a.S)().search({kind:["dashboard"],query:"*",location:d||"general",from:(s-1)*g,limit:g,offset:(s-1)*g});return x.view.map(m=>{const p=(0,c.hI)(m,x.view);return p.parentUID===n.TF&&(p.parentUID=void 0),p})}},78059(ne,A,e){"use strict";e.d(A,{x:()=>l});var t=e(74848),n=e(70255),a=e(92745),c=e(34999),r=e(66404),i=e(62779);function o(f,h,d,s){const g=f+h+d+s,v=[];f&&v.push((0,a.t)("browse-dashboards.counts.folder","{{count}} folder",{count:f})),h&&v.push((0,a.t)("browse-dashboards.counts.dashboard","{{count}} dashboard",{count:h})),d&&v.push((0,a.t)("browse-dashboards.counts.libraryPanel","{{count}} library panel",{count:d})),s&&v.push((0,a.t)("browse-dashboards.counts.alertRule","{{count}} alert rule",{count:s}));let x=(0,a.t)("browse-dashboards.counts.total","{{count}} item",{count:g});return v.length>0&&(x+=`: ${v.join(", ")}`),x}const l=({selectedItems:f})=>{const{data:h,isFetching:d,isLoading:s,error:g}=(0,i.IH)(f);return g?(0,t.jsx)(c.F,{severity:"error",title:(0,a.t)("browse-dashboards.descendant-count.title-unable-to-retrieve-descendant-information","Unable to retrieve descendant information")}):(0,t.jsxs)(r.E,{element:"p",color:"secondary",children:[h&&o(h.folders,h.dashboards,h.library_elements,h.alertrules),(d||s)&&(0,t.jsx)(n.A,{width:200})]})}},62963(ne,A,e){"use strict";e.d(A,{Gf:()=>o,I2:()=>c,X2:()=>l,_0:()=>r,aY:()=>i,eM:()=>a});var t=e(43173),n=e(73427);function a(f,h){return f+h.uid}function c(f){return f===t.$.sharedWithMeFolderUID}function r(f){const{orgId:h}=n.TP.user,s=`${t.$.appSubUrl??""}/dashboards/f/${f}/`;return h?`${s}?orgId=${h}`:s}function i(f){const h=[];for(const[d,s]of Object.entries(f.folder))s&&h.push({name:d,group:"folder.grafana.app",kind:"Folder"});for(const[d,s]of Object.entries(f.dashboard))s&&h.push({name:d,group:"dashboard.grafana.app",kind:"Dashboard"});return h}function o(f,h){const{canEditFolders:d,canDeleteFolders:s,canEditDashboards:g,canDeleteDashboards:v}=h;return f==="folder"?!!(d||s):!!(g||v)}function l(f){const{canEditFolders:h,canDeleteFolders:d,canEditDashboards:s,canDeleteDashboards:g}=f;return!!(h||d||(s||g))}},44220(ne,A,e){"use strict";e.d(A,{Ii:()=>o,Zw:()=>r,bw:()=>i});var t=e(99090),n=e(52763),a=e(27044),c=e(78034);const r=(0,n.zD)("browseDashboards/refreshParents",async(l,{getState:f,dispatch:h})=>{const{browseDashboards:d}=f(),{rootItems:s,childrenByParentUID:g}=d,v=new Set;for(const x of l){const m=(0,c.R)(s?.items??[],g,x);v.add(m?.parentUID)}for(const x of v)h(i({parentUID:x,pageSize:a.md}))}),i=(0,n.zD)("browseDashboards/refetchChildren",async({parentUID:l,pageSize:f})=>{const h=l===t.TF?void 0:l;let d=1,s="folder",g=await(0,a.uT)(h,void 0,d,f),v=g.length{const s=!f.includes("dashboard"),g=l===t.TF?void 0:l,v=d.getState().browseDashboards,x=g?v.childrenByParentUID[g]:v.rootItems;let m=1,p;if(x?x.lastFetchedKind==="dashboard"&&!x.lastKindHasMoreItems?console.warn(`fetchNextChildrenPage called for ${g} but that collection is fully loaded`):x.lastFetchedKind==="folder"&&x.lastKindHasMoreItems?(m=x.lastFetchedPage+1,p="folder"):s&&(m=x.lastFetchedKind==="folder"?1:x.lastFetchedPage+1,p="dashboard"):(m=1,p="folder"),!p)return;let y=p==="folder"?await(0,a.uT)(g,void 0,m,h):await(0,a.aw)(g,m,h),E=y.lengthf,Ms:()=>y,QE:()=>p,V6:()=>E,Zg:()=>u,eC:()=>x,ku:()=>l,q0:()=>m,xK:()=>b});var t=e(96540),n=e(25508),a=e(52763),c=e(27044),r=e(62963),i=e(44220),o=e(78034);const l=P=>P.browseDashboards.rootItems,f=P=>P.browseDashboards.childrenByParentUID,h=P=>P.browseDashboards.openFolders,d=P=>P.browseDashboards.selectedItems,s=(0,n.Mz)(l,f,h,(P,C)=>C,(P,C,S,R)=>D(R,P,C,S)),g=(0,n.Mz)(d,P=>Object.values(P).some(C=>Object.values(C).some(S=>S))),v=(0,n.Mz)(d,f,(P,C)=>{const S={dashboard:{...P.dashboard},folder:{...P.folder}};for(const R of Object.keys(P.folder))if(P.folder[R]){const j=C[R];if(j)for(const N of j.items)N.kind==="dashboard"&&(S.dashboard[N.uid]=!1),N.kind==="folder"&&(S.folder[N.uid]=!1)}return S});function x(P){return(0,a.d4)(C=>(P?C.browseDashboards.childrenByParentUID[P]:C.browseDashboards.rootItems)?"fulfilled":"pending")}function m(P){return(0,a.d4)(C=>s(C,P))}function p(){return(0,a.d4)(P=>g(P))}function y(){return(0,a.d4)(d)}function E(){return(0,a.d4)(P=>P.browseDashboards.childrenByParentUID)}function b(){return(0,a.d4)(P=>v(P))}function u(P=[]){const C=(0,a.wA)(),S=(0,t.useRef)(!1);return(0,t.useCallback)(L=>{if(S.current)return Promise.resolve();S.current=!0;const j=C((0,i.Ii)({parentUID:L,excludeKinds:P,pageSize:c.md}));return j.finally(()=>S.current=!1),j},[C,P])}function D(P,C,S,R,L=0,j=[],N=[]){function V(G,F,W){if(j.includes(G.kind)||N.includes(G.uid))return[];const H=D(G.uid,C,S,R,W+1,j,N),Y=!!R[G.uid],te=S[G.uid]?.items.length===0;Y&&te&&!j.includes("empty-folder")&&H.push({isOpen:!1,level:W+1,item:{kind:"ui",uiKind:"empty-folder",uid:G.uid+"empty-folder"},parentUID:F});const Z={item:G,parentUID:F,level:W,isOpen:Y},se=[Z,...H];return(0,r.I2)(Z.item.uid)&&se.push({item:{kind:"ui",uiKind:"divider",uid:"shared-with-me-divider"},parentUID:F,level:W+1,isOpen:!1}),se}const w=P&&R[P]||L===0,M=P?S[P]:C;let U=((P?w&&M?.items:M?.items)||[]).flatMap(G=>V(G,P,L));const K=j.includes("dashboard")&&M?.lastFetchedKind==="dashboard";return(L===0&&!M||w&&M&&!(M.isFullyLoaded||K))&&(U=U.concat((0,o.T)(c.md,P,L))),U}},87186(ne,A,e){"use strict";e.d(A,{xN:()=>D,Ay:()=>P,cT:()=>u,wn:()=>E,t$:()=>b});var t={};e.r(t),e.d(t,{clearFolders:()=>s,fetchNextChildrenPageFulfilled:()=>l,refetchChildrenFulfilled:()=>o,setAllSelection:()=>d,setFolderOpenState:()=>f,setItemSelectionState:()=>h});var n=e(65307),a=e(44220),c=e(99090),r=e(62963),i=e(78034);function o(C,S){const{children:R,page:L,kind:j,lastPageOfKind:N}=S.payload,{parentUID:V}=S.meta.arg,w={items:R,lastFetchedKind:j,lastFetchedPage:L,lastKindHasMoreItems:!N,isFullyLoaded:j==="dashboard"&&N};V&&V!==c.TF?C.childrenByParentUID[V]=w:C.rootItems=w}function l(C,S){const R=S.payload;if(!R)return;const{children:L,page:j,kind:N,lastPageOfKind:V}=R,{parentUID:w,excludeKinds:M=[]}=S.meta.arg,K={items:((w?C.childrenByParentUID[w]:C.rootItems)?.items??[]).concat(L),lastFetchedKind:N,lastFetchedPage:j,lastKindHasMoreItems:!V,isFullyLoaded:(M.includes("dashboard")||N==="dashboard")&&V};if(!w){C.rootItems=K;return}if(C.childrenByParentUID[w]=K,C.selectedItems.folder[w])for(const G of L)C.selectedItems[G.kind][G.uid]=!0}function f(C,S){const{folderUID:R,isOpen:L}=S.payload;C.openFolders[R]=L}function h(C,S){const{item:R,isSelected:L}=S.payload;if((0,r.I2)(R.uid))return;function j(N,V){if(C.selectedItems[N][V]=L,N!=="folder")return;let w=C.childrenByParentUID[V];for(const M of w?.items??[])j(M.kind,M.uid)}if(j(R.kind,R.uid),!L){let N=R.parentUID;for(;N;){const V=(0,i.R)(C.rootItems?.items??[],C.childrenByParentUID,N);if(!V)break;C.selectedItems[V.kind][V.uid]=!1,N=V.parentUID}}C.selectedItems.$all=C.rootItems?.items?.every(N=>C.selectedItems[N.kind][N.uid])??!1}function d(C,S){const{isSelected:R,folderUID:L,excludeUIDs:j}=S.payload;if(!(L&&(0,r.I2)(L)))if(C.selectedItems.$all=R,R){let V=function(w){if(w&&(0,r.I2)(w))return;const M=w?C.childrenByParentUID[w]:C.rootItems;if(M)for(const O of M.items)(0,r.I2)(O.uid)||j?.includes(O.uid)||(C.selectedItems[O.kind][O.uid]=R,O.kind==="folder"&&V(O.uid))};var N=V;V(L)}else for(const V in C.selectedItems){if(!(V==="dashboard"||V==="panel"||V==="folder"))continue;const w=C.selectedItems[V];for(const M in w)w[M]=R}}function s(C,S){const R=Array.isArray(S.payload)?S.payload:[S.payload];for(const L of R)L?(C.childrenByParentUID[L]=void 0,C.openFolders[L]=!1):C.rootItems=void 0}const{fetchNextChildrenPageFulfilled:g,refetchChildrenFulfilled:v,...x}=t,m={rootItems:void 0,childrenByParentUID:{},openFolders:{},selectedItems:{dashboard:{},folder:{},panel:{},$all:!1}},p=(0,n.Z0)({name:"browseDashboards",initialState:m,reducers:x,extraReducers:C=>{C.addCase(a.Ii.fulfilled,g),C.addCase(a.bw.fulfilled,v)}}),y=p.reducer,{setFolderOpenState:E,setItemSelectionState:b,setAllSelection:u,clearFolders:D}=p.actions,P={browseDashboards:y}},78034(ne,A,e){"use strict";e.d(A,{R:()=>t,T:()=>n});function t(a,c,r){for(const i of a)if(i.uid===r)return i;for(const i in c){const o=c[i];if(o){for(const l of o.items)if(l.uid===r)return l}}}function n(a,c,r){return new Array(a).fill(null).map((i,o)=>({parentUID:c,level:r,isOpen:!1,item:{kind:"ui",uiKind:"pagination-placeholder",uid:`${c}-pagination-${o}`}}))}},26437(ne,A,e){"use strict";e.d(A,{b:()=>n,q:()=>t});const t="connections",n={Base:`/${t}`,DataSources:`/${t}/datasources`,DataSourcesNew:`/${t}/datasources/new`,DataSourcesEdit:`/${t}/datasources/edit/:uid`,DataSourcesDashboards:`/${t}/datasources/edit/:uid/dashboards`,AddNewConnection:`/${t}/add-new-connection`,DataSourcesDetails:`/${t}/datasources/:id`,ConnectDataOutdated:`/${t}/connect-data`,YourConnectionsOutdated:`/${t}/your-connections`}},70191(ne,A,e){"use strict";e.d(A,{k:()=>r});var t=e(60455),n=e.n(t),a=e(79609),c=e(62635);const r=(i,o,l)=>{let f={},h={};if(i.type===a.CC.Regex&&i.expression){const d=new RegExp(i.expression,"gi"),g=(typeof o=="string"?o:(0,c.MA)(o)).matchAll(d);for(const v of g)v.groups?h=v.groups:h[i.mapValue||l]=v[1]||v[0]}else i.type===a.CC.Logfmt&&o!==void 0&&(h=n().parse(o));return Object.keys(h).forEach(d=>{const s=typeof h[d]=="string"?h[d]:(0,c.MA)(h[d]);f[d]={value:s}}),f}},52860(ne,A,e){"use strict";e.d(A,{F0:()=>l,bQ:()=>f,lW:()=>h});var t=e(41053),n=e(75505),a=e(78282),c=e(27963),r=e(6219);const i=({sourceUID:d,...s})=>{const g=(0,a.l)().getInstanceSettings(d),v=s.type==="query"?(0,a.l)().getInstanceSettings(s.targetUID):void 0;if((s?.orgId===void 0||s?.orgId===null||s?.orgId===0)&&r.kb.logWarning("Invalid correlation config: Missing org id."),g&&g?.uid!==void 0&&v?.uid!==void 0&&s.type==="query")return{...s,source:g,target:v};if(g&&g?.uid!==void 0&&v?.uid===void 0&&s.type==="external")return{...s,source:g};r.kb.logWarning("Invalid correlation config: Missing source or target.",{source:JSON.stringify(g),target:JSON.stringify(v)})},o=d=>!!d,l=d=>({...d,correlations:d.correlations.map(i).filter(o)});function f(d){return d.data}const h=()=>{const{backend:d}=(0,c.Il)(),[s,g]=(0,t.A)(b=>(0,n.s)(d.fetch({url:"/api/datasources/correlations",params:{page:b.page},method:"GET",showErrorAlert:!1})).then(f).then(l),[d]),[v,x]=(0,t.A)(({sourceUID:b,...u})=>d.post(`/api/datasources/uid/${b}/correlations`,u).then(D=>{const P=i(D.result);if(P!==void 0)return P;throw new Error("invalid sourceUID")}),[d]),[m,p]=(0,t.A)(({sourceUID:b,uid:u})=>d.delete(`/api/datasources/uid/${b}/correlations/${u}`),[d]),[y,E]=(0,t.A)(({sourceUID:b,uid:u,...D})=>d.patch(`/api/datasources/uid/${b}/correlations/${u}`,D).then(P=>{const C=i(P.result);if(C!==void 0)return C;throw new Error("invalid sourceUID")}),[d]);return{create:{execute:x,...v},update:{execute:E,...y},get:{execute:g,...s},remove:{execute:p,...m}}}},6219(ne,A,e){"use strict";e.d(A,{$q:()=>v,J6:()=>g,cA:()=>h,kb:()=>p,tZ:()=>m});var t=e(75505),n=e(79609),a=e(68143),c=e(43173),r=e(78282),i=e(25992),o=e(44720),l=e(46072),f=e(52860);const h=(y,E,b)=>(y.forEach(u=>{const D=u.refId;if(!D)return;let P=b[D];if(P===void 0&&u.meta?.preferredVisualisationType==="rawPrometheus"){const S=(0,o.a)(D);P=b[S]}const C=E.filter(S=>S.source.uid===P);d(u,s(C,u))}),y),d=(y,E)=>{y.fields.forEach(b=>{b.config.links=b.config.links?.filter(u=>u.origin!==n.x0.Correlations)||[],E.map(u=>{if(u.config.field===b.name){if(u.type==="query"){const D=u.config.target||{};b.config.links.push({internal:{query:{...D,datasource:{uid:u.target.uid}},datasourceUid:u.target.uid,datasourceName:u.target.name},url:"",title:u.label||u.target.name,origin:n.x0.Correlations,meta:{transformations:u.config.transformations}})}else if(u.type==="external"){const D=u.config.target;b.config.links.push({url:D.url,title:u.label||"External URL",origin:n.x0.Correlations,meta:{transformations:u.config?.transformations}})}}})})},s=(y,E)=>y.map(b=>{if(b.source.meta?.id==="loki"&&c.$.featureToggles.lokiLogsDataplane===!0&&b.config.field==="Line"){const u=(0,l.Os)(E);u!=null&&u.bodyField.name!==void 0&&(b.config.field=u?.bodyField.name)}return b}),g=async y=>(0,t.s)((0,a.AI)().fetch({url:"/api/datasources/correlations",method:"GET",showErrorAlert:!1,params:{sourceUID:y}})).then(f.bQ).then(f.F0),v=async(y,E)=>(0,a.AI)().post(`/api/datasources/uid/${y}/correlations`,E),x=async y=>y.datasourceInstance?.meta.mixed?await(0,r.l)().get(y.queries[0].datasource):y.datasourceInstance,m=async(y,E)=>Promise.all([x(y),x(E)]).then(b=>b[0]?.name!==void 0&&b[1]?.name!==void 0?`${b[0]?.name} to ${b[1]?.name}`:""),p=(0,i.DW)("features.correlations")},67490(ne,A,e){"use strict";e.r(A),e.d(A,{AddToDashboardForm:()=>R,default:()=>j});var t=e(74848),n=e(2543),a=e(96540),c=e(49785),r=e(92745),i=e(27489),o=e(37386),l=e(77824),f=e(34999),h=e(22787),d=e(45861),s=e(95506),g=e(73427),v=e(11257),x=e(92138),m=e(43173),p=e(36490),y=e(29043),E=e(4604),b=e(6262),u=(N=>(N.UNKNOWN="unknown-error",N.NAVIGATION="navigation-error",N))(u||{}),D=(N=>(N.FETCH_DASHBOARD="fetch-dashboard",N.SET_DASHBOARD_LS="set-dashboard-ls-error",N))(D||{});function P({panel:N,dashboardUid:V,openInNewTab:w,timeRange:M,options:O}){let U={meta:{},dashboard:{title:"",uid:"",panels:[N],schemaVersion:E.O2}};if(M){const G=M.raw;U.dashboard.time={from:typeof G.from=="string"?G.from:G.from.toISOString(),to:typeof G.to=="string"?G.to:G.to.toISOString()}}try{y.A.setObject(b.us,U)}catch{return{error:"set-dashboard-ls-error",message:(0,r.t)("dashboard-scene.add-to-dashboard.message.could-panel-dashboard-please-again","Could not add panel to dashboard. Please try again.")}}const K=C(V);if(w)return!e.g.open(m.$.appUrl+K,"_blank")?(y.A.delete(b.us),{error:"navigation-error",message:(0,r.t)("dashboard-scene.add-to-dashboard.message.could-navigate-selected-dashboard-please-again","Could not navigate to the selected dashboard. Please try again.")}):void 0;let z=x.I.stripBaseFromUrl(K);O?.useAbsolutePath&&(z="/"+z),p.Ny.push(z)}function C(N){return N?`d/${N}`:"dashboard/new"}var S=(N=>(N.NewDashboard="new-dashboard",N.ExistingDashboard="existing-dashboard",N))(S||{});function R({onClose:N,buildPanel:V,timeRange:w,options:M,children:O}){const[U,K]=(0,a.useState)(),{handleSubmit:z,control:G,formState:{errors:F},watch:W}=(0,c.mN)({defaultValues:{saveTarget:"new-dashboard"}}),H=g.TP.hasPermission(v.w.DashboardsCreate),Y=g.TP.hasPermission(v.w.DashboardsWrite),te=[];H&&te.push({label:(0,r.t)("dashboard-scene.add-to-dashboard-form.label.new-dashboard","New dashboard"),value:"new-dashboard"}),Y&&te.push({label:(0,r.t)("dashboard-scene.add-to-dashboard-form.label.existing-dashboard","Existing dashboard"),value:"existing-dashboard"});const Z=te.length>1?W("saveTarget"):te[0].value,se=(ae,J)=>{K(void 0);const k=J.saveTarget==="existing-dashboard"?J.dashboardUid:void 0,_=V(M);(0,i.rR)("e_2_d_submit",{newTab:ae,saveTarget:J.saveTarget,queries:_.targets});const Q=P({dashboardUid:k,panel:_,openInNewTab:ae,timeRange:w,options:M});if(Q){K(Q);return}N()};return(0,a.useEffect)(()=>{(0,i.rR)("e_2_d_open")},[]),(0,t.jsxs)("form",{children:[O,te.length>1&&(0,t.jsx)(c.xI,{control:G,render:({field:{ref:ae,...J}})=>(0,t.jsx)(o.D,{label:(0,r.t)("dashboard-scene.add-to-dashboard-form.label-target-dashboard","Target dashboard"),description:(0,r.t)("dashboard-scene.add-to-dashboard-form.description-choose-where-to-add-the-panel","Choose where to add the panel."),children:(0,t.jsx)(l.z,{options:te,...J,id:"e2d-save-target"})}),name:"saveTarget"}),Z==="existing-dashboard"&&(0,t.jsx)(c.xI,{render:({field:{ref:ae,value:J,onChange:k,..._}})=>(0,t.jsx)(o.D,{label:(0,r.t)("dashboard-scene.add-to-dashboard-form.label-dashboard","Dashboard"),description:(0,r.t)("dashboard-scene.add-to-dashboard-form.description-select-which-dashboard-panel-created","Select in which dashboard the panel will be created."),error:F.dashboardUid?.message,invalid:!!F.dashboardUid,children:(0,t.jsx)(s.b,{..._,inputId:"e2d-dashboard-picker",defaultOptions:!0,onChange:Q=>k(Q?.uid)})}),control:G,name:"dashboardUid",shouldUnregister:!0,rules:{required:{value:!0,message:(0,r.t)("dashboard-scene.add-to-dashboard-form.message.this-field-is-required","This field is required.")}}}),U&&(0,t.jsx)(f.F,{severity:"error",title:(0,r.t)("dashboard-scene.add-to-dashboard-form.title-error-adding-the-panel","Error adding the panel"),children:U.message}),(0,t.jsxs)(h.a.ButtonRow,{children:[(0,t.jsx)(d.$n,{type:"reset",onClick:N,fill:"outline",variant:"secondary",children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.add-to-dashboard-form.cancel",children:"Cancel"})}),(0,t.jsx)(d.$n,{type:"submit",variant:"secondary",onClick:z((0,n.partial)(se,!0)),icon:"external-link-alt",children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.add-to-dashboard-form.open-in-new-tab",children:"Open in new tab"})}),(0,t.jsx)(d.$n,{type:"submit",variant:"primary",onClick:z((0,n.partial)(se,!1)),icon:"apps",children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.add-to-dashboard-form.open-dashboard",children:"Open dashboard"})})]})]})}function L(N){}const j=R},11968(ne,A,e){"use strict";e.d(A,{U:()=>i});var t=e(44248),n=e(29043),a=e(7817),c=e(6262),r=e(65333);function i(o){const l=n.A.getObject(c.us);if(l){const f=new a.G(l.dashboard);for(const h of f.panels){const d=(0,r.tt)(h);o.addPanel(d.state.body)}if(l.dashboard.time){const h=new t.JZ({from:l.dashboard.time.from,to:l.dashboard.time.to}),d=o.state.$timeRange;d&&d.setState({value:h.state.value,from:h.state.from,to:h.state.to})}}n.A.delete(c.us)}},9634(ne,A,e){"use strict";e.d(A,{J:()=>a});var t=e(44248),n=e(11909);function a(c){const{uid:r,title:i}=c.state;if(!r){console.warn("dashboardAnalyticsInitializer: Dashboard UID is missing");return}(0,t.MV)("DAI","Setting dashboard context for analytics aggregator");const o=(0,n.oc)();return o.initialize(r,i||"Untitled Dashboard"),(0,t.MV)("DAI","Dashboard analytics aggregator context set:",{uid:r,title:i}),()=>{o.destroy(),(0,t.MV)("DAI","Dashboard analytics aggregator context cleared")}}},71199(ne,A,e){"use strict";e.d(A,{B:()=>d});var t=e(74848),n=e(92745),a=e(30703),c=e(76319),r=e(45967),i=e(34999),o=e(66404),l=e(41654),f=e(33143),h=e(87748);function d({children:s,info:g,isObjectSupported:v,model:x,title:m}){return(0,t.jsxs)(l.B,{direction:"column",children:[(0,t.jsxs)(l.B,{direction:"row",gap:1,children:[(0,t.jsx)(o.E,{variant:"bodySmall",children:m}),g&&(0,t.jsx)(r.m,{content:g,children:(0,t.jsx)(a.I,{name:"info-circle"})})]}),(0,t.jsxs)(l.B,{direction:"row",gap:1,justifyContent:"stretch",alignItems:"center",children:[(0,t.jsxs)(l.B,{flex:1,direction:"column",gap:1,children:[s,!v&&(0,t.jsx)(i.F,{severity:"error",title:"",children:(0,t.jsx)(n.x6,{i18nKey:"dashboard.conditional-rendering.conditions.wrapper.unsupported-object-type",children:"This condition is not supported by the element, hence it will be ignored."})})]}),(0,t.jsx)(c.K,{"aria-label":(0,n.t)("dashboard.conditional-rendering.conditions.wrapper.delete-condition","Delete Condition"),name:"trash-alt",onClick:()=>{const p=(0,h.I7)(x);f.cc.edit({description:(0,n.t)("dashboard.conditional-rendering.conditions.wrapper.delete-condition","Delete Condition"),source:x,perform:()=>(0,h.Am)(x),undo:()=>{p>-1&&(0,h.AR)(x,p)}})}})]})]},x.state.key)}},66507(ne,A,e){"use strict";e.d(A,{t:()=>d});var t=e(74848),n=e(96540),a=e(28105),c=e(92745),r=e(44248),i=e(43243),o=e(33143),l=e(32603),f=e(71199),h=e(87748);class d extends r.Bs{constructor(v){super(v),this._dataProvider=void 0,this.addActivationHandler(()=>this._activationHandler())}static{this.Component=s}static{this.serializer={id:"ConditionalRenderingData",name:"Data",deserialize:this.deserialize}}_activationHandler(){if(this.forEachChild(x=>{x.isActive||this._subs.add(x.activate())}),this._dataProvider=this._getObjectDataProvider(),!this._dataProvider)return;const v=this._dataProvider.activate();return this._check(),this._subs.add(this._dataProvider.subscribeToState(()=>this._check())),()=>{v?.()}}_getObjectDataProvider(){const v=(0,h.iM)(this);if(!v)return;let x;for(const m of Object.values(v.state))if(m instanceof r.Eb){x=m;break}if(x)return r.jh.getData(x)??void 0}_check(){const v=this._evaluate();v!==this.state.result&&(this.setState({...this.state,result:v}),(0,h.ah)(this))}_evaluate(){if(!this._dataProvider||!this._dataProvider.state.data||this._dataProvider.state.data.state===a.Gu.Loading||this._dataProvider.state.data.state===a.Gu.NotStarted)return;const v=this._dataProvider?.state.data?.series??[];let x=!1;for(let m=0;m0){x=!0;break}return this.state.value===x}changeValue(v){this.state.value!==v&&(this.setState({value:v}),this._check())}renderCmp(){return(0,t.jsx)(this.Component,{model:this},this.state.key)}serialize(){return{kind:"ConditionalRenderingData",spec:{value:this.state.value}}}static deserialize(v){return new d({value:v.spec.value,result:void 0})}static createEmpty(){return new d({value:!0,result:void 0})}}function s({model:g}){const{value:v}=g.useState(),x=(0,n.useMemo)(()=>[{label:(0,c.t)("dashboard.conditional-rendering.conditions.data.enable","Has data"),value:1},{label:(0,c.t)("dashboard.conditional-rendering.conditions.data.disable","No data"),value:0}],[]),m=(0,n.useMemo)(()=>x.find(y=>!!y.value===v)??x[0],[x,v]),p=(0,h.KG)(g);return(0,t.jsx)(f.B,{info:(0,c.t)("dashboard.conditional-rendering.conditions.data.info","Show or hide the {{type}} based on query results.",{type:(0,l.L9)(p)}),isObjectSupported:p==="panel",model:g,title:(0,c.t)("dashboard.conditional-rendering.conditions.data.label","Query result"),children:(0,t.jsx)(i.G,{options:x,value:m,onChange:({value:y})=>{o.cc.edit({description:(0,c.t)("dashboard.edit-actions.edit-query-result-rule","Change query result rule"),source:g,perform:()=>g.changeValue(!!y),undo:()=>g.changeValue(v)})}})})}},4506(ne,A,e){"use strict";e.d(A,{K:()=>s});var t=e(74848),n=e(96540),a=e(17548),c=e(92745),r=e(44248),i=e(37386),o=e(18857),l=e(33143),f=e(32603),h=e(71199),d=e(87748);class s extends r.Bs{constructor(x){super(x),this.validateIntervalRegex=/^(\d+(?:\.\d+)?)[Mwdhmsy]$/,this.addActivationHandler(()=>this._activationHandler())}static{this.Component=g}static{this.serializer={id:"ConditionalRenderingTimeRangeSize",name:"Time Range Size",deserialize:this.deserialize}}_activationHandler(){this.forEachChild(x=>{x.isActive||this._subs.add(x.activate())}),this._check(),this._subs.add(r.jh.getTimeRange(this).subscribeToState(()=>this._check()))}_check(){const x=this._evaluate();return x!==this.state.result&&(this.setState({...this.state,result:x}),(0,d.ah)(this)),x}_evaluate(){try{if(!this.validateIntervalRegex.test(this.state.value))return;const x=a.intervalToSeconds(this.state.value),m=r.jh.getTimeRange(this);return m.state.value.to.unix()-m.state.value.from.unix()<=x}catch{return}}changeValue(x){this.state.value!==x&&(this.setState({value:x}),this._check())}renderCmp(){return(0,t.jsx)(this.Component,{model:this},this.state.key)}serialize(){return{kind:"ConditionalRenderingTimeRangeSize",spec:{value:this.state.value}}}static deserialize(x){return new s({value:x.spec.value,result:void 0})}static createEmpty(){return new s({value:"7d",result:void 0})}}function g({model:v}){const{value:x}=v.useState(),[m,p]=(0,n.useState)(v.validateIntervalRegex.test(x));(0,n.useEffect)(()=>p(v.validateIntervalRegex.test(x)),[v,x]);const y=(0,n.useMemo)(()=>[{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.minutes","{{value}} minutes",{value:5}),value:"5m"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.minutes","{{value}} minutes",{value:15}),value:"15m"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.minutes","{{value}} minutes",{value:30}),value:"30m"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hour","{{value}} hour",{value:1}),value:"1h"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:3}),value:"3h"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:6}),value:"6h"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:12}),value:"12h"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:24}),value:"24h"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:2}),value:"2d"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:7}),value:"7d"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:30}),value:"30d"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:90}),value:"90d"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.months","{{value}} months",{value:6}),value:"6M"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.year","{{value}} year",{value:1}),value:"1y"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.years","{{value}} years",{value:2}),value:"2y"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.values.years","{{value}} years",{value:5}),value:"5y"}],[]),E=(0,n.useMemo)(()=>y.find(u=>u.value===x)?y:[{label:x,value:x},...y],[y,x]),b=(0,n.useCallback)(u=>{l.cc.edit({description:(0,c.t)("dashboard.edit-actions.edit-time-range-rule","Change time range rule"),source:v,perform:()=>v.changeValue(u??""),undo:()=>v.changeValue(x)})},[v,x]);return(0,t.jsx)(h.B,{info:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.info","Show or hide the {{type}} if the dashboard time range is shorter than the selected time frame.",{type:(0,f.L9)((0,d.KG)(v))}),isObjectSupported:!0,model:v,title:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.label","Time range less than"),children:(0,t.jsx)(i.D,{invalid:!m,error:(0,c.t)("dashboard.conditional-rendering.conditions.time-range-size.invalid-message","Invalid interval"),noMargin:!0,children:(0,t.jsx)(o.l6,{isClearable:!1,allowCustomValue:!0,onCreateOption:u=>b(u),value:x,options:E,onChange:({value:u})=>b(u)})})})}},69523(ne,A,e){"use strict";e.d(A,{H:()=>x});var t=e(74848),n=e(96540),a=e(92745),c=e(44248),r=e(31286),i=e(41654),o=e(37386),l=e(43243),f=e(63527),h=e(33143),d=e(92119),s=e(32603),g=e(71199),v=e(87748);class x extends c.Bs{constructor(y){super(y),this._variableDependency=new c.Sh(this,{onAnyVariableChanged:E=>{E.state.name===this.state.variable&&this._check()}}),this.addActivationHandler(()=>this._activationHandler())}static{this.Component=m}static{this.serializer={id:"ConditionalRenderingVariable",name:"Variable",deserialize:this.deserialize}}_activationHandler(){this.forEachChild(y=>{y.isActive||this._subs.add(y.activate())}),this._check()}_check(){const y=this._evaluate();y!==this.state.result&&(this.setState({result:y}),(0,v.ah)(this))}_evaluate(){if(!this.state.variable)return;const y=c.jh.getVariables(this).getByName(this.state.variable);if(!y)return;const E=y.getValue()??"";let b;if(this.state.operator==="="||this.state.operator==="!=")b=Array.isArray(E)?E.includes(this.state.value.toString()):E===this.state.value.toString();else try{const u=new RegExp(this.state.value);b=Array.isArray(E)?E.some(D=>u.test(D.toString())):u.test(E.toString())}catch{return!0}return this.state.operator==="!="||this.state.operator==="!~"?!b:b}changeVariable(y){this.state.variable!==y&&(this.setState({variable:y}),this._check())}changeOperator(y){this.state.operator!==y&&(this.setState({operator:y}),this._check())}changeValue(y){this.state.value!==y&&(this.setState({value:y}),this._check())}renderCmp(){return(0,t.jsx)(this.Component,{model:this},this.state.key)}serialize(){return{kind:"ConditionalRenderingVariable",spec:{variable:this.state.variable,operator:this._getLongOperator(this.state.operator),value:this.state.value}}}static deserialize(y){return new x({variable:y.spec.variable,operator:x._getShortOperator(y.spec.operator),value:y.spec.value,result:void 0})}static createEmpty(y){return new x({variable:y,operator:"=",value:"",result:void 0})}_getLongOperator(y){switch(y){case"=":return"equals";case"!=":return"notEquals";case"=~":return"matches";case"!~":return"notMatches"}}static _getShortOperator(y){switch(y){case"equals":return"=";case"notEquals":return"!=";case"matches":return"=~";case"notMatches":return"!~"}}}function m({model:p}){const{variable:y,operator:E,value:b}=p.useState(),[u,D]=(0,n.useState)(b);(0,n.useEffect)(()=>D(b),[b]);const P=c.jh.getVariables((0,d.YQ)(p)),C=(0,n.useMemo)(()=>P.state.variables.map(j=>({value:j.state.name,label:j.state.label??j.state.name})),[P.state.variables]),S=(0,n.useMemo)(()=>[{value:"=",description:(0,a.t)("dashboard.conditional-rendering.conditions.variable.operator.equals","Equals")},{value:"!=",description:(0,a.t)("dashboard.conditional-rendering.conditions.variable.operator.not-equals","Not equals")},{value:"=~",description:(0,a.t)("dashboard.conditional-rendering.conditions.variable.operator.matches","Matches")},{value:"!~",description:(0,a.t)("dashboard.conditional-rendering.conditions.variable.operator.not-matches","Not matches")}],[]),R=(0,n.useMemo)(()=>{if(E==="=~"||E==="!~")try{return new RegExp(u),""}catch{return(0,a.t)("dashboard.conditional-rendering.conditions.variable.error.invalid-regex","Invalid regex")}return""},[u,E]),L=(0,a.t)("dashboard.edit-actions.edit-template-variable-rule","Change template variable rule");return(0,t.jsx)(g.B,{info:(0,a.t)("dashboard.conditional-rendering.conditions.variable.info","Show or hide the {{type}} dynamically based on the variable value.",{type:(0,s.L9)((0,v.KG)(p))}),isObjectSupported:!0,model:p,title:(0,a.t)("dashboard.conditional-rendering.conditions.variable.label","Template variable"),children:(0,t.jsxs)(i.B,{direction:"column",gap:.5,children:[(0,t.jsxs)(i.B,{direction:"row",gap:.5,grow:1,children:[(0,t.jsx)(r.a,{flex:1,children:(0,t.jsx)(l.G,{placeholder:(0,a.t)("dashboard.conditional-rendering.conditions.variable.name","Name"),options:C,value:y,onChange:j=>{const N=j.value;N!==y&&h.cc.edit({description:L,source:p,perform:()=>p.changeVariable(N),undo:()=>p.changeVariable(y)})}})}),(0,t.jsx)(l.G,{width:"auto",minWidth:10,options:S,value:E,onChange:j=>{const N=j.value;N!==E&&h.cc.edit({description:L,source:p,perform:()=>p.changeOperator(N),undo:()=>p.changeOperator(E)})}})]}),(0,t.jsx)(o.D,{error:R,invalid:!!R,noMargin:!0,children:(0,t.jsx)(f.p,{placeholder:(0,a.t)("dashboard.conditional-rendering.conditions.variable.value","Value"),value:u,onChange:j=>{j.currentTarget.value!==b&&D(j.currentTarget.value)},onBlur:()=>{u!==b&&h.cc.edit({description:L,source:p,perform:()=>p.changeValue(u),undo:()=>p.changeValue(b)})}})})]})})}},87748(ne,A,e){"use strict";e.d(A,{AR:()=>l,Am:()=>o,I7:()=>f,KG:()=>i,ah:()=>h,iM:()=>r});var t=e(44248),n=e(6048),a=e(32603);function c(d){return d.parent instanceof n.M?d.parent:t.jh.getAncestor(d,n.M)}function r(d){return c(d).parent}function i(d){return(0,a.dQ)(r(d))}function o(d){c(d).removeCondition(d)}function l(d,s){c(d).undoRemoveCondition(d,s)}function f(d){return c(d).getConditionIndex(d)}function h(d){c(d).check()}},6048(ne,A,e){"use strict";e.d(A,{M:()=>u});var t=e(74848),n=e(2543),a=e(96540),c=e(92745),r=e(44248),i=e(41654),o=e(33143),l=e(92119),f=e(66507),h=e(4506),d=e(69523),s=e(42954);const g=new s.O(()=>[d.H.serializer,f.t.serializer,h.K.serializer]);var v=e(32603),x=e(59695);const m=({objectType:P,hasVariables:C,onAdd:S})=>{const R=(0,a.useMemo)(()=>{const L=[{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.add.data","Query result"),value:"data"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.add.variable","Template variable"),value:"variable",isDisabled:!C},{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.add.time-range-size","Time range less than"),value:"timeRangeSize"}];return P!=="panel"&&L.shift(),L},[P,C]);return(0,t.jsx)(x.i,{isFullWidth:!0,size:"sm",icon:"plus",variant:"secondary",label:(0,c.t)("dashboard.conditional-rendering.conditions.group.add.button","Add rule"),options:R,onChange:L=>S(L)})};var p=e(37386),y=e(77824);const E=({value:P,onChange:C})=>{const S=(0,a.useMemo)(()=>[{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.condition.all","Match all"),value:"and"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.condition.any","Match any"),value:"or"}],[]);return(0,t.jsx)(p.D,{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.condition.label","Match rules"),noMargin:!0,children:(0,t.jsx)(y.z,{fullWidth:!0,options:S,value:P,onChange:C})})},b=({objectType:P,value:C,onChange:S})=>{const R=(0,a.useMemo)(()=>[{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.visibility.show","Show"),value:"show"},{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.visibility.hide","Hide"),value:"hide"}],[]);return(0,t.jsx)(p.D,{label:(0,c.t)("dashboard.conditional-rendering.conditions.group.visibility.label","{{type}} visibility",{type:(0,v.uT)(P)}),noMargin:!0,children:(0,t.jsx)(y.z,{fullWidth:!0,options:R,value:C,onChange:S})})};class u extends r.Bs{static{this.Component=D}constructor(C){super(C),this._shouldShow=C.visibility==="show",this._shouldMatchAll=C.condition==="and",this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this.forEachChild(C=>{C.isActive||this._subs.add(C.activate())}),this.check()}check(){const C=this.state.conditions.filter(R=>R.state.result!==void 0);let S=!0;C.length>0&&(S=this._shouldMatchAll?C.every(R=>R.state.result):C.some(R=>R.state.result),this._shouldShow||(S=!S)),S!==this.state.result&&(this.setState({...this.state,result:S}),this.publishEvent(new o.N4(this),!0))}changeVisibility(C){C!==this.state.visibility&&(this._shouldShow=C==="show",this.setState({visibility:C}),this.check())}changeCondition(C){C!==this.state.condition&&(this._shouldMatchAll=C==="and",this.setState({condition:C}),this.check())}createCondition(C){switch(C){case"data":return f.t.createEmpty();case"timeRangeSize":return h.K.createEmpty();case"variable":return d.H.createEmpty(r.jh.getVariables((0,l.YQ)(this)).state.variables[0].state.name)}}addCondition(C){const S=[...this.state.conditions,C];this.setState({conditions:S,renderHidden:S.some(R=>R instanceof f.t)}),this.isActive&&!C.isActive&&C.activate(),this.check()}removeCondition(C){const S=this.state.conditions.filter(R=>R!==C);this.setState({conditions:S,renderHidden:S.some(R=>R instanceof f.t)}),this.check()}undoRemoveCondition(C,S){const R=[...this.state.conditions];R.splice(S,0,C),this.setState({conditions:R}),this.check()}removeLastCondition(){const C=[...this.state.conditions];C.pop(),this.setState({conditions:C}),this.check()}getConditionIndex(C){return this.state.conditions.findIndex(S=>S===C)}serialize(){return{kind:"ConditionalRenderingGroup",spec:{visibility:this.state.visibility,condition:this.state.condition,items:this.state.conditions.map(C=>C.serialize())}}}static createEmpty(){return new u({condition:"and",visibility:"show",conditions:[],result:!0,renderHidden:!1})}static deserialize(C){const S=C.spec.items.map(R=>g.get(R.kind).deserialize(R));return new u({condition:C.spec.condition,visibility:C.spec.visibility,conditions:S,result:!0,renderHidden:S.some(R=>R instanceof f.t)})}}function D({model:P}){const{condition:C,visibility:S,conditions:R}=P.useState(),{variables:L}=r.jh.getVariables(P).useState(),j=(0,a.useMemo)(()=>(0,v.dQ)(P.parent),[P]);return(0,t.jsxs)(i.B,{direction:"column",gap:2,children:[(0,t.jsx)(b,{objectType:j,value:S,onChange:N=>{o.cc.edit({description:(0,c.t)("dashboard.conditional-rendering.conditions.group.visibility.label","{{type}} visibility",{type:(0,v.uT)(j)}),source:P,perform:()=>P.changeVisibility(N),undo:()=>P.changeVisibility(S)})}}),R.length>1&&(0,t.jsx)(E,{value:C,onChange:N=>{o.cc.edit({description:(0,c.t)("dashboard.conditional-rendering.conditions.group.condition.label","Match rules"),source:P,perform:()=>P.changeCondition(N),undo:()=>P.changeCondition(C)})}}),R.map(N=>N.renderCmp()),(0,t.jsx)(m,{objectType:j,hasVariables:L.length>0,onAdd:({value:N,label:V})=>{const w=P.createCondition(N);o.cc.edit({description:(0,c.t)("dashboard.edit-actions.add-conditional-rule","Add {{ruleDescription}} rule",{ruleDescription:(0,n.lowerCase)(V)}),source:P,perform:()=>P.addCondition(w),undo:()=>P.removeLastCondition()})}})]})}},78725(ne,A,e){"use strict";e.d(A,{h:()=>s});var t=e(74848),n=e(92745),a=e(30703),c=e(45967),r=e(41654),i=e(25797),o=e(51156),l=e(6048),f=e(32603);let h;function d(){return h||(h=l.M.createEmpty()),h}function s(g,v){const x=(0,n.t)("dashboard.conditional-rendering.root.title","Show / hide rules"),m=g??d();return new i.C({title:x,disabledText:g?void 0:v??(0,n.t)("dashboard.conditional-rendering.editor.unsupported-object-type","Conditional rendering not supported for this item type"),id:"conditional-rendering-options",renderTitle:()=>{const{result:p}=m.useState();return(0,t.jsxs)(r.B,{direction:"row",gap:1,alignItems:"center",children:[(0,t.jsx)("div",{children:x}),g?(0,t.jsx)(c.m,{content:(0,n.t)("dashboard.conditional-rendering.editor.info","Set rules to control {{type}} visibility by matching any or all rules.",{type:(0,f.L9)((0,f.dQ)(m.parent))}),children:(0,t.jsx)(a.I,{name:p?"eye":"eye-slash"})}):(0,t.jsx)(a.I,{name:"eye-slash"})]})},isOpenDefault:!0}).addItem(new o.v({title:x,id:"conditional-rendering-options-item",render:()=>(0,t.jsx)(m.Component,{model:m})}))}},86292(ne,A,e){"use strict";e.d(A,{H:()=>g});var t=e(74848),n=e(44248),a=e(6048),c=e(22803),r=e(92745),i=e(63142),o=e(45967),l=e(30703);const f=()=>{const v=(0,i.of)(h);return(0,t.jsx)("div",{className:v.container,children:(0,t.jsx)(o.m,{content:(0,r.t)("dashboard.conditional-rendering.overlay.tooltip","Element is hidden by show/hide rules."),children:(0,t.jsx)(l.I,{name:"eye-slash"})})})},h=v=>({container:(0,c.css)({display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",width:"100%",height:"100%",bottom:0,right:0,zIndex:1,[v.transitions.handleMotion("no-preference","reduce")]:{transition:"all 0.2s ease"},"&:before":(0,c.css)({content:'""',opacity:.6,position:"absolute",width:"100%",height:"100%",top:0,left:0,backgroundColor:v.colors.background.canvas,pointerEvents:"none"}),"& > svg":(0,c.css)({height:"48px",width:"48px",maxWidth:"75%",maxHeight:"75%"}),".dashboard-visible-hidden-element:hover > &":(0,c.css)({width:"30px",height:"30px",top:"unset",left:"unset",right:0,bottom:0})})});let d;function s(){return d||(d=a.M.createEmpty()),d}function g(v){const x="conditionalRendering"in v.state&&v.state.conditionalRendering instanceof a.M?v.state.conditionalRendering:s(),{result:m,renderHidden:p}=(0,n.gn)(x,{shouldActivateOrKeepAlive:!0});return[!m,m?void 0:"dashboard-visible-hidden-element",m?null:(0,t.jsx)(f,{}),p]}},32603(ne,A,e){"use strict";e.d(A,{L9:()=>h,dQ:()=>d,uT:()=>f});var t=e(2543),n=e.n(t),a=e(92745),c=e(25953),r=e(97335),i=e(30643);const o={get panel(){return(0,a.t)("dashboard.edit-pane.elements.panel","Panel")},get row(){return(0,a.t)("dashboard.edit-pane.elements.row","Row")},get tab(){return(0,a.t)("dashboard.edit-pane.elements.tab","Tab")},get element(){return(0,a.t)("dashboard.edit-pane.elements.element","Element")}},l={get panel(){return(0,t.lowerCase)((0,a.t)("dashboard.edit-pane.elements.panel","Panel"))},get row(){return(0,t.lowerCase)((0,a.t)("dashboard.edit-pane.elements.row","Row"))},get tab(){return(0,t.lowerCase)((0,a.t)("dashboard.edit-pane.elements.tab","Tab"))},get element(){return(0,t.lowerCase)((0,a.t)("dashboard.edit-pane.elements.element","Element"))}};function f(s){return o[s]??(0,t.capitalize)(s)}function h(s){return l[s]??s}function d(s){if(s){if(s instanceof c.X)return"panel";if(s instanceof r.o)return"row";if(s instanceof i.V)return"tab"}else return"element";return"element"}},33143(ne,A,e){"use strict";e.d(A,{N4:()=>_e,BF:()=>Je,WG:()=>et,jO:()=>Re,ck:()=>we,su:()=>Ce,cc:()=>qe,wT:()=>Oe,JU:()=>ot,dt:()=>Be});var t=e(88544),n=e(68388),a=e(92745),c=e(44248),r=e(11534),i=e(74848),o=e(96540),l=e(51898),f=e(63527),h=e(34999),d=e(89640),s=e(25797),g=e(51156),v=e(31819),x=e(9931),m=e(18615),p=e(92119),y=e(1131),E=e(87308);function b(Ze){const at=(0,o.useMemo)(()=>new s.C({title:(0,a.t)("dashboard.default-layout.row-options.title","Row options"),id:"row-options",isOpenDefault:!0}).addItem(new g.v({title:(0,a.t)("dashboard.default-layout.row-options.form.title","Title"),id:"row-options-title",render:()=>(0,i.jsx)(D,{row:Ze})})),[Ze]),it=(0,o.useMemo)(()=>{const ct=(0,p.YQ)(Ze);return new s.C({title:(0,a.t)("dashboard.default-layout.row-options.repeat.title","Repeat options"),id:"row-repeat-options",isOpenDefault:!0}).addItem(new g.v({title:(0,a.t)("dashboard.default-layout.row-options.repeat.variable.title","Variable"),id:"row-options-repeat-variable",render:()=>(0,i.jsx)(P,{row:Ze,dashboard:ct})}))},[Ze]);return[at,it]}class u{constructor(at){this._row=at,this.isEditableDashboardElement=!0,this.useEditPaneOptions=b.bind(this,this._row)}getEditableElementInfo(){return{typeName:(0,a.t)("dashboard.edit-pane.elements.row","Row"),instanceName:c.jh.interpolate(this._row,this._row.state.title,void 0,"text"),icon:"list-ul"}}getOutlineChildren(){return this._row.state.children}onDelete(){const at=(0,p.h$)(this._row);at instanceof y.D&&at.removeRow(this._row)}}function D({row:Ze,id:at}){const{title:it}=Ze.useState();return(0,i.jsx)(f.p,{id:at,value:it,onChange:ct=>Ze.setState({title:ct.currentTarget.value})})}function P({row:Ze,dashboard:at,id:it}){const{$behaviors:ct,children:xt}=Ze.useState();let dt=ct?.find($t=>$t instanceof E.L);const wt=(0,o.useMemo)(()=>xt.reduce(($t,_t)=>[...$t,...c.jh.findDescendents(_t,c.Eb)],[]),[xt]).some($t=>{const _t=(0,p.un)($t);return _t?.state.datasource?.uid===x.K||_t?.state.datasource?.uid===m.uv&&_t?.state.queries.some(tn=>tn.datasource?.uid===x.K)});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v.U,{id:it,sceneContext:at,repeat:dt?.state.variableName,onChange:$t=>{$t?(dt?.removeBehavior(),dt=new E.L({variableName:$t}),Ze.setState({$behaviors:[...Ze.state.$behaviors??[],dt]})):dt?.removeBehavior()}}),wt?(0,i.jsxs)(h.F,{"data-testid":l.Tp.pages.Dashboard.Rows.Repeated.ConfigSection.warningMessage,severity:"warning",title:"",topSpacing:3,bottomSpacing:0,children:[(0,i.jsx)("p",{children:(0,i.jsxs)(a.x6,{i18nKey:"dashboard.default-layout.row-options.form.repeat-for.warning.text",children:["Panels in this row use the ",{SHARED_DASHBOARD_QUERY:x.K}," data source. These panels will reference the panel in the original row, not the ones in the repeated rows."]})}),(0,i.jsx)(d.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/create-dashboard/#configure-repeating-rows",children:(0,i.jsx)(a.x6,{i18nKey:"dashboard.default-layout.row-options.form.repeat-for.learn-more",children:"Learn more"})})]}):void 0]})}var C=e(95395);function S(Ze){return"isEditableDashboardElement"in Ze}var R=e(31286),L=e(41654);function j(){const Ze=this.variable,at=(0,o.useId)(),it=(0,o.useId)();return(0,o.useMemo)(()=>{const ct=new s.C({title:"",id:at});return ct.addItem(new g.v({title:"",id:it,skipField:!0,render:()=>(0,i.jsx)(R.a,{paddingBottom:1,children:(0,i.jsx)(L.B,{children:(0,i.jsxs)(L.B,{children:[(0,i.jsxs)("span",{children:["$",Ze.state.name]}),(0,i.jsx)("span",{children:"="}),(0,i.jsx)("span",{children:Ze.getValueText()})]})})})})),[ct]},[at,it,Ze])}class N{constructor(at){this.variable=at,this.isEditableDashboardElement=!0,this.useEditPaneOptions=j.bind(this)}getEditableElementInfo(){return{typeName:(0,a.t)("dashboard.edit-pane.elements.local-variable","Local variable"),icon:"dollar-alt",instanceName:`\xA0$${this.variable.state.name} = ${this.variable.getValueText()}`,isHidden:!0}}}var V=e(34440),w=e(7389),M=e(36490),O=e(37386),U=e(87105),K=e(45861),z=e(20246),G=e(29),F=e(37674),W=e(21285);function H(Ze){const at=(0,o.useId)(),it=(0,o.useId)(),ct=(0,o.useId)(),xt=(0,o.useId)();return(0,o.useMemo)(()=>new s.C({title:(0,a.t)("dashboard.edit-pane.variable.selection-options.category","Selection options"),id:"selection-options-category",isOpenDefault:!0}).addItem(new g.v({title:(0,a.t)("dashboard.edit-pane.variable.selection-options.multi-value","Multi-value"),id:at,render:dt=>(0,i.jsx)(Y,{id:dt.props.id,variable:Ze})})).addItem(new g.v({title:(0,a.t)("dashboard.edit-pane.variable.selection-options.include-all","Include All value"),id:it,description:(0,a.t)("dashboard.edit-pane.variable.selection-options.include-all-description","Enables a single option that represent all values"),render:dt=>(0,i.jsx)(te,{id:dt.props.id,variable:Ze})})).addItem(new g.v({title:(0,a.t)("dashboard.edit-pane.variable.selection-options.custom-all-value","Custom all value"),id:ct,description:(0,a.t)("dashboard.edit-pane.variable.selection-options.custom-all-value-description","A wildcard regex or other value to represent All"),useShowIf:()=>Ze.useState().includeAll??!1,render:dt=>(0,i.jsx)(se,{id:dt.props.id,variable:Ze})})).addItem(new g.v({title:(0,a.t)("dashboard.edit-pane.variable.selection-options.allow-custom-values","Allow custom values"),id:xt,description:(0,a.t)("dashboard.edit-pane.variable.selection-options.allow-custom-values-description","Enables users to enter values"),render:dt=>(0,i.jsx)(Z,{id:dt.props.id,variable:Ze})})),[xt,ct,it,at,Ze])}function Y({variable:Ze,id:at}){const{isMulti:it}=Ze.useState();return(0,i.jsx)(W.d,{id:at,value:it,onChange:ct=>Ze.setState({isMulti:ct.currentTarget.checked})})}function te({variable:Ze,id:at}){const{includeAll:it}=Ze.useState();return(0,i.jsx)(W.d,{id:at,value:it,onChange:ct=>Ze.setState({includeAll:ct.currentTarget.checked})})}function Z({variable:Ze,id:at}){const{allowCustomValue:it}=Ze.useState();return(0,i.jsx)(W.d,{id:at,value:it,onChange:ct=>Ze.setState({allowCustomValue:ct.currentTarget.checked})})}function se({variable:Ze,id:at}){const{allValue:it}=Ze.useState(),ct=(0,o.useRef)(null),xt=(0,o.useCallback)(dt=>{const vt=dt.currentTarget.value;vt!==Ze.state.allValue&&(Ze.setState({allValue:vt}),Ze.hasAllValue()&&Ze.publishEvent(new c.oh(Ze),!0))},[Ze]);return(0,i.jsx)(f.p,{id:at,ref:ct,defaultValue:it??"",onBlur:xt})}function ae(Ze){const at=this.variable,it=(0,o.useId)(),ct=(0,o.useId)(),xt=(0,o.useId)(),dt=(0,o.useId)(),vt=(0,o.useId)();if(at instanceof c.xc)return ee(at);const $t=[(0,o.useMemo)(()=>new s.C({title:"",id:it}).addItem(new g.v({title:"",id:ct,skipField:!0,render:()=>(0,i.jsx)(k,{variable:at,isNewElement:Ze})})).addItem(new g.v({title:(0,a.t)("dashboard.edit-pane.variable.label","Label"),id:xt,description:(0,a.t)("dashboard.edit-pane.variable.label-description","Optional display name"),render:()=>(0,i.jsx)(_,{variable:at})})).addItem(new g.v({title:(0,a.t)("dashboard.edit-pane.variable.description","Description"),id:dt,render:()=>(0,i.jsx)(Q,{variable:at})})).addItem(new g.v({title:"",id:vt,skipField:!0,render:()=>(0,i.jsx)(q,{variable:at})})),[it,ct,xt,dt,vt,at,Ze])],_t=oe(at);return $t.push(_t),at instanceof c.n8&&$t.push(H(at)),$t}class J{constructor(at){this.variable=at,this.isEditableDashboardElement=!0,this.typeName="Variable",this.useEditPaneOptions=ae.bind(this)}getEditableElementInfo(){if(this.variable instanceof c.xc)return{typeName:(0,a.t)("dashboard.edit-pane.elements.local-variable","Local variable"),icon:"dollar-alt",instanceName:this.variable.state.name,isHidden:!0};const at=(0,F.IO)(this.variable.state.type);return{typeName:(0,a.t)("dashboard.edit-pane.elements.variable","{{type}} variable",{type:at.name}),icon:"dollar-alt",instanceName:this.variable.state.name,isHidden:this.variable.state.hide===w.zL.hideVariable}}onDelete(){const at=this.variable.parent;at instanceof c.Pj&&qe.removeVariable({source:at,removedObject:this.variable})}onChangeName(at){this.variable.setState({name:at});const it=(0,F.c$)(this.variable,at);if(it.errorMessage)return it}}function k({variable:Ze,isNewElement:at}){const{name:it}=Ze.useState(),ct=(0,z.z4)({autoFocus:at}),[xt,dt]=(0,o.useState)(),vt=(0,o.useId)(),wt=_t=>{const tn=(0,F.c$)(Ze,_t.currentTarget.value);tn.errorMessage!==xt&&dt(tn.errorMessage),Ze.setState({name:_t.currentTarget.value})},$t=(0,o.useRef)(it);return(0,i.jsx)(O.D,{label:(0,a.t)("dashboard.edit-pane.variable.name","Name"),invalid:!!xt,error:xt,children:(0,i.jsx)(f.p,{id:vt,ref:ct,value:it,onFocus:()=>{$t.current=it},onChange:wt,onBlur:_t=>{const gt=$t.current===it||ot(_t);if(xt){dt(void 0),Ze.setState({name:$t.current});return}gt||qe.changeVariableName({source:Ze,oldValue:$t.current,newValue:it})},"data-testid":l.Tp.components.PanelEditor.ElementEditPane.variableNameInput,required:!0})})}function _({variable:Ze,id:at}){const{label:it}=Ze.useState(),ct=(0,o.useRef)(it??"");return(0,i.jsx)(f.p,{id:at,value:it,onFocus:()=>{ct.current=it??""},onChange:xt=>Ze.setState({label:xt.currentTarget.value}),onBlur:xt=>{ct.current===xt.currentTarget.value||ot(xt)||qe.changeVariableLabel({source:Ze,oldValue:ct.current,newValue:xt.currentTarget.value})},"data-testid":l.Tp.components.PanelEditor.ElementEditPane.variableLabelInput})}function Q({variable:Ze,id:at}){const{description:it}=Ze.useState(),ct=(0,o.useRef)(it??"");return(0,i.jsx)(U.f,{id:at,value:it??"",placeholder:(0,a.t)("dashboard.edit-pane.variable.description-placeholder","Descriptive text"),onFocus:()=>{ct.current=it??""},onChange:xt=>Ze.setState({description:xt.currentTarget.value}),onBlur:xt=>{ct.current===xt.currentTarget.value||ot(xt)||qe.changeVariableDescription({source:Ze,oldValue:ct.current,newValue:xt.currentTarget.value})}})}function q({variable:Ze}){const{hide:at=w.zL.dontHide}=Ze.useState(),it=ct=>{qe.changeVariableHideValue({source:Ze,oldValue:at,newValue:ct})};return(0,i.jsx)(G.D,{hide:at,type:Ze.state.type,onChange:it})}function oe(Ze){const at=(0,o.useId)();return(0,o.useMemo)(()=>{const it=(0,F.IO)(Ze.state.type),ct=(0,a.t)("dashboard.edit-pane.variable.type-category","{{type}} options",{type:it.name}),xt=new s.C({title:ct,id:"variable-type",isOpenDefault:!0});return it.getOptions?it.getOptions(Ze).forEach(vt=>xt.addItem(vt)):xt.addItem(new g.v({title:"",id:at,skipField:!0,render:()=>(0,i.jsx)(re,{variable:Ze})})),xt},[at,Ze])}function re({variable:Ze}){const at=()=>{const it=Ze.parent;if(!(it instanceof c.Pj))return;const ct=it.state.variables.indexOf(Ze);M.Ny.partial({editview:"variables",editIndex:ct})};return(0,i.jsx)(R.a,{display:"flex",direction:"column",paddingBottom:1,children:(0,i.jsx)(K.$n,{tooltip:(0,a.t)("dashboard.edit-pane.variable.open-editor-tooltip","For more variable options open variable editor"),onClick:at,size:"sm",fullWidth:!0,children:(0,i.jsx)(a.x6,{i18nKey:"dashboard.edit-pane.variable.open-editor",children:"Open variable editor"})})})}function ee(Ze){const at=(0,o.useId)(),it=(0,o.useId)();return(0,o.useMemo)(()=>{const ct=new s.C({title:"",id:at});return ct.addItem(new g.v({title:"",id:it,skipField:!0,render:()=>(0,i.jsx)(R.a,{paddingBottom:1,children:(0,i.jsx)(L.B,{children:(0,i.jsxs)(L.B,{children:[(0,i.jsxs)("span",{children:["$",Ze.state.name]}),(0,i.jsx)("span",{children:"="}),(0,i.jsx)("span",{children:Ze.getValueText()})]})})})})),[ct]},[it,at,Ze])}var B=e(22803),ie=e(63142),de=e(66404),fe=e(23289);function ce(Ze){const at=(0,o.useId)();return[(0,o.useMemo)(()=>new s.C({title:"",id:"variables"}).addItem(new g.v({title:"",id:at,skipField:!0,render:()=>(0,i.jsx)(Se,{set:Ze})})),[Ze,at])]}class ve{constructor(at){this.set=at,this.isEditableDashboardElement=!0,this.typeName="Variable",this.useEditPaneOptions=ce.bind(this,this.set)}getEditableElementInfo(){return{typeName:(0,a.t)("dashboard.edit-pane.elements.variable-set","Variables"),icon:"x",instanceName:(0,a.t)("dashboard.edit-pane.elements.variable-set","Variables")}}getOutlineChildren(){return this.set.state.variables}}function Se({set:Ze}){const{variables:at}=Ze.useState(),it=(0,ie.of)(je),ct=Ze.parent instanceof r.H$,xt=(0,o.useCallback)(vt=>{const{editPane:wt}=(0,p.YQ)(Ze).state;wt.selectObject(vt,vt.state.key)},[Ze]),dt=(0,o.useCallback)(()=>{(0,V.I)((0,p.YQ)(Ze)),fe.c.addVariableButtonClicked({source:"edit_pane"})},[Ze]);return(0,i.jsxs)(L.B,{direction:"column",gap:0,children:[at.map(vt=>(0,i.jsxs)("div",{className:it.variableItem,onClick:()=>xt(vt),children:[(0,i.jsxs)(de.E,{children:["$",vt.state.name]}),(0,i.jsx)(L.B,{direction:"row",gap:1,alignItems:"center",children:(0,i.jsx)(K.$n,{variant:"primary",size:"sm",fill:"outline",children:(0,i.jsx)(a.x6,{i18nKey:"dashboard.edit-pane.variables.select-variable",children:"Select"})})})]},vt.state.name)),ct&&(0,i.jsx)(R.a,{paddingBottom:1,display:"flex",children:(0,i.jsx)(K.$n,{fullWidth:!0,icon:"plus",size:"sm",variant:"secondary",onClick:dt,"data-testid":l.Tp.components.PanelEditor.ElementEditPane.addVariableButton,children:(0,i.jsx)(a.x6,{i18nKey:"dashboard.edit-pane.variables.add-variable",children:"Add variable"})})})]})}function je(Ze){return{variableItem:(0,B.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:Ze.spacing(1),padding:Ze.spacing(.5),borderRadius:Ze.shape.radius.default,cursor:"pointer",[Ze.transitions.handleMotion("no-preference","reduce")]:{transition:Ze.transitions.create(["color"],{duration:Ze.transitions.duration.short})},"&:last-child":{marginBottom:Ze.spacing(2)},button:{visibility:"hidden"},"&:hover":{color:Ze.colors.text.link,button:{visibility:"visible"}}})}}var Ve=e(27160),he=e(30703);const Ue=({dashboard:Ze})=>(0,i.jsx)(K.$n,{size:"sm",variant:"secondary",tooltip:(0,a.t)("dashboard.toolbar.new.edit-dashboard-v2-schema.tooltip","Edit dashboard v2 schema"),icon:(0,i.jsx)(he.I,{name:"brackets-curly",size:"lg",type:"default"}),onClick:()=>Ze.openV2SchemaEditor()});function pe(Ze){const{body:at}=Ze.useState(),it=(0,o.useId)(),ct=(0,o.useId)(),xt=(0,o.useMemo)(()=>new s.C({title:"",id:"dashboard-options"}).addItem(new g.v({title:(0,a.t)("dashboard.options.title-option","Title"),id:it,render:()=>(0,i.jsx)(ze,{id:it,dashboard:Ze})})).addItem(new g.v({title:(0,a.t)("dashboard.options.description","Description"),id:ct,render:()=>(0,i.jsx)(Ne,{id:ct,dashboard:Ze})})),[Ze,ct,it]),dt=(0,Ve.W)(at);return[xt,...dt]}class be{constructor(at){this.dashboard=at,this.isEditableDashboardElement=!0,this.useEditPaneOptions=pe.bind(this,this.dashboard)}getEditableElementInfo(){return{typeName:(0,a.t)("dashboard.edit-pane.elements.dashboard","Dashboard"),icon:"apps",instanceName:(0,a.t)("dashboard.edit-pane.elements.dashboard","Dashboard")}}getOutlineChildren(){const{$variables:at,body:it}=this.dashboard.state;return[at,...it.getOutlineChildren()]}renderActions(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Ue,{dashboard:this.dashboard}),(0,i.jsx)(K.$n,{variant:"secondary",size:"sm",onClick:()=>this.dashboard.onOpenSettings(),tooltip:(0,a.t)("dashboard.toolbar.dashboard-settings.tooltip","Dashboard settings"),icon:"sliders-v-alt",iconPlacement:"right",children:(0,i.jsx)(a.x6,{i18nKey:"dashboard.actions.open-settings",children:"Settings"})})]})}}function ze({dashboard:Ze,id:at}){const{title:it}=Ze.useState(),ct=(0,o.useRef)("");return(0,i.jsx)(f.p,{id:at,value:it,onChange:xt=>{Ze.setState({title:xt.currentTarget.value})},onFocus:xt=>{ct.current=xt.currentTarget.value},onBlur:xt=>{ct.current===xt.currentTarget.value||ot(xt)||qe.changeTitle({source:Ze,oldValue:ct.current,newValue:xt.currentTarget.value})}})}function Ne({dashboard:Ze,id:at}){const{description:it}=Ze.useState(),ct=(0,o.useRef)("");return(0,i.jsx)(U.f,{id:at,value:it,onChange:xt=>Ze.setState({description:xt.currentTarget.value}),onFocus:xt=>{ct.current=xt.currentTarget.value},onBlur:xt=>{ct.current===xt.currentTarget.value||ot(xt)||qe.changeDescription({source:Ze,oldValue:ct.current,newValue:xt.currentTarget.value})}})}var Ie=e(73427),ke=e(87745),Ee=e(22175),Ae=e(25953),$e=e(93389),Fe=e(3688),We=e(1682),Ge=e(24726);class me{constructor(at){this._panels=at,this.isEditableDashboardElement=!0,this.key=(0,Ge.A)()}getEditableElementInfo(){return{typeName:(0,a.t)("dashboard.edit-pane.elements.panels","Panels"),icon:"folder",instanceName:""}}useEditPaneOptions(){return[new s.C({title:"",id:""})]}onConfirmDelete(){Ie.lE.publish(new ke.bY({title:(0,a.t)("dashboard.edit-pane.elements.multiple-panels","Multiple panels"),text:(0,a.t)("dashboard.edit-pane.elements.multiple-panels-delete-text","Are you sure you want to delete these panels? All queries will be removed."),onConfirm:()=>this.onDelete()}))}onDelete(){this._panels.forEach(at=>{at.onDelete()})}}function De(Ze){const at=this.panel,it=at.parent,ct=(0,o.useId)(),xt=(0,o.useId)(),dt=(0,o.useId)(),vt=(0,o.useId)(),wt=(0,o.useMemo)(()=>new s.C({title:"",id:"panel-options"}).addItem(new g.v({title:"",id:ct,render:()=>(0,i.jsx)(Me,{panel:this.panel})})).addItem(new g.v({title:(0,a.t)("dashboard.viz-panel.options.title-option","Title"),id:xt,value:at.state.title,popularRank:1,render:_t=>(0,i.jsx)(Ee.m,{id:_t.props.id,panel:at,isNewElement:Ze})})).addItem(new g.v({title:(0,a.t)("dashboard.viz-panel.options.description","Description"),id:dt,value:at.state.description,render:_t=>(0,i.jsx)(Ee.dF,{id:_t.props.id,panel:at})})).addItem(new g.v({title:(0,a.t)("dashboard.viz-panel.options.transparent-background","Transparent background"),id:vt,render:_t=>(0,i.jsx)(Ee.R4,{id:_t.props.id,panel:at})})),[ct,xt,at,dt,vt,Ze]),$t=(0,o.useMemo)(()=>(0,Fe.y)(it)&&it.getOptions?it.getOptions():[],[it]);return[wt,...$t]}class xe{constructor(at){this.panel=at,this.isEditableDashboardElement=!0,this.typeName="Panel",this.useEditPaneOptions=De.bind(this)}getEditableElementInfo(){return{typeName:(0,a.t)("dashboard.edit-pane.elements.panel","Panel"),icon:"chart-line",instanceName:c.jh.interpolate(this.panel,this.panel.state.title,void 0,"text")}}onDelete(){We.b4.getLayoutManagerFor(this.panel).removePanel?.(this.panel)}onConfirmDelete(){Ie.lE.publish(new ke.bY({title:(0,a.t)("dashboard.viz-panel.delete-panel-title","Delete panel?"),text:(0,a.t)("dashboard.viz-panel.delete-panel-text","Deleting this panel will also remove all queries. Are you sure you want to continue?"),yesText:(0,a.t)("dashboard.viz-panel.delete-panel-yes","Delete"),onConfirm:()=>{this.onDelete()}}))}onDuplicate(){We.b4.getLayoutManagerFor(this.panel).duplicatePanel?.(this.panel)}onCopy(){(0,p.YQ)(this.panel).copyPanel(this.panel)}onChangeName(at){(0,Ee.dJ)(this.panel,at)}createMultiSelectedElement(at){return new me(at)}scrollIntoView(){(this.panel.parent instanceof Ae.X||this.panel.parent instanceof $e.U)&&this.panel.parent.scrollIntoView()}}const Me=({panel:Ze})=>(0,i.jsx)(L.B,{alignItems:"center",width:"100%",children:(0,i.jsx)(K.$n,{onClick:()=>{M.Ny.partial({editPanel:(0,p.Cs)(Ze)})},icon:"sliders-v-alt",fullWidth:!0,size:"sm",tooltip:(0,a.t)("dashboard.viz-panel.options.configure-button-tooltip","Edit queries and visualization options"),children:(0,i.jsx)(a.x6,{i18nKey:"dashboard.new-panel.configure-button",children:"Configure"})})});function Be(){return(0,t.A)("grafana.dashboards.edit-pane.isCollapsed",!1)}function Oe(Ze){if(Ze){if(S(Ze))return Ze;if(Ze instanceof c.Eb)return new xe(Ze);if(Ze instanceof c.tI)return new u(Ze);if(Ze instanceof r.H$)return new be(Ze);if(Ze instanceof c.Pj)return new ve(Ze);if(Ze instanceof c.xc)return new N(Ze);if((0,F.VD)(Ze))return new J(Ze);if(Ze instanceof V.mG)return new V.gp(Ze)}}class Re extends n.x{static{this.type="new-object-added-to-canvas"}}class we extends n.x{static{this.type="object-removed-from-canvas"}}class Ce extends n.x{static{this.type="objects-reordered-on-canvas"}}class _e extends n.x{static{this.type="conditional-rendering-changed"}}class Je extends n.x{static{this.type="dashboard-edit-action"}}class et extends n.x{static{this.type="dashboard-state-changed"}}const qe={edit(Ze){Ze.source.publishEvent(new Je(Ze),!0)},addElement(Ze){const{addedObject:at,source:it,perform:ct,undo:xt}=Ze,dt=Oe(at);if(!dt)throw new Error("Added object is not an editable element");const vt=dt.getEditableElementInfo().typeName;qe.edit({description:(0,a.t)("dashboard.edit-actions.add","Add {{typeName}}",{typeName:vt}),addedObject:at,source:it,perform:ct,undo:xt})},removeElement(Ze){const{removedObject:at,source:it,perform:ct,undo:xt}=Ze,dt=Oe(at);if(!dt)throw new Error("Removed object is not an editable element");const vt=dt.getEditableElementInfo().typeName;qe.edit({description:(0,a.t)("dashboard.edit-actions.remove","Remove {{typeName}}",{typeName:vt}),removedObject:at,source:it,perform:ct,undo:xt})},changeTitle:nt({description:(0,a.t)("dashboard.title.action","Change dashboard title"),prop:"title"}),changeDescription:nt({description:(0,a.t)("dashboard.description.action","Change dashboard description"),prop:"description"}),addVariable({source:Ze,addedObject:at}){const it=[...Ze.state.variables??[]];qe.addElement({source:Ze,addedObject:at,perform(){Ze.setState({variables:[...it,at]})},undo(){Ze.setState({variables:[...it]})}})},removeVariable({source:Ze,removedObject:at}){const it=[...Ze.state.variables];qe.removeElement({source:Ze,removedObject:at,perform(){Ze.setState({variables:it.filter(ct=>ct!==at)})},undo(){Ze.setState({variables:it})}})},changeVariableName:nt({description:(0,a.t)("dashboard.variable.name.action","Change variable name"),prop:"name"}),changeVariableLabel:nt({description:(0,a.t)("dashboard.variable.label.action","Change variable label"),prop:"label"}),changeVariableDescription:nt({description:(0,a.t)("dashboard.variable.description.action","Change variable description"),prop:"description"}),changeVariableHideValue:nt({description:(0,a.t)("dashboard.variable.hide.action","Change variable hide option") Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.