1(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8882],{62392:(ee,B,e)=>{"use strict";e.d(B,{p:()=>o});var t=e(74848),n=e(96540),r=e(79450);function o(s){const{children:m,instanceSettings:a}=s,l=(0,n.useMemo)(()=>({instanceSettings:a,meta:a.meta}),[a]);return(0,t.jsx)(r.o.Provider,{value:l,children:m})}},20877:(ee,B,e)=>{"use strict";e.d(B,{a:()=>r});var t=e(74848),n=e(79450);function r(o){const{children:s,...m}=o;return(0,t.jsx)(n.o.Provider,{value:m,children:s})}},17564:(ee,B,e)=>{"use strict";e.d(B,{S:()=>t});function t(n){return"instanceSettings"in n&&"meta"in n}},27359:(ee,B,e)=>{"use strict";e.d(B,{I:()=>o,f:()=>r});var t=e(95004),n=e(41119);class r{constructor(l,f){return this.fields=[],this.length=0,o(l,f)}}function o(a,l){const f={fields:[],length:a.length};if(!a?.length)return f;if(l){if(!m(a))throw new Error("source is not an array of objects");for(const u of l)f.fields.push(s(u,a.map(i=>i&&i[u])));return f}if(a.find(u=>u)===null)return f;if(m(a)){const u=a.find(i=>i);f.fields=Object.keys(u||{}).map(i=>s(i,a.map(x=>x&&x[i])))}else f.fields.push(s(t.Bc,a));return f}function s(a,l){const f={name:a,config:{},values:l,type:t.PU.other};return f.type=(0,n.dF)(f)??t.PU.other,f}function m(a){const l=a.find(f=>f);return a.length>0&&typeof l=="object"}},35479:(ee,B,e)=>{"use strict";e.d(B,{x:()=>r});var t=e(94777),n=e(18700);class r extends n.k{constructor(s){super(void 0,m=>new t.$({...s,buffer:m}))}}},77154:(ee,B,e)=>{"use strict";e.d(B,{EL:()=>s,Nw:()=>l,or:()=>a,t:()=>o});var t=e(95004),n=e(41119);const r={Inf:1/0,NegInf:-1/0,Undef:void 0,NaN:NaN};function o(f,h){let u;for(u in f){const i=r[u];for(const x of f[u])x<h.length&&(h[x]=i)}}function s(f,h){for(let u=0;u<h.length;u++)h[u]=f[Number(h[u])]}function m(f,h){for(const u of h)if(u!=null)return(0,n.by)(f,u);return t.PU.other}function a(f){const{schema:h,data:u}=f;if(!h||!h.fields)throw new Error("JSON needs a fields definition");const i=u?u.values.reduce((g,p)=>Math.max(g,p.length),0):0,x=h.fields.map((g,p)=>{let c=u?u.values[p]:[],y=c.length,P=g.type;y!==i&&(c.length=i,c.fill(void 0,y));let d=u?.entities?.[p];d&&o(d,c);let D=u?.enums?.[p];D&&(s(D,c),P=t.PU.string);const b=u?.nanos?.[p],E={...g,type:P??m(g.name,c),config:g.config??{},values:c,entities:d??{}};return b!=null&&(E.nanos=b),E});return{...h,fields:x,length:i}}function l(f){const h={values:[]},u=[];let i=!1;const x={refId:f.refId,meta:f.meta,name:f.name,fields:f.fields.map(g=>{const{values:p,nanos:c,state:y,display:P,...d}=g;return"entities"in d&&delete d.entities,h.values.push(p),c!=null?(u.push(c),i=!0):u.push(null),d})};return i&&(h.nanos=u),{schema:x,data:h}}},88673:(ee,B,e)=>{"use strict";e.d(B,{R:()=>n});var t=e(96453);class n extends t.F{constructor(o){super(),this.data=o,this.index=0;const s={},m={};for(let a=0;a<o.fields.length;a++){const l=o.fields[a];if(!l.name)continue;m[l.name]=l;const f=()=>l.values.get(this.index);s.hasOwnProperty(l.name)||Object.defineProperty(s,l.name,{enumerable:!0,get:f}),s.hasOwnProperty(a.toString())||Object.defineProperty(s,a,{enumerable:!1,get:f})}this.obj=s,this.fields=m}get dataFrame(){return this.data}get length(){return this.data.length}getFieldDisplayProcessor(o){if(!this.dataFrame||!this.dataFrame.fields)return;const s=this.dataFrame.fields[o];if(!(!s||!s.display))return s.display}get(o){return this.index=o,this.obj}toArray(){return new Array(this.data.length).fill(0).map((o,s)=>({...this.get(s)}))}}},10279:(ee,B,e)=>{"use strict";e.d(B,{L:()=>r});var t=e(95004),n=e(41119);class r{constructor(s){this.fields=[],this.fieldByName={},this.fieldByType={},this.fields=s.fields.map((m,a)=>({...m,index:a}));for(let m=0;m<s.fields.length;m++){const a=s.fields[m];if(a.type===t.PU.other){const l=(0,n.dF)(a);l&&(a.type=l)}this.fieldByType[a.type]||(this.fieldByType[a.type]=[]),this.fieldByType[a.type].push({...a,index:m}),this.fieldByName[a.name]?console.warn("Duplicate field names in DataFrame: ",a.name):this.fieldByName[a.name]={...a,index:m}}}getFields(s){if(!s)return[...this.fields];const m=this.fieldByType[s];return m?[...m]:[]}hasFieldOfType(s){const m=this.fieldByType[s];return m&&m.length>0}getFirstFieldOfType(s,m=!1){return this.fieldByType[s]?.find(f=>m||!f.config.custom?.hidden)}hasFieldNamed(s){return!!this.fieldByName[s]}hasFieldWithNameAndType(s,m){return!!this.fieldByName[s]&&this.fieldByType[m].filter(a=>a.name===s).length>0}getFieldByName(s){return this.fieldByName[s]}getFieldsByLabel(s,m){return Object.values(this.fieldByName).filter(a=>a.labels&&a.labels[s]===m)}}},18700:(ee,B,e)=>{"use strict";e.d(B,{p:()=>m,k:()=>a});var t=e(2543),n=e(95004),r=e(41119);function o(l,f){return f.type||(f.name==="time"||f.name==="Time"?f.type=n.PU.time:f.type=(0,r.HW)(l)),f.type===n.PU.number?h=>parseFloat(h):f.type===n.PU.boolean?h=>!(h[0]==="F"||h[0]==="f"||h[0]==="0"):h=>h}var s=e(96453);const m=void 0;class a extends s.F{constructor(f,h){if(super(),this.fields=[],this.first=[],this.parsers=void 0,this.creator=h||(u=>u??[]),f){const{name:u,refId:i,meta:x,fields:g}=f;if(u&&(this.name=u),i&&(this.refId=i),x&&(this.meta=x),g)for(const p of g)this.addField(p)}Object.defineProperty(this,"length",{enumerable:!0,get:()=>this.first.length})}get length(){return this.first.length}addFieldFor(f,h){return this.addField({name:h||"",type:(0,r.HW)(f)})}addField(f,h){let u;f.values&&(u=f.values);let i=f.type;!i&&(f.name==="time"||f.name==="Time")?i=n.PU.time:(!i&&u&&u.length&&(i=(0,r.HW)(u[0])),i||(i=n.PU.other));let x=f.name;x||(x=`Field ${this.fields.length+1}`);const g={...f,name:x,type:i,config:f.config||{},values:this.creator(u)};if(i===n.PU.other&&(i=(0,r.dF)(g),i&&(g.type=i)),this.fields.push(g),this.first=this.fields[0].values,h)for(;g.values.length<h;)g.values.push(m);else this.validate();return g}validate(){const f=this.fields.reduce((h,u)=>Math.max(h,u.values.length),0);for(const h of this.fields)for(;h.values.length!==f;)h.values.push(m)}setParser(f,h){return this.parsers||(this.parsers=new Map),this.parsers.set(f,h),h}parseValue(f,h){let u=this.parsers?.get(f);return u||(u=this.setParser(f,o(h,f))),u(h)}appendRow(f){for(let h=this.fields.length;h<f.length;h++)this.addField({name:`Field ${h+1}`,type:(0,r.HW)(f[h])});if(this.length<1)for(let h=0;h<this.fields.length;h++){const u=this.fields[h];(!u.type||u.type===n.PU.other)&&(u.type=(0,r.HW)(f[h]))}for(let h=0;h<this.fields.length;h++){const u=this.fields[h];let i=f[h];u.type!==n.PU.string&&(0,t.isString)(i)&&(i=this.parseValue(u,i)),u.values.push(i)}}push(...f){for(const h of f)this.add(h);return this.length}reverse(){for(const f of this.fields)f.values.reverse();return this}add(f){const h=f;for(const u of this.fields){let i=h[u.name];u.type!==n.PU.string&&(0,t.isString)(i)&&(i=this.parseValue(u,i)),i===void 0&&(i=m),u.values.push(i)}}set(f,h){if(f>this.length)throw new Error("Unable to set value beyond current length");const u=h||{};for(const i of this.fields)i.values[f]=u[i.name]}get(f){const h={};for(const u of this.fields)h[u.name]=u.values[f];return h}toJSON(){return(0,r.Kl)(this)}}},51388:(ee,B,e)=>{"use strict";e.d(B,{Kh:()=>a,Ls:()=>x,k9:()=>h,m8:()=>u});var t=e(8721),n=e(95004),r=e(71642),o=e(428),s=e(77154),m=e(41119),a=(D=>(D.Append="append",D.Replace="replace",D))(a||{});const l="__name__";var f=(D=>(D[D.wide=0]="wide",D[D.labels=1]="labels",D))(f||{});class h{constructor(b){this.options=b,this.meta={},this.fields=[],this.length=0,this.schemaFields=[],this.timeFieldIndex=-1,this.pushMode=0,this.labels=new Set,this.packetInfo={schemaChanged:!0,number:0,action:"replace",length:0},this.serialize=(E,v,C)=>{const S=v?Object.assign({},{...this.options,...v}):this.options,O=(0,m.By)(this,E),I=P(O.fields.map(T=>T.values??[]),typeof C?.maxLength=="number"?Math.min(C.maxLength,S.maxLength):S.maxLength,this.timeFieldIndex,S.maxDelta);O.fields=O.fields.map(T=>({...T,values:T.values?.slice(I)}));const R=O.fields[0]?.values?.length??0;return{...O,labels:this.labels,schemaFields:this.schemaFields,name:this.name,refId:this.refId,meta:this.meta,length:R,timeFieldIndex:this.timeFieldIndex,pushMode:this.pushMode,packetInfo:this.packetInfo,options:S}},this.initFromSerialized=E=>{this.name=E.name,this.refId=E.refId,this.meta=E.meta,this.length=E.length,this.labels=E.labels,this.schemaFields=E.schemaFields,this.timeFieldIndex=E.timeFieldIndex,this.pushMode=E.pushMode,this.packetInfo.length=E.packetInfo.length,this.packetInfo.number=E.packetInfo.number,this.packetInfo.action="replace",this.packetInfo.schemaChanged=!0,this.fields=E.fields.map(v=>({...v,type:v.type??n.PU.other,config:v.config??{},values:v.values??[]})),y(this.fields.map(v=>v.values),this.options.maxLength,this.timeFieldIndex,this.options.maxDelta)},this.needsResizing=({maxLength:E,maxDelta:v})=>{const C=E&&this.options.maxLength<E,S=v&&this.options.maxDelta<v,O=v&&this.options.maxDelta===1/0;return!!(C||S||O)},this.resize=({maxLength:E,maxDelta:v})=>
1{v&&(this.options.maxDelta===1/0?this.options.maxDelta=v:this.options.maxDelta=Math.max(v,this.options.maxDelta)),this.options.maxLength=Math.max(this.options.maxLength,E??0)},this.pushNewValues=E=>{if(!E?.length)return;this.packetInfo.action=this.options.action,this.packetInfo.number++,this.packetInfo.length=E[0].length,this.packetInfo.schemaChanged=!1,this.options.action==="append"?c(this.fields.map(C=>C.values),E,this.options.maxLength,this.timeFieldIndex,this.options.maxDelta):(E.forEach((C,S)=>{this.fields[S]&&(this.fields[S].values=C)}),y(this.fields.map(C=>C.values),this.options.maxLength,this.timeFieldIndex,this.options.maxDelta));const v=this.fields?.[0]?.values.length;v!==void 0&&(this.length=v)},this.resetStateCalculations=()=>{this.fields.forEach(E=>{E.state={...E.state??{},calcs:void 0,range:void 0}})},this.getMatchingFieldIndexes=E=>this.fields.map((v,C)=>E(v)?C:void 0).filter(v=>v!==void 0),this.getValuesFromLastPacket=()=>this.fields.map(E=>{const v=E.values;return v.slice(Math.max(v.length-this.packetInfo.length))}),this.hasAtLeastOnePacket=()=>!!this.packetInfo.length,this.getOptions=()=>this.options,Object.defineProperty(this,"length",{enumerable:!0}),Object.defineProperty(this,"fields",{enumerable:!0})}static{this.deserialize=b=>{const E=new h(b.options);return E.initFromSerialized(b),E}}static{this.empty=b=>new h(u(b))}static{this.fromDataFrameJSON=(b,E)=>{const v=new h(u(E));return v.push(b),v}}get alwaysReplace(){return this.options.action==="replace"}push(b){const{schema:E,data:v}=b;if(this.packetInfo.number++,this.packetInfo.length=0,this.packetInfo.schemaChanged=!1,E){this.pushMode=0,this.timeFieldIndex=E.fields.findIndex(I=>I.type===n.PU.time);const C=E.fields[0];this.timeFieldIndex===1&&C.type===n.PU.string&&(C.name==="labels"||C.name==="Labels")&&(this.pushMode=1,this.timeFieldIndex=0);const S=this.pushMode===1?E.fields.slice(1):E.fields;this.refId=E.refId,E.meta&&(this.meta={...E.meta});const{displayNameFormat:O}=this.options;if(d(this.schemaFields,S)){const I=S.length;this.fields.forEach((R,T)=>{const L=S[T%I];R.config=L.config??{},R.labels=L.labels}),O&&this.fields.forEach(R=>{const T={[l]:R.name,...R.labels};R.config.displayNameFromDS=(0,o.j)(O,T)})}else{this.packetInfo.schemaChanged=!0;const I=this.pushMode===0;this.fields=S.map(R=>{const T=R.config??{};if(O){const L={[l]:R.name,...R.labels};T.displayNameFromDS=(0,o.j)(O,L)}return{config:T,name:R.name,labels:R.labels,type:R.type??n.PU.other,values:I?this.fields.find(L=>L.name===R.name&&R.type===L.type)?.values??Array(this.length).fill(void 0):[]}})}this.schemaFields=S}if(v&&v.values.length&&v.values[0].length){let{values:C,entities:S}=v;
1if(S&&S.forEach((I,R)=>{I&&(0,s.t)(I,C[R])}),this.pushMode===1){const I=i(C);for(const L of I.keys())this.labels.has(L)||(this.packetInfo.schemaChanged=!0,this.addLabel(L));let R=Array(this.schemaFields.length).fill([]),T=[];this.labels.forEach(L=>{T.push(I.get(L)??R)}),C=(0,t.fj)(T)}if(C.length!==this.fields.length){if(this.fields.length)throw new Error(`push message mismatch. Expected: ${this.fields.length}, received: ${C.length} (labels=${this.pushMode===1})`);this.fields=C.map((I,R)=>{let T=`Field ${R}`,L=(0,m.HW)(I[0]);return R===0&&L===n.PU.number&&I[0]>1600016688632&&(L=n.PU.time,T="Time"),{name:T,type:L,config:{},values:[]}})}let O=C;this.packetInfo.length=C[0].length,this.alwaysReplace||!this.length?this.packetInfo.action="replace":(this.packetInfo.action="append",O=this.fields.map(I=>I.values),c(O,C,this.options.maxLength,this.timeFieldIndex,this.options.maxDelta)),O.forEach((I,R)=>{const T=this.fields[R],{state:L}=T;T.values=I,L&&(L.calcs=void 0)}),this.length=O[0].length}return{...this.packetInfo}}addLabel(b){const{displayNameFormat:E}=this.options,v=this.labels.size,C=g(b);if(v===0)this.fields.forEach((S,O)=>{if(O>0&&(S.labels=C,E)){const I={[l]:S.name,...C};S.config.displayNameFromDS=(0,o.j)(E,I)}});else for(let S=1;S<this.schemaFields.length;S++){let O=this.schemaFields[S];const I=O.config??{};
1if(E){const R={[l]:O.name,...C};I.displayNameFromDS=(0,o.j)(E,R)}this.fields.push({...O,config:I,labels:C,values:Array(this.length).fill(void 0)})}this.labels.add(b)}}function u(D){return{maxLength:D?.maxLength??1e3,maxDelta:D?.maxDelta??1/0,action:D?.action??"append",displayNameFormat:D?.displayNameFormat}}function i(D){let b=new Set(D[0]),E=new Map;b.forEach(v=>{let C=Array(D.length-1).fill(null).map(()=>[]);E.set(v,C)});for(let v=0;v<D[0].length;v++){let C=E.get(D[0][v]);for(let S=1;S<D.length;S++)C[S-1].push(D[S][v])}return E}function x(D,b,E,v){let C;E=E||0,v=v||b.length-1;let S=v<=2147483647;for(;v-E>1;)C=S?E+v>>1:Math.floor((E+v)/2),b[C]<D?E=C:v=C;return D-b[E]<=b[v]-D?E:v}function g(D){if(!D.length)return{};if(D.charAt(0)==="{")return(0,r.Xy)(D);const b={};return D.split(",").forEach(E=>{const[v,C]=E.trim().split("=");b[v]=C}),b}function p(D){if(D instanceof h)return D.packetInfo.action}function c(D,b,E=1/0,v=0,C=1/0){for(let S=0;S<D.length;S++)for(let O=0;O<b[S].length;O++)D[S].push(b[S][O]);return y(D,E,v,C)}function y(D,b=1/0,E=0,v=1/0){const C=P(D,b,E,v);if(C)for(let S=0;S<D.length;S++)D[S].splice(0,C);return C}function P(D,b=1/0,E=0,v=1/0){if(!D[0]?.length)return 0;const C=D[0].length;let S=0;if(C>b&&(S=C-b),v!==1/0&&E>=0){const O=D[E],I=O[S],R=O[C-1];R-I>v&&(S=x(R-v,O,S))}return S}function d(D,b){if(D?.length!==b.length)return!1;for(let E=0;E<D.length;E++){const v=D[E],C=b[E];if(v.name!==C.name||v.type!==C.type)return!1}return!0}},26332:(ee,B,e)=>{"use strict";e.d(B,{Km:()=>s,P4:()=>r,WK:()=>o,g6:()=>n,r4:()=>t,xB:()=>m});const t=(a,l)=>({name:a,columns:l}),n=a=>a.columns,r=(a,l)=>a.columns[l],o=(a,l,f)=>a.columns[l].values[f],s=(a,l,f)=>a.columns.map(h=>h.values[f]),m=(a,l)=>a[l]},76732:(ee,B,e)=>{"use strict";e.d(B,{J3:()=>o,ab:()=>m,bW:()=>r});var t=e(2543),n=e.n(t);function r(a,l,f){if(a===l)return!0;if(a?.fields?.length!==l?.fields?.length||a.name!==l.name)return!1;for(let h=0;h<a.fields.length;h++){const u=a.fields[h],i=l.fields[h];if(u.type!==i.type||u.name!==i.name)return!1;if(f)continue;if(u.labels&&i.labels&&!m(u.labels,i.labels))return!1;const x=u.config,g=i.config;if(Object.keys(x).length!==Object.keys(g).length)return!1;let p;for(p in x){if(!(p in g))return!1;if(p!=="interval"&&!(0,t.isEqual)(x[p],g[p]))return!1}}return!0}function o(a,l,f){if(a===l)return!0;if(a?.length!==l?.length)return!1;for(let h=0;h<a.length;h++)if(!f(a[h],l[h]))return!1;return!0}const s=(a,l)=>a===l;function m(a,l,f=s){if(a===l)return!0;if(Object.keys(a).length!==Object.keys(l).length)return!1;let h;for(h in a)if(!f(a[h],l[h]))return!1;return!0}},41119:(ee,B,e)=>{"use strict";e.d(B,{Bt:()=>A,By:()=>T,EI:()=>N,ES:()=>S,HW:()=>y,KR:()=>L,Kl:()=>R,LI:()=>E,N$:()=>W,Vc:()=>v,XQ:()=>d,Yn:()=>I,by:()=>p,ci:()=>b,dF:()=>P,oE:()=>c,pH:()=>D,q7:()=>O,w3:()=>C});var t=e(2543),n=e.n(t),r=e(25229),o=e(92446),s=e(16515),m=e(28105),a=e(95004),l=e(27359),f=e(77154);function h(w){const j=w.columns.map(V=>{const{text:U,type:F,...M}=V,H=[];return{name:U?.length?U:V,config:M||{},values:H,type:F&&Object.values(a.PU).includes(F)?F:a.PU.other}});if(!(0,t.isArray)(w.rows))throw new Error(`Expected table rows to be array, got ${typeof w.rows}.`);for(const V of w.rows)for(let U=0;U<j.length;U++)j[U].values.push(V[U]);for(const V of j)if(V.type===a.PU.other){const U=P(V);U&&(V.type=U)}return{fields:j,refId:w.refId,meta:w.meta,name:w.name,length:w.rows.length}}function u(w){const j=[],V=[],U=w.datapoints||w.points;for(const M of U)V.push(M[0]),j.push(M[1]);const F=[{name:a.LE,type:a.PU.time,config:{},values:j},{name:a.Bc,type:a.PU.number,config:{unit:w.unit},values:V,labels:w.tags}];return w.title&&(F[1].config.displayNameFromDS=w.title),{name:w.target||w.name,refId:w.refId,meta:w.meta,fields:F,length:V.length}}function i(w){const j=[],V=[];for(let U=0;U<w.data.length;U++){const F=w.data[U];j.push(F[1]),V.push(F[0])}return{name:w.label,fields:[{name:w.label||a.Bc,type:a.PU.number,config:{},values:j},{name:a.LE,type:a.PU.time,config:{unit:"dateTimeAsIso"},values:V}],length:j.length}}function x(w){const j=[{name:w.target,type:a.PU.other,labels:w.tags,config:{unit:w.unit,filterable:w.filterable},values:[]}];for(const V of w.datapoints)j[0].values.push(V);return{name:w.target,refId:w.target,meta:{json:!0},fields:j,length:w.datapoints.length}}const g=/^\s*(-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?|NAN)\s*$/i;function p(w,j){return w&&(w=w.toLowerCase(),w==="date"||w==="time")?a.PU.time:y(j)}function c(w){return w instanceof Date||(0,r.Ar)(w)?a.PU.time:(0,t.isNumber)(w)?a.PU.number:(0,t.isString)(w)?a.PU.string:(0,t.isBoolean)(w)?a.PU.boolean:a.PU.other}function y(w){return w instanceof Date||(0,r.Ar)(w)?a.PU.time:(0,t.isNumber)(w)?a.PU.number:(0,t.isString)(w)?g.test(w)?a.PU.number:w==="true"||w==="TRUE"||w==="True"||w==="false"||w==="FALSE"||w==="False"?a.PU.boolean:a.PU.str
1ing:(0,t.isBoolean)(w)?a.PU.boolean:a.PU.other}function P(w){if(w.name){const j=w.name.toLowerCase();if(j==="date"||j==="time")return a.PU.time}for(let j=0;j<w.values.length;j++){const V=w.values[j];if(V!=null)return y(V)}}const d=(w,j=!1)=>{for(const V of w.fields)if(!V.type||V.type===a.PU.other||j)return{...w,fields:w.fields.map(U=>U.type&&U.type!==a.PU.other&&!j?U:{...U,type:P(U)||a.PU.other})};return w},D=w=>!!(w&&w.hasOwnProperty("columns")),b=w=>!!(w&&w.hasOwnProperty("fields")),E=w=>!!(b(w)&&w.hasOwnProperty("value"));function v(w){if("fields"in w)return"length"in w&&w.fields[0]?.values?.get?w:N(w);if(w.hasOwnProperty("type")&&w.type==="docs")return x(w);if(w.hasOwnProperty("datapoints")||w.hasOwnProperty("points"))return u(w);if(w.hasOwnProperty("data"))return w.hasOwnProperty("schema")?(0,f.or)(w):i(w);if(w.hasOwnProperty("columns"))return h(w);if(Array.isArray(w))return(0,l.I)(w);throw console.warn("Can not convert",w),new Error("Unsupported data format")}const C=w=>{const{fields:j}=w,V=w.length,U=[];if(j.length===2){const{timeField:F,timeIndex:M}=L(w);if(F){const _=j[M===0?1:0],Z=j[M];for(let ne=0;ne<V;ne++)U.push([_.values[ne],Z.values[ne]]);return{alias:w.name,target:(0,s.Ct)(_,w),datapoints:U,unit:j[0].config?j[0].config.unit:void 0,refId:w.refId,meta:w.meta}}}for(let F=0;F<V;F++){const M=[];for(let H=0;H<j.length;H++)M.push(j[H].values[F]);U.push(M)}return w.meta&&w.meta.json?{alias:j[0].name||w.name,target:j[0].name||w.name,datapoints:j[0].values,filterable:j[0].config?j[0].config.filterable:void 0,type:"docs"}:{columns:j.map(F=>{const{name:M,config:H}=F;if(H){const{..._}=H;return _.text=M,_}return{text:M}}),type:"table",refId:w.refId,meta:w.meta,rows:U}};function S(w,j,V=!1){const U=w.fields[j];if(!U)return w;const F=[];for(let H=0;H<w.length;H++)F.push(H);const M=(0,o.i)(U,V);return F.sort(M),{...w,fields:w.fields.map(H=>{const _={...H,values:H.values.map((ne,te)=>H.values[F[te]])},{nanos:Z}=H;return Z!==void 0&&(_.nanos=Z.map((ne,te)=>Z[F[te]])),_})}}function O(w){return{...w,fields:w.fields.map(j=>{const V=[...j.values];V.reverse();const U={...j,values:V},{nanos:F}=j;if(F!==void 0){const M=[...F];M.reverse(),U.nanos=M}return U})}}function I(w,j){const V=[];for(const U of w.fields)V.push(U.values[j]);return V}function R(w){return T(w)}function T(w,j){return{fields:(j?w.fields.filter(j):w.fields).map(F=>{let M=F.values;return{name:F.name,type:F.type,config:F.config,values:M,labels:F.labels}}),refId:w.refId,meta:w.meta,name:w.name}}const L=w=>{for(let j=0;j<w.fields.length;j++)if(w.fields[j].type===a.PU.time)return{timeField:w.fields[j],timeIndex:j};return{}};function K(w){const j=d(v(w));if(j.fields&&j.fields.length)for(const V of j.fields)V.state=null;return j}function A(w){return!w||!(0,t.isArray)(w)?[]:w.map(j=>K(j))}function W(w,j){const{series:V,annotations:U}=w;if(w.state===m.Gu.Loading&&V.length===0)return j||(j=w),{...j,state:m.Gu.Loading,request:w.request};const F=performance.now(),M=V.map(Z=>K(Z)),H=A(U),_=performance.now();return{...w,series:M,annotations:H,timings:{dataProcessingTime:_-F}}}function N(w){let j=0;const V=w.fields.map((U,F)=>{const{state:M,...H}=U;return H.name||(H.name=`Field ${F+1}`),H.config||(H.config={}),H.values?H.values.length>j&&(j=H.values.length):H.values=new Array(j),H.type||(H.type=P(H)??a.PU.other),H});return{...w,fields:V,length:j}}},39884:(ee,B,e)=>{"use strict";e.d(B,{S1:()=>l,aH:()=>o,hF:()=>m,jq:()=>s,t9:()=>f,tP:()=>a,uY:()=>h});var t=e(95004),n=e(41119);const r=100;function o(u){if(u.fields.length<2)return!1;const i=u.fields.find(g=>g.type===t.PU.number);let x=!1;for(const g of u.fields)if(m(g)){x=!0;break}return x&&i!==void 0}function s(u){return!u.find(i=>!o(i))}function m(u){if(u.type!==t.PU.time)return!1;let i=null,x=u.values.length>r?r:u.values.length;for(let g=0;g<x;g++){const p=u.values[g];if(i===null||p!==null&&p>i)i=p;else return!1}return!0}function a(u){for(let i=0;i<u.length;i++){const x=(0,n.KR)(u[i]);if(x.timeField!==void 0&&x.timeIndex!==void 0)return!0}return!1}function l(u){return u.fields.some(i=>i.type===t.PU.time)}function f(u,i){if(u.meta?.uniqueRowIdFields!==void 0)return u.meta.uniqueRowIdFields.map(x=>u.fields[x].values[i]).join("-")}function h(u,i){if(i instanceof Array)for(let x=0;x<i.length;x++)u.fields[x].values.push(i[x]);else for(const x of u.fields)x.values.push(i[x.name]);try{u.length++}catch{}}},74529:(ee,B,e)=>{"use strict";e.d(B,{E9:()=>a,Q7:()=>m,Ri:()=>l,V3:()=>x,WT:()=>f,dU:()=>s,di:()=>u,pp:()=>i,vd:()=>h});var t=e(47402),n=e(60365),r=e(66907);const o={years:["y","Y","years"],months:["M","months"],weeks:["w","W","weeks"],days:["d","D","days"],hours:["h","H","hours"],minutes:["m","minutes"],seconds:["s","S","seconds"]};function s(p,c=!0){if((0,t.d)(p.start,p.end))return"";const y=(0,n.F)(p);return m(y,c)}function m(p,c){return Object.entries(p).reduce((y,[P,d])=>d&&d!==0&&!(P==="seconds"&&!c&&y)?y+`${y!==""?" ":""}${d}${o[P][0]}`:y,"")}function a(p){return p.split(" ").reduce((c,y)=>{const P=y.match(/(\d+)(.+)/),d=P?.[1],D=P?.[2];if(!(d&&D))return c;const b=Object.entries(o).find(([v,C])=>C?.includes(P[2])),E=parseInt(d,10);return b?{...c,[b[0]]:E}:c},{})}function l(p,c){return(0,r.W)(p,c)}function f(p){const c=new Date;return l(c,p).getTime()-c.getTime()}function h(p){return!isNaN(Date.parse(p))}function u(p){for(const c of p.trim().split(" ")){const y=c.match(/(\d+)(.+)/);if(y===null||y.length!==3||!Object.entries(o).find(([d,D])=>D?.includes(y[2]))?.[0])return!1}return!0}function i(p){return g(p,["h","m","s","ms","us","\xB5s","ns"])}function x(p){return g(p,["y","M","w","d","h","m","s","ms","us","\xB5s","ns"])}function g(p,c){for(const y of p.trim().split(" ")){const P=y.match(/([0-9]*[.]?[0-9]+)(.+)/);if(P===null||P.length!==3||!c.includes(P[2]))return!1}return!0}},62717:(ee,B,e)=>{"use strict";e.d(B,{HD:()=>l,P3:()=>h,QZ:()=>f,U3:()=>u,g$:()=>m,le:()=>a});var t=e(2543),n=e.n(t),r=e(84743),o=e.n(r),s=e(60188),m=(y=>(y.default="",y.localBrowserTime="browser",y.utc="utc",y))(m||{});const a=y=>{switch((0,s.O)({timeZone:y})){case"browser":return"Local browser time";case"utc":return"UTC";default:return y}},l=y=>o().tz.zone(y),f=(y,P)=>{const d=i(y,P);return d||g(y,P)},h=(0,t.memoize)((y=!1)=>{const P=[];
1return y===!0?P.push("","browser","utc"):y&&P.push(...y),o().tz.names().reduce((d,D)=>{const b=c[D];return!Array.isArray(b)||b.length===0||d.push(D),d},P)}),u=(0,t.memoize)((y=!1)=>{const d=h(y).reduce((D,b)=>{const E=b.indexOf("/");if(E===-1){const C="";return D[C]=D[C]??[],D[C].push(b),D}const v=b.slice(0,E);return D[v]=D[v]??[],D[v].push(b),D},{});return Object.keys(d).map(D=>({name:D,zones:d[D]}))}),i=(y,P)=>{switch(y){case"utc":return{name:"Coordinated Universal Time",ianaName:"UTC",zone:y,countries:[],abbreviation:"UTC, GMT",offsetInMins:0};case"":{const d=(0,s.O)(),b=d==="browser"||d==="utc"?i(d,P):g(d,P);return{countries:c[d]??[],abbreviation:"",offsetInMins:0,...b,ianaName:b?.ianaName??"",name:"Default",zone:y}}case"browser":{const d=o().tz.guess(!0),D=g(d,P);return{countries:c[d]??[],abbreviation:"Your local time",offsetInMins:new Date().getTimezoneOffset(),...D,name:"Browser Time",ianaName:D?.ianaName??"",zone:y}}default:return}},x=y=>/^(\+|\-).+/.test(y)?"":y,g=(y,P)=>{const d=o().tz.zone(y);if(d)return{name:y,ianaName:d.name,zone:y,countries:c[y]??[],abbreviation:x(d.abbr(P)),offsetInMins:d.utcOffset(P)}},p={AF:"Afghanistan",AX:"Aland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua And Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia",BA:"Bosnia And Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CV:"Cape Verde",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo, Democratic Republic",CK:"Cook Islands",CR:"Costa Rica",CI:"Cote D'Ivoire",HR:"Croatia",CU:"Cuba",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands (Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island & Mcdonald Islands",VA:"Holy See (Vatican City State)",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran (Islamic Republic Of)",IQ:"Iraq",IE:"Ireland",IM:"Isle Of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KR:"Korea",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libyan Arab Jamahiriya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MK:"Macedonia",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia (Federated States Of)",MD:"Moldova",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",AN:"Netherlands Antilles",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine, State of",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Reunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",BL:"Saint Barthelemy",SH:"Saint Helena",KN:"Saint Kitts And Nevis",LC:"Saint Lucia",MF:"Saint Martin",PM:"Saint Pierre And Miquelon",VC:"Saint Vincent And Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome And Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serb
1ia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia And Sandwich Isl.",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard And Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan",TJ:"Tajikistan",TZ:"Tanzania",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad And Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks And Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UM:"United States Outlying Islands",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela",VN:"Viet Nam",VG:"Virgin Islands, British",VI:"Virgin Islands, U.S.",WF:"Wallis And Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},c=o().tz.countries().reduce((y,P)=>o().tz.zonesForCountry(P).reduce((D,b)=>{D[b]||(D[b]=[]);const E=p[P];return E&&D[b].push({code:P,name:E}),D},y),{})},57852:(ee,B,e)=>{"use strict";e.d(B,{LL:()=>f,LO:()=>o,NI:()=>l,Tp:()=>h,We:()=>s,b_:()=>n,gc:()=>m,ql:()=>r,wE:()=>a});var t=e(68388);class n extends t.x{static{this.type="data-hover"}}class r extends t.a{static{this.type="data-hover-clear"}}class o extends t.x{static{this.type="data-select"}}class s extends t.x{static{this.type="annotation-event"}}class m extends t.x{static{this.type="dashboard-loaded"}}class a extends t.a{static{this.type="datasource-updated-successfully"}}class l extends t.a{static{this.type="datasource-test-succeeded"}}class f extends t.a{static{this.type="datasource-test-failed"}}class h extends t.x{static{this.type="set-panel-attention"}}},76803:(ee,B,e)=>{"use strict";e.d(B,{K:()=>n});var t=e(42954);class n extends t.O{}},11576:(ee,B,e)=>{"use strict";e.d(B,{H:()=>g,J:()=>i});var t=e(2543),n=e.n(t),r=e(41119),o=e(25229),s=e(44922),m=e(95004),a=e(13227),l=e(35987),f=e(55386),h=e(79118);const u={dateTimeAsIso:!0,dateTimeAsIsoNoDateIfToday:!0,dateTimeAsUS:!0,dateTimeAsUSNoDateIfToday:!0,dateTimeAsLocal:!0,dateTimeAsLocalNoDateIfToday:!0,dateTimeFromNow:!0};function i(c){if(!c||(0,t.isEmpty)(c)||!c.field)return x;const y=c.field,P=y.config??{},{palette:d}=c.theme.visualization;let D=P.unit,b=D&&(u[D]||D.startsWith("time:")),E=!1;if(y.type===m.PU.time&&!b){if(D="dateTimeAsSystem",b=!0,y.values&&y.values.length>1){let L=y.values[0],K=y.values[y.values.length-1];typeof L=="string"?(L=(0,s.b)(L).unix(),K=(0,s.b)(K).unix()):(L/=1e3,K/=1e3),E=Math.abs(K-L)<60}}else y.type===m.PU.boolean?(0,f.j9)(D)||(D="bool"):!D&&y.type===m.PU.string&&(D="string");const v=D?.startsWith("currency"),C=(0,f.j9)(D),S=y.type===m.PU.number,I=!b&&!v&&!C&&!(D==="locale")&&S&&P.decimals==null,R=(0,f.j_)(D||"none"),T=(0,h.jc)(y,c.theme);return(L,K)=>{const{mappings:A}=P,W=D==="string";b&&typeof L=="string"&&(L=(0,o.yT)(L).valueOf());let N=W?NaN:(0,a.t)(L),w,j,V,U,F,M;if(A&&A.length>0){const _=(0,l.Zz)(A,L);_&&(_.text!=null&&(w=_.text),_.color!=null&&(U=c.theme.visualization.getColorByName(_.color)),_.icon!=null&&(F=_.icon))}else if(y.type===m.PU.enum){if(L==null)return{text:"",numeric:NaN};const _=+L;if(P&&P.type&&P.type.enum){const{text:Z,color:ne}=P.type.enum;if(w=Z?Z[_]:`${L}`,U=ne?ne[_]:void 0,U==null){const te=d[_%d.length];U=c.theme.visualization.getColorByName(te)}}}if(!Number.isNaN(N)){if(w==null&&!(0,t.isBoolean)(L)){let _;I&&K!=null?(_=R(N,K,null,c.timeZone,E),_.text=+_.text+""):_=R(N,P.decimals,null,c.timeZone,E),w=_.text,V=_.suffix,j=_.prefix}if(U==null){const _=T(N);U=_.color,M=_.percent}}if(w==null&&(0,t.isArray)(L)&&(w=(0,t.join)(L,", ")),w==null&&(w=(0,t.toString)(L),w||(P.noValue?w=P.noValue:w="")),!U){const _=T(-1/0);U=_.color,M=_.percent}const H={text:w,numeric:N,prefix:j,suffix:V,color:U};return F!=null&&(H.icon=F),M!=null&&(H.percent=M),H}}function x(c){return{text:(0,t.toString)(c),numeric:(0,a.t)(c)}}function g(){return c=>({text:(0,r.oE)(c)==="other"?`${JSON.stringify(c,p())}`:`${c}`,numeric:null})}const p=()=>{const c=new WeakSet;return(y,P)=>{if(typeof P=="object"&&P!==null){if(c.has(P))return;c.add(P)}return P}}},76637:(ee,B,e)=>{"use strict";e.d(B,{Hs:()=>g,Qi:()=>x,lz:()=>p,uf:()=>u});var t=e(21197),n=e(55459),r=e.n(n),o=e(84140),s=e(6773),m=e(46644),a=e(64394),l=e(42954),f=e(79118),h=e(36394);const u=new l.O(()=>[{id:a.Y.Fixed,name:"Single color",description:"Set a specific color",getCalculator:c},{id:a.Y.Shades,name:"Shades of a color",description:"Select shades of a specific color",getCalculator:y},{id:a.Y.Thresholds,name:"From thresholds",isByValue:!0,description:"Derive colors from thresholds",getCalculator:(P,d)=>(D,b,E)=>{const v=E??h.QS;return d.visualization.getColorByName(v.color)}},new i({id:a.Y.PaletteClassic,name:"Classic palette",isContinuous:!1,isByValue:!1,getColors:P=>P.visualization.palette}),new i({id:a.Y.PaletteClassicByName,name:"Classic palette (by series n
1ame)",isContinuous:!1,isByValue:!1,useSeriesName:!0,getColors:P=>P.visualization.palette.filter(d=>(0,s.eM)(P.visualization.getColorByName(d),P.colors.background.primary)>=P.colors.contrastThreshold)}),new i({id:a.Y.ContinuousGrYlRd,name:"Green-Yellow-Red",isContinuous:!0,isByValue:!0,getColors:P=>["green","yellow","red"]}),new i({id:a.Y.ContinuousRdYlGr,name:"Red-Yellow-Green",isContinuous:!0,isByValue:!0,getColors:P=>["red","yellow","green"]}),new i({id:a.Y.ContinuousBlYlRd,name:"Blue-Yellow-Red",isContinuous:!0,isByValue:!0,getColors:P=>["dark-blue","super-light-yellow","dark-red"]}),new i({id:a.Y.ContinuousYlRd,name:"Yellow-Red",isContinuous:!0,isByValue:!0,getColors:P=>["super-light-yellow","dark-red"]}),new i({id:a.Y.ContinuousBlPu,name:"Blue-Purple",isContinuous:!0,isByValue:!0,getColors:P=>["blue","purple"]}),new i({id:a.Y.ContinuousYlBl,name:"Yellow-Blue",isContinuous:!0,isByValue:!0,getColors:P=>["super-light-yellow","dark-blue"]}),new i({id:a.Y.ContinuousBlues,name:"Blues",isContinuous:!0,isByValue:!0,getColors:P=>["panel-bg","dark-blue"]}),new i({id:a.Y.ContinuousReds,name:"Reds",isContinuous:!0,isByValue:!0,getColors:P=>["panel-bg","dark-red"]}),new i({id:a.Y.ContinuousGreens,name:"Greens",isContinuous:!0,isByValue:!0,getColors:P=>["panel-bg","dark-green"]}),new i({id:a.Y.ContinuousPurples,name:"Purples",isContinuous:!0,isByValue:!0,getColors:P=>["panel-bg","dark-purple"]})]);class i{constructor(d){this.id=d.id,this.name=d.name,this.description=d.description,this.getNamedColors=d.getColors,this.isContinuous=d.isContinuous,this.isByValue=d.isByValue,this.useSeriesName=d.useSeriesName}getColors(d){return this.getNamedColors?this.colorCache&&this.colorCacheTheme===d?this.colorCache:(this.colorCache=this.getNamedColors(d).map(d.visualization.getColorByName),this.colorCacheTheme=d,this.colorCache):[]}getInterpolator(){return this.interpolator||(this.interpolator=(0,t.Ik)(this.colorCache)),this.interpolator}getCalculator(d,D){const b=this.getColors(D);return this.isByValue?this.isContinuous?(E,v,C)=>this.getInterpolator()(v):(E,v,C)=>b[v*(b.length-1)]:this.useSeriesName?(E,v,C)=>b[Math.abs(r()(d.state?.displayName??d.name))%b.length]:(E,v,C)=>{const S=d.state?.seriesIndex??0;return b[S%b.length]}}}function x(P){return u.get(P.config.color?.mode??a.Y.Thresholds)}function g(P){return u.get(P??a.Y.Thresholds)}function p(P,d){const D=x(P);if(!D.isByValue)return{color:D.getCalculator(P,d)(0,0),threshold:h.QS,percent:1};const b=(0,f.jc)(P,d),E=P.config.color?.seriesBy??"last",C=(0,m.Nw)({field:P,reducers:[E]})[E]??0;return b(C)}function c(P,d){return()=>d.visualization.getColorByName(P.config.color?.fixedColor??a.F)}function y(P,d){return()=>{const D=d.visualization.getColorByName(P.config.color?.fixedColor??a.F),b=[D],E=6,v=10,C=35,S=35;for(let I=1;I<E;I++)b.push((0,o.A)(D).spin(I/E*v).brighten(I/E*C).toHexString()),b.push((0,o.A)(D).spin(-(I/E)*v).darken(I/E*S).toHexString());const O=P.state?.seriesIndex??0;return b[O%b.length]}}},92446:(ee,B,e)=>{"use strict";e.d(B,{i:()=>s});var t=e(2543),n=e.n(t),r=e(25229),o=e(95004);const s=(P,d=!1)=>{const D=P.values;switch(P.type){case o.PU.number:return p(D,d);case o.PU.string:return c(D,d);case o.PU.boolean:return g(D,d);case o.PU.time:return typeof P.values[0]=="number"?i(D,d):x(D,d);default:return y(d)}},m=(P,d)=>{if(!P||!d)return u(P,d);if((0,t.isNumber)(P)&&(0,t.isNumber)(d))return a(P,d);if((0,r.u8)(P)&&(0,r.u8)(d)){if((0,r.KQ)(P).isBefore(d))return-1;if((0,r.KQ)(d).isBefore(P))return 1}return 0},a=(P,d)=>P-d,l=new Intl.Collator("en",{sensitivity:"base"}).compare,f=(P,d)=>!P||!d?u(P,d):l(String(P),String(d)),h=(P,d)=>u(P,d),u=(P,d)=>!P&&d?1:P&&!d?-1:0,i=(P,d)=>{let D=d?-1:1;return(b,E)=>D*(P[b]-P[E])},x=(P,d)=>(D,b)=>{const E=P[D],v=P[b];return d?m(v,E):m(E,v)},g=(P,d)=>(D,b)=>{const E=P[D],v=P[b];return d?h(v,E):h(E,v)},p=(P,d)=>(D,b)=>{const E=P[D],v=P[b];return d?a(v,E):a(E,v)},c=(P,d)=>(D,b)=>{const E=P[D],v=P[b];return d?f(v,E):f(E,v)},y=P=>(d,D)=>P?a(D,d):a(d,D)},44232:(ee,B,e)=>{"use strict";e.d(B,{PI:()=>y,Pm:()=>c,XS:()=>E,Zo:()=>S,a_:()=>p,eG:()=>b,k3:()=>u,k_:()=>g,nF:()=>x,py:()=>i});var t=e(2543),n=e.n(t),r=e(88673),o=e(41119),s=e(46644),m=e(36638),a=e(57866),l=e(95004),f=e(11576),h=e(16515);const u="__series.name",i="__field.displayName",x="__field.labels",g="__calc",p="__cell_",c=25,y=I=>{const{replaceVariables:R,reduceOptions:T,timeZone:L,theme:K}=I,A=T.calcs.length?T.calcs:[s.gy.last],W=[],N=(0,m.NS)(T.fields?{id:a.Ct.byRegexp,options:T.fields}:{id:a.Ct.numeric}),w=I.data??[],j=T.limit?T.limit:c;let V=!1;for(let U=0;U<w.length&&!V;U++){const F=w[U],{timeField:M}=(0,o.KR)(F),H=new r.R(F);for(let _=0;_<F.fields.length&&!V;_++){const Z=F.fields[_],ne=Z.getLinks;if(!N(Z,F,w))continue;let te=Z.config;Z.state?.range&&(te={...te,...Z.state?.range});let Y=Z.config.displayName??"";const Q=Z.display??(0,f.J)({field:Z,theme:I.theme,timeZone:L});if(T.values)for(let J=0;J<Z.values.length;J++){Z.state=d(Z,W.length);const q=O(Z,J),X=Q(Z.values[J]),se=P(F,Z,J,R,q),oe=D(se,I.fieldConfig,K
1);if(W.push({name:"",field:te,display:{...X,title:se,color:oe??X.color},view:H,colIndex:_,rowIndex:J,getLinks:ne?()=>ne({valueRowIndex:J}):()=>[],hasLinks:b(Z)}),W.length>=j){V=!0;break}}else{const J=(0,s.Nw)({field:Z,reducers:A});for(const q of A){const X=Z.state?.scopedVars??{};X[g]={value:q,text:q};const se=Q(J[q]);Y!==""?se.title=R(Y,X):se.title=(0,h.Ct)(Z,F,w),se.percentChange=I.percentChange?(0,s.Nw)({field:Z,reducers:[s.gy.diffperc]}).diffperc:void 0;let oe;I.sparkline&&(oe={y:F.fields[_],x:M},q===s.gy.last?oe.highlightIndex=oe.y.values.length-1:q===s.gy.first&&(oe.highlightIndex=0));const ae=F.length===1?0:void 0;W.push({name:q,field:te,display:se,sparkline:oe,view:H,colIndex:_,getLinks:ne?()=>ne({calculatedValue:se,valueRowIndex:ae}):()=>[],hasLinks:b(Z)})}}}}return W.length===0&&W.push(v(I)),W};function P(I,R,T,L,K){const A=R.config.displayName;if(A)return A.indexOf(p)?L(S(A),K):L(A,K);let W=[],N=0;for(const w of I.fields)if(w!==R)if(w.type===l.PU.string){const j=w.values[T]??"",V=w.display?w.display(j).text:j;V.length>0&&W.push(V)}else w.type===l.PU.number&&N++;return(N||W.length===0)&&W.push((0,h.Ct)(R,I)),W.join(" ")}function d(I,R){return{...I.state,seriesIndex:R}}function D(I,R,T){for(const L of R.overrides)if(L.matcher.id==="byName"&&L.matcher.options===I){for(const K of L.properties)if(K.id==="color"&&K.value)return T.visualization.getColorByName(K.value.fixedColor)}return null}function b(I){return I.config?.links?.length?I.config.links.length>0:!1}function E(I){let R="",T="",L="",K="";for(let A=0;A<I.length;A++){const W=I[A].display;W.text&&W.text.length>T.length&&(T=W.text),W.title&&W.title.length>R.length&&(R=W.title),W.prefix&&W.prefix.length>L.length&&(L=W.prefix),W.suffix&&W.suffix.length>K.length&&(K=W.suffix)}return{text:T,title:R,suffix:K,prefix:L}}function v(I){const R="No data",{fieldConfig:T,timeZone:L}=I,{defaults:K}=T,W=(0,f.J)({field:{name:"",type:l.PU.other,config:K},theme:I.theme,timeZone:L})(null),N=C(W,R);return{name:R,field:{...K,max:K.max??0,min:K.min??0},display:{text:N,numeric:0,color:W.color},hasLinks:!1}}function C(I,R){return!I||(0,t.isEmpty)(I.text)?R:I.text}function S(I){return I.replace(/\${__cell_(\d+)(.*?)}|\[\[__cell_(\d+)(.*?)\]\]|\$__cell_(\d+)(\S*)/g,(R,T,L,K,A,W,N)=>`\${__data.fields[${T??K??W}]${L??A??N}}`)}function O(I,R){return I.state?.scopedVars?.__dataContext?{...I.state?.scopedVars,__dataContext:{value:{...I.state?.scopedVars?.__dataContext.value,rowIndex:R}}}:I.state?.scopedVars}},60519:(ee,B,e)=>{"use strict";e.d(B,{BF:()=>O,K3:()=>T,_M:()=>R,nJ:()=>d,rJ:()=>L,vd:()=>K,we:()=>D});var t=e(2543),n=e.n(t),r=e(96540),o=e(80292),s=e(21275),m=e(739),a=e(76732),l=e(41119),f=e(6773),h=e(46644),u=e(36638),i=e(95004),x=e(64394),g=e(38036),p=e(92138),c=e(11576),y=e(79118),P=e(53543);function d(A){let W=null,N=null;const w=[h.gy.min,h.gy.max];for(const j of A)for(const V of j.fields)if(V.type===i.PU.number){const U=(0,h.Nw)({field:V,reducers:w}),F=U[h.gy.min],M=U[h.gy.max];(W===null||F<W)&&(W=F),(N===null||M>N)&&(N=M)}return{min:W,max:N,delta:(N??0)-(W??0)}}function D(A){if(!A.data)return[];const W=A.fieldConfig;if(!W)return A.data;const N=A.fieldConfigRegistry??P.G;let w=0,j;const V=[];if(W.overrides)for(const U of W.overrides){const F=u.sJ.get(U.matcher.id);F&&V.push({match:F.get(U.matcher.options),properties:U.properties})}return A.data.map((U,F)=>{const M={...U};M.fields=M.fields.map(H=>({...H,config:(0,t.cloneDeep)(H.config),state:{...H.state}}));for(const H of M.fields){const _=H.config;H.state.scopedVars={__dataContext:{value:{data:A.data,frame:M,frameIndex:F,field:H}}};const Z={field:H,data:A.data,dataFrameIndex:F,replaceVariables:A.replaceVariables,fieldConfigRegistry:N};C(_,W.defaults,Z);for(const Q of V)if(Q.match(H,M,A.data))for(const J of Q.properties)v(_,J,Z);let ne=H.type;if(!ne||ne===i.PU.other){const Q=(0,l.dF)(H);Q&&(ne=Q)}const{range:te,newGlobalRange:Y}=b(_,H,j,A.data);if(j=Y,H.state.displayName=null,H.state.seriesIndex=w,H.state.range=te,H.type=ne,H.type!==i.PU.time&&w++,H.display=(0,c.J)({field:H,theme:A.theme,timeZone:A.timeZone}),H.config.unit!=="dateTimeFromNow"&&(H.display=E(H.display,2500)),H.getLinks=R(M,H,H.state.scopedVars,Z.replaceVariables,A.timeZone,A.dataLinkPostProcessor),H.type===i.PU.nestedFrames)for(const Q of H.values)for(let J=0;J<Q.length;J++)for(const q of Q[J].fields)q.display=(0,c.J)({field:q,theme:A.theme,timeZone:A.timeZone}),q.state={scopedVars:{__dataContext:{value:{data:Q,frame:Q[J],frameIndex:J,field:q}}}},q.getLinks=R(Q[J],q,q.state.scopedVars,Z.replaceVariables,A.timeZone,A.dataLinkPostProcessor)}return M})}function b(A,W,N,w){if(W.type!==i.PU.number||(0,t.isNumber)(A.min)&&(0,t.isNumber)(A.max))return{newGlobalRange:N};if(A.fieldMinMax){const F=(0,y.AP)(W),M=A.min??F.min,H=A.max??F.max;return{range:{min:M,max:H,delta:H-M},newGlobalRange:N}}const j=N??d(w),V=A.min??j.min,U=A.max??j.max;return{range:{min:V,max:U,delta:U-V},newGlobalRange:j}}function E(A,W=2500){const N=new Map;for(let w=-1;w<=15;w++)N.set(w,new Map);return(w,j)=>{let V=N.get(j??-1),U=V.get(w);return U||(V.size===W&&V.clear(),U=A(w,j),U.color&&(U.color=(0,f.ze)(U.color)),V.set(w,U)),U}}function v(A,W,N){const j=N.fieldConfigRegistry.getIfExists(W.id);if(!j)return;const V=j.process(W.value,N,j.settings);V==null?j.isCustom&&A.custom?(0,t.unset)(A.custom,j.path):(0,t.unset)(A,j.path):j.isCustom?(A.custom||(A.custom={}),(0,t.set)(A.custom,j.path,V)):(0,t.set)(A,j.path,V)}function C(A,W,N){A.links&&W.links&&(A.links=[...A.links,...W.links]);const w=W?.thresholds?.mode===s.Ol.Absolute&&W.thresholds?.steps.find(j=>j.value===-1/0);A.thresholds?.mode===s.Ol.Absolute&&!A.thresholds.steps.some(j=>j.value===-1/0)&&w&&(A.thresholds.steps=[w,...A.thresholds.steps]);for(const j of N.fieldConfigRegistry.list())j.isCustom&&!A.custom&&(A.custom={}
1),S(j.isCustom?A.custom:A,j.isCustom?W.custom:W,j,N);O(A)}function S(A,W,N,w){const j=(0,t.get)(A,N.path);if(j==null){const V=w.fieldConfigRegistry.getIfExists(N.id);if(!V)return;if(V&&V.shouldApply(w.field)){const U=V.process((0,t.get)(W,V.path),w,V.settings);U!=null&&(0,t.set)(A,V.path,U)}}}function O(A){const{thresholds:W}=A;if(A.color?A.color.mode||delete A.color:W&&(A.color={mode:x.Y.Thresholds}),A.hasOwnProperty("min")&&A.hasOwnProperty("max")&&A.min>A.max){const N=A.max;A.max=A.min,A.min=N}}const I=A=>{const{link:W,linkModel:N,dataLinkScopedVars:w,field:j,replaceVariables:V}=A;return W.internal?(0,g.u)({link:W,internalLink:W.internal,scopedVars:w,field:j,range:W.internal.range,replaceVariables:V}):N},R=(A,W,N,w,j,V)=>U=>!W.config.links||W.config.links.length===0?[]:W.config.links.map(M=>{const H=K(A,W,N),_={...N,__dataContext:H},Z=(Y,Q,J)=>w(Y,{..._,...Q},J);U.valueRowIndex!==void 0&&!isNaN(U.valueRowIndex)?H.value.rowIndex=U.valueRowIndex:H.value.calculatedValue=U.calculatedValue;let ne,te=M.onClick||!M.onBuildUrl?M.url:M.onBuildUrl({origin:W,replaceVariables:Z});return te&&(te=p.I.assureBaseUrl(te.replace(/\n/g,"")),te=w(te,_,m.$m.UriEncode),te=p.I.processUrl(te)),M.onClick?ne={href:te,title:w(M.title||"",_),target:M.targetBlank?"_blank":void 0,onClick:(Y,Q)=>{M.onClick({origin:Q??W,e:Y,replaceVariables:Z})},origin:W,oneClick:M.oneClick??!1}:ne={href:te,title:w(M.title||"",_),target:M.targetBlank?"_blank":void 0,origin:W,oneClick:M.oneClick??!1},(V||I)({frame:A,field:W,dataLinkScopedVars:_,replaceVariables:w,config:U,link:M,linkModel:ne})}).filter(M=>!!M);function T(A){if(!A||A.length===0)return[];const W=[...A],N=(0,c.H)();for(let w=0;w<W.length;w++){const j={...W[w]},V=[...j.fields];for(let U=0;U<V.length;U++)V[U]={...V[U],display:N};W[w]={...j,fields:V}}return W}function L(A,W,N,w,j,V,U){const F=A?.fieldConfigRegistry,M=(0,r.useRef)(0),H=(0,o.A)(N?.series);return(0,r.useMemo)(()=>{if(!F||!W||!N)return;const _=N?.series;N.structureRev==null&&_&&H&&!(0,a.J3)(_,H,a.bW)&&M.current++;const Z={structureRev:M.current,...N,series:D({data:_,fieldConfig:W,fieldConfigRegistry:F,replaceVariables:V,theme:j,timeZone:w,dataLinkPostProcessor:U})};return N.annotations&&N.annotations.length>0&&(Z.annotations=D({data:N.annotations,fieldConfig:{defaults:{},overrides:[]},replaceVariables:V,theme:j,timeZone:w,dataLinkPostProcessor:U})),Z},[F,W,N,H,w,j,V,U])}function K(A,W,N){return N?.__dataContext?{value:{...N.__dataContext.value}}:{value:{frame:A,field:W,data:[A]}}}},16515:(ee,B,e)=>{"use strict";e.d(B,{Ct:()=>a,Fm:()=>s,Ri:()=>o,fk:()=>f,j2:()=>m});var t=e(36638),n=e(95004),r=e(71642);
1function o(u,i){if(u.name)return u.name;const x=[];for(const g of u.fields)if(g.type!==n.PU.time){if(x.length>1)break;x.push(a(g,u))}return x.length===1?x[0]:i===void 0&&u.fields.length>0?u.fields.filter(g=>g.type!==n.PU.time).map(g=>a(g,u)).join(", "):u.refId?`Series (${u.refId})`:`Series (${i})`}function s(u){u.forEach(i=>{i.fields.forEach(x=>{a(x,i,u)})})}function m(u,i){u.forEach(x=>{x.fields.forEach(g=>{const p={legend:!1,tooltip:!1,viz:!1,...i.defaults.custom?.hideFrom},c=g.config.custom?.hideFrom;i.overrides.forEach(y=>{if("__systemRef"in y)return;if((0,t.NS)(y.matcher)(g,x,u))for(const d of y.properties)d.id==="custom.hideFrom"&&Object.assign(p,d.value)}),g.state={...g.state,hideFrom:{...c}},g.config.custom.hideFrom=p})})}function a(u,i,x){const g=u.state?.displayName,p=!!(x&&x.length>1);if(g&&p===u.state?.multipleFrames)return g;const c=l(u,i,x);return u.state=u.state||{},u.state.displayName=c,u.state.multipleFrames=p,c}function l(u,i,x){const g=u.config?.displayName&&u.config?.displayName.length,p=!!i?.meta?.timeCompare?.isTimeShiftQuery;let c=g?u.config.displayName:u.name;if(g)return p?`${c} (comparison)`:c;if(i&&u.config?.displayNameFromDS)return p?`${u.config.displayNameFromDS} (comparison)`:u.config.displayNameFromDS;if(u.type===n.PU.time&&!u.labels)return c??n.LE;let y=[],P=!1;if(x&&x.length>1){for(let b=1;b<x.length;b++)if(x[b].name!==x[b-1].name){P=!0;break}}let d=!1,D=!1;if(P&&i?.name&&(y.push(i.name),d=!0),u.name&&u.name!==n.Bc&&y.push(u.name),u.labels&&i){let b=h(x??[i]);if(b)u.labels[b]&&(y.push(u.labels[b]),D=!0);else{let E=(0,r.h6)(u.labels);E&&(y.push(E),D=!0)}}return i&&!d&&!D&&u.name===n.Bc&&i.name&&i.name.length>0&&(y.push(i.name),d=!0),y.length?c=y.join(" "):u.name?c=u.name:c=n.Bc,c===u.name&&(c=f(u,i)),p&&(c=`${c} (comparison)`),c}function f(u,i){let x=0,g=!1;if(i)for(let p=0;p<i.fields.length;p++){const c=i.fields[p];if(u===c){if(g=!0,x>0){x++;break}}else if(u.name===c.name&&(x++,g))break}return x?`${u.name} ${x}`:u.name}function h(u){let i=null;for(let x=0;x<u.length;x++){const g=u[x];for(const p of g.fields)if(p.labels){for(const c in p.labels)if(i===null)i=c;else if(c!==i)return null}}return i}},7102:(ee,B,e)=>{"use strict";e.d(B,{F:()=>s});var t=e(2543),n=e.n(t),r=e(55386),o=e(11576);function s(m){return new Proxy({},{get:(a,l)=>{let f=m.frame.fields.find(x=>l===x.name);if(!f){const x=(0,t.toNumber)(l);f=m.frame.fields[x]}if(f||(f=m.frame.fields.find(x=>l===x.config.displayName)),f||(f=m.frame.fields.find(x=>x.labels?l===x.labels.name:!1)),!f)return;const h=f.display??(0,o.J)(),u=f.values[m.rowIndex],i=h(u);return i.toString=()=>(0,r.cN)(i),i}})}},38809:(ee,B,e)=>{"use strict";e.d(B,{AM:()=>r,Ch:()=>o,FM:()=>u,N7:()=>f,OU:()=>l,X4:()=>i,cz:()=>s,hL:()=>a,hS:()=>t,lG:()=>h,m0:()=>n,xT:()=>m});const t=x=>x,n=(x,g,p)=>{if(x!=null)return parseFloat(String(x))},r=(x,g,p)=>(delete g.field?.state?.displayName,l(x,g,p)),o=(x,g,p)=>x,s=(x,g,p)=>x,m=(x,g,p)=>x,a=(x,g,p)=>x,l=(x,g,p)=>x==null?x:p&&p.expandTemplateVars&&g.replaceVariables&&typeof x=="string"?g.replaceVariables(x,g.field.state.scopedVars):`${x}`,f=(x,g,p)=>x,h=(x,g,p)=>x,u=(x,g,p)=>x;var i=(x=>(x.IncludeAll="all",x.ExcludeBaseNames="exclude",x.OnlyBaseNames="only",x))(i||{})},79118:(ee,B,e)=>{"use strict";e.d(B,{AP:()=>f,jc:()=>a,xg:()=>h});var t=e(2543),n=e.n(t),r=e(46644),o=e(95004),s=e(76637),m=e(36394);function a(u,i){if(u.type===o.PU.boolean)return l(u,i);const g=(0,s.Qi)(u).getCalculator(u,i),p=u.state?.range??f(u);return c=>{let y=0;c!==-1/0&&(y=(c-p.min)/p.delta,Number.isNaN(y)&&(y=0));const P=(0,m.k5)(u,c,y);return{percent:y,threshold:P,color:g(c,y,P)}}}function l(u,i){const x={color:i.visualization.getColorByName("green"),percent:1,threshold:void 0},g={color:i.visualization.getColorByName("red"),percent:0,threshold:void 0},p=(0,s.Qi)(u);if(p.isContinuous&&p.getColors){const c=p.getColors(i);x.color=c[c.length-1],g.color=c[0]}return c=>c?x:g}function f(u){if(u.type!==o.PU.number)return{min:0,max:100,delta:100};let i=u.config.min,x=u.config.max;if(!(0,t.isNumber)(i)||!(0,t.isNumber)(x))if(u.values&&u.values.length){const g=(0,r.Nw)({field:u,reducers:[r.gy.min,r.gy.max]});(0,t.isNumber)(i)||(i=g[r.gy.min]),(0,t.isNumber)(x)||(x=g[r.gy.max])}else i=0,x=100;return{min:i,max:x,delta:x-i}}function h(u,i){const{config:x}=u;let{min:g,max:p}=x;return(0,t.isNumber)(g)&&(0,t.isNumber)(p)?x:i||!u.state?.range?{...x,...f(u)}:{...x,...u.state.range}}},53543:(ee,B,e)=>{"use strict";e.d(B,{D:()=>o,G:()=>r});var t=e(42954),n=e(76803);const r=new n.K,o=new t.O},36394:(ee,B,e)=>{"use strict";e.d(B,{QS:()=>r,RU:()=>m,k5:()=>s,yQ:()=>o});var t=e(64394),n=e(33553);const r={value:0,color:t.F};function o(a,l){if(!l||l.length===0)return r;let f=l[0];for(const h of l)if(a>=h.value)f=h;else break;return f}function s(a,l,f){const{thresholds:h}=a.config;return h?.mode===n.O.Percentage?o(f*100,h?.steps):o(l,h?.steps)}function m(a){return a.sort((l,f)=>l.value-f.value)}},6199:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{AbstractLabelOperator:()=>et.D_,AlertState:()=>nn.O,AnnotationChangeEvent:()=>b.We,AnnotationEventFieldSource:()=>Wt.V,AppEvents:()=>tn.r1,AppPlugin:()=>On.hX,ArrayDataFrame:()=>f.f,ArrayVector:()=>En,BinaryOperationID:()=>le.k,BusEventBase:()=>d.a,BusEventWithPayload:()=>d.x,ByNamesMatcherMode:()=>je.PP,CSVHeaderStyle:()=>se.F7,CSVReader:()=>se.i8,CircularDataFrame:()=>zn.x,CircularVector:()=>en.$,CoreApp:()=>On.Jk,CustomVariableSupport:()=>Zt.f5,DEFAULT_FIELD_DISPLAY_VALUES_LIMIT:()=>T.Pm,DEFAULT_SAML_NAME:()=>Vt.En,DashboardCursorSync:()=>Je.y,DashboardLoadedEvent:()=>b.gc,DataFrameType:()=>Pt.m,DataFrameView:()=>n.R,DataHoverClearEvent:()=>b.ql,DataHoverEvent:()=>b.b_,DataLinkBuiltInVars:()=>F.c,DataLinkConfigOrigin:()=>rt.x0,DataQueryErrorType:()=>_t.v2,DataSelectEvent:()=>b.LO,DataSourceApi:()=>_t.mA,DataSourcePlugin:()=>_t.tD,DataSourcePluginContextProvider:()=>vn.p,DataSourceTestFailed:()=>b.LL,DataSourceTestSucceeded:()=>b.NI,DataSourceUpdatedSuccessfully:()=>b.wE,DataSourceVariableSupport:()=>Zt.ZV,DataTopic:()=>x.QR,DataTransformerID:()=>tt.F,DefaultTimeZone:()=>yt.lE,DocsId:()=>M.f,EventBusSrv:()=>D.o,ExploreMode:()=>_t.ZF,FALLBACK_COLOR:()=>Bt.F,FeatureState:()=>On.Ay,FieldCache:()=>r.L,FieldColorModeId:()=>Bt.Y,FieldConfigEditorBuilder:()=>W.bk,FieldConfigOptionsRegistry:()=>v.K,FieldConfigProperty:()=>Fn.uo,FieldMatcherID:()=>Ke.Ct,FieldNamePickerBaseNameMode:()=>A.X4,FieldType:()=>It.PU,FrameGeometrySourceMode:()=>x.aG,FrameMatcherID:()=>Ke.jR,GAUGE_DEFAULT_MAXIMUM:()=>Vt.d1,GAUGE_DEFAULT_MINIMUM:()=>Vt.tw,GrafanaPlugin:()=>gn.Ud,GrafanaThemeType:()=>Rt.I,HttpRequestMethod:()=>it.DO,ISO_8601:()=>lt.mt,InternalTimeZones:()=>Et.g$,LanguageProvider:()=>_t.Is,LayoutModes:()=>xt.R,LegacyGraphHoverClearEvent:()=>tn.Tq,LegacyGraphHoverEvent:()=>tn.kb,LegacyMappingType:()=>ne.An,LiveChannelConnectionState:()=>$t.ZF,LiveChannelEventType:()=>$t.o4,LiveChannelScope:()=>$t.qD,LiveChannelType:()=>$t.os,LoadingState:()=>N.Gu,LocalStorageValueProvider:()=>He.b,LogLevel:()=>Ot.$b,LogRowContextQueryDirection:()=>Ot.ZF,LogSortOrderChangeEvent:()=>Ot.Df,LogsDedupDescription:()=>Ot._C,LogsDedupStrategy:()=>x.fY,LogsMetaKind:()=>Ot.tG,LogsSortOrder:()=>x.uH,LogsVolumeType:()=>Ot.Aj,MISSING_VALUE:()=>o.p,MappingType:()=>aa.d,MatcherID:()=>Ke.cV,MutableDataFrame:()=>o.k,NodeGraphDataFrameFieldNames:()=>De.u,NullValueMode:()=>N.UW,NumericLogLevel:()=>Ot.s5,OneClickMode:()=>rt.yd,OrgRole:()=>ft.X,PageLayoutType:()=>mt.k,PanelEvents:()=>tn.ee,PanelOptionsEditorBuilder:()=>W.pv,PanelPlugin:()=>At.m,PluginContextProvider:()=>Cn.a,PluginErrorCode:()=>gn.ZK,PluginExtensionPoints:()=>an.S,PluginExtensionTypes:()=>an.u,PluginIncludeType:()=>gn.ib,PluginLoadingStrategy:()=>gn.xf,PluginSignatureStatus:()=>gn.Ac,PluginSignatureType:()=>gn.kv,PluginState:()=>gn.pn,PluginType:()=>gn.QE,ReducerID:()=>Re.gy,Registry:()=>J.O,SetPanelAttentionEvent:()=>b.Tp,SpecialValue:()=>na.N,SpecialValueMatch:()=>aa.W,StandardVariableSupport:()=>Zt.J$,Store:()=>Ce.i,StreamingDataFrame:()=>l.k9,StreamingFrameAction:()=>l.Kh,SupplementaryQueryType:()=>Ot.cF,SupportedTransformationType:()=>rt.CC,SystemDateFormatsState:()=>Tt.JE,TIME_FORMAT:()=>yt.G$,TIME_SERIES_METRIC_FIELD_NAME:()=>It.aI,TIME_SERIES_TIME_FIELD_NAME:()=>It.LE,TIME_SERIES_VALUE_FIELD_NAME:()=>It.Bc,ThemeContext:()=>Oe.D,ThresholdsMode:()=>Nt.O,TransformationApplicabilityLevels:()=>na.M,TransformerCategory:()=>Qe.m,UnaryOperationID:()=>me._,VAR_CALC:()=>T.k_,VAR_CELL_PREFIX:()=>T.a_,VAR_FIELD_LABELS:()=>T.nF,VAR_FIELD_NAME:()=>T.py,VAR_SERIES_NAME:()=>T.k3,ValueMatcherID:()=>Ke.Js,VariableHide:()=>
1jt.zL,VariableOrigin:()=>rt.$0,VariableRefresh:()=>jt.CO,VariableSort:()=>jt.ZG,VariableSuggestionsScope:()=>rt.uP,VariableSupportBase:()=>Zt.xi,VariableSupportType:()=>Zt.Qz,VisualizationSuggestionScore:()=>mn.nQ,VisualizationSuggestionsBuilder:()=>mn.v2,VisualizationSuggestionsListAppender:()=>mn.NV,VizOrientation:()=>mn.wV,addDurationToDate:()=>_e.Ri,addRow:()=>a.uY,amendTable:()=>t.c,anySeriesWithTimeField:()=>a.tP,anyToNumber:()=>_.t,applyFieldOverrides:()=>S.we,applyNullInsertThreshold:()=>ce.M,applyRawFieldOverrides:()=>S.K3,arrayToDataFrame:()=>f.I,arrayUtils:()=>Ne,availableIconsIndex:()=>Yt.az,binaryOperators:()=>le.b,booleanOverrideProcessor:()=>A.FM,booleanValueFormatter:()=>we.Qc,buildHistogram:()=>Ye.p3,cacheFieldDisplayNames:()=>I.Fm,classicColors:()=>fe,closestIdx:()=>l.Ls,colorManipulator:()=>ye.MV,compareArrayValues:()=>u.J3,compareDataFrameStructures:()=>u.bW,containsSearchFilter:()=>te.E,contentTypeOptions:()=>it.Ur,convertOldAngularValueMappings:()=>ne.bh,createDataFrame:()=>s.EI,createDimension:()=>m.r4,createFieldConfigRegistry:()=>Xt.O,createTheme:()=>Ee.a,dataFrameFromJSON:()=>h.or,dataFrameToJSON:()=>h.Nw,dataLinksOverrideProcessor:()=>A.Ch,dateMath:()=>Be,dateTime:()=>lt.KQ,dateTimeAsMoment:()=>lt.AN,dateTimeForTimeZone:()=>lt.oZ,dateTimeFormat:()=>Mt.LE,dateTimeFormatISO:()=>Mt.M7,dateTimeFormatTimeAgo:()=>Mt.fq,dateTimeFormatWithAbbrevation:()=>Mt._Q,dateTimeParse:()=>wt.b,decodeFieldValueEntities:()=>h.t,decodeFieldValueEnums:()=>h.EL,defaultActionConfig:()=>it.mx,defaultCalcs:()=>Re.C6,deprecationWarning:()=>X.l,displayNameOverrideProcessor:()=>A.AM,doStandardCalcs:()=>Re.H3,durationToMilliseconds:()=>_e.WT,ensureTimeField:()=>Ge.ks,escapeRegex:()=>g.$f,escapeStringForRegex:()=>g.jD,eventFactory:()=>P.R,fieldColorModeRegistry:()=>E.uf,fieldMatchers:()=>
1$e.sJ,fieldReducers:()=>Re.AS,filterFieldConfigOverrides:()=>bt.aW,findCommonLabels:()=>oe.yO,findHighlightChunksInText:()=>p.Oq,findMatchesInText:()=>p.bs,findUniqueLabels:()=>oe.s6,fixCellTemplateExpressions:()=>T.Zo,formatLabels:()=>oe.h6,formattedValueToString:()=>we.cN,frameMatchers:()=>$e.RE,getActiveThreshold:()=>C.yQ,getAllValuesFromDimension:()=>m.Km,getBuiltInThemes:()=>xe.k,getColumnFromDimension:()=>m.P4,getColumnsFromDimension:()=>m.g6,getDataFrameRow:()=>s.Yn,getDataSourceRef:()=>q.p$,getDataSourceUID:()=>q.Iz,getDefaultRelativeTimeRange:()=>yt.Cn,getDefaultTimeRange:()=>yt.E2,getDimensionByName:()=>m.xB,getDisplayProcessor:()=>L.J,getDisplayValueAlignmentFactors:()=>T.XS,getFieldColorMode:()=>E.Hs,getFieldColorModeForField:()=>E.Qi,getFieldConfigWithMinMax:()=>R.xg,getFieldDataContextClone:()=>S.vd,getFieldDisplayName:()=>I.Ct,getFieldDisplayValues:()=>T.PI,getFieldDisplayValuesProxy:()=>O.F,getFieldMatcher:()=>$e.NS,getFieldSeriesColor:()=>E.lz,getFieldTypeFromValue:()=>s.oE,getFlotPairs:()=>w,getFlotPairsConstant:()=>j,getFrameDisplayName:()=>I.Ri,getFrameMatchers:()=>$e.Dq,getHistogramFields:()=>Ye.ix,getLinksSupplier:()=>S._M,getLocale:()=>lt.JK,getLocaleData:()=>lt.XN,getMinMaxAndDelta:()=>R.AP,getNextRefId:()=>i.M,getPanelOptionsWithDefaults:()=>bt.F,getProcessedDataFrames:()=>s.Bt,getRawDisplayProcessor:()=>L.H,getRowUniqueId:()=>a.t9,getScaleCalculator:()=>R.jc,getSearchFilterScopedVar:()=>te.c,getSeriesTimeStep:()=>pe,getThemeById:()=>xe.g,getTimeField:()=>s.KR,getTimeZone:()=>st.O,getTimeZoneGroups:()=>Et.U3,getTimeZoneInfo:()=>Et.QZ,getTimeZones:()=>Et.P3,getUniqueFieldName:()=>I.fk,getValueFormat:()=>we.j_,getValueFormats:()=>we.Ke,getValueFormatterIndex:()=>we.uH,getValueFromDimension:()=>m.WK,getValueMatcher:()=>$e.kK,getWeekdayIndex:()=>lt.xQ,getWeekdayIndexByEnglishName:()=>lt.pp,getZone:()=>Et.HD,guessDecimals:()=>ae.E,guessFieldTypeForField:()=>s.dF,guessFieldTypeFromNameAndValue:()=>s.by,guessFieldTypeFromValue:()=>s.HW,guessFieldTypes:()=>s.XQ,hasLinks:()=>T.eG,hasLogsContextSupport:()=>Ot.Ol,hasLogsContextUiSupport:()=>Ot.wj,hasMsResolution:()=>de,hasQueryExportSupport:()=>et.Ee,hasQueryImportSupport:()=>et.FL,hasQueryModificationSupport:()=>Ot._0,hasSupplementaryQuerySupport:()=>Ot.Nc,hasTimeField:()=>a.S1,hasToggleableQueryFiltersSupport:()=>Ot.FP,histogramBucketSizes:()=>Ye.rW,histogramFieldInfo:()=>Ye.Rt,histogramFieldsToFrame:()=>Ye.cg,histogramFrameBucketMaxFieldName:()=>Ye.dA,histogramFrameBucketMinFieldName:()=>Ye.d$,histogramTransformer:()=>Ye.OA,httpMethodOptions:()=>it.ki,identityOverrideProcessor:()=>A.hS,incrRound:()=>Ye.ZU,incrRoundDn:()=>Ye.rs,incrRoundUp:()=>Ye.Uh,intervalToAbbreviatedDurationString:()=>_e.dU,isBooleanUnit:()=>we.j9,isCustomFieldProp:()=>bt.TQ,isDataFrame:()=>s.ci,isDataFrameWithValue:()=>s.LI,isDataSourcePluginContext:()=>Dt.S,isDataSourceRef:()=>q.fN,isDateTime:()=>lt.Ar,isDateTimeInput:()=>lt.u8,isEmptyObject:()=>ie.R,isEqualityOrMultiOperator:()=>Jt.RU,isHistogramFrameBucketMaxFieldName:()=>Ye.H1,isHistogramFrameBucketMinFieldName:()=>Ye.NX,isIconName:()=>Yt.n6,isLikelyAscendingVector:()=>ze.g2,isLiveChannelJoinEvent:()=>$t.Cz,isLiveChannelLeaveEvent:()=>$t.jQ,isLiveChannelMessageEvent:()=>$t.Z7,isLiveChannelStatusEvent:()=>$t.ew,isObject:()=>N.Gv,isReducerID:()=>Re.Em,isStandardFieldProp:()=>bt.nx,isSystemOverride:()=>Fn.Ow,isSystemOverrideWithRef:()=>Fn.ZW,isTableData:()=>s.pH,isTimeSeriesField:()=>a.hF,isTimeSeriesFrame:()=>a.aH,isTimeSeriesFrames:()=>a.jq,isTruthy:()=>N.zz,isUnsignedPluginSignature:()=>qt.x,isValidDate:()=>_e.vd,isValidDuration:()=>_e.di,isValidGoDuration:()=>_e.pp,isValidGrafanaDuration:()=>_e.V3,isValidLiveChannelAddress:()=>$t.aj,joinHistograms:()=>Ye.EO,localTimeFormat:()=>Tt.Od,locale:()=>we.Hg,locationUtil:()=>V.I,makeClassES5Compatible:()=>H.Y,makeTimeRange:()=>yt.HW,mapInternalLinkToExplore:()=>F.u,matchAllLabels:()=>oe._p,matchPluginId:()=>Q._,monacoLanguageRegistry:()=>Se.l,nullToValue:()=>Pe.C,numberOverrideProcessor:()=>A.m0,objRemoveUndefined:()=>ie.w,onUpdateDatasourceJsonDataOption:()=>q.PG,onUpdateDatasourceJsonDataOptionChecked:()=>q.EX,onUpdateDatasourceJsonDataOptionSelect:()=>q.BD,onUpdateDatasourceOption:()=>q.zX,onUpdateDatasourceResetOption:()=>q.yV,onUpdateDatasourceSecureJsonDataOption:()=>q.mn,onUpdateDatasourceSecureJsonDataOptionSelect:()=>q.wY,outerJoinDataFrames:()=>ze.Fd,parseDuration:()=>_e.E9,parseFlags:()=>p.bQ,parseLabels:()=>oe.Xy,parseLiveChannelAddress:()=>$t.DG,patchArrayVectorProrotypeMethods:()=>Nn.V,preProcessPanelData:()=>s.N$,preferredVisualizationTypes:()=>N.Nx,rangeUtil:()=>Xe,readCSV:()=>se.Jh,reduceField:()=>Re.Nw,renderLegendFormat:()=>Y.j,renderMarkdown:()=>c.G,renderTextPanelMarkdown:()=>c.P,restoreCustomOverrideRules:()=>bt.H9,reverseDataFrame:()=>s.q7,reverseParseDuration:()=>_e.Q7,reverseScopeFilterOperatorMap:()=>Jt.Dv,roundDecimals:()=>ae.h,scaledUnits:()=>we.yP,scopeFilterOperatorMap:()=>Jt.n9,selectOverrideProcessor:()=>
1A.hL,serializeStateToUrlParam:()=>U.Pp,setLocale:()=>lt.xS,setTimeZoneResolver:()=>st.G,setWeekStart:()=>lt.$D,shallowCompare:()=>u.ab,simpleCountUnit:()=>we.UR,sortDataFrame:()=>s.ES,sortThresholds:()=>C.RU,standardEditorsRegistry:()=>K.D,standardFieldConfigEditorRegistry:()=>K.G,standardTransformers:()=>Me.c,standardTransformersRegistry:()=>Qe.h,store:()=>Ce.M,stringFormater:()=>we.cH,stringOverrideProcessor:()=>A.OU,stringStartsAsRegEx:()=>g.AP,stringToJsRegex:()=>g.dO,stringToMs:()=>g.dc,systemDateFormats:()=>Tt.WC,textUtil:()=>y.sQ,thresholdsOverrideProcessor:()=>A.N7,throwIfAngular:()=>ke.M,timeZoneAbbrevation:()=>Mt.jw,timeZoneFormatUserFriendly:()=>Et.le,toCSV:()=>se._O,toDataFrame:()=>s.Vc,toDataFrameDTO:()=>s.Kl,toDuration:()=>lt.Ah,toFilteredDataFrameDTO:()=>s.By,toFixed:()=>we.Mg,toFixedScaled:()=>we.gZ,toFixedUnit:()=>we.G8,toFloatOrUndefined:()=>g.$D,toIconName:()=>Yt.Uo,toIntegerOrUndefined:()=>g.vb,toLegacyResponseData:()=>s.w3,toLiveChannelId:()=>$t.Qp,toNumberString:()=>g.kT,toOption:()=>Te.z,toPascalCase:()=>g.MX,toURLRange:()=>U.sQ,toUtc:()=>lt.yT,transformDataFrame:()=>Ve.m,trimTable:()=>t.F,unEscapeStringFromRegex:()=>g.xb,unaryOperators:()=>me.j,unitOverrideProcessor:()=>A.lG,updateDatasourcePluginJsonDataOption:()=>q.lO,updateDatasourcePluginOption:()=>q.pN,updateDatasourcePluginResetOption:()=>q.QP,updateDatasourcePluginSecureJsonDataOption:()=>q.wp,urlUtil:()=>U.kM,useFieldOverrides:()=>S.rJ,usePluginContext:()=>Wn.Q,userHasAllPermissions:()=>Gn.Fj,userHasAnyPermission:()=>Gn.jW,userHasPermission:()=>Gn.ZU,userHasPermissionInMetadata:()=>Gn.T6,validateFieldConfig:()=>S.BF,valueMappingsOverrideProcessor:()=>A.xT,valueMatchers:()=>$e.hI,vectorator:()=>ln.E,withLoadingIndicator:()=>Z.k});var t=e(15083),n=e(88673),r=e(10279),o=e(18700),s=e(41119),m=e(26332),a=e(39884),l=e(51388),f=e(27359),h=e(77154),u=e(76732),i=e(39796),x=e(739),g=e(8934),p=e(38388),c=e(67458),y=e(63704),P=e(36819),d=e(68388),D=e(19379),b=e(57852),E=e(76637),v=e(76803),C=e(36394),S=e(60519),O=e(7102),I=e(16515),R=e(79118),T=e(44232),L=e(11576),K=e(53543),A=e(38809),W=e(52205),N=e(28105);function w({xField:St,yField:Ht,nullValueMode:cn}){const un=St.values,bn=Ht.values,Sn=un.length;if(bn.length!==Sn)throw new Error("Unexpected field length");const wn=cn===N.UW.Ignore,ea=cn===N.UW.AsZero,Zn=[];for(let Vn=0;Vn<Sn;Vn++){const _n=un[Vn];let Ln=bn[Vn];if(Ln===null){if(wn)continue;ea&&(Ln=0)}_n!==null&&Zn.push([_n,Ln])}return Zn}function j(St,Ht){if(!Ht.from||!Ht.to||!St||St.length===0)return[];const cn=Ht.from.valueOf(),un=Ht.to.valueOf(),bn=St[0][1];return[[cn,bn],[un,bn]]}var V=e(92138),U=e(5556),F=e(38036),M=e(28882),H=e(35814),_=e(13227),Z=e(47520),ne=e(35987),te=e(94452),Y=e(428),Q=e(8134),J=e(42954),q=e(48480),X=e(37615),se=e(68125),oe=e(71642),ae=e(79243),ie=e(3594);const fe=["#7EB26D","#EAB839","#6ED0E0","#EF843C","#E24D42","#1F78C1","#BA43A9","#705DA0","#508642","#CCA300","#447EBC","#C15C17","#890F02","#0A437C","#6D1F62","#584477","#B7DBAB","#F4D598","#70DBED","#F9BA8F","#F29191","#82B5D8","#E5A8E2","#AEA2E0","#629E51","#E5AC0E","#64B0C8","#E0752D","#BF1B00","#0A50A1","#962D82","#614D93","#9AC48A","#F2C96D","#65C5DB","#F9934E","#EA6460","#5195CE","#D683CE","#806EB7","#3F6833","#967302","#2F575E","#99440A","#58140C","#052B51","#511749","#3F2B5B","#E0F9D7","#FCEACA","#CFFAFF","#F9E2D2","#FCE2DE","#BADFF4","#F9D9F9","#DEDAF7"],pe=St=>{let Ht,cn,un=Number.MAX_VALUE;for(let bn=0;bn<St.values.length;bn++){const Sn=St.values[bn];if(Ht!==void 0){const wn=Sn-Ht;cn===void 0&&(un=wn),wn<un&&(un=wn)}Ht=Sn}return un},de=St=>{for(let Ht=0;Ht<St.values.length;Ht++){const cn=St.values[Ht];if(cn!=null){const un=cn.toString();if(un.length===13&&un%1e3!==0)return!0}}return!1};var le=e(12823),me=e(48233),De=e(14613),Te=e(47184),Ne=e(46635),Ce=e(78012),He=e(66615),ke=e(78830),Me=e(96702),$e=e(36638),tt=e(64761),Ke=e(57866),Re=e(46644),Ve=e(2197),Qe=e(8642),je=e(4575),ze=e(8721),Ye=e(74261),Ge=e(406),ce=e(63409),Pe=e(34455),Se=e(54734),Ee=e(69884),xe=e(47070),ye=e(6773),Oe=e(35555),we=e(55386),Be=e(33239),Xe=e(17548),st=e(60188),lt=e(25229),Et=e(62717),Tt=e(5421),Mt=e(80011),wt=e(44922),_e=e(74529),xt=e(78479),At=e(16207),bt=e(69168),Xt=e(37297),Cn=e(20877),vn=e(62392),Wn=e(31595),Dt=e(17564),qt=e(29246),Yt=e(30360),nn=e(76190),Zt=e(48592),tn=e(32899),ft=e(90382),Rt=e(68492),Bt=e(64394),jt=e(7389),Nt=e(33553),$t=e(38619),an=e(54092),Jt=e(27164),gn=e(11
1594),mn=e(38919),_t=e(94644),On=e(1906),Nn=e(44326),Fn=e(83340),na=e(79319),aa=e(18600),yt=e(22592),mt=e(75683),Ot=e(67770),Wt=e(88907),et=e(46933),Je=e(84229),rt=e(79609),it=e(85891),Pt=e(39443),It=e(95004),Vt=e(48588),en=e(94777),ln=e(96453);const Qt="ArrayVector is deprecated and will be removed in Grafana 11. Please use plain arrays for field.values.";let xn=!1;class En extends Array{get buffer(){return this}set buffer(Ht){this.length=0;const cn=Ht?.length;if(cn){let un=65e3,bn=Math.ceil(cn/un);for(let Sn=0;Sn<bn;Sn++)this.push.apply(this,Ht.slice(Sn*un,(Sn+1)*un))}}constructor(Ht){super(),this.buffer=Ht??[],xn||(console.warn(Qt),xn=!0)}toJSON(){return[...this]}}var zn=e(35479),Gn=e(7918)},16207:(ee,B,e)=>{"use strict";e.d(B,{m:()=>l});var t=e(2543),n=e.n(t),r=e(76803),o=e(11594),s=e(52205),m=e(37615),a=e(37297);class l extends o.Ud{constructor(h){super(),this._fieldConfigDefaults={defaults:{},overrides:[]},this._initConfigRegistry=()=>new r.K,this.dataSupport={annotations:!1,alertStates:!1},this.panel=h}get defaults(){let h=this._defaults||{};if(!this._defaults&&this.optionsSupplier){const u=new s.pv;this.optionsSupplier(u,{data:[]});for(const i of u.getItems())i.defaultValue!=null&&(0,t.set)(h,i.path,i.defaultValue)}return h}get fieldConfigDefaults(){const h=this._fieldConfigDefaults.defaults;h.custom={};for(const u of this.fieldConfigRegistry.list())u.defaultValue!==void 0&&(0,t.set)(h,u.id,u.defaultValue);return{defaults:{...h},overrides:this._fieldConfigDefaults.overrides}}setDefaults(h){return(0,m.l)("PanelPlugin","setDefaults","setPanelOptions"),this._defaults=h,this}get fieldConfigRegistry(){return this._fieldConfigRegistry||(this._fieldConfigRegistry=this._initConfigRegistry()),this._fieldConfigRegistry}setEditor(h){return(0,m.l)("PanelPlugin","setEditor","setPanelOptions"),this.editor=h,this}setNoPadding(){return this.noPadding=!0,this}setMigrationHandler(h,u){return this.onPanelMigration=h,this.shouldMigrate=u,this}setPanelChangeHandler(h){return this.onPanelTypeChanged=h,this}setPanelOptions(h){return this.optionsSupplier=h,this}getPanelOptionsSupplier(){return this.optionsSupplier??(()=>{})}setDataSupport(h){return this.dataSupport={...this.dataSupport,...h},this}useFieldConfig(h={}){return this._initConfigRegistry=()=>(0,a.O)(h,this.meta.name),this}setSuggestionsSupplier(h){return this.suggestionsSupplier=h,this}getSuggestionsSupplier(){return this.suggestionsSupplier}hasPluginId(h){return this.meta.id===h}}},69168:(ee,B,e)=>{"use strict";e.d(B,{F:()=>a,H9:()=>x,TQ:()=>g,aW:()=>f,nx:()=>p});var t=e(2543),n=e.n(t),r=e(76637),o=e(64394),s=e(83340),m=e(33553);function a({plugin:c,currentOptions:y,currentFieldConfig:P,isAfterPluginChange:d}){const D=(0,t.mergeWith)({},c.defaults,y||{},(v,C)=>{if((0,t.isArray)(C))return C}),b=l(P,c),E=u(c,b,d);return{options:D,fieldConfig:E}}function l(c,y){const P=y.fieldConfigDefaults,d={defaults:(0,t.mergeWith)({},P.defaults,c?c.defaults:{},(D,b)=>{if((0,t.isArray)(b))return b}),overrides:c?.overrides??[]};h(d.defaults,"",y.fieldConfigRegistry),d.defaults.thresholds&&i(d.defaults.thresholds),d.overrides=f(d.overrides,D=>y.fieldConfigRegistry.getIfExists(D.id)!==void 0);for(const D of d.overrides)for(const b of D.properties)b.id==="thresholds"&&i(b.value);return d}function f(c,y){return c.map(P=>{const d=P.properties.filter(y);return{...P,properties:d}})}function h(c,y,P){let d=!1;for(const[D,b]of Object.entries(c)){const E=`${y}${D}`,v=!!P.getIfExists(E);if(v){d=!0;continue}(0,t.isArray)(b)||!(0,t.isObject)(b)?v||(0,t.unset)(c,D):h(b,`${E}.`,P)||(0,t.unset)(c,D)}return d}function u(c,y,P){if(!P)return y;const d=c.fieldConfigRegistry.getIfExists(s.uo.Color);if(d&&d.settings){const D=d.settings,b=r.uf.getIfExists(y.defaults.color?.mode);if(!D.byValueSupport&&(!b||b.isByValue))return y.defaults.color={mode:o.Y.PaletteClassic},y;if(D.byValueSupport&&D.preferThresholdsMode&&b?.id!==o.Y.Fixed&&(!b||!b.isByValue))return y.defaults.color={mode:o.Y.Thresholds},y;if(D.bySeriesSupport&&b?.isByValue)return y.defaults.color={mode:o.Y.PaletteClassic},y}return y}function i(c){c.mode||(c.mode=m.O.Absolute),c.steps?c.steps.length&&(c.steps[0].value=-1/0):c.steps=[]}function x(c,y){const P={defaults:{...c.defaults,custom:y.defaults.custom},overrides:[...c.overrides]};for(const d of y.overrides)for(const D of d.properties)if(g(D)){const b=P.overrides.find(E=>(0,t.isEqual)(E.matcher,d.matcher));b?b!==d&&b.properties.push(D):P.overrides.push(d)}return P}function g(c){return c.id.startsWith("custom.")}function p(c){return!g(c)}},37297:(ee,B,e)=>{"use strict";e.d(B,{O:()=>o});var t=e(76803),n=e(53543),r=e(52205);function o(m={},a){const l=new t.K,f=n.G.list(),h={};if(m.useCustomConfig){const u=new r.bk;m.useCustomConfig(u);for(const i of u.getRegistry().list())if(i.isCustom=!0,i.id="custom."+i.id,s(i,f)){const x=h[i.category[0]]??[];x.push(i),h[i.category[0]]=x}else l.register(i)}for(let u of f){const i=u.id;if(!(m.disableStandardOptions&&m.disableStandardOptions.indexOf(i)>
1-1)){if(m.standardOptions){const x=m.standardOptions[i]?.hideFromDefaults,g=m.standardOptions[i]?.defaultValue,p=m.standardOptions[i]?.settings;x!==void 0&&(u={...u,hideFromDefaults:x}),g&&(u={...u,defaultValue:g}),p&&(u={...u,settings:u.settings?{...u.settings,...p}:p})}if(l.register(u),u.category&&h[u.category[0]])for(let x of h[u.category[0]])l.register(x)}}for(const u of l.list())if(u.path.indexOf("[")>0)throw new Error(`[${a}] Field config paths do not support arrays: ${u.id}`);return l}function s(m,a){return!!a.find(l=>m.category&&l.category&&m.category[0]===l.category[0])}},39796:(ee,B,e)=>{"use strict";e.d(B,{M:()=>t});const t=r=>{for(let o=0;;o++){const s=n(o);if(!r.some(m=>m.refId===s))return s}};function n(r){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";return r<o.length?o[r]:n(Math.floor(r/o.length)-1)+o[r%o.length]}},15083:(ee,B,e)=>{"use strict";e.d(B,{F:()=>r,c:()=>n});var t=e(51388);function n(o,s){let[m]=o,[a]=s,l=m.length,f=m[0],h=m[l-1],u=a.length,i=a[0],x=a[u-1],g;if(l)if(u){if(i>h)g=o.map((p,c)=>o[c].concat(s[c]));else if(x<f)g=s.map((p,c)=>s[c].concat(o[c]));else if(i<=f&&x>=h)g=s;else if(i>f&&x<h){let p=(0,t.Ls)(i,m);p=m[p]<i?p+1:p;let c=(0,t.Ls)(x,m);c=m[c]>x?c-1:c,g=o.map((y,P)=>o[P].slice(0,p).concat(s[P]).concat(o[P].slice(c+1)))}else if(i>=f){let p=(0,t.Ls)(i,m);p=m[p]<i?p-1:p,g=o.map((c,y)=>o[y].slice(0,p).concat(s[y]))}else if(x>=f){let p=(0,t.Ls)(x,m);p=m[p]<x?p:p+1,g=s.map((c,y)=>s[y].concat(o[y].slice(p)))}}else g=o;else u?g=s:g=[[]];return g}function r(o,s,m){let[a,...l]=o,f,h;return a[0]<s&&(f=(0,t.Ls)(s,a),a[f]<s&&f++),a[a.length-1]>m&&(h=(0,t.Ls)(m,a),a[h]>m&&h--),(f!=null||h!=null)&&(a=a.slice(f??0,h),l=l.map(u=>u.slice(f??0,h))),[a,...l]}},67458:(ee,B,e)=>{"use strict";e.d(B,{G:()=>m,P:()=>a});var t=e(60023),n=e(33836),r=e(63704);let o=!1;const s={pedantic:!1,gfm:!0,breaks:!1};function m(l,f){o||(t.xI.use((0,n.z)()),t.xI.setOptions({...s}),o=!0);let h;f?.breaks&&(h={...s,breaks:!0});const u=(0,t.xI)(l||"",h);if(typeof u!="string")throw new Error("Failed to process markdown synchronously.");return f?.noSanitize?u:(0,r.G$)(u)}function a(l,f){o||(t.xI.use((0,n.z)()),t.xI.setOptions({...s}),o=!0);const h=(0,t.xI)(l||"");if(typeof h!="string")throw new Error("Failed to process markdown synchronously.");return f?.noSanitize?h:(0,r.G$)(h)}},38388:(ee,B,e)=>{"use strict";e.d(B,{Oq:()=>t,bQ:()=>m,bs:()=>r});function t({searchWords:a,textToHighlight:l}){const f=[];for(const h of a)typeof h=="string"&&f.push(...r(l,h));return f}const n=a=>a.replace(/[[{(][\w,.\/:;<=>?:*+]+$/,"");function r(a,l){if(!a||!l)return[];const f=[],{cleaned:h,flags:u}=m(n(l));let i;try{i=new RegExp(`(?:${h})`,u)}catch{return f}return a.replace(i,(x,...g)=>{if(x){const p=g[g.length-2];f.push({text:x,start:p,length:x.length,end:p+x.length})}return""}),f}const o="-",s=/\(\?([ims-]+)\)/g;function m(a){const l=new Set(["g"]);return{cleaned:a.replace(s,(h,u)=>{const i=u.startsWith(o);for(let x=0;x<u.length;++x){const g=u.charAt(x);i||u.charAt(x-1)===o?l.delete(g):g!==o&&l.add(g)}return""}),flags:Array.from(l).join("")}}},46644:(ee,B,e)=>{"use strict";e.d(B,{AH:()=>a,AS:()=>h,C6:()=>i,Em:()=>l,H3:()=>x,Nw:()=>f,gy:()=>m});var t=e(2543),n=e.n(t),r=e(28105),o=e(95004),s=e(42954),m=(v=>(v.sum="sum",v.max="max",v.min="min",v.logmin="logmin",v.mean="mean",v.variance="variance",v.stdDev="stdDev",v.last="last",v.median="median",v.first="first",v.count="count",v.range="range",v.diff="diff",v.diffperc="diffperc",v.delta="delta",v.step="step",v.firstNotNull="firstNotNull",v.lastNotNull="lastNotNull",v.changeCount="changeCount",v.distinctCount="distinctCount",v.allIsZero="allIsZero",v.allIsNull="allIsNull",v.allValues="allValues",v.uniqueValues="uniqueValues",v.p1="p1",v.p2="p2",v.p3="p3",v.p4="p4",v.p5="p5",v.p6="p6",v.p7="p7",v.p8="p8",v.p9="p9",v.p10="p10",v.p11="p11",v.p12="p12",v.p13="p13",v.p14="p14",v.p15="p15",v.p16="p16",v.p17="p17",v.p18="p18",v.p19="p19",v.p20="p20",v.p21="p21",v.p22="p22",v.p23="p23",v.p24="p24",v.p25="p25",v.p26="p26",v.p27="p27",v.p28="p28",v.p29="p29",v.p30="p30",v.p31="p31",v.p32="p32",v.p33="p33",v.p34="p34",v.p35="p35",v.p36="p36",v.p37="p37",v.p38="p38",v.p39="p39",v.p40="p40",v.p41="p41",v.p42="p42",v.p43="p43",v.p44="p44",v.p45="p45",v.p46="p46",v.p47="p47",v.p48="p48",v.p49="p49",v.p50="p50",v.p51="p51",v.p52="p52",v.p53="p53",v.p54="p54",v.p55="p55",v.p56="p56",v.p57="p57",v.p58="p58",v.p59="p59",v.p60="p60",v.p61="p61",v.p62="p62",v.p63="p63",v.p64="p64",v.p65="p65",v.p66="p66",v.p67="p67",v.p68="p68",v.p69="p69",v.p70="p70",v.p71="p71",v.p72="p72",v.p73="p73",v.p74="p74",v.p75="p75",v.p76="p76",v.p77="p77",v.p78="p78",v.p79="p79",v.p80="p80",v.p81="p81",v.p82="p82",v.p83="p83",v.p84="p84",v.p85="p85",v.p86="p86",v.p87="p87",v.p88="p88",v.p89="p89",v.p90="p90",v.p91="p91",v.p92="p92",v.p93="p93",v.p94="p94",v.p95="p95",v.p96="p96",v.p97="p97",v.p98="p98",v.p99="p99",v))(m||{});function a(v,C){return v==="count"||v==="distinctCount"||v==="changeCount"?o.PU.number:v==="allIsNull"||v==="allIsZero"?o.PU.boolean:C}function l(v){return Object.keys(m).includes(v)}function f(v){const{field:C,reducers:S}=v;if(!C||!S||S.length<1)return{};if(C.state?.calcs){const A=[];for(const W of S)C.state.calcs.hasOwnProperty(W)||A.push(W);if(A.length<1)return{...C.state.calcs}}C.state||(C.state={});const O=h.list(S),I=C.values;if(I&&I.length<1){const A={...C.state.calcs};for(const W of O)A[W.id]=W.emptyInputResult!==null?W.emptyInputResult:null;return C.state.calcs=A}
1const{nullValueMode:R=r.UW.Ignore}=C.config,T=R===r.UW.Ignore,L=R===r.UW.AsZero;if(O.length===1&&O[0].reduce){const A=O[0].reduce(C,T,L);return C.state.calcs={...C.state.calcs,...A},A}let K=x(C,T,L);for(const A of O)!K.hasOwnProperty(A.id)&&A.reduce&&(K={...K,...A.reduce(C,T,L)});return C.state.calcs={...C.state.calcs,...K},K}const h=new s.O(()=>[{id:"lastNotNull",name:"Last *",description:"Last non-null value (also excludes NaNs)",standard:!0,aliasIds:["current"],reduce:y,preservesUnits:!0},{id:"last",name:"Last",description:"Last value",standard:!0,reduce:c,preservesUnits:!0},{id:"firstNotNull",name:"First *",description:"First non-null value (also excludes NaNs)",standard:!0,reduce:p,preservesUnits:!0},{id:"first",name:"First",description:"First Value",standard:!0,reduce:g,preservesUnits:!0},{id:"min",name:"Min",description:"Minimum Value",standard:!0,preservesUnits:!0},{id:"max",name:"Max",description:"Maximum Value",standard:!0,preservesUnits:!0},{id:"mean",name:"Mean",description:"Average Value",standard:!0,aliasIds:["avg"],preservesUnits:!0},{id:"median",name:"Median",description:"Median Value",standard:!1,reduce:E,aliasIds:["median"],preservesUnits:!0},{id:"variance",name:"Variance",description:"Variance of all values in a field",standard:!1,reduce:P,preservesUnits:!0},{id:"stdDev",name:"StdDev",description:"Standard deviation of all values in a field",standard:!1,reduce:P,preservesUnits:!0},{id:"sum",name:"Total",description:"The sum of all values",emptyInputResult:0,standard:!0,aliasIds:["total"],preservesUnits:!0},{id:"count",name:"Count",description:"Number of values in response",emptyInputResult:0,standard:!0,preservesUnits:!1},{id:"range",name:"Range",description:"Difference between minimum and maximum values",standard:!0,preservesUnits:!0},{id:"delta",name:"Delta",description:"Cumulative change in value",standard:!0,preservesUnits:!0},{id:"step",name:"Step",description:"Minimum interval between values",standard:!0,preservesUnits:!0},{id:"diff",name:"Difference",description:"Difference between first and last values",standard:!0,preservesUnits:!0},{id:"logmin",name:"Min (above zero)",description:"Used for log min scale",standard:!0,preservesUnits:!0},{id:"allIsZero",name:"All Zeros",description:"All values are zero",emptyInputResult:!1,standard:!0,preservesUnits:!0},{id:"allIsNull",name:"All Nulls",description:"All values are null",emptyInputResult:!0,standard:!0,preservesUnits:!1},{id:"changeCount",name:"Change Count",description:"Number of times the value changes",standard:!1,reduce:d,preservesUnits:!1},{id:"distinctCount",name:"Distinct Count",description:"Number of distinct values",standard:!1,reduce:D,preservesUnits:!1},{id:"diffperc",name:"Difference percent",description:"Percentage difference between first and last values",standard:!0,preservesUnits:!1},{id:"allValues",name:"All values",description:"Returns an array with all values",standard:!1,reduce:v=>({allValues:[...v.values]}),preservesUnits:!1},{id:"uniqueValues",name:"All unique values",description:"Returns an array with all unique values",standard:!1,reduce:v=>({uniqueValues:[...new Set(v.values)]}),preservesUnits:!1},...u()]),u=(v=[...Array.from({length:99},(C,S)=>S+1)])=>{const C=[],S=O=>O>3&&O<21?"th":O%10===1?"st":O%10===2?"nd":O%10===3?"rd":"th";return v.forEach(O=>{const I=O/100,R=`p${O}`,T=`${O}${S(O)} %`,L=`${O}${S(O)} percentile value`;C.push({id:R,name:T,description:L,standard:!1,reduce:(K,A,W)=>({[R]:b(K,I,A,W)}),preservesUnits:!0})}),C},i={sum:0,max:-Number.MAX_VALUE,min:Number.MAX_VALUE,logmin:Number.MAX_VALUE,mean:null,last:null,first:null,lastNotNull:null,firstNotNull:null,count:0,nonNullCount:0,allIsNull:!0,allIsZero:!0,range:null,diff:null,delta:0,step:Number.MAX_VALUE,diffperc:0,previousDeltaUp:!0};function x(v,C,S){const O={...i},I=v.values;if(!I)return O;const R=v.type===o.PU.number||v.type===o.PU.time;for(let T=0;T<I.length;T++){let L=I[T];if(T===0&&(O.first=L),O.last=L,L==null){if(C)continue;S&&(L=0)}if(O.count++,L!=null&&!Number.isNaN(L)){const K=O.firstNotNull===null;if(K&&(O.firstNotNull=L),R){if(O.sum+=L,O.allIsNull=!1,O.nonNullCount++,!K){const A=L-O.lastNotNull;O.step>A&&(O.step=A),O.lastNotNull>L?O.previousDeltaUp=!1:(O.previousDeltaUp&&(O.delta+=A),O.previousDeltaUp=!0)}L>O.max&&(O.max=L),L<O.min&&(O.min=L),L<O.logmin&&L>0&&(O.logmin=L)}L!==0&&(O.allIsZero=!1),O.lastNotNull=L}}return O.max===-Number.MAX_VALUE&&(O.max=null),O.min===Number.MAX_VALUE&&(O.min=null),O.step===Number.MAX_VALUE&&(O.step=null),O.nonNullCount>0&&(O.mean=O.sum/O.nonNullCount),O.allIsNull&&(O.allIsZero=!1),O.max!==null&&O.min!==null&&(O.range=O.max-O.min),(0,t.isNumber)(O.firstNotNull)&&(0,t.isNumber)(O.lastNotNull)&&(O.diff=O.lastNotNull-O.firstNotNull),(0,t.isNumber)(O.firstNotNull)&&(0,t.isNumber)(O.diff)&&(O.diffperc=O.diff/O.firstNotNull*100),O}function g(v,C,S){return{first:v.values[0]}}function p(v,C,S){const O=v.values;for(let I=0;I<O.length;I++){const R=O[I];if(R!=null&&!Number.isNaN(R))return{firstNotNull:R}}return{firstNotNull:null}}function c(v,C,S){const O=v.values;return{last:O[O.length-1]}}function y(v,C,S){const O=v.values;let I=O.length-1;for(;I>=0;){const R=O[I--];if(R!=null&&!Number.isNaN(R))return{lastNotNull:R}}return{lastNotNull:null}}function P(v,C,S){if(!(v.type===o.PU.number||v.type===o.PU.time))return{variance:0,stdDev:0};let O=0,I=0,R=0;const T=v.values;for(let L=0;L<T.length;L++){const K=T[L];if(K!=null){R++;let A=I;I+=(K-A)/R,O+=(K-A)*(K-I)}}if(R>0){const L=O/R;return{variance:L,stdDev:Math.sqrt(L)}}return{variance:0,stdDev:0}}function d(v,C,S){const O=v.values;let I=0,R=!0,T=null;for(let L=0;L<O.length;L++){let K=O[L];if(K===null){if(C)continue;S&&(K=0)}!R&&T!==K&&I++,R=!1,T=K}return{changeCount:I}}function D(v,C,S){const O=v.values,I=new Set;for(let R=0;R<O.length;R++){let T=O[R];if(T===null){if(C)continue;S&&(T=0)}I.add(T)}return{distinctCount:I.size}}function b(v,C,S,O){let I=v.values;S&&(I=I.filter(L=>L!==null)),O&&(I=I.map(L=>L===null?0:L));const R=I.slice().sort((L,K)=>L-K),T=Math.round((R.length-1)*C);return R[T]}function E(v,C,S){const O=[];for(let R=0;R<v.values.length;R++){let T=v.values[R];if(T==null){if(C)continue;S&&(T=0)}O.push(T)}O.sort((R,T)=>R-T);const I=Math.floor(O.length/2);return O.length%2===0?{median:(O[I-1]+O[I])/2}:{median:O[I]}}},36638:(ee,B,e)=>{"use strict";e.d(B,{sJ:()=>M,RE:()=>H,NS:()=>Z,Dq:()=>ne,kK:()=>te,hI:()=>_});var t=e(42954),n=e(95004),r=e(57866);
1const o={id:r.Ct.byType,name:"Field Type",description:"match based on the field type",defaultOptions:n.PU.number,get:Y=>(Q,J,q)=>Y===Q.type,getOptionsDisplayText:Y=>`Field type: ${Y}`},s={id:r.Ct.byTypes,name:"Field Type",description:"match based on the field types",defaultOptions:new Set,get:Y=>(Q,J,q)=>Y.has(Q.type),getOptionsDisplayText:Y=>`Field types: ${[...Y].join(" | ")}`},m={id:r.Ct.numeric,name:"Numeric Fields",description:"Fields with type number",get:()=>o.get(n.PU.number),getOptionsDisplayText:()=>"Numeric Fields"},a={id:r.Ct.time,name:"Time Fields",description:"Fields with type time",get:()=>o.get(n.PU.time),getOptionsDisplayText:()=>"Time Fields"};function l(){return[o,s,m,a]}var f=e(739),h=e(46644),u=e(53685);function i(Y){return Y===h.gy.allIsNull||Y===h.gy.allIsZero}const x={id:r.Ct.byValue,name:"By value (reducer)",description:"Reduce a field to a single value and test for inclusion",defaultOptions:{reducer:h.gy.allIsZero,op:f.zT.GTE,value:0},get:Y=>{if(!Y||!Y.reducer)return()=>!1;let{reducer:Q,op:J,value:q}=Y;const X=i(Q);return J||(J=f.zT.EQ),(se,oe,ae)=>{const ie=(0,h.Nw)({field:se,reducers:[Q]})[Q];return X?!!ie:(0,u.c)(ie,J,q)}},getOptionsDisplayText:Y=>`By value (${Y.reducer})`};var g=e(4575),p=e(6844),c=e(8934);const y={id:r.jR.byRefId,name:"Query refId",description:"match the refId",defaultOptions:"A",get:Y=>{let Q=null;if((0,c.AP)(Y))try{Q=(0,c.dO)(Y)}catch(J){J instanceof Error&&console.warn(J.message)}else if(Y.includes("|")){const J=Y.split("|").map(c.jD).join("|");Q=new RegExp(`^(?:${J})$`)}return J=>Q?.test(J.refId||"")??J.refId===Y},getOptionsDisplayText:Y=>`RefID: ${Y}`};function P(){return[y]}const d={id:r.Ct.first,name:"First Field",description:"The first field in the frame",get:Y=>(Q,J,q)=>Q===J.fields[0],getOptionsDisplayText:()=>"First field"},D={id:r.Ct.firstTimeField,name:"First time field",description:"The first field of type time in a frame",get:Y=>(Q,J,q)=>Q.type===n.PU.time&&Q===J.fields.find(X=>X.type===n.PU.time),getOptionsDisplayText:()=>"First time field"};function b(){return[d,D]}const E={id:r.Js.equal,name:"Is equal",description:"Match where value for given field is equal to options value.",get:Y=>(Q,J)=>J.values[Q]==Y.value,getOptionsDisplayText:()=>"Matches all rows where field is null.",isApplicable:()=>!0,getDefaultOptions:()=>({value:""})},v={id:r.Js.notEqual,name:"Is not equal",description:"Match where value for given field is not equal to options value.",get:Y=>(Q,J)=>J.values[Q]!=Y.value,getOptionsDisplayText:()=>"Matches all rows where field is not null.",isApplicable:()=>!0,getDefaultOptions:()=>({value:""})},C=()=>[E,v],S={id:r.Js.isNull,name:"Is null",description:"Match where value for given field is null.",get:()=>(Y,Q)=>Q.values[Y]==null,getOptionsDisplayText:()=>"Matches all rows where field is null.",isApplicable:()=>!0,getDefaultOptions:()=>({})},O={id:r.Js.isNotNull,name:"Is not null",description:"Match where value for given field is not null.",get:()=>(Y,Q)=>Q.values[Y]!=null,getOptionsDisplayText:()=>"Matches all rows where field is not null.",isApplicable:()=>!0,getDefaultOptions:()=>({})},I=()=>[S,O],R={id:r.Js.greater,name:"Is greater",description:"Match when field value is greater than option.",get:Y=>(Q,J)=>{const q=J.values[Q];return isNaN(q)?!1:q>Y.value},getOptionsDisplayText:Y=>`Matches all rows where field value is greater than: ${Y.value}.`,isApplicable:Y=>Y.type===n.PU.number,getDefaultOptions:()=>({value:0})},T={id:r.Js.greaterOrEqual,name:"Is greater or equal",description:"Match when field value is greater than or equal to option.",get:Y=>(Q,J)=>{const q=J.values[Q];return isNaN(q)?!1:q>=Y.value},getOptionsDisplayText:Y=>`Matches all rows where field value is greater than or equal to: ${Y.value}.`,isApplicable:Y=>Y.type===n.PU.number,getDefaultOptions:()=>({value:0})},L={id:r.Js.lower,name:"Is lower",description:"Match when field value is lower than option.",get:Y=>(Q,J)=>{const q=J.values[Q];return isNaN(q)?!1:q<Y.value},getOptionsDisplayText:Y=>`Matches all rows where field value is lower than: ${Y.value}.`,isApplicable:Y=>Y.type===n.PU.number,getDefaultOptions:()=>({value:0})},K={id:r.Js.lowerOrEqual,name:"Is lower or equal",description:"Match when field value is lower or equal than option.",get:Y=>(Q,J)=>{const q=J.values[Q];return isNaN(q)?!1:q<=Y.value},getOptionsDisplayText:Y=>`Matches all rows where field value is lower or equal than: ${Y.value}.`,isApplicable:Y=>Y.type===n.PU.number,getDefaultOptions:()=>({value:0})},A=()=>[R,T,L,K],W={id:r.Js.between,name:"Is between",description:"Match when field value is between given option values.",get:Y=>(Q,J)=>{const q=J.values[Q];return isNaN(q)?!1:q>Y.from&&q<Y.to},getOptionsDisplayText:Y=>`Matches all rows where field value is between ${Y.from} and ${Y.to}.`,isApplicable:Y=>Y.type===n.PU.number,getDefaultOptions:()=>({from:0,to:100})},N=()=>[W],w={id:r.Js.regex,name:"Regex",description:"Match when field value is matching regex.",get:Y=>{const Q=new RegExp(Y.value);return(J,q)=>{const X=q.values[J];return Q.test(X)}},getOptionsDisplayText:Y=>`Matches all rows where field value is matching regex: ${Y.value}`,isApplicable:()=>!0,getDefaultOptions:()=>({value:".*"})},j=()=>[w],V={id:r.Js.substring,name:"Contains substring",description:"Match where value for given field is a substring to options value.",get:Y=>(Q,J)=>{const q=J.values[Q];return q&&Y.value&&typeof q=="string"&&q.toLowerCase().includes(Y.value.toLowerCase())||Y.value===""},getOptionsDisplayText:()=>"Matches all rows where field is similar to the value.",isApplicable:Y=>Y.type===n.PU.string,getDefaultOptions:()=>({value:""})},U={id:r.Js.notSubstring,name:"Does not contain substring",description:"Match where value for given field is not a substring to options value.",get:Y=>(Q,J)=>{const q=J.values[Q];return typeof q=="string"&&Y.value&&q&&Y.value!==""&&!q.toLowerCase().includes(Y.value.toLowerCase())},getOptionsDisplayText:()=>"Matches all rows where field is not similar to the value.",isApplicable:Y=>Y.type===n.PU.string,getDefaultOptions:()=>({value:""})},F=()=>[V,U],M=new t.O(()=>[...(0,p.nz)(),...l(),...(0,g.P7)(),...b(),x]),H=new t.O(()=>[...(0,p.UM)(),...(0,g.Y7)(),...P()]),_=new t.O(()=>[...I(),...A(),...C(),...F(),...N(),...j()]);function Z(Y){const Q=M.get(Y.id);if(!Q)throw new Error("Unknown field matcher: "+Y.id);return Q.get(Y.options)}function ne(Y){const Q=H.get(Y.id);if(!Q)throw new Error("Unknown frame matcher: "+Y.id);return Q.get(Y.options)}function te(Y){const Q=_.get(Y.id);if(!Q)throw new Error("Unknown value matcher: "+Y.id);return Q.get(Y.options)}},53685:(ee,B,e)=>{"use strict";e.d(B,{c:()=>n});var t=e(739);function n(r,o,s){switch((r==null||s==null)&&(r==null&&(r="null"),s==null&&(s="null"),(o===t.zT.GTE||o===t.zT.LTE)&&(o=t.zT.EQ)),o){case t.zT.EQ:return`${r}`==`${s}`;case t.zT.NEQ:return`${r}`!=`${s}`;case t.zT.GT:return r>s;case t.zT.GTE:return r>=s;case t.zT.LT:return r<s;case t.zT.LTE:return r<=s;default:return!1}}},57866:(ee,B,e)=>{"use strict";e.d(B,{Ct:()=>n,Js:()=>o,cV:()=>t,jR:()=>r});var t=(s=>(s.anyMatch="anyMatch",s.allMatch="allMatch",s.invertMatch="invertMatch",s.alwaysMatch="alwaysMatch",s.neverMatch="neverMatch",s))(t||{}),n=(s=>(s.numeric="numeric",s.time="time",s.first="first",s.firstTimeField="firstTimeField",
1s.byType="byType",s.byTypes="byTypes",s.byName="byName",s.byNames="byNames",s.byRegexp="byRegexp",s.byRegexpOrNames="byRegexpOrNames",s.byFrameRefID="byFrameRefID",s.byValue="byValue",s))(n||{}),r=(s=>(s.byName="byName",s.byRefId="byRefId",s.byIndex="byIndex",s))(r||{}),o=(s=>(s.regex="regex",s.isNull="isNull",s.isNotNull="isNotNull",s.greater="greater",s.greaterOrEqual="greaterOrEqual",s.lower="lower",s.lowerOrEqual="lowerOrEqual",s.equal="equal",s.notEqual="notEqual",s.substring="substring",s.notSubstring="notSubstring",s.between="between",s))(o||{})},4575:(ee,B,e)=>{"use strict";e.d(B,{P7:()=>g,PP:()=>s,Y7:()=>p});var t=e(16515),n=e(8934),r=e(95004),o=e(57866),s=(c=>(c.exclude="exclude",c.include="include",c))(s||{});const m={id:o.Ct.byName,name:"Field Name",description:"match the field name",defaultOptions:"",get:c=>{const P=l(new Set([c]));return(d,D,b)=>c===d.name||c===(0,t.Ct)(d,D,b)||!!(P&&P(d,D,b))},getOptionsDisplayText:c=>`Field name: ${c}`},a={id:o.Ct.byNames,name:"Field Names",description:"match any of the given the field names",defaultOptions:{mode:"include",names:[]},get:c=>{const{names:y,mode:P="include"}=c,d=new Set(y??[]),D=l(d),b=(E,v,C)=>d.has(E.name)||d.has((0,t.Ct)(E,v,C))||!!(D&&D(E,v,C));return P==="exclude"?(E,v,C)=>!b(E,v,C):b},getOptionsDisplayText:c=>{const{names:y,mode:P}=c,d=(y??[]).join(", ");return P==="exclude"?`All except: ${d}`:`All of: ${d}`}};function l(c){let y;return window?.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback&&(c.has(r.Bc)?y=(d,D)=>!!d.labels&&d.labels?.__name__===d.name:(c.has("Time")||c.has("time"))&&(y=(d,D)=>D.meta?.typeVersion==null&&d.type===r.PU.time)),y}const f={id:o.Ct.byRegexp,name:"Field Name by Regexp",description:"match the field name by a given regexp pattern",defaultOptions:"/.*/",get:c=>{const y=i(c);return(P,d,D)=>{const b=(0,t.Ct)(P,d,D);return!!y&&y.test(b)}},getOptionsDisplayText:c=>`Field name by pattern: ${c}`},h={id:o.Ct.byFrameRefID,name:"Fields by frame refId",description:"match all fields returned in data frame with refId.",defaultOptions:"",get:c=>(y,P,d)=>P.refId===c,getOptionsDisplayText:c=>`Math all fields returned by query with reference ID: ${c}`},u={id:o.Ct.byRegexpOrNames,name:"Field Name by Regexp or Names",description:"match the field name by a given regexp pattern or given names",defaultOptions:{pattern:"/.*/",names:[]},get:c=>{const y=f.get(c?.pattern||""),P=a.get({mode:"include",names:c?.names??[]});return(d,D,b)=>P(d,D,b)||y(d,D,b)},getOptionsDisplayText:c=>{const y=c?.pattern??"",P=c?.names?.join(",")??"";return`Field name by pattern: ${y} or names: ${P}`}},i=c=>{if(c)try{return(0,n.dO)(c)}catch(y){console.error(y);return}}
1,x={id:o.jR.byName,name:"Frame Name",description:"match the frame name",defaultOptions:"/.*/",get:c=>{const y=(0,n.dO)(c);return P=>y.test(P.name||"")},getOptionsDisplayText:c=>`Frame name: ${c}`};function g(){return[m,f,a,u,h]}function p(){return[x]}},6844:(ee,B,e)=>{"use strict";e.d(B,{UM:()=>D,Yg:()=>h,nz:()=>d,zx:()=>x});var t=e(95004),n=e(36638),r=e(57866);const o={id:r.cV.anyMatch,name:"Any",description:"Any child matches (OR)",excludeFromPicker:!0,defaultOptions:[],get:b=>{const E=b.map(v=>(0,n.NS)(v));return(v,C,S)=>{for(const O of E)if(O(v,C,S))return!0;return!1}},getOptionsDisplayText:b=>{let E="";for(const v of b){E.length>0&&(E+=" OR ");const C=n.sJ.get(v.id);E+=C.getOptionsDisplayText?C.getOptionsDisplayText(v):C.name}return E}},s={id:r.cV.anyMatch,name:"Any",description:"Any child matches (OR)",excludeFromPicker:!0,defaultOptions:[],get:b=>{const E=b.map(v=>(0,n.Dq)(v));return v=>{for(const C of E)if(C(v))return!0;return!1}},getOptionsDisplayText:b=>{let E="";for(const v of b){E.length>0&&(E+=" OR ");const C=n.RE.get(v.id);E+=C.getOptionsDisplayText?C.getOptionsDisplayText(v):C.name}return E}},m={id:r.cV.allMatch,name:"All",description:"Everything matches (AND)",excludeFromPicker:!0,defaultOptions:[],get:b=>{const E=b.map(v=>(0,n.NS)(v));return(v,C,S)=>{for(const O of E)if(!O(v,C,S))return!1;return!0}},getOptionsDisplayText:b=>{let E="";for(const v of b){E.length>0&&(E+=" AND ");const C=n.sJ.get(v.id);E+=C.getOptionsDisplayText?C.getOptionsDisplayText(v):C.name}return E}},a={id:r.cV.allMatch,name:"All",description:"Everything matches (AND)",excludeFromPicker:!0,defaultOptions:[],get:b=>{const E=b.map(v=>(0,n.Dq)(v));return v=>{for(const C of E)if(!C(v))return!1;return!0}},getOptionsDisplayText:b=>{let E="";for(const v of b){E.length>0&&(E+=" AND ");const C=n.RE.get(v.id);E+=C.getOptionsDisplayText?C.getOptionsDisplayText(v):C.name}return E}},l={id:r.cV.invertMatch,name:"NOT",description:"Inverts other matchers",excludeFromPicker:!0,get:b=>{const E=(0,n.NS)(b);return(v,C,S)=>!E(v,C,S)},getOptionsDisplayText:b=>{const E=n.sJ.get(b.id);return"NOT "+(E.getOptionsDisplayText?E.getOptionsDisplayText(b.options):E.name)}},f={id:r.cV.invertMatch,name:"NOT",description:"Inverts other matchers",excludeFromPicker:!0,get:b=>{const E=(0,n.Dq)(b);return v=>!E(v)},getOptionsDisplayText:b=>{const E=n.RE.get(b.id);return"NOT "+(E.getOptionsDisplayText?E.getOptionsDisplayText(b.options):E.name)}},h=b=>!0,u=b=>!0,i=b=>!1,x=b=>b.type!==t.PU.time,g=b=>!1,p={id:r.cV.alwaysMatch,name:"All Fields",description:"Always Match",get:b=>h,getOptionsDisplayText:b=>"Always"},c={id:r.cV.alwaysMatch,name:"All Frames",description:"Always Match",get:b=>u,getOptionsDisplayText:b=>"Always"},y={id:r.cV.neverMatch,name:"No Fields",description:"Never Match",excludeFromPicker:!0,get:b=>i,getOptionsDisplayText:b=>"Never"},P={id:r.cV.neverMatch,name:"No Frames",description:"Never Match",get:b=>g,getOptionsDisplayText:b=>"Never"};function d(){return[o,m,l,p,y]}function D(){return[s,a,f,c,P]}},8642:(ee,B,e)=>{"use strict";e.d(B,{h:()=>r,m:()=>n});var t=e(42954),n=(o=>(o.Combine="combine",o.CalculateNewFields="calculateNewFields",o.CreateNewVisualization="createNewVisualization",o.Filter="filter",o.PerformSpatialOperations="performSpatialOperations",o.Reformat="reformat",o.ReorderAndRename="reorderAndRename",o))(n||{});const r=new t.O},2197:(ee,B,e)=>{"use strict";e.d(B,{m:()=>u});var t=e(2543),n=e.n(t),r=e(62467),o=e(69862),s=e(81160),m=e(36638),a=e(8642);const l=(g,p)=>c=>{const y=a.h.get(g.id);if(!y)return c;const d={...y.transformation.defaultOptions??{},...g.options},b=window.__grafanaSceneContext!=null?d:x((0,t.cloneDeep)(d),v=>typeof v=="string"?p.interpolate(v):v),E=g.filter?.options?(0,m.Dq)(g.filter):void 0;return c.pipe((0,o.Z)(v=>(0,r.of)(f(v,E)).pipe(y.transformation.operator(b,p),h(v,y,E))))};function f(g,p){return p?g.filter(c=>p(c)):g}const h=(g,p,c)=>y=>y.pipe((0,s.T)(P=>{if(P===g)return P;if(c){let d=0;const D=g.filter((b,E)=>{const v=!c(b);return v&&!d&&(d=E),v});D.length&&P.splice(d,0,...D)}return P}));function u(g,p,c){const y=(0,r.of)(p);if(!g.length)return y;const P=[],d=c??{interpolate:D=>D};for(let D=0;D<g.length;D++){const b=g[D];if(i(b))P.push(b(d));else{if(b.disabled)continue;P.push(l(b,d))}}return y.pipe.apply(y,P)}function i(g){return typeof g=="function"}function x(g,p){if(Array.isArray(g))return g.map(c=>x(c,p));if(typeof g=="object"){for(const c in g)g[c]=x(g[c],p);return g}else return p(g)??g}},96702:(ee,B,e)=>{"use strict";e.d(B,{c:()=>me});var t=e(84691),n=e(9287),r=e(406),o=e(882),s=e(49297),m=e(359),a=e(57866),l=e(64761);const f={id:l.F.filterByRefId,name:"Filter data by query refId",description:"select a subset of results",defaultOptions:{},operator:(De,Te)=>Ne=>{const Ce={};
1return De.include&&(Ce.include={id:a.jR.byRefId,options:De.include}),De.exclude&&(Ce.exclude={id:a.jR.byRefId,options:De.exclude}),Ne.pipe(s.I.operator(Ce,Te))}};var h=e(68779),u=e(40041),i=e(81160),x=e(16515),g=e(79319);const p={id:l.F.formatTime,name:"Format time",description:"Set the output format of a time field",defaultOptions:{timeField:"",outputFormat:"",useTimezone:!0},isApplicable:De=>{for(const Te of De)for(const Ne of Te.fields)if(Ne.type==="time")return g.M.Applicable;return g.M.NotApplicable},isApplicableDescription:"The Format time transformation requires a time field to work. No time field could be found.",operator:(De,Te)=>Ne=>Ne.pipe((0,i.T)(Ce=>c(De,Ce,Te)))},c=({timeField:De,outputFormat:Te,timezone:Ne},Ce,He)=>!Array.isArray(Ce)||Ce.length===0?Ce:((0,x.Fm)(Ce),Te=He?.interpolate(Te)??Te,Ce.map(ke=>({...ke,fields:ke.fields.map(Me=>(Me.state?.displayName===De&&(Me=(0,r.Xv)(Me,Te,{timeZone:Ne})),Me))})));var y=e(47433),P=e(25260),d=e(36638);const D="Time",b="Time",E="Value",v=g.N.Empty,C=window?.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback,S={id:l.F.groupingToMatrix,name:"Grouping to Matrix",description:"Groups series by field and return a matrix visualisation",defaultOptions:{columnField:D,rowField:b,valueField:E},isApplicable:De=>{let Te=0;for(const Ne of De)Te+=Ne.fields.length;return Te>=3?g.M.Applicable:g.M.NotApplicable},isApplicableDescription:De=>{let Te=0;for(const Ne of De)Te+=Ne.fields.length;return`Grouping to matrix requiers at least 3 fields to work. Currently there are ${Te} fields.`},operator:(De,Te)=>Ne=>Ne.pipe((0,i.T)(Ce=>{const He=De.columnField||D,ke=De.rowField||b,Me=De.valueField||E,$e=De.emptyValue||v;if(Ce.length!==1)return Ce;const tt=Ce[0],Ke=I(tt,He),Re=I(tt,ke),Ve=I(tt,Me),Qe=`${ke}\\${He}`;if(!Ke||!Re||!Ve)return Ce;const je=O(Ke.values),ze=O(Re.values),Ye={};for(let ce=0;ce<Ve.values.length;ce++){const Pe=Ke.values[ce],Se=Re.values[ce],Ee=Ve.values[ce];Ye[Pe]||(Ye[Pe]={}),Ye[Pe][Se]=Ee}const Ge=[{name:Qe,values:ze,type:Re.type,config:{}}];for(const ce of je){let Pe=[];for(const Se of ze){const Ee=Ye[ce][Se]??R($e);Pe.push(Ee)}C&&typeof ce=="number"&&(Ve.config={...Ve.config,displayNameFromDS:void 0}),Ge.push({name:ce?.toString()??null,values:Pe,config:Ve.config,type:Ve.type})}return[{fields:Ge,length:ze.length}]}))};function O(De){const Te=new Set(De);return Array.from(Te)}function I(De,Te){for(let Ne=0;Ne<De.fields.length;Ne++){const Ce=De.fields[Ne];let He;if(C?He=d.sJ.get(a.Ct.byName).get(Te)(Ce,De,[De]):He=Te===(0,x.Ct)(Ce),He)return Ce}return null}function R(De){switch(De){case g.N.False:return!1;case g.N.True:return!0;case g.N.Null:return null;case g.N.Zero:return 0;case g.N.Empty:default:return""}}var T=e(74261),L=e(6684),K=e(79184);const A=10,W={id:l.F.limit,name:"Limit",description:"Limit the number of items to the top N",defaultOptions:{limitField:A},operator:(De,Te)=>Ne=>Ne.pipe((0,i.T)(Ce=>{let He=A;return De.limitField!==void 0&&(typeof De.limitField=="string"?He=parseInt(De.limitField,10):He=De.limitField),Ce.map(ke=>ke.length>He?{...ke,fields:ke.fields.map(Me=>({...Me,values:He>=0?Me.values.slice(0,He):Me.values.slice(Me.values.length+He,Me.values.length)})),length:Math.abs(He)}:ke)}))};var N=e(33023),w=e(1027),j=e(95575);const V={id:l.F.rename,name:"Rename fields by name",description:"Rename fields based on configuration given by user",defaultOptions:{renameByName:{}},operator:De=>Te=>Te.pipe((0,i.T)(Ne=>{const Ce=U(De.renameByName);return!Array.isArray(Ne)||Ne.length===0?Ne:Ne.map(He=>({...He,fields:Ce(He)}))}))},U=De=>Te=>!De||Object.keys(De).length===0?Te.fields:Te.fields.map(Ne=>{const Ce=(0,x.Ct)(Ne,Te),He=De[Ce];return typeof He!="string"||He.length===0?Ne:{...Ne,config:{...Ne.config,displayName:He},state:{...Ne.state,displayName:He}}}),F={id:l.F.organize,name:"Organize fields by name",description:"Order, filter and rename fields based on configuration given by user",defaultOptions:{excludeByName:{},indexByName:{},renameByName:{},includeByName:{}},isApplicable:De=>De.length>1?g.M.NotPossible:g.M.Applicable,operator:(De,Te)=>Ne=>Ne.pipe(m.D.operator({include:De.includeByName?{names:M(De.includeByName)}:void 0,exclude:{names:M(De.excludeByName)}},Te),j.x.operator(De,Te),V.operator(De,Te))},M=De=>De?Object.keys(De).filter(Te=>De[Te]):[];var H=e(32157),_=e(8934);const Z={id:l.F.renameByRegex,name:"Rename fields by regex",description:"Rename fields based on regular expression by users.",defaultOptions:{regex:"(.*)",renamePattern:"$1"}
1,operator:De=>Te=>Te.pipe((0,i.T)(Ne=>!Array.isArray(Ne)||Ne.length===0?Ne:Ne.map(ne(De))))},ne=De=>Te=>{const Ne=(0,_.dO)(De.regex),Ce=Te.fields.map(He=>{const ke=(0,x.Ct)(He,Te);if(!Ne.test(ke))return He;const Me=ke.replace(Ne,De.renamePattern);return{...He,config:{...He.config,displayName:Me},state:{...He.state,displayName:Me}}});return{...Te,fields:Ce}};var te=e(2543),Y=e(18700),Q=e(41119),J=e(39884),q=e(95004);const X={id:l.F.seriesToRows,name:"Series to rows",description:"Combines multiple series into a single serie and appends a column with metric name per value.",defaultOptions:{},operator:De=>Te=>Te.pipe((0,i.T)(Ne=>{if(!Array.isArray(Ne)||Ne.length===0||(Ne=Ne.filter($e=>$e.length>0),!(0,J.jq)(Ne)))return Ne;const Ce={},He=new Set,ke=new Y.k({refId:`${l.F.seriesToRows}-${Ne.map($e=>$e.refId).join("-")}`,fields:[]}),Me={name:q.aI,values:[],config:{},type:q.PU.string};for(let $e=0;$e<Ne.length;$e++){const tt=Ne[$e];for(let Ke=0;Ke<tt.fields.length;Ke++){const Re=tt.fields[Ke];if(Re.type===q.PU.time){Ce[$e]=Ke,He.has(q.LE)||(ke.addField(se(Re,q.LE)),ke.addField(Me),He.add(q.LE));continue}He.has(q.Bc)||(ke.addField(se(Re,q.Bc)),He.add(q.Bc))}}for(let $e=0;$e<Ne.length;$e++){const tt=Ne[$e];for(let Ke=0;Ke<tt.length;Ke++){const Re=Ce[$e],Ve=Re===0?1:0;ke.add({[q.LE]:tt.fields[Re].values[Ke],[q.aI]:(0,x.Ri)(tt),[q.Bc]:tt.fields[Ve].values[Ke]})}}return[(0,Q.ES)(ke,0,!0)]}))},se=(De,Te)=>({...(0,te.omit)(De,["values","state","labels","config","name"]),name:Te,values:[],config:{...(0,te.omit)(De.config,["displayName","displayNameFromDS"])}}),oe={id:l.F.sortBy,name:"Sort by",description:"Sort fields in a frame.",defaultOptions:{fields:{}},operator:(De,Te)=>Ne=>Ne.pipe((0,i.T)(Ce=>!Array.isArray(Ce)||Ce.length===0||!De?.sort?.length?Ce:ae(Ce,De.sort,Te)))};function ae(De,Te,Ne){return De.map(Ce=>{const He=ie(Ce,Te,Ne);return He.length&&He[0].index!=null?(0,Q.ES)(Ce,He[0].index,He[0].desc):Ce})}function ie(De,Te,Ne){return Te.map(Ce=>Ce.index!=null?Ce:{...Ce,index:De.fields.findIndex(He=>Ce.field===(0,x.Ct)(He,De))})}const fe={id:l.F.transpose,name:"Transpose",description:"Transpose the data frame",defaultOptions:{},operator:De=>Te=>Te.pipe((0,i.T)(Ne=>Ne.length===0?Ne:pe(De,Ne)))};function pe(De,Te){return Te.map(Ne=>{const Ce=Ne.fields[0],He=De.firstFieldName?De.firstFieldName:"Field",ke=De.restFieldsName?De.restFieldsName:"Value",Me=Ce.type===q.PU.string||Ce.type===q.PU.time||Ce.type===q.PU.enum,$e=Me?[He,...le(Ce,Ce.values)]:[He,...Ce.values.map((Ve,Qe)=>ke)],tt=Me?Ne.fields.map(Ve=>Ve.name).slice(1):Ne.fields.map(Ve=>Ve.name),Ke=de(Me?Ne.fields.map(Ve=>Ve.type).slice(1):Ne.fields.map(Ve=>Ve.type)),Re=$e.map((Ve,Qe)=>{if(Qe===0)return{name:He,type:q.PU.string,config:{},values:tt};const je=Ne.fields.map(Ge=>Ke===q.PU.string?le(Ge,[Ge.values[Qe-1]])[0]:Ge.values[Qe-1]),ze=Me?Ce.name:"row",Ye=Me?Ve:Qe;return{name:Me?ke:Ve,labels:{[ze]:Ye},type:Ke,config:{},values:Me?je.slice(1):je}});return{...Ne,fields:Re,length:Math.max(...Re.map(Ve=>Ve.values.length)),refId:`${l.F.transpose}-${Ne.refId}`}})}function de(De){const Te=new Set(De);return Te.size===1?[...Te][0]:q.PU.string}function le(De,Te){switch(De.type){case q.PU.time:case q.PU.number:case q.PU.boolean:case q.PU.string:return Te.map(Ne=>`${Ne}`);case q.PU.enum:return Te.map(Ne=>De.config.type.enum.text[Ne]);default:return Te.map(Ne=>JSON.stringify(Ne))}}const me={noopTransformer:w.W,filterFieldsTransformer:s.z,filterFieldsByNameTransformer:m.D,filterFramesTransformer:s.I,filterFramesByRefIdTransformer:f,filterByValueTransformer:h.Sv,formatStringTransformer:u.yt,formatTimeTransformer:p,orderFieldsTransformer:j.x,organizeFieldsTransformer:F,reduceTransformer:H.Wj,concatenateTransformer:n.vz,calculateFieldTransformer:t.SC,joinByFieldTransformer:L.L,seriesToColumnsTransformer:L.L,seriesToRowsTransformer:X,renameFieldsTransformer:V,labelsToFieldsTransformer:K.V,ensureColumnsTransformer:o.b,groupByTransformer:y.of,sortByTransformer:oe,mergeTransformer:N.o,renameByRegexTransformer:Z,histogramTransformer:T.OA,convertFieldTypeTransformer:r.zM,groupingToMatrixTransformer:S,limitTransformer:W,groupToNestedTable:P._,transposeTransformer:fe}},84691:(ee,B,e)=>{"use strict";e.d(B,{Bp:()=>y,SC:()=>v,UY:()=>c,Uj:()=>D,ip:()=>P,pR:()=>W,sw:()=>w});var t=e(2543),n=e.n(t),r=e(81160),o=e(41119),s=e(16515),m=e(28105),a=e(95004),l=e(12823),f=e(48233),h=e(46644),u=e(36638),i=e(57866),x=e(882),g=e(64761),p=e(1027),c=(j=>(j.ReduceRow="reduceRow",j.CumulativeFunctions="cumulativeFunctions",j.WindowFunctions="windowFunctions",j.BinaryOperation="binary",j.UnaryOperation="unary",j.Index="index",j))(c||{}),y=(j=>(j.Percentage="percentage",j.Fixed="fixed",j))(y||{}),P=(j=>(j.Trailing="trailing",j.Centered="centered",j))(P||{});const d={reducer:h.gy.sum},D={reducer:h.gy.mean,windowAlignment:"trailing",windowSizeMode:"percentage",windowSize:.1},b={left:{fixed:""},operator:l.k.Add,right:{fixed:""}},E={operator:f._.Abs,fieldName:""}
1,v={id:g.F.calculateField,name:"Add field from calculation",description:"Use the row values to calculate a new field",defaultOptions:{mode:"reduceRow",reduce:{reducer:h.gy.sum}},operator:(j,V)=>U=>{const F=j.mode??"reduceRow",M=j.timeSeries!==!1,H=j.binary?.right,_=typeof H=="string"?H:typeof H=="object"?H.fixed:void 0,Z=F==="binary"&&!Number.isNaN(Number(_)),te=M&&!Z?x.b.operator(null,V):p.W.operator({},V);return U.pipe(te,(0,r.T)(Y=>{let Q;switch(F){case"reduceRow":Q=L((0,t.defaults)(j.reduce,d),Y);break;case"cumulativeFunctions":Q=T((0,t.defaults)(j.cumulative,d),Y);break;case"windowFunctions":Q=C((0,t.defaults)(j.window,D),Y);break;case"unary":Q=N((0,t.defaults)(j.unary,E),Y);break;case"binary":const q=[];Y.map(se=>{se.fields.map(oe=>{q.push(oe.name)})});const X={left:W(j.binary?.left??"",q),operator:j.binary?.operator??b.operator,right:W(j.binary?.right??"",q)};if(j.binary=X,X.left?.matcher?.id&&X.left?.matcher.id===i.Ct.byType){const se=X.left.matcher.options,oe=l.b.getIfExists(X.operator);return Y.map(ie=>{const{timeField:fe}=(0,o.KR)(ie),pe=[];let de=!1;if(fe&&j.timeSeries!==!1&&pe.push(fe),ie.fields.map((le,me)=>{if(!j.replaceFields&&!pe.includes(le)&&pe.push(le),le.type===se){const De=le.values,Te=K(ie,X.right??b.right,Y,V);if(!De||!Te||!oe)return;const Ne=new Array(De.length);for(let He=0;He<Ne.length;He++)Ne[He]=oe.operation(De[He],Te[He]);const Ce={...le,name:`${le.name} ${j.binary?.operator??""} ${j.binary?.right.matcher?.options??j.binary?.right.fixed}`,values:Ne};delete Ce.state,pe.push(Ce),de=!0}}),!(j.replaceFields&&!de))return{...ie,fields:pe}}).filter(ie=>ie!=null)}else Q=A((0,t.defaults)(X,b),Y,V);break;case"index":return Y.map(se=>{const oe=[...Array(se.length).keys()];if(j.index?.asPercentile)for(let ie=0;ie<oe.length;ie++)oe[ie]=oe[ie]/oe.length;const ae={name:j.alias??"Row",type:a.PU.number,values:oe,config:j.index?.asPercentile?{unit:"percentunit"}:{}};return{...se,fields:j.replaceFields?[ae]:[...se.fields,ae]}})}return Q?Y.map(q=>{const X=Q(q);if(!X)return j.replaceFields?void 0:q;const se={name:w(j),type:a.PU.number,config:{},values:X};let oe=[];if(j.replaceFields){const{timeField:ae}=(0,o.KR)(q);ae&&j.timeSeries!==!1?oe=[ae,se]:oe=[se]}else oe=[...q.fields,se];return{...q,fields:oe}}).filter(q=>q!=null):Y}))}};function C(j,V){if(j.windowSize<=0)throw new Error("Add field from calculation transformation - Window size must be larger than 0");let U=(0,u.NS)({id:i.Ct.numeric});return j.field&&(U=(0,u.NS)({id:i.Ct.byNames,options:{names:[j.field]}})),F=>{const M=Math.ceil(j.windowSize*(j.windowSizeMode==="percentage"?F.length:1));let H=null;for(const _ of F.fields)if(U(_,F,V)){H=_;break}if(H){if(![h.gy.mean,h.gy.stdDev,h.gy.variance].includes(j.reducer))throw new Error(`Add field from calculation transformation - Unsupported reducer: ${j.reducer}`);return j.windowAlignment==="centered"?O(F,j.reducer,H,M):S(F,j.reducer,H,M)}}}function S(j,V,U,F){const M=[];let H=0,_=0;for(let Z=0;Z<j.length;Z++)if(V===h.gy.mean){const ne=U.values[Z];if(ne!=null&&(_++,H+=ne,Z>F-1)){const te=U.values[Z-F];te!=null&&(H-=te,_--)}M.push(_===0?0:H/_)}else if(V===h.gy.variance){const ne=Math.max(0,Z-F+1),te=Z+1;M.push(I(U.values.slice(ne,te)))}else if(V===h.gy.stdDev){const ne=Math.max(0,Z-F+1),te=Z+1;M.push(R(U.values.slice(ne,te)))}return M}function O(j,V,U,F){const M=[];let H=0,_=0;const Z=Math.ceil(F/2)-1,ne=Math.floor(F/2);for(let te=0;te<j.length;te++){const Y=te-ne,Q=te+Z;if(V===h.gy.mean){if(te===0)for(let J=0;J<Z+1&&J<U.values.length;J++)U.values[J]!=null&&(H+=U.values[J],_++);else Q<U.values.length&&U.values[Q]!=null&&(H+=U.values[Q],_++),Y>0&&U.values[Y-1]!=null&&(H-=U.values[Y-1],_--);M.push(_===0?0:H/_)}else if(V===h.gy.variance){const J=U.values.slice(Math.max(0,Y),Math.min(Q+1,U.values.length));M.push(I(J))}else if(V===h.gy.stdDev){const J=U.values.slice(Math.max(0,Y),Math.min(Q+1,U.values.length));M.push(R(J))}}return M}function I(j){if(j.length<1)return 0;let V=0,U=0,F=0;for(let H=0;H<j.length;H++){const _=j[H];if(_!=null){F++;let Z=U;U+=(_-Z)/F,V+=(_-Z)*(_-U)}}return F===0?0:V/F}function R(j){return Math.sqrt(I(j))}function T(j,V){let U=(0,u.NS)({id:i.Ct.numeric});if(j.field&&(U=(0,u.NS)({id:i.Ct.byNames,options:{names:[j.field]}})),![h.gy.mean,h.gy.sum].includes(j.reducer))throw new Error(`Add field from calculation transformation - Unsupported reducer: ${j.reducer}`);return F=>{let M=null;for(const Z of F.fields)if(U(Z,F,V)){M=Z;break}if(!M)return;const H=[];let _=0;for(let Z=0;Z<F.length;Z++)_+=M.values[Z]??0,j.reducer===h.gy.sum?H.push(_):j.reducer===h.gy.mean&&H.push(_/(Z+1));return H}}function L(j,V){let U=(0,u.NS)({id:i.Ct.numeric});j.include&&j.include.length&&(U=(0,u.NS)({id:i.Ct.byNames,options:{names:j.include}}));const F=h.AS.get(j.reducer);if(!F)throw new Error(`Unknown reducer: ${j.reducer}`);
1const M=F.reduce??h.H3,H=j.nullValueMode===m.UW.Ignore,_=j.nullValueMode===m.UW.AsZero;return Z=>{const ne=[];for(const J of Z.fields)U(J,Z,V)&&ne.push(J.values);const te=ne.length,Y={name:"temp",values:new Array(te),type:a.PU.number,config:{}},Q=[];for(let J=0;J<Z.length;J++){for(let q=0;q<te;q++)Y.values[q]=ne[q][J];Q.push(M(Y,H,_)[j.reducer])}return Q}}function K(j,V,U,F){if(!V)return;if(V.matcher&&V.matcher.id===i.Ct.byName){const H=V.matcher.options??"";for(const _ of j.fields)if(H===(0,s.Ct)(_,j,U))return _.type===a.PU.boolean?_.values.map(Z=>Z?1:0):_.values}const M=parseFloat(V.fixed??V.matcher?.options??"");if(!isNaN(M))return new Array(j.length).fill(M)}function A(j,V,U){const F=l.b.getIfExists(j.operator);return M=>{const H=K(M,j.left,V,U),_=K(M,j.right,V,U);if(!H||!_||!F)return;const Z=new Array(H.length);for(let ne=0;ne<Z.length;ne++)Z[ne]=F.operation(H[ne],_[ne]);return Z}}function W(j,V){return typeof j=="string"?isNaN(Number(j))?{matcher:{id:i.Ct.byName,options:j}}:V.includes(j)?{matcher:{id:i.Ct.byName,options:j}}:{fixed:j}:j}function N(j,V){const U=f.j.getIfExists(j.operator);return F=>{let M=[];for(const _ of F.fields)j.fieldName===(0,s.Ct)(_,F,V)&&_.type===a.PU.number&&(M=_.values);if(!M.length||!U)return;const H=new Array(M.length);for(let _=0;_<H.length;_++)H[_]=U.operation(M[_]);return H}}function w(j){if(j.alias?.length)return j.alias;switch(j.mode){case"cumulativeFunctions":{const{cumulative:V}=j;return`cumulative ${V?.reducer??""}${V?.field?`(${V.field})`:""}`}
1case"windowFunctions":{const{window:V}=j;return`${V?.windowAlignment??""} moving ${V?.reducer??""}${V?.field?`(${V.field})`:""}`}case"unary":{const{unary:V}=j;return`${V?.operator??""}${V?.fieldName?`(${V.fieldName})`:""}`}case"binary":{const{binary:V}=j;return`${V?.left?.matcher?.options??V?.left?.fixed??""} ${V?.operator??""} ${V?.right?.matcher?.options??V?.right?.fixed??""}`.replace(/\$/g,"")}case"reduceRow":{const V=h.AS.getIfExists(j.reduce?.reducer);if(V)return V.name}break;case"index":return"Row"}return"math"}},9287:(ee,B,e)=>{"use strict";e.d(B,{vz:()=>s,x1:()=>o});var t=e(81160),n=e(95004),r=e(64761),o=(a=>(a.Drop="drop",a.FieldName="field",a.Label="label",a))(o||{});const s={id:r.F.concatenate,name:"Concatenate fields",description:"Combine all fields into a single frame. Values will be appended with undefined values if not the same length.",defaultOptions:{frameNameMode:"field",frameNameLabel:"frame"},operator:a=>l=>l.pipe((0,t.T)(f=>!Array.isArray(f)||f.length<2?f:[m(f,a)]))};function m(a,l){let f=!0,h=a[0].length;const u=l.frameNameLabel??"frame";let i=[];for(const x of a){h!==x.length&&(f=!1,h=Math.max(h,x.length));for(const g of x.fields){const p={...g};p.state=void 0,x.name&&(l.frameNameMode==="drop"||(l.frameNameMode==="label"?(p.labels={...g.labels},p.labels[u]=x.name):!p.name||p.name===n.Bc?p.name=x.name:p.name=`${x.name} \xB7 ${g.name}`)),i.push(p)}}return f||(i=i.map(x=>{if(x.values.length===h)return x;const g=x.values.slice();return g.length=h,{...x,values:g}})),{fields:i,length:h}}},406:(ee,B,e)=>{"use strict";e.d(B,{Xv:()=>g,ks:()=>c,s7:()=>f,zM:()=>a});var t=e(81160),n=e(44922),r=e(95004),o=e(36638),s=e(57866),m=e(64761);const a={id:m.F.convertFieldType,name:"Convert field type",description:"Convert a field to a specified field type.",defaultOptions:{fields:{},conversions:[{targetField:void 0,destinationType:void 0,dateFormat:void 0,timezone:void 0}]},operator:(P,d)=>D=>D.pipe((0,t.T)(b=>a.transformer(P,d)(b))),transformer:P=>d=>!Array.isArray(d)||d.length===0?d:l(P,d)??[]};function l(P,d){if(!P.conversions.length)return d;const D=d.map(b=>({...b}));for(const b of P.conversions){if(!b.targetField)continue;const E=o.sJ.get(s.Ct.byName).get(b.targetField);for(const v of D)v.fields=v.fields.map(C=>E(C,v,D)?f(C,b):C)}return D}function f(P,d){switch(d.destinationType){case r.PU.time:return c(P,d.dateFormat);case r.PU.number:return i(P);case r.PU.string:return g(P,d.dateFormat,{timeZone:d.timezone},d.joinWith);case r.PU.boolean:return x(P);case r.PU.enum:return y(P,d.enumConfig);case r.PU.other:return p(P);default:return P}}const h=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3,})?(?:Z|[-+]\d{2}:?\d{2})$/;function u(P,d){let D=d?{format:d}:void 0;const b=P.values.slice();let E=b.find(S=>S!=null);const v=typeof E=="number"&&d==="X",C=typeof E=="string"&&h.test(E);for(let S=0;S<b.length;S++)if(b[S]){let O=C?Date.parse(b[S]):(0,n.b)(b[S],D).valueOf();Number.isFinite(O)?b[S]=v?O*1e3:O:b[S]=null}else b[S]=null;return{...P,type:r.PU.time,values:b}}function i(P){const d=P.values.slice(),D=d.some(b=>typeof b=="string");for(let b=0;b<d.length;b++){let E=d[b];D&&E!=null&&typeof E=="string"&&(E=E.replace(/,/g,""));const v=+E;d[b]=Number.isFinite(v)?v:null}return{...P,type:r.PU.number,values:d}}function x(P){const d=P.values.slice();for(let D=0;D<d.length;D++)d[D]=!!d[D];return{...P,type:r.PU.boolean,values:d}}function g(P,d,D,b){let E=P.values;switch(P.type){case r.PU.time:E=E.map(v=>(0,n.b)(v,D).format(d));break;case r.PU.other:E=E.map(v=>b?.length&&Array.isArray(v)?v.join(b):JSON.stringify(v));break;default:E=E.map(v=>`${v}`)}return{...P,type:r.PU.string,values:E}}function p(P){const d=P.values.slice();for(let D=0;D<d.length;D++)try{d[D]=JSON.parse(d[D])}catch{d[D]=null}return{...P,type:r.PU.other,values:d}}function c(P,d){const D=typeof P.values[0]=="number",b=d==="X";return P.type===r.PU.time&&D?P:D&&!b?{...P,type:r.PU.time}:u(P,d)}function y(P,d){const D={...d},b=P.values.slice(),E=new Map;if(D.text&&D.text.length>0)for(let v=0;v<D.text.length;v++)E.set(D.text[v],v);else return P;for(let v=0;v<b.length;v++){const C=b[v];b[v]=E.get(C)}return{...P,config:{...P.config,type:{enum:D}},type:r.PU.enum,values:b}}},882:(ee,B,e)=>{"use strict";e.d(B,{b:()=>s});var t=e(81160),n=e(41119),r=e(64761),o=e(6684);const s={id:r.F.ensureColumns,name:"Ensure Columns Transformer",description:"Will check if current data frames is series or columns. If in series it will convert to columns.",operator:(a,l)=>f=>f.pipe((0,t.T)(h=>s.transformer(a,l)(h))),transformer:(a,l)=>f=>{const h=m(f);return f.length>1&&h?o.L.transformer({byField:h},l)(f):f}};function m(a){let l;for(const f of a){const{timeField:h}=(0,n.KR)(f);
1if(!h)return;if(!l)l=h.name;else if(l!==h.name)return}return l}},49297:(ee,B,e)=>{"use strict";e.d(B,{I:()=>m,z:()=>s});var t=e(81160),n=e(36638),r=e(64761),o=e(1027);const s={id:r.F.filterFields,name:"Filter Fields",description:"select a subset of fields",defaultOptions:{},operator:(a,l)=>f=>!a.include&&!a.exclude?f.pipe(o.W.operator({},l)):(typeof a.include?.options=="string"?a.include.options=a.include?.options:typeof a.include?.options?.pattern=="string"&&(a.include.options.pattern=a.include?.options.pattern),typeof a.exclude?.options=="string"?a.exclude.options=a.exclude?.options:typeof a.exclude?.options?.pattern=="string"&&(a.exclude.options.pattern=a.exclude?.options.pattern),f.pipe((0,t.T)(h=>{const u=a.include?(0,n.NS)(a.include):null,i=a.exclude?(0,n.NS)(a.exclude):null,x=[];for(const g of h){const p=[];for(let y=0;y<g.fields.length;y++){const P=g.fields[y];if(i){if(i(P,g,h))continue;u||p.push(P)}u&&u(P,g,h)&&p.push(P)}if(!p.length)continue;const c={...g,fields:p};x.push(c)}return x})))},m={id:r.F.filterFrames,name:"Filter Frames",description:"select a subset of frames",defaultOptions:{},operator:(a,l)=>f=>!a.include&&!a.exclude?f.pipe(o.W.operator({},l)):f.pipe((0,t.T)(h=>{const u=a.include?(0,n.Dq)(a.include):null,i=a.exclude?(0,n.Dq)(a.exclude):null,x=[];for(const g of h){if(i){if(i(g))continue;u||x.push(g)}u&&u(g)&&x.push(g)}return x}))}},359:(ee,B,e)=>{"use strict";e.d(B,{D:()=>o,R:()=>s});var t=e(57866),n=e(49297),r=e(64761);const o={id:r.F.filterFieldsByName,name:"Filter fields by name",description:"select a subset of fields",defaultOptions:{},operator:(m,a)=>l=>l.pipe(n.z.operator({include:s(m.include,m.byVariable),exclude:s(m.exclude,m.byVariable)},a))},s=(m,a)=>{if(!m)return;const{names:l,pattern:f,variable:h}=m;if(a&&h){const u=h;if(/^\{.*\}$/.test(u)){const i=u.slice(1).slice(0,-1).split(",");return{id:t.Ct.byNames,options:{names:i}}}return{id:t.Ct.byNames,options:{names:u.split(",")}}}if(!((!Array.isArray(l)||l.length===0)&&!f))return f?!Array.isArray(l)||l.length===0?{id:t.Ct.byRegexp,options:f}:{id:t.Ct.byRegexpOrNames,options:m}:{id:t.Ct.byNames,options:{names:l}}}},68779:(ee,B,e)=>{"use strict";e.d(B,{Sm:()=>a,Sv:()=>l,j4:()=>m});var t=e(81160),n=e(16515),r=e(36638),o=e(64761),s=e(1027),m=(u=>(u.exclude="exclude",u.include="include",u))(m||{}),a=(u=>(u.all="all",u.any="any",u))(a||{});const l={id:o.F.filterByValue,name:"Filter data by values",description:"select a subset of results based on values",defaultOptions:{filters:[],type:"include",match:"any"},operator:(u,i)=>x=>{const g=u.filters,p=u.match==="all",c=u.type==="include";return!Array.isArray(g)||g.length===0?x.pipe(s.W.operator({},i)):x.pipe((0,t.T)(y=>{if(y.length===0)return y;const P=[];for(const d of y){const D=new Set,b=h(d,y),E=f(g,b);for(let S=0;S<d.length;S++){if(D.has(S))continue;let O=!0;for(const I of E){const R=I(S,d,y);if(!p&&R){O=!0;break}if(p&&!R){O=!1;break}O=R}O&&D.add(S)}const v=[],C=c?D.size:y[0].length-D.size;for(const S of d.fields){const O=[];for(let I=0;I<d.length;I++){if(c&&D.has(I)){O.push(S.values[I]);continue}if(!c&&!D.has(I)){O.push(S.values[I]);continue}}v.push({...S,values:O,state:{}})}P.push({...d,fields:v,length:C})}return P}))}},f=(u,i)=>{const x=()=>!1;return u.map(g=>{const p=i[g.fieldName]??-1;if(p<0)return console.warn(`[FilterByValue] Could not find index for field name: ${g.fieldName}`),x;const c=(0,r.kK)(g.config);return(y,P,d)=>c(y,P.fields[p],P,d)})},h=(u,i)=>{const x={};return u.fields.forEach((g,p)=>{const c=(0,n.Ct)(g,u,i);x[c]=p}),x}},40041:(ee,B,e)=>{"use strict";e.d(B,{gs:()=>a,yt:()=>h});var t=e(81160),n=e(95004),r=e(79319),o=e(36638),s=e(57866),m=e(64761),a=(i=>(i.UpperCase="Upper Case",i.LowerCase="Lower Case",i.SentenceCase="Sentence Case",i.TitleCase="Title Case",i.PascalCase="Pascal Case",i.CamelCase="Camel Case",i.SnakeCase="Snake Case",i.KebabCase="Kebab Case",i.Trim="Trim",i.Substring="Substring",i))(a||{});const l=i=>{const x=i.split(" ");for(let g=0;g<x.length;g++)x[g]=x[g].charAt(0).toUpperCase()+x[g].slice(1).toLowerCase();return x},f=i=>x=>x.values.map(g=>{switch(i.outputFormat){case"Upper Case":return g.toUpperCase();
1case"Lower Case":return g.toLowerCase();case"Sentence Case":return g.charAt(0).toUpperCase()+g.slice(1);case"Title Case":return l(g).join(" ");case"Pascal Case":return l(g).join("");case"Camel Case":return g=l(g).join(""),g.charAt(0).toLowerCase()+g.slice(1);case"Snake Case":return g.toLowerCase().split(" ").join("_");case"Kebab Case":return g.toLowerCase().split(" ").join("-");case"Trim":return g.trim();case"Substring":return g.substring(i.substringStart,i.substringEnd)}}),h={id:m.F.formatString,name:"Format string",description:"Manipulate string fields formatting",defaultOptions:{stringField:"",outputFormat:"Upper Case"},isApplicable:i=>{for(const x of i)for(const g of x.fields)if(g.type==="string")return r.M.Applicable;return r.M.NotApplicable},operator:i=>x=>x.pipe((0,t.T)(g=>{if(g.length===0)return g;const p=o.sJ.get(s.Ct.byName).get(i.stringField),c=f(i),y=u(p,c);return g.map(P=>({...P,fields:y(P,g)}))}))},u=(i,x)=>(g,p)=>g.fields.map(c=>{if(i(c,g,p)){const y=x(c);return{...c,type:n.PU.string,values:y}}return c})},47433:(ee,B,e)=>{"use strict";e.d(B,{Ce:()=>x,R3:()=>l,Y2:()=>i,of:()=>f});var t=e(81160),n=e(16515),r=e(79319),o=e(46644),s=e(64761),m=e(91146);const a=2;var l=(g=>(g.aggregate="aggregate",g.groupBy="groupby",g))(l||{});const f={id:s.F.groupBy,name:"Group by",description:"Group the data by a field values then process calculations for each group.",defaultOptions:{fields:{}},isApplicable:g=>(0,m.f)(g)>=a?r.M.Applicable:r.M.NotApplicable,isApplicableDescription:g=>{const p=(0,m.f)(g);return`The Group by transformation requires a series with at least ${a} fields to work. The maximum number of fields found on a series is ${p}`},operator:g=>p=>p.pipe((0,t.T)(c=>{if(!Object.keys(g.fields).find(d=>g.fields[d].operation==="groupby"))return c;const P=[];for(const d of c){const D=d.fields.filter(v=>h(v,g));if(D.length===0)continue;const b=i(d,D),E=x(D,b);for(const v of d.fields){if(!u(v,g))continue;const C=(0,n.Ct)(v),S=g.fields[C].aggregations,O={};b.forEach(I=>{const R=I[C],T=(0,o.Nw)({field:R,reducers:S});for(const L of S)Array.isArray(O[L])||(O[L]=[]),O[L].push(T[L])});for(const I of S){const R={name:`${C} (${I})`,values:O[I]??[],type:(0,o.AH)(I,v.type),config:{}};E.push(R)}}P.push({...d,fields:E,length:b.size})}return P}))},h=(g,p)=>{const c=(0,n.Ct)(g);return p?.fields[c]?.operation==="groupby"},u=(g,p)=>{const c=(0,n.Ct)(g);return p?.fields[c]?.operation==="aggregate"&&Array.isArray(p?.fields[c].aggregations)&&p?.fields[c].aggregations.length>0};function i(g,p){const c=new Map;for(let y=0;y<g.length;y++){const P=String(p.map(D=>D.values[y])),d=c.get(P)??{};c.has(P)||c.set(P,d);for(let D of g.fields){const b=(0,n.Ct)(D);d[b]||(d[b]={name:b,type:D.type,config:{...D.config},values:[]}),d[b].values.push(D.values[y])}}return c}function x(g,p){const c=[];for(const y of g){const P=[],d=(0,n.Ct)(y);p.forEach(D=>{P.push(D[d].values[0])}),c.push({name:y.name,type:y.type,config:{...y.config},values:P})}return c}},25260:(ee,B,e)=>{"use strict";e.d(B,{_:()=>x,l:()=>h});var t=e(81160),n=e(41119),r=e(16515),o=e(95004),s=e(79319),m=e(46644),a=e(47433),l=e(64761),f=e(91146);const h=!0,u=2;var i=(d=>(d.aggregate="aggregate",d.groupBy="groupby",d))(i||{});const x={id:l.F.groupToNestedTable,name:"Group to nested tables",description:"Group data by a field value and create nested tables with the grouped data",defaultOptions:{showSubframeHeaders:h,fields:{}},isApplicable:d=>(0,f.f)(d)>=u?s.M.Applicable:s.M.NotApplicable,isApplicableDescription:d=>{const D=(0,f.f)(d);return`The Group to nested table transformation requires a series with at least ${u} fields to work. The maximum number of fields found on a series is ${D}`},operator:d=>D=>D.pipe((0,t.T)(b=>{if(!Object.keys(d.fields).find(C=>d.fields[C].operation==="groupby"))return b;const v=[];for(const C of b){const S=C.fields.filter(T=>p(T,d));if(S.length===0)continue;const O=(0,a.Y2)(C,S),I=(0,a.Ce)(S,O),R=P(O,d);for(let T=0;T<C.fields.length;T++){const L=C.fields[T];if(!c(L,d))continue;const K=(0,r.Ct)(L),A=d.fields[K].aggregations,W={};O.forEach(N=>{const w=N[K],j=(0,m.Nw)({field:w,reducers:A});for(const V of A)Array.isArray(W[V])||(W[V]=[]),W[V].push(j[V])});for(const N of A){const w={name:`${K} (${N})`,values:W[N],type:o.PU.other,config:{}};w.type=y(N,L,w),I.push(w)}}I.push({config:{},name:"Nested frames",type:o.PU.nestedFrames,values:R}
1),v.push({fields:I,length:O.size})}return v}))};function g(d,D,b){return{meta:{custom:{noHeader:!(b.showSubframeHeaders===void 0?h:b.showSubframeHeaders)}},length:D,fields:d}}const p=(d,D)=>{const b=(0,r.Ct)(d);return D?.fields[b]?.operation==="groupby"},c=(d,D)=>{const b=(0,r.Ct)(d);return D?.fields[b]?.operation==="aggregate"&&Array.isArray(D?.fields[b].aggregations)&&D?.fields[b].aggregations.length>0},y=(d,D,b)=>{switch(d){case m.gy.allIsNull:return o.PU.boolean;case m.gy.last:case m.gy.lastNotNull:case m.gy.first:case m.gy.firstNotNull:return D.type;default:return(0,n.dF)(b)??o.PU.string}};function P(d,D){const b=[];for(const[,E]of d){const v=[];for(const[C,S]of Object.entries(E)){const O=D.fields[C];(O===void 0||O.aggregations===void 0||O.operation==="aggregate"&&O.aggregations.length===0||O.operation===null||O.operation===void 0)&&v.push(S)}v.length>0?b.push([g(v,v[0].values.length,D)]):b.push([g([],0,D)])}return b}},74261:(ee,B,e)=>{"use strict";e.d(B,{EO:()=>I,H1:()=>d,NX:()=>y,OA:()=>p,Rt:()=>g,Uh:()=>v,ZU:()=>E,cg:()=>O,d$:()=>c,dA:()=>P,ix:()=>D,p3:()=>b,rW:()=>h,rs:()=>C});var t=e(81160),n=e(8721),r=e(11576),o=e(69884),s=e(95004),m=e(39443),a=e(79243),l=e(64761),f=e(34455);const h=[1e-9,2e-9,25e-10,4e-9,5e-9,1e-8,2e-8,25e-9,4e-8,5e-8,1e-7,2e-7,25e-8,4e-7,5e-7,1e-6,2e-6,25e-7,4e-6,5e-6,1e-5,2e-5,25e-6,4e-5,5e-5,1e-4,2e-4,25e-5,4e-4,5e-4,.001,.002,.0025,.004,.005,.01,.02,.025,.04,.05,.1,.2,.25,.4,.5,1,2,4,5,10,20,25,40,50,100,200,250,400,500,1e3,2e3,2500,4e3,5e3,1e4,2e4,25e3,4e4,5e4,1e5,2e5,25e4,4e5,5e5,1e6,2e6,25e5,4e6,5e6,1e7,2e7,25e6,4e7,5e7,1e8,2e8,25e7,4e8,5e8,1e9,2e9,25e8,4e9,5e9],u=30,i=[],x=(R,T)=>R-T,g={bucketCount:{name:"Bucket count",description:"approx bucket count"},bucketSize:{name:"Bucket size",description:void 0},bucketOffset:{name:"Bucket offset",description:"for non-zero-based buckets"},combine:{name:"Combine series",description:"combine all series into a single histogram"}},p={id:l.F.histogram,name:"Histogram",description:"Calculate a histogram from input data.",defaultOptions:{fields:{}},operator:(R,T)=>L=>L.pipe((0,t.T)(K=>p.transformer(R,T)(K))),transformer:(R,T)=>L=>{if(!Array.isArray(L)||L.length===0)return L;let K,A;R.bucketSize&&(typeof R.bucketSize=="string"?K=parseFloat(R.bucketSize):K=R.bucketSize,isNaN(K)&&(K=void 0)),R.bucketOffset&&(typeof R.bucketOffset=="string"?A=parseFloat(R.bucketOffset):A=R.bucketOffset,isNaN(A)&&(A=void 0));const W={bucketSize:K,bucketOffset:A,combine:R.combine},N=b(L,W);return N==null?[]:[O(N)]}},c="xMin";function y(R){return R===c||R==="BucketMin"}const P="xMax";function d(R){return R===P||R==="BucketMax"}function D(R){if(R.meta?.type===m.m.HeatmapCells){let A=R.fields.find(F=>F.name==="yMin"),W=R.fields.find(F=>F.name==="yMax"),N=R.fields.find(F=>F.name==="count"),w=[...new Set(W.values)].sort((F,M)=>F-M),j=[...new Set(A.values)].sort((F,M)=>F-M),V=new Map;w.forEach(F=>V.set(F,0));for(let F=0;F<W.values.length;F++){let M=W.values[F];V.set(M,V.get(M)+N.values[F])}return{xMin:{...A,name:"xMin",values:j},xMax:{...W,name:"xMax",values:w},counts:[{...N,values:[...V.values()]}]}}else if(R.meta?.type===m.m.HeatmapRows){let A=[],W=[],N=[],w="0";return R.fields.forEach(V=>{if(V.type===s.PU.number){let U=V.values.reduce((F,M)=>F+M,0);N.push(U),A.push(w),W.push(w=V.name)}}),N.push(0),A.push(w),W.push(w),{xMin:{...R.fields[1],name:"xMin",type:s.PU.string,values:A},xMax:{...R.fields[1],name:"xMax",type:s.PU.string,values:W},counts:[{...R.fields[1],name:"count",type:s.PU.number,values:N}]}}let T,L;const K=[];for(const A of R.fields)y(A.name)?T=A:d(A.name)?L=A:A.type===s.PU.number&&K.push(A);if(!L&&T&&T.values.length>1){let A=T.values,W=(0,a.h)(A[1]-A[0],6);L={...T,name:P,values:A.map(N=>N+W)}}if(!T&&L&&L?.values.length>1){let A=L.values,W=(0,a.h)(A[1]-A[0],6);T={...L,name:c,values:A.map(N=>N-W)}}if(T&&L&&K.length)return{xMin:T,xMax:L,counts:K}}function b(R,T,L){let K=T?.bucketSize,A=T?.bucketCount??u,W=T?.bucketOffset??0;if(R=R.map(_=>({..._,fields:_.fields.map(Z=>{if(Z.type===s.PU.number){const ne=Number(Z.config.noValue);Number.isNaN(ne)?Z={...Z,values:Z.values.filter(te=>te!=null)}:Z=(0,f.A)(Z,ne)}return Z})})),!K||K<0){let _=[];for(const J of R)for(const q of J.fields)q.type===s.PU.number&&(_=_.concat(q.values));_.sort((J,q)=>J-q);let Z=1/0;
1if(_.length===1)Z=1;else for(let J=1;J<_.length;J++){let q=_[J]-_[J-1];q!==0&&(Z=Math.min(Z,q))}let ne=_[0];const Q=(_[_.length-1]-ne)/A;for(let J=0;J<h.length;J++){let q=h[J];if(Q<q&&q>=Z){K=q;break}}}const N=_=>(0,a.h)(C(_-W,K)+W,9);let w=((""+K).match(/\.\d+$/)??["."])[0].length-1,j=[],V=[],U;for(const _ of R)for(const Z of _.fields)if(Z.type===s.PU.number){let ne=S(Z.values,N,i,x);j.push(ne);const te={...Z,config:{...Z.config,unit:Z.config.unit==="short"?"short":void 0}};te.display=(0,r.J)({field:te,theme:L??(0,o.a)()}),V.push(te),!U&&Z.config.unit&&(U=Z.config)}if(!V.length)return null;let F=(0,n.fj)(j);for(let _=1;_<F.length;_++){let Z=F[_];for(let ne=0;ne<Z.length;ne++)Z[ne]==null&&(Z[ne]=0)}const M={name:c,values:F[0],type:s.PU.number,state:void 0,config:w===0?U??{}:{...U,decimals:w}},H={...M,name:P,values:F[0].map(_=>_+K)};if(T?.combine){const _=new Array(F[0].length).fill(0);for(let Z=1;Z<F.length;Z++)for(let ne=0;ne<_.length;ne++)_[ne]+=F[Z][ne];V=[{...V[0],name:"count",values:_,type:s.PU.number,state:{...V[0].state,displayName:"Count",multipleFrames:!1,origin:{frameIndex:0,fieldIndex:2}}}]}else V.forEach((_,Z)=>{_.values=F[Z+1]});return{xMin:M,xMax:H,counts:V}}function E(R,T){return Math.round(R/T)*T}function v(R,T){return Math.ceil(R/T)*T}function C(R,T){return Math.floor(R/T)*T}
1function S(R,T,L,K){let A=new Map;for(let j=0;j<R.length;j++){let V=R[j];V!=null&&(V=T(V));let U=A.get(V);U?U.count++:A.set(V,{value:V,count:1})}L&&L.forEach(j=>A.delete(j));let W=[...A.values()];K&&W.sort((j,V)=>K(j.value,V.value));let N=Array(W.length),w=Array(W.length);for(let j=0;j<W.length;j++)N[j]=W[j].value,w[j]=W[j].count;return[N,w]}function O(R,T){if(!R.xMin.display){const L=(0,r.J)({field:R.xMin,theme:T??(0,o.a)()});R.xMin.display=L,R.xMax.display=L}return{length:R.xMin.values.length,meta:{type:m.m.Histogram},fields:[R.xMin,R.xMax,...R.counts],refId:`${l.F.histogram}`}}function I(R){if(R.length===1)return R[0];let T=(0,n.Fd)({frames:R.map(N=>({length:N.xMax.values.length,fields:[N.xMax,N.xMin,...N.counts]})),joinBy:N=>N.name==="xMax"}),L=null,K=null,A=[];return T.fields.forEach(N=>{if(N.name==="xMax")L=N;else if(N.name==="xMin")if(K==null)K=N;else for(let w=0;w<N.values.length;w++)K.values[w]??=N.values[w];else A.push({...N,values:N.values.map(w=>w??0)})}),{xMin:K,xMax:L,counts:A}}},64761:(ee,B,e)=>{"use strict";e.d(B,{F:()=>t});var t=(n=>(n.append="append",n.reduce="reduce",n.order="order",n.organize="organize",n.rename="rename",n.calculateField="calculateField",n.seriesToColumns="seriesToColumns",n.seriesToRows="seriesToRows",n.merge="merge",n.concatenate="concatenate",n.labelsToFields="labelsToFields",n.filterFields="filterFields",n.filterFieldsByName="filterFieldsByName",n.filterFrames="filterFrames",n.filterByRefId="filterByRefId",n.renameByRegex="renameByRegex",n.filterByValue="filterByValue",n.noop="noop",n.ensureColumns="ensureColumns",n.groupBy="groupBy",n.sortBy="sortBy",n.histogram="histogram",n.configFromData="configFromData",n.rowsToFields="rowsToFields",n.prepareTimeSeries="prepareTimeSeries",n.convertFieldType="convertFieldType",n.fieldLookup="fieldLookup",n.heatmap="heatmap",n.spatial="spatial",n.joinByField="joinByField",n.joinByLabels="joinByLabels",n.extractFields="extractFields",n.groupingToMatrix="groupingToMatrix",n.limit="limit",n.partitionByValues="partitionByValues",n.timeSeriesTable="timeSeriesTable",n.transpose="transpose",n.formatTime="formatTime",n.formatString="formatString",n.regression="regression",n.groupToNestedTable="groupToNestedTable",n))(t||{})},6684:(ee,B,e)=>{"use strict";e.d(B,{L:()=>a,W:()=>m});var t=e(81160),n=e(36638),r=e(57866),o=e(64761),s=e(8721),m=(l=>(l.outer="outer",l.inner="inner",l.outerTabular="outerTabular",l))(m||{});const a={id:o.F.joinByField,aliasIds:[o.F.seriesToColumns],name:"Join by field",description:"Combine rows from two or more tables, based on a related field between them. This can be used to outer join multiple time series on the _time_ field to show many time series in one table.",defaultOptions:{byField:void 0,mode:"outer"},operator:(l,f)=>h=>h.pipe((0,t.T)(u=>a.transformer(l,f)(u))),transformer:(l,f)=>{let h;return u=>{if(u.length>1){l.byField&&!h&&(h=n.sJ.get(r.Ct.byName).get(l.byField));const i=(0,s.Fd)({frames:u,joinBy:h,mode:l.mode});if(i)return i.refId=`${o.F.joinByField}-${u.map(x=>x.refId).join("-")}`,[i]}return u}}}},8721:(ee,B,e)=>{"use strict";e.d(B,{Fd:()=>f,JI:()=>g,RC:()=>i,WO:()=>x,Yj:()=>l,fj:()=>c,g2:()=>y});var t=e(41119),n=e(95004),r=e(36638),o=e(57866),s=e(6684);function m(P){const{timeField:d}=(0,t.KR)(P[0]);if(d)return r.sJ.get(o.Ct.firstTimeField).get({});let D=[];for(const b of P[0].fields)b.type===n.PU.number&&D.push(b.name);for(let b=1;b<P.length;b++){const E=[];for(const v of P[0].fields)v.type===n.PU.number&&E.push(v.name);D=D.filter(v=>!E.includes(v))}return r.sJ.get(o.Ct.byName).get(D[0])}function a(P){return P.joinBy??m(P.frames)}function l(P,d){if(d>=0){let D=P.fields[d];D.type!==n.PU.string&&!y(D.values)&&(P=(0,t.ES)(P,d))}return P}function f(P){if(!P.frames?.length)return;const d=P.nullMode??(I=>{let R=I.config.custom?.spanNulls;return R===!0?i:R===-1?x:g});if(P.frames.length===1){let I=P.frames[0],R=I;const T=a(P);let L=R.fields.findIndex(K=>T(K,R,P.frames));if(P.keepOriginIndices&&(R={...I,fields:I.fields.map((K,A)=>{const W={...K},N={frameIndex:0,fieldIndex:A};return W.state?W.state.origin=N:W.state={origin:N},W})},L>0)){const K=R.fields[L],A=R.fields.filter((W,N)=>N!==L);A.unshift(K),R.fields=A,L=0}if(L>=0&&(R=l(R,L)),P.keep){let K=R.fields.filter((A,W)=>W===L||P.keep(A,R,P.frames));I!==R?R.fields=K:R={...I,fields:K}}return R}const D=[],b=[],E=[],v=[];let C=1;const S=a(P);for(let I=0;I<P.frames.length;I++){const R=P.frames[I];if(!R||!R.fields?.length)continue;const T=[i];let L,K=[],A=[];for(let N=0;N<R.fields.length;N++){const w=R.fields[N];if(w.state=w.state||{},!L&&S(w,R,P.frames))L=w;else{if(P.keep&&!P.keep(w,R,P.frames))continue;T.push(d(w));let j=w.labels??{},V=w.name;R.name&&(w.name===n.Bc?V=R.name:j.name==null&&(j={...j,name:R.name})),K.push({...w,name:V,labels:j})}P.keepOriginIndices&&(w.state.origin={frameIndex:I,fieldIndex:N})}if(!L)continue;E.length===0&&E.push(L),D.push(T);const W=[L.values];for(const N of K)W.push(N.values),E.push(N),P.keepDisplayNames||delete N.state?.displayName,A.push(C),C++;v.push(A),b.push(W)}let O=[];return P.mode===s.W.outerTabular?O=h(b,v,E.length,D):P.mode===s.W.inner?O=u(b):O=c(b,D,P.mode),{length:O[0]?O[0].length:0,fields:E.map((I,R)=>({...I,values:O[R]}))}}function h(P,d,D,b){let E={};for(let C=0;C<P.length;C++){let S=P[C],O=S[0];for(let I=0;I<P.length;I++){if(I===C)continue;let R=P[I],T=R[0];for(let L=0;L<O.length;L++){const K=O[L],A=D-1;let W=[K].concat(new Array(A)),N=0;for(let w=1;w<S.length;w++){const j=d[C][N];W[j]=S[w][L],N++}for(let w=0;w<T.length;w++)if(O[L]===T[w]){let j=0;for(let V=1;V<R.length;V++){const U=d[I][j];
1W[U]=R[V][w],j++}break}E[JSON.stringify(W)]=W}}}let v=[];for(let C=0;C<D;C++)v.push(new Array(0));for(let C in E){const S=E[C];for(let O=0;O<S.length;O++)v[O].push(S[O])}return v}function u(P){const d=[],D=(b,E,v)=>{if(E===b.length){d.push(v);return}const C=b[E],[S,...O]=C;for(let I=0;I<S.length;I++){const R=S[I];if(E===0||v.includes(R)){const T=[...v];E===0&&T.push(R);for(let L=0;L<O.length;L++)T.push(O[L][I]);D(b,E+1,T)}}};if(D(P,0,[]),d.length===0){const b=P.reduce((E,v)=>E+(v.length-1),1);return Array.from({length:b},()=>[])}return d[0].map((b,E)=>d.map(v=>v[E]))}const i=0,x=1,g=2;function p(P,d,D){for(let b=0,E,v=-1;b<d.length;b++){let C=d[b];if(C>v){for(E=C-1;E>=0&&P[E]==null;)P[E--]=null;for(E=C+1;E<D&&P[E]==null;)P[v=E++]=null}}}function c(P,d,D=s.W.outer){let b=new Set;for(let S=0;S<P.length;S++){let I=P[S][0],R=I.length;for(let T=0;T<R;T++)b.add(I[T])}let E=[Array.from(b).sort((S,O)=>S-O)],v=E[0].length,C=new Map;for(let S=0;S<v;S++)C.set(E[0][S],S);for(let S=0;S<P.length;S++){let O=P[S],I=O[0];for(let R=1;R<O.length;R++){let T=O[R],L=Array(v).fill(void 0),K=d?d[S][R]:x,A=[];for(let W=0;W<T.length;W++){let N=T[W],w=C.get(I[W]);N===null?K!==i&&(L[w]=N,K===g&&A.push(w)):L[w]=N}p(L,A,v),E.push(L)}}return E}function y(P,d=50){const D=P.length;if(D<=1)return!0;let b=0,E=D-1;for(;b<=E&&P[b]==null;)b++;for(;E>=b&&P[E]==null;)E--;if(E<=b)return!0;const v=Math.max(1,Math.floor((E-b+1)/d));for(let C=P[b],S=b+v;S<=E;S+=v){const O=P[S];if(O!=null&&C!=null){if(O<=C)return!1;C=O}}return!0}},79184:(ee,B,e)=>{"use strict";e.d(B,{V:()=>m,n:()=>s});var t=e(81160),n=e(16515),r=e(95004),o=e(64761),s=(l=>(l.Columns="columns",l.Rows="rows",l))(s||{});const m={id:o.F.labelsToFields,name:"Labels to fields",description:"Extract time series labels to fields (columns or rows)",defaultOptions:{},operator:(l,f)=>h=>h.pipe((0,t.T)(u=>m.transformer(l,f)(u))),transformer:l=>f=>{if(l.mode==="rows")return a(f,l.keepLabels);const h=[],u=l.keepLabels?.length?new Set(l.keepLabels):void 0;for(const i of f){const x=[],g={};for(const p of i.fields){if(!p.labels){x.push(p);continue}const c={...p,config:{...p.config,displayName:void 0,displayNameFromDS:void 0},labels:void 0};x.push(c);for(const y of Object.keys(p.labels)){if(u&&!u.has(y))continue;if(l.valueLabel===y){c.name=p.labels[y];continue}(g[y]??(g[y]=new Set)).add(p.labels[y])}}for(const p in g)for(const c of g[p]){const y=new Array(i.length).fill(c);x.push({name:p,type:r.PU.string,values:y,config:{}})}h.push({...i,fields:x,length:i.length})}return h}};function a(l,f){const h=[];for(const u of l)for(const i of u.fields)if(i.labels){const x=[],g=[];if(f)for(const p of f)x.push(p),g.push(i.labels[p]);else for(const[p,c]of Object.entries(i.labels))x.push(p),g.push(c);g.length&&h.push({...u,name:(0,n.Ct)(i,u,l),fields:[{name:"label",type:r.PU.string,config:{},values:x},{name:"value",type:r.PU.string,config:{},values:g}],length:g.length})}return h}},33023:(ee,B,e)=>{"use strict";e.d(B,{o:()=>a});var t=e(2543),n=e.n(t),r=e(81160),o=e(18700),s=e(79319),m=e(64761);const a={id:m.F.merge,name:"Merge series/tables",description:"Merges multiple series/tables into a single serie/table",defaultOptions:{},isApplicable:g=>g.length>1?s.M.Applicable:s.M.NotApplicable,isApplicableDescription:g=>`The merge transformation requires at least 2 data series to work. There is currently ${g.length} data series.`,operator:g=>p=>p.pipe((0,r.T)(c=>{if(!Array.isArray(c)||c.length<=1)return c;const y=c.filter(O=>O.fields.length>0);if(y.length===0)return[c[0]];const P=new Set,d={},D=[],b=new o.k({refId:`${m.F.merge}-${y.map(O=>O.refId).join("-")}`,fields:[]});for(let O=0;O<y.length;O++){const I=y[O];for(let R=0;R<I.fields.length;R++){const T=I.fields[R];P.has(T.name)||(b.addField(l(T)),P.add(T.name)),d[T.name]=d[T.name]||{},d[T.name][O]=R,y.length-1===O&&i(d,T,y)&&D.push(T.name)}}if(D.length===0)return c;const E={},v=[],C=f(y,d,D),S=h(y,P,d);for(let O=0;O<y.length;O++){const I=y[O];for(let R=0;R<I.length;R++){const T=C(O,R),L=S(O,R);if(!Array.isArray(E[T])){E[T]=[L],v.push(x(T,E));continue}let K=!1;E[T]=E[T].map(A=>u(A,L)?(K=!0,{...A,...L}):A),K||(E[T].push(L),v.push(x(T,E)))}}for(const O of v){const I=E[O.key][O.index];I&&b.add(I)}return[b]}))},l=g=>({...(0,t.omit)(g,["values","state","labels","config"]),values:[],config:{...(0,t.omit)(g.config,"displayName")}}),f=(g,p,c)=>{const y=c.reduce((P,d)=>Object.keys(p[d]).reduce((D,b)=>(D[b]=D[b]||[],D[b].push(p[d][b]),D),P),{});return(P,d)=>y[P].reduce((D,b)=>D+g[P].fields[b].values[d],"")},h=(g,p,c)=>(y,P)=>{const d={},D=Array.from(p);for(const b of D){const E=c[b];
1if(!E)continue;const v=E[y];if(typeof v!="number")continue;const C=g[y];if(!C||!C.fields)continue;const S=C.fields[v];!S||!S.values||(d[b]=S.values[P])}return d},u=(g,p)=>{let c=!0;for(const y in p)if(!(typeof g[y]>"u")&&g[y]!==null&&g[y]!==p[y]){c=!1;break}return c},i=(g,p,c)=>Object.keys(g[p.name]).length===c.length,x=(g,p)=>({key:g,index:p[g].length-1})},1027:(ee,B,e)=>{"use strict";e.d(B,{W:()=>n});var t=e(64761);const n={id:t.F.noop,name:"noop",description:"No-operation transformer",defaultOptions:{},operator:r=>o=>o,transformer:r=>o=>o}},63409:(ee,B,e)=>{"use strict";e.d(B,{M:()=>o});var t=e(95004);const n={threshold:(m,a,l)=>m+l,midpoint:(m,a,l)=>(m+a)/2,plusone:(m,a,l)=>m+1};function r(m,a){return m.fields.find(l=>a!=null?l.name===a:l.type===t.PU.time)}function o(m){if(m.frame.length===0)return m.frame;let a=!0,{frame:l,refFieldName:f,refFieldPseudoMax:h,refFieldPseudoMin:u,insertMode:i}=m;i||(i=n.threshold);const x=r(l,f);if(x==null)return l;x.state={...x.state,nullThresholdApplied:!0};const g=l.fields.map(c=>c.config.custom?.insertNulls||x.config.interval||null),p=new Set(g);if(p.delete(null),p.size===0)return l;if(p.size===1){const c=p.values().next().value;if(!c||c<=0)return l;const y=x.values,P=l.fields.map(D=>D.values),d=s(y,P,c,u,h,i,a);return d===P?l:{...l,length:d[0].length,fields:l.fields.map((D,b)=>({...D,values:d[b]}))}}return l}function s(m,a,l,f=null,h=null,u,i){const x=m.length,g=[];if(f!=null&&f<m[0]){let P=Math.ceil((m[0]-f)/l),d=m[0]-P*l;for(;d<m[0];)g.push(u(d-l,d,l)),d+=l}g.push(m[0]);let p=m[0];for(let P=1;P<x;P++){const d=m[P];for(;d-p>l&&(g.push(u(p,d,l)),p+=l,!!i););g.push(d),p=d}if(h!=null&&h>p)for(;p+l<h;)g.push(u(p,h,l)),p+=l;const c=g.length;if(c===x)return a;const y=[];for(let P of a){let d;if(P!==m){d=Array(c);for(let D=0,b=0;D<c;D++)d[D]=m[b]===g[D]?P[b++]:null}else d=g;y.push(d)}return y}},34455:(ee,B,e)=>{"use strict";e.d(B,{A:()=>n,C:()=>t});function t(r){return{...r,fields:r.fields.map(o=>{const s=Number(o.config.noValue);return Number.isNaN(s)?o:n(o,s)})}}function n(r,o){const s=r.values.slice();for(let m=0;m<s.length;m++)s[m]===null&&(s[m]=o);return{...r,values:s}}},95575:(ee,B,e)=>{"use strict";e.d(B,{X:()=>a,x:()=>m});var t=e(2543),n=e.n(t),r=e(81160),o=e(16515),s=e(64761);const m={id:s.F.order,name:"Order fields by name",description:"Order fields based on configuration given by user",defaultOptions:{indexByName:{}},operator:h=>u=>u.pipe((0,r.T)(i=>{const x=l(h.indexByName);return!Array.isArray(i)||i.length===0?i:i.map(g=>({...g,fields:x(g.fields,i,g)}))}))},a=h=>(u,i)=>f(u,h)-f(i,h),l=h=>(u,i,x)=>{if(!Array.isArray(u)||u.length===0||!h||Object.keys(h).length===0)return u;const g=a(h);return(0,t.clone)(u).sort((p,c)=>g((0,o.Ct)(p,x,i),(0,o.Ct)(c,x,i)))},f=(h,u)=>Number.isInteger(u[h])?u[h]:Number.MAX_SAFE_INTEGER},32157:(ee,B,e)=>{"use strict";e.d(B,{Wj:()=>h,rV:()=>f});var t=e(81160),n=e(41119),r=e(16515),o=e(95004),s=e(46644),m=e(36638),a=e(6844),l=e(64761),f=(c=>(c.SeriesToRows="seriesToRows",c.ReduceFields="reduceFields",c))(f||{});const h={id:l.F.reduce,name:"Reduce",description:"Reduce all rows or data points to a single value using a function like max, min, mean or last.",defaultOptions:{reducers:[s.gy.max]},operator:c=>y=>y.pipe((0,t.T)(P=>{if(!c?.reducers?.length)return P;const d=c.fields?(0,m.NS)(c.fields):c.includeTimeField&&c.mode==="reduceFields"?a.Yg:a.zx;if(c.mode==="reduceFields")return g(P,d,c.reducers);const D=u(P,d,c.reducers,c.labelsToFields);return D?[{...D,refId:`${l.F.reduce}-${P.map(b=>b.refId).join("-")}`}]:[]}))};function u(c,y,P,d){const D=s.AS.list(P),b=D.map(C=>C.id),E=[],v=d?i(c):[];for(const C of c){const S=C.fields.filter(K=>y(K,C,c)),O=S.length,I=[],R=new Array(O);I.push({name:"Field",type:o.PU.string,values:R,config:{}});const T={};if(d)for(const K of v)T[K]=new Array(O),I.push({name:K,type:o.PU.string,values:T[K],config:{}});const L={};for(const K of D)L[K.id]=new Array(O),I.push({name:K.name,type:o.PU.other,values:L[K.id],config:{}});for(let K=0;K<S.length;K++){const A=S[K],W=(0,s.Nw)({field:A,reducers:b});if(d){if(R[K]=A.name,A.labels)for(const N in A.labels)T[N][K]=A.labels[N]}else R[K]=(0,r.Ct)(A,C,c);for(const N of D){const w=W[N.id];w===null?L[N.id][K]=NaN:L[N.id][K]=w}}for(const K of I)if(K.type===o.PU.other){const A=(0,n.dF)(K);A&&(K.type=A)}E.push({...C,fields:I,length:O})}return x(E)}function i(c){const y=new Set;for(const P of c)for(const d of P.fields)if(d.labels)for(const D of Object.keys(d.labels))y.add(D);return[...y]}function x(c){if(!c?.length)return;const y=c[0];for(let P=1;P<c.length;P++){const d=c[P];for(let D=0;D<y.fields.length;D++){const b=y.fields[D];for(let E=0;E<d.fields.length;E++){const v=d.fields[E],C=D===0&&E===0,S=b.type===v.type&&b.name===v.name;if(C||S){const O=b.values,I=v.values;
1b.values=O.concat(I)}}}}return y.name=void 0,y.length=y.fields[0].values.length,y}function g(c,y,P){const D=s.AS.list(P).map(E=>E.id),b=[];for(const E of c){const v=[];for(const C of E.fields)if(y(C,E,c)){const S=(0,s.Nw)({field:C,reducers:D});for(const O of D){const I=S[O],R={...C,type:p(O,C),values:[I]};R.state=void 0,D.length>1&&(R.labels||(R.labels={}),R.labels.reducer=s.AS.get(O).name),v.push(R)}}v.length&&b.push({...E,fields:v,length:1})}return b}function p(c,y){switch(c){case s.gy.allValues:case s.gy.uniqueValues:return o.PU.other;case s.gy.first:case s.gy.firstNotNull:case s.gy.last:case s.gy.lastNotNull:return y.type;default:return o.PU.number}}},91146:(ee,B,e)=>{"use strict";e.d(B,{f:()=>t});function t(n){let r=0;for(const o of n)o.fields.length>r&&(r=o.fields.length);return r}},85891:(ee,B,e)=>{"use strict";e.d(B,{DO:()=>n,Ur:()=>o,ki:()=>r,mx:()=>s});var t=(m=>(m.Fetch="fetch",m))(t||{}),n=(m=>(m.POST="POST",m.PUT="PUT",m.GET="GET",m))(n||{});const r=[{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"GET",value:"GET"}],o=[{label:"application/json",value:"application/json"},{label:"text/plain",value:"text/plain"},{label:"application/xml",value:"application/xml"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"}],s={type:"fetch",title:"",fetch:{url:"",method:"POST",body:"{}",queryParams:[],headers:[["Content-Type","application/json"]]}}},76190:(ee,B,e)=>{"use strict";e.d(B,{O:()=>t});var t=(n=>(n.NoData="no_data",n.Paused="paused",n.Alerting="alerting",n.OK="ok",n.Pending="pending",n.Recovering="recovering",n.Unknown="unknown",n))(t||{})},88907:(ee,B,e)=>{"use strict";e.d(B,{V:()=>t});var t=(n=>(n.Field="field",n.Text="text",n.Skip="skip",n))(t||{})},1906:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>s,Jk:()=>r,hX:()=>o});var t=e(78830),n=e(11594),r=(m=>(m.CloudAlerting="cloud-alerting",m.UnifiedAlerting="unified-alerting",m.Dashboard="dashboard",m.Explore="explore",m.Correlations="correlations",m.Unknown="unknown",m.PanelEditor="panel-editor",m.PanelViewer="panel-viewer",m))(r||{});class o extends n.Ud{constructor(){super(...arguments),this._exposedComponentConfigs=[],this._addedComponentConfigs=[],this._addedLinkConfigs=[],this._addedFunctionConfigs=[]}init(a){}setRootPage(a){return this.root=a,this}setComponentsFromLegacyExports(a){if((0,t.M)(a),this.meta&&this.meta.includes){for(const l of this.meta.includes)if(l.type===n.ib.page&&l.component&&!a[l.component]){console.warn("App Page uses unknown component: ",l.component,this.meta);continue}}}get exposedComponentConfigs(){return this._exposedComponentConfigs}get addedComponentConfigs(){return this._addedComponentConfigs}get addedLinkConfigs(){return this._addedLinkConfigs}get addedFunctionConfigs(){return this._addedFunctionConfigs}addLink(a){return this._addedLinkConfigs.push(a),this}addComponent(a){return this._addedComponentConfigs.push(a),this}addFunction(a){return this._addedFunctionConfigs.push(a),this}exposeComponent(a){return this._exposedComponentConfigs.push(a),this}}var s=(m=>(m.alpha="alpha",m.beta="beta",m.experimental="experimental",m.privatePreview="private preview",m.preview="preview",m.new="new",m))(s||{})},41607:(ee,B,e)=>{"use strict";e.d(B,{r:()=>t});var t=(n=>(n.OpenSource="Open Source",n.Pro="Pro",n.Enterprise="Enterprise",n))(t||{})},48588:(ee,B,e)=>{"use strict";e.d(B,{En:()=>r,d1:()=>n,tw:()=>t});const t=0,n=100,r="SAML"},84229:(ee,B,e)=>{"use strict";e.d(B,{y:()=>t});var t=(n=>(n[n.Off=0]="Off",n[n.Crosshair=1]="Crosshair",n[n.Tooltip=2]="Tooltip",n))(t||{})},28105:(ee,B,e)=>{"use strict";e.d(B,{Gu:()=>t,Gv:()=>m,Nx:()=>n,UW:()=>r,zz:()=>o});var t=(a=>(a.NotStarted="NotStarted",a.Loading="Loading",a.Streaming="Streaming",a.Done="Done",a.Error="Error",a))(t||{});const n=["graph","table","logs","trace","nodeGraph","flamegraph","rawPrometheus"];var r=(a=>(a.Null="null",a.Ignore="connected",a.AsZero="null as zero",a))(r||{});const o=a=>!!a;function s(a){return a}function m(a){return typeof a=="object"&&a!==null?!0:!1}},39443:(ee,B,e)=>{"use strict";e.d(B,{m:()=>t});var t=(n=>(n.TimeSeriesWide="timeseries-wide",n.TimeSeriesLong="timeseries-long",n.TimeSeriesMany="timeseries-many",n.TimeSeriesMulti="timeseries-multi",n.NumericWide="numeric-wide",n.NumericMulti="numeric-multi",n.NumericLong="numeric-long",n.LogLines="log-lines",n.DirectoryListing="directory-listing",n.HeatmapRows="heatmap-rows",n.HeatmapCells="heatmap-cells",n.Histogram="histogram",n))(t||{})},79609:(ee,B,e)=>{"use strict";e.d(B,{$0:()=>r,CC:()=>n,uP:()=>o,x0:()=>t,yd:()=>s});var t=(m=>(m.Datasource="Datasource",m.Correlations="Correlations",m.ExploreCorrelationsEditor="CorrelationsEditor",m))(t||{}),n=(m=>(m.Regex="regex",m.Logfmt="logfmt",m))(n||{}),r=(m=>(m.Series="series",m.Field="field",m.Fields="fields",m.Value="value",m.BuiltIn="built-in",m.Template="template",m))(r||{}),o=(m=>(m.Values="values",m))(o||{}),s=(m=>(m.Action="action",m.Link="link",m.Off="off",m))(s||{})},94644:(ee,B,e)=>{"use strict";e.d(B,{Is:()=>f,ZF:()=>a,mA:()=>m,tD:()=>s,v2:()=>l});var t=e(37615),n=e(35814),r=e(78830),o=e(11594);class s extends o.Ud{constructor(u){super(),this.DataSourceClass=u,this.components={}}setConfigEditor(u){return this.components.ConfigEditor=u,this}setConfigCtrl(u){return(0,t.l)("DataSourcePlugin","setConfigCtrl"),this.angularConfigCtrl=u,this}setQueryCtrl(u){return(0,t.l)("DataSourcePlugin","setQueryCtrl"),this.components.QueryCtrl=u,this}setAnnotationQueryCtrl(u){return this.components.AnnotationsQueryCtrl=u,this}setQueryEditor(u){return this.components.QueryEditor=u,this}
1setExploreQueryField(u){return this.components.ExploreQueryField=u,this}setExploreMetricsQueryField(u){return this.components.ExploreMetricsQueryField=u,this}setExploreLogsQueryField(u){return this.components.ExploreLogsQueryField=u,this}setQueryEditorHelp(u){return this.components.QueryEditorHelp=u,this}setExploreStartPage(u){return this.setQueryEditorHelp(u)}setVariableQueryEditor(u){return this.components.VariableQueryEditor=u,this}setMetadataInspector(u){return this.components.MetadataInspector=u,this}setComponentsFromLegacyExports(u){(0,r.M)(u),this.components.QueryCtrl=u.QueryCtrl,this.components.AnnotationsQueryCtrl=u.AnnotationsQueryCtrl,this.components.ExploreQueryField=u.ExploreQueryField,this.components.QueryEditor=u.QueryEditor,this.components.QueryEditorHelp=u.QueryEditorHelp,this.components.VariableQueryEditor=u.VariableQueryEditor}}class m{constructor(u){this.name=u.name,this.id=u.id,this.type=u.type,this.meta=u.meta,this.cachingConfig=u.cachingConfig,this.uid=u.uid,this.apiVersion=u.apiVersion}filterQuery(u){return!0}getRef(){const u={type:this.type,uid:this.uid};return this.apiVersion&&(u.apiVersion=this.apiVersion),u}}var a=(h=>(h.Logs="Logs",h.Metrics="Metrics",h.Tracing="Tracing",h))(a||{}),l=(h=>(h.Cancelled="cancelled",h.Timeout="timeout",h.Unknown="unknown",h))(l||{});class f{}f=(0,n.Y)(f),m=(0,n.Y)(m)},83340:(ee,B,e)=>{"use strict";e.d(B,{Ow:()=>n,ZW:()=>t,uo:()=>r});function t(o){return s=>"__systemRef"in s&&s.__systemRef===o}const n=o=>"__systemRef"in o&&typeof o.__systemRef=="string";var r=(o=>(o.Unit="unit",o.Min="min",o.Max="max",o.FieldMinMax="fieldMinMax",o.Decimals="decimals",o.DisplayName="displayName",o.NoValue="noValue",o.Thresholds="thresholds",o.Mappings="mappings",o.Links="links",o.Actions="actions",o.Color="color",o.Filterable="filterable",o))(r||{})},78479:(ee,B,e)=>{"use strict";e.d(B,{R:()=>t});var t=(n=>(n.Grid="grid",n.List="list",n))(t||{})},32899:(ee,B,e)=>{"use strict";e.d(B,{Tq:()=>m,ee:()=>o,kb:()=>s,r1:()=>r});var t=e(36819),n=e(68388);const r={alertSuccess:(0,t.R)("alert-success"),alertWarning:(0,t.R)("alert-warning"),alertError:(0,t.R)("alert-error"),alertInfo:(0,t.R)("alert-info")},o={refresh:(0,t.R)("refresh"),componentDidMount:(0,t.R)("component-did-mount"),dataReceived:(0,t.R)("data-received"),dataError:(0,t.R)("data-error"),dataFramesReceived:(0,t.R)("data-frames-received"),dataSnapshotLoad:(0,t.R)("data-snapshot-load"),editModeInitialized:(0,t.R)("init-edit-mode"),initPanelActions:(0,t.R)("init-panel-actions"),initialized:(0,t.R)("panel-initialized"),panelTeardown:(0,t.R)("panel-teardown"),render:(0,t.R)("render")};class s extends n.x{static{this.type="graph-hover"}}class m extends n.a{constructor(){super(...arguments),this.payload={point:{}}}static{this.type="graph-hover-clear"}}},38619:(ee,B,e)=>{"use strict";e.d(B,{Cz:()=>m,DG:()=>f,Qp:()=>u,Z7:()=>l,ZF:()=>r,aj:()=>h,ew:()=>s,jQ:()=>a,o4:()=>o,os:()=>n,qD:()=>t});var t=(i=>(i.DataSource="ds",i.Plugin="plugin",i.Grafana="grafana",i.Stream="stream",i.Watch="watch",i))(t||{}),n=(i=>(i.DataStream="stream",i.DataFrame="frame",i.JSON="json",i))(n||{}),r=(i=>(i.Pending="pending",i.Connected="connected",i.Connecting="connecting",i.Disconnected="disconnected",i.Shutdown="shutdown",i.Invalid="invalid",i))(r||{}),o=(i=>(i.Status="status",i.Join="join",i.Leave="leave",i.Message="message",i))(o||{});function s(i){return i.type==="status"}function m(i){return i.type==="join"}function a(i){return i.type==="leave"}function l(i){return i.type==="message"}function f(i){if(i?.length){let x=i.trim().split("/");if(x.length>=3)return{scope:x[0],namespace:x[1],path:x.slice(2).join("/")}}}function h(i){return!!(i?.path&&i.namespace&&i.scope)}function u(i){if(!i.scope)return"";let x=i.scope;return!i.namespace||(x+="/"+i.namespace,!i.path)?x:x+"/"+i.path}},67770:(ee,B,e)=>{"use strict";e.d(B,{$b:()=>n,Aj:()=>f,Df:()=>g,FP:()=>i,Nc:()=>h,Ol:()=>a,ZF:()=>m,_0:()=>x,_C:()=>s,cF:()=>l,s5:()=>r,tG:()=>o,wj:()=>u});var t=e(68388),n=(p=>(p.emerg="critical",p.fatal="critical",p.alert="critical",p.crit="critical",p.critical="critical",p.warn="warning",p.warning="warning",p.err="error",p.eror="error",p.error="error",p.info="info",p.information="info",p.informational="info",p.notice="info",p.dbug="debug",p.debug="debug",p.trace="trace",p.unknown="unknown",p))(n||{});const r={0:"critical",1:"critical",2:"critical",3:"error",4:"warning",5:"info",6:"info",7:"debug"};var o=(p=>(p[p.Number=0]="Number",p[p.String=1]="String",p[p.LabelsMap=2]="LabelsMap",p[p.Error=3]="Error",p))(o||{}),s=(p=>(p.none="No de-duplication",p.exact="De-duplication of successive lines that are identical, ignoring ISO datetimes.",p.numbers="De-duplication of successive lines that are identical when ignoring numbers, e.g., IP addresses, latencies.",p.signature="De-duplication of successive lines that have identical punctuation and whitespace.",p))(s||{}),m=(p=>(p.Backward="BACKWARD",p.Forward="FORWARD",p))(m||{});const a=p=>!p||typeof p!="object"?!1:"getLogRowContext"in p;var l=(p=>(p.LogsVolume="LogsVolume",p.LogsSample="LogsSample",p))(l||{}),f=(p=>(p.FullRange="FullRange",p.Limited="Limited",p))(f||{});const h=(p,c)=>p?("getDataProvider"in p||"getSupplementaryRequest"in p)&&"getSupplementaryQuery"in p&&"getSupp
1ortedSupplementaryQueryTypes"in p&&p.getSupportedSupplementaryQueryTypes().includes(c):!1,u=p=>!p||typeof p!="object"?!1:"getLogRowContextUi"in p,i=p=>p!=null&&typeof p=="object"&&"toggleQueryFilter"in p&&"queryHasFilter"in p,x=p=>p!=null&&typeof p=="object"&&"modifyQuery"in p&&"getSupportedQueryModifications"in p;class g extends t.x{static{this.type="logs-sort-order-change"}}},75683:(ee,B,e)=>{"use strict";e.d(B,{k:()=>t});var t=(n=>(n[n.Standard=0]="Standard",n[n.Canvas=1]="Canvas",n[n.Custom=2]="Custom",n))(t||{})},38919:(ee,B,e)=>{"use strict";e.d(B,{NV:()=>a,nQ:()=>s,v2:()=>m,wV:()=>o});var t=e(2543),n=e.n(t),r=e(95004),o=(l=>(l.Auto="auto",l.Vertical="vertical",l.Horizontal="horizontal",l))(o||{}),s=(l=>(l[l.Best=100]="Best",l[l.Good=70]="Good",l[l.OK=50]="OK",l))(s||{});class m{constructor(f,h){this.list=[],this.data=f,this.panel=h,this.dataSummary=this.computeDataSummary()}getListAppender(f){return new a(this.list,f)}computeDataSummary(){const f=this.data?.series||[];let h=0,u=0,i=0,x=0,g=0,p=0,c;for(const y of f){x+=y.length,y.meta?.preferredVisualisationType&&(c=y.meta.preferredVisualisationType);for(const P of y.fields)switch(p++,P.type){case r.PU.number:h+=1;break;case r.PU.time:u+=1;break;case r.PU.string:i+=1;break}y.length>g&&(g=y.length)}return{numberFieldCount:h,timeFieldCount:u,stringFieldCount:i,rowCountTotal:x,rowCountMax:g,fieldCount:p,preferredVisualisationType:c,frameCount:f.length,hasData:x>0,hasTimeField:u>0,hasNumberField:h>0,hasStringField:i>0}}getList(){return this.list}}class a{constructor(f,h){this.list=f,this.defaults=h}append(f){this.list.push((0,t.defaultsDeep)(f,this.defaults))}}},54092:(ee,B,e)=>{"use strict";e.d(B,{S:()=>n,u:()=>t});var t=(r=>(r.link="link",r.component="component",r.function="function",r))(t||{}),n=(r=>(r.AlertInstanceAction="grafana/alerting/instance/action",r.AlertingHomePage="grafana/alerting/home",r.AlertingAlertingRuleAction="grafana/alerting/alertingrule/action",r.AlertingRecordingRuleAction="grafana/alerting/recordingrule/action",r.CommandPalette="grafana/commandpalette/action",r.DashboardPanelMenu="grafana/dashboard/panel/menu",r.DataSourceConfig="grafana/datasources/config",r.ExploreToolbarAction="grafana/explore/toolbar/action",r.UserProfileTab="grafana/user/profile/tab",r.TraceViewDetails="grafana/traceview/details",r.QueryEditorRowAdaptiveTelemetryV1="grafana/query-editor-row/adaptivetelemetry/v1",r))(n||{})},29246:(ee,B,e)=>{"use strict";e.d(B,{x:()=>n});var t=e(11594);function n(r){return r&&r!==t.Ac.valid&&r!==t.Ac.internal}},46933:(ee,B,e)=>{"use strict";e.d(B,{D_:()=>t,Ee:()=>r,FL:()=>n});var t=(o=>(o.Equal="Equal",o.NotEqual="NotEqual",o.EqualRegEx="EqualRegEx",o.NotEqualRegEx="NotEqualRegEx",o))(t||{});const n=o=>!o||typeof o!="object"?!1:"importFromAbstractQueries"in o,r=o=>!o||typeof o!="object"?!1:"exportToAbstractQueries"in o},27164:(ee,B,e)=>{"use strict";e.d(B,{Dv:()=>r,RU:()=>t,n9:()=>n});function t(o){return new Set(["equals","not-equals","one-of","not-one-of"]).has(o)}const n={"=":"equals","!=":"not-equals","=~":"regex-match","!~":"regex-not-match","=|":"one-of","!=|":"not-one-of"},r=Object.fromEntries(Object.entries(n).map(([o,s])=>[s,o]))},7389:(ee,B,e)=>{"use strict";e.d(B,{CO:()=>t,ZG:()=>n,zL:()=>r});var t=(o=>(o[o.never=0]="never",o[o.onDashboardLoad=1]="onDashboardLoad",o[o.onTimeRangeChanged=2]="onTimeRangeChanged",o))(t||{}),n=(o=>(o[o.disabled=0]="disabled",o[o.alphabeticalAsc=1]="alphabeticalAsc",o[o.alphabeticalDesc=2]="alphabeticalDesc",o[o.numericalAsc=3]="numericalAsc",o[o.numericalDesc=4]="numericalDesc",o[o.alphabeticalCaseInsensitiveAsc=5]="alphabeticalCaseInsensitiveAsc",o[o.alphabeticalCaseInsensitiveDesc=6]="alphabeticalCaseInsensitiveDesc",o[o.naturalAsc=7]="naturalAsc",o[o.naturalDesc=8]="naturalDesc",o))(n||{}),r=(o=>(o[o.dontHide=0]="dontHide",o[o.hideLabel=1]="hideLabel",o[o.hideVariable=2]="hideVariable",o))(r||{})},33553:(ee,B,e)=>{"use strict";e.d(B,{O:()=>t});var t=(n=>(n.Absolute="absolute",n.Percentage="percentage",n))(t||{})},79319:(ee,B,e)=>{"use strict";e.d(B,{M:()=>t,N:()=>n});var t=(r=>
1(r[r.NotPossible=-1]="NotPossible",r[r.NotApplicable=0]="NotApplicable",r[r.Applicable=1]="Applicable",r[r.HighlyApplicable=2]="HighlyApplicable",r))(t||{}),n=(r=>(r.True="true",r.False="false",r.Null="null",r.Empty="empty",r.Zero="zero",r))(n||{})},18600:(ee,B,e)=>{"use strict";e.d(B,{W:()=>n,d:()=>t});var t=(r=>(r.ValueToText="value",r.RangeToText="range",r.RegexToText="regex",r.SpecialValue="special",r))(t||{}),n=(r=>(r.True="true",r.False="false",r.Null="null",r.NaN="nan",r.NullAndNaN="null+nan",r.Empty="empty",r))(n||{})},48592:(ee,B,e)=>{"use strict";e.d(B,{J$:()=>r,Qz:()=>t,ZV:()=>s,f5:()=>o,xi:()=>n});var t=(m=>(m.Legacy="legacy",m.Standard="standard",m.Custom="custom",m.Datasource="datasource",m))(t||{});class n{}class r extends n{getType(){return"standard"}}class o extends n{getType(){return"custom"}}class s extends n{getType(){return"datasource"}}},44326:(ee,B,e)=>{"use strict";e.d(B,{V:()=>t});function t(){Object.getOwnPropertyDescriptor(Array.prototype,"toArray")||Object.defineProperties(Array.prototype,{get:{value:function(n){return this[n]},writable:!0,enumerable:!1,configurable:!0},set:{value:function(n,r){this[n]=r},writable:!0,enumerable:!1,configurable:!0},add:{value:function(n){this.push(n)},writable:!0,enumerable:!1,configurable:!0},toArray:{value:function(){return this},writable:!0,enumerable:!1,configurable:!0}})}t()},66615:(ee,B,e)=>{"use strict";e.d(B,{b:()=>o});var t=e(74848),n=e(96540),r=e(78012);const o=s=>{const{children:m,storageKey:a,defaultValue:l}=s,[f,h]=(0,n.useState)({value:r.M.getObject(s.storageKey,s.defaultValue)});(0,n.useEffect)(()=>{const x=g=>{g.key===a&&h({value:r.M.getObject(s.storageKey,s.defaultValue)})};return window.addEventListener("storage",x),()=>{window.removeEventListener("storage",x)}});const u=x=>{try{r.M.setObject(a,x)}catch(g){console.error(g)}h({value:x})},i=()=>{try{r.M.delete(a)}catch(x){console.log(x)}h({value:l})};return(0,t.jsx)(t.Fragment,{children:m(f.value,u,i)})}},52205:(ee,B,e)=>{"use strict";e.d(B,{bk:()=>a,pv:()=>h,iF:()=>f});var t=e(2543),n=e(38809),r=e(53543),o=e(42954);class s{constructor(){this.properties=[]}addCustomEditor(i){return this.properties.push(i),this}getRegistry(){return new o.O(()=>this.properties)}getItems(){return this.properties}}var m=e(28105);class a extends s{addNumberInput(i){return this.addCustomEditor({...i,id:i.path,override:r.D.get("number").editor,editor:r.D.get("number").editor,process:n.m0,shouldApply:i.shouldApply??(()=>!0),settings:i.settings||{}})}addSliderInput(i){return this.addCustomEditor({...i,id:i.path,override:r.D.get("slider").editor,editor:r.D.get("slider").editor,process:n.m0,shouldApply:i.shouldApply??(()=>!0),settings:i.settings||{}})}addTextInput(i){return this.addCustomEditor({...i,id:i.path,override:r.D.get("text").editor,editor:r.D.get("text").editor,process:n.OU,shouldApply:i.shouldApply??(()=>!0),settings:i.settings||{}})}addSelect(i){return this.addCustomEditor({...i,id:i.path,override:r.D.get("select").editor,editor:r.D.get("select").editor,process:n.hL,shouldApply:i.shouldApply?i.shouldApply:()=>!0,settings:i.settings||{options:[]}})}addRadio(i){return this.addCustomEditor({...i,id:i.path,override:r.D.get("radio").editor,editor:r.D.get("radio").editor,process:n.hL,shouldApply:i.shouldApply?i.shouldApply:()=>!0,settings:i.settings||{options:[]}})}addBooleanSwitch(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("boolean").editor,override:r.D.get("boolean").editor,process:n.FM,shouldApply:i.shouldApply?i.shouldApply:()=>!0,settings:i.settings||{}})}addColorPicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("color").editor,override:r.D.get("color").editor,process:n.hS,shouldApply:i.shouldApply?i.shouldApply:()=>!0,settings:i.settings||{}})}addUnitPicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("unit").editor,override:r.D.get("unit").editor,process:n.lG,shouldApply:i.shouldApply?i.shouldApply:()=>!0,settings:i.settings||{}})}addFieldNamePicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("field-name").editor,override:r.D.get("field-name").editor,process:n.hS,shouldApply:i.shouldApply?i.shouldApply:()=>!0,settings:i.settings||{}})}addGenericEditor(i,x){return this.addCustomEditor({...i,id:i.path,editor:x,override:x,process:n.hS,shouldApply:i.shouldApply?i.shouldApply:()=>!0,settings:i.settings||{}})}}class l{constructor(i){this.cfg=i,this.path="",this.id="nested-panel-options",this.name="nested",this.editor=()=>null,this.getBuilder=()=>this.cfg.build,this.getNestedValueAccess=x=>{const g=this.cfg.values;return g?g(x):{getValue:p=>x.getValue(`${this.path}.${p}`),onChange:(p,c)=>x.onChange(`${this.path}.${p}`,c)}},this.path=i.path,this.category=i.category,this.defaultValue=this.getDefaultValue(i)}getDefaultValue(i){let x=(0,m.Gv)(i.defaultValue)?(0,t.cloneDeep)(i.defaultValue):{};const g=new h;i.build(g,{data:[]});for(const p of g.getItems())p.defaultValue!=null&&(0,t.set)(x,p.path,p.defaultValue);return x}}function f(u){return(0,m.Gv)(u)&&"id"in u&&u.id==="nested-panel-options"}class h extends s{addNestedOptions(i){const x=new l(i);return this.addCustomEditor(x)}addNumberInput(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("number").editor})}addSliderInput(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("slider").editor})}addTextInput(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("text").editor})}addStringArray(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("strings").editor})}addSelect(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("select").editor})}addMultiSelect(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("multi-select").editor})}addRadio(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("radio").editor})}addBooleanSwitch(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("boolean").editor})}addColorPicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("color").editor,settings:i.settings||{}})}addTimeZonePicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("timezone").editor,settings:i.settings||{}})}addUnitPicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("unit").editor})}addFieldNamePicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("field-name").editor})}addDashboardPicker(i){return this.addCustomEditor({...i,id:i.path,editor:r.D.get("dashboard-uid").editor})}}},13227:(ee,B,e)=>{"use strict";e.d(B,{t:()=>r});var t=e(2543),n=e.n(t);function r(o){return typeof o=="number"?o:o===""||o===null||o===void 0||Array.isArray(o)?NaN:typeof o=="boolean"?o?1:0:(0,t.toNumber)(o)}},46635:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{insertAfterImmutably:()=>o,insertBeforeImmutably:()=>r,moveItemImmutably:()=>n,sortValues:()=>a});var t=e(739);function n(l,f,h){const u=[...l];return Array.prototype.splice.call(u,h,0,Array.prototype.splice.call(u,f,1)[0]),u}function r(l,f,h){if(h<0||h>l.length)throw new Error("Index out of bounds");const u=[...l];return u.splice(h,0,f),u}function o(l,f,h){if(h<0||h>l.length)throw new Error("Index out of bounds");const u=[...l];return u.splice(h+1,0,f),u}const s=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),m=(l,f)=>l-f;function a(l){return(f,h)=>
1{if(f===h)return 0;if(h==null||typeof h=="string"&&h.trim()==="")return-1;if(f==null||typeof f=="string"&&f?.trim()==="")return 1;let u=s.compare;return typeof f=="number"&&typeof h=="number"&&(u=m),l===t.xB.Descending?u(h,f):u(f,h)}}},12823:(ee,B,e)=>{"use strict";e.d(B,{b:()=>r,k:()=>n});var t=e(42954),n=(o=>(o.Add="+",o.Subtract="-",o.Divide="/",o.Multiply="*",o))(n||{});const r=new t.O(()=>[{id:"+",name:"Add",operation:(o,s)=>o+s,binaryOperationID:"+"},{id:"-",name:"Subtract",operation:(o,s)=>o-s,binaryOperationID:"-"},{id:"*",name:"Multiply",operation:(o,s)=>o*s,binaryOperationID:"*"},{id:"/",name:"Divide",operation:(o,s)=>o/s,binaryOperationID:"/"}])},68125:(ee,B,e)=>{"use strict";e.d(B,{F7:()=>h,Jh:()=>u,_O:()=>P,i8:()=>x});var t=e(2543),n=e.n(t),r=e(44809),o=e.n(r),s=e(18700),m=e(41119),a=e(16515),l=e(95004),f=e(55386),h=(d=>(d[d.full=0]="full",d[d.name=1]="name",d[d.none=2]="none",d))(h||{});function u(d,D){return new x(D).readCSV(d)}var i=(d=>(d[d.Starting=0]="Starting",d[d.InHeader=1]="InHeader",d[d.ReadingRows=2]="ReadingRows",d))(i||{});class x{constructor(D){this.chunk=(b,E)=>{for(let v=0;v<b.data.length;v++){const C=b.data[v];if(C.length<1)continue;const S=C[0];if(S){if(S.startsWith("#")){const O=S.indexOf("#",2);if(O>0){const I=S.slice(1,O),R=I==="name";if(R||{unit:"#"}.hasOwnProperty(I)){this.state===2&&(this.current=new s.k({fields:[]}),this.data.push(this.current));const L=S.slice(O+1);if(R){this.current.addFieldFor(void 0,L);for(let K=1;K<C.length;K++)this.current.addFieldFor(void 0,C[K])}else{const{fields:K}=this.current;for(let A=0;A<K.length;A++){K[A].config||(K[A].config={});const W=K[A].config;W[I]=A===0?L:C[A]}}this.state=1;continue}}else if(this.state===0){this.state=1;continue}continue}if(this.state===0){if((0,m.HW)(S)===l.PU.string){for(const I of C)this.current.addFieldFor(void 0,I);this.state=1;continue}this.state=1}}if(this.state,this.state=2,C.length>this.current.fields.length){const{fields:O}=this.current;for(let I=O.length;I<C.length;I++)this.current.addFieldFor(C[I]);this.callback&&this.callback.onHeader(this.current.fields)}this.current.appendRow(C),this.callback&&this.callback.onRow(C)}},D||(D={}),this.config=D.config||{},this.callback=D.callback,this.current=new s.k({fields:[]}),this.state=0,this.data=[]}readCSV(D){this.current=new s.k({fields:[]}),this.data=[this.current];const b={...this.config,dynamicTyping:!1,skipEmptyLines:!0,comments:!1,chunk:this.chunk};return o().parse(D,b),this.data}}function g(d,D){if(d==null)return"";const b=d.toString();return b.includes('"')?D.quoteChar+b.replace(/"/gi,'""')+D.quoteChar:b.includes(` 2`)||D.delimiter&&b.includes(D.delimiter)?D.quoteChar+b+D.quoteChar:b}function p(d,D){return d.display?b=>{const E=d.display(b);return g((0,f.cN)(E),D)}:b=>g(b,D)}function c(d,D,b){const E=d==="name",v=d==="type";for(const C of D){const S=C.config;if(E||v||S&&S.hasOwnProperty(d)){let O="#"+d+"#";for(let I=0;I<D.length;I++){I>0&&(O=O+b.delimiter);let R=D[I].name;v?R=D[I].type:E||(R=D[I].config[d]),R&&(O=O+g(R,b))}return O+b.newline}}return""}function y(){const d=["x","y"];return d.toLocaleString?d.toLocaleString().charAt(1):","}function P(d,D){if(!d)return"";D=(0,t.defaults)(D,{delimiter:y(),newline:`\r 3`,quoteChar:'"',encoding:"",headerStyle:1,useExcelHeader:!1});let b=D.useExcelHeader?`sep=${D.delimiter}${D.newline}`:"";for(let E=0;E<d.length;E++){const v=d[E],{fields:C}=v;if(C.length===0)continue;if(D.headerStyle===0)b=b+c("name",C,D)+c("type",C,D)+c("unit",C,D)+c("dateFormat",C,D);else if(D.headerStyle===1){for(let O=0;O<C.length;O++)O>0&&(b+=D.delimiter),b+=`"${(0,a.Ct)(C[O],v).replace(/"/g,'""')}"`;b+=D.newline}const S=C[0].values.length;if(S>0){const O=C.map(I=>p(I,D));for(let I=0;I<S;I++){for(let R=0;R<C.length;R++){R>0&&(b=b+D.delimiter);let T=C[R].values[I];C[R].type===l.PU.frame&&C[R].values[I].value&&(T=C[R].values[I].value),T!==null&&(b=b+O[R](T))}I!==S-1&&(b=b+D.newline)}}E!==d.length-1&&(b=b+D.newline)}return b}},38036:(ee,B,e)=>{"use strict";e.d(B,{c:()=>r,u:()=>o});var t=e(92138),n=e(5556);const r={keepTime:"__url_time_range",timeRangeFrom:"__from",timeRangeTo:"__to",includeVars:"__all_variables",seriesName:"__series.name",fieldName:"__field.name",valueTime:"__value.time",valueNumeric:"__value.numeric",valueText:"__value.text",valueRaw:"__value.raw",valueCalc:"__value.calc"};function o(l){const{onClickFn:f,replaceVariables:h,link:u,scopedVars:i,range:
3x,field:g,internalLink:p}=l,c=typeof u.internal?.query=="function"?u.internal.query({replaceVariables:h,scopedVars:i}):p.query,y=m(c,i,h),P=m(u.internal?.panelsState,i,h),d=m(u.meta?.correlationData,i,h),D=u.title?u.title:p.datasourceName;return{title:h(D,i),href:s(p.datasourceUid,y,x,P),onClick:f?b=>{b.preventDefault&&b.preventDefault(),f({datasourceUid:p.datasourceUid,queries:[y],panelsState:P,correlationHelperData:d,range:x})}:void 0,target:u?.targetBlank?"_blank":"_self",origin:g}}function s(l,f,h,u){return t.I.assureBaseUrl(`/explore?left=${encodeURIComponent((0,n.Pp)({...h?.raw?{range:(0,n.sQ)(h.raw)}:{},datasource:l,queries:[f],panelsState:u}))}`)}function m(l,f,h){if(!l)return l;if(typeof l=="string")return h(l,f);const u=JSON.parse(JSON.stringify(l));return a(u,f,h)}function a(l,f,h){for(const u of Object.keys(l))typeof l[u]=="string"?l[u]=h(l[u],f):typeof l[u]=="object"&&l[u]!==null&&(l[u]=a(l[u],f,h));return l}},48480:(ee,B,e)=>{"use strict";e.d(B,{BD:()=>f,EX:()=>h,Iz:()=>s,PG:()=>a,QP:()=>c,fN:()=>o,lO:()=>g,mn:()=>l,p$:()=>r,pN:()=>x,wY:()=>u,wp:()=>p,yV:()=>i,zX:()=>m});var t=e(2543),n=e.n(t);function r(y){const P={uid:y.uid,type:y.type};return y.apiVersion&&(P.apiVersion=y.apiVersion),P}function o(y){return typeof y=="object"&&typeof y?.uid=="string"}function s(y){if(o(y))return y.uid;if((0,t.isString)(y))return y}const m=(y,P)=>d=>{x(y,P,d.currentTarget.value)},a=(y,P)=>d=>{g(y,P,d.currentTarget.value)},l=(y,P)=>d=>{p(y,P,d.currentTarget.value)},f=(y,P)=>d=>{g(y,P,d.value)},h=(y,P)=>d=>{g(y,P,d.currentTarget.checked)},u=(y,P)=>d=>{p(y,P,d.value)},i=(y,P)=>d=>{c(y,P)};function x(y,P,d){const D=y.options;y.onOptionsChange({...D,[P]:d})}const g=(y,P,d)=>{const D=y.options;y.onOptionsChange({...D,jsonData:{...D.jsonData,[P]:d}})},p=(y,P,d)=>{const D=y.options;y.onOptionsChange({...D,secureJsonData:{...D.secureJsonData?D.secureJsonData:{},[P]:d}})},c=(y,P)=>{const d=y.options;y.onOptionsChange({...d,secureJsonData:{...d.secureJsonData?d.secureJsonData:{},[P]:""},secureJsonFields:{...d.secureJsonFields,[P]:!1}})}},28882:(ee,B,e)=>{"use strict";e.d(B,{f:()=>t});var t=(n=>(n[n.Transformations=0]="Transformations",n[n.FieldConfig=1]="FieldConfig",n[n.FieldConfigOverrides=2]="FieldConfigOverrides",n))(t||{})},71642:(ee,B,e)=>{"use strict";e.d(B,{Xy:()=>n,_p:()=>s,h6:()=>m,s6:()=>o,yO:()=>r});const t=/\b(\w+)(!?=~?)"([^"\n]*?)"/g;function n(a){const l={};return a.replace(t,(f,h,u,i)=>(l[h]=i,"")),l}function r(a){return a.reduce((l,f)=>{if(!f)throw new Error("Need parsed labels to find common labels.");return Object.keys(f).forEach(h=>{(l[h]===void 0||l[h]!==f[h])&&delete l[h]}),Object.keys(l).forEach(h=>{f[h]===void 0&&delete l[h]}),l},{...a[0]})}function o(a,l){const f={...a};return Object.keys(l).forEach(h=>{delete f[h]}),f}function s(a,l){if(!a)return!0;for(const[f,h]of Object.entries(a))if(!l||l[f]!==h)return!1;return!0}function m(a,l="",f){if(!a||Object.keys(a).length===0)return l;const u=Object.keys(a).sort().map(i=>`${i}="${a[i]}"`).join(", ");return f?u:["{",u,"}"].join("")}},428:(ee,B,e)=>{"use strict";e.d(B,{j:()=>t});function t(n,r){const o=/\{\{\s*(.+?)\s*\}\}/g;return n.replace(o,(s,m)=>r[m]?r[m]:m)}},92138:(ee,B,e)=>{"use strict";e.d(B,{I:()=>u});var t=e(63704),n=e(5556);let r={appSubUrl:""},o,s;const m=i=>{try{return new URL(i)}catch{return}},a=i=>{const x=m(i);if(x&&x.origin!==window.location.origin)return i;const g=r.appSubUrl??"",p=g.endsWith("/")?1:0,c=i.startsWith("http");let y=g;return(!i.startsWith("/")||c)&&(y=`${window.location.origin}${g}`),i.length>0&&(i.indexOf(y+"/")===0||i===y)?i.slice(y.length-p):i},l=i=>i.startsWith("/")?`${r.appSubUrl}${a(i)}`:i,u={initialize:i=>{r=i.config,o=i.getTimeRangeForUrl,s=i.getVariablesUrlParams},stripBaseFromUrl:a,assureBaseUrl:l,updateSearchParams:(i,x)=>{const g=new URLSearchParams(x);try{const p=new URL(i);return g.forEach((c,y)=>p.searchParams.set(y,c)),p.href}catch{const p=new URLSearchParams(i);return g.forEach((c,y)=>{p.set(y,c)}),"?"+p.toString()}},getTimeRangeUrlParams:()=>o?n.kM.toUrlParams(o()):null,getVariablesUrlParams:i=>{if(!s)return null;const x=s(i);return n.kM.toUrlParams(x)}
3,getUrlForPartial:(i,x)=>{const g=n.kM.parseKeyValue(i.search.startsWith("?")?i.search.substring(1):i.search);for(const p in x)x[p]===null||x[p]===void 0?delete g[p]:g[p]=x[p];return l(n.kM.renderUrl(i.pathname,g))},processUrl:i=>r.disableSanitizeHtml?i:t.sQ.sanitizeUrl(i)}},35814:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>t});function t(n){return new Proxy(n,{apply(r,o,s){return(typeof Reflect>"u"||!Reflect.construct)&&alert("Browser is too old"),Reflect.construct(r,s,o.constructor)}})}},8134:(ee,B,e)=>{"use strict";e.d(B,{_:()=>t});function t(r,o){return o.id===r?!0:n(r)?n(o.id):o.aliasIDs?o.aliasIDs.includes(r):!1}function n(r){return r==="prometheus"?!0:new RegExp("^grafana-[0-9a-z]+prometheus-datasource$").test(r)}},14613:(ee,B,e)=>{"use strict";e.d(B,{u:()=>t});var t=(n=>(n.id="id",n.title="title",n.subTitle="subtitle",n.mainStat="mainstat",n.secondaryStat="secondarystat",n.arc="arc__",n.icon="icon",n.color="color",n.source="source",n.target="target",n.detail="detail__",n.nodeRadius="noderadius",n.thickness="thickness",n.highlighted="highlighted",n.strokeDasharray="strokedasharray",n.fixedX="fixedx",n.fixedY="fixedy",n.isInstrumented="isinstrumented",n))(t||{})},79243:(ee,B,e)=>{"use strict";e.d(B,{E:()=>n,h:()=>t});function t(r,o=0){if(Number.isInteger(r))return r;let s=10**o,m=r*s*(1+Number.EPSILON);return Math.round(m)/s}function n(r){return((""+r).split(".")[1]||"").length}},3594:(ee,B,e)=>{"use strict";e.d(B,{R:()=>n,w:()=>t});const t=r=>Object.keys(r).reduce((o,s)=>(r[s]!==void 0&&(o[s]=r[s]),o),{}),n=r=>typeof r=="object"&&r!==null&&Object.keys(r).length===0},78012:(ee,B,e)=>{"use strict";e.d(B,{M:()=>n,i:()=>t});class t{constructor(){this.subscribers=new Map,window.addEventListener("storage",o=>{o.key&&this.notifySubscribers(o.key)})}notifySubscribers(o){const s=this.subscribers.get(o);s&&s.forEach(m=>m())}subscribe(o,s){return this.subscribers.has(o)||this.subscribers.set(o,new Set),this.subscribers.get(o).add(s),()=>{const m=this.subscribers.get(o);m&&(m.delete(s),m.size===0&&this.subscribers.delete(o))}}get(o){return window.localStorage[o]}set(o,s){window.localStorage[o]=s,this.notifySubscribers(o)}getBool(o,s){return s!==void 0&&!this.exists(o)?s:window.localStorage[o]==="true"}getObject(o,s){let m=s;if(this.exists(o)){const a=window.localStorage[o];try{m=JSON.parse(a)}catch(l){console.error(`Error parsing store object: ${o}. Returning default: ${s}. [${l}]`)}}return m}setObject(o,s){let m;try{m=JSON.stringify(s)}catch(a){throw new Error(`Could not stringify object: ${o}. [${a}]`)}try{this.set(o,m)}catch(a){const l=new Error(`Could not save item in localStorage: ${o}. [${a}]`);throw a instanceof Error&&(l.name=a.name),l}return!0}exists(o){return window.localStorage[o]!==void 0}delete(o){window.localStorage.removeItem(o),this.notifySubscribers(o)}}const n=new t},78830:(ee,B,e)=>{"use strict";e.d(B,{M:()=>t});function t(n){const r=n?.angular?.detected??n?.angularDetected??!1,o=n?.angularPanelCtrl??!1,s=n.PanelCtrl??n?.ConfigCtrl??!1;if(r||o||s)throw new Error("Angular plugins are not supported")}},48233:(ee,B,e)=>{"use strict";e.d(B,{_:()=>n,j:()=>r});var t=e(42954),n=(o=>(o.Abs="abs",o.Exp="exp",o.Ln="ln",o.Round="round",o.Floor="floor",o.Ceil="ceil",o))(n||{});const r=new t.O(()=>[{id:"abs",name:"Absolute value",operation:o=>Math.abs(o),unaryOperationID:"abs"},{id:"exp",name:"Natural exponent",operation:o=>Math.exp(o),unaryOperationID:"exp"},{id:"ln",name:"Natural logarithm",operation:o=>Math.log(o),unaryOperationID:"ln"},{id:"round",name:"Round",operation:o=>Math.round(o),unaryOperationID:"round"},{id:"floor",name:"Floor",operation:o=>Math.floor(o),unaryOperationID:"floor"},{id:"ceil",name:"Ceiling",operation:o=>Math.ceil(o),unaryOperationID:"ceil"}])},5556:(ee,B,e)=>{"use strict";e.d(B,{Pp:()=>u,kM:()=>h,sQ:()=>i});var t=e(25229);/** 4 * @preserve jquery-param (c) 2015 KNOWLEDGECODE | MIT 5 */function n(x,g){return g&&Object.keys(g).length>0&&(x+="?"+o(g)),x}function r(x,g){return encodeURIComponent(x).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,g?"%20":"+").replace(/[!'()*]/g,function(p){return"%"+p.charCo
5deAt(0).toString(16).toUpperCase()})}function o(x,g=!0){const p=[],c=/\[\]$/,y=g?(b,E)=>r(b,E):(b,E)=>encodeURIComponent(b),P=b=>Object.prototype.toString.call(b)==="[object Array]",d=(b,E)=>{if(E=typeof E=="function"?E():E===null||E===void 0?"":E,typeof E!="boolean")p[p.length]=y(b,!0)+"="+y(E,!0);else{const v=E?"":"="+y("false",!0);p[p.length]=y(b,!0)+v}},D=(b,E)=>{let v,C,S;if(b)if(P(E))for(v=0,C=E.length;v<C;v++)c.test(b)?d(b,E[v]):D(b,E[v]);else if(E&&String(E)==="[object Object]")for(S in E)D(b+"["+S+"]",E[S]);else d(b,E);else if(P(E))for(v=0,C=E.length;v<C;v++)d(E[v].name,E[v].value);else for(S in E)D(S,E[S]);return p};return D("",x).join("&")}function s(x){return o(x,!1)}function m(x,g){if(g!=null&&g!==""){const p=x.indexOf("?");p!==-1?x.length-p>1&&(x+="&"):x+="?",x+=g}return x}function a(){const g=window.location.search.substring(1).split("&"),p={};for(const c of g){const y=c.split("=");if(y.length>1){const P=decodeURIComponent(y[0]),d=decodeURIComponent(y[1]);P in p?p[P]=[...p[P],d]:p[P]=[d]}else if(y.length===1){const P=decodeURIComponent(y[0]);p[P]=!0}}return p}function l(x){const g={},p=(x||"").split("&");for(let c of p){let y,P,d;if(c&&(P=c=c.replace(/\+/g,"%20"),y=c.indexOf("="),y!==-1&&(P=c.substring(0,y),d=c.substring(y+1)),P=f(P),P!==void 0)){d=d!==void 0?f(d):!0;let D;typeof d=="string"&&d!==""?D=d==="true"||d==="false"?d==="true":d:D=d,g.hasOwnProperty(P)?Array.isArray(g[P])?g[P].push(d):g[P]=[g[P],isNaN(D)?d:D]:g[P]=isNaN(D)?d:D}}return g}function f(x){try{return decodeURIComponent(x)}catch{return}}const h={renderUrl:n,toUrlParams:o,appendQueryToUrl:m,getUrlSearchParams:a,parseKeyValue:l,serializeParams:s};function u(x,g){return g!==void 0&&console.warn("`compact` parameter is deprecated and will be removed in a future release"),JSON.stringify(x)}const i=x=>{let g=x.from;(0,t.Ar)(g)&&(g=g.valueOf().toString());let p=x.to;return(0,t.Ar)(p)&&(p=p.valueOf().toString()),{from:g,to:p}}},35987:(ee,B,e)=>{"use strict";e.d(B,{An:()=>m,Zz:()=>o,bh:()=>a});var t=e(36394),n=e(8934),r=e(18600);function o(f,h){for(const u of f)switch(u.type){case r.d.ValueToText:if(h==null)continue;const i=u.options[h];if(i)return i;break;case r.d.RangeToText:if(h==null)continue;const x=parseFloat(h);if(isNaN(x))continue;const g=u.options.from??-1/0;if(!isNaN(g)&&x<g)continue;const c=u.options.to??1/0;if(!isNaN(c)&&x>c)continue;return u.options.result;case r.d.RegexToText:if(h==null||typeof h!="string")continue;const P=(0,n.dO)(u.options.pattern);if(h.match(P)){const d={...u.options.result};return d.text!=null&&(d.text=h.replace(P,u.options.result.text||"")),d}case r.d.SpecialValue:switch(u.options.match){case r.W.Null:{if(h==null)return u.options.result;break}case r.W.NaN:{if(typeof h=="number"&&isNaN(h))return u.options.result;break}case r.W.NullAndNaN:{if(typeof h=="number"&&isNaN(h)||h==null)return u.options.result;break}case r.W.True:{if(h===!0||h==="true")return u.options.result;break}case r.W.False:{if(h===!1||h==="false")return u.options.result;break}case r.W.Empty:{if(h==="")return u.options.result;break}}}return null}function s(f){return(typeof f=="number"||typeof f=="string"&&f.trim()!=="")&&!isNaN(f)}var m=(f=>(f[f.ValueToText=1]="ValueToText",f[f.RangeToText=2]="RangeToText",f))(m||{});function a(f,h){const u=[];let i=f.mappingType;if(f.mappingType||(f.valueMaps&&f.valueMaps.length?i=1:f.rangeMaps&&f.rangeMaps.length&&(i=2)),i===1)for(let x=0;x<f.valueMaps.length;x++){const g=f.valueMaps[x];u.push(l({...g,id:x,type:r.d.ValueToText},f.fieldConfig?.defaults?.thresholds||h))}else if(i===2)for(let x=0;x<f.rangeMaps.length;x++){const g=f.rangeMaps[x];u.push(l({...g,id:x,type:r.d.RangeToText},f.fieldConfig?.defaults?.thresholds||h))}return u}function l(f,h){const u={type:r.d.ValueToText,options:{}},i=[];let x;const g=parseFloat(f.text);if(h&&!isNaN(g)){const p=(0,t.yQ)(g,h.steps);p&&p.color&&(x=p.color)}switch(f.type){case 1:case r.d.ValueToText:f.value!=null&&(f.value==="null"?i.push({type:r.d.SpecialValue,options:{match:r.W.Null,result:{text:f.text,color:x}}}):u.options[String(f.value)]={text:f.text,color:x});break;case 2:case r.d.RangeToText:f.from==="null"||f.to==="null"?i.push({type:r.d.SpecialValue,options:{match:r.W.Null,result:{text:f.text,color:x}}}):i.push({type:r.d.RangeToText,options:{from:+f.from,to:+f.to,result:{text:f.text,color:x}}});break}return Object.keys(u.options).length>0&&i.unshift(u),i[0]}},94452:(ee,B,e)=>{"use strict";e.d(B,{E:()=>n,c:()=>r});const t="__searchFilter",n=o=>
5o&&typeof o=="string"?o.indexOf(t)!==-1:!1,r=o=>{const{query:s,wildcardChar:m}=o;if(!n(s))return{};let{options:a}=o;return a=a||{searchFilter:""},{__searchFilter:{value:a.searchFilter?`${a.searchFilter}${m}`:`${m}`,text:""}}}},47520:(ee,B,e)=>{"use strict";e.d(B,{k:()=>s});var t=e(44240),n=e(39697),r=e(65961),o=e(67791);function s({whileLoading:m,source:a}){return(0,t.h)((0,n.O)(200).pipe((0,r.u)(m),(0,o.Q)(a)),a)}},94777:(ee,B,e)=>{"use strict";e.d(B,{$:()=>n});var t=e(96453);class n extends t.F{constructor(o){return super(),this.buffer=o.buffer||[],this.capacity=this.buffer.length,this.tail=o.append!=="head",this.index=0,this.add=this.getAddFunction(),o.capacity&&this.setCapacity(o.capacity),new Proxy(this,{get(s,m,a){if(typeof m!="symbol"){const l=+m;if(String(l)===m)return s.get(l)}return Reflect.get(s,m,a)},set(s,m,a,l){if(typeof m!="symbol"){const f=+m;if(String(f)===m)return s.set(f,a),!0}return Reflect.set(s,m,a,l)}})}getAddFunction(){return this.capacity>this.buffer.length?this.tail?o=>{this.buffer.push(o),this.buffer.length>=this.capacity&&(this.add=this.getAddFunction())}:o=>{this.buffer.unshift(o),this.buffer.length>=this.capacity&&(this.add=this.getAddFunction())}:this.tail?o=>{this.buffer[this.index]=o,this.index=(this.index+1)%this.buffer.length}:o=>{let s=this.index-1;s<0&&(s=this.buffer.length-1),this.buffer[s]=o,this.index=s}}setCapacity(o){if(this.capacity===o)return;const s=this.toArray();if(o>this.length)this.buffer=s;else if(o<this.capacity){const m=this.length-o;this.tail?this.buffer=s.slice(m,s.length):this.buffer=s.slice(0,s.length-m)}this.capacity=o,this.index=0,this.add=this.getAddFunction()}setAppendMode(o){const s=o!=="head";s!==this.tail&&(this.buffer=this.toArray().reverse(),this.index=0,this.tail=s,this.add=this.getAddFunction())}reverse(){return this.buffer.reverse()}get(o){return this.buffer[(o+this.index)%this.buffer.length]}set(o,s){this.buffer[(o+this.index)%this.buffer.length]=s}get length(){return this.buffer.length}}},96453:(ee,B,e)=>{"use strict";e.d(B,{E:()=>s,F:()=>r});var t,n;class r{constructor(){this[t]={}}*iterator(){for(let a=0;a<this.length;a++)yield this.get(a)}set(a,l){throw"unsupported operation"}add(a){throw"unsupported operation"}push(...a){for(const l of a)this.add(l);return this.length}[(n=Symbol.iterator,t=Symbol.unscopables,n)](){return this.iterator()}forEach(a){return s(this).forEach(a)}map(a){return s(this).map(a)}filter(a){return s(this).filter(a)}at(a){return this.get(a)}toArray(){const a=new Array(this.length);for(let l=0;l<this.length;l++)a[l]=this.get(l);return a}join(a){return this.toArray().join(a)}toJSON(){return this.toArray()}pop(){throw new Error("Method not implemented.")}concat(...a){throw new Error("Method not implemented.")}reverse(){throw new Error("Method not implemented.")}shift(){throw new Error("Method not implemented.")}sort(a){throw new Error("Method not implemented.")}splice(a,l,...f){throw new Error("Method not implemented.")}unshift(...a){throw new Error("Method not implemented.")}fill(a,l,f){throw new Error("Method not implemented.")}copyWithin(a,l,f){throw new Error("Method not implemented.")}slice(a,l){return this.toArray().slice(a,l)}indexOf(a,l){return this.toArray().indexOf(a,l)}lastIndexOf(a,l){return this.toArray().lastIndexOf(a,l)}every(a,l){return this.toArray().every(a,l)}some(a,l){return this.toArray().some(a,l)}reduce(a,l){throw new Error("Method not implemented.")}reduceRight(a,l){throw new Error("Method not implemented.")}find(a,l){return this.toArray().find(a,l)}findIndex(a,l){return this.toArray().findIndex(a,l)}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.toArray().values()}includes(a,l){return this.toArray().includes(a,l)}flatMap(a,l){return this.toArray().flatMap(a,l)}flat(a){throw new Error("Method not implemented.")}}const o=[];function s(m){return{*[Symbol.iterator](){for(let a=0;a<m.length;a++)yield m.get(a)},forEach(a){for(let l=0;l<m.length;l++)a(m.get(l),l,o)},map(a){const l=[];for(let f=0;f<m.length;f++)l.push(a(m.get(f),f,o));return l},filter(a){const l=[];let f=0;for(const h of this)a(h,f++,o)&&l.push(h);return l}}}},76658:(ee,B,e)=>{"use strict";e.d(B,{t:()=>o});var t=e(21489),n=e(13502),r=e(64283);function o(f,h,u,i="="){if(!h||!u)throw new Error("Need label to add to query.");const x=s(f);if(!x.length)return f;const g=m(h,u,i);return a(f,x,g)}function s(f){const h=t.K3.parse(f),u=[];return h.iterate({enter:({to:i,from:x,type:g})=>
5{if(g.id===t.Fb){const p=(0,r.u)(f.substring(x,i));return u.push({query:p.query,from:x,to:i}),!1}}}),u}function m(f,h,u){const i=h===1/0?"+Inf":h.toString();return{label:f,op:u,value:i}}function a(f,h,u){const i=new n.l;let x="",g=0;for(let p=0;p<h.length;p++){const c=h[p],y=p===h.length-1,P=f.substring(g,c.from),d=y?f.substring(c.to):"";l(c.query.labels,u)||c.query.labels.push(u);const D=i.renderQuery(c.query);x+=P+D+d,g=c.to}return x}function l(f,h){return f.find(u=>u.label===h.label&&u.value===h.value)}},20410:(ee,B,e)=>{"use strict";e.d(B,{L:()=>aa});var t=e(74848),n=e(22803),r=e(96540),o=e(41119),s=e(22592),m=e(85629),a=e(27489),l=e(63142),f=e(30703),h=e(45861),u=e(55342);function i(yt){return typeof yt=="object"&&yt!==null&&"isCanceled"in yt}const x=yt=>{let mt=!1;return{promise:new Promise((Wt,et)=>{const Je={isCanceled:!0};yt.then(rt=>mt?et(Je):Wt(rt)),yt.catch(rt=>et(mt?Je:rt))}),cancel(){mt=!0}}};var g=e(6975),p=e(41654),c=e(72636),y=e(63527),P=e(88977);function d({nonMetricLabels:yt,labelSearchTerm:mt,onChangeLabelSearch:Ot,onClickLabel:Wt,styles:et}){return(0,t.jsxs)("div",{className:et.section,children:[(0,t.jsx)(c.J,{description:"Once label values are selected, only possible label combinations are shown.",children:"2. Select labels to search in"}),(0,t.jsx)("div",{children:(0,t.jsx)(y.p,{onChange:Ot,"aria-label":"Filter expression for label",value:mt,"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.labelNamesFilter})}),(0,t.jsx)("div",{className:et.list,style:{height:120},children:yt.map(Je=>(0,t.jsx)(P.J,{name:Je.name,loading:Je.loading,active:Je.selected,hidden:Je.hidden,facets:Je.facets,onClick:Wt,searchTerm:mt},Je.name))})]})}var D=e(91793),b=e(9806);function E({metrics:yt,metricSearchTerm:mt,seriesLimit:Ot,onChangeMetricSearch:Wt,onChangeSeriesLimit:et,onClickMetric:Je,styles:rt}){const it=yt?.values?.length||0;return(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:rt.section,children:[(0,t.jsx)(c.J,{description:"Once a metric is selected only possible labels are shown. Labels are limited by the series limit below.",children:"1. Select a metric"}),(0,t.jsx)("div",{children:(0,t.jsx)(y.p,{onChange:Wt,"aria-label":"Filter expression for metric",value:mt,"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.selectMetric})}),(0,t.jsx)(c.J,{description:"Set to 'none' to remove limit and show all labels for a selected metric. Removing the limit may cause performance issues.",children:"Series limit"}),(0,t.jsx)("div",{children:(0,t.jsx)(y.p,{onChange:et,"aria-label":"Limit results from series endpoint",value:Ot,"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.seriesLimit})}),(0,t.jsx)("div",{role:"list",className:rt.valueListWrapper,"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.metricList,children:(0,t.jsx)(D.Y1,{height:Math.min(450,it*b.fo),itemCount:it,itemSize:b.fo,itemKey:Pt=>yt.values[Pt].name,width:300,className:rt.valueList,children:({index:Pt,style:It})=>{const Vt=yt?.values?.[Pt];return Vt?(0,t.jsx)("div",{style:It,children:(0,t.jsx)(P.J,{name:yt.name,value:Vt?.name,title:Vt.details,active:Vt?.selected,onClick:Je,searchTerm:mt})}):null}})})]})})}function v({selector:yt,validationStatus:mt,status:Ot,error:Wt,empty:et,onClickRunQuery:Je,onClickRunRateQuery:rt,onClickValidate:it,onClickClear:Pt,styles:It}){return(0,t.jsxs)("div",{className:It.section,children:[(0,t.jsx)(c.J,{children:"4. Resulting selector"}),(0,t.jsx)("div",{"aria-label":"selector",className:It.selector,children:yt}),mt&&(0,t.jsx)("div",{className:It.validationStatus,children:mt}),(0,t.jsxs)(p.B,{children:[(0,t.jsx)(h.$n,{"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.useQuery,"aria-label":"Use selector for query button",disabled:et,onClick:Je,children:"Use query"}),(0,t.jsx)(h.$n,{"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.useAsRateQuery,"aria-label":"Use selector as metrics button",variant:"secondary",disabled:et,onClick:rt,children:"Use as rate query"}),(0,t.jsx)(h.$n,{"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.validateSelector,"aria-label":"Validate submit button",variant:"secondary",disabled:et,onClick:it,children:"Validate selector"}),(0,t.jsx)(h.$n,{"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.clear,"aria-label":"Selector clear button",variant:"secondary",onClick:Pt,children:"Clear"}),(0,t.jsx)("div",{className:(0,n.cx)(It.status,(Ot||Wt)&&It.statusShowing),children:(0,t.jsx)("span",{className:Wt?It.error:"",children:Wt||Ot})})]})]})}function C({selectedLabels:yt,valueSearchTerm:mt,onChangeValueSearch:Ot,onClickValue:Wt,onClickLabel:et,styles:Je}){return(0,t.jsxs)("div",{className:Je.section,children:[(0,t.jsx)(c.J,{description:"Use the search f
5ield to find values across selected labels.",children:"3. Select (multiple) values for your labels"}),(0,t.jsx)("div",{children:(0,t.jsx)(y.p,{onChange:Ot,"aria-label":"Filter expression for label values",value:mt,"data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.labelValuesFilter})}),(0,t.jsx)("div",{className:Je.valueListArea,children:yt.map(rt=>(0,t.jsxs)("div",{role:"list","aria-label":`Values for ${rt.name}`,className:Je.valueListWrapper,children:[(0,t.jsx)("div",{className:Je.valueTitle,children:(0,t.jsx)(P.J,{name:rt.name,loading:rt.loading,active:rt.selected,hidden:rt.hidden,facets:rt.facets||rt.values?.length,onClick:et})}),(0,t.jsx)(D.Y1,{height:Math.min(200,b.fo*(rt.values?.length||0)),itemCount:rt.values?.length||0,itemSize:28,itemKey:it=>rt.values[it].name,width:200,className:Je.valueList,children:({index:it,style:Pt})=>{const It=rt.values?.[it];return It?(0,t.jsx)("div",{style:Pt,children:(0,t.jsx)(P.J,{name:rt.name,value:It?.name,active:It?.selected,onClick:Wt,searchTerm:mt})}):null}})]},rt.name))})]})}var S=e(85187),O=e(31200);function I(yt){let mt="";const Ot=[];for(const Je of yt)if((Je.name===b.SM||Je.selected)&&Je.values&&Je.values.length>0){const rt=Je.values.filter(it=>it.selected).map(it=>it.name);rt.length>1?Ot.push(`${(0,O.Nc)(Je.name)}=~"${rt.map(S.Cs).join("|")}"`):rt.length===1&&(Je.name===b.SM?mt=rt[0]:Ot.push(`${(0,O.Nc)(Je.name)}="${(0,S.Qn)(rt[0])}"`))}const Wt=[];return mt===""||(0,O.Rq)(mt)?Wt.push(mt,"{"):(Wt.push("{",`"${mt}"`),Ot.length>0&&Wt.push(",")),Wt.push(Ot.join(","),"}"),Wt.join("")}function R(yt,mt,Ot){return yt.map(Wt=>{const et=mt[Wt.name];if(et){let Je;if(Wt.name===Ot&&Wt.values)Je=Wt.values;else{const rt=new Set(Wt.values?.filter(it=>it.selected).map(it=>it.name)||[]);Je=et.map(it=>({name:it,selected:rt.has(it)}))}return{...Wt,loading:!1,values:Je,hidden:!et,facets:Je.length}}return{...Wt,loading:!1,hidden:!et,values:void 0,facets:0}})}var T=e(65240);const L=(0,T.N)(yt=>({wrapper:(0,n.css)({backgroundColor:yt.colors.background.secondary,padding:yt.spacing(1),width:"100%"}),list:(0,n.css)({marginTop:yt.spacing(1),display:"flex",flexWrap:"wrap",maxHeight:"200px",overflow:"auto",alignContent:"flex-start"}),section:(0,n.css)({"& + &":{margin:`${yt.spacing(2)} 0`},position:"relative"}),selector:(0,n.css)({fontFamily:yt.typography.fontFamilyMonospace,marginBottom:yt.spacing(1)}),status:(0,n.css)({padding:yt.spacing(.5),color:yt.colors.text.secondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",position:"absolute",width:"50%",right:0,textAlign:"right",opacity:0,[yt.transitions.handleMotion("no-preference","reduce")]:{transition:"opacity 100ms linear"}}),statusShowing:(0,n.css)({opacity:1}),error:(0,n.css)({color:yt.colors.error.main}),valueList:(0,n.css)({marginRight:yt.spacing(1),resize:"horizontal"}),valueListWrapper:(0,n.css)({borderLeft:`1px solid ${yt.colors.border.medium}`,margin:`${yt.spacing(1)} 0`,padding:`${yt.spacing(1)} 0 ${yt.spacing(1)} ${yt.spacing(1)}`}),valueListArea:(0,n.css)({display:"flex",flexWrap:"wrap",marginTop:yt.spacing(1)}),valueTitle:(0,n.css)({marginLeft:`-${yt.spacing(.5)}`,marginBottom:yt.spacing(1)}),validationStatus:(0,n.css)({padding:yt.spacing(.5),marginBottom:yt.spacing(1),color:yt.colors.text.maxContrast,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"})}));class K extends r.Component{constructor(){super(...arguments),this.state={labels:[],labelSearchTerm:"",metricSearchTerm:"",status:"Ready",error:"",validationStatus:"",valueSearchTerm:""},this.onChangeLabelSearch=mt=>{this.setState({labelSearchTerm:mt.target.value})},this.onChangeMetricSearch=mt=>{this.setState({metricSearchTerm:mt.target.value})},this.onChangeSeriesLimit=mt=>{this.setState({seriesLimit:mt.target.value.trim()})},this.onChangeValueSearch=mt=>{this.setState({valueSearchTerm:mt.target.value})},this.onClickRunQuery=()=>{const mt=I(this.state.labels);this.props.onChange(mt)},this.onClickRunRateQuery=()=>{const Ot=`rate(${I(this.state.labels)}[$__rate_interval])`;this.props.onChange(Ot)},this.onClickClear=()=>{this.setState(mt=>({labels:mt.labels.map(Wt=>({...Wt,values:void 0,selected:!1,loading:!1,hidden:!1,facets:void 0})),labelSearchTerm:"",metricSearchTerm:"",status:"",error:"",validationStatus:"",valueSearchTerm:""})),localStorage.removeItem(b.B9),this.fetchValues(b.SM,b.qb)},this.onClickLabel=(mt,Ot,Wt)=>{const et=this.state.labels.find(it=>it.name===mt);if(!et)return;const Je=!et.selected;let rt={selected:Je};if(et.values&&!Je){const it=et.values.map(Pt=>({...Pt,selected:!1}));rt={...rt,facets:0,values:it}}this.setState({labelSearchTerm:""}),this.updateLabelState(mt,rt,"",()=>this.doFacettingForLabel(mt))},this.onClickValue=(mt,Ot,Wt)=>{const et=this.state.labels.find(rt=>rt.name===mt);if(!et||!et.values)return;this.setState({labelSearchTerm:""});const Je=et.values.map(rt=>({...rt,selected:rt.name===Ot?!rt.selected:rt.selected}));this.updateLabelState(mt,{values:Je},"",()=>this.doFacetting(mt))},this.onClickMetric=(mt,Ot,Wt)=>{const et=this.state.labels.find(it=>it.name===mt);if(!et||!et.values)return;this.setState({metricSearchTerm:""});const Je=et.values.map(it=>({...it,selected:it.name===Ot||it.selected?!it.selected:it.selected})),rt=Je.some(it=>it.selected);this.updateLabelState(mt,{selected:rt,values:Je},"",()=>this.doFacetting(mt))},this.onClickValidate=()=>{const mt=I(this.state.labels);this.validateSelector(mt)},this.doFacetting=mt=>{const Ot=I(this.state.labels);if(Ot===b.qb){const Wt=this.state.labels.map(et=>({...et,facets:0,values:void 0,hidden:!1}));this.setState({labels:Wt},()=>
5{this.state.labels.forEach(et=>(et.selected||et.name===b.SM)&&this.fetchValues(et.name,Ot))})}else this.fetchSeries(Ot,mt)}}updateLabelState(mt,Ot,Wt="",et){this.setState(Je=>{const rt=Je.labels.map(Pt=>Pt.name===mt?{...Pt,...Ot}:Pt),it=Wt?"":Je.error;return{labels:rt,status:Wt,error:it,validationStatus:""}},et)}componentDidMount(){const{languageProvider:mt}=this.props;if(mt){const Ot=JSON.parse(localStorage.getItem(b.B9)??"[]")??[];mt.start(this.props.timeRange).then(()=>{let Wt=mt.getLabelKeys();this.fetchValues(b.SM,b.qb);const et=Wt.map((Je,rt,it)=>({name:Je,selected:Ot.includes(Je),loading:!1}));this.setState({labels:et},()=>{this.state.labels.forEach(Je=>{Je.selected&&this.fetchValues(Je.name,b.qb)})})})}}doFacettingForLabel(mt){const Ot=this.state.labels.find(et=>et.name===mt);if(!Ot)return;const Wt=this.state.labels.filter(et=>et.selected).map(et=>et.name);localStorage.setItem(b.B9,JSON.stringify(Wt)),Ot.selected?Ot.values||this.fetchValues(mt,I(this.state.labels)):this.doFacetting()}async fetchValues(mt,Ot){const{languageProvider:Wt}=this.props;this.updateLabelState(mt,{loading:!0},`Fetching values for ${mt}`);try{let et=await Wt.getLabelValues(this.props.timeRange??(0,s.E2)(),mt);if(Ot!==I(this.state.labels)){this.updateLabelState(mt,{loading:!1});return}const Je=[],{metricsMetadata:rt}=Wt;for(const it of et){const Pt={name:it};
5if(mt===b.SM&&rt){const It=rt[it];It&&(Pt.details=`(${It.type}) ${It.help}`)}Je.push(Pt)}this.updateLabelState(mt,{values:Je,loading:!1})}catch(et){console.error(et)}}async fetchSeries(mt,Ot){const{languageProvider:Wt}=this.props;Ot&&this.updateLabelState(Ot,{loading:!0},`Facetting labels for ${mt}`);try{const et=await Wt.fetchSeriesLabels(this.props.timeRange??(0,s.E2)(),mt,!0,this.state.seriesLimit);if(mt!==I(this.state.labels)){Ot&&this.updateLabelState(Ot,{loading:!1});return}if(Object.keys(et).length===0){this.setState({error:`Empty results, no matching label for ${mt}`});return}const Je=R(this.state.labels,et,Ot);this.setState({labels:Je,error:""}),Ot&&this.updateLabelState(Ot,{loading:!1})}catch(et){console.error(et)}}async validateSelector(mt){const{languageProvider:Ot}=this.props;this.setState({validationStatus:`Validating selector ${mt}`,error:""});const Wt=await Ot.fetchSeries(this.props.timeRange??(0,s.E2)(),mt);this.setState({validationStatus:`Selector is valid (${Wt.length} series found)`})}render(){const{theme:mt}=this.props,{labels:Ot,labelSearchTerm:Wt,metricSearchTerm:et,status:Je,error:rt,validationStatus:it,valueSearchTerm:Pt}=this.state,It=L(mt);if(Ot.length===0)return(0,t.jsx)("div",{className:It.wrapper,children:(0,t.jsx)(g._,{text:"Loading labels..."})});let Vt=Ot.find(En=>En.name===b.SM);Vt&&et&&(Vt={...Vt,values:Vt.values?.filter(En=>En.selected||En.name.includes(et))});let en=Ot.filter(En=>!En.hidden&&En.name!==b.SM);Wt&&(en=en.filter(En=>En.selected||En.name.includes(Wt)));let ln=en.filter(En=>En.selected&&En.values);Pt&&(ln=ln.map(En=>({...En,values:En.values?.filter(zn=>zn.selected||zn.name.includes(Pt))})));const Qt=I(this.state.labels),xn=Qt===b.qb;return(0,t.jsxs)("div",{className:It.wrapper,children:[(0,t.jsxs)(p.B,{gap:3,children:[(0,t.jsx)(E,{metrics:Vt,metricSearchTerm:et,seriesLimit:this.state.seriesLimit??b._N,onChangeMetricSearch:this.onChangeMetricSearch,onChangeSeriesLimit:this.onChangeSeriesLimit,onClickMetric:this.onClickMetric,styles:It}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d,{nonMetricLabels:en,labelSearchTerm:Wt,onChangeLabelSearch:this.onChangeLabelSearch,onClickLabel:this.onClickLabel,styles:It}),(0,t.jsx)(C,{selectedLabels:ln,valueSearchTerm:Pt,onChangeValueSearch:this.onChangeValueSearch,onClickValue:this.onClickValue,onClickLabel:this.onClickLabel,styles:It})]})]}),(0,t.jsx)(v,{selector:Qt,validationStatus:it,status:Je,error:rt,empty:xn,onClickRunQuery:this.onClickRunQuery,onClickRunRateQuery:this.onClickRunRateQuery,onClickValidate:this.onClickValidate,onClickClear:this.onClickClear,styles:It})]})}}const A=(0,l.cV)(K);var W=e(21489),N=e(75357),w=e(39554),j=e(24726),V=e(65232);function U(){const yt=new Map;return yt.set("expandSuggestionDocs","true"),{onDidChangeValue:mt=>{},onDidChangeTarget:mt=>{},onWillSaveState:mt=>{},get:(mt,Ot,Wt)=>yt.get(mt)??Wt,getBoolean:(mt,Ot,Wt)=>{const et=yt.get(mt);return et!==void 0?et==="true":Wt},getNumber:(mt,Ot,Wt)=>{const et=yt.get(mt);return et!==void 0?parseInt(et,10):Wt},store:(mt,Ot,Wt,et)=>{Ot==null?yt.delete(mt):yt.set(mt,Ot.toString())},remove:(mt,Ot)=>{yt.delete(mt)},keys:(mt,Ot)=>Array.from(yt.keys()),logStorage:()=>{console.log("logStorage: not implemented")},migrate:()=>Promise.resolve(void 0),isNew:mt=>!0,flush:mt=>Promise.resolve(void 0)}}let F=null;function M(){return F===null&&(F={storageService:U()}),F}var H=e(84139),_=e(43173),Z=e(96944),ne=e(35748);class te extends Error{constructor(mt){super("should never happen")}}const Y=4,Q={multiInsert:new H.A({intraMode:0}),singleError:new H.A({intraMode:1})},J="${1:}";function q({metricNames:yt,inputText:mt,limit:Ot}){if(!mt?.trim())return yt.slice(0,Ot);const Je=Q.multiInsert.split(mt).length>4?Q.multiInsert.filter(yt,mt):Q.singleError.filter(yt,mt);return Je?Je.slice(0,Ot).map(rt=>yt[rt]):[]}function X(yt){let mt=yt.getAllMetricNames();if(_.$.featureToggles.prometheusCodeModeMetricNamesSearch&&mt.length>yt.metricNamesSuggestionLimit){const{monacoSettings:Ot}=yt;Ot.enableAutocompleteSuggestionsUpdate(),Ot.inputInRange?mt=q({metricNames:mt,inputText:Ot.inputInRange,limit:yt.metricNamesSuggestionLimit}):mt=mt.slice(0,yt.metricNamesSuggestionLimit)}return yt.metricNamesToMetrics(mt).map(Ot=>
5({type:"METRIC_NAME",label:Ot.name,detail:`${Ot.name} : ${Ot.type}`,documentation:Ot.help,...Ot.isUtf8?{insertText:`{"${Ot.name}"${J}}`,insertTextRules:Y}:{insertText:Ot.name}}))}const se=ne.AW.map(yt=>({type:"FUNCTION",label:yt.label,insertText:yt.insertText??"",detail:yt.detail,documentation:yt.documentation}));async function oe(yt){const mt=X(yt);return[...se,...mt]}const ae=["$__interval","$__range","$__rate_interval","1m","5m","10m","30m","1h","1d"].map(yt=>({type:"DURATION",label:yt,insertText:yt}));function ie(yt){return yt.getHistory().slice(0,10).map(Ot=>({type:"HISTORY",label:Ot,insertText:Ot}))}function fe(yt,mt){const Ot=[...mt];return yt!==void 0&&Ot.push({name:"__name__",value:yt,op:"="}),`{${Ot.map(et=>`${et.name}${et.op}"${(0,S.Qn)(et.value)}"`).join(",")}}`}async function pe(yt,mt,Ot,Wt){if(yt===void 0&&mt.length===0)return Promise.resolve(Ot.getAllLabelNames());{const et=fe(yt,mt);return await Ot.getSeriesLabels(Wt,et,mt)}}async function de(yt,mt,Ot,Wt,et,Je){return(await pe(yt,Wt,et,Je)).map(it=>{const Pt=!(0,O.Rq)(it);return{type:"LABEL_NAME",label:it,...Pt?{insertText:`"${it}"${mt}`,insertTextRules:Y}:{insertText:`${it}${mt}`},triggerOnInsert:Ot}})}async function le(yt,mt,Ot,Wt){return de(yt,"=",!0,mt,Ot,Wt)}async function me(yt,mt,Ot,Wt){return de(yt,"",!1,mt,Ot,Wt)}async function De(yt,mt,Ot,Wt,et){if(yt===void 0&&Ot.length===0)return Wt.getLabelValues(et,mt);{const Je=fe(yt,Ot);return await Wt.getSeriesValues(et,mt,Je)}}async function Te(yt,mt,Ot,Wt,et,Je){return(await De(yt,mt,Wt,et,Je)).map(it=>({type:"LABEL_VALUE",label:it,insertText:Ne(it,Ot)}))}function Ne(yt,mt){const Ot=_.$.featureToggles.prometheusSpecialCharsInLabelValues?(0,Z.ee)(yt):yt;return mt?Ot:`"${Ot}"`}function Ce(yt,mt,Ot){switch(yt.type){case"IN_DURATION":return Promise.resolve(ae);case"IN_FUNCTION":return oe(mt);case"AT_ROOT":return oe(mt);case"EMPTY":{const Wt=X(mt),et=ie(mt);return Promise.resolve([...et,...se,...Wt])}case"IN_LABEL_SELECTOR_NO_LABEL_NAME":return le(yt.metricName,yt.otherLabels,mt,Ot);case"IN_GROUPING":return me(yt.metricName,yt.otherLabels,mt,Ot);case"IN_LABEL_SELECTOR_WITH_LABEL_NAME":return Te(yt.metricName,yt.labelName,yt.betweenQuotes,yt.otherLabels,mt,Ot);default:throw new te(yt)}}function He(yt,mt){switch(mt){case"parent":return yt.parent;case"firstChild":return yt.firstChild;case"lastChild":return yt.lastChild;case"nextSibling":return yt.nextSibling;default:throw new te(mt)}}function ke(yt,mt){let Ot=yt;for(const[Wt,et]of mt)if(Ot=He(Ot,Wt),Ot===null||Ot.type.id!==et)return null;return Ot}function Me(yt,mt,Ot){const Wt=Ot?yt.from+1:yt.from,et=Ot?yt.to-1:yt.to;return mt.slice(Wt,et)}function $e(yt){const mt=yt.slice(1,yt.length-1);if(yt.startsWith('"')&&yt.endsWith('"'))return mt.replace(/\\"/,'"');if(yt.startsWith("'")&&yt.endsWith("'"))return mt.replace(/\\'/,"'");if(yt.startsWith("`")&&yt.endsWith("`"))return mt;throw new Error("FIXME: invalid string literal")}function tt(yt,mt){return yt.every((Ot,Wt)=>Ot===mt[Wt])}const Ke=0,Re=[{path:[W.ww,W.Fb],fun:Oe},{path:[W.LW,W.c6,W.ww,W.Fb],fun:we},{path:[W.ab],fun:Ee},{path:[W.Dh],fun:xe},{path:[W.LW,W.Yq],fun:Pe},{path:[W.LW,W.d2],fun:Se},{path:[Ke,W.df,W.ab],fun:Ee},{path:[Ke,W.Yq],fun:Pe},{path:[Ke,W.d2],fun:Se},{path:[Ke,W.TG,W.l4],fun:ye},{path:[W.x$],fun:ce}],Ve=new Map([[W.Hl,"="],[W.Ed,"=~"],[W.l3,"!="],[W.$i,"!~"]]);function Qe(yt){const mt=yt.firstChild;return mt===null?null:Ve.get(mt.type.id)??null}function je(yt,mt){if(!new Set([W.Yq,W.d2]).has(yt.type.id))return null;const Wt=ke(yt,[["firstChild",W.IC]])??ke(yt,[["firstChild",W.c6]]);if(Wt===null)return null;const et=ke(Wt,[["nextSibling",W.Lf]]);if(et===null)return null;const Je=Qe(et);if(Je===null)return null;const rt=ke(yt,[["lastChild",W.LW]]);if(rt===null)return null;const it=Me(Wt,mt),Pt=$e(Me(rt,mt));return{name:it,value:Pt,op:Je}}function ze(yt,mt){return yt.type.id!==W.ww?[]:[W.Yq,W.d2].reduce((Wt,et)=>(yt.getChildren(et).forEach(Je=>{const rt=je(Je,mt);lt(rt)&&Wt.push(rt)}),Wt),[])}function Ye(yt){let mt=yt.firstChild;const Ot=[];for(;mt!==null;)Ot.push(mt),mt=mt.nextSibling;return Ot}function Ge(yt,mt){if(yt.type.id===mt)return yt;const Ot=Ye(yt);for(const Wt of Ot){const et=Ge(Wt,mt);if(et!==null)return et}return null}function ce(yt,mt,Ot){const Wt=ke(yt,[["parent",W.hI],["parent",W.Fn]]);if(Wt===null)return null;const et=Wt.getChild(W.Dh);if(et===null)return null;const Je=Ge(et,W.gw)??Ge(et,W.LW);return!Je||Je.type.id===W.LW&&Je.parent?.type.id!==W.c6?null:{type:"IN_GROUPING",metricName:Me(Je,mt,Je.type.id===W.LW),otherLabels:[]}}function Pe(yt,mt,Ot){const Wt=!yt.type.isError,et=ke(yt,[["parent",W.Yq]]);if(et===null)return null;const Je=ke(et,[["firstChild",W.IC]]);if(Je===null)return null;const rt=Me(Je,mt),it=ke(et,[["parent",W.ww]]);if(it===null)return null;const It=ze(it,mt).filter(en=>en.name!==rt),Vt=Be(it,mt);return{type:"IN_LABEL_SELECTOR_WITH_LABEL_NAME",labelName:rt,betweenQuotes:Wt,otherLabels:It,...Vt?{metricName:Vt}:{}}}function Se(yt,mt,Ot){const Wt=!yt.type.isError,et=ke(yt,[["parent",W.d2]]);if(et===null)return null;const Je=ke(et,[["firstChild",W.c6]]);if(Je===null)return null;const rt=Me(Je,mt),it=ke(et,[["parent",W.ww]]);if(it===null)return null;const It=ze(it,mt).filter(en=>en.name!==rt),Vt=Be(et.parent,mt);return{type:"IN_LABEL_SELECTOR_WITH_LABEL_NAME",labelName:rt,betweenQuotes:Wt,otherLabels:It,...Vt?{metricName:Vt}:{}}}function Ee(yt,mt,Ot){return{type:"AT_ROOT"}}function xe(yt,mt,Ot){return{type:"IN_FUNCTION"}}function ye(yt,mt,Ot){return{type:"IN_DURATION"}}function Oe(yt,mt,Ot){let Wt=ke(yt,[["firstChild",W.Yq]]);if(Wt!==null&&!mt.slice(Wt.to,Ot).includes(",")||(Wt=ke(yt,[["firstChild",W.c6]]),Wt!==null&&!mt.slice(Wt.to,Ot).includes(",")))return null;const et=ze(yt,mt),Je=Be(yt,mt);return{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",otherLabels:et,betweenQuotes:!1,...Je?{metricName:Je}:{}}}function we(yt,mt,Ot){const Wt=ze(yt,mt),et=yt.parent?.parent?Be(yt.parent.parent,mt):null;return{type:"IN_LABEL_SELECTOR_NO_LABEL_NAME",otherLabels:Wt,betweenQuotes:!0,...et?{metricName:et}:{}}}function Be(yt,mt){const Ot=ke(yt,[["parent",W.Fb],["firstChild",W.gw]]);if(Ot)return Me(Ot,mt);const Wt=ke(yt,[["parent",W.Fb],["firstChild",W.ww],["firstChild",W.c6],["firstChild",W.LW]]);return Wt?Me(Wt,mt,!0):null}function Xe(yt,mt){const Ot=yt.cursorAt(mt);for(;;){if(Ot.from===mt&&Ot.to===mt){const{node:Wt}=Ot;if(Wt.type.isError)return Wt}if(!Ot.next())break}return null}function st(yt,mt){if(yt==="")return{type:"EMPTY"};
5const Ot=W.K3.parse(yt),Wt=Xe(Ot,mt),et=Wt!=null?Wt.cursor():Ot.cursorAt(mt),Je=et.node,rt=[et.type.id];for(;et.parent();)rt.push(et.type.id);for(let it of Re)if(tt(it.path,rt))return it.fun(Je,yt,mt);return null}function lt(yt){return yt!=null}function Et(){return{showWords:!1}}function Tt(yt,mt){switch(yt){case"DURATION":return mt.languages.CompletionItemKind.Unit;case"FUNCTION":return mt.languages.CompletionItemKind.Variable;case"HISTORY":return mt.languages.CompletionItemKind.Snippet;case"LABEL_NAME":return mt.languages.CompletionItemKind.Enum;case"LABEL_VALUE":return mt.languages.CompletionItemKind.EnumMember;case"METRIC_NAME":return mt.languages.CompletionItemKind.Constructor;default:throw new te(yt)}}function Mt(yt,mt,Ot){return{triggerCharacters:["{",",","[","(","=","~"," ",'"'],provideCompletionItems:(et,Je)=>{const rt=et.getWordAtPosition(Je),it=rt!=null?yt.Range.lift({startLineNumber:Je.lineNumber,endLineNumber:Je.lineNumber,startColumn:rt.startColumn,endColumn:rt.endColumn}):yt.Range.fromPositions(Je),Pt={column:Je.column,lineNumber:Je.lineNumber};if(mt.monacoSettings.setInputInRange(et.getValueInRange(it)),window.getSelection){const ln=window.getSelection()?.toString();ln&&ln.length>0&&(Pt.column=Pt.column-ln.length)}const It=et.getOffsetAt(Pt),Vt=st(et.getValue(),It);return(Vt!=null?Ce(Vt,mt,Ot):Promise.resolve([])).then(ln=>{const Qt=ln.length.toString().length;return{suggestions:ln.map((En,zn)=>({kind:Tt(En.type,yt),label:En.label,insertText:En.insertText,insertTextRules:En.insertTextRules,detail:En.detail,documentation:En.documentation,sortText:zn.toString().padStart(Qt,"0"),range:it,command:En.triggerOnInsert?{id:"editor.action.triggerSuggest",title:""}:void 0})),incomplete:mt.monacoSettings.suggestionsIncomplete}})}}}var wt=e(44409);const _e=0;function xt(yt,mt,Ot,Wt){if(!yt)return!1;const et=At(mt,Wt);if(!et.length)return!1;let Je=et;if(yt!==mt){const rt=At(yt,Wt);Je=et.flatMap(it=>rt.filter(Pt=>it.text===Pt.text)||it)}return Je.map(rt=>bt(yt,Ot,rt)).filter(Xt)}function At(yt,mt){const Ot=[];return mt.parse(yt).iterate({enter:et=>{if(et.type.id===_e){const Je=et.node;Ot.push({node:Je,text:yt.substring(Je.from,Je.to)})}}}),Ot}function bt(yt,mt,Ot){if(mt.length===1){const Je=Ot.node.from===Ot.node.to,rt=Je&&Ot.node.parent?Ot.node.parent:Ot.node,it=Je?yt.substring(rt.from,rt.to):Ot.text;return{startLineNumber:1,startColumn:rt.from+1,endLineNumber:1,endColumn:rt.to+1,error:it}}let Wt=0,et=0;for(let Je=0;Je<mt.length;Je++){if(et=Wt+mt[Je].length,Ot.node.from>et){Wt+=mt[Je].length+1;continue}return{startLineNumber:Je+1,startColumn:Ot.node.from-Wt+1,endLineNumber:Je+1,endColumn:Ot.node.to-Wt+1,error:Ot.text}}return null}function Xt(yt){return yt!==null}const Cn={__interval:{text:"1s",value:"1s"},__rate_interval:{text:"1s",value:"1s"},__auto:{text:"1s",value:"1s"},__interval_ms:{text:"1000",value:1e3},__range_ms:{text:"1000",value:1e3},__range_s:{text:"1",value:1},__range:{text:"1s",value:"1s"}},vn={wordPattern:/(-?\d*\.\d\w*)|([^`~!#%^&*()\-=+\[{\]}\\|;:'",.<>\/?\s]+)/g,comments:{lineComment:"#"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{}},Wn=["sum","min","max","avg","group","stddev","stdvar","count","count_values","bottomk","topk","quantile"],Dt=["abs","absent","ceil","changes","clamp_max","clamp_min","day_of_month","day_of_week","days_in_month","delta","deriv","double_exponential_smoothing","exp","floor","histogram_quantile","histogram_avg","histogram_count","histogram_sum","histogram_fraction","histogram_stddev","histogram_stdvar","holt_winters","hour","idelta","increase","info","irate","label_join","label_replace","ln","log2","log10","minute","month","predict_linear","rate","resets","round","scalar","sort","sort_desc","sqrt","time","timestamp","vector","year"],qt=[];for(let yt=0,mt=Wn;yt<mt.length;yt++){let Ot=mt[yt];qt.push(Ot+"_over_time")}const Yt=["on","ignoring","group_right","group_left","by","without"],nn="("+Yt.reduce(function(yt,mt){return yt+"|"+mt})+")",Zt=["+","-","*","/","%","^","==","!=",">","<",">=","<=","and","or","unless"],tn=["offset"],Rt={ignoreCase:!1,defaultToken:"",tokenPostfix:".promql",keywords:Wn.concat(Dt).concat(qt).concat(Yt).concat(tn),operators:Zt,vectorMatching:nn,symbols:/[=><!~?:&|+\-*\/^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,integersuffix:/(ll|LL|u|U|l|L)?(ll|LL|u|U|l|L)?/,floatsuffix:/[fFlL]?/,tokenizer:{root:[[/@vectorMatching\s*(?=\()/,"type","@clauses"],[/[a-z_]\w
5*(?=\s*(=|!=|=~|!~))/,"tag"],[/(^#.*$)/,"comment"],[/[a-zA-Z_]\w*/,{cases:{"@keywords":"type","@default":"identifier"}}],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string","@string_double"],[/'/,"string","@string_single"],[/`/,"string","@string_backtick"],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/\d+[smhdwy]/,"number"],[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/,"number.float"],[/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/,"number.float"],[/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/,"number.hex"],[/0[0-7']*[0-7](@integersuffix)/,"number.octal"],[/0[bB][0-1']*[0-1](@integersuffix)/,"number.binary"],[/\d[\d']*\d(@integersuffix)/,"number"],[/\d(@integersuffix)/,"number"]],string_double:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],string_single:[[/[^\\']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,"string","@pop"]],string_backtick:[[/[^\\`$]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/`/,"string","@pop"]],clauses:[[/[^(,)]/,"tag"],[/\)/,"identifier","@pop"]],whitespace:[[/[ \t\r\n]+/,"white"]]}},Bt={codeLens:!1,contextmenu:!1,fixedOverflowWidgets:!0,folding:!1,fontSize:14,lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},overviewRulerBorder:!1,overviewRulerLanes:0,padding:{top:4,bottom:5},renderLineHighlight:"none",scrollbar:{vertical:"hidden",verticalScrollbarSize:8,horizontal:"hidden",horizontalScrollbarSize:0,alwaysConsumeMouseWheel:!1},scrollBeyondLastLine:!1,suggest:Et(),suggestFontSize:12,wordWrap:"on"},jt=2,Nt=N.Y.id;let $t=!1;function an(yt){if($t===!1){$t=!0;const{aliases:mt,extensions:Ot,mimetypes:Wt}=N.Y;yt.languages.register({id:Nt,aliases:mt,extensions:Ot,mimetypes:Wt}),yt.languages.setMonarchTokensProvider(Nt,Rt),yt.languages.setLanguageConfiguration(Nt,vn)}}const Jt=(yt,mt)=>({container:(0,n.css)({borderRadius:yt.shape.radius.default,border:`1px solid ${yt.components.input.borderColor}`,display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",height:"100%",overflow:"hidden"}),placeholder:(0,n.css)({"::after":{content:`'${mt}'`,fontFamily:yt.typography.fontFamilyMonospace,opacity:.6}})}),mn=yt=>{const mt=(0,j.A)(),Ot=(0,r.useRef)(M()),Wt=(0,r.useRef)(null),{languageProvider:et,history:Je,onBlur:rt,onRunQuery:it,initialValue:Pt,placeholder:It,datasource:Vt,timeRange:en}=yt,ln=(0,w.A)(et),Qt=(0,w.A)(Je),xn=(0,w.A)(it),En=(0,w.A)(rt),zn=(0,r.useRef)(null),Gn=(0,l.$j)(),St=Jt(Gn,It);return(0,r.useEffect)(()=>()=>{zn.current?.()},[]),(0,t.jsx)("div",{"data-testid":m.Tp.components.QueryField.container,className:St.container,ref:Wt,children:(0,t.jsx)(V.m,{saveViewState:!0,overrideServices:Ot.current,options:Bt,language:"promql",value:Pt,beforeMount:Ht=>{an(Ht)},onMount:(Ht,cn)=>{const un=Ht.createContextKey("isEditorFocused"+mt,!1);Ht.onDidBlurEditorWidget(()=>{un.set(!1),En.current(Ht.getValue())}),Ht.onDidFocusEditorText(()=>{un.set(!0)});const bn=new wt.M9({historyProvider:Qt.current,languageProvider:ln.current}),Sn=Mt(cn,bn,en),wn={...Sn,provideCompletionItems:(Vn,_n,Ln,Xn)=>Ht.getModel()?.id!==Vn.id?{suggestions:[]}:Sn.provideCompletionItems(Vn,_n,Ln,Xn)},{dispose:ea}=cn.languages.registerCompletionItemProvider(Nt,wn);zn.current=ea;const Zn=()=>{const Vn=Wt.current;if(Vn!==null){const _n=Ht.getContentHeight();Vn.style.height=`${_n+jt}px`,Vn.style.width="100%";const Ln=Vn.clientWidth;Ht.layout({width:Ln,height:_n})}};if(Ht.onDidContentSizeChange(Zn),Zn(),Ht.addCommand(cn.KeyMod.Shift|cn.KeyCode.Enter,()=>{xn.current(Ht.getValue())},"isEditorFocused"+mt),cn.editor.addKeybindingRule({keybinding:cn.KeyMod.CtrlCmd|cn.KeyCode.KeyF,command:null}),Ht.addCommand(cn.KeyMod.CtrlCmd|cn.KeyCode.KeyK,function(){e.g.dispatchEvent(new KeyboardEvent("keydown",{key:"k",metaKey:!0}))}),It){const Vn=[{range:new cn.Range(1,1,1,1),options:{className:St.placeholder,isWholeLine:!0}}];let _n=[];const Ln=()=>{const Xn=Ht.getModel();if(!Xn)return;const ma=Xn.getValueLength()===0?Vn:[];_n=Xn.deltaDecorations(_n,ma)};Ln(),Ht.onDidChangeModelContent(Ln),Ht.onDidChangeModelContent(Xn=>{const ma=Ht.getModel();if(!ma)return;const Ca=ma.getValue(),Qn=(xt(Ca,Vt.interpolateString(Ca,Cn),ma.getLinesContent(),W.K3)||[]).map(({error:Ha,...ba})=>({message:`${Ha?`Error parsing "${Ha}"`:"Parse error"}. The query appears to be incorrect and could fail to be executed.`,severity:cn.MarkerSeverity.Error,...ba}));cn.editor.setModelMarkers(ma,"owner",Qn)})}}})})},_t=yt=>(0,t.jsx)(r.Suspense,{fallback:null,children:(0,t.jsx)(mn,{...yt})}),On=yt=>
5{const mt=(0,r.useRef)(null),{onRunQuery:Ot,onChange:Wt,...et}=yt,Je=it=>{mt.current=it,Wt(it),Ot()},rt=it=>{Wt(it)};return(0,t.jsx)(_t,{onRunQuery:Je,onBlur:rt,...et})};function Nn(yt,mt,Ot){return yt?"(Disabled)":mt?Ot?"Metrics browser":"(No metrics found)":"Loading metrics..."}function Fn(yt,mt,Ot){return(0,r.useMemo)(()=>{const Wt=mt.metrics.length>0,et=Nn(yt.lookupsDisabled,Ot,Wt);return{hasMetrics:Wt,chooserText:et,buttonDisabled:!(Ot&&Wt)}},[mt.metrics,yt.lookupsDisabled,Ot])}function na(yt,mt,Ot,Wt,et){const Je=(0,r.useRef)(null),rt=(0,r.useRef)(null);return(0,r.useEffect)(()=>(yt&&Wt(rt),et(),()=>{rt.current&&(rt.current.cancel(),rt.current=null)}),[]),(0,r.useEffect)(()=>{if(!mt)return;const it=(0,S.eN)(mt.from.valueOf()),Pt=(0,S.eN)(mt.to.valueOf());Je.current||(Je.current={from:mt.from,to:mt.to});const It=(0,S.eN)(Je.current.from.valueOf()),Vt=(0,S.eN)(Je.current.to.valueOf());(it!==It||Pt!==Vt)&&(Je.current={from:mt.from,to:mt.to},Wt(rt))},[mt,Wt]),(0,r.useEffect)(()=>{et()},[Ot,et]),rt}const aa=yt=>{const{app:mt,datasource:Ot,datasource:{languageProvider:Wt},query:et,ExtraFieldElement:Je,history:rt=[],data:it,range:Pt,onChange:It,onRunQuery:Vt}=yt,en=(0,l.$j)(),[ln,Qt]=(0,r.useState)(!1),[xn,En]=(0,r.useState)(null),[zn,Gn]=(0,r.useState)(!1),St=(0,r.useCallback)(()=>{Wt.metrics&&Qt(!0)},[Wt]),Ht=(0,r.useCallback)(async Vn=>{if(Vn.current&&Vn.current.cancel(),!(!Wt||!Pt))try{const _n=x(Wt.start(Pt));Vn.current=_n;const Ln=await _n.promise;Array.isArray(Ln)&&Ln.length>0&&await Promise.all(Ln),St()}catch(_n){if(!(i(_n)&&_n.isCanceled))throw _n}finally{Vn.current=null}},[Wt,Pt,St]),cn=(0,r.useCallback)(()=>{const _n=(0,u.X1)(Ot)[0]??null;if(!it?.series?.length){En(_n);return}const Ln=(0,o.ci)(it.series[0])?it.series.map(o.w3):it.series,Xn=Ot.getQueryHints(et,Ln);let ma=Xn.length>0?Xn[0]:null;En(ma??_n)},[it,Ot,et]),un=(Vn,_n)=>{if(!It)return;const Ln={...et,expr:Vn};It(Ln),_n&&Vt&&Vt()},bn=Vn=>{un(Vn,!0),Gn(!1)},Sn=()=>{Gn(!zn),(0,a.rR)("user_grafana_prometheus_metrics_browser_clicked",{editorMode:zn?"metricViewClosed":"metricViewOpen",app:mt??""})},wn=()=>{xn?.fix?.action&&It(Ot.modifyQuery(et,xn.fix.action)),Vt()};na(Wt,Pt,it?.series,Ht,cn);const{chooserText:ea,buttonDisabled:Zn}=Fn(Ot,Wt,ln);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"gf-form-inline gf-form-inline--xs-view-flex-column flex-grow-1","data-testid":yt["data-testid"],children:[(0,t.jsxs)("button",{className:"gf-form-label query-keyword pointer",onClick:Sn,disabled:Zn,type:"button","data-testid":m.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton,children:[ea,(0,t.jsx)(f.I,{name:zn?"angle-down":"angle-right"})]}),(0,t.jsx)("div",{className:"flex-grow-1 min-width-15",children:(0,t.jsx)(On,{languageProvider:Wt,history:rt,onChange:un,onRunQuery:Vt,initialValue:et.expr??"",placeholder:"Enter a PromQL query\u2026",datasource:Ot,timeRange:Pt??(0,s.E2)()})})]}),zn&&(0,t.jsx)("div",{className:"gf-form",children:(0,t.jsx)(A,{languageProvider:Wt,onChange:bn,timeRange:Pt})}),Je,xn?(0,t.jsx)("div",{className:(0,n.css)({flexBasis:"100%"}),children:(0,t.jsxs)("div",{className:"text-warning",children:[xn.label," ",xn.fix?(0,t.jsx)("button",{type:"button",className:(0,n.cx)((0,h.my)(en),"text-link","muted"),onClick:wn,children:xn.fix.label}):null]})}):null]})}},9806:(ee,B,e)=>{"use strict";e.d(B,{B9:()=>m,SM:()=>o,_N:()=>t,bS:()=>n,fo:()=>s,qb:()=>r});const t="40000",n="none",r="{}",o="__name__",s=25,m="grafana.datasources.prometheus.browser.labels"},44409:(ee,B,e)=>{"use strict";e.d(B,{M9:()=>o,Ol:()=>r,w0:()=>n});var t=e(31200);const n="codeModeSuggestionsIncomplete";function r(s){return s.type===n&&"detail"in s&&typeof s.detail=="object"&&s.detail!==null&&"limit"in s.detail&&"datasourceUid"in s.detail}class o{constructor(m){this.languageProvider=m.languageProvider,this.historyProvider=m.historyProvider,this.inputInRange="",this.metricNamesSuggestionLimit=this.languageProvider.datasource.metricNamesAutocompleteSuggestionLimit,this.suggestionsIncomplete=!1,this.getSeriesLabels=this.languageProvider.getSeriesLabels.bind(this.languageProvider),this.get
5SeriesValues=this.languageProvider.getSeriesValues.bind(this.languageProvider),this.getAllLabelNames=this.languageProvider.getLabelKeys.bind(this.languageProvider),this.getLabelValues=this.languageProvider.getLabelValues.bind(this.languageProvider)}getHistory(){return this.historyProvider.map(m=>m.query.expr).filter(Boolean)}getAllMetricNames(){return this.languageProvider.metrics}metricNamesToMetrics(m){const{metricsMetadata:a}=this.languageProvider;return m.map(f=>{const h=a?.[f];return{name:f,help:h?.help??"",type:h?.type??"",isUtf8:!(0,t.Rq)(f)}})}enableAutocompleteSuggestionsUpdate(){this.suggestionsIncomplete=!0,dispatchEvent(new CustomEvent(n,{detail:{limit:this.metricNamesSuggestionLimit,datasourceUid:this.languageProvider.datasource.uid}}))}setInputInRange(m){this.inputInRange=m}get monacoSettings(){return{enableAutocompleteSuggestionsUpdate:this.enableAutocompleteSuggestionsUpdate.bind(this),inputInRange:this.inputInRange,setInputInRange:this.setInputInRange.bind(this),suggestionsIncomplete:this.suggestionsIncomplete}}}},51901:(ee,B,e)=>{"use strict";e.d(B,{TT:()=>a,Zh:()=>l,jW:()=>m,k1:()=>o});var t=e(74848),n=e(22803),r=e(12594);const o=30,s=f=>{const{options:h,onOptionsChange:u}=f,i=useTheme2(),x=l(i);return jsxs(Fragment,{children:[h.access==="direct"&&jsx(Alert,{title:"Error",severity:"error",children:"Browser access mode in the Prometheus data source is no longer available. Switch to server access mode."}),jsx(DataSourceDescription,{dataSourceName:"Prometheus",docsLink:"https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/"}),jsx("hr",{className:`${x.hrTopSpace} ${x.hrBottomSpace}`}),jsx(DataSourceHttpSettingsOverhaul,{options:h,onOptionsChange:u,secureSocksDSProxyEnabled:config.secureSocksDSProxyEnabled}),jsx("hr",{}),jsxs(ConfigSection,{className:x.advancedSettings,title:"Advanced settings",description:"Additional settings are optional settings that can be configured for more control over your data source.",children:[jsx(AdvancedHttpSettings,{className:x.advancedHTTPSettingsMargin,config:h,onChange:u}),jsx(AlertingSettingsOverhaul,{options:h,onOptionsChange:u}),jsx(PromSettings,{options:h,onOptionsChange:u})]})]})};function m(f){return(0,t.jsx)("a",{href:f||"https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/",target:"_blank",rel:"noopener noreferrer",children:"Visit docs for more details here."})}const a=(f,h,u)=>{const i="Value is not valid";return f&&!f.match(h)?(0,t.jsx)(r.P,{children:u||i}):!0};function l(f){return{additionalSettings:(0,n.css)({marginBottom:"25px"}),secondaryGrey:(0,n.css)({color:f.colors.secondary.text,opacity:"65%"}),inlineError:(0,n.css)({margin:"0px 0px 4px 245px"}),switchField:(0,n.css)({alignItems:"center"}),sectionHeaderPadding:(0,n.css)({paddingTop:"32px"}),sectionBottomPadding:(0,n.css)({paddingBottom:"28px"}),subsectionText:(0,n.css)({fontSize:"12px"}),hrBottomSpace:(0,n.css)({marginBottom:"56px"}),hrTopSpace:(0,n.css)({marginTop:"50px"}),textUnderline:(0,n.css)({textDecoration:"underline"}),versionMargin:(0,n.css)({marginBottom:"12px"}),advancedHTTPSettingsMargin:(0,n.css)({margin:"24px 0 8px 0"}),advancedSettings:(0,n.css)({paddingTop:"32px"}),alertingTop:(0,n.css)({marginTop:"40px !important"}),overhaulPageHeading:(0,n.css)({fontWeight:400}),container:(0,n.css)({maxwidth:578})}}},96944:(ee,B,e)=>{"use strict";e.d(B,{gs:()=>Ye,UD:()=>Ge,ee:()=>Se});var t=e(2543),n=e(84743),r=e(13288),o=e(75505),s=e(81160),m=e(59099),a=e(99589),l=e(22592),f=e(17548),h=e(25229),u=e(27164),i=e(1906),x=e(36580),g=e(2863),p=e(68143),c=e(43173),y=e(76658),P=e(88483),d=e(62467),D=e(428),b=e(74848),E=e(96540),v=e(85629),C=e(1667),S=e(32300),O=e(30048),I=e(78246),R=e(33033),T=e(35137),L=e(63527),K=e(24706);const A="{{alertname}}",W="{{instance}}",N="label1,label2",w=(0,E.memo)(function(ye){const{annotation:Oe,onAnnotationChange:we,onChange:Be,onRunQuery:Xe,query:st}=ye;if(!Oe||!we)return(0,b.jsx)("h3",{children:"annotation data load error!"});const lt=_e=>{Be({...st,interval:_e})},Et=_e=>{we({...Oe,titleFormat:_e})},Tt=_e=>{we({...Oe,tagKeys:_e})},Mt=_e=>{we({...Oe,textFormat:_e})},wt=_e=>{we({...Oe,useValueForTime:_e})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(C.D,{children:[(0,b.jsx)(K.$,{...ye,query:st,showExplain:!1,onRunQuery:Xe,onChange:Be}),(0,b.jsx)(S.U,{children:(0,b.jsx)(O.c,{label:"Min step",tooltip:(0,b.jsxs)(b.Fragment,{children:["An additional lower limit for the step parameter of the Prometheus query and for the"," ",(0,b.jsx)("code",{children:"$__interval"})," and ",(0,b.jsx)("code",{children:"$__rate_interval"})," variables."]}),children:(0,b.jsx)(R.D,{type:"text","aria-label":"Set lower limit for the step parameter",placeholder:"auto",minWidth:10,value:st.interval??"",onChange:_e=>lt(_e.currentTarget.value),id:v.Tp.components.DataSource.Prometheus.annotations.minStep})})})]}),(0,b.jsx)(T.$,{v:.5}),(0,b.jsxs)(S.U,{children:[(0,b.jsx)(O.c,{label:"Title",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance.",children:(0,b.jsx)(L.p,{type:"text",placeholder:A,value:Oe.titleFormat??"",onChange:_e=>Et(_e.currentTarget.value),"data-testid":v.Tp.components.DataSource.Prometheus.annotations.title})}),(0,b.jsx)(O.c,{label:"Tags",children:(0,b.jsx)(L.p,{type:"text",placeholder:N,value:Oe.tagKeys??"",onChange:_e=>Tt(_e.currentTarget.value),"data-testid":v.Tp.components.DataSource.Prometheus.annotations.tags})}),(0,b.jsx)(O.c,{label:"Text",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance.",children:(0,b.jsx)(L.p,{type:"text",placeholder:W,value:Oe.textFormat??"",onChange:_e=>Mt(_e.currentTarget.value),"data-testid":v.Tp.components.DataSource.Prometheus.annotations.text})}),(0,b.jsx)(O.c,{label:"Series value as timestamp",tooltip:"The unit of timestamp is milliseconds. If the unit of the series value is seconds, multiply its range vector by 1000.",children:(0,b.jsx)(I.C,{value:Oe.useValueForTime??!1,onChange:_e=>wt(_e.currentTarget.checked),"data-testid":v.Tp.components.DataSource.Prometheus.annotations.seriesValueAsTimestamp})})]})]})}),j="60s",V=xe=>({QueryEditor:w,prepareAnnotation(ye){return ye.target||(ye.target={expr:"",refId:"Anno"}),ye.target={...ye.target,refId:ye.target.refId||ye.refId||"Anno",expr:ye.target.expr||ye.expr||"",interval:ye.target.interval||ye.step||""},delete ye.expr,delete ye.step,ye},processEvents(ye,Oe){if(!Oe.length)return new P.c;const{tagKeys:we="",titleFormat:Be="",textFormat:Xe=""}=ye,st=Oe[0].meta?.executedQueryString||"",lt=/Step:\s*([\d\w]+)/,Et=st.match(lt),Tt=Et?Et[1]:null,Mt=f.intervalToSeconds(Tt||j)*1e3,wt=we.split(","),_e=[];for(const xt of Oe){if(xt.fields.length===0)continue;const At=xt.fields[0],bt=xt.fields[1],Xt=bt?.labels||{},Cn=Object.keys(Xt).filter(nn=>wt.includes(nn)).map(nn=>Xt[nn]),vn=[];let Wn=0;
5bt.values.forEach(nn=>{let Zt,tn;const ft=At.values[Wn];ye.useValueForTime?(Zt=Math.floor(parseFloat(nn)),tn=1):(Zt=Math.floor(parseFloat(ft)),tn=parseFloat(nn)),Wn++,vn.push([Zt,tn])});const qt=vn.filter(nn=>nn[1]>0).map(nn=>nn[0]);let Yt=null;for(const nn of qt){if(Yt&&(Yt.timeEnd??0)+Mt>=nn){Yt.timeEnd=nn;continue}Yt&&_e.push(Yt),Yt={time:nn,timeEnd:nn,annotation:ye,title:(0,D.j)(Be,Xt),tags:Cn,text:(0,D.j)(Xe,Xt)}}Yt&&(Yt.timeEnd=qt[qt.length-1],_e.push(Yt))}return(0,d.of)(_e)}});var U=e(41753),F=e(85187),M=e(13502),H=e(64283),_=e(66758);const Z=/^label_names\(\)\s*$/,ne=/^label_values\((?:(.+),\s*)?(.+)\)\s*$/,te=/^metrics\((.+)\)\s*$/,Y=/^query_result\((.+)\)\s*$/,Q=/^label_names\((.+)\)\s*$/;function J(xe){if(typeof xe!="string")return xe;const ye={refId:"PrometheusDatasource-VariableQuery",qryType:_.B4.LabelNames},Oe=xe.match(Q);if(Oe)return{...ye,qryType:_.B4.LabelNames,match:Oe[1]};const we=xe.match(Z);if(we)return{...ye,qryType:_.B4.LabelNames};const Be=xe.match(/^label_values\(/);if(Be){const lt=xe.match(ne),Et=lt?lt[2]:"",Tt=lt?lt[1]:"";if(Tt){const Mt=(0,H.u)(Tt);return{...ye,qryType:_.B4.LabelValues,label:Et,metric:Mt.query.metric,labelFilters:Mt.query.labels}}else return{...ye,qryType:_.B4.LabelValues,label:Et}}const Xe=xe.match(/^metrics\(/);if(Xe){const lt=xe.match(te),Et=lt?lt[1]:"";return{...ye,qryType:_.B4.MetricNames,metric:Et}}const st=xe.match(/^query_result\(/);if(st){const lt=xe.match(Y),Et=lt?lt[1]:"";return{...ye,qryType:_.B4.VarQueryResult,varQuery:Et}}return!we&&!Be&&!Xe&&!st?{...ye,qryType:_.B4.SeriesQuery,seriesQuery:xe}:ye}function q(xe){switch(xe.qryType){case _.B4.LabelNames:return xe.match?`label_names(${xe.match})`:"label_names()";case _.B4.LabelValues:if(xe.metric||xe.labelFilters&&xe.labelFilters.length!==0){const Oe={metric:xe.metric,labels:xe.labelFilters??[],operations:[]};return`label_values(${M.z.renderQuery(Oe)},${xe.label})`}else return`label_values(${xe.label})`;case _.B4.MetricNames:return`metrics(${xe.metric})`;case _.B4.VarQueryResult:return`query_result(${X(xe.varQuery)})`;
5case _.B4.SeriesQuery:return xe.seriesQuery??"";case _.B4.ClassicQuery:return xe.classicQuery??""}return""}function X(xe){return xe?xe.replace(/[\r\n]+/gm,""):""}var se=e(31200);class oe{constructor(ye,Oe){this.datasource=ye,this.query=Oe,this.datasource=ye,this.query=Oe}process(ye){const Oe=Z,we=Q,Be=ne,Xe=te,st=Y,lt=this.query.match(Oe),Et=this.query.match(we);if(Et){const xt=`{__name__=~".*${Et[1]}.*"}`;return this.datasource.languageProvider.getSeriesLabels(ye,xt,[]).then(At=>At.map(bt=>({text:bt})))}if(lt)return this.datasource.getTagKeys({filters:[],timeRange:ye});const Tt=this.query.match(Be);if(Tt){const xt=Tt[1],At=Tt[2];return ae(xt)?this.labelValuesQuery(At,ye,xt):this.labelValuesQuery(At,ye)}const Mt=this.query.match(Xe);if(Mt)return this.metricNameQuery(Mt[1],ye);const wt=this.query.match(st);return wt?this.queryResultQuery(wt[1],ye):["label_values()","metrics()","query_result()"].includes(this.query)?Promise.resolve([]):this.metricNameAndLabelsQuery(this.query,ye)}labelValuesQuery(ye,Oe,we){const Be=(0,F.mv)(Oe.from,!1),Xe=(0,F.mv)(Oe.to,!0),st={...we&&{"match[]":we},start:Be.toString(),end:Xe.toString()};let lt=ye;if((0,se.Rq)(ye)||(lt=(0,se.$H)(ye)),!we||this.datasource.hasLabelsMatchAPISupport()){const Et=`/api/v1/label/${lt}/values`;return this.datasource.metadataRequest(Et,st).then(Tt=>(0,t.map)(Tt.data.data,Mt=>({text:Mt})))}else return this.datasource.metadataRequest("/api/v1/series",st).then(Tt=>{const Mt=(0,t.map)(Tt.data.data,wt=>wt[ye]||"").filter(wt=>wt!=="");return(0,t.uniq)(Mt).map(wt=>({text:wt,expandable:!0}))})}metricNameQuery(ye,Oe){const we=(0,F.mv)(Oe.from,!1),Be=(0,F.mv)(Oe.to,!0),Xe={start:we.toString(),end:Be.toString()};return this.datasource.metadataRequest("/api/v1/label/__name__/values",Xe).then(lt=>(0,t.chain)(lt.data.data).filter(Et=>new RegExp(ye).test(Et)).map(Et=>({text:Et,expandable:!0})).value())}queryResultQuery(ye,Oe){const we="/api/v1/query",Be={query:ye,time:(0,F.mv)(Oe.to,!0).toString()};return this.datasource.metadataRequest(we,Be).then(Xe=>{switch(Xe.data.data.resultType){case"scalar":case"string":return[{text:Xe.data.data.result[1]||"",expandable:!1}];case"vector":return(0,t.map)(Xe.data.data.result,st=>{let lt=st.metric.__name__||"";return delete st.metric.__name__,lt+="{"+(0,t.map)(st.metric,(Et,Tt)=>Tt+'="'+Et+'"').join(",")+"}",lt+=" "+st.value[1]+" "+st.value[0]*1e3,{text:lt,expandable:!0}});default:throw Error(`Unknown/Unhandled result type: [${Xe.data.data.resultType}]`)}})}metricNameAndLabelsQuery(ye,Oe){const we=(0,F.mv)(Oe.from,!1),Be=(0,F.mv)(Oe.to,!0),Xe={"match[]":ye,start:we.toString(),end:Be.toString()},st="/api/v1/series",lt=this;return this.datasource.metadataRequest(st,Xe).then(Et=>(0,t.map)(Et.data.data,Tt=>({text:lt.datasource.getOriginalMetricName(Tt),expandable:!0})))}}function ae(xe){return xe&&xe.split(" ").join("")!=="{}"}var ie=e(55342),fe=e(62382),pe=e(70210),de=e(27489);function le(xe,ye,Oe){const{app:we,targets:Be}=ye;if(we===i.Jk.Explore)for(const Xe of Be)(0,de.rR)("grafana_prometheus_query_executed",{app:we,grafana_version:c.$.buildInfo.version,has_data:xe.data.some(st=>st.length>0),has_error:xe.error!==void 0,expr:Xe.expr,format:Xe.format,instant:Xe.instant,range:Xe.range,exemplar:Xe.exemplar,hinting:Xe.hinting,interval:Xe.interval,intervalFactor:Xe.intervalFactor,utcOffsetSec:Xe.utcOffsetSec,legend:Xe.legendFormat,valueWithRefId:Xe.valueWithRefId,requestId:ye.requestId,showingGraph:Xe.showingGraph,showingTable:Xe.showingTable,editor_mode:Xe.editorMode,simultaneously_sent_query_count:Be.length,time_range_from:ye?.range?.from?.toISOString(),time_range_to:ye?.range?.to?.toISOString(),time_taken:Date.now()-Oe.getTime()})}var me=e(65474),De=e(48592),Te=e(76459),Ne=e.n(Te),Ce=e(47184),He=e(97095),ke=e(18027),Me=e(18857),$e=e(87105),tt=e(98602);const Ke=[{label:"Label names",value:_.B4.LabelNames},{label:"Label values",value:_.B4.LabelValues},{label:"Metrics",value:_.B4.MetricNames},{label:"Query result",value:_.B4.VarQueryResult},{label:"Series query",value:_.B4.SeriesQuery},{label:"Classic query",value:_.B4.ClassicQuery}],Re="PrometheusVariableQueryEditor-VariableQuery",Ve=({onChange:xe,query:ye,datasource:Oe,range:we})=>{const[Be,Xe]=(0,E.useState)(void 0),[st,lt]=(0,E.useState)(""),[Et,Tt]=(0,E.useState)(""),[Mt,wt]=(0,E.useState)(""),[_e,xt]=(0,E.useState)(""),[At,bt]=(0,E.useState)(""),[Xt,Cn]=(0,E.useState)(""),[vn,Wn]=(0,E.useState)([]),[Dt,qt]=(0,E.useState)([]);function Yt(_t,On){qt([...On,..._t]);const Nn=(0,F.ky)(_t);
5Wn([...On,...Nn])}const[nn,Zt]=(0,E.useState)([]);(0,E.useEffect)(()=>{Oe.languageProvider.start(we)},[]),(0,E.useEffect)(()=>{if(ye)if(ye.qryType===_.B4.ClassicQuery)Xe(ye.qryType),Cn(ye.query??"");else{const _t=Qe(ye);Tt(_t.match??""),Xe(_t.qryType),lt(_t.label??""),wt(_t.metric??""),Zt(_t.labelFilters??[]),xt(_t.varQuery??""),bt(_t.seriesQuery??""),Cn(_t.classicQuery??"")}},[ye]),(0,E.useEffect)(()=>{if(Be!==_.B4.LabelValues)return;const _t=Oe.getVariables().map(Nn=>({label:Nn,value:Nn}));let On=we;if(On||(On=(0,l.E2)()),!Mt)Oe.getTagKeys({timeRange:On,filters:[]}).then(Nn=>{const Fn=Nn.map(({text:na})=>({label:na,value:na}));Yt(Fn,_t)});else{const Nn=[{label:"__name__",op:"=",value:Mt}],Fn=M.z.renderLabels(Nn);Oe.languageProvider.fetchLabelsWithMatch(On,Fn).then(na=>{const yt=Object.keys(na).map(mt=>({label:mt,value:mt}));Yt(yt,_t)})}},[Oe,Be,Mt,we]);const tn=(_t,On)=>{const na={...{qryType:Be,label:st,metric:Mt,match:Et,varQuery:_e,seriesQuery:At,classicQuery:Xt,refId:"PrometheusVariableQueryEditor-VariableQuery"},..._t,...On?{labelFilters:On}:{labelFilters:nn}},aa=q(na);xe({query:aa,qryType:na.qryType,refId:Re})},ft=_t=>{Xe(_t.value),_t.value!==_.B4.SeriesQuery&&tn({qryType:_t.value??0})},Rt=_t=>{const On=_t&&_t.value?_t.value:"";lt(On),Be===_.B4.LabelValues&&On&&tn({label:On})},Bt=_t=>{wt(_t.metric),Zt(_t.labels);const On=_t.metric,Nn=_t.labels??[];Be===_.B4.LabelValues&&st&&(On||Nn)&&tn({qryType:Be,metric:On},Nn)},jt=_t=>{Be===_.B4.LabelNames&&tn({qryType:Be,match:_t})},Nt=_t=>{Be===_.B4.MetricNames&&_t&&tn({metric:_t})},$t=_t=>{xt(_t.currentTarget.value)},an=_t=>{bt(_t.currentTarget.value)},Jt=_t=>{Cn(_t.currentTarget.value)},gn=(0,E.useCallback)(()=>({metric:Mt,labels:nn,operations:[]}),[Mt,nn]),mn=Ne()(_t=>{const On=Dt.filter(Nn=>Nn.value?.includes(_t));return(0,F.ky)(On)},300);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(He.C,{children:(0,b.jsx)(ke.I,{label:"Query type",labelWidth:20,tooltip:(0,b.jsx)("div",{children:"The Prometheus data source plugin provides the following query types for template variables."}),children:(0,b.jsx)(Me.l6,{placeholder:"Select query type","aria-label":"Query type",onChange:ft,value:Be,options:Ke,width:25,"data-testid":v.Tp.components.DataSource.Prometheus.variableQueryEditor.queryType})})}),Be===_.B4.LabelValues&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(He.C,{children:(0,b.jsx)(ke.I,{label:"Label",labelWidth:20,required:!0,"aria-labelledby":"label-select",tooltip:(0,b.jsx)("div",{children:"Returns a list of label values for the label name in all metrics unless the metric is specified."}),children:(0,b.jsx)(Me.DW,{"aria-label":"label-select",onChange:Rt,value:st?(0,Ce.z)(st):null,defaultOptions:vn,width:25,allowCustomValue:!0,isClearable:!0,loadOptions:mn,"data-testid":v.Tp.components.DataSource.Prometheus.variableQueryEditor.labelValues.labelSelect})})}),(0,b.jsx)(tt.I,{query:gn(),datasource:Oe,onChange:Bt,variableEditor:!0,timeRange:we??(0,l.E2)()})]}),Be===_.B4.LabelNames&&(0,b.jsx)(He.C,{children:(0,b.jsx)(ke.I,{label:"Metric regex",labelWidth:20,"aria-labelledby":"Metric regex",tooltip:(0,b.jsx)("div",{children:"Returns a list of label names, optionally filtering by specified metric regex."}),children:(0,b.jsx)(L.p,{type:"text","aria-label":"Metric regex",placeholder:"Metric regex",value:Et,onBlur:_t=>{Tt(_t.currentTarget.value),jt(_t.currentTarget.value)},onChange:_t=>{Tt(_t.currentTarget.value)},width:25,"data-testid":v.Tp.components.DataSource.Prometheus.variableQueryEditor.labelnames.metricRegex})})}),Be===_.B4.MetricNames&&(0,b.jsx)(He.C,{children:(0,b.jsx)(ke.I,{label:"Metric regex",labelWidth:20,"aria-labelledby":"Metric selector",tooltip:(0,b.jsx)("div",{children:"Returns a list of metrics matching the specified metric regex."}),children:(0,b.jsx)(L.p,{type:"text","aria-label":"Metric selector",placeholder:"Metric regex",value:Mt,onChange:_t=>{wt(_t.currentTarget.value)},onBlur:_t=>{wt(_t.currentTarget.value),Nt(_t.currentTarget.value)},width:25,"data-testid":v.Tp.components.DataSource.Prometheus.variableQueryEditor.metricNames.metricRegex})})}),Be===_.B4.VarQueryResult&&(0,b.jsx)(He.C,{children:(0,b.jsx)(ke.I,{label:"Query",labelWidth:20,tooltip:(0,b.jsx)("div",{children:"Returns a list of Prometheus query results for the query. This can include Prometheus functions, i.e. sum(go_goroutines)."}),children:(0,b.jsx)($e.f,{type:"text","aria-label":"Prometheus Query",placeholder:"Prometheus Query",value:_e,onChange:$t,onBlur:()=>
5{Be===_.B4.VarQueryResult&&_e&&tn({qryType:Be})},cols:100,"data-testid":v.Tp.components.DataSource.Prometheus.variableQueryEditor.varQueryResult})})}),Be===_.B4.SeriesQuery&&(0,b.jsx)(He.C,{children:(0,b.jsx)(ke.I,{label:"Series Query",labelWidth:20,tooltip:(0,b.jsx)("div",{children:'Enter a metric with labels, only a metric or only labels, i.e. go_goroutines{instance="localhost:9090"}, go_goroutines, or {instance="localhost:9090"}. Returns a list of time series associated with the entered data.'}),children:(0,b.jsx)(L.p,{type:"text","aria-label":"Series Query",placeholder:"Series Query",value:At,onChange:an,onBlur:()=>{Be===_.B4.SeriesQuery&&At&&tn({qryType:Be})},width:100,"data-testid":v.Tp.components.DataSource.Prometheus.variableQueryEditor.seriesQuery})})}),Be===_.B4.ClassicQuery&&(0,b.jsx)(He.C,{children:(0,b.jsx)(ke.I,{label:"Classic Query",labelWidth:20,tooltip:(0,b.jsx)("div",{children:"The original implemetation of the Prometheus variable query editor. Enter a string with the correct query type and parameters as described in these docs. For example, label_values(label, metric)."}),children:(0,b.jsx)(L.p,{type:"text","aria-label":"Classic Query",placeholder:"Classic Query",value:Xt,onChange:Jt,onBlur:()=>{Be===_.B4.ClassicQuery&&Xt&&tn({qryType:Be})},width:100,"data-testid":v.Tp.components.DataSource.Prometheus.variableQueryEditor.classicQuery})})})]})};function Qe(xe){return typeof xe=="string"?J(xe):xe.query?J(xe.query):xe}class je extends De.f5{constructor(ye,Oe=(0,g.w)()){super(),this.datasource=ye,this.templateSrv=Oe,this.editor=Ve}query(ye){let Oe;if(typeof ye.targets[0]=="string"?Oe=ye.targets[0]:Oe=ye.targets[0].query,!Oe)return(0,d.of)({data:[]});const we={...ye.scopedVars,__interval:{text:this.datasource.interval,value:this.datasource.interval},__interval_ms:{text:f.intervalToMs(this.datasource.interval),value:f.intervalToMs(this.datasource.interval)},...this.datasource.getRangeScopedVars(ye.range)},Be=this.templateSrv.replace(Oe,we,this.datasource.interpolateQueryExpr),Xe=new oe(this.datasource,Be);return(0,me.H)(Xe.process(ye.range)).pipe((0,s.T)(lt=>({data:lt})))}}const ze=["api/v1/query","api/v1/query_range","api/v1/series","api/v1/labels","suggestions"],Ye="-Instant";class Ge extends x.iy{constructor(ye,Oe=(0,g.w)(),we){super(ye),this.templateSrv=Oe,this.init=async()=>{this.disableRecordingRules||this.loadRules(),this.exemplarsAvailable=await this.areExemplarsAvailable()},this.type="prometheus",this.id=ye.id,this.url=ye.url,this.access=ye.access,this.basicAuth=ye.basicAuth,this.withCredentials=!!ye.withCredentials,this.interval=ye.jsonData.timeInterval||"15s",this.httpMethod=ye.jsonData.httpMethod||"GET",this.exemplarTraceIdDestinations=ye.jsonData.exemplarTraceIdDestinations,this.hasIncrementalQuery=ye.jsonData.incrementalQuerying??!1,this.ruleMappings={},this.languageProvider=we??new U.Ay(this),this.lookupsDisabled=ye.jsonData.disableMetricsLookup??!1,this.customQueryParameters=new URLSearchParams(ye.jsonData.customQueryParameters),this.datasourceConfigurationPrometheusFlavor=ye.jsonData.prometheusType,this.datasourceConfigurationPrometheusVersion=ye.jsonData.prometheusVersion,this.seriesEndpoint=ye.jsonData.seriesEndpoint??!1,this.defaultEditor=ye.jsonData.defaultEditor,this.disableRecordingRules=ye.jsonData.disableRecordingRules??!1,this.variables=new je(this,this.templateSrv),this.exemplarsAvailable=!0,this.cacheLevel=ye.jsonData.cacheLevel??_.fD.Low,this.metricNamesAutocompleteSuggestionLimit=ye.jsonData.codeModeMetricNamesSuggestionLimit??U.OP,this.cache=new fe.$i({getTargetSignature:this.getPrometheusTargetSignature.bind(this),overlapString:ye.jsonData.incrementalQueryOverlapWindow??fe.Dr,applyInterpolation:this.interpolateString.bind(this)}),this.annotations=V(this)}getQueryDisplayText(ye){return ye.expr}getPrometheusTargetSignature(ye,Oe){return`${this.interpolateString(Oe.expr)}|${Oe.interval??ye.interval}|${JSON.stringify(ye.rangeRaw??"")}|${Oe.exemplar}`}hasLabelsMatchAPISupport(){return this.seriesEndpoint?!1:this._isDatasourceVersionGreaterOrEqualTo("2.24.0",_.N1.Prometheus)||this._isDatasourceVersionGreaterOrEqualTo("2.0.0",_.N1.Mimir)||this._isDatasourceVersionGreaterOrEqualTo("1.11.0",_.N1.Cortex)||this._isDatasourceVersionGreaterOrEqualTo("0.18.0",_.N1.Thanos)}_isDatasourceVersionGreaterOrEqualTo(ye,Oe){return!this.datasourceConfigurationPrometheusVersion||!this.datasourceConfigurationPrometheusFlavor?!0:Oe!==this.datasourceConfigurationPrometheusFlavor?!1:(0,a.gte)(this.datasourceConfigurationPrometheusVersion,ye)}_addTracingHeaders(ye,Oe){ye.headers={},this.access==="proxy"&&(ye.headers["X-Dashboard-UID"]=Oe.dashboardUID,ye.headers["X-Panel-Id"]=Oe.panelId)}directAccessError(){return(0,r.$)(()=>new Error("Browser access mode in the Prometheus datasource is no longer available. Switch to server access mode."))}_request(ye,Oe,we={}){if(this.access==="direct")return this.directAccessError();Oe=Oe||{};for(const[st,lt]of this.customQueryParameters)Oe[st]==null&&(Oe[st]=lt);let Be=this.url+ye;ye.startsWith(`/api/datasources/uid/${this.uid}`)&&(Be=ye);const Xe=(0,t.defaults)(we,{url:Be,method:this.httpMethod,headers:{}});return Xe.method==="GET"?Oe&&Object.keys(Oe).length&&(Xe.url=Xe.url+(Xe.url.search(/\?/)>=0?"&":"?")+Object.entries(Oe).map(([st,lt])=>`${encodeURIComponent(st)}=${encodeURIComponent(lt)}`).join("&")):(Xe.headers["Content-Type"]||(Xe.headers["Content-Type"]="application/x-www-form-urlencoded"),Xe.data=Oe),(this.basicAuth||this.withCredentials)&&(Xe.withCredentials=!0),this.basicAuth&&(Xe.headers.Authorization=this.basicAuth),(0,p.AI)().fetch(Xe)}async importFromAbstractQueries(ye){return ye.map(Oe=>this.languageProvider.importFromAbstractQuery(Oe))}async exportToAbstractQueries(ye){return ye.map(Oe=>
5this.languageProvider.exportToAbstractQuery(Oe))}async metadataRequest(ye,Oe={},we){if(ze.some(Be=>ye.includes(Be)))try{return await(0,o.s)(this._request(`/api/datasources/uid/${this.uid}/resources${ye}`,Oe,{method:this.httpMethod,hideFromInspector:!0,showErrorAlert:!1,...we}))}catch(Be){if(this.httpMethod==="POST"&&(0,p.NF)(Be)&&(Be.status===405||Be.status===400))console.warn("Couldn't use configured POST HTTP method for this request. Trying to use GET method instead.");else throw Be}return await(0,o.s)(this._request(`/api/datasources/uid/${this.uid}/resources${ye}`,Oe,{method:"GET",hideFromInspector:!0,...we}))}interpolateQueryExpr(ye=[],Oe){if(!Oe.multi&&!Oe.includeAll)return Se(ye);if(typeof ye=="string")return Ee(ye);const we=ye.map(Be=>Ee(Be));return we.length===1?we[0]:"("+we.join("|")+")"}targetContainsTemplate(ye){return this.templateSrv.containsTemplate(ye.expr)}shouldRunExemplarQuery(ye,Oe){if(ye.exemplar){const we=this.languageProvider.histogramMetrics.find(st=>ye.expr.includes(st)),Be=Oe.targets.findIndex(st=>st.refId===ye.refId),Xe=Oe.targets.slice(0,Be).filter(st=>!st.hide);return!!(!we||we&&!Xe.some(st=>st.expr.includes(we)))}return!1}processTargetV2(ye,Oe){let we=Oe.range.to.utcOffset();Oe.timezone==="browser"?we=this.isUsingRelativeTimeRange(Oe.range)?we:0:we=(0,n.tz)(Oe.timezone).utcOffset();const Be=[],Xe={...ye,exemplar:this.shouldRunExemplarQuery(ye,Oe),requestId:Oe.panelId+ye.refId,utcOffsetSec:we*60};return c.$.featureToggles.promQLScope&&(Xe.scopes=(Oe.scopes??[]).map(st=>({name:st.metadata.name,...st.spec}))),c.$.featureToggles.groupByVariable&&(Xe.groupByKeys=Oe.groupByKeys),ye.instant&&ye.range?Be.push({...Xe,refId:Xe.refId,instant:!1},{...Xe,refId:Xe.refId+Ye,range:!1,exemplar:!1}):Be.push(Xe),Be}query(ye){if(this.access==="direct")return this.directAccessError();let Oe,we;const Be=ye.targets.some(lt=>lt.instant);this.hasIncrementalQuery&&!Be?(we=this.cache.requestInfo(ye),Oe=we.requests[0]):Oe=ye;const Xe=Oe.targets.map(lt=>this.processTargetV2(lt,Oe)),st=new Date;return super.query({...Oe,targets:Xe.flat()}).pipe((0,s.T)(lt=>{const Et={...lt,data:this.cache.procFrames(ye,we,lt.data)};return(0,pe.J3)(Et,ye,{exemplarTraceIdDestinations:this.exemplarTraceIdDestinations})}),(0,m.M)(lt=>{le(lt,ye,st)}))}metricFindQuery(ye,Oe){if(!ye)return Promise.resolve([]);const we=Oe?.range??(0,l.E2)(),Be={...this.getIntervalVars(),...this.getRangeScopedVars(we)},Xe=this.templateSrv.replace(ye,Be,this.interpolateQueryExpr);return new oe(this,Xe).process(we)}getIntervalVars(){return{__interval:{text:this.interval,value:this.interval},__interval_ms:{text:f.intervalToMs(this.interval),value:f.intervalToMs(this.interval)}}}getRangeScopedVars(ye){const Oe=ye.to.diff(ye.from),we=Math.round(Oe/1e3);return{__range_ms:{text:Oe,value:Oe},__range_s:{text:we,value:we},__range:{text:we+"s",value:we+"s"}}}async getTagKeys(ye){if(ye.timeRange||(ye.timeRange=(0,l.E2)()),c.$.featureToggles.promQLScope&&(ye?.scopes?.length??0)>0)return(await this.languageProvider.fetchSuggestions(ye.timeRange,ye.queries,ye.scopes,ye.filters)).filter(st=>!!st&&!ye.filters.find(lt=>lt.key===st)).map(st=>({value:st,text:st}));if(!ye||ye.filters.length===0)return await this.languageProvider.fetchLabels(ye.timeRange,ye.queries),this.languageProvider.getLabelKeys().map(Xe=>({value:Xe,text:Xe}));const Oe=ye.filters.map(Xe=>({label:Xe.key,value:Xe.value,op:Xe.operator})),we=M.z.renderLabels(Oe);let Be=await this.languageProvider.fetchLabelsWithMatch(ye.timeRange,we);return Object.keys(Be).filter(Xe=>!ye.filters.find(st=>st.key===Xe)).map(Xe=>({value:Xe,text:Xe}))}async getTagValues(ye){ye.timeRange||(ye.timeRange=(0,l.E2)());const Oe=`[${this.uid}][${ye.key}]`;if(c.$.featureToggles.promQLScope&&(ye?.scopes?.length??0)>0)return(await this.languageProvider.fetchSuggestions(ye.timeRange,ye.queries,ye.scopes,ye.filters,ye.key,void 0,Oe)).map(lt=>({value:lt,text:lt}));const we=ye.filters.map(lt=>({label:lt.key,value:lt.value,op:lt.operator})),Be=M.z.renderLabels(we);if(this.hasLabelsMatchAPISupport())return(await this.languageProvider.fetchSeriesValuesWithMatch(ye.timeRange,ye.key,Be,Oe)).map(lt=>({value:lt,text:lt}));const Xe=this.getTimeRangeParams(ye.timeRange??(0,l.E2)());return(await this.metadataRequest(`/api/v1/label/${ye.key}/values`,Xe))?.data?.data?.map(lt=>({text:lt}))??[]}interpolateVariablesInQueries(ye,Oe,we){let Be=ye;return ye&&ye.length&&(Be=ye.map(Xe=>{const st=this.templateSrv.replace(Xe.expr,Oe,this.interpolateExploreMetrics(Xe.fromExploreMetrics)),lt=c.$.featureToggles.promQLScope?st:this.templateSrv.replace(this.enhanceExprWithAdHocFilters(we,st),Oe,this.interpolateQueryExpr);return{...Xe,...c.$.featureToggles.promQLScope?{adhocFilters:this.generateScopeFilters(we)}:{},datasource:this.getRef(),expr:lt,interval:this.templateSrv.replace(Xe.interval,Oe)}})),Be}getQueryHints(ye,Oe){return(0,ie.DT)(ye.expr??"",Oe,this)}async loadRules(){try{const Oe=(await this.metadataRequest("/api/v1/rules",{},{showErrorAlert:!1})).data?.data?.groups;Oe&&(this.ruleMappings=Pe(Oe))}catch(ye){console.log("Rules API is experimental. Ignore next error."),console.error(ye)}}async areExemplarsAvailable(){try{return(await this.metadataRequest("/api/v1/query_exemplars",{query:"test",start:(0,h.KQ)().subtract(30,"minutes").valueOf().toString(),end:(0,h.KQ)().valueOf().toString()},{showErrorAlert:!1})).data.status==="success"}catch{return!1}}modifyQuery(ye,Oe){let we=ye.expr??"";switch(Oe.type){case"ADD_FILTER":{const{key:Be,value:Xe}=Oe.options??{};Be&&Xe&&(we=(0,y.t)(we,Be,Xe));break}case"ADD_FILTER_OUT":{const{key:Be,value:Xe}=Oe.options??{};Be&&Xe&&(we=(0,y.t)(we,Be,Xe,"!="));break}case"ADD_HISTOGRAM_QUANTILE":{we=`histogram_quantile(0.95, sum(rate(${we}[$__rate_interval])) by (le))`;break}case"ADD_HISTOGRAM_AVG":{we=`histogram_avg(rate(${we}[$__rate_interval]))`;break}case"ADD_HISTOGRAM_FRACTION":{we=`histogram_fraction(0,0.2,rate(${we}[$__rate_interval]))`;break}case"ADD_HISTOGRAM_COUNT":{we=`histogram_count(rate(${we}[$__rate_interval]))`;break}case"ADD_HISTOGRAM_SUM":{we=`histogram_sum(rate(${we}[$__rate_interval]))`;break}case"ADD_HISTOGRAM_STDDEV":{we=`histogram_stddev(rate(${we}[$__rate_interval]))`;break}case"ADD_HISTOGRAM_STDVAR":{we=`histogram_stdvar(rate(${we}[$__rate_interval]))`;break}case"ADD_RATE":{we=`rate(${we}[$__rate_interval])`;break}case"ADD_SUM":{we=`sum(${we.trim()}) by ($1)`;break}case"EXPAND_RULES":{Oe.options&&(we=(0,F.P_)(we,Oe.options));break}default:break}return{...ye,expr:we}}getAdjustedInterval(ye){return(0,F.Xd)(this.cacheLevel,ye)}getTimeRangeParams(ye){return{start:(0,F.mv)(ye.from,!1).toString(),end:(0,F.mv)(ye.to,!0).toString()}}getOriginalMetricName(ye){return(0,pe.hF)(ye)}generateScopeFilters(ye){return ye?ye.map(Oe=>({key:Oe.key,operator:u.n9[Oe.operator],value:this.templateSrv.replace(Oe.value,{},this.interpolateQueryExpr),values:Oe.values?.map(we=>this.templateSrv.replace(we,{},this.interpolateQueryExpr))})):[]}enhanceExprWithAdHocFilters(ye,Oe){return!ye||ye.length===0?Oe:ye.reduce((Be,Xe)=>{const{key:st,operator:lt}=Xe;let{value:Et}=Xe;return(lt==="=~"||lt==="!~")&&(Et=Se(Et)),(0,y.t)(Be,st,Et,lt)},Oe)}filterQuery(ye){return!(ye.hide||!ye.expr)}applyTemplateVariables(ye,Oe,we){const Be={...Oe};Be.__interval={value:"$__interval"},Be.__interval_ms={value:"$__interval_ms"};const Xe=this.templateSrv.replace(ye.expr,Be,this.interpolateExploreMetrics(ye.fromExploreMetrics)),st=c.$.featureToggles.promQLScope?Xe:this.templateSrv.replace(this.enhanceExprWithAdHocFilters(we,Xe),Be,this.interpolateQueryExpr);return{...ye,...c.$.featureToggles.promQLScope?{adhocFilters:this.generateScopeFilters(we)}:{},expr:st,interval:this.templateSrv.replace(ye.interval,Be),legendFormat:this.templateSrv.replace(ye.legendFormat,Be)}}getVariables(){return this.templateSrv.getVariables().map(ye=>`$${ye.name}`)}interpolateString(ye,Oe){return this.templateSrv.replace(ye,Oe,this.interpolateQueryExpr)}interpolateExploreMetrics(ye){return(Oe=[],we)=>{if(typeof Oe=="string"&&ye){if(we.name==="filters")return(0,se.p0)(Oe);if(we.name==="groupby")return(0,se.Nc)(Oe)}return this.interpolateQueryExpr(Oe,we)}}isUsingRelativeTimeRange(ye){return typeof ye.raw.from!="string"||typeof ye.raw.to!="string"?!1:ye.raw.from.includes("now")||ye.raw.to.includes("now")}getDebounceTimeInMilliseconds(){switch(this.cacheLevel){case _.fD.Medium:return 600;case _.fD.High:return 1200;default:return 350}}getDaysToCacheMetadata(){switch(this.cacheLevel){case _.fD.Medium:return 7;case _.fD.High:return 30;default:return 1}}getCacheDurationInMinutes(){return(0,F.u3)(this.cacheLevel)}getDefaultQuery(ye){const Oe={refId:"A",expr:"",range:!0,instant:!1};
5return ye===i.Jk.UnifiedAlerting?{...Oe,instant:!0,range:!1}:ye===i.Jk.Explore?{...Oe,instant:!0,range:!0}:Oe}}function ce(xe,ye,Oe,we){const Be=Math.floor((ye+we)/Oe)*Oe-we,Xe=Math.floor((xe+we)/Oe)*Oe-we;return{end:Be,start:Xe}}function Pe(xe){return xe.reduce((ye,Oe)=>Oe.rules.filter(we=>we.type==="recording").reduce((we,Be)=>{const Xe=we[Be.name]??[];return Xe.push({query:Be.query,labels:Be.labels}),we[Be.name]=Xe,we},ye),{})}function Se(xe){return typeof xe!="string"?xe:c.$.featureToggles.prometheusSpecialCharsInLabelValues?/^\w+(=|!=|=~|!~)".*"$/.test(xe)?xe:xe.replace(/\\/g,"\\\\").replace(/"/g,'\\"'):xe.replace(/\\/g,"\\\\").replace(/'/g,"\\\\'")}function Ee(xe){return typeof xe!="string"?xe:c.$.featureToggles.prometheusSpecialCharsInLabelValues?xe.replace(/\\/g,"\\\\\\\\").replace(/"/g,'\\\\\\"').replace(/[$^*{}\[\]\'+?.()|]/g,"\\\\$&"):xe.replace(/\\/g,"\\\\\\\\").replace(/[$^*{}\[\]+?.()|]/g,"\\\\$&")}},41753:(ee,B,e)=>{"use strict";e.d(B,{AU:()=>b,Ay:()=>C,OP:()=>y,pK:()=>D,xB:()=>d});var t=e(2543),n=e.n(t),r=e(28848),o=e.n(r),s=e(94644),m=e(22592),a=e(27164),l=e(46933),f=e(9806),h=e(85187),u=e(35748),i=e(64283),x=e(66758),g=e(31200);const p=["job","instance"],c="{}",y=1e4,P=R=>({headers:{"X-Grafana-Cache":`private, max-age=${R}`}});function d(R,T){if(!T[R])return;const{type:L,help:K}=T[R];return`${L.toUpperCase()}: ${K}`}function D(R,T){if(T[R])return T[R].help}function b(R,T){if(T[R])return T[R].type}const E=/(="|!="|=~"|!~"|\{|\[|\(|\+|-|\/|\*|%|\^|\band\b|\bor\b|\bunless\b|==|>=|!=|<=|>|<|=|~|,)/,v=86400;class C extends s.Is{constructor(T,L){super(),this.labelKeys=[],this.request=async(K,A,W={},N)=>{try{return(await this.datasource.metadataRequest(K,W,N)).data.data}catch(w){O(w)||console.error(w)}return A},this.start=async(K=(0,m.E2)())=>this.datasource.lookupsDisabled?[]:(this.metrics=await this.fetchLabelValues(K,"__name__")||[],this.histogramMetrics=(0,h.Rg)(this.metrics).sort(),Promise.all([this.loadMetricsMetadata(),this.fetchLabels(K)])),this.fetchLabelValues=async(K,A)=>{const W=this.datasource.getAdjustedInterval(K),N=this.datasource.interpolateString(A),j=`/api/v1/label/${(0,g.$H)(I(N))}/values`;return await this.request(j,[],W,this.getDefaultCacheHeaders())??[]},this.fetchLabels=async(K,A)=>{let W="/api/v1/labels";const N=this.datasource.getAdjustedInterval(K);this.labelFetchTs=Date.now().valueOf();const w=new URLSearchParams({...N});A?.forEach(V=>{const U=(0,i.u)(V.expr);if(U.query.metric!==""){const F=!(0,g.Rq)(U.query.metric);w.append("match[]",F?`{"${U.query.metric}"}`:U.query.metric),U.query.binaryQueries&&U.query.binaryQueries.forEach(M=>{w.append("match[]",F?`{"${M.query.metric}"}`:M.query.metric)})}}),this.datasource.httpMethod==="GET"&&(W+=`?${w.toString()}`);const j=await this.request(W,[],w,this.getDefaultCacheHeaders());return Array.isArray(j)?(this.labelKeys=j.slice().sort(),[...this.labelKeys]):[]},this.getSeriesValues=async(K,A,W)=>this.datasource.hasLabelsMatchAPISupport()?await this.fetchSeriesValuesWithMatch(K,A,W):(await this.get
5Series(K,W))[I(A)]??[],this.fetchSeriesValuesWithMatch=async(K,A,W,N)=>{const w=A?this.datasource.interpolateString(A):null,j=W?this.datasource.interpolateString(W):null,U={...this.datasource.getAdjustedInterval(K),...j&&{"match[]":j}};let F={...this.getDefaultCacheHeaders(),...N&&{requestId:N}};Object.keys(F).length||(F=void 0);const M=(0,g.$H)(I(w??""));return await this.request(`/api/v1/label/${M}/values`,[],U,F)??[]},this.getSeriesLabels=async(K,A,W)=>{let N,w;this.datasource.hasLabelsMatchAPISupport()?(W.push({name:"__name__",value:"",op:"!="}),w=await this.fetchSeriesLabelsMatch(K,A),N=Object.keys(w)):(w=await this.getSeries(K,A),N=Object.keys(w));const j=new Set(W.map(V=>V.name));return N.filter(V=>!j.has(V))},this.fetchLabelsWithMatch=async(K,A,W)=>this.datasource.hasLabelsMatchAPISupport()?this.fetchSeriesLabelsMatch(K,A,W):this.fetchSeriesLabels(K,A,W,f.bS),this.fetchSeriesLabels=async(K,A,W,N)=>{const w=this.datasource.interpolateString(A);let V={...this.datasource.getAdjustedInterval(K),"match[]":w};N!=="none"&&(V={...V,limit:N??f._N});const F=await this.request("/api/v1/series",[],V,this.getDefaultCacheHeaders()),{values:M}=(0,h.P7)(F,W);return M},this.fetchSeriesLabelsMatch=async(K,A,W)=>{const N=this.datasource.interpolateString(A),j={...this.datasource.getAdjustedInterval(K),"match[]":N};return(await this.request("/api/v1/labels",[],j,this.getDefaultCacheHeaders())).reduce((F,M)=>({...F,[M]:""}),{})},this.fetchSeries=async(K,A)=>{const W="/api/v1/series",w={...this.datasource.getTimeRangeParams(K),"match[]":A};return await this.request(W,{},w,this.getDefaultCacheHeaders())},this.fetchDefaultSeries=(0,t.once)(async K=>{const A=await Promise.all(p.map(W=>this.fetchLabelValues(K,W)));return p.reduce((W,N,w)=>({...W,[N]:A[w]}),{})}),this.fetchSuggestions=async(K,A,W,N,w,j,V)=>{K||(K=(0,m.E2)());const U="/suggestions",F=this.datasource.getAdjustedInterval(K);return await this.request(U,[],{labelName:w,queries:A?.map(H=>this.datasource.interpolateString(H.expr,{...this.datasource.getIntervalVars(),...this.datasource.getRangeScopedVars(K)})),scopes:W?.reduce((H,_)=>(H.push(..._.spec.filters),H),[]),adhocFilters:N?.map(H=>({key:H.key,operator:a.n9[H.operator],value:H.value,values:H.values})),limit:j,...F},{...V&&{requestId:V},headers:{...this.getDefaultCacheHeaders()?.headers,"Content-Type":"application/json"},method:"POST"})??[]},this.datasource=T,this.histogramMetrics=[],this.metrics=[],Object.assign(this,L)}getDefaultCacheHeaders(){if(this.datasource.cacheLevel!==x.fD.None)return P(this.datasource.getCacheDurationInMinutes()*60)}cleanText(T){return T.split(E).pop().trimStart().replace(/"$/,"").replace(/^"/,"")}get syntax(){return u.Ay}async loadMetricsMetadata(){const T=P(this.datasource.getDaysToCacheMetadata()*v);this.metricsMetadata=(0,h.DX)(await this.request("/api/v1/metadata",{},{},{showErrorAlert:!1,...T}))}getLabelKeys(){return this.labelKeys}importFromAbstractQuery(T){return(0,h.pt)(T)}exportToAbstractQuery(T){const L=T.expr;if(!L||L.length===0)return{refId:T.refId,labelMatchers:[]};const K=o().tokenize(L,u.Ay),A=(0,h.VH)(K),W=S(L,K);return W&&W.length>0&&A.push({name:"__name__",operator:l.D_.Equal,value:W}),{refId:T.refId,labelMatchers:A}}async getSeries(T,L,K){if(this.datasource.lookupsDisabled)return{};try{return L===c?await this.fetchDefaultSeries(T):await this.fetchSeriesLabels(T,L,K,f.bS)}catch(A){return console.error(A),{}}}async getLabelValues(T,L){return await this.fetchLabelValues(T,L)}}function S(R,T){let L="";for(const K of T)if(typeof K=="string"){L=K;break}return L}function O(R){return typeof R=="object"&&R!==null&&"cancelled"in R&&R.cancelled===!0}function I(R){return R.match(/^"(.*)"$/)?.[1]??R}},85187:(ee,B,e)=>{"use strict";e.d(B,{Cs:()=>R,DX:()=>d,P7:()=>x,P_:()=>y,Qn:()=>I,Rg:()=>i,VH:()=>N,Xd:()=>w,eN:()=>D,ky:()=>U,mv:()=>V,pt:()=>A,u3:()=>j});var t=e(2543),n=e.n(t),r=e(28848),o=e.n(r),s=e(46933),m=e(74261),a=e(33239),l=e(76658),f=e(41753),h=e(3430),u=e(66758);const i=F=>{const M=new Set,H=new RegExp("_bucket($|:)");for(let _=0;_<F.length;_++){const Z=F[_];H.test(Z)&&M.add(Z)}return[...M]};function x(F,M=!1){const H={};F.forEach(Z=>{const{__name__:ne,...te}=Z;M&&(H.__name__=H.__name__||new Set,H.__name__.has(ne)||H.__name__.add(ne)),Object.keys(te).forEach(Y=>{H[Y]||(H[Y]=new Set),H[Y].has(te[Y])||H[Y].add(te[Y])})});const _={};
5return v(Object.keys(H)).forEach(Z=>{_[Z]=v(Array.from(H[Z]))}),{values:_,keys:Object.keys(_)}}const g=/\{[^}]*?(\}|$)/,p=/\b(\w+)(!?=~?)("[^"\n]*?")(,)?(\s*)?/g;function c(F,M=1){if(!F.match(g)){if(F.match(/^[A-Za-z:][\w:]*$/))return{selector:`{__name__="${F}"}`,labelKeys:["__name__"]};throw new Error("Query must contain a selector: "+F)}const H=F.slice(0,M),_=H.lastIndexOf("{"),Z=H.lastIndexOf("}");if(_===-1)throw new Error("Not inside selector, missing open brace: "+H);if(Z>-1&&Z>_)throw new Error("Not inside selector, previous selector already closed: "+H);const ne=F.slice(M),Y=ne.indexOf("}")+M,Q=ne.indexOf("{"),J=Q+M;if(Y===-1)throw new Error("Not inside selector, missing closing brace in suffix: "+ne);if(Q>-1&&J<Y)throw new Error("Not inside selector, next selector opens before this one closed: "+ne);const q=F.slice(_,Y),X={};q.replace(p,(pe,de,le,me)=>{const De=F.indexOf(pe),Te=De+de.length+le.length+1,Ne=De+de.length+le.length+me.length-1;return(M<Te||M>Ne)&&(X[de]={value:me,operator:le}),""});const oe=F.slice(0,_).match(/[A-Za-z:][\w:]*$/);oe&&(X.__name__={value:`"${oe[0]}"`,operator:"="});const ae=Object.keys(X).sort(),fe=["{",ae.map(pe=>`${pe}${X[pe].operator}${X[pe].value}`).join(","),"}"].join("");return{labelKeys:ae,selector:fe}}function y(F,M){const H=te=>new RegExp(`(\\s|\\(|^)(${te})(\\s|$|\\(|\\[|\\{)`,"ig"),_=Object.keys(M).reduce((te,Y)=>{let Q=[],J=[],q=[];return te.filter(Boolean).forEach((X,se)=>{X.match(H(Y))&&(Q=X.split(Y),Q.length===2?(q.push(se),J.push(...[Q[0],Y,Q[1]].filter(Boolean))):Q.length>2&&(q.push(se),Q=Q.map(ae=>ae===""?Y:ae),J.push(...Q)))}),q.forEach(X=>te[X]=""),te=te.filter(Boolean),te.push(...J),te},[F]);let Z=!1;return _.map((te,Y)=>{if(Z)return Z=!1,"";if(M[te]){const{expandedQuery:Q,identifierValue:J,identifier:q}=M[te];if(Y+1!==_.length&&_[Y+1].match(p)){Z=!0;const X=new RegExp(`(,)?(\\s)?(${q}=\\"${J}\\")(,)?(\\s)?`,"g"),se=_[Y+1].replace(X,""),oe=/(\)\{|\}\{|\]\{)/;return P(Q+se,oe)}else return Q}return te}).filter(Boolean).join("")}function P(F,M){const H=F.match(M);if(!H)return F;const _=H.index??0,Z=F.slice(0,_+1),ne=F.slice(_+1),te=[];ne.replace(p,(q,X,se,oe,ae,ie)=>(te.push({key:X,operator:se,value:oe,comma:ae,space:ie}),""));let Y=Z;te.filter(Boolean).forEach(q=>{const X=q.value.slice(1,-1);Y=(0,l.t)(Y,q.key,X,q.operator)});let Q=te.reduce((q,X)=>(q+=`${X.key}${X.operator}${X.value}${X.comma??""}${X.space??""}`,q),"");Q="{"+Q+"}";const J=ne.replace(Q,"");return Y+J}function d(F){if(!F)return F;const M={},H={};for(const Z in F){const ne=F[Z][0];M[Z]=ne,ne.type==="histogram"&&(H[`${Z}_bucket`]={type:"counter",help:`Cumulative counters for the observation buckets (${ne.help})`},H[`${Z}_count`]={type:"counter",help:`Count of events that have been observed for the histogram metric (${ne.help})`},H[`${Z}_sum`]={type:"counter",help:`Total sum of all observed values for the histogram metric (${ne.help})`}),ne.type==="summary"&&(H[`${Z}_count`]={type:"counter",help:`Count of events that have been observed for the base metric (${ne.help})`},H[`${Z}_sum`]={type:"counter",help:`Total sum of all observed values for the base metric (${ne.help})`})}const _={};return _.ALERTS={type:"gauge",help:"Time series showing pending and firing alerts. The sample value is set to 1 as long as the alert is in the indicated active (pending or firing) state."},{...M,...H,..._}}function D(F){return b(F/1e3)}function b(F){return Math.floor(F/60)}function E(F,M=1){return Math.ceil(F/60)-Math.ceil(F/60)%M}function v(F){return F.slice(0,f.OP)}function C(F){return F&&F.length>=SUGGESTIONS_LIMIT?`, limited to the first ${SUGGESTIONS_LIMIT} received items`:""}const S=/[*+?()|\\.\[\]{}^$]/g;function O(F){return F.replace(S,"\\$&")}function I(F){return F.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function R(F){return I(O(F))}const T={"=":s.D_.Equal,"!=":s.D_.NotEqual,"=~":s.D_.EqualRegEx,"!~":s.D_.NotEqualRegEx},L=(0,t.invert)(T);function K(F){const M=F.labelMatchers.map(H=>{const _=L[H.operator];return _?`${H.name}${_}"${H.value}"`:""}).filter(H=>H!=="").join(", ");return M?`{${M}}`:""}function A(F){return{refId:F.refId,expr:K(F),range:!0}}function W(F){return typeof F.content=="string"?F.content:""}function N(F){const M=[];for(const H of F)if(H instanceof r.Token&&H.type==="context-labels"){let _="",Z="",ne="";const te=Array.isArray(H.content)?H.content:[H.content];for(let Y of te)if(typeof Y=="string"){let Q;Q=Y,(Q==="="||Q==="!="||Q==="=~"||Q==="!~")&&(ne=Q)}else if(Y instanceof r.Token)switch(Y.type){case"label-key":_=W(Y);break;case"label-value":Z=W(Y),Z=Z.substring(1,Z.length-1);const Q=T[ne];Q&&M.push({name:_,operator:Q,value:Z});break}}return M}function w(F,M){if(F===u.fD.None)return{start:V(M.from,!1).toString(),end:V(M.to,!0).toString()};const H=V(M.from,!1),_=(0,m.rs)(H,j(F)*60),Z=V(M.to,!0),ne=E(Z,j(F))*60;if(_===ne){const Q=ne+j(F)*60;return{start:_.toString(),end:Q.toString()}}const te=_.toString(),Y=ne.toString();return{start:te,end:Y}}function j(F){switch(F){case u.fD.Medium:return 10;case u.fD.High:return 60;default:return 1}}function V(F,M){return typeof F=="string"&&(F=a.parse(F,M)),Math.ceil(F.valueOf()/1e3)}function U(F,M){return M===void 0&&(M=h.o6),F.length=Math.min(F.length,M),F}},35748:(ee,B,e)=>{"use strict";e.d(B,{AW:()=>m,Ay:()=>f,n6:()=>l});const t=[{label:"$__interval",sortValue:"$__interval"},{label:"$__rate_interval",sortValue:"$__rate_interval"},{label:"$__range",sortValue:"$__range"},{label:"1m",sortValue:"00:01:00"},{label:"5m",sortValue:"00:05:00"},{label:"10m",sortValue:"00:10:00"},{label:"30m",sortValue:"00:30:00"},{label:"1h",sortValue:"01:00:00"},{label:"1d",sortValue:"24:00:00"}],n=["by","group_left","group_right","ignoring","on","offset","without"],r=null,o=[{label:"acos",insertText:"acos",detail
5:"acos(v instant-vector)",documentation:"calculates the arccosine of all elements in v"},{label:"acosh",insertText:"acosh",detail:"acosh(v instant-vector)",documentation:"calculates the inverse hyperbolic cosine of all elements in v"},{label:"asin",insertText:"asin",detail:"asin(v instant-vector)",documentation:"calculates the arcsine of all elements in v"},{label:"asinh",insertText:"asinh",detail:"asinh(v instant-vector)",documentation:"calculates the inverse hyperbolic sine of all elements in v"},{label:"atan",insertText:"atan",detail:"atan(v instant-vector)",documentation:"calculates the arctangent of all elements in v"},{label:"atanh",insertText:"atanh",detail:"atanh(v instant-vector)",documentation:"calculates the inverse hyperbolic tangent of all elements in v"},{label:"cos",insertText:"cos",detail:"cos(v instant-vector)",documentation:"calculates the cosine of all elements in v"},{label:"cosh",insertText:"cosh",detail:"cosh(v instant-vector)",documentation:"calculates the hyperbolic cosine of all elements in v"},{label:"sin",insertText:"sin",detail:"sin(v instant-vector)",documentation:"calculates the sine of all elements in v"},{label:"sinh",insertText:"sinh",detail:"sinh(v instant-vector)",documentation:"calculates the hyperbolic sine of all elements in v"},{label:"tan",insertText:"tan",detail:"tan(v instant-vector)",documentation:"calculates the tangent of all elements in v"},{label:"tanh",insertText:"tanh",detail:"tanh(v instant-vector)",documentation:"calculates the hyperbolic tangent of all elements in v"}],m=[...[{label:"sum",insertText:"sum",documentation:"Calculate sum over dimensions"},{label:"min",insertText:"min",documentation:"Select minimum over dimensions"},{label:"max",insertText:"max",documentation:"Select maximum over dimensions"},{label:"avg",insertText:"avg",documentation:"Calculate the average over dimensions"},{label:"group",insertText:"group",documentation:"All values in the resulting vector are 1"},{label:"stddev",insertText:"stddev",documentation:"Calculate population standard deviation over dimensions"},{label:"stdvar",insertText:"stdvar",documentation:"Calculate population standard variance over dimensions"},{label:"count",insertText:"count",documentation:"Count number of elements in the vector"},{label:"count_values",insertText:"count_values",documentation:"Count number of elements with the same value"},{label:"bottomk",insertText:"bottomk",documentation:"Smallest k elements by sample value"},{label:"topk",insertText:"topk",documentation:"Largest k elements by sample value"},{label:"quantile",insertText:"quantile",documentation:"Calculate \u03C6-quantile (0 \u2264 \u03C6 \u2264 1) over dimensions"}],...o,{insertText:"abs",label:"abs",detail:"abs(v instant-vector)",documentation:"Returns the input vector with all sample values converted to their absolute value."},{insertText:"absent",label:"absent",detail:"absent(v instant-vector)",documentation:"Returns an empty vector if the vector passed to it has any elements and a 1-element vector with the value 1 if the vector passed to it has no elements. This is useful for alerting on when no time series exist for a given metric name and label combination."},{insertText:"absent_over_time",label:"absent_over_time",detail:"absent(v range-vector)",documentation:"Returns an empty vector if the range vector passed to it has any elements and a 1-element vector with the value 1 if the range vector passed to it has no elements."},{insertText:"ceil",label:"ceil",detail:"ceil(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` up to the nearest integer."},{insertText:"changes",label:"changes",detail:"changes(v range-vector)",documentation:"For each input time series, `changes(v range-vector)` returns the number of times its value has changed within the provided time range as an instant vector."},{insertText:"clamp",label:"clamp",detail:"clamp(v instant-vector, min scalar, max scalar)",documentation:"Clamps the sample values of all elements in `v` to have a lower limit of `min` and an upper limit of `max`."}
5,{insertText:"clamp_max",label:"clamp_max",detail:"clamp_max(v instant-vector, max scalar)",documentation:"Clamps the sample values of all elements in `v` to have an upper limit of `max`."},{insertText:"clamp_min",label:"clamp_min",detail:"clamp_min(v instant-vector, min scalar)",documentation:"Clamps the sample values of all elements in `v` to have a lower limit of `min`."},{insertText:"count_scalar",label:"count_scalar",detail:"count_scalar(v instant-vector)",documentation:"Returns the number of elements in a time series vector as a scalar. This is in contrast to the `count()` aggregation operator, which always returns a vector (an empty one if the input vector is empty) and allows grouping by labels via a `by` clause."},{insertText:"deg",label:"deg",detail:"deg(v instant-vector)",documentation:"Converts radians to degrees for all elements in v"},{insertText:"day_of_month",label:"day_of_month",detail:"day_of_month(v=vector(time()) instant-vector)",documentation:"Returns the day of the month for each of the given times in UTC. Returned values are from 1 to 31."}
5,{insertText:"day_of_week",label:"day_of_week",detail:"day_of_week(v=vector(time()) instant-vector)",documentation:"Returns the day of the week for each of the given times in UTC. Returned values are from 0 to 6, where 0 means Sunday etc."},{insertText:"day_of_year",label:"day_of_year",detail:"day_of_year(v=vector(time()) instant-vector)",documentation:"Returns the day of the year for each of the given times in UTC. Returned values are from 1 to 365 for non-leap years, and 1 to 366 in leap years."},{insertText:"days_in_month",label:"days_in_month",detail:"days_in_month(v=vector(time()) instant-vector)",documentation:"Returns number of days in the month for each of the given times in UTC. Returned values are from 28 to 31."},{insertText:"delta",label:"delta",detail:"delta(v range-vector)",documentation:"Calculates the difference between the first and last value of each time series element in a range vector `v`, returning an instant vector with the given deltas and equivalent labels. The delta is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if the sample values are all integers."},{insertText:"deriv",label:"deriv",detail:"deriv(v range-vector)",documentation:"Calculates the per-second derivative of the time series in a range vector `v`, using simple linear regression."},{insertText:"double_exponential_smoothing",label:"double_exponential_smoothing",detail:"double_exponential_smoothing(v range-vector, sf scalar, tf scalar)",documentation:"Produces a smoothed value for time series based on the range in `v`. The lower the smoothing factor `sf`, the more importance is given to old data. The higher the trend factor `tf`, the more trends in the data is considered. Both `sf` and `tf` must be between 0 and 1."},{insertText:"drop_common_labels",label:"drop_common_labels",detail:"drop_common_labels(instant-vector)",documentation:"Drops all labels that have the same name and value across all series in the input vector."},{insertText:"exp",label:"exp",detail:"exp(v instant-vector)",documentation:"Calculates the exponential function for all elements in `v`.\nSpecial cases are:\n* `Exp(+Inf) = +Inf` \n* `Exp(NaN) = NaN`"},{insertText:"floor",label:"floor",detail:"floor(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` down to the nearest integer."},{insertText:"histogram_quantile",label:"histogram_quantile",detail:"histogram_quantile(\u03C6 float, b instant-vector)",documentation:"Calculates the \u03C6-quantile (0 \u2264 \u03C6 \u2264 1) from the buckets `b` of a histogram. The samples in `b` are the counts of observations in each bucket. Each sample must have a label `le` where the label value denotes the inclusive upper bound of the bucket. (Samples without such a label are silently ignored.) The histogram metric type automatically provides time series with the `_bucket` suffix and the appropriate labels."},{insertText:"holt_winters",label:"holt_winters",detail:"holt_winters(v range-vector, sf scalar, tf scalar)",documentation:"Renamed as double_exponential_smoothing in prometheus v3.x. For prometheus versions equal and greater than v3.0 please use double_exponential_smoothing. \n\nProduces a smoothed value for time series based on the range in `v`. The lower the smoothing factor `sf`, the more importance is given to old data. The higher the trend factor `tf`, the more trends in the data is considered. Both `sf` and `tf` must be between 0 and 1."},{insertText:"hour",label:"hour",detail:"hour(v=vector(time()) instant-vector)",documentation:"Returns the hour of the day for each of the given times in UTC. Returned values are from 0 to 23."},{insertText:"idelta",label:"idelta",detail:"idelta(v range-vector)",documentation:"Calculates the difference between the last two samples in the range vector `v`, returning an instant vector with the given deltas and equivalent labels."},{insertText:"increase",label:"increase",detail:"increase(v range-vector)",documentation:"Calculates the increase in the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. The increase is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if a counter increases only by integer increments."}
5,{insertText:"info",label:"info",detail:"info(v instant-vector, [data-label-selector instant-vector])",documentation:"Returns latest details and metadata about a group of metrics, such as their labels and current values, without doing any calculations"},{insertText:"irate",label:"irate",detail:"irate(v range-vector)",documentation:"Calculates the per-second instant rate of increase of the time series in the range vector. This is based on the last two data points. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for."},{insertText:"label_join",label:"label_join",detail:"label_join(v instant-vector, dst_label string, separator string, src_label_1 string, src_label_2 string, ...)",documentation:"For each timeseries in `v`, joins all the values of all the `src_labels` using `separator` and returns the timeseries with the label `dst_label` containing the joined value. There can be any number of `src_labels` in this function."},{insertText:"label_replace",label:"label_replace",detail:"label_replace(v instant-vector, dst_label str
5ing, replacement string, src_label string, regex string)",documentation:"For each timeseries in `v`, `label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)` matches the regular expression `regex` against the label `src_label`. If it matches, then the timeseries is returned with the label `dst_label` replaced by the expansion of `replacement`. `$1` is replaced with the first matching subgroup, `$2` with the second etc. If the regular expression doesn't match then the timeseries is returned unchanged."},{insertText:"ln",label:"ln",detail:"ln(v instant-vector)",documentation:"Calculates the natural logarithm for all elements in `v`.\nSpecial cases are:\n * `ln(+Inf) = +Inf`\n * `ln(0) = -Inf`\n * `ln(x < 0) = NaN`\n * `ln(NaN) = NaN`"},{insertText:"log2",label:"log2",detail:"log2(v instant-vector)",documentation:"Calculates the binary logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"log10",label:"log10",detail:"log10(v instant-vector)",documentation:"Calculates the decimal logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"minute",label:"minute",detail:"minute(v=vector(time()) instant-vector)",documentation:"Returns the minute of the hour for each of the given times in UTC. Returned values are from 0 to 59."},{insertText:"month",label:"month",detail:"month(v=vector(time()) instant-vector)",documentation:"Returns the month of the year for each of the given times in UTC. Returned values are from 1 to 12, where 1 means January etc."},{insertText:"pi",label:"pi",detail:"pi()",documentation:"Returns pi"},{insertText:"predict_linear",label:"predict_linear",detail:"predict_linear(v range-vector, t scalar)",documentation:"Predicts the value of time series `t` seconds from now, based on the range vector `v`, using simple linear regression."},{insertText:"rad",label:"rad",detail:"rad(v instant-vector)",documentation:"Converts degrees to radians for all elements in v"},{insertText:"rate",label:"rate",detail:"rate(v range-vector)",documentation:"Calculates the per-second average rate of increase of the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. Also, the calculation extrapolates to the ends of the time range, allowing for missed scrapes or imperfect alignment of scrape cycles with the range's time period."},{insertText:"resets",label:"resets",detail:"resets(v range-vector)",documentation:"For each input time series, `resets(v range-vector)` returns the number of counter resets within the provided time range as an instant vector. Any decrease in the value between two consecutive samples is interpreted as a counter reset."},{insertText:"round",label:"round",detail:"round(v instant-vector, to_nearest=1 scalar)",documentation:"Rounds the sample values of all elements in `v` to the nearest integer. Ties are resolved by rounding up. The optional `to_nearest` argument allows specifying the nearest multiple to which the sample values should be rounded. This multiple may also be a fraction."},{insertText:"scalar",label:"scalar",detail:"scalar(v instant-vector)",documentation:"Given a single-element input vector, `scalar(v instant-vector)` returns the sample value of that single element as a scalar. If the input vector does not have exactly one element, `scalar` will return `NaN`."},{insertText:"sgn",label:"sgn",detail:"sgn(v instant-vector)",documentation:"Returns a vector with all sample values converted to their sign, defined as this: 1 if v is positive, -1 if v is negative and 0 if v is equal to zero."},{insertText:"sort",label:"sort",detail:"sort(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in ascending order."},{insertText:"sort_desc",label:"sort_desc",detail:"sort_desc(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in descending order."},{insertText:"sqrt",label:"sqrt",detail:"sqrt(v instant-vector)",documentation:"Calculates the square root of all elements in `v`."},{insertText:"time",label:"time",detail:"time()",documentation:"Returns the number of seconds since January 1, 1970 UTC. Note that this does not actually return the current time, but the time at which the expression is to be evaluated."}
5,{insertText:"timestamp",label:"timestamp",detail:"timestamp(v instant-vector)",documentation:"Returns the timestamp of each of the samples of the given vector as the number of seconds since January 1, 1970 UTC."},{insertText:"vector",label:"vector",detail:"vector(s scalar)",documentation:"Returns the scalar `s` as a vector with no labels."},{insertText:"year",label:"year",detail:"year(v=vector(time()) instant-vector)",documentation:"Returns the year for each of the given times in UTC."},{insertText:"avg_over_time",label:"avg_over_time",detail:"avg_over_time(range-vector)",documentation:"The average value of all points in the specified interval."},{insertText:"min_over_time",label:"min_over_time",detail:"min_over_time(range-vector)",documentation:"The minimum value of all points in the specified interval."},{insertText:"max_over_time",label:"max_over_time",detail:"max_over_time(range-vector)",documentation:"The maximum value of all points in the specified interval."},{insertText:"sum_over_time",label:"sum_over_time",detail:"sum_over_time(range-vector)",documentation:"The sum of all values in the specified interval."},{insertText:"count_over_time",label:"count_over_time",detail:"count_over_time(range-vector)",documentation:"The count of all values in the specified interval."},{insertText:"quantile_over_time",label:"quantile_over_time",detail:"quantile_over_time(scalar, range-vector)",documentation:"The \u03C6-quantile (0 \u2264 \u03C6 \u2264 1) of the values in the specified interval."},{insertText:"stddev_over_time",label:"stddev_over_time",detail:"stddev_over_time(range-vector)",documentation:"The population standard deviation of the values in the specified interval."},{insertText:"stdvar_over_time",label:"stdvar_over_time",detail:"stdvar_over_time(range-vector)",documentation:"The population standard variance of the values in the specified interval."},{insertText:"last_over_time",label:"last_over_time",detail:"last_over_time(range-vector)",documentation:"The most recent point value in specified interval."},{insertText:"present_over_time",label:"present_over_time",detail:"present_over_time(range-vector)",documentation:"The value 1 for any series in the specified interval."},{insertText:"histogram_avg",label:"histogram_avg",detail:"histogram_avg(v instant-vector)",documentation:"Returns the arithmetic average of observed values stored in a native histogram. Samples that are not native histograms are ignored and do not show up in the returned vector."},{insertText:"histogram_count",label:"histogram_count",detail:"histogram_count(v instant-vector)",documentation:"Returns the count of observations stored in a native histogram."},{insertText:"histogram_sum",label:"histogram_sum",detail:"histogram_sum(v instant-vector)",documentation:"Returns the sum of observations stored in a native histogram."},{insertText:"histogram_fraction",label:"histogram_fraction",detail:"histogram_fraction(lower scalar, upper scalar, v instant-vector)",documentation:"Returns the estimated fraction of observations between the provided lower and upper values."},{insertText:"histogram_stddev",label:"histogram_stddev",detail:"histogram_stddev(v instant-vector)",documentation:"Returns the estimated standard deviation of observations in a native histogram, based on the geometric mean of the buckets where the observations lie."},{insertText:"histogram_stdvar",label:"histogram_stdvar",detail:"histogram_stdvar(v instant-vector)",documentation:"Returns the estimated standard variance of observations in a native histogram."}],a=m.map(h=>h.label),l={comment:{pattern:/#.*/},"context-aggregation":{pattern:/((by|without)\s*)\([^)]*\)/,lookbehind:!0,inside:{"label-key":{pattern:/[^(),\s][^,)]*[^),\s]*/,alias:"attr-name"},punctuation:/[()]/}},"context-labels":{pattern:/\{[^}]*(?=}?)/,greedy:!0,inside:{comment:{pattern:/#.*/},"label-key":{pattern:/[a-z_]\w*(?=\s*(=|!=|=~|!~))/,alias:"attr-name",greedy:!0},"label-value":{pattern:/"(?:\\.|[^\\"])*"/,greedy:!0,alias:"attr-value"},punctuation:/[{]/}},function:new RegExp(`\\b(?:${m.map(h=>h.label).join("|")})(?=\\s*\\()`,"i"),"context-range":[{pattern:/\[[^\]]*(?=])/,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}},{pattern:/(offset\s+)\w+/,lookbehind:!0,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}}],idList:{pattern:/\d+(\|\d+)+/,alias:"number"},number:/\b-?\d+((\.\d*)?([eE][+-]?\d+)?)?\b/,operator:new RegExp(`/[-+*/=%^~]|&&?|\\|?\\||!=?|<(?:=>?|<|>)?|>[>=]?|\\b(?:${n.join("|")})\\b`,"i"),punctuation:/[{};()`,.]/},f=l},55342:(ee,B,e)=>{"use strict";e.d(B,{DT:()=>s,X1:()=>m});var t=e(2543),n=e.n(t),r=e(64283);const o=20;function s(g,p,c){const y=[],P=c?.languageProvider?.metricsMetadata;if(g.trim().match(/^\w+_bucket$|^\w+_bucket{.*}$/))y.push({type:"HISTOGRAM_QUANTILE",label:"Selected metric has buckets.",fix:{label:"Consider calculating aggregated quantile by adding histogram_quantile().",action:{type:"ADD_HISTOGRAM_QUANTILE",query:g}}});else if(P&&x(g)){const D=u(g),{nameMetric:b}=i(D,"histogram",P,!1);if(b){const v="Selected metric is a native histogram.";y.push({type:"HISTOGRAM_QUANTILE",label:v,fix:{label:"Consider calculating aggregated quantile by adding histogram_quantile().",action:{type:"ADD_HISTOGRAM_QUANTILE",query:g}}},{type:"HISTOGRAM_AVG",label:v,fix:{label:"Consider calculating the arithmetic average of observed values by adding histogram_avg().",action:{type:"ADD_HISTOGRAM_AVG",query:g}}},{type:"HISTOGRAM_COUNT",label:v,fix:{label:"Consider calculating the count of observations by adding histogram_count().",action:{type:"ADD_HISTOGRAM_COUNT",query:g}}})}}if(g.indexOf("rate(")===-1&&g.indexOf("increase(")===-1){const D=g.match(/\b((?<!:)\w+_(total|sum|count)(?!:))\b/);let b=D?D[1]:"",E=!1;if(P){const v=u(g),C=i(v,"counter",P,E);b=C.nameMetric,E=C.certain}
5if(b){const v=x(g);let S=`Selected metric ${E?"is":"looks like"} a counter.`,O;v?O={label:"Consider calculating rate of counter by adding rate().",action:{type:"ADD_RATE",query:g}}:S=`${S} Consider calculating rate of counter by adding rate().`,y.push({type:"APPLY_RATE",label:S,fix:O})}}if(c&&c.ruleMappings){const D=l(g,c.ruleMappings);y.push(...D)}return p&&p.length>=o&&g.trim().match(/^\w+$/)&&y.push({type:"ADD_SUM",label:"Many time series results returned.",fix:{label:"Consider aggregating with sum().",action:{type:"ADD_SUM",query:g,preventSubmit:!0}}}),y}function m(g){const p=[];return g.lookupsDisabled&&p.push({label:"Labels and metrics lookup was disabled in data source settings.",type:"INFO"}),p}function a(g,p){return!g||!p?!1:new RegExp(`(?<![\\w:])${p}(?=[\\[{(\\s\\)]|$)`).test(g)}function l(g,p){const c=[],y=Object.keys(p).reduce((P,d)=>{if(!a(g,d))return P;if(p[d].length>1){const{idx:D,expandedQuery:b,identifier:E,identifierValue:v}=f(g,d,p[d]);return D===-1?(c.push({type:"EXPAND_RULES_WARNING",label:"We found multiple recording rules that match in this query. To expand the recording rule, add an identifier label/value."}),P):{...P,[d]:{expandedQuery:b,identifier:E,identifierValue:v}}}else return{...P,[d]:{expandedQuery:p[d][0].query}}},{});return(0,t.size)(y)>0&&c.push({type:"EXPAND_RULES",label:"Query contains recording rules.",fix:{label:"Expand rules",action:{type:"EXPAND_RULES",query:g,options:y}}}),c}function f(g,p,c){const{query:y}=(0,r.u)(g),P=h(p,y);if(P.length===0)return{idx:-1,identifier:"",identifierValue:"",expandedQuery:""};let d="",D="",b=-1;return P.forEach(E=>{b===-1&&E.label.search("uuid")!==-1&&(d=E.label,D=E.value)}),c.forEach((E,v)=>{E.labels&&Object.entries(E.labels).forEach(([C,S])=>{b===-1&&C===d&&S===D&&(b=v)})}),{idx:b,identifier:d,identifierValue:D,expandedQuery:c[b]?.query??""}}function h(g,p){if(p.metric===g)return p.labels;if(p.binaryQueries)for(let c=0;c<p.binaryQueries.length;c++){const y=h(g,p.binaryQueries[c].query);if(y&&y.length>0)return y}return[]}function u(g){return Array.from(g.matchAll(/\$?[a-zA-Z_:][a-zA-Z0-9_:]*/g)).map(([p])=>p).filter(p=>!p.startsWith("$")).flatMap(p=>p.split(":"))}function i(g,p,c,y){return{nameMetric:g.find(d=>{const D=c[d];return D&&D.type.toLowerCase()===p?(y=!0,!0):!1})??"",certain:y}}function x(g){return g.trim().match(/^\w+$|^\w+{.*}$/)}},13502:(ee,B,e)=>{"use strict";e.d(B,{l:()=>C,z:()=>S});var t=e(35748),n=e(76861),r=e(72184),o=e(81748),s=e(19150);function m(){return[{id:s.jN.HistogramQuantile,name:"Histogram quantile",params:[{name:"Quantile",type:"number",options:[.99,.95,.9,.75,.5,.25]}],defaultParams:[.9],category:s.Ag.Functions,renderer:n.jY,addOperationHandler:n.iZ},a({id:s.jN.HistogramAvg}),a({id:s.jN.HistogramCount}),a({id:s.jN.HistogramSum}),{id:s.jN.HistogramFraction,name:"Histogram fraction",params:[{name:"Lower scalar",type:"number"},{name:"Upper scalar",type:"number"}],defaultParams:[0,.2],category:s.Ag.Functions,renderer:n.jY,addOperationHandler:n.iZ},a({id:s.jN.HistogramStddev}),a({id:s.jN.HistogramStdvar}),{id:s.jN.LabelReplace,name:"Label replace",params:[{name:"Destination label",type:"string"},{name:"Replacement",type:"string"},{name:"Source label",type:"string"},{name:"Regex",type:"string"}],category:s.Ag.Functions,defaultParams:["","$1","","(.*)"],renderer:n.kf,addOperationHandler:n.iZ},{id:s.jN.Ln,name:"Ln",params:[],defaultParams:[],category:s.Ag.Functions,renderer:n.jY,addOperationHandler:n.iZ},l(s.jN.Changes),l(s.jN.Rate,!0),l(s.jN.Irate),l(s.jN.Increase,!0),l(s.jN.Idelta),l(s.jN.Delta),a({id:s.jN.DoubleExponentialSmoothing,params:[(0,n.z2)(),{name:"Smoothing Factor",type:"number"},{name:"Trend Factor",type:"number"}],defaultParams:["$__interval",.5,.5],alternativesKey:"range function",category:s.Ag.RangeFunctions,renderer:n.nU,addOperationHandler:u,changeTypeHandler:f}),a({id:s.jN.HoltWinters,params:[(0,n.z2)(),{name:"Smoothing Factor",type:"number"},{name:"Trend Factor",type:"number"}],defaultParams:["$__interval",.5,.5],alternativesKey:"range function",category:s.Ag.RangeFunctions,renderer:n.nU,addOperationHandler:u,changeTypeHandler:f}),a({id:s.jN.PredictLinear,params:[(0,n.z2)(),{name:"Seconds from now",type:"number"}],defaultParams:["$__interval",60],alternativesKey:"range function",category:s.Ag.RangeFunctions,renderer:n.nU,addOperationHandler:u,changeTypeHandler:f}),a({id:s.jN.QuantileOverTime,params:[(0,n.z2)(),{name:"Quantile",type:"number"}],defaultParams:["$__interval",.5],alternativesKey:"overtime function",category:s.Ag.RangeFunctions,renderer:n.Kl,addOperationHandler:u,changeTypeHandler:f}),...r.Iu,{id:s.jN.NestedQuery,name:"Binary operation with query",params:[],defaultParams:[],category:s.Ag.BinaryOps,renderer:(I,R,T)=>T,addOperationHandler:i},a({id:s.jN.Abs}),a({id:s.jN.Absent}),a({id:s.jN.Acos,category:s.Ag.Trigonometric}),a({id:s.jN.Acosh,category:s.Ag.Trigonometric}),a({id:s.jN.Asin,category:s.Ag.Trigonometric}),a({id:s.jN.Asinh,category:s.Ag.Trigonometric}),a({id:s.jN.Atan,category:s.Ag.Trigonometric}),a({id:s.jN.Atanh,category:s.Ag.Trigonometric}),a({id:s.jN.Ceil}),a({id:s.jN.Clamp,name:"Clamp",params:[{name:"Minimum Scalar",type:"number"},{name:"Maximum Scalar",type:"number"}],defaultParams:[1,1]}),a({id:s.jN.ClampMax,params:[{name:"Maximum Scalar",type:"number"}],defaultParams:[1]}),a({id:s.jN.ClampMin,params:[{name:"Minimum Scalar",type:"number"}],defaultParams:[1]}),a({id:s.jN.Cos,category:s.Ag.Trigonometric}),a({id:s.jN.Cosh,category:s.Ag.Trigonometric}),a({id:s.jN.DayOfMonth,category:s.Ag.Time}),a({id:s.jN.DayOfWeek,category:s.Ag.Time}),a({id:s.jN.DayOfYear,category:s.Ag.Time}),a({id:s.jN.DaysInMonth,category:s.Ag.Time}),a({id:s.jN.Deg}),l(s.jN.Deriv),a({id:s.jN.Exp}),a({id:s.jN.Floor}),a({id:s.jN.Hour}),a({id:s.jN.LabelJoin,params:[{name:"Destination Label",type:"string",editor:o.r},{name:"Separator",type:"string"},{name:"Source Label",type:"string",restParam:!0,optional:!0,editor:o.r}],defaultParams:["",",",""],renderer:x,explainHandler:g,addOperationHandler:p}),a({id:s.jN.Log10}),a({id:s.jN.Log2}),a({id:s.jN.Minute}),a({id:s.jN.Month}),a({id:s.jN.Pi,renderer:I=>`${I.id}()`}),a({id:s.jN.Rad}),l(s.jN.Resets),a({id:s.jN.Round,category:s.Ag.Functions,params:[{name:"To Nearest",type:"number"}],defaultParams:[1]}),a({id:s.jN.Scalar}),a({id:s.jN.Sgn}),a({id:s.jN.Sin,category:s.Ag.Trigonometric}),a({id:s.jN.Sinh,category:s.Ag.Trigonometric}),a({id:s.jN.Sort}),a({id:s.jN.SortDesc}),a({id:s.jN.Sqrt}),a({id:s.jN.Stddev}),a({id:s.jN.Tan,category:s.Ag.Trigonometric}),a({id:s.jN.Tanh,category:s.Ag.Trigonometric}),a({id:s.jN.Time,renderer:I=>`${I.id}()`}),a({id:s.jN.Timestamp}
5),a({id:s.jN.Vector,params:[{name:"Value",type:"number"}],defaultParams:[1],renderer:I=>`${I.id}(${I.params[0]})`}),a({id:s.jN.Year})]}function a(O){return{...O,id:O.id,name:O.name??(0,n.DQ)(O.id),params:O.params??[],defaultParams:O.defaultParams??[],category:O.category??s.Ag.Functions,renderer:O.renderer??(O.params?n.kf:n.jY),addOperationHandler:O.addOperationHandler??n.iZ}}function l(O,I=!1){return{id:O,name:(0,n.DQ)(O),params:[(0,n.z2)(I)],defaultParams:[I?"$__rate_interval":"$__interval"],alternativesKey:"range function",category:s.Ag.RangeFunctions,renderer:h,addOperationHandler:u,changeTypeHandler:f}}function f(O,I){return(O.params[0]==="$__rate_interval"&&I.defaultParams[0]!=="$__rate_interval"||O.params[0]==="$__interval"&&I.defaultParams[0]!=="$__interval")&&(O.params=I.defaultParams),O}function h(O,I,R){let T=(O.params??[])[0]??"5m";return`${I.id}(${R}[${T}])`}function u(O,I,R){const T={id:O.id,params:O.defaultParams};return I.operations.length>0&&R.getOperationDef(I.operations[0].id).addOperationHandler===u?{...I,operations:[T,...I.operations.slice(1)]}:{...I,operations:[T,...I.operations]}}function i(O,I){return{...I,binaryQueries:[...I.binaryQueries??[],{operator:"/",query:I}]}}function x(O,I,R){const T=O.params[0]??"",K=`"${O.params[1]??""}"`;return`${O.id}(${R}, "${T}", ${K}, "${O.params.slice(2).join(K)}")`}function g(O,I){let R=I?.documentation??"no docs";return typeof O.params[1]!="string"&&(R+=" \u{1F6A8}\u{1F6A8}\u{1F6A8} The `separator` must be a string."),R}function p(O,I){const R={id:O.id,params:O.defaultParams};return{...I,operations:[...I.operations,R]}}function c(){return[...(0,n.G3)(s.jN.Sum),...(0,n.G3)(s.jN.Avg),...(0,n.G3)(s.jN.Min),...(0,n.G3)(s.jN.Max),...(0,n.G3)(s.jN.Count),...(0,n.G3)(s.jN.Group),...(0,n.jC)(s.jN.TopK,{params:[{name:"K-value",type:"number"}],defaultParams:[5]}),...(0,n.jC)(s.jN.BottomK,{params:[{name:"K-value",type:"number"}],defaultParams:[5]}),...(0,n.jC)(s.jN.CountValues,{params:[{name:"Identifier",type:"string"}],defaultParams:["count"]}),...(0,n.jC)(s.jN.Quantile,{params:[{name:"Value",type:"number"}],defaultParams:[1]}),y(s.jN.SumOverTime),y(s.jN.AvgOverTime),y(s.jN.MinOverTime),y(s.jN.MaxOverTime),y(s.jN.CountOverTime),y(s.jN.LastOverTime),y(s.jN.PresentOverTime),y(s.jN.AbsentOverTime),y(s.jN.StddevOverTime)]}function y(O){return{id:O,name:(0,n.DQ)(O),params:[(0,n.z2)()],defaultParams:["$__interval"],alternativesKey:"overtime function",category:s.Ag.RangeFunctions,renderer:P,addOperationHandler:u}}function P(O,I,R){let T=(O.params??[])[0]??"$__interval";return`${I.id}(${R}[${T}])`}var d=e(42954),D=e(43173),b=e(96944),E=e(31200);class v{constructor(I){this.categories=[],this.operationsRegistry=new d.O(I)}setOperationCategories(I){this.categories=I}getOperationsForCategory(I){return this.operationsRegistry.list().filter(R=>R.category===I&&!R.hideFromList)}getAlternativeOperations(I){return this.operationsRegistry.list().filter(R=>R.alternativesKey&&R.alternativesKey===I)}getCategories(){return this.categories}getOperationDef(I){return this.operationsRegistry.getIfExists(I)}renderOperations(I,R){for(const T of R){const L=this.operationsRegistry.getIfExists(T.id);if(!L)throw new Error(`Could not find operation ${T.id} in the registry`);I=L.renderer(T,L,I)}return I}renderBinaryQueries(I,R){if(R)for(const T of R)I=`${this.renderBinaryQuery(I,T)}`;return I}renderBinaryQuery(I,R){let T=I+` ${R.operator} `;return R.vectorMatches&&(T+=`${R.vectorMatchesType}(${R.vectorMatches}) `),T+this.renderQuery(R.query,!0)}renderLabels(I){if(I.length===0)return"";let R="{";for(const T of I){R!=="{"&&(R+=", ");let L=T.value;const K=T.op==="=~"||T.op==="!~";D.$.featureToggles.prometheusSpecialCharsInLabelValues&&!K&&(L=(0,b.ee)(L)),R+=`${(0,E.Nc)(T.label)}${T.op}"${L}"`}return R+"}"}renderQuery(I,R){let T="";const L=this.renderLabels(I.labels);return I.metric?(0,E.Rq)(I.metric)?T=`${I.metric}${L}`:T=`{"${I.metric}"${L.length>0?`, ${L.substring(1)}`:"}"}`:T=L,T=this.renderOperations(T,I.operations),!R&&this.hasBinaryOp(I)&&I.binaryQueries?.length&&(T=`(${T})`),T=this.renderBinaryQueries(T,I.binaryQueries),R&&(this.hasBinaryOp(I)||I.binaryQueries?.length)&&(T=`(${T})`),T}hasBinaryOp(I){return I.operations.find(R=>this.getOperationDef(R.id)?.category===s.Ag.BinaryOps)!==void 0}}class C extends v{constructor(){super(()=>{const I=[...m(),...c()];for(const R of I){const T=t.AW.find(L=>
5L.insertText===R.id);T&&(R.documentation=T.documentation)}return I}),this.setOperationCategories([s.Ag.Aggregations,s.Ag.RangeFunctions,s.Ag.Functions,s.Ag.BinaryOps,s.Ag.Trigonometric,s.Ag.Time])}getQueryPatterns(){return[{name:"Rate then sum",type:s.n5.Rate,operations:[{id:"rate",params:["$__rate_interval"]},{id:"sum",params:[]}]},{name:"Rate then sum by(label) then avg",type:s.n5.Rate,operations:[{id:"rate",params:["$__rate_interval"]},{id:"__sum_by",params:[""]},{id:"avg",params:[]}]},{name:"Histogram quantile on rate",type:s.n5.Histogram,operations:[{id:"rate",params:["$__rate_interval"]},{id:"__sum_by",params:["le"]},{id:"histogram_quantile",params:[.95]}]},{name:"Histogram quantile on increase",type:s.n5.Histogram,operations:[{id:"increase",params:["$__rate_interval"]},{id:"__max_by",params:["le"]},{id:"histogram_quantile",params:[.95]}]},{name:"Binary Query",type:s.n5.Binary,operations:[{id:"rate",params:["$__rate_interval"]},{id:"sum",params:[]}],binaryQueries:[{operator:"/",query:{metric:"",labels:[],operations:[{id:"rate",params:["$__rate_interval"]},{id:"sum",params:[]}]}}]}]}}const S=new C},72184:(ee,B,e)=>{"use strict";e.d(B,{AE:()=>o,C8:()=>r,Iu:()=>s});var t=e(76861),n=e(19150);const r=[{id:n.jN.Addition,name:"Add scalar",sign:"+"},{id:n.jN.Subtraction,name:"Subtract scalar",sign:"-"},{id:n.jN.MultiplyBy,name:"Multiply by scalar",sign:"*"},{id:n.jN.DivideBy,name:"Divide by scalar",sign:"/"},{id:n.jN.Modulo,name:"Modulo by scalar",sign:"%"},{id:n.jN.Exponent,name:"Exponent",sign:"^"},{id:n.jN.EqualTo,name:"Equal to",sign:"==",comparison:!0},{id:n.jN.NotEqualTo,name:"Not equal to",sign:"!=",comparison:!0},{id:n.jN.GreaterThan,name:"Greater than",sign:">",comparison:!0},{id:n.jN.LessThan,name:"Less than",sign:"<",comparison:!0},{id:n.jN.GreaterOrEqual,name:"Greater or equal to",sign:">=",comparison:!0},{id:n.jN.LessOrEqual,name:"Less or equal to",sign:"<=",comparison:!0}],o=r.reduce((a,l)=>(a[l.sign]={id:l.id,comparison:l.comparison},a),{}),s=r.map(a=>{const l=[{name:"Value",type:"number"}];let f=[2];return a.comparison&&(l.push({name:"Bool",type:"boolean",description:"If checked comparison will return 0 or 1 for the value rather than filtering."}),f=[2,!1]),{id:a.id,name:a.name,params:l,defaultParams:f,alternativesKey:"binary scalar operations",category:n.Ag.BinaryOps,renderer:m(a.sign),addOperationHandler:t.iZ}});function m(a){return function(f,h,u){let i=f.params[0],x="";return f.params.length===2&&(x=f.params[1]?" bool":""),`${u} ${a}${x} ${i}`}}},81748:(ee,B,e)=>{"use strict";e.d(B,{r:()=>a});var t=e(74848),n=e(96540),r=e(47184),o=e(18857),s=e(13502),m=e(76861);function a({onChange:f,index:h,operationId:u,value:i,query:x,datasource:g,timeRange:p}){const[c,y]=(0,n.useState)({});return(0,t.jsx)(o.l6,{inputId:(0,m.OS)(u,h),autoFocus:i===""?!0:void 0,openMenuOnFocus:!0,onOpenMenu:async()=>{y({isLoading:!0});const P=await l(p,x,g);y({options:P,isLoading:void 0})},isLoading:c.isLoading,allowCustomValue:!0,noOptionsMessage:"No labels found",loadingMessage:"Loading labels",options:c.options,value:(0,r.z)(i),onChange:P=>f(h,P.value)})}async function l(f,h,u){let i=h.labels;u.type==="prometheus"&&(i=[{label:"__name__",op:"=",value:h.metric},...h.labels]);const x=s.z.renderLabels(i),g=await u.languageProvider.fetchLabelsWithMatch(f,x);return Object.keys(g).map(p=>({label:p,value:p}))}},3430:(ee,B,e)=>{"use strict";e.d(B,{dm:()=>I,o6:()=>O});var t=e(74848),n=e(22803),r=e(76459),o=e.n(r),s=e(96540),m=e(23257),a=e.n(m),l=e(47184),f=e(85629),h=e(75349),u=e(30048),i=e(63142),x=e(45861),g=e(30703),p=e(72508),c=e(69665),y=e(92807),P=e(18857),d=e(97095),D=e(18027),b=e(85187),E=e(65094),v=e(3781),C=e(717);const S=" ",O=1e3;function I({datasource:K,query:A,onChange:W,onGetMetrics:N,labelsFilters:w,metricLookupDisabled:j,onBlur:V,variableEditor:U}
5){const F=(0,i.of)(R),[M,H]=(0,s.useState)({}),_=[{value:"BrowseMetrics",label:"Metrics explorer",description:"Browse and filter all metrics and metadata with a fuzzy search"}],Z=(0,s.useCallback)((oe,ae)=>{const ie=oe.label??oe.value;return ie?ie.toLowerCase?ae.split(S).reduce((pe,de)=>{const le=ie.toLowerCase().includes(de.toLowerCase());return pe&&(le||ie==="Metrics explorer")},!0):!0:!1},[]),ne=(0,s.useCallback)((oe,ae)=>oe.__isNew__?oe.label:(0,t.jsx)(a(),{searchWords:ae.inputValue.split(S),textToHighlight:oe.label??"",highlightClassName:F.highlight}),[F.highlight]),te=(oe,ae)=>{const ie=(0,E.b4)(oe);return T(ie,ae)},Y=oe=>K.metricFindQuery(te(oe,w)).then(ie=>{const fe=ie.length;(0,b.ky)(ie),fe>ie.length?H({...M,resultsTruncated:!0}):H({...M,resultsTruncated:!1});const pe=ie.map(de=>({label:de.text,value:de.text}));return[..._,...pe]}),Q=()=>Promise.resolve([]),J=o()(oe=>Y(oe),K.getDebounceTimeInMilliseconds()),q=oe=>{const ae=oe.data;if(ae.value==="BrowseMetrics"){const ie=oe.isFocused?F.focus:"";return(0,t.jsx)("div",{...oe.innerProps,ref:oe.innerRef,className:`${F.customOptionWidth} metric-encyclopedia-open`,"data-testid":f.Tp.components.Select.option,onKeyDown:fe=>{fe.code==="Enter"&&H({...M,metricsModalOpen:!0})},children:(0,t.jsxs)("div",{className:`${F.customOption} ${ie} metric-encyclopedia-open`,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"metric-encyclopedia-open",children:ae.label}),(0,t.jsx)("div",{className:`${F.customOptionDesc} metric-encyclopedia-open`,children:ae.description})]}),(0,t.jsxs)(x.$n,{fill:"text",size:"sm",variant:"secondary",onClick:()=>H({...M,metricsModalOpen:!0}),className:"metric-encyclopedia-open",children:["Open",(0,t.jsx)(g.I,{name:"arrow-right"})]})]})})}return(0,p.o5)(oe)},X=({children:oe,maxHeight:ae,innerRef:ie,innerProps:fe})=>{const pe=(0,i.$j)(),de=(0,c.J)(pe),le=!s.isValidElement(oe)&&M.resultsTruncated;return(0,t.jsxs)("div",{...fe,className:`${de.menu} ${F.customMenuContainer}`,style:{maxHeight:Math.round(ae*.9)},"aria-label":"Select options menu",children:[(0,t.jsx)(y.P,{ref:ie,showScrollIndicators:!0,children:oe}),le&&(0,t.jsx)("div",{className:F.customMenuFooter,children:(0,t.jsx)("div",{children:"Only the top 1000 metrics are displayed in the metric select. Use the metrics explorer to view all metrics."})})]})},se=()=>(0,t.jsx)(P.DW,{"data-testid":f.Tp.components.DataSource.Prometheus.queryEditor.builder.metricSelect,isClearable:!0,inputId:"prometheus-metric-select",className:F.select,value:A.metric?(0,l.z)(A.metric):void 0,placeholder:"Select metric",allowCustomValue:!0,formatOptionLabel:ne,filterOption:Z,minMenuHeight:250,onOpenMenu:async()=>{if(j)return;H({isLoading:!0});const oe=await N(),ae=oe.map(fe=>fe.value),ie=oe.length;oe.length>O&&(0,b.ky)(oe),H({metrics:[..._,...oe],isLoading:void 0,initialMetrics:ae,resultsTruncated:ie>oe.length})},loadOptions:j?Q:J,isLoading:M.isLoading,defaultOptions:M.metrics??Array.from(new Array(25),()=>({value:""})),onChange:oe=>{const ae=oe?.value;ae?ae==="BrowseMetrics"?((0,C.E5)("grafana_prometheus_metric_encyclopedia_open",null,"",A),H({...M,metricsModalOpen:!0})):W({...A,metric:ae}):W({...A,metric:""})},components:{Option:q,MenuList:X},onBlur:V});return(0,t.jsxs)(t.Fragment,{children:[!K.lookupsDisabled&&M.metricsModalOpen&&(0,t.jsx)(v.Ly,{datasource:K,isOpen:M.metricsModalOpen,onClose:()=>H({...M,metricsModalOpen:!1}),query:A,onChange:W,initialMetrics:M.initialMetrics??[]}),U?(0,t.jsx)(d.C,{children:(0,t.jsx)(D.I,{label:"Metric",labelWidth:20,tooltip:(0,t.jsx)("div",{children:"Optional: returns a list of label values for the label name in the specified metric."}),children:se()})}):(0,t.jsx)(h.B,{children:(0,t.jsx)(u.c,{label:"Metric",children:se()})})]})}const R=K=>({select:(0,n.css)({minWidth:"125px"}),highlight:(0,n.css)({label:"select__match-highlight",background:"inherit",padding:"inherit",color:K.colors.warning.contrastText,backgroundColor:K.colors.warning.main}),customOption:(0,n.css)({padding:"8px",display:"flex",justifyContent:"space-between",cursor:"pointer",":hover":{backgroundColor:K.colors.emphasize(K.colors.background.primary,.1)}}),customOptionlabel:(0,n.css)({color:K.colors.text.primary}),customOptionDesc:(0,n.css)({color:K.colors.text.secondary,fontSize:K.typography.size.xs,opacity:"50%"}),focus:(0,n.css)({backgroundColor:K.colors.emphasize(K.colors.background.primary,.1)}),customOptionWidth:(0,n.css)({minWidth:"400px"}),customMenuFooter:(0,n.css)({flex:0,display:"flex",justifyContent:"space-between",padding:K.spacing(1.5),borderTop:`1px solid ${K.colors.border.weak}`,color:K.colors.text.secondary}),customMenuContainer:(0,n.css)({display:"flex",flexDirection:"column",background:K.colors.background.primary,boxShadow:K.shadows.z3})}),T=(K,A)=>{const W=A?L(A):[];return`label_values({__name__=~".*${K}"${W?W.join(""):""}},__name__)`},L=K=>K.map(A=>`,${A.label}="${A.value}"`)},98602:(ee,B,e)=>{"use strict";e.d(B,{I:()=>j});var t=e(74848),n=e(96540),r=e(43173),o=e(41753),s=e(85187),m=e(13502),a=e(65094),l=e(22803),f=e(2543),h=e(26774),u=e(75349),i=e(30048),x=e(97095),g=e(79233),p=e(76459),c=e.n(p),y=e(47184),P=e(85629),d=e(72500),D=e(20301),b=e(18857);function E({item:U,defaultOp:F,onChange:M,onDelete:H,onGetLabelNames:_,onGetLabelValues:Z,invalidLabel:ne,invalidValue:te,getLabelValuesAutofillSuggestions:Y,debounceDuration:Q}
5){const[J,q]=(0,n.useState)({}),[X,se]=(0,n.useState)(!1),[oe,ae]=(0,n.useState)(!1),[ie,fe]=(0,n.useState)([]),pe=(Te=U.op)=>v.find(Ne=>Ne.label===Te)?.isMultiValue,de=Te=>{if(Te){const Ne=/\(([^)]+)\)/,Ce=Te?.match(Ne);return Ce&&Ce[0].indexOf("|")>0?[Te]:Te.indexOf("|")>0?Te.split("|"):[Te]}return[]},le=c()(Te=>Y(Te,U.label),Q),me=c()(Te=>{const Ne=ie.filter(Ce=>Ce.value.includes(Te));return(0,s.ky)(Ne)},Q),De=U?.value??"";return(0,t.jsx)("div",{"data-testid":"prometheus-dimensions-filter-item",children:(0,t.jsxs)(d.M,{children:[(0,t.jsx)(b.DW,{placeholder:"Select label","data-testid":P.Tp.components.QueryBuilder.labelSelect,inputId:"prometheus-dimensions-filter-item-key",width:"auto",value:U.label?(0,y.z)(U.label):null,allowCustomValue:!0,onOpenMenu:async()=>{q({isLoadingLabelNames:!0});const Te=await _(U);fe(Te),se(!0);const Ne=(0,s.ky)(Te);q({labelNames:Ne,isLoadingLabelNames:void 0})},onCloseMenu:()=>{se(!1)},isOpen:X,isLoading:J.isLoadingLabelNames??!1,loadOptions:me,defaultOptions:J.labelNames,onChange:Te=>{Te.label&&M({...U,op:U.op??F,label:Te.label})},invalid:ne}),(0,t.jsx)(b.l6,{"data-testid":P.Tp.components.QueryBuilder.matchOperatorSelect,className:"query-segment-operator",value:(0,y.z)(U.op??F),options:v,width:"auto",onChange:Te=>{Te.value!=null&&M({...U,op:Te.value,value:pe(Te.value)?U.value:de(U?.value)[0]})}}),(0,t.jsx)(b.DW,{placeholder:"Select value","data-testid":P.Tp.components.QueryBuilder.valueSelect,inputId:"prometheus-dimensions-filter-item-value",width:"auto",value:pe()?de(De).map(y.z):de(De).map(y.z)[0],allowCustomValue:!0,formatCreateLabel:Te=>Te,createOptionPosition:U.op?.includes("~")?"first":"last",onOpenMenu:async()=>{q({isLoadingLabelValues:!0});const Te=await Z(U);(0,s.ky)(Te),ae(!0),q({...J,labelValues:Te,isLoadingLabelValues:void 0})},onCloseMenu:()=>{ae(!1)},isOpen:oe,defaultOptions:J.labelValues,isMulti:pe(),isLoading:J.isLoadingLabelValues,loadOptions:le,onChange:Te=>{if(Te.value)M({...U,value:Te.value,op:U.op??F});else{const Ne=Te.map(Ce=>Ce.label).join("|");M({...U,value:Ne,op:U.op??F})}},invalid:te}),(0,t.jsx)(D.Z,{"aria-label":`remove-${U.label}`,icon:"times",variant:"secondary",onClick:H})]})},De)}const v=[{label:"=",value:"=",isMultiValue:!1},{label:"!=",value:"!=",isMultiValue:!1},{label:"=~",value:"=~",isMultiValue:!0},{label:"!~",value:"!~",isMultiValue:!0}],C="Select at least 1 label filter (label and value)";function S({labelsFilters:U,onChange:F,onGetLabelNames:M,onGetLabelValues:H,labelFilterRequired:_,getLabelValuesAutofillSuggestions:Z,debounceDuration:ne,variableEditor:te}
5){const Y="=",[Q,J]=(0,n.useState)([{op:Y}]);(0,n.useEffect)(()=>{U.length>0?J(U):J([{op:Y}])},[U]);const q=oe=>{J(oe);const ae=oe.filter(ie=>ie.label!=null&&ie.value!=null);(0,f.isEqual)(ae,U)||F(ae)},X=Q.some(oe=>oe.label&&oe.value),se=()=>(0,t.jsx)(h.o,{items:Q,onChange:q,renderItem:(oe,ae,ie)=>(0,t.jsx)(E,{debounceDuration:ne,item:oe,defaultOp:Y,onChange:ae,onDelete:ie,onGetLabelNames:M,onGetLabelValues:H,invalidLabel:_&&!oe.label,invalidValue:_&&!oe.value,getLabelValuesAutofillSuggestions:Z})});return(0,t.jsx)(t.Fragment,{children:te?(0,t.jsx)(x.C,{children:(0,t.jsxs)("div",{className:(0,l.cx)((0,l.css)({display:"flex"})),children:[(0,t.jsx)(g.c,{width:20,tooltip:(0,t.jsx)("div",{children:"Optional: used to filter the metric select for this query type."}),children:"Label filters"}),se()]})}):(0,t.jsx)(u.B,{children:(0,t.jsx)(i.c,{label:"Label filters",error:C,invalid:_&&!X,children:se()})})})}var O=e(43243),I=e(45861),R=e(18027),T=e(3781),L=e(717);function K({datasource:U,query:F,onChange:M,onGetMetrics:H,labelsFilters:_,variableEditor:Z}){const[ne,te]=(0,n.useState)(!1),Y=(0,n.useCallback)(async se=>(await U.metricFindQuery(N(se,_))).map(ie=>({label:ie.text,value:ie.text})),[U,_]),Q=(0,n.useCallback)(se=>{M({...F,metric:se?.value??""})},[M,F]),J=(0,n.useCallback)(async se=>(se.length?await Y(se):await H()).map(ae=>({label:ae.label??ae.value,value:ae.value})),[Y,H]),q=(0,n.useCallback)(async()=>{const se=await H(),oe=[];for(const ae of se)ae.value&&oe.push(ae.value);return oe},[H]),X=()=>(0,t.jsxs)(d.M,{children:[(0,t.jsx)(O.G,{placeholder:"Select metric",width:"auto",minWidth:25,options:J,value:F.metric,onChange:Q,createCustomValue:!0,"data-testid":P.Tp.components.DataSource.Prometheus.queryEditor.builder.metricSelect}),(0,t.jsx)(I.$n,{tooltip:"Open metrics explorer","aria-label":"Open metrics explorer",variant:"secondary",icon:"book-open",onClick:()=>{(0,L.E5)("grafana_prometheus_metric_encyclopedia_open",null,"",F),te(!0)}})]});return(0,t.jsxs)(t.Fragment,{children:[!U.lookupsDisabled&&ne&&(0,t.jsx)(T.Ly,{datasource:U,isOpen:ne,onClose:()=>te(!1),query:F,onChange:M,initialMetrics:q}),Z?(0,t.jsx)(x.C,{children:(0,t.jsx)(R.I,{label:"Metric",labelWidth:20,tooltip:(0,t.jsx)("div",{children:"Optional: returns a list of label values for the label name in the specified metric."}),children:X()})}):(0,t.jsx)(u.B,{children:(0,t.jsx)(i.c,{label:"Metric",children:X()})})]})}const A=(U,F)=>{const M=F?W(F):[];return`label_values({__name__=~".*${U}"${M?M.join(""):""}},__name__)`},W=U=>U.map(F=>`,${F.label}="${F.value}"`),N=(U,F)=>{const M=(0,a.b4)(U);return A(M,F)};var w=e(3430);function j({datasource:U,query:F,onChange:M,onBlur:H,variableEditor:_,timeRange:Z}){const ne=ae=>{M({...F,labels:ae})},te=(0,n.useCallback)(async ae=>{const ie=U.getVariables(),fe=await ae;return[...ie.map(pe=>({label:pe,value:pe})),...fe.map(pe=>({label:pe.value,value:pe.value,title:pe.description}))]},[U]),Y=async ae=>{if(!F.metric)return await U.languageProvider.fetchLabels(Z),U.languageProvider.getLabelKeys().map(de=>({value:de}));const ie=F.labels.filter(de=>de!==ae);ie.push({label:"__name__",op:"=",value:F.metric});const fe=m.z.renderLabels(ie);let pe=await U.languageProvider.fetchLabelsWithMatch(Z,fe);return Object.keys(pe).filter(de=>!ie.find(le=>le.label===de)).map(de=>({value:de}))},Q=(ae,ie)=>{const fe={label:ie??"__name__",op:"=~",value:(0,a.b4)(`.*${ae}`)},pe=F.labels.filter(De=>De.label!==fe.label);pe.push(fe),F.metric&&pe.push({label:"__name__",op:"=",value:F.metric});const de=pe.map(De=>({...De,label:U.interpolateString(De.label),value:U.interpolateString(De.value)})),le=m.z.renderLabels(de);let me;return U.hasLabelsMatchAPISupport()?me=q(fe,le):me=J(fe,le),me.then(De=>((0,s.ky)(De),De))},J=(ae,ie)=>{if(!ae.label)return Promise.resolve([]);const fe=U.languageProvider.fetchSeries(Z,ie),pe=U.interpolateString(ae.label);return fe.then(de=>{const le=new Set;return de.forEach(me=>{const De=me[pe];le.add(De)}),Array.from(le).map(me=>({label:me,value:me}))})},q=(ae,ie)=>{if(!ae.label)return Promise.resolve([]);const fe=`[${U.uid}][${F.metric}][${ae.label}][${ae.op}]`;return U.languageProvider.fetchSeriesValuesWithMatch(Z,ae.label,ie,fe).then(pe=>pe.map(de=>({value:de,label:de})))},X=async ae=>{if(!ae.label)return[];if(!F.metric)return(await U.languageProvider.getLabelValues(Z,ae.label)).map(de=>({value:de}));const ie=F.labels.filter(de=>de!==ae);ie.push({label:"__name__",op:"=",value:F.metric});const fe=ie.map(de=>({...de,label:U.interpolateString(de.label),value:U.interpolateString(de.value)})),pe=m.z.renderLabels(fe);return U.hasLabelsMatchAPISupport()?q(ae,pe):J(ae,pe)},se=(0,n.useCallback)(()=>te(V(U,F,Z)),[U,F,Z,te]),oe=r.$.featureToggles.prometheusUsesCombobox?K:w.dm;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oe,{query:F,onChange:M,onGetMetrics:se,datasource:U,labelsFilters:F.labels,metricLookupDisabled:U.lookupsDisabled,onBlur:H||(()=>{}),variableEditor:_}),(0,t.jsx)(S,{debounceDuration:U.getDebounceTimeInMilliseconds(),getLabelValuesAutofillSuggestions:Q,labelsFilters:F.labels,onChange:ne,onGetLabelNames:ae=>te(Y(ae)),onGetLabelValues:ae=>te(X(ae)),variableEditor:_})]})}async function V(U,F,M){U.languageProvider.metricsMetadata||await U.languageProvider.loadMetricsMetadata(),U.languageProvider.metricsMetadata||(U.languageProvider.metricsMetadata={});let H;if(F.labels.length>0){const _=m.z.renderLabels(F.labels);H=(await U.languageProvider.getSeries(M,_,!0)).__name__??[]}else H=await U.languageProvider.getLabelValues(M,"__name__")??[];return H.map(_=>({value:_,description:(0,o.xB)(_,U.languageProvider.metricsMetadata)}))}},97783:(ee,B,e)=>{"use strict";e.d(B,{W:()=>h,i:()=>u});var t=e(74848),n=e(96540),r=e(41654),o=e(35748),s=e(13502),m=e(64283),a=e(21833),l=e(21216),f=e(58469);const h="Fetch all series matching metric name and label filters.",u=(0,n.memo)(({query:i})=>{const x=(0,m.u)(i||"").query,g={grammar:o.Ay,name:"promql"};return(0,t.jsxs)(r.B,{gap:.5,direction:"column",children:[(0,t.jsx)(a.r,{stepNumber:1,title:(0,t.jsx)(f.Z,{query:`${s.z.renderQuery(x)}`,lang:g}),children:h}),(0,t.jsx)(l.k,{stepNumber:2,queryModeller:s.z,query:x,lang:g})]})});u.displayName="PromQueryBuilderExplained"},24706:(ee,B,e)=>{"use strict";e.d(B,{$:()=>a});var t=e(74848),n=e(22803),r=e(85629),o=e(63142),s=e(20410),m=e(97783);function a(f){const{query:h,datasource:u,range:i,onRunQuery:x,onChange:g,data:p,app:c,showExplain:y}=f,P=(0,o.of)(l);return(0,t.jsxs)("div",{"data-testid":r.Tp.components.DataSource.Prometheus.queryEditor.code.queryField,className:P.wrapper,children:[(0,t.jsx)(s.L,{datasource:u,query:h,range:i,onRunQuery:x,onChange:g,history:[],data:p,app:c}),y&&(0,t.jsx)(m.i,{query:h.expr})]})}const l=f=>({wrapper:(0,n.css)({".gf-form":{marginBottom:0}})})},3781:(ee,B,e)=>{"use strict";e.d(B,{Ly:()=>U,hD:()=>F,VL:()=>fe});var t=e(74848),n=e(22803),r=e(65307),o=e(76459),s=e.n(o),m=e(96540),a=e(85629),l=e(63142),f=e(22787),h=e(63527),u=e(18857),i=e(68079),x=e(59243),g=e(93256),p=e(45861),c=e(30703),y=e(34213),P=e(21285),d=e(45967),D=e(717);function b(pe){const{state:de,onChangeFullMetaSearch:le,onChangeIncludeNullMetadata:me,onChangeDisableTextWrap:De,onCh
5angeUseBackend:Te}=pe,Ne=(0,l.$j)(),Ce=E(Ne);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:Ce.selectItem,children:[(0,t.jsx)(P.d,{"data-testid":F.searchWithMetadata,value:de.fullMetaSearch,disabled:de.useBackend||!de.hasMetadata,onChange:()=>le()}),(0,t.jsx)("div",{className:Ce.selectItemLabel,children:D.Ft.metadataSearchSwitch})]}),(0,t.jsxs)("div",{className:Ce.selectItem,children:[(0,t.jsx)(P.d,{value:de.includeNullMetadata,disabled:!de.hasMetadata,onChange:()=>me()}),(0,t.jsx)("div",{className:Ce.selectItemLabel,children:D.Ft.includeNullMetadata})]}),(0,t.jsxs)("div",{className:Ce.selectItem,children:[(0,t.jsx)(P.d,{value:de.disableTextWrap,onChange:()=>De()}),(0,t.jsx)("div",{className:Ce.selectItemLabel,children:"Disable text wrap"})]}),(0,t.jsxs)("div",{className:Ce.selectItem,children:[(0,t.jsx)(P.d,{"data-testid":F.setUseBackend,value:de.useBackend,onChange:()=>Te()}),(0,t.jsxs)("div",{className:Ce.selectItemLabel,children:[D.Ft.setUseBackend,"\xA0"]}),(0,t.jsx)(d.m,{content:"Filter metric names by regex search, using an additional call on the Prometheus API.",placement:"bottom-end",children:(0,t.jsx)(c.I,{name:"info-circle",size:"xs",className:Ce.settingsIcon})})]})]})}function E(pe){return{settingsIcon:(0,n.css)({color:pe.colors.text.secondary}),selectItem:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"center",padding:"4px 0"}),selectItemLabel:(0,n.css)({margin:`0 0 0 ${pe.spacing(1)}`,alignSelf:"center",color:pe.colors.text.secondary,fontSize:"12px"})}}var v=e(41654);function C({feedbackUrl:pe}){const de=(0,l.of)(S);return(0,t.jsx)(v.B,{children:(0,t.jsxs)("a",{href:pe,className:de.link,title:"The metrics explorer is new, please let us know how we can improve it",target:"_blank",rel:"noreferrer noopener",children:[(0,t.jsx)(c.I,{name:"comment-alt-message"})," Give feedback"]})})}function S(pe){return{link:(0,n.css)({color:pe.colors.text.secondary,fontSize:pe.typography.bodySmall.fontSize,":hover":{color:pe.colors.text.link},margin:"-25px 0 30px 0"})}}var O=e(23257),I=e.n(O),R=e(51901);function T(pe){const{metrics:de,onChange:le,onClose:me,query:De,state:Te,disableTextWrap:Ne}=pe,Ce=(0,l.$j)(),He=L(Ce,Ne);function ke(Ve){Ve.value&&(le({...De,metric:Ve.value}),(0,D.E5)("grafana_prom_metric_encycopedia_tracking",Te,Ve.value),me())}function Me(Ve){return Te.fullMetaSearch&&Ve?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("td",{children:tt(Ve.type??"")}),(0,t.jsx)("td",{children:(0,t.jsx)(I(),{textToHighlight:Ve.description??"",searchWords:Te.metaHaystackMatches,autoEscape:!0,highlightClassName:He.matchHighLight})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("td",{children:tt(Ve.type??"")}),(0,t.jsx)("td",{children:Ve.description??""})]})}function $e(Ve,Qe,je){return(0,t.jsxs)(t.Fragment,{children:[Ve,(0,t.jsx)("span",{className:He.tooltipSpace,children:(0,t.jsx)(d.m,{content:(0,t.jsxs)(t.Fragment,{children:["When creating a ",Qe,", Prometheus exposes multiple series with the type counter."," ",(0,R.jW)(je)]}),placement:"bottom-start",interactive:!0,children:(0,t.jsx)(c.I,{name:"info-circle",size:"xs"})})})]})}function tt(Ve){return Ve?Ve.includes("(summary)")?$e(Ve,"summary","https://prometheus.io/docs/concepts/metric_types/#summary"):Ve.includes("(histogram)")?$e(Ve,"histogram","https://prometheus.io/docs/concepts/metric_types/#histogram"):Ve:""}function Ke(){let Ve;return Te.fuzzySearchQuery||(Ve="There are no metrics found in the data source."),De.labels.length>0&&(Ve="There are no metrics found. Try to expand your label filters."),(Te.fuzzySearchQuery||Te.selectedTypes.length>0)&&(Ve="There are no metrics found. Try to expand your search and filters."),(0,t.jsx)("tr",{className:He.noResults,children:(0,t.jsx)("td",{colSpan:3,children:Ve})})}function Re(Ve){return Ve.useBackend?[Ve.fuzzySearchQuery]:Ve.fullMetaSearch?Ve.metaHaystackMatches:Ve.nameHaystackMatches}return(0,t.jsxs)("table",{className:He.table,children:[(0,t.jsx)("thead",{className:He.stickyHeader,children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:`${He.nameWidth} ${He.tableHeaderPadding}`,children:"Name"}),Te.hasMetadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("th",{className:`${He.typeWidth} ${He.tableHeaderPadding}`,children:"Type"}),(0,t.jsx)("th",{className:`${He.descriptionWidth} ${He.tableHeaderPadding}`,children:"Description"})]}),(0,t.jsx)("th",{className:He.selectButtonWidth,children:" "})]})}),(0,t.jsx)("tbody",{children:(0,t.jsxs)(t.Fragment,{children:[de.length>0&&de.map((Ve,Qe)=>(0,t.jsxs)("tr",{className:He.row,children:[(0,t.jsx)("td",{className:He.nameOverflow,children:(0,t.jsx)(I(),{textToHighlight:Ve?.value??"",searchWords:Re(Te),autoEscape:!0,highlightClassName:He.matchHighLight})}),Te.hasMetadata&&Me(Ve),(0,t.jsx)("td",{children:(0,t.jsx)(p.$n,{size:"md",variant:"secondary",onClick:()=>ke(Ve),className:He.centerButton,children:"Select"})})]},Ve?.value??Qe)),de.length===0&&!Te.isLoading&&Ke()]})})]})}const L=(pe,de)=>
5({table:(0,n.css)({tableLayout:de?void 0:"fixed",borderRadius:pe.shape.radius.default,width:"100%",whiteSpace:de?"nowrap":"normal",td:{padding:pe.spacing(1)},"td,th":{minWidth:pe.spacing(3),borderBottom:`1px solid ${pe.colors.border.weak}`}}),row:(0,n.css)({label:"row",borderBottom:`1px solid ${pe.colors.border.weak}`,"&:last-child":{borderBottom:0}}),tableHeaderPadding:(0,n.css)({padding:"8px"}),matchHighLight:(0,n.css)({background:"inherit",color:pe.components.textHighlight.text,backgroundColor:pe.components.textHighlight.background}),nameWidth:(0,n.css)({width:de?void 0:"37.5%"}),nameOverflow:(0,n.css)({overflowWrap:de?void 0:"anywhere"}),typeWidth:(0,n.css)({width:de?void 0:"15%"}),descriptionWidth:(0,n.css)({width:de?void 0:"35%"}),selectButtonWidth:(0,n.css)({width:de?void 0:"12.5%"}),stickyHeader:(0,n.css)({position:"sticky",top:0,backgroundColor:pe.colors.background.primary}),noResults:(0,n.css)({textAlign:"center",color:pe.colors.text.secondary}),tooltipSpace:(0,n.css)({marginLeft:"4px"}),centerButton:(0,n.css)({display:"block",margin:"auto",border:"none"})});var K=e(29093);const A=(pe,de)=>({modal:(0,n.css)({width:"85vw",[pe.breakpoints.down("md")]:{width:"100%"},[pe.breakpoints.up("xl")]:{width:"60%"}}),inputWrapper:(0,n.css)({display:"flex",flexDirection:"row",flexWrap:"wrap"}),inputItemFirst:(0,n.css)({flexBasis:"40%",paddingRight:"16px",[pe.breakpoints.down("md")]:{paddingRight:"0px",paddingBottom:"16px"}}),inputItem:(0,n.css)({flexGrow:1,flexBasis:"20%",[pe.breakpoints.down("md")]:{minWidth:"100%"}}),selectWrapper:(0,n.css)({marginBottom:pe.spacing(1)}),resultsAmount:(0,n.css)({color:pe.colors.text.secondary,fontSize:"0.85rem",padding:"0 0 4px 0"}),resultsData:(0,n.css)({margin:`4px 0 ${pe.spacing(2)} 0`}),resultsDataCount:(0,n.css)({margin:0}),resultsDataFiltered:(0,n.css)({color:pe.colors.text.secondary,textAlign:"center",border:"solid 1px rgba(204, 204, 220, 0.25)",padding:"7px"}),resultsDataFilteredText:(0,n.css)({display:"inline",verticalAlign:"text-top"}
5),results:(0,n.css)({height:"calc(80vh - 310px)",overflowY:"scroll"}),resultsFooter:(0,n.css)({marginTop:"24px",display:"flex",flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",position:"sticky"}),currentlySelected:(0,n.css)({color:"grey",opacity:"75%",fontSize:"0.75rem"}),loadingSpinner:(0,n.css)({visibility:"hidden"}),visible:(0,n.css)({visibility:"visible"}),settingsBtn:(0,n.css)({float:"right"}),noBorder:(0,n.css)({border:"none"}),resultsPerPageLabel:(0,n.css)({color:pe.colors.text.secondary,opacity:"75%",paddingTop:"5px",fontSize:"0.85rem",marginRight:"8px"}),resultsPerPageWrapper:(0,n.css)({display:"flex"})});var W=e(84139),N=e(2543);const w=new W.A({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1});function j(pe,de,le){const[me,De,Te]=w.search(pe,de,0,1e5);let Ne=[],Ce=new Set;if(me&&Te){const He=(ke,Me)=>{Me&&Ce.add(ke)};for(let ke=0;ke<Te.length;ke++){let Me=Te[ke];W.A.highlight(pe[De.idx[Me]],De.ranges[Me],He),Ne.push(pe[De.idx[Me]])}le([Ne,[...Ce]])}else de||le([[],[]])}const V=(0,N.debounce)(j,300),U=pe=>{const{datasource:de,isOpen:le,onClose:me,onChange:De,query:Te,initialMetrics:Ne}=pe,[Ce,He]=(0,m.useReducer)(M.reducer,(0,K.ue)(Te)),ke=(0,l.$j)(),Me=A(ke,Ce.disableTextWrap),$e=(0,m.useCallback)(async()=>{He(H(!0));const ze=typeof Ne=="function"?await Ne():Ne,Ye=await(0,D.E1)(de,Te,ze);He(_({isLoading:!1,hasMetadata:Ye.hasMetadata,metrics:Ye.metrics,metaHaystackDictionary:Ye.metaHaystackDictionary,nameHaystackDictionary:Ye.nameHaystackDictionary,totalMetricCount:Ye.metrics.length,filteredMetricCount:Ye.metrics.length}))},[Te,de,Ne]);(0,m.useEffect)(()=>{$e()},[$e]);const tt=D.uq.map(ze=>({value:ze.value,label:ze.value,description:ze.description})),Ke=(0,m.useMemo)(()=>s()(async ze=>{He(H(!0));const Ye=await(0,D.qn)(ze,Te.labels,de);He(Z({metrics:Ye,filteredMetricCount:Ye.length,isLoading:!1}))},de.getDebounceTimeInMilliseconds()),[de,Te]);function Re(ze){He(Q(ze))}function Ve(ze){He(J(ze))}function Qe(ze,Ye){Ce.useBackend&&ze===""?$e():Ce.useBackend?Ke(ze):Ye?V(Object.keys(Ce.metaHaystackDictionary),ze,Ve):V(Object.keys(Ce.nameHaystackDictionary),ze,Re)}const je=(0,t.jsx)(b,{state:Ce,onChangeFullMetaSearch:()=>{const ze=!Ce.fullMetaSearch;He(q(ze)),De({...Te,fullMetaSearch:ze}),Qe(Ce.fuzzySearchQuery,ze)},onChangeIncludeNullMetadata:()=>{He(X(!Ce.includeNullMetadata)),De({...Te,includeNullMetadata:!Ce.includeNullMetadata})},onChangeDisableTextWrap:()=>{He(ae()),De({...Te,disableTextWrap:!Ce.disableTextWrap}),(0,D.E5)("grafana_prom_metric_encycopedia_disable_text_wrap_interaction",Ce,"")},onChangeUseBackend:()=>{const ze=!Ce.useBackend;He(oe(ze)),De({...Te,useBackend:ze}),ze===!1?$e():Ce.fuzzySearchQuery!==""&&Ke(Ce.fuzzySearchQuery)}});return(0,t.jsxs)(f.a,{"data-testid":F.metricModal,isOpen:le,title:"Metrics explorer",onDismiss:me,"aria-label":"Browse metrics",className:Me.modal,children:[(0,t.jsx)(C,{feedbackUrl:"https://forms.gle/DEMAJHoAMpe3e54CA"}),(0,t.jsxs)("div",{className:Me.inputWrapper,"data-testid":a.Tp.components.DataSource.Prometheus.queryEditor.builder.metricsExplorer,children:[(0,t.jsx)("div",{className:(0,n.cx)(Me.inputItem,Me.inputItemFirst),children:(0,t.jsx)(h.p,{autoFocus:!0,"data-testid":F.searchMetric,placeholder:D.Ft.browse,value:Ce.fuzzySearchQuery,onInput:ze=>{const Ye=ze.currentTarget.value??"";He(Y(Ye)),Qe(Ye,Ce.fullMetaSearch)}})}),Ce.hasMetadata&&(0,t.jsx)("div",{className:Me.inputItem,children:(0,t.jsx)(u.KF,{"data-testid":F.selectType,inputId:"my-select",options:tt,value:Ce.selectedTypes,placeholder:D.Ft.type,onCh
5ange:ze=>He(se(ze))})}),(0,t.jsx)("div",{children:(0,t.jsx)(i.y,{className:`${Me.loadingSpinner} ${Ce.isLoading?Me.visible:""}`})}),(0,t.jsx)("div",{className:Me.inputItem,children:(0,t.jsx)(x.G,{"aria-label":"Additional settings",content:je,placement:"bottom-end",closeButton:!1,children:(0,t.jsxs)(g.e,{className:Me.settingsBtn,children:[(0,t.jsx)(p.$n,{variant:"secondary",size:"md",onClick:()=>He(ie()),"data-testid":F.showAdditionalSettings,className:Me.noBorder,children:"Additional Settings"}),(0,t.jsx)(p.$n,{className:Me.noBorder,variant:"secondary",icon:Ce.showAdditionalSettings?"angle-up":"angle-down"})]})})})]}),(0,t.jsxs)("div",{className:Me.resultsData,children:[Te.metric&&(0,t.jsxs)("i",{className:Me.currentlySelected,children:["Currently selected: ",Te.metric]}),Te.labels.length>0&&(0,t.jsxs)("div",{className:Me.resultsDataFiltered,children:[(0,t.jsx)(c.I,{name:"info-circle",size:"sm"}),(0,t.jsx)("div",{className:Me.resultsDataFilteredText,children:"\xA0These metrics have been pre-filtered by labels chosen in the label filters."})]})]}),(0,t.jsx)("div",{className:Me.results,children:Ce.metrics&&(0,t.jsx)(T,{metrics:(0,D.PV)(Ce,He),onChange:De,onClose:me,query:Te,state:Ce,disableTextWrap:Ce.disableTextWrap})}),(0,t.jsxs)("div",{className:Me.resultsFooter,children:[(0,t.jsxs)("div",{className:Me.resultsAmount,children:["Showing ",Ce.filteredMetricCount," of ",Ce.totalMetricCount," results"]}),(0,t.jsx)(y.d,{currentPage:Ce.pageNum??1,numberOfPages:(0,D.EP)(Ce).length,onNavigate:ze=>{He(te(ze??1))}}),(0,t.jsxs)("div",{className:Me.resultsPerPageWrapper,children:[(0,t.jsx)("p",{className:Me.resultsPerPageLabel,children:"# Results per page\xA0"}),(0,t.jsx)(h.p,{"data-testid":F.resultsPerPage,value:(0,D.fh)(Ce.resultsPerPage,K.J3,K.yH),placeholder:"results per page",width:10,title:"The maximum results per page is "+K.yH,type:"number",onInput:ze=>{const Ye=+ze.currentTarget.value;isNaN(Ye)||Ye>=K.yH||He(ne(Ye))}})]})]})]})},F={metricModal:"metric-modal",searchMetric:"search-metric",searchWithMetadata:"search-with-metadata",selectType:"select-type",metricCard:"metric-card",useMetric:"use-metric",searchPage:"search-page",resultsPerPage:"results-per-page",setUseBackend:"set-use-backend",showAdditionalSettings:"show-additional-settings"},M=(0,r.Z0)({name:"metrics-modal-state",initialState:(0,K.ue)(),reducers:{filterMetricsBackend:(pe,de)=>{pe.metrics=de.payload.metrics,pe.filteredMetricCount=de.payload.filteredMetricCount,pe.isLoading=de.payload.isLoading},buildMetrics:(pe,de)=>{pe.isLoading=de.payload.isLoading,pe.metrics=de.payload.metrics,pe.hasMetadata=de.payload.hasMetadata,pe.metaHaystackDictionary=de.payload.metaHaystackDictionary,pe.nameHaystackDictionary=de.payload.nameHaystackDictionary,pe.totalMetricCount=de.payload.totalMetricCount,pe.filteredMetricCount=de.payload.filteredMetricCount},setIsLoading:(pe,de)=>{pe.isLoading=de.payload},setFilteredMetricCount:(pe,de)=>{pe.filteredMetricCount=de.payload},setResultsPerPage:(pe,de)=>{pe.resultsPerPage=de.payload},setPageNum:(pe,de)=>{pe.pageNum=de.payload},setFuzzySearchQuery:(pe,de)=>{pe.fuzzySearchQuery=de.payload,pe.pageNum=1},setNameHaystack:(pe,de)=>{pe.nameHaystackOrder=de.payload[0],pe.nameHaystackMatches=de.payload[1]},setMetaHaystack:(pe,de)=>{pe.metaHaystackOrder=de.payload[0],pe.metaHaystackMatches=de.payload[1]},setFullMetaSearch:(pe,de)=>{pe.fullMetaSearch=de.payload,pe.pageNum=1},setIncludeNullMetadata:(pe,de)=>{pe.includeNullMetadata=de.payload,pe.pageNum=1},setSelectedTypes:(pe,de)=>{pe.selectedTypes=de.payload,pe.pageNum=1},setUseBackend:(pe,de)=>{pe.useBackend=de.payload,pe.fullMetaSearch=!1,pe.pageNum=1},setDisableTextWrap:pe=>{pe.disableTextWrap=!pe.disableTextWrap},showAdditionalSettings:pe=>{pe.showAdditionalSettings=!pe.showAdditionalSettings}}}),{setIsLoading:H,buildMetrics:_,filterMetricsBackend:Z,setResultsPerPage:ne,setPageNum:te,setFuzzySearchQuery:Y,setNameHaystack:Q,setMetaHaystack:J,setFullMetaSearch:q,setIncludeNullMetadata:X,setSelectedTypes:se,setUseBackend:oe,setDisableTextWrap:ae,showAdditionalSettings:ie,setFilteredMetricCount:fe}=M.actions},717:(ee,B,e)=>{"use strict";e.d(B,{E1:()=>s,E5:()=>x,EP:()=>f,Ft:()=>p,PV:()=>a,fh:()=>u,qn:()=>i,uq:()=>g});var t=e(27489),n=e(41753),r=e(65094),o=e(3781);async function s(c,y,P){let d=!0;const D=c.languageProvider.metricsMetadata;
5D&&Object.keys(D).length===0&&(d=!1);let b={},E={},v;return v=P?.map(C=>{const S=m(C,c),O=`${C}\xA6${S.description}`;return b[C]=S,E[O]=S,S}),{isLoading:!1,hasMetadata:d,metrics:v??[],metaHaystackDictionary:E,nameHaystackDictionary:b,totalMetricCount:v?.length??0,filteredMetricCount:v?.length??0}}function m(c,y){let P=(0,n.AU)(c,y.languageProvider.metricsMetadata);const d=(0,n.pK)(c,y.languageProvider.metricsMetadata);["histogram","summary"].forEach(E=>{d?.toLowerCase().includes(E)&&P!==E&&(P+=` (${E})`)});const D=c.match(/^\w+_bucket$|^\w+_bucket{.*}$/);return P==="histogram"&&!D&&(P="native histogram"),{value:c,type:P,description:d}}function a(c,y){const P=l(c);return!c.isLoading&&c.filteredMetricCount!==P.length&&y((0,o.VL)(P.length)),h(P,c.pageNum,c.resultsPerPage)}function l(c){let y=c.metrics;return c.fuzzySearchQuery&&!c.useBackend&&(c.fullMetaSearch?y=c.metaHaystackOrder.map(P=>c.metaHaystackDictionary[P]):y=c.nameHaystackOrder.map(P=>c.nameHaystackDictionary[P])),c.selectedTypes.length>0&&(y=y.filter((P,d)=>c.selectedTypes.some(b=>P.type&&b.value?P.type.includes(b.value):!P.type&&b.value==="no type"))),c.includeNullMetadata||(y=y.filter(P=>P.type!==void 0&&P.description!==void 0)),y}function f(c){if(!c.metrics.length)return[];const y=c.resultsPerPage===0?1:c.resultsPerPage,P=Math.floor(l(c).length/y)+1;return[...Array(P).keys()].map(d=>d+1)}function h(c,y,P){const d=P===0?1:P,D=y===1?0:(y-1)*d,b=D+d;return c.slice(D,b)}const u=(c,y,P)=>c<1?1:c>P?P:c??y;async function i(c,y,P){const d=(0,r.b4)(c),D=y.map(v=>`,${v.label}="${v.value}"`),b=`label_values({__name__=~".*${d}"${y?D.join():""}},__name__)`;return await P.metricFindQuery(b).then(v=>v.map(C=>m(C.text,P)))}function x(c,y,P,d){switch(c){case"grafana_prom_metric_encycopedia_tracking":(0,t.rR)(c,{metric:P,hasMetadata:y?.hasMetadata,totalMetricCount:y?.totalMetricCount,fuzzySearchQuery:y?.fuzzySearchQuery,fullMetaSearch:y?.fullMetaSearch,selectedTypes:y?.selectedTypes,useRegexSearch:y?.useBackend,includeResultsWithoutMetadata:y?.includeNullMetadata});case"grafana_prom_metric_encycopedia_disable_text_wrap_interaction":(0,t.rR)(c,{disableTextWrap:y?.disableTextWrap});case"grafana_prometheus_metric_encyclopedia_open":(0,t.rR)(c,{query:d})}}const g=[{value:"counter",description:"A cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero on restart."},{value:"gauge",description:"A metric that represents a single numerical value that can arbitrarily go up and down."},{value:"histogram",description:"A histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets."},{value:"native histogram",description:"Native histograms are different from classic Prometheus histograms in a number of ways: Native histogram bucket boundaries are calculated by a formula that depends on the scale (resolution) of the native histogram, and are not user defined."},{value:"summary",description:"A summary samples observations (usually things like request durations and response sizes) and can calculate configurable quantiles over a sliding time window."},{value:"unknown",description:"These metrics have been given the type unknown in the metadata."},{value:"no type",description:"These metrics have no defined type in the metadata."}],p={browse:"Search metrics by name",metadataSearchSwitch:"Include description in search",type:"Filter by type",includeNullMetadata:"Include results with no metadata",setUseBackend:"Enable regex search"}},29093:(ee,B,e)=>{"use strict";e.d(B,{J3:()=>t,mt:()=>o,ue:()=>r,yH:()=>n});const t=100,n=1e3;function r(s){return{isLoading:!0,metrics:[],hasMetadata:!0,metaHaystackDictionary:{},metaHaystackMatches:[],metaHaystackOrder:[],nameHaystackDictionary:{},nameHaystackOrder:[],nameHaystackMatches:[],totalMetricCount:0,filteredMetricCount:null,resultsPerPage:t,pageNum:1,fuzzySearchQuery:"",fullMetaSearch:s?.fullMetaSearch??!1,includeNullMetadata:s?.includeNullMetadata??!0,selectedTypes:[],useBackend:s?.useBackend??!1,disableTextWrap:s?.disableTextWrap??!1,showAdditionalSettings:!1}}function o(s){return{useBackend:s?.useBackend??!1,disableTextWrap:s?.disableTextWrap??!1,fullMetaSearch:s?.fullMetaSearch??!1,includeNullMetadata:s.includeNullMetadata??
5!1}}},76861:(ee,B,e)=>{"use strict";e.d(B,{DQ:()=>g,G3:()=>y,Kl:()=>u,OS:()=>p,iZ:()=>x,jC:()=>P,jY:()=>a,kf:()=>l,nU:()=>h,z2:()=>c});var t=e(2543),n=e.n(t),r=e(55127),o=e.n(r),s=e(81748),m=e(19150);function a(O,I,R){const T=i(O,I,R),L=O.id+"(";return R&&T.push(R),L+T.join(", ")+")"}function l(O,I,R){const T=i(O,I,R),L=O.id+"(";return R&&T.unshift(R),L+T.join(", ")+")"}function f(O,I,R,T){if(I.params.length<2)throw`Cannot render a function with params of length [${I.params.length}]`;let L=(O.params??[])[0]??"5m";const K=i({...O,params:O.params.slice(1)},{...I,params:I.params.slice(1),defaultParams:I.defaultParams.slice(1)},R),A=O.id+"(";return R&&(T?K.push(`${R}[${L}]`):K.unshift(`${R}[${L}]`)),A+K.join(", ")+")"}function h(O,I,R){return f(O,I,R,!1)}function u(O,I,R){return f(O,I,R,!0)}function i(O,I,R){return(O.params??[]).map((T,L)=>I.params[L]?.type==="string"?`"${T}"`:T)}function x(O,I){const R={id:O.id,params:O.defaultParams};return{...I,operations:[...I.operations,R]}}function g(O){return(0,t.capitalize)(O.replace(/_/g," "))}function p(O,I){return`operations.${O}.param.${I}`}function c(O=!1){const I=[{label:"$__interval",value:"$__interval"},{label:"1m",value:"1m"},{label:"5m",value:"5m"},{label:"10m",value:"10m"},{label:"1h",value:"1h"},{label:"24h",value:"24h"}];return O&&I.unshift({label:"$__rate_interval",value:"$__rate_interval"}),{name:"Range",type:"string",options:I}}function y(O,I={}){return[{id:O,name:g(O),params:[{name:"By label",type:"string",restParam:!0,optional:!0}],defaultParams:[],alternativesKey:"plain aggregations",category:m.Ag.Aggregations,renderer:a,paramChangedHandler:C(`__${O}_by`),explainHandler:b(O,""),addOperationHandler:x,...I},{id:`__${O}_by`,name:`${g(O)} by`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:s.r}],defaultParams:[""],alternativesKey:"aggregations by",category:m.Ag.Aggregations,renderer:d(O),paramChangedHandler:v(O),explainHandler:b(O,"by"),addOperationHandler:x,hideFromList:!0,...I},{id:`__${O}_without`,name:`${g(O)} without`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:s.r}],defaultParams:[""],alternativesKey:"aggregations by",category:m.Ag.Aggregations,renderer:D(O),paramChangedHandler:v(O),explainHandler:b(O,"without"),addOperationHandler:x,hideFromList:!0,...I}]}function P(O,I,R={}){const T=y(O,R);return T[0].params.unshift(...I.params),T[1].params.unshift(...I.params),T[2].params.unshift(...I.params),T[0].defaultParams=I.defaultParams,T[1].defaultParams=[...I.defaultParams,""],T[2].defaultParams=[...I.defaultParams,""],T[1].renderer=E(O),T[2].renderer=E(O),T}function d(O){return function(R,T,L){return`${O} by(${R.params.join(", ")}) (${L})`}}function D(O){return function(R,T,L){return`${O} without(${R.params.join(", ")}) (${L})`}}function b(O,I){return function(T){const L=T.params.map(A=>`\`${A}\``).join(" and "),K=o()("label",T.params.length);switch(I){case"by":return`Calculates ${O} over dimensions while preserving ${K} ${L}.`;case"without":return`Calculates ${O} over the dimensions ${L}. All other labels are preserved.`;default:return`Calculates ${O} over the dimensions.`}}}function E(O){return function(R,T,L){const K=T.params.findIndex(N=>N.restParam),A=R.params.slice(0,K),W=R.params.slice(K);return`${O} by(${W.join(", ")}) (${A.map((N,w)=>T.params[w].type==="string"?`"${N}"`:N).join(", ")}, ${L})`}}function v(O){return function(R,T,L){return T.params.length<L.params.length?{...T,id:O}:T}}function C(O){return function(R,T,L){return T.params.length===L.params.length?{...T,id:O}:T}}function S(O,I){if(!O.label||!O.op||!O.value||I.length<2)return!1;const R=O.op.toString().startsWith("!");return I.filter(K=>K.label===O.label&&K.value===O.value&&K.op!==O.op).some(K=>!!(R&&K?.op?.toString().startsWith("!")===!1||R===!1&&K?.op?.toString().startsWith("!")))}},64283:(ee,B,e)=>{"use strict";e.d(B,{u:()=>o});var t=e(21489),n=e(72184),r=e(65094);function o(c){const y=(0,r.qk)(c),d=t.K3.parse(y).topNode,b={query:{metric:"",labels:[],operations:[]},errors:[]};try{m(y,d,b)}catch(E){console.error(E),E instanceof Error&&b.errors.push({text:E.message})}return p(b.query)&&(b.errors=[]),s(c)&&(b.errors=[]),b}function s(c){const y={query:{metric:"",labels:[],operations:[]},errors:[]};
5c=c.replace(/\$__interval/g,"1s"),c=c.replace(/\$__interval_ms/g,"1000"),c=c.replace(/\$__rate_interval/g,"1s"),c=c.replace(/\$__range_ms/g,"1000"),c=c.replace(/\$__range_s/g,"1"),c=c.replace(/\$__range/g,"1s");const d=t.K3.parse(c).topNode;try{m(c,d,y)}catch{return!1}return y.errors.length===0}function m(c,y,P){const d=P.query;switch(y.type.id){case t.gw:{d.metric=(0,r.AA)(c,y);break}case t.c6:{if(d.metric===""){const D=y.getChild(t.LW),b=(0,r.AA)(c,D);d.metric=b.slice(1,-1)}break}case t.d2:{const D=l(c,y,t.c6);D.label=D.label.slice(1,-1),d.labels.push(D);const b=y.getChild(r.Ql);b&&P.errors.push((0,r.xz)(c,b));break}case t.Yq:{d.labels.push(l(c,y,t.IC));const D=y.getChild(r.Ql);D&&P.errors.push((0,r.xz)(c,D));break}case t.R6:{h(c,y,P);break}case t.Fn:{u(c,y,P);break}case t.df:{x(c,y,P);break}case r.Ql:{if(a(y))break;P.errors.push((0,r.xz)(c,y));break}default:{y.type.id===t.ek&&P.errors.push((0,r.xz)(c,y));let D=y.firstChild;for(;D;)m(c,D,P),D=D.nextSibling}}}function a(c){return c.prevSibling?.firstChild?.type.id===t.Fb}function l(c,y,P){const d=(0,r.AA)(c,y.getChild(P)),D=(0,r.AA)(c,y.getChild(t.Lf)),b=(0,r.AA)(c,y.getChild(t.LW)).replace(/^["'`]|["'`]$/g,"");return{label:d,op:D,value:b}}const f=["changes","rate","irate","increase","delta"];function h(c,y,P){const d=P.query,D=y.getChild(t.m3),b=(0,r.AA)(c,D);b==="info"&&P.errors.push({text:"Query parsing is ambiguous.",from:y.from,to:y.to});const E=y.getChild(t.Dh),v=[];let C="";if(f.includes(b)||b.endsWith("_over_time")){let O=(0,r.AA)(c,y).match(/\[(.+)\]/);O?.[1]&&(C=O[1],v.push(O[1]))}const S={id:b,params:v};if(d.operations.unshift(S),E){if((0,r.AA)(c,E)==="(["+C+"])")return;i(c,E,P,S)}}function u(c,y,P){const d=P.query,D=y.getChild(t.xb);let b=(0,r.AA)(c,D);const E=y.getChild(t.hI),v=[];E&&(E.getChild("By")&&b&&(b=`__${b}_by`),E.getChild(t.xB)&&(b=`__${b}_without`),v.push(...(0,r.R1)(c,E,t.IC),...(0,r.R1)(c,E,t.c6)));const C=y.getChild(t.Dh),S={id:b,params:[]};d.operations.unshift(S),i(c,C,P,S),S.params.push(...v)}function i(c,y,P,d){if(y)switch(y.type.id){case t.Dh:{let D=y.firstChild;for(;D;){let b;D.type.id===t.df?b=D:b=D.getChild(t.df),b&&P.errors.push({text:"Query parsing is ambiguous.",from:b.from,to:b.to}),i(c,D,P,d),D=D.nextSibling}break}case t.j_:{d.params.push(parseFloat((0,r.AA)(c,y)));break}case t.LW:{d.params.push((0,r.AA)(c,y).replace(/"/g,""));break}default:m(c,y,P)}}function x(c,y,P){const d=P.query,D=y.firstChild,b=(0,r.AA)(c,D.nextSibling),E=g(c,y.getChild(t.eM)??y.getChild(t.Ue)),v=y.lastChild,C=n.AE[b],S=D.type.id===t.j_,O=v.type.id===t.j_,I=v.type.id===t.df;if(S||m(c,D,P),O)d.operations.push((0,r.rq)(C,c,v,!!E?.isBool));else if(I){const R=(0,r.z9)(v);R?.type.id===t.j_&&d.operations.push((0,r.rq)(C,c,R,!!E?.isBool)),m(c,v,P)}else{d.binaryQueries=d.binaryQueries||[];const R={operator:b,query:{metric:"",labels:[],operations:[]}};E?.isMatcher&&(R.vectorMatchesType=E.matchType,R.vectorMatches=E.matches),d.binaryQueries.push(R),m(c,v,{query:R.query,errors:P.errors})}}function g(c,y){if(y){if(y.getChild("Bool"))return{isBool:!0,isMatcher:!1};{let P="";const d=y.getChild(t.x$);return d&&(P=(0,r.R1)(c,d,t.IC).join(", ")),{isMatcher:!0,isBool:!1,matches:P,matchType:y.getChild(t.On)?"on":"ignoring"}}}}function p(c){return c.labels.length===0&&c.operations.length===0&&!c.metric}},65094:(ee,B,e)=>{"use strict";e.d(B,{AA:()=>l,Ql:()=>t,R1:()=>h,b4:()=>u,qk:()=>s,rq:()=>f,xz:()=>r,z9:()=>n});const t=0;function n(i){return i.firstChild?n(i.firstChild):i}function r(i,x){return{text:l(i,x),from:x.from,to:x.to,parentType:x.parent?.name}}const o=/\$(\w+)|\[\[([\s\S]+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g;function s(i){return i.replace(o,(x,g,p,c,y,P,d)=>{const D=c||d;let b=g,E="0";return p&&(b=p,E="1"),y&&(b=y,E="2"),`__V_${E}__`+b+"__V__"+(D?"__F__"+D+"__F__":"")})}const m=[(i,x)=>`$${i}`,(i,x)=>`[[${i}${x?`:${x}`:""}]]`,(i,x)=>`\${${i}${x?`:${x}`:""}}`];function a(i){return i.replace(/__V_(\d)__(.+?)__V__(?:__F__(\w+)__F__)?/g,(x,g,p,c)=>m[parseInt(g,10)](p,c))}function l(i,x){return x?a(i.substring(x.from,x.to)):""}function f(i,x,g,p){const c=[parseFloat(l(x,g))];return i.comparison&&c.push(p),{id:i.id,params:c}}function h(i,x,g){if(x.type.id===g)return[l(i,x)];const p=[];let c=0,y=x.childAfter(c);for(;y;)p.push(...h(i,y,g)),c=y.to,y=x.childAfter(c);return p}const u=i=>i.split(" ").map(g=>`${g}.*`).join("")},21833:(ee,B,e)=>{"use strict";e.d(B,{r:()=>s});var t=e(74848),n=e(22803),r=e(67458),o=e(63142);function s({title:a,stepNumber:l,markdown:f,children:h}){const u=(0,o.of)(m);return(0,t.jsxs)("div",{className:u.box,children:[l!==void 0&&(0,t.jsx)("div",{className:u.stepNumber,children:l}),(0,t.jsxs)("div",{className:u.boxInner,children:[a&&(0,t.jsx)("div",{className:u.header,children:(0,t.jsx)("span",{children:a})}),(0,t.jsxs)("div",{className:u.body,children:[f&&(0,t.jsx)("div",{dangerouslySetInnerHTML:{__html:(0,r.G)(f)}}),h]})]})]})}const m=a=>({box:(0,n.css)({background:a.colors.background.secondary,padding:a.spacing(1),borderRadius:a.shape.radiu
5s.default,position:"relative"}),boxInner:(0,n.css)({marginLeft:a.spacing(4)}),stepNumber:(0,n.css)({fontWeight:a.typography.fontWeightMedium,background:a.colors.secondary.main,width:"20px",height:"20px",borderRadius:a.shape.radius.circle,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"10px",left:"11px",fontSize:a.typography.bodySmall.fontSize}),header:(0,n.css)({paddingBottom:a.spacing(.5),display:"flex",alignItems:"center",fontFamily:a.typography.fontFamilyMonospace}),body:(0,n.css)({color:a.colors.text.secondary,"p:last-child":{margin:0},a:{color:a.colors.text.link,textDecoration:"underline"}})})},21216:(ee,B,e)=>{"use strict";e.d(B,{k:()=>o});var t=e(74848),n=e(21833),r=e(58469);function o({query:s,queryModeller:m,stepNumber:a,lang:l,onMouseEnter:f,onMouseLeave:h}){return(0,t.jsx)(t.Fragment,{children:s.operations.map((u,i)=>{const x=m.getOperationDef(u.id);if(!x)return`Operation ${u.id} not found`;const g=x.renderer(u,x,"<expr>"),p=x.explainHandler?x.explainHandler(u,x):x.documentation??"no docs";return(0,t.jsx)("div",{onMouseEnter:()=>f?.(u,i),onMouseLeave:()=>h?.(u,i),children:(0,t.jsx)(n.r,{stepNumber:i+a,title:(0,t.jsx)(r.Z,{query:g,lang:l}),markdown:p})},i)})})}},58469:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>m});var t=e(74848),n=e(22803),r=e(28848),o=e.n(r),s=e(63142);function m({query:l,lang:f,className:h}){const u=(0,s.$j)(),i=a(u),x=o().highlight(l,f.grammar,f.name);return(0,t.jsx)("div",{className:(0,n.cx)(i.editorField,"prism-syntax-highlight",h),"aria-label":"selector",dangerouslySetInnerHTML:{__html:x}})}const a=l=>({editorField:(0,n.css)({fontFamily:l.typography.fontFamilyMonospace,fontSize:l.typography.bodySmall.fontSize})})},19150:(ee,B,e)=>{"use strict";e.d(B,{Ag:()=>t,jN:()=>n,n5:()=>r});var t=(o=>(o.Aggregations="Aggregations",o.RangeFunctions="Range functions",o.Functions="Functions",o.BinaryOps="Binary operations",o.Trigonometric="Trigonometric",o.Time="Time Functions",o))(t||{}),n=(o=>(o.Abs="abs",o.Absent="absent",o.AbsentOverTime="absent_over_time",o.Acos="acos",o.Acosh="acosh",o.Asin="asin",o.Asinh="asinh",o.Atan="atan",o.Atanh="atanh",o.Avg="avg",o.AvgOverTime="avg_over_time",o.BottomK="bottomk",o.Ceil="ceil",o.Changes="changes",o.Clamp="clamp",o.ClampMax="clamp_max",o.ClampMin="clamp_min",o.Cos="cos",o.Cosh="cosh",o.Count="count",o.CountOverTime="count_over_time",o.CountScalar="count_scalar",o.CountValues="count_values",o.DayOfMonth="day_of_month",o.DayOfWeek="day_of_week",o.DayOfYear="day_of_year",o.DaysInMonth="days_in_month",o.Deg="deg",o.Delta="delta",o.Deriv="deriv",o.DoubleExponentialSmoothing="double_exponential_smoothing",o.DropCommonLabels="drop_common_labels",o.Exp="exp",o.Floor="floor",o.Group="group",o.HistogramQuantile="histogram_quantile",o.HistogramAvg="histogram_avg",o.HistogramCount="histogram_count",o.HistogramSum="histogram_sum",o.HistogramFraction="histogram_fraction",o.HistogramStddev="histogram_stddev",o.HistogramStdvar="histogram_stdvar",o.HoltWinters="holt_winters",o.Hour="hour",o.Idelta="idelta",o.Increase="increase",o.Info="info",o.Irate="irate",o.LabelJoin="label_join",o.LabelReplace="label_replace",o.Last="last",o.LastOverTime="last_over_time",o.Ln="ln",o.Log10="log10",o.Log2="log2",o.Max="max",o.MaxOverTime="max_over_time",o.Min="min",o.MinOverTime="min_over_time",o.Minute="minute",o.Month="month",o.Pi="pi",o.PredictLinear="predict_linear",o.Present="present",o.PresentOverTime="present_over_time",o.Quantile="quantile",o.QuantileOverTime="quantile_over_time",o.Rad="rad",o.Rate="rate",o.Resets="resets",o.Round="round",o.Scalar="scalar",o.Sgn="sgn",o.Sin="sin",o.Sinh="sinh",o.Sort="sort",o.SortDesc="sort_desc",o.Sqrt="sqrt",o.Stddev="stddev",o.StddevOverTime="stddev_over_time",o.Sum="sum",o.SumOverTime="sum_over_time",o.Tan="tan",o.Tanh="tanh",o.Time="time",o.Timestamp="timestamp",o.TopK="topk",o.Vector="vector",o.Year="year",o.Addition="__addition",o.Subtraction="__subtraction",o.MultiplyBy="__multiply_by",o.DivideBy="__divide_by",o.Modulo="__modulo",o.Exponent="__exponent",o.NestedQuery="__nested_query",o.EqualTo="__equal_to",o.NotEqualTo="__not_equal_to",o.GreaterThan="__greater_than",o.LessThan="__less_than",o.GreaterOrEqual="__greater_or_equal",o.LessOrEqual="__less_or_equal",o))(n||{}),r=(o=>(o.Rate="rate",o.Histogram="histogram",o.Binary="binary",o))(r||{})},62382:(ee,B,e)=>{"use strict";e.d(B,{$i:()=>l,Dr:()=>m});var t=e(74529),n=e(25229),r=e(74261),o=e(15083),s=e(17548);const m="10m",a=h=>`${h.type}|${h.name}|${JSON.stringify(h.labels??"")}`;class l{constructor(u){this.applyInterpolation=(x,g)=>x,this.cache=new Map;const i=u.overlapString;if((0,t.di)(i)){const x=(0,t.E9)(i);this.overlapWindowMs=(0,t.WT)(x)}else{const x=(0,t.E9)(m);this.overlapWindowMs=(0,t.WT)(x)}this.getTargetSignature=u.getTargetSignature,u.applyInterpolation&&(this.applyInterpolation=u.applyInterpolation)}requestInfo(u){const i=u.range.from.valueOf(),x=u.range.to.valueOf(),g=u.rangeRaw?.to?.toString()==="now";let p=g,c;const y=new Map;
5u.targets.forEach(P=>{let d=`${u.dashboardUID}|${u.panelId}|${P.refId}`,D=this.getTargetSignature(u,P);y.set(d,D)});for(const[P,d]of y){let D=this.cache.get(P);if(D?.signature!==d?p=!1:(c=D?.prevTo??1/0,p=x>c&&i<=c),!p)break}if(p&&c){let P=Math.max(c-this.overlapWindowMs,i);const d=(0,n.KQ)(x),D=(0,n.KQ)((0,r.rs)(P,u.intervalMs));u={...u,range:{...u.range,from:D,to:d}}}else y.forEach((P,d)=>{this.cache.delete(d)});return{requests:[u],targetSignatures:y,shouldCache:g}}procFrames(u,i,x){if(i?.shouldCache){const g=u.range.from.valueOf(),p=u.range.to.valueOf(),c=new Map;x.forEach(P=>{let d=`${u.dashboardUID}|${u.panelId}|${P.refId}`,D=c.get(d);D||(D=[],c.set(d,D)),D.push(P)});let y=[];c.forEach((P,d)=>{let D=(d?this.cache.get(d)?.frames:null)??[];P.forEach(E=>{if(E.length===0||E.fields.length===0)return;let v=a(E.fields[1]),C=D.find(S=>a(S.fields[1])===v);if(!C)D.push(E);else{let S=C.fields.map(R=>R.values),O=E.fields.map(R=>R.values),I=(0,o.c)(S,O);if(I){for(let R=0;R<I.length;R++)C.fields[R].values=I[R],C.fields[R].config.displayNameFromDS!==E.fields[R].config.displayNameFromDS&&(C.fields[R].config.displayNameFromDS=E.fields[R].config.displayNameFromDS);C.length=C.fields[0].values.length}}});let b=[];D.forEach(E=>{let v=E.fields.map(O=>O.values);const C=f(u,P,this.applyInterpolation);let S=(0,o.F)(v,g-C,p);if(S[0].length>0){for(let O=0;O<S.length;O++)E.fields[O].values=S[O];b.push(E)}}),this.cache.set(d,{signature:i.targetSignatures.get(d),frames:b,prevTo:p}),y.push(...b)}),x=y.map(P=>({...P,fields:P.fields.map(d=>({...d,config:{...d.config},values:d.values.slice()}))}))}return x}}function f(h,u,i){if(h.targets[0].datasource?.type!=="prometheus")return 0;const x=h.targets.find(p=>p.refId===u[0].refId);let g=h.intervalMs;if(x?.interval){const p=s.intervalToMs(i(x.interval));p>h.intervalMs&&(g=p)}return g}},70210:(ee,B,e)=>{"use strict";e.d(B,{Bm:()=>S,J3:()=>g,L:()=>O,hF:()=>E});var t=e(2543),n=e.n(t),r=e(1906),o=e(39443),s=e(95004),m=e(16515),a=e(739),l=e(41119),f=e(11576),h=e(78282);const u=/^[+-]?inf(?:inity)?$/i,i=(I,R)=>R.app===r.Jk.Explore&&(I.meta?.custom?.resultType==="vector"||I.meta?.custom?.resultType==="scalar")?!0:R.targets.find(L=>L.refId===I.refId)?.format==="table",x=(I,R)=>I.meta?.type===o.m.HeatmapCells?!1:R.targets.find(L=>L.refId===I.refId)?.format==="heatmap";function g(I,R,T){I.data.forEach(Z=>{const ne=R.targets.find(te=>te.refId===Z.refId);ne&&ne.legendFormat==="__auto"&&Z.fields.forEach(te=>{if(te.labels?.__name__&&te.labels?.__name__===te.name){const Y={...te,name:s.Bc};te.config.displayNameFromDS=(0,m.Ct)(Y,Z,I.data)}})});const[L,K]=(0,t.partition)(I.data,Z=>i(Z,R)),A=c(L),[W,N]=(0,t.partition)(K,Z=>Z.meta?.custom?.resultType==="exemplar"),{exemplarTraceIdDestinations:w}=T,j=W.map(Z=>{if(w?.length)for(const ne of w){const te=Z.fields.find(Y=>Y.name===ne.name);if(te){const Y=P(ne);te.config.links=te.config.links?.length?[...te.config.links,...Y]:Y}}return{...Z,meta:{...Z.meta,dataTopic:a.QR.Annotations}}}),[V,U]=(0,t.partition)(N,Z=>x(Z,R));V.forEach(Z=>{if(Z.name==null){let ne=Z.fields.find(te=>te.type===s.PU.number);if(ne){let te=ne.labels?.le;te&&(Z.name=te,ne.config.displayNameFromDS=te)}}});const F=(0,t.groupBy)(V,Z=>Z.refId);let M=[];for(const Z in F){const ne=F[Z],te=(0,t.groupBy)(ne,Y=>{const Q=Y.fields.find(J=>J.type===s.PU.number);if(Q?.labels&&p in Q.labels){const{le:J,...q}=Q?.labels;return Object.values(q).join()}return Object.values(Q?.labels??[]).join()});(0,t.forOwn)(te,(Y,Q)=>{const J=Y.sort(S);M.push(v(C(J)))})}const H=U.map(Z=>({...Z,meta:{...Z.meta,preferredVisualisationType:"graph"}})),_=(0,t.flatten)(M);return{...I,data:[...H,...A,..._,...j]}}const p="le";function c(I){if(I.length===0||I.length===1&&I[0].length===0)return I;const R=(0,t.groupBy)(I,"refId"),T=Object.keys(R);return T.map(K=>{const A=y(T.length,K),W=b({data:[],valueName:A}),N=D([]),w=[];
5R[K].forEach(M=>{const _=M.fields[1]?.labels??{};Object.keys(_).sort().forEach(Z=>{w.some(ne=>ne.name===Z)||w.push({name:Z,config:{filterable:!0},type:s.PU.string,values:[]})})});let j=-1/0,V=!1;R[K].forEach(M=>{N.config.interval??=M.fields[0]?.config.interval;const H=M.fields[0]?.values??[],_=M.fields[1]?.values??[];H.forEach(Z=>{N.values.push(Z),Z<j&&(V=!0),j=Z}),_.forEach(Z=>{W.values.push(O(Z));const ne=M.fields[1].labels??{};w.forEach(te=>te.values.push(d(ne,te.name)))})});const U=[N,...w,W],F={refId:K,fields:U,meta:{...R[K][0].meta,preferredVisualisationType:"rawPrometheus"},length:N.values.length};return V?(0,l.ES)(F,0):F})}function y(I,R=""){return I>1?`Value #${R}`:"Value"}function P(I){const R=[];if(I.datasourceUid){const L=(0,h.l)().getInstanceSettings(I.datasourceUid);L&&R.push({title:I.urlDisplayLabel||`Query with ${L?.name}`,url:"",internal:{query:{query:"${__value.raw}",queryType:"traceql"},panelsState:{trace:{spanId:'${__data.fields["span_id"]}'}},datasourceUid:I.datasourceUid,datasourceName:L?.name??"Data source not found"}})}return I.url&&R.push({title:I.urlDisplayLabel||`Go to ${I.url}`,url:I.url,targetBlank:!0}),R}function d(I,R){return I.hasOwnProperty(R)?I[R]:""}function D(I,R=!1){return{name:s.LE,type:s.PU.time,config:{},values:I.map(T=>R?T[0]:T[0]*1e3)}}function b({data:I,valueName:R=s.Bc,parseValue:T=!0,labels:L,displayNameFromDS:K}){return{name:R,type:s.PU.number,display:(0,f.J)(),config:{displayNameFromDS:K},labels:L,values:I.map(A=>T?O(A[1]):A[1])}}function E(I){const R=I.__name__||"";delete I.__name__;const T=Object.entries(I).map(L=>`${L[0]}="${L[1]}"`).join(",");return`${R}{${T}}`}function v(I){if(I.length===0||I.length===1&&I[0].length===0)return[];const R=I[0].fields.find(L=>L.type===s.PU.time),T=I.map(L=>{let K=L.fields.find(A=>A.type===s.PU.number);return{...K,name:K.config.displayNameFromDS}});return[{...I[0],meta:{...I[0].meta,type:o.m.HeatmapRows},fields:[R,...T]}]}function C(I){for(let R=I.length-1;R>0;R--){const T=I[R].fields.find(K=>K.type===s.PU.number),L=I[R-1].fields.find(K=>K.type===s.PU.number);if(!T||!L)throw new Error("Prometheus heatmap transform error: data should be a time series");for(let K=0;K<T.values.length;K++){const A=L.values[K]||[0];T.values[K]-=A,T.values[K]<1e-9&&(T.values[K]=0)}}return I}function S(I,R){let T,L;try{T=O(I.fields[1].state?.displayName??I.name??I.fields[1].name),L=O(R.fields[1].state?.displayName??R.name??R.fields[1].name)}catch(K){return console.error(K),0}return T>L?1:T<L?-1:0}function O(I){return u.test(I)?I[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:parseFloat(I)}},66758:(ee,B,e)=>{"use strict";e.d(B,{B4:()=>o,N1:()=>n,fD:()=>t,m_:()=>r});var t=(s=>(s.Low="Low",s.Medium="Medium",s.High="High",s.None="None",s))(t||{}),n=(s=>(s.Cortex="Cortex",s.Mimir="Mimir",s.Prometheus="Prometheus",s.Thanos="Thanos",s))(n||{}),r=(s=>
5(s.Auto="__auto",s.Verbose="__verbose",s.Custom="__custom",s))(r||{}),o=(s=>(s[s.LabelNames=0]="LabelNames",s[s.LabelValues=1]="LabelValues",s[s.MetricNames=2]="MetricNames",s[s.VarQueryResult=3]="VarQueryResult",s[s.SeriesQuery=4]="SeriesQuery",s[s.ClassicQuery=5]="ClassicQuery",s))(o||{})},31200:(ee,B,e)=>{"use strict";e.d(B,{$H:()=>n,Nc:()=>t,Rq:()=>r,p0:()=>m});const t=a=>a===""||r(a)?a:`"${a}"`,n=a=>{if(r(a))return a;let f="U__";for(let h=0;h<a.length;h++){const u=a[h],i=a.codePointAt(h);u==="_"?f+="__":i!==void 0&&o(u,h)?f+=u:i===void 0||!s(i)?f+="_FFFD_":(f+="_",f+=i.toString(16),f+="_"),i!==void 0&&i>65535&&h++}return f},r=a=>{if(a.length===0)return!1;for(let l=0;l<a.length;l++){const f=a[l];if(!o(f,l))return!1}return!0},o=(a,l)=>{const f=a.codePointAt(0);return f===void 0?!1:f>=97&&f<=122||f>=65&&f<=90||f===95||f===58||f>=48&&f<=57&&l>0},s=a=>a>=0&&a<=1114111,m=a=>{const l=[],f=/(=~|!=|!~|=)/;let h="",u="",i=!1,x="";const g=()=>{const p=x.match(f);if(p){const c=p[0];[h,u]=x.split(c),l.push(`${t(h.trim())}${c}"${u.slice(1,-1)}"`)}};for(const p of a)p==='"'&&x[x.length-1]!=="\\"?(i=!i,x+=p):p===","&&!i?(g(),x=""):x+=p;return x&&g(),l.join(",")}},61190:(ee,B,e)=>{"use strict";e.d(B,{L:()=>n,y:()=>r});var t=e(43173);function n(o){return{grafana_version:t.$.buildInfo.version,plugin_type:String(o.type),plugin_version:o.info.version,plugin_id:o.id,plugin_name:o.name}}function r(o){return{...n(o.meta),datasource_uid:o.uid}}},77010:(ee,B,e)=>{"use strict";e.d(B,{G:()=>a});var t=e(96540),n=e(31595),r=e(17564),o=e(27489),s=e(61190);const m="grafana_plugin_";function a(){const f=(0,n.Q)();return(0,t.useMemo)(()=>{if(!f)throw new Error("No PluginContext found. The usePluginInteractionReporter() hook can only be used from a plugin.");const h=(0,r.S)(f)?(0,s.y)(f.instanceSettings):(0,s.L)(f.meta);return(u,i)=>{if(!l(u))throw new Error(`Interactions reported in plugins should start with: "${m}".`);return(0,o.rR)(u,{...i,...h})}},[f])}function l(f){return f.startsWith(m)&&f.length>m.length}},33749:(ee,B,e)=>{"use strict";e.d(B,{fX:()=>r,nB:()=>n,n_:()=>t,p6:()=>o});var t=(s=>(s.DashboardView="dashboard-view",s.DataRequest="data-request",s))(t||{});const n=s=>!!s.payload.page,r=s=>!!s.payload.interactionName,o=s=>!!s.payload.experimentId},27489:(ee,B,e)=>{"use strict";e.d(B,{G$:()=>o,Jy:()=>s,Xp:()=>a,rR:()=>m});var t=e(43173),n=e(36490),r=e(78646);const o=l=>{(0,r.x$)().addEvent({type:r.on.MetaAnalytics,payload:l})},s=()=>{const l=n.Ny.getLocation(),f=`${t.$.appSubUrl??""}${l.pathname}${l.search}${l.hash}`;(0,r.x$)().addEvent({type:r.on.Pageview,payload:{page:f}})},m=(l,f)=>{t.$.reportingStaticContext&&t.$.reportingStaticContext instanceof Object&&(f={...f,...t.$.reportingStaticContext}),(0,r.x$)().addEvent({type:r.on.Interaction,payload:{interactionName:l,properties:f}})},a=(l,f,h)=>{(0,r.x$)().addEvent({type:r.on.ExperimentView,payload:{experimentId:l,experimentGroup:f,experimentVariant:h}})}},80839:(ee,B,e)=>{"use strict";e.d(B,{s:()=>u});var t=e(74848),n=e(96540),r=e(48480),o=e(29246),s=e(85629),m=e(18857),a=e(41654),l=e(63509),f=e(78282),h=e(36580);class u extends n.PureComponent{constructor(x){super(x),this.dataSourceSrv=(0,f.l)(),this.state={},this.onChange=(g,p)=>{if(p.action==="clear"&&this.props.onClear){this.props.onClear();return}const c=this.dataSourceSrv.getInstanceSettings(g.value);c&&(this.props.onChange(c),this.setState({error:void 0}))}}static{this.defaultProps={autoFocus:!1,openMenuOnFocus:!1,placeholder:"Select data source"}}componentDidMount(){const{current:x}=this.props;this.dataSourceSrv.getInstanceSettings(x)||this.setState({error:"Could not find data source "+x})}getCurrentValue(){const{current:x,hideTextValue:g,noDefault:p}=this.props;if(!x&&p)return;const c=this.dataSourceSrv.getInstanceSettings(x);if(c)return{label:c.name.slice(0,37),value:c.uid,imgUrl:c.meta.info.logos.small,hideText:g,meta:c.meta};const y=(0,r.Iz)(x);return y===h.dR.uid||y===h.dR.name?{label:y,value:y,hideText:g}:{label:(y??"no name")+" - not found",value:y??void 0,imgUrl:"",hideText:g}}getDataSourceOptions(){const{alerting:x,tracing:g,metrics:p,mixed:c,dashboard:y,variables:P,annotations:d,pluginId:D,type:b,filter:E,logs:v}=this.props;return this.dataSourceSrv.getList({alerting:x,tracing:g,metrics:p,logs:v,dashboard:y,mixed:c,variables:P,annotations:d,pluginId:D,filter:E,type:b}).map(S=>({value:S.name,label:`${S.name}${S.isDefault?" (default)":""}`,imgUrl:S.meta.info.logos.small,meta:S.meta}))}render(){const{autoFocus:x,onBlur:g,onClear:p,openMenuOnFocus:c,placeholder:y,width:P,inputId:d,disabled:D=!1,isLoading:b=!1}=this.props,{error:E}=this.state,v=this.getDataSourceOptions(),C=this.getCurrentValue(),S=typeof p=="function";return(0,t.jsx)("div",{"aria-label":"Data source picker select container","data-testid":s.Tp.components.DataSourcePicker.container,children:(0,t.jsx)(m.l6,{isLoading:b,disabled:D,"aria-label":"Select a data source","data-testid":s.Tp.components.DataSourcePicker.inputV2,inputId:d||"data-source-picker",className:"ds-picker select-container",isMulti:!1,isClearable:S,backspaceRemovesValue:!1,onChange:this.onChange,options:v,autoFocus:x,onBlur:g,width:P,openMenuOnFocus:c,maxMenuHeight:500,placeholder:y,noOptionsMessage:"No datasources found",value:C??null,invali
5d:!!E||!!this.props.invalid,getOptionLabel:O=>O.meta&&(0,o.x)(O.meta.signature)&&O!==C?(0,t.jsxs)(a.B,{alignItems:"center",justifyContent:"space-between",children:[(0,t.jsx)("span",{children:O.label})," ",(0,t.jsx)(l.B,{status:O.meta.signature})]}):O.label||""})})}}},43122:(ee,B,e)=>{"use strict";e.d(B,{f:()=>t,p:()=>n});let t=()=>{throw new Error("EmbeddedDashboard requires runtime initialization")};function n(r){t=r}},47700:(ee,B,e)=>{"use strict";e.d(B,{N:()=>r,d:()=>o});var t=e(74848);let n;function r(s){n=s}function o(s){return n?(0,t.jsx)(n,{...s}):null}},14477:(ee,B,e)=>{"use strict";e.d(B,{a:()=>n,e:()=>r});var t=e(74848);let n=({message:o})=>(0,t.jsxs)("div",{children:["Unable to render data: ",o,"."]});function r(o){n=o}},60311:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>r,m:()=>n});var t=e(74848);let n=()=>(0,t.jsx)("div",{children:"PanelRenderer can only be used after Grafana instance has been started."});function r(o){n=o}},88806:(ee,B,e)=>{"use strict";e.d(B,{V:()=>n,l:()=>r});var t=e(74848);let n=({children:o})=>(0,t.jsx)("div",{children:o});function r(o){n=o}},92243:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{CopyPanelEvent:()=>l.ah,DataSourcePicker:()=>N.s,DataSourceWithBackend:()=>I.iy,EchoEventType:()=>o.on,EmbeddedDashboard:()=>F.f,FakeEchoSrv:()=>o.c_,FolderPicker:()=>se.d,GrafanaBootConfig:()=>b.p,HealthCheckError:()=>I.b1,HealthStatus:()=>I.VQ,HistoryWrapper:()=>a.K9,LocationServiceProvider:()=>a._K,MetaAnalyticsEventName:()=>E.n_,PanelDataErrorView:()=>L.a,PanelRenderer:()=>T.m,PluginPage:()=>W.V,QueryEditorWithMigration:()=>q,RefreshEvent:()=>l._,RuntimeDataSource:()=>d,ScopesContext:()=>D.j,StreamingFrameAction:()=>m.Kh,ThemeChangedEvent:()=>l.E8,TimeRangeUpdatedEvent:()=>l.sR,config:()=>b.$,createDataSourcePluginEventProperties:()=>w.y,createMonitoringLogger:()=>O.DW,createPluginEventProperties:()=>w.L,createQueryRunner:()=>A.d,featureEnabled:()=>S.a,frameToMetricFindValue:()=>R.$h,getAppEvents:()=>l.J7,getBackendSrv:()=>t.AI,getCorrelationsService:()=>oe.r,getDataSourceSrv:()=>n.l,getEchoSrv:()=>o.x$,getGrafanaLiveSrv:()=>m.oF,getLimitedComponentsToRender:()=>p.CP,getLocationSrv:()=>r.X,getObservablePluginComponents:()=>g.z,getObservablePluginLinks:()=>x.m,getPluginImportUtils:()=>v.o,getRunRequest:()=>A.XJ,getTemplateSrv:()=>s.w,hasAllPermissions:()=>Z,hasAnyPermission:()=>ne,hasPermission:()=>H,hasPermissionInMetadata:()=>_,isExperimentViewEvent:()=>E.p6,isExpressionReference:()=>I.s9,isFetchError:()=>t.NF,isInteractionEvent:()=>E.fX,isMigrationHandler:()=>J.LZ,isPageviewEvent:()=>E.nB,isPluginExtensionComponent:()=>p.aR,isPluginExtensionLink:()=>p.DG,loadPluginCss:()=>v.PL,locationSearchToObject:()=>a.SE,locationService:()=>a.Ny,logDebug:()=>O.MD,logError:()=>O.vV,logInfo:()=>O.fH,logMeasurement:()=>O.l$,logWarning:()=>O.FF,migrateQuery:()=>J.aX,migrateRequest:()=>J.xt,navigationLogger:()=>a.Lc,registerEchoBackend:()=>o.pl,renderLimitedComponents:()=>p.RC,reportExperimentView:()=>C.Xp,reportInteraction:()=>C.rR,reportMetaAnalytics:()=>C.G$,reportPageview:()=>C.Jy,setAppEvents:()=>l.H8,setBackendSrv:()=>t.u5,setChromeHeaderHeightHook:()=>U._,setCorrelationsService:()=>oe.l,setCurrentUser:()=>c.l,setDataSourceSrv:()=>n.h,setEchoSrv:()=>o.H2,setEmbeddedDashboard:()=>F.p,setFolderPicker:()=>se.N,setGrafanaLiveSrv:()=>m.S8,setLocationService:()=>a.vG,setLocationSrv:()=>r.T,setPluginComponentHook:()=>f.A,setPluginComponentsHook:()=>h.R,setPluginFunctionsHook:()=>i.U,setPluginImportUtils:()=>v.se,setPluginLinksHook:()=>u.q,setQueryRunnerFactory:()=>A.HC,setReturnToPreviousHook:()=>V._,setRunRequest:()=>A.pC,setTemplateSrv:()=>s.d,toDataQueryError:()=>K.u,toDataQueryResponse:()=>R.bE,useChromeHeaderHeight:()=>U.k,useLocationService:()=>a.at,usePluginComponent:()=>f.S,usePluginComponents:()=>h.f,usePluginFunctions:()=>i.W,usePluginInteractionReporter:()=>j.G,usePluginLinks:()=>u.U,usePluginUserStorage:()=>X.D,useReturnToPrevious:()=>V.i,useScopes:()=>D.b});var t=e(68143),n=e(78282),r=e(48072),o=e(78646),s=e(2863),m=e(33184),a=e(36490),l=e(75234),f=e(33005),h=e(33604),u=e(46907),i=e(33707),x=e(58873),g=e(2874),p=e(22099),c=e(6201),y=e(94644),P=e(11594);class d extends y.mA{constructor(ie,fe){const pe={name:"RuntimeDataSource-"+ie,uid:fe,type:ie,id:1,readOnly:!0,jsonData:{},access:"direct",meta:{id:ie,name:"RuntimeDataSource-"+ie,type:P.QE.datasource,info:{author:{name:""},description:"",links:[],logos:{large:"",small:""},screenshots:[],updated:"",version:""},module:"",baseUrl:""}};super(pe),this.instanceSettings=pe}testDatasource(){return Promise.resolve({status:"success",message:""})}}var D=e(69896),b=e(43173),E=e(33749),v=e(39698),C=e(27489),S=e(62061),O=e(25992),I=e(36580),R=e(38866),T=e(60311),L=e(14477),K=e(97534),A=e(83734),W=e(88806),N=e(80839),w=e(61190),j=e(77010),V=e(41071),U=e(92293),F=e(43122),M=e(7918);const H=ae=>(0,M.ZU)(ae,(0,c.H)()),_=(ae,ie)=>(0,M.T6)(ae,ie),Z=ae=>(0,M.Fj)(ae,(0,c.H)()),ne=ae=>(0,M.jW)(ae,(0,c.H)());var te=e(74848),Y=e(96540),Q=e(70255),J=e(38353);function q(ae){return fe=>{const[pe,de]=(0,Y.useState)(!1),[le,me]=(0,Y.useState)(fe.query);return(0,Y.useEffect)(()=>{fe.query&&(0,J.LZ)(fe.datasource)?(0,J.aX)(fe.datasource,fe.query).then(De=>{fe.onChange(De),me(De),de(!0)}):de(!0)},[]),(0,Y.useEffect)(()=>{me(fe.query)},[fe.query]),pe?(0,te.jsx)(ae,{...fe,query:le}):(0,te.jsx)(Q.A,{containerTestId:"react-loading-skeleton-testid",height:75})}}var X=e(55315),se=e(47700),oe=e(25076)},25076:(ee,B,e)=>{"use strict";e.d(B,{l:()=>n,r:()=>r});let t;function n(o){t=o}function r(){return t}},78646:(ee,B,e)=>{"use strict";e.d(B,{H2:()=>r,c_:()=>m,on:()=>t,pl:()=>s,x$:()=>o});var t=(a=>(a.Performance="performance",a.MetaAnalytics="meta-analytics",a.Pageview="pageview",a.Interaction="interaction",a.ExperimentView="experimentview",a.GrafanaJavascriptAgent="grafana-javascript-agent",a))(t||{});let n;function r(a){if(n instanceof m)for(const l of n.buffer)a.addEvent(l.event,l.meta);n=a}function o(){return n||(n=new m),n}const s=a=>{o().addBackend(a)};class m{constructor(){this.buffer=[]}flush(){this.buffer=[]}addBackend(l){}addEvent(l,f){this.buffer.push({event:l,meta:f})}}},36490:(ee,B,e)=>{"use strict";e.d(B,{K9:()=>h,Lc:()=>p,Ny:()=>i,SE:()=>u,_K:()=>P,at:()=>y,vG:()=>x});var t=e(74848),n=e(44499),r=e(96540),o=e(49426),s=e(5556),m=e(37615),a=e(60379),l=e(20720),f=e(43173);class h{constructor(D){this.history=D||n.zR({basename:f.$.appSubUrl??"/"}),this.locationObservable=new o.t(this.history.location),this.history.listen(b=>{this.locationObservable.next(b)}),this.partial=this.partial.bind(this),this.push=this.push.bind(this),this.replace=this.replace.b
5ind(this),this.getSearch=this.getSearch.bind(this),this.getHistory=this.getHistory.bind(this),this.getLocation=this.getLocation.bind(this)}getLocationObservable(){return this.locationObservable.asObservable()}getHistory(){return this.history}getSearch(){return new URLSearchParams(this.history.location.search)}partial(D,b){const E=this.history.location,v=this.getSearchObject();for(const S in D)D[S]===null||D[S]===void 0?delete v[S]:v[S]=D[S];const C=s.kM.renderUrl(E.pathname,v);b?this.history.replace(C,this.history.location.state):this.history.push(C,this.history.location.state)}push(D){this.history.push(D)}replace(D){this.history.replace(D)}reload(){const D=this.history.location.state?.routeReloadCounter;this.history.replace({...this.history.location,state:{routeReloadCounter:D?D+1:1}})}getLocation(){return this.history.location}getSearchObject(){return u(this.history.location.search)}update(D){if((0,m.l)("LocationSrv","update","partial, push or replace"),D.partial&&D.query)this.partial(D.query,D.partial);else{const b={pathname:D.path};D.query&&(b.search=s.kM.toUrlParams(D.query)),D.replace?this.replace(b):this.push(b)}}}function u(d){let D=typeof d=="number"?String(d):d;return D.length>0?D.startsWith("?")?s.kM.parseKeyValue(D.substring(1)):s.kM.parseKeyValue(D):{}}let i=new h;const x=d=>{throw new Error("locationService can be only overriden in test environment")},g=(0,a.h)("Router"),p=g.logger;(0,l.h)("location",i,g);const c=r.createContext(void 0);function y(){const d=(0,r.useContext)(c);if(!d)throw new Error("useLocationService must be used within a LocationServiceProvider");return d}const P=({service:d,children:D})=>(0,t.jsx)(c.Provider,{value:d,children:D})},48072:(ee,B,e)=>{"use strict";e.d(B,{T:()=>n,X:()=>r});let t;function n(o){t=o}function r(){return t}},83734:(ee,B,e)=>{"use strict";e.d(B,{HC:()=>n,XJ:()=>m,d:()=>r,pC:()=>s});let t;const n=a=>{if(t)throw new Error("Runner should only be set when Grafana is starting.");t=a},r=()=>{if(!t)throw new Error("`createQueryRunner` can only be used after Grafana instance has started.");return t()};let o;function s(a){if(o)throw new Error("runRequest function should only be set once, when Grafana is starting.");o=a}function m(){if(!o)throw new Error("getRunRequest can only be used after Grafana instance has started.");return o}},69896:(ee,B,e)=>{"use strict";e.d(B,{b:()=>s,j:()=>o});var t=e(96540),n=e(24120),r=e(88483);const o=(0,t.createContext)(void 0);function s(){const m=(0,t.useContext)(o);return(0,n.A)(m?.stateObservable??new r.c,m?.state),(0,t.useMemo)(()=>m?{state:m.state,stateObservable:m.stateObservable,changeScopes:m.changeScopes,setReadOnly:m.setReadOnly,setEnabled:m.setEnabled}:void 0,[m,m?.state])}},78282:(ee,B,e)=>{"use strict";e.d(B,{h:()=>n,l:()=>r});let t;function n(o){t=o}function r(){return t}},33184:(ee,B,e)=>{"use strict";e.d(B,{Kh:()=>t.Kh,S8:()=>r,oF:()=>o});var t=e(51388);let n;const r=s=>{n=s},o=()=>n},2874:(ee,B,e)=>{"use strict";e.d(B,{h:()=>n,z:()=>r});let t;function n(o){if(t)throw new Error("setGetObservablePluginComponents() function should only be called once, when Grafana is starting.");t=o}function r(o){if(!t)throw new Error("getObservablePluginComponents() can only be used after the Grafana instance has started.");return t(o)}},58873:(ee,B,e)=>{"use strict";e.d(B,{C:()=>n,m:()=>r});let t;function n(o){if(t)throw new Error("setGetObservablePluginLinks() function should only be called once, when Grafana is starting.");t=o}function r(o){if(!t)throw new Error("getObservablePluginLinks() can only be used after the Grafana instance has started.");return t(o)}},33005:(ee,B,e)=>{"use strict";e.d(B,{A:()=>n,S:()=>r});let t;function n(o){if(t)throw new Error("setPluginComponentHook() function should only be called once, when Grafana is starting.");t=o}function r(o){if(!t)throw new Error("setPluginComponentHook(options) can only be used after the Grafana instance has started.");return t(o)}},33604:(ee,B,e)=>{"use strict";e.d(B,{R:()=>n,f:()=>r});let t;function n(o){if(t)throw new Error("setPluginComponentsHook() function should only be called once, when Grafana is starting.");t=o}function r(o){if(!t)throw new Error("setPluginComponentsHook(options) can only be used after the Grafana instance has started.");return t(o)}},33707:(ee,B,e)=>{"use strict";e.d(B,{U:()=>n,W:()=>r});let t;function n(o){if(t)throw new Error("setUsePluginFunctionsHook() function should only be called once, when Grafana is starting.");t=o}function r(o){if(!t)throw new Error("usePluginFunctions(options) can only be used after the Grafana instance has started.");return t(o)}},46907:(ee,B,e)=>{"use strict";e.d(B,{U:()=>r,q:()=>n});let t;function n(o){if(t)throw new Error("setPluginLinksHook() function should only be called once, when Grafana is starting.");t=o}function r(o){if(!t)throw new Error("setPluginLinksHook(options) can only be used after the Grafana instance has started.");return t(o)}},22099:(ee,B,e)=>{"use strict";e.d(B,{CP:()=>m,DG:()=>
5o,RC:()=>a,aR:()=>s});var t=e(74848),n=e(96540),r=e(54092);function o(l){return l?l.type===r.u.link&&("path"in l||"onClick"in l):!1}function s(l){return l?l.type===r.u.component&&"component"in l:!1}function m({props:l,components:f,limit:h,pluginId:u}){if(!f.length)return null;const i=[];for(const x of f){const{meta:g}=x;if(!(u&&typeof u=="string"&&u!==g.pluginId)&&!(u&&Array.isArray(u)&&!u.includes(g.pluginId))&&!(u instanceof RegExp&&!u.test(g.pluginId))){if(h===void 0){i.push(x);continue}if(n.createElement(x,l)!==null&&i.push(x),i.length>=h)break}}return i}function a({props:l,components:f,limit:h,pluginId:u}){const i=m({props:l,components:f,limit:h,pluginId:u});return i?.length?(0,t.jsx)(t.Fragment,{children:i.map(x=>(0,t.jsx)(x,{...l},x.meta.id))}):null}},2863:(ee,B,e)=>{"use strict";e.d(B,{d:()=>n,w:()=>r});let t;const n=o=>{t=o},r=()=>t},6201:(ee,B,e)=>{"use strict";e.d(B,{H:()=>r,l:()=>n});let t=null;function n(o){if(t)throw new Error("User should only be set once, when Grafana is starting.");t=o}function r(){if(!t)throw new Error("User can only be used after Grafana instance has started.");return t}},36580:(ee,B,e)=>{"use strict";e.d(B,{iy:()=>O,dR:()=>b,b1:()=>v,VQ:()=>C,s9:()=>E});var t=e(62467),n=e(75505),r=e(44240),o=e(63720),s=e(66847),m=e(94644),a=e(48480),l=e(1906),f=e(38619),h=e(77154),u=e(35814),i=e(27489),x=e(43173),g=e(78282),p=e(68143),c=e(33184),y=e(51388),P=e(38866);function d(T){const{intervalMs:L,maxDataPoints:K,requestId:A,panelId:W,queryCachingTTL:N,range:{from:w,to:j}}=T;if(!T.targets.length)return(0,t.of)({data:[]});const V={intervalMs:L,maxDataPoints:K,queryCachingTTL:N,timeRange:{from:w.valueOf().toString(),to:j.valueOf().toString(),timezone:T.timezone}};return(0,p.AI)().fetch({url:`/api/public/dashboards/${x.$.publicDashboardAccessToken}/panels/${W}/query`,method:"POST",data:V,requestId:A}).pipe((0,o.n)(U=>(0,t.of)((0,P.bE)(U,T.targets))),(0,s.W)(U=>(0,t.of)((0,P.bE)(U))))}var D=e(55315);const b=Object.freeze({type:"__expr__",uid:"__expr__",name:"Expression"});function E(T){if(!T)return!1;const L=typeof T=="string"?T:T.type;return L===b.type||L===b.name||L==="-100"}class v extends Error{constructor(L,K){super(L),this.details=K,this.name="HealthCheckError"}}var C=(T=>(T.Unknown="UNKNOWN",T.OK="OK",T.Error="ERROR",T))(C||{}),S=(T=>(T.PluginID="X-Plugin-Id",T.DatasourceUID="X-Datasource-Uid",T.DashboardUID="X-Dashboard-Uid",T.PanelID="X-Panel-Id",T.PanelPluginId="X-Panel-Plugin-Id",T.QueryGroupID="X-Query-Group-Id",T.FromExpression="X-Grafana-From-Expr",T.SkipQueryCache="X-Cache-Skip",T))(S||{});class O extends m.mA{constructor(L){super(L),this.streamOptionsProvider=R,this.userStorage=new D.X(L.t
5ype)}query(L){if(x.$.publicDashboardAccessToken)return d(L);const{intervalMs:K,maxDataPoints:A,queryCachingTTL:W,range:N,requestId:w,hideFromInspector:j=!1}=L;let V=L.targets,U=!1;const F=new Set,M=new Set,H=V.map(te=>{let Y=this.getRef(),Q=this.id,J=!0;if(E(te.datasource))return U=!0,{...te,datasource:b};if(te.datasource){const q=(0,g.l)().getInstanceSettings(te.datasource,L.scopedVars);if(!q)throw new Error(`Unknown Datasource: ${JSON.stringify(te.datasource)}`);const X=q.rawRef??(0,a.p$)(q),se=q.id;(X.uid!==Y.uid||Q!==se)&&(Y=X,Q=se,J=!1)}return Y.type?.length&&F.add(Y.type),Y.uid?.length&&M.add(Y.uid),{...J?this.applyTemplateVariables(te,L.scopedVars,L.filters):te,datasource:Y,datasourceId:Q,intervalMs:K,maxDataPoints:A,queryCachingTTL:W}});if(!H.length)return(0,t.of)({data:[]});const _={queries:H,from:N?.from.valueOf().toString(),to:N?.to.valueOf().toString()},Z=L.headers??{};Z["X-Plugin-Id"]=Array.from(F).join(", "),Z["X-Datasource-Uid"]=Array.from(M).join(", ");let ne="/api/ds/query?ds_type="+this.type;if(x.$.featureToggles.queryServiceFromExplore&&L.app===l.Jk.Explore){const te=x.$.featureToggles.queryService,Y=x.$.featureToggles.grafanaAPIServerWithExperimentalAPIs;!te&&!Y?console.warn("feature toggle queryServiceFromExplore also requires the queryService to be running"):ne=`/apis/query.grafana.app/v0alpha1/namespaces/${x.$.namespace}/query?ds_type=${this.type}`}return x.$.featureToggles.queryServiceFromUI&&(x.$.featureToggles.queryService||x.$.featureToggles.grafanaAPIServerWithExperimentalAPIs?(!U&&M.size,ne=`/apis/query.grafana.app/v0alpha1/namespaces/${x.$.namespace}/query?ds_type=' + this.type`):console.warn("feature toggle queryServiceFromUI also requires the queryService to be running")),U&&(Z["X-Grafana-From-Expr"]="true",ne+="&expression=true"),w&&(ne+=`&requestId=${w}`),L.dashboardUID&&(Z["X-Dashboard-Uid"]=L.dashboardUID,L.panelId&&(Z["X-Panel-Id"]=`${L.panelId}`)),L.panelPluginId&&(Z["X-Panel-Plugin-Id"]=`${L.panelPluginId}`),L.queryGroupId&&(Z["X-Query-Group-Id"]=`${L.queryGroupId}`),L.skipQueryCache&&(Z["X-Cache-Skip"]="true"),(0,p.AI)().fetch({url:ne,method:"POST",data:_,requestId:w,hideFromInspector:j,headers:Z}).pipe((0,o.n)(te=>{const Y=(0,P.bE)(te,H);return Y.data?.length&&Y.data.find(Q=>Q.meta?.channel)?I(Y,L,this.streamOptionsProvider):(0,t.of)(Y)}),(0,s.W)(te=>(0,t.of)((0,P.bE)(te))))}getRequestHeaders(){const L={};return L["X-Plugin-Id"]=this.type,L["X-Datasource-Uid"]=this.uid,L}interpolateVariablesInQueries(L,K,A){return L.map(W=>this.applyTemplateVariables(W,K,A))}applyTemplateVariables(L,K,A){return L}async getResource(L,K,A){const W=this.getRequestHeaders();return(await(0,n.s)((0,p.AI)().fetch({...A,method:"GET",headers:A?.headers?{...A.headers,...W}:W,params:K??A?.params,url:`/api/datasources/uid/${this.uid}/resources/${L}`}))).data}async postResource(L,K,A){const W=this.getRequestHeaders();return(await(0,n.s)((0,p.AI)().fetch({...A,method:"POST",headers:A?.headers?{...A.headers,...W}:W,data:K??{...K},url:`/api/datasources/uid/${this.uid}/resources/${L}`}))).data}async callHealthCheck(){return(0,n.s)((0,p.AI)().fetch({method:"GET",url:`/api/datasources/uid/${this.uid}/health`,showErrorAlert:!1,headers:this.getRequestHeaders()})).then(L=>L.data).catch(L=>{let K={plugin_id:this.meta?.id||"",plugin_version:this.meta?.info?.version||"",datasource_healthcheck_status:L?.data?.status||"error",datasource_healthcheck_message:L?.data?.message||""};return(0,i.rR)("datasource_health_check_completed",K),L.data})}async testDatasource(){return this.callHealthCheck().then(L=>L.status==="OK"?{status:"success",message:L.message}:Promise.reject({status:"error",message:L.message,error:new v(L.message,L.details)}))}}function I(T,L,K){const A=(0,c.oF)();if(!A)return(0,t.of)(T);const W=[],N=[];for(const w of T.data){const j=(0,f.DG)(w.meta?.channel);if(j){const V=w;N.push(A.getDataStream({addr:j,buffer:K(L,V),frame:(0,h.Nw)(w)}))}else W.push(w)}return W.length&&N.push((0,t.of)({...T,data:W})),N.length===1?N[0]:(0,r.h)(...N)}const R=(T,L)=>{const K={maxLength:T.maxDataPoints??500,action:y.Kh.Append};return T.rangeRaw?.to==="now"&&(K.maxDelta=T.range.to.valueOf()-T.range.from.valueOf()),K};O=(0,u.Y)(O)},92293:(ee,B,e)=>{"use strict";e.d(B,{_:()=>n,k:()=>r});let t;const n=o=>{t=o},r=()=>(t||console.error("useChromeHeaderHeight hook not found"),t?.())},25992:(ee,B,e)=>{"use strict";e.d(B,{DW:()=>f,FF:()=>s,MD:()=>m,fH:()=>o,l$:()=>l,vV:()=>a});var t=e(32631),n=e(37930),r=e(43173);function o(h,u){r.$.grafanaJavascriptAgent.enabled&&t.P.api.pushLog([h],{level:n.$b.INFO,context:u})}function s(h,u){r.$.grafanaJavascriptAgent.enabled&&t.P.api.pushLog([h],{level:n.$b.WARN,context:u})}function m(h,u){r.$.grafanaJavascriptAgent.enabled&&t.P.api.pushLog([h],{level:n.$b.DEBUG,context:u})}function a(h,u){r.$.grafanaJavascriptAgent.enabled&&t.P.api.pushError(h,{context:u})}function l(h,u,i){r.$.grafanaJavascriptAgent.enabled&&t.P.api.pushMeasurement({type:h,values:u},{context:i})}function f(h,u){const i=x=>({source:h,...u,...x});return{logDebug:(x,g)=>m(x,i(g)),logInfo:(x,g)=>o(x,i(g)),logWarning:(x,g)=>s(x,i(g)),logError:(x,g)=>a(x,i(g)),logMeasurement:(x,g,p)=>l(x,g,i(p))}}},38353:(ee,B,e)=>{"use strict";e.d(B,{LZ:()=>o,aX:()=>m,xt:()=>a});var t=e(43173),n=e(68143),r=e(36580);function o(l){return l instanceof r.iy&&"hasBackendMigration"in l&&"shouldMigrate"in l}async function s(l){if(!(t.$.featureToggles.grafanaAPIServerWithExperimentalAPIs||t.$.featureToggles.datasourceAPIServers))return console.warn("migrateQuery is only available with the experimental API server"),l;const i=`/apis/${`${l[0].datasource?.type?.replace(/^(grafana-)?(.*?)(-datasource)?$/,"$2")}.datasource.grafana.app`}/v0alpha1/namespaces/${t.$.namespace}/queryconvert`,x={queries:l.map(p=>({...p,JSON:p}))};return(await(0,n.AI)().post(i,x)).queries.map(p=>p.JSON)}async function m(l,f){return!l.hasBackendMigration||!l.shouldMigrate(f)?f:(await s([f]))[0]}async function a(l,f){if(!l.hasBackendMigration||!f.targets.some(u=>l.shouldMigrate(u)))return f;const h=await s(f.targets);return{...f,targets:h}}},39698:(ee,B,e)=>{"use strict";e.d(B,{PL:()=>n,o:()=>s,se:()=>o});var t=e(43173);async function n(m){try{const a=t.$.bootData.user.theme==="light"?m.light:m.dark;return window.System.import(a)}catch(a){console.error(a)}}let r;function o(m){if(r)throw new Error("pluginImportUtils should only be set once, when Grafana is starting.");r=m}function s(){if(!r)throw new Error("pluginImportUtils can only be used after Grafana instance has started.");return r}},38866:(ee,B,e)=>{"use strict";e.d(B,{$h:()=>u,bE:()=>a});var t=e(28105),n=e(77154),r=e(41119),o=e(95004),s=e(97534);const m={severity:"info",text:"Cached response"};function a(i,x){const g={data:[],state:t.Gu.Done},p="traceId"in i?i.traceId:void 0;p!=null&&(g.traceIds=[p]);const c=i;
5if(c.data?.results){const y=c.data.results,P=x?.length?x.map(b=>b.refId):Object.keys(y),d=l(c),D=[];for(const b of P){const E=y[b];E&&(E.refId=b,D.push(E))}for(const b of D){if(b.error){const E={refId:b.refId,message:b.error,status:b.status};p!=null&&(E.traceId=p),g.error||(g.error={...E}),g.errors?g.errors.push({...E}):g.errors=[{...E}],g.state=t.Gu.Error}if(b.frames?.length){for(let E of b.frames){d&&(E=f(E));const v=(0,n.or)(E);v.refId||(v.refId=b.refId),g.data.push(v)}continue}if(b.series?.length)for(const E of b.series)E.refId||(E.refId=b.refId),g.data.push((0,r.Vc)(E));if(b.tables?.length)for(const E of b.tables)E.refId||(E.refId=b.refId),g.data.push((0,r.Vc)(E))}}return c.status&&c.status!==200&&(g.state!==t.Gu.Error&&(g.state=t.Gu.Error),g.error||(g.error=(0,s.u)(i))),g}function l(i){const x=i?.headers;return!x||!x.get?!1:x.get("X-Cache")==="HIT"}function f(i){return{...i,schema:{...i.schema,fields:[...i.schema?.fields??[]],meta:{...i.schema?.meta,notices:[...i.schema?.meta?.notices??[],m],isCachedResponse:!0}}}}function h(i){const x=a(i);if(x.error?.data?.message)return{status:"error",message:x.error.data.message,details:x.error?.data?.error?{message:x.error.data.error}:void 0};if(x.error?.refId&&x.error?.message)return{status:"error",message:x.error.message};throw i}function u(i){if(!i||!i.length)return[];const x=[];let g=i.fields.find(p=>p.type===o.PU.string);if(g||(g=i.fields.find(p=>p.type!==o.PU.time)),g)for(let p=0;p<g.values.length;p++)x.push({text:""+g.values[p]});return x}},41071:(ee,B,e)=>{"use strict";e.d(B,{_:()=>n,i:()=>r});let t;const n=o=>{t=o},r=()=>t?t():()=>console.error("ReturnToPrevious hook not found")},97534:(ee,B,e)=>{"use strict";e.d(B,{u:()=>t});function t(n){const r=n||{};if(!r.message){if(typeof n=="string")return{message:n};let o="Query error";r.message?o=r.message:r.data&&r.data.message&&r.data?.message!=="Query data error"?o=r.data.message:r?.data?.message==="Query data error"&&r?.data?.error||r.data&&r.data.error?o=r.data.error:r.status&&(o=`Query error: ${r.status} ${r.statusText}`),r.message=o}return r}},55315:(ee,B,e)=>{"use strict";e.d(B,{D:()=>h,X:()=>f});var t=e(2543),n=e.n(t),r=e(75505),o=e(31595),s=e(43173),m=e(68143);const a=`/apis/userstorage.grafana.app/v0alpha1/namespaces/${s.$.namespace}/user-storage`;async function l(u){try{const{data:i,...x}=await(0,r.s)((0,m.AI)().fetch({...u,url:a+u.url,data:u.body}));return{data:i,meta:x}}catch(i){return u.manageError?u.manageError(i):{error:i}}}class f{constructor(i){this.service=i,this.userUID=s.$.bootData.user.uid===""?s.$.bootData.user.id.toString():s.$.bootData.user.uid,this.resourceName=`${i}:${this.userUID}`,this.canUseUserStorage=s.$.bootData.user.isSignedIn}
5async init(){if(this.storageSpec!==void 0)return;const i=await l({url:`/${this.resourceName}`,method:"GET",showErrorAlert:!1});"error"in i?((0,t.get)(i,"error.status")!==404&&console.error("Failed to get user storage",i.error),this.storageSpec=null):this.storageSpec=i.data.spec}async getItem(i){return this.canUseUserStorage?(await this.init(),this.storageSpec?this.storageSpec.data[i]:localStorage.getItem(`${this.resourceName}:${i}`)):localStorage.getItem(`${this.resourceName}:${i}`)}async setItem(i,x){if(!this.canUseUserStorage){localStorage.setItem(`${this.resourceName}:${i}`,x);return}const g={data:{[i]:x}};if(await this.init(),!this.storageSpec){await l({url:"/",method:"POST",body:{metadata:{name:this.resourceName,labels:{user:this.userUID,service:this.service}},spec:g}}),this.storageSpec=g;return}this.storageSpec.data[i]=x,await l({headers:{"Content-Type":"application/merge-patch+json"},url:`/${this.resourceName}`,method:"PATCH",body:{spec:g}})}}function h(){const u=(0,o.Q)();if(!u)throw new Error("No PluginContext found. The usePluginUserStorage() hook can only be used from a plugin.");return new f(u?.meta.id)}},97474:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>r,QB:()=>o});var t=e(739);const n="12.0.2",r={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:t.wV.Auto,showValue:t.yL.Auto,stacking:t.gs.None,xTickLabelRotation:0,xTickLabelSpacing:0},o={fillOpacity:80,gradientMode:t.on.None,lineWidth:1}},48390:(ee,B,e)=>{"use strict";e.d(B,{K:()=>r});var t=e(739);const n="12.0.2",r={displayMode:t.eX.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:t.TZ.Auto,showUnfilled:!0,sizing:t.T6.Auto,valueMode:t.$l.Color}},53478:(ee,B,e)=>{"use strict";e.d(B,{K:()=>n});const t="12.0.2",n={selectedSeries:0}},74194:(ee,B,e)=>{"use strict";e.d(B,{K:()=>r});var t=e(739);const n="12.0.2",r={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:t.T6.Auto}},48850:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>n});const t="12.0.2",n={layers:[]},r={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var o=(m=>(m.Details="details",m.None="none",m))(o||{}),s=(m=>(m.Coords="coords",m.Fit="fit",m.Zero="zero",m))(s||{})},97644:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>m});var t=e(739);const n="12.0.2";var r=(a=>(a.Opacity="opacity",a.Scheme="scheme",a))(r||{}),o=(a=>(a.Exponential="exponential",a.Linear="linear",a))(o||{}),s=(a=>(a.X="x",a.Xy="xy",a.Y="y",a))(s||{});const m={calculate:!1,cellGap:1,cellValues:{},color:{scheme:"Oranges",fill:"dark-orange",reverse:!1,exponent:.5,steps:64},exemplars:{color:"rgba(255,0,255,0.7)"},filterValues:{le:1e-9},legend:{show:!0},selectionMode:"x",showValue:t.yL.Auto,tooltip:{mode:t.$N.Single,yHistogram:!1,showColorScale:!1}}},55448:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>r,QB:()=>o});var t=e(739);const n="12.0.2",r={bucketCount:30,bucketOffset:0},o={fillOpacity:80,gradientMode:t.on.None,lineWidth:1}},25346:(ee,B,e)=>{"use strict";e.d(B,{K:()=>n});const t="12.0.2",n={showImage:!0}},23130:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>m});const t="12.0.2";var n=(a=>(a.Donut="donut",a.Pie="pie",a))(n||{}),r=(a=>(a.Name="name",a.Percent="percent",a.Value="value",a))(r||{}),o=(a=>(a.Percent="percent",a.Value="value",a))(o||{});const s={values:[]},m={displayLabels:[]}},7698:(ee,B,e)=>{"use strict";e.d(B,{K:()=>r});var t=e(739);const n="12.0.2",r={colorMode:t.yp.Value,graphMode:t.$p.Area,justifyMode:t.F8.Auto,percentChangeColorMode:t.CD.Standard,showPercentChange:!1,textMode:t.SV.Auto,wideLayout:!0}},16880:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>r,QB:()=>o});var t=e(739);const n="12.0.2",r={alignValue:"left",mergeValues:!0,perPage:20,rowHeight:.9,showValue:t.yL.Auto},o={fillOpacity:70,lineWidth:0}},93384:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>r,QB:()=>o});var t=e(739);const n="12.0.2",r={colWidth:.9,perPage:20,rowHeight:.9,showValue:t.yL.Auto},o={fillOpacity:70,lineWidth:1}},59740:(ee,B,e)=>{"use strict";e.d(B,{K:()=>r});var t=e(739);const n="12.0.2",r={cellHeight:t.qM.Sm,footer:{show:!1,countRows:!1,reducer:[]},frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]}},51250:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>m});const t="12.0.2";var n=(a=>(a.Code="code",a.HTML="html",a.Markdown="markdown",a))(n||{}),r=(a=>(a.Go="go",a.Html="html",a.Json="json",a.Markdown="markdown",a.Plaintext="plaintext",a.Sql="sql",a.Typescript="typescript",a.Xml="xml",a.Yaml="yaml",a))(r||{});const o="plaintext",s={language:"plaintext",showLineNumbers:!1,showMiniMap:!1},m={content:`# Title 6
7For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)`,mode:"markdown"}},81166:(ee,B,e)=>{"use strict";e.d(B,{KQ:()=>a,QB:()=>m});const t="12.0.2";var n=(l=>(l.Circle="circle",l.Square="square",l))(n||{}),r=(l=>(l.Auto="auto",l.Manual="manual",l))(r||{}),o=(l=>(l.Lines="lines",l.Points="points",l.PointsAndLines="points+lines",l))(o||{});const s={id:""},m={fillOpacity:50,show:"points"},a={series:[]}},21275:(ee,B,e)=>{"use strict";e.d(B,{$C:()=>P,CO:()=>m,GW:()=>v,OA:()=>d,Ol:()=>i,QB:()=>E,WL:()=>p,Yb:()=>h,Ye:()=>C,ZG:()=>l,aD:()=>r,bf:()=>o,bt:()=>D,dM:()=>g,lt:()=>c,rw:()=>s,ss:()=>b,yV:()=>y});const t={tags:[]},n={exclude:!1,ids:[]},r={list:[]},o={builtIn:0,enable:!0,hide:!1},s={allowCustomValue:!0,includeAll:!1,multi:!1,options:[],skipUrlSync:!1};var m=(S=>(S[S.never=0]="never",S[S.onDashboardLoad=1]="onDashboardLoad",S[S.onTimeRangeChanged=2]="onTimeRangeChanged",S))(m||{}),a=(S=>(S[S.dontHide=0]="dontHide",S[S.hideLabel=1]="hideLabel",S[S.hideVariable=2]="hideVariable",S))(a||{}),l=(S=>(S[S.alphabeticalAsc=1]="alphabeticalAsc",S[S.alphabeticalCaseInsensitiveAsc=5]="alphabeticalCaseInsensitiveAsc",S[S.alphabeticalCaseInsensitiveDesc=6]="alphabeticalCaseInsensitiveDesc",S[S.alphabeticalDesc=2]="alphabeticalDesc",S[S.disabled=0]="disabled",S[S.naturalAsc=7]="naturalAsc",S[S.naturalDesc=8]="naturalDesc",S[S.numericalAsc=3]="numericalAsc",S[S.numericalDesc=4]="numericalDesc",S))(l||{});const f={asDropdown:!1,includeVars:!1,keepTime:!1,tags:[],targetBlank:!1};var h=(S=>(S.ContinuousBlPu="continuous-BlPu",S.ContinuousBlYlRd="continuous-BlYlRd",S.ContinuousBlues="continuous-blues",S.ContinuousGrYlRd="continuous-GrYlRd",S.ContinuousGreens="continuous-greens",S.ContinuousPurples="continuous-purples",S.ContinuousRdYlGr="continuous-RdYlGr",S.ContinuousReds="continuous-reds",S.ContinuousYlBl="continuous-YlBl",S.ContinuousYlRd="continuous-YlRd",S.Fixed="fixed",S.PaletteClassic="palette-classic",S.PaletteClassicByName="palette-classic-by-name",S.Shades="shades",S.Thresholds="thresholds",S))(h||{});const u={h:9,w:12,x:0,y:0};var i=(S=>
7(S.Absolute="absolute",S.Percentage="percentage",S))(i||{});const x={steps:[]};var g=(S=>(S.RangeToText="range",S.RegexToText="regex",S.SpecialValue="special",S.ValueToText="value",S))(g||{}),p=(S=>(S.Empty="empty",S.False="false",S.NaN="nan",S.Null="null",S.NullAndNan="null+nan",S.True="true",S))(p||{});const c={hidden:!1,quick_ranges:[],refresh_intervals:["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"]};var y=(S=>(S[S.Crosshair=1]="Crosshair",S[S.Off=0]="Off",S[S.Tooltip=2]="Tooltip",S))(y||{});const P=0,d={links:[],repeatDirection:"h",targets:[],transformations:[],transparent:!1},D={overrides:[]},b={id:""},E={links:[],mappings:[]},v={collapsed:!1,panels:[]},C={editable:!0,fiscalYearStartMonth:0,graphTooltip:0,links:[],panels:[],schemaVersion:41,tags:[],timezone:"browser"}},78947:(ee,B,e)=>{"use strict";e.d(B,{Bj:()=>bt,ET:()=>st,FM:()=>Oe,G9:()=>we,IP:()=>Cn,SR:()=>ye,X1:()=>Et,bt:()=>E,ft:()=>Ge,kH:()=>ke,l_:()=>Xt,m6:()=>Se,ns:()=>_e,pK:()=>Mt,t1:()=>Be,uB:()=>At,xE:()=>Dt});const t=()=>({kind:"AnnotationQuery",spec:n()}),n=()=>({enable:!1,hide:!1,iconColor:"",name:"",builtIn:!1}),r=()=>({}),o=()=>({kind:"",spec:{}}),s=()=>({exclude:!1,ids:[]}),m=()=>"Off",a=()=>l(),l=()=>({kind:"Panel",spec:f()}),f=()=>({id:0,title:"",description:"",links:[],data:u(),vizConfig:D()}),h=()=>({title:"",url:""}),u=()=>({kind:"QueryGroup",spec:i()}),i=()=>({queries:[],transformations:[],queryOptions:d()}),x=()=>({kind:"PanelQuery",spec:g()}),g=()=>({query:o(),refId:"",hidden:!1}),p=()=>({kind:"",spec:c()}),c=()=>({id:"",options:{}}),y=()=>({id:""}),P=()=>"series",d=()=>({}),D=()=>({kind:"",spec:b()}),b=()=>({pluginVersion:"",options:{},fieldConfig:E()}),E=()=>({defaults:v(),overrides:[]}),v=()=>({}),C=()=>S(),S=()=>({type:"value",options:{}}),O=()=>"value",I=()=>({}),R=()=>({type:"range",options:{from:0,to:0,result:I()}}),T=()=>({type:"regex",options:{pattern:"",result:I()}}),L=()=>({type:"special",options:{match:"true",result:I()}}),K=()=>"true",A=()=>({mode:"absolute",steps:[]}),W=()=>"absolute",N=()=>({value:0,color:""}),w=()=>({mode:"thresholds"}),j=()=>"thresholds",V=()=>"min",U=()=>({id:""}),F=()=>({kind:"LibraryPanel",spec:M()}),M=()=>({id:0,title:"",libraryPanel:H()}),H=()=>({name:"",uid:""}),_=()=>({kind:"GridLayout",spec:Z()}),Z=()=>({items:[]}),ne=()=>({kind:"GridLayoutItem",spec:te()}),te=()=>({x:0,y:0,width:0,height:0,element:Y()}),Y=()=>({kind:"ElementReference",name:""}),Q=()=>({mode:J,value:""}),J="variable",q=()=>({kind:"GridLayoutRow",spec:X()}),X=()=>({y:0,collapsed:!1,title:"",elements:[]}),se=()=>({mode:J,value:""}),oe=()=>({kind:"RowsLayout",spec:ae()}),ae=()=>({rows:[]}),ie=()=>({kind:"RowsLayoutRow",spec:fe()}),fe=()=>({layout:_()}),pe=()=>({kind:"ConditionalRenderingGroup",spec:de()}),de=()=>({visibility:"show",condition:"and",items:[]}),le=()=>({kind:"ConditionalRenderingVariable",spec:me()}),me=()=>({variable:"",operator:"equals",value:""}),De=()=>({kind:"ConditionalRenderingData",spec:Te()}),Te=()=>({value:!1}),Ne=()=>({kind:"ConditionalRenderingTimeRangeSize",spec:Ce()}),Ce=()=>({value:""}),He=()=>({kind:"AutoGridLayout",spec:ke()}),ke=()=>({maxColumnCount:3,columnWidthMode:"standard",rowHeightMode:"standard",fillScreen:!1,items:[]}),Me=()=>({kind:"AutoGridLayoutItem",spec:$e()}),$e=()=>({element:Y()}),tt=()=>({mode:J,value:""}),Ke=()=>({kind:"TabsLayout",spec:Re()}),Re=()=>({tabs:[]}),Ve=()=>({kind:"TabsLayoutTab",spec:Qe()}),Qe=()=>({layout:_()}),je=()=>({mode:J,value:""}),ze=()=>({title:"",type:"link",icon:"",tooltip:"",tags:[],asDropdown:!1,targetBlank:!1,includeVars:!1,keepTime:!1}),Ye=()=>"link",Ge=()=>({timezone:"browser",from:"now-6h",to:"now",autoRefresh:"",autoRefreshIntervals:["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],hideTimepicker:!1,fiscalYearStartMonth:0}),ce=()=>({display:"Last 6 hours",from:"now-6h",to:"now"}),Pe=()=>Se(),Se=()=>({kind:"QueryVariable",spec:Ee()}),Ee=()=>({name:"",current:{text:"",value:""},hide:"dontHide",refresh:"never",skipUrlSync:!1,query:o(),regex:"",sort:"disabled",options:[],multi:!1,includeAll:!1}),xe=()=>({text:"",value:""}),ye=()=>"dontHide",Oe=()=>"never",we=()=>"disabled",Be=()=>({kind:"TextVariable",spec:Xe()}),Xe=()=>({name:"",current:{text:"",value:""},query:"",hide:"dontHide",skipUrlSync:!1}),st=()=>({kind:"ConstantVariable",spec:lt()}),lt=()=>({name:"",query:"",current:{text:"",value:""},hide:"dontHide",skipUrlSync:!1}),Et=()=>({kind:"DatasourceVariable",spec:Tt()}),Tt=()=>({name:"",pluginId:"",refresh:"never",regex:"",current:{text:"",value:""},options:[],multi:!1,includeAll:!1,hide:"dontHide",skipUrlSync:!1}),Mt=()=>({kind:"IntervalVariable",spec:wt()}),wt=()=>({name:"",query:"",current:{text:"",value:""},options:[],auto:!1,auto_min:"",auto_count:0,refresh:"never",hide:"dontHide",skipUrlSync:!1}),_e=()=>({kind:"CustomVariable",spec:xt()}),xt=()=>({name:"",query:"",current:xe(),options:[],multi:!1,includeAll:!1,hide:"dontHide",skipUrlSync:!1}),At=()=>({kind:"GroupByVariable",spec:bt()}),bt=()=>({name:"",current:{text:"",value:""},options:[],multi:!1,hide:"dontHide",skipUrlSync:!1}),Xt=()=>({kind:"AdhocVariable",spec:Cn()}),Cn=()=>({name:"",baseFilters:[],filters:[],defaultKeys:[],hide:"dontHide",skipUrlSync:!1}),vn=()=>({key:"",operator:"",value:""}),Wn=()=>({text:""}),Dt=()=>({annotations:[],cursorSync:"Off",editable:!0,elements:{},layout:_(),links:[],preload:!1,tags:[],timeSettings:Ge(),title:"",variables:[]})},31114:(ee,B,e)=>{"use strict";e.d(B,{Gu:()=>r,gB:()=>n});var t=e(739);const n={align:"auto",inspect:!1,cellOptions:{type:t.ob.Auto}};var r=(o=>(o.NotStarted="NotStarted",o.Loading="Loading",o.Streaming="Streaming",o.Done="Done",o.Error="Error",o))(r||{})},59857:(ee,B,e)=>{"use strict";e.d(B,{Ye:()=>r,lt:()=>s,rw:()=>o,zL:()=>n});var t=e(21275),n=(x=>(x[x.dontHide=0]="dontHide",x[x.hideLabel=1]="hideLabel",x[x.hideVariable=2]="hideVariable",x))(n||{});const r=t.Ye,o={...t.rw},s=t.lt,m=t.OA,a=t.GW,l=t.QB,f=t.bt,h=t.ss,u=t.bf,i=t.aD},27074:(ee,B,e)=>{"use strict";e.d(B,{l:()=>h});var t=e(74848),n=e(22803),r=e(73287),o=e(27489),s=e(63142),m=e(76319),a=e(37386),l=e(50992),f=e(52308);function h({rawSql:i,datasourceType:x}){const[g,p]=(0,r.A)(),c=(0,s.of)(u),y=d=>{p(d),(0,o.rR)("grafana_sql_preview_copied",{datasource:x})},P=(0,t.jsxs)("div",{className:c.labelWrapper,children:[(0,t.jsx)("span",{className:c.label,children:"Preview"}
7),(0,t.jsx)(m.K,{tooltip:"Copy to clipboard",onClick:()=>y(i),name:"copy"})]});return(0,t.jsx)(a.D,{label:P,className:c.grow,children:(0,t.jsx)(l.B,{language:"sql",height:80,value:(0,f.s)(i),monacoOptions:{scrollbar:{vertical:"hidden"},scrollBeyondLastLine:!1},readOnly:!0,showMiniMap:!1})})}function u(i){return{grow:(0,n.css)({flexGrow:1}),label:(0,n.css)({fontSize:12,fontWeight:i.typography.fontWeightMedium}),labelWrapper:(0,n.css)({display:"flex",justifyContent:"space-between",paddingBottom:i.spacing(.5)})}}},52308:(ee,B,e)=>{"use strict";e.d(B,{s:()=>n});var t=e(27633);function n(r){return t.default.format(r).replace(/(\$ \{ .* \})|(\$ __)|(\$ \w+)/g,o=>o.replace(/\s/g,""))}},31210:(ee,B,e)=>{"use strict";e.d(B,{r:()=>m});var t=e(74848),n=e(96540),r=e(7685),o=e(45861),s=e(71599);function m({action:a,...l}){const[f,h]=(0,n.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.$n,{variant:"primary",size:"sm",onClick:()=>h(!0),...l,style:{width:"fit-content"},children:a.title}),f&&(0,t.jsx)(s.u,{isOpen:!0,title:(0,r.t)("grafana-ui.action-editor.button.confirm-action","Confirm action"),body:a.confirmation,confirmText:(0,r.t)("grafana-ui.action-editor.button.confirm","Confirm"),confirmButtonVariant:"primary",onConfirm:()=>{h(!1),a.onClick(new MouseEvent("click"))},onDismiss:()=>{h(!1)}})]})}},34999:(ee,B,e)=>{"use strict";e.d(B,{F:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(63142),m=e(7685),a=e(45861),l=e(30703),f=e(31286),h=e(66404);const u=r.forwardRef(({title:g,onRemove:p,children:c,buttonContent:y,elevated:P,bottomSpacing:d,topSpacing:D,className:b,severity:E="error",...v},C)=>{const S=(0,s.$j)(),I=x(S,E,!!g,P,d,D),R={error:"alert",warning:"alert",info:"status",success:"status"},T=v.role||R[E],L=v["aria-label"]||g,K=(0,m.t)("grafana-ui.alert.close-button","Close alert");return(0,t.jsx)("div",{ref:C,className:(0,n.cx)(I.wrapper,b),role:T,"aria-label":L,...v,children:(0,t.jsxs)(f.a,{"data-testid":o.Tp.components.Alert.alertV2(E),display:"flex",backgroundColor:E,borderRadius:"default",paddingY:1,paddingX:2,borderStyle:"solid",borderColor:E,alignItems:"stretch",boxShadow:P?"z3":void 0,children:[(0,t.jsx)(f.a,{paddingTop:1,paddingRight:2,children:(0,t.jsx)("div",{className:I.icon,children:(0,t.jsx)(l.I,{size:"xl",name:i(E)})})}),(0,t.jsxs)(f.a,{paddingY:1,grow:1,children:[(0,t.jsx)(h.E,{color:"primary",weight:"medium",children:g}),c&&(0,t.jsx)("div",{className:I.content,children:c})]}),p&&!y&&(0,t.jsx)("div",{className:I.close,children:(0,t.jsx)(a.$n,{"aria-label":K,icon:"times",onClick:p,type:"button",fill:"text",variant:"secondary"})}),p&&y&&(0,t.jsx)(f.a,{marginLeft:1,display:"flex",alignItems:"center",children:(0,t.jsx)(a.$n,{"aria-label":K,variant:"secondary",onClick:p,type:"button",children:y})})]})})});u.displayName="Alert";const i=g=>{switch(g){case"error":return"exclamation-circle";case"warning":return"exclamation-triangle";case"info":return"info-circle";case"success":return"check"}},x=(g,p,c,y,P,d)=>{const D=g.colors[p];return{wrapper:(0,n.css)({flexGrow:1,marginBottom:g.spacing(P??2),marginTop:g.spacing(d??0),position:"relative","&:before":{content:'""',position:"absolute",top:0,left:0,bottom:0,right:0,background:g.colors.background.primary,zIndex:-1}}),icon:(0,n.css)({color:D.text,position:"relative",top:"-1px"}),content:(0,n.css)({color:g.colors.text.primary,paddingTop:c?g.spacing(.5):0,maxHeight:"50vh",overflowY:"auto"}),close:(0,n.css)({position:"relative",color:g.colors.text.secondary,background:"none",display:"flex",top:"-6px",right:"-14px"})}}},99887:(ee,B,e)=>{"use strict";e.d(B,{E:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(70255),s=e(84140),m=e(63142),a=e(21348),l=e(30703),f=e(45967);const h=r.memo(({icon:p,color:c,text:y,tooltip:P,className:d,...D})=>{const b=(0,m.of)(g,c),E=(0,t.jsxs)("div",{className:(0,n.cx)(b.wrapper,d),...D,children:[p&&(0,t.jsx)(l.I,{name:p,size:"sm"}),y]});return P?(0,t.jsx)(f.m,{content:P,placement:"auto",children:E}):E});h.displayName="Badge";const u=({rootProps:p})=>{const c=(0,m.of)(x);return(0,t.jsx)(o.A,{width:60,height:22,containerClassName:c.container,...p})},i=(0,a.j)(h,u),x=()=>({container:(0,n.css)({lineHeight:1})}),g=(p,c)=>{let y=p.visualization.getColorByName(c),P="",d="",D="";return p.isDark?(d=(0,s.A)(y).setAlpha(.15).toString(),P=(0,s.A)(y).setAlpha(.25).toString(),D=(0,s.A)(y).lighten(15).toString()):(d=(0,s.A)(y).setAlpha(.15).toString(),P=(0,s.A)(y).setAlpha(.25).toString(),D=(0,s.A)(y).darken(20).toString()),{wrapper:(0,n.css)({display:"inline-flex",padding:"1px 4px",borderRadius:p.shape.radiu
7s.default,background:d,border:`1px solid ${P}`,color:D,fontWeight:p.typography.fontWeightRegular,gap:p.spacing(.5),fontSize:p.typography.bodySmall.fontSize,lineHeight:p.typography.bodySmall.lineHeight,alignItems:"center"})}}},98005:(ee,B,e)=>{"use strict";e.d(B,{xE:()=>v});var t=e(74848),n=e(22803),r=e(96540),o=e(84140),s=e(38919),m=e(33553),a=e(48588),l=e(55386),f=e(64394),h=e(76637),u=e(85629),i=e(739),x=e(53568),g=e(45861),p=e(21539);const c=18,y=50,P=150,d=1.5,D=1,b=10,E=15;class v extends r.PureComponent{static{this.defaultProps={lcdCellWidth:12,value:{text:"100",numeric:100},displayMode:i.eX.Gradient,orientation:s.wV.Horizontal,field:{min:0,max:100,thresholds:{mode:m.O.Absolute,steps:[]}},itemSpacing:8,showUnfilled:!0,isOverflow:!1}}render(){const{onClick:w,className:j,theme:V}=this.props,{title:U}=this.props.value,F=O(this.props);return w?(0,t.jsxs)("button",{type:"button",style:F.wrapper,onClick:w,className:(0,n.cx)((0,g.my)(V),j),children:[(0,t.jsx)("div",{style:F.title,children:U}),this.renderBarAndValue()]}):(0,t.jsxs)("div",{style:F.wrapper,className:j,children:[U&&(0,t.jsx)("div",{style:F.title,children:U}),this.renderBarAndValue()]})}renderBarAndValue(){switch(this.props.displayMode){case"lcd":return this.renderRetroBars();case"basic":case"gradient":default:return this.renderBasicAndGradientBars()}}renderBasicAndGradientBars(){const{value:w,showUnfilled:j,valueDisplayMode:V}=this.props,U=L(this.props);return(0,t.jsxs)("div",{style:U.wrapper,children:[V!==i.$l.Hidden&&(0,t.jsx)(p.i,{"data-testid":u.Tp.components.Panels.Visualization.BarGauge.valueV2,value:w,style:U.value}),j&&(0,t.jsx)("div",{style:U.emptyBar}),(0,t.jsx)("div",{style:U.bar})]})}renderRetroBars(){const{display:w,field:j,value:V,itemSpacing:U,alignmentFactors:F,orientation:M,lcdCellWidth:H,text:_,valueDisplayMode:Z,theme:ne,isOverflow:te}=this.props,{valueHeight:Y,valueWidth:Q,maxBarHeight:J,maxBarWidth:q,wrapperWidth:X,wrapperHeight:se}=I(this.props),oe=j.min??a.tw,ae=j.max??a.d1,ie=C(M),fe=ae-oe,pe=ie?J:q,de=U,le=Math.floor(pe/H),me=Math.floor((pe-de*le)/le),De=A(this.props),Ne=W(F||V,De,Q,Y,M,te,_),Ce={width:`${X}px`,height:`${se}px`,display:"flex"};ie?(Ce.flexDirection="column-reverse",Ce.alignItems="center"):(Ce.flexDirection="row",Ce.alignItems="center",Ne.justifyContent="flex-end");const He=[];for(let ke=0;ke<le;ke++){const Me=oe+fe/le*ke,$e=R(Me,V,w),tt={borderRadius:ne.shape.radius.default};$e.isLit?tt.backgroundImage=`radial-gradient(${$e.background} 10%, ${$e.backgroundShade})`:tt.backgroundColor=$e.background,ie?(tt.height=`${me}px`,tt.width=`${q}px`,tt.marginTop=`${de}px`):(tt.width=`${me}px`,tt.height=`${J}px`,tt.marginRight=`${de}px`),He.push((0,t.jsx)("div",{style:tt},ke.toString()))}return(0,t.jsxs)("div",{style:Ce,children:[He,Z!==i.$l.Hidden&&(0,t.jsx)(p.i,{"data-testid":u.Tp.components.Panels.Visualization.BarGauge.valueV2,value:V,style:Ne})]})}}function C(N){return N===s.wV.Vertical}function S(N){const{height:w,width:j,alignmentFactors:V,orientation:U,text:F,namePlacement:M}=N,H=V?V.title:N.value.title;if(!H)return{fontSize:0,width:0,height:0,placement:"above"};if(M===i.TZ.Hidden)return{fontSize:0,width:0,height:0,placement:i.TZ.Hidden};if(C(U)){const J=F?.titleSize??14;return{fontSize:J,width:j,height:J*d,placement:"below"}}if(w>40&&M===i.TZ.Auto||M===i.TZ.Top){if(F?.titleSize)return{fontSize:F?.titleSize,width:0,height:F.titleSize*d,placement:"above"};const q=Math.max(Math.min(w*.45,y),17);return{fontSize:q/d,width:0,height:q,placement:"above"}}const te=Math.max(w*.6,c)/d,Y=(0,x.kD)(H,te),Q=Math.min(Y.width+15,j*.4);return{fontSize:F?.titleSize??te,height:0,width:Q,placement:"left"}}function O(N){const w={display:"flex",overflow:"hidden",width:"100%"},j=S(N),V={fontSize:`${j.fontSize}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%",alignItems:"center",alignSelf:"center"};return j.placement==="hidden"?V.display="none":C(N.orientation)?(w.flexDirection="column-reverse",V.textAlign="center"):j.placement==="above"?w.flexDirection="column":(w.flexDirection="row",V.width=`${j.width}px`,V.textAlign="right",V.paddingRight="10px"),{wrapper:w,title:V}}function I(N){const{height:w,width:j,orientation:V,text:U,alignmentFactors:F,valueDisplayMode:M}=N,H=S(N),_=F??N.value,Z=(0,l.cN)(_);let ne=0,te=0,Y=0,Q=0,J=0,q=0;const X=U?.valueSize??Math.max(H.fontSize,12),oe=(0,x.kD)(Z,X).width+b*2;return C(V)?(U?.valueSize?Y=U.valueSize*D:Y=Math.min(Math.max(w*.1,c),y),Q=j,M===i.$l.Hidden&&(Y=0,Q=0),ne=w-(H.height+Y),te=j,J=j,q=w-H.height):(M===i.$l.Hidden?(Y=0,Q=0):(Y=w-H.height,Q=Math.max(Math.min(j*.2,P),oe)),ne=w-H.height,te=j-Q-H.width,H.placement==="above"?(J=j,q=w-H.height):(J=j-H.width,q=w)),{valueWidth:Q,valueHeight:Y,maxBarWidth:te,maxBarHeight:ne,wrapperHeight:q,wrapperW
7idth:J}}function R(N,w,j){if(N===null)return{background:f.F,border:f.F};const V=j?j(N).color:null;return V?w===null||isNaN(w.numeric)||N!==null&&N>w.numeric?{background:(0,o.A)(V).setAlpha(.18).toRgbString(),border:"transparent",isLit:!1}:{background:(0,o.A)(V).setAlpha(.95).toRgbString(),backgroundShade:(0,o.A)(V).setAlpha(.55).toRgbString(),border:(0,o.A)(V).setAlpha(.9).toRgbString(),isLit:!0}:{background:f.F,border:f.F}}function T(N,w,j){const V=Math.min((N-w)/(j-w),1);return isNaN(V)?0:V}function L(N){const{displayMode:w,field:j,value:V,alignmentFactors:U,orientation:F,theme:M,text:H,isOverflow:_}=N,{valueWidth:Z,valueHeight:ne,maxBarHeight:te,maxBarWidth:Y}=I(N),Q=j.min??a.tw,J=j.max??a.d1,q=T(V.numeric,Q,J),X=A(N),se=V.color??f.F,ae=W(U||V,X,Z,ne,F,_,H),ie=w==="basic",fe={display:"flex",flexGrow:1},pe={borderRadius:M.shape.radius.default,position:"relative"},de={background:M.colors.background.secondary,flexGrow:1,display:"flex",borderRadius:M.shape.radius.default,position:"relative"};if(C(F)){const le=Math.max(q*te,1);fe.flexDirection="column",fe.justifyContent="flex-end",pe.transition="height 1s",pe.height=`${le}px`,pe.width=`${Y}px`,de.bottom="-3px",de.width=`${Z}px`,ie?(pe.background=`${(0,o.A)(se).setAlpha(.35).toRgbString()}`,pe.borderTop=`2px solid ${se}`):pe.background=K(N,te)}else{const le=Math.max(q*Y,1);fe.flexDirection="row-reverse",fe.justifyContent="flex-end",fe.alignItems="stretch",pe.transition="width 1s",pe.height=`${te}px`,pe.width=`${le}px`,de.left="-3px",de.height=`${ne}px`,ie?(pe.background=`${(0,o.A)(se).setAlpha(.35).toRgbString()}`,pe.borderRight=`2px solid ${se}`):pe.background=K(N,Y)}return{wrapper:fe,bar:pe,value:ae,emptyBar:de}}function K(N,w){const{field:j,value:V,orientation:U,theme:F}=N,M=C(U)?"0deg":"90deg",H=j.min,_=j.max;let Z="",ne=0,te=(0,h.Hs)(j.color?.mode);if(te.id===f.Y.Thresholds){const Y=j.thresholds;for(let Q=0;Q<Y.steps.length;Q++){const J=Y.steps[Q],q=N.theme.visualization.getColorByName(J.color),X=Y.mode===m.O.Percentage?J.value/100:T(J.value,H,_),se=X*w,oe=Math.round(se-(se-ne)/2),ae=Y.mode===m.O.Percentage?H+(_-H)*X:J.value;if(Z==="")Z=`linear-gradient(${M}, ${q}, ${q}`;else{if(V.numeric<ae)break;ne=se,Z+=` ${oe}px, ${q}`}}return Z+")"}if(te.isContinuous&&te.getColors){const Y=te.getColors(F);for(let Q=0;Q<Y.length;Q++){const J=Y[Q];if(Z==="")Z=`linear-gradient(${M}, ${J} 0px`;else{const X=Q/(Y.length-1)*w;Z+=`, ${J} ${X}px`}}return Z+")"}return V.color??f.F}function A(N){if(N.valueDisplayMode==="text")return N.theme.colors.text.primary;const{value:w}=N;return w.color?w.color:f.F}function W(N,w,j,V,U,F,M){const H={color:w,height:`${V}px`,width:`${j}px`,display:"flex",alignItems:"center",textWrap:"nowrap",lineHeight:D};let _=j;const Z=(0,l.cN)(N);return C(U)?(H.fontSize=M?.valueSize??(0,x.Vr)(Z,_,V,D),H.justifyContent="center"):(H.fontSize=M?.valueSize??(0,x.Vr)(Z,_-b*2,V,D),H.justifyContent="flex-end",H.paddingLeft=`${b}px`,H.paddingRight=`${b+(F?E:0)}px`,_-=b),H}},97611:(ee,B,e)=>{"use strict";e.d(B,{yV:()=>A,yp:()=>R,$p:()=>T,F8:()=>L,SV:()=>K});var t=e(74848),n=e(22803),r=e(96540),o=e(45861),s=e(21539),m=e(84140),a=e(95004),l=e(55386),f=e(739),h=e(8255),u=e(53568),i=e(53431),x=e(30703);const g=({percentChange:W,styles:N})=>{let w;return W>0?w="arrow-up":W<0&&(w="arrow-down"),(0,t.jsxs)("div",{style:N.containerStyles,children:[w&&(0,t.jsx)(x.I,{name:w,height:N.iconSize,width:N.iconSize,viewBox:"6 6 12 12"}),p(W)]})},p=W=>(W/100).toLocaleString(void 0,{style:"percent",maximumSignificantDigits:3}),c=1.2,y=30,P=500;class d{constructor(N){this.props=N;const{width:w,height:j,value:V,text:U}=N;this.valueColor=V.color??"gray",this.panelPadding=j>100?12:8,this.textValues=O(N),this.justifyCenter=S(N.justifyMode,this.textValues.title),this.valueToAlignTo=this.textValues.valueToAlignTo,this.titleToAlignTo=this.textValues.titleToAlignTo,this.titleFontSize=0,this.valueFontSize=0,this.percentFontSize=0,this.chartHeight=0,this.chartWidth=0,this.maxTextWidth=w-this.panelPadding*2,this.maxTextHeight=j-this.panelPadding*2,U&&(U.titleSize&&(this.titleFontSize=U.titleSize,this.titleToAlignTo=void 0),U.valueSize&&(this.valueFontSize=U.valueSize,this.valueToAlignTo=""),U.percentSize&&(this.percentFontSize=U.percentSize))}getTitleStyles(){const N={fontSize:`${this.titleFontSize}px`,lineHeight:c};
7return(this.props.colorMode===R.Background||this.props.colorMode===R.BackgroundSolid)&&(N.color=(0,h.mZ)(this.valueColor,this.props.theme.isDark)),N}getValueStyles(){const N={fontSize:this.valueFontSize,fontWeight:P,lineHeight:c,position:"relative",zIndex:1};switch(this.justifyCenter&&(N.textAlign="center"),this.props.colorMode){case R.Value:N.color=this.valueColor;break;case R.Background:case R.BackgroundSolid:N.color=(0,h.mZ)(this.valueColor,this.props.theme.isDark);break;case R.None:N.color=this.props.theme.colors.text.primary;break}return N}getPercentChangeStyles(N,w,j){const U=this.getValueAndTitleContainerStyles(),F=this.percentFontSize||Math.max(this.valueFontSize/2.5,12);let M=this.percentFontSize?this.percentFontSize-3:Math.max(this.valueFontSize/3,10);const H=this.props.theme.visualization,_=I(N,w,j,H),Z={fontSize:F,fontWeight:P,lineHeight:c,position:"relative",display:"flex",alignItems:"center",gap:Math.max(F/3,4),zIndex:1,color:_};switch(this.justifyCenter&&(Z.textAlign="center"),U.flexDirection==="column"&&F>12&&(Z.marginTop=-(F/4)),U.flexDirection==="row"&&(Z.alignItems="baseline",Z.lineHeight=c*2.5),this.props.colorMode){case R.Background:case R.BackgroundSolid:Z.color=(0,h.mZ)(this.valueColor,this.props.theme.isDark);break}return this.props.textMode===K.None&&(Z.fontSize=(0,u.Vr)(p(N),this.maxTextWidth*.8,this.maxTextHeight*.8,c,void 0,P),M=Z.fontSize*.8),{containerStyles:Z,iconSize:M}}getValueAndTitleContainerStyles(){const N={display:"flex",flexWrap:"wrap"};return this.justifyCenter&&(N.alignItems="center",N.justifyContent="center",N.flexGrow=1,N.gap="0.75ch"),N}getPanelStyles(){const{width:N,height:w,theme:j,colorMode:V,textMode:U}=this.props,F={width:`${N}px`,height:`${w}px`,padding:`${U===K.None?2:this.panelPadding}px`,borderRadius:j.shape.radius.default,position:"relative",display:"flex"},M=j.isDark?1:-.7;switch(V){case R.Background:const H=(0,m.A)(this.valueColor).darken(15*M).spin(8).toRgbString(),_=(0,m.A)(this.valueColor).darken(5*M).spin(-8).toRgbString();F.background=`linear-gradient(120deg, ${H}, ${_})`;break;case R.BackgroundSolid:F.background=(0,m.A)(this.valueColor).toString();break;case R.Value:F.background="transparent";break}return this.justifyCenter&&(F.alignItems="center",F.flexDirection="row"),F}renderChart(){const{sparkline:N,colorMode:w}=this.props;if(!N||N.y?.type!==a.PU.number)return null;let j,V;switch(w){case R.Background:case R.BackgroundSolid:j="rgba(255,255,255,0.4)",V=(0,m.A)(this.valueColor).brighten(40).toRgbString();break;case R.None:case R.Value:default:V=this.valueColor,j=(0,m.A)(this.valueColor).setAlpha(.2).toRgbString();break}const U={custom:{drawStyle:f.GR.Line,lineWidth:1,fillColor:j,lineColor:V}};return(0,t.jsx)("div",{style:this.getChartStyles(),children:(0,t.jsx)(i.O,{height:this.chartHeight,width:this.chartWidth,sparkline:N,config:U,theme:this.props.theme})})}getChartStyles(){return{position:"absolute",right:0,bottom:0}}}class D extends d{constructor(N){super(N);const w=this.titleToAlignTo?.length?.3:1;this.valueToAlignTo.length&&(this.valueFontSize=(0,u.Vr)(this.valueToAlignTo,this.maxTextWidth*w,this.maxTextHeight,c,void 0,P)),this.titleToAlignTo?.length&&(this.titleFontSize=(0,u.Vr)(this.titleToAlignTo,this.maxTextWidth*.6,this.maxTextHeight,c,y),this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize))}getValueAndTitleContainerStyles(){const N=super.getValueAndTitleContainerStyles();return N.flexDirection="row",N.alignItems="center",N.flexGrow=1,this.justifyCenter||(N.justifyContent="space-between"),N}renderChart(){return null}getPanelStyles(){const N=super.getPanelStyles();return N.alignItems="center",N}}class b extends d{constructor(N){super(N);const{width:w,height:j}=N,V=.5,U=.6,F=1-U,M=.4;this.chartWidth=w,this.chartHeight=j*V,this.titleToAlignTo?.length&&(this.titleFontSize=(0,u.Vr)(this.titleToAlignTo,this.maxTextWidth*U,this.maxTextHeight*M,c,y)),this.valueToAlignTo.length&&(this.valueFontSize=(0,u.Vr)(this.valueToAlignTo,this.maxTextWidth*F,this.maxTextHeight*V,c,void 0,P))}getValueAndTitleContainerStyles(){const N=super.getValueAndTitleContainerStyles();return N.flexDirection="row",N.flexGrow=1,this.justifyCenter||(N.justifyContent="space-between"),N}getPanelStyles(){const N=super.getPanelStyles();return N.flexDirection="row",N.justifyContent="space-between",N}}class E extends d{constructor(N){super(N);const{width:w,height:j}=N,V=.15,U=.25;let F=0;
7this.chartHeight=j*U,this.chartWidth=w,this.titleToAlignTo?.length&&(this.titleFontSize=(0,u.Vr)(this.titleToAlignTo,this.maxTextWidth,j*V,c,y),F=this.titleFontSize*c),this.valueToAlignTo.length&&(this.valueFontSize=(0,u.Vr)(this.valueToAlignTo,this.maxTextWidth,this.maxTextHeight-this.chartHeight-F,c,void 0,P)),this.titleToAlignTo?.length&&(this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize)),this.chartHeight=j-this.titleFontSize*c-this.valueFontSize*c}getValueAndTitleContainerStyles(){const N=super.getValueAndTitleContainerStyles();return N.flexDirection="column",N.justifyContent="center",N}getPanelStyles(){const N=super.getPanelStyles();return N.flexDirection="column",N}}class v extends d{constructor(N){super(N);const{height:w}=N,j=.15;let V=0;this.titleToAlignTo?.length&&(this.titleFontSize=(0,u.Vr)(this.titleToAlignTo,this.maxTextWidth,w*j,c,y),V=this.titleFontSize*c),this.valueToAlignTo.length&&(this.valueFontSize=(0,u.Vr)(this.valueToAlignTo,this.maxTextWidth,this.maxTextHeight-V,c,void 0,P)),this.titleToAlignTo?.length&&(this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize))}getValueAndTitleContainerStyles(){const N=super.getValueAndTitleContainerStyles();return N.flexDirection="column",N.flexGrow=1,N}renderChart(){return null}getPanelStyles(){const N=super.getPanelStyles();return N.alignItems="center",N}}function C(W){const{width:N,height:w,sparkline:j}=W;return N/w>2.5&&!W.disableWideLayout?w>50&&j&&j.y.values.length>1?new b(W):new D(W):w>100&&j&&j.y.values.length>1?new E(W):new v(W)}function S(W,N){return W===L.Center?!0:(N??"").length===0}function O(W){const{value:N,alignmentFactors:w,count:j}=W;let{textMode:V}=W;const U=w?w.title:N.title,F=(0,l.cN)(w||N);switch(V===K.Auto&&(j??1)===1&&(V=K.Value),V){case K.Name:return{...N,title:void 0,prefix:void 0,suffix:void 0,text:N.title||"",titleToAlignTo:void 0,valueToAlignTo:U??"",tooltip:(0,l.cN)(N)};case K.Value:return{...N,title:void 0,titleToAlignTo:void 0,valueToAlignTo:F,tooltip:N.title};case K.None:return{numeric:N.numeric,color:N.color,title:void 0,text:"",titleToAlignTo:void 0,valueToAlignTo:"1",tooltip:`Name: ${N.title} 8Value: ${(0,l.cN)(N)}`};case K.ValueAndName:default:return{...N,titleToAlignTo:U,valueToAlignTo:F}}}function I(W,N,w,j){return N===f.CD.SameAsValue?w.color:W*(N===f.CD.Inverted?-1:1)>0?j.getColorByName("green"):j.getColorByName("red")}var R=(W=>(W.Background="background",W.BackgroundSolid="background_solid",W.None="none",W.Value="value",W))(R||{}),T=(W=>(W.None="none",W.Line="line",W.Area="area",W))(T||{}),L=(W=>(W.Auto="auto",W.Center="center",W))(L||{}),K=(W=>(W.Auto="auto",W.Value="value",W.ValueAndName="value_and_name",W.Name="name",W.None="none",W))(K||{});class A extends r.PureComponent{static{this.defaultProps={justifyMode:"auto"}}render(){const{onClick:N,className:w,hasLinks:j,theme:V}=this.props,U=C(this.props),F=U.getPanelStyles(),M=U.getValueAndTitleContainerStyles(),H=U.getValueStyles(),_=U.getTitleStyles(),Z=U.textValues,ne=this.props.value.percentChange,te=this.props.percentChangeColorMode,Y=ne!=null&&!Number.isNaN(ne),Q=j?void 0:Z.tooltip;return N?(0,t.jsxs)("button",{type:"button",className:(0,n.cx)((0,o.my)(V),w),style:F,onClick:N,title:Q,children:[(0,t.jsxs)("div",{style:M,children:[Z.title&&(0,t.jsx)("div",{style:_,children:Z.title}),(0,t.jsx)(s.i,{value:Z,style:H})]}),U.renderChart()]}):(0,t.jsxs)("div",{className:w,style:F,title:Q,children:[(0,t.jsxs)("div",{style:M,children:[Z.title&&(0,t.jsx)("div",{style:_,children:Z.title}),(0,t.jsx)(s.i,{value:Z,style:H}),Y&&(0,t.jsx)(g,{percentChange:ne,styles:U.getPercentChangeStyles(ne,te,H)})]}),U.renderChart()]})}}},88977:(ee,B,e)=>{"use strict";e.d(B,{J:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(23257),s=e.n(o),m=e(63142),a=e(20662);const l=(0,r.forwardRef)(({name:h,value:u,hidden:i,facets:x,onClick:g,className:p,loading:c,searchTerm:y,active:P,style:d,title:D,highlightParts:b,...E},v)=>{const C=(0,m.$j)(),S=f(C),O=y?[y]:[],I=(0,r.useCallback)(T=>{g&&!i&&g(h,u,T)},[g,h,i,u]);let R=u||h;return x&&(R=`${R} (${x})`),(0,t.jsx)("button",{ref:v,onClick:I,style:d,title:D||R,type:"button",role:"option","aria-selected":!!P,className:(0,n.cx)(S.base,P&&S.active,c&&S.loading,i&&S.hidden,p,g&&!i&&S.hover),...E,children:b!==void 0?(0,t.jsx)(a.z,{text:R,highlightClassName:S.matchHighLight,highlightParts:b}):(0,t.jsx)(s(),{textToHighlight:R,searchWords:O,autoEscape:!0,highlightClassName:S.matchHighLight})},R)});l.displayName="Label";const f=h=>({base:(0,n.css)({display:"inline-block",cursor:"pointer",fontSize:h.typography.size.sm,lineHeight:h.typography.bodySmall.lineHeight,backgroundColor:h.colors.background.secondary,color:h.colors.text.primary,whiteSpace:"nowrap",textShadow:"none",padding:h.spacing(.5),borderRadius:h.shape.radiu
8s.default,border:"none",marginRight:h.spacing(1),marginBottom:h.spacing(.5)}),loading:(0,n.css)({fontWeight:h.typography.fontWeightMedium,backgroundColor:h.colors.primary.shade,color:h.colors.text.primary,[h.transitions.handleMotion("no-preference","reduce")]:{animation:"pulse 3s ease-out 0s infinite normal forwards"},"@keyframes pulse":{"0%":{color:h.colors.text.primary},"50%":{color:h.colors.text.secondary},"100%":{color:h.colors.text.disabled}}}),active:(0,n.css)({fontWeight:h.typography.fontWeightMedium,backgroundColor:h.colors.primary.main,color:h.colors.primary.contrastText}),matchHighLight:(0,n.css)({background:"inherit",color:h.components.textHighlight.text,backgroundColor:h.components.textHighlight.background}),hidden:(0,n.css)({opacity:.6,cursor:"default",border:"1px solid transparent"}),hover:(0,n.css)({"&:hover":{opacity:.85,cursor:"pointer"}})})},93256:(ee,B,e)=>{"use strict";e.d(B,{e:()=>s});var t=e(74848),n=e(22803),r=e(96540),o=e(63142);const s=(0,r.forwardRef)(({className:a,children:l,...f},h)=>{const u=(0,o.of)(m);return(0,t.jsx)("div",{ref:h,className:(0,n.cx)("button-group",u.wrapper,a),...f,children:l})});s.displayName="ButtonGroup";const m=a=>({wrapper:(0,n.css)({display:"flex",borderRadius:a.shape.radius.default,"> .button-group:not(:first-child) > button, > button:not(:first-child)":{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid rgba(255, 255, 255, 0.12)"},"> .button-group:not(:last-child) > button, > button:not(:last-child)":{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"1px solid rgba(0, 0, 0, 0.12)"}})})},43951:(ee,B,e)=>{"use strict";e.d(B,{c:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({message:m,callToActionElement:a,footer:l,className:f})=>{const h=(0,r.of)(s);return(0,t.jsxs)("div",{className:(0,n.cx)([h.wrapper,f]),children:[m&&(0,t.jsx)("div",{className:h.message,children:m}),a,l&&(0,t.jsx)("div",{className:h.footer,children:l})]})},s=m=>({wrapper:(0,n.css)({label:"call-to-action-card",background:m.colors.background.secondary,borderRadius:m.shape.radius.default,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1,padding:m.spacing(3),[m.breakpoints.down("sm")]:{padding:m.spacing(3,1)}}),message:(0,n.css)({marginBottom:m.spacing(3),fontStyle:"italic"}),footer:(0,n.css)({marginTop:m.spacing(3)})})},8073:(ee,B,e)=>{"use strict";e.d(B,{H:()=>C,Z:()=>f});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(35484),m=e(7685),a=e(43856);const l=r.createContext(null),f=({disabled:S,href:O,onClick:I,children:R,isSelected:T,isCompact:L,className:K,...A})=>{const W=(0,r.useMemo)(()=>r.Children.toArray(R).some(V=>r.isValidElement(V)&&V.type===h),[R]),N=S||!I&&!O,w=I&&!S?I:void 0,j=(0,o.of)(a.i,S,N,T,L);return(0,t.jsx)(a.Q,{disableEvents:S,disableHover:N,isSelected:T,className:(0,n.cx)(j.container,K),...A,children:(0,t.jsxs)(l.Provider,{value:{href:O,onClick:w,disabled:S,isSelected:T},children:[!W&&(0,t.jsx)(h,{}),R]})})};f.displayName="Card";const h=({children:S,className:O,"aria-label":I})=>{const R=(0,r.useContext)(l),T=(0,o.of)(u),{href:L,onClick:K,isSelected:A}=R??{href:void 0,onClick:void 0,isSelected:void 0},W=(0,m.t)("grafana-ui.card.option","option");return(0,t.jsxs)("h2",{className:(0,n.cx)(T.heading,O),children:[L?(0,t.jsx)("a",{href:L,className:T.linkHack,"aria-label":I,onClick:K,children:S}):K?(0,t.jsx)("button",{onClick:K,className:T.linkHack,"aria-label":I,type:"button",children:S}):(0,t.jsx)(t.Fragment,{children:S}),A!==void 0&&(0,t.jsx)("input",{"aria-label":W,type:"radio",checked:A,readOnly:!0})]})};h.displayName="Heading";const u=S=>({heading:(0,n.css)({gridArea:"Heading",justifySelf:"start",display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:0,fontSize:S.typography.size.md,letterSpacing:"inherit",lineHeight:S.typography.body.lineHeight,color:S.colors.text.primary,fontWeight:S.typography.fontWeightMedium,"& input[readonly]":{cursor:"inherit"}}),linkHack:(0,n.css)({all:"unset","&::after":{position:"absolute",content:'""',top:0,bottom:0,left:0,right:0,borderRadius:S.shape.radiu
8s.default},"&:focus-visible":{outline:"none",outlineOffset:0,boxShadow:"none","&::after":{...(0,s.getFocusStyles)(S),zIndex:1}}})}),i=({children:S,className:O})=>{const I=(0,o.of)(x);return(0,t.jsx)("div",{className:(0,n.cx)(I.tagList,O),children:S})};i.displayName="Tags";const x=S=>({tagList:(0,n.css)({position:"relative",gridArea:"Tags",alignSelf:"center"})}),g=({children:S,className:O})=>{const I=(0,o.of)(p),R=typeof S=="string"?"p":"div";return(0,t.jsx)(R,{className:(0,n.cx)(I.description,O),children:S})};g.displayName="Description";const p=S=>({description:(0,n.css)({width:"100%",gridArea:"Description",margin:S.spacing(1,0,0),color:S.colors.text.secondary,lineHeight:S.typography.body.lineHeight})}),c=({children:S,align:O="start",className:I})=>{const R=(0,o.of)(y);return(0,t.jsx)("div",{className:(0,n.cx)(R.media,I,(0,n.css)({alignSelf:O})),children:S})};c.displayName="Figure";const y=S=>({media:(0,n.css)({position:"relative",gridArea:"Figure",marginRight:S.spacing(2),width:"40px","> img":{width:"100%"},"&:empty":{display:"none"}})}),P=(0,r.memo)(({children:S,className:O,separator:I="|"})=>{const R=(0,o.of)(d);let T=S;const L=r.Children.toArray(S).filter(Boolean);return L.length?(T=L.map((K,A)=>(0,t.jsx)("div",{className:R.metadataItem,children:K},`element_${A}`)),L.length>1&&I&&(T=L.reduce((K,A,W)=>[K,(0,t.jsx)("span",{className:R.separator,children:I},`separator_${W}`),A])),(0,t.jsx)("div",{className:(0,n.cx)(R.metadata,O),children:T})):null});P.displayName="Meta";const d=S=>({metadata:(0,n.css)({gridArea:"Meta",display:"flex",alignItems:"center",width:"100%",fontSize:S.typography.size.sm,color:S.colors.text.secondary,margin:S.spacing(.5,0,0),lineHeight:S.typography.bodySmall.lineHeight,overflowWrap:"anywhere"}),metadataItem:(0,n.css)({zIndex:0}),separator:(0,n.css)({margin:`0 ${S.spacing(1)}`})}),D=({children:S,disabled:O,variant:I,className:R})=>{const T=(0,o.of)(b),K=(0,r.useContext)(l)?.disabled||O,A=I==="primary"?T.actions:T.secondaryActions;return(0,t.jsx)("div",{className:(0,n.cx)(A,R),children:r.Children.map(S,W=>r.isValidElement(W)?(0,r.cloneElement)(W,{disabled:K,...W.props}):null)})},b=S=>({actions:(0,n.css)({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:S.spacing(1),gridArea:"Actions",marginTop:S.spacing(2)}),secondaryActions:(0,n.css)({alignSelf:"center",color:S.colors.text.secondary,display:"flex",flexDirection:"row",flexWrap:"wrap",gap:S.spacing(1),gridArea:"Secondary",marginTop:S.spacing(2)})}),E=({children:S,disabled:O,className:I})=>(0,t.jsx)(D,{variant:"primary",disabled:O,className:I,children:S});E.displayName="Actions";const v=({children:S,disabled:O,className:I})=>(0,t.jsx)(D,{variant:"secondary",disabled:O,className:I,children:S});v.displayName="SecondaryActions";const C=S=>({inner:(0,n.css)({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",flexWrap:"wrap"}),...u(S),...d(S),...p(S),...y(S),...b(S),...x(S)});f.Heading=h,f.Tags=i,f.Figure=c,f.Meta=P,f.Actions=E,f.SecondaryActions=v,f.Description=g},43856:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>a,i:()=>l});var t=e(74848),n=e(22803),r=e(63142),o=e(35484);const s=({children:f,href:h})=>{const{inner:u}=(0,r.of)(m);return h?(0,t.jsx)("a",{className:u,href:h,children:f}):(0,t.jsx)(t.Fragment,{children:f})},m=f=>({inner:(0,n.css)({display:"flex",width:"100%",padding:f.spacing(2)})}),a=({children:f,disableEvents:h,disableHover:u,isSelected:i,className:x,href:g,...p})=>{const{oldContainer:c}=(0,r.of)(l,h,u,i);return(0,t.jsx)("div",{...p,className:(0,n.cx)(c,x),children:(0,t.jsx)(s,{href:g,children:f})})},l=(f,h=!1,u=!1,i,x)=>{const g=i!==void 0;return{container:(0,n.css)({display:"grid",position:"relative",gridTemplateColumns:"auto 1fr auto",gridTemplateRows:"1fr auto auto auto",gridAutoColumns:"1fr",gridAutoFlow:"row",gridTemplateAreas:` 9 "Figure Heading Tags" 10 "Figure Meta Tags" 11 "Figure Description Tags" 12 "Figure Actions Secondary"`,width:"100%",padding:f.spacing(x?1:2),background:f.colors.background.secondary,borderRadius:f.shape.radius.default,marginBottom:"8px",pointerEvents:h?"none":"auto",[f.transitions.handleMotion("no-preference","reduce")]:{transition:f.transitions.create(["background-color","box-shadow","border-color","color"],{duration:f.transitions.duration.short})},...!u&&{"&:hover":{background:f.colors.emphasize(f.colors.background.secondary,.03),cursor:"pointer",zIndex:1},"&:focus":o.getFocusStyles(f)},...g&&{cursor:"pointer"},...i&&{outline:`solid 2px ${f.colors.primary.border}`}}),oldContainer:(0,n.css)({display:"flex",width:"100%",background:f.colors.background.secondary,borderRadius:f.shape.radiu
12s.default,position:"relative",pointerEvents:h?"none":"auto",marginBottom:f.spacing(1),[f.transitions.handleMotion("no-preference","reduce")]:{transition:f.transitions.create(["background-color","box-shadow","border-color","color"],{duration:f.transitions.duration.short})},...!u&&{"&:hover":{background:f.colors.emphasize(f.colors.background.secondary,.03),cursor:"pointer",zIndex:1},"&:focus":o.getFocusStyles(f)}})}}},56873:(ee,B,e)=>{"use strict";e.d(B,{F:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(7685),m=e(34999),a=e(76319);const l=({images:h})=>{const[u,i]=(0,r.useState)(null),[x,g]=(0,r.useState)({}),[p,c]=(0,r.useState)(h),y=(0,o.of)(f()),P=C=>{g(S=>({...S,[C]:!0}))};(0,r.useEffect)(()=>{const C=h.filter(S=>!x[S.path]);c(C)},[x,h]);const d=C=>{i(C)},D=()=>{i(null)},b=()=>{u!==null&&p.length>0&&i((u+1)%p.length)},E=()=>{u!==null&&p.length>0&&i((u-1+p.length)%p.length)},v=C=>{if(u!==null)switch(C.key){case"ArrowRight":b();break;case"ArrowLeft":E();break;case"Escape":D();break;default:break}};return p.length===0?(0,t.jsx)(m.F,{title:(0,s.t)("carousel.error","Something went wrong loading images"),severity:"warning","data-testid":"alert-warning"}):(0,t.jsxs)("div",{onKeyDown:v,tabIndex:0,children:[(0,t.jsx)("div",{className:(0,n.cx)(y.imageGrid),children:p.map((C,S)=>(0,t.jsxs)("div",{onClick:()=>d(S),style:{cursor:"pointer"},children:[(0,t.jsx)("img",{src:C.path,alt:C.name,onError:()=>P(C.path)}),(0,t.jsx)("p",{children:C.name})]},C.path))}),u!==null&&(0,t.jsxs)("div",{className:(0,n.cx)(y.fullScreenDiv),onClick:D,"data-testid":"carousel-full-screen",children:[(0,t.jsx)(a.K,{name:"times","aria-label":(0,s.t)("carousel.close","Close"),size:"xl",onClick:D,className:(0,n.cx)(y.closeButton)}),(0,t.jsx)(a.K,{size:"xl",name:"angle-left","aria-label":(0,s.t)("carousel.previous","Previous"),onClick:C=>{C.stopPropagation(),E()},className:(0,n.cx)(y.navigationButton,y.previousButton),"data-testid":"previous-button"}),(0,t.jsx)("div",{style:{position:"relative",maxWidth:"90%",maxHeight:"90%"},onClick:C=>C.stopPropagation(),"data-testid":"carousel-full-image",children:(0,t.jsx)("img",{src:p[u].path,alt:p[u].name,onError:()=>P(p[u].path)})}),(0,t.jsx)(a.K,{size:"xl",name:"angle-right","aria-label":(0,s.t)("carousel.next","Next"),onClick:C=>{C.stopPropagation(),b()},className:(0,n.cx)(y.navigationButton,y.nextButton),"data-testid":"next-button"})]})]})},f=()=>h=>({imageGrid:(0,n.css)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"16px",marginBottom:"20px","& img":{width:"100%",height:"150px",objectFit:"cover",border:h.colors.border.strong,borderRadius:h.shape.radius.default,boxShadow:h.shadows.z1},"& p":{margin:"4px 0",fontWeight:h.typography.fontWeightMedium,color:h.colors.text.primary}}),fullScreenDiv:(0,n.css)({position:"fixed",zIndex:h.zIndex.modalBackdrop,top:0,right:0,bottom:0,left:0,backgroundColor:h.components.overlay.background,alignItems:"center",justifyContent:"center",display:"flex","& img":{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain"}}),closeButton:(0,n.css)({position:"absolute",top:"20px",right:"20px",backgroundColor:"transparent",color:h.colors.text.primary}),navigationButton:(0,n.css)({position:"absolute",backgroundColor:"transparent",color:h.colors.text.primary,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"}),nextButton:(0,n.css)({right:"20px"}),previousButton:(0,n.css)({left:"20px"})})},64913:(ee,B,e)=>{"use strict";e.d(B,{v:()=>d});var t=e(74848),n=e(22803),r=e(47078),o=e.n(r),s=e(3163),m=e(96540),a=e(63142),l=e(7685),f=e(30703),h=e(76319),u=e(63527),i=e(41654),x=e(18857),g=e(78121),p=e(21133);const c=(0,n.css)({"&:focus":{outline:"none"}}),y=" / ";class P extends m.PureComponent{constructor(b){super(b),this.flattenOptions=(S,O=[])=>{let I=[];for(const R of S){const T=[...O];T.push(R),!R.items||R.items.length===0?I.push({singleLabel:T[T.length-1].label,label:T.map(L=>L.label).join(this.props.separator||y),value:T.map(L=>L.value)}):I=[...I,...this.flattenOptions(R.items,T)]}return I},this.getSearchableOptions=o()(S=>this.flattenOptions(S)),this.onChange=(S,O)=>{const I=this.props.hideActiveLevelLabel?"":this.props.displayAllSelectedLevels?O.map(T=>T.label).join(this.props.separator||y):O[O.length-1].label,R={rcValue:{value:S,label:I},focusCascade:!0,activeLabel:I,isSearching:!1,inputValue:I};this.setState(R),this.props.onSelect(O[O.length-1].value)},this.onSelect=S=>{const O=S.value||[],I=this.props.displayAllSelectedLevels?S.label:S.singleLabel||"",R={activeLabel:I,inputValue:I,rcValue:{value:O,label:I},isSearching:!1,focusCascade:!1};this.setState(R),this.props.onSelect(O[O.length-1])},this.onCreateOption=S=>{this.setState({activeLabel:S,inputValue:S,rcValue:[],isSearching:!1}),this.props.onSelect(S)},this.onBlur=()=>{this.setState({isSearching:!1,focusCascade:!1}),this.state.activeLabel===""&&this.setState({rcValue:[]}),this.props.onBlur?.()},this.onBlurCascade=()=>{this.setState({focusCascade:!1}),this.props.onBlur?.()},this.onInputKeyDown=S=>{if(["ArrowDown","ArrowUp","Enter","ArrowLeft","ArrowRight"].includes(S.key))return;const{activeLabel:O}=this.state;this.setState({focusCascade:!1,isSearching:!0,inputValue:O})},this.onSelectInputChange=S=>{this.setState({inputValue:S})};const E=this.getSearchableOptions(b.options),{rcValue:v,activeLabel:C}=this.setInitialValue(E,b.initialValue);this.state={isSearching:!1,focusCascade:!1,rcValue:v,activeLabel:C,inputValue:""}}static{this.defaultProps={changeOnSelect:!0}}setInitialValue(b,E){if(!E)return{rcValue:[],activeLabel:""};for(const v of b){const C=v.value||[];if(C[C.length-1]===E)return{rcValue:C,activeLabel:this.props.displayAllSelectedLevels?v.label:v.singleLabel||""}}return this.props.allowCustomValue?{rcValue:[],activeLabel:E}:{rcValue:[],activeLabel:""}}render(){const{allowCustomValue:b,formatCreateLabel:E,placeholder:v,width:C,changeOnSelect:S,options:O,disabled:I,id:R,isClearable:T,theme:L}=this.props,{focusCascade:K,isSearching:A,rcValue:W,activeLabel:N,inputValue:w}=this.state,j=this.getSearchableOptions(O),V=(0,p.T)(L);return(0,t.jsx)("div",{children:A?(0,t.jsx)(x.l6,{allowCustomValue:b,placeholder:v,autoFocus:!K,onChange:this.onSelect,onBlur:this.onBlur,options:j,onCreateOption:this.onCreateOption,formatCreateLabel:E,width:C,onInputChange:this.onSelectInputChange,disabled:I,inputValue:w,inputId:R}):(0,t.jsx)(s.A,{onChange:(0,g.k)(this.onChange),options:O,changeOnSelect:S,value:W.value,fieldNames:{label:"label",value:"value",children:"items"},expandIcon:null,open:this.props.alwaysOpen,disabled:I,dropdownClassName:V.dropdown,children:(0,t.jsx)("div",{className:c,children:(0,t.jsx)(u.p,{autoFocus:this.props.autoFocus,width:C,placeholder:v,onBlur:this.onBlurCascade,value:N,onKeyDown:this.onInputKeyDown,onChange:()=>{},suffix:(0,t.jsxs)(i.B,{gap:.5,children:[T&&N!==""&&(0,t.jsx)(h.K,{name:"times","aria-label":(0,l.t)("grafana-ui.cascader.clear-button","Clear selection"),onClick:U=>{U.preventDefault(),U.stopPropagation(),this.setState({rcValue:[],activeLabel:"",inputValue:""}),this.props.onSelect("")}}),(0,t.jsx)(f.I,{name:K?"angle-up":"angle-down"})]}),disabled:I,id:R})})})})}}const d=(0,a.cV)(P)},78121:(ee,B,e)=>{"use strict";e.d(B,{W:()=>n,k:()=>t});const t=s=>(m,a)=>{s&&s(m.map(l=>String(l)),r(a))},n=s=>m=>{s&&s(r(m))},r=s=>s.map(o),o=s=>{const m=s.value?String(s.value):"";return{value:m,label:typeof s.label=="string"?s.label:m}}},21133:(ee,B,e)=>{"use strict";e.d(B,{T:()=>m});var t=e(22803);const n=(0,t.keyframes)({"0%":{opacity:0,transformOrigin:"0% 0%",transform:"scaleY(0.8)"},"100%":{opacity:1,transformOrigin:"0% 0%",transform:"scaleY(1)"}}),r=(0,t.keyframes)({"0%":{opacity:1,transformOrigin:"0% 0%",transform:"scaleY(1)"},"100%":{opacity:0,transformOrigin:"0% 0%",transform:"scaleY(0.8)"}}),o=(0,t.keyframes)({"0%":{opacity:0,transformOrigin:"0% 100%",transform:"scaleY(0.8)"},"100%":{opacity:1,transformOrigin:"0% 100%",transform:"scaleY(1)"}}),s=(0,t.keyframes)({"0%":{opacity:1,transformOrigin:"0% 100%",transform:"scaleY(1)"},"100%":{opacity:0,transformOrigin:"0% 100%",transform:"scaleY(0.8)"}}),m=a=>({dropdown:(0,t.css)({"&.rc-cascader-dropdown":{position:"absolute",zIndex:9999,"&-hidden":{display:"none"}},".rc-cascader":{"&-menus":{overflow:"hidden",background:a.colors.background.elevated,border:"none",borderRadius:a.shape.radiu
12s.default,boxShadow:a.shadows.z3,whiteSpace:"nowrap","&.slide-up-enter, &.slide-up-appear":{animationDuration:"0.3s",animationFillMode:"both",transformOrigin:"0 0",opacity:0,animationTimingFunction:"cubic-bezier(0.08, 0.82, 0.17, 1)",animationPlayState:"paused"},"&.slide-up-enter.slide-up-enter-active.rc-cascader-menus-placement, &.slide-up-appear.slide-up-appear-active.rc-cascader-menus-placement":{"&-bottomLeft":{animationName:n,animationPlayState:"running"},"&-topLeft":{animationName:o,animationPlayState:"running"}},"&.slide-up-leave":{animationDuration:"0.3s",animationFillMode:"both",transformOrigin:"0 0",opacity:1,animationTimingFunction:"cubic-bezier(0.6, 0.04, 0.98, 0.34)",animationPlayState:"paused","&.slide-up-leave-active.rc-cascader-menus-placement":{"&-bottomLeft":{animationName:r,animationPlayState:"running"},"&-topLeft":{animationName:s,animationPlayState:"running"}}}},"&-menu":{display:"inline-block",maxWidth:"50vw",height:"192px",listStyle:"none",margin:0,padding:a.spacing(.5),borderRight:`1px solid ${a.colors.border.weak}`,overflow:"auto","&:last-child":{borderRight:0},"&-item":{height:a.spacing(4),lineHeight:a.spacing(4),padding:a.spacing(0,4,0,2),borderRadius:a.shape.radius.default,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",transition:"all 0.3s ease",position:"relative","&:hover":{background:a.colors.action.hover},"&-disabled":{cursor:"not-allowed",color:a.colors.text.disabled,"&:hover":{background:"transparent"},"&:after":{position:"absolute",right:"12px",content:"'loading'",color:a.colors.text.disabled,fontStyle:"italic"}},"&-active":{color:a.colors.text.maxContrast,background:a.colors.background.secondary,"&:hover":{background:a.colors.action.hover}},"&-expand":{position:"relative","&:after":{background:a.colors.background.secondary,content:"''",height:a.spacing(3),mask:"url(../img/icons/unicons/angle-right.svg)",maskType:"luminance",position:"absolute",right:0,top:a.spacing(.5),width:a.spacing(3)}}}}}})})},8135:(ee,B,e)=>{"use strict";e.d(B,{N:()=>r});var t=e(74848),n=e(96540);class r extends n.PureComponent{constructor(){super(...arguments),this.myRef=(0,n.createRef)(),this.state={hasEventListener:!1},this.onOutsideClick=s=>{const m=this.myRef.current;(!m||s.target instanceof Node&&!m.contains(s.target))&&this.props.onClick()}}static{this.defaultProps={includeButtonPress:!0,parent:typeof window<"u"?window:void 0,useCapture:!1}}componentDidMount(){this.props.parent.addEventListener("click",this.onOutsideClick,this.props.useCapture),this.props.includeButtonPress&&this.props.parent.addEventListener("keyup",this.onOutsideClick,this.props.useCapture)}componentWillUnmount(){this.props.parent.removeEventListener("click",this.onOutsideClick,this.props.useCapture),this.props.includeButtonPress&&this.props.parent.removeEventListener("keyup",this.onOutsideClick,this.props.useCapture)}render(){return(0,t.jsx)("div",{ref:this.myRef,children:this.props.children})}}},47931:(ee,B,e)=>{"use strict";e.d(B,{b:()=>h});var t=e(74848),n=e(22803),r=e(96540),o=e(7685),s=e(63142),m=e(45861),a=e(30703),l=e(53371);const f=2*1e3;function h({onClipboardCopy:x,onClipboardError:g,children:p,getText:c,icon:y,variant:P,...d}){const D=(0,s.of)(i),[b,E]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let O;return b&&(O=setTimeout(()=>{E(!1)},f)),()=>{window.clearTimeout(O)}},[b]);const v=(0,r.useRef)(null),C=(0,r.useCallback)(async()=>{const O=c();try{await u(O,v),E(!0),x?.(O)}catch(I){g?.(O,I)}},[c,x,g]),S=(0,o.t)("clipboard-button.inline-toast.success","Copied");return(0,t.jsxs)(t.Fragment,{children:[b&&(0,t.jsx)(l.r,{placement:"top",referenceElement:v.current,children:S}),(0,t.jsxs)(m.$n,{onClick:C,icon:y,variant:b?"success":P,"aria-label":b?S:void 0,...d,className:(0,n.cx)(D.button,b&&D.successButton,d.className),ref:v,children:[p,b&&(0,t.jsx)("div",{className:D.successOverlay,children:(0,t.jsx)(a.I,{name:"check"})})]})]})}const u=async(x,g)=>{if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(x);{const p=document.createElement("textarea");g.current?.appendChild(p),p.value=x,p.focus(),p.select(),document.execCommand("copy"),p.remove()}},i=x=>({button:(0,n.css)({position:"relative"}),successButton:(0,n.css)({"> *":(0,n.css)({visibility:"hidden"})}),successOverlay:(0,n.css)({position:"absolute",top:0,bottom:0,right:0,left:0,visibility:"visible"})})},74475:(ee,B,e)=>{"use strict";e.d(B,{M:()=>h});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(96540),m=e(63142),a=e(35484),l=e(30703),f=e(68079);const h=({label:i,isOpen:x,onToggle:g,className:p,contentClassName:c,children:y,labelId:P,loading:d=!1,headerDataTestId:D,contentDataTestId:b,unmountContentWhenClosed:E=!0})=>
12{const[v,C]=(0,s.useState)(x),S=(0,m.of)(u),O=L=>{L.target instanceof HTMLElement&&L.target.tagName==="A"||(L.preventDefault(),L.stopPropagation(),g?.(!v),C(!v))},{current:I}=(0,s.useRef)((0,r.uniqueId)()),R=P??`collapse-label-${I}`,T=(0,t.jsx)("div",{id:`collapse-content-${I}`,className:(0,n.cx)(S.content,c,{[S.contentHidden]:!v&&!E}),"data-testid":b,children:y});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{onClick:O,className:(0,n.cx)(S.header,p),children:[(0,t.jsx)("button",{type:"button",id:`collapse-button-${I}`,className:S.button,onClick:O,"aria-expanded":v&&!d,"aria-controls":`collapse-content-${I}`,"aria-labelledby":R,children:d?(0,t.jsx)(f.y,{className:S.spinner}):(0,t.jsx)(l.I,{name:v?"angle-up":"angle-down",className:S.icon})}),(0,t.jsx)("div",{className:S.label,id:`collapse-label-${I}`,"data-testid":D,children:i})]}),E?v&&T:T]})},u=i=>({header:(0,n.css)({display:"flex",cursor:"pointer",boxSizing:"border-box",flexDirection:"row-reverse",position:"relative",justifyContent:"space-between",fontSize:i.typography.size.lg,padding:`${i.spacing(.5)} 0`,"&:focus-within":(0,a.getFocusStyles)(i)}),button:(0,n.css)({all:"unset","&:focus-visible":{outline:"none",outlineOffset:"unset",transition:"none",boxShadow:"none"}}),icon:(0,n.css)({color:i.colors.text.secondary}),content:(0,n.css)({padding:`${i.spacing(2)} 0`}),contentHidden:(0,n.css)({display:"none"}),spinner:(0,n.css)({display:"flex",alignItems:"center",width:i.spacing(2)}),label:(0,n.css)({display:"flex",fontWeight:i.typography.fontWeightMedium,color:i.colors.text.maxContrast})})},89599:(ee,B,e)=>{"use strict";e.d(B,{S:()=>f,a:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(45861),m=e(30703);const a=h=>({collapse:(0,n.css)({label:"collapse",marginBottom:h.spacing(1),backgroundColor:h.colors.background.primary,border:`1px solid ${h.colors.border.weak}`,position:"relative",borderRadius:h.shape.radius.default,width:"100%",display:"flex",flexDirection:"column",flex:"1 1 0"}),collapseBody:(0,n.css)({label:"collapse__body",padding:h.spacing(h.components.panel.padding),paddingTop:0,flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),bodyContentWrapper:(0,n.css)({label:"bodyContentWrapper",flex:1}),loader:(0,n.css)({label:"collapse__loader",height:"2px",position:"relative",overflow:"hidden",background:"none",margin:h.spacing(.5)}),loaderActive:(0,n.css)({label:"collapse__loader_active","&:after":{content:"' '",display:"block",width:"25%",top:0,height:"250%",position:"absolute",animation:"loader 2s cubic-bezier(0.17, 0.67, 0.83, 0.67) 500ms",animationIterationCount:100,left:"-25%",background:h.colors.primary.main},"@keyframes loader":{from:{left:"-25%",opacity:.1},to:{left:"100%",opacity:1}}}),header:(0,n.css)({label:"collapse__header",padding:h.spacing(1,2,1,2),display:"flex"}),headerCollapsed:(0,n.css)({label:"collapse__header--collapsed",padding:h.spacing(1,2,1,2)}),headerLabel:(0,n.css)({label:"collapse__header-label",fontWeight:h.typography.fontWeightMedium,marginRight:h.spacing(1),fontSize:h.typography.size.md,display:"flex",flex:"0 0 100%"}),icon:(0,n.css)({label:"collapse__icon",margin:h.spacing(.25,1,0,-1)})}),l=({isOpen:h,onToggle:u,...i})=>{const[x,g]=(0,r.useState)(h);return(0,t.jsx)(f,{isOpen:x,collapsible:!0,...i,onToggle:()=>{g(!x),u&&u(!x)}})},f=({isOpen:h,label:u,loading:i,collapsible:x,onToggle:g,className:p,children:c})=>{const y=(0,o.of)(s.my),P=(0,o.of)(a),d=()=>{g&&g(!h)},D=(0,n.cx)([P.collapse,p]),b=i?(0,n.cx)([P.loader,P.loaderActive]):(0,n.cx)([P.loader]),E=x?(0,n.cx)([P.header]):(0,n.cx)([P.headerCollapsed]);return(0,t.jsxs)("div",{className:D,children:[(0,t.jsxs)("button",{type:"button",className:(0,n.cx)(y,E),onClick:d,children:[x&&(0,t.jsx)(m.I,{className:P.icon,name:h?"angle-down":"angle-right"}),(0,t.jsx)("div",{className:(0,n.cx)([P.headerLabel]),children:u})]}),h&&(0,t.jsxs)("div",{className:(0,n.cx)([P.collapseBody]),children:[(0,t.jsx)("div",{className:b}),(0,t.jsx)("div",{className:P.bodyContentWrapper,children:c})]})]})};f.displayName="Collapse"},12173:(ee,B,e)=>{"use strict";e.d(B,{A:()=>h});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(96540),m=e(84140),a=e(63142),l=e(63527);const f=(0,s.forwardRef)(({color:x,onChange:g,isClearable:p=!1,onClick:c,onBlur:y,disabled:P,buttonAriaLabel:d,...D},b)=>
12{const[E,v]=(0,s.useState)(x),[C,S]=(0,s.useState)(x),O=(0,s.useMemo)(()=>(0,r.debounce)(g,100),[]);(0,s.useEffect)(()=>{const T=(0,m.A)(x);T.isValid()&&x!==C&&(v(T.toString()),S(x))},[x,C]);const I=T=>{const{value:L}=T.currentTarget;if(v(L),L===""&&p){O(L);return}const K=(0,m.A)(L);K.isValid()&&O(K.toString())},R=T=>{(0,m.A)(E).isValid()||v(x),y?.(T)};return(0,t.jsx)(l.p,{...D,value:E,onChange:I,disabled:P,onClick:c,onBlur:R,addonBefore:(0,t.jsx)(u,{onClick:c,ariaLabel:d,disabled:P,color:x}),ref:b})});f.displayName="ColorInput";const h=f,u=({color:x,onClick:g,disabled:p,ariaLabel:c})=>{const y=(0,a.of)(i);return(0,t.jsx)("button",{type:"button",onClick:g,"aria-label":c,disabled:p||!g,className:(0,n.cx)(y,(0,n.css)({backgroundColor:x}))})},i=x=>(0,n.css)({height:"100%",width:`${x.spacing.gridSize*4}px`,borderRadius:`${x.shape.radius.default} 0 0 ${x.shape.radius.default}`,border:`1px solid ${x.colors.border.medium}`})},35427:(ee,B,e)=>{"use strict";e.d(B,{Dp:()=>g,sk:()=>x});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(65240),m=e(14226),a=e(2381),l=e(43533),f=e(28832),h=e(13409),u=e(57339);const i=(c,y="ColorPicker")=>class extends r.Component{constructor(){super(...arguments),this.pickerTriggerRef=(0,r.createRef)()}static{this.displayName=y}render(){const{theme:d,children:D,onChange:b,color:E}=this.props,v=p(d),C=r.createElement(c,{...this.props,children:null,onChange:b});return(0,t.jsx)(l.I,{content:C,hideAfter:300,children:(S,O,I)=>(0,t.jsxs)(t.Fragment,{children:[this.pickerTriggerRef.current&&(0,t.jsx)(a.A,{...I,referenceElement:this.pickerTriggerRef.current,wrapperClassName:v.colorPicker,onMouseLeave:O,onMouseEnter:S,onKeyDown:R=>(0,m.Q)(R,O)}),D?D({ref:this.pickerTriggerRef,showColorPicker:S,hideColorPicker:O}):(0,t.jsx)(h.q,{ref:this.pickerTriggerRef,onClick:S,onMouseLeave:O,color:d.visualization.getColorByName(E||"#000000"),"aria-label":E})]})})}},x=(0,o.cV)(i(f.$,"ColorPicker")),g=(0,o.cV)(i(u.o,"SeriesColorPicker")),p=(0,s.N)(c=>({colorPicker:(0,n.css)({position:"absolute",zIndex:c.zIndex.tooltip,color:c.colors.text.primary,maxWidth:"400px",fontSize:c.typography.size.sm})}))},28832:(ee,B,e)=>{"use strict";e.d(B,{$:()=>b});var t=e(74848),n=e(22803),r=e(42211),o=e(96540),s=e(6773),m=e(63142),a=e(65240),l=e(7685),f=e(60208),h=e(54314),u=e(13409),i=e(2543);function x(v,C){const S=new Array(v.length);for(let O=0;O<v.length;O++){const I=v.length-1-O;S[O]=C(v[I],I,v)}return S}const p=({hue:v,selectedColor:C,onColorSelect:S,...O})=>{const I=(0,i.upperFirst)(v.name),R=(0,m.of)(c);return(0,t.jsxs)("div",{className:R.colorRow,children:[(0,t.jsx)("div",{className:R.colorLabel,children:I}),(0,t.jsx)("div",{...O,className:R.swatchRow,children:x(v.shades,T=>(0,t.jsx)(u.q,{"aria-label":T.name,variant:T.primary?u.h.Large:u.h.Small,isSelected:T.name===C,color:T.color,onClick:()=>S(T.name)},T.name))})]})},c=v=>({colorRow:(0,n.css)({display:"grid",gridTemplateColumns:"25% 1fr",gridColumnGap:v.spacing(2),padding:v.spacing(.5,0),"&:hover":{background:v.colors.background.secondary}}),colorLabel:(0,n.css)({paddingLeft:v.spacing(1),display:"flex",alignItems:"center"}),swatchRow:(0,n.css)({display:"flex",gap:v.spacing(1),alignItems:"center",justifyContent:"space-around",flexDirection:"row"})}),y=({color:v,onChange:C})=>{const S=(0,m.$j)(),O=(0,m.of)(P),I=[];for(const R of S.visualization.hues)I.push((0,t.jsx)(p,{selectedColor:v,hue:R,onColorSelect:C},R.name));return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:O.swatches,children:I}),(0,t.jsxs)("div",{className:O.extraColors,children:[(0,t.jsx)(u.q,{isSelected:v==="transparent",color:"rgba(0,0,0,0)",label:(0,l.t)("grafana-ui.named-colors-palette.transparent-swatch","Transparent"),onClick:()=>C("transparent")}),(0,t.jsx)(u.q,{isSelected:v==="text",color:S.colors.text.primary,label:(0,l.t)("grafana-ui.named-colors-palette.text-color-swatch","Text color"),onClick:()=>C("text")})]})]})},P=v=>({container:(0,n.css)({display:"flex",flexDirection:"column"}),extraColors:(0,n.css)({display:"flex",alignItems:"center",justifyContent:"space-around",gap:v.spacing(1),padding:v.spacing(1,0)}),swatches:(0,n.css)({display:"grid",flexGrow:1})});var d=e(32550);class D extends o.Component{constructor(C){super(C),this.handleChange=S=>{const{onChange:O,enableNamedColors:I,theme:R}=this.props;if(I)return O(S);O(s.MV.asHexString(R.visualization.getColorByName(S)))},this.onTabChange=S=>()=>this.setState({activePicker:S}),this.renderPicker=()=>{const{activePicker:S}=this.state,{color:O}=this.props;switch(S){case"spectrum":return(0,t.jsx)(d.A,{color:O,onChange:this.handleChange});case"palette":return(0,t.jsx)(y,{color:O,onChange:this.handleChange});default:return this.renderCustomPicker(S)}},this.renderCustomPicker=S=>{const{customPickers:O,color:I,theme:R}=this.props;return O?o.createElement(O[S].tabComponent,{color:I,theme:R,onChange:this.handleChange}):null},this.renderCustomPickerTabs=()=>{const{customPickers:S}=this.props;return S?(0,t.jsx)(t.Fragment,{children:Object.keys(S).map(O=>(0,t.jsx)(f.o,{label:S[O].name,onChangeTab:this.onTabChange(O)},O))}):null},this.state={activePicker:"palette"}}render(){const{theme:C}=this.props,{activePicker:S}=this.state,O=E(C);return(0,t.jsx)(r.n1,{contain:!0,restoreFocus:!0,autoFocus:!0,children:(0,t.jsxs)("div",{tabIndex:-1,
12className:O.colorPickerPopover,children:[(0,t.jsxs)(h.U,{children:[(0,t.jsx)(f.o,{label:(0,l.t)("grafana-ui.color-picker-popover.palette-tab","Colors"),onChangeTab:this.onTabChange("palette"),active:S==="palette"}),(0,t.jsx)(f.o,{label:(0,l.t)("grafana-ui.color-picker-popover.spectrum-tab","Custom"),onChangeTab:this.onTabChange("spectrum"),active:S==="spectrum"}),this.renderCustomPickerTabs()]}),(0,t.jsx)("div",{className:O.colorPickerPopoverContent,children:this.renderPicker()})]})})}}const b=(0,m.cV)(D);b.displayName="ColorPickerPopover";const E=(0,a.N)(v=>({colorPickerPopover:(0,n.css)({borderRadius:v.shape.radius.default,boxShadow:v.shadows.z3,background:v.colors.background.elevated,padding:v.spacing(.5),border:`1px solid ${v.colors.border.weak}`}),colorPickerPopoverContent:(0,n.css)({width:"246px",fontSize:v.typography.bodySmall.fontSize,minHeight:"184px",height:"290px",padding:v.spacing(1),display:"flex",flexDirection:"column"}),colorPickerPopoverTabs:(0,n.css)({display:"flex",width:"100%",borderRadius:`${v.shape.radius.default} ${v.shape.radius.default} 0 0`})}))},13409:(ee,B,e)=>{"use strict";e.d(B,{h:()=>l,q:()=>f});var t=e(74848),n=e(22803),r=e(95382),o=e(96540),s=e(84140),m=e(85629),a=e(63142),l=(u=>(u.Small="small",u.Large="large",u))(l||{});const f=o.forwardRef(({color:u,label:i,variant:x="small",isSelected:g,"aria-label":p,...c},y)=>{const P=(0,a.$j)(),{isFocusVisible:d,focusProps:D}=(0,r.o)(),b=h(P,x,u,d,g),E=!!i,v=p||i;return(0,t.jsxs)("div",{ref:y,className:b.wrapper,"data-testid":m.Tp.components.ColorSwatch.name,...c,children:[E&&(0,t.jsx)("span",{className:b.label,children:i}),(0,t.jsx)("button",{className:b.swatch,...D,"aria-label":v?`${v} color`:"Pick a color",type:"button"})]})}),h=(u,i,x,g,p)=>{const c=(0,s.A)(x),P=i==="small"?"16px":"32px";let d="none";return c.getAlpha()<.1&&(d=`2px solid ${u.colors.border.medium}`),{wrapper:(0,n.css)({display:"flex",alignItems:"center",cursor:"pointer"}),label:(0,n.css)({marginRight:u.spacing(1)}),swatch:(0,n.css)({width:P,height:P,background:`${x}`,border:d,borderRadius:u.shape.radius.circle,outlineOffset:"1px",outline:g?`2px solid ${u.colors.primary.main}`:"none",boxShadow:p?`inset 0 0 0 2px ${x}, inset 0 0 0 4px ${u.colors.getContrastText(x)}`:"none",[u.transitions.handleMotion("no-preference")]:{transition:u.transitions.create(["transform"],{duration:u.transitions.duration.short})},"&:hover":{transform:"scale(1.1)"},"@media (forced-colors: active)":{forcedColorAdjust:"none"}})}};f.displayName="ColorSwatch"},57339:(ee,B,e)=>{"use strict";e.d(B,{o:()=>a,t:()=>l});var t=e(74848),n=e(63142),r=e(7685),o=e(18027),s=e(21285),m=e(28832);const a=f=>{const{yaxis:h,onToggleAxis:u,color:i,...x}=f,g=(0,r.t)("grafana-ui.series-color-picker-popover.y-axis-usage","Use right y-axis"),p=u?{yaxis:{name:"Y-Axis",tabComponent(){return(0,t.jsx)(o.I,{labelWidth:20,label:g,children:(0,t.jsx)(s.K,{value:h===2,label:g,onChange:u})})}}}:void 0;return(0,t.jsx)(m.$,{...x,color:i||"#000000",customPickers:p})},l=(0,n.cV)(a)},32550:(ee,B,e)=>{"use strict";e.d(B,{$:()=>u,A:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(7612),s=e(65229),m=e(84140),a=e(6773),l=e(63142),f=e(12173);const h=({color:x,onChange:g})=>{const[p,c]=(0,r.useState)(x);(0,s.A)(D=>{g(a.MV.asHexString(y.visualization.getColorByName(D)))},500,[p]);const y=(0,l.$j)(),P=(0,l.of)(u),d=(0,r.useMemo)(()=>p.startsWith("rgba")?p:(0,m.A)(y.visualization.getColorByName(x)).toRgbString(),[p,y,x]);return(0,t.jsxs)("div",{className:P.wrapper,children:[(0,t.jsx)(o.p9,{className:P.root,color:d,onChange:c}),(0,t.jsx)(f.A,{theme:y,color:d,onChange:c,className:P.colorInput})]})},u=x=>({wrapper:(0,n.css)({flexGrow:1}),root:(0,n.css)({"&.react-colorful":{width:"auto"},".react-colorful":{"&__saturation":{borderRadius:`${x.shape.radius.default} ${x.shape.radius.default} 0 0`},"&__alpha":{borderRadius:`0 0 ${x.shape.radius.default} ${x.shape.radius.default}`}
12,"&__alpha, &__hue":{height:x.spacing(2),position:"relative"},"&__pointer":{height:x.spacing(2),width:x.spacing(2)}}}),colorInput:(0,n.css)({marginTop:x.spacing(2)})}),i=h},43243:(ee,B,e)=>{"use strict";e.d(B,{G:()=>D});var t=e(74848),n=e(22803),r=e(72181),o=e(76698),s=e(96540),m=e(63142),a=e(7685),l=e(30703),f=e(33033),h=e(63527),u=e(15245),i=e(70733),x=e(74440),g=e(98869),p=e(75168),c=e(5320),y=e(93521);const P=()=>{},d=4,D=b=>{const{options:E,onChange:v,value:C,placeholder:S,isClearable:O=!1,createCustomValue:I=!1,id:R,width:T,minWidth:L,maxWidth:K,"aria-labelledby":A,"data-testid":W,autoFocus:N,onBlur:w,disabled:j,loading:V,invalid:U}=b,F=typeof C=="object"?C?.value:C,M=(0,s.useId)().replace(/:/g,"--"),{options:H,groupStartIndices:_,updateOptions:Z,asyncLoading:ne,asyncError:te}=(0,c.I)(b.options,I),Y=typeof E=="function",Q=(0,s.useMemo)(()=>{if(Y||C==null)return null;const Ke=E.findIndex(Re=>Re.value===F);return Ke===-1?null:Ke},[C,E,F,Y]),J=(0,s.useMemo)(()=>C==null?null:Q!==null&&!Y?E[Q]:typeof C=="object"?C:{value:C,label:C.toString()},[Q,Y,C,E]),q=`${M}-downshift-menu`,X=`${M}-downshift-label`,se=(0,m.of)(g.C3),oe=(0,s.useCallback)(Ke=>{const Re=Math.max(0,Ke.startIndex-Ke.overscan),Ve=Math.min(H.length-1,Ke.endIndex+Ke.overscan),Qe=Array.from({length:Ve-Re+1},(ze,Ye)=>Re+Ye),je=H[Qe[0]];if(je?.group){const ze=_.get(je.group);ze!==void 0&&ze<Qe[0]&&Qe.unshift(ze)}return Qe},[H,_]),ae=(0,r.Te)({count:H.length,getScrollElement:()=>Ce.current,estimateSize:Ke=>{const Re=(0,y.S)(H[Ke],Ke>0?H[Ke-1]:void 0),Ve="description"in H[Ke],Qe="group"in H[Ke];let je=g.Aj;return Ve&&(je=g.pg),Re&&Qe&&(je+=g.Aj),je},overscan:d,rangeExtractor:oe}),{isOpen:ie,highlightedIndex:fe,getInputProps:pe,getMenuProps:de,getItemProps:le,selectItem:me}=(0,o.Bp)({menuId:q,labelId:X,inputId:R,items:H,itemToString:x.yl,selectedItem:J,onSelectedItemChange:({selectedItem:Ke})=>{v(Ke)},defaultHighlightedIndex:Q??0,scrollIntoView:()=>{},onIsOpenChange:({isOpen:Ke,inputValue:Re})=>{Ke&&Re===""&&Z(Re)},onHighlightedIndexChange:({highlightedIndex:Ke,type:Re})=>{Re!==o.Bp.stateChangeTypes.MenuMouseLeave&&ae.scrollToIndex(Ke)},onStateChange:({inputValue:Ke,type:Re,selectedItem:Ve})=>{switch(Re){case o.Bp.stateChangeTypes.InputChange:Z(Ke??"");break;default:break}},stateReducer(Ke,Re){let{changes:Ve}=Re;const Qe=Ke.isOpen===!1&&Ve.isOpen===!0,je=Ke.isOpen===!0&&Ve.isOpen===!1;return Qe&&Ve.inputValue===Ke.inputValue&&(Ve={...Ve,inputValue:""}),je&&(Ve.selectedItem?Ve={...Ve,inputValue:(0,x.yl)(Ve.selectedItem)}:Ve.inputValue!==""&&(Ve={...Ve,inputValue:""})),Ve}}),{inputRef:De,floatingRef:Te,floatStyles:Ne,scrollRef:Ce}=(0,p.l)(H,ie),He=T==="auto",ke=He?f.D:h.p,Me=(ie?(0,x.yl)(J):null)||S,$e=ne?"spinner":ie?"search":"angle-down",tt=(0,t.jsxs)(t.Fragment,{children:[F&&F===J?.value&&O&&(0,t.jsx)(l.I,{name:"times",className:se.clear,title:(0,a.t)("combobox.clear.title","Clear value"),tabIndex:0,role:"button",onClick:()=>{me(null)},onKeyDown:Ke=>{(Ke.key==="Enter"||Ke.key===" ")&&me(null)}}),(0,t.jsx)(l.I,{name:$e})]});return(0,t.jsxs)("div",{className:He?se.addaptToParent:void 0,children:[(0,t.jsx)(ke,{width:He?void 0:T,...He?{minWidth:L,maxWidth:K}:{},autoFocus:N,onBlur:w,disabled:j,loading:V,invalid:U,className:se.input,suffix:tt,...pe({ref:De,onChange:P,"aria-labelledby":A,placeholder:Me,"data-testid":W})}),(0,t.jsx)(u.ZL,{children:(0,t.jsx)("div",{className:(0,n.cx)(se.menu,!ie&&se.menuClosed),style:Ne,...de({ref:Te,"aria-labelledby":A}),children:ie&&(0,t.jsx)(i.e,{options:H,highlightedIndex:fe,selectedItems:J?[J]:[],scrollRef:Ce,getItemProps:le,error:te})})})]})}},70733:(ee,B,e)=>{"use strict";e.d(B,{e:()=>D});var t=e(74848),n=e(22803),r=e(72181),o=e(96540),s=e(63142),m=e(32635),a=e(92807),l=e(7685),f=e(30703),h=e(31286),u=e(41654),i=e(66404);const x=()=>(0,t.jsxs)(p,{children:[(0,t.jsx)(i.E,{color:"warning",children:(0,t.jsx)(f.I,{name:"exclamation-triangle",size:"md"})}),(0,t.jsx)(l.x,{i18nKey:"combobox.async.error",children:"An error occurred while loading options."})]}),g=()=>(0,t.jsx)(p,{children:(0,t.jsx)(l.x,{i18nKey:"combobox.options.no-found",children:"No options foun
12d."})}),p=({children:b})=>(0,t.jsx)(h.a,{padding:2,children:(0,t.jsx)(u.B,{justifyContent:"center",alignItems:"center",direction:"column",children:b})});var c=e(98869),y=e(33605),P=e(93521);const d=4,D=({options:b,highlightedIndex:E,selectedItems:v=[],scrollRef:C,getItemProps:S,enableAllOption:O,isMultiSelect:I=!1,error:R=!1})=>{const T=(0,s.of)(c.C3),L=(0,o.useCallback)(N=>{const w=(0,P.S)(b[N],N>0?b[N-1]:void 0),j="description"in b[N],V="group"in b[N];let U=c.Aj;return j&&(U=c.pg),w&&V&&(U+=c.Aj),U},[b]),K=(0,r.Te)({count:b.length,getScrollElement:()=>C.current,estimateSize:L,overscan:d}),A=(0,o.useCallback)(N=>v.some(w=>w.value===N.value),[v]),W=O&&v.length===b.length-1;return(0,t.jsxs)(a.P,{showScrollIndicators:!0,maxHeight:"inherit",ref:C,padding:.5,children:[(0,t.jsx)("div",{style:{height:K.getTotalSize()},className:T.menuUlContainer,children:K.getVirtualItems().map((N,w,j)=>{const V=b[N.index],U=(0,P.S)(V,b[N.index-1]),F=j.find(Z=>b[Z.index].group===V.group),M=F&&b[F.index],H=`combobox-option-${V.value}`,_=M?`combobox-option-group-${M.value}`:void 0;return(0,t.jsxs)("div",{className:T.listItem,style:{height:N.size,transform:`translateY(${N.start}px)`},children:[U&&(0,t.jsx)("div",{role:"presentation","data-testid":"combobox-option-group",id:_,className:(0,n.cx)(T.optionGroupHeader,V.group&&T.optionGroupLabel,N.index===0&&T.optionFirstGroupHeader),children:V.group}),(0,t.jsxs)("div",{className:(0,n.cx)(T.option,!I&&A(V)&&T.optionSelected,E===N.index&&T.optionFocused),...S({item:V,index:N.index,id:H,"aria-describedby":_}),children:[I&&(0,t.jsx)("div",{className:T.optionAccessory,children:(0,t.jsx)(m.S,{value:W||A(V),indeterminate:V.value===y.A&&v.length>0&&!W,"aria-labelledby":H,onClick:Z=>{Z.stopPropagation()}},H)}),(0,t.jsxs)("div",{className:T.optionBody,children:[(0,t.jsx)("div",{className:T.optionLabel,children:V.label??V.value}),V.description&&(0,t.jsx)("div",{className:T.optionDescription,children:V.description})]})]})]},V.value)})}),(0,t.jsxs)("div",{"aria-live":"polite",children:[R&&(0,t.jsx)(x,{}),b.length===0&&!R&&(0,t.jsx)(g,{})]})]})}},74440:(ee,B,e)=>{"use strict";e.d(B,{op:()=>u,yl:()=>f});var t=e(84139);const n=/[^ -~]/m,r=/^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+$/m,o=5,s=25,m=5,a=1e4,l=new t.A({intraMode:1});function f(i){return i==null?"":i.label??i.value.toString()}function h(i){const x=i.toLowerCase();return g=>!i||g.label?.toLowerCase().includes(x)||g.value?.toString().toLowerCase().includes(x)||g.value.toString()===ALL_OPTION_VALUE}function u(i,x,g){let p=[];if(g==="")p=i;else if(n.test(g)||r.test(g)||g.length>s||l.split(g).length>m)for(let c=0;c<x.length;c++)x[c].includes(g)&&p.push(i[c]);else{const[c,y,P]=l.search(x,g,o,a);c?.length&&(y&&P?p=P.map(d=>i[y.idx[d]]):p=c.map(d=>i[d]))}return p}},98869:(ee,B,e)=>{"use strict";e.d(B,{AK:()=>s,Aj:()=>l,C3:()=>u,pg:()=>f,sh:()=>n,xB:()=>h,zx:()=>o});var t=e(22803);const n=14,r=12,o=500,s=8,m=2,a=1.5,l=m+s*2+n*a,f=l+r*a,h=l*8.5,u=i=>({menuClosed:(0,t.css)({display:"none"}),menu:(0,t.css)({label:"combobox-menu",background:i.components.dropdown.background,boxShadow:i.shadows.z3,zIndex:i.zIndex.dropdown,position:"relative",borderRadius:i.shape.radius.default,overflow:"hidden"}),menuUlContainer:(0,t.css)({label:"combobox-menu-ul-container",listStyle:"none"}),listItem:(0,t.css)({label:"list-item",position:"absolute",width:"100%"}),optionGroupHeader:(0,t.css)({label:"combobox-new-option-group",borderTop:`1px solid ${i.colors.border.weak}`}),optionFirstGroupHeader:(0,t.css)({borderTop:"none"}),optionGroupLabel:(0,t.css)({textOverflow:"ellipsis",overflow:"hidden",letterSpacing:0,color:i.colors.text.secondary,fontSize:i.typography.bodySmall.fontSize,fontWeight:i.typography.fontWeightLight,padding:s}),option:(0,t.css)({label:"combobox-option",position:"relative",display:"flex",width:"100%",gap:i.spacing(1),alignItems:"center",padding:s,marginBottom:m,borderRadius:i.shape.radius.default,fontWeight:i.typography.fontWeightMedium,whiteSpace:"nowrap",overflow:"hidden",cursor:"pointer","&:hover":{background:i.colors.action.hover,"@media (forced-colors: active), (prefers-contrast: more)":{border:`1px solid ${i.colors.primary.border}`}}}),optionAccessory:(0,t.css)({label:"combobox-option-accessory",height:n*a}),optionBody:(0,t.css)({label:"combobox-option-body",display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden"}),optionLabel:(0,t.css)({label:"combobox-option-label",fontSize:n,fontWeight:o,lineHeight:a,letterSpacing:0,textOverflow:"ellipsis",overflow:"hidden"}),optionDescription:(0,t.css)({label:"combobox-option-description",color:i.colors.text.secondary,fontSize:r,fontWeight:i.typography.fontWeightRegular,lineHeight:a,letterSpacing:0,textOverflow:"ellipsis",overflow:"hidden"}),optionFocused:(0,t.css)({label:"combobox-option-focused",background:i.colors.action.focus,"@media (forced-colors: active), (prefers-contrast: more)":{border:`1px solid ${i.colors.primary.border}`}}),optionSelected:(0,t.css)({background:i.colors.action.selected,"&::before":{backgroundImage:i.colors.gradients.brandVertical,borderRadius:i.shape.radiu
12s.default,content:'" "',display:"block",height:"100%",position:"absolute",width:i.spacing(.5),left:0,top:0}}),clear:(0,t.css)({label:"combobox-clear",cursor:"pointer",pointerEvents:"auto","&:hover":{color:i.colors.text.primary}}),input:(0,t.css)({label:"combobox-input","> div > div:last-child":{pointerEvents:"none"},"& input":{cursor:"pointer"},"& input:focus":{cursor:"text"}}),addaptToParent:(0,t.css)({label:"combobox-addapt-to-parent",maxWidth:"100%",'[class*="input-wrapper-combobox-input"]':{maxWidth:"100%"}})})},33605:(ee,B,e)=>{"use strict";e.d(B,{A:()=>t});const t="__GRAFANA_INTERNAL_MULTICOMBOBOX_ALL_OPTION__"},75168:(ee,B,e)=>{"use strict";e.d(B,{l:()=>h});var t=e(34743),n=e(83505),r=e(46885),o=e(96540),s=e(53568),m=e(98869);const a=1e5,l=16,f=8,h=(i,x)=>{const g=(0,o.useRef)(null),p=(0,o.useRef)(null),c=(0,o.useRef)(null),[y,P]=(0,o.useState)({width:0,height:0}),d=(0,o.useMemo)(()=>u(),[]),D=[(0,t.RK)({allowedPlacements:["bottom-start","bottom-end","top-start","top-end"],boundary:document.body,crossAxis:!0}),(0,t.Ej)({apply({availableWidth:S,availableHeight:O}){const I=S-l,R=O-l,T=Math.max(I,0),L=Math.min(Math.max(R,m.Aj*6),m.xB);P({width:T,height:L})}})],b={reference:g.current,floating:p.current},{floatingStyles:E}=(0,n.we)({strategy:"fixed",open:x,placement:"bottom-start",middleware:D,elements:b,whileElementsMounted:r.ll}),v=(0,o.useMemo)(()=>{let S="";const O=Math.min(i.length,a);for(let R=0;R<O;R++){const T=i[R].label??i[R].value.toString();S=T.length>S.length?T:S}return(0,s.kD)(S,m.sh,m.zx).width+f+m.AK*2+d},[i,d]),C={...E,width:v,maxWidth:y.width,minWidth:g.current?.offsetWidth,maxHeight:y.height};return{inputRef:g,floatingRef:p,scrollRef:c,floatStyles:C}};function u(){const i=document.createElement("div");i.style.visibility="hidden",i.style.overflow="scroll",document.body.appendChild(i);const x=document.createElement("div");i.appendChild(x);const g=i.offsetWidth-x.offsetWidth;return i.parentNode?.removeChild(i),g}},5320:(ee,B,e)=>{"use strict";e.d(B,{I:()=>l});var t=e(2543),n=e(96540),r=e(7685),o=e(74440);function s(h){const u=(0,n.useRef)(0);return(0,n.useCallback)(x=>{u.current++;const g=u.current;return new Promise((p,c)=>{h(x).then(y=>
12{g===u.current?p(y):c(new m)}).catch(c)})},[h])}class m extends Error{constructor(){super("This result is stale and is discarded"),this.name="StaleResultError",Object.setPrototypeOf(this,new.target.prototype)}}const a=()=>Promise.resolve([]);function l(h,u){const i=typeof h=="function",x=s(i?h:a),g=(0,n.useMemo)(()=>(0,t.debounce)(T=>x(T).then(L=>{c(L),P(!1),D(!1)}).catch(L=>{L instanceof m||(D(!0),P(!1),L&&console.error("Error loading async options for Combobox",L))}),200),[x]),[p,c]=(0,n.useState)([]),[y,P]=(0,n.useState)(!1),[d,D]=(0,n.useState)(!1),[b,E]=(0,n.useState)(""),v=(0,n.useCallback)(T=>{let L=T;return u&&b&&(T.some(A=>A.value===b)||(L=L.slice(),L.unshift({label:b,value:b,description:(0,r.t)("combobox.custom-value.description","Use custom value")}))),L},[u,b]),C=(0,n.useCallback)(T=>{E(T),i&&(P(!0),g(T))},[g,i]),S=(0,n.useMemo)(()=>i?[]:h.map(o.yl),[i,h]),O=(0,n.useMemo)(()=>i?p:(0,o.op)(h,S,b),[p,i,h,S,b]),[I,R]=(0,n.useMemo)(()=>{const{options:T,groupStartIndices:L}=f(O);return[v(T),L]},[O,v]);return{options:I,groupStartIndices:R,updateOptions:C,asyncLoading:y,asyncError:d}}function f(h){const u=new Map,i=new Map;for(const p of h){const c=p.group,y=u.get(c);y?y.push(p):u.set(c,[p])}if(u.size<=1)return h[0]?.group&&i.set(h[0]?.group,0),{options:h,groupStartIndices:i};const x=new Array(h.length);let g=0;for(const[p,c]of u){p&&i.set(p,g);for(const y of c)x[g++]=y}return{options:x,groupStartIndices:i}}},93521:(ee,B,e)=>{"use strict";e.d(B,{S:()=>t});const t=(n,r)=>{const o=n.group;return o?r?r.group!==o:!0:!!r?.group}},7075:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>a});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(7685),m=e(45861);const a=({children:f,className:h,closeOnConfirm:u,confirmText:i="Save",confirmVariant:x="primary",disabled:g=!1,onCancel:p,onClick:c,onConfirm:y,size:P="md"})=>{const d=(0,r.useRef)(null),D=(0,r.useRef)(null),[b,E]=(0,r.useState)(!1),[v,C]=(0,r.useState)(!1),S=(0,o.of)(l);(0,r.useEffect)(()=>{b?(D.current?.focus(),C(!0)):v&&(d.current?.focus(),C(!1))},[v,b]);const O=A=>{A&&A.preventDefault(),E(!0),c?.()},I=A=>{A&&A.preventDefault(),E(!1),d.current?.focus(),p?.()},R=A=>{A&&A.preventDefault(),y?.(),u&&E(!1)},T=(0,n.cx)(h,S.mainButton,{[S.mainButtonHide]:b}),L=(0,n.cx)(S.confirmButton,{[S.confirmButtonHide]:!b}),K=(0,n.cx)(S.confirmButtonContainer,{[S.confirmButtonContainerHide]:!b});return(0,t.jsxs)("div",{className:S.container,children:[(0,t.jsx)("span",{className:T,children:typeof f=="string"?(0,t.jsx)(m.$n,{disabled:g,size:P,fill:"text",onClick:O,ref:d,children:f}):r.cloneElement(f,{disabled:g,onClick:O,ref:d})}),(0,t.jsx)("div",{className:K,children:(0,t.jsxs)("span",{className:L,children:[(0,t.jsx)(m.$n,{size:P,variant:x,onClick:R,ref:D,children:i}),(0,t.jsx)(m.$n,{size:P,fill:"text",onClick:I,children:(0,t.jsx)(s.x,{i18nKey:"grafana-ui.confirm-button.cancel",children:"Cancel"})})]})})]})};a.displayName="ConfirmButton";const l=f=>({container:(0,n.css)({alignItems:"center",display:"flex",justifyContent:"flex-end",position:"relative"}),mainButton:(0,n.css)({opacity:1,[f.transitions.handleMotion("no-preference")]:{transition:f.transitions.create(["opacity"],{duration:f.transitions.duration.shortest,easing:f.transitions.easing.easeOut})},zIndex:2}),mainButtonHide:(0,n.css)({opacity:0,[f.transitions.handleMotion("no-preference")]:{transition:f.transitions.create(["opacity","visibility"],{duration:f.transitions.duration.shortest,easing:f.transitions.easing.easeIn})},visibility:"hidden",zIndex:0}),confirmButtonContainer:(0,n.css)({overflow:"visible",position:"absolute",pointerEvents:"all",right:0}),confirmButtonContainerHide:(0,n.css)({overflow:"hidden",pointerEvents:"none"}),confirmButton:(0,n.css)({alignItems:"flex-start",background:f.colors.background.primary,display:"flex",opacity:1,transform:"translateX(0)",[f.transitions.handleMotion("no-preference")]:{transition:f.transitions.create(["opacity","transform"],{duration:f.transitions.duration.shortest,easing:f.transitions.easing.easeOut})},zIndex:1}),confirmButtonHide:(0,n.css)({opacity:0,transform:"translateX(100%)",[f.transitions.handleMotion("no-preference")]:{transition:f.transitions.create(["opacity","transform","visibility"],{duration:f.transitions.duration.shortest,easing:f.transitions.easing.easeIn})},visibility:"hidden"})})},44458:(ee,B,e)=>{"use strict";e.d(B,{e:()=>
12o});var t=e(74848),n=e(45861),r=e(7075);const o=({size:s,disabled:m,onConfirm:a,"aria-label":l,closeOnConfirm:f})=>(0,t.jsx)(r.Z,{confirmText:"Delete",confirmVariant:"destructive",size:s||"md",disabled:m,onConfirm:a,closeOnConfirm:f,children:(0,t.jsx)(n.$n,{"aria-label":l,variant:"destructive",icon:"times",size:s||"sm"})})},70735:(ee,B,e)=>{"use strict";e.d(B,{k:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(49785),s=e(85629),m=e(63142),a=e(7685),l=e(45861),f=e(37386),h=e(63527),u=e(41654);const i=({body:g,confirmPromptText:p,confirmButtonLabel:c,confirmButtonVariant:y,dismissButtonVariant:P,dismissButtonLabel:d,onConfirm:D,onDismiss:b,onAlternative:E,alternativeButtonLabel:v,description:C,justifyButtons:S="flex-end",disabled:O})=>{const[I,R]=(0,r.useState)(O),T=(0,m.of)(x),L=(0,r.useRef)(null),K=w=>{R(p?.toLowerCase().localeCompare(w.currentTarget.value.toLowerCase())!==0)};(0,r.useEffect)(()=>{L.current?.focus()},[]),(0,r.useEffect)(()=>{R(O?!0:!!p)},[p,O]);const A=async()=>{O===void 0&&R(!0);try{await D()}finally{O===void 0&&R(!1)}},{handleSubmit:W}=(0,o.mN)(),N=(0,a.t)("grafana-ui.confirm-content.placeholder",'Type "{{confirmPromptText}}" to confirm',{confirmPromptText:p});return(0,t.jsxs)("form",{onSubmit:W(A),children:[(0,t.jsxs)("div",{className:T.text,children:[g,C?(0,t.jsx)("div",{className:T.description,children:C}):null,p?(0,t.jsx)("div",{className:T.confirmationInput,children:(0,t.jsx)(u.B,{alignItems:"flex-start",children:(0,t.jsx)(f.D,{disabled:O,children:(0,t.jsx)(h.p,{placeholder:N,onChange:K})})})}):null]}),(0,t.jsx)("div",{className:T.buttonsContainer,children:(0,t.jsxs)(u.B,{justifyContent:S,gap:2,wrap:"wrap",children:[(0,t.jsx)(l.$n,{variant:P,onClick:b,fill:"outline",children:d}),(0,t.jsx)(l.$n,{type:"submit",variant:y,disabled:I,ref:L,"data-testid":s.Tp.pages.ConfirmModal.delete,children:c}),E?(0,t.jsx)(l.$n,{variant:"primary",onClick:E,children:v}):null]})})]})},x=g=>({text:(0,n.css)({fontSize:g.typography.h5.fontSize,color:g.colors.text.primary}),description:(0,n.css)({fontSize:g.typography.body.fontSize}),confirmationInput:(0,n.css)({paddingTop:g.spacing(1)}),buttonsContainer:(0,n.css)({paddingTop:g.spacing(3)})})},71599:(ee,B,e)=>{"use strict";e.d(B,{u:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(22787),s=e(70735);const m=({isOpen:l,title:f,body:h,description:u,confirmText:i,confirmVariant:x="destructive",confirmationText:g,dismissText:p="Cancel",dismissVariant:c="secondary",alternativeText:y,modalClass:P,icon:d="exclamation-triangle",onConfirm:D,onDismiss:b,onAlternative:E,confirmButtonVariant:v="destructive",disabled:C})=>{const S=(0,r.of)(a);return(0,t.jsx)(o.a,{className:(0,n.cx)(S.modal,P),title:f,icon:d,isOpen:l,onDismiss:b,children:(0,t.jsx)(s.k,{body:h,description:u,confirmButtonLabel:i,dismissButtonLabel:p,dismissButtonVariant:c,confirmPromptText:g,alternativeButtonLabel:y,confirmButtonVariant:v,onConfirm:D,onDismiss:b,onAlternative:E,disabled:C})})},a=()=>({modal:(0,n.css)({width:"500px"})})},97375:(ee,B,e)=>{"use strict";e.d(B,{t:()=>a});var t=e(74848),n=e(96540),r=e(29647),o=e(85629),s=e(87063),m=e(15245);const a=n.memo(({x:l,y:f,onClose:h,focusOnOpen:u=!0,renderMenuItems:i,renderHeader:x})=>{const g=(0,n.useRef)(null),[p,c]=(0,n.useState)({});(0,n.useLayoutEffect)(()=>{const b=g.current;if(b){const E=b.getBoundingClientRect(),v=5,C={right:window.innerWidth<l+E.width,bottom:window.innerHeight<f+E.height+v};c({position:"fixed",left:C.right?l-E.width-v:l-v,top:Math.max(0,C.bottom?f-E.height-v:f+v)})}},[l,f]),(0,r.A)(g,()=>{h?.()});const y=x?.(),P=i?.(),d=b=>{u&&b(0)},D=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),h?.())};return(0,t.jsx)(m.ZL,{children:(0,t.jsx)(s.W,{header:y,ref:g,style:p,ariaLabel:o.Tp.components.Menu.MenuComponent("Context"),onOpen:d,onClick:h,onKeyDown:D,children:P})})});a.displayName="ContextMenu"},41479:(ee,B,e)=>{"use strict";e.d(B,{n:()=>o});var t=e(74848),n=e(96540),r=e(97375);const o=({children:s,renderMenuItems:m,focusOnOpen:a=!0})=>
12{const[l,f]=(0,n.useState)(!1),[h,u]=(0,n.useState)({x:0,y:0});return(0,t.jsxs)(t.Fragment,{children:[s({openMenu:i=>{f(!0),u({x:i.pageX,y:i.pageY-window.scrollY})}}),l&&(0,t.jsx)(r.t,{onClose:()=>f(!1),x:h.x,y:h.y,renderMenuItems:m,focusOnOpen:a})]})}},52718:(ee,B,e)=>{"use strict";e.d(B,{E:()=>l,A:()=>f});var t=e(74848),n=e(22803),r=e(96540),o=e(62295),s=e(63142);const m=({children:i})=>{const[x,g]=(0,r.useState)(!1),[p,c]=(0,r.useState)(!1),y=(0,r.useRef)(null),P=(0,r.useRef)(null),d=(0,s.of)(a);return(0,r.useEffect)(()=>{const D=new IntersectionObserver(b=>{b.forEach(E=>{E.target===y.current?g(!E.isIntersecting):E.target===P.current&&c(!E.isIntersecting)})});return[y,P].forEach(b=>{b.current&&D.observe(b.current)}),()=>D.disconnect()},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,n.cx)(d.scrollIndicator,d.scrollTopIndicator,{[d.scrollIndicatorVisible]:x})}),(0,t.jsxs)("div",{className:d.scrollContent,children:[(0,t.jsx)("div",{ref:y}),i,(0,t.jsx)("div",{ref:P})]}),(0,t.jsx)("div",{className:(0,n.cx)(d.scrollIndicator,d.scrollBottomIndicator,{[d.scrollIndicatorVisible]:p})})]})},a=i=>({scrollContent:(0,n.css)({flex:1,position:"relative"}
12),scrollIndicator:(0,n.css)({height:i.spacing(6),left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,[i.transitions.handleMotion("no-preference","reduce")]:{transition:i.transitions.create("opacity")},zIndex:1}),scrollTopIndicator:(0,n.css)({background:`linear-gradient(0deg, transparent, ${i.colors.background.canvas})`,top:0}),scrollBottomIndicator:(0,n.css)({background:`linear-gradient(180deg, transparent, ${i.colors.background.canvas})`,bottom:0}),scrollIndicatorVisible:(0,n.css)({opacity:1})}),l=({autoHide:i=!1,autoHideTimeout:x=200,setScrollTop:g,className:p,testId:c,autoHeightMin:y="0",autoHeightMax:P="100%",hideTracksWhenNotNeeded:d=!1,hideHorizontalTrack:D,hideVerticalTrack:b,scrollRefCallback:E,showScrollIndicators:v=!1,updateAfterMountMs:C,scrollTop:S,onScroll:O,children:I,divId:R})=>{const T=(0,r.useRef)(null),L=(0,s.of)(h);(0,r.useEffect)(()=>{T.current&&E&&E(T.current.view)},[T,E]),u(T.current,S),(0,r.useEffect)(()=>{C&&setTimeout(()=>{const U=T.current;U?.update&&U.update()},C)},[C]);function K(U,F,M){return M.style&&F&&(M.style.display="none"),(0,t.jsx)("div",{...M,className:U})}const A=(0,r.useCallback)(U=>K("track-horizontal",D,U),[D]),W=(0,r.useCallback)(U=>K("track-vertical",b,U),[b]),N=(0,r.useCallback)(U=>(0,t.jsx)("div",{...U,className:"thumb-horizontal"}),[]),w=(0,r.useCallback)(U=>(0,t.jsx)("div",{...U,className:"thumb-vertical"}),[]),j=(0,r.useCallback)(U=>(U.style&&U.style.WebkitOverflowScrolling==="touch"&&(U.style.WebkitOverflowScrolling="auto"),(0,t.jsx)("div",{...U,className:"scrollbar-view",id:R})),[R]),V=(0,r.useCallback)(()=>{T.current&&g&&g(T.current.getValues())},[g]);return(0,t.jsx)(o.Ay,{"data-testid":c,ref:T,className:(0,n.cx)(L.customScrollbar,p,{[L.scrollbarWithScrollIndicators]:v}),onScrollStop:V,autoHeight:!0,autoHide:i,autoHideTimeout:x,hideTracksWhenNotNeeded:d,autoHeightMax:P,autoHeightMin:y,renderTrackHorizontal:A,renderTrackVertical:W,renderThumbHorizontal:N,renderThumbVertical:w,renderView:j,onScroll:O,children:v?(0,t.jsx)(m,{children:I}):I})},f=l,h=i=>({customScrollbar:(0,n.css)({display:"flex",flexGrow:1,".scrollbar-view":{display:"flex",flexGrow:1,flexDirection:"column"},".track-vertical":{borderRadius:i.shape.borderRadius(2),width:`${i.spacing(1)} !important`,right:0,bottom:i.spacing(.25),top:i.spacing(.25)},".track-horizontal":{borderRadius:i.shape.borderRadius(2),height:`${i.spacing(1)} !important`,right:i.spacing(.25),bottom:i.spacing(.25),left:i.spacing(.25)},".thumb-vertical":{background:i.colors.action.focus,borderRadius:i.shape.borderRadius(2),opacity:0},".thumb-horizontal":{background:i.colors.action.focus,borderRadius:i.shape.borderRadius(2),opacity:0}
12,"&:hover":{".thumb-vertical, .thumb-horizontal":{opacity:1,transition:"opacity 0.3s ease-in-out"}}}),scrollbarWithScrollIndicators:(0,n.css)({".scrollbar-view":{position:"static !important"}})});function u(i,x){(0,r.useEffect)(()=>{i&&x!=null&&i.scrollTop(x)},[x,i])}},28134:(ee,B,e)=>{"use strict";e.d(B,{R:()=>r});var t=e(74848),n=e(45861);function r({link:o,buttonProps:s}){return(0,t.jsx)("a",{href:o.href,target:o.target,rel:"noreferrer",onClick:o.onClick?m=>{!(m.ctrlKey||m.metaKey||m.shiftKey)&&o.onClick&&(m.preventDefault(),o.onClick(m))}:void 0,children:(0,t.jsx)(n.$n,{icon:o.target==="_blank"?"external-link-alt":"link",variant:"primary",size:"sm",...s,children:o.title})})}},81917:(ee,B,e)=>{"use strict";e.d(B,{l:()=>O});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(28848),a=e.n(m),l=e(96540),f=e(80292),h=e(52845),u=e(29317),i=e(79609),x=e(38036),g=e(56103),p=e(63142),c=e(35458),y=e(63527),P=e(15245),d=e(92807),D=e(81563);class b{getBoundingClientRect(){const T=window.getSelection(),L=T&&T.anchorNode;return L&&L.parentElement?L.parentElement.getBoundingClientRect():{top:0,left:0,bottom:0,right:0,width:0,height:0,x:0,y:0,toJSON:()=>{}}}get clientWidth(){return this.getBoundingClientRect().width}get clientHeight(){return this.getBoundingClientRect().height}}const E=(R,T)=>R-T*Math.floor(R/T),v={builtInVariable:{pattern:/(\${\S+?})/}},C=[(0,g.D)({onlyIn:R=>"type"in R&&R.type==="code_block",getSyntax:()=>"links"},{...a().languages,links:v})],S=R=>({input:(0,y.n)({theme:R,invalid:!1}).input,editor:(0,n.css)({".token.builtInVariable":{color:R.colors.success.text},".token.variable":{color:R.colors.primary.text}}),suggestionsWrapper:(0,n.css)({boxShadow:R.shadows.z2}),wrapperOverrides:(0,n.css)({width:"100%","> .slate-query-field__wrapper":{padding:0,backgroundColor:"transparent",border:"none"}})}),O=(0,l.memo)(({value:R,onChange:T,suggestions:L,placeholder:K="http://your-grafana.com/d/000000010/annotations"})=>{const A=(0,l.useRef)(null),W=(0,p.of)(S),[N,w]=(0,l.useState)(!1),[j,V]=(0,l.useState)(0),[U,F]=(0,l.useState)((0,c.mO)(R)),M=(0,f.A)(U),[H,_]=(0,l.useState)(0),Z=(0,l.useRef)(null);(0,l.useEffect)(()=>{Z.current?.scrollTo(0,H)},[H]);const ne=[(0,r.cY)(({rects:ae})=>({alignmentAxis:ae.reference.width})),(0,r.UU)({fallbackAxisSideDirection:"start",crossAxis:!1,boundary:document.body}),(0,r.BN)()],{refs:te,floatingStyles:Y}=(0,o.we)({open:N,placement:"bottom-start",onOpenChange:w,middleware:ne,whileElementsMounted:s.ll,strategy:"fixed"}),Q=(0,l.useRef)({showingSuggestions:N,suggestions:L,suggestionsIndex:j,linkUrl:U,onChange:T});Q.current={showingSuggestions:N,suggestions:L,suggestionsIndex:j,linkUrl:U,onChange:T};const J=(0,l.useRef)(null);(0,l.useEffect)(()=>{_(I(J.current,j))},[j]);const q=l.useCallback((ae,ie)=>{if(!Q.current.showingSuggestions){if(ae.key==="="||ae.key==="$"||ae.keyCode===32&&ae.ctrlKey){const fe=new b;return te.setReference(fe),w(!0)}return ie()}switch(ae.key){case"Backspace":Q.current.linkUrl.focusText.getText().length===1&&ie();case"Escape":return w(!1),V(0);case"Enter":return ae.preventDefault(),se(Q.current.suggestions[Q.current.suggestionsIndex]);case"ArrowDown":case"ArrowUp":ae.preventDefault();const fe=ae.key==="ArrowDown"?1:-1;return V(pe=>E(pe+fe,Q.current.suggestions.length));default:return ie()}},[]);(0,l.useEffect)(()=>{M&&M.selection.isFocused&&!U.selection.isFocused&&Q.current.onChange(h.default.serialize(U))},[U,M]);const X=l.useCallback(({value:ae})=>{F(ae)},[]),se=(ae,ie=A.current)=>{const pe=oe()==="$";ae.origin!==i.$0.Template||ae.value===x.c.includeVars?ie.insertText(`${pe?"":"$"}{${ae.value}}`):ie.insertText(`${pe?"":"$"}{${ae.value}:queryparam}`),F(ie.value),w(!1),V(0),Q.current.onChange(h.default.serialize(ie.value))},oe=()=>{const ae=document.getElementById("data-link-input");let ie="",fe,pe;return window.getSelection&&(fe=window.getSelection(),fe&&fe.rangeCount>0&&(pe=fe.getRangeAt(0).cloneRange(),pe.collapse(!0),pe.setStart(ae,0),ie=pe.toString().slice(-1))),ie};return(0,t.jsx)("div",{className:W.wrapperOverrides,children:(0,t.jsx)("div",{className:"slate-query-field__wrapper",children:(0,t.jsxs)("div",{id:"data-link-input",className:"slate-query-field",children:[N&&(0,t.jsx)(P.ZL,{children:(0,t.jsx)("div",{ref:te.setFloating,style:Y,children:(0,t.jsx)(d.P,{maxHeight:"300px",ref:Z,onScroll:ae=>_(ae.currentTarget.scrollTop),children:(0,t.jsx)(D.k,{activeRef:J,suggestions:Q.current.suggestions,onSuggestionSelect:se,onClose:()=>w(!1),activeIndex:j})})})}),(0,t.jsx)(u.Editor,{schema:c.yx,ref:A,placeholder:K,value:Q.current.linkUrl,onChange:X,onKeyDown:(ae,ie,fe)=>q(ae,fe),plugins:C,className:(0,n.cx)(W.editor,W.input,(0,n.css)({padding:"3px 8px"}))})]})})})});O.displayName="DataLinkInput";function I(R,T){return(R?.clientHeight??0)*T}},81563:(ee,B,e)=>{"use strict";e.d(B,{k:()=>h});var t=e(74848),n=e(96540),r=e(22803),o=e(2543),s=e.n(o),m=e(37151),a=e(63142),l=e(5585);const f=i=>({list:(0,r.css)({borderBottom:`1px solid ${i.colors.border.weak}`,"&:last-child":{border:"none"}}),wrapper:(0,r.css)({background:i.colors.background.primary,width:"250px"}),item:(0,r.css)({background:"none",padding:"2px 8px",userSelect:"none",color:i.colors.text.primary,cursor:"pointer","&:hover":{background:i.colors.action.hover}}),label:(0,r.css)({color:i.colors.text.secondary}),activeItem:(0,r.css)({background:i.colors.background.secondary,"&:hover":{background:i.colors.background.secondary}}),itemValue:(0,r.css)({fontFamily:i.typography.fontFamilyMonospace,fontSize:i.typography.size.sm})}),h=({suggestions:i,...x})=>{const g=(0,n.useRef)(null);(0,m.A)(g,()=>{x.onClose&&x.onClose()});const p=(0,n.useMemo)(()=>(0,o.groupBy)(i,y=>y.origin),[i]),c=(0,a.of)(f);return(0,t.jsx)("div",{role:"menu",ref:g,className:c.wrapper,children:Object.keys(p).map((y,P)=>{const d=P===0?0:Object.keys(p).reduce((D,b,E)=>E>=P?D:D+p[b].length,0);return(0,n.createElement)(u,{...x,suggestions:p[y],label:(0,o.capitalize)(y),activeIndex:x.activeIndex,activeIndexOffset:d,key:y})})})};h.displayName="DataLinkSuggestions";const u=n.memo(({activeIndex:i,activeIndexOffset:x,label:g,onClose:p,onSuggestionSelect:c,suggestions:y,activeRef:P})=>{const d=(0,a.of)(f);return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(l.B,{className:d.list,items:y,renderItem:(D,b)=>{const E=b+x===i;return(0,t.jsx)("div",{role:"menuitem",tabIndex:0,className:(0,r.cx)(d.item,E&&d.activeItem),ref:E?P:void 0,onClick:()=>{c(D)},title:D.documentation,children:(0,t.jsxs)("span",{className:d.itemValue,children:[(0,t.jsx)("span",{className:d.label,children:g})," ",D.label]})})}})})});u.displayName="DataLinkSuggestionsList"},6399:(ee,B,e)=>{"use strict";e.d(B,{e:()=>f});var t=e(74848),n=e(22803),r=e(85629),o=e(63142),s=e(75254),m=e(41479),a=e(30930),l=e(94535);const f=({children:u,links:i,style:x})=>{const g=(0,o.of)(h),p=[{items:(0,s.J)(i),label:i().length?"Data links":""}],c=p[0].items.length,y=()=>p.map((d,D)=>(0,t.jsx)(a.r,{label:d.label,children:(d.items||[]).map((b,E)=>
12(0,t.jsx)(l.D,{url:b.url,label:b.label,target:b.target,icon:b.icon,active:b.active,onClick:b.onClick,className:g.itemWrapper},`${d.label}-${D}-${E}}`))},`${d.label}${D}`)),P=(0,n.css)({cursor:"context-menu"});if(c>1)return(0,t.jsx)(m.n,{renderMenuItems:y,children:({openMenu:d})=>u({openMenu:d,targetClassName:P})});{const d=i()[0];return(0,t.jsx)("a",{href:d.href,onClick:d.onClick,target:d.target,title:d.title,style:{...x,overflow:"hidden",display:"flex"},"data-testid":r.Tp.components.DataLinksContextMenu.singleLink,children:u({})})}},h=u=>({itemWrapper:(0,n.css)({fontSize:12})})},96822:(ee,B,e)=>{"use strict";e.d(B,{e:()=>c});var t=e(74848),n=e(96540),r=e(7685),o=e(45861),s=e(22787),m=e(22803),a=e(63142),l=e(37386),f=e(63527),h=e(21285),u=e(81917);const i=y=>({listItem:(0,m.css)({marginBottom:y.spacing()}),infoText:(0,m.css)({paddingBottom:y.spacing(2),marginLeft:"66px",color:y.colors.text.secondary})}),x=(0,n.memo)(({index:y,value:P,onChange:d,suggestions:D,isLast:b,showOneClick:E=!1})=>{const v=(0,a.of)(i),C=(R,T)=>{d(y,{...P,url:R},T)},S=R=>{d(y,{...P,title:R.target.value})},O=()=>{d(y,{...P,targetBlank:!P.targetBlank})},I=()=>{d(y,{...P,oneClick:!P.oneClick})};return(0,t.jsxs)("div",{className:v.listItem,children:[(0,t.jsx)(l.D,{label:(0,r.t)("grafana-ui.data-link-editor.title-label","Title"),children:(0,t.jsx)(f.p,{value:P.title,onChange:S,placeholder:(0,r.t)("grafana-ui.data-link-editor.title-placeholder","Show details")})}),(0,t.jsx)(l.D,{label:(0,r.t)("grafana-ui.data-link-editor.url-label","URL"),children:(0,t.jsx)(u.l,{value:P.url,onChange:C,suggestions:D})}),(0,t.jsx)(l.D,{label:(0,r.t)("grafana-ui.data-link-editor.new-tab-label","Open in new tab"),children:(0,t.jsx)(h.d,{value:P.targetBlank||!1,onChange:O})}),E&&(0,t.jsx)(l.D,{label:(0,r.t)("grafana-ui.data-link-inline-editor.one-click","One click"),description:(0,r.t)("grafana-ui.data-link-editor-modal.one-click-description","Only one link can have one click enabled at a time"),children:(0,t.jsx)(h.d,{value:P.oneClick||!1,onChange:I})}),b&&(0,t.jsx)("div",{className:v.infoText,children:(0,t.jsx)(r.x,{i18nKey:"grafana-ui.data-link-editor.info",children:"With data links you can reference data variables like series name, labels and values. Type CMD+Space, CTRL+Space, or $ to open variable suggestions."})})]})});x.displayName="DataLinkEditor";const g=({link:y,index:P,onSave:d,onCancel:D,getSuggestions:b,showOneClick:E})=>{const[v,C]=(0,n.useState)(y);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x,{value:v,index:P,isLast:!1,onChange:(S,O)=>{C(O)},suggestions:b(),showOneClick:E}),(0,t.jsxs)(s.a.ButtonRow,{children:[(0,t.jsx)(o.$n,{variant:"secondary",onClick:()=>D(P),fill:"outline",children:(0,t.jsx)(r.x,{i18nKey:"grafana-ui.data-link-editor-modal.cancel",children:"Cancel"})}),(0,t.jsx)(o.$n,{onClick:()=>{d(P,v)},disabled:v.title.trim()===""||v.url.trim()==="",children:(0,t.jsx)(r.x,{i18nKey:"grafana-ui.data-link-editor-modal.save",children:"Save"})})]})]})};var p=e(73628);const c=({links:y,getSuggestions:P,showOneClick:d=!1,...D})=>(0,t.jsx)(p.J,{type:"link",items:y,...D,children:(b,E,v,C)=>(0,t.jsx)(g,{index:E,link:b??{title:"",url:""},data:D.data,onSave:v,onCancel:C,getSuggestions:P,showOneClick:d})})},73628:(ee,B,e)=>{"use strict";e.d(B,{J:()=>p});var t=e(74848),n=e(22803),r=e(57095),o=e(2543),s=e(96540),m=e(63142),a=e(7685),l=e(45861),f=e(22787),h=e(99887),u=e(30703),i=e(76319);function x({item:y,onEdit:P,onRemove:d,index:D,itemKey:b}){const E=(0,m.of)(g),{title:v="",oneClick:C=!1}=y,S=y.url??y.fetch?.url??"",O=v.trim()!=="",I=S.trim()!=="";return(0,t.jsx)(r.Draggable,{draggableId:b,index:D,children:R=>(0,s.createElement)("div",{className:(0,n.cx)(E.wrapper,E.dragRow),ref:R.innerRef,...R.draggableProps,key:D},(0,t.jsxs)("div",{className:E.linkDetails,children:[(0,t.jsx)("div",{className:(0,n.cx)(E.url,!O&&E.notConfigured),children:O?v:(0,a.t)("grafana-ui.data-links-inline-editor.title-not-provided","Title not provided")}),(0,t.jsx)("div",{className:(0,n.cx)(E.url,!I&&E.notConfigured),title:S,children:I?S:(0,a.t)("grafana-ui.data-links-inline-editor.url-not-provided","Data link url not provided")})]}
12),(0,t.jsxs)("div",{className:E.icons,children:[C&&(0,t.jsx)(h.E,{color:"blue",text:(0,a.t)("grafana-ui.data-links-inline-editor.one-click","One click"),tooltip:(0,a.t)("grafana-ui.data-links-inline-editor.one-click-enabled","One click enabled")}),(0,t.jsx)(i.K,{name:"pen",onClick:P,className:E.icon,tooltip:(0,a.t)("grafana-ui.data-links-inline-editor.tooltip-edit","Edit")}),(0,t.jsx)(i.K,{name:"trash-alt",onClick:d,className:E.icon,tooltip:(0,a.t)("grafana-ui.data-links-inline-editor.tooltip-remove","Remove")}),(0,t.jsx)("div",{className:E.dragIcon,...R.dragHandleProps,children:(0,t.jsx)(u.I,{name:"draggabledots",size:"lg"})})]}))},b)}const g=y=>({wrapper:(0,n.css)({display:"flex",flexGrow:1,alignItems:"center",justifyContent:"space-between",padding:"5px 0 5px 10px",borderRadius:y.shape.radius.default,background:y.colors.background.secondary,gap:8}),linkDetails:(0,n.css)({display:"flex",flexDirection:"column",flexGrow:1,maxWidth:"calc(100% - 100px)"}),errored:(0,n.css)({color:y.colors.error.text,fontStyle:"italic"}),notConfigured:(0,n.css)({fontStyle:"italic"}),title:(0,n.css)({color:y.colors.text.primary,fontSize:y.typography.size.sm,fontWeight:y.typography.fontWeightMedium}),url:(0,n.css)({color:y.colors.text.secondary,fontSize:y.typography.size.sm,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),dragRow:(0,n.css)({position:"relative",margin:"8px"}),icons:(0,n.css)({display:"flex",padding:6,alignItems:"center",gap:8}),dragIcon:(0,n.css)({cursor:"grab",color:y.colors.text.secondary,margin:y.spacing(0,.5)}),icon:(0,n.css)({color:y.colors.text.secondary})});function p({type:y,items:P,onChange:d,data:D,children:b}){const[E,v]=(0,s.useState)(null),[C,S]=(0,s.useState)(!1),[O,I]=(0,s.use
12State)([]);(0,s.useEffect)(()=>{I(P??[])},[P]);const R=(0,m.of)(c),T=E!==null,L=(j,V)=>{if(C){const F=V.title,M=V.url??V.fetch?.url??"";if(F.trim()===""&&M.trim()===""){S(!1),v(null);return}else v(null),S(!1)}V.oneClick===!0&&O.forEach(F=>{F.oneClick&&(F.oneClick=!1)});const U=(0,o.cloneDeep)(O);U[j]=V,d(U),v(null)},K=j=>{C&&S(!1),v(null)},A=()=>{let j=(0,o.cloneDeep)(O);v(j.length),S(!0)},W=j=>{const V=(0,o.cloneDeep)(O);V.splice(j,1),d(V)},N=j=>{if(P==null||j.destination==null)return;const V=(0,o.cloneDeep)(O),U=V[j.source.index];V.splice(j.source.index,1),V.splice(j.destination.index,0,U),I(V),d(V)},w=j=>{let V="";switch(y){case"link":V=j==="edit"?(0,a.t)("grafana-ui.data-links-inline-editor.edit-link","Edit link"):(0,a.t)("grafana-ui.data-links-inline-editor.add-link","Add link");break;case"action":V=j==="edit"?(0,a.t)("grafana-ui.action-editor.inline.edit-action","Edit action"):(0,a.t)("grafana-ui.action-editor.inline.add-action","Add action");break}return V};return(0,t.jsxs)("div",{className:R.container,children:[(0,t.jsx)(r.DragDropContext,{onDragEnd:N,children:(0,t.jsx)(r.Droppable,{droppableId:"sortable-links",direction:"vertical",children:j=>(0,t.jsxs)("div",{className:R.wrapper,ref:j.innerRef,...j.droppableProps,children:[O.map((V,U)=>{const F=`${V.title}/${U}`;return(0,t.jsx)(x,{index:U,item:V,onChange:L,onEdit:()=>v(U),onRemove:()=>W(U),data:D,itemKey:F},F)}),j.placeholder]})})}),T&&E!==null&&(0,t.jsx)(f.a,{title:w(C?"add":"edit"),isOpen:!0,closeOnBackdropClick:!1,onDismiss:()=>{K(E)},children:b(O[E],E,L,K)}),(0,t.jsx)(l.$n,{size:"sm",icon:"plus",onClick:A,variant:"secondary",className:R.button,children:w("add")})]})}const c=y=>({container:(0,n.css)({position:"relative"}),wrapper:(0,n.css)({marginBottom:y.spacing(2),display:"flex",flexDirection:"column"}),button:(0,n.css)({marginLeft:y.spacing(1)})})},45558:(ee,B,e)=>{"use strict";e.d(B,{K:()=>l});var t=e(74848),n=e(7685),r=e(45861),o=e(18027),s=e(97095),m=e(63527),a=e(87105);const l=({hasCert:f,label:h,onChange:u,onClick:i,placeholder:x})=>(0,t.jsxs)(s.C,{children:[(0,t.jsx)(o.I,{label:h,labelWidth:14,disabled:f,children:f?(0,t.jsx)(m.p,{type:"text",value:"configured",width:24}):(0,t.jsx)(a.f,{rows:7,onChange:u,placeholder:x,required:!0})}),f&&(0,t.jsx)(r.$n,{variant:"secondary",onClick:i,style:{marginLeft:4},children:(0,t.jsx)(n.x,{i18nKey:"grafana-ui.data-source-settings.cert-key-reset",children:"Reset"})})]})},55803:(ee,B,e)=>{"use strict";e.d(B,{P:()=>g});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(96540),m=e(63142),a=e(7685),l=e(45861),f=e(94959),h=e(30703),u=e(23659);const i=()=>({layout:(0,n.css)({display:"flex",alignItems:"center",marginBottom:"4px","> *":{marginLeft:"4px",marginBottom:0,height:"100%","&:first-child, &:last-child":{marginLeft:0}}})}),x=({header:c,onBlur:y,onChange:P,onRemove:d,onReset:D})=>{const b=(0,m.of)(i);return(0,t.jsxs)("div",{className:b.layout,children:[(0,t.jsx)(f.z,{label:(0,a.t)("grafana-ui.data-source-settings.custom-headers-header","Header"),name:"name",placeholder:"X-Custom-Header",labelWidth:5,value:c.name||"",onChange:E=>P({...c,name:E.target.value}),onBlur:y}),(0,t.jsx)(u.L,{label:(0,a.t)("grafana-ui.data-source-settings.custom-headers-header-value","Value"),"aria-label":(0,a.t)("grafana-ui.data-source-settings.custom-headers-header-value","Value"),name:"value",isConfigured:c.configured,value:c.value,labelWidth:5,inputWidth:c.configured?11:12,placeholder:(0,a.t)("grafana-ui.data-source-settings.custom-headers-header-placeholder","Header Value"),onReset:()=>D(c.id),onChange:E=>P({...c,value:E.target.value}),onBlur:y}),(0,t.jsx)(l.$n,{type:"button","aria-label":(0,a.t)("grafana-ui.data-source-settings.custom-headers-header-remove","Remove header"),variant:"secondary",size:"xs",onClick:E=>d(c.id),children:(0,t.jsx)(h.I,{name:"trash-alt"})})]})};x.displayName="CustomHeaderRow";class g extends s.PureComponent{constructor(y){super(y),this.state={headers:[]},this.updateSettings=()=>{const{headers:b}=this.state,E=Object.fromEntries(Object.entries(this.props.dataSourceConfig.jsonData).filter(([C,S])=>!C.startsWith("httpHeaderName"))),v=Object.fromEntries(Object.entries(this.props.dataSourceConfig.secureJsonData||{}).filter(([C,S])=>!C.startsWith("httpHeaderValue")));for(const[C,S]of b.entries())E[`httpHeaderName${C+1}`]=S.name,S.configured||(v[`httpHeaderValue${C+1}`]=S.value);this.props.onChange({...this.props.dataSourceConfig,jsonData:E,secureJsonData:v})},this.onHeaderAdd=()=>{this.setState(b=>({headers:[...b.headers,{id:(0,r.uniqueId)(),name:"",value:"",configured:!1}]}))},this.onHeaderChange=(b,E)=>{this.setState(({headers:v})=>({headers:v.map((C,S)=>b!==S?C:{...E})}))},this.onHeaderReset=b=>{this.setState(({headers:E})=>({headers:E.map((v,C)=>v.id!==b?v:{...v,value:"",configured:!1})}))},this.onHeaderRemove=b=>{this.setState(({headers:E})=>({headers:E.filter(v=>v.id!==b)}),this.updateSettings)};const{jsonData:P,secureJsonData:d,secureJsonFields:D}=this.props.dataSourceConfig;this.state={headers:Object.keys(P).sort().filter(b=>b.startsWith("httpHeaderName")).map((b,E)=>({id:(0,r.uniqueId)(),name:P[b],value:d!==void 0?d[b]:"",configured:D&&D[`httpHeaderValue${E+1}`]||!1}))}}render(){const{headers:y}=this.state,{dataSourceConfig:P}=this.props;return(0,t.jsxs)("div",{className:"gf-form-group",children:[(0,t.jsx)("div",{className:"gf-form",children:(0,t.jsx)("h6",{children:(0,t.jsx)(a.x,{i18nKey:"grafana-ui.data-source-settings.custom-headers-title",children:"Custom HTTP Headers"})})}),(0,t.jsx)("div",{children:y.map((d,D)=>(0,t.jsx)(x,{header:d,onChange:b=>{this.onHeaderChange(D,b)},onBlur:this.updateSettings,onRemove:this.onHeaderRemove,onReset:this.onHeaderReset},d.id))}),!P.readOnly&&(0,t.jsx)("div",{className:"gf-form",children:(0,t.jsx)(l.$n,{variant:"secondary",icon:"plus",type:"button",onClick:d=>{this.onHeaderAdd()},children:(0,t.jsx)(a.x,{i18nKey:"grafana-ui.data-source-settings.custom-headers-add",children:"Add header"})})})]})}}var p=null},96004:(ee,B,e)=>{"use strict";e.d(B,{t:()=>L});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(63142),m=e(7685),a=e(34999),l=e(45861),f=e(37386),h=e(18027),u=e(77824),i=e(30703),x=e(63527),g=e(41654),p=e(21285),c=e(10928),y=e(66404),P=e(94959),d=e(23659);const D=({dataSourceConfig:K,onChange:A})=>{const W=K.secureJsonData?K.secureJsonData.basicAuthPassword:"",N=()=>{A({...K,secureJsonData:{...K.secureJsonData,basicAuthPassword:""},secureJsonFields:{...K.secureJsonFields,basicAuthPassword:!1}})},w=j=>{A({...K,secureJsonData:{...K.secureJsonData,basicAuthPassword:j.currentTarget.value}})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.I,{disabled:K.readOnly,children:(0,t.jsx)(P.z,{label:(0,m.t)("grafana-ui.data-source-basic-auth-settings.user-label","User"),labelWidth:10,inputWi
12dth:18,placeholder:(0,m.t)("grafana-ui.data-source-basic-auth-settings.user-placeholder","user"),value:K.basicAuthUser,onChange:j=>A({...K,basicAuthUser:j.currentTarget.value})})}),(0,t.jsx)(h.I,{disabled:K.readOnly,children:(0,t.jsx)(d.L,{isConfigured:!!(K.secureJsonFields&&K.secureJsonFields.basicAuthPassword),value:W||"",inputWidth:18,labelWidth:10,onReset:N,onChange:w})})]})};var b=e(55803);const E=26,v=({dataSourceConfig:K,onChange:A,showForwardOAuthIdentityOption:W=!0})=>{const N=(0,s.of)(C);return(0,t.jsxs)("div",{className:N,children:[(0,t.jsxs)(g.B,{direction:"row",gap:.5,children:[(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-proxy-settings.ts-client-auth-label","TLS Client Auth"),labelWidth:E,disabled:K.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-tls-client-auth",value:K.jsonData.tlsAuth||!1,onChange:w=>A({...K.jsonData,tlsAuth:w.currentTarget.checked})})}),(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-proxy-settings.with-ca-cert-label","With CA Cert"),tooltip:(0,m.t)("grafana-ui.data-source-http-proxy-settings.with-ca-cert-tooltip","Needed for verifying self
12-signed TLS Certs"),labelWidth:E,disabled:K.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-ca-cert",value:K.jsonData.tlsAuthWithCACert||!1,onChange:w=>A({...K.jsonData,tlsAuthWithCACert:w.currentTarget.checked})})})]}),(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-proxy-settings.skip-tls-verify-label","Skip TLS Verify"),labelWidth:E,disabled:K.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-skip-tls-verify",value:K.jsonData.tlsSkipVerify||!1,onChange:w=>A({...K.jsonData,tlsSkipVerify:w.currentTarget.checked})})}),W&&(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-proxy-settings.oauth-identity-label","Forward OAuth Identity"),tooltip:(0,m.t)("grafana-ui.data-source-http-proxy-settings.oauth-identity-tooltip","Forward the user's upstream OAuth identity to the data source (Their access token gets passed along)."),labelWidth:E,disabled:K.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-forward-oauth",value:K.jsonData.oauthPassThru||!1,onChange:w=>A({...K.jsonData,oauthPassThru:w.currentTarget.checked})})})]})},C=K=>(0,n.css)({display:"grid",gridTemplateColumns:"auto",gap:0});var S=e(3936),O=e(37235);const I="grafana-http-access-help",R=()=>(0,t.jsxs)(a.F,{severity:"info",title:(0,m.t)("grafana-ui.data-source-http-settings.access-help-title","Access help"),topSpacing:3,id:I,children:[(0,t.jsx)("p",{children:(0,t.jsxs)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.access-help-details",children:["Access mode controls how requests to the data source will be handled.",(0,t.jsxs)("strong",{children:["\xA0",(0,t.jsx)("i",{children:"Server"})]})," ","should be the preferred way if nothing else is stated."]})}),(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.server-mode-title",children:(0,t.jsx)(y.E,{weight:"medium",children:"Server access mode (Default):"})}),(0,t.jsx)("p",{children:(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.server-mode-description",children:"All requests will be made from the browser to Grafana backend/server which in turn will forward the requests to the data source and by that circumvent possible Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the grafana backend/server if you select this access mode."})}),(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.browser-mode-title",children:(0,t.jsx)(y.E,{weight:"medium",children:"Browser access mode:"})}),(0,t.jsx)("p",{children:(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.browser-mode-description",children:"All requests will be made from the browser directly to the data source and may be subject to Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the browser if you select this access mode."})})]}),T=26,L=K=>{const{defaultUrl:A,dataSourceConfig:W,onChange:N,showAccessOptions:w,sigV4AuthToggleEnabled:j,showForwardOAuthIdentityOption:V,azureAuthSettings:U,renderSigV4Editor:F,secureSocksDSProxyEnabled:M,urlLabel:H,urlDocs:_}=K,Z=(0,r.useMemo)(()=>[{label:(0,m.t)("grafana-ui.data-source-http-settings.server-mode-label","Server (default)"),value:"proxy"},{label:(0,m.t)("grafana-ui.data-source-http-settings.browser-mode-label","Browser"),value:"direct"}],[]),ne=(0,r.useMemo)(()=>Z[0],[Z]),[te,Y]=(0,r.useState)(!1),[Q,J]=(0,r.useState)(!1),q=(0,s.$j)();let X;const se=(0,r.useCallback)(fe=>{const pe=U?.azureAuthSupported&&U.getAzureAuthEnabled(W)||!1;if(J(pe),pe){const de=W.jsonData.oauthPassThru!==void 0?W.jsonData.oauthPassThru:!1;fe={...fe,jsonData:{...W.jsonData,oauthPassThru:pe?!1:de}}}N({...W,...fe})},[U,W,N]);switch(W.access){case"direct":X=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.direct-url-tooltip",children:["Your access method is ",(0,t.jsx)("em",{children:"Browser"}),", this means the URL needs to be accessible from the browser."]}),_]});break;case"proxy":X=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.proxy-url-tooltip",children:["Your access method is ",(0,t.jsx)("em",{children:"Server"}),", this means the URL needs to be accessible from the grafana backend
12/server."]}),_]});break;default:X=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.default-url-tooltip",children:"Specify a complete HTTP URL (for example http://your_server:8080)"}),_]})}const oe=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/.test(W.url),ae=(0,n.css)({display:"grid",gridTemplateColumns:"auto 1fr",gap:q.spacing(.5)}),ie=(0,r.useId)();return(0,t.jsxs)(g.B,{direction:"column",gap:5,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h3",{className:"page-heading",children:(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.heading",children:"HTTP"})}),(0,t.jsx)(f.D,{label:H??"URL",description:X,invalid:!oe,error:!oe&&(0,m.t)("grafana-ui.data-source-http-settings.invalid-url-error","Invalid URL"),disabled:W.readOnly,children:(0,t.jsx)(x.p,{id:ie,width:40,placeholder:A,value:W.url,"data-testid":o.Tp.components.DataSource.DataSourceHttpSettings.urlInput,onChange:fe=>se({url:fe.currentTarget.value})})}),w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.D,{label:(0,m.t)("grafana-ui.data-source-http-settings.access-label","Access"),disabled:W.readOnly,children:(0,t.jsxs)(g.B,{direction:"row",gap:.5,children:[(0,t.jsx)(u.z,{"aria-label":(0,m.t)("grafana-ui.data-source-http-settings.access-label","Access"),options:Z,value:Z.find(fe=>fe.value===W.access)?.value||ne.value,onChange:fe=>se({access:fe})}),(0,t.jsx)(l.$n,{type:"button",variant:"secondary",size:"md",fill:"outline",onClick:()=>Y(fe=>!fe),"aria-expanded":te,"aria-controls":I,children:(0,t.jsxs)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.access-help",children:["Help\xA0",(0,t.jsx)(i.I,{name:te?"angle-down":"angle-right"})]})})]})}),te&&(0,t.jsx)(R,{})]}),W.access==="proxy"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.D,{label:(0,m.t)("grafana-ui.data-source-http-settings.allowed-cookies","Allowed cookies"),description:(0,m.t)("grafana-ui.data-source-http-settings.allowed-cookies-description","Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source."),children:(0,t.jsx)(c.u,{tags:W.jsonData.keepCookies,width:40,onChange:fe=>se({jsonData:{...W.jsonData,keepCookies:fe}}),disabled:W.readOnly})}),(0,t.jsx)(f.D,{label:(0,m.t)("grafana-ui.data-source-http-settings.timeout-label","Timeout"),description:(0,m.t)("grafana-ui.data-source-http-settings.timeout-description","HTTP request timeout in seconds"),disabled:W.readOnly,children:(0,t.jsx)(x.p,{type:"number",width:40,placeholder:(0,m.t)("grafana-ui.data-source-http-settings.timeout-placeholder","Timeout in seconds"),value:W.jsonData.timeout,onChange:fe=>{se({jsonData:{...W.jsonData,timeout:parseInt(fe.currentTarget.value,10)}})}})})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h3",{className:"page-heading",children:(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.auth",children:"Auth"})}),(0,t.jsxs)(g.B,{direction:"column",gap:4,children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:ae,children:[(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-settings.basic-auth-label","Basic auth"),labelWidth:T,disabled:W.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-basic-auth",value:W.basicAuth,onChange:fe=>{se({basicAuth:fe.currentTarget.checked})}})}),(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-settings.with-credentials-label","With Credentials"),tooltip:(0,m.t)("grafana-ui.data-source-http-settings.with-credentials-tooltip","Whether credentials such as cookies or auth headers should be sent with cross-site requests."),labelWidth:T,disabled:W.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-with-credentials",value:W.withCredentials,onChange:fe=>{se({withCredentials:fe.currentTarget.checked})}})}),U?.azureAuthSupported&&(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-settings.azure-auth-label","Azure Authentication"),tooltip:(0,m.t)("grafana-ui.data-source-http-settings.azure-auth-tooltip","Use Azure authentication for Azure endpoint."),labelWidth:T,disabled:W.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-azure-auth",value:Q,onChange:fe=>{se(U.setAzureAuthEnabled(W,fe.currentTarget.checked))}})}),j&&(0,t.jsx)(h.I,{label:(0,m.t)("grafana-ui.data-source-http-settings.sigv4-auth-label","SigV4 auth"),labelWidth:T,disabled:W.readOnly,children:(0,t.jsx)(p.K,{id:"http-settings-sigv4-auth",value:W.jsonData.sigV4Auth||!1,onChange:fe=>{se({jsonData:{...W.jsonData,sigV4Auth:fe.currentTarget.checked}})}})})]}),W.access==="proxy"&&(0,t.jsx)(v,{dataSourceConfig:W,onChange:fe=>se({jsonData:fe}),showForwardOAuthIdentityOption:Q?!1:V})]}),W.basicAuth&&(0,t.jsxs)("section",{children:[(0,t.jsx)(y.E,{variant:"h6",element:"h4",children:(0,t.jsx)(m.x,{i18nKey:"grafana-ui.data-source-http-settings.basic-auth",children:"Basic Auth Details"})}),(0,t.jsx)(D,{...K})]}),U?.azureAuthSupported&&Q&&U.azureSettingsUI&&(0,t.jsx)(U.azureSettingsUI,{dataSourceConfig:W,onChange:N}),W.jsonData.sigV4Auth&&j&&F,(W.jsonData.tlsAuth||W.jsonData.tlsAuthWithCACert)&&(0,t.jsx)(O.j,{dataSourceConfig:W,onChange:N}),W.access==="proxy"&&(0,t.jsx)(b.P,{dataSourceConfig:W,onChange:N})]})]}),M&&(0,t.jsx)(S.Y,{options:W,onOptionsChange:N})]})}},3936:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>s});var t=e(74848),n=e(21285),r=e(7685),o=e(18027);function s({options:m,onOptionsChange:a}){return(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"page-heading",children:(0,t.jsx)(r.x,{i18nKey:"grafana-ui.data-source-settings.secure-socks-heading",children:"Secure Socks Proxy"})}),(0,t.jsx)("div",{className:"gf-form-group",children:(0,t.jsx)("div",{className:"gf-form-inline",children:(0,t.jsx)("div",{className:"gf-form",children:(0,t.jsx)(o.I,{labelWidth:26,label:(0,r.t)("grafana-ui.data-source-settings.secure-socks-label","Enabled"),tooltip:(0,r.t)("grafana-ui.data-source-settings.secure-socks-tooltip","Connect to this datasource via the secure socks proxy."),children:(0,t.jsx)(n.K,{value:m.jsonData.enableSecureSocksProxy??!1,onChange:l=>a({...m,jsonData:{...m.jsonData,enableSecureSocksProxy:l.currentTarget.checked}})})})})})})]})}},37235:(ee,B,e)=>{"use strict";e.d(B,{j:()=>l});var t=e(74848),n=e(22803),r=e(7685),o=e(94959),s=e(30703),m=e(45967),a=e(45558);const l=({dataSourceConfig:f,onChange:h})=>{const u=f.secureJsonFields&&f.secureJsonFields.tlsCACert,i=f.secureJsonFields&&f.secureJsonFields.tlsClientCert,x=f.secureJsonFields&&f.secureJsonFields.tlsClientKey,g=f.jsonData&&f.jsonData.serverName,p=D=>b=>{b.preventDefault();const E={...f.secureJsonFields};E[D]=!1,h({...f,secureJsonFields:E})},c=D=>b=>{const E={...f.secureJsonData};E[D]=b.currentTarget.value,h({...f,secureJsonData:E})},y=D=>{const b={...f.jsonData,serverName:D.currentTarget.value};h({...f,jsonData:b})},P="-----BEGIN CERTIFICATE-----";return(0,t.jsxs)("div",{className:"gf-form-group",children:[(0,t.jsxs)("div",{className:(0,n.cx)("gf-form",(0,n.css)({alignItems:"baseline"})),children:[(0,t.jsx)("h6",{children:(0,t.jsx)(r.x,{i18nKey:"grafana-ui.data-source-settings.tls-heading",children:"TLS/SSL Auth Details"})}),(0,t.jsx)(m.m,{placement:"right-end",content:(0,r.t)("grafana-ui.data-source-settings.tls-tooltip","TLS/SSL Certs are encrypted and stored in the Grafana database."),theme:"info",children:(0,t.jsx)(s.I,{name:"info-circle",size:"xs",style:{marginLeft:"10px"}})})]}),(0,t.jsxs)("div",{children:[f.jsonData.tlsAuthWithCACert&&(0,t.jsx)(a.K,{hasCert:!!u,onChange:c("tlsCACert"),placeholder:(0,r.t)("grafana-ui.data-source-settings.tls-certification-placeholder","Begins with {{certificateBeginsWith}}",{certificateBeginsWith:P}),label:(0,r.t)("grafana-ui.data-source-settings.tls-certification-label","CA Cert"),onClick:p("tlsCACert")}),f.jsonData.tlsAuth&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"gf-form",children:(0,t.jsx)(o.z,{label:(0,r.t)("grafana-ui.data-source-settings.tls-server-name-label","ServerName"),labelWidth:7,inputWi
12dth:30,placeholder:"domain.example.com",value:g&&f.jsonData.serverName,onChange:y})}),(0,t.jsx)(a.K,{hasCert:!!i,label:(0,r.t)("grafana-ui.data-source-settings.tls-client-certification-label","Client Cert"),onChange:c("tlsClientCert"),placeholder:(0,r.t)("grafana-ui.data-source-settings.tls-certification-placeholder","Begins with {{certificateBeginsWith}}",{certificateBeginsWith:P}),onClick:p("tlsClientCert")}),(0,t.jsx)(a.K,{hasCert:!!x,label:(0,r.t)("grafana-ui.data-source-settings.tls-client-key-label","Client Key"),placeholder:(0,r.t)("grafana-ui.data-source-settings.tls-client-key-placeholder","Begins with {{privateKeyBeginsWith}}",{privateKeyBeginsWith:"-----BEGIN RSA PRIVATE KEY-----"}),onChange:c("tlsClientKey"),onClick:p("tlsClientKey")})]})]})]})}},96396:(ee,B,e)=>{"use strict";e.d(B,{l:()=>f});var t=e(74848),n=e(22803),r=e(96540),o=e(79055),s=e(63142),m=e(8135),a=e(30703),l=e(66630);const f=(0,r.memo)(i=>{const x=(0,s.of)(u),{isOpen:g,onClose:p}=i;return g?(0,t.jsx)(m.N,{useCapture:!0,includeButtonPress:!1,onClick:p,children:(0,t.jsx)("div",{className:x.modal,"data-testid":"date-picker",children:(0,t.jsx)(h,{...i})})}):null});f.displayName="DatePicker";const h=(0,r.memo)(({value:i,minDate:x,maxDate:g,onChange:p})=>{const c=(0,s.of)(l.h2);return(0,t.jsx)(o.Ay,{className:c.body,tileClassName:c.title,value:i||new Date,minDate:x,maxDate:g,nextLabel:(0,t.jsx)(a.I,{name:"angle-right"}),prevLabel:(0,t.jsx)(a.I,{name:"angle-left"}),onChange:y=>{y&&!Array.isArray(y)&&p(y)},locale:"en"})});h.displayName="Body";const u=i=>({modal:(0,n.css)({zIndex:i.zIndex.modal,boxShadow:i.shadows.z3,backgroundColor:i.colors.background.primary,border:`1px solid ${i.colors.border.weak}`,borderTopLeftRadius:i.shape.radius.default,borderBottomLeftRadius:i.shape.radius.default,"button:disabled":{color:i.colors.text.disabled}})})},43482:(ee,B,e)=>{"use strict";e.d(B,{l:()=>i});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(96540),a=e(25229),l=e(63142),f=e(63527),h=e(96396);const u=g=>(0,a.KQ)(g).format("L"),i=({value:g,minDate:p,maxDate:c,onChange:y,closeOnSelect:P,placeholder:d="Date",...D})=>{const[b,E]=(0,m.useState)(!1),v=(0,l.of)(x),C=[(0,r.UU)({crossAxis:!1,boundary:document.body}),(0,r.BN)()],{context:S,refs:O,floatingStyles:I}=(0,o.we)({open:b,placement:"bottom-start",onOpenChange:E,middleware:C,whileElementsMounted:s.ll,strategy:"fixed"}),R=(0,o.kp)(S),T=(0,o.s9)(S),{getReferenceProps:L,getFloatingProps:K}=(0,o.bv)([T,R]);return(0,t.jsxs)("div",{className:v.container,children:[(0,t.jsx)(f.p,{ref:O.setReference,type:"text",autoComplete:"off",placeholder:d,value:g&&u(g),onChange:A=>{A.target.value===""&&y("")},className:v.input,...D,...L()}),(0,t.jsx)("div",{className:v.popover,ref:O.setFloating,style:I,...K(),children:(0,t.jsx)(h.l,{isOpen:b,value:g&&typeof g!="string"?g:(0,a.KQ)().toDate(),minDate:p,maxDate:c,onChange:A=>{y(A),P&&E(!1)},onClose:()=>E(!1)})})]})},x=g=>({container:(0,n.css)({position:"relative"}),input:(0,n.css)({"input[type='date']::-webkit-inner-spin-button, input[type='date']::-webkit-calendar-picker-indicator":{display:"none",WebkitAppearance:"none"}}),popover:(0,n.css)({zIndex:g.zIndex.tooltip})})},27282:(ee,B,e)=>{"use strict";e.d(B,{K:()=>T});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(18828),a=e(42211),l=e(93225),f=e(96540),h=e(79055),u=e(49045),i=e(80011),x=e(25229),g=e(60188),p=e(85629),c=e(63142),y=e(7685),P=e(45861),d=e(18027),D=e(30703),b=e(63527),E=e(41654),v=e(35621),C=e(15245),S=e(11527),O=e(66630),I=e(62348),R=e(41e3);const T=({date:W,maxDate:N,minDate:w,label:j,onChange:V,disabledHours:U,disabledMinutes:F,disabledSeconds:M,timeZone:H,showSeconds:_=!0,clearable:Z=!1})=>{const[ne,te]=(0,f.useState)(!1),Y=(0,f.useRef)(null),{overlayProps:Q,underlayProps:J}=(0,l.e)({onClose:()=>te(!1),isDismissable:!0,isOpen:ne,shouldCloseOnInteractOutside:me=>{const De=document.getElementsByClassName(S.i)[0];return!(De&&De.contains(me))}},Y),{dialogProps:q}=(0,m.s)({},Y),X=(0,c.$j)(),{modalBackdrop:se}=(0,c.of)(v.o),oe=(0,u.A)(`(min-width: ${X.breakpoints.values.lg}px)`),ae=(0,c.of)(A),ie=[(0,r.UU)({crossAxis:!1,boundary:document.body}),(0,r.BN)()],{refs:fe,floatingStyles:pe}=(0,o.we)({open:ne,placement:"bottom-start",onOpenChange:te,middleware:ie,whileElementsMounted:s.ll,strategy:"fixed"}),de=(0,f.useCallback)(me=>{te(!1),V(me)},[V]),le=(0,f.useCallback)(me=>{me.preventDefault(),te(!0)},[te]);return(0,t.jsxs)("div",{"data-testid":"date-time-picker",style:{position:"relative"},children:[(0,t.jsx)(L,{date:W,onChange:V,isFullscreen:oe,onOpen:le,label:j,ref:fe.setReference,showSeconds:_,clearable:Z,timeZone:H}),ne?oe?(0,t.jsx)(C.ZL,{children:(0,t.jsx)(a.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)("div",{ref:Y,...Q,...q,children:(0,t.jsx)(K,{date:W,onChange:de,isFullscreen:!0,onClose:()=>te(!1),maxDate:N,minDate:w,ref:fe.setFloating,style:pe,showSeconds:_,disabledHours:U,disabledMinutes:F,disabledSeconds:M,timeZone:H})})})}):(0,t.jsxs)(C.ZL,{children:[(0,t.jsx)("div",{className:se,...J}),(0,t.jsx)(a.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)("div",{ref:Y,...Q,...q,children:(0,t.jsx)("div",{className:ae.modal,children:(0,t.jsx)(K,{date:W,maxDate:N,minDate:w,onChange:de,isFullscreen:!1,onClose:()=>te(!1),showSeconds:_,disabledHours:U,disabledMinutes:F,disabledSeconds:M,timeZone:H})})})})]}):null]})},L=f.forwardRef(({date:W,label:N,onChange:w,onOpen:j,timeZone:V,showSeconds:U=!0,clearable:F=!1},M)=>{const H=(0,c.of)(A),_=U?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm",[Z,ne]=(0,f.useState)(()=>({value:W?(0,i.LE)(W,{timeZone:V}):F?"":(0,i.LE)((0,x.KQ)(),{timeZone:V}),invalid:!1}));(0,f.useEffect)(()=>
12{if(W){const q=(0,i.LE)(W,{format:_,timeZone:V});ne({invalid:!(0,I.f)(q),value:(0,x.Ar)(W)?q:W})}},[W,_,V]);const te=(0,f.useCallback)(q=>{const X=!(0,I.f)(q.currentTarget.value);ne({value:q.currentTarget.value,invalid:X})},[]),Y=(0,f.useCallback)(()=>{if(!Z.invalid&&Z.value){const q=(0,x.oZ)((0,g.O)({timeZone:V}),Z.value);w(q)}},[Z,w,V]),Q=(0,f.useCallback)(()=>{ne({value:"",invalid:!1}),w()},[w]),J=(0,t.jsx)(P.$n,{"aria-label":(0,y.t)("grafana-ui.date-time-picker.calendar-icon-label","Time picker"),icon:"calendar-alt",variant:"secondary",onClick:j});return(0,t.jsx)(d.I,{label:N,invalid:!!(Z.value&&Z.invalid),className:H.field,children:(0,t.jsx)(b.p,{onChange:te,addonAfter:J,value:Z.value,onBlur:Y,"data-testid":p.XF.DateTimePicker.input,placeholder:(0,y.t)("grafana-ui.date-time-picker.select-placeholder","Select date/time"),ref:M,suffix:F&&Z.value&&(0,t.jsx)(D.I,{name:"times",className:H.clearIcon,onClick:Q})})})});L.displayName="DateTimeInput";const K=f.forwardRef(({date:W,onClose:N,onChange:w,isFullscreen:j,maxDate:V,minDate:U,style:F,showSeconds:M=!0,disabledHours:H,disabledMinutes:_,disabledSeconds:Z,timeZone:ne},te)=>{const Y=(0,c.of)(O.h2),Q=(0,c.of)(A),[J,q]=(0,f.useState)(()=>W&&W.isValid()?(0,x.oZ)((0,g.O)({timeZone:ne}),W):(0,x.oZ)((0,g.O)({timeZone:ne}),new Date)),[X,se]=(0,f.useState)(()=>W&&W.isValid()?(0,R.Q)(W.toDate(),(0,g.O)({timeZone:ne})):(0,R.Q)(new Date,(0,g.O)({timeZone:ne}))),oe=(0,f.useCallback)(fe=>{fe&&!Array.isArray(fe)&&se(fe)},[]),ae=(0,f.useCallback)(fe=>{q(fe)},[]),ie=()=>{const fe=(0,x.KQ)(J);fe.set("date",X.getDate()),fe.set("month",X.getMonth()),fe.set("year",X.getFullYear()),w(fe)};return(0,t.jsxs)("div",{className:(0,n.cx)(Q.container,{[Q.fullScreen]:j}),style:F,ref:te,children:[(0,t.jsx)(h.Ay,{next2Label:null,prev2Label:null,value:X,nextLabel:(0,t.jsx)(D.I,{name:"angle-right"}),nextAriaLabel:(0,y.t)("grafana-ui.date-time-picker.next-label","Next month"),prevLabel:(0,t.jsx)(D.I,{name:"angle-left"}),prevAriaLabel:(0,y.t)("grafana-ui.date-time-picker.previous-label","Previous month"),onChange:oe,locale:"en",className:Y.body,tileClassName:Y.title,maxDate:V,minDate:U}),(0,t.jsx)("div",{className:Q.time,children:(0,t.jsx)(S.R,{showSeconds:M,onChange:ae,value:J,disabledHours:H,disabledMinutes:_,disabledSeconds:Z})}),(0,t.jsxs)(E.B,{children:[(0,t.jsx)(P.$n,{type:"button",onClick:ie,children:(0,t.jsx)(y.x,{i18nKey:"grafana-ui.date-time-picker.apply",children:"Apply"})}),(0,t.jsx)(P.$n,{variant:"secondary",type:"button",onClick:N,children:(0,t.jsx)(y.x,{i18nKey:"grafana-ui.date-time-picker.cancel",children:"Cancel"})})]})]})});K.displayName="DateTimeCalendar";const A=W=>({container:(0,n.css)({padding:W.spacing(1),border:`1px ${W.colors.border.weak} solid`,borderRadius:W.shape.radius.default,backgroundColor:W.colors.background.primary,zIndex:W.zIndex.modal}),fullScreen:(0,n.css)({position:"absolute"}),time:(0,n.css)({marginBottom:W.spacing(2)}),modal:(0,n.css)({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:W.zIndex.modal,maxWidth:"280px"}),clearIcon:(0,n.css)({cursor:"pointer"}),field:(0,n.css)({marginBottom:0,width:"100%"})})},90929:(ee,B,e)=>{"use strict";e.d(B,{N:()=>K});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(18828),a=e(42211),l=e(93225),f=e(96540),h=e(63142),u=e(7685),i=e(45861),x=e(37386),g=e(30703),p=e(63527),c=e(92807),y=e(45967),P=e(47087),d=e(44398),D=e(8431);const b=/^now$|^now(\-|\+)(\d{1,10})([wdhms])$/,E=j=>({from:O(j.from),to:O(j.to)}),v=j=>{const V=R(j.from),U=R(j.to);return{from:V,to:U,display:`${V} to ${U}`}},C=(j,V=Date.now())=>S(j)?O(j)>Math.ceil(V/1e3)?{isValid:!1,errorMessage:"Can not enter value prior to January 1, 1970."}:{isValid:!0}:{isValid:!1,errorMessage:"Value not in relative time format."},S=j=>b.test(j),O=j=>{const V=b.exec(j);if(!V||V.length!==4)return 0;const[,U,F,M]=V,H=parseInt(F,10);if(isNaN(H))return 0;const _=H*I[M];return U==="+"?_*-1:_},I={w:604800,d:86400,h:3600,m:60,s:1},R=j=>{if(j===0)return"now";const V=Math.abs(j);return j<0?`now+${T(V)}`:`now-${T(V)}`};function T(j){const V=[{unit:"w",value:604800},{unit:"d",value:86400},{unit:"h",value:3600},{unit:"m",value:60},{unit:"s",value:1}];for(const{unit:F,value:M}of V)if(j%M===0)return`${j/M}${F}`;const U=V[V.length-1];return`${j}${U.unit}`}const L=D.o.filter(j=>S(j.from));function K(j){const{timeRange:V,onChange:U}=j,[F,M]=(0,f.useState)(!1),H=(0,f.useCallback)(()=>M(!1),[]),_=v(V),[Z,ne]=(0,f.useState)({value:_.from,validation:C(_.from)}),[te,Y]=(0,f.useState)({value:_.to,validation:C(_.to)}),Q=(0,f.useRef)(null),{overlayProps:J,underlayProps:q}=(0,l.e)({onClose:()=>M(!1),isDismissable:!0,isOpen:F},Q),{dialogProps:X}=(0,m.s)({},Q),se=[(0,r.UU)({crossAxis:!1,boundary:document.body}),(0,r.BN)()],{context:oe,refs:ae,floatingStyles:ie}=(0,o.we)({open:F,placement:"bottom-start",onOpenChange:M,middleware:se,whileElementsMounted:s.ll,strategy:"fixed"}),fe=(0,o.kp)(oe),pe=(0,o.s9)(oe),{getReferenceProps:de,getFloatingProps:le}=(0,o.bv)([pe,fe]),me=(0,h.of)(N(Z.validation.errorMessage,te.validation.errorMessage)),De=ke=>{const Me=E(ke);Me&&(H(),ne({...Z,value:ke.from}),Y({...te,value:ke.to}),U(Me))},Te=(0,f.useCallback)(ke=>{ke.stopPropagation(),ke.preventDefault(),M(!F)},[F]),Ne=ke=>{if(ke.preventDefault(),!te.validation.isValid||!Z.validation.isValid)return;const Me=E({from:Z.value,to:te.value,display:""});Me&&(U(Me),M(!1))},{from:Ce,to:He}=_;return(0,t.jsxs)("div",{className:me.container,children:[(0,t.jsxs)("button",{ref:ae.setReference,className:me.pickerInput,type:"button",onClick:Te,...de(),children:[(0,t.jsx)("span",{className:me.clockIcon,children:(0,t.jsx)(g.I,{name:"clock-nine"})}),(0,t.jsx)("span",{children:(0,t.jsxs)(u.x,{i18nKey:"time-picker.time-range.from-to",children:[{timeOptionFrom:Ce}," to ",{timeOptionTo:He}]})}),(0,t.jsx)("span",{className:me.caretIcon,children:(0,t.jsx)(g.I,{name:F?"angle-up":"angle-down",size:"lg"})})]}),F&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{role:"presentation",className:me.backdrop,...q}),(0,t.jsx)(a.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)("div",{ref:Q,...J,...X,children:(0,t.jsx)("div",{className:me.content,ref:ae.setFloating,style:ie,...le(),children:(0,t.jsxs)("div",{className:me.body,children:[(0,t.jsx)("div",{className:me.leftSide,children:(0,t.jsx)(c.P,{showScrollIndicators:!0,children:(0,t.jsx)(d.l,{title:(0,u.t)("time-picker.time-range.example-title","Example time ranges"),options:L,onChange:De,value:_})})}),(0,t.jsxs)("div",{className:me.rightSide,children:[(0,t.jsx)("div",{className:me.title,children:(0,t.jsx)(P.e,{children:(0,t.jsx)(y.m,{content:(0,t.jsx)(A,{}),placement:"bottom",theme:"info",children:(0,t.jsx)("div",{children:(0,t.jsxs)(u.x,{i18nKey:"time-picker.time-range.specify",children:["Specify time range ",(0,t.jsx)(g.I,{name:"info-circle"})]})})})})}),(0,t.jsx)(x.D,{label:(0,u.t)("time-picker.time-range.from-label","From"),invalid:!Z.validation.isValid,error:Z.val
12idation.errorMessage,children:(0,t.jsx)(p.p,{onClick:ke=>ke.stopPropagation(),onBlur:()=>ne({...Z,validation:C(Z.value)}),onChange:ke=>ne({...Z,value:ke.currentTarget.value}),value:Z.value})}),(0,t.jsx)(x.D,{label:(0,u.t)("time-picker.time-range.to-label","To"),invalid:!te.validation.isValid,error:te.validation.errorMessage,children:(0,t.jsx)(p.p,{onClick:ke=>ke.stopPropagation(),onBlur:()=>Y({...te,validation:C(te.value)}),onChange:ke=>Y({...te,value:ke.currentTarget.value}),value:te.value})}),(0,t.jsx)(i.$n,{"aria-label":(0,u.t)("time-picker.time-range.submit-button-label","TimePicker submit button"),onClick:Ne,children:(0,t.jsx)(u.x,{i18nKey:"time-picker.time-range.apply",children:"Apply time range"})})]})]})})})})]})]})}const A=()=>{const j=(0,h.of)(W);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:j.supported,children:(0,t.jsxs)(u.x,{i18nKey:"time-picker.time-range.supported-formats",children:["Supported formats: ",(0,t.jsx)("code",{className:j.tooltip,children:"now-[digit]s/m/h/d/w"})]})}),(0,t.jsx)("div",{children:(0,t.jsx)(u.x,{i18nKey:"time-picker.time-range.example",children:"Example: to select a time range from 10 minutes ago to now"})}),(0,t.jsx)("code",{className:j.tooltip,children:(0,t.jsx)(u.x,{i18nKey:"time-picker.time-range.example-details",children:"From: now-10m To: now"})}),(0,t.jsx)("div",{className:j.link,children:(0,t.jsxs)(u.x,{i18nKey:"time-picker.time-range.more-info",children:["For more information see"," ",(0,t.jsxs)("a",{href:"https://grafana.com/docs/grafana/latest/dashboards/time-range-controls/",children:["docs ",(0,t.jsx)(g.I,{name:"external-link-alt"})]}),"."]})})]})},W=j=>({supported:(0,n.css)({marginBottom:j.spacing(1)}),tooltip:(0,n.css)({margin:0}),link:(0,n.css)({marginTop:j.spacing(1)})}),N=(j,V)=>U=>{const F=(0,p.n)({theme:U,invalid:!1}),H=250+w(U,j)+w(U,V);return{backdrop:(0,n.css)({position:"fixed",zIndex:U.zIndex.modalBackdrop,top:0,right:0,bottom:0,left:0}),container:(0,n.css)({display:"flex",position:"relative"}),pickerInput:(0,n.cx)(F.input,F.wrapper,(0,n.css)({display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",paddingRight:0,paddingLeft:0,lineHeight:`${U.spacing.gridSize*U.components.height.md-2}px`})),caretIcon:(0,n.cx)(F.suffix,(0,n.css)({position:"relative",marginLeft:U.spacing(.5)})),clockIcon:(0,n.cx)(F.prefix,(0,n.css)({position:"relative",marginRight:U.spacing(.5)})),content:(0,n.css)({background:U.colors.background.primary,boxShadow:U.shadows.z3,position:"absolute",zIndex:U.zIndex.modal,width:"500px",top:"100%",borderRadius:U.shape.radius.default,border:`1px solid ${U.colors.border.weak}`,left:0,whiteSpace:"normal"}),body:(0,n.css)({display:"flex",height:`${H}px`}),description:(0,n.css)({color:U.colors.text.secondary,fontSize:U.typography.size.sm}),leftSide:(0,n.css)({width:"50% !important",borderRight:`1px solid ${U.colors.border.medium}`}),rightSide:(0,n.css)({width:"50%",padding:U.spacing(1)}),title:(0,n.css)({marginBottom:U.spacing(1)})}};function w(j,V){return V?V.length>34?j.spacing.gridSize*6.5:j.spacing.gridSize*4:0}},11527:(ee,B,e)=>{"use strict";e.d(B,{R:()=>i,i:()=>u});var t=e(74848),n=e(22803),r=e(65740),o=e(34235),s=e(24938),m=e(25229),a=e(63142),l=e(35484),f=e(3343),h=e(30703);const u="time-of-day-picker-panel",i=({minuteStep:c=1,showHour:y=!0,showSeconds:P=!1,value:d,size:D="auto",disabled:b,disabledHours:E,disabledMinutes:v,disabledSeconds:C,placeholder:S,...O})=>{const I=(0,a.of)(p),R=O.allowEmpty??!1;return(0,t.jsx)(r.Ay,{generateConfig:o.A,locale:s.A,allowClear:R&&{clearIcon:(0,t.jsx)(h.I,{name:"times",className:I.clearIcon})},className:(0,n.cx)((0,f.lH)()[D],I.input),classNames:{popup:(0,n.cx)(I.picker,u)},defaultValue:O.allowEmpty?void 0:(0,m.AN)(),disabled:b,disabledTime:()=>({disabledHours:E,disabledMinutes:v,disabledSeconds:C}),format:x(y,P),minuteStep:c,onChange:T=>{if((0,m.u8)(T))return O.allowEmpty?O.onChange(T?(0,m.KQ)(T):void 0):O.onChange((0,m.KQ)(T))},picker:"time",placeholder:S,showNow:!1,needConfirm:!1,suffixIcon:(0,t.jsx)(g,{wrapperStyle:I.caretWrapper}),value:d&&(0,m.AN)(d)})};function x(c=!0,y=!1){const P=c?"HH:":"",d=y?":ss":"";return P+"mm"+d}const g=({wrapperStyle:c=""})=>(0,t.jsx)("div",{className:c,children:(0,t.jsx)(h.I,{name:"angle-down"})}),p=c=>{const y=c.components.input.background,P=c.colors.action.hover,d=c.shape.radiu
12s.default,D=c.components.input.borderColor;return{caretWrapper:(0,n.css)({position:"relative",top:"50%",transform:"translateY(-50%)",display:"inline-block",color:c.colors.text.secondary}),clearIcon:(0,n.css)({color:c.colors.text.secondary,"&:hover":{color:c.colors.text.maxContrast}}),picker:(0,n.css)({"&.rc-picker-dropdown":{boxShadow:"none",zIndex:c.zIndex.portal},".rc-picker-time-panel-column":{fontSize:c.typography.htmlFontSize,backgroundColor:y,color:c.colors.text.secondary,padding:"unset",overflowY:"auto",scrollbarWidth:"thin",width:c.spacing(8),li:{paddingRight:c.spacing(2),width:"auto","&.rc-picker-time-panel-cell-selected":{backgroundColor:"inherit",border:`1px solid ${c.colors.action.selectedBorder}`,borderRadius:d,color:c.colors.text.primary},"&:hover":{background:P,color:c.colors.text.primary},"&.rc-picker-time-panel-cell-disabled":{color:c.colors.action.disabledText}},".rc-picker-time-panel-cell-inner":{color:"inherit"},"&:not(:last-of-type)":{borderRight:`1px solid ${D}`}},".rc-picker-panel":{boxShadow:c.shadows.z3,backgroundColor:y,borderColor:D,borderRadius:d,overflow:"hidden"}}),input:(0,n.css)({"&.rc-picker-focused":{border:"none",".rc-picker-input":(0,l.getFocusStyles)(c)},"&.rc-picker-disabled":{".rc-picker-input":{backgroundColor:c.colors.action.disabledBackground,color:c.colors.action.disabledText,border:`1px solid ${c.colors.action.disabledBackground}`,"&:focus":{boxShadow:"none"}}},".rc-picker-input":{backgroundColor:y,borderRadius:d,borderColor:D,borderStyle:"solid",borderWidth:"1px",color:c.colors.text.primary,height:c.spacing(4),padding:c.spacing(0,1),input:{color:"unset",backgroundColor:"unset","&:focus":{outline:"none"},"&::placeholder":{color:c.colors.text.disabled}}},".rc-picker-clear":{alignItems:"center",display:"flex",insetInlineEnd:"unset",position:"relative"}})}}},72296:(ee,B,e)=>{"use strict";e.d(B,{A:()=>o,X:()=>s});var t=e(74848),n=e(96540);const r=(0,n.createContext)(void 0);function o({children:m}
12){const[a,l]=(0,n.useState)(0),[f,h]=(0,n.useState)(),u=(0,n.useMemo)(()=>({sync:i=>h(i),unSync:()=>h(void 0),addPicker:()=>l(i=>i+1),removePicker:()=>{l(i=>{const x=i-1;return x<2&&h(void 0),x})},syncPossible:a>1,synced:!!f,syncedValue:f}),[a,f]);return(0,t.jsx)(r.Provider,{value:u,children:m})}function s(m){const a=(0,n.useContext)(r);return(0,n.useEffect)(()=>a?(a.addPicker(),m&&a.sync(m),()=>{a.removePicker()}):()=>{},[]),(0,n.useMemo)(()=>a&&{sync:a.sync,unSync:a.unSync,syncPossible:a.syncPossible,synced:a.synced,syncedValue:a.syncedValue},[a])}},56265:(ee,B,e)=>{"use strict";e.d(B,{b:()=>y});var t=e(74848),n=e(22803),r=e(83505),o=e(42211),s=e(96540),m=e(25229),a=e(22592),l=e(85629),f=e(63142),h=e(30703),u=e(63527),i=e(4364),x=e(83692),g=e(8431),p=e(62348);const c=()=>{},y=({value:d,onChange:D,onChangeTimeZone:b=c,clearable:E,weekStart:v,hideTimeZone:C=!0,timeZone:S="browser",placeholder:O="Select time range",isReversed:I=!0,hideQuickRanges:R=!1,disabled:T=!1,showIcon:L=!1})=>{const[K,A]=(0,s.useState)(!1),W=(0,f.of)(P,T),N=ne=>{ne.stopPropagation(),ne.preventDefault(),!T&&A(!K)},w=()=>{A(!1)},j=ne=>{w(),D(ne)},V=ne=>{ne.stopPropagation();const te=(0,m.KQ)(null),Y=(0,m.KQ)(null);D({from:te,to:Y,raw:{from:te,to:Y}})},{refs:U,floatingStyles:F,context:M}=(0,r.we)({open:K,onOpenChange:A,placement:"bottom-start",strategy:"fixed"}),H=(0,r.s9)(M,{bubbles:{outsidePress:!1}}),{getReferenceProps:_,getFloatingProps:Z}=(0,r.bv)([H]);return(0,t.jsxs)("div",{className:W.container,children:[(0,t.jsxs)("button",{type:"button",className:W.pickerInput,"data-testid":l.Tp.components.TimePicker.openButton,onClick:N,ref:U.setReference,..._(),children:[L&&(0,t.jsx)(h.I,{name:"clock-nine",size:"sm",className:W.icon}),(0,t.jsx)(x.f,{value:d,timeZone:S,placeholder:O}),!T&&(0,t.jsxs)("span",{className:W.caretIcon,children:[(0,p.X)(d)&&E&&(0,t.jsx)(h.I,{className:W.clearIcon,name:"times",size:"lg",onClick:V}),(0,t.jsx)(h.I,{name:K?"angle-up":"angle-down",size:"lg"})]})]}),K&&(0,t.jsx)(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)("section",{className:W.content,ref:U.setFloating,style:F,...Z(),children:(0,t.jsx)(i.r,{timeZone:S,value:(0,p.X)(d)?d:(0,a.E2)(),onChange:j,quickOptions:g.o,onChangeTimeZone:b,className:W.content,hideTimeZone:C,isReversed:I,hideQuickRanges:R,weekStart:v})})})]})},P=(d,D=!1)=>{const b=(0,u.n)({theme:d,invalid:!1});return{container:(0,n.css)({display:"flex",position:"relative"}),content:(0,n.css)({marginLeft:0,position:"absolute",top:"116%",zIndex:d.zIndex.modal}),pickerInput:(0,n.cx)(b.input,D&&b.inputDisabled,b.wrapper,(0,n.css)({display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",paddingRight:0,lineHeight:`${d.spacing.gridSize*4-2}px`})),caretIcon:(0,n.cx)(b.suffix,(0,n.css)({position:"relative",top:"-1px",marginLeft:d.spacing(.5)})),clearIcon:(0,n.css)({marginRight:d.spacing(.5),"&:hover":{color:d.colors.text.maxContrast}}),placeholder:(0,n.css)({color:d.colors.text.disabled,opacity:1}),icon:(0,n.css)({marginRight:d.spacing(.5)})}}},91867:(ee,B,e)=>{"use strict";e.d(B,{_8:()=>R,xS:()=>I,$6:()=>S});var t=e(74848),n=e(22803),r=e(18828),o=e(42211),s=e(93225),m=e(96540),a=e(17548),l=e(80011),f=e(62717),h=e(33239),u=e(85629),i=e(63142),x=e(7685),g=e(93256),p=e(35621),c=e(15245),y=e(7895),P=e(45967),d=e(4364),D=e(8431),b=e(84596),E=e(72296);function v(A){const{onClick:W,isSynced:N}=A,w=()=>{const j=N?"Unsync all views":"Sync all views to this time range";return(0,t.jsx)(t.Fragment,{children:j})};return(0,t.jsx)(P.m,{content:w,placement:"bottom",children:(0,t.jsx)(y.I,{icon:"link",variant:N?"active":"canvas","aria-label":N?"Un sync times":"Sync times",onClick:W})})}function C(A){const{value:W,onChangeProp:N,isSyncedProp:w,initialIsSynced:j,timeSyncButtonProp:V}=A,U=(0,E.X)(j&&W?W:void 0),F=U?.synced,M=U?.syncedValue,H=U?.sync,_=!!(A.isSyncedProp===void 0&&U),Z=(0,m.useCallback)(J=>{N(J),_&&F&&H?.(J)},[N,_,H,F]),ne=(0,b.A)(W),te=(0,b.A)(U?.syncedValue);(0,m.useEffect)(()=>{_&&F&&(W!==ne&&W!==M?H?.(W):M&&M!==te&&M!==W&&N(M))},[_,F,M,H,te,W,ne,N]);const Y=_?U?.synced:w,Q=_?U?.syncPossible&&(0,t.jsx)(v,{isSynced:U?.synced,onClick:()=>U?.synced?U.unSync():U.sync(W)}):V;return{onChangeWithSync:Z,isSynced:Y,timeSyncButton:Q}}function S(A){const[W,N]=(0,m.useState)(!1),{value:w,onMoveBackward:j,onMoveForward:V,onZoom:U,onError:F,timeZone:M,fiscalYearStartMonth:H,history:_,onChangeTimeZone:Z,onChangeFiscalYearStartMonth:ne,quickRanges:te,hideQuickRanges:Y,widthOverride:Q,isOnCanvas:J,onToolbarTimePickerClick:q,weekStart:X,initialIsSynced:se}=A,{onChangeWithSync:oe,isSynced:ae,timeSyncButton:ie}=C({initialIsSynced:se,value:w,onChangeProp:A.onChange,isSyncedProp:A.isSynced,timeSyncButtonProp:A.timeSyncButton}),fe=Re=>{oe(Re),N(!1)};(0,m.useEffect)(()=>{W&&q&&q()},[W,q]);const pe=()=>{N(Re=>!Re)},de=()=>{N(!1)},le=(0,m.createRef)(),me=(0,m.createRef)(),{overlayProps:De,underlayProps:Te}=(0,s.e)({onClose:de,isDismissable:!0,isOpen:W,shouldCloseOnInteractOutside:Re=>{const Ve=(0,c.gF)();return!me.current?.contains(Re)&&!Ve.contains(Re)}},le),{dialogProps:Ne}=(0,r.s)({},le),Ce=(0,i.of)(L),{modalBackdrop:He}=(0,i.of)(p.o),ke=!a.isRelativeTime(w.raw.from)||!a.isRelativeTime(w.raw.to),Me=ae?"active":J?"canvas":"default",tt=w?.to?.isBefore(w.from)?"exclamation-triangle":"clock-nine",Ke=T(w,M,te);return(0,t.jsxs)(g.e,{className:Ce.container,children:[ke&&(0,t.jsx)(y.I,{"aria-label":(0,x.t)("time-picker.range-picker.backwards-time-aria-label","Move time range backwards"),variant:Me,onClick:j,icon:"angle-left",type:"button",narrow:!0}),(0,t.jsx)(P.m,{ref:me,content:(0,t.jsx)(I,{timeRange:w,timeZone:M}),placement:"bottom",interactive:!0,children:(0,t.jsx)(y.I,{"data-testid":u.Tp.components.TimePicker.openButton,"aria-label":(0,x.t)("time-picker.range-picker.current-time-selected","Time range selected: {{currentTimeRange}}",{currentTimeRange:Ke}),"aria-controls":"TimePickerContent",onClick:pe,icon:tt,isOpen:W,type:"button",variant:Me,children:(0,t.jsx)(R,{...A})})}),W&&(0,t.jsxs)("div",{"data-testid":u.Tp.components.TimePicker.overlayContent,children:[(0,t.jsx)("div",{role:"presentation",className:(0,n.cx)(He,Ce.backdrop),...Te}),(0,t.jsx)(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)("section",{className:Ce.content,ref:le,...De,...Ne,children:(0,t.jsx)(d.r,{timeZone:M,fiscalYearStartMonth:H,value:w,onChange:fe,quickOptions:te||D.o,history:_,showHistory:!0,widthOverride:Q,onChangeTimeZone:Z,onChangeFiscalYearStartMonth:ne,hideQuickRanges:Y,onError:F,weekStart:X})})})]}),ie,ke&&(0,t.jsx)(y.I,{"aria-label":(0,x.t)("time-picker.range-picker.forwards-time-aria-label","Move time range forwards"),onClick:V,icon:"angle-right",narrow:!0,type:"button",variant:Me}),(0,t.jsx)(P.m,{content:O,placement:"bottom",children:(0,t.jsx)(y.I,{"aria-label":(0,x.t)("time-picker.range-picker.zoom-out-button","Zoom out time range"),onClick:U,icon:"search-minus",type:"button",variant:Me})})]})}S.displayName="TimeRangePicker";const O=()=>(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(x.x,{i18nKey:"time-picker.range-picker.zoom-out-tooltip",children:["Time range zoom out ",(0,t.jsx)("br",{})," CTRL+Z"]})}),I=({timeRange:A,timeZone:W})=>{const N=(0,i.of)(K);return(0,t.jsxs)(t.Fragment,{children:[(0,l.LE)(A.from,{timeZone:W}),(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)(x.x,{i18nKey:"time-picker.range-picker.to",children:"to"})}),(0,l.LE)(A.to,{timeZone:W}),(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)("span",{className:N.utc,children:(0,f.le)(W)})})]})},R=(0,m.memo)(({hideText:A,value:W,timeZone:N,quickRanges:w})=>{const j=(0,i.of)(K);return A?null:(0,t.jsxs)("span",{className:j.container,"aria-live":"polite","aria-atomic":"true",children:[(0,t.jsx)("span",{children:T(W,N,w)}),(0,t.jsx)("span",{className:j.utc,children:a.describeTimeRangeAbbreviation(W,N)})]})});R.displayName="TimePickerButtonLabel";const T=(A,W,N)=>{const w={to:h.isMathString(A.raw.to)?A.raw.to:A.to,from:h.isMathString(A.raw.from)?A.raw.from:A.from};return a.describeTimeRange(w,W,N)},L=A=>({container:(0,n.css)({position:"relative",display:"flex",verticalAlign:"middle"}),backdrop:(0,n.css)({display:"none",[A.breakpoints.down("sm")]:{display:"block"}}),content:(0,n.css)({position:"absolute",right:0,top:"116%",zIndex:A.zIndex.dropdown,[A.breakpoints.down("sm")]:{position:"fixed",right:"50%",top:"50%",transform:"translate(50%, -50%)",zIndex:A.zIndex.modal}})}),K=A=>({container:(0,n.css)({display:"flex",alignItems:"center",whiteSpace:"nowrap"}),utc:(0,n.css)({color:A.v1.palette.orange,fontSize:A.typography.size.sm,paddingLeft:"6px",lineHeight:"28px",verticalAlign:"bottom",fontWeight:A.typography.fontWeightMedium})})},66630:(ee,B,e)=>{"use strict";e.d(B,{h2:()=>c,nB:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(79055),s=e(44922),m=e(63142),a=e(7685),l=e(30703),f=e(5857),h=e(41e3);const u={saturday:"islamic",sunday:"gregory",monday:"iso8601"};function i({onChange:y,from:P,to:d,timeZone:D,weekStart:b}){const E=x(P,d,new Date,D),v=g(y,D),C=(0,m.of)(c),S=(0,f.rL)(b);return(0,t.jsx)(o.Ay,{selectRange:!0,next2Label:null,prev2Label:null,className:C.body,tileClassName:C.title,value:E,nextLabel:(0,t.jsx)(l.I,{name:"angle-right"}),nextAriaLabel:(0,a.t)("time-picker.calendar.next-month","Next month"),prevLabel:(0,t.jsx)(l.I,{name:"angle-left"}),prevAriaLabel:(0,a.t)("time-picker.calendar.previous-month","Previous month"),onChange:v,locale:"en",calendarType:u[S]})}i.displayName="Body";function x(y,P,d=new Date,D){let b=y.isValid()?y.toDate():d,E=P.isValid()?P.toDate():d;return D&&(b=(0,h.Q)(b,D),E=(0,h.Q)(E,D)),b>E?[E,b]:[b,E]}function g(y,P){return(0,r.useCallback)(d=>{if(!Array.isArray(d))return console.error("onCalendarChange: should be run in selectRange={true}");if(d[0]&&d[1]){const D=(0,s.b)(p(d[0]),{timeZone:P}),b=(0,s.b)(p(d[1]),{timeZone:P});
12y(D,b)}},[y,P])}function p(y){return[y.getFullYear(),y.getMonth(),y.getDate(),y.getHours(),y.getMinutes(),y.getSeconds()]}const c=y=>{const P=".react-calendar__tile--hasActive:not(.react-calendar__tile--range)";return{title:(0,n.css)({color:y.colors.text.primary,backgroundColor:y.colors.background.primary,fontSize:y.typography.size.md,border:"1px solid transparent","&:hover, &:focus":{position:"relative"},"&:disabled":{color:y.colors.action.disabledText}}),body:(0,n.css)({zIndex:y.zIndex.modal,backgroundColor:y.colors.background.primary,width:"268px",".react-calendar__navigation":{display:"flex"},".react-calendar__navigation__label, .react-calendar__navigation__arrow, .react-calendar__navigation":{paddingTop:"4px",backgroundColor:"inherit",color:y.colors.text.primary,border:0,fontWeight:y.typography.fontWeightMedium},".react-calendar__month-view__weekdays":{backgroundColor:"inherit",textAlign:"center",color:y.colors.primary.text,abbr:{border:0,textDecoration:"none",cursor:"default",display:"block",padding:"4px 0 4px 0"}},".react-calendar__month-view__days":{backgroundColor:"inherit"},".react-calendar__tile, .react-calendar__tile--now":{marginBottom:"4px",backgroundColor:"inherit",height:"26px"},".react-calendar__navigation__label, .react-calendar__navigation > button:focus, .time-picker-calendar-tile:focus":{outline:0},[`${P}, .react-calendar__tile--active, .react-calendar__tile--active:hover`]:{color:y.colors.primary.contrastText,fontWeight:y.typography.fontWeightMedium,background:y.colors.primary.main,border:"0px"},".react-calendar__tile--rangeEnd, .react-calendar__tile--rangeStart":{padding:0,border:"0px",color:y.colors.primary.contrastText,fontWeight:y.typography.fontWeightMedium,background:y.colors.primary.main,abbr:{backgroundColor:y.colors.primary.main,borderRadius:"100px",display:"block",paddingTop:"2px",height:"26px"}},[`${P}, .react-calendar__tile--rangeStart`]:{borderTopLeftRadius:"20px",borderBottomLeftRadius:"20px"},[`${P}, .react-calendar__tile--rangeEnd`]:{borderTopRightRadius:"20px",borderBottomRightRadius:"20px"}})}}},4364:(ee,B,e)=>{"use strict";e.d(B,{r:()=>pe});var t=e(74848),n=e(22803),r=e(96540),o=e(25229),s=e(17548),m=e(85629),a=e(63142),l=e(35484),f=e(7685),h=e(12737),u=e(30703),i=e(2543),x=e(62717),g=e(45861),p=e(43243),c=e(37386),y=e(54314),P=e(60208),d=e(13941),D=e(59310),b=e(34788),E=e(44229),v=e(27228),C=e(8431);const S=Me=>{const{timeZone:$e,fiscalYearStartMonth:tt,timestamp:Ke=Date.now(),onChangeTimeZone:Re,onChangeFiscalYearStartMonth:Ve}=Me,[Qe,je]=(0,r.useState)(!1),[ze,Ye]=(0,r.useState)("tz"),Ge=(0,r.useId)(),ce=(0,r.useId)(),Pe=(0,r.useId)(),Se=(0,r.useCallback)(ye=>{ye&&ye.stopPropagation(),je(!Qe)},[Qe,je]),Ee=(0,a.of)(O);if(!(0,i.isString)($e))return null;const xe=(0,x.QZ)($e,Ke);return xe?(0,t.jsxs)("div",{children:[(0,t.jsxs)("section",{"aria-label":(0,f.t)("time-picker.footer.time-zone-selection","Time zone selection"),className:Ee.container,children:[(0,t.jsxs)("div",{className:Ee.timeZoneContainer,children:[(0,t.jsxs)("div",{className:Ee.timeZone,children:[(0,t.jsx)(v.U,{title:xe.name}),(0,t.jsx)("div",{className:Ee.spacer}),(0,t.jsx)(b.E,{info:xe})]}),(0,t.jsx)(E.X,{timeZone:$e,timestamp:Ke})]}),(0,t.jsx)("div",{className:Ee.spacer}),(0,t.jsx)(g.$n,{"data-testid":m.Tp.components.TimeZonePicker.changeTimeSettingsButton,variant:"secondary",onClick:Se,size:"sm","aria-expanded":Qe,"aria-controls":Ge,icon:Qe?"angle-up":"angle-down",children:(0,t.jsx)(f.x,{i18nKey:"time-picker.footer.change-settings-button",children:"Change time settings"})})]}),Qe?(0,t.jsxs)("div",{className:Ee.editContainer,id:Ge,children:[(0,t.jsxs)(y.U,{children:[(0,t.jsx)(P.o,{label:(0,f.t)("time-picker.footer.time-zone-option","Time zone"),active:ze==="tz",onChangeTab:()=>{Ye("tz")},"aria-controls":ce}),(0,t.jsx)(P.o,{label:(0,f.t)("time-picker.footer.fiscal-year-option","Fiscal year"),active:ze==="fy",onChangeTab:()=>{Ye("fy")},"aria-controls":Pe})]}),(0,t.jsx)(d.J,{children:ze==="tz"?(0,t.jsx)("section",{role:"tabpanel","data-testid":m.Tp.components.TimeZonePicker.containerV2,id:ce,className:(0,n.cx)(Ee.timeZoneContainer,Ee.timeSettingContainer),children:(0,t.jsx)(D.U,{includeInternal:!0,onChange:ye=>{Se(),(0,i.isString)(ye)&&Re(ye)},onBlur:Se,menuShouldPortal:!1})}):(0,t.jsx)("section",{role:"tabpanel","data-testid":m.Tp.components.TimeZonePicker.containerV2,
12id:Pe,className:(0,n.cx)(Ee.timeZoneContainer,Ee.timeSettingContainer),children:(0,t.jsx)(c.D,{className:Ee.fiscalYearField,label:(0,f.t)("time-picker.footer.fiscal-year-start","Fiscal year start month"),children:(0,t.jsx)(p.G,{value:tt??null,options:C.Z,onChange:ye=>{Ve&&Ve(ye?.value??0)}})})})})]}):null]}):null},O=Me=>({container:(0,n.css)({borderTop:`1px solid ${Me.colors.border.weak}`,padding:Me.spacing(1.5),display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}),editContainer:(0,n.css)({borderTop:`1px solid ${Me.colors.border.weak}`,padding:Me.spacing(1.5),paddingTop:0,justifyContent:"space-between",alignItems:"center"}),spacer:(0,n.css)({marginLeft:"7px"}),timeSettingContainer:(0,n.css)({paddingTop:Me.spacing(1)}),fiscalYearField:(0,n.css)({marginBottom:0}),timeZoneContainer:(0,n.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1}),timeZone:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"baseline",flexGrow:1})});var I=e(47087),R=e(44922),T=e(80011),L=e(63527),K=e(45967),A=e(62348),W=e(18828),N=e(42211),w=e(93225),j=e(59875),V=e(35621),U=e(66630),F=e(41654);function M({onClose:Me,onApply:$e}){return(0,t.jsxs)(F.B,{gap:2,justifyContent:"space-between",children:[(0,t.jsx)(g.$n,{variant:"secondary",onClick:Me,children:(0,t.jsx)(f.x,{i18nKey:"time-picker.calendar.cancel-button",children:"Cancel"})}),(0,t.jsx)(g.$n,{onClick:$e,children:(0,t.jsx)(f.x,{i18nKey:"time-picker.calendar.apply-button",children:"Apply time range"})})]})}M.displayName="Footer";var H=e(76319);function _({onClose:Me}){return(0,t.jsxs)(F.B,{justifyContent:"space-between",children:[(0,t.jsx)(I.e,{children:(0,t.jsx)(f.x,{i18nKey:"time-picker.calendar.select-time",children:"Select a time range"})}),(0,t.jsx)(H.K,{"data-testid":m.Tp.components.TimePicker.calendar.closeButton,tooltip:(0,f.t)("time-picker.calendar.close","Close calendar"),name:"times",variant:"secondary",onClick:Me})]})}_.displayName="Header";const Z=(Me,$e=!1)=>({container:(0,n.css)({top:0,position:"absolute",[`${$e?"left":"right"}`]:"546px"}),modalContainer:(0,n.css)({label:"modalContainer",margin:"0 auto"}),calendar:(0,n.css)({display:"flex",flexDirection:"column",gap:Me.spacing(1),padding:Me.spacing(1),label:"calendar",boxShadow:Me.shadows.z3,backgroundColor:Me.colors.background.primary,border:`1px solid ${Me.colors.border.weak}`,borderRadius:Me.shape.radius.default}),modal:(0,n.css)({label:"modal",boxShadow:Me.shadows.z3,left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)",zIndex:Me.zIndex.modal})});function ne(Me){const $e=(0,a.$j)(),{modalBackdrop:tt}=(0,a.of)(V.o),Ke=Z($e,Me.isReversed),{isOpen:Re,isFullscreen:Ve,onClose:Qe}=Me,je=(0,r.createRef)(),{dialogProps:ze}=(0,W.s)({"aria-label":m.Tp.components.TimePicker.calendar.label},je),{overlayProps:Ye}=(0,w.e)({isDismissable:!0,isOpen:Re,onClose:Qe},je),Ge=!Ve;if(!Re)return null;const ce=(0,t.jsxs)("section",{className:Ke.calendar,ref:je,...Ye,...ze,"data-testid":m.Tp.components.TimePicker.calendar.label,children:[(0,t.jsx)(_,{...Me}),(0,t.jsx)(U.nB,{...Me}),Ge&&(0,t.jsx)(M,{...Me})]});return Ge?(0,t.jsxs)(j.Sf,{children:[(0,t.jsx)("div",{className:tt}),(0,t.jsx)(N.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)("div",{className:Ke.modal,children:(0,t.jsx)("div",{className:Ke.modalContainer,children:ce})})})]}):(0,t.jsx)(N.n1,{contain:!0,restoreFocus:!0,autoFocus:!0,children:(0,t.jsx)("div",{className:Ke.container,children:ce})})}const te=(0,r.memo)(ne);ne.displayName="TimePickerCalendar";const Y={default:()=>(0,f.t)("time-picker.range-content.default-error",'Please enter a past date or "now"'),range:()=>(0,f.t)("time-picker.range-content.range-error",`"From" can't be after "To"`)},Q=Me=>{const{value:$e,isFullscreen:tt=!1,timeZone:Ke,onApply:Re,isReversed:Ve,fiscalYearStartMonth:Qe,onError:je,weekStart:ze}=Me,[Ye,Ge]=q($e.raw.from,$e.raw.to,Ke),ce=(0,a.of)(se),[Pe,Se]=(0,r.useState)(Ye),[Ee,xe]=(0,r.useState)(Ge),[ye,Oe]=(0,r.useState)(!1),we=(0,r.useId)(),Be=(0,r.useId)();(0,r.useEffect)(()=>{const[bt,Xt]=q($e.raw.from,$e.raw.to,Ke);Se(bt),xe(Xt)},[$e.raw.from,$e.raw.to,Ke]);const Xe=(0,r.useCallback)(bt=>{bt.preventDefault(),Oe(!0)},[Oe]),st=(0,r.useCallback)(()=>
12{if(Ee.invalid||Pe.invalid)return;const bt={from:Pe.value,to:Ee.value},Xt=s.convertRawToRange(bt,Ke,Qe);Re(Xt)},[Pe.invalid,Pe.value,Re,Ke,Ee.invalid,Ee.value,Qe]),lt=(0,r.useCallback)((bt,Xt)=>{const[Cn,vn]=q(bt,Xt,Ke);Se(Cn),xe(vn)},[Ke]),Et=bt=>{bt.key==="Enter"&&st()},Tt=()=>{const bt={from:Pe.value,to:Ee.value};navigator.clipboard.writeText(JSON.stringify(bt))},Mt=async()=>{const bt=await navigator.clipboard.readText();let Xt;try{Xt=JSON.parse(bt)}catch{je&&je(bt);return}const[Cn,vn]=q(Xt.from,Xt.to,Ke);Se(Cn),xe(vn)},wt=s.convertRawToRange({from:"now/fy",to:"now/fy"},Ke,Qe),_e=(0,f.t)("time-picker.range-content.fiscal-year","Fiscal year"),xt=(0,t.jsx)("div",{className:ce.tooltip,children:s.isFiscal($e)?(0,t.jsx)(K.m,{content:`${_e}: ${wt.from.format("MMM-DD")} - ${wt.to.format("MMM-DD")}`,children:(0,t.jsx)(u.I,{name:"info-circle"})}):null}),At=(0,t.jsx)(g.$n,{"aria-label":(0,f.t)("time-picker.range-content.open-input-calendar","Open calendar"),"data-testid":m.Tp.components.TimePicker.calendar.openButton,icon:"calendar-alt",variant:"secondary",type:"button",onClick:Xe});return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:ce.fieldContainer,children:[(0,t.jsx)(c.D,{label:(0,f.t)("time-picker.range-content.from-input","From"),invalid:Pe.invalid,error:Pe.errorMessage,children:(0,t.jsx)(L.p,{id:we,onClick:bt=>bt.stopPropagation(),onChange:bt=>lt(bt.currentTarget.value,Ee.value),addonAfter:At,onKeyDown:Et,"data-testid":m.Tp.components.TimePicker.fromField,value:Pe.value})}),xt]}),(0,t.jsxs)("div",{className:ce.fieldContainer,children:[(0,t.jsx)(c.D,{label:(0,f.t)("time-picker.range-content.to-input","To"),invalid:Ee.invalid,error:Ee.errorMessage,children:(0,t.jsx)(L.p,{id:Be,onClick:bt=>bt.stopPropagation(),onChange:bt=>lt(Pe.value,bt.currentTarget.value),addonAfter:At,onKeyDown:Et,"data-testid":m.Tp.components.TimePicker.toField,value:Ee.value})}),xt]}),(0,t.jsxs)("div",{className:ce.buttonsContainer,children:[(0,t.jsx)(g.$n,{"data-testid":m.Tp.components.TimePicker.copyTimeRange,icon:"copy",variant:"secondary",tooltip:(0,f.t)("time-picker.copy-paste.tooltip-copy","Copy time range to clipboard"),type:"button",onClick:Tt}),(0,t.jsx)(g.$n,{"data-testid":m.Tp.components.TimePicker.pasteTimeRange,icon:"clipboard-alt",variant:"secondary",tooltip:(0,f.t)("time-picker.copy-paste.tooltip-paste","Paste time range"),type:"button",onClick:Mt}),(0,t.jsx)(g.$n,{"data-testid":m.Tp.components.TimePicker.applyTimeRange,type:"button",onClick:st,children:(0,t.jsx)(f.x,{i18nKey:"time-picker.range-content.apply-button",children:"Apply time range"})})]}),(0,t.jsx)(te,{isFullscreen:tt,isOpen:ye,from:(0,R.b)(Pe.value,{timeZone:Ke}),to:(0,R.b)(Ee.value,{timeZone:Ke}),onApply:st,onClose:()=>Oe(!1),onChange:lt,timeZone:Ke,isReversed:Ve,weekStart:ze})]})};function J(Me,$e,tt){const Ke={from:Me,to:$e},Re=s.convertRawToRange(Ke,tt);return!(Re.from.isSame(Re.to)||Re.from.isBefore(Re.to))}function q(Me,$e,tt){const Ke=X(Me,tt),Re=X($e,tt),Ve=!(0,A.f)(Ke,!1,tt),Qe=!(0,A.f)(Re,!0,tt),je=J(Ke,Re,tt)&&!Qe;return[{value:Ke,invalid:Ve||je,errorMessage:je&&!Ve?Y.range():Y.default()},{value:Re,invalid:Qe,errorMessage:Y.default()}]}function X(Me,$e){if((0,o.Ar)(Me))return(0,T.LE)(Me,{timeZone:$e});if(Me.endsWith("Z")){const tt=(0,R.b)(Me);return(0,T.LE)(tt,{timeZone:$e})}return Me}function se(Me){return{fieldContainer:(0,n.css)({display:"flex"}),buttonsContainer:(0,n.css)({display:"flex",gap:Me.spacing(.5),marginTop:Me.spacing(1)}),tooltip:(0,n.css)({paddingLeft:Me.spacing(1),paddingTop:Me.spacing(3)})}}var oe=e(44398);const ae=(Me,$e)=>s.convertRawToRange({from:Me.from,to:Me.to},$e),ie=(Me,$e)=>{const tt=(0,T.LE)(Me.from,{timeZone:$e}),Ke=(0,T.LE)(Me.to,{timeZone:$e});return{from:tt,to:Ke,display:`${tt} to ${Ke}`}},fe=Me=>{const{quickOptions:$e=[],isReversed:tt,isFullscreen:Ke,hideQuickRanges:Re,timeZone:Ve,fiscalYearStartMonth:Qe,value:je,onChange:ze,history:Ye,showHistory:Ge,className:ce,hideTimeZone:Pe,onChangeTimeZone:Se,onChangeFiscalYearStartMonth:Ee}=Me,xe=!Ye?.length,ye=Ke&&Ge||!Ke&&(Ge&&!xe||!Re),Oe=(0,a.of)(Ne,tt,Re,ye,Ke),we=De(Ye,Ve),Be=Te(je.raw,$e),[Xe,st]=(0,r.useState)(""),lt=$e.filter(Tt=>Tt.display.toLowerCase().includes(Xe.toLowerCase())),Et=Tt=>ze(ae(Tt));return(0,t.jsxs)("div",{id:"TimePickerContent",className:(0,n.cx)(Oe.container,ce),children:[(0,t.jsxs)("div",{className:Oe.body,children:[(!Ke||!Re)&&(0,t.jsxs)("div",{className:Oe.rightSide,children:[(0,t.jsx)("div",{className:Oe.timeRangeFilter,children:(0,t.jsx)(h.Z,{width:0,value:Xe,onChange:st,placeholder:(0,f.t)("time-picker.content.filter-placeholder","Search quick ranges")})}
12),(0,t.jsxs)("div",{className:Oe.scrollContent,children:[!Ke&&(0,t.jsx)(de,{...Me,historyOptions:we}),!Re&&(0,t.jsx)(oe.l,{options:lt,onChange:Et,value:Be})]})]}),Ke&&(0,t.jsx)("div",{className:Oe.leftSide,children:(0,t.jsx)(le,{...Me,historyOptions:we})})]}),!Pe&&Ke&&(0,t.jsx)(S,{timeZone:Ve,fiscalYearStartMonth:Qe,onChangeTimeZone:Se,onChangeFiscalYearStartMonth:Ee})]})},pe=Me=>{const{widthOverride:$e}=Me,tt=(0,a.$j)(),Ke=($e||window.innerWidth)>=tt.breakpoints.values.lg;return(0,t.jsx)(fe,{...Me,isFullscreen:Ke})},de=Me=>{const{value:$e,hideQuickRanges:tt,onChange:Ke,timeZone:Re,historyOptions:Ve=[],showHistory:Qe,onError:je,weekStart:ze}=Me,Ye=(0,a.of)(Ce),Ge=(0,o.Ar)($e.raw.from)||(0,o.Ar)($e.raw.to),[ce,Pe]=(0,r.useState)(!Ge),Se=tt?!1:ce,Ee=xe=>Ke(ae(xe,Re));return(0,t.jsxs)("fieldset",{children:[(0,t.jsx)("div",{className:Ye.header,children:(0,t.jsxs)("button",{type:"button",className:Ye.expandButton,onClick:()=>{tt||Pe(!Se)},"data-testid":m.Tp.components.TimePicker.absoluteTimeRangeTitle,"aria-expanded":!Se,"aria-controls":"expanded-timerange",children:[(0,t.jsx)(I.e,{children:(0,t.jsx)(f.x,{i18nKey:"time-picker.absolute.title",children:"Absolute time range"})}),!tt&&(0,t.jsx)(u.I,{name:Se?"angle-down":"angle-up"})]})}),!Se&&(0,t.jsxs)("div",{className:Ye.body,id:"expanded-timerange",children:[(0,t.jsx)("div",{className:Ye.form,children:(0,t.jsx)(Q,{value:$e,onApply:Ke,timeZone:Re,isFullscreen:!1,onError:je,weekStart:ze})}),Qe&&(0,t.jsx)(oe.l,{title:(0,f.t)("time-picker.absolute.recent-title","Recently used absolute ranges"),options:Ve,onChange:Ee,placeholderEmpty:null})]})]})},le=Me=>{const{onChange:$e,value:tt,timeZone:Ke,fiscalYearStartMonth:Re,isReversed:Ve,historyOptions:Qe,onError:je,weekStart:ze}=Me,Ye=(0,a.of)(He,Me.hideQuickRanges),Ge=ce=>$e(ae(ce,Ke));return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:Ye.container,children:[(0,t.jsx)("div",{className:Ye.title,"data-testid":m.Tp.components.TimePicker.absoluteTimeRangeTitle,children:(0,t.jsx)(I.e,{children:(0,t.jsx)(f.x,{i18nKey:"time-picker.absolute.title",children:"Absolute time range"})})}),(0,t.jsx)(Q,{value:tt,timeZone:Ke,fiscalYearStartMonth:Re,onApply:$e,isFullscreen:!0,isReversed:Ve,onError:je,weekStart:ze})]}),Me.showHistory&&(0,t.jsx)("div",{className:Ye.recent,children:(0,t.jsx)(oe.l,{title:(0,f.t)("time-picker.absolute.recent-title","Recently used absolute ranges"),options:Qe||[],onChange:Ge,placeholderEmpty:(0,t.jsx)(me,{})})})]})},me=(0,r.memo)(()=>{const Me=(0,a.of)(ke),$e=(0,f.t)("time-picker.content.empty-recent-list-info","It looks like you haven't used this time picker before. As soon as you enter some time intervals, recently used intervals will appear here.");return(0,t.jsxs)("div",{className:Me.container,children:[(0,t.jsx)("div",{children:(0,t.jsx)("span",{children:$e})}),(0,t.jsx)(f.x,{i18nKey:"time-picker.content.empty-recent-list-docs",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("a",{className:Me.link,href:"https://grafana.com/docs/grafana/latest/dashboards/time-range-controls",target:"_new",children:"Read the documentation"}),(0,t.jsx)("span",{children:" to find out more about how to enter custom time ranges."})]})})]})});function De(Me,$e){return!Array.isArray(Me)||Me.length===0?[]:Me.map(tt=>ie(tt,$e))}me.displayName="EmptyRecentList";const Te=(Me,$e)=>(0,r.useMemo)(()=>{if(s.isRelativeTimeRange(Me))return $e.find(tt=>tt.from===Me.from&&tt.to===Me.to)},[Me,$e]),Ne=(Me,$e,tt,Ke,Re)=>({container:(0,n.css)({background:Me.colors.background.elevated,boxShadow:Me.shadows.z3,width:`${Re?"546px":"262px"}`,borderRadius:Me.shape.radius.default,border:`1px solid ${Me.colors.border.weak}`,[`${$e?"left":"right"}`]:0,display:"flex",flexDirection:"column"}),body:(0,n.css)({display:"flex",flexDirection:"row-reverse",height:`${Ke?"381px":"217px"}`,maxHeight:"100vh"}),leftSide:(0,n.css)({display:"flex",flexDirection:"column",borderRight:`${$e?"none":`1px solid ${Me.colors.border.weak}`}`,width:`${tt?"100%":"60%"}`,overflow:"auto",scrollbarWidth:"thin",order:$e?1:0}),rightSide:(0,n.css)({width:`${Re?"40%":"100%"}; !important`,borderRight:$e?`1px solid ${Me.colors.border.weak}`:"none",display:"flex",flexDirection:"column"}),timeRangeFilter:(0,n.css)({padding:Me.spacing(1)}),spacing:(0,n.css)({marginTop:"16px"}),scrollContent:(0,n.css)({overflowY:"auto",scrollbarWidth:"thin"})}),Ce=Me=>({header:(0,n.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${Me.colors.border.weak}`,padding:"7px 9px 7px 9px"}),expandButton:(0,n.css)({backgroundColor:"transparent",border:"none",display:"flex",width:"100%","&:focus-visible":(0,l.getFocusStyles)(Me)}),body:(0,n.css)({borderBottom:`1px solid ${Me.colors.border.weak}`}),form:(0,n.css)({padding:"7px 9px 7px 9px"})}
12),He=(Me,$e)=>({container:(0,n.css)({paddingTop:"9px",paddingLeft:"11px",paddingRight:$e?"11px":"20%"}),title:(0,n.css)({marginBottom:"11px"}),recent:(0,n.css)({flexGrow:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",paddingTop:Me.spacing(1)})}),ke=Me=>({container:(0,n.css)({padding:"12px",margin:"12px","a, span":{fontSize:"13px"}}),link:(0,n.css)({color:Me.colors.text.link})})},47087:(ee,B,e)=>{"use strict";e.d(B,{e:()=>m});var t=e(74848),n=e(22803),r=e(96540),o=e(63142);const s=a=>({text:(0,n.css)({fontSize:a.typography.size.md,fontWeight:a.typography.fontWeightMedium,color:a.colors.text.primary,margin:0,display:"flex"})}),m=(0,r.memo)(({children:a})=>{const l=(0,o.of)(s);return(0,t.jsx)("h3",{className:l.text,children:a})});m.displayName="TimePickerTitle"},83692:(ee,B,e)=>{"use strict";e.d(B,{f:()=>a});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(91867),m=e(62348);const a=(0,r.memo)(function({hideText:h,value:u,timeZone:i="browser",placeholder:x="No time range selected",className:g}){const p=(0,o.of)(l);return h?null:(0,t.jsx)("span",{className:g,children:(0,m.X)(u)?(0,t.jsx)(s._8,{value:u,timeZone:i}):(0,t.jsx)("span",{className:p.placeholder,children:x})})}),l=f=>({placeholder:(0,n.css)({color:f.colors.text.disabled,opacity:1})})},44398:(ee,B,e)=>{"use strict";e.d(B,{l:()=>g});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(7685),m=e(47087),a=e(24726),l=e(35484);const f=D=>({container:(0,n.css)({display:"flex",alignItems:"center",flexDirection:"row-reverse",justifyContent:"space-between",position:"relative"}),radio:(0,n.css)({opacity:0,width:"0 !important","&:focus-visible + label":(0,l.getFocusStyles)(D)}),label:(0,n.css)({cursor:"pointer",flex:1,padding:D.spacing(1),borderRadius:D.shape.radius.default,"&:hover":{background:D.colors.action.hover,cursor:"pointer"}}),labelSelected:(0,n.css)({background:D.colors.action.selected,"&::before":{backgroundImage:D.colors.gradients.brandVertical,borderRadius:D.shape.radius.default,content:'" "',display:"block",height:"100%",position:"absolute",width:D.spacing(.5),left:0,top:0}})}),h=(0,r.memo)(({value:D,onSelect:b,selected:E=!1,name:v})=>{const C=(0,o.of)(f),S=(0,a.A)();return(0,t.jsxs)("li",{className:C.container,children:[(0,t.jsx)("input",{className:C.radio,checked:E,name:v,type:"checkbox","data-role":"item",tabIndex:-1,id:S,onChange:()=>b(D)}),(0,t.jsx)("label",{className:(0,n.cx)(C.label,E&&C.labelSelected),htmlFor:S,children:D.display})]})});h.displayName="TimeRangeOption";const u=(D,b)=>(D%b+b)%b,i=["ArrowUp","ArrowDown","Home","End","Enter","Tab"],x=({localRef:D,options:b})=>{const[E,v]=(0,r.useState)(0);return(0,r.useEffect)(()=>{const S=D.current?.querySelectorAll('[data-role="item"]')||[],O=Array.from(S).findIndex(R=>R.checked),I=O>=0?O:0;S.forEach((R,T)=>{R.tabIndex=T===I?0:-1}),v(I)},[D,b]),[S=>{const O=D?.current?.querySelectorAll('[data-role="item"]'),I=O?.length??0;i.indexOf(S.key)>-1&&(S.preventDefault(),S.key!=="Tab"&&S.stopPropagation());let R=null;switch(S.key){case"ArrowUp":R=u(E-1,I);break;case"ArrowDown":R=u(E+1,I);break;case"Home":R=0;break;case"End":R=I-1;break;case"Enter":O?.[E]?.click();break;default:break}R!==null&&(v(R),O?.[R]?.focus(),O?.forEach((T,L)=>{T.tabIndex=L===R?0:-1}))}]},g=D=>{const b=(0,o.of)(P),{title:E,options:v,placeholderEmpty:C}=D;return typeof C<"u"&&v.length<=0?(0,t.jsx)(t.Fragment,{children:C}):E?(0,t.jsx)("section",{"aria-label":E,children:(0,t.jsxs)("fieldset",{children:[(0,t.jsx)("div",{className:b.title,children:(0,t.jsx)(m.e,{children:E})}),(0,t.jsx)(p,{...D})]})}):(0,t.jsx)(p,{...D})},p=({options:D,value:b,onChange:E,title:v})=>{const C=(0,o.of)(d),S=(0,r.useRef)(null),[O]=x({localRef:S,options:D});return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("ul",{role:"presentation",onKeyDown:O,ref:S,"aria-roledescription":(0,s.t)("time-picker.time-range.aria-role","Time range selection"),className:C.list,children:D.map((I,R)=>(0,t.jsx)(h,{value:I,selected:y(I,b),onSelect:E,name:v??(0,s.t)("time-picker.time-range.default-title","Time ranges")},c(I,R)))})})};function c(D,b){return`${D.from}-${D.to}-${b}`}function y(D,b){return!b||!D?!1:b.from===D.from&&b.to===D.to}const P=()=>({title:(0,n.css)({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px 5px 9px"})}),d=D=>({list:(0,n.css)({padding:D.spacing(.5)})})},59310:(ee,B,e)=>{"use strict";e.d(B,{U:()=>D});var t=e(74848),n=e(2543),r=e(96540),o=e(62717),s=e(7685),m=e(18857),a=e(22803),l=e(63142);const f=O=>{const{children:I,label:R}=O,T=(0,l.of)(h);return R?(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:T.header,children:(0,t.jsx)("span",{className:T.label,children:R})}),I]}):(0,t.jsx)("div",{children:I})},h=O=>({header:(0,a.css)({padding:"7px 10px",width:"100%",borderTop:`1px solid ${O.colors.border.weak}`,textTransform:"capitalize"}),label:(0,a.css)({fontSize:O.typography.size.sm,color:O.colors.text.secondary,fontWeight:O.typography.fontWeightMedium})});var u=e(44229),i=e(85629),x=e(30703),g=e(34788),p=e(27228);const c="tz-utc-offset",y=O=>{const{children:I,innerProps:R,innerRef:T,data:L,isSelected:K,isFocused:A}
12=O,W=(0,l.of)(d),N=Date.now(),w=(0,a.cx)(W.container,A&&W.containerFocused);if(!(0,n.isString)(L.value))return null;const j=(0,o.QZ)(L.value,N);return(0,t.jsx)("div",{className:w,...R,ref:T,"data-testid":i.Tp.components.Select.option,children:(0,t.jsxs)("div",{className:(0,a.cx)(W.leftColumn,W.row),children:[(0,t.jsxs)("div",{className:(0,a.cx)(W.leftColumn,W.wideRow),children:[(0,t.jsx)(p.U,{title:I}),(0,t.jsx)("div",{className:W.spacer}),(0,t.jsx)(g.E,{info:j})]}),(0,t.jsxs)("div",{className:W.rightColumn,children:[(0,t.jsx)(u.X,{timeZone:j?.ianaName||L.value,timestamp:N,className:c}),K&&(0,t.jsx)("span",{children:(0,t.jsx)(x.I,{name:"check"})})]})]})})},P=O=>{const{children:I,innerProps:R,innerRef:T,data:L,isSelected:K,isFocused:A}=O,W=(0,l.of)(d),N=Date.now(),w=(0,a.cx)(W.container,A&&W.containerFocused);if(!(0,n.isString)(L.value))return null;const j=(0,o.QZ)(L.value,N);return(0,t.jsx)("div",{className:w,...R,ref:T,"data-testid":i.Tp.components.Select.option,children:(0,t.jsxs)("div",{className:W.body,children:[(0,t.jsxs)("div",{className:W.row,children:[(0,t.jsx)("div",{className:W.leftColumn,children:(0,t.jsx)(p.U,{title:I})}),(0,t.jsx)("div",{className:W.rightColumn,children:K&&(0,t.jsx)("span",{children:(0,t.jsx)(x.I,{name:"check"})})})]}),(0,t.jsxs)("div",{className:W.row,children:[(0,t.jsx)("div",{className:W.leftColumn,children:(0,t.jsx)(g.E,{info:j})}),(0,t.jsx)("div",{className:W.rightColumn,children:(0,t.jsx)(u.X,{timestamp:N,timeZone:j?.ianaName||L.value,className:c})})]})]})})},d=O=>({container:(0,a.css)({display:"flex",alignItems:"center",flexDirection:"row",flexShrink:0,whiteSpace:"nowrap",cursor:"pointer",padding:"6px 8px 4px","&:hover":{background:O.colors.action.hover}}),containerFocused:(0,a.css)({background:O.colors.action.hover}),body:(0,a.css)({display:"flex",fontWeight:O.typography.fontWeightMedium,flexDirection:"column",flexGrow:1}),row:(0,a.css)({display:"flex",flexDirection:"row"}),leftColumn:(0,a.css)({flexGrow:1,textOverflow:"ellipsis"}),rightColumn:(0,a.css)({justifyContent:"flex-end",alignItems:"center"}),wideRow:(0,a.css)({display:"flex",flexDirection:"row",alignItems:"baseline"}),spacer:(0,a.css)({marginLeft:"6px"})}),D=O=>{const{onChange:I,width:R,autoFocus:T=!1,onBlur:L,value:K,includeInternal:A=!1,disabled:W=!1,inputId:N,menuShouldPortal:w=!0,openMenuOnFocus:j=!0}=O,V=b(A),U=E(V,K),F=C(),M=R&&R<=45?P:y,H=(0,r.useCallback)(_=>{if(!_||!(0,n.isString)(_.value))return I(K);I(_.value)},[I,K]);return(0,t.jsx)(m.l6,{inputId:N,value:U,placeholder:(0,s.t)("time-picker.zone.select-search-input","Type to search (country, city, abbreviation)"),autoFocus:T,menuShouldPortal:w,openMenuOnFocus:j,width:R,filterOption:F,options:V,onChange:H,onBlur:L,components:{Option:M,Group:f},disabled:W,"aria-label":(0,s.t)("time-picker.zone.select-aria-label","Time zone picker")})},b=O=>{const I=Date.now();return(0,o.U3)(O).map(T=>{const L=T.zones.reduce((K,A)=>{const W=(0,o.QZ)(A,I);return W&&K.push({label:W.name,value:W.zone,searchIndex:S(W,I)}),K},[]);return{label:T.name,options:L}})},E=(O,I)=>(0,r.useMemo)(()=>{if(I===void 0)return;const R=(0,n.toLower)(I);return O.find(L=>L.label?R.startsWith((0,n.toLower)(L.label)):v(R))?.options.find(L=>(0,n.isEmpty)(R)?L.value===o.g$.default:(0,n.toLower)(L.value)===R)},[O,I]),v=O=>{switch(O){case o.g$.default:case o.g$.localBrowserTime:case o.g$.utc:return!0;default:return!1}},C=()=>(0,r.useCallback)((O,I)=>!I||!O.data||!O.data.searchIndex?!0:O.data.searchIndex.indexOf((0,n.toLower)(I))>-1,[]),S=(O,I)=>{const R=[(0,n.toLower)(O.name),(0,n.toLower)(O.abbreviation),(0,n.toLower)((0,u.t)(I,O.zone))];for(const T of O.countries)R.push((0,n.toLower)(T.name)),R.push((0,n.toLower)(T.code));return R.join("|")}},34788:(ee,B,e)=>{"use strict";e.d(B,{E:()=>s});var t=e(74848),n=e(22803),r=e(96540),o=e(63142);const s=({info:l})=>{const f=(0,o.of)(a),h=m(l);return l?(0,t.jsx)("div",{className:f.description,children:h}):null},m=l=>(0,r.useMemo)(()=>{const f=[];if(!l)return"";if(l.name==="Europe/Simferopol")return"Ukraine, EEST";if(l.countries.length>0){const h=l.countries[0];f.push(h.name)}return l.abbreviation&&f.push(l.abbreviation),f.join(", ")},[l]),a=l=>({description:(0,n.css)({fontWeight:"normal",fontSize:l.typography.size.sm,color:l.colors.text.secondary,whiteSpace:"normal",textOverflow:"ellipsis"})})},44229:(ee,B,e)=>{"use strict";e.d(B,{X:()=>a,t:()=>l});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(80011),m=e(63142);const a=h=>{const{timestamp:u,timeZone:i,className:x}=h,g=(0,m.of)(f);return(0,r.isString)(i)?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("span",{className:(0,n.cx)(g.offset,x),children:l(u,i)})}):null},l=(h,u)=>`UTC${(0,s.LE)(h,{timeZone:u,format:"Z"})}`,f=h=>{const u=(0,n.css)({fontWeight:"normal",fontSize:h.typography.size.sm,color:h.colors.text.secondary,whiteSpace:"normal"});return{offset:(0,n.css)(u,{color:h.colors.text.primary,background:h.colors.background.secondary,padding:"2px 5px",borderRadius:h.shape.radiu
12s.default,marginLeft:"4px"})}}},27228:(ee,B,e)=>{"use strict";e.d(B,{U:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({title:m})=>{const a=(0,r.of)(s);return m?(0,t.jsx)("span",{className:a.title,children:m}):null},s=m=>({title:(0,n.css)({fontWeight:m.typography.fontWeightRegular,textOverflow:"ellipsis"})})},5857:(ee,B,e)=>{"use strict";e.d(B,{l6:()=>l,rE:()=>m,rL:()=>a});var t=e(74848),n=e(96540),r=e(85629),o=e(43243);const s=[{value:"",label:"Default"},{value:"saturday",label:"Saturday"},{value:"sunday",label:"Sunday"},{value:"monday",label:"Monday"}];function m(f){return["saturday","sunday","monday"].includes(f)}function a(f){if(f&&m(f))return f;const h=window?.grafanaBootData?.user?.weekStart;return h&&m(h)?h:"monday"}const l=f=>{const{onChange:h,width:u,autoFocus:i=!1,onBlur:x,value:g,disabled:p=!1,inputId:c}=f,y=(0,n.useCallback)(d=>{d&&d.value!==void 0&&h(m(d.value)?d.value:void 0)},[h]),P=(0,n.useMemo)(()=>s.find(d=>d.value===g)?.value??"",[g]);return(0,t.jsx)(o.G,{id:c,value:P,placeholder:r.Tp.components.WeekStartPicker.placeholder,autoFocus:i,width:u,options:s,onChange:y,onBlur:x,disabled:p})}},8431:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>n,o:()=>t});const t=[{from:"now-5m",to:"now",display:"Last 5 minutes"},{from:"now-15m",to:"now",display:"Last 15 minutes"},{from:"now-30m",to:"now",display:"Last 30 minutes"},{from:"now-1h",to:"now",display:"Last 1 hour"},{from:"now-3h",to:"now",display:"Last 3 hours"},{from:"now-6h",to:"now",display:"Last 6 hours"},{from:"now-12h",to:"now",display:"Last 12 hours"},{from:"now-24h",to:"now",display:"Last 24 hours"},{from:"now-2d",to:"now",display:"Last 2 days"},{from:"now-7d",to:"now",display:"Last 7 days"},{from:"now-30d",to:"now",display:"Last 30 days"},{from:"now-90d",to:"now",display:"Last 90 days"},{from:"now-6M",to:"now",display:"Last 6 months"},{from:"now-1y",to:"now",display:"Last 1 year"},{from:"now-2y",to:"now",display:"Last 2 years"},{from:"now-5y",to:"now",display:"Last 5 years"},{from:"now-1d/d",to:"now-1d/d",display:"Yesterday"},{from:"now-2d/d",to:"now-2d/d",display:"Day before yesterday"},{from:"now-7d/d",to:"now-7d/d",display:"This day last week"},{from:"now-1w/w",to:"now-1w/w",display:"Previous week"},{from:"now-1M/M",to:"now-1M/M",display:"Previous month"},{from:"now-1Q/fQ",to:"now-1Q/fQ",display:"Previous fiscal quarter"},{from:"now-1y/y",to:"now-1y/y",display:"Previous year"},{from:"now-1y/fy",to:"now-1y/fy",display:"Previous fiscal year"},{from:"now/d",to:"now/d",display:"Today"},{from:"now/d",to:"now",display:"Today so far"},{from:"now/w",to:"now/w",display:"This week"},{from:"now/w",to:"now",display:"This week so far"},{from:"now/M",to:"now/M",display:"This month"},{from:"now/M",to:"now",display:"This month so far"},{from:"now/y",to:"now/y",display:"This year"},{from:"now/y",to:"now",display:"This year so far"},{from:"now/fQ",to:"now",display:"This fiscal quarter so far"},{from:"now/fQ",to:"now/fQ",display:"This fiscal quarter"},{from:"now/fy",to:"now",display:"This fiscal year so far"},{from:"now/fy",to:"now/fy",display:"This fiscal year"}],n=[{label:"January",value:0},{label:"February",value:1},{label:"March",value:2},{label:"April",value:3},{label:"May",value:4},{label:"June",value:5},{label:"July",value:6},{label:"August",value:7},{label:"September",value:8},{label:"October",value:9},{label:"November",value:10},{label:"December",value:11}]},62348:(ee,B,e)=>{"use strict";e.d(B,{X:()=>s,f:()=>o});var t=e(25229),n=e(33239),r=e(44922);function o(m,a,l){return(0,t.Ar)(m)?m.isValid():n.isMathString(m)?n.isValid(m):(0,r.b)(m,{roundUp:a,timeZone:l}).isValid()}function s(m){return n.isValid(m.from)&&n.isValid(m.to)}},41e3:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>n});var t=e(62717);function n(r,o){const s=(0,t.HD)(o);if(!s)return r;const m=s.utcOffset(r.getTime()),a=r.getTimezoneOffset(),l=m-a;return new Date(r.getTime()-l*1e3*60)}},3271:(ee,B,e)=>{"use strict";e.d(B,{c:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({direction:m="horizontal",spacing:a=2})=>{const l=(0,r.of)(s,a);return m==="vertical"?(0,t.jsx)("div",{className:l.verticalDivider}):(0,t.jsx)("hr",{className:l.horizontalDivider})};o.displayName="Divider";const s=(m,a)=>({horizontalDivider:(0,n.css)({borderTop:`1px solid ${m.colors.border.weak}`,margin:m.spacing(a,0),width:"100%"}),verticalDivider:(0,n.css)({borderRight:`1px solid ${m.colors.border.weak}`,margin:m.spacing(0,a),height:"100%"})})},45897:(ee,B,e)=>{"use strict";e.d(B,{l:()=>n});var t=e(22803);const n=(r,o)=>{const s=o||"middle",m=r.colors.emphasize(r.colors.background.secondary,.15),a=r.colors.primary.border,l=r.spacing(2),f=4,h=200;let u="50%",i="50%";switch(s){case"start":{u="0%",i="0%";break}case"end":{u="100%",i="100%";break}}const x=(0,t.css)({position:"relative","&:before":{content:'""',position:"absolute",transition:r.transitions.create("border-color"),zIndex:1},"&:after":{background:m,content:'""',position:"absolute",transition:r.transitions.create("background"),transform:"translate(-50%, -50%)",borderRadius:r.shape.radiu
12s.pill,zIndex:1},"&:hover":{"&:before":{borderColor:a},"&:after":{background:a}}}),g={borderRight:"1px solid transparent",height:"100%",left:u,transform:"translateX(-50%)"},p={borderTop:"1px solid transparent",top:i,transform:"translateY(-50%)"};return{dragHandleVertical:(0,t.cx)(x,(0,t.css)({cursor:"col-resize",width:l,"&:before":g,"&:after":{left:u,top:"50%",height:h,width:f}})),dragHandleHorizontal:(0,t.cx)(x,(0,t.css)({height:l,cursor:"row-resize","&:before":p,"&:after":{left:"50%",top:i,height:f,width:h}})),dragHandleBaseVertical:(0,t.cx)(x,(0,t.css)({cursor:"col-resize",width:l,"&:before":g})),dragHandleBaseHorizontal:(0,t.cx)(x,(0,t.css)({cursor:"row-resize",height:l,"&:before":p}))}}},8207:(ee,B,e)=>{"use strict";e.d(B,{_:()=>c});var t=e(74848),n=e(22803),r=e(18828),o=e(42211),s=e(93225),m=e(50848),a=e(96540),l=e(85629),f=e(63142),h=e(7685),u=e(45897),i=e(76319),x=e(92807),g=e(66404);const p={sm:{width:"25vw",minWidth:384},md:{width:"50vw",minWidth:568},lg:{width:"75vw",minWidth:744}};function c({children:E,onClose:v,closeOnMaskClick:C=!0,scrollableContent:S=!0,title:O,subtitle:I,width:R,size:T="md",tabs:L}){const[K,A,W]=y(),N=(0,f.of)(D),w=(0,f.of)(b,T),j=(0,f.of)(u.l),V=a.useRef(null),{dialogProps:U,titleProps:F}=(0,r.s)({},V),{overlayProps:M}=(0,s.e)({isDismissable:!1,isOpen:!0,onClose:v},V);d();const H=(0,t.jsx)("div",{className:N.content,children:E}),_=K??R??p[T].width,Z=p[T].minWidth;return(0,t.jsx)(m.A,{open:!0,onClose:v,placement:"right",getContainer:".main-view",className:N.drawerContent,rootClassName:N.drawer,classNames:{wrapper:w},styles:{wrapper:{width:_,minWidth:Z}},width:"",motion:{motionAppear:!0,motionName:N.drawerMotion},maskClassName:N.mask,maskClosable:C,maskMotion:{motionAppear:!0,motionName:N.maskMotion},children:(0,t.jsx)(o.n1,{restoreFocus:!0,contain:!0,autoFocus:!0,children:(0,t.jsxs)("div",{"aria-label":typeof O=="string"?l.Tp.components.Drawer.General.title(O):l.Tp.components.Drawer.General.title("no title"),className:N.container,...M,...U,ref:V,children:[(0,t.jsx)("div",{className:(0,n.cx)(j.dragHandleVertical,N.resizer),onMouseDown:A,onTouchStart:W}),typeof O=="string"&&(0,t.jsxs)("div",{className:(0,n.cx)(N.header,!!L&&N.headerWithTabs),children:[(0,t.jsx)("div",{className:N.actions,children:(0,t.jsx)(i.K,{name:"times",variant:"secondary",onClick:v,"data-testid":l.Tp.components.Drawer.General.close,tooltip:(0,h.t)("grafana-ui.drawer.close","Close")})}),(0,t.jsxs)("div",{className:N.titleWrapper,children:[(0,t.jsx)(g.E,{element:"h3",...F,children:O}),I&&(0,t.jsx)("div",{className:N.subtitle,"data-testid":l.Tp.components.Drawer.General.subtitle,children:I}),L&&(0,t.jsx)("div",{className:N.tabsWrapper,children:L})]})]}),typeof O!="string"&&O,S?(0,t.jsx)(x.P,{showScrollIndicators:!0,children:H}):H]})})})}function y(){const[E,v]=(0,a.useState)(void 0),C=(0,a.useCallback)(L=>{v(P(L.clientX))},[]),S=(0,a.useCallback)(L=>{const K=L.touches[0];v(P(K.clientX))},[]),O=(0,a.useCallback)(L=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",O)},[C]),I=(0,a.useCallback)(L=>{document.removeEventListener("touchmove",S),document.removeEventListener("touchend",I)},[S]);function R(L){L.stopPropagation(),L.preventDefault(),document.addEventListener("mousemove",C),document.addEventListener("mouseup",O)}function T(L){L.stopPropagation(),L.preventDefault(),document.addEventListener("touchmove",S),document.addEventListener("touchend",I)}return[E,R,T]}function P(E){let v=document.body.offsetWidth-(E-document.body.offsetLeft);return`${Math.min(v/document.body.clientWidth*100,98).toFixed(2)}vw`}function d(){(0,a.useEffect)(()=>{if(document.body)return document.body.classList.add("body-drawer-open"),()=>{document.body.classList.remove("body-drawer-open")}},[])}const D=E=>({container:(0,n.css)({display:"flex",flexDirection:"column",height:"100%",flex:"1 1 0",minHeight:"100%",position:"relative"}),drawer:(0,n.css)({top:0,".rc-drawer-content-wrapper":{boxShadow:E.shadows.z3}}),drawerContent:(0,n.css)({backgroundColor:`${E.colors.background.primary} !important`,display:"flex",overflow:"unset !important",flexDirection:"column"}),drawerMotion:(0,n.css)({"&-appear":{transform:"translateX(100%)",transition:"none !important","&-active":{transition:`${E.transitions.create("transform")} !important`,transform:"translateX(0)"}}}),mask:(0,n.css)({backgroundColor:"transparent !important",position:"fixed !important","&:before":{backgroundColor:`${E.components.overlay.background} !important`,bottom:0,content:'""',left:0,position:"fixed",right:0,top:0}}),maskMotion:(0,n.css)({"&-appear":{opacity:0,"&-active":{opacity:1,transition:E.transitions.create("opacity")}}}),header:(0,n.css)({label:"drawer-header",flexGrow:0,padding:E.spacing(2,2,3),borderBottom:`1px solid ${E.colors.border.weak}`}),headerWithTabs:(0,n.css)({borderBottom:"none"}),actions:(0,n.css)({position:"absolute",right:E.spacing(1),top:E.spacing(1)}),titleWrapper:(0,n.css)({label:"drawer-title",overflowWrap:"break-word"}),subtitle:(0,n.css)({label:"drawer-subtitle",color:E.colors.text.secondary,paddingTop:E.spacing(1)}),content:(0,n.css)({padding:E.spacing(2),height:"100%",flexGrow:1,minHeight:0}),tabsWrapper:(0,n.css)({label:"drawer-tabs",paddingLeft:E.spacing(2),margin:E.spacing(1,-1,-3,-3)}),resizer:(0,n.css)({top:0,left:E.spacing(-1),bottom:0,position:"absolute",zIndex:E.zIndex.modal})});function b(E,v){return(0,n.css)({label:`drawer-content-wrapper-${v}`,overflow:"unset !important",[E.breakpoints.down("md")]:{width:`calc(100% - ${E.spacing(2)}) !important`,minWidth:"0 !important"}})}},15356:(ee,B,e)=>{"use strict";e.d(B,{f:()=>x});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(42211),a=e(96540),l=e(63142),f=e(87063),h=e(94535),u=e(7895);const i=p=>{const{className:c,options:y,value:P,onChange:d,narrow:D,variant:b,...E}
12=p,v=(0,l.of)(g),[C,S]=(0,a.useState)(!1),O=[(0,r.cY)(0),(0,r.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,r.BN)()],{context:I,refs:R,floatingStyles:T}=(0,o.we)({open:C,placement:"bottom-end",onOpenChange:S,middleware:O,whileElementsMounted:s.ll}),L=(0,o.kp)(I),K=(0,o.s9)(I),{getReferenceProps:A,getFloatingProps:W}=(0,o.bv)([K,L]),N=w=>{d(w),S(!1)};return(0,t.jsxs)("div",{className:v.wrapper,children:[(0,t.jsx)(u.I,{className:c,isOpen:C,narrow:D,variant:b,ref:R.setReference,...A(),...E,children:P?.label||(P?.value!=null?String(P?.value):null)}),C&&(0,t.jsx)("div",{className:v.menuWrapper,ref:R.setFloating,...W(),style:T,children:(0,t.jsx)(m.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)(f.W,{tabIndex:-1,onClose:()=>S(!1),children:y.map(w=>(0,t.jsx)(h.D,{label:w.label??String(w.value),onClick:()=>N(w),active:w.value===P?.value,ariaChecked:w.value===P?.value,ariaLabel:w.ariaLabel||w.label,disabled:w.isDisabled,component:w.component,role:"menuitemradio"},`${w.value}`))})})})]})};i.displayName="ButtonSelect";const x=(0,a.memo)(i),g=p=>({wrapper:(0,n.css)({position:"relative",display:"inline-flex"}),menuWrapper:(0,n.css)({zIndex:p.zIndex.dropdown})})},88559:(ee,B,e)=>{"use strict";e.d(B,{m:()=>i});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(96540),a=e(86634),l=e(63142),f=e(44019),h=e(71495),u=e(15245);const i=m.memo(({children:g,overlay:p,placement:c,offset:y,onVisibleChange:P})=>{const[d,D]=(0,m.useState)(!1),b=(0,m.useRef)(null),E=(0,m.useCallback)(w=>{D(w),P?.(w)},[P]),v=[(0,r.cY)({mainAxis:y?.[0]??8,crossAxis:y?.[1]??0}),(0,r.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,r.BN)()],{context:C,refs:S,floatingStyles:O}=(0,o.we)({open:d,placement:(0,h.O)(c),onOpenChange:E,middleware:v,whileElementsMounted:s.ll}),I=(0,o.kp)(C),R=(0,o.s9)(C),{getReferenceProps:T,getFloatingProps:L}=(0,o.bv)([R,I]),K=150,A=(0,l.of)(x,K),W=()=>{E(!1)},N=w=>{w.key==="Tab"&&E(!1)};return(0,t.jsxs)(t.Fragment,{children:[m.cloneElement(g,{ref:S.setReference,...T()}),d&&(0,t.jsx)(u.ZL,{children:(0,t.jsx)(o.s3,{context:C,children:(0,t.jsx)("div",{ref:S.setFloating,style:O,onClick:W,onKeyDown:N,children:(0,t.jsx)(a.A,{nodeRef:b,appear:!0,in:!0,timeout:{appear:K,exit:0,enter:0},classNames:A,children:(0,t.jsx)("div",{ref:b,children:f.renderOrCallToRender(p,{...L()})})})})})})]})});i.displayName="Dropdown";const x=(g,p)=>({appear:(0,n.css)({opacity:"0",position:"relative",transformOrigin:"top",[g.transitions.handleMotion("no-preference")]:{transform:"scaleY(0.5)"}}),appearActive:(0,n.css)({opacity:"1",[g.transitions.handleMotion("no-preference")]:{transform:"scaleY(1)",transition:`transform ${p}ms cubic-bezier(0.2, 0, 0.2, 1), opacity ${p}ms cubic-bezier(0.2, 0, 0.2, 1)`}})})},56887:(ee,B,e)=>{"use strict";e.d(B,{_:()=>n,y:()=>r});var t=e(96540);const n=(0,t.createContext)(void 0);function r(o){if(!o)return{};const s=(0,t.useContext)(n);if(!s)return{};const m=s.selected.some(f=>f.id===o),a=(0,t.useCallback)((f,h={})=>{s.enabled&&(f.stopPropagation(),f.shiftKey&&(f.preventDefault(),window.getSelection()?.empty()),s.onSelect({id:o},{...h,multi:h.multi??f.shiftKey}))},[s,o]),l=(0,t.useCallback)(()=>{s.enabled&&s.onClear()},[s]);return{isSelected:m,onSelect:a,onClear:l,isSelectable:s.enabled}}},74451:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({children:m})=>{const a=(0,r.of)(s);return(0,t.jsx)("div",{className:a.container,children:m})},s=m=>({container:(0,n.css)({borderLeft:`3px solid ${m.colors.info.main}`,backgroundColor:`${m.colors.background.secondary}`,padding:m.spacing(2),minWidth:"350px",borderRadius:m.shape.radius.default,marginBottom:m.spacing(4)})})},50201:(ee,B,e)=>{"use strict";e.d(B,{p:()=>b});var t=e(74848),n=e(22803),r=e(55494),o=e(63142),s=e(31286),m=e(41654),a=e(66404),l=e(36348);const f=({width:C="auto",height:S})=>{const O=(0,o.of)(h);return(0,t.jsx)(r.default,{src:l,className:O.svg,height:S,width:C})};f.displayName="GrotCTA";const h=C=>({svg:(0,n.css)({"#grot-cta-cactus-1, #grot-cta-cactus-2":{fill:C.isDark?"#58558c":"#c9c5f4"}})});var u=e(96540),i=e(22687);const x=-20,g=5,p=-5,c=5,y=({width:C="auto",height:S})=>{const O=(0,u.useRef)(null),I=(0,o.of)(P);return(0,u.useEffect)(()=>{const R=T=>{if(window.matchMedia("(prefers-reduced-motion: reduce").matches)return;const L=O.current?.querySelector("#grot-not-found-arm"),K=O.current?.querySelector("#grot-not-found-magnifier"),{clientX:A,clientY:W}=T,{innerWidth:N,innerHeight:w}=window,j=W/w,V=A/N,U=d(j,x,g),F=d(V,p,c);window.requestAnimationFrame(()=>{L?.setAttribute("style",`transform: rotate(${U}deg) translateX(${F}%)`),K?.setAttribute("style",`transform: rotate(${U}deg) translateX(${F}%)`)})};return window.addEventListener("mousemove",R),()=>{window.removeEventListener("mousemove",R)}},[]),(0,t.jsx)(r.default,{innerRef:O,src:i,className:I.svg,height:S,width:C})};y.displayName="GrotNotFound";const P=C=>({svg:(0,n.css)({"#grot-not-found-arm, #grot-not-found-magnifier":{transformOrigin:"center"}})}),d=(C,S,O)=>C*(O-S)+S;var D=e(9886);const b=({button:C,children:S,image:O,message:I,hideImage:R=!1,variant:T,role:L})=>{const K=(0,o.of)(v),A=O??E(T);return(0,t.jsx)(s.a,{paddingY:4,display:"flex",direction:"column",alignItems:"center",role:L,children:(0,t.jsxs)("div",{className:K.container,children:[!R&&A,(0,t.jsxs)(m.B,{direction:"column",alignItems:"center",children:[(0,t.jsx)(a.E,{variant:"h4",textAlignment:"center",children:I}),S&&(0,t.jsx)(a.E,{color:"secondary",textAlignment:"center",children:S})]}),C]})})};function E(C){switch(C){case"call-to-action":return(0,t.jsx)(f,{width:300});case"not-found":return(0,t.jsx)(y,{width:300});case"completed":return(0,t.jsx)(r.default,{src:D,width:300});default:throw new Error(`Unknown variant: ${C}`)}}const v=C=>({container:(0,n.css)({display:"flex",flexDirection:"column",alignItems:"center",gap:C.spacing(4),maxWidth:"600px"})})},36303:(ee,B,e)=>{"use strict";e.d(B,{Xc:()=>l,Xw:()=>a,tH:()=>m});var t=e(74848),n=e(96540),r=e(32631),o=e(34999),s=e(56297);class m extends n.PureComponent{constructor(){super(...arguments),this.state={error:null,errorInfo:null}}componentDidCatch(h,u){const i=this.props.errorLogger??r.P?.api?.pushError;i&&i(h),this.setState({error:h,errorInfo:u}),this.props.onError&&this.props.onError(h)}componentDidUpdate(h){const{dependencies:u,onRecover:i}=this.props;if(this.state.error&&u&&h.dependencies){for(let x=0;x<u.length;x++)if(u[x]!==h.dependencies[x]){this.setState({error:null,errorInfo:null}),i&&i();break}}}render(){const{children:h}=this.props,{error:u,errorInfo:i}=this.state;return h({error:u,errorInfo:i})}}class a extends n.PureComponent{static{this.defaultProps={title:"An unexpected error happened",style:"alertbox"}}render(){const{title:h,children:u,style:i,dependencies:x,errorLogger:g}=this.props;return(0,t.jsx)(m,{dependencies:x,errorLogger:g,children:({error:p,errorInfo:c})=>c?i==="alertbox"?(0,t.jsx)(o.F,{title:h||"",children:(0,t.jsxs)("details",{style:{whiteSpace:"pre-wrap"},children:[p&&p.toString(),(0,t.jsx)("br",{}),c.componentStack]})}):(0,t.jsx)(s.D,{title:h||"",error:p,errorInfo:c}):u})}}function l(f,h={}){const u=i=>(0,t.jsx)(a,{...h,children:(0,t.jsx)(f,{...i})});return u.displayName="WithErrorBoundary",u}},991:(ee,B,e)=>{"use strict";e.d(B,{y:()=>s});var t=e(74848),n=e(1906),r=e(7685),o=e(99887);const s=({featureState:a,tooltip:l})=>{const f=m(a);return(0,t.jsx)(o.E,{text:f.text,color:f.color,icon:f.icon,tooltip:l})};function m(a){switch(a){case n.Ay.alpha:return{text:"Alpha",icon:"exclamation-triangle",color:"orange"};case n.Ay.beta:return{text:"Beta",icon:"rocket",color:"blue"};case n.Ay.experimental:return{text:(0,r.t)("grafana-ui.feature-badge.experimental","Experimental"),icon:"exclamation-triangle",color:"orange"};case n.Ay.preview:return{text:(0,r.t)("grafana-ui.feature-badge.preview","Preview"),icon:"rocket",color:"blue"};case n.Ay.privatePreview:return{text:(0,r.t)("grafana-ui.feature-badge.private-preview","Private preview"),icon:"rocket",color:"blue"};case n.Ay.new:return{text:(0,r.t)("grafana-ui.feature-badge.new","New!"),icon:"rocket",color:"blue"}}}},40279:(ee,B,e)=>{"use strict";e.d(B,{gH:()=>g,wI:()=>y});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(96540),m=e(92940),a=e(47172),l=e(55386),f=e(63142),h=e(7685),u=e(34999),i=e(30703),x=e(48431);
12function g({options:E,children:v,readAs:C,onLoad:S,fileListRenderer:O,onFileRemove:I}){const[R,T]=(0,s.useState)([]),[L,K]=(0,s.useState)([]),A=(0,l.j_)("decbytes")(E?.maxSize?E?.maxSize:0),W=(0,s.useCallback)((te,Y)=>{T(Q=>Q.map(J=>(J.id===te.id&&Y(J),J)))},[]),N=(0,s.useCallback)((te,Y,Q)=>{let J=te.map(D);if(E?.multiple===!1?T(J):T(q=>[...q,...J]),_(Y),E?.onDrop)E.onDrop(te,Y,Q);else for(const q of J){const X=new FileReader,se=()=>{C?X[C](q.file):X.readAsText(q.file)};W(q,oe=>{oe.abortUpload=()=>{X.abort()},oe.retryUpload=()=>{W(q,ae=>{ae.error=null,ae.progress=void 0}),se()}}),X.onabort=()=>{W(q,oe=>{oe.error=new DOMException("Aborted")})},X.onprogress=oe=>{W(q,ae=>{ae.progress=oe.loaded})},X.onload=()=>{S?.(X.result)},X.onerror=()=>{W(q,oe=>{oe.error=X.error})},se()}},[S,E,C,W]),w=te=>{const Y=R.filter(Q=>te.id!==Q.id);T(Y),I?.(te)},{getRootProps:j,getInputProps:V,isDragActive:U}=(0,m.VB)({...E,useFsAccessApi:!1,onDrop:N,accept:c(E?.accept)}),F=(0,f.$j)(),M=b(F,U),H=R.map(te=>O?O(te,w):(0,t.jsx)(x.I,{file:te,removeFile:w},te.id)),_=te=>{let Y=[];te.map(Q=>{Q.errors.map(J=>{Y.findIndex(q=>q.code===J.code&&q.message===J.message)===-1&&Y.push(J)})}),K(Y)},Z=te=>{const Y=(0,l.cN)(A);return(0,t.jsx)("div",{className:M.errorAlert,children:(0,t.jsx)(u.F,{title:(0,h.t)("grafana-ui.file-dropzone.error-title","Upload failed"),severity:"error",onRemove:ne,children:te.map(Q=>{switch(Q.code){case a.O4.FileTooLarge:return(0,t.jsx)("div",{children:(0,t.jsxs)(h.x,{i18nKey:"grafana-ui.file-dropzone.file-too-large",children:["File is larger than ",{size:Y}]})},Q.message+Q.code);default:return(0,t.jsx)("div",{children:Q.message},Q.message+Q.code)}})})})},ne=()=>{K([])};return(0,t.jsxs)("div",{className:M.container,children:[(0,t.jsxs)("div",{"data-testid":"dropzone",...j({className:M.dropzone}),children:[(0,t.jsx)("input",{...V()}),v??(0,t.jsx)(y,{primaryText:P(R,E)})]}),L.length>0&&Z(L),(0,t.jsxs)("small",{className:(0,n.cx)(M.small,M.acceptContainer),children:[E?.maxSize&&`Max file size: ${(0,l.cN)(A)}`,E?.maxSize&&E?.accept&&(0,t.jsx)("span",{className:M.acceptSeparator,children:"|"}),E?.accept&&d(E.accept)]}),H]})}function p(E){return["txt","json","csv","xls","yml"].some(v=>E.match(v))?"text/plain":"application/octet-stream"}function c(E){return(0,r.isString)(E)?{[p(E)]:[E]}:Array.isArray(E)?E.reduce((v,C)=>{const S=p(C);return v[S]=v[S]?[...v[S],C]:[C],v},{}):E}function y({primaryText:E="Drop file here or click to upload",secondaryText:v=""}){const C=(0,f.$j)(),S=b(C);return(0,t.jsxs)("div",{className:(0,n.cx)(S.defaultDropZone),"data-testid":"file-drop-zone-default-children",children:[(0,t.jsx)(i.I,{className:(0,n.cx)(S.icon),name:"upload",size:"xl"}),(0,t.jsx)("h6",{className:(0,n.cx)(S.primaryText),children:E}),(0,t.jsx)("small",{className:S.small,children:v})]})}function P(E,v){return v?.multiple===void 0||v?.multiple?"Upload file":E.length?"Replace file":"Upload file"}function d(E){return(0,r.isString)(E)?`Accepted file type: ${E}`:Array.isArray(E)?`Accepted file types: ${E.join(", ")}`:`Accepted file types: ${Object.values(E).flat().join(", ")}`}function D(E){return{id:(0,r.uniqueId)("file"),file:E,error:null}}function b(E,v){return{container:(0,n.css)({display:"flex",flexDirection:"column",width:"100%",padding:E.spacing(2),borderRadius:E.shape.radius.default,border:`1px dashed ${E.colors.border.strong}`,backgroundColor:v?E.colors.background.secondary:E.colors.background.primary,cursor:"pointer",alignItems:"center",justifyContent:"center"}
12),dropzone:(0,n.css)({height:"100%",width:"100%",display:"flex",flexDirection:"column"}),defaultDropZone:(0,n.css)({textAlign:"center"}),icon:(0,n.css)({marginBottom:E.spacing(1)}),primaryText:(0,n.css)({marginBottom:E.spacing(1)}),acceptContainer:(0,n.css)({textAlign:"center",margin:0}),acceptSeparator:(0,n.css)({margin:`0 ${E.spacing(1)}`}),small:(0,n.css)({color:E.colors.text.secondary}),errorAlert:(0,n.css)({paddingTop:"10px"})}}},48431:(ee,B,e)=>{"use strict";e.d(B,{I:()=>u});var t=e(74848),n=e(22803),r=e(55386),o=e(63142),s=e(28473),m=e(7685),a=e(45861),l=e(30703),f=e(76319);const h="Remove file";function u({file:x,removeFile:g}){const p=(0,o.of)(i),{file:c,progress:y,error:P,abortUpload:d,retryUpload:D}=x,b=()=>P?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:p.error,children:P.message}),D&&(0,t.jsx)(f.K,{name:"sync",tooltip:(0,m.t)("grafana-ui.file-dropzone.item-retry","Retry"),tooltipPlacement:"top",onClick:D}),g&&(0,t.jsx)(f.K,{className:D?p.marginLeft:"",name:"trash-alt",onClick:()=>g(x),tooltip:h})]}):y&&c.size>y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("progress",{className:p.progressBar,max:c.size,value:y}),(0,t.jsxs)("span",{className:p.paddingLeft,children:[Math.round(y/c.size*100),"%"]}),d&&(0,t.jsx)(a.$n,{variant:"secondary",type:"button",fill:"text",onClick:d,children:(0,t.jsx)(m.x,{i18nKey:"grafana-ui.file-dropzone.cancel-upload",children:"Cancel upload"})})]}):g&&(0,t.jsx)(f.K,{name:"trash-alt",onClick:()=>g(x),tooltip:h,tooltipPlacement:"top"}),E=(0,r.j_)("decbytes")(c.size);return(0,t.jsxs)("div",{className:p.fileListContainer,children:[(0,t.jsxs)("span",{className:p.fileNameWrapper,children:[(0,t.jsx)(l.I,{name:"file-blank",size:"lg","aria-hidden":!0}),(0,t.jsx)("span",{className:p.padding,children:(0,s.i)(c.name)}),(0,t.jsx)("span",{children:(0,r.cN)(E)})]}),(0,t.jsx)("div",{className:p.fileNameWrapper,children:b()})]})}function i(x){return{fileListContainer:(0,n.css)({width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:x.spacing(2),border:`1px dashed ${x.colors.border.medium}`,backgroundColor:`${x.colors.background.secondary}`,marginTop:x.spacing(1)}),fileNameWrapper:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"center"}),padding:(0,n.css)({padding:x.spacing(0,1)}),paddingLeft:(0,n.css)({paddingLeft:x.spacing(2)}),marginLeft:(0,n.css)({marginLeft:x.spacing(1)}),error:(0,n.css)({paddingRight:x.spacing(2),color:x.colors.error.text}),progressBar:(0,n.css)({borderRadius:x.shape.radius.default,height:"4px","::-webkit-progress-bar":{backgroundColor:x.colors.border.weak,borderRadius:x.shape.radius.default},"::-webkit-progress-value":{backgroundColor:x.colors.primary.main,borderRadius:x.shape.radius.default}})}}},12737:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>f});var t=e(74848),n=e(96540),r=e(8934),o=e(7685);function s(...h){const u=n.useRef(null);return n.useEffect(()=>{h.forEach(i=>{i&&(typeof i=="function"?i(u.current):i.current=u.current)})},[h]),u}var m=e(45861),a=e(30703),l=e(63527);const f=(0,n.forwardRef)(({value:h,width:u,onChange:i,escapeRegex:x=!0,...g},p)=>{const c=(0,n.useRef)(null),y=s(p,c),P=h!==""?(0,t.jsx)(m.$n,{icon:"times",fill:"text",size:"sm",onClick:d=>{c.current?.focus(),i(""),d.stopPropagation()},children:(0,t.jsx)(o.x,{i18nKey:"grafana-ui.filter-input.clear",children:"Clear"})}):null;return(0,t.jsx)(l.p,{prefix:(0,t.jsx)(a.I,{name:"search"}),suffix:P,width:u,type:"text",value:x?(0,r.xb)(h??""):h,onChange:d=>i(x?(0,r.jD)(d.currentTarget.value):d.currentTarget.value),...g,ref:y})});f.displayName="FilterInput"},34343:(ee,B,e)=>{"use strict";e.d(B,{m:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(45861),s=e(30703);const m=({label:l,selected:f,onClick:h,icon:u="check"})=>{const i=(0,r.of)(a),x=(0,r.of)(o.my);return(0,t.jsxs)("button",{type:"button",className:(0,n.cx)(x,i.wrapper,f&&i.selected),onClick:h,children:[(0,t.jsx)("span",{children:l}),f&&(0,t.jsx)(s.I,{name:u,className:i.icon})]})},a=l=>({wrapper:(0,n.css)({background:l.colors.background.secondary,borderRadius:l.shape.radius.pill,padding:l.spacing(0,2),fontSize:l.typography.bodySmall.fontSize,fontWeight:l.typography.fontWeightMedium,lineHeight:l.typography.bodySmall.lineHeight,color:l.colors.text.secondary,display:"flex",alignItems:"center",height:"32px",position:"relative",border:`1px solid ${l.colors.background.secondary}`,whiteSpace:"nowrap","&:hover":{background:l.colors.action.hover,color:l.colors.text.primary}}),selected:(0,n.css)({color:l.colors.text.primary,background:l.colors.action.selected,"&:hover":{background:l.colors.action.focus}}),icon:(0,n.css)({marginLeft:l.spacing(.5)})})},94959:(ee,B,e)=>{"use strict";e.d(B,{z:()=>o});var t=e(74848),n=e(22803),r=e(51115);
12const o=({label:m,tooltip:a,labelWidth:l=6,inputWidth:f=12,inputEl:h,className:u,interactive:i,...x})=>{const g=s();return(0,t.jsxs)("div",{className:(0,n.cx)(g.formField,u),children:[(0,t.jsx)(r.I,{width:l,tooltip:a,interactive:i,children:m}),h||(0,t.jsx)("input",{type:"text",className:`gf-form-input ${f?`width-${f}`:""}`,...x,disabled:x.disabled})]})};o.displayName="FormField";const s=()=>({formField:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative"})})},51115:(ee,B,e)=>{"use strict";e.d(B,{I:()=>a});var t=e(74848),n=e(46942),r=e.n(n),o=e(30703),s=e(45967);const a=({children:l,isFocused:f,isInvalid:h,className:u,htmlFor:i,tooltip:x,width:g,interactive:p,...c})=>{const y=r()(u,`gf-form-label width-${g||"10"}`,{"gf-form-label--is-focused":f,"gf-form-label--is-invalid":h});return(0,t.jsxs)("label",{className:y,...c,htmlFor:i,children:[l,x&&(0,t.jsx)(s.m,{placement:"top",content:x,theme:"info",interactive:p,children:(0,t.jsx)(o.I,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}})})]})}},21539:(ee,B,e)=>{"use strict";e.d(B,{i:()=>r});var t=e(74848);function n(o){return o<20?.9:o<26?.8:.6}const r=({value:o,className:s,style:m,...a})=>{const l=(o.prefix??"").length>0,f=(o.suffix??"").length>0;let h;if(m&&typeof m.fontSize=="number"&&!Number.isNaN(m.fontSize)){const u=m.fontSize,i=n(u);h={fontSize:u*i}}return(0,t.jsx)("div",{className:s,style:m,...a,children:(0,t.jsxs)("div",{children:[l&&(0,t.jsx)("span",{children:o.prefix}),(0,t.jsx)("span",{children:o.text}),f&&(0,t.jsx)("span",{style:h,children:o.suffix})]})})};r.displayName="FormattedDisplayValue"},32635:(ee,B,e)=>{"use strict";e.d(B,{S:()=>a});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(35484),m=e(72636);const a=r.forwardRef(({label:f,description:h,value:u,htmlValue:i,onChange:x,disabled:g,className:p,indeterminate:c,invalid:y,...P},d)=>{const D=(0,r.useCallback)(v=>{x&&x(v)},[x]),b=(0,o.of)(l,y),E=c?"mixed":void 0;return(0,t.jsxs)("label",{className:(0,n.cx)(b.wrapper,p),children:[(0,t.jsxs)("div",{className:b.checkboxWrapper,children:[(0,t.jsx)("input",{type:"checkbox",className:(0,n.cx)(b.input,c&&b.inputIndeterminate),checked:u,disabled:g,onChange:D,value:i,"aria-checked":E,...P,ref:d}),(0,t.jsx)("span",{className:b.checkmark})]}),f&&(0,t.jsx)("span",{className:b.label,children:f}),h&&(0,t.jsx)("span",{className:b.description,children:h})]})}),l=(f,h=!1)=>{const u=(0,m.f)(f),i=2,x=1,g=p=>h?f.colors.error.border:p;return{wrapper:(0,n.css)({display:"inline-grid",alignItems:"center",columnGap:f.spacing(x),gridAutoRows:"max-content",position:"relative",verticalAlign:"middle"}),input:(0,n.css)({position:"absolute",zIndex:1,top:0,left:0,width:"100% !important",height:"100%",opacity:0,"&:focus + span, &:focus-visible + span":(0,s.getFocusStyles)(f),"&:focus:not(:focus-visible) + span":(0,s.getMouseFocusStyles)(f),"&:checked + span":{background:f.colors.primary.main,border:`1px solid ${g(f.colors.primary.main)}`,"&:hover":{background:f.colors.primary.shade},"&:after":{content:'""',position:"absolute",zIndex:2,left:f.spacing(.5),top:0,width:f.spacing(.75),height:f.spacing(1.5),border:`solid ${f.colors.primary.contrastText}`,borderWidth:"0 3px 3px 0",transform:"rotate(45deg)"}},"&:disabled + span":{backgroundColor:f.colors.action.disabledBackground,cursor:"not-allowed",border:`1px solid ${g(f.colors.action.disabledBackground)}`,"&:hover":{backgroundColor:f.colors.action.disabledBackground},"&:after":{borderColor:f.colors.action.disabledText}}}),inputIndeterminate:(0,n.css)({"&[aria-checked='mixed'] + span":{border:`1px solid ${g(f.colors.primary.main)}`,background:f.colors.primary.main,"&:hover":{background:f.colors.primary.shade},"&:after":{content:'""',position:"absolute",zIndex:2,left:"2px",right:"2px",top:"calc(50% - 1.5px)",height:"3px",border:`1.5px solid ${f.colors.primary.contrastText}`,backgroundColor:f.colors.primary.contrastText,width:"auto",transform:"none"}},"&:disabled[aria-checked='mixed'] + span":{backgroundColor:f.colors.action.disabledBackground,border:`1px solid ${g(f.colors.error.transparent)}`,"&:after":{borderColor:f.colors.action.disabledText}}}),checkboxWrapper:(0,n.css)({display:"flex",alignItems:"center",gridColumnStart:1,gridRowStart:1}),checkmark:(0,n.css)({position:"relative",zIndex:2,display:"inline-block",width:f.spacing(i),height:f.spacing(i),borderRadius:f.shape.radiu
12s.default,background:f.components.input.background,border:`1px solid ${g(f.components.input.borderColor)}`,"&:hover":{cursor:"pointer",borderColor:g(f.components.input.borderHover)}}),label:(0,n.cx)(u.label,(0,n.css)({gridColumnStart:2,gridRowStart:1,position:"relative",zIndex:2,cursor:"pointer",maxWidth:"fit-content",lineHeight:f.typography.bodySmall.lineHeight,marginBottom:0})),description:(0,n.cx)(u.description,(0,n.css)({gridColumnStart:2,gridRowStart:2,lineHeight:f.typography.bodySmall.lineHeight,marginTop:0,zIndex:1}))}};a.displayName="Checkbox"},37386:(ee,B,e)=>{"use strict";e.d(B,{D:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(44019),m=e(12594),a=e(72636);const l=r.forwardRef(({label:u,description:i,horizontal:x,invalid:g,loading:p,disabled:c,required:y,error:P,children:d,className:D,validationMessageHorizontalOverflow:b,htmlFor:E,...v},C)=>{const S=(0,o.of)(h),O=E??(0,s.getChildId)(d),I=typeof u=="string"?(0,t.jsx)(a.J,{htmlFor:O,description:i,children:`${u}${y?" *":""}`}):u,R=f({invalid:g,disabled:c,loading:p});return(0,t.jsxs)("div",{className:(0,n.cx)(S.field,x&&S.fieldHorizontal,D),...v,children:[I,(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{ref:C,children:r.cloneElement(d,R)}),g&&P&&!x&&(0,t.jsx)("div",{className:(0,n.cx)(S.fieldValidationWrapper,{[S.validationMessageHorizontalOverflow]:!!b}),children:(0,t.jsx)(m.P,{children:P})})]}),g&&P&&x&&(0,t.jsx)("div",{className:(0,n.cx)(S.fieldValidationWrapper,S.fieldValidationWrapperHorizontal,{[S.validationMessageHorizontalOverflow]:!!b}),children:(0,t.jsx)(m.P,{children:P})})]})});l.displayName="Field";function f(u){for(const i in u)u[i]===void 0&&delete u[i];return u}const h=u=>({field:(0,n.css)({display:"flex",flexDirection:"column",marginBottom:u.spacing(2)}),fieldHorizontal:(0,n.css)({flexDirection:"row",justifyContent:"space-between",flexWrap:"wrap"}),fieldValidationWrapper:(0,n.css)({marginTop:u.spacing(.5)}),fieldValidationWrapperHorizontal:(0,n.css)({flex:"1 1 100%"}),validationMessageHorizontalOverflow:(0,n.css)({width:0,overflowX:"visible","& > *":{whiteSpace:"nowrap"}})})},16780:(ee,B,e)=>{"use strict";e.d(B,{n:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(53487);const s=({label:a,children:l,className:f,...h})=>{const u=(0,r.of)(m);return(0,t.jsxs)("fieldset",{className:(0,n.cx)(u.wrapper,f),...h,children:[a&&(0,t.jsx)(o.s,{children:a}),l]})},m=a=>({wrapper:(0,n.css)({marginBottom:a.spacing(4),"&:last-child":{marginBottom:0}})})},12594:(ee,B,e)=>{"use strict";e.d(B,{P:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(30703);const s=({children:a,horizontal:l,className:f})=>{const h=(0,r.of)(m),u=(0,n.cx)(l?h.horizontal:h.vertical,f);return(0,t.jsxs)("div",{role:"alert",className:u,children:[(0,t.jsx)(o.I,{className:h.fieldValidationMessageIcon,name:"exclamation-triangle"}),a]})},m=a=>{const l=` 13 font-size: ${a.typography.size.sm}; 14 font-weight: ${a.typography.fontWeightMedium}; 15 padding: ${a.spacing(.5,1)}; 16 color: ${a.colors.error.contrastText}; 17 background: ${a.colors.error.main}; 18 border-radius: ${a.shape.radius.default}; 19 position: relative; 20 display: inline-block; 21 align-self: flex-start; 22 23 a { 24 color: ${a.colors.error.contrastText}; 25 text-decoration: underline; 26 } 27 28 a:hover { 29 text-decoration: none; 30 } 31 `;return{vertical:(0,n.css)(l,{margin:a.spacing(.5,0,0,0),"&:before":{content:'""',position:"absolute",left:"9px",top:"-5px",width:0,height:0,borderWidth:"0 4px 5px 4px",borderColor:`transparent transparent ${a.colors.error.main} transparent`,borderStyle:"solid"}}),horizontal:(0,n.css)(l,{marginLeft:"10px","&:before":{content:'""',position:"absolute",left:"-5px",top:"9px",width:0,height:0,borderWidth:"4px 5px 4px 0",borderColor:"transparent #e02f44 transparent transparent",borderStyle:"solid"}}),fieldValidationMessageIcon:(0,n.css)({marginRight:a.spacing()})}}},50426:(ee,B,e)=>{"use strict";e.d(B,{l:()=>s});var t=e(74848),n=e(22803),r=e(96540),o=e(49785);function s({defaultValues:m,onSubmit:a,validateOnMount:l=!1,validateFieldsOnMount:f,children:h,validateOn:u="onSubmit",maxWidth:i=600,...x}){const{handleSubmit:g,trigger:p,formState:c,...y}=(0,o.mN)({mode:u,defaultValues:m});return(0,r.useEffect)(()=>{l&&p(f)},[p,f,l]),(0,t.jsx)("form",{className:(0,n.css)({maxWidth:i!=="none"?i+"px":i,width:"100%"}),onSubmit:g(a),...x,children:h({errors:c.errors,formState:c,trigger:p,...y})})}},18027:(ee,B,e)=>{"use strict";e.d(B,{I:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(44019),m=e(12594),a=e(79233);const l=({children:h,label:u,tooltip:i,labelWidth:x="auto",invali
31d:g,loading:p,disabled:c,required:y,className:P,htmlFor:d,grow:D,shrink:b,error:E,transparent:v,interactive:C,validationMessageHorizontalOverflow:S,...O})=>{const I=(0,o.$j)(),R=f(I,D,b),T=d??(0,s.getChildId)(h),L=typeof u=="string"?(0,t.jsx)(a.c,{interactive:C,width:x,tooltip:i,htmlFor:T,transparent:v,children:`${u}${y?" *":""}`}):u;return(0,t.jsxs)("div",{className:(0,n.cx)(R.container,P),...O,children:[L,(0,t.jsxs)("div",{className:R.childContainer,children:[(0,r.cloneElement)(h,{invalid:g,disabled:c,loading:p}),g&&E&&(0,t.jsx)("div",{className:(0,n.cx)(R.fieldValidationWrapper,{[R.validationMessageHorizontalOverflow]:!!S}),children:(0,t.jsx)(m.P,{children:E})})]})]})};l.displayName="InlineField";const f=(h,u,i)=>({container:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative",flex:`${u?1:0} ${i?1:0} auto`,margin:`0 ${h.spacing(.5)} ${h.spacing(.5)} 0`}),childContainer:(0,n.css)({flex:`${u?1:0} ${i?1:0} auto`}),fieldValidationWrapper:(0,n.css)({marginTop:h.spacing(.5)}),validationMessageHorizontalOverflow:(0,n.css)({width:0,overflowX:"visible","& > *":{whiteSpace:"nowrap"}})})},97095:(ee,B,e)=>{"use strict";e.d(B,{C:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({children:m,className:a,...l})=>{const f=(0,r.of)(s);return(0,t.jsx)("div",{className:(0,n.cx)(f.container,a),...l,children:m})},s=m=>({container:(0,n.css)({label:"InlineFieldRow",display:"flex",flexDirection:"row",flexWrap:"wrap",alignContent:"flex-start",rowGap:m.spacing(.5)})})},79233:(ee,B,e)=>{"use strict";e.d(B,{c:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(30703),s=e(45967);const m=({children:l,className:f,tooltip:h,width:u,transparent:i,interactive:x,as:g="label",...p})=>{const c=(0,r.of)(a,i,u);return(0,t.jsxs)(g,{className:(0,n.cx)(c.label,f),...p,children:[l,h&&(0,t.jsx)(s.m,{interactive:x,placement:"top",content:h,theme:"info",children:(0,t.jsx)(o.I,{tabIndex:0,name:"info-circle",size:"sm",className:c.icon})})]})},a=(l,f=!1,h)=>({label:(0,n.css)({display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,padding:l.spacing(0,1),fontWeight:l.typography.fontWeightMedium,fontSize:l.typography.size.sm,backgroundColor:f?"transparent":l.colors.background.secondary,height:l.spacing(l.components.height.md),lineHeight:l.spacing(l.components.height.md),marginRight:l.spacing(.5),borderRadius:l.shape.radius.default,border:"none",width:h?h!=="auto"?`${8*h}px`:h:"100%",color:l.colors.text.primary}),icon:(0,n.css)({color:l.colors.text.secondary,marginLeft:"10px",":hover":{color:l.colors.text.primary}})})},83871:(ee,B,e)=>{"use strict";e.d(B,{e:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({children:m,className:a,grow:l,...f})=>{const h=(0,r.of)(s,l);return(0,t.jsx)("div",{className:(0,n.cx)(h.container,a),...f,children:m})};o.displayName="InlineSegmentGroup";const s=(m,a)=>({container:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative",flex:`${a?1:0} 0 auto`,marginBottom:m.spacing(.5)})})},72636:(ee,B,e)=>{"use strict";e.d(B,{J:()=>s,f:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(30703);const s=({children:a,description:l,className:f,category:h,...u})=>{const i=(0,r.of)(m),x=h?.map((g,p)=>(0,t.jsxs)("span",{className:i.categories,children:[(0,t.jsx)("span",{children:g}),(0,t.jsx)(o.I,{name:"angle-right",className:i.chevron})]},`${g}/${p}`));return(0,t.jsx)("div",{className:(0,n.cx)(i.label,f),children:(0,t.jsxs)("label",{...u,children:[(0,t.jsxs)("div",{className:i.labelContent,children:[x,a]}),l&&(0,t.jsx)("span",{className:i.description,children:l})]})})},m=a=>({label:(0,n.css)({label:"Label",fontSize:a.typography.size.sm,fontWeight:a.typography.fontWeightMedium,lineHeight:1.25,marginBottom:a.spacing(.5),color:a.colors.text.primary,maxWidth:"480px"}),labelContent:(0,n.css)({display:"flex",alignItems:"center"}),description:(0,n.css)({label:"Label-description",color:a.colors.text.secondary,fontSize:a.typography.size.sm,fontWeight:a.typography.fontWeightRegular,marginTop:a.spacing(.25),display:"block"}),categories:(0,n.css)({label:"Label-categories",display:"inline-flex",alignItems:"center"}),chevron:(0,n.css)({margin:a.spacing(0,.25)})})},32581:(ee,B,e)=>{"use strict";e.d(B,{O:()=>m,p:()=>a});var t=e(74848),n=e(46942),r=e.n(n),o=e(96540),s=e(75745),m=(l=>(l.Invalid="invalid",l.Valid="valid",l))(m||{});class a extends o.PureComponent{constructor(){super(...arguments),this.state={error:null},this.validatorAsync=f=>h=>{const u=(0,s.tf)(h.target.value,f);this.setState(i=>({...i,error:u?u[0]:null}))},this.populateEventPropsWithStatus=(f,h)=>{const u={...f};
31return h&&Object.keys(s.Pw).forEach(i=>{((0,s.K)(i,h)||f[i])&&(u[i]=async x=>{x.persist(),(0,s.K)(i,h)&&await this.validatorAsync(h[i]).apply(this,[x]),f[i]&&f[i].apply(null,[x,this.status])})}),u}}static{this.defaultProps={className:""}}get status(){return this.state.error?"invalid":"valid"}get isInvalid(){return this.status==="invalid"}render(){const{validationEvents:f,className:h,hideErrorMessage:u,inputRef:i,...x}=this.props,{error:g}=this.state,p=r()("gf-form-input",{invalid:this.isInvalid},h),c=this.populateEventPropsWithStatus(x,f);return(0,t.jsxs)("div",{style:{flexGrow:1},children:[(0,t.jsx)("input",{...c,ref:i,className:p}),g&&!u&&(0,t.jsx)("span",{children:g})]})}}},53487:(ee,B,e)=>{"use strict";e.d(B,{s:()=>s});var t=e(74848),n=e(22803),r=e(63142);const o=m=>({legend:(0,n.css)({fontSize:m.typography.h3.fontSize,fontWeight:m.typography.fontWeightRegular,margin:m.spacing(0,0,2,0)})}),s=({children:m,className:a,...l})=>{const f=(0,r.of)(o);return(0,t.jsx)("legend",{className:(0,n.cx)(f.legend,a),...l,children:m})}},77824:(ee,B,e)=>{"use strict";e.d(B,{z:()=>p});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(30360),m=e(63142),a=e(30703),l=e(85629),f=e(35484),h=e(45967),u=e(3343);const i=2,x=o.forwardRef(({children:y,active:P=!1,disabled:d=!1,size:D="md",onChange:b,onClick:E,id:v,name:C=void 0,description:S,fullWidth:O,"aria-label":I},R)=>{const T=(0,m.of)(g,D,O),L=(0,t.jsx)("input",{type:"radio",className:T.radio,onChange:b,onClick:E,disabled:d,id:v,checked:P,name:C,"aria-label":I,ref:R});return S?(0,t.jsxs)("div",{className:T.radioOption,"data-testid":l.Tp.components.RadioButton.container,children:[(0,t.jsx)(h.m,{content:S,placement:"bottom",children:L}),(0,t.jsx)("label",{className:T.radioLabel,htmlFor:v,title:S||I,children:y})]}):(0,t.jsxs)("div",{className:T.radioOption,"data-testid":l.Tp.components.RadioButton.container,children:[L,(0,t.jsx)("label",{className:T.radioLabel,htmlFor:v,title:S||I,children:y})]})});x.displayName="RadioButton";const g=(y,P,d)=>{const{fontSize:D,height:b,padding:E}=(0,u.SM)(P,y),v=y.colors.text.secondary,C=y.colors.text.primary,S=b*y.spacing.gridSize-4-2;return{radioOption:(0,n.css)({display:"flex",justifyContent:"space-between",position:"relative",flex:d?"1 0 0":"none",textAlign:"center"}),radio:(0,n.css)({position:"absolute",opacity:0,zIndex:2,width:"100% !important",height:"100%",cursor:"pointer","&:checked + label":{color:y.colors.text.primary,fontWeight:y.typography.fontWeightMedium,background:y.colors.action.selected,zIndex:1},"&:focus + label, &:focus-visible + label":(0,f.getFocusStyles)(y),"&:focus:not(:focus-visible) + label":(0,f.getMouseFocusStyles)(y),"&:disabled + label":{color:y.colors.text.disabled,cursor:"not-allowed"}}),radioLabel:(0,n.css)({display:"flex",alignItems:"center",justifyContent:"center",fontSize:D,height:`${S}px`,lineHeight:`${S}px`,color:v,padding:y.spacing(0,E),borderRadius:(0,f.getInternalRadius)(y,i),background:y.colors.background.primary,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",flexGrow:1,"&:hover":{color:C}})}};function p({options:y,value:P,onChange:d,onClick:D,disabled:b,disabledOptions:E,size:v="md",id:C,className:S,fullWidth:O=!1,autoFocus:I=!1,"aria-label":R,invalid:T=!1}){const L=(0,o.useCallback)(j=>()=>{d&&d(j.value)},[d]),K=(0,o.useCallback)(j=>()=>{D&&D(j.value)},[D]),A=C??(0,r.uniqueId)("radiogroup-"),W=(0,o.useRef)(A),N=(0,m.of)(c),w=(0,o.useRef)(null);return(0,o.useEffect)(()=>{I&&w.current&&w.current.focus()},[I]),(0,t.jsx)("div",{role:"radiogroup","aria-label":R,className:(0,n.cx)(N.radioGroup,O&&N.fullWidth,T&&N.invalid,S),children:y.map((j,V)=>{const U=E&&j.value&&E.includes(j.value),F=j.icon?(0,s.Uo)(j.icon):void 0,M=!!(j.imgUrl||j.label||j.component);return(0,t.jsxs)(x,{size:v,disabled:U||b,active:P===j.value,"aria-label":j.ariaLabel,onChange:L(j),onClick:K(j),id:`option-${j.value}-${A}`,name:W.current,description:j.description,fullWidth:O,ref:P===j.value?w:void 0,children:[F&&(0,t.jsx)(a.I,{name:F,className:(0,n.cx)(M&&N.icon)}),j.imgUrl&&(0,t.jsx)("img",{src:j.imgUrl,alt:j.label,className:N.img}),j.label," ",j.component?(0,t.jsx)(j.component,{}):null]},`o.label-${V}`)})})}p.displayName="RadioButtonGroup";const c=y=>({radioGroup:(0,n.css)({backgroundColor:y.colors.background.primary,display:"inline-flex",flexDirection:"row",flexWrap:"nowrap",border:`1px solid ${y.components.input.borderColor}
31`,borderRadius:y.shape.radius.default,padding:i,"&:hover":{borderColor:y.components.input.borderHover}}),fullWidth:(0,n.css)({display:"flex",flexGrow:1}),icon:(0,n.css)({marginRight:"6px"}),img:(0,n.css)({width:y.spacing(2),height:y.spacing(2),marginRight:y.spacing(1)}),invalid:(0,n.css)({border:`1px solid ${y.colors.error.border}`})})},45450:(ee,B,e)=>{"use strict";e.d(B,{J:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({id:m,name:a,label:l,checked:f,value:h,disabled:u,description:i,onChange:x,...g})=>{const p=(0,r.of)(s);return(0,t.jsxs)("label",{title:i,className:p.label,children:[(0,t.jsx)("input",{...g,id:m,name:a,type:"radio",checked:f,value:h,disabled:u,className:p.input,onChange:()=>x&&x(m)}),(0,t.jsxs)("div",{children:[l,i&&(0,t.jsx)("div",{className:p.description,children:i})]})]})},s=m=>({input:(0,n.css)({position:"relative",appearance:"none",outline:"none",backgroundColor:m.colors.background.canvas,width:`${m.spacing(2)} !important`,height:m.spacing(2),border:`1px solid ${m.colors.border.medium}`,borderRadius:m.shape.radius.circle,cursor:"pointer",margin:"3px 0",":checked":{backgroundColor:m.v1.palette.white,border:`5px solid ${m.colors.primary.main}`},":disabled":{backgroundColor:`${m.colors.action.disabledBackground} !important`,borderColor:m.colors.border.weak},":disabled:checked":{border:`1px solid ${m.colors.border.weak}`},":disabled:checked::after":{content:'""',width:"6px",height:"6px",backgroundColor:m.colors.text.disabled,borderRadius:m.shape.radius.circle,display:"inline-block",position:"absolute",top:"4px",left:"4px"},":focus":{outline:"none !important",boxShadow:`0 0 0 1px ${m.colors.background.canvas}, 0 0 0 3px ${m.colors.primary.main}`}}),label:(0,n.css)({fontSize:m.typography.fontSize,lineHeight:"22px",display:"grid",gridTemplateColumns:`${m.spacing(2)} auto`,gap:m.spacing(1),cursor:"pointer"}),description:(0,n.css)({fontSize:m.typography.size.sm,color:m.colors.text.secondary})})},16203:(ee,B,e)=>{"use strict";e.d(B,{a:()=>a});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(63142),m=e(45450);function a({name:f,id:h,options:u,value:i,onChange:x,className:g,disabled:p,disabledOptions:c=[]}){const y=(0,s.of)(l),P=h??(0,r.uniqueId)("radiogroup-list-");return(0,t.jsx)("div",{id:h,className:(0,n.cx)(y.container,g),role:"radiogroup",children:u.map((d,D)=>{const b=`${P}-${D}`,E=i&&i===d.value,v=p||c.some(S=>S===d.value),C=()=>x&&d.value&&x(d.value);return(0,t.jsx)(m.J,{id:b,name:f,label:d.label,description:d.description,checked:E,value:d.value,disabled:v,onChange:C},D)})})}const l=f=>({container:(0,n.css)({display:"grid",gap:f.spacing(1)})})},18627:(ee,B,e)=>{"use strict";e.d(B,{_:()=>c});var t=e(74848),n=e(34796),r=e.n(n),o=e(96540),s=e(55386),m=e(48588),a=e(33553),l=e(739),f=e(53568),h=e(45861),u=e(64394),i=e(36394);const x={mode:a.O.Absolute,steps:[{value:-1/0,color:"green"},{value:80,color:"red"}]};function g(y,P,d,D){const b=d!=null,E=D===l.wV.Vertical?P:y,v=Math.min(E*.15/1.5,20),C=v*1.5,S=b?P-C:P,O=Math.min(S,y);return{showLabel:b,gaugeHeight:O,titleFontSize:v}}function p(y,P,d,D){if(P.color?.mode!==u.Y.Thresholds)return[{value:P.min??m.tw,color:d.color??u.F}];const b=P.thresholds??x,E=b.mode===a.O.Percentage,v=b.steps;let C=P.min??m.tw,S=P.max??m.d1;E&&(C=0,S=100);const O=(0,i.yQ)(C,v),I=(0,i.yQ)(S,v),R=[{value:+C.toFixed(y),color:D.visualization.getColorByName(O.color)}];let T=!0;for(let L=0;L<v.length;L++){const K=v[L];if(T){O===K&&(T=!1);continue}const A=v[L-1];if(R.push({value:K.value,color:D.visualization.getColorByName(A.color)}),K===I)break}return R.push({value:+S.toFixed(y),color:D.visualization.getColorByName(I.color)}),R}class c extends o.PureComponent{constructor(){super(...arguments),this.canvasElement=null,this.renderVisualization=()=>{const{width:P,value:d,height:D,onClick:b,text:E,theme:v,orientation:C}=this.props,S=g(P,D,d.title,C),O=C===l.wV.Vertical?`${S.gaugeHeight}px`:"100%",I=(0,t.jsx)("div",{style:{height:`${S.gaugeHeight}px`,width:O},ref:R=>this.canvasElement=R});return(0,t.jsxs)(t.Fragment,{children:[b?(0,t.jsx)("button",{className:(0,h.my)(v),type:"button",onClick:b,children:I}):I,S.showLabel&&(0,t.jsx)("div",{style:{textAlign:"center",fontSize:E?.titleSize??S.titleFontSize,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",position:"relative",width:O,top:"-4px",cursor:"default"},children:d.title})]})}}static{this.defaultProps={showThresholdMarkers:!0,showThresholdLabels:!1,field:{min:0,max:100,thresholds:x}}}componentDidMount(){this.draw()}componentDidUpdate(){this.draw()}draw(){const{field:P,showThresholdLabels:d,showThresholdMarkers:D,width:b,height:E,theme:v,value:C,orientation:S}=this.props,O=g(b,E,C.title),I=S===l.wV.Vertical?O.gaugeHeight:b,R=Math.min(I,O.gaugeHeight),T=v.colors.background.secondary,L=d?1.5:1,K=Math.min(R/5.5,40)/L,A=K/5,W=(0,s.cN)(C),w=Math.min(I,R*1.3)*.9-((K+(D?A:0)+(d?10:0))*2+10),j=this.props.text?.valueSize??(0,f.Vr)(W,w,R,
311,K*1.7),V=Math.max(j/2.5,12);let U=P.min??m.tw,F=P.max??m.d1,M=C.numeric;P.thresholds?.mode===a.O.Percentage&&(U=0,F=100,C.percent===void 0?M=(M-U)/(F-U)*100:M=C.percent*100);const H=P.decimals===void 0?2:P.decimals;D&&(U=+U.toFixed(H),F=+F.toFixed(H));const _={series:{gauges:{gauge:{min:U,max:F,neutralValue:P.custom?.neutral,background:{color:T},border:{color:null},shadow:{show:!1},width:K},frame:{show:!1},label:{show:!1},layout:{margin:0,thresholdWidth:0,vMargin:0},cell:{border:{width:0}},threshold:{values:p(H,P,C,v),label:{show:d,margin:A+1,font:{size:V}},show:D,width:A},value:{color:C.color,formatter:()=>W,font:{size:j,family:v.typography.fontFamily}},show:!0}}},Z={data:[[0,M]],label:C.title};try{this.canvasElement&&r().plot(this.canvasElement,[Z],_)}catch(ne){console.error("Gauge rendering error",ne,_,C)}}render(){return(0,t.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",overflow:"hidden"},className:this.props.className,children:this.renderVisualization()})}}},79331:(ee,B,e)=>{"use strict";e.d(B,{w:()=>a});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(34999),m=e(30703);const a=r.memo(r.forwardRef(({title:f,className:h,children:u,branded:i,url:x,urlTitle:g,onDismiss:p,severity:c="info",...y},P)=>{const d=(0,o.of)(l);return(0,t.jsxs)(s.F,{severity:c,className:h,...y,ref:P,title:f,children:[(0,t.jsx)("div",{children:u}),x&&(0,t.jsxs)("a",{href:x,className:(0,n.cx)("external-link",d.docsLink),target:"_blank",rel:"noreferrer",children:[(0,t.jsx)(m.I,{name:"book"})," ",g||"Read more"]})]})}));a.displayName="InfoBox";const l=f=>({docsLink:(0,n.css)({display:"inline-block",marginTop:f.spacing(2)})})},53371:(ee,B,e)=>{"use strict";e.d(B,{r:()=>h});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(96540),a=e(63142),l=e(30703),f=e(15245);function h({referenceElement:x,children:g,suffixIcon:p,placement:c}){const y=(0,a.of)(u),P=(0,a.$j)(),d=[(0,r.cY)(8),(0,r.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,r.BN)()],{context:D,refs:b,floatingStyles:E}=(0,o.we)({open:!0,placement:c,middleware:d,whileElementsMounted:s.ll,strategy:"fixed"});(0,m.useLayoutEffect)(()=>{b.setReference(x)},[x,b]);const{styles:v}=(0,o.DL)(D,{initial:({side:C})=>({opacity:0,transform:i(C,P)}),duration:P.transitions.duration.shortest});return(0,t.jsx)(f.ZL,{children:(0,t.jsx)("div",{style:{display:"inline-block",...E},ref:b.setFloating,"aria-live":"polite",children:(0,t.jsxs)("span",{className:(0,n.cx)(y.root),style:v,children:[g&&(0,t.jsx)("span",{children:g}),p&&(0,t.jsx)(l.I,{name:p})]})})})}const u=x=>({root:(0,n.css)({...x.typography.bodySmall,willChange:"transform",background:x.components.tooltip.background,color:x.components.tooltip.text,padding:x.spacing(.5,1.5),borderRadius:x.shape.radius.pill,display:"inline-flex",gap:x.spacing(.5),alignItems:"center"})}),i=(x,g)=>{switch(x){case"top":return`translateY(${g.spacing(1)})`;case"bottom":return`translateY(-${g.spacing(1)})`;case"left":return`translateX(${g.spacing(1)})`;case"right":return`translateX(-${g.spacing(1)})`}}},33033:(ee,B,e)=>{"use strict";e.d(B,{D:()=>m});var t=e(74848),n=e(96540),r=e(53568),o=e(74660),s=e(63527);const m=n.forwardRef((f,h)=>{const{defaultValue:u="",minWidth:i=10,maxWidth:x,onCommitChange:g,onChange:p,onKeyDown:c,onBlur:y,value:P,placeholder:d,...D}=f,[b,E]=l(P,p),v=b??u,C=(0,n.useMemo)(()=>{const S=v||d||"",O=typeof S=="string"?S:S.toString();return a(O,i,x)},[d,v,i,x]);return(0,t.jsx)(o.W.Provider,{value:!0,children:(0,t.jsx)(s.p,{"data-testid":"autosize-input",...D,placeholder:d,ref:h,value:v.toString(),onChange:S=>{p&&p(S),E(S.currentTarget.value)},width:C,onBlur:S=>{y?y(S):g&&g(S)},onKeyDown:S=>{c?c(S):S.key==="Enter"&&g&&g(S)}})})});function a(f,h,u){if(!f)return h;const x=(0,r.kD)(f.toString(),14).width/8+3;return h&&x<h?h:u&&x>u?u:x}m.displayName="AutoSizeInput";function l(f,h){const u=f!==void 0&&h!==void 0,i=(0,n.useRef)(u),x=(0,n.useRef)(!1);u!==i.current&&!x.current&&(console.warn("An AutoSizeInput is changing from an uncontrolled to a controlled input. If you want to control the input, the empty value should be an empty string."),x.current=!0);const[g,p]=n.useState(f);(0,n.useEffect)(()=>{i.current||p(f)},[f]);const c=(0,n.useCallback)(P=>{i.current||p(P)},[]);return[i.current?f:g,c]}},26987:(ee,B,e)=>{"use strict";e.d(B,{e:()=>n});var t=e(49785);const n=t.xI},27594:(ee,B,e)=>{"use strict";e.d(B,{j:()=>d});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(32885),m=e(28105),a=e(63142),l=e(30703),f=e(34213),h=e(45967),u=e(7685),i=e(76319);const x=(0,n.css)({display:"flex",alignItems:"center",height:"100%"});function g({row:v,__rowID:C}){return(0,t.jsx)("div",{className:x,children:(0,t.jsx)(i.K,{tooltip:(0,u.t)("grafana-ui.interactive-table.expand-row-tooltip","Toggle row expanded"),"aria-controls":C,name:v.isExpanded?"angle-down":"angle-right","aria-expanded":v.isExpanded,...v.getToggleRowExpandedProps(),size:"lg"})})}function p({isAllRowsExpanded:v,toggleAllRowsExpanded:C}){return(0,t.jsx)("div",{className:x,children:(0,t.jsx)(i.K,{"aria-label":v?"Collapse all rows":"Expand all rows",name:v?"table-collapse-
31all":"table-expand-all",onClick:()=>C(),size:"lg",tooltip:v?"Collapse all rows":"Expand all rows",variant:"secondary"})})}const c="__expander";function y(v,C=!1){return[{id:c,Cell:g,...C&&{Header:p},disableSortBy:!0,width:0},...v.map(S=>({id:S.id,accessor:S.id,Header:S.header||(()=>null),sortType:S.sortType||"alphanumeric",disableSortBy:!S.sortType,width:S.disableGrow?0:void 0,visible:S.visible,...S.cell&&{Cell:S.cell}}))]}const P=v=>{const C=v.colors.emphasize(v.colors.background.primary,.03);return{container:(0,n.css)({display:"flex",gap:v.spacing(2),flexDirection:"column",width:"100%",overflowX:"auto"}),cell:(0,n.css)({padding:v.spacing(1),minWidth:v.spacing(3)}),table:(0,n.css)({borderRadius:v.shape.radius.default,width:"100%"}),disableGrow:(0,n.css)({width:0}),header:(0,n.css)({borderBottom:`1px solid ${v.colors.border.weak}`,minWidth:v.spacing(3),"&, & > button":{position:"relative",whiteSpace:"nowrap",padding:v.spacing(1)},"& > button":{"&:after":{content:'"\\00a0"'},width:"100%",height:"100%",background:"none",border:"none",paddingRight:v.spacing(2.5),textAlign:"left",fontWeight:v.typography.fontWeightMedium}}),row:(0,n.css)({label:"row",borderBottom:`1px solid ${v.colors.border.weak}`,"&:hover":{backgroundColor:C},"&:last-child":{borderBottom:0}}),expandedRow:(0,n.css)({label:"expanded-row-content",borderBottom:"none"}),expandedContentCell:(0,n.css)({borderBottom:`1px solid ${v.colors.border.weak}`,position:"relative",padding:v.spacing(2,2,2,5),"&:before":{content:'""',position:"absolute",width:"1px",top:0,left:"16px",bottom:v.spacing(2),background:v.colors.border.medium}}),expandedContentRow:(0,n.css)({label:"expanded-row-content"}),sortableHeader:(0,n.css)({"&&":{padding:0}})}};function d({className:v,columns:C,data:S,getRowId:O,headerTooltips:I,pageSize:R=0,renderExpandedRow:T,showExpandAll:L=!1,fetchData:K,initialSortBy:A=[]}){const W=(0,a.of)(P),N=(0,o.useMemo)(()=>y(C,L),[C,L]),w=D(),j=(0,o.useCallback)(Y=>`${w}-${Y.id}`.replace(/\s/g,""),[w]),V=[s.useSortBy,s.useExpanded],U=S.length>R,F=R>0;F&&V.push(s.usePagination);const M=(0,s.useTable)({columns:N,data:S,autoResetExpanded:!1,autoResetSortBy:!1,disableMultiSort:!0,manualSortBy:!!K,getRowId:O,initialState:{hiddenColumns:[!T&&c,...N.filter(Y=>!(!Y.visible||Y.visible(S))).map(Y=>Y.id).filter(m.zz)].filter(m.zz),sortBy:A}},...V),{getTableProps:H,getTableBodyProps:_,headerGroups:Z,prepareRow:ne}=M,{sortBy:te}=M.state;return(0,o.useEffect)(()=>{K&&K({sortBy:te})},[te,K]),(0,o.useEffect)(()=>{F&&M.setPageSize(R)},[F,R,M.setPageSize,M]),(0,t.jsxs)("div",{className:W.container,children:[(0,t.jsxs)("table",{...H(),className:(0,n.cx)(W.table,v),children:[(0,t.jsx)("thead",{children:Z.map(Y=>{const{key:Q,...J}=Y.getHeaderGroupProps();return(0,t.jsx)("tr",{...J,children:Y.headers.map(q=>{const{key:X,...se}=q.getHeaderProps(),oe=I?.[q.id];return(0,t.jsx)("th",{className:(0,n.cx)(W.header,{[W.disableGrow]:q.width===0,[W.sortableHeader]:q.canSort}),...se,...q.isSorted&&{"aria-sort":q.isSortedDesc?"descending":"ascending"},children:(0,t.jsx)(E,{column:q,headerTooltip:oe})},X)})},Q)})}),(0,t.jsx)("tbody",{..._(),children:(F?M.page:M.rows).map(Y=>{ne(Y);const{key:Q,...J}=Y.getRowProps(),q=j(Y),X=Y.isExpanded;return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("tr",{...J,className:(0,n.cx)(W.row,X&&W.expandedRow),children:Y.cells.map(se=>{const{key:oe,...ae}=se.getCellProps();return(0,t.jsx)("td",{className:W.cell,...ae,children:se.render("Cell",{__rowID:q})},oe)})}),X&&T&&(0,t.jsx)("tr",{...J,id:q,className:W.expandedContentRow,children:(0,t.jsx)("td",{className:W.expandedContentCell,colSpan:Y.cells.length,children:T(Y.original)})})]},Q)})})]}),F&&U&&(0,t.jsx)("span",{children:(0,t.jsx)(f.d,{currentPage:M.state.pageIndex+1,numberOfPages:M.pageOptions.length,onNavigate:Y=>M.gotoPage(Y-1)})})]})}const D=()=>(0,o.useMemo)(()=>(0,r.uniqueId)("InteractiveTable"),[]),b=v=>({sortIcon:(0,n.css)({position:"absolute",top:v.spacing(1)}),headerTooltipIcon:(0,n.css)({marginLeft:v.spacing(.5)})});function E({column:{canSort:v,render:C,isSorted:S,isSortedDesc:O,getSortByToggleProps:I},headerTooltip:R}){const T=(0,a.of)(b),{onClick:L}=I(),K=(0,t.jsxs)(t.Fragment,{children:[C("Header"),R&&(0,t.jsx)(h.m,{theme:"info-alt",content:R.content,placement:"top-end",children:(0,t.jsx)(l.I,{className:T.headerTooltipIcon,name:R.iconName||"info-circle","data-testid":"header-tooltip-icon"})}),S&&(0,t.jsx)("span",{"aria-hidden":"true",className:T.sortIcon,children:(0,t.jsx)(l.I,{name:O?"angle-down":"angle-up"})})]});return v?(0,t.jsx)("button",{type:"button",onClick:L,children:K}):K}},50275:(ee,B,e)=>{"use strict";e.d(B,{B:()=>o});var t=e(74848),n=e(96540),r=e(22658);class o extends n.PureComponent{constructor(){super(...arguments),this.wrapperRef=(0,n.createRef)(),this.renderJson=()=>{const{json:m,config:a,open:l,onDidRender:f}=this.props,h=this.wrapperRef.current,u=new r.O(m,l,a);h.hasChildNodes()?h.replaceChild(u.render(),h.lastChild):h.appendChild(u.render()),f&&f(u.json)}}static{this.defaultProps={open:3,config:{animateOpen:!0}}}componentDidMount(){this.renderJson()}componentDidUpdate(){this.renderJson()}render(){const{className:m}=this.props;return(0,t.jsx)("div",{className:m,ref:this.wrapperRef})}}},22658:(ee,B,e)=>{"use strict";e.d(B,{O:()=>y});var t=e(2543);function n(P){return P.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function r(P){return!!P&&typeof P==="object"}function o(P){if(P===void 0)return"";if(P===null||typeof P=="object"&&!P.constructor)return"Object";const D=/function ([^(]*)/.exec(P.constructor.toString());return D&&D.length>1?D[1]:""}function s(P){return P===null?"null":typeof P}function m(P,d){const D=s(P);
31return D==="null"||D==="undefined"?D:(D==="string"&&(d='"'+n(d)+'"'),D==="function"?P.toString().replace(/[\r\n]/g,"").replace(/\{.*\}/,"")+"{\u2026}":d)}let a="";function l(P){return r(P)?(a=o(P),Array.isArray(P)&&(a+="["+P.length+"]")):a=m(P,P.toString()),a}function f(P){return`json-formatter-${P}`}function h(P,d,D){const b=document.createElement(P);return d&&b.classList.add(f(d)),D!==void 0&&(D instanceof Node?b.appendChild(D):b.appendChild(document.createTextNode(String(D)))),b}const u=/(^\d{1,4}[\.|\\/|-]\d{1,2}[\.|\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/,i=/\d{2}:\d{2}:\d{2} GMT-\d{4}/,x=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,g=10,p=typeof window<"u"&&window.requestAnimationFrame||(P=>(P(),0)),c={animateOpen:!0,animateClose:!0};class y{constructor(d,D=1,b=c,E){this.json=d,this.open=D,this.config=b,this.key=E,this._isOpen=null,this.element=null,this.skipChildren=!1}get isOpen(){return this._isOpen!==null?this._isOpen:this.open>0}set isOpen(d){this._isOpen=d}get isDate(){return this.type==="string"&&(u.test(this.json)||x.test(this.json)||i.test(this.json))}get isUrl(){return this.type==="string"&&this.json.indexOf("http")===0}get isArray(){return Array.isArray(this.json)}get isObject(){return r(this.json)}get isEmptyObject(){return!this.keys.length&&!this.isArray}get isEmpty(){return this.isEmptyObject||this.keys&&!this.keys.length&&this.isArray}get hasKey(){return typeof this.key<"u"}get constructorName(){return o(this.json)}get type(){return s(this.json)}get keys(){return this.isObject?Object.keys(this.json).map(d=>d||'""'):[]}toggleOpen(){this.isOpen=!this.isOpen,this.element&&(this.isOpen?this.appendChildren(this.config.animateOpen):this.removeChildren(this.config.animateClose),this.element.classList.toggle(f("open")))}openAtDepth(d=1){d<0||(this.open=d,this.isOpen=d!==0,this.element&&(this.removeChildren(!1),d===0?this.element.classList.remove(f("open")):(this.appendChildren(this.config.animateOpen),this.element.classList.add(f("open")))))}isNumberArray(){return this.json.length>0&&this.json.length<4&&((0,t.isNumber)(this.json[0])||(0,t.isNumber)(this.json[1]))}renderArray(){const d=h("span");return d.appendChild(h("span","bracket","[")),this.isNumberArray()?(this.json.forEach((D,b)=>{b>0&&d.appendChild(h("span","array-comma",",")),d.appendChild(h("span","number",D))}),this.skipChildren=!0):d.appendChild(h("span","number",this.json.length)),d.appendChild(h("span","bracket","]")),d}render(d=!1){this.element=h("div","row");const D=h("a","toggler-link"),b=h("span","toggler");if(this.isObject&&D.appendChild(b),this.hasKey&&D.appendChild(h("span","key",`${this.key}:`)),this.isObject){const v=h("span","value"),C=h("span"),S=h("span","constructor-name",this.constructorName);if(C.appendChild(S),this.isArray){const O=this.renderArray();C.appendChild(O)}v.appendChild(C),D.appendChild(v)}else{const v=this.isUrl?h("a"):h("span");v.classList.add(f(this.type)),this.isDate&&v.classList.add(f("date")),this.isUrl&&(v.classList.add(f("url")),v.setAttribute("href",this.json));const C=m(this.json,this.json);v.appendChild(document.createTextNode(C)),D.appendChild(v)}const E=h("div","children");return this.isObject&&E.classList.add(f("object")),this.isArray&&E.classList.add(f("array")),this.isEmpty&&E.classList.add(f("empty")),this.config&&this.config.theme&&this.element.classList.add(f(this.config.theme)),this.isOpen&&this.element.classList.add(f("open")),d||this.element.appendChild(D),this.skipChildren?D.removeChild(b):this.element.appendChild(E),this.isObject&&this.isOpen&&this.appendChildren(),this.isObject&&D.addEventListener("click",this.toggleOpen.bind(this)),this.element}appendChildren(d=!1){const D=this.element&&this.element.querySelector(`div.${f("children")}`);if(!(!D||this.isEmpty))if(d){let b=0;const E=()=>{const v=this.keys[b],C=new y(this.json[v],this.open-1,this.config,v);D.appendChild(C.render()),b+=1,b<this.keys.length&&(b>g?E():p(E))};p(E)}else this.keys.forEach(b=>{const E=new y(this.json[b],this.open-1,this.config,b);D.appendChild(E.render())})}removeChildren(d=!1){const D=this.element&&this.element.querySelector(`div.${f("children")}`);if(d){let b=0;const E=()=>{D&&D.children.length&&(D.removeChild(D.children[0]),b+=1,b>g?E():p(E))};p(E)}else D&&(D.innerHTML="")}}},13943:(ee,B,e)=>{"use strict";e.d(B,{x:()=>m});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(43990);const m=(0,r.forwardRef)((l,f)=>{const{alignItems:h,children:u,gap:i,rowGap:x,columnGap:g,columns:p,minColumnWidth:c,...y}=l,P=(0,o.of)(a,i,x,g,p,c,h);return(0,t.jsx)("div",{ref:f,...y,className:P.grid,children:u})});m.displayName="Grid";const a=(l,f,h,u,i,x,g)=>({grid:(0,n.css)([{display:"grid"},(0,s.Y)(l,f,p=>({gap:l.spacing(p)})),(0,s.Y)(l,h,p=>({rowGap:l.spacing(p)})),(0,s.Y)(l,u,p=>({columnGap:l.spacing(p)})),x&&(0,s.Y)(l,x,p=>({gridTemplateColumns:`repeat(auto-fill, minmax(${l.spacing(p)}, 1fr))`})),i&&(0,s.Y)(l,i,p=>({gridTemplateColumns:`repeat(${p}, 1fr)`})),(0,s.Y)(l,g,p=>({alignItems:p}))])})},32881:(ee,B,e)=>{"use strict";e.d(B,{Gy:()=>a,gW:()=>l,mc:()=>f});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=(x=>(x[x.Horizontal=0]="Horizontal",x[x.Vertical=1]="Vertical",x))(s||{});const m=({children:x,orientation:g=0,spacing:p="sm",justify:c="flex-start",align:y="normal",wrap:P=!1,width:d="100%",height:D="100%",...b})=>
31{const E=(0,o.of)(h,g,p,c,y,P);return(0,t.jsx)("div",{className:E.layout,style:{width:d,height:D},...b,children:r.Children.toArray(x).filter(Boolean).map((v,C)=>(0,t.jsx)("div",{className:E.childWrapper,children:v},C))})},a=({children:x,spacing:g,justify:p,align:c="center",wrap:y,width:P,height:d})=>(0,t.jsx)(m,{spacing:g,justify:p,orientation:0,align:c,width:P,height:d,wrap:y,children:x}),l=({children:x,spacing:g,justify:p,align:c,width:y,height:P})=>(0,t.jsx)(m,{spacing:g,justify:p,orientation:1,align:c,width:y,height:P,children:x}),f=({children:x,padding:g,margin:p,grow:c,shrink:y})=>{const P=(0,o.of)(i,g,p);return(0,t.jsx)("div",{className:(0,n.cx)(P.wrapper,c!==void 0&&(0,n.css)({flexGrow:c}),y!==void 0&&(0,n.css)({flexShrink:y})),children:x})},h=(x,g,p,c,y,P)=>{const d=p!=="none"?x.spacing(u[p]):0,D=g===0&&!P||g===1?0:`-${d}`,b=g===1?"vertical-group":"horizontal-group";return{layout:(0,n.css)({label:b,display:"flex",flexDirection:g===1?"column":"row",flexWrap:P?"wrap":"nowrap",justifyContent:c,alignItems:y,height:"100%",maxWidth:"100%",marginBottom:D}),childWrapper:(0,n.css)({label:"layoutChildrenWrapper",marginBottom:g===0&&!P?0:d,marginRight:g===0?d:0,display:"flex",alignItems:y,"&:last-child":{marginBottom:g===1?0:void 0,marginRight:g===0?0:void 0}})}},u={none:0,xs:.5,sm:1,md:2,lg:3},i=(x,g,p)=>{const c=g&&g!=="none"&&x.spacing(u[g])||0,y=p&&p!=="none"&&x.spacing(u[p])||0;return{wrapper:(0,n.css)({label:"container",margin:y,padding:c})}}},35137:(ee,B,e)=>{"use strict";e.d(B,{$:()=>r});var t=e(74848),n=e(31286);const r=({v:o=0,h:s=0,layout:m})=>(0,t.jsx)(n.a,{paddingRight:s,paddingBottom:o,display:m==="inline"?"inline-block":"block"})},20941:(ee,B,e)=>{"use strict";e.d(B,{N:()=>m});var t=e(74848),n=e(96540),r=e(35557),o=e(92138),s=e(63704);const m=(0,n.forwardRef)(({href:a,children:l,...f},h)=>{const u=o.I.stripBaseFromUrl(s.sQ.sanitizeUrl(a??""));return(0,t.jsx)(r.Link,{ref:h,to:u,...f,children:l})});m.displayName="Link"},89640:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(63704),s=e(92138),m=e(63142),a=e(30703),l=e(66969),f=e(20941);const h={h1:"xl",h2:"xl",h3:"lg",h4:"lg",h5:"md",h6:"md",body:"md",bodySmall:"xs"},u=(0,r.forwardRef)(({href:x,color:g="link",external:p=!1,inline:c=!0,variant:y="body",weight:P,icon:d,children:D,...b},E)=>{const v=o.sQ.sanitizeUrl(x??""),C=(0,m.$j)(),S=i(C,c,y,P,g),O=d||"external-link-alt";if(p)return(0,t.jsxs)("a",{href:v,ref:E,...b,target:"_blank",rel:"noreferrer",className:S,children:[D,(0,t.jsx)(a.I,{size:h[y]||"md",name:O})]});const I=s.I.stripBaseFromUrl(v);return(0,t.jsxs)(f.N,{ref:E,href:I,...b,className:S,children:[D,d&&(0,t.jsx)(a.I,{name:d,size:h[y]||"md"})]})});u.displayName="TextLink";const i=(x,g,p,c,y)=>(0,n.css)([p&&{...x.typography[p]},c&&{fontWeight:(0,l.iV)(c,x)},y&&{color:x.colors.text[y]},{alignItems:"center",gap:"0.25em",display:"inline-flex",textDecoration:"none","&:hover":{textDecoration:"underline",color:x.colors.text.link}},g&&{textDecoration:"underline","&:hover":{textDecoration:"none"}}])},46559:(ee,B,e)=>{"use strict";e.d(B,{p:()=>m});var t=e(74848),n=e(22803),r=e(96540),o=e(65240);const s=(0,o.N)((a=!1)=>({list:(0,n.css)({listStyleType:"none",margin:0,padding:0}),item:(0,n.css)({display:a&&"inline-block"||"block"})}));class m extends r.PureComponent{constructor(l){super(l)}render(){const{items:l,renderItem:f,getItemKey:h,className:u,inline:i}=this.props,x=s(i);return(0,t.jsx)("ul",{className:(0,n.cx)(x.list,u),children:l.map((g,p)=>(0,t.jsx)("li",{className:x.item,children:f(g,p)},h?h(g):p))})}}},34950:(ee,B,e)=>{"use strict";e.d(B,{c:()=>o});var t=e(74848),n=e(96540),r=e(46559);class o extends n.PureComponent{render(){return(0,t.jsx)(r.p,{inline:!0,...this.props})}}},5585:(ee,B,e)=>{"use strict";e.d(B,{B:()=>o});var t=e(74848),n=e(96540),r=e(46559);class o extends n.PureComponent{render(){return(0,t.jsx)(r.p,{...this.props})}}},47327:(ee,B,e)=>{"use strict";e.d(B,{G:()=>h});var t=e(74848),n=e(22803),r=e(63142);const o=28,s=2.4,m=500,a=4e3,l=300,f=100/o*100;function h({width:i,delay:x=l,ariaLabel:g="Loading bar"}){const p=Math.min(Math.max(Math.round(i*s),m),a),c=(0,r.of)(u,x,p),y={overflow:"hidden"};return(0,t.jsx)("div",{style:y,children:(0,t.jsx)("div",{"aria-label":g,className:c.bar})})}const u=(i,x,g)=>{const p=(0,n.keyframes)({"0%":{transform:"translateX(-100%)"},"85%, 100%":{transform:`translateX(${f}%)`}});return{bar:(0,n.css)({width:o+"%",height:1,background:`linear-gradient(90deg, transparent 0%, ${i.colors.primary.main} 80.75%, transparent 100%)`,transform:"translateX(-100%)",willChange:"transform",[i.transitions.handleMotion("no-preference")]:{animationName:p,animationDelay:`${x}ms`,animationTimingFunction:"linear",animationIterationCount:"infinite",animationDuration:`${g}ms`},[i.transitions.handleMotion("reduce")]:{animationName:p,animationDelay:`${x}ms`,animationTimingFunction:"linear",animationIterationCount:"infinite",animationDuration:`${4*g}ms`}})}}},48457:(ee,B,e)=>{"use strict";e.d(B,{O:()=>s});var t=e(74848),n=e(96540),r=e(18857),o=e(56755);
31const s=({value:m,onChange:a,context:l,item:f})=>{const h=f.settings??{},u=(0,o.sE)(l.data,h?.filter),i=(0,o.m3)(u,m,void 0,void 0,h.baseNameMode),x=(0,n.useCallback)(p=>{if(!(p&&!(0,o.v3)(p.value,u)))return a(p?.value)},[u,a]),g=i.find(p=>p.value===m);return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(r.l6,{value:g,placeholder:h.placeholderText??"Select field",options:i,onChange:x,noOptionsMessage:h.noFieldsMessage,width:h.width,isClearable:h.isClearable!==!1})})}},62693:(ee,B,e)=>{"use strict";e.d(B,{bx:()=>f,cH:()=>i});var t=e(74848),n=e(96540),r=e(95004),o=e(57866),s=e(36638),m=e(97958),a=e(18857);const l=(0,n.memo)(x=>{const{data:g,options:p,onChange:c,id:y}=x,P=h(g),d=u(P,p),D=(0,n.useCallback)(E=>c(E.value),[c]),b=d.find(E=>E.value===p);return(0,t.jsx)(a.l6,{inputId:y,value:b,options:d,onChange:D})});l.displayName="FieldTypeMatcherEditor";const f=[{value:r.PU.number,label:"Number",icon:(0,m.lV)(r.PU.number)},{value:r.PU.string,label:"String",icon:(0,m.lV)(r.PU.string)},{value:r.PU.time,label:"Time",icon:(0,m.lV)(r.PU.time)},{value:r.PU.boolean,label:"Boolean",icon:(0,m.lV)(r.PU.boolean)},{value:r.PU.trace,label:"Traces",icon:(0,m.lV)(r.PU.trace)},{value:r.PU.enum,label:"Enum",icon:(0,m.lV)(r.PU.enum)},{value:r.PU.other,label:"Other",icon:(0,m.lV)(r.PU.other)}],h=x=>(0,n.useMemo)(()=>{const g=new Map;for(const p of f)g.set(p.value,0);for(const p of x)for(const c of p.fields){const y=c.type||r.PU.other;let P=g.get(y);P||(P=0),g.set(y,P+1)}return g},[x]),u=(x,g)=>(0,n.useMemo)(()=>{let p=!1;const c=[];for(const y of f){const P=x.get(y.value),d=g===y.value;(P||d)&&c.push({...y,label:`${y.label} (${x.get(y.value)})`}),d&&(p=!0)}return g&&!p&&c.push({value:g,label:`${g} (No matches)`}),c},[x,g]),i={id:o.Ct.byType,component:l,matcher:s.sJ.get(o.Ct.byType),name:"Fields with type",description:"Set properties for fields of a specific type (number, string, boolean)",optionsToLabel:x=>x}},18105:(ee,B,e)=>{"use strict";e.d(B,{N:()=>i,r1:()=>c});var t=e(74848),n=e(22803),r=e(96540),o=e(46644),s=e(57866),m=e(36638),a=e(739),l=e(63142),f=e(7685),h=e(63527),u=e(18857);const i=[{label:"==",value:a.zT.EQ},{label:"!=",value:a.zT.NEQ},{label:">",value:a.zT.GT},{label:">=",value:a.zT.GTE},{label:"<",value:a.zT.LT},{label:"<=",value:a.zT.LTE}];function x(y){return y===o.gy.allIsNull||y===o.gy.allIsZero}const g=({options:y,onChange:P})=>{const d=(0,l.of)(p),D=(0,r.useMemo)(()=>o.AS.selectOptions([y?.reducer]),[y?.reducer]),b=(0,r.useCallback)(O=>P({...y,reducer:O.value}),[y,P]),E=(0,r.useCallback)(O=>P({...y,op:O.value}),[y,P]),v=(0,r.useCallback)(O=>{const I=O.currentTarget.valueAsNumber;return P({...y,value:I})},[y,P]),C=y??{},S=x(C.reducer);return(0,t.jsxs)("div",{className:d.spot,children:[(0,t.jsx)(u.l6,{value:D.current,options:D.options,onChange:b,placeholder:(0,f.t)("grafana-ui.field-value-matcher.select-field-placeholder","Select field reducer")}),C.reducer&&!S&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.l6,{value:i.find(O=>O.value===C.op),options:i,onChange:E,"aria-label":(0,f.t)("grafana-ui.field-value-matcher.operator-label","Comparison operator"),width:19}),(0,t.jsx)(h.p,{type:"number",value:C.value,onChange:v})]})]})},p=y=>({spot:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"center",alignContent:"flex-end",gap:"4px"})}),c={id:s.Ct.byValue,component:g,matcher:m.sJ.get(s.Ct.byValue),name:"Fields with values",description:"Set properties for fields with reducer condition",optionsToLabel:y=>`${y?.reducer} ${y?.op} ${y?.value}`}},88531:(ee,B,e)=>{"use strict";e.d(B,{RQ:()=>g,XL:()=>f,gK:()=>u,h:()=>y});var t=e(74848),n=e(96540),r=e(47184),o=e(16515),s=e(57866),m=e(36638),a=e(18857);const l=(P,d,D)=>{if(!D)return;let b=P.find(E=>!d.some(v=>E===v));if(b)return b};function f({value:P,data:d,onChange:D,placeholder:b}){const E=(0,n.useMemo)(()=>i(d),[d]),[v,C]=(0,n.useState)({refIds:[],value:void 0}),S=(0,n.useMemo)(()=>E.find(I=>I.value===P)??l(E,v.refIds,v.value),[P,E,v]),O=(0,n.useCallback)(I=>{D(I?.value)},[D]);return(E!==v.refIds||S?.value!==v.value)&&C({refIds:E,value:S?.value}),(0,t.jsx)(a.l6,{options:E,onChange:O,isClearable:!0,placeholder:b??"Select query refId",value:S})}const h=(P,d,D)=>
31{if(!D||!D.length)return;const b=P.filter(E=>d.some(v=>E===v));if(b.length)return b};function u({value:P,data:d,onChange:D,placeholder:b}){const E=(0,n.useMemo)(()=>i(d),[d]),[v,C]=(0,n.useState)({refIds:[],value:void 0}),S=(0,n.useMemo)(()=>{let I=new Set;if(P)if(P.startsWith("/^"))try{I=new Set(c(P))}catch{I.add(P)}else P.includes("|")?I=new Set(P.split("|")):I.add(P);const R=E.filter(L=>I.has(L.value||""));if(R.length)return R;const T=[...I].map(r.z);return h(T,v.refIds,v.value)},[P,E,v]),O=(0,n.useCallback)(I=>{D(I.map(R=>R.value))},[D]);return(E!==v.refIds||S?.length!==v.value?.length)&&C({refIds:E,value:S}),(0,t.jsx)(a.KF,{options:E,onChange:O,isClearable:!0,placeholder:b??"Select query refId",value:S})}function i(P){const d=new Map;for(const b of P){const E=b.refId??"",v=d.get(E)??[];v.length===0&&d.set(E,v),v.push(b)}const D=[];for(const[b,E]of d.entries())D.push({value:b,label:`Query: ${b??"(missing refId)"}`,description:x(E)});return D}function x(P){return`Frames (${P.length}): 32 ${P.slice(0,Math.min(3,P.length)).map(d=>(0,o.Ri)(d)).join(", ")} ${P.length>3?"...":""}`}const g={id:s.Ct.byFrameRefID,component:P=>(0,t.jsx)(f,{value:P.options,data:P.data,onChange:P.onChange}),matcher:m.sJ.get(s.Ct.byFrameRefID),name:"Fields returned by query",description:"Set properties for fields from a specific query",optionsToLabel:P=>P};function p(P){return P.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const c=P=>P.slice(5,-3).split(/(?<!\\)\|/g).map(d=>d.replace(/\\(.)/g,"$1")),y=P=>`/^(?:${P.map(d=>p(d)).join("|")})$/`},63152:(ee,B,e)=>{"use strict";e.d(B,{g:()=>d});var t=e(42954),n=e(74848),r=e(96540),o=e(57866),s=e(36638),m=e(7685),a=e(63527);const l=(0,r.memo)(D=>{const{options:b,onChange:E}=D,v=(0,r.useCallback)(C=>E(C.target.value),[E]);return(0,n.jsx)(a.p,{placeholder:(0,m.t)("grafana-ui.field-name-by-regex-matcher.input-placeholder","Enter regular expression"),defaultValue:b,onBlur:v})});l.displayName="FieldNameByRegexMatcherEditor";const f={id:o.Ct.byRegexp,component:l,matcher:s.sJ.get(o.Ct.byRegexp),name:"Fields with name matching regex",description:"Set properties for fields with names matching a regex",optionsToLabel:D=>D};var h=e(18857),u=e(56755);const i=(0,r.memo)(D=>{const{data:b,options:E,onChange:v,id:C}=D,S=(0,u.sE)(b),O=(0,u.m3)(S,E),I=(0,r.useCallback)(T=>{if((0,u.v3)(T.value,S))return v(T.value)},[S,v]),R=O.find(T=>T.value===E);return(0,n.jsx)(h.l6,{value:R,options:O,onChange:I,inputId:C})});i.displayName="FieldNameMatcherEditor";const x={id:o.Ct.byName,component:i,matcher:s.sJ.get(o.Ct.byName),name:"Fields with name",description:"Set properties for a specific field",optionsToLabel:D=>D},g=(0,r.memo)(D=>{const{data:b,options:E,onChange:v}=D,{readOnly:C,prefix:S}=E,O=(0,u.sE)(b),I=(0,u.m3)(O,void 0),R=(0,r.useCallback)(T=>{if(Array.isArray(T))return v({...E,names:T.reduce((L,K)=>((0,u.v3)(K.value,O)&&L.push(K.value),L),[])})},[O,v,E]);if(C){const T=(E.names??[]).join(", ");return(0,n.jsx)(a.p,{value:T,readOnly:!0,disabled:!0,prefix:S})}return(0,n.jsx)(h.KF,{value:E.names,options:I,onChange:R})});g.displayName="FieldNameMatcherEditor";const p={id:o.Ct.byNames,component:g,matcher:s.sJ.get(o.Ct.byNames),name:"Fields with name",description:"Set properties for a specific field",optionsToLabel:D=>(D.names??[]).join(", "),excludeFromPicker:!0};var c=e(62693),y=e(18105),P=e(88531);const d=new t.O(()=>[x,f,c.cH,P.RQ,p,y.r1])},56755:(ee,B,e)=>{"use strict";e.d(B,{BP:()=>m,m3:()=>l,sE:()=>a,v3:()=>s});var t=e(96540),n=e(16515),r=e(38809),o=e(97958);function s(f,h){return f?h.display.has(f)||h.raw.has(f):!1}function m(f,h){const u={display:new Set,raw:new Set,fields:new Map};for(const i of f)for(const x of i.fields){if(h&&!h(x))continue;const g=(0,n.Ct)(x,i,f);u.display.add(g),u.fields.set(g,x),x.name&&g!==x.name&&(u.raw.add(x.name),u.fields.set(x.name,x))}return u}function a(f,h){return(0,t.useMemo)(()=>m(f,h),[f,h])}function l(f,h,u,i,x){return(0,t.useMemo)(()=>{let g=!1;const p=[];if(u&&p.push(u),x===r.X4.OnlyBaseNames)for(const c of f.raw)!g&&c===h&&(g=!0),p.push({value:c,label:`${c} (base field name)`});else{for(const c of f.display){!g&&c===h&&(g=!0);const y=f.fields.get(c);(!i||i===y?.type)&&p.push({value:c,label:c,icon:y?(0,o.SS)(y):void 0})}if(x!==r.X4.ExcludeBaseNames)for(const c of f.raw)f.display.has(c)||(!g&&c===h&&(g=!0),p.push({value:c,label:`${c} (base field name)`}))}return h&&!g&&p.push({value:h,label:`${h} (not found)`}),p},[f,h,u,i,x])}},87063:(ee,B,e)=>{"use strict";e.d(B,{W:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(31286),m=e(25460),a=e(30930),l=e(94535),f=e(92132);const h=r.forwardRef(({header:x,children:g,ariaLabel:p,onOpen:c,onClose:y,onKeyDown:P,...d},D)=>{const b=(0,o.of)(i),E=(0,r.useRef)(null);(0,r.useImperativeHandle)(D,()=>E.current);const[v]=(0,f.t)({isMenuOpen:!0,localRef:E,onOpen:c,onClose:y,onKeyDown:P});return(0,t.jsxs)(s.a,{...d,"aria-label":p,backgroundColor:"elevated",borderRadius:"default",boxShadow:"z3",display:"inline-block",onKeyDown:v,paddingX:.5,paddingY:.5,ref:E,role:"menu",tabIndex:-1,
32children:[x&&(0,t.jsx)("div",{className:(0,n.cx)(b.header,!!g&&r.Children.toArray(g).length>0&&b.headerBorder),children:x}),g]})});h.displayName="Menu";const u=Object.assign(h,{Item:l.D,Divider:m.N,Group:a.r}),i=x=>({header:(0,n.css)({padding:x.spacing(.5,.5,1,.5)}),headerBorder:(0,n.css)({borderBottom:`1px solid ${x.colors.border.weak}`,marginBottom:x.spacing(.5)})})},25460:(ee,B,e)=>{"use strict";e.d(B,{N:()=>o});var t=e(74848),n=e(22803),r=e(63142);function o(){const m=(0,r.of)(s);return(0,t.jsx)("div",{className:m.divider})}const s=m=>({divider:(0,n.css)({height:1,backgroundColor:m.colors.border.weak,margin:m.spacing(.5,0)})})},30930:(ee,B,e)=>{"use strict";e.d(B,{r:()=>m});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(63142);const m=({label:l,ariaLabel:f,children:h})=>{const u=(0,s.of)(a),i=`group-label-${(0,r.uniqueId)()}`;return(0,t.jsxs)("div",{role:"group","aria-labelledby":!f&&l?i:void 0,"aria-label":f,children:[l&&(0,t.jsx)("label",{id:i,className:u.groupLabel,"aria-hidden":!0,children:l}),h]})};m.displayName="MenuGroup";const a=l=>({groupLabel:(0,n.css)({color:l.colors.text.secondary,fontSize:l.typography.size.sm,padding:l.spacing(.5,1)})})},94535:(ee,B,e)=>{"use strict";e.d(B,{D:()=>g});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(35484),m=e(7685),a=e(30703),l=e(41654),f=e(85629),h=e(92132);const u=c=>{if(!c)return!1;const y=c.parentElement.getBoundingClientRect(),P=c.getBoundingClientRect();return P.width!==0&&y.right+P.width+10>window.innerWidth},i=(0,r.memo)(({items:c,isOpen:y,close:P,customStyle:d})=>{const D=(0,o.of)(x),b=(0,r.useRef)(null),[E]=(0,h.t)({localRef:b,isMenuOpen:y,close:P}),[v,C]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{y&&b.current&&C(u(b.current))},[y]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:D.iconWrapper,"aria-hidden":!0,"data-testid":f.Tp.components.Menu.SubMenu.icon,children:(0,t.jsx)(a.I,{name:"angle-right",className:D.icon})}),y&&(0,t.jsx)("div",{ref:b,className:(0,n.cx)(D.subMenu,{[D.pushLeft]:v}),"data-testid":f.Tp.components.Menu.SubMenu.container,style:d,children:(0,t.jsx)("div",{tabIndex:-1,className:D.itemsWrapper,role:"menu",onKeyDown:E,children:c})})]})});i.displayName="SubMenu";const x=c=>({iconWrapper:(0,n.css)({display:"flex",flex:1,justifyContent:"end"}),icon:(0,n.css)({opacity:.7,marginLeft:c.spacing(1),color:c.colors.text.secondary}),itemsWrapper:(0,n.css)({background:c.colors.background.elevated,padding:c.spacing(.5),boxShadow:c.shadows.z3,display:"inline-block",borderRadius:c.shape.radius.default}),pushLeft:(0,n.css)({right:"100%",left:"unset"}),subMenu:(0,n.css)({position:"absolute",top:0,left:"100%",zIndex:c.zIndex.dropdown})}),g=r.memo(r.forwardRef((c,y)=>
32{const{url:P,icon:d,label:D,description:b,ariaLabel:E,ariaChecked:v,target:C,onClick:S,className:O,active:I,disabled:R,destructive:T,childItems:L,role:K,tabIndex:A=-1,customSubMenuContainerStyles:W,shortcut:N,testId:w}=c,j=(0,o.of)(p),[V,U]=(0,r.useState)(I),[F,M]=(0,r.useState)(!1),H=(0,r.useCallback)(()=>{R||(M(!0),U(!0))},[R]),_=(0,r.useCallback)(()=>{R||(M(!1),U(!1))},[R]),Z=L&&L.length>0,ne=Z?"div":P===void 0?"button":"a",te=(0,n.cx)({[j.item]:!0,[j.active]:V,[j.disabled]:R,[j.destructive]:T&&!R},O),Y={[ne==="button"?"disabled":"aria-disabled"]:R,...ne==="a"&&R&&{href:void 0,onClick:void 0},...R&&{tabIndex:-1,"data-disabled":R}},Q=(0,r.useRef)(null);(0,r.useImperativeHandle)(y,()=>Q.current);const J=se=>{switch(se.key){case"ArrowRight":se.preventDefault(),se.stopPropagation(),Z&&(M(!0),U(!0));break;default:break}},q=()=>{M(!1),U(!1),Q?.current?.focus()},X=!!(N&&N.length>0);return(0,t.jsxs)(ne,{target:C,className:te,rel:C==="_blank"?"noopener noreferrer":void 0,href:P,onClick:se=>{Z&&!F&&(se.preventDefault(),se.stopPropagation()),S?.(se)},onMouseEnter:H,onMouseLeave:_,onKeyDown:J,role:P?K:K||"menuitem","data-role":"menuitem",ref:Q,"data-testid":w,"aria-label":E,"aria-checked":v,tabIndex:A,...Y,children:[(0,t.jsxs)(l.B,{direction:"row",justifyContent:"flex-start",alignItems:"center",children:[d&&(0,t.jsx)(a.I,{name:d,className:j.icon,"aria-hidden":!0}),(0,t.jsx)("span",{className:j.ellipsis,children:D}),(0,t.jsxs)("div",{className:(0,n.cx)(j.rightWrapper,{[j.withShortcut]:X}),children:[X&&(0,t.jsxs)("div",{className:j.shortcut,children:[(0,t.jsx)(a.I,{name:"keyboard",title:(0,m.t)("grafana-ui.menu-item.keyboard-shortcut-label","Keyboard shortcut")}),N]}),Z&&(0,t.jsx)(i,{items:L,isOpen:F,close:q,customStyle:W})]})]}),b&&(0,t.jsx)("div",{className:(0,n.cx)(j.description,j.ellipsis,{[j.descriptionWithIcon]:d!==void 0}),children:b}),c.component?(0,t.jsx)(c.component,{}):null]})}));g.displayName="MenuItem";const p=c=>({item:(0,n.css)({background:"none",cursor:"pointer",whiteSpace:"nowrap",color:c.colors.text.primary,display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"center",padding:c.spacing(.5,1.5),minHeight:c.spacing(4),borderRadius:c.shape.radius.default,margin:0,border:"none",width:"100%",position:"relative","&:hover, &:focus-visible":{background:c.colors.action.hover,color:c.colors.text.primary,textDecoration:"none"},"&:focus-visible":(0,s.getFocusStyles)(c)}),active:(0,n.css)({background:c.colors.action.hover}),destructive:(0,n.css)({color:c.colors.error.text,svg:{color:c.colors.error.text},"&:hover, &:focus, &:focus-visible":{background:c.colors.error.main,color:c.colors.error.contrastText,svg:{color:c.colors.error.contrastText}}}),disabled:(0,n.css)({color:c.colors.action.disabledText,label:"menu-item-disabled","&:hover, &:focus, &:focus-visible":{cursor:"not-allowed",background:"none",color:c.colors.action.disabledText}}),icon:(0,n.css)({opacity:.7,color:c.colors.text.secondary}),rightWrapper:(0,n.css)({display:"flex",alignItems:"center",marginLeft:"auto"}),withShortcut:(0,n.css)({minWidth:c.spacing(10.5)}),shortcut:(0,n.css)({display:"flex",alignItems:"center",gap:c.spacing(1),marginLeft:c.spacing(2),color:c.colors.text.secondary,opacity:.7}),description:(0,n.css)({...c.typography.bodySmall,color:c.colors.text.secondary,textAlign:"start"}),descriptionWithIcon:(0,n.css)({marginLeft:c.spacing(3)}),ellipsis:(0,n.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})})},92132:(ee,B,e)=>{"use strict";e.d(B,{t:()=>s});var t=e(96540),n=e(94701);const r=(m,a)=>(m%a+a)%a,o=-1,s=({localRef:m,isMenuOpen:a,close:l,onOpen:f,onClose:h,onKeyDown:u})=>{const[i,x]=(0,t.useState)(o);return(0,t.useEffect)(()=>{a&&x(0)},[a]),(0,t.useEffect)(()=>{const p=m?.current?.querySelectorAll('[data-role="menuitem"]:not([data-disabled])');p?.[i]?.focus(),p?.forEach((c,y)=>{c.tabIndex=y===i?0:-1})},[m,i]),(0,n.A)(()=>{f?.(x)}),[p=>{const c=m?.current?.querySelectorAll('[data-role="menuitem"]:not([data-disabled])'),y=c?.length??0;switch(p.key){case"ArrowUp":p.preventDefault(),p.stopPropagation(),x(r(i-1,y));break;case"ArrowDown":p.preventDefault(),p.stopPropagation(),x(r(i+1,y));break;case"ArrowLeft":p.preventDefault(),p.stopPropagation(),x(o),l?.();break;case"Home":p.preventDefault(),p.stopPropagation(),x(0);break;case"End":p.preventDefault(),p.stopPropagation(),x(y-1);break;case"Enter":p.preventDefault(),p.stopPropagation(),c?.[i]?.click();break;case"Escape":h?.();break;case"Tab":p.preventDefault(),h?.();break;default:break}u?.(p)}]}},22787:(ee,B,e)=>{"use strict";e.d(B,{a:()=>g});var t=e(74848),n=e(22803),r=e(18828),o=e(42211),s=e(93225),m=e(59875),a=e(96540),l=e(63142),f=e(7685),h=e(76319),u=e(41654),i=e(53428),x=e(35621);function g(y){const{title:P,children:d,isOpen:D=!1,closeOnEscape:b=!0,
32closeOnBackdropClick:E=!0,className:v,contentClassName:C,onDismiss:S,onClickBackdrop:O,trapFocus:I=!0}=y,R=(0,l.of)(x.o),T=(0,a.useRef)(null),{overlayProps:L,underlayProps:K}=(0,s.e)({isKeyboardDismissDisabled:!b,isOpen:D,onClose:S},T),{dialogProps:A,titleProps:W}=(0,r.s)({},T);if(!D)return null;const N=(0,n.cx)(R.modalHeader,typeof P!="string"&&R.modalHeaderWithTabs);return(0,t.jsxs)(m.Sf,{children:[(0,t.jsx)("div",{role:"presentation",className:R.modalBackdrop,onClick:O||(E?S:void 0),...K}),(0,t.jsx)(o.n1,{contain:I,autoFocus:!0,restoreFocus:!0,children:(0,t.jsxs)("div",{className:(0,n.cx)(R.modal,v),ref:T,...L,...A,children:[(0,t.jsxs)("div",{className:N,children:[typeof P=="string"&&(0,t.jsx)(c,{...y,title:P,id:W.id}),typeof P!="string"&&P,(0,t.jsx)("div",{className:R.modalHeaderClose,children:(0,t.jsx)(h.K,{name:"times",size:"xl",onClick:S,"aria-label":(0,f.t)("grafana-ui.modal.close-tooltip","Close")})})]}),(0,t.jsx)("div",{className:(0,n.cx)(R.modalContent,C),children:d})]})})]})}function p({leftItems:y,children:P}){const d=(0,l.of)(x.o);return y?(0,t.jsx)("div",{className:d.modalButtonRow,children:(0,t.jsxs)(u.B,{justifyContent:"space-between",children:[(0,t.jsx)(u.B,{justifyContent:"flex-start",gap:2,children:y}),(0,t.jsx)(u.B,{justifyContent:"flex-end",gap:2,children:P})]})}):(0,t.jsx)("div",{className:d.modalButtonRow,children:(0,t.jsx)(u.B,{justifyContent:"flex-end",gap:2,wrap:"wrap",children:P})})}g.ButtonRow=p;function c({icon:y,iconTooltip:P,title:d,id:D}){return(0,t.jsx)(i.r,{icon:y,iconTooltip:P,title:d,id:D})}},53428:(ee,B,e)=>{"use strict";e.d(B,{r:()=>o});var t=e(74848),n=e(63142),r=e(35621);const o=({icon:s,iconTooltip:m,title:a,children:l,id:f})=>{const h=(0,n.of)(r.o);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("h2",{className:h.modalHeaderTitle,id:f,children:a}),l]})}},52792:(ee,B,e)=>{"use strict";e.d(B,{J:()=>s});var t=e(74848),n=e(60208),r=e(54314),o=e(53428);const s=({icon:m,title:a,tabs:l,activeTab:f,onChangeTab:h})=>(0,t.jsx)(o.r,{icon:m,title:a,children:(0,t.jsx)(r.U,{hideBorder:!0,children:l.map((u,i)=>(0,t.jsx)(n.o,{label:u.label,icon:u.icon,suffix:u.tabSuffix,active:u.value===f,onChangeTab:()=>h(u)},`${u.value}-${i}`))})})},8515:(ee,B,e)=>{"use strict";e.d(B,{$s:()=>m,EO:()=>s,YO:()=>o,wE:()=>r});var t=e(74848),n=e(96540);const r=n.createContext({component:null,props:{},showModal:()=>{},hideModal:()=>{}});class o extends n.Component{constructor(l){super(l),this.showModal=(f,h)=>{this.setState({component:f,props:h})},this.hideModal=()=>{this.setState({component:null,props:{}})},this.state={component:l.component||null,props:l.props||{},showModal:this.showModal,hideModal:this.hideModal}}render(){return(0,t.jsx)(r.Provider,{value:this.state,children:this.props.children})}}const s=()=>(0,t.jsx)(r.Consumer,{children:({component:a,props:l})=>a?(0,t.jsx)(a,{...l}):null}),m=r.Consumer},35621:(ee,B,e)=>{"use strict";e.d(B,{o:()=>n});var t=e(22803);const n=r=>{const o=r.shape.radius.default;return{modal:(0,t.css)({position:"fixed",zIndex:r.zIndex.modal,background:r.colors.background.primary,boxShadow:r.shadows.z3,borderRadius:o,border:`1px solid ${r.colors.border.weak}`,backgroundClip:"padding-box",outline:"none",width:"750px",maxWidth:"100%",left:0,right:0,marginLeft:"auto",marginRight:"auto",top:"10%",maxHeight:"80%",display:"flex",flexDirection:"column"}),modalBackdrop:(0,t.css)({position:"fixed",zIndex:r.zIndex.modalBackdrop,top:0,right:0,bottom:0,left:0,backgroundColor:r.components.overlay.background}),modalHeader:(0,t.css)({label:"modalHeader",display:"flex",alignItems:"center",minHeight:"42px",margin:r.spacing(1,2,0,2)}),modalHeaderWithTabs:(0,t.css)({borderBottom:`1px solid ${r.colors.border.weak}`}),modalHeaderTitle:(0,t.css)({fontSize:r.typography.size.lg,margin:r.spacing(0,4,0,1),display:"flex",alignItems:"center",position:"relative",top:"2px"}),modalHeaderIcon:(0,t.css)({marginRight:r.spacing(2),fontSize:"inherit","&:before":{verticalAlign:"baseline"}}),modalHeaderClose:(0,t.css)({height:"100%",display:"flex",alignItems:"center",color:r.colors.text.secondary,flexGrow:1,justifyContent:"flex-end"}),modalContent:(0,t.css)({overflow:"auto",padding:r.spacing(3),width:"100%"}),modalButtonRow:(0,t.css)({paddingTop:r.spacing(3)})}}},13477:(ee,B,e)=>{"use strict";e.d(B,{O:()=>n});var t=e(78193);function n(r){const o="${"+r.value+"}",s=r.value===r.label?r.origin:`${r.label} / ${r.origin}`;return{label:o,kind:t.q.Property,detail:s,documentation:r.documentation}}},84600:(ee,B,e)=>{"use strict";e.d(B,{d:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(63142),m=e(35484),a=e(7685),l=e(30703),f=e(76319),h=e(20941),u=e(36219);const i=(0,r.memo)(({title:g,section:p,parent:c,pageIcon:y,onGoBack:P,children:d,titleHref:D,parentHref:b,leftItems:E,isFullscreen:v,className:C,"aria-label":S,buttonOverflowAlignment:O="right",forceShowLeftItems:I=!1})=>{const R=(0,s.of)(x),T=(0,n.cx)("page-toolbar",R.toolbar,{"page-toolbar--fullscreen":v,[R.noPageIcon]:!y},C),L=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:R.truncateText,children:g}),p&&(0,t.jsxs)("span",{className:R.pre,children:[" / ",p]})]}),K=(0,a.t)("grafana-ui.page-toolbar.go-back","Go back (Esc)"),A=(0,a.t)("grafana-ui.page-toolbar.search-parent-folder","Search dashboard in the {{parent}} folder",{parent:c}),W=(0,a.t)("grafana-ui.page-toolbar.search-dashboard-name","Search dashboard by n
32ame"),N=(0,a.t)("grafana-ui.page-toolbar.search-links","Search links");return(0,t.jsxs)("nav",{className:T,"aria-label":S,children:[(0,t.jsxs)("div",{className:R.leftWrapper,children:[y&&!P&&(0,t.jsx)("div",{className:R.pageIcon,children:(0,t.jsx)(l.I,{name:y,size:"lg","aria-hidden":!0})}),P&&(0,t.jsx)("div",{className:R.pageIcon,children:(0,t.jsx)(f.K,{name:"arrow-left",tooltip:K,tooltipPlacement:"bottom",size:"xxl","data-testid":o.Tp.components.BackButton.backArrow,onClick:P})}),(0,t.jsxs)("nav",{"aria-label":N,className:R.navElement,children:[c&&b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(h.N,{"aria-label":A,className:(0,n.cx)(R.titleText,R.parentLink,R.titleLink,R.truncateText),href:b,children:[c," ",(0,t.jsx)("span",{className:R.parentIcon})]}),D&&(0,t.jsx)("span",{className:(0,n.cx)(R.titleText,R.titleDivider),"aria-hidden":!0,children:"/"})]}),(g||!!E?.length)&&(0,t.jsxs)("div",{className:R.titleWrapper,children:[g&&(0,t.jsx)("h1",{className:R.h1Styles,children:D?(0,t.jsx)(h.N,{"aria-label":W,className:(0,n.cx)(R.titleText,R.titleLink),href:D,children:L}):(0,t.jsx)("div",{className:R.titleText,children:L})}),E?.map((w,j)=>(0,t.jsx)("div",{className:(0,n.cx)(R.leftActionItem,{[R.forceShowLeftActionItems]:I}),children:w},j))]})]})]}),(0,t.jsx)(u.U,{alignment:O,children:r.Children.toArray(d).filter(Boolean)})]})});i.displayName="PageToolbar";const x=g=>{const{spacing:p,typography:c}=g,y=(0,m.getFocusStyles)(g);return{pre:(0,n.css)({whiteSpace:"pre"}),toolbar:(0,n.css)({alignItems:"center",background:g.colors.background.canvas,display:"flex",gap:g.spacing(2),justifyContent:"space-between",padding:g.spacing(1.5,2),[g.breakpoints.down("md")]:{paddingLeft:"53px"}}),noPageIcon:(0,n.css)({[g.breakpoints.down("md")]:{paddingLeft:g.spacing(2)}}),leftWrapper:(0,n.css)({display:"flex",flexWrap:"nowrap",maxWidth:"70%"}),pageIcon:(0,n.css)({display:"none",[g.breakpoints.up("sm")]:{display:"flex",paddingRight:g.spacing(1),alignItems:"center"}}),truncateText:(0,n.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),titleWrapper:(0,n.css)({display:"flex",margin:0,minWidth:0}),navElement:(0,n.css)({display:"flex",alignItems:"center",minWidth:0}),h1Styles:(0,n.css)({margin:p(0,1,0,0),lineHeight:"inherit",flexGrow:1,minWidth:0}),parentIcon:(0,n.css)({marginLeft:g.spacing(.5)}),titleText:(0,n.css)({display:"flex",fontSize:c.size.lg,margin:0,borderRadius:g.shape.radius.default}),titleLink:(0,n.css)({"&:focus-visible":y}),titleDivider:(0,n.css)({padding:p(0,.5,0,.5),display:"none",[g.breakpoints.up("md")]:{display:"unset"}}),parentLink:(0,n.css)({display:"none",[g.breakpoints.up("md")]:{display:"unset",flex:1}}),leftActionItem:(0,n.css)({display:"none",alignItems:"center",paddingRight:p(.5),[g.breakpoints.up("md")]:{display:"flex"}}),forceShowLeftActionItems:(0,n.css)({display:"flex"})}}},34213:(ee,B,e)=>{"use strict";e.d(B,{d:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(7685),m=e(45861),a=e(30703);const l=({currentPage:h,numberOfPages:u,onNavigate:i,hideWhenSinglePage:x,showSmallVersion:g,className:p})=>{const c=(0,o.of)(f),y=g?1:8,P=(0,r.useMemo)(()=>{const b=[...new Array(u).keys()],E=u>y,v=(C,S)=>(0,t.jsx)("li",{className:c.item,children:(0,t.jsx)(m.$n,{size:"sm",variant:S,onClick:()=>i(C),children:C})},C);return b.reduce((C,S)=>{const O=S+1,I=O===h?"primary":"secondary",R=y,T=u-y+1,L=T-R,K=O===1||O===u,A=L>-1&&h>=R&&h<=T,W=g?1:3,N=g?0:2;return E?K||h<R&&O<R||L>=0&&h>T&&O>T||L<0&&h>=R&&O>T||A&&O>=h-N&&O<=h+N?C.push(v(O,I)):(O===R&&h<R||O===T&&h>T||A&&(O===h-W||O===h+W))&&C.push((0,t.jsx)("li",{className:c.item,children:(0,t.jsx)(a.I,{className:c.ellipsis,name:"ellipsis-v"})},O)):C.push(v(O,I)),C},[])},[h,u,i,y,g,c.ellipsis,c.item]);if(x&&u<=1)return null;const d=(0,s.t)("grafana-ui.pagination.previous-page","previous page"),D=(0,s.t)("grafana-ui.pagination.next-page","next page");return(0,t.jsx)("div",{className:(0,n.cx)(c.container,p),children:(0,t.jsxs)("ol",{children:[(0,t.jsx)("li",{className:c.item,children:(0,t.jsx)(m.$n,{"aria-label":d,size:"sm",variant:"secondary",onClick:()=>i(h-1),disabled:h===1,children:(0,t.jsx)(a.I,{name:"angle-left"})})}),P,(0,t.jsx)("li",{className:c.item,children:(0,t.jsx)(m.$n,{"aria-label":D,size:"sm",variant:"secondary",onClick:()=>i(h+1),disabled:h===u,children:(0,t.jsx)(a.I,{name:"angle-right"})})})]})})},f=()=>({container:(0,n.css)({float:"right"}),item:(0,n.css)({display:"inline-block",paddingLeft:"10px",marginBottom:"5px"}),ellipsis:(0,n.css)({transform:"rotate(90deg)"})})},17503:(ee,B,e)=>{"use strict";e.d(B,{I:()=>a});var t=e(74848),n=e(22803),r=e(85629),o=e(63142),s=e(30703),m=e(45967);const a=({onCancel:h,loading:u})=>{const i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=(0,o.of)(f);return u?(0,t.jsx)(m.m,{content:"Cancel query",children:(0,t.jsx)(s.I,{className:(0,n.cx)(x.spin,{[x.clickable]:!!h}),name:i?"hourglass":"sync",size:"sm",onClick:h,"data-testid":r.Tp.components.LoadingIndicator.icon})}):null},l=(0,n.keyframes)({"0%":{transform:"rotate(0deg) scaleX(-1)"},"100%":{transform:"rotate(359deg) scaleX(-1)"}}),f=h=>({clickable:(0,n.css)({cursor:"pointer"}),spin:(0,n.css)({[h.transitions.handleMotion("no-preference")]:{animation:`${l} 3s linear infinite`}})})},64400:(ee,B,e)=>{"use strict";e.d(B,{XF:()=>o,d2:()=>s,e4:()=>r});var t=e(96540),n=e(19379);const r=(0,t.createContext)({eventsScope:"global",eventBus:new n.o}),o=r.Provider,s=()=>(0,t.useContext)(r)},67522:(ee,B,e)=>{"use strict";e.d(B,{NR:()=>j});var t=e(17503),n=e(74848),r=e(22803),o=e(96540),s=e(42941),m=e(49185),a=e(28105),l=e(85629),f=e(63142),h=e(35484),u=e(36324);function i({children:V,delay:U}){const[F,M]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{window.setTimeout(()=>{M(!0)},U)},[V,U]),(0,n.jsx)(n.Fragment,{children:F?V:null})}var x=e(56887),g=e(30703),p=e(47327),c=e(66404),y=e(45967),P=e(7685),d=e(88559),D=e(7895);function b({menu:V,title:U,placement:F="bottom",offset:M,dragClassCancel:H,menuButtonClass:_,onOpenMenu:Z}){const ne=U?l.Tp.components.Panels.Panel.menu(U):"panel-menu-button",te=(0,o.useCallback)(Y=>{Y&&Z&&Z()}
32,[Z]);return(0,n.jsx)(d.m,{overlay:V,placement:F,offset:M,onVisibleChange:te,children:(0,n.jsx)(D.I,{"aria-label":(0,P.t)("grafana-ui.panel-menu.label","Menu for panel {{ title }}",{title:U??"Untitled"}),title:(0,P.t)("grafana-ui.panel-menu.title","Menu"),icon:"ellipsis-v",iconSize:"md",narrow:!0,"data-testid":ne,className:(0,r.cx)(_,H)})})}function E({menu:V,title:U,dragClass:F,children:M,offset:H=-32,onOpenMenu:_}){const Z=(0,f.of)(v),ne=(0,o.useRef)(null),te=l.Tp.components.Panels.Panel.HoverWidget,Y=(0,o.useCallback)(J=>{ne.current?.setPointerCapture(J.pointerId)},[]),Q=(0,o.useCallback)(J=>{ne.current?.releasePointerCapture(J.pointerId)},[]);return M===void 0||o.Children.count(M)===0?null:(0,n.jsxs)("div",{className:(0,r.cx)(Z.container,"show-on-hover"),style:{top:H},"data-testid":te.container,children:[F&&(0,n.jsx)("div",{className:(0,r.cx)(Z.square,Z.draggable,F),onPointerDown:Y,onPointerUp:Q,ref:ne,"data-testid":te.dragIcon,children:(0,n.jsx)(g.I,{name:"expand-arrows",className:Z.draggableIcon})}),M,V&&(0,n.jsx)(b,{menu:V,title:U,placement:"bottom",menuButtonClass:Z.menuButton,onOpenMenu:_})]})}function v(V){return{container:(0,r.css)({label:"hover-container-widget",[V.transitions.handleMotion("no-preference","reduce")]:{transition:"all .1s linear"},display:"flex",position:"absolute",zIndex:1,right:0,boxSizing:"content-box",alignItems:"center",background:V.colors.background.secondary,color:V.colors.text.primary,border:`1px solid ${V.colors.border.weak}`,borderRadius:V.shape.radius.default,height:V.spacing(4),boxShadow:V.shadows.z1}),square:(0,r.css)({display:"flex",justifyContent:"center",alignItems:"center",width:V.spacing(4),height:"100%"}),draggable:(0,r.css)({cursor:"move",[V.breakpoints.down("md")]:{display:"none"}}),menuButton:(0,r.css)({background:"inherit",border:"none","&:hover":{background:V.colors.secondary.main}}),draggableIcon:(0,r.css)({transform:"rotate(45deg)",color:V.colors.text.secondary,"&:hover":{color:V.colors.text.primary}})}}var C=e(45861);const S=(0,o.forwardRef)(({className:V,children:U,href:F,onClick:M,target:H,title:_,...Z},ne)=>{const te=(0,f.of)(O);return F?(0,n.jsx)("a",{ref:ne,href:F,onClick:M,target:H,title:_,className:(0,r.cx)(te.linkItem,V),...Z,children:U}):M?(0,n.jsx)(C.$n,{ref:ne,className:(0,r.cx)(te.item,V),variant:"secondary",fill:"text",onClick:M,children:U}):(0,n.jsx)("span",{ref:ne,className:(0,r.cx)(te.item,V),...Z,children:U})});S.displayName="TitleItem";const O=V=>{const U=(0,r.css)({color:`${V.colors.text.secondary}`,label:"panel-header-item",cursor:"auto",border:"none",borderRadius:`${V.shape.radius.default}`,padding:`${V.spacing(0,1)}`,height:`${V.spacing(V.components.panel.headerHeight)}`,display:"flex",alignItems:"center",justifyContent:"center","&:focus, &:focus-visible":{...(0,h.getFocusStyles)(V),zIndex:1},"&: focus:not(:focus-visible)":(0,h.getMouseFocusStyles)(V),"&:hover ":{boxShadow:`${V.shadows.z1}`,background:`${V.colors.background.secondary}`,color:`${V.colors.text.primary}`}});return{item:U,linkItem:(0,r.cx)(U,(0,r.css)({cursor:"pointer"}))}};function I({description:V,className:U}){const F=(0,f.of)(R),M=()=>{const H=typeof V=="function"?V():V;return(0,n.jsx)("div",{className:"panel-info-content markdown-html",children:(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:H}})})};return V!==""?(0,n.jsx)(y.m,{interactive:!0,content:M,children:(0,n.jsx)(S,{className:(0,r.cx)(U,F.description),children:(0,n.jsx)(g.I,{name:"info-circle",size:"md"})})}):null}const R=V=>({description:(0,r.css)({code:{whiteSpace:"normal",wordWrap:"break-word"},"pre > code":{display:"block"}})});function T({message:V,onClick:U,ariaLabel:F="status"}){const M=(0,f.of)(L);return(0,n.jsx)(D.I,{className:M.buttonStyles,onClick:U,variant:"destructive",icon:"exclamation-triangle",iconSize:"md",tooltip:V||"","aria-label":F,"data-testid":l.Tp.components.Panels.Panel.status("error")})}const L=V=>{const{headerHeight:U,padding:F}=V.components.panel;return{buttonStyles:(0,r.css)({label:"panel-header-state-button",display:"flex",alignItems:"center",justifyContent:"center",padding:V.spacing(F),width:V.spacing(U),height:V.spacing(U),borderRadius:V.shape.radiu
32s.default})}};function K({width:V,height:U,children:F,padding:M="md",title:H="",description:_="",displayMode:Z="default",titleItems:ne,menu:te,dragClass:Y,dragClassCancel:Q,hoverHeader:J=!1,hoverHeaderOffset:q,loadingState:X,statusMessage:se,statusMessageOnClick:oe,leftItems:ae,actions:ie,selectionId:fe,onCancelQuery:pe,onOpenMenu:de,collapsible:le=!1,collapsed:me,onToggleCollapse:De,onFocus:Te,onMouseMove:Ne,onMouseEnter:Ce,onDragStart:He,showMenuAlways:ke=!1}){const Me=(0,f.$j)(),$e=(0,f.of)(w),tt=(0,o.useId)(),Ke=(0,o.useId)().replace(/:/g,"_"),{isSelected:Re,onSelect:Ve,isSelectable:Qe}=(0,x.y)(fe),je=(0,u.C)(),ze=!J,[Ye,Ge]=(0,s.A)(!0),[ce,Pe]=(0,o.useState)(!1),Se=o.useCallback(()=>Pe(!0),[]),Ee=o.useCallback(()=>Pe(!1),[]);me===void 0&&(me=!Ye);const xe=ke?"always-show":"show-on-hover",ye=Z==="transparent",Oe=W(Me,ze),{contentStyle:we,innerWidth:Be,innerHeight:Xe}=N(M,Me,Oe,me,U,V),st={height:Oe,cursor:Y?"move":"auto"},lt={width:V,height:me?void 0:U},[Et,{width:Tt}]=(0,m.A)();ae&&(ie=ae);const Mt=typeof H=="string"?l.Tp.components.Panels.Panel.title(H):"Panel",wt=o.useCallback(bt=>{je.check(bt)||Q&&bt.target instanceof Element&&bt.target.closest(`.${Q}`)||setTimeout(()=>Ve?.(bt))},[Q,Ve,je]),_e=o.useCallback(bt=>{bt.stopPropagation(),je.set(bt),He?.(bt)},[je,He]),xt=o.useCallback(bt=>{bt.target instanceof Element&&bt.target.closest("button,a,canvas,svg")||Ve?.(bt)},[Ve]),At=(0,n.jsxs)(n.Fragment,{children:[!le&&H&&(0,n.jsx)("div",{className:$e.title,children:(0,n.jsx)(c.E,{element:"h2",variant:"h6",truncate:!0,title:typeof H=="string"?H:void 0,id:Ke,children:H})}),le&&(0,n.jsx)("div",{className:$e.title,children:(0,n.jsx)(c.E,{element:"h2",variant:"h6",children:(0,n.jsxs)("button",{type:"button",className:$e.clearButtonStyles,onClick:()=>{Ge(),De&&De(!me)},"aria-expanded":!me,"aria-controls":me?void 0:tt,children:[(0,n.jsx)(g.I,{name:me?"angle-right":"angle-down","aria-hidden":!!H,"aria-label":H?void 0:"toggle collapse panel"}),(0,n.jsx)(c.E,{variant:"h6",truncate:!0,id:Ke,children:H})]})})}),(0,n.jsxs)("div",{className:(0,r.cx)($e.titleItems,Q),"data-testid":"title-items-container",children:[(0,n.jsx)(I,{description:_,className:Q}),ne]}),X===a.Gu.Streaming&&(0,n.jsx)(y.m,{content:pe?"Stop streaming":"Streaming",children:(0,n.jsx)(S,{className:Q,"data-testid":"panel-streaming",onClick:pe,children:(0,n.jsx)(g.I,{name:"circle-mono",size:"md",className:$e.streaming})})}),X===a.Gu.Loading&&pe&&(0,n.jsx)(i,{delay:2e3,children:(0,n.jsx)(y.m,{content:"Cancel query",children:(0,n.jsx)(S,{className:(0,r.cx)(Q,$e.pointer),"data-testid":"panel-cancel-query",onClick:pe,children:(0,n.jsx)(g.I,{name:"sync-slash",size:"md"})})})}),(0,n.jsx)("div",{className:$e.rightAligned,children:ie&&(0,n.jsx)("div",{className:$e.rightActions,children:A(ie,bt=>bt)})})]});return(0,n.jsxs)("section",{className:(0,r.cx)($e.container,ye&&$e.transparentContainer,Re&&"dashboard-selected-element",!Re&&Qe&&ce&&"dashboard-selectable-element"),style:lt,"aria-labelledby":H?Ke:void 0,"data-testid":Mt,tabIndex:0,onFocus:Te,onMouseMove:Ne,onMouseEnter:Ce,ref:Et,children:[(0,n.jsx)("div",{className:$e.loadingBarContainer,children:X===a.Gu.Loading?(0,n.jsx)(p.G,{width:Tt,ariaLabel:"Panel loading bar"}):null}),J&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E,{menu:te,title:typeof H=="string"?H:void 0,offset:q,dragClass:Y,onOpenMenu:de,children:At}),se&&(0,n.jsx)("div",{className:$e.errorContainerFloating,children:(0,n.jsx)(T,{message:se,onClick:oe,ariaLabel:"Panel status"})})]}),ze&&(0,n.jsxs)("div",{className:(0,r.cx)($e.headerContainer,Y),style:st,"data-testid":"header-container",onPointerDown:_e,onMouseEnter:Qe?Se:void 0,onMouseLeave:Qe?Ee:void 0,onPointerUp:wt,children:[se&&(0,n.jsx)("div",{className:Q,children:(0,n.jsx)(T,{message:se,onClick:oe,ariaLabel:"Panel status"})}),At,te&&(0,n.jsx)(b,{menu:te,title:typeof H=="string"?H:void 0,placement:"bottom-end",menuButtonClass:(0,r.cx)($e.menuItem,Q,xe),onOpenMenu:de})]}),!me&&(0,n.jsx)("div",{id:tt,"data-testid":l.Tp.components.Panels.Panel.content,className:(0,r.cx)($e.content,U===void 0&&$e.containNone),style:we,onPointerDown:xt,children:typeof F=="function"?F(Be,Xe):F})]})}const A=(V,U)=>
32{const F=o.Children.toArray(V).filter(Boolean);return F.length>0?U(F):null},W=(V,U)=>U?V.spacing.gridSize*V.components.panel.headerHeight:0,N=(V,U,F,M,H,_)=>{const Z=(V==="md"?U.components.panel.padding:0)*U.spacing.gridSize,ne=Z*2,te=1*2;let Y=0;_&&(Y=_-ne-te);let Q=0;return H&&(Q=H-F-ne-te),M&&(Q=F),{contentStyle:{padding:Z},innerWidth:Y,innerHeight:Q}},w=V=>{const{background:U,borderColor:F,padding:M}=V.components.panel;return{container:(0,r.css)({label:"panel-container",backgroundColor:U,border:`1px solid ${F}`,position:"relative",borderRadius:V.shape.radius.default,height:"100%",display:"flex",flexDirection:"column",".always-show":{background:"none","&:focus-visible, &:hover":{background:V.colors.secondary.shade}},".show-on-hover":{opacity:"0",visibility:"hidden"},"&:focus-visible, &:hover":{".show-on-hover":{opacity:"1",visibility:"visible"}},"&:focus-visible":(0,h.getFocusStyles)(V),"&:focus-within:not(:focus)":{".show-on-hover":{visibility:"visible",opacity:"1"}}}),transparentContainer:(0,r.css)({label:"panel-transparent-container",backgroundColor:"transparent",border:"1px solid transparent",boxSizing:"border-box","&:hover":{border:`1px solid ${F}`}}),loadingBarContainer:(0,r.css)({label:"panel-loading-bar-container",position:"absolute",top:0,width:"100%",zIndex:1}),containNone:(0,r.css)({contain:"none"}),content:(0,r.css)({label:"panel-content",flexGrow:1,contain:"size layout"}),headerContainer:(0,r.css)({label:"panel-header",display:"flex",alignItems:"center"}),pointer:(0,r.css)({cursor:"pointer"}),streaming:(0,r.css)({label:"panel-streaming",marginRight:0,color:V.colors.success.text,"&:hover":{color:V.colors.success.text}}),title:(0,r.css)({label:"panel-title",display:"flex",padding:V.spacing(0,M),minWidth:0,"& > h2":{minWidth:0}}),items:(0,r.css)({display:"flex"}),item:(0,r.css)({display:"flex",justifyContent:"center",alignItems:"center"}),hiddenMenu:(0,r.css)({visibility:"hidden"}),menuItem:(0,r.css)({label:"panel-menu",border:"none",background:V.colors.secondary.main,"&:hover":{background:V.colors.secondary.shade}}),errorContainerFloating:(0,r.css)({label:"error-container",position:"absolute",left:0,top:0,zIndex:1}),rightActions:(0,r.css)({display:"flex",padding:V.spacing(0,M),gap:V.spacing(1)}),rightAligned:(0,r.css)({label:"right-aligned-container",marginLeft:"auto",display:"flex",alignItems:"center"}),titleItems:(0,r.css)({display:"flex",height:"100%"}),clearButtonStyles:(0,r.css)({alignItems:"center",display:"flex",gap:V.spacing(.5),background:"transparent",border:"none",padding:0,maxWidth:"100%"})}},j=K;j.LoadingIndicator=t.I,j.TitleItem=S},49256:(ee,B,e)=>{"use strict";e.d(B,{B:()=>t});var t=(n=>(n.ToggleSelection="select",n.AppendToSelection="append",n))(t||{})},3023:(ee,B,e)=>{"use strict";e.d(B,{_:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({children:m,className:a,...l})=>{const f=(0,r.of)(s);return(0,t.jsx)("div",{className:(0,n.cx)(f,a),...l,children:m})},s=m=>(0,n.css)({backgroundColor:m.components.panel.background,border:`1px solid ${m.components.panel.borderColor}`,borderRadius:m.shape.radius.default})},63509:(ee,B,e)=>{"use strict";e.d(B,{B:()=>s});var t=e(74848),n=e(11594),r=e(99887);const o={[n.kv.grafana]:"grafana",[n.kv.commercial]:"shield",[n.kv.community]:"shield",DEFAULT:"shield-exclamation"},s=({status:a,color:l,signatureType:f,signatureOrg:h,...u})=>{const i=m(a,f,h);return(0,t.jsx)(r.E,{text:i.text,color:i.color,icon:i.icon,tooltip:i.tooltip,...u})};s.displayName="PluginSignatureBadge";function m(a,l,f){a||(a=n.Ac.invalid);const h=o[l||""]||o.DEFAULT;switch(a){case n.Ac.internal:return{text:"Core",color:"blue",tooltip:"Core plugin that is bundled with Grafana"};case n.Ac.valid:return{text:l||"Signed",icon:l?h:"lock",color:"green",tooltip:"Signed and verified plugin"};case n.Ac.invalid:return{text:"Invalid signature",icon:"exclamation-triangle",color:"red",tooltip:"Invalid plugin signature"};case n.Ac.modified:return{text:"Modified signature",icon:"exclamation-triangle",color:"red",tooltip:"Valid signature but content has been modified"};case n.Ac.missing:return{text:"Missing signature",icon:"exclamation-triangle",color:"red",tooltip:"Missing plugin signature"};default:return{text:"Unsigned",icon:"exclamation-triangle",color:"red",tooltip:"Unsigned external plugin"}}}},92505:(ee,B,e)=>{"use strict";e.d(B,{X:()=>E});var t=e(74848),n=e(22803),r=e(46942),o=e.n(r),s=e(2543),m=e.n(s),a=e(96540),l=e(52845),f=e(29317),h=e(85629),u=e(93427),i=e(59490),x=e(21266),g=e(16123),p=e(91272),c=e(52513),y=e(54024),P=e(63142),d=e(35484),D=e(35458);class b extends a.PureComponent{constructor(S){super(S),this.lastExecutedValue=null,this.mounted=!1,this.editor=null,this.onChange=(L,K)=>{const A=L.document!==this.state.value.document,W=this.state.value;this.props.onRichValueChange&&this.props.onRichValueChange(L),this.setState({value:L},()=>{if(A){const N=l.default.serialize(W)!==l.default.serialize(L);
32N&&K&&this.runOnChangeAndRunQuery(),N&&!K&&this.runOnChangeDebounced()}})},this.runOnChange=()=>{const{onChange:L}=this.props,K=l.default.serialize(this.state.value);L&&L(this.cleanText(K))},this.runOnRunQuery=()=>{const{onRunQuery:L}=this.props;L&&(L(),this.lastExecutedValue=this.state.value)},this.runOnChangeAndRunQuery=()=>{this.runOnChange(),this.runOnRunQuery()},this.handleBlur=(L,K,A)=>{const{onBlur:W}=this.props;if(W)W();else{const N=this.lastExecutedValue?l.default.serialize(this.lastExecutedValue):"",w=l.default.serialize(K.value);N!==w&&this.runOnChangeAndRunQuery()}return A()},this.runOnChangeDebounced=(0,s.debounce)(this.runOnChange,500);const{onTypeahead:O,cleanText:I,portalOrigin:R,onWillApplySuggestion:T}=S;this.plugins=[(0,u.Pz)({onTypeahead:O,cleanText:I,portalOrigin:R,onWillApplySuggestion:T}),(0,i.U)({handler:this.runOnChangeAndRunQuery}),(0,x.O)(),(0,g.v)(),(0,p.l)(),(0,c.T)(),(0,y.s)(),...S.additionalPlugins||[]].filter(L=>L),this.state={suggestions:[],typeaheadContext:null,typeaheadPrefix:"",typeaheadText:"",value:(0,D.mO)(S.query||"",S.syntax)}}static{this.defaultProps={onBlur:()=>{}}}componentDidMount(){this.mounted=!0}componentWillUnmount(){this.mounted=!1}componentDidUpdate(S,O){const{query:I,syntax:R,syntaxLoaded:T}=this.props;if(!S.syntaxLoaded&&T&&this.editor){const K=this.editor.insertText(" ").deleteBackward(1);this.onChange(K.value,!0)}const{value:L}=this.state;I!==S.query&&I!==l.default.serialize(L)&&this.setState({value:(0,D.mO)(I||"",R)})}cleanText(S){return S.replace(/[\r]/g,"")}render(){const{disabled:S,theme:O}=this.props,I=o()("slate-query-field__wrapper",{"slate-query-field__wrapper--disabled":S}),R=v(O);return(0,t.jsx)("div",{className:(0,n.cx)(I,R.wrapper),children:(0,t.jsx)("div",{className:"slate-query-field","data-testid":h.Tp.components.QueryField.container,children:(0,t.jsx)(f.Editor,{ref:T=>this.editor=T,schema:D.yx,autoCorrect:!1,readOnly:this.props.disabled,onBlur:this.handleBlur,onClick:this.props.onClick,onChange:T=>{this.onChange(T.value,!1)},placeholder:this.props.placeholder,plugins:this.plugins,spellCheck:!1,value:this.state.value})})})}}const E=(0,P.cV)(b),v=C=>{const S=(0,d.getFocusStyles)(C);return{wrapper:(0,n.css)({"&:focus-within":S})}}},90811:(ee,B,e)=>{"use strict";e.d(B,{cC:()=>i,cb:()=>u});var t=e(74848),n=e(22803),r=e(58521),o=e(96540),s=e(74529),m=e(85629),a=e(7685),l=e(93256),f=e(15356),h=e(7895);const u=["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"];class i extends o.PureComponent{constructor(c){super(c),this.onChangeSelect=y=>{const{onIntervalChanged:P}=this.props;P&&y.value!=null&&P(y.value)}}static{this.offOption={label:"Off",value:"",ariaLabel:"Turn off auto refresh"}}static{this.liveOption={label:"Live",value:"LIVE",ariaLabel:"Turn on live streaming"}}static{this.autoOption={label:"Auto",value:"auto",ariaLabel:"Select refresh from the query range"}}static{this.isLive=c=>c===i.liveOption.value}getVariant(){return this.props.isLive||this.props.primary?"primary":this.props.isOnCanvas?"canvas":"default"}render(){const{onRefresh:c,intervals:y,tooltip:P,value:d,text:D,isLoading:b,noIntervalPicker:E,width:v,showAutoInterval:C}=this.props,S=d||"",O=this.getVariant(),I=g({intervals:y,showAutoInterval:C}),R=I.find(({value:U})=>U===S),T=x(i.offOption.value);let L=R||T;L.label===T.label&&(L={value:""});const K=L.ariaLabel,A=(0,a.t)("refresh-picker.aria-label.duration-selected","Choose refresh time interval with current interval {{durationAriaLabel}} selected",{durationAriaLabel:K}),W=(0,a.t)("refresh-picker.aria-label.choose-interval","Auto refresh turned off. Choose refresh time interval"),N=L.value===""?W:A,w=(0,a.t)("refresh-picker.tooltip.interval-selected","Set auto refresh interval"),j=(0,a.t)("refresh-picker.tooltip.turned-off","Auto refresh off"),V=L.value===""?j:w;return(0,t.jsxs)(l.e,{className:"refresh-picker",children:[(0,t.jsx)(h.I,{"aria-label":D,tooltip:P,onClick:c,variant:O,icon:b?"spinner":"sync",style:v?{width:v}:void 0,"data-testid":m.Tp.components.RefreshPicker.runButtonV2,children:D}),!E&&(0,t.jsx)(f.f,{className:(0,n.css)({borderTopLeftRadius:0,borderBottomLeftRadius:0}),value:L,options:I,onChange:this.onChangeSelect,variant:O,"data-testid":m.Tp.components.RefreshPicker.intervalButtonV2,"aria-label":N,tooltip:V})]})}}function x(p){switch(p){case i.liveOption.value:return{label:(0,a.t)("refresh-picker.live-option.label","Live"),value:p,ariaLabel:(0,a.t)("refresh-picker.live-option.aria-label","Turn on live streaming")};case i.offOption.value:return{label:(0,a.t)("refresh-picker.off-option.label","Off"),value:p,ariaLabel:(0,a.t)("refresh-picker.off-option.aria-label","Turn off auto refresh")};case i.autoOption.value:return{label:(0,a.t)("refresh-picker.auto-option.label",i.autoOption.label),value:p,ariaLabel:(0,a.t)("refresh-picker.auto-option.aria-label",i.autoOption.ariaLabel)}}return{label:p,value:p}}function g({intervals:p=u,showAutoInterval:c=!1}={}){const y=p.map(P=>{const d=(0,s.E9)(P),D=(0,r.a)(d);return{label:P,value:P,ariaLabel:D}});return c&&y.unshift(x(i.autoOption.value)),y.unshift(x(i.offOption.value)),y}},70663:(ee,B,e)=>{"use strict";e.d(B,{I:()=>r});var t=e(96540),n=e(63704);function r({component:o,content:s,...m}){return t.createElement(o||"span",{dangerouslySetInnerHTML:{__html:n.sQ.sanitize(s)},...m})}},23659:(ee,B,e)=>{"use strict";e.d(B,{L:()=>f});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(7685),m=e(45861),a=e(94959);const l=()=>({noRadiusInput:(0,n.css)({borderBottomRightRadius:"0 !important",borderTopRightRadius:"0 !important"}),noRadiusButton:(0,n.css)({borderBottomLeftRadius:"0 !important",borderTopLeftRadius:"0 !important"})}),f=({label:h="Password",labelWidth:u,inputWidth:i=12,onReset:x,isConfigured:g,tooltip:p,placeholder:c="Password",interactive:y,...P})=>{const d=l();return(0,t.jsx)(a.z,{label:h,tooltip:p,interactive:y,labelWidth:u,inputEl:g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{type:"text",className:(0,n.cx)(`gf-form-input width-${i}`,d.noRadiusInput),disabled:!0,value:"configured",...(0,r.omit)(P,"value")}),(0,t.jsx)(m.$n,{onClick:x,variant:"secondary",type:"button",children:(0,t.jsx)(s.x,{i18nKey:"grafana-ui.secret-form-field.reset",children:"Reset"})})]}):(0,t.jsx)("input",{type:"password",className:`gf-form-input width-${i}`,placeholder:c,...P})})};f.displayName="SecretFormField"},48767:(ee,B,e)=>{"use strict";e.d(B,{L4:()=>a});var t=e(74848),n=e(45861),r=e(63527),o=e(41654);const s="configured",m="Reset",a=({isConfigured:l,onReset:f,...h})=>(0,t.jsxs)(o.B,{children:[!l&&(0,t.jsx)(r.p,{...h,type:"password"}),l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.p,{...h,type:"text",disabled:!0,value:s}),(0,t.jsx)(n.$n,{onClick:f,variant:"secondary",children:m})]})]})},40601:(ee,B,e)=>{"use strict";e.d(B,{lp:()=>u});var t=e(74848),n=e(22803),r=e(63142),o=e(45861),s=e(31286),m=e(41654),a=e(87105);const l="configured",f="Reset",h=i=>({configuredStyle:(0,n.css)({minHeight:i.spacing(i.components.height.md),paddingTop:i.spacing(.5),resize:"none"})}),u=({isConfigured:i,onReset:x,...g})=>{const p=(0,r.of)(h);return(0,t.jsxs)(m.B,{children:[(0,t.jsxs)(s.a,{children:[!i&&(0,t.jsx)(a.f,{...g}),i&&(0,t.jsx)(a.f,{...g,rows:1,disabled:!0,value:l,className:(0,n.cx)(p.configuredStyle)})]}),i&&(0,t.jsx)(o.$n,{onClick:x,variant:"secondary",children:f})]})}},61875:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>h});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(63142),m=e(79233),a=e(89467),l=e(37864),f=e(3431);function h({options:u,value:i,onChange:x,Component:g,className:p,allowCustomValue:c,allowEmptyValue:y,placeholder:P,disabled:d,inputMinWidth:D,inputPlaceholder:b,onExpandedChange:E,autofocus:v=!1,...C}){const[S,O,I,R]=(0,f.Q)(v,E),T=D?Math.max(D,O):O,L=(0,s.of)(l.m);if(!I){const K=(0,r.isObject)(i)?i.label:i,A=K!=null?String(K):void 0;return(0,t.jsx)(S,{disabled:d,Component:g||(0,t.jsx)(m.c,{className:(0,n.cx)(L.segment,{[L.queryPlaceholder]:P!==void 0&&!i,[L.disabled]:d},p),children:A||P})})}return(0,t.jsx)(a.a,{...C,value:i&&!(0,r.isObject)(i)?{value:i}:i,placeholder:b,options:u,width:T,onClickOutside:()=>R(!1),allowCustomValue:c,allowEmptyValue:y,onChange:K=>{R(!1),x(K)}})}},76671:(ee,B,e)=>{"use strict";e.d(B,{s:()=>i});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(41053),m=e(63142),a=e(7685),l=e(79233),f=e(89467),h=e(37864),u=e(3431);function i({value:g,onChange:p,loadOptions:c,reloadOptionsOnChange:y=!1,Component:P,className:d,allowCustomValue:D,allowEmptyValue:b,disabled:E,placeholder:v,inputMinWidth:C,inputPlaceholder:S,autofocus:O=!1,onExpandedChange:I,noOptionMessageHandler:R=x,...T}
32){const[L,K]=(0,s.A)(c,[c]),[A,W,N,w]=(0,u.Q)(O,I),j=C?Math.max(C,W):W,V=(0,m.of)(h.m);if(!N){const U=(0,r.isObject)(g)?g.label:g,F=U!=null?String(U):void 0;return(0,t.jsx)(A,{onClick:y?void 0:K,disabled:E,Component:P||(0,t.jsx)(l.c,{className:(0,n.cx)(V.segment,{[V.queryPlaceholder]:v!==void 0&&!g,[V.disabled]:E},d),children:F||v})})}return(0,t.jsx)(f.a,{...T,value:g&&!(0,r.isObject)(g)?{value:g}:g,placeholder:S,options:L.value??[],loadOptions:y?K:void 0,width:j,noOptionsMessage:R(L),allowCustomValue:D,allowEmptyValue:b,onClickOutside:()=>{w(!1)},onChange:U=>{w(!1),p(U)}})}function x(g){return g.loading?(0,a.t)("grafana-ui.segment-async.loading","Loading options..."):g.error?(0,a.t)("grafana-ui.segment-async.error","Failed to load options"):(0,a.t)("grafana-ui.segment-async.no-options","No options found")}},3263:(ee,B,e)=>{"use strict";e.d(B,{o:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(37151),s=e(63142),m=e(53568),a=e(79233),l=e(37864),f=e(3431);const h=14;function u({value:i,onChange:x,Component:g,className:p,placeholder:c,inputPlaceholder:y,disabled:P,autofocus:d=!1,onExpandedChange:D,...b}){const E=(0,r.useRef)(null),[v,C]=(0,r.useState)(i),[S,O]=(0,r.useState)((0,m.kD)((i||"").toString(),h).width),[I,,R,T]=(0,f.Q)(d,D),L=(0,s.of)(l.m);if((0,o.A)(E,()=>{T(!1),x(v)}),!R)return(0,t.jsx)(I,{disabled:P,Component:g||(0,t.jsx)(a.c,{className:(0,n.cx)(L.segment,{[L.queryPlaceholder]:c!==void 0&&!v,[L.disabled]:P},p),children:i||c})});const K=(0,n.css)({width:`${Math.max(S+20,32)}px`});return(0,t.jsx)("input",{...b,ref:E,autoFocus:!0,className:(0,n.cx)("gf-form gf-form-input",K),value:v,placeholder:y,onChange:A=>{const{width:W}=(0,m.kD)(A.target.value,h);O(W),C(A.target.value)},onBlur:()=>{T(!1),x(v)},onKeyDown:A=>{[13,27].includes(A.keyCode)&&(T(!1),x(v))}})}},52042:(ee,B,e)=>{"use strict";e.d(B,{L:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(97095),s=e(79233);const m=({label:l,htmlFor:f,children:h,fill:u})=>{const i=(0,r.of)(a);return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.C,{children:[(0,t.jsx)(s.c,{htmlFor:f,width:12,className:i.label,children:l}),h,u&&(0,t.jsx)("div",{className:i.fill,children:(0,t.jsx)(s.c,{children:""})})]})})},a=l=>({label:(0,n.css)({color:l.colors.primary.text}),fill:(0,n.css)({flexGrow:1,marginBottom:l.spacing(.5)})})},89467:(ee,B,e)=>{"use strict";e.d(B,{a:()=>s});var t=e(74848),n=e(96540),r=e(63142),o=e(18857);function s({value:m,placeholder:a="",options:l=[],onChange:f,onClickOutside:h,loadOptions:u=void 0,width:i,noOptionsMessage:x="",allowCustomValue:g=!1,allowEmptyValue:p=!1,...c}){const y=(0,n.useRef)(null),P=(0,r.$j)();let d=i>0?i/P.spacing.gridSize:void 0,D,b={};return u?(D=o.DW,b={loadOptions:u,defaultOptions:!0}):D=o.l6,(0,t.jsx)("div",{...c,ref:y,children:(0,t.jsx)(D,{width:d,noOptionsMessage:x,placeholder:a,autoFocus:!0,isOpen:!0,onChange:f,options:l,value:m,closeMenuOnSelect:!1,onCloseMenu:()=>{if(y&&y.current){const E=y.current.querySelector('input[id^="react-select-"]');E&&(E.value||p)?f({value:E.value,label:E.value}):h()}},allowCustomValue:g,...b})})}},37864:(ee,B,e)=>{"use strict";e.d(B,{m:()=>n});var t=e(22803);const n=r=>{const o="v1"in r?r.v1.palette:r.palette;return{segment:(0,t.css)({cursor:"pointer",width:"auto"}),queryPlaceholder:(0,t.css)({color:o.gray2}),disabled:(0,t.css)({cursor:"not-allowed",opacity:.65,boxShadow:"none"})}}},3431:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>s});var t=e(74848),n=e(96540),r=e(63142),o=e(45861);const s=(m,a)=>
32{const l=(0,n.useRef)(null),f=(0,r.of)(o.my),[h,u]=(0,n.useState)(m),[i,x]=(0,n.useState)(0),g=c=>{u(c),a&&a(c)};return[({Component:c,onClick:y,disabled:P})=>(0,t.jsx)("button",{type:"button",className:f,ref:l,disabled:P,onClick:()=>{g(!0),l&&l.current&&x(l.current.clientWidth*1.25),y?.()},children:c}),i,h,g]}},82143:(ee,B,e)=>{"use strict";e.d(B,{u:()=>x});var t=e(2543),n=e.n(t),r=e(96540),o=e(13752),s=e(62467),m=e(11150),a=e(96083),l=e(63720),f=e(59099),h=e(8934),u=e(90811);function i(g){return{label:g,value:stringToMs(g)}}class x extends r.PureComponent{constructor(p){super(p),this.propsSubject=new o.B,this.subscription=null}componentDidMount(){this.subscription=this.propsSubject.pipe((0,l.n)(p=>u.cC.isLive(p.interval)?(0,s.of)({}):p.loading?m.t:(0,a.Y)((0,h.dc)(p.interval))),(0,f.M)(()=>this.props.func())).subscribe(),this.propsSubject.next(this.props)}componentDidUpdate(p){u.cC.isLive(p.interval)&&u.cC.isLive(this.props.interval)||(0,t.isEqual)(p,this.props)||this.propsSubject.next(this.props)}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe(),this.propsSubject.unsubscribe()}render(){return null}}},59795:(ee,B,e)=>{"use strict";e.d(B,{I1:()=>d,_$:()=>p,gl:()=>i});var t=e(2543),n=e.n(t),r=e(38919),o=e(46644),s=e(33553),m=e(35987),a=e(64394),l=e(60519),f=e(36394),h=e(739);const u=["reduceOptions","orientation"];function i(E,v,C){let S=E.options;if(E.fieldConfig=E.fieldConfig||{defaults:{},overrides:[]},v==="singlestat"&&C.angular)return g(E,C);if(v==="graph")return x(E,C);for(const O of u)C.hasOwnProperty(O)&&(S[O]=(0,t.cloneDeep)(C[O]));return S}function x(E,v){const C=v.angular,S={orientation:r.wV.Auto,reduceOptions:{values:!1,calcs:[]},legend:{displayMode:h.lm.List,showLegend:!0,placement:"bottom",calcs:[]}};if(C.xaxis?.mode==="series"){E.fieldConfig={...E.fieldConfig,defaults:{...E.fieldConfig.defaults,color:{mode:"palette-classic"}}},C.xaxis.values&&(S.reduceOptions.calcs=b(C.xaxis.values));const O=C.legend;if(O){if(O.show?S.legend.displayMode=O.alignAsTable?h.lm.Table:h.lm.List:S.legend.showLegend=!1,O.rightSide&&(S.legend.placement="right"),O.values){const I=(0,t.pickBy)(O,t.identity);S.legend.calcs=D(I)}O.sideWidth&&(S.legend.width=O.sideWidth)}}return S}function g(E,v){const C=v.angular,S=o.AS.getIfExists(C.valueName),O={reduceOptions:{calcs:[S?S.id:o.gy.mean]},orientation:r.wV.Horizontal},I={};if(C.format&&(I.unit=C.format),C.tableColumn&&(O.reduceOptions.fields=`/^${C.tableColumn}$/`),C.nullPointMode&&(I.nullValueMode=C.nullPointMode),C.nullText&&(I.noValue=C.nullText),(C.decimals||C.decimals===0)&&(I.decimals=C.decimals),C.thresholds&&C.colors){const T=C.thresholds.split(",").map(K=>Number(K.trim())),L=[];for(const K of C.colors){const A=L.length-1;A>=0?L.push({value:T[A],color:K}):L.push({value:-1/0,color:K})}I.thresholds={mode:s.O.Absolute,steps:L}}const R=(0,m.bh)(C,I.thresholds);return R&&R.length&&(I.mappings=R),C.gauge&&C.gauge.show&&(I.min=C.gauge.minValue,I.max=C.gauge.maxValue),E.fieldConfig.defaults=I,O}function p(E){if(!E.options)return{reduceOptions:{calcs:[o.gy.mean]},orientation:r.wV.Horizontal};const v=parseFloat(E.pluginVersion||"6.1");let C=E.options;v<6.2&&(C=y(C)),v<6.3&&(C=c(C));const{fieldOptions:S}=C;if(v<6.6&&S){if(S&&S.override){const{override:R,...T}=C.fieldOptions;C={...C,fieldOptions:{...T,overrides:[]}}}let O=S?.defaults?.thresholds;O?delete S.defaults.thresholds:(O=S?.thresholds,delete S.thresholds),O&&(S.defaults.thresholds={mode:s.O.Absolute,steps:O});const{defaults:I}=S;I.color&&typeof I.color=="string"&&(I.color={mode:a.Y.Fixed,fixedColor:I.color}),(0,l.BF)(I)}if(v<7&&(E.fieldConfig=E.fieldConfig||{defaults:{},overrides:[]},E.fieldConfig={defaults:S&&S.defaults?{...E.fieldConfig.defaults,...S.defaults}:E.fieldConfig.defaults,overrides:S&&S.overrides?[...E.fieldConfig.overrides,...S.overrides]:E.fieldConfig.overrides},S&&(C.reduceOptions={values:S.values,limit:S.limit,calcs:S.calcs}),delete C.fieldOptions),v<7.1){const O=E.fieldConfig.defaults.title;O!=null&&(E.fieldConfig.defaults.displayName=O,delete E.fieldConfig.defaults.title)}if(v<8){const O=E.fieldConfig?.defaults;let I=O?.unit;I==="percent"?((0,t.isNumber)(O.min)||(O.min=0),(0,t.isNumber)(O.max)||(O.max=100)):I==="percentunit"&&((0,t.isNumber)(O.min)||(O.min=0),(0,t.isNumber)(O.max)||(O.max=1))}return C}function c(E){const{fieldOptions:v}=E;if(!v)return E;const{mappings:C,...S}=E.fieldOptions;let O;return E.thresholds&&(O={mode:s.O.Absolute,steps:P(E.thresholds)}),{...E,fieldOptions:{...S,defaults:{...v.defaults,mappings:C,thresholds:O}}}}function y(E){const{valueOptions:v}=E;if(!v)return E;const C={},S={};if(C.mappings=E.valueMappings,C.thresholds=E.thresholds,C.defaults=S,S.unit=v.unit,S.decimals=v.decimals,v.stat){const I=o.AS.get(v.stat);I&&(C.calcs=[I.id])}S.min=E.minValue,S.max=E.maxValue;const O={...E,fieldOptions:C};return(0,t.omit)(O,"valueMappings","thresholds","valueOptions","minValue","maxValue")}function P(E){if(!E||!E.length)return;const v=E.map(C=>({value:C.value===null?-1/0:C.value,color:C.color}));return(0,f.RU)(v),v[0].value=-1/0,v}function d(E){return(0,m.bh)(E)}function D(E){const v=[];for(const C in E){const S=o.AS.getIfExists(C);S&&v.push(S.id)}return v}function b(E){const v=[];return E?.forEach(C=>{Object.values(o.gy).includes(C)?v.push(C):C==="current"?v.push(o.gy.lastNotNull):C==="total"?v.push(o.gy.sum):C==="avg"&&v.push(o.gy.mean)}),E?v:[o.gy.sum]}},21103:(ee,B,e)=>{"use strict";e.d(B,{F:()=>i});var t=e(74848),n=e(22803),r=e(17437),o=e(55168),s=e(96540),m=e(63142),a=e(80427);const l=x=>{const{value:g,children:p,visible:c,placement:y,tipFormatter:P,...d}=x,D=(0,s.useRef)(null),b=(0,s.useRef)(null),E=(0,m.of)(f);function v(){b.current!==null&&cancelAnimationFrame(b.current)}function C(){b.current=requestAnimationFrame(()=>{D.current?.forceAlign()})}return(0,s.useEffect)(()=>(c?C():v(),v),[g,c]),(0,t.jsx)(a.A,{overlayClassName:E.tooltip,placement:y,overlay:P??g,overlayInnerStyle:{minHeight:"auto"},ref:D,visible:c,...d,children:p})},f=x=>({tooltip:(0,n.css)({position:"absolute",display:"block",visibility:"visible",fontSize:x.typography.bodySmall.fontSize,opacity:.9,padding:3,zIndex:x.zIndex.tooltip})}),h=l;var u=e(91302);const i=({min:x,max:g,onChange:p,onAfterChange:c,orientation:y="horizontal",reverse:P,step:d,formatTooltipResult:D,value:b,tooltipAlwaysVisible:E=!0})=>{const v=(0,s.useCallback)(R=>{p?.(typeof R=="number"?[R,R]:R)},[p]),C=(0,s.useCallback)(R=>{c?.(typeof R=="number"?[R,R]:R)},[c]),S=y==="horizontal",O=(0,m.of)(u.$,S),I=(R,T)=>(0,t.jsx)(h,{value:T.value,visible:E||T.dragging,tipFormatter:D?()=>D(T.value):void 0,placement:S?"top":"right",children:R});return(0,t.jsxs)("div",{className:(0,n.cx)(O.container,O.slider),children:[(0,t.jsx)(r.Global,{styles:O.tooltip}),(0,t.jsx)(o.A,{min:x,max:g,step:d,defaultValue:b,range:!0,onChange:v,onCh
32angeComplete:C,vertical:!S,reverse:P,handleRender:I})]})};i.displayName="RangeSlider"},91302:(ee,B,e)=>{"use strict";e.d(B,{$:()=>r});var t=e(22803),n=e(17437);const r=(o,s,m=!1)=>{const{spacing:a}=o,l=o.colors.border.strong,f=o.colors.primary.main,h=o.colors.primary.main,i=`box-shadow: 0px 0px 0px 6px ${o.colors.primary.transparent}`;return{container:(0,t.css)({width:"100%",margin:s?"inherit":a(1,3,1,1),paddingBottom:s&&m?o.spacing(1):"inherit",height:s?"auto":"100%"}),slider:(0,t.css)` 33 .rc-slider { 34 display: flex; 35 flex-grow: 1; 36 margin-left: 7px; // half the size of the handle to align handle to the left on 0 value 37 } 38 .rc-slider-mark { 39 top: ${o.spacing(1.75)}; 40 } 41 .rc-slider-mark-text { 42 color: ${o.colors.text.disabled}; 43 font-size: ${o.typography.bodySmall.fontSize}; 44 } 45 .rc-slider-mark-text-active { 46 color: ${o.colors.text.primary}; 47 } 48 .rc-slider-handle { 49 border: none; 50 background-color: ${h}; 51 box-shadow: ${o.shadows.z1}; 52 cursor: pointer; 53 opacity: 1; 54 } 55 56 .rc-slider-handle:hover, 57 .rc-slider-handle:active, 58 .rc-slider-handle-click-focused:focus { 59 ${i}; 60 } 61 62 // The triple class names is needed because that's the specificity used in the source css :( 63 .rc-slider-handle-dragging.rc-slider-handle-dragging.rc-slider-handle-dragging, 64 .rc-slider-handle:focus-visible { 65 box-shadow: 0 0 0 5px ${o.colors.text.primary}; 66 } 67 68 .rc-slider-dot, 69 .rc-slider-dot-active { 70 background-color: ${o.colors.text.primary}; 71 border-color: ${o.colors.text.primary}; 72 } 73 74 .rc-slider-track { 75 background-color: ${f}; 76 } 77 .rc-slider-rail { 78 background-color: ${l}; 79 cursor: pointer; 80 } 81 `,tooltip:(0,n.css)` 82 body { 83 .rc-slider-tooltip { 84 cursor: grab; 85 user-select: none; 86 z-index: ${o.zIndex.tooltip}; 87 } 88 89 .rc-slider-tooltip-inner { 90 color: ${o.colors.text.primary}; 91 background-color: transparent !important; 92 border-radius: 0; 93 box-shadow: none; 94 } 95 96 .rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow { 97 display: none; 98 } 99 100 .rc-slider-tooltip-placement-top { 101 padding: 0; 102 } 103 } 104 `,sliderInput:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center",width:"100%"}),sliderInputVertical:(0,t.css)({flexDirection:"column",height:"100%",".rc-slider":{margin:0,order:2}}),sliderInputField:(0,t.css)({marginLeft:o.spacing(3),input:{textAlign:"center"}}),sliderInputFieldVertical:(0,t.css)({margin:`0 0 ${o.spacing(3)} 0`,order:1})}}},53431:(ee,B,e)=>{"use strict";e.d(B,{O:()=>y});var t=e(74848),n=e(2543),r=e(96540),o=e(34455),s=e(76732),m=e(95004),a=e(76637),l=e(739),f=e(92790),h=e(47276),u=e(36192),i=e(8721),x=e(41119),g=e(63409);function p(P,d){const D=P.y.values.length,b={...P.y.config,...d},E=P.x??{name:"",values:[...Array(D).keys()],type:m.PU.number,config:{}};let v={refId:"sparkline",fields:[E,{...P.y,config:b}],length:D};return(0,i.g2)(E.values)||(v=(0,x.ES)(v,0)),(0,g.M)({frame:v,refFieldPseudoMin:P.timeRange?.from.valueOf(),refFieldPseudoMax:P.timeRange?.to.valueOf()})}const c={drawStyle:l.GR.Line,showPoints:l.yL.Auto,axisPlacement:l.vM.Hidden,pointSize:2};class y extends r.PureComponent{constructor(d){super(d);const D=p(d.sparkline,d.config);this.state={data:(0,u.bq)(D,(0,u.ro)(D)),alignedDataFrame:D,configBuilder:this.prepareConfig(D)}}static getDerivedStateFromProps(d,D){const b=p(d.sparkline,d.config),E=(0,o.C)(b);return E?{...D,data:(0,u.bq)(E,(0,u.ro)(E)),alignedDataFrame:E}:{...D}}componentDidUpdate(d,D){const{alignedDataFrame:b}=this.state;if(!b)return;let E=!1;if(d.sparkline!==this.props.sparkline){const v=!(0,s.bW)(this.state.alignedDataFrame,D.alignedDataFrame),C=!(0,n.isEqual)(b.fields[1].state?.range,D.alignedDataFrame.fields[1].state?.range);E=v||C}else E=!(0,n.isEqual)(d.config,this.props.config);E&&this.setState({configBuilder:this.prepareConfig(b)})}getYRange(d){let{min:D,max:b}=this.state.alignedDataFrame.fields[1].state?.range;const E=+this.state.alignedDataFrame.fields[1].config?.noValue;return Number.isNaN(E)||(D=Math.min(D,+E),b=Math.max(b,+E)),D===b?(D===0?b=100:(D=0,b*=2),[D,b]):[Math.max(D,d.config.min??-1/0),Math.min(b,d.config.max??1/0)]}prepareConfig(d){const{theme:D}=this.props,b=new h.e;b.setCursor({show:!1,x:!1,y:!1});const E=d.fields[0];b.addScale({scaleKey:"x",orientation:l.Lt.Horizontal,direction:l.ON.Right,isTime:!1,range:()=>{const{sparkline:v}=this.props;if(v.x){if(v.timeRange&&v.x.type===m.PU.time)return[v.timeRange.from.valueOf(),v.timeRange.to.valueOf()];const C=v.x.values;return[C[0],C[C.length-1]]}return[0,v.y.values.length-1]}}),b.addAxis({scaleKey:"x",theme:D,placement:l.vM.Hidden});for(let v=0;v<d.fields.length;v++){const C=d.fields[v],S=C.config,O={...c,...S.custom};if(C===E||C.type!==m.PU.number)continue;const I=S.unit||"__fixed";b.addScale({scaleKey:I,orientation:l.Lt.Vertical,direction:l.ON.Up,range:()=>this.getYRange(C)}),b.addAxis({scaleKey:I,theme:D,placement:l.vM.Hidden});const R=(0,a.Qi)(C),T=R.getCalculator(C,D)(0,0),L=O.drawStyle===l.GR.Points?l.yL.Always:O.showPoints;b.addSeries({pxAlign:!1,scaleKey:I,theme:D,colorMode:R,thresholds:S.thresholds,drawStyle:O.drawStyle,lineColor:O.lineColor??T,lineWidth:O.lineWidth,lineInterpolation:O.lineInterpolation,showPoints:L,pointSize:O.pointSize,fillOpacity:O.fillOpacity,fillColor:O.fillColor,lineStyle:O.lineStyle,gradientMode:O.gradientMode,spanNulls:O.spanNulls})}return b}render(){const{data:d,configBuilder:D}=this.state,{width:b,height:E}=this.props;return(0,t.jsx)(f.Z,{data:d,config:D,width:b,height:E})}}},93008:(ee,B,e)=>{"use strict";e.d(B,{h:()=>u});var t=e(22803),n=e(2543),r=e.n(n),o=e(96540),s=e(63142),m=e(45897);const a=.3,l=new Set(["ArrowUp","ArrowDown"]),f=new Set(["ArrowLeft","ArrowRight"]),h={row:{dim:"width",axis:"clientX",min:"minWidth",max:"maxWidth"},column:{dim:"height",axis:"clientY",min:"minHeight",max:"maxHeight"}};function u(c){const{direction:y,initialSize:P=c.usePixels?300:.5,dragPosition:d="middle",onResizing:D,onSizeChanged:b,usePixels:E}=c,v=p(c.handleSize),C=(0,o.useRef)(null),S=(0,o.useRef)(null),O=(0,o.useRef)(null),I=(0,o.useRef)(null),R=(0,o.useRef)(null),T=(0,o.useRef)(null),L=(0,o.useRef)(void 0),K=(0,o.useRef)(void 0),A=h[y].dim,W=h[y].axis,N=h[y].min,w=h[y].max,j=(0,o.useRef)(null),V=(0,o.useCallback)(ie=>{!S.current||!O.current||(T.current=S.current.getBoundingClientRect()[A],R.current=I.current.getBoundingClientRect()[A],j.current=ie[W],C.current.setPointerCapture(ie.pointerId),E?L.current=x(O.current,E):L.current=x(S.current),K.current=void 0)},[A,W,E]),U=(0,o.useCallback)(ie=>{if(!R.current||!T.current||!O.current)return;const fe=T.current,pe=R.current-fe-v,de=L.current;if(E){const le=(0,n.clamp)(pe-ie,de[N],de[w]);O.current.style.flexBasis=`${le}px`,C.current.ariaValueNow=`${le}`,D?.(le,fe+ie,le)}else{const le=(0,n.clamp)(T.current+ie,de[N],de[w]),me=le/(R.current-v);S.current.style.flexGrow=`${me}`,O.current.style.flexGrow=`${1-me}`,C.current.ariaValueNow=i(le,de[N],de[w]),D?.(me,le,pe-ie)}},[D,v,E,N,w]),F=(0,o.useCallback)(ie=>{j.current!==null&&U(ie[W]-j.current)},[U,W]),M=(0,o.useCallback)(ie=>{ie.preventDefault(),ie.stopPropagation(),j.current=null,C.current.releasePointerCapture(ie.pointerId);const fe=S.current.getBoundingClientRect()[A],pe=R.current-fe-v;b?.(parseFloat(S.current.style.flexGrow),fe,pe)},[b,v,A]),H=(0,o.useRef)(new Set),_=(0,o.useRef)(null),Z=(0,o.useCallback)(ie=>{if(H.current.size===0){_.current=null;return}else if(T.current===null)return;const de=(ie-(_.current??ie))*a;let le=0;y==="row"?(H.current.has("ArrowLeft")&&(le-=de),H.current.has("ArrowRight")&&(le+=de)):(H.current.has("ArrowUp")&&(le-=de),H.current.has("ArrowDown")&&(le+=de)),T.current=S.current.getBoundingClientRect()[A],R.current=I.current.getBoundingClientRect()[A],U(le),_.current=ie,window.requestAnimationFrame(Z)},[y,A,U]),ne=(0,o.useCallback)(ie=>
104{if(!S.current||!O.current||!C.current||!I.current||!(y==="column"&&l.has(ie.key)||y==="row"&&f.has(ie.key))||H.current.has(ie.key))return;if(K.current=void 0,ie.preventDefault(),ie.stopPropagation(),T.current=S.current.getBoundingClientRect()[A],R.current=I.current.getBoundingClientRect()[A],E?L.current=x(O.current):L.current=x(S.current),!H.current.has(ie.key)){const pe=H.current.size===0;H.current.add(ie.key),pe&&window.requestAnimationFrame(Z)}},[y,Z,,A,E]),te=(0,o.useCallback)(ie=>{if(!(y==="row"&&!f.has(ie.key)||y==="column"&&!l.has(ie.key))&&(H.current.delete(ie.key),T.current!==null)){const fe=R.current-T.current-v;b?.(parseFloat(S.current.style.flexGrow),T.current,fe)}},[y,b,v]),Y=(0,o.useCallback)(()=>{!S.current||!O.current||(E?O.current.style.flexBasis=`${P}px`:(S.current.style.flexGrow="0.5",O.current.style.flexGrow="0.5",T.current=S.current.getBoundingClientRect()[A],C.current.ariaValueNow="50"))},[A,E,P]),Q=(0,o.useCallback)(()=>{if(H.current.size>0&&(H.current.clear(),j.current=null,typeof T.current=="number")){const ie=R.current-T.current-v;b?.(parseFloat(S.current.style.flexGrow),T.current,ie)}},[b,v]),J=(0,s.of)(g,y),q=(0,s.of)(m.l,d),X=y==="column"?q.dragHandleHorizontal:q.dragHandleVertical,se=(0,o.useId)(),oe={flexGrow:(0,n.clamp)(P,0,1),[N]:"min-content"},ae={flexGrow:(0,n.clamp)(1-P,0,1),[N]:"min-content"};return E&&(oe.flexGrow=1,ae.flexGrow="unset",ae.flexBasis=`${P}px`),{containerProps:{ref:I,className:J.container},primaryProps:{ref:S,className:J.panel,style:oe},secondaryProps:{ref:O,className:J.panel,style:ae},splitterProps:{onPointerUp:M,onPointerDown:V,onPointerMove:F,onKeyDown:ne,onKeyUp:te,onDoubleClick:Y,onBlur:Q,ref:C,style:{[A]:`${v}px`},role:"separator","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":P*100,"aria-controls":`start-panel-${se}`,"aria-label":"Pane resize widget",tabIndex:0,className:X}}}function i(c,y,P){return`${(0,n.clamp)((c-y)/(P-y)*100,0,100)}`}function x(c,y){const P=document.body.style.overflow,d=c.style.width,D=c.style.height,b=c.style.flexGrow,E=c.style.flexBasis;document.body.style.overflow="hidden",c.style.flexGrow="0",c.style.flexBasis="0";const{width:v,height:C}=c.getBoundingClientRect();c.style.flexGrow="100";const{width:S,height:O}=c.getBoundingClientRect();return document.body.style.overflow=P,c.style.width=d,c.style.height=D,c.style.flexGrow=b,c.style.flexBasis=E,{minWidth:v,maxWidth:S,minHeight:C,maxHeight:O}}function g(c,y){return{container:(0,t.css)({display:"flex",flexDirection:y==="row"?"row":"column",width:"100%",flexGrow:1,overflow:"hidden"}),panel:(0,t.css)({display:"flex",position:"relative",flexBasis:0})}}function p(c="md"){return{xs:4,sm:8,md:16,lg:32}[c]}},34107:(ee,B,e)=>{"use strict";e.d(B,{S:()=>a});var t=e(74848),n=e(2543),r=e.n(n),o=e(96540),s=e(46644),m=e(18857);class a extends o.PureComponent{constructor(){super(...arguments),this.checkInput=()=>{const{stats:f,allowMultiple:h,defaultStat:u,onChange:i}=this.props,x=s.AS.list(f);if(x.length!==f.length){const g=x.map(c=>c.id),p=(0,n.difference)(f,g);console.warn("Unknown stats",p,f),i(x.map(c=>c.id))}!h&&f.length>1&&(console.warn("Removing extra stat",f),i([f[0]])),u&&f.length<1&&i([u])},this.onSelectionChange=f=>{const{onChange:h}=this.props;Array.isArray(f)?h(f.map(u=>u.value)):h(f&&f.value?[f.value]:[])}}static{this.defaultProps={allowMultiple:!1}}componentDidMount(){this.checkInput()}componentDidUpdate(f){this.checkInput()}render(){const{stats:f,allowMultiple:h,defaultStat:u,placeholder:i,className:x,menuPlacement:g,width:p,inputId:c,filterOptions:y}=this.props,P=s.AS.selectOptions(f,y);return(0,t.jsx)(m.l6,{value:P.current,className:x,isClearable:!u,isMulti:h,width:p,isSearchable:!0,options:P.options,placeholder:i,onChange:this.onSelectionChange,menuPlacement:g,inputId:c})}}},21285:(ee,B,e)=>{"use strict";e.d(B,{K:()=>u,d:()=>h});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(96540),m=e(37615),a=e(63142),l=e(35484),f=e(30703);const h=(0,s.forwardRef)(({value:x,checked:g,onChange:p,id:c,label:y,disabled:P,invalid:d=!1,...D},b)=>{g&&(0,m.l)("Switch","checked prop","value");const E=(0,a.of)(i),v=(0,s.useRef)(c||(0,r.uniqueId)("switch-"));return(0,t.jsxs)("div",{className:(0,n.cx)(E.switch,d&&E.invalid),children:[(0,t.jsx)("input",{type:"checkbox",role:"switch",disabled:P,checked:x,onChange:C=>{!P&&p?.(C)},id:v.current,...D,ref:b}),(0,t.jsx)("label",{htmlFor:v.current,"aria-label":y,children:(0,t.jsx)(f.I,{name:"check",size:"xs"})})]})});h.displayName="Switch";const u=(0,s.forwardRef)(({transparent:x,className:g,showLabel:p,label:c,value:y,id:P,invali
104d:d,...D},b)=>{const E=(0,a.of)(i,x);return(0,t.jsxs)("div",{className:(0,n.cx)(E.inlineContainer,g,D.disabled&&E.disabled,d&&E.invalid),children:[p&&(0,t.jsx)("label",{htmlFor:P,className:(0,n.cx)(E.inlineLabel,y&&E.inlineLabelEnabled,"inline-switch-label"),children:c}),(0,t.jsx)(h,{...D,id:P,label:c,ref:b,value:y})]})});u.displayName="Switch";const i=(x,g)=>({switch:(0,n.css)({width:x.spacing(4),height:x.spacing(2),position:"relative",lineHeight:1,input:{height:"100%",width:"100% !important",opacity:0,zIndex:-1e3,position:"absolute","&:checked + label":{background:x.colors.primary.main,borderColor:x.colors.primary.main,"&:hover":{background:x.colors.primary.shade},svg:{transform:`translate3d(${x.spacing(2.25)}, -50%, 0)`,background:x.colors.primary.contrastText,color:x.colors.primary.main}},"&:disabled + label":{background:x.colors.action.disabledBackground,borderColor:x.colors.border.weak,cursor:"not-allowed",svg:{background:x.colors.text.disabled}},"&:disabled:checked + label":{background:x.colors.primary.transparent,svg:{color:x.colors.primary.contrastText}},"&:focus + label, &:focus-visible + label":(0,l.getFocusStyles)(x),"&:focus:not(:focus-visible) + label":(0,l.getMouseFocusStyles)(x)},label:{width:"100%",height:"100%",cursor:"pointer",borderRadius:x.shape.radius.pill,background:x.components.input.background,border:`1px solid ${x.components.input.borderColor}`,transition:"all 0.3s ease","&:hover":{borderColor:x.components.input.borderHover},svg:{position:"absolute",display:"block",color:"transparent",width:x.spacing(1.5),height:x.spacing(1.5),borderRadius:x.shape.radius.circle,background:x.colors.text.secondary,boxShadow:x.shadows.z1,left:0,top:"50%",transform:`translate3d(${x.spacing(.25)}, -50%, 0)`,transition:"transform 0.2s cubic-bezier(0.19, 1, 0.22, 1)","@media (forced-colors: active)":{border:`1px solid ${x.colors.primary.contrastText}`}}}}),inlineContainer:(0,n.css)({padding:x.spacing(0,1),height:x.spacing(x.components.height.md),display:"inline-flex",alignItems:"center",background:g?"transparent":x.components.input.background,border:`1px solid ${g?"transparent":x.components.input.borderColor}`,borderRadius:x.shape.radius.default,"&:hover":{border:`1px solid ${g?"transparent":x.components.input.borderHover}`,".inline-switch-label":{color:x.colors.text.primary}}}),disabled:(0,n.css)({backgroundColor:"rgba(204, 204, 220, 0.04)",color:"rgba(204, 204, 220, 0.6)",border:"1px solid rgba(204, 204, 220, 0.04)"}),inlineLabel:(0,n.css)({cursor:"pointer",paddingRight:x.spacing(1),color:x.colors.text.secondary,whiteSpace:"nowrap"}),inlineLabelEnabled:(0,n.css)({color:x.colors.text.primary}),invalid:(0,n.css)({"input + label, input:checked + label, input:hover + label":{border:`1px solid ${x.colors.error.border}`}})})},86848:(ee,B,e)=>{"use strict";e.d(B,{q:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(76319),s=e(54314),m=e(60208),a=e(13941),l=e(63142),f=e(31286),h=e(92807);function u({tabs:x,defaultTab:g,closeIconTooltip:p,onClose:c,testId:y}){const[P,d]=(0,r.useState)(x.some(E=>E.value===g)?g:x[0].value),D=(0,l.of)(i),b=E=>{d(E.value)};return(0,t.jsxs)("div",{className:D.container,"data-testid":y,children:[(0,t.jsxs)(s.U,{className:D.tabs,children:[x.map(E=>(0,t.jsx)(m.o,{label:E.label,active:E.value===P,onChangeTab:()=>b(E),icon:E.icon},E.value)),(0,t.jsx)(f.a,{grow:1,display:"flex",justifyContent:"flex-end",paddingRight:1,children:(0,t.jsx)(o.K,{size:"lg",onClick:c,name:"times",tooltip:p??"Close"})})]}),(0,t.jsx)(h.P,{children:(0,t.jsx)(a.J,{className:D.tabContent,children:x.find(E=>E.value===P)?.content})})]})}const i=x=>
104({container:(0,n.css)({height:"100%",display:"flex",flexDirection:"column",flex:"1 1 0",minHeight:0}),tabContent:(0,n.css)({padding:x.spacing(2),backgroundColor:x.colors.background.primary,flex:1}),tabs:(0,n.css)({paddingTop:x.spacing(.5),borderColor:x.colors.border.weak,ul:{marginLeft:x.spacing(2)}})})},93948:(ee,B,e)=>{"use strict";e.d(B,{a:()=>x,t:()=>i});var t=e(74848),n=e(79118),r=e(41119),o=e(55386),s=e(95004),m=e(739),a=e(63142),l=e(53568),f=e(21539),h=e(53431),u=e(74198);const i={type:m.ob.Sparkline,drawStyle:m.GR.Line,lineInterpolation:m.dx.Smooth,lineWidth:1,fillOpacity:17,gradientMode:m.on.Hue,pointSize:2,barAlignment:m.Nj.Center,showPoints:m.yL.Never,hideValue:!1},x=c=>{const{field:y,innerWidth:P,tableStyles:d,cell:D,cellProps:b,timeRange:E}=c,v=g(D.value),C=(0,a.$j)();if(!v)return(0,t.jsx)("div",{...b,className:d.cellContainer,children:y.config.noValue||"no data"});v.x&&!v.x.config.interval&&v.x.values.length>1&&(v.x.config.interval=v.x.values[1]-v.x.values[0]),v.y.values=v.y.values.map(K=>Number.isFinite(K)?K:null);const S=(0,n.AP)(v.y);v.y.config.min=S.min,v.y.config.max=S.max,v.y.state={range:S},v.timeRange=E;const O=p(y),I={color:y.config.color,custom:{...i,...O}},R=y.config.custom?.cellOptions?.hideValue;let T=0,L=null;if(!R){const K=(0,r.LI)(D.value)?D.value.value:null,A=y.display(K),W=(0,u.zi)(y,A,D.row.index);T=(0,l.kD)((0,o.cN)(W),16).width+C.spacing.gridSize,L=(0,t.jsx)(f.i,{style:{width:`${T-C.spacing.gridSize}px`,textAlign:"right",marginRight:C.spacing(1)},value:A})}return(0,t.jsxs)("div",{...b,className:d.cellContainer,children:[L,(0,t.jsx)("div",{children:(0,t.jsx)(h.O,{width:P-T,height:d.cellHeightInner,sparkline:v,config:I,theme:d.theme})})]})};function g(c){if(Array.isArray(c))return{y:{name:"test",type:s.PU.number,values:c,config:{}}};if((0,r.ci)(c)){const y=c.fields.find(d=>d.type===s.PU.time),P=c.fields.find(d=>d.type===s.PU.number);if(y&&P)return{x:y,y:P}}}function p(c){let y=(0,u.bk)(c);if(y.type===m.ob.Auto&&(y={...y,type:m.ob.Sparkline}),y.type===m.ob.Sparkline)return y;throw new Error(`Expected options type ${m.ob.Sparkline} but got ${y.type}`)}},28533:(ee,B,e)=>{"use strict";e.d(B,{n:()=>n});var t=e(74848);const n=({cell:r,tableStyles:o,onCellFilterAdded:s,timeRange:m,userProps:a,frame:l,rowStyled:f,rowExpanded:h,textWrapped:u,height:i,getActions:x,replaceVariables:g,setInspectCell:p})=>{const c=r.getCellProps(),y=r.column.field;if(!y?.display)return null;if(c.style){c.style.wordBreak="break-word",c.style.minWidth=c.style.width;const D=r.column.justifyContent;D==="flex-end"&&!y.config.unit?(c.style.textAlign="right",c.style.direction="rtl",c.style.unicodeBidi="plaintext"):c.style.justifyContent=D}let P=(typeof r.column.width=="number"?r.column.width:24)-o.cellPadding*2;const d=x?x(l,y,r.row.index,g):[];return(0,t.jsx)(t.Fragment,{children:r.render("Cell",{field:y,tableStyles:o,onCellFilterAdded:s,cellProps:c,innerWidth:P,timeRange:m,userProps:a,frame:l,rowStyled:f,rowExpanded:h,textWrapped:u,height:i,actions:d,setInspectCell:p})})}},64780:(ee,B,e)=>{"use strict";e.d(B,{B:()=>i,s:()=>x});var t=e(74848),n=e(2543),r=e.n(n),o=e(96540),s=e(7685),m=e(47931),a=e(8207),l=e(41654),f=e(50992),h=e(54314),u=e(60208),i=(g=>(g.code="code",g.text="text",g))(i||{});function x({value:g,onDismiss:p,mode:c}){let y=g;const[P,d]=(0,o.useState)(c);if((0,n.isString)(g)){const C=g.trim();if(C[0]==="{"||C[0]==="["||c==="code")try{g=JSON.parse(g),y=JSON.stringify(g,null," ")}catch(S){console.log("Failed to parse JSON in Table cell inspector (this will cause JSON to not print nicely): ",S.message)}}else y=JSON.stringify(g);let D=y;const b=[{label:"Plain text",value:"text"},{label:"Code editor",value:"code"}],E=()=>{d(P==="text"?"code":"text")},v=(0,t.jsx)(h.U,{children:b.map((C,S)=>(0,t.jsx)(u.o,{label:C.label,active:C.value===P,onChangeTab:E},`${C.value}-${S}`))});return(0,t.jsx)(a._,{onClose:p,title:(0,s.t)("grafana-ui.table.inspect-drawer-title","Inspect value"),tabs:v,children:(0,t.jsxs)(l.B,{direction:"column",gap:2,children:[(0,t.jsx)(m.b,{icon:"copy",getText:()=>D,style:{marginLeft:"auto",width:"200px"},children:(0,t.jsx)(s.x,{i18nKey:"grafana-ui.table.copy",children:"Copy to Clipboard"})}),P==="code"?(0,t.jsx)(f.B,{width:"100%",height:500,language:"json",showLineNumbers:!0,showMiniMap:(D&&D.length)>100,value:D,readOnly:!0,wordWrap:!0}):(0,t.jsx)("pre",{children:D})]})})}},74533:(ee,B,e)=>{"use strict";e.d(B,{u:()=>l,d:()=>h});var t=e(74848),n=e(96540),r=e(46644),o=e(85629),s=e(22803);const m=u=>{const i=(0,s.css)({width:"100%",listStyle:"none"}),x=(0,s.css)({width:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between"});return u.value&&!Array.isArray(u.value)?(0,t.jsx)("span",{children:u.value}):u.value&&Array.isArray(u.value)&&u.value.length>0?(0,t.jsx)("ul",{className:i,children:u.value.map((g,p)=>{const c=Object.keys(g)[0];return(0,t.jsxs)("li",{className:x,children:[(0,t.jsx)("span",{children:c}),(0,t.jsx)("span",{children:g[c]})]},p)})}):a},a=()=>(0,t.jsx)("span",{children:"\xA0"});function l(u){const{totalColumnsWidth:i,footerGroups:x,isPaginationVisible:g,tableStyles:p}=u,c=o.Tp.components.Panels.Visualization.Table;return(0,t.jsx)("div",{style:{position:g?"relative":"absolute",width:i?`${i}px`:"100%",bottom:"0px"},children:x.map(y=>{const{key:P,...d}=y.getFooterGroupProps();return(0,n.createElement)("div",{className:p.tfoot,...d,key:P,"data-testid":c.footer},y.headers.map(D=>f(D,p)))})})}function f(u,i){const{key:x,...g}=u.getHeaderProps();return g?(g.style=g.style??{},g.style.position="absolute",g.style.justifyContent=u.justifyContent,(0,t.jsx)("div",{className:i.headerCell,...g,children:u.render("Footer")},x)):null}function h(u,i,x){if(i===void 0)return a;
104if(x){if(i[u]===void 0)return a;const g=r.AS.get(r.gy.count).name;return m({value:[{[g]:String(i[u])}]})}return m({value:i[u]})}},24343:(ee,B,e)=>{"use strict";e.d(B,{X:()=>Me});var t=e(74848),n=e(96540),r=e(32885),o=e(46644),s=e(95004),m=e(39884),a=e(36638),l=e(85629),f=e(739),h=e(63142),u=e(7685),i=e(52718),x=e(34213),g=e(64780);function p($e,tt){(0,n.useEffect)(()=>{if($e.current&&tt.current){const Ke=$e.current.querySelector(".track-vertical"),Re=tt.current.firstChild;Re&&Ke&&(Ke.remove(),Re instanceof HTMLElement&&(Re.querySelector(":scope > .track-vertical")?.remove(),Re.append(Ke)))}})}function c($e,tt,Ke,Re){const Ve=JSON.stringify(Object.keys($e.expanded));(0,n.useEffect)(()=>{let Qe=0;Re||(Number.isFinite($e.lastExpandedOrCollapsedIndex)&&(Qe=$e.lastExpandedOrCollapsedIndex),Qe=$e.pageIndex===0?Qe-1:Qe-$e.pageIndex-$e.pageIndex*$e.pageSize),tt.current?.resetAfterIndex(Math.max(Qe,0))},[$e.lastExpandedOrCollapsedIndex,$e.pageSize,$e.pageIndex,tt,Ke,Ve,Re])}var y=e(16515);function P({onColumnResize:$e,onSortByChange:tt,data:Ke}){return(0,n.useCallback)((Re,Ve)=>{switch(Ve.type){case"columnDoneResizing":if($e){const je=Re.columnResizing?.headerIdWidths?.[0]?.[0],ze=parseInt(je,10),Ye=Math.round(Re.columnResizing.columnWidths?.[je]),Ge=Ke.fields?.[ze];if(!Ge)return Re;const ce=(0,y.Ct)(Ge,Ke);$e(ce,Ye)}case"toggleSortBy":if(tt){const Qe=[];for(const je of Re.sortBy){const ze=Ke.fields[parseInt(je.id,10)];ze&&Qe.push({displayName:(0,y.Ct)(ze,Ke),desc:je.desc})}tt(Qe)}case"toggleRowExpanded":if(Ve.id)return{...Re,lastExpandedOrCollapsedIndex:parseInt(Ve.id,10)}}return Re},[Ke,$e,tt])}function d($e,tt){const Ke={};if($e){Ke.sortBy=[];for(const Re of $e)for(const Ve of tt)Ve.Header===Re.displayName&&Ke.sortBy.push({id:Ve.id,desc:Re.desc})}return Ke}var D=e(74198),b=e(74533),E=e(97958),v=e(30703),C=e(22803),S=e(2381),O=e(91793),I=e(55386),R=e(41654),T=e(12737),L=e(15356),K=e(32635),A=e(72636);const W=28,N=W*5,w={Contains:{label:"Contains",value:"Contains",description:"Contains"},"=":{label:"=",value:"=",description:"Equals"},"!=":{label:"!=",value:"!=",description:"Not equals"},">":{label:">",value:">",description:"Greater"},">=":{label:">=",value:">=",description:"Greater or Equal"},"<":{label:"<",value:"<",description:"Less"},"<=":{label:"<=",value:"<=",description:"Less or Equal"},Expression:{label:"Expression",value:"Expression",description:'Bool Expression (Char $ represents the column value in the expression, e.g. "$ >= 10 && $ <= 12")'}},j=Object.values(w),V=w.Contains,U=w.Expression,F=$e=>{if($e=$e.trim().replace(/\\/g,""),/^(\d{4}-\d{2}-\d{2}|\d{4}\/\d{2}\/\d{2})/.test($e)){const Re=new Date($e);if(!isNaN(Re.getTime())){const Ve=(0,I.j_)("dateTimeAsIso");return(0,I.cN)(Ve(Re.getTime()))}}const tt=parseFloat($e);if(!isNaN(tt))return tt;const Ke=$e.toLowerCase();return Ke==="true"||Ke==="false"?Ke==="true":$e},M=({options:$e,values:tt,caseSensitive:Ke,showOperators:Re,onChange:Ve,searchFilter:Qe,setSearchFilter:je,operator:ze,setOperator:Ye})=>{const Ge=(0,n.useMemo)(()=>new RegExp(Qe,Ke?void 0:"i"),[Qe,Ke]),ce=(0,n.useMemo)(()=>$e.filter(Et=>{if(!Re||!Qe||ze.value===V.value)return Et.label===void 0?!1:Ge.test(Et.label);if(ze.value===U.value){if(Et.value===void 0)return!1;try{const Tt=Qe.replace(/\\/g,""),Mt=new Function("$",`'use strict'; return ${Tt};`),wt=F(Et.value);return Mt(wt)}catch{}return!1}else{if(Et.value===void 0)return!1;const Tt=F(Et.value),Mt=F(Qe);switch(ze.value){case"=":return Tt===Mt;case"!=":return Tt!==Mt;case">":return Tt>Mt;case">=":return Tt>=Mt;case"<":return Tt<Mt;case"<=":return Tt<=Mt}return!1}}),[$e,Ge,Re,ze,Qe]),Pe=(0,n.useMemo)(()=>ce.filter(Et=>tt.includes(Et)),[ce,tt]),Se=(0,n.useMemo)(()=>ce.length===Pe.length,[ce,Pe]),Ee=(0,n.useMemo)(()=>Pe.length>0&&ce.length>Pe.length,[ce,Pe]),xe=(0,n.useMemo)(()=>Pe.length?`${Pe.length} selected`:"Select all",[Pe]),ye=(0,n.useMemo)(()=>ce.length!==Pe.length?"Add all displayed values to the filter":"Remove all displayed values from the filter",[ce,Pe]),Oe=(0,h.of)(_),Be=(0,h.$j)().spacing.gridSize,Xe=(0,n.useMemo)(()=>Math.min(ce.length*W,N)+Be,[Be,ce.length]),st=(0,n.useCallback)(Et=>Tt=>{const Mt=Tt.currentTarget.checked?tt.concat(Et):tt.filter(wt=>wt.value!==Et.value);Ve(Mt)},[Ve,tt]),lt=(0,n.useCallback)(()=>
104{if(ce.length===Pe.length){const Et=tt.filter(Tt=>!ce.includes(Tt));Ve(Et)}else{const Et=[...new Set([...tt,...ce])];Ve(Et)}},[Ve,tt,ce,Pe]);return(0,t.jsxs)(R.B,{direction:"column",gap:.25,children:[!Re&&(0,t.jsx)(T.Z,{placeholder:(0,u.t)("grafana-ui.table.filter-placeholder","Filter values"),onChange:je,value:Qe}),Re&&(0,t.jsxs)(R.B,{direction:"row",gap:0,children:[(0,t.jsx)(L.f,{variant:"canvas",options:j,onChange:Ye,value:ze,tooltip:ze.description}),(0,t.jsx)(T.Z,{placeholder:(0,u.t)("grafana-ui.table.filter-placeholder","Filter values"),onChange:je,value:Qe})]}),ce.length>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.Y1,{height:Xe,itemCount:ce.length,itemSize:W,itemData:{items:ce,values:Pe,onCheckedChanged:st,className:Oe.filterListRow},width:"100%",className:Oe.filterList,children:H}),(0,t.jsxs)(R.B,{direction:"column",gap:.25,children:[(0,t.jsx)("div",{className:(0,C.cx)(Oe.selectDivider)}),(0,t.jsx)("div",{className:(0,C.cx)(Oe.filterListRow),children:(0,t.jsx)(K.S,{value:Se,indeterminate:Ee,label:xe,description:ye,onChange:lt})})]})]}):(0,t.jsx)(A.J,{className:Oe.noValuesLabel,children:(0,t.jsx)(u.x,{i18nKey:"grafana-ui.table.no-values-label",children:"No values"})})]})};function H({index:$e,style:tt,data:{onCheckedChanged:Ke,items:Re,values:Ve,className:Qe}}){const je=Re[$e],{value:ze,label:Ye}=je,Ge=Ve.find(ce=>ce.value===ze)!==void 0;return(0,t.jsx)("div",{className:Qe,style:tt,title:Ye,children:(0,t.jsx)(K.S,{value:Ge,label:Ye,onChange:Ke(je)})})}const _=$e=>({filterList:(0,C.css)({label:"filterList"}),filterListRow:(0,C.css)({label:"filterListRow",cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:$e.spacing(.5),":hover":{backgroundColor:$e.colors.action.hover}}),selectDivider:(0,C.css)({label:"selectDivider",width:"100%",borderTop:`1px solid ${$e.colors.border.medium}`,padding:$e.spacing(.5,2)}),noValuesLabel:(0,C.css)({paddingTop:$e.spacing(1)})});var Z=e(8135),ne=e(76319),te=e(45861);const Y=({column:{preFilteredRows:$e,filterValue:tt,setFilter:Ke},onClose:Re,field:Ve,searchFilter:Qe,setSearchFilter:je,operator:ze,setOperator:Ye})=>{const Ge=(0,h.$j)(),ce=(0,n.useMemo)(()=>(0,D.MY)($e,Ve),[$e,Ve]),Pe=(0,n.useMemo)(()=>(0,D.Yz)(ce),[ce]),Se=(0,n.useMemo)(()=>(0,D.Sj)(Pe,tt),[Pe,tt]),[Ee,xe]=(0,n.useState)(Se),[ye,Oe]=(0,n.useState)(!1),we=(0,n.useCallback)(Et=>Re(),[Re]),Be=(0,n.useCallback)(Et=>{const Tt=Ee.length?Ee:void 0;Ke(Tt),Re()},[Ke,Ee,Re]),Xe=(0,n.useCallback)(Et=>{Ke(void 0),Re()},[Ke,Re]),st=(0,n.useMemo)(()=>tt!==void 0,[tt]),lt=(0,h.of)(Q);return(0,t.jsx)(Z.N,{onClick:we,useCapture:!0,children:(0,t.jsx)("div",{className:(0,C.cx)(lt.filterContainer),onClick:J,children:(0,t.jsxs)(R.B,{direction:"column",gap:3,children:[(0,t.jsxs)(R.B,{direction:"column",gap:.5,children:[(0,t.jsxs)(R.B,{justifyContent:"space-between",alignItems:"center",children:[(0,t.jsx)(A.J,{className:lt.label,children:(0,t.jsx)(u.x,{i18nKey:"grafana-ui.table.filter-popup-heading",children:"Filter by values:"})}),(0,t.jsx)(ne.K,{name:"text-fields",tooltip:(0,u.t)("grafana-ui.table.filter-popup-match-case","Match case"),style:{color:ye?Ge.colors.text.link:Ge.colors.text.disabled},onClick:()=>{Oe(Et=>!Et)}})]}),(0,t.jsx)("div",{className:(0,C.cx)(lt.listDivider)}),(0,t.jsx)(M,{onChange:xe,values:Ee,options:Pe,caseSensitive:ye,showOperators:!0,searchFilter:Qe,setSearchFilter:je,operator:ze,setOperator:Ye})]}),(0,t.jsxs)(R.B,{gap:3,children:[(0,t.jsxs)(R.B,{children:[(0,t.jsx)(te.$n,{size:"sm",onClick:Be,children:(0,t.jsx)(u.x,{i18nKey:"grafana-ui.table.filter-popup-apply",children:"Ok"})}),(0,t.jsx)(te.$n,{size:"sm",variant:"secondary",onClick:we,children:(0,t.jsx)(u.x,{i18nKey:"grafana-ui.table.filter-popup-cancel",children:"Cancel"})})]}),st&&(0,t.jsx)(R.B,{children:(0,t.jsx)(te.$n,{fill:"text",size:"sm",onClick:Xe,children:(0,t.jsx)(u.x,{i18nKey:"grafana-ui.table.filter-popup-clear",children:"Clear filter"})})})]})]})})})},Q=$e=>({filterContainer:(0,C.css)({label:"filterContainer",width:"100%",minWidth:"250px",height:"100%",maxHeight:"400px",backgroundColor:$e.colors.background.primary,border:`1px solid ${$e.colors.border.weak}`,padding:$e.spacing(2),boxShadow:$e.shadows.z3,borderRadius:$e.shape.radiu
104s.default}),listDivider:(0,C.css)({label:"listDivider",width:"100%",borderTop:`1px solid ${$e.colors.border.medium}`,padding:$e.spacing(.5,2)}),label:(0,C.css)({marginBottom:0})}),J=$e=>{$e.stopPropagation()},q=({column:$e,field:tt,tableStyles:Ke})=>{const Re=(0,n.useRef)(null),[Ve,Qe]=(0,n.useState)(!1),je=(0,h.of)(X),ze=(0,n.useMemo)(()=>!!$e.filterValue,[$e.filterValue]),Ye=(0,n.useCallback)(()=>Qe(!0),[Qe]),Ge=(0,n.useCallback)(()=>Qe(!1),[Qe]),[ce,Pe]=(0,n.useState)(""),[Se,Ee]=(0,n.useState)(V);return!tt||!tt.config.custom?.filterable?null:(0,t.jsxs)("button",{className:(0,C.cx)(Ke.headerFilter,ze?je.filterIconEnabled:je.filterIconDisabled),ref:Re,type:"button",onClick:Ye,children:[(0,t.jsx)(v.I,{name:"filter"}),Ve&&Re.current&&(0,t.jsx)(S.A,{content:(0,t.jsx)(Y,{column:$e,tableStyles:Ke,field:tt,onClose:Ge,searchFilter:ce,setSearchFilter:Pe,operator:Se,setOperator:Ee}),placement:"bottom-start",referenceElement:Re.current,show:!0})]})},X=$e=>({filterIconEnabled:(0,C.css)({label:"filterIconEnabled",color:$e.colors.primary.text}),filterIconDisabled:(0,C.css)({label:"filterIconDisabled",color:$e.colors.text.disabled})}),se=$e=>{const{headerGroups:tt,showTypeIcons:Ke,tableStyles:Re}=$e,Ve=l.Tp.components.Panels.Visualization.Table;return(0,t.jsx)("div",{role:"rowgroup",className:Re.headerRow,children:tt.map(Qe=>{const{key:je,...ze}=Qe.getHeaderGroupProps();return(0,n.createElement)("div",{className:Re.thead,...ze,key:je,"aria-label":Ve.header,role:"row"},Qe.headers.map((Ye,Ge)=>oe(Ye,Re,Ke)))})})};function oe($e,tt,Ke){const{key:Re,...Ve}=$e.getHeaderProps(),Qe=$e.field??null,je=Qe?.config.custom;$e.canResize&&(Ve.style.userSelect=$e.isResizing?"none":"auto"),Ve.style.position="absolute",Ve.style.justifyContent=$e.justifyContent,Ve.style.left=$e.totalLeft;let ze=$e.render("Header"),Ye=$e.canSort&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{...$e.getSortByToggleProps(),className:tt.headerCellLabel,children:[Ke&&(0,t.jsx)(v.I,{name:(0,E.SS)(Qe),title:Qe?.type,size:"sm",className:tt.typeIcon}),(0,t.jsx)("div",{children:ze}),$e.isSorted&&($e.isSortedDesc?(0,t.jsx)(v.I,{size:"lg",name:"arrow-down",className:tt.sortIcon}):(0,t.jsx)(v.I,{name:"arrow-up",size:"lg",className:tt.sortIcon}))]}),$e.canFilter&&(0,t.jsx)(q,{column:$e,tableStyles:tt,field:Qe})]});return Ye&&je?.headerComponent?Ye=(0,t.jsx)(je.headerComponent,{field:Qe,defaultContent:Ye}):je?.headerComponent&&(ze=(0,t.jsx)(je.headerComponent,{field:Qe,defaultContent:ze})),(0,t.jsxs)("div",{className:tt.headerCell,...Ve,role:"columnheader",children:[$e.canSort&&Ye,!$e.canSort&&ze,!$e.canSort&&$e.canFilter&&(0,t.jsx)(q,{column:$e,tableStyles:tt,field:Qe}),$e.canResize&&(0,t.jsx)("div",{...$e.getResizerProps(),className:tt.resizeHandle})]},Re)}var ae=e(64423),ie=e(56978),fe=e(57852),pe=e(64400),de=e(28533);function le({tableStyles:$e,nestedData:tt,rowIndex:Ke,width:Re,cellHeight:Ve}){const Qe=tt.values,je=[],ze=(0,h.$j)(),Ye=(0,h.of)(me);let Ge=$e.rowHeight+ze.spacing.gridSize;return Qe[Ke].forEach((ce,Pe)=>{const Se=!!ce.meta?.custom?.noHeader,Ee=$e.rowHeight*(ce.length+(Se?0:1)),xe={height:Ee,paddingLeft:D.jV,position:"absolute",top:Ge,backgroundColor:ze.colors.background.primary,color:ze.colors.text.primary};Ge+=Ee+ze.spacing.gridSize,je.push((0,t.jsx)("div",{style:xe,children:(0,t.jsx)(Me,{data:ce,width:Re-D.jV,height:$e.rowHeight*(ce.length+1),noHeader:Se,cellHeight:Ve})},`subTable_${Ke}_${Pe}`))}),(0,t.jsx)("div",{className:Ye.subTables,children:je})}const me=$e=>({subTables:(0,C.css)({"&:before":{content:'""',position:"absolute",width:"1px",top:$e.spacing(5),left:$e.spacing(1),bottom:$e.spacing(2),background:$e.colors.border.medium}})});function De($e,tt,Ke){return $e.values[tt].reduce((Qe,je)=>{if(je.length){const ze=!!je.meta?.custom?.noHeader;return Qe+Ke.rowHeight*(je.length+(ze?0:1))+8}return Qe},Ke.rowHeight)??Ke.rowHeight}const Te=$e=>{const{data:tt,rows:Ke,headerHeight:Re,footerPaginationEnabled:Ve,rowHeight:Qe,itemCount:je,pageIndex:ze,tableState:Ye,prepareRow:Ge,onCellFilterAdded:ce,width:Pe,cellHeight:Se=f.qM.Sm,timeRange:Ee,tableStyles:xe,nestedDataField:ye,listHeight:Oe,listRef:we,enableSharedCrosshair:Be=!1,initialRowIndex:Xe=void 0,headerGroups:st,longestField:lt,textWrapField:Et,getActions:Tt,replaceVariables:Mt,setInspectCell:wt}
104=$e,[_e,xt]=(0,n.useState)(Xe);Xe===void 0&&_e!==void 0&&xt(void 0);const At=(0,h.$j)(),bt=(0,pe.d2)();let Xt=null;window.OffscreenCanvas!==void 0&&(Xt=new OffscreenCanvas(256,1024).getContext("2d")),Xt!=null&&(Xt.font=`${At.typography.fontSize}px ${At.typography.body.fontFamily}`);const Cn=(0,n.useMemo)(()=>{const jt=tt.fields.find(Nt=>Nt.type===s.PU.time);return jt?(0,D.HY)(jt):0},[tt]),vn=(0,n.useCallback)((jt,Nt)=>{if(!bt||!Be)return;const $t=Nt.fields.find(an=>an.type===s.PU.time);$t&&bt.eventBus.publish(new fe.b_({point:{time:$t.values[jt]}}))},[Be,bt]),Wn=(0,n.useCallback)(()=>{!bt||!Be||bt.eventBus.publish(new fe.ql)},[Be,bt]),Dt=(0,n.useCallback)(jt=>{if(jt.payload.point?.time&&jt.payload.rowIndex!==void 0){const Nt=tt.fields.find(gn=>gn.type===s.PU.time),$t=Nt.values[jt.payload.rowIndex],an=jt.payload.point.time;if((0,D.Iy)(an,$t,Cn)){xt(jt.payload.rowIndex);return}const Jt=Nt.values.findIndex(gn=>(0,D.Iy)(an,gn,Cn));if(Jt!==-1){xt(Jt);return}xt(void 0)}},[tt.fields,Cn]);(0,n.useEffect)(()=>{if(!bt||!Be||!(0,m.S1)(tt)||Ve)return;const jt=new ae.yU;return jt.add(bt.eventBus.getStream(fe.b_).pipe((0,ie.B)(250)).subscribe({next:Nt=>{bt.eventBus!==Nt.origin&&Dt(Nt)}})),jt.add(bt.eventBus.getStream(fe.ql).pipe((0,ie.B)(250)).subscribe({next:Nt=>{bt.eventBus!==Nt.origin&&xt(void 0)}})),()=>{jt.unsubscribe()}},[tt,Be,Ve,Dt,bt]);let qt;if(_e!==void 0){const jt=Ke.findIndex(Nt=>Nt.index===_e);jt!==-1&&(qt=Re+(jt-1)*Qe)}const Yt=(0,n.useCallback)(jt=>Ye.pageIndex*Ye.pageSize+jt,[Ye.pageIndex,Ye.pageSize]);let nn,Zt;for(const jt of tt.fields){const Nt=jt.config.custom;Nt!==void 0&&Nt.cellOptions!==void 0&&Nt.cellOptions.type===f.ob.ColorBackground&&Nt.cellOptions.applyToRow&&(nn=an=>{const Jt=jt.display(jt.values.get(an));return(0,D.HW)(xe.theme,Nt.cellOptions,Jt)}),Et!==void 0?Zt=Et:lt!==void 0&&(Zt=lt)}const tn=(0,n.useCallback)(({index:jt,style:Nt,rowHighlightIndex:$t})=>{const an=Yt(jt),Jt=Ke[an];let gn={};Ge(Jt);const mn=Ye.expanded[Jt.id]?(0,C.css)({"&:hover":{background:"inherit"}}):{},_t=ye&&Ye.expanded[Jt.id];if($t!==void 0&&Jt.index===$t&&(Nt={...Nt,backgroundColor:At.components.table.rowSelected},gn={"aria-selected":"true"}),nn){const{bgColor:Fn,textColor:na}=nn(Jt.index);Nt.background=Fn,Nt.color=na,Nt.borderLeft=`2px solid ${Fn}`}if(Zt){const na=tt.fields.filter(mt=>!mt.config.custom?.hidden).findIndex(mt=>mt.name===Zt.name),aa=At.typography.body.lineHeight*At.typography.fontSize,yt=(0,D.M2)(Zt.values[Jt.index],st[0].headers[na],Xt,aa,xe.rowHeight,xe.cellPadding);Nt.height=yt.height}const{key:On,...Nn}=Jt.getRowProps({style:Nt,...gn});return(0,t.jsxs)("div",{...Nn,className:(0,C.cx)(xe.row,mn),onMouseEnter:()=>vn(Jt.index,tt),onMouseLeave:Wn,children:[_t&&(0,t.jsx)(le,{nestedData:ye,tableStyles:xe,rowIndex:Jt.index,width:Pe,cellHeight:Se}),Jt.cells.map((Fn,na)=>(0,t.jsx)(de.n,{tableStyles:xe,cell:Fn,onCellFilterAdded:ce,columnIndex:na,columnCount:Jt.cells.length,timeRange:Ee,frame:tt,rowStyled:nn!==void 0,rowExpanded:_t,textWrapped:Zt!==void 0,height:Number(Nt.height)-1,getActions:Tt,replaceVariables:Mt,setInspectCell:wt},na))]},On)},[Yt,Ke,Ge,Ye.expanded,ye,nn,Zt,xe,Wn,Pe,Se,At.components.table.rowSelected,At.typography.body.lineHeight,At.typography.fontSize,tt,st,Xt,vn,ce,Ee,Tt,Mt,wt]),ft=jt=>{const Nt=Yt(jt),$t=Ke[Nt];if(Ye.expanded[$t.id]&&ye)return De(ye,$t.index,xe);if(Zt){const Jt=tt.fields.filter(mn=>!mn.config.custom?.hidden).findIndex(mn=>mn.name===Zt.name),gn=At.typography.fontSize*At.typography.body.lineHeight;return(0,D.M2)(Zt.values[$t.index],st[0].headers[Jt],Xt,gn,xe.rowHeight,xe.cellPadding).height}return xe.rowHeight},Rt=jt=>{const{scrollTop:Nt}=jt.currentTarget;we.current!==null&&we.current.scrollTo(Nt)},Bt=Object.keys(Ye.expanded).join("|");return(0,n.useEffect)(()=>{we.current&&we.current.resetAfterIndex(0)},[Ke,we]),(0,t.jsx)(i.A,{onScroll:Rt,hideHorizontalTrack:!0,scrollTop:qt,children:(0,t.jsx)(O._m,{height:Oe,itemCount:je,itemSize:ft,width:"100%",ref:we,style:{overflow:void 0},children:({index:jt,style:Nt})=>tn({index:jt,style:Nt,rowHighlightIndex:_e})},`${Qe}${ze}${Bt}`)})};var Ne=e(59692);const Ce=150,He=36,ke="No data",Me=(0,n.memo)($e=>{const{ariaLabel:tt,data:Ke,height:Re,onCellFilterAdded:Ve,onColumnResize:Qe,width:je,columnMinWidth:ze=Ce,noHeader:Ye,resizable:Ge=!0,initialSortBy:ce,footerOptions:Pe,showTypeIcons:Se,footerValues:Ee,enablePagination:xe,cellHeight:ye=f.qM.Sm,timeRange:Oe,enableSharedCrosshair:we=!1,initialRowIndex:Be=void 0,fieldConfig:Xe,getActions:st,replaceVariables:lt}=$e,Et=(0,n.useRef)(null),Tt=(0,n.useRef)(null),Mt=(0,n.useRef)(null),wt=(0,h.$j)(),_e=(0,Ne.k)(wt,ye),xt=Ye?0:_e.rowHeight,[At,bt]=(0,n.use
104State)(Ee),Xt=Xe?.defaults?.noValue??ke,[Cn,vn]=(0,n.useState)(null),Wn=(0,n.useMemo)(()=>{const it=He;let Pt=0;if(!At)return 0;for(const It of At)Array.isArray(It)&&It.length>Pt&&(Pt=It.length);return Pt>1?it*Pt:it},[At]),Dt=(0,n.useMemo)(()=>Ke.fields.length?Array(Ke.length).fill(0):[],[Ke]),qt=!!(Pe?.countRows&&Pe.reducer&&Pe.reducer.length&&Pe.reducer[0]===o.gy.count),Yt=Ke.fields.find(it=>it.type===s.PU.nestedFrames),nn=Yt!==void 0,Zt=(0,n.useMemo)(()=>(0,D.GH)(Ke,je,ze,nn,At,qt),[Ke,je,ze,nn,At,qt]),tn=(0,n.useRef)(),ft=P({onColumnResize:Qe,onSortByChange:it=>{tn.current(!1),$e.onSortByChange&&$e.onSortByChange(it)},data:Ke}),Rt=!!Ke.meta?.uniqueRowIdFields?.length,Bt=(0,n.useMemo)(()=>{const it={columns:Zt,data:Dt,disableResizing:!Ge,stateReducer:ft,autoResetPage:!1,initialState:d(ce,Zt),autoResetFilters:!1,sortTypes:{number:D.Ok,"alphanumeric-insensitive":D.IM}};return Rt&&(it.getRowId=(Pt,It)=>(0,m.t9)(Ke,It),it.autoResetExpanded=!1),it},[ce,Zt,Dt,Ge,ft,Rt,Ke]),{getTableProps:jt,headerGroups:Nt,footerGroups:$t,rows:an,prepareRow:Jt,totalColumnsWidth:gn,page:mn,state:_t,gotoPage:On,setPageSize:Nn,pageOptions:Fn,toggleAllRowsExpanded:na}=(0,r.useTable)(Bt,r.useFilters,r.useSortBy,r.useAbsoluteLayout,r.useResizeColumns,r.useExpanded,r.usePagination),aa=_t;tn.current=na,(0,n.useEffect)(()=>{Pe||bt(Ee)},[Ee,Pe]),(0,n.useEffect)(()=>{if(!Pe)return;if(!Pe.show){bt(void 0);return}if(qt){const Pt=[];Pt[0]=an.length.toString()??Ke.length.toString(),bt(Pt);return}const it=(0,D.Ux)(Nt[0].headers,(0,D.XX)(an),Pe,wt);bt(it)},[Pe,wt,_t.filters,Ke]);let yt=Re-(xt+Wn);xe&&(yt-=_e.cellHeight);const mt=Math.round(yt/_e.rowHeight)-1;(0,n.useEffect)(()=>{mt<=0||Nn(mt)},[mt,Nn]),(0,n.useEffect)(()=>{Ke.length/mt<_t.pageIndex&&On(0)},[Ke]),c(aa,Et,Ke,Rt),p(Mt,Tt);const Ot=(0,n.useCallback)(it=>{On(it-1)},[On]),Wt=xe?mn.length:an.length;let et=null;if(xe){const it=_t.pageIndex*_t.pageSize+1;let Pt=it+_t.pageSize-1;const It=je<550;Pt>Ke.length&&(Pt=Ke.length);const Vt=an.length,en=Pt<an.length?Pt:an.length;et=(0,t.jsxs)("div",{className:_e.paginationWrapper,children:[(0,t.jsx)(x.d,{currentPage:_t.pageIndex+1,numberOfPages:Fn.length,showSmallVersion:It,onNavigate:Ot}),It?null:(0,t.jsx)("div",{className:_e.paginationSummary,children:(0,t.jsxs)(u.x,{i18nKey:"grafana-ui.table.pagination-summary",children:[{itemsRangeStart:it}," - ",{displayedEnd:en}," of ",{numRows:Vt}," rows"]})})]})}const Je=Xe?(0,D.O4)(Xe,Ke):void 0;let rt;return Xe!==void 0&&Ke.fields.forEach(it=>{Xe.overrides.forEach(Pt=>{if((0,a.NS)(Pt.matcher)(it,Ke,[Ke]))for(const Vt of Pt.properties)Vt.id==="custom.cellOptions"&&Vt.value.wrapText&&(rt=it)})}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{...jt(),className:_e.table,"aria-label":tt,role:"table",ref:Tt,style:{width:je,height:Re},children:[(0,t.jsx)(i.E,{hideVerticalTrack:!0,children:(0,t.jsxs)("div",{className:_e.tableContentWrapper(gn),children:[!Ye&&(0,t.jsx)(se,{headerGroups:Nt,showTypeIcons:Se,tableStyles:_e}),Wt>0?(0,t.jsx)("div",{"data-testid":l.Tp.components.Panels.Visualization.Table.body,ref:Mt,children:(0,t.jsx)(Te,{headerGroups:Nt,data:Ke,rows:an,width:je,cellHeight:ye,headerHeight:xt,rowHeight:_e.rowHeight,itemCount:Wt,pageIndex:_t.pageIndex,listHeight:yt,listRef:Et,tableState:_t,prepareRow:Jt,timeRange:Oe,onCellFilterAdded:Ve,nestedDataField:Yt,tableStyles:_e,footerPaginationEnabled:!!xe,enableSharedCrosshair:we,initialRowIndex:Be,longestField:Je,textWrapField:rt,getActions:st,replaceVariables:lt,setInspectCell:vn})}):(0,t.jsx)("div",{style:{height:Re-xt,width:je},className:_e.noData,children:Xt}),At&&(0,t.jsx)(b.u,{isPaginationVisible:!!xe,footerValues:At,footerGroups:$t,totalColumnsWidth:gn,tableStyles:_e})]})}),et]}),Cn!==null&&(0,t.jsx)(g.s,{mode:Cn.mode,value:Cn.value,onDismiss:()=>{vn(null)}})]})});Me.displayName="Table"},59692:(ee,B,e)=>{"use strict";e.d(B,{k:()=>n});var t=e(22803);function n(o,s){const m=o.colors.border.weak,a=o.colors.primary.border,l=6,f=r(o,s,l),h=f+2,u=28,i=(x,g,p,c,y,P,d,D,b)=>(0,t.css)({label:c?"cellContainerOverflow":"cellContainerNoOverflow",padding:`${l}px`,width:"100%",height:b?"auto !important":`${h-1}px`,wordBreak:d?"break-all":"inherit",display:"flex",...y?{overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap"}:{},alignItems:"center",borderRight:`1px solid ${m}`,color:D?"inherit":x??void 0,background:D?void 0:g??void 0,backgroundClip:"padding-box","&:last-child:not(:only-child)":{borderRight:"none"},"&:hover":{overflow:c&&!d?"visible":void 0,width:P||!c?"auto":"auto !important",height:(P||c)&&!d?"auto !important":`${h-1}px`,minHeight:`${h-1}px`,wordBreak:P?"break-word":void 0,whiteSpace:P&&c?"normal":"nowrap",boxShadow:c?`0 0 2px ${o.colors.primary.main}`:void 0,background:D?"inherit":p??o.colors.background.primary,zIndex:1,".cellActions":{background:o.components.tooltip.background,color:o.components.tooltip.text,visibility:"visible",opacity:1,width:"auto",borderRadius:o.shape.radiu
104s.default}},a:{color:"inherit"},".cellActions":{display:"flex",position:c?void 0:"absolute",top:c?void 0:"1px",right:c?void 0:0,margin:c?o.spacing(0,0,0,1):"auto",visibility:"hidden",opacity:0,width:0,alignItems:"center",height:"100%",padding:o.spacing(.5,0,.5,.5),background:o.components.tooltip.background,color:o.components.tooltip.text},".cellActionsLeft":{right:"auto !important",left:0}});return{theme:o,cellHeight:f,buildCellContainerStyle:i,cellPadding:l,cellHeightInner:f-l*2,rowHeight:h,table:(0,t.css)({height:"100%",width:"100%",overflow:"auto",display:"flex",flexDirection:"column"}),thead:(0,t.css)({label:"thead",height:`${u}px`,overflowY:"auto",overflowX:"hidden",position:"relative"}),tfoot:(0,t.css)({label:"tfoot",height:`${u}px`,borderTop:`1px solid ${m}`,overflowY:"auto",overflowX:"hidden",position:"relative"}),headerRow:(0,t.css)({label:"row",borderBottom:`1px solid ${m}`}),headerCell:(0,t.css)({height:"100%",padding:`0 ${l}px`,overflow:"hidden",whiteSpace:"nowrap",display:"flex",alignItems:"center",fontWeight:o.typography.fontWeightMedium,"&:last-child":{borderRight:"none"}}),headerCellLabel:(0,t.css)({border:"none",padding:0,background:"inherit",cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontWeight:o.typography.fontWeightMedium,display:"flex",alignItems:"center",marginRight:o.spacing(.5),"&:hover":{textDecoration:"underline",color:o.colors.text.link}}),cellContainerText:i(void 0,void 0,void 0,!0,!0),cellContainerTextNoOverflow:i(void 0,void 0,void 0,!1,!0),cellContainer:i(void 0,void 0,void 0,!0,!1),cellContainerNoOverflow:i(void 0,void 0,void 0,!1,!1),cellText:(0,t.css)({overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap",cursor:"text"}),sortIcon:(0,t.css)({marginLeft:o.spacing(.5)}),cellLink:(0,t.css)({cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap",color:o.colors.text.link,fontWeight:o.typography.fontWeightMedium,paddingRight:o.spacing(1.5),"&:hover":{textDecoration:"underline",color:o.colors.text.link}}),cellLinkForColoredCell:(0,t.css)({cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap",fontWeight:o.typography.fontWeightMedium,textDecoration:"underline"}),imageCellLink:(0,t.css)({cursor:"pointer",overflow:"hidden",height:"100%"}),headerFilter:(0,t.css)({background:"transparent",border:"none",label:"headerFilter",padding:0}),paginationWrapper:(0,t.css)({display:"flex",height:`${f}px`,justifyContent:"center",alignItems:"center",width:"100%",li:{marginBottom:0}}),paginationSummary:(0,t.css)({color:o.colors.text.secondary,fontSize:o.typography.bodySmall.fontSize,display:"flex",justifyContent:"flex-end",padding:o.spacing(0,1,0,2)}),tableContentWrapper:x=>{const g=x!==void 0?`${x}px`:"100%";return(0,t.css)({label:"tableContentWrapper",width:g,display:"flex",flexDirection:"column"})},row:(0,t.css)({label:"row",borderBottom:`1px solid ${m}`,"&:hover":{backgroundColor:o.components.table.rowHoverBackground},"&:last-child":{borderBottom:0}}),imageCell:(0,t.css)({height:"100%"}),resizeHandle:(0,t.css)({label:"resizeHandle",cursor:"col-resize !important",display:"inline-block",background:a,opacity:0,[o.transitions.handleMotion("no-preference","reduce")]:{transition:"opacity 0.2s ease-in-out"},width:"8px",height:"100%",position:"absolute",right:"-4px",borderRadius:o.shape.radius.default,top:0,touchAction:"none","&:hover":{opacity:1}}),typeIcon:(0,t.css)({marginRight:o.spacing(1),color:o.colors.text.secondary}),noData:(0,t.css)({alignItems:"center",display:"flex",height:"100%",justifyContent:"center",width:"100%"}),expanderCell:(0,t.css)({display:"flex",flexDirection:"column",justifyContent:"center",height:`${h}
104px`,cursor:"pointer"})}}function r(o,s,m){const a=o.typography.fontSize,l=o.typography.body.lineHeight;switch(s){case"md":return 42;case"lg":return 48;case"sm":default:return m*2+a*l}}},36100:(ee,B,e)=>{"use strict";e.d(B,{Zi:()=>n,mc:()=>t});const t="=",n="!="},74198:(ee,B,e)=>{"use strict";e.d(B,{jV:()=>X,HY:()=>Qe,MY:()=>fe,XX:()=>ke,zi:()=>Re,HW:()=>je,bk:()=>$e,GH:()=>oe,Sj:()=>me,Ux:()=>Ce,j1:()=>se,O4:()=>Ye,M2:()=>ze,Iy:()=>Ve,o7:()=>tt,IM:()=>De,Ok:()=>Te,Yz:()=>de});var t=e(2543),n=e(47078),r=e.n(n),o=e(84140),s=e(95004),m=e(16515),a=e(41119),l=e(39884),f=e(55386),h=e(46644),u=e(11576),i=e(739),x=e(8255),g=e(74848),p=e(22803),c=e(63142),y=e(31210);const P=Ge=>{const{cellProps:ce,tableStyles:Pe,actions:Se}=Ge,Ee=(0,c.of)(d);return(0,g.jsx)("div",{...ce,className:(0,p.cx)(Pe.cellContainerText,Ee.buttonsGap),children:Se&&Se.map((xe,ye)=>(0,g.jsx)(y.r,{action:xe,variant:"secondary"},ye))})},d=Ge=>({buttonsGap:(0,p.css)({gap:6})});var D=e(33553),b=e(79118),E=e(38919),v=e(98005),C=e(6399);const S={mode:D.O.Absolute,steps:[{color:"blue",value:-1/0},{color:"green",value:20}]},O=Ge=>{const{field:ce,innerWidth:Pe,tableStyles:Se,cell:Ee,cellProps:xe,row:ye}=Ge,Oe=ce.display(Ee.value),we=$e(ce);let Be=(0,b.xg)(ce,!1);Be.thresholds||(Be={...Be,thresholds:S});let Xe=i.eX.Gradient,st;we.type===i.ob.Gauge&&(Xe=we.mode??i.eX.Gradient,st=we.valueDisplayMode!==void 0?we.valueDisplayMode:i.$l.Text);const lt=()=>(0,t.isFunction)(ce.getLinks)?ce.getLinks({valueRowIndex:ye.index}):[],Et=!!lt().length,Tt=Re(ce,Oe,Ee.row.index),Mt=wt=>{const{openMenu:_e,targetClassName:xt}=wt;return(0,g.jsx)(v.xE,{width:Pe,height:Se.cellHeightInner,field:Be,display:ce.display,text:{valueSize:14},value:Oe,orientation:E.wV.Horizontal,theme:Se.theme,alignmentFactors:Tt,onClick:_e,className:xt,itemSpacing:1,lcdCellWidth:8,displayMode:Xe,valueDisplayMode:st})};return(0,g.jsx)("div",{...xe,className:Se.cellContainer,children:Et?(0,g.jsx)(C.e,{links:lt,style:{display:"flex",width:"100%"},children:wt=>Mt(wt)}):Mt({})})};var I=e(86059);const R=Ge=>{const{field:ce,row:Pe,cellProps:Se,tableStyles:Ee}=Ge,xe=(0,I.k)(ce,Pe);return(0,g.jsx)("div",{...Se,className:Ee.cellContainerText,children:xe&&xe.map((ye,Oe)=>(0,g.jsx)("span",{className:Ee.cellLink,onClick:ye.onClick,children:(0,g.jsx)("a",{href:ye.href,target:ye.target,children:ye.title})},Oe))})};var T=e(96540),L=e(45861),K=e(7685),A=e(76319),W=e(41654),N=e(36100);function w({field:Ge,cell:ce,previewMode:Pe,showFilters:Se,onCellFilterAdded:Ee,setInspectCell:xe}){const ye=se(Ge)==="flex-end",Oe=!!Ge.config.custom?.inspect,we={size:"sm",tooltipPlacement:"top"},Be=(0,T.useCallback)(st=>{Ee&&Ee({key:Ge.name,operator:N.mc,value:ce.value})},[ce,Ge,Ee]),Xe=(0,T.useCallback)(st=>{Ee&&Ee({key:Ge.name,operator:N.Zi,value:ce.value})},[ce,Ge,Ee]);return(0,g.jsx)("div",{className:`cellActions${ye?" cellActionsLeft":""}`,children:(0,g.jsxs)(W.B,{gap:.5,children:[Oe&&(0,g.jsx)(A.K,{name:"eye",tooltip:(0,K.t)("grafana-ui.table.cell-inspect","Inspect value"),onClick:()=>{xe&&xe({value:ce.value,mode:Pe})},...we}),Se&&(0,g.jsx)(A.K,{name:"search-plus",onClick:Be,tooltip:(0,K.t)("grafana-ui.table.cell-filter-on","Filter for value"),...we}),Se&&(0,g.jsx)(A.K,{name:"search-minus",onClick:Xe,tooltip:(0,K.t)("grafana-ui.table.cell-filter-out","Filter out value"),...we})]})})}var j=e(64780);const V=Ge=>{const{field:ce,cell:Pe,tableStyles:Se,row:Ee,cellProps:xe,frame:ye,rowStyled:Oe,rowExpanded:we,textWrapped:Be,height:Xe}=Ge,st=!!ce.config.custom?.inspect,lt=ce.display(Pe.value),Et=Ge.onCellFilterAdded&&ce.config.filterable,Tt=Et&&Pe.value!==void 0||st,Mt=$e(ce),wt=!!(0,I.k)(ce,Ee)?.length,_e=(0,c.of)(L.Ez);let xt;const At=140;if(Mt.type===i.ob.Custom){const Dt=Mt.cellComponent;xt=(0,g.jsx)(Dt,{field:ce,value:Pe.value,rowIndex:Ee.index,frame:ye})}else T.isValidElement(Pe.value)?xt=Pe.value:xt=(0,f.cN)(lt);const bt=typeof xt=="string",Xt=lt.text.length<=At&&/\s/.test(lt.text),Cn=U(Se,Mt,lt,st,bt,Xt,Be,Oe,we);
104if(bt){let Dt=xe.style?.justifyContent;Dt==="flex-end"?xe.style={...xe.style,textAlign:"right"}:Dt==="center"&&(xe.style={...xe.style,textAlign:"center"})}Xe&&(xe.style={...xe.style,height:Xe}),Be&&(xe.style={...xe.style,textWrap:"wrap"});const{key:vn,...Wn}=xe;return(0,g.jsxs)("div",{...Wn,className:Cn,children:[wt?(0,g.jsx)(C.e,{links:()=>(0,I.k)(ce,Ee)||[],children:Dt=>Dt.openMenu?(0,g.jsx)("button",{className:(0,p.cx)(_e,F(Se,Mt,Dt.targetClassName)),onClick:Dt.openMenu,children:xt}):(0,g.jsx)("div",{className:F(Se,Mt,Dt.targetClassName),children:xt})}):bt?`${xt}`:(0,g.jsx)("div",{className:Se.cellText,children:xt}),Tt&&(0,g.jsx)(w,{...Ge,previewMode:j.B.text,showFilters:Et})]},vn)};function U(Ge,ce,Pe,Se=!1,Ee=!1,xe=!1,ye=!1,Oe=!1,we=!1){let Be,Xe,st;const lt=je(Ge.theme,ce,Pe);return Be=lt.textColor,Xe=lt.bgColor,st=lt.bgHoverColor,Ge.buildCellContainerStyle(Be,Xe,st,!Se,Ee,xe,ye,Oe,we)}function F(Ge,ce,Pe){return ce.type===i.ob.Auto?(0,p.cx)(Ge.cellLink,Pe):(0,p.cx)(Ge.cellLinkForColoredCell,Pe)}var M=e(64136),H=e(27430);function _(Ge){const{cell:ce,tableStyles:Pe,cellProps:Se}=Ge;let Ee="";return ce.value instanceof H.A?Ee=new M.A().writeGeometry(ce.value,{featureProjection:"EPSG:3857",dataProjection:"EPSG:4326"}):ce.value!=null&&(Ee=`${ce.value}`),(0,g.jsx)("div",{...Se,className:Pe.cellContainer,children:(0,g.jsx)("div",{className:Pe.cellText,style:{fontFamily:"monospace"},children:Ee})})}const Z=10,ne=Ge=>{const{field:ce,cell:Pe,tableStyles:Se,row:Ee,cellProps:xe}=Ge,ye=$e(ce),{title:Oe,alt:we}=ye.type===i.ob.Image?ye:{title:void 0,alt:void 0},Be=ce.display(Pe.value),Xe=!!(0,I.k)(ce,Ee)?.length,st=(0,g.jsx)("img",{style:{height:Se.cellHeight-Z,width:"auto"},src:Be.text,className:Se.imageCell,alt:we,title:Oe});return(0,g.jsx)("div",{...xe,className:Se.cellContainer,children:Xe?(0,g.jsx)(C.e,{style:{height:Se.cellHeight-Z,width:"auto"},links:()=>(0,I.k)(ce,Ee)||[],children:lt=>lt.openMenu?(0,g.jsx)("div",{onClick:lt.openMenu,role:"button",tabIndex:0,onKeyDown:Et=>{Et.key==="Enter"&<.openMenu&<.openMenu(Et)},children:st}):st}):st})};function te(Ge){const{cell:ce,tableStyles:Pe,cellProps:Se,field:Ee,row:xe}=Ge,ye=!!Ee.config.custom?.inspect,Oe=(0,p.css)({cursor:"pointer",fontFamily:"monospace"});let we=ce.value,Be=we;if((0,t.isString)(we))try{we=JSON.parse(we)}catch{}else Be=JSON.stringify(we,null," ");const Xe=!!(0,I.k)(Ee,xe)?.length,st=(0,c.of)(L.Ez);return(0,g.jsxs)("div",{...Se,className:ye?Pe.cellContainerNoOverflow:Pe.cellContainer,children:[(0,g.jsx)("div",{className:(0,p.cx)(Pe.cellText,Oe),children:Xe?(0,g.jsx)(C.e,{links:()=>(0,I.k)(Ee,xe)||[],children:lt=>lt.openMenu?(0,g.jsx)(L.$n,{className:(0,p.cx)(st),onClick:lt.openMenu,children:Be}):(0,g.jsx)(g.Fragment,{children:Be})}):(0,g.jsx)("div",{className:Pe.cellText,children:Be})}),ye&&(0,g.jsx)(w,{...Ge,previewMode:j.B.code})]})}var Y=e(93948),Q=e(74533),J=e(30703);function q({row:Ge,tableStyles:ce}){return(0,g.jsx)("div",{className:ce.expanderCell,...Ge.getToggleRowExpandedProps(),children:(0,g.jsx)(J.I,{"aria-label":Ge.isExpanded?"Collapse row":"Expand row",name:Ge.isExpanded?"angle-down":"angle-right",size:"lg"})})}const X=50;function se(Ge){if(!Ge)return"flex-start";if(Ge.config.custom)switch(Ge.config.custom.align){case"right":return"flex-end";case"left":return"flex-start";case"center":return"center"}return Ge.type===s.PU.number?"flex-end":"flex-start"}function oe(Ge,ce,Pe,Se,Ee,xe){const ye=[];let Oe=0;Se&&(ye.push({Header:()=>null,id:"expander",Cell:q,width:X,minWidth:X,filter:(Be,Xe,st)=>[],justifyContent:"left",field:Ge.fields[0],sortType:"basic"}),ce-=X);for(const[Be,Xe]of Ge.fields.entries()){const st=Xe.config.custom||{};if(st.hidden||Xe.type===s.PU.nestedFrames)continue;st.width?ce-=st.width:Oe++;const lt=Tt=>{switch(Tt){case s.PU.number:case s.PU.frame:return"number";case s.PU.time:return"basic";default:return"alphanumeric-insensitive"}},Et=ae(st.cellOptions?.type,Xe);ye.push({Cell:Et,id:Be.toString(),field:Xe,Header:st.hideHeader?"":(0,m.Ct)(Xe,Ge),accessor:(Tt,Mt)=>Xe.values[Mt],sortType:lt(Xe.type),width:st.width,minWidth:st.minWidth??Pe,filter:r()(ie(Xe)),justifyContent:se(Xe),Footer:(0,Q.d)(Be,Ee,xe)})}let we=ce/Oe;for(let Be=Oe;Be>0;
104Be--)for(const Xe of ye)!Xe.width&&Xe.minWidth>we&&(Xe.width=Xe.minWidth,ce-=Xe.width,Oe-=1,we=ce/Oe);for(const Be of ye)Be.width||(Be.width=we),Be.minWidth=50;return ye}function ae(Ge,ce){switch(Ge){case i.ob.Custom:case i.ob.ColorText:case i.ob.ColorBackground:return V;case i.ob.Image:return ne;case i.ob.Gauge:return O;case i.ob.Sparkline:return Y.a;case i.ob.JSONView:return te;case i.ob.DataLinks:return R;case i.ob.Actions:return P}if(ce.type===s.PU.geo)return _;if(ce.type===s.PU.frame){const Pe=ce.values[0];return(0,a.ci)(Pe)&&(0,l.aH)(Pe)?Y.a:te}return ce.type===s.PU.other?te:V}function ie(Ge){return function(ce,Pe,Se){return ce.length===0||!Se||!Ge?ce:ce.filter(Ee=>{if(!Ee.values.hasOwnProperty(Pe))return!1;const xe=pe(Ee,Ge);return Se.find(ye=>ye.value===xe)!==void 0})}}function fe(Ge,ce){if(!ce||Ge.length===0)return{};const Pe={};for(let Se=0;Se<Ge.length;Se++){const Ee=pe(Ge[Se],ce);Pe[Ee||"(Blanks)"]=Ee}return Pe}function pe(Ge,ce){if(!ce||!Ge)return"";const Pe=ce.values[Ge.index],Se=ce.display?ce.display(Pe):Pe;return ce.display?(0,f.cN)(Se):Se}function de(Ge){return Object.keys(Ge).reduce((ce,Pe)=>ce.concat({value:Ge[Pe],label:Pe}),[]).sort(le)}function le(Ge,ce){return Ge.label===void 0&&ce.label===void 0?0:Ge.label===void 0&&ce.label!==void 0?-1:Ge.label!==void 0&&ce.label===void 0?1:Ge.label<ce.label?-1:Ge.label>ce.label?1:0}function me(Ge,ce){return ce?Ge.filter(Pe=>ce.some(Se=>Se.value===Pe.value)):[]}function De(Ge,ce,Pe){return String(Ge.values[Pe]).localeCompare(String(ce.values[Pe]),void 0,{sensitivity:"base"})}function Te(Ge,ce,Pe){const Se=Ne(Ge.values[Pe]),Ee=Ne(ce.values[Pe]);return Se===Ee?0:Se>Ee?1:-1}function Ne(Ge){return(0,a.LI)(Ge)?Ge.value??Number.NEGATIVE_INFINITY:Ge==null||Ge===""||isNaN(Ge)?Number.NEGATIVE_INFINITY:typeof Ge=="number"?Ge:Number(Ge)}function Ce(Ge,ce,Pe,Se){return Ke(Ge),Ge.map((Ee,xe)=>{if(Ee?.field?.type!==s.PU.number)return xe===0&&Pe.reducer&&Pe.reducer.length>0?h.AS.get(Pe.reducer[0]).name:void 0;let ye=(0,t.clone)(Ee.field);return ye.values=ce[Ee.id],ye.state=void 0,Ee.field=ye,Pe.fields&&Pe.fields.length>0?Pe.fields.find(we=>we===Ee?.field?.name)?He(Ee.field,Pe.reducer,Se):void 0:He(Ee.field,Pe.reducer||[],Se)})}function He(Ge,ce,Pe){const Se=ce[0];if(Se===void 0)return"";const Ee=Ge.display??(0,u.J)({field:Ge,theme:Pe}),xe=(0,h.Nw)({field:Ge,reducers:ce})[Se];return h.AS.get(Se).preservesUnits?(0,f.cN)(Ee(xe)):(0,f.cN)({text:xe})}function ke(Ge){const ce=[];for(const Pe in Ge)for(const[Se,Ee]of Object.entries(Ge[Pe].values))ce[Se]===void 0&&(ce[Se]=[]),ce[Se].push(Ee);return ce}const Me={type:i.ob.Auto};function $e(Ge){return Ge.config.custom?.displayMode?tt(Ge.config.custom?.displayMode):Ge.config.custom?.cellOptions?Ge.config.custom.cellOptions:Me}function tt(Ge){switch(Ge){case"basic":case"gradient-gauge":case"lcd-gauge":let ce=i.eX.Basic;return Ge==="gradient-gauge"?ce=i.eX.Gradient:Ge==="lcd-gauge"&&(ce=i.eX.Lcd),{type:i.ob.Gauge,mode:ce};case"color-background":case"color-background-solid":let Pe=i.Wq.Basic;return Ge==="color-background"&&(Pe=i.Wq.Gradient),{type:i.ob.ColorBackground,mode:Pe};default:return{type:Ge}}}function Ke(Ge){const ce=Ge.findIndex((Pe,Se)=>Pe?.id!==String(Se));ce===-1||Ge[ce]?.id==="expander"||(Ge.splice(ce,0,{id:String(ce)}),Ke(Ge))}function Re(Ge,ce,Pe){let Se=Ge.state?.alignmentFactors;if(Se)return(0,f.cN)(Se).length<(0,f.cN)(ce).length&&(Se={...ce},Ge.state.alignmentFactors=Se),Se;{Se={...ce};const Ee=Math.min(Ge.values.length,Pe+1e3);for(let xe=Pe+1;xe<Ee;xe++){const ye=Ge.display(Ge.values[xe]);(0,f.cN)(Se).length>(0,f.cN)(ye).length&&(Se.text=ce.text)}return Ge.state?Ge.state.alignmentFactors=Se:Ge.state={alignmentFactors:Se},Se}}function Ve(Ge,ce,Pe){return Math.abs(Math.floor(Ge)-ce)<Pe}function Qe(Ge){let ce=-Number.MAX_VALUE,Pe=Number.MAX_VALUE;if(Ge.values.length<2)return 0;for(let Se=0;Se<Ge.values.length;Se++){const Ee=Ge.values[Se];Ee>ce&&(ce=Ee),Ee<Pe&&(Pe=Ee)}return(ce-Pe)/Ge.values.length}function je(Ge,ce,Pe){const Se=Ge.isDark?1:-.7;let Ee,xe,ye;if(ce.type===i.ob.ColorText)Ee=Pe.color;
104else if(ce.type===i.ob.ColorBackground){const Oe=ce.mode??i.Wq.Gradient;if(Oe===i.Wq.Basic)Ee=(0,x.mZ)(Pe.color,Ge.isDark),xe=(0,o.A)(Pe.color).toRgbString(),ye=(0,o.A)(Pe.color).setAlpha(1).toRgbString();else if(Oe===i.Wq.Gradient){const we=(0,o.A)(Pe.color).setAlpha(1).toRgbString(),Be=(0,o.A)(Pe.color).darken(10*Se).spin(5);Ee=(0,x.mZ)(Pe.color,Ge.isDark),xe=`linear-gradient(120deg, ${Be.toRgbString()}, ${Pe.color})`,ye=`linear-gradient(120deg, ${Be.setAlpha(1).toRgbString()}, ${we})`}}return{textColor:Ee,bgColor:xe,bgHoverColor:ye}}function ze(Ge,ce,Pe,Se,Ee,xe=0){const ye=Number(ce?.width??300),Oe=1.17,we=42,Be=xe*2;if(Pe!==null&&typeof Ge=="string"){const Xe=Ge.split(/\s/),st=[];let lt="",Et=0,Tt=0;for(let _e=0;_e<Xe.length;_e++){const xt=Xe[_e];let At=Pe.measureText(lt+" "+xt).width;At<ye-Be?(lt+=" "+xt,Et++):(st.push({width:At,line:lt}),lt=xt,Et=0)}for(let _e=0;_e<st.length;_e++)if(st[_e].width>ye){let xt=Math.floor(st[_e].width/ye)-1;Tt+=xt}let Mt=st.length+Tt,wt=38;return Mt>5?wt=Mt*Se*Oe:wt=Mt*Se+we,wt+=Be,{width:ye,height:wt}}return{width:ye,height:Ee}}function Ye(Ge,ce){let Pe;if(Ge.defaults.custom?.cellOptions?.wrapText){const Ee=ce.fields.filter(xe=>xe.type===s.PU.string);if(Ee.length>=1&&Ee[0].values.length>0){const xe=Ee[0].values.length;let ye=0;if(xe<=30)for(const Oe of Ee){const we=Oe.values[0].length;we>ye&&(ye=we,Pe=Oe)}else for(const Oe of Ee){const we=(0,t.sampleSize)(Oe.values,3),Be=(we[0]?.length+we[1]?.length+we[2]?.length)/3;Be>ye&&(ye=Be,Pe=Oe)}}}return Pe}},72489:(ee,B,e)=>{"use strict";e.d(B,{p:()=>s});var t=e(74848),n=e(22803),r=e(55386),o=e(63142);const s=({value:a})=>{const l=(0,o.of)(m);return(0,t.jsx)("span",{className:l.counter,children:(0,r.Hg)(a,0).text})},m=a=>({counter:(0,n.css)({label:"counter",marginLeft:a.spacing(1),borderRadius:a.spacing(3),backgroundColor:a.colors.action.hover,padding:a.spacing(.25,1),color:a.colors.text.secondary,fontWeight:a.typography.fontWeightMedium,fontSize:a.typography.size.sm})})},60208:(ee,B,e)=>{"use strict";e.d(B,{o:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(63142),m=e(35484),a=e(45861),l=e(30703),f=e(45967),h=e(72489);const u=r.forwardRef(({label:x,active:g,icon:p,onChangeTab:c,counter:y,suffix:P,className:d,href:D,truncate:b,tooltip:E,...v},C)=>{const S=(0,s.of)(i),O=(0,s.of)(a.my),I=()=>(0,t.jsxs)(t.Fragment,{children:[p&&(0,t.jsx)(l.I,{name:p}),x,typeof y=="number"&&(0,t.jsx)(h.p,{value:y}),P&&(0,t.jsx)(P,{className:S.suffix})]}),T={className:(0,n.cx)(O,S.link,g?S.activeStyle:S.notActive,b&&S.linkTruncate),"data-testid":o.Tp.components.Tab.title(x),...v,onClick:c,role:"tab","aria-selected":g,title:E?void 0:v.title};let L=null;return D?L=(0,t.jsx)("div",{className:(0,n.cx)(S.item,b&&S.itemTruncate,d),children:(0,t.jsx)("a",{...T,href:D,ref:C,children:I()})}):L=(0,t.jsx)("div",{className:(0,n.cx)(S.item,b&&S.itemTruncate,d),children:(0,t.jsx)("button",{...T,type:"button",ref:C,children:I()})}),E?(0,t.jsx)(f.m,{content:E,children:L}):L});u.displayName="Tab";const i=x=>({item:(0,n.css)({listStyle:"none",position:"relative",display:"flex",whiteSpace:"nowrap",padding:x.spacing(0,.5)}),itemTruncate:(0,n.css)({maxWidth:x.spacing(40)}),link:(0,n.css)({color:x.colors.text.secondary,padding:x.spacing(1,1.5,1),borderRadius:x.shape.radius.default,display:"block",height:"100%",svg:{marginRight:x.spacing(1)},"&:focus-visible":(0,m.getFocusStyles)(x),"&::before":{display:"block",content:'" "',position:"absolute",left:0,right:0,height:"2px",borderRadius:x.shape.radius.default,bottom:0}}),linkTruncate:(0,n.css)({textOverflow:"ellipsis",whiteSpace:"nowrap",wordBreak:"break-word",overflow:"hidden"}),notActive:(0,n.css)({"a:hover, &:hover, &:focus":{color:x.colors.text.primary,"&::before":{backgroundColor:x.colors.action.hover}}}),activeStyle:(0,n.css)({label:"activeTabStyle",color:x.colors.text.primary,overflow:"hidden","&::before":{backgroundImage:x.colors.gradients.brandHorizontal}}),suffix:(0,n.css)({marginLeft:x.spacing(1)})})},13941:(ee,B,e)=>{"use strict";e.d(B,{J:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({children:m,className:a,...l})=>{const f=(0,r.of)(s);return(0,t.jsx)("div",{...l,className:(0,n.cx)(f.tabContent,a),children:m})},s=m=>({tabContent:(0,n.css)({background:m.colors.background.primary})})},54314:(ee,B,e)=>{"use strict";e.d(B,{U:()=>s});var t=e(74848),n=e(22803),r=e(96540),o=e(63142);const s=(0,r.forwardRef)(({children:a,className:l,hideBorder:f=!1},h)=>{const u=(0,o.of)(m);return(0,t.jsx)("div",{className:(0,n.cx)(u.tabsWrapper,f&&u.noBorder,l),ref:h,children:(0,t.jsx)("div",{className:u.tabs,role:"tablist",children:a})})}),m=a=>({tabsWrapper:(0,n.css)({borderBottom:`1px solid ${a.colors.border.weak}`,overflowX:"auto"}),noBorder:(0,n.css)({borderBottom:0}),tabs:(0,n.css)({position:"relative",display:"flex",alignItems:"center"})});s.displayName="TabsBar"},94018:(ee,B,e)=>{"use strict";e.d(B,{v:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(70255),s=e(63142),m=e(48542),a=e(21348),l=e(30703);
104const f=(0,r.forwardRef)(({name:g,onClick:p,icon:c,className:y,colorIndex:P,...d},D)=>{const b=(0,s.$j)(),E=x(b,g,P),v=S=>{S.preventDefault(),S.stopPropagation(),p?.(g,S)},C=(0,n.cx)(E.wrapper,y,{[E.hover]:p!==void 0});return p?(0,t.jsxs)("button",{...d,className:C,onClick:v,ref:D,children:[c&&(0,t.jsx)(l.I,{name:c}),g]}):(0,t.jsxs)("span",{...d,className:C,ref:D,children:[c&&(0,t.jsx)(l.I,{name:c}),g]})});f.displayName="Tag";const h=({rootProps:g})=>{const p=(0,s.of)(i);return(0,t.jsx)(o.A,{width:60,height:22,containerClassName:p.container,...g})},u=(0,a.j)(f,h),i=()=>({container:(0,n.css)({lineHeight:1})}),x=(g,p,c)=>{let y;return c===void 0?y=(0,m.MC)(p):y=(0,m.yC)(c),{wrapper:(0,n.css)({appearance:"none",borderStyle:"none",fontWeight:g.typography.fontWeightMedium,fontSize:g.typography.size.sm,lineHeight:g.typography.bodySmall.lineHeight,verticalAlign:"baseline",backgroundColor:y.color,color:g.v1.palette.gray98,whiteSpace:"pre",textShadow:"none",padding:"3px 6px",borderRadius:g.shape.radius.default}),hover:(0,n.css)({"&:hover":{opacity:.85,cursor:"pointer"}})}}},37658:(ee,B,e)=>{"use strict";e.d(B,{L:()=>h});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(7685),m=e(21348),a=e(94018);const l=(0,r.memo)((0,r.forwardRef)(({displayMax:x,tags:g,icon:p,onClick:c,className:y,getAriaLabel:P,getColorIndex:d},D)=>{const b=(0,o.$j)(),E=i(b,!!(x&&x>0)),v=g.length,C=x?g.slice(0,x):g;return(0,t.jsxs)("ul",{className:(0,n.cx)(E.wrapper,y),"aria-label":(0,s.t)("grafana-ui.tags.list-label","Tags"),ref:D,children:[C.map((S,O)=>(0,t.jsx)("li",{className:E.li,children:(0,t.jsx)(a.v,{name:S,icon:p,onClick:c,"aria-label":P?.(S,O),"data-tag-id":O,colorIndex:d?.(S,O)})},S)),x&&x>0&&v-x>0&&(0,t.jsxs)("span",{className:E.moreTagsLabel,children:["+ ",v-x]})]})}));l.displayName="TagList";const f=({rootProps:x})=>{const g=(0,o.of)(u);return(0,t.jsxs)("div",{className:g.container,...x,children:[(0,t.jsx)(a.v.Skeleton,{}),(0,t.jsx)(a.v.Skeleton,{})]})},h=(0,m.j)(l,f),u=x=>({container:(0,n.css)({display:"flex",gap:x.spacing(1)})}),i=(x,g)=>({wrapper:(0,n.css)({position:"relative",alignItems:g?"center":"unset",display:"flex",flex:"1 1 auto",flexWrap:"wrap",flexShrink:g?0:1,justifyContent:"flex-end",gap:"6px"}),moreTagsLabel:(0,n.css)({color:x.colors.text.secondary,fontSize:x.typography.size.sm}),li:(0,n.css)({listStyle:"none"})})},10928:(ee,B,e)=>{"use strict";e.d(B,{u:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(7685),m=e(45861),a=e(63527),l=e(48542),f=e(76319);const h=({name:g,disabled:p,onRemove:c,autoColors:y=!0})=>{const P=(0,o.of)(u),d=(0,r.useMemo)(()=>{if(y){const{color:D,borderColor:b}=(0,l.MC)(g);return{backgroundColor:D,borderColor:b}}},[g,y]);return(0,t.jsxs)("li",{className:(0,n.cx)(P.itemStyle,!d&&P.defaultTagColor),style:d,children:[(0,t.jsx)("span",{className:P.nameStyle,children:g}),(0,t.jsx)(f.K,{name:"times",size:"lg",disabled:p,tooltip:(0,s.t)("grafana-ui.tags-input.remove","Remove tag: {{name}}",{name:g}),onClick:()=>c(g),className:P.buttonStyles})]})},u=g=>{const p=g.spacing.gridSize*3;return{itemStyle:(0,n.css)({display:"flex",gap:"3px",alignItems:"center",height:`${p}px`,lineHeight:`${p-2}px`,borderWidth:"1px",borderStyle:"solid",borderRadius:g.shape.radius.default,padding:`0 ${g.spacing(.5)}`,whiteSpace:"nowrap",textShadow:"none",fontWeight:500,fontSize:g.typography.size.sm,color:"#fff"}),defaultTagColor:(0,n.css)({backgroundColor:g.colors.background.secondary,borderColor:g.components.input.borderColor,color:g.colors.text.primary}),nameStyle:(0,n.css)({maxWidth:"25ch",textOverflow:"ellipsis",overflow:"hidden"}),buttonStyles:(0,n.css)({margin:0,"&:hover::before":{display:"none"}})}},i=({placeholder:g="New tag (enter key to add)",tags:p=[],onChange:c,width:y,className:P,disabled:d,addOnBlur:D,invalid:b,id:E,autoColors:v=!0})=>{const[C,S]=(0,r.useState)(""),O=(0,o.of)(x),I=(0,o.$j)(),R=(0,r.useCallback)(W=>{S(W.target.value)},[]),T=W=>{c(p.filter(N=>N!==W))},L=W=>{W?.preventDefault(),p.includes(C)||c(p.concat(C)),S("")},K=()=>{D&&C&&L()},A=W=>{W.key==="Enter"&&C!==""&&L(W)};return(0,t.jsxs)("div",{className:(0,n.cx)(O.wrapper,P,y?(0,n.css)({width:I.spacing(y)}):""),children:[(0,t.jsx)(a.p,{id:E,disabled:d,placeholder:g,onChange:R,value:C,onKeyDown:A,onBlur:K,invalid:b,suffix:(0,t.jsx)(m.$n,{fill:"text",className:O.addButtonStyle,onClick:L,size:"md",disabled:C.length<=0,children:(0,t.jsx)(s.x,{i18nKey:"grafana-ui.tags-input.add",children:"Add"})})}),p?.length>0&&(0,t.jsx)("ul",{className:O.tags,children:p.map(W=>(0,t.jsx)(h,{name:W,onRemove:T,disabled:d,autoColors:v},W))})]})},x=g=>({wrapper:(0,n.css)({minHeight:g.spacing(4),display:"flex",flexDirection:"column",gap:g.spacing(1),flexWrap:"wrap"}),tags:(0,n.css)({display:"flex",justifyContent:"flex-start",flexWrap:"wrap",gap:g.spacing(.5)}),addButtonStyle:(0,n.css)({margin:`0 -${g.spacing(1)}`})})},87105:(ee,B,e)=>{"use strict";e.d(B,{f:()=>m});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(3343);const m=(0,r.forwardRef)(({invalid:l,className:f,...h},u)=>{const i=(0,o.of)(a,l);return(0,t.jsx)("textarea",{...h,className:(0,n.cx)(i.textarea,f),ref:u})}),a=(l,f=!1)=>({textarea:(0,n.cx)((0,s.Xb)(l),(0,s.gm)(l),(0,n.css)({display:"block",borderRadius:l.shape.radiu
104s.default,padding:`${l.spacing.gridSize/4}px ${l.spacing.gridSize}px`,width:"100%",borderColor:f?l.colors.error.border:l.components.input.borderColor}))});m.displayName="TextArea"},59243:(ee,B,e)=>{"use strict";e.d(B,{G:()=>u});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(96540),a=e(63142),l=e(7685),f=e(71495),h=e(76319);const u=(0,m.memo)(({children:x,theme:g="info",placement:p="auto",content:c,title:y,closeButton:P=!0,onClose:d,footer:D,fitContent:b=!1,onOpen:E,show:v})=>{const C=(0,m.useRef)(null),S=(0,a.$j)(),O=(0,a.of)(i),I=O[g],[R,T]=(0,m.useState)(v),L=v??R,K=[(0,r.cY)(8),(0,r.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,r.BN)(),(0,r.UE)({element:C})],{context:A,refs:W,floatingStyles:N}=(0,o.we)({open:L,placement:(0,f.O)(p),onOpenChange:F=>{v===void 0&&T(F),F?E?.():d?.()},middleware:K,whileElementsMounted:s.ll,strategy:"fixed"}),w=(0,o.kp)(A),j=(0,o.s9)(A),{getReferenceProps:V,getFloatingProps:U}=(0,o.bv)([j,w]);return(0,t.jsxs)(t.Fragment,{children:[(0,m.cloneElement)(x,{ref:W.setReference,tabIndex:0,"aria-expanded":L,...V()}),L&&(0,t.jsx)(o.s3,{context:A,modal:!1,closeOnFocusOut:!1,children:(0,t.jsxs)("div",{"data-testid":"toggletip-content",className:(0,n.cx)(I.container,{[O.fitContent]:b}),ref:W.setFloating,style:N,...U(),children:[(0,t.jsx)(o.ie,{strokeWidth:.3,stroke:S.colors.border.weak,className:I.arrow,ref:C,context:A}),!!y&&(0,t.jsx)("div",{className:I.header,children:y}),P&&(0,t.jsx)("div",{className:I.headerClose,children:(0,t.jsx)(h.K,{"aria-label":(0,l.t)("grafana-ui.toggletip.close","Close"),name:"times","data-testid":"toggletip-header-close",onClick:()=>{T(!1),d?.()}})}),(0,t.jsxs)("div",{className:I.body,children:[(typeof c=="string"||(0,m.isValidElement)(c))&&c,typeof c=="function"&&c({})]}),!!D&&(0,t.jsx)("div",{className:I.footer,children:D})]})})]})});u.displayName="Toggletip";const i=x=>{const g=(0,f.f)(x,x.colors.background.primary,x.colors.border.weak,x.components.tooltip.text,{topBottom:2,rightLeft:2}),p=(0,f.f)(x,x.colors.error.main,x.colors.error.main,x.colors.error.contrastText,{topBottom:2,rightLeft:2});return{info:g,error:p,fitContent:(0,n.css)({maxWidth:"fit-content"})}}},7895:(ee,B,e)=>{"use strict";e.d(B,{I:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(30360),s=e(85629),m=e(63142),a=e(35484),l=e(45861),f=e(30703),h=e(45967);const u=(0,r.forwardRef)(({tooltip:p,icon:c,iconSize:y,className:P,children:d,imgSrc:D,imgAlt:b,fullWidth:E,isOpen:v,narrow:C,variant:S="default",iconOnly:O,"aria-label":I,isHighlighted:R,...T},L)=>{const K=(0,m.of)(g),A=(0,n.cx)({[K.button]:!0,[K.buttonFullWidth]:E,[K.narrow]:C},K[S],P),W=(0,n.cx)({[K.content]:!0,[K.contentWithIcon]:!!c,[K.contentWithRightIcon]:v!==void 0}),N=(0,t.jsxs)("button",{ref:L,className:A,"aria-label":i(I,p),"aria-expanded":v,type:"button",...T,children:[x(c,y),D&&(0,t.jsx)("img",{className:K.img,src:D,alt:b??""}),d&&!O&&(0,t.jsx)("div",{className:W,children:d}),v===!1&&(0,t.jsx)(f.I,{name:"angle-down"}),v===!0&&(0,t.jsx)(f.I,{name:"angle-up"}),R&&(0,t.jsx)("div",{className:K.highlight})]});return p?(0,t.jsx)(h.m,{ref:L,content:p,placement:"bottom",children:N}):N});u.displayName="ToolbarButton";function i(p,c){return p||(c?s.Tp.components.PageToolbar.item(c):void 0)}function x(p,c){return p?(0,o.n6)(p)?(0,t.jsx)(f.I,{name:p,size:`${c||"lg"}`}):p:null}const g=p=>{const c=(0,l.U_)(p,"primary","solid"),y=(0,l.U_)(p,"destructive","solid"),P=(0,n.css)({color:p.colors.text.primary,background:p.colors.secondary.main,"&:hover":{color:p.colors.text.primary,background:p.colors.secondary.shade,border:`1px solid ${p.colors.border.medium}`}});return{button:(0,n.css)({label:"toolbar-button",position:"relative",display:"flex",alignItems:"center",height:p.spacing(p.components.height.md),padding:p.spacing(0,1),borderRadius:p.shape.radius.default,lineHeight:`${p.components.height.md*p.spacing.gridSize-2}px`,fontWeight:p.typography.fontWeightMedium,border:`1px solid ${p.colors.secondary.border}`,whiteSpace:"nowrap",[p.transitions.handleMotion("no-preference","reduce")]:{transition:p.transitions.create(["background","box-shadow","border-color","color"],{duration:p.transitions.duration.short})},[p.breakpoints.down("md")]:{width:"auto !important"},"&:focus, &:focus-visible":{...(0,a.getFocusStyles)(p),zIndex:1},"&:focus:not(:focus-visible)":(0,a.getMouseFocusStyles)(p),"&[disabled], &:disabled":{cursor:"not-allowed",opacity:p.colors.action.disabledOpacity,background:p.colors.action.disabledBackgroun
104d,boxShadow:"none","&:hover":{color:p.colors.text.disabled,background:p.colors.action.disabledBackground,boxShadow:"none"}}}),default:(0,n.css)({color:p.colors.text.secondary,background:"transparent",border:"1px solid transparent","&:hover":{color:p.colors.text.primary,background:p.colors.action.hover}}),canvas:P,active:(0,n.cx)(P,(0,n.css)({"&::before":{display:"block",content:'" "',position:"absolute",left:0,right:0,height:"2px",bottom:0,borderRadius:p.shape.radius.default,backgroundImage:p.colors.gradients.brandHorizontal}})),primary:(0,n.css)(c),destructive:(0,n.css)(y),narrow:(0,n.css)({padding:p.spacing(0,.5)}),img:(0,n.css)({width:"16px",height:"16px",marginRight:p.spacing(1)}),buttonFullWidth:(0,n.css)({flexGrow:1}),content:(0,n.css)({display:"flex",flexGrow:1}),contentWithIcon:(0,n.css)({display:"none",paddingLeft:p.spacing(1),[`@media ${a.mediaUp(p.v1.breakpoints.md)}`]:{display:"block"}}),contentWithRightIcon:(0,n.css)({paddingRight:p.spacing(.5)}),highlight:(0,n.css)({backgroundColor:p.colors.success.main,borderRadius:p.shape.radius.circle,width:"6px",height:"6px",position:"absolute",top:"-3px",right:"-3px",zIndex:1})}}},36219:(ee,B,e)=>{"use strict";e.d(B,{U:()=>u});var t=e(74848),n=e(22803),r=e(18828),o=e(42211),s=e(93225),m=e(96540),a=e(63142),l=e(7685),f=e(15245),h=e(7895);const u=(0,m.forwardRef)(({alignment:x="left",className:g,children:p,...c},y)=>{const P=m.Children.toArray(p).filter(K=>K!=null),[d,D]=(0,m.useState)(Array(P.length).fill(!1)),b=(0,m.useRef)(null),[E,v]=(0,m.useState)(!1),C=(0,m.useRef)(null),S=(0,m.createRef)(),{overlayProps:O}=(0,s.e)({onClose:()=>v(!1),isDismissable:!0,isOpen:E,shouldCloseOnInteractOutside:K=>{const A=(0,f.gF)();return!C.current?.contains(K)&&!A.contains(K)}},S),{dialogProps:I}=(0,r.s)({},S),R=(0,a.$j)(),T=x==="left"?d.indexOf(!1)-1:d.length,L=i(R,T,x);return(0,m.useLayoutEffect)(()=>{const K=new IntersectionObserver(A=>{A.forEach(W=>{if(W.target instanceof HTMLElement&&W.target.parentNode){const N=Array.prototype.indexOf.call(W.target.parentNode.children,W.target);D(w=>{const j=[...w];return j[N]=W.isIntersecting,j})}})},{threshold:1,root:b.current});return b.current&&Array.from(b.current.children).forEach(A=>{A instanceof HTMLElement&&A!==C.current&&K.observe(A)}),()=>K.disconnect()},[p]),(0,t.jsxs)("div",{ref:b,className:(0,n.cx)(L.container,g),...c,children:[P.map((K,A)=>(0,t.jsx)("div",{style:{order:A,visibility:d[A]?"visible":"hidden"},className:L.childWrapper,children:K},A)),d.includes(!1)&&(0,t.jsxs)("div",{ref:C,className:L.overflowButton,children:[(0,t.jsx)(h.I,{variant:E?"active":"default",tooltip:(0,l.t)("grafana-ui.toolbar-button-row.show-more","Show more items"),onClick:()=>v(!E),icon:"ellipsis-v",iconOnly:!0,narrow:!0}),E&&(0,t.jsx)(o.n1,{contain:!0,autoFocus:!0,children:(0,t.jsx)("div",{className:L.overflowItems,ref:S,...O,...I,children:P.map((K,A)=>!d[A]&&K)})})]})]})});u.displayName="ToolbarButtonRow";const i=(x,g,p)=>({overflowButton:(0,n.css)({order:g}),overflowItems:(0,n.css)({alignItems:"center",backgroundColor:x.colors.background.primary,borderRadius:x.shape.radius.default,boxShadow:x.shadows.z2,display:"flex",flexWrap:"wrap",gap:x.spacing(1),marginTop:x.spacing(1),maxWidth:"80vw",padding:x.spacing(.5,1),position:"absolute",right:0,top:"100%",width:"max-content",zIndex:x.zIndex.dropdown}),container:(0,n.css)({alignItems:"center",display:"flex",gap:x.spacing(1),justifyContent:p==="left"?"flex-start":"flex-end",minWidth:0,position:"relative"}),childWrapper:(0,n.css)({alignItems:"center",display:"flex",gap:x.spacing(1)})})},2381:(ee,B,e)=>{"use strict";e.d(B,{A:()=>f});var t=e(74848),n=e(34743),r=e(83505),o=e(46885),s=e(96540),m=e(63142),a=e(71495),l=e(15245);function f({content:h,show:u,placement:i,className:x,wrapperClassName:g,referenceElement:p,renderArrow:c,hidePopper:y,...P}){const d=(0,m.$j)(),D=(0,s.useRef)(null),b=[(0,n.cY)(8),(0,n.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,n.BN)()];c&&b.push((0,n.UE)({element:D}));const{context:E,refs:v,floatingStyles:C}=(0,r.we)({open:u,placement:(0,a.O)(i),middleware:b,whileElementsMounted:o.ll,strategy:"fixed"});(0,s.useLayoutEffect)(()=>{v.setReference(p)},[p,v]);const{styles:S}=(0,r.DL)(E,{initial:()=>({opacity:0}
104),duration:d.transitions.duration.enteringScreen});return u?(0,t.jsx)(l.ZL,{children:(0,t.jsx)("div",{ref:v.setFloating,style:{...C,...S},className:g,...P,children:(0,t.jsxs)("div",{className:x,children:[c&&(0,t.jsx)(r.ie,{fill:d.colors.border.weak,ref:D,context:E}),typeof h=="string"&&h,s.isValidElement(h)&&s.cloneElement(h),typeof h=="function"&&h({hidePopper:y})]})})}):void 0}},43533:(ee,B,e)=>{"use strict";e.d(B,{I:()=>n});var t=e(96540);class n extends t.Component{constructor(){super(...arguments),this.hideTimeout=null,this.state={show:!1},this.showPopper=()=>{this.hideTimeout&&clearTimeout(this.hideTimeout),this.setState({show:!0})},this.hidePopper=()=>{this.hideTimeout=setTimeout(()=>{this.setState({show:!1})},this.props.hideAfter)}}render(){const{children:o,content:s,placement:m="auto"}=this.props,{show:a}=this.state;return o(this.showPopper,this.hidePopper,{show:a,placement:m,content:s})}}},20662:(ee,B,e)=>{"use strict";e.d(B,{z:()=>o});var t=e(74848),n=e(96540);function r(s,m){const a=[];return s.forEach(l=>{a.push(l.start,l.end+1)}),a[0]!==0&&a.unshift(0),a[a.length-1]!==m&&a.push(m),a}const o=s=>{let{highlightParts:m,text:a,highlightClassName:l}=s;if(!m?.length)return null;let f=[],h=r(m,a.length),u=m[0].start===0;for(let i=1;i<h.length;i++){let x=h[i-1],g=h[i];f.push((0,n.createElement)(u?"mark":"span",{key:i-1,className:u?l:void 0},a.substring(x,g))),u=!u}return(0,t.jsx)("div",{children:f})}},12965:(ee,B,e)=>{"use strict";e.d(B,{p:()=>a});var t=e(74848),n=e(96540),r=e(55386),o=e(7685),s=e(64913);function m(l){return`Custom unit: ${l}`}class a extends n.PureComponent{constructor(){super(...arguments),this.onChange=f=>{this.props.onChange(f.value)}}render(){const{value:f,width:h}=this.props;let u;const x=(0,r.Ke)().map(g=>{const p=g.submenu.map(c=>{const y={label:c.text,value:c.value};return c.value===f&&(u=y),y});return{label:g.text,value:g.text,items:p}});return f&&!u&&(u={value:f,label:f}),(0,t.jsx)(s.v,{width:h,initialValue:u&&u.label,allowCustomValue:!0,changeOnSelect:!1,formatCreateLabel:m,options:x,placeholder:(0,o.t)("grafana-ui.unit-picker.placeholder","Choose"),isClearable:!0,onSelect:this.props.onChange})}}},71555:(ee,B,e)=>{"use strict";e.d(B,{e:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(43990);const s=({src:a,alt:l,width:f,height:h})=>{const u=(0,r.of)(m,f,h);return(0,t.jsx)("img",{className:u.image,src:a,alt:l})},m=(a,l=3,f=3)=>({image:(0,n.css)([(0,o.Y)(a,l,h=>({width:a.spacing(h)})),(0,o.Y)(a,f,h=>({height:a.spacing(h)})),{borderRadius:a.shape.radius.circle}])})},59695:(ee,B,e)=>{"use strict";e.d(B,{i:()=>a});var t=e(74848),n=e(96540),r=e(85629),o=e(63142),s=e(45861),m=e(18857);function a({"aria-label":l,label:f,icon:h,options:u,onChange:i,variant:x,minWidth:g=16,size:p="sm",isFullWidth:c=!0,menuPlacement:y,fill:P,buttonCss:d}){const[D,b]=(0,n.useState)(!1),E=(0,o.$j)();return(0,t.jsxs)(t.Fragment,{children:[!D&&(0,t.jsx)(s.$n,{size:p||"sm",className:d,icon:h||"plus",onClick:()=>b(!0),variant:x,fill:P,fullWidth:c,"data-testid":r.Tp.components.ValuePicker.button(l??f),children:f}),D&&(0,t.jsx)("span",{style:{minWidth:E.spacing(g),flexGrow:c?1:void 0},children:(0,t.jsx)(m.l6,{placeholder:f,options:u,"aria-label":r.Tp.components.ValuePicker.select(l??f),isOpen:!0,onCloseMenu:()=>b(!1),autoFocus:!0,onChange:v=>{b(!1),i(v)},menuPlacement:y})})]})}},54735:(ee,B,e)=>{"use strict";e.d(B,{KU:()=>a});var t=e(74848),n=e(22803),r=e(49185),o=e(63142),s=e(35484),m=e(92807);const a=({width:h,height:u,legend:i,children:x})=>{const g=(0,o.$j)(),p=(0,o.of)(l),c={display:"flex",width:`${h}px`,height:`${u}px`},[y,P]=(0,r.A)();if(!i)return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{style:c,className:p.viz,children:x(h,u)})});let{placement:d,maxHeight:D="35%",maxWidth:b="60%"}=i.props;document.body.clientWidth<g.breakpoints.values.lg&&(d="bottom");let E=null;const v={};switch(d){case"bottom":c.flexDirection="column",v.maxHeight=D,P.height&&(E={width:h,height:u-P.height});break;case"right":c.flexDirection="row",v.maxWidth=b,P.width&&(E={width:h-P.width,height:u}),i.props.width&&(v.width=i.props.width,E={width:h-i.props.width,height:u});break}return E?.width===0&&(E.width=h),E?.height===0&&(E.height=u),(0,t.jsxs)("div",{style:c,children:[(0,t.jsx)("div",{className:p.viz,children:E&&x(E.width,E.height)}),(0,t.jsx)("div",{style:v,ref:y,children:(0,t.jsx)(m.P,{children:i})})]})},l=h=>
104({viz:(0,n.css)({flexGrow:2,borderRadius:h.shape.radius.default,"&:focus-visible":(0,s.getFocusStyles)(h)})}),f=({children:h})=>(0,t.jsx)(t.Fragment,{children:h});a.Legend=f},71479:(ee,B,e)=>{"use strict";e.d(B,{p:()=>m});var t=e(74848),n=e(22803),r=e(96540),o=e(76637),s=e(63142);const m=r.memo(r.forwardRef(({color:l,className:f,gradient:h,lineStyle:u,...i},x)=>{const g=(0,s.$j)(),p=(0,s.of)(a);let c;if(h){const P=o.uf.get(h).getColors?.(g);P?.length?c=`linear-gradient(90deg, ${P.join(", ")})`:c=g.visualization.getColorByName("")}else c=l;let y;return u?.fill==="dot"&&!h?y={backgroundImage:`radial-gradient(circle at 2px 2px, ${l} 2px, transparent 0)`,backgroundSize:"4px 4px",backgroundRepeat:"space"}:u?.fill==="dash"&&!h?y={backgroundImage:`linear-gradient(to right, ${l} 100%, transparent 0%)`,backgroundSize:"6px 4px",backgroundRepeat:"space"}:y={background:c,borderRadius:g.shape.radius.pill},(0,t.jsx)("div",{"data-testid":"series-icon",ref:x,className:(0,n.cx)(f,p.forcedColors,p.container),style:y,...i})})),a=l=>({container:(0,n.css)({marginRight:"8px",display:"inline-block",width:"14px",height:"4px"}),forcedColors:(0,n.css)({"@media (forced-colors: active)":{forcedColorAdjust:"none"}})});m.displayName="SeriesIcon"},78055:(ee,B,e)=>{"use strict";e.d(B,{t:()=>I});var t=e(74848),n=e(96540),r=e(57852),o=e(739),s=e(64400),m=e(49256),a=e(22803),l=e(63142),f=e(34950),h=e(5585),u=e(89123);const i=({items:R,itemRenderer:T,onLabelMouseOver:L,onLabelMouseOut:K,onLabelClick:A,placement:W,className:N,readonly:w})=>{const j=(0,l.of)(x);T||(T=U=>(0,t.jsx)(u.M,{item:U,onLabelClick:A,onLabelMouseOver:L,onLabelMouseOut:K,readonly:w}));const V=U=>`${U.getItemKey?U.getItemKey():U.label}`;switch(W){case"right":{const U=(F,M)=>(0,t.jsx)("span",{className:j.itemRight,children:T(F,M)});return(0,t.jsx)("div",{className:(0,a.cx)(j.rightWrapper,N),children:(0,t.jsx)(h.B,{items:R,renderItem:U,getItemKey:V})})}case"bottom":default:{const U=R.filter(H=>H.yAxis===1),F=R.filter(H=>H.yAxis!==1),M=(H,_)=>(0,t.jsx)("span",{className:j.itemBottom,children:T(H,_)});return(0,t.jsxs)("div",{className:(0,a.cx)(j.bottomWrapper,N),children:[U.length>0&&(0,t.jsx)("div",{className:j.section,children:(0,t.jsx)(f.c,{items:U,renderItem:M,getItemKey:V})}),F.length>0&&(0,t.jsx)("div",{className:(0,a.cx)(j.section,j.sectionRight),children:(0,t.jsx)(f.c,{items:F,renderItem:M,getItemKey:V})})]})}}};i.displayName="VizLegendList";const x=R=>{const T=(0,a.css)({paddingRight:"10px",display:"flex",fontSize:R.typography.bodySmall.fontSize,whiteSpace:"nowrap"});return{itemBottom:T,itemRight:(0,a.cx)(T,(0,a.css)({marginBottom:R.spacing(.5)})),rightWrapper:(0,a.css)({padding:R.spacing(.5)}),bottomWrapper:(0,a.css)({display:"flex",flexWrap:"wrap",justifyContent:"space-between",width:"100%",padding:R.spacing(.5),gap:"15px 25px"}),section:(0,a.css)({display:"flex"}),sectionRight:(0,a.css)({justifyContent:"flex-end",flexGrow:1,flexBasis:"50%"})}};var g=e(30703),p=e(55386),c=e(35484),y=e(7685),P=e(87);const d=({item:R,onLabelClick:T,onLabelMouseOver:L,onLabelMouseOut:K,className:A,readonly:W})=>{const N=(0,l.of)(D),w=(0,n.useCallback)(U=>{L&&L(R,U)},[R,L]),j=(0,n.useCallback)(U=>{K&&K(R,U)},[R,K]),V=(0,n.useCallback)(U=>{T&&T(R,U)},[R,T]);return(0,t.jsxs)("tr",{className:(0,a.cx)(N.row,A),children:[(0,t.jsx)("td",{children:(0,t.jsxs)("span",{className:N.itemWrapper,children:[(0,t.jsx)(P.R,{color:R.color,seriesName:R.fieldName??R.label,readonly:W,lineStyle:R.lineStyle}),(0,t.jsxs)("button",{disabled:W,type:"button",title:R.label,onBlur:j,onFocus:w,onMouseOver:w,onMouseOut:j,onClick:W?void 0:V,className:(0,a.cx)(N.label,R.disabled&&N.labelDisabled),children:[R.label," ",R.yAxis===2&&(0,t.jsx)("span",{className:N.yAxisLabel,children:(0,t.jsx)(y.x,{i18nKey:"grafana-ui.viz-legend.right-axis-indicator",children:"(right y-axis)"})})]})]})}),R.getDisplayValues&&R.getDisplayValues().map((U,F)=>(0,t.jsx)("td",{className:N.value,children:(0,p.cN)(U)},`${U.title}-${F}`))]})};d.displayName="LegendTableItem";const D=R=>{const T=c.hoverColor(R.colors.background.primary,R);return{row:(0,a.css)({label:"LegendRow",fontSize:R.v1.typography.size.sm,borderBottom:`1px solid ${R.colors.border.weak}`,td:{padding:R.spacing(.25,1),whiteSpace:"nowrap"},"&:hover":{background:T}}),label:(0,a.css)({label:"LegendLabel",whiteSpace:"nowrap",background:"none",border:"none",fontSize:"inherit",padding:0,maxWidth:"600px",textOverflow:"ellipsis",overflow:"hidden",userSelect:"text"}),labelDisabled:(0,a.css)({label:"LegendLabelDisabled",color:R.colors.text.disabled}),itemWrapper:(0,a.css)({display:"flex",whiteSpace:"nowrap",alignItems:"center"}),value:(0,a.css)({textAlign:"right"}),yAxisLabel:(0,a.css)({color:R.colors.text.secondary})}},b="Name",E=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}).compare,v=({items:R,sortBy:T,sortDesc:L,itemRenderer:K,className:A,onToggleSort:W,onLabelClick:N,onLabelMouseOver:w,onLabelMouseOut:j,readonly:V,isSortable:U})=>{const F=(0,l.of)(C),M={};U&&(M[b]="");for(const H of R)if(H.getDisplayValues)for(const _ of H.getDisplayValues())M[_.title??"?"]=_.description??"";if(T!=null){let H=new Map;R.forEach(Z=>{if(T!==b&&Z.getDisplayValues){const ne=Z.getDisplayValues().find(Y=>Y.title===T),te=ne==null||Number.isNaN(ne.numeric)?-1/0:ne.numeric;H.set(Z,te)}});let _=L?-1:1;T===b?R.sort((Z,ne)=>_*E(Z.label,ne.label)):R.sort((Z,ne)=>{const te=H.get(Z)??0,Y=H.get(ne)??0;return _*(te-Y)})}return K||(K=(H,_)=>(0,t.jsx)(d,{item:H,onLabelClick:N,onLabelMouseOver:w,onLabelMouseOut:j,readonly:V},`${H.label}-${_}`)),(0,t.jsxs)("table",{className:(0,a.cx)(F.table,A),children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[!U&&(0,t.jsx)("th",{}),Object.keys(M).map(H=>(0,t.jsxs)("th",{title:M[H],className:(0,a.cx)(F.header,W&&F.headerSortable,U&&F.nameHeader,{[F.withIcon]:T===H}),onClick:()=>{W&&W(H)},children:[H,T===H&&(0,t.jsx)(g.I,{size:"xs",name:L?"angle-down":"angle-up"})]},H))]})}),(0,t.jsx)("tbody",{children:R.map(K)})]})},C=R=>({table:(0,a.css)({width:"100%","th:first-child":{width:"100%",borderBottom:`1px solid ${R.colors.border.weak}`}}),header:(0,a.css)({color:R.colors.primary.text,fontWeight:R.typography.fontWeightMedium,borderBottom:`1px solid ${R.colors.border.weak}`,padding:R.spacing(.25,1,.25,1),fontSize:R.typography.bodySmall.fontSize,textAlign:"right",whiteSpace:"nowrap"}),nameHeader:(0,a.css)({textAlign:"left",paddingLeft:"30px"}),withIcon:(0,a.css)({paddingRight:"4px"}),headerSortable:(0,a.css)({cursor:"pointer"})});var S=e(22940),O=e(96384);function I({items:R,thresholdItems:T,mappingItems:L,displayMode:K,sortBy:A,seriesVisibilityChangeBehavior:W=S.K.Isolate,sortDesc:N,onLabelClick:w,onToggleSort:j,placement:V,className:U,itemRenderer:F,readonly:M,isSortable:H}){const{eventBus:_,onToggleSeriesVisibility:Z,onToggleLegendSort:ne}=(0,s.d2)(),te=(0,n.useCallback)((q,X)=>{_?.publish({type:r.b_.type,payload:{raw:X,x:0,y:0,dataId:q.label}})},[_]),Y=(0,n.useCallback)((q,X)=>{_?.publish({type:r.ql.type,payload:{raw:X,x:0,y:0,dataId:q.label}})},[_]),Q=(0,n.useCallback)((q,X)=>{w&&w(q,X),Z&&Z(q.fieldName??q.label,W===S.K.Hide?m.B.AppendToSelection:(0,O.W)(X))},[Z,w,W]),J=(0,n.useCallback)(q=>(0,t.jsx)(i,{className:U,placement:V,onLabelMouseOver:te,onLabelMouseOut:Y,onLabelClick:Q,itemRenderer:F,readonly:M,items:q}),[U,V,te,Y,Q,F,M]);switch(K){case o.lm.Table:return(0,t.jsx)(v,{className:U,items:R,placement:V,sortBy:A,sortDesc:N,onLabelClick:Q,onToggleSort:j||ne,onLabelMouseOver:te,onLabelMouseOut:Y,itemRenderer:F,readonly:M,isSortable:H});case o.lm.List:const q=T&&T.length>1,X=L&&L.length>0;return(0,t.jsxs)(t.Fragment,{children:[!q&&(!X||R.length>1)&&J(R),q&&J(T),X&&J(L)]});default:return null}}I.displayName="VizLegend"},89123:(ee,B,e)=>{"use strict";e.d(B,{M:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(63142),m=e(87),a=e(2543),l=e(55386),f=e(34950);const h=({stats:g})=>{const p=(0,s.of)(u);return g.length===0?null:(0,t.jsx)(f.c,{className:p.list,items:g,renderItem:c=>(0,t.jsxs)("div",{className:p.item,title:c.description,children:[c.title&&`${(0,a.capitalize)(c.title)}:`," ",(0,l.cN)(c)]})})},u=()=>({list:(0,n.css)({flexGrow:1,textAlign:"right"}),item:(0,n.css)({marginLeft:"8px"})});h.displayName="VizLegendStatsList";const i=({item:g,onLabelClick:p,onLabelMouseOver:c,onLabelMouseOut:y,className:P,readonly:d})=>{const D=(0,s.of)(x),b=(0,r.useCallback)(C=>{c&&c(g,C)},[g,c]),E=(0,r.useCallback)(C=>{y&&y(g,C)},[g,y]),v=(0,r.useCallback)(C=>{p&&p(g,C)},[g,p]);return(0,t.jsxs)("div",{className:(0,n.cx)(D.itemWrapper,g.disabled&&D.itemDisabled,P),"data-testid":o.Tp.components.VizLegend.seriesName(g.label),children:[(0,t.jsx)(m.R,{seriesName:g.fieldName??g.label,color:g.color,gradient:g.gradient,readonly:d,lineStyle:g.lineStyle}),(0,t.jsx)("button",{disabled:d,type:"button",onBlur:E,onFocus:b,onMouseOver:b,onMouseOut:E,onClick:v,className:D.label,children:g.label}),g.getDisplayValues&&(0,t.jsx)(h,{stats:g.getDisplayValues()})]})};i.displayName="VizLegendListItem";const x=g=>({label:(0,n.css)({label:"LegendLabel",whiteSpace:"nowrap",background:"none",border:"none",fontSize:"inherit",padding:0,userSelect:"text"}),itemDisabled:(0,n.css)({label:"LegendLabelDisabled",color:g.colors.text.disabled}),itemWrapper:(0,n.css)({label:"LegendItemWrapper",display:"flex",whiteSpace:"nowrap",alignItems:"center",flexGrow:1}),value:(0,n.css)({textAlign:"right"}),yAxisLabel:(0,n.css)({color:g.v1.palette.gray2})})},87:(ee,B,e)=>{"use strict";e.d(B,{R:()=>m});var t=e(74848),n=e(96540),r=e(35427),o=e(64400),s=e(71479);const m=(0,n.memo)(({seriesName:a,color:l,gradient:f,readonly:h,lineStyle:u})=>{const{onSeriesColorChange:i}=(0,o.d2)(),x=(0,n.useCallback)(g=>i(a,g),[a,i]);
104return a&&i&&l&&!h?(0,t.jsx)(r.Dp,{color:l,onChange:x,enableNamedColors:!0,children:({ref:g,showColorPicker:p,hideColorPicker:c})=>(0,t.jsx)(s.p,{color:l,className:"pointer",ref:g,onClick:p,onMouseLeave:c,lineStyle:u})}):(0,t.jsx)(s.p,{color:l,gradient:f,lineStyle:u})});m.displayName="VizLegendSeriesIcon"},22940:(ee,B,e)=>{"use strict";e.d(B,{K:()=>t});var t=(n=>(n[n.Isolate=0]="Isolate",n[n.Hide=1]="Hide",n))(t||{})},96384:(ee,B,e)=>{"use strict";e.d(B,{W:()=>n});var t=e(49256);function n(r){return r.ctrlKey||r.metaKey||r.shiftKey?t.B.AppendToSelection:t.B.ToggleSelection}},33352:(ee,B,e)=>{"use strict";e.d(B,{S:()=>a});var t=e(74848),n=e(2543),r=e(96540),o=e(38919);const s=(f,h,u,i)=>{const x=m(f,h,i),g=m(h,f,i),p=Math.max(x,g);let c=Math.floor(f/p),y=Math.ceil(i/c);c=Math.ceil(i/y);const P=c-(c*y-i),d=f/P-u+u/P;return{width:f/c-u+u/c,height:h/y-u+u/y,widthOnLastRow:d,xCount:c,yCount:y}};function m(f,h,u){const i=Math.ceil(Math.sqrt(u*f/h));return Math.floor(i*h/f)*i<u?h/Math.ceil(i*h/f):f/i}class a extends r.PureComponent{static{this.defaultProps={itemSpacing:8}}constructor(h){super(h),this.state={values:h.getValues()}}componentDidUpdate(h){const{renderCounter:u,source:i}=this.props;(u!==h.renderCounter||i!==h.source)&&this.setState({values:this.props.getValues()})}getOrientation(){const{orientation:h,width:u,height:i}=this.props;return h===o.wV.Auto?u>i?o.wV.Vertical:o.wV.Horizontal:h}renderGrid(){const{renderValue:h,height:u,width:i,itemSpacing:x,getAlignmentFactors:g,orientation:p}=this.props,{values:c}=this.state,y=s(i,u,x,c.length),P=g?g(c,y.width,y.height):{};let d=0,D=0,b=[];for(let E=0;E<c.length;E++){const v=c[E],S=D===y.yCount-1?y.widthOnLastRow:y.width,O=y.height,I=d*S+x*d,R=D*O+x*D,T={position:"absolute",left:I,top:R,width:`${S}px`,height:`${O}px`};b.push((0,t.jsx)("div",{style:T,children:h({value:v,width:S,height:O,alignmentFactors:P,orientation:p,count:c.length})},E)),d++,d===y.xCount&&(d=0,D++)}return(0,t.jsx)("div",{style:{position:"relative"},children:b})}render(){const{renderValue:h,height:u,width:i,itemSpacing:x,getAlignmentFactors:g,autoGrid:p,orientation:c,maxVizHeight:y,minVizWidth:P,minVizHeight:d}=this.props,{values:D}=this.state;if(p&&c===o.wV.Auto)return this.renderGrid();const b={display:"flex"},E={display:"flex",overflow:`${P?"auto":"hidden"} ${d?"auto":"hidden"}`};let v=u,C=i;const S=this.getOrientation();switch(S){case o.wV.Horizontal:const I=(u+x)/D.length-x;E.flexDirection="column",E.height=`${u}px`,E.overflowX="hidden",E.scrollbarWidth="thin",b.marginBottom=`${x}px`,C=i,v=(0,n.clamp)(I,d??0,y??I);break;case o.wV.Vertical:E.flexDirection="row",E.justifyContent="space-between",E.overflowY="hidden",b.marginRight=`${x}px`,v=u,C=Math.max(i/D.length-x+x/D.length,P??0)}b.width=`${C}px`,b.height=`${v}px`;const O=g?g(D,C,v):{};return(0,t.jsx)("div",{style:E,children:D.map((I,R)=>(0,t.jsx)("div",{style:l(b,R,D.length),children:h({value:I,width:C,height:v,alignmentFactors:O,orientation:S,count:D.length})},R))})}}function l(f,h,u){return h===u-1?{...f,marginRight:0,marginBottom:0}:f}},63428:(ee,B,e)=>{"use strict";e.d(B,{g:()=>a,o:()=>l});var t=e(74848),n=e(22803),r=e(63142),o=e(7685),s=e(71479);const m=f=>({icon:(0,n.css)({marginRight:f.spacing(1),verticalAlign:"middle"}),seriesTable:(0,n.css)({display:"table"}),seriesTableRow:(0,n.css)({display:"table-row",fontSize:f.typography.bodySmall.fontSize}),seriesTableCell:(0,n.css)({display:"table-cell"}),label:(0,n.css)({wordBreak:"break-all"}),value:(0,n.css)({paddingLeft:f.spacing(2),textAlign:"right"}),activeSeries:(0,n.css)({fontWeight:f.typography.fontWeightBold,color:f.colors.text.maxContrast}),timestamp:(0,n.css)({fontWeight:f.typography.fontWeightBold,fontSize:f.typography.bodySmall.fontSize})}),a=({color:f,label:h,value:u,isActive:i})=>{const x=(0,r.of)(m);return(0,t.jsxs)("div",{"data-testid":"SeriesTableRow",className:(0,n.cx)(x.seriesTableRow,i&&x.activeSeries),children:[f&&(0,t.jsx)("div",{className:x.seriesTableCell,children:(0,t.jsx)(s.p,{color:f,className:x.icon})}),h&&(0,t.jsx)("div",{className:(0,n.cx)(x.seriesTableCell,x.label),children:h}),u&&(0,t.jsx)("div",{className:(0,n.cx)(x.seriesTableCell,x.value),
104children:u})]})},l=({timestamp:f,series:h})=>{const u=(0,r.of)(m);return(0,t.jsxs)(t.Fragment,{children:[f&&(0,t.jsx)("div",{className:u.timestamp,"aria-label":(0,o.t)("grafana-ui.viz-tooltip.timestamp","Timestamp"),children:f}),h.map((i,x)=>(0,t.jsx)(a,{isActive:i.isActive,label:i.label,color:i.color,value:i.value},`${i.label}-${x}`))]})}},71076:(ee,B,e)=>{"use strict";e.d(B,{o:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(52908),s=e(63142),m=e(35484),a=e(55302);const l=({position:{x:h,y:u},offset:{x:i,y:x},children:g,allowPointerEvents:p=!1,className:c,...y})=>{const P=(0,r.useRef)(null),[d,D]=(0,r.useState)({width:0,height:0}),{width:b,height:E}=(0,o.A)(),[v,C]=(0,r.useState)({x:h+i,y:u+x}),S=(0,r.useMemo)(()=>new ResizeObserver(I=>{for(let R of I){const T=Math.floor(R.contentRect.width+16),L=Math.floor(R.contentRect.height+2*8);(d.width!==T||d.height!==L)&&D({width:Math.min(T,b),height:Math.min(L,E)})}}),[d,b,E]);(0,r.useLayoutEffect)(()=>(P.current&&S.observe(P.current),()=>{S.disconnect()}),[S]),(0,r.useLayoutEffect)(()=>{if(P&&P.current){const{x:I,y:R}=(0,a.Ju)(h,u,d.width,d.height,i,x,b,E);C({x:I,y:R})}},[b,E,h,i,u,x,d]);const O=(0,s.of)(f);return(0,t.jsx)("div",{ref:P,style:{position:"fixed",left:0,pointerEvents:p?"auto":"none",top:0,transform:`translate(${v.x}px, ${v.y}px)`,transition:"transform ease-out 0.1s"},"aria-live":"polite","aria-atomic":"true",...y,className:(0,n.cx)(O.wrapper,c),children:g})};l.displayName="VizTooltipContainer";const f=h=>({wrapper:(0,n.css)((0,m.getTooltipContainerStyles)(h))})},55978:(ee,B,e)=>{"use strict";e.d(B,{Ev:()=>r,fX:()=>t,lJ:()=>n});var t=(o=>(o.series="series",o.value="value",o.hexagon="hexagon",o.pie_1_4="pie_1_4",o.pie_2_4="pie_2_4",o.pie_3_4="pie_3_4",o.marker_sm="marker_sm",o.marker_md="marker_md",o.marker_lg="marker_lg",o))(t||{}),n=(o=>(o.hidden="hidden",o.first="first",o.leading="leading",o.trailing="trailing",o))(n||{});const r="series"},55302:(ee,B,e)=>{"use strict";e.d(B,{Ju:()=>a,L$:()=>l,cp:()=>i});var t=e(95004),n=e(76637),r=e(55386),o=e(64394),s=e(739),m=e(55978);const a=(x=0,g=0,p=0,c=0,y=0,P=0,d=0,D=0)=>{let b=x,E=g;const v=Math.max(x+y+p-(d-y),0),C=Math.abs(Math.min(x-y-p-y,0)),S=v>0,O=C>0,I=Math.max(g+P+c-(D-P),0),R=Math.abs(Math.min(g-P-c-P,0)),T=I>0,L=R>0;return S&&O?b=v>C?y:d-y-p:S?b=x-y-p:b=x+y,T&&L?E=I>R?P:D-P-c:T?E=g-P-c:E=g+P,{x:b,y:E}},l=(x,g)=>{switch(x){case m.fX.value:return g.value;case m.fX.hexagon:return g.hexagon;case m.fX.pie_1_4:return g.pie_1_4;case m.fX.pie_2_4:return g.pie_2_4;case m.fX.pie_3_4:return g.pie_3_4;case m.fX.marker_sm:return g.marker_sm;case m.fX.marker_md:return g.marker_md;case m.fX.marker_lg:return g.marker_lg;default:return g.value}},f=(x,g)=>x.numeric-g.numeric,h=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),u=(x,g)=>h.compare(`${x.value}`,`${g.value}`),i=(x,g,p,c,y,P,d=b=>!0,D=!1)=>{let b=[],E=!0;for(let v=0;v<x.length;v++){const C=x[v];if(C===g||C.type===t.PU.time||!d(C)||C.config.custom?.hideFrom?.tooltip||C.config.custom?.hideFrom?.viz||y===s.$N.Single&&c!==v)continue;let S=p[v];if(S==null)continue;C.type===t.PU.number||C.type===t.PU.boolean||C.type===t.PU.enum||(E=!1);const O=x[v].values[S];if(O==null&&C.config.noValue==null||D&&O===0)continue;const I=C.display(O),R=Number.isNaN(I.numeric)?P===s.xB.Descending?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER:I.numeric,T=(0,n.Qi)(C);let L=m.fX.series,K=m.lJ.first;T.isByValue&&(L=m.fX.value,K=m.lJ.trailing),b.push({label:C.state?.displayName??C.name,value:(0,r.cN)(I),color:I.color??o.F,colorIndicator:L,colorPlacement:K,isActive:y===s.$N.Multi&&c===v,numeric:R,lineStyle:C.config.custom?.lineStyle})}if(P!==s.xB.None&&b.length>1){const v=E?f:u,C=P===s.xB.Descending?-1:1;b.sort((S,O)=>C*v(S,O))}return b}},71786:(ee,B,e)=>{"use strict";e.d(B,{FcD:()=>Sn.F,ibS:()=>Is,Ivu:()=>xa.Iv,DWK:()=>xa.DW,gZN:()=>xa.gZ,p0K:()=>At,Dd_:()=>so.D,euF:()=>_o.e,Exy:()=>Ri.E,xEy:()=>Vt.xE,eX$:()=>sa.eX,yVm:()=>it.yV,ypG:()=>it.yp,$p8:()=>it.$p,F8C:()=>it.F8,SV3:()=>it.SV,azJ:()=>Ba.a,jQM:()=>_i.J,$nd:()=>oe.$n,HRi:()=>fe,e2v:()=>pn.e,fHW:()=>Go.f,cbd:()=>Da.c,ZpM:()=>$o.Z,Q_j:()=>zo.Q,FNf:()=>X.F,vxQ:()=>q.v,KmA:()=>Qr.K,Sc0:()=>lr.S,NqN:()=>He.N,bLJ:()=>J.b,BYM:()=>Yt.B,q0m:()=>Zt.q,MU_:()=>Zn.M,SDm:()=>ea.S,skP:()=>De.sk,itl:()=>$e,G3_:()=>Ei.G,ZFl:()=>M.Z,uoB:()=>
104Dt.u,mcf:()=>Or.mc,tzH:()=>Qn.t,a2C:()=>ea.a,phK:()=>Ot.p,Pli:()=>_r.P,EZm:()=>Y.E,Rsn:()=>Vn.R,lZ_:()=>$r.l,ebG:()=>zr.e,eHD:()=>Ds.e,Jb3:()=>br.J,tco:()=>Gr.t,lrV:()=>xe.l,lS2:()=>ye.l,K7n:()=>Oe.K,etH:()=>H.e,cGx:()=>Vi.c,_s:()=>_s._,msM:()=>Wi.m,_V2:()=>ge._,Z7I:()=>Re.Z,ppr:()=>Ve.p,tHk:()=>Fs.tH,XwR:()=>Fs.Xw,DaU:()=>Wa.D,Kur:()=>Yo.K,aaz:()=>zi.a,sN5:()=>Xo.s,AVJ:()=>Yr.A,yKR:()=>as.y,ep7:()=>ka,D0$:()=>lt.D,ED_:()=>Rs,nA8:()=>_n,nVY:()=>Oo.n,PgM:()=>Io.P,gHy:()=>Vo.gH,wIj:()=>Vo.wI,IBq:()=>Bi.I,ef9:()=>wo,ZYI:()=>Ai.Z,mKT:()=>Wn.m,lVW:()=>Ut.l,i7I:()=>Ho.i,Vpd:()=>Xn,_I2:()=>It._,TS0:()=>Ar,Hdp:()=>qo,io8:()=>ei,ovZ:()=>Bs,MTY:()=>wn,IK5:()=>Lr,xA9:()=>ks.x,GyY:()=>Or.Gy,Int:()=>s.I,K0:()=>F.K,w4Q:()=>Gs.w,IP5:()=>or.I,CeB:()=>vi.C,IjS:()=>wi.I,c2B:()=>Ro.c,e8d:()=>mi.e,KYK:()=>rr.K,r0T:()=>de.r,pde:()=>$a.p,eyo:()=>on.e,jDF:()=>Be.j,BJ$:()=>Hr.B,OoN:()=>Ws.O,Z7z:()=>Jo.Z,JU7:()=>gi.J,rRI:()=>Le,OYG:()=>n.O,s$2:()=>Aa.s,N_E:()=>pa.N,z9$:()=>oe.z9,B8B:()=>we.B,GmG:()=>me.G,_ae:()=>le._,pH9:()=>Hi.p,W1t:()=>Ha.W,rXV:()=>ba.r,Drp:()=>Ps.D,aFV:()=>ft.a,rQ0:()=>Rt.r,EOs:()=>$t.EO,OHP:()=>jt,JXd:()=>Bt.J,wEe:()=>$t.wE,$sz:()=>$t.$s,YO7:()=>$t.YO,fpH:()=>no,KFt:()=>xa.KF,dAS:()=>an.d,dKS:()=>Xt.d,NRL:()=>zn.NR,oQQ:()=>Gn.I,_wj:()=>Rr._,XFg:()=>St.XF,e4W:()=>St.e4,$sV:()=>hs.$,Bjr:()=>Fi.B,AMh:()=>Z.A,IE3:()=>_.I,ZLI:()=>te.ZL,qB2:()=>te.qB,Xjo:()=>qt.X,JBW:()=>Ys.J,zWQ:()=>ao.z,a0s:()=>bl.a,F16:()=>dt.F,m3b:()=>nn.m,cCp:()=>ze.cC,NBP:()=>Ni.N,IUm:()=>rt.I,L47:()=>sa.L4,PaW:()=>y.P,L44:()=>ro.L4,lpq:()=>Li.lp,YAX:()=>Za.Y,Y4n:()=>Jr.Y,sYD:()=>Mr.s,oyW:()=>rs.o,Lrm:()=>Xr.L,a$h:()=>os.a,l6P:()=>xa.l6,KAb:()=>xa.KA,o5c:()=>Lo.o5,Dpi:()=>De.Dp,o0L:()=>Ke.o,tJM:()=>Ke.t,pMY:()=>sr.p,o95:()=>xn.o,gNl:()=>xn.g,KHN:()=>cn.K,Bd:()=>Zo.B,u3P:()=>Jt.u,nfS:()=>Cr.n,Apm:()=>Tr,$xS:()=>pi.$,OW$:()=>Pt.O,y$y:()=>kr.y,BJc:()=>us.B,SPA:()=>je.S,dOG:()=>rr.d,jDu:()=>ss.j,ozo:()=>yt.o,JSC:()=>Je.J,qtX:()=>Q.q,XIK:()=>gn.X,sRj:()=>mn.s,Btl:()=>mn.B,bwN:()=>Fn,U05:()=>aa.U,vwO:()=>Cn.v,LYX:()=>vn.L,um3:()=>Xe.u,EYj:()=>va.E,fs1:()=>On.f,YqK:()=>ia.Y,R3l:()=>Pe.R,xSz:()=>Ye.xS,bYj:()=>Ui.b,fD2:()=>ce.f,$64:()=>Ye.$6,AjF:()=>Ge.A,ZOC:()=>fo,U7r:()=>Se.U,XNj:()=>xi.X,Gff:()=>ne.G,IBt:()=>Tn.I,Uhs:()=>Kn.U,m_M:()=>D.m,TkQ:()=>mo,xlH:()=>dr.xl,piP:()=>ko.pi,ZCE:()=>lo.Z,eEE:()=>Qo.e,pKo:()=>Qe.p,nys:()=>oo.n,qeh:()=>Ki,iyp:()=>Mn.i,gWJ:()=>Or.gW,sMJ:()=>Wt,ipx:()=>xa.ip,KUk:()=>Ht.KU,tZ2:()=>un.t,MJh:()=>bn.M,SdN:()=>En.S,nRt:()=>ln,oNG:()=>en.o,l69:()=>Ee.l6,nuT:()=>Ms.n,_XZ:()=>Gi._,jnT:()=>po,Myc:()=>uo,myI:()=>oe.my,I1_:()=>Ca.I1,cbf:()=>ze.cb,gso:()=>Jn.g,Hut:()=>$o.H,lBN:()=>Js.l,na7:()=>$a.n,gF8:()=>te.gF,Jq4:()=>yi.J,rLY:()=>Ee.rL,ti9:()=>$i.t,YnM:()=>pr,JcZ:()=>La,rEW:()=>Ee.rE,mYT:()=>si,aLN:()=>d.A,Xb:()=>kt.Xb,_$q:()=>Ca._$,glJ:()=>Ca.gl,yff:()=>ge.y,IyU:()=>sl,d2s:()=>St.d2,hrX:()=>io.h,OOt:()=>tn.O,Xc0:()=>Fs.Xc});var t=e(94959),n=e(32581),r=e(74848),o=e(15777),s=e(30703);const m=he=>{const Ae=he.selectProps.menuIsOpen;return(0,r.jsx)(o.c.IndicatorsContainer,{...he,children:(0,r.jsx)(s.I,{name:Ae?"angle-up":"angle-down",style:{marginTop:"7px"}})})},a=m,l=he=>{const{children:Ae}=he;return(0,r.jsx)(o.c.NoOptionsMessage,{...he,children:(0,r.jsx)("div",{className:"gf-form-select-box__desc-option",children:(0,r.jsx)("div",{className:"gf-form-select-box__desc-option__body",children:Ae})})})},f=l;var h=e(46942),u=e.n(h),i=e(96540),x=e(46005),g=e(8539),p=e(66963),c=e(35555),y=e(92807),P=e(89534),d=e(57830),D=e(45967);const b=he=>{const{children:Ae,isSelected:Fe,data:qe}=he;return(0,r.jsx)(o.c.Option,{...he,children:(0,r.jsxs)("div",{className:"gf-form-select-box__desc-option",children:[qe.imgUrl&&(0,r.jsx)("img",{className:"gf-form-select-box__desc-option__img",src:qe.imgUrl,alt:""}),(0,r.jsxs)("div",{className:"gf-form-select-box__desc-option__body",children:[(0,r.jsx)("div",{children:Ae}),qe.description&&(0,r.jsx)("div",{className:"gf-form-select-box__desc-option__desc",children:qe.description})]}),Fe&&(0,r.jsx)(s.I,{name:"check","aria-hidden":"true"})]})})},E=null;var v=e(22803),C=e(65240),S=e(63142);const O=(0,C.N)(he=>({header:(0,v.css)({display:"flex",alignItems:"center",justifyContent:"flex-start",justifyItems:"center",cursor:"pointer",padding:"7px 10px",width:"100%",borderBottom:`1px solid ${he.colors.background.secondary}`,"&:hover":{color:he.colors.text.maxContrast}}),label:(0,v.css)({flexGrow:1}),icon:(0,v.css)({paddingRight:"2px"})}));class I extends i.PureComponent{constructor(){super(...arguments),this.state={expanded:!1},this.onToggleChildren=()=>{this.setState(Ae=>({expanded:!Ae.expanded}))}}componentDidMount(){if(this.props.data.expanded)this.setState({expanded:!0});else if(this.props.selectProps&&this.props.selectProps.value){const{value:Ae}=this.props.selectProps.value;Ae&&this.props.options.some(Fe=>Fe.value===Ae)&&this.setState({expanded:!0})}}componentDidUpdate(Ae){Ae.selectProps.inputValue!==""&&this.setState({expanded:!0})}render(){const{children:Ae,label:Fe,theme:qe}=this.props,{expanded:nt}=this.state,ot=O(qe);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:ot.header,onClick:this.onToggleChildren,role:"presentation",children:[(0,r.jsx)("span",{className:ot.label,children:Fe}),(0,r.jsx)(s.I,{className:ot.icon,name:nt?"angle-up":"angle-down"})]}),nt&&Ae]})}}const R=(0,S.cV)(I),T=he=>(0,r.jsx)(o.c.MenuList,{...he,children:(0,r.jsx)(y.P,{showScrollIndicators:!0,overflowX:"hidden",maxHeight:"inherit",children:he.children})});class L extends i.PureComponent{static{this.contextType=c.D}static{this.defaultProps={className:"",isDisabled:!1,isSearchable:!0,isClearable:!1,isMulti:!1,openMenuOnFocus:!1,autoFocus:!1,isLoading:!1,backspaceRemovesValue:!0,maxMenuHeight:300,tabSelectsValue:!0,allowCustomValue:!1,components:{Option:b,SingleValue:P.K,IndicatorsContainer:a,MenuList:T,Group:R}}}render(){const{defaultValue:Ae,getOptionLabel:Fe,getOptionValue:qe,onChange:nt,options:ot,placeholder:ut,width:Ct,value:Lt,className:Kt,isDisabled:zt,isLoading:dn,isSearchable:Gt,isClearable:rn,backspaceRemovesValue:Pn,isMulti:Un,autoFocus:jn,openMenuOnFocus:Bn,onBlur:Yn,maxMenuHeight:Pa,noOptionsMessage:Hn,isOpen:kn,components:Rn,tooltipContent:yn,tabSelectsValue:qn,onCloseMenu:An,onOpenMenu:ra,allowCustomValue:oa,formatCreateLabel:la,"aria-label":ca}=this.props;let ga="";Ct&&(ga="width-"+Ct);let Ia=x.Ay;const es={};oa&&(Ia=p.A,es.formatCreateLabel=la??(Ua=>Ua));const Fa=u()("gf-form-input","gf-form-input--form-dropdown",ga,Kt),Cs={...L.defaultProps.components,...Rn};return(0,r.jsx)(A,{onCloseMenu:An,onOpenMenu:ra,tooltipContent:yn,isOpen:kn,children:(Ua,Nr)=>(0,r.jsx)(Ia,{captureMenuScroll:!1,classNamePrefix:"gf-form-select-box",className:Fa,components:Cs,defaultValue:Ae,value:Lt,getOptionLabel:Fe,getOptionValue:qe,menuShouldScrollIntoView:!1,isSearchable:Gt,onCh
104ange:nt,options:ot,placeholder:ut||"Choose",styles:(0,d.A)(this.context),isDisabled:zt,isLoading:dn,isClearable:rn,autoFocus:jn,onBlur:Yn,openMenuOnFocus:Bn,maxMenuHeight:Pa,noOptionsMessage:Hn,isMulti:Un,backspaceRemovesValue:Pn,menuIsOpen:kn,onMenuOpen:Ua,onMenuClose:Nr,tabSelectsValue:qn,"aria-label":ca,...es})})}}class K extends i.PureComponent{static{this.contextType=c.D}static{this.defaultProps={className:"",components:{},loadingMessage:()=>"Loading...",isDisabled:!1,isClearable:!1,isMulti:!1,isSearchable:!0,backspaceRemovesValue:!0,autoFocus:!1,openMenuOnFocus:!1,maxMenuHeight:300}}render(){const{defaultValue:Ae,getOptionLabel:Fe,getOptionValue:qe,onChange:nt,placeholder:ot,width:ut,value:Ct,className:Lt,loadOptions:Kt,defaultOptions:zt,isLoading:dn,loadingMessage:Gt,noOptionsMessage:rn,isDisabled:Pn,isSearchable:Un,isClearable:jn,backspaceRemovesValue:Bn,autoFocus:Yn,onBlur:Pa,openMenuOnFocus:Hn,maxMenuHeight:kn,isMulti:Rn,tooltipContent:yn,onCloseMenu:qn,onOpenMenu:An,isOpen:ra}=this.props;let oa="";ut&&(oa="width-"+ut);const la=u()("gf-form-input","gf-form-input--form-dropdown",oa,Lt);return(0,r.jsx)(A,{onCloseMenu:qn,onOpenMenu:An,tooltipContent:yn,isOpen:ra,children:(ca,ga)=>(0,r.jsx)(g.A,{captureMenuScroll:!1,classNamePrefix:"gf-form-select-box",className:la,components:{Option:b,SingleValue:P.K,IndicatorsContainer:a,NoOptionsMessage:f},defaultValue:Ae,value:Ct,getOptionLabel:Fe,getOptionValue:qe,menuShouldScrollIntoView:!1,onChange:nt,loadOptions:Kt,isLoading:dn,defaultOptions:zt,placeholder:ot||"Choose",styles:(0,d.A)(this.context),loadingMessage:Gt,noOptionsMessage:rn,isDisabled:Pn,isSearchable:Un,isClearable:jn,autoFocus:Yn,onBlur:Pa,openMenuOnFocus:Hn,maxMenuHeight:kn,isMulti:Rn,backspaceRemovesValue:Bn})})}}class A extends i.PureComponent{constructor(){super(...arguments),this.state={isOpenInternal:!1},this.onOpenMenu=()=>{const{onOpenMenu:Ae}=this.props;Ae&&Ae(),this.setState({isOpenInternal:!0})},this.onCloseMenu=()=>{const{onCloseMenu:Ae}=this.props;Ae&&Ae(),this.setState({isOpenInternal:!1})}}render(){const{children:Ae,isOpen:Fe,tooltipContent:qe}=this.props,{isOpenInternal:nt}=this.state;let ot;return(nt||Fe)&&(ot=!1),qe?(0,r.jsx)(D.m,{show:ot,content:qe,placement:"bottom",children:(0,r.jsx)("div",{children:Ae(this.onOpenMenu,this.onCloseMenu)})}):(0,r.jsx)("div",{children:Ae(this.onOpenMenu,this.onCloseMenu)})}}const W=null;var N=e(2543);class w extends i.PureComponent{constructor(){super(...arguments),this.state={id:(0,N.uniqueId)()},this.internalOnChange=Ae=>{Ae.stopPropagation(),this.props.onChange(Ae)}}render(){const{labelClass:Ae="",switchClass:Fe="",label:qe,checked:nt,disabled:ot,transparent:ut,className:Ct,theme:Lt,tooltip:Kt,tooltipPlacement:zt}=this.props,dn=V(Lt),Gt=this.state.id,rn=`gf-form-label ${Ae} ${ut?"gf-form-label--transparent":""} pointer`,Pn=(0,v.cx)(dn.switch,Fe,{[dn.switchTransparent]:ut});return(0,r.jsx)("div",{className:dn.container,children:(0,r.jsxs)("label",{htmlFor:Gt,className:(0,v.cx)("gf-form",dn.labelContainer,Ct),children:[qe&&(0,r.jsxs)("div",{className:rn,children:[qe,Kt&&(0,r.jsx)(D.m,{placement:zt||"auto",content:Kt,theme:"info",children:(0,r.jsx)(s.I,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}})})]}),(0,r.jsxs)("div",{className:Pn,children:[(0,r.jsx)("input",{disabled:ot,id:Gt,type:"checkbox",checked:nt,onChange:this.internalOnChange}),(0,r.jsx)("span",{className:dn.slider})]})]})})}}const j=(0,S.cV)(w),V=he=>{const Ae=(0,v.css)({background:he.v1.palette.gray1,borderRadius:he.shape.radius.pill,height:"16px",width:"32px",display:"block",position:"relative","&::before":{position:"absolute",content:"''",height:"12px",width:"12px",left:"2px",top:"2px",background:he.components.input.background,transition:"0.4s",borderRadius:he.shape.radius.circle,boxShadow:he.shadows.z1}});return{container:(0,v.css)({display:"flex",flexShrink:0}),labelContainer:(0,v.css)({display:"flex",cursor:"pointer",marginRight:he.spacing(.5)}),switch:(0,v.css)({display:"flex",position:"relative",width:"56px",height:he.spacing(4),background:he.components.input.background,border:`1px solid ${he.components.input.borderColor}
104`,borderRadius:he.shape.radius.default,alignItems:"center",justifyContent:"center",input:{opacity:0,width:0,height:0},[`input:checked + .${Ae}`]:{background:he.colors.primary.main},[`input:checked + .${Ae}::before`]:{transform:"translateX(16px)"}}),switchTransparent:(0,v.css)({background:"transparent",border:0,width:"40px"}),slider:Ae}};var U=e(23659),F=e(76319),M=e(7075),H=e(44458),_=e(43533),Z=e(2381),ne=e(59243),te=e(15245),Y=e(52718),Q=e(86848),J=e(47931),q=e(64913),X=e(56873),se=e(3163),oe=e(45861),ae=e(78121),ie=e(21133);const fe=he=>{const{onChange:Ae,className:Fe,loadData:qe,icon:nt,buttonProps:ot,hideDownIcon:ut,variant:Ct,disabled:Lt,...Kt}=he,zt=(0,S.of)(pe),dn=(0,S.of)(ie.T);let Gt=he.children;return ut||(Gt=[he.children,(0,r.jsx)(s.I,{name:"angle-down",className:zt.icons.right},"down-icon")]),(0,r.jsx)(se.A,{onChange:(0,ae.k)(Ae),loadData:(0,ae.W)(qe),dropdownClassName:(0,v.cx)(dn.dropdown,zt.popup),...Kt,expandIcon:null,children:(0,r.jsx)(oe.$n,{icon:nt,disabled:Lt,variant:Ct,...ot??{},children:Gt})})};fe.displayName="ButtonCascader";const pe=he=>({popup:(0,v.css)({label:"popup",zIndex:he.zIndex.dropdown}),icons:{right:(0,v.css)({margin:"1px 0 0 4px"}),left:(0,v.css)({margin:"-1px 4px 0 0"})}});var de=e(53371),le=e(6975),me=e(47327),De=e(35427),Te=e(7612),Ne=e(65229),Ce=e(6773),He=e(8135),ke=e(12173),Me=e(32550);const $e=(0,i.forwardRef)(({value:he="",onChange:Ae,returnColorAs:Fe="rgb",...qe},nt)=>{const[ot,ut]=(0,i.useState)(he),[Ct,Lt]=(0,i.useState)(!1),Kt=(0,S.$j)(),zt=(0,S.of)(tt),dn=(0,S.of)(Me.$);(0,Ne.A)(rn=>{if(rn===he)return;if(!rn){Ae("");return}const Pn=Kt.visualization.getColorByName(rn);Ae(Fe==="rgb"?Ce.MV.asRgbString(Pn):Ce.MV.asHexString(Pn))},500,[ot]);const Gt=rn=>{document.querySelector('[data-testid="color-popover"]')?.contains(rn.relatedTarget)||Lt(!1)};return(0,r.jsx)(He.N,{onClick:()=>Lt(!1),children:(0,r.jsxs)("div",{className:zt.wrapper,children:[Ct&&!qe.disabled&&(0,r.jsx)(Te.p9,{"data-testid":"color-popover",color:ot,onChange:ut,className:(0,v.cx)(dn.root,zt.picker)}),(0,r.jsx)(ke.A,{...qe,theme:Kt,color:ot,onChange:ut,buttonAriaLabel:"Open color picker",onClick:()=>Lt(!0),onBlur:rn=>Gt(rn),ref:nt,isClearable:!0})]})})});$e.displayName="ColorPickerInput";const tt=he=>({wrapper:(0,v.css)({position:"relative"}),picker:(0,v.css)({"&.react-colorful":{position:"absolute",width:"100%",zIndex:11,bottom:"36px"}}),inner:(0,v.css)({position:"absolute"})});var Ke=e(57339),Re=e(74451),Ve=e(50201),Qe=e(12965),je=e(34107),ze=e(90811),Ye=e(91867),Ge=e(72296),ce=e(83692),Pe=e(11527),Se=e(59310),Ee=e(5857),xe=e(96396),ye=e(43482),Oe=e(27282),we=e(5585),Be=e(27594),Xe=e(10928),st=e(7685),lt=e(37386);const Et=(0,i.memo)(()=>{const he=(0,S.of)(Tt);return(0,r.jsxs)("div",{className:he.ellipsis,children:[(0,r.jsx)("span",{className:he.firstDot,children:"."}),(0,r.jsx)("span",{className:he.secondDot,children:"."}),(0,r.jsx)("span",{className:he.thirdDot,children:"."})]})});Et.displayName="EllipsisAnimated";const Tt=he=>({ellipsis:(0,v.css)({display:"inline"}),firstDot:(0,v.css)({[he.transitions.handleMotion("no-preference","reduce")]:{animation:`${Mt} 2s linear infinite`}}),secondDot:(0,v.css)({[he.transitions.handleMotion("no-preference","reduce")]:{animation:`${wt} 2s linear infinite`}}),thirdDot:(0,v.css)({[he.transitions.handleMotion("no-preference","reduce")]:{animation:`${_e} 2s linear infinite`}})}),Mt=(0,v.keyframes)` 105 0% { 106 opacity: 1; 107 } 108 65% { 109 opacity: 1; 110 } 111 66% { 112 opacity: 0.5; 113 } 114 100% { 115 opacity: 0; 116 } 117 `,wt=(0,v.keyframes)` 118 0% { 119 opacity: 0; 120 } 121 21% { 122 opacity: 0.5; 123 } 124 22% { 125 opacity: 1; 126 } 127 65% { 128 opacity: 1; 129 } 130 66% { 131 opacity: 0.5; 132 } 133 100% { 134 opacity: 0; 135 } 136 `,_e=(0,v.keyframes)` 137 0% { 138 opacity: 0; 139 } 140 43% { 141 opacity: 0.5; 142 } 143 44% { 144 opacity: 1; 145 } 146 65% { 147 opacity: 1; 148 } 149 66% { 150 opacity: 0.5; 151 } 152 100% { 153 opacity: 0; 154 } 155 `,xt=2*1e3;function At(he){const{invalid:Ae,loading:Fe,onFinishChange:qe,saveErrorMessage:nt="Error saving this value",error:ot,children:ut,disabled:Ct,...Lt}=he,[Kt,zt]=i.useState({isLoading:!1,showSuccess:!1,showError:Ae}),dn=(0,i.useRef)(null);i.useEffect(()=>{let jn;if(Kt.showSuccess){const Bn=Kt.showError?0:xt;jn=setTimeout(()=>{zt({...Kt,showSuccess:!1})},Bn)}return()=>{window.clearTimeout(jn)}},[Kt]);const Gt=(0,i.useCallback)(jn=>{Ae||(zt({...Kt,isLoading:!0,showSuccess:!1}),qe(jn).then(()=>{zt({isLoading:!1,showSuccess:!0,showError:!1})}).catch(()=>{zt({...Kt,isLoading:!1,showError:!0})}
155))},[Ae,Kt,qe]),rn=(0,i.useMemo)(()=>(0,N.debounce)(Gt,600,{leading:!1}),[Gt]),Pn=Ae||Kt.showError||void 0,Un=(0,S.of)(bt);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lt.D,{...Lt,loading:Fe||void 0,invalid:Pn,disabled:Ct,error:ot||Kt.showError&&nt,ref:dn,className:Un.widthFitContent,children:i.cloneElement(ut(jn=>{rn(jn)}))}),Kt.isLoading&&(0,r.jsx)(de.r,{referenceElement:dn.current,placement:"right",children:(0,r.jsxs)(st.x,{i18nKey:"grafana-ui.auto-save-field.saving",children:["Saving ",(0,r.jsx)(Et,{})]})}),Kt.showSuccess&&(0,r.jsx)(de.r,{suffixIcon:"check",referenceElement:dn.current,placement:"right",children:(0,r.jsx)(st.x,{i18nKey:"grafana-ui.auto-save-field.saved",children:"Saved!"})})]})}At.displayName="AutoSaveField";const bt=()=>({widthFitContent:(0,v.css)({width:"fit-content"})});var Xt=e(34213),Cn=e(94018),vn=e(37658),Wn=e(34343),Dt=e(71599),qt=e(92505),Yt=e(50992),nn=e(65232),Zt=e(78193),tn=e(13477),ft=e(22787),Rt=e(53428),Bt=e(52792);const jt=({children:he})=>{const Ae=(0,S.of)(Nt);return(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:Ae.header,children:(0,r.jsx)("div",{className:Ae.content,children:he})})})},Nt=he=>({header:(0,v.css)({display:"flex",margin:he.spacing(0,0,3,0)}),content:(0,v.css)({flexGrow:1})});var $t=e(8515),an=e(84600),Jt=e(82143),gn=e(24343),mn=e(64780),_t=e(68125),On=e(87105);class Nn extends i.PureComponent{constructor(Ae){super(Ae),this.readCSV=(0,N.debounce)(()=>{const{config:nt}=this.props,{text:ot}=this.state;this.setState({data:(0,_t.Jh)(ot,{config:nt})})},150),this.onTextChange=nt=>{this.setState({text:nt.target.value})};const{text:Fe,config:qe}=Ae;this.state={text:Fe,data:(0,_t.Jh)(Fe,{config:qe})}}componentDidUpdate(Ae,Fe){const{text:qe}=this.state;(qe!==Fe.text||this.props.config!==Ae.config)&&this.readCSV(),this.props.text!==Ae.text&&this.props.text!==qe&&this.setState({text:this.props.text}),this.state.data!==Fe.data&&this.props.onSeriesParsed(this.state.data,this.state.text)}render(){const{width:Ae,height:Fe,theme:qe}=this.props,{data:nt}=this.state,ot=na(qe);return(0,r.jsxs)("div",{className:ot.tableInputCsv,children:[(0,r.jsx)(On.f,{style:{width:Ae,height:Fe},placeholder:(0,st.t)("grafana-ui.table.csv-placeholder","Enter CSV here..."),value:this.state.text,onChange:this.onTextChange,className:ot.textarea}),nt&&(0,r.jsx)("footer",{className:ot.footer,children:nt.map((ut,Ct)=>{const Lt=ut.length,Kt=ut.fields.length;return(0,r.jsx)("span",{children:(0,r.jsxs)(st.x,{i18nKey:"grafana-ui.table.csv-counts",children:["Rows:",{rows:Lt},", Columns:",{columns:Kt}," \xA0",(0,r.jsx)(s.I,{name:"check-circle"})]})},Ct)})})]})}}const Fn=(0,S.cV)(Nn);Fn.displayName="TableInputCSV";const na=(0,C.N)(he=>({tableInputCsv:(0,v.css)({position:"relative"}),textarea:(0,v.css)({height:"100%",width:"100%"}),footer:(0,v.css)({position:"absolute",bottom:"15px",right:"15px",border:"1px solid #222",background:he.colors.success.main,padding:`1px ${he.spacing(.5)}`,fontSize:"80%"})}));var aa=e(54314),yt=e(60208),mt=e(85629),Ot=e(72489);const Wt=(0,i.forwardRef)(({label:he,active:Ae,icon:Fe,counter:qe,className:nt,suffix:ot,onChangeTab:ut,href:Ct,...Lt},Kt)=>{const zt=(0,S.of)(et),dn=()=>(0,r.jsxs)(r.Fragment,{children:[Fe&&(0,r.jsx)(s.I,{name:Fe}),he,typeof qe=="number"&&(0,r.jsx)(Ot.p,{value:qe}),ot&&(0,r.jsx)(ot,{className:zt.suffix})]}),Gt=(0,v.cx)(zt.link,Ae&&zt.activeStyle);return(0,r.jsx)("a",{href:Ct,className:Gt,...Lt,onClick:ut,"aria-label":Lt["aria-label"]||mt.Tp.components.Tab.title(he),role:"tab","aria-selected":Ae,ref:Kt,children:dn()})});Wt.displayName="Tab";const et=he=>({link:(0,v.css)({padding:"6px 12px",display:"block",height:"100%",cursor:"pointer",position:"relative",color:he.colors.text.primary,svg:{marginRight:he.spacing(1)},"&:hover, &:focus":{textDecoration:"underline"}}),activeStyle:(0,v.css)({label:"activeTabStyle",color:he.colors.text.maxContrast,overflow:"hidden","&::before":{display:"block",content:'" "',position:"absolute",left:0,width:"4px",bottom:"2px",top:"2px",borderRadius:he.shape.radius.default,backgroundImage:"linear-gradient(0deg, #f05a28 30%, #fbca0a 99%)"}}),suffix:(0,v.css)({marginLeft:he.spacing(1)})});
155var Je=e(13941),rt=e(70663),it=e(97611),Pt=e(53431),It=e(18627),Vt=e(98005),en=e(71076);const ln=({content:he,position:Ae,offset:Fe})=>{const qe=(0,S.of)(Qt);return Ae?(0,r.jsx)(te.ZL,{className:qe.portal,children:(0,r.jsx)(en.o,{position:Ae,offset:Fe||{x:0,y:0},children:he})}):null};ln.displayName="VizTooltip";const Qt=()=>({portal:(0,v.css)({position:"absolute",top:0,left:0,pointerEvents:"none",width:"100%",height:"100%"})});var xn=e(63428),En=e(33352),zn=e(67522),Gn=e(17503),St=e(64400),Ht=e(54735),cn=e(22940),un=e(78055),bn=e(89123),Sn=e(34999);class wn extends i.Component{constructor(Ae){super(Ae),this.onSeriesToggle=this.onSeriesToggle.bind(this),this.state={hiddenSeries:[],toggledSeries:Ae.series}}componentDidUpdate(Ae){const{series:Fe}=this.props;(0,N.isEqual)(Ae.series,Fe)||this.setState({hiddenSeries:[],toggledSeries:Fe})}onSeriesToggle(Ae,Fe){const{series:qe,onHiddenSeriesChanged:nt}=this.props,{hiddenSeries:ot}=this.state;if(Fe.ctrlKey||Fe.metaKey||Fe.shiftKey){const Kt=ot.indexOf(Ae)>-1?ot.filter(dn=>dn!==Ae):ot.concat([Ae]),zt=qe.map(dn=>({...dn,isVisible:Kt.indexOf(dn.label)===-1}));this.setState({hiddenSeries:Kt,toggledSeries:zt},()=>nt?nt(Kt):void 0);return}const ut=qe.map(Kt=>Kt.label),Ct=ot.length+1===ut.length?[]:(0,N.difference)(ut,[Ae]),Lt=qe.map(Kt=>({...Kt,isVisible:Ct.indexOf(Kt.label)===-1}));this.setState({hiddenSeries:Ct,toggledSeries:Lt},()=>nt?nt(Ct):void 0)}render(){const{children:Ae}=this.props,{toggledSeries:Fe}=this.state;return Ae({onSeriesToggle:this.onSeriesToggle,toggledSeries:Fe})}}var ea=e(89599),Zn=e(74475),Vn=e(28134);function _n({links:he}){const Ae=(0,S.of)(Ln);if(he.length===1)return(0,r.jsx)(Vn.R,{link:he[0]});const Fe=he.filter(nt=>nt.target==="_blank"),qe=he.filter(nt=>nt.target==="_self");return(0,r.jsxs)(r.Fragment,{children:[qe.map((nt,ot)=>(0,r.jsx)(Vn.R,{link:nt},ot)),(0,r.jsxs)("div",{className:Ae.wrapper,children:[(0,r.jsx)("p",{className:Ae.externalLinksHeading,children:(0,r.jsx)(st.x,{i18nKey:"grafana-ui.field-link-list.external-links-heading",children:"External links"})}),Fe.map((nt,ot)=>(0,r.jsxs)("a",{href:nt.href,target:nt.target,className:Ae.externalLink,children:[(0,r.jsx)(s.I,{name:"external-link-alt"}),nt.title]},ot))]})]})}const Ln=he=>({wrapper:(0,v.css)({flexBasis:"150px",width:"100px",marginTop:he.spacing(1)}),externalLinksHeading:(0,v.css)({color:he.colors.text.secondary,fontWeight:he.typography.fontWeightRegular,fontSize:he.typography.size.sm,margin:0}),externalLink:(0,v.css)({color:he.colors.text.link,fontWeight:he.typography.fontWeightRegular,display:"block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis","&:hover":{textDecoration:"underline"},div:{marginRight:he.spacing(1)}})}),Xn=({className:he,children:Ae})=>{const Fe=(0,S.of)(ma);return(0,r.jsx)("div",{className:(0,v.cx)(Fe,he),children:Ae})},ma=()=>(0,v.css)({display:"flex",button:{flexGrow:1,justifyContent:"center"},"> *":{flexGrow:1},label:{flexGrow:1,textAlign:"center"}});var Ca=e(59795),Da=e(43951),Qn=e(97375),Ha=e(87063),ba=e(30930),Ps=e(94535),Ms=e(41479),Ds=e(96822),br=e(73628),$r=e(81917),zr=e(6399),sr=e(71479),Gs=e(79331),as=e(991);const ka=(0,i.memo)((0,i.forwardRef)(({title:he,featureState:Ae,...Fe},qe)=>{const nt=(0,S.of)(Ya),ot=Ae?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:nt.badge,children:(0,r.jsx)(as.y,{featureState:Ae})}),(0,r.jsx)("h3",{children:he})]}):(0,r.jsx)("h3",{children:he});return(0,r.jsx)(Gs.w,{branded:!0,title:ot,urlTitle:"Read documentation",ref:qe,...Fe})}));ka.displayName="FeatureInfoBox";const Ya=he=>({badge:(0,v.css)({marginBottom:he.spacing(1)})});var Hr=e(50275),Ws=e(22658),Fs=e(36303),Wa=e(56297),Gr=e(96004),_r=e(55803),rr=e(21285),or=e(18027);function Is({options:he,onOptionsChange:Ae}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h3",{className:"page-heading",children:(0,r.jsx)(st.x,{i18nKey:"grafana-ui.data-source-settings.alerting-settings-heading",children:"Alerting"})}),(0,r.jsx)("div",{className:"gf-form-group",children:(0,r.jsx)("div",{className:"gf-form-inline",children:(0,r.jsx)("div",{className:"gf-form",children:(0,r.jsx)(or.I,{labelWidth:29,label:(0,st.t)("grafana-ui.data-source-settings.alerting-settings-label","Manage alert rules in Alerting UI"),disabled:he.readOnly,tooltip:(0,st.t)("grafana-ui.data-source-settings.alerting-settings-tooltip","Manage alert rules for this data source. To manage other alerting resources, add an Alertmanager data source."),children:(0,r.jsx)(rr.K,{value:he.jsonData.manageAlerts!==!1,onChange:Fe=>Ae({...he,jsonData:{...he.jsonData,manageAlerts:Fe.currentTarget.checked}})})})})})})]})}var Za=e(3936),ss=e(37235),Qr=e(45558),kr=e(68079),Yr=e(19052),Cr=e(4819),Jr=e(61875),Mr=e(76671),rs=e(3263),os=e(89467),Xr=e(52042),_s=e(8207),Ks=e(17437),Qs=e(55168),$a=e(63527),Sr=e(91302);const Tr=({min:he,max:Ae,onChange:Fe,onAfterChange:qe,orientation:nt="horizontal",reverse:ot,step:ut,value:Ct,ariaLabelForHandle:Lt,marks:Kt,included:zt})=>{const dn=nt==="horizontal",Gt=(0,S.of)(Sr.$,dn,!!Kt),rn=Qs.A,[Pn,Un]=(0,i.useState)(Ct??he),jn=(0,i.useCallback)(Rn=>{const yn=typeof Rn=="number"?Rn:Rn[0];Un(yn),Fe?.(yn)},[Un,Fe]),Bn=(0,i.useCallback)(Rn=>{let yn=+Rn.target.value;Number.isNaN(yn)&&(yn=0),Un(yn),Fe&&Fe(yn),qe&&qe(yn)},[Fe,qe]),Yn=(0,i.useCallback)(Rn=>{const yn=+Rn.target.value;yn>Ae?Un(Ae):yn<he&&Un(he)},[Ae,he]),Pa=(0,i.useCallback)(Rn=>{const yn=typeof Rn=="number"?Rn:Rn[0];qe?.(yn)},[qe]),Hn=dn?[]:[Gt.sliderInputVertical],kn=dn?[]:[Gt.sliderInputFieldVertical];return(0,r.jsxs)("div",{className:(0,v.cx)(Gt.container,Gt.slider),children:[(0,r.jsx)(Ks.Global,{styles:Gt.tooltip}),(0,r.jsxs)("div",{className:(0,v.cx)(Gt.sliderInput,...Hn),children:[(0,r.jsx)(rn,{min:he,max:Ae,step:ut,defaultValue:Ct,value:Pn,onChange:jn,onChangeComplete:Pa,vertical:!dn,reverse:ot,ariaLabelForHandle:Lt,marks:Kt,included:zt}),(0,r.jsx)($a.p,{type:"text",width:7.5,className:(0,v.cx)(Gt.sliderInputField,...kn),value:Pn,onChange:Bn,onBlur:Yn,min:he,max:Ae})]})]})};Tr.displayName="Slider";var dt=e(21103),Ut=e(50426),kt=e(3343),on=e(26987),pn=e(93256),Tn=e(7895),Kn=e(36219),Mn=e(59695),Jn=e(63152),pa=e(20941),ia=e(89640),va=e(66404),Ba=e(31286),us=e(41654),ks=e(13943),pi=e(35137),gi=e(72636),Aa=e(53487),Oo=e(16780),Io=e(12594),mi=e(83871),Ro=e(79233),vi=e(97095),Ao=e(49785);const Rs=({name:he,control:Ae,children:Fe,...qe})=>
155{const{fields:nt,append:ot,prepend:ut,remove:Ct,swap:Lt,move:Kt,insert:zt}=(0,Ao.jz)({control:Ae,name:he,...qe});return Fe({fields:nt,append:ot,prepend:ut,remove:Ct,swap:Lt,move:Kt,insert:zt})};var xa=e(18857),Lo=e(72508),yi=e(69665),xi=e(29362),Ei=e(43243),Ga=e(76698),Pi=e(70733);const Di=({isLoading:he,isOpen:Ae})=>{const Fe=he?"spinner":Ae?"search":"angle-down";return(0,r.jsx)(s.I,{name:Fe})},bi=(0,i.forwardRef)(({children:he,onRemove:Ae,disabled:Fe,...qe},nt)=>{const ot=(0,S.of)(Ci,Fe),ut=(0,st.t)("grafana-ui.value-pill.remove-button","Remove {{children}}",{children:he});return(0,r.jsxs)("span",{className:ot.wrapper,...qe,ref:nt,children:[(0,r.jsx)("span",{className:ot.text,children:he}),!Fe&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:ot.separator}),(0,r.jsx)(F.K,{name:"times",size:"md","aria-label":ut,onClick:Ct=>{Ct.stopPropagation(),Ae()}})]})]})}),Ci=(he,Ae)=>({wrapper:(0,v.css)({display:"inline-flex",borderRadius:he.shape.radius.default,color:he.colors.text.primary,background:he.colors.background.secondary,padding:he.spacing(.25),border:Ae?`1px solid ${he.colors.border.weak}`:"none",fontSize:he.typography.bodySmall.fontSize,flexShrink:0,minWidth:"50px",alignItems:"center","&:first-child:has(+ div)":{flexShrink:1}}),text:(0,v.css)({whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:he.spacing(0,1,0,.75)}),separator:(0,v.css)({background:he.colors.border.weak,width:"2px",height:"100%",marginRight:he.spacing(.5)})});var Zr=e(74440),jo=e(98869),Bo=e(35484);const Mi=(he,Ae,Fe,qe,nt,ot,ut,Ct)=>{const Lt=(0,$a.n)({theme:he,invalid:Fe}),Kt=(0,Bo.getFocusStyles)(he),zt=nt&&nt!=="auto"?he.spacing(nt):"100%",dn=ot?he.spacing(ot):"",Gt=ut?he.spacing(ut):"";return{container:(0,v.css)({width:nt==="auto"?"auto":zt,minWidth:dn,maxWidth:Gt,display:nt==="auto"?"inline-block":"block"}),wrapper:(0,v.cx)(Lt.input,(0,v.css)({display:"flex",width:"100%",gap:he.spacing(.5),padding:he.spacing(.5),paddingRight:Ct?he.spacing(5):28,"&:focus-within":{...Kt}})),input:(0,v.css)({border:"none",outline:"none",background:"transparent",flexGrow:1,maxWidth:"100%",minWidth:40,"&::placeholder":{color:he.colors.text.disabled},"&:focus":{outline:"none",cursor:"text"},cursor:"pointer"}),pillWrapper:(0,v.css)({display:"inline-flex",flexWrap:Ae?"wrap":"nowrap",flexGrow:1,minWidth:"50px",gap:he.spacing(.5)}),restNumber:(0,v.css)({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:he.spacing(0,1),border:qe?`1px solid ${he.colors.border.weak}`:"none",borderRadius:he.shape.radius.default,backgroundColor:he.colors.background.secondary,cursor:"pointer","&:hover":{backgroundColor:he.colors.action.hover}}),suffix:Lt.suffix,disabled:Lt.inputDisabled}};var qr=e(33605),ir=e(75168),za=e(49185),Uo=e(53568);const eo=12,Si=50,No=10,Wo=15;function Fo(he,Ae,Fe){const[qe,nt]=(0,i.useState)(he.length),[ot,{width:ut}]=(0,za.A)(),[Ct,{width:Lt}]=(0,za.A)(),[Kt,{width:zt}]=(0,za.A)(),dn=Ae&&Ae!=="auto"?Ae:ut;return(0,i.useEffect)(()=>{const Gt=dn-Lt-zt;let rn=0;for(let Pn=0;Pn<he.length;Pn++){if(rn+=(0,Uo.kD)(he[Pn].label||"",eo).width+(Fe?No:Si),rn>Gt){nt(Math.min(Pn,Wo)||1);break}Pn===he.length-1&&nt(he.length)}},[dn,Lt,zt,he,nt,Fe]),{measureRef:ot,counterMeasureRef:Ct,suffixMeasureRef:Kt,shownItems:qe}}function Ti(he){const Ae=(0,i.useRef)(null),Fe=(0,i.useRef)(0),[qe,nt]=(0,i.useState)("");return(0,i.useLayoutEffect)(()=>{if(Ae.current&&he==null&&Fe.current===0&&(Fe.current=Ae?.current.getBoundingClientRect().width),!Ae.current||he==null){nt("");return}const ot=window.getComputedStyle(Ae.current).fontSize,ut=(0,Uo.kD)(Ae.current.value||"",parseInt(ot,10)).width;ut<Fe.current?nt(""):nt(`${ut+5}px`)},[he]),{inputRef:Ae,inputWidth:qe}}var to=e(5320);const no=he=>{const{placeholder:Ae,onChange:Fe,value:qe,width:nt,enableAllOption:ot,invalid:ut,disabled:Ct,minWidth:Lt,maxWidth:Kt,isClearable:zt,createCustomValue:dn=!1}=he,Gt=(0,S.of)(jo.C3),[rn,Pn]=(0,i.useState)(""),Un=(0,i.useMemo)(()=>({label:rn===""?(0,st.t)("multicombobox.all.title","All"):(0,st.t)("multicombobox.all.title-filtered","All (filtered)"),value:qr.A}),[rn]),{options:jn,updateOptions:Bn,asyncLoading:Yn,asyncError:Pa}=(0,to.I)(he.options,dn),Hn=(0,i.useMemo)(()=>ot&&jn.length>1?[Un,...jn]:jn,[jn,ot,Un]),kn=he.loading||Yn,Rn=(0,i.useMemo)(()=>qe?Oi(qe,typeof he.options!="function"?he.options:jn):[],[qe,he.options,jn]),{measureRef:yn,counterMeasureRef:qn,suffixMeasureRef:An,shownItems:ra}=Fo(Rn,nt,Ct),oa=(0,i.useCallback)(da=>Rn.some(Ta=>Ta.value===da.value),[Rn]),{getSelectedItemProps:la,getDropdownProps:ca,setSelectedItems:ga,addSelectedItem:Ia,removeSelectedItem:es,reset:Fa}=(0,Ga.mH)({selectedItems:Rn,onStateChange:({type:da,selectedItems:Ta})=>{switch(da){case Ga.mH.stateChangeTypes.SelectedItemKeyDownBackspace:case Ga.mH.stateChangeTypes.SelectedItemKeyDownDelete:case Ga.mH.stateChangeTypes.DropdownKeyDownBackspace:case Ga.mH.stateChangeTypes.FunctionRemoveSelectedItem:case Ga.mH.stateChangeTypes.FunctionAddSelectedItem:case Ga.mH.stateChangeTypes.FunctionSetSelectedItems:case Ga.mH.stateChangeTypes.FunctionReset:Fe(Ta??[]);break;default:break}},stateReducer:(da,Ta)=>{const{changes:ys}=Ta;return{...ys,activeIndex:-999}}}),{getToggleButtonProps:Cs,isOpen:Ua,highlightedIndex:Nr,getMenuProps:Ra,getInputProps:ms,getItemProps:ls}=(0,Ga.Bp)({items:Hn,itemToString:Zr.yl,inputValue:rn,selectedItem:null,stateReducer:(da,Ta)=>{const{type:ys}=Ta;let{changes:xs}=Ta;switch(da.isOpen===!1&&xs.isOpen===!0&&xs.inputValue===da.inputValue&&(xs={...xs,inputValue:""}),ys){case Ga.Bp.stateChangeTypes.InputKeyDownEnter:case Ga.Bp.stateChangeTypes.ItemClick:return{...xs,isOpen:!0,highlightedIndex:da.highlightedIndex};case Ga.Bp.stateChangeTypes.InputBlur:Pn("");default:return xs}},onIsOpenChange:({isOpen:da,inputValue:Ta})=>{da&&Ta===""&&Bn(Ta)},onStateChange:({inputValue:da,type:Ta,selectedItem:ys})=>{switch(Ta){case Ga.Bp.stateChangeTypes.InputKeyDownEnter:case Ga.Bp.stateChangeTypes.ItemClick:if(ys?.value===qr.A){const xs=Rn.length===Hn.length-1,Ts=Hn.slice(1);let cs=xs&&rn===""?[]:Ts;if(!xs&&rn!==""&&(cs=[...new Set([...Rn,...Ts])]),xs&&rn!==""){const vo=new Set(Ts.map(Os=>Os.value));cs=Rn.filter(Os=>!vo.has(Os.value))}ga(cs)}else ys&&oa(ys)?es(ys):ys&&Ia(ys);break;case Ga.Bp.stateChangeTypes.InputChange:Pn(da??""),Bn(da??"");break;default:break}}}),{inputRef:Na,floatingRef:ts,floatStyles:Ja,scrollRef:vs}=(0,ir.l)(Hn,Ua),Ka=(0,S.of)(Mi,Ua,ut,Ct,nt,Lt,Kt,zt),zs=Ua?Rn.slice(0,Wo):Rn.slice(0,ra),{inputRef:tr,inputWidth:Wr}=Ti(rn);return(0,r.jsxs)("div",{className:Ka.container,ref:Na,children:[(0,r.jsx)("div",{className:(0,v.cx)(Ka.wrapper,{[Ka.disabled]:Ct}),ref:yn,children:(0,r.jsxs)("span",{className:Ka.pillWrapper,children:[zs.map((da,Ta)=>(0,r.jsx)(bi,{disabled:Ct,onRemove:()=>{es(da)},...la({selectedItem:da,index:Ta}),children:(0,Zr.yl)(da)},`${da.value}${Ta}`)),Rn.length>zs.length&&(0,r.jsxs)(Ba.a,{display:"flex",direction:"row",marginLeft:.5,gap:1,ref:qn,children:[(0,r.jsx)(va.E,{children:"..."}),(0,r.jsx)(D.m,{interactive:!0,content:(0,r.jsx)(r.Fragment,{children:Rn.slice(zs.length).map(da=>(0,r.jsx)("div",{children:(0,Zr.yl)(da)},da.value))}),children:(0,r.jsx)("div",{className:Ka.restNumber,children:Rn.length-ra})})]}),(0,r.jsx)("input",{className:Ka.input,...ms(ca({disabled:Ct,preventKeyAction:Ua,placeholder:zs.length===0?Ae:"",ref:tr,style:{width:Wr}}))}),(0,r.jsxs)("div",{className:Ka.suffix,ref:An,...Cs(),children:[zt&&Rn.length>0&&(0,r.jsx)(s.I,{name:"times",className:Gt.clear,title:(0,st.t)("multicombobox.clear.title","Clear all"),tabIndex:0,role:"button",onClick:da=>{da.stopPropagation(),Fa()},onKeyDown:da=>{(da.key==="Enter"||da.key===" ")&&Fa()}}),(0,r.jsx)(Di,{isLoading:kn||!1,isOpen:Ua})]})]})}),(0,r.jsx)(te.ZL,{children:(0,r.jsx)("div",{className:(0,v.cx)(Gt.menu,!Ua&&Gt.menuClosed),style:{...Ja,width:Ja.width+24},...Ra({ref:ts}),children:Ua&&(0,r.jsx)(Pi.e,{options:Hn,highlightedIndex:Nr,selectedItems:Rn,scrollRef:vs,getItemProps:ls,enableAllOption:ot,isMultiSelect:!0,error:Pa})})})]})};function Oi(he,Ae){if(Ii(he))return he;const Fe=new Map(he.map((nt,ot)=>[nt,ot])),qe=[];for(const nt of Ae){const ot=Fe.get(nt.value);if(ot!==void 0&&(qe[ot]=nt,Fe.delete(nt.value)),Fe.size===0)break}for(const[nt,ot]of Fe)qe[ot]={value:nt};return qe}function Ii(he){return typeof he[0]=="object"}var Or=e(32881),Ri=e(99887),ao=e(77824),Ys=e(45450),bl=e(16203),so=e(33033),Ai=e(12737),ro=e(48767),Li=e(40601),lr=e(32635),cr=e(24726),Ko=e(28473);const wo=({onFileUpload:he,className:Ae,children:Fe="Upload file",accept:qe="*",size:nt="md",showFileName:ot})=>{const ut=(0,S.of)(ji(nt)),[Ct,Lt]=(0,i.useState)(""),Kt=(0,cr.A)(),zt=(0,i.useCallback)(dn=>{const Gt=dn.currentTarget?.files?.[0];Gt&&Lt(Gt.name??""),he(dn)},[he]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{type:"file",id:Kt,className:ut.fileUpload,onChange:zt,multiple:!1,accept:qe,"data-testid":mt.Tp.components.FileUpload.inputField}),(0,r.jsxs)("label",{htmlFor:Kt,className:(0,v.cx)(ut.labelWrapper,Ae),children:[(0,r.jsx)(s.I,{name:"upload",className:ut.icon}),Fe]}),ot&&Ct&&(0,r.jsx)("span",{"aria-label":(0,st.t)("grafana-ui.file-upload.file-name","File name"),className:ut.fileName,"data-testid":mt.Tp.components.FileUpload.fileNameSpan,children:(0,Ko.i)(Ct)})]})},ji=he=>Ae=>{const Fe=(0,oe.hs)({theme:Ae,variant:"primary",size:he,iconOnly:!1}),qe=(0,Bo.getFocusStyles)(Ae);
155return{fileUpload:(0,v.css)({height:"0.1px",opacity:"0",overflow:"hidden",position:"absolute",width:"0.1px",zIndex:-1,"&:focus + label":qe,"&:focus-visible + label":qe}),labelWrapper:Fe.button,icon:Fe.icon,fileName:(0,v.css)({marginLeft:Ae.spacing(.5)})}};var Vo=e(40279),Bi=e(48431),Ui=e(56265),Ni=e(90929),$o=e(8073),zo=e(43856),Ho=e(21539),Go=e(15356),Wi=e(88559),Fi=e(63509),oo=e(35942);const Ki=({users:he,onClick:Ae,limit:Fe=4})=>{const qe=(0,S.of)(Ir);if(!he.length)return null;Fe=Fe>0?Fe:4;const nt=he.length>Fe,ot=he.length-Fe,ut=ot>99;return(0,r.jsxs)("div",{className:qe.container,"aria-label":(0,st.t)("grafana-ui.users-indicator.container-label","Users indicator container"),children:[nt&&(0,r.jsx)(oo.n,{onClick:Ae,userView:{user:{name:"Extra users"},lastActiveAt:""},showTooltip:!1,children:ut?"...":`+${ot}`}),he.slice(0,nt?Fe:Fe+1).reverse().map(Ct=>(0,r.jsx)(oo.n,{userView:Ct},Ct.user.name))]})},Ir=he=>({container:(0,v.css)({display:"flex",justifyContent:"center",flexDirection:"row-reverse",marginLeft:he.spacing(1),"& > button":{marginLeft:he.spacing(-1)}}),dots:(0,v.css)({marginBottom:"3px"})});var _o=e(71555),wi=e(51115),Vi=e(3271),Js=e(45897),io=e(93008),$i=e(99555),sa=e(739),Qo=e(47276),ko=e(23414),lo=e(92790),hs=e(61897),zi=e(7515),Hi=e(73858),Gi=e(16477),dr=e(69234),Yo=e(18667),Jo=e(93630),Xo=e(62748),Zo=e(49256),_i=e(88977),Rr=e(3023),ur=e(34796),hr=e.n(ur),fs=e(26332),ws=e(80011);const qo=({getContextMenuSource:he,timeZone:Ae,itemsGroup:Fe,dimensions:qe,contextDimensions:nt,...ot})=>{const ut=he(),Ct=Fe?Fe.map(zt=>({...zt,items:zt.items?.filter(dn=>dn.label)})):[],Lt=()=>{if(!ut)return null;let zt;if(qe?.yAxis&&nt?.yAxis?.[1]){const Gt=(0,fs.WK)(qe.yAxis,nt.yAxis[0],nt.yAxis[1]),rn=ut.series.valueField.display;zt=rn(Gt)}const dn=(0,ws.LE)(ut.datapoint[0],{defaultWithMS:ut.series.hasMsResolution,timeZone:Ae});return(0,r.jsx)(ei,{timestamp:dn,seriesColor:ut.series.color,displayName:ut.series.alias||ut.series.label,displayValue:zt})},Kt=()=>Ct?.map((zt,dn)=>(0,r.jsx)(ba.r,{label:zt.label,children:(zt.items||[]).map(Gt=>(0,r.jsx)(Ps.D,{url:Gt.url,label:Gt.label,target:Gt.target,icon:Gt.icon,active:Gt.active,onClick:Gt.onClick},`${Gt.label}`))},`${zt.label}${dn}`));return(0,r.jsx)(Qn.t,{...ot,renderMenuItems:Kt,renderHeader:Lt})},ei=({timestamp:he,seriesColor:Ae,displayName:Fe,displayValue:qe})=>{const nt=(0,S.of)(fr);return(0,r.jsxs)("div",{className:nt.wrapper,children:[(0,r.jsx)("strong",{children:he}),(0,r.jsxs)(Or.Gy,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(sr.p,{color:Ae}),(0,r.jsx)("span",{className:nt.displayName,children:Fe})]}),qe&&(0,r.jsx)(Ho.i,{value:qe})]})]})};function fr(he){return{wrapper:(0,v.css)({padding:he.spacing(.5,1),fontSize:he.typography.size.sm,zIndex:he.zIndex.tooltip}),displayName:(0,v.css)({whiteSpace:"nowrap",paddingLeft:he.spacing(.5)})}}var bs=e(55386),As=e(16515),Ls=e(5421);const Qi=(he,Ae)=>{let Fe=0,qe=he.values.length-1,nt;for(;;){if(Fe>qe)return Math.max(qe,0);nt=Math.floor((Fe+qe)/2);const ot=he.values[nt];if(ot===Ae)return nt;ot&&ot<Ae?Fe=nt+1:qe=nt-1}},ti=(he,Ae,Fe,qe)=>{let nt,ot,ut,Ct,Lt;const Kt=[];let zt,dn;for(nt=0;nt<he.length;nt++){ot=he[nt];const Gt=Ae[nt];ut=Qi(Gt,Fe),Ct=Fe-Gt.values[ut],Lt=Gt.values[ut],(zt===void 0||Ct>=0&&(Ct<zt||zt<0)||Ct<0&&Ct>zt)&&(zt=Ct,dn=Gt.display?(0,bs.cN)(Gt.display(Lt)):Lt);const rn=ot.display(ot.values[ut]);Kt.push({value:(0,bs.cN)(rn),datapointIndex:ut,seriesIndex:nt,color:rn.color,label:(0,As.Ct)(ot),time:Gt.display?(0,bs.cN)(Gt.display(Lt)):Lt})}return{results:Kt,time:dn}},pr=(he,Ae)=>(0,ws.LE)(he,{format:Ae?.options?.timeformat,timeZone:Ae?.options?.timezone}),La=(he,Ae,Fe)=>{if(Ae&&Fe&&he){const qe=Fe-Ae,nt=qe/he/1e3,ot=86400010,ut=31536e6;return nt<=10?Ls.WC.interval.millisecond:nt<=45?Ls.WC.interval.second:qe<=ot?Ls.WC.interval.minute:nt<=8e4?Ls.WC.interval.hour:qe<=ut?Ls.WC.interval.day:nt<=31536e3?Ls.WC.interval.month:Ls.WC.interval.year}return Ls.WC.interval.minute},co=({dimensions:he,activeDimensions:Ae,pos:Fe,timeZone:qe})=>{let nt=null;if(Ae.xAxis===null)return null;Ae.yAxis&&(nt=Ae.yAxis[0]);const ot=Ae.xAxis[1]?(0,fs.WK)(he.xAxis,Ae.xAxis[0],Ae.xAxis[1]):Fe.x,ut=ti(he.yAxis.columns,he.xAxis.columns,ot,qe),Ct=ut.time,Lt=ut.results.map((Kt,zt)=>({color:Kt.color,label:Kt.label,value:Kt.value,isActive:nt===zt}));return(0,r.jsx)(xn.o,{series:Lt,timestamp:Ct})};co.displayName="MultiModeGraphTooltip";const Xs=({dimensions:he,activeDimensions:Ae,timeZone:Fe})=>
155{if(Ae.yAxis===null||Ae.yAxis[1]===void 0||Ae.xAxis===null||Ae.xAxis[1]===void 0)return null;const qe=(0,fs.WK)(he.xAxis,Ae.xAxis[0],Ae.xAxis[1]),nt=(0,fs.P4)(he.xAxis,Ae.xAxis[0]),ot=nt.display?(0,bs.cN)(nt.display(qe)):qe,ut=(0,fs.P4)(he.yAxis,Ae.yAxis[0]),Ct=(0,fs.WK)(he.yAxis,Ae.yAxis[0],Ae.yAxis[1]),Lt=ut.display,Kt=Lt(Ct);return(0,r.jsx)(xn.o,{series:[{color:Kt.color,label:(0,As.Ct)(ut),value:(0,bs.cN)(Kt)}],timestamp:ot})};Xs.displayName="SingleModeGraphTooltip";const is=({mode:he=sa.$N.Single,dimensions:Ae,activeDimensions:Fe,pos:qe,timeZone:nt})=>!Fe||!Fe.xAxis?null:he==="single"?(0,r.jsx)(Xs,{dimensions:Ae,activeDimensions:Fe,timeZone:nt}):(0,r.jsx)(co,{dimensions:Ae,activeDimensions:Fe,pos:qe,timeZone:nt});is.displayName="GraphTooltip";class Ar extends i.PureComponent{constructor(){super(...arguments),this.state={isTooltipVisible:!1,isContextVisible:!1},this.element=null,this.$element=null,this.onPlotSelected=(Ae,Fe)=>{const{onHorizontalRegionSelected:qe}=this.props;qe&&qe(Fe.xaxis.from,Fe.xaxis.to)},this.onPlotHover=(Ae,Fe,qe)=>{this.setState({isTooltipVisible:!0,activeItem:qe,pos:Fe})},this.onPlotClick=(Ae,Fe,qe)=>{this.setState({isContextVisible:!0,isTooltipVisible:!1,contextItem:qe,contextPos:Fe})},this.renderTooltip=()=>{const{children:Ae,series:Fe,timeZone:qe}=this.props,{pos:nt,activeItem:ot,isTooltipVisible:ut}=this.state;let Ct;if(!ut||!nt||Fe.length===0||(i.Children.forEach(Ae,jn=>{if(Ct)return;(jn&&jn.type&&(jn.type.displayName||jn.type.name))===ln.displayName&&(Ct=jn)}),!Ct))return null;const Lt=Ct.props,Kt=Lt.mode||"single";if(!ot&&Kt==="single")return null;const zt=Lt.tooltipComponent||is,dn=ot?ot.series.seriesIndex:0,Gt=ot?ot.dataIndex:void 0,rn={xAxis:[dn,Gt],yAxis:ot?[ot.series.seriesIndex,ot.dataIndex]:null},Pn={dimensions:{xAxis:(0,fs.r4)("xAxis",Fe.map(jn=>jn.timeField)),yAxis:(0,fs.r4)("yAxis",Fe.map(jn=>jn.valueField))},activeDimensions:rn,pos:nt,mode:Lt.mode||sa.$N.Single,timeZone:qe},Un=i.createElement(zt,{...Pn});return i.cloneElement(Ct,{content:Un,position:{x:nt.pageX,y:nt.pageY},offset:{x:10,y:10}})},this.renderContextMenu=()=>{const{series:Ae}=this.props,{contextPos:Fe,contextItem:qe,isContextVisible:nt}=this.state;if(!nt||!Fe||!qe||Ae.length===0)return null;const ot=qe?qe.series.seriesIndex:0,ut=qe?qe.dataIndex:void 0,Ct={xAxis:[ot,ut],yAxis:qe?[qe.series.seriesIndex,qe.dataIndex]:null},Lt={xAxis:(0,fs.r4)("xAxis",Ae.map(Gt=>Gt.timeField)),yAxis:(0,fs.r4)("yAxis",Ae.map(Gt=>Gt.valueField))},Kt=()=>this.setState({isContextVisible:!1}),zt=()=>({datapoint:qe.datapoint,dataIndex:qe.dataIndex,series:qe.series,seriesIndex:qe.series.seriesIndex,pageX:Fe.pageX,pageY:Fe.pageY}),dn={x:Fe.pageX,y:Fe.pageY,onClose:Kt,getContextMenuSource:zt,timeZone:this.props.timeZone,dimensions:Lt,contextDimensions:Ct};return(0,r.jsx)(qo,{...dn})},this.getBarWidth=()=>{const{series:Ae}=this.props;return Math.min(...Ae.map(Fe=>Fe.timeStep))}}static{this.defaultProps={showLines:!0,showPoints:!1,showBars:!1,isStacked:!1,lineWidth:1}}componentDidUpdate(Ae,Fe){Ae!==this.props&&this.draw()}componentDidMount(){this.draw(),this.element&&(this.$element=hr()(this.element),this.$element.bind("plotselected",this.onPlotSelected),this.$element.bind("plothover",this.onPlotHover),this.$element.bind("plotclick",this.onPlotClick))}componentWillUnmount(){this.$element&&this.$element.unbind("plotselected",this.onPlotSelected)}getYAxes(Ae){return Ae.length===0?[{show:!0,min:-1,max:1}]:(0,N.uniqBy)(Ae.map(Fe=>{const qe=Fe.yAxis?Fe.yAxis.index:1,nt=Fe.yAxis&&Fe.yAxis.min&&!isNaN(Fe.yAxis.min)?Fe.yAxis.min:null,ot=Fe.yAxis&&Fe.yAxis.tickDecimals&&!isNaN(Fe.yAxis.tickDecimals)?Fe.yAxis.tickDecimals:null;return{show:!0,index:qe,position:qe===1?"left":"right",min:nt,tickDecimals:ot}}),Fe=>Fe.index)}draw(){if(this.element===null)return;const{width:Ae,series:Fe,timeRange:qe,showLines:nt,showBars:ot,showPoints:ut,isStacked:Ct,lineWidth:Lt,timeZone:Kt,onHorizontalRegionSelected:zt}=this.props;if(!Ae)return;const dn=Ae/100,Gt=qe.from.valueOf(),rn=qe.to.valueOf(),Pn=this.getYAxes(Fe),Un={legend:{show:!1},series:{stack:Ct,lines:{show:nt,lineWidth:Lt,zero:!1},points:{show:ut,fill:1,fillColor:!1,radius:2},bars:{show:ot,fill:1,barWidth:ot?this.getBarWidth()/1.5:1,zero:!1,lineWidth:Lt},shadowSize:0},xaxis:{timezone:Kt,show:!0,mode:"time",min:Gt,max:rn,label:"Datetime",ticks:dn,timeformat:La(dn,Gt,rn),tick
155Formatter:pr},yaxes:Pn,grid:{minBorderMargin:0,markings:[],backgroundColor:null,borderWidth:0,hoverable:!0,clickable:!0,color:"#a1a1a1",margin:{left:0,right:0},labelMarginX:0,mouseActiveRadius:30},selection:{mode:zt?"x":null,color:"#666"},crosshair:{mode:"x"}};try{hr().plot(this.element,Fe.filter(jn=>jn.isVisible),Un)}catch(jn){throw console.error("Graph rendering error",jn,Un,Fe),new Error("Error rendering panel")}}render(){const{ariaLabel:Ae,height:Fe,width:qe,series:nt}=this.props,ot=nt.length===0,ut=this.renderTooltip(),Ct=this.renderContextMenu();return(0,r.jsxs)("div",{className:"graph-panel","aria-label":Ae,children:[(0,r.jsx)("div",{className:"graph-panel__chart",ref:Lt=>this.element=Lt,style:{height:Fe,width:qe},onMouseLeave:()=>{this.setState({isTooltipVisible:!1})}}),ot&&(0,r.jsx)("div",{className:"datapoints-warning",children:"No data"}),ut,Ct]})}}const ki=null,Yi=(he,Ae=!1,Fe=!1)=>{const qe=he.reduce((ot,ut)=>ot+(ut[1]||0),0)===0,nt=!he.reduce((ot,ut)=>ot&&ut[1]!==null,!0);return Ae&&nt||Fe&&qe},Lr=he=>{const{series:Ae,timeRange:Fe,width:qe,height:nt,showBars:ot,showLines:ut,showPoints:Ct,sortLegendBy:Lt,sortLegendDesc:Kt,legendDisplayMode:zt,legendVisibility:dn,placement:Gt,onSeriesToggle:rn,onToggleSort:Pn,hideEmpty:Un,hideZero:jn,isStacked:Bn,lineWidth:Yn,onHorizontalRegionSelected:Pa,timeZone:Hn,children:kn,ariaLabel:Rn}=he,{graphContainer:yn,wrapper:qn,legendContainer:An}=(0,S.of)(ni,he.placement),ra=Ae.reduce((oa,la)=>Yi(la.data,Un,jn)?oa:oa.concat([{label:la.label,color:la.color||"",disabled:!la.isVisible,yAxis:la.yAxis.index,getDisplayValues:()=>la.info||[]}]),[]);return(0,r.jsxs)("div",{className:qn,"aria-label":Rn,children:[(0,r.jsx)("div",{className:yn,children:(0,r.jsx)(Ar,{series:Ae,timeRange:Fe,timeZone:Hn,showLines:ut,showPoints:Ct,showBars:ot,width:qe,height:nt,isStacked:Bn,lineWidth:Yn,onHorizontalRegionSelected:Pa,children:kn})}),dn&&(0,r.jsx)("div",{className:An,children:(0,r.jsx)(Y.E,{hideHorizontalTrack:!0,children:(0,r.jsx)(un.t,{items:ra,displayMode:zt,placement:Gt,sortBy:Lt,sortDesc:Kt,onLabelClick:(oa,la)=>{rn&&rn(oa.label,la)},onToggleSort:Pn})})})]})},ni=(he,Ae)=>({wrapper:(0,v.css)({display:"flex",flexDirection:Ae==="bottom"?"column":"row"}),graphContainer:(0,v.css)({minHeight:"65%",flexGrow:1}),legendContainer:(0,v.css)({padding:"10px 0",maxHeight:Ae==="bottom"?"35%":"none"})});var Ji=e(64423),gr=e(99165),Zs=e(36638),qs=e(57866),ps=e(95004),jr=e(57852),ai=e(32899),js=e(36192),Xi=e(8721);const Zi={threshold:(he,Ae,Fe)=>he+Fe,midpoint:(he,Ae,Fe)=>(he+Ae)/2,plusone:(he,Ae,Fe)=>he+1};function qi(he){if(he.frame.length===0)return he.frame;let Ae=!0,{frame:Fe,refFieldName:qe,refFieldPseudoMax:nt,refFieldPseudoMin:ot,insertMode:ut}=he;ut||(ut=Zi.threshold);const Ct=ya(Fe,qe);if(Ct==null)return Fe;Ct.state={...Ct.state,nullThresholdApplied:!0};const Lt=Fe.fields.map(zt=>zt.config.custom?.insertNulls||Ct.config.interval||null),Kt=new Set(Lt);if(Kt.delete(null),Kt.size===0)return Fe;if(Kt.size===1){const zt=Kt.values().next().value;if(!zt||zt<=0)return Fe;const dn=Ct.values,Gt=Fe.fields.map(Pn=>Pn.values),rn=ja(dn,Gt,zt,ot,nt,ut,Ae);return rn===Gt?Fe:{...Fe,length:rn[0].length,fields:Fe.fields.map((Pn,Un)=>({...Pn,values:rn[Un]}))}}return Fe}function ja(he,Ae,Fe,qe=null,nt=null,ot,ut){const Ct=he.length,Lt=[];if(qe!=null&&qe<he[0]){let Gt=Math.ceil((he[0]-qe)/Fe),rn=he[0]-Gt*Fe;for(;rn<he[0];
155)Lt.push(ot(rn-Fe,rn,Fe)),rn+=Fe}Lt.push(he[0]);let Kt=he[0];for(let Gt=1;Gt<Ct;Gt++){const rn=he[Gt];for(;rn-Kt>Fe&&(Lt.push(ot(Kt,rn,Fe)),Kt+=Fe,!!ut););Lt.push(rn),Kt=rn}if(nt!=null&&nt>Kt)for(;Kt+Fe<nt;)Lt.push(ot(Kt,nt,Fe)),Kt+=Fe;const zt=Lt.length;if(zt===Ct)return Ae;const dn=[];for(let Gt of Ae){let rn;if(Gt!==he){rn=Array(zt);for(let Pn=0,Un=0;Pn<zt;Pn++)rn[Pn]=he[Un]===Lt[Pn]?Gt[Un++]:null}else rn=Lt;dn.push(rn)}return dn}function el(he,Ae,Fe){let qe,nt;for(let ot=0;ot<Ae.length;ot++)if(Ae[ot]==null)nt==null&&qe!=null&&(nt=ot);else{if(nt!=null){if(he[ot]-qe<Fe)for(;nt<ot;)Ae[nt++]=void 0;nt=null}qe=he[ot]}return Ae}function gs(he){return he.type===ps.PU.number&&he.config.custom?.drawStyle===sa.GR.Bars&&!he.config.custom?.hideFrom?.viz}function ya(he,Ae){return he.fields.find(Fe=>Ae!=null?Fe.name===Ae:Fe.type===ps.PU.time)}function Sa(he,Ae){const Fe=ya(he,Ae);let qe=Fe?.values;for(let nt=0;nt<he.fields.length;nt++){let ot=he.fields[nt];if(ot===Fe||gs(ot))continue;let ut=ot.config.custom?.spanNulls;typeof ut=="number"&&ut!==-1&&qe&&(ot.values=el(qe,ot.values,ut))}return he}function si(he,Ae,Fe){let qe;e:for(let Ct of he)for(let Lt of Ct.fields)if(Ae.x(Lt,Ct,he)){qe=Lt;break e}he=he.map(Ct=>qe?.state?.nullThresholdApplied?Ct:qi({frame:Ct,refFieldName:qe.name,refFieldPseudoMin:Fe?.from.valueOf(),refFieldPseudoMax:Fe?.to.valueOf()}));let nt=0;he.forEach(Ct=>{Ct.fields.forEach(Lt=>{gs(Lt)&&(Lt.config.custom={...Lt.config.custom,spanNulls:-1},nt++)})});let ot=1/0;nt>1&&he.forEach(Ct=>{if(!Ct.fields.some(gs))return;const Lt=qe.values;for(let Kt=0;Kt<Lt.length;Kt++)Kt>0&&(ot=Math.min(ot,Lt[Kt]-Lt[Kt-1]))});let ut=(0,Xi.Fd)({frames:he,joinBy:Ae.x,keep:Ae.y,keepOriginIndices:!0});return ut?(ut=Sa(ut,qe.name),ot!==1/0&&(ut.fields.forEach((Ct,Lt)=>{let Kt=Ct.values;if(Lt===0){let zt=Kt[Kt.length-1];Kt.push(zt+ot,zt+2*ot)}else gs(Ct)?Kt.push(null,null):Kt.push(void 0,void 0)}),ut.length+=2),ut):null}function uo(he,Ae){const Fe="na",qe=`${he.min!==void 0?he.min:Fe}-${he.max!==void 0?he.max:Fe}`,nt=`${he.custom?.axisSoftMin!==void 0?he.custom.axisSoftMin:Fe}-${he.custom?.axisSoftMax!==void 0?he.custom.axisSoftMax:Fe}`,ot=`${he.custom?.axisPlacement!==void 0?he.custom?.axisPlacement:sa.vM.Auto}`,ut=he.unit??Xo.s,Ct=he.custom?.scaleDistribution?tl(he.custom.scaleDistribution):sa.L4.Linear,Lt=he.custom?.axisLabel?he.custom.axisLabel:Fe;return`${ut}/${qe}/${nt}/${ot}/${Ct}/${Lt}/${Ae}`}function tl(he){return he.type===sa.L4.Log?`${he.type}${he.log}`:he.type}function Ma(he,Ae,Fe=[]){for(const qe of Fe)if(typeof qe=="function"){if(!qe(he,Ae))return!1}else if(Ae[qe]!==he[qe])return!1;return!0}class Bs extends i.Component{constructor(Ae){super(Ae),this.panelContext={},this.subscription=new Ji.yU,this.getTimeRange=()=>this.props.timeRange;let Fe=this.prepState(Ae);Fe.alignedData=Fe.config.prepData([Fe.alignedFrame]),this.state=Fe,this.plotInstance=i.createRef()}static{this.contextType=St.e4}prepState(Ae,Fe=!0){let qe=null;const{frames:nt,fields:ot,preparePlotFrame:ut}=Ae,Lt=(ut||si)(nt,ot||{x:Zs.sJ.get(qs.Ct.firstTimeField).get({}),y:Zs.sJ.get(qs.Ct.byTypes).get(new Set([ps.PU.number,ps.PU.enum]))},Ae.timeRange);if((0,js.uY)("GraphNG",!1,"data aligned",Lt),Lt){let Kt=this.state?.config;Fe&&(Kt=Ae.prepConfig(Lt,this.props.frames,this.getTimeRange),(0,js.uY)("GraphNG",!1,"config prepared",Kt)),qe={alignedFrame:Lt,config:Kt},(0,js.uY)("GraphNG",!1,"data prepared",qe.alignedData)}return qe}handleCursorUpdate(Ae){const Fe=Ae.payload?.point?.time,qe=this.plotInstance.current;if(qe&&Fe){const nt=qe.valToPos(Fe,"x");let ot;if(nt&&(ot=(0,js.sw)(qe,qe.posToIdx(nt))),!ot||!nt)return;qe.setCursor({left:nt,top:ot})}}componentDidMount(){this.panelContext=this.context;const{eventBus:Ae}=this.panelContext;this.subscription.add(Ae.getStream(jr.b_).pipe((0,gr.c)(50)).subscribe({next:Fe=>{Ae!==Fe.origin&&this.handleCursorUpdate(Fe)}})),this.subscription.add(Ae.getStream(ai.kb).pipe((0,gr.c)(50)).subscribe({next:Fe=>this.handleCursorUpdate(Fe)})),this.subscription.add(Ae.getStream(jr.ql).pipe((0,gr.c)(50)).subscribe({next:()=>{const Fe=this.plotInstance?.current;Fe&&!Fe.cursor._lock&&Fe.setCursor({left:-10,top:-10}
155)}}))}componentDidUpdate(Ae){const{frames:Fe,structureRev:qe,timeZone:nt,propsToDiff:ot}=this.props,ut=!Ma(Ae,this.props,ot);if(Fe!==Ae.frames||ut||nt!==Ae.timeZone){let Ct=this.prepState(this.props,!1);Ct&&((this.state.config===void 0||nt!==Ae.timeZone||qe!==Ae.structureRev||!qe||ut)&&(Ct.config=this.props.prepConfig(Ct.alignedFrame,this.props.frames,this.getTimeRange),(0,js.uY)("GraphNG",!1,"config recreated",Ct.config)),Ct.alignedData=Ct.config.prepData([Ct.alignedFrame]),this.setState(Ct))}}componentWillUnmount(){this.subscription.unsubscribe()}render(){const{width:Ae,height:Fe,children:qe,renderLegend:nt}=this.props,{config:ot,alignedFrame:ut,alignedData:Ct}=this.state;return ot?(0,r.jsx)(Ht.KU,{width:Ae,height:Fe,legend:nt(ot),children:(Lt,Kt)=>(0,r.jsx)(lo.Z,{config:ot,data:Ct,width:Lt,height:Kt,plotRef:zt=>this.plotInstance.current=zt,children:qe?qe(ot,ut):null})}):null}}var Br=e(36613),Ss=e(11576),qa=e(76637),Vs=e(64394),Ur=e(84229),ta=e(66650);const nl=new Set(["bytes","bits","kbytes","mbytes","gbytes","tbytes","pbytes","binBps","binbps","KiBs","Kibits","MiBs","Mibits","GiBs","Gibits","TiBs","Tibits","PiBs","Pibits"]),ho=Array(53);for(let he=0;he<ho.length;he++)ho[he]=2**he;const Us=(he,Ae=1)=>he==null?"-":he.toFixed(Ae),hn={drawStyle:sa.GR.Line,showPoints:sa.yL.Auto,axisPlacement:sa.vM.Auto},$s=({frame:he,theme:Ae,timeZones:Fe,getTimeRange:qe,sync:nt,allFrames:ot,renderers:ut,tweakScale:Ct=Kt=>Kt,tweakAxis:Lt=Kt=>Kt})=>{const Kt="__global_",zt=new Qo.e(Fe[0]);let dn;zt.setPrepData(Rn=>(dn=Rn[0],(0,js.bq)(Rn[0],zt.getStackingGroups())));const Gt=he.fields[0];if(!Gt)return zt;const rn="x";let Pn="";const Un=Gt.config.custom?.axisPlacement!==sa.vM.Hidden?sa.vM.Bottom:sa.vM.Hidden,jn=Gt.config.custom?.axisPlacement!==sa.vM.Hidden;if(Gt.type===ps.PU.time){zt.addScale({scaleKey:rn,orientation:sa.Lt.Horizontal,direction:sa.ON.Right,isTime:!0,range:()=>{const yn=qe();return[yn.from.valueOf(),yn.to.valueOf()]}});const Rn=Fe.length>1?(yn,qn)=>qn.map((An,ra)=>ra<2?null:An):void 0;for(let yn=0;yn<Fe.length;yn++){const qn=Fe[yn];zt.addAxis({scaleKey:rn,isTime:!0,placement:Un,show:jn,label:Gt.config.custom?.axisLabel,timeZone:qn,theme:Ae,grid:{show:yn===0&&Gt.config.custom?.axisGridShow},filter:Rn})}Fe.length>1&&zt.addHook("drawAxes",yn=>{yn.ctx.save(),yn.ctx.fillStyle=Ae.colors.text.primary,yn.ctx.textAlign="left",yn.ctx.textBaseline="bottom";let qn=0;yn.axes.forEach(An=>{if(An.side===2){let ra=An._pos+An._size;yn.ctx.fillText(Fe[qn],yn.bbox.left,ra*Br.A.pxRatio),qn++}}),yn.ctx.restore()})}else zt.addScale({scaleKey:rn,orientation:sa.Lt.Horizontal,direction:sa.ON.Right,range:(Rn,yn,qn)=>[Gt.config.min??yn,Gt.config.max??qn]}),zt.addAxis({scaleKey:rn,placement:Un,show:jn,label:Gt.config.custom?.axisLabel,theme:Ae,grid:{show:Gt.config.custom?.axisGridShow},formatValue:(Rn,yn)=>(0,bs.cN)(Gt.display(Rn,yn))});let Bn=ut?.flatMap(Rn=>Object.values(Rn.fieldMap).filter(yn=>Rn.indicesOnly.indexOf(yn)===-1))??[],Yn;for(let Rn=1;Rn<he.fields.length;Rn++){const yn=he.fields[Rn],qn={...yn.config,custom:{...hn,...yn.config.custom}},An=qn.custom;if(yn===Gt||yn.type!==ps.PU.number&&yn.type!==ps.PU.enum)continue;let ra=yn.display??Us;yn.config.custom?.stacking?.mode===sa.gs.Percent&&(ra=(0,Ss.J)({field:{...yn,config:{...yn.config,unit:"percentunit"}},theme:Ae}));const oa=uo(qn,yn.type),la=(0,qa.Qi)(yn),ga=(0,qa.lz)(yn,Ae).color;if(zt.addScale(Ct({scaleKey:oa,orientation:sa.Lt.Vertical,direction:sa.ON.Up,distribution:An.scaleDistribution?.type,log:An.scaleDistribution?.log,linearThreshold:An.scaleDistribution?.linearThreshold,min:yn.config.min,max:yn.config.max,softMin:An.axisSoftMin,softMax:An.axisSoftMax,centeredZero:An.axisCenteredZero,range:An.stacking?.mode===sa.gs.Percent?(Ra,ms,ls)=>(ms=ms<0?-1:0,ls=ls>0?1:0,[ms,ls]):yn.type===ps.PU.enum?(Ra,ms,ls)=>[-1,yn.config.type.enum.text.length]:void 0,decimals:yn.config.decimals},yn)),Pn||(Pn=oa),An.axisPlacement!==sa.vM.Hidden){let Ra;An.axisColorMode===sa.Y$.Series&&(la.isByValue&&yn.config.custom?.gradientMode===sa.on.Scheme&&la.id===Vs.Y.Thresholds?Ra=(0,ta.pl)(1,Ae,la,yn.config.thresholds):Ra=ga);const ms={border:{show:An.axisBorderShow||!1,width:1/devicePixelRatio,stroke:
155Ra||Ae.colors.text.primary},ticks:{show:An.axisBorderShow||!1,stroke:Ra||Ae.colors.text.primary},color:Ra||Ae.colors.text.primary};let ls,Na,ts;if(nl.has(qn.unit))ls=ho;else if(yn.type===ps.PU.enum){let Ja=yn.config.type.enum.text;ts=Ja.map((vs,Ka)=>Ka),Na=Ja}zt.addAxis(Lt({scaleKey:oa,label:An.axisLabel,size:An.axisWidth,placement:An.axisPlacement??sa.vM.Auto,formatValue:(Ja,vs)=>(0,bs.cN)(ra(Ja,vs)),theme:Ae,grid:{show:An.axisGridShow},decimals:yn.config.decimals,distr:An.scaleDistribution?.type,splits:ts,values:Na,incrs:ls,...ms},yn))}const Ia=An.drawStyle===sa.GR.Points?sa.yL.Always:An.showPoints;let es=()=>null;An.spanNulls!==!0&&(es=(Ra,ms,ls,Na)=>{let ts=[],Ja=Ra.series[ms];if(!ls&&Na&&Na.length){const[vs,Ka]=Ja.idxs,zs=Ra.data[0],tr=Ra.data[ms],Wr=Math.round(Ra.valToPos(zs[vs],"x",!0)),da=Math.round(Ra.valToPos(zs[Ka],"x",!0));Na[0][0]===Wr&&ts.push(vs);for(let Ta=0;Ta<Na.length;Ta++){let ys=Na[Ta],xs=Na[Ta+1];if(xs&&ys[1]===xs[0]){let Ts=Ra.posToIdx(ys[1],!0);if(tr[Ts]==null)for(let cs=1;cs<100;cs++){if(tr[Ts+cs]!=null){Ts+=cs;break}if(tr[Ts-cs]!=null){Ts-=cs;break}}ts.push(Ts)}}Na[Na.length-1][1]===da&&ts.push(Ka)}return ts.length?ts:null});let{fillOpacity:Fa}=An,Cs=null,Ua=null;if(yn.state?.origin){Yn||(Yn=Ns(he,ot));const Ra=ot[yn.state.origin.frameIndex],ms=Ra?.fields[yn.state.origin.fieldIndex],ls=(0,As.Ct)(ms??yn,Ra,ot);if(Bn.indexOf(ls)>=0)Cs=()=>null,Ua=()=>{};else if(An.transform===sa.NU.Constant){const Na=Br.A.paths.linear();Cs=(ts,Ja)=>{const vs=ts._data,Ka=qe();let zs=[Ka.from.valueOf(),Ka.to.valueOf()],tr=vs[Ja].find(Ta=>Ta!=null),Wr=[tr,tr],da=vs.slice();return da[0]=zs,da[Ja]=Wr,Na({...ts,_data:da},Ja,0,1)}}if(An.fillBelowTo){const Na=he.fields.find(Ka=>An.fillBelowTo===Ka.name||An.fillBelowTo===Ka.config?.displayNameFromDS||An.fillBelowTo===(0,As.Ct)(Ka,he,ot)),ts=Na?(0,As.Ct)(Na,he,ot):An.fillBelowTo,Ja=Yn.get(ls),vs=Yn.get(ts);(0,N.isNumber)(vs)&&(0,N.isNumber)(Ja)?(zt.addBand({series:[Ja,vs],fill:void 0}),Fa||(Fa=35)):Fa=0}}let Nr;la.id===Vs.Y.Thresholds&&(Nr=Ra=>(0,qa.lz)(dn.fields[Ra],Ae).color),zt.addSeries({pathBuilder:Cs,pointsBuilder:Ua,scaleKey:oa,showPoints:Ia,pointsFilter:es,colorMode:la,fillOpacity:Fa,theme:Ae,dynamicSeriesColor:Nr,drawStyle:An.drawStyle,lineColor:An.lineColor??ga,lineWidth:An.lineWidth,lineInterpolation:An.lineInterpolation,lineStyle:An.lineStyle,barAlignment:An.barAlignment,barWidthFactor:An.barWidthFactor,barMaxWidth:An.barMaxWidth,pointSize:An.pointSize,spanNulls:An.spanNulls||!1,show:!An.hideFrom?.viz,gradientMode:An.gradientMode,thresholds:qn.thresholds,hardMin:yn.config.min,hardMax:yn.config.max,softMin:An.axisSoftMin,softMax:An.axisSoftMax,dataFrameFieldIndex:yn.state?.origin}),An.thresholdsStyle&&qn.thresholds&&(An.thresholdsStyle.mode??sa.Ly.Off)!==sa.Ly.Off&&zt.addThresholds({config:An.thresholdsStyle,thresholds:qn.thresholds,scaleKey:oa,theme:Ae,hardMin:yn.config.min,hardMax:yn.config.max,softMin:An.axisSoftMin,softMax:An.axisSoftMax})}let Pa=(0,js.ro)(he);zt.setStackingGroups(Pa),ut?.forEach(Rn=>{Yn||(Yn=Ns(he,ot));let yn={};for(let qn in Rn.fieldMap){let An=Rn.fieldMap[qn];yn[qn]=Yn.get(An)}Rn.init(zt,yn)}),zt.scaleKeys=[rn,Pn];const Hn=15;let kn={dataIdx:(Rn,yn,qn,An)=>{let ra=Rn.data[yn];if(ra[qn]==null){let oa=null,la=null,ca;for(ca=qn;oa==null&&ca-- >0;)ra[ca]!=null&&(oa=ca);for(ca=qn;la==null&&ca++<ra.length;)ra[ca]!=null&&(la=ca);let ga=Rn.data[0],Ia=Rn.valToPos(An,"x"),es=la==null?1/0:Rn.valToPos(ga[la],"x"),Fa=oa==null?-1/0:Rn.valToPos(ga[oa],"x"),Cs=Ia-Fa,Ua=es-Ia;Cs<=Ua?Cs<=Hn&&(qn=oa):Ua<=Hn&&(qn=la)}return qn}};
155return nt&&nt()!==Ur.y.Off&&(kn.sync={key:Kt,scales:[rn,null]}),zt.setCursor(kn),zt};function Ns(he,Ae){const Fe=new Map;return he.fields.forEach((qe,nt)=>{const ot=qe.state?.origin;if(ot){const ut=Ae[ot.frameIndex]?.fields[ot.fieldIndex];ut&&Fe.set((0,As.Ct)(ut,Ae[ot.frameIndex],Ae),nt)}}),Fe}const er=["legend","options","theme"];class ri extends i.Component{constructor(){super(...arguments),this.prepConfig=(Ae,Fe,qe)=>{const{sync:nt}=this.context,{theme:ot,timeZone:ut,renderers:Ct,tweakAxis:Lt,tweakScale:Kt}=this.props;return $s({frame:Ae,theme:ot,timeZones:Array.isArray(ut)?ut:[ut],getTimeRange:qe,sync:nt,allFrames:Fe,renderers:Ct,tweakScale:Kt,tweakAxis:Lt})},this.renderLegend=Ae=>{const{legend:Fe,frames:qe}=this.props;return!Ae||Fe&&!Fe.showLegend||!(0,hs.t)(Ae,qe)?null:(0,r.jsx)(hs.$,{data:qe,config:Ae,...Fe})}}static{this.contextType=St.e4}render(){return(0,r.jsx)(Bs,{...this.props,prepConfig:this.prepConfig,propsToDiff:er,renderLegend:this.renderLegend})}}const fo=(0,S.cV)(ri);fo.displayName="TimeSeries";const al=(0,i.createContext)({}),sl=()=>{const{data:he,dimFields:Ae,mapSeriesIndexToDataFrameFieldIndex:Fe}=(0,i.useContext)(al),qe=(0,i.useCallback)(()=>{const nt=Ae.x;let ot=null;for(let ut=0;ut<he.fields.length;ut++)if(nt(he.fields[ut],he,[he])){ot=he.fields[ut];break}return ot},[he,Ae]);return{dimFields:Ae,mapSeriesIndexToDataFrameFieldIndex:Fe,getXAxisField:qe,alignedData:he}},mr=5,vr=he=>he!=null&&!he.ctrlKey&&!he.metaKey,po=({onZoom:he,config:Ae,withZoomY:Fe=!1})=>((0,i.useLayoutEffect)(()=>{let qe=!1,nt=!1;Fe&&Ae.addHook("init",ot=>{ot.over.addEventListener("mousedown",ut=>{if(vr(ut)&&ut.button===0&&ut.shiftKey){nt=!0,ot.cursor.drag.x=!1,ot.cursor.drag.y=!0;let Ct=Lt=>{ot.cursor.drag.x=!0,ot.cursor.drag.y=!1,document.removeEventListener("mouseup",Ct,!0)};document.addEventListener("mouseup",Ct,!0)}},!0)}),Ae.addHook("setSelect",ot=>{const ut=ot.scales.x.ori===0;if(vr(ot.cursor.event)){if(Fe&&nt){if(ot.select.height>=mr){for(let Ct in ot.scales)if(Ct!=="x"){const Lt=ut?ot.posToVal(ot.select.top,Ct):ot.posToVal(ot.select.left+ot.select.width,Ct),Kt=ut?ot.posToVal(ot.select.top+ot.select.height,Ct):ot.posToVal(ot.select.left,Ct);ot.setScale(Ct,{min:Kt,max:Lt})}qe=!0}nt=!1}else if(ot.select.width>=mr){const Ct=ut?ot.posToVal(ot.select.left,"x"):ot.posToVal(ot.select.top+ot.select.height,"x"),Lt=ut?ot.posToVal(ot.select.left+ot.select.width,"x"):ot.posToVal(ot.select.top,"x");he({from:Ct,to:Lt}),qe=!1}}ot.setSelect({left:0,width:0,top:0,height:0},!1)}),Ae.setCursor({bind:{dblclick:ot=>()=>{if(!vr(ot.cursor.event))return null;if(Fe&&qe){for(let ut in ot.scales)ut!=="x"&&ot.setScale(ut,{min:null,max:null});qe=!1}else{let ut=ot.scales.x;const Ct=ut.min,Lt=ut.max,Kt=(Lt-Ct)/2;he({from:Ct-Kt,to:Lt+Kt})}return null}}})},[Ae,he,Fe]),null);var rl=e(1604),oi=e(46635);const go=10,mo=({mode:he=sa.$N.Single,sortOrder:Ae=sa.xB.None,sync:Fe,timeZone:qe,config:nt,renderTooltip:ot,...ut})=>{const Ct=(0,i.useRef)(),Lt=(0,S.$j)(),[Kt,zt]=(0,i.useState)(null),[dn,Gt]=(0,i.useState)(null),[rn,Pn]=(0,i.useState)([]),[Un,jn]=(0,i.useState)(null),[Bn,Yn]=(0,i.useState)(!1),Pa=(0,rl.A)();let Hn=null;const kn=(0,S.of)(Ie);if((0,i.useLayoutEffect)(()=>{let ra;const oa=()=>{Pa()&&(Yn(!0),Ct.current?.root.classList.add("plot-active"))},la=()=>{Pa()&&(jn(null),Yn(!1),Ct.current?.root.classList.remove("plot-active"))};return nt.addHook("syncRect",(ca,ga)=>ra=ga),nt.addHook("init",ca=>{Ct.current=ca,ca.over.addEventListener("mouseenter",oa),ca.over.addEventListener("mouseleave",la),Hn=ca.root.closest("[tabindex]"),Hn&&(Hn.addEventListener("focus",oa),Hn.addEventListener("blur",la)),Fe&&Fe()===Ur.y.Crosshair&&ca.root.classList.add("shared-crosshair")}),nt.addHook("setLegend",ca=>{Pa()&&(Gt(ca.legend.idx),Pn(ca.legend.idxs.slice()))}),nt.addHook("setCursor",ca=>{if(!ra||!Pa())return;const{x:ga,y:Ia}=ii(ca,ra);jn(ga!==void 0&&Ia!==void 0?{x:ga,y:Ia}:null)}),nt.addHook("setSeries",(ca,ga)=>{Pa()&&zt(ga)}),()=>{jn(null),Ct.current&&(Ct.current.over.removeEventListener("mouseleave",la),Ct.current.over.removeEventListener("mouseenter",oa),Hn&&(Hn.removeEventListener("focus",oa),Hn.removeEventListener("blur",la)))}},[nt,jn,Yn,Gt,Pn]),dn===null||!Bn&&Fe&&Fe()===Ur.y.Crosshair)return null;let Rn=ut.data.fields[0];if(!Rn)return null;const yn=Rn.display||(0,Ss.J)({field:Rn,timeZone:qe,theme:Lt});let qn=null,An=yn(Rn.values[dn]).text;if(ot)qn=ot(ut.data,Kt,dn);else{if(he===sa.$N.Single&&Kt!==null){const ra=ut.data.fields[Kt];
155if(!ra)return null;const oa=rn?.[Kt]??dn;An=yn(Rn.values[oa]).text;const ca=(ra.display||(0,Ss.J)({field:ra,timeZone:qe,theme:Lt}))(ra.values[oa]);qn=(0,r.jsx)(xn.o,{series:[{color:ca.color||Vs.F,label:(0,As.Ct)(ra,ut.data,ut.frames),value:ca?(0,bs.cN)(ca):null}],timestamp:An})}if(he===sa.$N.Multi){let ra=[];const oa=ut.data,la=oa.fields,ca=[];for(let ga=0;ga<la.length;ga++){const Ia=oa.fields[ga];if(!Ia||Ia===Rn||Ia.type===ps.PU.time||Ia.type!==ps.PU.number||Ia.config.custom?.hideFrom?.tooltip||Ia.config.custom?.hideFrom?.viz)continue;const es=ut.data.fields[ga].values[rn[ga]],Fa=Ia.display(es);ca.push(es),ra.push({color:Fa.color||Vs.F,label:(0,As.Ct)(Ia,oa,ut.frames),value:Fa?(0,bs.cN)(Fa):null,isActive:Kt===ga})}if(Ae!==sa.xB.None){const ga=[...ra],Ia=oi.sortValues(Ae);ra.sort((es,Fa)=>{const Cs=ga.indexOf(es),Ua=ga.indexOf(Fa);return Ia(ca[Cs],ca[Ua])})}qn=(0,r.jsx)(xn.o,{series:ra,timestamp:An})}}return(0,r.jsx)(te.ZL,{className:Bn?kn.tooltipWrapper:void 0,children:qn&&Un&&(0,r.jsx)(en.o,{position:{x:Un.x,y:Un.y},offset:{x:go,y:go},children:qn})})};function ol({left:he,top:Ae},Fe){return he===void 0||Ae===void 0?!1:he<0||he>Fe.width||Ae<0||Ae>Fe.height}function ii(he,Ae){let Fe,qe;const nt=he.cursor.left||0,ot=he.cursor.top||0;if(ol(he.cursor,Ae)){const ut=he.posToIdx(nt);if(ot<0||ot>Ae.height){let Ct=(0,js.sw)(he,ut);Ct&&(qe=Ae.top+Ct,nt>=0&&nt<=Ae.width&&(Fe=Ae.left+he.valToPos(he.data[0][he.posToIdx(nt)],he.series[0].scale)))}}else Fe=Ae.left+nt,qe=Ae.top+ot;return{x:Fe,y:qe}}const Ie=he=>({tooltipWrapper:(0,v.css)({"z-index":he.zIndex.portal+1+" !important"})});var ge=e(56887);const Le={SecretFormField:U.L,FormField:t.z,Select:L,AsyncSelect:K,IndicatorsContainer:m,NoOptionsMessage:l,Input:n.p,Switch:j}},92790:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>l});var t=e(74848),n=e(96540),r=e(36613),o=e(36192);function s(f,h){return h.width===f.width&&h.height===f.height}function m(f,h){return h.data===f.data}function a(f,h){return h.config===f.config}class l extends n.Component{constructor(h){super(h),this.plotContainer=(0,n.createRef)(),this.plotCanvasBBox=(0,n.createRef)(),this.plotInstance=null}reinitPlot(){let{width:h,height:u,plotRef:i}=this.props;if(this.plotInstance?.destroy(),h===0&&u===0)return;this.props.config.addHook("setSize",p=>{p.over});const x={width:Math.floor(this.props.width),height:Math.floor(this.props.height),...this.props.config.getConfig()};(0,o.uY)("UPlot",!1,"Reinitializing plot",x);const g=new r.A(x,this.props.data,this.plotContainer.current);i&&i(g),this.plotInstance=g}componentDidMount(){this.reinitPlot()}componentWillUnmount(){this.plotInstance?.destroy()}componentDidUpdate(h){s(h,this.props)?a(h,this.props)?m(h,this.props)||this.plotInstance?.setData(this.props.data):this.reinitPlot():this.plotInstance?.setSize({width:Math.floor(this.props.width),height:Math.floor(this.props.height)})}render(){return(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("div",{ref:this.plotContainer,"data-testid":"uplot-main-div"}),this.props.children]})}}},61897:(ee,B,e)=>{"use strict";e.d(B,{$:()=>u,t:()=>h});var t=e(74848),n=e(96540),r=e(16515),o=e(76637),s=e(739),m=e(63142),a=e(54735),l=e(78055),f=e(36192);function h(i,x){return i.getSeries().some(g=>{const p=g.props.dataFrameFieldIndex;if(!p)return!1;const c=x[p.frameIndex]?.fields[p.fieldIndex];return!(!c||c.config.custom?.hideFrom?.legend)})}const u=(0,n.memo)(({data:i,config:x,placement:g,calcs:p,displayMode:c,...y})=>{const P=(0,m.$j)(),d=x.getSeries().map(D=>{const b=D.props,E=b.dataFrameFieldIndex,v=x.getAxisPlacement(D.props.scaleKey);if(!E)return;const C=i[E.frameIndex]?.fields[E.fieldIndex];if(!C||C.config.custom?.hideFrom?.legend)return;const S=(0,r.Ct)(C,i[E.frameIndex],i),I=(0,o.lz)(C,P).color;return{disabled:!(b.show??!0),fieldIndex:E,color:I,label:S,yAxis:v===s.vM.Left||v===s.vM.Bottom?1:2,getDisplayValues:()=>(0,f.UO)(p,C,P),getItemKey:()=>`${S}-${E.frameIndex}-${E.fieldIndex}`,lineStyle:b.lineStyle}}).filter(D=>D!==void 0);return(0,t.jsx)(a.KU.Legend,{placement:g,...y,children:(0,t.jsx)(l.t,{placement:g,items:d,displayMode:c,sortBy:y.sortBy,sortDe
155sc:y.sortDesc,isSortable:!0})})});u.displayName="PlotLegend"},99555:(ee,B,e)=>{"use strict";e.d(B,{t:()=>n});var t=e(739);const n={drawStyle:[{label:"Lines",value:t.GR.Line},{label:"Bars",value:t.GR.Bars},{label:"Points",value:t.GR.Points}],lineInterpolation:[{description:"Linear",value:t.dx.Linear,icon:"gf-interpolation-linear"},{description:"Smooth",value:t.dx.Smooth,icon:"gf-interpolation-smooth"},{description:"Step before",value:t.dx.StepBefore,icon:"gf-interpolation-step-before"},{description:"Step after",value:t.dx.StepAfter,icon:"gf-interpolation-step-after"}],barAlignment:[{description:"Before",value:t.Nj.Before,icon:"gf-bar-alignment-before"},{description:"Center",value:t.Nj.Center,icon:"gf-bar-alignment-center"},{description:"After",value:t.Nj.After,icon:"gf-bar-alignment-after"}],showPoints:[{label:"Auto",value:t.yL.Auto,description:"Show points when the density is low"},{label:"Always",value:t.yL.Always},{label:"Never",value:t.yL.Never}],axisPlacement:[{label:"Auto",value:t.vM.Auto,description:"First field on the left, everything else on the right"},{label:"Left",value:t.vM.Left},{label:"Right",value:t.vM.Right},{label:"Hidden",value:t.vM.Hidden}],fillGradient:[{label:"None",value:t.on.None},{label:"Opacity",value:t.on.Opacity,description:"Enable fill opacity gradient"},{label:"Hue",value:t.on.Hue,description:"Small color hue gradient"},{label:"Scheme",value:t.on.Scheme,description:"Use color scheme to define gradient"}],stacking:[{label:"Off",value:t.gs.None},{label:"Normal",value:t.gs.Normal},{label:"100%",value:t.gs.Percent}],thresholdsDisplayModes:[{label:"Off",value:t.Ly.Off},{label:"As lines",value:t.Ly.Line},{label:"As lines (dashed)",value:t.Ly.Dashed},{label:"As filled regions",value:t.Ly.Area},{label:"As filled regions and lines",value:t.Ly.LineAndArea},{label:"As filled regions and lines (dashed)",value:t.Ly.DashedAndArea}]}},23414:(ee,B,e)=>{"use strict";e.d(B,{Zj:()=>y,pi:()=>f,zH:()=>c});var t=e(55386),n=e(79243),r=e(5421),o=e(80011),s=e(739),m=e(53568),a=e(62748),l=e(42073);const f=12,h=150,u=30,i=15,x=40,g=18,p=8;class c extends a.R{merge(v){this.props.size=(0,l.Y)("max",this.props.size,v.size),this.props.label||(this.props.label=v.label),this.props.placement===s.vM.Auto&&(this.props.placement=v.placement)}getConfig(){let{scaleKey:v,label:C,show:S=!0,placement:O=s.vM.Auto,grid:I={show:!0},ticks:R,space:T,filter:L,gap:K=5,formatValue:A,splits:W,values:N,incrs:w,isTime:j,timeZone:V,theme:U,tickLabelRotation:F,size:M,color:H,border:_,decimals:Z,distr:ne=s.L4.Linear}=this.props;const te=`${f}px ${U.typography.fontFamily}`,Y=U.isDark?"rgba(240, 250, 255, 0.09)":"rgba(0, 10, 23, 0.09)";(0,t.j9)(v)&&(W=[0,1]),Z===0&&ne===s.L4.Linear&&(L=(J,q)=>q.map(X=>Number.isInteger(X)?X:null));let Q={scale:v,show:S,stroke:H??U.colors.text.primary,side:b(O),font:te,size:M??((J,q,X)=>D(J,q,X)),rotate:F,gap:K,labelGap:0,grid:{show:I.show,stroke:Y,width:1/devicePixelRatio},ticks:Object.assign({show:!0,stroke:_?.show?H??U.colors.text.primary:Y,width:1/devicePixelRatio,size:4},R),splits:W,values:N,space:T??((J,q,X,se,oe)=>d(J,q,X,se,oe,A)),filter:L,incrs:w};return _?.show&&(Q.border={stroke:H??U.colors.text.primary,width:1/devicePixelRatio,..._}),C!=null&&C.length>0&&(Q.label=C,Q.labelSize=f+p,Q.labelFont=te,Q.labelGap=p),N?Q.values=N:j?Q.values=P:A&&(Q.values=(J,q,X,se,oe)=>{let ae=(0,n.E)((0,n.h)(oe,6));return q.map(ie=>ie==null?null:A(ie,ae>0?ae:void 0))}),Q.timeZone=V,Q}}const y={second:1e3,minute:60*1e3,hour:60*60*1e3,day:24*60*60*1e3,month:28*24*60*60*1e3,year:365*24*60*60*1e3};function P(E,v,C,S,O){const I=E.axes[C],R="timeZone"in I&&typeof I.timeZone=="string"?I.timeZone:void 0,T=E.scales.x,L=(T?.max??0)-(T?.min??0),K=Math.round(y.year/y.day)*y.day,A=Math.round(O/y.day)*y.day;let W=r.WC.interval.year;return O<y.second?W=r.WC.interval.millisecond:O<=y.minute?W=r.WC.interval.second:L<=y.day?W=r.WC.interval.minute:O<=y.day?W=r.WC.interval.hour:L<y.year?W=r.WC.interval.day:A===K?W=r.WC.interval.year:O<=y.year&&(W=r.WC.interval.month),v.map(N=>N==null?"":(0,o.LE)(N,{format:W,timeZone:R}))}function d(E,v,C,S,O,I){const R=E.axes[v],T=E.scales[R.scale];if(R.side!==2||!T)return O<=h?i:u;const L=O/x,K=(S-C)/L,A=Math.max(Math.abs(C),Math.abs(S));let W="";if(T.time)W=P(E,[A],v,x,K)[0];else if(I!=null)W=I(A);else return x;return(0,m.kD)(W,f).width+g}function D(E,v,C){const S=E.axes[C];let O=S.ticks.size;if(S.side===2)O+=S.gap+f;else if(v?.length){let I=v.reduce((T,L)=>Math.max(T,(0,m.kD)(L,f).width),0);const R=Math.min(E.width*.4,I);O+=S.gap+S.labelGap+R}return Math.ceil(O)}function b(E){switch(E){case s.vM.Top:return 0;case s.vM.Right:return 1;case s.vM.Bottom:return 2;case s.vM.Left:}return 3}},47276:(ee,B,e)=>{"use strict";e.d(B,{e:()=>D});var t=e(2543),n=e(36613),r=e(22592),o=e(62717),s=e(739),m=e(36192),a=e(23414),l=e(42073),f=e(64394),h=e(6773),u=e(62748),i=e(66650);class x extends u.R{getConfig(){const{facets:E,drawStyle:v,pathBuilder:C,pointsBuilder:S,pointsFilter:O,lineInterpolation:I,lineWidth:R,lineStyle:T,barAlignment:L,barWidthFactor:K,barMaxWidth:A,showPoints:W,pointSize:N,scaleKey:w,pxAlign:j,spanNulls:V,show:U=!0}=this.props;let F={},M=this.getLineColor();F.stroke=M,F.width=R,T&&T.fill!=="solid"&&(T.fill==="dot"&&(F.cap="round"),F.dash=T.dash??[10,10]),
155C!=null?F.paths=C:v===s.GR.Points?F.paths=()=>null:v!=null&&(F.paths=(Z,ne,te,Y)=>p(v,I,L,K,A)(Z,ne,te,Y));const H=typeof M=="string"?M:(Z,ne)=>Z.series[ne]._stroke,_={points:{stroke:H,fill:H,size:!N||N<R?void 0:N,filter:O}};return S!=null?_.points.show=S:v===s.GR.Points?_.points.show=!0:W===s.yL.Auto?v===s.GR.Bars&&(_.points.show=!1):W===s.yL.Never?_.points.show=!1:W===s.yL.Always&&(_.points.show=!0),{scale:w,facets:E,spanGaps:typeof V=="number"?!1:V,value:()=>"",pxAlign:j,show:U,fill:this.getFill(),...F,..._}}getLineColor(){const{lineColor:E,gradientMode:v,colorMode:C,thresholds:S,theme:O,hardMin:I,hardMax:R,softMin:T,softMax:L,dynamicSeriesColor:K}=this.props;return v===s.on.None&&K?(A,W)=>K(W)??E??f.F:v===s.on.Scheme&&C?.id!==f.Y.Fixed?(0,i.pl)(1,O,C,S,I,R,T,L):v===s.on.Hue?(0,i.B5)(E??f.F,1,O):E??f.F}getFill(){const{lineColor:E,fillColor:v,gradientMode:C,fillOpacity:S,colorMode:O,thresholds:I,theme:R,hardMin:T,hardMax:L,softMin:K,softMax:A,dynamicSeriesColor:W}=this.props;if(v)return v;const N=C??s.on.None,w=(S??0)/100;if(N===s.on.None&&W&&w>0)return(j,V)=>{let U=j.series[V]._stroke;return h.MV.alpha(U??"",w)};switch(N){case s.on.Opacity:return(0,i.WO)(v??E,w);case s.on.Hue:return(0,i.B5)(v??E,w,R);case s.on.Scheme:if(O?.id!==f.Y.Fixed)return(0,i.pl)(w,R,O,I,T,L,K,A);default:if(w>0)return h.MV.alpha(E??"",w)}}}let g;function p(b,E,v=s.Nj.Center,C=.6,S=200){const O=n.A.paths;if(g||(g={linear:O.linear(),smooth:O.spline(),stepBefore:O.stepped({align:-1}),stepAfter:O.stepped({align:1})}),b===s.GR.Bars){let I=`bars|${v}|${C}|${S}`;return g[I]||(g[I]=O.bars({size:[C,S],align:v})),g[I]}else if(b===s.GR.Line){if(E===s.dx.StepBefore)return g.stepBefore;if(E===s.dx.StepAfter)return g.stepAfter;if(E===s.dx.Smooth)return g.smooth}return g.linear}var c=e(84140),y=e(33553);function P(b){const E=b.config.mode===s.Ly.Dashed||b.config.mode===s.Ly.DashedAndArea?[10,10]:[];function v(W,N,w,j){let V=W.ctx,U=0;for(let F=0;F<w.length;F++)if(w[F].color==="transparent"){U=F;break}V.lineWidth=2,V.setLineDash(E);for(let F=1;F<w.length;F++){const M=w[F];let H;U>=F&&F>0?H=(0,c.A)(j.visualization.getColorByName(w[F-1].color)):H=(0,c.A)(j.visualization.getColorByName(M.color)),H.getAlpha()===1&&H.setAlpha(.7);const _=W.scales.x.ori===s.Lt.Horizontal,Z=W.valToPos(M.value,N,!0);let ne=Math.round(_?W.bbox.left:Z),te=Math.round(_?Z:W.bbox.top),Y=Math.round(_?W.bbox.left+W.bbox.width:Z),Q=Math.round(_?Z:W.bbox.top+W.bbox.height);V.beginPath(),V.moveTo(ne,te),V.lineTo(Y,Q),V.strokeStyle=H.toString(),V.stroke()}}function C(W,N,w,j){let V=W.ctx,U=(0,i.Z8)(W,N,w.map(F=>{let M=(0,c.A)(j.visualization.getColorByName(F.color));return M.getAlpha()===1&&M.setAlpha(.15),[F.value,M.toString()]}),!0);V.fillStyle=U,V.fillRect(W.bbox.left,W.bbox.top,W.bbox.width,W.bbox.height)}const{scaleKey:S,thresholds:O,theme:I,config:R,hardMin:T,hardMax:L,softMin:K,softMax:A}=b;return W=>{const N=W.ctx,{min:w,max:j}=W.scales.x,{min:V,max:U}=W.scales[S];if(w==null||j==null||V==null||U==null)return;let{steps:F,mode:M}=O;if(M===y.O.Percentage){let[H,_]=(0,i.EJ)(W,S,T,L,K,A),Z=_-H;F=F.map(ne=>({...ne,value:H+Z*(ne.value/100)}))}switch(N.save(),R.mode){case s.Ly.Line:case s.Ly.Dashed:v(W,S,F,I);break;case s.Ly.Area:C(W,S,F,I);break;case s.Ly.LineAndArea:case s.Ly.DashedAndArea:C(W,S,F,I),v(W,S,F,I)}N.restore()}}const d={drag:{setScale:!1},points:{size:(b,E)=>b.series[E].points.size*2,width:(b,E,v)=>v/4},focus:{prox:30}};class D{constructor(E=r.lE){this.uid=Math.random().toString(36).slice(2),this.series=[],this.axes={},this.scales=[],this.bands=[],this.stackingGroups=[],this.hasLeftAxis=!1,this.hooks={},this.tz=void 0,this.mode=1,this.frames=void 0,this.thresholds={},this.padding=void 0,this.prepData=void 0,this.scaleKeys=["",""],this.tzDate=v=>{let C=new Date(v);return this.tz?n.A.tzDate(C,this.tz):C},this.tz=(0,o.QZ)(E,Date.now())?.ianaName}addHook(E,v){(0,m.uY)("UPlotConfigBuilder",!1,"addHook",E),this.hooks[E]||(this.hooks[E]=[]),this.hooks[E].push(v)}addThresholds(E){this.thresholds[E.scaleKey]||(this.thresholds[E.scaleKey]=E,this.addHook("drawClear",P(E)))}addAxis(E){E.placement=E.placement??s.vM.Auto,E.grid=E.grid??{};let v=E.scaleKey;if(v==="x"&&(v+=E.timeZone??""),this.axes[v]){this.axes[v].merge
155(E);return}E.placement===s.vM.Auto&&(E.placement=this.hasLeftAxis?s.vM.Right:s.vM.Left),E.placement===s.vM.Left&&(this.hasLeftAxis=!0),E.placement===s.vM.Hidden&&(E.grid.show=!1,E.size=0),this.axes[v]=new a.zH(E)}getAxisPlacement(E){return this.axes[E]?.props.placement??s.vM.Left}setCursor(E){this.cursor=(0,t.merge)({},this.cursor,E)}setMode(E){this.mode=E}setSelect(E){this.select=E}addSeries(E){this.series.push(new x(E))}getSeries(){return this.series}addScale(E){const v=this.scales.find(C=>C.props.scaleKey===E.scaleKey);if(v){v.merge(E);return}this.scales.push(new l.G(E))}addBand(E){this.bands.push(E)}setStackingGroups(E){this.stackingGroups=E}getStackingGroups(){return this.stackingGroups}setPrepData(E){this.prepData=v=>(this.frames=v,E(v,this.getStackingGroups()))}setPadding(E){this.padding=E}getConfig(){if(this.cachedConfig)return this.cachedConfig;const E={...m.NN,mode:this.mode,series:[this.mode===2?null:{value:()=>""}]};E.axes=this.ensureNonOverlappingAxes(Object.values(this.axes)).map(C=>C.getConfig()),E.series=[...E.series,...this.series.map(C=>C.getConfig())],E.scales=this.scales.reduce((C,S)=>({...C,...S.getConfig()}),{}),E.hooks=this.hooks,E.select=this.select;const v=(C="")=>(S,O)=>{let I=S.series[O].points._stroke;if(typeof I!="string"){let R=this.frames[0].fields[O];I=R.display(R.values[S.cursor.idxs[O]]).color}return I+C};return E.cursor=(0,t.merge)({},d,{points:{stroke:v("80"),fill:v()}},this.cursor),E.tzDate=this.tzDate,Array.isArray(this.padding)&&(E.padding=this.padding),this.stackingGroups.forEach(C=>{(0,m.Tz)(C).forEach(S=>{this.addBand(S)})}),this.bands.length&&(E.bands=this.bands),this.cachedConfig=E,E}ensureNonOverlappingAxes(E){const v=E.find(O=>O.props.scaleKey==="x"),C=E.filter(O=>O.props.grid?.show===void 0),S=C.findIndex(O=>O.props.placement===s.vM.Left||O.props.placement===s.vM.Right||O.props.placement===s.vM.Bottom&&O!==v);for(let O=0;O<C.length;O++)C[O]===v||O===S?C[O].props.grid.show=!0:C[O].props.grid.show=!1;return E}}},42073:(ee,B,e)=>{"use strict";e.d(B,{G:()=>m,Y:()=>a});var t=e(36613),n=e(74261),r=e(55386),o=e(739),s=e(62748);class m extends s.R{merge(f){this.props.min=a("min",this.props.min,f.min),this.props.max=a("max",this.props.max,f.max)}getConfig(){let{isTime:f,scaleKey:h,min:u,max:i,softMin:x,softMax:g,range:p,direction:c,orientation:y,centeredZero:P,decimals:d,stackingMode:D}=this.props;D===o.gs.Percent&&(u==null&&x==null&&(x=0),i==null&&g==null&&(g=1));const b=this.props.distribution,E=f?{}:{distr:b===o.L4.Symlog?4:b===o.L4.Log?3:b===o.L4.Ordinal?2:1,log:b===o.L4.Log||b===o.L4.Symlog?this.props.log??2:void 0,asinh:b===o.L4.Symlog?this.props.linearThreshold??1:void 0};if(b===o.L4.Log){let K=this.props.log,A=K===2?Math.log2:Math.log10;u!=null&&(u<=0?u=null:u=K**Math.floor(A(u))),i!=null&&(i<=0?i=null:i=K**Math.ceil(A(i))),x!=null&&(x<=0?x=null:x=K**Math.floor(A(x))),g!=null&&(g<=0?g=null:g=K**Math.ceil(A(g)))}let v=x==null?3:1,C=g==null?3:1;const S={min:{pad:.1,hard:u??-1/0,soft:x||0,mode:v},max:{pad:.1,hard:i??1/0,soft:g||0,mode:C}};let O=x==null&&u!=null,I=g==null&&i!=null,R=O&&I;const T=(K,A,W,N)=>{const w=K.scales[N];let j=[A,W];if(!R&&A==null&&W==null)return j;let V=w.log??10;if(w.distr===1||w.distr===2||w.distr===4){if(P){let U=Math.abs(A),F=Math.abs(W),M=Math.max(U,F);M===0&&(M=80),A=-M,W=M}w.distr===4?j=t.A.rangeAsinh(A,W,V,!0):j=t.A.rangeNum(O?u:A,I?i:W,S)}else w.distr===3&&(j=t.A.rangeLog(u??A,i??W,V,!0));if(d===0)if(w.distr===1||w.distr===2)j[0]=(0,n.rs)(j[0],1),j[1]=(0,n.Uh)(j[1],1);else if(w.distr===3){let U=w.log===2?Math.log2:Math.log10;if(j[0]<=1)j[0]=1;else{let M=Math.floor(U(j[0]));j[0]=V**M}let F=Math.ceil(U(j[1]));j[1]=V**F,j[0]===j[1]&&(j[1]*=V)}else w.distr===4&&(j[0]=(0,n.rs)(j[0],1),j[1]=(0,n.Uh)(j[1],1));return(w.distr===1||w.distr===4)&&(O&&(j[0]=u),I&&(j[1]=i)),j[0]>=j[1]&&(j[0]=w.distr===3?1:0,j[1]=100),j};let L=!f&&!R;return(0,r.j9)(h)&&(L=!1,p=[0,1]),{[h]:{time:f,auto:L,range:p??T,dir:c,ori:y,...E}}}}function a(l,f,h){const u=f!=null,i=h!=null;return u?i?l==="min"?f<h?f:h:f>h?f:h:f:h}},66650:(ee,B,e)=>{"use strict";e.d(B,{B5:()=>f,EJ:()=>x,WO:()=>l,Z8:()=>u,pl:()=>p});var t=e(84140),n=e(6773),r=e(64394),o=e(33553),s=e(739),m=e(53568);function a(c,y,P){let d=0,D=0,b=0,E=0;return c===3?(D=y.top,E=y.top+y.height):c===2?(d=y.left+y.width,b=y.left):c===1?(D=y.top+y.height,E=y.top):c===0&&(
155d=y.left,b=y.left+y.width),P.createLinearGradient(d,D,b,E)}function l(c,y){return(P,d)=>{const D=(0,m.Yc)(),b=a(P.scales.x.ori===s.Lt.Horizontal?3:2,P.bbox,D);return b.addColorStop(0,n.MV.alpha(c,y)),b.addColorStop(1,n.MV.alpha(c,0)),b}}function f(c,y,P){return(d,D)=>{const b=(0,m.Yc)(),E=a(d.scales.x.ori===s.Lt.Horizontal?3:2,d.bbox,b),v=(0,t.A)(c).spin(-25).darken(5),C=(0,t.A)(c).saturate(20).spin(20).brighten(10);return P.isDark?(E.addColorStop(0,C.lighten(10).setAlpha(y).toString()),E.addColorStop(1,v.darken(10).setAlpha(y).toString())):(E.addColorStop(0,C.lighten(10).setAlpha(y).toString()),E.addColorStop(1,v.setAlpha(y).toString())),E}}var h=(c=>(c[c.Right=0]="Right",c[c.Up=1]="Up",c[c.Left=2]="Left",c[c.Down=3]="Down",c))(h||{});function u(c,y,P,d=!1){let D=c.scales[y],b=null,E=null;for(let w=0;w<P.length;w++){let j=P[w][0];if((j<=D.min||b==null)&&(b=w),E=w,j>=D.max)break}if(b===E)return P[b][1];let v=P[b][0],C=P[E][0];v===-1/0&&(v=D.min),C===1/0&&(C=D.max);let S=Math.round(c.valToPos(v,y,!0)),O=Math.round(c.valToPos(C,y,!0)),I=S-O;if(I===0)return P[E][1];let R,T,L,K;c.scales.x.ori===s.Lt.Horizontal?(R=L=0,T=S,K=O):(T=K=0,R=S,L=O);let W=(0,m.Yc)().createLinearGradient(R,T,L,K),N;for(let w=b;w<=E;w++){let j=P[w],V=w===b?S:w===E?O:Math.round(c.valToPos(j[0],y,!0)),U=(S-V)/I;d&&w>b&&W.addColorStop(U,N),W.addColorStop(U,N=j[1])}return W}function i(c,y){let P=c.scales[y],d=1/0,D=-1/0;return c.series.forEach((b,E)=>{if(b.show&&b.scale===y)if(b.min==null){let v=c.data[E];for(let C=0;C<v.length;C++)v[C]!=null&&(d=Math.min(d,v[C]),D=Math.max(D,v[C]))}else d=Math.min(d,b.min),D=Math.max(D,b.max)}),D===d&&(d=P.min,D=P.max),[d,D]}function x(c,y,P,d,D,b){let E=P??D??null,v=d??b??null;if(E==null||v==null){let[C,S]=i(c,y);E=E??C??0,v=v??S??100}return[E,v]}function g(c){return c==="transparent"||c[0]==="#"&&c.slice(-2)==="00"}function p(c,y,P,d,D,b,E,v){if(!P)throw Error("Missing colorMode required for color scheme gradients");if(!d)throw Error("Missing thresholds required for color scheme gradients");return(C,S)=>{let O=C.series[S].scale,I="";if(P.id===r.Y.Thresholds)if(d.mode===o.O.Absolute){const R=d.steps.map(T=>[T.value,g(T.color)?"#0000":n.MV.alpha(y.visualization.getColorByName(T.color),c)]);I=u(C,O,R,!0)}else{const[R,T]=x(C,O,D,b,E,v),L=T-R,K=d.steps.map(A=>[R+L*(A.value/100),n.MV.alpha(y.visualization.getColorByName(A.color),c)]);I=u(C,O,K,!0)}else if(P.getColors){const R=P.getColors(y),[T,L]=x(C,O,D,b,E,v),K=L-T,A=R.map((W,N)=>[T+K*(N/(R.length-1)),n.MV.alpha(y.visualization.getColorByName(W),c)]);I=u(C,O,A,!1)}return I}}},7515:(ee,B,e)=>{"use strict";e.d(B,{a:()=>m});var t=e(74848),n=e(96540),r=e(1604),o=e(73858),s=e(16477);function m({id:a,events:l,renderEventMarker:f,mapEventToXYCoords:h,config:u}){const i=(0,n.useRef)(),[x,g]=(0,n.useState)(0),p=(0,r.A)();(0,n.useLayoutEffect)(()=>{u.addHook("init",y=>{i.current=y}),u.addHook("draw",()=>{p()&&g(y=>y+1)})},[u,g]);const c=(0,n.useMemo)(()=>{const y=[];if(!i.current||l.length===0)return y;for(let P=0;P<l.length;P++){const d=l[P];for(let D=0;D<d.length;D++){const b=h(d,{fieldIndex:D,frameIndex:P});b&&y.push((0,n.createElement)(o.p,{...b,key:`${a}-marker-${P}-${D}`},f(d,{fieldIndex:D,frameIndex:P})))}}return(0,t.jsx)(t.Fragment,{children:y})},[l,f,x]);return i.current?(0,t.jsx)(s._,{left:i.current.bbox.left/window.devicePixelRatio,top:i.current.bbox.top/window.devicePixelRatio,children:c}):null}},73858:(ee,B,e)=>{"use strict";e.d(B,{p:()=>n});var t=e(74848);const n=({x:r,y:o,children:s})=>(0,t.jsx)("div",{style:{position:"absolute",top:`${o}px`,left:`${r}px`},children:s})},16477:(ee,B,e)=>{"use strict";e.d(B,{_:()=>o});var t=e(74848),n=e(22803),r=e(96540);const o=({children:s,left:m,top:a})=>{const l=(0,r.useMemo)(()=>(0,n.css)({position:"absolute",overflow:"visible",left:`${m}px`,top:`${a}px`}),[m,a]);return(0,t.jsx)("div",{className:l,children:s})}},70332:(ee,B,e)=>{"use strict";e.d(B,{M:()=>r});var t=e(739),n=e(62748);function r(s,m){const a="na",l=`${s.min!==void 0?s.min:a}-${s.max!==void 0?s.max:a}`,f=`${s.custom?.axisSoftMin!==void 0?s.custom.axisSoftMin:a}-${s.custom?.axisSoftMax!==void 0?s.custom.axisSoftMax:a}`,h=`${s.custom?.axisPlacement!==void 0?s.custom?.axisPlacement:t.vM.Auto}`,u=s.unit??n.s,i=s.custom?.scaleDistribution?o(s.custom.scaleDistribution):t.L4.Linear,x=s.custom?.axisLabel?s.custom.axisLabel:a;return`${u}/${l}/${f}/${h}/${i}/${x}/${m}`}function o(s){return s.type===t.L4.Log?`${s.type}${s.log}`:s.type}},84522:(ee,B,e)=>{"use strict";e.d(B,{J:()=>s});var t=e(74848),n=e(22803),r=e(76319),o=e(63142);const s=({onClick:a,"aria-label":l,style:f})=>{const h=(0,o.of)(m);return(0,t.jsx)(r.K,{"aria-label":l??"Close",className:h,name:"times",onClick:a,style:f})},m=a=>(0,n.css)({position:"absolute",margin:"0px",right:5,top:6})},18667:(ee,B,e)=>{"use strict";e.d(B,{K:()=>l});var t=e(2543),n=e.n(t),r=e(96540),o=e(64423),s=e(99165),m=e(57852),a=e(32899);const l=({config:f,eventBus:h,frame:u})=>{const i=(0,r.useRef)(u);return i.current=u,(0,r.useLayoutEffect)(()=>{let x=null;const g={point:{time:null},data:i.current};f.addHook("init",E=>{x=E});let p=null;f.addHook("setSeries",(E,v)=>{p=v}),f.addHook("setLegend",()=>{if(!(x.cursor.event==null)){let v=x.cursor.idxs.find(C=>C!=null);if(v==null)b();else{let C=v,S=p,O=x.data[0]??x.data[1][0];g.point.time=O[C],g.rowIndex=C??void 0,g.columnIndex=S??void 0,g.data=i.current;let I=x.cursor.top;g.point.panelRelY=I===0?.001:I>0?I/x.rect.height:1,D()}}});function c(E){const v=E.payload?.point?.time;if(v){const C=x.valToPos(v,"x");x.setCursor({left:C,top:x.rect.height/2})}}const y=new o.yU,P=new m.b_(g).setTags(["uplot"]),d=new m.ql().setTags(["uplot"]);let D=(0,t.throttle)(()=>{h.publish(P)},100),b=(0,t.throttle)(()=>{h.publish(d)},100);return y.add(h.getStream(m.b_).subscribe({next:E=>{h===E.origin||E.tags?.has("uplot")||c(E)}})),y.add(h.getStream(a.kb).subscribe({next:E=>c(E)})),y.add(h.getStream(m.ql).pipe((0,s.c)(50)).subscribe({next:E=>{h===E.origin||E.tags?.has("uplot")||x.cursor._lock||x.setCursor({left:-10,top:-10}
155)}})),()=>{y.unsubscribe()}},[f]),null}},93630:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>l});var t=e(2543),n=e.n(t),r=e(96540);const o=.1,s=2,m=new Set(["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Shift"," "]),a=f=>{let h=f.root,u=new Set,i=null,x=null;if(!h)return;h.tabIndex=0;const g=(b,E)=>{const{cursor:v}=f;if(v.left===void 0||v.top===void 0)return;const{width:C,height:S}=f.over.style,[O,I]=[Math.floor(parseFloat(C)),Math.floor(parseFloat(S))];f.setCursor({left:(0,t.clamp)(v.left+b,0,O),top:(0,t.clamp)(v.top+E,0,I)})},p=b=>{if(u.size===0||!f){x=null;return}const C=(b-(x??b))*o;let S=0,O=0;u.has("ArrowUp")&&(O-=C),u.has("ArrowDown")&&(O+=C),u.has("ArrowLeft")&&(S-=C),u.has("ArrowRight")&&(S+=C),u.has("Shift")&&(S*=s,O*=s),g(S,O);const{cursor:I}=f;if(u.has(" ")&&I){const R=Number(f.over.style.height.slice(0,-2));f.setSelect({left:I.left<i?I.left:i,top:0,width:Math.abs(I.left-(i??I.left)),height:R},!1)}x=b,window.requestAnimationFrame(p)},c=b=>{if(b.key==="Tab"){f.setCursor({left:-5,top:-5});return}if(!m.has(b.key))return;if(b.preventDefault(),b.stopPropagation(),!u.has(b.key)){const v=u.size===0;u.add(b.key),i=b.key===" "&&i===null?f.cursor.left:i,v&&window.requestAnimationFrame(p)}},y=b=>{m.has(b.key)&&(u.delete(b.key),b.key===" "&&(b.preventDefault(),b.stopPropagation(),f.setSelect(f.select),i=null))},P=()=>{if(!h?.matches(":focus-visible"))return;const b=parseFloat(f.over.style.width),E=parseFloat(f.over.style.height);f.setCursor({left:b/2,top:E/2})},d=()=>{x=null,i=null,u.clear(),f.setSelect({left:0,top:0,width:0,height:0},!1)};h.addEventListener("keydown",c),h.addEventListener("keyup",y),h.addEventListener("focus",P),h.addEventListener("blur",d);const D=()=>{h?.removeEventListener("keydown",c),h?.removeEventListener("keyup",y),h?.removeEventListener("focus",P),h?.removeEventListener("blur",d),h=null};(f.hooks.destroy??=[]).push(D)},l=({config:f})=>((0,r.useLayoutEffect)(()=>f.addHook("init",a),[f]),null)},69234:(ee,B,e)=>{"use strict";e.d(B,{b3:()=>u,xl:()=>P});var t=e(74848),n=e(22803),r=e(96540),o=e(40961),s=e(21275),m=e(63142),a=e(15245),l=e(84522);const f=void 0,h=10;var u=(D=>(D[D.xOne=0]="xOne",D[D.xAll=1]="xAll",D[D.xyOne=2]="xyOne",D))(u||{});function i(D,b){return{...D,...b,style:{...D.style,...b.style}}}function x(){return{style:{transform:"",pointerEvents:"none"},isHovering:!1,isPinned:!1,contents:null,plot:null,dismiss:()=>{}}}const g=5,p=D=>D!=null&&!D.ctrlKey&&!D.metaKey,c=()=>[],y=/Android|iPhone|iPad/i.test(navigator.userAgent),P=({config:D,hoverMode:b,render:E,clientZoom:v=!1,queryZoom:C,onSelectRange:S,maxWidth:O,syncMode:I=s.yV.Off,syncScope:R="global",getDataLinks:T=c})=>{const L=(0,r.useRef)(null),K=(0,r.useRef)(null);K.current==null&&(K.current=(0,a.gF)());const[{plot:A,isHovering:W,isPinned:N,contents:w,style:j,dismiss:V},U]=(0,r.useReducer)(i,null,x),F=(0,r.useRef)(),M=(0,m.of)(d,O),H=(0,r.useRef)(E);H.current=E;const _=(0,r.useRef)(T);return _.current=T,(0,r.useLayoutEffect)(()=>{F.current={width:0,height:0,observer:new ResizeObserver(je=>{let ze=F.current;for(const Ye of je)Ye.borderBoxSize?.length>0?(ze.width=Ye.borderBoxSize[0].inlineSize,ze.height=Ye.borderBoxSize[0].blockSize):(ze.width=Ye.contentRect.width,ze.height=Ye.contentRect.height)})};let Z=!1,ne=!1,te=A,Y=W,Q=!1,J=N,q=j,X=!1;const se=I===s.yV.Tooltip;I!==s.yV.Off&&D.scales[0].props.isTime&&D.setCursor({sync:{key:R,scales:["x",null]}});const oe=()=>{le?Y=X&&Q&&se:Y=de!=null||b===1&&Q};let ae=0,ie=0,fe=null,pe=[],de=null,le=!1,me=[],De=[],Te=!1,Ne=!1;const Ce=(je=!1)=>{Te||(Y?queueMicrotask(ke):setTimeout(ke,100),Te=!0),je&&(Ne=!0)},He=je=>{L.current.contains(je.target)||Me()},ke=()=>{Te=!1,Ne&&(q={pointerEvents:J?"all":"none"},te.cursor._lock=J,J?(document.addEventListener("mousedown",He,!0),document.addEventListener("keydown",He,!0)):(document.removeEventListener("mousedown",He,!0),document.removeEventListener("keydown",He,!0)),Ne=!1);let je={style:q,isPinned:J,isHovering:Y,contents:Y||fe!=null?H.current(te,pe,de,J,Me,fe,le,J?me:de!=null?De[de]:[]):null,dismiss:Me};U(je),fe=null},Me=()=>{let je=J;J=!1,Y=!1,te.setCursor({left:-10,top:-10}
155),me=[],Ce(je)};D.addHook("init",je=>{U({plot:te=je}),v&&je.over.addEventListener("mousedown",ze=>{if(p(ze)&&ze.button===0&&ze.shiftKey){ne=!0,je.cursor.drag.x=!1,je.cursor.drag.y=!0;let Ye=Ge=>{je.cursor.drag.x=!0,je.cursor.drag.y=!1,document.removeEventListener("mouseup",Ye,!0)};document.addEventListener("mouseup",Ye,!0)}},!0),je.over.addEventListener("click",ze=>{if(ze.target===je.over){if(ze.ctrlKey||ze.metaKey){let Ye;je.scales.x.ori===0?Ye=je.posToVal(je.cursor.left,"x"):Ye=je.posToVal(je.select.top+je.select.height,"x"),fe={from:Ye,to:Ye},Ce(!1)}else if(Y&&!J&&de!=null){me=_.current(de,pe[de]);const Ye=me.find(Ge=>Ge.oneClick===!0);Ye!=null?window.open(Ye.href,Ye.target??"_self"):setTimeout(()=>{J=!0,Ce(!0)},0)}}})}),D.addHook("setSelect",je=>{const ze=je.scales.x.ori===0;if(!le&&(v||C!=null))if(p(je.cursor.event)){if(S!=null){let Ye=[];const Ge=!!je.cursor.drag.y,ce=!!je.cursor.drag.x;let Pe=null,Se=[];ce&&(Pe={from:ze?je.posToVal(je.select.left,"x"):je.posToVal(je.select.top+je.select.height,"x"),to:ze?je.posToVal(je.select.left+je.select.width,"x"):je.posToVal(je.select.top,"x")}),Ge&&D.scales.forEach(Ee=>{const xe=Ee.props.scaleKey;if(xe!=="x"){let ye={from:ze?je.posToVal(je.select.top+je.select.height,xe):je.posToVal(je.select.left+je.select.width,xe),to:ze?je.posToVal(je.select.top,xe):je.posToVal(je.select.left,xe)};Se.push(ye)}}),ce?Ge?Ye=Se.map(Ee=>({x:Pe,y:Ee})):Ye=[{x:Pe}]:Ge&&(Ye=Se.map(Ee=>({y:Ee}))),S(Ye)}else if(v&&ne){if(je.select.height>=g){for(let Ye in je.scales)if(Ye!=="x"){const Ge=ze?je.posToVal(je.select.top,Ye):je.posToVal(je.select.left+je.select.width,Ye),ce=ze?je.posToVal(je.select.top+je.select.height,Ye):je.posToVal(je.select.left,Ye);je.setScale(Ye,{min:ce,max:Ge})}Z=!0}ne=!1}else if(C!=null&&je.select.width>=g){const Ye=ze?je.posToVal(je.select.left,"x"):je.posToVal(je.select.top+je.select.height,"x"),Ge=ze?je.posToVal(je.select.left+je.select.width,"x"):je.posToVal(je.select.top,"x");C({from:Ye,to:Ge}),Z=!1}}else fe={from:ze?je.posToVal(je.select.left,"x"):je.posToVal(je.select.top+je.select.height,"x"),to:ze?je.posToVal(je.select.left+je.select.width,"x"):je.posToVal(je.select.top,"x")},Ce(!0);je.setSelect({left:0,width:0,top:0,height:0},!1)}),(v||C!=null)&&D.setCursor({bind:{dblclick:je=>()=>{if(!p(je.cursor.event))return null;if(v&&Z){for(let ze in je.scales)ze!=="x"&&je.setScale(ze,{min:null,max:null});Z=!1}else if(C!=null){let ze=je.scales.x;const Ye=ze.min,Ge=ze.max,ce=(Ge-Ye)/2;C({from:Ye-ce,to:Ge+ce})}return null}}}),D.addHook("setData",je=>{Z=!1,ne=!1,J&&Me()}),D.addHook("setSeries",(je,ze)=>{de=ze,le=je.cursor.event==null,oe(),Ce()}),D.addHook("setLegend",je=>{pe=te?.cursor.idxs.slice(),Q=pe.some((Ye,Ge)=>Ge>0&&Ye!=null),De.length===0&&(De=pe.map((Ye,Ge)=>{if(Ge>0){const Pe=T(Ge,pe[Ge]).find(Se=>Se.oneClick===!0);if(Pe)return[Pe]}return[]})),le=je.cursor.event==null;let ze=Y;oe(),(Y||Y!==ze)&&Ce()});const $e=16;let tt=0,Ke=0;const Re=()=>{Y&&!J&&Me(),tt=window.innerWidth-$e,Ke=window.innerHeight-$e},Ve=()=>{X=te.rect.bottom<=Ke&&te.rect.top>=0&&te.rect.left>=0&&te.rect.right<=tt};Re(),D.addHook("ready",Ve),D.addHook("setCursor",je=>{if(le=je.cursor.event==null,!Y)return;let{left:ze=-10,top:Ye=-10}=je.cursor;if(ze>=0||Ye>=0){let Ge=je.rect.left+ze,ce=je.rect.top+Ye,Pe="",{width:Se,height:Ee}=F.current;Se+=h,Ee+=h,ie!==0?ce+Ee<Ke||ce-Ee<0?ie=0:ie!==-Ee&&(ie=-Ee):ce+Ee>Ke&&ce-Ee>=0&&(ie=-Ee),ae!==0?Ge+Se<tt||Ge-Se<0?ae=0:ae!==-Se&&(ae=-Se):Ge+Se>tt&&Ge-Se>=0&&(ae=-Se);const xe=Ge+(ae===0?h:-h),ye=ce+(ie===0?h:-h);Pe=`translateX(${xe}px) ${ae===0?"":"translateX(-100%)"} translateY(${ye}px) ${ie===0?"":"translateY(-100%)"}`,L.current!=null?L.current.style.transform=Pe:(q.transform=Pe,Ce())}});const Qe=je=>{Ve(),Y&&je.target instanceof Node&&je.target.contains(te.root)&&Me()};return window.addEventListener("resize",Re),window.addEventListener("scroll",Qe,!0),()=>{window.removeEventListener("resize",Re),window.removeEventListener("scroll",Qe,!0),document.removeEventListener("mousedown",He,!0),document.removeEventListener("keydown",He,!0)}},[D]),(0,r.useLayoutEffect)(()=>{const Z=F.current;if(L.current!=null){Z.observer.observe(L.current);const{width:ne,height:te}=L.current.getBoundingClientRect();Z.width=ne,Z.height=te;let Y=A.cursor.event;if(Y!=null){const Q=Y.type!=="mousemove"||y;Q&&(Y=new MouseEvent("mousemove",{view:window,bubbles:!0,cancelable:!0,clientX:Y.clientX,clientY:Y.clientY,screenX:Y.screenX,screenY:Y.screenY})),!(Q?!1:performance.now()-Y.timeStamp>16)&&A.over.dispatchEvent(Y)}
155else A.setCursor({left:A.cursor.left,top:A.cursor.top},!0)}else Z.width=0,Z.height=0},[W]),A&&W?(0,o.createPortal)((0,t.jsxs)("div",{className:(0,n.cx)(M.tooltipWrapper,N&&M.pinned),style:j,"aria-live":"polite","aria-atomic":"true",ref:L,children:[N&&(0,t.jsx)(l.J,{onClick:V}),w]}),K.current):null},d=(D,b)=>({tooltipWrapper:(0,n.css)({top:0,left:0,zIndex:D.zIndex.portal,whiteSpace:"pre",borderRadius:D.shape.radius.default,position:"fixed",background:D.colors.background.elevated,border:`1px solid ${D.colors.border.weak}`,boxShadow:D.shadows.z2,userSelect:"text",maxWidth:b??"none"}),pinned:(0,n.css)({boxShadow:D.shadows.z3})})},62748:(ee,B,e)=>{"use strict";e.d(B,{R:()=>n,s:()=>t});const t="__fixed";class n{constructor(o){this.props=o}}},36192:(ee,B,e)=>{"use strict";e.d(B,{NN:()=>h,Tz:()=>i,UO:()=>P,bq:()=>g,ro:()=>x,sw:()=>p,uY:()=>D});var t=e(95004),n=e(406),r=e(46644),o=e(11576),s=e(739),m=e(20720),a=e(60379),l=e(70332);const f=(b,E,v)=>{let C=E%2?v[0]||v[2]:v[1]||v[3];return v[E]||!C?0:8},h={ms:1,focus:{alpha:1},cursor:{focus:{prox:30}},legend:{show:!1},padding:[f,f,f,f],series:[],hooks:{}};var u=(b=>(b[b.Pos=1]="Pos",b[b.Neg=-1]="Neg",b))(u||{});function i(b){let E=[],{series:v,dir:C}=b,S=v.length-1,O=v.slice().reverse();return O.forEach((I,R)=>{if(R!==S){let T=O[R+1];E.push({series:[I,T],dir:-1*C})}}),E}function x(b){let E=new Map;return b.fields.forEach(({config:v,values:C,type:S},O)=>{if(O===0)return;let{custom:I}=v;if(I==null||I.hideFrom?.viz)return;let{stacking:R}=I;if(R==null)return;let{mode:T,group:L}=R;if(T===s.gs.None)return;let K=I.transform,A=c(K,C),W=I.drawStyle,N=W===s.GR.Bars?I.barAlignment:W===s.GR.Line?I.lineInterpolation:null,w=`${A}|${T}|${L}|${(0,l.M)(v,S)}|${W}|${N}`,j=E.get(w);j==null&&(j={series:[],dir:A},E.set(w,j)),j.series.push(O)}),[...E.values()]}function g(b,E,v){let C=Array(b.fields.length),S=E.length,O=b.length,I=S>0?Array(O).fill(0):[],R=S>0?Array(O).fill(!1):[],T=Array.from({length:S},()=>I.slice()),L=Array.from({length:S},()=>R.slice());if(E.forEach((K,A)=>{let W=L[A];K.series.forEach(N=>{let w=b.fields[N];if(w.config.custom?.hideFrom?.viz)return;let j=w.values;for(let V=0;V<O;V++)j[V]!=null&&(W[V]=!0)})}),b.fields.forEach((K,A)=>{let W=K.values;if(A===0){K.type===t.PU.time?C[0]=(0,n.ks)(K).values:C[0]=W;return}let{custom:N}=K.config;if(!N||N.hideFrom?.viz){C[A]=W;return}if(N.transform===s.NU.Constant){let j=W.findIndex(U=>U!=null),V=W[j];W=Array(W.length).fill(void 0),W[j]=V}else if(W=W.slice(),N.transform===s.NU.NegativeY)for(let j=0;j<W.length;j++)W[j]!=null&&(W[j]*=-1);let w=N.stacking?.mode;if(!w||w===s.gs.None)C[A]=W;else{let j=E.findIndex(M=>M.series.indexOf(A)>-1),V=T[j],U=L[j],F=C[A]=Array(O);for(let M=0;M<O;M++){let H=W[M];H!=null?F[M]=V[M]+=H:F[M]=U[M]?V[M]:H}}}),v){let K=C.map((A,W)=>{let N=E.findIndex(w=>w.series.indexOf(W)>-1);return N!==-1?T[N]:A});v({totals:K})}return b.fields.forEach((K,A)=>{if(A===0||K.config.custom?.hideFrom?.viz)return;if(K.config.custom?.stacking?.mode===s.gs.Percent){let N=E.findIndex(U=>U.series.indexOf(A)>-1),w=T[N],j=E[N],V=C[A];for(let U=0;U<O;U++){let F=V[U];F!=null&&(V[U]=w[U]===0?0:j.dir*(F/w[U]))}}}),C}function p(b,E){let v,C=1,S=1,O=b.data[1][E],I=b.data[1][E];for(let R=1;R<b.data.length;R++){const L=b.data[R][E];L!=null&&(O==null?O=L:L>O&&(O=b.data[R][E],C=R),I==null?I=L:L<I&&(I=b.data[R][E],S=R))}return I==null&&O==null?v=void 0:I!=null&&O!=null?v=(b.valToPos(I,b.series[S].scale)+b.valToPos(O,b.series[C].scale))/2:v=b.valToPos(I||O,b.series[C||S].scale),v!==void 0&&v<0&&(v=b.bbox.height/devicePixelRatio),v}function c(b,E){const v=y(E);return b===s.NU.NegativeY?v?1:-1:v?-1:1}function y(b,E=100){const v=b.length;if(v===0)return!1;let C=0,S=v-1;for(;C<=S&&b[C]==null;)C++;for(;S>=C&&b[S]==null;)S--;let O=0,I=0;if(S>=C){const R=Math.max(1,Math.floor((S-C+1)/E));for(let T=C;T<=S;T+=R){const L=b[T];L!=null&&typeof L=="number"&&(L<0||Object.is(L,-0)?O++:L>0&&I++)}if(O>I)return!0}return!1}const P=(b,E,v)=>{if(!b?.length)return[];const C=R=>R==null?"-":R.toFixed(1),S=E.display??C;let O=null;const I=(0,r.Nw)({field:E,reducers:b});return b.map(R=>{const T=r.AS.get(R);let L=S;return T.id===r.gy.diffperc&&(L=(0,o.J)({field:{...E,config:{...E.config,unit:"percent"}},theme:v})),(T.id===r.gy.count||T.id===r.gy.changeCount||T.id===r.gy.distinctCount)&&(O||(O=(0,o.J)({field:{...E,config:{...E.config,unit:"none"}},theme:v})),L=O),{...L(I[R]),title:T.name,description:T.description}})},d=(0,a.h)("uPlot"),D=d.logger;(0,m.h)("graphng",void 0,d)},26527:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{ALERTING_COLOR:()=>o.xj,Alert:()=>t.FcD,AlertingSettings:()=>t.ibS,AsyncMultiSelect:()=>t.Ivu,AsyncSelect:()=>t.DWK,AsyncVirtualizedSelect:()=>t.gZN,AutoSaveField:()=>t.p0K,AutoSizeInput:()=>t.Dd_,Avatar:()=>t.euF,AxisPlacement:()=>l.vM,Badge:()=>t.Exy,BarAlignment:()=>l.Nj,BarGauge:()=>t.xEy,BarGaugeDisplayMode:()=>t.eX$,BarValueVisibility:()=>l.TC,BigValue:()=>t.yVm,BigValueColorMode:()=>t.ypG,BigValueGraphMode:()=>
155t.$p8,BigValueJustifyMode:()=>t.F8C,BigValueTextMode:()=>t.SV3,Box:()=>t.azJ,BracesPlugin:()=>a.e1,BrowserLabel:()=>t.jQM,Button:()=>t.$nd,ButtonCascader:()=>t.HRi,ButtonGroup:()=>t.e2v,ButtonSelect:()=>t.fHW,CallToActionCard:()=>t.cbd,Card:()=>t.ZpM,CardContainer:()=>t.Q_j,Carousel:()=>t.FNf,Cascader:()=>t.vxQ,CertificationKey:()=>t.KmA,Checkbox:()=>t.Sc0,ClearPlugin:()=>a.vJ,ClickOutsideWrapper:()=>t.NqN,ClipboardButton:()=>t.bLJ,ClipboardPlugin:()=>a.sW,CodeEditor:()=>t.BYM,CodeEditorSuggestionItemKind:()=>t.q0m,CollapsableSection:()=>t.MU_,Collapse:()=>t.SDm,ColorPicker:()=>t.skP,ColorPickerInput:()=>t.itl,Combobox:()=>t.G3_,ConfirmButton:()=>t.ZFl,ConfirmModal:()=>t.uoB,Container:()=>t.mcf,ContextMenu:()=>t.tzH,ControlledCollapse:()=>t.a2C,Counter:()=>t.phK,CustomHeadersSettings:()=>t.Pli,CustomScrollbar:()=>t.EZm,DEFAULT_ANNOTATION_COLOR:()=>o.Mk,DOMUtil:()=>o.bk,DataLinkButton:()=>t.Rsn,DataLinkInput:()=>t.lZ_,DataLinksContextMenu:()=>t.ebG,DataLinksInlineEditor:()=>t.eHD,DataLinksInlineEditorBase:()=>t.Jb3,DataSourceHttpSettings:()=>t.tco,DatePicker:()=>t.lrV,DatePickerWithInput:()=>t.lS2,DateTimePicker:()=>t.K7n,DeleteButton:()=>t.etH,Divider:()=>t.cGx,DrawStyle:()=>l.yg,Drawer:()=>t._s,Dropdown:()=>t.msM,ElementSelectionContext:()=>t._V2,EmptySearchResult:()=>t.Z7I,EmptyState:()=>t.ppr,ErrorBoundary:()=>t.tHk,ErrorBoundaryAlert:()=>t.XwR,ErrorWithStack:()=>t.DaU,EventBusPlugin:()=>t.Kur,EventsCanvas:()=>t.aaz,EventsWithValidation:()=>o.Pw,FIXED_UNIT:()=>t.sN5,FadeTransition:()=>t.AVJ,FeatureBadge:()=>t.yKR,FeatureInfoBox:()=>t.ep7,Field:()=>t.D0$,FieldArray:()=>t.ED_,FieldLinkList:()=>t.nA8,FieldSet:()=>t.nVY,FieldValidationMessage:()=>t.PgM,FileDropzone:()=>t.gHy,FileDropzoneDefaultChildren:()=>t.wIj,FileListItem:()=>t.IBq,FileUpload:()=>t.ef9,FilterInput:()=>t.ZYI,FilterPill:()=>t.mKT,Form:()=>t.lVW,FormattedValueDisplay:()=>t.i7I,FullWidthButtonContainer:()=>t.Vpd,Gauge:()=>t._I2,GlobalStyles:()=>s.kH,Graph:()=>t.TS0,GraphContextMenu:()=>t.Hdp,GraphContextMenuHeader:()=>t.io8,GraphGradientMode:()=>l.on,GraphNG:()=>t.ovZ,GraphSeriesToggler:()=>t.MTY,GraphThresholdsStyleMode:()=>l.Ly,GraphWithLegend:()=>t.IK5,Grid:()=>t.xA9,HorizontalGroup:()=>t.GyY,Icon:()=>t.Int,IconButton:()=>t.K0,IndentationPlugin:()=>a.TA,InfoBox:()=>t.w4Q,InlineField:()=>t.IP5,InlineFieldRow:()=>t.CeB,InlineFormLabel:()=>t.IjS,InlineLabel:()=>t.c2B,InlineSegmentGroup:()=>t.e8d,InlineSwitch:()=>t.KYK,InlineToast:()=>t.r0T,Input:()=>t.pde,InputControl:()=>t.eyo,InteractiveTable:()=>t.jDF,JSONFormatter:()=>t.BJ$,JsonExplorer:()=>t.OoN,KeyboardPlugin:()=>t.Z7z,Label:()=>t.JU7,LegacyForms:()=>t.rRI,LegacyInputStatus:()=>t.OYG,Legend:()=>t.s$2,LegendDisplayMode:()=>l.lm,LineInterpolation:()=>l.dx,Link:()=>t.N_E,LinkButton:()=>t.z9$,List:()=>t.B8B,LoadingBar:()=>t.GmG,LoadingPlaceholder:()=>t._ae,Marker:()=>t.pH9,Menu:()=>t.W1t,MenuGroup:()=>t.rXV,MenuItem:()=>t.Drp,Modal:()=>t.aFV,ModalHeader:()=>t.rQ0,ModalRoot:()=>t.EOs,ModalTabContent:()=>t.OHP,ModalTabsHeader:()=>t.JXd,ModalsContext:()=>t.wEe,ModalsController:()=>t.$sz,ModalsProvider:()=>t.YO7,MultiCombobox:()=>t.fpH,MultiSelect:()=>t.KFt,NO_DATA_COLOR:()=>o.nO,NewlinePlugin:()=>a.Om,NodeGraphDataFrameFieldNames:()=>o.uc,OK_COLOR:()=>o.Xw,PENDING_COLOR:()=>o.ct,PageToolbar:()=>t.dAS,Pagination:()=>t.dKS,PanelChrome:()=>t.NRL,PanelChromeLoadingIndicator:()=>t.oQQ,PanelContainer:()=>t._wj,PanelContextProvider:()=>t.XFg,PanelContextRoot:()=>t.e4W,PlotLegend:()=>t.$sV,PluginSignatureBadge:()=>t.Bjr,PointVisibility:()=>l.nT,Popover:()=>t.AMh,PopoverController:()=>t.IE3,Portal:()=>t.ZLI,PortalContainer:()=>t.qB2,QueryField:()=>t.Xjo,REGION_FILL_ALPHA:()=>o.UJ,RadioButtonDot:()=>t.JBW,RadioButtonGroup:()=>t.zWQ,RadioButtonList:()=>t.a0s,RangeSlider:()=>t.F16,ReactMonacoEditor:()=>t.m3b,ReactUtils:()=>o.zt,RefreshPicker:()=>t.cCp,RelativeTimeRangePicker:()=>t.NBP,RenderUserContentAsHTML:()=>t.IUm,RunnerPlugin:()=>a.Ul,SCHEMA:()=>o.yx,ScaleDirection:()=>l.ON,ScaleDistribution:()=>t.L47,ScaleOrientation:()=>l.Lt,ScrollContainer:()=>t.PaW,SearchFunctionType:()=>o.Tt,SecretInput:()=>t.L44,SecretTextArea:()=>t.lpq,SecureSocksProxySettings:()=>t.YAX,Segment:()=>t.Y4n,SegmentAsync:()=>t.sYD,SegmentInput:()=>t.oyW,SegmentSection:()=>t.Lrm,SegmentSelect:()=>t.a$h,Select:()=>t.l6P,SelectContainer:()=>t.KAb,SelectMenuOptions:()=>t.o5c,SelectionShortcutsPlugin:()=>a.l9,SeriesColorPicker:()=>t.Dpi,SeriesColorPickerPopover:()=>t.o0L,SeriesColorPickerPopoverWithTheme:()=>t.tJM,SeriesIcon:()=>t.pMY,SeriesTable:()=>t.o95,SeriesTableRow:()=>t.gNl,SeriesVisibilityChangeBehavior:()=>t.KHN,SeriesVisibilityChangeMode:()=>t.Bd,SetInterval:()=>t.u3P,SlatePrism:()=>a.De,SlideOutTransition:()=>t.nfS,Slider:()=>t.Apm,Space:()=>t.$xS,Sparkline:()=>t.OW$,Spinner:()=>t.y$y,Stack:()=>t.BJc,StackingMode:()=>l.gs,StatsPicker:()=>t.SPA,SuggestionsPlugin:()=>a.Pz,Switch:()=>t.dOG,TLSAuthSettings:()=>t.jDu,Tab:()=>t.ozo,TabContent:()=>t.JSC,TabbedContainer:()=>t.qtX,Table:()=>
155t.XIK,TableCellDisplayMode:()=>l.ob,TableCellInspector:()=>t.sRj,TableCellInspectorMode:()=>t.Btl,TableInputCSV:()=>t.bwN,TabsBar:()=>t.U05,Tag:()=>t.vwO,TagList:()=>t.LYX,TagsInput:()=>t.um3,Text:()=>t.EYj,TextArea:()=>t.fs1,TextLink:()=>t.YqK,ThemeContext:()=>s.Dx,TimeOfDayPicker:()=>t.R3l,TimePickerTooltip:()=>t.xSz,TimeRangeInput:()=>t.bYj,TimeRangeLabel:()=>t.fD2,TimeRangePicker:()=>t.$64,TimeRangeProvider:()=>t.AjF,TimeSeries:()=>t.ZOC,TimeZonePicker:()=>t.U7r,ToggleAllState:()=>t.XNj,Toggletip:()=>t.Gff,ToolbarButton:()=>t.IBt,ToolbarButtonRow:()=>t.Uhs,Tooltip:()=>t.m_M,TooltipDisplayMode:()=>l.$N,TooltipPlugin:()=>t.TkQ,TooltipPlugin2:()=>t.xlH,UPLOT_AXIS_FONT_SIZE:()=>t.piP,UPlotChart:()=>t.ZCE,UPlotConfigBuilder:()=>t.eEE,UnitPicker:()=>t.pKo,UserIcon:()=>t.nys,UsersIndicator:()=>t.qeh,ValuePicker:()=>t.iyp,VerticalGroup:()=>t.gWJ,VerticalTab:()=>t.sMJ,VirtualizedSelect:()=>t.ipx,VizLayout:()=>t.KUk,VizLegend:()=>t.tZ2,VizLegendListItem:()=>t.MJh,VizRepeater:()=>t.SdN,VizTooltip:()=>t.nRt,VizTooltipContainer:()=>t.oNG,WeekStartPicker:()=>t.l69,WithContextMenu:()=>t.nuT,XYCanvas:()=>t._XZ,ZoomPlugin:()=>t.jnT,attachDebugger:()=>o.hF,buildScaleKey:()=>t.Myc,calculateFontSize:()=>o.Vr,clearButtonStyles:()=>t.myI,colors:()=>o.Tj,commonOptionsBuilder:()=>m.j,convertOldAngularValueMapping:()=>t.I1_,createLogger:()=>o.h,createPointerDistance:()=>o.b3,defaultIntervals:()=>t.cbf,fieldMatchersUI:()=>t.gso,fuzzyMatch:()=>o.It,getCanvasContext:()=>o.Yc,getCardStyles:()=>t.Hut,getCellLinks:()=>o.kl,getDragStyles:()=>t.lBN,getInputStyles:()=>t.na7,getPortalContainer:()=>t.gF8,getScrollbarWidth:()=>o.XJ,getSelectStyles:()=>t.Jq4,getTagColor:()=>o.yC,getTagColorIndexFromName:()=>o.JF,getTagColorsFromName:()=>o.MC,getTextColorForAlphaBackground:()=>o.mZ,getTextColorForBackground:()=>o.sg,getTheme:()=>s.O4,getWeekStart:()=>t.rLY,graphFieldOptions:()=>
155t.ti9,graphTickFormatter:()=>t.YnM,graphTimeFormat:()=>t.JcZ,hasValidationEvent:()=>o.K,isWeekStart:()=>t.rEW,linkModelToContextMenuItems:()=>o.Jl,logOptions:()=>o.DD,makeFragment:()=>o.dF,makeValue:()=>o.mO,measureText:()=>o.kD,mockTheme:()=>s.mG,mockThemeContext:()=>s.fq,preparePlotFrame:()=>t.mYT,regexValidation:()=>o.RP,resetSelectStyles:()=>t.aLN,sharedInputStyle:()=>t.Xb,sharedSingleStatMigrationHandler:()=>t._$q,sharedSingleStatPanelChangedHandler:()=>t.glJ,sortedColors:()=>o.Ih,styleMixins:()=>s.YF,stylesFactory:()=>s.N3,useElementSelection:()=>t.yff,useForceUpdate:()=>o.CH,useGraphNGContext:()=>t.IyU,usePanelContext:()=>t.d2s,usePointerDistance:()=>o.Ct,useSplitter:()=>t.hrX,useStyles:()=>s.IS,useStyles2:()=>s.of,useTheme:()=>s.DP,useTheme2:()=>s.$j,validate:()=>o.tf,variableSuggestionToCodeEditorSuggestion:()=>t.OOt,withErrorBoundary:()=>t.Xc0,withTheme:()=>s.SL,withTheme2:()=>s.cV});var t=e(71786),n=e(74527),r={};for(const f in n)["default","Alert","AlertingSettings","AsyncMultiSelect","AsyncSelect","AsyncVirtualizedSelect","AutoSaveField","AutoSizeInput","Avatar","Badge","BarGauge","BarGaugeDisplayMode","BigValue","BigValueColorMode","BigValueGraphMode","BigValueJustifyMode","BigValueTextMode","Box","BrowserLabel","Button","ButtonCascader","ButtonGroup","ButtonSelect","CallToActionCard","Card","CardContainer","Carousel","Cascader","CertificationKey","Checkbox","ClickOutsideWrapper","ClipboardButton","CodeEditor","CodeEditorSuggestionItemKind","CollapsableSection","Collapse","ColorPicker","ColorPickerInput","Combobox","ConfirmButton","ConfirmModal","Container","ContextMenu","ControlledCollapse","Counter","CustomHeadersSettings","CustomScrollbar","DataLinkButton","DataLinkInput","DataLinksContextMenu","DataLinksInlineEditor","DataLinksInlineEditorBase","DataSourceHttpSettings","DatePicker","DatePickerWithInput","DateTimePicker","DeleteButton","Divi
155der","Drawer","Dropdown","ElementSelectionContext","EmptySearchResult","EmptyState","ErrorBoundary","ErrorBoundaryAlert","ErrorWithStack","EventBusPlugin","EventsCanvas","FIXED_UNIT","FadeTransition","FeatureBadge","FeatureInfoBox","Field","FieldArray","FieldLinkList","FieldSet","FieldValidationMessage","FileDropzone","FileDropzoneDefaultChildren","FileListItem","FileUpload","FilterInput","FilterPill","Form","FormattedValueDisplay","FullWidthButtonContainer","Gauge","Graph","GraphContextMenu","GraphContextMenuHeader","GraphNG","GraphSeriesToggler","GraphWithLegend","Grid","HorizontalGroup","Icon","IconButton","InfoBox","InlineField","InlineFieldRow","InlineFormLabel","InlineLabel","InlineSegmentGroup","InlineSwitch","InlineToast","Input","InputControl","InteractiveTable","JSONFormatter","JsonExplorer","KeyboardPlugin","Label","LegacyForms","LegacyInputStatus","Legend","Link","LinkButton","List","LoadingBar","LoadingPlaceholder","Marker","Menu","MenuGroup","MenuItem","Modal","ModalHeader","ModalRoot","ModalTabContent","ModalTabsHeader","ModalsContext","ModalsController","ModalsProvider","MultiCombobox","MultiSelect","PageToolbar","Pagination","PanelChrome","PanelChromeLoadingIndicator","PanelContainer","PanelContextProvider","PanelContextRoot","PlotLegend","PluginSignatureBadge","Popover","PopoverController","Portal","PortalContainer","QueryField","RadioButtonDot","RadioButtonGroup","RadioButtonList","RangeSlider","ReactMonacoEditor","RefreshPicker","RelativeTimeRangePicker","RenderUserContentAsHTML","ScaleDistribution","ScrollC
155ontainer","SecretInput","SecretTextArea","SecureSocksProxySettings","Segment","SegmentAsync","SegmentInput","SegmentSection","SegmentSelect","Select","SelectContainer","SelectMenuOptions","SeriesColorPicker","SeriesColorPickerPopover","SeriesColorPickerPopoverWithTheme","SeriesIcon","SeriesTable","SeriesTableRow","SeriesVisibilityChangeBehavior","SeriesVisibilityChangeMode","SetInterval","SlideOutTransition","Slider","Space","Sparkline","Spinner","Stack","StatsPicker","Switch","TLSAuthSettings","Tab","TabContent","TabbedContainer","Table","TableCellInspector","TableCellInspectorMode","TableInputCSV","TabsBar","Tag","TagList","TagsInput","Text","TextArea","TextLink","TimeOfDayPicker","TimePickerTooltip","TimeRangeInput","TimeRangeLabel","TimeRangePicker","TimeRangeProvider","TimeSeries","TimeZonePicker","ToggleAllState","Toggletip","ToolbarButton","ToolbarButtonRow","Tooltip","TooltipPlugin","TooltipPlugin2","UPLOT_AXIS_FONT_SIZE","UPlotChart","UPlotConfigBuilder","UnitPicker","UserIcon","UsersIndicator","ValuePicker","VerticalGroup","VerticalTab","VirtualizedSelect","VizLayout","VizLegend","VizLegendListItem","VizRepeater","VizTooltip","VizTooltipContainer","WeekStartPicker","WithContextMenu","XYCanvas","ZoomPlugin","buildScaleKey","clearButtonStyles","convertOldAngularValueMapping","defaultIntervals","fieldMatchersUI","getCardStyles","getDragStyles","getInputStyles","getPortalContainer","getSelectStyles","getWeekStart","graphFieldOptions","graphTickFormatter","graphTimeFormat","isWeekStart","preparePlotFrame","resetSelectStyles","sharedInputStyle","sharedSingleStatMigrationHandler","sharedSingleStatPanelChangedHandler","useElementSelection","useGraphNGContext","usePanelContext","useSplitter","variableSuggestionToCodeEditorSuggestion","withErrorBoundary"].indexOf(f)<0&&(r[f]=()=>n[f]);e.d(B,r);var o=e(47479),s=e(71857),m=e(45851),a=e(79346),l=e(31658)},44017:(ee,B,e)=>{"use strict";e.d(B,{T4:()=>y,W1:()=>c,Wq:()=>P,rg:()=>x});var t=e(74848),n=e(95004),r=e(38809),o=e(739),s=e(37386),m=e(77824),a=e(63527),l=e(41654),f=e(18857),h=e(99555),u=e(7685);const i=["Axis"];function x(d,D){P(d),d.addTextInput({path:"axisLabel",name:"Label",category:i,defaultValue:"",settings:{placeholder:"Optional text",expandTemplateVars:!0},showIf:b=>b.axisPlacement!==o.vM.Hidden,shouldApply:b=>b.type!==n.PU.time&&b.type!==n.PU.string}),y(d),d.addRadio({path:"axisGridShow",name:"Show grid lines",category:i,defaultValue:void 0,settings:{options:[{value:void 0,label:"Auto"},{value:!0,label:"On"},{value:!1,label:"Off"}]},showIf:b=>b.axisPlacement!==o.vM.Hidden}).addRadio({path:"axisColorMode",name:"Color",category:i,defaultValue:o.Y$.Text,settings:{options:[{value:o.Y$.Text,label:"Text"},{value:o.Y$.Series,label:"Series"}]},showIf:b=>b.axisPlacement!==o.vM.Hidden}).addBooleanSwitch({path:"axisBorderShow",name:"Show border",category:i,defaultValue:!1,showIf:b=>b.axisPlacement!==o.vM.Hidden}),d.addCustomEditor({id:"scaleDistribution",path:"scaleDistribution",name:"Scale",category:i,editor:c,override:c,defaultValue:{type:o.L4.Linear},shouldApply:b=>b.type===n.PU.number,process:r.hS}).addBooleanSwitch({path:"axisCenteredZero",name:"Centered zero",category:i,defaultValue:!1,showIf:b=>b.scaleDistribution?.type!==o.L4.Log}).addNumberInput({path:"axisSoftMin",name:"Soft min",defaultValue:D.axisSoftMin,category:i,settings:{placeholder:"See: Standard options > Min"}}).addNumberInput({path:"axisSoftMax",name:"Soft max",defaultValue:D.axisSoftMax,category:i,settings:{placeholder:"See: Standard options > Max"}})}const g=[{label:"Linear",value:o.L4.Linear},{label:"Logarithmic",value:o.L4.Log},{label:"Symlog",value:o.L4.Symlog}],p=[{label:"2",value:2},{label:"10",value:10}],c=({value:d,onChange:D})=>{const b=d?.type??o.L4.Linear,E=d?.log??2;return(0,t.jsxs)(l.B,{direction:"column",gap:2,children:[(0,t.jsx)(m.z,{value:b,options:g,onChange:v=>{D({...d,type:v,log:v===o.L4.Linear?void 0:E})}}),(b===o.L4.Log||b===o.L4.Symlog)&&(0,t.jsx)(s.D,{label:(0,u.t)("grafana-ui.axis-builder.log-base","Log base"),children:(0,t.jsx)(f.l6,{options:p,value:E,onChange:v=>{D({...d,log:v.value})}})}),b===o.L4.Symlog&&(0,t.jsx)(s.D,{label:(0,u.t)("grafana-ui.axis-builder.linear-threshold","Linear threshold"),style:{marginBottom:0},children:(0,t.jsx)(a.p,{placeholder:"1",value:d?.linearThreshold,onChange:v=>{D({...d,linearThreshold:Number(v.currentTarget.value)})}})})]})};function y(d){d.addNumberInput({path:"axisWidth",name:"Width",category:i,settings:{placeholder:"Auto"},showIf:D=>D.axisPlacement!==o.vM.Hidden})}function P(d,D=b=>!0){d.addRadio({path:"axisPlacement",name:"Placement",category:i,defaultValue:h.t.axisPlacement[0].value,settings:{options:h.t.axisPlacement.filter(b=>D(b.value))}})}},45013:(ee,B,e)=>{"use strict";e.d(B,{e:()=>l});var t=e(74848),n=e(2543),r=e.n(n),o=e(96540),s=e(34343),m=e(41654);const a=({value:f,onChange:h})=>{const u=(0,o.useCallback)(i=>{h({...f,[i]:!f[i]})},[f,h]);return(0,t.jsx)(m.B,{gap:.5,children:Object.keys(f).map(i=>{const x=i;return(0,t.jsx)(s.m,{icon:f[x]?"eye-slash":"eye",onClick:()=>u(x),label:(0,n.startCase)(x),selected:f[x]},x)})})};
155function l(f){f.addCustomEditor({id:"hideFrom",name:"Hide in area",category:["Series"],path:"hideFrom",defaultValue:{tooltip:!1,viz:!1,legend:!1},editor:a,override:a,shouldApply:()=>!0,hideFromDefaults:!0,process:h=>h})}},41069:(ee,B,e)=>{"use strict";e.d(B,{H:()=>r});var t=e(53543),n=e(739);function r(o,s=!0,m=!0){o.addBooleanSwitch({path:"legend.showLegend",name:"Visibility",category:["Legend"],description:"",defaultValue:m}).addRadio({path:"legend.displayMode",name:"Mode",category:["Legend"],description:"",defaultValue:n.lm.List,settings:{options:[{value:n.lm.List,label:"List"},{value:n.lm.Table,label:"Table"}]},showIf:a=>a.legend.showLegend}).addRadio({path:"legend.placement",name:"Placement",category:["Legend"],description:"",defaultValue:"bottom",settings:{options:[{value:"bottom",label:"Bottom"},{value:"right",label:"Right"}]},showIf:a=>a.legend.showLegend}).addNumberInput({path:"legend.width",name:"Width",category:["Legend"],settings:{placeholder:"Auto"},showIf:a=>a.legend.showLegend&&a.legend.placement==="right"}),s&&o.addCustomEditor({id:"legend.calcs",path:"legend.calcs",name:"Values",category:["Legend"],description:"Select values or calculations to show in legend",editor:t.D.get("stats-picker").editor,defaultValue:[],settings:{allowMultiple:!0},showIf:a=>a.legend.showLegend!==!1}
155)}},81082:(ee,B,e)=>{"use strict";e.d(B,{I:()=>i,m:()=>u});var t=e(74848),n=e(38809),r=e(95004),o=e(739),s=e(77824),m=e(76319),a=e(63527),l=e(41654),f=e(99555),h=e(7685);const u=({value:x,context:g,onChange:p,item:c})=>(0,t.jsxs)(l.B,{children:[(0,t.jsx)(s.z,{value:x?.mode||o.gs.None,options:c.settings?.options??[],onChange:y=>{p({...x,mode:y})}}),g.isOverride&&x?.mode&&x?.mode!==o.gs.None&&(0,t.jsx)(a.p,{type:"text",placeholder:(0,h.t)("grafana-ui.stacking-builder.group","Group"),suffix:(0,t.jsx)(m.K,{name:"question-circle",tooltip:(0,h.t)("grafana-ui.stacking-builder.group-tooltip","Name of the stacking group"),tooltipPlacement:"top"}),defaultValue:x?.group,onChange:y=>{p({...x,group:y.currentTarget.value.trim()})}})]});function i(x,g,p=["Graph styles"]){x.addCustomEditor({id:"stacking",path:"stacking",name:"Stack series",category:p,defaultValue:g,editor:u,override:u,settings:{options:f.t.stacking},process:n.hS,shouldApply:c=>c.type===r.PU.number})}},14099:(ee,B,e)=>{"use strict";e.d(B,{I:()=>t});function t(n,r=!0){r&&n.addNumberInput({path:"text.titleSize",category:["Text size"],name:"Title",settings:{placeholder:"Auto",integer:!1,min:1,max:200},defaultValue:void 0}),n.addNumberInput({path:"text.valueSize",category:["Text size"],name:"Value",settings:{placeholder:"Auto",integer:!1,min:1,max:200},defaultValue:void 0}),n.addNumberInput({path:"text.percentSize",category:["Text size"],name:"Percent change",settings:{placeholder:"Auto",integer:!1,min:1,max:200},defaultValue:void 0})}},79277:(ee,B,e)=>{"use strict";e.d(B,{D:()=>r,U:()=>n});var t=e(739);const n={tooltip:{mode:t.$N.Single,sort:t.xB.None,hideZeros:!1}};function r(o,s=!1,m=!1,a){const l=["Tooltip"],f=s?[{value:t.$N.Single,label:"Single"},{value:t.$N.None,label:"Hidden"}]:[{value:t.$N.Single,label:"Single"},{value:t.$N.Multi,label:"All"},{value:t.$N.None,label:"Hidden"}],h=[{value:t.xB.None,label:"None"},{value:t.xB.Ascending,label:"Ascending"},{value:t.xB.Descending,label:"Descending"}];o.addRadio({path:"tooltip.mode",name:"Tooltip mode",category:l,defaultValue:a?.tooltip?.mode??t.$N.Single,settings:{options:f}}).addRadio({path:"tooltip.sort",name:"Values sort order",category:l,defaultValue:a?.tooltip?.sort??t.xB.None,showIf:u=>u.tooltip?.mode===t.$N.Multi,settings:{options:h}}).addBooleanSwitch({path:"tooltip.hideZeros",name:"Hide zeros",category:l,defaultValue:!1,showIf:u=>a?.tooltip?.hideZeros!==void 0&&u.tooltip?.mode===t.$N.Multi}),m&&o.addNumberInput({path:"tooltip.hoverProximity",name:"Hover proximity",description:"How close the cursor must be to a point to trigger the tooltip, in pixels",category:l,settings:{integer:!0},showIf:u=>u.tooltip?.mode!==t.$N.None}),o.addNumberInput({path:"tooltip.maxWidth",name:"Max width",category:l,settings:{integer:!0},showIf:u=>u.tooltip?.mode!==t.$N.None}).addNumberInput({path:"tooltip.maxHeight",name:"Max height",category:l,defaultValue:void 0,settings:{integer:!0},showIf:(u,i,x)=>u.tooltip?.mode===t.$N.Multi||x?.some(g=>g.meta?.custom?.resultType==="exemplar")})}},45851:(ee,B,e)=>{"use strict";e.d(B,{j:()=>t});var t={};e.r(t),e.d(t,{ScaleDistributionEditor:()=>n.W1,StackingEditor:()=>a.m,addAxisConfig:()=>n.rg,addAxisPlacement:()=>n.Wq,addAxisWidth:()=>n.T4,addHideFrom:()=>r.e,addLegendOptions:()=>o.H,addStackingConfig:()=>a.I,addTextSizeOptions:()=>m.I,addTooltipOptions:()=>s.D});var n=e(44017),r=e(45013),o=e(41069),s=e(79277),m=e(14099),a=e(81082)},31658:(ee,B,e)=>{"use strict";e.d(B,{$N:()=>t.$N,Lt:()=>t.Lt,Ly:()=>t.Ly,Nj:()=>t.Nj,ON:()=>t.ON,TC:()=>t.yL,dx:()=>t.dx,gs:()=>t.gs,lm:()=>t.lm,nT:()=>t.yL,ob:()=>t.ob,on:()=>t.on,vM:()=>t.vM,yg:()=>t.GR});var t=e(739)},16123:(ee,B,e)=>{"use strict";e.d(B,{v:()=>t});function t(){return{onKeyDown(n,r,o){const s=r.value;if(s.selection.isExpanded)return o();if(n.key==="k"&&n.ctrlKey){n.preventDefault();const m=s.anchorText.text,a=s.selection.anchor.offset,f=m.length-a;return r.deleteForward(f),!0}return o()}}}},54024:(ee,B,e)=>{"use strict";e.d(B,{s:()=>r});const t=(o,s,m)=>{if(!o.length)return;const a=o.slice(0,-1).join("").length+o.length-1;return o.join(` 156`).slice(s,a+m)},n=o=>o?.replace(/[\uFEFF]/g,"");function r(){const o={onCopy(s,m,a){s.preventDefault();const{document:l,selection:f}=m.value,{start:{offset:h},end:{offset:u}}=f,i=l.getLeafBlocksAtRange(f).toArray().map(g=>g.text),x=n(t(i,h,u));return x&&s.clipboardData&&s.clipboardData.setData("Text",x),!0},onPaste(s,m,a){if(s.preventDefault(),s.clipboardData){const f=n(s.clipboardData.getData("Text"))?.split(` 157`);if(f&&f.length){m.insertText(f[0]);for(const h of f.slice(1))m.splitBlock().insertText(h)}}return!0}};return{...o,onCut(s,m,a){return o.onCopy(s,m,a),m.deleteAtRange(m.value.selection),!0}}}},52513:(ee,B,e)=>{"use strict";e.d(B,{T:()=>h});var t=e(57746),n=e(82611),r=e(52845);const o=(0,t.Sn)("mod+["),s=(0,t.Sn)("shift+tab"),m=(0,t.Sn)("mod+]"),a=" ",l=(u,i,x)=>{const{startBlock:g,endBlock:p,selection:{start:{offset:c,key:y},end:{offset:P,key:d}}}=i.value;if(r.default.serialize(i.value)==="")return;u.preventDefault();const D=g.getFirstText();D&&c===0&&y===D.key&&P===D.text.length&&d===D.key||!g.equals(p)?f(i,"right"):i.insertText(a)},f=(u,i)=>{const x=u.value.selection,g=u.value.document.getLeafBlocksAtRange(x).toArray();if(i==="left")for(const p of g){const c=p.text.length-p.text.trimLeft().length,y=p.getFirstText().key,P={anchor:{key:y,offset:c,path:[]},focus:{key:y,offset:c,path:[]}};u.deleteBackwardAtRange(n.Range.create(P),Math.min(a.length,c))}else{const{startText:p}=u.value,c=p.text.slice(0,x.start.offset),y=/^\s*$/.test(c);for(const P of g)u.insertTextByKey(P.getFirstText().key,0,a);y&&u.moveStartBackward(a.length)}};function h(){return{onKeyDown(u,i,x){if(o(u)||s(u))u.preventDefault(),f(i,"left");else if(m(u))u.preventDefault(),f(i,"right");else if(u.key==="Tab")l(u,i,x);else return x();return!0}}}},79346:(ee,B,e)=>{"use strict";e.d(B,{e1:()=>o,vJ:()=>s.v,sW:()=>m.s,TA:()=>a.T,Om:()=>l.O,Ul:()=>f.U,l9:()=>h.l,De:()=>u.D,Pz:()=>i.Pz});var t=e(24726);const n={"[":"]","{":"}","(":")"},r="brace_match";function o(){return{onKeyDown(x,g,p){const{value:c}=g;switch(x.key){case"(":case"{":case"[":{const{start:{offset:y,key:P},end:{offset:d,key:D},focus:{offset:b}}=c.selection,E=c.focusText.text;if(c.selection.isExpanded)return x.preventDefault(),g.insertTextByKey(P,y,x.key).insertTextByKey(D,d+1,n[x.key]).moveEndBackward(1),!0;
157if(b===E.length||E[b]===" "||Object.values(n).includes(E[b])){x.preventDefault();const v=n[x.key],C={key:`${r}-${(0,t.A)()}`,type:`${r}-${v}`,anchor:{key:P,offset:y,object:"point"},focus:{key:D,offset:d+1,object:"point"},object:"annotation"};return g.insertText(x.key).insertText(v).addAnnotation(C).moveBackward(1),!0}break}case")":case"}":case"]":{const y=c.anchorText.text,P=c.selection.anchor.offset,d=y[P],D=x.key,b=`${r}-${D}`,E=c.annotations.find(v=>v?.type===b&&v.anchor.key===c.anchorText.key);if(E&&d===D&&!c.selection.isExpanded)return x.preventDefault(),g.moveFocusForward(1).removeAnnotation(E).moveAnchorForward(1),!0;break}case"Backspace":{const y=c.anchorText.text,P=c.selection.anchor.offset,d=y[P-1],D=y[P];if(n[d]&&n[d]===D)return x.preventDefault(),g.deleteBackward(1).deleteForward(1).focus(),!0}default:break}return p()}}}var s=e(16123),m=e(54024),a=e(52513),l=e(21266),f=e(59490),h=e(91272),u=e(56103),i=e(93427)},21266:(ee,B,e)=>{"use strict";e.d(B,{O:()=>n});function t(r){let o=r.length-r.trimLeft().length;if(o){let s=r[0];for(;--o;)s+=r[0];return s}return""}function n(){return{onKeyDown(r,o,s){const m=o.value;if(m.selection.isExpanded)return s();if(r.key==="Enter"){r.preventDefault();const{startBlock:a}=m,l=a.text,f=t(l);return o.splitBlock().insertText(f).focus()}return s()}}}},59490:(ee,B,e)=>{"use strict";e.d(B,{U:()=>t});function t({handler:n}){return{onKeyDown(r,o,s){return n&&r.key==="Enter"&&(r.shiftKey||r.ctrlKey)?(r.preventDefault(),n(r),o):s()}}}},91272:(ee,B,e)=>{"use strict";e.d(B,{l:()=>r});var t=e(57746);const n=(0,t.Sn)("mod+l");function r(){return{onKeyDown(o,s,m){if(n(o)){o.preventDefault();const{focusBlock:a,document:l}=s.value;s.moveAnchorToStartOfBlock(),l.getNextBlock(a.key)?s.moveFocusToStartOfNextBlock():s.moveFocusToEndOfText()}else return m();return!0}}}},65937:(ee,B,e)=>{"use strict";e.d(B,{A:()=>n});const n="prism-token"},56103:(ee,B,e)=>{"use strict";e.d(B,{D:()=>i,R:()=>c});var t=e(28848),n=e.n(t),r=e(82611),o=e(65937),s=e(74848),m=e(49568);function a(y){return y.object==="block"&&y.type==="code_block"}function l(y){return"javascript"}function f(y,P,d){const{decoration:D}=y;if(D.type!==o.A)return d();const b=D.data.get("className");return(0,s.jsx)("span",{className:b,children:y.children})}class h extends(0,m.Record)({onlyIn:a,getSyntax:l,renderDecoration:f}){constructor(P){super(P)}}const u=h;function i(y={},P=n().languages){const d=new u(y);return{decorateNode:(D,b,E)=>{if(!d.onlyIn(D))return E();const v=r.Block.create(D),C=d.getSyntax(v),S=P[C];if(!S)return[];const I=v.getTexts().map(K=>K&&K.getText()).join(` 158`),R=n().tokenize(I,S),T=c(R),L=b.value.data.set("tokens",T);return b.setData(L),x(d,R,v)},renderDecoration:(D,b,E)=>d.renderDecoration({children:D.children,decoration:D.decoration},b,E)}}function x(y,P,d){const D=d.getTexts(),b=[];let E=0,v=0;return D.forEach(C=>{v=E+C.getText().length;let S=0;function O(I,R){if(typeof I=="string"){if(R){const T=g({text:C,textStart:E,textEnd:v,start:S,end:S+I.length,className:`prism-token token ${R}`,block:d});T&&b.push(T)}S+=I.length}else if(R=`${R} ${I.type}`,I.alias&&(R+=" "+I.alias),typeof I.content=="string"){const T=g({text:C,textStart:E,textEnd:v,start:S,end:S+I.content.length,className:`prism-token token ${R}`,block:d});T&&b.push(T),S+=I.content.length}else for(let T=0;T<I.content.length;T+=1)O(I.content[T],R)}P.forEach(O),E=v+1}),b}function g({text:y,textStart:P,textEnd:d,start:D,end:b,className:E,block:v}){return D>=d||b<=P?null:(D=Math.max(D,P),b=Math.min(b,d),D-=P,b-=P,v.createDecoration({object:"decoration",anchor:{key:y.key,offset:D,object:"point"},focus:{key:y.key,offset:b,object:"point"},type:o.A,data:{className:E}}))}function p(y){return typeof y=="string"?[{content:y,types:[],aliases:[]}]:Array.isArray(y)?y.flatMap(P=>p(P)):y instanceof n().Token?p(y.content).flatMap(P=>{let d=[];return typeof y.alias=="string"?d=[y.alias]:d=y.alias??[],{content:P.content,types:[y.type,...P.types],aliases:[...d,...P.aliases]}}):[]}function c(y){const P=p(y);if(!P.length)return[];const d=P[0];d.prev=null,d.next=P.length>=2?P[1]:null,d.offsets={start:0,end:d.content.length};for(let b=1;b<P.length-1;b++)P[b].prev=P[b-1],P[b].next=P[b+1],P[b].offsets={start:P[b-1].offsets.end,end:P[b-1].offsets.end+P[b].content.length};const D=P[P.length-1];return D.prev=P.length>=2?P[P.length-2]:null,D.next=null,D.offsets={start:P.length>=2?P[P.length-2].offsets.end:0,end:P.length>=2?P[P.length-2].offsets.end+D.content.length:D.content.length},P}},93427:(ee,B,e)=>{"use strict";e.d(B,{Pz:()=>W});var t=e(74848),n=e(2543),r=e(22803),o=e(96540),s=e(40961),m=e(91793),a=e(35555),l=e(53926),f=e(49579);const h=j=>j.reduce((V,{items:U,label:F})=>(V.push({label:F,kind:l.I.GroupTitle}),U.reduce((M,H)=>(M.push(H),M),V)),[]),u=j=>j.reduce((V,U)=>V.length<U.label.length?U.label:V,""),i=(j,V,U)=>{const F=(0,f.A)(U,{font:j.typography.fontFamilyMonospace,fontSize:j.typography.bodySmall.fontSize,fontWeight:"normal"}),M=g(F.width,j),H=x(F.height,j),_=p(H,V);return{listWidth:M,listHeight:_,itemHeight:H}},x=(j,V)=>{const U=V.spacing.gridSize*2;return j+U},g=(j,V)=>{const U=V.spacing.gridSize*3;return Math.min(Math.max(j+U,200),800)},p=(j,V)=>{const U=Math.min(V.length,10),F=100,M=U*j;return Math.max(M,F)};var c=e(67458),y=e(63142);const P=(j,V,U)=>({typeaheadItem:(0,r.css)({label:"type-ahead-item",zIndex:11,padding:j.spacing(1,1,1,2),border:j.colors.border.medium,overflowY:"scroll",overflowX:"hidden",outline:"none",background:j.colors.background.secondary,color:j.colors.text.secondary,boxShadow:`0 0 20px ${j.v1.colors.dropdownShadow}
158`,visibility:U===!0?"visible":"hidden",width:"250px",minHeight:`${V+parseInt(j.spacing(.25),10)}px`,position:"relative",wordBreak:"break-word"})}),d=({item:j,height:V})=>{const U=j&&!!j.documentation,F=j?j.label:"",M=(0,c.G)(j?.documentation),H=(0,y.$j)(),_=P(H,V,U);return(0,t.jsxs)("div",{className:(0,r.cx)([_.typeaheadItem]),children:[(0,t.jsx)("b",{children:F}),(0,t.jsx)("hr",{}),(0,t.jsx)("div",{dangerouslySetInnerHTML:{__html:M}})]})};var D=e(23257),b=e.n(D),E=e(20662);const v=j=>({typeaheadItem:(0,r.css)({border:"none",background:"none",textAlign:"left",label:"type-ahead-item",height:"auto",fontFamily:j.typography.fontFamilyMonospace,padding:j.spacing(1,1,1,2),fontSize:j.typography.bodySmall.fontSize,textOverflow:"ellipsis",overflow:"hidden",zIndex:11,display:"block",whiteSpace:"nowrap",cursor:"pointer",[j.transitions.handleMotion("no-preference","reduce")]:{transition:"color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), padding 0.15s cubic-bezier(0.645, 0.045, 0.355, 1)"}}),typeaheadItemSelected:(0,r.css)({label:"type-ahead-item-selected",backgroundColor:j.colors.background.secondary}),typeaheadItemMatch:(0,r.css)({label:"type-ahead-item-match",color:j.v1.palette.yellow,borderBottom:`1px solid ${j.v1.palette.yellow}`,padding:"inherit",background:"inherit"}),typeaheadItemGroupTitle:(0,r.css)({label:"type-ahead-item-group-title",color:j.colors.text.secondary,fontSize:j.typography.bodySmall.fontSize,lineHeight:j.typography.body.lineHeight,padding:j.spacing(1)})}),C=j=>{const V=(0,y.of)(v),{isSelected:U,item:F,prefix:M,style:H,onMouseEnter:_,onMouseLeave:Z,onClickItem:ne}=j,te=U?(0,r.cx)([V.typeaheadItem,V.typeaheadItemSelected]):(0,r.cx)([V.typeaheadItem]),Y=(0,r.cx)([V.typeaheadItemMatch]),Q=(0,r.cx)([V.typeaheadItemGroupTitle]),J=F.label||"";return F.kind===l.I.GroupTitle?(0,t.jsx)("li",{className:Q,style:H,children:(0,t.jsx)("span",{children:J})}):(0,t.jsx)("li",{role:"none",children:(0,t.jsx)("button",{role:"menuitem",className:te,style:H,onMouseDown:ne,onMouseEnter:_,onMouseLeave:Z,type:"button",children:F.highlightParts!==void 0?(0,t.jsx)(E.z,{text:J,highlightClassName:Y,highlightParts:F.highlightParts}):(0,t.jsx)(b(),{textToHighlight:J,searchWords:[M??""],autoEscape:!0,highlightClassName:Y})})})},S=(j,V)=>j-V*Math.floor(j/V);class O extends o.PureComponent{constructor(){super(...arguments),this.listRef=(0,o.createRef)(),this.state={hoveredItem:null,typeaheadIndex:null,allItems:[],listWidth:-1,listHeight:-1,itemHeight:-1},this.componentDidMount=()=>{this.props.menuRef&&this.props.menuRef(this),document.addEventListener("selectionchange",this.handleSelectionChange);const V=h(this.props.groupedItems),U=u(V),{listWidth:F,listHeight:M,itemHeight:H}=i(this.context,V,U);this.setState({listWidth:F,listHeight:M,itemHeight:H,allItems:V})},this.componentWillUnmount=()=>{document.removeEventListener("selectionchange",this.handleSelectionChange)},this.handleSelectionChange=()=>{this.forceUpdate()},this.componentDidUpdate=(V,U)=>{if(this.state.typeaheadIndex!==null&&U.typeaheadIndex!==this.state.typeaheadIndex&&this.listRef&&this.listRef.current){if(this.state.typeaheadIndex===1){this.listRef.current.scrollToItem(0);return}this.listRef.current.scrollToItem(this.state.typeaheadIndex)}if((0,n.isEqual)(V.groupedItems,this.props.groupedItems)===!1){const F=h(this.props.groupedItems),M=u(F),{listWidth:H,listHeight:_,itemHeight:Z}=i(this.context,F,M);this.setState({listWidth:H,listHeight:_,itemHeight:Z,allItems:F,typeaheadIndex:null})}},this.onMouseEnter=V=>{this.setState({hoveredItem:V})},this.onMouseLeave=()=>{this.setState({hoveredItem:null})},this.moveMenuIndex=V=>{const U=this.state.allItems.length;if(U){const F=this.state.typeaheadIndex||0;let M=S(F+V,U);this.state.allItems[M].kind===l.I.GroupTitle&&(M=S(M+V,U)),this.setState({typeaheadIndex:M});return}},this.insertSuggestion=()=>{this.props.onSelectSuggestion&&this.state.typeaheadIndex!==null&&this.props.onSelectSuggestion(this.state.allItems[this.state.typeaheadIndex])}}static{this.contextType=a.D}get menuPosition(){if(!window.getSelection)return"";const V=window.getSelection(),U=V&&V.anchorNode;if(U&&U.parentElement){const F=U.parentElement.getBoundingClientRect(),M=window.scrollX,H=window.scrollY;return`position: absolute; display: flex; top: ${F.top+H+F.height+6}px; left: ${F.left+M-2}px`}return""}render(){const{prefix:V,isOpen:U=!1,origin:F}=this.props,{allItems:M,listWidth:H,listHeight:_,itemHeight:Z,hoveredItem:ne,typeaheadIndex:te}=this.state,Y=R(this.context),Q=ne||te,J=M[ne||te||0];return(0,t.jsxs)(I,{origin:F,isOpen:U,style:this.menuPosition,children:[(0,t.jsx)("ul",{role:"menu",className:Y.typeahead,"data-testid":"typeahead",children:(0,t.jsx)(m.Y1,{ref:this.listRef,itemCount:M.length,itemSize:Z,itemKey:q=>{const X=M&&M[q];return X?`${q}-${X.label}`:`${q}`},width:H,height:_,children:({index:q,style:X})=>{const se=M&&M[q];return se?(0,t.jsx)(C,{onClickItem:()=>this.props.onSelectSuggestion?this.props.onSelectSuggestion(se):{},isSelected:te===null?!1:M[te]===se,item:se,prefix:V,style:X,onMouseEnter:()=>this.onMouseEnter(q),onMouseLeave:this.onMouseLeave}):null}})}),Q&&(0,t.jsx)(d,{height:_,item:J})]})}}class I extends o.PureComponent{constructor(V){super(V);const{index:U=0,origin:F="query",style:M}=V;this.node=document.createElement("div"),this.node.setAttribute("style",M),this.node.classList.add(`slate-typeahead-${F}-${U}`),document.body.appendChild(this.node)}componentWillUnmount(){document.body.removeChild(this.node)}render(){return this.props.isOpen?(this.node.setAttribute("style",this.props.style),this.node.classList.add("slate-typeahead--open"),s.createPortal(this.props.children,this.node)):(this.node.classList.remove("slate-typeahead--open"),null)}}const R=j=>
158({typeahead:(0,r.css)({position:"relative",zIndex:j.zIndex.typeahead,borderRadius:j.shape.radius.default,border:`1px solid ${j.components.panel.borderColor}`,maxHeight:"66vh",overflowY:"scroll",overflowX:"hidden",outline:"none",listStyle:"none",background:j.components.panel.background,color:j.colors.text.primary,boxShadow:j.shadows.z2,strong:{color:j.v1.palette.yellow}})});var T=e(35458),L=e(59258),K=e(65937);const A=250;function W({onTypeahead:j,cleanText:V,onWillApplySuggestion:U,portalOrigin:F}){let M,H={groupedItems:[],typeaheadPrefix:"",typeaheadContext:"",typeaheadText:""};const _=(0,n.debounce)(N,A),Z=ne=>{H={...H,...ne}};return{onBlur:(ne,te,Y)=>(H={...H,groupedItems:[]},Y()),onClick:(ne,te,Y)=>(H={...H,groupedItems:[]},Y()),onKeyDown:(ne,te,Y)=>{const J=H.groupedItems.length;switch(ne.key){case"Escape":{if(J)return ne.preventDefault(),H={...H,groupedItems:[]},te.insertText("");break}case"ArrowDown":case"ArrowUp":if(J){ne.preventDefault(),M.moveMenuIndex(ne.key==="ArrowDown"?1:-1);return}break;case"Enter":{if(!(ne.shiftKey||ne.ctrlKey)&&J)return ne.preventDefault(),M.insertSuggestion();break}
158case"Tab":{if(J)return ne.preventDefault(),M.insertSuggestion();break}default:{ne.key.length===1&&_(te,Z,j,V);break}}return Y()},commands:{selectSuggestion:(ne,te)=>{const Y=H.groupedItems;if(!Y||!Y.length)return ne;const Q=ne.applyTypeahead(te);return _(ne,Z,j,V),Q},applyTypeahead:(ne,te)=>{let Y=te.insertText||te.label;const Q=te.kind==="function",J=te.move||0,q=J>0?J:0,X=J<0?-J:0,{typeaheadPrefix:se,typeaheadText:oe,typeaheadContext:ae}=H;U&&(Y=U(Y,{groupedItems:H.groupedItems,typeaheadContext:ae,typeaheadPrefix:se,typeaheadText:oe}));const{forward:ie,backward:fe}=w(Y,se,oe,Q,te.deleteBackwards,V);if(Y.match(/\n/)){const pe=(0,T.dF)(Y);return ne.deleteBackward(fe).deleteForward(ie).insertFragment(pe).focus(),ne}return H={...H,groupedItems:[]},ne.snapshotSelection().deleteBackward(fe).deleteForward(ie).insertText(Y).moveForward(q).moveBackward(X).focus(),ne}},renderEditor(ne,te,Y){if(te.value.selection.isExpanded)return Y();const Q=Y();return(0,t.jsxs)(t.Fragment,{children:[Q,(0,t.jsx)(O,{menuRef:J=>M=J,origin:F,prefix:H.typeaheadPrefix,isOpen:!!H.groupedItems.length,groupedItems:H.groupedItems,onSelectSuggestion:te.selectSuggestion})]})}}}const N=async(j,V,U,F)=>{if(!U)return;const{value:M}=j,{selection:H}=M,_=M.document.getClosestBlock(M.focusBlock.key),Z=M.selection.start.offset-1,ne=_&&_.getDecorations(j),te=ne?ne.filter(fe=>fe.start.offset<=Z&&fe.end.offset>Z&&fe.type===K.A).toArray():[],Y=ne&&ne.filter(fe=>fe.end.offset<=Z&&fe.type===K.A&&fe.data.get("className").includes("label-key")).last(),Q=Y&&M.focusText.text.slice(Y.start.offset,Y.end.offset),J=te.map(fe=>fe.data.get("className")).join(" ").split(" ").filter(fe=>fe.length);let q=M.focusText.text,X=q.slice(0,H.focus.offset);te.length&&(q=M.focusText.text.slice(te[0].start.offset,te[0].end.offset),X=M.focusText.text.slice(te[0].start.offset,H.focus.offset));const se=X.match(/(?:!?=~?"?|")(.*)/);se?X=se[1]:F&&(X=F(X));const{suggestions:oe,context:ae}=await U({prefix:X,text:q,value:M,wrapperClasses:J,labelKey:Q||void 0,editor:j}),ie=oe.map(fe=>{if(!fe.items)return fe;const pe=fe.searchFunctionType||(fe.prefixMatch?L.T.Prefix:L.T.Word),de=L.H[pe];let le={...fe};return X&&(fe.skipFilter||(le.items=le.items.filter(me=>(me.filterText||me.label).length>=X.length),le.items=de(le.items,X)),le.items=le.items.filter(me=>!(me.insertText===X||(me.filterText??me.label)===X))),fe.skipSort||(le.items=(0,n.sortBy)(le.items,me=>me.sortText===void 0?me.sortValue!==void 0?me.sortValue:me.label:me.sortText||me.label)),le}).filter(fe=>fe.items&&fe.items.length);V({groupedItems:ie,typeaheadPrefix:X,typeaheadContext:ae,typeaheadText:q}),j.blur().focus()};function w(j,V,U,F,M,H){const _=M||V.length,Z=H?H(U):U,ne=U.indexOf(V),te=ne>-1?Z.length-ne-V.length:Z.length-V.length;return{forward:!!(V&&te>0||j===U)&&!F?te+ne:0,backward:_}}},77345:(ee,B,e)=>{"use strict";e.d(B,{k:()=>K});var t=e(74848),n=e(17437),r=e(63142);function o(A){return(0,n.css)({".sr-only":{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",border:0}})}function s(A){return(0,n.css)({".alert-state-paused, .alert-state-pending":{color:A.colors.text.secondary,fontWeight:A.typography.fontWeightMedium},".alert-state-ok":{color:A.colors.success.text,fontWeight:A.typography.fontWeightMedium},".alert-state-warning":{color:A.colors.warning.text,fontWeight:A.typography.fontWeightMedium},".alert-state-critical":{color:A.colors.error.text,fontWeight:A.typography.fontWeightMedium}})}function m(A){return(0,n.css)({".card-section":{marginBottom:A.spacing(4)},".card-list":{display:"flex",flexDirection:"row",flexWrap:"wrap",listStyleType:"none"},".card-item":{display:"block",height:"100%",background:A.colors.background.secondary,boxShadow:"none",padding:A.spacing(2),borderRadius:"4px","&:hover":{background:A.colors.emphasize(A.colors.background.secondary,.03)},".label-tag":{marginLeft:A.spacing(1),fontSize:"11px",padding:"2px 6px"}},".card-item-body":{display:"flex",overflow:"hidden"},".card-item-details":{overflow:"hidden"},".card-item-header":{marginBottom:A.spacing(2)},".card-item-type":{color:A.colors.text.secondary,textTransform:"uppercase",fontSize:A.typography.size.sm,fontWeight:A.typography.fontWeightMedium},".card-item-badge":{margin:"6px 0"},".card-item-notice":{fontSize:A.typography.size.sm},".card-item-name":{color:A.colors.text.primary,overflow:"hidden",textOverflow:"ellipsis",width:"100%"},".card-item-label":{marginLeft:A.spacing(1)},".card-item-sub-name":{color:A.colors.text.secondary,overflow:"hidden",textOverflow:"ellipsis",width:"100%"},".card-item-sub-name--header":{color:A.colors.text.secondary,textTransform:"uppercase",marginBottom:A.spacing(2),fontSize:A.typography.size.sm,fontWeight:"bold"},".card-list-layout-grid":{".card-item-type":{display:"inline-block"},".card-item-notice":{fontSize:A.typography.size.sm,display:"inline-block",marginLeft:A.spacing(2)},".card-item-header-action":{float:"right"},".card-item-wrapper":{width:"100%",padding:A.spacing(0,2,2,0)},".card-item-wrapper--clickable":{cursor:"pointer"},".card-item-figure":{margin:A.spacing(0,2,2,0),height:"80px",img:{width:"80px"}},".card-item-name":{fontSize:A.typography.h3.fontSize},[A.breakpoints.up("md")]:{".card-item-wrapper":{width:"50%"}},[A.breakpoints.up("lg")]:{".card-item-wrapper":{width:"33.333333%"}},"&.card-list-layout-grid--max-2-col":{[A.breakpoints.up("lg")]:{".card-item-wrapper":{width:"50%"}}}},".card-list-layout-list":{".card-item-wrapper":{padding:0,width:"100%",marginBottom:A.spacing(1)},".card-item-wrapper--clickable":{cursor:"pointer"},".card-item":{borderRadius:"2px"},".card-item-header":{float:"right",textAlign:"right"},".card-item-figure":{margin:A.spacing(0,2,0,0),img:{width:"48px"}},".card-item-name":{fontSize:A.typography.h4.fontSize},".card-item-sub-name":{fontSize:A.typography.size.sm},".layout-selector":{marginRight:0}}})}function a(A){return(0,n.css)({"code, pre, kbd, samp":{...A.typography.code,fontSize:A.typography.bodySmall.fontSize,backgroundColor:A.colors.background.primary,color:A.colors.text.primary,border:`1px solid ${A.colors.border.medium}`,borderRadius:"4px"},code:{whiteSpace:"nowrap",padding:"2px 5px",margin:"0 2px"},pre:{display:"block",margin:A.spacing(0,0,2),lineHeight:A.typography.body.lineHeight,wordBreak:"break-all",wordWrap:"break-word",whiteSpace:"pre-wrap",overflow:"auto",padding:"10px",code:{padding:0,color:"inherit",whiteSpace:"pre-wrap",backgroundColor:"transparent",border:0}}})}function l(A){return(0,n.css)({".react-resizable-handle":{visibility:"hidden"},".react-grid-item, #grafana-portal-container":{touchAction:"initial !important","&:hover":{".react-resizable-handle":{visibility:"visible"}}},".dragging-active":{"*":{cursor:"move",userSelect:"none"}},[A.breakpoints.down("md")]:{".react-grid-layout":{height:"unset !important"},".react-grid-item":{display:"block !important",transitionProperty:"none !important",position:"unset !important",transform:"translate(0px, 0px) !important",marginBottom:A.spacing(2)},".panel-repeater-grid-item":{height:"auto !important"}},".react-grid-item.react-grid-placeholder":{boxShadow:`0 0 4px ${A.colors.primary.border} !important`,background:`${A.colors.primary.transparent} !important`,zIndex:"-1 !important",opacity:"unset !important"},".react-grid-item > .react-resizable-handle::after":{borderRight:`2px solid ${A.isDark?A.v1.palette.gray1:A.v1.palette.gray3} !important`,borderBottom:`2px solid ${A.isDark?A.v1.palette.gray1:A.v1.palette.gray3} !important`},".react-grid-item.resizing.panel, .react-grid-item.panel.dropdown-menu-open, .react-grid-item.react-draggable-dragging.panel":{zIndex:A.zIndex.dropdown},".react-grid-item.cssTransforms":{transitionProperty:"none !important"},[A.transitions.handleMotion("no-preference")]:{".react-grid-layout--enable-move-animations":{".react-grid-item.cssTransforms":{transitionProperty:"transform !important"}}},".dashboard-selected-element":{outline:`1px dashed ${A.colors.primary.border}
158`,outlineOffset:"0px",borderRadius:A.shape.radius.default},".dashboard-selectable-element":{"&:hover":{outline:`1px dashed ${A.colors.border.strong}`,outlineOffset:"0px",borderRadius:A.shape.radius.default,backgroundColor:A.colors.emphasize(A.colors.background.canvas,.08)}},".dashboard-canvas-add-button":{display:"flex",opacity:.5,transition:A.transitions.create("opacity"),filter:"grayscale(100%)","&:hover":{opacity:1,filter:"unset"}},".dashboard-visible-hidden-element":{position:"relative"},".dashboard-drop-target":{"&:is(:hover),&:not(:hover)":{outline:`2px solid ${A.colors.primary.border}`,outlineOffset:"0px",borderRadius:"2px"}},".dashboard-draggable-transparent-selection":{"*::selection":{all:"inherit"}},".react-draggable-dragging":{opacity:.8}})}function f(A){return(0,n.css)({".delta-html":{background:A.colors.background.secondary,paddingTop:"5px",paddingBottom:"5px",userSelect:"none"},".diff-line":{color:A.colors.text.primary,fontFamily:A.typography.fontFamilyMonospace,fontSize:A.typography.size.sm,lineHeight:2,marginBottom:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",position:"relative","&:after":{left:"-40px"}},".diff-line-number":{color:A.colors.text.secondary,display:"inline-block",fontSize:A.typography.size.xs,lineHeight:2.3,textAlign:"right",width:"30px"},".diff-line-number-hide":{visibility:"hidden"},".diff-line-icon":{color:A.colors.text.primary,fontSize:A.typography.size.xs,float:"right",position:"relative",top:"2px",right:"10px"},".diff-json-new, .diff-json-old, .diff-json-deleted, .diff-json-added":{color:A.v1.palette.gray5,".diff-line-number":{color:A.colors.text.primary}},".diff-json-new":{backgroundColor:A.isDark?"#457740":"#664e33"},".diff-json-old":{backgroundColor:A.isDark?"#a04338":"#5a372a"},".diff-json-added":{backgroundColor:A.colors.primary.shade},".diff-json-deleted":{backgroundColor:A.colors.error.shade},".diff-value":{userSelect:"all"},".diff-circle":{marginRight:"0.5em","*":{marginBottom:"1px"}},".diff-circle-changed":{color:"#f59433"},".diff-circle-added":{color:"#29d761"},".diff-circle-deleted":{color:"#fd474a"},".diff-item-added, .diff-item-deleted":{listStyle:"none"},".diff-group":{background:A.colors.background.secondary,fontSize:"16px",fontStyle:"normal",padding:"10px 15px",margin:A.spacing(2,0),".diff-group":{padding:"0 5px"}},".diff-group-name":{display:"inline-block",width:"100%",fontSize:"16px",paddingLeft:"1.75em",margin:"0 0 14px 0"},".diff-summary-key":{paddingLeft:"0.25em"},".diff-list":{paddingLeft:"40px",".diff-list":{paddingLeft:0}},".diff-item":{color:A.v1.palette.gray2,lineHeight:2.5,"> div":{display:"inline"}},".diff-item-changeset":{listStyle:"none"},".diff-label":{backgroundColor:A.colors.action.hover,borderRadius:"3px",color:A.colors.text.primary,display:"inline",fontSize:`${A.typography.fontSize}px`,margin:"0 5px",padding:"3px 8px"},".diff-linenum":{float:"right"},".diff-arrow":{color:A.colors.text.primary},".diff-block":{width:"100%",display:"inline-block"},".diff-block-title":{fontSize:"16px",display:"inline-block"},".diff-title":{fontSize:"16px"},".diff-change-container":{margin:"0 0",paddingLeft:"3em",paddingRight:0},".diff-change-group":{width:"100%",color:A.colors.text.primary,marginBottom:"14px"},".diff-change-item":{display:"inline-block"},".diff-change-title":{fontSize:"16px"},".bullet-position-container":{position:"relative",left:"-6px"},".diff-list-circle":{marginBottom:"3px"}})}var h=e(35484);function u(A,W){const N=W?{}:{overflowY:"auto !important"};return(0,n.css)({"*, *::before, *::after":{boxSizing:"inherit"},"[tabindex='-1']:focus":{outline:"none !important"},html:{MsOverflowStyle:"scrollbar",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",boxSizing:"border-box",height:"100%",fontSize:`${A.typography.htmlFontSize}px`,fontFamily:A.typography.fontFamily,lineHeight:A.typography.body.lineHeight,fontKerning:"normal"},":root":{colorScheme:A.colors.mode},body:{height:"100%",width:"100%",position:"unset",color:A.colors.text.primary,backgroundColor:A.colors.background.canvas,paddingRight:"0 !important","@media print":{overflow:"visible"},"@page":{margin:0,size:"auto",padding:0}
158,fontVariantLigatures:"no-contextual",...A.typography.body,...N},"h1, .h1":i(A.typography.h1),"h2, .h2":i(A.typography.h2),"h3, .h3":i(A.typography.h3),"h4, .h4":i(A.typography.h4),"h5, .h5":i(A.typography.h5),"h6, .h6":i(A.typography.h6),p:{margin:A.spacing(0,0,2)},textarea:{overflow:"auto",resize:"vertical"},button:{letterSpacing:A.typography.body.letterSpacing,"&:focus-visible":(0,h.getFocusStyles)(A),"&:focus":{outline:"none"}},label:{display:"inline-block"},figure:{margin:A.spacing(0,0,2)},img:{verticalAlign:"middle"},fieldset:{minWidth:0,padding:0,margin:0,border:0},legend:{display:"block",width:"100%",padding:0,marginBottom:A.spacing(1),fontSize:A.spacing(3),lineHeight:"inherit",border:0},"small, .small":{fontSize:A.typography.bodySmall.fontSize,fontWeight:"normal"},"b, strong":{fontWeight:A.typography.fontWeightMedium},em:{fontStyle:"italic",color:A.colors.text.primary},cite:{fontStyle:"normal"},blockquote:{padding:A.spacing(0,0,0,2),margin:A.spacing(0,0,2),borderLeft:`5px solid ${A.v1.palette.gray3}`,p:{marginBottom:0,fontSize:A.typography.fontSize*1.25,fontWeight:300,lineHeight:1.25},small:{display:"block",lineHeight:A.typography.body.lineHeight,color:A.v1.palette.gray2,"&:before":{content:"'\\2014 \\00A0'"}}},"q:before, q:after, blockquote:before, blockquote:after":{content:"''"},address:{display:"block",marginBottom:A.spacing(2),fontStyle:"normal",lineHeight:A.typography.body.lineHeight},"a.external-link":{color:A.colors.text.link,textDecoration:"normal","&:hover":{color:A.colors.text.link,textDecoration:"underline"}},".link":{color:A.colors.text.primary,cursor:"pointer"},".link:hover":{color:A.colors.text.maxContrast},".pointer":{cursor:"pointer"},"audio, canvas, progress, video":{display:"inline-block",verticalAlign:"baseline"},"audio:not([controls])":{display:"none",height:0},"abbr[title]":{borderBottom:"1px dotted",cursor:"help"},dfn:{fontStyle:"italic"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},hr:{marginTop:A.spacing(2),marginBottom:A.spacing(2),border:0,borderTop:`1px solid ${A.colors.border.medium}`},"mark, .mark":{background:A.colors.warning.main},"ul, ol, dl":{marginTop:0,marginBottom:0,padding:0},"ul ul, ul ol, ol ol, ol ul":{marginBottom:0},li:{lineHeight:A.typography.body.lineHeight},dd:{marginBottom:A.spacing(1),marginLeft:0},"dt, dd":{lineHeight:A.typography.body.lineHeight},dt:{fontWeight:A.typography.fontWeightMedium},"button, input, optgroup, select, textarea":{borderRadius:0,color:"inherit",font:"inherit",lineHeight:"inherit",margin:0},optgroup:{fontWeight:"bold"},'button, html input[type="button"], input[type="submit"]':{WebkitAppearance:"button",cursor:"pointer"},'input[type="search"]':{WebkitAppearance:"none"},'input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration':{WebkitAppearance:"none"},table:{backgroundColor:"transparent",borderCollapse:"collapse",borderSpacing:0},caption:{paddingTop:A.spacing(.5),paddingBottom:A.spacing(.5),color:A.colors.text.secondary,textAlign:"left",captionSide:"bottom"},th:{fontWeight:A.typography.fontWeightMedium,textAlign:"left"},"td, th":{padding:0},".muted":{color:A.colors.text.secondary},"a.muted:hover, a.muted:focus":{color:A.colors.text.primary},".text-warning":{color:A.colors.warning.text,"&:hover, &:focus":{color:A.colors.emphasize(A.colors.warning.text,.15)}},".text-error":{color:A.colors.error.text,"&:hover, &:focus":{color:A.colors.emphasize(A.colors.error.text,.15)}},".text-success":{color:"$success-text-color","&:hover, &:focus":{color:A.colors.emphasize(A.colors.success.text,.15)}},a:{cursor:"pointer",color:A.colors.text.primary,textDecoration:"none","&:focus":{outline:"none"},"&:focus-visible":(0,h.getFocusStyles)(A),"&:[disabled]":{cursor:"default",pointerEvents:"none !important"}},"[role='button']":{cursor:"pointer"},"[hidden]":{display:"none !important"},"a, area, button, [role='button'], input, label, select, summary, textarea":{touchAction:"manipulation"},".text-link":{textDecoration:"underline"},".text-left":{textAlign:"left"},".text-right":{textAlign:"right"},".text-center":{textAlign:"center"},".highlight-search-match":{background:A.components.textHighlight.background,color:A.components.textHighlight.text,padding:0},".template-variable":{color:A.colors.primary.text},".modal-header-title":{fontSize:A.typography.size.lg,float:"left",paddingTop:A.spacing(1),margin:A.spacing(0,2)}})}function i(A){return{margin:0,fontSize:A.fontSize,lineHeight:A.lineHeight,fontWeight:A.fontWeight,letterSpacing:A.letterSpacing,fontFamily:A.fontFamily,marginBottom:"0.45em"}}function x(A){return(0,n.css)({"iframe.intercom-borderless-frame":{colorScheme:A.colors.mode}})}function g(A){return(0,n.css)({".filter-table *":{boxSizing:"border-box"},".filter-table":{width:"100%",borderCollapse:"separate",tbody:{"tr:nth-of-type(odd)":{background:A.colors.emphasize(A.colors.background.primary,.02)}},th:{width:"auto",padding:A.spacing(.5,1),textAlign:"left",lineHeight:"30px",height:"30px",whiteSpace:"nowrap"},td:{padding:A.spacing(.5,1),lineHeight:"30px",height:"30px",whiteSpace:"nowrap"},".link-td":{padding:0,lineHeight:"30px",height:"30px",whiteSpace:"nowrap",a:{display:"block",padding:A.spacing(0,1),height:"30px"}},".ellipsis":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},".expanded":{borderColor:A.components.panel.background},".expanded > td":{paddingBottom:0},".filter-table__avatar":{width:"25px",height:"25px",borderRadius:"50%"},"&--hover":{"tbody tr:hover":{background:A.colors.emphasize(A.colors.background.primary,.05)}}}})}function p(A){const W=typeof window<"u"&&window.__grafana_public_path__,N=W?`${W}fonts/`:"public/fonts/";return(0,n.css)([{"@font-face":{fontFamily:"Roboto Mono",fontStyle:"normal",fontWeight:400,fontDisplay:"swap",src:`url('${N}roboto/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2') format('woff2')`,unicodeRange:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"}},{"@font-face":{fontFamily:"Roboto Mono",fontStyle:"normal",fontWeight:500,fontDisplay:"swap",src:`url('${N}roboto/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2') format('woff2')`,unicodeRange:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"}},{"@font-face":{fontFamily:"Inter",fontStyle:"normal",fontWeight:400,fontDisplay:"swap",src:`url('${N}inter/Inter-Regular.woff2') format('woff2')`}},{"@font-face":{fontFamily:"Inter",fontStyle:"normal",fontWeight:500,fontDisplay:"swap",src:`url('${N}inter/Inter-Medium.woff2') format('woff2')`}}])}function c(A){return(0,n.css)({"input, button, select, textarea":{fontFamily:A.typography.body.fontFamily,fontSize:A.typography.body.fontSize,fontWeight:A.typography.body.fontWeight,lineHeight:A.typography.body.lineHeight},"input, select":{backgroundColor:A.components.input.background,color:A.components.input.text,border:"none",boxShadow:"none"},"input, textarea":{"&::placeholder":{color:A.colors.text.disabled}},'input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button':{WebkitAppearance:"none",margin:0},'input[type="number"]':{MozAppearance:"textfield"},'select, input[type="file"]':{height:A.components.height.md,lineHeight:A.components.height.md},select:{width:"220px",border:`1px solid ${A.components.input.borderColor}`,backgroundColor:A.components.input.background},"select[multiple], select[size], textarea":{height:"auto"},'select:focus, input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus':{outline:"5px auto -webkit-focus-ring-color",outlineOffset:"-2px"},"input[type='file'], input[type='image'], input[type='submit'], input[type='reset'], input[type='button'], input[type='radio'], input[type='checkbox']":{
158width:"auto"},"input[disabled], select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly]":{cursor:"not-allowed",backgroundColor:A.colors.action.disabledBackground},'input[type="radio"][disabled], input[type="checkbox"][disabled], input[type="radio"][readonly], input[type="checkbox"][readonly]':{cursor:"not-allowed",backgroundColor:"transparent"},"input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill, textarea:-webkit-autofill, textarea:-webkit-autofill:hover, textarea:-webkit-autofill:focus, select:-webkit-autofill, select:-webkit-autofill:hover, select:-webkit-autofill:focus":{WebkitBoxShadow:`0 0 0px 1000px ${A.components.input.background} inset !important`,WebkitTextFillColor:A.components.input.text,boxShadow:`0 0 0px 1000px ${A.components.input.background} inset`,border:`1px solid ${A.components.input.background}`},".gf-form":{display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative",marginBottom:A.spacing(.5),"&--offset-1":{marginLeft:A.spacing(2)},"&--grow":{flexGrow:1},"&--flex-end":{justifyContent:"flex-end"},"&--align-center":{alignContent:"center"},"&--alt":{flexDirection:"column",alignItems:"flex-start",".gf-form-label":{padding:"4px 0"}}},".gf-form--has-input-icon":{position:"relative",marginRight:A.spacing(.5),".gf-form-input-icon":{position:"absolute",top:"8px",fontSize:A.typography.size.lg,left:"10px",color:A.colors.text.disabled},"> input":{paddingLeft:"35px","&:focus + .gf-form-input-icon":{color:A.colors.text.secondary}},".Select--multi .Select-multi-value-wrapper, .Select-placeholder":{paddingLeft:"30px"}},".gf-form-disabled":{color:A.colors.text.secondary,".gf-form-select-wrapper::after":{color:A.colors.text.secondary},"a, .gf-form-input":{color:A.colors.text.secondary}},".gf-form-group":{marginBottom:A.spacing(5)},".gf-form-inline":{display:"flex",flexDirection:"row",flexWrap:"wrap",alignContent:"flex-start","&--nowrap":{flexWrap:"nowrap"},"&--xs-view-flex-column":{flexDirection:"row",flexWrap:"nowrap",[A.breakpoints.down("sm")]:{flexDirection:"column"}},".select-container":{marginRight:A.spacing(.5)},".gf-form-spacing":{marginRight:A.spacing(.5)}},".gf-form-button-row":{paddingTop:A.spacing(3),"a, button":{marginRight:A.spacing(2)}},".gf-form-label":{display:"flex",alignItems:"center",padding:A.spacing(0,1),flexShrink:0,fontWeight:A.typography.fontWeightMedium,fontSize:A.typography.size.sm,backgroundColor:A.colors.background.secondary,height:"32px",lineHeight:"32px",marginRight:A.spacing(.5),borderRadius:A.shape.radius.default,justifyContent:"space-between",border:"none","&--grow":{flexGrow:1},"&--transparent":{backgroundColor:"transparent",border:0,textAlign:"right",paddingLeft:0},"&--variable":{color:A.colors.primary.text,background:A.components.panel.background,border:`1px solid ${A.components.panel.borderColor}`},"&--btn":{border:"none",borderRadius:A.shape.radius.default,"&:hover":{background:A.colors.background.secondary,color:A.colors.text.primary}},"&:disabled":{color:A.colors.text.secondary}},".gf-form-label + .gf-form-label":{marginRight:A.spacing(.5)},".gf-form-pre":{display:"block !important",flexGrow:1,margin:0,marginRight:A.spacing(.5),border:"1px solid transparent",borderLeft:"none",borderRadius:A.shape.radius.default},".gf-form-textarea":{maxWidth:"650px"},".gf-form-input":{display:"block",width:"100%",height:"32px",padding:A.spacing(0,1),fontSize:A.typography.size.md,lineHeight:"18px",color:A.components.input.text,backgroundColor:A.components.input.background,backgroundImage:"none",backgroundClip:"padding-box",border:`1px solid ${A.components.input.borderColor}`,borderRadius:A.shape.radius.default,marginRight:A.spacing(.5),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis","&textarea":{overflow:"auto",whiteSpace:"pre-wrap",padding:`6px ${A.spacing(1)}`,minHeight:"32px",height:"auto"},"&::-ms-expand":{backgroundColor:"transparent",border:0,display:"none"},"&:focus":{borderColor:A.colors.primary.border,outline:"none"},"&::placeholder":{color:A.colors.text.disabled,opacity:1},"&:disabled, &[readonly]":{backgroundColor:A.colors.action.disabledBackgroun
158d,opacity:1},"&:disabled":{cursor:"not-allowed"},"&.gf-size-auto":{width:"auto"},"&--dropdown":{paddingRight:A.spacing(3),position:"relative",display:"flex",alignItems:"center","&::after":{position:"absolute",top:"36%",right:"11px",fontSize:"11px",backgroundColor:"transparent",color:A.colors.text.primary,font:`normal normal normal ${A.typography.size.sm}/1 FontAwesome`,content:'"\f0d7"',pointerEvents:"none"}},"&--has-help-icon":{paddingRight:A.spacing(4)}},".gf-form-select-wrapper":{position:"relative",backgroundColor:A.components.input.background,marginRight:A.spacing(.5),".gf-form-select-icon":{position:"absolute",zIndex:1,top:"50%",marginTop:"-7px","+ .gf-form-input":{position:"relative",zIndex:2,paddingLeft:A.spacing(4),backgroundColor:"transparent",option:{color:A.v1.palette.black}}},".gf-form-input":{marginRight:0,lineHeight:"32px"},"select.gf-form-input":{textIndent:"0.01px",textOverflow:"''",paddingRight:A.spacing(4),appearance:"none","&:-moz-focusring":{outline:"none",color:"transparent",textShadow:`0 0 0 ${A.colors.text.primary}`},"&.ng-empty":{color:A.colors.text.secondary}},"&::after":{position:"absolute",top:"36%",right:"11px",backgroundColor:"transparent",color:A.colors.text.primary,font:`normal normal normal ${A.typography.size.sm}/1 FontAwesome`,content:'"\f0d7"',pointerEvents:"none",fontSize:"11px"},"&--has-help-icon":{"&::after":{right:A.spacing(4)}}},".gf-form--v-stretch":{alignItems:"stretch"},".gf-form-btn":{padding:A.spacing(0,1),marginRight:A.spacing(.5),lineHeight:"18px",fontSize:A.typography.size.sm,flexShrink:0,flexGrow:0},".gf-form-help-icon":{flexGrow:0,color:A.colors.text.secondary,"&:hover":{color:A.colors.text.primary}},".cta-form":{position:"relative",padding:A.spacing(3),backgroundColor:A.colors.background.secondary,marginBottom:A.spacing(3),borderTop:`3px solid ${A.colors.success.main}`},".input-small":{width:"90px"}})}function y(A){return(0,n.css)([])}function P(A){return(0,n.css)({".json-formatter-row":{fontFamily:"monospace","&, a, a:hover":{color:A.colors.text.primary,textDecoration:"none"},".json-formatter-row":{marginLeft:A.spacing(2)},".json-formatter-children":{"&.json-formatter-empty":{opacity:.5,marginLeft:A.spacing(2),"&::after":{display:"none"},"&.json-formatter-object::after":{content:"'No properties'"},"&.json-formatter-array::after":{content:"'[]'"}}},".json-formatter-string":{color:A.isDark?"#23d662":"green",whiteSpace:"pre-wrap",wordWrap:"break-word",wordBreak:"break-all"},".json-formatter-number":{color:A.isDark?A.colors.primary.text:A.colors.primary.main},".json-formatter-boolean":{color:A.isDark?A.colors.primary.text:A.colors.error.main},".json-formatter-null":{color:A.isDark?"#eec97d":"#855a00"},".json-formatter-undefined":{color:A.isDark?"rgb(239, 143, 190)":"rgb(202, 11, 105)"},".json-formatter-function":{color:A.isDark?"#fd48cb":"#ff20ed"},".json-formatter-url":{textDecoration:"underline",color:A.isDark?"#027bff":A.colors.primary.main,cursor:"pointer"},".json-formatter-bracket":{color:A.isDark?"#9494ff":A.colors.primary.main},".json-formatter-key":{color:A.isDark?"#23a0db":"#00008b",cursor:"pointer",paddingRight:A.spacing(.25),marginRight:A.spacing(.5)},".json-formatter-constructor-name":{cursor:"pointer"},".json-formatter-array-comma":{marginRight:A.spacing(.5)},".json-formatter-toggler":{lineHeight:"16px",fontSize:A.typography.size.xs,verticalAlign:"middle",opacity:.6,cursor:"pointer",paddingRight:A.spacing(.25),"&::after":{display:"inline-block",transition:"transform 100ms ease-in",content:"'\u25BA'"}},"> a > .json-formatter-preview-text":{opacity:0,transition:"opacity 0.15s ease-in",fontStyle:"italic"},"&:hover > a > .json-formatter-preview-text":{opacity:.6},"&.json-formatter-open":{"> .json-formatter-toggler-link .json-formatter-toggler::after":{transform:"rotate(90deg)"},"> .json-formatter-children::after":{display:"inline-block"},"> a > .json-formatter-preview-text":{display:"none"},"&.json-formatter-empty::after":{display:"block"}}}})}function d(A){return(0,n.css)({".gf-form-select-box__control":{width:"100%",marginRight:A.spacing(.5),backgroundColor:A.components.input.background,border:`1px solid ${A.components.input.borderColor}
158`,borderRadius:A.shape.radius.default,color:A.components.input.text,cursor:"default",height:A.spacing(4),outline:"none",overflow:"hidden",position:"relative"},".gf-form-select-box__control--is-focused":{backgroundColor:A.components.input.background,borderColor:A.colors.primary.border,outline:"none",boxShadow:`inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px ${A.colors.primary.border}`},".gf-form-select-box__control--is-disabled":{backgroundColor:A.colors.action.disabledBackground},".gf-form-select-box__control--menu-right":{".gf-form-select-box__menu":{right:0,left:"unset"}},".gf-form-select-box__input":{input:{lineHeight:"inherit"}},".gf-form-select-box__menu":{background:A.colors.background.primary,boxShadow:A.shadows.z3,position:"absolute",zIndex:A.zIndex.dropdown,minWidth:"100%","&-notice--no-options":{backgroundColor:A.components.input.background,padding:"10px"}},".gf-form-select-box__menu-list":{overflowY:"auto",maxHeight:"300px",maxWidth:"600px"},".tag-filter .gf-form-select-box__menu":{width:"100%"},".gf-form-select-box__multi-value":{display:"inline",margin:"0 6px 0 0",cursor:"pointer"},".gf-form-select-box__multi-value__remove":{textAlign:"center",display:"inline-block",marginLeft:"2px",position:"relative"},".gf-form-select-box__multi-value__label":{display:"inline",verticalAlign:"middle"},".gf-form-select-box__option":{borderLeft:"2px solid transparent",whiteSpace:"nowrap",backgroundColor:A.components.input.background,"&.gf-form-select-box__option--is-focused":{color:A.colors.text.primary,background:A.colors.action.hover,borderImage:A.colors.gradients.brandVertical,borderImageSlice:1,borderStyle:"solid",borderTop:0,borderRight:0,borderBottom:0,borderLeftWidth:"2px"},"&.gf-form-select-box__option--is-selected":{".fa":{color:A.colors.text.primary}}},".gf-form-select-box__placeholder":{color:A.colors.text.disabled},".gf-form-select-box__control--is-focused .gf-form-select-box__placeholder":{display:"none"},".gf-form-select-box__value-container":{display:"inline-block",padding:"6px 20px 6px 10px",verticalAlign:"middle","> div":{display:"inline-block",verticalAlign:"middle"}},".gf-form-select-box__indicators":{position:"absolute",height:"100%",right:"8px",top:"1px",display:"inline-block",textAlign:"right"},".gf-form-input--form-dropdown":{padding:0,border:0,overflow:"visible",position:"relative"},".gf-form--has-input-icon":{".gf-form-select-box__value-container":{paddingLeft:"30px"}},".gf-form-select-box__desc-option":{display:"flex",alignItems:"center",justifyContent:"flex-start",justifyItems:"center",cursor:"pointer",padding:"7px 10px",width:"100%"},".gf-form-select-box__desc-option__body":{display:"flex",flexDirection:"column",flexGrow:1,paddingRight:"10px",fontWeight:A.typography.fontWeightMedium},".gf-form-select-box__desc-option__desc":{fontWeight:"normal",fontSize:A.typography.bodySmall.fontSize,color:A.colors.text.secondary},".gf-form-select-box__desc-option__img":{width:"16px",marginRight:"10px"},".gf-form-select-box__option-group__header":{display:"flex",alignItems:"center",justifyContent:"flex-start",justifyItems:"center",cursor:"pointer",padding:"7px 10px",width:"100%",borderBottom:`1px solid ${A.v1.palette.dark9}`,textTransform:"capitalize",".fa":{paddingRight:"2px"}},".gf-form-select-box-button-select":{height:"auto"},".select-button":{display:"flex",alignItems:"center"}})}function D(A){return(0,n.css)({".markdown-html":{img:{maxWidth:"100%"},"ul, ol":{paddingLeft:A.spacing(3),marginBottom:A.spacing(2)},table:{marginBottom:A.spacing(2),"td, th":{padding:A.spacing(.5,1)},th:{fontWeight:A.typography.fontWeightMedium,background:A.colors.background.secondary}},"table, th, td":{border:`1px solid ${A.colors.border.medium}`,borderCollapse:"collapse"},a:{color:A.colors.text.link,textDecoration:"none","&:hover":{color:A.colors.text.link,textDecoration:"underline"}},"p:last-child":{marginBottom:0},"table:last-child, ul:last-child, ol:last-child":{marginBottom:0}}})}function b(A){const W=A.breakpoints.values.xxl+A.spacing.gridSize*2+A.components.sidemenu.width;return(0,n.css)({".grafana-app":{display:"flex",flexDirection:"column",height:"100vh"},".main-view":{display:"flex",flexDirection:"column",flexGrow:1,position:"relative",minWidth:0},".page-scrollbar-content":{display:"flex",minHeight:"100%",flexDirection:"column",width:"100%",height:"100%"},".page-container":{flexGrow:1,flexBasis:"100%",paddingLeft:A.spacing(2),paddingRight:A.spacing(2),[A.breakpoints.up("sm")]:{margin:A.spacing(0,1)},[A.breakpoints.up("md")]:{margin:A.spacing(0,2)},[`@media (min-width: ${W}px)`]:{maxWidth:`${A.breakpoints.values.xxl}px`,marginLeft:"auto",marginRight:"auto",width:"100%"}},".page-full":{marginLeft:A.spacing(2),paddingLeft:A.spacing(2),paddingRight:A.spacing(2)},".page-body":{padding:A.spacing(1),background:A.components.panel.background,border:`1px solid ${A.components.panel.borderColor}`,marginBottom:"32px",[A.breakpoints.up("md")]:{padding:A.spacing(2)},[A.breakpoints.up("lg")]:{padding:A.spacing(3)}},".page-heading":{fontSize:A.typography.h4.fontSize,marginTop:0,marginBottom:A.spacing(2)},".page-action-bar":{marginBottom:A.spacing(2),display:"flex",alignItems:"flex-start",ga
158p:A.spacing(2)},".page-action-bar--narrow":{marginBottom:0},".page-action-bar__spacer":{width:A.spacing(2),flexGrow:1},".page-sub-heading":{marginBottom:A.spacing(2)},".page-sub-heading-icon":{marginLeft:A.spacing(1),marginTop:A.spacing(.5)},".page-hidden":{display:"none"}})}function E(A){return(0,n.css)({".query-editor-row":{marginBottom:"2px","&--disabled":{".query-keyword":{color:A.colors.text.secondary}}},".query-keyword":{fontWeight:A.typography.fontWeightMedium,color:`${A.colors.primary.text} !important`},".query-part":{backgroundColor:A.colors.background.secondary,"&:hover":{background:A.colors.emphasize(A.colors.background.secondary,.03)}},".query-segment-operator":{color:`${A.v1.palette.orange} !important`},".tight-form-func":{background:A.colors.background.secondary},'input[type="text"].tight-form-func-param':{fontSize:A.typography.bodySmall.fontSize,background:"transparent",border:"none",margin:0,padding:0},".tight-form-func-controls":{textAlign:"center",".fa-arrow-left":{float:"left",position:"relative",top:2},".fa-arrow-right":{float:"right",position:"relative",top:2},".fa-remove":{marginLeft:"10px"}}})}var v=e(21348);const C=A=>(0,n.css)({".react-loading-skeleton":v.Q});function S(A){return(0,n.css)({".slate-query-field":{fontSize:A.typography.fontSize,fontFamily:A.typography.fontFamilyMonospace,height:"auto",wordBreak:"break-word",overflow:"auto"},".slate-query-field__wrapper":{position:"relative",display:"inline-block",padding:"6px 8px",minHeight:"32px",width:"100%",color:A.colors.text.primary,backgroundColor:A.components.input.background,backgroundImage:"none",border:`1px solid ${A.components.input.borderColor}`,borderRadius:A.shape.radius.default,transition:"all 0.3s",lineHeight:"18px"},".slate-query-field__wrapper--disabled":{backgroundColor:"inherit",cursor:"not-allowed"},".slate-typeahead":{".typeahead":{position:"relative",zIndex:A.zIndex.typeahead,borderRadius:A.shape.radius.default,border:`1px solid ${A.components.panel.borderColor}`,maxHeight:"66vh",overflowY:"scroll",overflowX:"hidden",outline:"none",listStyle:"none",background:A.components.panel.background,color:A.colors.text.primary,boxShadow:A.shadows.z2},".typeahead-group__title":{color:A.colors.text.secondary,fontSize:A.typography.size.sm,lineHeight:A.typography.body.lineHeight,padding:A.spacing(1)},".typeahead-item":{height:"auto",fontFamily:A.typography.fontFamilyMonospace,padding:A.spacing(1,1,1,2),fontSize:A.typography.size.sm,textOverflow:"ellipsis",overflow:"hidden",zIndex:1,display:"block",whiteSpace:"nowrap",cursor:"pointer",transition:"color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), padding 0.15s cubic-bezier(0.645, 0.045, 0.355, 1)"},".typeahead-item__selected":{backgroundColor:A.isDark?A.v1.palette.dark9:A.v1.palette.gray6,".typeahead-item-hint":{fontSize:A.typography.size.xs,color:A.colors.text.primary,whiteSpace:"normal"}},".typeahead-match":{color:A.v1.palette.yellow,borderBottom:`1px solid ${A.v1.palette.yellow}`,padding:"inherit",background:"inherit"}},".slate-query-field, .prism-syntax-highlight":{".token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata":{color:A.colors.text.secondary},".token.variable, .token.entity":{color:A.colors.text.primary},".token.property, .token.tag, .token.constant, .token.symbol, .token.deleted":{color:A.colors.error.text},".token.attr-value, .token.selector, .token.string, .token.char, .token.builtin, .token.inserted":{color:A.colors.success.text},".token.boolean, .token.number, .token.operator, .token.url":{color:"#fe85fc"},".token.function, .token.attr-name, .token.function-name, .token.atrule, .token.keyword, .token.class-name":{color:A.colors.primary.text},".token.punctuation, .token.regex, .token.important":{color:A.v1.palette.orange},".token.important":{fontWeight:"normal"},".token.bold":{fontWeight:"bold"},".token.italic":{fontStyle:"italic"},".token.entity":{cursor:"help"},".namespace":{opacity:.7}}})}function O(A){return(0,n.css)({".uplot":{fontFamily:"inherit"},".u-select":{background:"rgba(120, 120, 130, 0.2)"},".u-hz .u-cursor-x, .u-vt .u-cursor-y":{borderRight:"1px dashed rgba(120, 120, 130, 0.5)"},".u-hz .u-cursor-y, .u-vt .u-cursor-x":{borderBottom:"1px dashed rgba(120, 120, 130, 0.5)"},".shared-crosshair:not(.plot-active) .u-cursor-pt":{display:"none !important"}})}function I(A,W,N="#fff",w="0px 1px 0 rgba(0, 0, 0, 0.1)"){return{backgroundColor:A,backgroundImage:`linear-gradient(to bottom, ${A}, ${W})`,backgroundRepeat:"repeat-x",color:N,textShadow:w,borderColor:A,"&:hover, &:focus, &:active, &.active, &.disabled, &[disabled]":{color:N,backgroundImage:"none",backgroundColor:A}}}function R(A,W,N,w){return{padding:`${A} ${W}`,fontSize:N,borderRadius:w}}function T(A,W){let N={};for(let w=1;w<=W;w++){const j=`${A.spacing(2*w)} !important`;N[`.width-${w}`]={width:j},N[`.max-width-${w}`]={maxWidth:j,flexGrow:1},N[`.min-width-${w}`]={minWidth:j},N[`.offset-width-${w}`]={marginLeft:j}}return N}function L(A){return(0,n.css)({".highlight-word":{color:A.v1.palette.orange},".hide":{display:"none"},".show":{display:"block"},".invisible":{visibility:"hidden !important"},".absolute":{position:"absolute"},".flex-grow-1":{flexGrow:1},".flex-shrink-1":{flexShrink:1},".flex-shrink-0":{flexShrink:0},".center-vh":{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",justifyItems:"center"},".btn":{display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:A.typography.fontWeightMedium,lineHeight:A.typography.body.lineHeight,textAlign:"center",verticalAlign:"middle",curs
158or:"pointer",border:"none",height:`${A.spacing.gridSize*A.components.height.md}px`,...R(A.spacing(0),A.spacing(2),`${A.typography.fontSize}px`,A.shape.radius.default),"&, &:active, &.active":{"&:focus, &.focus":{outline:"none"}},"&:focus, &:hover":{textDecoration:"none"},"&.focus":{textDecoration:"none"},"&:active, &.active":{backgroundImage:"none",outline:0},"&.disabled, &[disabled], &:disabled":{cursor:"not-allowed",opacity:.65,boxShadow:"none",pointerEvents:"none"}},".btn-small":{...R(A.spacing(.5),A.spacing(1),A.typography.size.sm,A.shape.radius.default),height:`${A.spacing.gridSize*A.components.height.sm}px`},".btn-mini":{...R(A.spacing(.5),A.spacing(1),A.typography.size.sm,A.shape.radius.default),height:`${A.spacing.gridSize*A.components.height.sm}px`},".btn-success, .btn-primary":{...I(A.colors.primary.main,A.colors.primary.shade)},".btn-danger":{...I(A.colors.error.main,A.colors.error.shade)},".btn-secondary":{...I(A.colors.secondary.main,A.colors.secondary.shade,A.colors.text.primary)},".btn-inverse":{...I(A.isDark?A.v1.palette.dark6:A.v1.palette.gray5,A.isDark?A.v1.palette.dark5:A.v1.palette.gray4,A.colors.text.primary),"&":{boxShadow:"none"}},".typeahead":{zIndex:A.zIndex.typeahead},...T(A,30),".row":{display:"flex",flexWrap:"wrap",marginLeft:`calc(${A.spacing(4)} / -2)`,marginRight:`calc(${A.spacing(4)} / -2)`},".container":{marginLeft:"auto",marginRight:"auto",paddingLeft:`calc(${A.spacing(4)} / 2)`,paddingRight:`calc(${A.spacing(4)} / 2)`,[A.breakpoints.up("sm")]:{maxWidth:A.breakpoints.values.sm},[A.breakpoints.up("md")]:{maxWidth:A.breakpoints.values.md},[A.breakpoints.up("lg")]:{maxWidth:A.breakpoints.values.lg},[A.breakpoints.up("xl")]:{maxWidth:A.breakpoints.values.xl}}})}function K(A){const W=(0,r.$j)(),{isExtensionSidebarOpen:N}=A;return(0,t.jsx)(n.Global,{styles:[o(W),s(W),a(W),f(W),l(W),u(W,N),x(W),g(W),p(W),c(W),P(W),m(W),D(W),b(W),E(W),C(W),S(W),O(W),L(W),d(W),y({})]})}},71857:(ee,B,e)=>{"use strict";e.d(B,{kH:()=>l.k,Dx:()=>t.D,O4:()=>s,mG:()=>m,fq:()=>n.fq,YF:()=>f,N3:()=>a.N,IS:()=>n.IS,of:()=>n.of,DP:()=>n.DP,$j:()=>n.$j,SL:()=>n.SL,cV:()=>n.cV});var t=e(35555),n=e(63142),r=e(69884);let o;const s=(h="dark")=>o?o(h):(0,r.a)({colors:{mode:h}}).v1,m=h=>(o=h,()=>{o=null});var a=e(65240),l=e(77345),f=e(35484)},53926:(ee,B,e)=>{"use strict";e.d(B,{I:()=>t});var t=(n=>(n.GroupTitle="GroupTitle",n))(t||{})},77420:()=>{"use strict"},74527:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{CompletionItemKind:()=>s.I,getAvailableIcons:()=>l.GO,getFieldTypeIcon:()=>l.SS,getFieldTypeIconName:()=>l.lV,isIconSize:()=>l.rJ,toIconName:()=>l.Uo});var t=e(49578),n=e.n(t),p={};for(const c in t)c!=="default"&&(p[c]=()=>t[c]);e.d(B,p);var r=e(82511),o=e.n(r),p={};for(const c in r)c!=="default"&&(p[c]=()=>r[c]);e.d(B,p);var s=e(53926),m=e(77420),a=e.n(m),p={};for(const c in m)["default","CompletionItemKind"].indexOf(c)<0&&(p[c]=()=>m[c]);e.d(B,p);var l=e(97958),f=e(8963),h=e.n(f),p={};for(const c in f)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","isIconSize","toIconName"].indexOf(c)<0&&(p[c]=()=>f[c]);e.d(B,p);var u=e(5138),i=e.n(u),p={};for(const c in u)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","isIconSize","toIconName"].indexOf(c)<0&&(p[c]=()=>u[c]);e.d(B,p);var x=e(58479),g=e.n(x),p={};for(const c in x)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","isIconSize","toIconName"].indexOf(c)<0&&(p[c]=()=>x[c]);e.d(B,p)},82511:()=>{"use strict"},58479:()=>{"use strict"},8963:()=>{"use strict"},5138:()=>{"use strict"},49578:()=>{"use strict"},14226:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>t});const t=(n,r)=>{n.key==="Tab"||n.altKey||n.ctrlKey||n.metaKey||(n.stopPropagation(),n.key==="Escape"&&r())}},8255:(ee,B,e)=>{"use strict";e.d(B,{Ih:()=>y,Mk:()=>s,Tj:()=>u,UJ:()=>h,Xw:()=>m,ct:()=>f,mZ:()=>c,nO:()=>l,sg:()=>p,xj:()=>a});var t=e(2543),n=e.n(t),r=e(84140);const o=4,s="rgba(0, 211, 255, 1)",m="rgba(11, 237, 50, 1)",a="rgba(237, 46, 24, 1)",l="rgba(150, 150, 150, 1)",f="rgba(247, 149, 32, 1)",h=.09,u=["#7EB26D","#EAB839","#6ED0E0","#EF843C","#E24D42","#1F78C1","#BA43A9","#705DA0","#508642","#CCA300","#447EBC","#C15C17","#890F02","#0A437C","#6D1F62","#584477","#B7DBAB","#F4D598","#70DBED","#F9BA8F","#F29191","#82B5D8","#E5A8E2","#AEA2E0","#629E51","#E5AC0E","#64B0C8","#E0
158752D","#BF1B00","#0A50A1","#962D82","#614D93","#9AC48A","#F2C96D","#65C5DB","#F9934E","#EA6460","#5195CE","#D683CE","#806EB7","#3F6833","#967302","#2F575E","#99440A","#58140C","#052B51","#511749","#3F2B5B","#E0F9D7","#FCEACA","#CFFAFF","#F9E2D2","#FCE2DE","#BADFF4","#F9D9F9","#DEDAF7"];function i(P){const d=(0,t.map)(P,x),D=(0,t.sortBy)(d,["h"]),b=(0,t.chunk)(D,o),E=(0,t.map)(b,C=>(0,t.sortBy)(C,"l")),v=(0,t.flattenDeep)((0,t.zip)(...E));return(0,t.map)(v,g)}function x(P){return(0,r.A)(P).toHsl()}function g(P){return(0,r.A)(P).toHexString()}function p(P){return(0,r.A)(P).getBrightness()>180?"rgb(32, 34, 38)":"rgb(247, 248, 250)"}function c(P,d){const D=(0,r.A)(P),b=D.getBrightness();return D.getAlpha()<.3?d?"rgb(247, 248, 250)":"rgb(32, 34, 38)":b>180?"rgb(32, 34, 38)":"rgb(247, 248, 250)"}let y=i(u)},75254:(ee,B,e)=>{"use strict";e.d(B,{J:()=>t});const t=n=>n().map(r=>({label:r.title,ariaLabel:r.title,url:r.href,target:r.target,icon:`${r.target==="_blank"?"external-link-alt":"link"}`,onClick:r.onClick}))},20720:(ee,B,e)=>{"use strict";e.d(B,{h:()=>t});function t(n,r,o){}},28473:(ee,B,e)=>{"use strict";e.d(B,{i:()=>t});function t(n){const o=n.lastIndexOf("."),s=n.substring(o),m=n.substring(0,o);return m.length<16?n:`${m.substring(0,16)}...${s}`}},63267:(ee,B,e)=>{"use strict";e.d(B,{I:()=>r});var t=e(2543),n=e.n(t);function r(o,s){let m=0,a=o.indexOf(s);s=s.replace(/\s/g,"");const l=[];if(a!==-1)return{distance:0,found:!0,ranges:[{start:a,end:a+s.length-1}]};for(const f of s){const h=o.indexOf(f,a);if(h===-1)return{distance:1/0,ranges:[],found:!1};if(a!==-1&&(m+=h-a),a=h+1,l.length===0)l.push({start:h,end:h});else{const u=(0,t.last)(l);h===u.end+1?u.end++:l.push({start:h,end:h})}}return{distance:m,ranges:l,found:!0}}},47479:(ee,B,e)=>{"use strict";e.d(B,{xj:()=>s.xj,Mk:()=>s.Mk,bk:()=>t,Pw:()=>m.Pw,nO:()=>s.nO,uc:()=>d,Xw:()=>s.Xw,ct:()=>s.ct,UJ:()=>s.UJ,zt:()=>o,yx:()=>a.yx,Tt:()=>c.T,hF:()=>P.h,Vr:()=>x.Vr,Tj:()=>s.Tj,h:()=>y.h,b3:()=>g.b,It:()=>D.I,Yc:()=>x.Yc,kl:()=>i.k,XJ:()=>u,yC:()=>f.yC,JF:()=>f.JF,MC:()=>f.MC,mZ:()=>s.mZ,sg:()=>s.sg,K:()=>m.K,Jl:()=>l.J,DD:()=>b,dF:()=>a.dF,mO:()=>a.mO,kD:()=>x.kD,RP:()=>m.RP,Ih:()=>s.Ih,CH:()=>p.C,Ct:()=>g.C,tf:()=>m.tf});var t={};e.r(t),e.d(t,{getNextCharacter:()=>r,getPreviousCousin:()=>n}),typeof window<"u"&&"Element"in window&&!Element.prototype.closest&&(Element.prototype.closest=function(E){const v=(this.document||this.ownerDocument).querySelectorAll(E);let C=this,S;do{for(S=v.length;--S>=0&&v.item(S)!==C;);C=C.parentElement}while(S<0&&C);return C});function n(E,v){let C=E.parentElement?.previousSibling,S;for(;C;){if(C instanceof HTMLElement&&(S=C.querySelector(v)),S)return S;C=C.previousSibling}}function r(E){const v=(E||window).getSelection();if(!v||!v.anchorNode)return null;const C=v.getRangeAt(0),S=v.anchorNode.textContent,O=C.startOffset;return S.slice(O,O+1)}var o=e(44019),s=e(8255),m=e(75745),a=e(35458),l=e(75254),f=e(48542);let h=null;function u(){if(h!==null)return h;if(typeof document<"u"){const E=document.createElement("div"),v={width:"100px",height:"100px",position:"absolute",top:"-9999px",overflow:"scroll",MsOverflowStyle:"scrollbar"};Object.keys(v).map(C=>{E.style[C]=v[C]}),document.body.appendChild(E),h=E.offsetWidth-E.clientWidth,document.body.removeChild(E)}else h=0;return h||0}var i=e(86059),x=e(53568),g=e(36324),p=e(79104),c=e(59258),y=e(60379),P=e(20720),d=(E=>(E.id="id",E.title="title",E.subTitle="subTitle",E.mainStat="mainStat",E.secondaryStat="secondaryStat",E.source="source",E.target="target",E.detail="detail__",E.arc="arc__",E.color="color",E))(d||{}),D=e(63267);function b(E,v,C,S){if(E>v){const O=`[Combobox] Items exceed the recommended amount ${v}.`;console.warn(O,{itemsCount:""+E,recommendedAmount:""+v,"aria-labelledby":S??"",id:C??""})}}},60379:(ee,B,e)=>{"use strict";e.d(B,{h:()=>o});var t=e(2543),n=e.n(t);const r=(0,t.throttle)((...s)=>{console.log(...s)},500),o=s=>{let m=!1;return typeof window<"u"&&(m=window.localStorage.getItem("grafana.debug")==="true"),{logger:(a,l=!1,...f)=>{},enable:()=>m=!0,disable:()=>m=!1,isEnabled:()=>m}}},53568:(ee,B,e)=>{"use strict";e.d(B,{Vr:()=>a,Yc:()=>s,kD:()=>m});let t;const n=new Map,r=500;let o="";function s(){return t||(t=document.createElement("canvas").getContext("2d")),t}
158function m(l,f,h=400){const u=`${h} ${f}px 'Inter'`,i=l+u,x=n.get(i);if(x)return x;const g=s();o!==u&&(g.font=o=u);const p=g.measureText(l);return n.size===r&&n.clear(),n.set(i,p),p}function a(l,f,h,u,i,x){const g=m(l,14,x),p=f/(g.width+2)*14,c=h/u,y=Math.min(c,p);return Math.min(y,i??y)}},44019:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{getChildId:()=>n,renderOrCallToRender:()=>r});var t=e(96540);function n(o){let s;const m=t.Children.only(o);return"id"in m?.props?s=m.props.id:"inputId"in m.props&&(s=m?.props.inputId),typeof s=="string"?s:void 0}function r(o,s){if(t.isValidElement(o)||typeof o=="string"||typeof o=="number")return o;if(typeof o=="function"&&s)return o(s);throw new Error(`${o} is not a React element nor a function that returns React element`)}},59258:(ee,B,e)=>{"use strict";e.d(B,{H:()=>m,T:()=>n});var t=e(63267),n=(a=>(a.Word="Word",a.Prefix="Prefix",a.Fuzzy="Fuzzy",a))(n||{});const m={Word:(a,l)=>a.filter(f=>(f.filterText||f.label).includes(l)),Prefix:(a,l)=>a.filter(f=>(f.filterText||f.label).startsWith(l)),Fuzzy:(a,l)=>(l=l.toLowerCase(),a.filter(f=>{const{distance:h,ranges:u,found:i}=(0,t.I)(f.label.toLowerCase(),l);return i?(f.sortValue=h,f.highlightParts=u,!0):!1}))}},21348:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>o,j:()=>s});var t=e(74848),n=e(22803);const o={animationName:(0,n.keyframes)({"0%":{opacity:0},"100%":{opacity:1}}),animationDelay:"100ms",animationTimingFunction:"ease-in",animationDuration:"100ms",animationFillMode:"backwards"},s=(m,a)=>Object.assign(m,{Skeleton:f=>(0,t.jsx)(a,{...f,rootProps:{style:o}})})},35458:(ee,B,e)=>{"use strict";e.d(B,{dF:()=>r,mO:()=>o,yx:()=>n});var t=e(82611);const n={document:{nodes:[{match:[{type:"paragraph"},{type:"code_block"},{type:"code_line"}]}]},inlines:{}},r=(s,m)=>{const a=s.split(` 159`).map(f=>t.Block.create({type:"code_line",nodes:[t.Text.create(f)]})),l=t.Block.create({data:{syntax:m},type:"code_block",nodes:a});return t.Document.create({nodes:[l]})},o=(s,m)=>{const a=r(s,m);return t.Value.create({document:a})}},86059:(ee,B,e)=>{"use strict";e.d(B,{k:()=>t});const t=(n,r)=>{let o;if(n.getLinks&&(o=n.getLinks({valueRowIndex:r.index})),!!o){for(let s=0;s<o?.length;s++)if(o[s].onClick){const m=o[s].onClick;o[s].onClick=a=>{a.ctrlKey||a.metaKey||a.shiftKey||(a.preventDefault(),m(a,{field:n,rowIndex:r.index}))}}return o}}},48542:(ee,B,e)=>{"use strict";e.d(B,{JF:()=>r,MC:()=>o,yC:()=>s});const t=["#D32D20","#1E72B8","#B240A2","#705DA0","#466803","#497A3C","#3D71AA","#B15415","#890F02","#6E6E6E","#0A437C","#6D1F62","#584477","#4C7A3F","#2F4F4F","#BF1B00","#7662B1","#8A2EB8","#517A00","#000000","#3F6833","#2F575E","#99440A","#AE561A","#0E4AB4","#58140C","#052B51","#511749","#3F2B5B"],n=["#FF7368","#459EE7","#E069CF","#9683C6","#6C8E29","#76AC68","#6AA4E2","#E7823D","#AF3528","#9B9B9B","#3069A2","#934588","#7E6A9D","#88C477","#557575","#E54126","#A694DD","#B054DE","#8FC426","#262626","#658E59","#557D84","#BF6A30","#FF9B53","#3470DA","#7E3A32","#2B5177","#773D6F","#655181"];function r(l=""){const f=m(l.toLowerCase());return Math.abs(f%t.length)}function o(l=""){const f=r(l);return s(f)}function s(l){return{color:t[l],borderColor:n[l]}}function m(l){let f=5381;for(let h=0;h<l.length;h++)f=(f<<5)+f+l.charCodeAt(h);return f}var a={getTagColorsFromName:o}},79104:(ee,B,e)=>{"use strict";e.d(B,{C:()=>n});var t=e(96540);function n(){const[r,o]=(0,t.useState)(0);return(0,t.useCallback)(()=>o(s=>s+1),[])}},36324:(ee,B,e)=>{"use strict";e.d(B,{C:()=>r,b:()=>n});var t=e(96540);function n(m=10){let a={x:0,y:0};return{set:h=>{a=o(h)},check:(h,u=m)=>s(a,o(h),u)}}function r(m=10){const a=t.useRef({x:0,y:0}),l=(0,t.useCallback)(h=>{a.current=o(h)},[]),f=(0,t.useCallback)((h,u=m)=>s(a.current,o(h),u),[m]);return(0,t.useMemo)(()=>({set:l,check:f}),[l,f])}function o(m){return{x:m.clientX,y:m.clientY}}function s(m,a,l){return Math.hypot(m.x-a.x,m.y-a.y)>l}},75745:(ee,B,e)=>{"use strict";e.d(B,{K:()=>r,Pw:()=>t,RP:()=>o,tf:()=>n});var t=(s=>(s.onBlur="onBlur",s.onFocus="onFocus",s.onChange="onChange",s))(t||{});const n=(s,m)=>{const a=m.reduce((l,f)=>f.rule(s)?l:l.concat(f.errorMessage),[]);return a.length>0?a:null},r=(s,m)=>m&&m[s],o=(s,m)=>({rule:a=>
159!!a.match(s),errorMessage:m||"Value is not valid"})},143:(ee,B,e)=>{"use strict";e.d(B,{b:()=>l,k:()=>f});var t=e(75816),n=e(73892),r=e(85618);const o=(0,r.T)("folder.grafana.app","v0alpha1"),s=(0,t.xP)({reducerPath:"folderAPI",baseQuery:(0,n.W)({baseURL:o}),endpoints:()=>({})}),m=["Folder"],l=s.enhanceEndpoints({addTagTypes:m}).injectEndpoints({endpoints:h=>({getFolder:h.query({query:u=>({url:`/folders/${u.name}`,params:{pretty:u.pretty}}),providesTags:["Folder"]})}),overrideExisting:!1}).enhanceEndpoints({}),{useGetFolderQuery:f}=l},14375:(ee,B,e)=>{"use strict";e.d(B,{C:()=>o,F:()=>s});var t=e(75816),n=e(43173),r=e(73892);const o=`apis/provisioning.grafana.app/v0alpha1/namespaces/${n.$.namespace}`,s=(0,t.xP)({reducerPath:"provisioningAPI",baseQuery:(0,r.W)({baseURL:o}),endpoints:()=>({})})},19164:(ee,B,e)=>{"use strict";e.d(B,{Ko:()=>V,tj:()=>d,bS:()=>C,ZL:()=>u,L:()=>L,Qo:()=>D,So:()=>p,KA:()=>i,F9:()=>W,Bm:()=>c,Kw:()=>y,$j:()=>E,qC:()=>v,$9:()=>S,Sw:()=>x,nS:()=>I,c2:()=>R,v$:()=>N,L3:()=>l,Ih:()=>h,XM:()=>P,hD:()=>g});var t=e(68143),n=e(6890),r=e(64762),o=e(56840),s=e(14375);const m=["Job","Repository","Provisioning"],a=s.F.enhanceEndpoints({addTagTypes:m}).injectEndpoints({endpoints:U=>({listJob:U.query({query:F=>({url:"/jobs",params:{allowWatchBookmarks:F.allowWatchBookmarks,continue:F.continue,fieldSelector:F.fieldSelector,labelSelector:F.labelSelector,limit:F.limit,pretty:F.pretty,resourceVersion:F.resourceVersion,resourceVersionMatch:F.resourceVersionMatch,sendInitialEvents:F.sendInitialEvents,timeoutSeconds:F.timeoutSeconds,watch:F.watch}}),providesTags:["Job"]}),getJob:U.query({query:F=>({url:`/jobs/${F.name}`,params:{pretty:F.pretty}}),providesTags:["Job"]}),listRepository:U.query({query:F=>({url:"/repositories",params:{pretty:F.pretty,allowWatchBookmarks:F.allowWatchBookmarks,continue:F.continue,fieldSelector:F.fieldSelector,labelSelector:F.labelSelector,limit:F.limit,resourceVersion:F.resourceVersion,resourceVersionMatch:F.resourceVersionMatch,sendInitialEvents:F.sendInitialEvents,timeoutSeconds:F.timeoutSeconds,watch:F.watch}}),providesTags:["Repository"]}),createRepository:U.mutation({query:F=>({url:"/repositories",method:"POST",body:F.repository,params:{pretty:F.pretty,dryRun:F.dryRun,fieldManager:F.fieldManager,fieldValidation:F.fieldValidation}}),invalidatesTags:["Repository"]}),deletecollectionRepository:U.mutation({query:F=>({url:"/repositories",method:"DELETE",params:{pretty:F.pretty,continue:F.continue,dryRun:F.dryRun,fieldSelector:F.fieldSelector,gracePeriodSeconds:F.gracePeriodSeconds,ignoreStoreReadErrorWithClusterBreakingPotential:F.ignoreStoreReadErrorWithClusterBreakingPotential,labelSelector:F.labelSelector,limit:F.limit,orphanDependents:F.orphanDependents,propagationPolicy:F.propagationPolicy,resourceVersion:F.resourceVersion,resourceVersionMatch:F.resourceVersionMatch,sendInitialEvents:F.sendInitialEvents,timeoutSeconds:F.timeoutSeconds}}),invalidatesTags:["Repository"]}),getRepository:U.query({query:F=>({url:`/repositories/${F.name}`,params:{pretty:F.pretty}}),providesTags:["Repository"]}),replaceRepository:U.mutation({query:F=>({url:`/repositories/${F.name}`,method:"PUT",body:F.repository,params:{pretty:F.pretty,dryRun:F.dryRun,fieldManager:F.fieldManager,fieldValidation:F.fieldValidation}}),invalidatesTags:["Repository"]}),deleteRepository:U.mutation({query:F=>({url:`/repositories/${F.name}`,method:"DELETE",params:{pretty:F.pretty,dryRun:F.dryRun,gracePeriodSeconds:F.gracePeriodSeconds,ignoreStoreReadErrorWithClusterBreakingPotential:F.ignoreStoreReadErrorWithClusterBreakingPotential,orphanDependents:F.orphanDependents,propagationPolicy:F.propagationPolicy}}),invalidatesTags:["Repository"]}),getRepositoryFiles:U.query({query:F=>({url:`/repositories/${F.name}/files/`,params:{ref:F.ref}}),providesTags:["Repository"]}),getRepositoryFilesWithPath:U.query({query:F=>({url:`/repositories/${F.name}/files/${F.path}`,params:{ref:F.ref}}),providesTags:["Repository"]}),replaceRepositoryFilesWithPath:U.mutation({query:F=>({url:`/repositories/${F.name}/files/${F.path}`,method:"PUT",body:F.body,params:{ref:F.ref,message:F.message}}),invalidatesTags:["Repository"]}),createRepositoryFilesWithPath:U.mutation({query:F=>({url:`/repositories/${F.name}/files/${F.path}`,method:"POST",body:F.body,params:{ref:F.ref,message:F.message}}),invalidatesTags:["Repository"]}),deleteRepositoryFilesWithPath:U.mutation({query:F=>({url:`/repositories/${F.name}/files/${F.path}`,method:"DELETE",params:{ref:F.ref,message:F.message}}),invalidatesTags:["Repository"]}),getRepositoryHistory:U.query({query:F=>({url:`/repositories/${F.name}/history`,params:{ref:F.ref}}),providesTags:["Repository"]}),getRepositoryHistoryWithPath:U.query({query:F=>({url:`/repositories/${F.name}/history/${F.path}`,params:{ref:F.ref}}),providesTags:["Repository"]}),getRepositoryJobs:U.query({query:F=>({url:`/repositories/${F.name}/jobs`}),providesTags:["Repository"]}),createRepositoryJobs:U.mutation({query:F=>({url:`/repositories/${F.name}/jobs`,method:"POST",body:F.jobSpec}),invalidatesTags:["Repository"]}),getRepositoryJobsWithPath:U.query({query:F=>({url:`/repositories/${F.name}/jobs/${F.uid}`}),providesTags:["Repository"]}),getRepositoryRenderWithPath:U.query({query:F=>({url:`/repositories/${F.name}/render/${F.guid}`}),providesTags:["Repository"]}),getRepositoryResources:U.query({query:F=>({url:`/repositories/${F.name}/resources`}),providesTags:["Repository"]}),getRepositoryStatus:U.query({query:F=>({url:`/repositories/${F.name}/status`,params:{pretty:F.pretty}}),providesTags:["Repository"]}),replaceRepositoryStatus:U.mutation({query:F=>({url:`/repositories/${F.name}/status`,method:"PUT",body:F.repository,params:{pretty:F.pretty,dryRun:F.dryRun,fieldManager:F.fieldManager,fieldValidation:F.fieldValidation}}),invalidatesTags:["Repository"]}),createRepositoryTest:U.mutation({query:F=>({url:`/repositories/${F.name}/test`,method:"POST",body:F.body}),invalidatesTags:["Repository"]}),getRepositoryWebhook:U.query({query:F=>({url:`/repositories/${F.name}/webhook`}),providesTags:["Repository"]}),createRepositoryWebhook:U.mutation({query:F=>({url:`/repositories/${F.name}/webhook`,method:"POST"}),invalidatesTags:["Repository"]}),getFrontendSettings:U.query({query:()=>({url:"/settings"}),providesTags:["Provisioning","Repository"]}),getResourceStats:U.query({query:()=>({url:"/stats"}),providesTags:["Provisioning","Repository"]})}),overrideExisting:!1}),{useListJobQuery:l,useGetJobQuery:f,useListRepositoryQuery:h,useCreateRepositoryMutation:u,useDeletecollectionRepositoryMutation:i,useGetRepositoryQuery:x,useReplaceRepositoryMutation:g,useDeleteRepositoryMutation:p,useGetRepositoryFilesQuery:c,useGetRepositoryFilesWithPathQuery:y,useReplaceRepositoryFilesWithPathMutation:P,useCreateRepositoryFilesWithPathMutation:d,useDeleteRepositoryFilesWithPathMutation:D,useGetRepositoryHistoryQuery:b,useGetRepositoryHistoryWithPathQuery:E,useGetRepositoryJobsQuery:v,useCreateRepositoryJobsMutation:C,useGetRepositoryJobsWithPathQuery:S,useGetRepositoryRenderWithPathQuery:O,useGetRepositoryResourcesQuery:I,useGetRepositoryStatusQuery:R,useReplaceRepositoryStatusMutation:T,useCreateRepositoryTestMutation:L,useGetRepositoryWebhookQuery:K,useCreateRepositoryWebhookMutation:A,useGetFrontendSettingsQuery:W,useGetResourceStatsQuery:N}=a;var w=e(54115);function j(U){return async function(M,{updateCachedData:H,cacheDataLoaded:_,cacheEntryRemoved:Z}){if(!M?.watch)return;const ne=new w.ws({group:"provisioning.grafana.app",version:"v0alpha1",resource:U});let te=null;try{const Q=(await _).data.metadata?.resourceVersion;te=ne.watch({resourceVersion:Q}).subscribe(J=>{H(q=>{q.items||(q.items=[]);const X=q.items.findIndex(se=>se.metadata?.name===J.object.metadata.name);J.type==="ADDED"&&X===-1?q.items.push(J.object):J.type==="DELETED"&&X!==-1?q.items.splice(X,1):X!==-1&&(q.items[X]=J.object)})})}catch(Y){console.error("Error in onCacheEntryAdded:",Y)}await Z,te?.unsubscribe()}}const V=a.enhanceEndpoints({endpoints:{listJob:{query:({watch:U,...F})=>({url:"/jobs",params:F}),onCacheEntryAdded:j("jobs")},listRepository:{query:({watch:U,...F})=>({url:"/repositories",params:F}),onCacheEntryAdded:j("repositories")},deleteRepository:{onQueryStarted:async(U,{queryFulfilled:F,dispatch:M})=>{try{await F,M((0,n.dx)((0,r.tZ)((0,o.t)("provisioning.delete-repository-button.success-repository-deleted","Repository settings queued for deleti
159on"))))}catch(H){H instanceof Error&&M((0,n.dx)((0,r.gi)((0,o.t)("provisioning.delete-repository-button.error-repository-delete","Failed to delete repository"),H)))}}},deletecollectionRepository:{onQueryStarted:async(U,{queryFulfilled:F,dispatch:M})=>{try{await F,M((0,n.dx)((0,r.tZ)((0,o.t)("provisioning.home-page.success-all-repositories-deleted","All configured repositories deleted"))))}catch(H){H instanceof Error&&M((0,n.dx)((0,r.gi)((0,o.t)("provisioning.home-page.error-delete-all-repositories","Failed to delete all repositories"),H)))}}},createRepositoryTest:{onQueryStarted:async(U,{queryFulfilled:F,dispatch:M})=>{try{await F}catch(H){H?H instanceof Error?M((0,n.dx)((0,r.gi)("Error validating repository",H))):typeof H=="object"&&"error"in H&&(0,t.NF)(H.error)&&Array.isArray(H.error.data.errors)&&H.error.data.errors.length&&H.error.data.errors.filter(Z=>!Z.field).length>0&&M((0,n.dx)((0,r.gi)("Error validating repository"))):M((0,n.dx)((0,r.gi)("Error validating repository",new Error("Unknown error"))))}}},createRepositoryJobs:{onQueryStarted:async(U,{queryFulfilled:F,dispatch:M})=>{try{await F,M((0,n.dx)((0,r.tZ)((0,o.t)("provisioning.sync-repository.success-pull-started","Pull started"))))}catch(H){H instanceof Error&&M((0,n.dx)((0,r.gi)((0,o.t)("provisioning.sync-repository.error-pulling-resources","Error pulling resources"),H)))}}},createRepository:{onQueryStarted:async(U,{queryFulfilled:F,dispatch:M})=>{try{await F,M((0,n.dx)((0,r.tZ)((0,o.t)("provisioning.config-form.alert-repository-settings-saved","Repository settings saved"))))}catch(H){H instanceof Error&&M((0,n.dx)((0,r.gi)((0,o.t)("provisioning.config-form.error-save-repository","Failed to save repository settings"),H)))}}},replaceRepository:{onQueryStarted:async(U,{queryFulfilled:F,dispatch:M})=>{try{await F,M((0,n.dx)((0,r.tZ)((0,o.t)("provisioning.config-form.alert-repository-settings-updated","Repository settings updated"))))}catch(H){H instanceof Error&&M((0,n.dx)((0,r.gi)((0,o.t)("provisioning.config-form.error-save-repository","Failed to save repository settings"),H)))}}}}})},73892:(ee,B,e)=>{"use strict";e.d(B,{W:()=>r,s:()=>o});var t=e(75505),n=e(68143);function r({baseURL:s}){async function m(a){try{const{data:l,...f}=await(0,t.s)((0,n.AI)().fetch({...a,url:s+a.url,showErrorAlert:a.showErrorAlert??!1,data:a.body}));return{data:l,meta:f}}catch(l){return a.manageError?a.manageError(l):o(l)}}return m}function o(s){return(0,n.NF)(s)||s instanceof Error?{error:s}:{error:new Error("Unknown error")}}},85618:(ee,B,e)=>{"use strict";e.d(B,{G:()=>n,T:()=>r});var t=e(43173);const n=()=>t.$.namespace,r=(o,s)=>`/apis/${o}/${s}/namespaces/${n()}`},873:(ee,B,e)=>{"use strict";e.d(B,{A:()=>r});var t=e(2543),n=e.n(t);class r{constructor(a){if(this.columns=[],this.columnMap={},this.rows=[],this.type="table",a){if(a.columns)for(const l of a.columns)this.addColumn(l);if(a.rows)for(const l of a.rows)this.addRow(l)}}sort(a){a.col===null||a.col===void 0||this.columns.length<=a.col||(this.rows.sort((l,f)=>(l=l[a.col],f=f[a.col],+(l==null)-+(f==null)||+(l>f)||-(l<f))),a.desc&&this.rows.reverse(),this.columns[a.col].sort=!0,this.columns[a.col].desc=a.desc)}addColumn(a){this.columnMap[a.text]||(this.columns.push(a),this.columnMap[a.text]=a)}addRow(a){this.rows.push(a)}}function o(m,a,l){let f=!1;for(let h=0;h<m.length;h++)if(a[h]!==void 0&&l[h]!==void 0){if(a[h]!==l[h])return!1}else(a[h]===void 0||l[h]===void 0)&&(f=!0);return f}function s(m,...a){const l=m||new r;if(arguments.length===1)return l;if(arguments.length===2)return l.columns=a[0].hasOwnProperty("columns")?[...a[0].columns]:[],l.rows=a[0].hasOwnProperty("rows")?[...a[0].rows]:[],l;const f=a.filter(c=>!!c.columns),h={},u=f.slice().reduce((c,y)=>(y.columns.forEach(P=>{const{text:d}=P;h[d]===void 0&&(h[d]=c.length,c.push(P))}),c),[]),i=f.map(c=>c.columns.map(y=>h[y.text])),x=f.reduce((c,y,P)=>{const d=i[P];return y.rows.forEach(D=>{const b=[];d.forEach((E,v)=>{b[E]=D[v]}),c.push(b)}),c},[]),g={},p=x.reduce((c,y,P)=>{if(!g[P]){let d=P+1;for(;d<x.length;){const D=findIndex(x,b=>o(u,y,b),d);if(D>-1){const b=x[D];for(let E=0;E<u.length;E++)y[E]===void 0&&b[E]!==void 0&&(y[E]=b[E]);g[D]=b,d=D+1}else break}c.push(y)}return c},[]);return l.columns=u,l.rows=p,l}},20018:(ee,B,e)=>{"use strict";e.d(B,{N:()=>n});var t=e(65307);const n=(0,t.VP)("core/cleanUpState")},6890:(ee,B,e)=>{"use strict";e.d(B,{Do:()=>t.Do,Vz:()=>n.Vz,YA:()=>n.YA,dx:()=>t.dx});var t=e(12066),n=e(43550)},54384:(ee,B,e)=>{"use strict";e.d(B,{x:()=>V});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(63142),m=e(35137),a=e(31286),l=e(66404),f=e(45861),h=e(63722),u=e(56840),i=e(83873),x=e(78059),g=e(41654),p=e(18857),c=e(15840),y=e(76459),P=e.n(y),d=e(68143);class D extends o.Component{constructor(Y){super(Y),this.search=P()(async Q=>(this.setState({isLoading:!0}),(0,r.isNil)(Q)&&(Q=""),(0,d.AI)().get(`/api/serviceaccounts/search?query=${Q}&perpage=100`).then(J=>J.serviceAccounts.map(q=>({id:q.id,uid:q.uid,value:q,label:q.login,imgUrl:q.avatarUrl,login:q.login}))).finally(()=>{this.setState({isLoading:!1})}
159)),300,{leading:!0}),this.state={isLoading:!1}}render(){const{className:Y,onSelected:Q,inputId:J}=this.props,{isLoading:q}=this.state;return(0,t.jsx)("div",{className:"service-account-picker","data-testid":"serviceAccountPicker",children:(0,t.jsx)(p.DW,{isClearable:!0,className:Y,inputId:J,isLoading:q,defaultOptions:!0,loadOptions:this.search,onChange:Q,placeholder:(0,u.t)("service-account-picker.select-placeholder","Start typing to search for service accounts"),noOptionsMessage:"No service accounts found","aria-label":(0,u.t)("service-account-picker.select-aria-label","Service account picker")})})}}class b extends o.Component{constructor(Y){super(Y),this.search=P()(async Q=>(this.setState({isLoading:!0}),(0,r.isNil)(Q)&&(Q=""),(0,d.AI)().get(`/api/teams/search?perpage=100&page=1&query=${Q}`).then(J=>{const q=J.teams.map(X=>({value:X,label:X.name,imgUrl:X.avatarUrl}));return this.setState({isLoading:!1}),q})),300,{leading:!0}),this.state={isLoading:!1}}componentDidMount(){const{teamId:Y}=this.props;Y&&(0,d.AI)().get(`/api/teams/${Y}`).then(Q=>{this.setState({value:{value:Q,label:Q.name,imgUrl:Q.avatarUrl}})})}render(){const{onSelected:Y,className:Q}=this.props,{isLoading:J,value:q}=this.state;return(0,t.jsx)("div",{className:"user-picker","data-testid":"teamPicker",children:(0,t.jsx)(p.DW,{isLoading:J,defaultOptions:!0,loadOptions:this.search,value:q,onChange:Y,className:Q,placeholder:(0,u.t)("team-picker.select-placeholder","Select a team"),noOptionsMessage:"No teams found","aria-label":(0,u.t)("team-picker.select-aria-label","Team picker")})})}}class E extends o.Component{constructor(Y){super(Y),this.search=P()(async Q=>(this.setState({isLoading:!0}),(0,r.isNil)(Q)&&(Q=""),(0,d.AI)().get(`/api/org/users/lookup?query=${Q}&limit=100`).then(J=>J.map(q=>({id:q.userId,uid:q.uid,value:q,label:q.login,imgUrl:q.avatarUrl,login:q.login}))).finally(()=>{this.setState({isLoading:!1})})),300,{leading:!0}),this.state={isLoading:!1}}render(){const{className:Y,onSelected:Q,inputId:J}=this.props,{isLoading:q}=this.state;return(0,t.jsx)("div",{className:"user-picker","data-testid":"userPicker",children:(0,t.jsx)(p.DW,{isClearable:!0,className:Y,inputId:J,isLoading:q,defaultOptions:!0,loadOptions:this.search,onChange:Q,placeholder:(0,u.t)("user-picker.select-placeholder","Start typing to search for user"),noOptionsMessage:"No users found","aria-label":(0,u.t)("user-picker.select-aria-label","User picker")})})}}var v=e(70590),C=(te=>(te.None="None",te.Team="Team",te.User="User",te.ServiceAccount="ServiceAccount",te.BuiltInRole="builtInRole",te))(C||{});const S=({title:te=(0,u.t)("access-control.add-permission.title","Add permission for"),permissions:Y,assignments:Q,onAdd:J,onCancel:q})=>{const[X,se]=(0,o.useState)(C.None),[oe,ae]=(0,o.useState)(""),[ie,fe]=(0,o.useState)(""),[pe,de]=(0,o.useState)(""),[le,me]=(0,o.useState)(""),De=(0,o.useMemo)(()=>{const Ne=[];return Q.users&&Ne.push({value:C.User,label:(0,u.t)("access-control.add-permission.user-label","User")}),Q.serviceAccounts&&Ne.push({value:C.ServiceAccount,label:(0,u.t)("access-control.add-permission.serviceaccount-label","Service Account")}),Q.teams&&Ne.push({value:C.Team,label:(0,u.t)("access-control.add-permission.team-label","Team")}),Q.builtInRoles&&Ne.push({value:C.BuiltInRole,label:(0,u.t)("access-control.add-permission.role-label","Role")}),Ne},[Q]);(0,o.useEffect)(()=>{Y.length>0&&me(Y[0])},[Y]);const Te=()=>X===C.Team&&oe||X===C.User&&ie||X===C.ServiceAccount&&ie||C.BuiltInRole&&v.XT.hasOwnProperty(pe);return(0,t.jsxs)("div",{className:"cta-form","aria-label":(0,u.t)("access-control.add-permission.permissions-aria-label","Permissions slider"),children:[(0,t.jsx)(c.J,{onClick:q}),(0,t.jsx)("h5",{children:te}),(0,t.jsx)("form",{name:"addPermission",onSubmit:Ne=>{Ne.preventDefault(),J({userUid:ie,teamUid:oe,builtInRole:pe,permission:le,target:X})},children:(0,t.jsxs)(g.B,{gap:1,direction:"row",children:[(0,t.jsx)(p.l6,{"aria-label":(0,u.t)("access-control.add-permission.role-select-aria-label","Role to add new permission to"),value:X,options:De,onCh
159ange:Ne=>se(Ne.value),disabled:De.length===0,width:"auto"}),X===C.User&&(0,t.jsx)(E,{onSelected:Ne=>fe(Ne?.value?.uid||"")}),X===C.ServiceAccount&&(0,t.jsx)(D,{onSelected:Ne=>fe(Ne?.value?.uid||"")}),X===C.Team&&(0,t.jsx)(b,{onSelected:Ne=>ae(Ne.value?.uid||"")}),X===C.BuiltInRole&&(0,t.jsx)(p.l6,{"aria-label":(0,u.t)("access-control.add-permission.built-in-aria-label","Built-in role picker"),options:Object.values(v.XT).filter(Ne=>Ne!==v.XT.None).map(Ne=>({value:Ne,label:Ne})),onChange:Ne=>de(Ne.value||""),width:"auto"}),(0,t.jsx)(p.l6,{"aria-label":(0,u.t)("access-control.add-permission.level-aria-label","Permission level"),width:"auto",value:Y.find(Ne=>Ne===le),options:Y.map(Ne=>({label:Ne,value:Ne})),onChange:Ne=>me(Ne.value||"")}),(0,t.jsx)(f.$n,{type:"submit",disabled:!Te(),children:(0,t.jsx)(u.x6,{i18nKey:"access-control.add-permissions.save",children:"Save"})})]})})]})};var O=e(45967),I=e(30703);const R=({item:te,permissionLevels:Y,canSet:Q,onRemove:J,onChange:q})=>{const X=(0,s.of)(W);return(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:T(te)}),(0,t.jsx)("td",{children:K(te)}),(0,t.jsx)("td",{children:te.isInherited&&(0,t.jsx)("em",{className:X.inherited,children:(0,t.jsx)(u.x6,{i18nKey:"access-control.permission-list-item.inherited",children:"Inherited from folder"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(p.l6,{disabled:!Q||!te.isManaged,onChange:se=>q(te,se.value),value:Y.find(se=>se===te.permission),options:Y.map(se=>({value:se,label:se}))})}),(0,t.jsx)("td",{children:te.warning?(0,t.jsx)(O.m,{content:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.a,{marginBottom:1,children:te.warning}),A(te)]}),children:(0,t.jsx)(I.I,{name:"exclamation-triangle",className:X.warning})}):(0,t.jsx)(O.m,{content:A(te),children:(0,t.jsx)(I.I,{name:"info-circle"})})}),(0,t.jsx)("td",{children:te.isManaged?(0,t.jsx)(f.$n,{size:"sm",icon:"times",variant:"destructive",disabled:!Q,onClick:()=>J(te),"aria-label":(0,u.t)("access-control.permission-list-item.remove-aria-label","Remove permission for {{identifier}}",{identifier:L(te)})}):(0,t.jsx)(O.m,{content:te.isInherited?"Inherited Permission":"Provisioned Permission",children:(0,t.jsx)(f.$n,{size:"sm",icon:"lock","aria-label":(0,u.t)("access-control.permission-list-item.locked-aria-label","Locked permission indicator")})})})]})},T=te=>te.teamId?(0,t.jsx)("img",{className:"filter-table__avatar",src:te.teamAvatarUrl,alt:`Avatar for team ${te.teamId}`}):te.userId?(0,t.jsx)("img",{className:"filter-table__avatar",src:te.userAvatarUrl,alt:`Avatar for user ${te.userId}`}):(0,t.jsx)(I.I,{size:"xl",name:"shield"}),L=te=>te.userId?te.userLogin:te.teamId?te.team:te.builtInRole,K=te=>te.userId?(0,t.jsxs)("span",{children:[te.userLogin," "]},"name"):te.teamId?(0,t.jsxs)("span",{children:[te.team," "]},"name"):te.builtInRole?(0,t.jsxs)("span",{children:[te.builtInRole," "]},"name"):(0,t.jsx)("span",{},"name"),A=te=>`Actions: ${[...new Set(te.actions)].sort().join(" ")}`,W=te=>({warning:(0,n.css)({color:te.colors.warning.main}),inherited:(0,n.css)({color:te.colors.text.secondary,flexWrap:"nowrap"})}),N=({title:te,items:Y,compareKey:Q,permissionLevels:J,canSet:q,onRemove:X,onChange:se})=>{const oe=(0,o.useMemo)(()=>{const ae={};for(let ie of Y){const fe=ie[Q];if(!ae[fe]){ae[fe]=ie;continue}if(ie.actions.length>ae[fe].actions.length){ae[fe]=ie;continue}ie.actions.length===ae[fe].actions.length&&!ie.isInherited&&(ae[fe]=ie)}return Object.keys(ae).map(ie=>ae[ie])},[Y,Q]);return oe.length===0?null:(0,t.jsx)("div",{children:(0,t.jsxs)("table",{className:"filter-table gf-form-group",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{style:{width:"1%"}}),(0,t.jsx)("th",{children:te}),(0,t.jsx)("th",{style:{width:"1%"}}),(0,t.jsx)("th",{style:{width:"40%"},children:(0,t.jsx)(u.x6,{i18nKey:"access-control.permission-list.permission",children:"Permission"})}),(0,t.jsx)("th",{style:{width:"1%"}}),(0,t.jsx)("th",{style:{width:"1%"}})]})}),(0,t.jsx)("tbody",{children:oe.map((ae,ie)=>(0,t.jsx)(R,{item:ae,onRemove:X,onChange:se,canSet:q,permissionLevels:J},`${ie}-${ae.userId}`))})]})})},w="",j={permissions:[],assignments:{teams:!1,users:!1,serviceAccounts:!1,builtInRoles:!1}},V=({title:te=(0,u.t)("access-control.permissions.title","Permissions"),buttonLabel:Y=(0,u.t)("access-control.permissions.add-label","Add a permission"),emptyLabel:Q=(0,u.t)("access-control.permissions.no-permissions","There are no permissions"),resource:J,resourceId:q,canSetPermissions:X,addPermissionTitle:se,getWarnings:oe,epilogue:ae})=>{const ie=(0,s.of)(ne),[fe,pe]=(0,o.useState)(!1),[de,le]=(0,o.useState)([]),[me,De]=(0,o.useState)(j),Te=(0,o.useCallback)(async()=>{let je=await F(J,q);oe&&(je=oe(je)),le(je)},[J,q,oe]);(0,o.useEffect)(()=>{U(J).then(je=>(De(je),Te()))},[J,q,Te]);const Ne=je=>{let ze=null;je.target===C.User||je.target===C.ServiceAccount?ze=M(J,q,je.userUid,je.permission):je.target===C.Team?ze=H(J,q,je.teamUid,je.permission):je.target===C.BuiltInRole&&(ze=_(J,q,je.builtInRole,je.permission)),ze!==null&&ze.then(Te)},Ce=je=>{let ze=null;je.userUid?ze=M(J,q,je.userUid,w):je.teamUid?ze=H(J,q,je.teamUid,w):je.builtInRole&&(ze=_(J,q,je.builtInRole,w)),ze!==null&&ze.then(Te)},He=(je,ze)=>{console.log("onChange",je,ze),je.permission!==ze&&(je.userUid||je.isServiceAccount?Ne({permission:ze,userUid:je.userUid,target:C.User}):je.teamUid?Ne({permission:ze,teamUid:je.teamUid,target:C.Team}):je.builtInRole&&Ne({permission:ze,builtInRole:je.builtInRole,target:C.BuiltInRole}))},ke=(0,o.useMemo)(()=>(0,r.sortBy)(de.filter(je=>je.teamId),["team","isManaged"]),[de]),Me=(0,o.useMemo)(()=>(0,r.sortBy)(de.filter(je=>je.userId&&!je.isServiceAccount),["userLogin","isManaged"]),[de]),$e=(0,o.useMemo)(()=>(0,r.sortBy)(de.filter(je=>je.userId&&je.isServiceAccount),["userLogin","isManaged"]),[de]),tt=(0,o.useMemo)(()=>(0,r.sortBy)(de.filter(je=>je.builtInRole),["builtInRole","isManaged"]),[de]),Ke=(0,u.t)("access-control.permissions.role","Role"),Re=(0,u.t)("access-control.permissions.user","User"),Ve=(0,u.t)("access-control.permissions.serviceaccount","Service Account"),Qe=(0,u.t)("access-control.permissions.team","Team");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[X&&J==="folders"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.x6,{i18nKey:"access-control.permissions.permissions-change-warning",children:"This will change permissions for this folder and all its desce
159ndants. In total, this will affect:"}),(0,t.jsx)(x.x,{selectedItems:{folder:{[q]:!0},dashboard:{},panel:{},$all:!1}}),(0,t.jsx)(m.$,{v:2})]}),de.length===0&&(0,t.jsx)(a.a,{children:(0,t.jsx)(l.E,{children:Q})}),(0,t.jsx)(N,{title:Ke,items:tt,compareKey:"builtInRole",permissionLevels:me.permissions,onChange:He,onRemove:Ce,canSet:X}),(0,t.jsx)(N,{title:Re,items:Me,compareKey:"userLogin",permissionLevels:me.permissions,onChange:He,onRemove:Ce,canSet:X}),(0,t.jsx)(N,{title:Ve,items:$e,compareKey:"userLogin",permissionLevels:me.permissions,onChange:He,onRemove:Ce,canSet:X}),(0,t.jsx)(N,{title:Qe,items:ke,compareKey:"team",permissionLevels:me.permissions,onChange:He,onRemove:Ce,canSet:X}),X&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.$n,{className:ie.addPermissionButton,variant:"primary",onClick:()=>pe(!0),icon:"plus",children:Y},"add-permission"),(0,t.jsx)(h.a,{in:fe,children:(0,t.jsx)(S,{title:se,onAdd:Ne,permissions:me.permissions,assignments:me.assignments,onCancel:()=>pe(!1)})})]})]}),ae&&ae(de)]})},U=async te=>{try{return await(0,i.AI)().get(`/api/access-control/${te}/description`)}catch(Y){return console.error("failed to load resource description: ",Y),j}},F=(te,Y)=>(0,i.AI)().get(`/api/access-control/${te}/${Y}`),M=(te,Y,Q,J)=>Z(te,Y,"users",Q,J),H=(te,Y,Q,J)=>Z(te,Y,"teams",Q,J),_=(te,Y,Q,J)=>Z(te,Y,"builtInRoles",Q,J),Z=(te,Y,Q,J,q)=>(0,i.AI)().post(`/api/access-control/${te}/${Y}/${Q}/${J}`,{permission:q}),ne=te=>({breakdown:(0,n.css)({...te.typography.bodySmall,color:te.colors.text.secondary,marginBottom:te.spacing(2)}),addPermissionButton:(0,n.css)({marginBottom:te.spacing(2)})})},63722:(ee,B,e)=>{"use strict";e.d(B,{a:()=>a});var t=e(74848),n=e(96540),r=e(22669);const o="200px",s=200,m={transition:`max-height ${s}ms ease-in-out`,overflow:"hidden"},a=({children:l,in:f,maxHeight:h=o,style:u=m})=>{const i=(0,n.useRef)(null),x={exited:{maxHeight:0},entering:{maxHeight:h},entered:{maxHeight:"unset",overflow:"visible"},exiting:{maxHeight:0}};return(0,t.jsx)(r.Ay,{in:f,timeout:s,nodeRef:i,children:g=>(0,t.jsx)("div",{style:{...u,...x[g]},ref:i,children:l})})}},43707:(ee,B,e)=>{"use strict";e.d(B,{H:()=>r});var t=e(96540),n=e(27963);const r=t.memo(({actions:o,breadcrumbActions:s})=>{const{chrome:m}=(0,n.Il)();return(0,t.useLayoutEffect)(()=>()=>{m.update({actions:void 0,breadcrumbActions:void 0})},[m]),(0,t.useLayoutEffect)(()=>{m.update({actions:o,breadcrumbActions:s})}),null});r.displayName="TopNavUpdate"},92270:(ee,B,e)=>{"use strict";e.d(B,{EE:()=>f,T0:()=>l,nf:()=>a,yq:()=>m});var t=e(74848),n=e(22803),r=e(33604),o=e(63142),s=e(58449);const m=300,a=100,l=700;function f(){const u=h((0,o.$j)()),{dockedComponentId:i,isEnabled:x,props:g={}}=(0,s.sA)(),{components:p,isLoading:c}=(0,r.f)({extensionPointId:s.up});if(c||!i||!x)return null;const y=(0,s.rS)(i);if(!y)return null;const P=p.find(d=>d.meta.pluginId===y.pluginId&&d.meta.title===y.componentTitle);return P?(0,t.jsx)("div",{className:u.sidebarWrapper,children:(0,t.jsx)("div",{className:u.content,children:(0,t.jsx)(P,{...g})})}):null}const h=u=>({sidebarWrapper:(0,n.css)({backgroundColor:u.colors.background.primary,borderLeft:`1px solid ${u.colors.border.weak}`,display:"flex",flexDirection:"column",gap:u.spacing(1),padding:u.spacing(1),width:"100%",height:"100%",overflow:"auto"}),content:(0,n.css)({flex:1,minHeight:0})})},58449:(ee,B,e)=>{"use strict";e.d(B,{kn:()=>c,pF:()=>y,rS:()=>P,sA:()=>p,up:()=>h});var t=e(74848),n=e(96540),r=e(78685),o=e(78012),s=e(43173),m=e(75234),a=e(31439),l=e(87745),f=e(92270);const h="grafana/extension-sidebar/v0-alpha",u="grafana.navigation.extensionSidebarDocked",i="grafana.navigation.extensionSidebarWidth",x=["grafana-investigations-app","grafana-aiassistant-app","grafana-dash-app"],g=(0,n.createContext)({isEnabled:!!s.$.featureToggles.extensionSidebar,isOpen:!1,dockedComponentId:void 0,setDockedComponentId:()=>{},availableComponents:new Map,extensionSidebarWidth:f.yq,setExtensionSidebarWidth:()=>{}});function p(){return(0,n.useContext)(g)}const c=({children:d})=>{const[D,b]=(0,n.useState)(void 0),E=o.M.get(u),[v,C]=(0,r.A)(i,f.yq),S=!!s.$.featureToggles.extensionSidebar,O=S?new Map(Array.from((0,a.UX)(h).entr
159ies()).filter(([K])=>x.includes(K))):new Map;let I;if(E){const K=P(E);if(K){const A=O.get(K.pluginId);A&&A.addedComponents.find(N=>N.title===K.componentTitle)&&(I=E)}}const[R,T]=(0,n.useState)(I),L=(0,n.useCallback)((K,A)=>{b(A),T(K)},[T]);return(0,n.useEffect)(()=>{if(!S)return;const K=W=>{W.payload.pluginId&&W.payload.componentTitle&&x.includes(W.payload.pluginId)&&L(JSON.stringify({pluginId:W.payload.pluginId,componentTitle:W.payload.componentTitle}),W.payload.props)},A=(0,m.J7)().subscribe(l.Am,K);return()=>{A.unsubscribe()}},[S,L]),(0,n.useEffect)(()=>{R?o.M.set(u,R):o.M.delete(u)},[R]),(0,t.jsx)(g.Provider,{value:{isEnabled:S,isOpen:S&&R!==void 0,dockedComponentId:R,setDockedComponentId:K=>L(K,void 0),availableComponents:O,extensionSidebarWidth:v??f.yq,setExtensionSidebarWidth:C,props:D},children:d})};function y(d,D){return JSON.stringify({pluginId:d,componentTitle:D.title})}function P(d){try{const D=JSON.parse(d);return typeof D=="object"&&D!==null&&"pluginId"in D&&"componentTitle"in D&&typeof D.pluginId=="string"&&typeof D.componentTitle=="string"?D:void 0}catch{return}}},89409:(ee,B,e)=>{"use strict";e.d(B,{t3:()=>v,iL:()=>C,fn:()=>S});var t=e(74848),n=e(22803),r=e(63142),o=e(41654),s=e(7895),m=e(76319),a=e(27963),l=e(56840),f=e(92948),h=e(96540),u=e(36490),i=e(35137),x=e(66404),g=e(15130),p=e(93922),c=e(96673),y=e(18857),P=e(30703);function d({orgs:I,onSelectChange:R}){const T=(0,r.of)(D),{orgId:L}=g.TP.user,K=(0,h.useMemo)(()=>I.map(j=>({label:j.name,description:j.role,value:j})),[I]),A=(0,h.useMemo)(()=>K.find(j=>j.value.orgId===L),[K,L]),[W,N]=(0,h.useState)(()=>A),w=j=>{N(j),R(j)};return(0,t.jsx)(y.l6,{"aria-label":(0,l.t)("navigation.org-switcher.aria-label","Change organization"),width:"auto",value:W,prefix:(0,t.jsx)(P.I,{className:"prefix-icon",name:"building"}),className:T.select,options:K,onChange:w})}const D=I=>({select:(0,n.css)({border:"none",background:"none",color:I.colors.text.secondary,"&:hover":{color:I.colors.text.primary,"& .prefix-icon":(0,n.css)({color:I.colors.text.primary})}})});function b(){const I=(0,c.useDispatch)(),R=(0,c.useSelector)(L=>L.organization.userOrgs),T=L=>{L.value&&((0,p.bA)(L.value.orgId),u.Ny.push(`/?orgId=${L.value.orgId}`),window.location.reload())};return(0,h.useEffect)(()=>{g.TP.isSignedIn&&!(g.TP.user.authenticatedBy==="apikey"||g.TP.user.authenticatedBy==="render")&&I((0,p.wV)())},[I]),R?.length<=1?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.$,{h:1}),(0,t.jsx)(x.E,{truncate:!0,children:f.M.AppTitle})]}):(0,t.jsx)(d,{orgs:R,onSelectChange:T})}var E=e(31937);const v="dock-menu-button",C="mega-menu-header-toggle";function S({handleMegaMenu:I,handleDockedMenu:R,onClose:T}){const L=(0,r.$j)(),{chrome:K}=(0,a.Il)(),A=K.useState(),W=O(L);return(0,t.jsxs)("div",{className:W.header,children:[(0,t.jsxs)(o.B,{alignItems:"center",minWidth:0,gap:.25,children:[(0,t.jsx)(s.I,{narrow:!0,id:C,onClick:I,tooltip:(0,l.t)("navigation.megamenu.close","Close menu"),children:(0,t.jsx)(f.M.MenuLogo,{className:W.img})}),(0,t.jsx)(b,{})]}),(0,t.jsx)(m.K,{id:v,className:W.dockMenuButton,tooltip:A.megaMenuDocked?(0,l.t)("navigation.megamenu.undock","Undock menu"):(0,l.t)("navigation.megamenu.dock","Dock menu"),name:"web-section-alt",onClick:R,variant:"secondary"}),(0,t.jsx)(m.K,{className:W.mobileCloseButton,tooltip:(0,l.t)("navigation.megamenu.close","Close menu"),name:"times",onClick:T,size:"xl",variant:"secondary"})]})}S.displayName="MegaMenuHeader";const O=I=>({dockMenuButton:(0,n.css)({display:"none",[I.breakpoints.up("xl")]:{display:"inline-flex"}}),header:(0,n.css)({alignItems:"center",borderBottom:`1px solid ${I.colors.border.weak}`,display:"flex",gap:I.spacing(1),justifyContent:"space-between",padding:I.spacing(0,1,0,.75),height:(0,E.vn)(),flexShrink:0}),img:(0,n.css)({alignSelf:"center",height:I.spacing(3),width:I.spacing(3)}),mobileCloseButton:(0,n.css)({[I.breakpoints.up("md")]:{display:"none"}})})},5071:(ee,B,e)=>{"use strict";e.d(B,{s:()=>o});var t=e(96540),n=e(43173),r=e(1492);const o=()=>{const s=(0,r.Pj)(void 0,{skip:!n.$.bootData.user.isSignedIn}),m=(0,t.useMemo)(()=>s.data?.navbar?.bookmarkUrls||[],[s]);return n.$.featureToggles.pinNavItems?m:[]}},30362:(ee,B,e)=>{"use strict";e.d(B,{A6:()=>p,CS:()=>i,J0:()=>x,Wk:()=>y,m0:()=>g,n0:()=>P});var t=e(96540),n=e(27489),r=e(43173),o=e(95943),s=e(56840),m=e(43550),a=e(87745),l=e(45229),f=e(10388),h=e(47981),u=e(89409);const i=d=>{let D=d.children||[];if(d.id==="help"){const b=()=>{l.A.publish(new a.S8({component:h.N}))};d.children=[...D,...(0,f.Dd)(),...c(),{id:"keyboard-shortcuts",text:(0,s.t)("nav.help/keyboard-shortcuts","Keyboard shortcuts"),icon:"keyboard",onClick:b}]}return d},x=(d,D,b=!1)=>{const E={...d},v=E.onClick;let C;return E.isNew?C="item":b&&(C="ancestor"),E.onClick=()=>{(0,n.rR)("grafana_navigation_item_clicked",{path:E.url??E.id,menuIsDocked:D,itemIsBookmarked:!!(r.$.featureToggles.pinNavItems&&E?.parentItem?.id==="bookmarks"),bookmarkToggleOn:!!r.$.featureToggles.pinNavItems,isNew:C}),v?.()},E.children&&(E.children=E.children.map(S=>x(S,D,C!==void 0))),E},g=(d,D)=>!!d.children?.some(b=>b===D?!0:g(b,D)),p=(d,D,b)=>{const{id:E,parentItem:v}=D;if(b==="/")return d.find(S=>S.id===m.Id);if(D.id==="profile")return;for(const S of d){const O=!!(S.id&&S.id===E),I=S.text===D.text&&S.url===D.url;if(O||I)return S;
159if(S.children){const R=p(S.children,D);if(R)return R}}const C=d[0]?.parentItem?.id==="bookmarks";if(v&&!C)return p(d,v)};function c(){const{buildInfo:d,licenseInfo:D}=r.$,b=D.stateInfo?` (${D.stateInfo})`:"",E=[];return E.push({target:"_blank",id:"version",text:`${d.edition}${b}`,url:D.licenseUrl,icon:"external-link-alt"}),d.hasUpdate&&E.push({target:"_blank",id:"updateVersion",text:"New version available!",icon:"download-alt",url:"https://grafana.com/grafana/download?utm_source=grafana_footer"}),E}function y(d,D){for(const b of d){if(b.url===D)return b;if(b.children?.length){const E=y(b.children,D);if(E)return E}}return null}function P(d,D){(0,t.useEffect)(()=>{d?document.getElementById(u.iL)?.focus():document.getElementById(o.Ut)?.focus()},[d]),(0,t.useEffect)(()=>{D?document.getElementById(u.t3)?.focus():document.getElementById(o.Ut)?.focus()},[D])}},5423:(ee,B,e)=>{"use strict";e.d(B,{K:()=>o});var t=e(74848),n=e(22803),r=e(63142);function o({className:m,leftActionsSeparator:a}){const l=(0,r.of)(s);return a?(0,t.jsx)("div",{className:(0,n.cx)(m,l.leftActionsSeparator)}):(0,t.jsx)("div",{className:(0,n.cx)(m,l.line)})}const s=m=>({leftActionsSeparator:(0,n.css)({display:"flex",flexGrow:1}),line:(0,n.css)({width:1,backgroundColor:m.colors.border.medium,height:24,flexShrink:0,flexGrow:0,[m.breakpoints.down("sm")]:{display:"none"}})})},31937:(ee,B,e)=>{"use strict";e.d(B,{UH:()=>a,k9:()=>f,vn:()=>h});var t=e(96540),n=e(69896),r=e(43173),o=e(27963),s=e(51702),m=e(58449);function a(){const{chrome:u}=(0,o.Il)(),i=u.state.getValue(),x=(0,n.b)(),g=(0,s.i)("xl"),[p,c]=(0,t.useState)(l(i,x?.state.enabled,g));return(0,t.useEffect)(()=>{const y=u.state.subscribe(P=>{const d=l(P,x?.state.enabled,g);d!==p&&c(d)});return()=>y.unsubscribe()},[u,p,x,g]),p}function l(u,i=!1,x){return u.kioskMode||u.chromeless?0:i?2:u.actions?u.megaMenuDocked||!r.$.featureToggles.dashboardScene?2:x&&r.$.featureToggles.unifiedNavbars?1:2:1}function f(){const u=a(),{isOpen:i}=(0,m.sA)();return i?0:u*h()}function h(){return 40}},92948:(ee,B,e)=>{"use strict";e.d(B,{M:()=>f});var t=e(74848),n=e(22803),r=e(6773),o=e(63142);const s=({className:h,logo:u})=>(0,t.jsx)("img",{className:h,src:`${u||"public/img/grafana_icon.svg"}`,alt:"Grafana"}),m=({className:h,children:u})=>{const i=(0,o.$j)(),x=(0,n.css)({"&:before":{content:'""',position:"fixed",left:0,right:0,bottom:0,top:0,background:`url(public/img/g8_login_${i.isDark?"dark":"light"}.svg)`,backgroundPosition:"top center",backgroundSize:"auto",backgroundRepeat:"no-repeat",opacity:0,transition:"opacity 3s ease-in-out",[i.breakpoints.up("md")]:{backgroundPosition:"center",backgroundSize:"cover"}}});return(0,t.jsx)("div",{className:(0,n.cx)(x,h),children:u})},a=({className:h})=>(0,t.jsx)("img",{className:h,src:"public/img/grafana_icon.svg",alt:"Grafana"}),l=()=>{const h=(0,o.$j)();return(0,n.css)({background:r.MV.alpha(h.colors.background.primary,.7),backgroundSize:"cover"})};class f{static{this.LoginLogo=s}static{this.LoginBackground=m}static{this.MenuLogo=a}static{this.LoginBoxBackground=l}static{this.AppTitle="Grafana"}static{this.LoginTitle="Welcome to Grafana"}static{this.HideEdition=!1}static{this.GetLoginSubTitle=()=>null}}},18607:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>t});function t(n,r,o,s){const m=[];let a=!1,l;function f(h,u=!1){if(a)return;const i=h.url?.split("?")??["",""];let x=i[0];const g=new URLSearchParams(i[1]);if(g.has("editview")&&(x+=`?editview=${g.get("editview")}`),o&&x===o.url){s||m.unshift({text:o.text,href:h.url??""}),a=!0;return}const p=x.length>0&&l===x;if(l=x,!h.hideFromBreadcrumbs&&!(u&&p)){const y=h.children?.findIndex(P=>P.active)??-1;if(y>0){const P=h.children?.[y];P&&m.unshift({text:P.text,href:P.url??""})}m.unshift({text:h.text,href:h.url??""})}h.parentItem&&f(h.parentItem)}return r&&f(r),f(n,!0),m}},15840:(ee,B,e)=>{"use strict";e.d(B,{J:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(76319),s=e(56840);const m=({onClick:l,"aria-label":f,style:h})=>{const u=(0,r.of)(a);return(0,t.jsx)(o.K,{"aria-label":f??"Close",className:u,name:"times",onClick:l,style:h,tooltip:(0,s.t)("close-button.tooltip","Close")})},a=l=>(0,n.css)({position:"absolute",right:l.spacing(.5),top:l.spacing(1)})},10388:(ee,B,e)=>{"use strict";e.d(B,{Dd:()=>l,wi:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(43173),s=e(63142),m=e(30703),a=e(56840);let l=()=>[{target:"_blank",id:"documentation",text:(0,a.t)("nav.help/documentation","Documentation"),icon:"document-info",url:"https://grafana.com/docs/grafana/latest/?utm_source=grafana_footer"},{target:"_blank",id:"support",text:(0,a.t)("nav.help/support","Support"),icon:"question-circle",url:"https://grafana.com/products/enterprise/?utm_source=grafana_footer"},{target:"_blank",id:"community",text:(0,a.t)("nav.help/community","Community"),icon:"comments-alt",url:"https://community.grafana.com/?utm_source=grafana_footer"}];function f(p){return{hasReleaseNotes:!0,isBeta:p.includes("-beta")}}function h(p){const{buildInfo:c,licenseInfo:y}=o.$,P=[],d=y.stateInfo?` (${y.stateInfo})`:"";if(p||P.push({target:"_blank",id:"license",text:`${c.edition}${d}`,url:y.licenseUrl}),c.hideVersion)return P;const{hasReleaseNotes:D}=f(c.version);return P.push({target:"_blank",id:"version",text:c.versionString,url:D?"https://github.com/grafana/grafana/blob/main/CHANGELOG.md":void 0}),c.hasUpdate&&P.push({target:"_blank",id:"updateVersion",text:"New version available!",icon:"download-alt",url:"https://grafana.com/grafana/download?utm_source=grafana_footer"}),P}function u(p){l=p}const i=(0,r.memo)(({customLinks:p,hideEdition:c})=>{const y=(p||l()).concat(h(c)),P=(0,s.of)(g);return(0,t.jsx)("footer",{className:P.footer,children:(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)("ul",{className:P.list,children:y.map((d,D)=>(0,t.jsx)("li",{className:P.listItem,children:(0,t.jsx)(x,{item:d})},D))})})})});i.displayName="Footer";function x({item:p}){const c=p.url?(0,t.jsx)("a",{href:p.url,target:p.target,rel:"noopener noreferrer",id:p.id,children:p.text}):p.text;return(0,t.jsxs)(t.Fragment,{children:[p.icon&&(0,t.jsx)(m.I,{name:p.icon})," ",c]})}const g=p=>({footer:(0,n.css)({...p.typography.bodySmall,color:p.colors.text.primary,display:"block",padding:p.spacing(2,0),position:"relative",width:"98%","a:hover":{color:p.colors.text.maxContrast,textDecoration:"underline"}
159,[p.breakpoints.down("md")]:{display:"none"}}),list:(0,n.css)({listStyle:"none"}),listItem:(0,n.css)({display:"inline-block","&:after":{content:"' | '",padding:p.spacing(0,1)},"&:last-child:after":{content:"''",paddingLeft:0}})})},90666:(ee,B,e)=>{"use strict";e.d(B,{T:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(43990);function s({children:a,spacing:l,level:f}){const h=(0,r.of)(m,l,f);return(0,t.jsx)("span",{className:(0,n.css)(h.indentor),children:a})}const m=(a,l,f)=>({indentor:(0,n.css)((0,o.Y)(a,l,h=>({paddingLeft:a.spacing(h*f)})))})},36321:(ee,B,e)=>{"use strict";e.d(B,{b:()=>o});var t=e(74848),n=e(96540),r=e(29043);const o=s=>{const{children:m,storageKey:a,defaultValue:l}=s,[f,h]=(0,n.useState)({value:r.A.getObject(s.storageKey,s.defaultValue)});(0,n.useEffect)(()=>{const x=g=>{g.key===a&&h({value:r.A.getObject(s.storageKey,s.defaultValue)})};return window.addEventListener("storage",x),()=>{window.removeEventListener("storage",x)}});const u=x=>{try{r.A.setObject(a,x)}catch(g){console.error(g)}h({value:x})},i=()=>{try{r.A.delete(a)}catch(x){console.log(x)}h({value:l})};return(0,t.jsx)(t.Fragment,{children:m(f.value,u,i)})}},94076:(ee,B,e)=>{"use strict";e.d(B,{A:()=>n,X:()=>r});var t=e(96540);function n({children:o,onSetScrollRef:s,divId:m}){const a=(0,t.useRef)(null);return(0,t.useEffect)(()=>{s&&s(new r(document.documentElement))},[a,s]),o}class r{constructor(s){this.element=s}get scrollTop(){return this.element.scrollTop}scrollTo(s,m,a=0){if(!(this.element.scrollHeight-this.element.clientHeight-m>=0)&&a<10){requestAnimationFrame(()=>this.scrollTo(s,m,a+1));return}this.element.scrollTo(s,m)}}},21234:(ee,B,e)=>{"use strict";e.d(B,{I:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(8073);function s({description:a,text:l,url:f}){const h=(0,r.of)(m);return(0,t.jsxs)(o.Z,{className:h.card,href:f,children:[(0,t.jsx)(o.Z.Heading,{children:l}),(0,t.jsx)(o.Z.Description,{className:h.description,children:a})]})}const m=a=>({card:(0,n.css)({marginBottom:0,gridTemplateRows:"1fr 0 2fr"}),description:(0,n.css)({WebkitLineClamp:3,WebkitBoxOrient:"vertical",display:"-webkit-box",overflow:"hidden"})})},82151:(ee,B,e)=>{"use strict";e.d(B,{b:()=>s});var t=e(74848),n=e(99887),r=e(56840),o=e(27321);function s({folder:m}){const a=(0,o.F)();return!m||"parentUID"in m&&m.parentUID||!m.managedBy||a?null:(0,t.jsx)(n.E,{text:(0,r.t)("folder-repo.badge-text","Provisioned"),color:"darkgrey"})}},39989:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{NestedFolderPicker:()=>oe});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(76459),a=e.n(m),l=e(96540),f=e(43173),h=e(63142),u=e(41654),i=e(66404),x=e(63527),g=e(30703),p=e(34999),c=e(47327),y=e(56840),P=e(15203),d=e(55860),D=e(93854),b=e(96673),E=e(82151),v=e(70255),C=e(91793),S=e(10022),O=e(76319),I=e(90666),R=e(25724);const T=40,L="md",K=(ie,fe)=>`${ie}-${fe||"root"}`;function A({items:ie,focusedItemIndex:fe,foldersAreOpenable:pe,idPrefix:de,selectedFolder:le,onFolderExpand:me,onFolderSelect:De,isItemLoaded:Te,requestLoadMore:Ne}){const Ce=(0,l.useRef)(null),He=(0,h.of)(w),ke=(0,l.useMemo)(()=>({items:ie,focusedItemIndex:fe,foldersAreOpenable:pe,selectedFolder:le,onFolderExpand:me,onFolderSelect:De,idPrefix:de}),[ie,fe,pe,le,me,De,de]),Me=(0,l.useCallback)(tt=>Te(tt),[Te]),$e=(0,l.useCallback)((tt,Ke)=>{const{parentUID:Re}=ie[tt];Ne(Re)},[Ne,ie]);return(0,t.jsx)("div",{className:He.table,role:"tree",children:ie.length>0?(0,t.jsx)(S.A,{ref:Ce,itemCount:ie.length,isItemLoaded:Me,loadMoreItems:$e,children:({onItemsRendered:tt,ref:Ke})=>(0,t.jsx)(C.Y1,{ref:Ke,height:T*Math.min(6.5,ie.length),width:"100%",itemData:ke,itemSize:T,itemCount:ie.length,onItemsRendered:tt,children:N})}):(0,t.jsx)("div",{className:He.emptyMessage,children:(0,t.jsx)(y.x6,{i18nKey:"browse-dashboards.folder-picker.empty-message",children:"No folders found"})})})}const W=[100,200,130,160,150];function N({index:ie,style:fe,data:pe}){const{items:de,focusedItemIndex:le,foldersAreOpenable:me,selectedFolder:De,onFolderExpand:Te,onFolderSelect:Ne,idPrefix:Ce}=pe,{item:He,isOpen:ke,level:Me,parentUID:$e}=de[ie],tt=(0,l.useRef)(null),Ke=(0,l.useId)(),Re=(0,b.useSelector)(R.ku),Ve=(0,b.useSelector)(R.Am),Qe=(He.uid?Ve[He.uid]:Re)?.items??[];let je=[];He.uid&&(je=($e?Ve[$e]:Re)?.items??[]);const ze=(0,h.of)(w),Ye=(0,l.useCallback)(ce=>{ce.preventDefault(),ce.stopPropagation(),He.uid&&Te(He.uid,!ke)},[He.uid,ke,Te]),Ge=(0,l.useCallback)(()=>{He.kind==="folder"&&Ne(He)},[He,Ne]);if(He.kind==="ui"&&He.uiKind==="pagination-placeholder")return(0,t.jsxs)("span",{style:fe,className:ze.row,children:[(0,t.jsx)(I.T,{level:Me,spacing:2}),(0,t.jsx)(v.A,{width:W[ie%W.length]})]});if(He.kind!=="folder"){const ce=He.kind,Pe=He.uid;return null}return(0,t.jsx)("div",{ref:tt,style:fe,className:(0,n.cx)(ze.row,{[ze.rowFocused]:ie===le,[ze.rowSelected]:He.uid===De}),tabIndex:-1,onClick:Ge,"aria-expanded":ke,"aria-selected":He.uid===De,"aria-labelledby":Ke,"aria-level":Me+1,role:"treeitem","aria-owns":Qe.length>0?Qe.map(ce=>K(Ce,ce.uid)).join(" "):void 0,"aria-setsize":Qe.length,"aria-posinset":je.findIndex(ce=>ce.uid===He.uid)+1,id:K(Ce,He.uid),children:(0,t.jsxs)("div",{className:ze.rowBody,children:[(0,t.jsx)(I.T,{level:Me,spacing:2}),me?(0,t.jsx)(O.K,{size:L,onMouseDown:Ye,tabIndex:-1,"aria-label":ke?`Collapse folder ${He.title}`:`Expand folder ${He.title}`,name:ke?"angle-down":"angle-right"}):(0,t.jsx)("span",{className:ze.folderButtonSpacer}),(0,t.jsxs)("label",{className:ze.label,id:Ke,children:[(0,t.jsx)(i.E,{truncate:!0,children:He.title}),(0,t.jsx)(E.b,{folder:He})]})]})})}const w=ie=>
159{const fe=(0,n.css)({height:T,display:"flex",position:"relative",alignItems:"center",flexGrow:1,gap:ie.spacing(.5),overflow:"hidden",padding:ie.spacing(0,1)});return{table:(0,n.css)({background:ie.components.input.background}),emptyMessage:(0,n.css)({padding:ie.spacing(1),textAlign:"center",width:"100%"}),folderButtonSpacer:(0,n.css)({paddingLeft:ie.spacing(.5)}),row:(0,n.css)({display:"flex",position:"relative",alignItems:"center",":not(:first-child)":{borderTop:`solid 1px ${ie.colors.border.weak}`}}),rowFocused:(0,n.css)({backgroundColor:ie.colors.background.secondary}),rowSelected:(0,n.css)({"&::before":{display:"block",content:'""',position:"absolute",left:0,bottom:0,top:0,width:4,borderRadius:ie.shape.radius.default,backgroundImage:ie.colors.gradients.brandVertical}}),rowBody:fe,label:(0,n.css)({display:"flex",alignItems:"center",gap:ie.spacing(1),lineHeight:T+"px",flexGrow:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","&:hover":{textDecoration:"underline",cursor:"pointer"}})}};var j=e(35484),V=e(35222);function U({handleClearSelection:ie,isLoading:fe,invalid:pe,label:de,...le},me){const De=(0,h.$j)(),Te=M(De,pe),Ne=Ce=>{(Ce.key==="Enter"||Ce.key===" ")&&ie?.(Ce)};return fe?(0,t.jsx)(V.A,{}):(0,t.jsx)("div",{className:Te.wrapper,children:(0,t.jsxs)("div",{className:Te.inputWrapper,children:[de?(0,t.jsx)("div",{className:Te.prefix,children:(0,t.jsx)(g.I,{name:"folder"})}):void 0,(0,t.jsxs)("button",{type:"button",className:(0,n.cx)(Te.fakeInput,de?Te.hasPrefix:void 0),...le,ref:me,children:[de?(0,t.jsx)(i.E,{truncate:!0,children:de}):(0,t.jsx)(i.E,{truncate:!0,color:"secondary",children:(0,t.jsx)(y.x6,{i18nKey:"browse-dashboards.folder-picker.button-label",children:"Select folder"})}),!fe&&ie&&(0,t.jsx)(g.I,{role:"button",tabIndex:0,"aria-label":(0,y.t)("browse-dashboards.folder-picker.clear-selection","Clear selection"),className:Te.clearIcon,name:"times",onClick:ie,onKeyDown:Ne})]}),(0,t.jsx)("div",{className:Te.suffix,children:(0,t.jsx)(g.I,{name:"angle-down"})})]})})}const F=(0,l.forwardRef)(U),M=(ie,fe=!1)=>{const pe=(0,x.n)({theme:ie,invalid:fe});return{wrapper:pe.wrapper,inputWrapper:pe.inputWrapper,prefix:(0,n.css)([pe.prefix,{pointerEvents:"none",color:ie.colors.text.primary}]),suffix:(0,n.css)([pe.suffix,{pointerEvents:"none"}]),fakeInput:(0,n.css)([pe.input,{textAlign:"left",letterSpacing:"normal","&:focus":{outline:"unset",boxShadow:"unset"},"&:focus-visible":(0,j.getFocusStyles)(ie),alignItems:"center",display:"flex",flexWrap:"nowrap",justifyContent:"space-between",paddingRight:28}]),hasPrefix:(0,n.css)({paddingLeft:28}),clearIcon:(0,n.css)({color:ie.colors.text.secondary,cursor:"pointer","&:hover":{color:ie.colors.text.primary},"&:focus:not(:focus-visible)":(0,j.getMouseFocusStyles)(ie),"&:focus-visible":(0,j.getFocusStyles)(ie)})}};var H=e(25508),_=e(27044),Z=e(78034),ne=e(52763);const te="pending";function Y(ie){const fe=ie.at(-1),pe=fe?.originalArgs?.page,de=fe?.status===te;return fe?.data?[fe.data.length<fe.originalArgs.limit,pe,de]:[!1,pe,de]}function Q(ie,fe,pe){const de=(0,ne.wA)(),le=(0,l.useRef)([]),[me,De]=(0,l.useState)([]),Te=(0,l.useMemo)(()=>(0,H.Mz)(me,(...ke)=>{let Me=!1;const $e=[],tt={};for(const Ke of ke){Ke.status===te&&(Me=!0);const Re=Ke.originalArgs?.parentUid;Re?(tt[Re]||(tt[Re]=[]),tt[Re].push(Ke)):$e.push(Ke)}return{isLoading:Me,rootPages:$e,pagesByParent:tt}}),[me]),Ne=(0,ne.d4)(Te),Ce=(0,l.useCallback)(ke=>{const Me=ke?Ne.pagesByParent[ke]:Ne.rootPages,[$e,tt,Ke]=Y(Me??[]);if($e||Ke)return;const Re={parentUid:ke,page:(tt??0)+1,limit:_.md,permission:pe},Ve=de(P.cU.endpoints.listFolders.initiate(Re)),Qe=P.cU.endpoints.listFolders.select({parentUid:Ve.arg.parentUid,page:Ve.arg.page,limit:Ve.arg.limit,permission:Ve.arg.permission});De(je=>je.concat(Qe)),le.current=le.current.concat([Ve])},[Ne,de,pe]);return(0,l.useEffect)(()=>()=>{for(const ke of le.current)ke.unsubscribe()},[]),{items:(0,l.useMemo)(()=>{if(!ie)return[];function ke($e,tt,Ke){const Re=tt.flatMap(Qe=>(Qe.data??[]).flatMap(ze=>{const Ye=fe[ze.uid],Ge={isOpen:!!Ye,level:Ke,item:{kind:"folder",title:ze.title,uid:ze.uid,managedBy:ze.managedBy}},ce=Ye&&Ne.pagesByParent[ze.uid];if(ce){const Pe=ke(ze.uid,ce,Ke+1);return[Ge,...Pe]}return Ge})),[Ve]=Y(tt);return Ve||Re.push(...(0,Z.T)(_.md,$e,Ke)),Re}const Me=ke(void 0,Ne.rootPages,1);return Me.unshift(J),Me},[Ne,ie,fe]),isLoading:Ne.isLoading,requestNextPage:Ce}}const J={isOpen:!0,level:0,item:{kind:"folder",title:"Dashboards",uid:""}};function q({tree:ie,handleCloseOverlay:fe,handleFolderSelect:pe,handleFolderExpand:de,idPrefix:le,search:me,visible:De}){const[Te,Ne]=(0,l.useState)(-1),Ce=!!f.$.featureToggles.nestedFolders;(0,l.useEffect)(()=>{De&&Ne(-1)},[De]),(0,l.useEffect)(()=>{Ne(0)},[me]),(0,l.useEffect)(()=>{document.getElementById(K(le,ie[Te]?.item.uid))?.scrollIntoView({block:"nearest",inline:"nearest"})},[Te,le,ie]);const He=(0,l.useCallback)(ke=>{const Me=Ce&&!me;switch(ke.key){case"ArrowRight":case"ArrowLeft":Me&&(ke.preventDefault(),de(ie[Te].item.uid,ke.key==="ArrowRight"));break;case"ArrowUp":Te>0&&(ke.preventDefault(),Ne(Te-1));break;case"ArrowDown":Te<ie.length-1&&(ke.preventDefault(),Ne(Te+1));break;case"Enter":ke.preventDefault();const $e=ie[Te].item;$e.kind==="folder"&&pe($e);break;case"Tab":ke.stopPropagation(),fe();break;case"Escape":ke.stopPropagation(),ke.preventDefault(),fe();break}},[Te,fe,de,pe,Ce,me,ie]);return{focusedItemIndex:Te,handleKeyDown:He}}const X=a()(se,300);async function se(ie,fe){const pe=await(0,d.S)().search({query:ie,kind:["folder"],limit:100,permission:fe}),de=pe.view.map(le=>
159(0,D.hI)(le,pe.view));return{...pe,items:de}}function oe({value:ie,invalid:fe,showRootFolder:pe=!0,clearable:de=!1,excludeUIDs:le,permission:me="edit",onChange:De}){const Te=(0,h.of)(ae),Ne=(0,P.kH)(ie||P.hT),Ce=!!f.$.featureToggles.nestedFolders,[He,ke]=(0,l.useState)(""),[Me,$e]=(0,l.useState)(null),[tt,Ke]=(0,l.useState)(!1),[Re,Ve]=(0,l.useState)(!1),[Qe,je]=(0,l.useState)(!1),[ze,Ye]=(0,l.useState)({}),Ge=(0,l.useId)(),[ce]=(0,l.useState)(void 0),Pe=(0,l.useRef)(0),Se=(0,l.useMemo)(()=>{if(me==="view")return b.PermissionLevelString.View;if(me==="edit")return b.PermissionLevelString.Edit;throw new Error("Invalid permission")},[me]),Ee=!!(Qe&&!(He&&Me)),{items:xe,isLoading:ye,requestNextPage:Oe}=Q(Ee,ze,Se);(0,l.useEffect)(()=>{if(!He){$e(null);return}const Zt=Date.now();Ke(!0),X(He,Se).then(tn=>{if(Zt>Pe.current){const ft=tn.view.map(Rt=>(0,D.hI)(Rt,tn.view));$e({...tn,items:ft}),Ke(!1),Pe.current=Zt}})},[He,Se]);const we=[(0,r.UU)({crossAxis:!1,boundary:document.body})],{context:Be,refs:Xe,floatingStyles:st,elements:lt}=(0,o.we)({open:Qe,placement:"bottom",onOpenChange:Zt=>{Zt&&(ke(""),Ve(!0)),je(Zt)},middleware:we,whileElementsMounted:s.ll}),Et=(0,o.kp)(Be),Tt=(0,o.s9)(Be),{getReferenceProps:Mt,getFloatingProps:wt}=(0,o.bv)([Tt,Et]),_e=(0,l.useCallback)(async(Zt,tn)=>{Ye(ft=>({...ft,[Zt]:tn})),tn&&!ze[Zt]&&Oe(Zt)},[Oe,ze]),xt=(0,l.useCallback)(Zt=>{De&&De(Zt.uid,Zt.title),je(!1)},[De]),At=(0,l.useCallback)(Zt=>{Zt.preventDefault(),Zt.stopPropagation(),De&&De(void 0,void 0)},[De]),bt=(0,l.useCallback)(()=>je(!1),[je]),Xt=(0,l.useCallback)(Zt=>{He||Oe(Zt)},[He,Oe]),Cn=(0,l.useMemo)(()=>{let Zt=[];return Ee?Zt=xe:Zt=Me?.items.map(tn=>({isOpen:!1,level:0,item:{kind:"folder",title:tn.title,uid:tn.uid}}))??[],(!pe||le?.length)&&(Zt=Zt.filter(tn=>!(!pe&&tn===J||le?.includes(tn.item.uid)))),Zt},[xe,le,Ee,Me?.items,pe]),vn=(0,l.useCallback)(Zt=>{const tn=Cn[Zt];if(!tn)return!1;const ft=tn.item;return!(ft.kind==="ui"&&ft.uiKind==="pagination-placeholder")},[Cn]),Wn=ye||tt,{focusedItemIndex:Dt,handleKeyDown:qt}=q({tree:Cn,handleCloseOverlay:bt,handleFolderSelect:xt,handleFolderExpand:_e,idPrefix:Ge,search:He,visible:Qe});let Yt=Ne.data?.title;ie===""&&(Yt="Dashboards");const nn=Yt?(0,t.jsxs)(u.B,{alignItems:"center",children:[(0,t.jsx)(i.E,{truncate:!0,children:Yt}),(0,t.jsx)(E.b,{folder:Ne.data})]}):"";return Qe?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.p,{ref:Xe.setReference,autoFocus:!0,prefix:Yt?(0,t.jsx)(g.I,{name:"folder"}):null,placeholder:Yt??(0,y.t)("browse-dashboards.folder-picker.search-placeholder","Search folders"),value:He,invalid:fe,className:Te.search,onChange:Zt=>ke(Zt.currentTarget.value),"aria-autocomplete":"list","aria-expanded":!0,"aria-haspopup":!0,"aria-controls":Ge,"aria-owns":Ge,"aria-activedescendant":K(Ge,Cn[Dt]?.item.uid),role:"combobox",suffix:(0,t.jsx)(g.I,{name:"search"}),...Mt(),onKeyDown:qt}),(0,t.jsx)("fieldset",{ref:Xe.setFloating,id:Ge,className:Te.tableWrapper,style:{...st,width:lt.domReference?.clientWidth},...wt(),children:ce?(0,t.jsx)(p.F,{className:Te.error,severity:"warning",title:(0,y.t)("browse-dashboards.folder-picker.error-title","Error loading folders"),children:ce.message||ce.toString?.()||(0,y.t)("browse-dashboards.folder-picker.unknown-error","Unknown error")}):(0,t.jsxs)("div",{children:[Wn&&(0,t.jsx)("div",{className:Te.loader,children:(0,t.jsx)(c.G,{width:600})}),(0,t.jsx)(A,{items:Cn,selectedFolder:ie,focusedItemIndex:Dt,onFolderExpand:_e,onFolderSelect:xt,idPrefix:Ge,foldersAreOpenable:Ce&&!(He&&Me),isItemLoaded:vn,requestLoadMore:Xt})]})})]}):(0,t.jsx)(F,{label:nn,handleClearSelection:de&&ie!==void 0?At:void 0,invalid:fe,isLoading:Ne.isLoading,autoFocus:Re,ref:Xe.setReference,"aria-label":Yt?(0,y.t)("browse-dashboards.folder-picker.accessible-label","Select folder: {{ label }} currently selected",{label:Yt}):void 0,...Mt()})}const ae=ie=>({button:(0,n.css)({maxWidth:"100%"}),error:(0,n.css)({marginBottom:0}),tableWrapper:(0,n.css)({boxShadow:ie.shadows.z3,position:"relative",zIndex:ie.zIndex.portal}),loader:(0,n.css)({position:"absolute",top:0,left:0,right:0,zIndex:ie.zIndex.portal+1,overflow:"hidden"}),search:(0,n.css)({input:{cursor:"default"}})})},35222:(ee,B,e)=>{"use strict";e.d(B,{A:()=>m});var t=e(74848),n=e(22803),r=e(70255),o=e(63142),s=e(63527);function m(){const l=(0,o.of)(a);return(0,t.jsx)("div",{className:l.wrapper,children:(0,t.jsx)("div",{className:l.inputWrapper,children:(0,t.jsx)("button",{type:"button",className:l.fakeInput,"aria-disabled":!0,children:(0,t.jsx)(r.A,{width:100})})})})}const a=l=>{const f=(0,s.n)({theme:l});return{wrapper:f.wrapper,inputWrapper:f.inputWrapper,fakeInput:(0,n.css)([f.input,{textAlign:"left"}])}}},19753:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>a});var t=e(74848),n=e(2543),r=e.n(n),o=e(96540),s=e(63527),m=e(37386);class a extends o.PureComponent{constructor(){super(...arguments),this.state={text:"",inputCorrected:!1}
159,this.inputRef=o.createRef(),this.updateValue=()=>{const f=this.inputRef.current?.value;let h=!1,u="";const i=this.props.min,x=this.props.max;let g=f!==""?Number(f):void 0;g&&!Number.isNaN(g)&&(i!=null&&g<i?(u=i.toString(),h=!0):x!=null&&g>x?(u=x.toString(),h=!0):u=f??"",this.setState({text:u,inputCorrected:h})),h&&this.updateValueDebounced(),!Number.isNaN(g)&&g!==this.props.value&&this.props.onChange(g)},this.updateValueDebounced=(0,n.debounce)(this.updateValue,500),this.onChange=f=>{this.setState({text:f.currentTarget.value}),this.updateValueDebounced()},this.onKeyPress=f=>{f.key==="Enter"&&this.updateValue()}}componentDidMount(){this.setState({text:isNaN(this.props.value)?"":`${this.props.value}`})}componentDidUpdate(f){if(this.props.value!==f.value){const h=isNaN(this.props.value)?"":`${this.props.value}`;h!==this.state.text&&this.setState({text:h})}}renderInput(){return(0,t.jsx)(s.p,{type:"number",ref:this.inputRef,min:this.props.min,max:this.props.max,step:this.props.step,autoFocus:this.props.autoFocus,value:this.state.text,onChange:this.onChange,onBlur:this.updateValue,onKeyPress:this.onKeyPress,placeholder:this.props.placeholder,disabled:this.props.fieldDisabled,width:this.props.width,suffix:this.props.suffix})}render(){const{inputCorrected:f}=this.state;if(f){let h="",{min:u,max:i}=this.props;return i==null?u!=null&&(h=`< ${u}`):u!=null?h=`${u} < > ${i}`:h=`> ${i}`,(0,t.jsx)(m.D,{invalid:f,error:`Out of range ${h}`,validationMessageHorizontalOverflow:!0,style:{direction:"rtl"},children:this.renderInput()})}return this.renderInput()}}},38669:(ee,B,e)=>{"use strict";e.d(B,{a:()=>l});var t=e(74848),n=e(22803),r=e(63142),o=e(35427),s=e(76319),m=e(13409),a=e(56840);const l=({value:h,settings:u,onChange:i,details:x})=>{const g=(0,r.$j)(),p=(0,r.of)(f);return(0,t.jsx)(o.sk,{color:h??"",onChange:i,enableNamedColors:u?.enableNamedColors!==!1,children:({ref:c,showColorPicker:y,hideColorPicker:P})=>(0,t.jsxs)("div",{className:p.spot,children:[(0,t.jsx)("div",{className:p.colorPicker,children:(0,t.jsx)(m.q,{ref:c,onClick:y,onMouseLeave:P,color:h?g.visualization.getColorByName(h):g.components.input.borderColor})}),x&&(0,t.jsxs)(t.Fragment,{children:[h?(0,t.jsx)("span",{className:p.colorText,onClick:y,children:h}):(0,t.jsx)("span",{className:p.placeholderText,onClick:y,children:u?.placeholder??"Select color"}),u?.isClearable&&h&&(0,t.jsx)(s.K,{name:"times",onClick:()=>i(void 0),tooltip:(0,a.t)("options-ui.color.clear-tooltip","Clear settings")})]})]})})},f=h=>({spot:(0,n.css)({cursor:"pointer",color:h.colors.text.primary,background:h.components.input.background,padding:"3px",height:h.v1.spacing.formInputHeight,border:`1px solid ${h.components.input.borderColor}`,display:"flex",flexDirection:"row",alignItems:"center",alignContent:"flex-end","&:hover":{border:`1px solid ${h.components.input.borderHover}`}}),colorPicker:(0,n.css)({padding:`0 ${h.spacing(1)}`}),colorText:(0,n.css)({flexGrow:2}),placeholderText:(0,n.css)({flexGrow:2,color:h.colors.text.secondary})})},85053:(ee,B,e)=>{"use strict";e.d(B,{w:()=>o});var t=e(74848),n=e(96540),r=e(19753);const o=({value:s,onChange:m,item:a})=>{const{settings:l}=a,f=(0,n.useCallback)(h=>{m(l?.integer&&h!==void 0?Math.floor(h):h)},[m,l?.integer]);return(0,t.jsx)(r.Q,{value:s,min:l?.min,max:l?.max,step:l?.step,placeholder:l?.placeholder,onChange:f})}},83162:(ee,B,e)=>{"use strict";e.d(B,{H:()=>Pe,u:()=>Se});var t=e(74848),n=e(53543),r=e(38809),o=e(95004),s=e(33553),m=e(21285),a=e(77824),l=e(59310),f=e(48457),h=e(96540),u=e(22803),i=e(2543),x=e(36394),g=e(35555),p=e(8255),c=e(63527),y=e(35427),P=e(76319),d=e(45861),D=e(72636),b=e(65240),E=e(56840);const v=[{value:s.O.Absolute,label:"Absolute",description:"Pick thresholds based on the absolute values"},{value:s.O.Percentage,label:"Percentage",description:"Pick threshold based on the percent between min/max"}];class C extends h.PureComponent{constructor(xe){super(xe),this.onAddThreshold=()=>{const{steps:Oe}=this.state;let we=0;Oe.length>1&&(we=Oe[Oe.length-1].value+10);let Be=p.Tj.filter(lt=>!Oe.some(Et=>Et.color===lt))[1];Be||(Be="#CCCCCC");const Xe={value:we,color:Be,key:S++},st=[...Oe,Xe];(0,x.RU)(st),this.setState({steps:st},()=>{this.latestThresholdInputRef.current&&this.latestThresholdInputRef.current.focus(),this.onChange()})},this.onRemoveThreshold=Oe=>{const{steps:we}=this.state;we.length&&Oe.key!==we[0].key&&this.setState({steps:we.filter(Be=>Be.key!==Oe.key)},this.onChange)},this.onChangeThresholdValue=(Oe,we)=>{const Be=Oe.target.value.replace(/,/g,"."),Xe=parseFloat(Be),st=isNaN(Xe)?"":Xe,lt=this.state.steps.map(Et=>(Et.key===we.key&&(Et={...Et,value:st}),Et));lt.length&&(lt[0].value=-1/0),(0,x.RU)(lt),this.setState({steps:lt})},this.onChangeThresholdColor=(Oe,we)=>{const{steps:Be}=this.state,Xe=Be.map(st=>(st.key===Oe.key&&(st={...st,color:we}),st));this.setState({steps:Xe},this.onChange)},this.onBlur=()=>{const Oe=[...this.state.steps];(0,x.RU)(Oe),this.setState({steps:Oe},this.onChange)},this.onChange=()=>{this.props.onChange(I(this.props.thresholds,this.state.steps))},this.onModeChanged=Oe=>{this.props.onChange({...this.props.thresholds,mode:Oe})};const ye=O(xe.thresholds.steps);ye[0].value=-1/0,this.state={steps:ye},this.latestThresholdInputRef=h.createRef()}renderInput(xe,ye,Oe){const we=this.props.thresholds.mode===s.O.Percentage,Be=`Threshold ${Oe+1}`;return isFinite(xe.value)?(0,t.jsx)(c.p,{type:"number",step:"0.0001",onChange:Xe=>this.onChangeThresholdValue(Xe,xe),value:xe.value,"aria-label":Be,ref:Oe===0?this.latestThresholdInputRef:null,onBlur:this.onBlur,prefix:(0,t.jsxs)("div",{className:ye.inputPrefix,children:[(0,t.jsx)("div",{className:ye.colorPicker,children:(0,t.jsx)(y.sk,{color:xe.color,onChange:Xe=>this.onChangeThresholdColor(xe,Xe),enableNamedColors:!0})}),we&&(0,t.jsx)("div",{className:ye.percentIcon,children:"%"})]}),suffix:(0,t.jsx)(P.K,{className:ye.trashIcon,name:"trash-alt",onClick:()=>this.onRemoveThreshold(xe),tooltip:`Remove ${Be}`})},we.toString()):(0,t.jsx)(c.p,{type:"text",value:"Base","aria-label":Be,disabled:!0,prefix:(0,t.jsx)("div",{className:ye.colorPicker,children:(0,t.jsx)(y.sk,{color:xe.color,onChange:Xe=>this.onChangeThresholdColor(xe,Xe),enableNamedColors:!0})})})}render(){const{thresholds:xe}=this.props,{steps:ye}=this.state;return(0,t.jsx)(g.D.Consumer,{children:Oe=>{const we=R(Oe);return(0,t.jsxs)("div",{className:we.wrapper,children:[(0,t.jsx)(d.$n,{size:"sm",icon:"plus",onClick:()=>this.onAddThreshold(),variant:"secondary",className:we.addButton,fullWidth:!0,children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.thresholds-editor.add-threshold",children:"Add threshold"})}),(0,t.jsx)("div",{className:we.thresholds,children:ye.slice(0).reverse().map((Be,Xe)=>(0,t.jsx)("div",{className:we.item,children:this.renderInput(Be,we,Xe)},`${Be.key}`))}),(0,t.jsxs)("div",{children:[(0,t.jsx)(D.J,{description:(0,E.t)("dimensions.thresholds-editor.description-percentage-means-thresholds-relative","Percentage means thresholds relative to min & max"),children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.thresholds-editor.thresholds-mode",children:"Thresholds mode"})}),(0,t.jsx)(a.z,{options:v,onChange:this.onModeChanged,value:xe.mode})]})]})}})}}let S=100;function O(Ee){return(!Ee||Ee.length===0)&&(Ee=[{value:-1/0,color:"green"}]),Ee.filter((xe,ye)=>(0,i.isNumber)(xe.value)||ye===0).map(xe=>({color:xe.color,value:xe.value===null?-1/0:xe.value,key:S++}))}function I(Ee,xe){return{mode:Ee.mode??s.O.Absolute,steps:xe.map(Oe=>{const{key:we,...Be}=Oe;return Be})}}const R=(0,b.N)(Ee=>({wrapper:(0,u.css)({display:"flex",flexDirection:"column"}),thresholds:(0,u.css)({display:"flex",flexDirection:"column",marginBottom:Ee.spacing(2)}),item:(0,u.css)({marginBottom:Ee.spacing(1),"&:last-child":{marginBottom:0}}),colorPicker:(0,u.css)({padding:Ee.spacing(0,1)}),addButton:(0,u.css)({marginBottom:Ee.spacing(1)}),percentIcon:(0,u.css)({fontSize:Ee.typography.bodySmall.fontSize,color:Ee.colors.text.secondary}),inputPrefix:(0,u.css)({display:"flex",alignItems:"center"}),trashIcon:(0,u.css)({color:Ee.colors.text.secondary,cursor:"pointer",marginRight:0,"&:hover":{color:Ee.colors.text.primary}})}));class T extends h.PureComponent{constructor(xe){super(xe)}render(){const{onChange:xe}=this.props;let ye=this.props.value;return ye||(ye={mode:s.O.Percentage,steps:[]}),(0,t.jsx)(C,{thresholds:ye,onChange:xe})}}var L=e(18600),K=e(63142),A=e(32881),W=e(30703),N=e(22787),w=e(4896),j=e(71451),V=e(57095),U=e(59695),F=e(18857);
159function M({mapping:Ee,index:xe,onChange:ye,onRemove:Oe,onDuplicate:we,showIconPicker:Be}){const{key:Xe,result:st,id:lt}=Ee,Et=(0,K.of)(H),Tt=(0,h.useRef)(null),Mt=(0,h.useCallback)(Yt=>{const nn={...Ee,result:{...Ee.result}};Yt(nn),ye(xe,nn)},[Ee,xe,ye]);(0,h.useEffect)(()=>{Tt.current&&Ee.isNew&&(Tt.current.focus(),Mt(Yt=>{Yt.isNew=!1}))},[Ee,Tt,Mt]);const wt=Yt=>{Mt(nn=>{nn.result.color=Yt})},_e=()=>{Mt(Yt=>{Yt.result.color=void 0})},xt=Yt=>{Mt(nn=>{nn.result.icon=Yt})},At=()=>{Mt(Yt=>{Yt.result.icon=void 0})},bt=Yt=>{Mt(nn=>{nn.key=Yt.currentTarget.value})},Xt=Yt=>{Mt(nn=>{nn.result.text=Yt.currentTarget.value})},Cn=Yt=>{Mt(nn=>{nn.from=parseFloat(Yt.currentTarget.value)})},vn=Yt=>{Mt(nn=>{nn.to=parseFloat(Yt.currentTarget.value)})},Wn=Yt=>{Mt(nn=>{nn.pattern=Yt.currentTarget.value})},Dt=Yt=>{Mt(nn=>{nn.specialMatch=Yt.value})},qt=[{label:"Null",value:L.W.Null,description:"Matches null and undefined values"},{label:"NaN",value:L.W.NaN,description:"Matches against Number.NaN (not a number)"},{label:"Null + NaN",value:L.W.NullAndNaN,description:"Matches null, undefined and NaN"},{label:"True",value:L.W.True,description:"Boolean true values"},{label:"False",value:L.W.False,description:"Boolean false values"},{label:"Empty",value:L.W.Empty,description:"Empty string"}];return(0,t.jsx)(V.Draggable,{draggableId:lt,index:xe,children:Yt=>(0,t.jsxs)("tr",{className:Et.dragRow,ref:Yt.innerRef,...Yt.draggableProps,children:[(0,t.jsx)("td",{children:(0,t.jsx)("div",{className:Et.dragHandle,...Yt.dragHandleProps,children:(0,t.jsx)(W.I,{name:"draggabledots",size:"lg"})})}),(0,t.jsx)("td",{className:Et.typeColumn,children:Ee.type}),(0,t.jsxs)("td",{children:[Ee.type===L.d.ValueToText&&(0,t.jsx)(c.p,{ref:Tt,type:"text",value:Xe??"",onChange:bt,placeholder:(0,E.t)("dimensions.value-mapping-edit-row.placeholder-exact-value-to-match","Exact value to match")}),Ee.type===L.d.RangeToText&&(0,t.jsxs)("div",{className:Et.rangeInputWrapper,children:[(0,t.jsx)(c.p,{type:"number",value:Ee.from??"",placeholder:(0,E.t)("dimensions.value-mapping-edit-row.placeholder-from","From"),onChange:Cn}),(0,t.jsx)(c.p,{type:"number",value:Ee.to??"",placeholder:(0,E.t)("dimensions.value-mapping-edit-row.placeholder-to","To"),onChange:vn})]}),Ee.type===L.d.RegexToText&&(0,t.jsx)(c.p,{type:"text",value:Ee.pattern??"",placeholder:(0,E.t)("dimensions.value-mapping-edit-row.placeholder-regular-expression","Regular expression"),onChange:Wn}),Ee.type===L.d.SpecialValue&&(0,t.jsx)(F.l6,{value:qt.find(nn=>nn.value===Ee.specialMatch),options:qt,onChange:Dt})]}),(0,t.jsx)("td",{children:(0,t.jsx)(c.p,{type:"text",value:st.text??"",onChange:Xt,placeholder:(0,E.t)("dimensions.value-mapping-edit-row.placeholder-optional-display-text","Optional display text")})}),(0,t.jsxs)("td",{className:Et.textAlignCenter,children:[st.color&&(0,t.jsxs)(A.Gy,{spacing:"sm",justify:"center",children:[(0,t.jsx)(y.sk,{color:st.color,onChange:wt,enableNamedColors:!0}),(0,t.jsx)(P.K,{name:"times",onClick:_e,tooltip:(0,E.t)("dimensions.value-mapping-edit-row.tooltip-remove-color","Remove color"),tooltipPlacement:"top"})]}),!st.color&&(0,t.jsx)(y.sk,{color:"gray",onChange:wt,enableNamedColors:!0,children:nn=>(0,t.jsx)(d.$n,{variant:"primary",fill:"text",onClick:nn.showColorPicker,ref:nn.ref,size:"sm",children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mapping-edit-row.set-color",children:"Set color"})})})]}),Be&&(0,t.jsx)("td",{className:Et.textAlignCenter,children:(0,t.jsxs)(A.Gy,{spacing:"sm",justify:"center",children:[(0,t.jsx)(j.n,{onChange:xt,onClear:At,value:st.icon,size:w.Iy.SMALL,folderName:w.Iu.Icon,mediaType:w.zu.Icon,color:st.color}),st.icon&&(0,t.jsx)(P.K,{name:"times",onClick:At,tooltip:(0,E.t)("dimensions.value-mapping-edit-row.tooltip-remove-icon","Remove icon"),tooltipPlacement:"top"})]})}),(0,t.jsx)("td",{className:Et.textAlignCenter,children:(0,t.jsxs)(A.Gy,{spacing:"sm",children:[(0,t.jsx)(P.K,{name:"copy",onClick:()=>we(xe),"data-testid":"duplicate-value-mapping","aria-label":(0,E.t)("dimensions.value-mapping-edit-row.duplicate-value-mapping-aria-label-duplicate-value-mapping","Duplicate value mapping"),tooltip:(0,E.t)("dimensions.value-mapping-edit-row.duplicate-value-mapping-tooltip-duplicate","Duplicate")}),(0,t.jsx)(P.K,{name:"trash-alt",onClick:()=>Oe(xe),"data-testid":"remove-value-mapping","aria-label":(0,E.t)("dimensions.value-mapping-edit-row.remove-value-mapping-aria-label-delete-value-mapping","Delete value mapping"),tooltip:(0,E.t)("dimensions.value-mapping-edit-row.remove-value-mapping-tooltip-delete","Delete")})]})})]})},lt)}const H=Ee=>({dragRow:(0,u.css)({position:"relative"}),dragHandle:(0,u.css)({cursor:"grab","&:focus-visible&:after":{bottom:0,content:'""',left:0,position:"absolute",right:0,top:0,outline:`2px solid ${Ee.colors.primary.main}`,outlineOffset:"-2px"}}),rangeInputWrapper:(0,u.css)({display:"flex","> div:first-child":{marginRight:Ee.spacing(2)}}),regexInputWrapper:(0,u.css)({display:"flex","> div:first-child":{marginRight:Ee.spacing(2)}}),typeColumn:(0,u.css)({textTransform:"capitalize",textAlign:"center",width:"1%"}),textAlignCenter:(0,u.css)({textAlign:"center"})});function _({value:Ee,onChange:xe,onClose:ye,showIconPicker:Oe}){const we=(0,K.of)(Z),[Be,Xe]=(0,h.useState)([]);(0,h.useEffect)(()=>{Xe(J(Ee))},[Ee]);const st=xt=>{if(!Ee||!xt.destination)return;const At=[...Be],bt=At[xt.source.index];At.splice(xt.source.index,1),At.splice(xt.destination.index,0,bt),Xe(At)},lt=(xt,At)=>{const bt=[...Be];bt.splice(xt,1,At),Xe(bt)},Et=xt=>{const At=[...Be];At.splice(xt,1),Xe(At)}
159,Tt=[{label:"Value",value:L.d.ValueToText,description:"Match a specific text value"},{label:"Range",value:L.d.RangeToText,description:"Match a numerical range of values"},{label:"Regex",value:L.d.RegexToText,description:"Match a regular expression with replacement"},{label:"Special",value:L.d.SpecialValue,description:"Match on null, NaN, boolean and empty values"}],Mt=xt=>{Xe([...Be,te({type:xt.value,result:{},isNew:!0})])},wt=xt=>{const At=Y(Be[xt]),bt=[...Be];bt.splice(xt,0,{...At});for(let Xt=xt;Xt<Be.length;Xt++)bt[Xt].result.index=Xt;Xe(bt)},_e=()=>{xe(Q(Be)),ye()};return(0,h.useEffect)(()=>{Ee?.length||Mt({value:L.d.ValueToText})},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:we.tableWrap,children:(0,t.jsxs)("table",{className:we.editTable,children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{style:{width:"1%"}}),(0,t.jsx)("th",{style:{width:"40%",textAlign:"left"},colSpan:2,children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor-modal.condition",children:"Condition"})}),(0,t.jsx)("th",{style:{textAlign:"left"},children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor-modal.display-text",children:"Display text"})}),(0,t.jsx)("th",{style:{width:"10%"},children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor-modal.color",children:"Color"})}),Oe&&(0,t.jsx)("th",{style:{width:"10%"},children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor-modal.icon",children:"Icon"})}),(0,t.jsx)("th",{style:{width:"1%"}})]})}),(0,t.jsx)(V.DragDropContext,{onDragEnd:st,children:(0,t.jsx)(V.Droppable,{droppableId:"sortable-field-mappings",direction:"vertical",children:xt=>(0,t.jsxs)("tbody",{ref:xt.innerRef,...xt.droppableProps,children:[Be.map((At,bt)=>(0,t.jsx)(M,{mapping:At,index:bt,onChange:lt,onRemove:Et,onDuplicate:wt,showIconPicker:Oe},At.id)),xt.placeholder]})})})]})}),(0,t.jsxs)(N.a.ButtonRow,{leftItems:(0,t.jsx)(U.i,{label:(0,E.t)("dimensions.value-mappings-editor-modal.label-add-a-new-mapping","Add a new mapping"),variant:"secondary",size:"md",icon:"plus",menuPlacement:"auto",minWidth:40,options:Tt,onChange:Mt}),children:[(0,t.jsx)(d.$n,{variant:"secondary",fill:"outline",onClick:ye,children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor-modal.cancel",children:"Cancel"})}),(0,t.jsx)(d.$n,{variant:"primary",onClick:_e,children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor-modal.update",children:"Update"})})]})]})}const Z=Ee=>({tableWrap:(0,u.css)({maxHeight:"calc(80vh - 170px)",minHeight:"40px",overflow:"auto"}),editTable:(0,u.css)({width:"100%",marginBottom:Ee.spacing(2),"thead th":{textAlign:"center"},"tbody tr:hover":{background:Ee.colors.action.hover}," th, td":{padding:Ee.spacing(1)}})});function ne(){return(0,i.uniqueId)("mapping-")}function te(Ee){return{type:L.d.ValueToText,result:{},id:ne(),...Ee}}function Y(Ee){return{...te(Ee),id:ne()}}function Q(Ee){const xe=[],ye={type:L.d.ValueToText,options:{}};return Ee.forEach((Oe,we)=>{const Be={...Oe.result,index:we};switch((!Be.text||Be.text.trim().length===0)&&(Be.text=void 0),Oe.type){case L.d.ValueToText:Oe.key!=null&&(ye.options[Oe.key]=Be);break;case L.d.RangeToText:(Oe.from!=null||Oe.to!=null)&&xe.push({type:Oe.type,options:{from:Oe.from??null,to:Oe.to??null,result:Be}});break;case L.d.RegexToText:Oe.pattern!=null&&xe.push({type:Oe.type,options:{pattern:Oe.pattern,result:Be}});break;case L.d.SpecialValue:xe.push({type:Oe.type,options:{match:Oe.specialMatch,result:Be}})}}),Object.keys(ye.options).length>0&&xe.unshift(ye),xe}function J(Ee){const xe=[];if(Ee)for(const ye of Ee)switch(ye.type){case L.d.ValueToText:for(const Oe in ye.options)xe.push(te({type:ye.type,result:ye.options[Oe],key:Oe}));break;case L.d.RangeToText:xe.push(te({type:ye.type,result:ye.options.result,from:ye.options.from,to:ye.options.to}));break;case L.d.RegexToText:xe.push(te({type:ye.type,result:ye.options.result,pattern:ye.options.pattern}
159));break;case L.d.SpecialValue:xe.push(te({type:ye.type,result:ye.options.result,specialMatch:ye.options.match??L.W.Null}))}return xe.sort((ye,Oe)=>(ye.result.index??0)>(Oe.result.index??0)?1:-1),xe}const q=(0,h.memo)(Ee=>{const{value:xe,onChange:ye,item:Oe}=Ee,we=(0,K.of)(X),Be=Oe.settings?.icon,[Xe,st]=(0,h.useState)(!1),lt=(0,h.useCallback)(()=>{st(!1)},[st]),Et=(0,h.useMemo)(()=>J(xe),[xe]),Tt=(0,h.useCallback)((wt,_e)=>{Et[_e].result.color=wt,ye(Q(Et))},[Et,ye]),Mt=(0,h.useCallback)((wt,_e)=>{Et[_e].result.icon=wt,ye(Q(Et))},[Et,ye]);return(0,t.jsxs)(A.gW,{children:[(0,t.jsx)("table",{className:we.compactTable,children:(0,t.jsx)("tbody",{children:Et.map((wt,_e)=>(0,t.jsxs)("tr",{children:[(0,t.jsxs)("td",{children:[wt.type===L.d.ValueToText&&wt.key,wt.type===L.d.RangeToText&&(0,t.jsxs)("span",{children:["[",wt.from??"-\u221E"," - ",wt.to??"\u221E","]"]}),wt.type===L.d.RegexToText&&wt.pattern,wt.type===L.d.SpecialValue&&wt.specialMatch]}),(0,t.jsx)("td",{children:(0,t.jsx)(W.I,{name:"arrow-right"})}),(0,t.jsx)("td",{children:wt.result.text}),wt.result.color&&(0,t.jsx)("td",{children:(0,t.jsx)(y.sk,{color:wt.result.color,onChange:xt=>Tt(xt,_e),enableNamedColors:!0})}),Be&&wt.result.icon&&(0,t.jsx)("td",{"data-testid":"iconPicker",children:(0,t.jsx)(j.n,{onChange:xt=>Mt(xt,_e),value:wt.result.icon,size:w.Iy.SMALL,folderName:w.Iu.Icon,mediaType:w.zu.Icon,color:wt.result.color})})]},_e.toString()))})}),(0,t.jsxs)(d.$n,{variant:"secondary",size:"sm",fullWidth:!0,onClick:()=>st(!0),children:[Et.length>0&&(0,t.jsx)("span",{children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor.edit-value-mappings",children:"Edit value mappings"})}),Et.length===0&&(0,t.jsx)("span",{children:(0,t.jsx)(E.x6,{i18nKey:"dimensions.value-mappings-editor.add-value-mappings",children:"Add value mappings"})})]}),(0,t.jsx)(N.a,{isOpen:Xe,title:(0,E.t)("dimensions.value-mappings-editor.title-value-mappings","Value mappings"),onDismiss:lt,className:we.modal,closeOnBackdropClick:!1,children:(0,t.jsx)(_,{value:xe,onChange:ye,onClose:lt,showIconPicker:Be})})]})});q.displayName="ValueMappingsEditor";const X=Ee=>({modal:(0,u.css)({width:"980px"}),compactTable:(0,u.css)({width:"100%","tbody td":{padding:Ee.spacing(.5)}})});var se=e(95506);const oe=({value:Ee,onChange:xe,item:ye})=>{const{placeholder:Oe,isClearable:we}=ye?.settings??{},Be=(0,h.useCallback)(Xe=>{xe(Xe?.value?.uid)},[xe]);return(0,t.jsx)(se.b,{isClearable:we,defaultOptions:!0,onChange:Be,placeholder:Oe,value:Ee})};var ae=e(79609),ie=e(92273);const fe=({value:Ee,onChange:xe,context:ye})=>(0,t.jsx)(ie.G,{actions:Ee,onChange:xe,data:ye.data,getSuggestions:()=>ye.getSuggestions?ye.getSuggestions(ae.uP.Values):[]});var pe=e(38669),de=e(76637),le=e(64394),me=e(37386);const De=({value:Ee,onChange:xe,item:ye,id:Oe})=>{const we=(0,K.$j)(),Be=(0,K.of)(Ne),Xe=(0,de.Hs)(Ee?.mode),lt=(ye.settings?.byValueSupport?de.uf.list():de.uf.list().filter(_e=>!_e.isByValue)).filter(_e=>!_e.excludeFromPicker).map(_e=>{let xt=_e.isByValue?" (by value)":"";return{value:_e.id,label:`${_e.name}${xt}`,description:_e.description,isContinuous:_e.isContinuous,isByValue:_e.isByValue,component(){return(0,t.jsx)(Te,{mode:_e,theme:we})}}}),Et=_e=>{xe({...Ee,mode:_e.value})},Tt=_e=>{xe({...Ee,mode:wt,fixedColor:_e})},Mt=_e=>{xe({...Ee,mode:wt,seriesBy:_e})},wt=Ee?.mode??le.Y.Thresholds;if(wt===le.Y.Fixed||wt===le.Y.Shades)return(0,t.jsxs)("div",{className:Be.group,children:[(0,t.jsx)(F.l6,{minMenuHeight:200,options:lt,value:wt,onChange:Et,className:Be.select,inputId:Oe}),(0,t.jsx)(pe.a,{value:Ee?.fixedColor,onChange:Tt})]});if(ye.settings?.bySeriesSupport&&Xe.isByValue){const _e=[{label:"Last",value:"last"},{label:"Min",value:"min"},{label:"Max",value:"max"}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{marginBottom:we.spacing(2)},children:(0,t.jsx)(F.l6,{minMenuHeight:200,options:lt,value:wt,onChange:Et,inputId:Oe})}),(0,t.jsx)(me.D,{label:(0,E.t)("options-ui.field-color.color-by-label","Color series by"),children:(0,t.jsx)(a.z,{value:Ee?.seriesBy??"last",options:_e,onChange:Mt})})]})}return(0,t.jsx)(F.l6,{minMenuHeight:200,options:lt,value:wt,onChange:Et,inputId:Oe})},Te=({mode:Ee,theme:xe})=>
159{if(!Ee.getColors)return null;const ye=Ee.getColors(xe).map(xe.visualization.getColorByName),Oe={height:"8px",width:"100%",margin:"2px 0",borderRadius:"3px",opacity:1};if(Ee.isContinuous)Oe.background=`linear-gradient(90deg, ${ye.join(",")})`;else{let we="",Be="";for(let Xe=0;Xe<ye.length;Xe++){const st=ye[Xe];if(we==="")we=`linear-gradient(90deg, ${st} 0%`;else{const Et=Xe/(ye.length-1)*100;we+=`, ${Be} ${Et}%, ${st} ${Et}%`}Be=st}Oe.background=we}return(0,t.jsx)("div",{style:Oe})},Ne=Ee=>({group:(0,u.css)({display:"flex"}),select:(0,u.css)({marginRight:Ee.spacing(1),flexGrow:1})});var Ce=e(96822);const He=({value:Ee,onChange:xe,context:ye,item:Oe})=>(0,t.jsx)(Ce.e,{links:Ee,onChange:xe,data:ye.data,getSuggestions:()=>ye.getSuggestions?ye.getSuggestions(ae.uP.Values):[],showOneClick:Oe.settings?.showOneClick});class ke extends h.PureComponent{constructor(){super(...arguments),this.state={isLoading:!0,options:[]},this.updateOptions=async()=>{const{item:xe}=this.props,{settings:ye}=xe;let Oe=xe.settings?.options||[];ye?.getOptions&&(Oe=await ye.getOptions(this.props.context)),this.state.options!==Oe&&this.setState({isLoading:!1,options:Oe})}}componentDidMount(){this.updateOptions()}componentDidUpdate(xe){const ye=xe.item?.settings,Oe=this.props.item?.settings;if(ye!==Oe)this.updateOptions();else if(Oe?.getOptions){const we=xe.context?.data,Be=this.props.context?.data;we!==Be&&this.updateOptions()}}render(){const{options:xe,isLoading:ye}=this.state,{value:Oe,onChange:we,item:Be}=this.props,{settings:Xe}=Be;return(0,t.jsx)(F.KF,{isLoading:ye,value:Oe,defaultValue:Oe,allowCustomValue:Xe?.allowCustomValue,onChange:st=>{we(st.map(lt=>lt.value).flatMap(lt=>lt!==void 0?[lt]:[]))},options:xe})}}var Me=e(85053);class $e extends h.PureComponent{constructor(){super(...arguments),this.state={isLoading:!0,options:[]},this.updateOptions=async()=>{const{item:xe}=this.props,{settings:ye}=xe;let Oe=xe.settings?.options||[];ye?.getOptions&&(Oe=await ye.getOptions(this.props.context)),this.state.options!==Oe&&this.setState({isLoading:!1,options:Oe})}}componentDidMount(){this.updateOptions()}componentDidUpdate(xe){const ye=xe.item?.settings,Oe=this.props.item?.settings;if(ye!==Oe)this.updateOptions();else if(Oe?.getOptions){const we=xe.context?.data,Be=this.props.context?.data;we!==Be&&this.updateOptions()}}render(){const{options:xe,isLoading:ye}=this.state,{value:Oe,onChange:we,item:Be}=this.props,{settings:Xe}=Be;let st=xe.find(lt=>lt.value===Oe);return!st&&Oe&&(st={label:`${Oe}`,value:Oe}),(0,t.jsx)(F.l6,{isLoading:ye,value:st,defaultValue:Oe,allowCustomValue:Xe?.allowCustomValue,isClearable:Xe?.isClearable,onChange:lt=>we(lt?.value),options:xe})}}var tt=e(21253),Ke=e(34107);const Re=({value:Ee,onChange:xe,item:ye,id:Oe})=>(0,t.jsx)(Ke.S,{stats:Ee,onChange:xe,allowMultiple:!!ye.settings?.allowMultiple,defaultStat:ye.settings?.defaultStat,inputId:Oe});var Ve=e(41185),Qe=e(43173);class je extends h.PureComponent{constructor(){super(...arguments),this.state={showAdd:!1},this.onRemoveString=xe=>{const{value:ye,onChange:Oe}=this.props,we=[...ye];we.splice(xe,1),Oe(we)},this.onValueChange=(xe,ye)=>{if("key"in xe&&xe.key!=="Enter")return;const{value:Oe,onChange:we}=this.props,Be=xe.currentTarget.value.trim();if(ye<0){Be&&(xe.currentTarget.value="",we([...Oe,Be])),this.setState({showAdd:!1});return}if(!Be)return this.onRemoveString(ye);const Xe=[...Oe];Xe[ye]=Be,we(Xe)}}render(){const{value:xe,item:ye}=this.props,{showAdd:Oe}=this.state,we=ze(Qe.$.theme2),Be=ye.settings?.placeholder||"Add text";return(0,t.jsxs)("div",{children:[xe.map((Xe,st)=>(0,t.jsx)(c.p,{className:we.textInput,defaultValue:Xe||"",onBlur:lt=>this.onValueChange(lt,st),onKeyDown:lt=>this.onValueChange(lt,st),suffix:(0,t.jsx)(W.I,{className:we.trashIcon,name:"trash-alt",onClick:()=>this.onRemoveString(st)})},`${st}/${Xe}`)),Oe?(0,t.jsx)(c.p,{autoFocus:!0,className:we.textInput,placeholder:Be,defaultValue:"",onBlur:Xe=>this.onValueChange(Xe,-1),onKeyDown:Xe=>this.onValueChange(Xe,-1),suffix:(0,t.jsx)(W.I,{name:"plus-circle"})}):(0,t.jsx)(d.$n,{icon:"plus",size:"sm",variant:"secondary",onClick:()=>this.setState({showAdd:!0}),children:Be})]})}}const ze=(0,b.N)(Ee=>({textInput:(0,u.css)({marginBottom:"5px","&:hover":{border:`1px solid ${Ee.components.input.borderHover}`}}),trashIcon:(0,u.css)({color:Ee.colors.text.secondary,cursor:"pointer","&:hover":{color:Ee.colors.text.primary}})}));var Ye=e(12965);function Ge({value:Ee,onChange:xe,item:ye}){const Oe=(0,K.of)(ce);return ye?.settings?.isClearable&&Ee!=null?(0,t.jsxs)("div",{className:Oe.wrapper,children:[(0,t.jsx)("span",{className:Oe.first,children:(0,t.jsx)(Ye.p,{value:Ee,onChange:xe})}),(0,t.jsx)(P.K,{name:"times",onClick:()=>xe(void 0),tooltip:(0,E.t)("options-ui.units.clear-tooltip","Clear unit selection")})]}):(0,t.jsx)(Ye.p,{value:Ee,onChange:xe})}const ce=Ee=>({wrapper:(0,u.css)({width:"100%",display:"flex",flexDirection:"row",alignItems:"center"}),first:(0,u.css)({marginRight:Ee.spacing(1),flexGrow:2})}),Pe=()=>{const Ee={id:"number",name:"Number",description:"Allows numeric values input",editor:Me.w},xe={id:"slider",name:"Slider",description:"Allows numeric values input",editor:tt.G},ye={id:"text",name:"Text",description:"Allows string values input",editor:Ve.g},Oe={id:"strings",name:"String array",description:"An array of str
159ings",editor:je},we={id:"boolean",name:"Boolean",description:"Allows boolean values input",editor(vn){const{id:Wn,...Dt}=vn;return(0,t.jsx)(m.d,{...Dt,onChange:qt=>vn.onChange(qt.currentTarget.checked)})}},Be={id:"select",name:"Select",description:"Allows option selection",editor:$e},Xe={id:"multi-select",name:"Multi select",description:"Allows for multiple option selection",editor:ke},st={id:"radio",name:"Radio",description:"Allows option selection",editor(vn){return(0,t.jsx)(a.z,{...vn,options:vn.item.settings?.options})}},lt={id:"unit",name:"Unit",description:"Allows unit input",editor:Ge},Et={id:"color",name:"Color",description:"Allows color selection",editor(vn){return(0,t.jsx)(pe.a,{value:vn.value,onChange:vn.onChange,settings:vn.item.settings,details:!0})}},Tt={id:"fieldColor",name:"Field Color",description:"Field color selection",editor:De},Mt={id:"links",name:"Links",description:"Allows defining data links",editor:He},wt={id:"actions",name:"Actions",description:"Allows defining actions",editor:fe},_e={id:"stats-picker",name:"Stats Picker",editor:Re,description:""},xt={id:"timezone",name:"Time zone",description:"Time zone selection",editor:l.U},At={id:"field-name",name:"Field name",description:"Allows selecting a field name from a data frame",editor:f.O};return[ye,Ee,xe,we,st,Be,lt,Mt,wt,_e,Oe,xt,Tt,Et,Xe,At,{id:"dashboard-uid",name:"Dashboard",description:"Select dashboard",editor:oe},{id:"mappings",name:"Mappings",description:"Allows defining value mappings",editor:q},{id:"thresholds",name:"Thresholds",description:"Allows defining thresholds",editor:T}]},Se=()=>{const Ee=["Standard options"],xe={id:"displayName",path:"displayName",name:"Display name",description:"Change the field or series name",editor:n.D.get("text").editor,override:n.D.get("text").editor,process:r.AM,settings:{placeholder:"none",expandTemplateVars:!0},shouldApply:()=>!0,category:Ee},ye={id:"unit",path:"unit",name:"Unit",description:"",editor:n.D.get("unit").editor,override:n.D.get("unit").editor,process:r.OU,settings:{placeholder:"none"},shouldApply:()=>!0,category:Ee},Oe={id:"fieldMinMax",path:"fieldMinMax",name:"Field min/max",description:"Calculate min max per field",editor:n.D.get("boolean").editor,override:n.D.get("boolean").editor,process:r.FM,shouldApply:At=>At.type===o.PU.number,showIf:At=>At.min===void 0||At.max===void 0,category:Ee},we={id:"min",path:"min",name:"Min",description:"Leave empty to calculate based on all values",editor:n.D.get("number").editor,override:n.D.get("number").editor,process:r.m0,settings:{placeholder:"auto"},shouldApply:At=>At.type===o.PU.number,category:Ee},Be={id:"max",path:"max",name:"Max",description:"Leave empty to calculate based on all values",editor:n.D.get("number").editor,override:n.D.get("number").editor,process:r.m0,settings:{placeholder:"auto"},shouldApply:At=>At.type===o.PU.number,category:Ee},Xe={id:"decimals",path:"decimals",name:"Decimals",editor:n.D.get("number").editor,override:n.D.get("number").editor,process:r.m0,settings:{placeholder:"auto",min:0,max:15,integer:!0},shouldApply:At=>At.type===o.PU.number,category:Ee},st={id:"noValue",path:"noValue",name:"No value",description:"What to show when there is no value",editor:n.D.get("text").editor,override:n.D.get("text").editor,process:r.OU,settings:{placeholder:"-"},shouldApply:()=>!0,category:Ee},lt="Data links and actions",Et={id:"links",path:"links",name:"Data links",editor:n.D.get("links").editor,override:n.D.get("links").editor,process:r.Ch,settings:{showOneClick:!1},shouldApply:()=>!0,category:[lt],getItemsCount:At=>At?At.length:0},Tt={id:"actions",path:"actions",name:"Actions",editor:n.D.get("actions").editor,override:n.D.get("actions").editor,process:r.cz,settings:{showOneClick:!1},shouldApply:()=>!0,category:[lt],getItemsCount:At=>At?At.length:0,hideFromDefaults:!0},Mt={id:"color",path:"color",name:"Color scheme",editor:n.D.get("fieldColor").editor,override:n.D.get("fieldColor").editor,process:r.hS,shouldApply:()=>!0,settings:{byValueSupport:!0,preferThresholdsMode:!0},category:Ee},wt={id:"mappings",path:"mappings",name:"Value mappings",description:"Modify the display text based on input value",editor:n.D.get("mappings").editor,override:n.D.get("mappings").editor,process:r.xT,settings:{},defaultValue:[],shouldApply:At=>At.type!==o.PU.time,category:["Value mappings"],getItemsCount:At=>At?At.length:0},_e={id:"thresholds",path:"thresholds",name:"Thresholds",editor:n.D.get("thresholds").editor,override:n.D.get("thresholds").editor,process:r.N7,settings:{},defaultValue:{mode:s.O.Absolute,steps:[{value:-1/0,color:"green"},{value:80,color:"red"}]},shouldApply:()=>!0,category:["Thresholds"],getItemsCount:At=>At?At.steps.length:0},xt={id:"filterable",path:"filterable",name:"Ad-hoc filterable",hideFromDefaults:!0,editor:n.D.get("boolean").editor,override:n.D.get("boolean").editor,process:r.FM,shouldApply:()=>!0,settings:{},category:Ee};return[ye,we,Be,Oe,Xe,xe,Mt,st,Et,Tt,wt,_e,xt]}},21253:(ee,B,e)=>{"use strict";e.d(B,{G:()=>f});var t=e(74848),n=e(22803),r=e(17437),o=e(55168),s=e(96540),m=e(63142),a=e(91302),l=e(19753);const f=({value:i,onChange:x,item:g})=>{const p=(0,s.useRef)(null),{settings:c}=g,y=c?.min||0,P=c?.max||100,d=c?.step,D=c?.marks||{[y]:y,[P]:P},b=c?.included,E=c?.ariaLabelForHandle,v=75,C=!0,S=(0,m.$j)(),[O,I]=(0,s.use
159State)(i??y),[R,T]=(0,s.useState)(v);(0,s.useEffect)(()=>{i!=null&&i!==O&&I(i)},[i,O]),(0,s.useEffect)(()=>{const w=getComputedStyle(p.current),j=w.getPropertyValue("font-weight")||"normal",V=w.getPropertyValue("font-size")||"16px",U=w.getPropertyValue("font-family")||"Arial",F="0",M=4,H=8,_=Math.max((P+(d||0)).toString().length,(P-(d||0)).toString().length)+M,Z=F.repeat(_),ne=h(Z,`${j} ${V} ${U}`);ne&&T(ne+H*2)},[P,d]);const L=(0,s.useCallback)(w=>{const j=typeof w=="number"?w:w[0];I(j),x&&x(j)},[I,x]),K=(0,s.useCallback)(w=>{let j=w;(Number.isNaN(j)||!j)&&(j=0),I(j),x&&x(j)},[x]),A=(0,a.$)(S,C,!!D),W=u(S,R),N=C?[]:[A.sliderInputVertical];return(0,t.jsxs)("div",{className:(0,n.cx)(A.container,A.slider),children:[(0,t.jsx)(r.Global,{styles:A.slider}),(0,t.jsxs)("div",{className:(0,n.cx)(A.sliderInput,...N),children:[(0,t.jsx)(o.A,{min:y,max:P,step:d,defaultValue:i,value:O,onChange:L,vertical:!C,reverse:!1,ariaLabelForHandle:E,marks:D,included:b}),(0,t.jsx)("span",{className:W.numberInputWrapper,ref:p,children:(0,t.jsx)(l.Q,{value:O,onChange:K,max:P,min:y,step:d})})]})]})};function h(i,x){const p=document.createElement("canvas").getContext("2d");return p?(p.font=x,p.measureText(i).width):null}const u=(i,x)=>({numberInputWrapper:(0,n.css)({marginLeft:i.spacing(3),maxHeight:"32px",maxWidth:x,minWidth:x,overflow:"visible",width:"100%"})})},41185:(ee,B,e)=>{"use strict";e.d(B,{g:()=>s});var t=e(74848),n=e(96540),r=e(87105),o=e(63527);const s=({value:m,onChange:a,item:l,suffix:f})=>{const h=l.settings?.useTextarea?r.f:o.p,u=(0,n.useCallback)(i=>{let x=m??"";
159"key"in i?i.key==="Enter"&&!l.settings?.useTextarea&&(x=i.currentTarget.value.trim()):x=i.currentTarget.value.trim(),x!==m&&a(x===""?void 0:x)},[m,l.settings?.useTextarea,a]);return(0,t.jsx)(h,{placeholder:l.settings?.placeholder,defaultValue:m||"",rows:l.settings?.useTextarea&&l.settings.rows||5,onBlur:u,onKeyDown:u,suffix:f})}},13791:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>V});var t=e(74848),n=e(22803),r=e(96540),o=e(75683),s=e(63142),m=e(27963),a=e(94076),l=e(11098);const f=({isLoading:F,children:M,className:H})=>{let _=H?(0,t.jsx)("div",{className:H,children:M}):M;return(0,t.jsx)(t.Fragment,{children:F?(0,t.jsx)(l.A,{}):_})};function h({info:F}){const M=(0,s.of)(u);return(0,t.jsx)("div",{className:M.container,children:F.map((H,_)=>(0,t.jsxs)(r.Fragment,{children:[(0,t.jsxs)("div",{className:M.infoItem,children:[(0,t.jsx)("div",{className:M.label,children:H.label}),H.value]}),_+1<F.length&&(0,t.jsx)("div",{"data-testid":"page-info-separator",className:M.separator})]},_))})}const u=F=>({container:(0,n.css)({display:"flex",flexDirection:"row",gap:F.spacing(1.5),overflow:"auto"}),infoItem:(0,n.css)({...F.typography.bodySmall,display:"flex",flexDirection:"column",gap:F.spacing(.5)}),label:(0,n.css)({color:F.colors.text.secondary}),separator:(0,n.css)({borderLeft:`1px solid ${F.colors.border.weak}`})});var i=e(68143),x=e(66404),g=e(76319),p=e(37386),c=e(63527),y=e(56840);const P=({value:F,onEdit:M})=>{const H=(0,s.of)(d),[_,Z]=(0,r.useState)(F),[ne,te]=(0,r.useState)(!1),[Y,Q]=(0,r.useState)(!1),[J,q]=(0,r.useState)();(0,r.useEffect)(()=>{Z(F)},[F]);const X=(0,r.useCallback)(async se=>{const oe=se.currentTarget.value;if(!oe)q("Please enter a title");else if(oe===F)q(void 0),te(!1);else{Q(!0);try{await M(oe),q(void 0),te(!1)}catch(ae){(0,i.NF)(ae)?q(ae.data.message):ae instanceof Error&&q(ae.message)}Q(!1)}},[M,F]);return ne?(0,t.jsx)("div",{className:H.inputContainer,children:(0,t.jsx)(p.D,{className:H.field,loading:Y,invalid:!!J,error:J,children:(0,t.jsx)(c.p,{className:H.input,defaultValue:_,onKeyDown:se=>{se.key==="Enter"&&X(se)},autoFocus:!0,onBlur:X,onChange:se=>Z(se.currentTarget.value),onFocus:()=>te(!0)})})}):(0,t.jsx)("div",{className:H.textContainer,children:(0,t.jsxs)("div",{className:H.textWrapper,children:[(0,t.jsx)(x.E,{element:"h1",truncate:!0,children:_}),(0,t.jsx)(g.K,{name:"pen",size:"lg",tooltip:(0,y.t)("page.editable-title.edit-tooltip","Edit title"),onClick:()=>te(!0)})]})})};P.displayName="EditableTitle";const d=F=>({textContainer:(0,n.css)({minWidth:0}),field:(0,n.css)({flex:1,left:`calc(-${F.spacing(1)} - 1px)`,position:"relative",marginBottom:0}),input:(0,n.css)({input:{...F.typography.h1}}),inputContainer:(0,n.css)({display:"flex",flex:1}),textWrapper:(0,n.css)({alignItems:"center",display:"flex",gap:F.spacing(1),height:F.spacing(F.components.height.md)})});function D({navItem:F,renderTitle:M,actions:H,info:_,subTitle:Z,onEditTitle:ne}){const te=(0,s.of)(b),Y=Z??F.subTitle,Q=ne?(0,t.jsx)(P,{value:F.text,onEdit:ne}):(0,t.jsxs)("div",{className:te.title,children:[F.img&&(0,t.jsx)("img",{className:te.img,src:F.img,alt:`logo for ${F.text}`}),M?M(F.text):(0,t.jsx)("h1",{children:F.text})]});return(0,t.jsxs)("div",{className:te.pageHeader,children:[(0,t.jsxs)("div",{className:te.topRow,children:[(0,t.jsxs)("div",{className:te.titleInfoContainer,children:[Q,_&&(0,t.jsx)(h,{info:_})]}),(0,t.jsx)("div",{className:te.actions,children:H})]}),Y&&(0,t.jsx)("div",{className:te.subTitle,children:Y})]})}const b=F=>({topRow:(0,n.css)({alignItems:"flex-start",display:"flex",flexDirection:"row",flexWrap:"wrap",gap:F.spacing(1,3)}),title:(0,n.css)({display:"flex",flexDirection:"row",maxWidth:"100%",flex:1,h1:{marginBottom:0}}),actions:(0,n.css)({display:"flex",flexDirection:"row",gap:F.spacing(1)}),titleInfoContainer:(0,n.css)({display:"flex",label:"title-info-container",flex:1,flexWrap:"wrap",gap:F.spacing(1,4),justifyContent:"space-between",maxWidth:"100%",minWidth:"200px"}),pageHeader:(0,n.css)({label:"page-header",display:"flex",flexDirection:"column",gap:F.spacing(1),marginBottom:F.spacing(2)}),subTitle:(0,n.css)({position:"relative",color:F.colors.text.secondary}),img:(0,n.css)({width:"32px",height:"32px",marginRight:F.spacing(2)})});var E=e(54314),v=e(30360),C=e(60208);function S({navItem:F}){const M=(0,s.of)(O);return(0,t.jsx)("div",{className:M.tabsWrapper,children:(0,t.jsx)(E.U,{children:F.children.map((H,_)=>{const Z=H.icon?(0,v.Uo)(H.icon):void 0;return!H.hideFromTabs&&(0,t.jsx)(C.o,{label:H.text,active:H.active,icon:Z,counter:H.tabCounter,href:H.url,suffix:H.tabSuffix,onChangeTab:H.onClick},`${H.url}-${_}`)})})})}const O=F=>({tabsWrapper:(0,n.css)({paddingBottom:F.spacing(3)})});var I=e(25508),R=e(84057),T=e(8535),L=e(96673);function K(F,M){if(M)return M;
159if(F&&T.M_)return(0,L.useSelector)((0,I.Mz)(A,H=>(0,R.tc)(H,F??"home")))}function A(F){return F.navIndex}var W=e(43550),N=e(92948),w=e(18607);function j(F,M){const H=(0,L.useSelector)(_=>_.navIndex)?.[W.Id];(0,r.useEffect)(()=>{const _=(F?.node!==F?.main?F?.node:F?.main)??{text:"Grafana"},Z=(0,w.Z)(_,M,H).map(ne=>ne.text).reverse();Z[Z.length-1]=N.M.AppTitle,document.title=Z.join(" - ")},[H,F,M])}const V=({navId:F,navModel:M,pageNav:H,renderTitle:_,onEditTitle:Z,actions:ne,subTitle:te,children:Y,className:Q,info:J,layout:q=o.k.Standard,onSetScrollRef:X,...se})=>{const oe=(0,s.of)(U),ae=K(F,M),{chrome:ie}=(0,m.Il)();j(ae,H);const fe=H??ae?.node;return(0,r.useLayoutEffect)(()=>{ae&&ie.update({sectionNav:ae,pageNav:H,layout:q})},[ae,H,ie,q]),(0,t.jsxs)("div",{className:(0,n.cx)(oe.wrapper,Q),...se,children:[q===o.k.Standard&&(0,t.jsx)(a.A,{divId:"page-scrollbar",onSetScrollRef:X,children:(0,t.jsxs)("div",{className:oe.pageInner,children:[fe&&(0,t.jsx)(D,{actions:ne,onEditTitle:Z,navItem:fe,renderTitle:_,info:J,subTitle:te}),H&&H.children&&(0,t.jsx)(S,{navItem:H}),(0,t.jsx)("div",{className:oe.pageContent,children:Y})]})}),q===o.k.Canvas&&(0,t.jsx)(a.A,{divId:"page-scrollbar",onSetScrollRef:X,children:(0,t.jsx)("div",{className:oe.canvasContent,children:Y})}),q===o.k.Custom&&Y]})};V.Contents=f;const U=F=>({wrapper:(0,n.css)({label:"page-wrapper",display:"flex",flex:"1 1 0",flexDirection:"column",position:"relative"}),pageContent:(0,n.css)({label:"page-content",flexGrow:1}),primaryBg:(0,n.css)({background:F.colors.background.primary}),pageInner:(0,n.css)({label:"page-inner",padding:F.spacing(2),borderBottom:"none",background:F.colors.background.primary,display:"flex",flexDirection:"column",flexGrow:1,margin:F.spacing(0,0,0,0),[F.breakpoints.up("md")]:{padding:F.spacing(4)}}),canvasContent:(0,n.css)({label:"canvas-content",display:"flex",flexDirection:"column",padding:F.spacing(2),flexBasis:"100%",flexGrow:1})})},11098:(ee,B,e)=>{"use strict";e.d(B,{A:()=>s});var t=e(74848),n=e(31286),r=e(6975);const s=({pageName:m=""})=>{const a=`Loading ${m}...`;return(0,t.jsx)(n.a,{display:"flex",alignItems:"center",direction:"column",justifyContent:"center",paddingTop:10,children:(0,t.jsx)(r._,{text:a})})}},1506:(ee,B,e)=>{"use strict";e.d(B,{L:()=>l});var t=e(74848),n=e(22803),r=e(85629),o=e(63142),s=e(50201),m=e(89640),a=e(56840);function l({entity:h="Page"}){const u=(0,o.of)(f),i=h.toLowerCase();return(0,t.jsx)("div",{className:u.container,"data-testid":r.Tp.components.EntityNotFound.container,children:(0,t.jsx)(s.p,{message:`${h} not found`,variant:"not-found",children:(0,t.jsxs)(a.x6,{i18nKey:"entity-not-found.description",children:["We're looking but can't seem to find this ",{lowerCaseEntity:i},". Try returning"," ",(0,t.jsx)(m.Y,{href:"/",children:"home"})," or seeking help on the"," ",(0,t.jsx)(m.Y,{href:"https://community.grafana.com",external:!0,children:"community site."})]})})})}function f(h){return{container:(0,n.css)({padding:h.spacing(8,2,2,2)})}}},86678:(ee,B,e)=>{"use strict";e.d(B,{H:()=>s});var t=e(74848),n=e(75683),r=e(13791),o=e(1506);function s(){return(0,t.jsx)(r.Y,{navId:"home",layout:n.k.Canvas,pageNav:{text:"Page not found"},children:(0,t.jsx)(o.L,{entity:"Page"})})}},92100:(ee,B,e)=>{"use strict";e.d(B,{$:()=>h});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(45861),m=e(18857),a=e(30703),l=e(56840),f=e(52193);const h=({onChange:i,maxMenuHeight:x})=>{const g=(0,r.useMemo)(f.A4,[]),p=(0,r.useMemo)(()=>g.map(b=>({label:b.name,imgUrl:b.info.logos.small,value:b})).sort((b,E)=>b.label?.localeCompare(E.label)),[g]),[c,y]=(0,r.useState)([]),P=(0,r.useCallback)(b=>{const E=b.filter(v=>v.value).map(v=>v.value);i(E),y(b)},[i]),d=(0,o.of)(u),D={defaultOptions:!0,getOptionLabel:b=>b.label,getOptionValue:b=>b.value,noOptionsMessage:(0,l.t)("panel-type-filter.select-no-options","No panel types found"),placeholder:(0,l.t)("panel-type-filter.select-placeholder","Filter by type"),maxMenuHeight:x,options:p,value:c,onChange:P};return(0,t.jsxs)("div",{className:d.container,children:[c.length>0&&(0,t.jsx)(s.$n,{size:"xs",icon:"trash-alt",fill:"text",className:d.clear,onClick:()=>P([]),children:(0,t.jsx)(l.x6,{i18nKey:"panel-type-filter.clear-button",children:"Clear types"})}),(0,t.jsx)(m.KF,{...D,prefix:(0,t.jsx)(a.I,{name:"filter"}),"aria-label":(0,l.t)("panel-type-filter.select-aria-label","Panel type filter")})]})};function u(i){return{container:(0,n.css)({label:"container",position:"relative",minWidth:"180px",flexGrow:1}),clear:(0,n.css)({label:"clear",fontSize:i.spacing(1.5),position:"absolute",top:i.spacing(-4.5),right:0})}}},68805:(ee,B,e)=>{"use strict";e.d(B,{j:()=>m});var t=e(74848),n=e(22803),r=e(96540),o=e(67458),s=e(63142);const m=r.memo(r.forwardRef(({className:f,children:h,markdown:u,styleOverrides:i,onRemove:x,...g},p)=>{const c=(0,s.of)(y=>l(y,i?.borderTop));return(0,t.jsxs)("div",{className:(0,n.cx)(c.wrapper,f),...g,ref:p,children:[u&&a(u),h]})}));function a(f){const h=(0,o.G)(f);return(0,t.jsx)("div",{className:"markdown-html",dangerouslySetInnerHTML:{__html:h}})}
159m.displayName="OperationRowHelp";const l=(f,h)=>{const u=f.shape.radius.default,i=f.colors.background.secondary;return{wrapper:(0,n.css)({padding:f.spacing(2),border:`2px solid ${i}`,borderTop:h?h+i:"none",borderRadius:`0 0 ${u} ${u}`,position:"relative",top:"-4px"})}}},43260:(ee,B,e)=>{"use strict";e.d(B,{A:()=>l,q:()=>a});var t=e(74848),n=e(22803),r=e(85629),o=e(63142),s=e(76319);function m(h){const u=(0,o.of)(f);return(0,t.jsx)("div",{className:(0,n.cx)(u.icon,"active"in h&&h.active&&u.active),children:(0,t.jsx)(s.K,{name:h.icon,tooltip:h.title,className:u.icon,disabled:!!h.disabled,onClick:h.onClick,type:"button","data-testid":h.dataTestId??r.Tp.components.QueryEditorRow.actionButton(h.title),..."active"in h&&{"aria-pressed":h.active}})})}function a(h){return(0,t.jsx)(m,{...h})}const l=h=>(0,t.jsx)(m,{...h}),f=h=>({icon:(0,n.css)({display:"flex",position:"relative",color:h.colors.text.secondary}),active:(0,n.css)({"&:before":{display:"block",content:'" "',position:"absolute",left:-1,right:2,height:3,borderRadius:h.shape.radius.default,bottom:-8,backgroundImage:h.colors.gradients.brandHorizontal}})})},85348:(ee,B,e)=>{"use strict";e.d(B,{u:()=>p});var t=e(74848),n=e(22803),r=e(57095),o=e(96540),s=e(22589),m=e(27489),a=e(63142),l=e(44019),f=e(76319),h=e(41654),u=e(30703),i=e(56840);const x=({actionsElement:y,disabled:P,draggable:d,collapsable:D=!0,dragHandleProps:b,headerElement:E,isContentVisible:v,onRowToggle:C,reportDragMousePosition:S,title:O,id:I,expanderMessages:R})=>{const T=(0,a.of)(g);let L=v?(0,i.t)("query-operation.header.collapse-row","Collapse query row"):(0,i.t)("query-operation.header.expand-row","Expand query row");R!==void 0&&v?L=R.close:R!==void 0&&(L=R?.open);const K=(0,i.t)("query-operation.header.drag-and-drop","Drag and drop to reorder");return(0,t.jsxs)("div",{className:T.header,children:[(0,t.jsxs)("div",{className:T.column,children:[D&&(0,t.jsx)(f.K,{name:v?"angle-down":"angle-right",tooltip:L,className:T.collapseIcon,onClick:C,"aria-expanded":v,"aria-controls":I}),O&&(0,t.jsx)("div",{className:T.titleWrapper,onClick:C,children:(0,t.jsx)("div",{className:(0,n.cx)(T.title,P&&T.disabled),children:O})}),E]}),(0,t.jsxs)(h.B,{gap:1,alignItems:"center",children:[y,d&&(0,t.jsx)("div",{onMouseMove:S,...b,children:(0,t.jsx)(u.I,{title:K,name:"draggabledots",size:"lg",className:T.dragIcon})})]})]})},g=y=>({header:(0,n.css)({label:"Header",padding:y.spacing(.5,.5),borderRadius:y.shape.radius.default,background:y.colors.background.secondary,minHeight:y.spacing(4),display:"grid",gridTemplateColumns:"minmax(100px, max-content) min-content",alignItems:"center",justifyContent:"space-between",whiteSpace:"nowrap","&:focus":{outline:"none"}}),column:(0,n.css)({label:"Column",display:"flex",alignItems:"center",overflow:"hidden"}),dragIcon:(0,n.css)({cursor:"grab",color:y.colors.text.disabled,margin:y.spacing(0,.5),"&:hover":{color:y.colors.text.primary}}),collapseIcon:(0,n.css)({marginLeft:y.spacing(.5),color:y.colors.text.disabled}),titleWrapper:(0,n.css)({display:"flex",alignItems:"center",flexGrow:1,cursor:"pointer",overflow:"hidden",marginRight:y.spacing(.5)}),title:(0,n.css)({fontWeight:y.typography.fontWeightBold,color:y.colors.text.link,marginLeft:y.spacing(.5),overflow:"hidden",textOverflow:"ellipsis"}),disabled:(0,n.css)({color:y.colors.text.disabled})});x.displayName="QueryOperationRowHeader";function p({children:y,actions:P,title:d,headerElement:D,onClose:b,onOpen:E,isOpen:v,disabled:C,draggable:S,collapsable:O,index:I,id:R,expanderMessages:T}){const[L,K]=(0,o.useState)(v!==void 0?v:!0),A=(0,a.of)(c),W=(0,o.useCallback)(()=>{K(!L)},[L,K]);(0,o.useEffect)(()=>{typeof v=="boolean"&&K(v)},[v]);const N=(0,o.useCallback)(U=>{if(U.defaultPrevented){const F=U.currentTarget.getBoundingClientRect(),M=U.clientX-F.left,H=U.clientY-F.top;(0,m.rR)("query_row_reorder_drag_position",{x:M/F.width,y:H/F.height,width:F.width,height:F.height})}},[]);(0,s.A)(()=>{L?E&&E():b&&b()},[L]);const w={isOpen:L,onOpen:()=>{K(!0)},onClose:()=>{K(!1)}},j=P&&l.renderOrCallToRender(P,w),V=D&&l.renderOrCallToRender(D,w);return S?(0,t.jsx)(r.Draggable,{draggableId:R,index:I,children:U=>(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{ref:U.innerRef,className:A.wrapper,...U.draggableProps,children:[(0,t.jsx)("div",{children:(0,t.jsx)(x,{id:R,actionsElement:j,disabled:C,draggable:!0,collapsable:O,dragHandleProps:U.dragHandleProps,headerElement:V,isContentVisible:L,onRowToggle:W,reportDragMousePosition:N,title:d,expanderMe
159ssages:T})}),L&&(0,t.jsx)("div",{className:A.content,children:y})]})})}):(0,t.jsxs)("div",{className:A.wrapper,children:[(0,t.jsx)(x,{id:R,actionsElement:j,disabled:C,draggable:!1,collapsable:O,headerElement:V,isContentVisible:L,onRowToggle:W,reportDragMousePosition:N,title:d,expanderMessages:T}),L&&(0,t.jsx)("div",{className:A.content,children:y})]})}const c=y=>({wrapper:(0,n.css)({marginBottom:y.spacing(2)}),content:(0,n.css)({marginTop:y.spacing(.5),marginLeft:y.spacing(3)})});p.displayName="QueryOperationRow"},30868:(ee,B,e)=>{"use strict";e.d(B,{y:()=>h});var t=e(74848),n=e(55494),r=e(63704),o=e(24726);const s=2,m=5,a=g=>{const p=g.match(new RegExp('<style type="text/css">([\\s\\S]*?)<\\/style>'));return p?p[0]:null},l=g=>g.match(new RegExp(`<svg.*id\\s*=\\s*(['"])(.*?)\\1`))?.[s],f=g=>{let p=l(g);if(!p){p=`x${(0,o.A)()}`;const y=g.indexOf("<svg")+m;g=g.substring(0,y)+`id="${p}" `+g.substring(y)}let c=a(g);if(c){let y=c.replace(/(#(.*?))?\./g,`#${p} .`);g=g.replace(c,y)}return g},h=g=>{const{cleanStyle:p,...c}=g;return(0,t.jsx)(n.default,{...c,cacheRequests:!0,preProcessor:p?x:i})};let u=new Map;function i(g){let p=u.get(g);return p||(p=r.sQ.sanitizeSVGContent(g),u.set(g,p)),p}function x(g){let p=u.get(g);return p||(p=r.sQ.sanitizeSVGContent(g),p.indexOf('<style type="text/css">')>-1&&(p=f(p)),u.set(g,p)),p}},95506:(ee,B,e)=>{"use strict";e.d(B,{b:()=>x});var t=e(74848),n=e(76459),r=e.n(n),o=e(96540),s=e(18857),m=e(83873),a=e(75735),l=e(18646),f=e(60171);const h=(g="Dashboards",p)=>`${g}/${p}`;async function u(g=""){return m.IB.search({type:"dash-db",query:g,limit:100}).then(p=>p.map(c=>({value:{uid:c.uid,title:c.title,folderTitle:c.folderTitle,folderUid:c.folderUid},label:h(c?.folderTitle,c.title)})))}const i=r()(u,250,{leading:!0}),x=({value:g,onChange:p,placeholder:c="Select dashboard",noOptionsMessage:y="No dashboards found",...P})=>{const[d,D]=(0,o.useState)();(0,o.useEffect)(()=>{!g||g===d?.value?.uid||(async()=>{const E=await(0,l.n)().getDashboardDTO(g,void 0);(0,f.HG)(E)?D({value:{uid:E.metadata.name,title:E.spec.title,folderTitle:E.metadata.annotations?.[a.w2],folderUid:E.metadata.annotations?.[a.ew]},label:h(E.metadata.annotations?.[a.ew],E.spec.title)}):E.dashboard&&D({value:{uid:E.dashboard.uid,title:E.dashboard.title,folderTitle:E.meta.folderTitle,folderUid:E.meta.folderUid},label:h(E.meta?.folderTitle,E.dashboard.title)})})()},[g]);const b=(0,o.useCallback)(E=>{D(E),p?.(E?.value)},[p,D]);return(0,t.jsx)(s.DW,{loadOptions:i,onChange:b,placeholder:c,noOptionsMessage:y,value:d,defaultOptions:!0,...P})}},67804:(ee,B,e)=>{"use strict";e.d(B,{d:()=>O});var t=e(74848),n=e(96540),r=e(43173),o=e(39989),s=e(22803),m=e(76459),a=e.n(m),l=e(16817),f=e(32899),h=e(85629),u=e(27489),i=e(63142),x=e(63527),g=e(18857),p=e(45229),c=e(56840),y=e(15130),P=e(74755),d=e(96673);const D="+ Add new",b="-10";function E(R){const{dashboardId:T,allowEmpty:L,onChange:K,filter:A,enableCreateNew:W,inputId:N,onClear:w,enableReset:j,initialFolderUid:V,initialTitle:U="",permissionLevel:F=d.PermissionLevelString.Edit,rootName:M,showRoot:H=!0,skipInitialLoad:_,searchQueryType:Z,customAdd:ne,folderWarning:te,invalid:Y}
159=R,Q=M??"Dashboards",[J,q]=(0,n.useState)(null),[X,se]=(0,n.useState)(!1),[oe,ae]=(0,n.useState)(""),[ie,fe]=(0,n.useState)(J?.title??""),pe=(0,i.of)(S),de=typeof w=="function",le=(0,n.useCallback)(async Ke=>{const Re=await(0,P.c0)(Ke,F,Z),Qe=v(Re,A);return(0,u.rR)("grafana_folder_picker_results_loaded",{results:Qe.length,searchTermLength:Ke.length,enableCreateNew:!!W}),(y.TP.hasPermission(d.AccessControlAction.DashboardsWrite)||y.TP.hasPermission(d.AccessControlAction.DashboardsCreate))&&Q?.toLowerCase().startsWith(Ke.toLowerCase())&&H&&Qe.unshift({label:Q,value:""}),j&&Ke===""&&U!==""&&!Qe.find(ze=>ze.label===U)&&Qe.unshift({label:U,value:V}),W&&ne?[...Qe,{value:b,label:D,title:Ke}]:Qe},[j,V,U,F,Q,H,Z,A,W,ne]),me=(0,n.useMemo)(()=>a()(le,300,{leading:!0}),[le]),De=async()=>{const Ke={label:U,value:void 0},Re={label:Q,value:""},Ve=await le("");let Qe=null;V!=null?Qe=Ve.find(je=>je.value===V)||null:j&&U?Qe=Ke:V&&(Qe=Ve.find(je=>je.id===V)||null),!Qe&&!L&&(y.TP.isEditor?Qe=Re:!!T?Qe=Ke:Qe=Ve.length>0?Ve[0]:Ke),!X&&q(Qe)};(0,n.useEffect)(()=>{J&&J.value!==V&&!X&&J.value&&J.label&&K({uid:J.value,title:J.label})},[J,V]),(0,l.A)(async()=>{if(_){const Ke=await C({getFolder:P.Ql,folderUid:V,folderName:U});q(Ke)}await De()},[_,V,U]),(0,n.useEffect)(()=>{J&&J.id===b&&se(!0)},[J]);const Te=(0,n.useCallback)((Ke,Re)=>{if(Ke?.value===b)q({id:b,title:oe}),fe(oe);else{if(Ke||(Ke={value:"",label:Q}),Re.action==="clear"&&w){w();return}q(Ke),K({uid:Ke.value,title:Ke.label})}},[K,w,Q,oe]),Ne=(0,n.useCallback)(async Ke=>{if(te?.warningCondition(Ke))return(0,u.rR)("grafana_folder_picker_folder_created",{status:"failed_condition"}),!1;const Re=await(0,P.vV)({title:Ke});let Ve={value:"",label:"Not created"};return Re.uid?((0,u.rR)("grafana_folder_picker_folder_created",{status:"success"}),p.A.emit(f.r1.alertSuccess,["Folder Created","OK"]),Ve={value:Re.uid,label:Re.title},q(Re),Te(Ve,{action:"create-option",option:Ve})):((0,u.rR)("grafana_folder_picker_folder_created",{status:"failed"}),p.A.emit(f.r1.alertError,["Folder could not be created"])),Ve},[te,Te]),Ce=(0,n.useCallback)(Ke=>{const Re=!!ne?.disallowValues;if(Ke.key==="Enter"&&Re&&!ne?.isAllowedValue(ie)){Ke.preventDefault();return}switch(Ke.key){case"Enter":{Ne(J?.title),se(!1);break}case"Escape":q({value:"",label:Q}),se(!1)}},[ne?.disallowValues,ne?.isAllowedValue,ie,Ne,J?.title,Q]),He=Ke=>{const Re=Ke.currentTarget.value;fe(Re),q({id:void 0,title:Re})},ke=()=>{q({value:"",label:Q}),se(!1)},Me=(Ke,{action:Re})=>{Re==="input-change"&&ae(Ve=>Ke),Re==="menu-close"&&ae(Ve=>Ke)},$e=()=>te?.warningCondition(ie)?(0,t.jsx)(te.warningComponent,{}):null,tt=()=>te?.warningCondition(oe)?(0,t.jsx)(te.warningComponent,{}):null;return X?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($e,{}),(0,t.jsx)("div",{className:pe.newFolder,children:(0,t.jsx)(c.x6,{i18nKey:"folder-picker.create-instructions",children:"Press enter to create the new folder."})}),(0,t.jsx)(x.p,{width:30,autoFocus:!0,value:ie,onChange:He,onKeyDown:Ce,placeholder:(0,c.t)("folder-picker.input-placeholder","Press enter to confirm new folder"),onBlur:ke})]}):(0,t.jsxs)("div",{"data-testid":h.Tp.components.FolderPicker.containerV2,children:[(0,t.jsx)(tt,{}),(0,t.jsx)(g.gZ,{inputId:N,"data-testid":h.Tp.components.FolderPicker.input,loadingMessage:(0,c.t)("folder-picker.loading","Loading folders..."),defaultOptions:!0,defaultValue:J,inputValue:oe,onInputChange:Me,value:J,allowCustomValue:W&&!ne,loadOptions:me,onChange:Te,onCreateOption:Ne,invalid:Y,isClearable:de})]})}function v(R,T){return(T?T(R):R).map(K=>({label:K.title,value:K.uid}))}async function C({folderName:R,folderUid:T,getFolder:L}){if(T==null)throw new Error("folderUid is not found.");return R?{label:R,value:T}:{label:(await L(T)).title,value:T}}const S=R=>({newFolder:(0,s.css)({color:R.colors.warning.main,fontSize:R.typography.bodySmall.fontSize,paddingBottom:R.spacing(1)})});function O(R){const T=r.$.featureToggles.newFolderPicker||r.$.featureToggles.nestedFolders,{initialTitle:L,dashboardId:K,enableCreateNew:A,...W}=R;return T?(0,t.jsx)(o.NestedFolderPicker,{...W}):(0,t.jsx)(I,{...R})}
159function I({value:R,showRootFolder:T,onChange:L,initialTitle:K,dashboardId:A,enableCreateNew:W,inputId:N,skipInitialLoad:w}){const j=(0,n.useCallback)(V=>{L&&L(V.uid,V.title)},[L]);return(0,t.jsx)(E,{onChange:j,showRoot:T,initialFolderUid:R,initialTitle:K,inputId:N,skipInitialLoad:w,dashboardId:A,enableCreateNew:W})}},18552:(ee,B,e)=>{"use strict";e.d(B,{r:()=>f});var t=e(74848),n=e(16817),r=e(18857),o=e(30703),s=e(99090),m=e(55860),a=e(56840);const l=()=>(0,m.S)().getSortOptions();function f({onChange:h,value:u,placeholder:i,filter:x,getSortOptions:g,isClearable:p}){const c=(0,n.A)(async()=>{const P=await(g??l)();return x?P.filter(d=>x.includes(d.value)):P},[g,x]);if(c.loading)return null;const y=!!(u?.includes("desc")||u?.startsWith("-"));return(0,t.jsx)(r.l6,{width:28,onChange:h,value:c.value?.find(P=>P.value===u)??null,options:c.value,"aria-label":(0,a.t)("sort-picker.select-aria-label","Sort"),placeholder:i??`Sort (Default ${s.r4.label})`,prefix:(0,t.jsx)(o.I,{name:y?"sort-amount-down":"sort-amount-up"}),isClearable:p},u)}},11297:(ee,B,e)=>{"use strict";e.d(B,{$:()=>a,E:()=>m});var t=e(74848),n=e(22803),r=e(48542),o=e(63142),s=e(30703);const m=({count:l,label:f,onClick:h,removeIcon:u})=>{const{color:i}=(0,r.MC)(f),x=(0,o.of)(a),g=l!==0&&(0,t.jsx)("span",{style:{marginLeft:"3px"},children:`(${l})`});return(0,t.jsxs)("span",{className:x.badge,style:{backgroundColor:i},children:[u&&(0,t.jsx)(s.I,{onClick:h,name:"times"}),f," ",g]})},a=l=>({badge:(0,n.css)({...l.typography.bodySmall,backgroundColor:l.v1.palette.gray1,borderRadius:l.shape.radius.default,color:l.v1.palette.white,display:"inline-block",height:"20px",lineHeight:"20px",padding:l.spacing(0,.75),verticalAlign:"baseline",whiteSpace:"nowrap","&:hover":{opacity:.85}})})},93732:(ee,B,e)=>{"use strict";e.d(B,{$:()=>g});var t=e(74848),n=e(22803),r=e(96540),o=e(15777),s=e(8934),m=e(63142),a=e(18857),l=e(30703),f=e(56840),h=e(11297);const u=({data:c,className:y,label:P,isFocused:d,innerProps:D})=>{const b=(0,m.of)(i);return(0,t.jsx)("div",{className:(0,n.cx)(b.option,d&&b.optionFocused),"aria-label":(0,f.t)("tag-filter.tag-option-label","Tag option"),...D,children:(0,t.jsx)("div",{className:(0,n.cx)(b.optionInner,y),children:typeof P=="string"?(0,t.jsx)(h.E,{label:P,removeIcon:!1,count:c.count??0}):P})})},i=c=>({option:(0,n.css)({padding:c.spacing(.5),whiteSpace:"nowrap",cursor:"pointer",borderLeft:"2px solid transparent",borderRadius:c.shape.radius.default,"&:hover":{background:c.colors.action.hover}}),optionFocused:(0,n.css)({background:c.colors.action.focus,borderStyle:"solid",borderTop:0,borderRight:0,borderBottom:0,borderLeftWidth:"2px"}),optionInner:(0,n.css)({position:"relative",textAlign:"left",width:"100%",display:"block",cursor:"pointer",padding:"2px 0"})}),x=(c,y)=>{const P=RegExp((0,s.jD)(y),"i");return!!(c.value&&P.test(c.value))},g=({allowCustomValue:c=!1,formatCreateLabel:y,hideValues:P,inputId:d,isClearable:D,onChange:b,placeholder:E,tagOptions:v,tags:C,width:S})=>{const O=(0,m.of)(p),I=C.map(H=>({value:H,label:H,count:0})),[R,T]=(0,r.useState)(I),[L,K]=(0,r.useState)(!1),[A,W]=(0,r.useState)(C),[N,w]=(0,r.useState)(I),j=(0,r.useMemo)(()=>C.join(),[C]),V=(0,r.useCallback)(async()=>(await v()).map(_=>C.includes(_.term)?{value:_.term,label:_.term,count:0}:{value:_.term,label:_.term,count:_.count}),[v,C]),U=(0,r.useCallback)(async()=>{K(!0);const H=await V();c&&N.forEach(_=>H.push(_)),T(H),K(!1)},[c,N,V]);(0,r.useEffect)(()=>{C.length>0&&R.length===0&&U()},[U,R.length,C.length]),(0,r.useEffect)(()=>{C!==A&&(W(C),U())},[U,A,C]);const F=H=>{H.forEach(_=>_.count=0),b((H||[]).map(_=>_.value)),c&&w(H.filter(_=>!C.includes(_)))},M={onFocus:U,isLoading:L,options:R,allowCreateWhileLoading:!0,allowCustomValue:c,formatCreateLabel:y,defaultOptions:!0,filterOption:x,getOptionLabel:H=>H.label,getOptionValue:H=>H.value,inputId:d,isMulti:!0,onChange:F,loadingMessage:(0,f.t)("tag-filter.loading","Loading..."),noOptionsMessage:(0,f.t)("tag-filter.no-tags","No tags found"),placeholder:E||(0,f.t)("tag-filter.placeholder","Filter by tag"),value:I,width:S,components:{Option:u,MultiValueLabel:()=>null,MultiValueRemove(H){const{data:_}=H;
159return(0,t.jsx)(o.c.MultiValueRemove,{...H,children:(0,t.jsx)(h.E,{label:_.label,removeIcon:!0,count:_.count},_.label)})},MultiValueContainer:P?()=>null:o.c.MultiValueContainer}};return(0,t.jsxs)("div",{className:O.tagFilter,children:[D&&C.length>0&&(0,t.jsx)("button",{className:O.clear,onClick:()=>F([]),children:(0,t.jsx)(f.x6,{i18nKey:"tag-filter.clear-button",children:"Clear tags"})}),(0,t.jsx)(a.KF,{...M,prefix:(0,t.jsx)(l.I,{name:"tag-alt"}),"aria-label":(0,f.t)("tag-filter.select-aria-label","Tag filter")},j)]})};g.displayName="TagFilter";const p=c=>{const y=(0,h.$)(c);return{tagFilter:(0,n.css)({position:"relative",minWidth:"180px",flexGrow:1,[`.${y.badge}`]:{marginLeft:"6px",cursor:"pointer"}}),clear:(0,n.css)({background:"none",border:"none",textDecoration:"underline",fontSize:"12px",padding:"none",position:"absolute",top:"-17px",right:0,cursor:"pointer",color:c.colors.text.secondary,"&:hover":{color:c.colors.text.primary}})}}},61074:(ee,B,e)=>{"use strict";e.d(B,{F:()=>r});var t=e(47070),n=e(43173);function r(){const o=[];return n.$.featureToggles.extraThemes&&o.push("debug"),n.$.featureToggles.grafanaconThemes&&(o.push("desertbloom"),o.push("gildedgrove"),o.push("sapphiredusk"),o.push("tron"),o.push("gloom")),(0,t.k)(o)}},51158:(ee,B,e)=>{"use strict";e.d(B,{m:()=>i});var t=e(74848),n=e(2543),r=e.n(n),o=e(32899),s=e(17548),m=e(25229),a=e(91867),l=e(45229),f=e(56840),h=e(36321);const u="grafana.dashboard.timepicker.history",i=P=>(0,t.jsx)(h.b,{storageKey:u,defaultValue:[],children:(d,D)=>{const b=g(d),E=x(b);return(0,t.jsx)(a.$6,{...P,history:E,onChange:v=>{p(v,b,D),P.onChange(v)},onError:v=>l.A.emit(o.r1.alertError,[(0,f.t)("time-picker.copy-paste.default-error-title","Invalid time range"),(0,f.t)("time-picker.copy-paste.default-error-message","{{error}} is not a valid time range",{error:v})])})}});function x(P){return P.map(d=>s.convertRawToRange(d,"utc",void 0,"YYYY-MM-DD HH:mm:ss"))}function g(P){return P.map(d=>{const D=typeof d.from=="string"?d.from:d.from.toISOString(),b=typeof d.to=="string"?d.to:d.to.toISOString();return{from:D,to:b}})}function p(P,d,D){if(!c(P))return;const b={from:typeof P.raw.from=="string"?P.raw.from:P.raw.from.toISOString(),to:typeof P.raw.to=="string"?P.raw.to:P.raw.to.toISOString()},E=y([b,...d]);D(E)}function c(P){return(0,m.Ar)(P.raw.from)||(0,m.Ar)(P.raw.to)}function y(P){return(0,n.uniqBy)(P,d=>d.from+d.to).slice(0,4)}},47981:(ee,B,e)=>{"use strict";e.d(B,{N:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(22787),m=e(13943),a=e(66404),l=e(56840),f=e(9628);const h=p=>[{category:(0,l.t)("help-modal.shortcuts-category.global","Global"),shortcuts:[{keys:["g","h"],description:(0,l.t)("help-modal.shortcuts-description.go-to-home-dashboard","Go to Home Dashboard")},{keys:["g","d"],description:(0,l.t)("help-modal.shortcuts-description.go-to-dashboards","Go to Dashboards")},{keys:["g","e"],description:(0,l.t)("help-modal.shortcuts-description.go-to-explore","Go to Explore")},{keys:["g","p"],description:(0,l.t)("help-modal.shortcuts-description.go-to-profile","Go to Profile")},{keys:[`${p} + k`],description:(0,l.t)("help-modal.shortcuts-description.open-search","Open search")},{keys:["esc"],description:(0,l.t)("help-modal.shortcuts-description.exit-edit/setting-views","Exit edit/setting views")},{keys:["?"],description:(0,l.t)("help-modal.shortcuts-description.show-all-shortcuts","Show all keyboard shortcuts")},{keys:["c","t"],description:(0,l.t)("help-modal.shortcuts-description.change-theme","Change theme")}]},{category:(0,l.t)("help-modal.shortcuts-category.time-range","Time range"),shortcuts:[{keys:["t","z"],description:(0,l.t)("help-modal.shortcuts-description.zoom-out-time-range","Zoom out time range")},{keys:["t","\u2190"],description:(0,l.t)("help-modal.shortcuts-description.move-time-range-back","Move time range back")},{keys:["t","\u2192"],description:(0,l.t)("help-modal.shortcuts-description.move-time-range-forward","Move time range forward")},{keys:["t","a"],description:(0,l.t)("help-modal.shortcuts-description.make-time-range-permanent","Make time range absolute/permanent")},{keys:["t","c"],description:(0,l.t)("help-modal.shortcuts-description.copy-time-range","Copy time range")},{keys:["t","v"],description:(0,l.t)("help-modal.shortcuts-description.paste-time-range","Paste time range")}]},{category:(0,l.t)("help-modal.shortcuts-category.dashboard","Dashboard"),shortcuts:[{keys:[`${p} + s`],description:(0,l.t)("help-modal.shortcuts-description.save-dashboard","Save dashboard")},{keys:["d","r"],description:(0,l.t)("help-modal.shortcuts-description.refresh-all-panels","Refresh all panels")},{keys:["d","s"],description:(0,l.t)("help-modal.shortcuts-description.dashboard-settings","Dashboard settings")},{keys:["d","v"],description:(0,l.t)("help-modal.shortcuts-description.toggle-active-mode","Toggle in-active / view mode")},{keys:["d","k"],description:(0,l.t)("help-modal.shortcuts-description.toggle-kiosk","Toggle kiosk mode (hides top nav)")},{keys:["d","\u21E7 + e"],description:(0,l.t)("help-modal.shortcuts-description.expand-all-rows","Expand all rows")},{keys:["d","\u21E7 + c"],description:(0,l.t)("help-modal.shortcuts-description.collapse-
159all-rows","Collapse all rows")},{keys:["d","a"],description:(0,l.t)("help-modal.shortcuts-description.toggle-auto-fit","Toggle auto fit panels (experimental feature)")},{keys:[`${p} + o`],description:(0,l.t)("help-modal.shortcuts-description.toggle-graph-crosshair","Toggle shared graph crosshair")},{keys:["d","l"],description:(0,l.t)("help-modal.shortcuts-description.toggle-all-panel-legends","Toggle all panel legends")},{keys:["d","x"],description:(0,l.t)("help-modal.shortcuts-description.toggle-exemplars","Toggle exemplars in all panel")}]},{category:(0,l.t)("help-modal.shortcuts-category.focused-panel","Focused panel"),shortcuts:[{keys:["e"],description:(0,l.t)("help-modal.shortcuts-description.toggle-panel-edit","Toggle panel edit view")},{keys:["v"],description:(0,l.t)("help-modal.shortcuts-description.toggle-panel-fullscreen","Toggle panel fullscreen view")},{keys:["p","s"],description:(0,l.t)("help-modal.shortcuts-description.open-shared-modal","Share panel snapshot")},{keys:["p","d"],description:(0,l.t)("help-modal.shortcuts-description.duplicate-panel","Duplicate Panel")},{keys:["p","r"],description:(0,l.t)("help-modal.shortcuts-description.remove-panel","Remove Panel")},{keys:["p","l"],description:(0,l.t)("help-modal.shortcuts-description.toggle-panel-legend","Toggle panel legend")}]}],u=({onDismiss:p})=>{const c=(0,o.of)(g),y=(0,r.useMemo)(()=>(0,f.gn)(),[]),P=(0,r.useMemo)(()=>h(y),[y]);return(0,t.jsx)(s.a,{title:(0,l.t)("help-modal.title","Shortcuts"),isOpen:!0,onDismiss:p,onClickBackdrop:p,children:(0,t.jsx)(m.x,{columns:{xs:1,sm:2},gap:3,tabIndex:0,children:Object.values(P).map(({category:d,shortcuts:D})=>(0,t.jsx)("section",{children:(0,t.jsxs)("table",{className:c.table,children:[(0,t.jsx)("caption",{children:(0,t.jsx)(a.E,{element:"p",variant:"h5",children:d})}),(0,t.jsx)("thead",{className:"sr-only",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(l.x6,{i18nKey:"help-modal.column-headers.keys",children:"Keys"})}),(0,t.jsx)("th",{children:(0,t.jsx)(l.x6,{i18nKey:"help-modal.column-headers.description",children:"Description"})})]})}),(0,t.jsx)("tbody",{children:D.map(({keys:b,description:E})=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:c.keys,children:b.map(v=>(0,t.jsx)(i,{children:v},v))}),(0,t.jsx)("td",{children:(0,t.jsx)(a.E,{variant:"bodySmall",element:"p",children:E})})]},b.join()))})]})},d))})})},i=({children:p})=>{const c=(0,o.of)(g),y=(0,r.useMemo)(()=>x(p),[p]),P=(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:y}});return(0,t.jsx)("kbd",{className:c.shortcutTableKey,children:(0,t.jsx)(a.E,{variant:"code",children:P})})};function x(p){let c,y;if(p.includes("ctrl"))c="ctrl",y="Control";else if(p.includes("esc"))c="esc",y="Escape";else return p;return p.replace(c,`<span class="sr-only">${y}</span><span aria-hidden="true" role="none">${c}</span>`)}function g(p){return{table:(0,n.css)({borderCollapse:"separate",borderSpacing:p.spacing(2),"& caption":{captionSide:"top"}}),keys:(0,n.css)({textAlign:"end",whiteSpace:"nowrap",minWidth:83}),shortcutTableKey:(0,n.css)({display:"inline-block",textAlign:"center",marginRight:p.spacing(.5),padding:"3px 5px",lineHeight:"10px",verticalAlign:"middle",border:`solid 1px ${p.colors.border.medium}`,borderRadius:p.shape.radius.default,color:p.colors.text.primary,backgroundColor:p.colors.background.secondary})}}},95943:(ee,B,e)=>{"use strict";e.d(B,{FG:()=>g,Gk:()=>u,HG:()=>s,IZ:()=>i,Pz:()=>o,Ut:()=>c,bJ:()=>a,cV:()=>r,cx:()=>l,dU:()=>n,o9:()=>m,rt:()=>h,sD:()=>t,tH:()=>f,wV:()=>p});const t=30,n=8,r=24,o="v",s="h",m=4,a=250,l=t*3,f="panel-copy",h="row-copy",u="tab-copy",i=2,x=23763571993,g=40,p="VisualizationSelectPane.ListMode",c="mega-menu-toggle"},27963:(ee,B,e)=>{"use strict";e.d(B,{Il:()=>o,YE:()=>r,ni:()=>s});var t=e(96540),n=e(36490);const r=(0,t.createContext)(void 0);function o(){const m=(0,t.useContext)(r);if(!m)throw new Error("No GrafanaContext found");return m}function s(){const{chrome:m}=o();return(0,t.useCallback)((a,l)=>{const{pathname:f,search:h}=n.Ny.getLocation();m.setReturnToPrevious({title:a,href:l??f+h})},[m])}},64762:(ee,B,e)=>{"use strict";e.d(B,{Cf:()=>i,_2:()=>x,gi:()=>h,q8:()=>u,tZ:()=>f});var t=e(96540),n=e(24726),r=e(47797),o=e(96673),s=e(6890);const m={title:"",text:"",severity:o.AppNotificationSeverity.Success,icon:"check"},a={title:"",text:"",severity:o.AppNotificationSeverity.Warning,icon:"exclamation-triangle"},l={title:"",text:"",severity:o.AppNotificationSeverity.Error,icon:"exclamation-triangle"},f=(g,p="",c)=>({...m,title:g,text:p,id:(0,n.A)(),timestamp:Date.now(),showing:!0}),h=(g,p="",c,y)=>({...l,text:(0,r.q6)(p),title:g,id:(0,n.A)(),traceId:c,component:y,timestamp:Date.now(),showing:!0}),u=(g,p="",c)=>({...a,title:g,text:p,traceId:c,id:(0,n.A)(),timestamp:Date.now(),showing:!0}),i=(g,p="",c)=>({severity:o.AppNotificationSeverity.Info,icon:"info-circle",title:g,text:p,id:(0,n.A)(),timestamp:Date.now(),showing:!0});function x(){const g=(0,o.useDispatch)();return(0,t.useMemo)(()=>({success:(p,c="")=>{g((0,s.dx)(f(p,c)))},warning:(p,c="",y)=>{g((0,s.dx)(u(p,c,y)))},error:(p,c="",y)=>{g((0,s.dx)(h(p,c,y)))},info:(p,c="")=>{g((0,s.dx)(i(p,c)))}}),[g])}},66594:(ee,B,e)=>{"use strict";e.d(B,{$H:()=>f,Ay:()=>h});var t=e(2543),n=e(29043),r=e(72054),o=e(78282);const s=d=>{const D=(0,o.l)().getInstanceSettings(d.datasourceName);return{id:d.ts.toString(),createdAt:d.ts,datasourceName:d.datasourceName,datasourceUid:D?.uid||"",starred:d.starred,comment:d.comment,queries:d.queries}},m=d=>{if(!(0,o.l)().getInstanceSettings({uid:d.datasourceUid}))throw new Error("Datasource not found.");return{ts:d.createdAt,datasourceName:d.datasourceName,starred:d.starred,comment:d.comment,queries:d.queries}};var a=e(68126);
159const l="grafana.explore.richHistory",f=1e4;class h{async getRichHistory(D){const b=g().map(s),E=D.starred?b.filter(S=>S.starred===!0):b,v=D.from&&D.to?[D.from,D.to]:void 0,C=(0,a.a_)(E,D.sortOrder,D.datasourceFilters,D.search,v);return{richHistory:C,total:C.length}}async addToRichHistory(D){const b=Date.now(),E={id:b.toString(),createdAt:b,...D},v=m(E),C=i(g()),S=v.queries.map(L=>(0,t.omit)(L,["key","refId"])),O=C.length>0&&C[0].queries.map(L=>(0,t.omit)(L,["key","refId"]));if((0,t.isEqual)(S,O)){const L=new Error("Entry already exists");throw L.name=r.m.DuplicatedEntry,L}const{queriesToKeep:I,limitExceeded:R}=x(C),T=[v,...I];try{n.A.setObject(l,T)}catch(L){if(L instanceof Error&&L.name==="QuotaExceededError")P(r.m.StorageFull,`Saving rich history failed: ${L.message}`);else throw L}return R?{warning:{type:r.C.LimitExceeded,message:`Query history reached the limit of ${f}. Old, not-starred items have been removed.`},richHistoryQuery:E}:{richHistoryQuery:E}}async deleteAll(){n.A.delete(l)}async deleteRichHistory(D){const b=parseInt(D,10),v=n.A.getObject(l,[]).filter(C=>C.ts!==b);n.A.setObject(l,v)}async updateStarred(D,b){return u(D,E=>E.starred=b)}async updateComment(D,b){return u(D,E=>E.comment=b)}async getSettings(){return{activeDatasourcesOnly:n.A.getObject(a.mE.activeDatasourcesOnly)??n.A.getObject(a.mE.legacyActiveDatasourceOnly,!1),retentionPeriod:n.A.getObject(a.mE.retentionPeriod,7),starredTabAsFirstTab:n.A.getBool(a.mE.starredTabAsFirstTab,!1),lastUsedDatasourceFilters:n.A.getObject(a.mE.datasourceFilters,[]).map(b=>b.value)}}async updateSettings(D){n.A.set(a.mE.activeDatasourcesOnly,D.activeDatasourcesOnly),n.A.set(a.mE.retentionPeriod,D.retentionPeriod),n.A.set(a.mE.starredTabAsFirstTab,D.starredTabAsFirstTab),n.A.setObject(a.mE.datasourceFilters,(D.lastUsedDatasourceFilters||[]).map(b=>({value:b})))}}function u(d,D){const b=parseInt(d,10),E=n.A.getObject(l,[]),v=(0,t.find)(E,{ts:b});if(!v)throw new Error("Rich history item not found.");return D(v),n.A.setObject(l,E),s(v)}function i(d){const D=n.A.getObject(a.mE.retentionPeriod,7),b=(0,a.wQ)(D,{isLastTs:!1});return d.filter(E=>E.ts>b||E.starred===!0)||[]}function x(d){let D=!1,b=d.length-1;for(;b>=0&&d.length>=f;)d[b].starred||(d.splice(b,1),D=!0),b--;return{queriesToKeep:d,limitExceeded:D}}function g(){const d=n.A.getObject(l,[]);return p(d)}function p(d){return d.map(b=>{const E=b.queries.map((v,C)=>c(b,v,C));return{...b,queries:E}})}function c(d,D,b){const E="ABCDEFGHIJKLMNOPQRSTUVXYZ";return typeof D=="object"?D:y(D)?JSON.parse(D):{expr:D,refId:E[b]}}function y(d){try{JSON.parse(d)}catch{return!1}return!0}function P(d,D){const b=new Error(D);throw b.name=d,b}},72054:(ee,B,e)=>{"use strict";e.d(B,{C:()=>n,m:()=>t});var t=(r=>(r.StorageFull="StorageFull",r.DuplicatedEntry="DuplicatedEntry",r))(t||{}),n=(r=>(r.LimitExceeded="LimitExceeded",r))(n||{})},68126:(ee,B,e)=>{"use strict";e.d(B,{a_:()=>s,mE:()=>u,wQ:()=>m});var t=e(2543),n=e.n(t),r=e(25229),o=e(80977);function s(i,x,g,p,c){const y=l(i,g),P=f(y,p),d=c?a(P,c):P;return h(d,x)}const m=(i,x)=>{let g=x.now;return g||(g=x.tz?(0,r.oZ)(x.tz):(0,r.KQ)()),g.add(-i,"d"),(x.isLastTs?g.endOf("d"):g.startOf("d")).valueOf()};function a(i,x){return i.filter(g=>g.createdAt>x[0]&&g.createdAt<x[1])}function l(i,x){return x.length>0?i.filter(g=>x.includes(g.datasourceName)):i}function f(i,x){return i.filter(g=>g.comment.includes(x)?!0:g.queries.filter(c=>Object.values((0,t.omit)(c,["datasource","key","refId","hide","queryType"])).some(y=>y?.toString().includes(x))).length>0)}const h=(i,x)=>{let g;return x===o.x.Ascending&&(g=(p,c)=>p.createdAt<c.createdAt?-1:p.createdAt>c.createdAt?1:0),x===o.x.Descending&&(g=(p,c)=>p.createdAt<c.createdAt?1:p.createdAt>c.createdAt?-1:0),x===o.x.DatasourceZA&&(g=(p,c)=>p.datasourceName<c.datasourceName?-1:p.datasourceName>c.datasourceName?1:0),x===o.x.DatasourceAZ&&(g=(p,c)=>p.datasourceName<c.datasourceName?1:p.datasourceName>c.datasourceName?-1:0),i.sort(g)},u={retentionPeriod:"grafana.explore.richHistory.retentionPeriod",starredTabAsFirstTab:"grafana.explore.richHistory.starredTabAsFirstTab",legacyActiveDatasourceOnly:"grafana.explore.ric
159hHistory.activeDatasourceOnly",activeDatasourcesOnly:"grafana.explore.richHistory.activeDatasourcesOnly",datasourceFilters:"grafana.explore.richHistory.datasourceFilters"}},53222:(ee,B,e)=>{"use strict";e.d(B,{tU:()=>c,a:()=>p,gQ:()=>y});var t=e(43173),n=e(73427),r=e(80977),o=e(66594),s=e(75505),m=e(68143),a=e(78282),l=e(69738);const f=P=>{const d=(0,a.l)().getInstanceSettings({uid:P.datasourceUid});return{id:P.uid,createdAt:P.createdAt*1e3,datasourceName:d?.name||"",datasourceUid:P.datasourceUid,starred:P.starred,comment:P.comment,queries:P.queries}},h=P=>({uid:P.id,createdAt:Math.floor(P.createdAt/1e3),datasourceUid:P.datasourceUid,starred:P.starred,comment:P.comment,queries:P.queries});class u{constructor(){this.preferenceService=new l.W("user")}async addToRichHistory(d){const{result:D}=await(0,m.AI)().post("/api/query-history",{dataSourceUid:d.datasourceUid,queries:d.queries});return{richHistoryQuery:f(D)}}async deleteAll(){throw new Error("not supported")}async deleteRichHistory(d){(0,m.AI)().delete(`/api/query-history/${d}`)}async getRichHistory(d){const D=i(d);let b="query-history-get-all";d.starred&&(b="query-history-get-starred");const v=(await(0,s.s)((0,m.AI)().fetch({method:"GET",url:`/api/query-history?${D}`,requestId:b}))).data,C=(v.result.queryHistory||[]).map(f),S=v.result.totalCount||0;return{richHistory:C,total:S}}async getSettings(){return{activeDatasourcesOnly:!1,lastUsedDatasourceFilters:void 0,retentionPeriod:14,starredTabAsFirstTab:(await this.preferenceService.load()).queryHistory?.homeTab==="starred"}}async updateComment(d,D){const b=await(0,m.AI)().patch(`/api/query-history/${d}`,{comment:D});return f(b.result)}updateSettings(d){return this.preferenceService.patch({queryHistory:{homeTab:d.starredTabAsFirstTab?"starred":"query"}})}async updateStarred(d,D){let b;return D?b=await(0,m.AI)().post(`/api/query-history/star/${d}`):b=await(0,m.AI)().delete(`/api/query-history/star/${d}`),f(b.result)}}function i(P){let d=`${P.datasourceFilters.map(D=>{const b=(0,a.l)().getInstanceSettings(D).uid;return`datasourceUid=${encodeURIComponent(b)}`}).join("&")}`;return P.search&&(d=d+`&searchString=${P.search}`),P.sortOrder&&(d=d+`&sort=${P.sortOrder===r.x.Ascending?"time-asc":"time-desc"}`),P.starred||(d=d+`&to=${P.to}`,d=d+`&from=${P.from}`),d=d+"&limit=100",d=d+`&page=${P.page||1}`,P.starred&&(d=d+`&onlyStarred=${P.starred}`),d}const x=new o.Ay,g=new u,p=()=>t.$.queryHistoryEnabled?g:x,c=()=>x,y=()=>t.$.queryHistoryEnabled?{availableFilters:[r.x.Descending,r.x.Ascending],lastUsedDataSourcesAvailable:!1,clearHistory:!1,onlyActiveDataSource:!1,changeRetention:!1,queryHistoryAvailable:n.TP.isSignedIn}:{availableFilters:[r.x.Descending,r.x.Ascending,r.x.DatasourceAZ,r.x.DatasourceZA],lastUsedDataSourcesAvailable:!0,clearHistory:!0,onlyActiveDataSource:!0,changeRetention:!0,queryHistoryAvailable:!0}},94232:(ee,B,e)=>{"use strict";e.d(B,{u:()=>n});var t=e(96540);function n(r,o){const[s,m]=(0,t.useState)();return(0,t.useEffect)(()=>{const a=r.subscribe(o,m);return()=>a.unsubscribe()},[r,o]),s}},51702:(ee,B,e)=>{"use strict";e.d(B,{i:()=>r});var t=e(96540),n=e(63142);function r(o){const s=(0,n.$j)(),m=(0,t.useMemo)(()=>window.matchMedia(`(min-width: ${s.breakpoints.values[o]}px)`),[s,o]),[a,l]=(0,t.useState)(m.matches);return(0,t.useEffect)(()=>{const f=h=>l(h.matches);return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[m]),a}},45776:(ee,B,e)=>{"use strict";e.d(B,{C:()=>r});var t=e(96673),n=e(84057);const r=o=>{const s=(0,t.useSelector)(m=>m.navIndex);return(0,n.tc)(s,o)}},70958:(ee,B,e)=>{"use strict";e.d(B,{s:()=>o});var t=e(96540),n=e(54148),r=e(36490);function o(){const{search:s}=(0,n.zy)(),m=(0,t.useMemo)(()=>(0,r.SE)(s||""),[s]),a=(0,t.useCallback)((l,f)=>r.Ny.partial(l,f),[]);return[m,a]}},12810:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>i,a:()=>x});var t=e(5086),n=e(32017),r=e.n(n),o=e(47078),s=e.n(o),m=e(65642),a=e(56840);const l=g=>s()(g,{isEqual:r()}),f=m.$W.featureToggles.localeFormatPreference,h=l((g,p)=>new Intl.DateTimeFormat(g,p)),u=l((g,p)=>new Intl.DurationFormat(g,p)),i=l((g,p={})=>
159{if(typeof g=="string")return i(new Date(g),p);const c=(0,a.iL)(),y=f?m.$W.locale:c.language;return h(y,p).format(g)}),x=l((g,p={})=>{const c=(0,a.iL)(),y=f?m.$W.locale:c.language;return u(y,p).format(g)})},74101:(ee,B,e)=>{"use strict";e.d(B,{z:()=>r});var t=e(54148),n=e(36490);function r(){const o=(0,t.zy)();return[new URLSearchParams(o.search),(a,l)=>{n.Ny.partial(a,l)}]}},12066:(ee,B,e)=>{"use strict";e.d(B,{$K:()=>p,Do:()=>h,XC:()=>i,XR:()=>u,dx:()=>f,fX:()=>d,g5:()=>g,oF:()=>x,qN:()=>P});var t=e(65307),n=e(25508),r=e(96673);const o=25,s="notifications",m=`${s}/lastRead`,a={byId:v(),lastRead:Number.parseInt(window.localStorage.getItem(m)??`${Date.now()}`,10)},l=(0,t.Z0)({name:"appNotifications",initialState:a,reducers:{notifyApp:(S,{payload:O})=>{Object.values(S.byId).some(I=>D(O,I)&&I.showing)||(S.byId[O.id]=O,C(S.byId))},hideAppNotification:(S,{payload:O})=>{O in S.byId&&(S.byId[O].showing=!1,C(S.byId))},clearNotification:(S,{payload:O})=>{delete S.byId[O],C(S.byId)},clearAllNotifications:S=>{S.byId={},C(S.byId)},readAllNotifications:(S,{payload:O})=>{S.lastRead=O}}}),{notifyApp:f,hideAppNotification:h,clearNotification:u,clearAllNotifications:i,readAllNotifications:x}=l.actions,g=l.reducer,p=S=>S.lastRead,c=S=>S.byId,y=(0,n.Mz)(c,S=>Object.values(S).sort((O,I)=>I.timestamp-O.timestamp)),P=(0,n.Mz)(y,S=>S.filter(b)),d=(0,n.Mz)(c,S=>Object.values(S).filter(O=>O.showing));function D(S,O){return S.icon===O.icon&&S.severity===O.severity&&S.text===O.text&&S.title===O.title}function b(S){return S.severity===r.AppNotificationSeverity.Warning||S.severity===r.AppNotificationSeverity.Error}function E(S){return typeof S=="object"&&S!==null&&"id"in S&&"icon"in S&&"title"in S&&"text"in S}function v(){const S=window.localStorage.getItem(s);if(!S)return{};const O=JSON.parse(S);return Object.values(O).every(I=>E(I))?O:{}}function C(S){const O=Object.values(S).filter(b).sort((I,R)=>R.timestamp-I.timestamp).slice(0,o).reduce((I,R)=>(I[R.id]={id:R.id,severity:R.severity,icon:R.icon,title:R.title,text:R.text,traceId:R.traceId,timestamp:R.timestamp,showing:!1},I),{});try{window.localStorage.setItem(s,JSON.stringify(O))}catch(I){console.error("Unable to persist notifications to local storage"),console.error(I)}}},38206:(ee,B,e)=>{"use strict";e.d(B,{I_:()=>i,L1:()=>m,TU:()=>h,ci:()=>l,fc:()=>f,ve:()=>u});var t=e(65307),n=e(43173),r=e(18832);const o=n.$.bootData?.navTree??[];function s(x){return x.map(g=>{const p=g.children&&s(g.children);return{...g,children:p,text:(0,r.C)(g.id)??g.text,subTitle:(0,r.o)(g.id)??g.subTitle,emptyMessage:(0,r.C)(g.emptyMessageId)}})}const m="starred/",a=(0,t.Z0)({name:"navBarTree",initialState:()=>s(n.$.bootData?.navTree??[]),reducers:{setStarred:(x,g)=>{const p=x.find(D=>D.id==="starred"),{id:c,title:y,url:P,isStarred:d}=g.payload;if(p)if(d){p.children||(p.children=[]);const D={id:m+c,text:y,url:P};p.children.push(D),p.children.sort((b,E)=>b.text.localeCompare(E.text))}else{const D=p.children?.findIndex(b=>b.id===m+c)??-1;D>-1&&p?.children?.splice(D,1)}},setBookmark:(x,g)=>{if(!n.$.featureToggles.pinNavItems)return;const p=x.find(P=>P.id==="bookmarks"),{item:c,isSaved:y}=g.payload;if(p)if(y){p.children||=[];const P={...c,children:[],sortWeight:0,emptyMessageId:"",emptyMessage:"",parentItem:{id:p.id,text:p.text}};p.children.push(P)}else p.children=p.children?.filter(P=>P.url!==c.url)??[]},updateDashboardName:(x,g)=>{const{id:p,title:c,url:y}=g.payload,P=x.find(d=>d.id==="starred");if(P){const d=P.children?.find(D=>D.id===p);d&&(d.text=c,d.url=y,P.children?.sort((D,b)=>D.text.localeCompare(b.text)))}},removePluginFromNavTree:(x,g)=>{const p="plugin-page-"+g.payload.pluginID,c=x.findIndex(y=>y.id===p);c>-1&&x.splice(c,1)}}}),{setStarred:l,removePluginFromNavTree:f,updateDashboardName:h,setBookmark:u}=a.actions,i=a.reducer},43550:(ee,B,e)=>{"use strict";e.d(B,{Id:()=>m,Im:()=>x,Vz:()=>u,YA:()=>i,_h:()=>p,s2:()=>a});var t=e(65307),n=e(2543),r=e.n(n),o=e(65642),s=e(18832);const m="home";function a(){const c={},y=(0,n.cloneDeep)(o.Ay.bootData.navTree),P=y.find(D=>D.id===m),d=y.filter(D=>D.id!==m);return P&&l(c,[P]),l(c,d,c[m]),c}function l(c,y,P){const d=[];for(const D of y){const b={...D,text:(0,s.C)(D.id)??D.text,subTitle:(0,s.o)(D.id)??D.subTitle,emptyMessage:(0,s.C)(D.emptyMessageId),parentItem:P};b.id&&(c[b.id]=b),b.children&&l(c,b.children,b),d.push(b)}P&&(P.children=d),c["not-found"]={...f("Page not found","404 Error").node},c.error={...f("Page error","An unexpected error").node}}function f(c,y){const P={text:c,subTitle:y,icon:"exclamation-triangle"};return{node:P,main:P}}const h={},u=(0,t.VP)("navIndex/updateNavIndex"),i=(0,t.VP)("navIndex/updateConfigurationSubtitle"),x=(0,t.VP)("navIndex/removeNavIndex"),g=(c,y)=>({...c,parentItem:{...c.parentItem,text:c.parentItem?.text??"",subTitle:y}}),p=(c=h,y)=>{if(u.match(y)){let d=function(E){if(E.children)for(const v of E.children)D[v.id]={...v,parentItem:E};E.parentItem&&d(E.parentItem)};var P=d;const D={},b=y.payload;return d(b),{...c,...D}}else if(i.match(y)){const d=`Organization: ${y.payload}`;return{...c,cfg:{...c.cfg,subTitle:d},datasources:g(c.datasources,d),correlations:g(c.correlations,d),users:g(c.users,d),teams:g(c.teams,d),plugins:g(c.plugins,d),"org-settings":g(c["org-settings"],d),apikeys:g(c.apikeys,d)}}else x.match(y)&&delete c[y.payload];return c}},84057:(ee,B,e)=>{"use strict";e.d(B,{rH:()=>m,tc:()=>s});var t=e(41811),n=e(66198),r=e(43550);const o=()=>{const f={id:"not-found",text:"Page not found",icon:"exclamation-triangle",subTitle:"404 Error",url:"not-found"};return{node:f,main:f}},s=(0,t.default)((f,h,u,i=!1)=>
159{if(f[h]){const x=f[h],g=i?x:m(x),p=a(g,h);return{node:x,main:p}}return u||o()});function m(f){return f.id===n.Rj?f:f.parentItem&&f.parentItem.id!==r.Id?m(f.parentItem):f}function a(f,h){return f.id===h?{...f,active:!0}:f.children&&f.children.length>0?{...f,children:f.children.map(u=>a(u,h))}:f}const l=f=>`${f.main.text}${f.node.text?": "+f.node.text:""}`},69738:(ee,B,e)=>{"use strict";e.d(B,{W:()=>n});var t=e(83873);class n{constructor(o){this.resourceUri=o}update(o){return t.IB.put(`/api/${this.resourceUri}/preferences`,o)}patch(o){return t.IB.patch(`/api/${this.resourceUri}/preferences`,o)}load(){return t.IB.get(`/api/${this.resourceUri}/preferences`)}}},5114:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>o});var t=e(96540),n=e(13752),r=e(79104);class o{constructor(a){this._subject=new n.B,this._state=a}useState(){return s(this)}get state(){return this._state}setState(a){this._state={...this._state,...a},this._subject.next(this._state)}subscribeToState(a){return this._subject.subscribe(a)}}function s(m){const a=(0,r.C)();return(0,t.useEffect)(()=>{const l=m.subscribeToState({next:a});return()=>l.unsubscribe()},[m,a]),m.state}},83873:(ee,B,e)=>{"use strict";e.d(B,{Mf:()=>Me,IB:()=>$e,AI:()=>tt});var t=e(56568),n=e(13752),r=e(75505),o=e(88483),s=e(64423),m=e(13288),a=e(65474),l=e(20039),f=e(81160),h=e(69862),u=e(59099),i=e(37748),x=e(66847),g=e(67791),p=e(16126),c=e(41560),y=e(69850),P=e(1005),d=e(24726),D=e(32899),b=e(94644),E=e(37615),v=e(43173),C=e(45229),S=e(65642),O=e(57680),I=e(65556),R=e(18646),T=e(74848),L=e(22803),K=e(63142),A=e(15245),W=e(79331),N=e(45861),w=e(35621),j=e(56840);const V=Ke=>{const Re=(0,K.of)(U),Ve=(0,K.$j)(),Qe=(0,w.o)(Ve),je=!!Ke.maxConcurrentSessions,ze=()=>{window.location.reload()};return(0,T.jsxs)(A.ZL,{children:[(0,T.jsx)("div",{className:Qe.modal,children:(0,T.jsxs)(W.w,{title:(0,j.t)("users.token-revoked-modal.title-you-have-been-automatically-signed-out","You have been automatically signed out"),severity:"warning",className:Re.infobox,children:[(0,T.jsxs)("div",{className:Re.text,children:[(0,T.jsxs)("p",{children:["Your session token was automatically revoked because you have reached",(0,T.jsx)("strong",{children:` the maximum number of ${je?Ke.maxConcurrentSessions:""} concurrent sessions `}),"for your account."]}),(0,T.jsx)("p",{children:(0,T.jsxs)(j.x6,{i18nKey:"users.token-revoked-modal.resume-message",children:[(0,T.jsx)("strong",{children:"To resume your session, sign in again."}),"Contact your administrator or visit the license page to review your quota if you are repeatedly signed out automatically."]})})]}),(0,T.jsx)(N.$n,{size:"md",variant:"primary",onClick:ze,children:(0,T.jsx)(j.x6,{i18nKey:"users.token-revoked-modal.sign-in",children:"Sign in"})})]})}),(0,T.jsx)("div",{className:(0,L.cx)(Qe.modalBackdrop,Re.backdrop)})]})},U=Ke=>({infobox:(0,L.css)({marginBottom:0}),text:(0,L.css)({margin:Ke.spacing(1,0,2)}),backdrop:(0,L.css)({backgroundColor:Ke.colors.background.canvas,opacity:.8})});var F=e(87745),M=e(2543);const H=Ke=>{const Re=Ke.method,Ve=X(Ke),Qe=se(Ve),je=oe(Ke,Qe),ze=pe(Ke);return{method:Re,headers:Ve,body:je,credentials:ze,signal:Ke.abortSignal}},_={canParse:()=>!0,parse:Ke=>(Ke.get("accept")||Ke.set("accept","application/json, text/plain, */*"),Ke)},Z=Ke=>({canParse:Re=>(Re?.method?Re?.method.toLowerCase():"")===Ke,parse:Re=>(Re.get("content-type")||Re.set("content-type","application/json"),Re)}),ne=Z("post"),te=Z("put"),Y=Z("patch"),Q=[ne,te,Y,_],J=/[^\u0000-\u00ff]/g;function q(Ke){return J.test(Ke)?encodeURI(Ke):Ke}const X=Ke=>{const Re={};for(let[ze,Ye]of Object.entries(Ke.headers??{}))Re[q(ze)]=q(Ye);const Ve=new Headers(Re);return Q.filter(ze=>ze.canParse(Ke)).reduce((ze,Ye)=>Ye.parse(ze),Ve)},se=Ke=>{if(!Ke)return!1;const Re=Ke.get("content-type");return!!(Re&&(Re.toLowerCase()==="application/json"||Re.toLowerCase()==="application/merge-patch+json"))},oe=(Ke,Re)=>Ke&&(!Ke.data||typeof Ke.data=="string"||Ke.data instanceof Blob?Ke.data:Re?JSON.stringify(Ke.data):new URLSearchParams(Ke.data));async function ae(Ke,Re){if(Re)switch(Re){case"arraybuffer":return Ke.arrayBuffer();case"blob":return Ke.blob();case"json":return Ke.headers.get("Content-Length")==="0"?(console.warn(`${Ke.url}
159 returned an invalid JSON`),{}):await Ke.json();case"text":return Ke.text()}const Ve=await Ke.text();try{return JSON.parse(Ve)}catch{}return Ve}function ie(Ke){return Object.keys(Ke).map(Re=>{const Ve=Ke[Re];return Array.isArray(Ve)?Ve.map(Qe=>`${encodeURIComponent(Re)}=${encodeURIComponent(Qe)}`).join("&"):`${encodeURIComponent(Re)}=${encodeURIComponent(Ve)}`}).join("&")}const fe=Ke=>{const Re=(0,M.omitBy)(Ke.params,Qe=>Qe===void 0||Qe&&Qe.length===0),Ve=ie(Re);return Ke.params&&Ve.length?`${Ke.url}?${Ve}`:Ke.url},pe=Ke=>Ke&&(Ke.credentials?Ke.credentials:Ke.withCredentials?((0,E.l)("BackendSrvRequest","withCredentials","credentials"),"include"):"same-origin");var de=e(1404),le=(Ke=>(Ke[Ke.Pending=0]="Pending",Ke[Ke.InProgress=1]="InProgress",Ke[Ke.Done=2]="Done",Ke))(le||{});class me{constructor(Re=!1){this.state={},this.queue=new n.B,this.updates=new n.B,this.add=(Ve,Qe)=>this.queue.next({id:Ve,options:Qe,state:0}),this.setInProgress=Ve=>this.queue.next({id:Ve,state:1}),this.setDone=Ve=>this.queue.next({id:Ve,state:2}),this.getUpdates=()=>this.updates.asObservable(),this.getUpdate=Ve=>{const Qe=Object.keys(Ve).filter(ze=>Ve[ze].state===1).length;return{noOfPending:Object.keys(Ve).filter(ze=>Ve[ze].state===0).length,noOfInProgress:Qe,state:Ve}},this.publishUpdate=(Ve,Qe)=>{this.printState(Ve,Qe),this.updates.next(Ve)},this.printState=(Ve,Qe)=>{if(!Qe)return;const je=Object.keys(Ve.state).reduce((ze,Ye)=>{const Ge={id:Ye,state:Ve.state[Ye].state};return ze.push(Ge),ze},[]);console.log("FetchQueue noOfStarted",Ve.noOfInProgress),console.log("FetchQueue noOfNotStarted",Ve.noOfPending),console.log("FetchQueue state",je)},this.queue.subscribe(Ve=>{const{id:Qe,state:je,options:ze}=Ve;if(this.state[Qe]||(this.state[Qe]={state:0,options:{url:""}}),je===2){delete this.state[Qe];const Ge=this.getUpdate(this.state);this.publishUpdate(Ge,Re);return}this.state[Qe].state=je,ze&&(this.state[Qe].options=ze);const Ye=this.getUpdate(this.state);this.publishUpdate(Ye,Re)})}}var De=e(95864);class Te{constructor(Re,Ve,Qe){const je=Qe?.http2Enabled?1e3:5;Re.getUpdates().pipe((0,p.p)(({noOfPending:ze})=>ze>0),(0,De.H)(({state:ze,noOfInProgress:Ye})=>{const Ge=Object.keys(ze).filter(Ee=>ze[Ee].state===le.Pending&&!(0,de.dr)(ze[Ee].options.url)).reduce((Ee,xe)=>{const ye={id:xe,options:ze[xe].options};return Ee.push(ye),Ee},[]),ce=Object.keys(ze).filter(Ee=>ze[Ee].state===le.Pending&&(0,de.dr)(ze[Ee].options.url)).reduce((Ee,xe)=>{const ye={id:xe,options:ze[xe].options};return Ee.push(ye),Ee},[]),Pe=Math.max(je-Ye-Ge.length,0),Se=ce.slice(0,Pe);return Ge.concat(Se)})).subscribe(({id:ze,options:Ye})=>{Ve.add(ze,Ye)})}}class Ne{constructor(Re,Ve){this.queue=new n.B,this.responses=new n.B,this.add=(Qe,je)=>{this.queue.next({id:Qe,options:je})},this.getResponses=Qe=>this.responses.asObservable().pipe((0,p.p)(je=>je.id===Qe)),this.queue.subscribe(Qe=>{const{id:je,options:ze}=Qe;Re.setInProgress(je),this.responses.next({id:je,observable:Ve(ze)})})}}var Ce=e(15130);const He="cancel_all_requests_request_id",ke="grafana-trace-id";class Me{constructor(Re){this.inFlightRequests=new n.B,this.HTTP_REQUEST_CANCELED=-1,this.inspectorStream=new n.B,this._tokenRotationInProgress=null,this.deviceID=null,this.dependencies={fromFetch:l.$,appEvents:C.A,contextSrv:Ce.TP,logout:()=>{Ce.TP.setLoggedOut()}},this.chunkRequestId=1,Re&&(this.dependencies={...this.dependencies,...Re}),this.noBackendCache=!1,this.internalFetch=this.internalFetch.bind(this),this.fetchQueue=new me,this.responseQueue=new Ne(this.fetchQueue,this.internalFetch),this.initGrafanaDeviceID(),new Te(this.fetchQueue,this.responseQueue,(0,S.zj)())}async initGrafanaDeviceID(){try{const Ve=await(await t.Ay.load()).get();this.deviceID=Ve.visitorId}catch(Re){console.error(Re)}}async request(Re){return await(0,r.s)(this.fetch(Re).pipe((0,f.T)(Ve=>Ve.data)))}fetch(Re){const Ve=(0,d.A)(),Qe=this.fetchQueue;return new o.c(je=>{const ze=new s.yU;return ze.add(this.responseQueue.getResponses(Ve).subscribe(Ye=>{ze.add(Ye.observable.subscribe(je))})),this.fetchQueue.add(Ve,Re),function(){Qe.setDone(Ve),ze.unsubscribe()}})}chunked(Re){const Ve=Re.requestId??`chunked-${this.chunkRequestId++}`,Qe=new AbortController,je=fe(Re),ze=H({...Re,requestId:Ve,abortSignal:Qe.signal});return new o.c(Ye=>{let Ge=!1;const ce=this.dependencies.fromFetch(je,ze).subscribe({next:Pe=>{const Se={status:Pe.status,statusText:Pe.statusText,ok:Pe.ok,headers:Pe.headers,url:Pe.url,type:Pe.type,redirected:Pe.redirected,config:Re,traceId:Pe.headers.get(ke)??void 0,data:void 0};if(!Pe.body){Ye.next(Se),Ye.complete();return}const Ee=Pe.body.getReader();async function xe(){for(;Ee&&!Ge;){if(Qe.signal.aborted){Ee.cancel(Qe.signal.reason),console.log(Ve,"signal.aborted");return}const ye=await Ee.read();Ye.next({...Se,data:ye.value}),ye.done&&(Ge=!0,console.log(Ve,"done"))}}xe().then(()=>{console.log(Ve,"complete"),Ye.complete()}).catch(ye=>{console.log(Ve,"catch",ye),Ye.error(ye)})},error:Pe=>{Ye.error(Pe)}});return function(){console.log(Ve,"unsubscribe"),Qe.abort("unsubscribe"),ce.unsubscribe()}})}internalFetch(Re){Re.requestId&&this.inFlightRequests.next(Re.requestId),Re=this.parseRequestOptions(Re);const Ve=(0,I.r)();return Ve!==null&&Ve!==""&&v.$.jwtUrlLogin&&v.$.jwtHeaderName&&(Re.headers=Re.headers??{},Re.headers[v.$.jwtHeaderName]=`${Ve}`),this.deviceID&&(Re.headers=Re.headers??{},Re.headers["X-Grafana-Device-Id"]=`${this.deviceID}
159`),this.getFromFetchStream(Re).pipe(this.handleStreamResponse(Re),this.handleStreamError(Re),this.handleStreamCancellation(Re))}resolveCancelerIfExists(Re){this.inFlightRequests.next(Re)}cancelAllInFlightRequests(){this.inFlightRequests.next(He)}async datasourceRequest(Re){return(0,r.s)(this.fetch(Re))}parseRequestOptions(Re){const Ve=this.dependencies.contextSrv.user?.orgId;return Re.retry=Re.retry??0,(0,de.Lr)(Re.url)&&(Ve&&(Re.headers=Re.headers??{},Re.headers["X-Grafana-Org-Id"]=Ve),Re.url.startsWith("/")&&(Re.url=Re.url.substring(1)),Re.headers?.Authorization&&(Re.headers["X-DS-Authorization"]=Re.headers.Authorization,delete Re.headers.Authorization),this.noBackendCache&&(Re.headers=Re.headers??{},Re.headers["X-Grafana-NoCache"]="true")),Re.hideFromInspector===void 0&&(Re.hideFromInspector=(0,de.Lr)(Re.url)&&!(0,de.dr)(Re.url)),Re}getFromFetchStream(Re){const Ve=fe(Re),Qe=H(Re);return this.dependencies.fromFetch(Ve,Qe).pipe((0,h.Z)(async je=>{const{status:ze,statusText:Ye,ok:Ge,headers:ce,url:Pe,type:Se,redirected:Ee}=je,xe=Re.responseType??(se(ce)?"json":void 0),ye=await ae(je,xe);return{status:ze,statusText:Ye,ok:Ge,data:ye,headers:ce,url:Pe,type:Se,redirected:Ee,config:Re,traceId:je.headers.get(ke)??void 0}}))}showApplicationErrorAlert(Re){}showSuccessAlert(Re){const{config:Ve}=Re;if(Ve.showSuccessAlert===!1||Ve.showSuccessAlert===void 0&&(Ve.method==="GET"||(0,de.dr)(Ve.url)||!(0,de.Lr)(Ve.url)))return;const Qe=Re.data;Qe?.message&&this.dependencies.appEvents.emit(D.r1.alertSuccess,[Qe.message])}showErrorAlert(Re,Ve){if((Ve.status<400||Ve.status>=500)&&this.dependencies.contextSrv.isSignedIn&&(this.dependencies.contextSrv.user.authenticatedBy==="apikey"||this.dependencies.contextSrv.user.authenticatedBy==="render")||Re.showErrorAlert===!1||Re.showErrorAlert===void 0&&((0,de.dr)(Re.url)||!(0,de.Lr)(Re.url)))return;let Qe="",je=Ve.data.message;je==="Unexpected error"&&Ve.message&&(je=Ve.message),je.length>80&&(Qe=je,je="Error"),Ve.status===422&&(Qe=Ve.data.message,je="Validation failed"),this.dependencies.appEvents.emit(Ve.status<500?D.r1.alertWarning:D.r1.alertError,[je,Qe,Ve.data.traceID])}processRequestError(Re,Ve){return Ve.data=Ve.data??{message:"Unexpected error"},typeof Ve.data=="string"&&(Ve.data={message:Ve.data,error:Ve.statusText,response:Ve.data}),Ve.data&&!Ve.data.message&&typeof Ve.data.error=="string"&&(Ve.data.message=Ve.data.error),Ve.data.message&&setTimeout(()=>{Ve.isHandled||this.showErrorAlert(Re,Ve)},50),this.inspectorStream.next({response:Ve,requestId:Re.requestId}),Ve}handleStreamResponse(Re){return Ve=>Ve.pipe((0,f.T)(Qe=>{if(!Qe.ok){const{status:je,statusText:ze,data:Ye}=Qe;throw{status:je,statusText:ze,data:Ye,config:Re,traceId:Qe.headers.get(ke)??void 0}}return Qe}),(0,u.M)(Qe=>{this.showSuccessAlert(Qe),this.inspectorStream.next({response:Qe,requestId:Re.requestId})}))}handleStreamError(Re){const{isSignedIn:Ve}=this.dependencies.contextSrv.user;return Qe=>Qe.pipe((0,i.l)(je=>je.pipe((0,h.Z)((ze,Ye)=>{const Ge=Ye===0&&Re.retry===0;if(ze.status===401&&(0,de.Lr)(Re.url)&&Ge&&Ve){if(ze.data?.error?.id==="ERR_TOKEN_REVOKED")return this.dependencies.appEvents.publish(new F.S8({component:V,props:{maxConcurrentSessions:ze.data?.error?.maxConcurrentSessions}})),this.dependencies.contextSrv.setRedirectToUrl(),(0,m.$)(()=>ze);let ce=this.loginPing();return(0,O.m)()&&(0,O.W)()*1e3<Date.now()&&(ce=this.rotateToken()),(0,a.H)(ce).pipe((0,x.W)(Pe=>(Pe.status===401&&this.dependencies.logout(),(0,m.$)(Pe))))}return(0,m.$)(ze)}))),(0,x.W)(je=>(0,m.$)(()=>this.processRequestError(Re,je))))}handleStreamCancellation(Re){return Ve=>Ve.pipe((0,g.Q)(this.inFlightRequests.pipe((0,p.p)(Qe=>{let je=!1;return Re&&Re.requestId&&Re.requestId===Qe&&(je=!0),Qe===He&&(je=!0),je}))),(0,c.v)(()=>({type:b.v2.Cancelled,cancelled:!0,data:null,status:this.HTTP_REQUEST_CANCELED,statusText:"Request was aborted",config:Re})))}getInspectorStream(){return this.inspectorStream}async get(Re,Ve,Qe,je){return this.request({...je,method:"GET",url:Re,params:Ve,requestId:Qe})}async delete(Re,Ve,Qe){return this.request({...Qe,method:"DELETE",url:Re,data:Ve})}async post(Re,Ve,Qe){return this.request({...Qe,method:"POST",url:Re,data:Ve})}async patch(Re,Ve,Qe){return this.request({...Qe,method:"PATCH",url:Re,data:Ve})}async put(Re,Ve,Qe){return this.request({...Qe,method:"PUT",url:Re,data:Ve})}withNoBackendCache(Re){return this.noBackendCache=!0,Re().finally(()=>{this.noBackendCache=!1})}rotateToken(){return this._tokenRotationInProgress?this._tokenRotationInProgress:(this._tokenRotationInProgress=this.fetch({url:"/api/user/auth-tokens/rotate",method:"POST",retry:1}).pipe((0,y.j)(()=>{this._tokenRotationInProgress=null}),(0,P.u)()),this._tokenRotationInProgress)}loginPing(){return this.fetch({url:"/api/login/ping",method:"GET",retry:1})}search(Re){return this.get("/api/search",Re)}getDashboardByUid(Re){return(0,E.l)("backend_srv","getDashboardByUid(uid)","getDashboardAPI().getDashboardDTO(uid)"),(0,R.n)("v1").getDashboardDTO(Re)}validateDashboard(Re){return Promise.resolve({isValid:!1,message:"dashboard validation is not supported"})}getPublicDashboardByUid(Re){return this.get(`/api/public/dashboards/${Re}`)}getFolderByUid(Re,Ve={}
159){const Qe=new URLSearchParams;return Ve.withAccessControl&&Qe.set("accesscontrol","true"),this.get(`/api/folders/${Re}?${Qe.toString()}`,void 0,void 0,{showErrorAlert:!1})}}const $e=new Me,tt=()=>$e},78731:(ee,B,e)=>{"use strict";e.d(B,{n:()=>n});var t=e(78646);const n=(o,s)=>{(0,t.x$)().addEvent({type:t.on.Performance,payload:{name:o,value:s}})},r=o=>faro?.api?.pushError(o)},25240:(ee,B,e)=>{"use strict";e.d(B,{S5:()=>s,k0:()=>r});var t=e(60379),n=e(20720);function r(m,a=!1){return new Promise(l=>{const f=document.createElement("script");f.onload=l,f.src=m,f.async=a,document.head.appendChild(f)})}const o=(0,t.h)("EchoSrv"),s=o.logger;(0,n.h)("echo",void 0,o)},67020:(ee,B,e)=>{"use strict";e.d(B,{A:()=>l});var t=e(2543),n=e.n(t),r=e(68143),o=e(65642),s=e(29043);class m{constructor(){}addDashboardImpression(h){const u=this.impressionKey();let i=[];s.A.exists(u)&&(i=JSON.parse(s.A.get(u)),(0,t.isArray)(i)||(i=[])),i=i.filter(x=>h!==x),i.unshift(h),i.length>50&&i.pop(),s.A.set(u,JSON.stringify(i))}async convertToUIDs(){let h=this.getImpressions();const u=(0,t.filter)(h,x=>(0,t.isNumber)(x));if(!u.length)return;const i=await(0,r.AI)().get(`/api/dashboards/ids/${u.join(",")}`);s.A.set(this.impressionKey(),JSON.stringify([...(0,t.filter)(h,x=>(0,t.isString)(x)),...i]))}getImpressions(){const h=s.A.get(this.impressionKey())||"[]";return JSON.parse(h)}async getDashboardOpened(){try{await this.convertToUIDs()}catch{}return(0,t.filter)(this.getImpressions(),u=>(0,t.isString)(u))}impressionKey(){return"dashboard_impressions-"+o.Ay.bootData.user.orgId}}const l=new m},12469:(ee,B,e)=>{"use strict";e.d(B,{R:()=>P});let t={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},n={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},r={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},o={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},s=null;for(let d=1;d<20;++d)t[111+d]="f"+d;for(let d=0;d<=9;++d)t[d+96]=d.toString();function m(d){if(d.type==="keypress"){let D=String.fromCharCode(d.which);return d.shiftKey||(D=D.toLowerCase()),D}return t[d.which]?t[d.which]:n[d.which]?n[d.which]:String.fromCharCode(d.which).toLowerCase()}function a(d,D){return d.sort().join(",")===D.sort().join(",")}function l(d){let D=[];return d.shiftKey&&D.push("shift"),d.altKey&&D.push("alt"),d.ctrlKey&&D.push("ctrl"),d.metaKey&&D.push("meta"),D}function f(d){if(d.preventDefault){d.preventDefault();return}d.returnValue=!1}function h(d){if(d.stopPropagation){d.stopPropagation();return}d.cancelBubble=!0}function u(d){return d==="shift"||d==="ctrl"||d==="alt"||d==="meta"}function i(){if(!s){s={};for(let d in t){const D=parseInt(d,10);D>95&&D<112||t.hasOwnProperty(d)&&(s[t[d]]=d)}}return s}function x(d,D,b){return b||(b=i()[d]?"keydown":"keypress"),b==="keypress"&&D.length&&(b="keydown"),b}function g(d){return d==="+"?["+"]:(d=d.replace(/\+{2}/g,"+plus"),d.split("+"))}function p(d,D){let b,E,v,C=[];for(b=g(d),v=0;v<b.length;++v)E=b[v],o[E]&&(E=o[E]),D&&D!=="keypress"&&r[E]&&(E=r[E],C.push("shift")),u(E)&&C.push(E);if(!E)throw new Error("Unable to get key");return D=x(E,C,D),{key:E,modifiers:C,action:D}}function c(d,D){return d===null||d===document?!1:d===D?!0:c(d.parentNode,D)}class y{constructor(D){this._callbacks={},this._directMap={},this._sequenceLevels={},this._resetTimer=void 0,this._ignoreNextKeyup=!1,this._ignoreNextKeypress=!1,this._nextExpectedAction=!1,this._globalCallbacks={},this._resetSequences=b=>{b=b||{};let E=!1,v;for(v in this._sequenceLevels){if(b[v]){E=!0;continue}this._sequenceLevels[v]=0}E||(this._nextExpectedAction=!1)},this._getMatches=(b,E,v,C,S,O)=>{let I,R,T=[],L=v.type;if(!this._callbacks[b])return[];for(L==="keyup"&&u(b)&&(E=[b]),I=0;I<this._callbacks[b].length;++I)if(R=this._callbacks[b][I],!(!C&&R.seq&&this._sequenceLevels[R.seq]!==R.level)&&L===R.action&&(L==="keypress"&&!v.metaKey&&!v.ctrlKey||a(E,R.modifiers))){let K=!C&&R.combo===S,A=C&&R.seq===C&&R.level===O;(K||A)&&this._callbacks[b].splice(I,1),T.push(R)}return T},this._fireCallback=(b,E,v,C)=>{const S=E.target||E.srcElement;S&&S instanceof HTMLElement&&this.stopCallback(E,S,v,C)||b(E,v)===!1&&(f(E),h(E))},this._handleKey=(b,E,v)=>{let C=this._getMatches(b,E,v),S,O={},I=0,R=!1;for(S=0;S<C.length;++S)C[S].seq&&(I=Math.max(I,C[S].level??0));for(S=0;S<C.length;++S){const L=C[S].seq;if(L){if(C[S].level!==I)continue;R=!0,O[L]=1,this._fireCallback(C[S].callback,v,C[S].combo,L);const K=L.lastIndexOf(b),A=L.slice(0,K);for(const[W,N]of Object.entries(this._sequenceLevels))N>0&&W.startsWith(A)&&(O[W]=1);continue}R||this._fireCallback(C[S].callback,v,C[S].combo)}for(const L of this._callbacks[b]??[])L.action===v.type&&L.seq&&L.level===0&&(O[L.seq]=1);
159let T=v.type==="keypress"&&this._ignoreNextKeypress;v.type===this._nextExpectedAction&&!u(b)&&!T&&this._resetSequences(O),this._ignoreNextKeypress=R&&v.type==="keydown"},this._handleKeyEvent=b=>{if(!(b instanceof KeyboardEvent))throw new Error("Didn't get a KeyboardEvent");const E=b;if(E.repeat)return;typeof E.which!="number"&&(E.which=E.keyCode);let v=m(E);if(v){if(E.type==="keyup"&&this._ignoreNextKeyup===v){this._ignoreNextKeyup=!1;return}this.handleKey(v,l(E),E)}},this._resetSequenceTimer=()=>{clearTimeout(this._resetTimer),this._resetTimer=setTimeout(this._resetSequences,1e3)},this._bindSequence=(b,E,v,C)=>{this._sequenceLevels[b]=0;const S=I=>()=>{this._nextExpectedAction=I,++this._sequenceLevels[b],this._resetSequenceTimer()},O=I=>{this._fireCallback(v,I,b),C!=="keyup"&&(this._ignoreNextKeyup=m(I)),this._resetSequenceTimer()};for(let I=0;I<E.length;++I){let T=I+1===E.length?O:S(C||p(E[I+1]).action);this._bindSingle(E[I],T,C,b,I)}},this._bindSingle=(b,E,v,C,S)=>{this._directMap[b+":"+v]=E,b=b.replace(/\s+/g," ");let O=b.split(" "),I;if(O.length>1){this._bindSequence(b,O,E,v);return}I=p(b,v),this._callbacks[I.key]=this._callbacks[I.key]||[];const R={type:I.action,metaKey:!1,ctrlKey:!1};this._getMatches(I.key,I.modifiers,R,C,b,S);const T={callback:E,modifiers:I.modifiers,action:I.action,seq:C,level:S,combo:b};this._callbacks[I.key][C?"unshift":"push"](T)},this._bindMultiple=(b,E,v)=>{for(let C=0;C<b.length;++C)this._bindSingle(b[C],E,v)},this.bind=(b,E,v)=>(b=b instanceof Array?b:[b],this._bindMultiple(b,E,v),self),this.unbind=(b,E)=>this.bind(b,function(){},E),this.bindGlobal=(b,E,v)=>{if(this.bind(b,E,v),b instanceof Array){for(let C=0;C<b.length;C++)this._globalCallbacks[b[C]]=!0;return}this._globalCallbacks[b]=!0},this.unbindGlobal=(b,E)=>{if(this.unbind(b,E),b instanceof Array){for(let v=0;v<b.length;v++)this._globalCallbacks[b[v]]=!1;return}this._globalCallbacks[b]=!1},this.trigger=(b,E)=>{let v=this;return v._directMap[b+":"+E]&&v._directMap[b+":"+E]({},b),v},this.reset=()=>(this._callbacks={},this._directMap={},this),this.stopCallback=(b,E,v,C)=>{if(this._globalCallbacks[v]||C&&this._globalCallbacks[C]||(" "+E.className+" ").indexOf(" mousetrap ")>-1||c(E,this.target))return!1;if("composedPath"in b&&typeof b.composedPath=="function"){let S=b.composedPath()[0];S!==b.target&&S instanceof HTMLElement&&(E=S)}return!!(E.tagName==="INPUT"||E.tagName==="SELECT"||E.tagName==="TEXTAREA"||"isContentEditable"in E&&E.isContentEditable)},this.handleKey=(...b)=>this._handleKey(...b),this.addKeycodes=b=>{for(let E in b)b.hasOwnProperty(E)&&(t[E]=b[E]);s=null},this.target=D,this.target.addEventListener("keypress",b=>{b instanceof KeyboardEvent&&this._handleKeyEvent(b)}),this.target.addEventListener("keydown",b=>{b instanceof KeyboardEvent&&this._handleKeyEvent(b)}),this.target.addEventListener("keyup",b=>{b instanceof KeyboardEvent&&this._handleKeyEvent(b)})}}const P=new y(document)},44410:(ee,B,e)=>{"use strict";e.d(B,{K:()=>a,O:()=>l});var t=e(47070),n=e(75234),r=e(45229),o=e(65642),s=e(73427),m=e(69738);async function a(f,h){const u=o.$W.theme2,i=(0,t.g)(f);if(r.A.publish(new n.E8(i)),u.colors.mode!==i.colors.mode){const p=document.createElement("link");p.rel="stylesheet",p.href=o.$W.bootData.assets[i.colors.mode],p.onload=()=>{const c=document.getElementsByTagName("link");for(let y=0;y<c.length;y++){const P=c[y];P.href&&P.href.includes(`build/grafana.${u.colors.mode}`)&&P.remove()}},document.head.insertBefore(p,document.head.firstChild)}if(h||!s.TP.isSignedIn)return;const x=new m.W("user"),g=await x.load();await x.update({...g,theme:f})}async function l(f){const h=o.$W.theme2;a(h.isDark?"light":"dark",f)}},29043:(ee,B,e)=>{"use strict";e.d(B,{A:()=>r});var t=e(78012);const r=new t.i},81871:(ee,B,e)=>{"use strict";e.d(B,{F:()=>t});function t(n={}){return{...n,accesscontrol:!0}}},49344:(ee,B,e)=>{"use strict";e.d(B,{b:()=>t});const t=(n,r,o)=>(n.splice(o,0,n.splice(r,1)[0]),n)},9628:(ee,B,e)=>{"use strict";e.d(B,{gn:()=>r});function t(){const o=navigator.userAgent.indexOf("MSIE")>-1,s=navigator.userAgent.indexOf("Edge/")>-1||navigator.userAgent.indexOf("Edg/")>-1,m=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,a=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),l=/Edge\/([0-9.]+)/.exec(navigator.userAgent);return o&&parseFloat(/Trident\/([0-9.]+)/.exec(navigator.userAgent)[1])<=7||s&&(l&&parseFloat(l[1])<=16||parseFloat(/Edg\/([0-9.]+)/.exec(navigator.userAgent)[1])<=16)||m&&parseFloat(/Firefox\/([0-9.]+)/.exec(navigator.userAgent)[1])<=64?!1:!(a&&parseFloat(/Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1])<=54)}function n(){return/(iPhone|iPad|Mac)/.test(navigator.platform)}function r(){return n()?"\u2318":"ctrl"}},68220:(ee,B,e)=>{"use strict";e.d(B,{TS:()=>r});class t{_linkTo(a,l){l<=0&&a.inputEdges.push(this),l>=0&&a.outputEdges.push(this),a.edges.push(this)}link(a,l){if(!a)throw Error("inputNode is required");if(!l)throw Error("outputNode is required");return this.unlink(),this.inputNode=a,this.outputNode=l,this._linkTo(a,1),this._linkTo(l,-1),this}unlink(){let a;const l=this.inputNode,f=this.outputNode;l&&f&&(a=l.edges.indexOf(this),a>-1&&l.edges.splice(a,1),a=f.edges.indexOf(this),a>-1&&f.edges.splice(a,1),a=l.outputEdges.indexOf(this),a>-1&&l.outputEdges.splice(a,1),a=f.inputEdges.indexOf(this),a>-1&&f.inputEdges.splice(a,1))}}class n{constructor(a){this.name=a,this.edges=[],this.inputEdges=[],this.outputEdges=[]}getEdgeFrom(a){return a?typeof a=="object"?this.inputEdges.find(l=>l.inputNode?.name===a.name):this.inputEdges.find(l=>l.inputNode?.name===a):null}getEdgeTo(a){return a?typeof a=="object"?this.outputEdges.find(l=>l.outputNode?.name===a.name):this.outputEdges.find(l=>l.outputNode?.name===a):null}getOptimizedInputEdges(){const a=[];
159return this.inputEdges.forEach(l=>{l.inputNode?.inputEdges.map(h=>h.inputNode)?.forEach(h=>{const u=h?.getEdgeTo(this.name);u&&a.push(u)})}),this.inputEdges.filter(l=>a.indexOf(l)===-1)}}class r{constructor(){this.nodes={}}createNode(a){const l=new n(a);return this.nodes[a]=l,l}createNodes(a){const l=[];return a.forEach(f=>{l.push(this.createNode(f))}),l}link(a,l){let f=[],h=[];const u=[],i=[];a instanceof Array?f=a:f=[a],l instanceof Array?h=l:h=[l];for(let g=0;g<f.length;g++){const p=f[g];if(typeof p=="string"){const c=this.getNode(p);if(!c)throw Error(`cannot link input node named ${p} since it doesn't exist in graph`);u.push(c)}else u.push(p)}for(let g=0;g<h.length;g++){const p=h[g];if(typeof p=="string"){const c=this.getNode(p);if(!c)throw Error(`cannot link output node named ${p} since it doesn't exist in graph`);i.push(c)}else i.push(p)}const x=[];return u.forEach(g=>{i.forEach(p=>{if(this.willCreateCycle(g,p))throw Error(`cannot link ${g.name} to ${p.name} since it would create a cycle`);x.push(this.createEdge().link(g,p))})}),x}descendants(a){if(!a.length)return new Set;const l=new Set(s(a)?a.map(f=>this.nodes[f]).filter(f=>f!==void 0):a);return this.descendantsRecursive(l)}descendantsRecursive(a,l=new Set){for(const f of a){const h=new Set;for(const{inputNode:u}of f.inputEdges)u&&!l.has(u)&&(l.add(u),h.add(u));this.descendantsRecursive(h,l)}return l}willCreateCycle(a,l){if(a===l)return!0;const f=new Set,h=[l];for(;h.length;){const u=h.pop();if(u===a)return!0;f.add(u);for(const i of u.outputEdges){const x=i.outputNode;x&&!f.has(x)&&h.push(x)}}return!1}createEdge(){return new t}getNode(a){return this.nodes[a]}}const o=m=>{Object.keys(m.nodes).forEach(a=>{const l=m.nodes[a];let f=l.outputEdges.map(u=>u.outputNode?.name).join(", ");f||(f="<none>");let h=l.inputEdges.map(u=>u.inputNode?.name).join(", ");h||(h="<none>"),console.log(`${l.name}: 160 - links to: ${f} 161 - links from: ${h}`)})};function s(m){return m.length>0&&typeof m[0]=="string"}},47797:(ee,B,e)=>{"use strict";e.d(B,{do:()=>r,q6:()=>n,rE:()=>o});var t=e(68143);function n(s){if(typeof s=="string")return s;if(s){if(s instanceof Error)return s.message;if((0,t.NF)(s)){if(s.data&&s.data.message)return s.data.message;if(s.statusText)return s.statusText}else if(s.hasOwnProperty("message"))return s.message}return JSON.stringify(s)}function r(s){if(typeof s!="string"&&s){if(s instanceof Error)return;if((0,t.NF)(s))return s.status;if(s.hasOwnProperty("status"))return s.status}}function o(s){if(typeof s!="string"&&s){if(s instanceof Error)return;if((0,t.NF)(s))return s.data?.messageId;if(s.hasOwnProperty("messageId"))return s.messageId}}},62635:(ee,B,e)=>{"use strict";e.d(B,{HQ:()=>d,Ll:()=>R,MA:()=>O,WP:()=>p,Xe:()=>E,_u:()=>j,bI:()=>C,dY:()=>W,di:()=>L,dr:()=>D,eF:()=>T,o$:()=>b,uE:()=>w,uJ:()=>U,uq:()=>v,w4:()=>S,zT:()=>A,zq:()=>N});var t=e(43561),n=e(24726),r=e(739),o=e(5556),s=e(92138),m=e(1906),a=e(22592),l=e(39796),f=e(17548),h=e(78282),u=e(90811),i=e(29043),x=e(4651);const g={dedupStrategy:r.fY.none},p="0123456789abcdefghijklmnopqrstuvwxyz",c=(0,t.d_)(p,3),y="grafana.explore.datasource",P=F=>`${y}.${F}`,d=F=>i.A.getObject(P(F)),D=(F,M)=>i.A.setObject(P(F),M);function b(){for(;;){const F=c(3);if(!/^\d+$/.test(F))return F}}async function E(F){const{queries:M,dsRef:H,timeRange:_,scopedVars:Z,adhocFilters:ne}=F,te=(await Promise.allSettled(M.filter(Q=>Q.datasource?.uid!==x.Uj).map(async Q=>{const J=await(0,h.l)().get(Q.datasource||H);return{...J.interpolateVariablesInQueries?.([Q],Z??{},ne)[0]||Q,...!J.meta.mixed&&{datasource:J.getRef()}}}))).filter(Q=>Q.status==="fulfilled").map(Q=>Q.value),Y=JSON.stringify({[b()]:{range:(0,o.sQ)(_.raw),queries:te,datasource:H?.uid}});return s.I.assureBaseUrl(o.kM.renderUrl("/explore",{panes:Y,schemaVersion:1}))}function v(F){return`explore_${F}`}function C(F,M,H,_,Z,ne,te){const Y=Number.parseInt(F,36),{interval:Q,intervalMs:J}=V(_,H.minInterval,H.maxDataPoints),q={app:m.Jk.Explore,timezone:ne||a.lE,startTime:Date.now(),interval:Q,intervalMs:J,panelId:Y,targets:M,range:_,requestId:v(F),rangeRaw:_.raw,scopedVars:{__interval:{text:Q,value:Q},__interval_ms:{text:J,value:J},...te},maxDataPoints:H.maxDataPoints,liveStreaming:H.liveStreaming,skipQueryCache:!0};return{queries:M,request:q,scanning:Z,id:I(),done:!1}}const S=({key:F,...M})=>M,O=(F,M)=>
161{if(F==null)return"";try{return JSON.stringify(F,null,M)}catch(H){console.error(H)}return""};function I(F=0){return`Q-${(0,n.A)()}-${F}`}async function R(F,M=0,H){let _,Z,ne;return H?Z=H:F.length>0&&F[F.length-1].datasource?Z=F[F.length-1].datasource:(_=await(0,h.l)().get(),ne=_.getDefaultQuery?.(m.Jk.Explore),Z=_.getRef()),_||(_=await(0,h.l)().get(Z),ne=_.getDefaultQuery?.(m.Jk.Explore)),{...ne,refId:(0,l.M)(F),key:I(M),datasource:Z}}const T=(F,M,H=0)=>{const _=I(H),Z=F.refId||(0,l.M)(M);return{...F,refId:Z,key:_}};async function L(F,M){if(F&&typeof F=="object"&&F.length>0){const H=[];for(let _=0;_<F.length;_++){const Z=F[_],ne=I(_);let te=Z.refId;te||(te=(0,l.M)(H));let Y=!0;if(Z.datasource)try{await(0,h.l)().get(Z.datasource.uid)}catch{console.error("One of the queries has a datasource that is no longer available and was removed."),Y=!1}Y&&H.push({...Z,refId:te,key:ne})}return H}try{const H=M??(await(0,h.l)().get()).getRef();return[await R(F??[],void 0,H)]}catch{return[]}}const K=["refId","key","context","datasource"];function A(F){return F&&F.some(M=>Object.entries(M).filter(([_,Z])=>K.indexOf(_)===-1).filter(([_,Z])=>Z).length>0)}const W=F=>F.reduce((H,_,Z)=>{const ne=_.datasource?.uid||_.key;return H.concat(`${ne}-${Z}`)},[]),N=(F,M,H)=>f.convertRawToRange(M,F,H),w=F=>u.cC.isLive(F)?r.uH.Ascending:r.uH.Descending,j=F=>{F&&F.unsubscribe()};function V(F,M,H){return H?f.calculateInterval(F,H,M):{interval:"1s",intervalMs:1e3}}const U=F=>{if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(F);else{const M=document.createElement("textarea");M.value=F,document.body.appendChild(M),M.select(),document.execCommand("copy"),document.body.removeChild(M)}}},77197:(ee,B,e)=>{"use strict";e.d(B,{A:()=>a});var t=e(37615),n=e(8934),r=e(17548),o=e(55386);const m={valueFormats:{},intervalRegex:/(\d+(?:\.\d+)?)(ms|[Mwdhmsy])/,intervalsInSeconds:{y:31536e3,M:2592e3,w:604800,d:86400,h:3600,m:60,s:1,ms:.001},regexEscape:l=>((0,t.l)("kbn.ts","kbn.regexEscape()","escapeRegex from @grafana/data"),(0,n.$f)(l)),roundInterval:l=>((0,t.l)("kbn.ts","kbn.roundInterval()","@grafana/data"),r.roundInterval(l)),secondsToHms:l=>((0,t.l)("kbn.ts","kbn.secondsToHms()","@grafana/data"),r.secondsToHms(l)),secondsToHhmmss:l=>{const f=[],h=Math.floor(l/3600),u=Math.floor(l%3600/60),i=Math.floor(l%3600%60);return h>9?f.push(""+h):f.push("0"+h),u>9?f.push(""+u):f.push("0"+u),i>9?f.push(""+i):f.push("0"+i),f.join(":")},toPercent:(l,f)=>Math.floor(l/f*1e4)/100+"%",addSlashes:l=>l.replace(/[\'\"\\0]/g,"\\$&"),describeInterval:l=>((0,t.l)("kbn.ts","kbn.describeInterval()","@grafana/data"),r.describeInterval(l)),intervalToSeconds:l=>((0,t.l)("kbn.ts","rangeUtil.intervalToSeconds()","@grafana/data"),r.intervalToSeconds(l)),intervalToMs:l=>((0,t.l)("kbn.ts","rangeUtil.intervalToMs()","@grafana/data"),r.intervalToMs(l)),calculateInterval:(l,f,h)=>((0,t.l)("kbn.ts","kbn.calculateInterval()","@grafana/data"),r.calculateInterval(l,f,h)),queryColorDot:(l,f)=>'<div class="icon-circle" style="'+["display:inline-block","color:"+l,"font-size:"+f+"px"].join(";")+'"></div>',slugifyForUrl:l=>l.toLowerCase().replace(/[^\w ]+/g,"").replace(/ +/g,"-"),stringToJsRegex:l=>((0,t.l)("kbn.ts","kbn.stringToJsRegex()","@grafana/data"),(0,n.dO)(l)),toFixed:(l,f)=>{if(l===null)return"";const h=f?Math.pow(10,Math.max(0,f)):1,u=String(Math.round(l*h)/h);if(u.indexOf("e")!==-1||l===0)return u;if(f!=null){const i=u.indexOf("."),x=i===-1?0:u.length-i-1;if(x<f)return(x?u:u+".")+String(h).slice(1,f-x+1)}return u},toFixedScaled:(l,f,h,u,i)=>h===null?m.toFixed(l,f)+i:m.toFixed(l,h+u)+i,roundValue:(l,f)=>{if(l===null)return null;const h=Math.pow(10,f),u=(h*l).toFixed(f);return Math.round(parseFloat(u))/h},getUnitFormats:o.Ke};typeof Proxy<"u"?m.valueFormats=new Proxy(m.valueFormats,{get(l,f,h){if(typeof f!="string")throw{message:`Value format ${String(f)} is not a string`};const u=(0,o.j_)(f);return u?(i,x,g,p)=>(0,o.cN)(u(i,x,g,p?"utc":"browser")):Reflect.get(l,f,h)}}):m.valueFormats=(0,o.uH)();const a=m},60017:(ee,B,e)=>{"use strict";e.d(B,{j:()=>n,z:()=>r});var t=e(78731);function n(o){if(!(!performance||!performance.mark))try{performance.mark(`${o}_started`)}catch(s){console.error(`[Metrics] Failed to startMeasure ${o}`,s)}}function r(o){if(!(!performance||!performance.mark))try{const s=`${o}_started`,m=`${o}_completed`,a=`${o}_measured`;performance.mark(m);const l=performance.measure(a,s,m);
161return(0,t.n)(`${o}_ms`,l.duration),performance.clearMarks(s),performance.clearMarks(m),performance.clearMeasures(a),l}catch(s){console.error(`[Metrics] Failed to stopMeasure ${o}`,s);return}}},18832:(ee,B,e)=>{"use strict";e.d(B,{C:()=>r,o:()=>o});var t=e(43173),n=e(56840);function r(s){switch(s){case"home":return(0,n.t)("nav.home.title","Home");case"home-setup-guide":return(0,n.t)("nav.setup-guide.title","Setup guide");case"new":return(0,n.t)("nav.new.title","New");case"create":return(0,n.t)("nav.create.title","Create");case"create-dashboard":return(0,n.t)("nav.create-dashboard.title","Dashboard");case"folder":return(0,n.t)("nav.create-folder.title","Folder");case"import":return(0,n.t)("nav.create-import.title","Import dashboard");case"alert":return(0,n.t)("nav.create-alert.title","New alert rule");case"bookmarks":return(0,n.t)("nav.bookmarks.title","Bookmarks");case"bookmarks-empty":return(0,n.t)("nav.bookmarks-empty.title","Bookmark pages for them to appear here");case"starred":return(0,n.t)("nav.starred.title","Starred");case"starred-empty":return(0,n.t)("nav.starred-empty.title","Your starred dashboards will appear here");case"dashboards":return(0,n.t)("nav.dashboards.title","Dashboards");case"dashboards/browse":return(0,n.t)("nav.dashboards.title","Dashboards");case"dashboards/playlists":return(0,n.t)("nav.playlists.title","Playlists");case"dashboards/snapshots":return(0,n.t)("nav.snapshots.title","Snapshots");case"dashboards/library-panels":return(0,n.t)("nav.library-panels.title","Library panels");case"reports":return(0,n.t)("nav.reporting.title","Reporting");case"dashboards/public":return t.$.featureToggles.newDashboardSharingComponent?(0,n.t)("nav.shared-dashboard.title","Shared dashboards"):(0,n.t)("nav.public.title","Public dashboards");case"dashboards/recently-deleted":return(0,n.t)("nav.recently-deleted.title","Recently deleted");case"dashboards/new":return(0,n.t)("nav.new-dashboard.title","New dashboard");case"dashboards/folder/new":return(0,n.t)("nav.new-folder.title","New folder");case"dashboards/import":return(0,n.t)("nav.create-import.title","Import dashboard");case"scenes":return(0,n.t)("nav.scenes.title","Scenes");case"explore":return(0,n.t)("nav.explore.title","Explore");case"drilldown":return(0,n.t)("nav.drilldown.title","Drilldown");case"alerting":return(0,n.t)("nav.alerting.title","Alerting");case"plugin-page-grafana-oncall-app":return(0,n.t)("nav.oncall.title","OnCall");case"alerting-legacy":return(0,n.t)("nav.alerting-legacy.title","Alerting (legacy)");case"alerting-upgrade":return(0,n.t)("nav.alerting-upgrade.title","Alerting upgrade");case"alert-home":return(0,n.t)("nav.alerting-home.title","Home");case"alert-list":return(0,n.t)("nav.alerting-list.title","Alert rules");case"alert-list-legacy":return(0,n.t)("nav.alert-list-legacy.title","Alert rules");case"receivers":return(0,n.t)("nav.alerting-receivers.title","Contact points");case"am-routes":return(0,n.t)("nav.alerting-am-routes.title","Notification policies");case"channels":return(0,n.t)("nav.alerting-channels.title","Notification channels");case"silences":return(0,n.t)("nav.alerting-silences.title","Silences");case"groups":return(0,n.t)("nav.alerting-groups.title","Active notifications");case"alerting-admin":return(0,n.t)("nav.alerting-admin.title","Settings");case"alerts/recently-deleted":return(0,n.t)("nav.alerts-recently-deleted.title","Recently deleted");case"cfg":return(0,n.t)("nav.config.title","Administration");case"cfg/general":return(0,n.t)("nav.config-general.title","General");case"cfg/plugins":return(0,n.t)("nav.config-plugins.title","Plugins and data");case"cfg/access":return(0,n.t)("nav.config-access.title","Users and access");case"datasources":return(0,n.t)("nav.datasources.title","Data sources");case"authentication":return(0,n.t)("nav.authentication.title","Authentication");
161case"licensing":return(0,n.t)("nav.statistics-and-licensing.title","Statistics and licensing");case"recordedQueries":return(0,n.t)("nav.recorded-queries.title","Recorded queries");case"correlations":return(0,n.t)("nav.correlations.title","Correlations");case"users":return(0,n.t)("nav.users.title","Users");case"teams":return(0,n.t)("nav.teams.title","Teams");case"plugins":return(0,n.t)("nav.plugins.title","Plugins");case"org-settings":return(0,n.t)("nav.org-settings.title","Default preferences");case"apikeys":return(0,n.t)("nav.api-keys.title","API keys");case"serviceaccounts":return(0,n.t)("nav.service-accounts.title","Service accounts");case"admin":return(0,n.t)("nav.admin.title","Server admin");case"support-bundles":return(0,n.t)("nav.support-bundles.title","Support bundles");case"global-users":return(0,n.t)("nav.global-users.title","Users");case"global-orgs":return(0,n.t)("nav.global-orgs.title","Organizations");case"server-settings":return(0,n.t)("nav.server-settings.title","Settings");case"storage":return(0,n.t)("nav.storage.title","Storage");case"migrate-to-cloud":return(0,n.t)("nav.migrate-to-cloud.title","Migrate to Grafana Cloud");case"upgrading":return(0,n.t)("nav.upgrading.title","Stats and license");case"monitoring":return(0,n.t)("nav.monitoring.title","Observability");case"infrastructure":return(0,n.t)("nav.infrastructure.title","Infrastructure");case"frontend":return(0,n.t)("nav.frontend.title","Frontend");case"apps":return(0,n.t)("nav.apps.title","More apps");case"alerts-and-incidents":return(0,n.t)("nav.alerts-and-incidents.title","Alerts & IRM");case"testing-and-synthetics":return(0,n.t)("nav.testing-and-synthetics.title","Testing & synthetics");case"plugin-page-grafana-incident-app":return(0,n.t)("nav.incidents.title","Incident");case"plugin-page-grafana-ml-app":return(0,n.t)("nav.machine-learning.title","Machine learning");case"plugin-page-grafana-slo-app":return(0,n.t)("nav.slo.title","SLO");case"plugin-page-k6-app":return(0,n.t)("nav.k6.title","Performance");case"plugin-page-grafana-k8s-app":return(0,n.t)("nav.kubernetes.title","Kubernetes");case"plugin-page-grafana-dbo11y-app":return(0,n.t)("nav.databases.title","Databases");case"plugin-page-grafana-app-observability-app":return(0,n.t)("nav.application.title","Application");case"plugin-page-grafana-pyroscope-app":return(0,n.t)("nav.profiles.title","Profiles");case"plugin-page-grafana-kowalski-app":return(0,n.t)("nav.frontend-app.title","Frontend");case"plugin-page-grafana-synthetic-monitoring-app":return(0,n.t)("nav.synthetics.title","Synthetics");case"help":return(0,n.t)("nav.help.title","Help");case"profile/settings":return(0,n.t)("nav.profile/settings.title","Profile");case"profile/notifications":return(0,n.t)("nav.profile/notifications.title","Notification history");case"profile/password":return(0,n.t)("nav.profile/password.title","Change password");case"sign-out":return(0,n.t)("nav.sign-out.title","Sign out");case"search":return(0,n.t)("nav.search-dashboards.title","Search dashboards");case"connections":return(0,n.t)("nav.connections.title","Connections");case"connections-add-new-connection":return(0,n.t)("nav.add-new-connections.title","Add new connection");case"standalone-plugin-page-/connections/collector":return(0,n.t)("nav.collector.title","Collector");case"connections-datasources":return(0,n.t)("nav.data-sources.title","Data sources");case"standalone-plugin-page-/connections/infrastructure":return(0,n.t)("nav.integrations.title","Integrations");case"standalone-plugin-page-/connections/connect-data":return(0,n.t)("nav.connect-data.title","Connect data");case"standalone-plugin-page-/connections/private-data-source-connections":return(0,n.t)("nav.private-data-source-connections.title","Private data source connect");case"plugin-page-grafana-detect-app":return(0,n.t)("nav.detect.title","Detect");case"plugin-page-grafana-quaderno-app":return(0,n.t)("nav.grafana-quaderno.title","Grafana Quaderno");default:return}}function o(s){switch(s){case"dashboards":return(0,n.t)("nav.dashboards.subtitle","Create and manage dashboards to visualize your data");case"dashboards/browse":return(0,n.t)("nav.dashboards.subtitle","Create and manage dashboards to visualize your data");case"manage-folder":return(0,n.t)("nav.manage-folder.subtitle","Manage folder dashboards and permissions");case"dashboards/playlists":return(0,n.t)("nav.playlists.subtitle","Groups of dashboards that are displayed in a sequence");
161case"dashboards/snapshots":return(0,n.t)("nav.snapshots.subtitle","Interactive, publically available, point-in-time representations of dashboards and panels");case"dashboards/public":return t.$.featureToggles.newDashboardSharingComponent?(0,n.t)("nav.shared-dashboard.subtitle","Manage your organization's externally shared dashboards"):void 0;case"dashboards/library-panels":return(0,n.t)("nav.library-panels.subtitle","Reusable panels that can be added to multiple dashboards");case"dashboards/recently-deleted":return(0,n.t)("nav.recently-deleted.subtitle","Any items listed here for more than 30 days will be automatically deleted.");case"alerting":return(0,n.t)("nav.alerting.subtitle","Learn about problems in your systems moments after they occur");case"alerting-upgrade":return(0,n.t)("nav.alerting-upgrade.subtitle","Upgrade your existing legacy alerts and notification channels to the new Grafana Alerting");case"alerting-admin":return(0,n.t)("nav.alerting-admin.subtitle","Manage Alertmanager configurations and enable receiving Grafana-managed alerts");case"alert-list":return(0,n.t)("nav.alerting-list.subtitle","Rules that determine whether an alert will fire");case"receivers":return(0,n.t)("nav.alerting-receivers.subtitle","Choose how to notify your contact points when an alert instance fires");case"am-routes":return(0,n.t)("nav.alerting-am-routes.subtitle","Determine how alerts are routed to contact points");case"silences":return(0,n.t)("nav.alerting-silences.subtitle","Stop notifications from one or more alerting rules");case"groups":return(0,n.t)("nav.alerting-groups.subtitle","See grouped alerts with active notifications");case"alerts/recently-deleted":return(0,n.t)("nav.alerts-recently-deleted.subtitle","See recently deleted alert rules");case"datasources":return(0,n.t)("nav.datasources.subtitle","Add and configure data sources");case"correlations":return(0,n.t)("nav.correlations.subtitle","Add and configure correlations");case"users":return(0,n.t)("nav.users.subtitle","Invite and assign roles to users");case"teams":return(0,n.t)("nav.teams.subtitle","Groups of users that have common dashboard and permission needs");case"plugins":return(0,n.t)("nav.plugins.subtitle","Extend the Grafana experience with plugins");case"org-settings":return(0,n.t)("nav.org-settings.subtitle","Manage preferences across an organization");case"apikeys":return(0,n.t)("nav.api-keys.subtitle","Manage and create API keys that are used to interact with Grafana HTTP APIs");case"serviceaccounts":return(0,n.t)("nav.service-accounts.subtitle","Use service accounts to run automated workloads in Grafana");case"groupsync":return(0,n.t)("nav.groupsync.subtitle","Manage mappings of Identity Provider groups to Grafana Roles");case"global-users":return(0,n.t)("nav.global-users.subtitle","Manage users in Grafana");case"global-orgs":return(0,n.t)("nav.global-orgs.subtitle","Isolated instances of Grafana running on the same server");case"server-settings":return(0,n.t)("nav.server-settings.subtitle","View the settings defined in your Grafana config");case"storage":return(0,n.t)("nav.storage.subtitle","Manage file storage");case"migrate-to-cloud":return(0,n.t)("nav.migrate-to-cloud.subtitle","Copy resources from your self-managed installation to a cloud stack");case"support-bundles":return(0,n.t)("nav.support-bundles.subtitle","Download support bundles");case"admin":return(0,n.t)("nav.admin.subtitle","Manage server-wide settings and access to resources such as organizations, users, and licenses");case"cfg/general":return(0,n.t)("nav.config-general.subtitle","Manage default preferences and settings across Grafana");case"cfg/plugins":return(0,n.t)("nav.config-plugins.subtitle","Install plugins and define the relationships between data");case"cfg/access":return(0,n.t)("nav.config-access.subtitle","Configure access for individual users, teams, and service accounts");case"apps":return(0,n.t)("nav.apps.subtitle","App plugins that extend the Grafana experience");case"monitoring":return(0,n.t)("nav.monitoring.subtitle","Out-of-the-box observability solutions");
161case"infrastructure":return(0,n.t)("nav.infrastructure.subtitle","Understand your infrastructure's health");case"frontend":return(0,n.t)("nav.frontend.subtitle","Gain real user monitoring insights");case"alerts-and-incidents":return(0,n.t)("nav.alerts-and-incidents.subtitle","Alerting and incident management apps");case"testing-and-synthetics":return(0,n.t)("nav.testing-and-synthetics.subtitle","Optimize performance with k6 and Synthetic Monitoring insights");case"connections-add-new-connection":return(0,n.t)("nav.connections.subtitle","Browse and create new connections");case"connections-datasources":return(0,n.t)("nav.data-sources.subtitle","View and manage your connected data source connections");case"connections-private-data-source-connections":return(0,n.t)("nav.private-data-source-connections.subtitle","Query data that lives within a secured network without opening the network to inbound traffic from Grafana Cloud. Learn more in our docs.");default:return}}},10605:(ee,B,e)=>{"use strict";e.d(B,{v:()=>r});var t=e(2543),n=e.n(t);function r(o){return(0,t.isArray)(o)?o.map(r):(0,t.isPlainObject)(o)?Object.keys(o).sort().reduce((s,m)=>{const a=o[m];return a!=null&&a!==-1/0&&(s[m]=r(a)),s},{}):o}},1404:(ee,B,e)=>{"use strict";e.d(B,{Ih:()=>n,Lr:()=>s,U7:()=>r,dr:()=>o,fE:()=>m});var t=e(39796);function n(a){const l=["refId","hide","key","queryType","datasource"];for(const f in a)if(f!=="label"&&!l.includes(f))return!1;return!0}function r(a,l,f){const h={...l,refId:(0,t.M)(a),hide:!1};return!h.datasource&&f&&(h.datasource=f),[...a,h]}function o(a){return a.indexOf("api/datasources/proxy")!==-1||a.indexOf("api/ds/query")!==-1}function s(a){return!a.match(/^http/)}function m(a){return a||void 0}},81970:(ee,B,e)=>{"use strict";e.d(B,{Ax:()=>R,DI:()=>c,Gx:()=>P,IA:()=>C,NC:()=>E,TR:()=>L,U3:()=>v,X1:()=>d,cX:()=>b,l0:()=>p,oU:()=>D,rs:()=>y,x8:()=>T,xB:()=>g.x});var t=e(2543),n=e.n(t),r=e(5556),o=e(80011),s=e(78282),m=e(6890),a=e(64762),l=e(56840),f=e(8535),h=e(72054),u=e(6812
1616),i=e(53222),x=e(15130),g=e(80977);async function p(A){const{queries:W,localOverride:N,datasource:w,starred:j,comment:V,showNotif:U}=A,F=U?.quotaExceededError??!0,M=U?.limitExceededWarning??!0,H=U?.otherErrors??!0,_=W&&W.filter(Z=>K(Z));if(_.length>0){let Z=!1,ne=!1,te;try{te=(await(N?(0,i.tU)():(0,i.a)()).addToRichHistory({datasourceUid:w.uid,datasourceName:w.name??"",queries:_,starred:j,comment:V??""})).warning}catch(Y){return Y instanceof Error&&(Y.name===h.m.StorageFull?(Z=!0,F&&(0,f.JD)((0,m.dx)((0,a.gi)(Y.message)))):H&&Y.name!==h.m.DuplicatedEntry&&(0,f.JD)((0,m.dx)((0,a.gi)((0,l.t)("explore.rich-history-utils-notification.update-failed","Rich History update failed"),Y.message)))),{richHistoryStorageFull:Z,limitExceeded:ne}}return te&&te.type===h.C.LimitExceeded&&(ne=!0,M&&(0,f.JD)((0,m.dx)((0,a.q8)(te.message)))),{richHistoryStorageFull:Z,limitExceeded:ne}}return{}}async function c(A){const W={...A,from:A.to===void 0?A.to:(0,u.wQ)(A.to,{isLastTs:!0,tz:x.TP.user?.timezone}),to:A.from===void 0?A.from:(0,u.wQ)(A.from,{isLastTs:!0,tz:x.TP.user?.timezone})};return await(0,i.a)().getRichHistory(W)}async function y(A){await(0,i.a)().updateSettings(A)}async function P(){return await(0,i.a)().getSettings()}async function d(){return(0,i.a)().deleteAll()}async function D(A,W){try{return await(0,i.a)().updateStarred(A,W)}catch(N){N instanceof Error&&(0,f.JD)((0,m.dx)((0,a.gi)((0,l.t)("explore.rich-history-utils-notification.saving-failed","Saving rich history failed"),N.message)));return}}async function b(A,W){try{return await(0,i.a)().updateComment(A,W)}catch(N){N instanceof Error&&(0,f.JD)((0,m.dx)((0,a.gi)((0,l.t)("explore.rich-history-utils-notification.saving-failed","Saving rich history failed"),N.message)));return}}async function E(A){try{return await(0,i.a)().deleteRichHistory(A),A}catch(W){W instanceof Error&&(0,f.JD)((0,m.dx)((0,a.gi)((0,l.t)("explore.rich-history-utils-notification.saving-failed","Saving rich history failed"),W.message)));return}}const v=A=>{const W={range:{from:(0,l.t)("explore.rich-history-utils.default-from","now-1h"),to:(0,l.t)("explore.rich-history-utils.default-to","now")},datasource:A.datasourceName,queries:A.queries},N=(0,r.Pp)(W),w=/.*(?=\/explore)/.exec(`${window.location.href}`)[0];return r.kM.renderUrl(`${w}/explore`,{left:N})},C=A=>{let W;switch(A){case 0:W=(0,l.t)("explore.rich-history-utils.today","today");break;case 1:W=(0,l.t)("explore.rich-history-utils.yesterday","yesterday");break;case 7:W=(0,l.t)("explore.rich-history-utils.a-week-ago","a week ago");break;case 14:W=(0,l.t)("explore.rich-history-utils.two-weeks-ago","two weeks ago");break;default:W=(0,l.t)("explore.rich-history-utils.days-ago","{{num}} days ago",{num:`${A}`})}return W};function S(A){return(0,o.LE)(A,{format:"MMMM D"})}function O(A){const W=(0,t.omit)(A,["key","refId","datasource"]);return JSON.stringify(W)}function I(A,W){let N="";return W===g.x.DatasourceAZ||W===g.x.DatasourceZA?N=A.datasourceName:N=S(A.createdAt),N}function R(A,W){return W?.getQueryDisplayText?W.getQueryDisplayText(A):O(A)}function T(A,W){let N={};return A.forEach(w=>{let j=I(w,W);j in N?N[j]=[...N[j],w]:N[j]=[w]}),N}function L(){return(0,s.l)().getList({mixed:!0}).map(A=>({name:A.name,uid:A.uid}))}function K(A){const W=(0,t.omit)(A,["key","refId","datasource"]);return Object.keys(W).length>0}},80977:(ee,B,e)=>{"use strict";e.d(B,{x:()=>t});var t=(n=>(n.Descending="Descending",n.Ascending="Ascending",n.DatasourceAZ="Datasource A-Z",n.DatasourceZA="Datasource Z-A",n))(t||{})},71673:(ee,B,e)=>{"use strict";e.d(B,{$l:()=>P,Sp:()=>c,VN:()=>y,VP:()=>p,fn:()=>g,sU:()=>D});var t=e(41811),n=e(43173),r=e(68143),o=e(36490),s=e(56838),m=e(6890),a=e(64762),l=e(52043),f=e(8535),h=e(56840),u=e(62635);function i(){return`${window.location.protocol}//${window.location.host}${n.$.appSubUrl}`}function x(b){let E=b.replace(i(),"");return E.startsWith("/")?E.substring(1,E.length):E}const g=(0,t.default)(async function(b){try{return(await(0,r.AI)().post("/api/short-urls",{path:x(b)})).url}catch(E){console.error("Error when creating shortened link: ",E),(0,f.JD)((0,m.dx)((0,a.gi)("Error generating shortened link")))}}),p=async b=>{const E=await g(b);E?((0,u.uJ)(E),(0,f.JD)((0,m.dx)((0,a.tZ)("Shortened link copied to clipboard")))):(0,f.JD)((0,m.dx)((0,a.gi)("Error generating shortened link")))},c=async(b,E,v)=>{const C=y(b,E,v);
161if(E.useShortUrl)return await p(C);(0,u.uJ)(C),(0,f.JD)((0,m.dx)((0,a.tZ)((0,h.t)("link.share.copy-to-clipboard","Link copied to clipboard"))))},y=(b,E,v)=>{const C=o.Ny.getLocation(),S=s.jh.getTimeRange(v??b),O=P(E,S,v);return(0,l.u)({uid:b.state.uid,slug:b.state.meta.slug,currentQueryParams:C.search,updateQuery:O,absolute:!E.useShortUrl})},P=(b,E,v)=>{const C={};return v&&(C.viewPanel=v.state.key),b.useAbsoluteTimeRange&&(C.from=E.state.value.from.toISOString(),C.to=E.state.value.to.toISOString()),b.theme!=="current"&&(C.theme=b.theme),C};function d(b,E){for(let v=E.indexOf(b)-1;v>=0;v--)if(E[v].timeEpochMs>b.timeEpochMs)return E[v];return null}function D(b,E,v){const C={from:new Date(v.from).toISOString(),to:new Date(v.to).toISOString()};if(!n.$.featureToggles.logsInfiniteScrolling)return C;const S=E.filter(I=>I.dataFrame.refId===b.dataFrame.refId),O=d(b,S);return b.timeEpochMs>v.to&&!O?{from:new Date(v.from).toISOString(),to:new Date(b.timeEpochMs+1).toISOString()}:{from:new Date(v.from).toISOString(),to:new Date(O?O.timeEpochMs:v.to).toISOString()}}},23237:(ee,B,e)=>{"use strict";e.d(B,{Wb:()=>n,Zk:()=>r,zG:()=>o});var t=e(25229);const n=(s,m)=>{const a={from:(0,t.yT)(m.from),to:(0,t.yT)(m.to)},l=(a.to.valueOf()-a.from.valueOf())/2;let f,h;return s===-1?(f=a.to.valueOf()-l,h=a.from.valueOf()-l):s===1?(f=a.to.valueOf()+l,h=a.from.valueOf()+l,f>Date.now()&&a.to.valueOf()<Date.now()&&(f=Date.now(),h=a.from.valueOf())):(f=a.to.valueOf(),h=a.from.valueOf()),{from:h,to:f}},r=(s,m)=>{const a=s.to.valueOf()-s.from.valueOf(),l=s.to.valueOf()-a/2,f=a===0?3e4:a*m,h=l+f/2;return{from:l-f/2,to:h}};async function o(){const s=await navigator.clipboard.readText();let m;try{return m=JSON.parse(s),!m.from||!m.to?{range:s,isError:!0}:{range:m,isError:!1}}catch{return{range:s,isError:!0}}}},65556:(ee,B,e)=>{"use strict";e.d(B,{r:()=>n});let t="";const n=()=>{const o=new URLSearchParams(window.location.search).get("auth_token");return o!==null&&o!==""?(t=o,o):t}},92273:(ee,B,e)=>{"use strict";e.d(B,{G:()=>I});var t=e(74848),n=e(85891),r=e(73628),o=e(96540),s=e(22787),m=e(45861),a=e(56840),l=e(22803),f=e(63142),h=e(50275),u=e(37386),i=e(21285),x=e(97095),g=e(18027),p=e(77824),c=e(17200),y=e(41654),P=e(76319),d=e(63527),D=e(18857);const b=({value:R,onChange:T,suggestions:L,contentTypeHeader:K=!1})=>{const A=(0,f.of)(E),W=R.find(([J,q])=>J==="Content-Type"),[N,w]=(0,o.useState)(""),[j,V]=(0,o.useState)(""),[U,F]=(0,o.useState)("");(0,o.useEffect)(()=>{U!==""?F(U):W&&F(W[1])},[U,W]);const[M,H]=(0,o.useState)(Math.random().toString()),_=J=>{V(J)},Z=J=>{w(J)},ne=J=>()=>{const q=R.filter(X=>X[0]!==J);T(q)},te=J=>{let q;R?q=R.filter(X=>X[0]!==(J?J[0]:N)):q=[],q.push(J??[N,j]),q.sort((X,se)=>X[0].localeCompare(se[0])),T(q),w(""),V(""),H(Math.random().toString())},Y=J=>{F(J),te(["Content-Type",J])},Q=N===""||j==="";return(0,t.jsxs)("div",{children:[(0,t.jsxs)(y.B,{direction:"row",children:[(0,t.jsx)(c.y,{value:N,onChange:Z,suggestions:L,placeholder:(0,a.t)("actions.params-editor.placeholder-key","Key"),style:{width:332}}),(0,t.jsx)(c.y,{value:j,onChange:_,suggestions:L,placeholder:(0,a.t)("actions.params-editor.placeholder-value","Value"),style:{width:332}}),(0,t.jsx)(P.K,{"aria-label":(0,a.t)("actions.params-editor.aria-label-add","Add"),name:"plus-circle",onClick:()=>te(),disabled:Q})]},M),(0,t.jsx)(y.B,{direction:"column",children:Array.from(R.filter(J=>J[0]!=="Content-Type")||[]).map(J=>(0,t.jsxs)(y.B,{direction:"row",children:[(0,t.jsx)(d.p,{disabled:!0,value:J[0]}),(0,t.jsx)(d.p,{disabled:!0,value:J[1]}),(0,t.jsx)(P.K,{"aria-label":(0,a.t)("actions.params-editor.aria-label-delete","Delete"),onClick:ne(J[0]),name:"trash-alt"})]},J[0]))}),K&&(0,t.jsx)("div",{className:A.extraHeader,children:(0,t.jsxs)(y.B,{direction:"row",children:[(0,t.jsx)(d.p,{value:"Content-Type",disabled:!0}),(0,t.jsx)(D.l6,{onChange:J=>Y(J.value),options:n.Ur,value:U})]})})]})},E=R=>({extraHeader:(0,l.css)({marginTop:R.spacing(1),marginBottom:R.spacing(1),maxWidth:673})}),v=13,C=(0,o.memo)(({index:R,value:T,onChange:L,suggestions:K,showOneClick:A})=>{const W=(0,f.of)(S),N=ne=>{L(R,{...T,title:ne})},w=ne=>{L(R,{...T,confirmation:ne})},j=()=>{L(R,{...T,oneClick:!T.oneClick})},V=ne=>{L(R,{...T,fetch:{...T.fetch,url:ne}})},U=ne=>{L(R,{...T,fetch:{...T.fetch,body:ne}})},F=ne=>{L(R,{...T,fetch:{...T.fetch,method:ne}})},M=ne=>{L(R,{...T,fetch:{...T.fetch,queryParams:ne}})}
161,H=ne=>{L(R,{...T,fetch:{...T.fetch,headers:ne}})},_=(ne="{}")=>{try{const te=JSON.parse(ne);return(0,t.jsx)(h.B,{json:te})}catch(te){return te instanceof Error?`Invalid JSON provided: ${te.message}`:"Invalid JSON provided"}},Z=T.fetch.method!==n.DO.GET&&T.fetch.headers?.some(([ne,te])=>ne==="Content-Type"&&te==="application/json");return(0,t.jsxs)("div",{className:W.listItem,children:[(0,t.jsx)(u.D,{label:(0,a.t)("grafana-ui.action-editor.modal.action-title","Title"),className:W.inputField,children:(0,t.jsx)(c.y,{value:T.title,onChange:N,suggestions:K,autoFocus:T.title==="",placeholder:(0,a.t)("grafana-ui.action-editor.modal.action-title-placeholder","Action title")})}),(0,t.jsx)(u.D,{label:(0,a.t)("grafana-ui.viz-tooltip.actions-confirmation-label","Confirmation message"),description:(0,a.t)("grafana-ui.viz-tooltip.actions-confirmation-message","Provide a descriptive prompt to confirm or cancel the action."),className:W.inputField,children:(0,t.jsx)(c.y,{value:T.confirmation,onChange:w,suggestions:K,placeholder:(0,a.t)("grafana-ui.viz-tooltip.actions-confirmation-input-placeholder","Are you sure you want to {{ actionTitle }}?",{actionTitle:T.title||"... "})})}),A&&(0,t.jsx)(u.D,{label:(0,a.t)("grafana-ui.data-link-inline-editor.one-click","One click"),description:(0,a.t)("grafana-ui.action-editor.modal.one-click-description","Only one link or action can have one click enabled at a time"),children:(0,t.jsx)(i.d,{value:T.oneClick||!1,onChange:j})}),(0,t.jsx)(x.C,{children:(0,t.jsx)(g.I,{label:(0,a.t)("grafana-ui.action-editor.modal.action-method","Method"),labelWidth:v,grow:!0,children:(0,t.jsx)(p.z,{value:T?.fetch.method,options:n.ki,onChange:F,fullWidth:!0})})}),(0,t.jsx)(x.C,{children:(0,t.jsx)(g.I,{label:(0,a.t)("actions.action-editor.label-url","URL"),labelWidth:v,grow:!0,children:(0,t.jsx)(c.y,{value:T.fetch.url,onChange:V,suggestions:K,placeholder:(0,a.t)("actions.action-editor.placeholder-url","URL")})})}),(0,t.jsx)(u.D,{label:(0,a.t)("grafana-ui.action-editor.modal.action-query-params","Query parameters"),className:W.fieldGap,children:(0,t.jsx)(b,{value:T?.fetch.queryParams??[],onChange:M,suggestions:K})}),(0,t.jsx)(u.D,{label:(0,a.t)("actions.action-editor.label-headers","Headers"),children:(0,t.jsx)(b,{value:T?.fetch.headers??[],onChange:H,suggestions:K,contentTypeHeader:!0})}),T?.fetch.method!==n.DO.GET&&(0,t.jsx)(u.D,{label:(0,a.t)("grafana-ui.action-editor.modal.action-body","Body"),className:W.inputField,children:(0,t.jsx)(c.y,{value:T.fetch.body,onChange:U,suggestions:K,type:c.c.TextAreaElement})}),Z&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("br",{}),_(T?.fetch.body)]})]})}),S=R=>({listItem:(0,l.css)({marginBottom:R.spacing()}),infoText:(0,l.css)({paddingBottom:R.spacing(2),marginLeft:"66px",color:R.colors.text.secondary}),fieldGap:(0,l.css)({marginTop:R.spacing(2)}),inputField:(0,l.css)({marginRight:4})});C.displayName="ActionEditor";
161const O=({action:R,index:T,onSave:L,onCancel:K,getSuggestions:A,showOneClick:W})=>{const[N,w]=(0,o.useState)(R);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C,{value:N,index:T,onChange:(j,V)=>{w(V)},suggestions:A(),showOneClick:W}),(0,t.jsxs)(s.a.ButtonRow,{children:[(0,t.jsx)(m.$n,{variant:"secondary",onClick:()=>K(T),fill:"outline",children:(0,t.jsx)(a.x6,{i18nKey:"action-editor.modal.cancel-button",children:"Cancel"})}),(0,t.jsx)(m.$n,{onClick:()=>{L(T,N)},disabled:N.title.trim()===""||N.fetch.url.trim()==="",children:(0,t.jsx)(a.x6,{i18nKey:"action-editor.modal.save-button",children:"Save"})})]})]})},I=({actions:R,getSuggestions:T,showOneClick:L=!1,...K})=>(0,t.jsx)(r.J,{type:"action",items:R,...K,children:(A,W,N,w)=>(0,t.jsx)(O,{index:W,action:A??n.mx,data:K.data,onSave:N,onCancel:w,getSuggestions:T,showOneClick:L})})},74267:(ee,B,e)=>{"use strict";e.d(B,{$u:()=>V,A5:()=>Z,Bc:()=>ne,DX:()=>K,JI:()=>T,Jc:()=>A,Kg:()=>L,MV:()=>c,N6:()=>d,P3:()=>E,Pi:()=>v,T$:()=>S,TK:()=>g,VR:()=>O,Vk:()=>F,hG:()=>P,hU:()=>N,is:()=>te,kz:()=>i,ly:()=>p,mI:()=>R,nM:()=>j,nh:()=>b,nr:()=>y,pm:()=>I,xq:()=>H,yd:()=>U});var t=e(2543),n=e.n(t),r=e(80011),o=e(62061),s=e(68143),m=e(36490),a=e(65642),l=e(73427),f=e(81871),h=e(96673),u=e(52695);function i(Y){return async Q=>{try{Q((0,u.D1)(!1)),await Q(x(Y)),await Q(D(Y)),await Q(C(Y)),a.Ay.ldapEnabled&&(0,o.a)("ldapsync")&&await Q(I()),Q((0,u.D1)(!0))}catch(J){if(console.error(J),(0,s.NF)(J)){const q={title:J.data.message,body:J.data.error};Q((0,u.PV)(q))}}}}function x(Y){return async Q=>{const J=await(0,s.AI)().get(`/api/users/${Y}`,(0,f.F)());Q((0,u.G_)(J))}}function g(Y){return async Q=>{await(0,s.AI)().put(`/api/users/${Y.uid}`,Y),Q(i(Y.uid))}}function p(Y,Q){return async J=>{const q={password:Q};await(0,s.AI)().put(`/api/admin/users/${Y}/password`,q),J(i(Y))}}function c(Y){return async Q=>{await(0,s.AI)().post(`/api/admin/users/${Y}/disable`),m.Ny.push("/admin/users")}}function y(Y){return async Q=>{await(0,s.AI)().post(`/api/admin/users/${Y}/enable`),Q(i(Y))}}function P(Y){return async Q=>{await(0,s.AI)().delete(`/api/admin/users/${Y}`),m.Ny.push("/admin/users")}}function d(Y,Q){return async J=>{const q={isGrafanaAdmin:Q};await(0,s.AI)().put(`/api/admin/users/${Y}/permissions`,q),J(i(Y))}}function D(Y){return async Q=>{const J=await(0,s.AI)().get(`/api/users/${Y}/orgs`);Q((0,u.OF)(J))}}function b(Y,Q,J){return async q=>{const X={loginOrEmail:Y.login,role:J};await(0,s.AI)().post(`/api/orgs/${Q}/users/`,X),q(i(Y.uid))}}function E(Y,Q,J){return async q=>{const X={role:J};await(0,s.AI)().patch(`/api/orgs/${Q}/users/${Y}`,X),q(i(Y))}}function v(Y,Q){return async J=>{await(0,s.AI)().delete(`/api/orgs/${Q}/users/${Y}`),J(i(Y))}}function C(Y){return async Q=>{if(!l.TP.hasPermission(h.AccessControlAction.UsersAuthTokenList))return;const J=await(0,s.AI)().get(`/api/admin/users/${Y}/auth-tokens`);J.reverse();const q=J.map(X=>({id:X.id,isActive:X.isActive,seenAt:(0,r.fq)(X.seenAt),createdAt:X.createdAt,clientIp:X.clientIp,browser:X.browser,browserVersion:X.browserVersion,authModule:X.authModule,os:X.os,osVersion:X.osVersion,device:X.device}));Q((0,u.ag)(q))}}function S(Y,Q){return async J=>{const q={authTokenId:Y};await(0,s.AI)().post(`/api/admin/users/${Q}/revoke-auth-token`,q),J(C(Q))}}function O(Y){return async Q=>{await(0,s.AI)().post(`/api/admin/users/${Y}/logout`),Q(C(Y))}}function I(){return async Y=>{const Q=l.TP.hasPermission(h.AccessControlAction.LDAPStatusRead);if((0,o.a)("ldapsync")&&Q){const J=await(0,s.AI)().get("/api/admin/ldap-sync-status");Y((0,u.OR)(J))}}}function R(Y,Q){return async J=>{await(0,s.AI)().post(`/api/admin/ldap/sync/${Y}`),J(i(Q))}}function T(){return async Y=>{if(l.TP.hasPermission(h.AccessControlAction.LDAPStatusRead))try{const Q=await(0,s.AI)().get("/api/admin/ldap/status");Y((0,u.pH)(Q))}catch(Q){if((0,s.NF)(Q)){Q.isHandled=!0;const J={title:Q.data.message,body:Q.data.error};Y((0,u.V$)(J))}}}}function L(Y){return async Q=>{try{const J=await(0,s.AI)().get(`/api/admin/ldap/${encodeURIComponent(Y)}`),{name:q,surname:X,email:se,login:oe,isGrafanaAdmin:ae,isDisabled:ie,roles:fe,teams:pe}=J,de={info:{name:q,surname:X,email:se,login:oe},permissions:{isGrafanaAdmin:ae,isDisabled:ie},roles:fe,teams:pe};Q((0,u.TW)(de))}catch(J){if((0,s.NF)(J)){J.isHandled=!0;const q={title:J.data.message,body:J.data.error};Q((0,u.Vv)()),Q((0,u.Nf)(q))}}}}function K(){return Y=>{Y((0,u.zi)())}}function A(){return Y=>{Y((0,u.zi)()),Y((0,u.Vv)())}}const W=Y=>Y.map(Q=>Array.isArray(Q.value)?Q.value.map(J=>`${Q.name}=${J.value}`).join("&"):`${Q.name}=${Q.value}`).join("&");function N(){return async(Y,Q)=>{try{const{perPage:J,page:q,query:X,filters:se,sort:oe}=Q().userListAdmin;let ae=`/api/users/search?perpage=${J}&page=${q}&query=${X}&${W(se)}`;oe&&(ae+=`&sort=${oe}`);const ie=await(0,s.AI)().get(ae);Y((0,u.Mb)(ie))}catch(J){(0,u.g4)(),console.error(J)}}}const w=(0,t.debounce)(Y=>Y(N()),500);function j(Y){return async Q=>{Q((0,u.Cj)()),Q((0,u.L5)(Y)),w(Q)}}function V(Y){return async Q=>{Q((0,u.Cj)()),Q((0,u.jX)(Y)),w(Q)}}function U(Y){return async Q=>{Q((0,u.Cj)()),Q((0,u.EC)(Y)),Q(N())}}function F({sortBy:Y}){const Q=Y.length?`${Y[0].id}-${Y[0].desc?"desc":"asc"}
161`:void 0;return async(J,q)=>{q().userListAdmin.sort!==Q&&(J((0,u.Cj)()),J((0,u.$u)(Q)),J(N()))}}const M=Y=>Y.map(Q=>Array.isArray(Q.value)?Q.value.map(J=>`${Q.name}=${J.value}`).join("&"):`${Q.name}=${Q.value}`).join("&");function H(){return async(Y,Q)=>{try{const{perPage:J,page:q,query:X,filters:se,sort:oe}=Q().userListAnonymousDevices;let ae=`/api/anonymous/search?perpage=${J}&page=${q}&query=${X}&${M(se)}`;oe&&(ae+=`&sort=${oe}`);const ie=await(0,s.AI)().get(ae);Y((0,u.o3)(ie))}catch(J){console.error(J)}}}const _=(0,t.debounce)(Y=>Y(H()),500);function Z({sortBy:Y}){const Q=Y.length?`${Y[0].id}-${Y[0].desc?"desc":"asc"}`:void 0;return async(J,q)=>{q().userListAnonymousDevices.sort!==Q&&(J((0,u.kh)(Q)),J(H()))}}function ne(Y){return async Q=>{Q((0,u.xx)(Y)),_(Q)}}function te(Y){return async Q=>{Q((0,u.iK)(Y)),Q(H())}}},52695:(ee,B,e)=>{"use strict";e.d(B,{$u:()=>R,Ay:()=>V,Cj:()=>v,D1:()=>y,EC:()=>O,G_:()=>g,L5:()=>S,Mb:()=>E,Nf:()=>f,OF:()=>p,OR:()=>l,PV:()=>P,TW:()=>h,V$:()=>a,Vv:()=>s,ag:()=>c,g4:()=>C,iK:()=>N,jX:()=>I,kh:()=>W,o3:()=>A,pH:()=>m,xx:()=>w,zi:()=>o});var t=e(65307);const n={connectionInfo:[],syncInfo:void 0,user:void 0,connectionError:void 0,userError:void 0},r=(0,t.Z0)({name:"ldap",initialState:n,reducers:{ldapConnectionInfoLoadedAction:(U,F)=>({...U,ldapError:void 0,connectionInfo:F.payload}),ldapFailedAction:(U,F)=>({...U,ldapError:F.payload}),ldapSyncStatusLoadedAction:(U,F)=>({...U,syncInfo:F.payload}),userMappingInfoLoadedAction:(U,F)=>({...U,user:F.payload,userError:void 0}),userMappingInfoFailedAction:(U,F)=>({...U,user:void 0,userError:F.payload}),clearUserMappingInfoAction:(U,F)=>({...U,user:void 0}),clearUserErrorAction:(U,F)=>({...U,userError:void 0})}}),{clearUserErrorAction:o,clearUserMappingInfoAction:s,ldapConnectionInfoLoadedAction:m,ldapFailedAction:a,ldapSyncStatusLoadedAction:l,userMappingInfoFailedAction:f,userMappingInfoLoadedAction:h}=r.actions,u=r.reducer,i={user:void 0,sessions:[],orgs:[],isLoading:!0,error:void 0},x=(0,t.Z0)({name:"userAdmin",initialState:i,reducers:{userProfileLoadedAction:(U,F)=>({...U,user:F.payload}),userOrgsLoadedAction:(U,F)=>({...U,orgs:F.payload}),userSessionsLoadedAction:(U,F)=>({...U,sessions:F.payload}),userAdminPageLoadedAction:(U,F)=>({...U,isLoading:!F.payload}),userAdminPageFailedAction:(U,F)=>({...U,error:F.payload,isLoading:!1})}}),{userProfileLoadedAction:g,userOrgsLoadedAction:p,userSessionsLoadedAction:c,userAdminPageLoadedAction:y,userAdminPageFailedAction:P}=x.actions,d=x.reducer,D={users:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,filters:[{name:"activeLast30Days",value:!1}],isLoading:!0},b=(0,t.Z0)({name:"userListAdmin",initialState:D,reducers:{usersFetched:(U,F)=>{const{totalCount:M,perPage:H,..._}=F.payload,Z=Math.ceil(M/H);return{...U,..._,totalPages:Z,perPage:H,showPaging:Z>1,isLoading:!1}},usersFetchBegin:U=>({...U,isLoading:!0}),usersFetchEnd:U=>({...U,isLoading:!1}),queryChanged:(U,F)=>({...U,query:F.payload,page:0}),pageChanged:(U,F)=>({...U,page:F.payload}),sortChanged:(U,F)=>({...U,page:0,sort:F.payload}),filterChanged:(U,F)=>{const{name:M,value:H}=F.payload;return U.filters.some(_=>_.name===M)?{...U,page:0,filters:U.filters.map(_=>_.name===M?{..._,value:H}:_)}:{...U,page:0,filters:[...U.filters,F.payload]}}}}),{usersFetched:E,usersFetchBegin:v,usersFetchEnd:C,queryChanged:S,pageChanged:O,filterChanged:I,sortChanged:R}=b.actions,T=b.reducer,L={devices:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,filters:[{name:"activeLast30Days",value:!0}]},K=(0,t.Z0)({name:"userListAnonymousDevices",initialState:L,reducers:{usersAnonymousDevicesFetched:(U,F)=>{const{totalCount:M,perPage:H,..._}=F.payload,Z=Math.ceil(M/H);return{...U,..._,totalPages:Z,perPage:H,showPaging:Z>1}},anonQueryChanged:(U,F)=>({...U,query:F.payload,page:0}),anonPageChanged:(U,F)=>({...U,page:F.payload}),anonUserSortChanged:(U,F)=>({...U,page:0,sort:F.payload}),filterChanged:(U,F)=>{const{name:M,value:H}=F.payload;return U.filters.some(_=>_.name===M)?{...U,page:0,filters:U.filters.map(_=>_.name===M?{..._,value:H}:_)}:{...U,page:0,filters:[...U.filters,F.payload]}}}}),{usersAnonymousDevicesFetched:A,anonUserSortChanged:W,anonPageChanged:N,anonQueryChanged:w}=K.actions,j=K.reducer,V={ldap:u,userAdmin:d,userListAdmin:T,userListAnonymousDevices:j}},2954:(ee,B,e)=>{"use strict";e.d(B,{A:()=>d,p:()=>a});var t=e(2543),n=e.n(t),r=e(56355);const o=new r.tI({type:"query",params:[{name:"queryRefId",type:"string",dynamicLookup:!0}
161,{name:"from",type:"string",options:["10s","1m","5m","10m","15m","1h","2h","6h","12h","24h","48h"]},{name:"to",type:"string",options:["now","now-1m","now-5m","now-10m","now-1h"]}],defaultParams:["#A","15m","now","avg"]}),s=[{text:"Query",value:"query"}],m={alerting:1,firing:1,no_data:2,pending:3,ok:4,paused:5,inactive:5};var a=(D=>(D.IsAbove="gt",D.IsBelow="lt",D.IsEqual="eq",D.IsNotEqual="ne",D.IsGreaterThanEqual="gte",D.IsLessThanEqual="lte",D.IsOutsideRange="outside_range",D.IsWithinRange="within_range",D.IsWithinRangeIncluded="within_range_included",D.IsOutsideRangeIncluded="outside_range_included",D.HasNoValue="no_value",D))(a||{});const l=[{value:"gt",text:"IS ABOVE"},{value:"lt",text:"IS BELOW"},{value:"eq",text:"IS EQUAL TO"},{value:"ne",text:"IS NOT EQUAL TO"},{value:"gte",text:"IS ABOVE OR EQUAL TO"},{value:"lte",text:"IS BELOW OR EQUAL TO"},{value:"outside_range",text:"IS OUTSIDE RANGE"},{value:"within_range",text:"IS WITHIN RANGE"},{value:"outside_range_included",text:"IS OUTSIDE RANGE INCLUDED"},{value:"within_range_included",text:"IS WITHIN RANGE INCLUDED"},{value:"no_value",text:"HAS NO VALUE"}],f=[{text:"OR",value:"or"},{text:"AND",value:"and"},{text:"LOGIC OR",value:"logic-or"}],h=[{text:"avg()",value:"avg"},{text:"min()",value:"min"},{text:"max()",value:"max"},{text:"sum()",value:"sum"},{text:"count()",value:"count"},{text:"last()",value:"last"},{text:"median()",value:"median"},{text:"diff()",value:"diff"},{text:"diff_abs()",value:"diff_abs"},{text:"percent_diff()",value:"percent_diff"},{text:"percent_diff_abs()",value:"percent_diff_abs"},{text:"count_non_null()",value:"count_non_null"}],u=[{text:"Alerting",value:"alerting"},{text:"No Data",value:"no_data"},{text:"Keep Last State",value:"keep_state"},{text:"Ok",value:"ok"}],i=[{text:"Alerting",value:"alerting"},{text:"Keep Last State",value:"keep_state"}];function x(D){const b=new r.tI({type:D.type,defaultParams:[]});return new r.kW(D,b)}function g(D){return D.toLowerCase().replace(/_/g,"").split(" ")[0]}function p(D){switch(g(D)){case"normal":case"ok":return{text:"OK",iconClass:"heart",stateClass:"alert-state-ok"};case"alerting":return{text:"ALERTING",iconClass:"heart-break",stateClass:"alert-state-critical"};case"nodata":return{text:"NO DATA",iconClass:"question-circle",stateClass:"alert-state-warning"};case"paused":return{text:"PAUSED",iconClass:"pause",stateClass:"alert-state-paused"};case"pending":return{text:"PENDING",iconClass:"hourglass",stateClass:"alert-state-warning"};case"recovering":return{text:"RECOVERING",iconClass:"hourglass",stateClass:"alert-state-warning"};case"firing":return{text:"FIRING",iconClass:"fire",stateClass:""};case"inactive":return{text:"INACTIVE",iconClass:"check",stateClass:""};case"error":return{text:"ERROR",iconClass:"heart-break",stateClass:"alert-state-critical"};case"unknown":default:return{text:"UNKNOWN",iconClass:"question-circle",stateClass:".alert-state-paused"}}}function c(D,b){return(0,t.reduce)(D,(E,v)=>(v.metric!==void 0&&v.value!==void 0&&E.push(v.metric+"="+v.value),v.Metric!==void 0&&v.Value!==void 0&&E.push(v.Metric+"="+v.Value),E),[]).join(b)}function y(D){return(0,t.isArray)(D.data)?c(D.data,", "):(0,t.isArray)(D.data.evalMatches)?c(D.data.evalMatches,", "):D.data.error?"Error: "+D.data.error:""}function P(D){return(0,t.isArray)(D)?c(D,", "):(0,t.isArray)(D.evalMatches)?c(D.evalMatches,", "):D.error?"Error: "+D.error:""}const d={alertQueryDef:o,getStateDisplayModel:p,conditionTypes:s,evalFunctions:l,evalOperators:f,noDataModes:u,executionErrorModes:i,reducerTypes:h,createReducerPart:x,getAlertAnnotationInfo:y,getAlertAnnotationText:P,alertStateSortScore:m}},56355:(ee,B,e)=>{"use strict";e.d(B,{Dw:()=>m,Wn:()=>s,kW:()=>o,tI:()=>r});var t=e(2543),n=e.n(t);class r{constructor(h){this.type=h.type,this.params=h.params,this.defaultParams=h.defaultParams,this.renderer=h.renderer,this.category=h.category,this.addStrategy=h.addStrategy}}class o{constructor(h,u){if(this.part=h,this.def=u,!this.def)throw{message:"Could not find query part "+h.type};h.params=h.params||(0,t.clone)(this.def.defaultParams),this.params=h.params,this.text="",this.updateText()}render(h){return this.def.renderer(this,h)}hasMultipleParamsInString(h,u){return h.indexOf(",")===-1?!1:this.def.params[u+1]&&this.def.params[u+1].optional}updateParam(h,u){if(this.hasMultipleParamsInString(h,u)){(0,t.each)(h.split(","),(i,x)=>{this.updateParam(i.trim(),x)});return}h===""&&this.def.params[u].optional?this.params.splice(u,1):this.params[u]=h,this.part.params=this.params,this.updateText()}updateText(){if(this.params.length===0){this.text=this.def.type+"()";return}let h=this.def.type+"(";h+=this.params.join(", "),h+=")",this.text=h}}function s(f,h){const u=f.def.type+"(",i=(0,t.map)(f.params,(x,g)=>{const p=f.def.params[g];return p.type==="time"&&x==="auto"&&(x="$__interval"),p.quote==="single"?"'"+x+"'":p.quote==="double"?'"'+x+'"':x});return h&&i.unshift(h),u+i.join(", ")+")"}function m(f,h){return h+" "+f.params[0]}function a(f,h){return f.params[0]}function l(f,h){return'"'+f.params[0]+'"'}},74268:(ee,B,e)=>{"use strict";e.d(B,{AK:()=>O,Cl:()=>H,Ey:()=>L,FF:()=>i,Gn:()=>v,Hs:()=>ne,IR:()=>E,KF:()=>p,Ke:()=>y,P6:()=>_,Pq:()=>K,QA:()=>x,Rh:()=>I,Rk:()=>b,Sn:()=>V,Sq:()=>d,Tc:()=>W,U6:()=>F,U7:()=>g,XW:()=>T,Yk:()=>S,aL:()=>U,cg:()=>R,fH:()=>f,iF:()=>A,iW:()=>Z,l$:()=>u,le:()=>l,nf:()=>D,t6:()=>M,vO:()=>C,vV:()=>h,zs:()=>w});var t=e(2543),n=e.n(t),r=e(25992),o=e(43173),s=e(27489),m=e(73427),a=e(56369);const l={filterByLabel:"filtering alert instances by label",loadedList:"loaded Alert Rules list",leavingRuleGroupEdit:"leaving rule group edit without saving",alertRuleFromPanel:"creating alert rule from panel",alertRuleFromScratch:"creating alert rule from scratch",recordingRuleFromScratch:"creating recording rule from scratch",clickingAlertStateFilters:"clicking alert state filters",cancelSavingAlertRule:"user canceled alert rule creation",successSavingAlertRule:"alert rule saved successfully",unknownMessageFromError:"unknown messageFromError",grafanaRecording:"creating Grafana recording rule from scratch",loadedCentralAlertStateHistory:"loaded central alert state history",exportNewGrafanaRule:"exporting new Grafana rule",noAlertRuleVersionsFound:"no alert rule versions foun
161d"},{logInfo:f,logError:h,logMeasurement:u,logWarning:i}=(0,r.DW)("features.alerting",{module:"Alerting"});function x(te,Y,Q={}){return async function(...J){const q=`${Y}:start`;performance.mark(q);const X=await te(...J),se=performance.measure(Y,q);return u(Y,{duration:se.duration,loadTimesMs:se.duration},Q),X}}function g(te,Y,Q){return async(...J)=>{const q=performance.now(),X=await Y(...J),{namespacesCount:se,groupsCount:oe,rulesCount:ae}=c(X);return u(te,{loadTimeMs:performance.now()-q,namespacesCount:se,groupsCount:oe,rulesCount:ae},Q),X}}function p(te){Object.entries(te).forEach(([Y,Q])=>{const J=Q.message??"unknown error",q=String(Q.type)??"unknown",X=new Error(J);h(X,{field:Y,type:q})})}function c(te){const Y=te.length,Q=te.flatMap(X=>X.groups).length,J=te.flatMap(X=>X.groups).flatMap(X=>X.rules).length;return{namespacesCount:Y,groupsCount:Q,rulesCount:J}}function y(te,Y,Q){return async(...J)=>{const q=performance.now(),X=await Y(...J),{namespacesCount:se,groupsCount:oe,rulesCount:ae}=P(X);return u(te,{namespacesCount:se,groupsCount:oe,rulesCount:ae,loadTimeMs:performance.now()-q},Q),X}}function P(te){const Y=Object.keys(te),Q=Object.values(te).flatMap(q=>q),J=Q.flatMap(q=>q.rules);return{namespacesCount:Y.length,groupsCount:Q.length,rulesCount:J.length}}const d=async(te={grafana_version:o.$.buildInfo.version,org_id:m.TP.user.orgId,user_id:m.TP.user.id})=>{(0,s.rR)("grafana_alerting_navigation",te)},D=te=>{(0,s.rR)("grafana_alerting_rule_creation",te)},b=te=>{(0,s.rR)("grafana_alerting_rule_aborted",te)},E=te=>{(0,s.rR)("grafana_alerting_rule_form_error",te)},v=te=>{(0,s.rR)("grafana_alerting_grafana_rule_creation_new_success",te)},C=()=>{(0,s.rR)("grafana_alerting_grafana_rule_creation_new_aborted")},S=()=>{(0,s.rR)("grafana_alerting_grafana_rule_creation_new_error")},O=async te=>{const Y={grafana_version:o.$.buildInfo.version,org_id:m.TP.user.orgId,user_id:m.TP.user.id};(0,s.rR)("grafana_alerting_insights",{...Y,...te})},I=async te=>{(0,s.rR)("grafana_alerting_rule_versions_comparison_click",{...te})},R=async te=>{(0,s.rR)("grafana_alerting_rule_versions_restore_success",{...te})},T=async te=>{(0,s.rR)("grafana_alerting_rule_versions_restore_error",{...te})},L=async()=>{(0,s.rR)("grafana_alerting_deleted_rule_restore_success")},K=async()=>{(0,s.rR)("grafana_alerting_deleted_rule_restore_error")},A=async()=>{(0,s.rR)("grafana_alerting_import_to_gma_success")},W=async()=>{(0,s.rR)("grafana_alerting_import_to_gma_error")};function N(te){(0,s.rR)("grafana_alerting_rules_search",{...te})}function w({oldQuery:te,newQuery:Y}){try{const Q=(0,a.XY)(te),J=(0,a.XY)(Y),q=j(Q);j(J).filter(oe=>!q.includes(oe)).forEach(oe=>{N({filter:oe,triggeredBy:"typing"})})}catch(Q){Q instanceof Error&&h(Q)}}function j(te){return Object.entries(te).filter(([Y,Q])=>!(0,t.isEmpty)(Q)).map(([Y])=>Y)}function V(te){N({filter:te,triggeredBy:"component"})}function U(te){(0,s.rR)("grafana_alerting_rules_list_mode",{...te})}function F(){(0,s.rR)("grafana_alerting_contact_point_form_edit_input_with_template")}function M(){(0,s.rR)("grafana_alerting_contact_point_form_use_custom_input_in_template")}function H(){(0,s.rR)("grafana_alerting_contact_point_form_use_single_template_in_input")}function _(te){(0,s.rR)("grafana_alerting_central_alert_state_history_filter_by_clicking",te)}function Z(){(0,s.rR)("grafana_alerting_central_alert_state_history_expand_row")}function ne(te){(0,s.rR)("grafana_alerting_central_alert_state_history_max_events_reached",te)}},28390:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{default:()=>P,defaultPageNav:()=>c});var t=e(74848),n=e(96540),r=e(54148),o=e(68143),s=e(34999),m=e(1506),a=e(56840),l=e(36826),f=e(54552),h=e(74159),u=e(44109),i=e(77256),x=e(94646),g=e(88547);const p=()=>{const d=(0,r.g)(),D=(0,x.uE)(d),[b]=(0,h.P5)(),v=b===h.gQ.Instances?void 0:0,C=(0,n.useMemo)(()=>{if(!D)throw new Error("Rule ID is required");return(0,x.qg)(D,!0)},[D]),{loading:S,error:O,result:I}=(0,u.ZU)({ruleIdentifier:C,limitAlerts:v});return O?(0,t.jsx)(l.d,{pageNav:c,navId:"alert-list",children:(0,t.jsx)(y,{error:O})}):S?(0,t.jsx)(l.d,{pageNav:c,navId:"alert-list",isLoading:!0}):I?(0,t.jsx)(f.K,{identifier:C,rule:I,children:(0,t.jsx)(h.Ay,{})}):!I&&!S?(0,t.jsx)(l.d,{pageNav:c,navId:"alert-list",children:(0,t.jsx)(m.L,{entity:"Rule"})}):null},c={id:"alert-rule-view",text:""};function y({error:d}){return(0,o.NF)(d)&&d.status===404?(0,t.jsx)(m.L,{entity:"Rule"}):(0,t.jsx)(s.F,{title:(0,a.t)("alerting.rule-viewer.error-loading","Something went wrong loading the rule"),children:(0,i.JZ)(d)})}const P=(0,g.S)(p)},70327:(ee,B,e)=>{"use strict";e.d(B,{hK:()=>g});var t=e(2543),n=e.n(t),r=e(56840),o=e(52161),s=e(39659),m=e(29609),a=e(5709),l=e(55143),f=e(78467),h=e(77295);const u="/api/v1/rule/test/grafana",i="api/prometheus/grafana/api/v1/rules";var x=(p=>(p.RuleGroup="rule_group",p.Namespace="file",p.FolderUID="folder_uid",p.LimitAlerts="limit_alerts",p))(x||{});const g=a.H.injectEndpoints({endpoints:p=>
161({preview:p.mutation({query:({alertQueries:c,condition:y,customLabels:P,folder:d,alertName:D,alertUid:b})=>({url:u,data:{rule:{grafana_alert:{data:c,condition:y,no_data_state:"Alerting",title:D,uid:b??"N/A"},for:"0s",labels:(0,s.x4)(P),annotations:{}},folderUid:d.uid,folderTitle:d.title},method:"POST"})}),prometheusRulesByNamespace:p.query({query:({limitAlerts:c,identifier:y,filter:P,state:d,matcher:D})=>{const b=new URLSearchParams;c&&b.set("limit_alerts",String(c)),y&&((0,m.Mj)(y)||(0,m.X4)(y))&&(b.set("file",y.namespace),b.set("rule_group",y.groupName));const v={...(0,f.ou)(P),...Object.fromEntries(b)};return{url:i,params:(0,f.Dj)(v,d,D)}},transformResponse:c=>(0,f.lH)(c.data.groups,o.hY)}),prometheusRuleNamespaces:p.query({query:({ruleSourceName:c,namespace:y,groupName:P,ruleName:d,dashboardUid:D,panelId:b,limitAlerts:E,maxGroups:v,excludeAlerts:C})=>{const S={rule_group:P,rule_name:d,dashboard_uid:D,panel_id:b?.toString()};return y&&((0,o.z2)(c)?(0,t.set)(S,"folder_uid",y):(0,t.set)(S,"file",y)),E!==void 0&&(0,t.set)(S,"limit_alerts",String(E)),v&&(0,t.set)(S,"max_groups",v),C&&(0,t.set)(S,"exclude_alerts","true"),{url:`api/prometheus/${(0,o.w5)(c)}/api/v1/rules`,params:S}},transformResponse:(c,y,P)=>(0,f.lH)(c.data.groups,P.ruleSourceName),providesTags:["CombinedAlertRule"]}),rulerRules:p.query({query:({rulerConfig:c,filter:y})=>{const{path:P,params:d}=(0,h.$o)(c).rules(y);return{url:P,params:d}},providesTags:["CombinedAlertRule"]}),rulerNamespace:p.query({query:({rulerConfig:c,namespace:y})=>{const{path:P,params:d}=(0,h.$o)(c).namespace(y);return{url:P,params:d}},providesTags:(c,y,{namespace:P})=>[{type:"RuleNamespace",id:P}]}),getRuleGroupForNamespace:p.query({query:({rulerConfig:c,namespace:y,group:P,notificationOptions:d})=>{const{path:D,params:b}=(0,h.$o)(c).namespaceGroup(y,P);return{url:D,params:b,notificationOptions:d}},providesTags:(c,y,{namespace:P,group:d,rulerConfig:D})=>[{type:"RuleGroup",id:`${D.dataSourceUid}/${P}/${d}`},{type:"RuleNamespace",id:`${D.dataSourceUid}/${P}`}]}),getGrafanaRulerGroup:p.query({query:({folderUid:c,groupName:y})=>{const{path:P,params:d}=(0,h.$o)(l.b).namespaceGroup(c,y);return{url:P,params:d}},providesTags:(c,y,{folderUid:P,groupName:d})=>[{type:"RuleGroup",id:`grafana/${P}/${d}`},{type:"RuleNamespace",id:`grafana/${P}`}]}),deleteRuleGroupFromNamespace:p.mutation({query:({rulerConfig:c,namespace:y,group:P,notificationOptions:d})=>{const D=(0,r.t)("alerting.rule-groups.delete.success","Successfully deleted rule group"),{path:b,params:E}=(0,h.$o)(c).namespaceGroup(y,P);return{url:b,params:E,method:"DELETE",notificationOptions:{successMessage:D,...d}}},invalidatesTags:(c,y,{namespace:P,group:d,rulerConfig:D})=>[{type:"RuleGroup",id:`${D.dataSourceUid}/${P}/${d}`},{type:"RuleNamespace",id:`${D.dataSourceUid}/${P}`},"DeletedRules"]}),upsertRuleGroupForNamespace:p.mutation({query:({payload:c,namespace:y,rulerConfig:P,notificationOptions:d})=>{const{path:D,params:b}=(0,h.$o)(P).namespace(y),E=(0,r.t)("alerting.rule-groups.update.success","Successfully updated rule group");return{url:D,params:b,data:c,method:"POST",notificationOptions:{successMessage:E,...d}}},invalidatesTags:(c,y,{namespace:P,payload:d,rulerConfig:D})=>{const b=d.rules.filter(m.p.grafana.rule);return[{type:"RuleNamespace",id:`${D.dataSourceUid}/${P}`},{type:"RuleGroup",id:`${D.dataSourceUid}/${P}/${d.name}`},...b.flatMap(E=>[{type:"GrafanaRulerRule",id:E.grafana_alert.uid},{type:"GrafanaRulerRuleVersion",id:E.grafana_alert.uid}]),"DeletedRules"]}}),getAlertRule:p.query({query:({uid:c})=>({url:`/api/ruler/${o.hY}/api/v1/rule/${c}`}),providesTags:(c,y,{uid:P})=>[{type:"GrafanaRulerRule",id:P}]}),getAlertVersionHistory:p.query({query:({uid:c})=>({url:`/api/ruler/${o.hY}/api/v1/rule/${c}/versions`}),providesTags:(c,y,{uid:P})=>[{type:"GrafanaRulerRuleVersion",id:P}]}),exportRules:p.query({query:({format:c,folderUid:y,group:P,ruleUid:d})=>({url:"/api/ruler/grafana/api/v1/export/rules",params:{format:c,folderUid:y,group:P,ruleUid:d},responseType:"text"}),keepUnusedDataFor:0}),exportReceiver:p.query({query:({receiverName:c,decrypt:y,format:P})=>({url:"/api/v1/provisioning/contact-points/export/",params:{format:P,decrypt:y,name:c},responseType:"text"}
161),keepUnusedDataFor:0}),exportReceivers:p.query({query:({decrypt:c,format:y})=>({url:"/api/v1/provisioning/contact-points/export/",params:{format:y,decrypt:c},responseType:"text"}),keepUnusedDataFor:0}),exportPolicies:p.query({query:({format:c})=>({url:"/api/v1/provisioning/policies/export/",params:{format:c},responseType:"text"}),keepUnusedDataFor:0}),exportModifiedRuleGroup:p.mutation({query:({payload:c,format:y,nameSpaceUID:P})=>({url:`/api/ruler/grafana/api/v1/rules/${P}/export/`,params:{format:y},responseType:"text",data:c,method:"POST"})}),exportMuteTimings:p.query({query:({format:c})=>({url:"/api/v1/provisioning/mute-timings/export/",params:{format:c},responseType:"text"}),keepUnusedDataFor:0}),exportMuteTiming:p.query({query:({format:c,muteTiming:y})=>({url:`/api/v1/provisioning/mute-timings/${y}/export/`,params:{format:c},responseType:"text"}),keepUnusedDataFor:0}),getDeletedRules:p.query({query:()=>({url:`/api/ruler/${o.hY}/api/v1/rules/`,params:{deleted:"true"}}),transformResponse:c=>{const y=Object.values(c);return y.length>0?y[0][0]?.rules:[]},providesTags:["DeletedRules"]}),permanentlyDeleteRule:p.mutation({query:({guid:c})=>({url:`/api/ruler/${o.hY}/api/v1/trash/rule/guid/${c}`,method:"DELETE"}),invalidatesTags:["DeletedRules"]})})})},62421:(ee,B,e)=>{"use strict";e.d(B,{F:()=>o});var t=e(32899),n=e(45229),r=e(5709);const o=r.H.injectEndpoints({endpoints:s=>({getSilences:s.query({query:({datasourceUid:m,ruleMetadata:a,accessControl:l})=>({url:`/api/alertmanager/${m}/api/v2/silences`,params:{ruleMetadata:a,accesscontrol:l}}),providesTags:m=>m?[...m.map(({id:a})=>({type:"AlertmanagerSilences",id:a})),{type:"AlertmanagerSilences"}]:[{type:"AlertmanagerSilences"}]}),getSilence:s.query({query:({datasourceUid:m,id:a,ruleMetadata:l,accessControl:f})=>({url:`/api/alertmanager/${m}/api/v2/silence/${a}`,showErrorAlert:!1,params:{ruleMetadata:l,accesscontrol:f}}),providesTags:(m,a,{id:l})=>m?[{type:"AlertmanagerSilences",id:l}]:["AlertmanagerSilences"]}),createSilence:s.mutation({query:({datasourceUid:m,payload:a})=>({url:`/api/alertmanager/${m}/api/v2/silences`,method:"POST",data:a}),invalidatesTags:["AlertmanagerSilences","AlertmanagerAlerts"],onQueryStarted:async(m,{queryFulfilled:a})=>{try{await a,n.A.emit(t.r1.alertSuccess,["Silence created"])}catch{n.A.emit(t.r1.alertError,["Could not create silence"])}}}),expireSilence:s.mutation({query:({datasourceUid:m,silenceId:a})=>({url:`/api/alertmanager/${m}/api/v2/silence/${a}`,method:"DELETE"}),invalidatesTags:["AlertmanagerSilences"]})})})},5709:(ee,B,e)=>{"use strict";e.d(B,{H:()=>u});var t=e(75816),n=e(10378),r=e(2543),o=e.n(r),s=e(75505),m=e(32899),a=e(68143),l=e(45229),f=e(74268);const h=()=>async({body:i,notificationOptions:x={},...g},p,c)=>{const{errorMessage:y,showErrorAlert:P,successMessage:d,showSuccessAlert:D}=x,{hideErrorMessage:b}=c||{};try{const E={...g,...i&&{data:i},...(0,r.isBoolean)(D)&&{showSuccessAlert:D},...(0,r.isBoolean)(P)&&{showErrorAlert:P},...d&&{showSuccessAlert:!1},...(y||b)&&{showErrorAlert:!1}},v=performance.now(),{data:C,...S}=await(0,s.s)((0,a.AI)().fetch(E));return(0,f.l$)("backendSrvBaseQuery",{loadTimeMs:performance.now()-v},{url:g.url,method:g.method??"GET",responseStatus:S.statusText}),d&&D!==!1&&l.A.emit(m.r1.alertSuccess,[d]),{data:C,meta:S}}catch(E){return y&&P!==!1&&l.A.emit(m.r1.alertError,[y]),{error:E}}},u=(0,t.xP)({reducerPath:"alertingApi",baseQuery:h(),serializeQueryArgs:i=>(0,n.lE)((0,r.omit)(i,"queryArgs.notificationOptions")),tagTypes:["AlertingConfiguration","AlertmanagerConfiguration","AlertmanagerConnectionStatus","AlertmanagerAlerts","AlertmanagerSilences","OnCallIntegrations","DataSourceSettings","GrafanaLabels","CombinedAlertRule","GrafanaRulerRule","GrafanaRulerRuleVersion","GrafanaSlo","RuleGroup","RuleNamespace","ContactPoint","ContactPointsStatus","Receiver","DeletedRules"],endpoints:()=>({})})},47938:(ee,B,e)=>{"use strict";e.d(B,{By:()=>h,VO:()=>f,WS:()=>s,f4:()=>l,nd:()=>a,vk:()=>m});var t=e(75505),n=e(28105),r=e(68143),o=e(52161);async function s(p){try{const c=await(0,t.s)((0,r.AI)().fetch({url:`/api/alertmanager/${(0,o.w5)(p)}/config/api/v1/alerts`,showErrorAlert:!1,showSuccessAlert:!1}));return{template_files:c.data.template_files??{},template_file_provenances:c.data.template_file_provenances??{},alertmanager_config:c.data.alertmanager_config??{},last_applied:c.data.last_applied,id:c.data.id}}catch(c){if(p===o.hY&&(0,r.NF)(c)&&c.data?.message?.includes("could not find an Alertmanager configuration"))return{template_files:{},alertmanager_config:{}};throw c}}async function m(p,c){await(0,t.s)((0,r.AI)().fetch({method:"POST",url:`/api/alertmanager/${(0,o.w5)(p)}/config/api/v1/alerts`,data:c,showErrorAlert:!1,showSuccessAlert:!1}))}async function a(p){await(0,t.s)((0,r.AI)().fetch({method:"DELETE",url:`/api/alertmanager/${(0,o.w5)(p)}/config/api/v1/alerts`,showErrorAlert:!1,showSuccessAlert:!1}))}async function l(p){return(await(0,t.s)((0,r.AI)().fetch({url:`/api/alertmanager/${(0,o.w5)(p)}/api/v2/alerts/groups`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function f(p){return(await(0,t.s)((0,r.AI)().fetch({url:`/api/alertmanager/${(0,o.w5)(p)}/api/v2/status`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function h(p,c,y){const P={receivers:c,alert:y};try{const d=await(0,t.s)((0,r.AI)().fetch({method:"POST",data:P,url:`/api/alertmanager/${(0,o.w5)(p)}/config/api/v1/receivers/test`,showErrorAlert:!1,showSuccessAlert:!1}));if(u(d.data))throw new Error(g(d.data))}catch(d){throw(0,r.NF)(d)&&i(d.data)&&u(d.data)?new Error(g(d.data)):d}}function u(p){return p.receivers.some(c=>c.grafana_managed_receiver_configs.some(y=>y.status==="failed"))}function i(p){return(0,n.Gv)(p)&&"receivers"in p&&Array.isArray(p.receivers)?p.receivers.every(x):!1}function x(p){return(0,n.Gv)(p)&&"name"in p&&typeof p.name=="string"&&"grafana_managed_receiver_configs"in p&&Array.isArray(p.grafana_managed_receiver_configs)}function g(p){return p.receivers.flatMap(c=>c.grafana_managed_receiver_configs.filter(y=>y.status==="failed").map(y=>y.error??"Unknown error.")).join("; ")}},91984:(ee,B,e)=>{"use strict";e.d(B,{m:()=>c});var t=e(2543),n=e.n(t),r=e(63895),o=e(8535),s=e(74268),m=e(86017),a=e(52161),l=e(77256),f=e(36200),h=e(5709),u=e(47938),i=e(55143);const x=30,g=30*1e3,p=["AlertingConfiguration","AlertmanagerConfiguration","AlertmanagerConnectionStatus","ContactPoint","ContactPointsStatus","Receiver"],c=h.H.injectEndpoints({endpoints:y=>({getAlertmanagerAlerts:y.query({query:({amSourceName:P,filter:d,showErrorAlert:D=!0})=>{const b=d?.matchers?.filter(R=>R.name&&R.value).map(R=>(0,r.b2)((0,m.MU)(R))),{silenced:E,inhibited:v,unprocessed:C,active:S}=d||{},O=Object.fromEntries(Object.entries({silenced:E,active:S,inhibited:v,unprocessed:C}).filter(([R,T])=>T!==void 0)),I={filter:b};return O&&Object.keys(O).forEach(R=>{I[R]=O[R]}),{url:`/api/alertmanager/${(0,a.w5)(P)}/api/v2/alerts`,params:I,showErrorAlert:D}},providesTags:["AlertmanagerAlerts"]}),getAlertmanagerAlertGroups:y.query({query:({amSourceName:P})=>({url:`/api/alertmanager/${(0,a.w5)(P)}/api/v2/alerts/groups`})}),grafanaNotifiers:y.query({query:()=>({url:"/api/alert-notifiers"})}),getGrafanaAlertingConfiguration:y.query({query:()=>({url:"/api/v1/ngalert/admin_config",showErrorAlert:!1}),providesTags:["AlertingConfiguration"]}),getGrafanaAlertingConfigurationStatus:y.query({query:()=>({url:"/api/v1/ngalert"}),providesTags:["AlertingConfiguration"]}),getExternalAlertmanagers:y.query({query:()=>({url:"/api/v1/ngalert/alertmanagers"}),transformResponse:P=>P.data,providesTags:["AlertmanagerConnectionStatus"]}),updateGrafanaAlertingConfiguration:y.mutation({query:P=>({url:"/api/v1/ngalert/admin_config",method:"POST",data:P,showSuccessAlert:!1}),invalidatesTags:[...p]}),getAlertmanagerConfigurationHistory:y.query({query:()=>({url:`/api/alertmanager/${(0,a.w5)(a.hY)}/config/history`,params:{limit:x}}),providesTags:["AlertmanagerConfiguration"]}),resetAlertmanagerConfigurationToOldVersion:y.mutation({query:P=>({url:`/api/alertmanager/${(0,a.w5)(a.hY)}/config/history/${P.id}/_activate`,method:"POST"}),invalidatesTags:["AlertmanagerConfiguration"]}),getAlertmanagerConfiguration:y.query({queryFn:async P=>{const d=P===a.hY;if((0,a.AL)(P))return(0,f.$I)((0,u.VO)(P).then(O=>({data:{alertmanager_config:O.config,template_files:{}}})));const{data:b}=await(0,o.JD)(i.L.endpoints.discoverAmFeatures.initiate({amSourceName:P})),E={alertmanager_config:{},template_files:{},template_file_provenances:{}},v=b?.lazyConfigInit??!1,C=(0,s.QA)(u.WS,"unifiedalerting/fetchAmConfig",{dataSourceName:P,thunk:"unifiedalerting/fetchAmConfig"}),S=(0,l.i9)(()=>C(P),O=>!!(0,f.CZ)(O)?.includes("alertmanager storage object not found")&&!v,g).then(O=>d?O:(0,t.isEmpty)(O.alertmanager_config)&&(0,t.isEmpty)(O.template_files)?(0,u.VO)(P).then(R=>({alertmanager_config:R.config,template_files:{},template_file_provenances:O.template_file_provenances,last_applied:O.last_applied,id:O.id})):O).then(O=>O??E).then(O=>({data:O})).catch(O=>{if(v&&(0,f.CZ)(O)?.includes("alertmanager storage object not found"))return{data:E};throw O});return(0,f.$I)(S).catch(O=>({error:O,data:void 0}))},providesTags:["AlertmanagerConfiguration"]}),updateAlertmanagerConfiguration:y.mutation({query:({selectedAlertmanager:P,config:d})=>({url:`/api/alertmanager/${(0,a.w5)(P)}/config/api/v1/alerts`,method:"POST",data:d,showSuccessAlert:!1}),invalidatesTags:["AlertmanagerConfiguration","ContactPoint","ContactPointsStatus","Receiver"]}),getContactPointsStatus:y.query({query:()=>({url:`/api/alertmanager/${(0,a.w5)(a.hY)}/config/api/v1/receivers`}),transformResponse:P=>{const d=D=>D.startsWith("0001-01-01");return P.map(D=>({...D,integrations:D.integrations.map(b=>{const E=d(b.lastNotifyAttempt);return{...b,lastNotifyAttempt:E?"":b.lastNotifyAttempt,lastNotifyAttemptDuration:E?"":b.lastNotifyAttemptDuration}})}))},providesTags:["ContactPointsStatus"]}),getContactPointsList:y.query({query:()=>({url:"/api/v1/notifications/receivers"}),providesTags:["ContactPoint"]}),getMuteTimingList:y.query({query:()=>({url:"/api/v1/notifications/time-intervals"}),providesTags:["AlertmanagerConfiguration"]})})})},1895:(ee,B,e)=>{"use strict";e.d(B,{O5:()=>u,_y:()=>h,cc:()=>l});var t=e(75505),n=e(68143),r=e(24619),o=e(95443),s=e(52161),m=e(78467),a=e(77295);async function l(y){if(y===s.hY)return{application:"grafana",features:{rulerApiEnabled:!0}};const P=(0,s.of)(y);if(!P)throw new Error(`Cannot find data source configuration for ${y}`);const{url:d,name:D,type:b}=P;if(!d)throw new Error("The data source url cannot be empty.");if(!(0,s.cl)(b))throw new Error(`The build info request is not available for ${b}. Supported values are ${s.at.join()}.`);return f({name:D,url:d,type:b})}async function f(y){const{url:P,name:d,type:D}=y,b=D==="loki"?void 0:await x(P);if(!(b!==void 0)){if(!await g(d))throw new Error(`Unable to fetch alert rules. Is the ${d} data source properly configured?`);const S=await p(d);return{application:D==="loki"?"Loki":r.N1.Cortex,features:{rulerApiEnabled:S}}}const{features:v}=b.data;return v?{application:r.N1.Mimir,features:{rulerApiEnabled:v?.ruler_config_api==="true"}}:{application:r.N1.Prometheus,features:{rulerApiEnabled:!1}}}async function h(y){if(y===s.hY)return{lazyConfigInit:!1};const P=i(y),{url:d,type:D}=P;if(!d)throw new Error("The data source url cannot be empty.");if(D!=="alertmanager")throw new Error(`Alertmanager feature discovery is not available for ${D}. Only 'alertmanager' type is supported`);return await u(d)}async function u(y){try{return{lazyConfigInit:(await x(y))?.data?.application==="Grafana Mimir"}}catch{return{lazyConfigInit:!1}}}function i(y){const P=(0,s.oh)(y);if(!P)throw new Error(`Cannot find data source configuration for ${y}`);return P}async function x(y){return(await(0,t.s)((0,n.AI)().fetch({url:`${y}/api/v1/status/buildinfo`,showErrorAlert:!1,showSuccessAlert:!1})).catch(d=>{if(!("status"in d&&d.status===404))throw d}))?.data}async function g(y){try{return await(0,m.sA)(y),!0}catch{return!1}}async function p(y){try{return await(0,a.Zp)(y),!0}catch(P){if(c(P))return!1;throw P}}function c(y){return(0,n.NF)(y)?y.data.message?.includes("GetRuleGroup unsupported in rule local store")||y.data.message?.includes("page not found")||y.data.message?.includes(o.UU):y instanceof Error&&y.message?.includes("404 from rules config endpoint")}},55143:(ee,B,e)=>{"use strict";e.d(B,{L:()=>a,b:()=>m});var t=e(86791),n=e(24619),r=e(52161),o=e(5709),s=e(1895);const m={dataSourceName:"grafana",dataSourceUid:"grafana",apiVersion:"legacy"},a=o.H.injectEndpoints({endpoints:l=>({discoverAmFeatures:l.query({queryFn:async({amSourceName:f})=>{try{return{data:await(0,s._y)(f)}}catch(h){return{error:h}}}}),discoverDsFeatures:l.query({queryFn:async f=>{const h=(0,r.Iz)(f);
161if(!h)return{error:new Error(`Unable to find data source for ${JSON.stringify(f)}`)};if(h===t.l$)return{data:{name:r.hY,uid:r.hY,application:"grafana",rulerConfig:m}};const u=h?(0,r.of)(h):void 0;if(!u)return{error:new Error(`Missing data source configuration for ${f}`)};const i=await(0,s.cc)(u.uid),x=i.features.rulerApiEnabled?{dataSourceName:u.name,dataSourceUid:u.uid,apiVersion:i.application===n.N1.Cortex?"legacy":"config"}:void 0;return{data:{name:u.name,uid:u.uid,application:i.application,rulerConfig:x}}}})})})},77788:(ee,B,e)=>{"use strict";e.d(B,{Pc:()=>s,WG:()=>a,uz:()=>h});var t=e(68143),n=e(6135),r=e(182),o=e(5709);const s="grafana_alerting_v2";function m(u){return`/api/plugins/${(0,r.BO)()}/resources${u}`}const a=o.H.injectEndpoints({endpoints:u=>({grafanaOnCallIntegrations:u.query({query:()=>({url:m("/alert_receive_channels/"),params:{filters:!0,integration:[n.FI,"legacy_grafana_alerting"],skip_pagination:!0},showErrorAlert:!1}),transformResponse:i=>l(i)?i.results:i,providesTags:["OnCallIntegrations"]}),validateIntegrationName:u.query({query:i=>({url:m("/alert_receive_channels/validate_name/"),params:{verbal_name:i},showErrorAlert:!1})}),createIntegration:u.mutation({query:i=>({url:m("/alert_receive_channels/"),data:i,method:"POST",showErrorAlert:!0}),invalidatesTags:["OnCallIntegrations"]}),features:u.query({query:()=>({url:m("/features/"),showErrorAlert:!1})}),onCallConfigChecks:u.query({query:()=>({url:m("/organization/config-checks/"),showErrorAlert:!1})})})});function l(u){return"results"in u&&Array.isArray(u.results)}const{useGrafanaOnCallIntegrationsQuery:f}=a;function h(u){return(0,t.NF)(u)&&"detail"in u.data}},78467:(ee,B,e)=>{"use strict";e.d(B,{Dj:()=>h,JY:()=>u,Kw:()=>x,lH:()=>i,ou:()=>f,sA:()=>p});var t=e(1932),n=e(75505),r=e(68143),o=e(74268),s=e(24619),m=e(52161),a=e(29609);function l(c){const{dataSourceName:y,limitAlerts:P,identifier:d}=c;return{rules:(D,b,E)=>{const v=new URLSearchParams;y===m.hY&&P&&v.set("limit_alerts",String(P)),d&&((0,a.Mj)(d)||(0,a.X4)(d))&&(v.set("file",d.namespace),v.set("rule_group",d.groupName));const S={...f(D),...Object.fromEntries(v)};return{url:`/api/prometheus/${(0,m.w5)(y)}/api/v1/rules`,params:h(S,b,E)}}}}function f(c){const y={};return c?.dashboardUID&&(y.dashboard_uid=c.dashboardUID,c?.panelId&&(y.panel_id=String(c.panelId))),y}function h(c,y,P){let d={...c};if(y?.length&&(d={...d,state:y}),P?.length){const D=P.map(b=>JSON.stringify(b));d={...d,matcher:D}}return d}function u(c){return(0,t.jM)(c,y=>
161{y.rules.forEach(P=>{P.query=P.query||"",P.type===s.JS.Alerting&&(P.state||((0,o.fH)("prom rule with type=alerting is missing a state",{ruleName:P.name}),P.state=s.cF.Inactive))})})}const i=(c,y)=>{const P=c.map(u),d={};return P.forEach(D=>{d[D.file]?d[D.file].groups.push(D):d[D.file]={dataSourceName:y,name:D.file,groups:[D]}}),Object.values(d)},x=(c=[])=>c?.flatMap(y=>y.groups.flatMap(P=>g(P,y.name)));function g(c,y){return{name:c.name,file:y,rules:c.rules,interval:c.interval}}async function p(c,y,P,d,D,b){if(y?.dashboardUID&&c!==m.hY)throw new Error("Filtering by dashboard UID is only supported for Grafana Managed rules.");const{url:E,params:v}=l({dataSourceName:c,limitAlerts:P,identifier:b}).rules(y,D,d),C=await(0,n.s)((0,r.AI)().fetch({url:E,params:v,showErrorAlert:!1,showSuccessAlert:!1})).catch(S=>{throw"status"in S&&S.status===404?new Error("404 from rule state endpoint. Perhaps ruler API is not enabled?"):S});return i(C.data.data.groups,c)}},77295:(ee,B,e)=>{"use strict";e.d(B,{$o:()=>h,HO:()=>c,Zp:()=>p,iy:()=>x});var t=e(75505),n=e(28105),r=e(68143),o=e(55376),s=e(95443),m=e(52161),a=e(78467);const l="QUERY_NAMESPACE",f="QUERY_GROUP";function h(b){const E=i(b),v=u(b),C=b.apiVersion==="legacy"?"cortex":"mimir";return{rules:S=>({path:E,params:{subtype:C,...(0,a.ou)(S)}}),namespace:S=>{const{namespace:O,searchParams:I}=v.namespace(S);return{path:`${E}/${encodeURIComponent(O)}`,params:{subtype:C,...I}}},namespaceGroup:(S,O)=>{if(!S)throw new Error("Namespace UID is required to fetch ruler group");if(!O)throw new Error("Group name is required to fetch ruler group");const{namespace:I,searchParams:R}=v.namespace(S),{group:T,searchParams:L}=v.group(O);return{path:`${E}/${encodeURIComponent(I)}/${encodeURIComponent(T)}`,params:{subtype:C,...R,...L}}}}}function u(b){const E=b.dataSourceName===m.hY,v=C=>(0,o.Cl)(C)===!0?{group:f,searchParams:{group:C}}:{group:C,searchParams:{}};return E?{namespace:C=>({namespace:C,searchParams:{}}),group:v}:{namespace:C=>(0,o.Cl)(C)===!0?{namespace:l,searchParams:{namespace:C}}:{namespace:C,searchParams:{}},group:v}}function i(b){return`${`/api/ruler/${b.dataSourceUid}`}/api/v1/rules`}async function x(b,E){if(E?.dashboardUID&&b.dataSourceName!==m.hY)throw new Error("Filtering by dashboard UID is only supported by Grafana.");const{path:v,params:C}=h(b).rules(E);return y(v,{},C)}async function g(b,E){const{path:v,params:C}=h(b).namespace(E);return(await y(v,{},C))[E]||[]}async function p(b){return y(`/api/ruler/${(0,m.w5)(b)}/api/v1/rules/test/test`,null)}async function c(b,E,v){const{path:C,params:S}=h(b).namespaceGroup(E,v);return y(C,null,S)}async function y(b,E,v){try{return(await(0,t.s)((0,r.AI)().fetch({url:b,showErrorAlert:!1,showSuccessAlert:!1,params:v}))).data}catch(C){if(!P(C))throw C;if(D(C))return E;throw d(C)?{...C,data:{...C.data,message:s.UU}}:C}}function P(b){if(!(0,n.Gv)(b))return!1;const E="data"in b&&b.data!==null&&b.data!==void 0;return"status"in b&&Number.isFinite(b.status)&&E}function d(b){return b.status===404||b.status===500&&b.data.message?.includes("unexpected content type from upstream. expected YAML, got text/html")}function D(b){return b.status===404&&(b.data.message?.includes("group does not exist")||b.data.message?.includes("no rule groups found"))}},62939:(ee,B,e)=>{"use strict";e.d(B,{E:()=>r,R:()=>n});var t=e(68143);function n(o){if(r(o))return null;throw o}function r(o){return(0,t.NF)(o)&&o.status===404}},7840:(ee,B,e)=>{"use strict";e.d(B,{m:()=>g});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(55127),m=e.n(s),a=e(96540),l=e(63142),f=e(45861),h=e(48542),u=e(56840),i=e(39659),x=e(78793);const g=({labels:y,commonLabels:P={},size:d,onClick:D})=>{const b=(0,l.of)(c,d),[E,v]=(0,a.useState)(!1),C=(0,r.chain)(y).toPairs().reject(i.w0).reject(([R])=>E?!1:R in P).value(),S=Object.keys(P).length,O=S>0,I=(0,u.t)("alert-labels.button.show.tooltip","Show common labels");return(0,t.jsxs)("div",{className:b.wrapper,role:"list","aria-label":(0,u.t)("alerting.alert-labels.aria-label-labels","Labels"),children:[C.map(([R,T])=>(0,t.jsx)(x.J,{size:d,label:R,value:T,color:p(R),onClick:D},R+T)),!E&&O&&(0,t.jsxs)(f.$n,{variant:"secondary",fill:"text",onClick:()=>v(!0),tooltip:I,tooltipPlacement:"top",size:"sm",children:["+",S," common ",m()("label",S)]}),E&&O&&(0,t.jsx)(f.$n,{variant:"secondary",fill:"text",onClick:()=>v(!1),tooltipPlacement:"top",size:"sm",children:(0,t.jsx)(u.x6,{i18nKey:"alert-labels.button.hide",children:"Hide common labels"})})]})};function p(y){return(0,h.MC)(y).color}const c=(y,P)=>({wrapper:(0,n.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:P==="md"?y.spacing():y.spacing(.5)})})},36826:(ee,B,e)=>{"use strict";e.d(B,{d:()=>b,y:()=>E});
161var t=e(74848),n=e(87586),r=e(13791),o=e(5358),s=e(22803),m=e(96540),a=e(63142),l=e(18027),f=e(18857),h=e(72508),u=e(52161);function i(S){return S.name===u.hY?"Grafana":S.name}const x=({disabled:S=!1})=>{const O=(0,a.of)(g),{selectedAlertmanager:I,availableAlertManagers:R,setSelectedAlertmanager:T}=(0,o.VI)(),L=(0,m.useMemo)(()=>R.map(W=>({label:i(W),value:W.name,imgUrl:W.imgUrl,meta:W.meta})),[R]),K=S||L.length===1,A=K?"Alertmanager":"Choose Alertmanager";return(0,t.jsx)(l.I,{className:O.field,label:A,disabled:K,"data-testid":"alertmanager-picker",children:(0,t.jsx)(f.l6,{"aria-label":A,width:29,className:"ds-picker select-container",backspaceRemovesValue:!1,onChange:W=>{W?.value&&T(W.value)},options:L,noOptionsMessage:"No datasources found",value:I,getOptionLabel:W=>W.label,components:{Option:p}})})},g=S=>({field:(0,s.css)({margin:0})}),p=S=>(0,t.jsx)(h.o5,{...S,renderOptionLabel:({label:O})=>(0,t.jsx)("div",{style:{whiteSpace:"pre-line"},children:O})});var c=e(34999),y=e(56840);const P=()=>(0,t.jsx)(c.F,{title:(0,y.t)("alerting.no-alert-managers-available.title-no-alertmanager-found","No Alertmanager found"),severity:"warning",children:"We could not find any external Alertmanagers and you may
161not have access to the built-in Grafana Alertmanager."}),d=()=>(0,t.jsx)(c.F,{title:(0,y.t)("alerting.other-alert-managers-available.title-selected-alertmanager-not-found","Selected Alertmanager not found."),severity:"warning",children:"The selected Alertmanager no longer exists or you may not have permission to access it. You can select a different Alertmanager from the dropdown."}),D=({availableAlertManagers:S})=>{const O=S.length>0;return(0,t.jsx)("div",{children:O?(0,t.jsx)(d,{}):(0,t.jsx)(P,{})})},b=({children:S,isLoading:O,...I})=>(0,t.jsx)(r.Y,{...I,children:(0,t.jsx)(r.Y.Contents,{isLoading:O,children:S})}),E=({children:S,accessType:O,...I})=>{const R=v();return(0,t.jsx)(o.b9,{accessType:O,children:(0,t.jsx)(b,{...I,actions:(0,t.jsx)(x,{disabled:R}),children:(0,t.jsx)(C,{children:S})})})};function v(){const S=(0,n.A)();return["/edit","/new"].some(I=>S?.pathname?.includes(I))}const C=({children:S})=>{const{availableAlertManagers:O,selectedAlertmanager:I}=(0,o.VI)();return I?(0,t.jsx)(t.Fragment,{children:S}):(0,t.jsx)(D,{availableAlertManagers:O})}},83750:(ee,B,e)=>{"use strict";e.d(B,{s:()=>u});var t=e(74848),n=e(22803),r=e(45967),o=e(63142),s=e(89640),m=e(95443),a=e(40165),l=e(9368),f=e(16591);const h=["message","description"],u=({annotationKey:g,value:p,valueLink:c})=>{const y=g,P=m.J3[y]?(0,t.jsx)(r.m,{content:g,placement:"top",theme:"info",children:(0,t.jsx)("span",{children:m.J3[y]})}):g;return(0,t.jsx)(a.X,{label:P,horizontal:!0,children:(0,t.jsx)(i,{annotationKey:g,value:p,valueLink:c})})},i=({annotationKey:g,value:p,valueLink:c})=>{const y=(0,o.of)(x),P=h.includes(g),d=p&&p.startsWith("http"),D=(0,t.jsx)(l.Y,{input:p,delimiter:["{{","}}"]});return c?(0,t.jsx)(s.Y,{href:c,external:!0,children:p}):P?(0,t.jsx)(f.L,{className:y.well,children:D}):d?(0,t.jsx)(s.Y,{href:p,external:!0,children:p}):(0,t.jsx)(t.Fragment,{children:D})},x=g=>({well:(0,n.css)({wordBreak:"break-word"})})},10427:(ee,B,e)=>{"use strict";e.d(B,{A:()=>r});var t=e(96540);function n({children:o,shouldWrap:s,wrap:m},a){return s?(0,t.cloneElement)(m(o)):o}const r=(0,t.forwardRef)(n)},40165:(ee,B,e)=>{"use strict";e.d(B,{X:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({className:m,label:a,horizontal:l,children:f,childrenWrapperClassName:h})=>{const u=(0,r.of)(s);return(0,t.jsxs)("div",{className:(0,n.cx)(u.field,l?u.fieldHorizontal:u.fieldVertical,m),children:[(0,t.jsx)("div",{children:a}),(0,t.jsx)("div",{className:h,children:f})]})},s=m=>({fieldHorizontal:(0,n.css)({flexDirection:"row",[m.breakpoints.down("md")]:{flexDirection:"column"}}),fieldVertical:(0,n.css)({flexDirection:"column"}),field:(0,n.css)({display:"flex",margin:`${m.spacing(2)} 0`,"& > div:first-child":{width:"110px",paddingRight:m.spacing(1),fontSize:m.typography.size.sm,fontWeight:m.typography.fontWeightBold,lineHeight:1.8},"& > div:nth-child(2)":{flex:1,color:m.colors.text.secondary}})})},6106:(ee,B,e)=>{"use strict";e.d(B,{E:()=>h});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(63142),m=e(76319),a=e(34213),l=e(74048),f=e(18771);const h=({cols:i,items:x,isExpandable:g=!1,onCollapse:p,onExpand:c,isExpanded:y,renderExpandedContent:P,testIdGenerator:d,pagination:D,paginationStyles:b,renderPrefixCell:E,renderPrefixHeader:v,footerRow:C,dataTestId:S})=>{const O=(0,s.of)(f.H);if((p||c||y)&&!(p&&c&&y))throw new Error("either all of onCollapse, onExpand, isExpanded must be provided, or none");if((g||P)&&!(g&&P))throw new Error("either both isExpanded and renderExpandedContent must be provided, or neither");const I=(0,s.of)(u(i,g,!!v)),[R,T]=(0,r.useState)([]),L=j=>{y&&p&&c?y(j)?p(j):c(j):T(R.includes(j.id)?R.filter(V=>V!==j.id):[...R,j.id])},K=D?.itemsPerPage??x.length,{page:A,numberOfPages:W,onPageChange:N,pageItems:w}=(0,l.W)(x,1,K);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:I.container,"data-testid":S??"dynamic-table",children:[(0,t.jsxs)("div",{className:I.row,"data-testid":"header",children:[v&&v(),g&&(0,t.jsx)("div",{className:I.cell()}),i.map(j=>(0,t.jsx)("div",{className:I.cell(j.alignColumn),children:j.label},j.id))]}),w.map((j,V)=>
161{const U=y?y(j):R.includes(j.id);return(0,t.jsxs)("div",{className:I.row,"data-testid":d?.(j,V)??"row",children:[E&&E(j,V,x),g&&(0,t.jsx)("div",{className:(0,n.cx)(I.cell(),I.expandCell),children:(0,t.jsx)(m.K,{tooltip:`${U?"Collapse":"Expand"} row`,"data-testid":o.Tp.components.AlertRules.toggle,name:U?"angle-down":"angle-right",onClick:()=>L(j)})}),i.map(F=>(0,t.jsx)("div",{className:(0,n.cx)(I.cell(F.alignColumn),I.bodyCell,F.className),"data-column":F.label,children:F.renderCell(j,V)},`${j.id}-${F.id}`)),U&&P&&(0,t.jsx)("div",{className:I.expandedContentRow,"data-testid":o.Tp.components.AlertRules.expandedContent,children:P(j,V,x)})]},`${j.id}-${V}`)}),C&&(0,t.jsx)("div",{className:(0,n.cx)(I.row,I.footerRow),children:C})]}),D&&(0,t.jsx)(a.d,{className:(0,n.cx)(O,b),currentPage:A,numberOfPages:W,onNavigate:N,hideWhenSinglePage:!0})]})},u=(i,x,g)=>{const p=i.map(c=>c.size?typeof c.size=="number"?`${c.size}fr`:c.size:"auto");return x&&p.unshift("calc(1em + 16px)"),g&&p.unshift("0"),c=>({container:(0,n.css)({border:`1px solid ${c.colors.border.weak}`,borderRadius:c.shape.radius.default,color:c.colors.text.secondary}),row:(0,n.css)({display:"grid",gridTemplateColumns:p.join(" "),gridTemplateRows:"1fr auto","&:nth-child(2n + 1)":{backgroundColor:c.colors.background.secondary},"&:nth-child(2n)":{backgroundColor:c.colors.background.primary},[c.breakpoints.down("sm")]:{gridTemplateColumns:"auto 1fr",gridTemplateAreas:"left right",padding:`0 ${c.spacing(.5)}`,"&:first-child":{display:"none"},"& > *:first-child":{display:g?"none":void 0}}}),footerRow:(0,n.css)({display:"flex",padding:c.spacing(1)}),cell:y=>(0,n.css)({display:"flex",alignItems:"center",padding:c.spacing(1),justifyContent:y||"initial",[c.breakpoints.down("sm")]:{padding:`${c.spacing(1)} 0`,gridTemplateColumns:"1fr"}}),bodyCell:(0,n.css)({overflow:"hidden",[c.breakpoints.down("sm")]:{gridColumnEnd:"right",gridColumnStart:"right","&::before":{content:"attr(data-column)",display:"block",color:c.colors.text.primary}}}),expandCell:(0,n.css)({justifyContent:"center",[c.breakpoints.down("sm")]:{alignItems:"start",gridArea:"left"}}),expandedContentRow:(0,n.css)({gridColumnEnd:p.length+1,gridColumnStart:g?3:2,gridRow:2,padding:`0 ${c.spacing(3)} 0 ${c.spacing(1)}`,position:"relative",[c.breakpoints.down("sm")]:{gridColumnStart:2,borderTop:`1px solid ${c.colors.border.strong}`,gridRow:"auto",padding:`${c.spacing(1)} 0 0 0`}})})}},57487:(ee,B,e)=>{"use strict";e.d(B,{B:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(6106);const s=({renderExpandedContent:a,...l})=>{const f=(0,r.of)(m);return(0,t.jsx)(o.E,{renderExpandedContent:a?(h,u,i)=>(0,t.jsxs)(t.Fragment,{children:[u!==i.length-1&&(0,t.jsx)("div",{className:(0,n.cx)(f.contentGuideline,f.guideline)}),a(h,u,i)]}):void 0,renderPrefixHeader:()=>(0,t.jsx)("div",{className:f.relative,children:(0,t.jsx)("div",{className:(0,n.cx)(f.headerGuideline,f.guideline)})}),renderPrefixCell:(h,u,i)=>(0,t.jsxs)("div",{className:f.relative,children:[(0,t.jsx)("div",{className:(0,n.cx)(f.topGuideline,f.guideline)}),u!==i.length-1&&(0,t.jsx)("div",{className:(0,n.cx)(f.bottomGuideline,f.guideline)})]}),...l})},m=a=>({relative:(0,n.css)({position:"relative",height:"100%"}),guideline:(0,n.css)({left:"-19px",borderLeft:`1px solid ${a.colors.border.weak}`,position:"absolute",[a.breakpoints.down("md")]:{display:"none"}}),topGuideline:(0,n.css)({width:"18px",borderBottom:`1px solid ${a.colors.border.medium}`,top:0,bottom:"50%"}),bottomGuideline:(0,n.css)({top:"50%",bottom:0}),contentGuideline:(0,n.css)({top:0,bottom:0,left:"-49px !important"}),headerGuideline:(0,n.css)({top:"-17px",bottom:0})})},58750:(ee,B,e)=>{"use strict";e.d(B,{M:()=>h});var t=e(74848),n=e(22803),r=e(63142),o=e(34999),s=e(56840),m=e(84266),a=e(91984),l=e(16692),f=e(52161);function h({currentAlertmanager:i}){const x=(0,r.of)(u),g=i!==f.hY,[p,c]=(0,l.Ej)(l.RY.ReadConfigurationStatus),y=p&&c,{currentData:P}=a.m.endpoints.getGrafanaAlertingConfigurationStatus.useQuery(void 0,{skip:g||!y});if(!(P?.alertmanagersChoice&&[m.nA.External,m.nA.All].includes(P?.alertmanagersChoice))||g)return null;const D=P.numExternalAlertmanagers>0;return P.alertmanagersChoice===m.nA.External?(0,t.jsxs)(o.F,{title:(0,s.t)("alerting.grafana-alertmanager-delivery-warning.title-grafana-alerts-delivered-alertmanager","Grafana alerts are not delivered to Grafana Alertmanager"),children:["Grafana is configured to send alerts to external Alertmanagers only. Changing Grafana Alertmanager configuration will not affect delivery of your alerts.",(0,t.jsx)("div",{className:x.adminHint,children:"To change your Alertmanager setup, go to the Alerting Admin page. If you do not have access, contact your Administrator."})]}):P.alertmanagersChoice===m.nA.All&&D?(0,t.jsxs)(o.F,{title:(0,s.t)("alerting.grafana-alertmanager-delivery-warning.title-you-have-additional-alertmanagers-to-configure","You have additional Alertmanagers to configure"),severity:"warning",children:["Ensure you make configuration changes in the correct Alertmanagers; both internal and external. Changing one will not affect the others.",(0,t.jsx)("div",{className:x.adminHint,children:"To change your Alertmanager setup, go to the Alerting Admin page. If you do not have access, contact your Administrator."})]}):null}const u=i=>({adminHint:(0,n.css)({fontSize:i.typography.bodySmall.fontSize,fontWeight:i.typography.bodySmall.fontWeight})})},38055:(ee,B,e)=>{"use strict";e.d(B,{B:()=>h});var t=e(74848),n=e(22803),r=e(46942),o=e.n(r),s=e(96540),m=e(63142),a=e(41654),l=e(43533),f=e(2381);
161const h=({children:i,header:x,content:g,footer:p,arrow:c,showAfter:y=300,wrapperClassName:P,disabled:d=!1,showOn:D="hover",...b})=>{const E=(0,s.useRef)(null),v=(0,m.of)(u);if(d)return i;const C=D==="hover",S=D==="click",O=(0,t.jsxs)(a.B,{direction:"column",gap:0,role:"tooltip",children:[x&&(0,t.jsx)("div",{className:v.card.header,children:x}),(0,t.jsx)("div",{className:v.card.body,children:g}),p&&(0,t.jsx)("div",{className:v.card.footer,children:p})]});return(0,t.jsx)(l.I,{content:O,hideAfter:100,children:(I,R,T)=>{const L={onClick:I},K={onMouseLeave:R,onMouseEnter:I},A={onBlur:R,onFocus:I};return(0,t.jsxs)(t.Fragment,{children:[E.current&&(0,t.jsx)(f.A,{...T,...b,wrapperClassName:o()(v.popover,P),referenceElement:E.current,renderArrow:c,...A,...C?K:{}}),(0,s.cloneElement)(i,{ref:E,onFocus:I,onBlur:R,tabIndex:0,...C?K:{},...S?L:{}})]})}})},u=i=>({popover:(0,n.css)({borderRadius:i.shape.radius.default,boxShadow:i.shadows.z3,background:i.colors.background.primary,border:`1px solid ${i.colors.border.weak}`}),card:{body:(0,n.css)({padding:i.spacing(1)}),header:(0,n.css)({padding:i.spacing(1),background:i.colors.background.secondary,borderBottom:`solid 1px ${i.colors.border.medium}`}),footer:(0,n.css)({padding:i.spacing(.5,1),background:i.colors.background.secondary,borderTop:`solid 1px ${i.colors.border.medium}`})}})},85311:(ee,B,e)=>{"use strict";e.d(B,{A:()=>s});var t=e(74848),n=e(34999),r=e(56840);const s=()=>(0,t.jsx)(n.F,{severity:"info",title:(0,r.t)("alerting.alert.evaluation-paused","Alert evaluation currently paused"),children:(0,t.jsx)(r.x6,{i18nKey:"alerting.alert.evaluation-paused-description",children:"Notifications for this rule will not fire and no alert instances will be created until the rule is un-paused."})})},78793:(ee,B,e)=>{"use strict";e.d(B,{J:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(84140),s=e(63142),m=e(41654),a=e(30703);const l=({label:h,value:u,icon:i,color:x,size:g="md",onClick:p})=>{const c=(0,s.of)(f,x,g),y=`${h}: ${u}
161`,P=h?.toString()??"",d=u?.toString()??"",D=(0,r.useMemo)(()=>(0,t.jsxs)(m.B,{direction:"row",gap:0,alignItems:"stretch",children:[(0,t.jsx)("div",{className:c.label,children:(0,t.jsxs)(m.B,{direction:"row",gap:.5,alignItems:"center",children:[i&&(0,t.jsx)(a.I,{name:i}),h&&(0,t.jsx)("span",{className:c.labelText,title:h.toString(),children:h??""})]})}),(0,t.jsx)("div",{className:c.value,title:u?.toString(),children:u??"-"})]}),[i,h,u,c]);return(0,t.jsx)("div",{className:c.wrapper,role:"listitem","aria-label":y,"data-testid":"label-value",children:p?(0,t.jsx)("div",{className:c.clickable,role:"button",tabIndex:0,onClick:()=>p(P,d),onKeyDown:b=>{b.key==="Enter"&&(p(P,d),b.preventDefault())},children:D},P+d):D})},f=(h,u,i)=>{const x=u??h.colors.secondary.main,g=h.isDark?(0,o.A)(x).lighten(5).toString():(0,o.A)(x).darken(5).toString(),p=h.isDark?(0,o.A)(x).darken(5).toString():(0,o.A)(x).lighten(5).toString(),c=u?o.A.mostReadable(x,["#000","#fff"]).toString():h.colors.text.primary;let y=h.spacing(.33,1);switch(i){case"sm":y=h.spacing(.2,.6);break;case"xs":y=h.spacing(0,.5);break;default:break}return{wrapper:(0,n.css)({color:c,fontSize:h.typography.bodySmall.fontSize,borderRadius:h.shape.borderRadius(2)}),labelText:(0,n.css)({whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"300px"}),label:(0,n.css)({display:"flex",alignItems:"center",color:"inherit",padding:y,background:x,border:`solid 1px ${g}`,borderTopLeftRadius:h.shape.borderRadius(2),borderBottomLeftRadius:h.shape.borderRadius(2)}),clickable:(0,n.css)({"&:hover":{opacity:.8,cursor:"pointer"}}),value:(0,n.css)({color:"inherit",padding:y,background:p,border:`solid 1px ${g}`,borderLeft:"none",borderTopRightRadius:h.shape.borderRadius(2),borderBottomRightRadius:h.shape.borderRadius(2),whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"300px"})}}},50072:(ee,B,e)=>{"use strict";e.d(B,{A:()=>a});var t=e(74848),n=e(96540),r=e(45861),o=e(41654),s=e(30703);const a=(0,n.forwardRef)(function(f,h){return(0,t.jsx)(r.$n,{variant:"secondary",size:"sm",type:"button","aria-label":"More",ref:h,...f,children:(0,t.jsxs)(o.B,{direction:"row",alignItems:"center",gap:0,children:["More ",(0,t.jsx)(s.I,{name:"angle-down"})]})})})},28405:(ee,B,e)=>{"use strict";e.d(B,{h:()=>o});var t=e(74848),n=e(3986);const r=({children:s,plugin:m,loadingComponent:a,notInstalledFallback:l})=>{const{loading:f,installed:h}=usePluginBridge(m);return f?a??null:h?jsx(Fragment,{children:s}):l??null};function o(s,m,a){const l=new URLSearchParams(a).toString();return`/a/${s}${m}`+(l?"?"+l:"")}},1972:(ee,B,e)=>{"use strict";e.d(B,{Yi:()=>a,hk:()=>m,rS:()=>l});var t=e(74848),n=e(34999),r=e(99887),o=e(45967),s=e(56840),m=(f=>(f.ContactPoint="contact point",f.Template="template",f.MuteTiming="mute timing",f.AlertRule="alert rule",f.RootNotificationPolicy="root notification policy",f))(m||{});const a=({resource:f,...h})=>(0,t.jsxs)(n.F,{title:`This ${f} cannot be edited through the UI`,severity:"info",...h,children:["This ",f," has been provisioned, that means it was created by config. Please contact your server admin to update this ",f,"."]}),l=({tooltip:f,provenance:h})=>{const u=(0,t.jsx)(r.E,{text:(0,s.t)("alerting.provisioning-badge.badge.text-provisioned","Provisioned"),color:"purple"});if(f){const i=(0,t.jsxs)(s.x6,{i18nKey:"alerting.provisioning.badge-tooltip-provenance",values:{provenance:h},children:["This resource has been provisioned via ",{provenance:h}," and cannot be edited through the UI"]}),x=(0,t.jsx)(s.x6,{i18nKey:"alerting.provisioning.badge-tooltip-standard",children:"This resource has been provisioned and cannot be edited through the UI"}),g=h?i:x;return(0,t.jsx)(o.m,{content:g,children:(0,t.jsx)("span",{children:u})})}return u}},40360:(ee,B,e)=>{"use strict";e.d(B,{c:()=>o});var t=e(74848),n=e(66404),r=e(30703);const o=({namespace:s,group:m})=>m?(0,t.jsxs)(n.E,{element:"h3",variant:"body",children:[s," ",(0,t.jsx)(r.I,{name:"angle-right","aria-label":">"})," ",m]}):(0,t.jsx)(n.E,{element:"h3",variant:"body",children:s})},49779:(ee,B,e)=>{"use strict";e.d(B,{h:()=>r});var t=e(74848),n=e(22803);const r=()=>(0,t.jsx)("span",{className:(0,n.css)({flex:1})})},67834:(ee,B,e)=>{"use strict";e.d(B,{O:()=>s});var t=e(74848),n=e(22803),r=e(96540),o=e(63142);const s=(0,r.forwardRef)(({children:a,state:l,size:f="md",muted:h=!1},u)=>{const i=(0,o.of)(m);return(0,t.jsx)("span",{className:(0,n.cx)(i.common,i[l],i[f],{[i.muted]:h}),ref:u,children:a||l})});s.displayName="StateTag";const m=a=>({common:(0,n.css)({display:"inline-block",color:"white",borderRadius:a.shape.radiu
161s.default,fontSize:a.typography.size.sm,textTransform:"capitalize",lineHeight:"1.2",textAlign:"center",fontWeight:a.typography.fontWeightBold}),good:(0,n.css)({backgroundColor:a.colors.success.main,border:`solid 1px ${a.colors.success.main}`,color:a.colors.success.contrastText}),warning:(0,n.css)({backgroundColor:a.colors.warning.main,border:`solid 1px ${a.colors.warning.main}`,color:a.colors.warning.contrastText}),bad:(0,n.css)({backgroundColor:a.colors.error.main,border:`solid 1px ${a.colors.error.main}`,color:a.colors.error.contrastText}),neutral:(0,n.css)({backgroundColor:a.colors.secondary.main,border:`solid 1px ${a.colors.secondary.main}`,color:a.colors.secondary.contrastText}),info:(0,n.css)({backgroundColor:a.colors.primary.main,border:`solid 1px ${a.colors.primary.main}`,color:a.colors.primary.contrastText}),md:(0,n.css)({padding:a.spacing(.5,1),minWidth:a.spacing(8)}),sm:(0,n.css)({padding:a.spacing(.3,.5),minWidth:"52px"}),muted:(0,n.css)({opacity:"0.5"})})},9368:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>l});var t=e(74848),n=e(22803),r=e(63142),o=e(99887),s=e(38055),m=e(56652);const a=["$",".",'"'];function l({input:c,delimiter:y=["{{","}}"]}){const P=(0,r.of)(p),[d,D]=y,b=new RegExp(`(?<before>.*?)(${d}(?<token>.*?)${D}|$)`,"gm"),E=c.split(` 162`),v=[];return E.forEach((C,S)=>{Array.from(C.matchAll(b)).forEach((I,R)=>{const T=I.groups?.before,L=I.groups?.token?.trim();if(T&&v.push((0,t.jsx)("span",{children:T},`${S}-${R}-before`)),L){const K=g(L),A=K==="variable"?L:"",W=`${d} ${L} ${D}`;v.push((0,t.jsx)(h,{content:W,type:K,description:A},`${S}-${R}-token`))}}),v.push((0,t.jsx)("br",{},`${S}-newline`))}),(0,t.jsx)("span",{className:P.wrapper,children:v})}var f=(c=>(c.Variable="variable",c.Function="function",c.Keyword="keyword",c.Unknown="unknown",c))(f||{});function h({content:c,description:y,type:P}){const d=(0,r.of)(p),D=!P;return(0,t.jsx)(s.B,{placement:"top-start",disabled:D,content:(0,t.jsxs)("div",{className:d.hoverTokenItem,children:[(0,t.jsx)(o.E,{tabIndex:0,text:(0,t.jsx)(t.Fragment,{children:P}),color:"blue"})," ",y&&(0,t.jsx)("code",{children:y})]}),children:(0,t.jsx)("span",{children:(0,t.jsx)(o.E,{tabIndex:0,className:d.token,text:c,color:"blue"})})})}function u(c){return a.some(y=>c.startsWith(y))}function i(c){return m.keywords.some(y=>c.startsWith(y))}function x(c){return m.builtinFunctions.some(y=>c.startsWith(y))}function g(c){let y;return u(c)?y="variable":i(c)?y="keyword":x(c)?y="function":y="unknown",y}const p=c=>({wrapper:(0,n.css)({whiteSpace:"pre-wrap"}),token:(0,n.css)({cursor:"default",fontFamily:c.typography.fontFamilyMonospace}),popover:(0,n.css)({borderRadius:c.shape.radius.default,boxShadow:c.shadows.z3,background:c.colors.background.primary,border:`1px solid ${c.colors.border.medium}`,padding:c.spacing(1)}),hoverTokenItem:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"center",gap:c.spacing(1)})})},16591:(ee,B,e)=>{"use strict";e.d(B,{L:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({children:m,className:a})=>{const l=(0,r.of)(s);return(0,t.jsx)("div",{className:(0,n.cx)(l.wrapper,a),children:m})},s=m=>({wrapper:(0,n.css)({backgroundColor:m.components.panel.background,border:`solid 1px ${m.components.input.borderColor}`,borderRadius:m.shape.radius.default,padding:m.spacing(.5,1),fontFamily:m.typography.fontFamilyMonospace})})},2401:(ee,B,e)=>{"use strict";e.d(B,{d:()=>r});var t=e(96540),n=e(41071);const r=({component:o,title:s="previous page"})=>{const m=(0,n.i)(),a=(0,t.useCallback)(()=>{m(s)},[m,s]);return(0,t.cloneElement)(o,{onClick:a})}},87133:(ee,B,e)=>{"use strict";e.d(B,{X:()=>p});var t=e(74848),n=e(22803),r=e(96540),o=e(40996),s=e(63142),m=e(30703),a=e(37386),l=e(72636),f=e(41654),h=e(45967),u=e(63527),i=e(56840),x=e(74268),g=e(63895);const p=({onFilterChange:y,defaultQueryString:P})=>{const d=(0,s.of)(c),[D,b]=(0,r.useState)(P??"");(0,o.A)(()=>{(0,x.fH)(x.le.filterByLabel),y(D)},600,[D]);const E=(0,t.jsx)(m.I,{name:"search"});let v=!!(P&&P.length>=3);try{P?(0,g.S6)(P):v=!0}catch{v=!1}return(0,t.jsx)(a.D,{className:d.fixMargin,invalid:!v,error:v?null:"Query must use valid matcher syntax. See the examples in the help tooltip.",label:(0,t.jsx)(l.J,{children:(0,t.jsxs)(f.B,{gap:.5,alignItems:"center",children:[(0,t.jsx)("span",{children:(0,t.jsx)(i.x6,{i18nKey:"alerting.matcher-filter.search-by-label",children:"Search by label"})}),(0,t.jsx)(h.m,{content:(0,t.jsxs)("div",{children:["Filter alerts using label querying without spaces, ex:",(0,t.jsx)("pre",{children:'{severity="critical", instance=~"cluster-us-.+"}'}
162),"Invalid use of spaces:",(0,t.jsx)("pre",{children:'{severity= "critical"}'}),(0,t.jsx)("pre",{children:'{severity ="critical"}'}),"Valid use of spaces:",(0,t.jsx)("pre",{children:'{severity=" critical"}'}),"Filter alerts using label querying without braces, ex:",(0,t.jsx)("pre",{children:'severity="critical", instance=~"cluster-us-.+"'})]}),children:(0,t.jsx)(m.I,{name:"info-circle",size:"sm"})})]})}),children:(0,t.jsx)(u.p,{placeholder:(0,i.t)("alerting.matcher-filter.search-query-input-placeholder-search","Search"),value:D,onChange:C=>b(C.currentTarget.value),"data-testid":"search-query-input",prefix:E,className:d.inputWidth})})},c=y=>({fixMargin:(0,n.css)({marginBottom:0}),inputWidth:(0,n.css)({width:340,flexGrow:0})})},3887:(ee,B,e)=>{"use strict";e.d(B,{MX:()=>n,sW:()=>r,v4:()=>t});const t=Symbol("receiver_status"),n=Symbol("receiver_metadata"),r=Symbol("receiver_plugin_metadata")},76070:(ee,B,e)=>{"use strict";e.d(B,{PE:()=>n,w6:()=>o});var t=e(96673);const n=[t.AccessControlAction.AlertingReceiversRead],r=[t.AccessControlAction.AlertingReceiversCreate,t.AccessControlAction.AlertingReceiversWrite],o=[...n,...r]},97507:(ee,B,e)=>{"use strict";e.d(B,{dK:()=>H,Kt:()=>te,$x:()=>_,om:()=>M,Z3:()=>V,Pm:()=>Y,cB:()=>Q});var t=e(2543),n=e(96540),r=e(5709);const o=["Receiver"],m=r.H.enhanceEndpoints({addTagTypes:o}).injectEndpoints({endpoints:J=>({listNamespacedReceiver:J.query({query:q=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${q.namespace}/receivers`,params:{pretty:q.pretty,allowWatchBookmarks:q.allowWatchBookmarks,continue:q.continue,fieldSelector:q.fieldSelector,labelSelector:q.labelSelector,limit:q.limit,resourceVersion:q.resourceVersion,resourceVersionMatch:q.resourceVersionMatch,sendInitialEvents:q.sendInitialEvents,timeoutSeconds:q.timeoutSeconds,watch:q.watch}}),providesTags:["Receiver"]}),createNamespacedReceiver:J.mutation({query:q=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${q.namespace}/receivers`,method:"POST",body:q.comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1Receiver,params:{pretty:q.pretty,dryRun:q.dryRun,fieldManager:q.fieldManager,fieldValidation:q.fieldValidation}}),invalidatesTags:["Receiver"]}),readNamespacedReceiver:J.query({query:q=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${q.namespace}/receivers/${q.name}`,params:{pretty:q.pretty}}),providesTags:["Receiver"]}),replaceNamespacedReceiver:J.mutation({query:q=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${q.namespace}/receivers/${q.name}`,method:"PUT",body:q.comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1Receiver,params:{pretty:q.pretty,dryRun:q.dryRun,fieldManager:q.fieldManager,fieldValidation:q.fieldValidation}}),invalidatesTags:["Receiver"]}),deleteNamespacedReceiver:J.mutation({query:q=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${q.namespace}/receivers/${q.name}`,method:"DELETE",body:q.ioK8SApimachineryPkgApisMetaV1DeleteOptions,params:{pretty:q.pretty,dryRun:q.dryRun,gracePeriodSeconds:q.gracePeriodSeconds,orphanDependents:q.orphanDependents,propagationPolicy:q.propagationPolicy}}),invalidatesTags:["Receiver"]})}),overrideExisting:!1}).enhanceEndpoints({endpoints:{createNamespacedReceiver:{invalidatesTags:["Receiver","ContactPoint","ContactPointsStatus","AlertmanagerConfiguration"]},deleteNamespacedReceiver:J=>{const q=J.query;J.query=(...X)=>{const se=q(...X);return se.headers={"content-type":"application/json"},se}},readNamespacedReceiver:J=>{const q={hideErrorMessage:!0};J.extraOptions=q}}});var a=e(53226),l=e(51740),f=e(52161),h=e(56476),u=e(85618),i=e(91984),x=e(77788),g=e(80218),p=e(3986),c=e(43100),y=e(15518),P=e(182),d=e(66056);const D=10*1e3,{useGetAlertmanagerConfigurationQuery:b,useGetContactPointsListQuery:E,useGetContactPointsStatusQuery:v,useGrafanaNotifiersQuery:C,useLazyGetAlertmanagerConfigurationQuery:S}=i.m,{useGrafanaOnCallIntegrationsQuery:O}=x.WG,{useListNamespacedReceiverQuery:I,useReadNamespacedReceiverQuery:R,useDeleteNamespacedReceiverMutation:T,useCreateNamespacedReceiverMutation:L,useReplaceNamespacedReceiverMutation:K}=m,A={refetchOnFocus:!0,refetchOnReconnect:!0},W=({skip:J}={})=>{const{installed:q,loading:X}=(0,p._)((0,P.BO)()),se=O(void 0,{skip:J||!q});return(0,n.useMemo)(()=>q?se:{isLoading:X,data:void 0},[q,X,se])},N=J=>({id:J.metadata.name||J.metadata.uid||J.spec.title,name:J.spec.title,provisioned:(0,h.Uo)(J),grafana_managed_receiver_configs:J.spec.integrations,metadata:J.metadata}),w=(...[J,q])=>I(J,{...q,selectFromResult:X=>{const se=X.data?.items.map(oe=>N(oe));return{...X,data:X.error?[]:se,currentData:se}}}),j=({skip:J}={})=>{const q=(0,u.G)(),X=(0,h.dM)(f.hY),se=E(void 0,{skip:J||X,selectFromResult:ae=>{const ie=ae.data?.map(fe=>({...fe,provisioned:fe.grafana_managed_receiver_configs?.some(pe=>pe.provenance)}));return{...ae,data:ie,currentData:ie}}}),oe=w({namespace:q},{skip:J||!X});return X?oe:se},V=({fetchStatuses:J,fetchPolicies:q,skip:X}={})=>{const se={skip:X},oe=W(se),ae=C(void 0,se),ie=j(se),fe=v(void 0,{...A,pollingInterval:D,skip:X||!J}),pe=b(f.hY,{skip:X||!q});return(0,n.useMemo)(()=>
162{if(oe.isLoading||ae.isLoading||ie.isLoading)return{...ie,isLoading:!0,contactPoints:[]};const le=(0,d.Rm)({status:fe.data,notifiers:ae.data,onCallIntegrations:oe?.data,contactPoints:ie.data||[],alertmanagerConfiguration:pe.data});return{...ie,contactPoints:le}},[ae,pe,ie,fe,oe])},U=({alertmanager:J,name:q},X)=>b(J,{...X,selectFromResult:se=>{const oe=se.data?.alertmanager_config.receivers?.find(ae=>ae.name===q);return{...se,data:oe,currentData:oe}}}),F=({name:J},q)=>{const X=(0,u.G)(),se=(0,h.dM)(f.hY),oe=R({namespace:X,name:J},{...q,selectFromResult:ie=>{const fe=ie.data?N(ie.data):void 0;return{...ie,data:fe,currentData:fe}},skip:q?.skip||!se}),ae=U({alertmanager:f.hY,name:J},{skip:q?.skip||se});return se?oe:ae},M=({alertmanager:J,name:q})=>{const X=J===f.hY,se=F({name:q},{skip:!X}),oe=U({alertmanager:J,name:q},{skip:X});return X?se:oe};function H({alertmanager:J,fetchStatuses:q,fetchPolicies:X,skip:se}){const oe=J===f.hY,ae=V({skip:se||!oe,fetchStatuses:q,fetchPolicies:X}),ie=b(J,{...A,selectFromResult:fe=>({...fe,contactPoints:fe.data?(0,d.Rm)({notifiers:l.r,contactPoints:fe.data.alertmanager_config.receivers??[],alertmanagerConfiguration:fe.data}):[]}),skip:se||oe});return oe?ae:ie}function _({alertmanager:J}){const q=(0,h.dM)(J),[X]=(0,c.d)(),[se]=T(),oe=(0,g.Yb)(async({name:ie,resourceVersion:fe})=>{const pe=(0,u.G)();await se({name:ie,namespace:pe,ioK8SApimachineryPkgApisMetaV1DeleteOptions:{preconditions:{resourceVersion:fe}}}).unwrap()}),ae=(0,g.Yb)(async({name:ie})=>{const fe=(0,y.FS)(ie);return X(fe)});return q?oe:ae}const Z=J=>{const{secureSettings:q,settings:X,...se}=J,oe=Object.entries(q||{}).reduce((fe,[pe,de])=>de===void 0?{...fe,[pe]:!0}:fe,{}),ae=Object.entries(q||{}).reduce((fe,[pe,de])=>de?(0,t.set)(fe,pe,de):fe,{}),ie=(0,t.merge)({},X,ae);return{...se,secureFields:oe,settings:ie}},ne=(J,q,X)=>({metadata:{...q&&{name:q},resourceVersion:X},spec:{title:J.name,integrations:(J.grafana_managed_receiver_configs||[]).map(Z)}}),te=({alertmanager:J})=>{const q=J===f.hY,X=(0,h.dM)(J),{createOnCallIntegrations:se}=(0,a.VY)(),[oe]=L(),[ae]=(0,c.d)(),ie=(0,g.Yb)(async({contactPoint:pe})=>{const de=q?await se(pe):pe,le=(0,u.G)(),me=ne(de);return oe({namespace:le,comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1Receiver:me}).unwrap()}),fe=(0,g.Yb)(async({contactPoint:pe})=>{const de=q?await se(pe):pe,le=(0,y.BD)(de);return ae(le)});return X?ie:fe},Y=({alertmanager:J})=>{const q=J===f.hY,X=(0,h.dM)(J),{createOnCallIntegrations:se}=(0,a.VY)(),[oe]=K(),[ae]=(0,c.d)();return(0,g.Yb)(async fe=>{if("resourceVersion"in fe&&X){const{contactPoint:pe,id:de,resourceVersion:le}=fe,me=q?await se(pe):pe,De=(0,u.G)(),Te=ne(me,de,le);return oe({name:de,namespace:De,comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1Receiver:Te}).unwrap()}else if("originalName"in fe){const{contactPoint:pe,originalName:de}=fe,le=q?await se(pe):pe,me=(0,y.Xm)({name:de,receiver:le});return ae(me)}})},Q=({alertmanager:J})=>{const q=(0,h.dM)(J),[X]=S();return q?()=>{}:async(se,oe)=>{if(!(oe&&se===oe))return X(J).unwrap().then(ae=>{const{alertmanager_config:ie}=ae;return!!ie.receivers?.find(pe=>pe.name===se)?`Contact point already exists with name "${se}"`:void 0})}}},66056:(ee,B,e)=>{"use strict";e.d(B,{Rm:()=>b,aM:()=>d,T8:()=>O});var t=e(2543),n=e(43173),r=e(56840),o=e(56476),s=e(84266),m=e(48442);function a(I){return"grafana_managed_receiver_configs"in I?I.grafana_managed_receiver_configs??[]:Object.entries(I).filter(([T])=>T!=="grafana_managed_receiver_configs"&&T.endsWith("_configs")).filter(([T,L])=>Array.isArray(L)&&!(0,t.isEmpty)(L)).reduce((T,[L,K])=>{const A=L.replace("_configs",""),W=K.map(N=>({name:I.name,type:A,settings:N,disableResolveMessage:!1}));return T.concat(W)},[])}var l=e(6135),f=e(182),h=e(28405),u=e(2869);const p={title:"Grafana OnCall",icon:{[u.W.OnCall]:"public/img/alerting/oncall_logo.svg",[u.W.Irm]:"public/img/alerting/irm_logo.svg",[u.W.Incident]:"",[u.W.MachineLearning]:"",[u.W.Labels]:"",[u.W.Slo]:""}[(0,f.BO)()]};function c(I,R,T=!0){const L=(0,f.ZP)()?"IRM":"OnCall";if(!T||!R.settings?.url||I===void 0)return p;if(I==null)return{...p,warning:`Grafana ${L} is not installed or is disabled`};const K=I.find(A=>A.integration_url===R.settings?.url);return{...p,description:K?.display_name,externalUrl:K?(0,h.h)((0,f.BO)(),`/integrations/${K.value}`):void 0,warning:K?void 0:`${L} Integration no longer exists`}}var y=e(3887);const P="__grafana_receiver__";function d(I){if(!I.settings)return;const{settings:R}=I;switch(I.type){case"email":{const T=R.addresses||R.to;return T?D(T):void 0}case"slack":{const T=R.recipient||R.channel;return T?`#${T.replace(/^#/,"")}`:void 0}case"kafka":return R.kafkaTopic;case"webhook":return R.url;case"jira":return(0,r.t)("alerting.contact-points.receiver-summary.jira",'Creates a "{{issueType}}" issue in the "{{project}}" project',{issueType:R.issue_type,project:R.project,url:R.api_url});case l.J4.OnCall:return I[y.sW]?.description;default:return I[y.MX]?.description}}function D(I){const T=/,|;|\n+/g,L=I.trim().split(T).map(t.trim),K=(0,t.take)(L,3),A=(0,t.difference)(L,K);return A.length&&K.push(`+${A.length} more`),K.join(", ")}function b({status:I=[],notifiers:R=[],onCallIntegrations:T,contactPoints:L,alertmanagerConfiguration:K}){const A=(0,m._I)(K?.alertmanager_config?.route??{}),W=C(A),N=(0,t.groupBy)(W,"receiver");return L.map(j=>{const V=a(j),U=I.find(M=>M.name===j.name),F=E(j);return{...j,id:F,policies:K&&N&&(N[j.name]??[]),grafana_managed_receiver_configs:V.map((M,H)=>{const _=M.type===l.J4.OnCall;return{...M,[y.v4]:U?.integrations[H],[y.MX]:S(R,M),[y.sW]:_?c(T,M,!!K):void 0}})}}).sort((j,V)=>j.name.localeCompare(V.name))}function E(I){return"id"in I&&I.id?I.id:I.name}
162function v(I){return!(n.$.featureToggles.alertingSimplifiedRouting??!1)||!I.object_matchers?!1:I.object_matchers.some(T=>T[0]===P&&T[1]===s.ho.equal)??!1}function C(I){const R=I.routes?.flatMap(T=>C(T))??[];return I.receiver?[{receiver:I.receiver,route:{type:v(I)?"auto-generated":"normal"}},...R]:R}function S(I,R){const T=I.find(L=>L.type===R.type);return{name:T?.name??(0,t.upperFirst)(R.type),description:T?.description}}const O=(I,R)=>(0,o.dM)(I)&&(0,o.jw)(R)},51993:(ee,B,e)=>{"use strict";e.d(B,{GX:()=>j,r4:()=>N});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(96540),m=e(49785),a=e(28105),l=e(1906),f=e(39884),h=e(80011),u=e(63142),i=e(34999),x=e(41654),g=e(45861),p=e(33033),c=e(76319),y=e(66404),P=e(56840),d=e(91073),D=e(18203),b=e(89931),E=e(4652),v=e(32576),C=e(38610),S=e(4651),O=e(24619),I=e(74048),R=e(29609),T=e(38055),L=e(49779),K=e(65420),A=e(38076),W=e(88589);const N=({queries:Q=[],query:J,data:q,error:X,warning:se,isAlertCondition:oe,onSetCondition:ae,onUpdateRefId:ie,onRemoveExpression:fe,onUpdateExpressionType:pe,onChangeQuery:de})=>{const le=(0,u.of)(Y),me=J?.type,{setError:De,clearErrors:Te,watch:Ne}=(0,m.xW)(),Ce=Ne("type"),He=Ce?(0,R.pq)(Ce):!1,ke=(0,s.useCallback)(Ye=>{Ye?De("queries",{type:"custom",message:Ye}):Te("queries")},[De,Te]),Me=q&&Object.values(q).some(Ye=>!!Ye&&Ye.state===a.Gu.Loading),$e=Array.isArray(q?.series)&&!Me,tt=q?.series??[],Ke=oe??!1,{seriesCount:Re,groupedByState:Ve}=U(tt),Qe=(0,s.useCallback)(Ye=>{const Ge=Q.filter(ce=>Ye.refId!==ce.refId).map(ce=>({value:ce.refId,label:ce.refId}));switch(Ye.type){case S.Tz.math:return(0,t.jsx)(D.z,{onChange:de,query:Ye,labelWidth:"auto",onRunQuery:()=>{}});case S.Tz.reduce:return(0,t.jsx)(b.Z,{onChange:de,refIds:Ge,labelWidth:"auto",app:l.Jk.UnifiedAlerting,query:Ye});case S.Tz.resample:return(0,t.jsx)(E.C,{onChange:de,query:Ye,labelWidth:"auto",refIds:Ge});case S.Tz.classic:return(0,t.jsx)(d.z,{onChange:de,query:Ye,refIds:Ge});case S.Tz.threshold:return(0,t.jsx)(C.O,{onChange:de,query:Ye,labelWidth:"auto",refIds:Ge,onError:ke,useHysteresis:!0});case S.Tz.sql:return(0,t.jsx)(v.k,{onChange:ce=>de(ce),query:Ye,refIds:Ge,alerting:!0});default:return(0,t.jsxs)(t.Fragment,{children:["Expression not supported: ",Ye.type]})}},[de,Q,ke]),ze=S.uQ.find(Ye=>Ye.value===me)?.description??"";return(0,t.jsx)("div",{className:(0,n.cx)(le.expression.wrapper,Ke&&le.expression.alertCondition,me===S.Tz.classic&&le.expression.classic,me!==S.Tz.classic&&le.expression.nonClassic),children:(0,t.jsxs)("div",{className:le.expression.stack,children:[(0,t.jsx)(F,{refId:J.refId,queryType:me,onRemoveExpression:()=>fe(J.refId),onUpdateRefId:Ye=>ie(J.refId,Ye),onSetCondition:ae,query:J,alertCondition:Ke}),(0,t.jsxs)("div",{className:le.expression.body,children:[X&&(0,t.jsx)(i.F,{title:(0,P.t)("alerting.expression.title-expression-failed","Expression failed"),severity:"error",children:X.message}),se&&(0,t.jsx)(i.F,{title:(0,P.t)("alerting.expression.title-expression-warning","Expression warning"),severity:"warning",children:se.message}),(0,t.jsx)("div",{className:le.expression.description,children:ze}),Qe(J)]}),$e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{series:tt,isAlertCondition:oe,isRecordingRule:He}),!He&&(0,t.jsx)("div",{className:le.footer,children:(0,t.jsxs)(x.B,{direction:"row",alignItems:"center",children:[(0,t.jsx)(L.h,{}),(0,t.jsx)(V,{isCondition:!!oe,firing:Ve[O.cF.Firing].length,normal:Ve[O.cF.Inactive].length,seriesCount:Re})]})})]})]})})},w=20,j=({series:Q,isAlertCondition:J,isRecordingRule:q=!1})=>{const{pageItems:X,previousPage:se,nextPage:oe,numberOfPages:ae,pageStart:ie,pageEnd:fe}=(0,I.W)(Q,1,w),pe=(0,u.of)(Y),de=(0,W.PI)(Q),le=!de&&(0,f.jq)(Q),me=ae>1;return(0,t.jsxs)("div",{className:pe.expression.results,children:[!de&&le&&(0,t.jsx)("div",{children:X.map((De,Te)=>(0,t.jsx)(te,{frame:De,index:ie+Te,isAlertCondition:J},(0,r.uniqueId)()))}),!de&&!le&&X.map((De,Te)=>(0,t.jsx)(ne,{frame:De,index:ie+Te,isAlertCondition:J,isRecordingRule:q},(0,r.uniqueId)())),de&&(0,t.jsx)("div",{className:(0,n.cx)(pe.expression.noData,pe.mutedText),children:(0,t.jsx)(P.x6,{i18nKey:"alerting.expression-result.no-data",children:"No data"})}),me&&(0,t.jsx)("div",{className:pe.pagination.wrapper,"data-testid":"paginate-expression",children:(0,t.jsxs)(x.B,{children:[(0,t.jsx)(g.$n,{variant:"secondary",fill:"outline",onClick:se,icon:"angle-left",size:"sm","aria-label":(0,P.t)("alerting.expression-result.aria-label-previouspage","previous-page")}),(0,t.jsx)(L.h,{}),(0,t.jsxs)("span",{className:pe.mutedText,children:[ie," - ",fe," of ",Q.length]}),(0,t.jsx)(L.h,{}),(0,t.jsx)(g.$n,{variant:"secondary",fill:"outline",onClick:oe,icon:"angle-right",size:"sm","aria-label":(0,P.t)("alerting.expression-result.aria-label-nextpage","next-page")})]})})]})},V=({firing:Q,normal:J,isCondition:q,seriesCount:X})=>{const{mutedText:se}=(0,u.of)(Y);return X===0?(0,t.jsx)("span",{className:se,children:(0,t.jsx)(P.x6,{i18nKey:"alerting.preview-summary.no-series",children:"No series"})}):q?(0,t.jsx)("span",{className:se,children:`${X} series: ${Q} firing, ${J} normal`}):(0,t.jsx)("span",{className:se,children:`${X} series`})};function U(Q){const J=Q.filter(se=>(0,W.Lm)(se)===void 0).length,q={[O.cF.Firing]:Q.filter(se=>(0,W.Lm)(se)!==void 0&&(0,W.Lm)(se)!==0),[O.cF.Inactive]:Q.filter(se=>(0,W.Lm)(se)===0)},X=Q.length-J;return{groupedByState:q,seriesCount:X}}const F=({refId:Q,queryType:J,onUpdateRefId:q,onRemoveExpression:X,onSetCondition:se,alertCondition:oe,query:ae})=>
162{const ie=(0,u.of)(Y),fe=(0,u.of)(g.my),[pe,de]=(0,s.useState)(!1),me=pe!==!1&&pe==="refId";return(0,t.jsx)("header",{className:ie.header.wrapper,children:(0,t.jsxs)(x.B,{direction:"row",gap:.5,alignItems:"center",children:[(0,t.jsxs)(x.B,{direction:"row",gap:1,alignItems:"center",children:[!me&&(0,t.jsx)("button",{type:"button",className:(0,n.cx)(fe,ie.editable),onClick:()=>de("refId"),children:(0,t.jsx)("div",{className:ie.expression.refId,children:Q})}),me&&(0,t.jsx)(p.D,{autoFocus:!0,defaultValue:Q,minWidth:5,onFocus:De=>De.target.select(),onBlur:De=>{q(De.currentTarget.value),de(!1)}}),(0,t.jsx)("div",{children:(0,S.NI)(J)})]}),(0,t.jsx)(L.h,{}),(0,t.jsx)(A.a,{refId:Q,onSetCondition:()=>se(ae.refId),isCondition:oe}),(0,t.jsx)(c.K,{name:"trash-alt",variant:"secondary",className:ie.mutedIcon,onClick:X,tooltip:`Remove expression "${Q}"`})]})})},M=()=>(0,t.jsx)("span",{children:"{"}),H=()=>(0,t.jsx)("span",{children:"}"}),_=()=>(0,t.jsx)("span",{children:'"'}),Z=()=>(0,t.jsx)("span",{children:"="});function ne({frame:Q,index:J,isAlertCondition:q,isRecordingRule:X}){const se=(0,u.of)(Y),oe=(0,W.Jw)(Q)||"Series "+J,ae=(0,W.Lm)(Q),ie=(0,W.JQ)(Q),fe=Object.entries(ie),pe=fe.length>0,de=q&&ae!==0,le=q&&ae===0,me=`${pe?"":oe}${pe?`{${(0,W.h6)(ie)}}`:""}`,De=!X;return(0,t.jsx)("div",{className:se.expression.resultsRow,children:(0,t.jsxs)(x.B,{direction:"row",gap:1,alignItems:"center",children:[(0,t.jsx)("div",{className:se.expression.resultLabel,title:me,children:(0,t.jsx)(y.E,{variant:"code",children:pe?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M,{}),fe.map(([Te,Ne],Ce)=>(0,t.jsxs)(y.E,{variant:"body",children:[(0,t.jsx)("span",{className:se.expression.labelKey,children:Te}),(0,t.jsx)(Z,{}),(0,t.jsx)(_,{}),(0,t.jsx)("span",{className:se.expression.labelValue,children:Ne}),(0,t.jsx)(_,{}),Ce<fe.length-1&&(0,t.jsx)("span",{children:", "})]},(0,r.uniqueId)())),(0,t.jsx)(H,{})]}):(0,t.jsx)("span",{className:se.expression.labelKey,children:me})})}),(0,t.jsx)("div",{className:se.expression.resultValue,children:(0,W.Cs)(ae)}),De&&(0,t.jsxs)(t.Fragment,{children:[de&&(0,t.jsx)(K.C,{state:O.cF.Firing,size:"sm"}),le&&(0,t.jsx)(K.C,{state:O.cF.Inactive,size:"sm"})]})]})})}const te=({frame:Q,index:J})=>{const q=(0,u.of)(Y),X=Q.fields[1],se=X.labels,ae=X.config?.displayNameFromDS??(se?(0,W.h6)(X.labels??{}):"Series "+J),ie=Q.fields[0].values,fe=de=>Q.fields[0].values[de],pe=de=>Q.fields[1].values[de];return(0,t.jsx)("div",{className:q.expression.resultsRow,children:(0,t.jsxs)(x.B,{direction:"row",alignItems:"center",children:[(0,t.jsx)("span",{className:(0,n.cx)(q.mutedText,q.expression.resultLabel),title:ae,children:ae}),(0,t.jsx)("div",{className:q.expression.resultValue,children:(0,t.jsx)(T.B,{placement:"right",wrapperClassName:q.timeseriesTableWrapper,content:(0,t.jsxs)("table",{className:q.timeseriesTable,children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(P.x6,{i18nKey:"alerting.timeseries-row.timestamp",children:"Timestamp"})}),(0,t.jsx)("th",{children:(0,t.jsx)(P.x6,{i18nKey:"alerting.timeseries-row.value",children:"Value"})})]})}),(0,t.jsx)("tbody",{children:ie.map((de,le)=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:q.mutedText,children:(0,h.LE)(fe(le))}),(0,t.jsx)("td",{className:q.expression.resultValue,children:pe(le)})]},le))})]}),children:(0,t.jsx)("span",{children:(0,t.jsx)(P.x6,{i18nKey:"alerting.timeseries-row.time-series-data",children:"Time series data"})})})})]})})},Y=Q=>({expression:{wrapper:(0,n.css)({display:"flex",border:`solid 1px ${Q.colors.border.medium}`,flex:1,flexBasis:"400px",borderRadius:Q.shape.radius.default}),stack:(0,n.css)({display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:0,width:"100%",minWidth:"0"}),classic:(0,n.css)({maxWidth:"100%"}),nonClassic:(0,n.css)({maxWidth:"640px"}),alertCondition:(0,n.css)({}),body:(0,n.css)({padding:Q.spacing(1),flex:1}),description:(0,n.css)({marginBottom:Q.spacing(1),fontSize:Q.typography.size.xs,color:Q.colors.text.secondary}),refId:(0,n.css)({fontWeight:Q.typography.fontWeightBold,color:Q.colors.primary.text}),results:(0,n.css)({display:"flex",flexDirection:"column",flexWrap:"nowrap",borderTop:`solid 1px ${Q.colors.border.medium}`}),noResults:(0,n.css)({display:"flex",alignItems:"center",justifyContent:"center"}),resultsRow:(0,n.css)({padding:`${Q.spacing(.75)} ${Q.spacing(1)}`,"&:nth-child(odd)":{backgroundColor:Q.colors.background.secondary},"&:hover":{backgroundColor:Q.colors.background.canvas}}),labelKey:(0,n.css)({color:Q.isDark?"#73bf69":"#56a64b"}),labelValue:(0,n.css)({color:Q.isDark?"#ce9178":"#a31515"}),resultValue:(0,n.css)({textAlign:"right"}),resultLabel:(0,n.css)({flex:1,overflowX:"auto",display:"inline-block",whiteSpace:"nowrap"}),noData:(0,n.css)({display:"flex",alignItems:"center",justifyContent:"center",padding:Q.spacing()})},mutedText:(0,n.css)({color:Q.colors.text.secondary,fontSize:"0.9em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),header:{wrapper:(0,n.css)({background:Q.colors.background.secondary,padding:`${Q.spacing(.5)} ${Q.spacing(1)}`,borderBottom:`solid 1px ${Q.colors.border.weak}`})},footer:(0,n.css)({background:Q.colors.background.secondary,padding:Q.spacing(1),borderTop:`solid 1px ${Q.colors.border.weak}`}),draggableIcon:(0,n.css)({cursor:"grab"}),mutedIcon:(0,n.css)({color:Q.colors.text.secondary}),editable:(0,n.css)({padding:`${Q.spacing(.5)} ${Q.spacing(1)}`,border:`solid 1px ${Q.colors.border.weak}
162`,borderRadius:Q.shape.radius.default,display:"flex",flexDirection:"row",alignItems:"center",gap:Q.spacing(1),cursor:"pointer"}),timeseriesTableWrapper:(0,n.css)({maxHeight:"500px",overflowY:"scroll"}),timeseriesTable:(0,n.css)({tableLayout:"auto",width:"100%",height:"100%","td, th":{padding:Q.spacing(1)},td:{background:Q.colors.background.primary},th:{background:Q.colors.background.secondary},tr:{borderBottom:`1px solid ${Q.colors.border.medium}`,"&:last-of-type":{borderBottom:"none"}}}),pagination:{wrapper:(0,n.css)({borderTop:`1px solid ${Q.colors.border.medium}`,padding:Q.spacing()})}})},38076:(ee,B,e)=>{"use strict";e.d(B,{a:()=>l});var t=e(74848),n=e(22803),r=e(49785),o=e(63142),s=e(99887),m=e(45861),a=e(29609);const l=({isCondition:h,onSetCondition:u,refId:i})=>{const x=(0,o.of)(f),{watch:g}=(0,r.xW)(),p=g("type"),c=p?(0,a.pq)(p):!1,y=c?"Recording rule output":"Alert condition",P=i?`Set "${i}" as alert condition`:"Set as alert condition",d=c?"Set as recording rule output":P;return h?(0,t.jsx)(s.E,{color:"green",icon:"check",text:y},"condition"):(0,t.jsx)("button",{type:"button",className:x.actionLink,onClick:()=>u&&u(),children:d},"make-condition")},f=h=>{const u=(0,m.my)(h);return{actionLink:(0,n.css)(u,{color:h.colors.text.link,cursor:"pointer","&:hover":{textDecoration:"underline"}})}}},88589:(ee,B,e)=>{"use strict";e.d(B,{Cs:()=>l,EL:()=>u,JQ:()=>f,Jw:()=>s,Lm:()=>m,PI:()=>x,h6:()=>h});var t=e(2543),n=e.n(t),r=e(79243),o=e(52161);const s=g=>{const p=g.fields.at(0);return p?.config?.displayNameFromDS??g.name??p?.labels?.__name__},m=g=>g.fields.at(0)?.values.at(0),a=new Intl.NumberFormat(void 0,{maximumSignificantDigits:5}),l=g=>Number.isFinite(g)&&typeof g=="number"?Math.abs(g)<1?a.format(g):(0,r.h)(g,5).toString(10):String(g),f=g=>g.fields[0]?.labels??{},h=g=>Object.entries(g).map(([p,c])=>p+"="+c).join(", "),u=g=>{const p=g.name;if((0,o.Eb)(g.rulesSource))return{name:p,parents:[]};try{const c=JSON.parse(p);if(!Array.isArray(c))throw new Error("not a nested Grafana folder");const y=(0,t.last)(c)??p,P=(0,t.dropRight)(c,1);return{name:y,parents:P}}catch{return{name:g.name,parents:[]}}},i=(g,p=[])=>JSON.stringify(p.concat(g)),x=g=>g.every(c=>c.fields.every(y=>y.values.every(P=>P==null)))},66513:(ee,B,e)=>{"use strict";e.d(B,{GK:()=>o,Zr:()=>r,xK:()=>n});var t=e(96673);const n=[t.AccessControlAction.AlertingTimeIntervalsRead],r=[t.AccessControlAction.AlertingTimeIntervalsWrite],o=[...n,...r]},88114:(ee,B,e)=>{"use strict";e.d(B,{Im:()=>o,nv:()=>r,rw:()=>n});var t=e(96673);const n=[t.AccessControlAction.AlertingRoutesRead],r=[t.AccessControlAction.AlertingRoutesWrite],o=[...n,...r]},46202:(ee,B,e)=>{"use strict";e.d(B,{g0:()=>I,a1:()=>O,yV:()=>v,F:()=>S});var t=e(2543),n=e(47078),r=e.n(n),o=e(84266),s=e(85618),m=e(91984),a=e(80218),l=e(43100),f=e(5709);const h=["RoutingTree"],u=f.H.enhanceEndpoints({addTagTypes:h}).injectEndpoints({endpoints:W=>({listNamespacedRoutingTree:W.query({query:N=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${N.namespace}/routingtrees`,params:{pretty:N.pretty,allowWatchBookmarks:N.allowWatchBookmarks,continue:N.continue,fieldSelector:N.fieldSelector,labelSelector:N.labelSelector,limit:N.limit,resourceVersion:N.resourceVersion,resourceVersionMatch:N.resourceVersionMatch,sendInitialEvents:N.sendInitialEvents,timeoutSeconds:N.timeoutSeconds,watch:N.watch}}),providesTags:["RoutingTree"]}),replaceNamespacedRoutingTree:W.mutation({query:N=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${N.namespace}/routingtrees/${N.name}`,method:"PUT",body:N.comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1RoutingTree,params:{pretty:N.pretty,dryRun:N.dryRun,fieldManager:N.fieldManager,fieldValidation:N.fieldValidation}}),invalidatesTags:["RoutingTree"]})}),overrideExisting:!1});var i=e(78045),x=e(42824),g=e(22628),p=e(56476),c=e(48442),y=e(67923);const P=r()(R,{maxSize:1}),{useListNamespacedRoutingTreeQuery:d,useReplaceNamespacedRoutingTreeMutation:D,useLazyListNamespacedRoutingTreeQuery:b}=u,{useGetAlertmanagerConfigurationQuery:E}=m.m,v=({alertmanager:W},{skip:N}={})=>{const w=(0,p.dM)(W),j=d({namespace:(0,s.G)()},{skip:N||!w,selectFromResult:U=>({...U,currentData:U.currentData?P(U.currentData.items):void 0,data:U.data?P(U.data.items):void 0})}),V=E(W,{skip:N||w,selectFromResult:U=>({...U,currentData:U.currentData?.alertmanager_config?.route?[C(U.currentData.alertmanager_config.route)]:void 0,data:U.data?.alertmanager_config?.route?[C(U.data.alertmanager_config.route)]:void 0})});return w?j:V},C=r()(W=>({...W,[o.uz]:{provisioned:!!(W.provenance&&W.provenance!==g.rh)}}));function S({alertmanager:W}){const N=(0,p.dM)(W),[w]=D(),[j]=(0,l.d)(),[V]=b(),U=(0,a.Yb)(async M=>{const H=(0,s.G)(),_=await V({namespace:H}),[Z]=_.data?P(_.data.items):[];
162if(!Z)throw new Error(`no root route found for namespace ${H}`);const ne=(0,x.QM)(Z),te=(0,y.AB)(W,M,ne),Y=A(te);return w({name:g.DM,namespace:H,comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1RoutingTree:(0,y.HO)(Y)}).unwrap()}),F=(0,a.Yb)(async M=>{const H=(0,i.LY)({update:M,alertmanager:W});return j(H)});return N?U:F}function O({alertmanager:W}){const N=(0,p.dM)(W),[w]=(0,l.d)(),[j]=b(),[V]=D(),U=(0,a.Yb)(async M=>{const H=(0,s.G)(),_=await j({namespace:H}),[Z]=_.data?P(_.data.items):[];if(!Z)throw new Error(`no root route found for namespace ${H}`);const ne=(0,x.QM)(Z),te=(0,y.AS)(M,ne),Y=A(te);return V({name:g.DM,namespace:H,comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1RoutingTree:Y}).unwrap()}),F=(0,a.Yb)(async M=>{const H=(0,i.Z8)({id:M});return w(H)});return N?U:F}function I({alertmanager:W}){const N=(0,p.dM)(W),[w]=(0,l.d)(),[j]=b(),[V]=D(),U=(0,a.Yb)(async({partialRoute:M,referenceRouteIdentifier:H,insertPosition:_})=>{const Z=(0,s.G)(),ne=await j({namespace:Z}),[te]=ne.data?P(ne.data.items):[];if(!te)throw new Error(`no root route found for namespace ${Z}`);const Y=(0,x.QM)(te),Q=(0,y.I8)(W??"",M,H,Y,_),J=A(Q);return V({name:g.DM,namespace:Z,comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1RoutingTree:(0,y.HO)(J)}).unwrap()}),F=(0,a.Yb)(async({partialRoute:M,referenceRouteIdentifier:H,insertPosition:_})=>{const Z=(0,i.tD)({partialRoute:M,referenceRouteIdentifier:H,insertPosition:_,alertmanager:W});return w(Z)});return N?U:F}function R(W){return W?.map(N=>({...N.spec.defaults,routes:N.spec.routes?.map(L),[o.uz]:{provisioned:(0,p.Uo)(N),resourceVersion:N.metadata.resourceVersion,name:N.metadata.name}}))}function T(W){return Object.values(o.ho).includes(W)}function L(W){return{...W,routes:W.routes?.map(L),matchers:void 0,object_matchers:W.matchers?.map(({label:N,type:w,value:j})=>{if(!T(w))throw new Error(`Invalid matcher operator from API: ${w}`);return[N,w,j]})}}function K(W){const{object_matchers:N,...w}=W;return{...w,receiver:W.receiver??void 0,matchers:N?.map(([j,V,U])=>({label:j,type:V,value:U})),routes:W.routes?.map(K)}}function A(W){const w={...(0,t.pick)(W,c.Rs),receiver:W.receiver??""},j=W.routes?.map(K)??[];return{spec:{defaults:w,routes:j},metadata:{name:g.DM,resourceVersion:W[o.uz]?.resourceVersion}}}},56652:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{AlertmanagerTemplateFunction:()=>n,GomplateFunctions:()=>r,availableAlertManagerFunctions:()=>o,builtinFunctions:()=>m,conf:()=>f,keywords:()=>a,language:()=>l});var t=(h=>(h.Delimiter="delimiter",h.Keyword="keyword",h.Function="type.identifier",h.String="string",h.Variable="variable.name",h.Number="number",h.Comment="comment",h.Operator="operator",h.Identifier="idenfifier",h))(t||{}),n=(h=>(h.toUpper="toUpper",h.toLower="toLower",h.title="title",h.join="join",h.match="match",h.safeHtml="safeHtml",h.reReplaceAll="reReplaceAll",h.stringSlice="stringSlice",h))(n||{});const r={coll:[{keyword:"coll.Dict",definition:"Creates a map with string keys from key/value pairs. All keys are converted to strings. If an odd number of arguments is provided, the last is used as the key with an empty string value.",usage:"function(key string, val any, ...)",example:'{{ coll.Dict "name" "Frank" "age" 42 | data.ToYAML }}'},{keyword:"coll.Slice",definition:"Creates a slice (like an array or list). Useful when needing to range over a bunch of variables.",usage:"function(in ...any)",example:'{{ range coll.Slice "Bart" "Lisa" "Maggie" }}Hello, {{ . }}{{ end }}'},{keyword:"coll.Append",definition:"Appends a value to the end of a list. Creates a new list rather than modifying the input.",usage:"function(value any, list []any)",example:"{{ coll.Slice 1 1 2 3 | append 5 }}"}],data:[{keyword:"data.JSON",definition:"Converts a JSON string into an object. Works for JSON Objects and Arrays.",usage:"function(json string)",example:"{{ ($json | data.JSON).hello }}"},{keyword:"data.ToJSON",definition:"Converts an object to a JSON document.",usage:"function(obj any)",example:'{{ (`{"foo":{"hello":"world"}}` | json).foo | data.ToJSON }}'},{keyword:"data.ToJSONPretty",definition:"Converts an object to a pretty-printed (indented) JSON document.",usage:"function(indent string, obj any)",example:'{{ `{"hello":"world"}` | data.JSON | data.ToJSONPretty " " }}'}],tmpl:[{keyword:"tmpl.Exec",definition:"Execute (render) the named template. This is equivalent to using the `template` action, except the result is returned as a string. This allows for post-processing of templates.",usage:"function(name string, [context any])",example:'{{ tmpl.Exec "T1" | strings.ToUpper }}'},{keyword:"tmpl.Inline",definition:"Render the given string as a template, just like a nested template. If the template is given a name, it can be re-used later with the `template` keyword. A context c
162an be provided, otherwise the default gomplate context will be used.",usage:"function(partial string, context any)",example:'{{ tmpl.Inline "{{print `hello world`}}" }}'}],time:[{keyword:"time.Now",definition:"Returns the current local time, as a time.Time. This wraps Go's time.Now.",usage:"function()",example:'{{ (time.Now).UTC.Format "Day 2 of month 1 in year 2006 (timezone MST)" }}'}]},o=[...Object.values(n),...Object.keys(r).map(h=>h)],m=["and","call","html","index","slice","js","len","not","or","print","printf","println","urlquery",...["eq","ne","lt","le","gt","ge"]],a=["define","if","else","end","range","break","continue","template","block","with"],l={defaultToken:"",keywords:a,functions:[...m,...o],operators:["|"],tokenizer:{root:[[/"/,"string","@string"],[/`/,"string","@rawstring"],[/\d*\d+[eE]([\-+]?\d+)?/,"number.float"],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F']*[0-9a-fA-F]/,"number.hex"],[/0[0-7']*[0-7]/,"number.octal"],[/0[bB][0-1']*[0-1]/,"number.binary"],[/\d[\d']*/,"number"],[/\d/,"number"],[/[;,.]/,"delimiter"],[/{{-?/,"delimiter"],[/-?}}/,"delimiter"],[/\.([A-Za-z]+)?/,"variable.name"],[/[a-zA-Z_]\w*/,{cases:{"@keywords":{token:"keyword"},"@functions":{token:"type.identifier"},"@default":"idenfifier"}}],[/\/\*.*\*\//,"comment"]],string:[[/[^\\"]+/,"string"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],rawstring:[[/[^\`]/,"string"],[/`/,"string","@pop"]]}},f={comments:{blockComment:["/*","*/"]},brackets:[["{{","}}"],["(",")"]],autoClosingPairs:[{open:"{{",close:"}}"},{open:"(",close:")"},{open:"`",close:"`"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{{",close:"}}"},{open:"(",close:")"},{open:"`",close:"`"},{open:'"',close:'"'},{open:"'",close:"'"}]}},6135:(ee,B,e)=>{"use strict";e.d(B,{FI:()=>t,J4:()=>n});const t="grafana_alerting";var n=(s=>(s.OnCall="oncall",s))(n||{});const r=(s,m)=>m.includes(s),o=(s,m)=>{if(!s.grafana_managed_receiver_configs)return!1;const a=s.grafana_managed_receiver_configs.length===1,l=r(s.grafana_managed_receiver_configs[0]?.settings?.url??"",m.map(f=>f.integration_url));return a&&l}},53226:(ee,B,e)=>{"use strict";e.d(B,{U0:()=>x,VY:()=>y});var t=e(74848),n=e(1932),r=e(96540),o=e(68143),s=e(99887),m=e(56840),a=e(182),l=e(64762),f=e(77788),h=e(3986),u=e(72930),i=e(6135),x=(P=>(P.NewIntegration="new_oncall_integration",P.ExistingIntegration="existing_oncall_integration",P))(x||{}),g=(P=>(P.IntegrationType="integration_type",P.IntegrationName="integration_name",P))(g||{}),p=(P=>(P.Disabled="disabled",P.V1="v1",P.V2="v2",P))(p||{});function c(){const{installed:P,loading:d,error:D}=(0,h._)((0,a.BO)()),{data:b=[],error:E,isLoading:v}=f.WG.endpoints.features.useQuery(void 0,{skip:!P}),C=(0,r.useMemo)(()=>P?b.includes(f.Pc)?"v2":"v1":"disabled",[P,b]),S=(0,r.useMemo)(()=>C==="v2",[C]);return{isOnCallEnabled:P,integrationStatus:C,isAlertingV2IntegrationEnabled:S,isOnCallStatusLoading:d||v,onCallError:D??E}}function y(){const P=(0,l._2)(),{isOnCallEnabled:d,integrationStatus:D,isAlertingV2IntegrationEnabled:b,isOnCallStatusLoading:E,onCallError:v}=c(),{useCreateIntegrationMutation:C,useGrafanaOnCallIntegrationsQuery:S,useLazyValidateIntegrationNameQuery:O}=f.WG,[I,{isFetching:R}]=O(),[T]=C(),{data:L=[],isLoading:K,isError:A}=S(void 0,{skip:!b}),W=(0,r.useMemo)(()=>({integration_name:async V=>{try{return await I(V).unwrap(),!0}catch(U){if((0,o.NF)(U)&&U.status===409)return(0,m.t)("alerting.irm-integration.integration-name-exists","Integration of this name already exists in IRM");throw P.error((0,m.t)("alerting.irm-integration.validation-failed","Failed to validate IRM integration name. Is the OnCall API available?")),U}},url:V=>b?L.map(U=>U.integration_url).includes(V)?!0:(0,m.t)("alerting.irm-integration.integration-required","Selection of existing IRM integration is required"):!0}),[L,I,b,P]),N=(0,r.useCallback)(V=>b?(0,n.jM)(V,U=>{U.grafana_managed_receiver_configs?.forEach(F=>{F.type===i.J4.OnCall&&(F.settings.integration_type="existing_oncall_integration")})}):V,[b]),w=(0,r.useCallback)(async V=>{if(!b)return V;const M=(V.grafana_managed_receiver_configs?.filter(H=>H.type===i.J4.OnCall)??[]).filter(H=>H.settings.integration_type==="new_oncall_integration").map(async H=>{const _=await T({integration:i.FI,verbal_name:H.settings.integration_name}).unwrap();H.settings.url=_.integration_url});return await Promise.all(M),(0,n.jM)(V,H=>{H.grafana_managed_receiver_configs?.forEach(_=>{_.type===i.J4.OnCall&&(delete _.settings.integration_type,delete _.settings.integration_name)})})},[b,T]),j=(0,r.useCallback)(V=>{if(V.type===i.J4.OnCall&&b){const U=V.options.filter(H=>H.propertyName!=="url"),F={value:"new_oncall_integration",label:(0,m.t)("alerting.irm-integration.new-integration","New IRM integration"),description:(0,m.t)("alerting.irm-integration.new-integration-description","A new IRM integration without escalation chains will be automatically created")},M={value:"existing_oncall_integration",label:(0,m.t)("alerting.irm-integration.existing-integration","Existing IRM integration"),description:(0,m.t)("alerting.irm-integration.existing-integration-description","Use an existing IRM integration")};return U.unshift((0,u.u)("integration_type",(0,m.t)("alerting.irm-integration.connection-method","How to connect to IRM"),"",{required:!0,element:"radio",defaultValue:F,selectOptions:[F,M]}),(0,u.u)("integration_name",(0,m.t)("alerting.irm-integration.integration-name","Integration name"),(0,m.t)("alerting.irm-integration.integration-name-description","The name of the new IRM integration"),{required:!0,showWhen:{field:"integration_type",is:"new_oncall_integration"}}),(0,u.u)("url",(0,m.t)("alerting.irm-integration.integration","IRM Integration"),(0,m.t)("alerting.irm-integration.integration-description","The IRM integration to send alerts to"),{element:"select",required:!0,showWhen:{field:"integration_type",is:"existing_oncall_integration"},selectOptions:L.map(H=>({label:H.display_name,description:H.integration_url,value:H.integration_url}))})),{...V,options:U}}return V},[L,b]);return{integrationStatus:D,onCallNotifierMeta:{enabled:!!d,order:-1,description:d?(0,m.t)("alerting.irm-integration.enabled-description","Seamless way to handle alerts and manage incidents"):(0,m.t)("alerting.irm-integration.disabled-description","Enable IRM through a Webhook integration"),badge:(0,t.jsx)(s.E,{color:"blue",text:(0,m.t)("alerting.irm-integration.recommended","Recommended")})},extendOnCallNotifierFeatures:j,extendOnCallReceivers:N,createOnCallIntegrations:w,onCallFormV
162alidators:W,isLoadingOnCallIntegration:K||E,isValidating:R,hasOnCallError:!!v||A}}},89144:(ee,B,e)=>{"use strict";e.d(B,{j:()=>u});var t=e(74848),n=e(22803),r=e(70713),o=e(39884),s=e(63142),m=e(45229),a=e(56840),l=e(5929),f=e(51993),h=e(55376);const u=({data:x,thresholds:g,thresholdsType:p})=>{const c=(0,s.of)(i),y=(0,o.jq)(x.series),P=(0,h.yW)(x),d=p?{mode:p}:void 0;return(0,t.jsx)("div",{className:c.wrapper,children:(0,t.jsx)(r.default,{disableHeight:!0,children:({width:D})=>(0,t.jsx)("div",{style:{width:D},children:y?(0,t.jsx)(l.y,{statusMessage:P,data:x.series,eventBus:m.A,height:300,width:D,timeRange:x.timeRange,timeZone:"browser",onChangeTime:()=>{},splitOpenFn:()=>{},loadingState:x.state,thresholdsConfig:g,thresholdsStyle:d}):(0,t.jsxs)("div",{className:c.instantVectorResultWrapper,children:[(0,t.jsx)("header",{className:c.title,children:(0,t.jsx)(a.x6,{i18nKey:"alerting.viz-wrapper.table",children:"Table"})}),(0,t.jsx)(f.GX,{series:x.series})]})})})})},i=x=>({wrapper:(0,n.css)({width:"100%",position:"relative"}),instantVectorResultWrapper:(0,n.css)({border:`solid 1px ${x.colors.border.medium}`,borderRadius:x.shape.radius.default,padding:0,display:"flex",flexDirection:"column",flexWrap:"nowrap"}),title:(0,n.css)({label:"panel-title",padding:x.spacing(),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontSize:x.typography.h6.fontSize,fontWeight:x.typography.h6.fontWeight})})},42970:(ee,B,e)=>{"use strict";e.d(B,{p_:()=>g,qQ:()=>x,vL:()=>m,wz:()=>a});var t=e(2543),n=e.n(t),r=e(68220),o=e(44022),s=e(4651);function m(P){const d=new r.TS,D=[],b=P.map(E=>E.refId);if(d.createNodes(b),P.forEach(E=>{if(!(0,o.f)(E.model))return;const v=E.refId;f(E.model).forEach(S=>{if(v&&S)try{d.link(S,v)}catch(O){D.push({source:v,target:S,error:O})}})}),D.length>0)throw new l("failed to create DAG from queries",{cause:D});return d}function a(P,d=[]){try{return[m(P),d]}catch(D){if(D instanceof l){const b=D.cause;d.push(...b);const E=(0,t.reject)(P,v=>b.some(C=>C.source===v.refId));return a(E,d)}}return[new r.TS,d]}class l extends Error{constructor(d,D){super(d,D),this.cause=D?.cause??[]}}function f(P){const d=P.type===s.Tz.math,D=P.type===s.Tz.classic,b=P.type===s.Tz.sql;return d?h(P.expression??""):D?P.conditions?.map(E=>E.query.params[0])??[]:b?u(P.expression??""):[P.expression]}function h(P){const d=new RegExp(/\$\{(?<var>[a-zA-Z0-9_ ]+?)\}/gm),D=new RegExp(/\$(?<var>[a-zA-Z0-9_]+)/gm),b=Array.from(P.matchAll(d)).map(v=>v.groups?.var),E=Array.from(P.matchAll(D)).map(v=>v.groups?.var);return(0,t.compact)((0,t.uniq)([...b,...E]))}function u(P){if(!P)return[];const E=P.split(` 163`).filter(O=>!O.trim().startsWith("--")).join(" ").replace(/\s+/g," ").replace(/\/\*[\s\S]*?\*\//g,""),v=[],C=/from\s+([^;]*?)(?:\s+(?:join|where|group|having|order|limit)|\s*$)/gi;for(const O of E.matchAll(C)){const R=O[1].trim().split(",").map(T=>T.trim());for(const T of R)v.push(i(T))}const S=/join\s+([a-zA-Z0-9_."]+)/gi;for(const O of E.matchAll(S))v.push(i(O[1]));return(0,t.compact)((0,t.uniq)(v))}function i(P){let d=P.replace(/['"]/g,"");return d.includes(" as ")?d=d.split(" as ")[0]:d.includes(" ")&&(d=d.split(" ")[0]),d.includes(".")&&(d=d.split(".").pop()||""),d.trim()}const x=(0,t.memoize)(p,(P,d)=>P+y(d)),g=(0,t.memoize)(c,(P,d)=>P+y(d));function p(P,d){const D=d.getNode(P);if(!D)return[];const b=[];function E(v){const C=v.inputEdges;C.length>0?C.forEach(S=>{S.inputNode&&E(S.inputNode)}):b.push(v)}return E(D),b.map(v=>v.name)}function c(P,d){const D=d.getNode(P);if(!D)return[];const b=[];function E(v){v.outputEdges.forEach(S=>{S.outputNode&&(b.push(S.outputNode),E(S.outputNode))})}return E(D),b.map(v=>v.name)}function y(P){return Object.keys(P.nodes).map(d=>{const D=P.nodes[d],b=D.outputEdges.map(v=>v.outputNode?.name).join(", "),E=D.inputEdges.map(v=>v.inputNode?.name).join(", ");return`${D.name}:${b}:${E}`}).join(" ")}},54513:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>H});var t=e(96540),n=e(28105),r=e(2543),o=e(39741),s=e(62467),m=e(66847),a=e(1005),l=e(81160),f=e(24726),h=e(41119),u=e(47520),i=e(17548),x=e(22592),g=e(77154),p=e(78282),c=e(36580),y=e(97534),P=e(56840),d=e(83873),D=e(44022),b=e(77526),E=e(39050),v=e(42970),C=e(4651);const S={from:21600,to:0},O=(_,Z)=>{const ne=I(_,Z);if(!ne)return S;const{from:te,to:Y}=T(ne,Z);return!te.length&&!Y.length?S:{from:Math.max(...te),to:Math.min(...Y)}},I=(_,Z)=>{switch(_.type){case C.Tz.classic:return R(_);case C.Tz.math:case C.Tz.sql:return L(_,Z);case C.Tz.resample:case C.Tz.reduce:case C.Tz.threshold:return K(_)}},R=_=>_.conditions?.map(Z=>Z.query.params[0]),T=(_,Z)=>{const ne=[],te=[S.to];for(const Y of _){const Q=Z.find(J=>J.refId===Y);!Q||!Q.relativeTimeRange||(ne.push(Q.relativeTimeRange.from),te.push(Q.relativeTimeRange.to))}return{from:ne,to:te}},L=(_,Z)=>Z.filter(ne=>ne.queryType==="query"&&_.expression?.includes(ne.refId)).map(ne=>ne.refId),K=_=>_.expression?[_.expression]:void 0;class A{constructor(Z=(0,d.AI)(),ne=(0,p.l)()){this.backendSrv=Z,this.dataSourceSrv=ne,this.subject=ne
163w o.m(1),this.lastResult={}}get(){return this.subject.asObservable()}async run(Z,ne){const te=await this.prepareQueries(Z);if(te.length===0)return;const Q=te.some(J=>J.refId===ne)?ne:"";this.subscription=W(this.backendSrv,te,Q).subscribe({next:J=>{const q=U(J,(oe,ae)=>{const ie=this.lastResult[oe],fe=(0,h.N$)(ae,ie);return(0,E.B)(fe,ie)}),[X,se]=(0,v.wz)(Z);se.forEach(oe=>{q[oe.source]=F(oe)}),this.lastResult=q,this.subject.next(this.lastResult)},error:J=>{this.lastResult=V(this.lastResult,J),this.subject.next(this.lastResult)}})}async prepareQueries(Z){const ne=[];for(const J of Z){const q=J.model.refId;if((0,D.f)(J.model))continue;const X=await this.dataSourceSrv.get(J.datasourceUid);X instanceof c.iy&&X.filterQuery&&!X.filterQuery(J.model)&&ne.push(q)}const[te]=(0,v.wz)(Z),Y=Object.keys(te.nodes);return ne.forEach(J=>{const q=(0,v.p_)(J,te);ne.push(...q)}),Z.filter(J=>!Y.includes(J.refId)).forEach(J=>{ne.push(J.refId)}),(0,r.reject)(Z,J=>ne.includes(J.refId))}cancel(){if(!this.subscription)return;this.subscription.unsubscribe();let Z=!1;const ne=U(this.lastResult,(te,Y)=>(Y.state===n.Gu.Loading&&(Z=!0),{...Y,state:n.Gu.Done}));Z&&this.subject.next(ne)}destroy(){this.subject&&this.subject.complete(),this.cancel()}}const W=(_,Z,ne)=>{const te=N(Z,n.Gu.Loading),Y={data:{data:Z,condition:ne},url:"/api/v1/eval",method:"POST",requestId:(0,f.A)()};return(0,u.k)({whileLoading:te,source:_.fetch(Y).pipe(j(te),(0,m.W)(Q=>(0,s.of)(V(te,Q))),(0,b.N)(_,Y.requestId),(0,a.u)())})},N=(_,Z)=>_.reduce((ne,te)=>(ne[te.refId]={state:Z,series:[],timeRange:w(te,_)},ne),{}),w=(_,Z)=>{if((0,D.f)(_.model)){const ne=O(_.model,Z);return i.relativeToTimeRange(ne)}return _.relativeTimeRange?i.relativeToTimeRange(_.relativeTimeRange):(console.warn(`Query with refId: ${_.refId} did not have any relative time range, using default.`),(0,x.E2)())},j=_=>(0,l.T)(Z=>{const{data:ne}=Z,te={};for(const[Y,Q]of Object.entries(ne.results)){const{error:J,status:q,frames:X=[]}=Q,se=J?[{message:J,refId:Y,status:q}]:[];te[Y]={errors:se,timeRange:_[Y].timeRange,state:n.Gu.Done,series:X.map(g.or)}}return te}),V=(_,Z)=>{const ne=(0,y.u)(Z);return U(_,(te,Y)=>Y.state===n.Gu.Error?Y:{...Y,state:n.Gu.Error,error:ne})},U=(_,Z)=>{const ne={};for(const[te,Y]of Object.entries(_))ne[te]=Z(te,Y);return ne},F=_=>({series:[],state:n.Gu.Error,errors:[{message:M(_)}],timeRange:(0,x.E2)()});function M(_){return _.source===_.target?(0,P.t)("alerting.dag.self-reference","You can't link an expression to itself"):(0,P.t)("alerting.dag.missing-reference",'Expression "{{source}}" failed to run because "{{target}}" is missing or also failed.',{source:_.source,target:_.target})}function H(){const[_,Z]=(0,t.useState)({}),ne=(0,t.useRef)(new A);(0,t.useEffect)(()=>{const q=ne.current;return q.get().subscribe(X=>{Z(X)}),()=>{q.destroy()}},[]);const te=(0,t.useCallback)(()=>{Z({})},[]),Y=(0,t.useCallback)(()=>{ne.current.cancel()},[]),Q=(0,t.useCallback)((q,X)=>{ne.current.run(q,X)},[]),J=(0,t.useMemo)(()=>Object.values(_).some(q=>q.state===n.Gu.Loading),[_]);return{queryPreviewData:_,runQueries:Q,cancelQueries:Y,isPreviewLoading:J,clearPreviewData:te}}},55376:(ee,B,e)=>{"use strict";e.d(B,{Cl:()=>p,I3:()=>i,YG:()=>E,an:()=>d,lb:()=>y,xb:()=>g,yW:()=>b,yr:()=>P,zy:()=>c});var t=e(2543),n=e.n(t),r=e(39884),o=e(33553),s=e(28105),m=e(739),a=e(65642),l=e(2954),f=e(44022),h=e(4651),u=e(42970);function i(v,C,S){return v.map(O=>{if(C===S||!(0,f.f)(O.model))return O;const I=O.model.type==="math",R=O.model.type==="reduce",T=O.model.type==="resample",L=O.model.type==="classic_conditions",K=O.model.type==="threshold";if(I)return{...O,model:{...O.model,expression:x(O.model.expression??"",C,S)}};if(T||R||K){const A=O.model.expression===C;return{...O,model:{...O.model,expression:A?S:O.model.expression}}}if(L){const A=O.model.conditions?.map(W=>({...W,query:{...W.query,params:W.query.params.map(N=>N===C?S:N)}}));return{...O,model:{...O.model,conditions:A}}}return O})}function x(v,C,S){const O=new RegExp("(\\$"+C+"\\b)|(\\${"+C+"})","gm"),I="${"+S+"}";return v.replace(O,I)}function g(v,C){return v.find(S=>S.refId===C)!==void 0}function p(v){return v.includes("/")||v.includes("\\")}function c(v){if(v.series.length===0)return;const C=(0,r.jq)(v.series);let S;return C&&(S=new Error("You cannot use time series data as an alert condition, consider adding a reduce expression.")),S}function y(v){if(v.errors?.length)return new Error(v.errors[0].message)}
163function P(v){const S=(v[0]?.meta?.notices??[]).find(O=>O.severity==="warning")?.text;return S?new Error(S):void 0}function d(v,C){const S={},O=[h.Tz.threshold,h.Tz.classic];if(!C)return S;for(const T of v){if(!(0,f.f)(T.model)||!O.includes(T.model.type)||!Array.isArray(T.model.conditions)||T.model.refId!==C)continue;const L=T.model.conditions.some(D);T.model.conditions.forEach(K=>{const A=K.evaluator.params,W=K.query?.params[0]??T.model.expression;if(!W)return;const N=D(K);try{const w=(0,u.vL)(v),j=(0,u.qQ)(W,w);v.filter(U=>j.includes(U.refId)).forEach(U=>{const F=U.refId,H=!!(!(0,f.f)(U?.model)&&F);F&&!S[F]&&(S[F]={config:{mode:o.O.Absolute,steps:[]},mode:m.Ly.Line}),F&&H&&!N&&!L?I(F,A[0]):F&&H&&N&&(R(F,A,K.evaluator.type),S[F].mode=m.Ly.LineAndArea)})}catch(w){console.error("Failed to parse thresholds",w);return}})}function I(T,L){S[T].config.steps.push({value:-1/0,color:"transparent"},{value:L,color:a.$W.theme2.colors.error.main})}function R(T,L,K){K===l.p.IsWithinRange&&S[T].config.steps.push({value:-1/0,color:"transparent"},{value:L[0],color:a.$W.theme2.colors.error.main},{value:L[1],color:a.$W.theme2.colors.error.main},{value:L[1],color:"transparent"}),K===l.p.IsOutsideRange&&S[T].config.steps.push({value:-1/0,color:a.$W.theme2.colors.error.main},{value:L[0],color:a.$W.theme2.colors.error.main},{value:L[0],color:"transparent"},{value:L[1],color:a.$W.theme2.colors.error.main}),K===l.p.IsWithinRangeIncluded&&S[T].config.steps.push({value:-1/0,color:"transparent"},{value:L[0],color:a.$W.theme2.colors.error.main},{value:L[1],color:a.$W.theme2.colors.error.main},{value:L[1],color:"transparent"}),K===l.p.IsOutsideRangeIncluded&&S[T].config.steps.push({value:-1/0,color:a.$W.theme2.colors.error.main},{value:L[0],color:a.$W.theme2.colors.error.main},{value:L[0],color:"transparent"},{value:L[1],color:a.$W.theme2.colors.error.main}),S[T].config.steps.sort((A,W)=>A.value-W.value),S[T].config.steps=S[T].config.steps.filter(A=>A.value!==void 0)}return S}function D(v){return v.evaluator.type===l.p.IsWithinRange||v.evaluator.type===l.p.IsOutsideRange||v.evaluator.type===l.p.IsOutsideRangeIncluded||v.evaluator.type===l.p.IsWithinRangeIncluded}function b(v){const C="Failed to fetch data";if(v.state!==s.Gu.Error)return;const S=v.errors;return S?.length?S.map(O=>O.message??C).join(", "):v.error?.message??C}function E(v,C){const S=C.filter(T=>!(0,f.f)(T.model)).map(T=>T.refId),O=v.filter(T=>!(0,f.f)(T.model)).map(T=>T.refId),[I,R]=(0,t.xor)(O,S);return[I,R]}},94380:(ee,B,e)=>{"use strict";e.d(B,{A:()=>U});var t=e(74848),n=e(32899),r=e(87063),o=e(88559),s=e(45229),m=e(56840),a=e(64762),l=e(70327),f=e(96137),h=e(67598),u=e(80218),i=e(71639);function x(){const[F]=(0,i.D)(),[M]=l.hK.endpoints.upsertRuleGroupForNamespace.useMutation(),H=(0,m.t)("alerting.rules.pause-rule.success","Rule evaluation paused"),_=(0,m.t)("alerting.rules.resume-rule.success","Rule evaluation resumed");return(0,u.Yb)(async(Z,ne,te)=>{const Y=(0,h.Rc)(Z),Q=(0,f.LH)({uid:ne,pause:te}),{newRuleGroupDefinition:J,rulerConfig:q}=await F(Y,[Q]);return M({rulerConfig:q,namespace:Z.namespace.uid,payload:J,notificationOptions:{successMessage:te?H:_}}).unwrap()})}var g=e(77256),p=e(29609);const y=({rule:F,groupIdentifier:M,onPauseChange:H})=>{const _=(0,a._2)(),[Z,ne]=x(),[te,Y]=(0,p.hC)(F)?["play","Resume evaluation"]:["pause","Pause evaluation"],Q=async J=>{try{await Z.execute(M,F.grafana_alert.uid,J)}catch(q){_.error(`Failed to ${J?"pause":"resume"} the rule: ${(0,g.JZ)(q)}`);return}H?.()};return(0,t.jsx)(r.W.Item,{label:Y,icon:te,disabled:(0,u.VP)(ne),onClick:()=>{Q(!F.grafana_alert.is_paused)}})};var P=e(50072),d=e(96540),D=e(54092),b=e(46907),E=e(24619);function v(F,M){const H=(0,d.useRef)([]),_=C(F,M),{links:Z}=(0,b.U)(_);if(!F)return H.current;const ne=(0,p.uo)(F),te=F.type;if(!ne||!te)return H.current;const{pluginId:Y}=ne;return Z.filter(Q=>Q.pluginId===Y)}function C(F,M){return(0,d.useMemo)(()=>{if(!F)return{extensionPointId:""};const H=F.type,{namespace:_,groupName:Z}=M,ne="uid"in _?_.uid:_.name;switch(H){case E.JS.Alerting:return{extensionPointId:D.S.AlertingAlertingRuleAction,context:{name:F.name,namespace:ne,group:Z,expression:F.query,labels:F.labels??{},annotations:F.annotations??{}}};case E.JS.Recording:return{extensionPointId:D.S.AlertingRecordingRuleAction,context:{name:F.name,namespace:ne,group:Z,expression:F.query,labels:F.labels??{}}};default:return{extensionPointId:""}}},[M,F])}var S=e(16692),O=e(94646),I=e(92367),R=e(45967),T=e(3986),L=e(182),K=e(28405);const A=(0,L.Wx)(),W=({title:F="",severity:M="",url:H=""})=>{const _=createBridgeURL(A,"/incidents/declare",{title:F,severity:M,url:H}),{loading:Z,installed:ne,settings:te}=usePluginBridge(A);return jsxs(Fragment,{children:[Z===!0&&jsx(Button,{icon:"fire",size:"sm",type:"button",disabled:!0,children:jsx(Trans,{i18nKey:"alerting.declare-incident-button.declare-incident",children:"Declare Incident"})}),ne===!1&&jsx(Tooltip,{content:"Grafana Incident is not installed or is not configured correctly",children:jsx(Button,{icon:"fire",size:"sm",type:"button",disabled:!0,children:jsx(Trans,{i18nKey:"alerting.declare-incident-button.declare-incident",children:"Declare Incident"})})}),te&&jsx(LinkButton,{icon:"fire",size:"sm",type:"button",href:_,children:jsx(Trans,{i18nKey:"alerting.declare-incident-button.declare-incident",children:"Declare Incident"})})]})},N=({title:F="",severity:M="",url:H=""})=>{const _=(0,K.h)(A,"/incidents/declare",{title:F,severity:M,url:H}),{loading:Z,installed:ne,settings:te}=(0,T._)(A);return(0,t.jsxs)(t.Fragment,{children:[Z===!0&&(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.declare-incident-menu-item.label-declare-incident","Declare incident"),icon:"fire",disabled:!0}),ne===!1&&(0,t.jsx)(R.m,{content:"Grafana Incident is not installed or is not configured correctly",children:(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.declare-incident-menu-item.label-declare-incident","Declare incident"),icon:"fire",disabled:!0})}),te&&(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.declare-incident-menu-item.label-declare-incident","Declare incident"),url:_,icon:"fire"})]})}
163,w=({promRule:F,rulerRule:M,identifier:H,groupIdentifier:_,handleSilence:Z,handleDelete:ne,handleDuplicateRule:te,onPauseChange:Y,buttonSize:Q})=>{const[J,q]=(0,S.mW)(M,_,S.j5.Pause),X=J&&q,[se,oe]=(0,S.mW)(M,_,S.j5.Delete),ae=se&&oe,[ie,fe]=(0,S.mW)(M,_,S.j5.Duplicate),pe=ie&&fe,[de,le]=(0,S.mW)(M,_,S.j5.Silence),me=de&&le,[De,Te]=(0,S.mW)(M,_,S.j5.ModifyExport),Ne=De&&Te,Ce=v(F,_),He=Ce.length>0,ke=(!(0,g.y$)()||(0,g.ES)())&&p.R$.alertingRule(F)&&F.state===E.cF.Firing,Me=(0,g.S2)(H),$e=[X,me,ke,pe].some(Boolean)&&[Ne].some(Boolean),tt=(0,t.jsxs)(t.Fragment,{children:[X&&p.p.grafana.rule(M)&&_.groupOrigin==="grafana"&&(0,t.jsx)(y,{rule:M,groupIdentifier:_,onPauseChange:Y}),me&&(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.alert-menu.silence-notifications","Silence notifications"),icon:"bell-slash",onClick:Z}),ke&&(0,t.jsx)(N,{title:F.name,url:""}),pe&&(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.alert-menu.duplicate","Duplicate"),icon:"copy",onClick:()=>te(H)}),$e&&(0,t.jsx)(r.W.Divider,{}),Me&&(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.alert-menu.copy-link","Copy link"),icon:"share-alt",onClick:()=>V(Me)}),Ne&&(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.alert-menu.export","Export"),icon:"download-alt",childItems:[(0,t.jsx)(j,{identifier:H},"export-with-modifications")]}),He&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.W.Divider,{}),Ce.map(Ke=>(0,t.jsx)(r.W.Item,{label:Ke.title,icon:Ke.icon,onClick:Ke.onClick},Ke.id))]}),ae&&M&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.W.Divider,{}),(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.common.delete","Delete"),icon:"trash-alt",destructive:!0,onClick:()=>ne(M,_)})]})]});return(0,t.jsx)(o.m,{overlay:(0,t.jsx)(r.W,{children:tt}),children:(0,t.jsx)(P.A,{size:Q})})},j=({identifier:F})=>{const M=location.pathname+location.search,H=(0,I.G)(`/alerting/${encodeURIComponent(O.$9(F))}/modify-export`,{returnTo:M});return(0,t.jsx)(r.W.Item,{label:(0,m.t)("alerting.alert-menu.with-modifications","With modifications"),icon:"file-edit-alt",url:H},"with-modifications")};function V(F){navigator.clipboard?.writeText(F).then(()=>{s.A.emit(n.r1.alertSuccess,["URL copied to clipboard"])})}const U=w},53567:(ee,B,e)=>{"use strict";e.d(B,{w:()=>g});var t=e(74848),n=e(96540),r=e(36490),o=e(71599),s=e(56840),m=e(8535),a=e(74869),l=e(75756),f=e(80276),h=e(11018),u=e(67598),i=e(29609);const x=(0,a.wS)(),g=(p=!1)=>{const[c,y]=(0,n.useState)(),[P]=(0,l.Y)(),{waitForRemoval:d}=(0,f.IH)(),D=(0,a.f2)(),b=(0,n.useCallback)(()=>{y(void 0)},[]),E=(0,n.useCallback)((S,O)=>{y({ruleIdentifier:S,groupIdentifier:O})},[]),v=(0,n.useCallback)(async()=>{if(!c)return;const{ruleIdentifier:S,groupIdentifier:O}=c,I=(0,u.Rc)(O),R=I.dataSourceName;await P.execute(I,S),(0,m.JD)((0,h.Lc)({rulesSourceName:R})),x&&(0,i.X4)(S)?await d(S):await(0,m.JD)((0,h.eB)({rulesSourceName:R})),b(),p&&r.Ny.replace("/alerting/list")},[P,b,c,p,d]);return[(0,n.useMemo)(()=>(0,t.jsx)(o.u,{isOpen:!!c,title:(0,s.t)("alerting.delete-rule-modal.title","Delete rule"),body:D?(0,s.t)("alerting.delete-rule-modal.with-soft-delete","Are you sure you want to delete this rule? This rule will be recoverable from the Recently deleted page by a user with an admin role."):(0,s.t)("alerting.delete-rule-modal.without-soft-delete","Deleting this rule will permanently remove it from your alert rule list. Are you sure you want to delete this rule?"),confirmText:"Yes, delete",icon:"exclamation-triangle",onConfirm:v,onDismiss:b}),[c,v,b,D]),E,b]}},54552:(ee,B,e)=>{"use strict";e.d(B,{K:()=>o,k:()=>s});var t=e(74848),n=e(96540);const r=n.createContext(void 0),o=({children:m,rule:a,identifier:l})=>{const f={rule:a,identifier:l};return(0,t.jsx)(r.Provider,{value:f,children:m})},s=()=>{const m=n.useContext(r);if(m===void 0)throw new Error("useAlertRule must be used within a AlertRuleContext");return m}},74159:(ee,B,e)=>{"use strict";e.d(B,{gQ:()=>Nt,rf:()=>yt,Ay:()=>Wt,lf:()=>Nn,P5:()=>Fn});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(49185),m=e(41654),a=e(34999),l=e(13941),f=e(63142),h=e(89640),u=e(66404),i=e(45861),x=e(36303),g=e(47327),p=e(70958),c=e(56840),y=e(85311),P=e(3969),d=e(86791),D=e(24619),b=e(74268),E=e(28390),v=e(74869),C=e(80218),S=e(44109),O=e(11940),I=e(80276),R=e(39187),T=e(17305),L=e(95443),K=e(52161),A=e(77256),W=e(29442),N=e(29609),w=e(7840),j=e(36826),V=e(1972),U=e(2401),F=e(88589),M=e(14050);function H(){return(0,t.jsx)(a.F,{severity:"info",title:(0,c.t)("alerting.federated-rule-warning.title-federated-group","This rule is part of a federated rule group."),bottomSpacing:0,topSpacing:2,children:(0,t.jsxs)(m.B,{direction:"column",children:["Federated rule groups are currently an experimental feature.",(0,t.jsx)(i.$n,{fill:"text",icon:"book",children:(0,t.jsx)("a",{href:"https://grafana.com/docs/metrics-enterprise/latest/tenant-management/tenant-federation/#cross-tenant-alerting-and-recording-rule-federation",children:(0,t.jsx)(c.x6,{i18nKey:"alerting.federated-rule-warning.read-documentation",children:"Read documentation"})})})]})})}var _=e(30703);function Z(){return(0,t.jsx)(u.E,{variant:"bodySmall",color:"warning",children:(0,t.jsxs)(m.B,{direction:"row",alignItems:"center",gap:.25,wrap:"nowrap",flex:"0 0 auto",children:[(0,t.jsx)(_.I,{name:"pause",size:"xs"})," Paused"]})})}var ne=e(54552);const te=({color:et,includeState:Je})=>{const rt=(0,f.of)(Y,{color:et,includeState:Je});return(0,t.jsx)(m.B,{direction:"row",gap:.5,children:(0,t.jsx)("div",{className:rt.dot})})},Y=(et,Je)=>{const rt=et.spacing(1.25),it=`calc(${rt} / 2.5)`,Pt=Je.color==="error",It=Je.color==="success",Vt=Je.color==="warning";
163return{dot:(0,n.css)({width:rt,height:rt,borderRadius:"100%",backgroundColor:et.colors.secondary.main,outline:`solid ${it} ${et.colors.secondary.transparent}`,margin:it},It&&(0,n.css)({backgroundColor:et.colors.success.main,outlineColor:et.colors.success.transparent}),Vt&&(0,n.css)({backgroundColor:et.colors.warning.main,outlineColor:et.colors.warning.transparent}),Pt&&(0,n.css)({backgroundColor:et.colors.error.main,outlineColor:et.colors.error.transparent}))}},Q=({health:et})=>{const Je=Nn(et),rt=Je?"error":"success",it=Je?"Recording error":"Recording";return(0,t.jsx)(q,{color:rt,text:it})},J=({state:et,health:Je})=>{let rt,it;switch(et){case D.cF.Inactive:it="success",rt="Normal";break;case D.cF.Firing:it="error",rt="Firing";break;case D.cF.Pending:it="warning",rt="Pending";break;case D.cF.Recovering:it="warning",rt="Recovering";break}return Nn(Je)&&(it="error",rt="Error"),Je==="nodata"&&(it="warning",rt="No data"),(0,t.jsx)(q,{color:it,text:rt})};function q({color:et,text:Je}){return(0,t.jsxs)(m.B,{direction:"row",gap:.5,wrap:"nowrap",flex:"0 0 auto",children:[(0,t.jsx)(te,{color:et}),(0,t.jsx)(u.E,{variant:"bodySmall",color:et,children:Je})]})}var X=e(3845),se=e(45746),oe=e(43173),ae=e(58138);const ie=(0,o.lazy)(()=>e.e(2835).then(e.bind(e,32835))),fe=(0,o.lazy)(()=>Promise.all([e.e(8706),e.e(4302)]).then(e.bind(e,54302))),pe=({rule:et})=>{const Je=oe.$.unifiedAlerting.alertStateHistoryBackend,rt=oe.$.unifiedAlerting.alertStateHistoryPrimary,Pt=[Je,rt].some(Vt=>Vt===ae.Q.Loki)?ae.Q.Loki:ae.Q.Annotations,It=et.grafana_alert.uid;return(0,t.jsxs)(o.Suspense,{fallback:"Loading...",children:[Pt===ae.Q.Loki&&(0,t.jsx)(fe,{ruleUID:It}),Pt===ae.Q.Annotations&&(0,t.jsx)(ie,{ruleUID:It})]})};var de=e(95943),le=e(66773);const me=({rule:et})=>(0,t.jsx)(le.s,{rule:et,pagination:{itemsPerPage:de.FG},enableFiltering:!0});var De=e(17548),Te=e(5556),Ne=e(27074),Ce=e(99887),He=e(44022),ke=e(4651),Me=e(2954),$e=e(49779),tt=e(51993),Ke=e(55376),Re=e(89144);function Ve({data:et,thresholds:Je}){return et?(0,t.jsx)(Re.j,{data:et,thresholds:Je?.config,thresholdsType:Je?.mode}):null}var Qe=e(20382),je=e(20437),ze=e(65232);const Ye=({expression:et})=>(0,t.jsx)(ze.m,{options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastColumn:0,scrollBeyondLastLine:!1,lineNumbers:"off",cursorWidth:0,overviewRulerLanes:0},defaultLanguage:"sql",height:80,defaultValue:et,width:"100%"});function Ge(et){return"rawSql"in et}const ce=null,Pe=o.lazy(()=>e.e(3659).then(e.bind(e,33659))),Se=o.lazy(()=>e.e(4964).then(e.bind(e,24964)));function Ee({model:et,dataSource:Je}){return(0,K.bS)(Je.type)&&(0,je.Bu)(et)?(0,t.jsx)(Pe,{query:et.expr}):Je.type===K.ol.Loki&&(0,je.Bu)(et)?(0,t.jsx)(Se,{query:et.expr??""}):Ge(et)?(0,t.jsx)(Ye,{expression:et.rawSql}):(0,t.jsx)("pre",{children:(0,t.jsx)("code",{children:(0,Qe.Bh)(et)})})}var xe=e(16692);function ye({rule:et,queries:Je,condition:rt,evalDataByQuery:it={}}){const Pt=(0,r.keyBy)(Object.values(oe.$.datasources),Qt=>Qt.uid),It=Je.filter(Qt=>!(0,He.f)(Qt.model)),Vt=Je.filter(Qt=>(0,He.f)(Qt.model)),en=(0,f.of)(Xt),ln=(0,Ke.an)(Je,rt);return(0,t.jsxs)(m.B,{gap:1,direction:"column",flex:"1 1 320px",children:[(0,t.jsx)("div",{className:en.maxWidthContainer,children:(0,t.jsx)(m.B,{gap:1,wrap:"wrap","data-testid":"queries-container",children:It.map(({model:Qt,relativeTimeRange:xn,refId:En,datasourceUid:zn},Gn)=>{const St=Pt[zn];return(0,t.jsx)(Oe,{rule:et,refId:En,model:Qt,relativeTimeRange:xn,dataSource:St,thresholds:ln[En],queryData:it[En]},Gn)})})}),(0,t.jsx)("div",{className:en.maxWidthContainer,children:(0,t.jsx)(m.B,{gap:1,wrap:"wrap","data-testid":"expressions-container",children:Vt.map(({model:Qt,refId:xn,datasourceUid:En},zn)=>(0,He.f)(Qt)&&(0,t.jsx)(st,{refId:xn,isAlertCondition:rt===xn,model:Qt,evalData:it[xn]},zn))})})]})}function Oe({refId:et,rule:Je,thresholds:rt,model:it,dataSource:Pt,queryData:It,relativeTimeRange:Vt}){const en=(0,f.of)(Xe),ln=(0,He.f)(it),[Qt,xn]=(0,xe.mh)(Je,xe.j5.Explore),En=Qt&&xn,zn=[];if(Pt){const St=Pt.name??"[[Data source not found]]",Ht=Pt.meta.info.logos.small;zn.push((0,t.jsx)(Be,{name:St,imgUrl:Ht},"datasource"))}Vt&&zn.push((0,t.jsxs)(u.E,{color:"secondary",children:[De.secondsToHms(Vt.from)," to now"]},"timerange"));let Gn;return!ln&&En&&(Gn=Pt&&we(Pt,it)),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(lt,{refId:et,headerItems:zn,exploreLink:Gn,children:(0,t.jsx)("div",{className:en.queryPreviewWrapper,children:(0,t.jsx)(x.Xw,{children:it&&Pt&&(0,t.jsx)(Ee,{model:it,dataSource:Pt})})})}),Pt&&(0,t.jsx)(Ve,{data:It,thresholds:rt})]})}function we(et,Je){const{uid:rt,type:it}=et,{refId:Pt,...It}=Je;return Te.kM.renderUrl(`${oe.$.appSubUrl}/explore`,{left:JSON.stringify({datasource:et.uid,queries:[{refId:"A",...It,datasource:{type:it,uid:rt}}],range:{from:"now-1h",to:"now"}})})}function Be({name:et,imgUrl:Je}){const rt=(0,f.of)(Xe);return(0,t.jsxs)("div",{className:rt.dataSource,children:[(0,t.jsx)("img",{src:Je,width:16,alt:et}),et]},"datasource")}const Xe=et=>({queryPreviewWrapper:(0,n.css)({margin:et.spacing(1)}),contentBox:(0,n.css)({flex:"1 0 100%"}),dataSource:(0,n.css)({border:`1px solid ${et.colors.border.weak}
163`,borderRadius:et.shape.radius.default,padding:et.spacing(.5,1),display:"flex",alignItems:"center",gap:et.spacing(1)})});function st({refId:et,model:Je,evalData:rt,isAlertCondition:it}){const Pt=(0,f.of)(Et);function It(){switch(Je.type){case ke.Tz.math:return(0,t.jsx)(Cn,{model:Je});case ke.Tz.reduce:return(0,t.jsx)(wt,{model:Je});case ke.Tz.resample:return(0,t.jsx)(xt,{model:Je});case ke.Tz.classic:return(0,t.jsx)(Tt,{model:Je});case ke.Tz.threshold:return(0,t.jsx)(bt,{model:Je});case ke.Tz.sql:return(0,t.jsx)(Ne.l,{rawSql:Je.expression||"",datasourceType:Je.datasource?.type});default:return(0,t.jsxs)(t.Fragment,{children:["Expression not supported: ",Je.type]})}}return(0,t.jsxs)(lt,{refId:et,headerItems:[(0,t.jsx)(u.E,{color:"secondary",children:(0,r.startCase)(Je.type)},"expression-type")],isAlertCondition:it,children:[(0,t.jsxs)("div",{className:Pt.previewWrapper,children:[rt?.errors?.map(Vt=>(0,t.jsx)(a.F,{title:(0,c.t)("alerting.expression-preview.title-expression-failed","Expression failed"),severity:"error",bottomSpacing:1,children:Vt.message},(0,r.uniqueId)())),It()]}),(0,t.jsx)($e.h,{}),rt&&(0,t.jsx)(tt.GX,{series:rt.series,isAlertCondition:it})]})}function lt({refId:et,headerItems:Je=[],children:rt,isAlertCondition:it,exploreLink:Pt}){const It=(0,f.of)(Et);return(0,t.jsxs)("div",{className:(0,n.cx)(It.container),children:[(0,t.jsxs)("header",{className:It.header,children:[(0,t.jsx)("span",{className:It.refId,children:et}),Je,(0,t.jsx)($e.h,{}),it&&(0,t.jsx)(Ce.E,{color:"green",icon:"check",text:(0,c.t)("alerting.query-box.text-alert-condition","Alert condition")}),Pt&&(0,t.jsx)(U.d,{component:(0,t.jsx)(i.z9,{size:"md",variant:"secondary",icon:"compass",href:Pt,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.query-box.view-in-explore",children:"View in Explore"})})})]}),rt]})}const Et=et=>({container:(0,n.css)({flex:"1 0 25%",border:`1px solid ${et.colors.border.weak}`,maxWidth:"100%",borderRadius:et.shape.radius.default,display:"flex",flexDirection:"column"}),header:(0,n.css)({display:"flex",alignItems:"center",gap:et.spacing(1),padding:et.spacing(1),backgroundColor:et.colors.background.secondary}),textBlock:(0,n.css)({border:`1px solid ${et.colors.border.weak}`,padding:et.spacing(.5,1),backgroundColor:et.colors.background.primary,borderRadius:et.shape.radius.default}),refId:(0,n.css)({color:et.colors.text.link,padding:et.spacing(.5,1),border:`1px solid ${et.colors.border.weak}`,borderRadius:et.shape.radius.default}),previewWrapper:(0,n.css)({padding:et.spacing(1)})});function Tt({model:et}){const Je=(0,f.of)(Mt),rt=(0,r.keyBy)(Me.A.reducerTypes,It=>It.value),it=(0,r.keyBy)(Me.A.evalOperators,It=>It.value),Pt=(0,r.keyBy)(Me.A.evalFunctions,It=>It.value);return(0,t.jsx)("div",{className:Je.container,children:et.conditions?.map(({query:It,operator:Vt,reducer:en,evaluator:ln},Qt)=>{const xn=Wn(ln);return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("div",{className:Je.blue,children:Qt===0?"WHEN":!!Vt?.type&&it[Vt?.type]?.text}),(0,t.jsx)("div",{className:Je.bold,children:en?.type&&rt[en.type]?.text}),(0,t.jsx)("div",{className:Je.blue,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.classic-condition-viewer.of",children:"OF"})}),(0,t.jsx)("div",{className:Je.bold,children:It.params[0]}),(0,t.jsx)("div",{className:Je.blue,children:Pt[ln.type].text}),(0,t.jsx)("div",{className:Je.bold,children:xn?`(${ln.params[0]}; ${ln.params[1]})`:ln.params[0]})]},Qt)})})}const Mt=et=>({container:(0,n.css)({display:"grid",gridTemplateColumns:"repeat(6, max-content)",gap:et.spacing(0,1)}),...vn(et)});function wt({model:et}){const Je=(0,f.of)(_e),{reducer:rt,expression:it,settings:Pt}=et,It=ke.Cu.find(ln=>ln.value===rt),Vt=Pt?.mode??ke.Mt.Strict,en=ke.HZ.find(ln=>ln.value===Vt);return(0,t.jsxs)("div",{className:Je.container,children:[(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.reduce-condition-viewer.function",children:"Function"})}),(0,t.jsx)("div",{className:Je.value,children:It?.label}),(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.reduce-condition-viewer.input",children:"Input"})}),(0,t.jsx)("div",{className:Je.value,children:it}),(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.reduce-condition-viewer.mode",children:"Mode"})}),(0,t.jsx)("div",{className:Je.value,children:en?.label})]})}const _e=et=>({container:(0,n.css)({display:"grid",gap:et.spacing(.5),gridTemplateRows:"1fr 1fr",gridTemplateColumns:"repeat(4, 1fr)","> :nth-child(6)":{gridColumn:"span 3"}}),...vn(et)});function xt({model:et}){const Je=(0,f.of)(At),{expression:rt,window:it,downsampler:Pt,upsampler:It}=et,Vt=ke.PN.find(ln=>ln.value===Pt),en=ke.iX.find(ln=>ln.value===It);return(0,t.jsxs)("div",{className:Je.container,children:[(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.resample-expression-viewer.input",children:"Input"})}),(0,t.jsx)("div",{className:Je.value,children:rt}),(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.resample-expression-viewer.resample-to",children:"Resample to"})}),(0,t.jsx)("div",{className:Je.value,children:it}),(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.resample-expression-viewer.downsample",children:"Downsample"})}),(0,t.jsx)("div",{className:Je.value,children:Vt?.label}),(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.resample-expression-viewer.upsample",children:"Upsample"})}),(0,t.jsx)("div",{className:Je.value,children:en?.label})]})}const At=et=>({container:(0,n.css)({display:"grid",gap:et.spacing(.5),gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"1fr 1fr"}),...vn(et)});function bt({model:et}){const Je=(0,f.of)(Xt),{expression:rt,conditions:it}=et,Pt=it&&it[0]?.evaluator,It=ke.zd.find(xn=>xn.value===Pt?.type),Vt=Pt?Wn(Pt):!1,en=it&&it[0]?.unloadEvaluator,ln=ke.zd.find(xn=>xn.value===en?.type),Qt=en?Wn(en):!1;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:Je.container,children:[(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.threshold-expression-viewer.input",children:"Input"})}),(0,t.jsx)("div",{className:Je.value,children:rt}),Pt&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:Je.blue,children:It?.label}),(0,t.jsx)("div",{className:Je.bold,children:Vt?`(${Pt.params[0]}; ${Pt.params[1]})`:Pt.params[0]})]})]}
163),(0,t.jsx)("div",{className:Je.container,children:en&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.threshold-expression-viewer.stop-alerting-when",children:"Stop alerting when "})}),(0,t.jsx)("div",{className:Je.value,children:rt}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:Je.blue,children:ln?.label}),(0,t.jsx)("div",{className:Je.bold,children:Qt?`(${en.params[0]}; ${en.params[1]})`:en.params[0]})]})]})})]})}const Xt=et=>{const{blue:Je,bold:rt,...it}=vn(et);return{...it,maxWidthContainer:(0,n.css)({maxWidth:"100%"}),container:(0,n.css)({display:"flex",gap:et.spacing(.5)}),blue:(0,n.css)(Je,{margin:"auto 0"}),bold:(0,n.css)(rt,{margin:"auto 0"})}};function Cn({model:et}){const Je=(0,f.of)(Xt),{expression:rt}=et;return(0,t.jsxs)("div",{className:Je.container,children:[(0,t.jsx)("div",{className:Je.label,children:(0,t.jsx)(c.x6,{i18nKey:"alerting.math-expression-viewer.input",children:"Input"})}),(0,t.jsx)("div",{className:Je.value,children:rt})]})}const vn=et=>({blue:(0,n.css)({color:et.colors.text.link}),bold:(0,n.css)({fontWeight:et.typography.fontWeightBold}),label:(0,n.css)({display:"flex",alignItems:"center",padding:et.spacing(.5,1),backgroundColor:et.colors.background.secondary,fontSize:et.typography.bodySmall.fontSize,lineHeight:et.typography.bodySmall.lineHeight,fontWeight:et.typography.fontWeightBold,borderRadius:et.shape.radius.default}),value:(0,n.css)({padding:et.spacing(.5,1),border:`1px solid ${et.colors.border.weak}`,borderRadius:et.shape.radius.default})});function Wn(et){return et.type===Me.p.IsWithinRange||et.type===Me.p.IsOutsideRange||et.type===Me.p.IsOutsideRangeIncluded||et.type===Me.p.IsWithinRangeIncluded}var Dt=e(55096),qt=e(1932),Yt=e(15629);function nn(et){if(!et)return[];const{namespace:Je,rulerRule:rt}=et,{rulesSource:it}=Je;if(N.p.grafana.rule(rt)){const Pt=rt.grafana_alert.data;return Zt(Pt,rt.for??"",et.group.interval)}if((0,K.Eb)(it)){const Pt=ft(it,et);return[tn(Pt,it.uid)]}return[]}function Zt(et,Je,rt){const it=(0,Yt.P8)(Je)??(0,Yt.P8)(rt??"1m"),Pt=Math.floor(it/1e3);return et.map(It=>(0,qt.jM)(It,Vt=>{const en=Vt.relativeTimeRange?.from??0,ln=Math.max(Pt*3,en+Pt*2);Vt.relativeTimeRange={from:ln,to:0}}))}function tn(et,Je){return{refId:et.refId,datasourceUid:Je,queryType:"",model:et,relativeTimeRange:{from:360,to:0}}}function ft(et,Je){if(!(0,K.cl)(et.type))throw new Error(`Query for datasource type ${et.type} is currently not supported by cloud alert rules.`);return{refId:"A",expr:Je.query}}var Rt=e(54513);const Bt=({rule:et})=>{const{queryPreviewData:Je,runQueries:rt,isPreviewLoading:it}=(0,Rt.Y)(),Pt=(0,o.useMemo)(()=>nn(et),[et]),{allDataSourcesAvailable:It}=(0,Dt.g)(Pt),Vt=(0,o.useCallback)(()=>{if(Pt.length>0&&It){let ln;et&&N.p.grafana.rule(et.rulerRule)&&(ln=et.rulerRule.grafana_alert.condition),rt(Pt,ln??"A")}},[Pt,It,et,rt]);(0,o.useEffect)(()=>{It&&Vt()},[It,Vt]);const en=(0,N.YN)(et.group);return it?(0,t.jsx)(c.x6,{i18nKey:"alerting.common.loading",children:"Loading..."}):(0,t.jsxs)(t.Fragment,{children:[N.p.grafana.rule(et.rulerRule)&&!en&&(0,t.jsx)(ye,{rule:et,condition:et.rulerRule.grafana_alert.condition,queries:Pt,evalDataByQuery:Je}),!N.p.grafana.rule(et.rulerRule)&&!en&&Je&&Object.keys(Je).length>0&&(0,t.jsx)(m.B,{direction:"column",gap:1,children:Pt.map(ln=>(0,t.jsx)(Oe,{rule:et,refId:ln.refId,model:ln.model,dataSource:Object.values(oe.$.datasources).find(Qt=>Qt.uid===ln.datasourceUid),queryData:Je[ln.refId],relativeTimeRange:ln.relativeTimeRange},ln.refId))}),!en&&!It&&(0,t.jsx)(a.F,{title:(0,c.t)("alerting.rule-view.query.datasources-na.title","Query not available"),severity:"warning",children:(0,t.jsx)(c.x6,{i18nKey:"alerting.rule-view.query.datasources-na.description",children:"Cannot display the query preview. Some of the data sources used in the queries are not available."})})]})},jt=()=>(0,t.jsx)(c.x6,{i18nKey:"alerting.routing.routing",children:"Routing"});var Nt=(et=>(et.Query="query",et.Instances="instances",et.History="history",et.Routing="routing",et.Details="details",et.VersionHistory="version-history",et))(Nt||{});const $t=(0,v.wS)(),an=(0,v.sk)(),Jt=$t||an,gn=()=>{const{rule:et,identifier:Je}=(0,ne.k)(),{pageNav:rt,activeTab:it}=aa(et),[Pt,It]=(0,o.useState)(),{annotations:Vt,promRule:en,rulerRule:ln}=et,Qt=Nn(en?.health),xn=N.R$.alertingRule(en),En=(0,N.YN)(et.group),zn=N.p.grafana.rule(ln
163)&&!!ln.grafana_alert.provenance,Gn=N.p.grafana.rule(ln)&&(0,N.hC)(ln),St=Qt&&!Gn,Ht=ln?(0,N.uo)(ln):(0,N.uo)(en),cn=Vt[L.YH.summary];return(0,t.jsxs)(j.d,{pageNav:rt,navId:"alert-list",isLoading:!1,renderTitle:un=>(0,t.jsx)(_t,{name:un,paused:Gn,state:xn?en.state:void 0,health:en?.health,ruleType:en?.type,ruleOrigin:Ht}),actions:(0,t.jsx)(P.l,{rule:et,rulesSource:et.namespace.rulesSource}),info:mn(et),subTitle:(0,t.jsxs)(m.B,{direction:"column",children:[cn,Gn&&(0,t.jsx)(y.A,{}),En&&(0,t.jsx)(H,{}),zn&&(0,t.jsx)(V.Yi,{resource:V.hk.AlertRule,bottomSpacing:0,topSpacing:2}),St&&(0,t.jsx)(a.F,{title:(0,c.t)("alerting.rule-viewer.title-something-wrong-evaluating-alert","Something went wrong when evaluating this alert rule"),bottomSpacing:0,topSpacing:2,children:(0,t.jsx)("pre",{style:{marginBottom:0},children:(0,t.jsx)("code",{children:et.promRule?.lastError??"No error message"})})})]}),children:[Jt&&(0,t.jsx)(On,{ruleIdentifier:Je}),(0,t.jsx)(m.B,{direction:"column",gap:2,children:(0,t.jsxs)(l.J,{children:[it==="query"&&(0,t.jsx)(Bt,{rule:et}),it==="instances"&&(0,t.jsx)(me,{rule:et}),it==="history"&&N.p.grafana.rule(et.rulerRule)&&(0,t.jsx)(pe,{rule:et.rulerRule}),it==="routing"&&(0,t.jsx)(jt,{}),it==="details"&&(0,t.jsx)(se.B,{rule:et}),it==="version-history"&&N.p.grafana.rule(et.rulerRule)&&(0,t.jsx)(X.f,{rule:et.rulerRule})]})}),Pt&&(0,t.jsx)(M.Z,{redirectTo:!0,identifier:Pt,isProvisioned:zn,onDismiss:()=>It(void 0)})]})},mn=et=>{const{labels:Je,annotations:rt,group:it}=et,Pt=[],It=rt[L.YH.runbookURL],Vt=rt[L.YH.dashboardUID],en=rt[L.YH.panelID],ln=Vt&&en,Qt=Vt,xn=!(0,r.isEmpty)(Je),En=it.interval,zn=(0,f.of)(mt);if(It){const Gn=(0,r.truncate)(It,{length:42}),St=Ot(It)?(0,t.jsx)(h.Y,{variant:"bodySmall",className:zn.url,href:It,external:!0,children:Gn}):(0,t.jsx)(u.E,{variant:"bodySmall",children:Gn});Pt.push({label:"Runbook URL",value:St})}if(ln?Pt.push({label:"Dashboard and panel",value:(0,t.jsx)(U.d,{title:et.name,component:(0,t.jsx)(h.Y,{variant:"bodySmall",href:(0,A.D2)(Vt,en),children:(0,t.jsx)(c.x6,{i18nKey:"alerting.create-metadata.view-panel",children:"View panel"})})})}):Qt&&Pt.push({label:"Dashboard",value:(0,t.jsx)(U.d,{title:et.name,component:(0,t.jsx)(h.Y,{title:et.name,variant:"bodySmall",href:(0,A.JM)(Vt),children:(0,t.jsx)(c.x6,{i18nKey:"alerting.create-metadata.view-dashboard",children:"View dashboard"})})})}),N.p.grafana.recordingRule(et.rulerRule)){const Gn=et.rulerRule?.grafana_alert.record?.metric??"";Pt.push({label:"Metric name",value:(0,t.jsx)(u.E,{color:"primary",children:Gn})})}return En&&Pt.push({label:"Evaluation interval",value:(0,t.jsxs)(u.E,{color:"primary",children:["Every ",En]})}),xn&&Pt.push({label:"Labels",value:(0,t.jsx)(w.m,{labels:Je,size:"sm"})}),Pt},_t=({name:et,paused:Je=!1,state:rt,health:it,ruleType:Pt,ruleOrigin:It})=>{const Vt=Pt===D.JS.Recording,{returnTo:en}=(0,R.h)("/alerting/list");return(0,t.jsxs)(m.B,{direction:"row",gap:1,minWidth:0,alignItems:"center",children:[(0,t.jsx)(i.z9,{variant:"secondary",icon:"angle-left",href:en}),It&&(0,t.jsx)(T.T,{pluginId:It.pluginId,size:"lg"}),(0,t.jsx)(u.E,{variant:"h1",truncate:!0,children:et}),Je?(0,t.jsx)(Z,{}):(0,t.jsxs)(t.Fragment,{children:[rt&&(0,t.jsx)(J,{state:rt,health:it}),Vt&&(0,t.jsx)(Q,{health:it})]})]})},On=(0,x.Xc)(({ruleIdentifier:et})=>{const[Je,{width:rt}]=(0,s.A)(),{hasRuler:it}=(0,O.w)((0,K.bt)(et)),{result:Pt}=(0,S.FY)(et),{waitForGroupConsistency:It,groupConsistent:Vt}=(0,I.zx)(),[en,ln]=(0,C.Yb)(Qt=>It(Qt));return(0,o.useEffect)(()=>{Pt&&it&&en.execute(Pt.groupIdentifier)},[Pt,it,en]),(0,C.bJ)(ln)?(0,t.jsx)(a.F,{title:(0,c.t)("alerting.prometheus-consistency-check.title-unable-to-check-the-rule-status","Unable to check the rule status"),bottomSpacing:0,topSpacing:2,children:(0,A.JZ)(ln.error)}):Vt===!1?(0,t.jsxs)(m.B,{direction:"column",gap:0,ref:Je,children:[(0,t.jsx)(g.G,{width:rt}),(0,t.jsx)(a.F,{title:(0,c.t)("alerting.rule-viewer.prometheus-consistency-check.alert-title","Update in progress"),severity:"info",children:(0,t.jsx)(c.x6,{i18nKey:"alerting.rule-viewer.prometheus-consistency-check.alert-message",children:"Alert rule has been added or updated. Changes may take up to a minute to appear on the Alert rules list view."})})]}):null},{errorLogger:b.vV}),Nn=et=>et==="error"||et==="err";function Fn(){const[et,Je]=(0,p.s)(),rt=et.tab;return[na(rt)?rt:"query",It=>{Je({tab:It})}]}function na(et){return typeof et=="string"&&Object.values(Nt).includes(et)}function aa(et){const[Je,rt]=Fn(),{annotations:it,promRule:Pt,rulerRule:It}=et,Vt=it[L.YH.summary],en=N.R$.alertingRule(Pt),ln=en?yt(et.instanceTotals):void 0,Qt=(0,F.EL)(et.namespace).name,xn=et.group.name,En=N.p.grafana.rule(It)&&en,zn=N.p.grafana.recordingRule(It),Gn=N.R$.recordingRule(Pt);return{pageNav:{...E.defaultPageNav,text:et.name,subTitle:Vt,children:[{text:"Query and conditions",active:Je==="query",onClick:()=>{rt("query")}},{text:"Instances",active:Je==="instances",onClick:()=>{rt("instances")},tabCounter:ln,hideFromTabs:Gn},{text:"History",active:Je==="history",onClick:()=>{rt("history")},hideFromTabs:!En},{text:"Details",active:Je==="details",onClick:()=>{rt("details")}},{text:"Versions",active:Je==="version-history",onClick:()=>{rt("version-history")},hideFromTabs:!En&&!zn}],parentItem:{text:xn,url:(0,W.tx)([["namespace",Qt],["group",xn]]),parentItem:{text:Qt,url:(0,W.tx)([["namespace",Qt]])}}},activeTab:Je}}const yt=et=>(0,r.chain)(et).pick([d.$7.Alerting,d.$7.Pending,d.$7.Recovering,d.$7.Normal,d.$7.NoData,d.$7.Error]).values().sum().value(
163),mt=()=>({title:(0,n.css)({display:"flex",alignItems:"center",gap:8,minWidth:0}),url:(0,n.css)({wordBreak:"break-all"})});function Ot(et){const Je=et.startsWith("/");let rt=!1;try{new URL(et),rt=!0}catch{return!1}return Je||rt}const Wt=gn},3845:(ee,B,e)=>{"use strict";e.d(B,{f:()=>X,R:()=>q});var t=e(74848),n=e(96540),r=e(43173),o=e(34999),s=e(6975),m=e(50201),a=e(41654),l=e(66404),f=e(45967),h=e(45861),u=e(56840),i=e(74268),x=e(70327),g=e(16692),p=e(52161),c=e(77256),y=e(8207),P=e(2543),d=e(80011),D=e(31286),b=e(30703),E=e(3271),v=e(34753),C=e(1199),S=e(61371);const O=({info:se})=>{const{createdAt:oe,createdBy:ae,version:ie,message:fe=""}=se,pe=(0,d.fq)(oe);return(0,t.jsxs)(u.x6,{i18nKey:"core.versionHistory.comparison.header.text",children:["Version ",{version:ie}," updated by ",{createdBy:ae}," (",{ageString:pe},") ",{message:fe}]})},I=({oldSummary:se,newSummary:oe,oldVersion:ae,newVersion:ie,preprocessVersion:fe=P.identity,showRestoreButton:pe=!1,onRestore:de})=>{const le=(0,S.G4)(fe(ae),fe(ie)),me=Object.entries(le).length===0,[De,Te]=(0,n.use
163State)(me);return(0,t.jsxs)(a.B,{gap:2,direction:"column",children:[(0,t.jsx)(D.a,{children:(0,t.jsxs)(l.E,{variant:"h5",element:"h4",children:[(0,t.jsx)(O,{info:se}),(0,t.jsx)(b.I,{name:"arrow-right"}),(0,t.jsx)(O,{info:oe})]})}),(0,t.jsxs)(D.a,{children:[me&&(0,t.jsx)(m.p,{message:(0,u.t)("core.versionHistory.no-properties-changed","No relevant properties changed"),variant:"not-found",hideImage:!0,children:(0,t.jsx)(u.x6,{i18nKey:"core.versionHistory.view-json-diff",children:"View JSON diff to see all changes"})}),Object.entries(le).map(([Ne,Ce])=>(0,t.jsx)(v.D,{diffs:Ce,title:Ne},Ne)),(0,t.jsx)(E.c,{})]}),(0,t.jsxs)(a.B,{gap:2,direction:"row",justifyContent:"space-between",children:[(0,t.jsxs)(h.$n,{variant:"secondary",onClick:()=>{Te(!De)},children:[De&&(0,t.jsx)(u.x6,{i18nKey:"core.versionHistory.comparison.header.hide-json-diff",children:"Hide JSON diff "}),!De&&(0,t.jsx)(u.x6,{i18nKey:"core.versionHistory.comparison.header.show-json-diff",children:"Show JSON diff "})]}),pe&&(0,t.jsx)(h.$n,{variant:"destructive",onClick:de,icon:"history",children:(0,t.jsxs)(u.x6,{i18nKey:"alerting.alertVersionHistory.restore-version",children:["Restore to version ",{version:se.version}]})})]}),De&&(0,t.jsx)(C.M,{oldValue:JSON.stringify(ae,null,2),newValue:JSON.stringify(ie,null,2)})]})};var R=e(54148),T=e(5556),L=e(71599),K=e(44109),A=e(20437),W=e(23390),N=e(80218),w=e(94646),j=e(29609);function V(){const[se]=(0,W.pU)();return(0,N.Yb)(async(oe,ae)=>{const ie=(0,j.I2)(ae),fe=(0,w.mw)(ie,oe);return se.execute(ie,fe,oe,{dataSourceName:p.hY,namespaceName:oe.grafana_alert.namespace_uid,groupName:oe.grafana_alert.rule_group})})}var U=e(21241);const F=({isOpen:se,baseVersion:oe,versionToRestore:ae,ruleIdentifier:ie,onDismiss:fe,onRestoreSucess:pe,onRestoreError:de})=>{const{result:le}=(0,K.Ll)({ruleIdentifier:ie}),me=(0,R.Zp)(),[De,{error:Te}]=V(),Ne=(0,u.t)("alerting.alertVersionHistory.restore-modal.title","Restore version"),Ce=(0,u.t)("alerting.alertVersionHistory.restore-modal.error","Could not restore alert rule version "),He=Te?"Manually restore rule":(0,u.t)("alerting.alertVersionHistory.restore-modal.confirm","Yes, restore configuration"),ke=oe&&ae?(0,S.G4)((0,U.L0)(oe),(0,U.L0)(ae)):void 0;async function Me(){if(!(!ae||!le))return De.execute(ae,le).then(()=>{fe(),pe()}).catch(tt=>{de(tt)})}async function $e(){if(!ae||!le)return;const tt=(0,A.QX)({...le,rule:ae}),Ke=T.kM.renderUrl(`/alerting/${ie.uid}/edit`,{isManualRestore:!0,defaults:JSON.stringify(tt),returnTo:location.pathname+location.search});me(Ke)}return(0,t.jsx)(L.u,{isOpen:se,title:Ne,confirmText:He,confirmButtonVariant:Te?"primary":"destructive",body:(0,t.jsxs)(a.B,{direction:"column",gap:2,children:[!Te&&(0,t.jsx)(u.x6,{i18nKey:"alerting.alertVersionHistory.restore-modal.body",children:"Are you sure you want to restore the alert rule definition to this version? All unsaved changes will be lost."}),(0,t.jsx)(l.E,{variant:"h6",children:(0,t.jsx)(u.x6,{i18nKey:"alerting.alertVersionHistory.restore-modal.summary",children:"Summary of changes to be applied:"})}),(0,t.jsx)("div",{children:ke&&Object.entries(ke).map(([tt,Ke])=>(0,t.jsx)(v.D,{diffs:Ke,title:tt},tt))}),Te&&(0,t.jsxs)(o.F,{severity:"warning",title:Ce,children:[(0,t.jsx)(u.x6,{i18nKey:"alerting.alertVersionHistory.restore-manually",children:"Your alert rule could not be restored. This may be due to changes to other entities such as contact points, data sources etc. Please manually restore the rule version"}),(0,t.jsx)("pre",{style:{marginBottom:0},children:(0,t.jsx)("code",{children:(0,c.JZ)(Te)})})]})]}),onConfirm:Te?$e:Me,onDismiss:fe})},M=({oldVersion:se,newVersion:oe,ruleIdentifier:ae,isNewLatest:ie,setShowDrawer:fe,onRestoreSuccess:pe,onRestoreError:de,canRestore:le})=>{const[me,De]=(0,n.useState)(!1),Te=(0,n.useCallback)(()=>fe(!1),[fe]),Ne=(0,U.Lw)(se),Ce=(0,U.Lw)(oe);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y._,{onClose:()=>fe(!1),title:(0,u.t)("alerting.alertVersionHistory.comparing-versions","Comparing versions"),children:(0,t.jsx)(I,{oldSummary:Ne,oldVersion:se,newSummary:Ce,newVersion:oe,preprocessVersion:U.L0,showRestoreButton:ie&&le,onRestore:()=>De(!0)})}),me&&(0,t.jsx)(F,{ruleIdentifier:ae,baseVersion:oe,versionToRestore:se,isOpen:me,onDismiss:Te,onRestoreSucess:pe,onRestoreError:de})]})};var H=e(32635),_=e(99887),Z=e(27594),ne=e(85835),te=e(49914);const Y=20;function Q({onVersionsChecked:se,onCompareSingleVersion:oe,ruleVersions:ae,disableSelection:ie,checkedVersions:fe,onRestoreSuccess:pe,onRestoreError:de,canRestore:le}
163){const[me,De]=(0,n.useState)(!1),[Te,Ne]=(0,n.useState)(),Ce=Te?.grafana_alert?.uid??"",He=(0,n.useMemo)(()=>({ruleSourceName:p.hY,uid:Ce}),[Ce]),ke=Ke=>{De(!0),Ne(Ke)},Me=()=>{De(!1)},$e=(0,u.t)("alerting.alertVersionHistory.unknown","Unknown"),tt=[{disableGrow:!0,id:"id",header:(0,u.t)("core.versionHistory.table.version","Version"),cell:({row:Ke})=>{const Re=String(Ke.original.grafana_alert.version),Ve=fe.has(String(Re??!1))??!1;return(0,t.jsx)(a.B,{direction:"row",children:(0,t.jsx)(H.S,{label:Re,checked:Ve,disabled:ie&&!Ve,onChange:()=>{se(Re)}})})}},{id:"createdBy",header:(0,u.t)("core.versionHistory.table.updatedBy","Updated By"),disableGrow:!0,cell:({row:Ke})=>(0,t.jsx)(te.m,{user:Ke.original.grafana_alert.updated_by})},{id:"created",header:(0,u.t)("core.versionHistory.table.updated","Date"),disableGrow:!0,cell:({row:Ke})=>{const Re=Ke.original.grafana_alert.updated;return Re?(0,d.LE)(Re)+" ("+(0,d.fq)(Re)+")":$e}},{id:"diff",disableGrow:!0,cell:({rows:Ke,row:Re})=>{const Qe=Re.index===ae.length-1?{}:Ke[Re.index+1]?.original,je=Re.original,ze=(0,ne.h)(Qe,je),Ye=`+${ze.added}`,Ge=`-${ze.removed}`;return(0,t.jsxs)(a.B,{alignItems:"baseline",gap:.5,children:[(0,t.jsx)(l.E,{color:"success",variant:"bodySmall",children:Ye}),(0,t.jsx)(l.E,{color:"error",variant:"bodySmall",children:Ge})]})}},{id:"actions",disableGrow:!0,cell:({row:Ke})=>{const Re=Ke.index===0,Ve=(0,u.t)("alerting.alertVersionHistory.compare-with-latest","Compare with latest version");return(0,t.jsx)(a.B,{direction:"row",alignItems:"center",justifyContent:"flex-end",children:Re?(0,t.jsx)(_.E,{text:(0,u.t)("alerting.alertVersionHistory.latest","Latest"),color:"blue"}):le?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.$n,{variant:"secondary",size:"sm",icon:"code-branch",onClick:()=>{oe(Ke.original)},tooltip:Ve,children:(0,t.jsx)(u.x6,{i18nKey:"alerting.alertVersionHistory.compare",children:"Compare"})}),(0,t.jsx)(h.$n,{variant:"secondary",size:"sm",icon:"history",onClick:()=>{Ke.original.grafana_alert.version&&ke(Ke.original)},children:(0,t.jsx)(u.x6,{i18nKey:"alerting.alertVersionHistory.restore",children:"Restore"})})]}):null})}}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Z.j,{pageSize:Y,columns:tt,data:ae,getRowId:Ke=>`${Ke.grafana_alert.version}`}),(0,t.jsx)(F,{ruleIdentifier:He,baseVersion:ae[0],versionToRestore:Te,isOpen:me,onDismiss:Me,onRestoreSucess:pe,onRestoreError:de})]})}const{useGetAlertVersionHistoryQuery:J}=x.hK,q=["id","uid","updated","updated_by","version"];function X({rule:se}){const oe=se.grafana_alert.uid,{isLoading:ae,currentData:ie=[],error:fe}=J({uid:oe}),pe=(0,n.useMemo)(()=>({ruleSourceName:p.hY,uid:oe}
163),[oe]),[de,le]=(0,n.useState)(),[me,De]=(0,n.useState)(),[Te,Ne]=(0,n.useState)(!1),[Ce,He]=(0,n.useState)(new Set),ke=(0,n.useMemo)(()=>Ce.size>1,[Ce]),Me={namespace:{uid:se.grafana_alert.namespace_uid},groupName:se.grafana_alert.rule_group,groupOrigin:"grafana"},[$e,tt]=(0,g.mW)(se,Me,g.j5.Restore),Ke=tt&&$e&&!!r.$.featureToggles.alertingRuleVersionHistoryRestore,Re=(0,n.useCallback)(Ge=>{(0,i.cg)({origin:Ge,latest:me===ie[0],oldVersion:de?.grafana_alert.version||0,newVersion:me?.grafana_alert.version||0})},[de,me,ie]),Ve=(0,n.useCallback)((Ge,ce)=>{(0,i.XW)({origin:Ge,latest:me===ie[0],oldVersion:de?.grafana_alert.version||0,newVersion:me?.grafana_alert.version||0,error:ce})},[de,me,ie]);if(fe)return(0,t.jsx)(o.F,{title:(0,u.t)("alerting.alertVersionHistory.errorloading","Failed to load alert rule versions"),children:(0,c.JZ)(fe)});if(ae)return(0,t.jsx)(s._,{text:(0,u.t)("alerting.common.loading","Loading...")});if(!ie.length)return(0,i.fH)(i.le.noAlertRuleVersionsFound,{ruleUid:oe}),(0,t.jsx)(m.p,{variant:"not-found",message:(0,u.t)("alerting.alertVersionHistory.noVersionsFound","No versions found for this rule")});const Qe=()=>{const[Ge,ce]=ie.filter(Pe=>{const Se=Pe.grafana_alert.version;if(!(!Se&&Se!==0))return Ce.has(String(Pe.grafana_alert.version))}).sort((Pe,Se)=>{const Ee=Pe.grafana_alert.version,xe=Se.grafana_alert.version;return Ee===void 0||xe===void 0?0:Ee-xe});(0,i.Rh)({latest:ce===ie[0],oldVersion:Ge?.grafana_alert.version||0,newVersion:ce?.grafana_alert.version||0}),je(Ge,ce)},je=(Ge,ce)=>{le(Ge),De(ce),Ne(!0)};function ze(Ge){He(ce=>{const Pe=new Set(ce);return Pe.has(Ge)?Pe.delete(Ge):Pe.add(Ge),Pe}),le(void 0),De(void 0)}const Ye=ie[0].grafana_alert.version===me?.grafana_alert.version;return(0,t.jsxs)(a.B,{direction:"column",gap:2,children:[(0,t.jsx)(l.E,{variant:"body",children:(0,t.jsx)(u.x6,{i18nKey:"alerting.alertVersionHistory.description",children:"Each time you edit the alert rule, a new version is created. Select two versions below and compare their differences."})}),(0,t.jsx)(a.B,{children:(0,t.jsx)(f.m,{content:(0,u.t)("core.versionHistory.comparison.select","Select two versions to start comparing"),placement:"bottom",children:(0,t.jsx)(h.$n,{type:"button",disabled:!ke,onClick:Qe,icon:"code-branch",children:(0,t.jsx)(u.x6,{i18nKey:"alerting.alertVersionHistory.compareVersions",children:"Compare versions"})})})}),Te&&de&&me&&(0,t.jsx)(M,{oldVersion:de,newVersion:me,ruleIdentifier:pe,isNewLatest:Ye,setShowDrawer:Ne,onRestoreSuccess:()=>Re("comparison-drawer"),onRestoreError:Ge=>Ve("comparison-drawer",Ge),canRestore:Ke}),(0,t.jsx)(Q,{onCompareSingleVersion:Ge=>je(Ge,ie[0]),onVersionsChecked:ze,ruleVersions:ie,disableSelection:ke,checkedVersions:Ce,onRestoreSuccess:()=>Re("version-list"),onRestoreError:Ge=>Ve("version-list",Ge),canRestore:Ke})]})}},45746:(ee,B,e)=>{"use strict";e.d(B,{$:()=>R,B:()=>I});var t=e(74848),n=e(22803),r=e(74226),o=e(2543),s=e(80011),m=e(43173),a=e(41654),l=e(66404),f=e(63142),h=e(30703),u=e(20941),i=e(89640),x=e(56840),g=e(42227),p=e(11504),c=e(29609),y=e(15629),P=e(9368),d=e(31286),D=e(45967),b=e(47931),E=e(10427);const v=({id:L,label:K,value:A,monospace:W,showCopyButton:N,copyValue:w,tooltipValue:j})=>{const V=(0,x.t)("alerting.copy-to-clipboard",'Copy "{{label}}" to clipboard',{label:K});return(0,t.jsx)(d.a,{children:(0,t.jsxs)(a.B,{direction:"column",gap:0,children:[(0,t.jsx)(l.E,{color:"secondary",id:L,children:K}),(0,t.jsxs)(l.E,{"aria-labelledby":L,color:"primary",variant:W?"code":"body",children:[(0,t.jsx)(E.A,{shouldWrap:!!j,wrap:U=>(0,t.jsx)(D.m,{content:j,children:U}),children:(0,t.jsx)("span",{children:A})}),N&&(0,t.jsx)(b.b,{"aria-label":V,fill:"text",variant:"secondary",icon:"copy",size:"sm",getText:()=>w})]})]})})};var C=e(49914),S=(L=>(L.GrafanaManagedAlertRule="Grafana-managed alert rule",L.GrafanaManagedRecordingRule="Grafana-managed recording rule",L.CloudAlertRule="Cloud alert rule",L.CloudRecordingRule="Cloud recording rule",L.Unknown="Unknown",L))(S||{});const O=({title:L,children:K})=>(0,t.jsxs)(a.B,{direction:"column",gap:1,children:[(0,t.jsx)(l.E,{variant:"h4",children:L}),(0,t.jsx)(a.B,{direction:"column",gap:2,children:K})]}),I=({rule:L})=>{const K=(0,f.of)(T),A=(0,p.G)(L),W=c.p.grafana.alertingRule(L.rulerRule)?L.rulerRule.keep_firing_for:void 0;let N="Unknown";c.p.grafana.alertingRule(L.rulerRule)?N="Grafana-managed alert rule":c.p.grafana.recordingRule(L.rulerRule)?N="Grafana-managed recording rule":c.p.dataSource.alertingRule(L.rulerRule)?N="Cloud alert rule":c.p.dataSource.recordingRule(L.rulerRule)&&(N="Cloud recording rule");const w=c.p.grafana.recordingRule(L.rulerRule)?L.rulerRule.grafana_alert.record?.target_datasource_uid:null,j=(0,g.ps)(w),V=m.$.featureToggles.grafanaManagedRecordingRulesDatasources&&w&&w!=="grafana",U=L.promRule?.evaluationTime,F=L.promRule?.lastEvaluation,M=c.R$.alertingRule(L.promRule)?(0,c.Rh)(L.promRule):void 0,H=Number.isFinite(U),_=c.p.grafana.rule(L.rulerRule)?L.rulerRule.grafana_alert.updated:void 0,Z=c.p.grafana.rule(L.rulerRule)&&(0,c.hC)(L.rulerRule),ne=c.p.grafana.rule(L.rulerRule)&&!(0,o.isUndefined)(L.rulerRule.grafana_alert.missing_series_evals_to_resolve)?String(L.rulerRule.grafana_alert.missing_series_evals_to_resolve):void 0,te=(0,t.jsxs)(a.B,{children:[(0,t.jsx)(l.E,{color:"warning",children:(0,t.jsx)(h.I,{name:"pause-circle"})}),(0,t.jsx)(l.E,{children:(0,t.jsx)(x.x6,{i18nKey:"alerting.alert.evaluation-paused",children:"Alert evaluation currently paused"})})]});return(0,t.jsxs)("div",{className:K.metadata,children:[(0,t.jsxs)(O,{title:(0,x.t)("alerting.alert.rule","Rule"),children:[(0,t.jsx)(v,{id:"rule-type",label:(0,x.t)("alerting.alert.rule-type","Rule type"),value:N}),c.p.grafana.rule(L.rulerRule)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v,{id:"rule-type",label:(0,x.t)("alerting.alert.rule-identifier","Rule identifier"),value:L.rulerRule.grafana_alert.uid,monospace:!0,showCopyButton:!0,copyValue:L.rulerRule.grafana_alert.uid}),(0,t.jsx)(v,{id:"last-updated-by",label:(0,x.t)("alerting.alert.last-updated-by","Last updated by"),value:(0,t.jsx)(C.m,{user:L.rulerRule.grafana_alert.updated_by})}),_&&(0,t.jsx)(v,{id:"date-of-last-update",label:(0,x.t)("alerting.alert.last-updated-at","Last updated at"),value:(0,s.LE)(_)+` (${(0,s.fq)(_)})`})]}),V&&(0,t.jsx)(v,{id:"target-datasource-uid",label:(0,x.t)("alerting.alert.target-datasource-uid","Target data source"),value:(0,t.jsx)(u.N,{href:`/connections/datasources/edit/${j?.uid}`,children:(0,t.jsxs)(a.B,{direction:"row",gap:1,children:[(0,t.jsx)("img",{style:{width:"16px"},src:j?.meta.info.logos.small,alt:"datasource logo"}),j?.name]})})})]}),(0,t.jsxs)(O,{title:(0,x.t)("alerting.alert.evaluation","Evaluation"),children:[Z?te:(0,t.jsxs)(t.Fragment,{children:[H&&F&&(0,t.jsx)(v,{id:"last-evaluated",label:(0,x.t)("alerting.alert.last-evaluated","Last evaluated"),value:(0,y.mo)(F)?"-":(0,r.B)(new Date(F),{addSuffix:!0}),tooltipValue:(0,y.mo)(F)?void 0:(0,s.LE)(F)}),H&&(0,t.jsx)(v,{id:"last-evaluation-duration",label:(0,x.t)("alerting.alert.last-evaluation-duration","Last evaluation duration"),value:`${U} ms`}),ne&&(0,t.jsx)(v,{id:"missing-series-resolve",label:(0,x.t)("alerting.alert.missing-series-resolve","Missing series evaluations to resolve"),value:ne,tooltipValue:(0,x.t)("alerting.alert.description-missing-series-evaluations","How many consecutive evaluation intervals with no data for a dimension must pass before the alert state is considered stale and automatically resolved. If no value is provided, the value will default to 2.")})]}),A&&(0,t.jsx)(v,{id:"pending-period",label:(0,x.t)("alerting.alert.pending-period","Pending period"),value:A}),W&&(0,t.jsx)(v,{id:"keep-firing-for",label:(0,x.t)("alerting.alert.keep-firing-for","Keep firing for"),value:W})]}),c.p.grafana.rule(L.rulerRule)&&L.rulerRule.grafana_alert.no_data_state&&L.rulerRule.grafana_alert.exec_err_state&&(0,t.jsxs)(O,{title:(0,x.t)("alerting.alert.alert-state","Alert state"),children:[H&&(0,t.jsx)(v,{id:"alert-state-no-data",label:(0,x.t)("alerting.alert.state-no-data","Alert state if no data or all values are null"),value:L.rulerRule.grafana_alert.no_data_state}),A&&(0,t.jsx)(v,{id:"alert-state-exec-err",label:(0,x.t)("alerting.alert.state-error-timeout","Alert state if execution error or timeout"),value:L.rulerRule.grafana_alert.exec_err_state})]}),M&&(0,t.jsx)(O,{title:(0,x.t)("alerting.alert.annotations","Annotations"),children:Object.keys(M).length===0?(0,t.jsx)("div",{children:(0,t.jsx)(l.E,{color:"secondary",italic:!0,children:(0,t.jsx)(x.x6,{i18nKey:"alerting.alert.no-annotations",children:"No annotations"})})}):Object.entries(M).map(([Y,Q])=>{const J=`annotation-${Y.replace(/\s/g,"-")}`;return(0,t.jsx)(v,{id:J,label:Y,value:(0,t.jsx)(R,{value:Q})},Y)})})]})};function R({value:L}){const K=L&&L.startsWith("http"),A=(0,t.jsx)(P.Y,{input:L,delimiter:["{{","}}"]});return K?(0,t.jsx)(i.Y,{href:L,external:!0,children:L}):(0,t.jsx)(l.E,{color:"primary",children:A})}const T=L=>({metadata:(0,n.css)({display:"grid",gap:L.spacing(4),gridTemplateColumns:"1fr 1fr 1fr",[L.breakpoints.down("lg")]:{gridTemplateColumns:"1fr 1fr"},[L.breakpoints.down("sm")]:{gridTemplateColumns:"1fr"}})})},49914:(ee,B,e)=>{"use strict";e.d(B,{m:()=>f});var t=e(74848),n=e(22803),r=e(63142),o=e(45967),s=e(30703),m=e(99887),a=e(56840),l=e(21241);const f=({user:u})=>{const i=(0,a.t)("alerting.alertVersionHistory.unknown","Unknown"),x=(0,l.J8)(),g=(0,r.of)(h),p=(0,t.jsx)(o.m,{content:(0,a.t)("alerting.alertVersionHistory.unknown-change-description","This update was made prior to the implementation of alert rule version history. The user who made the change is not tracked, but future changes will include the user"),children:(0,t.jsxs)("span",{children:[(0,t.jsxs)("span",{className:g.underline,children:[i," "]}),(0,t.jsx)(s.I,{name:"question-circle"})]})});if(!u)return p;const c=x[u.uid];return c||!u?(0,t.jsx)(o.m,{content:c.tooltipContent,children:(0,t.jsx)("span",{children:(0,t.jsx)(m.E,{className:g.badge,text:c.name,color:c.badgeColor,icon:c.icon})})}):u.name?u.name:u.uid?(0,a.t)("alerting.alertVersionHistory.user-id","User ID {{uid}}",{uid:u.uid}):p},h=()=>({badge:(0,n.css)({cursor:"help"}),underline:(0,n.css)({textDecoration:"underline dotted",textUnderlineOffset:"5px",cursor:"help"})})},21241:(ee,B,e)=>{"use strict";e.d(B,{J8:()=>r,L0:()=>o,Lw:()=>s});var t=e(56840),n=e(3845);const r=()=>{const m={name:(0,t.t)("alerting.alertVersionHistory.provisioning","Provisioning"),tooltipContent:(0,t.t)("alerting.alertVersionHistory.provisioning-change-description","Version update was made via provisioning"),badgeColor:"purple"};return{__alerting__:{name:(0,t.t)("alerting.alertVersionHistory.alerting","Alerting"),tooltipContent:(0,t.t)("alerting.alertVersionHistory.alerting-change-description","This update was made by the alert
163ing system due to other changes. For example, when renaming a contact point that is used for simplified routing, this will update affected rules"),badgeColor:"orange",icon:"bell"},service:m,__provisioning__:m}};function o(m){const{grafana_alert:a,...l}=m,f={for:(0,t.t)("alerting.alertVersionHistory.pendingPeriod","Pending period"),annotations:(0,t.t)("alerting.alertVersionHistory.annotations","Annotations"),labels:(0,t.t)("alerting.alertVersionHistory.labels","Labels")},h={title:(0,t.t)("alerting.alertVersionHistory.name","Name"),namespace_uid:(0,t.t)("alerting.alertVersionHistory.namespace_uid","Folder UID"),data:(0,t.t)("alerting.alertVersionHistory.queryAndAlertCondition","Query and alert condition"),notification_settings:(0,t.t)("alerting.alertVersionHistory.contactPointRouting","Contact point routing"),no_data_state:(0,t.t)("alerting.alertVersionHistory.noDataState","Alert state when no data"),exec_err_state:(0,t.t)("alerting.alertVersionHistory.execErrorState","Alert state when execution error"),is_paused:(0,t.t)("alerting.alertVersionHistory.paused","Paused state"),rule_group:(0,t.t)("alerting.alertVersionHistory.rule_group","Rule group"),condition:(0,t.t)("alerting.alertVersionHistory.condition","Alert condition"),intervalSeconds:(0,t.t)("alerting.alertVersionHistory.intervalSeconds","Evaluation interval")},u=Object.entries(l).reduce((x,[g,p])=>{const y=f[g]||g;return{...x,[y]:p}},{}),i=Object.entries(a).reduce((x,[g,p])=>{const c=g;if(n.R.includes(c))return x;const y=h[c]||g;return{...x,[y]:p}},{});return{...u,...i}}function s(m){const a=(0,t.t)("alerting.alertVersionHistory.unknown","Unknown"),l=r(),f=(()=>{const h=m?.grafana_alert.updated_by,u=h?.uid,i=h?.name;return h?u&&l[u]?l[u].name:i||(u?(0,t.t)("alerting.alertVersionHistory.user-id","User ID {{uid}}",{uid:u}):a):a})();return{createdAt:m.grafana_alert.updated||a,createdBy:f,version:m.grafana_alert.version||a}}},75983:(ee,B,e)=>{"use strict";e.d(B,{D:()=>b});var t=e(74848),n=e(96540),r=e(71642),o=e(25229),s=e(54092),m=e(29609),a=e(7840),l=e(6106),f=e(46907),h=e(88559),u=e(76319),i=e(56840),x=e(20806),g=e(9860);const p=({rule:v,instance:C,extensionPointId:S})=>{const[O,I]=(0,n.useState)(),R=(0,n.useMemo)(()=>({instance:C,rule:v}),[C,v]),{links:T}=(0,f.U)({context:R,extensionPointId:S,limitPerPlugin:3});if(T.length===0)return null;const L=(0,t.jsx)(g.w,{extensions:T,onSelect:I});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.m,{placement:"bottom-start",overlay:L,children:(0,t.jsx)(u.K,{name:"ellipsis-v","aria-label":(0,i.t)("alerting.alert-instance-extension-point.aria-label-actions","Actions"),variant:"secondary"})}),!!O&&!!O.path&&(0,t.jsx)(x.s,{path:O.path,title:O.title,onDismiss:()=>I(void 0)})]})};var c=e(75640),y=e(83750),P=e(40165);const d=({instance:v})=>{const C=(0,c.Hx)(v.annotations),S=(0,c.gO)(C);return(0,t.jsxs)("div",{children:[v.value&&(0,t.jsx)(P.X,{label:(0,i.t)("alerting.alert-instance-details.label-value","Value"),horizontal:!0,children:v.value}),C.map(([O,I])=>(0,t.jsx)(y.s,{annotationKey:O,value:I,valueLink:S.get(O)},O))]})};var D=e(65420);const b=({rule:v,instances:C,pagination:S,footerRow:O})=>{const I=(0,n.useMemo)(()=>C.length>1?(0,r.yO)(C.map(T=>T.labels)):{},[C]),R=(0,n.useMemo)(()=>C.map(T=>({data:{rule:v,alert:{...T,commonLabels:I}},id:(0,m.RI)(T)})),[I,C,v]);return(0,t.jsx)(l.E,{cols:E,isExpandable:!0,items:R,renderExpandedContent:({data:T})=>(0,t.jsx)(d,{instance:T.alert}),pagination:S,footerRow:O})},E=[{id:"state",label:"State",renderCell:({data:{alert:{state:v}}})=>(0,t.jsx)(D.C,{state:v}),size:"95px"},{id:"labels",label:"Labels",renderCell:({data:{alert:{labels:v,commonLabels:C}}})=>(0,t.jsx)(a.m,{labels:v,commonLabels:C,size:"sm"})},{id:"created",label:"Created",renderCell:({data:{alert:{activeAt:v}}})=>(0,t.jsx)(t.Fragment,{children:v.startsWith("0001")?"-":(0,o.KQ)(v).format("YYYY-MM-DD HH:mm:ss")}),size:"150px"},{id:"actions",label:"",renderCell:({data:{alert:v,rule:C}})=>(0,t.jsx)(p,{rule:C,instance:v,extensionPointId:s.S.AlertInstanceAction},"alert-instance-extension-point"),size:"40px"}]},65420:(ee,B,e)=>{"use strict";e.d(B,{C:()=>a});var t=e(74848),n=e(96540),r=e(45967),o=e(30703),s=e(29609),m=e(67834);const a=(0,n.memo)(({state:l,isPaused:f=!1,size:h="md",muted:u=!1})=>f?(0,t.jsx)(r.m,{content:"Alert evaluation is currently paused",placement:"top",children:(0,t.jsxs)(m.O,{state:"warning",size:h,muted:u,children:[(0,t.jsx)(o.I,{name:"pause",size:"xs"})," Paused"]})}):(0,t.jsx)(m.O,{state:(0,s.Wy)(l),size:h,muted:u,children:(0,s.XI)(l)}));a.displayName="AlertStateTag"},14050:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>l});var t=e(74848),n=e(96540),r=e(54148),o=e(71599),s=e(45861),m=e(56840),a=e(94646);
163function l({identifier:h,isProvisioned:u,redirectTo:i=!1,onDismiss:x}){const g=(0,r.zy)(),[p,c]=(0,n.useState)(u?"confirm":"redirect");if(p==="redirect"){const y=a.$9(h),P=g.pathname+g.search,d=new URLSearchParams({copyFrom:y,returnTo:i?P:""});return(0,t.jsx)(r.C5,{to:"/alerting/new?"+d.toString(),replace:!1})}return(0,t.jsx)(o.u,{isOpen:p==="confirm",title:(0,m.t)("alerting.redirect-to-clone-rule.title-copy-provisioned-alert-rule","Copy provisioned alert rule"),body:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:["The new rule will ",(0,t.jsx)("strong",{children:"not"})," be marked as a provisioned rule."]}),(0,t.jsx)("p",{children:"You will need to set a new evaluation group for the copied rule because the original one has been provisioned and cannot be used for rules created in the UI."})]}),confirmText:"Copy",onConfirm:()=>c("redirect"),onDismiss:x})}const f=(0,n.forwardRef)(({text:h,ruleIdentifier:u,isProvisioned:i,className:x},g)=>{const[p,c]=(0,n.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.$n,{title:(0,m.t)("alerting.clone-rule-button.title-copy","Copy"),className:x,size:"sm",variant:"secondary",icon:"copy",onClick:()=>c(!0),ref:g,children:h},"clone"),p&&(0,t.jsx)(l,{identifier:u,isProvisioned:i,onDismiss:()=>c(!1)})]})});f.displayName="CloneRuleButton"},3969:(ee,B,e)=>{"use strict";e.d(B,{l:()=>E});var t=e(74848),n=e(96540),r=e(45861),o=e(41654),s=e(56840),m=e(94380),a=e(53567),l=e(90186),f=e(2218),h=e(96784),u=e(96673),i=e(16692),x=e(11018),g=e(52161),p=e(67598),c=e(77256),y=e(94646),P=e(29609),d=e(92367),D=e(14050);const b=v=>window.matchMedia(`(max-width: ${v}px)`).matches,E=({compact:v,showViewButton:C,rule:S,rulesSource:O})=>{const I=(0,u.useDispatch)(),R=!v,[T,L]=(0,a.w)(R),[K,A]=(0,n.use
163State)(!1),[W,N]=(0,n.useState)(void 0),{namespace:w,group:j,rulerRule:V}=S,{hasActiveFilters:U}=(0,h.dI)(),F=P.p.grafana.rule(S.rulerRule)&&!!S.rulerRule.grafana_alert.provenance,[M,H]=(0,i.mh)(S,i.j5.Update),_=M&&H,Z=[],ne=v?"sm":"md",te=(0,g.EV)(O),Y=y.UP(te,S),Q=p.HA.fromCombinedRule(S);if(C&&Z.push((0,t.jsx)(r.z9,{title:(0,s.t)("alerting.rule-actions-buttons.title-view","View"),size:ne,variant:"secondary",icon:"eye",href:(0,c.w$)(O,S),children:(0,t.jsx)(s.x6,{i18nKey:"common.view",children:"View"})},"view")),V&&_){const J=y.P1(te,w.name,j.name,V),q=(0,d.G)(`/alerting/${encodeURIComponent(y.$9(J))}/edit`);Z.push((0,t.jsx)(r.z9,{title:(0,s.t)("alerting.rule-actions-buttons.title-edit","Edit"),size:ne,variant:"secondary",icon:"pen",href:q,children:(0,t.jsx)(s.x6,{i18nKey:"common.edit",children:"Edit"})},"edit"))}return!S.promRule&&!S.rulerRule?null:(0,t.jsxs)(o.B,{gap:1,alignItems:"center",wrap:"nowrap",children:[Z,(0,t.jsx)(m.A,{rulerRule:S.rulerRule,promRule:S.promRule,identifier:Y,groupIdentifier:Q,handleDelete:()=>{if(S.rulerRule){const J=y.co(Q,S.rulerRule);L(J,Q)}},handleSilence:()=>A(!0),handleDuplicateRule:()=>N({identifier:Y,isProvisioned:F}),onPauseChange:()=>{const J=U?void 0:l.Ys+1;I((0,x.Lc)({rulesSourceName:g.hY,limitAlerts:J}))},buttonSize:ne}),T,P.p.grafana.alertingRule(S.rulerRule)&&K&&(0,t.jsx)(f.A,{rulerRule:S.rulerRule,onClose:()=>A(!1)}),W?.identifier&&(0,t.jsx)(D.Z,{identifier:W.identifier,isProvisioned:W.isProvisioned,onDismiss:()=>N(void 0)})]})}},90186:(ee,B,e)=>{"use strict";e.d(B,{Ys:()=>Q,DI:()=>J});var t=e(74848),n=e(22803),r=e(80011),o=e(25229),s=e(63142),m=e(45967),a=e(56840),l=e(55555),f=e(11504),h=e(75640),u=e(29609),i=e(15629),x=e(7840),g=e(40165),p=e(83750);function c(se){const oe=(0,s.of)(y),{annotations:ae}=se,ie=(0,h.gO)(ae);return ae.length===0?null:(0,t.jsx)("div",{className:oe.annotations,children:ae.map(([fe,pe])=>(0,t.jsx)(p.s,{annotationKey:fe,value:pe,valueLink:ie.get(fe)},fe))})}const y=()=>({annotations:(0,n.css)({marginTop:"46px"})});var P=e(96540),d=e(63704),D=e(41071),b=e(45861),E=e(41654),v=e(16692),C=e(58138),S=e(95443),O=e(52161),I=e(77256);const T=({rule:se,rulesSource:oe})=>{const{group:ae}=se,{StateHistoryModal:ie,showStateHistoryModal:fe}=(0,C.G)(),pe=(0,D.i)(),[de,le]=(0,v.mh)(se,v.j5.Explore),me=[],De=(0,u.YN)(ae);if((0,O.Eb)(oe)&&de&&le&&!De&&me.push((0,t.jsx)(b.z9,{size:"sm",variant:"primary",icon:"chart-line",target:"_blank",href:(0,I.Yp)(oe,se.query),children:(0,t.jsx)(a.x6,{i18nKey:"alerting.rule-details-buttons.see-graph",children:"See graph"})},"explore")),se.annotations[S.YH.runbookURL]&&me.push((0,t.jsx)(b.z9,{size:"sm",variant:"primary",icon:"book",target:"_blank",href:d.sQ.sanitizeUrl(se.annotations[S.YH.runbookURL]),children:(0,t.jsx)(a.x6,{i18nKey:"alerting.rule-details-buttons.view-runbook",children:"View runbook"})},"runbook")),se.annotations[S.YH.dashboardUID]){const Te=se.annotations[S.YH.dashboardUID];if(Te){me.push((0,t.jsx)(b.z9,{size:"sm",variant:"primary",icon:"apps",href:`d/${encodeURIComponent(Te)}`,onClick:()=>{pe(se.name)},children:(0,t.jsx)(a.x6,{i18nKey:"alerting.rule-details-buttons.go-to-dashboard",children:"Go to dashboard"})},"dashboard"));const Ne=se.annotations[S.YH.panelID];Ne&&me.push((0,t.jsx)(b.z9,{size:"sm",variant:"primary",icon:"apps",href:`d/${encodeURIComponent(Te)}?viewPanel=${encodeURIComponent(Ne)}`,onClick:()=>{pe(se.name)},children:(0,t.jsx)(a.x6,{i18nKey:"alerting.rule-details-buttons.go-to-panel",children:"Go to panel"})},"panel"))}}return u.p.grafana.alertingRule(se.rulerRule)&&me.push((0,t.jsxs)(P.Fragment,{children:[(0,t.jsx)(b.$n,{size:"sm",icon:"history",onClick:()=>u.p.grafana.rule(se.rulerRule)&&fe(se.rulerRule),children:(0,t.jsx)(a.x6,{i18nKey:"alerting.rule-details-buttons.show-state-history",children:"Show state history"})}),ie]},"history")),me.length?(0,t.jsx)(E.B,{children:me}):null};var L=e(78282),K=e(4651);function A(se){const{rulesSource:oe,rule:ae}=se,ie=(0,s.of)(W),fe=(0,P.useMemo)(()=>{if((0,O.Eb)(oe))return[{name:oe.name,icon:oe.meta.info.logos.small}];if(u.p.grafana.rule(ae.rulerRule)){const{data:pe}=ae.rulerRule.grafana_alert,de=pe.reduce((le,me)=>{const De=(0,L.l)().getInstanceSettings(me.datasourceUid);return!De||De.uid===K.Uj||(le[De.name]={name:De.name,icon:De.meta.info.logos.small}),le},{});return Object.values(de)}return[]},[ae,oe]);return fe.length===0?null:(0,t.jsx)(g.X,{label:(0,a.t)("alerting.rule-details-data-sources.label-data-source","Data source"),children:fe.map(({name:pe,icon:de},le)=>(0,t.jsxs)("div",{children:[de&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("img",{alt:`${pe} datasource logo`,className:ie.dataSourceIcon,src:de})," "]}),pe]},pe))})}function W(se){const oe=se.spacing(2);return{dataSourceIcon:(0,n.css)({width:oe,height:oe})}}var N=e(28848),w=e(29317),j=e(35748),V=e(56103),U=e(35458),F=e(77236),M=e(16591);const H=({language:se,expr:oe})=>{const ae=(0,P.useMemo)(()=>[(0,V.D)({onlyIn:fe=>"type"in fe&&fe.type==="code_block",getSyntax:()=>se},{...N.languages,[se]:se==="logql"?F.Ay:j.n6})],[se]),ie=(0,P.useMemo)(()=>(0,U.mO)(oe),[oe]);return(0,t.jsx)(w.Editor,{"data-testid":"expression-editor",plugins:ae,value:ie})},_=({expression:se,rulesSource:oe})=>{const ae=(0,s.of)(Z);return(0,t.jsx)(M.L,{className:(0,n.cx)(ae.well,"slate-query-field"),children:(0,O.Eb)(oe)?(0,t.jsx)(H,{expr:se,language:oe.type===O.ol.L
163oki?"logql":"promql"}):se})},Z=se=>({well:(0,n.css)({fontFamily:se.typography.fontFamilyMonospace})});function ne(se){const{annotations:oe,rulesSource:ae,rule:ie}=se,fe=te();return(0,O.Eb)(ae)?(0,t.jsx)(g.X,{label:(0,a.t)("alerting.rule-details-expression.label-expression","Expression"),horizontal:!0,className:(0,n.cx)({[fe.exprRow]:!!oe.length}),children:(0,t.jsx)(_,{expression:ie.query,rulesSource:ae})}):null}const te=()=>({exprRow:(0,n.css)({marginBottom:"46px"})});var Y=e(66773);const Q=15,J=({rule:se})=>{const oe=(0,s.of)(X),{namespace:{rulesSource:ae}}=se,ie=(0,h.Hx)(se.annotations),fe=u.p.any.alertingRule(se.rulerRule)||u.R$.alertingRule(se.promRule);return(0,t.jsxs)("div",{children:[(0,t.jsx)(T,{rule:se,rulesSource:ae}),(0,t.jsxs)("div",{className:oe.wrapper,children:[(0,t.jsxs)("div",{className:oe.leftSide,children:[(0,t.jsx)(q,{rule:se}),!!se.labels&&!!Object.keys(se.labels).length&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.rule-details.label-labels","Labels"),horizontal:!0,children:(0,t.jsx)(x.m,{labels:se.labels})}),(0,t.jsx)(ne,{rulesSource:ae,rule:se,annotations:ie}),(0,t.jsx)(c,{annotations:ie})]}),(0,t.jsx)("div",{className:oe.rightSide,children:(0,t.jsx)(A,{rulesSource:ae,rule:se})})]}),fe&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.rule-details.label-instances","Instances"),horizontal:!0,children:(0,t.jsx)(Y.s,{rule:se,itemsDisplayLimit:Q})})]})},q=({rule:se})=>{const oe=se.group.interval,ae=se.promRule?.lastEvaluation,ie=se.promRule?.evaluationTime,fe=u.p.grafana.recordingRule(se.rulerRule)?se.rulerRule?.grafana_alert.record?.metric:void 0,pe=(0,f.G)(se),de=u.p.grafana.alertingRule(se.rulerRule)?se.rulerRule.keep_firing_for:void 0;return(0,t.jsxs)(t.Fragment,{children:[fe&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.evaluation-behavior-summary.label-metric","Metric"),horizontal:!0,children:fe}),oe&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.evaluation-behavior-summary.label-evaluate","Evaluate"),horizontal:!0,children:(0,t.jsxs)(a.x6,{i18nKey:"alerting.evaluation-behavior-summary.evaluate",values:{every:oe},children:["Every ",{every:oe}]})}),pe&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.evaluation-behavior-summary.label-pending-period","Pending period"),horizontal:!0,children:pe}),de&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.rule-details.keep-firing-for","Keep firing for"),horizontal:!0,children:de}),ae&&!(0,i.mo)(ae)&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.evaluation-behavior-summary.label-last-evaluation","Last evaluation"),horizontal:!0,children:(0,t.jsx)(m.m,{placement:"top",content:`${(0,r.LE)(ae,{format:"YYYY-MM-DD HH:mm:ss"})}`,theme:"info",children:(0,t.jsx)("span",{children:(0,a.t)("alerting.rule-details.last-evaluation-ago","{{time}} ago",{time:(0,o.KQ)(ae).locale("en").fromNow(!0)})})})}),ae&&!(0,i.mo)(ae)&&ie!==void 0&&(0,t.jsx)(g.X,{label:(0,a.t)("alerting.evaluation-behavior-summary.label-evaluation-time","Evaluation time"),horizontal:!0,children:(0,t.jsx)(m.m,{placement:"top",content:`${ie}s`,theme:"info",children:(0,t.jsx)("span",{children:(0,l.g)({timeInMs:ie*1e3,humanize:!0})})})})]})},X=se=>({wrapper:(0,n.css)({display:"flex",flexDirection:"row",[se.breakpoints.down("md")]:{flexDirection:"column"}}),leftSide:(0,n.css)({flex:1}),rightSide:(0,n.css)({[se.breakpoints.up("md")]:{paddingLeft:"90px",width:"300px"}})})},66773:(ee,B,e)=>{"use strict";e.d(B,{s:()=>C});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(63142),m=e(45861),a=e(87133),l=e(94018),f=e(72636),h=e(77824),u=e(56840),i=e(24619);const x=({className:I,onStateFilterChange:R,stateFilter:T,filterType:L,itemPerStateStats:K})=>{const A=(0,s.of)(g),W=U=>function(){return K&&K[U]?(0,t.jsx)(l.v,{name:K[U].toFixed(0),colorIndex:9,className:A.tag}):null},N=Object.values(i.Gi).map(U=>({label:U,value:U,component:W(U)})),j=[i.cF.Firing,i.cF.Pending].map(U=>({label:(0,r.capitalize)(U),value:U,component:W(U)})),V=L==="grafana"?N:j;return(0,t.jsxs)("div",{className:I,"data-testid":"alert-instance-state-filter",children:[(0,t.jsx)(f.J,{children:(0,t.jsx)(u.x6,{i18nKey:"alerting.alert-instance-state-filter.state",children:"State"})}),(0,t.jsx)(h.z,{options:V,value:T,onChange:R,onClick:U=>{U===T&&R(void 0)}})]})};function g(I){return{tag:(0,n.css)({fontSize:"11px",fontWeight:"normal",padding:I.spacing(.25,.5),verticalAlign:"middle",marginLeft:I.spacing(.5)})}}var p=e(86017),c=e(77256),y=e(21834),P=e(52161),d=e(63895),D=e(29609),b=e(75983),E=e(46672);function v({stats:I,onClick:R,href:T}){const L=(0,s.of)(O);return(0,t.jsxs)("div",{className:L.footerRow,children:[(0,t.jsxs)("div",{children:["Showing ",I.visibleItemsCount," out of ",I.totalItemsCount," instances"]}),(0,t.jsxs)(m.z9,{size:"sm",variant:"secondary","data-testid":"show-all",onClick:R,href:T,children:["Show all ",I.totalItemsCount," alert instances"]})]})}function C(I){const{rule:R,itemsDisplayLimit:T=Number.POSITIVE_INFINITY,pagination:L,enableFiltering:K=!1}=I,{promRule:A,namespace:W,instanceTotals:N}=R,[w,j]=(0,o.useState)(),[V,U]=(0,o.useState)(),[F]=(0,o.useState)(Math.floor(Math.random()*100)),M=`queryString-${F}`,H=(0,s.of)(O),_=(0,P.z2)(W.rulesSource)?P.hY:"prometheus",Z=(0,o.useMemo)(()=>D.R$.alertingRule(A)&&A.alerts?.length?S(w,V,(0,c.Cp)(y.xB.Importance,A.alerts)):[],[A,V,w]);if(!D.R$.alertingRule(A))return null;const ne=Z.slice(0,T),te=(0,r.countBy)(A.alerts,ae=>(0,i.lh)(ae.state)),Y=(0,r.sum)([N.alerting,N.inactive,N.pending,N.recovering,N.nodata]),Q=Y-ne.length,J={totalItemsCount:Y,visibleItemsCount:ne.length}
163,q=(0,c.w$)(W.rulesSource,I.rule,location.pathname+location.search),X=(0,E.kc)(N),se=()=>U(void 0),oe=Q?(0,t.jsx)(v,{stats:J,onClick:K?se:void 0,href:K?void 0:q}):void 0;return(0,t.jsxs)(t.Fragment,{children:[K&&(0,t.jsx)("div",{className:(0,n.cx)(H.flexRow,H.spaceBetween),children:(0,t.jsxs)("div",{className:H.flexRow,children:[(0,t.jsx)(a.X,{defaultQueryString:w,onFilterChange:ae=>j(ae)},M),(0,t.jsx)(x,{filterType:_,stateFilter:V,onStateFilterChange:U,itemPerStateStats:te})]})}),!K&&(0,t.jsx)("div",{className:H.stats,children:X}),(0,t.jsx)(b.D,{rule:R,instances:ne,pagination:L,footerRow:oe})]})}function S(I,R,T){let L=[...T];if(I){const K=I?(0,d.Zc)(I):[];L=L.filter(({labels:A})=>(0,p.Av)(A,K))}return R&&(L=L.filter(K=>(0,i.lh)(K.state)===R)),L}const O=I=>({flexRow:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"flex-end",width:"100%",flexWrap:"wrap",marginBottom:I.spacing(1),gap:I.spacing(1)}),spaceBetween:(0,n.css)({justifyContent:"space-between"}),footerRow:(0,n.css)({display:"flex",flexDirection:"column",gap:I.spacing(1),justifyContent:"space-between",alignItems:"center",width:"100%"}),instancesContainer:(0,n.css)({marginBottom:I.spacing(2)}),stats:(0,n.css)({display:"flex",gap:I.spacing(1),padding:I.spacing(1,0)})})},46672:(ee,B,e)=>{"use strict";e.d(B,{M_:()=>x,j7:()=>c,kc:()=>y});var t=e(74848),n=e(2543),r=e.n(n),o=e(55127),s=e.n(o),m=e(96540),a=e(41654),l=e(99887),f=e(56840),h=e(86791),u=e(24619);const i={recording:0,alerting:0,[u.cF.Pending]:0,[u.cF.Inactive]:0,[u.cF.Recovering]:0,paused:0,error:0,nodata:0},x=m.memo(({namespaces:P})=>{const d=(0,m.useDeferredValue)(P),D=(0,m.useMemo)(()=>g(d),[d]),b=p(D),E=y(D),v=!!E.length;return E.unshift((0,t.jsxs)(m.Fragment,{children:[b," ",s()("rule",b)]},"total")),(0,t.jsx)(a.B,{direction:"row",children:v&&(0,t.jsx)("div",{children:(0,t.jsx)(a.B,{gap:.5,children:E})})})});x.displayName="RuleStats";function g(P){const d={...i};return P.forEach(({groups:D})=>{D.forEach(b=>{const E=(0,n.omitBy)(b.totals,n.isUndefined);for(const v in E)d[v]+=E[v]})}),d}function p(P){const d=(0,n.pick)(P,["alerting","pending","inactive","recording","recovering"]);return(0,n.sum)(Object.values(d))}const c=({group:P})=>{const d=P.totals,D=P?.interval,b=y(d),E=!!b.length;return(0,t.jsxs)(a.B,{direction:"row",children:[E&&(0,t.jsx)("div",{children:(0,t.jsx)(a.B,{gap:.5,children:b})}),D&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{children:"|"}),(0,t.jsx)(l.E,{text:D,icon:"clock-nine",color:"blue"})]})]})};function y(P){const d=[];if(P[h.$7.Alerting]&&d.push((0,t.jsx)(l.E,{color:"red",text:(0,f.t)("alerting.rule-stats.firing","{{alertingStats}} firing",{alertingStats:P[h.$7.Alerting]})},"firing")),P.error&&d.push((0,t.jsx)(l.E,{color:"red",text:(0,f.t)("alerting.rule-stats.error","{{count}} errors",{count:P.error})},"errors")),P.nodata&&d.push((0,t.jsx)(l.E,{color:"blue",text:(0,f.t)("alerting.rule-stats.nodata","{{nodataStats}} no data",{nodataStats:P.nodata})},"nodata")),P[h.$7.Pending]){const D=P[h.$7.Pending];d.push((0,t.jsx)(l.E,{color:"orange",text:(0,f.t)("alerting.rule-stats.pending","{{pendingStats}} pending",{pendingStats:D})},"pending"))}if(P[h.$7.Recovering]){const D=P[h.$7.Recovering];d.push((0,t.jsx)(l.E,{color:"orange",text:(0,f.t)("alerting.rule-stats.recovering","{{recoveringStats}} recovering",{recoveringStats:D})},"recovering"))}if(P[h.$7.Normal]&&P.paused){const D=P[h.$7.Normal],b=P.paused;d.push((0,t.jsx)(l.E,{color:"green",text:(0,f.t)("alerting.rule-stats.paused","{{normalStats}} normal ({{pausedStats}} paused)",{normalStats:D,pausedStats:b})},"paused"))}if(P[h.$7.Normal]&&!P.paused){const D=P[h.$7.Normal];d.push((0,t.jsx)(l.E,{color:"green",text:(0,f.t)("alerting.rule-stats.inactive","{{normalStats}} normal",{normalStats:D})},"inactive"))}if(P.recording){const D=P.recording;d.push((0,t.jsx)(l.E,{color:"purple",text:(0,f.t)("alerting.rule-stats.recording","{{recordingStats}} recording",{recordingStats:D})},"recording"))}return d}},22971:(ee,B,e)=>{"use strict";e.d(B,{sF:()=>q,ZI:()=>fe});var t=e(74848),n=e(22803),r=e(96540),o=e(70255),s=e(63142),m=e(34213),a=e(45967),l=e(95943),f=e(70327),h=e(55143),u=e(74869),i=e(80218),x=e(23265),g=e(11940),p=e(74048),
163c=e(98127),y=e(17305),P=e(76267),d=e(95443),D=e(52161),b=e(29609),E=e(6106),v=e(57487),C=e(1972),S=e(40360),O=e(9368),I=e(3969),R=e(43173),T=e(30703),L=e(182);function K({rule:de}){const le=(0,s.of)(A),me=b.p.grafana.rule(de.rulerRule);return(0,r.useMemo)(()=>me?(0,L.qf)(de.group.interval).exceedsLimit:!1,[de.group.interval,me])?(0,t.jsx)(a.m,{theme:"error",content:(0,t.jsxs)("div",{children:["A minimum evaluation interval of"," ",(0,t.jsx)("span",{className:le.globalLimitValue,children:R.$.unifiedAlerting.minInterval})," has been configured in Grafana and will be used instead of the ",de.group.interval," interval configured for the Rule Group."]}),children:(0,t.jsx)(T.I,{name:"stopwatch-slash",className:le.icon})}):null}function A(de){return{globalLimitValue:(0,n.css)({fontWeight:de.typography.fontWeightBold}),icon:(0,n.css)({fill:de.colors.warning.text})}}var W=e(90186),N=e(56840),w=e(74159);const j=({rule:de})=>{const le=(0,s.of)(V);return(0,w.lf)(de.health)?(0,t.jsx)(a.m,{theme:"error",content:de.lastError||"No error message provided.",children:(0,t.jsxs)("div",{className:le.warn,children:[(0,t.jsx)(T.I,{name:"exclamation-triangle"}),(0,t.jsx)("span",{children:(0,t.jsx)(N.x6,{i18nKey:"alerting.rule-health.error",children:"error"})})]})}):(0,t.jsx)(t.Fragment,{children:de.health})},V=de=>({warn:(0,n.css)({display:"inline-flex",flexDirection:"row",alignItems:"center",gap:de.spacing(1),color:de.colors.warning.text})});var U=e(74529),F=e(41654),M=e(68079),H=e(24619),_=e(67834),Z=e(65420);const ne=({rule:de,isDeleting:le,isCreating:me,isPaused:De})=>{const Te=(0,s.of)(te),{promRule:Ne,rulerRule:Ce}=de,He=()=>De&&b.p.grafana.recordingRule(Ce)?(0,t.jsx)(a.m,{content:"Recording rule evaluation is currently paused",placement:"top",children:(0,t.jsxs)(_.O,{state:"warning",children:[(0,t.jsx)(T.I,{name:"pause",size:"xs"}),(0,t.jsx)(N.x6,{i18nKey:"alerting.rule-state.paused",children:"Paused"})]})}):(0,t.jsx)(N.x6,{i18nKey:"alerting.rule-state.recording-rule",children:"Recording rule"}),ke=(0,r.useMemo)(()=>{if(b.R$.alertingRule(Ne)&&Ne.alerts?.length&&Ne.state!==H.cF.Inactive){const Me=Ne.activeAt?new Date(Ne.activeAt):(0,b.Om)(Ne);if(Me)return(0,t.jsxs)("span",{title:String(Me),className:Te.for,children:["for"," ",(0,U.dU)({start:Me,end:new Date},!1)]})}return null},[Ne,Te]);return le?(0,t.jsxs)(F.B,{gap:1,children:[(0,t.jsx)(M.y,{}),(0,t.jsx)(N.x6,{i18nKey:"alerting.rule-state.deleting",children:"Deleting"})]}):me?(0,t.jsxs)(F.B,{gap:1,children:[(0,t.jsx)(M.y,{}),(0,t.jsx)(N.x6,{i18nKey:"alerting.rule-state.creating",children:"Creating"})]}):b.R$.alertingRule(Ne)?(0,t.jsxs)(F.B,{gap:1,children:[(0,t.jsx)(Z.C,{state:Ne.state,isPaused:De}),!De&&ke]}):Ne&&b.R$.recordingRule(Ne)?(0,t.jsx)(He,{}):(0,t.jsx)(N.x6,{i18nKey:"alerting.rule-state.na",children:"n/a"})},te=de=>({for:(0,n.css)({fontSize:de.typography.bodySmall.fontSize,color:de.colors.text.secondary,whiteSpace:"nowrap",paddingTop:"2px"})}),Y=(0,u.wS)(),{useLazyGetRuleGroupForNamespaceQuery:Q}=f.hK,{useLazyDiscoverDsFeaturesQuery:J}=h.L,q=({rules:de,className:le,showGuidelines:me=!1,emptyMessage:De="No rules found.",showGroupColumn:Te=!1,showSummaryColumn:Ne=!1,showNextEvaluationColumn:Ce=!1})=>{const He=(0,s.of)(se),ke=(0,n.cx)(He.wrapper,le,{[He.wrapperMargin]:me}),{pageItems:Me,page:$e,numberOfPages:tt,onPageChange:Ke}=(0,p.W)(de,1,l.FG),{result:Re,status:Ve}=X(Me),Qe=Ve==="loading",je=(0,r.useMemo)(()=>Re.map((Ge,ce)=>({id:`${Ge.namespace.name}-${Ge.group.name}-${Ge.name}-${ce}`,data:Ge})),[Re]),ze=oe(Ne,Te,Ce,Qe);if(!Me.length)return(0,t.jsx)("div",{className:(0,n.cx)(ke,He.emptyMessage),children:De});const Ye=me?v.B:E.E;return(0,t.jsxs)("div",{className:ke,"data-testid":"rules-table",children:[(0,t.jsx)(Ye,{cols:ze,isExpandable:!0,items:je,renderExpandedContent:({data:Ge})=>(0,t.jsx)(W.DI,{rule:Ge})}),(0,t.jsx)(m.d,{currentPage:$e,numberOfPages:tt,onNavigate:Ke,hideWhenSinglePage:!0,className:He.pagination})]})};function X(de){const[le]=Q(),[me]=J(),[De,Te]=(0,i.Yb)(async()=>Promise.all(de.map(async Ce=>{const He=await me({rulesSourceName:(0,D.EV)(Ce.namespace.rulesSource)},!0).unwrap();if(He.rulerConfig&&Ce.namespace.rulesSource!==D.hY){const ke=await le({namespace:Ce.namespace.name,group:Ce.group.name,rulerConfig:He.rulerConfig},!0).unwrap();(0,x.yh)(Ce,ke)}return Ce})),de);return(0,r.useEffect)(()=>{Y?De.execute():De.reset()},[de,De]),Te}const se=de=>({wrapperMargin:(0,n.css)({[de.breakpoints.up("md")]:{marginLeft:"36px"}}),emptyMessage:(0,n.css)({padding:de.spacing(1)}
163),wrapper:(0,n.css)({width:"auto",borderRadius:de.shape.radius.default}),skeletonWrapper:(0,n.css)({flex:1}),pagination:(0,n.css)({display:"flex",margin:0,paddingTop:de.spacing(1),paddingBottom:de.spacing(.25),justifyContent:"center",borderLeft:`1px solid ${de.colors.border.medium}`,borderRight:`1px solid ${de.colors.border.medium}`,borderBottom:`1px solid ${de.colors.border.medium}`,float:"none"})});function oe(de,le,me,De){return(0,r.useMemo)(()=>{const Te=[{id:"state",label:"State",renderCell:({data:Ne})=>(0,t.jsx)(ae,{rule:Ne}),size:"165px"},{id:"name",label:"Name",renderCell:({data:Ne})=>Ne.name,size:me?4:5},{id:"metadata",label:"",renderCell:({data:Ne})=>{const{promRule:Ce,rulerRule:He}=Ne,ke=(0,b.uo)(Ce??He);return ke?(0,t.jsx)(y.T,{pluginId:ke.pluginId}):b.p.grafana.rule(He)&&He.grafana_alert.provenance?(0,t.jsx)(C.rS,{}):null},size:"100px"},{id:"warnings",label:"",renderCell:({data:Ne})=>(0,t.jsx)(K,{rule:Ne}),size:"45px"},{id:"health",label:"Health",renderCell:({data:{promRule:Ne,group:Ce}})=>Ne?(0,t.jsx)(j,{rule:Ne}):null,size:"75px"}];return de&&Te.push({id:"summary",label:"Summary",renderCell:({data:Ne})=>(0,t.jsx)(O.Y,{input:Ne.annotations[d.YH.summary]??""}),size:me?4:5}),me&&Te.push({id:"nextEvaluation",label:"Next evaluation",renderCell:({data:Ne})=>{const Ce=(0,P.C)(Ne.promRule?.lastEvaluation,Ne.group.interval);return Ce&&(0,t.jsx)(a.m,{placement:"top",content:`${Ce?.fullDate}`,theme:"info",children:(0,t.jsx)("span",{children:Ce?.humanized})})},size:2}),le&&Te.push({id:"group",label:"Group",renderCell:({data:Ne})=>{const{namespace:Ce,group:He}=Ne;return He.name==="default"?(0,t.jsx)(S.c,{namespace:Ce.name}):(0,t.jsx)(S.c,{namespace:Ce.name,group:He.name})},size:5}),Te.push({id:"actions",label:"Actions",renderCell:({data:Ne})=>(0,t.jsx)(ie,{rule:Ne,isLoadingRuler:De}),size:"215px"}),Te},[de,le,me,De])}function ae({rule:de}){const{isDeleting:le,isCreating:me,isPaused:De}=pe(de);return(0,t.jsx)(ne,{rule:de,isDeleting:le,isCreating:me,isPaused:De})}function ie({rule:de,isLoadingRuler:le}){const me=(0,s.of)(se),{isDeleting:De,isCreating:Te}=pe(de);return le?(0,t.jsx)(o.A,{containerClassName:me.skeletonWrapper}):(0,t.jsx)(I.l,{compact:!0,showViewButton:!De&&!Te,rule:de,rulesSource:de.namespace.rulesSource})}function fe(de){const le=(0,c.$)(Te=>Te.rulerRules),me=(0,D.EV)(de);return!!le[me]?.result}function pe(de){const le=de.namespace.rulesSource,me=fe(le),{hasRuler:De}=(0,g.y)(le),{promRule:Te,rulerRule:Ne}=de;if(Y&&!b.p.grafana.rule(Ne))return{isDeleting:!1,isCreating:!1,isPaused:!1};const Ce=!!(De&&me&&Te&&!Ne),He=!!(De&&me&&Ne&&!Te),ke=b.p.grafana.rule(Ne)&&(0,b.hC)(Ne);return{isDeleting:Ce,isCreating:He,isPaused:ke}}},83903:(ee,B,e)=>{"use strict";e.d(B,{y:()=>s});var t=e(74848),n=e(84266),r=e(67834);const o={[n.Or.Active]:"bad",[n.Or.Unprocessed]:"neutral",[n.Or.Suppressed]:"info"},s=({state:m})=>(0,t.jsx)(r.O,{state:o[m],children:m})},2218:(ee,B,e)=>{"use strict";e.d(B,{A:()=>h});var t=e(74848),n=e(96540),r=e(8207),o=e(41654),s=e(56840),m=e(24158),a=e(52161),l=e(5358);const h=n.memo(({rulerRule:u,onClose:i})=>{const{uid:x}=u.grafana_alert;return(0,t.jsx)(r._,{title:(0,s.t)("alerting.silence-grafana-rule-drawer.title-silence-alert-rule","Silence alert rule"),subtitle:"Configure silences to stop notifications from a particular alert rule.",onClose:i,size:"md",children:(0,t.jsx)(o.B,{direction:"column",children:(0,t.jsx)(l.b9,{accessType:"instance",children:(0,t.jsx)(m.SilencesEditor,{ruleUid:x,alertManagerSourceName:a.hY,onSilenceCreated:i,onCancel:i})})})})},(u,i)=>u.rulerRule.grafana_alert.uid===i.rulerRule.grafana_alert.uid)},24158:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{SilencesEditor:()=>me,default:()=>Ne});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(49785),m=e(54148),a=e(40996),l=e(74529),f=e(25229),h=e(68143),u=e(36490),i=e(43173),x=e(6975),g=e(34999),p=e(63142),c=e(16780),y=e(37386),P=e(63527),d=e(87105),D=e(41654),b=e(45861),E=e(56840),v=e(62421),C=e(95443),S=e(52161),O=e(84266),I=e(16692),R=e(5358),T=e(86017),L=e(77256),K=e(88547),A=e(36826),W=e(58750),N=e(3271),w=e(18857),j=e(76319),V=e(70327);const U=({className:Ce,required:He,ruleUid:ke})=>{const Me=(0,p.of)(F),$e=(0,s.xW)(),{control:tt,register:Ke,formState:{errors:Re}}=$e,{fields:Ve=[],append:Qe,remove:je}=(0,s.jz)({name:"matchers"}),[ze,{data:Ye}]=V.hK.endpoints.getAlertRule.useLazyQuery();return(0,o.useEffect)(()=>{ke&&ze({uid:ke})},[ze,ke]),(0,t.jsx)("div",{className:Ce,children:(0,t.jsx)(y.D,{label:(0,E.t)("alerting.matchers-field.label-refine-affected-alerts","Refine affected alerts"),required:He,children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:(0,n.cx)(Me.matchers,Me.indent),children:[Ye&&(0,t.jsxs)("div",{children:[(0,t.jsx)(y.D,{label:(0,E.t)("alerting.matchers-field.label-alert-rule","Alert rule"),disabled:!0,children:(0,t.jsx)(P.p,{id:"alert-rule-name",defaultValue:Ye.grafana_alert.title,disabled:!0})}),(0,t.jsx)(N.c,{})]}),Ve.map((Ge,ce)=>(0,t.jsxs)("div",{className:Me.row,"data-testid":"matcher",children:[(0,t.jsx)(y.D,{label:(0,E.t)("alerting.matchers-field.label-label","Label"),invalid:!!Re?.matchers?.[ce]?.name,error:Re?.matchers?.[ce]?.name?.message,children:(0,t.jsx)(P.p,{...Ke(`matchers.${ce}.name`,{required:{value:He,message:"Required."}}),defaultValue:Ge.name,placeholder:(0,E.t)("alerting.matchers-field.placeholder-label","label"),id:`matcher-${ce}-label`})}),(0,t.jsx)(y.D,{label:(0,E.t)("alerting.matchers-field.label-operator","Operator"),children:(0,t.jsx)(s.xI,{control:tt,render:({field:{onCh
163ange:Pe,ref:Se,...Ee}})=>(0,t.jsx)(w.l6,{...Ee,onChange:xe=>Pe(xe.value),className:Me.matcherOptions,options:T.xH,"aria-label":(0,E.t)("alerting.matchers-field.aria-label-operator","operator"),id:`matcher-${ce}-operator`}),defaultValue:Ge.operator||T.xH[0].value,name:`matchers.${ce}.operator`,rules:{required:{value:He,message:"Required."}}})}),(0,t.jsx)(y.D,{label:(0,E.t)("alerting.matchers-field.label-value","Value"),invalid:!!Re?.matchers?.[ce]?.value,error:Re?.matchers?.[ce]?.value?.message,children:(0,t.jsx)(P.p,{...Ke(`matchers.${ce}.value`,{required:{value:He,message:"Required."}}),defaultValue:Ge.value,placeholder:(0,E.t)("alerting.matchers-field.placeholder-value","value"),id:`matcher-${ce}-value`})}),(Ve.length>1||!He)&&(0,t.jsx)(j.K,{"aria-label":(0,E.t)("alerting.matchers-field.aria-label-remove-matcher","Remove matcher"),className:Me.removeButton,name:"trash-alt",onClick:()=>je(ce),children:(0,t.jsx)(E.x6,{i18nKey:"alerting.matchers-field.remove",children:"Remove"})})]},`${Ge.id}`))]}),(0,t.jsx)(b.$n,{className:Me.indent,tooltip:(0,E.t)("alerting.matchers-field.tooltip-refine-which-alert-instances-silenced-selecting","Refine which alert instances are silenced by selecting label matchers"),type:"button",icon:"plus",variant:"secondary",onClick:()=>{const Ge={name:"",value:"",operator:O.ho.equal};Qe(Ge)},children:(0,t.jsx)(E.x6,{i18nKey:"alerting.matchers-field.add-matcher",children:"Add matcher"})})]})})})},F=Ce=>({wrapper:(0,n.css)({marginTop:Ce.spacing(2)}),row:(0,n.css)({marginTop:Ce.spacing(1),display:"flex",alignItems:"flex-start",flexDirection:"row",backgroundColor:Ce.colors.background.secondary,padding:`${Ce.spacing(1)} ${Ce.spacing(1)} 0 ${Ce.spacing(1)}`,"& > * + *":{marginLeft:Ce.spacing(2)}}),removeButton:(0,n.css)({marginLeft:Ce.spacing(1),marginTop:Ce.spacing(2.5)}),matcherOptions:(0,n.css)({minWidth:"140px"}),matchers:(0,n.css)({maxWidth:`${Ce.breakpoints.values.sm}px`,margin:`${Ce.spacing(1)} 0`,paddingTop:Ce.spacing(.5)}),indent:(0,n.css)({marginLeft:Ce.spacing(2)})}),M=U;var H=e(56265);const _=()=>{const{control:Ce,getValues:He}=(0,s.xW)(),{field:{onChange:ke,value:Me},fieldState:{invalid:$e}}=(0,s.as)({name:"startsAt",control:Ce,rules:{validate:Ge=>He().endsAt>Ge}}),{field:{onChange:tt,value:Ke},fieldState:{invalid:Re}}=(0,s.as)({name:"endsAt",control:Ce,rules:{validate:Ge=>He().startsAt<Ge}}),{field:{onChange:Ve,value:Qe}}=(0,s.as)({name:"timeZone",control:Ce}),je=$e||Re,ze=(0,f.KQ)(Me),Ye=(0,f.KQ)(Ke);return(0,t.jsx)(y.D,{className:Z.timeRange,label:(0,E.t)("alerting.silence-period.label-silence-start-and-end","Silence start and end"),error:je?"To is before or the same as from":"",invalid:je,children:(0,t.jsx)(H.b,{value:{from:ze,to:Ye,raw:{from:ze,to:Ye}},timeZone:Qe,onChange:Ge=>{ke((0,f.KQ)(Ge.from)),tt((0,f.KQ)(Ge.to))},onChangeTimeZone:Ge=>Ve(Ge),hideTimeZone:!1,hideQuickRanges:!0,placeholder:(0,E.t)("alerting.silence-period.placeholder-select-time-range","Select time range")})})},Z={timeRange:(0,n.css)({width:"400px"})};var ne=e(45214),te=e(45967),Y=e(30703),Q=e(99887),J=e(91984),q=e(15629),X=e(7840),se=e(6106),oe=e(83903);const ae=(Ce,He,ke)=>{const[Me,$e]=(0,o.useState)();(0,a.A)(Ce,He,[Me]),(0,ne.A)(()=>{$e(ke)},[ke])},ie=({amSourceName:Ce,matchers:He,ruleUid:ke})=>{const Me=[...ke?[{name:C.kW,value:ke,operator:O.ho.equal}]:[],...He].map(T.Wc),$e=J.m.endpoints.getAlertmanagerAlerts.useLazyQuery,tt=(0,p.of)(pe),Ke=fe(),Re=ke||He.some(Ge=>Ge.value&&Ge.name),[Ve,{currentData:Qe=[],isFetching:je,isError:ze}]=$e();if(ae(()=>{Re&&Ve({amSourceName:Ce,filter:{matchers:Me}})},500,[Ce,Me]),ze)return(0,t.jsx)(g.F,{title:(0,E.t)("alerting.silenced-instances-preview.title-preview-not-available","Preview not available"),severity:"error",children:"Error occurred when generating preview of affected alerts. Are your matchers valid?"});const Ye=Qe.map(Ge=>({id:Ge.fingerprint,data:Ge}));return(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{className:tt.title,children:[(0,t.jsx)(E.x6,{i18nKey:"alerting.silences.affected-instances",children:"Affected alert instances"}),(0,t.jsx)(te.m,{content:(0,t.jsxs)("div",{children:[(0,t.jsx)(E.x6,{i18nKey:"alerting.silences.preview-affected-instances",children:"Preview the alert instances affected by this
163silence."}),(0,t.jsx)("br",{}),(0,t.jsx)(E.x6,{i18nKey:"alerting.silences.only-firing-instances",children:"Only alert instances in the firing state are displayed."})]}),children:(0,t.jsxs)("span",{children:["\xA0",(0,t.jsx)(Y.I,{name:"info-circle",size:"sm"})]})}),Ye.length>0?(0,t.jsx)(Q.E,{className:tt.badge,color:"blue",text:Ye.length}):null]}),!Re&&(0,t.jsx)("span",{children:(0,t.jsx)(E.x6,{i18nKey:"alerting.silenced-instances-preview.valid-matcher-affected-alerts",children:"Add a valid matcher to see affected alerts"})}),je&&(0,t.jsx)(x._,{text:(0,E.t)("alerting.silenced-instances-preview.text-loading-affected-alert-rule-instances","Loading affected alert rule instances...")}),!je&&!ze&&Re&&(0,t.jsx)("div",{className:tt.table,children:Ye.length>0?(0,t.jsx)(se.E,{items:Ye,isExpandable:!1,cols:Ke,pagination:{itemsPerPage:10}}):(0,t.jsx)("span",{children:(0,t.jsx)(E.x6,{i18nKey:"alerting.silenced-instances-preview.no-firing-alert-instances-found",children:"No firing alert instances found"})})})]})};function fe(){const Ce=(0,p.of)(pe);return[{id:"state",label:"State",renderCell:function({data:ke}){return(0,t.jsx)(oe.y,{state:ke.status.state})},size:"120px",className:Ce.stateColumn},{id:"labels",label:"Labels",renderCell:function({data:ke}){return(0,t.jsx)(X.m,{labels:ke.labels,size:"sm"})},size:"auto"},{id:"created",label:"Created",renderCell:function({data:ke}){return(0,t.jsx)(t.Fragment,{children:(0,q.mo)(ke.startsAt)?"-":(0,f.KQ)(ke.startsAt).format("YYYY-MM-DD HH:mm:ss")})},size:"180px"}]}const pe=Ce=>({table:(0,n.css)({maxWidth:`${Ce.breakpoints.values.lg}px`}),moreMatches:(0,n.css)({marginTop:Ce.spacing(1)}),title:(0,n.css)({display:"flex",alignItems:"center"}),badge:(0,n.css)({marginLeft:Ce.spacing(1)}),stateColumn:(0,n.css)({display:"flex",alignItems:"center"})});var de=e(39947);const le=()=>{const{id:Ce=""}=(0,m.g)(),{selectedAlertmanager:He=""}=(0,R.VI)(),{data:ke,isLoading:Me,error:$e}=v.F.endpoints.getSilence.useQuery({id:Ce,datasourceUid:(0,S.w5)(He),ruleMetadata:!0,accessControl:!0}),tt=ke?.matchers?.find(je=>je.name===C.kW)?.value,Ke=He===S.hY,Re=(0,o.useMemo)(()=>{if(!ke)return;const je=ke.matchers?.filter(ze=>ze.name!==C.kW);return(0,de.Ee)({...ke,matchers:je})},[ke]);return Ce&&Me?(0,t.jsx)(x._,{text:(0,E.t)("alerting.existing-silence-editor.text-loading-existing-silence-information","Loading existing silence information...")}):(0,h.NF)($e)&&$e.status===404?(0,t.jsx)(g.F,{title:`Existing silence "${Ce}" not found`,severity:"warning"}):(Ke?ke?.accessControl?.write:!0)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.M,{currentAlertmanager:He}),(0,t.jsx)(me,{ruleUid:tt,formValues:Re,alertManagerSourceName:He})]}):(0,t.jsx)(g.F,{title:"You do not have permission to edit/recreate this silence",severity:"error"})},me=({formValues:Ce=(0,de.Di)(),alertManagerSourceName:He,onSilenceCreated:ke,onCancel:Me,ruleUid:$e})=>{const[tt,Ke]=(0,I.L7)(I.QI.PreviewSilencedInstances),Re=tt&&Ke,[Ve,{isLoading:Qe}]=v.F.endpoints.createSilence.useMutation(),je=(0,s.mN)({defaultValues:Ce}),ze=(0,p.of)(De),{register:Ye,handleSubmit:Ge,formState:ce,watch:Pe,setValue:Se,clearErrors:Ee}=je,[xe,ye,Oe,we]=Pe(["duration","startsAt","endsAt","matchers"]),Be=()=>{u.Ny.push((0,L.nL)("/alerting/silences",He))},Xe=ke||Be,st=Me||Be,lt=async wt=>{const{id:_e,startsAt:xt,endsAt:At,comment:bt,createdBy:Xt,matchers:Cn}=wt;$e&&Cn.push({name:C.kW,value:$e,operator:O.ho.equal});const vn=Cn.map(T.Wc).filter(Dt=>Dt.name&&Dt.value),Wn=(0,r.pickBy)({id:_e,startsAt:xt,endsAt:At,comment:bt,createdBy:Xt,matchers:vn},Dt=>!!Dt);await Ve({datasourceUid:(0,S.w5)(He),payload:Wn}).unwrap().then(Dt=>{Xe?.(Dt)})},[Et,Tt]=(0,o.useState)(xe);(0,a.A)(()=>{if((0,l.vd)(ye)&&(0,l.vd)(Oe))if(xe!==Et)Se("endsAt",(0,f.KQ)((0,l.Ri)(new Date(ye),(0,l.E9)(xe))).toISOString()),Tt(xe);else{const wt=new Date(ye).valueOf();if(new Date(Oe).valueOf()>wt){const xt=(0,l.dU)({start:new Date(ye),end:new Date(Oe)});Se("duration",xt),Tt(xt)}}},700,[Ee,xe,Oe,Et,Se,ye]);const Mt=!!(i.$.bootData.user.isSignedIn&&i.$.bootData.user.name);return(0,t.jsx)(s.Op,{...je,children:(0,t.jsxs)("form",{onSubmit:Ge(lt),children:[(0,t.jsxs)(c.n,{className:ze.formContainer,children:[(0,t.jsxs)("div",{className:ze.silencePeriod,children:[(0,t.jsx)(_,{}),(0,t.jsx)(y.D,{label:(0,E.t)("alerting.silences-editor.label-duration","Duration"),invalid:!!ce.errors.duration,error:ce.errors.duration&&(ce.errors.duration.type==="required"?"Required field":ce.errors.duration.message),children:(0,t.jsx)(P.p,{...Ye("duration",{validate:wt=>Object.keys((0,l.E9)(wt)).length===0?"Invalid duration. Valid example: 1d 4h (Available units: y, M, w, d, h, m, s)":void 0}),id:"duration"})})]}),(0,t.jsx)(M,{required:!$e,ruleUid:$e}),(0,t.jsx)(y.D,{label:(0,E.t)("alerting.silences-editor.label-comment","Comment"),required:!0,error:ce.errors.comment?.message,invali
163d:!!ce.errors.comment,children:(0,t.jsx)(d.f,{...Ye("comment",{required:{value:!0,message:"Required."}}),rows:5,placeholder:(0,E.t)("alerting.silences-editor.comment-placeholder-details-about-the-silence","Details about the silence"),id:"comment"})}),!Mt&&(0,t.jsx)(y.D,{label:(0,E.t)("alerting.silences-editor.label-created-by","Created By"),required:!0,error:ce.errors.createdBy?.message,invalid:!!ce.errors.createdBy,children:(0,t.jsx)(P.p,{...Ye("createdBy",{required:{value:!0,message:"Required."}}),placeholder:(0,E.t)("alerting.silences-editor.placeholder-whos-creating-the-silence","Who's creating the silence")})}),Re&&(0,t.jsx)(ie,{amSourceName:He,matchers:we,ruleUid:$e})]}),(0,t.jsxs)(D.B,{gap:1,children:[Qe&&(0,t.jsx)(b.$n,{disabled:!0,icon:"spinner",variant:"primary",children:(0,t.jsx)(E.x6,{i18nKey:"alerting.silences-editor.saving",children:"Saving..."})}),!Qe&&(0,t.jsx)(b.$n,{type:"submit",children:(0,t.jsx)(E.x6,{i18nKey:"alerting.silences-editor.save-silence",children:"Save silence"})}),(0,t.jsx)(b.z9,{onClick:st,variant:"secondary",children:(0,t.jsx)(E.x6,{i18nKey:"alerting.common.cancel",children:"Cancel"})})]})]})})},De=Ce=>({formContainer:(0,n.css)({maxWidth:Ce.breakpoints.values.md}),alertRule:(0,n.css)({paddingBottom:Ce.spacing(2)}),silencePeriod:(0,n.css)({display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:Ce.spacing(1),maxWidth:Ce.breakpoints.values.sm,paddingTop:Ce.spacing(2)})});function Te(){const Ce={id:"silence-edit",text:"Edit silence",subTitle:"Recreate existing silence to stop notifications from a particular alert rule"};return(0,t.jsx)(A.y,{navId:"silences",pageNav:Ce,accessType:"instance",children:(0,t.jsx)(le,{})})}const Ne=(0,K.S)(Te)},39947:(ee,B,e)=>{"use strict";e.d(B,{Di:()=>u,Ee:()=>h,LP:()=>f});var t=e(74529),n=e(22592),r=e(25229),o=e(43173),s=e(86017),m=e(95443),a=e(63895),l=e(84266);const f=i=>{const x={},g=i.get("comment"),c=i.getAll("matcher").filter(P=>!P.startsWith(m.kW)),y=(0,a.ou)(c);return y.length&&(x.matchers=y.map(s.MU)),g&&(x.comment=g),x},h=i=>{const x=new Date,p=Date.parse(i.endsAt)<Date.now()?{start:x,end:(0,t.Ri)(x,{hours:2})}:{start:new Date(i.startsAt),end:new Date(i.endsAt)};return{id:i.id,startsAt:p.start.toISOString(),endsAt:p.end.toISOString(),comment:i.comment,createdBy:i.createdBy,duration:(0,t.dU)(p),isRegex:!1,matchers:i.matchers?.map(s.MU)||[],matcherName:"",matcherValue:"",timeZone:n.lE}},u=i=>{const x=new Date,g=(0,t.Ri)(x,{hours:2});return{id:"",startsAt:x.toISOString(),endsAt:g.toISOString(),comment:`created ${(0,r.KQ)().format("YYYY-MM-DD HH:mm")}`,createdBy:o.$.bootData.user.name,duration:"2h",isRegex:!1,matcherName:"",matcherValue:"",timeZone:n.lE,matchers:[{name:"",value:"",operator:l.ho.equal}],...i}}},17349:(ee,B,e)=>{"use strict";e.d(B,{X:()=>n});var t=e(96673);const n=[t.AccessControlAction.AlertingTemplatesRead,t.AccessControlAction.AlertingTemplatesWrite,t.AccessControlAction.AlertingTemplatesDelete]},74869:(ee,B,e)=>{"use strict";e.d(B,{AW:()=>s,VB:()=>a,f2:()=>m,sk:()=>o,wS:()=>r});var t=e(43173),n=e(77256);const r=()=>t.$.featureToggles.alertingPrometheusRulesPrimary??!1,o=()=>t.$.featureToggles.alertingListViewV2??!1,s=()=>t.$.unifiedAlerting.recordingRulesEnabled&&t.$.featureToggles.grafanaManagedRecordingRules,m=()=>((0,n.qc)()&&t.$.featureToggles.alertingRuleRecoverDeleted&&t.$.featureToggles.alertRuleRestore)??!1,a=()=>(m()&&t.$.featureToggles.alertingRulePermanentlyDelete)??!1},75756:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>m});var t=e(56840),n=e(70327),r=e(96137),o=e(80218),s=e(71639);function m(){const[a]=(0,s.D)(),[l]=n.hK.endpoints.upsertRuleGroupForNamespace.useMutation(),[f]=n.hK.endpoints.deleteRuleGroupFromNamespace.useMutation();return(0,o.Yb)(async(h,u)=>{const{groupName:i,namespaceName:x}=h,g=(0,r.KH)({identifier:u}),{newRuleGroupDefinition:p,rulerConfig:c}=await a(h,[g]),y=(0,t.t)("alerting.rules.delete-rule.success","Rule successfully deleted");return p.rules.length===0?f({rulerConfig:c,namespace:x,group:i,notificationOptions:{successMessage:y}}).unwrap():l({rulerConfig:c,namespace:x,payload:p,notificationOptions:{successMessage:y}}).unwrap()})}},71639:(ee,B,e)=>{"use strict";e.d(B,{D:()=>i,_:()=>u});var t=e(86791),n=e(70327),r=e(55143),o=e(62939),s=e(96137),m=e(84523),a=e(52161);const l=!0,{useLazyGetRuleGroupForNamespaceQuery:f}=n.hK,{useLazyDiscoverDsFeaturesQuery:h}=r.L,u=g=>new Error(`DataSource ${g} does not support ruler API or does not have the ruler API enabled.`);function i(){const[g,p]=f(),[c]=h();return[async(P,d)=>{const{dataSourceName:D,groupName:b,namespaceName:E}=P,v=D==="grafana"?t.l$:(0,a.w5)(D),{rulerConfig:C}=await c({uid:v},l).unwrap();if(!C)throw u(D);const O=await g({rulerConfig:C,namespace:E,group:b,notificationOptions:{showErrorAlert:!1}}).unwrap().catch(o.R)??x(b);return{newRuleGroupDefinition:d.reduce((R,T)=>(0,s.i3)(R,T),O),rulerConfig:C}},p]}const x=g=>({name:g,interval:m.T6,rules:[]})},23390:(ee,B,e)=>{"use strict";e.d(B,{d:()=>u,pU:()=>i});var t=e(1932),n=e(2543),r=e.n(n),o=e(56840),s=e(70327),m=e(96137),a=e(29609),l=e(80218),f=e(75756),h=e(71639);function u(){const[p]=(0,h.D)(),[c]=s.hK.endpoints.upsertRuleGroupForNamespace.useMutation(),y=(0,o.t)("alerting.rules.add-rule.success","Rule added successfully");return(0,l.Yb)(async(P,d,D)=>{const{namespaceName:b}=P,E=(0,m.Qn)({rule:d,interval:D,groupName:P.groupName}),{newRuleGroupDefinition:v,rulerConfig:C}=await p(P,[E]);return c({rulerConfig:C,namespace:b,payload:v,notificationOptions:{successMessage:y}}).unwrap()})}function i(){const[p]=(0,h.D)(),[c]=x(),[y]=s.hK.endpoints.upsertRuleGroupForNamespace.useMutation(),P=(0,o.t)("alerting.rules.update-rule.success","Rule updated successfully");return(0,l.Yb)(async(d,D,b,E,v)=>{const{namespaceName:C}=d,S=g(D,b),O=(0,n.isEqual)(d,E);if(E&&!O)return c.execute(d,E,D,b,v);const I=(0,m.Wu)({identifier:D,rule:S}),{newRuleGroupDefinition:R,rulerConfig:T}=await p(d,[I]);return y({rulerConfig:T,namespace:C,payload:R,notificationOptions:{successMessage:P}}).unwrap()})}function x(){const[p]=(0,h.D)(),[c]=(0,f.Y)(),[y]=s.hK.endpoints.upsertRuleGroupForNamespace.useMutation(),P=(0,o.t)("alerting.rules.update-rule.success","Rule updated successfully");return(0,l.Yb)(async(d,D,b,E,v)=>{const C=g(b,E),S=(0,m.Qn)({rule:C,interval:v}),{newRuleGroupDefinition:O,rulerConfig:I}=await p(D,[S]),R=await y({rulerConfig:I,namespace:D.namespaceName,payload:O,notificationOptions:{successMessage:P}}).unwrap();return(0,a.A4)(b)||await c.execute(d,b),R})}function g(p,c){const y=(0,a.A4)(p);return(0,t.jM)(c,P=>{const d=a.p.grafana.rule(P);y&&d&&(P.grafana_alert.uid=p.uid)})}},11504:(ee,B,e)=>{"use strict";e.d(B,{G:()=>r});var t=e(96540),n=e(29609);function r(o){return(0,t.useMemo)(()=>(0,n.fC)(o),[o])}},16692:(ee,B,e)=>{"use strict";e.d(B,{Ej:()=>v,Hl:()=>A,L7:()=>K,QI:()=>y,RY:()=>d,e2:()=>E,iI:()=>L,j5:()=>P,mW:()=>O,mh:()=>C});var t=e(96540),n=e(15130),r=e(76070),o=e(66513),s=e(88114),m=e(18404),a=e(84266),l=e(96673),f=e(91984),h=e(5358),u=e(54),i=e(52161),x=e(67598),g=e(77256),p=e(29609),c=e(12770),y=(F=>(F.ViewExternalConfiguration="view-external-configuration",F.UpdateExter
163nalConfiguration="update-external-configuration",F.CreateContactPoint="create-contact-point",F.ViewContactPoint="view-contact-point",F.UpdateContactPoint="edit-contact-points",F.DeleteContactPoint="delete-contact-point",F.ExportContactPoint="export-contact-point",F.CreateNotificationTemplate="create-notification-template",F.ViewNotificationTemplate="view-notification-template",F.UpdateNotificationTemplate="edit-notification-template",F.DeleteNotificationTemplate="delete-notification-template",F.DecryptSecrets="decrypt-secrets",F.CreateNotificationPolicy="create-notification-policy",F.ViewNotificationPolicyTree="view-notification-policy-tree",F.UpdateNotificationPolicyTree="update-notification-policy-tree",F.DeleteNotificationPolicy="delete-notification-policy",F.ExportNotificationPolicies="export-notification-policies",F.ViewAutogeneratedPolicyTree="view-autogenerated-policy-tree",F.CreateSilence="create-silence",F.ViewSilence="view-silence",F.UpdateSilence="update-silence",F.PreviewSilencedInstances="preview-silenced-alerts",F.ViewMuteTiming="view-mute-timing",F.CreateMuteTiming="create-mute-timing",F.UpdateMuteTiming="update-mute-timing",F.DeleteMuteTiming="delete-mute-timing",F.ExportMuteTimings="export-mute-timings",F.ViewAlertGroups="view-alert-groups",F))(y||{}),P=(F=>(F.Duplicate="duplicate-alert-rule",F.View="view-alert-rule",F.Update="update-alert-rule",F.Delete="delete-alert-rule",F.Explore="explore-alert-rule",F.Silence="silence-alert-rule",F.ModifyExport="modify-export-rule",F.Pause="pause-alert-rule",F.Restore="restore-alert-rule",F.DeletePermanently="delete-alert-rule-permanently",F))(P||{}),d=(F=>(F.CreateAlertRule="create-alert-rule",F.ViewAlertRule="view-alert-rule",F.UpdateAlertRule="update-alert-rule",F.DeleteAlertRule="delete-alert-rule",F.ExportGrafanaManagedRules="export-grafana-managed-rules",F.ReadConfigurationStatus="read-configuration-status",F.CreateExternalAlertRule="create-external-alert-rule",F.ViewExternalAlertRule="view-external-alert-rule",F.UpdateExternalAlertRule="update-external-alert-rule",F.DeleteExternalAlertRule="delete-external-alert-rule",F))(d||{});const D=!0,b=!1,E=()=>({"create-alert-rule":U(D,l.AccessControlAction.AlertingRuleCreate),"view-alert-rule":U(D,l.AccessControlAction.AlertingRuleRead),"update-alert-rule":U(D,l.AccessControlAction.AlertingRuleUpdate),"delete-alert-rule":U(D,l.AccessControlAction.AlertingRuleDelete),"export-grafana-managed-rules":U(D,l.AccessControlAction.AlertingRuleRead),"read-configuration-status":[D,n.TP.hasPermission(l.AccessControlAction.AlertingInstanceRead)||n.TP.hasPermission(l.AccessControlAction.AlertingNotificationsRead)],"create-external-alert-rule":U(D,l.AccessControlAction.AlertingRuleExternalWrite),"view-external-alert-rule":U(D,l.AccessControlAction.AlertingRuleExternalRead),"update-external-alert-rule":U(D,l.AccessControlAction.AlertingRuleExternalWrite),"delete-external-alert-rule":U(D,l.AccessControlAction.AlertingRuleExternalWrite)}),v=F=>E()[F];function C(F,M){const H=R(F);return(0,t.useMemo)(()=>H[M],[H,M])}function S(F,M){const H=R(F);return useMemo(()=>M.map(_=>H[_]),[H,M])}function O(F,M,H){const _=T(F,M);return(0,t.useMemo)(()=>_[H],[_,H])}function I(F,M,H){const _=T(F,M);return useMemo(()=>H.map(Z=>_[Z]),[_,H])}function R(F){const M=(0,i.EV)(F.namespace.rulesSource),{isEditable:H,isRemovable:_,isRulerAvailable:Z=!1,loading:ne}=(0,c.g)(M,F.rulerRule),[te,Y]=v("export-grafana-managed-rules"),Q=N(F.rulerRule);return(0,t.useMemo)(()=>{const q=p.p.grafana.rule(F.rulerRule)&&!!F.rulerRule.grafana_alert.provenance,X=(0,p.YN)(F.group),se=p.p.grafana.rule(F.rulerRule),oe=(0,p.Tm)(F.rulerRule),ae=q||X||oe,ie=ne?b:Z,fe=ae?b:ie,pe=oe?b:ie,de=(0,u.Wd)(M);return{"duplicate-alert-rule":U(pe,de.create),"view-alert-rule":U(D,de.read),"update-alert-rule":[fe,H??!1],"delete-alert-rule":[fe,_??!1],"explore-alert-rule":U(D,l.AccessControlAction.DataSourcesExplore),"silence-alert-rule":Q,"modify-export-rule":[se,Y],"pause-alert-rule":[fe&&se,H??!1],"restore-alert-rule":[fe&&se,H??!1],"delete-alert-rule-permanently":[fe&&se,(_&&(0,g.qc)())??!1]}},[F,ne,Z,H,_,M,Y,Q])}function T(F,M){const H=(0,x.rO)(M),{isEditable:_,isRemovable:Z,isRulerAvailable:ne=!1,loading:te}
163=(0,c.g)(H,F),[Y,Q]=v("export-grafana-managed-rules"),J=N(F);return(0,t.useMemo)(()=>{const X=p.p.grafana.rule(F)&&!!F.grafana_alert.provenance,se=!1,oe=p.p.grafana.rule(F),ae=(0,p.Tm)(F),ie=X||se||ae,fe=te?b:ne,pe=ie?b:fe,de=ae?b:fe,le=(0,u.Wd)(H);return{"duplicate-alert-rule":U(de,le.create),"view-alert-rule":U(D,le.read),"update-alert-rule":[pe,_??!1],"delete-alert-rule":[pe,Z??!1],"explore-alert-rule":U(D,l.AccessControlAction.DataSourcesExplore),"silence-alert-rule":J,"modify-export-rule":[oe,Q],"pause-alert-rule":[pe&&oe,_??!1],"restore-alert-rule":[pe&&oe,_??!1],"delete-alert-rule-permanently":[pe&&oe,(Z&&(0,g.qc)())??!1]}},[F,te,ne,H,_,Z,J,Q])}function L(){const{selectedAlertmanager:F,hasConfigurationAPI:M,isGrafanaAlertmanager:H}=(0,h.VI)(),_=(0,u.lV)(F),Z=(0,u.jy)(F);return{"view-external-configuration":U(D,l.AccessControlAction.AlertingNotificationsExternalRead),"update-external-configuration":U(M,l.AccessControlAction.AlertingNotificationsExternalWrite),"create-contact-point":U(M,_.create,...H?[l.AccessControlAction.AlertingReceiversCreate]:[]),"view-contact-point":U(D,_.read,...H?r.PE:[]),"edit-contact-points":U(M,_.update,...H?[l.AccessControlAction.AlertingReceiversWrite]:[]),"delete-contact-point":U(M,_.delete,...H?[l.AccessControlAction.AlertingReceiversWrite]:[]),"export-contact-point":[H,H],"create-notification-template":U(M,_.create,...H?[l.AccessControlAction.AlertingTemplatesWrite]:[]),"view-notification-template":U(D,_.read,...H?[l.AccessControlAction.AlertingTemplatesRead]:[]),"edit-notification-template":U(M,_.update,...H?[l.AccessControlAction.AlertingTemplatesWrite]:[]),"delete-notification-template":U(M,_.delete),"create-notification-policy":U(M,_.create,...H?s.nv:[]),"view-notification-policy-tree":U(D,_.read,...H?s.rw:[]),"update-notification-policy-tree":U(M,_.update,...H?s.nv:[]),"delete-notification-policy":U(M,_.delete,...H?s.nv:[]),"export-notification-policies":U(H,_.read),"decrypt-secrets":U(H,_.provisioning.readSecrets),"view-autogenerated-policy-tree":[H,(0,g.qc)()],"create-silence":U(D,Z.create),"view-silence":U(D,Z.read),"update-silence":U(D,Z.update),"preview-silenced-alerts":U(D,Z.read),"create-mute-timing":U(M,_.create,...H?o.Zr:[]),"view-mute-timing":U(D,_.read,...H?o.xK:[]),"update-mute-timing":U(M,_.update,...H?o.Zr:[]),"delete-mute-timing":U(M,_.delete,...H?o.Zr:[]),"export-mute-timings":U(H,_.read),"view-alert-groups":U(D,Z.read)}}function K(F){const M=L();return(0,t.useMemo)(()=>M[F],[M,F])}function A(F){const M=L();return(0,t.useMemo)(()=>F.map(H=>M[H]),[M,F])}const{useGetGrafanaAlertingConfigurationStatusQuery:W}=f.m;function N(F){const M=p.p.grafana.rule(F)?F.grafana_alert.namespace_uid:void 0,{loading:H,folder:_}=(0,m.a)(M),Z=F&&p.p.grafana.rule(F),ne=p.p.grafana.recordingRule(F),te=j(),Y=w(M);return F?!Z||ne||H||!_?[!1,!1]:[te,Y]:[!1,!1]}function w(F){const H=V(F)[l.AccessControlAction.AlertingSilenceCreate]??!1;return n.TP.hasPermission(l.AccessControlAction.AlertingInstanceCreate)||H}function j(){const{currentData:F,isLoading:M}=W(void 0),H=F?.alertmanagersChoice===a.nA.External,_=F?.alertmanagersChoice===a.nA.All;return M?!1:!H||_}function V(F){const{folder:M}=(0,m.a)(F);return M?.accessControl??{}}const U=(F,...M)=>[F,M.some(H=>H&&n.TP.hasPermission(H))]},93395:(ee,B,e)=>{"use strict";e.d(B,{W:()=>r});var t=e(96540),n=e(52161);function r(o){return(0,t.useMemo)(()=>(0,n.sq)(o),[o])}},55096:(ee,B,e)=>{"use strict";e.d(B,{g:()=>o});var t=e(96540),n=e(36580),r=e(78282);function o(s){return{allDataSourcesAvailable:(0,t.useMemo)(()=>s.filter(a=>!(0,n.s9)(a.datasourceUid)).every(a=>!!(0,r.l)().getInstanceSettings(a.datasourceUid)),[s])}}},80218:(ee,B,e)=>{"use strict";e.d(B,{Gz:()=>h,VP:()=>f,Yb:()=>o,bJ:()=>m});var t=e(74848),n=e(96540),r=e(77256);function o(i,x){const[g,p]=(0,n.useState)({status:"not-executed",error:void 0,result:x}),c=(0,n.useRef)(),y=(0,n.useRef)(),P=s({execute(...d){y.current=d;const D=i(...d);return c.current=D,p(b=>({...b,status:"loading"})),D.then(b=>{D===c.current&&p(E=>({...E,status:"success",error:void 0,result:b}))},b=>{D===c.current&&p(E=>({...E,status:"error",error:b}))}),D},reset(){p({status:"not-executed",error:void 0,result:x}),c.current=void 0,y.current=void 0}});return[(0,n.useMemo)(()=>({reset(){P.current.reset()},execute:(...d)=>P.current.execute(...d)}),[]),g,{promise:c.current,lastArgs:y.current}]}function s(i){const x=(0,n.useRef)(i);return x.current=i,(0,n.useMemo)(()=>Object.freeze({get current(){return x.current}}),[])}function m(i){return i.status==="error"}function a(i){return i.status==="success"}function l(i){return i.status==="not-executed"}function f(i){return i.status==="loading"}function h(...i){return{uninitialized:i.every(l),loading:i.some(f),error:i.find(m)?.error,success:i.some(a)}}function u({state:i}){return jsxs(Fragment,{children:[l(i)&&"uninitialized",f(i)&&"loading",a(i)&&"success",a(i)&&`result: ${JSON.stringify(i.result,null,2)}
163`,m(i)&&`error: ${stringifyErrorLike(i.error)}`]})}},44109:(ee,B,e)=>{"use strict";e.d(B,{FY:()=>g,Ll:()=>c,O3:()=>y,ZU:()=>x,we:()=>i});var t=e(10378),n=e(96540),r=e(16817),o=e(52161),s=e(70327),m=e(55143),a=e(67598),l=e(94646),f=e(29609),h=e(23265),u=e(18404);function i(P,d,D){const b=(0,o.oh)(d),{dsFeatures:E,isLoadingDsFeatures:v}=y(d),{currentData:C,isLoading:S,error:O}=s.hK.endpoints.prometheusRuleNamespaces.useQuery({ruleSourceName:d,ruleName:P,namespace:D?.namespace,groupName:D?.groupName}),[I]=s.hK.endpoints.getRuleGroupForNamespace.useLazyQuery(),{loading:R,error:T,value:L}=(0,r.A)(async()=>{if(!b)throw new Error("Unable to obtain data source settings");if(O)throw new Error("Unable to obtain Prometheus rules");const K=C||[],A=[];if(E?.rulerConfig){const w=E.rulerConfig,j=K.map(V=>V.groups.map(U=>({namespace:V,group:U}))).flat();await Promise.allSettled(j.map(async V=>{const U=await I({rulerConfig:w,namespace:V.namespace.name,group:V.group.name}).unwrap();A.push(U)}))}return K.map(w=>(0,h.O6)(b,w,A)).flatMap(w=>w.groups.flatMap(j=>j.rules))},[b,E,S,O,C,I]);return{loading:v||R,error:T,rules:L}}function x({ruleIdentifier:P,limitAlerts:d}){const{ruleSourceName:D}=P,b=p(P),{dsFeatures:E,isLoadingDsFeatures:v}=y(D),{loading:C,error:S,result:O}=g(P),{currentData:I=[],isLoading:R,error:T}=s.hK.endpoints.prometheusRuleNamespaces.useQuery({ruleSourceName:P.ruleSourceName,namespace:O?.namespace,groupName:O?.group,ruleName:O?.ruleName,limitAlerts:d},{skip:!O||C,refetchOnMountOrArgChange:!0}),L=(0,o.z2)(D),K=(0,u.a)(L?O?.namespace:void 0),A=L&&K.folder?(0,u.W)(K.folder):O?.namespace,[W,{currentData:N,isLoading:w,error:j}]=s.hK.endpoints.getRuleGroupForNamespace.useLazyQuery();(0,n.useEffect)(()=>{!E?.rulerConfig||!O||W({rulerConfig:E.rulerConfig,namespace:O.namespace,group:O.group})},[E,W,O]);const V=(0,n.useMemo)(()=>{if(!b||!O)return;const U=N&&A?{[A]:[N]}:{};return(0,h.gt)(b,I,U).flatMap(_=>_.groups).flatMap(_=>_.rules).find(_=>l.LC(l.UP(D,_),P))},[P,D,I,N,b,O,A]);return{loading:C||v||R||w,error:S??T??j,result:V}}function g(P){const d=(0,f.A4)(P)&&P.uid!==""?{uid:P.uid}:t.hT,{isLoading:D,currentData:b,error:E,isUninitialized:v}=s.hK.endpoints.getAlertRule.useQuery(d,{refetchOnMountOrArgChange:!0});return(0,n.useMemo)(()=>{if((0,f.Mj)(P)||(0,f.X4)(P))try{return{result:{datasource:P.ruleSourceName,namespace:P.namespace,group:P.groupName,ruleName:P.ruleName,groupIdentifier:a.HA.fromRuleIdentifier(P)},loading:!1}}catch(C){return{loading:!1,error:C}}return(0,f.A4)(P)?D||v?{loading:!0}:E?{loading:!1,error:E}:b?{result:{datasource:P.ruleSourceName,namespace:b.grafana_alert.namespace_uid,group:b.grafana_alert.rule_group,ruleName:b.grafana_alert.title,groupIdentifier:{namespace:{uid:b.grafana_alert.namespace_uid},groupName:b.grafana_alert.rule_group,groupOrigin:"grafana"}},loading:!1}:{loading:!1,error:new Error(`Unable to obtain rule location for rule ${P.uid}`)}:{loading:!1,error:new Error("Unsupported rule identifier")}},[P,D,v,E,b])}function p(P){return(0,f.A4)(P)?"grafana":(0,o.oh)(P.ruleSourceName)}function c({ruleIdentifier:P}){const d=p(P),{data:D,isLoading:b}=m.L.endpoints.discoverDsFeatures.useQuery({rulesSourceName:P.ruleSourceName}),{loading:E,error:v,result:C}=g(P),[S,{currentData:O,isLoading:I,isUninitialized:R,error:T}]=s.hK.endpoints.getRuleGroupForNamespace.useLazyQuery();(0,n.useEffect)(()=>{!D?.rulerConfig||!C||S({rulerConfig:D.rulerConfig,namespace:C.namespace,group:C.group})},[D,S,C]);const L=(0,n.useMemo)(()=>{const{ruleSourceName:K}=P;if(!O||!d||!C)return;const A=O.rules.find(W=>{const N=l.P1(K,C.namespace,C.group,W);return l.LC(N,P)});if(A)return{ruleSourceName:K,group:O,namespace:C.namespace,rule:A}},[P,O,d,C]);return{loading:E||b||I||R,error:v??T,result:L}}function y(P){const{currentData:d,isLoading:D}=m.L.endpoints.discoverDsFeatures.useQuery({rulesSourceName:P});return{isLoadingDsFeatures:D,dsFeatures:d}}},23265:(ee,B,e)=>{"use strict";e.d(B,{Jr:()=>P,NW:()=>v,O6:()=>p,Tj:()=>C,Ug:()=>E,dy:()=>x,gt:()=>g,kU:()=>L,yh:()=>c});var t=e(2543),n=e.n(t),r=e(96540),o=e(86791),s=e(24619),m=e(70327),a=e(55143),l=e(95443),f=e(52161),h=e(94646),u=e(29609),i=e(98127);function x(A,W){const N=(0,i.$)(U=>
163U.promRules),w=(0,i.$)(U=>U.rulerRules),j=(0,r.useRef)({}),V=(0,r.useMemo)(()=>{if(A){const U=(0,f.Zw)(A);if(!U)throw new Error(`Unknown rules source: ${A}`);return[U]}return(0,f.lS)()},[A]);return(0,r.useMemo)(()=>V.map(U=>{const F=(0,f.Eb)(U)?U.name:U,M=w[F]?.result;let H=N[F]?.result;F===f.hY&&W&&(H=W);const _=j.current[F];if(_&&_.promRules===H&&_.rulerRules===M)return _.result;const Z={};Object.entries(M||{}).forEach(([te,Y])=>{const Q={rulesSource:U,name:te,groups:[]};u.p.grafana.rule(Y[0].rules[0])&&(Q.uid=Y[0].rules[0].grafana_alert.namespace_uid),Z[te]=Q,D(Q,Y)}),H?.forEach(({name:te,groups:Y})=>{const Q=Z[te]=Z[te]||{rulesSource:U,name:te,groups:[]};b(Q,Y)});const ne=Object.values(Z);return j.current[F]={promRules:H,rulerRules:M,result:ne},ne}).flat(),[N,w,V,W])}function g(A,W,N){const w={};return Object.entries(N||{}).forEach(([j,V])=>{const U={rulesSource:A,name:j,groups:[]};w[j]=U,D(U,V)}),W?.forEach(({name:j,groups:V})=>{const U=w[j]=w[j]||{rulesSource:A,name:j,groups:[]};b(U,V)}),Object.values(w)}function p(A,W,N){const w={rulesSource:A,name:W.name,groups:[]};return D(w,N),b(w,W.groups),w.groups.forEach(j=>{j.rules=j.rules.filter(V=>V.promRule)}),w}function c(A,W){if(!A.promRule)return;const w=W.rules.map(V=>I(V,A.namespace,A.group)).reduce((V,U)=>{const F=V.get(K(U));return F?F.push(U):V.set(K(U),[U]),V},new Map),j=R(A.promRule,w,A.namespace.rulesSource);j&&(A.rulerRule=j.rulerRule,A.query=j.query,A.labels=j.labels,A.annotations=j.annotations)}function y(A,W,N){return D(A,N),b(A,W),A}function P(A){return A.map(W=>{const N={...W,groups:[]};return N.groups.push({name:"default",rules:d(W.groups.flatMap(w=>w.rules)),totals:S(W.groups)}),N})}function d(A){return A.sort((W,N)=>W.name.localeCompare(N.name))}function D(A,W=[]){A.groups=W.map(N=>{const w=N.rules.filter(U=>u.p.any.recordingRule(U)).length,j=N.rules.filter(U=>u.p.grafana.alertingRule(U)&&(0,u.hC)(U)).length,V={name:N.name,interval:N.interval,source_tenants:N.source_tenants,rules:[],totals:{paused:j,recording:w}};return V.rules=N.rules.map(U=>I(U,A,V)),V})}function b(A,W){const N=new Map;A.groups.forEach(w=>N.set(w.name,w)),W.forEach(w=>{let j=N.get(w.name);j||(j={name:w.name,rules:[],totals:C(w)},A.groups.push(j),N.set(w.name,j)),j.totals={...j.totals,...C(w)};const V=new Map;
163j.rules.forEach(U=>{const F=V.get(K(U));F?F.push(U):V.set(K(U),[U])}),(w.rules??[]).forEach(U=>{const F=R(U,V,A.rulesSource);F?(F.promRule=U,F.instanceTotals=u.R$.alertingRule(U)?E(U):{},F.filteredInstanceTotals=u.R$.alertingRule(U)?v(U):{}):j.rules.push(O(U,A,j))})})}function E(A){const W=(0,t.countBy)(A.alerts,"state");if(A.totals){const{normal:N,...w}=A.totals;return{...w,inactive:N}}return{alerting:W[o.$7.Alerting]||W.firing,pending:W[o.$7.Pending],recovering:W[o.$7.Recovering],inactive:W[o.$7.Normal],nodata:W[o.$7.NoData],error:W[o.$7.Error]||W.err||void 0}}function v(A){if(A.totalsFiltered){const{normal:W,...N}=A.totalsFiltered;return{...N,inactive:W}}return{}}function C(A){if(A.totals){const{firing:j,...V}=A.totals;return{...V,alerting:j}}const W=(0,t.countBy)(A.rules,j=>u.R$.alertingRule(j)&&j.state),N=(0,t.countBy)(A.rules,j=>j.health),w=A.rules.filter(j=>u.R$.recordingRule(j)).length;return{alerting:W[s.cF.Firing],error:N.error,nodata:N.nodata,inactive:W[s.cF.Inactive],pending:W[s.cF.Pending],recovering:W[s.cF.Recovering],recording:w}}function S(A){const W={};return A.forEach(N=>{const w=N.totals;Object.entries(w).forEach(([j,V])=>{W[j]||(W[j]=0),V!=null&&(W[j]+=V)})}),W}function O(A,W,N){return{name:A.name,query:A.query,labels:A.labels||{},annotations:u.R$.alertingRule(A)?(0,u.Rh)(A):{},promRule:A,namespace:W,group:N,instanceTotals:u.R$.alertingRule(A)?E(A):{},filteredInstanceTotals:u.R$.alertingRule(A)?v(A):{}}}function I(A,W,N){return u.p.dataSource.alertingRule(A)?{name:A.alert,query:A.expr,labels:A.labels||{},annotations:A.annotations||{},rulerRule:A,namespace:W,group:N,instanceTotals:{},filteredInstanceTotals:{},uid:u.p.grafana.rule(A)?A.grafana_alert.uid:void 0}:u.p.dataSource.recordingRule(A)?{name:A.record,query:A.expr,labels:A.labels||{},annotations:{},rulerRule:A,namespace:W,group:N,instanceTotals:{},filteredInstanceTotals:{},uid:u.p.grafana.rule(A)?A.grafana_alert.uid:void 0}:{name:A.grafana_alert.title,query:"",labels:A.labels||{},annotations:A.annotations||{},rulerRule:A,namespace:W,group:N,instanceTotals:{},filteredInstanceTotals:{},uid:u.p.grafana.rule(A)?A.grafana_alert.uid:void 0}}function R(A,W,N){const w=K(A),j=W.get(w);if(!j)return;if((0,f.z2)(N))return j[0];const V=j.find(F=>!F.promRule&&T(F,A,!0));if(V)return V;const U=j.find(F=>!F.promRule&&T(F,A,!1));if(U)return U}function T(A,W,N=!0){const w=u.R$.alertingRule(W)?(0,u.Rh)(W):{},j=W.labels??{},V=N?(0,h.h1)(W.query):"",U=A.annotations,F=A.labels,M=N?(0,h.h1)(A.query):"";return A.name===W.name?(0,t.isEqual)([M,F,U],[V,j,w]):!1}function L(A,W,N){const w=!A,{currentData:j,isLoading:V,error:U}=m.hK.endpoints.prometheusRuleNamespaces.useQuery({ruleSourceName:f.hY,dashboardUid:A??void 0,panelId:W},{skip:w,pollingInterval:N?l.HH:void 0}),{currentData:F,isLoading:M,error:H}=m.hK.endpoints.rulerRules.useQuery({rulerConfig:a.b,filter:{dashboardUID:A??void 0,panelId:W}},{pollingInterval:N?l.HH:void 0,skip:w}),_=(0,r.useRef)({}),Z=(0,f.Zw)(f.hY),ne=(0,r.useMemo)(()=>{if(!Z)return[];const te=_.current[f.hY];if(te&&te.promRules===j&&te.rulerRules===F)return te.result;const Y={};Object.entries(F||{}).forEach(([J,q])=>{const X={rulesSource:Z,name:J,groups:[]};u.p.grafana.rule(q[0].rules[0])&&(X.uid=q[0].rules[0].grafana_alert.namespace_uid),Y[J]=X,D(X,q)}),j?.forEach(({name:J,groups:q})=>{const X=Y[J]=Y[J]||{rulesSource:Z,name:J,groups:[]};b(X,q)});const Q=Object.values(Y);return _.current[f.hY]={promRules:j,rulerRules:F,result:Q},Q},[j,F,Z]);return{loading:V||M,error:U??H,result:ne}}function K(A){return A.uid?A.uid??"":A.name}},96784:(ee,B,e)=>{"use strict";e.d(B,{dI:()=>E,i7:()=>v});var t=e(84139),n=e(1932),r=e(2543),o=e.n(r),s=e(96540),m=e(78282),a=e(24619),l=e(74268),f=e(56369),h=e(86017),u=e(95443),i=e(52161),x=e(63895),g=e(29609),p=e(23265),c=e(20962);const y=25,P=1/0,d=5,D=/[^ -~]/m,b=/^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+$/m;function E(){const[L,K]=(0,c.l)(),A=L.get("search")??"",W=(0,s.useMemo)(()=>(0,f.XY)(A),[A]),N=(0,s.useMemo)(()=>Object.values(W).some(V=>!(0,r.isEmpty)(V)),[W]),w=(0,s.useCallback)(V=>{const U=(0,f.kL)(A,V);K({search:U})},[A,K]),j=(0,s.useCallback)(V=>{K({search:V})},[K]);return(0,s.useEffect)(()=>{const V={dataSource:L.get("dataSource")??void 0,alertState:L.get("alertState")??void 0,ruleType:L.get("ruleType")??void 0,labels:(0,x.S6)(L.get("queryString")??"").map(h.MU)};Object.values(V).some(F=>!(0,r.isEmpty)(F))&&(K({dataSource:void 0,alertState:void 0,ruleType:void 0,queryString:void 0}),w((0,n.jM)(W,F=>{if(F.dataSourceNames??=V.dataSource?[V.dataSource]:[],V.alertState&&(0,a.Si)(V.alertState)&&(F.ruleState??=V.alertState),V.ruleType&&(0,g.nf)(V.ruleType)&&(F.ruleType??=V.ruleType),F.labels.length===0&&V.labels.length>0){const M=V.labels.map(({name:H,operator:_,value:Z})=>`${H}${_}${Z}`);F.labels.push(...M)}})))},[L,w,W,K]),{filterState:W,hasActiveFilters:N,searchQuery:A,setSearchQuery:j,updateFilters:w}}const v=(L,K)=>{const A=(0,s.useDeferredValue)(L),W=(0,s.useDeferredValue)(K);return(0,s.useMemo)(()=>{const N=C(A,W);
163return N.forEach(w=>{w.groups.forEach(j=>{j.rules.forEach(V=>{g.R$.alertingRule(V.promRule)&&(V.instanceTotals=(0,p.Ug)(V.promRule),V.filteredInstanceTotals=(0,p.NW)(V.promRule))}),j.totals=(0,p.Tj)({rules:j.rules.map(V=>V.promRule).filter(V=>!!V)})})}),N},[A,W])},C=(L,K={dataSourceNames:[],labels:[],freeFormWords:[]})=>{let A=L;const W=K.dataSourceNames;W.length&&(A=A.filter(({rulesSource:j})=>(0,i.Eb)(j)?W.includes(j.name):!0));const N=K.namespace;N&&(A=R(A,j=>j.name,N));const w=[];try{A.reduce(S(K),[]).forEach(V=>{w.push(V)})}catch(j){(0,l.vV)(new Error("Failed to filter rules",{cause:j}),{search:JSON.stringify(K)})}return w},S=L=>(K,A)=>{const W=L.groupName;let N=A.groups;return W&&(N=R(N,w=>w.name,W)),N=N.reduce(O(L),[]),N.length&&K.push({...A,groups:N}),K},O=L=>{const K=L.ruleName??L.freeFormWords.join(" ");return(A,W)=>{let N=W.rules;return K&&(N=R(N,w=>w.name,K)),N=N.filter(w=>{const j=w.promRule,V=(0,r.chain)(L).pick(["ruleType","dataSourceNames","ruleHealth","labels","ruleState","dashboardUid","plugins","contactPoint"]).omitBy(r.isEmpty).mapValues(()=>!1).value();if("ruleType"in V&&L.ruleType===j?.type&&(V.ruleType=!0),"plugins"in V&&L.plugins==="hide"&&(V.plugins=w.rulerRule&&!(0,g.Tm)(w.rulerRule)),"contactPoint"in V){const U=L.contactPoint;g.p.grafana.rule(w.rulerRule)&&w.rulerRule.grafana_alert.notification_settings?.receiver===U&&(V.contactPoint=!0)}if("dataSourceNames"in V&&(g.p.grafana.rule(w.rulerRule)?T(w.rulerRule,L)&&(V.dataSourceNames=!0):V.dataSourceNames=!0),"ruleHealth"in L&&j){const U=(0,g.f6)(j.health);L.ruleHealth===U&&(V.ruleHealth=!0)}if("labels"in V){const U=(0,r.compact)(L.labels.map(I)),F=U.length>0&&(0,h.Av)(w.labels,U),M=U.length>0&&j&&j.type===a.JS.Alerting&&j.alerts&&j.alerts.some(H=>(0,h.Av)(H.labels,U));(F||M)&&(V.labels=!0)}if("ruleState"in V){const U=w.promRule;U&&g.R$.alertingRule(U)&&U.state===L.ruleState&&(V.ruleState=!0)}return"dashboardUid"in V&&w.annotations[u.YH.dashboardUID]===L.dashboardUid&&(V.dashboardUid=!0),Object.values(V).every(U=>U===!0)}),N.length&&A.push({...W,rules:N}),A}};function I(L){try{return(0,x.qR)(L)}catch{return{name:L,value:"",isRegex:!0,isEqual:!0}}}function R(L,K,A){let W=L;const N=new t.A({intraMode:1}),w=N.split(A).length;if(D.test(A)||b.test(A)||A.length>y||w>d)return L.filter(_=>K(_).toLowerCase().includes(A.toLowerCase()));const V=L.map(K),U=w<5?4:0,[F,M,H]=N.search(V,A,U,P);return M&&H?W=H.map(_=>W[M.idx[_]]):F&&(W=F.map(_=>W[_])),W}const T=(L,K)=>K.dataSourceNames?.length?!!L.grafana_alert.data.find(A=>{if(!A.datasourceUid)return!1;const W=(0,m.l)().getInstanceSettings(A.datasourceUid);return W?.name&&K?.dataSourceNames?.includes(W.name)}):!0},18404:(ee,B,e)=>{"use strict";e.d(B,{W:()=>o,a:()=>r});var t=e(10378),n=e(15203);function r(m){const a=(0,n.kH)(m||t.hT);return{loading:a.isLoading,folder:a.data}}function o({title:m,parents:a}){return a&&a?.length?[...a.map(l=>l.title),m].map(s).join("/"):s(m)}function s(m){return m.replaceAll("/","\\/")}},11940:(ee,B,e)=>{"use strict";e.d(B,{w:()=>s,y:()=>o});var t=e(55143),n=e(52161);const{useDiscoverDsFeaturesQuery:r}=t.L;function o(m){const a=(0,n.EV)(m),{currentData:l}=r({rulesSourceName:a});return{hasRuler:!!l?.rulerConfig,rulerConfig:l?.rulerConfig}}function s(m){const{currentData:a}=r({uid:m.uid});return{hasRuler:!!a?.rulerConfig,rulerConfig:a?.rulerConfig}}},12770:(ee,B,e)=>{"use strict";e.d(B,{g:()=>m});var t=e(15130),n=e(55143),r=e(54),o=e(29609),s=e(18404);function m(a,l){const{currentData:f,isLoading:h,error:u}=n.L.endpoints.discoverDsFeatures.useQuery({rulesSourceName:a}),i=l&&o.p.grafana.rule(l)?l.grafana_alert.namespace_uid:void 0,x=(0,r.Wd)(a),{folder:g,loading:p}=(0,s.a)(i);if(u)return{isEditable:!1,isRemovable:!1,loading:!1,isRulerAvailable:!1,error:u};if(!l)return{isEditable:!1,isRemovable:!1,loading:!1};if(o.p.grafana.rule(l)){if(!i)throw new Error(`Rule ${l.grafana_alert.title} does not have a folder uid, cannot determine if it is editable.`);if(!g)return{isRulerAvailable:!0,isEditable:!1,isRemovable:!1,loading:p};const d=t.TP.hasPermissionInMetadata(x.update,g),D=t.TP.hasPermissionInMetadata(x.delete,g);return{isRulerAvailable:!0,isEditable:d,isRemovable:D,loading:p||h}}const c=!!f?.rulerConfig,y=t.TP.hasPermission(x.update),P=t.TP.hasPermission(x.delete);return{isRulerAvailable:c,isEditable:y&&c,isRemovable:P&&c,loading:h}}},74048:(ee,B,e)=>{"use strict";e.d(B,{W:()=>o});var t=e(2543),n=e.n(t),r=e(96540);function o(s,m=1,a){const[l,f]=(0,r.useState)(m),h=(0,r.useMemo)(()=>(0,t.chunk)(s,a),[s,a]),u=h.length,i=h[l-1]??[],x=(l-1)*a+1,g=(0,t.clamp)(l*a,s.length),p=(0,r.useCallback)(P=>{f((0,t.clamp)(P,1,h.length))},[f,h]),c=(0,r.useCallback)(()=>p(l+1),[l,p]),y=(0,r.useCallback)(()=>p(l-1),[l,p]);return(0,r.useEffect)(()=>f(1),[u]),{page:l,onPageChange:p,numberOfPages:u,pageItems:i,pageStart:x,pageEnd:g,nextPage:c,previousPage:y}}},21764:(ee,B,e)=>{"use strict";e.d(B,{S:()=>n});var t=e(23265);function n({dashboardUID:r,panelId:o,poll:s=!1}){const{result:m,loading:a,error:l}=(0,t.kU)(r,o,s);return{rules:m?m.flatMap(h=>h.groups).flatMap(h=>h.rules):[],errors:l?[l]:[],loading:a}}},3986:(ee,B,e)=>{"use strict";e.d(B,{_:()=>r});var t=e(16817),n=e(95027);function r(o){const{loading:s,error:m,value:a}=(0,t.A)(()=>(0,n.x)(o,{showErrorAlert:!1})),l=a&&!m&&!s,f=a?.enabled;return s&&!a?{loading:!0}:!l||!f?{loading:!1,installed:!1}:{loading:s,installed:!0,settings:a}}},43100:(ee,B,e)=>{"use strict";e.d(B,{d:()=>g});var t=e(34632),n=e(91984),r=e(72748),o=e(78045),s=e(55614),m=e(15518),a=e(5358);function l(...p){return{error:p.find(c=>c.error),isUninitialized:p.every(c=>c.isUninitialized),isSuccess:p.every(c=>c.isSuccess),isError:p.some(c=>c.isError),isLoading:p.some(c=>c.isLoading)}}const f=new Error("no active Alertmanager"),{useLazyGetAlertmanagerConfigurationQuery:h,useUpdateAlertmanagerConfigurationMutation:u}=n.m,i={alertmanager_config:{receivers:[],route:{},time_intervals:[],mute_time_intervals:[],inhibit_rules:[],templates:[]},template_files:{}},x=(0,t.A)(i,r.f1,m.NF,s.r0,o.B8);function g(){const{selectedAlertmanager:p}=(0,a.VI)(),[c,y]=h(),[P,d]=u(),D=l(y,d);if(!p)throw f;return[async E=>{const v=await c(p).unwrap(),C=x(v,E);return P({selectedAlertmanager:p,config:C}).unwrap()},D]}},80276:(ee,B,e)=>{"use strict";e.d(B,{IH:()=>E,zx:()=>b});var t=e(2543),n=e.n(t),r=e(96540),o=e(86791),s=e(74268),m=e(70327),a=e(55143),l=e(94646),f=e(29609),h=e(80218);const{useLazyPrometheusRuleNamespacesQuery:u,useLazyGetRuleGroupForNamespaceQuery:i}=m.hK,{useLazyDiscoverDsFeaturesQuery:x}=a.L,g=3*1e3,p=90*1e3,{setInterval:c,clearInterval:y}=window;function P(){const[C]=u();return{matchingPromRuleExists:(0,r.useCallback)(async O=>{const{ruleSourceName:I,namespace:R,groupName:T,ruleName:L}=O;return(await C({ruleSourceName:I,namespace:R,groupName:T,ruleName:L}).unwrap()).find(N=>N.name===R)?.groups.find(N=>N.name===T)?.rules.some(N=>{const w=l.Lg(I,R,T,N);return l.LC(w,O)})??!1},[C])}}const d=!0;function D(){const[C]=x(),[S]=u(),[O]=i();return{isGroupInSync:(0,r.useCallback)(async R=>{const T=R.groupOrigin==="datasource"?R.rulesSource.uid:o.l$,L=await C({uid:T},d).unwrap();if(!L.rulerConfig)throw new Error("Datasource does not support ruler. Unable to determine group consistency");const K=R.groupOrigin==="datasource"?R.namespace.name:R.namespace.uid,A={ruleSourceName:L.name,namespace:K,groupName:R.groupName,limitAlerts:0,excludeAlerts:!0},W={namespace:K,group:R.groupName,rulerConfig:L.rulerConfig,notificationOptions:{showSuccessAlert:!1,showErrorAlert:!1}}
163,[N,w]=await Promise.allSettled([S(A).unwrap(),O(W).unwrap()]);if(N.status==="rejected"&&w.status==="rejected")return(0,s.vV)(new Error("Error fetching Prometheus and Ruler rule groups",{cause:[N.reason,w.reason]})),!0;if(N.status==="rejected"&&w.status==="fulfilled")return(0,s.vV)(new Error("Error fetching Prometheus rule groups",{cause:N.reason})),!0;if(w.status==="rejected"&&N.status==="fulfilled")return N.value.flatMap(V=>V.groups).every(V=>V.name!==R.groupName);if(N.status==="fulfilled"&&w.status==="fulfilled"){const j=N.value.flatMap(U=>U.groups).find(U=>U.name===R.groupName),V=w.value;if(j&&V){if(!(j.rules.length===V.rules.length))return!1;const F=j.rules.map(H=>H.name),M=V.rules.map(f.qz);for(const[H,_]of(0,t.zip)(F,M))if(H!==_)return!1;return!0}}return!1},[C,S,O])}}function b(){const{isGroupInSync:C}=D(),[S,O]=(0,r.useState)(),I=(0,r.useRef)();(0,r.useEffect)(()=>()=>{R()},[]);const R=()=>{I.current&&(clearTimeout(I.current),I.current=void 0)};async function T(L){R();const K=new Promise((W,N)=>{setTimeout(()=>{R();const w=new Error("Timeout while waiting for rule group consistency");(0,s.vV)(w,{groupOrigin:L.groupOrigin}),N(w)},p)}),A=new Promise((W,N)=>{function w(){performance.mark("waitForGroupConsistency:finished");const V=performance.measure("waitForGroupConsistency","waitForGroupConsistency:started","waitForGroupConsistency:finished");(0,s.l$)("alerting:wait-for-group-consistency",{duration:V.duration},{groupOrigin:L.groupOrigin})}function j(){C(L).then(V=>{O(V),V?(w(),R(),W()):I.current=setTimeout(j,g)}).catch(V=>{R(),N(V)})}performance.mark("waitForGroupConsistency:started"),j()});return Promise.race([K,A])}return{waitForGroupConsistency:T,groupConsistent:S}}function E(){const{matchingPromRuleExists:C}=P(),S=(0,r.useRef)(),O=(0,r.useRef)();(0,r.useEffect)(()=>()=>{I(),R()},[]);const I=()=>{S.current&&(y(S.current),S.current=void 0)},R=()=>{O.current&&(y(O.current),O.current=void 0)};async function T(K){I();const A=new Promise((N,w)=>{setTimeout(()=>{I(),w(new Error("Timeout while waiting for rule removal"))},p)}),W=new Promise((N,w)=>{S.current=c(()=>{C(K).then(j=>{j===!1&&(I(),N())}).catch(j=>{I(),w(j)})},g)});return Promise.race([A,W])}async function L(K){R();const A=new Promise((N,w)=>{setTimeout(()=>{R(),w(new Error("Timeout while waiting for rule creation"))},p)}),W=new Promise((N,w)=>{O.current=c(()=>{C(K).then(j=>{j===!0&&(R(),N())}).catch(j=>{R(),w(j)})},g)});return Promise.race([A,W])}return{waitForRemoval:T,waitForCreation:L}}function v(C){const{matchingPromRuleExists:S}=P(),{waitForCreation:O}=E(),[I,R]=useAsync(async T=>isCloudRuleIdentifier(T)?O(T):Promise.resolve());return useEffect(()=>{isCloudRuleIdentifier(C)&&S(C).then(T=>{T||I.execute(C)})},[I,C,S]),{isConsistent:R.status==="success"||R.status==="not-executed",error:R.error}}},39187:(ee,B,e)=>{"use strict";e.d(B,{h:()=>m,w:()=>a});var t=e(63704),n=e(43173),r=e(36490),o=e(74268),s=e(20962);function m(f){const h={returnTo:f},[u]=(0,s.l)(),i=u.get("returnTo");if(!i)return h;const x=t.sQ.sanitizeUrl(i),g=`${window.location.origin}/${n.$.appSubUrl}`,p=l(x,g);if(!p)return(0,o.FF)("Malformed returnTo parameter",{returnTo:i}),h;const{protocol:c,origin:y,pathname:P,search:d}=p;return["http:","https:"].includes(c)===!1||y!==window.location.origin?((0,o.FF)("Malformed returnTo parameter",{returnTo:i}),h):{returnTo:`${P}${d}`}}function a(f=!0){const{pathname:h,search:u}=r.Ny.getLocation();return h+(f?u:"")}function l(f,h){try{return new URL(f,h)}catch{return null}}},58138:(ee,B,e)=>{"use strict";e.d(B,{G:()=>u,Q:()=>h});var t=e(74848),n=e(22803),r=e(96540),o=e(43173),s=e(63142),m=e(22787),a=e(56840);const l=(0,r.lazy)(()=>e.e(2835).then(e.bind(e,32835))),f=(0,r.lazy)(()=>Promise.all([e.e(8706),e.e(4302)]).then(e.bind(e,54302)));var h=(x=>(x.Loki="loki",x.Annotations="annotations",x))(h||{});function u(){const[x,g]=(0,r.useState)(!1),[p,c]=(0,r.useState)(),y=(0,s.of)(i),P=o.$.unifiedAlerting.alertStateHistoryBackend,d=o.$.unifiedAlerting.alertStateHistoryPrimary,b=[P,d].some(S=>S==="loki")?"loki":"annotations",E=(0,r.useCallback)(()=>{c(void 0),g(!1)},[]),v=(0,r.useCallback)(S=>{c(S),g(!0)},[]);return{StateHistoryModal:(0,r.useMemo)(()=>p?(0,t.jsx)(m.a,{isOpen:x,onDismiss:E,closeOnBackdropClick:!0,closeOnEscape:!0,title:(0,a.t)("alerting.use-state-history-modal.state-history-modal.title-state-history","State history"),className:y.modal,contentClassName:y.modalContent,children:(0,t.jsxs)(r.Suspense,{fallback:"Loading...",children:[b==="loki"&&(0,t.jsx)(f,{ruleUID:p.grafana_alert.uid}),b==="annotations"&&(0,t.jsx)(l,{ruleUID:p.grafana_alert.uid??""})]})}
163):null,[p,x,E,b,y]),showStateHistoryModal:v,hideStateHistoryModal:E}}const i=x=>({modal:(0,n.css)({width:"80%",height:"80%",minWidth:"800px"}),modalContent:(0,n.css)({height:"100%",width:"100%",padding:x.spacing(2)})})},20962:(ee,B,e)=>{"use strict";e.d(B,{l:()=>o});var t=e(96540),n=e(54148),r=e(36490);function o(){const{search:s}=(0,n.zy)(),m=(0,t.useMemo)(()=>new URLSearchParams(s),[s]),a=(0,t.useCallback)((l,f)=>{r.Ny.partial(l,f)},[]);return[m,a]}},98127:(ee,B,e)=>{"use strict";e.d(B,{$:()=>r});var t=e(25508),n=e(96673);function r(o,s){return(0,n.useSelector)((0,t.Mz)(m=>m.unifiedAlerting,m=>o(m)),s)}},17305:(ee,B,e)=>{"use strict";e.d(B,{T:()=>a});var t=e(74848),n=e(16817),r=e(99887),o=e(45967),s=e(58851),m=e(95027);function a({pluginId:l,size:f="md"}){const{value:h,loading:u}=(0,n.A)(()=>(0,m.x)(l));if(u||!h)return null;const i=h.info.logos?.small,x=h.name,g=(0,s.cs)(f),p=i?(0,t.jsx)("img",{src:i,alt:x,height:g}):(0,t.jsx)(r.E,{text:l,color:"orange"});return(0,t.jsx)(o.m,{content:`This rule is managed by the ${x} plugin`,children:p})}},72748:(ee,B,e)=>{"use strict";e.d(B,{$8:()=>a,X9:()=>s,f1:()=>f,ov:()=>m});var t=e(65307),n=e(2543),r=e.n(n),o=e(86017);const s=(0,t.VP)("muteTiming/add"),m=(0,t.VP)("muteTiming/update"),a=(0,t.VP)("muteTiming/delete"),l={alertmanager_config:{},template_files:{}},f=(0,t.vy)(l,h=>{h.addCase(s,(u,{payload:i})=>{const{interval:x}=i;u.alertmanager_config.time_intervals=(u.alertmanager_config.time_intervals??[]).concat(x)}).addCase(m,(u,{payload:i})=>{const{interval:x,originalName:g}=i,p=x.name!==g,c=u.alertmanager_config.time_intervals??[],y=u.alertmanager_config.mute_time_intervals??[],P=c.findIndex(({name:D})=>D===g);P!==-1&&(c[P]=x);const d=y.findIndex(({name:D})=>D===g);d!==-1&&(y[d]=x),p&&u.alertmanager_config.route&&(u.alertmanager_config.route=(0,o.$m)(x.name,g,u.alertmanager_config.route))}).addCase(a,(u,{payload:i})=>{const{name:x}=i,{alertmanager_config:g}=u,{time_intervals:p=[],mute_time_intervals:c=[]}=g;(0,n.remove)(p,y=>y.name===x),(0,n.remove)(c,y=>y.name===x),g.route=(0,o._n)(x,g.route??{})})})},78045:(ee,B,e)=>{"use strict";e.d(B,{B8:()=>l,LY:()=>o,Z8:()=>s,tD:()=>m});var t=e(65307),n=e(42824),r=e(67923);const o=(0,t.VP)("routes/update"),s=(0,t.VP)("routes/delete"),m=(0,t.VP)("routes/add"),a={alertmanager_config:{},template_files:{}},l=(0,t.vy)(a,f=>{f.addCase(o,(h,{payload:u})=>{const{update:i,alertmanager:x}=u,{alertmanager_config:g}=h;if(!g.route)return;const p=(0,n.QM)(g.route),c=(0,r.AB)(x,i,p);g.route=(0,r.dn)(c)}).addCase(s,(h,{payload:u})=>{const{id:i}=u,{alertmanager_config:x}=h;if(!x.route)return;const g=(0,n.QM)(x.route),p=(0,r.AS)(i,g);h.alertmanager_config.route=(0,r.dn)(p)}).addCase(m,(h,{payload:u})=>{const{partialRoute:i,referenceRouteIdentifier:x,insertPosition:g,alertmanager:p}=u,{alertmanager_config:c}=h;if(!c.route)return;const y=(0,n.QM)(c.route),P=(0,r.I8)(p,i,x,y,g);h.alertmanager_config.route=(0,r.dn)(P)})})},55614:(ee,B,e)=>{"use strict";e.d(B,{FB:()=>s,JI:()=>a,jS:()=>m,r0:()=>f});var t=e(65307),n=e(2543),r=e.n(n),o=e(42801);const s=(0,t.VP)("notificationTemplate/add"),m=(0,t.VP)("notificationTemplate/update"),a=(0,t.VP)("notificationTemplate/delete"),l={alertmanager_config:{},template_files:{}},f=(0,t.vy)(l,h=>{h.addCase(s,(u,{payload:i})=>{const{alertmanager_config:x={},template_files:g={}}=u,{template:p}=i;if(g[p.title]!==void 0)throw new Error("target template already exists");const y=(0,o.o)(p.title,p.content);g[p.title]=y,x.templates=(0,n.toArray)(x.templates).concat(p.title)}).addCase(m,(u,{payload:i})=>{const{alertmanager_config:x={},template_files:g={}}=u,{name:p,template:c}=i,y=p!==c.title;if(!(g[p]!==void 0))throw new Error(`Expected notification template ${p} to exist, but did not find it in the config`);const d=(0,o.o)(c.title,c.content);if(y){const D=p,b=c.title;if(g[b]!==void 0)throw new Error(`Duplicate template name ${b}`);(0,n.unset)(g,D),(0,n.remove)(x.templates??[],v=>v===D),x.templates=(0,n.toArray)(x.templates).concat(c.title)}g[c.title]=d}).addCase(a,(u,{payload:i})=>{const{name:x}=i,{alertmanager_config:g={},template_files:p={}}=u;(0,n.unset)(p,x),(0,n.remove)(g.templates??[],c=>c===x)})})},15518:(ee,B,e)=>{"use strict";e.d(B,{BD:()=>s,FS:()=>a,NF:()=>f,Xm:()=>m});var t=e(65307),n=e(2543),r=e.n(n),o=e(48442);const s=(0,t.VP)("receiver/add"),m=(0,t.VP)("receiver/update"),a=(0,t.VP)("receiver/delete"),l={alertmanager_config:{},template_files:{}},f=(0,t.vy)(l,h=>{h.addCase(s,(u,{payload:i})=>{const x=u.alertmanager_config.receivers=u.alertmanager_config.receivers??[];if(x.some(p=>p.name===i.name))throw new Error(`Duplicate receiver name ${i.name}`);x.push(i)}).addCase(m,(u,{payload:i})=>{const{name:x,receiver:g}=i,p=x!==g.name,c=u.alertmanager_config.receivers??[],y=c.findIndex(D=>D.name===x);if(!(y>-1))throw new Error(`Expected receiver ${x} to exist, but did not find it in the config`);if(p&&c.some(b=>b.name===g.name))throw new Error(`Duplicate receiver name ${g.name}`);c[y]=g;const d=u.alertmanager_config.route;d&&p&&(u.alertmanager_config.route=(0,o.Wn)(d,x,g.name))}).addCase(a,(u,{payload:i})=>{(0,n.remove)(u.alertmanager_config.receivers??[],x=>x.name===i)})})},96137:(ee,B,e)=>{"use strict";e.d(B,{Ct:()=>d,KH:()=>h,KL:()=>x,LH:()=>f,Qn:()=>a,Wu:()=>l,bw:()=>g,fO:()=>i,i3:()=>c,lF:()=>u});var t=e(65307),n=e(2543),r=e.n(n),o=e(52161),s=e(94646),m=e(29609);const a=(0,t.VP)("ruleGroup/rules/add"),l=(0,t.VP)("ruleGroup/rules/update"),f=(0,t.VP)("ruleGroup/rules/pause"),h=(0,t.VP)("ruleGroup/rules/delete"),u=(0,t.VP)("ruleGroup/update"),i=(0,t.VP)("ruleGroup/move"),x=(0,t.VP)("ruleGroup/rename"),g=(0,t.VP)("ruleGroup/rules/reorder"),p={name:"initial",rules:[]},c=(0,t.vy)(p,b=>{b.addCase(a,(E,{payload:v})=>{const{rule:C}=v;E.rules.push(C)}).addCase(l,(E,{payload:v})=>{const{identifier:C,rule:S}=v,O=D(E.rules,C);E.rules[O]=S}).addCase(h,(E,{payload:v})=>{const{identifier:C}=v,S=D(E.rules,C);E.rules.splice(S,1)}).addCase(f,(E,{payload:v})=>{const{uid:C,pause:S}=v,O={ruleSourceName:o.hY,uid:C},I=D(E.rules,O),R=E.rules[I];if(m.p.grafana.rule(R))R.grafana_alert.is_paused=S;else throw new Error("Matching rule is not a Grafana-managed rule")}).addCase(g,(E,{payload:v})=>{const{swaps:C}=v;P(E.rules,C)}).addMatcher((0,t.i0)(x,i,a),(E,{payload:v})=>{const{groupName:C}=v;E.name=C??E.name}).addMatcher((0,t.i0)(u,x,i,a),(E,{payload:v})=>{const{interval:C}=v;E.interval=C??E.interval}).addDefaultCase((E,v)=>{throw new Error(`Unknown action for rule group reducer: ${v.type}`)})}),y=b=>{const E=(0,m.A4)(b),v=(0,m.X4)(b);return C=>{const S=m.p.grafana.rule(C),O=m.p.dataSource.rule(C);if(E&&S)return C.grafana_alert.uid===b.uid;if(O&&v)return(0,s.Ns)(C)===b.rulerRuleHash}};function P(b,E){for(const v of E)d(b,v);return b}function d(b,[E,v]){if(!((0,n.inRange)(E,b.length)&&(0,n.inRange)(v,b.length)))throw new Error("Invalid operation: index out of bounds");const[S]=b.splice(E,1);b.splice(v,0,S)}function D(b,E){const v=b.findIndex(y(E));if(v===-1)throw new Error("no rule matching identifier found");return v}},84523:(ee,B,e)=>{"use strict";e.d(B,{BH:()=>C,IJ:()=>P,JG:()=>b,T6:()=>y,_u:()=>S,b0:()=>E,ir:()=>v});var t=e(2543),n=e.n(t),r=e(43173),o=e(24619),s=e(67817),m=e(54),a=e(95443),l=e(52161),f=e(20437),h=e(29609),u=e(15629),i=e(6194);const x=(0,u.P8)(r.$.unifiedAlerting?.minInterval??"10s"),g=(0,u.P8)("1m"),p=1/0,c="0s",y=(0,u.an)((0,t.clamp)(x,g,p)),P=()=>{const{canCreateGrafanaRules:O,canCreateCloudRules:I}=(0,m.Q9)();return Object.freeze({name:"",uid:"",labels:[{key:"",value:""}],annotations:a.kl,dataSourceName:l.hY,type:O?s.Z.grafana:I?s.Z.cloudAlerting:void 0,group:"",folder:void 0,queries:[],recordingRulesQueries:[],condition:"",noDataState:o.Q8.NoData,execErrState:o.Q8.Error,evaluateFor:y,keepFiringFor:c,evaluateEvery:y,manualRouting:d(),contactPoints:{},overrideGrouping:!1,overrideTimings:!1,muteTimeIntervals:[],editorSettings:D(),namespace:"",expression:"",forTime:1,forTimeUnit:"m"})},d=()=>r.$.featureToggles.alertingSimplifiedRouting??!1?localStorage.getItem(f.Q8)!=="false":!1;function D(){if(!(r.$.featureToggles.alertingQueryAndExpressionsStepMode??!1))return;const I=localStorage.getItem(f.Os),R=localStorage.getItem(f.Q8);return{simplifiedQueryEditor:I!=="false",simplifiedNotificationEditor:R!=="false"}}function b(O,I){let R;try{R=JSON.parse(O)}catch{return{...P(),queries:(0,f.qO)()}}return(0,i.bx)((0,i.A2)((0,i.i_)({...P(),...R,annotations:(0,i.JE)(R.annotations??[]),queries:R.queries??(0,f.qO)(),type:I||s.Z.grafana,evaluateEvery:y})))}function E(O){return(0,i.i_)({...P(),...O})}function v(O){return(0,i.i_)((0,f.QX)(O))}function C(O){return{...P(),condition:"C",queries:(0,f.qO)((0,h.pq)(O)),type:O,evaluateEvery:y}}function S(O=""){return O==="recording"?s.Z.cloudRecording:O==="grafana-recording"?s.Z.grafanaRecording:s.Z.grafana}},6194:(ee,B,e)=>{"use strict";e.d(B,{A2:()=>u,JE:()=>c,Nx:()=>i,Oy:()=>x,bx:()=>h,i_:()=>p});var t=e(2543),n=e.n(t),r=e(43173),o=e(44022),s=e(4651),m=e(82779),a=e(95443),l=e(52161),f=e(20437);function h(y){if(!(r.$.featureToggles.alertingQueryAndExpressionsStepMode??!1))return{...y,editorSettings:{simplifiedQueryEditor:!1,simplifiedNotificationEditor:!0}};const d=y.queries.filter(E=>!(0,o.f)(E.model)),D=y.queries.filter(E=>x(E)),b=i(d,D);return{...y,editorSettings:{simplifiedQueryEditor:b,simplifiedNotificationEditor:!0}}}function u(y){return{...y,queries:y.queries?.map(P=>{if((0,o.f)(P.model))return P;const d=P.model.datasource?.type?(0,l.cl)(P.model.datasource.type):!1,D="instant"in P.model&&P.model.instant!==void 0?P.model.instant:d;return{...P,model:{...P.model,instant:D,range:!D}}})}}function i(y,P){if(y.length!==1||P.length>2)return!1;const d=y.at(0),D=P.find(K=>K.model.type===s.Tz.reduce),b=P.find(K=>K.model.type===s.Tz.threshold),E=D?(0,m.OC)(D.model):!1,v=b?.model.conditions?.every(K=>(0,t.isEmpty)(K.unloadEvaluator))??!0,C=D&&E,S=b&&v,O=b?.model.expression===D?.refId,I=D?.model.expression===d?.refId;if(C&&I&&S&&O)return!0;const R=d?(0,f.mY)(d):!1,T=P.length===1&&b,L=b?.model.expression===d?.refId;return!!(R&&T&&S&&L)}function x(y){return(0,o.f)(y.model)}function g(y){return!isExpressionQuery(y.model)}const p=y=>({...y,queries:y.queries?.map(P=>(0,t.omit)(P,"model.hide"))});function c(y){const P=[...y];return a.kl.map(D=>
163D.key).forEach((D,b)=>{const E=P.findIndex(v=>v.key===D);if(E===-1){const v={key:D,value:""};P.splice(b,0,v)}else E!==b&&P.splice(b,0,P.splice(E,1)[0])}),P}},76267:(ee,B,e)=>{"use strict";e.d(B,{C:()=>a});var t=e(79197),n=e(48497),r=e(74529),o=e(25229),s=e(80011),m=e(15629);function a(f,h){if(!f||!h||!(0,r.vd)(f))return;let u;try{u=(0,m.M9)(h)}catch{return}if((0,m.mo)(f))return;const i=Date.parse(f||""),x=(0,t.A)(i,u);return(0,n.Y)(x,new Date)?{humanized:`within ${h}`,fullDate:`within ${h}`}:{humanized:`in ${(0,o.KQ)(x).locale("en").fromNow(!0)}`,fullDate:(0,s.LE)(x,{format:"YYYY-MM-DD HH:mm:ss"})}}function l(f){if(!f)return null;if(!isNullDate(f))return formatDistanceToNowStrict(new Date(f))}},56369:(ee,B,e)=>{"use strict";e.d(B,{Jc:()=>H,kL:()=>Z,XY:()=>_});var t=e(24619),n=e(29609);const r=1,o=2,s=3,m=4,a=5,l=6,f=7,h=8,u=9,i=10,x=11,g=12,p=13,c=14,y=15,P=0,d=1,D=2,b=3,E=4,v=5,C=6,S=7,O=8,I=9,R=10;var T=e(2543),L=e(48820);const K=L.U1.deserialize({version:14,states:"!vOQOPOOO{OPO'#CkOOOO'#Ck'#CkOQOPO'#CoOOOO'#Cl'#ClQQOPOOO!yOQO'#C^O#OOPO'#CmO#TOPO,59VOOOO,59Z,59ZOOOO-E6j-E6jOOOO,58x,58xOOOO,59X,59XOOOO-E6k-E6k",stateData:"$t~ORUOTUOUUOVUOWUOXUOYUOZUO[UO]UO^UOdPOfQO~OeVOR_XT_XU_XV_XW_XX_XY_XZ_X[_X]_X^_Xd_Xf_X~OSZO~Od[O~OeVOR_aT_aU_aV_aW_aX_aY_aZ_a[_a]_a^_ad_af_a~OR~T~U~V~W~Y~Z~[~]~^~R^][ZYXWVUTd~",goto:"}dPPePPPPPPPPPPPPejpPvVRORTQTORYTQWPR]WSSOTRXR",nodeNames:"\u26A0 AlertRuleSearch FilterExpression DataSourceToken FilterValue NameSpaceToken LabelToken GroupToken RuleToken StateToken TypeToken HealthToken DashboardToken PluginsToken ContactPointToken FreeFormExpression",maxTerm:22,skippedNodes:[0],repeatNodeCount:2,tokenData:"$ nRRtqr#crs&ost#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]+q!]#V#c#V#W-T#W#X@m#X#Z#c#Z#[!/S#[#]!7|#]#`#c#`#a!B`#a#b#c#b#c!KY#c#d#c#d#e#,W#e#f#c#f#g#8S#g#h#?d#h#i#H^#i$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#jcSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cQ$zcSQqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uQ&YP;=`<%l$uQ&`P;=`;NQ$uR&fP;=`<%l#cR&lP;=`;NQ#cR&rrX^(|pq(|qr(|st(|tu(|uv(|vw(|wx(|xy(|yz(|z{(|{|(||!P(|!P!Q(|!QPsX^(|pq(|qr(|rs+^st(|tu(|uv(|vw(|wx(|xy(|yz(|z{(|{|(||!P(|!P!Q(|!Q[#g$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!)ceSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#V#c#V#W!*t#W$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!*{eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y!,^#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!,ecSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]!-p!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!-wcSQRPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR!/ZeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#f#c#f#g!0l#g$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!0seSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#c#c#c#d!2U#d$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!2]eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#i#c#i#j!3n#j$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!3ueSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#d#c#d#e!5W#e$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!5_cSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]!6j!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!6qcSQVPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR!8TeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y!9f#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!9meSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#T#c#T#U!;O#U$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!;VeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#`#c#`#a!<h#a$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!<oeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#h#c#h#i!>Q#i$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!>XeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#[#c#[#]!?j#]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!?qcSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]!@|!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!ATcSQZPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR!BgeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#T#c#T#U!Cx#U$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!DPeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#U#c#U#V!Eb#V$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!EieSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y!Fz#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!GReSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#`#c#`#a!Hd#a$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!HkcSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]!Iv!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!I}cSQUPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR!KaeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#T#c#T#U!Lr#U$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!LyeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#a#c#a#b!N[#b$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR!NceSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y# t#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR# {eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#g#c#g#h##^#h$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR##eeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#d#c#d#e#$v#e$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#$}eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#T#c#T#U#&`#U$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#&geSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#V#c#V#W#'x#W$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#(PeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y#)b#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#)icSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]#*t!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#*{cSQTPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR#,_eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#`#c#`#a#-p#a$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#-weSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#i#c#i#j#/Y#j$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#/aeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#Z#c#Z#[#0r#[$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#0yeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#]#c#]#^#2[#^$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#2ceSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#b#c#b#c#3t#c$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#3{eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#g#c#g#h#5^#h$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#5ecSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]#6p!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#6wcSQ]Pqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR#8ZeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#i#c#i#j#9l#
163j$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#9seSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#`#c#`#a#;U#a$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#;]eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y#<n#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#<ucSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]#>Q!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#>XcSQWPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR#?keSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#h#c#h#i#@|#i$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#ATeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#T#c#T#U#Bf#U$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#BmeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#h#c#h#i#DO#i$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#DVeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y#Eh#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#EocSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]#Fz!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#GRcSQXPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$uR#HeeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#m#c#m#n#Iv#n$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#I}eSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#d#c#d#e#K`#e$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#KgeSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]$u!]#X#c#X#Y#Lx#Y$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#MPcSQdPqr#cst#ctu#cuv#cvw#cwx#cxy#cyz#cz{#c{|#c|!P#c!P!Q#c!Q![#c![!]#N[!]$Ch#c$JU;'S#c;'S;(d&c;(d;(e&i<%lO#cR#NccSQYPqr$ust$utu$uuv$uvw$uwx$uxy$uyz$uz{$u{|$u|!P$u!P!Q$u!Q![$u![!]$u!]$Ch$u$JU;'S$u;'S;(d&V;(d;(e&]<%lO$u",tokenizers:[0,1],topRules:{AlertRuleSearch:[0,1]},dialects:{dataSourceFilter:141,nameSpaceFilter:143,labelFilter:145,groupFilter:147,ruleFilter:149,stateFilter:84,typeFilter:151,healthFilter:153,dashboardFilter:155,pluginsFilter:157,contactPointFilter:159},tokenPrec:161}),A={[s]:"datasource",[a]:"namespace",[l]:"label",[h]:"rule",[f]:"group",[u]:"state",[i]:"type",[x]:"health",[g]:"dashboard",[p]:"plugins",[c]:"contactPoint"};var W=(te=>(te.dataSource="dataSourceFilter",te.nameSpace="nameSpaceFilter",te.label="labelFilter",te.group="groupFilter",te.rule="ruleFilter",te.state="stateFilter",te.type="typeFilter",te.health="healthFilter",te.dashboard="dashboardFilter",te.plugins="pluginsFilter",te.contactPoint="contactPointFilter",te))(W||{});function N(te,Y,Q){U(te,Y,J=>{if(J.type.id===o){const q=w(te,J);if(q.type&&q.value){const X=Q[q.type];X&&X(q.value)}}else if(J.type.id===y){const q=Q[y];q&&q(j(te,J))}})}function w(te,Y){if(Y.type.id!==o)throw new Error("Invalid node provided. Only FilterExpression nodes are supported");const Q=Y.firstChild;if(!Q)return{type:void 0,value:void 0};const J=Y.getChild(m),q=J?(0,T.trim)(j(te,J),'"'):void 0;return{type:Q.type.id,value:q}}function j(te,Y){return te.slice(Y.from,Y.to).trim().replace(/\"/g,"")}function V(te,Y,Q){const J=[];U(te,Y,X=>{X.type.id===o&&X.firstChild&&J.push(X.firstChild),X.type.id===y&&J.push(X)});const q=[];return J.forEach(X=>{const se=Q.findIndex(oe=>oe.type===X.type.id);if(se!==-1){if(X.parent?.type.is(o)){const oe=A[X.type.id],ae=Q.splice(se,1)[0];q.push(`${oe}:${F(ae.value)}`)}if(X.type.is(y)){const oe=Q.splice(se,1)[0];q.push(oe.value)}}}),Q.forEach(X=>{X.type===y?q.push(X.value):q.push(`${A[X.type]}:${F(X.value)}`)}),q.join(" ")}function U(te,Y,Q){const J=Y.join(" "),X=K.configure({dialect:J}
163).parse(te).cursor();do Q(X.node);while(X.next())}function F(te){return/\s/.test(te)?`"${te}"`:te}const M=[W.dataSource,W.nameSpace,W.label,W.group,W.rule,W.state,W.type,W.health,W.dashboard,W.plugins,W.contactPoint];var H=(te=>(te.Ok="ok",te.Error="error",te.NoData="nodata",te.Unknown="unknown",te))(H||{});function _(te){const Y={labels:[],freeFormWords:[],dataSourceNames:[]},Q={[s]:J=>Y.dataSourceNames.push(J),[a]:J=>Y.namespace=J,[f]:J=>Y.groupName=J,[h]:J=>Y.ruleName=J,[l]:J=>Y.labels.push(J),[u]:J=>Y.ruleState=ne(J),[i]:J=>(0,n.nf)(J)?Y.ruleType=J:void 0,[x]:J=>Y.ruleHealth=(0,n.f6)(J),[g]:J=>Y.dashboardUid=J,[p]:J=>Y.plugins=J==="hide"?J:void 0,[c]:J=>Y.contactPoint=J,[y]:J=>Y.freeFormWords.push(J)};return N(te,M,Q),Y}function Z(te,Y){const Q=[];return Y.dataSourceNames&&Q.push(...Y.dataSourceNames.map(J=>({type:s,value:J}))),Y.namespace&&Q.push({type:a,value:Y.namespace}),Y.groupName&&Q.push({type:f,value:Y.groupName}),Y.ruleName&&Q.push({type:h,value:Y.ruleName}),Y.ruleState&&Q.push({type:u,value:Y.ruleState}),Y.ruleType&&Q.push({type:i,value:Y.ruleType}),Y.ruleHealth&&Q.push({type:x,value:Y.ruleHealth}),Y.labels&&Q.push(...Y.labels.map(J=>({type:l,value:J}))),Y.dashboardUid&&Q.push({type:g,value:Y.dashboardUid}),Y.plugins&&Q.push({type:p,value:Y.plugins}),Y.freeFormWords&&Q.push(...Y.freeFormWords.map(J=>({type:y,value:J}))),Y.contactPoint&&Q.push({type:c,value:Y.contactPoint}),V(te,M,Q)}function ne(te){if(te==="normal")return t.cF.Inactive;if((0,t.Si)(te))return te}},5358:(ee,B,e)=>{"use strict";e.d(B,{Kh:()=>g,VI:()=>u,b9:()=>h});var t=e(74848),n=e(96540),r=e(36490),o=e(29043),s=e(84266),m=e(93395),a=e(95443),l=e(52161);const f=n.createContext(void 0),h=({children:p,accessType:c,alertmanagerSourceName:y})=>{const P=r.Ny.getSearch(),d=r.Ny.partial,D=(0,m.W)(c),b=D.availableInternalDataSources.concat(D.availableExternalDataSources),E=n.useCallback(W=>{i(b,W)&&(W===l.hY?(o.A.delete(a.Oq),d({[a.DD]:void 0})):(o.A.set(a.Oq,W),d({[a.DD]:W})))},[b,d]),v=P.get(a.DD),C=o.A.get(a.Oq),S=l.hY;n.useEffect(()=>{v&&v!==C&&o.A.set(a.Oq,v)},[v,C]);const O=y??v??C??S,I=i(b,O)?O:void 0,R=(0,l.r3)(I)?.jsonData,T=I===l.hY,L=R?g(R):!1,A={selectedAlertmanager:I,hasConfigurationAPI:T||L,isGrafanaAlertmanager:T,selectedAlertmanagerConfig:R,availableAlertManagers:b,setSelectedAlertmanager:E};return(0,t.jsx)(f.Provider,{value:A,children:p})};function u(){const p=n.useContext(f);if(p===void 0)throw new Error("useAlertmanager must be used within a AlertmanagerContext");return p}function i(p,c){return p.map(P=>P.name).includes(c)}const x=[s.Oz.mimir,s.Oz.cortex,void 0];function g(p){return x.includes(p.implementation)}},11018:(ee,B,e)=>{"use strict";e.d(B,{nO:()=>R,D3:()=>I,yo:()=>v,nV:()=>C,JH:()=>S,Lc:()=>E,mB:()=>D,eB:()=>b,uQ:()=>L,bO:()=>T,RW:()=>O});var t=e(65307),n=e(2543),r=e(25992),o=e(36490),s=e(74268),m=e(47938),a=e(91984),l=e(68143);function f(K){return(0,l.AI)().get("/api/annotations",{alertUID:K}).then(A=>A?.sort(h))}function h(K,A){const W=(j,V)=>j>V?-1:V>j?1:0,N=W(K.timeEnd,A.timeEnd);if(N)return N;const w=W(K.time,A.time);return w||W(K.id,A.id)}var u=e(55143),i=e(78467),x=e(77295),g=e(86017),p=e(52161),c=e(77256),y=e(36200),P=e(29609),d=e(15629);const D=(0,t.zD)("unifiedalerting/fetchPromRules",async({rulesSourceName:K,filter:A,limitAlerts:W,matcher:N,state:w,identifier:j},V)=>{const U=(0,s.U7)("unifiedalerting/fetchPromRules",i.sA,{dataSourceName:K,thunk:"unifiedalerting/fetchPromRules"});return await(0,y.$I)(U(K,A,W,N,w,j))}),b=(0,t.zD)("unifiedalerting/fetchRulerRules",async({rulesSourceName:K,filter:A},{dispatch:W,getState:N})=>{const{data:w}=await W(u.L.endpoints.discoverDsFeatures.initiate({rulesSourceName:K}));if(!w?.rulerConfig)return null;const j=(0,s.Ke)("unifiedalerting/fetchRulerRules",x.iy,{dataSourceName:K,thunk:"unifiedalerting/fetchRulerRules"});return await(0,y.$I)(j(w.rulerConfig,A))});function E({rulesSourceName:K,identifier:A,filter:W,limitAlerts:N,matcher:w,state:j}){return async V=>{const{data:U}=await V(u.L.endpoints.discoverDsFeatures.initiate({rulesSourceName:K}));await Promise.all([V(D({rulesSourceName:K,identifier:A,filter:W,limitAlerts:N,matcher:w,state:j})),U?.rulerConfig?V(b({rulesSourceName:K})):Promise.resolve()])}}function v(K=!1,A={}){return async(W,N)=>{const w=performance.now();await Promise.allSettled((0,p.gR)().map(async j=>{const{data:V}=await W(u.L.endpoints.discoverDsFeatures.initiate({rulesSourceName:j})),{promRules:U,rulerRules:F}=N().unifiedAlerting;if(!V)return;const M=K||!U[j]?.loading,H=(K||!F[j]?.loading)&&!!V?.rulerConfig;await Promise.allSettled([M&&W(D({rulesSourceName:j,...A})),H&&W(b({rulesSourceName:j}))])})),(0,r.l$)("unifiedalerting/fetchAllPromAndRulerRulesAction",{loadTimeMs:performance.now()-w})}}function C(K=!1,A={}){return async(W,N)=>{const{promRules:w}=N().unifiedAlerting;(0,p.gR)().map(j=>{(K||!w[j]?.loading)&&W(D({rulesSourceName:j,...A}))})}}const S=(0,t.zD)("unifiedalerting/fetchGrafanaAnnotations",K=>(0,y.$I)(f(K))),O=(0,t.zD)("unifiedalerting/updateAMConfig",({alertManagerSourceName:K,oldConfig:A,newConfig:W,successMessage:N,redirectPath:w,redirectSearch:j},V)=>(0,y.v5)((0,y.$I)((async()=>{const U=await V.dispatch(a.m.endpoints.getAlertmanagerConfiguration.initiate(K,{forceRefetch:!0})).unwrap(),F=(0,n.isEmpty)(U.alertmanager_config)&&(0,n.isEmpty)(U.template_files),M=JSON.stringify(U)!==JSON.stringify(A);if(!F&&M)throw new Error("A newer Alertmanager configuration is available. Please reload the page and try again to not overwrite recent changes.");if(await(0,m.vk)(K,(0,g.MZ)(W)),V.dispatch(a.m.util.invalidateTags(["AlertmanagerConfiguration","ContactPoint","ContactPointsStatus","Receiver"])),w){const H=new URLSearchParams(j??"");o.Ny.push((0,c.nL)(w,K,H))}})()),{successMessage:N})),I=(0,t.zD)("unifiedalerting/fetchAlertGroups",K=>(0,y.$I)((0,m.f4)(K))),R=(0,t.zD)("unifiedalerting/deleteAlertManagerConfig",async(K,A)=>(0,y.v5)((0,y.$I)((async()=>{await(0,m.nd)(K),await A.dispatch(a.m.util.invalidateTags(["AlertmanagerConfiguration"]))})()),{errorMessage:"Failed to reset Alertmanager configuration",successMessage:"Alertmanager configuration reset."})),T=(0,t.zD)("unifiedalerting/testReceivers",({alertManagerSourceName:K,receivers:A,alert:W})=>(0,y.v5)((0,y.$I)((0,m.By)(K,A,W)),{errorMessage:"Failed to send test alert.",successMessage:"Test alert sent."})),L=(K,A)=>K.filter(W=>{const{forDuration:N}=(0,P.jg)(W,A),w=N?(0,d.P8)(N):null,j=(0,d.P8)(A);return w?w!==0&&w<j:!1})},18771:(ee,B,e)=>{"use strict";e.d(B,{H:()=>n});var t=e(22803);const n=r=>(0,t.css)({float:"none",display:"flex",justifyContent:"flex-start",margin:r.spacing(2,0)})},2869:(ee,B,e)=>{"use strict";e.d(B,{W:()=>t});var t=(n=>(n.Incident="grafana-incident-app",n.OnCall="grafana-oncall-app",n.Irm="grafana-irm-app",n.MachineLearning="grafana-ml-app",n.Labels="grafana-labels-app",n.Slo="grafana-slo-app",n))(t||{})},67817:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>t});var t=(n=>(n.grafana="grafana-alerting",n.grafanaRecording="grafana-recording",n.cloudAlerting="cloud-alerting",n.cloudRecording="cloud-rec
163ording",n))(t||{})},72649:(ee,B,e)=>{"use strict";e.d(B,{y:()=>t});var t=(n=>(n.seconds="s",n.minutes="m",n.hours="h",n.days="d",n.weeks="w",n))(t||{})},54:(ee,B,e)=>{"use strict";e.d(B,{C0:()=>g,HL:()=>m,Q9:()=>p,VQ:()=>a,Wd:()=>x,jy:()=>u,lV:()=>i,nU:()=>l,q0:()=>c});var t=e(65642),n=e(15130),r=e(96673),o=e(52161);function s(y){return(0,o.z2)(y)?"grafana":"external"}const m={read:{grafana:r.AccessControlAction.AlertingInstanceRead,external:r.AccessControlAction.AlertingInstancesExternalRead},create:{grafana:r.AccessControlAction.AlertingInstanceCreate,external:r.AccessControlAction.AlertingInstancesExternalWrite},update:{grafana:r.AccessControlAction.AlertingInstanceUpdate,external:r.AccessControlAction.AlertingInstancesExternalWrite},delete:{grafana:r.AccessControlAction.AlertingInstanceUpdate,external:r.AccessControlAction.AlertingInstancesExternalWrite}},a={read:{grafana:r.AccessControlAction.AlertingNotificationsRead,external:r.AccessControlAction.AlertingNotificationsExternalRead},create:{grafana:r.AccessControlAction.AlertingNotificationsWrite,external:r.AccessControlAction.AlertingNotificationsExternalWrite},update:{grafana:r.AccessControlAction.AlertingNotificationsWrite,external:r.AccessControlAction.AlertingNotificationsExternalWrite},delete:{grafana:r.AccessControlAction.AlertingNotificationsWrite,external:r.AccessControlAction.AlertingNotificationsExternalWrite}},l={read:{grafana:r.AccessControlAction.AlertingSilenceRead,external:r.AccessControlAction.AlertingInstanceRead},create:{grafana:r.AccessControlAction.AlertingSilenceCreate,external:r.AccessControlAction.AlertingInstancesExternalWrite},update:{grafana:r.AccessControlAction.AlertingSilenceUpdate,external:r.AccessControlAction.AlertingInstancesExternalWrite}},f={read:r.AccessControlAction.AlertingProvisioningRead,readSecrets:r.AccessControlAction.AlertingProvisioningReadSecrets,write:r.AccessControlAction.AlertingProvisioningWrite},h={read:{grafana:r.AccessControlAction.AlertingRuleRead,external:r.AccessControlAction.AlertingRuleExternalRead},create:{grafana:r.AccessControlAction.AlertingRuleCreate,external:r.AccessControlAction.AlertingRuleExternalWrite},update:{grafana:r.AccessControlAction.AlertingRuleUpdate,external:r.AccessControlAction.AlertingRuleExternalWrite},delete:{grafana:r.AccessControlAction.AlertingRuleDelete,external:r.AccessControlAction.AlertingRuleExternalWrite}};function u(y){const P=s(y);return{read:m.read[P],create:m.create[P],update:m.update[P],delete:m.delete[P]}}function i(y){const P=s(y);return{read:a.read[P],create:a.create[P],update:a.update[P],delete:a.delete[P],provisioning:f}}function x(y){const P=s(y);return{read:h.read[P],create:h.create[P],update:h.update[P],delete:h.delete[P]}}function g(y){return()=>n.TP.evaluatePermission(y)}function p(){return{canCreateGrafanaRules:n.TP.hasPermission(r.AccessControlAction.FoldersRead)&&n.TP.hasPermission(h.create.grafana),canCreateCloudRules:n.TP.hasPermission(r.AccessControlAction.DataSourcesRead)&&n.TP.hasPermission(h.create.external),canEditRules:y=>n.TP.hasPermission(x(y).update)}}function c(){const{unifiedAlertingEnabled:y}=(0,t.zj)(),P=n.TP.hasPermission(x(o.hY).read),d=n.TP.hasPermission(x(o.hY).update);return y&&P&&d}},86017:(ee,B,e)=>{"use strict";e.d(B,{$P:()=>R,$m:()=>h,Av:()=>d,Dm:()=>S,EU:()=>D,LF:()=>C,MN:()=>i,MU:()=>g,MZ:()=>l,NL:()=>P,UL:()=>I,VE:()=>b,Wc:()=>p,_n:()=>f,mP:()=>T,uH:()=>O,xH:()=>y});var t=e(2543),n=e.n(t),r=e(84266),o=e(182),s=e(52161),m=e(39659),a=e(63895);function l(L){return L.alertmanager_config.receivers||(L.alertmanager_config.receivers=[{name:"default "}]),L.alertmanager_config.route||(L.alertmanager_config.route={receiver:L.alertmanager_config.receivers[0].name}),L.template_files||(L.template_files={}),L}function f(L,K){return{...K,mute_time_intervals:K.mute_time_intervals?.filter(W=>W!==L)??[],active_time_intervals:K.active_time_intervals?.filter(W=>W!==L)??[],routes:K.routes?.map(W=>f(L,W))}}function h(L,K,A){return{...A,mute_time_intervals:A.mute_time_intervals?.map(W=>W===K?L:W),active_time_intervals:A.active_time_intervals?.map(W=>W===K?L:W),routes:A.routes?.map(W=>h(L,K,W))}}function u(L){return L.map(([K,A,W])=>[K,A,unquoteWithUnescape(W)])}function i(L){return L.isEqual?L.isRegex?r.ho.regex:r.ho.equal:L.isRegex?r.ho.notRegex:r.ho.notEqual}function x(L){switch(L){case r.ho.equal:return{isEqual:!0,isRegex:!1};case r.ho.notEqual:return{isEqual:!1,isRegex:!1};case r.ho.regex:return{isEqual:!0,isRegex:!0};case r.ho.notRegex:return{isEqual:!1,isRegex:!0}}}function g(L){return{name:L.name,value:L.value,operator:i(L)}}function p(L){return{name:L.name,value:L.value,...x(L.operator)}}function c(L){return`{ ${L.map(g).reduce((W,N)=>{const w=`${N.name}${N.operator}"${N.value}"`;return W?`${W}, ${w}`:w},"")} }`}const y=[{label:r.ho.equal,description:"Equals",value:r.ho.equal},{label:r.ho.notEqual,description:"Does not equal",value:r.ho.notEqual},{label:r.ho.regex,description:"Matches regex",value:r.ho.regex},{label:r.ho.notRegex,description:"Does not match regex",value:r.ho.notRegex}];function P(L){const K=i(L);return[L.name,K,L.value]}function d(L,K){const A=(0,m.Dd)(L),W=K.map(P);return(0,a.ry)(W,A)}function D(...L){const K=L.map(a.Zc).flat(),A=(0,t.uniqWith)(K,t.isEqual);return c(A)}function b(L){return L===s.hY?"default":"unquote"}function E(){return getAllDataSources().filter(L=>L.type===DataSourceType.Alertmanager)}function v(L){return E().find(K=>L===K.uid)}function C(L){const{times:K,weekdays:A,days_of_month:W,months:N,years:w,location:j}=L,V=S(K,j),U=O(A),F=I(W),M=R(N),H=T(w);return[V,U,F,M,H].join(", ")}function S(L,K){return"Times: "+(L?L?.map(({start_time:A,end_time:W})=>`${A} - ${W} [${K??"UTC"}]`).join(" and "):"All")}function O(L){return"Weekdays: "+(L?.map(K=>{if(K.includes(":"))return K.split(":").map(A=>{const W=A.slice(0,3);return W[0].toLocaleUpperCase()+W.slice(1)}).join("-");{const A=K.slice(0,3);return A[0].toLocaleUpperCase()+A.slice(1)}}).join(", ")??"All")}function I(L){return"Days of the month: "+(L?.join(", ")??"All")}function R(L){return"Months: "+(L?.join(", ")??"All")}function T(L){return"Years: "+(L?.join(", ")??"All")}},42824:(ee,B,e)=>{"use strict";e.d(B,{DY:()=>E,Mk:()=>y,QM:()=>g,Rg:()=>h,SJ:()=>c,YE:()=>p,Yl:()=>i,gY:()=>P,hH:()=>D,ie:()=>d});var t=e(84266),n=e(86017),r=e(52161),o=e(63895),s=e(67923),m=e(15629);const a=(v,C)=>Object.entries(v??{}).reduce((S,[O,I])=>[...S,{name:O,value:I,operator:C?t.ho.regex:t.ho.equal}],[]),l=v=>v.value,f=v=>(v??[]).map(l),h={name:"",value:"",operator:t.ho.equal},u=["grafana_folder","alertname"],i=[{label:"grafana_folder",value:"grafana_folder",isFixed:!0},{label:"alertname",value:"alertname",isFixed:!0},{label:"Disable (...)",value:"..."}],x={id:"",overrideGrouping:!1,groupBy:u,object_matchers:[],routes:[],continue:!1,receiver:"",overrideTimings:!1,groupWaitValue:"",groupIntervalValue:"",repeatIntervalValue:"",muteTimeIntervals:[]};function g(v,C="0"){const S=(0,s.KR)(v),O=v.routes??[];return{id:`${C}-${S}`,...v,routes:O.map((I,R)=>g(I,`${C}-${R}`))}}const p=v=>{if(!v)return x;const C=v.id;if(Object.keys(v).length===0)return{...x,id:C};const S=[];v.routes?.forEach(R=>{const T=p(R);S.push(T)});const O=v.object_matchers?.map(R=>({name:R[0],operator:R[1],value:R[2]}))??[],I=v.matchers?.flatMap(R=>(0,o.So)(R).flatMap(n.MU)).map(({name:R,operator:T,value:L})=>({name:(0,o.Ig)(R),operator:T,value:(0,o.Ig)(L)}))??[];return{id:C,object_matchers:[...I,...O,...a(v.match,!1),...a(v.match_re,!0)],continue:v.continue??!1,receiver:v.receiver??"",overrideGrouping:Array.isArray(v.group_by)&&v.group_by.length>0,groupBy:v.group_by??void 0,overrideTimings:[v.group_wait,v.group_interval,v.repeat_interval].some(Boolean),groupWaitValue:v.group_wait??"",groupIntervalValue:v.group_interval??"",repeatIntervalValue:v.repeat_interval??"",routes:S,muteTimeIntervals:v.mute_time_intervals??[]}},c=(v,C,S)=>{const O=(0,s.eM)(C.id??"",S),{overrideGrouping:I,groupBy:R,overrideTimings:T,groupWaitValue:L,groupIntervalValue:K,repeatIntervalValue:A,receiver:W}=C,N=void 0,w=I?R:N,V=T&&L?L:N,F=T&&K?K:N,H=T&&A?A:N,_=C.object_matchers?.filter(te=>te.name&&te.operator&&te.value!==null&&te.value!==void 0).map(({name:te,operator:Y,value:Q})=>[te,Y,Q]),Z=C.routes?.map(te=>c(v,te,S)),ne={...O??{},continue:C.continue,group_by:w,object_matchers:_,match:void 0,match_re:void 0,group_wait:V,group_interval:F,repeat_interval:H,routes:Z,mute_time_intervals:C.muteTimeIntervals,receiver:W};return v!==r.hY?(ne.matchers=C.object_matchers?.map(o.b2),ne.object_matchers=void 0):(ne.object_matchers=(0,o.J$)(ne),ne.matchers=void 0),C.receiver&&(ne.receiver=C.receiver),ne},y=v=>({label:v,value:v}),P=v=>(v??[]).map(y),d=v=>v?f(v):[];function D(v){return!v||v.length===0?!0:(0,m.TN)(v)||"Invalid duration format. Must be {number}{time_unit}"}const b=v=>v.map(C=>{const[S,O,I]=C;return`${S}${O}${I}`}),E=(v,C="")=>{if(v.length===0)return!0;const S=D(v),O=D(C);if(S!==!0)return S;if(O!==!0)return O;const I=(0,m.P8)(v),R=(0,m.P8)(C);return R!==0&&I<R?"Repeat interval should be higher or equal to Group interval":!0}},75640:(ee,B,e)=>{"use strict";e.d(B,{Hx:()=>s,gO:()=>m});var t=e(96540),n=e(95443),r=e(77256);function o(a){return{dashboardUID:a.find(([l])=>l===n.YH.dashboardUID)?.[1],panelId:a.find(([l])=>l===n.YH.panelID)?.[1]}}function s(a){return(0,t.useMemo)(()=>Object.entries(a||{}).filter(([l,f])=>!!f.trim()),[a])}function m(a){const l=new Map,{panelId:f,dashboardUID:h}=o(a);return h&&l.set(n.YH.dashboardUID,(0,r.JM)(h)),h&&f&&l.set(n.YH.panelID,(0,r.D2)(h,f)),l}},51740:(ee,B,e)=>{"use strict";e.d(B,{U:()=>f,r:()=>l});var t=e(43173),n=e(72930);const r=(0,n.u)("basic_auth","Basic auth","Sets the `Authorization` header with the configured username and password. Password and password_file are mutually exclusive.",{element:"subform",subformOptions:[(0,n.u)("username","Username",""),(0,n.u)("password","Password",""),(0,n.u)("password_file","Password file","")]}),o=(0,n.u)("tls_config","TLS config","Configures the TLS settings.",{element:"subform",subformOptions:[(0,n.u)("ca_file","CA file","CA certificate to validate the server certificate with."),(0,n.u)("cert_file","Cert file","Certificate for client cert authentication to the server."),(0,n.u)("key_file","Key file","Key file for client cert authentication to the server."),(0,n.u)("server_name","Server name","ServerName extension to indicate the name of the server."),(0,n.u)("insecure_skip_verify","Skip verify","Disable validation of the server certificate.",{element:"checkbox"})]}),s=(0,n.u)("oauth2","OAuth2","Configures the OAuth2 settings.",{element:"subform",subformOptions:[(0,n.u)("client_id","Client ID","The OAuth2 client ID",{required:!0}),(0,n.u)("client_secret","Client secret","The OAuth2 client secret",{required:!0}),(0,n.u)("token_url","Token URL","The OAuth2 token exchange URL",{required:!0}),(0,n.u)("scopes","Scopes","Comma-separated list of scopes",{element:"string_array"}),(0,n.u)("endpoint_params","Additional parameters","",{element:"key_value_map"})]}),m=(0,n.u)("http_config","HTTP Config","Note that `basic_auth`, `bearer_token` and `bearer_token_file` options are mutually exclusive.",{element:"subform",subformOptions:[(0,n.u)("bearer_token","Bearer token","Sets the `Authorization` header with the configured bearer token."),(0,n.u)("bearer_token_file","Bearer token file","Sets the `Authorization` header with the bearer token read from the configured file."),(0,n.u)("proxy_url","Proxy URL","Optional proxy URL."),r,o,s]}),a={name:"Jira",description:"Send notifications to Jira Service Management",type:"jira",info:"",heading:"Jira settings",options:[(0,n.u)("api_url","API URL","The host to send Jira API requests to",{required:!0}),(0,n.u)("project","Project Key","The project key where issues are created",{required:!0}),(0,n.u)("summary","Summary","Issue summary template",{placeholder:'{{ template "jira.default.summary" . }}'}),(0,n.u)("description","Description","Issue description template",{placeholder:'{{ template "jira.default.description" . }}'}),(0,n.u)("labels","Labels"," Labels to be added to the issue",{element:"string_array"}),(0,n.u)("priority","Priority","Priority of the issue",{placeholder:'{{ template "jira.default.priority" . }}'}),(0,n.u)("issue_type","Issue Type","Type of the issue (e.g. Bug)",{required:!0}),(0,n.u)("reopen_transition","Reopen transition",'Name of the workflow transition to reopen an issue. The target status should not have the category "done"'),(0,n.u)("resolve_transition","Resolve transition",'Name of the workflow transition to resolve an issue. The target status must have the category "done"'),(0,n.u)("wont_fix_resolution","Won't fix resolution",'If "Reopen transition" is defined, ignore issues with that resolution'),(0,n.u)("reopen_duration","Reopen duration",'If "Reopen transition" is defined, reopen the issue when it is not older than this value (rou
163nded down to the nearest minute)',{placeholder:"Use duration format, for example: 1.2s, 100ms"}),(0,n.u)("fields","Fields","Other issue and custom fields",{element:"key_value_map"}),m]},l=[{name:"Email",description:"Send notification over SMTP",type:"email",info:"",heading:"Email settings",options:[(0,n.u)("to","To",'The email address to send notifications to. You can enter multiple addresses using a "," separator',{required:!0}),(0,n.u)("from","From","The sender address."),(0,n.u)("smarthost","SMTP host","The SMTP host through which emails are sent."),(0,n.u)("hello","Hello","The hostname to identify to the SMTP server."),(0,n.u)("auth_username","Username","SMTP authentication information"),(0,n.u)("auth_password","Password","SMTP authentication information"),(0,n.u)("auth_secret","Secret","SMTP authentication information"),(0,n.u)("auth_identity","Identity","SMTP authentication information"),(0,n.u)("require_tls","Require TLS","The SMTP TLS requirement",{element:"checkbox"}),(0,n.u)("html","Email HTML body","The HTML body of the email notification.",{placeholder:'{{ template "email.default.html" . }}',element:"textarea"}),(0,n.u)("text","Email text body","The text body of the email notification.",{element:"textarea"}),(0,n.u)("headers","Headers","Further headers email header key/value pairs. Overrides any headers previously set by the notification implementation.",{element:"key_value_map"}),o]},{name:"PagerDuty",description:"Send notifications to PagerDuty",type:"pagerduty",info:"",heading:"PagerDuty settings",options:[(0,n.u)("routing_key","Routing key","The PagerDuty integration key (when using PagerDuty integration type `Events API v2`)"),(0,n.u)("service_key","Service key","The PagerDuty integration key (when using PagerDuty integration type `Prometheus`)."),(0,n.u)("url","URL","The URL to send API requests to"),(0,n.u)("client","Client","The client identification of the Alertmanager.",{placeholder:'{{ template "pagerduty.default.client" . }}'}),(0,n.u)("client_url","Client URL","A backlink to the sender of the notification.",{placeholder:'{{ template "pagerduty.default.clientURL" . }}'}),(0,n.u)("description","Description","A description of the incident.",{placeholder:'{{ template "pagerduty.default.description" .}}'}),(0,n.u)("severity","Severity","Severity of the incident.",{placeholder:"error"}),(0,n.u)("details","Details","A set of arbitrary key/value pairs that provide further detail about the incident.",{element:"key_value_map"}),(0,n.u)("images","Images","Images to attach to the incident.",{element:"subform_array",subformOptions:[(0,n.u)("href","URL","",{required:!0}),(0,n.u)("source","Source","",{required:!0}),(0,n.u)("alt","Alt","",{required:!0})]}),(0,n.u)("links","Links","Links to attach to the incident.",{element:"subform_array",subformOptions:[(0,n.u)("href","URL","",{required:!0}),(0,n.u)("text","Text","",{required:!0})]}),m]},{name:"Pushover",description:"Send notifications to Pushover",type:"pushover",info:"",heading:"Pushover settings",options:[(0,n.u)("user_key","User key","The recipient user\u2019s user key.",{required:!0}),(0,n.u)("token","Token","Your registered application\u2019s API token, see https://pushover.net/app",{required:!0}),(0,n.u)("title","Title","Notification title.",{placeholder:'{{ template "pushover.default.title" . }}'}),(0,n.u)("message","Message","Notification message.",{placeholder:'{{ template "pushover.default.message" . }}'}),(0,n.u)("url","URL","A supplementary URL shown alongside the message.",{placeholder:'{{ template "pushover.default.url" . }}'}),(0,n.u)("priority","Priority","Priority, see https://pushover.net/api#priority",{placeholder:'{{ if eq .Status "firing" }}2{{ else }}0{{ end }}'}),(0,n.u)("retry","Retry","How often the Pushover servers will send the same notification to the user. Must be at least 30 seconds.",{placeholder:"1m"}),(0,n.u)("expire","Expire","How long your notification will continue to be retried for, unless the user acknowledges the notification.",{placeholder:"1h"}),(0,n.u)("ttl","TTL","The number of seconds before a message expires and is deleted automatically. Examples: 10s, 5m30s, 8h.",{validationRule:"^(\\d+[s|m|h])+$|^$",element:"input"}),m]},{name:"Slack",description:"Send notifications to Slack",type:"slack",info:"",heading:"Slack settings",options:[(0,n.u)("api_url","Webhook URL","The Slack webhook URL."),(0,n.u)("channel","Channel","The #channel or @user to send notifications to.",{required:!0}),(0,n.u)("icon_emoji","Emoji icon",""),(0,n.u)("icon_url","Icon URL",""),(0,n.u)("link_names","Names link","",{element:"checkbox"}),(0,n.u)("username","Username","",{placeholder:'{{ template "slack.default.username" . }}'}),(0,n.u)("callback_id","Callback ID","",{placeholder:'{{ template "slack.default.callbackid" . }}'}),(0,n.u)("color","Color","",{placeholder:'{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}'}),(0,n.u)("fallback","Fallback","",{placeholder:'{{ template "slack.default.fallback" . }}'}),(0,n.u)("footer","Footer","",{placeholder:'{{ template "slack.default.footer" . }}'}),(0,n.u)("mrkdwn_in","Mrkdwn fields","An array of field names that should be formatted by mrkdwn syntax.",{element:"string_array"}),(0,n.u)("pretext","Pre-text","",{placeholder:'{{ template "slack.default.pretext" . }}'}),(0,n.u)("short_fields","Short fields","",{element:"checkbox"}),(0,n.u)("text","Message body","",{element:"textarea",placeholder:'{{ template "slack.default.text" . }}'}),(0,n.u)("title","Title","",{placeholder:'{{ template "slack.default.title" . }}'}),(0,n.u)("title_link","Title link","",{placeholder:'{{ template "slack.default.titlelink" . }}'}),(0,n.u)("image_url","Image URL",""),(0,n.u)("thumb_url","Thumbnail URL",""),(0,n.u)("actions","Actions","",{element:"subform_array",subformOptions:[(0,n.u)("text","Text","",{required:!0}),(0,n.u)("type","Type","",{required:!0}),(0,n.u)("url","URL","Either url or name and value are mandatory."),(0,n.u)("name","Name",""),(0,n.u)("value","Value",""),(0,n.u)("confirm","Confirm","",{element:"subform",subformOptions:[(0,n.u)("text","Text","",{required:!0}),(0,n.u)("dismiss_text","Dismiss text",""),(0,n.u)("ok_text","OK text",""),(0,n.u)("title","Title","")]}),(0,n.u)("style","Style","")]}),(0,n.u)("fields","Fields","",{element:"subform_array",subformOptions:[(0,n.u)("title","Title","",{required:!0}),(0,n.u)("value","Value","",{required:!0}),(0,n.u)("short","Short","",{element:"checkbox"})]}),m]},...t.$.featureToggles?.alertingJiraIntegration?[a]:[],{name:"OpsGenie",description:"Send notifications to OpsGenie",type:"opsgenie",info:"",heading:"OpsGenie settings",options:[(0,n.u)("api_key","API key","The API key to use when talking to the OpsGenie API."),(0,n.u)("api_url","API URL","The host to send OpsGenie API requests to."),(0,n.u)("message","Message","Alert text limited to 130 characters."),(0,n.u)("description","Description","A description of the incident.",{placeholder:'{{ template "opsgenie.default.description" . }}'}),(0,n.u)("source","Source","A backlink to the sender of the notification.",{placeholder:'{{ template "opsgenie.default.source" . }}'}),(0,n.u)("details","Details","A set of arbitrary key/value pairs that provide further detail about the incident.",{element:"key_value_map"}),(0,n.u)("tags","Tags","Comma separated list of tags attached to the notifications."),(0,n.u)("note","Note","Additional alert note."),(0,n.u)("priority","Priority","Priority level of alert. Possible values are P1, P2, P3, P4, and P5."),(0,n.u)("responders","Responders","List of responders responsible for notifications.",{element:"subform_array",subformOptions:[(0,n.u)("type","Type",'"team", "user", "escalation" or schedule".',{required:!0}),(0,n.u)("id","ID","Exactly one of these fields should be defined."),(0,n.u)("name","Name","Exactly one of these fields should be defined."),(0,n.u)("username","Username","Exactly one of these fields should be defined.")]}),m]},{name:"VictorOps",description:"Send notifications to VictorOps",type:"victorops",info:"",heading:"VictorOps settings",options:[(0,n.u)("api_key","API key","The API key to use when talking to the VictorOps API."),(0,n.u)("api_url","API URL","The VictorOps API URL."),(0,n.u)("routing_key","Routing key","A key used to map the alert to a team.",{required:!0}),(0,n.u)("message_type","Message type","Describes the behavior of the alert (CRITICAL, WARNING, INFO)."),(0,n.u)("entity_display_name","Entity display name","Contains summary of the alerted problem.",{placeholder:'{{ template "victorops.default.entity_display_name" . }}'}),(0,n.u)("state_message","State message","Contains long explanation of the alerted problem.",{placeholder:'{{ template "victorops.default.state_message" . }}'}),(0,n.u)("monitoring_tool","Monitoring tool","The monitoring tool the state message is from.",{placeholder:'{{ template "victorops.default.monitoring_tool" . }}'}),m]}
163,{name:"Webhook",description:"Send notifications to a webhook",type:"webhook",info:"",heading:"Webhook settings",options:[(0,n.u)("url","URL","The endpoint to send HTTP POST requests to.",{required:!0}),(0,n.u)("max_alerts","Max alerts","The maximum number of alerts to include in a single webhook message. Alerts above this threshold are truncated. When leaving this at its default value of 0, all alerts are included.",{placeholder:"0",inputType:"number",validationRule:"(^\\d+$|^$)",setValueAs:h=>{const u=Number(h);return Number.isFinite(u)?u:0}}),(0,n.u)("timeout","Timeout","The maximum time to wait for a webhook request to complete, before failing the request and allowing it to be retried. The default value of 0s indicates that no timeout should be applied. NOTE: This will have no effect if set higher than the group_interval.",{placeholder:"Use duration format, for example: 1.2s, 100ms"}),m]},{name:"Discord",description:"Sends notifications to Discord",type:"discord",info:"",heading:"Discord settings",options:[(0,n.u)("title","Title","Templated title of the message",{placeholder:'{{ template "discord.default.title" . }}'}),(0,n.u)("message","Message Content","Mention a group using @ or a user using <@ID> when notifying in a channel",{placeholder:'{{ template "discord.default.message" . }}'}),(0,n.u)("webhook_url","Webhook URL","",{placeholder:"Discord webhook URL",required:!0}),m]},{name:"Cisco Webex Teams",description:"Sends notifications to Cisco Webex Teams",type:"webex",info:"",heading:"Cisco Webex Teams settings",options:[(0,n.u)("api_url","API URL","The Webex Teams API URL",{placeholder:"https://webexapis.com/v1/messages"}),(0,n.u)("room_id","Room ID","ID of the Webex Teams room where to send the messages",{required:!0}),(0,n.u)("message","Message","Message template",{placeholder:'{{ template "webex.default.message" .}}'}),{...m,required:!0}]},{name:"Telegram",description:"Sends notifications to Telegram",type:"telegram",info:"",heading:"Telegram settings",options:[(0,n.u)("api_url","API URL","The Telegram API URL",{placeholder:"https://api.telegram.org"}),(0,n.u)("bot_token","Bot token","Telegram bot token",{required:!0}),(0,n.u)("chat_id","Chat ID","ID of the chat where to send the messages",{required:!0,setValueAs:h=>typeof h=="string"?parseInt(h,10):h}),(0,n.u)("message","Message","Message template",{placeholder:'{{ template "webex.default.message" .}}'}),(0,n.u)("disable_notifications","Disable notifications","Disable telegram notifications",{element:"checkbox"}),(0,n.u)("parse_mode","Parse mode","Parse mode for telegram message",{element:"select",defaultValue:{label:"None",value:""},selectOptions:[{label:"None",value:""},{label:"MarkdownV2",value:"MarkdownV2"},{label:"Markdown",value:"Markdown"},{label:"HTML",value:"HTML"}]}),m]},{name:"Amazon SNS",description:"Sends notifications to Amazon SNS",type:"sns",info:"",heading:"Amazon SNS settings",options:[(0,n.u)("api_url","API URL","The Amazon SNS API URL"),(0,n.u)("sigv4","SigV4 authentication","Configures AWS's Signature Verification 4 signing process to sign requests",{element:"subform",subformOptions:[(0,n.u)("region","Region","The AWS region. If blank, the region from the default credentials chain is used"),(0,n.u)("access_key","Access key",'The AWS API access_key. If blank the environment variable "AWS_ACCESS_KEY_ID" is used'),(0,n.u)("secret_key","Secret key",'The AWS API secret_key. If blank the environment variable "AWS_ACCESS_SECRET_ID" is used'),(0,n.u)("profile","Profile","Named AWS profile used to authenticate"),(0,n.u)("role_arn","Role ARN","AWS Role ARN, an alternative to using AWS API keys")]}),(0,n.u)("topic_arn","SNS topic ARN","If you don't specify this value, you must specify a value for the phone_number or target_arn. If you are using a FIFO SNS topic you should set a message group interval longer than 5 minutes to prevent messages with the same group key being deduplicated by the SNS default deduplication window"),(0,n.u)("phone_number","Phone number","Phone number if message is delivered via SMS in E.164 format. If you don't specify this value, you must specify a value for the topic_arn or target_arn"),(0,n.u)("target_arn","Target ARN","The mobile platform endpoint ARN if message is delivered via mobile notifications. If you don't specify this value, you must specify a value for the topic_arn or phone_number"),(0,n.u)("subject","Subject","Subject line when the message is delivered",{placeholder:'{{ template "sns.default.subject" .}}'}),(0,n.u)("message","Message","The message content of the SNS notification",{placeholder:'{{ template "sns.default.message" .}}'}),(0,n.u)("attributes","Attributes","SNS message attributes",{element:"key_value_map"}),m]},{name:"WeChat",description:"Sends notifications to WeChat",type:"wechat",info:"",heading:"WeChat settings",options:[(0,n.u)("api_url","API URL","The WeChat API URL"),(0,n.u)("api_secret","API Secret","The API key to use when talking to the WeChat API"),(0,n.u)("corp_id","Corp ID","The corp id for authentication"),(0,n.u)("message","Message","API request data as defined by the WeChat API",{placeholder:'{{ template "wechat.default.message" . }}'}),(0,n.u)("message_type","Message type","Type of the message type",{element:"select",defaultValue:{label:"Text",value:"text"},selectOptions:[{label:"Text",value:"text"},{label:"Markdown",value:"markdown"}]}),(0,n.u)("agent_id","Agent ID","",{placeholder:'{{ template "wechat.default.agent_id" . }}'}),(0,n.u)("to_user","to user","",{placeholder:'{{ template "wechat.default.to_user" . }}'}),(0,n.u)("to_party","to party","",{placeholder:'{{ template "wechat.default.to_party" . }}'}),(0,n.u)("to_tag","to tag","",{placeholder:'{{ template "wechat.default.to_tag" . }}'})]},{name:"Microsoft Teams",description:"Sends notifications to Microsoft Teams",type:"msteams",info:"",heading:"Microsoft Teams settings",options:[(0,n.u)("webhook_url","Webhook URL","The incoming webhook URL."),(0,n.u)("title","Title","Message title template.",{placeholder:'{{ template "team
163s.default.title" . }}'}),(0,n.u)("text","Text","Message body template.",{placeholder:'{{ template "teams.default.text" . }}'})]}],f=[(0,n.u)("smtp_from","SMTP from","The default SMTP From header field."),(0,n.u)("smtp_smarthost","SMTP smarthost","The default SMTP smarthost used for sending emails, including port number. Port number usually is 25, or 587 for SMTP over TLS (sometimes referred to as STARTTLS). Example: smtp.example.org:587"),(0,n.u)("smtp_hello","SMTP hello","The default hostname to identify to the SMTP server.",{placeholder:"localhost"}),(0,n.u)("smtp_auth_username","SMTP auth username","SMTP Auth using CRAM-MD5, LOGIN and PLAIN. If empty, Alertmanager doesn't authenticate to the SMTP server."),(0,n.u)("smtp_auth_password","SMTP auth password","SMTP Auth using LOGIN and PLAIN."),(0,n.u)("smtp_auth_identity","SMTP auth identity","SMTP Auth using PLAIN."),(0,n.u)("smtp_auth_secret","SMTP auth secret","SMTP Auth using CRAM-MD5."),(0,n.u)("smtp_require_tls","SMTP require TLS","The default SMTP TLS requirement. Note that Go does not support unencrypted connections to remote SMTP endpoints.",{element:"checkbox"}),(0,n.u)("slack_api_url","Slack API URL",""),(0,n.u)("victorops_api_key","VictorOps API key",""),(0,n.u)("victorops_api_url","VictorOps API URL","",{placeholder:"https://alert.victorops.com/integrations/generic/20131114/alert/"}),(0,n.u)("pagerduty_url","PagerDuty URL","https://events.pagerduty.com/v2/enqueue"),(0,n.u)("opsgenie_api_key","OpsGenie API key",""),(0,n.u)("opsgenie_api_url","OpsGenie API URL","",{placeholder:"https://api.opsgenie.com/"}),(0,n.u)("wechat_api_url","WeChat API URL","",{placeholder:"https://qyapi.weixin.qq.com/cgi-bin/"}),(0,n.u)("wechat_api_secret","WeChat API secret",""),(0,n.u)("wechat_api_corp_id","WeChat API corp id",""),(0,n.u)("webex_api_url","Cisco Webex Teams API URL",""),(0,n.u)("telegram_api_url","The Telegram API URL",""),m,(0,n.u)("resolve_timeout","Resolve timeout","ResolveTimeout is the default value used by alertmanager if the alert does not include EndsAt, after this time passes it can declare the alert as resolved if it has not been updated. This has no impact on alerts from Prometheus, as they always include EndsAt.",{placeholder:"5m"})]},182:(ee,B,e)=>{"use strict";e.d(B,{BO:()=>l,Wx:()=>a,ZP:()=>m,k7:()=>o,qf:()=>s});var t=e(43173),n=e(2869),r=e(15629);function o(){return Object.values(t.$.datasources)}function s(f){if(!(0,r.TN)(t.$.unifiedAlerting.minInterval))return{globalLimit:0,exceedsLimit:!1};const h=(0,r.P8)(t.$.unifiedAlerting.minInterval);if(!f||!(0,r.TN)(f))return{globalLimit:h,exceedsLimit:!1};const u=(0,r.P8)(f),i=h>u&&u>0;return{globalLimit:h,exceedsLimit:i}}function m(){return n.W.Irm in t.$.apps}function a(){return m()?n.W.Irm:n.W.Incident}function l(){return m()?n.W.Irm:n.W.OnCall}},95443:(ee,B,e)=>{"use strict";e.d(B,{DD:()=>r,H8:()=>x,HH:()=>n,J3:()=>i,Oq:()=>o,U3:()=>m,UU:()=>t,YH:()=>u,cB:()=>a,kW:()=>p,kl:()=>g,wG:()=>s});const t="ruler not supported",n=3e4,r="alertmanager",o="alerting-alertmanager",s=2e4,m=2e4,a=2e4,l="timeseries",f="table",h="stat";var u=(c=>(c.description="description",c.summary="summary",c.runbookURL="runbook_url",c.alertId="__alertId__",c.dashboardUID="__dashboardUid__",c.panelID="__panelId__",c))(u||{});const i={description:"Description",summary:"Summary",runbook_url:"Runbook URL",__dashboardUid__:"Dashboard UID",__panelId__:"Panel ID",__alertId__:"Alert ID"},x={description:"Description of what the alert rule does.",summary:"Short summary of what happened and why.",runbook_url:"Webpage where you keep your runbook for the alert.",__dashboardUid__:"",__panelId__:"",__alertId__:""},g=[{key:"summary",value:""},{key:"description",value:""},{key:"runbook_url",value:""}],p="__alert_rule_uid__"},52161:(ee,B,e)=>{"use strict";e.d(B,{$e:()=>Z,AL:()=>F,EV:()=>j,Eb:()=>U,Iz:()=>J,TG:()=>N,Zw:()=>te,at:()=>pe,bD:()=>O,bS:()=>ae,bt:()=>oe,cl:()=>fe,cy:()=>K,gR:()=>W,hP:()=>se,hY:()=>c,iV:()=>R,k5:()=>q,lS:()=>w,o_:()=>le,of:()=>v,oh:()=>_,ol:()=>d,qi:()=>D,r3:()=>ne,r6:()=>P,sq:()=>A,v0:()=>V,vv:()=>y,w5:()=>Q,y9:()=>X,yc:()=>M,z2:()=>H});var t=e(78282),n=e(15130),r=e(66513),o=e(88114),s=e(84266),m=e(96673),a=e(86791),l=e(91984),f=e(76070),h=e(17349),u=e(93395),i=e(5358),x=e(54),g=e(182),p=e(29609);const c="grafana",y="-- Grafana --",P={uid:a.l$,name:c,ruleSourceType:"grafana"};var d=(me=>(me.Alertmanager="alertmanager",me.Loki="loki",me.Prometheus="prometheus",me.AmazonPrometheus="grafana-amazonprometheus-datasource",me.AzurePrometheus="grafana-azureprometheus-datasource",me))(d||{});
163function D(){const me=n.TP.hasPermission(m.AccessControlAction.AlertingRuleExternalRead),De=n.TP.hasPermission(m.AccessControlAction.AlertingRuleExternalWrite);return!me&&!De?[]:(0,g.k7)().filter(Te=>fe(Te.type)).filter(Te=>se(Te)).sort((Te,Ne)=>Te.name.localeCompare(Ne.name))}function b(me){return H(me)?"grafana":me.uid??me.id}function E(me){return D().find(De=>De.name===me)}function v(me){return D().find(De=>De.uid===me)}function C(){return(0,g.k7)().filter(S).sort((me,De)=>me.name.localeCompare(De.name))}function S(me){return me.type==="alertmanager"}function O(me){return me.type==="alertmanager"}function I(){return C().filter(me=>me.jsonData.handleGrafanaManagedAlerts)}function R(me){return me.jsonData.handleGrafanaManagedAlerts===!0}const T={name:c,imgUrl:"public/img/grafana_icon.svg",hasConfigurationAPI:!0};function L(){return[T,...C().map(me=>({name:me.name,displayName:me.name,imgUrl:me.meta.info.logos.small,meta:me.meta}))]}function K(me){const De=(0,u.W)(me),Te=De.availableExternalDataSources.filter(ke=>ke.handleGrafanaManagedAlerts),Ne=De.availableInternalDataSources,{currentData:Ce}=l.m.endpoints.getGrafanaAlertingConfigurationStatus.useQuery();switch(Ce?.alertmanagersChoice){case s.nA.Internal:return Ne;case s.nA.External:return Te;default:return[...Ne,...Te]}}function A(me){const De=[],Te=[],Ne={instance:x.HL.read,notification:x.VQ.read,silence:x.nU.read};if([...Object.values(Ne).flatMap(ke=>ke.grafana),...f.w6,...o.Im,...h.X,...r.GK].some(ke=>n.TP.hasPermission(ke))&&De.push(T),n.TP.hasPermission(Ne[me].external)){const ke=C().map(Me=>({name:Me.name,displayName:Me.name,imgUrl:Me.meta.info.logos.small,meta:Me.meta,hasConfigurationAPI:(0,i.Kh)(Me.jsonData),handleGrafanaManagedAlerts:Me.jsonData.handleGrafanaManagedAlerts}));Te.push(...ke)}return{availableInternalDataSources:De,availableExternalDataSources:Te}}function W(){const me=D().map(De=>De.name);return n.TP.hasPermission(m.AccessControlAction.AlertingRuleRead)&&me.push(c),me}function N(){return D().map(me=>({name:me.name,uid:me.uid,ruleSourceType:"datasource"}))}function w(){const me=D();return n.TP.hasPermission(m.AccessControlAction.AlertingRuleRead)&&me.unshift(c),me}function j(me){return U(me)?me.name:me}function V(me){return U(me)?me.uid:c}function U(me){return me!==c}function F(me){return me!==c&&ne(me)?.jsonData?.implementation===s.Oz.prometheus}function M(me){return me.readOnly===!0}function H(me){return me===c}function _(me){return(0,g.k7)().find(De=>De.name===me)}function Z(me){return(0,g.k7)().find(De=>De.uid===me)}function ne(me){return(0,g.k7)().filter(S).find(De=>De.name===me)}function te(me){return me===c?c:_(me)}function Y(me){if(me===c)return c;const De=_(me);if(!De)throw new Error(`Datasource "${me}" not found`);return String(De.id)}function Q(me){if(me===c)return c;const De=_(me);if(!De)throw new Error(`Datasource "${me}" not found`);return De.uid}function J(me){if("uid"in me)return me.uid;if(me.rulesSourceName===c)return a.l$;const De=E(me.rulesSourceName);if(De)return De.uid}function q(){return(0,t.l)().getList({alerting:!0})[0]}function X(){const me=(0,t.l)().getInstanceSettings("default");return me?.meta.alerting??!1?me:q()}function se(me){return me.jsonData.manageAlerts!==!1}function oe(me){return(0,p.A4)(me)?{uid:a.l$,name:c,ruleSourceType:"grafana"}:{uid:Q(me.ruleSourceName),name:me.ruleSourceName,ruleSourceType:"datasource"}}function ae(me){return ie.find(De=>De===me)!==void 0}const ie=["prometheus","grafana-amazonprometheus-datasource","grafana-azureprometheus-datasource"];function fe(me){return pe.find(De=>De===me)!==void 0}const pe=["loki",...ie];function de(me){return me===c||fe(me)}const le=[c,...pe]},85835:(ee,B,e)=>{"use strict";e.d(B,{h:()=>o});var t=e(2543),n=e.n(t),r=e(61371);function o(s,m,a=t.identity){const l=a(s),f=a(m),h=(0,r.G4)(l,f),u=(0,t.chain)(h).values().flatMap().filter(x=>x.op==="add"||x.op==="replace"||x.op==="move").sumBy(x=>x.endLineNumber-x.startLineNumber+1).value(),i=(0,t.chain)(h).values().flatMap().filter(x=>x.op==="remove"||x.op==="replace").sumBy(x=>x.endLineNumber-x.startLineNumber+1).value();return{added:u,removed:i}}},67598:(ee,B,e)=>{"use strict";e.d(B,{HA:()=>a,Rc:()=>s,rO:()=>o});var t=e(52161),n=e(29609);function r(l){if(n.p.grafana.rule(l.rulerRule)&&(0,t.z2)(l.namespace.rulesSource))return{namespace:{uid:l.rulerRule.grafana_alert.namespace_uid},groupName:l.group.name,groupOrigin:"grafana"};const f=(0,t.EV)(l.namespace.rulesSource);return{rulesSource:{uid:(0,t.w5)(f),name:f,ruleSourceType:"datasource"},namespace:{name:l.namespace.name},groupName:l.group.name,groupOrigin:"datasource"}}function o(l){return l.groupOrigin==="grafana"?t.hY:l.rulesSource.name}function s(l){return{dataSourceName:o(l),namespaceName:"uid"in l.namespace?l.namespace.uid:l.namespace.name,groupName:l.groupName}}function m(l){return{rulesSource:{ruleSourceType:"datasource",name:l.ruleSourceName,uid:(0,t.w5)(l.ruleSourceName)},namespace:{name:l.namespace},groupName:l.groupName,groupOrigin:"datasource"}}const a={fromCombinedRule:r,fromRuleIdentifier:m}},22628:(ee,B,e)=>{"use strict";e.d(B,{DM:()=>o,T:()=>r,a3:()=>t,rh:()=>n});const t="grafana.com/provenance",n="none";var r=(s=>(s.Provenance="grafana.com/provenance",s.InUseRoutes="grafana.com/inUse/routes",s.InUseRules="grafana.com/inUse/rules",s.AccessWrite="grafana.com/access/canWrite",s.AccessAdmin="grafana.com/access/canAdmin",s.AccessDelete="grafana.com/access/canDelete",s))(r||{});const o="user-defined"},33998:(ee,B,e)=>{"use strict";e.d(B,{g2:()=>s,j2:()=>m,jX:()=>a});var t=e(2543),n=e.n(t),r=e(68143),o=e(56840);const s="alerting.notifications.conflict";function m(l){return{[s]:(0,o.t)("alerting.policies.update-errors.conflict","The notification policy tree has been updated by another user.")}[l]}function a(l){return(0,r.NF)(l)&&(0,t.get)(l.data,"kind")==="Status"&&(0,t.get)(l.data,"status")==="Failure"}},56476:(ee,B,e)=>{"use strict";e.d(B,{Au:()=>a,O:()=>h,Uo:()=>o,dM:()=>r,gw:()=>m,jw:()=>l,zl:()=>f});var t=e(52161),n=e(22628);const r=u=>u===t.hY,o=u=>{const i=m(u,n.T.Provenance);return!!(i&&i!==n.rh)},s="grafana.com/access/",m=(u,i)=>u.metadata?.annotations?.[i],a=u=>m(u,n.T.AccessWrite)==="true",l=u=>m(u,n.T.AccessAdmin)==="true",f=u=>m(u,n.T.AccessDelete)==="true",h=u=>u.replaceAll(/\\/g,"\\\\").replaceAll(/\=/g,"\\=").replaceAll(/,/g,"\\,")},39659:(ee,B,e)=>{"use strict";e.d(B,{Dd:()=>o,F2:()=>f,M4:()=>r,lL:()=>a,rm:()=>l,w0:()=>h,x4:()=>m,zm:()=>s});var t=e(2543),n=e.n(t);function r(u){return Object.entries(u).map(([i,x])=>`${i}=${x}`).sort()}function o(u){return Object.entries(u)}function s(u){const i={};return u.forEach(x=>{i[x[0]]=x[1]}),i}function m(u){const i={};return u.forEach(x=>{x.key&&(i[x.key]=x.value)}),i}const a="__grafana_origin";function l(u){return(0,t.isEmpty)(u)?0:Object.keys(u).filter(i=>!f(i)).length}function f(u){return u.startsWith("__")&&u.endsWith("__")||u===a}const h=([u,i])=>f(u)},63895:(ee,B,e)=>{"use strict";e.d(B,{Ig:()=>D,J$:()=>g,J9:()=>x,S6:()=>h,So:()=>l,Zc:()=>u,b2:()=>d,ou:()=>i,qR:()=>a,ry:()=>S,t8:()=>b,yk:()=>P});var t=e(2543),n=e.n(t),r=e(38388),o=e(84266),s=e(39659);const m=[o.ho.regex,o.ho.notRegex,o.ho.notEqual,o.ho.equal];function a(T){if(T.startsWith("{")&&T.endsWith("}"))throw new Error("this function does not support PromQL-style matcher syntax, call parsePromQLStyleMatcher() instead");const L=m.map(w=>[w,T.indexOf(w)]).filter(([w,j])=>j>-1).sort((w,j)=>w[1]-j[1]);if(!L.length)throw new Error(`Invalid matcher: ${T}`);const[K,A]=L[0],W=T.slice(0,A).trim(),N=T.slice(A+K.length);if(!W)throw new Error(`Invalid matcher: ${T}`);return{name:W,value:N,isRegex:K===o.ho.regex||K===o.ho.notRegex,isEqual:K===o.ho.equal||K===o.ho.regex}}function l(T){return E(T)?f(T):[a(T)]}function f(T){if(!E(T))throw new Error("not a PromQL style matcher");return h(T)}function h(T){const L=/,(?=(?:[^"]*"[^"]*")*[^"]*$)/,K=T.replace(/^\{/,"").replace(/\}$/,"").trim().split(L);return(0,t.compact)(K).flatMap(a).map(A=>({...A,name:D(A.name),value:D(A.value)}))}function u(T){try{return h(T)}catch{return[]}}function i(T){return(0,t.chain)(T).map(L=>L.trim()).compact().flatMap(u).uniqBy("name").value()}const x=T=>{const L=Object.entries(T).filter(([A])=>!(0,s.F2)(A)),K=new URLSearchParams;
163return L.forEach(([A,W])=>K.append("matcher",`${A}=${W}`)),K},g=T=>{let L=[];return T.matchers&&T.matchers.forEach(K=>{const A=l(K).map(v);L=L.concat(A)}),T.object_matchers&&L.push(...T.object_matchers),T.match_re&&Object.entries(T.match_re).forEach(([K,A])=>{L.push([K,o.ho.regex,A])}),T.match&&Object.entries(T.match).forEach(([K,A])=>{L.push([K,o.ho.equal,A])}),L};function p(T){return`"${T.replace(/[\\"]/g,K=>`\\${K}`)}"`}const c=/[\{\}\!\=\~\,\\\"\'\`\s]+/;function y(T){return c.test(T)?p(T):T}function P(T){return y(D(T))}const d=({name:T,operator:L,value:K})=>{const A=y(T),W=p(K);return`${A}${L}${W}`};function D(T){return/^"(.*)"$/.test(T)?T.replace(/^"(.*)"$/,"$1").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):T}const b={default:([T,L,K])=>`${T} ${L} ${K||""}`,unquote:([T,L,K])=>{const A=D(T),W=D(K)||'""';return`${A} ${L} ${W}`}};function E(T){return T.startsWith("{")&&T.endsWith("}")}function v(T){const L=C(T);return[T.name,L,T.value]}function C(T){return T.isEqual?T.isRegex?o.ho.regex:o.ho.equal:T.isRegex?o.ho.notRegex:o.ho.notEqual}function S(T,L){for(const K of T)if(!I(K,L))return!1;return!0}const O={[o.ho.equal]:(T,L)=>T===L,[o.ho.notEqual]:(T,L)=>T!==L,[o.ho.regex]:(T,L)=>{const K=(0,r.bQ)(`^(?:${L})$`);return new RegExp(K.cleaned,K.flags).test(T)},[o.ho.notRegex]:(T,L)=>{const K=(0,r.bQ)(`^(?:${L})$`);return!new RegExp(K.cleaned,K.flags).test(T)}};function I(T,L){const[K,A,W]=T;let N="";const w=Object.fromEntries(L)[K];w&&(N=w);const j=O[A];if(!j)throw new Error(`no such operator: ${A}`);try{return j(N,W)}catch(V){return console.warn(V),!1}}function R(T,L){const[K,A]=L,[W,N,w]=T;if(K!==W)return!1;const j=O[N];if(!j)throw new Error(`no such operator: ${N}`);return j(A,w)}},77256:(ee,B,e)=>{"use strict";e.d(B,{BK:()=>L,Cp:()=>F,D2:()=>j,E2:()=>ne,ES:()=>_,GD:()=>K,Ht:()=>S,JM:()=>w,JZ:()=>Y,KT:()=>R,NH:()=>A,S2:()=>v,Sl:()=>C,Yp:()=>d,bI:()=>b,bg:()=>D,i7:()=>E,i9:()=>V,nL:()=>T,qc:()=>H,qy:()=>I,u7:()=>Z,w$:()=>y,y$:()=>M});var t=e(2543),n=e.n(t),r=e(41607),o=e(43173),s=e(68143),m=e(15130),a=e(94646),l=e(29609),f=e(21834),h=e(24619),u=e(95443),i=e(52161),x=e(33998),g=e(63895),p=e(29442),c=e(92367);function y(Q,J,q){const X=(0,i.EV)(Q),se=a.UP(X,J);return p.PP.detailsPageLink(X,se,q?{returnTo:q}:void 0)}function P(Q,J,q){const X=Q.rulesSource.name,se=ruleId.fromRule(X,Q.namespace.name,Q.groupName,J);return rulesNav.detailsPageLink(X,se,q?{returnTo:q}:void 0)}function d(Q,J){const{uid:q,type:X}=Q;return(0,c.G)("/explore",{left:JSON.stringify({datasource:Q.uid,queries:[{refId:"A",datasource:{uid:q,type:X},expr:J}],range:{from:"now-1h",to:"now"}})})}function D(Q,J=""){return(0,c.G)(`/alerting/notifications/receivers/${encodeURIComponent(Q)}/edit`,{alertmanager:J})}function b(Q,J=""){return(0,c.G)("/alerting/notifications",{search:Q,tab:"contact_points",alertmanager:J})}function E(Q,J=""){return(0,c.G)("/alerting/routes/mute-timing/edit",{muteName:Q,alertmanager:J})}function v(Q){if((0,l.X4)(Q)||(0,l.Mj)(Q))return(0,c.z)(`/alerting/${encodeURIComponent(Q.ruleSourceName)}/${encodeURIComponent((0,a.PH)(Q.ruleName))}/find`);if((0,l.A4)(Q))return(0,c.z)(`/alerting/grafana/${Q.uid}/view`)}function C(Q){return Q.reduce((J,{key:q,value:X})=>(J[q]=X,J),{})}const S=Q=>{const J=Q.queryString===void 0?void 0:String(Q.queryString),q=Q.alertState===void 0?void 0:String(Q.alertState),X=Q.dataSource===void 0?void 0:String(Q.dataSource),se=Q.ruleType===void 0?void 0:String(Q.ruleType),oe=Q.groupBy===void 0?void 0:String(Q.groupBy).split(",");return{queryString:J,alertState:q,dataSource:X,groupBy:oe,ruleType:se}},O=Q=>({queryString:Q.get("queryString")??void 0,contactPoint:Q.get("contactPoint")??void 0}),I=Q=>{const J=Q.queryString===void 0?void 0:String(Q.queryString),q=Q.silenceState===void 0?void 0:String(Q.silenceState);return{queryString:J,silenceState:q}};function R(Q){return Object.entries(Q).map(([J,q])=>({key:J,value:q}))}function T(Q,J,q){const X=new URLSearchParams(q);return J&&X.set(u.DD,J),`${Q}?${X.toString()}`}function L(Q,J){const q=new URLSearchParams;return q.append("alertmanager",Q),(0,g.J9)(J).forEach((se,oe)=>q.append(oe,se)),(0,c.G)("/alerting/silence/new",q)}function K(Q){return(0,c.G)(`/datasources/edit/${Q}`)}function A(Q){return(0,c.G)(`/dashboards/f/${Q}`)}function W(Q,J){return createRelativeUrl(`/dashboards/f/${Q}/${J}/alerting`)}function N(Q){return createRelativeUrl(`/dashboards/f/${Q}/settings`)}function w(Q){return(0,c.G)(`/d/${encodeURIComponent(Q)}`)}function j(Q,J){const q=new URLSearchParams({viewPanel:J});return(0,c.G)(`/d/${encodeURIComponent(Q)}`,q)}function V(Q,J,q,X=1e3){const se=new Date().getTime(),oe=()=>Q().catch(ae=>{if(J(ae)&&new Date().getTime()-se<q)return new Promise(ie=>setTimeout(ie,X)).then(oe);throw ae});return oe()}const U={[h.Gi.Alerting]:1,[h.cF.Firing]:1,[h.Gi.Error]:1,[h.Gi.Pending]:2,[h.Gi.Recovering]:2,[h.cF.Pending]:2,[h.cF.Recovering]:2,[h.cF.Inactive]:2,[h.Gi.NoData]:3,[h.Gi.Normal]:4};function F(Q,J){if(Q===f.xB.Importance)return(0,t.sortBy)(J,X=>[U[(0,h.lh)(X.state)],(0,l.RI)(X).toLocaleLowerCase()]);if(Q===f.xB.TimeAsc)return(0,t.sortBy)(J,X=>[new Date(X.activeAt)||new Date,(0,l.RI)(X).toLocaleLowerCase()]);if(Q===f.xB.TimeDesc)return(0,t.sortBy)(J,X=>[new Date(X.activeAt)||new Date,(0,l.RI)(X).toLocaleLowerCase()]).reverse();const q=(0,t.sortBy)(J,X=>(0,l.RI)(X).toLocaleLowerCase());return Q===f.xB.AlphaDesc&&q.reverse(),q}function M(){return o.$.buildInfo.edition===r.r.OpenSource}function H(){return m.TP.hasRole("Admin")||m.TP.isGrafanaAdmin}function _(){return o.$.buildInfo.env==="development"}function Z(Q){return!!(Q&&typeof Q=="object"&&"message"in Q)}function ne(Q){return(0,x.jX)(Q)&&Q.data.details?Q.data.details.uid:Q.cause}function te(Q,J){return Q?ne(Q)===J:!1}function Y(Q){if((0,s.NF)(Q)){if((0,x.jX)(Q)&&Q.data.details){const X=(0,x.j2)(Q.data.details.uid);if(X)return X}return Q.message?Q.message:"message"in Q.data&&typeof Q.data.message=="string"?Q.data.message:Q.statusText?Q.statusText:String(Q.status)||"Unknown error"}if(!Z(Q))return String(Q);const q=ne(Q);if(typeof q=="string"){const X=(0,x.j2)(q);
163if(X)return X}return Q.cause?`${Q.message}, cause: ${Y(Q.cause)}`:Q.message}},29442:(ee,B,e)=>{"use strict";e.d(B,{Mo:()=>s,PP:()=>a,TN:()=>m,tx:()=>o});var t=e(39187),n=e(94646),r=e(92367);const o=(l,f)=>{const h=new URLSearchParams([["search",l.map(([u,i])=>`${u}:"${i}"`).join(" ")]]);return(0,r.G)("/alerting/list",h,{skipSubPath:f?.skipSubPath})},s=(l={},f)=>(0,r.G)("/alerting/list",l,{skipSubPath:f?.skipSubPath}),m={detailsPageLink:(l,f,h,u)=>{const i=u?.includeReturnTo?{returnTo:(0,t.w)()}:{};return(0,r.G)(`/alerting/${l}/namespaces/${encodeURIComponent(f)}/groups/${encodeURIComponent(h)}/view`,i)},detailsPageLinkFromGroupIdentifier:l=>{const{groupOrigin:f,namespace:h,groupName:u}=l;return f==="grafana"?m.detailsPageLink("grafana",h.uid,u):m.detailsPageLink(l.rulesSource.uid,h.name,u)},editPageLink:(l,f,h,u)=>{const i=u?.includeReturnTo?{returnTo:(0,t.w)()}:{};return(0,r.G)(`/alerting/${l}/namespaces/${encodeURIComponent(f)}/groups/${encodeURIComponent(h)}/edit`,i,{skipSubPath:u?.skipSubPath})}},a={detailsPageLink:(l,f,h)=>(0,r.G)(`/alerting/${encodeURIComponent(l)}/${encodeURIComponent((0,n.$9)(f))}/view`,h)}},48442:(ee,B,e)=>{"use strict";e.d(B,{Rs:()=>o,W$:()=>h,Wn:()=>i,_I:()=>u,rJ:()=>a});var t=e(2543),n=e.n(t),r=e(63895);const o=["receiver","group_by","group_wait","group_interval","repeat_interval"];function s(x,g){const p=matchLabelsSet(x,g),c=new Map(g.map(y=>[y,{match:!1,matcher:null}]));return x.forEach(y=>{const P=g.find(d=>isLabelMatch(y,d));P&&c.set(P,{match:!0,matcher:y})}),{matches:p,labelsMatch:c}}function m(x,g){let p=[];const c=s(x.object_matchers??[],g);if(!c.matches)return[];if(x.routes)for(const y of x.routes){const P=m(y,g);if(p=p.concat(P),P.length&&!y.continue)break}return p.length===0&&p.push({route:x,labelsMatch:c.labelsMatch}),p}function a(x){function g(c){c.object_matchers=(0,r.J$)(c),delete c.matchers,delete c.match,delete c.match_re,c.routes?.forEach(g)}const p=structuredClone(x);return g(p),p}function l(x){function g(c){c.object_matchers=c.object_matchers?.map(([y,P,d])=>[unquoteWithUnescape(y),P,unquoteWithUnescape(d)]),c.routes?.forEach(g)}const p=structuredClone(x);return g(p),p}function f(x,g,p){const c=[];return p.reduce((y,P)=>{const d=P.alerts.filter(D=>{const b=Object.entries(D.labels);return m(x,b).some(E=>E.route===g)});return d.length&&y.push({...P,alerts:d}),y},c)}function h(x,g,p){const y={...(0,t.pick)(x,o),...p};return(0,t.reduce)(y,(d,D,b)=>{const E=D!=null,S=[void 0,"",null].some(R=>g[b]===R)&&E,O=b==="group_by"&&E&&(0,t.isArray)(g[b])&&g[b]?.length===0;return(S||O)&&(d[b]=D),d},{})}function u(x){return{...x,routes:x.routes?.map(g=>{const p=h(x,g);return u({...g,...p})})}}function i(x,g,p){const c={...x};return c.receiver===g&&(c.receiver=p),c.routes&&(c.routes=c.routes.map(y=>i(y,g,p))),c}},72930:(ee,B,e)=>{"use strict";e.d(B,{u:()=>t});function t(n,r,o,s={}){return{propertyName:n,label:r,description:o,element:"input",inputType:"",required:!1,secure:!1,placeholder:"",validationRule:"",showWhen:{field:"",is:""},dependsOn:"",...s}}},36200:(ee,B,e)=>{"use strict";e.d(B,{$I:()=>u,BU:()=>b,CZ:()=>g,J7:()=>f,ML:()=>E,Vf:()=>d,Xw:()=>h,jA:()=>a,p0:()=>p,t4:()=>D,v5:()=>i});var t=e(65307),n=e(32899),r=e(68143),o=e(73427),s=e(74268),m=e(77256);const a=Object.freeze({loading:!1,result:void 0,error:void 0,dispatched:!1});function l(v,C=a,S){if(v.pending.match(S))return{result:C.result,loading:!0,error:C.error,dispatched:!0,requestId:S.meta.requestId};if(v.fulfilled.match(S)){if(C.requestId===void 0||C.requestId===S.meta.requestId)return{...C,result:S.payload,loading:!1,error:void 0}}else if(v.rejected.match(S)&&C.requestId===S.meta.requestId)return{...C,loading:!1,error:S.error};return C}function f(v,C){return(0,t.Z0)({name:v,initialState:a,reducers:{},extraReducers:S=>S.addDefaultCase((O,I)=>l(C,O,I))})}function h(v,C,S){return(0,t.Z0)({name:v,initialState:{},reducers:{},extraReducers:O=>O.addDefaultCase((I,R)=>{if((0,t.$S)(C)(R)){const T=R,L=S(T.meta.arg);return{...I,[L]:l(C,I[L],T)}}return I})})}function u(v){return v.catch(C=>{throw{message:g(C),code:C.statusCode}})}function i(v,C){return v.then(S=>(C.successMessage&&o.lE.emit(n.r1.alertSuccess,[C.successMessage]),S)).catch(S=>{const O=g(S);throw o.lE.emit(n.r1.alertError,[`${C.errorMessage??"Error"}: ${O}`]),S})}const x="Unknown Error";function g(v){if((0,r.NF)(v))if(v.data?.message){let C=v.data?.message;return typeof v.data?.error=="string"&&(C+=`; ${v.data.error}`),C}else{if(Array.isArray(v.data)&&v.data.length&&v.data[0]?.message)return v.data.map(C=>C?.message).filter(C=>!!C).join(" ");if(v.statusText)return v.statusText}return(0,m.u7)(v)?v.message:((0,s.fH)(s.le.unknownMessageFromError,{error:JSON.stringify(v)}),x)}function p(v){return Object.values(v).every(c)}function c(v){return v.dispatched&&!v.loading}function y(v){return Object.values(v).every(P)}function P(v){return v.dispatched&&!v.loading&&!v.error}function d(v){return Object.values(v).some(E)}function D(v){return Object.values(v).some(C=>C.dispatched)}function b(v){return Object.values(v).some(P)}function E(v){return v?v.dispatched&&v.loading:!1}},67923:(ee,B,e)=>{"use strict";e.d(B,{AB:()=>l,AS:()=>f,HO:()=>x,I8:()=>h,KR:()=>p,dn:()=>i,eM:()=>g});var t=e(1932),n=e(2543),r=e.n(n),o=e(46635),s=e(84266),m=e(42824),a=e(33998);const l=(P,d,D)=>
163{if(!g(d.id??"",D))throw new Error(`No such route with ID '${d.id}'`,{cause:a.g2});function E(v){let C=v;if(v.id===d.id){const S=(0,m.SJ)(P,d,D);C={...v,...S}}return{...C,routes:v.routes?.map(E)}}return E(D)},f=(P,d)=>{if(P===d.id)throw new Error("You cant remove the root policy");function D(b){return{...b,routes:b.routes?.reduce((E=[],v)=>(v.id===P||E.push(D(v)),E),[])}}return D(d)},h=(P,d,D,b,E)=>{const v=(0,m.SJ)(P,d,b);return(0,t.jM)(b,C=>{const[S,O,I]=u(C,D);if(S===void 0||O===void 0||I===void 0)throw new Error(`could not find reference route "${D}" in tree`,{cause:a.g2});E==="child"&&(S.routes?S.routes.push(v):S.routes=[v]),E==="above"&&(O.routes=o.insertBeforeImmutably(O.routes??[],v,I)),E==="below"&&(O.routes=o.insertAfterImmutably(O.routes??[],v,I))})};function u(P,d){let D,b,E;function v(C,S,O){D||(C.id===d&&(D=C,b=O,E=S),C.routes&&C.routes.forEach((I,R)=>v(I,R,C)))}return v(P,0,P),[D,b,E]}function i(P){return(0,n.omit)({...P,routes:P.routes?.map(d=>i(d))},"id")}function x(P){return(0,t.jM)(P,d=>{d.spec.routes=d.spec.routes.map(i)})}function g(P,d){return d.id===P?d:d.routes?.find(D=>g(P,D))}function p(P){const d=JSON.stringify(c(P));let D=0;for(let b=0;b<d.length;b++){const E=d.charCodeAt(b);D=(D<<5)-D+E,D=D&D}return D.toString(36)}function c(P){return{receiver:P.receiver??"",group_by:P.group_by?[...P.group_by].sort():[],continue:P.continue??!1,object_matchers:P.object_matchers?[...P.object_matchers].sort():[],matchers:P.matchers?[...P.matchers].sort():[],match:P.match?y(P.match):{},match_re:P.match_re?y(P.match_re):{},group_wait:P.group_wait??"",group_interval:P.group_interval??"",repeat_interval:P.repeat_interval??"",routes:P.routes??[],mute_time_intervals:P.mute_time_intervals?[...P.mute_time_intervals].sort():[],active_time_intervals:P.active_time_intervals?[...P.active_time_intervals].sort():[],provenance:P.provenance??"",[s.uz]:{}}}function y(P){const d={};return Object.keys(P).sort().forEach(D=>{d[D]=P[D]}),d}},20437:(ee,B,e)=>{"use strict";e.d(B,{Bu:()=>te,J6:()=>H,Os:()=>D,Q8:()=>d,QX:()=>K,Qk:()=>W,XI:()=>N,Z9:()=>S,l1:()=>b,mY:()=>Y,mp:()=>M,qO:()=>w,zQ:()=>A});var t=e(22592),n=e(17548),r=e(39796),o=e(43173),s=e(78282),m=e(36580),a=e(56838),l=e(8285),f=e(4651),h=e(2954),u=e(84523),i=e(6194),x=e(67817),g=e(95443),p=e(52161),c=e(77256),y=e(29609),P=e(15629);const d="grafana.alerting.manualRouting",D="grafana.alerting.simplifiedQueryEditor";function b(Q){const{name:J,expression:q,forTime:X,forTimeUnit:se,keepFiringForTime:oe,keepFiringForTimeUnit:ae,type:ie}=Q,fe=(0,c.Sl)(O(Q.annotations)),pe=(0,c.Sl)(I(Q.labels));if(ie===x.Z.cloudAlerting){let de;return oe&&ae&&(de=`${oe}${ae}`),{alert:J,for:`${X}${se}`,keep_firing_for:de,annotations:fe,labels:pe,expr:q}}else if(ie===x.Z.cloudRecording)return{record:J,labels:pe,expr:q};throw new Error(`unexpected rule type: ${ie}`)}function E(Q,J){const q=[...(0,c.KT)(Q||{})];return J&&q.push({key:"",value:""}),q}function v(Q,J){if(J?.grafana?.selectedContactPoint&&Q)return{receiver:J?.grafana?.selectedContactPoint,mute_time_intervals:J?.grafana?.muteTimeIntervals,group_by:J?.grafana?.overrideGrouping?J?.grafana?.groupBy:void 0,group_wait:J?.grafana?.overrideTimings&&J?.grafana?.groupWaitValue?J?.grafana?.groupWaitValue:void 0,group_interval:J?.grafana?.overrideTimings&&J?.grafana?.groupIntervalValue?J?.grafana?.groupIntervalValue:void 0,repeat_interval:J?.grafana?.overrideTimings&&J?.grafana?.repeatIntervalValue?J?.grafana?.repeatIntervalValue:void 0}}function C(Q){return{simplified_query_and_expressions_section:Q.simplifiedQueryEditor,simplified_notifications_section:Q.simplifiedNotificationEditor}}function S(Q){const{name:J,condition:q,noDataState:X,execErrState:se,evaluateFor:oe,keepFiringFor:ae,queries:ie,isPaused:fe,contactPoints:pe,manualRouting:de,type:le,metric:me,targetDatasourceUid:De,missingSeriesEvalsToResolve:Te}=Q;if(!q)throw new Error("You cannot create an alert rule without specifying the alert condition");const Ne=v(de,pe),Ce=Q.editorSettings?{editor_settings:C(Q.editorSettings)}:void 0,He=(0,c.Sl)(O(Q.annotations)),ke=(0,c.Sl)(I(Q.labels)),Me=(0,y.Mu)(le),$e=(0,y.pq)(le);if(Me)return{grafana_alert:{title:J,condition:q,data:ie.map(Z),is_paused:!!fe,no_data_state:X,exec_err_state:se,notification_settings:Ne,metadata:Ce,missing_series_evals_to_resolve:Te?Number(Te):0},annotations:He,labels:ke,for:oe,keep_firing_for:ae};if($e)return{grafana_alert:{title:J,condition:q,data:ie.map(Z),is_paused:!!fe,record:{metric:me??J,from:q,target_datasource_uid:De}},annotations:He,labels:ke};throw new Error(`Failed to convert form values to Grafana rule: unknown type ${le}`)}const O=Q=>Q.map(R).filter(({key:J,value:q})=>!!J&&!!q),I=Q=>Q.map(R).filter(({key:J})=>!!J),R=({key:Q,value:J})=>({key:Q.trim(),value:J.trim()});function T(Q){const J=Q.notification_settings?{selectedContactPoint:Q.notification_settings.receiver,muteTimeIntervals:Q.notification_settings.mute_time_intervals??[],overrideGrouping:Array.isArray(Q.notification_settings.group_by)&&Q.notification_settings.group_by.length>0,overrideTimings:[Q.notification_settings.group_wait,Q.notification_settings.group_interval,Q.notification_settings.repeat_interval].some(Boolean),groupBy:Q.notification_settings.group_by||[],groupWaitValue:Q.notification_settings.group_wait||"",groupIntervalValue:Q.notification_settings.group_interval||"",repeatIntervalValue:Q.notification_settings.repeat_interval||""}:void 0;return J?{[p.hY]:J}:void 0}function L(Q){if(o.$.featureToggles.alertingQueryAndExpressionsStepMode)return Q.metadata?.editor_settings?{simplifiedQueryEditor:Q.metadata.editor_settings.simplified_query_and_expressions_section,simplifiedNotificationEditor:Q.metadata.editor_settings.simplified_notifications_section}:{simplifiedQueryEditor:!1,simplifiedNotificationEditor:!!Q.notification_settings}}function K(Q){const{ruleSourceName:J,namespace:q,group:X,rule:se}=Q,oe=(0,u.IJ)();if((0,p.z2)(J))if(y.p.grafana.recordingRule(se)){const ae=se.grafana_alert;return{...oe,name:ae.title,type:x.Z.grafanaRecording,group:X.name,evaluateEvery:X.interval||oe.evaluateEvery,queries:ae.data,condition:ae.condition,annotations:(0,i.JE)(E(se.annotations,!1)),labels:E(se.labels,!0),folder:{title:q,uid:ae.n
163amespace_uid},isPaused:ae.is_paused,metric:ae.record?.metric,targetDatasourceUid:ae.record?.target_datasource_uid}}else if(y.p.grafana.rule(se)){const ae=se.grafana_alert,ie=T(ae);if(ae.no_data_state!==void 0&&ae.exec_err_state!==void 0)return{...oe,name:ae.title,type:x.Z.grafana,group:X.name,evaluateEvery:X.interval||oe.evaluateEvery,evaluateFor:se.for||"0",keepFiringFor:se.keep_firing_for||"0",noDataState:ae.no_data_state,execErrState:ae.exec_err_state,queries:ae.data,condition:ae.condition,annotations:(0,i.JE)(E(se.annotations,!1)),labels:E(se.labels,!0),folder:{title:q,uid:ae.namespace_uid},isPaused:ae.is_paused,contactPoints:ie,manualRouting:!!ie,editorSettings:L(ae),missingSeriesEvalsToResolve:ae.missing_series_evals_to_resolve};throw new Error("Unexpected type of rule for grafana rules source")}else throw new Error("Unexpected type of rule for grafana rules source");else if(y.p.dataSource.alertingRule(se)){const ie={refId:"A",datasourceUid:(0,s.l)().getInstanceSettings(J)?.uid??"",queryType:"",relativeTimeRange:(0,t.Cn)(),expr:se.expr,model:{refId:"A",hide:!1,expr:se.expr}},fe=W(se);return{...oe,...fe,queries:[ie],annotations:(0,i.JE)(E(se.annotations,!1)),type:x.Z.cloudAlerting,dataSourceName:J,namespace:q,group:X.name}}else if(y.p.dataSource.recordingRule(se)){const ae=N(se);return{...oe,...ae,type:x.Z.cloudRecording,dataSourceName:J,namespace:q,group:X.name}}else throw new Error("Unexpected type of rule for cloud rules source")}function A(Q,J){const q=(0,u.IJ)(),X=Q.grafana_alert,se=Q.for,oe=Q.keep_firing_for,ae=Q.annotations,ie=Q.labels,fe={...q,name:X.title,queries:X.data,condition:X.condition,annotations:(0,i.JE)(E(ae,!1)),labels:E(ie,!0),folder:{title:J,uid:X.namespace_uid},isPaused:X.is_paused};if(y.p.grafana.recordingRule(Q))return{...fe,type:x.Z.grafanaRecording,group:X.rule_group,metric:X.record?.metric};const pe=T(X);if(X.no_data_state!==void 0&&X.exec_err_state!==void 0)return{...fe,type:x.Z.grafana,group:X.rule_group,evaluateFor:se||"0",keepFiringFor:oe||"0",noDataState:X.no_data_state,execErrState:X.exec_err_state,contactPoints:pe,manualRouting:!!pe,editorSettings:L(X)};throw new Error("Unexpected type of rule for grafana rules source")}function W(Q){const J=(0,u.IJ)(),[q,X]=Q.for?(0,P.P1)(Q.for):[0,"s"],[se,oe]=Q.keep_firing_for?(0,P.P1)(Q.keep_firing_for):[J.keepFiringForTime,J.keepFiringForTimeUnit];return{name:Q.alert,expression:Q.expr,forTime:q,forTimeUnit:X,keepFiringForTime:se,keepFiringForTimeUnit:oe,annotations:E(Q.annotations,!1),labels:E(Q.labels,!0)}}function N(Q){return{name:Q.record,expression:Q.expr,labels:E(Q.labels,!0)}}const w=(Q=!1)=>{const J=(0,p.y9)();if(!J)return[...Q?U("A"):V("A","B")];const q=(0,t.Cn)(),X=Q?U("B"):V("B","C"),se=J?(0,p.cl)(J.type):!1;return[{refId:"A",datasourceUid:J.uid,queryType:"",relativeTimeRange:q,model:{refId:"A",instant:se?!0:void 0}},...X]},j=Q=>{const J=getDefaultRelativeTimeRange();return[{refId:"A",datasourceUid:Q[0]?.uid||"",queryType:"",relativeTimeRange:J,model:{refId:"A"}}]},V=(...Q)=>{const J=Q[0],q=Q[1],X={refId:Q[0],type:f.Tz.reduce,datasource:{uid:f.Uj,type:m.dR.type},conditions:[{type:"query",evaluator:{params:[],type:h.p.IsAbove},operator:{type:"and"},query:{params:[J]},reducer:{params:[],type:"last"}}],reducer:"last",expression:"A"},se={refId:q,type:f.Tz.threshold,datasource:{uid:f.Uj,type:m.dR.type},conditions:[{type:"query",evaluator:{params:[0],type:h.p.IsAbove},operator:{type:"and"},query:{params:[q]},reducer:{params:[],type:"last"}}],expression:J};return[{refId:J,datasourceUid:f.Uj,queryType:"",model:X},{refId:q,datasourceUid:f.Uj,queryType:"",model:se}]},U=Q=>{const J={refId:Q,type:f.Tz.reduce,datasource:{uid:f.Uj,type:m.dR.type},conditions:[{type:"query",evaluator:{params:[],type:h.p.IsAbove},operator:{type:"and"},query:{params:[Q]},reducer:{params:[],type:"last"}}],reducer:"last",expression:"A"};return[{refId:Q,datasourceUid:f.Uj,queryType:"",model:J}]},F=async(Q,J,q,X,se,oe)=>{const ae=[];for(const ie of Q){const fe=await(0,s.l)().get(ie.datasource?.uid?ie.datasource:X),pe={uid:fe.uid,type:fe.type},de=n.relativeToTimeRange(J),{interval:le,intervalMs:me}=_(de,oe??fe.interval,se),De={__interval:{text:le,value:le},__interval_ms:{text:me,value:me},...q},Te=fe.interpolateVariablesInQueries?fe.interpolateVariablesInQueries([ie],De)[0]:ie;if(pe.uid===f.Uj){const Ne={refId:Te.refId,queryType:"",relativeTimeRange:J,datasourceUid:f.Uj,model:Te};ae.push(Ne)}else{const Ne=(0,s.l)().getInstanceSettings(pe);
163if(Ne&&Ne.meta.alerting){const Ce={refId:Te.refId,queryType:Te.queryType??"",relativeTimeRange:J,datasourceUid:Ne.uid,model:{...Te,maxDataPoints:se,intervalMs:me}};ae.push(Ce)}}}return ae},M=async(Q,J)=>{const{targets:q}=Q;if(!Q.id||!J.uid)return;const X=n.timeRangeToRelative(n.convertRawToRange(J.time)),se=await F(q,X,Q.scopedVars||{},Q.datasource??void 0,Q.maxDataPoints??void 0,Q.interval??void 0);if(!se.length||!se.find(pe=>pe.datasourceUid!==f.Uj))return;if(!se.find(pe=>pe.datasourceUid===f.Uj)){const[pe,de]=V((0,r.M)(se),"-");se.push(pe);const[le,me]=V(pe.refId,(0,r.M)(se));se.push(me)}const{folderTitle:oe,folderUid:ae}=J.meta,ie=ae&&oe?{kind:"folder",uid:ae,title:oe}:void 0;return{type:x.Z.grafana,folder:ie,queries:se,name:Q.title,condition:se[se.length-1].refId,annotations:[{key:g.YH.dashboardUID,value:J.uid},{key:g.YH.panelID,value:String(Q.id)}]}},H=async Q=>{if(!Q.state.key)return;const J=a.jh.getTimeRange(Q),q=(0,l.un)(Q);if(!q)return;const{queries:X,datasource:se,maxDataPoints:oe,minInterval:ae}=q.state,ie=(0,l.YQ)(Q);if(!ie||!ie.state.uid)return;const fe=await F(X,n.timeRangeToRelative(n.convertRawToRange(J.state.value.raw)),{__sceneObject:{value:Q}},se,oe,ae);if(!fe.length||!fe.find(De=>De.datasourceUid!==f.Uj))return;if(!fe.find(De=>De.datasourceUid===f.Uj)){const[De,Te]=V((0,r.M)(fe),"-");fe.push(De);const[Ne,Ce]=V(De.refId,(0,r.M)(fe));fe.push(Ce)}const{folderTitle:pe,folderUid:de}=ie.state.meta,le=de&&pe?{kind:"folder",uid:de,title:pe}:void 0;return{type:x.Z.grafana,folder:le,queries:fe,name:Q.state.title,condition:fe[fe.length-1].refId,annotations:[{key:g.YH.dashboardUID,value:ie.state.uid},{key:g.YH.panelID,value:String((0,l.Cs)(Q))}]}};function _(Q,J,q){return q?n.calculateInterval(Q,q,J):J&&n.intervalToMs(J)>1e3?{interval:J,intervalMs:n.intervalToMs(J)}:{interval:"1s",intervalMs:1e3}}function Z(Q){const J=Q.model;return ne(J)&&J.instant&&J.range?{...Q,model:{...J,range:!0,instant:!1}}:Q}function ne(Q){return"expr"in Q&&"instant"in Q&&"range"in Q}function te(Q){return"expr"in Q}function Y(Q){const J=Q.datasourceUid??Q.model.datasource?.uid;if(!J)return;const q=(0,s.l)().getInstanceSettings(J)?.type;if(!q||!(0,p.cl)(q))return;const{model:X}=Q,se="instant"in X&&X.instant!==void 0?X.instant:!0,oe="queryType"in X&&X.queryType!==void 0?X.queryType==="instant":!0;return(0,p.bS)(q)?se:oe}},94646:(ee,B,e)=>{"use strict";e.d(B,{$9:()=>C,LC:()=>p,Lg:()=>i,Ns:()=>O,P1:()=>f,PH:()=>D,Tn:()=>T,UP:()=>x,VY:()=>A,c:()=>b,co:()=>h,h1:()=>L,jY:()=>R,mw:()=>u,qg:()=>E,uE:()=>W,vL:()=>I,x6:()=>v});var t=e(2543),n=e.n(t),r=e(36490),o=e(24619),s=e(74268),m=e(74869),a=e(52161),l=e(29609);function f(N,w,j,V){return l.p.grafana.rule(V)?{uid:V.grafana_alert.uid,ruleSourceName:"grafana"}:{ruleSourceName:N,namespace:w,groupName:j,ruleName:(0,l.qz)(V),rulerRuleHash:O(V)}}function h(N,w){if(N.groupOrigin==="grafana"){if(l.p.grafana.rule(w))return{uid:w.grafana_alert.uid,ruleSourceName:"grafana"};throw(0,s.vV)(new Error("Rule is not a Grafana Ruler rule")),new Error("Rule is not a Grafana Ruler rule")}return f(N.rulesSource.name,N.namespace.name,N.groupName,w)}function u(N,w){const{dataSourceName:j,namespaceName:V,groupName:U}=N;return f(j,V,U,w)}function i(N,w,j,V){return{ruleSourceName:N,namespace:w,groupName:j,ruleName:V.name,ruleHash:R(V)}}function x(N,w){const j=w.namespace.name,V=w.group.name;if(w.rulerRule)return f(N,j,V,w.rulerRule);if(w.promRule)return i(N,j,V,w.promRule);throw new Error("Could not create an id for a rule that is missing both `rulerRule` and `promRule`.")}function g(N){return f(N.ruleSourceName,N.namespace,N.group.name,N.rule)}function p(N,w){return(0,l.A4)(N)&&(0,l.A4)(w)?N.uid===w.uid:(0,l.X4)(N)&&(0,l.X4)(w)?N.groupName===w.groupName&&N.namespace===w.namespace&&N.ruleName===w.ruleName&&N.rulerRuleHash===w.rulerRuleHash&&N.ruleSourceName===w.ruleSourceName:(0,l.Mj)(N)&&(0,l.Mj)(w)?N.groupName===w.groupName&&N.namespace===w.namespace&&N.ruleName===w.ruleName&&N.ruleHash===w.ruleHash&&N.ruleSourceName===w.ruleSourceName:(0,l.X4)(N)&&(0,l.Mj)(w)?N.groupName===w.groupName&&N.namespace===w.namespace&&N.ruleName===w.ruleName&&N.rulerRuleHash===w.ruleHash&&N.ruleSourceName===w.ruleSourceName:(0,l.Mj)(N)&&(0,l.X4)(w)?N.groupName===w.groupName&&N.namespace===w.namespace&&N.ruleName===w.ruleName&&N.ruleHash===w.rulerRuleHash&&N.ruleSourceName===w.ruleSourceName:!1}const c="cri",y="pri";function P(N){return N.replace(/\$/g,"_DOLLAR_")}function d(N){return N.replace(/\_DOLLAR\_/g,"$")}function D(N){return N.replace(/\//g,"�").replace(/\\/g,"�")}function b(N){return N.replace(/\x1f/g,"/").replace(/\x1e/g,"\\")}
163function E(N,w=!1){const V=(w?decodeURIComponent(N):N).split("$");if(V.length===1)return{uid:N,ruleSourceName:"grafana"};if(V.length===6){const[U,F,M,H,_,Z]=V.map(d).map(b);if(U===c)return{ruleSourceName:F,namespace:M,groupName:H,ruleName:_,rulerRuleHash:Z};if(U===y)return{ruleSourceName:F,namespace:M,groupName:H,ruleName:_,ruleHash:Z}}throw new Error(`Failed to parse rule location: ${N}`)}function v(N,w=!1){if(N)try{return E(N,w)}catch{return}}function C(N){return(0,l.A4)(N)?N.uid:(0,l.X4)(N)?[c,N.ruleSourceName,N.namespace,N.groupName,N.ruleName,N.rulerRuleHash].map(String).map(P).map(D).join("$"):[y,N.ruleSourceName,N.namespace,N.groupName,N.ruleName,N.ruleHash].map(String).map(P).map(D).join("$")}function S(N){let w=0;if(N.length===0)return w;for(let j=0;j<N.length;j++){const V=N.charCodeAt(j);w=(w<<5)-w+V,w=w&w}return w}function O(N){if(l.p.grafana.rule(N))return N.grafana_alert.uid;const j=!(0,m.wS)(),V=I(N,j);return S(JSON.stringify(V)).toString()}function I(N,w){const j=w?L(N.expr):"",V=K(N.labels);if(l.p.dataSource.recordingRule(N))return[N.record,o.JS.Recording,j,V];if(l.p.dataSource.alertingRule(N))return[N.alert,o.JS.Alerting,j,K(N.annotations),V];throw new Error("Only recording and alerting ruler rules can be hashed")}function R(N){const j=!(0,m.wS)(),V=T(N,j);return S(JSON.stringify(V)).toString()}function T(N,w){const j=w?L(N.query):"",V=K(N.labels);if(l.R$.recordingRule(N))return[N.name,o.JS.Recording,j,V];if(l.R$.alertingRule(N))return[N.name,o.JS.Alerting,j,K(N.annotations),V];throw new Error("Only recording and alerting rules can be hashed")}function L(N){return N.length>1&&N[0]==="("&&N[N.length-1]===")"&&(N=N.slice(1,-1)),N=N.replace(/\s|\n/g,""),N.split("").sort().join("")}function K(N){return JSON.stringify(Object.entries(N||{}).sort((w,j)=>w[0].localeCompare(j[0])))}function A(N){return(0,l.A4)(N)?a.hY:N.ruleSourceName}function W(N){const{pathname:w=""}=r.Ny.getLocation(),{id:j}=N;return j?(0,t.nth)(w.split("/"),-2):void 0}},29609:(ee,B,e)=>{"use strict";e.d(B,{$7:()=>I,A4:()=>R,BL:()=>Te,Cl:()=>ie,H2:()=>Ce,I2:()=>pe,Mj:()=>K,Mu:()=>me,Nv:()=>W,O9:()=>ae,OF:()=>Ne,Om:()=>q,R$:()=>S,RI:()=>O,Rh:()=>U,Sk:()=>H,TU:()=>te,Tm:()=>_,Wy:()=>Q,X4:()=>T,XI:()=>Z,YN:()=>X,dS:()=>Y,f6:()=>w,fC:()=>j,hC:()=>p,j_:()=>de,jg:()=>oe,nf:()=>L,oI:()=>N,p:()=>C,pq:()=>De,qz:()=>se,s_:()=>ke,uo:()=>F,vE:()=>He,x6:()=>d});var t=e(2543),n=e.n(t),r=e(76190),o=e(43173),s=e(24619),m=e(56369),a=e(67817),l=e(95443),f=e(52161),h=e(39659),u=e(15629);function i(Me){return typeof Me=="object"&&"grafana_alert"in Me}function x(Me){return i(Me)&&!g(Me)}function g(Me){return i(Me)&&"record"in Me.grafana_alert}function p(Me){return!!Me.grafana_alert.is_paused}function c(Me){return typeof Me=="object"&&"alert"in Me}function y(Me){return typeof Me=="object"&&!i(Me)}function P(Me){return typeof Me=="object"&&"record"in Me}function d(Me){return Me.rules.every($e=>y($e))}function D(Me){return typeof Me=="object"&&Me.type===s.JS.Alerting}function b(Me){return typeof Me=="object"&&Me.type===s.JS.Recording}function E(Me){return D(Me)&&"folderUid"in Me&&"uid"in Me}function v(Me){return b(Me)&&"folderUid"in Me&&"uid"in Me}const C={grafana:{rule:i,alertingRule:x,recordingRule:g},dataSource:{rule:y,alertingRule:c,recordingRule:P},any:{recordingRule:Me=>P(Me)||g(Me),alertingRule:Me=>c(Me)||x(Me)}},S={rule:Me=>D(Me)||b(Me),alertingRule:D,recordingRule:b,grafana:{rule:Me=>E(Me)||v(Me),alertingRule:E,recordingRule:v}};function O(Me){return JSON.stringify(Me.labels)}function I(Me){return Me.error&&Me.error?.message?.includes(l.UU)}function R(Me){return"uid"in Me}function T(Me){return"rulerRuleHash"in Me}function L(Me){return Object.values(s.JS).includes(Me)}function K(Me){return"ruleHash"in Me}function A(Me){return R(Me)||T(Me)}function W(Me){return i(Me)&&!!Me.grafana_alert.provenance}function N(Me){return Me.rules.some($e=>W($e))}function w(Me){switch(Me){case"ok":return m.Jc.Ok;case"nodata":return m.Jc.NoData;case"error":case"err":return m.Jc.Error;case"unknown":return m.Jc.Unknown;default:return}}function j(Me){if(!C.any.recordingRule(Me.rulerRule)){if(c(Me.rulerRule))return Me.rulerRule.for;if(D(Me.promRule)){const $e=(Me.promRule.duration??0)*1e3;return(0,u.an)($e)}}}function V(Me){if(!C.any.recordingRule(Me.rulerRule)&&x(Me.rulerRule))return Me.rulerRule.keep_firing_for}function U(Me){return Me?.annotations??{}}function F(Me){if(!Me)return;const $e=Me.labels?.[h.lL];if(!$e)return;const tt=$e.match(/^plugin\/(?<pluginId>.+)$/);if(!tt?.groups)return;const Ke=tt.groups.pluginId;if(M(Ke))return{pluginId:Ke}}function M(Me){return!!o.$.apps[Me]}
163function H(Me){return Me.rules.some($e=>_($e))}function _(Me){return!!F(Me)}function Z(Me){return Me===s.cF.Inactive?"Normal":(0,t.capitalize)(Me)}const ne=Me=>Me.reduce(($e,{dataSourceName:tt,name:Ke,groups:Re})=>(Re.forEach(({name:Ve,rules:Qe})=>{Qe.forEach(je=>{D(je)&&$e.push({dataSourceName:tt,namespaceName:Ke,groupName:Ve,rule:je})})}),$e),[]),te=Me=>D(Me.promRule)?Me.promRule:null,Y=Me=>Me.reduce(($e,{rulesSource:tt,name:Ke,groups:Re})=>(Re.forEach(({name:Ve,rules:Qe})=>{Qe.forEach(je=>{je.promRule&&D(je.promRule)&&$e.push({dataSourceName:(0,f.EV)(tt),namespaceName:Ke,groupName:Ve,...je,namespace:{...je.namespace,uid:je.promRule.folderUid}})})}),$e),[]);function Q(Me){let $e;return Object.values(r.O).includes(Me)?$e=Me:$e=(0,s.lh)(Me),J[$e]}const J={[s.cF.Inactive]:"good",[s.cF.Firing]:"bad",[s.cF.Pending]:"warning",[s.cF.Recovering]:"warning",[s.Gi.Alerting]:"bad",[s.Gi.Error]:"bad",[s.Gi.NoData]:"info",[s.Gi.Normal]:"good",[s.Gi.Pending]:"warning",[s.Gi.Recovering]:"warning",[r.O.NoData]:"info",[r.O.Paused]:"warning",[r.O.Alerting]:"bad",[r.O.OK]:"good",[r.O.Unknown]:"info"};function q(Me){return Me?.alerts?Me.alerts.reduce(($e,tt)=>{const Ke=(0,s.lh)(tt.state)!==s.Gi.Normal;if(tt.activeAt&&Ke){const Re=new Date(tt.activeAt);if($e===null||$e.getTime()>Re.getTime())return Re}return $e},null):null}function X(Me){return Array.isArray(Me.source_tenants)}function se(Me){return C.grafana.rule(Me)?Me.grafana_alert.title:C.dataSource.alertingRule(Me)?Me.alert:C.dataSource.recordingRule(Me)?Me.record:""}const oe=(Me,$e)=>{const tt={alertName:"",forDuration:"0s",evaluationsToFire:0};return i(Me)?{alertName:Me.grafana_alert.title,forDuration:Me.for,evaluationsToFire:Me.for?ae(Me.for,$e):null}:c(Me)?{alertName:Me.alert,forDuration:Me.for??"0s",evaluationsToFire:ae(Me.for??"0s",$e)}:tt},ae=(Me,$e)=>{const tt=(0,u.P8)($e),Ke=(0,u.P8)(Me);return Ke===0&&tt!==0?1:tt===0||Ke/tt<1?0:Math.ceil(Ke/tt)+1};function ie(Me,$e){return Me===0?1:$e===0||Me/$e<1?0:Math.ceil(Me/$e)+1}function fe(Me){const $e=isGrafanaRulesSource(Me.namespace.rulesSource)?Me.namespace.rulesSource:Me.namespace.rulesSource.name,tt=i(Me.rulerRule)?Me.rulerRule.grafana_alert.namespace_uid:Me.namespace.name;return{dataSourceName:$e,namespaceName:tt,groupName:Me.group.name}}function pe(Me){const $e=Me.ruleSourceName,tt=i(Me.rule)?Me.rule.grafana_alert.namespace_uid:Me.namespace,Ke=Me.group.name;return{dataSourceName:$e,namespaceName:tt,groupName:Ke}}function de(Me){const $e=Me.dataSourceName,tt=Me.folder?.uid??Me.namespace,Ke=Me.group;if(!$e)throw new Error("no datasource name in form values");return{dataSourceName:$e,namespaceName:tt,groupName:Ke}}function le(Me){return isGrafanaRulesSource(Me)?Me:Me.name}function me(Me){return Me===a.Z.grafana}function De(Me){return Me===a.Z.grafanaRecording}function Te(Me){return Me===a.Z.cloudAlerting}function Ne(Me){return Me===a.Z.cloudRecording}function Ce(Me){return me(Me)||De(Me)}function He(Me){return De(Me)||Ne(Me)}function ke(Me){return Te(Me)||Ne(Me)}},42801:(ee,B,e)=>{"use strict";e.d(B,{a:()=>o,o:()=>r});var t=e(2543),n=e.n(t);function r(s,m){let a=m.trim();if(!a.match(/\{\{\s*define/)){const l=a.split(` 164`).map(f=>" "+f).join(` 165`);a=`{{ define "${s}" }} 166${l} 167{{ end }}`}return a}function o(s){const m=(a,l)=>`{{ define "${l}_NEW_${(0,t.now)()}" }}`;return s.replace(/\{\{\s*define\s*\"(?<defineName>.*)\"\s*\}\}/g,m)}},15629:(ee,B,e)=>{"use strict";e.d(B,{M9:()=>f,P1:()=>n,P8:()=>u,TN:()=>s,an:()=>h,mo:()=>i,sc:()=>o,yl:()=>x});var t=e(72649);function n(g){const p=g.match(/(\d+)(\w+)/);if(p)return[Number(p[1]),p[2]];throw new Error(`Invalid interval description: ${g}`)}function r(g){const{sec:p,count:c}=rangeUtil.describeInterval(g);return p*c}const o=Object.entries(t.y).map(([g,p])=>({label:g[0].toUpperCase()+g.slice(1),value:p}));function s(g){try{return f(g),!0}catch{return!1}}const m={ms:1,s:1e3,m:60*1e3,h:60*60*1e3,d:24*60*60*1e3,w:7*24*60*60*1e3,y:365*24*60*60*1e3},a=new RegExp(/^(?:(?<value>\d+)(?<type>ms|s|m|h|d|w|y))|0$/),l=new Error(`Must be of format "(number)(unit)", for example "1m", or just "0". Available units: ${Ob
167ject.values(t.y).join(", ")}`);function f(g){let p=g;const c=[];function y(d){const D=a.exec(d),b=D?.groups?.value&&D?.groups?.type;if(!D||!b)throw l;D&&D.groups?.value&&D.groups?.type&&(p=p.replace(D[0],""),c.push([Number(D.groups.value),D.groups.type])),p&&y(p)}if(y(g),!c.length)throw l;return c.reduce((d,[D,b])=>{const E=D*m[b];return d+E},0)}function h(g){const p=Math.floor(g/1e3),c=Math.floor(p/60),y=Math.floor(c/60),P=Math.floor(y/24),d=Math.floor(P/7),D=Math.floor(P/365);return g===0?"0s":[[D,"y"],[d%52,"w"],[P%365-7*(d%52),"d"],[y%24,"h"],[c%60,"m"],[p%60,"s"],[g%1e3,"ms"]].filter(([E])=>E>0).map(([E,v])=>E+v).join("")}const u=g=>{try{return f(g)}catch{return 0}},i=g=>g.includes("0001-01-01T00");function x(g){return g%(1e3*60*60)===0?g/(1e3*60*60)+"h":g%(1e3*60)===0?g/(1e3*60)+"m":g%1e3===0?g/1e3+"s":g.toFixed()+"ms"}},92367:(ee,B,e)=>{"use strict";e.d(B,{G:()=>n,z:()=>r});var t=e(43173);function n(o,s,m={skipSubPath:!1}){const l=new URLSearchParams(s).toString();return`${m.skipSubPath?"":t.$.appSubUrl}${o}${l?`?${l}`:""}`}function r(o,s){const a=new URLSearchParams(s).toString();try{return`${new URL(t.$.appSubUrl+o,t.$.appUrl).href}${a?`?${a}`:""}`}catch{return n(o,s)}}},88547:(ee,B,e)=>{"use strict";e.d(B,{S:()=>r});var t=e(36303),n=e(74268);function r(o,s={}){return(0,t.Xc)(o,{...s,style:"page",errorLogger:n.vV})}},78767:(ee,B,e)=>{"use strict";e.d(B,{Xm:()=>o,rJ:()=>r,vJ:()=>n,vy:()=>s});var t=e(68143);function n(m){return(0,t.AI)().post("/api/annotations",m)}function r(m){return(0,t.AI)().put(`/api/annotations/${m.id}`,m)}function o(m){return(0,t.AI)().delete(`/api/annotations/${m.id}`)}async function s(){return(await(0,t.AI)().get("/api/annotations/tags")).result.tags.map(({tag:a,count:l})=>({term:a,count:l}))}},76478:(ee,B,e)=>{"use strict";e.d(B,{A:()=>C});var t=e(74848),n=e(96540),r=e(75505),o=e(28105),s=e(62392),m=e(85629),a=e(35137),l=e(68079),f=e(45861),h=e(34999),u=e(56840),i=e(22429),x=e(75421),g=e(82612),p=e(87033),c=e(90696),y=e(16515),P=e(88907),d=e(55386),D=e(45967),b=e(30703),E=e(18857);class v extends n.PureComponent{constructor(O){super(O),this.updateFields=()=>{const I=this.props.response?.panelData,R=I?.series?.[0]??I?.annotations?.[0];if(R&&R.fields){const T=R.fields.map(L=>{const K=(0,y.Ct)(L,R);let A="";for(let W=0;W<R.length;W++){if(W>0&&(A+=", "),W>2){A+="...";break}A+=L.values[W]}return A.length>50&&(A=A.substring(0,50)+"..."),{label:`${K} (${L.type})`,value:K,description:A}});this.setState({fieldNames:T})}},this.onFieldSourceChange=(I,R)=>{const T=this.props.mappings||{},L=T[I]||{};this.props.change({...T,[I]:{...L,source:R.value||P.V.Field}})},this.onFieldNameChange=(I,R)=>{const T=this.props.mappings||{};if(!R){const K={...this.props.mappings};delete K[I],this.props.change(K);return}const L=T[I]||{};this.props.change({...T,[I]:{...L,value:R.value,source:P.V.Field}})},this.state={fieldNames:[]}}componentDidMount(){this.updateFields()}componentDidUpdate(O){O.response!==this.props.response&&this.updateFields()}renderRow(O,I,R){const{fieldNames:T}=this.state;let L=[...T];const K=I.value;let A=T.find(N=>K===N.value);K&&!A&&L.push({label:K,value:K});let W=R?R[O.key]:"";if(W&&O.key.startsWith("time")){const N=(0,d.j_)("dateTimeAsIso");W=(0,d.cN)(N(W))}return W==null&&(W=""),(0,t.jsxs)("tr",{children:[(0,t.jsxs)("td",{children:[O.label||O.key," ",O.help&&(0,t.jsx)(D.m,{content:O.help,children:(0,t.jsx)(b.I,{name:"info-circle"})})]}),(0,t.jsx)("td",{children:(0,t.jsx)(E.l6,{value:A,options:L,placeholder:O.placeholder||O.key,onChange:N=>{this.onFieldNameChange(O.key,N)},noOptionsMessage:"Unknown field names",allowCustomValue:!0,isClearable:!0})}),(0,t.jsx)("td",{children:`${W}`})]},O.key)}render(){const O=this.props.response?.events?.[0],I=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)(u.x6,{i18nKey:"annotations.annotation-field-mapper.annotation",children:"Annotation"})}),(0,t.jsx)("th",{children:(0,t.jsx)(u.x6,{i18nKey:"annotations.annotation-field-mapper.from",children:"From"})}),(0,t.jsx)("th",{children:(0,t.jsx)(u.x6,{i18nKey:"annotations.annotation-field-mapper.first-value",children:"First value"})})]})}),(0,t.jsx)("tbody",{children:c.kj.map(R=>this.renderRow(R,I[R.key]||{},O))})]})}}class C extends n.PureComponent{constructor(){super(...arguments),this.state={},this.onRunQuery=async()=>{const{datasource:O,annotation:I}=this.props;if((0,c.E7)(O))return;const R=(0,i.UA)().getCurrent();if(!R)return;this.setState({running:!0});const T=await(0,r.s)((0,p.b)({range:(0,x.jG)().timeRange(),panel:new g.a9({}),dashboard:R},O,I));this.setState({running:!1,response:T})},this.onQueryChange=O=>{this.props.onChange({...this.props.annotation,target:O,...this.props.annotation.options?{options:this.props.annotation.options}:{}})},this.onMappingChange=O=>{this.props.onChange({...this.props.annotation,mappings:O})},this.onAnnotationChange=O=>{this.props.onChange({...O,...this.props.annotation.options?{options:this.props.annotation.options}:{}})}}componentDidMount(){this.verifyDataSource()}componentDidUpdate(O){this.props.annotation!==O.annotation&&!(0,c.E7)(this.props.datasource)&&this.verifyDataSource()}verifyDataSource(){const{datasource:O,annotation:I}=this.props,T={...c.CU,...O.annotations}.prepareAnnotation(I);T!==I?this.props.onChange(T):this.onRunQuery()}getStatusSeverity(O){const{events:I,panelData:R}=O;return R?.errors||R?.error?"error":I?.length?"success":"warning"}renderStatusText(O,I){const{events:R,panelData:T}=O;
167if(I||O?.panelData?.state===o.Gu.Loading||!O)return(0,t.jsx)("p",{children:"loading..."});if(T?.errors)return(0,t.jsx)(t.Fragment,{children:T.errors.map((W,N)=>(0,t.jsx)("p",{children:W.message},N))});if(T?.error)return(0,t.jsx)("p",{children:T.error.message??"There was an error fetching data"});if(!R?.length)return(0,t.jsx)("p",{children:(0,t.jsx)(u.x6,{i18nKey:"annotations.standard-annotation-query-editor.no-events-found",children:"No events found"})});const L=T?.series?.[0]??T?.annotations?.[0],K=R.length,A=L?.fields.length;return(0,t.jsx)("p",{children:(0,t.jsxs)(u.x6,{i18nKey:"annotations.standard-annotation-query-editor.events-found",children:[{numEvents:K}," events (from ",{numFields:A}," fields)"]})})}renderStatus(){const{response:O,running:I}=this.state;return O?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.$,{v:2}),(0,t.jsx)("div",{children:I?(0,t.jsx)(l.y,{}):(0,t.jsx)(f.$n,{"data-testid":m.Tp.components.Annotations.editor.testButton,variant:"secondary",size:"xs",onClick:this.onRunQuery,children:(0,t.jsx)(u.x6,{i18nKey:"annotations.standard-annotation-query-editor.test-annotation-query",children:"Test annotation query"})})}),(0,t.jsx)(a.$,{v:2,layout:"block"}),(0,t.jsx)(h.F,{"data-testid":m.Tp.components.Annotations.editor.resultContainer,severity:this.getStatusSeverity(O),title:(0,u.t)("annotations.standard-annotation-query-editor.title-query-result","Query result"),children:this.renderStatusText(O,I)})]}):null}render(){const{datasource:O,annotation:I,datasourceInstanceSettings:R}=this.props,{response:T}=this.state;let L=O.annotations?.QueryEditor||O.components?.QueryEditor;if(!L)return(0,t.jsx)("div",{children:(0,t.jsx)(u.x6,{i18nKey:"annotations.standard-annotation-query-editor.no-query-editor",children:"Annotations are not supported. This datasource needs to export a QueryEditor"})});let K=I.target;I.query&&I.query.spec&&(K={...I.query.spec});let A={...O.annotations?.getDefaultQuery?.(),...K??{refId:"Anno"}},W=I;return I.query&&I.options&&(W={...I},Object.assign(W,I.options)),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.p,{instanceSettings:R,children:(0,t.jsx)(L,{query:A,datasource:O,onChange:this.onQueryChange,onRunQuery:this.onRunQuery,data:T?.panelData,range:(0,x.jG)().timeRange(),annotation:W,onAnnotationChange:this.onAnnotationChange},O?.name)}),(0,c.JX)(O)&&(0,t.jsxs)(t.Fragment,{children:[this.renderStatus(),(0,t.jsx)(v,{response:T,mappings:I.mappings,change:this.onMappingChange})]})]})}}},87033:(ee,B,e)=>{"use strict";e.d(B,{b:()=>h});var t=e(62467),n=e(69862),r=e(81160),o=e(17548),s=e(1906),m=e(71393),a=e(90696);let l=100;function f(){return"AQ"+l++}function h(u,i,x){const g={...a.CU,...i.annotations},p={...g.getDefaultQuery?.(),...x},c=g.prepareAnnotation(p);if(!c)return(0,t.of)({});const y=g.prepareQuery(c);if(!y)return(0,t.of)({});const P=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,d=o.calculateInterval(u.range,P,i.interval),D={__interval:{text:d.interval,value:d.interval},__interval_ms:{text:d.intervalMs.toString(),value:d.intervalMs},__annotation:{text:c.name,value:c}},b={startTime:Date.now(),requestId:f(),range:u.range,maxDataPoints:P,scopedVars:D,...d,app:s.Jk.Dashboard,timezone:u.dashboard.timezone,targets:[{...y,refId:"Anno"}]};return(0,m.BN)(i,b).pipe((0,n.Z)(E=>{const v=E?.series.length?E.series:E.annotations;return v?.length?g.processEvents(c,v).pipe((0,r.T)(C=>({panelData:E,events:C}))):(0,t.of)({panelData:E,events:[]})}))}},90696:(ee,B,e)=>{"use strict";e.d(B,{CU:()=>u,E7:()=>d,JX:()=>P,kj:()=>x});var t=e(2543),n=e.n(t),r=e(62467),o=e(69862),s=e(81160),m=e(96702),a=e(95004),l=e(16515),f=e(88907),h=e(65642);const u={prepareAnnotation:D=>{if((0,t.isString)(D?.query)){const{query:b,...E}=D;return{...E,target:{refId:"annotation_query",query:b},mappings:{}}}return D},prepareQuery:D=>D.target,processEvents:(D,b)=>c(b,D.mappings)};function i(){return D=>D.pipe((0,o.Z)(b=>{if(!b?.length)return(0,r.of)(void 0);if(b.length===1)return(0,r.of)(b[0]);const E={interpolate:v=>v};return(0,r.of)(b).pipe(m.c.mergeTransformer.operator({},E),(0,s.T)(v=>v[0]))}))}const x=[{key:"time",field:D=>D.fields.find(b=>b.type===a.PU.time),placeholder:"time, or the first time field"},{key:"timeEnd",label:"end time",help:"When this field is defined, the annotation will be treated as a range"},{key:"title"},{key:"text",field:D=>D.fields.find(b=>
167b.type===a.PU.string),placeholder:"text, or the first text field"},{key:"tags",split:",",help:"The results will be split on comma (,)"},{key:"id"}],g=[{key:"color"},{key:"isRegion"},{key:"source"}],p=[...h.$W.publicDashboardAccessToken?g:[],...x,{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];function c(D,b){return(0,r.of)(D).pipe(i(),(0,s.T)(E=>{if(!E?.length)return[];let v=!1,C=!1;const S={};for(const R of E.fields){const T=(0,l.Ct)(R,E);S[T.toLowerCase()]=R}b||(b={});const O=[];for(const R of p){const T=b[R.key]||{};if(T.source===f.V.Skip)continue;const L={key:R.key,split:R.split};if(T.source===f.V.Text)L.text=T.value;else{const K=(T.value||R.key).toLowerCase();L.field=S[K],!L.field&&R.field&&(L.field=R.field(E))}(L.field||L.text)&&(O.push(L),L.key==="time"?v=!0:L.key==="text"&&(C=!0))}if(!v||!C)return console.error("Cannot process annotation fields. No time or text present."),[];const I=[];for(let R=0;R<E.length;R++){const T={type:"default",color:"red"};for(const L of O){let K;if(L.text)K=L.text;else if(L.field&&(K=L.field.values[R],K!==void 0&&L.regex)){const A=L.regex.exec(K);A&&(K=A[1]?A[1]:A[0])}K!=null&&(L.split&&typeof K=="string"&&(K=K.split(",")),T[L.key]=K)}I.push(T)}return I}))}const y=["prometheus","loki","elasticsearch","grafana-opensearch-datasource"];function P(D){const{type:b}=D;return!(b==="datasource"||y.includes(b))}function d(D){const{type:b}=D;return y.includes(b)}},78653:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>h,QB:()=>l,Ri:()=>a,Sf:()=>o,cV:()=>s,h8:()=>m});var t=e(65307);const n={hasFetched:!1,includeExpired:!1,keys:[],keysIncludingExpired:[],searchQuery:"",migrationResult:{total:0,migrated:0,failed:0,failedApikeyIDs:[0],failedDetails:[]}},r=(0,t.Z0)({name:"apiKeys",initialState:n,reducers:{apiKeysLoaded:(u,i)=>{const{keys:x,keysIncludingExpired:g}=i.payload,p=i.payload.keys.length===0&&i.payload.keysIncludingExpired.length>0?!0:u.includeExpired;return{...u,hasFetched:!0,keys:x,keysIncludingExpired:g,includeExpired:p}},setSearchQuery:(u,i)=>({...u,searchQuery:i.payload}),includeExpiredToggled:u=>({...u,includeExpired:!u.includeExpired}),isFetching:u=>({...u,hasFetched:!1}),setMigrationResult:(u,i)=>({...u,migrationResult:i.payload})}}),{apiKeysLoaded:o,includeExpiredToggled:s,isFetching:m,setSearchQuery:a,setMigrationResult:l}=r.actions,h={apiKeys:r.reducer}},54115:(ee,B,e)=>{"use strict";e.d(B,{H1:()=>c,ws:()=>g});var t=e(16126),n=e(81160),r=e(69862),o=e(65474),s=e(33160),m=e(66847),a=e(38619),l=e(68143),f=e(33184),h=e(43173),u=e(73427),i=e(85618),x=e(75735);class g{constructor(d,D=!0){this.parseListOptionsSelector=y;const b=D?`namespaces/${(0,i.G)()}/`:"";this.gvr=d,this.url=`/apis/${d.group}/${d.version}/${b}${d.resource}`}async get(d){return(0,l.AI)().get(`${this.url}/${d}`)}watch(d){const D={watch:!0,labelSelector:this.parseListOptionsSelector(d?.labelSelector),fieldSelector:this.parseListOptionsSelector(d?.fieldSelector)};if(d?.name&&(D.fieldSelector=`metadata.name=${name}`),this.gvr.group==="provisioning.grafana.app"){let E="";return D.fieldSelector?.startsWith("metadata.name=")&&(E=D.fieldSelector.substring(13)),(0,f.oF)().getStream({scope:a.qD.Watch,namespace:this.gvr.group,path:`${this.gvr.version}/${this.gvr.resource}${E}/${h.$.bootData.user.uid}`}).pipe((0,t.p)(v=>(0,a.Z7)(v)),(0,n.T)(v=>v.message))}const b=new TextDecoder;return(0,l.AI)().chunked({url:this.url,params:D,method:"GET"}).pipe((0,t.p)(E=>E.ok&&E.data instanceof Uint8Array),(0,n.T)(E=>b.decode(E.data).split(` 168`)),(0,r.Z)(E=>(0,o.H)(E)),(0,t.p)(E=>E.length>0),(0,n.T)(E=>{try{return JSON.parse(E)}catch(v){return console.warn("Invalid JSON in watch stream:",v,E),null}}),(0,t.p)(E=>E!==null),(0,s.L)({count:3,delay:1e3}),(0,m.W)(E=>{throw console.error("Watch stream error:",E),E}))}async subresource(d,D,b){return(0,l.AI)().get(`${this.url}/${d}/${D}`,b)}async list(d){const D=d||{};return D.labelSelector=this.parseListOptionsSelector(D?.labelSelector),D.fieldSelector=this.parseListOptionsSelector(D?.fieldSelector),(0,l.AI)().get(this.url,d)}async create(d,D){if(!d.metadata.name&&!d.metadata.generateName){const b=u.TP.user.login;d.metadata.generateName=b?b.slice(0,2):"g"}return p(d.metadata),(0,l.AI)().post(this.url,d,{params:D})}async update(d,D){p(d.metadata);const b=`${this.url}/${d.metadata.name}`;return(0,l.AI)().put(b,d,{params:D})}async delete(d,D){return(0,l.AI)().delete(`${this.url}/${d}`,void 0,{showSuccessAlert:D})}}function p(P){P.annotations||(P.annotations={}),P.annotations[x.Pd]=h.$.buildInfo.versionString}class c{async get(d){if(this.apiVersions)return this.apiVersions[d];const D=await(0,l.AI)().get("/apis"),b={};return D.groups.forEach(E=>{if(E.name.includes("datasource.grafana.app")){const v=E.name.split(".")[0];b[v]=E.preferredVersion.version,v.endsWith("-datasource")||(v.includes("-")?b[`${v}-datasource`]=E.preferredVersion.version:b[`grafana-${v}-datasource`]=E.preferredVersion.version)}}),this.apiVersions=b,b[d]}}const y=P=>Array.isArray(P)?P.map(d=>{const D=String(d.key),b=d.operator;switch(b){case"=":case"!=":return`${D}${b}${d.value}`;case"in":case"notin":return`${D} ${b} (${d.value.join(",")})`;case"":case"!":return`${b}${D}`;default:return null}}
168).filter(Boolean).join(","):P},75735:(ee,B,e)=>{"use strict";e.d(B,{AI:()=>x,D1:()=>D,Jw:()=>l,LH:()=>a,Pd:()=>i,Qu:()=>r,Sf:()=>m,UL:()=>c,Y5:()=>b,Y_:()=>f,ew:()=>o,fY:()=>s,hX:()=>g,hc:()=>t,hm:()=>y,nB:()=>d,qw:()=>p,w2:()=>P,xU:()=>n});const t="grafana.app/createdBy",n="grafana.app/updatedTimestamp",r="grafana.app/updatedBy",o="grafana.app/folder",s="grafana.app/message";var m=(E=>(E.Repo="repo",E.Terraform="terraform",E.Kubectl="kubectl",E.Plugin="plugin",E))(m||{});const a="grafana.app/managedBy",l="grafana.app/managerId",f="grafana.app/sourcePath",h="grafana.app/sourceChecksum",u="grafana.app/sourceTimestamp",i="grafana.app/saved-from-ui",x="grafana.app/grant-permissions",g="grafana.app/slug",p="grafana.app/dashboard-is-snapshot",c="grafana.app/dashboard-snapshot-original-url",y="grafana.app/dashboard-gnet-id",P="grafana.app/folderTitle",d="grafana.app/folderId",D="grafana.app/folderUrl",b="grafana.app/deprecatedInternalID"},69874:(ee,B,e)=>{"use strict";e.d(B,{getAuthProviderStatus:()=>u,getRegisteredAuthProviders:()=>l,initAuthConfig:()=>i});var t=e(65642),n=e(73427),r=e(83873),o=e(96673);const s=[],m={};function a(g,p){s.find(c=>c.id===g.id)||(s.push(g),p&&(m[g.id]=p))}function l(){return s}function f(g){return s.find(p=>p.id===g)}function h(g){const p=[];for(const[c,y]of Object.entries(g)){const P=s.find(d=>`auth.${d.id}`===c);if(P){const d={...y,providerId:P.id,displayName:y.name||P.displayName};p.push(d)}}return p}async function u(g){if(m[g]){const p=m[g];return p()}return{configured:!1,enabled:!1}}function i(){if(t.Ay.featureToggles.ssoSettingsApi&&t.Ay.featureToggles.ssoSettingsLDAP)return;a({id:"ldap",type:"LDAP",protocol:"LDAP",displayName:"LDAP",configPath:"ldap"},x)}async function x(){if(n.TP.hasPermission(o.AccessControlAction.SettingsRead)){const p=(await(0,r.AI)().get("/api/admin/settings"))["auth.ldap"]||{};return{configured:p.enabled==="true",enabled:p.enabled==="true",hide:p.enabled!=="true"}}return{configured:!1,enabled:!1}}},21875:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>g,MH:()=>a,Nh:()=>l,Oy:()=>i,SH:()=>f,TO:()=>s,jA:()=>o,sr:()=>m});var t=e(65307);const n={settings:{},providerStatuses:{},isLoading:!1,providers:[]},r=(0,t.Z0)({name:"authConfig",initialState:n,reducers:{settingsUpdated:(p,c)=>({...p,settings:c.payload}),providerStatusesLoaded:(p,c)=>({...p,providerStatuses:c.payload}),loadingBegin:p=>({...p,isLoading:!0}),loadingEnd:p=>({...p,isLoading:!1}),setError:(p,c)=>({...p,updateError:c.payload}),resetError:p=>({...p,updateError:void 0}),setWarning:(p,c)=>({...p,warning:c.payload}),resetWarning:p=>({...p,warning:void 0}),providersLoaded:(p,c)=>({...p,providers:c.payload})}}),{settingsUpdated:o,providerStatusesLoaded:s,loadingBegin:m,loadingEnd:a,setError:l,resetError:f,setWarning:h,resetWarning:u,providersLoaded:i}=r.actions,g={authConfig:r.reducer}},15203:(ee,B,e)=>{"use strict";e.d(B,{G2:()=>E,Ko:()=>D,Vc:()=>I,aF:()=>S,cU:()=>P,e8:()=>R,hT:()=>y.hT,iB:()=>T,kH:()=>v,uz:()=>b,vZ:()=>d,wt:()=>O});var t=e(75816),n=e(28105),r=e(32899),o=e(92138),s=e(68143),m=e(43173),a=e(36490),l=e(73892),f=e(45229),h=e(73427),u=e(18646),i=e(60171),x=e(79718),g=e(56840),p=e(25724),c=e(27044),y=e(10378);const P=(0,t.xP)({tagTypes:["getFolder"],reducerPath:"browseDashboardsAPI",baseQuery:(0,l.W)({baseURL:"/api"}),endpoints:A=>({listFolders:A.query({providesTags:W=>W&&W.length>0?W.map(N=>({type:"getFolder",id:N.uid})):[{type:"getFolder",id:"EMPTY_RESULT"}],query:({parentUid:W,limit:N,page:w,permission:j})=>({url:"/folders",params:{parentUid:W,limit:N,page:w,permission:j}})}),getFolder:A.query({providesTags:(W,N,w)=>[{type:"getFolder",id:w}],query:W=>({url:`/folders/${W}`,params:{accesscontrol:!0}})}),newFolder:A.mutation({invalidatesTags:["getFolder"],query:({title:W,parentUid:N})=>({method:"POST",url:"/folders",body:{title:W,parentUid:N}}),onQueryStarted:({parentUid:W},{queryFulfilled:N,dispatch:w})=>{N.then(async({data:j})=>{await h.TP.fetchUserPermissions(),w((0,p.bw)({parentUID:W,pageSize:c.md}))})}}),saveFolder:A.mutation({invalidatesTags:["getFolder"],query:({uid:W,title:N,version:w})=>({method:"PUT",url:`/folders/${W}`,body:{title:N,version:w}}),onQueryStarted:({parentUid:W},{queryFulfilled:N,dispatch:w})=>{N.then(()=>{w((0,p.bw)({parentUID:W,pageSize:c.md}))})}}),moveFolder:A.mutation({invalidatesTags:["getFolder"],query:({folder:W,destinationUID:N})=>({url:`/folders/${W.uid}/move`,method:"POST",body:{parentUID:N}}),onQueryStarted:({folder:W,destinationUID:N},{queryFulfilled:w,dispatch:j})=>{const{parentUid:V}=W;w.then(()=>{j((0,p.bw)({parentUID:V,pageSize:c.md})),j((0,p.bw)({parentUID:N,pageSize:c.md}))})}}),deleteFolder:A.mutation({query:({uid:W})=>({url:`/folders/${W}`,method:"DELETE",params:{forceDeleteRules:!1}}),onQueryStarted:({parentUid:W},{queryFulfilled:N,dispatch:w})=>{N.then(()=>{w((0,p.bw)({parentUID:W,pageSize:c.md}))})}}
168),getAffectedItems:A.query({keepUnusedDataFor:0,queryFn:async W=>{const w=Object.keys(W.folder).filter(U=>W.folder[U]).map(U=>(0,s.AI)().get(`/api/folders/${U}/counts`)),j=await Promise.all(w),V={folder:Object.values(W.folder).filter(n.zz).length,dashboard:Object.values(W.dashboard).filter(n.zz).length,libraryPanel:0,alertRule:0};for(const U of j)V.folder+=U.folder??0,V.dashboard+=U.dashboard,V.alertRule+=U.alertrule,V.libraryPanel+=U.librarypanel;return{data:V}}}),moveItems:A.mutation({invalidatesTags:["getFolder"],queryFn:async({selectedItems:W,destinationUID:N},w,j,V)=>{const U=Object.keys(W.dashboard).filter(M=>W.dashboard[M]),F=Object.keys(W.folder).filter(M=>W.folder[M]);for(const M of F)await V({url:`/folders/${M}/move`,method:"POST",body:{parentUID:N}});for(const M of U){const H=await(0,u.n)().getDashboardDTO(M),_=(0,i.HG)(H)?H.spec:H.dashboard,Z=(0,i.HG)(H)?H.metadata:void 0;await(0,u.n)().saveDashboard({dashboard:_,folderUid:N,overwrite:!1,message:"",k8s:Z})}return{data:void 0}},onQueryStarted:({destinationUID:W,selectedItems:N},{queryFulfilled:w,dispatch:j})=>{const V=Object.keys(N.dashboard).filter(F=>N.dashboard[F]),U=Object.keys(N.folder).filter(F=>N.folder[F]);w.then(()=>{j((0,p.bw)({parentUID:W,pageSize:c.md})),j((0,p.Zw)([...U,...V]))})}}),deleteItems:A.mutation({invalidatesTags:["getFolder"],queryFn:async({selectedItems:W},N,w,j)=>{const V=Object.keys(W.dashboard).filter(F=>W.dashboard[F]),U=Object.keys(W.folder).filter(F=>W.folder[F]);for(const F of U)await j({url:`/folders/${F}`,method:"DELETE",params:{forceDeleteRules:!1}});for(const F of V){const M=await(0,u.n)().deleteDashboard(F,!0);m.$.featureToggles.kubernetesDashboards&&f.A.publish({type:r.r1.alertSuccess.name,payload:["Dashboard deleted"]})}return{data:void 0}},onQueryStarted:({selectedItems:W},{queryFulfilled:N,dispatch:w})=>{const j=Object.keys(W.dashboard).filter(U=>W.dashboard[U]),V=Object.keys(W.folder).filter(U=>W.folder[U]);N.then(()=>{w((0,p.Zw)([...V,...j]))})}}),saveDashboard:A.mutation({queryFn:async W=>{try{if((0,i.mi)(W))return{data:await(0,u.n)("v2").saveDashboard(W)};if((0,i.rL)(W))return{data:await(0,u.n)().saveDashboard(W)};throw new Error("Invalid dashboard version")}catch(N){return(0,l.s)(N)}},onQueryStarted:({folderUid:W},{queryFulfilled:N,dispatch:w})=>{x.t.ignoreNextSave(),N.then(async()=>{await h.TP.fetchUserPermissions(),w((0,p.bw)({parentUID:W,pageSize:c.md}))})}}),importDashboard:A.mutation({query:({dashboard:W,overwrite:N,inputs:w,folderUid:j})=>({method:"POST",url:"/dashboards/import",body:{dashboard:W,overwrite:N,inputs:w,folderUid:j}}),onQueryStarted:({folderUid:W},{queryFulfilled:N,dispatch:w})=>{N.then(async j=>{w((0,p.bw)({parentUID:W,pageSize:c.md}));const V=o.I.stripBaseFromUrl(j.data.importedUrl);a.Ny.push(V)})}}),restoreDashboard:A.mutation({query:({dashboardUID:W,targetFolderUID:N})=>({url:`/dashboards/uid/${W}/trash`,body:{folderUid:N},method:"PATCH"})}),hardDeleteDashboard:A.mutation({queryFn:async({dashboardUID:W},N,w,j)=>{const U=(await j({url:`/dashboards/uid/${W}/trash`,method:"DELETE",showSuccessAlert:!1}))?.data?.title;return U&&f.A.publish({type:r.r1.alertSuccess.name,payload:[(0,g.t)("browse-dashboards.hard-delete.success","Dashboard {{name}} deleted",{name:U})]}),{data:void 0}},onQueryStarted:({dashboardUID:W},{queryFulfilled:N,dispatch:w})=>{N.then(()=>{w((0,p.Zw)([W]))})}})})}),{endpoints:d,useDeleteFolderMutation:D,useDeleteItemsMutation:b,useGetAffectedItemsQuery:E,useGetFolderQuery:v,useLazyGetFolderQuery:C,useMoveFolderMutation:S,useMoveItemsMutation:O,useNewFolderMutation:I,useSaveDashboardMutation:R,useSaveFolderMutation:T,useRestoreDashboardMutation:L,useHardDeleteDashboardMutation:K}=P},27044:(ee,B,e)=>{"use strict";e.d(B,{aw:()=>u,md:()=>f,uT:()=>h});var t=e(43173),n=e(68143),r=e(99090),o=e(55860),s=e(93854),m=e(73427),a=e(96673),l=e(62963);const f=50;async function h(i,x,g=1,p=f){if(i&&!t.$.featureToggles.nestedFolders)return[];const c=(0,n.AI)();let y=[];return m.TP.hasPermission(a.AccessControlAction.FoldersRead)&&(y=await c.get("/api/folders",{parentUid:i,page:g,limit:p})),y.map(P=>({kind:"folder",uid:P.uid,title:P.title,parentTitle:x,parentUID:i,managedBy:P.managedBy,url:(0,l.I2)(P.uid)?void 0:(0,l._0)(P.uid)}))}async function u(i,x=1,g=f){const c=await(0,o.S)().search({kind:["dashboard"],query:"*",location:i||"general",from:(x-1)*g,limit:g});return c.view.map(y=>{const P=(0,s.hI)(y,c.view);return P.parentUID===r.TF&&(P.parentUID=void 0),P})}},78059:(ee,B,e)=>{"use strict";e.d(B,{x:()=>l});var t=e(74848),n=e(70255),r=e(34999),o=e(66404),s=e(56840),m=e(15203);function a(f,h,u,i){const x=f+h+u+i,g=[];f&&g.push((0,s.t)("browse-dashboards.counts.folder","{{count}} folder",{count:f})),h&&g.push((0,s.t)("browse-dashboards.counts.dashboard","{{count}} dashboard",{count:h})),u&&g.push((0,s.t)("browse-dashboards.counts.libraryPanel","{{count}} library panel",{count:u})),i&&g.push((0,s.t)("browse-dashboards.counts.alertRule","{{count}} alert rule",{count:i}));let p=(0,s.t)("browse-dashboards.counts.total","{{count}} item",{count:x});return g.length>0&&(p+=`: ${g.join(", ")}`),p}const l=({selectedItems:f})=>{const{data:h,isFetching:u,isLoading:i,error:x}=(0,m.G2)(f);return x?(0,t.jsx)(r.F,{severity:"error",title:(0,s.t)("browse-dashboards.descendant-count.title-unable-to-retrieve-descendant-information","Unable to retrieve descendant information")}):(0,t.jsxs)(o.E,{element:"p",color:"secondary",children:[h&&a(h.folder,h.dashboard,h.libraryPanel,h.alertRule),(u||i)&&(0,t.jsx)(n.A,{width:200})]})}},62963:(ee,B,e)=>{"use strict";e.d(B,{I2:()=>o,_0:()=>s,eM:()=>r});var t=e(43173),n=e(73427);function r(m,a){return m+a.uid}function o(m){return m===t.$.sharedWithMeFolderUID}function s(m){const{orgId:a}=n.TP.user,f=`${t.$.appSubUrl??""}/dashboards/f/${m}/`;return a?`${f}?orgId=${a}`:f}},44220:(ee,B,e)=>{"use strict";e.d(B,{Ii:()=>a,Zw:()=>s,bw:()=>m});var t=e(99090),n=e(96673),r=e(27044),o=e(78034);const s=(0,n.createAsyncThunk)("browseDashboards/refreshParents",async(l,{getState:f,dispatch:h})=>{const{browseDashboards:u}=f(),{rootItems:i,childrenByParentUID:x}=u,g=new Set;for(const p of l){const c=(0,o.R)(i?.items??[],x,p);g.add(c?.parentUID)}for(const p of g)h(m({parentUID:p,pageSize:r.md}))}),m=(0,n.createAsyncThunk)("browseDashboards/refetchChildren",async({parentUID:l,pageSize:f})=>{const h=l===t.TF?void 0:l;let u=1,i="folder",x=await(0,r.uT)(h,void 0,u,f),g=x.length<f;if(i==="folder"&&g){i="dashboard",u=1;const p=await(0,r.aw)(h,u,f);g=p.length<f,x=x.concat(p)}return{children:x,lastPageOfKind:g,page:u,kind:i}}),a=(0,n.createAsyncThunk)("browseDashboards/fetchNextChildrenPage",async({parentUID:l,excludeKinds:f=[],pageSize:h},u)=>{const i=!f.includes("dashboard"),x=l===t.TF?void 0:l,g=u.getState().browseDashboards,p=x?g.childrenByParentUID[x]:g.rootItems;let c=1,y;if(p?p.lastFetchedKind==="dashboard"&&!p.lastKindHasMoreItems?console.warn(`fetchNextChildrenPage called for ${x}
168 but that collection is fully loaded`):p.lastFetchedKind==="folder"&&p.lastKindHasMoreItems?(c=p.lastFetchedPage+1,y="folder"):i&&(c=p.lastFetchedKind==="folder"?1:p.lastFetchedPage+1,y="dashboard"):(c=1,y="folder"),!y)return;let P=y==="folder"?await(0,r.uT)(x,void 0,c,h):await(0,r.aw)(x,c,h),d=P.length<h;if(y==="folder"&&d&&i){y="dashboard",c=1;const D=await(0,r.aw)(x,c,h);d=D.length<h,P=P.concat(D)}return{children:P,lastPageOfKind:d,page:c,kind:y}})},25724:(ee,B,e)=>{"use strict";e.d(B,{Am:()=>h,Ii:()=>n.Ii,bw:()=>n.bw,Zw:()=>n.Zw,ku:()=>f,cT:()=>t.cT,wn:()=>t.wn,t$:()=>t.t$,xK:()=>b,eC:()=>c,Ms:()=>d,V6:()=>D,q0:()=>y,QE:()=>P,Zg:()=>E});var t=e(87186),n=e(44220),r=e(96540),o=e(25508),s=e(96673),m=e(27044),a=e(62963),l=e(78034);const f=C=>C.browseDashboards.rootItems,h=C=>C.browseDashboards.childrenByParentUID,u=C=>C.browseDashboards.openFolders,i=C=>C.browseDashboards.selectedItems,x=(0,o.Mz)(f,h,u,(C,S)=>S,(C,S,O,I)=>v(I,C,S,O)),g=(0,o.Mz)(i,C=>Object.values(C).some(S=>Object.values(S).some(O=>O))),p=(0,o.Mz)(i,h,(C,S)=>{const O={dashboard:{...C.dashboard},folder:{...C.folder}};for(const I of Object.keys(C.folder))if(C.folder[I]){const T=S[I];if(T)for(const L of T.items)L.kind==="dashboard"&&(O.dashboard[L.uid]=!1),L.kind==="folder"&&(O.folder[L.uid]=!1)}return O});function c(C){return(0,s.useSelector)(S=>(C?S.browseDashboards.childrenByParentUID[C]:S.browseDashboards.rootItems)?"fulfilled":"pending")}function y(C){return(0,s.useSelector)(S=>x(S,C))}function P(){return(0,s.useSelector)(C=>g(C))}function d(){return(0,s.useSelector)(i)}function D(){return(0,s.useSelector)(C=>C.browseDashboards.childrenByParentUID)}function b(){return(0,s.useSelector)(C=>p(C))}function E(C=[]){const S=(0,s.useDispatch)(),O=(0,r.useRef)(!1);return(0,r.useCallback)(R=>{if(O.current)return Promise.resolve();O.current=!0;const T=S((0,n.Ii)({parentUID:R,excludeKinds:C,pageSize:m.md}));return T.finally(()=>O.current=!1),T},[S,C])}function v(C,S,O,I,R=0,T=[],L=[]){function K(U,F,M){if(T.includes(U.kind)||L.includes(U.uid))return[];const H=v(U.uid,S,O,I,M+1,T,L),_=!!I[U.uid],Z=O[U.uid]?.items.length===0;_&&Z&&!T.includes("empty-folder")&&H.push({isOpen:!1,level:M+1,item:{kind:"ui",uiKind:"empty-folder",uid:U.uid+"empty-folder"},parentUID:F});const ne={item:U,parentUID:F,level:M,isOpen:_},te=[ne,...H];return(0,a.I2)(ne.item.uid)&&te.push({item:{kind:"ui",uiKind:"divider",uid:"shared-with-me-divider"},parentUID:F,level:M+1,isOpen:!1}),te}const A=C&&I[C]||R===0,W=C?O[C]:S;let w=((C?A&&W?.items:W?.items)||[]).flatMap(U=>K(U,C,R));const j=T.includes("dashboard")&&W?.lastFetchedKind==="dashboard";return(R===0&&!W||A&&W&&!(W.isFullyLoaded||j))&&(w=w.concat((0,l.T)(m.md,C,R))),w}},87186:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>v,cT:()=>b,wn:()=>d,t$:()=>D});var t={};e.r(t),e.d(t,{clearFolders:()=>i,fetchNextChildrenPageFulfilled:()=>l,refetchChildrenFulfilled:()=>a,setAllSelection:()=>u,setFolderOpenState:()=>f,setItemSelectionState:()=>h});var n=e(65307),r=e(44220),o=e(75735),s=e(62963),m=e(78034);function a(C,S){const{children:O,page:I,kind:R,lastPageOfKind:T}=S.payload,{parentUID:L}=S.meta.arg,K={items:O,lastFetchedKind:R,lastFetchedPage:I,lastKindHasMoreItems:!T,isFullyLoaded:R==="dashboard"&&T};L?C.childrenByParentUID[L]=K:C.rootItems=K}function l(C,S){const O=S.payload;if(!O)return;const{children:I,page:R,kind:T,lastPageOfKind:L}=O,{parentUID:K,excludeKinds:A=[]}=S.meta.arg,w={items:((K?C.childrenByParentUID[K]:C.rootItems)?.items??[]).concat(I),lastFetchedKind:T,lastFetchedPage:R,lastKindHasMoreItems:!L,isFullyLoaded:(A.includes("dashboard")||T==="dashboard")&&L};if(!K){C.rootItems=w;return}if(C.childrenByParentUID[K]=w,C.selectedItems.folder[K])for(const V of I)C.selectedItems[V.kind][V.uid]=!0}function f(C,S){const{folderUID:O,isOpen:I}=S.payload;C.openFolders[O]=I}function h(C,S){const{item:O,isSelected:I}=S.payload;if((0,s.I2)(O.uid)||O.managedBy===o.Sf.Repo)return;function R(T,L){if(C.selectedItems[T][L]=I,T!=="folder")return;let K=C.childrenByParentUID[L];for(const A of K?.items??[])R(A.kind,A.uid)}if(R(O.kind,O.uid),!I){let T=O.parentUID;for(;T;){const L=(0,m.R)(C.rootItems?.items??[],C.childrenByParentUID,T);if(!L)break;C.selectedItems[L.kind][L.uid]=!1,T=L.parentUID}}C.selectedItems.$all=C.rootItems?.items?.every(T=>C.selectedItems[T.kind][T.uid])??!1}function u(C,S){const{isSelected:O,folderUID:I}=S.payload;if(!(I&&(0,s.I2)(I)))if(C.selectedItems.$all=O,O){let T=function(L){if(L&&(0,s.I2)(L))return;const K=L?C.childrenByParentUID[L]:C.rootItems;if(K)for(const A of K.items)(0,s.I2)(A.uid)||A.managedBy===o.Sf.Repo||(C.selectedItems[A.kind][A.uid]=O,A.kind==="folder"&&T(A.uid))};var R=T;T(I)}else for(const T in C.selectedItems){if(!(T==="dashboard"||T==="panel"||T==="folder"))continue;const L=C.selectedItems[T];for(const K in L)L[K]=O}}function i(C,S){const O=Array.isArray(S.payload)?S.payload:[S.payload];for(const I of O)I?(C.childrenByParentUID[I]=void 0,C.openFolders[I]=!1):C.rootItems=void 0}const{fetchNextChildrenPageFulfilled:x,refetchChildrenFulfilled:g,...p}=t,c={rootItems:void 0,childrenByParentUID:{},openFolders:{},selectedItems:{dashboard:{},folder:{},panel:{},$all:!1}},y=(0,n.Z0)({name:"browseDashboards",initialState:c,reducers:p,extraReducers:C=>{C.addCase(r.Ii.fulfilled,x),C.addCase(r.bw.fulfilled,g)}}),P=y.reducer,{setFolderOpenState:d,setItemSelectionState:D,setAllSelection:b,clearFolders:E}=y.actions,v={browseDashboards:P}},78034:(ee,B,e)=>{"use strict";e.d(B,{R:()=>t,T:()=>n});function t(r,o,s){for(const m of r)if(m.uid===s)return m;for(const m in o){const a=o[m];if(a){for(const l of a.items)if(l.uid===s)return l}}}function n(r,o,s){return new Array(r).fill(null).map((m,a)=>({parentUID:o,level:s,isOpen:!1,item:{kind:"ui",uiKind:"pagination-placeholder",uid:`${o}-pagination-${a}`}}))}},26437:(ee,B,e)=>{"use strict";e.d(B,{b:()=>n,q:()=>t});const t="connections",n={Base:`/${t}`,DataSources:`/${t}
168/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:(ee,B,e)=>{"use strict";e.d(B,{k:()=>s});var t=e(60455),n=e.n(t),r=e(79609),o=e(62635);const s=(m,a,l)=>{let f={},h={};if(m.type===r.CC.Regex&&m.expression){const u=new RegExp(m.expression,"gi"),x=(typeof a=="string"?a:(0,o.MA)(a)).matchAll(u);for(const g of x)g.groups?h=g.groups:h[m.mapValue||l]=g[1]||g[0]}else m.type===r.CC.Logfmt&&a!==void 0&&(h=n().parse(a));return Object.keys(h).forEach(u=>{const i=typeof h[u]=="string"?h[u]:(0,o.MA)(h[u]);f[u]={value:i}}),f}},52860:(ee,B,e)=>{"use strict";e.d(B,{F0:()=>l,bQ:()=>f,lW:()=>h});var t=e(41053),n=e(75505),r=e(78282),o=e(27963),s=e(6219);const m=({sourceUID:u,...i})=>{const x=(0,r.l)().getInstanceSettings(u),g=i.type==="query"?(0,r.l)().getInstanceSettings(i.targetUID):void 0;if((i?.orgId===void 0||i?.orgId===null||i?.orgId===0)&&s.kb.logWarning("Invalid correlation config: Missing org id."),x&&x?.uid!==void 0&&g?.uid!==void 0&&i.type==="query")return{...i,source:x,target:g};if(x&&x?.uid!==void 0&&g?.uid===void 0&&i.type==="external")return{...i,source:x};s.kb.logWarning("Invalid correlation config: Missing source or target.",{source:JSON.stringify(x),target:JSON.stringify(g)})},a=u=>!!u,l=u=>({...u,correlations:u.correlations.map(m).filter(a)});function f(u){return u.data}const h=()=>{const{backend:u}=(0,o.Il)(),[i,x]=(0,t.A)(D=>(0,n.s)(u.fetch({url:"/api/datasources/correlations",params:{page:D.page},method:"GET",showErrorAlert:!1})).then(f).then(l),[u]),[g,p]=(0,t.A)(({sourceUID:D,...b})=>u.post(`/api/datasources/uid/${D}/correlations`,b).then(E=>{const v=m(E.result);if(v!==void 0)return v;throw new Error("invalid sourceUID")}),[u]),[c,y]=(0,t.A)(({sourceUID:D,uid:b})=>u.delete(`/api/datasources/uid/${D}/correlations/${b}`),[u]),[P,d]=(0,t.A)(({sourceUID:D,uid:b,...E})=>u.patch(`/api/datasources/uid/${D}/correlations/${b}`,E).then(v=>{const C=m(v.result);if(C!==void 0)return C;throw new Error("invalid sourceUID")}),[u]);return{create:{execute:p,...g},update:{execute:d,...P},get:{execute:x,...i},remove:{execute:y,...c}}}}
168,6219:(ee,B,e)=>{"use strict";e.d(B,{$q:()=>g,J6:()=>x,cA:()=>h,kb:()=>y,tZ:()=>c});var t=e(75505),n=e(79609),r=e(43173),o=e(68143),s=e(78282),m=e(25992),a=e(44720),l=e(46072),f=e(52860);const h=(P,d,D)=>(P.forEach(b=>{const E=b.refId;if(!E)return;let v=D[E];if(v===void 0&&b.meta?.preferredVisualisationType==="rawPrometheus"){const S=(0,a.a)(E);v=D[S]}const C=d.filter(S=>S.source.uid===v);u(b,i(C,b))}),P),u=(P,d)=>{P.fields.forEach(D=>{D.config.links=D.config.links?.filter(b=>b.origin!==n.x0.Correlations)||[],d.map(b=>{if(b.config.field===D.name){if(b.type==="query"){const E=b.config.target||{};D.config.links.push({internal:{query:{...E,datasource:{uid:b.target.uid}},datasourceUid:b.target.uid,datasourceName:b.target.name},url:"",title:b.label||b.target.name,origin:n.x0.Correlations,meta:{transformations:b.config.transformations}})}else if(b.type==="external"){const E=b.config.target;D.config.links.push({url:E.url,title:b.label||"External URL",origin:n.x0.Correlations,meta:{transformations:b.config?.transformations}})}}})})},i=(P,d)=>P.map(D=>{if(D.source.meta?.id==="loki"&&r.$.featureToggles.lokiLogsDataplane===!0&&D.config.field==="Line"){const b=(0,l.Os)(d);b!=null&&b.bodyField.name!==void 0&&(D.config.field=b?.bodyField.name)}return D}),x=async P=>(0,t.s)((0,o.AI)().fetch({url:"/api/datasources/correlations",method:"GET",showErrorAlert:!1,params:{sourceUID:P}})).then(f.bQ).then(f.F0),g=async(P,d)=>(0,o.AI)().post(`/api/datasources/uid/${P}/correlations`,d),p=async P=>P.datasourceInstance?.meta.mixed?await(0,s.l)().get(P.queries[0].datasource):P.datasourceInstance,c=async(P,d)=>Promise.all([p(P),p(d)]).then(D=>D[0]?.name!==void 0&&D[1]?.name!==void 0?`${D[0]?.name} to ${D[1]?.name}`:""),y=(0,m.DW)("features.correlations")},11968:(ee,B,e)=>{"use strict";e.d(B,{U:()=>m});var t=e(56838),n=e(29043),r=e(7817),o=e(96673),s=e(65333);function m(a){const l=n.A.getObject(o.DASHBOARD_FROM_LS_KEY);if(l){console.log("asd",l);const f=new r.G(l.dashboard);for(const h of f.panels){const u=(0,s.tt)(h);a.addPanel(u.state.body)}if(l.dashboard.time){const h=new t.JZ({from:l.dashboard.time.from,to:l.dashboard.time.to}),u=a.state.$timeRange;u&&u.setState({value:h.state.value,from:h.state.from,to:h.state.to})}}n.A.delete(o.DASHBOARD_FROM_LS_KEY)}},57558:(ee,B,e)=>{"use strict";e.d(B,{p:()=>f});var t=e(56838),n=e(56840),r=e(35282),o=e(55793),s=e(25953),m=e(97335),a=e(92769);function l(u){return u instanceof s.X?"panel":u instanceof m.o?"row":u instanceof a.V?"tab":"element"}class f extends t.Bs{static{this.Component=h}get info(){return(0,n.t)("dashboard.conditional-rendering.root.info","Set rules to control {{type}} visibility by matching any or all rules.",{type:this.getItemType()})}constructor(i){super(i),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this.forEachChild(i=>{i.isActive||this._subs.add(i.activate())})}evaluate(){return this.state.rootGroup.evaluate()}notifyChange(){this.parent?.forceRender(),this.parent?.publishEvent(new r.N4(this),!0)}deleteItem(i){t.jh.getAncestor(i,o.M).removeItem(i.state.key)}serialize(){return this.state.rootGroup.serialize()}getItem(){return this.parent}getItemType(){return l(this.getItem())}static createEmpty(){return new f({rootGroup:o.M.createEmpty()})}}function h({model:u}){const{rootGroup:i}=u.useState();return i.render(!1)}},70903:(ee,B,e)=>{"use strict";e.d(B,{G:()=>u});var t=e(74848),n=e(56838),r=e(41654),o=e(66404),s=e(45967),m=e(30703),a=e(34999),l=e(76319),f=e(56840),h=e(57558);class u extends n.Bs{constructor(g){super(g),this.supportedItemTypes=void 0,this.addActivationHandler(()=>this._baseActivationHandler())}_baseActivationHandler(){this.forEachChild(g=>{g.isActive||this._subs.add(g.activate())})}onDelete(){this._getConditionalLogicRoot().deleteItem(this)}render(g=!0){return(0,t.jsx)(i,{model:this,withWrapper:g},this.state.key)}getItem(){return this._getConditionalLogicRoot().getItem()}getItemType(){return this._getConditionalLogicRoot().getItemType()}isItemSupported(){return this.supportedItemTypes?this.supportedItemTypes.includes(this.getItemType()):!0}notifyChange(){this._getConditionalLogicRoot().notifyChange()}setStateAndNotify(g){this.setState(g),this.notifyChange()}_getConditionalLogicRoot(){return n.jh.getAncestor(this,h.p)}}function i({model:x,withWrapper:g}){const p=(0,t.jsx)(x.Component,{model:x},x.state.key);return g?(0,t.jsxs)(r.B,{direction:"column",children:[(0,t.jsxs)(r.B,{direction:"row",gap:1,children:[(0,t.jsx)(o.E,{variant:"bodySmall",children:x.title}),x.info&&(0,t.jsx)(s.m,{content:x.info,children:(0,t.jsx)(m.I,{name:"info-circle"})})]}),(0,t.jsxs)(r.B,{direction:"row",gap:1,justifyContent:"stretch",alignItems:"center",children:[(0,t.jsxs)(r.B,{flex:1,direction:"column",gap:1,children:[p,!x.isItemSupported()&&(0,t.jsx)(a.F,{severity:"error",title:"",children:(0,t.jsx)(f.x6,{i18nKey:"dashboard.conditional-rendering.conditions.shared.unsupported-item-type",children:"This condition is not supported by the element, hence it will be ignored."})})]}),(0,t.jsx)(l.K,{"aria-label":(0,f.t)("dashboard.conditional-rendering.conditions.shared.delete-condition","Delete Condition"),name:"trash-alt",onClick:()=>x.onDelete()})]})]},x.state.key):p}},73816:(ee,B,e)=>{"use strict";e.d(B,{t:()=>l});var t=e(74848),n=e(96540),r=e(56838),o=e(43243),s=e(56840),m=e(25953),a=e(70903);class l extends a.G{constructor(u){super(u),this.supportedItemTypes=["panel"],this.addActivationHandler(()=>this._activationHandler())}static{this.Component=f}
168static{this.serializer={id:"ConditionalRenderingData",name:"Data",deserialize:this.deserialize}}get title(){return(0,s.t)("dashboard.conditional-rendering.conditions.data.label","Query result")}get info(){return(0,s.t)("dashboard.conditional-rendering.conditions.data.info","Show or hide the {{type}} based on query results.",{type:this.getItemType()})}_activationHandler(){if(!this.isItemSupported())return;const u=this.getItem();if(u instanceof m.X){const i=r.jh.getData(u.state.body);if(!i)return;this._subs.add(i.subscribeToState(()=>this.notifyChange()))}}evaluate(){if(!this.isItemSupported())return!0;const u=this._hasData();return this.state.value&&u||!this.state.value&&!u}serialize(){return{kind:"ConditionalRenderingData",spec:{value:this.state.value}}}_hasData(){const u=this.getItem();let i;if(u instanceof m.X&&(i=r.jh.getData(u.state.body).state.data),!i)return!1;const x=i?.series??[];for(let g=0;g<x.length;g++)if(x[g].length>0)return!0;return!1}static deserialize(u){return new l({value:u.spec.value})}static createEmpty(){return new l({value:!0})}}function f({model:h}){const{value:u}=h.useState(),i=(0,n.useMemo)(()=>[{label:(0,s.t)("dashboard.conditional-rendering.conditions.data.enable","Has data"),value:1},{label:(0,s.t)("dashboard.conditional-rendering.conditions.data.disable","No data"),value:0}],[]),x=(0,n.useMemo)(()=>i.find(g=>!!g.value===u)??i[0],[i,u]);return(0,t.jsx)(o.G,{options:i,value:x,onChange:({value:g})=>h.setStateAndNotify({value:!!g})})}},46415:(ee,B,e)=>{"use strict";e.d(B,{h:()=>l});var t=e(74848),n=e(41654),r=e(45967),o=e(30703),s=e(56840),m=e(25797),a=e(51156);function l(f){if(!f)return null;const h=(0,s.t)("dashboard.conditional-rendering.root.title","Show / hide rules");return new m.C({title:h,id:"conditional-rendering-options",renderTitle:()=>(0,t.jsxs)(n.B,{direction:"row",gap:1,alignItems:"center",children:[(0,t.jsx)("div",{children:h}),(0,t.jsx)(r.m,{content:f.info,children:(0,t.jsx)(o.I,{name:f.evaluate()?"eye":"eye-slash"})})]}),isOpenDefault:!0}).addItem(new a.v({title:h,render:()=>(0,t.jsx)(f.Component,{model:f})}))}},55793:(ee,B,e)=>{"use strict";e.d(B,{M:()=>E});var t=e(74848),n=e(56838),r=e(41654),o=e(56840),s=e(70903),m=e(73816),a=e(96540),l=e(59695);const f=({itemType:C,hasVariables:S,onAdd:O})=>{const I=(0,a.useMemo)(()=>{const R=[{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.add.data","Query result"),value:"data"},{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.add.variable","Template variable"),value:"variable",isDisabled:!S},{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.add.time-range-size","Time range less than"),value:"timeRangeSize"}];return C!=="panel"&&R.shift(),R},[C,S]);return(0,t.jsx)(l.i,{isFullWidth:!0,size:"sm",icon:"plus",variant:"secondary",label:(0,o.t)("dashboard.conditional-rendering.conditions.group.add.button","Add rule"),options:I,onChange:({value:R})=>O(R)})};var h=e(22803),u=e(63142),i=e(37386),x=e(77824);const g=({value:C,onChange:S})=>{const O=(0,u.of)(p),I=(0,a.useMemo)(()=>[{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.condition.all","Match all"),value:"and"},{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.condition.any","Match any"),value:"or"}],[]);return(0,t.jsx)(i.D,{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.condition.label","Match rules"),className:O.container,children:(0,t.jsx)(x.z,{fullWidth:!0,options:I,value:C,onChange:S})})},p=()=>({container:(0,h.css)({margin:0})});var c=e(2543);const y=({itemType:C,value:S,onChange:O})=>{const I=(0,u.of)(P),R=(0,a.useMemo)(()=>[{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.visibility.show","Show"),value:"show"},{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.visibility.hide","Hide"),value:"hide"}],[]);return(0,t.jsx)(i.D,{label:(0,o.t)("dashboard.conditional-rendering.conditions.group.visibility.label","{{type}} visibility",{type:(0,c.capitalize)(C)}),className:I.container,children:(0,t.jsx)(x.z,{fullWidth:!0,options:R,value:S,onChange:O})})},P=()=>({container:(0,h.css)({margin:0})});var d=e(91135),D=e(75904),b=e(84655);class E extends s.G{static{this.Component=v}
168static{this.serializer={id:"ConditionalRenderingGroup",name:"Group",deserialize:this.deserialize}}get title(){return(0,o.t)("dashboard.conditional-rendering.conditions.group.label","Group")}get info(){}evaluate(){if(this.state.value.length===0)return!0;const S=this.state.condition==="and"?this.state.value.every(O=>O.evaluate()):this.state.value.some(O=>O.evaluate());return this.state.visibility==="show"?S:!S}changeVisibility(S){this.setStateAndNotify({visibility:S})}changeCondition(S){this.setStateAndNotify({condition:S})}addItem(S){const O=S==="data"?m.t.createEmpty():S==="variable"?D.H.createEmpty(n.jh.getVariables(this).state.variables[0].state.name):d.K.createEmpty();this.setState({value:[...this.state.value,O]}),this.isActive&&!O.isActive&&O.activate(),this.notifyChange()}removeItem(S){this.setStateAndNotify({value:this.state.value.filter(O=>O.state.key!==S)})}serialize(){if(this.state.value.some(S=>S instanceof E))throw new Error("ConditionalRenderingGroup cannot contain nested ConditionalRenderingGroups");return{kind:"ConditionalRenderingGroup",spec:{visibility:this.state.visibility,condition:this.state.condition,items:this.state.value.map(S=>S.serialize()).filter(S=>S.kind!=="ConditionalRenderingGroup")}}}static deserialize(S){return new E({condition:S.spec.condition,visibility:S.spec.visibility,value:S.spec.items.map(O=>{const I=b.k.getIfExists(O.kind);if(!I)throw new Error(`No serializer found for conditional rendering kind: ${O.kind}`);return I.deserialize(O)})})}static createEmpty(){return new E({condition:"and",visibility:"show",value:[]})}}function v({model:C}){const{condition:S,visibility:O,value:I}=C.useState(),{variables:R}=n.jh.getVariables(C).useState();return(0,t.jsxs)(r.B,{direction:"column",gap:2,children:[(0,t.jsx)(y,{itemType:C.getItemType(),value:O,onChange:T=>C.changeVisibility(T)}),I.length>1&&(0,t.jsx)(g,{value:S,onChange:T=>C.changeCondition(T)}),I.map(T=>T.render()),(0,t.jsx)(f,{itemType:C.getItemType(),hasVariables:R.length>0,onAdd:T=>C.addItem(T)})]})}},91135:(ee,B,e)=>{"use strict";e.d(B,{K:()=>u});var t=e(74848),n=e(22803),r=e(96540),o=e(17548),s=e(56838),m=e(63142),a=e(37386),l=e(18857),f=e(56840),h=e(70903);class u extends h.G{static{this.Component=i}static{this.serializer={id:"ConditionalRenderingTimeRangeSize",name:"Time Range Size",deserialize:this.deserialize}}get title(){return(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.label","Time range less than")}get info(){return(0,f.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:this.getItemType()})}constructor(c){super(c),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this._subs.add(s.jh.getTimeRange(this).subscribeToState(()=>this.notifyChange()))}evaluate(){try{if(!g.test(this.state.value))return!0;const c=o.intervalToSeconds(this.state.value),y=s.jh.getTimeRange(this);if(y.state.value.to.unix()-y.state.value.from.unix()<=c)return!0}catch{return!1}return!1}serialize(){return{kind:"ConditionalRenderingTimeRangeSize",spec:{value:this.state.value}}}static deserialize(c){return new u({value:c.spec.value})}static createEmpty(){return new u({value:"7d"})}}function i({model:p}){const{value:c}=p.useState(),[y,P]=(0,r.useState)(g.test(c)),d=(0,m.of)(x);(0,r.useEffect)(()=>P(g.test(c)),[c]);const D=(0,r.useMemo)(()=>[{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.minutes","{{value}} minutes",{value:5}),value:"5m"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.minutes","{{value}} minutes",{value:15}),value:"15m"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.minutes","{{value}} minutes",{value:30}),value:"30m"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hour","{{value}} hour",{value:1}),value:"1h"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:3}),value:"3h"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:6}),value:"6h"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:12}),value:"12h"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.hours","{{value}} hours",{value:24}),value:"24h"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:2}),value:"2d"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:7}),value:"7d"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:30}),value:"30d"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.days","{{value}} days",{value:90}),value:"90d"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.months","{{value}} months",{value:6}),value:"6M"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.year","{{value}} year",{value:1}),value:"1y"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.years","{{value}} years",{value:2}),value:"2y"},{label:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.values.years","{{value}} years",{value:5}),value:"5y"}],[]),b=(0,r.useMemo)(()=>D.find(E=>E.value===c)?D:[{label:c,value:c},...D],[D,c]);return(0,t.jsx)(a.D,{invalid:!y,error:(0,f.t)("dashboard.conditional-rendering.conditions.time-range-size.invali
168d-message","Invalid interval"),className:d.container,children:(0,t.jsx)(l.l6,{isClearable:!1,allowCustomValue:!0,onCreateOption:E=>p.setStateAndNotify({value:E}),value:c,options:b,onChange:({value:E})=>p.setStateAndNotify({value:E})})})}const x=()=>({container:(0,n.css)({margin:0})}),g=/^(\d+(?:\.\d+)?)[Mwdhmsy]$/},75904:(ee,B,e)=>{"use strict";e.d(B,{H:()=>h});var t=e(74848),n=e(96540),r=e(56838),o=e(41654),s=e(31286),m=e(43243),a=e(63527),l=e(56840),f=e(70903);class h extends f.G{constructor(){super(...arguments),this._variableDependency=new r.Sh(this,{onAnyVariableChanged:x=>{x.state.name===this.state.value.name&&this.notifyChange()}})}static{this.Component=u}static{this.serializer={id:"ConditionalRenderingVariable",name:"Variable",deserialize:this.deserialize}}get title(){return(0,l.t)("dashboard.conditional-rendering.conditions.variable.label","Template variable")}get info(){return(0,l.t)("dashboard.conditional-rendering.conditions.variable.info","Show or hide the {{type}} dynamically based on the variable value.",{type:this.getItemType()})}evaluate(){if(!this.state.value.name)return!0;const x=r.jh.getVariables(this).getByName(this.state.value.name);if(!x)return!1;const g=x.getValue()??"",p=Array.isArray(g)?g.includes(this.state.value.value):g===this.state.value.value;return this.state.value.operator==="!="?!p:p}serialize(){return{kind:"ConditionalRenderingVariable",spec:{variable:this.state.value.name,operator:this.state.value.operator==="="?"equals":"notEquals",value:this.state.value.value}}}static deserialize(x){return new h({value:{name:x.spec.variable,operator:x.spec.operator==="equals"?"=":"!=",value:x.spec.value}})}static createEmpty(x){return new h({value:{name:x,operator:"=",value:""}})}}function u({model:i}){const{value:x}=i.useState(),g=(0,n.useMemo)(()=>r.jh.getVariables(i),[i]),p=(0,n.useMemo)(()=>g.state.variables.map(y=>({value:y.state.name,label:y.state.label??y.state.name})),[g.state.variables]),c=(0,n.useMemo)(()=>[{value:"=",description:(0,l.t)("dashboard.conditional-rendering.conditions.variable.operator.equals","Equals")},{value:"!=",description:(0,l.t)("dashboard.conditional-rendering.conditions.variable.operator.not-equals","Not equals")}],[]);return(0,t.jsxs)(o.B,{direction:"column",gap:.5,children:[(0,t.jsxs)(o.B,{direction:"row",gap:.5,grow:1,children:[(0,t.jsx)(s.a,{flex:1,children:(0,t.jsx)(m.G,{placeholder:(0,l.t)("dashboard.conditional-rendering.conditions.variable.name","Name"),options:p,value:x.name,onChange:y=>i.setStateAndNotify({value:{...x,name:y.value}})})}),(0,t.jsx)(m.G,{width:"auto",minWidth:10,options:c,value:x.operator,onChange:y=>i.setStateAndNotify({value:{...x,operator:y.value}})})]}),(0,t.jsx)(a.p,{placeholder:(0,l.t)("dashboard.conditional-rendering.conditions.variable.value","Value"),value:x.value,onChange:y=>i.setStateAndNotify({value:{...x,value:y.currentTarget.value}})})]})}},84655:(ee,B,e)=>{"use strict";e.d(B,{k:()=>m});var t=e(42954),n=e(73816),r=e(55793),o=e(91135),s=e(75904);const m=new t.O(()=>[r.M.serializer,s.H.serializer,n.t.serializer,o.K.serializer])},41116:(ee,B,e)=>{"use strict";e.d(B,{H:()=>h});var t=e(74848),n=e(57558),r=e(22803),o=e(63142),s=e(45967),m=e(30703),a=e(56840);const l=()=>{const u=(0,o.of)(f);return(0,t.jsx)("div",{className:u.container,children:(0,t.jsx)(s.m,{content:(0,a.t)("dashboard.conditional-rendering.overlay.tooltip","Element is hidden due to conditional rendering."),children:(0,t.jsx)(m.I,{name:"eye-slash"})})})},f=u=>({container:(0,r.css)({display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",width:"100%",height:"100%",bottom:0,right:0,zIndex:1,[u.transitions.handleMotion("no-preference","reduce")]:{transition:"all 0.2s ease"},"&:before":(0,r.css)({content:'""',opacity:.6,position:"absolute",width:"100%",height:"100%",top:0,left:0,backgroundColor:u.colors.background.canvas,pointerEvents:"none"}),"& > svg":(0,r.css)({height:"48px",width:"48px",maxWidth:"75%",maxHeight:"75%"}),".dashboard-visible-hidden-element:hover > &":(0,r.css)({width:"30px",height:"30px",top:"unset",left:"unset",right:0,bottom:0})})});function h(u){const i=u.useState();if(!("conditionalRendering"in i)||!(i.conditionalRendering instanceof n.p))return[!1,void 0,null];const x=i.conditionalRendering.evaluate()??!0;return[!x,x?void 0:"dashboard-visible-hidden-element",x?null:(0,t.jsx)(l,{})]}},35282:(ee,B,e)=>{"use strict";e.d(B,{N4:()=>Ke,jO:()=>Me,ck:()=>$e,su:()=>tt,wT:()=>ke,dt:()=>He});var t=e(88544),n=e(68388),r=e(56838),o=e(39385),s=e(74848),m=e(96540),a=e(85629),l=e(63527),f=e(34999),h=e(89640),u=e(56840),i=e(25797),x=e(51156),g=e(31819),p=e(9931),c=e(18615),y=e(8285),P=e(1131),d=e(87308);class D{constructor(Ve){this._row=Ve,this.isEditableDashboardElement=!0}getEditableElementInfo(){return{typeName:(0,u.t)("dashboard.edit-pane.elements.row","Row"),instanceName:r.jh.interpolate(this._row,this._row.state.title,void 0,"text"),icon:"list-ul",isContainer:!0}}useEditPaneOptions(){const Ve=this._row,Qe=(0,m.useMemo)(()=>new i.C({title:(0,u.t)("dashboard.default-layout.row-options.title","Row options"),id:"row-options",isOpenDefault:!0}).addItem(new x.v({title:(0,u.t)("dashboard.default-layout.row-options.form.title","Title"),render:()=>(0,s.jsx)(b,{row:Ve})})),[Ve]),je=(0,m.useMemo)(()=>{const ze=(0,y.YQ)(Ve);return new i.C({title:(0,u.t)("dashboard.default-layout.row-options.repeat.title","Repeat options"),id:"row-repeat-options",isOpenDefault:!0}).addItem(new x.v({title:(0,u.t)("dashboard.default-layout.row-options.repeat.variable.title","Variable"),render:()=>(0,s.jsx)(E,{row:Ve,dashboard:ze})}))},[Ve]);return[Qe,je]}onDelete(){const Ve=(0,y.h$)(this._row);Ve instanceof P.D&&Ve.removeRow(this._row)}}function b({row:Re}){const{title:Ve}=Re.useState();return(0,s.jsx)(l.p,{value:Ve,onChange:Qe=>Re.setState({title:Qe.currentTarget.value})})}function E({row:Re,dashboard:Ve}){const{$behaviors:Qe,children:je}=Re.useState();let ze=Qe?.find(ce=>ce instanceof d.L);const Ge=(0,m.useMemo)(()=>je.reduce((ce,Pe)=>[...ce,...r.jh.findDescendents(Pe,r.Eb)],[]),[je]).some(ce=>{const Pe=(0,y.un)(ce);return Pe?.state.datasource?.uid===p.K||Pe?.state.datasource?.uid===c.uv&&Pe?.state.queries.some(Se=>Se.datasource?.uid===p.K)});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g.U,{sceneContext:Ve,repeat:ze?.state.variableName,onChange:ce=>{ce?(ze?.removeBehavior(),ze=new d.L({variableName:ce}),Re.setState({$behaviors:[...Re.state.$behaviors??[],ze]})):ze?.removeBehavior()}}),Ge?(0,s.jsxs)(f.F,{"data-testid":a.Tp.pages.Dashboard.Rows.Repeated.ConfigSection.warningMessage,severity:"warning",title:"",topSpacing:3,bottomSpacing:0,children:[(0,s.jsx)("p",{children:(0,s.jsxs)(u.x6,{i18nKey:"dashboard.default-layout.row-options.form.repeat-for.warning.text",children:["Panels in this row use the ",{SHARED_DASHBOARD_QUERY:p.K}," data source. These panels will reference the panel in the original row, not the ones in the repeated rows."]})}),(0,s.jsx)(h.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/create-dashboard/#configure-repeating-rows",children:(0,s.jsx)(u.x6,{i18nKey:"dashboard.default-layout.row-options.form.repeat-for.learn-more",children:"Learn more"})})]}):void 0]})}function v(Re){return"isEditableDashboardElement"in Re}var C=e(7389),S=e(36490),O=e(37386),I=e(87105),R=e(41654),T=e(43243),L=e(45861),K=e(20246),A=e(29),W=e(44741);class N{constructor(Ve){this.variable=Ve,this.isEditableDashboardElement=!0,this.typeName="Variable"}getEditableElementInfo(){return{typeName:(0,u.t)("dashboard.edit-pane.elements.variable","Variable"),icon:"dollar-alt",instanceName:this.variable.state.name,isHidden:this.variable.state.hide===C.zL.hideVariable}}useEditPaneOptions(Ve){const Qe=this.variable;return[(0,m.useMemo)(()=>new i.C({title:"",id:"panel-options"}).addItem(new x.v({title:"",skipField:!0,render:()=>(0,s.jsx)(w,{variable:Qe,isNewElement:Ve})})).addItem(new x.v({title:(0,u.t)("dashboard-scene.variable-editor-form.label","Label"),description:(0,u.t)("dashboard-scene.variable-editor-form.description-optional-display-name","Optional display name"),render:()=>(0,s.jsx)(j,{variable:Qe})})).addItem(new x.v({title:(0,u.t)("dashboard-scene.variable-editor-form.description","Description"),render:()=>(0,s.jsx)(V,{variable:Qe})})).addItem(new x.v({title:"",skipField:!0,render:()=>(0,s.jsx)(U,{variable:Qe})})).addItem(new x.v({title:(0,u.t)("dashboard-scene.variable-editor-form.type","Type"),render:()=>(0,s.jsx)(F,{variable:Qe})})),[Qe,Ve])]}onDelete(){const Ve=this.variable.parent;Ve instanceof r.Pj&&(this.variable.publishEvent(new $e(this.variable),!0),Ve.setState({variables:Ve.state.variables.filter(Qe=>Qe!==this.variable)}))}onChangeName(Ve){this.variable.setState({name:Ve});const Qe=(0,W.c$)(this.variable,Ve);if(Qe.errorMessage)return Qe}}function w({variable:Re,isNewElement:Ve}){const{name:Qe}=Re.useState(),je=(0,K.z4)({autoFocus:Ve}),[ze,Ye]=(0,m.useState)(),[Ge,ce]=(0,m.useState)(Re.state.name),Pe=Ee=>{const xe=(0,W.c$)(Re,Ee.currentTarget.value);xe.errorMessage!==ze?Ye(xe.errorMessage):ce(Re.state.name),Re.setState({name:Ee.currentTarget.value})},Se=()=>{ze&&(Re.setState({name:Ge}),Ye(void 0))};return(0,s.jsx)(O.D,{label:(0,u.t)("dashboard-scene.variable-editor-form.name","Name"),invalid:!!ze,error:ze,children:(0,s.jsx)(l.p,{ref:je,value:Qe,onCh
168ange:Pe,required:!0,onBlur:Se})})}function j({variable:Re}){const{label:Ve}=Re.useState();return(0,s.jsx)(l.p,{value:Ve,onChange:Qe=>Re.setState({label:Qe.currentTarget.value})})}function V({variable:Re}){const{description:Ve}=Re.useState();return(0,s.jsx)(I.f,{id:"description-text-area",value:Ve??"",placeholder:(0,u.t)("dashboard-scene.variable-editor-form.placeholder-descriptive-text","Descriptive text"),onChange:Qe=>Re.setState({description:Qe.currentTarget.value})})}function U({variable:Re}){const{hide:Ve=C.zL.dontHide}=Re.useState(),Qe=je=>{Re.setState({hide:je})};return(0,s.jsx)(A.D,{hide:Ve,type:Re.state.type,onChange:Qe})}function F({variable:Re}){const Ve=(0,m.useMemo)(()=>(0,W.B$)().map(je=>({value:je.value,label:je.label})),[]),Qe=()=>{const je=Re.parent;if(!(je instanceof r.Pj))return;const ze=je.state.variables.indexOf(Re);S.Ny.partial({editview:"variables",editIndex:ze})};return(0,s.jsxs)(R.B,{gap:2,direction:"column",children:[(0,s.jsx)(T.G,{value:Re.state.type,options:Ve,disabled:!0,onChange:()=>{}}),(0,s.jsx)(L.$n,{tooltip:(0,u.t)("dashboard-scene.variable-editor-form.open-editor-tooltip","For more variable options open variable editor"),onClick:Qe,fullWidth:!0,children:(0,s.jsx)(u.x6,{i18nKey:"dashboard-scene.variable-editor-form.open-editor",children:"Open variable editor"})})]})}var M=e(22803),H=e(63142),_=e(66404),Z=e(31286);class ne{constructor(Ve){this.set=Ve,this.isEditableDashboardElement=!0,this.typeName="Variable"}getEditableElementInfo(){return{typeName:(0,u.t)("dashboard.edit-pane.elements.variable-set","Variables"),icon:"x",instanceName:(0,u.t)("dashboard.edit-pane.elements.variable-set","Variables"),isContainer:!0}}useEditPaneOptions(){const Ve=this.set;return[(0,m.useMemo)(()=>new i.C({title:"",id:"variables"}).addItem(new x.v({title:"",skipField:!0,render:()=>(0,s.jsx)(te,{set:Ve})})),[Ve])]}}function te({set:Re}){const{variables:Ve}=Re.useState(),Qe=(0,H.of)(Y),je=Ye=>{const{editPane:Ge}=(0,y.YQ)(Re).state;Ge.selectObject(Ye,Ye.state.key)},ze=()=>{const Ye=(0,W.kh)(Ve);Re.setState({variables:[...Ve,Ye]}),Re.publishEvent(new Me(Ye),!0)};return(0,s.jsxs)(R.B,{direction:"column",gap:0,children:[Ve.map(Ye=>(0,s.jsxs)("div",{className:Qe.variableItem,onClick:()=>je(Ye),children:[(0,s.jsxs)(_.E,{children:["$",Ye.state.name]}),(0,s.jsx)(R.B,{direction:"row",gap:1,alignItems:"center",children:(0,s.jsx)(L.$n,{variant:"primary",size:"sm",fill:"outline",children:(0,s.jsx)(u.x6,{i18nKey:"dashboard.edit-pane.variables.select-variable",children:"Select"})})})]},Ye.state.name)),(0,s.jsx)(Z.a,{paddingBottom:1,display:"flex",children:(0,s.jsx)(L.$n,{fullWidth:!0,icon:"plus",size:"sm",variant:"secondary",onClick:ze,children:(0,s.jsx)(u.x6,{i18nKey:"dashboard.edit-pane.variables.add-variable",children:"Add variable"})})})]})}function Y(Re){return{variableItem:(0,M.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:Re.spacing(1),padding:Re.spacing(.5),borderRadius:Re.shape.radius.default,cursor:"pointer",[Re.transitions.handleMotion("no-preference","reduce")]:{transition:Re.transitions.create(["color"],{duration:Re.transitions.duration.short})},"&:last-child":{marginBottom:Re.spacing(2)},button:{visibility:"hidden"},"&:hover":{color:Re.colors.text.link,button:{visibility:"visible"}}})}}var Q=e(30703),J=e(44802);const q=({dashboard:Re})=>(0,s.jsx)(L.$n,{size:"sm",variant:"secondary",tooltip:(0,u.t)("dashboard.toolbar.new.edit-dashboard-v2-schema.tooltip","Edit dashboard v2 schema"),icon:(0,s.jsx)(Q.I,{name:"brackets-curly",size:"lg",type:"default"}),onClick:()=>Re.openV2SchemaEditor()});class X{constructor(Ve){this.dashboard=Ve,this.isEditableDashboardElement=!0}getEditableElementInfo(){return{typeName:(0,u.t)("dashboard.edit-pane.elements.dashboard","Dashboard"),icon:"apps",instanceName:(0,u.t)("dashboard.edit-pane.elements.dashboard","Dashboard"),isContainer:!0}}useEditPaneOptions(){const Ve=this.dashboard,{body:Qe}=Ve.useState(),je=(0,m.useMemo)(()=>new i.C({title:"",id:"dashboard-options"}).addItem(new x.v({title:(0,u.t)("dashboard.options.title-option","Title"),render:()=>(0,s.jsx)(se,{dashboard:Ve})})).addItem(new x.v({title:(0,u.t)("dashboard.options.description","Description"),render:()=>(0,s.jsx)(oe,{dashboard:Ve})})),[Ve]),ze=(0,J.W)(Qe);return[je,...ze]}renderActions(){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(q,{dashboard:this.dashboard}),(0,s.jsx)(L.$n,{variant:"secondary",size:"sm",onClick:()=>this.dashboard.onOpenSettings(),tooltip:(0,u.t)("dashboard.toolbar.dashboard-settings.tooltip","Dashboard settings"),children:(0,s.jsxs)(R.B,{direction:"row",gap:1,justifyContent:"space-between",alignItems:"center",children:[(0,s.jsx)("span",{children:(0,s.jsx)(u.x6,{i18nKey:"dashboard.actions.open-settings",children:"Settings"})}),(0,s.jsx)(Q.I,{name:"sliders-v-alt"})]})})]})}}function se({dashboard:Re}){const{title:Ve}=Re.useState();return(0,s.jsx)(l.p,{value:Ve,onChange:Qe=>Re.setState({title:Qe.currentTarget.value})})}function oe({dashboard:Re}){const{description:Ve}=Re.useState();return(0,s.jsx)(I.f,{value:Ve,onChange:Qe=>
168Re.setState({description:Qe.currentTarget.value})})}var ae=e(73427),ie=e(87745),fe=e(22175),pe=e(25953),de=e(93389),le=e(3688),me=e(1682),De=e(24726);class Te{constructor(Ve){this._panels=Ve,this.isEditableDashboardElement=!0,this.key=(0,De.A)()}getEditableElementInfo(){return{typeName:(0,u.t)("dashboard.edit-pane.elements.panels","Panels"),icon:"folder",instanceName:""}}useEditPaneOptions(){return[new i.C({title:"",id:""})]}onConfirmDelete(){ae.lE.publish(new ie.bY({title:(0,u.t)("dashboard.edit-pane.elements.multiple-panels","Multiple panels"),text:(0,u.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(Ve=>{Ve.onDelete()})}}class Ne{constructor(Ve){this.panel=Ve,this.isEditableDashboardElement=!0,this.typeName="Panel"}getEditableElementInfo(){return{typeName:(0,u.t)("dashboard.edit-pane.elements.panel","Panel"),icon:"chart-line",instanceName:r.jh.interpolate(this.panel,this.panel.state.title,void 0,"text")}}useEditPaneOptions(Ve){const Qe=this.panel,je=Qe.parent,ze=(0,m.useMemo)(()=>new i.C({title:"",id:"panel-options"}).addItem(new x.v({title:"",render:()=>(0,s.jsx)(Ce,{panel:this.panel})})).addItem(new x.v({title:(0,u.t)("dashboard.viz-panel.options.title-option","Title"),value:Qe.state.title,popularRank:1,render:()=>(0,s.jsx)(fe.m,{panel:Qe,isNewElement:Ve})})).addItem(new x.v({title:(0,u.t)("dashboard.viz-panel.options.description","Description"),value:Qe.state.description,render:()=>(0,s.jsx)(fe.dF,{panel:Qe})})).addItem(new x.v({title:(0,u.t)("dashboard.viz-panel.options.transparent-background","Transparent background"),render:()=>(0,s.jsx)(fe.R4,{panel:Qe})})),[Qe,Ve]),Ye=(0,m.useMemo)(()=>(0,le.y)(je)&&je.getOptions?je.getOptions():[],[je]);return[ze,...Ye]}onDelete(){me.b4.getLayoutManagerFor(this.panel).removePanel?.(this.panel)}onConfirmDelete(){ae.lE.publish(new ie.bY({title:(0,u.t)("dashboard.viz-panel.delete-panel-title","Delete panel?"),text:(0,u.t)("dashboard.viz-panel.delete-panel-text","Deleting this panel will also remove all queries. Are you sure you want to continue?"),yesText:(0,u.t)("dashboard.viz-panel.delete-panel-yes","Delete"),onConfirm:()=>{this.onDelete()}}))}onDuplicate(){me.b4.getLayoutManagerFor(this.panel).duplicatePanel?.(this.panel)}onCopy(){(0,y.YQ)(this.panel).copyPanel(this.panel)}onChangeName(Ve){(0,fe.TU)(this.panel,Ve)}createMultiSelectedElement(Ve){return new Te(Ve)}scrollIntoView(){this.panel.parent instanceof pe.X&&this.panel.parent.scrollIntoView(),this.panel.parent instanceof de.U&&this.panel.parent.scrollIntoView()}}const Ce=({panel:Re})=>(0,s.jsx)(R.B,{alignItems:"center",width:"100%",children:(0,s.jsx)(L.$n,{onClick:()=>{S.Ny.partial({editPanel:(0,y.Cs)(Re)})},icon:"sliders-v-alt",fullWidth:!0,size:"sm",tooltip:(0,u.t)("dashboard.viz-panel.options.configure-button-tooltip","Edit queries and visualization options"),children:(0,s.jsx)(u.x6,{i18nKey:"dashboard.new-panel.configure-button",children:"Configure"})})});function He(){return(0,t.A)("grafana.dashboards.edit-pane.isCollapsed",!1)}function ke(Re){if(Re){if(v(Re))return Re;if(Re instanceof r.Eb)return new Ne(Re);if(Re instanceof r.tI)return new D(Re);if(Re instanceof o.H$)return new X(Re);if(Re instanceof r.Pj)return new ne(Re);if((0,W.VD)(Re))return new N(Re)}}class Me extends n.x{static{this.type="new-object-added-to-canvas"}}class $e extends n.x{static{this.type="object-removed-from-canvas"}}class tt extends n.x{static{this.type="objects-reordered-on-canvas"}}class Ke extends n.x{static{this.type="conditional-rendering-changed"}}},34273:(ee,B,e)=>{"use strict";e.d(B,{W:()=>r});var t=e(95004);function n(){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s="abcdefghijklmnopqrstuvwxyz",m=o.length,a=new Map;return l=>{const f=a.get(l);if(f!=null)return f;const h=[...l].map(u=>u.toLowerCase()&&u!==u.toUpperCase()?s.charAt(Math.floor(Math.random()*m)):u.toUpperCase()&&u!==u.toUpperCase()?o.charAt(Math.floor(Math.random()*m)):u).join("");return a.set(l,h),h}}function r(o,s){if(!(s.labels||s.names||s.values))return o;const m=new Set(["time","value","exemplar","traceid","id","uid","uuid","__name__","le","name"]),a=n();return o.map(l=>{let{schema:f,data:h}=l;if(f&&h){if(s.labels){for(const u of f.fields)if(u.labels){const i={};for(const[x,g]of Object.entries(u.labels))i[x]=a(g);u.labels=i}}if(s.names)for(const u of f.fields)u.name?.length&&!m.has(u.name.toLowerCase())&&(u.n
168ame=a(u.name));s.values&&f.fields.forEach((u,i)=>{if(u.type===t.PU.string&&h){const x=h.values[i].map(g=>a(String(g)));h.values[i]=x}})}return{schema:f,data:h}})}},41644:(ee,B,e)=>{"use strict";e.d(B,{m6:()=>R,sP:()=>N});var t=e(2543),n=e.n(t),r=e(92138),o=e(68143),s=e(36490),m=e(43173),a=e(56838),l=e(14375),f=e(5114),h=e(47797),u=e(60017),i=e(75735),x=e(50803),g=e(95407),p=e(60171),c=e(48600),y=e(22429),P=e(83127),d=e(95710),D=e(96673),b=e(84019),E=e(31119),v=e(65333),C=e(17788),S=e(75570);const O=500,I="loadDashboardScene",R="__grafana_home_uid__";class T extends f.Q{constructor(){super(...arguments),this.cache={}}getCache(){return this.cache}async fetchHomeDashboard(){const j=await(0,o.AI)().get("/api/dashboards/home");if((0,D.isRedirectResponse)(j)){const V=r.I.stripBaseFromUrl(j.redirectUri);return s.Ny.replace(V),null}return(0,p.aK)(j.dashboard)&&(j.dashboard=(0,x.Sb)(j.dashboard,{name:"",generation:0,resourceVersion:"0",creationTimestamp:""})),j?.meta&&(j.meta.canSave=!1,j.meta.canShare=!1,j.meta.canStar=!1),j}async loadHomeDashboard(){const j=await this.fetchHomeDashboard();return j?(0,v.wM)(j):null}async loadSnapshot(j){try{const V=await this.loadSnapshotScene(j);this.setState({dashboard:V,isLoading:!1})}catch(V){const U=(0,h.do)(V),F=(0,h.q6)(V),M=(0,h.rE)(V);if(this.setState({isLoading:!1,loadError:{status:U,message:F,messageId:M}}),V instanceof g.P)throw V}}async loadProvisioningDashboard(j,V){const F=new URLSearchParams(window.location.search).get("ref")??void 0,M=`${l.C}/repositories/${j}/files/${V}`;return(0,o.AI)().get(M,F?{ref:F}:void 0).then(H=>{const _=H.resource.dryRun;return _?_.apiVersion.startsWith("dashboard.grafana.app")?this.processDashboardFromProvisioning(j,V,_,{file:M,ref:F,repo:j}):Promise.reject("unexpected resource type: "+_.apiVersion):Promise.reject("failed to read provisioned dashboard")})}processDashboardFromProvisioning(j,V,U,F){if(U.apiVersion.split("/")[1]==="v2alpha1")return{...U,kind:"DashboardWithAccessInfo",access:{canStar:!1,isSnapshot:!1,canShare:!1,canDelete:!0,canSave:!0,canEdit:!0}};let M=U.metadata.annotations;return M||(U.metadata.annotations={}),M[i.LH]="repo",M[i.Jw]=j,M[i.Y_]=F.ref?V+"#"+F.ref:V,{meta:{canStar:!1,isSnapshot:!1,canShare:!1,canDelete:!0,canSave:!0,canEdit:!0,k8s:U.metadata,provisioning:F},dashboard:U.spec}}async loadDashboard(j){try{(0,u.j)(I);const V=await this.loadScene(j);if(!V)return;m.$.featureToggles.preserveDashboardStateWhenNavigating&&j.uid&&(0,C.Gq)(V),this.setState({dashboard:V,isLoading:!1,options:j});const U=(0,u.z)(I),F=a.jh.getQueryController(V);(0,d.Dd)(V,U?.duration),F?.startProfile("DashboardScene"),j.route!==D.DashboardRoutes.New&&(0,P.B)({meta:V.state.meta,uid:V.state.uid,title:V.state.title,id:V.state.id})}catch(V){const U=(0,h.do)(V),F=(0,h.q6)(V),M=(0,h.rE)(V);if(this.setState({isLoading:!1,loadError:{status:U,message:F,messageId:M}}),V instanceof g.P)throw V}}async loadScene(j){if(this.setState({dashboard:void 0,isLoading:!0}),j.route===D.DashboardRoutes.Home)return await this.loadHomeDashboard();const V=await this.fetchDashboard(j);return V?this.transformResponseToScene(V,j):null}getDashboardFromCache(j){const V=this.dashboardCache;return V&&V.cacheKey===j&&Date.now()-V?.ts<O?V.dashboard:null}clearState(){(0,y.UA)().setCurrent(void 0),this.setState({dashboard:void 0,loadError:void 0,isLoading:!1,panelEditor:void 0})}setDashboardCache(j,V){this.dashboardCache={dashboard:V,ts:Date.now(),cacheKey:j}}clearDashboardCache(){this.dashboardCache=void 0}getSceneFromCache(j){return this.cache[j]}setSceneCache(j,V){this.cache[j]=V}clearSceneCache(){this.cache={}}}class L extends T{transformResponseToScene(j,V){const U=this.getSceneFromCache(V.uid);if(U&&U.state.version===j?.dashboard.version)return U;if(j?.dashboard){const F=(0,v.wM)(j);return V.uid&&this.setSceneCache(V.uid,F),F}throw new Error("Dashboard not found")}async loadSnapshotScene(j){const V=await c.np.loadSnapshot(j);if(V?.dashboard)return(0,v.wM)(V);throw new Error("Snapshot not found")}async fetchDashboard({type:j,slug:V,uid:U,route:F,urlFolderUid:M,params:H}){const _=F===D.DashboardRoutes.Home?R:U;
168if(!H){const ne=this.getDashboardFromCache(_);if(ne)return ne}let Z;try{switch(F){case D.DashboardRoutes.Home:const ne=await this.fetchHomeDashboard();if(!ne)return null;Z=ne;break;case D.DashboardRoutes.New:Z=await(0,b.X)(M);break;case D.DashboardRoutes.Provisioning:return this.loadProvisioningDashboard(V||"",U);case D.DashboardRoutes.Public:return await c.np.loadDashboard("public","",U);default:const te=H?{version:H.version,scopes:H.scopes,from:H.timeRange.from,to:H.timeRange.to,...H.variables}:void 0;Z=await c.np.loadDashboard(j||"db",V||"",U,te),F===D.DashboardRoutes.Embedded&&(Z.meta.isEmbedded=!0)}if(Z.meta.url&&F===D.DashboardRoutes.Normal){const ne=r.I.stripBaseFromUrl(Z.meta.url),te=s.Ny.getLocation().pathname;ne!==te&&(s.Ny.replace({...s.Ny.getLocation(),pathname:ne}),console.log("not correct url correcting",ne,te))}Z.meta.folderUid&&await(0,S.Q)(Z.meta.folderUid),this.setDashboardCache(_,Z)}catch(ne){if((0,o.NF)(ne)&&ne.cancelled)return null;throw ne}return Z}async reloadDashboard(j){const V=this.state.options;if(!V)return;const U={...V,params:j};if(!((0,t.isEqual)(U.params?.variables,V.params?.variables)&&(0,t.isEqual)(U.params?.scopes,V.params?.scopes)))try{this.setState({isLoading:!0});const F=await this.fetchDashboard(U),M=this.getSceneFromCache(U.uid);if(M&&M.state.version===F?.dashboard.version){this.setState({isLoading:!1});return}if(!F?.dashboard){this.setState({isLoading:!1,loadError:{status:404,message:"Dashboard not found"}});return}const H=(0,v.wM)(F);this.setSceneCache(U.uid,H),this.setState({dashboard:H,isLoading:!1,options:U})}catch(F){const M=(0,h.do)(F),H=(0,h.q6)(F);if(this.setState({isLoading:!1,loadError:{message:H,status:M}}),F instanceof g.P)throw F}}}class K extends T{constructor(){super(...arguments),this.dashboardLoader=new c.t0}async loadSnapshotScene(j){const V=await this.dashboardLoader.loadSnapshot(j);if(V?.spec)return(0,E.dj)(V);throw new Error("Snapshot not found")}transformResponseToScene(j,V){const U=this.getSceneFromCache(V.uid);if(U&&U.state.version===j?.metadata.generation)return U;if(j){const F=(0,E.dj)(j);return V.uid&&this.setSceneCache(V.uid,F),F}throw new Error("Dashboard not found")}async fetchDashboard({type:j,slug:V,uid:U,route:F,urlFolderUid:M,params:H}){const _=F===D.DashboardRoutes.Home?R:U;if(!H){const ne=this.getDashboardFromCache(_);if(ne)return ne}let Z;try{switch(F){case D.DashboardRoutes.New:Z=await(0,b.V)(M);break;case D.DashboardRoutes.Provisioning:return await this.loadProvisioningDashboard(V||"",U);case D.DashboardRoutes.Public:return await this.dashboardLoader.loadDashboard("public","",U);default:const ne=H?{version:H.version,scopes:H.scopes,from:H.timeRange.from,to:H.timeRange.to,...H.variables}:void 0;if(Z=await this.dashboardLoader.loadDashboard(j||"db",V||"",U,ne),F===D.DashboardRoutes.Embedded)throw new Error("Method not implemented.")}if(Z.access.url&&F===D.DashboardRoutes.Normal){const ne=r.I.stripBaseFromUrl(Z.access.url),te=s.Ny.getLocation().pathname;
168ne!==te&&(s.Ny.replace({...s.Ny.getLocation(),pathname:ne}),console.log("not correct url correcting",ne,te))}Z.metadata.annotations?.[i.ew]&&await(0,S.Q)(Z.metadata.annotations?.[i.ew]),this.setDashboardCache(_,Z)}catch(ne){if((0,o.NF)(ne)&&ne.cancelled)return null;throw ne}return Z}async reloadDashboard(j){const V=this.state.options;if(!V)return;const U={...V,params:j};if(!((0,t.isEqual)(U.params?.variables,V.params?.variables)&&(0,t.isEqual)(U.params?.scopes,V.params?.scopes)))try{this.setState({isLoading:!0});const F=await this.fetchDashboard(U),M=this.getSceneFromCache(U.uid);if(M&&M.state.version===F?.metadata.generation){this.setState({isLoading:!1});return}if(!F?.spec){this.setState({isLoading:!1,loadError:{status:404,message:"Dashboard not found"}});return}const H=(0,E.dj)(F);this.setSceneCache(U.uid,H),this.setState({dashboard:H,isLoading:!1,options:U})}catch(F){const M=(0,h.do)(F),H=(0,h.q6)(F);if(this.setState({isLoading:!1,loadError:{message:H,status:M}}),F instanceof g.P)throw F}}}class A extends T{constructor(j){super(j),this.v1Manager=new L(j),this.v2Manager=new K(j),this.activeManager=this.v1Manager}async withVersionHandling(j){try{return await j(this.activeManager)}catch(V){if(V instanceof g.P){const U=V.data.storedVersion==="v2alpha1"?this.v2Manager:this.v1Manager;return this.activeManager=U,await j(U)}else throw V}finally{this.setState(this.activeManager.state)}}async fetchDashboard(j){return this.withVersionHandling(V=>V.fetchDashboard(j))}async reloadDashboard(j){return this.withVersionHandling(V=>V.reloadDashboard.call(this,j))}getDashboardFromCache(j){return this.activeManager.getDashboardFromCache(j)}transformResponseToScene(j,V){return j?(0,p.HG)(j)?(this.activeManager=this.v2Manager,this.v2Manager.transformResponseToScene(j,V)):this.v1Manager.transformResponseToScene(j,V):null}async loadSnapshotScene(j){try{return await this.v1Manager.loadSnapshotScene(j)}catch(V){if(V instanceof g.P&&V.data.storedVersion==="v2alpha1")return await this.v2Manager.loadSnapshotScene(j);throw new Error("Snapshot not found")}}async loadSnapshot(j){return this.withVersionHandling(V=>V.loadSnapshot(j))}clearDashboardCache(){this.v1Manager.clearDashboardCache(),this.v2Manager.clearDashboardCache()}clearSceneCache(){this.v1Manager.clearSceneCache(),this.v2Manager.clearSceneCache(),this.cache={}}getCache(){return this.activeManager.getCache()}setDashboardCache(j,V){(0,p.HG)(V)?this.v2Manager.setDashboardCache(j,V):this.v1Manager.setDashboardCache(j,V)}async loadDashboard(j){if(j.route===D.DashboardRoutes.New){const V=m.$.featureToggles.dashboardNewLayouts?"v2":"v1";this.setActiveManager(V)}return this.withVersionHandling(V=>V.loadDashboard.call(this,j))}setActiveManager(j){j==="v1"?this.activeManager=this.v1Manager:this.activeManager=this.v2Manager}}const W={v1:void 0,v2:void 0,unified:void 0};function N(w){return w==="v1"?(W.v1||(W.v1=new L({})),W.v1):w==="v2"?(W.v2||(W.v2=new K({})),W.v2):(W.unified||(W.unified=new A({})),W.unified)}},75570:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>s});var t=e(6890),n=e(83873),r=e(66198),o=e(8535);async function s(m){try{const a=await n.IB.getFolderByUid(m);o.M_.dispatch((0,t.Vz)((0,r.R4)(a)))}catch(a){console.warn("Error fetching parent folder",m,"for dashboard",a)}}},80849:(ee,B,e)=>{"use strict";e.d(B,{p:()=>l});var t=e(74848),n=e(85629),r=e(31286),o=e(41654),s=e(66404),m=e(45861),a=e(56840);function l(f){return(0,t.jsx)(r.a,{alignItems:"center",padding:4,children:(0,t.jsxs)(o.B,{direction:"column",alignItems:"center",gap:2,children:[(0,t.jsx)(s.E,{element:"h3",textAlignment:"center",children:(0,t.jsx)(a.x6,{i18nKey:"transformations.empty.add-transformation-header",children:"Start transforming data"})}),(0,t.jsx)(s.E,{element:"p",textAlignment:"center","data-testid":n.Tp.components.Transforms.noTransformationsMessage,children:(0,t.jsxs)(a.x6,{i18nKey:"transformations.empty.add-transformation-body",children:["Transformations allow data to be changed in various ways before your visualization is shown.",(0,t.jsx)("br",{}),"This includes joining data together, renaming fields, making calculations, formatting data for display, and more."]})}),(0,t.jsx)(m.$n,{icon:"plus",variant:"primary",size:"md",onClick:f.onShowPicker,"data-testid":n.Tp.components.Transforms.addTransformationButton,children:(0,t.jsx)(a.x6,{i18nKey:"dashboard-scene.empty-transformations-message.add-transformation",children:"Add transformation"})})]})})}},89451:(ee,B,e)=>{"use strict";e.d(B,{L:()=>et});var t=e(2543),n=e(36490),r=e(43173),o=e(56838),s=e(68373),m=e(77731),a=e(30124),l=e(3204),f=e(17862),h=e(29700),u=e(3688),i=e(70030),x=e(8285);class g extends o.Bs{constructor(rt){super({source:rt.source,data:rt.source.resolve().state.data}),this.addActivationHandler(()=>{this._subs.add(this.state.source.resolve().subscribeToState((it,Pt)=>{it.data!==Pt.data&&this.setState({data:it.data})}))})}setContainerWidth(rt){this.state.source.resolve().setContainerWidth?.(rt)}isDataReadyToDisplay(){return this.state.source.resolve().isDataReadyToDisplay?.()??!0}cancelQuery(){this.state.source.resolve().cancelQuery?.()}getResultsStream(){return this.state.source.resolve().getResultsStream()}}var p=e(74848),c=e(22803),y=e(85629),P=e(63142),d=e(54314),D=e(92807),b=e(13941),E=e(32881),v=e(65642),C=e(73427),S=e(54),O=e(52161),I=e(34999),R=e(6975),T=e(60208),L=e(56840),K=e(22971),A=e(21764),W=e(77256),N=e(54148),w=e(16817),j=e(5556),V=e(25992),U=e(45861),F=e(74268),M=e(20437);const H=({panel:Je,className:rt})=>{const it=(0,N.zy)(),{loading:Pt,value:It}=(0,w.A)(()=>(0,M.J6)(Je),[Je]);if(Pt)return(0,p.jsx)(U.$n,{disabled:!0,children:(0,p.jsx)(L.x6,{i18nKey:"dashboard-scene.scenes-new-rule-from-panel-button.new-alert-rule",children:"New alert rule"})});if(!It)return(0,p.jsx)(I.F,{severity:"info",title:(0,L.t)("dashboard-scene.scenes-new-rule-from-panel-button.title-no-alerting-capable-query-found","No alerting capable query found"),children:(0,p.jsx)(L.x6,{i18nKey:"dashboard-scene.scenes-new-rule-from-panel-button.body-no-alerting-capable-query-found",children:"Cannot create alerts from this panel because no query to an alerting capable datasource is found."})});const Vt=async()=>{(0,V.fH)(F.le.alertRuleFromPanel);const en=await(0,M.J6)(Je),ln=j.kM.renderUrl("/alerting/new",{defaults:JSON.stringify(en),returnTo:it.pathname+it.search});n.Ny.push(ln)};return(0,p.jsx)(U.$n,{icon:"bell",onClick:Vt,className:rt,"data-testid":"create-alert-rule-button",children:(0,p.jsx)(L.x6,{i18nKey:"dashboard-scene.scenes-new-rule-from-panel-button.new-alert-rule",children:"New alert rule"})})};var _=(Je=>(Je.Queries="queries",Je.Transformations="transformations",Je.Alert="alert",Je))(_||{});class Z extends o.Bs{constructor(){super(...arguments),this.tabId=_.Alert}static{this.Component=ne}renderTab(rt){return(0,p.jsx)(Y,{model:this,...rt},this.getTabLabel())}getTabLabel(){return"Alert"}getDashboardUID(){return this.getDashboard().state.uid}getDashboard(){return(0,x.YQ)(this)}getLegacyPanelId(){return(0,x.Cs)(this.state.panelRef.resolve())}getCanCreateRules(){const rt=(0,S.Wd)("grafana");return r.$.unifiedAlerting&&this.getDashboard().state.meta.canSave&&C.TP.hasPermission(rt.create)}}function ne({model:Je}){const rt=(0,P.of)(te),{errors:it,loading:Pt,rules:It}=(0,A.S)({dashboardUID:Je.getDashboardUID(),panelId:Je.getLegacyPanelId()}),Vt=it.length?(0,p.jsx)(I.F,{title:(0,L.t)("dashboard-scene.panel-data-alerting-tab-rendered.alert.title-errors-loading-rules","Errors loading rules"),severity:"error",children:it.map((En,zn)=>(0,p.jsxs)("div",{children:["Failed to load Grafana rules state: ",(0,W.JZ)(En)]},zn))}):null;if(Pt&&!It.length)return(0,p.jsxs)(p.Fragment,{children:[Vt,(0,p.jsx)(R._,{text:(0,L.t)("dashboard-scene.panel-data-alerting-tab-rendered.text-loading-rules","Loading rules...")})]});const en=Je.state.panelRef.resolve(),ln=Je.getCanCreateRules();if(It.length)return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(K.sF,{rules:It}),ln&&(0,p.jsx)(H,{className:rt.newButton,panel:en})]});const Qt=!Je.getDashboardUID(),xn=Je.getDashboard();return(0,p.jsxs)("div",{className:rt.noRulesWrapper,children:[!Qt&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{children:(0,p.jsx)(L.x6,{i18nKey:"dashboard.panel-edit.alerting-tab.no-rules",children:"There are no alert rules linked to this panel."})}),ln&&(0,p.jsx)(H,{panel:en})]}),Qt&&!!xn.state.meta.canSave&&(0,p.jsx)(I.F,{severity:"info",title:(0,L.t)("dashboard-scene.panel-data-alerting-tab-rendered.title-dashboard-not-saved","Dashboard not saved"),children:(0,p.jsx)(L.x6,{i18nKey:"dashboard.panel-edit.alerting-tab.dashboard-not-saved",children:"Dashboard must be saved before alerts can be added."})})]})}const te=Je=>({newButton:(0,c.css)({marginTop:Je.spacing(3)}),noRulesWrapper:(0,c.css)({margin:Je.spacing(2),backgroundColor:Je.colors.background.secondary,padding:Je.spacing(3)})});function Y(Je){const{model:rt}=Je,{rules:it}=(0,A.S)({dashboardUID:rt.getDashboardUID(),panelId:rt.getLegacyPanelId(),poll:!1});return(0,p.jsx)(T.o,{label:rt.getTabLabel(),icon:"bell",counter:it.length,active:Je.active,onChangeTab:Je.onChangeTab})}var Q=e(48480),J=e(1906),q=e(78282),X=e(41654),se=e(1404),oe=e(7078),ae=e(29328),ie=e(23117),fe=e(65966),pe=e(32154),de=e(57204),le=e(73601),me=e(18615),De=e(98838),Te=e(4651),Ne=e(28998),Ce=e(81657),He
168=e(22175);class ke extends o.Bs{constructor(rt){super(rt),this.tabId=_.Queries,this.onOpenInspector=()=>{const it=this.state.panelRef.resolve(),Pt=(0,x.Cs)(it);n.Ny.partial({inspect:Pt,inspectTab:"query"})},this.onChangeDataSource=async(it,Pt)=>{const{dsSettings:It}=this.state,Vt=this.queryRunner,en=It?await(0,q.l)().get({uid:It.uid}):void 0,ln=await(0,q.l)().get({uid:it.uid}),Qt=Vt.state.queries,xn=Pt||await(0,de.y)(ln,it.uid,Qt,en);Vt.setState({datasource:(0,Q.p$)(it),queries:xn}),Pt&&Vt.runQueries(),this.loadDataSource()},this.onQueryOptionsChange=it=>{const Pt=this.state.panelRef.resolve(),It=this.queryRunner,Vt={},en={};it.maxDataPoints!==It.state.maxDataPoints&&(Vt.maxDataPoints=it.maxDataPoints??void 0),it.minInterval!==It.state.minInterval&&(Vt.minInterval=it.minInterval??void 0);const ln=it.timeRange?.from??void 0,Qt=it.timeRange?.shift??void 0,xn=it.timeRange?.hide;ln!==void 0||Qt!==void 0?(en.$timeRange=new Ce.v({timeFrom:ln,timeShift:Qt,hideTimeOverride:xn}),en.hoverHeader=(0,He.$7)(Pt.state.title,en.$timeRange)):(en.$timeRange=void 0,en.hoverHeader=(0,He.$7)(Pt.state.title,void 0)),it.cacheTimeout!==It?.state.cacheTimeout&&(Vt.cacheTimeout=it.cacheTimeout),it.queryCachingTTL!==It?.state.queryCachingTTL&&(Vt.queryCachingTTL=it.queryCachingTTL),Pt.setState(en),It.setState(Vt),It.runQueries()},this.onQueriesChange=it=>{this.queryRunner.setState({queries:it})},this.onRunQueries=()=>{this.queryRunner.runQueries()},this.addQueryClick=()=>{const it=this.getQueries();this.onQueriesChange((0,se.U7)(it,this.newQuery()))},this.onAddQuery=it=>{const Pt=this.getQueries(),It=this.state.dsSettings;this.onQueriesChange((0,se.U7)(Pt,it,It?(0,Q.p$)(It):{type:void 0,uid:void 0}))},this.onAddExpressionClick=()=>{const it=this.getQueries();this.onQueriesChange((0,se.U7)(it,ae.Ex.newQuery()))},this.addActivationHandler(()=>this.onActivate())}static{this.Component=Me}getTabLabel(){return"Queries"}getItemsCount(){return this.getQueries().length}renderTab(rt){return(0,p.jsx)(tt,{model:this,...rt},this.getTabLabel())}onActivate(){this.loadDataSource()}async loadDataSource(){if(!this.state.panelRef.resolve().state.$data)return;let Pt=this.queryRunner.state.datasource;try{let It,Vt;if(Pt)It=await(0,q.l)().get(Pt),Vt=(0,q.l)().getInstanceSettings(Pt);else{const ln=(0,x.YQ)(this).state.uid??"",Qt=(0,m.CW)(ln);Qt?.datasourceUid!==null&&(Vt=(0,q.l)().getInstanceSettings({uid:Qt?.datasourceUid}),Vt&&(It=await(0,q.l)().get({uid:Qt?.datasourceUid,type:Vt.type}),this.queryRunner.setState({datasource:{...(0,Q.p$)(Vt),uid:Qt?.datasourceUid}})))}It&&Vt&&(this.setState({datasource:It,dsSettings:Vt}),(0,oe.tw)((0,Q.p$)(Vt)||{default:!0}))}catch(It){const Vt=await(0,q.l)().get(r.$.defaultDatasource),en=(0,q.l)().getInstanceSettings(r.$.defaultDatasource);Vt&&en&&(this.setState({datasource:Vt,dsSettings:en}),this.queryRunner.setState({datasource:(0,Q.p$)(en)})),console.error(It)}}buildQueryOptions(){const rt=this.state.panelRef.resolve(),it=(0,x.un)(rt),Pt=o.jh.getTimeRange(rt);let It={from:void 0,shift:void 0,hide:void 0};Pt instanceof Ce.v&&(It={from:Pt.state.timeFrom,shift:Pt.state.timeShift,hide:Pt.state.hideTimeOverride});let Vt=it.state.queries;const en=this.state.dsSettings;return{cacheTimeout:en?.meta.queryOptions?.cacheTimeout?it.state.cacheTimeout:void 0,queryCachingTTL:en?.cachingConfig?.enabled?it.state.queryCachingTTL:void 0,dataSource:{default:en?.isDefault,...en?(0,Q.p$)(en):{type:void 0,uid:void 0}},queries:Vt,maxDataPoints:it.state.maxDataPoints,minInterval:it.state.minInterval,timeRange:It}}getQueries(){return this.queryRunner.state.queries}newQuery(){const{dsSettings:rt,datasource:it}=this.state;let Pt;return rt?.meta.mixed?it?.meta.mixed?Pt=(0,q.l)().getInstanceSettings(r.$.defaultDatasource):Pt=it:Pt=rt,{...it?.getDefaultQuery?.(J.Jk.PanelEditor),datasource:{uid:Pt?.uid,type:Pt?.type}}}isExpressionsSupported(rt){return(rt.meta.backend||rt.meta.alerting||rt.meta.mixed)===!0}renderExtraActions(){return ie.m.getAllExtraRenderAction().map((rt,it)=>rt({onAddQuery:this.onAddQuery,onChangeDataSource:this.onChangeDataSource,key:it}
168)).filter(Boolean)}get queryRunner(){return(0,x.un)(this.state.panelRef.resolve())}}function Me({model:Je}){const{datasource:rt,dsSettings:it}=Je.useState(),{data:Pt,queries:It}=Je.queryRunner.useState(),{openDrawer:Vt,queryLibraryEnabled:en}=(0,De.Y)();if(!rt||!it||!Pt)return null;const ln=!(0,le.k)(it.name),Qt=async xn=>{const En=It.map(Gn=>Gn.datasource?Gn:{...Gn,datasource:rt.getRef()}),zn=(0,se.U7)(En,xn);if(Je.onQueriesChange(zn),xn.datasource?.uid){const Ht={uid:new Set(zn.map(un=>un.datasource?.uid).filter(un=>un!==Te.Uj)).size>1?me.uv:xn.datasource.uid};if(rt.uid!==Ht.uid){const un=(0,Ne.tR)().getInstanceSettings(Ht);un&&await Je.onChangeDataSource(un)}}};return(0,p.jsxs)("div",{"data-testid":y.Tp.components.QueryTab.content,children:[(0,p.jsx)(pe.K,{data:Pt,dsSettings:it,dataSource:rt,options:Je.buildQueryOptions(),onDataSourceChange:Je.onChangeDataSource,onOptionsChange:Je.onQueryOptionsChange,onOpenQueryInspector:Je.onOpenInspector}),(0,p.jsx)(fe.L,{data:Pt,queries:It,dsSettings:it,onAddQuery:Je.onAddQuery,onQueriesChange:Je.onQueriesChange,onRunQueries:Je.onRunQueries}),(0,p.jsxs)(X.B,{gap:2,children:[ln&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(U.$n,{icon:"plus",onClick:Je.addQueryClick,variant:"secondary","data-testid":y.Tp.components.QueryTab.addQuery,children:(0,p.jsx)(L.x6,{i18nKey:"dashboard-scene.panel-data-queries-tab-rendered.add-query",children:"Add query"})}),en&&(0,p.jsx)(U.$n,{icon:"plus",onClick:()=>Vt($e(rt,It),Qt),variant:"secondary","data-testid":y.Tp.components.QueryTab.addQueryFromLibrary,children:(0,p.jsx)(L.x6,{i18nKey:"dashboards.panel-queries.add-query-from-library",children:"Add query from library"})})]}),r.$.expressionsEnabled&&Je.isExpressionsSupported(it)&&(0,p.jsx)(U.$n,{icon:"plus",onClick:Je.onAddExpressionClick,variant:"secondary","data-testid":y.Tp.components.QueryTab.addExpression,children:(0,p.jsx)("span",{children:(0,p.jsx)(L.x6,{i18nKey:"dashboard-scene.panel-data-queries-tab-rendered.expression",children:"Expression\xA0"})})}),Je.renderExtraActions()]})]})}function $e(Je,rt){if(Je.uid==="-- Mixed --"){const it=(0,q.l)();return rt.map(Pt=>it.getInstanceSettings(Pt.datasource)?.name).filter(Pt=>Pt!==void 0)}else return[Je.name]}function tt(Je){const{model:rt}=Je,it=rt.queryRunner.useState();return(0,p.jsx)(T.o,{label:rt.getTabLabel(),icon:"database",counter:it.queries.length,active:Je.active,onChangeTab:Je.onChangeTab})}var Ke=e(57095),Re=e(96540),Ve=e(93256),Qe=e(71599),je=e(47350),ze=e(80849),Ye=e(8642),Ge=e(76319),ce=e(9284),Pe=e(34176);function Se(Je){const{isOpen:rt,series:it,onClose:Pt,onTransformationAdd:It}=Je,[Vt,en]=(0,Re.useState)({search:"",showIllustrations:!0}),ln=St=>en({...Vt,search:St.currentTarget.value}),Qt=St=>en({...Vt,showIllustrations:St}),xn=St=>en({...Vt,selectedFilter:St}),En=(0,Re.useMemo)(()=>Ye.h.list().sort((St,Ht)=>St.name>Ht.name?1:Ht.name>St.name?-1:0),[]),zn=En.filter(St=>Vt.selectedFilter&&Vt.selectedFilter!==Pe.e&&!St.categories?.has(Vt.selectedFilter)?!1:St.name.toLocaleLowerCase().includes(Vt.search.toLocaleLowerCase())||St.description?.toLocaleLowerCase().includes(Vt.search.toLocaleLowerCase())),Gn=(0,p.jsxs)(p.Fragment,{children:[zn.length," / ",En.length," \xA0\xA0",(0,p.jsx)(Ge.K,{name:"times",onClick:()=>{en({...Vt,search:""})},tooltip:(0,L.t)("dashboard-scene.transformations-drawer.search-box-suffix.tooltip-clear-search","Clear search")})]});if(rt)return(0,p.jsx)(ce.R,{data:it,onTransformationAdd:It,xforms:zn,search:Vt.search,noTransforms:!1,suffix:Vt.search!==""?Gn:(0,p.jsx)(p.Fragment,{}),selectedFilter:Vt.selectedFilter,onSearchChange:ln,onSearchKeyDown:()=>{},showIllustrations:Vt.showIllustrations,onShowIllustrationsChange:Qt,onSelectedFilterChange:xn,onClose:Pt})}class Ee extends o.Bs{constructor(){super(...arguments),this.tabId=_.Transformations}static{this.Component=xe}getTabLabel(){return"Transformations"}renderTab(rt){return(0,p.jsx)(we,{model:this,...rt},this.getTabLabel())}getQueryRunner(){return(0,x.un)(this.state.panelRef.resolve())}getDataTransformer(){const rt=this.state.panelRef.resolve().state.$data;if(!rt||!(rt instanceof o.Es))throw new Error("Could not find SceneDataTransformer for panel");return rt}onChangeTransformations(rt){const it=this.getDataTransformer();it.setState({transformations:rt}),it.reprocessTransformations()}}function xe({model:Je}){const rt=(0,P.of)(Oe),it=Je.getQueryRunner().useState(),{data:Pt,transformations:It}=Je.getDataTransformer().useState(),Vt=It,[en,ln]=(0,Re.useState)(!1),[Qt,xn]=(0,Re.useState)(!1),En=()=>ln(!0),zn=()=>ln(!1);if(!Pt||!it.data)return;const Gn=(0,p.jsx)(Se,{onClose:zn,onTransformationAdd:St=>{St.value!==void 0&&(Je.onChangeTransformations([...Vt,{id:St.value,options:{}}]),zn())},isOpen:en,series:Pt.series});return Vt.length<1?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ze.p,{onShowPicker:En}),Gn]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ye,{data:it.data,transformations:Vt,model:Je}),(0,p.jsxs)(Ve.e,{children:[(0,p.jsx)(U.$n,{icon:"plus",variant:"secondary",onClick:En,"data-testid":y.Tp.components.Transforms.addTransformationButton,children:(0,p.jsx)(L.x6,{i18nKey:"dashboard-scene.panel-data-transformations-tab-rendered.add-another-transformation",children:"Add another transformation"})}),(0,p.jsx)(U.$n,{"data-testid":y.Tp.components.Transforms.removeAllTransformationsButton,className:rt.removeAll,icon:"times",variant:"secondary",onClick:()=>xn(!0),children:(0,p.jsx)(L.x6,{i18nKey:"dashboard-scene.panel-data-transformations-tab-rendered.delete-all-transformations",children:"Delete all transformations"})})]}),(0,p.jsx)(Qe.u,{isOpen:Qt,title:(0,L.t)("dashboard-scene.panel-data-transformations-tab-rendered.title-delete-all-transformations","Delete all transformations?"),body:"By deleting all transformations, you will go back to the main selection screen.",confirmText:"Delete all",onConfirm:()=>{Je.onChangeTransformations([]),xn(!1)},onDismiss:()=>xn(!1)}),Gn]})}function ye({transformations:Je,model:rt,data:it}){const Pt=Je.map((Vt,en)=>({id:`${en} - ${Vt.id}`,transformation:Vt})),It=Vt=>{if(!Vt||!Vt.destination)return;const en=Vt.source.index,ln=Vt.destination.index;if(en===ln)return;const Qt=Array.from(Pt),[xn]=Qt.splice(en,1);
168Qt.splice(ln,0,xn),rt.onChangeTransformations(Qt.map(En=>En.transformation))};return(0,p.jsx)(Ke.DragDropContext,{onDragEnd:It,children:(0,p.jsx)(Ke.Droppable,{droppableId:"transformations-list",direction:"vertical",children:Vt=>(0,p.jsxs)("div",{ref:Vt.innerRef,...Vt.droppableProps,children:[(0,p.jsx)(je.A,{onChange:(en,ln)=>{const Qt=Je.slice();Qt[en]=ln,rt.onChangeTransformations(Qt)},onRemove:en=>{const ln=Je.slice();ln.splice(en,1),rt.onChangeTransformations(ln)},configs:Pt,data:it}),Vt.placeholder]})})})}const Oe=Je=>({removeAll:(0,c.css)({marginLeft:Je.spacing(2)})});function we(Je){const{model:rt}=Je,it=rt.getDataTransformer().useState();return(0,p.jsx)(T.o,{label:rt.getTabLabel(),icon:"process",counter:it.transformations.length,active:Je.active,onChangeTab:Je.onChangeTab})}class Be extends o.Bs{constructor(){super(...arguments),this._urlSync=new o.So(this,{keys:["tab"]}),this.onChangeTab=rt=>{this.setState({tab:rt.tabId})}}static{this.Component=Xe}static createFor(rt){const it=rt.getRef(),Pt=[new ke({panelRef:it}),new Ee({panelRef:it})];return st(rt.state.pluginId)&&Pt.push(new Z({panelRef:it})),new Be({panelRef:it,tabs:Pt,tab:_.Queries})}getUrlState(){return{tab:this.state.tab}}updateFromUrl(rt){rt.tab&&typeof rt.tab=="string"&&this.setState({tab:rt.tab})}}function Xe({model:Je}){const{tab:rt,tabs:it}=Je.useState(),Pt=(0,P.of)(lt);if(!it||!it.length)return;const It=it.find(Vt=>Vt.tabId===rt);return(0,p.jsxs)("div",{className:Pt.dataPane,"data-testid":y.Tp.components.PanelEditor.DataPane.content,children:[(0,p.jsx)(d.U,{className:Pt.tabsBar,children:it.map(Vt=>Vt.renderTab({active:Vt.tabId===rt,onChangeTab:()=>Je.onChangeTab(Vt)}))}),(0,p.jsx)(D.P,{backgroundColor:"primary",children:(0,p.jsx)(b.J,{className:Pt.tabContent,children:(0,p.jsx)(E.mc,{children:It&&(0,p.jsx)(It.Component,{model:It})})})})]})}function st(Je){const{unifiedAlertingEnabled:rt=!1}=(0,v.zj)(),it=C.TP.hasPermission((0,S.Wd)(O.hY).read);return rt&&it?Je==="graph"||Je==="timeseries":!1}function lt(Je){return{dataPane:(0,c.css)({display:"flex",flexDirection:"column",flexGrow:1,minHeight:0,height:"100%",width:"100%"}),tabContent:(0,c.css)({padding:Je.spacing(2),border:`1px solid ${Je.colors.border.weak}`,borderLeft:"none",borderBottom:"none",borderTopRightRadius:Je.shape.radius.default,flexGrow:1}),tabsBar:(0,c.css)({flexShrink:0,paddingLeft:Je.spacing(2)})}}var Et=e(7895),Tt=e(68079),Mt=e(35282),wt=e(8857),_e=e(12161),xt=e(17732),At=e(82754);function bt({model:Je}){const rt=(0,x.YQ)(Je),{optionsPane:it}=Je.useState(),Pt=(0,P.of)(vn),[It,Vt]=(0,Mt.dt)(),{containerProps:en,primaryProps:ln,secondaryProps:Qt,splitterProps:xn,splitterState:En,onToggleCollapse:zn}=(0,At.L)({direction:"row",dragPosition:"end",initialSize:330,usePixels:!0,collapsed:It,collapseBelowPixels:250});return(0,Re.useEffect)(()=>{Vt(En.collapsed)},[En.collapsed,Vt]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wt.c,{dashboard:rt}),(0,p.jsxs)("div",{...en,className:(0,c.cx)(en.className,Pt.content),"data-testid":y.Tp.components.PanelEditor.General.content,children:[(0,p.jsx)("div",{...ln,className:(0,c.cx)(ln.className,Pt.body),children:(0,p.jsx)(Xt,{model:Je})}),(0,p.jsx)("div",{...xn}),(0,p.jsxs)("div",{...Qt,className:(0,c.cx)(Qt.className,Pt.optionsPane),children:[En.collapsed&&(0,p.jsx)("div",{className:Pt.expandOptionsWrapper,children:(0,p.jsx)(Et.I,{tooltip:(0,L.t)("dashboard-scene.panel-editor-renderer.tooltip-open-options-pane","Open options pane"),icon:"arrow-to-right",onClick:zn,variant:"canvas",className:Pt.rotate180,"aria-label":(0,L.t)("dashboard-scene.panel-editor-renderer.aria-label-open-options-pane","Open options pane")})}),!En.collapsed&&it&&(0,p.jsx)(it.Component,{model:it}
168),!En.collapsed&&!it&&(0,p.jsx)(Tt.y,{})]})]})]})}function Xt({model:Je}){const rt=(0,x.YQ)(Je),{dataPane:it,showLibraryPanelSaveModal:Pt,showLibraryPanelUnlinkModal:It,tableView:Vt}=Je.useState(),en=Je.getPanel(),ln=(0,x.iL)(en),{controls:Qt}=rt.useState(),xn=(0,P.of)(vn),{containerProps:En,primaryProps:zn,secondaryProps:Gn,splitterProps:St,splitterState:Ht,onToggleCollapse:cn}=(0,At.L)({direction:"column",dragPosition:"start",initialSize:.5,collapseBelowPixels:150});return En.className=(0,c.cx)(En.className,xn.container),it||(zn.style.flexGrow=1),(0,p.jsxs)("div",{className:(0,c.cx)(xn.pageContainer,Qt&&xn.pageContainerWithControls),children:[Qt&&(0,p.jsx)("div",{className:xn.controlsWrapper,children:(0,p.jsx)(Qt.Component,{model:Qt})}),(0,p.jsxs)("div",{...En,children:[(0,p.jsx)("div",{...zn,children:(0,p.jsx)(Cn,{panel:en,tableView:Vt})}),Pt&&ln&&(0,p.jsx)(xt.Z,{libraryPanel:ln,onDismiss:Je.onDismissLibraryPanelSaveModal,onConfirm:Je.onConfirmSaveLibraryPanel,onDiscard:Je.onDiscard}),It&&ln&&(0,p.jsx)(_e.l,{onDismiss:Je.onDismissUnlinkLibraryPanelModal,onConfirm:Je.onConfirmUnlinkLibraryPanel,isOpen:!0}),it&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{...St}),(0,p.jsxs)("div",{...Gn,children:[Ht.collapsed&&(0,p.jsx)("div",{className:xn.expandDataPane,children:(0,p.jsx)(U.$n,{tooltip:(0,L.t)("dashboard-scene.viz-and-data-pane.tooltip-open-query-pane","Open query pane"),icon:"arrow-to-right",onClick:cn,variant:"secondary",size:"sm",className:xn.openDataPaneButton,"aria-label":(0,L.t)("dashboard-scene.viz-and-data-pane.aria-label-open-query-pane","Open query pane")})}),!Ht.collapsed&&(0,p.jsx)(it.Component,{model:it})]})]})]})]})}function Cn({panel:Je,tableView:rt}){const it=(0,P.of)(vn),Pt=rt??Je;return(0,p.jsx)("div",{className:it.vizWrapper,children:(0,p.jsx)(Pt.Component,{model:Pt})})}function vn(Je){return{pageContainer:(0,c.css)({display:"grid",gridTemplateAreas:` 169 "panels"`,gridTemplateColumns:"1fr",gridTemplateRows:"1fr",height:"100%"}),pageContainerWithControls:(0,c.css)({gridTemplateAreas:` 170 "controls" 171 "panels"`,gridTemplateRows:"auto 1fr"}),container:(0,c.css)({gridArea:"panels",height:"100%"}),canvasContent:(0,c.css)({label:"canvas-content",display:"flex",flexDirection:"column",flexBasis:"100%",flexGrow:1,minHeight:0,width:"100%"}),content:(0,c.css)({position:"absolute",width:"100%",height:"100%"}),body:(0,c.css)({label:"body",flexGrow:1,display:"flex",flexDirection:"column",minHeight:0}),optionsPane:(0,c.css)({flexDirection:"column",borderLeft:`1px solid ${Je.colors.border.weak}`,background:Je.colors.background.primary,marginTop:Je.spacing(2),borderTop:`1px solid ${Je.colors.border.weak}`,borderTopLeftRadius:Je.shape.radius.default}),expandOptionsWrapper:(0,c.css)({display:"flex",flexDirection:"column",padding:Je.spacing(2,1)}),expandDataPane:(0,c.css)({display:"flex",flexDirection:"row",padding:Je.spacing(1),borderTop:`1px solid ${Je.colors.border.weak}`,borderRight:`1px solid ${Je.colors.border.weak}`,background:Je.colors.background.primary,flexGrow:1,justifyContent:"space-around"}),rotate180:(0,c.css)({rotate:"180deg"}),controlsWrapper:(0,c.css)({display:"flex",flexDirection:"column",flexGrow:0,gridArea:"controls"}),openDataPaneButton:(0,c.css)({width:Je.spacing(8),justifyContent:"center",svg:{rotate:"-90deg"}}),vizWrapper:(0,c.css)({height:"100%",width:"100%",paddingLeft:Je.spacing(2)})}}var Wn=e(42941),Dt=e(69168),qt=e(27489),Yt=e(37386),nn=e(12737),Zt=e(41097),tn=e(52193),ft=e(25531),Rt=e(56424),Bt=e(7094);const jt=Re.memo(({panel:Je,searchQuery:rt,listMode:it,data:Pt})=>{const{options:It,fieldConfig:Vt,_pluginInstanceState:en}=Je.useState(),ln=(0,Re.useMemo)(()=>(0,He.yH)(Je),[Je]),Qt=(0,Re.useMemo)(()=>{const St=Je.getPlugin();if(St)return(0,Rt.Z4)({panel:Je,data:Pt,plugin:St,eventBus:Je.getPanelContext().eventBus,instanceState:en})},[Pt,Je,It,Vt,en]),xn=(0,Re.useMemo)(()=>{if(Je instanceof o.Eb&&(0,x.ME)(Je)){const St=(0,x.iL)(Je);return St instanceof Bt.u?(0,Rt.tN)(St):void 0}},[Je]),En=(0,Re.useMemo)(()=>(0,ft.v)(Vt,Je.getPlugin()?.fieldConfigRegistry,Pt?.series??[],rt,St=>{Je.onFieldConfigChange(St,!0)}),[Pt,rt,Je,Vt]),zn=rt.length>0,Gn=[];if(zn)Gn.push((0,s.Po)([ln,...xn?[xn]:[],...Qt??[]],En,rt));
171else switch(it){case s.gs.All:xn&&Gn.push(xn.render()),Gn.push(ln.render());for(const St of Qt??[])Gn.push(St.render());for(const St of En)Gn.push(St.render());break;case s.gs.Overrides:for(const St of En)Gn.push(St.render());default:break}return Gn});jt.displayName="PanelOptions";var Nt=e(78685),$t=e(77824),an=e(95943),Jt=e(62667),gn=e(82472),mn=e(72165),_t=e(33380);const On="dashboards_panel_plugin_picker_clicked",Nn={TOGGLE_DROPDOWN:"toggle_panel_plugin_picker",SELECT_PANEL_PLUGIN:"select_panel_plugin",CHANGE_TAB:"change_tab",SEARCH:"search"};function Fn({panel:Je,data:rt,onChange:it,onClose:Pt}){const It=(0,P.of)(na),[Vt,en]=(0,Re.useState)(""),ln=(0,Re.useMemo)(()=>(0,t.debounce)((bn,Sn)=>{bn&&(0,qt.rR)(On,{item:Nn.SEARCH,query:bn,result_count:Sn,creator_team:"grafana_plugins_catalog",schema_version:"1.0.0"})},300),[]),Qt=bn=>{en(bn)},xn=an.wV,En=Jt.__.Visualizations,zn=(0,Re.useMemo)(()=>new _t.R(Je),[Je]),Gn=(0,Re.useMemo)(()=>new Set([Jt.__.Visualizations,Jt.__.Suggestions]),[]),[St,Ht]=(0,Nt.A)(xn,En),cn=bn=>{(0,qt.rR)(On,{item:Nn.CHANGE_TAB,tab:Jt.__[bn],creator_team:"grafana_plugins_catalog",schema_version:"1.0.0"}),Ht(bn)};(0,Re.useEffect)(()=>{St&&!Gn.has(St)&&Ht(En)},[En,St,Ht,Gn]);const un=[{label:"Visualizations",value:Jt.__.Visualizations},{label:"Suggestions",value:Jt.__.Suggestions}];return(0,p.jsxs)("div",{className:It.wrapper,children:[(0,p.jsxs)("div",{className:It.searchRow,children:[(0,p.jsx)(nn.Z,{className:It.filter,value:Vt,onChange:Qt,autoFocus:!0,placeholder:(0,L.t)("dashboard-scene.panel-viz-type-picker.placeholder-search-for","Search for...")}),(0,p.jsx)(U.$n,{title:(0,L.t)("dashboard-scene.panel-viz-type-picker.title-close","Close"),variant:"secondary",icon:"angle-up",className:It.closeButton,"data-testid":y.Tp.components.PanelEditor.toggleVizPicker,onClick:Pt})]}),(0,p.jsx)(Yt.D,{className:It.customFieldMargin,children:(0,p.jsx)($t.z,{options:un,value:St,onChange:cn,fullWidth:!0})}),(0,p.jsxs)(D.P,{children:[St===Jt.__.Visualizations&&(0,p.jsx)(mn.G,{pluginId:Je.state.pluginId,searchQuery:Vt,trackSearch:ln,onChange:it}),St===Jt.__.Suggestions&&(0,p.jsx)(gn.a,{onChange:it,trackSearch:ln,searchQuery:Vt,panel:zn,data:rt})]})]})}const na=Je=>({wrapper:(0,c.css)({display:"flex",flexDirection:"column",flexGrow:1,padding:Je.spacing(2,1),height:"100%",gap:Je.spacing(2),border:`1px solid ${Je.colors.border.weak}`,borderRight:"none",borderBottom:"none",borderTopLeftRadius:Je.shape.radius.default}),searchRow:(0,c.css)({display:"flex",marginBottom:Je.spacing(1)}),closeButton:(0,c.css)({marginLeft:Je.spacing(1)}),customFieldMargin:(0,c.css)({marginBottom:Je.spacing(1)}),filter:(0,c.css)({minHeight:Je.spacing(4)})});class aa extends o.Bs{constructor(){super(...arguments),this._cachedPluginOptions={},this.onToggleVizPicker=()=>{(0,qt.rR)(On,{item:Nn.TOGGLE_DROPDOWN,open:!this.state.isVizPickerOpen}),this.setState({isVizPickerOpen:!this.state.isVizPickerOpen})},this.onChangePanelPlugin=rt=>{const it=this.state.panelRef.resolve(),{options:Pt,fieldConfig:It,pluginId:Vt}=it.state,en=rt.pluginId;(0,qt.rR)(On,{item:Nn.SELECT_PANEL_PLUGIN,plugin_id:en});let ln={defaults:{...It.defaults,custom:{}},overrides:(0,Dt.aW)(It.overrides,Dt.nx)};this._cachedPluginOptions[Vt]={options:Pt,fieldConfig:It};const Qt=this._cachedPluginOptions[en]?.options,xn=this._cachedPluginOptions[en]?.fieldConfig;xn&&(ln=(0,Dt.H9)(ln,xn)),it.changePluginType(en,Qt,ln),rt.options&&it.onOptionsChange(rt.options,!0),rt.fieldConfig&&it.onFieldConfigChange(rt.fieldConfig,!0),this.onToggleVizPicker()},this.onSetSearchQuery=rt=>{this.setState({searchQuery:rt})},this.onSetListMode=rt=>{this.setState({listMode:rt})},this.onOpenPanelJSON=rt=>{n.Ny.partial({inspect:rt.state.key,inspectTab:"json"})}}getOptionRadioFilters(){return[{label:s.gs.All,value:s.gs.All},{label:s.gs.Overrides,value:s.gs.Overrides}]}static{this.Component=({model:rt})=>{const{isVizPickerOpen:it,searchQuery:Pt,listMode:It,panelRef:Vt}=rt.useState(),en=Vt.resolve(),{pluginId:ln}=en.useState(),{data:Qt}=o.jh.getData(en).useState(),xn=(0,P.of)(yt),zn=!(Pt.length>0)&&!en.getPlugin()?.fieldConfigRegistry.isEmpty(),[Gn,St]=(0,Wn.A)(!1),Ht=It===s.gs.Overrides;return(0,p.jsxs)(p.Fragment,{children:[!it&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:xn.top,children:[(0,p.jsx)(Yt.D,{label:(0,L.t)("dashboard.panel-edit.visualization-button-label","Visualization"),className:xn.vizField,children:(0,p.jsxs)(X.B,{gap:1,children:[(0,p.jsx)(mt,{pluginId:ln,onOpen:rt.onToggleVizPicker}),(0,p.jsx)(U.$n,{icon:"search",variant:"secondary",onClick:St,tooltip:(0,L.t)("dashboard.panel-edit.visualization-button-tooltip","Search options")}),zn&&(0,p.jsx)(Et.I,{icon:"filter",tooltip:(0,L.t)("dashboard.panel-edit.only-overrides-button-tooltip","Show only overrides"),variant:Ht?"active":"canvas",onClick:()=>{rt.onSetListMode(Ht?s.gs.All:s.gs.Overrides)}})]})}),Gn&&(0,p.jsx)(nn.Z,{className:xn.searchOptions,value:Pt,placeholder:(0,L.t)("dashboard.panel-edit.placeholder-search-options","Search options"),onChange:rt.onSetSearchQuery,autoFocus:!0,onBlur:()=>
171{Pt.length===0&&St(!1)}})]}),(0,p.jsx)(D.P,{children:(0,p.jsx)(jt,{panel:en,searchQuery:Pt,listMode:It,data:Qt})})]}),it&&(0,p.jsx)(Fn,{panel:en,onChange:rt.onChangePanelPlugin,onClose:rt.onToggleVizPicker,data:Qt})]})}}}function yt(Je){return{top:(0,c.css)({display:"flex",flexDirection:"column",padding:Je.spacing(1,2,2,2),gap:Je.spacing(2)}),searchOptions:(0,c.css)({minHeight:Je.spacing(4)}),searchWrapper:(0,c.css)({padding:Je.spacing(2,2,2,0)}),vizField:(0,c.css)({marginBottom:Je.spacing(0)}),rotateIcon:(0,c.css)({rotate:"180deg"})}}function mt({pluginId:Je,onOpen:rt}){const it=(0,P.of)(Ot);let Pt=(0,Re.useMemo)(()=>(0,tn.A4)().filter(It=>It.id===Je)[0],[Je]);return Pt||(Pt=(0,Zt.$)(`Panel plugin not found (${Je})`,!0).meta),(0,p.jsx)(Et.I,{className:it.vizButton,tooltip:(0,L.t)("dashboard-scene.visualization-button.tooltip-click-to-change-visualization","Click to change visualization"),imgSrc:Pt.info.logos.small,onClick:rt,"data-testid":y.Tp.components.PanelEditor.toggleVizPicker,"aria-label":(0,L.t)("dashboard-scene.visualization-button.aria-label-change-visualization","Change visualization"),variant:"canvas",isOpen:!1,fullWidth:!0,children:Pt.name})}function Ot(Je){return{vizButton:(0,c.css)({textAlign:"left"})}}class Wt extends o.Bs{constructor(rt){super(rt),this._changesHaveBeenMade=!1,this.debounceSaveModelDiff=!0,this.onDiscard=()=>{this.setState({isDirty:!1});const It=this.state.panelRef.resolve();this.state.isNewPanel?(0,x.YQ)(this).removePanel(It):this._layoutItem.setState(this._layoutItemState),n.Ny.partial({editPanel:null})},this.onSaveLibraryPanel=()=>{this.setState({showLibraryPanelSaveModal:!0})},this.onConfirmSaveLibraryPanel=()=>{(0,a.DW)(this.state.panelRef.resolve()),this.setState({isDirty:!1}),n.Ny.partial({editPanel:null})},this.onDismissLibraryPanelSaveModal=()=>{this.setState({showLibraryPanelSaveModal:!1})},this.onUnlinkLibraryPanel=()=>{this.setState({showLibraryPanelUnlinkModal:!0})},this.onDismissUnlinkLibraryPanelModal=()=>{this.setState({showLibraryPanelUnlinkModal:!1})},this.onConfirmUnlinkLibraryPanel=()=>{const It=(0,x.iL)(this.getPanel());It&&(It.unlink(),this.setState({showLibraryPanelUnlinkModal:!1}))},this.onToggleTableView=()=>{if(this.state.tableView){this.setState({tableView:void 0});return}const Vt=this.state.panelRef.resolve().state.$data;Vt&&this.setState({tableView:o.d0.table().setTitle("").setOption("showTypeIcons",!0).setOption("showHeader",!0).setData(new g({source:Vt.getRef()})).build()})};const Pt=this.state.panelRef.resolve().parent;if(!Pt||!(0,u.y)(Pt))throw new Error("Panel must have a parent of type DashboardLayoutItem");this._layoutItem=Pt,this.setOriginalState(this.state.panelRef),this.addActivationHandler(this._activationHandler.bind(this))}static{this.Component=bt}_activationHandler(){const rt=this.state.panelRef.resolve();rt.state.pluginId===h.r&&rt.changePluginType("timeseries");const it=(0,x.sf)(rt);return this.waitForPlugin(),()=>{this._layoutItem.editingCompleted?.(this.state.isDirty||this._changesHaveBeenMade),it&&it()}}waitForPlugin(rt=0){const it=this.getPanel(),Pt=it.getPlugin();if(!Pt||Pt.meta.id!==it.state.pluginId){rt<100?setTimeout(()=>this.waitForPlugin(rt+1),rt*10):this.setState({pluginLoadErrror:"Failed to load panel plugin"});return}this.gotPanelPlugin(Pt)}setOriginalState(rt){const it=rt.resolve();this._originalSaveModel=(0,i.Z6)(it),this._layoutItemState=o.Go.cloneSceneObjectState(this._layoutItem.state)}_setupChangeDetection(){const rt=this.state.panelRef.resolve(),it=()=>{const{hasChanges:Vt}=(0,f.yO)(this._originalSaveModel,(0,i.Z6)(rt));this.setState({isDirty:Vt})},Pt=this.debounceSaveModelDiff?(0,t.debounce)(it,250):it,It=Vt=>{l.l.isUpdatingPersistedState(Vt)&&Pt()};this._subs.add(this._layoutItem.subscribeToEvent(o.bZ,It))}getPanel(){return this.state.panelRef?.resolve()}gotPanelPlugin(rt){const it=this.getPanel();this.state.isInitializing?(this.setOriginalState(this.state.panelRef),this._layoutItem.editingStarted?.(),this._setupChangeDetection(),this._updateDataPane(rt),this._subs.add(it.subscribeToState((Pt,It)=>{Pt.pluginId!==It.pluginId&&this.waitForPlugin()})),this.setState({optionsPane:new aa({panelRef:this.state.panelRef,searchQuery:"",listMode:s.gs.All}),isInitializing:!1})):this._updateDataPane(rt)}_updateDataPane(rt){const it=rt.meta.skipDataQuery,Pt=this.state.panelRef.resolve();if(it&&(this.state.dataPane&&(n.Ny.partial({tab:null},!0),this.setState({dataPane:void 0})),Pt.state.$data&&Pt.setState({$data:void 0})),!it&&(this.state.dataPane||this.setState({dataPane:Be.createFor(this.getPanel())}),!Pt.state.$data)){let It=(0,m.CW)((0,x.YQ)(this).state.uid)?.datasourceUid;It||(It=r.$.defaultDatasource),Pt.setState({$data:new o.Es({$data:new o.dt({datasource:{uid:It},queries:[{refId:"A"}]}),transformations:[]})})}}getUrlKey(){return this.getPanelId().toString()}getPanelId(){return(0,x.Cs)(this.state.panelRef.resolve())}getPageNav(rt,it){return{text:"Edit panel",parentItem:(0,x.YQ)(this).getPageNav(rt,it)}}dashboardSaved(){this.setOriginalState(this.state.panelRef),this.setState({isDirty:!1}),this._changesHaveBeenMade=!0}}function et(Je,rt=!1){return new Wt({isInitializing:!0,panelRef:Je.getRef(),isNewPanel:rt})}},17732:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>x});var t=e(74848),n=e(96540),r=e(16817),o=e(40996),s=e(63142),m=e(22787),a=e(63527),l=e(30703),f=e(45861),h=e(56840),u=e(30124),i=e(37666);const x=({libraryPanel:g,isUnsavedPrompt:p,onDismiss:c,onConfirm:y,onDiscard:P})=>
171{const[d,D]=(0,n.useState)(""),b=(0,r.A)(async()=>{const I=await(0,u.xV)(g.state.uid);return I.length>0?I.map(R=>R.title):[]},[g.state.uid]),[E,v]=(0,n.useState)([]);(0,o.A)(()=>b.value?v(b.value.filter(I=>I.toLowerCase().includes(d.toLowerCase()))):v([]),300,[b.value,d]);const C=(0,s.of)(i.o),S=(0,n.useCallback)(()=>{P()},[P]),O=p?"Unsaved library panel changes":"Save library panel";return(0,t.jsx)(m.a,{title:O,icon:"save",onDismiss:c,isOpen:!0,children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:C.textInfo,children:["This update will affect ",(0,t.jsxs)("strong",{children:[g.state._loadedPanel?.meta?.connectedDashboards," ",g.state._loadedPanel?.meta?.connectedDashboards===1?"dashboard":"dashboards","."]}),"The following dashboards using the panel will be affected:"]}),(0,t.jsx)(a.p,{className:C.dashboardSearch,prefix:(0,t.jsx)(l.I,{name:"search"}),placeholder:(0,h.t)("dashboard-scene.save-library-viz-panel-modal.placeholder-search-affected-dashboards","Search affected dashboards"),value:d,onChange:I=>D(I.currentTarget.value)}),b.loading?(0,t.jsx)("p",{children:(0,t.jsx)(h.x6,{i18nKey:"dashboard-scene.save-library-viz-panel-modal.loading-connected-dashboards",children:"Loading connected dashboards..."})}):(0,t.jsxs)("table",{className:C.myTable,children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:(0,t.jsx)("th",{children:(0,t.jsx)(h.x6,{i18nKey:"dashboard-scene.save-library-viz-panel-modal.dashboard-name",children:"Dashboard name"})})})}),(0,t.jsx)("tbody",{children:E.map((I,R)=>(0,t.jsx)("tr",{children:(0,t.jsx)("td",{children:I})},`dashrow-${R}`))})]}),(0,t.jsxs)(m.a.ButtonRow,{children:[(0,t.jsx)(f.$n,{variant:"secondary",onClick:c,fill:"outline",children:(0,t.jsx)(h.x6,{i18nKey:"dashboard-scene.save-library-viz-panel-modal.cancel",children:"Cancel"})}),p&&(0,t.jsx)(f.$n,{variant:"destructive",onClick:S,children:(0,t.jsx)(h.x6,{i18nKey:"dashboard-scene.save-library-viz-panel-modal.discard",children:"Discard"})}),(0,t.jsx)(f.$n,{onClick:()=>{y()},children:(0,t.jsx)(h.x6,{i18nKey:"dashboard-scene.save-library-viz-panel-modal.update-all",children:"Update all"})})]})]})})}},22175:(ee,B,e)=>{"use strict";e.d(B,{$7:()=>O,R4:()=>C,TU:()=>S,dF:()=>v,m:()=>E,yH:()=>D});var t=e(74848),n=e(1906),r=e(85629),o=e(43173),s=e(96822),m=e(63527),a=e(87105),l=e(21285),f=e(22055),h=e(76623),u=e(25797),i=e(51156),x=e(82345),g=e(81657),p=e(20246),c=e(3688),y=e(70030),P=e(1682),d=e(8285);function D(I){const R=new u.C({title:"Panel options",id:"Panel options",isOpenDefault:!0}),T=P.b4.getPanelLinks(I),L=T?.state.rawLinks??[],K=(0,d.YQ)(I),A=I.parent;return R.addItem(new i.v({title:"Title",value:I.state.title,popularRank:1,render:function(){return(0,t.jsx)(E,{panel:I})},addon:o.$.featureToggles.dashgpt&&(0,t.jsx)(h.h,{onGenerate:W=>S(I,W),panel:(0,y.Z6)(I),dashboard:(0,y.Uy)(K)})})).addItem(new i.v({title:"Description",value:I.state.description,render:function(){return(0,t.jsx)(v,{panel:I})},addon:o.$.featureToggles.dashgpt&&(0,t.jsx)(f.t,{onGenerate:W=>I.setState({description:W}),panel:(0,y.Z6)(I)})})).addItem(new i.v({title:"Transparent background",render:function(){return(0,t.jsx)(C,{panel:I})}})).addCategory(new u.C({title:"Panel links",id:"Panel links",isOpenDefault:!1,itemsCount:L?.length}).addItem(new i.v({title:"Panel links",render:()=>(0,t.jsx)(b,{panelLinks:T??void 0})}))),(0,c.y)(A)&&A.getOptions?.().forEach(W=>R.addCategory(W)),R}function b({panelLinks:I}){const{rawLinks:R}=I?I.useState():{rawLinks:[]};return(0,t.jsx)(s.e,{links:R,onChange:T=>I?.setState({rawLinks:T}),getSuggestions:x.Fq,data:[]})}function E({panel:I,isNewElement:R}){const{title:T}
171=I.useState(),L=I.getPanelContext().app!==n.Jk.PanelEditor;let K=(0,p.z4)({autoFocus:L&&R});return(0,t.jsx)(m.p,{ref:K,"data-testid":r.Tp.components.PanelEditor.OptionsPane.fieldInput("Title"),value:T,onChange:A=>S(I,A.currentTarget.value)})}function v({panel:I}){const{description:R}=I.useState();return(0,t.jsx)(a.f,{id:"description-text-area",value:R,onChange:T=>I.setState({description:T.currentTarget.value})})}function C({panel:I}){const{displayMode:R}=I.useState();return(0,t.jsx)(l.d,{value:R==="transparent",id:"transparent-background",onChange:()=>{I.setState({displayMode:I.state.displayMode==="transparent"?"default":"transparent"})}})}function S(I,R){I.setState({title:R,hoverHeader:O(R,I.state.$timeRange)})}function O(I,R){return!(I!==""||R instanceof g.v&&!R.state.hideTimeOverride&&(R.state.timeFrom||R.state.timeShift))}},82754:(ee,B,e)=>{"use strict";e.d(B,{L:()=>r});var t=e(96540),n=e(93008);function r({direction:o,initialSize:s,dragPosition:m,collapseBelowPixels:a,collapsed:l,handleSize:f,usePixels:h}){const[u,i]=(0,t.useState)({collapsed:l??!1,snapSize:l?0:void 0}),x=(0,t.useCallback)((D,b,E)=>{D<=0&&b<=0&&E<=0||(u.collapsed&&E>a&&i({collapsed:!1}),!u.collapsed&&E<a&&i({collapsed:!0}))},[u,a]),g=(0,t.useCallback)((D,b,E)=>{if(D<=0&&b<=0&&E<=0)return;const v=u.snapSize===0;if(u.collapsed&&!v)i({snapSize:0,collapsed:u.collapsed});else if(u.collapsed&&v)if(h){const C=Math.max(E,s??200);i({snapSize:C,collapsed:!u.collapsed})}else{const C=Math.max(1-(s??.5),1-D);i({snapSize:C,collapsed:!u.collapsed})}},[u,s,h]),p=(0,t.useCallback)(()=>{i({collapsed:!u.collapsed})},[u.collapsed]),{containerProps:c,primaryProps:y,secondaryProps:P,splitterProps:d}=(0,n.h)({direction:o,dragPosition:m,handleSize:f,initialSize:s,usePixels:h,onResizing:x,onSizeChanged:g});return P.style.overflow="hidden",P.style.minWidth="unset",P.style.minHeight="unset",u.snapSize?h?P.style.flexBasis=`${u.snapSize}px`:(y.style={...y.style,flexGrow:1-u.snapSize},P.style.flexGrow=u.snapSize):u.snapSize===0&&(P.style.minWidth="min-content",P.style.minHeight="min-content",P.style.overflow="unset",h?P.style.flexBasis="0px":(y.style.flexGrow=1,P.style.flexGrow=0)),{containerProps:c,primaryProps:y,secondaryProps:P,splitterProps:d,splitterState:u,onToggleCollapse:p}}},3204:(ee,B,e)=>{"use strict";e.d(B,{l:()=>v});var t=e(2543),n=e(56838),r=e(81041);const o=()=>new r.c(new URL(e.p+e.u(7061),e.b));var s=e(73816),m=e(55793),a=e(91135),l=e(75904),f=e(49e3),h=e(34960),u=e(39385),i=e(7094),x=e(32540),g=e(81657),p=e(25953),c=e(8835),y=e(93389),P=e(97335),d=e(80038),D=e(92769),b=e(37365),E=e(44741);class v{constructor(O){this._dashboard=O}static isUpdatingPersistedState({payload:O}){return Object.keys(O.partialUpdate).length===0?!1:!!(O.changedObject instanceof n.Eb||O.changedObject instanceof y.U||O.changedObject instanceof g.v||O.changedObject instanceof n.dt&&!Object.prototype.hasOwnProperty.call(O.partialUpdate,"data")||O.changedObject instanceof n.Es&&!Object.prototype.hasOwnProperty.call(O.partialUpdate,"data")||O.changedObject instanceof x.$||O.changedObject instanceof n.WM&&(Object.prototype.hasOwnProperty.call(O.partialUpdate,"intervals")||Object.prototype.hasOwnProperty.call(O.partialUpdate,"refresh"))||O.changedObject instanceof i.u&&Object.prototype.hasOwnProperty.call(O.partialUpdate,"name")||O.changedObject instanceof n.Gg.K2||O.changedObject instanceof n.kh||O.changedObject instanceof y.U||O.changedObject instanceof n.hy||O.changedObject instanceof u.H$&&Object.keys(O.partialUpdate).some(I=>u.vk.includes(I))||O.changedObject instanceof n.JZ||O.changedObject instanceof h.x&&Object.prototype.hasOwnProperty.call(O.partialUpdate,"hideTimeControls")||O.changedObject instanceof n.Pj||O.changedObject instanceof f.g&&!Object.prototype.hasOwnProperty.call(O.partialUpdate,"data")||O.changedObject instanceof n.Gg.en||(0,E.c7)(O.changedObject)||O.changedObject instanceof d.V||O.changedObject instanceof P.o||O.changedObject instanceof b.K||O.changedObject instanceof D.V||O.changedObject instanceof c.X2||O.changedObject instanceof p.X||O.changedObject instanceof l.H||O.changedObject instanceof a.K||O.changedObject instanceof m.M||O.changedObject instanceof s.t)}detectSaveModelChanges(){const O=this._dashboard.getSaveModel(),I=this._dashboard.getInitialSaveModel(),R=typeof O=="object"?JSON.parse(JSON.stringify(O)):O,T=typeof I=="object"?JSON.parse(JSON.stringify(I)):I;this._changesWorker?.postMessage({initial:T,changed:R})}hasMetadataChanges(){return this._dashboard.state.meta.folderUid!==this._dashboard.getInitialState()?.meta.folderUid}updateIsDirty(O){O||this.hasMetadataChanges()?this._dashboard.state.isDirty||this._dashboard.setState({isDirty:!0}):this._dashboard.state.isDirty&&this._dashboard.setState({isDirty:!1})}init(){this._changesWorker=o()}startTrackingChanges(){this._changesWorker||this.init(),this._changesWorker.onmessage=I=>{this.updateIsDirty(!!I.data.hasChanges)};const O=C(this.detectSaveModelChanges.bind(this));this._changeTrackerSub=this._dashboard.subscribeToEvent(n.bZ,I=>{v.isUpdatingPersistedState(I)&&O()})}stopTrackingChanges(){this._changeTrackerSub?.unsubscribe()}terminate(){this.stopTrackingChanges(),this._changesWorker?.terminate(),this._changesWorker=void 0}}function C(S){return(0,t.debounce)(S,250)}},17862:(ee,B,e)=>{"use strict";e.d(B,{AM:()=>a,Cj:()=>f,yO:()=>g});var t=e(50803),n=e(60171),r=e(61371);function o(p,c){try{let y=p;for(const P of c)y=y[P];return y}catch{return}}function s(p,c){return typeof p==typeof c&&(typeof p=="string"&&p===c||Array.isArray(p)&&p.length===c.length&&p.every((y,P)=>y===c[P]))}function m(p,c){return p===c||p&&c&&p.selected===c.selected&&s(p.text,c.text)&&s(p.value,c.value)}function a(p,c,y,P,d){const D=l(p),b=c,E=h(b.timeSettings,D.timeSettings),v=i(b,D,P),C=b.timeSettings.autoRefresh!==D.timeSettings.autoRefresh;y||(b.timeSettings.from=D.timeSettings.from,b.timeSettings.to=D.timeSettings.to),d||(b.timeSettings.autoRefresh=D.timeSettings.autoRefresh);const S=(0,r.G4)(p,b),O=Object.values(S).reduce((I,R)=>I+R.length,0);return{changedSaveModel:b,initialSaveModel:D,diffs:S,diffCount:O,hasChanges:O>0,hasTimeChanges:E,hasVariableValueChanges:v,hasRefreshChange:C,hasMigratedToV2:!(0,n.aK)(p)}}function l(p){if((0,n.aK)(p))return p;const c={dashboard:p,meta:{}};return t.Op.ensureV2Response(c).spec}function f(p,c,y,P,d){const D=p,b=c,E=h(b.time,D.time),v=x(b,D,P),C=b.refresh!==D.refresh;y||(b.time=D.time),d||(b.refresh=D.refresh);const S=(0,r.G4)(D,b),O=Object.values(S).reduce((I,R)=>I+R.length,0);return{changedSaveModel:b,initialSaveModel:D,diffs:S,diffCount:O,hasChanges:O>0,hasTimeChanges:E,isNew:b.version===0,hasVariableValueChanges:v,hasRefreshChange:C}}function h(p={},c={}){return p.from!==c.from||p.to!==c.to}function u(p,c){if(p===void 0&&c===void 0)return console.warn("Adhoc variable filter property is undefined"),!0;if(p===void 0&&c!==void 0||c===void 0&&p!==void 0)return console.warn("Adhoc variable filter property is undefined"),!1;if(p?.length!==c?.length)return!1;for(let y=0;y<(p?.length??0);y++){const P=p?.[y],d=c?.[y];if(P?.key!==d?.key||P?.operator!==d?.operator||P?.value!==d?.value)return!1}return!0}function i(p,c,y){const P=c.variables??[],d=p.variables??[];let D=!1;for(const b of d){const E=S=>S.kind==="QueryVariable"||S.kind==="CustomVariable"||S.kind==="DatasourceVariable"||S.kind==="ConstantVariable"||S.kind==="IntervalVariable"||S.kind==="TextVariable"||S.kind==="GroupByVariable",v=S=>S.kind==="QueryVariable"||S.kind==="CustomVariable"||S.kind==="DatasourceVariable"||S.kind==="IntervalVariable"||S.kind==="GroupByVariable",C=P.find(({spec:S,kind:O})=>S.name===b.spec.name&&O===b.kind);
171C&&((E(b)&&E(C)&&!m(b.spec.current,C.spec.current)||b.kind==="AdhocVariable"&&C.kind==="AdhocVariable"&&!u(b.spec.filters,C.spec.filters))&&(D=!0),y||(b.kind==="AdhocVariable"?b.spec.filters=C.spec.filters:(E(b)&&E(C)&&(b.spec.current=C.spec.current),v(b)&&v(C)&&(b.spec.options=C.spec.options))))}return D}function x(p,c,y){const P=c.templating?.list??[],d=p.templating?.list??[];let D=!1;for(const b of d){const E=P.find(({name:v,type:C})=>v===b.name&&C===b.type);if(E&&(E.current&&delete E.current.selected,m(b.current,E.current)?b.type==="adhoc"&&!u(b?.filters,E?.filters)&&(D=!0):D=!0,!y)){const v=b;v.type==="adhoc"?v.filters=E.filters:(b.current=E.current,b.options=E.options)}}return D}function g(p,c){const y=(0,r.G4)(c,p),P=Object.values(y).reduce((d,D)=>d+D.length,0);return{changedSaveModel:p,initialSaveModel:c,diffs:y,diffCount:P,hasChanges:P>0}}},27154:(ee,B,e)=>{"use strict";e.d(B,{f:()=>m});var t=e(74848),n=e(22787),r=e(45861),o=e(56840),s=e(39385);function m({onDismiss:l,resource:f}){return(0,t.jsxs)(n.a,{isOpen:!0,title:(0,o.t)("dashboard-scene.provisioned-resource-delete-modal.title-cannot-delete-provisioned-resource","Cannot delete provisioned resource"),onDismiss:l,children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:(0,t.jsx)(o.x6,{i18nKey:"dashboard-scene.provisioned-resource-delete-modal.managed-by-version-control",children:"This resource is managed by version control and cannot be deleted. To remove it, delete it from the repository and synchronise to apply the changes."})}),a(f)&&(0,t.jsxs)("p",{children:[(0,t.jsx)(o.x6,{i18nKey:"dashboard-scene.provisioned-resource-delete-modal.file-path",children:"File path:"})," ",f.getPath()]})]}),(0,t.jsx)(n.a.ButtonRow,{children:(0,t.jsx)(r.$n,{variant:"primary",onClick:l,children:(0,t.jsx)(o.x6,{i18nKey:"dashboard-scene.provisioned-resource-delete-modal.ok",children:"OK"})})})]})}function a(l){return l instanceof s.H$}},99454:(ee,B,e)=>{"use strict";e.d(B,{a:()=>n,r:()=>t});function t(r,o){return o&&o!==r?.branch?"write":r?.workflows?.[0]}function n(r,o){return r?r.type==="local"?[{label:"Save",value:"write"}]:(!o&&r.branch&&(o=r.branch),r.workflows.map(s=>{switch(s){case"write":return{label:o?`Push to ${o}`:"Save",value:s};case"branch":return{label:"Push to a new branch",value:s}}return{label:s,value:s}})):[]}},7498:(ee,B,e)=>{"use strict";e.d(B,{C:()=>E,S:()=>v});var t=e(65474),n=e(81160),r=e(739),o=e(76190),s=e(41119),m=e(28105),a=e(43173),l=e(56838),f=e(6890),h=e(64762),u=e(73427),i=e(47797),x=e(70327),g=e(78467),p=e(95443),c=e(52161),y=e(29609),P=e(8535),d=e(96673),D=e(24619),b=e(8285);class E extends l.VE{constructor(S){super({isEnabled:!0,...S,isHidden:!0}),this.hasAlertRules=!0,this.topic=r.QR.AlertStates,this.handleError=O=>{const I=(0,h.gi)("AlertStatesDataLayer",(0,i.q6)(O));(0,P.JD)((0,f.dx)(I))}}onEnable(){const S=l.jh.getTimeRange(this);this._timeRangeSub=S.subscribeToState(()=>{this.runWithTimeRange(S)})}onDisable(){this._timeRangeSub?.unsubscribe()}runLayer(){const S=l.jh.getTimeRange(this);this.runWithTimeRange(S)}async runWithTimeRange(S){const O=(0,b.YQ)(this),{uid:I,id:R}=O.state;if(this.querySub&&this.querySub.unsubscribe(),!this.canWork(S))return;const T=async()=>{const A=await(0,P.JD)(x.hK.endpoints.prometheusRuleNamespaces.initiate({ruleSourceName:c.hY,dashboardUid:I},{forceRefetch:!0}));if(A.error)throw new Error("Unexpected alert rules response.");return A.data},K=(0,t.H)(T()).pipe((0,n.T)(A=>(0,g.Kw)(A))).pipe((0,n.T)(A=>{this.hasAlertRules=!1;const W={};return A.forEach(N=>
171N.rules.forEach(w=>{if(y.R$.alertingRule(w)&&w.annotations?.[p.YH.panelID]){this.hasAlertRules=!0;const j=Number(w.annotations[p.YH.panelID]),V=v(w.state);W[j]?V===o.O.Alerting&&W[j].state!==o.O.Alerting?W[j].state=o.O.Alerting:V===o.O.Pending&&W[j].state!==o.O.Alerting&&W[j].state!==o.O.Pending&&(W[j].state=o.O.Pending):W[j]={state:V,id:Object.keys(W).length,panelId:j,dashboardId:R}}})),Object.values(W)}));this.querySub=K.subscribe({next:A=>{const W=(0,s.Vc)(A);this.publishResults({state:m.Gu.Done,series:[{...W,meta:{...W.meta,dataTopic:r.QR.AlertStates}}],timeRange:S.state.value})},error:A=>{this.handleError(A),this.publishResults({state:m.Gu.Error,series:[],errors:[{message:(0,i.q6)(A)}],timeRange:S.state.value})}})}canWork(S){const O=(0,b.YQ)(this),{uid:I}=O.state;return!(!I||a.$.publicDashboardAccessToken||S.state.value.raw.to!=="now"||this.hasAlertRules===!1||!(u.TP.hasPermission(d.AccessControlAction.AlertingRuleRead)&&u.TP.hasPermission(d.AccessControlAction.AlertingRuleExternalRead)))}}function v(C){return C===D.cF.Firing?o.O.Alerting:C===D.cF.Pending?o.O.Pending:o.O.OK}},49e3:(ee,B,e)=>{"use strict";e.d(B,{g:()=>a});var t=e(22592),n=e(27359),r=e(739),o=e(43173),s=e(56838),m=e(42942);class a extends s.tV.g{async resolveDataSource(f){return o.$.publicDashboardAccessToken?new m.X:super.resolveDataSource(f)}processEvents(f,h){if(o.$.publicDashboardAccessToken){const u={series:[],timeRange:(0,t.E2)(),state:h.state},i=(0,n.I)(h.events);return i.meta={...i.meta,dataTopic:r.QR.Annotations},u.annotations=[i],u}else return super.processEvents(f,h)}}},34960:(ee,B,e)=>{"use strict";e.d(B,{x:()=>C});var t=e(74848),n=e(22803),r=e(7389),o=e(85629),s=e(56838),m=e(63142),a=e(31286),l=e(41654),f=e(21285),h=e(56840);function u({panelEditor:R}){const{tableView:T,dataPane:L}=R.useState();return(0,t.jsx)(t.Fragment,{children:L&&(0,t.jsx)(f.K,{label:(0,h.t)("dashboard-scene.panel-edit-controls.table-view-label-table-view","Table view"),showLabel:!0,id:"table-view",value:!!T,onClick:R.onToggleTableView,"aria-label":(0,h.t)("dashboard-scene.panel-edit-controls.table-view-aria-label-toggletableview","Toggle table view"),"data-testid":o.Tp.components.PanelEditor.toggleTableView})})}var i=e(8285),x=e(63704),g=e(45967),p=e(4137),c=e(82345),y=e(86871);function P({links:R,dashboard:T}){s.jh.getTimeRange(T).useState();const L=T.state.uid;return!R||!L?null:(0,t.jsx)(t.Fragment,{children:R.map((K,A)=>{const W=(0,c.mQ)().getAnchorInfo(K),N=`${K.title}-$${A}`;if(K.type==="dashboards")return(0,t.jsx)(p.aK,{link:K,linkInfo:W,dashboardUID:L},N);const w=y.G[K.icon],j=(0,t.jsx)(p.Zx,{icon:w,href:(0,x.Jf)(W.href),target:K.targetBlank?"_blank":void 0,rel:"noreferrer","data-testid":o.Tp.components.DashboardLinks.link,children:W.title});return(0,t.jsx)("div",{"data-testid":o.Tp.components.DashboardLinks.container,children:K.tooltip?(0,t.jsx)(g.m,{content:W.tooltip,children:j}):j},N)})})}var d=e(56887);function D({dashboard:R}){const T=s.jh.getVariables(R).useState();return(0,t.jsx)(t.Fragment,{children:T.variables.map(L=>(0,t.jsx)(b,{variable:L},L.state.key))})}function b({variable:R}){const T=(0,s.gn)(R,{shouldActivateOrKeepAlive:!0}),{isSelected:L,onSelect:K,isSelectable:A}=(0,d.y)(R.state.key),W=(0,m.of)(v);if(T.hide===r.zL.hideVariable)return null;const N=w=>{A&&K&&(w.stopPropagation(),K(w))};return(0,t.jsxs)("div",{className:(0,n.cx)(W.container,L&&"dashboard-selected-element",A&&!L&&"dashboard-selectable-element"),onPointerDown:N,"data-testid":o.Tp.pages.Dashboard.SubMenu.submenuItem,children:[(0,t.jsx)(E,{variable:R,className:(0,n.cx)(A&&W.labelSelectable)}),(0,t.jsx)(R.Component,{model:R})]})}function E({variable:R,className:T}){const{state:L}=R;if(R.state.hide===r.zL.hideLabel)return null;const K=L.label||L.name,A=`var-${L.key}`;return(0,t.jsx)(s.Zx,{htmlFor:A,isLoading:L.loading,onCancel:()=>R.onCancel?.(),label:K,error:L.error,layout:"horizontal",description:L.description??void 0,className:T})}const v=R=>({container:(0,n.css)({display:"flex","> :nth-child(2)":(0,n.css)({borderTopLeftRadius:0,borderBottomLeftRadius:0})}),labelWrapper:(0,n.css)({display:"flex",alignItems:"center"}),labelSelectable:(0,n.css)({cursor:"pointer"})});class C extends s.Bs{constructor(T){super({timePicker:T.timePicker??new s.KE({}),refreshPicker:T.refreshPicker??new s.WM({}),...T}),this._variableDependency=new s.Sh(this,{onAnyVariableChanged:this._onAnyVariableChanged.bind(this)}),this._urlSync=new s.So(this,{keys:["_dash.hideTimePicker","_dash.hideVariables","_dash.hideLinks"]}),this.addActivationHandler(()=>{let L;return this.state.hideTimeControls&&(L=this.state.refreshPicker.activate()),()=>{L&&L()}})}static{this.Component=S}getUrlState(){return{}}updateFromUrl(T){const{hideTimeControls:L,hideVariableControls:K,hideLinksControls:A}
171=this.state,W=N=>T[N]==="true"||T[N]==="";!L&&W("_dash.hideTimePicker")&&this.setState({hideTimeControls:!0}),!K&&W("_dash.hideVariables")&&this.setState({hideVariableControls:!0}),!A&&W("_dash.hideLinks")&&this.setState({hideLinksControls:!0})}_onAnyVariableChanged(){(0,i.YQ)(this).state.links?.length>0&&this.forceRender()}hasControls(){const T=s.jh.getVariables(this)?.state.variables.some(w=>w.state.hide!==r.zL.hideVariable),L=s.jh.getDataLayers(this).some(w=>w.state.isEnabled&&!w.state.isHidden),K=(0,i.YQ)(this).state.links?.length>0,A=this.state.hideLinksControls||!K,W=this.state.hideVariableControls||!L&&!T,N=this.state.hideTimeControls;return!(W&&A&&N)}}function S({model:R}){const{refreshPicker:T,timePicker:L,hideTimeControls:K,hideVariableControls:A,hideLinksControls:W}=R.useState(),N=(0,i.YQ)(R),{links:w,editPanel:j}=N.useState(),V=(0,m.of)(I),U=location.search.includes("scene-debugger");return R.hasControls()?(0,t.jsxs)("div",{"data-testid":o.Tp.pages.Dashboard.Controls,className:(0,n.cx)(V.controls,j&&V.controlsPanelEdit),children:[(0,t.jsxs)(l.B,{grow:1,wrap:"wrap",children:[!A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(D,{dashboard:N}),(0,t.jsx)(O,{dashboard:N})]}),(0,t.jsx)(a.a,{grow:1}),!W&&!j&&(0,t.jsx)(P,{links:w,dashboard:N}),j&&(0,t.jsx)(u,{panelEditor:j})]}),!K&&(0,t.jsxs)(l.B,{justifyContent:"flex-end",children:[(0,t.jsx)(L.Component,{model:L}),(0,t.jsx)(T.Component,{model:T})]}),U&&(0,t.jsx)(s.or,{scene:R},"scene-debugger")]}):(0,t.jsx)(a.a,{padding:1})}function O({dashboard:R}){const T=s.jh.getDataLayers(R,!0);return(0,t.jsx)(t.Fragment,{children:T.map(L=>(0,t.jsx)(L.Component,{model:L},L.state.key))})}function I(R){return{controls:(0,n.css)({display:"flex",alignItems:"flex-start",flex:"100%",gap:R.spacing(1),padding:R.spacing(2),flexDirection:"row",flexWrap:"nowrap",position:"relative",width:"100%",marginLeft:"auto",[R.breakpoints.down("sm")]:{flexDirection:"column-reverse",alignItems:"stretch"}}),controlsPanelEdit:(0,n.css)({paddingRight:0}),embedded:(0,n.css)({background:"unset",position:"unset"})}}},88632:(ee,B,e)=>{"use strict";e.d(B,{s:()=>r});var t=e(74848),n=e(56838);class r extends n.ps{constructor(s){super({...s,name:s.name??"Data layers",annotationLayers:s.annotationLayers??[]}),this.addActivationHandler(()=>this._onActivate())}_onActivate(){return this._subs.add(this.subscribeToState((s,m)=>{s.annotationLayers!==m.annotationLayers&&(this.querySub?.unsubscribe(),this.subscribeToAllLayers(this.getAllLayers()))})),this.subscribeToAllLayers(this.getAllLayers()),()=>{this.querySub?.unsubscribe()}}addAnnotationLayer(s){this.setState({annotationLayers:[...this.state.annotationLayers,s]})}getAllLayers(){const s=[...this.state.annotationLayers];return this.state.alertStatesLayer&&s.push(this.state.alertStatesLayer),s}static{this.Component=({model:s})=>{const{annotationLayers:m}=s.useState();return(0,t.jsx)(t.Fragment,{children:m.map(a=>(0,t.jsx)(a.Component,{model:a},a.state.key))})}}}},36605:(ee,B,e)=>{"use strict";e.d(B,{L:()=>s});var t=e(56838),n=e(9931),r=e(18615),o=e(8285);class s extends t.Bs{constructor(a){super(a),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){const a=this.parent;let l,f,h;if(!(a instanceof t.dt))throw new Error("DashboardDatasourceBehaviour must be attached to a SceneQueryRunner");if(!this.containsDashboardDSQueries(a))return;try{h=(0,o.YQ)(a)}catch{return}const u=a.state.queries.find(P=>P.panelId!==void 0);if(!u)return;const i=u.panelId,x=(0,o.XA)(i),g=(0,o.EX)(h,x);if(!(g instanceof t.Eb))return;const p=(0,o.iL)(g);
171if(p&&!p.state.isLoaded){l=p.subscribeToState(P=>{this.handleLibPanelStateUpdates(P,a,g)});return}const c=(0,o.un)(g);if(!c)throw new Error("Could not find SceneQueryRunner for panel");const y=c.parent;return y instanceof t.Es&&y.state.transformations.length&&(f=y.subscribeToState((P,d)=>{P.data!==d.data&&a.runQueries()})),this.prevRequestId&&this.prevRequestId!==c.state.data?.request?.requestId&&a.runQueries(),()=>{this.prevRequestId=c?.state.data?.request?.requestId,l&&l.unsubscribe(),f&&f.unsubscribe()}}containsDashboardDSQueries(a){return a.state.datasource?.uid===n.K?!0:a.state.datasource?.uid===r.uv&&a.state.queries.some(l=>l.datasource?.uid===n.K)}handleLibPanelStateUpdates(a,l,f){if(a&&a?.isLoaded){if(!((0,o.un)(f)instanceof t.dt))throw new Error("Could not find SceneQueryRunner for library panel");l.runQueries()}}}},88499:(ee,B,e)=>{"use strict";e.d(B,{M:()=>o});var t=e(56838),n=e(8285);class r{constructor(m,a){this._sceneObject=a,this.state={name:m,type:"dashboard_macro"}}getValue(m){const a=(0,n.YQ)(this._sceneObject);switch(m){case"uid":return a.state.uid||"";case"title":case"name":case"id":default:return a.state.title}}getValueText(){return""}}function o(){const s=t.Go.registerVariableMacro("__dashboard",r);return()=>s()}},44804:(ee,B,e)=>{"use strict";e.d(B,{s:()=>m});var t=e(2543),n=e.n(t),r=e(56838),o=e(41644),s=e(39385);class m extends r.Bs{constructor(l){super(l),this.reloadDashboard=(0,t.debounce)(this.reloadDashboard).bind(this);const f=!!this.state.uid&&!!this.state.reloadOnParamsChange;this.addActivationHandler(()=>{f&&(this._timeRange=r.jh.getTimeRange(this),this._scopesBridge=r.jh.getScopesBridge(this),this._dashboardScene=r.jh.getAncestor(this,s.H$),this._variableDependency=new r.Sh(this,{onAnyVariableChanged:this.reloadDashboard}),this._scopesBridge?.subscribeToValue(()=>{f&&this.reloadDashboard()}),this._subs.add(this._timeRange.subscribeToState((h,u)=>{(0,t.isEqual)(h.value,u.value)||this.reloadDashboard()})),this.reloadDashboard())})}isEditing(){return!!this._dashboardScene?.state.isEditing}isWaitingForVariables(){const l=r.jh.getVariables(this.parent);return l.state.variables.some(f=>l.isVariableLoadingOrWaitingToUpdate(f))}reloadDashboard(){this.isEditing()||this.isWaitingForVariables()||setTimeout(()=>{(0,o.sP)().reloadDashboard({version:this.state.version,scopes:this._scopesBridge?.getValue().map(l=>l.metadata.name)??[],timeRange:{from:this._timeRange.state.value.from.toISOString(),to:this._timeRange.state.value.to.toISOString()},variables:r.jh.getVariables(this).state.variables.reduce((l,f)=>({...l,...f.urlSync?.getUrlState()}),{})})})}}},39385:(ee,B,e)=>{"use strict";e.d(B,{H$:()=>mo,vk:()=>rl,Nn:()=>ii});var t=e(92138),n=e(1906),r=e(43173),o=e(36490),s=e(75234),m=e(56838),a=e(45229),l=e(95943),f=e(84057),h=e(29043),u=e(10605),i=e(22429),x=e(7817),g=e(82612),p=e(79718),c=e(88813),y=e(87745),P=e(75735),d=e(74848),D=e(22803),b=e(33149),E=e(78685),v=e(63142),C=e(93008),S=e(7895),O=e(66404),I=e(30703),R=e(92807),T=e(56840),L=e(3371),K=e(8285),A=e(2543),W=e(96540),N=e(31286),w=e(56887),j=e(41654),V=e(93389),U=e(35282);function F(Ie){const[ge,Le]=(0,W.useState)({}),he=ot=>{Ie.onChangeName&&Le({isRenaming:!0,originalName:Ie.getEditableElementInfo().instanceName})},Ae=()=>{ge.error&&Ie.onChangeName(ge.originalName),Le({})},Fe=(0,W.useMemo)(()=>ot=>{ot?.focus(),ot?.select()},[]),qe=ot=>{const ut=Ie.onChangeName(ot.target.value);ut?.errorMessage?Le({...ge,error:ut.errorMessage}):ge.error&&Le({...ge,error:void 0})},nt=ot=>{ot.key==="Enter"&&Ae()};return{isRenaming:ge.isRenaming,onNameDoubleClicked:he,renameInputRef:Fe,onChangeName:qe,onInputBlur:Ae,onInputKeyDown:nt}}function M({editPane:Ie}){const ge=(0,K.YQ)(Ie);return(0,d.jsx)(N.a,{padding:1,gap:.25,display:"flex",direction:"column",children:(0,d.jsx)(H,{sceneObject:ge,editPane:Ie,depth:0})})}function H({sceneObject:Ie,editPane:ge,depth:Le}){const[he,Ae]=(0,W.useState)(Le>0),{key:Fe}=Ie.useState(),qe=(0,v.of)(_),{isSelected:nt,onSelect:ot}=(0,w.y)(Fe),ut=(0,W.useMemo)(()=>(0,L.uc)(Fe),[Fe]),Ct=(0,W.useMemo)(()=>(0,U.wT)(Ie),[Ie]),Lt=(0,A.sortBy)(Z(Ie,[],0),"depth"),Kt=Ct.getEditableElementInfo(),zt=(0,T.t)("dashboard.outline.tree-item.no-title","<no title>"),dn=Kt.instanceName===""?zt:Kt.instanceName,Gt=Ct.getCollapsedState?.(),rn=F(Ct),Pn=jn=>
171{nt||ot?.(jn),Ct.scrollIntoView?.()},Un=()=>{Ae(!he),Ct.getCollapsedState&&Ct.setCollapsedState?.(!he)};return(0,W.useEffect)(()=>{Gt!=null&&Gt!==he&&Ae(Gt)},[he,Gt]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(j.B,{gap:.5,children:[Kt.isContainer&&(0,d.jsx)("button",{role:"treeitem",className:qe.angleButton,onClick:Un,children:(0,d.jsx)(I.I,{name:he?"angle-right":"angle-down"})}),(0,d.jsxs)("button",{role:"button",className:(0,D.cx)(qe.nodeButton,ut&&qe.nodeButtonClone,nt&&qe.nodeButtonSelected),onPointerDown:Pn,onDoubleClick:rn.onNameDoubleClicked,children:[(0,d.jsx)(I.I,{size:"sm",name:Kt.icon}),rn.isRenaming?(0,d.jsx)("input",{ref:rn.renameInputRef,type:"text",value:Kt.instanceName,className:qe.outlineInput,onChange:rn.onChangeName,onBlur:rn.onInputBlur,onKeyDown:rn.onInputKeyDown}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:dn}),Kt.isHidden&&(0,d.jsx)(I.I,{name:"eye-slash",size:"sm",className:qe.hiddenIcon}),Kt.isContainer&&he&&(0,d.jsxs)("span",{children:["(",Lt.length,")"]})]})]})]}),Kt.isContainer&&!he&&(0,d.jsx)("div",{className:qe.container,role:"group",children:Lt.length>0?Lt.map(jn=>(0,d.jsx)(H,{sceneObject:jn.sceneObject,editPane:ge,depth:Le+1},jn.sceneObject.state.key)):(0,d.jsx)(O.E,{color:"secondary",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard.outline.tree-item.empty",children:"(empty)"})})})]})}function _(Ie){return{container:(0,D.css)({display:"flex",flexDirection:"column",gap:Ie.spacing(.5),marginLeft:Ie.spacing(1),paddingLeft:Ie.spacing(1.5),borderLeft:`1px solid ${Ie.colors.border.medium}`}),angleButton:(0,D.css)({boxShadow:"none",border:"none",background:"transparent",borderRadius:Ie.shape.radius.default,padding:0,color:Ie.colors.text.secondary,lineHeight:0}),nodeButton:(0,D.css)({boxShadow:"none",border:"none",background:"transparent",padding:Ie.spacing(.25,1,.25,0),borderRadius:Ie.shape.radius.default,color:Ie.colors.text.secondary,display:"flex",alignItems:"center",gap:Ie.spacing(.5),overflow:"hidden","&:hover":{color:Ie.colors.text.primary,outline:`1px dashed ${Ie.colors.border.strong}`,outlineOffset:"0px",backgroundColor:Ie.colors.emphasize(Ie.colors.background.canvas,.08)},"> span":{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}),nodeButtonSelected:(0,D.css)({color:Ie.colors.text.primary,outline:`1px dashed ${Ie.colors.primary.border} !important`,outlineOffset:"0px","&:hover":{outline:`1px dashed ${Ie.colors.primary.border}`}}),hiddenIcon:(0,D.css)({color:Ie.colors.text.secondary,marginLeft:Ie.spacing(1)}),nodeButtonClone:(0,D.css)({color:Ie.colors.text.secondary,cursor:"not-allowed"}),outlineInput:(0,D.css)({border:`1px solid ${Ie.colors.primary.border}`,height:Ie.spacing(3),"&:focus":{outline:"none",boxShadow:"none"}})}}function Z(Ie,ge,Le){return Ie.forEachChild(he=>{const Ae=(0,U.wT)(he);if(Ae){ge.push({sceneObject:he,editableElement:Ae,depth:Le});return}if(he instanceof V.U&&he.state.repeatedPanels?.length){for(const Fe of he.state.repeatedPanels){const qe=(0,U.wT)(Fe);ge.push({sceneObject:Fe,editableElement:qe,depth:Le})}return}Z(he,ge,Le+1)}),ge}var ne=e(76319),te=e(88559),Y=e(87063),Q=e(45861);function J({element:Ie,editPane:ge}){const Le=Ie.getEditableElementInfo(),he=(0,v.of)(q),Ae=Ie.onCopy?.bind(Ie),Fe=Ie.onDuplicate?.bind(Ie),qe=Ie.onDelete?.bind(Ie),nt=Ie.onConfirmDelete?.bind(Ie),ot=()=>ge.clearSelection(),ut=ge.state.selection;return(0,d.jsxs)("div",{className:he.wrapper,children:[(0,d.jsxs)(j.B,{direction:"row",gap:1,children:[ut&&(0,d.jsx)(ne.K,{name:"arrow-left",size:"lg",onClick:ot,tooltip:(0,T.t)("grafana.dashboard.edit-pane.go-back","Go back"),"aria-label":(0,T.t)("grafana.dashboard.edit-pane.go-back","Go back")}),(0,d.jsx)(O.E,{children:Le.typeName})]}),(0,d.jsxs)(j.B,{direction:"row",gap:1,children:[Ie.renderActions&&Ie.renderActions(),(Ae||Fe)&&(0,d.jsx)(te.m,{overlay:(0,d.jsxs)(Y.W,{children:[Ae?(0,d.jsx)(Y.W.Item,{icon:"copy",label:(0,T.t)("dashboard.layout.common.copy","Copy"),onClick:Ae}):null,Fe?(0,d.jsx)(Y.W.Item,{icon:"file-copy-alt",label:(0,T.t)("dashboard.layout.common.duplicate","Duplicate"),onClick:Fe}):null]}),children:(0,d.jsx)(Q.$n,{tooltip:(0,T.t)("dashboard.layout.common.copy-or-duplicate","Copy or Duplicate"),tooltipPlacement:"bottom",variant:"secondary",size:"sm",icon:"copy",children:(0,d.jsx)(I.I,{name:"angle-down"})})}),(qe||nt)&&(0,d.jsx)(Q.$n,{onClick:nt||qe,size:"sm",variant:"destructive",fill:"outline",icon:"trash-alt",tooltip:(0,T.t)("dashboard.layout.common.delete","Delete")})]})]})}function q(Ie){return{wrapper:(0,D.css)({display:"flex",alignItems:"center",justifyContent:"space-between",padding:Ie.spacing(1,2),borderBottom:`1px solid ${Ie.colors.border.weak}`})}}function X({element:Ie,editPane:ge,isNewElement:Le}){const he=Ie.useEditPaneOptions?Ie.useEditPaneOptions(Le):[],Ae=(0,v.of)(se);return(0,d.jsxs)("div",{className:Ae.wrapper,children:[(0,d.jsx)(J,{element:Ie,editPane:ge}),(0,d.jsx)(R.P,{showScrollIndicators:!0,children:(0,d.jsx)("div",{className:Ae.categories,children:he.map(Fe=>Fe.render())})})]})}function se(Ie){return{wrapper:(0,D.css)({display:"flex",flexDirection:"column",flex:"1 1 0",height:"100%"}),categories:(0,D.css)({display:"flex",flexDirection:"column",borderBottom:`1px solid ${Ie.colors.border.weak}`})}}function oe(Ie){return"onDelete"in Ie}var ae=e(73427);class ie{constructor(ge){this._elements=ge,this.isEditableDashboardElement=!0}useEditPaneOptions(){return[]}getEditableElementInfo(){return{typeName:(0,T.t)("dashboard.edit-pane.elements.objects","Objects"),icon:"folder",instanceName:""}}onConfirmDelete(){ae.lE.publish(new y.bY({title:(0,T.t)("dashboard.edit-pane.elements.multiple-elements","Multiple elements"),text:(0,T.t)("dashboard.edit-pane.elements.multiple-elements-delete-text","Are you sure you want to delete these elements?"),onConfirm:()=>this.onDelete()}))}
171onDelete(){this._elements.forEach(ge=>ge.onDelete())}}class fe{constructor(ge){this._isNewElement=!1,this.selectedObjects=new Map(ge),this._isMultiSelection=ge.length>1,this.isMultiSelection&&(this.sameType=this.checkSameType())}markAsNewElement(){this._isNewElement=!0}isNewElement(){return this._isNewElement}checkSameType(){const ge=this.selectedObjects.values(),Le=ge.next().value?.resolve().constructor.name;if(!Le)return!1;for(let he of ge??[])if(he.resolve().constructor.name!==Le)return!1;return!0}hasValue(ge){return this.selectedObjects.has(ge)}removeValue(ge){this.selectedObjects.delete(ge),this.selectedObjects.size<2&&(this.sameType=void 0,this._isMultiSelection=!1)}getStateWithValue(ge,Le,he){const Ae=Le.getRef();let Fe=[{id:ge}],qe=[[ge,Ae]];const nt=this.getSelectionEntries()??[],ot=nt.map(([ut])=>({id:ut}));return he&&(qe=[[ge,Ae],...nt],Fe=[{id:ge},...ot]),{selection:qe,contextItems:Fe}}getStateWithoutValueAt(ge){this.removeValue(ge);const Le=this.getSelectionEntries()??[],he=Le.map(([Ae])=>({id:Ae}));return{entries:Le,contextItems:he}}
171getSelection(){return this.isMultiSelection?this.getSceneObjects():this.getFirstObject()}getSelectionEntries(){return Array.from(this.selectedObjects.entries())}getFirstObject(){return this.selectedObjects.values().next().value?.resolve()}get isMultiSelection(){return this._isMultiSelection}getSceneObjects(){return Array.from(this.selectedObjects.values()??[]).map(ge=>ge.resolve())}createSelectionElement(){const ge=this.getSceneObjects();if(ge.length===0)return;const Le=(0,U.wT)(ge[0]);if(!Le)return;if(ge.length===1)return Le;if(this.sameType&&Le.createMultiSelectedElement){const Ae=ge.map(Fe=>(0,U.wT)(Fe));return Le.createMultiSelectedElement(Ae)}const he=[];for(const Ae of ge){const Fe=(0,U.wT)(Ae);Fe&&oe(Fe)&&he.push(Fe)}if(he.length)return new ie(he)}}function pe(Ie,ge){return(0,W.useMemo)(()=>{if(!Ie){const Le=(0,K.YQ)(ge);return new fe([[Le.state.uid,Le.getRef()]]).createSelectionElement()}return Ie.createSelectionElement()},[Ie,ge])}class de extends m.Bs{constructor(){super({selectionContext:{enabled:!1,selected:[],onSelect:(ge,Le)=>
171this.selectElement(ge,Le),onClear:()=>this.clearSelection()}}),this.addActivationHandler(this.onActivate.bind(this))}onActivate(){const ge=(0,K.YQ)(this);this._subs.add(ge.subscribeToEvent(U.jO,({payload:Le})=>{this.newObjectAddedToCanvas(Le)})),this._subs.add(ge.subscribeToEvent(U.ck,({payload:Le})=>{this.clearSelection()})),this._subs.add(ge.subscribeToEvent(U.su,({payload:Le})=>{this.forceRender()})),this._subs.add(ge.subscribeToEvent(U.N4,({payload:Le})=>{this.forceRender()}))}enableSelection(){this.setState({selectionContext:{...this.state.selectionContext,enabled:!0}})}disableSelection(){this.setState({selectionContext:{...this.state.selectionContext,selected:[],enabled:!1},selection:void 0})}selectElement(ge,Le){if((0,L.uc)(ge.id)){if(Le.multi)return;this.clearSelection();return}let he=m.jh.findByKey(this,ge.id);if(he){if(he instanceof m.Eb&&(0,L.ag)((0,L.Dq)(ge.id))){const Ae=(0,K.Uv)(this,ge.id);Ae&&(he=Ae)}this.selectObject(he,ge.id,Le)}}getSelection(){return this.state.selection?.getSelection()}selectObject(ge,Le,{multi:he,force:Ae}={}){if(!Ae){if(he){if(this.state.selection?.hasValue(Le)){this.removeMultiSelectedObject(Le);return}}else if(this.state.selection?.getFirstObject()===ge){this.clearSelection();return}}const Fe=this.state.selection??new fe([[Le,ge.getRef()]]),{selection:qe,contextItems:nt}=Fe.getStateWithValue(Le,ge,!!he);this.setState({selection:new fe(qe),selectionContext:{...this.state.selectionContext,selected:nt}})}removeMultiSelectedObject(ge){if(!this.state.selection)return;const{entries:Le,contextItems:he}=this.state.selection.getStateWithoutValueAt(ge);if(Le.length===0){this.clearSelection();return}this.setState({selection:new fe([...Le]),selectionContext:{...this.state.selectionContext,selected:he}})}clearSelection(){this.state.selection&&this.setState({selection:void 0,selectionContext:{...this.state.selectionContext,selected:[]}})}newObjectAddedToCanvas(ge){this.selectObject(ge,ge.state.key),this.state.selection.markAsNewElement()}}function le({editPane:Ie,isCollapsed:ge,onToggleCollapse:Le,openOverlay:he}){const{selection:Ae}=(0,m.gn)(Ie,{shouldActivateOrKeepAlive:!0}),Fe=(0,v.of)(me),qe=pe(Ae,Ie),nt=Ae?.getFirstObject(),ot=Ae?.isNewElement()??!1,[ut,Ct]=(0,E.A)("grafana.dashboard.edit-pane.outline.collapsed",!0),[Lt=.4,Kt]=(0,E.A)("grafana.dashboard.edit-pane.outline.size",.4),zt=(0,C.h)({direction:"column",handleSize:"sm",initialSize:1-Lt,dragPosition:"middle",onSizeChanged:dn=>{Kt(1-dn)}});return qe?ge?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:Fe.expandOptionsWrapper,children:(0,d.jsx)(S.I,{tooltip:(0,T.t)("dashboard.edit-pane.open","Open options pane"),icon:"arrow-to-right",onClick:Le,variant:"canvas",narrow:!0,className:Fe.rotate180,"aria-label":(0,T.t)("dashboard.edit-pane.open","Open options pane")})}),he&&(0,d.jsx)(b.c,{className:Fe.overlayWrapper,defaultSize:{height:"100%",width:"300px"},children:(0,d.jsx)(X,{element:qe,editPane:Ie,isNewElement:ot},nt?.state.key)})]}):(ut?(zt.primaryProps.style.flexGrow=1,zt.primaryProps.style.minHeight="unset",zt.secondaryProps.style.flexGrow=0,zt.secondaryProps.style.minHeight="min-content"):(zt.primaryProps.style.minHeight="unset",zt.secondaryProps.style.minHeight="unset"),(0,d.jsx)("div",{className:Fe.wrapper,children:(0,d.jsxs)("div",{...zt.containerProps,children:[(0,d.jsx)("div",{...zt.primaryProps,className:(0,D.cx)(zt.primaryProps.className,Fe.paneContent),children:(0,d.jsx)(X,{element:qe,editPane:Ie,isNewElement:ot},nt?.state.key)}),(0,d.jsx)("div",{...zt.splitterProps,className:(0,D.cx)(zt.splitterProps.className,Fe.splitter),"data-edit-pane-splitter":!0}),(0,d.jsxs)("div",{...zt.secondaryProps,className:(0,D.cx)(zt.primaryProps.className,Fe.paneContent),children:[(0,d.jsxs)("div",{role:"button",onClick:()=>Ct(!ut),className:Fe.outlineCollapseButton,children:[(0,d.jsx)(O.E,{weight:"medium",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.dashboard-edit-pane-renderer.outline",children:"Outline"})}),(0,d.jsx)(I.I,{name:"angle-up"})]}),!ut&&(0,d.jsx)("div",{className:Fe.outlineContainer,children:(0,d.jsx)(R.P,{showScrollIndicators:!0,children:(0,d.jsx)(M,{editPane:Ie})})})]})]})})):null}function me(Ie){return{wrapper:(0,D.css)({display:"flex",flexDirection:"column",flex:"1 1 0",marginTop:Ie.spacing(2),borderLeft:`1px solid ${Ie.colors.border.weak}`,borderTop:`1px solid ${Ie.colors.border.weak}`,background:Ie.colors.background.primary,borderTopLeftRadius:Ie.shape.radiu
171s.default}),overlayWrapper:(0,D.css)({right:0,bottom:0,top:Ie.spacing(2),position:"absolute !important",background:Ie.colors.background.primary,borderLeft:`1px solid ${Ie.colors.border.weak}`,borderTop:`1px solid ${Ie.colors.border.weak}`,boxShadow:Ie.shadows.z3,zIndex:Ie.zIndex.navbarFixed,flexGrow:1}),paneContent:(0,D.css)({overflow:"hidden",display:"flex",flexDirection:"column"}),rotate180:(0,D.css)({rotate:"180deg"}),tabsbar:(0,D.css)({padding:Ie.spacing(0,1),margin:Ie.spacing(.5,0)}),expandOptionsWrapper:(0,D.css)({display:"flex",flexDirection:"column",padding:Ie.spacing(2,1,2,0)}),splitter:(0,D.css)({"&:after":{display:"none"}}),outlineCollapseButton:(0,D.css)({display:"flex",padding:Ie.spacing(.5,2),gap:Ie.spacing(1),justifyContent:"space-between",alignItems:"center",background:Ie.colors.background.secondary,"&:hover":{background:Ie.colors.action.hover}}),outlineContainer:(0,D.css)({display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden"})}}var De=e(3204),Te=e(54314),Ne=e(60208),Ce=e(8207),He=e(30906),ke=e(55266);function Me(Ie){const Le=new URLSearchParams(window.location.search).get("folderUid")||void 0,{repository:he,isInstanceManaged:Ae}=(0,ke.T)({folderName:Le});return r.$.featureToggles.provisioning?Ie.isManagedRepository()||!!he||Ae:!1}var $e=e(76459),tt=e.n($e),Ke=e(49785),Re=e(85629),Ve=e(34999),Qe=e(37386),je=e(63527),ze=e(87105),Ye=e(21285),Ge=e(72636),ce=e(67804),Pe=e(89223),Se=e(143),Ee=e(8535);async function xe(Ie){if(!Ie||!r.$.featureToggles.provisioning)return{};const Le=(await(0,Ee.JD)(Se.b.endpoints.getFolder.initiate({name:Ie})).unwrap()).metadata.annotations?.[P.Jw];return Le?{k8s:{annotations:{[P.Jw]:Le,[P.LH]:P.Sf.Repo}}}:{}}var ye=e(68143);function Oe(Ie){return(0,ye.NF)(Ie)&&Ie.data&&Ie.data.status==="version-mismatch"}function we(Ie){return(0,ye.NF)(Ie)&&Ie.data&&Ie.data.status==="name-exists"}function Be(Ie){return(0,ye.NF)(Ie)&&Ie.data&&Ie.data.status==="plugin-dashboard"}function Xe({cancelButton:Ie,saveButton:ge}){return(0,d.jsxs)(Ve.F,{title:(0,T.t)("dashboard-scene.name-already-exists-error.title-name-already-exists","Name already exists"),severity:"error",children:[(0,d.jsx)("p",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.name-already-exists-error.body-name-already-exists",children:"A dashboard with the same name in selected folder already exists. Would you still like to save this dashboard?"})}),(0,d.jsx)(N.a,{paddingTop:2,children:(0,d.jsxs)(j.B,{alignItems:"center",children:[Ie,ge(!0)]})})]})}function st({overwrite:Ie,isLoading:ge,isValid:Le,onSave:he}){return(0,d.jsx)(Q.$n,{disabled:!Le||ge,icon:ge?"spinner":void 0,onClick:()=>he(Ie),variant:Ie?"destructive":"primary","data-testid":Re.Tp.components.Drawer.DashboardSaveDrawer.saveButton,children:ge?"Saving...":Ie?"Save and overwrite":"Save"})}var lt=e(41053),Et=e(27489),Tt=e(64762),Mt=e(38206),wt=e(15203),_e=e(96673),xt=e(77731);function At(Ie=!1){const ge=(0,_e.useDispatch)(),Le=(0,Tt._2)(),[he]=(0,wt.e8)(),[Ae,Fe]=(0,lt.A)(async(qe,nt)=>{{let ot=nt.rawDashboardJSON??qe.getSaveModel();nt.saveAsCopy&&(ot=qe.getSaveAsModel({isNew:nt.isNew,title:nt.title,description:nt.description,copyTags:nt.copyTags}));const ut=await he({dashboard:ot,folderUid:nt.folderUid,message:nt.message,overwrite:nt.overwrite,showErrorAlert:!1,k8s:nt.k8s});if("error"in ut)throw ut.error;const Ct=ut.data;qe.saveCompleted(ot,Ct,nt.folderUid),a.A.publish(new y.Eu),Le.success("Dashboard saved"),(0,xt.ko)(Ct.uid),Ie?(0,Et.rR)("grafana_dashboard_copied",{name:ot.title,url:Ct.url}):(0,Et.rR)(`grafana_dashboard_${Ct.uid?"saved":"created"}`,{name:ot.title,url:Ct.url});const Lt=o.Ny.getLocation(),Kt=t.I.stripBaseFromUrl(Ct.url);return Kt!==Lt.pathname&&setTimeout(()=>{o.Ny.push({pathname:Kt,search:Lt.search})}),qe.state.meta.isStarred&&ge((0,Mt.TU)({id:Ct.uid,title:qe.state.title,url:Kt})),ut.data}},[ge,Le]);return{state:Ae,onSaveDashboard:Fe}}function bt({dashboard:Ie,changeInfo:ge}){const{changedSaveModel:Le}=ge,{register:he,handleSubmit:Ae,setValue:Fe,formState:qe,getValues:nt,watch:ot}=(0,Ke.mN)({mode:"onBlur",defaultValues:{title:ge.isNew?Le.title:`${Le.title} Copy`,description:Le.description??"",folder:{uid:Ie.state.meta.folderUid,title:Ie.state.meta.folderTitle},copyTags:!1}}),{errors:ut,isValid:Ct,defaultValues:Lt}=qe,Kt=ot(),{state:zt,onSaveDashboard:dn}=At(!1),[Gt,rn]=(0,W.useState)({}),[Pn,Un]=(0,W.useState)(!1),jn=async Hn=>{const kn=nt();(await dn(Ie,{overwrite:Hn,folderUid:kn.folder.uid,rawDashboardJSON:Le,saveAsCopy:!0,isNew:ge.isNew,copyTags:kn.copyTags,title:kn.title,de
171scription:kn.description})).status==="success"?Ie.closeModal():rn({title:kn.title,folderUid:kn.folder.uid})},Bn=(0,d.jsx)(Q.$n,{variant:"secondary",onClick:()=>Ie.closeModal(),fill:"outline",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-dashboard-as-form.cancel-button.cancel",children:"Cancel"})}),Yn=Hn=>{const kn=!Ct&&Pn?!0:Ct;return(0,d.jsx)(st,{isValid:kn,isLoading:zt.loading,onSave:jn,overwrite:Hn})};function Pa(Hn){const kn=Kt.title.trim()===Gt.title&&Kt.folder.uid===Gt.folderUid;return we(Hn)&&kn?(0,d.jsx)(Xe,{cancelButton:Bn,saveButton:Yn}):(0,d.jsxs)(d.Fragment,{children:[Hn&&kn&&(0,d.jsx)(Ve.F,{title:(0,T.t)("dashboard-scene.save-dashboard-as-form.render-footer.title-failed-to-save-dashboard","Failed to save dashboard"),severity:"error",children:Hn.message&&(0,d.jsx)("p",{children:Hn.message})}),(0,d.jsxs)(j.B,{alignItems:"center",children:[Bn,Yn(!1)]})]})}return(0,d.jsxs)("form",{onSubmit:Ae(()=>jn(!1)),children:[(0,d.jsx)(Qe.D,{label:(0,d.jsx)(Xt,{onChange:Fe}),invalid:!!ut.title,error:ut.title?.message,children:(0,d.jsx)(je.p,{...he("title",{required:"Required",validate:vn}),"aria-label":(0,T.t)("dashboard-scene.save-dashboard-as-form.aria-label-save-dashboard-title-field","Save dashboard title field"),"data-testid":Re.Tp.components.Drawer.DashboardSaveDrawer.saveAsTitleInput,onChange:tt()(async Hn=>{Fe("title",Hn.target.value,{shouldValidate:!0})},400)})}),(0,d.jsx)(Qe.D,{label:(0,d.jsx)(Cn,{onChange:Fe}),invalid:!!ut.description,error:ut.description?.message,children:(0,d.jsx)(ze.f,{...he("description",{required:!1}),"aria-label":(0,T.t)("dashboard-scene.save-dashboard-as-form.aria-label-save-dashboard-description-field","Save dashboard description field"),autoFocus:!0})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-dashboard-as-form.label-folder","Folder"),children:(0,d.jsx)(ce.d,{onChange:async(Hn,kn)=>{Fe("folder",{uid:Hn,title:kn});const Rn=Ie.state.meta.folderUid;Un(Hn!==Rn);const yn=await xe(Hn);Ie.setState({meta:{...yn,folderUid:Hn}})},value:Kt.folder?.uid,initialTitle:Lt.folder.title,dashboardId:Ie.state.id??void 0,enableCreateNew:!0})}),!ge.isNew&&(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-dashboard-as-form.label-copy-tags","Copy tags"),children:(0,d.jsx)(Ye.d,{...he("copyTags")})}),(0,d.jsx)(N.a,{paddingTop:2,children:Pa(zt.error)})]})}function Xt(Ie){return(0,d.jsx)(j.B,{justifyContent:"space-between",children:(0,d.jsx)(Ge.J,{htmlFor:"description",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.title-field-label.t
171itle",children:"Title"})})})}function Cn(Ie){return(0,d.jsx)(j.B,{justifyContent:"space-between",children:(0,d.jsx)(Ge.J,{htmlFor:"description",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.description-label.description",children:"Description"})})})}async function vn(Ie,ge){if(Ie===ge.folder.title?.trim())return"Dashboard name cannot be the same as folder name";try{return await Pe.P.validateNewDashboardName(ge.folder.uid??"general",Ie),!0}catch(Le){return Le instanceof Error?Le.message:"Dashboard name is invalid"}}var Wn=e(32635);function Dt({dashboard:Ie,drawer:ge,changeInfo:Le}){const{hasChanges:he,hasMigratedToV2:Ae,changedSaveModel:Fe}=Le,{state:qe,onSaveDashboard:nt}=At(!1),[ot,ut]=(0,W.useState)({folderUid:Ie.state.meta.folderUid,k8s:{...Ie.state.meta.k8s}}),Ct=async Gt=>{(await nt(Ie,{...ot,rawDashboardJSON:Fe,overwrite:Gt})).status==="success"&&(Ie.closeModal(),ge.state.onSaveSuccess?.())},Lt=(0,d.jsx)(Q.$n,{variant:"secondary",onClick:()=>Ie.closeModal(),fill:"outline",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-dashboard-form.cancel-button.cancel",children:"Cancel"})}),Kt=Gt=>(0,d.jsx)(st,{isValid:he,isLoading:qe.loading,onSave:Ct,overwrite:Gt}),zt=Gt=>Gt&&Gt.length>500;function dn(Gt){if(zt(ot.message)){const rn=ot.message?.length??0;return(0,d.jsx)(Ve.F,{title:(0,T.t)("save-dashboards.message-length.title","Message too long"),severity:"error",children:(0,d.jsx)("p",{children:(0,d.jsxs)(T.x6,{i18nKey:"save-dashboards.message-length.info",children:["The message is ",{messageLength:rn}," characters, which exceeds the maximum length of 500 characters. Please shorten it before saving."]})})})}return Oe(Gt)?(0,d.jsxs)(Ve.F,{title:(0,T.t)("dashboard-scene.save-dashboard-form.render-footer.title-someone-else-has-updated-this-dashboard","Someone else has updated this dashboard"),severity:"error",children:[(0,d.jsx)("p",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-dashboard-form.render-footer.would-still-dashboard",children:"Would you still like to save this dashboard?"})}),(0,d.jsx)(N.a,{paddingTop:2,children:(0,d.jsxs)(j.B,{alignItems:"center",children:[Lt,Kt(!0)]})})]}):we(Gt)?(0,d.jsx)(Xe,{cancelButton:Lt,saveButton:Kt}):Be(Gt)?(0,d.jsxs)(Ve.F,{title:(0,T.t)("dashboard-scene.save-dashboard-form.render-footer.title-plugin-dashboard","Plugin dashboard"),severity:"error",children:[(0,d.jsx)("p",{children:(0,d.jsxs)(T.x6,{i18nKey:"dashboard-scene.save-dashboard-form.render-footer.body-plugin-dashboard",children:["Your changes will be lost when you update the plugin. Use ",(0,d.jsx)("strong",{children:"Save as"})," to create custom version."]})}),(0,d.jsx)(N.a,{paddingTop:2,children:(0,d.jsxs)(j.B,{alignItems:"center",children:[Lt,Kt(!0)]})})]}):(0,d.jsxs)(d.Fragment,{children:[Gt&&(0,d.jsx)(Ve.F,{title:(0,T.t)("dashboard-scene.save-dashboard-form.render-footer.title-failed-to-save-dashboard","Failed to save dashboard"),severity:"error",children:(0,d.jsx)("p",{children:Gt.message})}),(0,d.jsxs)(j.B,{alignItems:"center",children:[Lt,Kt(!1),!he&&(0,d.jsx)("div",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-dashboard-form.render-footer.no-changes-to-save",children:"No changes to save"})})]})]})}return(0,d.jsxs)(j.B,{gap:2,direction:"column",children:[(0,d.jsx)(qt,{drawer:ge,changeInfo:Le}),Ae&&(0,d.jsx)(Ve.F,{title:(0,T.t)("dashboard-scene.save-dashboard-form.title-dashboard-drastically-changed","Dashboard drastically changed"),severity:"warning",children:(0,d.jsx)("p",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-dashboard-form.body-dashboard-drastically-changed",children:"Because you're using new dashboards features only supported on new Grafana dashboard schema format, the dashboard will be saved in the new format. Please make sure you want to perform this action or you prefer to save the dashboard as a new copy."})})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-dashboard-form.label-message","Message"),children:(0,d.jsx)(ze.f,{"aria-label":(0,T.t)("dashboard-scene.save-dashboard-form.aria-label-message","message"),value:ot.message??"",onChange:Gt=>{ut({...ot,message:Gt.currentTarget.value})},placeholder:(0,T.t)("dashboard-scene.save-dashboard-form.placeholder-describe-changes-optional","Add a note to de
171scribe your changes (optional)."),autoFocus:!0,rows:5})}),dn(qe.error)]})}function qt({drawer:Ie,changeInfo:ge}){const{saveVariables:Le=!1,saveTimeRange:he=!1,saveRefresh:Ae=!1}=Ie.useState(),{hasTimeChanges:Fe,hasVariableValueChanges:qe,hasRefreshChange:nt}=ge;return(0,d.jsxs)(j.B,{direction:"column",alignItems:"flex-start",children:[Fe&&(0,d.jsx)(Wn.S,{id:"save-timerange",checked:he,onChange:Ie.onToggleSaveTimeRange,label:(0,T.t)("dashboard-scene.save-dashboard-form-common-options.save-timerange-label-update-default-time-range","Update default time range"),description:(0,T.t)("dashboard-scene.save-dashboard-form-common-options.save-timerange-description-current-range-default","Will make current time range the new default"),"data-testid":Re.Tp.pages.SaveDashboardModal.saveTimerange}),nt&&(0,d.jsx)(Wn.S,{id:"save-refresh",label:(0,T.t)("dashboard-scene.save-dashboard-form-common-options.save-refresh-label-update-default-refresh-value","Update default refresh value"),description:(0,T.t)("dashboard-scene.save-dashboard-form-common-options.save-refresh-description-current-refresh-default","Will make the current refresh the new default"),checked:Ae,onChange:Ie.onToggleSaveRefresh,"data-testid":Re.Tp.pages.SaveDashboardModal.saveRefresh}),qe&&(0,d.jsx)(Wn.S,{id:"save-variables",label:(0,T.t)("dashboard-scene.save-dashboard-form-common-options.save-variables-label-update-default-variable-values","Update default variable values"),description:(0,T.t)("dashboard-scene.save-dashboard-form-common-options.save-variables-description-current-values-default","Will make the current values the new default"),checked:Le,onChange:Ie.onToggleSaveVariables,"data-testid":Re.Tp.pages.SaveDashboardModal.saveVariables})]})}var Yt=e(4213),nn=e.n(Yt),Zt=e(70713),tn=e(50992),ft=e(47931);function Rt({dashboard:Ie,drawer:ge,changeInfo:Le}){const he=(0,W.useMemo)(()=>JSON.stringify(Le.changedSaveModel,null,2),[Le]),Ae=(0,W.useCallback)(()=>{const Fe=new Blob([he],{type:"application/json;charset=utf-8"});(0,Yt.saveAs)(Fe,Le.changedSaveModel.title+"-"+new Date().getTime()+".json")},[Le.changedSaveModel,he]);return(0,d.jsx)("div",{className:Bt.container,children:(0,d.jsxs)(j.B,{direction:"column",gap:2,grow:1,children:[(0,d.jsxs)("div",{children:["This dashboard cannot be saved from the Grafana UI because it has been provisioned from another source. Copy the JSON or save it to a file below, then you can update your dashboard in the provisioning source.",(0,d.jsx)("br",{}),(0,d.jsxs)("i",{children:["See"," ",(0,d.jsx)("a",{className:"external-link",href:"https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information about provisioning."]}),(0,d.jsx)("br",{})," ",(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"File path: "})," ",Ie.state.meta.provisionedExternalId]}),(0,d.jsx)(qt,{drawer:ge,changeInfo:Le}),(0,d.jsx)("div",{className:Bt.json,children:(0,d.jsx)(Zt.default,{disableWidth:!0,children:({height:Fe})=>(0,d.jsx)(tn.B,{width:"100%",height:Fe,language:"json",showLineNumbers:!0,showMiniMap:he.length>100,value:he,readOnly:!0})})}),(0,d.jsx)(N.a,{paddingTop:2,children:(0,d.jsxs)(j.B,{gap:2,children:[(0,d.jsx)(Q.$n,{variant:"secondary",onClick:ge.onClose,fill:"outline",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-provisioned-dashboard-form.cancel",children:"Cancel"})}),(0,d.jsx)(ft.b,{icon:"copy",getText:()=>he,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-provisioned-dashboard-form.copy-json-to-clipboard",children:"Copy JSON to clipboard"})}),(0,d.jsx)(Q.$n,{type:"submit",onClick:Ae,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-provisioned-dashboard-form.save-json-to-file",children:"Save JSON to file"})})]})})]})})}const Bt={container:(0,D.css)({height:"100%",display:"flex"}),json:(0,D.css)({flexGrow:1,maxHeight:"800px"})};var jt=e(74101),Nt=e(54148),$t=e(32899),an=e(77824),Jt=e(77197),gn=e(47195),mn=e(91555),_t=e(19164);function On(Ie){const[ge,Le]=(0,_t.tj)(),[he,Ae]=(0,_t.XM)();return[(0,W.useCallback)(qe=>(Ie?he:ge)(qe),[ge,Ie,he]),Ie?Ae:Le]}var Nn=e(92784),Fn=e(52043),na=e(99454);function aa({defaultValues:Ie,dashboard:ge,drawer:Le,changeInfo:he,isNew:Ae,loadedFromRef:Fe,repository:qe,isGitHub:nt}){const ot=(0,Nt.Zp)(),ut=(0,s.J7)(),{isDirty:Ct,editPanel:Lt}=ge.useState(),[Kt,zt]=On(Ae?void 0:Ie.path),{register:dn,handleSubmit:Gt,watch:rn,formState:{errors:Pn},control:Un,reset:jn}=(0,Ke.mN)({defaultValues:Ie}),[Bn,Yn,Pa]=rn(["ref","workflow","path"]);(0,W.useEffect)(()=>{jn(Ie)},[Ie,jn]),(0,W.useEffect)(()=>
171{if(zt.isSuccess){ge.setState({isDirty:!1});const{ref:Rn,path:yn}=zt.data;if(Yn==="branch"&&Rn&&yn){ge.closeModal(),Lt?.onDiscard(),ot(`${mn.mL}/${Ie.repo}/dashboard/preview/${yn}?ref=${Rn}`);return}ut.publish({type:$t.r1.alertSuccess.name,payload:[(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.api-success","Dashboard changes saved")]});const qn=zt.data.resource.upsert;if(Ae&&qn?.metadata?.name){const An=t.I.assureBaseUrl((0,Fn.u)({uid:qn.metadata.name,slug:Jt.A.slugifyForUrl(qn.spec.title??""),currentQueryParams:window.location.search}));ot(An);return}ge.closeModal(),o.Ny.partial({viewPanel:null,editPanel:null})}else zt.isError&&ut.publish({type:$t.r1.alertError.name,payload:[(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.api-error","Error saving dashboard"),zt.error]})},[ut,ge,Ie.repo,Le,Ae,ot,Lt,Pa,Bn,zt,Yn]);const Hn=async({title:Rn,description:yn,repo:qn,path:An,comment:ra,ref:oa})=>{if(!qn||!An)return;Yn==="write"&&(oa=Fe);const la=ge.getSaveResource({isNew:Ae,title:Rn,description:yn});Kt({ref:oa,name:qn,path:An,message:ra,body:la})},kn=(0,na.a)(qe,Fe);return(0,d.jsx)("form",{onSubmit:Gt(Hn),name:"save-provisioned-form",children:(0,d.jsxs)(j.B,{direction:"column",gap:2,children:[!qe?.workflows?.length&&(0,d.jsx)(Ve.F,{title:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.title-this-repository-is-read-only","This repository is read only"),children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-provisioned-dashboard-form.copy-json-message",children:"If you have direct access to the target, copy the JSON and paste it there."})}),Ae&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.label-title","Title"),invalid:!!Pn.title,error:Pn.title?.message,children:(0,d.jsx)(je.p,{id:"dashboard-title",...dn("title",{required:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.title-required","Dashboard t
171itle is required"),validate:yt})})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.label-description","Description"),invalid:!!Pn.description,error:Pn.description?.message,children:(0,d.jsx)(ze.f,{id:"dashboard-description",...dn("description")})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.label-target-folder","Target folder"),children:(0,d.jsx)(Ke.xI,{control:Un,name:"folder",render:({field:{ref:Rn,value:yn,onChange:qn,...An}})=>(0,d.jsx)(ce.d,{inputId:"dashboard-folder",onChange:async(ra,oa)=>{qn({uid:ra,title:oa}),mt("folderUid",ra);const la=await xe(ra);ge.setState({meta:{...la,folderUid:ra}})},value:yn.uid,...An})})})]}),!Ae&&(0,d.jsx)(qt,{drawer:Le,changeInfo:he}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.label-path","Path"),description:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.description-inside-repository","File path inside the repository (.json or .yaml)"),children:(0,d.jsx)(je.p,{id:"dashboard-path",...dn("path"),readOnly:!Ae})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.label-comment","Comment"),children:(0,d.jsx)(ze.f,{id:"dashboard-comment",...dn("comment"),placeholder:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.dashboard-comment-placeholder-describe-changes-optional","Add a note to describe your changes (optional)"),rows:5})}),nt&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.label-workflow","Workflow"),children:(0,d.jsx)(Ke.xI,{control:Un,name:"workflow",render:({field:{ref:Rn,...yn}})=>(0,d.jsx)(an.z,{id:"dashboard-workflow",...yn,options:kn})})}),Yn==="branch"&&(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.label-branch","Branch"),description:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.description-branch-name-in-git-hub","Branch name in GitHub"),invalid:!!Pn.ref,error:Pn.ref&&(0,d.jsx)(gn.y,{}),children:(0,d.jsx)(je.p,{id:"dashboard-branch",...dn("ref",{validate:Nn.e})})})]}),(0,d.jsxs)(j.B,{gap:2,children:[(0,d.jsx)(Q.$n,{variant:"primary",type:"submit",disabled:zt.isLoading||!Ct,children:zt.isLoading?(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.saving","Saving..."):(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.save","Save")}),(0,d.jsx)(Q.$n,{variant:"secondary",onClick:Le.onClose,fill:"outline",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.save-provisioned-dashboard-form.cancel",children:"Cancel"})})]})]})})}async function yt(Ie,ge){if(Ie===ge.folder.title?.trim())return(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.title-same-as-folder","Dashboard name cannot be the same as the folder name");try{return await Pe.P.validateNewDashboardName(ge.folder.uid??"general",Ie),
171!0}catch(Le){return Le instanceof Error?Le.message:(0,T.t)("dashboard-scene.save-provisioned-dashboard-form.title-validation-failed","Dashboard title validation failed.")}}function mt(Ie,ge){if(!ge)return;const Le=new URL(window.location.href);Le.searchParams.set(Ie,ge),window.history.replaceState({},"",Le)}function Ot({timestamp:Ie,pathFromAnnotation:ge,slug:Le,folderPath:he=""}){let Ae="";if(ge){const qe=ge.indexOf("#");return qe>0?ge.substring(0,qe):ge}return Ae=`${Le||`new-dashboard-${Ie}`}.json`,he?`${he}/${Ae}`:Ae}var Wt=e(97677),et=e(25229);function Je(){const Ie=new Wt.Chance;return`${(0,et.KQ)().format("YYYY-MM-DD")}-${Ie.string({length:5,alpha:!0})}`}function rt({meta:Ie,defaultTitle:ge,defaultDescription:Le,loadedFromRef:he}){const Ae=Ie.k8s?.annotations,Fe=Ae?.[P.LH],qe=Ae?.[P.Jw],nt=Ae?.[P.Y_],{repository:ot,folder:ut,isLoading:Ct}=(0,ke.T)({name:Fe==="repo"?qe:void 0,folderName:Ie.folderUid}),Lt=Je(),Kt=ut?.metadata?.annotations?.[P.Y_],zt=Ot({timestamp:Lt,pathFromAnnotation:nt,slug:Ie.slug,folderPath:Kt});return Ct||!ot?null:{values:{ref:`dashboard/${Lt}`,path:zt,repo:qe||ot?.name||"",comment:"",folder:{uid:Ie.folderUid,title:""},title:ge,description:Le??"",workflow:(0,na.r)(ot,he)},isNew:!Ie.k8s?.name,isGitHub:ot?.type==="github",repository:ot}}function it({drawer:Ie,changeInfo:ge,dashboard:Le}){const{meta:he,title:Ae,description:Fe}=Le.useState(),[qe]=(0,jt.z)(),nt=qe.get("ref")??void 0,ot=rt({meta:he,defaultTitle:Ae,defaultDescription:Fe,loadedFromRef:nt});if(!ot)return null;const{values:ut,isNew:Ct,isGitHub:Lt,repository:Kt}=ot;return(0,d.jsx)(aa,{dashboard:Le,drawer:Ie,changeInfo:ge,isNew:Ct,defaultValues:ut,loadedFromRef:nt,isGitHub:Lt,repository:Kt})}class Pt extends m.Bs{constructor(){super(...arguments),this.onClose=()=>{const ge=this.state.dashboardRef.resolve(),Le=ge.getDashboardChanges();ge.setState({overlay:void 0,meta:Le.isNew?ge.getInitialState()?.meta:ge.state.meta})},this.onToggleSaveTimeRange=()=>{this.setState({saveTimeRange:!this.state.saveTimeRange})},this.onToggleSaveVariables=()=>{this.setState({saveVariables:!this.state.saveVariables})},this.onToggleSaveRefresh=()=>{this.setState({saveRefresh:!this.state.saveRefresh})}}static{this.Component=({model:ge})=>{const{showDiff:Le,saveAsCopy:he,saveTimeRange:Ae,saveVariables:Fe,saveRefresh:qe}=ge.useState(),nt=ge.state.dashboardRef.resolve().getDashboardChanges(Ae,Fe,qe),{changedSaveModel:ot,initialSaveModel:ut,diffs:Ct,diffCount:Lt,hasFolderChanges:Kt,hasMigratedToV2:zt}=nt,dn=Lt+(Kt?1:0),Gt=ge.state.dashboardRef.resolve(),{meta:rn}=Gt.useState(),{provisioned:Pn,folderTitle:Un}=rn,jn=Me(Gt),Bn=(0,d.jsxs)(Te.U,{children:[(0,d.jsx)(Ne.o,{label:(0,T.t)("dashboard-scene.save-dashboard-drawer.tabs.label-details","Details"),active:!Le,onChangeTab:()=>ge.setState({showDiff:!1})}),dn>0&&(0,d.jsx)(Ne.o,{label:(0,T.t)("dashboard-scene.save-dashboard-drawer.tabs.label-changes","Changes"),active:Le,onChangeTab:()=>ge.setState({showDiff:!0}),counter:dn})]});let Yn="Save dashboard";he?Yn="Save dashboard copy":(Pn||jn)&&(Yn="Provisioned dashboard");const Pa=()=>Le?(0,d.jsx)(He.l,{diff:Ct,oldValue:ut,newValue:ot,hasFolderChanges:Kt,hasMigratedToV2:zt,oldFolder:Gt.getInitialState()?.meta.folderTitle,newFolder:Un}):jn?(0,d.jsx)(it,{dashboard:Gt,changeInfo:nt,drawer:ge}):he||nt.isNew?(0,d.jsx)(bt,{dashboard:Gt,changeInfo:nt}):Pn?(0,d.jsx)(Rt,{dashboard:Gt,changeInfo:nt,drawer:ge}):(0,d.jsx)(Dt,{dashboard:Gt,changeInfo:nt,drawer:ge});return(0,d.jsx)(Ce._,{title:Yn,subtitle:Gt.state.title,onClose:ge.onClose,tabs:Bn,children:Pa()})}}}var It=e(60171),Vt=e(65635),en=e(95710),ln=e(17862),Qt=e(3392),xn=e(13241),En=e(70030),zn=e(62265);class Gn{constructor(){this.elementPanelMap=new Map,this.defaultDsReferencesMap={panels:new Map,variables:new Set,annotations:new Set}}initializeElementMapping(ge){this.elementPanelMap.clear(),!(!ge||!ge.panels)&&ge.panels?.forEach(Le=>{if(Le.id){const he=(0,K.XA)(Le.id);this.elementPanelMap.set(he,Le.id)}})}getElementPanelMapping(){return this.elementPanelMap}initializeDSReferencesMapping(ge){return{}}getDSReferencesMapping(){return this.defaultDsReferencesMap}getPanelIdForElement(ge){return this.elementPanelMap.get(ge)}getElementIdForPanel(ge){for(const[he,Ae]of this.elementPanelMap.entries())if(Ae===ge)return he;const Le=(0,K.XA)(ge);return this.elementPanelMap.set(Le,ge),Le}getSaveModel(ge){return(0,En.Uy)(ge)}getSaveAsModel(ge,Le){const he=this.getSaveModel(ge);return{...he,id:null,uid:"",title:Le.title||"",description:Le.description||void 0,tags:Le.isNew||Le.copyTags?he.tags:[]}}getDashboardChangesFromScene(ge,Le){const he=this.getSaveModel(ge),Ae=(0,ln.Cj)(this.initialSaveModel,he,Le.saveTimeRange,Le.saveVariables,Le.s
171aveRefresh),Fe=ge.getInitialState()?.meta.folderUid!==ge.state.meta.folderUid;return{...Ae,hasFolderChanges:Fe,hasChanges:Ae.hasChanges||Fe,hasMigratedToV2:!1}}onSaveComplete(ge,Le){this.initialSaveModel={...ge,id:Le.id,uid:Le.uid,version:Le.version}}getTrackingInformation(){const ge=this.initialSaveModel?.panels?.map(Ae=>Ae.type)||[],Le=(0,en.GC)(ge),he=(0,en.wM)(this.initialSaveModel?.templating?.list||[]);if(this.initialSaveModel)return{uid:this.initialSaveModel.uid,title:this.initialSaveModel.title,schemaVersion:this.initialSaveModel.schemaVersion,panels_count:this.initialSaveModel.panels?.length||0,settings_nowdelay:void 0,settings_livenow:!!this.initialSaveModel.liveNow,...Le,...he}}getSnapshotUrl(){return this.initialSaveModel?.snapshot?.originalUrl}async makeExportableExternally(ge){const Le=this.getSaveModel(ge),he=new x.G(Le,void 0,{getVariablesFromState:()=>(0,xn.E)(window.__grafanaSceneContext)});return await(0,Qt.E)(he)}}class St{constructor(){this.elementPanelMap=new Map,this.defaultDsReferencesMap={panels:new Map,variables:new Set,annotations:new Set}}getElementPanelMapping(){return this.elementPanelMap}initializeElementMapping(ge){if(this.elementPanelMap.clear(),!ge||!ge.elements)return;Object.keys(ge.elements).forEach(he=>{const Ae=ge.elements[he];Ae.kind==="Panel"&&this.elementPanelMap.set(he,Ae.spec.id)})}initializeDSReferencesMapping(ge){if(ge===void 0||ge&&!(0,It.aK)(ge))return;if(this.defaultDsReferencesMap={panels:new Map,variables:new Set,annotations:new Set},Object.keys(ge?.elements||{}).forEach(he=>{const Ae=ge?.elements[he];if(Ae?.kind==="Panel"){const Fe=Ae.spec.data.spec.queries;for(const qe of Fe)if(!qe.spec.datasource){const nt=this.getElementIdForPanel(Ae.spec.id);this.defaultDsReferencesMap.panels.has(nt)||this.defaultDsReferencesMap.panels.set(nt,new Set),this.defaultDsReferencesMap.panels.get(nt).add(qe.spec.refId)}}}),ge?.variables)for(const he of ge.variables)he.kind==="QueryVariable"&&!he.spec.datasource&&this.defaultDsReferencesMap.variables.add(he.spec.name);if(ge?.annotations)for(const he of ge.annotations)he.spec.datasource||this.defaultDsReferencesMap.annotations.add(he.spec.name)}getDSReferencesMapping(){return this.defaultDsReferencesMap}getPanelIdForElement(ge){return this.elementPanelMap.get(ge)}getElementIdForPanel(ge){for(const[he,Ae]of this.elementPanelMap.entries())if(Ae===ge)return he;const Le=(0,K.XA)(ge);return this.elementPanelMap.set(Le,ge),Le}getSaveModel(ge){return(0,zn.Xl)(ge)}getSaveAsModel(ge,Le){const he=this.getSaveModel(ge);return{...he,title:Le.title||"",description:Le.description||"",tags:Le.isNew||Le.copyTags?he.tags:[]}}getDashboardChangesFromScene(ge,Le){const he=this.getSaveModel(ge),Ae=(0,ln.AM)(this.initialSaveModel,he,Le.saveTimeRange,Le.saveVariables,Le.saveRefresh),Fe=ge.getInitialState()?.meta.folderUid!==ge.state.meta.folderUid,qe=!ge.getInitialState()?.uid;return{...Ae,hasFolderChanges:Fe,hasChanges:Ae.hasChanges||Fe,isNew:qe,hasMigratedToV2:!!Ae.hasMigratedToV2}}onSaveComplete(ge,Le){this.initialSaveModel={...ge}}getTrackingInformation(ge){if(!this.initialSaveModel)return;const Le="elements"in this.initialSaveModel?Object.values(this.initialSaveModel.elements).filter(Fe=>Fe.kind==="Panel").map(Fe=>Fe.spec.vizConfig.kind):[],he=(0,en.GC)(Le),Ae="variables"in this.initialSaveModel?(0,en.z9)(this.initialSaveModel.variables):[];return{schemaVersion:Vt.O2,uid:ge.state.uid,title:this.initialSaveModel.title,panels_count:Le.length||0,settings_nowdelay:void 0,settings_livenow:!!this.initialSaveModel.liveNow,...he,...Ae}}getSnapshotUrl(){return this.metadata?.annotations?.[P.UL]}async makeExportableExternally(ge){return await(0,Qt.j)(this.getSaveModel(ge))}}function Ht(Ie){return Ie==="v2"?new St:new Gn}var cn=e(4974),un=e(17340),bn=e(67350),Sn=e(65333),wn=e(21378),ea=e(64423),Zn=e(19379),Vn=e(84229),_n=e(80011),Ln=e(88632),Xn=e(99392),ma=e(33380);class Ca{constructor(ge){this._scene=ge,this.events=new Zn.o,this._subs=new ea.yU;const Le=m.jh.getTimeRange(ge);this.formatDate=this.formatDate.bind(this),this._subs.add(Le.subscribeToState((he,Ae)=>{he.value!==Ae.value&&this.events.publish(new s.sR(he.value))}))}get id(){return this._scene.state.id??null}get uid(){return this._scene.state.uid??null}
171get title(){return this._scene.state.title}get description(){return this._scene.state.description}get editable(){return this._scene.state.editable}get graphTooltip(){return this._getSyncMode()}get timepicker(){return{refresh_intervals:this._scene.state.controls.state.refreshPicker.state.intervals,hidden:this._scene.state.controls.state.hideTimeControls??!1}}get timezone(){return this.getTimezone()}get weekStart(){return m.jh.getTimeRange(this._scene).state.weekStart}get tags(){return this._scene.state.tags}get links(){return this._scene.state.links}get meta(){return this._scene.state.meta}get time(){const ge=m.jh.getTimeRange(this._scene);return{from:ge.state.from,to:ge.state.to}}get panels(){return Da(this._scene,Le=>Le instanceof m.Eb).map(Le=>new ma.R(Le))}get annotations(){const ge={list:[]};return this._scene.state.$data instanceof Ln.s&&(ge.list=(0,Xn.O)(this._scene.state.$data.state.annotationLayers)),ge}getTimezone(){return m.jh.getTimeRange(this._scene).getTimeZone()}sharedTooltipModeEnabled(){return this._getSyncMode()>0}sharedCrosshairModeOnly(){return this._getSyncMode()===1}_getSyncMode(){if(this._scene.state.$behaviors){for(const ge of this._scene.state.$behaviors)if(ge instanceof m.Gg.K2)return ge.state.sync}return Vn.y.Off}otherPanelInFullscreen(ge){return!1}formatDate(ge,Le){return(0,_n.LE)(ge,{format:Le,timeZone:this.getTimezone()})}getPanelById(ge){const Le=(0,K.vL)(this._scene,(0,K.XA)(ge));return Le?new ma.R(Le):null}removePanel(ge){const Le=(0,K.vL)(this._scene,(0,K.XA)(ge.id));if(!Le){console.error("Trying to remove a panel that was not found in scene",ge);return}this._scene.removePanel(Le)}canEditAnnotations(ge){return this._scene.canEditDashboard()?ge?!!this._scene.state.meta.annotationsPermissions?.dashboard.canEdit:!!this._scene.state.meta.annotationsPermissions?.organization.canEdit:!1}panelInitialized(){}destroy(){this.events.removeAllListeners(),this._subs.unsubscribe()}hasUnsavedChanges(){return this._scene.state.isDirty}}function Da(Ie,ge){let Le=[];return Ie.forEachChild(he=>{ge(he)?Le.push(he):Le=Le.concat(Da(he,ge))}),Le}var Qn=e(1682);function Ha(Ie){let ge=5381;for(let Le=0;Le<Ie.length;Le++)ge=ge*33^Ie.charCodeAt(Le);return ge>>>0}var ba=e(22079);class Ps extends m.Bs{constructor(ge){super({...ge,jsonText:""}),this.onClose=()=>{this.state.dashboardRef.resolve().setState({overlay:void 0})},this.onSave=()=>{},this.addActivationHandler(()=>this.setState({jsonText:this.getJsonText()}))}getJsonText(){const ge=this.state.dashboardRef.resolve();return JSON.stringify((0,zn.Xl)(ge),null,2)}static{this.Component=({model:ge})=>{const{jsonText:Le}=ge.useState(),he=(0,v.of)(Ms),Ae=()=>(0,d.jsxs)("div",{className:he.wrapper,children:[(0,d.jsx)(tn.B,{width:"100%",value:Le,language:"json",showLineNumbers:!0,showMiniMap:!0,containerStyles:he.codeEditor,onBlur:Fe=>ge.setState({jsonText:Fe})}),(0,d.jsx)(N.a,{paddingTop:2,children:(0,d.jsx)(Q.$n,{onClick:ge.onSave,disabled:!0,children:"Update dashboard"})})]});return(0,d.jsx)(Ce._,{title:"[DEV] Schema V2 editor",subtitle:"Allows editing dashboard using v2 schema. Changes are not persisted in db.",onClose:ge.onClose,children:Ae()})}}}const Ms=Ie=>({wrapper:(0,D.css)({display:"flex",height:"100%",flexDirection:"column",gap:Ie.spacing(2)}),codeEditor:(0,D.css)({flexGrow:1})});var Ds=e(24438),br=e(7094),$r=e(3688);class zr extends m.Bs{constructor(){super(...arguments),this.onClose=()=>{(0,K.YQ)(this).closeModal()},this.onAddLibraryPanel=ge=>{const Le=(0,K.YQ)(this),he=(0,K.O8)();he.setState({title:ge.model.title,hoverHeader:!ge.model.title,$behaviors:[new br.u({uid:ge.uid,name:ge.name})]});const Ae=this.state.panelToReplaceRef?.resolve();if(Ae){const Fe=Ae.parent;Fe&&(0,$r.y)(Fe)&&Fe.setElementBody(he)}else Le.addPanel(he);this.onClose()}}static{this.Component=({model:ge})=>{const Le=(0,T.t)("library-panel.add-widget.title","Add panel from panel library");return(0,d.jsx)(Ce._,{title:Le,onClose:ge.onClose,children:(0,d.jsx)(Ds.j,{onClick:ge.onAddLibraryPanel,variant:Ds.s.Tight,showPanelFilter:!0})})}}}var sr=e(36324);function Gs(Ie){return"isDashboardDropTarget"in Ie&&Ie.isDashboardDropTarget===!0}
171class as extends m.Bs{constructor(){super({}),this._sourceDropTarget=null,this._lastDropTarget=null,this._pointerDistance=(0,sr.b)(),this._isSelectedObject=!1,this._onPointerMove=this._onPointerMove.bind(this),this._stopDraggingSync=this._stopDraggingSync.bind(this),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){return()=>{document.body.removeEventListener("pointermove",this._onPointerMove),document.body.removeEventListener("pointerup",this._stopDraggingSync)}}startDraggingSync(ge,Le){this._pointerDistance.set(ge),this._isSelectedObject=!1;const he=m.jh.findObject(Le,Gs);!he||!Gs(he)||(this._sourceDropTarget=he,this._lastDropTarget=he,document.body.addEventListener("pointermove",this._onPointerMove),document.body.addEventListener("pointerup",this._stopDraggingSync),this.setState({draggingPanel:Le.getRef()}))}_stopDraggingSync(ge){const Le=this.state.draggingPanel?.resolve();this._sourceDropTarget!==this._lastDropTarget&&setTimeout(()=>{this._sourceDropTarget?.draggedPanelOutside?.(Le),this._lastDropTarget?.draggedPanelInside?.(Le)}),document.body.removeEventListener("pointermove",this._onPointerMove),document.body.removeEventListener("pointerup",this._stopDraggingSync),this.setState({draggingPanel:void 0})}_onPointerMove(ge){if(!this._isSelectedObject&&this.state.draggingPanel&&this._pointerDistance.check(ge)){this._isSelectedObject=!0;const he=this.state.draggingPanel?.resolve();this._getDashboard().state.editPane.selectObject(he,he.state.key,{force:!0,multi:!1})}const Le=this._getDropTargetUnderMouse(ge)??this._sourceDropTarget;Le&&Le!==this._lastDropTarget&&(this._lastDropTarget?.setIsDropTarget?.(!1),this._lastDropTarget=Le,Le!==this._sourceDropTarget&&Le.setIsDropTarget?.(!0))}_getDashboard(){if(!(this.parent instanceof mo))throw new Error("Parent is not a DashboardScene");return this.parent}_getDropTargetUnderMouse(ge){const Le=document.elementsFromPoint(ge.clientX,ge.clientY)?.find(Ae=>{const Fe=Ae.getAttribute("data-dashboard-drop-target-key");return!!Fe&&Fe!==this._sourceDropTarget?.state.key})?.getAttribute("data-dashboard-drop-target-key");if(!Le)return null;const he=m.jh.findByKey(this._getDashboard(),Le);return!he||!Gs(he)?null:he}}var ka=e(75683),Ya=e(13791),Hr=e(92293),Ws=e(94076),Fs=e(82754),Wa=e(8857);function Gr({dashboard:Ie,isEditing:ge,body:Le,controls:he}){const Ae=(0,Hr.k)(),{editPane:Fe}=Ie.state,qe=(0,v.of)(_r,Ae??0),[nt,ot]=(0,U.dt)();if(!r.$.featureToggles.dashboardNewLayouts)return(0,d.jsx)(Ws.A,{onSetScrollRef:Ie.onSetScrollRef,children:(0,d.jsxs)("div",{className:qe.canvasWrappperOld,children:[(0,d.jsx)(Wa.c,{dashboard:Ie}),(0,d.jsx)("div",{className:qe.controlsWrapperSticky,children:he}),(0,d.jsx)("div",{className:qe.body,children:Le})]})});const{containerProps:ut,primaryProps:Ct,secondaryProps:Lt,splitterProps:Kt,splitterState:zt,onToggleCollapse:dn}=(0,Fs.L)({direction:"row",dragPosition:"end",initialSize:330,handleSize:"sm",usePixels:!0,collapseBelowPixels:250,collapsed:nt});(0,W.useEffect)(()=>{ot(zt.collapsed)},[zt.collapsed,ot]),(0,W.useEffect)(()=>{ge?Fe.enableSelection():Fe.disableSelection()},[ge,Fe]);const{selectionContext:Gt}=(0,m.gn)(Fe,{shouldActivateOrKeepAlive:!0}),rn={};ge||(Ct.style.flexGrow=1,Ct.style.width="100%",Ct.style.minWidth="unset",rn.overflow="unset");const Pn=Un=>{Un&&Ie.onSetScrollRef(new Ws.X(Un))};return(0,d.jsx)("div",{...ut,style:rn,children:(0,d.jsxs)(w._.Provider,{value:Gt,children:[(0,d.jsxs)("div",{...Ct,className:(0,D.cx)(Ct.className,qe.canvasWithSplitter),onPointerDown:Un=>{Un.shiftKey||Fe.clearSelection()},children:[(0,d.jsx)(Wa.c,{dashboard:Ie}),(0,d.jsx)("div",{className:(0,D.cx)(!ge&&qe.controlsWrapperSticky),children:he}),(0,d.jsx)("div",{className:qe.bodyWrapper,children:(0,d.jsx)("div",{className:(0,D.cx)(qe.body,ge&&qe.bodyEditing),ref:Pn,children:Le})})]}),ge&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{...Kt,className:(0,D.cx)(Kt.className,qe.splitter),"data-edit-pane-splitter":!0}),(0,d.jsx)("div",{...Lt,className:(0,D.cx)(Lt.className,qe.editPane),children:(0,d.jsx)(le,{editPane:Fe,isCollapsed:nt,onToggleCollapse:dn,openOverlay:Gt.selected.length>0})})]})]})})}function _r(Ie,ge){return{canvasWrappperOld:(0,D.css)({label:"canvas-wrapper-old",display:"flex",flexDirection:"column",flexGrow:1}),canvasWithSplitter:(0,D.css)({overflow:"unset",display:"flex",flexDirection:"column",flexGrow:1}),canvasWithSplitterEditing:(0,D.css)({overflow:"unset"}),bodyWrapper:(0,D.css)({label:"body-wrapper",display:"flex",flexDirection:"column",flexGrow:1,position:"relative"}),body:(0,D.css)({label:"body",display:"flex",flexGrow:1,gap:"8px",boxSizing:"border-box",flexDirection:"column",padding:Ie.spacing(0,2,2,2)}),bodyEditing:(0,D.css)({position:"absolute",left:0,top:0,right:0,bottom:0,overflow:"auto",scrollbarWidth:"thin",paddingTop:"2px",paddingRight:Ie.spacing(1)}),editPane:(0,D.css)({flexDirection:"column"}),splitter:(0,D.css)({"&:after":{display:"none"}}),controlsWrapperSticky:(0,D.css)({[Ie.breakpoints.up("md")]:{position:"sticky",zIndex:Ie.zIndex.activePanel,background:Ie.colors.background.canvas,top:ge}})}}var rr=e(46942),or=e.n(rr),Is=e(1131),Za=e(39765);const ss="--panels-per-row";function Qr({dashboard:Ie,panelSearch:ge="",panelsPerRow:Le}){const{body:he}
171=Ie.state,Ae=[],Fe=(0,v.of)(Yr),[qe,nt]=(0,W.useState)(""),ot=he instanceof Is.D?he.state.grid:null;if(!ot)return(0,d.jsx)(T.x6,{i18nKey:"panel-search.unsupported-layout",children:"Unsupported layout"});for(const ut of ot.state.children)if(ut instanceof V.U)Cr(ut,Ie,ge,Ae,nt);else if(ut instanceof m.tI)for(const Ct of ut.state.children)Ct instanceof V.U&&Cr(Ct,Ie,ge,Ae,nt);return Ae.length>0?(0,d.jsx)("div",{className:or()(Fe.grid,{[Fe.perRow]:Le!==void 0}),style:{[ss]:Le},children:Ae.map(ut=>(0,d.jsx)(kr,{panel:ut},ut.state.key))}):(0,d.jsx)("p",{className:Fe.noHits,children:(0,d.jsx)(T.x6,{i18nKey:"panel-search.no-matches",children:"No matches found"})})}function kr({panel:Ie}){return(0,W.useEffect)(()=>{const ge=(0,K.zo)(Ie);return()=>{ge?.()}},[Ie]),(0,d.jsx)(Ie.Component,{model:Ie})}function Yr(Ie){return{grid:(0,D.css)({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(400px, 1fr))",gap:Ie.spacing(1),gridAutoRows:"320px"}),perRow:(0,D.css)({gridTemplateColumns:`repeat(var(${ss}, 3), 1fr)`}),noHits:(0,D.css)({display:"grid",placeItems:"center"})}}function Cr(Ie,ge,Le,he,Ae){const Fe=m.jh.interpolate(ge,Le).toLowerCase();if(Ie.state.variableName&&!Ie.isActive){const nt=Ie.state.body;nt.interpolate(nt.state.title,void 0,"text").toLowerCase().includes(Fe)&&(Ie.subscribeToEvent(Za.d,ut=>{ut.payload.source instanceof V.U&&Ae(ut.payload.source.state.key??"")}),Ie.activate())}const qe=Ie.state.repeatedPanels??[Ie.state.body];for(const nt of qe)nt.interpolate(nt.state.title,void 0,"text").toLowerCase().includes(Fe)&&he.push(nt);return he}function Jr({model:Ie}){const{controls:ge,overlay:Le,editview:he,editPanel:Ae,viewPanelScene:Fe,panelSearch:qe,panelsPerRow:nt,isEditing:ot,scopesBridge:ut,layoutOrchestrator:Ct}=Ie.useState(),{type:Lt}=(0,Nt.g)(),Kt=(0,Nt.zy)(),zt=(0,_e.useSelector)(jn=>jn.navIndex),dn=Ie.getPageNav(Kt,zt),Gt=Ie.getBodyToRender(),rn=(0,f.tc)(zt,`dashboards/${Lt==="snapshot"?"snapshots":"browse"}`),Pn=he!==void 0;if((0,W.useMemo)(()=>{(Fe||Pn||Ae)&&Ie.rememberScrollPos()},[Pn,Ae,Fe,Ie]),(0,W.useEffect)(()=>{!Fe&&!Pn&&!Ae&&Ie.restoreScrollPos()},[Pn,Ae,Fe,Ie]),he)return(0,d.jsxs)(d.Fragment,{children:[ut&&(0,d.jsx)(ut.Component,{model:ut}),(0,d.jsx)(he.Component,{model:he}),Le&&(0,d.jsx)(Le.Component,{model:Le})]});function Un(){return!Fe&&(qe||nt)?(0,d.jsx)(Qr,{panelSearch:qe,panelsPerRow:nt,dashboard:Ie}):(0,d.jsx)(Gt.Component,{model:Gt})}return(0,d.jsxs)(d.Fragment,{children:[Ct&&(0,d.jsx)(Ct.Component,{model:Ct}),(0,d.jsxs)(Ya.Y,{navModel:rn,pageNav:dn,layout:ka.k.Custom,children:[ut&&(0,d.jsx)(ut.Component,{model:ut}),Ae&&(0,d.jsx)(Ae.Component,{model:Ae}),!Ae&&(0,d.jsx)(Gr,{dashboard:Ie,isEditing:ot,controls:ge&&(0,d.jsx)(ge.Component,{model:ge}),body:Un()}),Le&&(0,d.jsx)(Le.Component,{model:Le})]})]})}var Mr=e(14252),rs=e(61215),os=e(26689),Xr=e(991),_s=e(89640),Ks=e(68079),Qs=e(18857),$a=e(15130),Sr=e(55386),Tr=e(5114),dt=e(77154),Ut=e(739),kt=e(28105),on=e(8095),pn=e(34273);function Tn(Ie){const ge=[];if(Ie?.series)for(const Le of Ie.series)ge.push((0,dt.Nw)(Le));if(Ie?.annotations)for(const Le of Ie.annotations){const he=(0,dt.Nw)(Le);he.schema?.meta||(he.schema.meta={}),he.schema.meta.dataTopic=Ut.QR.Annotations,ge.push(he)}return ge}function Kn(Ie,ge){const Le={panelType:Ie.state.pluginId,datasource:"??"},he=r.$.buildInfo.versionString;let Ae=`| Key | Value | 172|--|--| 173| Panel | ${Le.panelType} @ ${Ie.state.pluginVersion??he} | 174| Grafana | ${he} // ${r.$.buildInfo.edition} | 175`;return ge&&(Ae+="<details><summary>Panel debug snapshot dashboard</summary>\n\n```json\n"+ge+"\n```\n</details>"),Ae}async function Mn(Ie,ge,Le){let he={type:""};const Ae=Ie.parent;(0,K.ME)(Ie)?he={...(0,En.ZB)(Ae),...(0,En.Z6)(Ie)}:he=(0,En.ZB)(Ae);const Fe=(0,A.cloneDeep)(va),qe={panelType:Ie.state.pluginId,datasource:"??"},nt=(0,K.un)(Ie);if(!nt.state.data)return;const ot=nt.state.data,ut=nt?.state.datasource,Ct=(0,pn.W)(Tn(ot),ge),Lt=r.$.buildInfo.versionString,Kt=nt.state.queries??[],zt=ot.annotations?ot.annotations.reduce((Gt,rn)=>rn.length+Gt,0):0,dn=`<table width="100%"> 176 <tr> 177 <th width="2%">Panel</th> 178 <td >${qe.panelType} @ ${he.pluginVersion??Lt}</td> 179 </tr> 180 <tr> 181 <th>Queries</th> 182 <td>${Kt.map(Gt=>{const rn=Gt.datasource??ut;return`${Gt.refId}[${rn?.type}]`}).join(", ")}</td> 183 </tr> 184 ${Jn(he)} 185 ${pa(ot,Ct)} 186 ${ia(ot)} 187 <tr> 188 <th>Grafana</th> 189 <td>${Lt} // ${r.$.buildInfo.edition}</td> 190 </tr> 191 </table>`.trim();if(Fe.panels[0]={...he,...Fe.panels[0],targets:[{refId:"A",datasource:{type:"grafana",uid:"grafana"},queryType:on.nj.Snapshot,snapshot:Ct}]},delete Fe.panels[0].libraryPanel,he.transformations?.length){const Gt=Fe.panels[Fe.panels.length-1];Gt.title=Gt.title+" (after transformations)";const rn=(0,A.cloneDeep)(Gt);rn.id=100,rn.title="Data (before transformations)",rn.gridPos.w=24,rn.targets[0].withTransforms=!1,Fe.panels.push(rn)}return zt>0&&Fe.panels.push({id:7,gridPos:{h:6,w:24,x:0,y:20},type:"table",title:"Annotations",datasource:{type:"datasource",uid:"-- Dashboard --"},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,topic:Ut.QR.Annotations,refId:"A"}]}),Fe.panels[1].options.content=dn,Fe.panels[2].options.content=JSON.stringify(he,null,2),Fe.title=`Debug: ${he.title} // ${(0,_n.LE)(new Date)}`,Fe.tags=["debug",`debug-${qe.panelType}`],Fe.time={from:Le.from.toISOString(),to:Le.to.toISOString()},Fe}function Jn(Ie){return Ie.transformations?`<tr> 192 <th>Transform</th> 193 <td>${Ie.transformations.map(ge=>ge.id).join(", ")}</td> 194 </tr>`:""}function pa(Ie,ge){let Le=Ie.series.length??0,he=0,Ae=0;for(const Fe of Ie.series)he+=Fe.fields.length,Ae+=Fe.length;return`<tr><th>Data</th><td>${Ie.state!==kt.Gu.Done?Ie.state:""} ${Le} frames, ${he} fields, ${Ae} rows </td></tr>`}function ia(Ie){return Ie.annotations?.length?`<tr> 195 <th>Annotations</th> 196 <td>${Ie.annotations.reduce((ge,Le)=>Le.length+ge,0)}</td> 197</tr>`:""}const va={panels:[{id:2,title:"Reproduced with embedded data",datasource:{type:"grafana",uid:"grafana"},gridPos:{h:13,w:15,x:0,y:0}},{gridPos:{h:7,w:9,x:15,y:0},id:5,options:{content:"...",mode:"html"},title:"Debug info",type:"text"},{id:6,title:"Original Panel JSON",type:"text",gridPos:{h:13,w:9,x:15,y:7},options:{content:"...",mode:"code",code:{language:"json",showLineNumbers:!0,showMiniMap:!0}}},{id:3,title:"Data from panel above",type:"table",datasource:{type:"datasource",uid:"-- Dashboard --"},gridPos:{h:7,w:15,x:0,y:13},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,refId:"A"}]}],schemaVersion:37};var Ba=(Ie=>(Ie[Ie.Support=0]="Support",Ie[Ie.Data=1]="Data",Ie))(Ba||{}),us=(Ie=>(Ie[Ie.PanelSnapshot=0]="PanelSnapshot",Ie[Ie.GithubComment=1]="GithubComment",Ie))(us||{});class ks extends Tr.Q{constructor(ge){super({panel:ge,panelTitle:m.jh.interpolate(ge,ge.state.t
197itle,{},"text"),currentTab:0,showMessage:1,snapshotText:"",markdownText:"",randomize:{},snapshotUpdate:0,options:[{label:"GitHub comment",description:"Copy and paste this message into a GitHub issue or comment",value:1},{label:"Panel support snapshot",description:"Dashboard JSON used to help troubleshoot visualization issues",value:0}]}),this.onCurrentTabChange=Le=>{this.setState({currentTab:Le})},this.onShowMessageChange=Le=>{this.setState({showMessage:Le.value})},this.onGetMarkdownForClipboard=()=>{const{markdownText:Le}=this.state,he=Math.pow(1024,2)*1.5;return Le.length>he?(this.setState({error:{title:"Copy to clipboard failed",message:"Snapshot is too large, consider download and attaching a file instead"}}),""):Le},this.onDownloadDashboard=()=>{const{snapshotText:Le,panelTitle:he}=this.state,Ae=new Blob([Le],{type:"text/plain"}),Fe=`debug-${he}-${(0,_n.LE)(new Date)}.json.txt`;nn()(Ae,Fe)},this.onSetSnapshotText=Le=>{this.setState({snapshotText:Le})},this.onToggleRandomize=Le=>{const{randomize:he}=this.state;this.setState({randomize:{...he,[Le]:!he[Le]}})}}async buildDebugDashboard(){const{panel:ge,randomize:Le,snapshotUpdate:he}=this.state,Ae=await Mn(ge,Le,m.jh.getTimeRange(ge).state.value),Fe=JSON.stringify(Ae,null,2),qe=Kn(ge,Fe),nt=(0,Sr.cN)((0,Sr.j_)("bytes")(Fe?.length??0));let ot;if(Ae)try{ot=(0,Sn.wM)({dashboard:Ae,meta:{isEmbedded:!0}}).state.body}catch(ut){console.log("Error creating scene:",ut)}this.setState({snapshot:Ae,snapshotText:Fe,markdownText:qe,snapshotSize:nt,snapshotUpdate:he+1,scene:ot})}}function pi({panel:Ie,onClose:ge}){const Le=(0,v.of)(gi),he=(0,W.useMemo)(()=>new ks(Ie),[Ie]),Ae=Ie.getPlugin(),{currentTab:Fe,loading:qe,error:nt,options:ot,showMessage:ut,snapshotSize:Ct,markdownText:Lt,snapshotText:Kt,randomize:zt,panelTitle:dn,scene:Gt}=he.useState();if((0,W.useEffect)(()=>{he.buildDebugDashboard()},[he,Ae,zt]),!Ae)return null;const rn=[{label:"Snapshot",value:Ba.Support},{label:"Data",value:Ba.Data}],Pn=r.$.supportBundlesEnabled&&$a.TP.hasPermission(_e.AccessControlAction.ActionSupportBundlesCreate);return(0,d.jsxs)(Ce._,{title:(0,T.t)("dashboard-scene.help-wizard.title-get-help-with-this-panel","Get help with this panel"),size:"lg",onClose:ge,subtitle:(0,d.jsxs)(j.B,{direction:"column",gap:1,children:[(0,d.jsxs)(j.B,{direction:"row",gap:1,children:[(0,d.jsx)(Xr.y,{featureState:n.Ay.beta}),(0,d.jsx)(_s.Y,{href:"https://grafana.com/docs/grafana/latest/troubleshooting/",external:!0,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.help-wizard.troubleshooting-docs",children:"Troubleshooting docs"})})]}),(0,d.jsx)("span",{className:"muted",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.help-wizard.troubleshooting-request-help",children:"To request troubleshooting help, send a snapshot of this panel to Grafana Labs Technical Support. The snapshot contains query response data and panel settings."})}),Pn&&(0,d.jsx)("span",{className:"muted",children:(0,d.jsxs)(T.x6,{i18nKey:"dashboard-scene-help-wizard.support-bundle",children:["You can also retrieve a support bundle containing information concerning your Grafana instance and configured datasources in the ",(0,d.jsx)(_s.Y,{href:"/support-bundles",children:"support bundles section"}),"."]})})]}),tabs:(0,d.jsx)(Te.U,{children:rn.map((Un,jn)=>(0,d.jsx)(Ne.o,{label:Un.label,active:Un.value===Fe,onChangeTab:()=>he.onCurrentTabChange(Un.value)},`${Un.value}-${jn}`))}),children:[qe&&(0,d.jsx)(Ks.y,{}),nt&&(0,d.jsx)(Ve.F,{title:nt.title,children:nt.message}),Fe===Ba.Data&&(0,d.jsxs)("div",{className:Le.code,children:[(0,d.jsxs)("div",{className:Le.opts,children:[(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.help-wizard.label-template","Template"),className:Le.field,children:(0,d.jsx)(Qs.l6,{options:ot,value:ut,onChange:he.onShowMessageChange})}),ut===us.GithubComment?(0,d.jsx)(ft.b,{icon:"copy",getText:he.onGetMarkdownForClipboard,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.help-wizard.copy-to-clipboard",children:"Copy to clipboard"})}):(0,d.jsx)(Q.$n,{icon:"download-alt",onClick:he.onDownloadDashboard,children:(0,d.jsxs)(T.x6,{i18nKey:"dashboard-scene.help-wizard.download-snapshot",children:["Download (",{snapshotSize:Ct},")"]})})]}),(0,d.jsx)(Zt.default,{disableWidth:!0,children:({height:Un})=>(0,d.jsx)(tn.B,{width:"100%",height:Un,language:ut===us.GithubComment?"markdown":"json",showLineNumbers:!0,showMiniMap:!0,value:ut===us.GithubComment?Lt:Kt,readOnly:!1,onBlur:he.onSetSnapshotText})})]}),Fe===Ba.Support&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.help-wizard.label-randomize-data","Randomize data"),description:(0,T.t)("dashboard-scene.help-wizard.description-randomize-data","Modify the original data to hide sensitive information. Note the lengths will stay the same, and duplicate values will be equal."),children:(0,d.jsxs)(j.B,{children:[(0,d.jsx)(Ye.K,{label:(0,T.t)("dashboard-scene.help-wizard.randomize-labels-label-labels","Labels"),id:"randomize-labels",showLabel:!0,value:!!zt.labels,onChange:()=>he.onToggleRandomize("labels")}),(0,d.jsx)(Ye.K,{label:(0,T.t)("dashboard-scene.help-wizard.randomize-field-names-label-field-names","Field names"),id:"randomize-field-names",showLabel:!0,value:!!zt.names,onChange:()=>he.onToggleRandomize("names")}),(0,d.jsx)(Ye.K,{label:(0,T.t)("dashboard-scene.help-wizard.randomize-string-values-label-string-values","String values"),id:"randomize-string-values",showLabel:!0,value:!!zt.values,onChange:()=>he.onToggleRandomize("values")})]})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.help-wizard.label-support-snapshot","Support snapshot"),description:(0,T.t)("dashboard-scene.help-wizard.description-support-snapshot","Panel: {{panelTitle}}",{panelTitle:dn}),children:(0,d.jsxs)(j.B,{children:[(0,d.jsx)(Q.$n,{icon:"download-alt",onClick:he.onDownloadDashboard,children:(0,d.jsxs)(T.x6,{i18nKey:"dashboard-scene.help-wizard.download-dashboard",children:["Dashboard (",{snapshotSize:Ct},")"]})}
197),(0,d.jsx)(ft.b,{icon:"github",getText:he.onGetMarkdownForClipboard,title:(0,T.t)("dashboard-scene.help-wizard.title-complete-git-hub-comment-clipboard","Copy a complete GitHub comment to the clipboard"),children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.help-wizard.copy-to-clipboard",children:"Copy to clipboard"})})]})}),(0,d.jsx)("div",{style:{height:"100%",overflow:"auto",display:"flex"},children:Gt&&(0,d.jsx)(Gt.Component,{model:Gt})})]})]})}const gi=Ie=>({code:(0,D.css)({flexGrow:1,height:"100%",overflow:"scroll"}),field:(0,D.css)({width:"100%"}),opts:(0,D.css)({display:"flex",width:"100%",flexGrow:0,alignItems:"center",justifyContent:"flex-end","& button":{marginLeft:Ie.spacing(1)}})});var Aa=e(42836);class Oo extends m.Bs{constructor(ge){super({...ge,options:{withTransforms:!1,withFieldConfig:!0}}),this.onOptionsChange=Le=>{this.setState({options:Le})}}getTabLabel(){return(0,T.t)("dashboard.inspect.data-tab","Data")}getTabValue(){return os.q.Data}static{this.Component=({model:ge})=>{const{options:Le}=ge.useState(),he=ge.state.panelRef.resolve(),Ae=m.jh.getData(he),{data:Fe}=mi(Ae,Le.withTransforms).useState(),qe=m.jh.getTimeRange(he);return Fe||T.x6,(0,d.jsx)(Aa.q,{isLoading:Fe?.state===kt.Gu.Loading,data:Fe?.series,options:Le,hasTransformations:Io(Ae),timeZone:qe.getTimeZone(),panelPluginId:he.state.pluginId,dataName:m.jh.interpolate(he,he.state.title),fieldConfig:he.state.fieldConfig,onOptionsChange:ge.onOptionsChange})}}}function Io(Ie){return Ie instanceof m.Es?Ie.state.transformations.length>0:!1}function mi(Ie,ge){return!ge&&Ie instanceof m.Es&&Ie.state.$data?Ie.state.$data:Ie}var Ro=e(98314),vi=e(89460),Ao=e(8419),Rs=e(67497);class xa extends m.Bs{constructor(ge){super({...ge,source:"panel-json",jsonText:Lo("panel-json",ge.panelRef.resolve())}),this.onChangeSource=Le=>{this.setState({source:Le.value,jsonText:Lo(Le.value,this.state.panelRef.resolve())})},this.onApplyChange=()=>{const Le=this.state.panelRef.resolve(),he=(0,K.YQ)(Le),Ae=JSON.parse(this.state.jsonText),Fe=new g.a9(Ae),qe=(0,Sn.tt)(Fe),nt=m.Go.cloneSceneObjectState(qe.state);if(!(Le.parent instanceof V.U)){console.error("Cannot update state of panel",Le,qe);return}this.state.onClose(),he.state.isEditing||he.onEnterEditMode(),Le.parent.setState(nt),(0,Rs.B9)(os.q.JSON,"apply",{panel_type_changed:Le.state.pluginId!==Fe.type,panel_id_changed:(0,K.Cs)(Le)!==Fe.id,panel_grid_pos_changed:Ei(Le.parent.state,nt),panel_targets_changed:Ga((0,K.un)(Le),(0,K.un)(nt.$data))})},this.onCodeEditorBlur=Le=>{this.setState({jsonText:Le})}}getTabLabel(){return(0,T.t)("dashboard.inspect.json-tab","JSON")}getTabValue(){return os.q.JSON}getOptions(){const ge=this.state.panelRef.resolve(),Le=ge.state.$data??ge.parent?.state.$data,he=[{label:(0,T.t)("dashboard.inspect-json.panel-json-label","Panel JSON"),description:(0,T.t)("dashboard.inspect-json.panel-json-description","The model saved in the dashboard JSON that configures how everything works."),value:"panel-json"}];return Le&&(he.push({label:(0,T.t)("dashboard.inspect-json.panel-data-label","Panel data"),description:(0,T.t)("dashboard.inspect-json.panel-data-description","The raw model passed to the panel visualization"),value:"panel-data"}),he.push({label:(0,T.t)("dashboard.inspect-json.dataframe-label","DataFrame JSON (from Query)"),description:(0,T.t)("dashboard.inspect-json.dataframe-description","Raw data without transformations and field config applied. "),value:"data-frames"})),he}isEditable(){if(this.state.source!=="panel-json")return!1;const ge=this.state.panelRef.resolve();return(0,K.ME)(ge)||(0,It.aK)((0,K.YQ)(ge).getSaveModel())||ge.parent instanceof V.U&&ge.parent.isRepeated()?!1:(0,K.YQ)(ge).state.meta.canEdit}static{this.Component=({model:ge})=>{const{source:Le,jsonText:he}=ge.useState(),Ae=(0,v.of)(vi.A),Fe=ge.getOptions();return(0,d.jsxs)("div",{className:Ae.wrap,children:[(0,d.jsxs)("div",{className:Ae.toolbar,"data-testid":Re.Tp.components.PanelInspector.Json.content,children:[(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard.inspect-json.select-source","Select source"),className:"flex-grow-1",children:(0,d.jsx)(Qs.l6,{inputId:"select-source-dropdown",options:Fe,value:Fe.find(qe=>qe.value===Le)??Fe[0].value,onChange:ge.onChangeSource})}),ge.isEditable()&&(0,d.jsx)(Q.$n,{className:Ae.toolbarItem,onClick:ge.onApplyChange,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.inspect-json-tab.apply",children:"Apply"})})]}),(0,d.jsx)("div",{className:Ae.content,children:(0,d.jsx)(Zt.default,{disableWidth:!0,children:({height:qe})=>(0,d.jsx)(tn.B,{width:"100%",height:qe,language:"json",showLineNumbers:!0,showMiniMap:he.length>100,value:he,readOnly:!ge.isEditable(),onBlur:ge.onCodeEditorBlur})})})]})}}}function Lo(Ie,ge){let Le={};switch(Ie){case"panel-json":{(0,Rs.B9)(os.q.JSON,"panelData");const he=(0,K.ME)(ge),Ae=ge.parent;if(he){Le=yi(ge);break}if((0,It.aK)((0,K.YQ)(ge).getSaveModel())){Le=(0,zn.GB)(ge);break}else Ae instanceof V.U&&(Le=(0,En.ZB)(Ae));break}case"panel-data":{(0,Rs.B9)(os.q.JSON,"panelJSON");const he=m.jh.getData(ge);he.state.data&&(Le=ge.applyFieldConfig(he.state.data));break}case"data-frames":{(0,Rs.B9)(os.q.JSON,"dataFrame");const he=m.jh.getData(ge);he.state.data&&(he instanceof m.Es&&he.state.$data?.state.data?Le=(0,Ro.B6)(he.state.$data.state.data):Le=(0,Ro.B6)(he.state.data))}}return(0,Ao.p)(Le)}function yi(Ie){if(!(0,K.ME)(Ie))throw"Panel not a library panel";const ge=Ie.parent;if(!(ge instanceof V.U))throw"LibraryPanel not child of DashboardGridItem";const Le={x:ge.state.x||0,y:ge.state.y||0,h:ge.state.height||0,w:ge.state.width||0},he=xi(Ie),Ae=(0,En.Z6)(Ie.clone({$behaviors:void 0}),Le,!1,ge);return{libraryPanel:{...he},...Ae}}function xi(Ie){if(!(0,K.ME)(Ie))throw new Error("Panel not a Library panel");const ge=(0,K.iL)(Ie);if(!ge)throw new Error("Library panel behavior not found");if(!ge.state._loadedPanel)throw new Error("Library panel not loaded");return ge.state._loadedPanel}function Ei(Ie,ge){return Ie.x!==ge.x||Ie.y!==ge.y||Ie.width!==ge.width||Ie.height!==ge.height}function Ga(Ie,ge){return Ie===void 0||ge===void 0?!1:!(0,A.isEqual)(Ie.state.queries,ge.state.queries)}class Pi extends m.Bs{getTabLabel(){return(0,T.t)("dashboard.inspect.meta-tab","Meta data")}getTabValue(){return os.q.Meta}static{this.Component=({model:ge})=>{const{panelRef:Le,dataSource:he}=ge.state,Ae=m.jh.getData(Le.resolve()),Fe=he.components?.MetadataInspector;return!Ae.state.data||!Fe?null:(0,d.jsx)(Fe,{datasource:he,data:Ae.state.data.series})}}}var Di=e(96065);class bi extends m.Bs{constructor(){super(...arguments),this.onRefreshQuery=()=>{const ge=(0,K.un)(this.state.panelRef.resolve());ge&&ge.runQueries()}}getTabLabel(){return(0,T.t)("dashboard.inspect.query-tab","Query")}getTabValue(){return os.q.Query}static{this.Component=({model:ge})=>{const Le=m.jh.getData(ge.state.panelRef.resolve()).useState();return Le.data?(0,d.jsx)(Di.e,{data:Le.data,onRefreshQuery:ge.onRefreshQuery}):null}}}var Ci=e(55072);class Zr extends m.Bs{getTabLabel(){return(0,T.t)("dashboard.inspect.stats-tab","Stats")}
197getTabValue(){return os.q.Stats}static{this.Component=({model:ge})=>{const Le=m.jh.getData(ge.state.panelRef.resolve()).useState(),he=m.jh.getTimeRange(ge.state.panelRef.resolve());return Le.data?(0,d.jsx)(Ci.N,{data:Le.data,timeZone:he.getTimeZone()}):null}}}class jo extends m.Bs{constructor(ge){super(ge),this.onClose=()=>{Mi((0,K.YQ)(this))},this.addActivationHandler(()=>this._activationHandler())}static{this.Component=Bo}_activationHandler(){this.buildTabs(0)}async buildTabs(ge){const Le=this.state.panelRef,he=Le.resolve()?.getPlugin(),Ae=[];if(he||(ge<2e3?setTimeout(()=>this.buildTabs(ge+100),100):this.setState({pluginNotLoaded:!0})),Le){if((0,rs.$)(he)){const Fe=m.jh.getData(Le.resolve());Ae.push(new Oo({panelRef:Le})),Ae.push(new Zr({panelRef:Le})),Ae.push(new bi({panelRef:Le}));const qe=await(0,Mr.BN)(Fe.state.data);qe&&Ae.push(new Pi({panelRef:Le,dataSource:qe}))}Ae.push(new xa({panelRef:Le,onClose:this.onClose}))}this.setState({tabs:Ae})}getDrawerTitle(){const ge=this.state.panelRef?.resolve();return ge?m.jh.interpolate(ge,`Inspect: ${ge.state.title}`):"Inspect panel"}}function Bo({model:Ie}){const{tabs:ge,pluginNotLoaded:Le,panelRef:he}=Ie.useState(),Ae=(0,Nt.zy)(),Fe=new URLSearchParams(Ae.search);if(!ge)return null;const qe=Fe.get("inspectTab"),nt=ge.find(ut=>ut.getTabValue()===qe)??ge[0],ot=he.resolve();return qe===os.q.Help?(0,d.jsx)(pi,{panel:ot,onClose:Ie.onClose}):(0,d.jsxs)(Ce._,{title:Ie.getDrawerTitle(),onClose:Ie.onClose,size:"md",tabs:(0,d.jsx)(Te.U,{children:ge.map(ut=>(0,d.jsx)(Ne.o,{label:ut.getTabLabel(),active:ut===nt,href:t.I.getUrlForPartial(Ae,{inspectTab:ut.getTabValue()})},ut.state.key))}),children:[Le&&(0,d.jsx)(Ve.F,{title:(0,T.t)("dashboard-scene.panel-inspect-renderer.title-panel-plugin-not-loaded","Panel plugin not loaded"),children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.panel-inspect-renderer.body-panel-plugin-not-loaded",children:"Make sure the panel you want to inspect is visible and has been displayed before opening inspect."})}),nt&&nt.Component&&(0,d.jsx)(nt.Component,{model:nt})]})}function Mi(Ie){const ge=Ie.state.meta,Le=!Ie.state.uid&&o.Ny.getLocation().pathname==="/dashboard/new";o.Ny.push((0,Fn.u)({uid:Ie.state.uid,slug:Ie.state.meta.slug,currentQueryParams:o.Ny.getLocation().search,updateQuery:{inspect:null,inspectTab:null},isHomeDashboard:!ge.url&&!ge.slug&&!Le}))}var qr=e(89451),ir=e(48480),za=e(78282),Uo=e(49e3);class eo{constructor(ge){this._scene=ge}getKeys(){return["editIndex"]}getUrlState(){const ge=this._scene.state;return{editIndex:ge.editIndex!==void 0?String(ge.editIndex):void 0}}updateFromUrl(ge){let Le={};typeof ge.editIndex=="string"?Le={editIndex:Number(ge.editIndex)}:Le={editIndex:void 0},Object.keys(Le).length>0&&this._scene.setState(Le)}}var Si=e(16817),No=e(16780),Wo=e(38669),Fo=e(76478),Ti=e(76792);const to="New annotation",no=({annotation:Ie,editIndex:ge,panels:Le,onUpdate:he,onBackToList:Ae,onDelete:Fe})=>{const qe=(0,v.of)(Oi),nt=(0,W.useMemo)(()=>Ie.filter?Ie.filter.exclude?2:1:0,[Ie.filter]),{value:ot}=(0,Si.A)(()=>(0,za.l)().get(Ie.datasource),[Ie.datasource]),ut=(0,za.l)().getInstanceSettings(Ie.datasource),Ct=Bn=>{he({...Ie,name:Bn.currentTarget.value},ge)},Lt=Bn=>{const Yn=(0,ir.p$)(Bn);Ie.datasource?.type!==Yn.type?he({datasource:Yn,builtIn:Ie.builtIn,enable:Ie.enable,iconColor:Ie.iconColor,name:Ie.name,hide:Ie.hide,filter:Ie.filter,mappings:Ie.mappings,type:Ie.type},ge):he({...Ie,datasource:Yn},ge)},Kt=Bn=>{const Yn=Bn.currentTarget;he({...Ie,[Yn.name]:Yn.type==="checkbox"?Yn.checked:Yn.value},ge)},zt=Bn=>{he({...Ie,iconColor:Bn},ge)},dn=Bn=>{let Yn=Bn.value===0?void 0:{exclude:Bn.value===2,ids:Ie.filter?.ids??[]};he({...Ie,filter:Yn},ge)},Gt=Bn=>{if(!Array.isArray(Bn))return;const Yn={exclude:nt===2,ids:[]};Bn.forEach(Pa=>Pa.value&&Yn.ids.push(Pa.value)),he({...Ie,filter:Yn},ge)},rn=()=>{Fe(ge),Ae()},Pn=Ie.name===to,Un=(Bn,Yn)=>Bn.label&&Yn.label?Bn.label.toLowerCase().localeCompare(Yn.label.toLowerCase()):-1,jn=(0,W.useMemo)(()=>Le.filter(Bn=>r.$.panels[Bn.state.pluginId]).map(Bn=>
197({value:(0,K.Cs)(Bn),label:Bn.state.title??`Panel ${(0,K.Cs)(Bn)}`,description:Bn.state.description,imgUrl:r.$.panels[Bn.state.pluginId].info.logos.small})).sort(Un)??[],[Le]);return(0,d.jsxs)("div",{children:[(0,d.jsxs)(No.n,{className:qe.settingsForm,children:[(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.annotation-settings-edit.label-name","Name"),children:(0,d.jsx)(je.p,{"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.Settings.name,name:"name",id:"name",autoFocus:Pn,value:Ie.name,onChange:Ct})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.annotation-settings-edit.label-data-source","Data source"),htmlFor:"data-source-picker",children:(0,d.jsx)(Ti.s,{annotations:!0,variables:!0,current:Ie.datasource,onChange:Lt})}),!ot?.meta.annotations&&(0,d.jsx)(Ve.F,{title:(0,T.t)("dashboard-scene.annotation-settings-edit.title-annotation-support-source","No annotation support for this data source"),severity:"error",children:(0,d.jsx)(T.x6,{i18nKey:"errors.dashboard-settings.annotations.datasource",children:"The selected data source does not support annotations. Please select a different data source."})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.annotation-settings-edit.label-enabled","Enabled"),description:(0,T.t)("dashboard-scene.annotation-settings-edit.description-enabled-annotation-query-issued-every-dashboard","When enabled the annotation query is issued every dashboard refresh"),children:(0,d.jsx)(Wn.S,{name:"enable",id:"enable",value:Ie.enable,onChange:Kt,"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.enable})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.annotation-settings-edit.label-hidden","Hidden"),description:(0,T.t)("dashboard-scene.annotation-settings-edit.description-hidden","Annotation queries can be toggled on or off at the top of the dashboard. With this option checked this toggle will be hidden."),children:(0,d.jsx)(Wn.S,{name:"hide",id:"hide",value:Ie.hide,onChange:Kt,"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.hide})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.annotation-settings-edit.label-color","Color"),description:(0,T.t)("dashboard-scene.annotation-settings-edit.description-color-annotation-event-markers","Color to use for the annotation event markers"),children:(0,d.jsx)(j.B,{children:(0,d.jsx)(Wo.a,{value:Ie?.iconColor,onChange:zt})})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-scene.annotation-settings-edit.label-show-in","Show in"),"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.showInLabel,children:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Qs.l6,{options:Or,value:nt,onChange:dn,"data-testid":Re.Tp.components.Annotations.annotationsTypeInput}
197),nt!==0&&(0,d.jsx)(Qs.KF,{options:jn,value:jn.filter(Bn=>Ie.filter?.ids.includes(Bn.value)),onChange:Gt,isClearable:!0,placeholder:(0,T.t)("dashboard-scene.annotation-settings-edit.placeholder-choose-panels","Choose panels"),width:100,closeMenuOnSelect:!1,className:qe.select,"data-testid":Re.Tp.components.Annotations.annotationsChoosePanelInput})]})})]}),(0,d.jsxs)(No.n,{children:[(0,d.jsx)("h3",{className:"page-heading",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.annotation-settings-edit.query",children:"Query"})}),ot?.annotations&&ut&&(0,d.jsx)(Fo.A,{datasource:ot,datasourceInstanceSettings:ut,annotation:Ie,onChange:Bn=>he(Bn,ge)})]}),(0,d.jsxs)(j.B,{children:[!Ie.builtIn&&(0,d.jsx)(Q.$n,{variant:"destructive",onClick:rn,"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.delete,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.annotation-settings-edit.delete",children:"Delete"})}),(0,d.jsx)(Q.$n,{variant:"secondary",onClick:Ae,"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.apply,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.annotation-settings-edit.back-to-list",children:"Back to list"})})]})]})},Oi=Ie=>({settingsForm:(0,D.css)({maxWidth:Ie.spacing(60),marginBottom:Ie.spacing(2)}),select:(0,D.css)({marginTop:"8px"})});var Ii=(Ie=>(Ie[Ie.AllPanels=0]="AllPanels",Ie[Ie.IncludePanels=1]="IncludePanels",Ie[Ie.ExcludePanels=2]="ExcludePanels",Ie))(Ii||{});const Or=[{label:"All panels",value:0,description:"Send the annotation data to all panels that support annotations"},{label:"Selected panels",value:1,description:"Send the annotations to the explicitly listed panels"},{label:"All panels except",value:2,description:"Do not send annotation data to the following panels"}];var Ri=e(44458),ao=e(50201),Ys=e(39302);const bl="Add annotation query",so=({annotations:Ie,onNew:ge,onEdit:Le,onMove:he,onDelete:Ae})=>{const Fe=(0,v.of)(Ai),qe=Ie.length===0||Ie.length===1&&Ie[0].builtIn,nt=ut=>ut.enable===!1?(0,d.jsxs)("em",{className:"muted",children:["(Disabled) \xA0 ",ut.name]}):ut.builtIn?(0,d.jsxs)("em",{className:"muted",children:[ut.name," \xA0 (Built-in)"]}):(0,d.jsx)(d.Fragment,{children:ut.name}),ot=(0,za.l)();return(0,d.jsxs)(j.B,{direction:"column",children:[Ie.length>0&&(0,d.jsx)("div",{className:Fe.table,children:(0,d.jsxs)("table",{role:"grid",className:"filter-table filter-table--hover",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.annotation-settings-list.query-name",children:"Query name"})}),(0,d.jsx)("th",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.annotation-settings-list.data-source",children:"Data source"})}),(0,d.jsx)("th",{colSpan:3})]})}),(0,d.jsx)("tbody",{"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.List.annotations,children:Ie.map((ut,Ct)=>(0,d.jsxs)("tr",{children:[ut.builtIn?(0,d.jsx)("td",{role:"gridcell",style:{width:"90%"},className:"pointer",onClick:()=>Le(Ct),children:(0,d.jsx)(Q.$n,{size:"sm",fill:"text",variant:"secondary",children:nt(ut)})}):(0,d.jsx)("td",{role:"gridcell",className:"pointer",onClick:()=>Le(Ct),children:(0,d.jsx)(Q.$n,{size:"sm",fill:"text",variant:"secondary",children:nt(ut)})}),(0,d.jsx)("td",{role:"gridcell",className:"pointer",onClick:()=>Le(Ct),children:ot.getInstanceSettings(ut.datasource)?.name||ut.datasource?.uid}),(0,d.jsx)("td",{role:"gridcell",style:{width:"1%"},children:Ct!==0&&(0,d.jsx)(ne.K,{name:"arrow-up",onClick:()=>he(Ct,ro.UP),tooltip:(0,T.t)("dashboard-scene.annotation-settings-list.tooltip-move-up","Move up")})}),(0,d.jsx)("td",{role:"gridcell",style:{width:"1%"},children:Ie.length>1&&Ct!==Ie.length-1?(0,d.jsx)(ne.K,{name:"arrow-down",onClick:()=>he(Ct,ro.DOWN),tooltip:(0,T.t)("dashboard-scene.annotation-settings-list.tooltip-move-down","Move down")}):null}),(0,d.jsx)("td",{role:"gridcell",style:{width:"1%"},children:!ut.builtIn&&(0,d.jsx)(Ri.e,{size:"sm",onConfirm:()=>Ae(Ct),"aria-label":(0,T.t)("dashboard-scene.annotation-settings-list.delete-aria-label",'Delete query with title "{{title}}"',{title:ut.name})})})]},`${ut.name}-${Ct}`))})]})}),qe&&(0,d.jsx)(j.B,{direction:"column",children:(0,d.jsxs)(ao.p,{variant:"call-to-action",button:(0,d.jsx)(Q.$n,{"data-testid":Re.Tp.components.CallToActionCard.buttonV2("Add annotation query"),icon:"comment-alt",onClick:ge,size:"lg",children:(0,d.jsx)(T.x6,{i18nKey:"annotations.empty-state.button-title",children:"Add annotation query"})}),message:(0,T.t)("annotations.empty-state.title","There are no custom annotation queries added yet"),children:[(0,d.jsx)(T.x6,{i18nKey:"annotations.empty-state.info-box-content",children:(0,d.jsx)("p",{children:"Annotations provide a way to integrate event data into your graphs. They are visualized as vertical lines and icons on all graph panels. When you hover over an annotation icon y
197ou can get event text & tags for the event. You can add annotation events directly from grafana by holding CTRL or CMD + click on graph (or drag region). These will be stored in Grafana's annotation database."})}),(0,d.jsxs)(T.x6,{i18nKey:"annotations.empty-state.info-box-content-2",children:["Checkout the"," ",(0,d.jsx)(_s.Y,{external:!0,href:"http://docs.grafana.org/reference/annotations/",children:"Annotations documentation"})," ","for more information."]})]})}),!qe&&(0,d.jsx)(Ys.d,{"data-testid":Re.Tp.pages.Dashboard.Settings.Annotations.List.addAnnotationCTAV2,onClick:ge,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.annotation-settings-list.new-query",children:"New query"})})]})},Ai=()=>({table:(0,D.css)({width:"100%",overflowX:"auto"})});var ro=(Ie=>(Ie[Ie.UP=-1]="UP",Ie[Ie.DOWN=1]="DOWN",Ie))(ro||{});class Li extends m.Bs{constructor(){super(...arguments),this._urlSync=new eo(this),this.getDataSourceRefForAnnotation=()=>{const ge=(0,za.l)().getInstanceSettings(null);if(!ge||!ge.meta.annotations){console.error("Default datasource does not support annotations");return}return(0,ir.p$)(ge)},this.onNew=async()=>{const ge={name:to,enable:!0,datasource:this.getDataSourceRefForAnnotation(),iconColor:"red"},Le=new Uo.g({query:ge,name:ge.name,isEnabled:!!ge.enable,isHidden:!!ge.hide}),he=Qn.b4.getDataLayers(this._dashboard);he.addAnnotationLayer(Le),this.setState({editIndex:he.state.annotationLayers.length-1})},this.onEdit=ge=>{this.setState({editIndex:ge})},this.onBackToList=()=>{this.setState({editIndex:void 0})},this.onMove=(ge,Le)=>{const he=Qn.b4.getDataLayers(this._dashboard),Ae=[...he.state.annotationLayers],[Fe]=Ae.splice(ge,1);Ae.splice(ge+Le,0,Fe),he.setState({annotationLayers:Ae})},this.onDelete=ge=>{const Le=Qn.b4.getDataLayers(this._dashboard),he=[...Le.state.annotationLayers];he.splice(ge,1),Le.setState({annotationLayers:he})},this.onUpdate=(ge,Le)=>{const he=this.getDataLayer(Le);he.setState({name:ge.name,isEnabled:!!ge.enable,isHidden:!!ge.hide,query:ge}),he.runLayer()}}static{this.Component=lr}getUrlKey(){return"annotations"}get _dashboard(){return(0,K.YQ)(this)}getDataLayer(ge){const he=Qn.b4.getDataLayers(this._dashboard).state.annotationLayers[ge];if(!(he instanceof m.tV.g))throw new Error("AnnotationsDataLayer not found at index "+ge);return he}getDashboard(){return this._dashboard}}function lr({model:Ie}){const ge=Ie.getDashboard(),{annotationLayers:Le}=Qn.b4.getDataLayers(ge).useState(),{navModel:he,pageNav:Ae}=Ss(ge,Ie.getUrlKey()),{editIndex:Fe}=Ie.useState(),qe=Qn.b4.getVizPanels(ge),nt=(0,Xn.O)(Le);return Fe!=null&&Fe<Le.length?(0,d.jsx)(cr,{annotationLayer:Ie.getDataLayer(Fe),pageNav:Ae,panels:qe,editIndex:Fe,navModel:he,dashboard:ge,onUpdate:Ie.onUpdate,onBackToList:Ie.onBackToList,onDelete:Ie.onDelete}):(0,d.jsxs)(Ya.Y,{navModel:he,pageNav:Ae,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:ge}),(0,d.jsx)(so,{annotations:nt,onNew:Ie.onNew,onEdit:Ie.onEdit,onDelete:Ie.onDelete,onMove:Ie.onMove})]})}function cr({annotationLayer:Ie,pageNav:ge,navModel:Le,panels:he,editIndex:Ae,dashboard:Fe,onUpdate:qe,onBackToList:nt,onDelete:ot}){const{name:ut,query:Ct}=Ie.useState(),Lt={text:ut,parentItem:ge};return(0,d.jsxs)(Ya.Y,{navModel:Le,pageNav:Lt,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:Fe}),(0,d.jsx)(no,{annotation:Ct,editIndex:Ae,panels:he,onUpdate:qe,onBackToList:nt,onDelete:ot})]})}var Ko=e(46635),wo=e(39468),ji=e(88898),Vo=e(86871);class Bi extends m.Bs{constructor(){super(...arguments),this._urlSync=new eo(this),this.onNewLink=()=>{this.links=[...this.links,Vo.q],this.setState({editIndex:this.links.length-1})},this.onDelete=ge=>{this.links=[...this.links.slice(0,ge),...this.links.slice(ge+1)],this.setState({editIndex:void 0})},this.onDuplicate=ge=>{this.links=[...this.links,{...ge}]},this.onOrderChange=(ge,Le)=>{this.links=Ko.moveItemImmutably(this.links,ge,ge+Le)},this.onEdit=ge=>{this.setState({editIndex:ge})},this.onUpdateLink=ge=>{const Le=this.state.editIndex;Le!==void 0&&(this.links=[...this.links.slice(0,Le),ge,...this.links.slice(Le+1)])},this.onGoBack=()=>{this.setState({editIndex:void 0})}}static{this.Component=Ui}getUrlKey(){return"links"}get dashboard(){return(0,K.YQ)(this)}get links(){return this.dashboard.state.links}set links(ge){this.dashboard.setState({links:ge})}}function Ui({model:Ie}){const{editIndex:ge}=Ie.useState(),Le=(0,K.YQ)(Ie),{links:he}=Le.useState(),{navModel:Ae,pageNav:Fe}=Ss(Le,Ie.getUrlKey()),qe=ge!==void 0?he[ge]:void 0;return qe?(0,d.jsx)(Ni,{pageNav:Fe,navModel:Ae,link:qe,dashboard:Le,onChange:Ie.onUpdateLink,onGoBack:Ie.onGoBack}):(0,d.jsxs)(Ya.Y,{navModel:Ae,pageNav:Fe,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:Le}),(0,d.jsx)(ji.X,{links:he,onNew:Ie.onNewLink,onEdit:Ie.onEdit,onDelete:Ie.onDelete,onDuplicate:Ie.onDuplicate,onOrderChange:Ie.onOrderChange})]})}function Ni({pageNav:Ie,link:ge,navModel:Le,dashboard:he,onChange:Ae,onGoBack:Fe}){const qe={text:"Edit link",parentItem:Ie};return(0,d.jsxs)(Ya.Y,{navModel:Le,pageNav:qe,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:he}),(0,d.jsx)(wo.d,{link:ge,onUpdate:Ae,onGoBack:Fe})]})}var $o=e(10928),zo=e(74475),Ho=e(56291),Go=e(42357),Wi=e(70969),Fi=e(75570),oo=e(22351);const Ki=[{label:"Editable",value:!0},{label:"Read-only",value:!1}],Ir=[{value:0,label:"Default"},{value:1,label:"Shared crosshair"},{value:2,label:"Shared Tooltip"}];class _o extends m.Bs{constructor(){super(...arguments),this.onTitleChange=ge=>{this._dashboard.setState({title:ge})},this.onDescriptionChange=ge=>
197{this._dashboard.setState({description:ge})},this.onTagsChange=ge=>{this._dashboard.setState({tags:ge})},this.onFolderChange=async(ge,Le)=>{const he={...this._dashboard.state.meta,folderUid:ge||this._dashboard.state.meta.folderUid,folderTitle:Le||this._dashboard.state.meta.folderTitle};he.folderUid&&await(0,Fi.Q)(he.folderUid),this._dashboard.setState({meta:he})},this.onEditableChange=ge=>{this._dashboard.setState({editable:ge})},this.onTimeZoneChange=ge=>{this.getTimeRange().setState({timeZone:ge})},this.onWeekStartChange=ge=>{this.getTimeRange().setState({weekStart:ge})},this.onRefreshIntervalChange=ge=>{this.getRefreshPicker()?.setState({intervals:ge})},this.onNowDelayChange=ge=>{this.getTimeRange()?.setState({UNSAFE_nowDelay:ge})},this.onHideTimePickerChange=ge=>{this.getDashboardControls()?.setState({hideTimeControls:ge})},this.onLiveNowChange=ge=>{try{const Le=this.getLiveNowTimer();ge?Le.enable():Le.disable()}catch(Le){console.error(Le)}},this.onTooltipChange=ge=>{this.getCursorSync()?.setState({sync:ge})},this.onPreloadChange=ge=>{this._dashboard.setState({preload:ge})},this.onDeleteDashboard=()=>{}}get _dashboard(){return(0,K.YQ)(this)}getUrlKey(){return"settings"}getDashboard(){return this._dashboard}getTimeRange(){return m.jh.getTimeRange(this._dashboard)}getRefreshPicker(){return this.getDashboardControls().state.refreshPicker}getCursorSync(){return Qn.b4.getCursorSync(this._dashboard)}getLiveNowTimer(){const ge=m.jh.findObject(this._dashboard,Le=>Le instanceof m.Gg.en);if(ge instanceof m.Gg.en)return ge;throw new Error("LiveNowTimer could not be found")}getDashboardControls(){return this._dashboard.state.controls}static{this.Component=({model:ge})=>{const Le=ge.getDashboard(),{navModel:he,pageNav:Ae}=Ss(Le,ge.getUrlKey()),{title:Fe,description:qe,tags:nt,meta:ot,editable:ut}=Le.useState(),{sync:Ct}=ge.getCursorSync()?.useState()||{},{timeZone:Lt,weekStart:Kt,UNSAFE_nowDelay:zt}=ge.getTimeRange().useState(),{intervals:dn}=ge.getRefreshPicker().useState(),{hideTimeControls:Gt}=ge.getDashboardControls().useState(),{enabled:rn}=ge.getLiveNowTimer().useState();return(0,d.jsxs)(Ya.Y,{navModel:he,pageNav:Ae,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:Le}),(0,d.jsxs)("div",{style:{maxWidth:"600px"},children:[(0,d.jsxs)(N.a,{marginBottom:5,children:[(0,d.jsx)(Qe.D,{label:(0,d.jsxs)(j.B,{justifyContent:"space-between",children:[(0,d.jsx)(Ge.J,{htmlFor:"title-input",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-settings.general.title-label",children:"Title"})}),r.$.featureToggles.dashgpt&&(0,d.jsx)(Wi.Z,{onGenerate:Pn=>ge.onTitleChange(Pn)})]}),children:(0,d.jsx)(je.p,{id:"title-input",name:"title",value:Fe,onChange:Pn=>ge.onTitleChange(Pn.target.value)})}),(0,d.jsx)(Qe.D,{label:(0,d.jsxs)(j.B,{justifyContent:"space-between",children:[(0,d.jsx)(Ge.J,{htmlFor:"description-input",children:(0,T.t)("dashboard-settings.general.description-label","Description")}),r.$.featureToggles.dashgpt&&(0,d.jsx)(Go.V,{onGenerate:Pn=>ge.onDescriptionChange(Pn)})]}),children:(0,d.jsx)(ze.f,{id:"description-input",name:"description",value:qe,onChange:Pn=>ge.onDescriptionChange(Pn.target.value)})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-settings.general.tags-label","Tags"),children:(0,d.jsx)($o.u,{id:"tags-input",tags:nt,onChange:ge.onTagsChange,width:40})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-settings.general.folder-label","Folder"),children:Le.isManagedRepository()?(0,d.jsx)(je.p,{readOnly:!0,value:ot.folderTitle}):(0,d.jsx)(ce.d,{value:ot.folderUid,onChange:ge.onFolderChange,initialTitle:ot.folderTitle,inputId:"dashboard-folder-input",enableCreateNew:!0,skipInitialLoad:!0})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-settings.general.editable-label","Editable"),description:(0,T.t)("dashboard-settings.general.editable-description","Set to read-only to disable all editing. Reload the dashboard for changes to take effect"),children:(0,d.jsx)(an.z,{value:ut,options:Ki,onChange:ge.onEditableChange})})]}),(0,d.jsx)(Ho.p,{onTimeZoneChange:ge.onTimeZoneChange,onWeekStartChange:ge.onWeekStartChange,onRefreshIntervalChange:ge.onRefreshIntervalChange,onNowDelayChange:ge.onNowDelayChange,onHideTimePickerChange:ge.onHideTimePickerChange,onLiveNowChange:ge.onLiveNowChange,refreshIntervals:dn,timePickerHidden:Gt,nowDelay:zt||"",liveNow:rn,timezone:Lt||"",weekStart:Kt}),(0,d.jsxs)(zo.M,{label:(0,T.t)("dashboard-settings.general.panel-options-label","Panel options"),isOpen:!0,children:[(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-settings.general.panel-options-graph-tooltip-label","Graph tooltip"),description:(0,T.t)("dashboard-settings.general.panel-options-graph-tooltip-description","Controls tooltip and hover highlight behavior across different panels. Reload the dashboard for changes to take effect"),children:(0,d.jsx)(an.z,{onChange:ge.onTooltipChange,options:Ir,value:Ct})}),(0,d.jsx)(Qe.D,{label:(0,T.t)("dashboard-settings.general.panels-preload-label","Preload panels"),description:(0,T.t)("dashboard-settings.general.panels-preload-description","When enabled all panels will start loading as soon as the dashboard has been loaded."),children:(0,d.jsx)(Ye.d,{id:"preload-panels-dashboards-toggle",value:Le.state.preload,onChange:Pn=>ge.onPreloadChange(Pn.currentTarget.checked)})})]}),(0,d.jsx)(N.a,{marginTop:3,children:ot.canDelete&&(0,d.jsx)(oo.c,{dashboard:Le})})]})]})}}}var wi=e(18646),Vi=e(31119);class Js extends m.Bs{constructor(ge){super({...ge,jsonText:""}),this.onCodeEditorBlur=Le=>{this.setState({jsonText:Le})},this.onSaveSuccess=async Le=>{const he=JSON.parse(this.state.jsonText),Ae=this.getDashboard(),Fe=ii(he);let qe;if(Fe){const nt=await(0,wi.n)("v2").getDashboardDTO(Le.uid);qe=(0,Vi.dj)(nt);const ot=m.Go.cloneSceneObjectState(qe.state);Ae.pauseTrackingChanges(),Ae.setInitialSaveModel(nt.spec,nt.metadata),Ae.setState(ot)}else{he.version=Le.version,qe=(0,Sn.wM)({dashboard:he,meta:Ae.state.meta});const nt=m.Go.cloneSceneObjectState(qe.state);Ae.pauseTrackingChanges(),Ae.setInitialSaveModel(he,Ae.state.meta),Ae.setState(nt)}this.setState({jsonText:this.getJsonText()})},this.addActivationHandler(()=>this.setState({jsonText:this.getJsonText()}))}getUrlKey(){return"json-model"}getDashboard(){return(0,K.YQ)(this)}getSaveModel(){return this.getDashboard().getSaveModel()}getJsonText(){const ge=this.getSaveModel();return(0,Ao.p)(ge)}static{this.Component=({model:ge})=>{const{state:Le,onSaveDashboard:he}=At(!1),[Ae,Fe]=(0,W.useState)(!1),qe=ge.getDashboard(),{navModel:nt,pageNav:ot}=Ss(qe,ge.getUrlKey()),ut=qe.useState().meta.canSave,{jsonText:Ct}=ge.useState(),Lt=async rn=>{const Pn=await he(qe,{folderUid:qe.state.meta.folderUid,overwrite:rn,rawDashboardJSON:JSON.parse(ge.state.jsonText),k8s:qe.state.meta.k8s});Fe(!0),Pn.status==="success"?(await ge.onSaveSuccess(Pn),Fe(!1)):Fe(!0)},Kt=rn=>(0,d.jsx)(Q.$n,{type:"submit",onClick:()=>{Lt(rn)},variant:rn?"destructive":"primary",children:rn?"Save and overwrite":(0,d.jsx)(T.x6,{i18nKey:"dashboard-settings.json-editor.save-button",children:"Save changes"})}),zt=(0,d.jsx)(Q.$n,{variant:"secondary",onClick:()=>Fe(!1),fill:"outline",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.json-model-edit-view.cancel-button.cancel",children:"Cancel"})}),dn=(0,v.of)(io);function Gt(rn){if(rn&&Ae){if(Oe(rn))return(0,d.jsxs)(Ve.F,{title:(0,T.t)("dashboard-scene.json-model-edit-view.render-save-button-and-error.title-someone-else-has-updated-this-dashboard","Someone else has updated this dashboard"),severity:"error",children:[(0,d.jsx)("p",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.json-model-edit-view.render-save-button-and-error.would-still-dashboard",children:"Would you still like to save this dashboard?"})}),(0,d.jsx)(N.a,{paddingTop:2,children:(0,d.jsxs)(j.B,{alignItems:"center",children:[zt,Kt(!0)]})})]});
197if(we(rn))return(0,d.jsx)(Xe,{saveButton:Kt,cancelButton:zt});if(Be(rn))return(0,d.jsxs)(Ve.F,{title:(0,T.t)("dashboard-scene.json-model-edit-view.render-save-button-and-error.title-plugin-dashboard","Plugin dashboard"),severity:"error",children:[(0,d.jsx)("p",{children:(0,d.jsxs)(T.x6,{i18nKey:"dashboard-scene.json-model-edit-view.render-save-button-and-error.body-plugin-dashboard",children:["Your changes will be lost when you update the plugin. Use ",(0,d.jsx)("strong",{children:"Save as"})," to create custom version."]})}),(0,d.jsx)(N.a,{paddingTop:2,children:(0,d.jsx)(j.B,{alignItems:"center",children:Kt(!0)})})]})}return(0,d.jsxs)(d.Fragment,{children:[rn&&Ae&&(0,d.jsx)(Ve.F,{title:(0,T.t)("dashboard-scene.json-model-edit-view.render-save-button-and-error.title-failed-to-save-dashboard","Failed to save dashboard"),severity:"error",children:(0,d.jsx)("p",{children:rn.message})}),(0,d.jsx)(j.B,{alignItems:"center",children:Kt(!1)})]})}return(0,d.jsxs)(Ya.Y,{navModel:nt,pageNav:ot,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:qe}),(0,d.jsxs)("div",{className:dn.wrapper,children:[(0,d.jsx)(T.x6,{i18nKey:"dashboard-settings.json-editor.subtitle",children:"The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel settings, layout, queries, and so on."}),(0,d.jsx)(tn.B,{width:"100%",value:Ct,language:"json",showLineNumbers:!0,showMiniMap:!0,containerStyles:dn.codeEditor,onBlur:ge.onCodeEditorBlur}),ut&&(0,d.jsx)(N.a,{paddingTop:2,children:Gt(Le.error)})]})]})}}}const io=Ie=>({wrapper:(0,D.css)({display:"flex",height:"100%",flexDirection:"column",gap:Ie.spacing(2)}),codeEditor:(0,D.css)({flexGrow:1})});var $i=e(54384);class sa extends m.Bs{static{this.Component=Qo}get _dashboard(){return(0,K.YQ)(this)}getUrlKey(){return"permissions"}getDashboard(){return this._dashboard}}function Qo({model:Ie}){const ge=Ie.getDashboard(),{uid:Le}=ge.useState(),{navModel:he,pageNav:Ae}=Ss(ge,Ie.getUrlKey()),Fe=ae.TP.hasPermission(_e.AccessControlAction.DashboardsPermissionsWrite);return(0,d.jsxs)(Ya.Y,{navModel:he,pageNav:Ae,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:ge}),(0,d.jsx)($i.x,{resource:"dashboards",resourceId:Le??"",canSetPermissions:Fe})]})}var ko=e(62635),lo=e(47969);const hs=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g;function zi(Ie){return Ie.map(ge=>({id:ge.state.name,label:`${ge.state.name}`}))}function Hi(Ie,ge){return Ie.filter(Le=>ge.some(he=>he.from===Le.id||he.to===Le.id))}const Gi=Ie=>{const ge=[];for(const Le of Ie)for(const he of Ie){if(Le===he)continue;Le.variableDependency?.hasDependencyOn(he.state.name)&&ge.push({from:Le.state.name,to:he.state.name})}return ge};function dr(Ie,ge){if(!ge)return[];let Le=[];for(const he of Ie){const Ae=he.state.name,Fe=(0,lo.Jx)(Ae,{key:"model",value:ge},{});Object.keys(Fe).length&&Le.push({variable:he,tree:Fe})}return Le}function Yo(Ie){const ge=[];for(const Le of Ie){const{variable:he,tree:Ae}=Le,Fe={variable:he,nodes:[{id:"dashboard",label:"dashboard"}],edges:[],showGraph:!1};ge.push(Jo(Fe,{id:"dashboard",value:Ae}))}return ge}const Jo=(Ie,ge)=>{const{id:Le,value:he}=ge,{nodes:Ae,edges:Fe}=Ie;if(he&&typeof he=="string"){const qe=`${ge.id}-${he}`;return Ae.push({id:qe,label:he}),Fe.push({from:qe,to:Le}),Ie}if(ws(he)){const qe=Object.keys(he);for(const nt of qe){const ot=`${ge.id}-${nt}`;Ae.push({id:ot,label:nt}),Fe.push({from:ot,to:Le}),Ie=Jo(Ie,{id:ot,value:he[nt]})}return Ie}return Ie},Xo=(Ie,ge)=>{const Le=ge.find(he=>he.variable.state.name===Ie);return Le&&ws(Le.tree)?Zo(Le.tree):0},Zo=Ie=>Object.values(Ie).reduce((Le,he)=>typeof he=="object"?Le+Zo(he):Le+1,0);async function _i(Ie,ge){return new Promise((Le,he)=>{setTimeout(()=>{try{const Ae=Rr(Ie,ge);Le(Yo(Ae))}catch(Ae){he(Ae)}},200)})}function Rr(Ie,ge){if(!ge)return[];let Le=[];const he=ur(Ie,ge);for(const Ae of he){const Fe=(0,lo.Jx)(Ae,{key:"model",value:ge},{});Object.keys(Fe).length&&Le.push({variable:Ae,tree:Fe})}return Le}const ur=(Ie,ge)=>{hs.lastIndex=0;const Le=[],Ae=(0,ko.MA)(ge,2).match(hs);if(!Ae)return Le;for(const Fe of Ae){if(!Fe||Fe.indexOf("$__")!==-1||Fe.indexOf("${__")!==-1||Fe.indexOf("$hashKey")!==-1)continue;const qe=hr(Fe);Ie.some(nt=>nt.state.name===qe)||Le.find(nt=>nt===qe)||qe&&Le.push(qe)}return Le};function hr(Ie){const ge=fs(Ie);if(!ge)return;const Le=ge.slice(1).find(he=>he!==void 0);if(!(Le in{}))return Le}const fs=Ie=>(hs.lastIndex=0,hs.exec(Ie));function ws(Ie){return typeof Ie=="object"&&Ie!==null&&!Array.isArray(Ie)}var qo=e(75505),ei=e(59857),fr=e(8515),bs=e(71599),As=e(6975),Ls=e(29),Qi=e(32442),ti=e(25379),pr=e(49602),La=e(18387),co=e(73829),Xs=e(68577),is=e(44741);function Ar({onChange:Ie,type:ge}){const Le=(0,W.useMemo)(()=>(0,is.B$)(),[]),he=(0,W.useMemo)(()=>Le.find(Ae=>Ae.value===ge)??Le[0],[Le,ge]);return(0,d.jsx)(Xs.v,{name:"Variable type",value:he,options:Le,onChange:Ie,testId:Re.Tp.pages.Dashboard.Settings.V
197ariables.Edit.General.generalTypeSelectV2})}function ki({variable:Ie,onTypeChange:ge,onGoBack:Le,onDelete:he}){const Ae=(0,v.of)(Yi),[Fe,qe]=(0,W.useState)(),{name:nt,type:ot,label:ut,description:Ct,hide:Lt}=Ie.useState(),Kt=(0,is.bZ)(ot)?(0,is.CD)(ot):void 0,[zt,dn]=(0,lt.A)(async()=>{await(0,qo.s)(Ie.validateAndUpdate())},[Ie]),Gt=Hn=>{Hn.value&&ge(Hn.value)},rn=(0,W.useCallback)(Hn=>{const kn=(0,is.c$)(Ie,Hn.currentTarget.value);kn.errorMessage!==Fe&&qe(kn.errorMessage)},[Ie,Fe]),Pn=Hn=>{Fe||Ie.setState({name:Hn.currentTarget.value})},Un=Hn=>Ie.setState({label:Hn.currentTarget.value}),jn=Hn=>Ie.setState({description:Hn.currentTarget.value}),Bn=Hn=>Ie.setState({hide:Hn}),Yn=(0,is.n_)(Ie),Pa=Hn=>()=>{(0,Et.rR)("Delete variable"),he(nt),Hn()};return(0,d.jsxs)("form",{"aria-label":(0,T.t)("dashboard-scene.variable-editor-form.aria-label-variable-editor-form","Variable editor form"),children:[(0,d.jsx)(Ar,{onChange:Gt,type:ot}),(0,d.jsx)(Qi.Y,{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.variable-editor-form.general",children:"General"})}),(0,d.jsx)(pr._,{name:"Name",description:(0,T.t)("dashboard-scene.variable-editor-form.description-template-variable-characters","The name of the template variable. (Max. 50 characters)"),placeholder:(0,T.t)("dashboard-scene.variable-editor-form.placeholder-variable-name","Variable name"),defaultValue:nt??"",onChange:rn,onBlur:Pn,testId:Re.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalNameInputV2,maxLength:co.M.MaxSize,required:!0,invalid:!!Fe,error:Fe}),(0,d.jsx)(pr._,{name:"Label",description:(0,T.t)("dashboard-scene.variable-editor-form.description-optional-display-name","Optional display name"),placeholder:(0,T.t)("dashboard-scene.variable-editor-form.placeholder-label-name","Label name"),defaultValue:ut??"",onBlur:Un,testId:Re.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInputV2}),(0,d.jsx)(ti.Z,{name:"Description",defaultValue:Ct??"",placeholder:(0,T.t)("dashboard-scene.variable-editor-form.placeholder-descriptive-text","Descriptive text"),onBlur:jn,width:52}),(0,d.jsx)(Ls.D,{onChange:Bn,hide:Lt||ei.rw.hide,type:ot}),Kt&&(0,d.jsx)(Kt,{variable:Ie,onRunQuery:dn}),Yn&&(0,d.jsx)(La.j,{options:Ie.getOptionsForSelect(!1)}),(0,d.jsx)("div",{className:Ae.buttonContainer,children:(0,d.jsxs)(j.B,{gap:2,children:[(0,d.jsx)(fr.$s,{children:({showModal:Hn,hideModal:kn})=>(0,d.jsx)(Q.$n,{variant:"destructive",fill:"outline",onClick:()=>{Hn(bs.u,{title:"Delete variable",body:`Are you sure you want to delete: ${nt}?`,confirmText:"Delete variable",onConfirm:Pa(kn),onDismiss:kn,isOpen:!0})},children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.variable-editor-form.delete",children:"Delete"})})}),(0,d.jsx)(Q.$n,{variant:"secondary","data-testid":Re.Tp.pages.Dashboard.Settings.Variables.Edit.General.applyButton,onClick:Le,children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.variable-editor-form.back-to-list",children:"Back to list"})}),Yn&&(0,d.jsx)(Q.$n,{disabled:zt.loading,variant:"secondary","data-testid":Re.Tp.pages.Dashboard.Settings.Variables.Edit.General.submitButton,onClick:dn,children:zt.loading?(0,d.jsx)(As._,{className:Ae.loadingPlaceHolder,text:(0,T.t)("dashboard-scene.variable-editor-form.text-running-query","Running query...")}):"Run query"})]})})]})}const Yi=Ie=>({buttonContainer:(0,D.css)({marginTop:Ie.spacing(2)}),loadingPlaceHolder:(0,D.css)({marginBottom:0})});var Lr=e(57095),ni=e(27690);const Ji=({variables:Ie})=>{const ge=(0,W.useMemo)(()=>zi(Ie),[Ie]),Le=(0,W.useMemo)(()=>Gi(Ie),[Ie]);return Le.length?(0,d.jsx)(ni.i,{show:!1,title:(0,T.t)("dashboards.settings.variables.dependencies.title","Dependencies"),nodes:Hi(ge,Le),edges:Le,children:({showModal:he})=>(0,d.jsx)(Q.$n,{onClick:()=>{(0,Et.rR)("Show variable dependencies"),he()},icon:"channel-add",variant:"secondary",children:(0,d.jsx)(T.x6,{i18nKey:"dashboards.settings.variables.dependencies.button",children:"Show dependencies"})})}):null};var gr=e(45967);const Zs=({id:Ie,usages:ge,isAdhoc:Le})=>{const he=(0,W.useMemo)(()=>ge.find(Fe=>(typeof Fe.variable=="string"?Fe.variable:Fe.variable.state.name)===Ie),[ge,Ie]);if(ge.length===0||Le||!he)return null;const Ae=he.nodes.map(Fe=>Fe.label.includes(`$${Ie}`)?{...Fe,color:"#FB7E81"}:Fe);return(0,d.jsx)(ni.i,{show:!1,title:(0,T.t)("dashboard-scene.variable-us
197ages-button.title-show-usages","Showing usages for: {{variableId}}",{variableId:`$${Ie}`}),nodes:Ae,edges:he.edges,children:({showModal:Fe})=>(0,d.jsx)(ne.K,{onClick:()=>{(0,Et.rR)("Show variable usages"),Fe()},name:"code-branch",tooltip:(0,T.t)("dashboard-scene.variable-usages-button.tooltip-show-usages","Show usages")})})};function qs({index:Ie,variable:ge,usageTree:Le,usagesNetwork:he,onEdit:Ae,onDuplicate:Fe,onDelete:qe}){const nt=(0,v.$j)(),ot=(0,v.of)(jr),ut=(0,is.Ao)(ge),Ct=ge.state,Lt=Ct.name,zt=Xo(Lt,Le)>0||Ct.type==="adhoc",[dn,Gt]=(0,W.useState)(!1),rn=Un=>()=>{Gt(Un)},Pn=()=>{(0,Et.rR)("Delete variable"),qe(Lt)};return(0,d.jsx)(Lr.Draggable,{draggableId:JSON.stringify(Lt),index:Ie,children:(Un,jn)=>(0,d.jsxs)("tr",{ref:Un.innerRef,...Un.draggableProps,style:{userSelect:jn.isDragging?"none":"auto",background:jn.isDragging?nt.colors.background.secondary:void 0,...Un.draggableProps.style},children:[(0,d.jsx)("td",{role:"gridcell",className:ot.column,children:(0,d.jsx)(Q.$n,{size:"xs",fill:"text",onClick:Bn=>{Bn.preventDefault(),Ae(Lt)},className:ot.nameLink,"data-testid":Re.Tp.pages.Dashboard.Settings.Variables.List.tableRowNameFields(Ct.name),children:Ct.name})}),(0,d.jsx)("td",{role:"gridcell",className:ot.definitionColumn,onClick:Bn=>{Bn.preventDefault(),Ae(Lt)},"data-testid":Re.Tp.pages.Dashboard.Settings.Variables.List.tableRowDefinitionFields(Ct.name),children:ut}),(0,d.jsx)("td",{role:"gridcell",className:ot.column,children:(0,d.jsxs)("div",{className:ot.icons,children:[(0,d.jsx)(ps,{passed:zt}),(0,d.jsx)(Zs,{id:Ct.name,isAdhoc:Ct.type==="adhoc",usages:he}),(0,d.jsx)(ne.K,{onClick:Bn=>{Bn.preventDefault(),(0,Et.rR)("Duplicate variable"),Fe(Lt)},name:"copy",tooltip:(0,T.t)("dashboard-scene.variable-editor-list-row.tooltip-duplicate-variable","Duplicate variable"),"data-testid":Re.Tp.pages.Dashboard.Settings.Variables.List.tableRowDuplicateButtons(Ct.name)}),(0,d.jsx)(ne.K,{onClick:Bn=>{Bn.preventDefault(),Gt(!0)},name:"trash-alt",tooltip:(0,T.t)("dashboard-scene.variable-editor-list-row.tooltip-remove-variable","Remove variable"),"data-testid":Re.Tp.pages.Dashboard.Settings.Variables.List.tableRowRemoveButtons(Ct.name)}),(0,d.jsx)(bs.u,{isOpen:dn,title:(0,T.t)("dashboard-scene.variable-editor-list-row.title-delete-variable","Delete variable"),body:`Are you sure you want to delete: ${Ct.name}?`,confirmText:"Delete variable",onConfirm:Pn,onDismiss:rn(!1)}),(0,d.jsx)("div",{...Un.dragHandleProps,className:ot.dragHandle,children:(0,d.jsx)(I.I,{name:"draggabledots",size:"lg"})})]})})]})})}function ps({passed:Ie}){const ge=(0,v.of)(jr);return Ie?(0,d.jsx)(gr.m,{content:"This variable is referenced by other variables or dashboard.",children:(0,d.jsx)(I.I,{name:"check",className:ge.iconPassed,"aria-label":(0,T.t)("dashboard-scene.variable-check-indicator.aria-label-variable-referenced-other-variables-dashboard","This variable is referenced by other variables or dashboard.")})}):(0,d.jsx)(gr.m,{content:"This variable is not referenced by other variables or dashboard.",children:(0,d.jsx)(I.I,{name:"exclamation-triangle",className:ge.iconFailed,"aria-label":(0,T.t)("dashboard-scene.variable-check-indicator.aria-label-variable-referenced-dashboard","This variable is not referenced by any variable or dashboard.")})})}function jr(Ie){return{dragHandle:(0,D.css)({cursor:"grab",marginLeft:Ie.spacing(1)}),column:(0,D.css)({width:"1%"}),nameLink:(0,D.css)({cursor:"pointer",color:Ie.colors.primary.text}),definitionColumn:(0,D.css)({width:"100%",maxWidth:"200px",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),iconPassed:(0,D.css)({color:Ie.v1.palette.greenBase,marginRight:Ie.spacing(2)}),iconFailed:(0,D.css)({color:Ie.v1.palette.orange,marginRight:Ie.spacing(2)}),icons:(0,D.css)({display:"flex",gap:Ie.spacing(2),alignItems:"center"})}}function ai({variables:Ie,usages:ge,usagesNetwork:Le,onChangeOrder:he,onDelete:Ae,onDuplicate:Fe,onAdd:qe,onEdit:nt}){const ot=(0,v.of)(Xi),ut=Ct=>{!Ct.destination||!Ct.source||((0,Et.rR)("Variable drag and drop"),he(Ct.source.index,Ct.destination.index))};return Ie.length<=0?(0,d.jsx)(js,{onAdd:qe}):(0,d.jsxs)(j.B,{direction:"column",gap:3,children:[(0,d.jsxs)("table",{className:or()("filter-table","filter-table--hover",ot.tableContainer),"data-testid":Re.Tp.pages.Dashboard.Settings.V
197ariables.List.table,role:"grid",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.variable-editor-list.variable",children:"Variable"})}),(0,d.jsx)("th",{children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.variable-editor-list.definition",children:"Definition"})}),(0,d.jsx)("th",{colSpan:5})]})}),(0,d.jsx)(Lr.DragDropContext,{onDragEnd:ut,children:(0,d.jsx)(Lr.Droppable,{droppableId:"variables-list",direction:"vertical",children:Ct=>(0,d.jsxs)("tbody",{ref:Ct.innerRef,...Ct.droppableProps,children:[Ie.map((Lt,Kt)=>{const zt=Lt.state;return(0,d.jsx)(qs,{index:Kt,variable:Lt,onDelete:Ae,onDuplicate:Fe,onEdit:nt,usageTree:ge,usagesNetwork:Le},`${zt.name}-${Kt}`)}),Ct.placeholder]})})})]}),(0,d.jsxs)(j.B,{children:[(0,d.jsx)(Ji,{variables:Ie}),(0,d.jsx)(Q.$n,{"data-testid":Re.Tp.pages.Dashboard.Settings.Variables.List.newButton,onClick:qe,icon:"plus",children:(0,d.jsx)(T.x6,{i18nKey:"dashboard-scene.variable-editor-list.new-variable",children:"New variable"})})]})]})}function js({onAdd:Ie}){return(0,d.jsx)(j.B,{direction:"column",children:(0,d.jsxs)(ao.p,{variant:"call-to-action",button:(0,d.jsx)(Q.$n,{"data-testid":Re.Tp.components.CallToActionCard.buttonV2("Add variable"),icon:"calculator-alt",onClick:Ie,size:"lg",children:(0,d.jsx)(T.x6,{i18nKey:"variables.empty-state.button-title",children:"Add variable"})}),message:(0,T.t)("variables.empty-state.title","There are no variables added yet"),children:[(0,d.jsx)("p",{children:(0,d.jsx)(T.x6,{i18nKey:"variables.empty-state.info-box-content",children:"Variables enable more interactive and dynamic dashboards. Instead of hard-coding things like server or sensor names in your metric queries you can use variables in their place. Variables are shown as list boxes at the top of the dashboard. These drop-down lists make it easy to change the data being displayed in your dashboard."})}),(0,d.jsxs)(T.x6,{i18nKey:"variables.empty-state.info-box-content-2",children:["Check out the"," ",(0,d.jsx)(_s.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/variables/",children:"Templates and variables documentation"})," ","for more information."]})]})})}const Xi=()=>({tableContainer:(0,D.css)({overflow:"auto"})}),Zi=1e3;function qi({variables:Ie,dashboard:ge}){const[Le,he]=(0,W.useState)(!1),[Ae,Fe]=(0,W.useState)(0),qe=(0,v.of)(ya);(0,W.useEffect)(()=>Fe(Lt=>Lt+1),[Ie,ge]);const[{loading:nt,value:ot},ut]=(0,lt.A)(async()=>{const Lt=Date.now(),Kt=await _i(Ie,ge),dn=Date.now()-Lt;return dn>=Zi&&(0,Et.rR)("Slow unknown variables expansion",{elapsed:dn}),Fe(0),Kt},[Ie,ge]),Ct=Lt=>{Lt&&((0,Et.rR)("Unknown variables section expanded"),Ae>0&&ut()),he(Lt)};return(0,d.jsx)("div",{className:qe.container,children:(0,d.jsx)(zo.M,{label:(0,d.jsx)(ja,{}),isOpen:Le,onToggle:Ct,children:nt||!ot?(0,d.jsx)(j.B,{justifyContent:"center",direction:"column",children:(0,d.jsxs)(j.B,{justifyContent:"center",children:[(0,d.jsx)("span",{children:(0,d.jsx)(T.x6,{i18nKey:"variables.unknown-table.loading",children:"Loading..."})}),(0,d.jsx)(Ks.y,{})]})}):ot.length>0?(0,d.jsx)(gs,{usages:ot}):(0,d.jsx)(el,{})})})}function ja(){const Ie=(0,v.of)(ya);return(0,d.jsxs)("h5",{children:[(0,d.jsx)(T.x6,{i18nKey:"variables.unknown-table.renamed-or-missing-variables",children:"Renamed or missing variables"}),(0,d.jsx)(gr.m,{content:"Click to expand a list with all variable references that have been renamed or are missing from the dashboard.",children:(0,d.jsx)(I.I,{name:"info-circle",className:Ie.infoIcon})})]})}function el(){return(0,d.jsx)("span",{children:(0,d.jsx)(T.x6,{i18nKey:"variables.unknown-table.no-unknowns",children:"No renamed or missing variables found."})})}function gs({usages:Ie}){const ge=(0,v.of)(ya);return(0,d.jsxs)("table",{className:"filter-table filter-table--hover",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{children:(0,d.jsx)(T.x6,{i18nKey:"variables.unknown-table.variable",children:"Variable"})}),(0,d.jsx)("th",{colSpan:5})]})}),(0,d.jsx)("tbody",{children:Ie.map(Le=>{const he=typeof Le.variable=="string"?Le.variable:Le.variable.state.name;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{className:ge.firstColumn,children:(0,d.jsx)("span",{children:he})}),(0,d.jsx)("td",{className:ge.defaultColumn}),(0,d.jsx)("td",{className:ge.defaultColumn}),(0,d.jsx)("td",{className:ge.defaultColumn}),(0,d.jsx)("td",{className:ge.lastColumn,children:(0,d.jsx)(Zs,{id:he,usages:Ie,isAdhoc:!1})})]},he)})})]})}const ya=Ie=>({container:(0,D.css)({marginTop:Ie.spacing(4),paddingTop:Ie.spacing(4)}),infoIcon:(0,D.css)({marginLeft:Ie.spacing(1)}),defaultColumn:(0,D.css)({width:"1%"}),firstColumn:(0,D.css)({width:"1%",verticalAlign:"top",color:Ie.colors.text.maxContrast}),lastColumn:(0,D.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",textAlign:"right"})});class Sa extends m.Bs{constructor(){super(...arguments),this._urlSync=new eo(this),this.getVariableIndex=ge=>this.getVariables().findIndex(he=>he.state.name===ge),this.replaceEditVariable=ge=>{const Le=this.state.editIndex??-1,{variables:he}=this.getVariableSet().state;if(!he[Le]){console.error("Variable not found");return}const Fe=[...he.slice(0,Le),ge,...he.slice(Le+1)];this.getVariableSet().setState({variables:Fe})},this.onDelete=ge=>{const Le=this.getVariableIndex(ge),{variables:he}=this.getVariableSet().state;if(Le===-1){console.error("Variable not found");return}const Ae=[...he.slice(0,Le),...he.slice(Le+1)];this.getVariableSet().setState({variables:Ae}),this.setState({editIndex:void 0})},this.onDuplicated=ge=>{const Le=this.getVariableIndex(ge),he=this.getVariableSet().state.variables;if(Le===-1){console.error("Variable not found");return}const Ae=he[Le];let Fe=0,qe=`copy_of_${Ae.state.name}`;for(;he.some(ut=>ut.state.name===qe);)Fe++,qe=`copy_of_${Ae.state.name}_${Fe}`;const nt=Ae.clone(Ae.state);nt.setState({name:qe});const ot=[...he.slice(0,Le+1),nt,...he.slice(Le+1)];this.getVariableSet().setState({variables:ot})},this.onOrderChanged=(ge,Le)=>{const he=this.getVariableSet().state.variables;if(!this.getVariableSet())return;if(ge<0||ge>=he.length||Le<0||Le>=he.length){console.error("Invalid index");return}const Ae=[...he],Fe=Ae.splice(ge,1);Ae.splice(Le,0,Fe[0]),this.getVariableSet().setState({variables:Ae})},this.onEdit=ge=>{const Le=this.getVariableIndex(ge);if(Le===-1){console.error("Variable not found");return}this.setState({editIndex:Le})},this.onAdd=()=>{const ge=this.getVariables(),Le=ge.length,he=(0,is.kh)(ge);this.getVariableSet().setState({variables:[...this.getVariables(),he]}),this.setState({editIndex:Le})},this.onTypeChange=ge=>{const Le=this.state.editIndex??-1,{variables:he}=this.getVariableSet().state,Ae=he[Le];if(!Ae){console.error("Variable not found");return}const{name:Fe,label:qe}=Ae.state,nt=(0,is.No)(ge,{name:Fe,label:qe});this.replaceEditVariable(nt)},this.onGoBack=()=>{this.setState({editIndex:void 0})},this.onValidateVariableName=(ge,Le)=>{let he=null;is.cH.test(ge)||(he="Template names cannot begin with '__', that's reserved for Grafana's global variables"),is.mJ.test(ge)||(he="Only word characters are allowed in variable names");const Ae=this.getVariableSet().getByName(ge)?.state;return Ae&&Ae.key!==Le&&(he="Variable with the same name already exists"),he?[!0,he]:[!1,null]}
197,this.getSaveModel=()=>(0,En.Uy)(this.getDashboard()),this.getUsages=()=>{const ge=this.getSaveModel();return dr(this.getVariables(),ge)},this.getUsagesNetwork=()=>{const ge=this.getUsages();return Yo(ge)}}static{this.Component=si}getUrlKey(){return"variables"}getDashboard(){return(0,K.YQ)(this)}getVariableSet(){return m.jh.getVariables(this.getDashboard())}getVariables(){return this.getVariableSet().state.variables}}function si({model:Ie}){const ge=Ie.getDashboard(),{navModel:Le,pageNav:he}=Ss(ge,Ie.getUrlKey()),{onDelete:Ae,onDuplicated:Fe,onOrderChanged:qe,onEdit:nt,onTypeChange:ot,onGoBack:ut,onAdd:Ct}=Ie,{variables:Lt}=Ie.getVariableSet().useState(),{editIndex:Kt}=Ie.useState(),zt=(0,W.useMemo)(()=>Ie.getUsagesNetwork(),[Ie]),dn=(0,W.useMemo)(()=>Ie.getUsages(),[Ie]),Gt=Ie.getSaveModel();if(Kt!==void 0&&Lt[Kt]){const rn=Lt[Kt];if(rn)return(0,d.jsx)(uo,{variable:rn,onTypeChange:ot,onGoBack:ut,pageNav:he,navModel:Le,dashboard:ge,onDelete:Ae})}return(0,d.jsxs)(Ya.Y,{navModel:Le,pageNav:he,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:ge}),(0,d.jsx)(ai,{variables:Lt,usages:dn,usagesNetwork:zt,onDelete:Ae,onDuplicate:Fe,onChangeOrder:qe,onAdd:Ct,onEdit:nt}),(0,d.jsx)(qi,{variables:Lt,dashboard:Gt})]})}function uo({variable:Ie,pageNav:ge,navModel:Le,dashboard:he,onTypeChange:Ae,onGoBack:Fe,onDelete:qe}){const{name:nt}=Ie.useState(),ot={text:nt,parentItem:ge};return(0,d.jsxs)(Ya.Y,{navModel:Le,pageNav:ot,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:he}),(0,d.jsx)(ki,{variable:Ie,onTypeChange:Ae,onGoBack:Fe,onDelete:qe},Ie.state.key)]})}const tl=10;class Ma extends m.Bs{constructor(ge){super({...ge,versions:[],isLoading:!0,isAppending:!0,viewMode:"list",isNewLatest:!1,diffData:{lhs:"",rhs:""}}),this._limit=tl,this._start=0,this._continueToken="",this.fetchVersions=(Le=!1)=>{const he=this._dashboard.state.uid;if(!he)return;this.setState({isAppending:Le});const Ae=this._continueToken?{limit:this._limit,start:this._start,continueToken:this._continueToken}:{limit:this._limit,start:this._start};wn.wL.getHistoryList(he,Ae).then(Fe=>{this.setState({isLoading:!1,versions:[...this.state.versions??[],...this.decorateVersions(Fe.versions)]}),this._start+=this._limit,this._continueToken=Fe.continueToken??""}).catch(Fe=>console.log(Fe)).finally(()=>this.setState({isAppending:!1}))},this.getDiff=async()=>{const Le=this.versions.filter(ot=>ot.checked),[he,Ae]=Le,Fe=he.version===this._dashboard.state.version;if(this.setState({isLoading:!0}),!this._dashboard.state.uid)return;let qe,nt;r.$.featureToggles.kubernetesClientDashboardsFolders?(qe=await wn.wL.getDashboardVersion(this._dashboard.state.uid,Ae.id),nt=await wn.wL.getDashboardVersion(this._dashboard.state.uid,he.id)):(qe=await wn.wL.getDashboardVersion(this._dashboard.state.uid,Ae.version),nt=await wn.wL.getDashboardVersion(this._dashboard.state.uid,he.version)),this.setState({baseInfo:Ae,isLoading:!1,isNewLatest:Fe,newInfo:he,viewMode:"compare",diffData:{lhs:qe.data,rhs:nt.data}})},this.reset=()=>{this._continueToken="",this.setState({baseInfo:void 0,diffData:{lhs:"",rhs:""},isNewLatest:!1,newInfo:void 0,versions:this.versions.map(Le=>({...Le,checked:!1})),viewMode:"list"})},this.onCheck=(Le,he)=>{this.setState({versions:this.versions.map(Ae=>Ae.id===he?{...Ae,checked:Le.currentTarget.checked}:Ae)})},this.addActivationHandler(()=>{this.fetchVersions()})}static{this.Component=Bs}get _dashboard(){return(0,K.YQ)(this)}get diffData(){return this.state.diffData??{lhs:"",rhs:""}}get versions(){return this.state.versions??[]}get limit(){return this._limit}get start(){return this._start}get continueToken(){return this._continueToken}getUrlKey(){return"versions"}getDashboard(){return this._dashboard}getTimeRange(){return m.jh.getTimeRange(this._dashboard)}decorateVersions(ge){const Le=this.getTimeRange().getTimeZone();return ge.map(he=>({...he,createdDateString:(0,_n.LE)(he.created,{timeZone:Le}),ageString:(0,_n.fq)(he.created,{timeZone:Le}),checked:!1}))}}function Bs({model:Ie}){const ge=Ie.getDashboard(),{isLoading:Le,isAppending:he,viewMode:Ae,baseInfo:Fe,newInfo:qe,isNewLatest:nt}=Ie.useState(),{navModel:ot,pageNav:ut}=Ss(ge,Ie.getUrlKey()),Ct=Ie.versions.filter(rn=>rn.checked).length===2,Lt=Ie.versions.length>1,Kt=Ie.versions.length>=Ie.limit;let zt=Ie.versions.find(rn=>rn.version===1)||Ie.versions.length%Ie.limit!==0;r.$.featureToggles.kubernetesClientDashboardsFolders&&(zt=zt||Ie.continueToken==="");const dn=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(wn.me,{onClick:Ie.reset,baseVersion:Fe?.version,newVersion:qe?.version,isNewLatest:nt}),Le?(0,d.jsx)(Br,{msg:"Fetching changes\u2026"}):(0,d.jsx)(wn.Cc,{newInfo:qe,baseInfo:Fe,isNewLatest:nt,diffData:Ie.diffData,onRestore:ge.onRestore})]}),Gt=(0,d.jsxs)(d.Fragment,{children:[Le?(0,d.jsx)(Br,{msg:"Fetching history list\u2026"}):(0,d.jsx)(wn.bS,{versions:Ie.versions,onCheck:Ie.onCheck,canCompare:Ct,onRestore:ge.onRestore}),he&&(0,d.jsx)(Br,{msg:"Fetching more entries\u2026"}),Lt&&(0,d.jsx)(wn.rJ,{hasMore:Kt,canCompare:Ct,getVersions:Ie.fetchVersions,getDiff:Ie.getDiff,isLastPage:!!zt})]});return(0,d.jsxs)(Ya.Y,{navModel:ot,pageNav:ut,layout:ka.k.Standard,children:[(0,d.jsx)(Wa.c,{dashboard:ge}),Ae==="compare"?dn:Gt]})}const Br=({msg:Ie})=>(0,d.jsxs)(j.B,{children:[(0,d.jsx)(Ks.y,{}),(0,d.jsx)("em",{children:Ie})]});function Ss(Ie,ge){const Le=(0,Nt.zy)(),he=(0,_e.useSelector)(nt=>nt.navIndex),Ae=(0,f.tc)(he,"dashboards/browse"),Fe=Ie.getPageNav(Le,he),qe={text:"Settings",url:t.I.getUrlForParti
197al(Le,{editview:"settings",editIndex:null}),children:[],parentItem:Fe};return Ie.state.meta.canEdit&&(qe.children.push({text:(0,T.t)("dashboard-settings.general.title","General"),url:t.I.getUrlForPartial(Le,{editview:"settings",editIndex:null}),active:ge==="settings"}),qe.children.push({text:(0,T.t)("dashboard-settings.annotations.title","Annotations"),url:t.I.getUrlForPartial(Le,{editview:"annotations",editIndex:null}),active:ge==="annotations"}),qe.children.push({text:(0,T.t)("dashboard-settings.variables.title","Variables"),url:t.I.getUrlForPartial(Le,{editview:"variables",editIndex:null}),active:ge==="variables"}),qe.children.push({text:(0,T.t)("dashboard-settings.links.title","Links"),url:t.I.getUrlForPartial(Le,{editview:"links",editIndex:null}),active:ge==="links"})),Ie.state.uid&&Ie.state.meta.canSave&&qe.children.push({text:(0,T.t)("dashboard-settings.versions.title","Versions"),url:t.I.getUrlForPartial(Le,{editview:"versions",editIndex:null}),active:ge==="versions"}),Ie.state.uid&&Ie.state.meta.canAdmin&&ae.TP.hasPermission(_e.AccessControlAction.DashboardsPermissionsRead)&&qe.children.push({text:(0,T.t)("dashboard-settings.permissions.title","Permissions"),url:t.I.getUrlForPartial(Le,{editview:"permissions",editIndex:null}),active:ge==="permissions"}),qe.children.push({text:(0,T.t)("dashboard-settings.json-editor.title","JSON Model"),url:t.I.getUrlForPartial(Le,{editview:"json-model",editIndex:null}),active:ge==="json-model"}),{navModel:Ae,pageNav:qe}}function qa(Ie){switch(Ie){case"annotations":return new Li({});case"variables":return new Sa({});case"links":return new Bi({});case"versions":return new Ma({});case"json-model":return new Js({});case"permissions":return new sa({});case"settings":default:return new _o({})}}var Vs=e(9175),Ur=e(99949);class ta extends m.Bs{constructor(ge){super(ge),this.addActivationHandler(this._activationHandler.bind(this))}_activationHandler(){const ge=this.state.panelRef.resolve();return(0,K.sf)(ge)}getUrlKey(){return this.state.panelRef.resolve().state.key}static{this.Component=({model:ge})=>{const{panelRef:Le}=ge.useState(),he=Le.resolve();return(0,d.jsx)(he.Component,{model:he})}}}class nl{constructor(ge){this._scene=ge}getKeys(){return["inspect","viewPanel","editPanel","editview","autofitpanels","kiosk","shareView"]}getUrlState(){const ge=this._scene.state;return{inspect:ge.inspectPanelKey,autofitpanels:this.getAutoFitPanels(),viewPanel:ge.viewPanelScene?.getUrlKey(),editview:ge.editview?.getUrlKey(),editPanel:ge.editPanel?.getUrlKey()||void 0,kiosk:ge.kioskMode===_e.KioskMode.Full?"":void 0,shareView:ge.shareView,orgId:ae.TP.user.orgId.toString()}}getAutoFitPanels(){if(this._scene.state.body instanceof Is.D)return this._scene.state.body.state.grid.state.UNSAFE_fitPanels?"true":void 0}updateFromUrl(ge){const{inspectPanelKey:Le,viewPanelScene:he,isEditing:Ae,editPanel:Fe,shareView:qe}=this._scene.state,nt={};
197if(typeof ge.editview=="string"&&this._scene.canEditDashboard()?(nt.editview=qa(ge.editview),Ae||(this._scene.state.editable?setTimeout(()=>this._scene.onEnterEditMode()):nt.editview=void 0)):ge.hasOwnProperty("editview")&&(nt.editview=void 0),typeof ge.inspect=="string"){let ut=(0,K.vL)(this._scene,ge.inspect);if(!ut){if((0,L.ag)(ge.inspect)){this._handleInspectRepeatClone(ge.inspect);return}a.A.emit($t.r1.alertError,["Panel not found"]),o.Ny.partial({inspect:null});return}nt.inspectPanelKey=ge.inspect,nt.overlay=new jo({panelRef:ut.getRef()})}else Le&&(nt.inspectPanelKey=void 0,nt.overlay=void 0);if(typeof ge.viewPanel=="string"){const ut=(0,K.vL)(this._scene,ge.viewPanel);if(!ut){if((0,L.ag)(ge.viewPanel)){this._handleViewRepeatClone(ge.viewPanel);return}a.A.emit($t.r1.alertError,["Panel not found"]),o.Ny.partial({viewPanel:null});return}nt.viewPanelScene=new ta({panelRef:ut.getRef()})}else he&&ge.viewPanel===null&&(nt.viewPanelScene=void 0);if(typeof ge.editPanel=="string"){const ut=(0,K.Uv)(this._scene,ge.editPanel);if(!ut){console.warn(`Panel ${ge.editPanel} not found`);return}this._scene.state.viewPanelScene&&this._scene.setState({viewPanelScene:void 0}),Ae||this._scene.onEnterEditMode(),this._scene.state.scopesBridge?.setReadOnly(!0);const Ct=(0,K.iL)(ut);if(Ct&&!Ct?.state.isLoaded){this._waitForLibPanelToLoadBeforeEnteringPanelEdit(ut,Ct);return}nt.editPanel=(0,qr.L)(ut)}else Fe&&ge.editPanel===null&&(nt.editPanel=void 0);typeof ge.shareView=="string"?(nt.shareView=ge.shareView,nt.overlay=r.$.featureToggles.newDashboardSharingComponent?new Vs.j({shareView:ge.shareView}):new Ur.Z({activeTab:ge.shareView})):qe&&ge.shareView===null&&(nt.overlay=void 0,nt.shareView=void 0);const ot=this._scene.state.body;if(ot instanceof Is.D){const ut=typeof ge.autofitpanels=="string";!!ot.state.grid.state.UNSAFE_fitPanels!==ut&&ot.state.grid.setState({UNSAFE_fitPanels:ut})}typeof ge.kiosk=="string"&&(ge.kiosk==="true"||ge.kiosk==="")&&(nt.kioskMode=_e.KioskMode.Full),Object.keys(nt).length>0&&this._scene.setState(nt)}_handleInspectRepeatClone(ge){this._inspectEventSub||(this._inspectEventSub=this._scene.subscribeToEvent(Za.d,()=>{const Le=(0,K.vL)(this._scene,ge);Le&&(this._inspectEventSub?.unsubscribe(),this._scene.setState({inspectPanelKey:ge,overlay:new jo({panelRef:Le.getRef()})}))}))}_handleViewRepeatClone(ge){this._viewEventSub||(this._viewEventSub=this._scene.subscribeToEvent(Za.d,()=>{const Le=(0,K.vL)(this._scene,ge);Le&&(this._viewEventSub?.unsubscribe(),this._scene.setState({viewPanelScene:new ta({panelRef:Le.getRef()})}))}))}_waitForLibPanelToLoadBeforeEnteringPanelEdit(ge,Le){const he=Le.subscribeToState(Ae=>{Ae.isLoaded&&(this._scene.setState({editPanel:(0,qr.L)(ge)}),he.unsubscribe())})}}var ho=e(57852),Us=e(12469);class hn{constructor(){this._binds=[]}addBinding(ge){Us.R.bind(ge.key,Le=>{Le.preventDefault(),Le.stopPropagation(),Le.returnValue=!1,ge.onTrigger()},"keydown"),this._binds.push(ge)}removeAll(){this._binds.forEach(ge=>{Us.R.unbind(ge.key,ge.type)}),this._binds=[]}}var $s=e(58662),Ns=e(37040);function er(Ie){const ge=new hn;let Le=null;const he=Ie.canEditDashboard(),Ae=a.A.subscribe(ho.Tp,qe=>{typeof qe.payload.panelId=="string"&&(Le=qe.payload.panelId)});function Fe(qe,nt){return()=>{const ot=m.jh.findObject(qe,ut=>ut.state.key===Le);if(ot&&ot instanceof m.Eb){nt(ot);return}}}return ge.addBinding({key:"v",onTrigger:Fe(Ie,qe=>{if(Ie.state.viewPanelScene)o.Ny.push(t.I.getUrlForPartial(o.Ny.getLocation(),{viewPanel:void 0}));else{const nt=t.I.stripBaseFromUrl((0,ba.r7)(qe));o.Ny.push(nt)}})}),r.$.featureToggles.newDashboardSharingComponent?(ge.addBinding({key:"p u",onTrigger:Fe(Ie,async qe=>{const nt=new Vs.j({shareView:$s.wr.link,panelRef:qe.getRef()});Ie.showModal(nt)})}),ge.addBinding({key:"p e",onTrigger:Fe(Ie,async qe=>{const nt=new Vs.j({shareView:$s.wr.embed,panelRef:qe.getRef()});Ie.showModal(nt)})}),$a.TP.isSignedIn&&r.$.snapshotEnabled&&$a.TP.hasPermission(_e.AccessControlAction.SnapshotsCreate)&&ge.addBinding({key:"p s",onTrigger:Fe(Ie,async qe=>{const nt=new Vs.j({shareView:$s.wr.snapshot,panelRef:qe.getRef()});Ie.showModal(nt)})})):ge.addBinding({key:"p s",onTrigger:Fe(Ie,async qe=>{Ie.showModal(new Ur.Z({panelRef:qe.getRef()}))})}),ge.addBinding({key:"i",onTrigger:Fe(Ie,async qe=>
197{Ie.state.inspectPanelKey?o.Ny.push(t.I.getUrlForPartial(o.Ny.getLocation(),{inspect:void 0})):o.Ny.push(t.I.stripBaseFromUrl((0,ba.Uu)(qe)))})}),ge.addBinding({key:"p x",onTrigger:Fe(Ie,async qe=>{const nt=await(0,ba.Lp)(qe);nt&&o.Ny.push(nt)})}),ge.addBinding({key:"p l",onTrigger:Fe(Ie,Ns.vR)}),ge.addBinding({key:"d r",onTrigger:()=>m.jh.getTimeRange(Ie).onRefresh()}),ge.addBinding({key:"t z",onTrigger:()=>{ri(Ie)}}),ge.addBinding({key:"ctrl+z",onTrigger:()=>{ri(Ie)}}),ge.addBinding({key:"t a",onTrigger:()=>{Qn.b4.getTimePicker(Ie)?.toAbsolute()}}),ge.addBinding({key:"t left",onTrigger:()=>{fo(Ie,"left")}}),ge.addBinding({key:"t right",onTrigger:()=>{fo(Ie,"right")}}),he&&(ge.addBinding({key:"e",onTrigger:Fe(Ie,async qe=>{if(qe.getRoot()instanceof mo){const ot=(0,K.Cs)(qe);if(Ie.state.editPanel)o.Ny.push(t.I.getUrlForPartial(o.Ny.getLocation(),{editPanel:void 0}));else{const ut=t.I.stripBaseFromUrl((0,ba.e0)(ot));o.Ny.push(ut)}}})}),ge.addBinding({key:"d s",onTrigger:Ie.onOpenSettings}),ge.addBinding({key:"mod+s",onTrigger:()=>Ie.openSaveDrawer({})}),ge.addBinding({key:"p r",onTrigger:Fe(Ie,qe=>{Ie.state.isEditing&&(0,Ns.MI)(Ie,qe)})}),ge.addBinding({key:"p d",onTrigger:Fe(Ie,qe=>{Ie.state.isEditing&&Ie.duplicatePanel(qe)})}),ge.addBinding({key:"d shift+c",onTrigger:()=>{Ie.state.body instanceof Is.D&&Ie.state.body.collapseAllRows()}}),ge.addBinding({key:"d shift+e",onTrigger:()=>{Ie.state.body instanceof Is.D&&Ie.state.body.expandAllRows()}})),()=>{ge.removeAll(),Ae.unsubscribe()}}function ri(Ie){Qn.b4.getTimePicker(Ie)?.onZoom()}function fo(Ie,ge){const Le=Qn.b4.getTimePicker(Ie);Le&&(ge==="left"&&Le.onMoveBackward(),ge==="right"&&Le.onMoveForward())}var al=e(25953),sl=e(76173),mr=e(17084),vr=e(48492),po=e(15759);const rl=["title","description","tags","editable","graphTooltip","links","meta","preload"],oi="systemPanelFilterVar",go="systemDynamicRowSizeVar";class mo extends m.Bs{constructor(ge,Le="v1"){super({title:"Dashboard",meta:{},editable:!0,$timeRange:ge.$timeRange??new m.JZ({}),body:ge.body??Is.D.fromVizPanels(),links:ge.links??[],...ge,editPane:new de,scopesBridge:r.$.featureToggles.scopeFilters?new m.N1({}):void 0,layoutOrchestrator:new as}),this._urlSync=new nl(this),this._variableDependency=new ol(this),this._renderBeforeActivation=!0,this._layoutRestorer=new sl.r,this.onEnterEditMode=()=>{this._initialState=m.Go.cloneSceneObjectState(this.state),this._initialUrlState=o.Ny.getL
197ocation(),this.setState({isEditing:!0}),this.state.body.editModeChanged?.(!0),this.state.scopesBridge?.setReadOnly(!0),this._changeTracker.startTrackingChanges()},this.onRestore=async he=>{let Ae;if(r.$.featureToggles.kubernetesClientDashboardsFolders?Ae=await wn.wL.restoreDashboard(he.uid,he.id):Ae=await wn.wL.restoreDashboard(he.uid,he.version),!Number.isInteger(Ae.version))return!1;const Fe={dashboard:new x.G(he.data),meta:this.state.meta},qe=(0,Sn.wM)(Fe),nt=m.Go.cloneSceneObjectState(qe.state);return nt.version=Ae.version,this.setState(nt),this.exitEditMode({skipConfirm:!0,restoreInitialState:!1}),!0},this.onOpenSettings=()=>{o.Ny.partial({editview:"settings"})},this.getSnapshotUrl=()=>this.serializer.getSnapshotUrl(),this.onSetScrollRef=he=>{this._scrollRef=he},this.serializer=Ht(Le==="v2"?"v2":"v1"),this._changeTracker=new De.l(this),this.addActivationHandler(()=>this._activationHandler())}static{this.Component=Jr}_activationHandler(){this.state.scopesBridge?.setEnabled(!0);let ge=window.__grafanaSceneContext;const Le=o.Ny.getLocation().pathname==="/dashboard/new";window.__grafanaSceneContext=this,this._initializePanelSearch(),this.state.isEditing&&(this.state.scopesBridge?.setReadOnly(!0),this._initialUrlState=o.Ny.getL
197ocation(),this._changeTracker.startTrackingChanges()),Le&&(this.onEnterEditMode(),this.setState({isDirty:!0})),!this.state.meta.isEmbedded&&this.state.uid&&p.t.watch(this.state.uid);let he=()=>{};r.$.publicDashboardAccessToken||(he=er(this));const Ae=new Ca(this);return(0,i.UA)().setCurrent(Ae),()=>{this.state.scopesBridge?.setReadOnly(!1),this.state.scopesBridge?.setEnabled(!1),window.__grafanaSceneContext=ge,he(),this._changeTracker.terminate(),Ae.destroy(),p.t.leave()}}_initializePanelSearch(){const ge=m.jh.lookupVariable(oi,this)?.getValue();typeof ge=="string"&&this.setState({panelSearch:ge});const Le=m.jh.lookupVariable(go,this)?.getValue();if(typeof Le=="string"){const he=Number.parseInt(Le,10);this.setState({panelsPerRow:Number.isInteger(he)?he:void 0})}}saveCompleted(ge,Le,he){this.serializer.onSaveComplete(ge,Le),this._changeTracker.stopTrackingChanges(),this.setState({version:Le.version,isDirty:!1,uid:Le.uid,id:Le.id,meta:{...this.state.meta,uid:Le.uid,url:Le.url,slug:Le.slug,folderUid:he,version:Le.version},overlay:void 0}),this.state.editPanel?.dashboardSaved(),this._initialState=m.Go.cloneSceneObjectState(this.state),this._initialUrlState=o.Ny.getL
197ocation(),this._changeTracker.startTrackingChanges()}exitEditMode({skipConfirm:ge,restoreInitialState:Le}){if(!this.canDiscard()){console.error("Trying to discard back to a state that does not exist, initialState undefined");return}if(!this.state.isDirty||ge){this.exitEditModeConfirmed(Le||this.state.isDirty),this.state.scopesBridge?.setReadOnly(!1);return}a.A.publish(new y.bY({title:"Discard changes to dashboard?",text:"You have unsaved changes to this dashboard. Are you sure you want to discard them?",icon:"trash-alt",yesText:"Discard",onConfirm:()=>{this.exitEditModeConfirmed(),this.state.scopesBridge?.setReadOnly(!1)}}))}exitEditModeConfirmed(ge=!0){this._changeTracker.stopTrackingChanges();const Le=t.I.getUrlForPartial(this._initialUrlState,{editPanel:null,editview:null,inspect:null,inspectTab:null,shareView:null});o.Ny.replace(t.I.stripBaseFromUrl(Le)),ge?this.setState({...this._initialState,isEditing:!1}):this.setState({isEditing:!1}),this.state.editPanel&&this.state.editPanel.onDiscard(),this.state.body.editModeChanged?.(!1)}canDiscard(){return this._initialState!==void 0}pauseTrackingChanges(){this._changeTracker.stopTrackingChanges()}resumeTrackingChanges(){this._changeTracker.startTrackingChanges()}openSaveDrawer({saveAsCopy:ge,onSaveSuccess:Le}){this.state.isEditing&&this.setState({overlay:new Pt({dashboardRef:this.getRef(),saveAsCopy:ge,onSaveSuccess:Le})})}openV2SchemaEditor(){this.setState({overlay:new Ps({dashboardRef:this.getRef()})})}getPageNav(ge,Le){const{meta:he,viewPanelScene:Ae,editPanel:Fe,title:qe,uid:nt}=this.state,ot=!nt;let ut={text:qe,url:(0,Fn.u)({uid:nt,slug:he.slug,currentQueryParams:ge.search,updateQuery:{viewPanel:null,inspect:null,editview:null,editPanel:null,tab:null,shareView:null},isHomeDashboard:!he.url&&!he.slug&&!ot&&!he.isSnapshot,isSnapshot:he.isSnapshot})};const{folderUid:Ct}=he;if(Ct){const Lt=(0,f.tc)(Le,`folder-dashboards-${Ct}`).main;Lt.id!=="not-found"&&(ut={...ut,parentItem:Lt})}return Ae&&(ut={text:"View panel",parentItem:ut,url:(0,ba.r7)(Ae.state.panelRef.resolve())}),Fe&&(ut={text:"Edit panel",parentItem:ut}),ut}getBodyToRender(){return this.state.viewPanelScene??this.state.body}getInitialState(){return this._initialState}addPanel(ge){this.state.isEditing||this.onEnterEditMode();const Le=this.state.editPane.getSelection();if(Le&&!Array.isArray(Le)&&(0,po.l)(Le)){Le.getLayout().addPanel(ge);return}this.state.body.addPanel(ge)}createLibraryPanel(ge,Le){const he=ge.clone({$behaviors:[new br.u({uid:Le.uid,name:Le.name})]}),Ae=ge.parent;if(!(Ae instanceof V.U))throw new Error("Trying to replace a panel that doesn't have a parent grid item");Ae.setState({body:he})}duplicatePanel(ge){(0,K.h$)(ge).duplicatePanel?.(ge)}copyPanel(ge){if(r.$.featureToggles.dashboardNewLayouts){const Ae=ge.parent;if(Ae instanceof al.X){const Fe=(0,bn.V6)(Ae,this),qe=(0,cn.zd)(Ae);(0,vr.G2)(),h.A.set(l.tH,JSON.stringify({elements:Fe,gridItem:qe}))}else if(Ae instanceof V.U){const Fe=(0,bn.V6)(Ae,this),qe=(0,un.i2)(Ae);(0,vr.G2)(),h.A.set(l.tH,JSON.stringify({elements:Fe,gridItem:qe}))}else throw console.error("Trying to copy a panel that is not DashboardGridItem child"),new Error("Trying to copy a panel that is not DashboardGridItem child");return}if(!ge.parent)return;let Le=ge.parent;if(!(Le instanceof V.U))throw console.error("Trying to copy a panel that is not DashboardGridItem child"),new Error("Trying to copy a panel that is not DashboardGridItem child");const he=(0,En.ZB)(Le);(0,vr.G2)(),h.A.set(l.tH,JSON.stringify(he))}pastePanel(){const ge=h.A.get(l.tH),Le=JSON.parse(ge),he=new g.a9(Le),Fe=(0,Sn.tt)(he).state.body;this.addPanel(Fe),h.A.delete(l.tH)}removePanel(ge){(0,K.h$)(ge).removePanel?.(ge)}unlinkLibraryPanel(ge){if(!ge.parent)return;const Le=ge.parent;if(!(Le instanceof V.U)){console.error("Trying to unlink a lib panel in a layout that is not DashboardGridItem");return}Le.state.body.setState({$behaviors:void 0})}showModal(ge){this.setState({overlay:ge})}closeModal(){this.setState({overlay:void 0})}async onStarDashboard(){const{meta:ge,uid:Le}=this.state;if(Le)try{const he=await(0,i.UA)().starDashboard(Le,!!ge.isStarred);this.setState({meta:{...ge,isStarred:he}})}catch(he){console.error("Failed to star dashboard",he)}}onShowAddLibraryPanelDrawer(ge){this.setState({overlay:new zr({panelToReplaceRef:ge})})}onCreateNewRow(){const ge=this.state.editPane.getSelection();if(ge&&!Array.isArray(ge)&&(0,po.l)(ge)){const Le=ge.getLayout();return(0,mr.t)(Le)}return(0,mr.t)(this.state.body)}onCreateNewTab(){const ge=this.state.editPane.getSelection();if(ge&&!Array.isArray(ge)&&(0,po.l)(ge)){const Le=ge.getLayout();return(0,mr.A)(Le)}return(0,mr.A)(this.state.body)}
197onCreateNewPanel(){const ge=(0,K.O8)();return this.addPanel(ge),ge}switchLayout(ge){this.setState({body:this._layoutRestorer.getLayout(ge,this.state.body)}),this.state.body.activateRepeaters?.()}getLayout(){return this.state.body}enrichDataRequest(ge){const Le=(0,K.YQ)(ge);let he=(0,K.xz)(ge);Le.state.isEditing&&Le.state.editPanel&&(he=Le.state.editPanel.state.panelRef.resolve());let Ae=0;return he&&he.state.key&&((0,L.uc)(he.state.key)?Ae=Ha(he?.state.key):Ae=(0,K.Cs)(he)),{app:n.Jk.Dashboard,dashboardUID:this.state.uid,panelId:Ae,panelName:he?.state?.title,panelPluginId:he?.state.pluginId}}canEditDashboard(){const{meta:ge}=this.state;return!!(ge.canEdit||ge.canMakeEditable)}getInitialSaveModel(){return this.serializer.initialSaveModel}setInitialSaveModel(ge,Le){this.serializer.initializeElementMapping(ge),this.serializer.initializeDSReferencesMapping(ge);const he=(0,u.v)(ge);this.serializer.initialSaveModel=he,this.serializer.metadata=Le}getTrackingInformation(){return this.serializer.getTrackingInformation(this)}async onDashboardDelete(){this.setState({isDirty:!1}),o.Ny.replace("/")}getDashboardPanels(){return Qn.b4.getVizPanels(this)}rememberScrollPos(){this._prevScrollPos=this._scrollRef?.scrollTop}restoreScrollPos(){this._prevScrollPos!==void 0&&this._scrollRef?.scrollTo(0,this._prevScrollPos)}getSaveModel(){return this.serializer.getSaveModel(this)}getSaveResource(ge){const{meta:Le}=this.state,he=this.getSaveAsModel(ge);return{apiVersion:`dashboard.grafana.app/${this.serializer instanceof St?"v2alpha1":"v1alpha1"}`,kind:"Dashboard",metadata:{...Le.k8s,name:Le.uid??Le.k8s?.name,generateName:ge.isNew?"d":void 0},spec:he}}getSaveAsModel(ge){return this.serializer.getSaveAsModel(this,ge)}getDashboardChanges(ge,Le,he){return this.serializer.getDashboardChangesFromScene(this,{saveTimeRange:ge,saveVariables:Le,saveRefresh:he})}getManagerKind(){return this.state.meta.k8s?.annotations?.[P.LH]}isManaged(){return!!this.getManagerKind()}isManagedRepository(){return r.$.featureToggles.provisioning?this.getManagerKind()===P.Sf.Repo:!1}getPath(){return this.state.meta.k8s?.annotations?.[P.Y_]}}class ol{constructor(ge){this._dashboard=ge,this._emptySet=new Set}getNames(){return this._emptySet}hasDependencyOn(){return!1}variableUpdateCompleted(ge,Le){if(Le&&(a.A.publish(new c.og({refreshAll:!0,panelIds:[]})),this._dashboard.publishEvent(new s._)),ge.state.name===oi){const he=ge.getValue();typeof he=="string"&&this._dashboard.setState({panelSearch:he})}else if(ge.state.name===go){const he=ge.getValue();if(typeof he=="string"){const Ae=Number.parseInt(he,10);this._dashboard.setState({panelsPerRow:Number.isInteger(Ae)?Ae:void 0})}}}}function ii(Ie){return"elements"in Ie}},7094:(ee,B,e)=>{"use strict";e.d(B,{u:()=>g});var t=e(74848),n=e(16207),r=e(56838),o=e(41654),s=e(56840),m=e(82612),a=e(30124),l=e(18789),f=e(32540),h=e(37040),u=e(66251),i=e(81657),x=e(93389);class g extends r.Bs{static{this.LOADING_VIZ_PANEL_PLUGIN_ID="library-panel-loading-plugin"}constructor(P){super(P),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this.state.isLoaded||this.loadLibraryPanelFromPanelModel()}setPanelFromLibPanel(P){if(this.state._loadedPanel?.version===P.version)return;const d=this.parent;if(!(d instanceof r.Eb))return;const D=new m.a9(P.model),b=[];b.push(new f.$({rawLinks:D.links,menu:new f.m({$behaviors:[h.oV]})})),b.push(new u.W);const E={title:d.state.title??D.title,options:D.options??{},fieldConfig:D.fieldConfig,pluginId:D.type,pluginVersion:D.pluginVersion,displayMode:D.transparent?"transparent":void 0,description:D.description,titleItems:b,$data:(0,l.w)(D)};(D.timeFrom||D.timeShift)&&(E.$timeRange=new i.v({timeFrom:D.timeFrom,timeShift:D.timeShift,hideTimeOverride:D.hideTimeOverride})),d.setState(E),d.changePluginType(D.type,E.options,E.fieldConfig),this.setState({_loadedPanel:P,isLoaded:!0,name:P.name});const v=d.parent;D.repeat&&v instanceof x.U&&(v.setState({variableName:D.repeat,repeatDirection:D.repeatDirection==="h"?"h":"v",maxPerRow:D.maxPerRow,itemHeight:v.state.height??10}),v.performRepeat())}unlink(){const P=this.parent;P instanceof r.Eb&&P.setState({$behaviors:P.state.$behaviors?.filter(d=>d!==this)})}async loadLibraryPanelFromPanelModel(){let P=this.parent;if(P instanceof r.Eb)try{const d=await(0,a.Yr)(this.state.uid,!0);
197this.setPanelFromLibPanel(d)}catch{P.setState({_pluginLoadError:`Unable to load library panel: ${this.state.uid}`})}}}const p=new n.m(c);function c(y){return(0,t.jsx)(o.B,{direction:"column",justifyContent:"space-between",children:(0,t.jsx)(s.x6,{i18nKey:"library-panels.loading-panel-text",children:"Loading library panel"})})}r.Go.registerRuntimePanelPlugin({pluginId:g.LOADING_VIZ_PANEL_PLUGIN_ID,plugin:p})},8857:(ee,B,e)=>{"use strict";e.d(B,{c:()=>At});var t=e(74848),n=e(96540),r=e(22803),o=e(78012),s=e(85629),m=e(43173),a=e(36490),l=e(63142),f=e(7895),h=e(30703),u=e(99887),i=e(88559),x=e(87063),g=e(45861),p=e(93256),c=e(36219),y=e(43707),P=e(5423),d=e(65642),D=e(95943),b=e(73427),E=e(56840),v=e(22429),C=e(4590),S=e(96673),O=e(58662),I=e(25508),R=e(19164);const T=[],L=R.Ko.endpoints.listRepository.select({}),K=(0,I.Mz)(L,Dt=>Dt.data?.items||T),A=(0,I.Mz)(K,(Dt,qt)=>qt,(Dt,qt)=>{if(qt)return Dt.find(Yt=>Yt.metadata?.name===qt)}),W=(0,I.Mz)(K,(Dt,qt)=>qt,(Dt,qt)=>Dt.find(Yt=>Yt.metadata?.name===qt));var N=e(89451),w=e(23289);const j=s.Tp.pages.Dashboard.DashNav.NewExportButton.Menu,V=[];function U(Dt){V.push(Dt)}function F({dashboard:Dt}){const qt=Zt=>{a.Ny.partial({shareView:Zt})},Yt=(0,n.useCallback)(()=>{const Zt=[];return V.forEach(tn=>Zt.push(tn)),Zt.push({shareId:O.wr.export,testId:j.exportAsJson,icon:"arrow",label:(0,E.t)("share-dashboard.menu.export-json-title","Export as JSON"),renderCondition:!0,onClick:()=>qt(O.wr.export)}),Zt.filter(tn=>tn.renderCondition)},[]),nn=Zt=>{w.c.sharingCategoryClicked({item:Zt.shareId,shareResource:(0,O.hD)()}),Zt.onClick(Dt)};return(0,t.jsx)(x.W,{"data-testid":j.container,children:Yt().map(Zt=>(0,t.jsx)(x.W.Item,{testId:Zt.testId,label:Zt.label,icon:Zt.icon,description:Zt.description,onClick:()=>nn(Zt)},Zt.label))})}const M=s.Tp.pages.Dashboard.DashNav.NewExportButton;function H({dashboard:Dt}){const[qt,Yt]=(0,n.useState)(!1),nn=(0,n.useCallback)(tn=>{Yt(tn)},[]),Zt=()=>(0,t.jsx)(F,{dashboard:Dt});return(0,t.jsx)(p.e,{"data-testid":M.container,children:(0,t.jsx)(i.m,{overlay:Zt,placement:"bottom-end",onVisibleChange:nn,children:(0,t.jsxs)(g.$n,{"data-testid":M.arrowMenu,size:"sm",variant:"secondary",fill:"solid",tooltip:(0,E.t)("export.menu.export-as-json-tooltip","Export"),children:[(0,t.jsx)(E.x6,{i18nKey:"export.menu.export-as-json-label",children:"Export"}),"\xA0",(0,t.jsx)(h.I,{name:qt?"angle-up":"angle-down",size:"sm"})]})})})}var _=e(41053),Z=e(24313);const ne=s.Tp.pages.Dashboard.DashNav.newShareButton.menu;let te=[];function Y(Dt){te.push(Dt)}function Q(){te=[]}function J({dashboard:Dt,panel:qt}){const Yt=tn=>{a.Ny.partial({shareView:tn})},nn=(0,n.useCallback)(()=>{const tn=[];return tn.push({shareId:O.wr.link,testId:ne.shareInternally,icon:"building",label:(0,E.t)("share-dashboard.menu.share-internally-title","Share internally"),renderCondition:!0,onClick:()=>Yt(O.wr.link)}),tn.push({shareId:O.wr.publicDashboard,testId:ne.shareExternally,icon:"share-alt",label:(0,E.t)("share-dashboard.menu.share-externally-title","Share externally"),renderCondition:!qt&&(0,Z.iR)(),onClick:()=>{Yt(O.wr.publicDashboard)}}),tn.push({shareId:O.wr.snapshot,testId:ne.shareSnapshot,icon:"camera",label:(0,E.t)("share-dashboard.menu.share-snapshot-title","Share snapshot"),renderCondition:b.TP.isSignedIn&&m.$.snapshotEnabled&&b.TP.hasPermission(S.AccessControlAction.SnapshotsCreate),onClick:()=>{Yt(O.wr.snapshot)}}),te.forEach(ft=>tn.push(ft)),tn.filter(ft=>ft.renderCondition)},[qt]),Zt=tn=>{w.c.sharingCategoryClicked({item:tn.shareId,shareResource:(0,O.hD)(qt?.getRef())}),tn.onClick(Dt)};return(0,t.jsx)(x.W,{"data-testid":ne.container,children:nn().map(tn=>(0,t.jsxs)(n.Fragment,{children:[tn.renderDividerAbove&&(0,t.jsx)(x.W.Divider,{}),(0,t.jsx)(x.W.Item,{testId:tn.testId,label:tn.label,icon:tn.icon,description:tn.description,component:tn.component,className:tn.className,onClick:()=>Zt(tn)})]},tn.shareId))})}var q=e(12434);const X=s.Tp.pages.Dashboard.DashNav.newShareButton;function se({dashboard:Dt,panel:qt}
197){const Yt=(0,l.of)(oe),[nn,Zt]=(0,n.useState)(!1),[tn,ft]=(0,_.A)(async()=>(w.c.toolbarShareClick(),await(0,q.Xe)(Dt,qt)),[Dt]),Rt=(0,n.useCallback)(jt=>{jt&&w.c.toolbarShareDropdownClick(),Zt(jt)},[]),Bt=()=>(0,t.jsx)(J,{dashboard:Dt});return(0,t.jsxs)(p.e,{"data-testid":X.container,className:Yt.container,children:[(0,t.jsx)(g.$n,{"data-testid":X.shareLink,size:"sm",tooltip:(0,E.t)("share-dashboard.share-button-tooltip","Copy link"),onClick:ft,children:(0,t.jsx)(E.x6,{i18nKey:"share-dashboard.share-button",children:"Share"})}),(0,t.jsx)(i.m,{overlay:Bt,placement:"bottom-end",onVisibleChange:Rt,children:(0,t.jsx)(g.$n,{"aria-label":(0,E.t)("dashboard-scene.share-button.aria-label-sharedropdownmenu","Toggle share menu"),"data-testid":X.arrowMenu,size:"sm",icon:nn?"angle-up":"angle-down"})})]})}function oe(Dt){return{container:(0,r.css)({gap:1})}}var ae=e(75541),ie=e(8285),fe=e(63704),pe=e(71599),de=e(45229),le=e(87745);function me(Dt){return(0,t.jsx)(f.I,{"data-testid":"button-snapshot",tooltip:(0,E.t)("dashboard.toolbar.open-original","Open original dashboard"),icon:"link",onClick:()=>De(Dt.originalURL)},"button-snapshot")}const De=Dt=>{const qt=Dt??"",Yt=fe.sQ.sanitizeUrl(qt);try{const nn=new URL(Yt,m.$.appUrl),Zt=new URL(m.$.appUrl);nn.host!==Zt.host?de.A.publish(new le.S8({component:pe.u,props:{title:"Proceed to external site?",modalClass:(0,r.css)({width:"max-content",maxWidth:"80vw"}),body:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{children:["This link connects to an external website at"," ",(0,t.jsx)("code",{children:qt})]}),(0,t.jsx)("p",{children:"Are you sure you'd like to proceed?"})]}),confirmVariant:"primary",confirmText:"Proceed",onConfirm:()=>{window.location.href=nn.href}}})):a.Ny.push(Yt)}catch(nn){console.error("Failed to open original dashboard",nn)}};var Te=e(75735);function Ne({meta:Dt}){const qt=Dt.k8s;if(!qt?.annotations)return;let Yt="Provisioned";const nn=qt.annotations?.[Te.LH],Zt=qt.annotations?.[Te.Jw];switch(nn){case Te.Sf.Terraform:Yt="Terraform";break;case Te.Sf.Kubectl:Yt="Kubectl";break;case Te.Sf.Plugin:Yt=`Plugin: ${Zt}`;break}return(0,t.jsx)(u.E,{color:"purple",icon:"exchange-alt",tooltip:Yt},"provisioned-dashboard-button-badge")}const Ce=({dashboard:Dt})=>{if(!Dt.state.meta.k8s?.annotations)return null;let qt="Provisioned";const Yt=Dt.state.meta.k8s.annotations[Te.LH],nn=Dt.state.meta.k8s.annotations[Te.Jw];switch(Yt){case Te.Sf.Terraform:qt="Terraform";break;case Te.Sf.Kubectl:qt="Kubectl";break;case Te.Sf.Plugin:qt=`Plugin: ${nn}`;break;case Te.Sf.Repo:qt="Repository";break}return(0,t.jsx)(u.E,{color:"purple",icon:"exchange-alt",tooltip:qt},"provisioned-dashboard-button-badge")},He=({dashboard:Dt})=>(0,t.jsx)(me,{originalURL:Dt.getSnapshotUrl()??""}),ke=({})=>{const Dt=(0,l.of)(Me);return(0,t.jsx)(u.E,{color:"blue",text:(0,E.t)("dashboard.toolbar.new.public-dashboard","Public"),className:Dt.badge,"data-testid":s.Tp.pages.Dashboard.DashNav.publicDashboardTag})},Me=()=>({badge:(0,r.css)({color:"grey",backgroundColor:"transparent",border:"1px solid"})}),$e=({dashboard:Dt})=>(0,t.jsx)(f.I,{tooltip:Dt.state.meta.isStarred?(0,E.t)("dashboard.toolbar.new.unmark-favorite","Unmark as favorite"):(0,E.t)("dashboard.toolbar.new.mark-favorite","Mark as favorite"),icon:(0,t.jsx)(h.I,{name:Dt.state.meta.isStarred?"favorite":"star",size:"lg",type:Dt.state.meta.isStarred?"mono":"default"}),"data-testid":s.Tp.components.NavToolbar.markAsFavorite,onClick:()=>{w.c.toolbarFavoritesClick(),Dt.onStarDashboard()}});function tt(Dt,qt){const Yt=[];let nn="";for(const Zt of Dt)Zt.condition&&(Zt.group&&nn&&nn!==Zt.group&&Yt.push((0,t.jsx)(P.K,{},`${Zt.group}-separator`)),Yt.push((0,t.jsx)(Zt.component,{dashboard:qt},Zt.key)),nn=Zt.group);return Yt}function Ke(Dt,qt,Yt){const nn=(0,v.UA)().getCurrent();return Dt.reduce((Zt,tn)=>{const ft={dashboard:nn};return tn.show(ft)&&Zt.push({key:Zt.length.toString(),group:qt,condition:Yt,component:()=>(0,t.jsx)(tn.component,{...ft})}),Zt},[])}const Re=({dashboard:Dt})=>{const{editview:qt,editPanel:Yt,isEditing:nn,uid:Zt,meta:tn,viewPanelScene:ft}=Dt.useState(),Rt=!!qt,Bt=!!ft,jt=!!nn,Nt=!!Yt,$t=!!tn.publicDashboardEnabled,an=!!Zt,Jt=!!tn.canEdit,gn=!!tn.canStar,mn=!!tn.isSnapshot,_t=!Rt&&!Bt&&!Nt,On=tt([...Ke(ae.C.left,"left-dynamic",!Nt),{key:"star-button",component:$e,group:"actions",condition:an&&gn&&_t&&!jt},{key:"public-dashboard-badge",component:ke,group:"actions",condition:$t&&an&&gn&&_t&&!jt},{key:"managed-dashboard-badge",component:Ce,group:"actions",condition:Dt.isManaged()&&Jt},{key:"open-snapshot-origin-button",component:He,group:"actions",condition:mn&&!jt}],Dt);return On.length===0?null:(0,t.jsx)(c.U,{alignment:"left",children:On})};var Ve=e(15130);const Qe=({dashboard:Dt})=>(0,t.jsx)(g.$n,{onClick:()=>a.Ny.partial(Dt.state.editview?{editview:null}:{viewPanel:null,editPanel:null}),tooltip:"",fill:Dt.state.editview?"text":void 0,variant:"secondary",size:"sm",icon:"arrow-left","data-testid":s.Tp.components.NavToolbar.editDashboard.backToDashboardButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.back-to-dashboard",children:"Back to dashboard"})}),je=({dashboard:Dt})=>(0,t.jsx)(f.I,{tooltip:(0,E.t)("dashboard.toolbar.new.dashboard-settings.tooltip","Dashboard settings"),icon:(0,t.jsx)(h.I,{name:"cog",size:"lg",type:"default"}),onClick:()=>Dt.onOpenSettings(),"data-testid":s.Tp.components.NavToolbar.editDashboard.settingsButton}),ze=({dashboard:Dt})=>(0,t.jsx)(g.$n,{onClick:()=>Dt.state.editPanel?.onDiscard(),tooltip:(0,E.t)("dashboard.toolbar.new.discard-library-panel-changes","Discard library panel changes"),size:"sm",fill:"outline",variant:"destructive","data-testid":s.Tp.components.NavToolbar.editDashboard.discardChangesButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.discard-library-panel-changes",children:"Discard library panel changes"})}),Ye=({dashboard:Dt})=>{const qt=Ge(Dt.state.editPanel);return(0,t.jsx)(g.$n,{onClick:()=>Dt.state.editPanel?.onDiscard(),tooltip:Dt.state.editPanel?.state.isNewPanel?(0,E.t)("dashboard.toolbar.new.discard-panel-new","Discard panel"):(0,E.t)("dashboard.toolbar.new.discard-panel","Discard panel changes"),size:"sm",disabled:!qt,fill:"outline",variant:"destructive","data-testid":s.Tp.components.NavToolbar.editDashboard.discardChangesButton,children:Dt.state.editPanel?.state.isNewPanel?(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.discard-panel-new",children:"Discard panel"}):(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.discard-panel",children:"Discard panel changes"})})};
197function Ge(Dt){const[qt,Yt]=(0,n.useState)();return(0,n.useEffect)(()=>{if(Dt){const nn=Dt.subscribeToState(Zt=>{Zt.isDirty!==qt&&Yt(Zt.isDirty)});return()=>nn.unsubscribe()}},[Dt,qt]),qt}var ce=e(45967);const Pe=({icon:Dt,label:qt,checked:Yt,checkedIcon:nn,checkedLabel:Zt,disabled:tn,onClick:ft,"data-testId":Rt})=>{const Bt=(0,l.of)(Se),jt=Yt&&Zt?Zt:qt,Nt=Yt&&nn?nn:Dt;return(0,t.jsx)(ce.m,{content:jt,children:(0,t.jsx)("div",{"aria-label":jt,role:"button",className:(0,r.cx)({[Bt.container]:!0,[Bt.containerChecked]:Yt,[Bt.containerDisabled]:tn}),"data-testid":Rt,onClick:tn?void 0:ft,children:(0,t.jsx)("div",{className:(0,r.cx)(Bt.box,Yt&&Bt.boxChecked),children:(0,t.jsx)(h.I,{name:Nt,size:"xs"})})})})},Se=Dt=>({container:(0,r.css)({border:`1px solid ${Dt.components.input.borderColor}`,padding:Dt.spacing(.25),backgroundColor:Dt.components.input.background,borderRadius:Dt.shape.radius.default,width:Dt.spacing(5.5),height:Dt.spacing(3),cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",[Dt.transitions.handleMotion("no-preference","reduce")]:{transition:"all 0.2s ease-in-out"},"&:hover":{borderColor:Dt.components.input.borderHover}}),containerChecked:(0,r.css)({backgroundColor:Dt.colors.primary.main,borderColor:"transparent","&:hover":{backgroundColor:Dt.colors.primary.shade,borderColor:"transparent"}}),containerDisabled:(0,r.css)({cursor:"initial",background:Dt.colors.action.disabledBackground,borderColor:Dt.colors.border.weak}),box:(0,r.css)({background:Dt.colors.background.primary,display:"flex",alignItems:"center",justifyContent:"center",width:Dt.spacing(2.5),height:Dt.spacing(2.5),borderRadius:Dt.shape.radius.default,transform:"translateX(0)",position:"relative",[Dt.transitions.handleMotion("no-preference","reduce")]:{transition:"all 0.2s ease-in-out"},"&:after":(0,r.css)({content:"''",position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:Dt.shape.radius.default,background:Dt.colors.secondary.main,border:`1px solid ${Dt.colors.secondary.border}`})}),boxChecked:(0,r.css)({transform:`translateX(calc(100% - ${Dt.spacing(.25)}))`})}),Ee=({dashboard:Dt})=>(0,t.jsx)(Pe,{checked:!!Dt.state.isEditing,icon:"pen",label:(0,E.t)("dashboard.toolbar.new.edit-toggle.enter.label","Enter edit mode"),checkedLabel:(0,E.t)("dashboard.toolbar.new.edit-toggle.exit.label","Exit edit mode"),disabled:C._o.state.isPlaying,"data-testid":s.Tp.components.NavToolbar.editDashboard.editButton,onClick:qt=>{qt.preventDefault(),qt.stopPropagation(),Dt.state.isEditing?Dt.exitEditMode({skipConfirm:!1}):Dt.onEnterEditMode()}}),xe=({dashboard:Dt,menu:qt,onMenuVisibilityChange:Yt,groupTestId:nn,buttonLabel:Zt,buttonTooltip:tn,buttonTestId:ft,onButtonClick:Rt,arrowLabel:Bt,arrowTestId:jt,variant:Nt="secondary"})=>{const[$t,an]=(0,n.useState)(!1);return(0,t.jsxs)(p.e,{"data-testid":nn,onPointerDown:Jt=>{Dt.state.isEditing&&Dt.state.isDirty&&(Jt.preventDefault(),Jt.stopPropagation(),de.A.publish(new le.bY({title:(0,E.t)("dashboard.toolbar.new.share-export.modal.title","Save changes to dashboard?"),text:(0,E.t)("dashboard.toolbar.new.share-export.modal.text","You have unsaved changes to this dashboard. You need to save them before you can share it."),icon:"exclamation-triangle",noText:(0,E.t)("dashboard.toolbar.new.share-export.modal.noText","Discard"),yesText:(0,E.t)("dashboard.toolbar.new.share-export.modal.yesText","Save"),yesButtonVariant:"primary",onConfirm:()=>Dt.openSaveDrawer({})})))},children:[(0,t.jsx)(g.$n,{"data-testid":ft,size:"sm",tooltip:tn,variant:Nt,onClick:Rt,children:Zt}),(0,t.jsx)(i.m,{overlay:qt,placement:"bottom-end",onVisibleChange:Jt=>{Dt.state.isEditing&&Dt.state.isDirty||(Yt?.(Jt),an(Jt))},children:(0,t.jsx)(g.$n,{"aria-label":Bt,"data-testid":jt,size:"sm",icon:$t?"angle-up":"angle-down",variant:Nt})})]})},ye=s.Tp.pages.Dashboard.DashNav.NewExportButton,Oe=({dashboard:Dt})=>(0,t.jsx)(xe,{menu:()=>(0,t.jsx)(F,{dashboard:Dt}),groupTestId:ye.container,buttonLabel:(0,E.t)("dashboard.toolbar.new.export.title","Export"),buttonTooltip:(0,E.t)("dashboard.toolbar.new.export.tooltip","Export as JSON"),buttonTestId:ye.container,onButtonClick:()=>{a.Ny.partial({shareView:O.wr.export}),w.c.sharingCategoryClicked({item:O.wr.export,shareResource:(0,O.hD)()})},arrowLabel:(0,E.t)("dashboard.toolbar.new.export.arrow","Export"),arrowTestId:ye.arrowMenu,dashboard:Dt}),we=({dashboard:Dt})=>(0,t.jsx)(g.$n,{disabled:C._o.state.isPlaying,onClick:()=>{Dt.onEnterEditMode(),Dt.setState({editable:!0,meta:{...Dt.state.meta,canEdit:!0}})},tooltip:(0,E.t)("dashboard.toolbar.new.enter-edit-mode.tooltip","This dashboard was marked as read only"),variant:"secondary",size:"sm","data-testid":s.Tp.components.NavToolbar.editDashboard.editButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.enter-edit-mode.label",children:"Make editable"})}),Be=({})=>(0,t.jsx)(f.I,{"data-testid":s.Tp.pages.Dashboard.DashNav.playlistControls.next,tooltip:(0,E.t)("dashboard.toolbar.new.playlist-next","Go to
197next dashboard"),icon:"forward",onClick:()=>C._o.next(),narrow:!0}),Xe=({})=>(0,t.jsx)(f.I,{"data-testid":s.Tp.pages.Dashboard.DashNav.playlistControls.prev,tooltip:(0,E.t)("dashboard.toolbar.new.playlist-previous","Go to previous dashboard"),icon:"backward",onClick:()=>C._o.prev()}),st=({})=>(0,t.jsx)(f.I,{onClick:()=>C._o.stop(),"data-testid":s.Tp.pages.Dashboard.DashNav.playlistControls.stop,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.playlist-stop",children:"Stop playlist"})}),lt=({dashboard:Dt})=>{const{meta:qt,isDirty:Yt,uid:nn}=Dt.state,Zt=!(nn||Dt.isManaged()),tn=Dt.isManaged();return Zt?(0,t.jsx)(g.$n,{onClick:()=>Dt.openSaveDrawer({}),tooltip:(0,E.t)("dashboard.toolbar.new.save-dashboard.tooltip","Save changes"),size:"sm",variant:"primary","data-testid":s.Tp.components.NavToolbar.editDashboard.saveButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.save-dashboard.label",children:"Save"})}):Ve.TP.hasEditPermissionInFolders&&!qt.canSave&&!qt.canMakeEditable&&!tn?(0,t.jsx)(g.$n,{onClick:()=>Dt.openSaveDrawer({saveAsCopy:!0}),tooltip:(0,E.t)("dashboard.toolbar.new.save-dashboard-copy.tooltip","Save as copy"),size:"sm",variant:Yt?"primary":"secondary",children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.save-dashboard-copy.label",children:"Save as copy"})}):(0,t.jsxs)(p.e,{children:[(0,t.jsx)(g.$n,{onClick:()=>Dt.openSaveDrawer({}),tooltip:(0,E.t)("dashboard.toolbar.new.save-dashboard.tooltip","Save changes"),size:"sm","data-testid":s.Tp.components.NavToolbar.editDashboard.saveButton,variant:Yt?"primary":"secondary",children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.save-dashboard.label",children:"Save"})}),(0,t.jsx)(i.m,{overlay:(0,t.jsxs)(x.W,{children:[(0,t.jsx)(x.W.Item,{label:(0,E.t)("dashboard.toolbar.new.save-dashboard-short","Save"),icon:"save",onClick:()=>Dt.openSaveDrawer({})}),(0,t.jsx)(x.W.Item,{label:(0,E.t)("dashboard.toolbar.new.save-dashboard-copy.label","Save as copy"),icon:"copy",onClick:()=>Dt.openSaveDrawer({saveAsCopy:!0})})]}),children:(0,t.jsx)(g.$n,{"aria-label":(0,E.t)("dashboard.toolbar.new.more-save-options","More save options"),icon:"angle-down",variant:Yt?"primary":"secondary",size:"sm"})})]})},Et=({dashboard:Dt})=>(0,t.jsx)(g.$n,{onClick:()=>Dt.state.editPanel?.onSaveLibraryPanel(),tooltip:(0,E.t)("dashboard.toolbar.new.save-library-panel","Save library panel"),size:"sm",fill:"outline",variant:"primary","data-testid":s.Tp.components.NavToolbar.editDashboard.saveLibraryPanelButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.save-library-panel",children:"Save library panel"})}),Tt=s.Tp.pages.Dashboard.DashNav.newShareButton,Mt=({dashboard:Dt})=>{const[qt,Yt]=(0,_.A)(async()=>(w.c.toolbarShareClick(),await(0,q.Xe)(Dt)),[Dt]);return(0,t.jsx)(xe,{menu:()=>(0,t.jsx)(J,{dashboard:Dt}),onMenuVisibilityChange:nn=>{nn&&w.c.toolbarShareDropdownClick()},groupTestId:Tt.shareLink,buttonLabel:(0,E.t)("dashboard.toolbar.new.share.title","Share"),buttonTooltip:(0,E.t)("dashboard.toolbar.new.share.tooltip","Copy link"),buttonTestId:Tt.container,onButtonClick:Yt,arrowLabel:(0,E.t)("dashboard.toolbar.new.share.arrow","Share"),arrowTestId:Tt.arrowMenu,dashboard:Dt,variant:Dt.state.isEditing?"secondary":"primary"})},wt=({dashboard:Dt})=>(0,t.jsx)(g.$n,{onClick:()=>Dt.state.editPanel?.onUnlinkLibraryPanel(),tooltip:(0,E.t)("dashboard.toolbar.new.unlink-library-panel","Unlink library panel"),size:"sm",fill:"outline",variant:"secondary","data-testid":s.Tp.components.NavToolbar.editDashboard.unlinkLibraryPanelButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.new.unlink-library-panel",children:"Unlink library panel"})}),_e=({dashboard:Dt})=>{const{editPanel:qt,editable:Yt,editview:nn,isEditing:Zt,uid:tn,meta:ft,viewPanelScene:Rt}=Dt.useState(),{isPlaying:Bt}=C._o.useState(),jt=(0,l.of)(xt),Nt=!!Yt,$t=!!ft.canSave,an=!!tn,Jt=!!Zt,gn=!!nn,mn=!!qt,_t=!!Rt,On=mn&&(0,ie.ME)(qt.state.panelRef.resolve()),Nn=!gn&&!_t&&!mn,Fn=Jt&&Nn,na=!!ft.isSnapshot,aa=Ve.TP.hasEditPermissionInFolders,yt=mn&&!gn&&!_t,mt=Bt&&Nn&&!Jt,Ot=an&&!na&&!Bt&&!mn;return(0,t.jsx)(c.U,{alignment:"right",className:jt.container,children:tt([...Ke(ae.C.right,"",!mn&&!Jt),{key:"play-list-previous-button",component:Xe,group:"playlist",condition:mt},{key:"play-list-stop-button",component:st,group:"playlist",condition:mt},{key:"play-list-next-button",component:Be,group:"playlist",condition:mt},{key:"back-to-dashboard-button",component:Qe,group:"panel",condition:gn||(_t||mn)&&!On},{key:"discard-panel-button",component:Ye,group:"panel",condition:yt&&!On},{key:"discard-library-panel-button",component:ze,group:"panel",condition:yt&&On},{key:"unlink-library-panel-button",component:wt,group:"panel",condition:yt&&On},{key:"save-library-panel-button",component:Et,group:"panel",condition:yt&&On},{key:"dashboard-settings",component:je,group:"dashboard",condition:Fn&&Dt.canEditDashboard()},{key:"save-dashboard",component:lt,group:"save-edit",condition:Jt&&!On&&($t||aa)},{key:"make-dashboard-editable-button",component:we,group:"save-edit",condition:!Zt&&Dt.canEditDashboard()&&!_t&&!Nt&&!Bt},{key:"edit-dashboard-switch",component:Ee,group:"save-edit",condition:Dt.canEditDashboard()&&!mn&&!On&&!_t&&Nt&&!Bt&&!mn},{key:"new-export-dashboard-button",component:Oe,group:"export-share",condition:Ot},{key:"new-share-dashboard-button",component:Mt,group:"export-share",condition:Ot}],Dt)})},xt=Dt=>({container:(0,r.css)({paddingLeft:Dt.spacing(.5)})}),At=(0,n.memo)(({dashboard:Dt})=>m.$.featureToggles.dashboardNewLayouts&&m.$.featureToggles.newDashboardSharingComponent?(0,t.jsx)(y.H,{breadcrumbActions:(0,t.jsx)(Re,{dashboard:Dt}),actions:(0,t.jsx)(_e,{dashboard:Dt})}):(0,t.jsx)(y.H,{actions:(0,t.jsx)(bt,{dashboard:Dt})}));At.displayName="NavToolbarActions";function bt({dashboard:Dt}){const{isEditing:qt,viewPanelScene:Yt,isDirty:nn,uid:Zt,meta:tn,editview:ft,editPanel:Rt,editable:Bt}=Dt.useState(),{isPlaying:jt}
197=C._o.useState(),[Nt,$t]=(0,n.useState)(!1),an=b.TP.hasEditPermissionInFolders,Jt=[],gn=(0,l.of)(Wn),mn=!!Rt,_t=!!Yt,On=vn(Rt),Nn=Rt&&(0,ie.ME)(Rt.state.panelRef.resolve()),Fn=!(Zt||Dt.isManaged()),na=o.M.exists(D.tH),aa=!ft&&!_t&&!mn,yt=qt&&aa,mt=(0,S.useSelector)(Je=>A(Je,tn.folderUid)),Ot=!!(Dt.isManagedRepository()||mt),Wt=d.Ay.viewersCanEdit;mn||Cn(Jt,ae.C.left,"left-actions"),Jt.push({group:"icon-actions",condition:Zt&&!!tn.canStar&&aa&&!qt,render:()=>{let Je=tn.isStarred?(0,E.t)("dashboard.toolbar.unmark-favorite","Unmark as favorite"):(0,E.t)("dashboard.toolbar.mark-favorite","Mark as favorite");return(0,t.jsx)(f.I,{tooltip:Je,icon:(0,t.jsx)(h.I,{name:tn.isStarred?"favorite":"star",size:"lg",type:tn.isStarred?"mono":"default"}),"data-testid":s.Tp.components.NavToolbar.markAsFavorite,onClick:()=>{w.c.toolbarFavoritesClick(),Dt.onStarDashboard()}},"star-dashboard-button")}}),tn.publicDashboardEnabled&&Jt.push({group:"icon-actions",condition:Zt&&!!tn.canStar&&aa&&!qt,render:()=>(0,t.jsx)(u.E,{color:"blue",text:(0,E.t)("dashboard.toolbar.public-dashboard","Public"),className:gn.publicBadge,"data-testid":s.Tp.pages.Dashboard.DashNav.publicDashboardTag},"public-dashboard-button-badge")}),Dt.isManaged()&&tn.canEdit&&Jt.push({group:"icon-actions",condition:!0,render:()=>(0,t.jsx)(Ne,{meta:tn},"managed-dashboard-badge")}),Jt.push({group:"icon-actions",condition:tn.isSnapshot&&!qt,render:()=>(0,t.jsx)(me,{originalURL:Dt.getSnapshotUrl()??""},"go-to-snapshot-origin")}),!mn&&!qt&&Cn(Jt,ae.C.right,"icon-actions"),Jt.push({group:"add-panel",condition:yt,render:()=>(0,t.jsx)(i.m,{onVisibleChange:Je=>{$t(Je),w.c.toolbarAddClick()},overlay:()=>(0,t.jsxs)(x.W,{children:[(0,t.jsx)(x.W.Item,{testId:s.Tp.pages.AddDashboard.itemButton("Add new visualization menu item"),label:(0,E.t)("dashboard.add-menu.visualization","Visualization"),onClick:()=>{const Je=Dt.onCreateNewPanel();w.c.toolbarAddButtonClicked({item:"add_visualization"}),Dt.setState({editPanel:(0,N.L)(Je,!0)})}},"add-visualization"),(0,t.jsx)(x.W.Item,{testId:s.Tp.pages.AddDashboard.itemButton("Add new panel from panel library menu item"),label:(0,E.t)("dashboard.add-menu.import","Import from library"),onClick:()=>{Dt.onShowAddLibraryPanelDrawer(),w.c.toolbarAddButtonClicked({item:"add_library_panel"})},disabled:Dt.isManagedRepository()},"add-panel-lib"),(0,t.jsx)(x.W.Item,{testId:s.Tp.pages.AddDashboard.itemButton("Add new row menu item"),label:(0,E.t)("dashboard.add-menu.row","Row"),onClick:()=>{Dt.onCreateNewRow(),w.c.toolbarAddButtonClicked({item:"add_row"})}},"add-row"),(0,t.jsx)(x.W.Item,{disabled:!na,testId:s.Tp.pages.AddDashboard.itemButton("Add new panel from clipboard menu item"),label:(0,E.t)("dashboard.add-menu.paste-panel","Paste panel"),onClick:()=>{Dt.pastePanel(),w.c.toolbarAddButtonClicked({item:"paste_panel"})}},"paste-panel")]}),placement:"bottom",offset:[0,6],children:(0,t.jsxs)(g.$n,{variant:"primary",size:"sm",fill:"outline","data-testid":s.Tp.components.PageToolbar.itemButton("Add button"),children:[(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.add",children:"Add"}),(0,t.jsx)(h.I,{name:Nt?"angle-up":"angle-down",size:"lg"})]},"add-panel-button")},"add-panel-dropdown")}),Jt.push({group:"playlist-actions",condition:jt&&aa&&!qt,render:()=>(0,t.jsx)(f.I,{"data-testid":s.Tp.pages.Dashboard.DashNav.playlistControls.prev,tooltip:(0,E.t)("dashboard.toolbar.playlist-previous","Go to previous dashboard"),icon:"backward",onClick:()=>C._o.prev()},"play-list-prev")}),Jt.push({group:"playlist-actions",condition:jt&&aa&&!qt,render:()=>(0,t.jsx)(f.I,{onClick:()=>C._o.stop(),"data-testid":s.Tp.pages.Dashboard.DashNav.playlistControls.stop,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.playlist-stop",children:"Stop playlist"})},"play-list-stop")}),Jt.push({group:"playlist-actions",condition:jt&&aa&&!qt,render:()=>(0,t.jsx)(f.I,{"data-testid":s.Tp.pages.Dashboard.DashNav.playlistControls.next,tooltip:(0,E.t)("dashboard.toolbar.playlist-next","Go to next dashboard"),icon:"forward",onClick:()=>C._o.next(),narrow:!0},"play-list-next")}),Jt.push({group:"back-button",condition:(_t||mn)&&!Nn,render:()=>(0,t.jsx)(g.$n,{onClick:()=>{a.Ny.partial({viewPanel:null,editPanel:null})},tooltip:"",variant:"secondary",size:"sm",icon:"arrow-left","data-testid":s.Tp.components.NavToolbar.editDashboard.backToDashboardButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.back-to-dashboard",children:"Back to dashboard"})},"back")}),Jt.push({group:"back-button",condition:!!ft,render:()=>(0,t.jsx)(g.$n,{onClick:()=>{a.Ny.partial({editview:null})},tooltip:"",fill:"text",variant:"secondary",size:"sm",icon:"arrow-left","data-testid":s.Tp.components.NavToolbar.editDashboard.backToDashboardButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.back-to-dashboard",children:"Back to dashboard"})},"back")});const et=Zt&&!qt&&!tn.isSnapshot&&!jt;
197return Jt.push({group:"main-buttons",condition:!m.$.featureToggles.newDashboardSharingComponent&&et,render:()=>(0,t.jsx)(g.$n,{tooltip:(0,E.t)("dashboard.toolbar.share.tooltip","Share dashboard"),size:"sm",className:gn.buttonWithExtraMargin,fill:"outline",onClick:()=>{w.c.toolbarShareClick(),a.Ny.partial({shareView:O.wr.link})},"data-testid":s.Tp.components.NavToolbar.shareDashboard,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.share.label",children:"Share"})},"share-dashboard-button")}),Jt.push({group:"main-buttons",condition:!qt&&(Dt.canEditDashboard()||Wt)&&!_t&&!jt&&Bt,render:()=>(0,t.jsx)(g.$n,{onClick:()=>{Dt.onEnterEditMode()},tooltip:(0,E.t)("dashboard.toolbar.edit.tooltip","Enter edit mode"),className:gn.buttonWithExtraMargin,variant:m.$.featureToggles.newDashboardSharingComponent?"secondary":"primary",size:"sm","data-testid":s.Tp.components.NavToolbar.editDashboard.editButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.edit.label",children:"Edit"})},"edit")}),Jt.push({group:"main-buttons",condition:!qt&&Dt.canEditDashboard()&&!_t&&!jt&&!Bt,render:()=>(0,t.jsx)(g.$n,{onClick:()=>{Dt.onEnterEditMode(),Dt.setState({editable:!0,meta:{...tn,canEdit:!0}})},tooltip:(0,E.t)("dashboard.toolbar.enter-edit-mode.tooltip","This dashboard was marked as read only"),className:gn.buttonWithExtraMargin,variant:"secondary",size:"sm","data-testid":s.Tp.components.NavToolbar.editDashboard.editButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.enter-edit-mode.label",children:"Make editable"})},"edit")}),Jt.push({group:"new-share-dashboard-buttons",condition:m.$.featureToggles.newDashboardSharingComponent&&et,render:()=>(0,t.jsx)(H,{dashboard:Dt},"new-export-dashboard-button")}),Jt.push({group:"new-share-dashboard-buttons",condition:m.$.featureToggles.newDashboardSharingComponent&&et,render:()=>(0,t.jsx)(se,{dashboard:Dt},"new-share-dashboard-button")}),Jt.push({group:"settings",condition:qt&&Dt.canEditDashboard()&&aa,render:()=>(0,t.jsx)(g.$n,{onClick:()=>{Dt.onOpenSettings()},tooltip:(0,E.t)("dashboard.toolbar.dashboard-settings.tooltip","Dashboard settings"),fill:"text",size:"sm",variant:"secondary","data-testid":s.Tp.components.NavToolbar.editDashboard.settingsButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.dashboard-settings.label",children:"Settings"})},"settings")}),Jt.push({group:"main-buttons",condition:qt&&!Fn&&aa,render:()=>(0,t.jsx)(g.$n,{onClick:()=>Dt.exitEditMode({skipConfirm:!1}),tooltip:(0,E.t)("dashboard.toolbar.exit-edit-mode.tooltip","Exits edit mode and discards unsaved changes"),size:"sm",fill:"text",variant:"primary","data-testid":s.Tp.components.NavToolbar.editDashboard.exitButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.exit-edit-mode.label",children:"Exit edit"})},"discard")}),Jt.push({group:"main-buttons",condition:mn&&!Nn&&!ft&&!_t,render:()=>(0,t.jsx)(g.$n,{onClick:Rt?.onDiscard,tooltip:Rt?.state.isNewPanel?(0,E.t)("dashboard.toolbar.discard-panel-new","Discard panel"):(0,E.t)("dashboard.toolbar.discard-panel","Discard panel changes"),size:"sm",disabled:!On,fill:"outline",variant:"destructive","data-testid":s.Tp.components.NavToolbar.editDashboard.discardChangesButton,children:Rt?.state.isNewPanel?(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.discard-panel-new",children:"Discard panel"}):(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.discard-panel",children:"Discard panel changes"})},"discard")}),Jt.push({group:"main-buttons",condition:mn&&Nn&&!ft&&!_t,render:()=>(0,t.jsx)(g.$n,{onClick:Rt?.onDiscard,tooltip:(0,E.t)("dashboard.toolbar.discard-library-panel-changes","Discard library panel changes"),size:"sm",fill:"outline",variant:"destructive","data-testid":s.Tp.components.NavToolbar.editDashboard.discardChangesButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.discard-library-panel-changes",children:"Discard library panel changes"})},"discardLibraryPanel")}),Jt.push({group:"main-buttons",condition:mn&&Nn&&!ft&&!_t,render:()=>(0,t.jsx)(g.$n,{onClick:Rt?.onUnlinkLibraryPanel,tooltip:(0,E.t)("dashboard.toolbar.unlink-library-panel","Unlink library panel"),size:"sm",fill:"outline",variant:"secondary","data-testid":s.Tp.components.NavToolbar.editDashboard.unlinkLibraryPanelButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.unlink-library-panel",children:"Unlink library panel"})},"unlinkLibraryPanel")}),Jt.push({group:"main-buttons",condition:mn&&Nn&&!ft&&!_t,render:()=>(0,t.jsx)(g.$n,{onClick:Rt?.onSaveLibraryPanel,tooltip:(0,E.t)("dashboard.toolbar.save-library-panel","Save library panel"),size:"sm",fill:"outline",variant:"primary","data-testid":s.Tp.components.NavToolbar.editDashboard.saveLibraryPanelButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.save-library-panel",children:"Save library panel"})},"saveLibraryPanel")}),Jt.push({group:"main-buttons",condition:qt&&!Nn&&(tn.canSave||an),render:()=>{if(Fn)return(0,t.jsx)(g.$n,{onClick:()=>{Dt.openSaveDrawer({})},className:gn.buttonWithExtraMargin,tooltip:(0,E.t)("dashboard.toolbar.save-dashboard.tooltip","Save changes"),size:"sm",variant:"primary","data-testid":s.Tp.components.NavToolbar.editDashboard.saveButton,children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.save-dashboard.label",children:"Save dashboard"})},"save");if(an&&!tn.canSave&&!tn.canMakeEditable&&!Ot)return(0,t.jsx)(g.$n,{onClick:()=>{Dt.openSaveDrawer({saveAsCopy:!0})},className:gn.buttonWithExtraMargin,tooltip:(0,E.t)("dashboard.toolbar.save-dashboard-copy.tooltip","Save as copy"),size:"sm",variant:nn?"primary":"secondary",children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.save-dashboard-copy.label",children:"Save as copy"})},"save");const Je=(0,t.jsxs)(x.W,{children:[(0,t.jsx)(x.W.Item,{label:(0,E.t)("dashboard.toolbar.save-dashboard-short","Save"),icon:"save",onClick:()=>{Dt.openSaveDrawer({})}}),(0,t.jsx)(x.W.Item,{label:(0,E.t)("dashboard.toolbar.save-dashboard-copy.label","Save as copy"),icon:"copy",onClick:()=>{Dt.openSaveDrawer({saveAsCopy:!0})}})]});return(0,t.jsxs)(p.e,{className:gn.buttonWithExtraMargin,children:[(0,t.jsx)(g.$n,{onClick:()=>{Dt.openSaveDrawer({})},tooltip:(0,E.t)("dashboard.toolbar.save-dashboard.tooltip","Save changes"),size:"sm","data-testid":s.Tp.components.NavToolbar.editDashboard.saveButton,variant:nn?"primary":"secondary",children:(0,t.jsx)(E.x6,{i18nKey:"dashboard.toolbar.save-dashboard.label",children:"Save dashboard"})}),(0,t.jsx)(i.m,{overlay:Je,children:(0,t.jsx)(g.$n,{"aria-label":(0,E.t)("dashboard.toolbar.more-save-options","More save options"),icon:"angle-down",variant:nn?"primary":"secondary",size:"sm"})})]},"save")}}),(0,t.jsx)(c.U,{alignment:"right",children:Xt(Jt)})}function Xt(Dt){const qt=[];let Yt="";for(const nn of Dt)nn.condition&&(Yt&&Yt!==nn.group&&Yt&&qt.push((0,t.jsx)(P.K,{},`${nn.group}-separator`)),qt.push(nn.render()),Yt=nn.group);return qt}function Cn(Dt,qt,Yt){if(qt.length>0)for(const nn of qt){const Zt={dashboard:(0,v.UA)().getCurrent()};if(nn.show(Zt)){const tn=nn.component;Dt.push({group:Yt,condition:!0,render:()=>(0,n.createElement)(tn,{...Zt,key:Dt.length})})}}}
197function vn(Dt){const[qt,Yt]=(0,n.useState)();return(0,n.useEffect)(()=>{if(Dt){const nn=Dt.subscribeToState(Zt=>{Zt.isDirty!==qt&&Yt(Zt.isDirty)});return()=>nn.unsubscribe()}},[Dt,qt]),qt}function Wn(Dt){return{hiddenElementsContainer:(0,r.css)({display:"flex",padding:0,gap:Dt.spacing(1),whiteSpace:"nowrap"}),buttonWithExtraMargin:(0,r.css)({margin:Dt.spacing(0,.5)}),publicBadge:(0,r.css)({color:"grey",backgroundColor:"transparent",border:"1px solid"})}}},32540:(ee,B,e)=>{"use strict";e.d(B,{$:()=>h,m:()=>i});var t=e(74848),n=e(56838),r=e(67522),o=e(30703),s=e(88559),m=e(7895),a=e(87063),l=e(56840),f=e(37040);class h extends n.Bs{constructor(){super(...arguments),this._variableDependency=new n.Sh(this,{onAnyVariableChanged:()=>{this.state.rawLinks&&this.state.rawLinks.length>0&&this.forceRender()}})}static{this.Component=u}}function u({model:g}){const{menu:p,rawLinks:c}=g.useState();if(n.jh.getTimeRange(g).useState(),!(g.parent instanceof n.Eb))throw new Error("VizPanelLinks must be a child of VizPanel");if(!c||c.length===0)return null;if(c.length===1){const y=(0,f.eQ)(g.parent)[0];return(0,t.jsx)(r.NR.TitleItem,{href:y.href,onClick:y.onClick,target:y.target,title:y.title,children:(0,t.jsx)(o.I,{name:"external-link-alt",size:"md"})})}return(0,t.jsx)(s.m,{overlay:()=>(0,t.jsx)(p.Component,{model:p},p.state.key),children:(0,t.jsx)(m.I,{icon:"external-link-alt",iconSize:"md","aria-label":(0,l.t)("dashboard-scene.viz-panel-links-renderer.aria-label-panel-links","Panel links")})})}class i extends n.Bs{static{this.Component=x}}function x({model:g}){const{links:p}=g.useState();return p?(0,t.jsx)(a.W,{children:p?.map((c,y)=>(0,t.jsx)(a.W.Item,{label:c.title,url:c.href,target:c.target,onClick:c.onClick},y))}):null}},37040:(ee,B,e)=>{"use strict";e.d(B,{eQ:()=>Z,MI:()=>te,oV:()=>_,_i:()=>F,vR:()=>Q});var t=e(54092),n=e(60188),r=e(5556),o=e(43173),s=e(36490),m=e(56838),a=e(45229),l=e(64762),f=e(56840),h=e(12066),u=e(15130),i=e(47797),x=e(54),g=e(20437),p=e(58662),c=e(26689),y=e(302),P=e(8001),d=e(63629),D=e(31439),b=e(8535),E=e(96673),v=e(87745),C=e(9175),S=e(99949),O=e(3371),I=e(23289),R=e(22079),T=e(8285),L=e(39385),K=e(32540),A=e(74848),W=e(12161);class N extends m.Bs{constructor(){super(...arguments),this.onDismiss=()=>{(0,T.YQ)(this).closeModal()},this.onConfirm=()=>{const se=(0,T.YQ)(this);se.unlinkLibraryPanel(this.state.panelRef.resolve()),se.closeModal()}}static{this.Component=w}}function w({model:X}){return(0,A.jsx)(W.l,{isOpen:!0,onConfirm:()=>{X.onConfirm(),X.onDismiss()},onDismiss:X.onDismiss})}let j;function V(){return j||(j=(0,P.dp)(d.qm),j)}const U="metrics-drilldown";function F(X){(async()=>{const oe=X.parent,ae=oe.getPlugin(),ie=[],fe=[],pe=(0,T.YQ)(oe),{isEmbedded:de}=pe.state.meta,le=await M(oe),me=(0,O.uc)(oe.state.key);if(de){le&&X.setState({items:[le]});return}const De=!!pe.state.editPanel;if(De||ie.push({text:(0,f.t)("panel.header-menu.view","View"),iconClassName:"eye",shortcut:"v",href:(0,R.r7)(oe)}),pe.canEditDashboard()&&pe.state.editable&&!me&&!De&&ie.push({text:(0,f.t)("panel.header-menu.edit","Edit"),iconClassName:"edit",shortcut:"e",href:(0,R.e0)((0,T.Cs)(oe))}),o.$.featureToggles.newDashboardSharingComponent){const Ce=[];Ce.push({text:(0,f.t)("share-panel.menu.share-link-title","Share link"),iconClassName:"link",shortcut:"p u",onClick:()=>{I.c.sharingCategoryClicked({item:p.wr.link,shareResource:(0,p.hD)(oe?.getRef())});const He=new C.j({shareView:p.wr.link,panelRef:oe.getRef()});pe.showModal(He)}}),Ce.push({text:(0,f.t)("share-panel.menu.share-embed-title","Share embed"),iconClassName:"arrow",shortcut:"p e",onClick:()=>{I.c.sharingCategoryClicked({item:p.wr.embed,shareResource:(0,p.hD)(oe.getRef())});const He=new C.j({shareView:p.wr.embed,panelRef:oe.getRef()});pe.showModal(He)}}),u.TP.isSignedIn&&o.$.snapshotEnabled&&u.TP.hasPermission(E.AccessControlAction.SnapshotsCreate)&&Ce.push({text:(0,f.t)("share-panel.menu.share-snapshot-title","Share snapshot"),iconClassName:"camera",shortcut:"p s",onClick:()=>{I.c.sharingCategoryClicked({item:p.wr.snapshot,shareResource:(0,p.hD)(oe.getRef())});const He=new C.j({shareView:p.wr.snapshot,panelRef:oe.getRef()});pe.showModal(He)}}),ie.push({type:"submenu",text:(0,f.t)("panel.header-menu.share","Share"),iconClassName:"share-alt",subMenu:Ce,onClick:He=>{He.preventDefault()}})}
197else ie.push({text:(0,f.t)("panel.header-menu.share","Share"),iconClassName:"share-alt",onClick:()=>{pe.showModal(new S.Z({panelRef:oe.getRef()}))},shortcut:"p s"});pe.state.isEditing&&!me&&!De&&fe.push({text:(0,f.t)("panel.header-menu.duplicate","Duplicate"),iconClassName:"file-copy-alt",onClick:()=>{pe.duplicatePanel(oe)},shortcut:"p d"}),De||fe.push({text:(0,f.t)("panel.header-menu.copy","Copy"),iconClassName:"copy",onClick:()=>{pe.copyPanel(oe)}}),pe.state.isEditing&&!me&&!De&&((0,T.ME)(oe)?(fe.push({text:(0,f.t)("panel.header-menu.unlink-library-panel","Unlink library panel"),iconClassName:"link-broken",onClick:()=>{pe.showModal(new N({panelRef:oe.getRef()}))}}),fe.push({text:(0,f.t)("panel.header-menu.replace-library-panel","Replace library panel"),iconClassName:"library-panel",onClick:()=>{pe.onShowAddLibraryPanelDrawer(oe.getRef())}})):o.$.featureToggles.newDashboardSharingComponent?fe.push({text:(0,f.t)("share-panel.menu.new-library-panel-title","New library panel"),iconClassName:"plus-square",onClick:()=>{const Ce=new C.j({shareView:p.wr.libraryPanel,panelRef:oe.getRef()});pe.showModal(Ce)}}):fe.push({text:(0,f.t)("panel.header-menu.create-library-panel","Create library panel"),onClick:()=>{pe.showModal(new S.Z({panelRef:oe.getRef(),activeTab:p.wr.libraryPanel}))}})),(0,x.q0)()&&fe.push({text:(0,f.t)("panel.header-menu.new-alert-rule","New alert rule"),iconClassName:"bell",onClick:Ce=>Y(oe)}),J(oe.state.options)&&!De&&fe.push({text:oe.state.options.legend.showLegend?(0,f.t)("panel.header-menu.hide-legend","Hide legend"):(0,f.t)("panel.header-menu.show-legend","Show legend"),iconClassName:oe.state.options.legend.showLegend?"legend-hide":"legend-show",onClick:Ce=>{Ce.preventDefault(),Q(oe)},shortcut:"p l"}),pe.canEditDashboard()&&ae&&!ae.meta.skipDataQuery&&!me&&fe.push({text:(0,f.t)("panel.header-menu.get-help","Get help"),iconClassName:"question-circle",onClick:Ce=>{Ce.preventDefault(),q(oe,c.q.Help)}}),le&&ie.push(le),ie.push(H(ae,oe,pe)),V();const{extensions:Ne}=j({extensionPointId:t.S.DashboardPanelMenu,context:ne(oe,pe),limitPerPlugin:3});if(Ne.length>0&&!pe.state.isEditing){const Ce=Ne.filter(Me=>Me.type===t.u.link),[He,ke]=Ce.reduce(([Me,$e],tt)=>(tt.category===U?Me.push(tt):$e.push(tt),[Me,$e]),[[],[]]);He.length>0&&ie.push({text:"Metrics drilldown",iconClassName:"code-branch",type:"submenu",subMenu:(0,D.N9)(He)}),ke.length>0&&ie.push({text:"Extensions",iconClassName:"plug",type:"submenu",subMenu:(0,D.N9)(ke)})}fe.length&&ie.push({type:"submenu",text:(0,f.t)("panel.header-menu.more","More..."),iconClassName:"cube",subMenu:fe,onClick:Ce=>{Ce.preventDefault()}}),pe.state.isEditing&&!me&&!De&&(ie.push({text:"",type:"divider"}),ie.push({text:(0,f.t)("panel.header-menu.remove","Remove"),iconClassName:"trash-alt",onClick:()=>{te(pe,oe)},shortcut:"p r"})),X.setState({items:ie})})()}async function M(X){const se=await(0,R.Lp)(X);if(se)return{text:(0,f.t)("panel.header-menu.explore","Explore"),iconClassName:"compass",shortcut:"p x",href:se}}function H(X,se,oe){const ae=[];return X&&!X.meta.skipDataQuery&&(ae.push({text:(0,f.t)("panel.header-menu.inspect-data","Data"),href:(0,R.Uu)(se,c.q.Data),onClick:ie=>{ie.preventDefault(),s.Ny.partial({inspect:se.state.key,inspectTab:c.q.Data})}}),oe instanceof L.H$&&oe.state.meta.canEdit&&ae.push({text:(0,f.t)("panel.header-menu.query","Query"),href:(0,R.Uu)(se,c.q.Query),onClick:ie=>{ie.preventDefault(),s.Ny.partial({inspect:se.state.key,inspectTab:c.q.Query})}})),ae.push({text:(0,f.t)("panel.header-menu.inspect-json","Panel JSON"),href:(0,R.Uu)(se,c.q.JSON),onClick:ie=>{ie.preventDefault(),s.Ny.partial({inspect:se.state.key,inspectTab:c.q.JSON})}}),{text:(0,f.t)("panel.header-menu.inspect","Inspect"),iconClassName:"info-circle",shortcut:"i",href:(0,R.Uu)(se),onClick:ie=>{ie.isDefaultPrevented()||s.Ny.partial({inspect:se.state.key,inspectTab:c.q.Data})},subMenu:ae.length>0?ae:void 0}}function _(X){if(!(X.parent instanceof K.$))throw new Error("parent of VizPanelLinksMenu must be VizPanelLinks");const se=X.parent.parent;if(!(se instanceof m.Eb))throw new Error("parent of VizPanelLinks must be VizPanel");X.setState({links:Z(se)})}function Z(X){const se=(ie,fe)=>m.jh.interpolate(X,ie,fe),oe=(0,y.CH)(X,se);if(!oe)return[];const ae=oe.getLinks(se);return ae.map(ie=>({...ie,onClick:(pe,de)=>
197{I.c.panelLinkClicked({has_multiple_links:ae.length>1}),ie.onClick?.(pe,de)}}))}function ne(X,se){const oe=m.jh.getTimeRange(X);let ae=(0,T.un)(X);const ie=ae?.state.queries,fe=(0,T.Cs)(X);let pe={};if(X.state.$variables&&X.state.$variables.state.variables.forEach(de=>{de instanceof m.xc&&(pe={...pe,[de.state.name]:{value:de.getValue(),text:de.getValueText()}})}),X.parent?.parent instanceof m.tI){const de=X.parent.parent;de.state.$variables&&de.state.$variables.state.variables.forEach(le=>{le instanceof m.xc&&(pe={...pe,[le.state.name]:{value:le.getValue(),text:le.getValueText()}})})}return{id:fe,pluginId:X.state.pluginId,title:X.state.title,timeRange:oe.state.value.raw,timeZone:(0,n.O)({timeZone:oe.getTimeZone()}),dashboard:{uid:se.state.uid,title:se.state.title,tags:se.state.tags||[]},targets:ie,scopedVars:pe,data:ae?.state.data}}function te(X,se){a.A.publish(new v.bY({title:"Remove panel",text:"Are you sure you want to remove this panel?",icon:"trash-alt",yesText:"Remove",onConfirm:()=>X.removePanel(se)}))}const Y=async X=>{try{const se=await(0,g.J6)(X),oe=r.kM.renderUrl("/alerting/new",{defaults:JSON.stringify(se),returnTo:location.pathname+location.search});s.Ny.push(oe)}catch(se){const oe=`Error getting rule values from the panel: ${(0,i.q6)(se)}`;(0,b.JD)((0,h.dx)((0,l.gi)(oe)));return}};function Q(X){const se=X.state.options;J(se)&&typeof se.legend.showLegend=="boolean"&&X.onOptionsChange({legend:{showLegend:!se.legend.showLegend}})}function J(X){return X!=null&&typeof X=="object"&&"legend"in X}const q=(X,se)=>{s.Ny.partial({inspect:X.state.key,inspectTab:se})}},66251:(ee,B,e)=>{"use strict";e.d(B,{W:()=>s});var t=e(74848),n=e(56838),r=e(46429),o=e(8285);class s extends n.Bs{constructor(){super({}),this.onActivate=()=>{const l=this.parent;if(!l||!(l instanceof n.Eb))throw new Error("PanelNotices can be used only as title items for VizPanel")},this.addActivationHandler(this.onActivate)}static{this.Component=m}getPanel(){const l=this.parent;return l&&l instanceof n.Eb?l:null}}function m({model:a}){const l=a.getPanel(),h=n.jh.getData(a).useState();if(!l)return null;const u=(0,o.Cs)(l);return h.data?.series?(0,t.jsx)(r.Z,{frames:h.data?.series,panelId:u}):null}},81657:(ee,B,e)=>{"use strict";e.d(B,{v:()=>i});var t=e(74848),n=e(22803),r=e(22592),o=e(17548),s=e(33239),m=e(56838),a=e(63142),l=e(45967),f=e(91867),h=e(67522),u=e(30703);class i extends m.XQ{constructor(c={}){super({...c,from:"now-6h",to:"now",value:(0,r.E2)()}),this._variableDependency=new m.Sh(this,{statePaths:["timeFrom","timeShift"]}),this.addActivationHandler(()=>this._onActivate())}static{this.Component=x}_onActivate(){this._subs.add(this.subscribeToState(y=>{const{timeInfo:P,timeRange:d}=this.getTimeOverride(this.getAncestorTimeRange().state.value);y.timeInfo!==P&&this.setState({timeInfo:P,value:d})}));const{timeRange:c}=this.getTimeOverride(this.getAncestorTimeRange().state.value);this.setState({value:c,from:c.raw.from.toString(),to:c.raw.to.toString()})}ancestorTimeRangeChanged(c){const y=this.getTimeOverride(c.value);this.setState({value:y.timeRange,timeInfo:y.timeInfo})}getTimeOverride(c){const{timeFrom:y,timeShift:P}=this.state,d={timeInfo:"",timeRange:c};if(y){const D=m.jh.interpolate(this,this.state.timeFrom),b=o.describeTextRange(D);if(b.invalid)return d.timeInfo="invalid time override",d;if(o.isRelativeTimeRange(c.raw)){const E=this.getTimeZone();d.timeInfo=b.display,d.timeRange={from:s.parse(b.from,void 0,E),to:s.parse(b.to,void 0,E),raw:{from:b.from,to:b.to}}}}if(P){const D=m.jh.interpolate(this,this.state.timeShift);if(o.describeTextRange(D).invalid)return d.timeInfo="invalid timeshift",d;const E="-"+D;d.timeInfo+=" timeshift "+E;const v=s.parseDateMath(E,d.timeRange.from,!1),C=s.parseDateMath(E,d.timeRange.to,!0);if(!v||!C)return d.timeInfo="invalid timeshift",d;d.timeRange={from:v,to:C,raw:{from:v,to:C}}}return d}}function x({model:p}){const{timeInfo:c,hideTimeOverride:y}=p.useState(),P=(0,a.of)(g);return!c||y?null:(0,t.jsx)(l.m,{content:(0,t.jsx)(f.xS,{timeRange:p.state.value,timeZone:p.getTimeZone()}),children:(0,t.jsxs)(h.NR.TitleItem,{className:P.timeshift,children:[(0,t.jsx)(u.I,{name:"clock-nine",size:"sm"})," ",c]})})}const g=p=>({timeshift:(0,n.css)({color:p.colors.text.link,gap:p.spacing(.5),whiteSpace:"nowrap"})})},29700:(ee,B,e)=>{"use strict";e.d(B,{r:()=>p});var t=e(74848),n=e(96540),r=e(16207),o=e(36490),s=e(56838),m=e(87063),a=e(41654),l=e(31286),f=e(93256),h=e(45861),u=e(88559),i=e(56840),x=e(8285),g=e(39385);const p="__unconfigured-panel",c=new r.m(y);
197function y(P){const[d,D]=(0,n.useState)(!1),b=(0,n.useCallback)(S=>{D(S)},[]),E=()=>{o.Ny.partial({editPanel:P.id})},v=()=>{const S=window.__grafanaSceneContext;if(!(S instanceof g.H$))throw new Error("DashboardScene not found");const O=(0,x.vL)(S,(0,x.XA)(P.id));if(!O)throw new Error("Panel not found");S.onShowAddLibraryPanelDrawer(O.getRef())},C=()=>(0,t.jsxs)(m.W,{children:[(0,t.jsx)(m.W.Item,{icon:"pen",label:(0,i.t)("dashboard.new-panel.menu-open-panel-editor","Configure"),onClick:E}),(0,t.jsx)(m.W.Item,{icon:"library-panel",label:(0,i.t)("dashboard.new-panel.menu-use-library-panel","Use library panel"),onClick:v})]});return(0,t.jsx)(a.B,{direction:"row",alignItems:"center",height:"100%",justifyContent:"center",children:(0,t.jsx)(l.a,{paddingBottom:2,children:(0,t.jsxs)(f.e,{children:[(0,t.jsx)(h.$n,{icon:"sliders-v-alt",onClick:E,children:(0,t.jsx)(i.x6,{i18nKey:"dashboard.new-panel.configure-button",children:"Configure"})}),(0,t.jsx)(u.m,{overlay:C,placement:"bottom-end",onVisibleChange:b,children:(0,t.jsx)(h.$n,{"aria-label":(0,i.t)("dashboard.new-panel.configure-button-menu","Toggle menu"),icon:d?"angle-up":"angle-down"})})]})})})}s.Go.registerRuntimePanelPlugin({pluginId:p,plugin:c})},12161:(ee,B,e)=>{"use strict";e.d(B,{l:()=>o});var t=e(74848),n=e(71599),r=e(56840);const o=({isOpen:s,onConfirm:m,onDismiss:a})=>(0,t.jsx)(n.u,{title:(0,r.t)("dashboard-scene.unlink-modal.title-really-unlink-panel","Do you really want to unlink this panel?"),icon:"question-circle",body:`If you unlink this panel, you will be able to edit it without affecting any other dashboards. 198 However, once you make a change you will not be able to revert to its original reusable panel.`,confirmText:"Yes, unlink",onConfirm:()=>{m(),a()},onDismiss:a,isOpen:s})},3392:(ee,B,e)=>{"use strict";e.d(B,{E:()=>x,j:()=>g});var t=e(2543),n=e(7389),r=e(78282),o=e(65642),s=e(30124),m=e(99305),a=e(75515),l=e(97583),f=e(67933);function h(p,c){switch(p.kind){case"GridLayout":{const y=p.spec.items||[];p.spec.items=y.filter(P=>P.kind==="GridLayoutItem"?P.spec.element.name!==c:P.kind==="GridLayoutRow"?(P.spec.elements=P.spec.elements.filter(d=>d.spec.element.name!==c),P.spec.elements.length>0):!0);break}case"AutoGridLayout":{const y=p.spec.items||[];p.spec.items=y.filter(P=>P.kind==="AutoGridLayoutItem"&&P.spec.element.name!==c);break}case"RowsLayout":{const y=p.spec.rows||[];p.spec.rows=y.filter(P=>(h(P.spec.layout,c),!u(P.spec.layout)));break}case"TabsLayout":{const y=p.spec.tabs||[];p.spec.tabs=y.filter(P=>(h(P.spec.layout,c),!u(P.spec.layout)));break}}}function u(p){if(!p||!p.spec)return!0;switch(p.kind){case"GridLayout":{const c=p.spec.items||[];return c.length===0||c.every(y=>y.kind==="GridLayoutItem"?!1:y.kind==="GridLayoutRow"?y.spec.elements.length===0:!1)}case"AutoGridLayout":return(p.spec.items||[]).length===0;case"RowsLayout":return(p.spec.rows||[]).length===0;case"TabsLayout":return(p.spec.tabs||[]).length===0;default:return!0}}function i(p){return!!(p.libraryPanel?.name&&p.libraryPanel?.uid)}async function x(p){p.cleanUpRepeats();const c=p.getSaveModelCloneOld();c.id=null,p.processRepeats();const y=[],P={},d={},D={},b=new Map;for(const S of c.getVariables())D[S.name]=S;const E=(S,O)=>{if(S.datasource===void 0){S.datasource=O;return}let I=S.datasource,R=null;const T=I?.uid,L=T&&m.SY.exec(T);if(L){const K=L[1]||L[2]||L[4];R=D[K],R&&R.current&&(I=R.current.value)}return(0,r.l)().get(I).then(K=>{if(K.meta?.builtIn||(P["datasource"+K.meta?.id]={type:"datasource",id:K.meta.id,name:K.meta.name,version:K.meta.info.version||"1.0.0"},R))return;const A=S.libraryPanel,W=A?"-for-library-panel":"";let N="DS_"+K.name.replace(" ","_").toUpperCase()+W.toUpperCase();if(d[N]={name:N,label:K.name,description:"",type:"datasource",pluginId:K.meta?.id,pluginName:K.meta?.name,usage:d[N]?.usage},A){const w=d[N]?.usage?.libraryPanels||[];w.push({name:A.name,uid:A.uid}),d[N].usage={libraryPanels:w}}S.datasource={type:K.meta.id,uid:"${"+N+"}"}})},v=async S=>{if(S.type!=="row"){if(await E(S),S.targets)for(const I of S.targets)await E(I,S.datasource);const O=o.Ay.panels[S.type];O&&(P["panel"+O.id]={type:"panel",id:O.id,name:O.name,version:O.info.version})}},C=async S=>{if((0,a.X)(S)){const{name:O,uid:I}=S.libraryPanel;let R=S.libraryPanel.model;R||(R=(await(0,s.Yr)(I,!0)).model),await E(R);const{gridPos:T,id:L,...K}=R;b.has(I)||b.set(I,{name:O,uid:I,kind:l.i.Panel,model:K})}};try{for(const I of c.panels)if(await v(I),I.collapsed!==void 0&&I.collapsed===!0&&I.panels)for(const R of I.panels)await v(R);for(const I of c.getVariables())I.type==="query"?(await E(I),I.options=[],I.current={},I.refresh=I.refresh!==n.CO.never?I.refresh:n.CO.onDashboardLoad):I.type==="datasource"&&(I.current={});for(const I of c.annotations.list)await E(I);P.grafana={type:"grafana",id:"grafana",name:"Grafana",version:o.Ay.buildInfo.version};for(const I of c.panels)if(await C(I),I.collapsed!==void 0&&I.collapsed===!0&&I.panels)for(const R of I.panels)await C(R);(0,t.each)(d,I=>{y.push(I)});for(const I of c.getVariables())if((0,f.VO)(I)){const R="VAR_"+I.name.replace(" ","_").toUpperCase();y.push({name:R,type:"constant",label:I.label||I.name,value:I.query,description:""}),I.query="${"+R+"}",I.current={value:I.query,text:I.query,selected:!1},I.options=[I.current]}const S=[...b.entries()].reduce((I,[R,T])=>(I[R]=T,I),{}),O=(0,t.defaults)({__inputs:y,__elements:S,__requires:(0,t.sortBy)(P,["id"])},c);for(let I=0;I<O.panels.length;I++){const R=O.panels[I];i(R)&&(O.panels[I]={gridPos:R.gridPos,id:R.id,libraryPanel:{uid:R.libraryPanel.uid,name:R.libraryPanel.name}})}return O}catch(S){return console.error("Export failed:",S),{error:S}}}async function g(p){const c={},y=p.variables.filter(D=>D.kind==="DatasourceVariable");for(const D of p.variables)c[D.spec.name]=D.spec;const P=D=>{const b=D.datasource?.uid;if(b?.startsWith("${")&&b?.endsWith("}")){const E=b.slice(2,-1);if(y.find(C=>C.spec.name===E))return}D.datasource=void 0},d=D=>
198{if(D.spec.data.spec.queries)for(const b of D.spec.data.spec.queries)P(b.spec)};try{const D=p.elements,b=p.layout;for(const[E,v]of Object.entries(D))v.kind==="Panel"?d(v):v.kind==="LibraryPanel"&&(delete D[E],h(b,E));for(const E of p.variables)E.kind==="QueryVariable"?(P(E.spec),E.spec.options=[],E.spec.current={text:"",value:""}):E.kind==="DatasourceVariable"&&(E.spec.current={text:"",value:""});for(const E of p.annotations)P(E.spec);return p}catch(D){return console.error("Export failed:",D),{error:D}}}},25953:(ee,B,e)=>{"use strict";e.d(B,{X:()=>C});var t=e(2543),n=e(96540),r=e(56838),o=e(57558),s=e(3371),m=e(8285),a=e(41667),l=e(39765),f=e(74848),h=e(56840),u=e(25797),i=e(51156),x=e(31819),g=e(46415);function p(S){const O=new u.C({title:(0,h.t)("dashboard.auto-grid.item-options.repeat.title","Repeat options"),id:"repeat-options",isOpenDefault:!1}).addItem(new i.v({title:(0,h.t)("dashboard.auto-grid.item-options.repeat.variable.title","Repeat by variable"),description:(0,h.t)("dashboard.auto-grid.item-options.repeat.variable.description","Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard."),render:()=>(0,f.jsx)(c,{item:S})})),I=(0,g.h)(S.state.conditionalRendering);return[O,I]}function c({item:S}){const{variableName:O}=S.useState();return(0,f.jsx)(x.U,{id:"repeat-by-variable-select",sceneContext:S,repeat:O,onChange:I=>S.setRepeatByVariable(I)})}var y=e(22803),P=e(63142),d=e(41116),D=e(39242);function b({model:S}){const{body:O,repeatedPanels:I,key:R}=S.useState(),{draggingKey:T}=S.getParentGrid().useState(),{isEditing:L}=(0,m.TN)(S),[K,A,W]=(0,d.H)(S),N=(0,P.of)(E);if(K&&!L)return null;const w=!!T,j=T===R;return I?(0,f.jsx)(f.Fragment,{children:I.map(V=>(0,f.jsxs)("div",{className:(0,y.cx)(A,N.wrapper),children:[(0,f.jsx)(V.Component,{model:V}),W]},V.state.key))}):(0,f.jsxs)("div",{ref:S.containerRef,"data-auto-grid-item-drop-target":w?R:void 0,children:[j&&(0,f.jsx)("div",{className:N.draggedPlaceholder}),(0,f.jsxs)("div",{className:(0,y.cx)(!j&&A,N.wrapper,j&&N.draggedWrapper),children:[(0,f.jsx)(O.Component,{model:O}),W]})]})}const E=S=>({container:(0,y.css)({width:"100%",height:"100%"}),wrapper:(0,y.css)({width:"100%",height:"100%",position:"relative"}),draggedWrapper:(0,y.css)({position:"absolute",zIndex:1e3,top:`var(${D.hM})`,left:`var(${D.PS})`,width:`var(${D.MS})`,height:`var(${D.PP})`,opacity:.8}),draggedPlaceholder:(0,y.css)({width:"100%",height:"100%",boxShadow:`0 0 ${S.spacing(.5)} ${S.colors.primary.border}`,background:`${S.colors.primary.transparent}`,zIndex:-1})});var v=e(29425);class C extends r.Bs{constructor(O){super({...O,conditionalRendering:O?.conditionalRendering??o.p.createEmpty()}),this._variableDependency=new r.Sh(this,{variableNames:this.state.variableName?[this.state.variableName]:[],onVariableUpdateCompleted:()=>this.performRepeat()}),this.isDashboardLayoutItem=!0,this.containerRef=n.createRef(),this.addActivationHandler(()=>this._activationHandler())}static{this.Component=b}_activationHandler(){this.state.variableName&&this.performRepeat();const O=this.state.conditionalRendering?.activate();return()=>{O&&O()}}getOptions(){return p(this)}setElementBody(O){this.setState({body:O})}performRepeat(){if(!this.state.variableName||r.jh.hasVariableDependencyInLoadingState(this))return;const O=r.jh.lookupVariable(this.state.variableName,this)??new r.yP({name:"_____default_sys_repeat_var_____",options:[],value:"",text:"",query:"A"});if(!(O instanceof r.n8)){console.error("DashboardGridItem: Variable is not a MultiValueVariable");return}const{values:I,texts:R}=(0,m.a7)(O);if((0,t.isEqual)(this._prevRepeatValues,I))return;const T=this.state.body,L=[],K={values:[""],texts:O.hasAllValue()?["All"]:["None"]},A=I.length?I:K.values,W=R.length?R:K.texts;for(let N=0;N<A.length;N++){const w={$variables:new r.Pj({variables:[new r.xc({name:O.state.name,value:A[N],text:String(W[N])})]}),key:(0,s.lv)(T.state.key,N)},j=T.clone(w);L.push(j)}this.setState({repeatedPanels:L}),this._prevRepeatValues=I,this.publishEvent(new l.d({source:this}),!0)}setRepeatByVariable(O){const I={variableName:O};this.state.body.state.$variables&&this.state.body.setState({$variables:void 0}),this._variableDependency.setVariableNames(O?[O]:[]),this.setState(I),this.performRepeat()}getParentGrid(){if(!(this.parent instanceof v.o))throw new Error("Parent is not a AutoGri
198dLayout");return this.parent}getBoundingBox(){const O=this.containerRef.current.getBoundingClientRect();return{width:O.width,height:O.height,top:this.containerRef.current.offsetTop,left:this.containerRef.current.offsetLeft}}scrollIntoView(){(0,a.d)(this,this.containerRef)}}},29425:(ee,B,e)=>{"use strict";e.d(B,{o:()=>g});var t=e(96540),n=e(56838),r=e(8285),o=e(25953),s=e(74848),m=e(22803),a=e(63142),l=e(3371),f=e(6607),h=e(8835);function u({model:p}){const{children:c,isHidden:y,isLazy:P}=p.useState(),d=(0,l.Qp)(p),D=(0,a.of)(i,p.state),{layoutOrchestrator:b,isEditing:E}=(0,r.TN)(p),v=n.jh.getAncestor(p,h.X2),{fillScreen:C}=v.useState();if(y||!b)return null;const S=!d&&E;return(0,s.jsxs)("div",{className:(0,m.cx)(D.container,C&&D.containerFillScreen,E&&D.containerEditing),ref:p.containerRef,children:[c.map(O=>P?(0,s.jsx)(n.w1,{className:D.container,children:(0,s.jsx)(O.Component,{model:O},O.state.key)},O.state.key):(0,s.jsx)(O.Component,{model:O},O.state.key)),S&&(0,s.jsx)(f.f,{layoutManager:v})]})}const i=(p,c)=>({container:(0,m.css)({display:"grid",position:"relative",gridTemplateColumns:c.templateColumns,gridTemplateRows:c.templateRows||"unset",gridAutoRows:c.autoRows||"unset",rowGap:p.spacing(c.rowGap??1),columnGap:p.spacing(c.columnGap??1),justifyItems:c.justifyItems||"unset",alignItems:c.alignItems||"unset",justifyContent:c.justifyContent||"unset",[p.breakpoints.down("md")]:c.md?{gridTemplateRows:c.md.templateRows,gridTemplateColumns:c.md.templateColumns,rowGap:c.md.rowGap?p.spacing(c.md.rowGap??1):void 0,columnGap:c.md.columnGap?p.spacing(c.md.rowGap??1):void 0,justifyItems:c.md.justifyItems,al
198ignItems:c.md.alignItems,justifyContent:c.md.justifyContent}:void 0,"&:hover":{".dashboard-canvas-add-button":{opacity:1,filter:"unset"}}}),containerFillScreen:(0,m.css)({flexGrow:1}),containerEditing:(0,m.css)({paddingBottom:p.spacing(5),position:"relative"}),wrapper:(0,m.css)({display:"grid",position:"relative",width:"100%",height:"100%"}),dragging:(0,m.css)({position:"fixed",top:0,left:0,zIndex:p.zIndex.portal+1,pointerEvents:"none"})});var x=e(39242);class g extends n.Bs{constructor(c){super({rowGap:1,columnGap:1,templateColumns:"repeat(auto-fit, minmax(400px, 1fr))",autoRows:c.autoRows??"320px",children:c.children??[],...c}),this.containerRef=(0,t.createRef)(),this._draggedGridItem=null,this._initialGridItemPosition=null,this._onDragStart=this._onDragStart.bind(this),this._onDragEnd=this._onDragEnd.bind(this),this._onDrag=this._onDrag.bind(this),this.addActivationHandler(()=>this._activationHandler())}static{this.Component=u}_activationHandler(){return()=>{this._resetPanelPositionAndSize(),document.body.removeEventListener("pointermove",this._onDrag),document.body.removeEventListener("pointerup",this._onDragEnd),document.body.classList.remove("dashboard-draggable-transparent-selection")}}isDraggable(){return this.state.isDraggable??!1}getDragClass(){return`grid-drag-handle-${this.state.key}`}getDragClassCancel(){return"grid-drag-cancel"}getDragHooks(){return{onDragStart:this._onDragStart}}_canDrag(c){return!this.isDraggable()||!(c.target instanceof Element)?!1:!!c.target.closest(`.${this.getDragClass()}`)&&!c.target.closest(`.${this.getDragClassCancel()}`)}_onDragStart(c,y){if(!this._canDrag(c))return;if(c.preventDefault(),c.stopPropagation(),!(y.parent instanceof o.X))throw new Error("Dragging wrong item");this._draggedGridItem=y.parent;const{top:P,left:d,width:D,height:b}=this._draggedGridItem.getBoundingBox();this._initialGridItemPosition={pageX:c.pageX,pageY:c.pageY,top:P,left:d},this._updatePanelSize(D,b),this._updatePanelPosition(P,d),this.setState({draggingKey:this._draggedGridItem.state.key}),document.body.addEventListener("pointermove",this._onDrag),document.body.addEventListener("pointerup",this._onDragEnd),document.body.classList.add("dashboard-draggable-transparent-selection"),(0,r.wP)(this)?.startDraggingSync(c,y)}_onDragEnd(){window.getSelection()?.removeAllRanges(),this._draggedGridItem=null,this._initialGridItemPosition=null,this._resetPanelPositionAndSize(),this.setState({draggingKey:void 0}),document.body.removeEventListener("pointermove",this._onDrag),document.body.removeEventListener("pointerup",this._onDragEnd),document.body.classList.remove("dashboard-draggable-transparent-selection")}_onDrag(c){if(!this._draggedGridItem||!this._initialGridItemPosition){this._onDragEnd();return}this._updatePanelPosition(this._initialGridItemPosition.top+(c.pageY-this._initialGridItemPosition.pageY),this._initialGridItemPosition.left+(c.pageX-this._initialGridItemPosition.pageX));const y=document.elementsFromPoint(c.clientX,c.clientY)?.find(P=>{const d=P.getAttribute("data-auto-grid-item-drop-target");return!!d&&d!==this._draggedGridItem.state.key})?.getAttribute("data-auto-grid-item-drop-target");y&&this._onDragOverItem(y)}_onDragOverItem(c){const y=[...this.state.children],P=y.findIndex(D=>D===this._draggedGridItem),d=y.findIndex(D=>D.state.key===c);P===-1||d===-1||(y.splice(P,1),y.splice(d,0,this._draggedGridItem),this.setState({children:y}))}_updatePanelPosition(c,y){this._setContainerStyle(x.hM,`${c}px`),this._setContainerStyle(x.PS,`${y}px`)}_updatePanelSize(c,y){this._setContainerStyle(x.MS,`${Math.floor(c)}px`),this._setContainerStyle(x.PP,`${Math.floor(y)}px`)}_resetPanelPositionAndSize(){this._removeContainerStyle(x.hM),this._removeContainerStyle(x.PS),this._removeContainerStyle(x.MS),this._removeContainerStyle(x.PP)}_setContainerStyle(c,y){this.containerRef.current?.style.setProperty(c,y)}_removeContainerStyle(c){this.containerRef.current?.style.removeProperty(c)}}},8835:(ee,B,e)=>{"use strict";e.d(B,{j:()=>T,YL:()=>L,X2:()=>K,jo:()=>j,Kf:()=>W});var t=e(74848),n=e(56838),r=e(95943),o=e(56840),s=e(35282),m=e(4974),a=e(3371),l=e(1682),f=e(8285),h=e(48492),u=e(25953),i=e(29425),x=e(22803),g=e(2543),p=e(96540),c=e(63142),y=e(41654),P=e(37386),d=e(43243),D=e(63527),b=e(45861),E=e(21285),v=e(51156);function C(V){const U=[];return U.push(new v.v({title:"Column options",skipField:!0,render:()=>(0,t.jsx)(S,{layoutManager:V})})),U.push(new v.v({title:"Row height options",skipField:!0,render:()=>(0,t.jsx)(O,{layoutManager:V})})),U}function S({layoutManager:V}){const{maxColumnCount:U,columnWidth:F}=V.useState(),[M,H]=p.useState(null),[_,Z]=p.useState(!1),[ne,te]=p.useState(!1),Y=(0,c.of)(I);(0,p.useEffect)(()=>{_&&M&&(M.focus(),Z(!1))},[_,M]);const Q=["narrow","standard","wide","custom"].map(ie=>({label:(0,g.capitalize)(ie),value:ie})),J=typeof F=="string",q=J?(0,o.t)("dashboard.auto-grid.options.min-width","Min column width"):(0,o.t)("dashboard.auto-grid.options.min-width-custom","Custom min width"),X=["1","2","3","4","5","6","7","8","9","10"].map(ie=>({label:ie,value:ie})),se=ie=>{const fe=parseInt(ie.target.value,10);if(isNaN(fe)||fe<50||fe>2e3){te(!0);return}else ne&&te(!1);V.onColumnWidthChanged(fe)},oe=ie=>{ie.value==="custom"&&Z(!0),V.onColumnWidthChanged(ie.value)},ae=()=>{ne&&te(!1),V.onColumnWidthChanged("standard")};return(0,t.jsxs)(y.B,{columnGap:2,rowGap:0,wrap:!0,children:[(0,t.jsx)(P.D,{label:q,invalid:ne,error:ne?(0,o.t)("dashboard.auto-grid.options.min-width-error","A number between 50 and 2000 is required"):void 0,className:Y.wideSelector,children:J?(0,t.jsx)(d.G,{options:Q,value:F,onChange:oe}):(0,t.jsx)(D.p,{defaultValue:F,onBlur:se,ref:ie=>
198H(ie),type:"number",min:50,max:2e3,invalid:ne,suffix:(0,t.jsx)(b.$n,{size:"sm",fill:"text",icon:"times",tooltip:(0,o.t)("dashboard.auto-grid.options.min-width-custom-clear","Back to standard min column width"),onClick:ae,children:(0,o.t)("dashboard.auto-grid.options.custom-min-width.clear","Clear")})})}),(0,t.jsx)(P.D,{label:(0,o.t)("dashboard.auto-grid.options.max-columns","Max columns"),className:Y.narrowSelector,children:(0,t.jsx)(d.G,{options:X,value:String(U),onChange:({value:ie})=>V.onMaxColumnCountChanged(parseInt(ie,10)),width:6.5})})]})}function O({layoutManager:V}){const{rowHeight:U,fillScreen:F}=V.useState(),[M,H]=p.useState(null),[_,Z]=p.useState(!1),[ne,te]=p.useState(!1),Y=(0,c.of)(I);(0,p.useEffect)(()=>{_&&M&&(M.focus(),Z(!1))},[_,M]);const Q=["short","standard","tall","custom"].map(ae=>({label:(0,g.capitalize)(ae),value:ae})),J=typeof U=="string",q=U?(0,o.t)("dashboard.auto-grid.options.min-height","Row height"):(0,o.t)("dashboard.auto-grid.options.min-height-custom","Custom row height"),X=ae=>{const ie=parseInt(ae.target.value,10);if(isNaN(ie)||ie<50||ie>2e3){te(!0);return}else ne&&te(!1);V.onRowHeightChanged(ie)},se=ae=>{ae.value==="custom"&&Z(!0),V.onRowHeightChanged(ae.value)},oe=()=>{ne&&te(!1),V.onRowHeightChanged("standard")};return(0,t.jsxs)(y.B,{columnGap:2,rowGap:0,wrap:!0,children:[(0,t.jsx)(P.D,{label:q,invalid:ne,error:ne?(0,o.t)("dashboard.auto-grid.options.min-height-error","A number between 50 and 2000 is required"):void 0,className:Y.wideSelector,children:J?(0,t.jsx)(d.G,{options:Q,value:U,onChange:se}):(0,t.jsx)(D.p,{defaultValue:U,onBlur:X,ref:ae=>H(ae),type:"number",min:50,max:2e3,invalid:ne,suffix:(0,t.jsx)(b.$n,{size:"sm",fill:"text",icon:"times",tooltip:(0,o.t)("dashboard.auto-grid.options.min-width-custom-clear","Back to standard min column width"),onClick:oe,children:(0,o.t)("dashboard.auto-grid.options.custom-min-height.clear","Clear")})})}),(0,t.jsx)(P.D,{label:(0,o.t)("dashboard.auto-grid.options.height-fill","Fill screen"),className:Y.narrowSelector,children:(0,t.jsx)(E.K,{value:F,onChange:()=>V.onFillScreenChanged(!F)})})]})}const I=V=>({wideSelector:(0,x.css)({minWidth:V.spacing(14),flex:`1 1 ${V.spacing(14)}`}),narrowSelector:(0,x.css)({width:V.spacing(10)})}),R=3,T="standard",L="standard";class K extends n.Bs{constructor(U){const F=U.maxColumnCount??R,M=U.columnWidth??T,H=U.rowHeight??L,_=U.fillScreen??!1;super({...U,maxColumnCount:F,columnWidth:M,rowHeight:H,fillScreen:_,layout:U.layout??new i.o({isDraggable:!0,templateColumns:W(F,M),autoRows:j(H,_)})}),this.isDashboardLayoutManager=!0,this.descriptor=K.descriptor}static{this.Component=A}static{this.descriptor={get name(){return(0,o.t)("dashboard.auto-grid.name","Auto grid")},get description(){return(0,o.t)("dashboard.auto-grid.description","Panels resize to fit and form uniform grids")},id:"AutoGridLayout",createFromLayout:K.createFromLayout,isGridLayout:!0,icon:"apps"}}serialize(){return(0,m.K4)(this)}addPanel(U){const F=l.b4.getNextPanelId(this);U.setState({key:(0,f.XA)(F)}),U.clearParent(),this.state.layout.setState({children:[...this.state.layout.state.children,new u.X({body:U})]}),this.publishEvent(new s.jO(U),!0)}pastePanel(){const U=(0,h.dp)((0,f.YQ)(this));this.state.layout.setState({children:[...this.state.layout.state.children,U]}),this.publishEvent(new s.jO(U),!0),(0,h.G2)()}removePanel(U){const F=U.parent;this.state.layout.setState({children:this.state.layout.state.children.filter(M=>M!==F)}),this.publishEvent(new s.ck(U),!0)}duplicate(){const U=this.state.layout.state.children,F=[];if(U.length){let M=l.b4.getNextPanelId(U[0].state.body);U.forEach(H=>{const _=H.clone({key:void 0,body:H.state.body.clone({key:(0,f.XA)(M)})});F.push(_),M++})}return this.clone({key:void 0,layout:this.state.layout.clone({key:void 0,children:F})})}duplicatePanel(U){const F=U.parent;if(!(F instanceof u.X)){console.error("Trying to duplicate a panel that is not inside a DashboardGridItem");return}const M=l.b4.getNextPanelId(this),H=this.state.layout,_=U.clone({key:(0,f.XA)(M)}),Z=F.clone({key:(0,f.ty)(M),body:_}),ne=H.state.children.indexOf(F),te=[...H.state.children];te.splice(ne+1,0,Z),H.setState({children:te}),this.publishEvent(new s.jO(_),!0)}getVizPanels(){const U=[];for(const F of this.state.layout.state.children)F instanceof u.X&&U.push(F.state.body);return U}editModeChanged(U){this.state.layout.setState({isDraggable:U}),(0,f.X0)(this.state.layout,!0)}cloneLayout(U,F){return this.clone({layout:this.state.layout.clone({isDraggable:F&&this.state.layout.state.isDraggable,children:this.state.layout.state.children.map(M=>
198{if(M instanceof u.X){const H=(0,f.Cs)(M.state.body),_=(0,a.ed)(U,(0,f.ty)(H));return M.clone({key:_,body:M.state.body.clone({key:(0,a.ed)(_,(0,f.XA)(H))})})}throw new Error("Unexpected child type")})})})}getOptions(){return C(this)}onMaxColumnCountChanged(U){this.setState({maxColumnCount:U}),this.state.layout.setState({templateColumns:W(U,this.state.columnWidth)})}onColumnWidthChanged(U){U==="custom"&&(U=N(this.state.columnWidth)),this.setState({columnWidth:U}),this.state.layout.setState({templateColumns:W(this.state.maxColumnCount,this.state.columnWidth)})}onFillScreenChanged(U){this.setState({fillScreen:U}),this.state.layout.setState({autoRows:j(this.state.rowHeight,U)})}onRowHeightChanged(U){U==="custom"&&(U=w(this.state.rowHeight)),this.setState({rowHeight:U}),this.state.layout.setState({autoRows:j(U,this.state.fillScreen)})}static createEmpty(){return new K({})}static createFromLayout(U){const F=U.getVizPanels(),M=[];for(let _ of F)M.push(new u.X({body:_.clone()}));const H=K.createEmpty();return H.state.layout.setState({children:M,isDraggable:(0,f.YQ)(U).state.isEditing}),H}}function A({model:V}){return(0,t.jsx)(V.state.layout.Component,{model:V.state.layout})}function W(V,U){return`repeat(auto-fit, minmax(min(max(100% / ${V} - ${r.dU}px, ${N(U)}px), 100%), 1fr))`}function N(V){if(typeof V=="number")return V;switch(V){case"narrow":return 192;case"wide":return 768;case"custom":case"standard":default:return 448}}function w(V){if(typeof V=="number")return V;switch(V){case"short":return 128;case"tall":return 512;case"custom":case"standard":default:return 320}}function j(V,U){const F=w(V),M=U?"auto":`${F}px`;return`minmax(${F}px, ${M})`}},39242:(ee,B,e)=>{"use strict";e.d(B,{MS:()=>r,PP:()=>o,PS:()=>n,hM:()=>t});const t="--responsive-grid-dragged-item-top",n="--responsive-grid-dragged-item-left",r="--responsive-grid-dragged-item-width",o="--responsive-grid-dragged-item-height"},93389:(ee,B,e)=>{"use strict";e.d(B,{U:()=>O});var t=e(2543),n=e(96540),r=e(56838),o=e(95943),s=e(3371),m=e(8285),a=e(41667),l=e(39765),f=e(74848),h=e(77824),u=e(18857),i=e(56840),x=e(25797),g=e(51156),p=e(31819);function c(I){return[new x.C({title:(0,i.t)("dashboard.default-layout.item-options.repeat.title","Repeat options"),id:"Repeat options",isOpenDefault:!1}).addItem(new g.v({title:(0,i.t)("dashboard.default-layout.item-options.repeat.variable.title","Repeat by variable"),description:(0,i.t)("dashboard.default-layout.item-options.repeat.variable.description","Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard."),render:()=>(0,f.jsx)(d,{gridItem:I})})).addItem(new g.v({title:(0,i.t)("dashboard.default-layout.item-options.repeat.direction.title","Repeat direction"),useShowIf:()=>{const{variableName:T}=I.useState();return!!T},render:()=>(0,f.jsx)(y,{gridItem:I})})).addItem(new g.v({title:(0,i.t)("dashboard.default-layout.item-options.repeat.max","Max per row"),useShowIf:()=>{const{variableName:T,repeatDirection:L}=I.useState();return!!T&&L==="h"},render:()=>(0,f.jsx)(P,{gridItem:I})}))]}function y({gridItem:I}){const{repeatDirection:R}=I.useState(),T=[{label:(0,i.t)("dashboard.default-layout.item-options.repeat.direction.horizontal","Horizontal"),value:"h"},{label:(0,i.t)("dashboard.default-layout.item-options.repeat.direction.vertical","Vertical"),value:"v"}];return(0,f.jsx)(h.z,{options:T,value:R??"h",onChange:L=>I.setRepeatDirection(L)})}function P({gridItem:I}){const{maxPerRow:R}=I.useState(),T=[2,3,4,6,8,12].map(L=>({label:L.toString(),value:L}));return(0,f.jsx)(u.l6,{options:T,value:R??4,onChange:L=>I.setMaxPerRow(L.value)})}function d({gridItem:I}){const{variableName:R,width:T}=I.useState();return(0,f.jsx)(p.U,{id:"repeat-by-variable-select",sceneContext:I,repeat:R,onChange:L=>{L!==R&&(I.setRepeatByVariable(L),I.handleVariableName(),T!==24&&(I.setState({width:24}),r.jh.getAncestor(I,r.hy).forceRender()))}})}var D=e(22803),b=e(43173);function E({model:I}){const{repeatedPanels:R,itemHeight:T,variableName:L,body:K}=I.useState(),A=R?.length??0,W=v(I.getRepeatDirection(),A,I.getMaxPerRow(),T??10);return!L&&K instanceof r.Eb?(0,f.jsx)("div",{className:C,ref:I.containerRef,children:(0,f.jsx)(K.Component,{model:K},K.state.key)}):R?(0,f.jsx)("div",{className:W,ref:I.containerRef,children:R.map(N=>(0,f.jsx)("div",{className:C,children:(0,f.jsx)(N.Component,{model:N},N.state.key)},N.state.key))}):null}function v(I,R,T,L){return(0,n.useMemo)(()=>{const K=b.$.theme2,A=L*o.sD*R+(R-1)*o.dU;if(I==="h"){const W=Math.ceil(R/T),N=Math.min(R,T);return(0,D.css)({display:"grid",height:"100%",width:"100%",gridTemplateColumns:`repeat(${N}, 1fr)`,gridTemplateRows:`repeat(${W}, 1fr)`,gridColumnGap:K.spacing(1),gridRowGap:K.spacing(1),[K.breakpoints.down("md")]:{dis
198play:"flex",flexDirection:"column",height:A}})}return(0,D.css)({display:"flex",height:"100%",width:"100%",flexDirection:"column",gap:K.spacing(1),[K.breakpoints.down("md")]:{height:A}})},[I,R,T,L])}const C=(0,D.css)({display:"flex",flexGrow:1,position:"relative",width:"100%",height:"100%"});class S{constructor(R){this._gridItem=R}getNames(){return this._gridItem.state.variableName?new Set([this._gridItem.state.variableName]):new Set}hasDependencyOn(R){return this._gridItem.state.variableName===R}variableUpdateCompleted(R){this._gridItem.state.variableName===R.state.name&&this._gridItem.performRepeat()}}class O extends r.Bs{constructor(R){super(R),this._variableDependency=new S(this),this.isDashboardLayoutItem=!0,this.containerRef=n.createRef(),this.addActivationHandler(()=>this.handleVariableName())}static{this.Component=E}_handleGridResize(R,T){const L=this.state.repeatedPanels?.length??1,K={};if(R.height!==T.height){if(this.getRepeatDirection()==="v")K.itemHeight=Math.ceil(R.height/L);else{const A=Math.ceil(L/this.getMaxPerRow());K.itemHeight=Math.ceil(R.height/A)}K.itemHeight!==this.state.itemHeight&&this.setState(K)}}getClassName(){return this.state.variableName?"panel-repeater-grid-item":""}getOptions(){return c(this)}setElementBody(R){this.setState({body:R})}editingStarted(){this.state.variableName&&(this.state.repeatedPanels?.length??!1)&&this.state.body.setState({$variables:this.state.repeatedPanels[0].state.$variables?.clone(),$data:this.state.repeatedPanels[0].state.$data?.clone()})}editingCompleted(R){R&&(this._prevRepeatValues=void 0),this.state.variableName&&this.state.repeatDirection==="h"&&this.state.width!==o.cV&&this.setState({width:o.cV})}performRepeat(){if(!this.state.variableName||r.jh.hasVariableDependencyInLoadingState(this))return;const R=r.jh.lookupVariable(this.state.variableName,this)??new r.yP({name:"_____default_sys_repeat_var_____",options:[],value:"",text:"",query:"A"});if(!(R instanceof r.n8)){console.error("DashboardGridItem: Variable is not a MultiValueVariable");return}const{values:T,texts:L}=(0,m.a7)(R);if((0,t.isEqual)(this._prevRepeatValues,T))return;const K=this.state.body,A=[],W={values:[""],texts:R.hasAllValue()?["All"]:["None"]},N=T.length?T:W.values,w=L.length?L:W.texts;for(let H=0;H<N.length;H++){const _={$variables:new r.Pj({variables:[new r.xc({name:R.state.name,value:N[H],text:String(w[H]),isMulti:R.state.isMulti,includeAll:R.state.includeAll})]}),key:(0,s.lv)(K.state.key,H)},Z=K.clone(_);A.push(Z)}const j=this.getRepeatDirection(),V={repeatedPanels:A},U=this.state.itemHeight??10,F=this.state.height,M=this.getMaxPerRow();if(j==="h"){const H=Math.ceil(A.length/M);V.height=H*U}else V.height=A.length*U;if(this.setState(V),F!==this.state.height){const H=r.jh.getLayout(this);H instanceof r.hy&&H.forceRender()}this._prevRepeatValues=T,this.publishEvent(new l.d({source:this}),!0)}handleVariableName(){this.state.variableName?this._gridSizeSub||(this._gridSizeSub=this.subscribeToState((R,T)=>this._handleGridResize(R,T)),this._subs.add(this._gridSizeSub)):this._gridSizeSub&&(this._gridSizeSub.unsubscribe(),this._subs.remove(this._gridSizeSub),this._gridSizeSub=void 0),this.performRepeat()}setRepeatByVariable(R){const T={variableName:R};R&&!this.state.repeatDirection&&(T.repeatDirection="h"),this.state.body.state.$variables&&this.state.body.setState({$variables:void 0}),this.setState(T)}getMaxPerRow(){return this.state.maxPerRow??4}setMaxPerRow(R){this.setState({maxPerRow:R})}getRepeatDirection(){return this.state.repeatDirection==="v"?"v":"h"}setRepeatDirection(R){this.setState({repeatDirection:R})}isRepeated(){return this.state.variableName!==void 0}scrollIntoView(){(0,a.d)(this,this.containerRef)}}},1131:(ee,B,e)=>{"use strict";e.d(B,{D:()=>S});var t=e(74848),n=e(22803),r=e(43173),o=e(56838),s=e(63142),m=e(95943),a=e(56840),l=e(84403),f=e(35282),h=e(17340),u=e(3371),i=e(1682),x=e(8285),g=e(6607),p=e(48492),c=e(93389),y=e(87308);const P=8,d=6,D=12,b=8;function E(R){const T=new Set;let L=0;function K(A){for(let W=0;W<A.state.width;W++)for(let N=0;N<A.state.height;N++){const w=`${A.state.x+W},${A.state.y+N}`;T.add(w),A.state.y+A.state.height>L&&(L=A.state.y+A.state.height)}}for(const A of R.state.children)if(K(A),A instanceof o.tI)for(const W of A.state.children)K(W);for(let A=0;A<1/0;A++){for(let W=0;W<=m.cV-P;W++){let N=!0;for(let w=0;w<P;w++){for(let j=0;j<d;j++){const V=`${W+w},${A+j}`;if(T.has(V)){N=!1;break}}if(!N)break}if(N)return v(T,{x:W,y:A,width:P,height:d},L)}if(A>L+d)break}return{x:0,y:L,width:D,height:b}}function v(R,T,L){if(T.y>=L)return T.width=D,T.height=b,T;for(let K=T.x+T.width+1;K<=m.cV;K++){let A=!0;for(let W=T.y;W<T.y+T.height;W++){const N=`${K},${W}`;if(R.has(N)){A=!1;break}}if(A)T.width=K-T.x;else break}for(let K=T.y+T.height+1;K<=L;K++){let A=!0;if(T.height>=20)break;for(let W=T.x;W<T.x+T.width;W++){const N=`${W},${K}`;if(R.has(N)){A=!1;break}}if(A)T.height=K-T.y;else break}return T}var C=e(18178);class S extends o.Bs{constructor(T){super(T),this.isDashboardLayoutManager=!0,this.descriptor=S.descriptor,this.addActivationHandler(()=>this._activationHandler())}static{this.Component=O}static{this.descriptor={get name(){return(0,a.t)("dashboard.default-layout.name","Custom")},get description(){return(0,a.t)("dashboard.default-layout.description","Position and size each panel individually")},id:"GridLayout",createFromLayout:S.createFromLayout,isGridLayout:!0,icon:"window-grid"}}serialize(){return(0,h.SW)(this)}_activationHandler(){r.$.featureToggles.dashboardNewLayouts&&this._subs.add(this.subscribeToEvent(o.V$,({payload:{evt:T,panel:L}})=>(0,x.wP)(this)?.startDraggingSync(T,L))),this._subs.add(this.state.grid.subscribeToState(({children:T},{children:L})=>{T.length===L.length&&this.publishEvent(new f.su(this.state.grid),!0)}))}addPanel(T){const L=i.b4.getNextPanelId(this);if(T.setState({key:(0,x.XA)(L)}),T.clearParent(),r.$.featureToggles.dashboardNewLayouts){const K=E(this.state.grid),A=new c.U({...K,body:T,key:(0,x.ty)(L)});this.state.grid.setState({children:[...this.state.grid.state.children,A]})}else{const K=new c.U({height:x.sw,width:x.vm,x:0,y:0,body:T,key:(0,x.ty)(L)});this.state.grid.setState({children:[K,...this.state.grid.state.children]})}this.publishEvent(new f.jO(T),!0)}pastePanel(){const T=E(this.state.grid),L=(0,p.qY)((0,x.YQ)(this),T);this.state.grid.setState({children:[...this.state.grid.state.children,L]}),this.publishEvent(new f.jO(L),!0),(0,p.G2)()}removePanel(T){const L=T.parent;if(!(L instanceof c.U))throw new Error("Trying to remove panel that is not inside a DashboardGridItem");const K=this.state.grid;let A;
198try{A=o.jh.getAncestor(L,o.tI)}catch{A=void 0}if(A){A.setState({children:A.state.children.filter(W=>W!==L)}),K.forceRender();return}this.state.grid.setState({children:K.state.children.filter(W=>W!==L)}),this.publishEvent(new f.ck(T),!0)}duplicatePanel(T){const L=T.parent;if(!(L instanceof c.U)){console.error("Trying to duplicate a panel that is not inside a DashboardGridItem");return}let K,A,W;const N=i.b4.getNextPanelId(this),w=this.state.grid;L instanceof c.U?(K=o.Go.cloneSceneObjectState(L.state.body.state),A=o.jh.getData(L.state.body).clone()):(K=o.Go.cloneSceneObjectState(T.state),A=o.jh.getData(T).clone()),delete A.state.data?.alertState;const j=new o.Eb({...K,$data:A,key:(0,x.XA)(N)});if(W=new c.U({x:L.state.x,y:L.state.y,height:L.state.height,itemHeight:L.state.height,width:L.state.width,variableName:L.state.variableName,repeatDirection:L.state.repeatDirection,maxPerRow:L.state.maxPerRow,key:(0,x.ty)(N),body:j}),L.parent instanceof o.tI){const V=L.parent;V.setState({children:[...V.state.children,W]}),w.forceRender();return}w.setState({children:[...w.state.children,W]}),this.publishEvent(new f.jO(j),!0)}duplicate(){const T=this.state.grid.state.children,L=T.find(W=>W instanceof c.U),K=[];if(T.length){let W=L?i.b4.getNextPanelId(L.state.body):1;T.forEach(N=>{if(N instanceof c.U){const w=N.clone({key:void 0,body:N.state.body.clone({key:(0,x.XA)(W)})});
198K.push(w),W++}else K.push(N.clone({key:void 0}))})}return this.clone({key:void 0,grid:this.state.grid.clone({key:void 0,children:K})})}getVizPanels(){const T=[];return this.state.grid.forEachChild(L=>{if(!(L instanceof c.U)&&!(L instanceof o.tI))throw new Error("Child is not a DashboardGridItem or SceneGridRow, invalid scene");L instanceof c.U&&L.state.body instanceof o.Eb?T.push(L.state.body):L instanceof o.tI&&L.forEachChild(K=>{K instanceof c.U&&K.state.body instanceof o.Eb&&T.push(K.state.body)})}),T}addNewRow(){const T=i.b4.getNextPanelId(this),L=new o.tI({key:(0,x.XA)(T),title:"Row title",actions:new C.u({}),y:0}),K=this.state.grid,A=K.state.children.findIndex(N=>N instanceof o.tI),W=K.state.children.splice(0,A===-1?K.state.children.length:A).map(N=>N.clone());return W&&L.setState({children:W}),K.setState({children:[L,...K.state.children]}),this.publishEvent(new f.jO(L),!0),L}editModeChanged(T){const L=()=>{this.state.grid.setState({isDraggable:T,isResizable:T}),(0,x.X0)(this.state.grid,!0)};if(r.$.featureToggles.dashboardNewLayouts){setTimeout(L,10);return}L()}activateRepeaters(){this.isActive||this.activate(),this.state.grid.isActive||this.state.grid.activate(),this.state.grid.forEachChild(T=>{if(T instanceof c.U&&!T.isActive){T.activate();return}if(T instanceof o.tI&&T.state.$behaviors){for(const L of T.state.$behaviors)if(L instanceof y.L&&!T.isActive){T.activate();break}T.state.children.forEach(L=>{if(L instanceof c.U&&!L.isActive){L.activate();return}})}})}cloneLayout(T,L){return this.clone({grid:this.state.grid.clone({isResizable:L&&this.state.grid.state.isResizable,isDraggable:L&&this.state.grid.state.isDraggable,children:this.state.grid.state.children.reduce((K,A)=>{if(A instanceof c.U){const W=(0,u.ed)(T,(0,x.ty)(K.panelId)),N=A.clone({key:W,body:A.state.body.clone({key:(0,u.ed)(W,(0,x.XA)(K.panelId++))}),isDraggable:L&&A.state.isDraggable,isResizable:L&&A.state.isResizable});return K.children.push(N),K}if(A instanceof o.tI){const W=(0,u.ed)(T,(0,x.XA)(K.panelId++)),N=A.clone({key:W,children:A.state.children.reduce((w,j)=>{if((0,u.Ry)(j.state.key))return w;if(!(j instanceof c.U))return w.push(j.clone()),w;const V=(0,u.ed)(W,(0,x.ty)(K.panelId)),U=j.clone({key:V,isDraggable:L&&j.state.isDraggable,isResizable:L&&j.state.isResizable,body:j.state.body.clone({key:(0,u.ed)(V,(0,x.XA)(K.panelId++))})});return w.push(U),w},[]),isDraggable:L&&A.state.isDraggable,isResizable:L&&A.state.isResizable});return K.children.push(N),K}return K.children.push(A.clone()),K},{panelId:0,children:[]}).children})})}removeRow(T,L=!1){const K=this.state.grid,A=K.state.children.filter(W=>W.state.key!==T.state.key);if(!L){const W=T.state.children.map(w=>w.clone()),N=K.state.children.findIndex(w=>w.state.key===T.state.key);A.splice(N,0,...W)}this.publishEvent(new f.ck(T),!0),K.setState({children:A})}collapseAllRows(){this.state.grid.state.children.forEach(T=>{T instanceof o.tI&&(T.state.isCollapsed||this.state.grid.toggleRow(T))})}expandAllRows(){this.state.grid.state.children.forEach(T=>{T instanceof o.tI&&T.state.isCollapsed&&this.state.grid.toggleRow(T)})}static createFromLayout(T){const L=T.getVizPanels();return S.fromVizPanels(L)}static fromVizPanels(T=[]){const L=[],A=m.cV/3;let W=0,N=0;for(let w of T)w.clearParent(),L.push(new c.U({key:(0,x.ty)((0,x.Cs)(w)),x:N,y:W,width:A,height:10,body:w})),N+=A,N+A>m.cV&&(N=0,W+=10);return new S({grid:new o.hy({children:L,isDraggable:!0,isResizable:!0})})}static fromGridItems(T,L,K){const A=T.reduce((W,N)=>(N.clearParent(),W.push(N),W),[]);return new S({grid:new o.hy({children:A,isDraggable:L,isResizable:K})})}}function O({model:R}){const{children:T}=(0,o.gn)(R.state.grid,{shouldActivateOrKeepAlive:!0}),L=(0,x.MZ)(R),{isEditing:K}=L.useState(),A=(0,u.Qp)(R),W=(0,s.of)(I),N=K&&r.$.featureToggles.dashboardNewLayouts&&!A;return R.parent===L&&T.length===0?(0,t.jsx)(l.A,{dashboard:L,canCreate:!!L.state.meta.canEdit},"dashboard-empty-state"):(0,t.jsxs)("div",{className:(0,n.cx)(W.container,K&&W.containerEditing),children:[R.state.grid.Component&&(0,t.jsx)(R.state.grid.Component,{model:R.state.grid}),N&&(0,t.jsx)("div",{className:W.actionsWrapper,children:(0,t.jsx)(g.f,{layoutManager:R})})]})}function I(R){return{container:(0,n.css)({width:"100%",display:"flex",flexGrow:1,flexDirection:"column"}),containerEditing:(0,n.css)({"> div:first-child":{flexGrow:"0 !important",minHeight:"250px"},"&:hover":{".dashboard-canvas-add-button":{opacity:1,filter:"unset"}}}),actionsWrapper:(0,n.css)({position:"relative",paddingBottom:R.spacing(5)})}}},87308:(ee,B,e)=>{"use strict";e.d(B,{L:()=>a});var t=e(2543),n=e.n(t),r=e(56838),o=e(3371),s=e(8285),m=e(39765);
198class a extends r.Bs{constructor(x){super(x),this._variableDependency=new r.Sh(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:()=>this.performRepeat()}),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this.performRepeat();const x=this._getLayout(),g=this._getRow(),p=g.state.children.filter(y=>!(0,o.Ry)(y.state.key)),c=x.subscribeToState(()=>{const y=x.state.children.filter(P=>(0,o.oX)(P.state.key,g.state.key));for(const P of y){if(!(P instanceof r.tI))continue;const d=P.state.children.filter(b=>!(0,o.Ry)(b.state.key));if(d.length===p.length)continue;const D=d.find(b=>!(0,o.ag)(b.state.key));if(D){const b=D.clone();if(P.setState({children:P.state.children.filter(E=>E!==D)}),g.state.children.find(E=>E.state.key===b.state.key))return;g.setState({children:[...g.state.children,b]}),this.performRepeat(!0)}}});return()=>{c.unsubscribe()}}_getRow(){if(!(this.parent instanceof r.tI))throw new Error("RepeatedRowBehavior: Parent is not a SceneGridRow");return this.parent}_getLayout(){const x=r.jh.getLayout(this);if(!(x instanceof r.hy))throw new Error("RepeatedRowBehavior: Layout is not a SceneGridLayout");return x}performRepeat(x=!1){if(this._variableDependency.hasDependencyInLoadingState())return;const g=r.jh.lookupVariable(this.state.variableName,this.parent?.parent);if(!g){console.error("RepeatedRowBehavior: Variable not found");return}if(!(g instanceof r.n8)){console.error("RepeatedRowBehavior: Variable is not a MultiValueVariable");return}const p=this._getRow(),c=this._getLayout(),{values:y,texts:P}=(0,s.a7)(g);if((0,t.isEqual)(this._prevRepeatValues,y)&&!x)return;this._prevRepeatValues=y,this._clonedRows=[];const d=p.state.children,D=l(d);let b=0;const E={values:[""],texts:g.hasAllValue()?["All"]:["None"]},v=y.length?y:E.values,C=P.length?P:E.texts;for(let S=0;S<v.length;S++){const I=S===0?p:p.clone({y:(p.state.y??0)+D*S+S,$behaviors:[],actions:void 0}),R=(0,o.lv)(p.state.key,S);I.setState({key:R,$variables:new r.Pj({variables:[new r.xc({name:this.state.variableName,value:v[S],text:String(C[S]),isMulti:g.state.isMulti,includeAll:g.state.includeAll})]}),children:[]});const T=[];for(const L of d){const K=L.state.y??0,A=(0,o.ed)(R,(0,o.Dq)(L.state.key)),W=K+(D+1)*S,N=S>0?L.clone({isDraggable:!1,isResizable:!1}):L;N.setState({key:A,y:W}),S>0&&u(N,A),T.push(N),b<W+N.state.height&&(b=W+N.state.height)}I.setState({children:T}),this._clonedRows.push(I)}f(c,this._clonedRows,b,p.state.key),this.publishEvent(new m.d({source:this}),!0)}removeBehavior(){const x=this._getRow(),g=this._getLayout(),p=h(g,x.state.key);g.setState({children:p}),x.setState({$behaviors:x.state.$behaviors.filter(c=>c!==this),$variables:void 0})}}function l(i){let x=0,g=Number.MAX_VALUE;if(i.length===0)return 0;for(const p of i)p.state.y+p.state.height>x&&(x=p.state.y+p.state.height),p.state.y<g&&(g=p.state.y);return x-g}function f(i,x,g,p){const c=h(i,p),y=c.findIndex(d=>d instanceof r.tI&&(0,o.d9)(d.state.key)===(0,o.d9)(p));if(y===-1)throw new Error("RowRepeaterBehavior: Parent row not found in layout children");const P=[...c.slice(0,y),...x,...c.slice(y+1)];if(c.length>y+1){const d=c.slice(y+1),D=d[0].state.y,b=g-D;for(const E of d)if(E.setState({y:E.state.y+b}),E instanceof r.tI)for(const v of E.state.children)v.setState({y:v.state.y+b})}i.setState({children:P})}function h(i,x){return i.state.children.filter(g=>!(g instanceof r.tI)||!(0,o.oX)((0,o.Dq)(g.state.key),x))}function u(i,x){i.forEachChild(g=>{const p=(0,o.ed)(x,g.state.key);g.setState({key:p}),u(g,p)})}},18178:(ee,B,e)=>{"use strict";e.d(B,{u:()=>A});var t=e(56838),n=e(45229),r=e(56840),o=e(87745),s=e(1131),m=e(87308),a=e(74848),l=e(22803),f=e(96540),h=e(63142),u=e(30703),i=e(9931),x=e(18615),g=e(8285),p=e(93389),c=e(8515),y=e(22787),P=e(49785),d=e(85629),D=e(37386),b=e(63527),E=e(34999),v=e(89640),C=e(45861),S=e(31819);const O=({repeat:W,title:N,sceneContext:w,isUsingDashboardDS:j,onUpdate:V,onCancel:U})=>{const[F,M]=(0,f.useState)(W),H=(0,f.useCallback)(te=>M(te),[M]),{handleSubmit:_,register:Z}=(0,P.mN)({defaultValues:{title:N}}),ne=te=>{V(te.title,F)};return(0,a.jsxs)("form",{onSubmit:_(ne),children:[(0,a.jsx)(D.D,{label:(0,r.t)("dashboard.default-layout.row-options.form.title","Title"),children:(0,a.jsx)(b.p,{...Z("title"),type:"text"})}),(0,a.jsx)(D.D,{label:(0,r.t)("dashboard.default-layout.row-options.form.repeat-for.label","Repeat for"),children:(0,a.jsx)(S.U,{sceneContext:w,repeat:F,onChange:H})}),j&&(0,a.jsx)(E.F,{"data-testid":d.Tp.pages.Dashboard.Rows.Repeated.ConfigSection.warningMessage,severity:"warning",title:"",topSpacing:3,bottomSpacing:0,children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:(0,a.jsxs)(r.x6,{i18nKey:"dashboard.default-layout.row-options.form.repeat-for.warning.text",children:["Panels in this row use the ",{SHARED_DASHBOARD_QUERY:i.K}," data source. These panels will reference the panel in the original row, not the ones in the repeated rows."]})}),(0,a.jsx)(v.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/create-dashboard/#configure-repeating-rows",children:(0,a.jsx)(r.x6,{i18nKey:"dashboard.default-layout.row-options.form.repeat-for.learn-more",children:"Learn more"})})]})}),(0,a.jsxs)(y.a.ButtonRow,{children:[(0,a.jsx)(C.$n,{type:"button",variant:"secondary",onClick:U,fill:"outline",children:(0,a.jsx)(r.x6,{i18nKey:"dashboard.default-layout.row-options.form.cancel",children:"Cancel"})}),(0,a.jsx)(C.$n,{type:"submit",children:(0,a.jsx)(r.x6,{i18nKey:"dashboard.default-layout.row-options.form.update",children:"Update"})})]})]})},I=({repeat:W,title:N,parent:w,onDismiss:j,onUpdate:V,isUsingDashboardDS:U})=>{const F=(0,h.of)(R);return(0,a.jsx)(y.a,{isOpen:!0,title:(0,r.t)("dashboard.default-layout.row-options.modal.title","Row options"),onDismiss:j,className:F.modal,children:(0,a.jsx)(O,{sceneContext:w,repeat:W,title:N,onCancel:j,onUpdate:V,isUsingDashboardDS:U})})},R=()=>({modal:(0,l.css)({label:"RowOptionsModal",width:"500px"})}),T=({repeat:W,title:N,parent:w,onUpdate:j,isUsingDashboardDS:V})=>(0,a.jsx)(c.$s,{children:({showModal:U,hideModal:F})=>(0,a.jsx)("button",{type:"button",className:"pointer","aria-label":(0,r.t)("dashboard.default-layout.row-options.button.label","Row options"),onClick:()=>
198{U(I,{title:N,repeat:W,parent:w,onDismiss:F,onUpdate:(M,H)=>{j(M,H),F()},isUsingDashboardDS:V})},children:(0,a.jsx)(u.I,{name:"cog"})})});T.displayName="RowOptionsButton";function L({model:W}){const N=W.getParent(),{title:w,children:j}=N.useState(),V=(0,g.MZ)(W),{meta:U,isEditing:F}=(0,g.TN)(W),M=(0,h.of)(K),H=(0,f.useMemo)(()=>j.some(Z=>{if(!(Z instanceof p.U))return!1;if(Z.state.body instanceof t.Eb){const ne=(0,g.un)(Z.state.body);return ne?.state.datasource?.uid===i.K||ne?.state.datasource?.uid===x.uv&&ne?.state.queries.some(te=>te.datasource?.uid===i.K)}return!1}),[j]),_=N.state.$behaviors?.find(Z=>Z instanceof m.L);return(0,a.jsx)(a.Fragment,{children:U.canEdit&&F&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:M.rowActions,children:[(0,a.jsx)(T,{title:w,repeat:_ instanceof m.L?_.state.variableName:void 0,parent:V,onUpdate:(Z,ne)=>W.onUpdate(Z,ne),isUsingDashboardDS:H}),(0,a.jsx)("button",{type:"button",onClick:()=>W.onDelete(),"aria-label":(0,r.t)("dashboard.default-layout.row-actions.delete","Delete row"),children:(0,a.jsx)(u.I,{name:"trash-alt"})})]})})})}const K=W=>({rowActions:(0,l.css)({color:W.colors.text.secondary,lineHeight:"27px",button:{color:W.colors.text.secondary,paddingLeft:W.spacing(2),background:"transparent",border:"none","&:hover":{color:W.colors.text.maxContrast}}})});class A extends t.Bs{static{this.Component=L}getParent(){if(!(this.parent instanceof t.tI))throw new Error("RowActions must have a SceneGridRow parent");return this.parent}removeRow(N){t.jh.getAncestor(this,s.D).removeRow(this.getParent(),N)}onUpdate(N,w){const j=this.getParent();let V;if(j.state.$behaviors)for(let U of j.state.$behaviors)U instanceof m.L&&(V=U);N!==j.state.title&&j.setState({title:N}),w?(V&&V.removeBehavior(),V=new m.L({variableName:w}),j.setState({$behaviors:[...j.state.$behaviors??[],V]})):V?.removeBehavior()}onDelete(){n.A.publish(new o.bY({title:(0,r.t)("dashboard.default-layout.row-actions.modal.title","Delete row"),text:(0,r.t)("dashboard.default-layout.row-actions.modal.text","Are you sure you want to remove this row and all its panels?"),altActionText:(0,r.t)("dashboard.default-layout.row-actions.modal.alt-action","Delete row only"),icon:"trash-alt",onConfirm:()=>this.removeRow(!0),onAltAction:()=>this.removeRow()}))}}},97335:(ee,B,e)=>{"use strict";e.d(B,{o:()=>pe});var t=e(96540),n=e(56838),r=e(45229),o=e(95943),s=e(56840),m=e(29043),a=e(77197),l=e(87745),f=e(57558),h=e(76584),u=e(67350),i=e(8285),x=e(8835),g=e(76173),p=e(48492),c=e(41667),y=e(74848),P=e(85629),d=e(37386),D=e(63527),b=e(21285),E=e(34999),v=e(89640),C=e(25797),S=e(51156),O=e(31819),I=e(9931),R=e(18615),T=e(46415),L=e(44802),K=e(20246);function A(de,le){const{layout:me}=de.useState(),De=(0,t.useMemo)(()=>new C.C({title:"",id:"row-options"}).addItem(new S.v({title:(0,s.t)("dashboard.rows-layout.row-options.row.title","Title"),render:()=>(0,y.jsx)(W,{row:de,isNewElement:le})})).addItem(new S.v({title:(0,s.t)("dashboard.rows-layout.row-options.row.fill-screen","Fill screen"),render:()=>(0,y.jsx)(w,{row:de})})).addItem(new S.v({title:(0,s.t)("dashboard.rows-layout.row-options.row.hide-header","Hide row header"),render:()=>(0,y.jsx)(N,{row:de})})),[de,le]),Te=(0,t.useMemo)(()=>new C.C({title:(0,s.t)("dashboard.rows-layout.row-options.repeat.title","Repeat options"),id:"repeat-options",isOpenDefault:!1}).addItem(new S.v({title:(0,s.t)("dashboard.rows-layout.row-options.repeat.variable.title","Repeat by variable"),description:(0,s.t)("dashboard.rows-layout.row-options.repeat.variable.description","Repeat this row for each value in the selected variable."),render:()=>(0,y.jsx)(j,{row:de})})),[de]),Ne=(0,L.W)(me),Ce=[De,...Ne,Te],He=(0,t.useMemo)(()=>(0,T.h)(de.state.conditionalRendering),[de]);return He&&Ce.push(He),Ce}function W({row:de,isNewElement:le}){const{title:me}=de.useState(),De=(0,K.z4)({autoFocus:le}),Te=de.hasUniqueTitle();return(0,y.jsx)(d.D,{invalid:!Te,error:Te?void 0:(0,s.t)("dashboard.rows-layout.row-options.title-not-unique","Title should be unique"),children:(0,y.jsx)(D.p,{ref:De,title:(0,s.t)("dashboard.rows-layout.row-options.title-option","Title"),value:me,onChange:Ne=>de.onChangeTitle(Ne.currentTarget.value)})})}function N({row:de}){const{hideHeader:le=!1}=de.useState();return(0,y.jsx)(b.d,{value:le,onChange:()=>de.onHeaderHiddenToggle()})}function w({row:de}){const{fillScreen:le}=de.useState();return(0,y.jsx)(b.d,{value:le,onChange:()=>de.onChangeFillScreen(!le)})}function j({row:de}){const{layout:le}=de.useState(),me=(0,i.MZ)(de),De=le.getVizPanels().some(Te=>{const Ne=(0,i.un)(Te);return Ne?.state.datasource?.uid===I.K||Ne?.state.datasource?.uid===R.uv&&Ne?.state.queries.some(Ce=>Ce.datasource?.uid===I.K)});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(O.U,{sceneContext:me,repeat:de.getRepeatVariable(),onChange:Te=>de.onChangeRepeat(Te)}),De?(0,y.jsxs)(E.F,{"data-testid":P.Tp.pages.Dashboard.Rows.Repeated.ConfigSection.warningMessage,severity:"warning",title:"",topSpacing:3,bottomSpacing:0,children:[(0,y.jsx)("p",{children:(0,y.jsxs)(s.x6,{i18nKey:"dashboard.rows-layout.row.repeat.warning",children:["Panels in this row use the ",{SHARED_DASHBOARD_QUERY:I.K}," data source. These panels will reference the panel in the original row, not the ones in the repeated rows."]})}),(0,y.jsx)(v.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/create-dashboard/#configure-repeating-rows",children:(0,y.jsx)(s.x6,{i18nKey:"dashboard.rows-layout.row.repeat.learn-more",children:"Learn more"})})]}):void 0]})}var V=e(22803),U=e(57095),F=e(56887),M=e(63142),H=e(45861),_=e(36324),Z=e(30703),ne=e(45967),te=e(41116),Y=e(3371),Q=e(39385);function J({model:de}){const{layout:le,collapse:me,fillScreen:De,hideHeader:Te,isDropTarget:Ne,key:Ce}=de.useState(),He=(0,Y.Lv)(de),{isEditing:ke}=(0,i.TN)(de),[Me,$e,tt]=(0,te.H)(de),{isSelected:Ke,onSelect:Re,isSelectable:Ve}=(0,F.y)(Ce),Qe=(0,i.hg)(de),{rows:je}=de.getParentLayout().useState(),ze=(0,M.of)(q),Ye=(0,M.of)(H.my),Ge=de.parent?.parent instanceof Q.H$,ce=(0,_.C)(),Pe=je.findIndex(Xe=>Xe===de),Se=!me&&De,Ee=Me&&!ke,[xe,ye]=(0,t.useState)(!1),Oe=(0,t.useCallback)(()=>ye(!0),[]),we=(0,t.useCallback)(()=>ye(!1),[]),Be=!He&&ke;return Ee?null:(0,y.jsx)(U.Draggable,{draggableId:Ce,index:Pe,isDragDisabled:!Be,children:(Xe,st)=>(0,y.jsxs)("div",{ref:lt=>{Xe.innerRef(lt),de.containerRef.current=lt},"data-dashboard-drop-target-key":de.state.key,className:(0,V.cx)(ze.
198wrapper,!me&&ze.wrapperNotCollapsed,st.isDragging&&ze.dragging,ke&&!me&&ze.wrapperEditing,ke&&me&&ze.wrapperEditingCollapsed,me&&ze.wrapperCollapsed,Se&&ze.wrapperGrow,$e,!He&&Ke&&"dashboard-selected-element",!He&&!Ke&&xe&&"dashboard-selectable-element",Ne&&"dashboard-drop-target"),onPointerDown:lt=>{lt.stopPropagation(),ce.set(lt)},onPointerUp:lt=>{if(Ke&<.target instanceof Element&<.target.closest("button")){lt.stopPropagation();return}ce.check(lt)||setTimeout(()=>Re?.(lt))},...Xe.draggableProps,children:[(!Te||ke)&&(0,y.jsxs)("div",{className:(0,V.cx)(ze.rowHeader,"dashboard-row-header"),onMouseEnter:Ve?Oe:void 0,onMouseLeave:Ve?we:void 0,...Xe.dragHandleProps,children:[(0,y.jsxs)("button",{onClick:()=>de.onCollapseToggle(),className:(0,V.cx)(Ye,ze.rowTitleButton),"aria-label":me?(0,s.t)("dashboard.rows-layout.row.expand","Expand row"):(0,s.t)("dashboard.rows-layout.row.collapse","Collapse row"),"data-testid":P.Tp.components.DashboardRow.title(Qe),children:[(0,y.jsx)(Z.I,{name:me?"angle-right":"angle-down"}),(0,y.jsxs)("span",{className:(0,V.cx)(ze.rowTitle,Te&&ze.rowTitleHidden,!Ge&&ze.rowTitleNested,me&&ze.rowTitleCollapsed),role:"heading",children:[!de.hasUniqueTitle()&&(0,y.jsx)(ne.m,{content:(0,s.t)("dashboard.rows-layout.row-warning.title-not-unique","This title is not unique"),children:(0,y.jsx)(Z.I,{name:"exclamation-triangle"})}),Qe,Te&&(0,y.jsx)(ne.m,{content:(0,s.t)("dashboard.rows-layout.header-hidden-tooltip","Row header only visible in edit mode"),children:(0,y.jsx)(Z.I,{name:"eye-slash"})})]})]}),Be&&(0,y.jsx)(Z.I,{name:"draggabledots",className:"dashboard-row-header-drag-handle"})]}),!me&&(0,y.jsx)(le.Component,{model:le}),tt]})},Ce)}function q(de){return{rowHeader:(0,V.css)({display:"flex",gap:de.spacing(1),padding:de.spacing(.5,.5,.5,0),alignItems:"center",justifyContent:"space-between",marginBottom:de.spacing(1),"& .dashboard-row-header-drag-handle":(0,V.css)({opacity:0,[de.transitions.handleMotion("no-preference","reduce")]:{transition:"opacity 0.25s"}}),"&:hover":(0,V.css)({"& .dashboard-row-header-drag-handle":(0,V.css)({opacity:1})})}),rowTitleButton:(0,V.css)({display:"flex",alignItems:"center",cursor:"pointer",background:"transparent",border:"none",minWidth:0,gap:de.spacing(1)}),rowTitle:(0,V.css)({display:"flex",alignItems:"center",gap:de.spacing(2),fontSize:de.typography.h5.fontSize,fontWeight:de.typography.fontWeightMedium,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",flexGrow:1,minWidth:0}),rowTitleHidden:(0,V.css)({textDecoration:"line-through",opacity:.6,"&:hover":(0,V.css)({opacity:1})}),rowTitleNested:(0,V.css)({fontSize:de.typography.body.fontSize,fontWeight:de.typography.fontWeightRegular}),rowTitleCollapsed:(0,V.css)({color:de.colors.text.secondary}),wrapper:(0,V.css)({display:"flex",flexDirection:"column",minHeight:"100px"}),wrapperNotCollapsed:(0,V.css)({"> div:nth-child(2)":{marginLeft:de.spacing(3),position:"relative",width:"auto","&:before":{content:'""',position:"absolute",top:"-8px",bottom:0,left:"-16px",width:"1px",backgroundColor:de.colors.border.weak}}}),dragging:(0,V.css)({cursor:"move"}),wrapperEditing:(0,V.css)({padding:de.spacing(.5),".dashboard-row-header":{padding:0}}),wrapperEditingCollapsed:(0,V.css)({padding:de.spacing(.5),".dashboard-row-header":{marginBottom:de.spacing(0),padding:0}}),wrapperGrow:(0,V.css)({flexGrow:1}),wrapperCollapsed:(0,V.css)({flexGrow:0,borderBottom:`1px solid ${de.colors.border.weak}`,minHeight:"unset",".dashboard-row-header":{marginBottom:de.spacing(0)}}),rowActions:(0,V.css)({display:"flex",opacity:0}
198),checkboxWrapper:(0,V.css)({display:"flex",alignItems:"center",paddingLeft:de.spacing(1)})}}var X=e(85269),se=e(32635);function oe(de){return[new C.C({title:"",id:"rows-options"}).addItem(new S.v({title:(0,s.t)("dashboard.edit-pane.row.header.title","Row header"),render:()=>(0,y.jsx)(ae,{model:de})}))]}function ae({model:de}){const le=de.getRows();let me=!1,De=!1;for(let Te=0;Te<le.length;Te++){const{hideHeader:Ne}=le[Te].useState(),Ce=le[Te-1];De=De||Ce&&!!Ce.state.hideHeader!=!!Ne,me=me||!!Ne}return(0,y.jsx)(se.S,{label:(0,s.t)("dashboard.edit-pane.row.header.hide","Hide"),value:me,indeterminate:De,onChange:()=>de.onHeaderHiddenToggle(me,De)})}class ie{constructor(le){this._rows=le,this.isEditableDashboardElement=!0}getEditableElementInfo(){return{typeName:(0,s.t)("dashboard.edit-pane.elements.rows","Rows"),icon:"folder",instanceName:""}}useEditPaneOptions(){return oe(this)}getRows(){return this._rows}onDelete(){this._rows.forEach(le=>le.onDelete())}onHeaderHiddenToggle(le,me){this._rows.forEach(De=>De.onHeaderHiddenToggle(me?!0:!le))}}var fe=e(80038);class pe extends n.Bs{constructor(le){super({...le,title:le?.title??(0,s.t)("dashboard.rows-layout.row.new","New row"),layout:le?.layout??x.X2.createEmpty(),conditionalRendering:le?.conditionalRendering??f.p.createEmpty()}),this._variableDependency=new n.Sh(this,{statePaths:["title"]}),this.isEditableDashboardElement=!0,this.isDashboardDropTarget=!0,this._layoutRestorer=new g.r,this.containerRef=t.createRef(),this.addActivationHandler(()=>this._activationHandler())}static{this.Component=J}_activationHandler(){const le=this.state.conditionalRendering?.activate();return()=>{le&&le()}}getEditableElementInfo(){return{typeName:(0,s.t)("dashboard.edit-pane.elements.row","Row"),instanceName:n.jh.interpolate(this,this.state.title,void 0,"text"),icon:"list-ul",isContainer:!0}}getLayout(){return this.state.layout}getSlug(){return a.A.slugifyForUrl(n.jh.interpolate(this,this.state.title??"Row"))}switchLayout(le){this.setState({layout:this._layoutRestorer.getLayout(le,this.state.layout)})}useEditPaneOptions(le){return A(this,le)}onDelete(){this.getParentLayout().removeRow(this)}onConfirmDelete(){if(this.getLayout().getVizPanels().length===0){this.onDelete();return}if(this.getParentLayout().shouldUngroup()){this.onDelete();return}r.A.publish(new l.bY({title:(0,s.t)("dashboard.rows-layout.delete-row-title","Delete row?"),text:(0,s.t)("dashboard.rows-layout.delete-row-text","Deleting this row will also remove all panels. Are you sure you want to continue?"),yesText:(0,s.t)("dashboard.rows-layout.delete-row-yes","Delete"),onConfirm:()=>{this.onDelete()}}))}createMultiSelectedElement(le){return new ie(le.filter(me=>me instanceof pe))}onDuplicate(){this.getParentLayout().duplicateRow(this)}duplicate(){return this.clone({key:void 0,layout:this.getLayout().duplicate()})}serialize(){return(0,h.HQ)(this)}onCopy(){const le=(0,u.IC)(this.getLayout(),(0,i.YQ)(this));(0,p.G2)(),m.A.set(o.rt,JSON.stringify({elements:le,row:this.serialize()}))}onAddPanel(le=(0,i.O8)()){this.getLayout().addPanel(le)}setIsDropTarget(le){!!this.state.isDropTarget!==le&&this.setState({isDropTarget:le})}draggedPanelOutside(le){this.getLayout().removePanel?.(le),this.setIsDropTarget(!1)}draggedPanelInside(le){le.clearParent(),this.getLayout().addPanel(le),this.setIsDropTarget(!1)}getRepeatVariable(){return this._getRepeatBehavior()?.state.variableName}onChangeTitle(le){this.setState({title:le})}onChangeName(le){this.onChangeTitle(le)}onHeaderHiddenToggle(le=!this.state.hideHeader){this.setState({hideHeader:le})}onChangeFillScreen(le){this.setState({fillScreen:le})}onChangeRepeat(le){let me=this._getRepeatBehavior();le?(me&&me.removeBehavior(),me=new X.y({variableName:le}),this.setState({$behaviors:[...this.state.$behaviors??[],me]}),me.activate()):me?.removeBehavior()}onCollapseToggle(){this.setState({collapse:!this.state.collapse})}getParentLayout(){return n.jh.getAncestor(this,fe.V)}_getRepeatBehavior(){return this.state.$behaviors?.find(le=>le instanceof X.y)}scrollIntoView(){(0,c.d)(this,this.containerRef)}getCollapsedState(){return this.state.collapse??!1}setCollapsedState(le){this.setState({collapse:le})}hasUniqueTitle(){return!this.getParentLayout().duplicateTitles().has(this.state.title)}}},85269:(ee,B,e)=>{"use strict";e.d(B,{y:()=>f});var t=e(2543),n=e.n(t),r=e(56838),o=e(3371),s=e(8285),m=e(39765),a=e(97335),l=e(80038);
198class f extends r.Bs{constructor(x){super(x),this._variableDependency=new r.Sh(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:()=>this.performRepeat()}),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this.performRepeat()}_getRow(){if(!(this.parent instanceof a.o))throw new Error("RepeatedRowItemBehavior: Parent is not a RowItem");return this.parent}_getLayout(){const x=this._getRow().parent;if(!(x instanceof l.V))throw new Error("RepeatedRowItemBehavior: Layout is not a RowsLayoutManager");return x}performRepeat(x=!1){if(this._variableDependency.hasDependencyInLoadingState())return;const g=r.jh.lookupVariable(this.state.variableName,this.parent?.parent);if(!g){console.error("RepeatedRowItemBehavior: Variable not found");return}if(!(g instanceof r.n8)){console.error("RepeatedRowItemBehavior: Variable is not a MultiValueVariable");return}const p=this._getRow(),c=this._getLayout(),{values:y,texts:P}=(0,s.a7)(g);if((0,t.isEqual)(this._prevRepeatValues,y)&&!x)return;this._prevRepeatValues=y,this._clonedRows=[];const d=p.getLayout(),D={values:[""],texts:g.hasAllValue()?["All"]:["None"]},b=y.length?y:D.values,E=P.length?P:D.texts;for(let v=0;v<b.length;v++){const C=v===0,S=C?p:p.clone({$behaviors:[]}),O=(0,o.lv)(p.state.key,v);S.setState({key:O,$variables:new r.Pj({variables:[new r.xc({name:this.state.variableName,value:b[v],text:String(E[v]),isMulti:g.state.isMulti,includeAll:g.state.includeAll})]}),layout:d.cloneLayout?.(O,C)}),this._clonedRows.push(S)}h(c,this._clonedRows,p.state.key),this.publishEvent(new m.d({source:this}),!0)}removeBehavior(){const x=this._getRow(),g=this._getLayout(),p=u(g,x.state.key);g.setState({rows:p}),x.setState({$behaviors:x.state.$behaviors.filter(c=>c!==this),$variables:void 0})}}function h(i,x,g){const p=u(i,g),c=p.findIndex(y=>y.state.key.includes(g));if(c===-1)throw new Error("RowItemRepeaterBehavior: Row not found in layout");i.setState({rows:[...p.slice(0,c),...x,...p.slice(c+1)]})}function u(i,x){return i.state.rows.filter(g=>!(0,o.oX)(g.state.key,x))}},80038:(ee,B,e)=>{"use strict";e.d(B,{V:()=>S});var t=e(56838),n=e(56840),r=e(35282),o=e(76584),s=e(3371),m=e(1682),a=e(8285),l=e(93389),f=e(1131),h=e(87308),u=e(34031),i=e(37365),x=e(48492),g=e(20246),p=e(97335),c=e(85269),y=e(74848),P=e(22803),d=e(57095),D=e(63142),b=e(45861),E=e(61659);function v({model:O}){const{rows:I,key:R}=O.useState(),{isEditing:T}=(0,a.TN)(O),L=(0,D.of)(C),{hasCopiedRow:K}=(0,E.x)();return(0,y.jsx)(d.DragDropContext,{onBeforeDragStart:A=>O.forceSelectRow(A.draggableId),onDragEnd:A=>{A.destination&&A.destination.index!==A.source.index&&O.moveRow(A.draggableId,A.source.index,A.destination.index)},children:(0,y.jsx)(d.Droppable,{droppableId:R,direction:"vertical",children:A=>(0,y.jsxs)("div",{className:L.wrapper,ref:A.innerRef,...A.droppableProps,children:[I.map(W=>(0,y.jsx)(W.Component,{model:W},W.state.key)),A.placeholder,T&&(0,y.jsxs)("div",{className:"dashboard-canvas-add-button",children:[(0,y.jsx)(b.$n,{icon:"plus",variant:"primary",fill:"text",onClick:()=>O.addNewRow(),children:(0,y.jsx)(n.x6,{i18nKey:"dashboard.canvas-actions.new-row",children:"New row"})}),K&&(0,y.jsx)(b.$n,{icon:"clipboard-alt",variant:"primary",fill:"text",onClick:()=>O.pasteRow(),children:(0,y.jsx)(n.x6,{i18nKey:"dashboard.canvas-actions.paste-row",children:"Paste row"})})]})]})})})}function C(O){return{wrapper:(0,P.css)({display:"flex",flexDirection:"column",gap:O.spacing(1),flexGrow:1,width:"100%"})}}class S extends t.Bs{constructor(){super(...arguments),this.isDashboardLayoutManager=!0,this.descriptor=S.descriptor}static{this.Component=v}static{this.descriptor={get name(){return(0,n.t)("dashboard.rows-layout.name","Rows")},get description(){return(0,n.t)("dashboard.rows-layout.description","Collapsable panel groups with headings")},id:"RowsLayout",createFromLayout:S.createFromLayout,isGridLayout:!1,icon:"list-ul"}}serialize(){return(0,o.aL)(this)}addPanel(I){const R=m.b4.getAllSelectedObjects(this).filter(T=>T instanceof p.o);if(R.length>0)return R.forEach(T=>T.onAddPanel(I));if(this.state.rows.length>0)return this.state.rows[0].onAddPanel(I);this.addNewRow(),this.state.rows[this.state.rows.length-1].onAddPanel(I)}getVizPanels(){const I=[];for(const R of this.state.rows){const T=R.getLayout().getVizPanels();I.push(...T)}return I}cloneLayout(I,R){return this.clone({rows:this.state.rows.map(T=>{const L=(0,s.ed)(I,T.state.key);return T.clone({key:L,layout:T.state.layout.cloneLayout(L,R)})})})}duplicate(){const I=this.state.rows.map(R=>R.duplicate());return this.clone({rows:I,key:void 0})}duplicateRow(I){const R=I.duplicate();this.addNewRow(R)}addNewRow(I){const R=I??new p.o({}),T=new Set(this.state.rows.map(K=>K.state.title).filter(K=>K!==void 0)),L=(0,g.BK)(R.state.title,T);return L!==R.state.title&&R.setState({title:L}),this.setState({rows:[...this.state.rows,R]}),this.publishEvent(new r.jO(R),!0),R}editModeChanged(I){this.state.rows.forEach(R=>R.getLayout().editModeChanged?.(I))}pasteRow(){const I=(0,a.YQ)(this),R=(0,x.$v)(I);this.addNewRow(R)}activateRepeaters(){this.state.rows.forEach(I=>{I.isActive||I.activate();const R=(I.state.$behaviors??[]).find(T=>T instanceof c.y);R?.isActive||R?.activate(),I.getLayout().activateRepeaters?.()})}shouldUngroup(){return this.state.rows.length===1}removeRow(I){if(this.shouldUngroup()){(0,g.f)(this,I.state.layout);return}const R=this.state.rows.filter(T=>T!==I);this.setState({rows:R}),this.publishEvent(new r.ck(I),!0)}moveRow(I,R,T){const L=[...this.state.rows],[K]=L.splice(R,1);L.splice(T,0,K),this.setState({rows:L}),this.publishEvent(new r.su(this),!0)}forceSelectRow(I){const R=this.state.rows.findIndex(K=>
198K.state.key===I),T=this.state.rows[R];if(!T)return;(0,a.YQ)(this).state.editPane.selectObject(T,I,{force:!0,multi:!1})}static createEmpty(){return new S({rows:[new p.o]})}static createFromLayout(I){let R=[];if(I instanceof i.K)for(const T of I.state.tabs){if((0,s.Ry)(T.state.key))continue;const L=T.state.conditionalRendering;L?.clearParent();const K=T.state.$behaviors?.find(W=>W instanceof u.T),A=K?[new c.y({variableName:K.state.variableName})]:void 0;R.push(new p.o({layout:T.state.layout.clone(),title:T.state.title,conditionalRendering:L,$behaviors:A}))}else if(I instanceof f.D){const T=[];let L;I.state.grid.forEachChild(K=>{if(!(K instanceof l.U)&&!(K instanceof t.tI))throw new Error("Child is not a DashboardGridItem or SceneGridRow, invalid scene");if(K instanceof t.tI){if(!(0,s.Ry)(K.state.key)){const A=K.state.$behaviors?.find(W=>W instanceof h.L);T.push({title:K.state.title,isCollapsed:!!K.state.isCollapsed,isDraggable:K.state.isDraggable,isResizable:K.state.isResizable,children:K.state.children,repeat:A?.state.variableName}),L=void 0}}else L||(L=[],T.push({children:L})),L.push(K)}),R=T.map(K=>new p.o({title:K.title,collapse:!!K.isCollapsed,layout:f.D.fromGridItems(K.children,K.isDraggable??I.state.grid.state.isDraggable,K.isResizable??I.state.grid.state.isResizable),$behaviors:K.repeat?[new c.y({variableName:K.repeat})]:[]}))}else R=[new p.o({layout:I.clone()})];return R.length===0&&(R=[new p.o]),new S({rows:R})}duplicateTitles(){const I=new Map,R=new Set;return this.state.rows.forEach(T=>{const L=t.jh.interpolate(T,T.state.title),K=(I.get(L)??0)+1;I.set(L,K),K>1&&L&&R.add(L)}),R}}},92769:(ee,B,e)=>{"use strict";e.d(B,{V:()=>X});var t=e(96540),n=e(56838),r=e(95943),o=e(73427),s=e(56840),m=e(29043),a=e(77197),l=e(87745),f=e(57558),h=e(6461),u=e(67350),i=e(8285),x=e(8835),g=e(76173),p=e(48492),c=e(41667),y=e(74848),P=e(85629),d=e(37386),D=e(63527),b=e(34999),E=e(89640),v=e(25797),C=e(51156),S=e(31819),O=e(9931),I=e(18615),R=e(46415),T=e(44802),L=e(20246);function K(se,oe){const{layout:ae}=se.useState(),ie=(0,t.useMemo)(()=>new v.C({title:"",id:"tab-item-options"}).addItem(new C.v({title:(0,s.t)("dashboard.tabs-layout.tab-options.title-option","Title"),render:()=>(0,y.jsx)(A,{tab:se,isNewElement:oe})})),[se,oe]),fe=(0,t.useMemo)(()=>new v.C({title:(0,s.t)("dashboard.tabs-layout.tab-options.repeat.title","Repeat options"),id:"repeat-options",isOpenDefault:!1}).addItem(new C.v({title:(0,s.t)("dashboard.tabs-layout.tab-options.repeat.variable.title","Repeat by variable"),description:(0,s.t)("dashboard.tabs-layout.tab-options.repeat.variable.description","Repeat this tab for each value in the selected variable."),render:()=>(0,y.jsx)(W,{tab:se})})),[se]),pe=(0,T.W)(ae),de=[ie,...pe,fe],le=(0,t.useMemo)(()=>(0,R.h)(se.state.conditionalRendering),[se]);return le&&de.push(le),de}function A({tab:se,isNewElement:oe}){const{title:ae}=se.useState(),ie=(0,L.z4)({autoFocus:oe}),fe=se.hasUniqueTitle();return(0,y.jsx)(d.D,{invalid:!fe,error:fe?void 0:(0,s.t)("dashboard.tabs-layout.tab-options.title-not-unique","Title should be unique"),children:(0,y.jsx)(D.p,{ref:ie,title:(0,s.t)("dashboard.tabs-layout.tab-options.title-option","Title"),value:ae,onChange:pe=>se.onChangeTitle(pe.currentTarget.value)})})}function W({tab:se}){const{layout:oe}=se.useState(),ae=(0,i.MZ)(se),ie=oe.getVizPanels().some(fe=>{const pe=(0,i.un)(fe);return pe?.state.datasource?.uid===O.K||pe?.state.datasource?.uid===I.uv&&pe?.state.queries.some(de=>de.datasource?.uid===O.K)});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(S.U,{sceneContext:ae,repeat:se.getRepeatVariable(),onChange:fe=>se.onChangeRepeat(fe)}),ie?(0,y.jsxs)(b.F,{"data-testid":P.Tp.pages.Dashboard.Rows.Repeated.ConfigSection.warningMessage,severity:"warning",title:"",topSpacing:3,bottomSpacing:0,children:[(0,y.jsx)("p",{children:(0,y.jsxs)(s.x6,{i18nKey:"dashboard.tabs-layout.tab.repeat.warning",children:["Panels in this tab use the ",{SHARED_DASHBOARD_QUERY:O.K}," data source. These panels will reference the panel in the original tab, not the ones in the repeated tabs."]})}),(0,y.jsx)(E.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/create-dashboard/#configure-repeating-tabs",children:(0,y.jsx)(s.x6,{i18nKey:"dashboard.tabs-layout.tab.repeat.learn-more",children:"Learn more"})})]}):void 0]})}var N=e(22803),w=e(57095),j=e(61574),V=e(63704),U=e(92138),F=e(56887),M=e(63142),H=e(36324),_=e(60208),Z=e(41116),ne=e(3371);function te({model:se}
198){const{title:oe,key:ae,isDropTarget:ie}=se.useState(),fe=se.getParentLayout(),{tabs:pe,currentTabIndex:de}=fe.useState(),le=n.jh.interpolate(se,oe,void 0,"text"),{isSelected:me,onSelect:De,isSelectable:Te}=(0,F.y)(ae),{isEditing:Ne}=(0,i.TN)(se),Ce=se.getSlug(),He=fe.getUrlKey(),ke=pe.findIndex(Ye=>Ye===se),Me=ke===de,$e=(0,j.zy)(),tt=V.sQ.sanitize(U.I.getUrlForPartial($e,{[He]:Ce})),Ke=(0,M.of)(Y),Re=(0,H.C)(),[Ve]=(0,Z.H)(se),je=!(0,ne.Lv)(se)&&Ne;if(Ve&&!Ne&&!Me)return null;let ze={};return se.hasUniqueTitle()||(ze={icon:"exclamation-triangle",tooltip:(0,s.t)("dashboard.tabs-layout.tab-warning.title-not-unique","This title is not unique")}),(0,y.jsx)(w.Draggable,{draggableId:ae,index:ke,isDragDisabled:!je,children:(Ye,Ge)=>(0,y.jsx)("div",{ref:ce=>Ye.innerRef(ce),className:(0,N.cx)(Ge.isDragging&&Ke.dragging),...Ye.draggableProps,...Ye.dragHandleProps,children:(0,y.jsx)(_.o,{ref:se.containerRef,truncate:!0,className:(0,N.cx)(Ve&&Ke.hidden,me&&"dashboard-selected-element",Te&&!me&&"dashboard-selectable-element",ie&&"dashboard-drop-target"),active:Me,role:"presentation",title:le,href:tt,"aria-selected":Me,onPointerDown:ce=>{ce.stopPropagation(),Re.set(ce)},onPointerUp:ce=>{ce.stopPropagation(),!(!Te||Re.check(ce))&&De?.(ce)},label:le,"data-dashboard-drop-target-key":se.state.key,...ze})})},ae)}const Y=()=>({dragging:(0,N.css)({cursor:"move"}),hidden:(0,N.css)({opacity:.4,"&:hover":(0,N.css)({opacity:1})})});var Q=e(34031);class J{constructor(oe){this._tabs=oe,this.isEditableDashboardElement=!0}getEditableElementInfo(){return{typeName:(0,s.t)("dashboard.edit-pane.elements.tabs","Tabs"),icon:"folder",instanceName:""}}useEditPaneOptions(){return[]}getTabs(){return this._tabs}
198onDelete(){this._tabs.forEach(oe=>oe.onDelete())}}var q=e(37365);class X extends n.Bs{constructor(oe){super({...oe,title:oe?.title??(0,s.t)("dashboard.tabs-layout.tab.new","New tab"),layout:oe?.layout??x.X2.createEmpty(),conditionalRendering:oe?.conditionalRendering??f.p.createEmpty()}),this._variableDependency=new n.Sh(this,{statePaths:["title"]}),this.isEditableDashboardElement=!0,this.isDashboardDropTarget=!0,this._layoutRestorer=new g.r,this.containerRef=t.createRef(),this.addActivationHandler(()=>this._activationHandler())}static{this.Component=te}_activationHandler(){const oe=this.state.conditionalRendering?.activate();return()=>{oe&&oe()}}getEditableElementInfo(){return{typeName:(0,s.t)("dashboard.edit-pane.elements.tab","Tab"),instanceName:n.jh.interpolate(this,this.state.title,void 0,"text"),icon:"layers",isContainer:!0}}getLayout(){return this.state.layout}getSlug(){return a.A.slugifyForUrl(n.jh.interpolate(this,this.state.title??"Tab"))}switchLayout(oe){this.setState({layout:this._layoutRestorer.getLayout(oe,this.state.layout)})}useEditPaneOptions(oe){return K(this,oe)}onDelete(){this.getParentLayout().removeTab(this)}onConfirmDelete(){const oe=this.getParentLayout();if(oe.shouldUngroup()){oe.removeTab(this);return}if(this.getLayout().getVizPanels().length===0){this.onDelete();return}o.lE.publish(new l.bY({title:(0,s.t)("dashboard.tabs-layout.delete-tab-title","Delete tab?"),text:(0,s.t)("dashboard.tabs-layout.delete-tab-text","Deleting this tab will also remove all panels. Are you sure you want to continue?"),yesText:(0,s.t)("dashboard.tabs-layout.delete-tab-yes","Delete"),onConfirm:()=>{this.onDelete()}}))}serialize(){return(0,h.Yz)(this)}onCopy(){const oe=(0,u.IC)(this.getLayout(),(0,i.YQ)(this));(0,p.G2)(),m.A.set(r.Gk,JSON.stringify({elements:oe,tab:this.serialize()}))}createMultiSelectedElement(oe){return new J(oe.filter(ae=>ae instanceof X))}onDuplicate(){this.getParentLayout().duplicateTab(this)}duplicate(){return this.clone({key:void 0,layout:this.getLayout().duplicate()})}onAddPanel(oe=(0,i.O8)()){this.getLayout().addPanel(oe)}onAddTab(){this.getParentLayout().addNewTab()}onChangeTitle(oe){this.setState({title:oe})}onChangeName(oe){this.onChangeTitle(oe)}onChangeRepeat(oe){let ae=this._getRepeatBehavior();oe?(ae&&ae.removeBehavior(),ae=new Q.T({variableName:oe}),this.setState({$behaviors:[...this.state.$behaviors??[],ae]}),ae.activate()):ae?.removeBehavior()}setIsDropTarget(oe){!!this.state.isDropTarget!==oe&&this.setState({isDropTarget:oe})}draggedPanelOutside(oe){this.getLayout().removePanel?.(oe),this.setIsDropTarget(!1)}draggedPanelInside(oe){oe.clearParent(),this.getLayout().addPanel(oe),this.setIsDropTarget(!1);const ae=this.getParentLayout(),ie=ae.state.tabs.findIndex(fe=>fe===this);ie!==ae.state.currentTabIndex&&ae.setState({currentTabIndex:ie})}getRepeatVariable(){return this._getRepeatBehavior()?.state.variableName}getParentLayout(){return n.jh.getAncestor(this,q.K)}scrollIntoView(){const oe=this.getParentLayout();oe.getCurrentTab()!==this&&oe.switchToTab(this),(0,c.d)(this,this.containerRef)}hasUniqueTitle(){return!this.getParentLayout().duplicateTitles().has(this.state.title)}_getRepeatBehavior(){return this.state.$behaviors?.find(oe=>oe instanceof Q.T)}}},34031:(ee,B,e)=>{"use strict";e.d(B,{T:()=>f});var t=e(2543),n=e.n(t),r=e(56838),o=e(3371),s=e(8285),m=e(39765),a=e(92769),l=e(37365);class f extends r.Bs{constructor(x){super(x),this._variableDependency=new r.Sh(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:()=>this.performRepeat()}),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this.performRepeat()}_getTab(){if(!(this.parent instanceof a.V))throw new Error("RepeatedTabItemBehavior: Parent is not a TabItem");return this.parent}_getLayout(){const x=this._getTab().parent;if(!(x instanceof l.K))throw new Error("RepeatedTabItemBehavior: Layout is not a TabsLayoutManager");return x}performRepeat(x=!1){if(this._variableDependency.hasDependencyInLoadingState())return;const g=r.jh.lookupVariable(this.state.variableName,this.parent?.parent);if(!g){console.error("RepeatedTabItemBehavior: Variable not found");return}if(!(g instanceof r.n8)){console.error("RepeatedTabItemBehavior: Variable is not a MultiValueVariable");return}const p=this._getTab(),c=this._getLayout(),{values:y,texts:P}=(0,s.a7)(g);if((0,t.isEqual)(this._prevRepeatValues,y)&&!x)return;this._prevRepeatValues=y,this._clonedTabs=[];const d=p.getLayout(),D={values:[""],texts:g.hasAllValue()?["All"]:["None"]},b=y.length?y:D.values,E=P.length?P:D.texts;for(let v=0;v<b.length;v++){const C=v===0,S=C?p:p.clone({$behaviors:[]}),O=(0,o.lv)(p.state.key,v);S.setState({key:O,$variables:new r.Pj({variables:[new r.xc({name:this.state.variableName,value:b[v],text:String(E[v]),isMulti:g.state.isMulti,includeAll:g.state.includeAll})]}),layout:d.cloneLayout?.(O,C)}),this._clonedTabs.push(S)}h(c,this._clonedTabs,p.state.key),this.publishEvent(new m.d({source:this}),!0)}removeBehavior(){const x=this._getTab(),g=this._getLayout(),p=u(g,x.state.key);g.setState({tabs:p}),x.setState({$behaviors:x.state.$behaviors.filter(c=>c!==this),$variables:void 0})}}function h(i,x,g){const p=u(i,g),c=p.findIndex(y=>y.state.key.includes(g));if(c===-1)throw new Error("TabItemRepeaterBehavior: Tab not found in layout");i.setState({tabs:[...p.slice(0,c),...x,...p.slice(c+1)]})}function u(i,x){return i.state.tabs.filter(g=>!(0,o.oX)(g.state.key,x))}},37365:(ee,B,e)=>{"use strict";e.d(B,{K:()=>S});var t=e(56838),n=e(56840),r=e(35282),o=e(6461),s=e(3371),m=e(8285),a=e(97335),l=e(85269),f=e(80038),h=e(48492),u=e(20246),i=e(92769),x=e(34031),g=e(74848),p=e(22803),c=e(57095),y=e(63142),P=e(54314),d=e(45861),D=e(13941),b=e(41116),E=e(61659);function v({model:O}){const I=(0,y.of)(C),{tabs:R,key:T}=O.useState(),L=O.getCurrentTab(),{layout:K}=L.useState(),A=(0,m.YQ)(O),{isEditing:W}=A.useState(),{hasCopiedTab:N}=(0,E.x)(),[w,j,V]=(0,b.H)(L);return(0,g.jsxs)("div",{className:I.tabLayoutContainer,children:[(0,g.jsx)(P.U,{className:I.tabsBar,children:(0,g.jsx)(c.DragDropContext,{onBeforeDragStart:U=>O.forceSelectTab(U.draggableId),onDragEnd:U=>
198{U.destination&&U.destination.index!==U.source.index&&O.moveTab(U.draggableId,U.source.index,U.destination.index)},children:(0,g.jsxs)("div",{className:I.tabsRow,children:[(0,g.jsx)(c.Droppable,{droppableId:T,direction:"horizontal",children:U=>(0,g.jsxs)("div",{className:I.tabsContainer,ref:U.innerRef,...U.droppableProps,children:[R.map(F=>(0,g.jsx)(F.Component,{model:F},F.state.key)),U.placeholder]})}),W&&(0,g.jsxs)("div",{className:"dashboard-canvas-add-button",children:[(0,g.jsx)(d.$n,{icon:"plus",variant:"primary",fill:"text",onClick:()=>O.addNewTab(),children:(0,g.jsx)(n.x6,{i18nKey:"dashboard.canvas-actions.new-tab",children:"New tab"})}),N&&(0,g.jsx)(d.$n,{icon:"clipboard-alt",variant:"primary",fill:"text",onClick:()=>O.pasteTab(),children:(0,g.jsx)(n.x6,{i18nKey:"dashboard.canvas-actions.paste-tab",children:"Paste tab"})})]})]})})}),W&&(0,g.jsxs)("div",{className:j,children:[(0,g.jsx)(D.J,{className:I.tabContentContainer,children:L&&(0,g.jsx)(K.Component,{model:K})}),V]}),!W&&(0,g.jsx)(D.J,{className:I.tabContentContainer,children:L&&(0,g.jsx)(K.Component,{model:K})})]})}const C=O=>({tabLayoutContainer:(0,p.css)({display:"flex",flexDirection:"column",flex:"1 1 auto"}),tabsBar:(0,p.css)({"&:hover":{".dashboard-canvas-add-button":{filter:"unset",opacity:1}}}),tabsRow:(0,p.css)({display:"flex",width:"100%",alignItems:"center"}),tabsContainer:(0,p.css)({display:"flex",justifyContent:"flex-start",alignItems:"flex-end",overflowX:"auto",overflowY:"hidden",paddingInline:O.spacing(.125),paddingTop:"1px"}),tabContentContainer:(0,p.css)({backgroundColor:"transparent",display:"flex",flexDirection:"column",flex:1,minHeight:0,paddingTop:O.spacing(1)})});class S extends t.Bs{constructor(I){super({...I,tabs:I.tabs??[new i.V],currentTabIndex:I.currentTabIndex??0}),this.isDashboardLayoutManager=!0,this.descriptor=S.descriptor,this._urlSync=new t.So(this,{keys:()=>[this.getUrlKey()]})}static{this.Component=v}static{this.descriptor={get name(){return(0,n.t)("dashboard.tabs-layout.name","Tabs")},get description(){return(0,n.t)("dashboard.tabs-layout.description","Organize panels into horizontal tabs")},id:"TabsLayout",createFromLayout:S.createFromLayout,isGridLayout:!1,icon:"window"}}serialize(){return(0,o.lX)(this)}duplicate(){throw new Error("Method not implemented.")}duplicateTab(I){const R=I.duplicate();this.addNewTab(R)}getUrlState(){return{[this.getUrlKey()]:this.getCurrentTab().getSlug()}}updateFromUrl(I){const R=this.getUrlKey(),T=I[R];if(T&&typeof I[R]=="string"){const L=this.state.tabs.findIndex(K=>K.getSlug()===T);L!==-1&&this.setState({currentTabIndex:L})}}switchToTab(I){this.setState({currentTabIndex:this.state.tabs.indexOf(I)})}getCurrentTab(){return this.state.tabs.length>this.state.currentTabIndex?this.state.tabs[this.state.currentTabIndex]:this.state.tabs[0]}addPanel(I){this.getCurrentTab().getLayout().addPanel(I)}getVizPanels(){const I=[];for(const R of this.state.tabs){const T=R.getLayout().getVizPanels();I.push(...T)}return I}cloneLayout(I,R){return this.clone({tabs:this.state.tabs.map(T=>{const L=(0,s.ed)(I,T.state.key);return T.clone({key:L,layout:T.state.layout.cloneLayout(L,R)})})})}addNewTab(I){const R=I??new i.V({}),T=new Set(this.state.tabs.map(K=>K.state.title).filter(K=>K!==void 0)),L=(0,u.BK)(R.state.title,T);return L!==R.state.title&&R.setState({title:L}),this.setState({tabs:[...this.state.tabs,R],currentTabIndex:this.state.tabs.length}),this.publishEvent(new r.jO(R),!0),R}editModeChanged(I){this.state.tabs.forEach(R=>R.getLayout().editModeChanged?.(I))}pasteTab(){const I=(0,m.YQ)(this),R=(0,h.sN)(I);this.addNewTab(R)}activateRepeaters(){this.state.tabs.forEach(I=>{I.isActive||I.activate();const R=(I.state.$behaviors??[]).find(T=>T instanceof x.T);R?.isActive||R?.activate(),I.getLayout().activateRepeaters?.()})}shouldUngroup(){return this.state.tabs.length===1}removeTab(I){if(this.shouldUngroup()){(0,u.f)(this,I.state.layout);return}if(this.getCurrentTab()===I){const K=this.state.currentTabIndex>0?this.state.currentTabIndex-1:0;this.setState({tabs:this.state.tabs.filter(A=>A!==I),currentTabIndex:K}),this.publishEvent(new r.ck(I),!0);return}const T=this.state.tabs.filter(K=>K!==I),L=T.length===0?[new i.V]:T;this.setState({tabs:L,currentTabIndex:0}),this.publishEvent(new r.ck(I),!0)}moveTab(I,R,T){const L=[...this.state.tabs],[K]=L.splice(R,1);L.splice(T,0,K),this.setState({tabs:L,currentTabIndex:T}),this.publishEvent(new r.su(this),!0)}forceSelectTab(I){const R=this.state.tabs.findIndex(K=>
198K.state.key===I),T=this.state.tabs[R];if(!T)return;(0,m.YQ)(this).state.editPane.selectObject(T,I,{force:!0,multi:!1}),this.setState({currentTabIndex:R})}static createEmpty(){const I=new i.V;return new S({tabs:[I]})}static createFromLayout(I){let R=[];if(I instanceof f.V)for(const T of I.state.rows){if((0,s.Ry)(T.state.key))continue;const L=T.state.conditionalRendering;L?.clearParent();const K=T.state.$behaviors?.find(W=>W instanceof l.y),A=K?[new x.T({variableName:K.state.variableName})]:void 0;R.push(new i.V({layout:T.state.layout.clone(),title:T.state.title,conditionalRendering:L,$behaviors:A}))}else I.clearParent(),R.push(new i.V({layout:I}));return new S({tabs:R})}getUrlKey(){let I=this.parent,R="dtab";for(;I;)I instanceof i.V&&(R=`${I.getSlug()}-${R}`),I instanceof a.o&&(R=`${I.getSlug()}-${R}`),I=I.parent;return R}duplicateTitles(){const I=new Map,R=new Set;return this.state.tabs.forEach(T=>{const L=t.jh.interpolate(T,T.state.title),K=(I.get(L)??0)+1;I.set(L,K),K>1&&R.add(L)}),R}}},6607:(ee,B,e)=>{"use strict";e.d(B,{f:()=>c});var t=e(74848),n=e(22803),r=e(63142),o=e(45861),s=e(88559),m=e(87063),a=e(56840),l=e(1682),f=e(8285),h=e(39385),u=e(80038),i=e(37365),x=e(17084),g=e(61659),p=e(20246);function c({layoutManager:b}){const E=(0,r.of)(D),{hasCopiedPanel:v}=(0,g.x)();return(0,t.jsxs)("div",{className:(0,n.cx)(E.addAction,"dashboard-canvas-add-button"),children:[(0,t.jsx)(o.$n,{variant:"primary",fill:"text",icon:"plus",onClick:()=>b.addPanel((0,f.O8)()),children:(0,t.jsx)(a.x6,{i18nKey:"dashboard.canvas-actions.add-panel",children:"Add panel"})}),(0,t.jsx)(s.m,{overlay:(0,t.jsxs)(m.W,{children:[(0,t.jsx)(m.W.Item,{icon:"list-ul",label:(0,a.t)("dashboard.canvas-actions.group-into-row","Group into row"),onClick:()=>{(0,x.t)(b)}}),(0,t.jsx)(m.W.Item,{icon:"layers",label:(0,a.t)("dashboard.canvas-actions.group-into-tab","Group into tab"),onClick:()=>{(0,x.A)(b)}})]}),children:(0,t.jsx)(o.$n,{variant:"primary",fill:"text",icon:"layers",onClick:()=>b.addPanel((0,f.O8)()),children:(0,t.jsx)(a.x6,{i18nKey:"dashboard.canvas-actions.group-panels",children:"Group panels"})})}),y(b),v&&b.pastePanel&&(0,t.jsx)(o.$n,{variant:"primary",fill:"text",icon:"clipboard-alt",onClick:()=>{b.pastePanel?.()},children:(0,t.jsx)(a.x6,{i18nKey:"dashboard.canvas-actions.paste-panel",children:"Paste panel"})})]})}function y(b){if(b.parent instanceof h.H$)return null;const v=l.b4.getLayoutManagerFor(b.parent),C=()=>{(0,p.f)(v,b)};return v instanceof i.K?(0,t.jsx)(P,{parentLayout:v,onClick:C}):v instanceof u.V?(0,t.jsx)(d,{parentLayout:v,onClick:C}):null}function P({parentLayout:b,onClick:E}){const{tabs:v}=b.useState();return v.length>1?null:(0,t.jsx)(o.$n,{variant:"primary",fill:"text",icon:"layers-slash",onClick:E,children:(0,t.jsx)(a.x6,{i18nKey:"dashboard.canvas-actions.un-group-panels",children:"Ungroup"})})}function d({parentLayout:b,onClick:E}){const{rows:v}=b.useState();return v.length>1?null:(0,t.jsx)(o.$n,{variant:"primary",fill:"text",icon:"layers-slash",onClick:E,children:(0,t.jsx)(a.x6,{i18nKey:"dashboard.canvas-actions.un-group-panels",children:"Ungroup"})})}const D=b=>({addAction:(0,n.css)({position:"absolute",padding:b.spacing(1,0),height:b.spacing(5),bottom:0,left:0,right:0,opacity:0,[b.transitions.handleMotion("no-preference","reduce")]:{transition:b.transitions.create("opacity")}})})},44802:(ee,B,e)=>{"use strict";e.d(B,{W:()=>c});var t=e(74848),n=e(96540),r=e(31286),o=e(77824),s=e(56840),m=e(25797),a=e(51156),l=e(15759),f=e(42954),h=e(8835),u=e(1131),i=e(80038),x=e(37365);const g=new f.O(()=>[u.D.descriptor,h.X2.descriptor,i.V.descriptor,x.K.descriptor]);function p({layoutManager:y}){const P=y.descriptor.isGridLayout,d=g.list().filter(E=>E.isGridLayout===P),D=(0,n.useCallback)(E=>{const v=y.parent;v&&(0,l.l)(v)&&v.switchLayout(E.createFromLayout(y))},[y]),b=d.map(E=>({value:E,label:E.name,icon:E.icon,description:E.description}));return(0,t.jsx)(r.a,{paddingBottom:2,display:"flex",grow:1,alignItems:"center",children:(0,t.jsx)(o.z,{fullWidth:!0,value:y.descriptor,options:b,onChange:D})})}function c(y){return(0,n.useMemo)(()=>{const P=y.descriptor.isGridLayout,d=new m.C({title:(0,s.t)("dashboard.layout.common.group-layout","Group layout"),id:"group-layout-category",isOpenDefault:!1}),D=new m.C({title:(0,s.t)("dashboard.layout.common.panel-layout","Panel layout"),id:"grid-layout-category",isOpenDefault:!1});if(D.addItem(new a.v({title:"",skipField:!0,render:()=>(0,t.jsx)(p,{layoutManager:y})})),P?d.props.disabledText=(0,s.t)("dashboard.layout.common.group-layout-disabled","No groups exists on this level"):(d.addItem(new a.v({title:"",skipField:!0,render:()=>(0,t.jsx)(p,{layoutManager:y})})),D.props.disabledText=(0,s.t)("dashboard.layout.common.panel-layout-disabled","Select a row or tab to change panel layout options")),y.getOptions)for(const b of y.getOptions())D.addItem(b);return[d,D]},[y])}},76173:(ee,B,e)=>{"use strict";e.d(B,{r:()=>t});class t{constructor(){this.layoutMap={}}getLayout(o,s){const m=this.layoutMap[o.descriptor.id];return m&&n(m.getVizPanels(),o.getVizPanels())?m:(this.layoutMap[s.descriptor.id]=s,o)}}function n(r,o){if(r.length<o.length)return!1;for(let s=0;s<r.length;s++){const m=r[s],a=o[s];if(m.state.key!==a.state.key||JSON.stringify(m.state.options)!==JSON.stringify(a.state.options)||JSON.stringify(m.state.fieldConfig)!==JSON.stringify(a.state.fieldConfig))return!1}return!0}},17084:(ee,B,e)=>{"use strict";e.d(B,{A:()=>a,t:()=>l});var t=e(43173),n=e(35282),r=e(1131),o=e(80038),s=e(37365),m=e(15759);function a(f){const h=f.parent;if(!(0,m.l)(h))throw new Error("Parent layout is not a LayoutParent");
198if(f instanceof s.K)return f.addNewTab();const u=s.K.createEmpty();u.state.tabs[0].setState({layout:f.clone()}),h.switchLayout(u);const i=u.state.tabs[0];return f.publishEvent(new n.jO(i),!0),i}function l(f){if(!t.$.featureToggles.dashboardNewLayouts){if(f instanceof r.D)return f.addNewRow();throw new Error("New dashboard layouts feature not enabled but new layout found")}if(f instanceof o.V)return f.addNewRow();if(f instanceof s.K){const x=f.getCurrentTab();return l(x.state.layout)}const h=f.parent;if(!(0,m.l)(h))throw new Error("Parent layout is not a LayoutParent");const u=o.V.createFromLayout(h.getLayout());h.switchLayout(u);const i=u.state.rows[0];return f.publishEvent(new n.jO(i),!0),i}},48492:(ee,B,e)=>{"use strict";e.d(B,{$v:()=>u,G2:()=>h,dp:()=>g,qY:()=>p,sN:()=>i});var t=e(95943),n=e(29043),r=e(4974),o=e(17340),s=e(76584),m=e(6461),a=e(1682),l=e(25953),f=e(93389);function h(){n.A.delete(t.tH),n.A.delete(t.rt),n.A.delete(t.Gk)}function u(y){const P=n.A.get(t.rt),d=JSON.parse(P);h();const D=c(a.b4.getNextPanelId(y));let b;try{b=(0,s.g5)(d.row,d.elements,!1,D)}catch{throw new Error("Error pasting row from clipboard, please try to copy again")}return b}function i(y){const P=n.A.get(t.Gk),d=JSON.parse(P);h();const D=c(a.b4.getNextPanelId(y));let b;try{b=(0,m.zE)(d.tab,d.elements,!1,D)}catch{throw new Error("Error pasting tab from clipboard, please try to copy again")}return b}function x(y){const P=n.A.get(t.tH),{elements:d,gridItem:D}=JSON.parse(P);return D.kind==="GridLayoutItem"?(0,o.ve)(D,d,c(a.b4.getNextPanelId(y))):(0,r.i6)(D,d,c(a.b4.getNextPanelId(y)))}function g(y){const P=x(y);return P instanceof l.X?P:new l.X({body:P.state.body,key:P.state.key,variableName:P.state.variableName})}function p(y,P){const d=x(y);return d instanceof f.U?d:new f.U({...P,body:d.state.body,key:d.state.key,variableName:d.state.variableName})}function c(y){let P=y;return()=>P++}},41667:(ee,B,e)=>{"use strict";e.d(B,{d:()=>s});var t=e(56838),n=e(97335),r=e(92769),o=e(37365);function s(a,l){if(l.current?.isConnected){m(l.current);return}let f=a.parent;for(;f;){if(f instanceof n.o&&f.state.collapse&&f.onCollapseToggle(),f instanceof t.tI&&f.state.isCollapsed&&f.onCollapseToggle(),f instanceof r.V){const h=f.parent;h instanceof o.K&&h.getCurrentTab()!==f&&h.switchToTab(f)}f=f.parent}setTimeout(()=>{l.current?.isConnected&&m(l.current)},10)}function m(a){a.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}},61659:(ee,B,e)=>{"use strict";e.d(B,{x:()=>o});var t=e(96540),n=e(95943),r=e(29043);function o(){const[s,m]=(0,t.useState)(r.A.exists(n.tH)),[a,l]=(0,t.useState)(r.A.exists(n.rt)),[f,h]=(0,t.useState)(r.A.exists(n.Gk));return(0,t.useEffect)(()=>{const u=r.A.subscribe(n.tH,()=>{m(r.A.exists(n.tH))}),i=r.A.subscribe(n.rt,()=>{l(r.A.exists(n.rt))}),x=r.A.subscribe(n.Gk,()=>{h(r.A.exists(n.Gk))});return()=>{u(),i(),x()}},[]),{hasCopiedPanel:s,hasCopiedRow:a,hasCopiedTab:f}}},20246:(ee,B,e)=>{"use strict";e.d(B,{BK:()=>s,f:()=>m,z4:()=>o});var t=e(96540),n=e(15759);function r(a){let l=a.parent;for(;l;){if(isDashboardLayoutManager(l))return l;l=l.parent}return null}function o({autoFocus:a}={}){const l=(0,t.useRef)(null);return(0,t.useEffect)(()=>{l.current&&a&&setTimeout(()=>l.current?.focus(),200)},[a]),l}function s(a,l){const f=a??"";if(l.has(f)){const h=f.match(/^(.*?)(\d+)$/);if(h){const u=h[1],i=parseInt(h[2],10);let x=`${u}${i+1}`;for(;l.has(x);){const g=parseInt(x.match(/\d+$/)[0],10)+1;x=`${u}${g}`}return x}else{let u=1,i=`${f} ${u}`;for(;l.has(i);)u++,i=`${f} ${u}`;return i}}return f}function m(a,l){const f=a.parent;(0,n.l)(f)&&(l.clearParent(),f.switchLayout(l))}},35718:(ee,B,e)=>{"use strict";e.d(B,{C:()=>f});var t=e(1906),n=e(57852),r=e(43173),o=e(78282),s=e(56838),m=e(78767),a=e(1682),l=e(8285);function f(g,p){const c=(0,l.YQ)(g);p.app=c.state.editPanel?t.Jk.PanelEditor:t.Jk.Dashboard,c.subscribeToState(y=>{y.editPanel?p.app=t.Jk.PanelEditor:p.app=t.Jk.Dashboard}),p.canAddAnnotations=()=>{const y=(0,l.YQ)(g);return!h(y)||!r.$.featureToggles.annotationPermissionUpdate&&!y.canEditDashboard()?!1:!!y.state.meta.annotationsPermissions?.dashboard.canAdd},p.canEditAnnotations=y=>{const P=(0,l.YQ)(g);return!r.$.featureToggles.annotationPermissionUpdate&&!P.canEditDashboard()?!1:y?!!P.state.meta.annotationsPermissions?.dashboard.canEdit:!!P.state.meta.annotationsPermissions?.organization.canEdit},p.canDeleteAnnotations=y=>{const P=(0,l.YQ)(g);return!r.$.featureToggles.annotationPermissionUpdate&&!P.canEditDashboard()?!1:y?!!P.state.meta.annotationsPermissions?.dashboard.canDelete:!!P.state.meta.annotationsPermissions?.organization.canDelete},p.onAnnotationCreate=async y=>{const P=(0,l.YQ)(g),d=y.from!==y.to,D={dashboardUID:P.state.uid,panelId:(0,l.Cs)(g),isRegion:d,time:y.from,timeEnd:d?y.to:0,tags:y.tags,text:y.description};await(0,m.vJ)(D),u(P),p.eventBus.publish(new n.We(D))},p.onAnnotationUpdate=async y=>{const P=(0,l.YQ)(g),d=y.from!==y.to,D={id:y.id,dashboardUID:P.state.uid,panelId:(0,l.Cs)(g),isRegion:d,time:y.from,timeEnd:d?y.to:0,tags:y.tags,text:y.description};await(0,m.rJ)(D),u(P),p.eventBus.publish(new n.We(D))},p.onAnnotationDelete=async y=>{await(0,m.Xm)({id:y}),u((0,l.YQ)(g)),p.eventBus.publish(new n.We({id:y}))},p.onAddAdHocFilter=y=>{const P=(0,l.YQ)(g),d=(0,l.un)(g);if(!d)return;const D=i(P,d.state.datasource);x(D,y)},p.onUpdateData=y=>Promise.resolve(!0)}function h(g){const p=a.b4.getDataLayers(g);for(const c of p.state.annotationLayers)if(c instanceof s.tV.g&&c.state.isEnabled&&c.state.query.builtIn)return c}function u(g){const p=h(g);p&&p.runLayer()}function i(g,p){const c=s.jh.getVariables(g);for(const P of c.state.variables)if(s.Go.isAdHocVariable(P)){const d=P.state.datasource;if(d===p||d?.uid===p?.uid)return P}const y=new s.H9({name:"Filters",datasource:p,supportsMultiValueOperators:!!(0,o.l)().getInstanceSettings(p)?.meta.multiValueFilterOperators,useQueriesAsFilterForOptions:!0,layout:r.$.featureToggles.newFiltersUI?"combobox":void 0});return c.setState({variables:[...c.state.variables,y]}),y}function x(g,p){const c=g.state.filters.findIndex(y=>y.key===p.key&&y.value===p.value&&y.operator!==p.operator);if(c>=0){const y=g.state.filters.slice();y.splice(c,1,p),g.updateFilters(y);return}g.updateFilters([...g.state.filters,p])}},3688:(ee,B,e)=>{"use strict";e.d(B,{y:()=>t});function t(n){return"isDashboardLayoutItem"in n}},39765:(ee,B,e)=>{"use strict";e.d(B,{d:()=>n});var t=e(68388);class n extends t.x{static{this.type="dashboard-repeats-processed"}}},15759:(ee,B,e)=>{"use strict";e.d(B,{l:()=>t});function t(n){return"switchLayout"in n}},84019:(ee,B,e)=>{"use strict";e.d(B,{V:()=>a,X:()=>m});var t=e(43173),n=e(59857),r=e(78947),o=e(75735),s=e(28998);async function m(l){let f=n.Ye.templating?.list;if(t.$.featureToggles.newDashboardWithFiltersAndGroupBy){const u=await(0,s.tR)().get();if(u.getTagKeys){const i={type:u.meta.id,uid:u.uid},x={datasource:i,filters:[],name:"Filter",type:"adhoc"},g={datasource:i,name:"Group by",type:"groupby"};f=(f||[]).concat([x,g])}}const h={meta:{canStar:!1,canShare:!1,canDelete:!1,isNew:!0,folderUid:""},dashboard:{...n.Ye,uid:"",title:"New dashboard",panels:[],timezone:t.$.bootData.user?.timezone||n.Ye.timezone}};return f&&(h.dashboard.templating={list:f}),l&&(h.meta.folderUid=l),h}async function a(l){let f=(0,r.xE)().variables;if(t.$.featureToggles.newDashboardWithFiltersAndGroupBy){const u=await(0,s.tR)().get();if(u.getTagKeys){const i={type:u.meta.id,uid:u.uid},x={kind:"AdhocVariable",spec:{...(0,r.IP)(),name:"Filter",datasource:i}},g={kind:"GroupByVariable",spec:{...(0,r.Bj)(),datasource:i,name:"Group by"}};f=(f||[]).concat([x,g])}}const h={apiVersion:"v2alpha1",kind:"DashboardWithAccessInfo",spec:{...(0,r.xE)(),title:"New dashboard",timeSettings:{...(0,r.ft)(),timezone:t.$.bootData.user?.timezone||(0,r.ft)().timezone}},access:{canStar:!1,canShare:!1,canDelete:!1},metadata:{name:"",resourceVersion:"0",creationTimestamp:"0",annotations:{[o.ew]:""}}};return f&&(h.spec.variables=f),l&&h.metadata.annotations&&(h.metadata.annotations[o.ew]=l),h}},78320:(ee,B,e)=>{"use strict";e.d(B,{o:()=>n,x:()=>t});const t={name:"grafana",uid:"grafana"},n=1},39557:(ee,B,e)=>{"use strict";e.d(B,{B:()=>o});var t=e(62467),n=e(81160),r=e(56838);class o extends r.n8{constructor(m){super({name:"",type:"snapshot",isReadOnly:!0,query:"",value:"",text:"",options:[],...m}),this._variableDependency=new r.Sh(this,{statePaths:[]})}getValueOptions(m){const f=(r.jh.interpolate(this,this.state.query).match(/(?:\\,|[^,])+/g)??[]).map(h=>{h=h.replace(/\\,/g,",");const u=/^(.+)\s:\s(.+)$/g.exec(h)??[];if(u.length===3){const[,i,x]=u;return{label:i.trim(),value:x.trim()}}else return{label:h.trim(),value:h.trim()}});return(0,t.of)(f)}validateAndUpdate(){return this.getValueOptions({}).pipe((0,n.T)(m=>
198(this.state.options!==m&&this._updateValueGivenNewOptions(m),{})))}static{this.Component=({model:m})=>(0,r.yC)(m)}_updateValueGivenNewOptions(m){const{value:a,text:l}=this.state,f={options:m,loading:!1,value:a??[],text:l??[]};this.setState(f)}}},99392:(ee,B,e)=>{"use strict";e.d(B,{O:()=>n});var t=e(56838);function n(r){const o=[];for(const s of r){if(!(s instanceof t.tV.g))continue;const m={...s.state.query,enable:!!s.state.isEnabled,hide:!!s.state.isHidden};o.push(m)}return o}},4974:(ee,B,e)=>{"use strict";e.d(B,{Dr:()=>h,K4:()=>l,i6:()=>x,zd:()=>f});var t=e(78947),n=e(25953),r=e(29425),o=e(8835),s=e(1682),m=e(8285),a=e(67350);function l(g){const{maxColumnCount:p,fillScreen:c,columnWidth:y,rowHeight:P,layout:d}=g.state,D=(0,t.kH)();return{kind:"AutoGridLayout",spec:{maxColumnCount:p,fillScreen:c===D.fillScreen?void 0:c,...u(y),...i(P),items:d.state.children.map(f)}}}function f(g){const c={kind:"AutoGridLayoutItem",spec:{element:{kind:"ElementReference",name:s.b4.getElementIdentifierForVizPanel(g.state?.body)}}},y=g.state.conditionalRendering?.serialize();return y?.spec.items.length&&(c.spec.conditionalRendering=y),g.state.variableName&&(c.spec.repeat={mode:"variable",value:g.state.variableName}),c}
198function h(g,p,c,y){if(g.kind!=="AutoGridLayout")throw new Error("Invalid layout kind");const P=(0,t.kH)(),{maxColumnCount:d,columnWidthMode:D,columnWidth:b,rowHeightMode:E,rowHeight:v,fillScreen:C}=g.spec,S=g.spec.items.map(R=>x(R,p,y)),O=D==="custom"?b:D,I=E==="custom"?v:E;return new o.X2({maxColumnCount:d,columnWidth:O,rowHeight:I,fillScreen:C??P.fillScreen,layout:new r.o({templateColumns:(0,o.Kf)(d??P.maxColumnCount,O??o.j),autoRows:(0,o.jo)(I??o.YL,C??!1),children:S})})}function u(g){return{columnWidthMode:typeof g=="number"?"custom":g,columnWidth:typeof g=="number"?g:void 0}}function i(g){return{rowHeightMode:typeof g=="number"?"custom":g,rowHeight:typeof g=="number"?g:void 0}}function x(g,p,c){const y=p[g.spec.element.name];if(!y)throw new Error(`Panel with uid ${g.spec.element.name} not found in the dashboard elements`);let P;return c&&(P=c()),new n.X({key:(0,m.ty)(P??y.spec.id),body:y.kind==="LibraryPanel"?(0,a.kB)(y,P):(0,a.Gl)(y,P),variableName:g.spec.repeat?.value,conditionalRendering:(0,a.Xy)(g)})}},17340:(ee,B,e)=>{"use strict";e.d(B,{SW:()=>i,i2:()=>y,v2:()=>x,ve:()=>b});var t=e(56838),n=e(73427),r=e(93389),o=e(1131),s=e(87308),m=e(18178),a=e(3371),l=e(1682),f=e(8285),h=e(78320),u=e(67350);function i(E,v){return{kind:"GridLayout",spec:{items:g(E,v)}}}function x(E,v,C,S){if(E.kind!=="GridLayout")throw new Error("Invalid layout kind");return new o.D({grid:new t.hy({isLazy:!(C||n.TP.user.authenticatedBy==="render"),children:d(E,v,S)})})}function g(E,v){let C=[];for(const S of E.state.grid.state.children)if(S instanceof r.U)S.state.variableName?C=C.concat(P(S,v)):C.push(y(S));else if(S instanceof t.tI){if((0,a.Ry)(S.state.key)&&!v)continue;C.push(c(S,v))}return C}function p(E){if(E.state.$behaviors){for(const v of E.state.$behaviors)if(v instanceof s.L)return{value:v.state.variableName,mode:"variable"}}}function c(E,v=!1){const C=E.state.children.map(S=>{if(!(S instanceof r.U))throw new Error("Unsupported row child type");const O=(S.state.y??0)-(E.state.y??0)-h.o;return y(S,O)});return{kind:"GridLayoutRow",spec:{title:E.state.title,y:E.state.y??0,collapsed:!!E.state.isCollapsed,elements:C,repeat:p(E)}}}function y(E,v){let C,S=0,O=0,I=0,R=0,T=E;if(!(T.state.body instanceof t.Eb))throw new Error("DashboardGridItem body expected to be VizPanel");R=(T.state.variableName?T.state.itemHeight:T.state.height)??0,S=T.state.x??0,O=T.state.y??0,I=T.state.width??0;const L=T.state.variableName;let K=l.b4.getElementIdentifierForVizPanel(T.state.body);if(C={kind:"GridLayoutItem",spec:{x:S,y:v??O,width:I,height:R,element:{kind:"ElementReference",name:K}}},L){const A={mode:"variable",value:L};T.state.maxPerRow&&(A.maxPerRow=T.getMaxPerRow()),T.state.repeatDirection&&(A.direction=T.getRepeatDirection()),C.spec.repeat=A}if(!C)throw new Error("Unsupported grid item type");return C}function P(E,v=!1){if(v){if(E.state.body instanceof t.Eb&&(0,f.ME)(E.state.body))return[];if(E.state.repeatedPanels){const{h:C,w:S,columnCount:O}=(0,f.bR)(E);return E.state.repeatedPanels.map((R,T)=>{let L=0,K=0;E.state.repeatDirection==="v"?(L=E.state.x,K=T*C):(L=T%O*S,K=E.state.y+Math.floor(T/O)*C);const A={x:L,y:K,w:S,h:C};return{kind:"GridLayoutItem",spec:{x:A.x,y:A.y,width:A.w,height:A.h,repeat:{mode:"variable",value:E.state.variableName,maxPerRow:E.getMaxPerRow(),direction:E.state.repeatDirection},element:{kind:"ElementReference",name:R.state.key}}}})}return[]}else return[y(E)]}function d(E,v,C){return E.spec.items.map(O=>{if(O.kind==="GridLayoutItem")return b(O,v,C);if(O.kind==="GridLayoutRow"){const I=O.spec.elements.map(T=>{const L=v[(0,a.d9)(T.spec.element.name)];if(L.kind==="Panel"||L.kind==="LibraryPanel"){let K;return C&&(K=C()),D(T.spec,L,O.spec.y+h.o+T.spec.y,K)}else throw new Error(`Unknown element kind: ${T.kind}`)});let R;return O.spec.repeat&&(R=[new s.L({variableName:O.spec.repeat.value})]),new t.tI({y:O.spec.y,isCollapsed:O.spec.collapsed,title:O.spec.title,$behaviors:R,actions:new m.u({}),children:I})}else throw new Error(`Unknown layout element kind: ${O.kind}`)})}function D(E,v,C,S){let O;return v.kind==="Panel"?O=(0,u.Gl)(v,S):O=(0,u.kB)(v,S),new r.U({key:`grid-item-${S??v.spec.id}`,x:E.x,y:C??E.y,width:E.repeat?.direction==="h"?24:E.width,height:E.height,itemHeight:E.height,body:O,variableName:E.repeat?.value,repeatDirection:E.repeat?.direction,maxPerRow:E.repeat?.maxPerRow})}function b(E,v,C){const S=v[E.spec.element.name];if(!S)throw new Error(`Panel with uid ${E.spec.element.name} not found in the dashboard elements`);let O;return C&&(O=C()),D(E.spec,S,void 0,O)}},76584:(ee,B,e)=>{"use strict";e.d(B,{HQ:()=>l,Vf:()=>f,aL:()=>a,g5:()=>h});var t=e(97335),n=e(85269),r=e(80038),o=e(3371),s=e(59006),m=e(67350);function a(u){return{kind:"RowsLayout",spec:{rows:u.state.rows.filter(i=>!(0,o.Ry)(i.state.key)).map(l)}}}function l(u){const i=u.state.layout.serialize(),x={kind:"RowsLayoutRow",spec:{title:u.state.t
198itle,collapse:u.state.collapse,layout:i,fillScreen:u.state.fillScreen,hideHeader:u.state.hideHeader}},g=u.state.conditionalRendering?.serialize();if(g?.spec.items.length&&(x.spec.conditionalRendering=g),u.state.$behaviors){for(const p of u.state.$behaviors)if(p instanceof n.y){if(x.spec.repeat)throw new Error("Multiple repeaters are not supported");x.spec.repeat={value:p.state.variableName,mode:"variable"}}}return x}function f(u,i,x,g){if(u.kind!=="RowsLayout")throw new Error("Invalid layout kind");const p=u.spec.rows.map(c=>h(c,i,x,g));return new r.V({rows:p})}function h(u,i,x,g){const p=u.spec.layout,c=u.spec.repeat?[new n.y({variableName:u.spec.repeat.value})]:void 0;return new t.o({title:u.spec.title,collapse:u.spec.collapse,hideHeader:u.spec.hideHeader,fillScreen:u.spec.fillScreen,$behaviors:c,layout:s.j.get(p.kind).deserialize(p,i,x,g),conditionalRendering:(0,m.Xy)(u)})}},6461:(ee,B,e)=>{"use strict";e.d(B,{Yz:()=>l,lX:()=>a,wm:()=>f,zE:()=>h});var t=e(92769),n=e(34031),r=e(37365),o=e(3371),s=e(59006),m=e(67350);function a(u){return{kind:"TabsLayout",spec:{tabs:u.state.tabs.filter(i=>!(0,o.Ry)(i.state.key)).map(l)}}}function l(u){const i=u.state.layout.serialize(),x={kind:"TabsLayoutTab",spec:{title:u.state.title,layout:i}},g=u.state.conditionalRendering?.serialize();if(g?.spec.items.length&&(x.spec.conditionalRendering=g),u.state.$behaviors){for(const p of u.state.$behaviors)if(p instanceof n.T){if(x.spec.repeat)throw new Error("Multiple repeaters are not supported");x.spec.repeat={value:p.state.variableName,mode:"variable"}}}return x}function f(u,i,x,g){if(u.kind!=="TabsLayout")throw new Error("Invalid layout kind");const p=u.spec.tabs.map(c=>h(c,i,x,g));return new r.K({tabs:p})}function h(u,i,x,g){const p=u.spec.layout,c=u.spec.repeat?[new n.T({variableName:u.spec.repeat.value})]:void 0;return new t.V({title:u.spec.title,layout:s.j.get(p.kind).deserialize(p,i,x,g),$behaviors:c,conditionalRendering:(0,m.Xy)(u)})}},59006:(ee,B,e)=>{"use strict";e.d(B,{j:()=>m});var t=e(42954),n=e(4974),r=e(17340),o=e(76584),s=e(6461);const m=new t.O(()=>[{id:"GridLayout",name:"Grid Layout",deserialize:r.v2},{id:"AutoGridLayout",name:"Auto Grid Layout",deserialize:n.Dr},{id:"RowsLayout",name:"Rows Layout",deserialize:o.Vf},{id:"TabsLayout",name:"Tabs Layout",deserialize:s.wm}])},67350:(ee,B,e)=>{"use strict";e.d(B,{Gl:()=>P,IC:()=>R,Kq:()=>E,V6:()=>T,Xy:()=>I,kB:()=>d});var t=e(43173),n=e(56838),r=e(18615),o=e(57558),s=e(55793),m=e(84655),a=e(36605),l=e(7094),f=e(32540),h=e(37040),u=e(66251),i=e(81657),x=e(35718),g=e(8285),p=e(62265),c=e(3281),y=e(39508);function P(L,K){const A=[];A.push(new f.$({rawLinks:L.spec.links,menu:new f.m({$behaviors:[h.oV]})})),A.push(new u.W);const W=L.spec.data.spec.queryOptions,N=(W.timeFrom||W.timeShift)&&!W.hideTimeOverride,w={key:(0,g.XA)(K??L.spec.id),title:L.spec.title?.substring(0,5e3),description:L.spec.description,pluginId:L.spec.vizConfig.kind,options:L.spec.vizConfig.spec.options,fieldConfig:(0,c.So)(L.spec.vizConfig.spec.fieldConfig),pluginVersion:L.spec.vizConfig.spec.pluginVersion,displayMode:L.spec.transparent?"transparent":"default",hoverHeader:!L.spec.title&&!N,hoverHeaderOffset:0,seriesLimit:t.$.panelSeriesLimit,$data:D(L),titleItems:A,$behaviors:[],extendPanelContext:x.C};return t.$.publicDashboardAccessToken||(w.menu=new n.Lw({$behaviors:[h._i]})),(W.timeFrom||W.timeShift)&&(w.$timeRange=new i.v({timeFrom:W.timeFrom,timeShift:W.timeShift,hideTimeOverride:W.hideTimeOverride})),new n.Eb(w)}function d(L,K){const A=[];A.push(new f.$({rawLinks:[],menu:new f.m({$behaviors:[h.oV]})})),A.push(new u.W);const W={key:(0,g.XA)(K??L.spec.id),titleItems:A,seriesLimit:t.$.panelSeriesLimit,$behaviors:[new l.u({uid:L.spec.libraryPanel.uid,name:L.spec.libraryPanel.name})],extendPanelContext:x.C,pluginId:l.u.LOADING_VIZ_PANEL_PLUGIN_ID,title:L.spec.title,options:{},fieldConfig:{defaults:{},overrides:[]}};return t.$.publicDashboardAccessToken||(W.menu=new n.Lw({$behaviors:[h._i]})),new n.Eb(W)}function D(L){const K=L.spec,A=K.data?.spec.queries??[];if(!A?.length||t.$.panels[K.vizConfig.kind]?.skipDataQuery)return;let W;const N=b(L);return W=new n.dt({datasource:N,queries:A.map(S),maxDataPoints:K.data.spec.queryOptions.maxDataPoints??void 0,maxDataPointsFromWidth:!0,cacheTimeout:K.data.spec.queryOptions.cacheTimeout,queryCachingTTL:K.data.spec.queryOptions.queryCachingTTL,minInterval:K.data.spec.queryOptions.interval??void 0,dataLayerFilter:{panelId:K.id},$behaviors:[new a.L({})]}),new n.Es({$data:W,transformations:K.data.spec.transformations.map(w=>({...w.spec,topic:(0,y.MM)(w.spec.topic)}))})}function b(L){if(!L.spec.data?.spec.queries?.length)return;let K,A=!1;
198return L.spec.data.spec.queries.forEach(W=>{K?(K.uid!==W.spec.datasource?.uid||K.type!==W.spec.datasource?.type)&&(A=!0):W.spec.datasource?.uid?K=W.spec.datasource:K=v(W)}),A?{type:"mixed",uid:r.uv}:K}function E(L){return C(L.spec.datasource,L.spec.query.kind)}function v(L){return C(L.spec.datasource,L.spec.query.kind)}function C(L,K){if(L?.uid)return L;const A=t.$.bootData.settings.defaultDatasource,W=t.$.bootData.settings.datasources,N=W&&Object.values(W).find(w=>w.meta.id===K);if(N)return{uid:N.uid,type:N.meta.id};if(W&&W[A])return{uid:W[A].uid||W[A].name,type:W[A].meta.id}}function S(L){return{refId:L.spec.refId,datasource:v(L),hide:L.spec.hidden,...L.spec.query.spec}}function O(L){return L.serialize()}function I(L){if(!L.spec.conditionalRendering)return o.p.createEmpty();const K=m.k.get(L.spec.conditionalRendering.kind).deserialize(L.spec.conditionalRendering);if(K&&!(K instanceof s.M))throw new Error("Conditional rendering must always start with a root group");return new o.p({rootGroup:K})}function R(L,K){const A=L.getVizPanels(),W=K.serializer.getDSReferencesMapping(),N=A.map(w=>(0,p.GB)(w,W));return(0,p.Cy)(N,K)}function T(L,K){return(0,p.Cy)([(0,p.GB)(L.state.body,K.serializer.getDSReferencesMapping())],K)}},84500:(ee,B,e)=>{"use strict";e.d(B,{$:()=>u,C:()=>f});var t=e(43173),n=e(56838),r=e(59857),o=e(21275),s=e(78947),m=e(8285),a=e(62265),l=e(39508);function f(i,x){const g=[];for(const p of i.state.variables){const c={name:p.state.name,label:p.state.label,description:p.state.description??void 0,skipUrlSync:!!p.state.skipUrlSync,hide:p.state.hide||r.zL.dontHide,type:p.state.type};if(n.Go.isQueryVariable(p)){let y=[];((0,l.qJ)(p.state.refresh)==="never"||x)&&(y=h(p.state)),g.push({...c,current:{value:p.state.value,text:p.state.text},options:y,query:p.state.query,definition:p.state.definition,datasource:(0,a.AB)(i,p,"variable"),sort:p.state.sort,refresh:p.state.refresh,regex:p.state.regex,allValue:p.state.allValue,includeAll:p.state.includeAll,multi:p.state.isMulti,allowCustomValue:p.state.allowCustomValue,skipUrlSync:p.state.skipUrlSync})}else if(n.Go.isCustomVariable(p))g.push({...c,current:{text:p.state.value,value:p.state.value},options:h(p.state),query:p.state.query,multi:p.state.isMulti,allValue:p.state.allValue,includeAll:p.state.includeAll,allowCustomValue:p.state.allowCustomValue});else if(n.Go.isDataSourceVariable(p))g.push({...c,current:{value:p.state.value,text:p.state.text},options:[],regex:p.state.regex,refresh:o.CO.onDashboardLoad,query:p.state.pluginId,multi:p.state.isMulti,allValue:p.state.allValue,includeAll:p.state.includeAll,allowCustomValue:p.state.allowCustomValue});else if(n.Go.isConstantVariable(p))g.push({...c,current:{value:p.state.value,text:p.state.value},query:p.state.value,hide:r.zL.hideVariable});else if(n.Go.isIntervalVariable(p)){const y=(0,m.bx)(p.state.intervals);g.push({...c,current:{text:p.state.value,value:p.state.value},query:y,refresh:p.state.refresh,options:p.state.intervals.map(P=>({value:P,text:P,selected:P===p.state.value})),auto:p.state.autoEnabled,auto_min:p.state.autoMinInterval,auto_count:p.state.autoStepCount})}else if(n.Go.isTextBoxVariable(p)){const y={text:p.state.value,value:p.state.value};g.push({...c,current:y,options:[{...y,selected:!0}],query:p.state.value})}else if(n.Go.isGroupByVariable(p)&&t.$.featureToggles.groupByVariable)g.push({...c,datasource:p.state.datasource,options:p.state.defaultOptions?.map(y=>({text:y.text,value:String(y.value)})),current:{text:p.state.text,value:p.state.value},allowCustomValue:p.state.allowCustomValue});else if(n.Go.isAdHocVariable(p))g.push({...c,datasource:p.state.datasource,allowCustomValue:p.state.allowCustomValue,baseFilters:p.state.baseFilters,filters:p.state.filters,defaultKeys:p.state.defaultKeys});else throw new Error("Unsupported variable type")}for(const p of g)p.hide===r.zL.dontHide&&delete p.hide,p.skipUrlSync||delete p.skipUrlSync,p.label===""&&delete p.label,p.multi||delete p.multi,p.sort===o.ZG.disabled&&delete p.sort;return g}function h(i){return i.options.map(x=>({value:String(x.value),text:x.label,selected:Array.isArray(i.value)?i.value.includes(x.value):i.value===x.value}))}function u(i,x,g){let p=[];
198for(const c of i.state.variables){const y={name:c.state.name,label:c.state.label,description:c.state.description??void 0,skipUrlSync:!!c.state.skipUrlSync,hide:(0,l.NB)(c.state.hide)||(0,s.SR)()},P={value:c.state.value,text:c.state.text};let d=[];if(n.Go.isQueryVariable(c)){((0,l.qJ)(c.state.refresh)==="never"||x)&&(d=h(c.state));const D=c.state.query;let b;typeof D!="string"?b={kind:c.state.datasource?.type??(0,a.lD)(D),spec:(0,a.c8)(D)}:b={kind:c.state.datasource?.type??(0,a.lD)(D),spec:{[l.sB]:D}};const E={kind:"QueryVariable",spec:{...y,current:P,options:d,query:b,definition:c.state.definition,datasource:(0,a.AB)(i,c,"variable",void 0,g),sort:(0,l.LY)(c.state.sort),refresh:(0,l.qJ)(c.state.refresh),regex:c.state.regex,allValue:c.state.allValue,includeAll:c.state.includeAll||!1,multi:c.state.isMulti||!1,skipUrlSync:c.state.skipUrlSync||!1}};p.push(E)}else if(n.Go.isCustomVariable(c)){d=h(c.state);const D={kind:"CustomVariable",spec:{...y,current:P,options:d,query:c.state.query,multi:c.state.isMulti||!1,allValue:c.state.allValue,includeAll:c.state.includeAll??!1}};p.push(D)}else if(n.Go.isDataSourceVariable(c)){const D={kind:"DatasourceVariable",spec:{...y,current:P,options:[],regex:c.state.regex,refresh:"onDashboardLoad",pluginId:c.state.pluginId,multi:c.state.isMulti||!1,includeAll:c.state.includeAll||!1}};c.state.allValue!==void 0&&(D.spec.allValue=c.state.allValue),p.push(D)}else if(n.Go.isConstantVariable(c)){const D={kind:"ConstantVariable",spec:{...y,current:{...P,text:String(c.state.value)},query:c.state.value}};p.push(D)}else if(n.Go.isIntervalVariable(c)){const D=(0,m.bx)(c.state.intervals),b={kind:"IntervalVariable",spec:{...y,current:{...P,text:c.state.value},query:D,refresh:"onTimeRangeChanged",options:c.state.intervals.map(E=>({value:E,text:E,selected:E===c.state.value})),auto:c.state.autoEnabled,auto_min:c.state.autoMinInterval,auto_count:c.state.autoStepCount}};p.push(b)}else if(n.Go.isTextBoxVariable(c)){const D={text:c.state.value,value:c.state.value},b={kind:"TextVariable",spec:{...y,current:D,query:c.state.value}};p.push(b)}else if(n.Go.isGroupByVariable(c)&&t.$.featureToggles.groupByVariable){d=h(c.state);const D={kind:"GroupByVariable",spec:{...y,datasource:c.state.datasource||{},options:c.state.defaultOptions?.map(b=>({text:b.text,value:String(b.value)}))||[],current:P,multi:c.state.isMulti||!1}};p.push(D)}else if(n.Go.isAdHocVariable(c)){const D={kind:"AdhocVariable",spec:{...y,name:c.state.name,datasource:c.state.datasource||{},baseFilters:c.state.baseFilters||[],filters:c.state.filters,defaultKeys:c.state.defaultKeys||[]}};p.push(D)}else throw new Error("Unsupported variable type: "+c.state.type)}return p}},31119:(ee,B,e)=>{"use strict";e.d(B,{dj:()=>S});var t=e(2543),n=e.n(t),r=e(43173),o=e(78282),s=e(56838),m=e(78947),a=e(8255),l=e(75735),f=e(11968),h=e(49e3),u=e(34960),i=e(88632),x=e(88499),g=e(44804),p=e(39385),c=e(17788),y=e(8285),P=e(39557),d=e(59006),D=e(67350),b=e(65333),E=e(3281),v=e(39508);const C="default";function S(j){const{spec:V,metadata:U}=j,F=w(V);F&&V.annotations.unshift(F);const M=V.annotations.map(Q=>{let J=Q.spec;return J?.options&&(J={...J,...J.options}),new h.g({key:(0,t.uniqueId)("annotations-"),query:{...J,builtIn:Q.spec.builtIn?1:0},name:Q.spec.name,isEnabled:!!Q.spec.enable,isHidden:!!Q.spec.hide})}),H=!!V.editable,_=j.access.canSave!==!1;let Z;U.labels?.[l.Y5]&&(Z=parseInt(U.labels[l.Y5],10));const ne={canShare:j.access.canShare!==!1,canSave:_,canStar:j.access.canStar!==!1,canEdit:j.access.canEdit!==!1,canDelete:j.access.canDelete!==!1,canAdmin:j.access.canAdmin!==!1,url:j.access.url,slug:j.access.slug,annotationsPermissions:j.access.annotationsPermissions,created:U.creationTimestamp,createdBy:U.annotations?.[l.hc],updated:U.annotations?.[l.xU],updatedBy:U.annotations?.[l.Qu],folderUid:U.annotations?.[l.ew],isSnapshot:!!U.annotations?.[l.qw],showSettings:!!j.access.canEdit,canMakeEditable:_&&!H,hasUnsavedFolderChange:!1,version:U.generation,k8s:U};H||(ne.canEdit=!1,ne.canDelete=!1,ne.canSave=!1);const te=d.j.get(V.layout.kind).deserialize(V.layout,V.elements,V.preload),Y=new p.H$({description:V.description,editable:V.editable,preload:V.preload,id:Z,isDirty:!1,links:V.links,meta:ne,tags:V.tags,title:V.title,uid:U.name,version:U.generation,body:te,$timeRange:new s.JZ({from:V.timeSettings.from,to:V.timeSettings.to,fiscalYearStartMonth:V.timeSettings.fiscalYearStartMonth,timeZone:V.timeSettings.timezone,weekStart:V.timeSettings.weekStart,UNSAFE_nowDelay:V.timeSettings.nowDelay}),$variables:O(V,ne.isSnapshot??!1),$behaviors:[new s.Gg.K2({sync:(0,E.Y_)(V.cursorSync)}),new s.Gg.Hf,x.M,b.A2,new s.Gg.en({enabled:V.liveNow}),c.zf,f.U,new g.s({reloadOnParamsChange:r.$.featureToggles.reloadDashboardsOnParamsChange&&!1,uid:Z?.toString(),version:1})],$data:new i.s({annotationLayers:M}),controls:new u.x({timePicker:new s.KE({quickRanges:V.timeSettings.quickRanges}),refreshPicker:new s.WM({refresh:V.timeSettings.autoRefresh,intervals:V.timeSettings.autoRefreshIntervals,withText:!0}),hideTimeControls:V.timeSettings.hideTimepicker})},"v2");return Y.setInitialSaveModel(j.spec,j.metadata),Y}function O(j,V){let U;return j.variables.length?V?U=K(j):U=I(j):U=new s.Pj({variables:[]}),U}function I(j){const V=j.variables.map(U=>{try{return R(U)}catch(F){return console.error(F),null}}).filter(U=>!!U);return new s.Pj({variables:V})}function R(j){const V={name:j.spec.name,label:j.spec.label,description:j.spec.description};if(j.kind===(0,m.l_)().kind)return new s.H9({...V,description:j.spec.description,skipUrlSync:j.spec.skipUrlSync,hide:(0,E.cc)(j.spec.hide),datasource:j.spec.datasource,applyMode:"auto",filters:j.spec.filters??[],baseFilters:j.spec.baseFilters??[],defaultKeys:j.spec.defaultKeys,useQueriesAsFilterForOptions:!0,layout:r.$.featureToggles.newFiltersUI?"combobox":void 0,supportsMultiValueOperators:!!(0,o.l)().getInstanceSettings(j.spec.datasource)?.meta.multiValueFilterOperators});if(j.kind===(0,m.ns)().kind)return new s.yP({...V,value:j.spec.current?.value??"",text:j.spec.current?.text??"",query:j.spec.query,isMulti:j.spec.multi,allValue:j.spec.allValue||void 0,includeAll:j.spec.includeAll,defaultToAll:!!j.spec.includeAll,skipUrlSync:j.spec.skipUrlSync,hide:(0,E.cc)(j.spec.hide)});if(j.kind===(0,m.m6)().kind)return new s.fS({...V,value:j.spec.current?.value??"",text:j.spec.current?.text??"",query:T(j),datasource:(0,D.Kq)(j),sort:(0,E.ES)(j.spec.sort),refresh:(0,E.tH)(j.spec.refresh),regex:j.spec.regex,allValue:j.spec.allValue||void 0,includeAll:j.spec.includeAll,defaultToAll:!!j.spec.includeAll,isMulti:j.spec.multi,skipUrlSync:j.spec.skipUrlSync,hide:(0,E.cc)(j.spec.hide),definition:j.spec.definition});if(j.kind===(0,m.X1)().kind)return new s.mI({...V,value:j.spec.current?.value??"",text:j.spec.current?.text??"",regex:j.spec.regex,pluginId:j.spec.pluginId,allValue:j.spec.allValue||void 0,includeAll:j.spec.includeAll,defaultToAll:!!j.spec.includeAll,skipUrlSync:j.spec.skipUrlSync,isMulti:j.spec.multi,hide:(0,E.cc)(j.spec.hide),defaultOptionEnabled:j.spec.current?.value===C&&j.spec.current?.text==="default"});if(j.kind===(0,m.pK)().kind){const U=(0,y.Sm)(j.spec.query),F=L(j,U);return new s.Yj({...V,value:F,intervals:U,autoEnabled:j.spec.auto,autoStepCount:j.spec.auto_count,autoMinInterval:j.spec.auto_min,refresh:(0,E.tH)(j.spec.refresh),skipUrlSync:j.spec.skipUrlSync,hide:(0,E.cc)(j.spec.hide)})}else{if(j.kind===(0,m.ET)().kind)return new s.x0({...V,value:j.spec.query,skipUrlSync:j.spec.skipUrlSync,hide:(0,E.cc)(j.spec.hide)});if(j.kind===(0,m.t1)().kind){let U;return j?.spec.current?.value?typeof j.spec.current.value=="string"?U=j.spec.current.value:U=j.spec.current.value[0]:U=j.spec.query,new s.TS({...V,value:U,skipUrlSync:j.spec.skipUrlSync,hide:(0,E.cc)(j.spec.hide)})}else{if(r.$.featureToggles.groupByVariable&&j.kind===(0,m.uB)().kind)return new s.ZG({...V,datasource:j.spec.datasource,value:j.spec.current?.value||[],text:j.spec.current?.text||[],skipUrlSync:j.spec.skipUrlSync,isMulti:j.spec.multi,hide:(0,E.cc)(j.spec.hide),defaultOptions:j.options});throw new Error(`Scenes: Unsupported variable type ${j.kind}`)}}}function T(j){return v.sB in j.spec.query.spec?j.spec.query.spec[v.sB]??"":{...j.spec.query.spec,refId:j.spec.query.spec.refId??"A"}}function L(j,V){const U=Array.isArray(j.spec.current.value)?j.spec.current.value[0]:j.spec.current.value;return U.startsWith("$__auto_interval_")?"$__auto":V.includes(U)?U:V[0]}function K(j){const V=j.variables.map(U=>{try{return U.kind==="AdhocVariable"?new s.H9({name:U.spec.name,label:U.spec.label,readOnly:!0,description:U.spec.description,skipUrlSync:U.spec.skipUrlSync,hide:(0,E.cc)(U.spec.hide),datasource:U.spec.datasource,applyMode:"auto",filters:U.spec.filters??[],baseFilters:U.spec.baseFilters??[],defaultKeys:U.spec.defaultKeys,useQueriesAsFilterForOptions:!0,layout:r.$.featureToggles.newFiltersUI?"combobox":void 0,supportsMultiValueOperators:!!(0,o.l)().getInstanceSettings(U.spec.datasource)?.meta.multiValueFilterOperators}):A(U)}catch(F){return console.error(F),null}}).filter(U=>!!U);return new s.Pj({variables:V})}function A(j){let V,U;if(j.kind==="IntervalVariable"){const F=(0,y.Sm)(j.spec.query),M=L(j,F);return V=new P.B({name:j.spec.name,label:j.spec.label,description:j.spec.description,value:M,text:M,hide:(0,E.cc)(j.spec.hide)}),V}return j.kind==="ConstantVariable"||j.kind==="AdhocVariable"?U={value:"",text:""}:U={value:j.spec.current?.value??"",text:j.spec.current?.text??""},V=new P.B({name:j.spec.name,label:j.spec.label,description:j.spec.description,value:U?.value??"",text:U?.text??"",hide:(0,E.cc)(j.spec.hide)}),V}function W(j,V){return j.elements[V].kind==="Panel"?j.elements[V]:void 0}function N(j,V){return j.elements[V].kind==="LibraryPanel"?j.elements[V]:void 0}function w(j){return j.annotations.some(F=>F.spec.builtIn)?void 0:{kind:"AnnotationQuery",spec:{datasource:{uid:"-- Grafana --",type:"grafana"},name:"Annotations & Alerts",iconColor:a.Mk,enable:!0,hide:!0,builtIn:!0}}}},65333:(ee,B,e)=>{"use strict";e.d(B,{tt:()=>te,EH:()=>ne,A2:()=>Y,wM:()=>H});var t=e(2543),n=e(43173),r=e(27489),o=e(25992),s=e(56838),m=e(5857),a=e(73427),l=e(7817),f=e(82612),h=e(11968),u=e(7498),i=e(49e3),x=e(34960),g=e(88632),p=e(88499),c=e(44804),y=e(39385),P=e(7094),d=e(32540),D=e(37040),b=e(66251),E=e(81657),v=e(93389),C=e(1131),S=e(87308),O=e(18178),I=e(35718),R=e(18789),T=e(17788),L=e(23289),K=e(8285),A=e(78282),W=e(39557);const N="default";function w(X){const se=X.templating.list.map(oe=>{try{return U(oe)}catch(ae){return console.error(ae),null}}).filter(oe=>!!oe);return new s.Pj({variables:se})}function j(X){const se=X.templating.list.map(oe=>{try{return oe.type==="adhoc"?new s.H9({name:oe.name,label:oe.label,readOnly:!0,description:oe.description,skipUrlSync:oe.skipUrlSync,hide:oe.hide,datasource:oe.datasource,applyMode:"auto",filters:oe.filters??[],baseFilters:oe.baseFilters??[],defaultKeys:oe.defaultKeys,useQueriesAsFilterForOptions:!0,layout:n.$.featureToggles.newFiltersUI?"combobox":void 0,supportsMultiValueOperators:!!(0,A.l)().getInstanceSettings(oe.datasource)?.meta.multiValueFilterOperators}):V(oe)}catch(ae){return console.error(ae),null}}).filter(oe=>!!oe);return new s.Pj({variables:se})}function V(X){let se,oe;if(X.type==="interval"){const ae=(0,K.Sm)(X.query),ie=(0,K.pk)(X,ae);return se=new W.B({name:X.name,label:X.label,description:X.description,value:ie,text:ie,hide:X.hide}),se}return X.type==="system"||X.type==="constant"||X.type==="adhoc"?oe={value:"",text:""}:oe={value:X.current?.value??"",text:X.current?.text??""},se=new W.B({name:X.name,label:X.label,description:X.description,value:oe?.value??"",text:oe?.text??"",hide:X.hide}),se}function U(X){const se={name:X.name,label:X.label,description:X.description};if(X.type==="adhoc")return new s.H9({...se,description:X.description,skipUrlSync:X.skipUrlSync,hide:X.hide,datasource:X.datasource,applyMode:"auto",filters:X.filters??[],baseFilters:X.baseFilters??[],defaultKeys:X.defaultKeys,allowCustomValue:X.allowCustomValue,useQueriesAsFilterForOptions:!0,layout:n.$.featureToggles.newFiltersUI?"combobox":void 0,supportsMultiValueOperators:!!(0,A.l)().getInstanceSettings(X.datasource)?.meta.multiValueFilterOperators});if(X.type==="custom")return new s.yP({...se,value:X.current?.value??"",text:X.current?.text??"",query:X.query,isMulti:X.multi,allValue:X.allValue||void 0,includeAll:X.includeAll,defaultToAll:!!X.includeAll,skipUrlSync:X.skipUrlSync,hide:X.hide,allowCustomValue:X.allowCustomValue});if(X.type==="query")return new s.fS({...se,value:X.current?.value??"",text:X.current?.text??"",query:X.query,datasource:X.datasource,sort:X.sort,refresh:X.refresh,regex:X.regex,allValue:X.allValue||void 0,includeAll:X.includeAll,defaultToAll:!!X.includeAll,isMulti:X.multi,skipUrlSync:X.skipUrlSync,hide:X.hide,definition:X.definition,allowCustomValue:X.allowCustomValue});if(X.type==="datasource")return new s.mI({...se,value:X.current?.value??"",text:X.current?.text??"",regex:X.regex,pluginId:X.query,allValue:X.allValue||void 0,includeAll:X.includeAll,defaultToAll:!!X.includeAll,skipUrlSync:X.skipUrlSync,isMulti:X.multi,hide:X.hide,defaultOptionEnabled:X.current?.value===N&&X.current?.text==="default",allowCustomValue:X.allowCustomValue});if(X.type==="interval"){const oe=(0,K.Sm)(X.query),ae=(0,K.pk)(X,oe);return new s.Yj({...se,value:ae,intervals:oe,autoEnabled:X.auto,autoStepCount:X.auto_count,autoMinInterval:X.auto_min,refresh:X.refresh,skipUrlSync:X.skipUrlSync,hide:X.hide})}else{if(X.type==="constant")return new s.x0({...se,value:X.query,skipUrlSync:X.skipUrlSync,hide:X.hide});if(X.type==="textbox"){let oe;return X?.current?.value?typeof X.current.value=="string"?oe=X.current.value:oe=X.current.value[0]:oe=X.query,new s.TS({...se,value:oe,skipUrlSync:X.skipUrlSync,hide:X.hide})}else{if(n.$.featureToggles.groupByVariable&&X.type==="groupby")return new s.ZG({...se,datasource:X.datasource,value:X.current?.value||[],text:X.current?.text||[],skipUrlSync:X.skipUrlSync,hide:X.hide,defaultOptions:X.options,allowCustomValue:X.allowCustomValue});throw new Error(`Scenes: Unsupported variable type ${X.type}`)}}}function F(X){return function(oe,ae){if(ae.angularPanelCtrl){oe.options={angularOptions:X.getOptionsToRemember()};return}if(!X.options||Object.keys(X.options).length===0){(0,t.defaults)(oe,X.getOptionsToRemember());const ie=(0,t.cloneDeep)(X.targets);Object.defineProperty(oe,"targets",{get:function(){return console.warn("Accessing the targets property when migrating a panel plugin is deprecated. Changes to this property will be ignored."),ie}})}if(X.autoMigrateFrom){const ie=f.NB[X.autoMigrateFrom]!=null,fe=X.getOptionsToRemember(),pe=X.autoMigrateFrom;if(ae.onPanelTypeChanged){const de=ie?{angular:fe}
198:fe.options;Object.assign(oe.options,ae.onPanelTypeChanged(oe,pe,de,oe.fieldConfig))}}}}var M=e(78320);function H(X){const se=new l.G(X.dashboard,X.meta),oe=ne(se,X.dashboard);return oe.setInitialSaveModel(X.dashboard),oe}function _(X){const se=[];let oe=null,ae=[];for(const ie of X)if(ie.type==="row")oe?oe.id!==ie.id&&(se.push(Z(oe,ae)),ie.collapsed?(se.push(Z(ie,[])),oe=null):oe=ie,ae=[]):ie.collapsed?se.push(Z(ie,[])):oe=ie;else{ie.snapshotData&&J(ie);const fe=te(ie);oe?ae.push(fe):se.push(fe)}return oe&&se.push(Z(oe,ae)),se}function Z(X,se){X.collapsed&&X.panels&&(se=X.panels.map(ie=>(ie instanceof f.a9||(ie=new f.a9(ie)),te(ie))));let oe,ae=se;return X.repeat&&(oe=[new S.L({variableName:X.repeat})]),new s.tI({key:(0,K.XA)(X.id),title:X.title,y:X.gridPos.y,isCollapsed:X.collapsed,children:ae,$behaviors:oe,actions:new O.u({})})}function ne(X,se){let oe,ae=[],ie;const fe=X.uid,pe=n.$.featureToggles.dashboardNewLayouts?"v2":"v1";X.templating?.list?.length?X.meta.isSnapshot?oe=j(X):oe=w(X):oe=new s.Pj({variables:[]}),X.annotations?.list?.length&&!X.isSnapshot()&&(ae=X.annotations?.list.map(Te=>new i.g({key:(0,t.uniqueId)("annotations-"),query:Te,name:Te.name,isEnabled:!!Te.enable,isHidden:!!Te.hide})));let de=n.$.unifiedAlertingEnabled;de||X.panels.find(Te=>!!Te.alert)&&(de=!0),de&&(ie=new u.C({key:"alert-states",name:"Alert States"}));const le=n.$.featureToggles.scopeFilters&&X.scopeMeta?{trait:X.scopeMeta.trait,groups:X.scopeMeta.groups}:void 0,me=[new s.Gg.K2({sync:X.graphTooltip}),new s.Gg.Hf({enableProfiling:n.$.dashboardPerformanceMetrics.findIndex(Te=>Te==="*"||Te===X.uid)!==-1,onProfileComplete:q(X.uid,X.title)}),p.M,Y,new s.Gg.en({enabled:X.liveNow}),T.zf,h.U,new c.s({reloadOnParamsChange:n.$.featureToggles.reloadDashboardsOnParamsChange&&X.meta.reloadOnParamsChange,uid:fe,version:X.version})];return new y.H$({uid:fe,description:X.description,editable:X.editable,preload:se.preload??!1,id:X.id,isDirty:!1,links:X.links||[],meta:X.meta,tags:X.tags||[],title:X.title,version:X.version,scopeMeta:le,body:new C.D({grid:new s.hy({isLazy:!(se.preload||a.TP.user.authenticatedBy==="render"),children:_(X.panels)})}),$timeRange:new s.JZ({from:X.time.from,to:X.time.to,fiscalYearStartMonth:X.fiscalYearStartMonth,timeZone:X.timezone,weekStart:(0,m.rE)(X.weekStart)?X.weekStart:void 0,UNSAFE_nowDelay:X.timepicker?.nowDelay}),$variables:oe,$behaviors:me,$data:new g.s({annotationLayers:ae,alertStatesLayer:ie}),controls:new x.x({timePicker:new s.KE({quickRanges:X.timepicker.quick_ranges}),refreshPicker:new s.WM({refresh:X.refresh,intervals:X.timepicker.refresh_intervals,withText:!0}),hideTimeControls:X.timepicker.hidden})},pe)}function te(X){const se=X.repeat?{variableName:X.repeat,repeatDirection:X.repeatDirection==="v"?"v":"h"}:{},oe=[];oe.push(new d.$({rawLinks:X.links,menu:new d.m({$behaviors:[D.oV]})})),oe.push(new b.W);const ae=(X.timeFrom||X.timeShift)&&!X.hideTimeOverride,ie={key:(0,K.XA)(X.id),title:X.title?.substring(0,5e3),description:X.description,pluginId:X.type??"timeseries",options:X.options??{},fieldConfig:X.fieldConfig,pluginVersion:X.pluginVersion,seriesLimit:n.$.panelSeriesLimit,displayMode:X.transparent?"transparent":void 0,hoverHeader:!X.title&&!ae,hoverHeaderOffset:0,$data:(0,R.w)(X),titleItems:oe,$behaviors:[],extendPanelContext:I.C,_UNSAFE_customMigrationHandler:F(X)};X.libraryPanel&&(ie.$behaviors.push(new P.u({uid:X.libraryPanel.uid,name:X.libraryPanel.name})),ie.pluginId=P.u.LOADING_VIZ_PANEL_PLUGIN_ID,ie.$data=void 0),n.$.publicDashboardAccessToken||(ie.menu=new s.Lw({$behaviors:[D._i]})),(X.timeFrom||X.timeShift)&&(ie.$timeRange=new E.v({timeFrom:X.timeFrom,timeShift:X.timeShift,hideTimeOverride:X.hideTimeOverride}));const fe=new s.Eb(ie);return new v.U({key:`grid-item-${X.id}`,x:X.gridPos.x,y:X.gridPos.y,width:se.repeatDirection==="h"?24:X.gridPos.w,height:X.gridPos.h,itemHeight:X.gridPos.h,body:fe,maxPerRow:X.maxPerRow,...se})}function Y(X){X.subscribeToEvent(s.Kw,se=>{const{interaction:oe}=se.payload;switch(oe){case"panel-status-message-clicked":L.c.panelStatusMessageClicked();break;case"panel-cancel-query-clicked":L.c.panelCancelQueryClicked();break}})}const Q=X=>X.map(se=>({data:{values:se.fields.map(oe=>oe.values).filter(oe=>oe!==void 0)},schema:{fields:se.fields.map(oe=>({name:oe.name,type:oe.type,config:oe.config}))}})),J=X=>{X.snapshotData&&(X.datasource=M.x,X.targets=[{refId:X.snapshotData[0]?.refId??"",datasource:X.datasource,queryType:"snapshot",snapshot:Q(X.snapshotData)}],X.snapshotData=[])};function q(X,se){return oe=>{let ae="";oe.origin==="SceneTimeRange"?ae="time-range-change":oe.origin==="SceneRefreshPicker"?ae="refresh":oe.origin==="DashboardScene"?ae="view":oe.origin.indexOf("Variable")>-1&&(ae="variable-change"),(0,r.rR)("dashboard-render",{interactionType:ae,duration:oe.duration,networkDuration:oe.networkDuration,totalJSHeapSize:oe.totalJSHeapSize,usedJSHeapSize:oe.usedJSHeapSize,jsHeapSizeLimit:oe.jsHeapSizeLimit}),(0,o.l$)(`dashboard.${ae}`,{duration:oe.duration,networkDuration:oe.networkDuration,totalJSHeapSize:oe.totalJSHeapSize,usedJSHeapSize:oe.usedJSHeapSize,jsHeapSizeLimit:oe.jsHeapSizeLimit,timeSinceBoot:performance.measure("time_since_boot","frontend_boot_js_done_time_seconds").duration},{dashboard:X,title:se})}}},70030:(ee,B,e)=>{"use strict";e.d(B,{Uy:()=>E,Z6:()=>C,ZB:()=>v,c:()=>R});var t=e(2543),n=e.n(t),r=e(3594),o=e(56838),s=e(59857),m=e(21275),a=e(10605),l=e(98314),f=e(65635),h=e(8095),u=e(88632),i=e(81657),x=e(93389),g=e(1131),p=e(87308),c=e(3371),y=e(1682),P=e(8285),d=e(78320),D=e(99392),b=e(84500);
198function E(L,K=!1){const A=L.state,W=A.$timeRange.state,N=A.$data,w=A.$variables,j=A.body;let V=[],U=[];if(j instanceof g.D){for(const Y of j.state.grid.state.children)if(Y instanceof x.U&&(Y.state.variableName?V=V.concat(O(Y,K)):V.push(v(Y,K))),Y instanceof o.tI){if((0,c.Ry)(Y.state.key)&&!K)continue;I(Y,V,K)}}let F=[];N instanceof u.s&&(F=(0,D.O)(N.state.annotationLayers)),w instanceof o.Pj&&(U=(0,b.C)(w));const M=A.controls?.state,H=M?.refreshPicker,_=T({refresh_intervals:H?.state.intervals,hidden:M?.hideTimeControls,nowDelay:W.UNSAFE_nowDelay,quick_ranges:M?.timePicker.state.quickRanges},s.lt),Z=A.$behaviors?.find(Y=>Y instanceof o.Gg.K2)?.state.sync??s.Ye.graphTooltip,ne=A.$behaviors?.find(Y=>Y instanceof o.Gg.en)?.isEnabled||void 0,te={...s.Ye,title:A.title,description:A.description||void 0,uid:A.uid,id:A.id,editable:A.editable,preload:A.preload,time:{from:W.from,to:W.to},timepicker:_,panels:V,annotations:{list:F},templating:{list:U},version:A.version,timezone:W.timeZone,fiscalYearStartMonth:W.fiscalYearStartMonth,weekStart:W.weekStart,tags:A.tags,links:A.links,graphTooltip:Z,liveNow:ne,schemaVersion:f.O2,refresh:H?.state.refresh,scopeMeta:A.scopeMeta};return(0,a.v)(te)}function v(L,K=!1){let A,W=0,N=0,w=0,j=0,V=L;if(!(V.state.body instanceof o.Eb))throw new Error("DashboardGridItem body expected to be VizPanel");if(A=V.state.body,W=V.state.x??0,N=V.state.y??0,w=V.state.width??0,j=(V.state.variableName?V.state.itemHeight:V.state.height)??0,!A)throw new Error("Unsupported grid item type");return C(A,{x:W,y:N,h:j,w},K,V)}function C(L,K,A=!1,W){let N;if((0,P.ME)(L)){const V=(0,P.iL)(L);return N={id:(0,P.Cs)(L),title:L.state.title,gridPos:K,libraryPanel:{name:V.state.name,uid:V.state.uid},type:"library-panel-ref"},N}else N={id:(0,P.Cs)(L),type:L.state.pluginId,title:L.state.title,description:L.state.description??void 0,gridPos:K,fieldConfig:L.state.fieldConfig??{defaults:{},overrides:[]},transformations:[],transparent:L.state.displayMode==="transparent",pluginVersion:L.state.pluginVersion,...S(L,A)};if(L.state.options){const{angularOptions:V,...U}=L.state.options;N.options=U,V&&(0,t.defaults)(N,V)}const w=L.state.$timeRange;w instanceof i.v&&(N.timeFrom=w.state.timeFrom,N.timeShift=w.state.timeShift,N.hideTimeOverride=w.state.hideTimeOverride),W instanceof x.U&&(W.state.variableName&&(N.repeat=W.state.variableName),W.state.maxPerRow&&(N.maxPerRow=W.state.maxPerRow),W.state.repeatDirection&&(N.repeatDirection=W.getRepeatDirection()));const j=y.b4.getPanelLinks(L);return N.links=j?.state.rawLinks??[],N.links.length===0&&delete N.links,N.transformations?.length===0&&delete N.transformations,N.transparent||delete N.transparent,N}function S(L,K=!1){const A=L.state.$data,W={},N=(0,P.un)(L);if(N&&(W.targets=N.state.queries,W.maxDataPoints=N.state.maxDataPoints,W.datasource=N.state.datasource,N.state.cacheTimeout&&(W.cacheTimeout=N.state.cacheTimeout),N.state.queryCachingTTL&&(W.queryCachingTTL=N.state.queryCachingTTL),N.state.minInterval&&(W.interval=N.state.minInterval)),A instanceof o.Es&&(W.transformations=A.state.transformations),A&&K){W.datasource=d.x;let w=(0,l.B6)(A.state.data);A instanceof o.Es&&(w=(0,l.B6)(A.state.$data.state.data)),W.targets=[{refId:"A",datasource:W.datasource,queryType:h.nj.Snapshot,snapshot:w}]}return W}function O(L,K=!1){if(K){if(L.state.body instanceof o.Eb&&(0,P.ME)(L.state.body)){const{x:A=0,y:W=0,width:N=0,height:w=0}=L.state;return[C(L.state.body,{x:A,y:W,w:N,h:w},K)]}if(L.state.repeatedPanels){const{h:A,w:W,columnCount:N}=(0,P.bR)(L);return L.state.repeatedPanels.map((j,V)=>{let U=0,F=0;L.state.repeatDirection==="v"?(U=L.state.x,F=V*A):(U=V%N*W,F=L.state.y+Math.floor(V/N)*A);const M={x:U,y:F,w:W,h:A},H=j.state.$variables.getByName(L.state.variableName);return{id:(0,P.Cs)(j),type:j.state.pluginId,title:j.state.title,gridPos:M,options:j.state.options,fieldConfig:j.state.fieldConfig??{defaults:{},overrides:[]},transformations:[],transparent:j.state.displayMode==="transparent",scopedVars:{[L.state.variableName]:{text:H?.state.text,value:H?.state.value}},...S(j,K)}})}return[]}else return[v(L)]}function I(L,K,A=!1){const W=!!L.state.isCollapsed,N={type:"row",id:(0,P.Cs)(L),title:L.state.title,gridPos:{x:L.state.x??0,y:L.state.y??0,w:L.state.width??24,h:L.state.height??1},collapsed:W,panels:[]};if(L.state.$behaviors?.length){const j=L.state.$behaviors[0];j instanceof p.L&&(N.repeat=j.state.variableName)}if(A&&L.state.$variables){const V=L.state.$variables.state.variables.reduce((U,F)=>({...U,[F.state.name]:{text:F.state.text,value:F.state.value}}),{});N.scopedVars=V}K.push(N);let w=[];
198A?L.state.children.forEach(j=>{j instanceof x.U&&(j.state.variableName?w=w.concat(O(j,!W)):w.push(v(j,!W)))}):w=L.state.children.map(j=>{if(!(j instanceof x.U))throw new Error("Row child expected to be DashboardGridItem");return v(j)}),L.state.isCollapsed?N.panels=w:K.push(...w)}function R(L,K,A,W){let N={...A,title:L,time:{from:K.from.toISOString(),to:K.to.toISOString()},links:[]};if(W){const w=A.panels?.find(j=>j.id===(0,P.Cs)(W));w&&(w.gridPos={w:24,x:0,y:0,h:20},N={...N,panels:[w]})}if(N.panels?.forEach(w=>{"links"in w&&(w.links=[])}),N.annotations){const j=(N.annotations.list?.filter(V=>V.enable)||[]).map(V=>({name:V.name,enable:V.enable,iconColor:V.iconColor,type:V.type,builtIn:V.builtIn,hide:V.hide,snapshotData:[]}));N.annotations.list=j}return N.templating&&N.templating.list?.forEach(w=>{"query"in w&&(w.query=""),"options"in w&&(w.options=w.current&&!(0,r.R)(w.current)?[w.current]:[]),"refresh"in w&&(w.refresh=m.CO.never)}),N}function T(L,K){const A={...L};for(const W in K)(0,t.isEqual)(A[W],K[W])&&delete A[W];return A}},62265:(ee,B,e)=>{"use strict";e.d(B,{AB:()=>M,Cy:()=>C,GB:()=>y,Ic:()=>R,Xl:()=>x,c8:()=>b,lD:()=>D});var t=e(2543),n=e.n(t),r=e(43173),o=e(56838),s=e(10605),m=e(78947),a=e(88632),l=e(81657),f=e(1682),h=e(8285),u=e(84500),i=e(39508);function x(H,_=!1){const Z=H.state,ne=Z.$timeRange.state,te=Z.controls?.state,Y=te?.refreshPicker,Q=H.serializer.getDSReferencesMapping(),J={title:Z.title,description:Z.description,cursorSync:g(Z),liveNow:p(Z),preload:Z.preload??(0,m.xE)().preload,editable:Z.editable??(0,m.xE)().editable,links:Z.links??(0,m.xE)().links,tags:Z.tags??(0,m.xE)().tags,timeSettings:{timezone:ne.timeZone,from:ne.from,to:ne.to,autoRefresh:Y?.state.refresh||"",autoRefreshIntervals:Y?.state.intervals,hideTimepicker:te?.hideTimeControls??!1,weekStart:ne.weekStart,fiscalYearStartMonth:ne.fiscalYearStartMonth,nowDelay:ne.UNSAFE_nowDelay,quickRanges:te?.timePicker.state.quickRanges},variables:S(Z,Q),elements:c(H,Q),annotations:O(Z,Q),layout:Z.body.serialize()};try{if(T(J))return(0,s.v)(J);throw new Error("Error we could transform the dashboard to schema v2: "+J)}catch(q){throw console.error("Error transforming dashboard to schema v2: "+q,J),new Error("Error transforming dashboard to schema v2: "+q)}}function g(H){const _=H.$behaviors?.find(Z=>Z instanceof o.Gg.K2)?.state.sync;return(0,i.k6)(_)}function p(H){const _=H.$behaviors?.find(Z=>Z instanceof o.Gg.en)?.isEnabled||void 0;return _===void 0?!!(0,m.xE)().liveNow:!!_}function c(H,_){const ne=(H.state.body.getVizPanels()??[]).map(te=>y(te,_));return C(ne,H)}function y(H,_){if((0,h.ME)(H)){const se=(0,h.iL)(H);return{kind:"LibraryPanel",spec:{id:(0,h.Cs)(H),title:H.state.title,libraryPanel:{uid:se.state.uid,name:se.state.name}}}}const Z=H.state.fieldConfig.defaults.color;let ne;if(Z){const se=(0,i.Jc)(Z.mode);se&&(ne={...Z,mode:se})}const te=H.state.fieldConfig.defaults.decimals??void 0,Y=H.state.fieldConfig.defaults.min??void 0,Q=H.state.fieldConfig.defaults.max??void 0,J=Object.fromEntries(Object.entries({...H.state.fieldConfig.defaults,decimals:te,min:Y,max:Q,color:ne}).filter(([se,oe])=>oe!==void 0)),q={...H.state.fieldConfig,defaults:J};return{kind:"Panel",spec:{id:(0,h.Cs)(H),title:H.state.title,description:H.state.description??"",links:P(H),data:{kind:"QueryGroup",spec:{queries:d(H,_),transformations:E(H),queryOptions:v(H)}},vizConfig:{kind:H.state.pluginId,spec:{pluginVersion:H.state.pluginVersion??"",options:H.state.options,fieldConfig:q??(0,m.bt)()}}}}}function P(H){const _=f.b4.getPanelLinks(H);return _?_.state.rawLinks??[]:[]}function d(H,_){const Z=[],ne=(0,h.un)(H),te=ne?.state.queries;return te&&te.forEach(Y=>{const Q=M(H,Y,"panel",ne,_),J={kind:D(Y,ne),spec:(0,t.omit)(Y,"datasource","refId","hide")},q={datasource:Q,query:J,refId:Y.refId,hidden:!!Y.hide};Z.push({kind:"PanelQuery",spec:q})}),Z}function D(H,_){return typeof H=="string"?R()?.type||"":H.datasource?.type?H.datasource.type:_?.state.datasource?.type?_.state.datasource.type:R()?.type||""}function b(H){return H}function E(H){let _=[];const Z=H.state.$data;if(Z instanceof o.Es){const ne=Z.state.transformations;if(ne.length===0)return[];for(const te of ne){const Y=te;if("id"in Y){const Q={id:Y.id,disabled:Y.disabled,filter:Y.filter,...Y.topic&&{topic:Y.topic},options:Y.options};_.push({kind:Y.id,spec:Q})}else throw new Error("Unsupported transformation type")}}return _}function v(H){let _={};const Z=(0,h.un)(H);Z&&(_.maxDataPoints=Z.state.maxDataPoints,Z.state.cacheTimeout&&(_.cacheTimeout=Z.state.cacheTimeout),Z.state.queryCachingTTL&&(_.queryCachingTTL=Z.state.queryCachingTTL),Z.state.minInterval&&(_.interval=Z.state.minInterval));const ne=H.state.$timeRange;
198return ne instanceof l.v&&(_.timeFrom=ne.state.timeFrom,_.timeShift=ne.state.timeShift,_.hideTimeOverride=ne.state.hideTimeOverride),_}function C(H,_){return H.reduce((Z,ne)=>{let te=_.serializer.getElementIdForPanel(ne.spec.id);return Z[te]=ne,Z},{})}function S(H,_){const Z=H.$variables;let ne=[];return Z instanceof o.Pj&&(ne=(0,u.$)(Z,!1,_)),ne}function O(H,_){const Z=H.$data;if(!(Z instanceof a.s))return[];const ne=[];for(const te of Z.state.annotationLayers){if(!(te instanceof o.tV.g))continue;const Y={kind:"AnnotationQuery",spec:{builtIn:!!te.state.query.builtIn,name:te.state.query.name,datasource:M(te,te.state.query,"annotation",void 0,_),enable:!!te.state.isEnabled,hide:!!te.state.isHidden,iconColor:te.state.query.iconColor}};te.state.query.target?te.state.query.builtIn?Y.spec.query={kind:"grafana",spec:{...te.state.query.target}}:Y.spec.query={kind:I(te.state.query),spec:{...te.state.query.target}}:te.state.query.query?.kind&&(Y.spec.query={kind:te.state.query.query.kind,spec:{...te.state.query.query.spec}});let Q=(0,t.omit)(te.state.query,"type","target","builtIn","name","datasource","iconColor","enable","hide","filter","query");if(Object.keys(Q).length>0){const{options:J,...q}=Q;Y.spec.options={...J,...q}}te.state.query.filter?.ids?.length&&(Y.spec.filter=te.state.query.filter),ne.push(Y)}return ne}function I(H){if(H.datasource?.type)return H.datasource.type;{const _=R();return _?_.type:"grafana"}}function R(){const H=r.$.bootData.settings.defaultDatasource,Z=r.$.bootData.settings.datasources[H];return{type:Z.meta.id,uid:Z.name}}function T(H){if(typeof H!="object"||H===null||Array.isArray(H))throw new Error("Dashboard is not an object or is null");if(!("title"in H)||typeof H.title!="string")throw new Error("Title is not a string");if(!("timeSettings"in H)||typeof H.timeSettings!="object"||H.timeSettings===null)throw new Error("TimeSettings is not an object or is null");if(!("variables"in H)||!Array.isArray(H.variables))throw new Error("Variables is not an array");if(!("elements"in H)||typeof H.elements!="object"||H.elements===null)throw new Error("Elements is not an object or is null");if(!("annotations"in H)||!Array.isArray(H.annotations))throw new Error("Annotations is not an array");if(!("layout"in H)||typeof H.layout!="object"||H.layout===null)throw new Error("Layout is not an object or is null");if("description"in H&&H.description!==void 0&&typeof H.description!="string")throw new Error("Description is not a string");if("cursorSync"in H&&H.cursorSync!==void 0){const Z=["Off","Crosshair","Tooltip"];if(typeof H.cursorSync!="string"||!Z.includes(H.cursorSync))throw new Error("CursorSync is not a valid value")}if("liveNow"in H&&H.liveNow!==void 0&&typeof H.liveNow!="boolean")throw new Error("LiveNow is not a boolean");if("preload"in H&&H.preload!==void 0&&typeof H.preload!="boolean")throw new Error("Preload is not a boolean");if("editable"in H&&H.editable!==void 0&&typeof H.editable!="boolean")throw new Error("Editable is not a boolean");if("links"in H&&H.links!==void 0&&!Array.isArray(H.links))throw new Error("Links is not an array");if("tags"in H&&H.tags!==void 0&&!Array.isArray(H.tags))throw new Error("Tags is not an array");if("id"in H&&H.id!==void 0&&typeof H.id!="number")throw new Error("ID is not a number");const _=H.timeSettings;if(!("from"in _)||typeof _.from!="string")throw new Error("From is not a string");if(!("to"in _)||typeof _.to!="string")throw new Error("To is not a string");if(!("autoRefresh"in _)||typeof _.autoRefresh!="string")throw new Error("AutoRefresh is not a string");if(!("hideTimepicker"in _)||typeof _.hideTimepicker!="boolean")throw new Error("HideTimepicker is not a boolean");if("autoRefreshIntervals"in _&&_.autoRefreshIntervals!==void 0&&!Array.isArray(_.autoRefreshIntervals))throw new Error("AutoRefreshIntervals is not an array");if("timezone"in _&&_.timezone!==void 0&&typeof _.timezone!="string")throw new Error("Timezone is not a string");if("quickRanges"in _&&_.quickRanges!==void 0&&!Array.isArray(_.quickRanges))throw new Error("QuickRanges is not an array");
198if("weekStart"in _&&_.weekStart!==void 0&&(typeof _.weekStart!="string"||!["saturday","sunday","monday"].includes(_.weekStart)))throw new Error('WeekStart should be one of "saturday", "sunday" or "monday"');if("nowDelay"in _&&_.nowDelay!==void 0&&typeof _.nowDelay!="string")throw new Error("NowDelay is not a string");if("fiscalYearStartMonth"in _&&_.fiscalYearStartMonth!==void 0&&typeof _.fiscalYearStartMonth!="number")throw new Error("FiscalYearStartMonth is not a number");if(!("kind"in H.layout))throw new Error("Layout kind is required");return H.layout.kind==="GridLayout"?L(H.layout):H.layout.kind==="RowsLayout"&&K(H.layout),!0}function L(H){if(typeof H!="object"||H===null)throw new Error("Layout is not an object or is null");if(!("kind"in H)||H.kind!=="GridLayout")throw new Error("Layout kind is not GridLayout");if(!("spec"in H)||typeof H.spec!="object"||H.spec===null)throw new Error("Layout spec is not an object or is null");if(!("items"in H.spec)||!Array.isArray(H.spec.items))throw new Error("Layout spec items is not an array")}function K(H){if(typeof H!="object"||H===null)throw new Error("Layout is not an object or is null");if(!("kind"in H)||H.kind!=="RowsLayout")throw new Error("Layout kind is not RowsLayout");if(!("spec"in H)||typeof H.spec!="object"||H.spec===null)throw new Error("Layout spec is not an object or is null");if(!("rows"in H.spec)||!Array.isArray(H.spec.rows))throw new Error("Layout spec items is not an array")}function A(H,_,Z){if(!Z)return new Set;if(_==="panels"&&w(H)){const ne=f.b4.getElementIdentifierForVizPanel(H);return Z.panels.get(ne)||new Set}if(_==="variables")return Z.variables;if(_==="annotations")return Z.annotations;throw new Error(`Invalid type ${_} for getAutoAssignedDSRef`)}function W(H,_,Z,ne){const te=N(H,Z);if(!_?.has(te)){if(Z==="query")return"datasource"in H&&H.datasource?H.datasource:ne?.state?.datasource;if(Z==="variable"&&"state"in H&&"datasource"in H.state)return H.state.datasource||{};if(Z==="annotation"&&"datasource"in H)return H.datasource||{}}}function N(H,_){if(_==="query")return"refId"in H?H.refId:"";if(_==="variable")return"state"in H&&"name"in H.state?H.state.name:"";if(_==="annotation")return"name"in H?H.name:"";throw new Error(`Invalid type ${_} for getElementIdentifier`)}function w(H){return"pluginId"in H.state}function j(H){return!("pluginId"in H.state)&&("variables"in H.state||"getValue"in H)}function V(H){return"refId"in H&&!("state"in H)}function U(H){return"datasource"in H&&"name"in H}function F(H){return"state"in H&&"name"in H.state}function M(H,_,Z,ne,te){let Y;if(Z==="panel"){if(!ne||!w(H)||!V(_))return;const Q=A(H,"panels",te);Y=W(_,Q,"query",ne)}if(Z==="variable"){if(!j(H)||!F(_))return;const Q=A(H,"variables",te);Y=W(_,Q,"variable")}if(Z==="annotation"){if(!U(_))return;const Q=A(H,"annotations",te);Y=W(_,Q,"annotation")}return Object.keys(Y||{}).length>0?Y:void 0}},3281:(ee,B,e)=>{"use strict";e.d(B,{ES:()=>m,So:()=>f,Y_:()=>a,cc:()=>s,tH:()=>o});var t=e(18600),n=e(21275),r=e(59857);function o(h){switch(h){case"never":return n.CO.never;case"onDashboardLoad":return n.CO.onDashboardLoad;case"onTimeRangeChanged":return n.CO.onTimeRangeChanged;default:return n.CO.never}}function s(h){switch(h){case"dontHide":return r.zL.dontHide;case"hideLabel":return r.zL.hideLabel;case"hideVariable":return r.zL.hideVariable;default:return r.zL.dontHide}}function m(h){switch(h){case"disabled":return n.ZG.disabled;case"numericalAsc":return n.ZG.numericalAsc;case"alphabeticalCaseInsensitiveAsc":return n.ZG.alphabeticalCaseInsensitiveAsc;case"alphabeticalCaseInsensitiveDesc":return n.ZG.alphabeticalCaseInsensitiveDesc;case"numericalDesc":return n.ZG.numericalDesc;case"naturalAsc":return n.ZG.naturalAsc;case"naturalDesc":return n.ZG.naturalDesc;case"alphabeticalAsc":return n.ZG.alphabeticalAsc;case"alphabeticalDesc":return n.ZG.alphabeticalDesc;default:return n.ZG.disabled}}function a(h){switch(h){case"Crosshair":return n.yV.Crosshair;case"Tooltip":return n.yV.Tooltip;case"Off":return n.yV.Off;default:return n.$C}}function l(h){switch(h){case"true":return t.W.True;case"false":return t.W.False;case"null":return t.W.Null;case"nan":return t.W.NaN;case"null+nan":return t.W.NullAndNaN;case"empty":return t.W.Empty;default:throw new Error(`Unknown match type: ${h}`)}}function f(h){const u=x=>{switch(x){case"absolute":return n.Ol.Absolute;case"percentage":return n.Ol.Percentage;default:return n.Ol.Absolute}},i={...h.defaults};return h.defaults.mappings&&(i.mappings=h.defaults.mappings.map(x=>{switch(x.type){case"value":return{...x,type:n.dM.ValueToText};case"range":return{...x,type:n.dM.RangeToText};case"regex":return{...x,type:n.dM.RegexToText};case"special":return{...x,options:{...x.options,match:l(x.options.match)},type:n.dM.SpecialValue};default:return x}})),h.defaults.thresholds&&(i.thresholds={...h.defaults.thresholds,mode:u(h.defaults.thresholds.mode)}),{...h,defaults:i}}},39508:(ee,B,e)=>{"use strict";e.d(B,{Jc:()=>h,LY:()=>l,MM:()=>f,NB:()=>a,k6:()=>s,qJ:()=>m,sB:()=>o});var t=e(739),n=e(21275),r=e(78947);const o="__legacyStringValue";function s(u){switch(u){case 0:return"Off";case 1:return"Crosshair";case 2:return"Tooltip";default:return(0,r.xE)().cursorSync}}function m(u){switch(u){case 0:return"never";case 1:return"onDashboardLoad";case 2:return"onTimeRangeChanged";default:return(0,r.FM)()}}function a(u){switch(u){case 0:return"dontHide";case 1:return"hideLabel";case 2:return"hideVariable";default:return(0,r.SR)()}}function l(u){switch(u){case 0:return"disabled";case 1:return"alphabeticalAsc";case 2:return"alphabeticalDesc";case 3:return"numericalAsc";case 4:return"numericalDesc";default:return(0,r.G9)()}}function f(u){switch(u){case"annotations":return t.QR.Annotations;case"alertStates":return t.QR.AlertStates;case"series":return t.QR.Series;default:return}}function h(u){switch(u){case n.Yb.Thresholds:return"thresholds";case n.Yb.PaletteClassic:return"palette-classic";case n.Yb.PaletteClassicByName:return"palette-classic-by-name";case n.Yb.ContinuousGrYlRd:return"continuous-GrYlRd";case n.Yb.ContinuousRdYlGr:return"continuous-RdYlGr";case n.Yb.ContinuousBlYlRd:return"continuous-BlYlRd";case n.Yb.ContinuousYlRd:return"continuous-YlRd";case n.Yb.ContinuousBlPu:return"continuous-BlPu";case n.Yb.ContinuousYlBl:return"continuous-YlBl";case n.Yb.ContinuousBlues:return"continuous-blues";case n.Yb.ContinuousReds:return"continuous-reds";case n.Yb.ContinuousGreens:return"continuous-greens";case n.Yb.ContinuousPurples:return"continuous-purples";case n.Yb.Fixed:return"fixed";case n.Yb.Shades:return"shades";default:return}}},22351:(ee,B,e)=>{"use strict";e.d(B,{c:()=>g,h:()=>p});var t=e(74848),n=e(42941),r=e(41053),o=e(85629),s=e(27489),m=e(45861),a=e(71599),l=e(66404),f=e(35137),h=e(22787),u=e(56840),i=e(15203),x=e(27154);function g({dashboard:y}){const[P,d]=(0,n.A)(!1),[D]=(0,i.uz)(),[,b]=(0,r.A)(async()=>{(0,s.rR)("grafana_manage_dashboards_delete_clicked",{item_counts:{dashboard:1},source:"dashboard_scene_settings",restore_enabled:!1}),d(),y.state.uid&&await D({selectedItems:{dashboard:{[y.state.uid]:!0},folder:{}}}),await y.onDashboardDelete()},[y,d]);return y.state.meta.provisioned&&P?(0,t.jsx)(c,{dashboardId:y.state.meta.provisionedExternalId,onClose:d}):y.isManagedRepository()&&P?(0,t.jsx)(x.f,{resource:y,onDismiss:d}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.$n,{variant:"destructive",onClick:d,"data-testid":o.Tp.pages.Dashboard.Settings.General.deleteDashBoard,children:(0,t.jsx)(u.x6,{i18nKey:"dashboard-settings.dashboard-delete-button",children:"Delete dashboard"})}),P&&(0,t.jsx)(p,{dashboardTitle:y.state.title,onConfirm:b,onClose:d})]})}function p({dashboardTitle:y,onConfirm:P,onClose:d}){return(0,t.jsx)(a.u,{isOpen:!0,body:(0,t.jsxs)(t.Fragment,{children:[!1,(0,t.jsx)(l.E,{element:"p",children:(0,t.jsx)(u.x6,{i18nKey:"dashboard-settings.delete-modal-text",children:"Do you want to delete this dashboard?"})}),(0,t.jsx)(l.E,{element:"p",children:y}),(0,t.jsx)(f.$,{v:2})]}),onConfirm:P,onDismiss:d,title:(0,u.t)("dashboard-settings.delete-modal.title","Delete"),icon:"trash-alt",confirmText:(0,u.t)("dashboard-settings.delete-modal.delete-button","Delete"),confirmationText:(0,u.t)("dashboard-settings.delete-modal.confirmation-text","Delete")})}function c({dashboardId:y,onClose:P}){return(0,t.jsxs)(h.a,{isOpen:!0,title:(0,u.t)("dashboard-scene.provisioned-delete-modal.title-cannot-delete-provisioned-dashboard","Cannot delete provisioned dashboard"),icon:"trash-alt",onDismiss:P,children:[(0,t.jsx)("p",{children:"This dashboard is managed by Grafana provisioning and cannot be deleted. Remove the dashboard from the config file to delete it."}),(0,t.jsxs)("p",{children:[(0,t.jsxs)("i",{children:["See"," ",(0,t.jsx)("a",{className:"external-link",href:"https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information about provisioning."]}),(0,t.jsx)("br",{}),"File path: ",y]}),(0,t.jsx)(h.a.ButtonRow,{children:(0,t.jsx)(m.$n,{variant:"primary",onClick:P,children:(0,t.jsx)(u.x6,{i18nKey:"dashboard-scene.provisioned-delete-modal.ok",children:"OK"})})})]})}},39468:(ee,B,e)=>{"use strict";e.d(B,{d:()=>x});var t=e(74848),n=e(37386),r=e(63527),o=e(18857),s=e(10928),m=e(74475),a=e(32635),l=e(45861),f=e(56840),h=e(86871);const u=[{value:"dashboards",label:"Dashboards"},{value:"link",label:"Link"}],i=Object.keys(h.G).map(g=>({label:g,value:g}));function x({link:g,onUpdate:p,onGoBack:c}){const y=E=>{p({...g,tags:E})},P=E=>{const v={...g,type:E.value};v.type==="dashboards"?(v.url="",v.tooltip=""):v.tags=[],p(v)},d=E=>{p({...g,icon:E.value})},D=E=>{const v=E.currentTarget;
198p({...g,[v.name]:v.type==="checkbox"?v.checked:v.value})},b=g.title===h.q.title;return(0,t.jsxs)("div",{style:{maxWidth:"600px"},children:[(0,t.jsx)(n.D,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-title","Title"),children:(0,t.jsx)(r.p,{name:"title",id:"title",value:g.title,onChange:D,autoFocus:b})}),(0,t.jsx)(n.D,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-type","Type"),children:(0,t.jsx)(o.l6,{inputId:"link-type-input",value:g.type,options:u,onChange:P})}),g.type==="dashboards"&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(n.D,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-with-tags","With tags"),children:(0,t.jsx)(s.u,{tags:g.tags,onChange:y})})}),g.type==="link"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.D,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-url","URL"),children:(0,t.jsx)(r.p,{name:"url",value:g.url,onChange:D})}),(0,t.jsx)(n.D,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-tooltip","Tooltip"),children:(0,t.jsx)(r.p,{name:"tooltip",value:g.tooltip,onChange:D,placeholder:(0,f.t)("dashboard-scene.dashboard-link-form.placeholder-open-dashboard","Open dashboard")})}),(0,t.jsx)(n.D,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-icon","Icon"),children:(0,t.jsx)(o.l6,{value:g.icon,options:i,onChange:d})})]}),(0,t.jsxs)(m.M,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-options","Options"),isOpen:!0,children:[g.type==="dashboards"&&(0,t.jsx)(n.D,{children:(0,t.jsx)(a.S,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-show-as-dropdown","Show as dropdown"),name:"asDropdown",value:g.asDropdown,onChange:D})}),(0,t.jsx)(n.D,{children:(0,t.jsx)(a.S,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-include-current-time-range","Include current time range"),name:"keepTime",value:g.keepTime,onChange:D})}),(0,t.jsx)(n.D,{children:(0,t.jsx)(a.S,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-include-current-template-variable-values","Include current template variable values"),name:"includeVars",value:g.includeVars,onChange:D})}),(0,t.jsx)(n.D,{children:(0,t.jsx)(a.S,{label:(0,f.t)("dashboard-scene.dashboard-link-form.label-open-link-in-new-tab","Open link in new tab"),name:"targetBlank",value:g.targetBlank,onChange:D})})]}),(0,t.jsx)(l.$n,{variant:"secondary",onClick:c,children:(0,t.jsx)(f.x6,{i18nKey:"dashboard-scene.dashboard-link-form.back-to-list",children:"Back to list"})})]})}},88898:(ee,B,e)=>{"use strict";e.d(B,{X:()=>x});var t=e(74848),n=e(22803),r=e(63142),o=e(41654),s=e(50201),m=e(45861),a=e(89640),l=e(30703),f=e(37658),h=e(76319),u=e(44458),i=e(56840);function x({links:p,onNew:c,onOrderChange:y,onEdit:P,onDuplicate:d,onDelete:D}){const b=(0,r.of)(g);return p.length===0?(0,t.jsx)(o.B,{direction:"column",children:(0,t.jsx)(s.p,{variant:"call-to-action",button:(0,t.jsx)(m.$n,{onClick:c,size:"lg",children:(0,t.jsx)(i.x6,{i18nKey:"dashboard-links.empty-state.button-title",children:"Add dashboard link"})}),message:(0,i.t)("dashboard-links.empty-state.title","There are no dashboard links added yet"),children:(0,t.jsxs)(i.x6,{i18nKey:"dashboard-links.empty-state.info-box-content",children:["Dashboard links allow you to place links to other dashboards and web sites directly below the dashboard header."," ",(0,t.jsx)(a.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/",children:"Learn more"})]})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("table",{role:"grid",className:"filter-table filter-table--hover",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(i.x6,{i18nKey:"dashboard-scene.dashboard-link-list.type",children:"Type"})}),(0,t.jsx)("th",{children:(0,t.jsx)(i.x6,{i18nKey:"dashboard-scene.dashboard-link-list.info",children:"Info"})}),(0,t.jsx)("th",{colSpan:3})]})}),(0,t.jsx)("tbody",{children:p.map((v,C)=>(0,t.jsxs)("tr",{children:[(0,t.jsxs)("td",{role:"gridcell",className:"pointer",onClick:()=>P(C),children:[(0,t.jsx)(l.I,{name:"external-link-alt"})," \xA0 ",v.type]}),(0,t.jsx)("td",{role:"gridcell",className:"pointer",onClick:()=>P(C),children:(0,t.jsxs)(o.B,{children:[v.title&&(0,t.jsx)("span",{className:b.titleWrapper,children:v.title}),v.type==="link"&&(0,t.jsx)("span",{className:b.urlWrapper,children:v.url}),v.type==="dashboards"&&(0,t.jsx)(f.L,{tags:v.tags??[]})]})}),(0,t.jsx)("td",{style:{width:"1%"},role:"gridcell",children:C!==0&&(0,t.jsx)(h.K,{name:"arrow-up",onClick:()=>y(C,-1),tooltip:(0,i.t)("dashboard-scene.dashboard-link-list.tooltip-move-link-up","Move link up")})}),(0,t.jsx)("td",{style:{width:"1%"},role:"gridcell",children:p.length>1&&C!==p.length-1?(0,t.jsx)(h.K,{name:"arrow-down",onClick:()=>y(C,1),tooltip:(0,i.t)("dashboard-scene.dashboard-link-list.tooltip-move-link-down","Move link down")}):null}),(0,t.jsx)("td",{style:{width:"1%"},role:"gridcell",children:(0,t.jsx)(h.K,{name:"copy",onClick:()=>d(v),tooltip:(0,i.t)("dashboard-scene.dashboard-link-list.tooltip-copy-link","Copy link")})}),(0,t.jsx)("td",{style:{width:"1%"},role:"gridcell",children:(0,t.jsx)(u.e,{"aria-label":(0,i.t)("dashboard-scene.dashboard-link-list.delete-aria-label",'Delete link with title "{{title}}"',{title:v.title}),size:"sm",onConfirm:()=>D(C)})})]},`${v.title}-${C}`))})]}),(0,t.jsx)(m.$n,{className:b.newLinkButton,icon:"plus",onClick:c,children:(0,t.jsx)(i.x6,{i18nKey:"dashboard-scene.dashboard-link-list.new-link",children:"New link"})})]})}const g=p=>({titleWrapper:(0,n.css)({width:"20vw",textOverflow:"ellipsis",overflow:"hidden"}),urlWrapper:(0,n.css)({width:"40vw",textOverflow:"ellipsis",overflow:"hidden"}),newLinkButton:(0,n.css)({marginTop:p.spacing(3)})})},86871:(ee,B,e)=>{"use strict";e.d(B,{G:()=>n,q:()=>t});const t={icon:"external link",title:"New link",tooltip:"",type:"dashboards",url:"",asDropdown:!1,tags:[],targetBlank:!1,keepTime:!1,includeVars:!1},n={"external link":"external-link-alt",dashboard:"apps",question:"question-circle",info:"info-circle",bolt:"bolt",doc:"file-alt",cloud:"cloud"}},99584:(ee,B,e)=>{"use strict";e.d(B,{Q:()=>x});var t=e(74848),n=e(96540),r=e(68125),o=e(85629),s=e(37386),m=e(34999),a=e(21285),l=e(50992),f=e(56840),h=e(76792),u=e(69076),i=e(32442);function x({datasource:g,infoText:p,allowCustomValue:c,onDataSourceChange:y,onDefaultKeysChange:P,onAllowCustomValueChange:d,defaultKeys:D}){const b=(0,n.useCallback)(E=>{const v=(0,r.Jh)(`key,value 199`+E)[0],C=[];for(let S=0;S<v.length;S++)C.push({text:v.fields[0].values[S],value:v.fields[1].values[S]});P?.(C)},[P]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.Y,{children:(0,t.jsx)(f.x6,{i18nKey:"dashboard-scene.ad-hoc-variable-form.adhoc-options",children:"Ad-hoc options"})}),(0,t.jsx)(s.D,{label:(0,f.t)("dashboard-scene.ad-hoc-variable-form.label-data-source","Data source"),htmlFor:"data-source-picker",children:(0,t.jsx)(h.s,{current:g,onChange:y,width:30,variables:!0,noDefault:!0})}),p?(0,t.jsx)(m.F,{title:p,severity:"info","data-testid":o.Tp.pages.Dashboard.Settings.V
199ariables.Edit.AdHocFiltersVariable.infoText}):null,P&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.D,{label:(0,f.t)("dashboard-scene.ad-hoc-variable-form.label-use-static-key-dimensions","Use static key dimensions"),description:(0,f.t)("dashboard-scene.ad-hoc-variable-form.description-provide-dimensions-as-csv-dimension-name-dimension-id","Provide dimensions as CSV: {{name}}, {{value}}",{name:"dimensionName",value:"dimensionId"}),children:(0,t.jsx)(a.d,{"data-testid":o.Tp.pages.Dashboard.Settings.Variables.Edit.AdHocFiltersVariable.modeToggle,value:D!==void 0,onChange:E=>{P(D===void 0?[]:void 0)}})}),D!==void 0&&(0,t.jsx)(l.B,{height:300,language:"csv",value:D.map(E=>`${E.text},${E.value}`).join(` 200`),onBlur:b,onSave:b,showMiniMap:!1,showLineNumbers:!0})]}),d&&(0,t.jsx)(u.c,{value:c??!0,name:"Allow custom values",description:(0,f.t)("dashboard-scene.ad-hoc-variable-form.description-enables-users-custom-values","Enables users to add custom values to the list"),onChange:d,testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsAllowCustomValueSwitch})]})}},23675:(ee,B,e)=>{"use strict";e.d(B,{d:()=>m});var t=e(74848),n=e(85629),r=e(56840),o=e(32442),s=e(49602);function m({onChange:a,constantValue:l}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Y,{children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.constant-variable-form.constant-options",children:"Constant options"})}),(0,t.jsx)(s._,{defaultValue:l,name:"Value",placeholder:(0,r.t)("dashboard-scene.constant-variable-form.placeholder-your-metric-prefix","Your metric prefix"),onBlur:a,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.ConstantVariable.constantOptionsQueryInputV2,width:30})]})}},70430:(ee,B,e)=>{"use strict";e.d(B,{w:()=>a});var t=e(74848),n=e(85629),r=e(56840),o=e(32442),s=e(25379),m=e(52847);function a({query:l,multi:f,allValue:h,includeAll:u,allowCustomValue:i,onQueryChange:x,onMultiChange:g,onIncludeAllChange:p,onAllValueChange:c,onAllowCustomValueChange:y}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Y,{children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.custom-variable-form.custom-options",children:"Custom options"})}),(0,t.jsx)(s.Z,{name:"Values separated by comma",defaultValue:l,placeholder:"1, 10, mykey : myvalue, myvalue, escaped\\,value",onBlur:x,required:!0,width:52,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.CustomVariable.customValueInput}),(0,t.jsx)(o.Y,{children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.custom-variable-form.selection-options",children:"Selection options"})}),(0,t.jsx)(m.B,{multi:f,includeAll:u,allValue:h,allowCustomValue:i,onMultiChange:g,onIncludeAllChange:p,onAllValueChange:c,onAllowCustomValueChange:y})]})}},42272:(ee,B,e)=>{"use strict";e.d(B,{y:()=>l});var t=e(74848),n=e(85629),r=e(56840),o=e(52847),s=e(32442),m=e(68577),a=e(49602);function l({query:f,regex:h,optionTypes:u,allowCustomValue:i,onChange:x,onRegExBlur:g,multi:p,includeAll:c,allValue:y,onMultiChange:P,onIncludeAllChange:d,onAllValueChange:D,onAllowCustomValueChange:b}){const E=u.find(v=>v.value===f)??u[0];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.Y,{children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.data-source-variable-form.data-source-options",children:"Data source options"})}),(0,t.jsx)(m.v,{name:"Type",value:E,options:u,onChange:x,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.DatasourceVariable.datasourceSelect}),(0,t.jsx)(a._,{defaultValue:h,name:"Instance name filter",placeholder:"/.*-(.*)-.*/",onBlur:g,description:(0,t.jsxs)("div",{children:["Regex filter for which data source instances to choose from in the variable value list. Leave empty for all.",(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),"Example: ",(0,t.jsx)("code",{children:"/^prod/"})]})}),(0,t.jsx)(s.Y,{children:(0,t.jsx)(r.x6,{i18nKey:"dashboard-scene.data-source-variable-form.selection-options",children:"Selection options"})}),(0,t.jsx)(o.B,{multi:p,includeAll:c,allValue:y,allowCustomValue:i,onMultiChange:P,onIncludeAllChange:d,onAllValueChange:D,onAllowCustomValueChange:b})]})}},1096:(ee,B,e)=>{"use strict";e.d(B,{s:()=>h});var t=e(74848),n=e(22803),r=e(85629),o=e(63142),s=e(56840),m=e(69076),a=e(32442),l=e(68577),f=e(49602);function h({intervals:i,onIntervalsChange:x,onAutoEnabledChange:g,onAutoMinIntervalChanged:p,onAutoCountChanged:c,autoEnabled:y,autoMinInterval:P,autoStepCount:d}){const D=[1,2,3,4,5,10,20,30,40,50,100,200,300,400,500].map(v=>({label:`${v}`,value:v})),b=(0,o.of)(u),E=D.find(v=>v.value===d)??D[0];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.Y,{children:(0,t.jsx)(s.x6,{i18nKey:"dashboard-scene.interval-variable-form.
200interval-options",children:"Interval options"})}),(0,t.jsx)(f._,{defaultValue:i,name:"Values",placeholder:"1m,10m,1h,6h,1d,7d",onBlur:x,testId:r.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.intervalsValueInput,width:32,required:!0}),(0,t.jsx)(m.c,{value:y,name:"Auto option",description:(0,s.t)("dashbaord-scene.interval-variable-form.description-auto-option","Dynamically calculates interval by dividing time range by the count specified"),onChange:g,testId:r.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.autoEnabledCheckbox}),y&&(0,t.jsxs)("div",{className:b.autoFields,children:[(0,t.jsx)(l.v,{name:"Step count",description:(0,s.t)("dashboard-scene.interval-variable-form.description-step-count","How many times the current time range should be divided to calculate the value"),value:E,options:D,onChange:c,width:9,testId:r.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.stepCountIntervalSelect}),(0,t.jsx)(f._,{value:P,name:"Min interval",description:(0,s.t)("dashboard-scene.interval-variable-form.description-calculated-value-below-threshold","The calculated value will not go below this threshold"),placeholder:"10s",onChange:p,width:11,testId:r.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.minIntervalInput})]})]})}const u=i=>({autoFields:(0,n.css)({marginTop:i.spacing(2),display:"flex",flexDirection:"column"})})},6841:(ee,B,e)=>{"use strict";e.d(B,{u:()=>I});var t=e(74848),n=e(16817),r=e(85629),o=e(78282),s=e(37386),m=e(56840),a=e(28105),l=e(2863),f=e(31286),h=e(66404),u=e(67933);function i({query:R,datasource:T,VariableQueryEditor:L,onLegacyQueryChange:K,onQueryChange:A,timeRange:W}){let N;return typeof R=="string"?N=R||(T.variables?.getDefaultQuery?.()??""):N={...T.variables?.getDefaultQuery?.(),...R},L&&(0,u.VN)(L,T)?(0,t.jsxs)(f.a,{marginBottom:2,children:[(0,t.jsx)(h.E,{element:"h4",children:(0,t.jsx)(m.x6,{i18nKey:"dashboard-scene.query-editor.query",children:"Query"})}),(0,t.jsx)(f.a,{marginTop:1,children:(0,t.jsx)(L,{datasource:T,query:N,templateSrv:(0,l.w)(),onChange:K},T.uid)})]}):L&&(0,u.CH)(L,T)?(0,t.jsxs)(f.a,{marginBottom:2,children:[(0,t.jsx)(h.E,{element:"h4",children:(0,t.jsx)(m.x6,{i18nKey:"dashboard-scene.query-editor.query",children:"Query"})}),(0,t.jsx)(f.a,{marginTop:1,children:(0,t.jsx)(L,{datasource:T,query:N,onChange:A,onRunQuery:()=>{},data:{series:[],state:a.Gu.Done,timeRange:W},range:W,onBlur:()=>{},history:[]},T.uid)})]}):null}var x=e(52847),g=e(76792),p=e(38681),c=e(96540),y=e(7389),P=e(77824),d=e(51702);const D=[{label:"On dashboard load",value:y.CO.onDashboardLoad},{label:"On time range change",value:y.CO.onTimeRangeChanged}];function b({onChange:R,refresh:T,testId:L}){const K=!(0,d.i)("sm"),A=(0,c.useMemo)(()=>D.find(W=>W.value===T)?.value??D[0].value,[T]);return(0,t.jsx)(s.D,{label:(0,m.t)("variables.query-variable-refresh-select.label-refresh","Refresh"),description:(0,m.t)("variables.query-variable-refresh-select.description-update-values-variable","When to update the values of this variable"),"data-testid":L,children:(0,t.jsx)(P.z,{options:D,onChange:R,value:A,size:K?"sm":"md"})})}var E=e(68577);const v=[{label:"Disabled",value:y.ZG.disabled},{label:"Alphabetical (asc)",value:y.ZG.alphabeticalAsc},{label:"Alphabetical (desc)",value:y.ZG.alphabeticalDesc},{label:"Numerical (asc)",value:y.ZG.numericalAsc},{label:"Numerical (desc)",value:y.ZG.numericalDesc},{label:"Alphabetical (case-insensitive, asc)",value:y.ZG.alphabeticalCaseInsensitiveAsc},{label:"Alphabetical (case-insensitive, desc)",value:y.ZG.alphabeticalCaseInsensitiveDesc},{label:"Natural (asc)",value:y.ZG.naturalAsc},{label:"Natural (desc)",value:y.ZG.naturalDesc}];function C({onChange:R,sort:T,testId:L}){const K=(0,c.useMemo)(()=>v.find(A=>A.value===T)??v[0],[T]);return(0,t.jsx)(E.v,{name:"Sort",description:(0,m.t)("variables.query-variable-sort-select.description-values-variable","How to sort the values of this variable"),value:K,options:v,onChange:R,testId:L,width:25})}var S=e(32442),O=e(25379);function I({datasource:R,onDataSourceChange:T,query:L,onQueryChange:K,onLegacyQueryChange:A,timeRange:W,regex:N,onRegExChange:w,sort:j,onSortChange:V,refresh:U,onRefreshChange:F,isMulti:M,onMultiChange:H,allowCustomValue:_,onAllowCustomValueChange:Z,includeAll:ne,onIncludeAllChange:te,allValue:Y,onAllValueChange:Q}){const{value:J}=(0,n.A)(async()=>{const se=await(0,o.l)().get(R??""),oe=await(0,p.y)(se),ae=se?.variables?.getDefaultQuery?.();if(!L&&ae){const ie=typeof ae=="string"?ae:{...ae,refId:ae.refId??"A"};K(ie)}return{datasource:se,VariableQueryEditor:oe}},[R]),{datasource:q,VariableQueryEditor:X}=J??{};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S.Y,{children:(0,t.jsx)(m.x6,{i18nKey:"dashboard-scene.query-variable-editor-form.query-options",children:"Query options"})}),(0,t.jsx)(s.D,{label:(0,m.t)("dashboard-scene.query-variable-editor-form.label-data-source","Data source"),htmlFor:"data-source-picker",children:(0,t.jsx)(g.s,{current:R,onChange:T,variables:!0,width:30})}),q&&X&&(0,t.jsx)(i,{onQueryChange:K,onLegacyQueryChange:A,datasource:q,query:L,VariableQueryEditor:X,timeRange:W}),(0,t.jsx)(O.Z,{defaultValue:N??"",name:"Regex",description:(0,t.jsxs)("div",{children:["Optional, if you want to extract part of a series n
200ame or metric node segment.",(0,t.jsx)("br",{}),"Named capture groups can be used to separate the display text and value (",(0,t.jsx)("a",{className:"external-link",href:"https://grafana.com/docs/grafana/latest/variables/filter-variables-with-regex#filter-and-modify-using-named-text-and-value-capture-groups",target:"__blank",children:"see examples"}),")."]}),placeholder:"/.*-(?<text>.*)-(?<value>.*)-.*/",onBlur:w,testId:r.Tp.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2,width:52}),(0,t.jsx)(C,{testId:r.Tp.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsSortSelectV2,onChange:V,sort:j}),(0,t.jsx)(b,{testId:r.Tp.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRefreshSelectV2,onChange:F,refresh:U}),(0,t.jsx)(S.Y,{children:(0,t.jsx)(m.x6,{i18nKey:"dashboard-scene.query-variable-editor-form.selection-options",children:"Selection options"})}),(0,t.jsx)(x.B,{multi:!!M,includeAll:!!ne,allowCustomValue:_,allValue:Y,onMultiChange:H,onIncludeAllChange:te,onAllValueChange:Q,onAllowCustomValueChange:Z})]})}},52847:(ee,B,e)=>{"use strict";e.d(B,{B:()=>a});var t=e(74848),n=e(85629),r=e(41654),o=e(56840),s=e(69076),m=e(49602);function a({multi:l,allowCustomValue:f,includeAll:h,allValue:u,onMultiChange:i,onAllowCustomValueChange:x,onIncludeAllChange:g,onAllValueChange:p}){return(0,t.jsxs)(r.B,{direction:"column",gap:2,height:"inherit",alignItems:"start",children:[(0,t.jsx)(s.c,{value:l,name:"Multi-value",description:(0,o.t)("dashboard-scene.selection-options-form.description-enables-multiple-values-selected","Enables multiple values to be selected at the same time"),onChange:i,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsMultiSwitch}),x&&(0,t.jsx)(s.c,{value:f??!0,name:"Allow custom values",description:(0,o.t)("dashboard-scene.selection-options-form.description-enables-users-custom-values","Enables users to add custom values to the list"),onChange:x,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsAllowCustomValueSwitch}),(0,t.jsx)(s.c,{value:h,name:"Include All option",description:(0,o.t)("dashboard-scene.selection-options-form.description-enables-option-include-variables","Enables an option to include all variables"),onChange:g,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsIncludeAllSwitch}),h&&(0,t.jsx)(m._,{defaultValue:u??"",onBlur:p,name:"Custom all value",testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsCustomAllInput})]})}},69076:(ee,B,e)=>{"use strict";e.d(B,{c:()=>o});var t=e(74848),n=e(92145),r=e(32635);function o({value:s,name:m,description:a,onChange:l,ariaLabel:f,testId:h}){const u=(0,n.Bi)();return(0,t.jsx)(r.S,{id:u,label:m,description:a,value:s,onChange:l,"aria-label":f,"data-testid":h})}},29:(ee,B,e)=>{"use strict";e.d(B,{D:()=>l});var t=e(74848),n=e(96540),r=e(7389),o=e(37386),s=e(77824),m=e(56840);const a=[{label:"Nothing",value:r.zL.dontHide},{label:"Variable",value:r.zL.hideVariable},{label:"Label",value:r.zL.hideLabel}];function l({onChange:f,hide:h,type:u}){const i=(0,n.useMemo)(()=>a.find(x=>x.value===h)?.value??a[0].value,[h]);return u==="constant"?null:(0,t.jsx)(o.D,{label:(0,m.t)("dashboard-scene.variable-hide-select.label","Hide"),children:(0,t.jsx)(s.z,{options:a,onChange:f,value:i})})}},32442:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(53487);function s({className:a,...l}){const f=(0,r.of)(m);return(0,t.jsx)(o.s,{...l,className:(0,n.cx)(f.legend,a)})}function m(a){return{legend:(0,n.css)({marginTop:a.spacing(3),marginBottom:a.spacing(1)})}}},68577:(ee,B,e)=>{"use strict";e.d(B,{v:()=>a});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(37386),m=e(18857);function a({name:f,description:h,value:u,options:i,onChange:x,testId:g,width:p}){const c=(0,o.of)(l),y=(0,r.useId)(),P=`variable-select-input-${f}-${y}`;return(0,t.jsx)(s.D,{label:f,description:h,htmlFor:P,children:(0,t.jsx)(m.l6,{"data-testid":g,inputId:P,onChange:x,value:u,width:p??30,options:i,className:c.selectContainer})})}function l(f){return{selectContainer:(0,n.css)({marginRight:f.spacing(.5)})}}},25379:(ee,B,e)=>{"use strict";e.d(B,{$:()=>l,Z:()=>a});var t=e(74848),n=e(22803),r=e(92145),o=e(63142),s=e(37386),m=e(87105);function a({value:f,defaultValue:h,name:u,description:i,placeholder:x,onChange:g,onBlur:p,ariaLabel:c,required:y,width:P,testId:d}){const D=(0,o.of)(l),b=(0,r.Bi)();return(0,t.jsx)(s.D,{label:u,description:i,htmlFor:b,children:(0,t.jsx)(m.f,{id:b,rows:2,value:f,defaultValue:h,onChange:g,onBlur:p,placeholder:x,required:y,"aria-label":c,cols:P,className:D.textarea,"data-testid":d})})}function l(f){return{textarea:(0,n.css)({whiteSpace:"pre-wrap",minHeight:f.spacing(4),height:"auto",overflow:"auto",padding:`${f.spacing(.75)} ${f.spacing(1)}`,width:"inherit",[f.breakpoints.down("sm")]:{width:"100%"}})}}},49602:(ee,B,e)=>{"use strict";e.d(B,{_:()=>s});var t=e(74848),n=e(92145),r=e(37386),o=e(63527);function s({value:m,defaultValue:a,name:l,placeholder:f="",onChange:h,testId:u,width:i,required:x,onBlur:g,grow:p,description:c,invalid:y,error:P,maxLength:d}){const D=(0,n.Bi)(l);return(0,t.jsx)(r.D,{label:l,description:c,invalid:y,error:P,htmlFor:D,children:(0,t.jsx)(o.p,{type:"text",id:D,placeholder:f,value:m,defaultValue:a,onChange:h,onBlur:g,width:p?void 0:i??30,"data-testid":u,maxLength:d,required:x})})}},18387:(ee,B,e)=>{"use strict";e.d(B,{j:()=>h});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(63142),m=e(97095),a=e(79233),l=e(45861),f=e(56840);const h=({options:i})=>{const[x,g]=(0,r.useState)(20),[p,c]=(0,r.useState)([]),y=(0,r.useCallback)(d=>{d.preventDefault(),g(x+20)},[x,g]),P=(0,s.of)(u);return(0,r.useEffect)(()=>c(i.slice(0,x)),[x,i]),p.length?(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",marginTop:"16px"},children:[(0,t.jsx)("h5",{children:(0,t.jsx)(f.x6,{i18nKey:"dashboard-scene.variable-values-preview.preview-of-values",children:"Preview of values"})}),(0,t.jsx)(m.C,{children:p.map((d,D)=>(0,t.jsx)(m.C,{className:P.optionContainer,children:(0,t.jsx)(a.c,{"data-testid":o.Tp.pages.Dashboard.Settings.V
200ariables.Edit.General.previewOfValuesOption,children:(0,t.jsx)("div",{className:P.label,children:d.label})})},`${d.value}-${D}`))}),i.length>x&&(0,t.jsx)(m.C,{className:P.optionContainer,children:(0,t.jsx)(l.$n,{onClick:y,variant:"secondary",size:"sm",children:(0,t.jsx)(f.x6,{i18nKey:"dashboard-scene.variable-values-preview.show-more",children:"Show more"})})})]}):null};h.displayName="VariableValuesPreview";function u(i){return{wrapper:(0,n.css)({display:"flex",flexDirection:"column",marginTop:i.spacing(2)}),optionContainer:(0,n.css)({marginLeft:i.spacing(.5),marginBottom:i.spacing(.5)}),label:(0,n.css)({whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"50vw"})}}},44741:(ee,B,e)=>{"use strict";e.d(B,{cH:()=>se,mJ:()=>oe,Ao:()=>Q,e4:()=>J,kh:()=>ne,CD:()=>_,No:()=>Z,B$:()=>H,n_:()=>Y,bZ:()=>U,VD:()=>q,c7:()=>X,c$:()=>ae});var t=e(2543),n=e(43173),r=e(78282),o=e(56838),s=e(59857),m=e(8285),a=e(74848),l=e(16817),f=e(48480),h=e(99584);function u(ie){const{variable:fe}=ie,{datasource:pe,defaultKeys:de,allowCustomValue:le}=fe.useState(),{value:me}=(0,l.A)(async()=>await(0,r.l)().get(pe),[pe]),De=me?.getTagKeys?"Ad hoc filters are applied automatically to all queries that target this data source":"This data source does not support ad hoc filters yet.",Te=He=>{const ke=(0,f.p$)(He);fe.setState({datasource:ke,supportsMultiValueOperators:He.meta.multiValueFilterOperators})},Ne=He=>{fe.setState({defaultKeys:He})},Ce=He=>{fe.setState({allowCustomValue:He.currentTarget.checked})};return(0,a.jsx)(h.Q,{datasource:pe??void 0,infoText:De,allowCustomValue:le,onDataSourceChange:Te,defaultKeys:de,onDefaultKeysChange:Ne,onAllowCustomValueChange:Ce})}var i=e(23675);function x({variable:ie}){const{value:fe}=ie.useState(),pe=de=>{ie.setState({value:de.currentTarget.value})};return(0,a.jsx)(i.d,{constantValue:String(fe),onChange:pe})}var g=e(70430);function p({variable:ie,onRunQuery:fe}){const{query:pe,isMulti:de,allValue:le,includeAll:me,allowCustomValue:De}=ie.useState(),Te=Me=>{ie.setState({isMulti:Me.currentTarget.checked})},Ne=Me=>{ie.setState({includeAll:Me.currentTarget.checked})},Ce=Me=>{ie.setState({query:Me.currentTarget.value}),fe()},He=Me=>{ie.setState({allValue:Me.currentTarget.value})},ke=Me=>{ie.setState({allowCustomValue:Me.currentTarget.checked})};return(0,a.jsx)(g.w,{query:pe??"",multi:!!de,allValue:le??"",includeAll:!!me,allowCustomValue:De,onMultiChange:Te,onIncludeAllChange:Ne,onQueryChange:Ce,onAllValueChange:He,onAllowCustomValueChange:ke})}var c=e(42272);function y({variable:ie,onRunQuery:fe}){const{pluginId:pe,regex:de,isMulti:le,allValue:me,includeAll:De,allowCustomValue:Te}=ie.useState(),Ne=J(),Ce=Ke=>{ie.setState({pluginId:Ke.value}),fe()},He=Ke=>{ie.setState({regex:Ke.currentTarget.value}),fe()},ke=Ke=>{ie.setState({isMulti:Ke.currentTarget.checked})},Me=Ke=>{ie.setState({includeAll:Ke.currentTarget.checked})},$e=Ke=>{ie.setState({allValue:Ke.currentTarget.value})},tt=Ke=>{ie.setState({allowCustomValue:Ke.currentTarget.checked})};return(0,a.jsx)(c.y,{query:pe,regex:de,multi:le||!1,allValue:me,includeAll:De||!1,optionTypes:Ne,allowCustomValue:Te,onChange:Ce,onRegExBlur:He,onMultiChange:ke,onIncludeAllChange:Me,onAllValueChange:$e,onAllowCustomValueChange:tt})}var P=e(96540),d=e(68125),D=e(85629),b=e(37386),E=e(34999),v=e(21285),C=e(50992),S=e(56840),O=e(76792),I=e(69076),R=e(32442);function T({datasource:ie,defaultOptions:fe,infoText:pe,onDataSourceChange:de,onDefaultOptionsChange:le,allowCustomValue:me,onAllowCustomValueChange:De}){const Te=(0,P.useCallback)(Ne=>{const Ce=(0,d.Jh)(`key,value 201`+Ne)[0],He=[];for(let ke=0;ke<Ce.length;ke++)He.push({text:Ce.fields[0].values[ke],value:Ce.fields[1].values[ke]});le(He)},[le]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R.Y,{children:(0,a.jsx)(S.x6,{i18nKey:"dashboard-scene.group-by-variable-form.group-by-options",children:"Group by options"})}),(0,a.jsx)(b.D,{label:(0,S.t)("dashboard-scene.group-by-variable-form.label-data-source","Data source"),htmlFor:"data-source-picker",children:(0,a.jsx)(O.s,{current:ie,onChange:de,width:30,variables:!0,noDefault:!0})}),pe?(0,a.jsx)(E.F,{title:pe,severity:"info","data-testid":D.Tp.pages.Dashboard.Settings.V
201ariables.Edit.GroupByVariable.infoText}):null,(0,a.jsx)(b.D,{label:(0,S.t)("dashboard-scene.group-by-variable-form.label-use-static-group-by-dimensions","Use static group dimensions"),description:(0,S.t)("dashboard-scene.group-by-variable-form.description-provide-dimensions-as-csv-dimension-name-dimension-id","Provide dimensions as CSV: {{name}}, {{value}}",{name:"dimensionName",value:"dimensionId"}),children:(0,a.jsx)(v.d,{"data-testid":D.Tp.pages.Dashboard.Settings.Variables.Edit.GroupByVariable.modeToggle,value:fe!==void 0,onChange:Ne=>{le(fe===void 0?[]:void 0)}})}),fe!==void 0&&(0,a.jsx)(C.B,{height:300,language:"csv",value:fe.map(Ne=>`${Ne.text},${Ne.value}`).join(` 202`),onBlur:Te,onSave:Te,showMiniMap:!1,showLineNumbers:!0}),(0,a.jsx)(I.c,{value:me,name:"Allow custom values",description:(0,S.t)("dashboard-scene.group-by-variable-form.description-enables-users-custom-values","Enables users to add custom values to the list"),onChange:De,testId:D.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsAllowCustomValueSwitch})]})}function L(ie){const{variable:fe,onRunQuery:pe}=ie,{datasource:de,defaultOptions:le,allowCustomValue:me=!0}=fe.useState(),{value:De}=(0,l.A)(async()=>await(0,r.l)().get(de),[fe.state]),Te=De?.getTagKeys?"Group by dimensions are applied automatically to all queries that target this data source":"This data source does not support group by variable yet.",Ne=async ke=>{const Me=(0,f.p$)(ke);fe.setState({datasource:Me}),pe()},Ce=async ke=>{fe.setState({defaultOptions:ke}),pe()},He=ke=>{fe.setState({allowCustomValue:ke.currentTarget.checked})};return(0,a.jsx)(T,{defaultOptions:le,datasource:de??void 0,infoText:de?Te:void 0,onDataSourceChange:Ne,onDefaultOptionsChange:Ce,allowCustomValue:me,onAllowCustomValueChange:He})}var K=e(1096);function A({variable:ie,onRunQuery:fe}){const{intervals:pe,autoStepCount:de,autoEnabled:le,autoMinInterval:me,value:De}=ie.useState(),Te=(0,m.bx)(pe),Ne=Me=>{const $e=(0,m.Sm)(Me.currentTarget.value),tt=$e.includes(De)?De:$e[0];ie.setState({intervals:$e,value:tt}),fe()},Ce=Me=>{ie.setState({autoStepCount:Me.value})},He=Me=>{ie.setState({autoEnabled:Me.target.checked})},ke=Me=>{ie.setState({autoMinInterval:Me.currentTarget.value})};return(0,a.jsx)(K.s,{intervals:Te,autoStepCount:de,autoEnabled:le,onAutoCountChanged:Ce,onIntervalsChange:Ne,onAutoEnabledChange:He,onAutoMinIntervalChanged:ke,autoMinInterval:me})}var W=e(6841);function N({variable:ie,onRunQuery:fe}){const{datasource:pe,regex:de,sort:le,refresh:me,isMulti:De,includeAll:Te,allValue:Ne,query:Ce,allowCustomValue:He}=ie.useState(),{value:ke}=o.jh.getTimeRange(ie).useState(),Me=Ye=>{ie.setState({regex:Ye.currentTarget.value})},$e=Ye=>{ie.setState({sort:Ye.value})},tt=Ye=>{ie.setState({refresh:Ye})},Ke=Ye=>{ie.setState({isMulti:Ye.currentTarget.checked})},Re=Ye=>{ie.setState({includeAll:Ye.currentTarget.checked})},Ve=Ye=>{ie.setState({allValue:Ye.currentTarget.value})},Qe=Ye=>{ie.setState({allowCustomValue:Ye.currentTarget.checked})},je=Ye=>{const Ge=(0,f.p$)(Ye);if((ie.state.datasource?.type||"")!==Ge.type){ie.setState({datasource:Ge,query:"",definition:""});return}ie.setState({datasource:Ge})},ze=Ye=>{let Ge;typeof Ye=="string"?Ge=Ye:Ye.hasOwnProperty("query")&&typeof Ye.query=="string"?Ge=Ye.query:Ge="",ie.setState({query:Ye,definition:Ge}),fe()};return(0,a.jsx)(W.u,{datasource:pe??void 0,onDataSourceChange:je,query:Ce,onQueryChange:ze,onLegacyQueryChange:ze,timeRange:ke,regex:de,onRegExChange:Me,sort:le,onSortChange:$e,refresh:me,onRefreshChange:tt,isMulti:!!De,onMultiChange:Ke,includeAll:!!Te,onIncludeAllChange:Re,allValue:Ne??"",onAllValueChange:Ve,allowCustomValue:He,onAllowCustomValueChange:Qe})}var w=e(49602);function j({defaultValue:ie,value:fe,onChange:pe,onBlur:de}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R.Y,{children:(0,a.jsx)(S.x6,{i18nKey:"dashboard-scene.text-box-variable-form.text-options",children:"Text options"})}),(0,a.jsx)(w._,{value:fe,defaultValue:ie,name:"Default value",placeholder:(0,S.t)("dashboard-scene.text-box-variable-form.placeholder-default-value-if-any","(optional)"),onChange:pe,onBlur:de,width:30,testId:D.Tp.pages.Dashboard.Settings.V
202ariables.Edit.TextBoxVariable.textBoxOptionsQueryInputV2})]})}function V({variable:ie}){const{value:fe}=ie.useState(),pe=de=>{ie.setState({value:de.currentTarget.value})};return(0,a.jsx)(j,{defaultValue:fe,onBlur:pe})}function U(ie){return ie!=="system"}const F={custom:{name:"Custom",description:"Define variable values manually",editor:p},query:{name:"Query",description:"Variable values are fetched from a datasource query",editor:N},constant:{name:"Constant",description:"Define a hidden constant variable, useful for metric prefixes in dashboards you want to share",editor:x},interval:{name:"Interval",description:"Define a timespan interval (ex 1m, 1h, 1d)",editor:A},datasource:{name:"Data source",description:"Enables you to dynamically switch the data source for multiple panels",editor:y},adhoc:{name:"Ad hoc filters",description:"Add key/value filters on the fly",editor:u},groupby:{name:"Group by",description:"Add keys to group by on the fly",editor:L},textbox:{name:"Textbox",description:"Define a textbox variable, where users can enter any arbitrary string",editor:V}},M=["query","custom","textbox","constant","datasource","interval","adhoc","groupby"];function H(){const ie=M.map(fe=>({label:F[fe].name,value:fe,description:F[fe].description}));return n.$.featureToggles.groupByVariable?ie:ie.filter(fe=>fe.value!=="groupby")}function _(ie){return F[ie].editor}function Z(ie,fe){switch(ie){case"custom":return new o.yP(fe);case"query":return new o.fS(fe);case"constant":return new o.x0({...fe,hide:s.zL.hideVariable});case"interval":return new o.Yj(fe);case"datasource":return new o.mI(fe);case"adhoc":return new o.H9({...fe,layout:n.$.featureToggles.newFiltersUI?"combobox":void 0});case"groupby":return new o.ZG(fe);case"textbox":return new o.TS(fe)}}function ne(ie){const pe=te("query",ie);return new o.fS({name:pe})}function te(ie,fe){let pe=0,de=`${ie}${pe}`;for(;fe.find(le=>le.state.name===de);)de=`${ie}${++pe}`;return de}function Y(ie){return"options"in ie.state||"intervals"in ie.state}function Q(ie){let fe="";return ie instanceof o.fS?fe=ie.state.definition||(typeof ie.state.query=="string"?ie.state.query:""):ie instanceof o.mI?fe=String(ie.state.pluginId):ie instanceof o.yP?fe=ie.state.query:ie instanceof o.Yj?fe=(0,m.bx)(ie.state.intervals):(ie instanceof o.TS||ie instanceof o.x0)&&(fe=String(ie.state.value)),fe}function J(){const ie=(0,r.l)().getList({metrics:!0,variables:!0}),fe=(0,t.chain)(ie).uniqBy("meta.id").map(pe=>({label:pe.meta.name,value:pe.meta.id})).value();return fe.unshift({label:"",value:""}),fe}function q(ie){return"type"in ie.state&&"getValue"in ie}function X(ie){return q(ie)?o.Go.isAdHocVariable(ie)||o.Go.isConstantVariable(ie)||o.Go.isCustomVariable(ie)||o.Go.isDataSourceVariable(ie)||o.Go.isIntervalVariable(ie)||o.Go.isQueryVariable(ie)||o.Go.isTextBoxVariable(ie)||o.Go.isGroupByVariable(ie):!1}const se=/^(?!__).*$/,oe=/^\w+$/;function ae(ie,fe){const pe=ie.parent;if(!(pe instanceof o.Pj))throw new Error("Variable parent is not a SceneVariableSet");if(!se.test(fe))return{isValid:!1,errorMessage:"Template names cannot begin with '__', that's reserved for Grafana's global variables"};if(!oe.test(fe))return{isValid:!1,errorMessage:"Only word characters are allowed in variable names"};const de=pe.getByName(fe);return de&&de!==ie?{isValid:!1,errorMessage:"Variable with the same name already exists"}:{isValid:!0}}},34753:(ee,B,e)=>{"use strict";e.d(B,{D:()=>i});var t=e(74848),n=e(22803),r=e(2543),o=e(63142),s=e(30703);const m=({diff:g})=>{const p=(0,o.of)(a),c=!(0,r.isUndefined)(g.originalValue)&&!(0,r.isArray)(g.originalValue)&&!(0,r.isObject)(g.originalValue),y=!(0,r.isUndefined)(g.value)&&!(0,r.isArray)(g.value)&&!(0,r.isObject)(g.value);return(0,t.jsxs)(t.Fragment,{children:[c&&(0,t.jsx)("span",{className:p,children:String(g.originalValue)}),c&&y?(0,t.jsx)(s.I,{name:"arrow-right"}):null,y&&(0,t.jsx)("span",{className:p,children:String(g.value)})]})},a=g=>(0,n.css)({backgroundColor:g.colors.action.hover,borderRadius:g.shape.radius.default,color:g.colors.text.primary,fontSize:g.typography.body.fontSize,margin:g.spacing(0,.5),padding:g.spacing(.25,.5)});var l=e(61371);const f={op:"replace",originalValue:void 0,path:[""],value:void 0,startLineNumber:0,endLineNumber:0}
202,h=({diff:g,title:p})=>{const c=(0,o.of)(u);return g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.I,{type:"mono",name:"circle",className:c[g.op],size:"xs"})," ",(0,t.jsx)("span",{className:c.embolden,children:p})," ",(0,t.jsx)("span",{children:(0,l.Fl)(g,g.path?.length>1)})," ",(0,t.jsx)(m,{diff:g})]}):(0,t.jsxs)("div",{className:c.withoutDiff,children:[(0,t.jsx)(s.I,{type:"mono",name:"circle",className:c.replace,size:"xs"})," ",(0,t.jsx)("span",{className:c.embolden,children:p})," ",(0,t.jsx)("span",{children:(0,l.Fl)(f,!1)})]})},u=g=>({embolden:(0,n.css)({fontWeight:g.typography.fontWeightBold}),add:(0,n.css)({color:g.colors.success.main}),replace:(0,n.css)({color:g.colors.warning.main}),move:(0,n.css)({color:g.colors.warning.main}),copy:(0,n.css)({color:g.colors.success.main}),_get:(0,n.css)({color:g.colors.success.main}),test:(0,n.css)({color:g.colors.success.main}),remove:(0,n.css)({color:g.colors.error.main}),withoutDiff:(0,n.css)({marginBottom:g.spacing(1)})}),i=({diffs:g,title:p})=>{const c=(0,o.of)(x);return g.length===1?(0,t.jsx)("div",{className:c.container,"data-testid":"diffGroup",children:(0,t.jsx)(h,{title:p,diff:g[0]})}):(0,t.jsxs)("div",{className:c.container,"data-testid":"diffGroup",children:[(0,t.jsx)(h,{title:p}),(0,t.jsx)("ul",{className:c.list,children:g.map((y,P)=>(0,t.jsxs)("li",{className:c.listItem,children:[(0,t.jsx)("span",{children:(0,l.Fl)(y)})," ",(0,t.jsx)(m,{diff:y})]},`${(0,r.last)(y.path)}__${P}`))})]})},x=g=>({container:(0,n.css)({}),list:(0,n.css)({marginLeft:g.spacing(4)}),listItem:(0,n.css)({marginBottom:g.spacing(1),"&:last-child":{marginBottom:0}})})},1199:(ee,B,e)=>{"use strict";e.d(B,{M:()=>a});var t=e(74848),n=e(22803),r=e(82514),o=e.n(r),s=e(84140),m=e(63142);const a=({oldValue:l,newValue:f,...h})=>{const u=(0,m.$j)(),i={variables:{dark:{diffViewerBackground:u.colors.background.canvas,diffViewerColor:u.colors.text.primary,addedBackground:(0,s.A)(u.v1.palette.greenShade).setAlpha(.3).toString(),addedColor:"white",removedBackground:(0,s.A)(u.v1.palette.redShade).setAlpha(.3).toString(),removedColor:"white",wordAddedBackground:(0,s.A)(u.v1.palette.greenBase).setAlpha(.4).toString(),wordRemovedBackground:(0,s.A)(u.v1.palette.redBase).setAlpha(.4).toString(),addedGutterBackground:(0,s.A)(u.v1.palette.greenShade).setAlpha(.2).toString(),removedGutterBackground:(0,s.A)(u.v1.palette.redShade).setAlpha(.2).toString(),gutterBackground:u.colors.background.primary,gutterBackgroundDark:u.colors.background.primary,highlightBackgroun
202d:(0,s.A)(u.colors.primary.main).setAlpha(.4).toString(),highlightGutterBackground:(0,s.A)(u.colors.primary.shade).setAlpha(.2).toString(),codeFoldGutterBackground:u.colors.background.secondary,codeFoldBackground:u.colors.background.secondary,emptyLineBackground:u.colors.background.secondary,gutterColor:u.colors.text.disabled,addedGutterColor:u.colors.text.primary,removedGutterColor:u.colors.text.primary,codeFoldContentColor:u.colors.text.disabled,diffViewerTitleBackground:u.colors.background.secondary,diffViewerTitleColor:u.colors.text.disabled,diffViewerTitleBorderColor:u.colors.border.strong}},codeFold:{fontSize:u.typography.bodySmall.fontSize},gutter:{pre:{color:(0,s.A)(u.colors.text.disabled).setAlpha(1).toString(),opacity:.61}}};return(0,t.jsx)("div",{className:(0,n.css)({fontSize:u.typography.bodySmall.fontSize,pre:{all:"revert"}}),children:(0,t.jsx)(o(),{styles:i,oldValue:l,newValue:f,splitView:!1,compareMethod:r.DiffMethod.CSS,useDarkTheme:u.isDark,...h})})}},21378:(ee,B,e)=>{"use strict";e.d(B,{Cc:()=>K,me:()=>b,bS:()=>c,rJ:()=>S,wL:()=>r});var t=e(68143);class n{getHistoryList(N,w){return typeof N!="string"?Promise.resolve([]):(0,t.AI)().get(`api/dashboards/uid/${N}/versions`,w)}getDashboardVersion(N,w){return typeof N!="string"?Promise.resolve({}):(0,t.AI)().get(`api/dashboards/uid/${N}/versions/${w}`)}restoreDashboard(N,w){if(typeof N!="string")return Promise.resolve({});const j=`api/dashboards/uid/${N}/restore`;return(0,t.AI)().post(j,{version:w})}}const r=new n;var o=e(74848),s=e(22803),m=e(63142),a=e(32635),l=e(94018),f=e(8515),h=e(45861),u=e(56840),i=e(23289),x=e(71599),g=e(64762);const p=({hideModal:W,onRestore:N,version:w})=>{const j=(0,g._2)(),V=async()=>{await N(w)?(j.success("Dashboard restored",`Restored from version ${w.version}`),i.c.versionRestoreClicked({version:w.version,confirm:!0})):j.error("Dashboard restore failed",`Failed to restore from version ${w.version}`),W()};return(0,o.jsx)(x.u,{isOpen:!0,title:(0,u.t)("dashboard-scene.revert-dashboard-modal.title-restore-version","Restore version"),icon:"history",onDismiss:W,onConfirm:V,body:(0,o.jsxs)("p",{children:["Are you sure you want to restore the dashboard to version ",w.version,"? All unsaved changes will be lost."]}),confirmText:`Yes, restore to version ${w.version}`})},c=({versions:W,canCompare:N,onCheck:w,onRestore:j})=>{const V=(0,m.of)(y);return(0,o.jsx)("div",{className:V.margin,children:(0,o.jsxs)("table",{className:"filter-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{className:"width-4"}),(0,o.jsx)("th",{className:"width-4",children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.version-history-table.version",children:"Version"})}),(0,o.jsx)("th",{className:"width-14",children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.version-history-table.date",children:"Date"})}),(0,o.jsx)("th",{className:"width-10",children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.version-history-table.updated-by",children:"Updated by"})}),(0,o.jsx)("th",{children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.version-history-table.notes",children:"Notes"})}),(0,o.jsx)("th",{})]})}),(0,o.jsx)("tbody",{children:W.map((U,F)=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:(0,o.jsx)(a.S,{"aria-label":(0,u.t)("dashboard-scene.version-history-table.aria-label-toggle-selection","Toggle selection of version {{version}}",{version:U.version}),className:(0,s.css)({display:"inline"}),checked:U.checked,onChange:M=>w(M,U.id),disabled:!U.checked&&N})}),(0,o.jsx)("td",{children:U.version}),(0,o.jsx)("td",{children:U.createdDateString}),(0,o.jsx)("td",{children:U.createdBy}),(0,o.jsx)("td",{children:U.message}),(0,o.jsx)("td",{className:"text-right",children:F===0?(0,o.jsx)(l.v,{name:"Latest",colorIndex:17}):(0,o.jsx)(f.$s,{children:({showModal:M,hideModal:H})=>(0,o.jsx)(h.$n,{variant:"secondary",size:"sm",icon:"history",onClick:()=>{M(p,{version:U,hideModal:H,onRestore:j}),i.c.versionRestoreClicked({version:U.version,index:F,confirm:!1,version_date:U.created})},children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.version-history-table.restore",children:"Restore"})})})})]},U.id))})]})})};function y(W){return{margin:(0,s.css)({marginBottom:W.spacing(4)})}}var P=e(2543),d=e(76319),D=e(30703);const b=({onClick:W=P.noop,baseVersion:N=0,newVersion:w=0,isNewLatest:j=!1})=>{const V=(0,m.of)(E);return(0,o.jsxs)("h3",{className:V.header,children:[(0,o.jsx)(d.K,{name:"arrow-left",size:"xl",onClick:W,tooltip:(0,u.t)("dashboard-scene.version-history-header.tooltip-reset-version","Reset version")}),(0,o.jsxs)("span",{children:["Comparing ",N," ",(0,o.jsx)(D.I,{name:"arrows-h"})," ",w," ",j&&(0,o.jsx)("cite",{className:"muted",children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.version-history-header.latest",children:"(Latest)"})})]})]})},E=W=>({header:(0,s.css)({fontSize:W.typography.h3.fontSize,display:"flex",gap:W.spacing(2),marginBottom:W.spacing(2)})});var v=e(41654),C=e(45967);const S=({hasMore:W,canCompare:N,getVersions:w,getDiff:j,isLastPage:V})=>(0,o.jsxs)(v.B,{children:[W&&(0,o.jsx)(h.$n,{type:"button",onClick:()=>{w(!0),i.c.showMoreVersionsClicked()},variant:"secondary",disabled:V,children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.versions-history-buttons.show-more-versions",children:"Show more versions"})}),(0,o.jsx)(C.m,{content:"Select two versions to start comparing",placement:"bottom",children:(0,o.jsx)(h.$n,{type:"button",disabled:!N,onClick:j,icon:"code-branch",children:(0,o.jsx)(u.x6,{i18nKey:"dashboard-scene.versions-history-buttons.compare-versions",children:"Compare versions"})})})]});var O=e(31286),I=e(74475),R=e(34753),T=e(1199),L=e(61371);const K=({baseInfo:W,newInfo:N,diffData:w,isNewLatest:j,onRestore:V}
202)=>{const U=(0,L.G4)(w.lhs,w.rhs),F=(0,m.of)(A);return(0,o.jsxs)(v.B,{direction:"column",gap:1,children:[(0,o.jsxs)(v.B,{justifyContent:"space-between",alignItems:"center",children:[(0,o.jsxs)(v.B,{alignItems:"center",children:[(0,o.jsxs)("span",{className:(0,s.cx)(F.versionInfo,F.noMarginBottom),children:[(0,o.jsxs)("strong",{children:["Version ",W.version]})," updated by ",W.createdBy," ",W.ageString,W.message]}),(0,o.jsx)(D.I,{name:"arrow-right",size:"sm"}),(0,o.jsxs)("span",{className:F.versionInfo,children:[(0,o.jsxs)("strong",{children:["Version ",N.version]})," updated by ",N.createdBy," ",N.ageString,N.message]})]}),j&&(0,o.jsx)(f.$s,{children:({showModal:M,hideModal:H})=>(0,o.jsxs)(h.$n,{variant:"destructive",icon:"history",onClick:()=>{M(p,{version:W,onRestore:V,hideModal:H})},children:["Restore to version ",W.version]})})]}),Object.entries(U).map(([M,H])=>(0,o.jsx)(R.D,{diffs:H,title:M},M)),(0,o.jsx)(O.a,{paddingTop:2,children:(0,o.jsx)(I.M,{isOpen:!1,label:(0,u.t)("dashboard-scene.version-history-comparison.label-view-json-diff","View JSON diff"),children:(0,o.jsx)(T.M,{oldValue:JSON.stringify(w.lhs,null,2),newValue:JSON.stringify(w.rhs,null,2)})})})]})},A=W=>({versionInfo:(0,s.css)({color:W.colors.text.secondary,fontSize:W.typography.bodySmall.fontSize}),noMarginBottom:(0,s.css)({marginBottom:0})})},61371:(ee,B,e)=>{"use strict";e.d(B,{Fl:()=>m,G4:()=>s});var t=e(16111),n=e(25504),r=e(2543),o=e.n(r);const s=(f,h)=>{const u=(0,t.UD)(f,h),i=n.stringify(f,null,2),x=n.stringify(h,null,2),g=y=>y.map(P=>{let d,D,b=0,E=0;const v=(0,r.tail)(P.path.split("/"));return P.op==="replace"&&x.pointers[P.path]&&(d=(0,r.get)(f,v),D=P.value,b=x.pointers[P.path].value.line,E=x.pointers[P.path].valueEnd.line),P.op==="add"&&x.pointers[P.path]&&(D=P.value,b=x.pointers[P.path].value.line,E=x.pointers[P.path].valueEnd.line),P.op==="remove"&&i.pointers[P.path]&&(d=(0,r.get)(f,v),b=i.pointers[P.path].value.line,E=i.pointers[P.path].valueEnd.line),{op:P.op,value:D,path:v,originalValue:d,startLineNumber:b,endLineNumber:E}}),p=y=>(0,r.sortBy)(y,"startLineNumber"),c=y=>y.reduce((P,d)=>{const D=d.path[0];return P[D]||(P[D]=[]),P[D].push(d),P},{});return(0,r.flow)([g,p,c])(u)},m=(f,h=!0)=>{const u=(0,r.last)(f.path),i=a(u),x=f.op==="remove"?f.originalValue:f.value;let g=l(f.op);return h&&(i?g+=` item ${u}`:(0,r.isArray)(x)&&!(0,r.isEmpty)(x)?g+=` ${x.length} ${u}`:g+=` ${u}`),g},a=f=>!(0,r.isNaN)((0,r.toNumber)(f)),l=f=>f==="add"?"added":f==="remove"?"deleted":"changed"},12434:(ee,B,e)=>{"use strict";e.d(B,{F7:()=>f,Xe:()=>m,yk:()=>l});var t=e(71673),n=e(58662),r=e(29043),o=e(23289);const s={useAbsoluteTimeRange:!0,useShortUrl:!0,theme:"current"},m=async(h,u)=>{const{useAbsoluteTimeRange:i,useShortUrl:x,theme:g}=l();return o.c.shareLinkCopied({currentTimeRange:i,theme:g,shortenURL:x,shareResource:(0,n.hD)(u?.getRef())}),await(0,t.Sp)(h,{useAbsoluteTimeRange:i,theme:g,useShortUrl:x})},a="grafana.dashboard.link.shareConfiguration";function l(){return r.A.exists(a)&&r.A.getObject(a)||s}function f(h){r.A.setObject(a,h)}},9175:(ee,B,e)=>{"use strict";e.d(B,{j:()=>xn});var t=e(74848),n=e(36490),r=e(56838),o=e(8207),s=e(58662),m=e(8285),a=e(22803),l=e(16817),f=e(70713),h=e(85629),u=e(63142),i=e(41654),x=e(21285),g=e(72636),p=e(34999),c=e(89640),y=e(50992),P=e(68079),d=e(45861),D=e(47931),b=e(6890),E=e(64762),v=e(56840),C=e(8535),S=e(23289),O=e(56445);const I=h.Tp.pages.ExportDashboardDrawer.ExportAsJson;class R extends O.N{static{this.Component=T}getTabLabel(){return(0,v.t)("export.json.title","Export dashboard JSON")}}function T({model:St}){const Ht=(0,u.of)(L),{isSharingExternally:cn}=St.useState(),un=(0,l.A)(async()=>await St.getExportableDashboardJson(),[cn]),bn=JSON.stringify(un.value?.json,null,2),Sn=un.value?.hasLibraryPanels,ea=un.value?.json&&"elements"in un.value.json&&cn&&Sn,Zn=async()=>{await St.onSaveAsFile();const _n=(0,v.t)("export.json.download-successful_toast_message","Your JSON has been downloaded");(0,C.JD)((0,b.dx)((0,E.tZ)(_n)))},Vn=(0,v.t)("export.json.export-externally-label","Export the dashboard to use in another instance");return(0,t.jsxs)("div",{"data-testid":I.container,className:Ht.container,children:[(0,t.jsx)("p",{children:(0,t.jsx)(v.x6,{i18nKey:"export.json.info-text",children:"Copy or download a JSON file containing the JSON of your dashboard"})}),(0,t.jsxs)(i.B,{gap:2,direction:"column",children:[(0,t.jsxs)(i.B,{gap:1,children:[(0,t.jsx)(x.d,{label:Vn,"data-testid":I.exportExternallyToggle,id:"export-externally-toggle",value:cn,onChange:St.onShareExternallyChange}),(0,t.jsx)(g.J,{children:Vn})]}),ea&&(0,t.jsx)(p.F,{title:(0,v.t)("dashboard-scene.save-dashboard-form.schema-v2-library-panels-export-title","Dashboard Schema V2 does not support exporting library panels to be used in another instance yet"),severity:"warning",children:(0,t.jsxs)(v.x6,{i18nKey:"dashboard-scene.save-dashboard-form.schema-v2-library-panels-export",children:["The dynamic dashboard functionality is experimental, and has not full feature parity with current dashboards behaviour. It is based on a new schema format, that does not support library panels. This means that when exp
202orting the dashboard to use it in another instance, we will not include library panels. We intend to support them as we progress in the feature"," ",(0,t.jsx)(c.Y,{external:!0,href:"https://grafana.com/docs/release-life-cycle/",children:"life cycle"}),"."]})})]}),(0,t.jsx)("div",{className:Ht.codeEditorBox,children:(0,t.jsx)(f.default,{"data-testid":I.codeEditor,children:({width:_n,height:Ln})=>bn?(0,t.jsx)(y.B,{value:bn,language:"json",showLineNumbers:!0,showMiniMap:!1,height:Ln,width:_n,readOnly:!0}):un.loading&&(0,t.jsx)(P.y,{})})}),(0,t.jsx)("div",{className:Ht.buttonsContainer,children:(0,t.jsxs)(i.B,{gap:1,flex:1,direction:{xs:"column",sm:"row"},children:[(0,t.jsx)(d.$n,{"data-testid":I.saveToFileButton,variant:"primary",icon:"download-alt",onClick:Zn,children:(0,t.jsx)(v.x6,{i18nKey:"export.json.download-button",children:"Download file"})}),(0,t.jsx)(D.b,{"data-testid":I.copyToClipboardButton,variant:"secondary",icon:"copy",disabled:un.loading,getText:()=>bn??"",onClipboardCopy:()=>{S.c.exportCopyJsonClicked()},children:(0,t.jsx)(v.x6,{i18nKey:"export.json.copy-button",children:"Copy to clipboard"})}),(0,t.jsx)(d.$n,{"data-testid":I.cancelButton,variant:"secondary",onClick:St.useState().onDismiss,fill:"outline",children:(0,t.jsx)(v.x6,{i18nKey:"export.json.cancel-button",children:"Cancel"})})]})})]})}function L(St){return{container:(0,a.css)({height:"100%"}),codeEditorBox:(0,a.css)({margin:`${St.spacing(2,0)}`,height:"75%"}),buttonsContainer:(0,a.css)({paddingBottom:St.spacing(2)})}}var K=e(96540),A=e(3271),W=e(73427),N=e(62905),w=e(82298),j=e(24313),V=e(96673),U=e(76319),F=e(66404),M=e(70735);function H({onConfirm:St,onDismiss:Ht,description:cn,confirmButtonLabel:un,title:bn,isActionLoading:Sn}){const wn=(0,u.of)(_),ea=()=>(0,t.jsx)("div",{className:wn.bodyContainer,children:(0,t.jsxs)(i.B,{justifyContent:"space-between",children:[(0,t.jsxs)(i.B,{gap:1,alignItems:"center",children:[(0,t.jsx)(U.K,{size:"xl",name:"angle-left","aria-label":(0,v.t)("share-drawer.confirm-action.back-arrow-button","Back button"),onClick:Ht}),(0,t.jsx)(F.E,{variant:"h4",children:bn})]}),Sn&&(0,t.jsx)(P.y,{})]})});return(0,t.jsx)(M.k,{body:(0,t.jsx)(ea,{}),description:cn,confirmButtonLabel:un,confirmButtonVariant:"destructive",dismissButtonLabel:(0,v.t)("share-drawer.confirm-action.cancel-button","Cancel"),dismissButtonVariant:"secondary",justifyButtons:"flex-start",onConfirm:St,onDismiss:Ht})}const _=St=>({bodyContainer:(0,a.css)({marginBottom:St.spacing(2)})}),Z=(0,K.createContext)(void 0),ne=()=>{const St=(0,K.useContext)(Z);if(St===void 0)throw new Error("useShareDrawerContext must be used within a DrawerContext");return St};var te=e(49785),Y=e(16780),Q=e(37386),J=e(45967),q=e(30703),X=e(63527),se=e(83692);const oe=h.Tp.pages.ShareDashboardDrawer.ShareExternally.Configuration;function ae(){const St=(0,u.of)(ie),{dashboard:Ht}=ne(),[cn,{isLoading:un}]=(0,N.T2)(),{data:bn}=N.Sm.endpoints?.getPublicDashboard.useQueryState(Ht.state.uid),Sn=W.TP.hasPermission(V.AccessControlAction.DashboardsPublicWrite),wn=un||!Sn,Zn=r.jh.getTimeRange(Ht).useState(),{handleSubmit:Vn,setValue:_n,control:Ln}=(0,te.mN)({defaultValues:{isAnnotationsEnabled:bn?.annotationsEnabled,isTimeSelectionEnabled:bn?.timeSelectionEnabled}}),Xn=async(Ca,Da)=>{_n(Ca,Da),await Vn(Qn=>ma({...Qn,[Ca]:Da}))()},ma=Ca=>{const{isAnnotationsEnabled:Da,isTimeSelectionEnabled:Qn}=Ca;cn({dashboard:Ht,payload:{...bn,annotationsEnabled:Da,timeSelectionEnabled:Qn}})};return(0,t.jsxs)(i.B,{direction:"column",gap:2,children:[(0,t.jsx)(F.E,{element:"p",children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.configuration.settings-label",children:"Settings"})}),(0,t.jsxs)(i.B,{justifyContent:"space-between",children:[(0,t.jsx)("form",{onSubmit:Vn(ma),children:(0,t.jsx)(Y.n,{disabled:wn,children:(0,t.jsxs)(i.B,{direction:"column",gap:2,children:[(0,t.jsxs)(i.B,{gap:1,children:[(0,t.jsx)(te.xI,{render:({field:{ref:Ca,...Da}})=>(0,t.jsx)(x.d,{...Da,"data-testid":oe.enableTimeRangeSwitch,onChange:Qn=>{S.c.publicDashboardTimeSelectionChanged({enabled:Qn.currentTarget.checked}),Xn("isTimeSelectionEnabled",Qn.currentTarget.checked)},label:(0,v.t)("public-dashboard.configuration.enable-time-range-label","Enable time range")}),control:Ln,name:"isTimeSelectionEnabled"}),(0,t.jsx)(g.J,{description:(0,v.t)("public-dashboard.configuration.enable-time-range-description","Allow people to change time range"),children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.configuration.enable-time-range-label",children:"Enable time range"})})]}),(0,t.jsxs)(i.B,{gap:1,children:[(0,t.jsx)(te.xI,{render:({field:{ref:Ca,...Da}})=>(0,t.jsx)(x.d,{...Da,"data-testid":oe.enableAnnotationsSwitch,onChange:Qn=>
202{S.c.publicDashboardAnnotationsSelectionChanged({enabled:Qn.currentTarget.checked}),Xn("isAnnotationsEnabled",Qn.currentTarget.checked)},label:(0,v.t)("public-dashboard.configuration.display-annotations-label","Display annotations")}),control:Ln,name:"isAnnotationsEnabled"}),(0,t.jsx)(g.J,{style:{flex:1},description:(0,v.t)("public-dashboard.configuration.display-annotations-description","Present annotations on this dashboard"),children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.configuration.display-annotations-label",children:"Display annotations"})})]}),(0,t.jsxs)(i.B,{gap:1,alignItems:"flex-start",children:[(0,t.jsx)("div",{className:St.timeRange,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.configuration.time-range-label",children:"Time range"})}),(0,t.jsx)("div",{className:(0,a.cx)(St.timeRange,St.timeRangeValue),children:(0,t.jsx)(se.f,{value:Zn.value})}),(0,t.jsx)(J.m,{placement:"right",content:(0,v.t)("public-dashboard.configuration.time-range-tooltip","The shared dashboard uses the default time range settings of the dashboard"),
202children:(0,t.jsx)(q.I,{name:"info-circle",size:"md"})})]})]})})}),un&&(0,t.jsx)(P.y,{})]})]})}const ie=St=>({timeRange:(0,a.css)({fontSize:St.typography.bodySmall.fontSize,fontWeight:St.typography.bodySmall.fontWeight}),timeRangeValue:(0,a.css)({color:St.colors.text.secondary})});var fe=e(87063),pe=e(88559);const de=h.Tp.pages.ShareDashboardModal.PublicDashboard.EmailSharingConfiguration,le=({onDelete:St,onReshare:Ht})=>(0,t.jsxs)(fe.W,{children:[(0,t.jsx)(fe.W.Item,{label:(0,v.t)("public-dashboard.email-sharing.resend-invite-label","Resend invite"),onClick:Ht}),(0,t.jsx)(fe.W.Item,{label:(0,v.t)("public-dashboard.email-sharing.revoke-access-label","Revoke access"),destructive:!0,onClick:St})]}),me=({recipients:St,dashboardUid:Ht,publicDashboard:cn})=>{const un=(0,u.of)(Te),[bn,{isLoading:Sn}]=(0,N.$L)(),[wn,{isLoading:ea}]=(0,N.NA)(),Zn=Sn||ea,Vn=(Ln,Xn)=>{S.c.revokePublicDashboardEmailClicked(),bn({recipientUid:Ln,recipientEmail:Xn,dashboardUid:Ht,uid:cn.uid})},_n=Ln=>{S.c.resendPublicDashboardEmailClicked(),wn({recipientUid:Ln,uid:cn.uid})};return(0,t.jsx)("table",{"data-testid":de.EmailSharingList,className:un.table,children:(0,t.jsx)("tbody",{children:St.map((Ln,Xn)=>(0,t.jsxs)("tr",{className:un.listItem,children:[(0,t.jsx)("td",{className:un.user,children:(0,t.jsxs)(i.B,{direction:"row",gap:1,alignItems:"center",children:[(0,t.jsx)("div",{className:un.icon,children:(0,t.jsx)(q.I,{name:"user"})}),(0,t.jsx)(F.E,{children:Ln.recipient})]})}),(0,t.jsx)("td",{children:Zn&&(0,t.jsx)(P.y,{})}),(0,t.jsx)("td",{children:(0,t.jsx)(pe.m,{overlay:(0,t.jsx)(le,{onDelete:()=>Vn(Ln.uid,Ln.recipient),onReshare:()=>_n(Ln.uid)}),children:(0,t.jsx)(U.K,{name:"ellipsis-v","aria-label":(0,v.t)("dashboard-scene.email-list.aria-label-emailmenu","Toggle email menu"),variant:"secondary",size:"lg"})})})]},Ln.uid))})})},De=({dashboard:St})=>{const Ht=(0,u.of)(Te),{data:cn}=N.Sm.endpoints?.getPublicDashboard.useQueryState(St.state.uid);return(0,t.jsx)(Q.D,{label:(0,v.t)("public-dashboard.email-sharing.recipient-list-title","People with access"),description:(0,v.t)("public-dashboard.email-sharing.recipient-list-description","Only people you've directly invited can access this dashboard"),
202className:Ht.listField,children:cn?.recipients?.length?(0,t.jsx)("div",{className:Ht.listContainer,children:(0,t.jsx)(me,{recipients:cn.recipients,dashboardUid:St.state.uid,publicDashboard:cn})}):(0,t.jsx)(t.Fragment,{})})},Te=St=>({listField:(0,a.css)({marginBottom:0}),listContainer:(0,a.css)({maxHeight:"140px",overflowY:"auto"}),table:(0,a.css)({width:"100%"}),listItem:(0,a.css)({display:"flex",alignItems:"center",gap:St.spacing(.5),padding:St.spacing(.75,1),color:St.colors.text.secondary}),user:(0,a.css)({flex:1}),icon:(0,a.css)({border:`${St.spacing(.25)} solid ${St.colors.text.secondary}`,padding:St.spacing(.125,.5),borderRadius:St.shape.radius.circle,color:St.colors.text.secondary})}),Ne=h.Tp.pages.ShareDashboardModal.PublicDashboard.EmailSharingConfiguration,Ce=()=>{const{dashboard:St}=ne(),{data:Ht,isError:cn}=N.Sm.endpoints?.getPublicDashboard.useQueryState(St.state.uid),[un,{isLoading:bn}]=(0,N.NY)(),Sn=W.TP.hasPermission(V.AccessControlAction.DashboardsPublicWrite),{register:wn,handleSubmit:ea,formState:{errors:Zn,isValid:Vn},reset:_n}=(0,te.mN)({defaultValues:{email:""},mode:"onSubmit"}),Ln=async Xn=>{S.c.publicDashboardEmailInviteClicked(),await un({recipient:Xn.email,uid:Ht.uid,dashboardUid:St.state.uid}).unwrap(),_n({email:""})};return(0,t.jsxs)("div",{children:[(0,t.jsx)("form",{onSubmit:ea(Ln),children:(0,t.jsx)(Y.n,{disabled:!Sn||cn,children:(0,t.jsx)(Q.D,{label:(0,t.jsxs)(i.B,{gap:1,alignItems:"center",children:[(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.email-sharing.recipient-invitation-button",children:"Invite"}),(0,t.jsx)(J.m,{placement:"right",content:(0,v.t)("public-dashboard.email-sharing.recipient-invitation-tooltip","This dashboard contains sensitive data. By using this feature you will be sharing with external people."),children:(0,t.jsx)(q.I,{name:"info-circle",size:"sm"})})]}),description:(0,v.t)("public-dashboard.email-sharing.recipient-invitation-description","Invite someone by email"),error:Zn.email?.message,invalid:!!Zn.email?.message,children:(0,t.jsxs)(i.B,{direction:"row",children:[(0,t.jsx)(X.p,{placeholder:(0,v.t)("public-dashboard.email-sharing.recipient-email-placeholder","Email"),autoCapitalize:"none",loading:bn,...wn("email",{required:(0,v.t)("public-dashboard.email-sharing.recipient-required-email-text","Email is required"),pattern:{value:j._l,message:(0,v.t)("public-dashboard.email-sharing.recipient-invalid-email-text","Invalid email")}}),"data-testid":Ne.EmailSharingInput}),(0,t.jsx)(d.$n,{type:"submit",variant:"primary",disabled:bn||!Vn,"data-testid":Ne.EmailSharingInviteButton,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.email-sharing.recipient-invitation-button",children:"Invite"})})]})})})}),(0,t.jsx)(De,{dashboard:St}),(0,t.jsx)(A.c,{}),(0,t.jsx)(ae,{})]})};var He=e(32635);const ke="https://grafana.com/docs/grafana/next/dashboards/share-dashboards-panels/shared-dashboards/#share-externally-with-specific-people",Me=h.Tp.pages.ShareDashboardDrawer.ShareExternally;function $e(){return(0,t.jsx)(p.F,{title:"",severity:"info",bottomSpacing:0,"data-testid":Me.emailSharingAlert,children:(0,t.jsxs)(i.B,{justifyContent:"space-between",gap:2,alignItems:"center",children:[(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.email-sharing.alert-text",children:"Sharing dashboards by email is billed per user for the duration of the 30-day token, regardless of how many dashboards are shared. Billing stops after 30 days unless you renew the token."}),(0,t.jsx)(d.$n,{variant:"secondary",onClick:()=>window.open(ke,"_blank"),type:"button",children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.email-sharing.learn-more-button",children:"Learn more"})})]})})}const tt=h.Tp.pages.ShareDashboardDrawer.ShareExternally.Creation,Ke=({hasError:St})=>{const{dashboard:Ht,onDismiss:cn}=ne(),un=(0,u.of)(Re),[bn,{isLoading:Sn,isError:wn}]=(0,N.U9)(),ea=W.TP.hasPermission(V.AccessControlAction.DashboardsPublicWrite),Zn=!ea||Sn||wn||St,{handleSubmit:Vn,register:_n,formState:{isValid:Ln}}=(0,te.mN)({mode:"onChange"}),Xn=()=>{S.c.generatePublicDashboardUrlClicked({share:j.Xo.EMAIL}),bn({dashboard:Ht,payload:{share:j.Xo.EMAIL,isEnabled:!0}})};return(0,t.jsxs)(t.Fragment,{children:[ea&&(0,t.jsx)($e,{}),(0,t.jsx)("form",{onSubmit:Vn(Xn),children:(0,t.jsxs)(Y.n,{disabled:Zn,children:[(0,t.jsx)("div",{className:un.checkbox,children:(0,t.jsx)(He.S,{..._n("billAcknowledgment",{required:!0}),label:(0,v.t)("public-dashboard.email-sharing.bill-ack","I understand that adding users requires payment.*")})}),(0,t.jsxs)(i.B,{direction:"row",gap:1,alignItems:"center",children:[(0,t.jsx)(d.$n,{type:"submit",disabled:!Ln,"data-testid":tt.EmailShare.createButton,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.email-sharing.accept-button",children:"Accept"})}),(0,t.jsx)(d.$n,{variant:"secondary",onClick:cn,"data-testid":tt.EmailShare.cancelButton,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.email-sharing.cancel-button",children:"Cancel"})}),Sn&&(0,t.jsx)(P.y,{})]})]})})]})},Re=St=>({checkbox:(0,a.css)({marginBottom:St.spacing(2)})}),Ve=()=>{const{dashboard:St}=ne(),{data:Ht,isError:cn}=N.Sm.endpoints?.getPublicDashboard.useQueryState(St.state.uid);return(0,t.jsx)(t.Fragment,{children:Ht?(0,t.jsx)(Ce,{}):(0,t.jsx)(Ke,{hasError:cn})})},Qe="https://grafana.com/docs/grafana/next/dashboards/share-dashboards-panels/shared-dashboards",je=h.Tp.pages.ShareDashboardDrawer.ShareExternally,ze=()=>(0,t.jsx)(p.F,{title:"",severity:"info",bottomSpacing:0,"data-testid":je.publicAlert,children:(0,t.jsxs)(i.B,{justifyContent:"space-between",gap:2,alignItems:"center",children:[(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.public-sharing.alert-text",children:"Sharing this dashboard externally makes it entirely accessible to anyone with the link."}),(0,t.jsx)(d.$n,{variant:"secondary",onClick:()=>window.open(Qe,"_blank"),type:"button",children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.public-sharing.learn-more-button",children:"Learn more"})})]})}),Ye=h.Tp.pages.ShareDashboardDrawer.ShareExternally.Creation;function Ge({hasError:St}){const{dashboard:Ht,onDismiss:cn}
202=ne(),un=(0,u.of)(ce),bn=W.TP.hasPermission(V.AccessControlAction.DashboardsPublicWrite),{handleSubmit:Sn,register:wn,formState:{isValid:ea}}=(0,te.mN)({mode:"onChange"}),[Zn,{isLoading:Vn,isError:_n}]=(0,N.U9)(),Ln=()=>{S.c.generatePublicDashboardUrlClicked({share:j.Xo.PUBLIC}),Zn({dashboard:Ht,payload:{share:j.Xo.PUBLIC,isEnabled:!0}})},Xn=!bn||Vn||_n||St;return(0,t.jsxs)(t.Fragment,{children:[bn&&(0,t.jsx)(ze,{}),(0,t.jsx)("form",{onSubmit:Sn(Ln),children:(0,t.jsxs)(Y.n,{disabled:Xn,children:[(0,t.jsx)("div",{className:un.checkbox,children:(0,t.jsx)(He.S,{...wn("publicAcknowledgment",{required:!0}),label:(0,v.t)("public-dashboard.public-sharing.public-ack","I understand that this entire dashboard will be public.*"),"data-testid":Ye.willBePublicCheckbox})}),(0,t.jsxs)(i.B,{direction:"row",gap:1,alignItems:"center",children:[(0,t.jsx)(d.$n,{type:"submit",disabled:!ea,"data-testid":Ye.PublicShare.createButton,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.public-sharing.accept-button",children:"Accept"})}),(0,t.jsx)(d.$n,{variant:"secondary",onClick:cn,"data-testid":Ye.PublicShare.cancelButton,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.public-sharing.cancel-button",children:"Cancel"})}),Vn&&(0,t.jsx)(P.y,{})]})]})})]})}const ce=St=>({checkbox:(0,a.css)({marginBottom:St.spacing(2)})});function Pe(){const{dashboard:St}=ne(),{data:Ht,isError:cn}=N.Sm.endpoints?.getPublicDashboard.useQueryState(St.state.uid);return(0,t.jsx)(t.Fragment,{children:Ht?(0,t.jsx)(ae,{}):(0,t.jsx)(Ge,{hasError:cn})})}var Se=e(37672),Ee=e(44173),xe=e(35195),ye=e(71748);function Oe({publicDashboard:St}){const{dashboard:Ht}=ne(),cn=W.TP.hasPermission(V.AccessControlAction.DashboardsPublicWrite),un=(0,ye.b)(Ht),bn=(Ht.state.$variables?.state.variables.length??0)>0;return(0,t.jsxs)(t.Fragment,{children:[cn&&bn&&(0,t.jsx)(Ee.D,{showDescription:!1}),!cn&&(0,t.jsx)(xe.t,{mode:St?"edit":"create"}),cn&&!!un?.length&&(0,t.jsx)(Se.s,{unsupportedDataSources:un.join(", ")}),St?.share===j.Xo.EMAIL&&(0,j.AY)()&&(0,t.jsx)($e,{}),St?.share===j.Xo.PUBLIC&&(0,t.jsx)(ze,{})]})}var we=e(30360),Be=e(18857);const Xe=()=>({label:(0,v.t)("public-dashboard.share-externally.public-share-type-option-label","Anyone with the link"),description:(0,v.t)("public-dashboard.share-externally.public-share-type-option-description","Anyone with the link can access dashboard"),value:j.Xo.PUBLIC,icon:"globe"}),st=()=>({label:(0,v.t)("public-dashboard.share-externally.email-share-type-option-label","Only specific people"),description:(0,v.t)("public-dashboard.share-externally.email-share-type-option-description","Only people with the link can access dashboard"),value:j.Xo.EMAIL,icon:"users-alt"}),lt=h.Tp.pages.ShareDashboardDrawer.ShareExternally;function Et({setShareType:St,options:Ht,value:cn}){const{dashboard:un}=ne(),bn=(0,u.of)(Tt),{data:Sn}=N.Sm.endpoints?.getPublicDashboard.useQueryState(un.state.uid),[wn,{isLoading:ea}]=(0,N.ft)(),Zn=W.TP.hasPermission(V.AccessControlAction.DashboardsPublicWrite),Vn=Xe(),_n=Ln=>{if(!Sn)return;S.c.publicDashboardShareTypeChange({shareType:Ln===j.Xo.EMAIL?"email":"public"});const Xn={dashboard:un,payload:{...Sn,share:Ln}};wn(Xn)};return(0,t.jsxs)("div",{children:[(0,t.jsxs)(i.B,{justifyContent:"space-between",children:[(0,t.jsx)(g.J,{description:cn.description,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.share-configuration.share-type-label",children:"Link access"})}),ea&&(0,t.jsx)(P.y,{})]}),(0,j.AY)()?(0,t.jsx)(Be.l6,{"data-testid":lt.shareTypeSelect,options:Ht,value:cn,disabled:!Zn,onChange:Ln=>{St(Ln),_n(Ln.value)},className:bn.select}):(0,t.jsxs)(i.B,{gap:1,alignItems:"center",children:[(0,we.Uo)(Vn.icon)&&(0,t.jsx)(q.I,{name:(0,we.Uo)(Vn.icon)}),(0,t.jsx)(F.E,{children:Vn.label})]})]})}const Tt=()=>({select:(0,a.css)({flex:1})}),Mt=h.Tp.pages.ShareDashboardDrawer.ShareExternally,wt=()=>(0,j.AY)()?[st(),Xe()]:[Xe()];class _e extends r.Bs{static{this.Component=xt}getTabLabel(){return(0,v.t)("share-dashboard.menu.share-externally-title","Share externally")}}function xt({model:St}){const[Ht,cn]=(0,K.useState)(!1),un=(0,u.of)(Xt),bn=(0,m.YQ)(St),{data:Sn,isLoading:wn}=(0,N.Bs)(bn.state.uid),[ea,{isLoading:Zn}]=(0,N.bN)(),Vn=()=>{cn(!0)},_n=async()=>{S.c.revokePublicDashboardClicked(),await ea({dashboard:bn,uid:Sn.uid,dashboardUid:bn.state.uid}).unwrap(),cn(!1)};return wn?(0,t.jsx)(w.a,{}):Ht?(0,t.jsx)(H,{title:(0,v.t)("public-dashboard.share-externally.revoke-access-button","Revoke access"),confirmButtonLabel:(0,v.t)("public-dashboard.share-externally.revoke-access-button","Revoke access"),onConfirm:_n,onDismiss:()=>cn(!1),description:(0,v.t)("public-dashboard.share-externally.revoke-access-description","Are you sure you want to revoke this access? The dashboard can no longer be shared."),isActionLoading:Zn}):(0,t.jsx)("div",{className:un.container,children:(0,t.jsx)(At,{publicDashboard:Sn,onRevokeClick:Vn})})}function At({publicDashboard:St,onRevokeClick:Ht}){const cn=wt(),un=(0,K.useMemo)(()=>St&&(0,j.AY)()?cn.find(Zn=>Zn.value===St?.share)??cn[0]:cn[0],[St,cn]),[bn,Sn]=(0,K.useState)(un),wn=(0,K.useMemo)(()=>bn.value===j.Xo.EMAIL&&(0,j.AY)()?(0,t.jsx)(Ve,{}):(0,t.jsx)(Pe,{}),[bn]);return(0,t.jsxs)(i.B,{direction:"column",gap:2,"data-testid":Mt.container,children:[(0,t.jsx)(Oe,{publicDashboard:St}),(0,t.jsx)(Et,{setShareType:Sn,value:bn,options:cn}),wn,St&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.c,{spacing:0}),(0,t.jsx)(bt,{publicDashboard:St,onRevokeClick:Ht})]})]})}function bt({publicDashboard:St,onRevokeClick:Ht}){const{dashboard:cn}=ne(),[un,{isLoading:bn}]=(0,N.eq)(),Sn=(0,u.of)(Xt),wn=W.TP.hasPermission(V.AccessControlA
202ction.DashboardsPublicWrite);function ea(){S.c.publicDashboardUrlCopied()}const Zn=async()=>{S.c.publicDashboardPauseSharingClicked({paused:!St.isEnabled}),un({dashboard:cn,payload:{...St,isEnabled:!St.isEnabled}})};return(0,t.jsxs)(i.B,{alignItems:"center",direction:{xs:"column",sm:"row"},children:[(0,t.jsx)("div",{className:Sn.actionsContainer,children:(0,t.jsxs)(i.B,{gap:1,flex:1,direction:{xs:"column",sm:"row"},children:[(0,t.jsx)(D.b,{"data-testid":Mt.Configuration.copyUrlButton,variant:"primary",fill:"outline",icon:"link",getText:()=>(0,j.mL)(St.accessToken),onClipboardCopy:ea,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.share-externally.copy-link-button",children:"Copy external link"})}),(0,t.jsx)(d.$n,{icon:"trash-alt",variant:"destructive",fill:"outline",disabled:bn||!wn,onClick:Ht,"data-testid":Mt.Configuration.revokeAccessButton,children:(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.share-externally.revoke-access-button",children:"Revoke access"})}),(0,t.jsx)(d.$n,{icon:St.isEnabled?"pause":"play",variant:"secondary",fill:"outline",tooltip:St.isEnabled?(0,v.t)("public-dashboard.share-externally.pause-access-tooltip","Pausing will temporarily disable access to this dashboard for all users"):"",onClick:Zn,disabled:bn||!wn,"data-testid":Mt.Configuration.toggleAccessButton,children:St.isEnabled?(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.share-externally.pause-access-button",children:"Pause access"}):(0,t.jsx)(v.x6,{i18nKey:"public-dashboard.share-externally.resume-access-button",children:"Resume access"})})]})}),bn&&(0,t.jsx)(P.y,{})]})}const Xt=St=>({container:(0,a.css)({paddingBottom:St.spacing(2)}),actionsContainer:(0,a.css)({width:"100%"})});var Cn=e(29216);const vn=h.Tp.pages.ShareDashboardDrawer.ShareInternally;function Wn({useLockedTime:St,onToggleLockedTime:Ht,useShortUrl:cn,onUrlShorten:un,onChangeTheme:bn,selectedTheme:Sn,isLoading:wn}){return(0,t.jsxs)(i.B,{justifyContent:"space-between",children:[(0,t.jsxs)(i.B,{gap:2,direction:"column",children:[(0,t.jsxs)(i.B,{gap:1,direction:"column",children:[(0,t.jsxs)(i.B,{gap:1,alignItems:"start",children:[(0,t.jsx)(x.d,{label:(0,v.t)("link.share.time-range-label","Lock time range"),id:"share-current-time-range",value:St,onChange:Ht,"data-testid":vn.lockTimeRangeSwitch}),(0,t.jsx)(g.J,{description:(0,v.t)("link.share.time-range-description","Change the current relative time range to an absolute time range"),children:(0,t.jsx)(v.x6,{i18nKey:"link.share.time-range-label",children:"Lock time range"})})]}),(0,t.jsxs)(i.B,{gap:1,alignItems:"start",children:[(0,t.jsx)(x.d,{id:"share-short-url",value:cn,label:(0,v.t)("link.share.short-url-label","Shorten link"),onChange:un,"data-testid":vn.shortenUrlSwitch}),(0,t.jsx)(g.J,{children:(0,t.jsx)(v.x6,{i18nKey:"link.share.short-url-label",children:"Shorten link"})})]})]}),(0,t.jsx)(Cn.w,{selectedTheme:Sn,onChange:bn})]}),wn&&(0,t.jsx)(P.y,{})]})}var Dt=e(8655),qt=e(12434);const Yt=h.Tp.pages.ShareDashboardDrawer.ShareInternally;class nn extends Dt.R{static{this.Component=Zt}constructor(Ht){const{useAbsoluteTimeRange:cn,useShortUrl:un,theme:bn}=(0,qt.yk)();super({...Ht,useLockedTime:cn,useShortUrl:un,selectedTheme:bn}),this.onToggleLockedTime=this.onToggleLockedTime.bind(this),this.onUrlShorten=this.onUrlShorten.bind(this),this.onThemeChange=this.onThemeChange.bind(this)}getTabLabel(){return(0,v.t)("share-dashboard.menu.share-internally-title","Share internally")}async onToggleLockedTime(){const Ht=!this.state.useLockedTime;(0,qt.F7)({useAbsoluteTimeRange:Ht,useShortUrl:this.state.useShortUrl,theme:this.state.selectedTheme}),await super.onToggleLockedTime()}async onUrlShorten(){const Ht=!this.state.useShortUrl;(0,qt.F7)({useShortUrl:Ht,useAbsoluteTimeRange:this.state.useLockedTime,theme:this.state.selectedTheme}),await super.onUrlShorten()}async onThemeChange(Ht){(0,qt.F7)({theme:Ht,useShortUrl:this.state.useShortUrl,useAbsoluteTimeRange:this.state.useLockedTime}),await super.onThemeChange(Ht)}}function Zt({model:St}){const Ht=(0,u.of)(tn),{useLockedTime:cn,useShortUrl:un,selectedTheme:bn,isBuildUrlLoading:Sn}=St.useState();return(0,t.jsxs)("div",{className:Yt.container,children:[(0,t.jsx)(p.F,{severity:"info",title:(0,v.t)("link.share.config-alert-title","Link settings"),children:(0,t.jsx)(v.x6,{i18nKey:"link.share.config-alert-description",children:"Updating your settings will modify the default copy link to include these changes. Please note that these settings are saved within your current browser scope."})}),(0,t.jsx)("div",{className:Ht.configDescription,children:(0,t.jsx)(F.E,{variant:"body",children:(0,t.jsx)(v.x6,{i18nKey:"link.share.config-description",children:"Create a personalized, direct link to share your dashboard within your organization, with the following customization settings:"})})}),(0,t.jsx)(Wn,{useLockedTime:cn,onToggleLockedTime:St.onToggleLockedTime,useShortUrl:un,onUrlShorten:St.onUrlShorten,selectedTheme:bn,onChangeTheme:St.onThemeChange,isLoading:Sn}),(0,t.jsx)(A.c,{spacing:1}),(0,t.jsx)(i.B,{gap:1,flex:1,direction:{xs:"column",sm:"row"},children:(0,t.jsx)(D.b,{icon:"link",variant:"primary",fill:"outline",disabled:Sn,getText:St.getShareUrl,onClipboardCopy:St.onCopy,className:Ht.copyButtonContainer,"data-testid":Yt.copyUrlButton,children:(0,t.jsx)(v.x6,{i18nKey:"link.share.copy-link-button",children:"Copy link"})})})]})}const tn=St=>({configDescription:(0,a.css)({marginBottom:St.spacing(2)}),copyButtonContainer:(0,a.css)({marginTop:St.spacing(2)})});var ft=e(5805),Rt=e(15130),Bt=e(51155),jt=e(77824);const Nt="https://grafana.com/docs/grafana/next/dashboards/share-dashboards-panels/#share-a-snapshot",$t="https://grafana.com/docs/grafana/next/dashboards/share-dashboards-panels/#panel-snapsh
202ot";function an({name:St,onNameChange:Ht,onExpireChange:cn,selectedExpireOption:un,panelRef:bn,disableInputs:Sn,children:wn}){const ea=(0,u.of)(Jt);return(0,t.jsxs)("div",{className:ea.container,children:[(0,t.jsx)(p.F,{severity:"info",title:"",children:(0,t.jsxs)(i.B,{justifyContent:"space-between",gap:2,alignItems:"center",children:[(0,t.jsx)(F.E,{children:bn?(0,t.jsx)(v.x6,{i18nKey:"snapshot.share-panel.info-alert",children:"A Grafana panel snapshot publicly shares a panel while removing sensitive data such as queries and panel links, leaving only visible metrics and series names. Anyone with the link can access the snapshot."}):(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.info-alert",children:"A Grafana dashboard snapshot publicly shares a dashboard while removing sensitive data such as queries and panel links, leaving only visible metrics and series names. Anyone with the link can access the snapshot."})}),(0,t.jsx)(d.$n,{variant:"secondary",onClick:()=>window.open(bn?$t:Nt,"_blank"),type:"button",children:(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.learn-more-button",children:"Learn more"})})]})}),(0,t.jsxs)("fieldset",{disabled:Sn,children:[(0,t.jsx)(Q.D,{label:(0,v.t)("snapshot.share.name-label","Snapshot name"),children:(0,t.jsx)(X.p,{id:"snapshot-name-input",value:St,onChange:Zn=>Ht(Zn.currentTarget.value)})}),(0,t.jsx)(Q.D,{label:(0,v.t)("snapshot.share.expiration-label","Expires in"),children:(0,t.jsx)(jt.z,{id:"expire-select-input",options:(0,Bt.u)(),value:un?.value,onChange:cn})})]}),(0,t.jsx)(A.c,{}),wn]})}const Jt=St=>({container:(0,a.css)({paddingBottom:St.spacing(2)})}),gn=h.Tp.pages.ShareDashboardDrawer.ShareSnapshot;class mn extends Bt.l{static{this.Component=_t}getTabLabel(){return(0,v.t)("share-dashboard.menu.share-snapshot-title","Share snapshot")}}function _t({model:St}){const[Ht,cn]=(0,K.useState)(!1),[un,bn]=(0,K.useState)(!1),[Sn,wn]=(0,K.useState)(1),{snapshotName:ea,snapshotSharingOptions:Zn,selectedExpireOption:Vn,panelRef:_n,onDismiss:Ln,dashboardRef:Xn}=St.useState(),[ma,Ca]=(0,ft.default)(async(Ms=!1)=>{const Ds=await St.onSnapshotCreate(Ms);return wn(2),Ds}),[Da,Qn]=(0,ft.default)(async Ms=>{const Ds=await St.onSnapshotDelete(Ms);return wn(1),cn(!1),bn(!0),Ds}),Ha=()=>{Ln?.()},ba=()=>{St.onSnasphotNameChange(Xn.resolve().state.title),wn(1)},Ps=async()=>{await Qn(ma.value?.deleteUrl),ba()};return Ht?(0,t.jsx)(H,{title:(0,v.t)("snapshot.share.delete-title","Delete snapshot"),confirmButtonLabel:(0,v.t)("snapshot.share.delete-button","Delete snapshot"),onConfirm:Ps,onDismiss:()=>cn(!1),description:(0,v.t)("snapshot.share.delete-description","Are you sure you want to delete this snapshot?"),isActionLoading:Da.loading}):(0,t.jsx)("div",{"data-testid":gn.container,children:(0,t.jsxs)(t.Fragment,{children:[Sn===1&&un&&(0,t.jsx)(p.F,{severity:"info",title:"",onRemove:()=>bn(!1),children:(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.deleted-alert",children:"Snapshot deleted. It could take an hour to be cleared from CDN caches."})}),(0,t.jsx)(an,{name:ea??"",selectedExpireOption:Vn,onNameChange:St.onSnasphotNameChange,onExpireChange:St.onExpireChange,disableInputs:Sn===2,panelRef:_n,children:(0,t.jsxs)(i.B,{justifyContent:"space-between",gap:{xs:2},direction:{xs:"column",xl:"row"},children:[Sn===1?(0,t.jsx)(On,{onCreateClick:Ca,isLoading:ma.loading,onCancelClick:Ha,sharingOptions:Zn}):Sn===2&&ma.value&&(0,t.jsx)(Nn,{url:ma.value.url,onDeleteClick:()=>cn(!0),onNewSnapshotClick:ba}),(0,t.jsx)(c.Y,{icon:"external-link-alt",href:"/dashboard/snapshots",external:!0,children:(0,v.t)("snapshot.share.view-all-button","View all snapshots")})]})})]})})}const On=({isLoading:St,onCreateClick:Ht,onCancelClick:cn,sharingOptions:un})=>(0,t.jsxs)(i.B,{gap:1,flex:1,direction:{xs:"column",sm:"row"},children:[(0,t.jsx)(d.$n,{variant:"primary",disabled:St,onClick:()=>Ht(),"data-testid":gn.publishSnapshot,children:(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.local-button",children:"Publish snapshot"})}),un?.externalEnabled&&(0,t.jsx)(d.$n,{variant:"secondary",disabled:St,onClick:()=>Ht(!0),children:un?.externalSnapshotName}),(0,t.jsx)(d.$n,{variant:"secondary",fill:"outline",onClick:cn,children:(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.cancel-button",children:"Cancel"})}),St&&(0,t.jsx)(P.y,{})]}
202),Nn=({url:St,onDeleteClick:Ht,onNewSnapshotClick:cn})=>{const un=Rt.TP.hasPermission(V.AccessControlAction.SnapshotsDelete),bn=un?"":(0,v.t)("snapshot.share.delete-permission-tooltip","You don't have permission to delete snapshots");return(0,t.jsxs)(i.B,{justifyContent:"flex-start",gap:1,direction:{xs:"column",sm:"row"},children:[(0,t.jsx)(D.b,{icon:"link",variant:"primary",fill:"outline",getText:()=>St,"data-testid":gn.copyUrlButton,children:(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.copy-link-button",children:"Copy link"})}),(0,t.jsx)(d.$n,{icon:"trash-alt",variant:"destructive",fill:"outline",onClick:Ht,disabled:!un,tooltip:bn,children:(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.delete-button",children:"Delete snapshot"})}),(0,t.jsx)(d.$n,{variant:"secondary",fill:"solid",onClick:cn,children:(0,t.jsx)(v.x6,{i18nKey:"snapshot.share.new-snapshot-button",children:"New snapshot"})})]})};var Fn=e(89752),na=e(42656),aa=e(43173),yt=e(4213),mt=e.n(yt),Ot=e(41053),Wt=e(75505),et=e(68143),Je=e(47327);const rt=h.Tp.pages.ShareDashboardDrawer.ShareInternally.SharePanel;function it({title:St,imageUrl:Ht,buildUrl:cn,disabled:un,theme:bn}){const Sn=(0,u.of)(Pt),{handleSubmit:wn,register:ea,watch:Zn,formState:{errors:Vn,isValid:_n}}=(0,te.mN)({mode:"onChange",defaultValues:{width:1e3,height:500,scaleFactor:1}});(0,K.useEffect)(()=>{cn({width:Zn("width"),height:Zn("height"),scale:Zn("scaleFactor")})},[cn,Zn]);const[{loading:Ln,value:Xn,error:ma},Ca]=(0,Ot.A)(async ba=>{const Ps=await(0,Wt.s)((0,et.AI)().fetch({url:ba,responseType:"blob"}));return new Blob([Ps.data],{type:"image/png"})},[]),Da=async ba=>{const{width:Ps,height:Ms,scaleFactor:Ds}=ba;S.c.generatePanelImageClicked({width:Ps,height:Ms,scaleFactor:Ds,theme:bn,shareResource:"panel"}),await Ca(Ht)},Qn=()=>{S.c.downloadPanelImageClicked({shareResource:"panel"}),mt()(Xn,`${St}.png`)},Ha=()=>{cn({width:Zn("width"),height:Zn("height"),scale:Zn("scaleFactor")})};return(0,t.jsx)("div",{"data-testid":rt.preview,children:(0,t.jsxs)(i.B,{gap:2,direction:"column",children:[(0,t.jsx)(F.E,{element:"h4",children:(0,t.jsx)(v.x6,{i18nKey:"share-panel-image.preview.title",children:"Panel preview"})}),(0,t.jsx)("form",{onSubmit:wn(Da),children:(0,t.jsxs)(Y.n,{disabled:!aa.$.rendererAvailable,label:(0,t.jsxs)(i.B,{gap:1,alignItems:"center",children:[(0,t.jsx)(F.E,{element:"h5",children:(0,t.jsx)(v.x6,{i18nKey:"share-panel-image.settings.title",children:"Image settings"})}),(0,t.jsx)(J.m,{content:(0,v.t)("share-panel-image.settings.max-warning","Setting maximums are limited by the image renderer service"),children:(0,t.jsx)(q.I,{name:"info-circle",size:"sm"})})]}),children:[(0,t.jsxs)(i.B,{gap:1,justifyContent:"space-between",direction:{xs:"column",sm:"row"},children:[(0,t.jsx)(Q.D,{label:(0,v.t)("share-panel-image.settings.width-label","Width"),className:Sn.imageConfigurationField,required:!0,invalid:!!Vn.width,error:Vn.width?.message,children:(0,t.jsx)(X.p,{...ea("width",{required:(0,v.t)("share-panel-image.settings.width-required","Width is required"),min:{value:1,message:(0,v.t)("share-panel-image.settings.width-min","Width must be equal or greater than 1")},valueAsNumber:!0,onChange:Ha}),placeholder:(0,v.t)("share-panel-image.settings.width-placeholder","1000"),type:"number",suffix:"px","data-testid":rt.widthInput})}),(0,t.jsx)(Q.D,{label:(0,v.t)("share-panel-image.settings.height-label","Height"),className:Sn.imageConfigurationField,required:!0,invalid:!!Vn.height,error:Vn.height?.message,children:(0,t.jsx)(X.p,{...ea("height",{required:(0,v.t)("share-panel-image.settings.height-required","Height is required"),min:{value:1,message:(0,v.t)("share-panel-image.settings.height-min","Height must be equal or greater than 1")},valueAsNumber:!0,onChange:Ha}),placeholder:(0,v.t)("share-panel-image.settings.height-placeholder","500"),type:"number",suffix:"px","data-testid":rt.heightInput})}),(0,t.jsx)(Q.D,{label:(0,v.t)("share-panel-image.settings.scale-factor-label","Scale factor"),className:Sn.imageConfigurationField,required:!0,invalid:!!Vn.scaleFactor,error:Vn.scaleFactor?.message,children:(0,t.jsx)(X.p,{...ea("scaleFactor",{required:(0,v.t)("share-panel-image.settings.scale-factor-required","Scale factor is required"),min:{value:1,message:(0,v.t)("share-panel-image.settings.scale-factor-min","Scale factor must be equal or greater than 1")},valueAsNumber:!0,onChange:Ha}),placeholder:(0,v.t)("share-panel-image.settings.scale-factor-placeholder","1"),type:"number","data-testid":rt.scaleFactorInput})})]}),(0,t.jsxs)(i.B,{gap:1,direction:{xs:"column",sm:"row"},children:[(0,t.jsx)(d.$n,{icon:"gf-layout-simple",variant:"secondary",fill:"solid",type:"submit",disabled:un||Ln||!_n,"data-testid":rt.generateImageButton,children:(0,t.jsx)(v.x6,{i18nKey:"link.share-panel.render-image",children:"Generate image"})}),(0,t.jsx)(d.$n,{onClick:Qn,icon:"download-alt",variant:"secondary",disabled:!Xn||Ln||un,"data-testid":rt.downloadImageButton,children:(0,t.jsx)(v.x6,{i18nKey:"link.share-panel.download-image",children:"Download image"})})]})]})}),Ln&&(0,t.jsxs)("div",{children:[(0,t.jsx)(Je.G,{width:128}),(0,t.jsx)("div",{className:Sn.imageLoadingContainer,children:(0,t.jsx)(F.E,{variant:"body",children:St||""})})]}),Xn&&!Ln&&(0,t.jsx)("img",{src:URL.createObjectURL(Xn),alt:"panel-preview-img",className:Sn.image}),ma&&!Ln&&(0,t.jsx)(p.F,{severity:"error",title:(0,v.t)("link.share-panel.render-image-error","Failed to render panel image"),children:(0,et.NF)(ma)?ma.statusText:(0,v.t)("link.share-panel.render-image-error-description","An error occurred when generating the image")})]})})}const Pt=St=>({imageConfigurationField:(0,a.css)({flex:1}),image:(0,a.css)({maxWidth:"100%",width:"max-content"}),imageLoadingContainer:(0,a.css)({maxWidth:"100%",height:362,border:`1px solid ${St.components.input.borderColor}`,padding:St.spacing(1)})});class It extends Dt.R{static{this.Component=Vt}constructor(Ht){super(Ht)}getTabLabel(){return(0,v.t)("share-panel.drawer.share-link-title","Link settings")}}function Vt({model:St}){const Ht=(0,u.of)(en),{useLockedTime:cn,useShortUrl:un,selectedTheme:bn,isBuildUrlLo
202ading:Sn,imageUrl:wn,panelRef:ea}=St.useState(),Zn=ea?.resolve().state.title,_n=!!(0,m.YQ)(St).state.uid;return(0,t.jsxs)("div",{children:[(0,t.jsx)(F.E,{variant:"body",children:(0,t.jsx)(v.x6,{i18nKey:"link.share-panel.config-description",children:"Create a personalized, direct link to share your panel within your organization, with the following customization settings:"})}),(0,t.jsxs)("div",{className:Ht.configurationContainer,children:[(0,t.jsx)(Wn,{useLockedTime:cn,onToggleLockedTime:St.onToggleLockedTime,useShortUrl:un,onUrlShorten:St.onUrlShorten,selectedTheme:bn,onChangeTheme:St.onThemeChange,isLoading:Sn}),(0,t.jsx)(D.b,{icon:"link",variant:"primary",fill:"outline",disabled:Sn,getText:St.getShareUrl,onClipboardCopy:St.onCopy,children:(0,t.jsx)(v.x6,{i18nKey:"link.share.copy-link-button",children:"Copy link"})})]}),(0,t.jsx)(A.c,{spacing:2}),(0,t.jsxs)(i.B,{gap:2,direction:"column",children:[!_n&&(0,t.jsx)(p.F,{severity:"info",title:(0,v.t)("share-modal.link.save-alert","Dashboard is not saved"),bottomSpacing:0,children:(0,t.jsx)(v.x6,{i18nKey:"share-modal.link.save-dashboard",children:"To render a panel image, you must save the dashboard first."})}),!aa.$.rendererAvailable&&(0,t.jsx)(p.F,{severity:"info",title:(0,v.t)("share-modal.link.render-alert","Image renderer plugin not installed"),bottomSpacing:0,children:(0,t.jsxs)(v.x6,{i18nKey:"share-modal.link.render-instructions",children:["To render a panel image, you must install the"," ",(0,t.jsx)("a",{href:"https://grafana.com/grafana/plugins/grafana-image-renderer",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"Grafana image renderer plugin"}),". Please contact your Grafana administrator to install the plugin."]})}),(0,t.jsx)(it,{title:Zn||"",buildUrl:St.buildUrl,imageUrl:wn,disabled:!_n,theme:bn})]})]})}const en=St=>({configurationContainer:(0,a.css)({marginTop:St.spacing(2)})}),ln=[];function Qt(St){ln.push(St)}class xn extends r.Bs{constructor(Ht){super({...Ht}),this.onDismiss=()=>{this.state.panelRef?(0,m.YQ)(this).closeModal():n.Ny.partial({shareView:null})},this.addActivationHandler(()=>this.buildActiveShare(Ht.shareView))}static{this.Component=En}buildActiveShare(Ht){const{panelRef:cn}=this.state,un=(0,m.YQ)(this),bn=cn?Gn(Ht,this.onDismiss,un.getRef(),cn):zn(Ht,this.onDismiss,un.getRef(),cn);this.setState({activeShare:bn})}}function En({model:St}){const{activeShare:Ht}=St.useState(),cn=(0,m.YQ)(St);return(0,t.jsx)(o._,{title:Ht?.getTabLabel(),onClose:St.onDismiss,size:"md",children:(0,t.jsx)(Z.Provider,{value:{dashboard:cn,onDismiss:St.onDismiss},children:Ht&&(0,t.jsx)(Ht.Component,{model:Ht})})})}function zn(St,Ht,cn,un){const bn=ln.find(Sn=>Sn.id===St);if(bn)return new bn.shareOption({onDismiss:Ht});switch(St){case s.wr.link:return new nn({onDismiss:Ht});case s.wr.publicDashboard:return new _e({onDismiss:Ht});case s.wr.snapshot:return new mn({dashboardRef:cn,panelRef:un,onDismiss:Ht});case s.wr.export:return new R({onDismiss:Ht});default:return new nn({onDismiss:Ht})}}function Gn(St,Ht,cn,un){switch(St){case s.wr.link:return new It({panelRef:un,onDismiss:Ht});case s.wr.snapshot:return new mn({dashboardRef:cn,panelRef:un,onDismiss:Ht});case s.wr.embed:return new na.c({panelRef:un,onDismiss:Ht});case s.wr.libraryPanel:return new Fn.S({panelRef:un,onDismiss:Ht});default:return new It({panelRef:un,onDismiss:Ht})}}},56445:(ee,B,e)=>{"use strict";e.d(B,{N:()=>b});var t=e(74848),n=e(4213),r=e.n(n),o=e(16817),s=e(70713),m=e(56838),a=e(41654),l=e(37386),f=e(21285),h=e(34999),u=e(89640),i=e(22787),x=e(45861),g=e(50992),p=e(47931),c=e(56840),y=e(60171),P=e(58662),d=e(23289),D=e(8285);class b extends m.Bs{constructor(C){super({isSharingExternally:!1,isViewingJSON:!1,...C}),this.tabId=P.wr.export,this.onShareExternallyChange=()=>{this.setState({isSharingExternally:!this.state.isSharingExternally})},this.onViewJSON=()=>{this.setState({isViewingJSON:!this.state.isViewingJSON})},this.getExportableDashboardJson=async()=>{const{isSharingExternally:S}=this.state,O=(0,D.YQ)(this),I=await O.serializer.makeExportableExternally(O),R=O.serializer.getSaveModel(O),T=S?I:R;return(0,y.aK)(R)?{json:T,hasLibraryPanels:Object.values(R.elements).some(L=>L.kind==="LibraryPanel")}:{json:T,hasLibraryPanels:void 0}},this.onSaveAsFile=async()=>{const S=await this.getExportableDashboardJson(),O=JSON.stringify(S.json,null,2),{isSharingExter
202nally:I}=this.state,R=new Blob([O],{type:"application/json;charset=utf-8"}),T=new Date().getTime();let L="dashboard";"title"in S.json&&S.json.title&&(L=S.json.title),r()(R,`${L}-${T}.json`),d.c.exportDownloadJsonClicked({externally:I})}}static{this.Component=E}getTabLabel(){return(0,c.t)("share-modal.tab-title.export","Export")}getClipboardText(){}}function E({model:v}){const{isSharingExternally:C,isViewingJSON:S,modalRef:O}=v.useState(),I=(0,o.A)(async()=>await v.getExportableDashboardJson(),[S,C]),R=JSON.stringify(I.value?.json,null,2),T=I.value?.hasLibraryPanels,K=I.value?.json&&"elements"in I.value.json&&C&&T,A=(0,c.t)("share-modal.export.share-externally-label","Export for sharing externally");return(0,t.jsxs)(t.Fragment,{children:[!S&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:(0,t.jsx)(c.x6,{i18nKey:"share-modal.export.info-text",children:"Export this dashboard."})}),(0,t.jsxs)(a.B,{gap:2,direction:"column",children:[(0,t.jsx)(l.D,{label:A,children:(0,t.jsx)(f.d,{id:"share-externally-toggle",value:C,onChange:v.onShareExternallyChange})}),K&&(0,t.jsx)(h.F,{title:(0,c.t)("dashboard-scene.save-dashboard-form.schema-v2-library-panels-export-title","Dashboard Schema V2 does not support exporting library panels to be used in another instance yet"),severity:"warning",children:(0,t.jsxs)(c.x6,{i18nKey:"dashboard-scene.save-dashboard-form.schema-v2-library-panels-export",children:["The dynamic dashboard functionality is experimental, and has not full feature parity with current dashboards behaviour. It is based on a new schema format, that does not support library panels. This means that when exp
202orting the dashboard to use it in another instance, we will not include library panels. We intend to support them as we progress in the feature"," ",(0,t.jsx)(u.Y,{external:!0,href:"https://grafana.com/docs/release-life-cycle/",children:"life cycle"}),"."]})})]}),(0,t.jsxs)(i.a.ButtonRow,{children:[(0,t.jsx)(x.$n,{variant:"secondary",onClick:()=>{O?.resolve().onDismiss()},fill:"outline",children:(0,t.jsx)(c.x6,{i18nKey:"share-modal.export.cancel-button",children:"Cancel"})}),(0,t.jsx)(x.$n,{variant:"secondary",icon:"brackets-curly",onClick:v.onViewJSON,children:(0,t.jsx)(c.x6,{i18nKey:"share-modal.export.view-button",children:"View JSON"})}),(0,t.jsx)(x.$n,{variant:"primary",icon:"save",onClick:()=>v.onSaveAsFile(),children:(0,t.jsx)(c.x6,{i18nKey:"share-modal.export.save-button",children:"Save to file"})})]})]}),S&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.default,{disableHeight:!0,children:({width:W})=>I.value?(0,t.jsx)(g.B,{value:R,showLineNumbers:!0,language:"json",showMiniMap:!1,height:"500px",width:W}):I.loading?(0,t.jsxs)("div",{children:[" ",(0,t.jsx)(c.x6,{i18nKey:"share-modal.export.loading",children:"Loading..."})]}):null}),(0,t.jsxs)(i.a.ButtonRow,{children:[(0,t.jsx)(x.$n,{variant:"secondary",fill:"outline",onClick:v.onViewJSON,icon:"arrow-left",children:(0,t.jsx)(c.x6,{i18nKey:"share-modal.export.back-button",children:"Back to export config"})}),(0,t.jsx)(p.b,{variant:"secondary",icon:"copy",disabled:I.loading,getText:()=>R??"",children:(0,t.jsx)(c.x6,{i18nKey:"share-modal.view-json.copy-button",children:"Copy to Clipboard"})}),(0,t.jsx)(x.$n,{variant:"primary",icon:"save",disabled:I.loading,onClick:()=>v.onSaveAsFile(),children:(0,t.jsx)(c.x6,{i18nKey:"share-modal.export.save-button",children:"Save to file"})})]})]})]})}},89752:(ee,B,e)=>{"use strict";e.d(B,{S:()=>i});var t=e(74848),n=e(43173),r=e(56838),o=e(56840),s=e(65241),m=e(58662),a=e(7817),l=e(82612),f=e(93389),h=e(70030),u=e(8285);class i extends r.Bs{constructor(){super(...arguments),this.tabId=m.wr.libraryPanel}static{this.Component=x}getTabLabel(){return n.$.featureToggles.newDashboardSharingComponent?(0,o.t)("share-panel.drawer.new-library-panel-title","New library panel"):(0,o.t)("share-modal.tab-title.library-panel","Library panel")}}function x({model:g}){const{panelRef:p,modalRef:c}=g.useState();if(!p)return null;const y=p.resolve(),P=y.parent;if(P instanceof f.U){const d=(0,u.YQ)(g),D=(0,h.ZB)(P),b=new l.a9(D),E=(0,h.Uy)(d),v=new a.G(E);return(0,t.jsx)(s.j,{initialFolderUid:d.state.meta.folderUid,dashboard:v,panel:b,onDismiss:()=>{c?c.resolve().onDismiss():d.closeModal()},onCreateLibraryPanel:C=>d.createLibraryPanel(y,C)})}return null}},8655:(ee,B,e)=>{"use strict";e.d(B,{R:()=>D});var t=e(74848),n=e(25229),r=e(85629),o=e(43173),s=e(56838),m=e(16780),a=e(37386),l=e(21285),f=e(63527),h=e(47931),u=e(30703),i=e(34999),x=e(56840),g=e(71673),p=e(29216),c=e(58662),y=e(52043),P=e(23289),d=e(8285);class D extends s.Bs{constructor(C){super({...C,useLockedTime:C.useLockedTime??!0,useShortUrl:C.useShortUrl??!1,selectedTheme:C.selectedTheme??"current",shareUrl:"",imageUrl:"",isBuildUrlLoading:!1}),this.tabId=c.wr.link,this.buildUrl=async S=>{this.setState({isBuildUrlLoading:!0});const{panelRef:O,useLockedTime:I,useShortUrl:R,selectedTheme:T}=this.state,L=(0,d.YQ)(this),K=O?.resolve(),A={useAbsoluteTimeRange:I,theme:T,useShortUrl:R};let W=(0,g.VN)(L,A,K);R&&(W=await(0,g.fn)(W));const N=s.jh.getTimeRange(K??L),w=(0,g.$l)(A,N,K);let j=w;K&&(delete j.viewPanel,j.panelId=K.state.key,j["__feature.dashboardSceneSolo"]=!0);const V=(0,y.u)({uid:L.state.uid,currentQueryParams:location.search,updateQuery:{...w,...S,panelId:K?.state.key},absolute:!0,soloRoute:!0,render:!0,timeZone:E(N.getTimeZone())});this.setState({shareUrl:W,imageUrl:V,isBuildUrlLoading:!1})},this.getShareUrl=()=>this.state.shareUrl,this.onCopy=()=>{P.c.shareLinkCopied({currentTimeRange:this.state.useLockedTime,theme:this.state.selectedTheme,shortenURL:this.state.useShortUrl,shareResource:(0,c.hD)(this.state.panelRef)})},this.addActivationHandler(()=>{this.buildUrl()}),this.onToggleLockedTime=this.onToggleLockedTime.bind(this),this.onUrlShorten=this.onUrlShorten.bind(this),this.onThemeChange=this.onThemeChange.bind(this)}static{this.Component=b}getTabLabel(){return(0,x.t)("share-modal.tab-title.link","Link")}async onToggleLockedTime(){const C=!this.state.useLockedTime;this.setState({useLockedTime:C}),await this.buildUrl()}async onUrlShorten(){const C=!this.state.useShortUrl;this.setState({useShortUrl:C}),await this.buildUrl()}async onThemeChange(C){this.setState({selectedTheme:C}),await this.buildUrl()}}function b({model:v}){const C=v.useState(),{panelRef:S}=C,O=(0,d.YQ)(v),I=S?.resolve(),T=s.jh.getTimeRange(I??O).state.to==="now",{useLockedTime:L,useShortUrl:K,selectedTheme:A,shareUrl:W,imageUrl:N}
202=C,w=r.Tp.pages.SharePanelModal,j=!!O.state.uid,V=(0,x.t)("share-modal.link.time-range-label","Lock time range"),U=(0,x.t)("share-modal.link.time-range-description","Transforms the current relative time range to an absolute time range"),F=(0,x.t)("share-modal.link.shorten-url","Shorten URL"),M=(0,x.t)("share-modal.link.link-url","Link URL");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:(0,t.jsx)(x.x6,{i18nKey:"share-modal.link.info-text",children:"Create a direct link to this dashboard or panel, customized with the options below."})}),(0,t.jsxs)(m.n,{children:[(0,t.jsx)(a.D,{label:V,description:T?U:"",children:(0,t.jsx)(l.d,{id:"share-current-time-range",value:L,onChange:v.onToggleLockedTime})}),(0,t.jsx)(p.w,{selectedTheme:A,onChange:v.onThemeChange}),(0,t.jsx)(a.D,{label:F,children:(0,t.jsx)(l.d,{id:"share-shorten-url",value:K,onChange:v.onUrlShorten})}),(0,t.jsx)(a.D,{label:M,children:(0,t.jsx)(f.p,{id:"link-url-input",value:W,readOnly:!0,addonAfter:(0,t.jsx)(h.b,{icon:"copy",variant:"primary",getText:v.getShareUrl,onClipboardCopy:v.onCopy,children:(0,t.jsx)(x.x6,{i18nKey:"share-modal.link.copy-link-button",children:"Copy"})})})})]}),I&&o.$.rendererAvailable&&(0,t.jsxs)(t.Fragment,{children:[j&&(0,t.jsx)("div",{className:"gf-form",children:(0,t.jsxs)("a",{href:N,target:"_blank",rel:"noreferrer","aria-label":w.linkToRenderedImage,children:[(0,t.jsx)(u.I,{name:"camera"}),"\xA0",(0,t.jsx)(x.x6,{i18nKey:"share-modal.link.rendered-image",children:"Direct link rendered image"})]})}),!j&&(0,t.jsx)(i.F,{severity:"info",title:(0,x.t)("share-modal.link.save-alert","Dashboard is not saved"),bottomSpacing:0,children:(0,t.jsx)(x.x6,{i18nKey:"share-modal.link.save-dashboard",children:"To render a panel image, you must save the dashboard first."})})]}),I&&!o.$.rendererAvailable&&(0,t.jsx)(i.F,{severity:"info",title:(0,x.t)("share-modal.link.render-alert","Image renderer plugin not installed"),bottomSpacing:0,children:(0,t.jsxs)(x.x6,{i18nKey:"share-modal.link.render-instructions",children:["To render a panel image, you must install the"," ",(0,t.jsx)("a",{href:"https://grafana.com/grafana/plugins/grafana-image-renderer",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"Grafana image renderer plugin"}),". Please contact your Grafana administrator to install the plugin."]})})]})}function E(v){const C="UTC"+encodeURIComponent((0,n.KQ)().format("Z"));if(v==="utc")return"UTC";if(v==="browser"){if(!window.Intl)return C;const O=window.Intl.DateTimeFormat().resolvedOptions();return O.timeZone?O.timeZone:C}return v}},99949:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>V});var t=e(74848),n=e(36490),r=e(43173),o=e(56838),s=e(52792),m=e(22787),a=e(13941),l=e(73427),f=e(56840),h=e(24313),u=e(96673),i=e(58662),x=e(23289),g=e(8285),p=e(56445),c=e(89752),y=e(8655),P=e(42656),d=e(51155),D=e(62905),b=e(82298),E=e(22803),v=e(63142),C=e(72973),S=e(71599);class O extends o.Bs{static{this.Component=I}constructor(M){super({confirmVariant:"destructive",dismissText:"Cancel",dismissVariant:"secondary",icon:"exclamation-triangle",confirmButtonVariant:"destructive",...M})}onDismiss(){}}function I({model:F}){const M=F.useState();return(0,t.jsx)(S.u,{...M})}var R=e(71748);function T({model:F,publicDashboard:M,isGetLoading:H}){const _=(0,v.of)(L),Z=l.TP.hasPermission(u.AccessControlAction.DashboardsPublicWrite),ne=(0,g.YQ)(F),{isDirty:te}=ne.useState(),[Y]=(0,D.bN)(),Q=(ne.state.$variables?.state.variables.length??0)>0,J=(0,R.b)(ne),X=o.jh.getTimeRange(F).useState();return(0,t.jsx)(C.b,{dashboard:ne,publicDashboard:M,unsupportedDatasources:J,onRevoke:()=>{ne.showModal(new O({isOpen:!0,title:"Revoke public URL",icon:"trash-alt",confirmText:"Revoke public URL",body:(0,t.jsx)("p",{className:_.description,children:(0,t.jsx)(f.x6,{i18nKey:"public-dashboard.config.revoke-body",children:"Are you sure you want to revoke this URL? The dashboard will no longer be public."})}),onDismiss:()=>{ne.showModal(new V({activeTab:i.wr.publicDashboard}))},onConfirm:()=>{Y({dashboard:ne,dashboardUid:ne.state.uid,uid:M.uid}),ne.closeModal()}}))},timeRange:X.value,showSaveChangesAlert:Z&&te,hasTemplateVariables:Q})}const L=F=>({description:(0,E.css)({fontSize:F.typography.body.fontSize})});var K=e(58375);function A({model:F}){const M=(0,g.YQ)(F),H=(0,R.b)(M),_=(M.state.$variables?.state.variables.length??0)>0;return(0,t.jsx)(K.D,{dashboard:M,unsupportedDatasources:H,unsupportedTemplateVariables:_})}class W extends o.Bs{constructor(){super(...arguments),this.tabId=i.wr.publicDashboard}static{this.Component=N}getTabLabel(){return(0,f.t)("share-modal.tab-title.public-dashboard","Public Dashboard")}}function N({model:F}){const{data:M,isLoading:H}=(0,D.Bs)((0,g.YQ)(F).state.uid);return(0,t.jsx)(t.Fragment,{children:H?(0,t.jsx)(b.a,{}):(0,h.lI)(M)?(0,t.jsx)(T,{model:F,publicDashboard:M,isGetLoading:H}):(0,t.jsx)(A,{model:F})})}const w=[];function j(F){w.push(F)}class V extends o.Bs{constructor(M){super({activeTab:"link",...M}),this.onDismiss=()=>{this.state.panelRef?(0,g.YQ)(this).closeModal():n.Ny.partial({shareView:null})},this.onChangeTab=H=>{x.c.sharingCategoryClicked({item:H.value,shareResource:(0,i.hD)(this.state.panelRef)}),this.setState({activeTab:H.value})},this.addActivationHandler(()=>this.buildTabs(M.activeTab))}static{this.Component=U}buildTabs(M){const{panelRef:H}=this.state,_=this.getRef(),Z=[new y.R({panelRef:H,modalRef:_})],ne=(0,g.YQ)(this);if(H||Z.push(new p.N({modalRef:_})),l.TP.isSignedIn&&r.$.snapshotEnabled&&l.TP.hasPermission(u.AccessControlA
202ction.SnapshotsCreate)&&Z.push(new d.l({panelRef:H,dashboardRef:ne.getRef(),modalRef:_})),H){Z.push(new P.c({panelRef:H}));const Y=H.resolve();Y instanceof o.Eb&&((0,g.ME)(Y)||Z.push(new c.S({panelRef:H,modalRef:_})))}H||(Z.push(...w.map(Y=>new Y({modalRef:_}))),(0,h.iR)()&&Z.push(new W({modalRef:_})));const te=Z.find(Y=>Y.tabId===M);this.setState({activeTab:te?.tabId??Z[0].tabId,tabs:Z})}}function U({model:F}){const{panelRef:M,tabs:H,activeTab:_}=F.useState(),Z=M?(0,f.t)("share-modal.panel.title","Share Panel"):(0,f.t)("share-modal.dashboard.title","Share");if(!H)return;const ne=H?.map(Q=>({label:Q.getTabLabel(),value:Q.tabId})),te=(0,t.jsx)(s.J,{title:Z,icon:"share-alt",tabs:ne,activeTab:_,onChangeTab:F.onChangeTab}),Y=H.find(Q=>Q.tabId===_);return(0,t.jsx)(m.a,{isOpen:!0,title:te,onDismiss:F.onDismiss,children:(0,t.jsx)(a.J,{children:Y&&(0,t.jsx)(Y.Component,{model:Y})})})}},42656:(ee,B,e)=>{"use strict";e.d(B,{c:()=>h});var t=e(74848),n=e(43173),r=e(56838),o=e(56840),s=e(24209),m=e(58662),a=e(81657),l=e(52043),f=e(8285);class h extends r.Bs{constructor(g){super(g),this.tabId=m.wr.embed}static{this.Component=u}getTabLabel(){return n.$.featureToggles.newDashboardSharingComponent?(0,o.t)("share-panel.drawer.share-embed-title","Share embed"):(0,o.t)("share-modal.tab-title.panel-embed","Embed")}}function u({model:x}){const{panelRef:g}=x.useState(),p=g.resolve(),c=(0,f.YQ)(x),{uid:y}=c.useState(),P=(0,f.Cs)(p),d=r.jh.getTimeRange(p),D=d instanceof a.v?d.state.timeFrom:void 0;return(0,t.jsx)(s.D,{panel:{id:P,timeFrom:D},range:d.state.value,dashboard:{uid:y??"",time:d.state.value},buildIframe:i(c),onCancelClick:()=>c.closeModal()})}const i=x=>(g,p,c,y,P)=>{const d=(0,m.XV)({useCurrentTimeRange:g,selectedTheme:c,panel:y,range:P}),D=d.get("editPanel")??d.get("viewPanel")??"";return d.set("panelId",D),d.delete("editPanel"),d.delete("viewPanel"),d.set("__feature.dashboardSceneSolo","true"),`<iframe src="${(0,l.u)({absolute:!0,soloRoute:!0,uid:x.state.uid,slug:x.state.meta.slug,currentQueryParams:d.toString()})}" width="450" height="200" frameborder="0"></iframe>`}},51155:(ee,B,e)=>{"use strict";e.d(B,{l:()=>C,u:()=>E});var t=e(74848),n=e(5805),r=e(85629),o=e(68143),s=e(56838),m=e(37386),a=e(63527),l=e(77824),f=e(22787),h=e(45861),u=e(41654),i=e(47931),x=e(6890),g=e(64762),p=e(56840),c=e(58662),y=e(8735),P=e(8535),d=e(70030),D=e(23289);const b=r.Tp.pages.ShareDashboardModal.SnapshotScene,E=()=>{const O={label:(0,p.t)("share-modal.snapshot.expire-week","1 Week"),value:604800};return[{label:(0,p.t)("share-modal.snapshot.expire-hour","1 Hour"),value:60*60},{label:(0,p.t)("share-modal.snapshot.expire-day","1 Day"),value:60*60*24},O,{label:(0,p.t)("share-modal.snapshot.expire-never","Never"),value:0}]},v=()=>E()[2];class C extends s.Bs{constructor(I){super({...I,snapshotName:I.dashboardRef.resolve().state.title,selectedExpireOption:v()}),this.tabId=c.wr.snapshot,this.onSnasphotNameChange=R=>{this.setState({snapshotName:R})},this.onExpireChange=R=>{this.setState({selectedExpireOption:E().find(T=>T.value===R)})},this.onSnapshotCreate=async(R=!1)=>{const{selectedExpireOption:T}=this.state,L=this.prepareSnapshot(),K={dashboard:L,name:L.title,expires:T?.value,external:R};try{const A=await(0,y.s)().create(K);return(0,P.JD)((0,x.dx)((0,g.tZ)((0,p.t)("snapshot.share.success-creation","Your snapshot has been created")))),A}finally{R?D.c.publishSnapshotClicked({expires:K.expires,shareResource:(0,c.hD)(this.state.panelRef)}):D.c.publishSnapshotLocalClicked({expires:K.expires,shareResource:(0,c.hD)(this.state.panelRef)})}},this.onSnapshotDelete=async R=>{const T=await(0,o.AI)().get(R);return(0,P.JD)((0,x.dx)((0,g.tZ)((0,p.t)("snapshot.share.success-delete","Your snapshot has been deleted")))),T},this.addActivationHandler(()=>{this._onActivate()})}static{this.Component=S}_onActivate(){(0,y.s)().getSharingOptions().then(I=>{this.isActive&&this.setState({snapshotSharingOptions:I})})}getTabLabel(){return(0,p.t)("share-modal.tab-title.snapshot","Snapshot")}prepareSnapshot(){const I=s.jh.getTimeRange(this),{dashboardRef:R,panelRef:T}=this.state,L=(0,d.Uy)(R.resolve(),!0);return(0,d.c)(this.state.snapshotName.trim()||"",I.state.value,L,T?.resolve())}}function S({model:O}){const{snapshotName:I,selectedExpireOption:R,modalRef:T,snapshotSharingOptions:L}=O.useState(),[K,A]=(0,n.default)(async(w=!1)=>O.onSnapshotCreate(w)),[W,N]=(0,n.default)(async w=>await(0,o.AI)().get(w));return W.value?(0,t.jsx)(p.x6,{i18nKey:"share-modal.snapshot.deleted-message",children:"The snapshot has been deleted. If you have already accessed it once, then it might take up to an hour before before it is removed from browser caches or CDN caches."}):(0,t.jsxs)(t.Fragment,{children:[!K.value&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{children:(0,t.jsx)(p.x6,{i18nKey:"share-modal.snapshot.info-text-1",children:"A snapshot is an instant way to share an interactive dashboard publicly. When created, we strip sensitive data like queries (metric, template, and annotation) and panel links, leaving only the visible metric data and series n
202ames embedded in your dashboard."})}),(0,t.jsx)("p",{children:(0,t.jsxs)(p.x6,{i18nKey:"share-modal.snapshot.info-text-2",children:["Keep in mind, your snapshot ",(0,t.jsx)("em",{children:"can be viewed by anyone"})," that has the link and can access the URL. Share wisely."]})})]}),(0,t.jsx)(m.D,{label:(0,p.t)("share-modal.snapshot.name","Snapshot name"),children:(0,t.jsx)(a.p,{id:"snapshot-name-input",width:30,defaultValue:I,onBlur:w=>O.onSnasphotNameChange(w.target.value)})}),(0,t.jsx)(m.D,{label:(0,p.t)("share-modal.snapshot.expire","Expire"),children:(0,t.jsx)(l.z,{id:"expire-select-input",options:E(),value:R?.value,onChange:O.onExpireChange})}),(0,t.jsxs)(f.a.ButtonRow,{children:[(0,t.jsx)(h.$n,{variant:"secondary",onClick:()=>{T?.resolve().onDismiss()},fill:"outline",children:(0,t.jsx)(p.x6,{i18nKey:"share-modal.snapshot.cancel-button",children:"Cancel"})}),L?.externalEnabled&&(0,t.jsx)(h.$n,{variant:"secondary",disabled:K.loading,onClick:()=>A(!0),children:L?.externalSnapshotName}),(0,t.jsx)(h.$n,{variant:"primary",disabled:K.loading,onClick:()=>A(),"data-testid":b.PublishSnapshot,children:(0,t.jsx)(p.x6,{i18nKey:"share-modal.snapshot.local-button",children:"Publish Snapshot"})})]})]}),K.value&&(0,t.jsxs)(u.B,{direction:"column",gap:0,children:[(0,t.jsx)(m.D,{label:(0,p.t)("share-modal.snapshot.url-label","Snapshot URL"),children:(0,t.jsx)(a.p,{"data-testid":b.CopyUrlInput,id:"snapshot-url-input",value:K.value.url,readOnly:!0,addonAfter:(0,t.jsx)(i.b,{"data-testid":b.CopyUrlButton,icon:"copy",variant:"primary",getText:()=>K.value.url,children:(0,t.jsx)(p.x6,{i18nKey:"share-modal.snapshot.copy-link-button",children:"Copy"})})})}),(0,t.jsxs)("div",{style:{alignSelf:"flex-end",padding:"5px"},children:[(0,t.jsx)(p.x6,{i18nKey:"share-modal.snapshot.mistake-message",children:"Did you make a mistake? "}),"\xA0",(0,t.jsx)(h.$n,{fill:"outline",size:"md",variant:"destructive",onClick:()=>{N(K.value.deleteUrl)},children:(0,t.jsx)(p.x6,{i18nKey:"share-modal.snapshot.delete-button",children:"Delete snapshot."})})]})]})]})}},71748:(ee,B,e)=>{"use strict";e.d(B,{b:()=>f});var t=e(16817),n=e(36580),r=e(35143),o=e(28998),s=e(8285);const m=async h=>{let u=new Set;for(const i of h)r.z.has(i)&&await(0,o.tR)().get(i)instanceof n.iy||u.add(i);return Array.from(u)};function a(h){const u=new Set,i=h.state.body.getVizPanels();for(const x of i){const g=l(x);for(const p of g)u.add(p)}return Array.from(u).sort()}function l(h){const u=new Set,i=(0,s.un)(h);if(i)for(const x of i.state.queries)u.add(x.datasource?.type??"");return Array.from(u)}function f(h){const{value:u}=(0,t.A)(async()=>{const i=a(h);return m(i)},[]);return u}},33380:(ee,B,e)=>{"use strict";e.d(B,{R:()=>r});var t=e(56838),n=e(8285);class r{constructor(s){this._vizPanel=s}get id(){const s=(0,n.Cs)(this._vizPanel);return isNaN(s)?(console.error("VizPanel key could not be translated to a legacy numeric panel id",this._vizPanel),0):s}get description(){return this._vizPanel.state.description}get type(){return this._vizPanel.state.pluginId}get title(){return this._vizPanel.state.title}get transformations(){return this._vizPanel.state.$data instanceof t.Es?this._vizPanel.state.$data.state.transformations:[]}get targets(){const s=(0,n.un)(this._vizPanel);return s?s.state.queries:[]}get datasource(){return(0,n.un)(this._vizPanel)?.state.datasource}get options(){return this._vizPanel.state.options}get fieldConfig(){return this._vizPanel.state.fieldConfig}get pluginVersion(){return this._vizPanel.state.pluginVersion}}},3371:(ee,B,e)=>{"use strict";e.d(B,{Dq:()=>u,Lv:()=>g,Qp:()=>p,Ry:()=>l,ag:()=>x,d9:()=>a,ed:()=>i,lv:()=>m,oX:()=>f,uc:()=>h});var t=e(39385);const n="-clone-",r="/",o=new RegExp(`${n}[1-9][0-9]*$`),s=new RegExp(`${n}\\d+$`);function m(c,y){const P=c.split(r).slice(0,-1),d=a(u(c));return[...P,`${d}${n}${y}`].join(r)}function a(c){return u(c).replace(s,"")}function l(c){return o.test(u(c))}function f(c,y){return l(c)&&a(c)===a(y)}function h(c){return c.split(r).some(l)}function u(c){return c.split(r).pop()??""}function i(...c){return c.filter(Boolean).join(r)}function x(c){return c.includes(n)}function g(c){const{key:y}=c.useState();return l(y)}function p(c){return l(c.state.key)?!0:!c.parent||c.parent instanceof t.H$?!1:
202p(c.parent)}},18789:(ee,B,e)=>{"use strict";e.d(B,{w:()=>o});var t=e(43173),n=e(56838),r=e(36605);function o(s){if(!s.targets?.length||t.$.panels[s.type]?.skipDataQuery)return;let m;return m=new n.dt({datasource:s.datasource??void 0,queries:s.targets,maxDataPoints:s.maxDataPoints??void 0,maxDataPointsFromWidth:!0,cacheTimeout:s.cacheTimeout,queryCachingTTL:s.queryCachingTTL,minInterval:s.interval??void 0,dataLayerFilter:{panelId:s.id},$behaviors:[new r.L({})]}),new n.Es({$data:m,transformations:s.transformations||[]})}},1682:(ee,B,e)=>{"use strict";e.d(B,{b4:()=>p});var t=e(56838),n=e(88632),r=e(32540),o=e(3371),s=e(8285);function m(c){return c.state.controls?.state.timePicker}function a(c){return c.state.controls?.state.refreshPicker}function l(c){return c.state.titleItems&&Array.isArray(c.state.titleItems)?c.state.titleItems.find(P=>P instanceof r.$)??null:null}function f(c){return c.state.body.getVizPanels()}function h(c){let y=0;return t.jh.findAllObjects(c.getRoot(),P=>P instanceof t.Eb||P instanceof t.tI).forEach(P=>{if((0,o.Ry)(P.state.key))return;const d=(0,s.Cs)(P);d>y&&(y=d)}),y+1}function u(c){const y=t.jh.getData(c);if(!(y instanceof n.s))throw new Error("DashboardDataLayerSet not found");return y}function i(c){return(0,s.YQ)(c).state.editPane.state.selection?.getSelectionEntries().map(([,y])=>y.resolve())??[]}function x(c){const y=c.state.$behaviors?.find(P=>P instanceof t.Gg.K2);if(y instanceof t.Gg.K2)return y}function g(c){const y=(0,s.YQ)(c),P=(0,s.Cs)(c);let d=y.serializer.getElementIdForPanel(P);return d||(d=(0,s.XA)(P)),d}const p={getTimePicker:m,getRefreshPicker:a,getPanelLinks:l,getVizPanels:f,getDataLayers:u,getAllSelectedObjects:i,getCursorSync:x,getLayoutManagerFor:s.h$,getNextPanelId:h,getElementIdentifierForVizPanel:g}},17788:(ee,B,e)=>{"use strict";e.d(B,{Gq:()=>m,zf:()=>a});var t=e(5556),n=e(36490),r=e(43173),o=e(56838);const s="grafana.dashboard.preservedUrlFiltersState";function m(l){const f=window.sessionStorage.getItem(s);if(f){const h=new URLSearchParams(f),u=n.Ny.getSearch();h.forEach((x,g)=>{u.has(g)||u.append(g,x)});for(const x of Array.from(u.keys()))x.startsWith("var-")&&(l.state.$variables?.getByName(x.replace("var-",""))||u.delete(x));const i=u.toString();i&&n.Ny.replace({search:i})}}function a(l){if(r.$.featureToggles.preserveDashboardStateWhenNavigating)return()=>{if(!l.state.uid)return;const f=Object.fromEntries(Object.entries(new o.g5().getUrlState(l)).filter(([u])=>u.startsWith("var-")||u==="from"||u==="to"||u==="timezone")),h=Object.fromEntries(Object.entries(f).filter(([u,i])=>!(Array.isArray(i)&&i.length===0)));Object.keys(h).length>0?window.sessionStorage.setItem(s,t.kM.renderUrl("",h)):window.sessionStorage.removeItem(s)}}},52043:(ee,B,e)=>{"use strict";e.d(B,{u:()=>o});var t=e(5556),n=e(36490),r=e(43173);function o(s){let m=`/d/${s.uid}`;s.uid||(m="/dashboard/new"),s.isSnapshot&&(m=`/dashboard/snapshot/${s.uid}`),s.soloRoute&&(m=`/d-solo/${s.uid}`),s.slug&&(m+=`/${s.slug}`),s.subPath&&(m+=s.subPath),s.render&&(m="/render"+m,s.updateQuery={...s.updateQuery,width:s.updateQuery?.width||1e3,height:s.updateQuery?.height||500,tz:s.timeZone}),s.isHomeDashboard&&(m="/");const a=s.currentQueryParams?(0,n.SE)(s.currentQueryParams):{};if(delete a.shareView,s.updateQuery)for(const f in s.updateQuery)s.updateQuery[f]===null||s.updateQuery[f]===void 0?delete a[f]:a[f]=s.updateQuery[f];const l=t.kM.renderUrl(m,a);return s.absolute?r.$.appUrl+l.slice(1):l}},13241:(ee,B,e)=>{"use strict";e.d(B,{E:()=>r});var t=e(56838),n=e(84500);function r(o){const s=t.jh.getVariables(o);return(0,n.C)(s,!0)}},23289:(ee,B,e)=>{"use strict";e.d(B,{c:()=>r});var t=e(27489);let n=!1;const r={dashboardInitialized:s=>{o("init_dashboard_completed",{...s})},panelLinkClicked:s=>{o("panelheader_datalink_clicked",s)},panelStatusMessageClicked:s=>{o("panelheader_statusmessage_clicked",s)},panelCancelQueryClicked:s=>{o("panelheader_cancelquery_clicked",s)},toolbarFavoritesClick:()=>{o("toolbar_actions_clicked",{item:"favorites"})},toolbarSettingsClick:()=>{o("toolbar_actions_clicked",{item:"settings"})},toolbarShareClick:()=>{o("toolbar_actions_clicked",{item:"share"})},toolbarShareDropdownClick:()=>{o("toolbar_actions_clicked",{item:"share_dropdown"})},toolbarAddClick:()=>{o("toolbar_actions_clicked",{item:"add"})},sharingCategoryClicked:s=>{o("sharing_category_clicked",s)},shareLinkCopied:s=>{o("sharing_link_copy_clicked",s)},embedSnippetCopy:s=>{o("sharing_embed_copy_clicked",s)},generatePanelImageClicked:s=>{o("sharing_link_generate_image_clicked",s)},downloadPanelImageClicked:s=>{o("sharing_link_download_image_clicked",s)}
202,publishSnapshotClicked:s=>{o("sharing_snapshot_publish_clicked",s)},publishSnapshotLocalClicked:s=>{o("sharing_snapshot_local_clicked",s)},exportDownloadJsonClicked:s=>{o("sharing_export_download_json_clicked",s)},exportCopyJsonClicked:s=>{o("sharing_export_copy_json_clicked",s)},exportSaveJsonClicked:s=>{o("sharing_export_save_json_clicked",s)},exportViewJsonClicked:s=>{o("sharing_export_view_json_clicked",s)},generatePublicDashboardUrlClicked:s=>{o("sharing_public_generate_url_clicked",s)},revokePublicDashboardEmailClicked:s=>{o("sharing_public_email_revoke_clicked",s)},resendPublicDashboardEmailClicked:s=>{o("sharing_public_email_resend_clicked",s)},publicDashboardEmailInviteClicked:s=>{o("sharing_public_email_invite_clicked",s)},publicDashboardShareTypeChange:s=>{o("sharing_public_can_view_clicked",s)},publicDashboardTimeSelectionChanged:s=>{o("sharing_public_time_picker_clicked",s)},publicDashboardAnnotationsSelectionChanged:s=>{o("sharing_public_annotations_clicked",s)},publicDashboardUrlCopied:s=>{o("sharing_public_copy_url_clicked",s)},publicDashboardPauseSharingClicked:s=>{o("sharing_public_pause_clicked",s)},revokePublicDashboardClicked:s=>{o("sharing_public_revoke_clicked",s)},emptyDashboardButtonClicked:s=>{o("emptydashboard_clicked",s)},toolbarAddButtonClicked:s=>{o("toolbar_add_clicked",s)},setScenesContext:()=>(n=!0,()=>{n=!1}),versionRestoreClicked:s=>{o("version_restore_clicked",s)},showMoreVersionsClicked:()=>{o("show_more_versions_clicked")}},o=(s,m)=>{const a=n?{scenesView:!0}:{};m?(0,t.rR)(`dashboards_${s}`,{...m,...a}):(0,t.rR)(`dashboards_${s}`)}},75541:(ee,B,e)=>{"use strict";e.d(B,{C:()=>t,Y:()=>n});const t={left:[],right:[]};function n(r,o){t[r].push(o)}},22079:(ee,B,e)=>{"use strict";e.d(B,{Lp:()=>h,Uu:()=>f,e0:()=>l,r7:()=>a});var t=e(92138),n=e(36490),r=e(56838),o=e(73427),s=e(62635),m=e(8285);function a(u){return t.I.getUrlForPartial(n.Ny.getLocation(),{viewPanel:u.state.key,editPanel:void 0})}function l(u){return t.I.getUrlForPartial(n.Ny.getLocation(),{editPanel:u,viewPanel:void 0})}function f(u,i){const x=u.state.key?.replace("-view","");return t.I.getUrlForPartial(n.Ny.getLocation(),{inspect:x,inspectTab:i})}function h(u){const i=u.getPlugin(),x=(0,m.un)(u);if(!o.TP.hasAccessToExplore()||i?.meta.skipDataQuery||!x)return Promise.resolve(void 0);const g=r.jh.getTimeRange(u);return(0,s.Xe)({queries:x.state.queries,dsRef:x.state.datasource,timeRange:g.state.value,scopedVars:{__sceneObject:{value:u}},adhocFilters:x.state.data?.request?.filters})}},8285:(ee,B,e)=>{"use strict";e.d(B,{sw:()=>c,vm:()=>y,sf:()=>V,bR:()=>j,Uv:()=>C,EX:()=>E,vL:()=>D,zo:()=>U,X0:()=>S,xz:()=>A,pk:()=>T,YQ:()=>K,O8:()=>W,ty:()=>H,Sm:()=>I,bx:()=>R,h$:()=>M,wP:()=>te,iL:()=>w,a7:()=>O,Cs:()=>d,un:()=>L,XA:()=>P,ME:()=>N,MZ:()=>_,TN:()=>Z,hg:()=>ne});var t=e(48480),n=e(43173),r=e(78282),o=e(56838),s=e(56840),m=e(98732),a=e(36605),l=e(39385),f=e(7094),h=e(32540),u=e(37040),i=e(29700),x=e(35718);function g(Y){return"isDashboardLayoutManager"in Y}var p=e(3371);const c=8,y=12;function P(Y){return`panel-${Y}`}function d(Y){return parseInt((0,p.d9)(Y.state.key).replace("panel-",""),10)}function D(Y,Q){if(!Q)return null;const J=b(Y,Q);if(J)return J;const q=parseInt(Q,10);return isNaN(q)?null:b(Y,P(q))}function b(Y,Q){if(!Q)return null;const J=o.jh.findObject(Y,q=>q.state.key===Q?!0:(q instanceof o.Eb,!1));if(J){if(J instanceof o.Eb)return J;throw new Error(`Found panel with key ${Q} but it was not a VizPanel`)}return null}function E(Y,Q){if(!Q)return null;let J=v(Y,Q);if(J)return J;const q=parseInt(Q,10);if(isNaN(q))return null;const X=P(q);return J=b(Y,X),J||(J=v(Y,X),J)}function v(Y,Q){if(!Q)return null;const J=o.jh.findObject(Y,q=>{const X=q.state.key;return X===Q||!(0,p.uc)(X)&&(0,p.d9)(X)===(0,p.d9)(Q)?!0:(q instanceof o.Eb,!1)});if(J){if(J instanceof o.Eb)return J;throw new Error(`Found panel with key ${Q} but it was not a VizPanel`)}return null}function C(Y,Q){if(!Q)return null;let J=E(Y,Q);if(!J||!J.state.key)return null;const q=(0,p.Dq)(J.state.key);if((0,p.ag)(q)){const X=(0,p.d9)(q);J=o.jh.findObject(J.parent??Y,se=>{if(!se.state.key||(0,p.uc)(se.state.key))return!1;const oe=(0,p.Dq)(se.state.key);return(0,p.ag)(oe)?!1:(0,p.d9)(oe)===X})}return J instanceof o.Eb?J:null}function S(Y,Q){Y.forEachChild(J=>{J.isActive&&(J.forceRender(),S(J,Q))})}function O(Y){const{value:Q,text:J,options:q}=Y.state;return Y.hasAllValue()?{values:q.map(X=>X.value),texts:q.map(X=>X.label)}:{values:Array.isArray(Q)?Q:[Q],texts:Array.isArray(J)?J:[J]}}function I(Y){const Q=Y.match(/(["'])(.*?)\1|\w+/g);if(!Q)return m.Ez.query?.split(",")??[];const J=new Set,q=Q.reduce((X,se)=>{const oe=se.replace(/["']+/g,"");return oe.startsWith("$__auto_interval_")||X.add(oe),X},J);return Array.from(q)}function R(Y){return Array.isArray(Y)?Y.join(","):""}function T(Y,Q){const J=Array.isArray(Y.current.value)?Y.current.value[0]:Y.current.value;return J.startsWith("$__auto_interval_")||J==="$__auto"?"$__auto":Q.includes(J)?J:Q[0]}function L(Y){if(!Y)return;const Q=Y.state.$data??Y.parent?.state.$data;if(Q instanceof o.dt)return Q;if(Q instanceof o.Es)return L(Q)}function K(Y){const Q=Y.getRoot();if(Q instanceof l.H$)return Q;throw new Error("SceneObject root is not a DashboardScene")}function A(Y){return Y instanceof o.Eb?Y:Y.parent?A(Y.parent):null}function W(){const Y=n.$.featureToggles.dashboardNewLayouts?i.r:"timeseries",Q=(0,s.t)("dashboard.new-panel-title","New panel");return new o.Eb({title:Q,pluginId:Y,seriesLimit:n.$.panelSeriesLimit,titleItems:[new h.$({menu:new h.m({})})],hoverHeaderOffset:0,$behaviors:[],extendPanelContext:x.C,menu:new o.Lw({$behaviors:[u._i]}),$data:new o.Es({$data:new o.dt({queries:[{refId:"A"}],datasource:(0,t.p$)((0,r.l)().getInstanceSettings(null)),$behaviors:[new a.L({})]}),transformations:[]})})}function N(Y){return w(Y)!==void 0}function w(Y){const Q=Y.state.$behaviors?.find(J=>J instanceof f.u);if(Q)return Q}function j(Y){const Q=Math.ceil(Y.state.repeatedPanels.length/Y.getMaxPerRow()),J=Math.ceil(Y.state.repeatedPanels.length/Q),q=24/J;return{h:Y.state.itemHeight??10,w:q,columnCount:J}}function V(Y){let Q,J;
202return Y.isActive?Q:(Y.parent&&(J=V(Y.parent)),Q=Y.activate(),()=>{J?.(),Q()})}function U(Y){let Q,J;return Y.parent&&(J=U(Y.parent)),Y.isActive?()=>{J?.(),Q?.()}:(Q=Y.activate(),()=>{J?.(),Q?.()})}const F=null;function M(Y){let Q=Y.parent;for(;Q;){if(g(Q))return Q;Q=Q.parent}throw new Error("Could not find layout manager for scene object")}function H(Y){return`grid-item-${Y}`}function _(Y){return K(Y)}function Z(Y){return _(Y).useState()}function ne(Y){const{title:Q}=Y.useState();return Q?o.jh.interpolate(Y,Q,void 0,"text"):""}function te(Y){return K(Y).state.layoutOrchestrator}},50803:(ee,B,e)=>{"use strict";e.d(B,{Op:()=>x,Sb:()=>w});var t=e(43173),n=e(21275),r=e(78947),o=e(5857),s=e(75735),m=e(78320),a=e(62265),l=e(3281),f=e(39508),h=e(60171);function u(j){if((0,h.HG)(j))return j;let V;(0,h.b_)(j)?V=j.spec:V=j.dashboard;const U=(0,r.ft)(),F=(0,r.xE)(),[M,H]=g(V.panels||[]),_=S(V.templating?.list||[]),Z=O(V.annotations?.list||[]);let ne,te,Y,Q;(0,h.b_)(j)?(ne=j.access,te={...j.metadata.annotations,[s.hm]:V.gnetId??void 0},Q=j.metadata.creationTimestamp,Y={[s.Y5]:j.metadata.labels?.[s.Y5]}):(ne={url:j.meta.url,slug:j.meta.slug,canSave:j.meta.canSave,canEdit:j.meta.canEdit,canDelete:j.meta.canDelete,canShare:j.meta.canShare,canStar:j.meta.canStar,canAdmin:j.meta.canAdmin,annotationsPermissions:j.meta.annotationsPermissions},te={[s.hc]:j.meta.createdBy,[s.Qu]:j.meta.updatedBy,[s.xU]:j.meta.updated,[s.ew]:j.meta.folderUid,[s.hX]:j.meta.slug,[s.hm]:V.gnetId??void 0,[s.qw]:j.meta.isSnapshot},Q=j.meta.created,Y={[s.Y5]:V.id?.toString()??void 0}),te?.[s.qw]&&(te[s.UL]=V.snapshot?.originalUrl);const J={title:V.title,description:V.description,tags:V.tags??[],cursorSync:(0,f.k6)(V.graphTooltip),preload:V.preload||F.preload,liveNow:V.liveNow,editable:V.editable,revision:V.revision,timeSettings:{from:V.time?.from||U.from,to:V.time?.to||U.to,timezone:V.timezone||U.timezone,autoRefresh:V.refresh||U.autoRefresh,autoRefreshIntervals:V.timepicker?.refresh_intervals||U.autoRefreshIntervals,fiscalYearStartMonth:V.fiscalYearStartMonth||U.fiscalYearStartMonth,hideTimepicker:V.timepicker?.hidden||U.hideTimepicker,quickRanges:V.timepicker?.quick_ranges,weekStart:c(V.weekStart,U.weekStart),nowDelay:V.timepicker?.nowDelay||U.nowDelay},links:V.links||[],annotations:Z,variables:_,elements:M,layout:H};return{apiVersion:"v2alpha1",kind:"DashboardWithAccessInfo",metadata:{creationTimestamp:Q||"",name:V.uid,resourceVersion:V.version?.toString()||"0",annotations:te,labels:Y},spec:J,access:ne}}function i(j){if(!(0,h.b_)(j))return j;const V=j.spec;return(0,h._5)(V)?{meta:{...j.access,isNew:!1,isFolder:!1,uid:j.metadata.name,k8s:j.metadata,version:j.metadata.generation},dashboard:V}:{meta:{created:j.metadata.creationTimestamp,createdBy:j.metadata.annotations?.[s.hc]??"",updated:j.metadata.annotations?.[s.xU],updatedBy:j.metadata.annotations?.[s.Qu],folderUid:j.metadata.annotations?.[s.ew],slug:j.metadata.annotations?.[s.hX],url:j.access.url,canAdmin:j.access.canAdmin,canDelete:j.access.canDelete,canEdit:j.access.canEdit,canSave:j.access.canSave,canShare:j.access.canShare,canStar:j.access.canStar,annotationsPermissions:j.access.annotationsPermissions},dashboard:w(V,j.metadata)}}const x={ensureV2Response:u,ensureV1Response:i};function g(j){const V={},U={kind:"GridLayout",spec:{items:[]}};if(!j)return[V,U];let F=null;for(const M of j)if(p(M)){F&&U.spec.items.push(F);const H=[];for(const _ of M.panels||[]){const[Z,ne]=D(_);V[ne]=Z,H.push(P(_,ne,d(_,M.gridPos.y)))}F=y(M,H)}else{const[H,_]=D(M);V[_]=H,F?F.spec.elements.push(P(M,_,d(M,F.spec.y))):U.spec.items.push(P(M,_))}return F&&U.spec.items.push(F),[V,U]}function p(j){return j.type==="row"}function c(j,V){return!j||!(0,o.rE)(j)?V:j}function y(j,V){return{kind:"GridLayoutRow",spec:{collapsed:j.collapsed,title:j.title??"",repeat:j.repeat?{value:j.repeat,mode:"variable"}:void 0,y:j.gridPos?.y??0,elements:V}}}function P(j,V,U){return{kind:"GridLayoutItem",spec:{x:j.gridPos.x,y:U??j.gridPos.y,width:j.gridPos.w,height:j.gridPos.h,repeat:j.repeat?{value:j.repeat,mode:"variable",direction:j.repeatDirection,maxPerRow:j.maxPerRow}:void 0,element:{kind:"ElementReference",name:V}}}}function d(j,V){return j.gridPos.y-V-m.o}function D(j){const V=`panel-${j.id}`;if(j.libraryPanel)return[{kind:"LibraryPanel",spec:{libraryPanel:{uid:j.libraryPanel.uid,name:j.libraryPanel.name},id:j.id,title:j.title??""}},V];{const U=v(j.targets||[],j.datasource||E()),F=C(j.transformations||[]);return[{kind:"Panel",spec:{title:j.title||"",description:j.description||"",vizConfig:{kind:j.type,spec:{fieldConfig:j.fieldConfig||(0,r.bt)(),options:j.options,pluginVersion:j.pluginVersion}},links:j.links?.map(H=>({title:H.title,url:H.url||"",targetBlank:H.targetBlank}
202))||[],id:j.id,data:{kind:"QueryGroup",spec:{queries:U,transformations:F,queryOptions:{cacheTimeout:j.cacheTimeout,maxDataPoints:j.maxDataPoints,interval:j.interval,hideTimeOverride:j.hideTimeOverride,queryCachingTTL:j.queryCachingTTL,timeFrom:j.timeFrom,timeShift:j.timeShift}}}}},V]}}function b(){return(0,a.Ic)()?.type??"grafana"}function E(){const j=(0,a.Ic)()??{type:"grafana",uid:"-- Grafana --"};if(j.uid&&!j.apiVersion){const V=t.$.bootData.settings.datasources[j.uid];j.apiVersion=V.apiVersion??void 0}return{apiVersion:j.apiVersion,type:j.type,uid:j.uid}}function v(j,V){return j.map(U=>{const{refId:F,hide:M,datasource:H,..._}=U;return{kind:"PanelQuery",spec:{refId:U.refId,hidden:U.hide??!1,datasource:U.datasource?U.datasource:V,query:{kind:U.datasource?.type||V.type,spec:{..._}}}}})}function C(j){return j.map(V=>({kind:V.id,spec:{...V,topic:(0,f.MM)(V.topic)}}))}function S(j){const V=[];for(const U of j){const F={name:U.name,label:U.label,...U.description&&{description:U.description},skipUrlSync:!!U.skipUrlSync,hide:(0,f.NB)(U.hide)};switch(U.type){case"query":let M=U.query||{};typeof M=="string"&&(console.warn("Query variable query is a string which is deprecated in the schema v2. It should extend DataQuery"),M={[f.sB]:M});const H={kind:"QueryVariable",spec:{...F,multi:!!U.multi,includeAll:!!U.includeAll,...U.allValue&&{allValue:U.allValue},current:{value:U.current?.value,text:U.current?.text},options:U.options||[],refresh:(0,f.qJ)(U.refresh),...U.datasource&&{datasource:U.datasource},regex:U.regex||"",sort:(0,f.LY)(U.sort),query:{kind:U.datasource?.type||b(),spec:M}}};V.push(H);break;case"datasource":let _=b();U.query&&typeof U.query=="string"&&(_=U.query);const Z={kind:"DatasourceVariable",spec:{...F,multi:!!U.multi,includeAll:!!U.includeAll,...U.allValue&&{allValue:U.allValue},current:{value:U.current.value,text:U.current.text},options:U.options||[],refresh:(0,f.qJ)(U.refresh),pluginId:_,regex:U.regex||""}};V.push(Z);break;case"custom":const ne={kind:"CustomVariable",spec:{...F,query:U.query,current:{value:U.current.value,text:U.current.text},options:U.options,multi:U.multi,includeAll:U.includeAll,...U.allValue&&{allValue:U.allValue}}};V.push(ne);break;case"adhoc":const te={kind:"AdhocVariable",spec:{...F,datasource:U.datasource||E(),baseFilters:U.baseFilters||[],filters:U.filters||[],defaultKeys:U.defaultKeys||[]}};V.push(te);break;case"constant":const Y={kind:"ConstantVariable",spec:{...F,current:{value:U.current.value,text:U.current.value},query:U.query}};V.push(Y);break;case"interval":const Q={kind:"IntervalVariable",spec:{...F,current:{value:U.current.value,text:U.current.value},query:U.query,refresh:"onTimeRangeChanged",options:U.options,auto:U.auto,auto_min:U.auto_min,auto_count:U.auto_count}};V.push(Q);break;case"textbox":const J={kind:"TextVariable",spec:{...F,current:{value:U.current.value,text:U.current.value},query:U.query}};V.push(J);break;case"groupby":const q={kind:"GroupByVariable",spec:{...F,datasource:U.datasource||E(),options:U.options,current:{value:U.current.value,text:U.current.text},multi:U.multi}};V.push(q);break;default:console.error(`Variable transformation not implemented: ${U.type}`)}}return V}function O(j){return j.map(V=>({kind:"AnnotationQuery",spec:{name:V.name,...V.datasource&&{datasource:V.datasource},enable:V.enable,hide:!!V.hide,iconColor:V.iconColor,builtIn:!!V.builtIn,query:{kind:V.datasource?.type||b(),spec:{...V.target}},filter:V.filter}}))}function I(j){const V=[];for(const U of j){const F={name:U.spec.name,label:U.spec.label,...U.spec.description&&{description:U.spec.description},skipUrlSync:U.spec.skipUrlSync,hide:(0,l.cc)(U.spec.hide),type:N(U)};switch(U.kind){case"QueryVariable":const M={...F,current:U.spec.current,options:U.spec.options,query:f.sB in U.spec.query.spec?U.spec.query.spec[f.sB]:U.spec.query.spec,datasource:U.spec.datasource,sort:(0,l.ES)(U.spec.sort),refresh:(0,l.tH)(U.spec.refresh),regex:U.spec.regex,allValue:U.spec.allValue,includeAll:U.spec.includeAll,multi:U.spec.multi,definition:U.spec.definition};V.push(M);break;case"DatasourceVariable":const H={...F,current:U.spec.current,options:[],regex:U.spec.regex,refresh:(0,l.tH)(U.spec.refresh),query:U.spec.pluginId,multi:U.spec.multi,allValue:U.spec.allValue,includeAll:U.spec.includeAll};V.push(H);break;case"CustomVariable":const _={...F,current:{text:U.spec.current.value,value:U.spec.current.value},options:U.spec.options,query:U.spec.query,multi:U.spec.multi,allValue:U.spec.allValue,includeAll:U.spec.includeAll};V.push(_);break;case"ConstantVariable":const Z={...F,current:{text:U.spec.current.value,value:U.spec.current.value},hide:(0,l.cc)(U.spec.hide),query:U.spec.current.value};V.push(Z);break;case"IntervalVariable":const ne={...F,current:{text:U.spec.current.value,value:U.spec.current.value},hide:(0,l.cc)(U.spec.hide),query:U.spec.query,refresh:(0,l.tH)(U.spec.refresh),options:U.spec.options,auto:U.spec.auto,auto_min:U.spec.auto_min,auto_count:U.spec.auto_count};V.push(ne);break;case"TextVariable":const te={text:U.spec.current.value,value:U.spec.current.value},Y={...F,current:{text:U.spec.current.value,value:U.spec.current.value},options:[{...te,selected:!0}],query:U.spec.query};V.push(Y);break;case"GroupByVariable":const Q={...F,datasource:U.spec.datasource,current:U.spec.current,options:U.spec.options};
202V.push(Q);break;case"AdhocVariable":const J={...F,datasource:U.spec.datasource,baseFilters:U.spec.baseFilters,filters:U.spec.filters,defaultKeys:U.spec.defaultKeys};V.push(J);break;default:console.error(`Variable transformation not implemented: ${U}`)}}return V}function R(j){return j.map(V=>({name:V.spec.name,datasource:V.spec.datasource,enable:V.spec.enable,hide:V.spec.hide,iconColor:V.spec.iconColor,builtIn:V.spec.builtIn?1:0,target:V.spec.query?.spec,filter:V.spec.filter}))}function T(j,V){const U=[];let F=0;if(V.kind!=="GridLayout")throw new Error("Cannot convert non-GridLayout layout to v1");for(const M of V.spec.items)if(M.kind==="GridLayoutItem"){const H=j[M.spec.element.name],_=L(H,M);U.push(_),(_.id??0>F)&&(F=_.id??0)}else if(M.kind==="GridLayoutRow"){const H={id:-1,type:"row",title:M.spec.title,collapsed:M.spec.collapsed,repeat:M.spec.repeat?M.spec.repeat.value:void 0,gridPos:{x:0,y:M.spec.y,w:24,h:m.o},panels:[]},_=[];for(const Z of M.spec.elements){const ne=j[Z.spec.element.name],te=L(ne,Z,M.spec.y+m.o+Z.spec.y);_.push(te),(te.id??0>F)&&(F=te.id??0)}M.spec.collapsed?(H.panels=_,U.push(H)):(U.push(H),U.push(..._))}for(const M of U)M.type==="row"&&M.id===-1&&(M.id=++F);return U}function L(j,V,U){const{x:F,y:M,width:H,height:_,repeat:Z}=V?.spec||{x:0,y:0,width:0,height:0},ne={x:F,y:U??M,w:H,h:_};if(j.kind==="Panel"){const te=j.spec;return{id:te.id,type:te.vizConfig.kind,title:te.title,description:te.description,fieldConfig:K(te.vizConfig.spec.fieldConfig),options:te.vizConfig.spec.options,pluginVersion:te.vizConfig.spec.pluginVersion,links:te.links?.map(Y=>({title:Y.title,url:Y.url,...Y.targetBlank&&{targetBlank:Y.targetBlank}}))||[],targets:te.data.spec.queries.map(Y=>({refId:Y.spec.refId,hide:Y.spec.hidden,datasource:Y.spec.datasource,...Y.spec.query.spec})),transformations:te.data.spec.transformations.map(Y=>Y.spec),gridPos:ne,cacheTimeout:te.data.spec.queryOptions.cacheTimeout,maxDataPoints:te.data.spec.queryOptions.maxDataPoints,interval:te.data.spec.queryOptions.interval,hideTimeOverride:te.data.spec.queryOptions.hideTimeOverride,queryCachingTTL:te.data.spec.queryOptions.queryCachingTTL,timeFrom:te.data.spec.queryOptions.timeFrom,timeShift:te.data.spec.queryOptions.timeShift,transparent:te.transparent,...Z?.value&&{repeat:Z.value},...Z?.direction&&{repeatDirection:Z.direction},...Z?.maxPerRow&&{maxPerRow:Z.maxPerRow}}}else if(j.kind==="LibraryPanel"){const te=j.spec;return{id:te.id,title:te.title,gridPos:ne,libraryPanel:{uid:te.libraryPanel.uid,name:te.libraryPanel.name},type:"library-panel-ref"}}else throw new Error(`Unknown element kind: ${j}`)}function K(j){const V=F=>{switch(F){case"absolute":return n.Ol.Absolute;case"percentage":return n.Ol.Percentage;default:return n.Ol.Absolute}},U={...j.defaults};return j.defaults.mappings&&(U.mappings=j.defaults.mappings.map(F=>{switch(F.type){case"value":return{...F,type:n.dM.ValueToText};case"range":return{...F,type:n.dM.RangeToText};case"regex":return{...F,type:n.dM.RegexToText};case"special":return{...F,options:{...F.options,match:W(F.options.match)},type:n.dM.SpecialValue};default:return F}})),j.defaults.thresholds&&(U.thresholds={...j.defaults.thresholds,mode:V(j.defaults.thresholds.mode)}),j.defaults.color?.mode&&(U.color={...j.defaults.color,mode:A(j.defaults.color.mode)}),{...j,defaults:U}}function A(j){switch(j){case"thresholds":return n.Yb.Thresholds;case"palette-classic":return n.Yb.PaletteClassic;case"palette-classic-by-name":return n.Yb.PaletteClassicByName;case"continuous-GrYlRd":return n.Yb.ContinuousGrYlRd;case"continuous-RdYlGr":return n.Yb.ContinuousRdYlGr;case"continuous-BlYlRd":return n.Yb.ContinuousBlYlRd;case"continuous-YlRd":return n.Yb.ContinuousYlRd;case"continuous-BlPu":return n.Yb.ContinuousBlPu;case"continuous-YlBl":return n.Yb.ContinuousYlBl;case"continuous-blues":return n.Yb.ContinuousBlues;case"continuous-reds":return n.Yb.ContinuousReds;case"continuous-greens":return n.Yb.ContinuousGreens;case"continuous-purples":return n.Yb.ContinuousPurples;case"fixed":return n.Yb.Fixed;case"shades":return n.Yb.Shades;default:return n.Yb.Thresholds}}function W(j){switch(j){case"true":return n.WL.True;case"false":return n.WL.False;case"null":return n.WL.Null;case"nan":return n.WL.NaN;case"null+nan":return n.WL.NullAndNan;case"empty":return n.WL.Empty;default:throw new Error(`Unknown match type: ${j}`)}}function N(j){switch(j.kind){case"QueryVariable":return"query";case"DatasourceVariable":return"datasource";case"CustomVariable":return"custom";case"ConstantVariable":return"constant";case"IntervalVariable":return"interval";case"TextVariable":return"textbox";case"GroupByVariable":return"groupby";case"AdhocVariable":return"adhoc";default:throw new Error(`Unknown variable type: ${j}`)}}function w(j,V){const U=R(j.annotations),F=I(j.variables),M=T(j.elements,j.layout);
202return{uid:V.name,title:j.title,description:j.description,tags:j.tags,schemaVersion:40,graphTooltip:(0,l.Y_)(j.cursorSync),preload:j.preload,liveNow:j.liveNow,editable:j.editable,gnetId:V.annotations?.[s.hm],revision:j.revision,time:{from:j.timeSettings.from,to:j.timeSettings.to},timezone:j.timeSettings.timezone,refresh:j.timeSettings.autoRefresh,timepicker:{refresh_intervals:j.timeSettings.autoRefreshIntervals,hidden:j.timeSettings.hideTimepicker,quick_ranges:j.timeSettings.quickRanges,nowDelay:j.timeSettings.nowDelay},fiscalYearStartMonth:j.timeSettings.fiscalYearStartMonth,weekStart:j.timeSettings.weekStart,version:V.generation,links:j.links,annotations:{list:U},panels:M,templating:{list:F}}}},18646:(ee,B,e)=>{"use strict";e.d(B,{n:()=>D});var t=e(95407),n=e(60171),r=e(92138),o=e(83873),s=e(47797),m=e(77197),a=e(54115),l=e(75735),f=e(52043);class h{constructor(){this.client=new a.ws({group:"dashboard.grafana.app",version:"v1beta1",resource:"dashboards"})}saveDashboard(E){const v=E.dashboard,C={metadata:{...E?.k8s},spec:{...v}};return E.message?C.metadata.annotations={...C.metadata.annotations,[l.fY]:E.message}:C.metadata.annotations&&delete C.metadata.annotations[l.fY],E.folderUid&&(C.metadata.annotations={...C.metadata.annotations,[l.ew]:E.folderUid}),v.uid?(C.metadata.name=v.uid,this.client.update(C,{fieldValidation:"Ignore"}).then(S=>this.asSaveDashboardResponseDTO(S))):(C.metadata.annotations={...C.metadata.annotations,[l.AI]:"default"},this.client.create(C,{fieldValidation:"Ignore"}).then(S=>this.asSaveDashboardResponseDTO(S)))}asSaveDashboardResponseDTO(E){const v=r.I.assureBaseUrl((0,f.u)({uid:E.metadata.name,currentQueryParams:"",slug:m.A.slugifyForUrl(E.spec.title.trim())}));return{uid:E.metadata.name,version:E.spec.version??0,id:E.spec.id??0,status:"success",url:v,slug:""}}deleteDashboard(E,v){return this.client.delete(E,v).then(C=>({id:0,message:C.message,title:"deleted"}))}async getDashboardDTO(E){try{const v=await this.client.subresource(E,"dto");if(v.status?.conversion?.failed&&v.status.conversion.storedVersion==="v2alpha1")throw new t.P(v.status.conversion.storedVersion,v.status.conversion.error);const C={meta:{...v.access,isNew:!1,isFolder:!1,uid:v.metadata.name,k8s:v.metadata,version:v.metadata.generation},dashboard:{...v.spec,version:v.metadata.generation,uid:v.metadata.name}};if(v.metadata.labels?.[l.Y5]&&(C.dashboard.id=parseInt(v.metadata.labels[l.Y5],10)),v.metadata.annotations?.[l.ew])try{const S=await o.IB.getFolderByUid(v.metadata.annotations[l.ew]);C.meta.folderTitle=S.title,C.meta.folderUrl=S.url,C.meta.folderUid=S.uid,C.meta.folderId=S.id}catch{throw new Error("Failed to load folder")}return C}catch(v){const C=(0,s.do)(v);throw(0,s.q6)(v).includes("not found")&&C!==404&&(v.status=404,v.data.message="Dashboard not found"),v}}}class u{constructor(){this.client=new a.ws({group:"dashboard.grafana.app",version:"v2alpha1",resource:"dashboards"})}async getDashboardDTO(E){try{const v=await this.client.subresource(E,"dto");if(v.status?.conversion?.failed&&(v.status.conversion.storedVersion==="v1alpha1"||v.status.conversion.storedVersion==="v1beta1"||v.status.conversion.storedVersion==="v0alpha1"))throw new t.P(v.status.conversion.storedVersion,v.status.conversion.error);if(v.metadata.annotations&&v.metadata.annotations[l.ew])try{const C=await o.IB.getFolderByUid(v.metadata.annotations[l.ew]);v.metadata.annotations[l.w2]=C.title,v.metadata.annotations[l.D1]=C.url,v.metadata.annotations[l.nB]=C.id}catch{throw new Error("Failed to load folder")}else v.metadata.annotations&&!v.metadata.annotations[l.ew]&&(v.metadata.annotations[l.ew]="");return v}catch(v){const C=(0,s.do)(v);throw(0,s.q6)(v).includes("not found")&&C!==404&&(v.status=404,v.data.message="Dashboard not found"),v}}deleteDashboard(E,v){return this.client.delete(E,v).then(C=>({id:0,message:C.message,title:"deleted"}))}async saveDashboard(E){const v=E.dashboard,C={metadata:{...E?.k8s},spec:{...v}};return E.message?C.metadata.annotations={...C.metadata.annotations,[l.fY]:E.message}:C.metadata.annotations&&delete C.metadata.annotations[l.fY],E.folderUid&&(delete C.metadata.annotations?.[l.w2],delete C.metadata.annotations?.[l.D1],delete C.metadata.annotations?.[l.nB],C.metadata.annotations={...C.metadata.annotations,[l.ew]:E.folderUid}),C.metadata.name?(delete C.metadata.resourceVersion,this.client.update(C).then(S=>this.asSaveDashboardResponseDTO(S))):(C.metadata.annotations={...C.metadata.annotations,[l.AI]:"default"},await this.client.create(C).then(S=>this.asSaveDashboardResponseDTO(S)))}asSaveDashboardResponseDTO(E){const v=r.I.assureBaseUrl((0,f.u)({uid:E.metadata.name,currentQueryParams:"",slug:m.A.slugifyForUrl(E.spec.title.trim())}));let C=0;return E.metadata.labels?.[l.Y5]&&(C=parseInt(E.metadata.labels[l.Y5],10)),{uid:E.metadata.name,version:E.metadata.generation??0,id:C,status:"success",url:v,slug:""}}}class i{constructor(){this.v1Client=new h,this.v2Client=new u}async getDashboardDTO(E){try{return await this.v1Client.getDashboardDTO(E)}catch(v){if(v instanceof t.P&&v.data.storedVersion==="v2alpha1")return await this.v2Client.getDashboardDTO(E);throw v}}async saveDashboard(E){if((0,n.mi)(E))return await this.v2Client.saveDashboard(E);if((0,n.rL)(E))return await this.v1Client.saveDashboard(E);throw new Error("Invalid dashboard command")}async deleteDashboard(E,v){return await this.v1Client.deleteDashboard(E,v)}}var x=e(32899),g=e(68143),p=e(45229),c=e(79718);class y{constructor(){}saveDashboard(E){return c.t.ignoreNextSave(),(0,g.AI)().post("/api/dashboards/db/",{dashboard:E.dashboard,message:E.message??"",overwrite:E.overwrite??!1,folderUid:E.folderUid})}deleteDashboard(E,v){return(0,g.AI)().delete(`/api/dashboards/uid/${E}`,void 0,{showSuccessAlert:v})}async getDashboardDTO(E,v){const C=await(0,g.AI)().get(`/api/dashboards/uid/${E}`,v);if(C.meta.isFolder)throw p.A.emit(x.r1.alertError,["Dashboard not found"]),{status:404,config:{url:`/api/dashboards/uid/${E}`},data:{message:"Dashboard not found"}};return C}}let P;function d(b){throw new Error("dashboardAPI can be only overridden in test environment")}function D(b){const E=(0,n.GV)(b);if(P||(P={legacy:new y,v1:new h,v2:new u,unified:new i}),!P[E])throw new Error(`Unknown Dashboard API version: ${E}`);return P[E]}},62905:(ee,B,e)=>{"use strict";e.d(B,{$L:()=>d,AK:()=>b,Bs:()=>x,NA:()=>D,NY:()=>P,Sm:()=>i,T2:()=>p,U9:()=>g,_e:()=>y,bN:()=>c,eq:()=>C,ft:()=>S,g9:()=>v,kd:()=>E});var t=e(75816),n=e(68143),r=e(43173),o=e(73892),s=e(6890),m=e(64762),a=e(56840),l=e(24313),f=e(39385);function h(O){return typeof O=="object"&&O!=null&&"error"in O}const u=O=>({error:(0,n.NF)(O)&&O.data.messageId!=="publicdashboards.notFound"?O:null}),i=(0,t.xP)({reducerPath:"publicDashboardApi",baseQuery:(0,o.W)({baseURL:"/api"}),tagTypes:["PublicDashboard","AuditTablePublicDashboard","UsersWithActiveSessions","ActiveUserDashboards"],refetchOnMountOrArgChange:!0,endpoints:O=>({getPublicDashboard:O.query({query:I=>({url:`/dashboards/uid/${I}/public-dashboards`,manageError:u,showErrorAlert:!1}),async onQueryStarted(I,{dispatch:R,queryFulfilled:T}){try{await T}catch(L){h(L)&&(0,n.NF)(L.error)&&R((0,s.dx)((0,m.gi)(L.error.data.message)))}},providesTags:(I,R,T)=>[{type:"PublicDashboard",id:T}]}),createPublicDashboard:O.mutation({query:I=>({url:`/dashboards/uid/${I.dashboard instanceof f.H$?I.dashboard.state.uid:I.dashboard.uid}/public-dashboards`,method:"POST",body:I.payload}),async onQueryStarted({dashboard:I,payload:{share:R}},{dispatch:T,queryFulfilled:L}){const{data:K}=await L;let A=(0,a.t)("public-dashboard.sharing.success-creation","Dashboard is public!");r.$.featureToggles.newDashboardSharingComponent&&(A=R===l.Xo.PUBLIC?(0,a.t)("public-dashboard.public-sharing.success-creation","Your dashboard is now publicly accessible"):(0,a.t)("public-dashboard.email-sharing.success-creation","Your dashboard is ready for external sharing")),T((0,s.dx)((0,m.tZ)(A))),I instanceof f.H$?I.setState({meta:{...I.state.meta,publicDashboardEnabled:K.isEnabled}}):I.updateMeta({publicDashboardEnabled:K.isEnabled})},invalidatesTags:(I,R,{dashboard:T})=>[{type:"PublicDashboard",id:T instanceof f.H$?T.state.uid:T.uid}]}),updatePublicDashboard:O.mutation({query:({payload:I,dashboard:R})=>({url:`/dashboards/uid/${R instanceof f.H$?R.state.uid:R.uid}/public-dashboards/${I.uid}`,method:"PATCH",body:I}),async onQueryStarted({dashboard:I},{dispatch:R,queryFulfilled:T}){await T,R((0,s.dx)((0,m.tZ)(r.$.featureToggles.newDashboardSharingComponent?(0,a.t)("public-dashboard.configuration.success-update","Settings have been successfully updated"):(0,a.t)("public-dashboard.configuration.success-update-old","Public dashboard updated!"))))},invalidatesTags:(I,R,{payload:T})=>[{type:"PublicDashboard",id:T.dashboardUid},"AuditTablePublicDashboard"]}),pauseOrResumePublicDashboard:O.mutation({query:({payload:I,dashboard:R})=>({url:`/dashboards/uid/${R instanceof f.H$?R.state.uid:R.uid}/public-dashboards/${I.uid}`,method:"PATCH",body:I}),async onQueryStarted({dashboard:I,payload:{isEnabled:R}},{dispatch:T,queryFulfilled:L}){const{data:K}=await L;let A=(0,a.t)("public-dashboard.configuration.success-update-old","Public dashboard updated!");r.$.featureToggles.newDashboardSharingComponent&&(A=R?(0,a.t)("public-dashboard.configuration.success-resume","Your dashboard access has been resumed"):(0,a.t)("public-dashboard.configuration.success-pause","Your dashboard access has been paused")),T((0,s.dx)((0,m.tZ)(A))),I instanceof f.H$?I.setState({meta:{...I.state.meta,publicDashboardEnabled:K.isEnabled}}):I.updateMeta?.({publicDashboardEnabled:K.isEnabled})},invalidatesTags:(I,R,{payload:T})=>[{type:"PublicDashboard",id:T.dashboardUid},"AuditTablePublicDashboard"]}),updatePublicDashboardAccess:O.mutation({query:({payload:I,dashboard:R})=>({url:`/dashboards/uid/${R instanceof f.H$?R.state.uid:R.uid}/public-dashboards/${I.uid}`,method:"PATCH",body:I}),async onQueryStarted({dashboard:I,payload:{share:R}},{dispatch:T,queryFulfilled:L}){await L;let K=(0,a.t)("public-dashboard.configuration.success-update-old","Public dashboard updated!");r.$.featureToggles.newDashboardSharingComponent&&(K=R===l.Xo.PUBLIC?(0,a.t)("public-dashboard.public-sharing.success-share-type-change","Dashboard access updated: Anyone with the link can now access"):(0,a.t)("public-dashboard.email-sharing.success-share-type-change","Dashboard access updated: Only specific people can now access with the link")),T((0,s.dx)((0,m.tZ)(K)))},invalidatesTags:(I,R,{payload:T})=>[{type:"PublicDashboard",id:T.dashboardUid},"AuditTablePublicDashboard"]}),addRecipient:O.mutation({query:()=>({url:""})}),deleteRecipient:O.mutation({query:()=>({url:""})}),reshareAccessToRecipient:O.mutation({query:()=>({url:""})}),getActiveUsers:O.query({query:()=>({url:"/"}),providesTags:["UsersWithActiveSessions"]}),getActiveUserDashboards:O.query({query:()=>({url:""}),providesTags:(I,R,T)=>[{type:"ActiveUserDashboards",id:T}]}),listPublicDashboards:O.query({query:(I=1)=>({url:`/dashboards/public-dashboards?page=${I}&perpage=8`}),transformResponse:I=>({...I,totalPages:Math.ceil(I.totalCount/I.perPage)}),providesTags:["AuditTablePublicDashboard"]}),deletePublicDashboard:O.mutation({query:I=>({url:`/dashboards/uid/${I.dashboardUid}/public-dashboards/${I.uid}`,method:"DELETE"}),async onQueryStarted({dashboard:I},{dispatch:R,queryFulfilled:T}){await T,R((0,s.dx)((0,m.tZ)(r.$.featureToggles.newDashboardSharingComponent?(0,a.t)("public-dashboard.share.success-delete","Your dashboard is no longer shareable"):(0,a.t)("public-dashboard.share.success-delete-old","Public dashboard deleted!")))),R(i.util?.resetApiState()),I instanceof f.H$?I.setState({meta:{...I.state.meta,publicDashboardEnabled:!1}}):I?.updateMeta({publicDashboardEnabled:!1})},invalidatesTags:(I,R,{dashboardUid:T})=>[{type:"PublicDashboard",id:T},"AuditTablePublicDashboard","UsersWithActiveSessions","ActiveUserDashboards"]}),revokeAllAccess:O.mutation({query:()=>({url:""})})})}),{useGetPublicDashboardQuery:x,useCreatePublicDashboardMutation:g,useUpdatePublicDashboardMutation:p,useDeletePublicDashboardMutation:c,useListPublicDashboardsQuery:y,useAddRecipientMutation:P,useDeleteRecipientMutation:d,useReshareAccessToRecipientMutation:D,useGetActiveUsersQuery:b,useGetActiveUserDashboardsQuery:E,useRevokeAllAccessMutation:v,usePauseOrResumePublicDashboardMutation:C,useUpd
202atePublicDashboardAccessMutation:S}=i},95407:(ee,B,e)=>{"use strict";e.d(B,{P:()=>t});class t extends Error{constructor(r,o="Dashboard version mismatch"){super(o),this.name="DashboardVersionError",this.status=200,this.data={storedVersion:r,message:o}}}},60171:(ee,B,e)=>{"use strict";e.d(B,{GV:()=>r,HG:()=>a,_5:()=>m,aK:()=>s,b_:()=>o,mi:()=>f,rL:()=>l});var t=e(43173),n=e(36490);function r(h){const u=t.$.featureToggles.dashboardScene,i=t.$.featureToggles.kubernetesDashboards,x=n.Ny.getSearch().get("scenes")==="false";if(!u||x){if(h==="v2")throw new Error("v2 is not supported for legacy architecture");return i?"v1":"legacy"}if(i)return h==="v1"?"v1":h==="v2"?"v2":"unified";if(h==="v2")throw new Error("v2 is not supported if kubernetes dashboards are disabled");return"legacy"}function o(h){return h?"kind"in h&&h.kind==="DashboardWithAccessInfo":!1}function s(h){return"elements"in h}function m(h){return!s(h)}function a(h){return o(h)&&s(h.spec)}function l(h){return!s(h.dashboard)}function f(h){return s(h.dashboard)}},25157:(ee,B,e)=>{"use strict";e.d(B,{fP:()=>ae,Ay:()=>fe});var t=e(74848),n=e(96540),r=e(22803),o=e(71468),s=e(54148),m=e(63704),a=e(85629),l=e(36490),f=e(79104),h=e(71599),u=e(99887),i=e(93256),x=e(7895),g=e(8515),p=e(36219),c=e(6890),y=e(43707),P=e(5423),d=e(65642),D=e(64762),b=e(73427),E=e(94232),v=e(56840),C=e(38206),S=e(43550),O=e(88559),I=e(45861),R=e(30703),T=e(87063),L=e(77731),K=e(23289),A=e(96673),W=e(37918);const w=({dashboard:le})=>{const me=(0,n.useMemo)(()=>(0,L._u)(),[]),De=(0,A.useDispatch)(),Te=(0,A.useSelector)(Ne=>Ne.dashboard.initialDatasource);return(0,t.jsxs)(T.W,{children:[(0,t.jsx)(T.W.Item,{testId:a.Tp.pages.AddDashboard.itemButton("Add new visualization menu item"),label:(0,v.t)("dashboard.add-menu.visualization","Visualization"),onClick:()=>{const Ne=(0,L.OK)(le,Te);K.c.toolbarAddButtonClicked({item:"add_visualization"}),l.Ny.partial({editPanel:Ne}),De((0,W.Ub)(void 0))}},"add-visualisation"),(0,t.jsx)(T.W.Item,{testId:a.Tp.pages.AddDashboard.itemButton("Add new row menu item"),label:(0,v.t)("dashboard.add-menu.row","Row"),onClick:()=>{K.c.toolbarAddButtonClicked({item:"add_row"}),(0,L.SD)(le)}},"add-row"),(0,t.jsx)(T.W.Item,{testId:a.Tp.pages.AddDashboard.itemButton("Add new panel from panel library menu item"),label:(0,v.t)("dashboard.add-menu.import","Import from library"),onClick:()=>{K.c.toolbarAddButtonClicked({item:"import_from_library"}),(0,L.s3)(le)}},"add-panel-lib"),(0,t.jsx)(T.W.Item,{testId:a.Tp.pages.AddDashboard.itemButton("Add new panel from clipboard menu item"),label:(0,v.t)("dashboard.add-menu.paste-panel","Paste panel"),onClick:()=>{K.c.toolbarAddButtonClicked({item:"paste_panel"}),(0,L.no)(le,me)},disabled:!me},"add-panel-clipboard")]})},V=({dashboard:le,onToolbarAddMenuOpen:me})=>
202{const[De,Te]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{De&&me&&me()},[De,me]),(0,t.jsx)(O.m,{overlay:()=>(0,t.jsx)(w,{dashboard:le}),placement:"bottom",offset:[0,6],onVisibleChange:Te,children:(0,t.jsxs)(I.$n,{variant:"secondary",size:"sm",fill:"outline","data-testid":a.Tp.components.PageToolbar.itemButton("Add button"),children:[(0,t.jsx)(v.x6,{i18nKey:"dashboard.toolbar.add",children:"Add"}),(0,t.jsx)(R.I,{name:De?"angle-up":"angle-down",size:"lg"})]})})};var U=e(37010),F=e(22429),M=e(4590),H=e(69289),_=e(87745),Z=e(75541),ne=e(34339),te=e(74618),Y=e(58662);const Q=({dashboard:le})=>(0,t.jsx)(I.$n,{"data-testid":a.Tp.pages.Dashboard.DashNav.shareButton,variant:"primary",size:"sm",onClick:()=>{K.c.toolbarShareClick(),l.Ny.partial({shareView:Y.wr.link})},children:(0,t.jsx)(v.x6,{i18nKey:"dashboard.toolbar.share-button",children:"Share"})}),J={removeNavIndex:S.Im,setStarred:C.ci,updateTimeZoneForSession:H.Cj,updateNavIndex:c.Vz},q=le=>({navIndex:le.navIndex}),X=(0,o.connect)(q,J),se=a.Tp.pages.Dashboard.DashNav;function oe(le){registerDynamicDashNavAction("left",le)}function ae(le){(0,Z.Y)("right",le)}const ie=(0,n.memo)(le=>{(0,s.zy)();const me=(0,f.C)();(0,E.u)(le.dashboard.events,_.Cf);const De=le.dashboard.snapshot?.originalUrl??"",Te=()=>{window.location.href=m.sQ.sanitizeUrl(le.dashboard.snapshot.originalUrl)},Ne=(0,D._2)(),Ce=()=>{try{const Ye=new URL(m.sQ.sanitizeUrl(De),d.Ay.appUrl),Ge=new URL(d.Ay.appUrl);Ye.host!==Ge.host?b.lE.publish(new _.S8({component:h.u,props:{title:"Proceed to external site?",modalClass:pe,body:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{children:["This link connects to an external website at"," ",(0,t.jsx)("code",{children:De})]}),(0,t.jsx)("p",{children:"Are you sure you'd like to proceed?"})]}),confirmVariant:"primary",confirmText:"Proceed",onConfirm:Te}})):Te()}catch(Ye){Ne.error("Invalid URL",Ye instanceof Error?Ye.message:void 0)}},He=()=>{K.c.toolbarFavoritesClick();const Ye=(0,F.UA)(),{dashboard:Ge,navIndex:ce,removeNavIndex:Pe,setStarred:Se,updateNavIndex:Ee}=le;Ye.starDashboard(Ge.uid,!!Ge.meta.isStarred).then(xe=>{Se({id:Ge.uid,title:Ge.title,url:Ge.meta.url??"",isStarred:xe});const ye=ce.starred;if(xe)ye.children?.push({id:C.L1+Ge.uid,text:Ge.title,url:Ge.meta.url??"",parentItem:ye});else{Pe(C.L1+Ge.uid);const Oe=ye.children?.findIndex(we=>we.id===C.L1+Ge.uid);Oe&&ye.children?.splice(Oe,1)}Ee(ye),Ge.meta.isStarred=xe,me()})},ke=()=>{K.c.toolbarSettingsClick(),l.Ny.partial({editview:"settings"})},Me=()=>{M._o.prev()},$e=()=>{M._o.next()},tt=()=>{M._o.stop(),me()},Ke=(Ye,Ge)=>{Ye.map((ce,Pe)=>{const Se=ce.component,Ee=(0,n.createElement)(Se,{...le,key:`button-custom-${Pe}`});typeof ce.index=="number"?Ge.splice(ce.index,0,Ee):Ge.push(Ee)})},Re=()=>M._o.state.isPlaying,Ve=()=>{const Ye=d.Ay.buildInfo.env==="development",{dashboard:Ge,kioskMode:ce}=le,{canStar:Pe,isStarred:Se}=Ge.meta,Ee=[];if(ce||Re())return[];if(Pe){let xe=Se?(0,v.t)("dashboard.toolbar.unmark-favorite","Unmark as favorite"):(0,v.t)("dashboard.toolbar.mark-favorite","Mark as favorite");Ee.push((0,t.jsx)(ne._,{tooltip:xe,icon:Se?"favorite":"star",iconType:Se?"mono":"default",iconSize:"lg",onClick:He},"button-star"))}return Ge.meta.publicDashboardEnabled&&Ee.push((0,t.jsx)(u.E,{color:"blue",text:(0,v.t)("dashboard.dash-nav.render-left-actions.text-public","Public"),className:de,"data-testid":se.publicDashboardTag},"public-dashboard-button-badge")),Ye&&d.Ay.featureToggles.dashboardScene&&Ee.push((0,t.jsx)(ne._,{tooltip:(0,v.t)("dashboard.dash-nav.render-left-actions.tooltip-view-as-scene","View as Scene"),icon:"apps",onClick:()=>{l.Ny.partial({scenes:!0})}},"button-scenes")),Ke(Z.C.left,Ee),Ee},Qe=()=>(0,t.jsxs)(i.e,{children:[(0,t.jsx)(x.I,{tooltip:(0,v.t)("dashboard.toolbar.playlist-previous","Go to previous dashboard"),icon:"backward",onClick:Me,narrow:!0}),(0,t.jsx)(x.I,{onClick:tt,children:(0,t.jsx)(v.x6,{i18nKey:"dashboard.toolbar.playlist-stop",children:"Stop playlist"})}),(0,t.jsx)(x.I,{tooltip:(0,v.t)("dashboard.toolbar.playlist-next","Go to next dashboard"),icon:"forward",onClick:$e,narrow:!0})]},"playlist-buttons"),je=()=>{const{dashboard:Ye,updateTimeZoneForSession:Ge,hideTimePicker:ce}=le;return ce?null:(0,t.jsx)(te.$,{dashboard:Ye,onChangeTimeZone:Ge}
202,"time-controls")},ze=()=>{const{dashboard:Ye,isFullscreen:Ge,hideTimePicker:ce}=le,{canSave:Pe,canEdit:Se,showSettings:Ee,canShare:xe}=Ye.meta,{snapshot:ye}=Ye,Oe=ye&&ye.originalUrl,we=[];return Re()?[Qe(),je()]:(Oe&&we.push((0,t.jsx)(x.I,{tooltip:(0,v.t)("dashboard.toolbar.open-original","Open original dashboard"),onClick:Ce,icon:"link"},"button-snapshot")),Pe&&!Ge&&we.push((0,t.jsx)(g.$s,{children:({showModal:Be,hideModal:Xe})=>(0,t.jsx)(x.I,{tooltip:(0,v.t)("dashboard.toolbar.save","Save dashboard"),icon:"save",onClick:()=>{Be(U.$,{dashboard:Ye,onDismiss:Xe})}})},"button-save")),Ke(Z.C.right,we),Ee&&we.push((0,t.jsx)(x.I,{tooltip:(0,v.t)("dashboard.toolbar.settings","Dashboard settings"),icon:"cog",onClick:ke},"button-settings")),Se&&!Ge&&we.push((0,t.jsx)(V,{onToolbarAddMenuOpen:K.c.toolbarAddClick,dashboard:Ye},"panel-add-dropdown")),xe&&we.push((0,t.jsx)(Q,{dashboard:Ye},"button-share")),ce||we.push((0,t.jsx)(P.K,{},"toolbar-separator")),we.push(je()),we)};return(0,t.jsx)(y.H,{actions:(0,t.jsxs)(t.Fragment,{children:[Ve(),(0,t.jsx)(P.K,{leftActionsSeparator:!0}),(0,t.jsx)(p.U,{alignment:"right",children:ze()})]})})});ie.displayName="DashNav";const fe=X(ie),pe=(0,r.css)({width:"max-content",maxWidth:"80vw"}),de=(0,r.css)({color:"grey",backgroundColor:"transparent",border:"1px solid"})},34339:(ee,B,e)=>{"use strict";e.d(B,{_:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(76319);const s=({icon:a,iconType:l,iconSize:f,tooltip:h,onClick:u,children:i})=>{const x=(0,r.of)(m);return(0,t.jsxs)("div",{className:x.noBorderContainer,children:[a&&(0,t.jsx)(o.K,{name:a,size:f,iconType:l,tooltip:h,tooltipPlacement:"bottom",onClick:u}),i]})},m=a=>({noBorderContainer:(0,n.css)({padding:`0 ${a.spacing(.5)}`,display:"flex"})})},74618:(ee,B,e)=>{"use strict";e.d(B,{$:()=>x});var t=e(74848),n=e(96540),r=e(33239),o=e(75234),s=e(90811),m=e(5857),a=e(51158),l=e(73427),f=e(56840),h=e(15130),u=e(75421),i=e(87745);class x extends n.Component{constructor(){super(...arguments),this.onChangeRefreshInterval=p=>{(0,u.jG)().setAutoRefresh(p),this.forceUpdate()},this.onRefresh=()=>((0,u.jG)().refreshTimeModel(),Promise.resolve()),this.onMoveBack=()=>{l.lE.publish(new i.Io({direction:i.xL.Left}))},this.onMoveForward=()=>{l.lE.publish(new i.Io({direction:i.xL.Right}))},this.onChangeTimePicker=p=>{const{dashboard:c}=this.props,y=c.timepicker,P=y.nowDelay&&p.raw.to==="now",d=r.isMathString(p.raw.from)?p.raw.from:p.from,D=r.isMathString(p.raw.to)?p.raw.to:p.to,b={from:d,to:P?"now-"+y.nowDelay:D};(0,u.jG)().setTime(b)},this.onChangeTimeZone=p=>{this.props.dashboard.timezone=p,this.props.onChangeTimeZone(p),this.onRefresh()},this.onChangeFiscalYearStartMonth=p=>{this.props.dashboard.fiscalYearStartMonth=p,this.onRefresh()},this.onZoom=()=>{this.props.onToolbarZoomClick&&this.props.onToolbarZoomClick(),l.lE.publish(new i.U0({scale:2}))},this.onRefreshClick=()=>{this.props.onToolbarRefreshClick&&this.props.onToolbarRefreshClick(),this.onRefresh()}}componentDidMount(){this.sub=this.props.dashboard.events.subscribe(o.sR,()=>this.forceUpdate())}componentWillUnmount(){this.sub?.unsubscribe()}render(){const{dashboard:p,isOnCanvas:c}=this.props,{quick_ranges:y,refresh_intervals:P}=p.timepicker,d=(0,u.jG)().getValidIntervals(P||s.cb),D=(0,u.jG)().timeRange(),b=p.getTimezone(),E=p.fiscalYearStartMonth,v=p.panelInEdit?.isEditing,C=p.weekStart;let S;return p.refresh===h.SM&&(S=(0,u.jG)().getAutoRefreshInteval().interval),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.m,{value:D,onChange:this.onChangeTimePicker,timeZone:b,fiscalYearStartMonth:E,onMoveBackward:this.onMoveBack,onMoveForward:this.onMoveForward,onZoom:this.onZoom,onChangeTimeZone:this.onChangeTimeZone,onChangeFiscalYearStartMonth:this.onChangeFiscalYearStartMonth,isOnCanvas:c,onToolbarTimePickerClick:this.props.onToolbarTimePickerClick,weekStart:(0,m.rE)(C)?C:void 0,quickRanges:y}),(0,t.jsx)(s.cC,{onIntervalChanged:this.onChangeRefreshInterval,onRefresh:this.onRefreshClick,value:p.refresh,intervals:d,isOnCanvas:c,tooltip:(0,f.t)("dashboard.toolbar.refresh","Refresh dashboard"),noIntervalPicker:v,showAutoInterval:!0,text:S})]})}}},39302:(ee,B,e)=>{"use strict";e.d(B,{d:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(45861);const s=({children:a,...l})=>{const f=(0,r.of)(m);return(0,t.jsx)("div",{className:f.buttonWrapper,children:(0,t.jsx)(o.$n,{icon:"plus",...l,children:a})})},m=a=>({buttonWrapper:(0,n.css)({padding:`${a.spacing(3)} 0`})})},56291:(ee,B,e)=>{"use strict";e.d(B,{p:()=>P});var t=e(74848),n=e(2543),r=e(96540),o=e(17548),s=e(85629),m=e(74475),a=e(37386),l=e(59310),f=e(5857),h=e(63527),u=e(21285),i=e(56840),x=e(90811),g=e(75421);const p=({refreshIntervals:d,onRefreshIntervalChange:D,getIntervalsFunc:b=y,validateIntervalsFunc:E=c})=>{const[v,C]=(0,r.useState)(b(d??x.cb)),[S,O]=(0,r.useState)(null);(0,r.useEffect)(()=>{const L=b(d??x.cb);C(L)},[b,d]);const I=(0,r.useMemo)(()=>Array.isArray(v)?v.join(","):"",[v]),R=(0,r.useCallback)(L=>
202{const K=L.currentTarget.value?L.currentTarget.value.split(","):[];C(K)},[C]),T=(0,r.useCallback)(L=>{const K=E(v);K===null&&D(b(v)),O(K)},[b,v,D,E]);return(0,t.jsx)(a.D,{label:(0,i.t)("dashboard-settings.general.auto-refresh-label","Auto refresh"),description:(0,i.t)("dashboard-settings.general.auto-refresh-description","Define the auto refresh intervals that should be available in the auto refresh list. Use the format '5s' for seconds, '1m' for minutes, '1h' for hours, and '1d' for days (e.g.: '5s,10s,30s,1m,5m,15m,30m,1h,2h,1d')."),error:S,invalid:!!S,children:(0,t.jsx)(h.p,{id:"auto-refresh-input",invalid:!!S,value:I,onChange:R,onBlur:T})})},c=(d,D={getTimeSrv:g.jG})=>{try{return y(d,D),null}catch(b){return b instanceof Error?b.message:"Invalid intervals"}},y=(d,D={getTimeSrv:g.jG})=>{const b=d.filter(E=>E.trim()!=="").map(E=>E.replace(/\s+/g,""));return[...new Set(D.getTimeSrv().getValidIntervals(b))]};class P extends r.PureComponent{constructor(){super(...arguments),this.state={isNowDelayValid:!0},this.onNowDelayChange=D=>{const b=D.currentTarget.value;if((0,n.isEmpty)(b))return this.setState({isNowDelayValid:!0}),this.props.onNowDelayChange(b);if(o.isValidTimeSpan(b))return this.setState({isNowDelayValid:!0}),this.props.onNowDelayChange(b);this.setState({isNowDelayValid:!1})},this.onHideTimePickerChange=()=>{this.props.onHideTimePickerChange(!this.props.timePickerHidden)},this.onLiveNowChange=()=>{this.props.onLiveNowChange(!this.props.liveNow)},this.onTimeZoneChange=D=>
202{typeof D=="string"&&this.props.onTimeZoneChange(D)},this.onWeekStartChange=D=>{this.props.onWeekStartChange(D)}}render(){return(0,t.jsxs)(m.M,{label:(0,i.t)("dashboard-settings.time-picker.time-options-label","Time options"),isOpen:!0,children:[(0,t.jsx)(a.D,{label:(0,i.t)("dashboard-settings.time-picker.time-zone-label","Time zone"),"data-testid":s.Tp.components.TimeZonePicker.containerV2,children:(0,t.jsx)(l.U,{inputId:"time-options-input",includeInternal:!0,value:this.props.timezone,onChange:this.onTimeZoneChange,width:40})}),(0,t.jsx)(a.D,{label:(0,i.t)("dashboard-settings.time-picker.week-start-label","Week start"),"data-testid":s.Tp.components.WeekStartPicker.containerV2,children:(0,t.jsx)(f.l6,{inputId:"week-start-input",width:40,value:this.props.weekStart,onChange:this.onWeekStartChange})}),(0,t.jsx)(p,{refreshIntervals:this.props.refreshIntervals,onRefreshIntervalChange:this.props.onRefreshIntervalChange}),(0,t.jsx)(a.D,{label:(0,i.t)("dashboard-settings.time-picker.now-delay-label","Now delay"),description:(0,i.t)("dashboard-settings.time-picker.now-delay-description","Exclude recent data that may be incomplete."),children:(0,t.jsx)(h.p,{id:"now-delay-input",invalid:!this.state.isNowDelayValid,placeholder:"0m",onChange:this.onNowDelayChange,defaultValue:this.props.nowDelay})}),(0,t.jsx)(a.D,{label:(0,i.t)("dashboard-settings.time-picker.hide-time-picker","Hide time picker"),children:(0,t.jsx)(u.d,{id:"hide-time-picker-toggle",value:!!this.props.timePickerHidden,onChange:this.onHideTimePickerChange})}),(0,t.jsx)(a.D,{label:(0,i.t)("dashboard-settings.time-picker.refresh-live-dashboards-label","Refresh live dashboards"),description:(0,i.t)("dashboard-settings.time-picker.refresh-live-dashboards-description","Continuously re-draw panels where the time range references 'now'"),children:(0,t.jsx)(u.d,{id:"refresh-live-dashboards-toggle",value:!!this.props.liveNow,onChange:this.onLiveNowChange})})]})}}},16200:(ee,B,e)=>{"use strict";e.d(B,{n:()=>U,C:()=>V});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(45861),m=e(66404),a=e(59243),l=e(68079),f=e(45967),h=e(34999),u=e(41654),i=e(63527),x=e(30703),g=e(89640),p=e(56840),c=e(76319);const y=({currentPage:M,numberOfPages:H,onNavigate:_,hideWhenSinglePage:Z,className:ne})=>{const te=(0,o.of)(P);return Z&&H<=1?null:(0,t.jsxs)("div",{className:(0,n.cx)(te.wrapper,ne),children:[(0,t.jsx)(c.K,{name:"angle-left",size:"md",tooltip:(0,p.t)("dashboard.minimalistic-pagination.tooltip-previous","Previous"),onClick:()=>_(M-1),disabled:M===1}),M," of ",H,(0,t.jsx)(c.K,{name:"angle-right",size:"md",tooltip:(0,p.t)("dashboard.minimalistic-pagination.tooltip-next","Next"),onClick:()=>_(M+1),disabled:M===H})]})},P=M=>({wrapper:(0,n.css)({display:"flex",flexDirection:"row",gap:16,userSelect:"none"})}),d=({history:M,index:H,onNavigate:_})=>{const Z=(0,o.of)(D),ne=M.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:Z.contentWrapper,children:(0,t.jsx)(m.E,{element:"p",color:"secondary",children:M[H-1]})}),(0,t.jsx)(y,{currentPage:H,numberOfPages:ne,onNavigate:_,hideWhenSinglePage:!1,
202className:Z.paginationWrapper})]})},D=M=>({paginationWrapper:(0,n.css)({display:"flex",flexDirection:"row",justifyContent:"flex-end",marginTop:15}),contentWrapper:(0,n.css)({display:"flex",flexBasis:"100%",flexGrow:3,whiteSpace:"pre-wrap",maxHeight:110,overflowY:"scroll",backgroundColor:M.colors.background.secondary,border:`1px solid ${M.colors.border.weak}`,padding:M.spacing(1),minHeight:60})});var b=e(66769);const E=({onSuggestionClick:M,isGenerating:H})=>{const _=(0,o.of)(v);return(0,t.jsxs)("div",{className:_.quickSuggestionsWrapper,children:[(0,t.jsx)(s.$n,{onClick:()=>M(b.HG.Shorter),size:"sm",variant:"secondary",icon:"paragraph",disabled:H,children:b.HG.Shorter}),(0,t.jsx)(s.$n,{onClick:()=>M(b.HG.MoreDescriptive),size:"sm",variant:"secondary",icon:"document-layout-left",disabled:H,children:b.HG.MoreDescriptive}),(0,t.jsx)(s.$n,{onClick:()=>M(b.HG.Regenerate),icon:"sync",size:"sm",variant:"secondary",disabled:H,children:"Regenerate"})]})},v=M=>({quickSuggestionsWrapper:(0,n.css)({display:"flex",flexDirection:"row",gap:8})});var C=e(16817),S=e(52768),O=e(25992),I=e(64762);const R=(0,O.DW)("features.dashboards.genai");var T=(M=>(M.IDLE="idle",M.GENERATING="generating",M.COMPLETED="completed",M))(T||{});const L=1e4,K={model:b.ys,temperature:1};function A({model:M,temperature:H,onResponse:_}=K){const[Z,ne]=(0,r.useState)([]),[te,Y]=(0,r.useState)(""),[Q,J]=(0,r.useState)("idle"),[q,X]=(0,r.useState)(),{error:se}=(0,I._2)();let oe="";const ae=(0,r.useCallback)(me=>{J("idle"),ne([]),X(me),se("Failed to generate content using LLM","Please try again or if the problem persists, contact your organization admin."),console.error(me),R.logError(me,{messages:JSON.stringify(Z),model:M,temperature:String(H)})},[Z,M,H,se]);(0,r.useEffect)(()=>{Z.length>0&&Y("")},[Z]);const{error:ie,value:fe}=(0,C.A)(async()=>await(0,b.QX)(),[b.QX]),{error:pe,value:de}=(0,C.A)(async()=>{if(!fe||!Z.length)return{enabled:fe};J("generating"),X(void 0);const me=S.qH({model:M,temperature:H,messages:Z}).pipe(S.qA());return{enabled:fe,stream:me.subscribe({next:De=>{oe=De},error:ae,complete:()=>{Y(oe),J("completed"),_?.(oe),ne([]),X(void 0)}})}},[Z,fe]);(0,r.useEffect)(()=>()=>{de?.stream?.unsubscribe()},[de]);const le=(0,r.useCallback)(()=>{de?.stream?.unsubscribe(),J("idle"),X(void 0),ne([])},[de]);return(0,r.useEffect)(()=>{let me;return Q==="generating"&&te===""&&(me=setTimeout(()=>{ae(new Error(`LLM stream timed out after ${L}ms`))},L)),()=>{clearTimeout(me)}},[Q,te,ae]),(pe||ie)&&X(pe||ie),{setMessages:ne,stopGeneration:le,messages:Z,reply:te,streamStatus:Q,error:q,value:de}}var W=e(37680);const N=.5,w=({eventTrackingSrc:M,history:H,messages:_,onApplySuggestion:Z,updateHistory:ne})=>{const te=(0,o.of)(j),[Y,Q]=(0,r.useState)(1),[J,q]=(0,r.useState)(""),X=(0,r.useCallback)(tt=>{ne((0,b.Kb)(tt))},[ne]),{setMessages:se,stopGeneration:oe,reply:ae,streamStatus:ie,error:fe}=A({model:b.ys,temperature:N,onResponse:X}),pe=(tt,Ke)=>(0,W.XX)(M,tt,Ke),de=tt=>{Te(tt),pe(W.KR.customFeedback,{customFeedback:tt})},le=()=>{oe(),ae&&X(ae)},me=()=>{Z(H[Y-1])},De=tt=>{Q(tt),pe(tt>Y?W.KR.backHistoryItem:W.KR.forwardHistoryItem)},Te=tt=>{se(Ke=>[...Ke,...(0,b.To)(H[Y-1],tt)]),tt in b.HG&&pe(W.KR.quickFeedback,{quickFeedbackItem:tt})},Ne=tt=>tt.key==="Enter"&&de(J),Ce=tt=>q(tt.currentTarget.value),He=()=>de(J),ke=()=>pe(W.KR.linkToDocs),Me=ie===T.GENERATING,$e=fe&&!Me;return(0,t.jsxs)("div",{className:te.container,children:[$e&&(0,t.jsx)(h.F,{title:"",children:(0,t.jsx)(u.B,{direction:"column",children:(0,t.jsx)("p",{children:(0,t.jsx)(p.x6,{i18nKey:"gen-ai.incomplete-request-error",children:"Sorry, I was unable to complete your request. Please try again."})})})}),(0,t.jsx)(d,{history:H,index:Y,onNavigate:De}),(0,t.jsx)("div",{className:te.actionButtons,children:(0,t.jsx)(E,{onSuggestionClick:Te,isGenerating:Me})}),(0,t.jsx)(i.p,{placeholder:(0,p.t)("dashboard.gen-aihistory.placeholder-tell-ai-what-to-do-next","Tell AI what to do next..."),suffix:(0,t.jsx)(s.$n,{icon:"enter",variant:"secondary",fill:"text","aria-label":(0,p.t)("dashboard.gen-aihistory.aria-label-send-custom-feedback","Send custom feedback"),onClick:He,disabled:!J,children:(0,t.jsx)(p.x6,{i18nKey:"gen-ai.send-custom-feedback",children:"Send"})}),value:J,onChange:Ce,onKeyDown:Ne}),(0,t.jsx)("div",{className:te.applySuggestion,children:(0,t.jsx)(u.B,{justifyContent:"flex-end",direction:"row",children:Me?(0,t.jsx)(s.$n,{icon:"fa fa-spinner",onClick:le,children:V}):(0,t.jsx)(s.$n,{icon:"check",onClick:me,children:(0,t.jsx)(p.x6,{i18nKey:"gen-ai.apply-suggestion",children:"Apply"})})})}),(0,t.jsxs)("div",{className:te.footer,children:[(0,t.jsx)(x.I,{name:"exclamation-circle",className:te.infoColor}),(0,t.jsxs)(m.E,{variant:"bodySmall",color:"secondary",children:["This content is AI-generated using the"," ",(0,t.jsx)(g.Y,{variant:"bodySmall",inline:!0,href:"https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/llm-plugin/",external:!0,onClick:ke,children:"Grafana LLM plugin"})]})]})]})},j=M=>({container:(0,n.css)({display:"flex",flexDirection:"column",width:520,maxHeight:350,paddingBottom:25}),applySuggestion:(0,n.css)({paddingTop:M.spacing(2)}),actions:(0,n.css)({display:"flex",flexDirection:"row",flexWrap:"wrap"}),footer:(0,n.css)({position:"absolute",bottom:0,left:0,width:"100%",display:"flex",flexDirection:"row",margin:0,padding:M.spacing(1),paddingLeft:M.spacing(2),alignItems:"center",gap:M.spacing(1),borderTop:`1px solid ${M.colors.border.weak}`,marginTop:M.spacing(2)}),infoColor:(0,n.css)({color:M.colors.info.main}),actionButtons:(0,n.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"24px 0 8px 0"})}),V="Stop generating",U=({text:M="Auto-generate",toggleTipTitle:H="",onClick:_,model:Z=b.ys,messages:ne,onGenerate:te,temperature:Y=1,eventTrackingSrc:Q,disabled:J,tooltip:q})=>{const X=(0,o.of)(F),[se,oe]=(0,r.useState)([]),ae=(0,r.useCallback)(Ge=>{oe(ce=>[Ge,...ce])},[]),ie=(0,r.useCallback)(Ge=>{const ce=(0,b.Kb)(Ge);te(ce),ae(ce)},[te,ae]),{setMessages:fe,stopGeneration:pe,value:de,error:le,streamStatus:me}=A({model:Z,temperature:Y,onResponse:ie}),[De,Te]=(0,r.useState)(!1),Ne=se.length>0,Ce=!Ne,He=me===T.GENERATING,ke=J||de&&!de.enabled&&!le,Me=(0,r.useCallback)(Ge=>(0,W.XX)(Q,Ge),[Q]),$e=le||q?void 0:!1,tt=le?"Failed to generate content using LLM. Please try again or if the problem persists, contact your organization admin.":q||"",Ke=Ge=>{me===T.GENERATING?pe():Ne?Te(!0):(_?.(Ge),fe(ze()));const ce=le?W.KR.erroredRetryButton:He?W.KR.stopGenerationButton:Ce?W.KR.autoGenerateButton:W.KR.improveButton;Me(ce)};if(!de?.enabled)return null;const Re=Ge=>{Me(W.KR.applySuggestion),te(Ge),Te(!1)},Ve=()=>{if(!He)return le||de&&!de.enabled?"exclamation-circle":"ai"},Qe=()=>{let Ge=M;return le&&(Ge="Retry"),He&&(Ge=V),Ne&&(Ge="Improve"),Ge},je=(0,t.jsx)(s.$n,{icon:Ve(),onClick:Ke,fill:"text",size:"sm",disabled:ke,variant:le?"destructive":"primary",children:Qe()}),ze=()=>typeof ne=="function"?ne():ne,Ye=()=>{if(Ne){const Ge=(0,t.jsx)(m.E,{element:"p",children:H});return(0,t.jsx)(a.G,{title:Ge,content:(0,t.jsx)(w,{history:se,messages:ze(),onApplySuggestion:Re,updateHistory:ae,eventTrackingSrc:Q}),placement:"left-start",fitContent:!0,show:De,onClose:()=>Te(!1),onOpen:()=>Te(!0),children:je})}return je};return(0,t.jsxs)("div",{className:X.wrapper,children:[He&&(0,t.jsx)(l.y,{size:"sm",className:X.spinner}),Ce?(0,t.jsx)(f.m,{show:$e,interactive:!0,content:tt,children:je}):Ye()]})},F=M=>({wrapper:(0,n.css)({display:"flex"}),spinner:(0,n.css)({color:M.colors.text.link})})},42357:(ee,B,e)=>{"use strict";e.d(B,{V:()=>l});var t=e(74848),n=e(22429),r=e(16200),o=e(37680),s=e(66769);const a=`You are an expert in creating Grafana Dashboards. 203Your goal is to write a descriptive and concise dashboard description. 204You will be given the title and description of the dashboard's panels. 205The dashboard description is meant to explain the purpose of the dashboard and what its panels show. 206If the dashboard has no panels, the description should be "Empty dashboard" 207There should be no numbers in the description except where they are important.
208The dashboard description should not have the dashboard title or any quotation marks in it. 209The description should be, at most, 300 characters. 210Respond with only the description of the dashboard.`,l=({onGenerate:h})=>{const u=(0,n.UA)().getCurrent(),i=(0,s.N3)(u);return(0,t.jsx)(r.n,{messages:f(u),onGenerate:h,eventTrackingSrc:o.ec.dashboardDescription,toggleTipTitle:"Improve your dashboard description",disabled:i.length===0,tooltip:i.length===0?s.ZN:void 0})};function f(h){return[{content:a,role:s.Xh.system},{content:`The title of the dashboard is "${h.title}" 211${(0,s.BB)(h)}`,role:s.Xh.user}]}},70969:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>l});var t=e(74848),n=e(22429),r=e(16200),o=e(37680),s=e(66769);const a=`You are an expert in creating Grafana Dashboards. 212Your goal is to write a concise dashboard title. 213You will be given the title and description of the dashboard's panels. 214The dashboard title is meant to say what it shows on one line for users to navigate to it. 215If the dashboard has no panels, the title should be "Empty dashboard" 216There should be no numbers in the title. 217The dashboard title should not have quotation marks in it. 218The title should be, at most, 50 characters. 219Respond with only the title of the dashboard.`,l=({onGenerate:h})=>{const u=(0,n.UA)().getCurrent(),i=(0,s.N3)(u);return(0,t.jsx)(r.n,{messages:f(u),onGenerate:h,eventTrackingSrc:o.ec.dashboardTitle,toggleTipTitle:"Improve your dashboard title",disabled:i.length===0,tooltip:i.length===0?s.ZN:void 0})};function f(h){return[{content:a,role:s.Xh.system},{content:`The panels in the dashboard are: ${(0,s.BB)(h)}`,role:s.Xh.user}]}},22055:(ee,B,e)=>{"use strict";e.d(B,{t:()=>l});var t=e(74848),n=e(22429),r=e(16200),o=e(37680),s=e(66769);const a=`You are an expert in creating Grafana Panels. 220You will be given the title and description of the dashboard the panel is in as well as the JSON for the panel. 221Your goal is to write a descriptive and concise panel description. 222The panel description is meant to explain the purpose of the panel, not just its attributes. 223Do not refer to the panel; simply describe its purpose. 224There should be no numbers in the description except for thresholds. 225The description should be, at most, 200 characters.`,l=({onGenerate:h,panel:u})=>(0,t.jsx)(r.n,{messages:()=>f(u),onGenerate:h,eventTrackingSrc:o.ec.panelDescription,toggleTipTitle:"Improve your panel description"});function f(h){const u=(0,n.UA)().getCurrent(),i=(0,s.hn)(h);return[{content:a,role:s.Xh.system},{content:`The panel is part of a dashboard with the title: ${u.title} 226The panel is part of a dashboard with the description: ${u.description} 227This is the JSON which defines the panel: ${i}`,role:s.Xh.user}]}},76623:(ee,B,e)=>{"use strict";e.d(B,{h:()=>a});var t=e(74848),n=e(16200),r=e(37680),o=e(66769);const m="You are an expert in creating Grafana Panels.Your goal is to write short, descriptive, and concise panel title.The title should be shorter than 50 characters.",a=({onGenerate:f,panel:h,dashboard:u})=>(0,t.jsx)(n.n,{messages:()=>l(h,u),onGenerate:f,eventTrackingSrc:r.ec.panelTitle,toggleTipTitle:"Improve your panel title"});function l(f,h){const u=(0,o.hn)(f);return[{content:m,role:o.Xh.system},{content:`The panel is part of a dashboard with the title: ${h.title} 228The panel is part of a dashboard with the description: ${h.description} 229Use this JSON object which defines the panel: ${u}`,role:o.Xh.user}]}},37680:(ee,B,e)=>{"use strict";e.d(B,{KR:()=>o,XX:()=>s,ec:()=>r});var t=e(27489);const n="dashboards_autogenerate_clicked";var r=(m=>(m.panelDescription="panel-description",m.panelTitle="panel-title",m.dashboardChanges="dashboard-changes",m.dashboardTitle="dashboard-title",m.dashboardDescription="dashboard-description",m.unknown="unknown",m))(r||{}),o=(m=>(m.autoGenerateButton="auto-generate-button",m.erroredRetryButton="errored-retry-button",m.stopGenerationButton="stop-generating-button",m.improveButton="improve-button",m.backHistoryItem="back-history-item",m.forwardHistoryItem="forward-history-item",m.quickFeedback="quick-feedback",m.linkToDocs="link-to-docs",m.customFeedback="custom-feedback",m.applySuggestion="apply-suggestion",m))(o||{});function s(m,a,l){(0,t.rR)(n,{src:m,item:a,...l})}},66769:(ee,B,e)=>{"use strict";e.d(B,{ZN:()=>O,ys:()=>P,HG:()=>y,Xh:()=>c,Yy:()=>D,BB:()=>C,To:()=>v,hn:()=>S,N3:()=>I,QX:()=>E,Kb:()=>d});var t=e(2543),n=e(52768),r=e(43173),o=e(77731),s=e(90254),m=e(7817);function a(T,L){return T===L?L:Array.isArray(T)&&Array.isArray(L)?h(T,L):l(T)&&l(L)?f(T,L):L}function l(T){return typeof T=="object"&&!Array.isArray(T)&&T!==null}function f(T,L){const K=Object.keys(T),A={};for(const W of K)L.hasOwnProperty(W)&&(Array.isArray(T[W])&&Array.isArray(L[W])||typeof T[W]=="object"&&typeof L[W]=="object"?A[W]=a(T[W],L[W]):A[W]=L[W]);return A}function h(T,L){const K=new Array(T.length).fill(void 0),A=new Set([...Array(T.length).keys()]),W=new Set([...Array(L.length).keys()]);for(let N=0;N<T.length&&W.size!==0;N++){let w=T[N];for(let j=0;j<L.length;j++){if(!W.has(j))continue;let V=L[j];V=a(w,V),JSON.stringify(w)===JSON.stringify(V)&&(A.delete(N),W.delete(j),K[N]=V)}}return u(T,L,K,A,W),K.filter(N=>N!==void 0)}function u(T,L,K,A,W){let N={};W.forEach(j=>{let V=L[j];if(typeof V!="object"||Array.isArray(V)){K.push(V),W.delete(j);return}A.forEach(U=>{let F=T[U];if(typeof F!="object"||Array.isArray(F)){A.delete(U);return}let M=0;for(const H in F){let _=F[H];if(!V.hasOwnProperty(H))continue;let Z=V[H];typeof _!="string"&&typeof _!="number"||typeof _!=typeof Z||_===Z&&
229(H==="id"&&(M+=1e3),M++)}M!==0&&(N[M]===void 0&&(N[M]=[]),N[M].push([U,j]))})});const w=Object.keys(N).map(Number);w.sort((j,V)=>V-j);for(const j of w){let V=N[j];for(const U of V){const[F,M]=U;A.has(F)&&W.has(M)&&(K[F]=L[M],A.delete(F),W.delete(M))}}for(const j of W)K.push(L[j])}function i(T){const L=T.split(` 230`);let K=T[0].startsWith("Index")?4:3,A=L.slice(0,K);const W=/("title"|Title|\{|\}|\[|\])/i;for(let N=K;N<L.length;N++){let w=L[N];(W.test(w)||w.startsWith("+")||w.startsWith("-"))&&A.push(w)}return A.join(` 231`)+` 232`}function x(T){if(T===null||T==="")return null;if(Array.isArray(T)){const K=T.map(A=>x(A)).filter(A=>A!==null);return K.length>0?K:null}if(typeof T!="object")return T;const L={};for(const K in T){const A=x(T[K]);if(A!==null){if(Array.isArray(A)&&A.length===0||typeof A=="object"&&Object.keys(A).length===0)continue;L[K]=A}}return Object.keys(L).length>0?L:null}function g(T){return JSON.parse(JSON.stringify(T,null,2))}function p(T){let L=g(T.getOriginalDashboard()),K=g(new m.G(L).getSaveModelClone()),A=g(T.getSaveModelClone());K=x(a(L,K)),A=x(a(K,A)),L=x(L);let W=(0,s.ss)("Before migration changes","After migration changes",JSON.stringify(L,null,2),JSON.stringify(K,null,2),"","",{context:20}),N=(0,s.ss)("Before user changes","After user changes",JSON.stringify(K,null,2),JSON.stringify(A,null,2),"","",{context:20});return W=i(W),N=i(N),{migrationDiff:W,userDiff:N}}var c=(T=>(T.system="system",T.user="user",T))(c||{}),y=(T=>(T.Shorter="Even shorter",T.MoreDescriptive="More descriptive",T.Regenerate="Please, regenerate",T))(y||{});const P=n.Kx.LARGE,d=T=>T.replace(/^"|"$/g,"");function D(T){const{migrationDiff:L,userDiff:K}=p(T);return{userChanges:K,migrationChanges:L}}let b;async function E(){return r.$.apps["grafana-llm-app"]?b||(b=new Promise(T=>{n.vK().then(L=>{L.ok||(b=void 0),T(L.ok)})}),b):!1}const v=(T,L)=>[{role:"system",content:`Your previous response was: ${T}. The user has provided the following feedback: ${L}. Re-generate your response according to the provided feedback.`}];function C(T){const L=I(T);let K;if(L.length<=10)K=`The panels in the dashboard are: 233${L.join(` 234`)}`;else{const A=T.panels.filter(w=>w.description),W=T.panels.filter(w=>!w.description);let N;A.length>=10?N=A.slice(10).map(R).join(` 235`):(N=A.map(R).join(` 236`),N+=` 237`,N+=W.slice(10-A.length).map(R).join("n")),K=`There are ${L.length} panels. 238Due to space constraints, only the information for ten of them is presented. 239These ten are not necessarily the first ten, but prioritized to those with descriptions. 240The panels in the dashboard are: 241${N}`}return K}function S(T){const L=["datasource","title","description","targets","type"],K={...(0,t.pick)(T,L),options:(0,t.pick)(T.options,["content"])};return JSON.stringify(K,null,2)}const O="To generate this content your dashboard must contain at least one panel with a valid title or description.";function I(T){return T.panels.filter(K=>K.title.length>0&&K.title!==o.LH||K.description&&K.description.length>0).map(R)}const R=(T,L)=>`- Panel ${L} 242- Title: ${T.title}${T.description?` 243- Description: ${T.description}`:""}`},98314:(ee,B,e)=>{"use strict";e.d(B,{B6:()=>u,E_:()=>x,jD:()=>i});var t=e(2543),n=e.n(t),r=e(72985),o=e(77154),s=e(739),m=e(80011),a=e(28105),l=e(43173),f=e(34273),h=e(8095);function u(P){const d=[];if(P?.series)for(const D of P.series)d.push((0,o.Nw)(D));if(P?.annotations)for(const D of P.annotations){const b=(0,o.Nw)(D);b.schema?.meta||(b.schema.meta={}),b.schema.meta.dataTopic=s.QR.Annotations,d.push(b)}return d}function i(P,d){const D=P.getSaveModel(),b={panelType:D.type,datasource:"??"},E=l.$.buildInfo.versionString;let v=`| Key | Value | 244|--|--| 245| Panel | ${b.panelType} @ ${D.pluginVersion??E} | 246| Grafana | ${E} // ${l.$.buildInfo.edition} | 247`;return d&&(v+="<details><summary>Panel debug snapshot dashboard</summary>\n\n```json\n"+d+"\n```\n</details>"),v}async function x(P,d,D){const b=P.getSaveModel(),E=(0,t.cloneDeep)(y),v={panelType:b.type,datasource:"??"},C=await(0,r._)(P.getQueryRunner().getData({withFieldConfig:!1,withTransforms:!1})),S=P.datasource,O=(0,f.W)(u(C),d),I=l.$.buildInfo.versionString,R=b?.targets??[],T=`<table width="100%"> 248 <tr> 249 <th width="2%">Panel</th> 250 <td >${v.panelType} @ ${b.pluginVersion??I}</td> 251 </tr> 252 <tr> 253 <th>Queries</th> 254 <td>${R.map(L=>{const K=L.datasource??S;return`${L.refId}[${K?.type}]`}).join(", ")}</td> 255 </tr> 256 ${g(b)} 257 ${p(C,O)} 258 ${c(C)} 259 <tr> 260 <th>Grafana</th> 261 <td>${I} // ${l.$.buildInfo.edition}</td> 262 </tr> 263 </table>`.trim();if(E.panels[0]={...b,...E.panels[0],targets:[{refId:"A",datasource:{type:"grafana",uid:"grafana"},queryType:h.nj.Snapshot,snapshot:O}]},b.transformations?.length){const L=E.panels[E.panels.length-1];L.title=L.title+" (after transformations)";const K=(0,t.cloneDeep)(L);K.id=100,K.title="Data (before transformations)",K.gridPos.w=24,K.targets[0].withTransforms=!1,E.panels.push(K)}return C.annotations?.length&&E.panels.push({id:7,gridPos:{h:6,w:24,x:0,y:20},type:"table",title:"Annotations",datasource:{type:"datasource",uid:"-- Dashboard --"},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,topic:s.QR.Annotations,refId:"A"}]}),E.panels[1].options.content=T,E.panels[2].options.content=JSON.stringify(b,null,2),E.title=`Debug: ${b.title} // ${(0,m.LE)(new Date)}`,E.tags=["debug",`debug-${v.panelType}`],E.time={from:D.from.toISOString(),to:D.to.toISOString()},E}function g(P){return P.transformations?`<tr> 264 <th>Transform</th> 265 <td>${P.transformations.map(d=>d.id).join(", ")}</td> 266 </tr>`:""}function p(P,d){let D=P.series.length??0,b=0,E=0;for(const v of P.series)b+=v.fields.length,E+=v.length;return`<tr><th>Data</th><td>${P.state!==a.Gu.Done?P.state:""} ${D} frames, ${b} fields, ${E} rows </td></tr>`}function c(P){return P.annotations?.length?`<tr> 267 <th>Annotations</th> 268 <td>${P.annotations.map((d,D)=>`<span>${d.length}</span>`)}</td> 269</tr>`:""}const y={panels:[{id:2,title:"Reproduced with embedded data",datasource:{type:"grafana",uid:"grafana"},gridPos:{h:13,w:15,x:0,y:0}},{gridPos:{h:7,w:9,x:15,y:0},id:5,options:{content:"...",mode:"html"},title:"Debug info",type:"text"},{id:6,title:"Original Panel JSON",type:"text",gridPos:{h:13,w:9,x:15,y:7},options:{content:"...",mode:"code",code:{language:"json",showLineNumbers:!0,showMiniMap:!0}}},{id:3,title:"Data from panel above",type:"table",datasource:{type:"datasource",uid:"-- Dashboard --"},gridPos:{h:7,w:15,x:0,y:13},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,refId:"A"}]}],schemaVersion:37}},14252:(ee,B,e)=>{"use strict";e.d(B,{BN:()=>l,kx:()=>f,sd:()=>a});var t=e(96540),n=e(24705),r=e(78282),o=e(56840),s=e(26689),m=e(61215);const a=h=>(0,n.A)(async()=>l(h),[h]).value;async function l(h){const u=h?.request?.targets||[];if(h&&h.series&&u.length){for(const i of h.series)if(i.meta&&i.meta.custom){const x=await(0,r.l)().get(u[0].datasource);if(x&&x.components?.MetadataInspector)return x}}}const f=(h,u,i,x,g)=>(0,t.useMemo)(()=>{const p=[];return(0,m.$)(i)&&(p.push({label:(0,o.t)("dashboard.inspect.data-tab","Data"),value:s.q.Data}),p.push({label:(0,o.t)("dashboard.inspect.stats-tab","Stats"),value:s.q.Stats})),g&&p.push({label:(0,o.t)("dashboard.inspect.meta-tab","Meta data"),value:s.q.Meta}),p.push({label:(0,o.t)("dashboard.inspect.json-tab","JSON"),value:s.q.JSON}),x&&p.push({label:(0,o.t)("dashboard.inspect.error-tab","Error"),value:s.q.Error}),u.meta.canEdit&&(0,m.$)(i)&&p.push({label:(0,o.t)("dashboard.inspect.query-tab","Query"),value:s.q.Query}),p},[i,g,u,x])},74098:(ee,B,e)=>{"use strict";e.d(B,{D:()=>g});var t=e(74848),n=e(22803),r=e(96540),o=e(78685),s=e(85629),m=e(72489),a=e(63142),l=e(45967),f=e(30703),h=e(45861),u=e(70958),i=e(42795);const x="showCategory",g=r.memo(({id:y,title:P,children:d,forceOpen:D,isOpenDefault:b=!0,renderTitle:E,className:v,itemsCount:C,isNested:S=!1,sandboxId:O,disabledText:I})=>{const[R,T]=(0,o.A)(c(y),{isExpanded:b}),L=D||(R?.isExpanded??b),[K,A]=(0,r.useState)(L),W=(0,r.useRef)(null),[N,w]=(0,u.s)(),j=N[x]===y;(0,r.useEffect)(()=>{(D||j)&&!K&&(A(!0),setTimeout(()=>{W.current?.scrollIntoView()},200))},[K,j,D]);const V=(0,r.useCallback)(()=>{w({[x]:K?void 0:y},!0),T({isExpanded:!K}),A(!K)},[w,K,y,T]);E||(E=function(Z){return Z||C===void 0||C===0?P:(0,t.jsxs)("span",{children:[P," ",(0,t.jsx)(m.p,{value:C})]})});const U=(0,a.of)(p),F=(0,n.cx)({[U.box]:!0,[U.boxNestedExpanded]:S&&K},v),M=(0,n.cx)(U.header,{[U.headerExpanded]:K,[U.headerNested]:S}),H=(0,n.cx)(U.body,{[U.bodyNested]:S});return I?(0,t.jsx)("div",{className:F,"data-plugin-sandbox":O,"data-testid":s.Tp.components.OptionsGroup.group(y),ref:W,children:(0,t.jsx)(l.m,{content:I,children:(0,t.jsxs)("div",{className:M,children:[(0,t.jsx)("h6",{id:`button-${y}`,className:(0,n.cx)(U.title,U.titleDisabled),children:E(K)}),(0,t.jsx)(f.I,{size:"sm",name:"ban",className:U.disabledIcon})]})})}):(0,t.jsxs)("div",{className:F,"data-plugin-sandbox":O,"data-testid":s.Tp.components.OptionsGroup.group(y),ref:W,children:[(0,t.jsxs)("div",{className:M,onClick:V,children:[(0,t.jsx)("h6",{id:`button-${y}`,className:(0,n.cx)(U.title,K&&U.titleExpanded),children:E(K)}),(0,t.jsx)(h.$n,{"data-testid":s.Tp.components.OptionsGroup.toggle(y),type:"button",fill:"text",size:"md",variant:"secondary","aria-expanded":K,className:U.toggleButton,icon:K?"angle-up":"angle-down",onClick:V})]}),K&&(0,t.jsx)("div",{className:H,id:y,"aria-labelledby":`button-${y}`,children:d})]})}),p=y=>({box:(0,n.css)({borderTop:`1px solid ${y.colors.border.weak}`}),boxNestedExpanded:(0,n.css)({marginBottom:y.spacing(2)}),title:(0,n.css)({flexGrow:1,overflow:"hidden",lineHeight:1.5,fontSize:"1rem",fontWeight:y.typography.fontWeightMedium,margin:0,color:y.colors.text.secondary}),titleExpanded:(0,n.css)({color:y.colors.text.primary}),header:(0,n.css)({display:"flex",alignItems:"center",padding:y.spacing(.5,1.5),color:y.colors.text.primary,fontWeight:y.typography.fontWeightMedium,cursor:"pointer","&:hover":{background:y.colors.emphasize(y.colors.background.primary,.03)}}),toggleButton:(0,n.css)({alignSelf:"baseline"}),headerExpanded:(0,n.css)({color:y.colors.text.primary}),headerNested:(0,n.css)({padding:y.spacing(.5,0,.5,0)}),body:(0,n.css)({padding:y.spacing(1,2,1,2)}),titleDisabled:(0,n.css)({color:y.colors.text.disabled,cursor:"not-allowed"}),disabledIcon:(0,n.css)({color:y.colors.text.disabled,marginRight:y.spacing(1)}),bodyNested:(0,n.css)({position:"relative",paddingRight:0,"&:before":{content:"''",position:"absolute",top:0,left:"1px",width:"1px",height:"100%",background:y.colors.border.weak}})}),c=y=>`${i.wi}.optionGroup[${y}]`},25797:(ee,B,e)=>{"use strict";e.d(B,{C:()=>o});var t=e(74848),n=e(31286),r=e(74098);class o{constructor(m){this.props=m,this.items=[],this.categories=[]}addItem(m){return m.parent=this,this.items.push(m),this}addCategory(m){return m.props.isNested=!0,m.parent=this,this.categories.push(m),this}getCategory(m){let a=this.categories.find(l=>l.props.id===m);return a||(a=new o({title:m,id:m}
269),this.addCategory(a)),a}render(m){return this.props.customRender?this.props.customRender():this.props.title===""?(0,t.jsx)(n.a,{padding:2,paddingBottom:1,children:this.items.map(a=>a.render(m))},this.props.title):(0,t.jsxs)(r.D,{...this.props,children:[this.items.map(a=>a.render(m)),this.categories.map(a=>a.render(m))]},this.props.title)}}},51156:(ee,B,e)=>{"use strict";e.d(B,{v:()=>i});var t=e(74848),n=e(22803),r=e(23257),o=e.n(r),s=e(85629),m=e(37386),a=e(72636),l=e(63142),f=e(45967);function h({overrides:P}){const d=(0,l.of)(u);return(0,t.jsx)("div",{className:d.wrapper,children:P.map((D,b)=>(0,t.jsx)(f.m,{content:D.tooltip,placement:"top",children:(0,t.jsx)("div",{"aria-label":D.description,className:d[D.type]})},b.toString()))})}const u=P=>{const d={width:8,height:8,borderRadius:P.shape.radius.circle,marginLeft:P.spacing(1),top:"-1px"};return{wrapper:(0,n.css)({display:"flex"}),rule:(0,n.css)({...d,position:"relative",backgroundColor:P.colors.primary.main}),data:(0,n.css)({...d,position:"relative",backgroundColor:P.colors.warning.main})}};class i{constructor(d){this.props=d}render(d){return(0,t.jsx)(x,{itemDescriptor:this,searchQuery:d},this.props.title)}useShowIf(){return this.props.useShowIf?this.props.useShowIf():this.props.showIf?this.props.showIf():!0}}function x({itemDescriptor:P,searchQuery:d}){const{title:D,description:b,render:E,skipField:v}=P.props,C=`${P.parent.props.id} ${D}`;return P.useShowIf()?v?E():(0,t.jsx)(m.D,{label:g(P,d),description:b,"aria-label":s.Tp.components.PanelEditor.OptionsPane.fieldLabel(C),children:E()},C):null}function g(P,d){const{title:D,description:b,overrides:E,addon:v}=P.props;if(!d)return P.parent.props.title===D&&!E?.length?null:(0,t.jsx)(c,{title:D,description:b,overrides:E,addon:v});const C=[];return P.parent.parent&&C.push(p(P.parent.parent.props.title,d)),P.parent.props.title!==D&&C.push(p(P.parent.props.title,d)),(0,t.jsxs)(a.J,{description:b&&p(b,d),category:C,children:[p(D,d),E&&E.length>0&&(0,t.jsx)(h,{overrides:E})]})}function p(P,d){return(0,t.jsx)(o(),{textToHighlight:P,searchWords:[d],highlightClassName:"search-fragment-highlight"})}function c({title:P,description:d,overrides:D,addon:b}){const E=(0,l.of)(y);return(0,t.jsxs)("div",{className:E.container,children:[(0,t.jsxs)(a.J,{description:d,children:[P,D&&D.length>0&&(0,t.jsx)(h,{overrides:D})]}),b]})}function y(P){return{container:(0,n.css)({display:"flex",justifyContent:"space-between"})}}},68373:(ee,B,e)=>{"use strict";e.d(B,{gs:()=>w,Ff:()=>W,Po:()=>j});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(12737),m=e(77824),a=e(92807),l=e(56840),f=e(75515),h=e(74098),u=e(25531),i=e(63527);const x=({panel:U,formatDate:F})=>{const M=(0,o.of)(g),H=U.libraryPanel?.meta;return H?(0,t.jsxs)("div",{className:M.info,children:[(0,t.jsxs)("div",{className:M.libraryPanelInfo,children:[`Used on ${H.connectedDashboards} `,H.connectedDashboards===1?"dashboard":"dashboards"]}),(0,t.jsxs)("div",{className:M.libraryPanelInfo,children:["Last edited on ",F?.(H.updated,"L")??H.updated," by",H.updatedBy.avatarUrl&&(0,t.jsx)("img",{width:"22",height:"22",className:M.userAvatar,src:H.updatedBy.avatarUrl,alt:`Avatar for ${H.updatedBy.name}`}),H.updatedBy.name]})]}):null},g=U=>({info:(0,n.css)({lineHeight:1}),libraryPanelInfo:(0,n.css)({color:U.colors.text.secondary,fontSize:U.typography.bodySmall.fontSize}),userAvatar:(0,n.css)({borderRadius:U.shape.radius.circle,boxSizing:"content-box",width:"22px",height:"22px",paddingLeft:U.spacing(1),paddingRight:U.spacing(1)})});var p=e(25797),c=e(51156);function y(U){const{panel:F,onPanelConfigChange:M,dashboard:H}=U,_=new p.C({title:"Library panel options",id:"Library panel options",isOpenDefault:!0});return(0,f.X)(F)&&_.addItem(new c.v({title:"Name",value:F.libraryPanel.name,popularRank:1,render:function(){return(0,t.jsx)(i.p,{id:"LibraryPanelFrameName",defaultValue:F.libraryPanel.name,onBlur:ne=>M("libraryPanel",{...F.libraryPanel,name:ne.currentTarget.value})})}})).addItem(new c.v({title:"Information",render:function(){return(0,t.jsx)(x,{panel:F,formatDate:H.formatDate})}})),_}var P=e(85629),d=e(43173),D=e(87105),b=e(21285),E=e(96822),v=e(18857),C=e(82345),S=e(22055),O=e(76623),I=e(31819);function R(U){const{dashboard:F,panel:M,onPanelConfigChange:H}=U,_=new p.C({title:"Panel options",id:"Panel options",isOpenDefault:!0}),Z=te=>{const Y=document.getElementById("PanelFrameTitle");Y instanceof HTMLInputElement&&(Y.value=te,H("title",te))},ne=te=>{const Y=document.getElementById("description-text-area");Y instanceof HTMLTextAreaElement&&(Y.value=te,H("description",te))};return _.addItem(new c.v({title:"Title",value:M.title,popularRank:1,render:function(){return(0,t.jsx)(i.p,{"data-testid":P.Tp.components.PanelEditor.OptionsPane.fieldInput("Title"),id:"PanelFrameTitle",defaultValue:M.title,onBlur:Y=>H("title",Y.currentTarget.value)})},addon:d.$.featureToggles.dashgpt&&(0,t.jsx)(O.h,{onGenerate:Z,panel:M.getSaveModel(),dashboard:F.getSaveModelClone()})})).addItem(new c.v({title:"Description",description:M.description,value:M.description,render:function(){return(0,t.jsx)(D.f,{"data-testid":P.Tp.components.PanelEditor.OptionsPane.fieldInput("Description"),id:"description-text-area",defaultValue:M.description,onBlur:Y=>H("description",Y.currentTarget.value)})},addon:d.$.featureToggles.dashgpt&&(0,t.jsx)(S.t,{onGenerate:ne,panel:M.getSaveModel()})}
269)).addItem(new c.v({title:"Transparent background",render:function(){return(0,t.jsx)(b.d,{"data-testid":P.Tp.components.PanelEditor.OptionsPane.fieldInput("Transparent background"),value:M.transparent,id:"transparent-background",onChange:Y=>H("transparent",Y.currentTarget.checked)})}})).addCategory(new p.C({title:"Panel links",id:"Panel links",isOpenDefault:!1,itemsCount:M.links?.length}).addItem(new c.v({title:"Panel links",render:function(){return(0,t.jsx)(E.e,{links:M.links,onChange:Y=>H("links",Y),getSuggestions:C.Fq,data:[]})}}))).addCategory(new p.C({title:"Repeat options",id:"Repeat options",isOpenDefault:!1}).addItem(new c.v({title:"Repeat by variable",description:"Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard.",render:function(){return(0,t.jsx)(I.G,{id:"repeat-by-variable-select",repeat:M.repeat,onChange:Y=>{H("repeat",Y)}})}})).addItem(new c.v({title:"Repeat direction",showIf:()=>!!M.repeat,render:function(){const Y=[{label:"Horizontal",value:"h"},{label:"Vertical",value:"v"}];return(0,t.jsx)(m.z,{options:Y,value:M.repeatDirection||"h",onChange:Q=>H("repeatDirection",Q)})}})).addItem(new c.v({title:"Max per row",showIf:()=>!!(M.repeat&&M.repeatDirection==="h"),render:function(){const Y=[2,3,4,6,8,12].map(Q=>({label:Q.toString(),value:Q}));return(0,t.jsx)(v.l6,{options:Y,value:M.maxPerRow,onChange:Q=>H("maxPerRow",Q.value)})}})))}var T=e(56424);class L{constructor(F,M){this.categories=F,this.overrides=M}search(F){const M=new RegExp(F,"i"),_=this.collectHits(this.categories,M,[]).sort(K).map(te=>te.item),ne=this.collectHits(this.overrides,M,[]).sort(K).map(te=>te.item);return{optionHits:_,overrideHits:this.buildOverrideHitCategories(ne),totalCount:this.getAllOptionsCount(this.categories)}}collectHits(F,M,H){for(const _ of F){const Z=M.test(_.props.title);for(const ne of _.items){if(M.test(ne.props.title)){H.push({item:ne,rank:1});continue}if(ne.props.description&&M.test(ne.props.description)){H.push({item:ne,rank:2});continue}Z&&H.push({item:ne,rank:3})}_.categories.length>0&&this.collectHits(_.categories,M,H)}return H}getAllOptionsCount(F){let M=0;for(const H of F)M+=H.items.length,H.categories.length>0&&(M+=this.getAllOptionsCount(H.categories));return M}buildOverrideHitCategories(F){const M={};for(const H of F){let _=M[H.parent.props.title];_||(_=M[H.parent.props.title]=new p.C(H.parent.props),_.addItem(H.parent.items[0])),_.items[0].props.title!==H.props.title&&_.addItem(H)}return Object.values(M)}}function K(U,F){return U.rank-F.rank}function A(U){const F=[];for(const M of U)for(const H of M.items)H.props.title==="Unit"&&(H.props.popularRank=2),H.props.title==="Min"&&(H.props.popularRank=3),H.props.title==="Max"&&(H.props.popularRank=4),H.props.title==="Display name"&&(H.props.popularRank=5),H.props.popularRank&&F.push(H);return F.sort((M,H)=>M.props.popularRank-H.props.popularRank)}const W=U=>{const{plugin:F,panel:M}=U,[H,_]=(0,r.useState)(""),[Z,ne]=(0,r.useState)("All"),te=(0,o.of)(V),[Y,Q,J]=(0,r.useMemo)(()=>[R(U),(0,T.Zm)(U),y(U)],[M.configRev,U.data,U.instanceState,H]),q=(0,r.useMemo)(()=>(0,u.v)(U.panel.fieldConfig,U.plugin.fieldConfigRegistry,U.data?.series??[],H,U.onFieldConfigsChange),[M.configRev,U.data,U.instanceState,H]),X=[],se=H.length>0,oe=(0,r.useMemo)(N,[]),ae=(0,f.X)(M)?[J,Y,...Q]:[Y,...Q];if(se)X.push(j(ae,q,H));else switch(Z){case"All":(0,f.X)(M)&&X.push(J.render()),X.push(Y.render());for(const fe of Q)X.push(fe.render());for(const fe of q)X.push(fe.render());break;case"Overrides":for(const fe of q)X.push(fe.render());break;case"Recent":X.push((0,t.jsx)(h.D,{id:"Recent options",title:(0,l.t)("dashboard.options-pane-options.Recent options-title-recent-options","Recent options"),forceOpen:!0,children:A(ae).map(fe=>fe.render())},"Recent options"));break}const ie=!se&&!F.fieldConfigRegistry.isEmpty();return(0,t.jsxs)("div",{className:te.wrapper,children:[(0,t.jsxs)("div",{className:te.formBox,children:[(0,t.jsx)("div",{className:te.formRow,children:(0,t.jsx)(s.Z,{width:0,value:H,onChange:_,placeholder:(0,l.t)("dashboard.options-pane-options.placeholder-search-options","Search options")})}),ie&&(0,t.jsx)("div",{className:te.formRow,children:(0,t.jsx)(m.z,{options:oe,value:Z,fullWidth:!0,onChange:ne})})]}),(0,t.jsx)(a.P,{children:(0,t.jsx)("div",{className:te.mainBox,children:X})})]})};function N(){return[{label:"All",value:"All"},{label:"Overrides",value:"Overrides"}]}var w=(U=>(U.All="All",U.Overrides="Overrides",U.Recent="Recent",U))(w||{});function j(U,F,M){const H=new L(U,F),{optionHits:_,totalCount:Z,overrideHits:ne}=H.search(M);return(0,t.jsxs)("div",{children:[(0,t.jsx)(h.D,{id:"Found options",title:`Matched ${_.length}/${Z} options`,forceOpen:!0,children:_.map(te=>te.render(M))},"Normal options"),ne.map(te=>te.render(M))]},"search results")}const V=U=>
269({wrapper:(0,n.css)({height:"100%",display:"flex",flexDirection:"column",flex:"1 1 0",".search-fragment-highlight":{color:U.colors.warning.text,background:"transparent"}}),searchBox:(0,n.css)({display:"flex",flexDirection:"column",minHeight:0}),formRow:(0,n.css)({marginBottom:U.spacing(1)}),formBox:(0,n.css)({padding:U.spacing(1),background:U.colors.background.primary,border:`1px solid ${U.components.panel.borderColor}`,borderTopLeftRadius:U.shape.borderRadius(1.5),borderBottom:"none"}),closeButton:(0,n.css)({marginLeft:U.spacing(1)}),searchHits:(0,n.css)({padding:U.spacing(1,1,0,1)}),searchNotice:(0,n.css)({fontSize:U.typography.size.sm,color:U.colors.text.secondary,padding:U.spacing(1),textAlign:"center"}),mainBox:(0,n.css)({background:U.colors.background.primary,border:`1px solid ${U.components.panel.borderColor}`,borderTop:"none",flexGrow:1}),angularDeprecationWrapper:(0,n.css)({padding:U.spacing(1)})})},25531:(ee,B,e)=>{"use strict";e.d(B,{v:()=>R});var t=e(74848),n=e(22803),r=e(2543),o=e(36638),s=e(83340),m=e(63152),a=e(59695),l=e(63142),f=e(56840),h=e(82345),u=e(96540),i=e(23257),x=e.n(i),g=e(32881),p=e(72636),c=e(72489),y=e(76319),P=e(37386),d=e(74098);const D=({property:A,context:W,registry:N,onChange:w,onRemove:j,isSystemOverride:V,searchQuery:U})=>{const F=(0,l.of)(b),M=N?.getIfExists(A.id),H=(0,u.useId)();if(!M)return null;const _=Array.isArray(A.value)||A.id===s.uo.Thresholds||A.id===s.uo.Links||A.id===s.uo.Mappings,Z=M.category?.filter(Y=>Y!==M.name);let ne;const te=(Y=!0,Q=!1)=>(J=!1)=>(0,t.jsxs)(g.Gy,{justify:"space-between",children:[(0,t.jsxs)(p.J,{category:Z,description:Y?M.description:void 0,htmlFor:H,children:[(0,t.jsx)(x(),{textToHighlight:M.name,searchWords:[U],highlightClassName:"search-fragment-highlight"}),!J&&Q&&M.getItemsCount&&(0,t.jsx)(c.p,{value:M.getItemsCount(A.value)})]}),!V&&(0,t.jsx)("div",{children:(0,t.jsx)(y.K,{name:"times",onClick:j,tooltip:(0,f.t)("dashboard.dynamic-config-value-editor.render-label.tooltip-remove-property","Remove property")})})]});return _?ne=(0,t.jsx)(d.D,{id:M.name,renderTitle:te(!1,!0),className:(0,n.css)({paddingLeft:0,paddingRight:0}),isNested:!0,isOpenDefault:A.value!==void 0,children:(0,t.jsx)(M.override,{value:A.value,onChange:Y=>{w(Y)},item:M,context:W})}):ne=(0,t.jsx)("div",{children:(0,t.jsx)(P.D,{label:te()(),description:M.description,children:(0,t.jsx)(M.override,{value:A.value,onChange:Y=>{w(Y)},item:M,context:W,id:H})})}),(0,t.jsx)("div",{className:(0,n.cx)(_&&F.collapsibleOverrideEditor,!_&&"dynamicConfigValueEditor--nonCollapsible"),children:ne})},b=A=>({collapsibleOverrideEditor:(0,n.css)({label:"collapsibleOverrideEditor","& + .dynamicConfigValueEditor--nonCollapsible":{marginTop:A.spacing(1)}})});var E=e(25797),v=e(51156),C=e(45861),S=e(30703);const O=({isExpanded:A,registry:W,matcherUi:N,overrideName:w,override:j,onOverrideRemove:V})=>{const U=(0,l.of)(I),M=j.properties.map(_=>W.getIfExists(_.id)).filter(_=>!!_).map(_=>_?.name).join(", "),H=N.optionsToLabel(j.matcher.options);return(0,t.jsxs)("div",{children:[(0,t.jsxs)(g.Gy,{justify:"space-between",children:[(0,t.jsx)("div",{children:w}),(0,t.jsx)(C.$n,{variant:"secondary",fill:"text",icon:"trash-alt",onClick:V,tooltip:(0,f.t)("dashboard.override-category-title.tooltip-remove-override","Remove override"),"aria-label":(0,f.t)("dashboard.override-category-title.aria-label-remove-override","Remove override")})]}),!A&&(0,t.jsx)("div",{className:U.overrideDetails,children:(0,t.jsxs)("div",{className:U.options,title:H,children:[H," ",(0,t.jsx)(S.I,{name:"angle-right"})," ",M]})})]})};O.displayName="OverrideTitle";const I=A=>({matcherUi:(0,n.css)({padding:A.spacing(1)}),propertyPickerWrapper:(0,n.css)({marginTop:A.spacing(2)}),overrideDetails:(0,n.css)({fontSize:A.typography.bodySmall.fontSize,color:A.colors.text.secondary,fontWeight:A.typography.fontWeightRegular}),options:(0,n.css)({overflow:"hidden",paddingRight:A.spacing(4)}),unknownLabel:(0,n.css)({marginBottom:0})});function R(A,W,N,w,j){const V=[],U=A;if(!W||W.isEmpty())return[];const F=(Z,ne)=>{let te=(0,r.cloneDeep)(U.overrides);te[Z]=ne,j({...U,overrides:te})},M=Z=>{let ne=(0,r.cloneDeep)(U.overrides);ne.splice(Z,1),j({...U,overrides:ne})}
269,H=Z=>{const ne=o.sJ.get(Z.value);ne&&j({...U,overrides:[...U.overrides,{matcher:{id:ne.id,options:ne.defaultOptions},properties:[]}]})},_={data:N,getSuggestions:Z=>(0,h.Hf)(N,Z),isOverride:!0};for(let Z=0;Z<U.overrides.length;Z++){const ne=U.overrides[Z],te=`Override ${Z+1}`,Y=m.g.get(ne.matcher.id),Q=T(W),J=(0,s.Ow)(ne),q=ne.properties.length===0,X=new E.C({title:te,id:te,forceOpen:q,renderTitle:function(ie){return(0,t.jsx)(O,{override:ne,isExpanded:ie,registry:W,overrideName:te,matcherUi:Y,onOverrideRemove:()=>M(Z)})}}),se=ae=>{F(Z,{...ne,matcher:{...ne.matcher,options:ae}})},oe=(ae,ie)=>{const fe=W.get(ie.value),pe={id:fe.id,value:fe.defaultValue},de=ae.properties??[];de.push(pe),F(Z,{...ae,properties:de})};X.addItem(new v.v({title:Y.name,render:function(){return(0,t.jsx)(Y.component,{id:`${Y.matcher.id}-${Z}`,matcher:Y.matcher,data:N??[],options:ne.matcher.options,onChange:se})}}));for(let ae=0;ae<ne.properties.length;ae++){const ie=ne.properties[ae],fe=W.getIfExists(ie.id);if(!fe)continue;const pe=le=>{F(Z,{...ne,properties:ne.properties.map((me,De)=>De===ae?{...me,value:le}:me)})},de=()=>{F(Z,{...ne,properties:ne.properties.filter((le,me)=>me!==ae)})};X.addItem(new v.v({title:fe.name,skipField:!0,render:function(){return(0,t.jsx)(D,{isSystemOverride:J,onChange:pe,onRemove:de,property:ie,registry:W,context:_,searchQuery:w},`${ie.id}/${ae}`)}}))}
269!J&&ne.matcher.options&&X.addItem(new v.v({title:"----------",skipField:!0,render:function(){return(0,t.jsx)(a.i,{label:(0,f.t)("dashboard.get-field-override-categories.label-add-override-property","Add override property"),variant:"secondary",isFullWidth:!0,icon:"plus",menuPlacement:"auto",options:Q,onChange:ie=>oe(ne,ie)},"Add override property")}})),V.push(X)}return V.push(new E.C({title:"add button",id:"add button",customRender:function(){return(0,t.jsx)(L,{children:(0,t.jsx)(a.i,{icon:"plus",label:(0,f.t)("dashboard.get-field-override-categories.label-add-field-override","Add field override"),variant:"secondary",menuPlacement:"auto",isFullWidth:!0,size:"md",options:m.g.list().filter(ne=>!ne.excludeFromPicker).map(ne=>({label:ne.name,value:ne.id,description:ne.description})),onChange:ne=>H(ne)})},"Add override")}})),V}function T(A){return A.list().filter(W=>!W.hideFromOverrides).map(W=>{let N=W.name;return W.category&&(N=[...W.category,W.name].join(" > ")),{label:N,value:W.id,description:W.description}})}function L({children:A}){const W=(0,l.of)(K);return(0,t.jsx)("div",{className:W,children:A})}function K(A){return(0,n.css)({borderTop:`1px solid ${A.colors.border.weak}`,padding:`${A.spacing(2)}`,display:"flex"})}},56424:(ee,B,e)=>{"use strict";e.d(B,{g5:()=>b,tN:()=>d,Zm:()=>P,Z4:()=>D});var t=e(74848),n=e(2543),r=e(52205),o=e(63527),s=e(22803),m=e(80011),a=e(63142);const l=({libraryPanel:E})=>{const v=(0,a.of)(f),C=E.useState(),S=C.$timeRange?.getTimeZone(),O=C._loadedPanel?.meta;return O?(0,t.jsxs)("div",{className:v.info,children:[(0,t.jsxs)("div",{className:v.libraryPanelInfo,children:[`Used on ${O.connectedDashboards} `,O.connectedDashboards===1?"dashboard":"dashboards"]}),(0,t.jsxs)("div",{className:v.libraryPanelInfo,children:[(0,m.LE)(O.updated,{format:"L",timeZone:S})," by",O.updatedBy.avatarUrl&&(0,t.jsx)("img",{className:v.userAvatar,src:O.updatedBy.avatarUrl,alt:`Avatar for ${O.updatedBy.name}`}),O.updatedBy.name]})]}):null},f=E=>({info:(0,s.css)({lineHeight:1}),libraryPanelInfo:(0,s.css)({color:E.colors.text.secondary,fontSize:E.typography.bodySmall.fontSize}),userAvatar:(0,s.css)({borderRadius:E.shape.radius.circle,boxSizing:"content-box",width:"22px",height:"22px",paddingLeft:E.spacing(1),paddingRight:E.spacing(1)})});var h=e(82345),u=e(25797),i=e(51156);const x="Some data fields have this option pre-configured. Add a field override rule to override the pre-configured value.",g="An override rule exists for this property";function p(E,v,C){const S=[];if(C){for(const I of C)for(const R of I.fields)if((0,n.get)(R.config,E.path)!=null){S.push({type:"data",description:x,tooltip:x});break}}return v.overrides.some(I=>I.properties.some(R=>R.id===E.id))&&S.push({type:"rule",description:g,tooltip:g}),S}var c=e(61215);function y({data:E,replaceVariables:v,options:C,eventBus:S,instanceState:O}){const I=E?.series??[];return{data:I,replaceVariables:v,options:C,eventBus:S,getSuggestions:T=>(0,h.Hf)(I,T),instanceState:O,annotations:E?.annotations}}function P(E){const{plugin:v,panel:C,onPanelOptionsChanged:S,onFieldConfigsChange:O,data:I,dashboard:R,instanceState:T}=E,L=C.getOptions(),K=C.fieldConfig,A={},W=y({data:I,replaceVariables:C.replaceVariables,options:L,eventBus:R.events,instanceState:T}),N=j=>{const V=(j&&j[0])??`${v.meta.name}`,U=A[V];return U||(A[V]=new u.C({title:V,id:V,sandboxId:v.meta.id}))},w={getValue:j=>(0,n.get)(L,j),onChange:(j,V)=>{const U=(0,c.Sf)(L,j,V);S(U)}};b(v.getPanelOptionsSupplier(),w,N,W);for(const j of v.fieldConfigRegistry.list()){if(j.isCustom){if(j.showIf&&!j.showIf(K.defaults.custom,I?.series,I?.annotations))continue}else if(j.showIf&&!j.showIf(K.defaults,I?.series,I?.annotations))continue;if(j.hideFromDefaults)continue;const V=N(j.category),U=j.editor,F=K.defaults,M=j.isCustom?F.custom?(0,n.get)(F.custom,j.path):void 0:(0,n.get)(F,j.path);j.getItemsCount&&(V.props.itemsCount=j.getItemsCount(M)),V.addItem(new i.v({title:j.name,description:j.description,overrides:p(j,K,I?.series),render:function(){const _=Z=>{O((0,c.EQ)(K,j.path,Z,j.isCustom))};return(0,t.jsx)(U,{value:M,onChange:_,item:j,context:W,id:j.id})}}))}return Object.values(A)}function d(E){const v=new u.C({title:"Library panel options",id:"Library panel options",isOpenDefault:!0});return v.addItem(new i.v({title:"Name",value:E,popularRank:1,render:function(){return(0,t.jsx)(o.p,{id:"LibraryPanelFrameName","data-testid":"library panel name input",defaultValue:E.state.name,onBlur:S=>E.setState({name:S.currentTarget.value})})}})).addItem(new i.v({title:"Information",render:function(){return(0,t.jsx)(l,{libraryPanel:E})}})),v}function D(E){const{plugin:v,panel:C,data:S,eventBus:O,instanceState:I}=E,R={},T=N=>{const w=N?.[0]??v.meta.name,j=R[w];return j||(R[w]=new u.C({title:w,id:w,sandboxId:v.meta.id}))},L=C.state.options,K={getValue:N=>(0,n.get)(L,N),onChange:(N,w)=>{const j=(0,c.Sf)(L,N,w);C.onOptionsChange(j)}},A=y({data:S,replaceVariables:C.interpolate,options:L,eventBus:O,instanceState:I});b(v.getPanelOptionsSupplier(),K,T,A);const W=C.state.fieldConfig;for(const N of v.fieldConfigRegistry.list()){const w=N.showIf&&(N.isCustom?!N.showIf(W.defaults.custom,S?.series,S?.annotations):!N.showIf(W.defaults,S?.series,S?.annotations));if(N.hideFromDefaults||w)continue;const j=T(N.category),V=N.editor,U=W.defaults,F=N.isCustom?U.custom?(0,n.get)(U.custom,N.path):void 0:(0,n.get)(U,N.path);N.getItemsCount&&(j.props.itemsCount=N.getItemsCount(F)),j.addItem(new i.v({title:N.name,description:N.description,overrides:p(N,W,S?.series),render:function(){const H=_=>{C.onFieldConfigChange((0,c.EQ)(W,N.path,_,N.isCustom),!0)};return(0,t.jsx)(V,{value:F,onChange:H,item:N,context:A,id:N.id})}}))}return Object.values(R)}function b(E,v,C,S,O){const I=new r.pv;E(I,S);for(const R of I.getItems()){if(R.showIf&&!R.showIf(S.options,S.data,S.annotations))continue;let T=O;if(T?R.category?.[0]?.length&&(T=T.getCategory(R.category[0])):T=C(R.category),(0,r.iF)(R)){const K=R.getNestedValueAccess(v),A=K.getContext?K.getContext(S):{...S,options:v.getValue(R.path)};b(R.getBuilder(),K,C,A,T);continue}const L=R.editor;T.addItem(new i.v({title:R.name,description:R.description,render:function(){return(0,t.jsx)(L,{value:v.getValue(R.path),onChange:A=>{v.onChange(R.path,A)},item:R,context:S,id:R.id})}}))}}},42795:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>d,GU:()=>u,MJ:()=>x,Ox:()=>g,eK:()=>c,fR:()=>p,kw:()=>y,wi:()=>a});var t=e(65307),n=e(28105),r=e(22592),o=e(29043),s=e(82612),m=e(62667);const a="grafana.dashboard.editor.ui",l={isPanelOptionsVisible:!0,rightPaneSize:400,topPaneSize:.45,mode:m.q5.Fill},f=()=>{const D=o.A.getObject(a,l);let b={...D};return typeof D.topPaneSize=="string"&&(b={...D,topPaneSize:parseFloat(D.topPaneSize)/100}),{getPanel:()=>new s.a9({}),getSourcePanel:()=>new s.a9({}),getData:()=>({state:n.Gu.NotStarted,series:[],timeRange:(0,r.E2)()}),initDone:!1,shouldDiscardChanges:!1,isOpen:!1,isVizPickerOpen:!1,tableViewEnabled:!1,ui:{...l,...b}}},h=(0,t.Z0)({name:"panelEditor",initialState:f(),reducers:{updateEditorInitState:(D,b)=>{D.getPanel=()=>b.payload.panel,D.getSourcePanel=()=>b.payload.sourcePanel,D.initDone=!0,D.isOpen=!0,D.shouldDiscardChanges=!1},setEditorPanelData:(D,b)=>{D.getData=()=>b.payload},setDiscardChanges:(D,b)=>{D.shouldDiscardChanges=b.payload},setPanelEditorUIState:(D,b)=>{D.ui={...D.ui,...b.payload}
269,!D.ui.isPanelOptionsVisible&&D.isVizPickerOpen&&(D.isVizPickerOpen=!1)},toggleVizPicker:(D,b)=>{D.isVizPickerOpen=b.payload,D.isVizPickerOpen&&(D.ui.isPanelOptionsVisible=!0)},toggleTableView(D){D.tableViewEnabled=!D.tableViewEnabled},closeEditor:D=>{D.getPanel=()=>new s.a9({}),D.getSourcePanel=()=>new s.a9({}),D.isOpen=!1,D.initDone=!1,D.isVizPickerOpen=!1,D.tableViewEnabled=!1}}}),{updateEditorInitState:u,setEditorPanelData:i,setDiscardChanges:x,closeEditor:g,setPanelEditorUIState:p,toggleVizPicker:c,toggleTableView:y}=h.actions,d={panelEditor:h.reducer}},62667:(ee,B,e)=>{"use strict";e.d(B,{M8:()=>t,Nt:()=>o,__:()=>m,q5:()=>n});var t=(a=>(a.Query="query",a.Transform="transform",a.Visualize="visualize",a.Alert="alert",a))(t||{}),n=(a=>(a[a.Fill=0]="Fill",a[a.Fit=1]="Fit",a[a.Exact=2]="Exact",a))(n||{}),r=(a=>(a[a.Off=0]="Off",a[a.Table=1]="Table",a))(r||{});const o=[{value:0,label:"Fill",description:"Use all available space"},{value:2,label:"Actual",description:"Make same size as on the dashboard"}],s=[{value:0,label:"Visualization",description:"Show using selected visualization"},{value:1,label:"Table",description:"Show raw data in table form"}];var m=(a=>(a[a.Visualizations=0]="Visualizations",a[a.LibraryPanels=1]="LibraryPanels",a[a.Suggestions=2]="Suggestions",a))(m||{})},61215:(ee,B,e)=>{"use strict";e.d(B,{$:()=>m,A:()=>s,EQ:()=>a,Sf:()=>l});var t=e(2543),n=e.n(t),r=e(95943),o=e(62667);function s(f,h,u,i){if(f===o.q5.Fill)return{width:h,height:u};const x=8*6,c=(window.innerWidth-60-r.dU*4)/r.cV*i.gridPos.w,y=r.sD*i.gridPos.h+x,P=Math.min(h/c,u/y);return c<=h&&y<=u?{width:c,height:y}:{width:c*P,height:y*P}}function m(f){return f?.meta.skipDataQuery===!1}const a=(f,h,u,i)=>{let x={...f.defaults};const g=u==null||u==="";return i?x.custom?g?x.custom=(0,t.omit)(x.custom,h):x.custom=l(x.custom,h,u):g||(x.custom=l(x.custom,h,u)):g?x=(0,t.omit)(x,h):x=l(x,h,u),{...f,defaults:x}};function l(f,h,u){const i=Array.isArray(h)?h:h.split("."),x=i.shift();if(x.endsWith("]")){const p=x.lastIndexOf("["),c=+x.substring(p+1,x.length-1),y=x.substring(0,p);let P=f[y];const d=Array.isArray(P)?[...P]:[];return i.length&&(P=d[c],(P==null||typeof P!="object")&&(P={}),u=l(P,i,u)),d[c]=u,{...f,[y]:d}}if(!i.length)return{...f,[x]:u};let g=f[x];return(g==null||typeof g!="object")&&(g={}),{...f,[x]:l(g,i,u)}}},31819:(ee,B,e)=>{"use strict";e.d(B,{G:()=>a,U:()=>l});var t=e(74848),n=e(96540),r=e(56838),o=e(18857),s=e(96673),m=e(93612);const a=({repeat:f,onChange:h,id:u})=>{const i=(0,s.useSelector)(p=>(0,m.SS)((0,m.y7)(p),p)),x=(0,n.useMemo)(()=>{const p=i.map(c=>({label:c.name,value:c.name}));return p.length===0&&p.unshift({label:"No template variables found",value:null}),p.unshift({label:"Disable repeating",value:null}),p},[i]),g=(0,n.useCallback)(p=>h(p.value),[h]);return(0,t.jsx)(o.l6,{inputId:u,value:f,onChange:g,options:x})},l=({sceneContext:f,repeat:h,id:u,onChange:i})=>{const g=(0,n.useMemo)(()=>r.jh.getVariables(f.getRoot()),[f]).useState().variables,p=(0,n.useMemo)(()=>{const y=g.map(P=>({label:P.state.name,value:P.state.name}));return y.length===0&&y.unshift({label:"No template variables found",value:null}),y.unshift({label:"Disable repeating",value:null}),y},[g]),c=(0,n.useCallback)(y=>i(y.value),[i]);return(0,t.jsx)(o.l6,{inputId:u,value:h,onChange:c,options:p})}},78159:(ee,B,e)=>{"use strict";e.d(B,{C:()=>l,m:()=>f});var t=e(74848),n=e(85629),r=e(27489),o=e(8515),s=e(45861),m=e(56840),a=e(37010);const l=({dashboard:h,onSaveSuccess:u,size:i})=>(0,t.jsx)(o.$s,{children:({showModal:x,hideModal:g})=>(0,t.jsx)(s.$n,{size:i,onClick:()=>{x(a.$,{dashboard:h,onSaveSuccess:u,onDismiss:g})},"aria-label":n.Tp.pages.Dashboard.Settings.General.saveDashBoard,children:(0,t.jsx)(m.x6,{i18nKey:"dashboard.save-dashboard-button.save-dashboard",children:"Save dashboard"})})}),f=({dashboard:h,onClick:u,onSaveSuccess:i,variant:x,size:g})=>(0,t.jsx)(o.$s,{children:({showModal:p,hideModal:c})=>(0,t.jsx)(s.$n,{size:g,onClick:()=>{(0,r.rR)("grafana_dashboard_save_as_clicked"),u?.(),p(a.$,{dashboard:h,onSaveSuccess:i,onDismiss:c,isCopy:!0})},variant:x,"aria-label":n.Tp.pages.Dashboard.Settings.General.saveAsDashBoard,children:(0,t.jsx)(m.x6,{i18nKey:"dashboard.save-dashboard-as-button.save-as",children:"Save as"})})})},30906:(ee,B,e)=>{"use strict";e.d(B,{l:()=>h});var t=e(74848),n=e(16817),r=e(41654),o=e(31286),s=e(34999),m=e(68079),a=e(56840),l=e(34753),f=e(1199);const h=({diff:u,oldValue:i,newValue:x,hasFolderChanges:g,oldFolder:p,newFolder:c,hasMigratedToV2:y})=>{const P=(0,n.A)(async()=>{const D=JSON.stringify(i??{},null,2),b=JSON.stringify(x??{},null,2);let E;const v=[];let C=0;if(u)for(const[S,O]of Object.entries(u)){const I=(0,t.jsx)(l.D,{diffs:O,title:S},S);S==="schemaVersion"?E=I:v.push(I),C+=O.length}return{schemaChange:E,diffs:v,count:C,showDiffs:C<15,jsonView:(0,t.jsx)(f.M,{oldValue:D,newValue:b})}},[u,i,x]),{value:d}=P;return(0,t.jsxs)(r.B,{direction:"column",gap:1,children:[y&&(0,t.jsx)(o.a,{paddingTop:1,children:(0,t.jsx)(s.F,{title:(0,a.t)("dashboard.save-dashboard-diff.title-because-dashboard-migrated-grafana-format","The diff is hard to read because the dashboard has been migrated to the new Grafana dashboard format"),severity:"info"})}),g&&(0,t.jsx)(l.D,{diffs:[{op:"replace",value:c,originalValue:p,path:[],startLineNumber:0,endLineNumber:0}],title:(0,a.t)("dashboard.save-dashboard-diff.title-folder","folder")},"folder"),(!d||!i)&&(0,t.jsx)(m.y,{}),d&&d.count>=1?(0,t.jsxs)(t.Fragment,{children:[!y&&d&&d.schemaChange&&d.schemaChange,d&&d.showDiffs&&d.diffs,(0,t.jsxs)(o.a,{paddingTop:1,children:[(0,t.jsx)("h4",{children:(0,t.jsx)(a.x6,{i18nKey:"dashboard.save-dashboard-diff.full-json-diff",children:"Full JSON diff"})}),d.jsonView]})]}):(0,t.jsx)(o.a,{paddingTop:1,children:(0,t.jsx)(a.x6,{i18nKey:"dashboard.save-dashboard-diff.no-changes-in-the-dashboard-json",children:"No changes in the dashboard JSON"})})]})}},37010:(ee,B,e)=>{"use strict";e.d(B,{$:()=>Qe});var t=e(74848),n=e(96540),r=e(68143),o=e(43173),s=e(8207),m=e(54314),a=e(60208),l=e(56840),f=e(61371),h=e(22803),u=e(16817),i=e(63142),x=e(34999),g=e(83873);function p({dashboard:je}){const ze=(0,i.of)(c),{loading:Ye,value:Ge,error:ce}=(0,u.A)(async()=>{const Se=je.getSaveModelCloneOld();return g.IB.validateDashboard(Se).catch(xe=>{if(xe.status>=500)throw xe;return xe.data})},[je]);let Pe;if(Ye)Pe=(0,t.jsx)(x.F,{severity:"info",title:(0,l.t)("dashboard.dashboard-validation.title-checking-dashboard-validity","Checking dashboard validity")});else if(Ge)Ge.isValid||(Pe=(0,t.jsxs)(x.F,{severity:"warning",title:(0,l.t)("dashboard.dashboard-validation.title-dashboard-failed-schema-validation","Dashboard failed schema validation"),children:[(0,t.jsx)("p",{children:"Validation is provided for development purposes and should be safe to ignore. If you are a Grafana developer, consider checking and updating the dashboard schema"}),(0,t.jsx)("div",{className:ze.error,children:Ge.message})]}));else{const Se=ce?.message??"Unknown error";Pe=(0,t.jsx)(x.F,{severity:"info",title:(0,l.t)("dashboard.dashboard-validation.title-error-checking-dashboard-validity","Error checking dashboard validity"),children:(0,t.jsx)("p",{className:ze.error,children:Se})})}return Pe?(0,t.jsx)("div",{className:ze.root,children:Pe}):null}const c=je=>({root:(0,h.css)({marginTop:je.spacing(1)}),error:(0,h.css)({fontFamily:je.typography.fontFamilyMonospace,whiteSpace:"pre-wrap",overflowX:"auto",maxWidth:"100%"})}),y=p;var P=e(30906),d=e(71599),D=e(22787),b=e(45861),E=e(78159),v=e(2543),C=e(41053),S=e(92138),O=e(27489),I=e(36490),R=e(45229),T=e(64762),L=e(38206),K=e(15203),A=e(96673),W=e(87745),N=e(77731);const w=async(je,ze,Ye,Ge)=>{const ce=await Ge({dashboard:je,folderUid:ze.folderUid??Ye.meta.folderUid??je.meta?.folderUid,message:ze.message,overwrite:ze.overwrite,k8s:Ye.meta.k8s});if("error"in ce)throw ce.error;return ce.data},j=(je=!1)=>{const ze=(0,A.useDispatch)(),Ye=(0,T._2)(),[Ge]=(0,K.e8)(),[ce,Pe]=(0,C.A)(async(Se,Ee,xe)=>{try{const ye=await w(Se,Ee,xe,Ge);xe.version=ye.version,Se=(0,v.cloneDeep)(Se),Se.version=ye.version,xe.clearUnsavedChanges(Se,Ee),R.A.publish(new W.Eu),Ye.success("Dashboard saved"),(0,N.ko)(ye.uid),je?(0,O.rR)("grafana_dashboard_copied",{name:xe.title,url:ye.url}):(0,O.rR)(`grafana_dashboard_${xe.id?"saved":"created"}`,{name:xe.title,url:ye.url});
269const Oe=I.Ny.getLocation().pathname,we=S.I.stripBaseFromUrl(ye.url);return we!==Oe&&ye.url&&setTimeout(()=>I.Ny.replace(we)),xe.meta.isStarred&&ze((0,L.TU)({id:xe.uid,title:xe.title,url:we})),ye}catch(ye){throw ye instanceof Error&&Ye.error(ye.message??"Error saving dashboard"),ye}},[ze,Ye]);return{state:ce,onDashboardSave:Pe}},V=({dashboard:je,dashboardSaveModel:ze,error:Ye,onDismiss:Ge,setErrorIsHandled:ce})=>{const{onDashboardSave:Pe}=j();return(0,t.jsxs)(t.Fragment,{children:[Ye.data&&Ye.data.status==="version-mismatch"&&(0,t.jsx)(d.u,{isOpen:!0,title:(0,l.t)("dashboard.save-dashboard-error-proxy.title-conflict","Conflict"),body:(0,t.jsxs)("div",{children:["Someone else has updated this dashboard ",(0,t.jsx)("br",{})," ",(0,t.jsx)("small",{children:"Would you still like to save this dashboard?"})]}),confirmText:"Save and overwrite",onConfirm:async()=>{await Pe(ze,{overwrite:!0},je),Ge()},onDismiss:Ge}),Ye.data&&Ye.data.status==="name-exists"&&(0,t.jsx)(t.Fragment,{children:!1?(0,t.jsxs)(D.a,{isOpen:!0,title:(0,l.t)("save-dashboards.name-exists.title","Dashboard name already exists"),onDismiss:Ge,children:[(0,t.jsx)("p",{children:(0,t.jsx)(l.x6,{i18nKey:"save-dashboards.name-exists.message-info",children:"A dashboard with the same name in the selected folder already exists, including recently deleted dashboards."})}),(0,t.jsx)("p",{children:(0,t.jsx)(l.x6,{i18nKey:"save-dashboards.name-exists.message-suggestion",children:"Please choose a different name or folder."})})]}):(0,t.jsx)(d.u,{isOpen:!0,title:(0,l.t)("dashboard.save-dashboard-error-proxy.title-conflict","Conflict"),body:(0,t.jsxs)("div",{children:["A dashboard with the same name in selected folder already exists. ",(0,t.jsx)("br",{}),(0,t.jsx)("small",{children:"Would you still like to save this dashboard?"})]}),confirmText:"Save and overwrite",onConfirm:async()=>{await Pe(ze,{overwrite:!0},je),Ge()},onDismiss:Ge})}),Ye.data&&Ye.data.status==="plugin-dashboard"&&(0,t.jsx)(U,{dashboard:je,onDismiss:()=>{ce(!0),Ge()}})]})},U=({onDismiss:je,dashboard:ze})=>{const{onDashboardSave:Ye}=j(),Ge=(0,i.of)(M);return(0,t.jsxs)(D.a,{className:Ge.modal,title:(0,l.t)("dashboard.confirm-plugin-dashboard-save-modal.title-plugin-dashboard","Plugin dashboard"),icon:"copy",isOpen:!0,onDismiss:je,children:[(0,t.jsxs)("div",{className:Ge.modalText,children:["Your changes will be lost when you update the plugin.",(0,t.jsx)("br",{}),(0,t.jsxs)("small",{children:["Use ",(0,t.jsx)("strong",{children:"Save As"})," to create custom version."]})]}),(0,t.jsxs)(D.a.ButtonRow,{children:[(0,t.jsx)(b.$n,{variant:"secondary",onClick:je,fill:"outline",children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.confirm-plugin-dashboard-save-modal.cancel",children:"Cancel"})}),(0,t.jsx)(E.m,{onClick:je,dashboard:ze,onSaveSuccess:je}),(0,t.jsx)(b.$n,{variant:"destructive",onClick:async()=>{await Ye(ze.getSaveModelClone(),{overwrite:!0},ze),je()},children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.confirm-plugin-dashboard-save-modal.overwrite",children:"Overwrite"})})]})]})},F=je=>{switch(je){case"version-mismatch":case"name-exists":case"plugin-dashboard":return!0;default:return!1}},M=je=>({modal:(0,h.css)({width:"500px"}),modalText:(0,h.css)({fontSize:je.typography.h4.fontSize,color:je.colors.text.primary,marginBottom:je.spacing(4),paddingTop:je.spacing(2)}),modalButtonRow:(0,h.css)({marginBottom:"14px","a, button":{marginRight:je.spacing(2)}})});var H=e(50426),_=e(26987),Z=e(37386),ne=e(41654),te=e(72636),Y=e(63527),Q=e(87105),J=e(21285),q=e(67804),X=e(89223),se=e(42357),oe=e(70969);const ae=je=>{const ze=je.getSaveModelClone();return ze.id=null,ze.uid="",ze.title+=" Copy",ze.editable=!0,je.id>0&&ze.panels&&ze.panels.forEach(Ye=>{Ye.type==="graph"&&Ye.alert&&delete Ye.thresholds,delete Ye.alert}),ze},ie=({dashboard:je,isLoading:ze,isNew:Ye,onSubmit:Ge,onCancel:ce,onSuccess:Pe})=>{const Se={title:Ye?je.title:`${je.title} Copy`,description:je.description,$folder:{uid:je.meta.folderUid,title:je.meta.folderTitle},copyTags:!1},Ee=xe=>async ye=>{if(ye&&ye===xe().$folder.title?.trim())return"Dashboard name cannot be the same as folder name";
269try{return await X.P.validateNewDashboardName(xe().$folder.uid??"general",ye),!0}catch(Oe){return Oe instanceof Error?Oe.message:"Dashboard name is invalid"}};return(0,t.jsx)(H.l,{defaultValues:Se,onSubmit:async xe=>{if(!Ge)return;const ye=ae(je);ye.title=xe.title,ye.description=xe.description,!Ye&&!xe.copyTags&&(ye.tags=[]),(await Ge(ye,{folderUid:xe.$folder.uid},je)).status==="success"&&Pe()},children:({register:xe,control:ye,errors:Oe,getValues:we})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_.e,{render:({field:{ref:Be,...Xe}})=>(0,t.jsx)(Z.D,{label:(0,t.jsxs)(ne.B,{justifyContent:"space-between",children:[(0,t.jsx)(te.J,{htmlFor:"title",children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-dashboard-as-form.title",children:"Title"})}),o.$.featureToggles.dashgpt&&Ye&&(0,t.jsx)(oe.Z,{onGenerate:st=>Xe.onChange(st)})]}),invalid:!!Oe.title,error:Oe.title?.message,children:(0,t.jsx)(Y.p,{...Xe,onChange:st=>Xe.onChange(st.target.value),"aria-label":(0,l.t)("dashboard.save-dashboard-as-form.aria-label-save-dashboard-title-field","Save dashboard title field"),autoFocus:!0})}),control:ye,name:"title",rules:{validate:Ee(we)}}),(0,t.jsx)(_.e,{render:({field:{ref:Be,...Xe}})=>(0,t.jsx)(Z.D,{label:(0,t.jsxs)(ne.B,{justifyContent:"space-between",children:[(0,t.jsx)(te.J,{htmlFor:"description",children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-dashboard-as-form.description",children:"Description"})}),o.$.featureToggles.dashgpt&&Ye&&(0,t.jsx)(se.V,{onGenerate:st=>Xe.onChange(st)})]}),invalid:!!Oe.description,error:Oe.description?.message,children:(0,t.jsx)(Q.f,{...Xe,onChange:st=>Xe.onChange(st.target.value),"aria-label":(0,l.t)("dashboard.save-dashboard-as-form.aria-label-save-dashboard-description-field","Save dashboard description field"),autoFocus:!0})}),control:ye,name:"description"}),(0,t.jsx)(Z.D,{label:(0,l.t)("dashboard.save-dashboard-as-form.label-folder","Folder"),children:(0,t.jsx)(_.e,{render:({field:{ref:Be,...Xe}})=>
269(0,t.jsx)(q.d,{...Xe,onChange:(st,lt)=>Xe.onChange({uid:st,title:lt}),value:Xe.value?.uid,initialTitle:je.meta.folderTitle,dashboardId:je.id,enableCreateNew:!0}),control:ye,name:"$folder"})}),!Ye&&(0,t.jsx)(Z.D,{label:(0,l.t)("dashboard.save-dashboard-as-form.label-copy-tags","Copy tags"),children:(0,t.jsx)(J.d,{...xe("copyTags")})}),(0,t.jsxs)(ne.B,{children:[(0,t.jsx)(b.$n,{type:"button",variant:"secondary",onClick:ce,fill:"outline",children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-dashboard-as-form.cancel",children:"Cancel"})}),(0,t.jsx)(b.$n,{disabled:ze,type:"submit","aria-label":(0,l.t)("dashboard.save-dashboard-as-form.aria-label-save-dashboard-button","Save dashboard button"),children:ze?"Saving...":"Save"})]})]})})};var fe=e(85629),pe=e(32635),de=e(52768),le=e(16200),me=e(37680),De=e(66769);const Te=["You are an expert in Grafana Dashboards","Your goal is to write a description of the changes for a dashboard to display to the user","You will be given human-readable diffs with most irrelevant lines filtered out"].join(`. 270`),Ne=["Respond only with the diff description, which is meant to be loaded directly into the application for the user.",'If there are no substantial user or migration changes, the correct description is "Minor changes only"',`If there are too many changes of either kind, and those changes have a message saying 'too long', the correct response for that section is "Too many changes to auto-summarize"`,"In a diff, lines beginning with - are removed, and lines beginning with + are added.","Lines with neither + nor - are included for c
270ontext. Be careful not to mark them as added or removed if they do not start with + or -.","If a line is changed, it will show a previous version removed and a new version added","When referring to panel changes, use the panel title","When using panel title, wrap it with double quotes","When the panel changes position, just mention that the panel has changed position","When an entire panel is added or removed, use the panel title and only say it was added or removed and disregard the rest of the changes for that panel","Group together similar changes into one line when multiple panels are affected","Refer to templating elements as variables","Try to make the response as short as possible"].join(`. 271`),Ce=({dashboard:je,onGenerate:ze,disabled:Ye})=>{const Ge=(0,n.useCallback)(()=>He(je),[je]);return(0,t.jsx)(le.n,{messages:Ge,onGenerate:ze,temperature:0,model:de.Kx.BASE,eventTrackingSrc:me.ec.dashboardChanges,toggleTipTitle:"Improve your dashboard changes summary",disabled:Ye})};function He(je){let{userChanges:ze,migrationChanges:Ye}=(0,De.Yy)(je);return ze.length>8e3&&(ze="User changes were too long, fill in the user changes section with 'User changes too long to auto-summarize'"),Ye.split(` 272`).length<10?Ye="No significant migration changes":Ye.length>8e3&&(Ye="Migration changes were too long, fill in the migration changes section with 'Migration changes too long to auto-summarize'"),[{content:Te,role:De.Xh.system},{content:`Summarize the following user changes diff under "User changes": 273${ze}`,role:De.Xh.system},{content:`Be sure to only include substantial user changes, such as adding or removing entire panels, changing panel titles or descriptions, etc. 274Do not include "User Changes" section if there are no substantial user changes to report.`,role:De.Xh.system},{content:`Summarize the following migration changes diff under "Migration changes": 275${Ye}`,role:De.Xh.system},{content:`Be sure to only include substantial migration changes, such as adding or removing entire panels, changing panel titles or descriptions, etc. 276Ignore any threshold step changes or templating list changes. 277Ignore other changes and do not include them in the summary. Do not include "Migration Changes" section if there are no substantial migration changes to report. 278If there are substantial migration changes, add "Some autogenerated changes are included to update the dashboard to the latest valid schema version" at the end.`,role:De.Xh.system},{content:Ne,role:De.Xh.system}]}const ke=({dashboard:je,isLoading:ze,saveModel:Ye,options:Ge,onSubmit:ce,onCancel:Pe,onSuccess:Se,onOptionsChange:Ee})=>{const xe=(0,n.useMemo)(()=>je.hasTimeChanged(),[je]),ye=(0,n.useMemo)(()=>je.hasVariablesChanged(),[je]),[Oe,we]=(0,n.useState)(!1),[Be,Xe]=(0,n.useState)(Ge.message),st=(0,i.of)(Me);return(0,t.jsx)("form",{onSubmit:async lt=>{if(lt.preventDefault(),!ce)return;we(!0),Ge={...Ge,message:Be},(await ce(Ye.clone,Ge,je)).status==="success"?Se():we(!1)},style:{maxWidth:600},children:(0,t.jsxs)(ne.B,{gap:2,direction:"column",alignItems:"flex-start",children:[xe&&(0,t.jsx)(pe.S,{checked:!!Ge.saveTimerange,onChange:()=>Ee({...Ge,saveTimerange:!Ge.saveTimerange}),label:(0,l.t)("dashboard.save-dashboard-form.label-current-range-dashboard-default","Save current time range as dashboard default"),"aria-label":fe.Tp.pages.SaveDashboardModal.saveTimerange}),ye&&(0,t.jsx)(pe.S,{checked:!!Ge.saveVariables,onChange:()=>Ee({...Ge,saveVariables:!Ge.saveVariables}),label:(0,l.t)("dashboard.save-dashboard-form.label-current-variable-values-dashboard-default","Save current variable values as dashboard default"),"aria-label":fe.Tp.pages.SaveDashboardModal.saveVariables}),(0,t.jsxs)("div",{className:st.message,children:[o.$.featureToggles.aiGeneratedDashboardChanges&&(0,t.jsx)(Ce,{dashboard:je,onGenerate:lt=>{Ee({...Ge,message:lt}),Xe(lt)},disabled:!Ye.hasChanges}),(0,t.jsx)(Q.f,{value:Be,onChange:lt=>{Ee({...Ge,message:lt.currentTarget.value}),Xe(lt.currentTarget.value)},placeholder:(0,l.t)("dashboard.save-dashboard-form.placeholder-describe-changes","Add a note to describe your changes."),autoFocus:!0,rows:5})]}),(0,t.jsxs)(ne.B,{alignItems:"center",children:[(0,t.jsx)(b.$n,{variant:"secondary",onClick:Pe,fill:"outline",children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-dashboard-form.cancel",children:"Cancel"})}),(0,t.jsx)(b.$n,{type:"submit",disabled:!Ye.hasChanges||ze,icon:Oe?"spinner":void 0,"aria-label":fe.Tp.pages.SaveDashboardModal.save,children:ze?"Saving...":"Save"}),!Ye.hasChanges&&(0,t.jsx)("div",{children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-dashboard-form.no-changes-to-save",children:"No changes to save"})})]})]})})};function Me(je){return{message:(0,h.css)({display:"flex",alignItems:"end",flexDirection:"column",width:"100%"})}}var $e=e(4213),tt=e(32881),Ke=e(47931);const Re=({dashboard:je,onCancel:ze})=>
278{const[Ye,Ge]=(0,n.useState)(()=>{const Pe=je.getSaveModelClone();return delete Pe.id,JSON.stringify(Pe,null,2)}),ce=(0,n.useCallback)(()=>{const Pe=new Blob([Ye],{type:"application/json;charset=utf-8"});(0,$e.saveAs)(Pe,je.title+"-"+new Date().getTime()+".json")},[je.title,Ye]);return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(ne.B,{direction:"column",gap:2,children:[(0,t.jsxs)("div",{children:["This dashboard cannot be saved from the Grafana UI because it has been provisioned from another source. Copy the JSON or save it to a file below, then you can update your dashboard in the provisioning source.",(0,t.jsx)("br",{}),(0,t.jsxs)("i",{children:["See"," ",(0,t.jsx)("a",{className:"external-link",href:"https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information about provisioning."]}),(0,t.jsx)("br",{})," ",(0,t.jsx)("br",{}),(0,t.jsx)("strong",{children:"File path: "})," ",je.meta.provisionedExternalId]}),(0,t.jsx)(Q.f,{spellCheck:!1,value:Ye,onChange:Pe=>{Ge(Pe.currentTarget.value)},className:Ve.json}),(0,t.jsxs)(tt.Gy,{children:[(0,t.jsx)(b.$n,{variant:"secondary",onClick:ze,fill:"outline",children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-provisioned-dashboard-form.cancel",children:"Cancel"})}),(0,t.jsx)(Ke.b,{icon:"copy",getText:()=>Ye,children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-provisioned-dashboard-form.copy-json-to-clipboard",children:"Copy JSON to clipboard"})}),(0,t.jsx)(b.$n,{type:"submit",onClick:ce,children:(0,t.jsx)(l.x6,{i18nKey:"dashboard.save-provisioned-dashboard-form.save-json-to-file",children:"Save JSON to file"})})]})]})})},Ve={json:(0,h.css)({height:"400px",width:"100%",overflow:"auto",resize:"none",fontFamily:"monospace"})},Qe=({dashboard:je,onDismiss:ze,onSaveSuccess:Ye,isCopy:Ge})=>{const[ce,Pe]=(0,n.useState)({}),Se=je.getOriginalDashboard(),Ee=je.meta.provisioned,xe=je.version===0,ye=!!je.meta.hasUnsavedFolderChange,[Oe,we]=(0,n.useState)(!1),Be=(0,n.useMemo)(()=>{const _e=je.getSaveModelClone({saveTimerange:!!ce.saveTimerange,saveVariables:!!ce.saveVariables});if(!Se)return{clone:_e,diff:{},diffCount:0,hasChanges:!1};const xt=(0,f.G4)(Se,_e);let At=0;for(const bt of Object.values(xt))At+=bt.length;return{clone:_e,diff:xt,diffCount:At,hasChanges:(At>0||ye)&&!xe}},[je,Se,ce,xe,ye]),[Xe,st]=(0,n.useState)(!1),{state:lt,onDashboardSave:Et}=j(Ge),Tt=Ye?()=>{ze(),Ye()}:ze,Mt=()=>Xe?(0,t.jsx)(P.l,{diff:Be.diff,oldValue:Se,newValue:Be.clone}):xe||Ge?(0,t.jsx)(ie,{dashboard:je,isLoading:lt.loading,onCancel:ze,onSuccess:Tt,onSubmit:Et,isNew:xe}):Ee?(0,t.jsx)(Re,{dashboard:je,onCancel:ze,onSuccess:Tt}):(0,t.jsx)(ke,{dashboard:je,isLoading:lt.loading,saveModel:Be,onCancel:ze,onSuccess:Tt,onSubmit:Et,options:ce,onOptionsChange:Pe});if(lt.error&&!Oe&&(0,r.NF)(lt.error)&&F(lt.error.data.status))return(0,t.jsx)(V,{error:lt.error,dashboard:je,dashboardSaveModel:Be.clone,onDismiss:ze,setErrorIsHandled:we});let wt="Save dashboard";return Ge?wt="Save dashboard copy":Ee&&(wt="Provisioned dashboard"),(0,t.jsxs)(s._,{title:wt,onClose:ze,subtitle:je.title,tabs:(0,t.jsxs)(m.U,{children:[(0,t.jsx)(a.o,{label:(0,l.t)("dashboard.save-dashboard-drawer.label-details","Details"),active:!Xe,onChangeTab:()=>st(!1)}),Be.hasChanges&&(0,t.jsx)(a.o,{label:(0,l.t)("dashboard.save-dashboard-drawer.label-changes","Changes"),active:Xe,onChangeTab:()=>st(!0),counter:Be.diffCount})]}),children:[Mt(),o.$.featureToggles.showDashboardValidationWarnings&&(0,t.jsx)(y,{dashboard:je})]})}},24209:(ee,B,e)=>{"use strict";e.d(B,{D:()=>c});var t=e(74848),n=e(96540),r=e(43173),o=e(47931),s=e(37386),m=e(41654),a=e(21285),l=e(72636),f=e(87105),h=e(45861),u=e(22787),i=e(56840),x=e(23289),g=e(29216),p=e(58662);function c({panel:y,dashboard:P,range:d,onCancelClick:D,buildIframe:b=p.CF}
278){const[E,v]=(0,n.useState)(!0),[C,S]=(0,n.useState)("current"),[O,I]=(0,n.useState)("");(0,n.useEffect)(()=>{const A=b(E,P.uid,C,y,d);I(A)},[C,E,P,y,d,b]);const R=A=>{I(A.currentTarget.value)},T=()=>{v(A=>!A)},L=A=>{S(A)},K=(0,t.jsx)(o.b,{icon:"copy",variant:"primary",getText:()=>O,onClipboardCopy:()=>{x.c.embedSnippetCopy({currentTimeRange:E,theme:C,shareResource:(0,p.hD)(y)})},children:(0,t.jsx)(i.x6,{i18nKey:"share-modal.embed.copy",children:"Copy to clipboard"})});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:(0,t.jsx)(i.x6,{i18nKey:"share-modal.embed.info",children:"Generate HTML for embedding an iframe with this panel"})}),(0,t.jsx)(s.D,{children:(0,t.jsxs)(m.B,{gap:1,alignItems:"start",children:[(0,t.jsx)(a.d,{label:(0,i.t)("share-modal.embed.time-range","Lock time range"),id:"share-current-time-range",value:E,onChange:T}),(0,t.jsx)(l.J,{description:(0,i.t)("embed.share.time-range-description","Change the current relative time range to an absolute time range"),children:(0,t.jsx)(i.x6,{i18nKey:"embed.share.time-range-label",children:"Lock time range"})})]})}),(0,t.jsx)(g.w,{selectedTheme:C,onChange:L}),(0,t.jsx)(s.D,{label:(0,i.t)("share-modal.embed.html","Embed HTML"),description:(0,i.t)("share-modal.embed.html-description","The HTML code below can be pasted and included in another web page. Unless anonymous access is enabled, the users viewing that page need to be signed into Grafana for the graph to load."),children:(0,t.jsx)(f.f,{"data-testid":"share-embed-html",id:"share-panel-embed-embed-html-textarea",rows:5,value:O,onChange:R})}),r.$.featureToggles.newDashboardSharingComponent?(0,t.jsxs)(m.B,{gap:1,justifyContent:"start",children:[K,(0,t.jsx)(h.$n,{variant:"secondary",fill:"outline",onClick:D,children:(0,t.jsx)(i.x6,{i18nKey:"snapshot.share.cancel-button",children:"Cancel"})})]}):(0,t.jsx)(u.a.ButtonRow,{children:K})]})}},65241:(ee,B,e)=>{"use strict";e.d(B,{j:()=>a});var t=e(74848),n=e(96540),r=e(27489),o=e(56840),s=e(43652),m=e(58662);const a=({panel:l,initialFolderUid:f,onCreateLibraryPanel:h,onDismiss:u})=>((0,n.useEffect)(()=>{(0,r.rR)("grafana_dashboards_library_panel_share_viewed",{shareResource:(0,m.hD)(l)})},[l]),l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:(0,t.jsx)(o.x6,{i18nKey:"share-modal.library.info",children:"Create library panel."})}),(0,t.jsx)(s.b,{panel:l,initialFolderUid:f,onCreateLibraryPanel:h,onDismiss:u})]}):null)},23753:(ee,B,e)=>{"use strict";e.d(B,{Zy:()=>De});var t=e(74848),n=e(96540),r=e(52792),o=e(22787),s=e(13941),m=e(63142),a=e(65642),l=e(73427),f=e(56840),h=e(82298),u=e(24313),i=e(23289),x=e(75515),g=e(96673),p=e(24209),c=e(4213),y=e(37386),P=e(21285),d=e(45861),D=e(2543),b=e(7389),E=e(78282),v=e(30124),C=e(99305),S=e(97583),O=e(67933);function I(Te){return!!(Te.libraryPanel?.name&&Te.libraryPanel?.uid)}class R{async makeExportable(Ne){Ne.cleanUpRepeats();const Ce=Ne.getSaveModelCloneOld();Ce.id=null,Ne.processRepeats();const He=[],ke={},Me={},$e={},tt=new Map;for(const Qe of Ce.getVariables())$e[Qe.name]=Qe;const Ke=(Qe,je)=>{if(Qe.datasource===void 0){Qe.datasource=je;return}let ze=Qe.datasource,Ye=null;const Ge=ze?.uid,ce=Ge&&C.SY.exec(Ge);if(ce){const Pe=ce[1]||ce[2]||ce[4];Ye=$e[Pe],Ye&&Ye.current&&(ze=Ye.current.value)}return(0,E.l)().get(ze).then(Pe=>{if(Pe.meta?.builtIn||(ke["datasource"+Pe.meta?.id]={type:"datasource",id:Pe.meta.id,name:Pe.meta.name,version:Pe.meta.info.version||"1.0.0"},Ye))return;const Se=Qe.libraryPanel,Ee=Se?"-for-library-panel":"";let xe="DS_"+Pe.name.replace(" ","_").toUpperCase()+Ee.toUpperCase();if(Me[xe]={name:xe,label:Pe.name,description:"",type:"datasource",pluginId:Pe.meta?.id,pluginName:Pe.meta?.name,usage:Me[xe]?.usage},Se){const ye=Me[xe]?.usage?.libraryPanels||[];ye.push({name:Se.name,uid:Se.uid}),Me[xe].usage={libraryPanels:ye}}Qe.datasource={type:Pe.meta.id,uid:"${"+xe+"}"}})},Re=async Qe=>{if(Qe.type!=="row"){if(await Ke(Qe),Qe.targets)for(const ze of Qe.targets)await Ke(ze,Qe.datasource);const je=a.Ay.panels[Qe.type];je&&(ke["panel"+je.id]={type:"panel",id:je.id,name:je.name,version:je.info.version})}},Ve=async Qe=>{if((0,x.X)(Qe)){const{name:je,uid:ze}=Qe.libraryPanel;let Ye=Qe.libraryPanel.model;Ye||(Ye=(await(0,v.Yr)(ze,!0)).model),await Ke(Ye);const{gridPos:Ge,id:ce,...Pe}=Ye;tt.has(ze)||tt.set(ze,{name:je,uid:ze,kind:S.i.Panel,model:Pe})}};try{for(const ze of Ce.panels)if(await Re(ze),ze.collapsed!==void 0&&ze.collapsed===!0&&ze.panels)for(const Ye of ze.panels)await Re(Ye);for(const ze of Ce.getVariables())ze.type==="query"?(await Ke(ze),ze.options=[],ze.current={},ze.refresh=ze.refresh!==b.CO.never?ze.refresh:b.CO.onDashboardLoad):ze.type==="datasource"&&(ze.current={});for(const ze of Ce.annotations.list)await Ke(ze);ke.grafana={type:"grafana",id:"grafana",name:"Grafana",version:a.Ay.buildInfo.version};for(const ze of Ce.panels)if(await Ve(ze),ze.collapsed!==void 0&&ze.collapsed===!0&&ze.panels)for(const Ye of ze.panels)await Ve(Ye);(0,D.each)(Me,ze=>{He.push(ze)});for(const ze of Ce.getVariables())if((0,O.VO)(ze)){const Ye="VAR_"+ze.name.replace(" ","_").toUpperCase();He.push({name:Ye,type:"constant",label:ze.label||ze.name,value:ze.query,description:""}),ze.query="${"+Ye+"}",ze.current={value:ze.query,text:ze.query,selected:!1},ze.options=[ze.current]}const Qe=[...tt.entries()].reduce((ze,[Ye,Ge])=>(ze[Ye]=Ge,ze),{}),je=(0,D.defaults)({__inputs:He,__elements:Qe,__requires:(0,D.sortBy)(ke,["id"])},Ce);for(let ze=0;ze<je.panels.length;ze++){const Ye=je.panels[ze];I(Ye)&&(je.panels[ze]={gridPos:Ye.gridPos,id:Ye.id,libraryPanel:{uid:Ye.libraryPanel.uid,name:Ye.libraryPanel.name}})}return je}catch(Qe){return console.error("Export failed:",Qe),{error:Qe}}}}var T=e(3392),L=e(87745),K=e(70713),A=e(50992),W=e(47931);function N({json:Te,onDismiss:Ne}){const Ce=(0,n.useCallback)(()=>Te,[Te]);return(0,t.jsxs)(o.a,{title:(0,f.t)("dashboard.view-json-modal.title-json","JSON"),onDismiss:Ne,onClickBackdrop:Ne,isOpen:!0,children:[(0,t.jsx)(K.default,{disableHeight:!0,children:({width:He})=>(0,t.jsx)(A.B,{value:Te,language:"json",showMiniMap:!1,height:"500px",width:He})}),(0,t.jsx)(o.a.ButtonRow,{children:(0,t.jsx)(W.b,{icon:"copy",getText:Ce,onClipboardCopy:()=>{i.c.exportCopyJsonClicked()},children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.view-json.copy-button",children:"Copy to Clipboard"})})})]})}var w=e(58662);class j extends n.PureComponent{constructor(Ne){super(Ne),this.onShareExternallyChange=()=>{this.setState({shareExternally:!this.state.shareExternally})},this.onSaveAsFile=()=>{const{dashboard:Ce}=this.props,{shareExternally:He}=this.state;i.c.exportSaveJsonClicked({externally:He,shareResource:(0,w.hD)(this.props.panel)}),He?(0,T.E)(Ce).then(ke=>{this.openSaveAsDialog(ke)}):this.openSaveAsDialog(Ce.getSaveModelClone())},this.onViewJson=()=>{const{dashboard:Ce}=this.props,{shareExternally:He}=this.state;
278i.c.exportViewJsonClicked({externally:He,shareResource:(0,w.hD)(this.props.panel)}),He?this.exporter.makeExportable(Ce).then(ke=>{this.openJsonModal(ke)}):this.openJsonModal(Ce.getSaveModelClone())},this.openSaveAsDialog=Ce=>{const He=JSON.stringify(Ce,null,2),ke=new Blob([He],{type:"application/json;charset=utf-8"}),Me=new Date().getTime();(0,c.saveAs)(ke,`${Ce.title}-${Me}.json`)},this.openJsonModal=Ce=>{l.lE.publish(new L.S8({props:{json:JSON.stringify(Ce,null,2)},component:N})),this.props.onDismiss?.()},this.state={shareExternally:!1},this.exporter=new R}render(){const{onDismiss:Ne}=this.props,{shareExternally:Ce}=this.state,He=(0,f.t)("share-modal.export.share-externally-label","Export for sharing externally");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.export.info-text",children:"Export this dashboard."})}),(0,t.jsx)(y.D,{label:He,children:(0,t.jsx)(P.d,{id:"share-externally-toggle",value:Ce,onChange:this.onShareExternallyChange})}),(0,t.jsxs)(o.a.ButtonRow,{children:[(0,t.jsx)(d.$n,{variant:"secondary",onClick:Ne,fill:"outline",children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.export.cancel-button",children:"Cancel"})}),(0,t.jsx)(d.$n,{variant:"secondary",onClick:this.onViewJson,children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.export.view-button",children:"View JSON"})}),(0,t.jsx)(d.$n,{variant:"primary",onClick:this.onSaveAsFile,children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.export.save-button",children:"Save to file"})})]})]})}}var V=e(65241),U=e(85629),F=e(16780),M=e(63527),H=e(89640),_=e(34999),Z=e(29216);class ne extends n.PureComponent{constructor(Ne){super(Ne),this.buildUrl=async()=>{const{panel:Ce,dashboard:He}=this.props,{useCurrentTimeRange:ke,useShortUrl:Me,selectedTheme:$e}=this.state,tt=await(0,w.Xe)(ke,$e,Ce,Me),Ke=(0,w.Lb)(ke,He.uid,$e,Ce);this.setState({shareUrl:tt,imageUrl:Ke})},this.onUseCurrentTimeRangeChange=()=>{this.setState({useCurrentTimeRange:!this.state.useCurrentTimeRange})},this.onUrlShorten=()=>{this.setState({useShortUrl:!this.state.useShortUrl})},this.onThemeChange=Ce=>{this.setState({selectedTheme:Ce})}
278,this.getShareUrl=()=>this.state.shareUrl,this.onCopy=()=>{i.c.shareLinkCopied({currentTimeRange:this.state.useCurrentTimeRange,theme:this.state.selectedTheme,shortenURL:this.state.useShortUrl,shareResource:(0,w.hD)(this.props.panel)})},this.state={useCurrentTimeRange:!0,useShortUrl:!1,selectedTheme:"current",shareUrl:"",imageUrl:""}}componentDidMount(){this.buildUrl()}componentDidUpdate(Ne,Ce){const{useCurrentTimeRange:He,useShortUrl:ke,selectedTheme:Me}=this.state;(Ce.useCurrentTimeRange!==He||Ce.selectedTheme!==Me||Ce.useShortUrl!==ke)&&this.buildUrl()}render(){const{panel:Ne,dashboard:Ce}=this.props,He=Ce?Ce.time.to==="now":!1,{useCurrentTimeRange:ke,useShortUrl:Me,selectedTheme:$e,shareUrl:tt,imageUrl:Ke}=this.state,Re=U.Tp.pages.SharePanelModal,Ve=!!Ce.id,Qe=(0,f.t)("share-modal.link.time-range-label","Lock time range"),je=(0,f.t)("share-modal.link.time-range-description","Transforms the current relative time range to an absolute time range"),ze=(0,f.t)("share-modal.link.shorten-url","Shorten URL"),Ye=(0,f.t)("share-modal.link.link-url","Link URL");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.link.info-text",children:"Create a direct link to this dashboard or panel, customized with the options below."})}),(0,t.jsxs)(F.n,{children:[(0,t.jsx)(y.D,{label:Qe,description:He?je:"",children:(0,t.jsx)(P.d,{id:"share-current-time-range",value:ke,onChange:this.onUseCurrentTimeRangeChange})}),(0,t.jsx)(Z.w,{selectedTheme:$e,onChange:this.onThemeChange}),(0,t.jsx)(y.D,{label:ze,children:(0,t.jsx)(P.d,{id:"share-shorten-url",value:Me,onChange:this.onUrlShorten})}),(0,t.jsx)(y.D,{label:Ye,children:(0,t.jsx)(M.p,{id:"link-url-input",value:tt,readOnly:!0,addonAfter:(0,t.jsx)(W.b,{icon:"copy",variant:"primary",getText:this.getShareUrl,onClipboardCopy:this.onCopy,children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.link.copy-link-button",children:"Copy"})})})})]}),Ne&&a.Ay.rendererAvailable&&(0,t.jsxs)(t.Fragment,{children:[Ve&&(0,t.jsx)(H.Y,{href:Ke,external:!0,icon:"camera","aria-label":Re.linkToRenderedImage,children:(0,f.t)("share-modal.link.rendered-image","Direct link rendered image")}),!Ve&&(0,t.jsx)(_.F,{severity:"info",title:(0,f.t)("share-modal.link.save-alert","Dashboard is not saved"),bottomSpacing:0,children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.link.save-dashboard",children:"To render a panel image, you must save the dashboard first."})})]}),Ne&&!a.Ay.rendererAvailable&&(0,t.jsx)(_.F,{severity:"info",title:(0,f.t)("share-modal.link.render-alert","Image renderer plugin not installed"),bottomSpacing:0,children:(0,t.jsxs)(f.x6,{i18nKey:"share-modal.link.render-instructions",children:["To render a panel image, you must install the"," ",(0,t.jsx)(H.Y,{href:"https://grafana.com/grafana/plugins/grafana-image-renderer",external:!0,children:"Grafana image renderer plugin"}),". Please contact your Grafana administrator to install the plugin."]})})]})}}var te=e(3594),Y=e(68143),Q=e(18857),J=e(41654),q=e(68079),X=e(75421),se=e(8735);class oe extends n.PureComponent{constructor(Ne){super(Ne),this.createSnapshot=Ce=>()=>{const{timeoutSeconds:He}=this.state;this.dashboard.snapshot={timestamp:new Date},this.setState({isLoading:!0}),this.dashboard.startRefresh(),setTimeout(()=>{this.saveSnapshot(this.dashboard,Ce)},He*1e3)},this.saveSnapshot=async(Ce,He)=>{const{snapshotExpires:ke,timeoutSeconds:Me}=this.state,$e=this.dashboard.getSaveModelCloneOld();this.scrubDashboard($e);const tt={dashboard:$e,name:$e.title,expires:ke,external:He};try{const Ke=await(0,se.s)().create(tt);this.setState({deleteUrl:Ke.deleteUrl,snapshotUrl:Ke.url,step:2})}finally{He?i.c.publishSnapshotClicked({expires:ke,timeout:Me,shareResource:(0,w.hD)(this.props.panel)}):i.c.publishSnapshotLocalClicked({expires:ke,timeout:Me,shareResource:(0,w.hD)(this.props.panel)}),this.setState({isLoading:!1})}},this.scrubDashboard=Ce=>{const{panel:He}=this.props,{snapshotName:ke}=this.state;Ce.title=ke,Ce.time=(0,X.jG)().timeRange(),Ce.links=[],Ce.panels.forEach($e=>{$e.targets=[],$e.links=[],$e.datasource=null});const Me=Ce.annotations.list.filter($e=>$e.enable);if(Ce.annotations.list=Me.map($e=>({name:$e.name,enable:$e.enable,iconColor:$e.iconColor,snapshotData:$e.snapshotData,type:$e.type,builtIn:$e.builtIn,hide:$e.hide}
278)),Ce.getVariables().forEach($e=>{"query"in $e&&($e.query=""),"options"in $e&&($e.options=$e.current&&!(0,te.R)($e.current)?[$e.current]:[]),"refresh"in $e&&($e.refresh=b.CO.never)}),He){const $e=He.getSaveModel();$e.gridPos.w=24,$e.gridPos.x=0,$e.gridPos.y=0,$e.gridPos.h=20,Ce.panels=[$e]}delete this.dashboard.snapshot,this.dashboard.forEachPanel($e=>{delete $e.snapshotData}),this.dashboard.annotations.list.forEach($e=>{delete $e.snapshotData})},this.deleteSnapshot=async()=>{const{deleteUrl:Ce}=this.state;await(0,Y.AI)().get(Ce),this.setState({step:3})},this.getSnapshotUrl=()=>this.state.snapshotUrl,this.onSnapshotNameChange=Ce=>{this.setState({snapshotName:Ce.target.value})},this.onTimeoutChange=Ce=>{this.setState({timeoutSeconds:Number(Ce.target.value)})},this.onExpireChange=Ce=>{this.setState({selectedExpireOption:Ce,snapshotExpires:Ce.value})},this.dashboard=Ne.dashboard,this.expireOptions=[{label:(0,f.t)("share-modal.snapshot.expire-hour","1 Hour"),value:60*60},{label:(0,f.t)("share-modal.snapshot.expire-day","1 Day"),value:60*60*24},{label:(0,f.t)("share-modal.snapshot.expire-week","1 Week"),value:60*60*24*7},{label:(0,f.t)("share-modal.snapshot.expire-never","Never"),value:0}],this.state={isLoading:!1,step:1,selectedExpireOption:this.expireOptions[2],snapshotExpires:this.expireOptions[2].value,snapshotName:Ne.dashboard.title,timeoutSeconds:4,snapshotUrl:"",deleteUrl:"",externalEnabled:!1,sharingButtonText:""}}componentDidMount(){this.getSnaphotShareOptions()}async getSnaphotShareOptions(){const Ne=await(0,se.s)().getSharingOptions();this.setState({sharingButtonText:Ne.externalSnapshotName,externalEnabled:Ne.externalEnabled})}renderStep1(){const{onDismiss:Ne}=this.props,{snapshotName:Ce,selectedExpireOption:He,timeoutSeconds:ke,isLoading:Me,sharingButtonText:$e,externalEnabled:tt}=this.state,Ke=(0,f.t)("share-modal.snapshot.name","Snapshot name"),Re=(0,f.t)("share-modal.snapshot.expire","Expire"),Ve=(0,f.t)("share-modal.snapshot.timeout","Timeout (seconds)"),Qe=(0,f.t)("share-modal.snapshot.timeout-description","You might need to configure the timeout value if it takes a long time to collect your dashboard metrics.");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.snapshot.info-text-1",children:"A snapshot is an instant way to share an interactive dashboard publicly. When created, we strip sensitive data like queries (metric, template, and annotation) and panel links, leaving only the visible metric data and series names embedded in your dashboard."})}),(0,t.jsx)("p",{children:(0,t.jsxs)(f.x6,{i18nKey:"share-modal.snapshot.info-text-2",children:["Keep in mind, your snapshot ",(0,t.jsx)("em",{children:"can be viewed by anyone"})," that has the link and can access the URL. Share wisely."]})})]}),(0,t.jsx)(y.D,{label:Ke,children:(0,t.jsx)(M.p,{id:"snapshot-name-input",width:30,value:Ce,onChange:this.onSnapshotNameChange})}),(0,t.jsx)(y.D,{label:Re,children:(0,t.jsx)(Q.l6,{inputId:"expire-select-input",width:30,options:this.expireOptions,value:He,onChange:this.onExpireChange})}),(0,t.jsx)(y.D,{label:Ve,description:Qe,children:(0,t.jsx)(M.p,{id:"timeout-input",type:"number",width:21,value:ke,onChange:this.onTimeoutChange})}),(0,t.jsxs)(o.a.ButtonRow,{children:[(0,t.jsx)(d.$n,{variant:"secondary",onClick:Ne,fill:"outline",children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.snapshot.cancel-button",children:"Cancel"})}),tt&&(0,t.jsx)(d.$n,{variant:"secondary",disabled:Me,onClick:this.createSnapshot(!0),children:$e}),(0,t.jsx)(d.$n,{variant:"primary",disabled:Me,onClick:this.createSnapshot(),children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.snapshot.local-button",children:"Publish Snapshot"})})]})]})}renderStep2(){const{snapshotUrl:Ne}=this.state;return(0,t.jsxs)(J.B,{direction:"column",gap:0,children:[(0,t.jsx)(y.D,{label:(0,f.t)("share-modal.snapshot.url-label","Snapshot URL"),children:(0,t.jsx)(M.p,{id:"snapshot-url-input",value:Ne,readOnly:!0,addonAfter:(0,t.jsx)(W.b,{icon:"copy",variant:"primary",getText:this.getSnapshotUrl,children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.snapshot.copy-link-button",children:"Copy"})})})}),(0,t.jsxs)("div",{style:{alignSelf:"flex-end",padding:"5px"},children:[(0,t.jsx)(f.x6,{i18nKey:"share-modal.snapshot.mistake-message",children:"Did you make a mistake? "}),"\xA0",(0,t.jsx)(d.z9,{fill:"text",target:"_blank",onClick:this.deleteSnapshot,children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.snapshot.delete-button",children:"Delete snapshot."})})]})]})}renderStep3(){return(0,t.jsx)("p",{children:(0,t.jsx)(f.x6,{i18nKey:"share-modal.snapshot.deleted-message",children:"The snapshot has been deleted. If you have already accessed it once, then it might take up to an hour before before it is removed from browser caches or CDN caches."})})}render(){const{isLoading:Ne,step:Ce}=this.state;return(0,t.jsxs)(t.Fragment,{children:[Ce===1&&this.renderStep1(),Ce===2&&this.renderStep2(
278),Ce===3&&this.renderStep3(),Ne&&(0,t.jsx)(q.y,{inline:!0})]})}}const ae=[],ie=[];function fe(Te){ae.push(Te)}function pe(Te){ie.push(Te)}function de(Te,Ne,Ce){const ke=[{label:(0,f.t)("share-modal.tab-title.link","Link"),value:w.wr.link,component:ne}];if(l.TP.isSignedIn&&a.$W.snapshotEnabled&&l.TP.hasPermission(g.AccessControlAction.SnapshotsCreate)){const $e=(0,f.t)("share-modal.tab-title.snapshot","Snapshot");ke.push({label:$e,value:w.wr.snapshot,component:oe})}if(Ne){const $e=(0,f.t)("share-modal.tab-title.embed","Embed");if(ke.push({label:$e,value:w.wr.embed,component:p.D}),!(0,x.X)(Ne)){const tt=(0,f.t)("share-modal.tab-title.library-panel","Library panel");ke.push({label:tt,value:w.wr.libraryPanel,component:V.j})}ke.push(...ie)}else{const $e=(0,f.t)("share-modal.tab-title.export","Export");ke.push({label:$e,value:w.wr.export,component:j}),ke.push(...ae),(0,u.iR)()&&ke.push({label:(0,f.t)("share-modal.tab-title.public-dashboard-title","Public dashboard"),value:w.wr.publicDashboard,component:h.b})}const Me=ke.find($e=>$e.value===Ce);return{tabs:ke,activeTab:Me?.value??ke[0].value}}function le(Te){const{tabs:Ne,activeTab:Ce}=de(Te.dashboard.canEditDashboard(),Te.panel,Te.activeTab);return{tabs:Ne,activeTab:Ce}}class me extends n.Component{constructor(Ne){super(Ne),this.onSelectTab=Ce=>{this.setState(He=>({...He,activeTab:Ce.value})),i.c.sharingCategoryClicked({item:Ce.value,shareResource:(0,w.hD)(this.props.panel)})},this.state=le(Ne)}getActiveTab(){const{tabs:Ne,activeTab:Ce}=this.state;return Ne.find(He=>He.value===Ce)}renderTitle(){const{panel:Ne}=this.props,{activeTab:Ce}=this.state,He=Ne?(0,f.t)("share-modal.panel.title","Share Panel"):(0,f.t)("share-modal.dashboard.title","Share"),ke=this.props.dashboard.canEditDashboard(),Me=de(ke,this.props.panel,this.state.activeTab).tabs;return(0,t.jsx)(r.J,{title:He,icon:"share-alt",tabs:Me,activeTab:Ce,onChangeTab:this.onSelectTab})}render(){const{dashboard:Ne,panel:Ce}=this.props,ke=this.getActiveTab().component;return(0,t.jsx)(o.a,{isOpen:!0,title:this.renderTitle(),onDismiss:this.props.onDismiss,children:(0,t.jsx)(s.J,{children:(0,t.jsx)(ke,{dashboard:Ne,panel:Ce,onDismiss:this.props.onDismiss})})})}}const De=(0,m.cV)(me)},72973:(ee,B,e)=>{"use strict";e.d(B,{K:()=>pe,b:()=>fe});var t=e(74848),n=e(22803),r=e(49785),o=e(85629),s=e(63142),m=e(37386),a=e(63527),l=e(47931),f=e(41654),h=e(21285),u=e(72636),i=e(32881),x=e(45861),g=e(8515),p=e(56840),c=e(62905),y=e(90593),P=e(23289),d=e(61730),D=e(15130),b=e(96673),E=e(52908);const v=()=>{const{width:le}=(0,E.A)();return le>1024};var C=e(23753),S=e(58662),O=e(35195),I=e(34999);const R=()=>(0,t.jsx)(I.F,{title:(0,p.t)("public-dashboard.modal-alerts.save-dashboard-changes-alert-title","Please save your dashboard changes before updating the public configuration"),severity:"warning",bottomSpacing:0});var T=e(37672),L=e(44173),K=e(24313),A=e(16780),W=e(56265);const N=o.Tp.pages.ShareDashboardModal.PublicDashboard,w=({disabled:le,onChange:me,register:De,timeRange:Te})=>(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(A.n,{disabled:le,children:(0,t.jsxs)(i.gW,{spacing:"md",children:[(0,t.jsxs)(f.B,{direction:"column",gap:.5,justifyContent:"space-between",children:[(0,t.jsx)(u.J,{description:(0,p.t)("public-dashboard.settings-configuration.default-time-range-label-desc","The public dashboard uses the default time range settings of the dashboard"),
278children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.settings-configuration.default-time-range-label",children:"Default time range"})}),(0,t.jsx)(W.b,{value:Te,disabled:!0,onChange:()=>{}})]}),(0,t.jsxs)(f.B,{direction:"row",gap:.5,children:[(0,t.jsx)(h.d,{...De("isTimeSelectionEnabled"),"data-testid":N.EnableTimeRangeSwitch,onChange:Ne=>{me("isTimeSelectionEnabled",Ne.currentTarget.checked),P.c.publicDashboardTimeSelectionChanged({enabled:Ne.currentTarget.checked})}}),(0,t.jsx)(u.J,{description:(0,p.t)("public-dashboard.settings-configuration.time-range-picker-label-desc","Allow viewers to change time range"),children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.settings-configuration.time-range-picker-label",children:"Time range picker enabled"})})]}),(0,t.jsxs)(f.B,{direction:"row",gap:.5,children:[(0,t.jsx)(h.d,{...De("isAnnotationsEnabled"),onChange:Ne=>{me("isAnnotationsEnabled",Ne.currentTarget.checked),P.c.publicDashboardAnnotationsSelectionChanged({enabled:Ne.currentTarget.checked})},"data-testid":N.EnableAnnotationsSwitch}),(0,t.jsx)(u.J,{description:(0,p.t)("public-dashboard.settings-configuration.show-annotations-label-desc","Show annotations on public dashboard"),
278children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.settings-configuration.show-annotations-label",children:"Show annotations"})})]})]})})});var j=e(93256),V=e(77824),U=e(68079),F=e(39385);const M=o.Tp.pages.ShareDashboardModal.PublicDashboard.EmailSharingConfiguration,H=({recipients:le,dashboardUid:me,publicDashboardUid:De})=>{const Te=(0,s.of)(Z),[Ne,{isLoading:Ce}]=(0,c.$L)(),[He,{isLoading:ke}]=(0,c.NA)(),Me=Ce||ke,$e=(Ke,Re)=>{P.c.revokePublicDashboardEmailClicked(),Ne({recipientUid:Ke,recipientEmail:Re,dashboardUid:me,uid:De})},tt=Ke=>{P.c.resendPublicDashboardEmailClicked(),He({recipientUid:Ke,uid:De})};return(0,t.jsx)("table",{className:Te.table,"data-testid":M.EmailSharingList,children:(0,t.jsx)("tbody",{children:le.map((Ke,Re)=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:Ke.recipient}),(0,t.jsx)("td",{children:(0,t.jsxs)(j.e,{className:Te.tableButtonsContainer,children:[(0,t.jsx)(x.$n,{type:"button",variant:"destructive",fill:"text",title:(0,p.t)("public-dashboard.email-sharing.revoke-button-title","Revoke"),size:"sm",disabled:Me,onClick:()=>$e(Ke.uid,Ke.recipient),"data-testid":`${M.DeleteEmail}-${Re}`,children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.email-sharing.revoke-button",children:"Revoke"})}),(0,t.jsx)(x.$n,{type:"button",variant:"primary",fill:"text",title:(0,p.t)("public-dashboard.email-sharing.resend-button-title","Resend"),size:"sm",disabled:Me,onClick:()=>tt(Ke.uid),"data-testid":`${M.ReshareLink}-${Re}`,children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.email-sharing.resend-button",children:"Resend"})})]})})]},Ke.uid))})})},_=({dashboard:le})=>{const{width:me}=(0,E.A)(),De=(0,s.of)(Z),Te=le instanceof F.H$?le.state.uid:le.uid,{data:Ne}=(0,c.Bs)(Te),[Ce]=(0,c.ft)(),[He,{isLoading:ke}]=(0,c.NY)(),Me=D.TP.hasPermission(b.AccessControlAction.DashboardsPublicWrite),{register:$e,setValue:tt,control:Ke,watch:Re,handleSubmit:Ve,formState:{errors:Qe},reset:je}=(0,r.mN)({defaultValues:{shareType:Ne?.share||K.Xo.PUBLIC,email:""},mode:"onSubmit"}),ze=Ge=>{const ce={dashboard:le,payload:{...Ne,share:Ge}};Ce(ce)},Ye=async Ge=>{P.c.publicDashboardEmailInviteClicked(),await He({recipient:Ge.email,uid:Ne.uid,dashboardUid:Te}).unwrap(),je({email:"",shareType:K.Xo.EMAIL})};return(0,t.jsx)("form",{onSubmit:Ve(Ye),children:(0,t.jsxs)(A.n,{disabled:!Me,"data-testid":M.Container,className:De.container,children:[(0,t.jsx)(m.D,{label:(0,p.t)("public-dashboard.config.can-view-dashboard-radio-button-label","Can view dashboard"),
278className:De.field,children:(0,t.jsx)(r.xI,{name:"shareType",control:Ke,render:({field:Ge})=>{const{ref:ce,...Pe}=Ge,Se=[{label:(0,p.t)("public-dashboard.config.public-share-type-option-label","Anyone with a link"),value:K.Xo.PUBLIC},{label:(0,p.t)("public-dashboard.config.email-share-type-option-label","Only specified people"),value:K.Xo.EMAIL}];return(0,t.jsx)(V.z,{...Pe,size:me<480?"sm":"md",options:Se,onChange:Ee=>{P.c.publicDashboardShareTypeChange({shareType:Ee===K.Xo.EMAIL?"email":"public"}),tt("shareType",Ee),ze(Ee)}})}})}),Re("shareType")===K.Xo.EMAIL&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.D,{label:(0,p.t)("public-dashboard.email-sharing.invite-field-label","Invite"),description:(0,p.t)("public-dashboard.email-sharing.invite-field-desc","Invite people by email"),error:Qe.email?.message,invalid:!!Qe.email?.message||void 0,className:De.field,children:(0,t.jsxs)("div",{className:De.emailContainer,children:[(0,t.jsx)(a.p,{className:De.emailInput,placeholder:"[email protected]",autoCapitalize:"none",...$e("email",{required:(0,p.t)("public-dashboard.email-sharing.input-required-email-text","Email is required"),pattern:{value:K._l,message:(0,p.t)("public-dashboard.email-sharing.input-invalid-email-text","Invalid email")}}),"data-testid":M.EmailSharingInput}),(0,t.jsxs)(x.$n,{type:"submit",variant:"primary",disabled:ke,"data-testid":M.EmailSharingInviteButton,children:[(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.email-sharing.invite-button",children:"Invite"}),ke&&(0,t.jsx)(U.y,{})]})]})}),!!Ne?.recipients?.length&&(0,t.jsx)(H,{recipients:Ne.recipients,dashboardUid:Te,publicDashboardUid:Ne.uid})]})]})})},Z=le=>({container:(0,n.css)({label:"emailConfigContainer",display:"flex",flexDirection:"column",flexWrap:"wrap",gap:le.spacing(3)}),field:(0,n.css)({label:"field-noMargin",marginBottom:0}),emailContainer:(0,n.css)({label:"emailContainer",display:"flex",gap:le.spacing(1)}),emailInput:(0,n.css)({label:"emailInput",flexGrow:1}),table:(0,n.css)({label:"table",display:"flex",maxHeight:"220px",overflowY:"scroll","& tbody":{display:"flex",flexDirection:"column",flexGrow:1},"& tr":{minHeight:"40px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:le.spacing(.5,1),":nth-child(odd)":{background:le.colors.background.secondary}}}),tableButtonsContainer:(0,n.css)({display:"flex",justifyContent:"end"})});var ne=e(96540),te=e(44019),Y=e(76319);function Q({headerElement:le,isContentVisible:me=!1,onRowToggle:De,title:Te,...Ne}){const Ce=(0,s.of)(J),He=le&&te.renderOrCallToRender(le,{className:Ce.summaryWrapper});return(0,t.jsx)("div",{className:Ce.wrapper,children:(0,t.jsxs)("div",{className:Ce.header,children:[(0,t.jsx)(Y.K,{name:me?"angle-down":"angle-right",tooltip:me?(0,p.t)("public-dashboard.settings-bar-header.collapse-settings-tooltip","Collapse settings"):(0,p.t)("public-dashboard.settings-bar-header.expand-settings-tooltip","Expand settings"),className:Ce.collapseIcon,onClick:De,"aria-expanded":me,...Ne}),Te&&(0,t.jsx)("div",{className:Ce.titleWrapper,onClick:De,children:(0,t.jsx)("span",{className:Ce.title,children:Te})}),He]})})}Q.displayName="SettingsBarHeader";function J(le){return{wrapper:(0,n.css)({label:"header",padding:le.spacing(.5,.5),borderRadius:le.shape.radius.default,background:le.colors.background.secondary,minHeight:le.spacing(4),"&:focus":{outline:"none"}}),header:(0,n.css)({label:"column",display:"flex",alignItems:"center",whiteSpace:"nowrap"}),collapseIcon:(0,n.css)({marginLeft:le.spacing(.5),color:le.colors.text.disabled}),titleWrapper:(0,n.css)({display:"flex",alignItems:"center",cursor:"pointer",overflow:"hidden",marginRight:`${le.spacing(.5)}`,[le.breakpoints.down("sm")]:{flex:"1 1"}}),title:(0,n.css)({fontWeight:le.typography.fontWeightBold,marginLeft:le.spacing(.5),overflow:"hidden",textOverflow:"ellipsis"}),summaryWrapper:(0,n.css)({display:"flex",flexWrap:"wrap",[le.breakpoints.down("sm")]:{flex:"2 2"}})}}function q({children:le,title:me,headerElement:De,...Te}){const Ne=(0,s.of)(X),[Ce,He]=(0,ne.useState)(!1);function ke(){He(Me=>!Me)}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q,{onRowToggle:ke,isContentVisible:Ce,title:me,headerElement:De,...Te}),Ce&&(0,t.jsx)("div",{className:Ne.content,children:le})]})}q.displayName="SettingsBar";const X=le=>({content:(0,n.css)({marginTop:le.spacing(1),marginLeft:le.spacing(4)})});var se=e(83692);function oe({className:le,isDataLoading:me=!1,timeRange:De,timeSelectionEnabled:Te,annotationsEnabled:Ne}){const Ce=(0,s.of)(ae),He=(0,p.t)("public-dashboard.settings-summary.time-range-picker-enabled-text","Time range picker = enabled"),ke=(0,p.t)("public-dashboard.settings-summary.time-range-picker-disabled-text","Time range picker = disabled"),Me=(0,p.t)("public-dashboard.settings-summary.annotations-show-text","Annotations = show"),$e=(0,p.t)("public-dashboard.settings-summary.annotations-hide-text","Annotations = hide");return me?(0,t.jsx)("div",{className:(0,n.cx)(Ce.summaryWrapper,le),children:(0,t.jsx)(U.y,{className:Ce.summary,inline:!0,size:"sm"})}):(0,t.jsxs)("div",{className:(0,n.cx)(Ce.summaryWrapper,le),children:[(0,t.jsxs)("span",{className:Ce.summary,children:[(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.settings-summary.time-range-text",children:"Time range = "}),(0,t.jsx)(se.f,{className:Ce.timeRange,value:De})]}),(0,t.jsx)("span",{className:Ce.summary,children:Te?He:ke}),(0,t.jsx)("span",{className:Ce.summary,children:Ne?Me:$e})]})}
278oe.displayName="SettingsSummary";const ae=le=>({summaryWrapper:(0,n.css)({display:"flex"}),summary:(0,n.css)({label:"collapsedText",marginLeft:`${le.spacing.gridSize*2}px`,fontSize:le.typography.bodySmall.fontSize,color:le.colors.text.secondary}),timeRange:(0,n.css)({display:"inline-block"})}),ie=o.Tp.pages.ShareDashboardModal.PublicDashboard;function fe({onRevoke:le,timeRange:me,hasTemplateVariables:De=!1,showSaveChangesAlert:Te=!1,unsupportedDatasources:Ne=[],publicDashboard:Ce,dashboard:He}){const ke=(0,s.of)(de),Me=v(),[$e,{isLoading:tt}]=(0,c.T2)(),[Ke,{isLoading:Re}]=(0,c.eq)(),Ve=D.TP.hasPermission(b.AccessControlAction.DashboardsPublicWrite),Qe=!Ve||tt||Re,{handleSubmit:je,setValue:ze,register:Ye}=(0,r.mN)({defaultValues:{isAnnotationsEnabled:Ce?.annotationsEnabled,isTimeSelectionEnabled:Ce?.timeSelectionEnabled,isPaused:!Ce?.isEnabled}}),Ge=async xe=>{const{isAnnotationsEnabled:ye,isTimeSelectionEnabled:Oe,isPaused:we}=xe;$e({dashboard:He,payload:{...Ce,annotationsEnabled:ye,timeSelectionEnabled:Oe,isEnabled:!we}})},ce=async xe=>{const{isAnnotationsEnabled:ye,isTimeSelectionEnabled:Oe,isPaused:we}=xe;Ke({dashboard:He,payload:{...Ce,annotationsEnabled:ye,timeSelectionEnabled:Oe,isEnabled:!we}})},Pe=async(xe,ye)=>{ze(xe,ye),await je(Oe=>Ge(Oe))()},Se=async xe=>{ze("isPaused",xe),await je(ye=>ce(ye))()};function Ee(){P.c.publicDashboardUrlCopied()}return(0,t.jsxs)("div",{className:ke.configContainer,children:[Te&&(0,t.jsx)(R,{}),!Ve&&(0,t.jsx)(O.t,{mode:"edit"}),De&&(0,t.jsx)(L.D,{}),Ne.length>0&&(0,t.jsx)(T.s,{unsupportedDataSources:Ne.join(", ")}),(0,K.AY)()&&(0,t.jsx)(_,{dashboard:He}),(0,t.jsx)(m.D,{label:(0,p.t)("public-dashboard.config.dashboard-url-field-label","Dashboard URL"),className:ke.fieldSpace,children:(0,t.jsx)(a.p,{value:(0,K.mL)(Ce.accessToken),readOnly:!0,disabled:!Ce?.isEnabled,"data-testid":ie.CopyUrlInput,addonAfter:(0,t.jsx)(l.b,{"data-testid":ie.CopyUrlButton,variant:"primary",disabled:!Ce?.isEnabled,getText:()=>(0,K.mL)(Ce.accessToken),onClipboardCopy:Ee,children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.config.copy-button",children:"Copy"})})})}),(0,t.jsx)(m.D,{className:ke.fieldSpace,children:(0,t.jsxs)(f.B,{children:[(0,t.jsx)(h.d,{...Ye("isPaused"),disabled:Qe,onChange:xe=>{P.c.publicDashboardPauseSharingClicked({paused:xe.currentTarget.checked}),Se(xe.currentTarget.checked)},"data-testid":ie.PauseSwitch}),(0,t.jsx)(u.J,{className:(0,n.css)({marginBottom:0}),children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.config.pause-sharing-dashboard-label",children:"Pause sharing dashboard"})})]})}),(0,t.jsx)(m.D,{className:ke.fieldSpace,children:(0,t.jsx)(q,{title:(0,p.t)("public-dashboard.config.settings-title","Settings"),headerElement:({className:xe})=>(0,t.jsx)(oe,{className:xe,isDataLoading:tt,timeRange:me,timeSelectionEnabled:Ce?.timeSelectionEnabled,annotationsEnabled:Ce?.annotationsEnabled}),"data-testid":ie.SettingsDropdown,children:(0,t.jsx)(w,{disabled:Qe,onChange:Pe,register:Ye,timeRange:me})})}),(0,t.jsx)(f.B,{direction:Me?"row":"column",justifyContent:Me?"flex-end":"flex-start",alignItems:Me?"center":"stretch",children:(0,t.jsx)(i.Gy,{justify:"flex-end",children:(0,t.jsx)(x.$n,{title:(0,p.t)("public-dashboard.config.revoke-public-URL-button-title","Revoke public URL"),onClick:le,type:"button",disabled:Qe,"data-testid":ie.DeleteButton,variant:"destructive",fill:"outline",children:(0,t.jsx)(p.x6,{i18nKey:"public-dashboard.config.revoke-public-URL-button",children:"Revoke public URL"})})})})]})}function pe({publicDashboard:le,unsupportedDatasources:me}){const Te=(0,b.useSelector)($e=>$e.dashboard).getModel(),Ne=(0,y.z)(Te.getDefaultTime(),Te),Ce=D.TP.hasPermission(b.AccessControlAction.DashboardsPublicWrite),He=(0,K.kD)(Te.getVariables()),[ke]=(0,c.bN)(),Me=$e=>{ke({dashboard:Te,uid:le.uid,dashboardUid:Te.uid}),$e()};return(0,t.jsx)(g.$s,{children:({showModal:$e,hideModal:tt})=>(0,t.jsx)(fe,{publicDashboard:le,dashboard:Te,unsupportedDatasources:me,timeRange:Ne,showSaveChangesAlert:Ce&&Te.hasUnsavedChanges(),hasTemplateVariables:He,onRevoke:()=>{P.c.revokePublicDashboardClicked(),$e(d.m,{onConfirm:()=>Me(tt),onDismiss:()=>{$e(C.Zy,{dashboard:Te,onDismiss:tt,activeTab:S.wr.publicDashboard})}})}})})}const de=le=>
278({configContainer:(0,n.css)({label:"config container",display:"flex",flexDirection:"column",flexWrap:"wrap",gap:le.spacing(3)}),fieldSpace:(0,n.css)({label:"field space",width:"100%",marginBottom:0}),timeRange:(0,n.css)({display:"inline-block"})})},58375:(ee,B,e)=>{"use strict";e.d(B,{M:()=>O,D:()=>S});var t=e(74848),n=e(22803),r=e(49785),o=e(85629),s=e(63142),m=e(45861),a=e(68079),l=e(56840),f=e(15130),h=e(62905),u=e(23289),i=e(96673),x=e(35195),g=e(37672),p=e(44173),c=e(24313),y=e(55066),P=e(16780),d=e(32881),D=e(32635);const b=o.Tp.pages.ShareDashboardModal.PublicDashboard,E=({disabled:R,register:T})=>{const L=(0,s.of)(v),K=[{type:"publicAcknowledgment",description:(0,l.t)("public-dashboard.acknowledgment-checkboxes.public-ack-desc","Your entire dashboard will be public*"),testId:b.WillBePublicCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/dashboards/dashboard-public/",tooltip:(0,l.t)("public-dashboard.acknowledgment-checkboxes.public-ack-tooltip","Learn more about public dashboards")}},{type:"dataSourcesAcknowledgment",description:(0,l.t)("public-dashboard.acknowledgment-checkboxes.data-src-ack-desc","Publishing currently only works with a subset of data sources*"),testId:b.LimitedDSCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/datasources/",tooltip:(0,l.t)("public-dashboard.acknowledgment-checkboxes.data-src-ack-tooltip","Learn more about public datasources")}},{type:"usageAcknowledgment",description:(0,l.t)("public-dashboard.acknowledgment-checkboxes.usage-ack-desc","Making a dashboard public will cause queries to run each time it is viewed, which may increase costs*"),testId:b.CostIncreaseCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/enterprise/query-caching/",tooltip:(0,l.t)("public-dashboard.acknowledgment-checkboxes.usage-ack-desc-tooltip","Learn more about query caching")}}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:L.title,children:(0,t.jsx)(l.x6,{i18nKey:"public-dashboard.acknowledgment-checkboxes.ack-title",children:"Before you make the dashboard public, acknowledge the following:"})}),(0,t.jsx)(P.n,{disabled:R,children:(0,t.jsx)(d.gW,{spacing:"md",children:K.map(A=>(0,t.jsxs)(d.Gy,{spacing:"none",align:"center",children:[(0,t.jsx)(D.S,{...T(A.type,{required:!0}),label:A.description,"data-testid":A.testId}),(0,t.jsx)(m.z9,{variant:"primary",href:A.info.href,target:"_blank",fill:"text",icon:"info-circle",rel:"noopener noreferrer",tooltip:A.info.tooltip})]},A.type))})})]})},v=R=>({title:(0,n.css)({fontWeight:R.typography.fontWeightBold})}),C=o.Tp.pages.ShareDashboardModal.PublicDashboard,S=({unsupportedDatasources:R=[],unsupportedTemplateVariables:T=!1,dashboard:L,hasError:K=!1})=>{const A=(0,s.of)(I),W=f.TP.hasPermission(i.AccessControlAction.DashboardsPublicWrite),[N,{isLoading:w,isError:j}]=(0,h.U9)(),V=()=>{N({dashboard:L,payload:{isEnabled:!0}}),u.c.generatePublicDashboardUrlClicked({})},{handleSubmit:U,register:F,formState:{isValid:M}}=(0,r.mN)({mode:"onChange"}),H=!W||w||j||K;return(0,t.jsxs)("div",{className:A.container,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:A.title,children:(0,t.jsx)(l.x6,{i18nKey:"public-dashboard.create-page.welcome-title",children:"Welcome to public dashboards!"})}),(0,t.jsx)("p",{className:A.description,children:(0,t.jsx)(l.x6,{i18nKey:"public-dashboard.create-page.unsupported-features-desc",children:"Currently, we don\u2019t support template variables or frontend data sources"})})]}),!W&&(0,t.jsx)(x.t,{mode:"create"}),T&&(0,t.jsx)(p.D,{}),R.length>0&&(0,t.jsx)(g.s,{unsupportedDataSources:R.join(", ")}),(0,t.jsxs)("form",{onSubmit:U(V),children:[(0,t.jsx)("div",{className:A.checkboxes,children:(0,t.jsx)(E,{disabled:H,register:F})}),(0,t.jsx)("div",{className:A.buttonContainer,children:(0,t.jsxs)(m.$n,{type:"submit",disabled:H||!M,"data-testid":C.CreateButton,children:[(0,t.jsx)(l.x6,{i18nKey:"public-dashboard.create-page.generate-public-url-button",children:"Generate public URL"}),w&&(0,t.jsx)(a.y,{className:A.loadingSpinner})]})})]})]})};function O({hasError:R}){const L=(0,i.useSelector)(W=>W.dashboard).getModel(),{unsupportedDataSources:K}=(0,y.Z)(L),A=(0,c.kD)(L.getVariables());return(0,t.jsx)(S,{dashboard:L,unsupportedDatasources:K,unsupportedTemplateVariables:A,hasError:R})}const I=R=>({container:(0,n.css)({display:"flex",flexDirection:"column",gap:R.spacing(4)}),title:(0,n.css)({fontSize:R.typography.h4.fontSize,margin:R.spacing(0,0,2)}),description:(0,n.css)({color:R.colors.text.secondary,marginBottom:R.spacing(0)}),checkboxes:(0,n.css)({margin:R.spacing(0,0,4)}),buttonContainer:(0,n.css)({display:"flex",justifyContent:"end"}),loadingSpinner:(0,n.css)({marginLeft:R.spacing(1)})})},35195:(ee,B,e)=>{"use strict";e.d(B,{t:()=>a});var t=e(74848),n=e(85629),r=e(43173),o=e(34999),s=e(56840);const m=n.Tp.pages.ShareDashboardModal.PublicDashboard,a=({mode:l})=>{const f=r.$.featureToggles.newDashboardSharingComponent?(0,s.t)("public-dashboard.share-externally.no-upsert-perm-alert-title","You don\u2019t have permission to {{ action }} a shared dashboard",{action:l}):(0,s.t)("public-dashboard.modal-alerts.no-upsert-perm-alert-title","You don\u2019t have permission to {{ action }} a public dashboard",{action:l});return(0,t.jsx)(o.F,{severity:"warning",title:f,"data-testid":m.NoUpsertPermissionsWarningAlert,bottomSpacing:0,children:r.$.featureToggles.newDashboardSharingComponent?(0,t.jsxs)(s.x6,{i18nKey:"public-dashboard.share-externally.no-upsert-perm-alert-desc",children:["Contact your admin to get permission to ",{action:l}," shared dashboards"]}):(0,t.jsxs)(s.x6,{i18nKey:"public-dashboard.modal-alerts.no-upsert-perm-alert-desc",children:["Contact your admin to get permission to ",{action:l}," public dashboards"]})})}},37672:(ee,B,e)=>{"use strict";e.d(B,{s:()=>u});var t=e(74848),n=e(22803),r=e(46942),o=e.n(r),s=e(85629),m=e(43173),a=e(63142),l=e(34999),f=e(56840);const h=s.Tp.pages.ShareDashboardModal.PublicDashboard,u=({unsupportedDataSources:x})=>{const g=(0,a.of)(i);return(0,t.jsxs)(l.F,{severity:"warning",title:(0,f.t)("public-dashboard.modal-alerts.unsupported-data-source-alert-title","Unsupported data sources"),"data-testid":h.UnsupportedDataSourcesWarningAlert,bottomSpacing:0,children:[(0,t.jsx)("p",{className:g.unsupportedDataSourceDescription,children:m.$.featureToggles.newDashboardSharingComponent?(0,t.jsxs)(f.x6,{i18nKey:"public-dashboard.share-externally.unsupported-data-source-alert-desc",children:["There are data sources in this dashboard that are unsupported for shared dashboards. Panels that use these data sources may not function properly: ",{unsupportedDataSources:x},"."]}):(0,t.jsxs)(f.x6,{i18nKey:"public-dashboard.modal-alerts.unsupported-data-source-alert-desc",children:["There are data sources in this dashboard that are unsupported for public dashboards. Panels that use these data sources may not function properly: ",{unsupportedDataSources:x},"."]})}),(0,t.jsx)("a",{href:m.$.featureToggles.newDashboardSharingComponent?"https://grafana.com/docs/grafana/next/dashboards/share-dashboards-panels/shared-dashboards/#supported-data-sources":"https://grafana.com/docs/grafana/v11.2/dashboards/dashboard-public/#supported-data-sources",target:"blank",className:o()("text-link",g.unsupportedDataSourceDescription),children:(0,t.jsx)(f.x6,{i18nKey:"public-dashboard.modal-alerts.unsupport-data-source-alert-readmore-link",children:"Read more about supported data sources"})})]})},i=x=>({unsupportedDataSourceDescription:(0,n.css)({color:x.colors.text.secondary,marginBottom:x.spacing(1)})})},44173:(ee,B,e)=>{"use strict";e.d(B,{D:()=>m});var t=e(74848),n=e(85629),r=e(34999),o=e(56840);const s=n.Tp.pages.ShareDashboardModal.PublicDashboard,m=({showDescription:a=!0})=>(0,t.jsx)(r.F,{severity:"warning",title:(0,o.t)("public-dashboard.modal-alerts.unsupported-template-variable-alert-title","Template variables are not supported"),"data-testid":s.TemplateVariablesWarningAlert,bottomSpacing:0,children:a&&(0,t.jsx)(o.x6,{i18nKey:"public-dashboard.modal-alerts.unsupported-template-variable-alert-desc",children:"This public dashboard may not work since it uses template variables"})})},82298:(ee,B,e)=>{"use strict";e.d(B,{a:()=>i,b:()=>x});var t=e(74848),n=e(22803),r=e(63142),o=e(68079),s=e(62905),m=e(24313),a=e(96673),l=e(40203),f=e(72973),h=e(58375),u=e(55066);const i=()=>{const p=(0,r.of)(g);return(0,t.jsx)(l.G,{className:p.loadingContainer,children:(0,t.jsxs)(t.Fragment,{children:["Loading configuration",(0,t.jsx)(o.y,{size:"lg",className:p.spinner})]})})},x=p=>{const{data:c,isLoading:y,isError:P}=(0,s.Bs)(p.dashboard.uid),D=(0,a.useSelector)(E=>E.dashboard).getModel(),{unsupportedDataSources:b}=(0,u.Z)(D);return(0,t.jsx)(t.Fragment,{children:y?(0,t.jsx)(i,{}):(0,m.lI)(c)?(0,t.jsx)(f.K,{publicDashboard:c,unsupportedDatasources:b}):(0,t.jsx)(h.M,{hasError:P})})},g=p=>
278({loadingContainer:(0,n.css)({height:"280px",alignItems:"center",justifyContent:"center",gap:p.spacing(1)}),spinner:(0,n.css)({marginBottom:p.spacing(0)})})},24313:(ee,B,e)=>{"use strict";e.d(B,{AY:()=>c,Xo:()=>l,_A:()=>u,_l:()=>g,gN:()=>x,iR:()=>p,kD:()=>f,lI:()=>h,mL:()=>i});var t=e(36580),n=e(43173),r=e(62061),o=e(65642),s=e(28998),m=e(58662),a=e(35143),l=(y=>(y.PUBLIC="public",y.EMAIL="email",y))(l||{});const f=y=>y.length>0,h=y=>y?.uid!==""&&y?.uid!==void 0,u=async y=>{let P=new Set;for(const d of y)for(const D of d.targets){const b=D?.datasource?.type;b&&(a.z.has(b)&&await(0,s.tR)().get(D.datasource)instanceof t.iy||P.add(b))}return Array.from(P).sort()},i=y=>`${(0,o.zj)().appUrl}public-dashboards/${y}`,x=(y,P)=>`/d/${y}/${P}?shareView=${m.wr.publicDashboard}`,g=/^[A-Z\d._%+-]+@[A-Z\d.-]+\.[A-Z]{2,}$/i,p=()=>n.$.publicDashboardsEnabled,c=()=>p()&&!!n.$.featureToggles.publicDashboardsEmailSharing&&(0,r.a)("publicDashboardsEmailSharing")},35143:(ee,B,e)=>{"use strict";e.d(B,{z:()=>t});const t=new Set(["__expr__","aggregations-io-datasource","apache-iotdb-datasource","aquaqanalytics-kdbbackend-datasource","axiomhq-axiom-datasource","cloudwatch","cnos-cnosdb-datasource","datasource","dlopes7-appdynamics-datasource","dvelop-odata-datasource","elasticsearch","factry-historian-datasource","fiskaly-surrealdb-datasource","frser-sqlite-datasource","grafadruid-druid-datasource","grafana-athena-datasource","grafana-azure-data-explorer-datasource","grafana-azure-monitor-datasource","grafana-azurecosmosdb-datasource","grafana-bigquery-datasource","grafana-catchpoint-datasource","grafana-clickhouse-datasource","grafana-databricks-datasource","grafana-datadog-datasource","grafana-dynamodb-datasource","grafana-dynatrace-datasource","grafana-falconlogscale-datasource","grafana-github-datasource","grafana-gitlab-datasource","grafana-honeycomb-datasource","grafana-iot-sitewise-datasource","grafana-jira-datasource","grafana-looker-datasource","grafana-mock-datasource","grafana-mongodb-datasource","grafana-newrelic-datasource","grafana-odbc-datasource","grafana-opensearch-datasource","grafana-oracle-datasource","grafana-orbit-datasource","grafana-pagerduty-datasource","grafana-postgresql-datasource","grafana-redshift-datasource","grafana-salesforce-datasource","grafana-saphana-datasource","grafana-sentry-datasource","grafana-servicenow-datasource","grafana-snowflake-datasource","grafana-splunk-datasource","grafana-splunk-monitoring-datasource","grafana-sumologic-datasource","grafana-surrealdb-datasource","grafana-testdata-datasource","grafana-timestream-datasource","grafana-wavefront-datasource","grafana-x-ray-datasource","graphite","hadesarchitect-cassandra-datasource","highlightinc-highlight-datasource","ibm-aql-datasource","ibm-kql-datasource","influxdata-flightsql-datasource","influxdb","innius-grpc-datasource","kniepdennis-neo4j-datasource","loki","manassehzhou-maxcompute-datasource","marcusolsson-csv-datasource","mssql","mysql","nagasudhirpulla-api-datasource","needleinajaystack-haystack-datasource","oci-metrics-datasource","opentsdb","parseable-parseable-datasource","postgres","prometheus","questdb-questdb-datasource","quickwit-quickwit-datasource","redis-datasource","retrodaredevil-wildgraphql-datasource","stackdriver","tdengine-datasource","timeplus-proton-datasource","trino-datasource","vertamedia-clickhouse-datasource","vertica-grafana-datasource","ydbtech-ydb-datasource","yesoreyeram-infinity-datasource"])},55066:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>r});var t=e(96540),n=e(24313);const r=o=>{const[s,m]=(0,t.useState)([]);return(0,t.useEffect)(()=>{(async()=>await(0,n._A)(o.panels))().then(l=>{m(l)})},[o.panels]),{unsupportedDataSources:s}}},29216:(ee,B,e)=>{"use strict";e.d(B,{w:()=>s});var t=e(74848),n=e(37386),r=e(77824),o=e(56840);const s=({selectedTheme:m="current",onChange:a,description:l})=>{const f=[{label:(0,o.t)("share-modal.theme-picker.current","Current"),value:"current"},{label:(0,o.t)("share-modal.theme-picker.dark","Dark"),value:"dark"},{label:(0,o.t)("share-modal.theme-picker.light","Light"),value:"light"}];return(0,t.jsx)(n.D,{label:(0,o.t)("share-modal.theme-picker.field-name","Theme"),description:l,children:(0,t.jsx)(r.z,{options:f,value:m,onChange:a})})}},58662:(ee,B,e)=>{"use strict";e.d(B,{CF:()=>x,Lb:()=>i,P_:()=>f,XV:()=>l,Xe:()=>h,hD:()=>p,wr:()=>c});var t=e(17548),n=e(5556),r=e(92138),o=e(25229),s=e(43173),m=e(71673),a=e(75421);function l({useCurrentTimeRange:y,selectedTheme:P,panel:d,search:D=window.location.search,range:b=(0,a.jG)().timeRange(),orgId:E=s.$.bootData.user.orgId}){const v=new URLSearchParams(D),C=d?.timeFrom;if(C){const{from:S,to:O}=t.describeTextRange(C);v.set("from",S),v.set("to",O)}else v.set("from",String(b.from.valueOf())),v.set("to",String(b.to.valueOf()));return v.set("orgId",String(E)),y||(v.delete("from"),v.delete("to")),P!=="current"&&v.set("theme",P),d&&!v.has("editPanel")&&v.set("viewPanel",String(d.id)),v.delete("auth_token"),v.delete("shareView"),v}function f(){let y=window.location.href;const P=y.indexOf("?");return P!==-1&&(y=y.substring(0,P)),y}async function h(y,P,d,D){const b=f(),E=l({useCurrentTimeRange:y,selectedTheme:P,panel:d}),v=n.kM.appendQueryToUrl(b,E.toString());return D?await(0,m.fn)(v):v}function u(y,P,d,D,b){const E=f(),v=l({useCurrentTimeRange:y,selectedTheme:d,panel:D,range:b});let C=E.replace(s.$.appSubUrl+"/dashboard/",s.$.appSubUrl+"/dashboard-solo/");C=C.replace(s.$.appSubUrl+"/d/",s.$.appSubUrl+"/d-solo/"),r.I.stripBaseFromUrl(E)==="/"&&(C=`${s.$.appUrl}d-solo/${P}`);const O=v.get("editPanel")??v.get("viewPanel")??"";return v.set("panelId",O),v.delete("editPanel"),v.delete("viewPanel"),n.kM.appendQueryToUrl(C,v.toString())}function i(y,P,d,D){let E=u(y,P,d,D).replace(s.$.appSubUrl+"/dashboard-solo/",s.$.appSubUrl+"/render/dashboard-solo/");return E=E.replace(s.$.appSubUrl+"/d-solo/",s.$.appSubUrl+"/render/d-solo/"),E+=`&width=${s.$.rendererDefaultImageWidth}&height=${s.$.rendererDefaultImageHeight}&scale=${s.$.rendererDefaultImageScale}`+g(),E}function x(y,P,d,D,b){return`<iframe src="${u(y,P,d,D,b)}" width="450" height="200" frameborder="0"></iframe>`}function g(){const y="&tz=UTC"+encodeURIComponent((0,o.KQ)().format("Z"));if(!window.Intl)return y;const P=window.Intl.DateTimeFormat();if(!P.resolvedOptions)return y;const d=P.resolvedOptions();return d.timeZone?"&tz="+encodeURIComponent(d.timeZone):y}const p=y=>y?"panel":"dashboard",c={link:"link",snapshot:"snapshot",export:"export",embed:"embed",libraryPanel:"library_panel",pdf:"pdf",report:"report",publicDashboard:"public_dashboard",inviteUser:"invite_user"}},4137:(ee,B,e)=>{"use strict";e.d(B,{Zx:()=>b,aK:()=>c});var t=e(74848),n=e(22803),r=e(96540),o=e(16817),s=e(63704),m=e(85629),a=e(63142),l=e(87063),f=e(92807),h=e(88559),u=e(30703),i=e(45861),x=e(83873),g=e(82345);function p({dashboardUID:E,link:v}){const C=(0,a.of)(D),S=y({dashboardUID:E,link:v});return!S||d.length===0?null:(0,t.jsx)(l.W,{children:(0,t.jsx)("div",{className:C.dropdown,children:(0,t.jsx)(f.P,{maxHeight:"inherit",children:S.map((O,I)=>(0,t.jsx)(l.W.Item,{url:O.url,target:v.targetBlank?"_blank":void 0,label:O.title,testId:m.Tp.components.DashboardLinks.link,"aria-label":`${O.title} dashboard`},`dashlinks-dropdown-item-${O.uid}-${I}`))})})})}const c=E=>{const{link:v,linkInfo:C,dashboardUID:S}=E,O=y(E),I=(0,a.of)(D);return v.asDropdown?(0,t.jsx)(h.m,{overlay:(0,t.jsx)(p,{link:v,dashboardUID:S}),children:(0,t.jsxs)(b,{"data-placement":"bottom","data-toggle":"dropdown","aria-controls":"dropdown-list","aria-haspopup":"menu",fill:"outline",variant:"secondary","data-testid":m.Tp.components.DashboardLinks.dropDown,children:[(0,t.jsx)(u.I,{"aria-hidden":!0,name:"bars",className:I.iconMargin}),(0,t.jsx)("span",{children:C.title})]})}):(0,t.jsx)(t.Fragment,{children:O.length>0&&O.map((R,T)=>(0,t.jsx)(b,{icon:"apps",variant:"secondary",fill:"outline",href:R.url,target:v.targetBlank?"_blank":void 0,rel:"noreferrer","data-testid":m.Tp.components.DashboardLinks.link,children:R.title},`dashlinks-list-item-${R.uid}-${T}`))})},y=({link:E,dashboardUID:v})=>{const{tags:C}=E,S=(0,o.A)(()=>P(C),[C]);return S.value?d(v,E,S.value):[]};async function P(E,v={getBackendSrv:x.AI}
278){return await v.getBackendSrv().search({tag:E,limit:100})}function d(E,v,C,S={getLinkSrv:g.mQ,sanitize:s.aj,sanitizeUrl:s.Jf}){return C.filter(O=>O.uid!==E).map(O=>{const I=O.uid,R=S.sanitize(O.title),T=S.getLinkSrv().getLinkUrl({...v,url:O.url}),L=S.sanitizeUrl(T);return{uid:I,title:R,url:L}})}function D(E){return{iconMargin:(0,n.css)({marginRight:E.spacing(.5)}),dropdown:(0,n.css)({maxWidth:"max(30vw, 300px)",maxHeight:"70vh"}),button:(0,n.css)({color:E.colors.text.primary}),dashButton:(0,n.css)({fontSize:E.typography.bodySmall.fontSize,paddingLeft:E.spacing(1),paddingRight:E.spacing(1)})}}const b=(0,r.forwardRef)(({className:E,...v},C)=>{const S=(0,a.of)(D),O=v.href?i.z9:i.$n;return(0,t.jsx)(O,{...v,variant:"secondary",fill:"outline",className:(0,n.cx)(E,S.dashButton),ref:C})});b.displayName="DashboardLinkButton"},47350:(ee,B,e)=>{"use strict";e.d(B,{A:()=>w});var t=e(74848),n=e(8642),r=e(96540),o=e(42941),s=e(69862),m=e(57866),a=e(36638),l=e(2197),f=e(85629),h=e(27489),u=e(2863),i=e(71599),x=e(43260),g=e(85348),p=e(65642),c=e(56840),y=e(85622),P=e(22803),d=e(63142),D=e(8207),b=e(50275),E=e(30703);const v=({input:j,output:V,debugMode:U,index:F,uiConfig:M,configs:H,onChange:_,toggleShowDebug:Z})=>{const ne=(0,d.of)(C),te=(0,r.useMemo)(()=>H[F],[H,F]),Y=(0,r.useMemo)(()=>(0,r.createElement)(M.editor,{options:{...M.transformation.defaultOptions,...te.transformation.options},input:j,onChange:Q=>{_(F,{...te.transformation,options:Q})}}),[M.editor,M.transformation.defaultOptions,te.transformation,j,_,F]);return(0,t.jsxs)("div",{"data-testid":f.Tp.components.TransformTab.transformationEditor(M.name),children:[Y,U&&(0,t.jsx)(D._,{title:(0,c.t)("dashboard.transformation-editor.title-debug-transformation","Debug transformation"),subtitle:M.name,onClose:Z,children:(0,t.jsxs)("div",{className:ne.debugWrapper,"data-testid":f.Tp.components.TransformTab.transformationEditorDebugger(M.name),children:[(0,t.jsxs)("div",{className:ne.debug,children:[(0,t.jsx)("div",{className:ne.debugTitle,children:(0,t.jsx)(c.x6,{i18nKey:"dashboard.transformation-editor.input-data",children:"Input data"})}),(0,t.jsx)("div",{className:ne.debugJson,children:(0,t.jsx)(b.B,{json:j})})]}),(0,t.jsx)("div",{className:ne.debugSeparator,children:(0,t.jsx)(E.I,{name:"arrow-right"})}),(0,t.jsxs)("div",{className:ne.debug,children:[(0,t.jsx)("div",{className:ne.debugTitle,children:(0,t.jsx)(c.x6,{i18nKey:"dashboard.transformation-editor.output-data",children:"Output data"})}),(0,t.jsx)("div",{className:ne.debugJson,children:V&&(0,t.jsx)(b.B,{json:V})})]})]})})]})},C=j=>({title:(0,P.css)({display:"flex",padding:"4px 8px 4px 8px",position:"relative",height:"35px",borderRadius:"4px 4px 0 0",flexWrap:"nowrap",justifyContent:"space-between",alignItems:"center"}),name:(0,P.css)({fontWeight:j.typography.fontWeightMedium,color:j.colors.primary.text}),iconRow:(0,P.css)({display:"flex"}),icon:(0,P.css)({background:"transparent",border:"none",boxShadow:"none",cursor:"pointer",color:j.colors.text.secondary,marginLeft:j.spacing(1),"&:hover":{color:j.colors.text.primary}}),debugWrapper:(0,P.css)({display:"flex",flexDirection:"row"}),debugSeparator:(0,P.css)({width:"48px",minHeight:"300px",display:"flex",alignItems:"center",alignSelf:"stretch",justifyContent:"center",margin:`0 ${j.spacing(.5)}`,color:j.colors.primary.text}),debugTitle:(0,P.css)({padding:`${j.spacing(1)} ${j.spacing(.25)}`,fontFamily:j.typography.fontFamilyMonospace,fontSize:j.typography.bodySmall.fontSize,color:j.colors.text.primary,borderBottom:`1px solid ${j.colors.border.weak}`,flexGrow:0,flexShrink:1}),debug:(0,P.css)({marginTop:j.spacing(1),padding:`0 ${j.spacing(1,1,1)}`,border:`1px solid ${j.colors.border.weak}`,background:`${j.isLight?j.v1.palette.white:j.v1.palette.gray05}`,borderRadius:j.shape.radius.default,width:"100%",minHeight:"300px",display:"flex",flexDirection:"column",alignSelf:"stretch"}),debugJson:(0,P.css)({flexGrow:1,height:"100%",overflow:"hidden",padding:j.spacing(.5)})});var S=e(68805),O=e(84510);const I=({isOpen:j,onCloseClick:V,transformer:U})=>{const{transformation:{name:F},help:M}=U,H=M||(0,O.$n)(),_=(0,t.jsx)(D._,{title:F,subtitle:"Transformation help",onClose:()=>V(!1),children:(0,t.jsx)(S.j,{markdown:H,styleOverrides:{borderTop:"2px solid"}})});return j?_:null};var R=e(739),T=e(37386),L=e(18857),K=e(42240);const A=({index:j,annotations:V,config:U,onChange:F,data:M})=>{const H=(0,d.of)(W),_=(0,r.useMemo)(()=>({context:{data:M}
278,showTopic:!0,showFilter:U.topic!==R.QR.Annotations,source:[{value:R.QR.Series,label:"Query and Transformation results"},{value:R.QR.Annotations,label:"Annotation data"}]}),[M,V?.length,U.topic]);return(0,t.jsx)("div",{className:H.wrapper,children:(0,t.jsx)(T.D,{label:(0,c.t)("dashboard.transformation-filter.label-apply-transformation-to","Apply transformation to"),children:(0,t.jsxs)(t.Fragment,{children:[_.showTopic&&(0,t.jsx)(L.l6,{isClearable:!0,options:_.source,value:_.source.find(Z=>Z.value===U.topic),placeholder:_.source[0].label,className:H.padded,onChange:Z=>{F(j,{...U,topic:Z?.value})}}),_.showFilter&&(0,t.jsx)(K.M,{value:U.filter,context:_.context,onChange:Z=>F(j,{...U,filter:Z})})]})})})},W=j=>{const V=j.shape.radius.default;return{wrapper:(0,P.css)({padding:j.spacing(2),border:`2px solid ${j.colors.background.secondary}`,borderTop:"none",borderRadius:`0 0 ${V} ${V}`,position:"relative",top:"-4px"}),padded:(0,P.css)({marginBottom:j.spacing(1)})}},N=({onRemove:j,index:V,id:U,data:F,configs:M,uiConfig:H,onChange:_})=>{const[Z,ne]=(0,o.A)(!1),[te,Y]=(0,o.A)(!1),[Q,J]=(0,o.A)(!1),q=!!M[V].transformation.disabled,X=M[V].transformation.topic,se=M[V].transformation.filter!=null||X!=null,oe=se||F.series.length>0||(F.annotations?.length??0)>0,[ae,ie]=(0,r.useState)([]),[fe,pe]=(0,r.useState)([]),[de,le]=(0,r.useState)([]),me=(0,r.useCallback)(Ce=>{const He=M[Ce].transformation;_(Ce,{...He,disabled:He.disabled?void 0:!0})},[_,M]),De=(0,r.useCallback)(()=>{let Ce={...M[V].transformation};Ce.filter?delete Ce.filter:Ce.filter={id:m.jR.byRefId,options:""},_(V,Ce)},[_,V,M]),Te=(0,r.useCallback)((Ce,He,ke)=>Me=>{let $e="panel_editor_tabs_transformations_toggle";p.Ay.featureToggles.transformationsRedesign&&($e="transformations_redesign_"+$e),(0,h.rR)($e,{action:ke?"off":"on",toggleId:He,transformationId:M[V].transformation.id}),Ce(Me)},[M,V]);(0,r.useEffect)(()=>{const Ce=M[V].transformation,He=Ce.filter?.options?(0,a.Dq)(Ce.filter):void 0,ke=V-1;let Me=[],$e=[];ke>=0&&(Me=M.slice(0,ke).map(ze=>ze.transformation),$e=M.slice(ke,V).map(ze=>ze.transformation));const tt=M.slice(0,V).map(ze=>ze.transformation),Ke=M.slice(V,V+1).map(ze=>ze.transformation),Re={interpolate:ze=>(0,u.w)().replace(ze)},Ve=(0,l.m)(tt,F.series,Re).subscribe(ze=>{He&&(ze=ze.filter(Ye=>He(Ye))),ie(ze)}),Qe=(0,l.m)(tt,F.series,Re).pipe((0,s.Z)(ze=>(0,l.m)(Ke,ze,Re))).subscribe(pe),je=(0,l.m)(Me,F.series,Re).pipe((0,s.Z)(ze=>(0,l.m)($e,ze,Re))).subscribe(le);return function(){Ve.unsubscribe(),Qe.unsubscribe(),je.unsubscribe()}},[V,F,M]);const Ne=()=>(0,t.jsxs)(t.Fragment,{children:[H.state&&(0,t.jsx)(y.p,{state:H.state}),(0,t.jsx)(x.A,{title:(0,c.t)("dashboard.transformation-operation-row.render-actions.title-show-transform-help","Show transform help"),icon:"info-circle",onClick:Te(J,"help",Q),active:Q}),oe&&(0,t.jsx)(x.A,{title:(0,c.t)("dashboard.transformation-operation-row.render-actions.title-filter","Filter"),icon:"filter",onClick:Te(De,"filter",se),active:se}),(0,t.jsx)(x.A,{title:(0,c.t)("dashboard.transformation-operation-row.render-actions.title-debug","Debug"),icon:"bug",onClick:Te(Y,"debug",te),active:te}),(0,t.jsx)(x.A,{title:(0,c.t)("dashboard.transformation-operation-row.render-actions.title-disable-transformation","Disable transformation"),icon:q?"eye-slash":"eye",onClick:Te(()=>me(V),"disabled",q),active:q,dataTestId:f.Tp.components.Transforms.disableTransformationButton}),(0,t.jsx)(x.q,{title:(0,c.t)("dashboard.transformation-operation-row.render-actions.title-remove","Remove"),icon:"trash-alt",onClick:()=>p.Ay.featureToggles.transformationsRedesign?ne(!0):j(V)}),p.Ay.featureToggles.transformationsRedesign&&(0,t.jsx)(i.u,{isOpen:Z,title:`Delete ${H.name}?`,body:"Note that removing one transformation may break others. If there is only a single transformation, you will go back to the main selection screen.",confirmText:"Delete",onConfirm:()=>{ne(!1),j(V)},onDismiss:()=>ne(!1)})]});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(g.u,{id:U,index:V,title:`${V+1} - ${H.name}`,draggable:!0,actions:Ne,disabled:q,expanderMessages:{close:"Collapse transformation row",open:"Expand transformation row"},children:[se&&(0,t.jsx)(A,{data:de,index:V,config:M[V].transformation,annotations:F.annotations,onChange:_}
278),(0,t.jsx)(v,{input:ae,output:fe,debugMode:te,index:V,configs:M,uiConfig:H,onChange:_,toggleShowDebug:Y})]}),(0,t.jsx)(I,{transformer:H,isOpen:Q,onCloseClick:J})]})},w=({data:j,onChange:V,onRemove:U,configs:F})=>(0,t.jsx)(t.Fragment,{children:F.map((M,H)=>{const _=n.h.getIfExists(M.transformation.id);return _?(0,t.jsx)(N,{index:H,id:`${M.id}`,data:j,configs:F,uiConfig:_,onRemove:U,onChange:V},`${M.id}`):null})})},9284:(ee,B,e)=>{"use strict";e.d(B,{R:()=>E});var t=e(74848),n=e(22803),r=e(96540),o=e(79319),s=e(64761),m=e(8642),a=e(85629),l=e(63142),f=e(8207),h=e(63527),u=e(21285),i=e(34343),x=e(8073),g=e(76319),p=e(65642),c=e(56840),y=e(85622),P=e(72598);const b=[["viewAll","View all"],...Object.entries(P.eJ)];function E(T){const L=(0,l.of)(v),{suffix:K,xforms:A,search:W,onSearchChange:N,onSearchKeyDown:w,showIllustrations:j,onTransformationAdd:V,selectedFilter:U,data:F,onClose:M,onShowIllustrationsChange:H,onSelectedFilterChange:_}=T,Z=(0,r.useCallback)(ne=>{ne?.click()},[]);return(0,t.jsxs)(f._,{size:"md",onClose:()=>{M&&M()},title:(0,c.t)("dashboard.transformation-picker-ng.title-add-another-transformation","Add another transformation"),children:[(0,t.jsxs)("div",{className:L.searchWrapper,children:[(0,t.jsx)(h.p,{"data-testid":a.Tp.components.Transforms.searchInput,className:L.searchInput,value:W??"",placeholder:(0,c.t)("dashboard.transformation-picker-ng.placeholder-search-for-transformation","Search for transformation"),onChange:N,onKeyDown:w,suffix:K,ref:Z,autoFocus:!0}),(0,t.jsxs)("div",{className:L.showImages,children:[(0,t.jsx)("span",{className:L.illustationSwitchLabel,children:(0,t.jsx)(c.x6,{i18nKey:"dashboard.transformation-picker-ng.show-images",children:"Show images"})})," ",(0,t.jsx)(u.d,{value:j,onChange:()=>H&&H(!j)})]})]}),(0,t.jsx)("div",{className:L.filterWrapper,children:b.map(([ne,te])=>(0,t.jsx)(i.m,{onClick:()=>_&&_(ne),label:te,selected:U===ne},ne))}),(0,t.jsx)(C,{showIllustrations:j,transformations:A,data:F,onClick:ne=>{V({value:ne})}})]})}function v(T){return{showImages:(0,n.css)({flexBasis:"0",display:"flex",gap:"8px",alignItems:"center"}),pickerInformationLine:(0,n.css)({fontSize:"16px",marginBottom:`${T.spacing(2)}`}),pickerInformationLineHighlight:(0,n.css)({verticalAlign:"middle"}),searchWrapper:(0,n.css)({display:"flex",flexWrap:"wrap",columnGap:"27px",rowGap:"16px",width:"100%"}),searchInput:(0,n.css)({flexGrow:"1",width:"initial"}),illustationSwitchLabel:(0,n.css)({whiteSpace:"nowrap"}),filterWrapper:(0,n.css)({padding:`${T.spacing(1)} 0`,display:"flex",flexWrap:"wrap",rowGap:`${T.spacing(1)}`,columnGap:`${T.spacing(.5)}`})}}function C({showIllustrations:T,transformations:L,onClick:K,data:A}){const W=(0,l.of)(S);return(0,t.jsx)("div",{className:W.grid,children:L.map(N=>{let w=o.M.Applicable;N.transformation.isApplicable!==void 0&&(w=N.transformation.isApplicable(A));const j=w>0;let V=null;N.transformation.isApplicableDescription!==void 0&&(typeof N.transformation.isApplicableDescription=="function"?V=N.transformation.isApplicableDescription(A):V=N.transformation.isApplicableDescription);let U=W.newCard;return j||(U=(0,n.cx)(W.newCard,W.cardDisabled)),(0,t.jsxs)(x.Z,{className:U,"data-testid":a.Tp.components.TransformTab.newTransform(N.name),onClick:()=>K(N.id),children:[(0,t.jsxs)(x.Z.Heading,{className:W.heading,children:[(0,t.jsx)("span",{children:N.name}),(0,t.jsx)("span",{className:W.pluginStateInfoWrapper,children:(0,t.jsx)(y.p,{state:N.state})})]}),(0,t.jsxs)(x.Z.Description,{className:W.description,children:[(0,t.jsx)("span",{children:R(N.id)}),T&&(0,t.jsx)("span",{children:(0,t.jsx)("img",{className:W.image,src:O(N.id,!j),alt:N.name})}),!j&&V!==null&&(0,t.jsx)(g.K,{className:W.cardApplicableInfo,name:"info-circle",tooltip:V})]})]},N.id)})})}function S(T){return{heading:(0,n.css)({fontWeight:400,"> button":{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"nowrap"}}),description:(0,n.css)({fontSize:"12px",display:"flex",flexDirection:"column",justifyContent:"space-between"}),image:(0,n.css)({display:"block",maxEidth:"100%`",marginTop:`${T.spacing(2)}`}),grid:(0,n.css)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gridAutoRows:"1fr",gap:`${T.spacing(2)} ${T.spacing(1)}`,width:"100%"}),cardDisabled:(0,n.css)({backgroundColor:"rgb(204, 204, 220, 0.045)",color:`${T.colors.text.disabled} !important`,img:{filter:"grayscale(100%)",opacity:.33}}),cardApplicableInfo:(0,n.css)({position:"absolute",bottom:`${T.spacing(1)}`,right:`${T.spacing(1)}`}),newCard:(0,n.css)({gridTemplateRows:"min-content 0 1fr 0"}),pluginStateInfoWrapper:(0,n.css)({marginLeft:"5px"})}}const O=(T,L)=>`public/img/transformations/${p.Ay.theme2.isDark?"dark":"light"}/${T}.svg`,I={[s.F.concatenate]:"Combine all fields into a single frame.",[s.F.configFromData]:"Set unit, min, max and more.",[s.F.fieldLookup]:"Use a field value to lookup countries, states, or airports.",[s.F.filterFieldsByName]:"Remove parts of the query results using a regex pattern.",[s.F.filterByRefId]:"Remove rows from the data based on origin query",[s.F.filterByValue]:"Remove rows from the query results using user-defined filters.",[s.F.groupBy]:"Group data by a field value and create aggregate data.",[s.F.groupingToMatrix]:"Summarize and reorganize data based on three fields.",[s.F.joinByField]:"Combine rows from 2+ tables, based on a related field.",[s.F.labelsToFields]:"Group series by time and return labels or tags as fields.",[s.F.merge]:"Merge multiple series. Values will be combined into one row.",[s.F.organize]:"Re-order, hide, or rename fields.",[s.F.partitionByValues]:"Split a one-frame dataset into multiple series.",[s.F.prepareTimeSeries]:"Stretch data frames from the wide format into the long format.",[s.F.reduce]:"Reduce all rows or data points to a single value (ex. max, mean).",[s.F.renameByRegex]:"Rename parts of the query results using a regular expression and replacement pattern.",[s.F.seriesToRows]:"Merge multiple series. Return time, metric and values as a row."},R=T=>I[T]||m.h.getIfExists(T)?.description||""},34176:(ee,B,e)=>{"use strict";e.d(B,{o:()=>U,e:()=>j});var t=e(74848),n=e(57095),r=e(96540),o=e(8642),s=e(85629),m=e(27489),a=e(76319),l=e(45861),f=e(71599),h=e(93256),u=e(92807),i=e(32881),x=e(63142),g=e(65642),p=e(56840),c=e(80849),y=e(36490),P=e(41654),d=e(62667);function D({message:F}){const M=(0,r.useCallback)(()=>{y.Ny.partial({tab:d.M8.Query})},[]);return(0,t.jsx)("div",{style:{marginTop:"100px"},children:(0,t.jsx)(P.B,{direction:"row",justifyContent:"center",children:(0,t.jsxs)(P.B,{direction:"column",gap:2,children:[(0,t.jsx)("h2",{children:F}),(0,t.jsx)("div",{children:(0,t.jsx)(l.$n,{size:"md",variant:"secondary",icon:"arrow-left",onClick:M,children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.panel-not-supported.go-back-to-queries",children:"Go back to Queries"})})})]})})})}var b=e(47350),E=e(22803),v=e(28882),C=e(34999),S=e(63527),O=e(8073),I=e(36321);const R={[v.f.Transformations]:"https://grafana.com/docs/grafana/latest/panels/transformations",[v.f.FieldConfig]:"https://grafana.com/docs/grafana/latest/panels/field-configuration-options/",[v.f.FieldConfigOverrides]:"https://grafana.com/docs/grafana/latest/panels/field-configuration-options/#override-a-field"},T=F=>R[F];var L=e(85622);const K="dashboard.components.TransformationEditor.featureInfoBox.isDismissed";function A(F){const{noTransforms:M,search:H,xforms:_,onSearchChange:Z,onSearchKeyDown:ne,onTransformationAdd:te,suffix:Y}=F;return(0,t.jsxs)(i.gW,{children:[M&&(0,t.jsx)(i.mc,{grow:1,children:(0,t.jsx)(I.b,{storageKey:K,defaultValue:!1,children:(Q,J)=>Q?null:(0,t.jsxs)(C.F,{title:(0,p.t)("dashboard.transformation-picker.title-transformations","Transformations"),severity:"info",onRemove:()=>{J(!0)},children:[(0,t.jsxs)("p",{children:["Transformations allow you to join, calculate, re-order, hide, and rename your query results before they are visualized. ",(0,t.jsx)("br",{}),"Many transforms are not suitable if you're using the Graph visualization, as it currently only supports time series data. ",(0,t.jsx)("br",{}),"It can help to switch to the Table visualization to understand what a transformation is doing."," "]}),(0,t.jsx)("a",{href:T(v.f.Transformations),className:"external-link",target:"_blank",rel:"noreferrer",children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.transformation-picker.read-more",children:"Read more"})})]})})}),(0,t.jsx)(S.p,{"data-testid":s.Tp.components.Transforms.searchInput,value:H??"",autoFocus:!M,placeholder:(0,p.t)("dashboard.transformation-picker.placeholder-search-for-transformation","Search for transformation"),onChange:Z,onKeyDown:ne,suffix:Y}),_.map(Q=>(0,t.jsx)(W,{transform:Q,onClick:()=>{te({value:Q.id})}},Q.name))]})}function W({transform:F,onClick:M}){const H=(0,x.of)(N);return(0,t.jsxs)(O.Z,{className:H.card,"data-testid":s.Tp.components.TransformTab.newTransform(F.name),onClick:M,children:[(0,t.jsx)(O.Z.Heading,{children:F.name}),(0,t.jsx)(O.Z.Description,{children:F.description}),F.state&&(0,t.jsx)(O.Z.Tags,{children:(0,t.jsx)(L.p,{state:F.state})})]})}function N(F){return{card:(0,E.css)({margin:"0",padding:`${F.spacing(1)}`})}}var w=e(9284);const j="viewAll";class V extends r.PureComponent{constructor(M){super(M),this.onSearchChange=Z=>{this.setState({search:Z.target.value})},this.onSearchKeyDown=Z=>{if(Z.key==="Enter"){const{search:ne}=this.state;if(ne){const te=ne.toLowerCase(),Y=o.h.list().filter(Q=>(Q.name+Q.description).toLowerCase().indexOf(te)>=0);Y.length>0&&this.onTransformationAdd({value:Y[0].id})}}else Z.keyCode===27&&(this.setState({search:"",showPicker:!1}),Z.stopPropagation())},this.getTransformationNextId=Z=>{const{transformations:ne}=this.state;let te=0;const Y=ne.filter(Q=>Q.id.startsWith(Z)).map(Q=>Q.id);return Y.length!==0&&(te=Math.max(...Y.map(Q=>parseInt(Q.match(/\d+/)[0],10)))+1),`${Z}-${te}`},this.onTransformationAdd=Z=>{let ne="panel_editor_tabs_transformations_management";g.Ay.featureToggles.transformationsRedesign&&(ne="transformations_redesign_"+ne),(0,m.rR)(ne,{action:"add",transformationId:Z.value});const{transformations:te}=this.state,Y=this.getTransformationNextId(Z.value);this.setState({search:"",showPicker:!1}),this.onChange([...te,{id:Y,transformation:{id:Z.value,options:{}}}])},this.onTransformationChange=(Z,ne)=>{const{transformations:te}=this.state,Y=Array.from(te);let Q="panel_editor_tabs_transformations_management";g.Ay.featureToggles.transformationsRedesign&&(Q="transformations_redesign_"+Q),(0,m.rR)(Q,{action:"change",transformationId:Y[Z].transformation.id}),Y[Z].transformation=ne,this.onChange(Y)},this.onTransformationRemove=Z=>{const{transformations:ne}=this.state,te=Array.from(ne);let Y="panel_editor_tabs_transformations_management";g.Ay.featureToggles.transformationsRedesign&&(Y="transformations_redesign_"+Y),(0,m.rR)(Y,{action:"remove",transformationId:te[Z].transformation.id}),te.splice(Z,1),this.onChange(te)},this.onTransformationRemoveAll=()=>{this.onChange([]),this.setState({showRemoveAllModal:!1})},this.onDragEnd=Z=>{const{transformations:ne}=this.state;if(!Z||!Z.destination)return;const te=Z.source.index,Y=Z.destination.index;if(te===Y)return;const Q=Array.from(ne),[J]=Q.splice(te,1);Q.splice(Y,0,J),this.onChange(Q)},this.renderEmptyMessage=()=>(0,t.jsx)(c.p,{onShowPicker:()=>{this.setState({showPicker:!0})}}),this.renderTransformationEditors=()=>{const{data:Z,transformations:ne}=this.state;return(0,t.jsx)(n.DragDropContext,{onDragEnd:this.onDragEnd,children:(0,t.jsx)(n.Droppable,{droppableId:"transformations-list",direction:"vertical",children:te=>(0,t.jsxs)("div",{ref:te.innerRef,...te.droppableProps,children:[(0,t.jsx)(b.A,{configs:ne,data:Z,onRemove:this.onTransformationRemove,onChange:this.onTransformationChange}),te.placeholder]})})})};const H=M.panel.transformations||[],_=this.buildTransformationIds(H);this.state={transformations:H.map((Z,ne)=>({transformation:Z,id:_[ne]})),data:{series:[]},search:"",selectedFilter:j,showIllustrations:!0},this.ref=(0,r.createRef)()}buildTransformationIds(M){const H={},_=[];for(let Z=0;Z<M.length;Z++){const ne=M[Z];H[ne.id]===void 0?H[ne.id]=0:H[ne.id]+=1,_.push(`${M[Z].id}-${H[M[Z].id]}`)}return _}componentDidMount(){this.subscription=this.props.panel.getQueryRunner().getData({withTransforms:!1,withFieldConfig:!1}).subscribe({next:M=>this.setState({data:M})})}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}
278componentDidUpdate(M,H){if(g.Ay.featureToggles.transformationsRedesign){const Z=!(H.transformations.length>0)||H.showPicker,te=!(this.state.transformations.length>0)||this.state.showPicker;if(Z!==te){const Y=Math.random()/2;this.setState({scrollTop:te?Y:Number.MAX_SAFE_INTEGER})}}H.scrollTop!==this.state.scrollTop&&this.ref.current?.scrollTo({top:this.state.scrollTop})}onChange(M){this.setState({transformations:M}),this.props.panel.setTransformations(M.map(H=>H.transformation))}renderTransformsPicker(){let{showPicker:M}=this.state;const{transformations:H,search:_}=this.state,{transformationsRedesign:Z}=g.Ay.featureToggles,ne=!H?.length,te=H.length>0;let Y=null,Q=o.h.list().sort((se,oe)=>se.name>oe.name?1:oe.name>se.name?-1:0);if(!Z&&ne&&(M=!0),this.state.selectedFilter!==j&&(Q=Q.filter(se=>se.categories&&this.state.selectedFilter&&se.categories.has(this.state.selectedFilter))),_){const se=_.toLowerCase(),oe=Q.filter(ae=>(ae.name+ae.description).toLowerCase().indexOf(se)>=0);Y=(0,t.jsxs)(t.Fragment,{children:[oe.length," / ",Q.length," \xA0\xA0",(0,t.jsx)(a.K,{name:"times",onClick:()=>{this.setState({search:""})},tooltip:(0,p.t)("dashboard.un-themed-transformations-editor.tooltip-clear-search","Clear search")})]}),Q=oe}!Y&&M&&!ne&&(Y=(0,t.jsx)(a.K,{name:"times",onClick:()=>{this.setState({showPicker:!1})},tooltip:(0,p.t)("dashboard.un-themed-transformations-editor.tooltip-close-picker","Close picker")}));let J=null,q=null;Z?(J=(0,t.jsx)(w.R,{noTransforms:ne,search:_,suffix:Y,xforms:Q,onClose:()=>this.setState({showPicker:!1}),onSelectedFilterChange:se=>this.setState({selectedFilter:se}),onShowIllustrationsChange:se=>this.setState({showIllustrations:se}),onSearchChange:this.onSearchChange,onSearchKeyDown:this.onSearchKeyDown,onTransformationAdd:this.onTransformationAdd,data:this.state.data.series,selectedFilter:this.state.selectedFilter,showIllustrations:this.state.showIllustrations}),q=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.$n,{icon:"times",variant:"secondary",onClick:()=>this.setState({showRemoveAllModal:!0}),style:{marginLeft:this.props.theme.spacing.md},children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.un-themed-transformations-editor.delete-all-transformations",children:"Delete all transformations"})}),(0,t.jsx)(f.u,{isOpen:!!this.state.showRemoveAllModal,title:(0,p.t)("dashboard.un-themed-transformations-editor.title-delete-all-transformations","Delete all transformations?"),body:"By deleting all transformations, you will go back to the main selection screen.",confirmText:"Delete all",onConfirm:()=>this.onTransformationRemoveAll(),onDismiss:()=>this.setState({showRemoveAllModal:!1})})]})):J=(0,t.jsx)(A,{noTransforms:ne,search:_,suffix:Y,xforms:Q,onSearchChange:this.onSearchChange,onSearchKeyDown:this.onSearchKeyDown,onTransformationAdd:this.onTransformationAdd});const X=(0,t.jsxs)(h.e,{children:[(0,t.jsx)(l.$n,{icon:"plus",variant:"secondary",onClick:()=>{this.setState({showPicker:!0})},"data-testid":s.Tp.components.Transforms.addTransformationButton,children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.un-themed-transformations-editor.actions.add-another-transformation",children:"Add another transformation"})}),q]});return(0,t.jsxs)(t.Fragment,{children:[M&&J,Z&&te&&X||!Z&&!M&&te&&X]})}render(){const{panel:{alert:M}}=this.props,{transformations:H}=this.state,_=H.length>0;if(M){const Z=_?"Transformations can't be used on a panel with alerts":"Transformations can't be used on a panel with existing alerts";return(0,t.jsx)(D,{message:Z})}return(0,t.jsx)(u.P,{ref:this.ref,minHeight:"100%",children:(0,t.jsx)(i.mc,{padding:"lg",children:(0,t.jsxs)("div",{"data-testid":s.Tp.components.TransformTab.content,children:[!_&&g.Ay.featureToggles.transformationsRedesign&&this.renderEmptyMessage(),_&&this.renderTransformationEditors(),this.renderTransformsPicker()]})})})}}const U=(0,x.SL)(V)},84403:(ee,B,e)=>{"use strict";e.d(B,{A:()=>P});var t=e(74848),n=e(22803),r=e(85629),o=e(36490),s=e(63142),m=e(41654),a=e(31286),l=e(66404),f=e(45861),h=e(56840),u=e(77731),i=e(89451),x=e(39385),g=e(23289),p=e(96673),c=e(37918);const P=({dashboard:D,canCreate:b})=>{const E=(0,s.of)(d),v=(0,p.useDispatch)(),C=(0,p.useSelector)(R=>R.dashboard.initialDatasource),S=()=>{let R;
278if(D instanceof x.H$){const T=D.onCreateNewPanel();D.setState({editPanel:(0,i.L)(T,!0)}),o.Ny.partial({firstPanel:!0})}else R=(0,u.OK)(D,C),v((0,c.Ub)(void 0)),o.Ny.partial({editPanel:R,firstPanel:!0});g.c.emptyDashboardButtonClicked({item:"add_visualization"})},O=()=>{g.c.emptyDashboardButtonClicked({item:"import_from_library"}),D instanceof x.H$?D.onShowAddLibraryPanelDrawer():(0,u.s3)(D)},I=D instanceof x.H$&&D.isManagedRepository();return(0,t.jsx)(m.B,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)("div",{className:E.wrapper,children:(0,t.jsxs)(m.B,{alignItems:"stretch",justifyContent:"center",gap:4,direction:"column",children:[(0,t.jsx)(a.a,{borderColor:"strong",borderStyle:"dashed",padding:4,children:(0,t.jsxs)(m.B,{direction:"column",alignItems:"center",gap:2,children:[(0,t.jsx)(l.E,{element:"h1",textAlignment:"center",weight:"medium",children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.add-visualization-header",children:"Start your new dashboard by adding a visualization"})}),(0,t.jsx)(a.a,{marginBottom:2,paddingX:4,children:(0,t.jsx)(l.E,{element:"p",textAlignment:"center",color:"secondary",children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.add-visualization-body",children:"Select a data source and then query and visualize your data with charts, stats and tables or create lists, markdowns and other widgets."})})}),(0,t.jsx)(f.$n,{size:"lg",icon:"plus","data-testid":r.Tp.pages.AddDashboard.itemButton("Create new panel button"),onClick:S,disabled:!b,children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.add-visualization-button",children:"Add visualization"})})]})}),(0,t.jsxs)(m.B,{direction:{xs:"column",md:"row"},wrap:"wrap",gap:4,children:[(0,t.jsx)(a.a,{borderColor:"strong",borderStyle:"dashed",padding:3,flex:1,children:(0,t.jsxs)(m.B,{direction:"column",alignItems:"center",gap:1,children:[(0,t.jsx)(l.E,{element:"h3",textAlignment:"center",weight:"medium",children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.add-library-panel-header",children:"Import panel"})}),(0,t.jsx)(a.a,{marginBottom:2,children:(0,t.jsx)(l.E,{element:"p",textAlignment:"center",color:"secondary",children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.add-library-panel-body",children:"Add visualizations that are shared with other dashboards."})})}),(0,t.jsx)(f.$n,{icon:"plus",fill:"outline","data-testid":r.Tp.pages.AddDashboard.itemButton("Add a panel from the panel library button"),onClick:O,disabled:!b||I,children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.add-library-panel-button",children:"Add library panel"})})]})}),(0,t.jsx)(a.a,{borderColor:"strong",borderStyle:"dashed",padding:3,flex:1,children:(0,t.jsxs)(m.B,{direction:"column",alignItems:"center",gap:1,children:[(0,t.jsx)(l.E,{element:"h3",textAlignment:"center",weight:"medium",children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.import-a-dashboard-header",children:"Import a dashboard"})}),(0,t.jsx)(a.a,{marginBottom:2,children:(0,t.jsx)(l.E,{element:"p",textAlignment:"center",color:"secondary",children:(0,t.jsxs)(h.x6,{i18nKey:"dashboard.empty.import-a-dashboard-body",children:["Import dashboards from files or ",(0,t.jsx)("a",{href:"https://grafana.com/grafana/dashboards/",children:"grafana.com"}),"."]})})}),(0,t.jsx)(f.$n,{icon:"upload",fill:"outline","data-testid":r.Tp.pages.AddDashboard.itemButton("Import dashboard button"),onClick:()=>{g.c.emptyDashboardButtonClicked({item:"import_dashboard"}),(0,u.VF)()},disabled:!b,children:(0,t.jsx)(h.x6,{i18nKey:"dashboard.empty.import-dashboard-button",children:"Import dashboard"})})]})})]})]})})})};function d(D){return{wrapper:(0,n.css)({label:"dashboard-empty-wrapper",flexDirection:"column",maxWidth:"890px",gap:D.spacing.gridSize*4,paddingTop:D.spacing(2),[D.breakpoints.up("sm")]:{paddingTop:D.spacing(12)}})}}},46429:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>i});var t=e(74848),n=e(96540),r=e(36490),o=e(22803),s=e(63142),m=e(7895),a=e(30703),l=e(45967),f=e(35484);const h=({notice:x,onClick:g})=>{const p=(0,s.of)(u),c=x.severity==="error"||x.severity==="warning"?"exclamation-triangle":"file-landscape-alt";return x.inspect&&g?(0,t.jsx)(m.I,{className:p.notice,icon:c,iconSize:"md",tooltip:x.text,onClick:y=>g(y,x.inspect)},x.severity):x.link?(0,t.jsx)("a",{className:p.notice,"aria-label":x.text,href:x.link,target:"_blank",rel:"noreferrer",children:(0,t.jsx)(a.I,{name:c,style:{marginRight:"8px"},size:"md"})}):(0,t.jsx)(l.m,{content:x.text,children:(0,t.jsx)("span",{className:p.iconTooltip,children:(0,t.jsx)(a.I,{name:c,size:"md"})})},x.severity)},u=x=>
278({notice:(0,o.css)({background:"inherit",border:"none",borderRadius:x.shape.radius.default}),iconTooltip:(0,o.css)({color:`${x.colors.text.secondary}`,backgroundColor:"inherit",cursor:"auto",border:"none",borderRadius:`${x.shape.radius.default}`,padding:`${x.spacing(0,1)}`,height:` ${x.spacing(x.components.height.md)}`,display:"flex",alignItems:"center",justifyContent:"center","&:focus, &:focus-visible":{...(0,f.getFocusStyles)(x),zIndex:1},"&: focus:not(:focus-visible)":(0,f.getMouseFocusStyles)(x),"&:hover ":{boxShadow:`${x.shadows.z1}`,color:`${x.colors.text.primary}`,background:`${x.colors.background.secondary}`}})}),i=({frames:x,panelId:g})=>{const p=(0,n.useCallback)((y,P)=>{y.stopPropagation(),r.Ny.partial({inspect:g,inspectTab:P})},[g]),c={};for(const y of x)if(!(!y.meta||!y.meta.notices))for(const P of y.meta.notices)c[P.severity]=P;return(0,t.jsx)(t.Fragment,{children:Object.values(c).map(y=>(0,t.jsx)(h,{notice:y,onClick:p},y.severity))})}},78013:(ee,B,e)=>{"use strict";e.d(B,{M:()=>h});var t=e(83340),n=e(4575),r=e(57866),o=e(95004),s=e(16515),m=e(36638),a=e(49256);const l="hideSeriesFrom",f=(0,t.ZW)(l);function h(y,P,d,D){const{overrides:b}=d,E=y,v=b.findIndex(f);if(v<0){if(P===a.B.ToggleSelection){const T=u([E,...c(b,D)]);return{...d,overrides:[...d.overrides,T]}}const I=p(D,E),R=u(I);return{...d,overrides:[...d.overrides,R]}}const C=Array.from(b),[S]=C.splice(v,1);if(P===a.B.ToggleSelection){let I=x(S);const R=c(C,D);if(R.length>0&&(I=I.filter(L=>R.indexOf(L)<0)),I[0]===E&&I.length===1)return{...d,overrides:C};const T=u([E,...R]);return{...d,overrides:[...C,T]}}const O=i(S,E);return g(O,D)?{...d,overrides:C}:{...d,overrides:[...C,O]}}function u(y,P=n.PP.exclude,d){return d=d??{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!1}},{__systemRef:l,matcher:{id:r.Ct.byNames,options:{mode:P,names:y,prefix:P===n.PP.exclude?"All except:":void 0,readOnly:!0}},properties:[{...d,value:{viz:!0,legend:!1,tooltip:!1}}]}}const i=(y,P,d=n.PP.exclude)=>{const D=y.properties.find(v=>v.id==="custom.hideFrom"),b=x(y),E=b.findIndex(v=>v===P);return E<0?b.push(P):b.splice(E,1),u(b,d,D)},x=y=>{const P=y.matcher.options?.names;return Array.isArray(P)?[...P]:[]},g=(y,P)=>x(y).length===p(P).length,p=(y,P)=>{const d=new Set;for(const D of y)for(const b of D.fields){if(b.type!==o.PU.number)continue;const E=(0,s.Ct)(b,D,y);E!==P&&d.add(E)}return Array.from(d)},c=(y,P)=>{let d=[];for(const D of y){const b=D.properties.find(E=>E.id==="custom.hideFrom");if(b!==void 0&&b.value?.legend===!0){const v=m.sJ.get(D.matcher.id).get(D.matcher.options);for(const C of P)for(const S of C.fields){if(S.type!==o.PU.number)continue;const O=(0,s.Ct)(S,C,P);v(S,C,P)&&d.push(O)}}}return d}},4405:(ee,B,e)=>{"use strict";e.d(B,{a:()=>l});var t=e(49426),n=e(25229),r=e(33239);const o=100;class s{constructor(){this.listeners=[],this.budget=1,this.threshold=1.5,this.ok=new t.t(!0),this.lastUpdate=Date.now(),this.isLive=!1,this.liveTimeOffset=0,this.measure=()=>{const h=Date.now();this.budget=(h-this.lastUpdate)/o;const u=this.ok.getValue(),i=this.budget<=this.threshold;if(u!==i&&this.ok.next(i),this.lastUpdate=h,this.isLive&&this.ok.getValue()&&this.timeRange){let x;for(const g of this.listeners){if(!g.panel.props.isInView)continue;if(h-g.last>=g.intervalMs){if(!x){const{raw:c}=this.timeRange;x={raw:c,from:(0,n.KQ)(h-this.liveTimeOffset),to:(0,n.KQ)(h)}}g.panel.liveTimeChanged(x),g.last=h}}}}}setLiveTimeRange(h){if(this.timeRange=h,this.isLive=h?.raw?.to==="now",this.isLive){const u=r.parse(h.raw.from,!1)?.valueOf(),i=r.parse(h.raw.to,!0)?.valueOf();this.liveTimeOffset=i-u;for(const x of this.listeners)x.intervalMs=a(this.liveTimeOffset,x.panel.props.width)}}listen(h){this.listeners.push({last:this.lastUpdate,panel:h,intervalMs:a(6e4,h.props.width)})}remove(h){this.listeners=this.listeners.filter(u=>u.panel!==h)}updateInterval(h){if(!(!this.timeRange||!this.isLive)){for(const u of this.listeners)if(u.panel===h){u.intervalMs=a(this.liveTimeOffset,u.panel.props.width);return}}}}const m=5*60*1e3;function a(f,h){const u=Math.ceil(f/h/100)*100;return u>m?m:u}const l=new s;setInterval(l.measure,o)},48600:(ee,B,e)=>{"use strict";e.d(B,{np:()=>S,t0:()=>C});var t=e(34796),n=e.n(t),r=e(2543),o=e.n(r),s=e(95093),m=e.n(s),a=e(32899),l=e(33239),f=e(68143),h=e(36490),u=e(83873),i=e(67020),x=e(77197),g=e(41644),p=e(28998),c=e(73427),y=e(50803),P=e(18646),d=e(95407),D=e(22429),b=e(8735);class E{loadScriptedDashboard(R){const T="public/dashboards/"+R.replace(/\.(?!js)/,"/")+"?"+new Date().getTime();return(0,f.AI)().get(T).then(this.executeScript.bind(this)).then(L=>({meta:{fromScript:!0,canDelete:!1,canSave:!1,canStar:!1},dashboard:L.data}),L=>{throw console.error("Script dashboard error "+L),c.lE.emit(a.r1.alertError,["Script Error","Please make sure it exists and returns a valid dashboard"]),L})}executeScript(R){const T={dashboardSrv:(0,D.UA)(),datasourceSrv:(0,p.tR)()},K=new Function("ARGS","kbn","dateMath","_","moment","window","document","$","jQuery","services",R)(h.Ny.getSearchObject(),x.A,l,o(),m(),window,document,n(),n(),T);return(0,r.isFunction)(K)?new Promise(A=>{K(W=>{A({data:W})})}):{data:K}}}
278class v extends E{loadDashboard(R,T,L,K){const A=(0,g.sP)("v1");let W;if(R==="script"&&T)W=this.loadScriptedDashboard(T);else if(R==="snapshot"&&T)W=(0,b.s)().getSnapshot(T);else if(R==="public"&&L)W=u.IB.getPublicDashboardByUid(L).then(N=>N);else if(L){if(!K){const N=A.getDashboardFromCache(L);if(N)return Promise.resolve(N)}W=(0,P.n)("v1").getDashboardDTO(L,K).then(N=>N).catch(N=>{throw(0,f.NF)(N)&&!(N instanceof d.P)&&(console.error("Failed to load dashboard",N),N.isHandled=!0,N.status===404&&c.lE.emit(a.r1.alertError,["Dashboard not found"])),N})}else throw new Error("Dashboard uid or slug required");return W.then(N=>(i.A.addDashboardImpression(N.dashboard.uid),N)),W}loadSnapshot(R){const T=(0,b.s)().getSnapshot(R);return T.then(L=>(i.A.addDashboardImpression(L.dashboard.uid),L)),T}}class C extends E{loadDashboard(R,T,L,K){const A=(0,g.sP)("v2");let W;if(R==="script"&&T)W=this.loadScriptedDashboard(T).then(N=>y.Op.ensureV2Response(N));else if(R==="public"&&L)W=u.IB.getPublicDashboardByUid(L).then(N=>y.Op.ensureV2Response(N));else if(L){if(!K){const N=A.getDashboardFromCache(L);if(N)return Promise.resolve(N)}W=(0,P.n)("v2").getDashboardDTO(L,K).then(N=>N).catch(N=>{throw(0,f.NF)(N)&&!(N instanceof d.P)&&(console.error("Failed to load dashboard",N),N.isHandled=!0,N.status===404&&c.lE.emit(a.r1.alertError,["Dashboard not found"])),N})}else throw new Error("Dashboard uid or slug required");return W.then(N=>(i.A.addDashboardImpression(N.metadata.name),N)),W}loadSnapshot(R){const T=(0,b.s)().getSnapshot(R).then(L=>y.Op.ensureV2Response(L));return T.then(L=>(i.A.addDashboardImpression(L.metadata.name),L)),T}}let S=new v;const O=I=>{throw new Error("dashboardLoaderSrv can be only overriden in test environment")}},22429:(ee,B,e)=>{"use strict";e.d(B,{UA:()=>i});var t=e(32899),n=e(45229),r=e(56840),o=e(83873),s=e(18646),m=e(87745),a=e(7817),l=e(17097);class f{constructor(){this.onRemovePanel=g=>{const p=this.getCurrent();p&&(0,l.FC)(p,p.getPanelById(g),!0)},n.l.subscribe(m.Vz,g=>this.onRemovePanel(g.payload))}create(g,p){return new a.G(g,p)}setCurrent(g){this.dashboard=g}getCurrent(){return this.dashboard}saveJSONDashboard(g){const p=JSON.parse(g);return(0,s.n)().saveDashboard({dashboard:p,folderUid:this.dashboard?.meta.folderUid||p.folderUid,message:"Edit Dashboard JSON",k8s:this.dashboard?.meta.k8s})}saveDashboard(g,p){return(0,s.n)().saveDashboard({message:g.message,folderUid:g.folderUid,dashboard:g.dashboard.getSaveModelClone(),showErrorAlert:p?.showErrorAlert})}starDashboard(g,p){const c=(0,o.AI)(),y={showSuccessAlert:!1,url:"/api/user/stars/dashboard/uid/"+g,method:p?"DELETE":"POST"};return c.request(y).then(()=>{const P=!p;this.dashboard?.uid===g&&(this.dashboard.meta.isStarred=P);const d=P?(0,r.t)("notifications.starred-dashboard","Dashboard starred"):(0,r.t)("notifications.unstarred-dashboard","Dashboard unstarred");return n.l.emit(t.r1.alertSuccess,[d]),P})}}let h;function u(x){h=x}function i(){return h||(h=new f),h}},8735:(ee,B,e)=>{"use strict";e.d(B,{s:()=>f});var t=e(75505),n=e(81160),r=e(68143),o=e(43173),s=e(73427),m=e(85618);const a={create:h=>(0,r.AI)().post("/api/snapshots",h),getSnapshots:()=>(0,r.AI)().get("/api/dashboard/snapshots"),getSharingOptions:()=>(0,r.AI)().get("/api/snapshot/shared-options"),deleteSnapshot:h=>(0,r.AI)().delete("/api/snapshots/"+h),getSnapshot:async h=>{try{const u=await(0,r.AI)().get("/api/snapshots/"+h);return u.meta.canShare=!1,u}catch(u){throw u}}};class l{constructor(){this.apiVersion="dashboardsnapshot.grafana.app/v0alpha1",this.url=`/apis/${this.apiVersion}/namespaces/${(0,m.G)()}/dashboardsnapshots`}async create(u){return(0,r.AI)().post(this.url+"/create",u)}async getSnapshots(){return(await(0,r.AI)().get(this.url)).items.map(i=>({key:i.metadata.name,name:i.spec.title,external:i.spec.externalUrl!=null,externalUrl:i.spec.externalUrl}))}deleteSnapshot(u){return(0,r.AI)().delete(this.url+"/"+u)}async getSharingOptions(){return(0,r.AI)().get("/api/snapshot/shared-options")}async getSnapshot(u){const i={};if(!s.TP.isSignedIn){alert("TODO... need a barer token for anonymous use case");const x=`??? TODO, get anon token for snapshots (${s.TP.user?.name}) ???`;i.Authorization=`Bearer ${x}`}return(0,t.s)((0,r.AI)().fetch({url:this.url+"/"+u+"/body",method:"GET",headers:i}).pipe((0,n.T)(x=>({dashboard:x.data.dashboard,meta:{isSnapshot:!0,canSave:!1,canEdit:!1,
278canAdmin:!1,canStar:!1,canShare:!1,canDelete:!1,isFolder:!1,provisioned:!1}}))))}}function f(){return o.$.featureToggles.kubernetesSnapshots?new l:a}},75421:(ee,B,e)=>{"use strict";e.d(B,{jG:()=>b});var t=e(2543),n=e(25229),r=e(22592),o=e(17548),s=e(32899),m=e(33239),a=e(36490),l=e(56838),f=e(45229),h=e(65642),u=e(56840),i=e(15130),x=e(23237),g=e(90593),p=e(87745),c=e(90811);function y({urlRefresh:E,currentRefresh:v,isAllowedIntervalFn:C,minRefreshInterval:S,refreshIntervals:O=c.cb}){if(!E)return v;const I=C(E),R=O.find(T=>T===E);if(!I||!R){const T=S?O.find(K=>K===S):void 0,L=O?.length?O[0]:void 0;return T??L??v}return E||v}class P{constructor(v){this.contextSrv=v,this.timeRangeForUrl=()=>{const C=this.timeRange().raw;return(0,n.Ar)(C.from)&&(C.from=C.from.valueOf().toString()),(0,n.Ar)(C.to)&&(C.to=C.to.valueOf().toString()),C},this.time=(0,r.E2)().raw,this.timeAtLoad=(0,r.E2)().raw,this.refreshTimeModel=this.refreshTimeModel.bind(this),f.A.subscribe(p.U0,C=>{this.zoomOut(C.payload.scale,C.payload.updateUrl)}),f.A.subscribe(p.Io,C=>{this.shiftTime(C.payload.direction,C.payload.updateUrl)}),f.A.subscribe(p.Rh,C=>{this.makeAbsoluteTime(C.payload.updateUrl)}),f.A.subscribe(p.Bt,()=>{this.copyTimeRangeToClipboard()}),f.A.subscribe(p.VZ,C=>{this.pasteTimeRangeFromClipboard(C.payload.updateUrl)}),document.addEventListener("visibilitychange",()=>{this.autoRefreshBlocked&&document.visibilityState==="visible"&&(this.autoRefreshBlocked=!1,this.refreshTimeModel())})}init(v){this.timeModel=v,this.time=v.time,this.refresh=v.refresh,this.initTimeFromUrl(),this.parseTime(),this.timeAtLoad=(0,t.cloneDeep)(this.time),this.refresh&&this.setAutoRefresh(this.refresh)}getValidIntervals(v){return this.contextSrv.getValidIntervals(v)}parseTime(){(0,t.isString)(this.time.from)&&this.time.from.indexOf("Z")>=0&&(this.time.from=(0,n.KQ)(this.time.from).utc()),(0,t.isString)(this.time.to)&&this.time.to.indexOf("Z")>=0&&(this.time.to=(0,n.KQ)(this.time.to).utc())}parseUrlParam(v,C){if(v.indexOf("now")!==-1)return v;if(v.length===8){const S=(0,n.yT)(v,"YYYYMMDD");if(S.isValid())return S}else if(v.length===15){const S=(0,n.yT)(v,"YYYYMMDDTHHmmss");if(S.isValid())return S}if(!isNaN(Number(v))){const S=parseInt(v,10);return C?(0,n.oZ)(C,S):(0,n.yT)(S)}return null}getTimeWindow(v,C){const S=parseInt(v,10);let O;return C.match(/^\d+$/)&&parseInt(C,10)?O=parseInt(C,10):O=o.intervalToMs(C),{from:(0,n.yT)(S-O/2),to:(0,n.yT)(S+O/2)}}initTimeFromUrl(){if(h.$W.publicDashboardAccessToken&&this.timeModel?.timepicker?.hidden)return;const v=a.Ny.getSearch();v.get("time")&&v.get("time.window")&&(this.time=this.getTimeWindow(v.get("time"),v.get("time.window")));const C=this.timeModel?.getTimezone();v.get("from")&&(this.time.from=this.parseUrlParam(v.get("from"),C)||this.time.from),v.get("to")&&(this.time.to=this.parseUrlParam(v.get("to"),C)||this.time.to),v.get("to")&&v.get("to").indexOf("now")===-1&&(this.refresh=!1,this.timeModel&&(this.timeModel.refresh=void 0)),this.refresh=y({urlRefresh:v.get("refresh"),currentRefresh:this.refresh,refreshIntervals:Array.isArray(this.timeModel?.timepicker?.refresh_intervals)?this.timeModel?.timepicker?.refresh_intervals:void 0,isAllowedIntervalFn:this.contextSrv.isAllowedInterval,minRefreshInterval:h.$W.minRefreshInterval})}updateTimeRangeFromUrl(){const v=a.Ny.getSearch();if(v.get("left"))return;const C=this.timeRangeForUrl(),S=v.get("from"),O=v.get("to");S&&O?(S!==C.from||O!==C.to)&&(this.initTimeFromUrl(),this.setTime(this.time,!1)):this.timeHasChangedSinceLoad()&&this.setTime(this.timeAtLoad,!0)}timeHasChangedSinceLoad(){return this.timeAtLoad&&(this.timeAtLoad.from!==this.time.from||this.timeAtLoad.to!==this.time.to)}setAutoRefresh(v){this.timeModel&&(this.timeModel.refresh=v),this.stopAutoRefresh();const C=a.Ny.getSearchObject();if(!v){C.refresh&&a.Ny.partial({refresh:null},!0);return}let S=v,O=60*1e3;v===i.SM?O=this.getAutoRefreshInteval().intervalMs:(S=this.contextSrv.getValidInterval(v),O=o.intervalToMs(S)),this.refreshMS=O,this.refreshTimer=window.setTimeout(()=>{this.startNextRefreshTimer(O),this.refreshTimeModel()},O),C.refresh!==S&&a.Ny.partial({refresh:S},!0)}getAutoRefreshInteval(){const v=window?.innerWidth??2e3;return o.calculateInterval(this.timeRange(),v,h.$W.minRefreshInterval)}refreshTimeModel(){this.timeModel?.timeRangeUpdated(this.timeRange())}startNextRefreshTimer(v){this.refreshTimer=window.setTimeout(()=>{this.startNextRefreshTimer(v),this.contextSrv.isGrafanaVisible()?this.refreshTimeModel():this.autoRefreshBlocked=!0},v)}stopAutoRefresh(){clearTimeout(this.refreshTimer),this.refreshTimer=void 0,this.refreshMS=void 0}resumeAutoRefresh(){this.timeModel?.refresh&&this.setAutoRefresh(this.timeModel.refresh)}setTime(v,C=!0){if((0,t.extend)(this.time,v),(0,n.Ar)(v.to)?(this.oldRefresh=this.timeModel?.refresh||this.oldRefresh,this.setAutoRefresh("")):this.oldRefresh&&this.oldRefresh!==this.timeModel?.refresh&&(this.setAutoRefresh(this.oldRefresh),this.oldRefresh=void 0),C===!0){const S=this.timeRangeForUrl(),O=a.Ny.getSearchObject();if(O.from===S.from.toString()&&O.to===S.to.toString())return;O.from=S.from.toString(),O.to=S.to.toString(),a.Ny.partial(O)}this.timeModel?.refresh===i.SM&&this.getAutoRefreshInteval().intervalMs!==this.refreshMS&&this.setAutoRefresh(i.SM),this.refreshTimeModel()}timeRange(){return window.__grafanaSceneContext&&window.__grafanaSceneContext.
278isActive?l.jh.getTimeRange(window.__grafanaSceneContext).state.value:(0,g.z)(this.time,this.timeModel)}zoomOut(v,C=!0){const S=this.timeRange(),{from:O,to:I}=(0,x.Zk)(S,v);this.setTime({from:(0,n.yT)(O),to:(0,n.yT)(I)},C)}shiftTime(v,C=!0){const S=this.timeRange(),{from:O,to:I}=(0,x.Wb)(v,S);this.setTime({from:(0,n.yT)(O),to:(0,n.yT)(I)},C)}makeAbsoluteTime(v){const{from:C,to:S}=this.timeRange();this.setTime({from:C,to:S},v)}copyTimeRangeToClipboard(){const{raw:v}=this.timeRange();navigator.clipboard.writeText(JSON.stringify({from:v.from,to:v.to})),f.A.emit(s.r1.alertSuccess,[(0,u.t)("time-picker.copy-paste.copy-success-message","Time range copied to clipboard")])}async pasteTimeRangeFromClipboard(v=!0){const{range:C,isError:S}=await(0,x.zG)();if(S===!0){f.A.emit(s.r1.alertError,[(0,u.t)("time-picker.copy-paste.default-error-title","Invalid time range"),(0,u.t)("time-picker.copy-paste.default-error-message","{{error}} is not a valid time range",{error:C})]);return}const{from:O,to:I}=C;this.setTime({from:O,to:I},v)}isRefreshOutsideThreshold(v,C=.05){const S=this.timeRange();if(m.isMathString(S.raw.from)){const O=S.to.diff(S.from),I=Date.now()-v,R=O*C;return I>=R}return!1}}let d;function D(E){d=E}function b(){return d||(d=new P(i.TP)),d}},65635:(ee,B,e)=>{"use strict";e.d(B,{O2:()=>w,SW:()=>j,og:()=>_});var t=e(2543),n=e(53543),r=e(3594),o=e(7389),s=e(48480),m=e(5556),a=e(38036),l=e(18600),f=e(36394),h=e(57866),u=e(95004),i=e(79184),x=e(33023),g=e(78282),p=e(739),c=e(74198),y=e(83162),P=e(65642),d=e(95943);function D(X){return Array.from(new Array(X+1),(se,oe)=>oe).filter(se=>X%se===0)}var b=e(77197),E=e(28998),v=e(67933),C=e(78763),S=e(18615),O=e(71843),I=e(75663),R=e(39796),T=e(51515);function L(X,se){const oe=[];if(X?.statistics&&X?.statistics.length){X.statistic=X.statistics[0];for(const ae of X.statistics.splice(1))oe.push({...X,statistic:ae})}for(const ae of oe)ae.refId=(0,R.M)(se),delete ae.statistics,se.push(ae);return delete X.statistics,oe}function K(X){const se=[];if(X&&"statistics"in X&&X?.statistics?.length){for(const oe of X.statistics.splice(1)){const{statistics:ae,name:ie,...fe}=X;se.push({...fe,statistic:oe,name:`${ie} - ${oe}`})}X.statistic=X.statistics[0],se.length!==0&&(X.name=`${X.name} - ${X.statistic}`),delete X.statistics}return se}function A(X){X.hasOwnProperty("metricQueryType")||(X.metricQueryType=T.d$.Search),X.hasOwnProperty("metricEditorMode")||(X.metricQueryType===T.d$.Insights?X.metricEditorMode=T.Rx.Code:X.metricEditorMode=X.expression?T.Rx.Code:T.Rx.Builder)}var W=e(82612),N=e(56623);n.D.setInit(y.H),n.G.setInit(y.u);const w=41;class j{constructor(se){this.dashboard=se,(0,g.l)()||(0,g.h)(new E.xq)}updateSchema(se){let oe,ae,ie,fe;const pe=this.dashboard.schemaVersion,de=[];if(this.dashboard.schemaVersion=w,pe!==this.dashboard.schemaVersion){if(pe<2&&(se.services&&se.services.filter&&(this.dashboard.time=se.services.filter.time,this.dashboard.templating.list=se.services.filter.list||[]),de.push(le=>(le.type==="graphite"&&(le.type="graph"),le.type!=="graph"||((0,t.isBoolean)(le.legend)&&(le.legend={show:le.legend}),le.grid&&(le.grid.min&&(le.grid.leftMin=le.grid.min,delete le.grid.min),le.grid.max&&(le.grid.leftMax=le.grid.max,delete le.grid.max)),le.y_format&&(le.y_formats||(le.y_formats=[]),le.y_formats[0]=le.y_format,delete le.y_format),le.y2_format&&(le.y_formats||(le.y_formats=[]),le.y_formats[1]=le.y2_format,delete le.y2_format)),le))),pe<3){let le=this.dashboard.getNextPanelId();de.push(me=>(me.id||(me.id=le,le+=1),me))}if(pe<4&&de.push(le=>(le.type!=="graph"||((0,t.each)(le.aliasYAxis,(me,De)=>{le.seriesOverrides=[{alias:De,yaxis:me}]}),delete le.aliasYAxis),le)),pe<6){const le=(0,t.find)(se.pulldowns,{type:"annotations"});for(le&&(this.dashboard.annotations={list:le.annotations||[]}),oe=0;oe<this.dashboard.templating.list.length;oe++){const me=this.dashboard.templating.list[oe];me.datasource===void 0&&(me.datasource=null),me.type==="filter"&&(me.type="query"),me.type===void 0&&(me.type="query"),me.allFormat===void 0&&delete me.allFormat}}if(pe<7&&(se.nav&&se.nav.length&&(this.dashboard.timepicker=se.nav[0]),de.push(le=>((0,t.each)(le.targets,me=>{me.refId||(me.refId=le.getNextQueryLetter&&le.getNextQueryLetter())}),le))),pe<8&&de.push(le=>((0,t.each)(le.targets,me=>{me.fields&&me.tags&&me.groupBy&&(me.rawQuery?(delete me.fields,delete me.fill):(me.select=(0,t.map)(me.fields,De=>{const Te=[];return Te.push({type:"field",params:[De.name]}),Te.push({type:De.func,params:[]}),De.mathExpr&&Te.push({type:"math",params:[De.mathExpr]}),De.asExpr&&Te.push({type:"alias",params:[De.asExpr]}),Te}),delete me.fields,(0,t.each)(me.groupBy,De=>{De.type==="time"&&De.interval&&(De.params=[De.interval],delete De.interval),De.type==="tag"&&De.key&&(De.params=[De.key],delete De.key)}),me.fill&&(me.groupBy.push({type:"fill",params:[me.fill]}),delete me.fill)))}),le)),pe<9&&de.push(le=>{if(le.type!=="singlestat"&&le.thresholds!=="")return le;if(le.thresholds){const me=le.thresholds.split(",");me.length>=3&&(me.shift(),le.thresholds=me.join(","))}return le}),pe<10&&de.push(le=>(le.type!=="table"||(0,t.each)(le.styles,me=>{if(me.thresholds&&me.thresholds.length>=3){const De=me.thresholds;De.shift(),me.thresholds=De}}),le)),pe<12&&(0,t.each)(this.dashboard.getVariables(),le=>{"refresh"in le&&(le.refresh&&(le.refresh=1),le.refresh||(le.refresh=0)),"hideVariable"in le&&le.hideVariable?le.hide=2:"hideLabel"in le&&le.hideLabel&&(le.hide=1)}),pe<12&&de.push(le=>(le.type!=="graph"||!le.grid||le.yaxes||(le.yaxes=[{show:le["y-axis"],min:le.grid.leftMin,max:le.grid.leftMax,logBase:le.grid.leftLogBase,format:le.y_formats[0],label:le.leftYAxisLabel},{show:le["y-axis"],min:le.grid.rightMin,max:le.grid.rightMax,logBase:le.grid.rightLogBase,format:le.y_formats[1],label:le.rightYAxisLabel}],le.xaxis={show:le["x-axis"]},delete le.grid.leftMin,delete le.grid.leftMax,delete le.grid.leftLogBase,delete le.grid.rightMin,delete le.grid.rightMax,delete le.grid.rightLogBase,delete le.y_formats,delete le.leftYAxisLabel,delete le.rightYAxisLabel,delete le["y-axis"],delete le["x-axis"]),le)),pe<13&&de.push(le=>{if(le.type!=="graph"||!le.grid)return le;le.thresholds||(le.thresholds=[]);const me={},De={};return le.grid.threshold1!==null&&(me.value=le.grid.threshold1,le.grid.thresholdLine?(me.line=!0,me.lineColor=le.grid.threshold1Color,me.colorMode="custom"):(me.fill=!0,me.fillColor=le.grid.threshold1Color,me.colorMode="custom")),le.grid.threshold2!==null&&(De.value=le.grid.threshold2,le.grid.thresholdLine?(De.line=!0,De.lineColor=le.grid.threshold2Color,De.colorMode="custom"):(De.fill=!0,De.fillColor=le.grid.threshold2Color,De.colorMode="custom")),(0,t.isNumber)(me.value)&&((0,t.isNumber)(De.value)?me.value>De.value?(me.op=De.op="lt",le.thresholds.push(me),le.thresholds.push(De)):(me.op=De.op="gt",le.thresholds.push(me),le.thresholds.push(De)):(me.op="gt",le.thresholds.push(me))),delete le.grid.threshold1,delete le.grid.threshold1Color,delete le.grid.threshold2,delete le.grid.threshold2Color,delete le.grid.thresholdLine,le}),pe<14&&(this.dashboard.graphTooltip=se.sharedCrosshair?1:0),pe<16&&this.upgradeToGridLayout(se),pe<17&&de.push(le=>{if(le.minSpan){const me=d.cV/le.minSpan,De=D(d.cV);le.maxPerRow=De[(0,t.findIndex)(De,Te=>Te>me)-1]}return delete le.minSpan,le}),pe<18&&de.push(le=>(le["options-gauge"]&&(le.options=le["options-gauge"],le.options.valueOptions={unit:le.options.unit,stat:le.options.stat,decimals:le.options.decimals,prefix:le.options.prefix,suffix:le.options.suffix}
278,le.options.thresholds&&le.options.thresholds.reverse(),delete le.options.options,delete le.options.unit,delete le.options.stat,delete le.options.decimals,delete le.options.prefix,delete le.options.suffix,delete le["options-gauge"]),le)),pe<19&&de.push(le=>(le.links&&(0,t.isArray)(le.links)&&(le.links=le.links.map(F)),le)),pe<20){const le=me=>({...me,url:M(me.url)});de.push(me=>(me.options&&me.options.dataLinks&&(0,t.isArray)(me.options.dataLinks)&&(me.options.dataLinks=me.options.dataLinks.map(le)),me.options&&me.options.fieldOptions&&me.options.fieldOptions.defaults&&(me.options.fieldOptions.defaults.links&&(0,t.isArray)(me.options.fieldOptions.defaults.links)&&(me.options.fieldOptions.defaults.links=me.options.fieldOptions.defaults.links.map(le)),me.options.fieldOptions.defaults.title&&(me.options.fieldOptions.defaults.title=M(me.options.fieldOptions.defaults.title))),me))}if(pe<21){const le=me=>({...me,url:me.url.replace(/__series.labels/g,"__field.labels")});de.push(me=>(me.options&&me.options.dataLinks&&(0,t.isArray)(me.options.dataLinks)&&(me.options.dataLinks=me.options.dataLinks.map(le)),me.options&&me.options.fieldOptions&&me.options.fieldOptions.defaults&&me.options.fieldOptions.defaults.links&&(0,t.isArray)(me.options.fieldOptions.defaults.links)&&(me.options.fieldOptions.defaults.links=me.options.fieldOptions.defaults.links.map(le)),me))}if(pe<22&&de.push(le=>(le.type!=="table"||(0,t.each)(le.styles,me=>{me.align="auto"}),le)),pe<23)for(const le of this.dashboard.templating.list){if(!(0,v.iv)(le))continue;const{multi:me,current:De}=le;(0,r.R)(De)||(le.current=(0,C.C)(De,me))}if(pe<24&&de.push(le=>{const me=le.type==="table";if(me&&!le.styles)return le;const De=le.table==="table2";if(!me||De)return le;if(le.type=me?"table-old":"table",le.type==="table-old"){const Te=(0,N.p)(le);Te&&(le.autoMigrateFrom=le.type,le.type=Te)}return le}),pe<25,pe<26&&de.push(le=>(le.type==="text2"&&(le.type="text",delete le.options.angular),le)),pe<27&&(this.removeRepeatedPanels(),this.dashboard.templating.list=this.dashboard.templating.list.map(le=>{if(!(0,v.VO)(le))return le;const me={...le};return me.current={selected:!0,text:me.query??"",value:me.query??""},me.options=[me.current],me.hide===o.zL.dontHide||me.hide===o.zL.hideLabel?{...me,type:"textbox"}:me})),pe<28){de.push(le=>le.type==="singlestat"?H(le):le);for(const le of this.dashboard.templating.list)le.tags&&delete le.tags,le.tagsQuery&&delete le.tagsQuery,le.tagValuesQuery&&delete le.tagValuesQuery,le.useTags&&delete le.useTags}if(pe<29)for(const le of this.dashboard.templating.list)le.type==="query"&&(le.refresh!==1&&le.refresh!==2&&(le.refresh=1),le.options?.length&&(le.options=[]));if(pe<30&&(de.push(ne),de.push(J)),pe<31&&de.push(le=>{if(le.transformations){for(const me of le.transformations)if(me.id===i.V.id)return Z(le,i.V.id,{id:x.o.id,options:{}})}return le}),pe<32,pe<33&&de.push(le=>{if(le.datasource=_(le.datasource,{returnDefaultAsNull:!0}),!le.targets)return le;for(const me of le.targets){const De=_(me.datasource,{returnDefaultAsNull:!0});De!=null&&(me.datasource=De)}return le}),pe<34&&(de.push(le=>(this.migrateCloudWatchQueries(le),le)),this.migrateCloudWatchAnnotationQuery()),pe<35&&de.push(q),pe<36){for(const me of this.dashboard.annotations.list)me.datasource=_(me.datasource,{returnDefaultAsNull:!1});const le=(0,g.l)().getInstanceSettings(null);if(le){for(const me of this.dashboard.templating.list)me.type==="query"&&me.datasource===null&&(me.datasource=(0,s.p$)(le));de.push(me=>{if(me.targets){let De=!1;me.datasource==null&&me.targets.length>0&&(me.datasource=(0,s.p$)(le),De=!0);for(const Te of me.targets)(Te.datasource==null||Te.datasource.uid==null)&&(me.datasource?.uid!==S.uv?Te.datasource={...me.datasource}:Te.datasource=_(Te.datasource,{returnDefaultAsNull:!1})),De&&Te.datasource?.uid!=="__expr__"&&(me.datasource=Te.datasource)}return me})}}if(pe<37&&de.push(le=>(le.options?.legend&&(le.options.legend.displayMode==="hidden"||le.options.legend.showLegend===!1)?(le.options.legend.displayMode="list",le.options.legend.showLegend=!1):le.options?.legend&&(le.options.legend={...le.options?.legend,showLegend:!0}),le)),pe<38&&de.push(le=>{if(le.type==="table"&&le.fieldConfig!==void 0){const me=le.fieldConfig.defaults?.custom?.displayMode;if(me!==void 0&&(le.fieldConfig.defaults.custom.cellOptions=(0,c.o7)(me),delete le.fieldConfig.defaults.custom.displayMode),le.fieldConfig?.overrides)for(const De of le.fieldConfig.overrides)for(let Te=0;Te<(De.properties?.length||0);Te++){let Ne=De.properties[Te].value;De.properties[Te].id==="custom.displayMode"&&(De.properties[Te].id="custom.cellOptions",De.properties[Te].value=(0,c.o7)(Ne))}}return le}),pe<39&&de.push(le=>(le.transformations?.forEach(me=>
278{if(me.id==="timeSeriesTable"&&me.options!==void 0&&me.options.refIdToStat!==void 0){let De={};for(const[Te,Ne]of Object.entries(me.options.refIdToStat)){let Ce={};Ce.stat=Ne,De[Te]=Ce}me.options=De}}),le)),pe<40&&typeof this.dashboard.refresh!="string"&&(this.dashboard.refresh=""),pe<41&&"time_options"in this.dashboard.timepicker&&delete this.dashboard.timepicker.time_options,de.length!==0)for(ae=0;ae<this.dashboard.panels.length;ae++)for(ie=0;ie<de.length;ie++){this.dashboard.panels[ae]=de[ie].call(this,this.dashboard.panels[ae]);const le=this.dashboard.panels[ae].panels;if(le)for(fe=0;fe<le.length;fe++)le[fe]=de[ie].call(this,le[fe])}}}removeRepeatedPanels(){const se=[];for(const oe of this.dashboard.panels)oe.repeatPanelId||oe.repeatByRow||(oe.type==="row"&&Array.isArray(oe.panels)&&(oe.panels=oe.panels.filter(ae=>!ae.repeatPanelId)),se.push(oe));this.dashboard.panels=se}migrateCloudWatchQueries(se){for(const oe of se.targets||[])if(te(oe)&&(A(oe),oe.hasOwnProperty("statistics"))){const ae=L(oe,[...se.targets]);for(const ie of ae)se.targets.push(ie)}}migrateCloudWatchAnnotationQuery(){for(const se of this.dashboard.annotations.list)if(Y(se)){const oe=K(se);for(const ae of oe)this.dashboard.annotations.list.push(ae)}}upgradeToGridLayout(se){let oe=0;const ae=d.cV/12;let fe=(0,t.max)((0,t.flattenDeep)((0,t.map)(se.rows,de=>(0,t.map)(de.panels,"id"))))+1;if(!se.rows)return;const pe=(0,t.some)(se.rows,de=>de.collapse||de.showTitle||de.repeat);for(const de of se.rows){if(de.repeatIteration)continue;const le=de.height||d.bJ,me=V(le),De={};let Te;pe&&(De.id=fe,De.type="row",De.title=de.title,De.collapsed=de.collapse,De.repeat=de.repeat,De.panels=[],De.gridPos={x:0,y:oe,w:d.cV,h:me},Te=new W.a9(De),fe++,oe++);const Ne=new U(me,d.cV,oe);for(const Ce of de.panels){Ce.span=Ce.span||d.o9,Ce.minSpan&&(Ce.minSpan=Math.min(d.cV,d.cV/12*Ce.minSpan));const He=Math.floor(Ce.span)*ae,ke=Ce.height?V(Ce.height):me,Me=Ne.getPanelPosition(ke,He);oe=Ne.yPos,Ce.gridPos={x:Me.x,y:oe+Me.y,w:He,h:ke},Ne.addPanel(Ce.gridPos),delete Ce.span,Te&&De.collapsed?Te.panels?.push(Ce):this.dashboard.panels.push(new W.a9(Ce))}Te&&this.dashboard.panels.push(Te),Te&&De.collapsed||(oe+=me)}}}function V(X){return(0,t.isString)(X)&&(X=parseInt(X.replace("px",""),10)),X<d.cx&&(X=d.cx),Math.ceil(X/(d.sD+d.dU))}class U{constructor(se,oe=d.cV,ae=0){this.area=new Array(oe).fill(0),this.yPos=ae,this.height=se}reset(){this.area.fill(0)}addPanel(se){for(let oe=se.x;oe<se.x+se.w;oe++)(!this.area[oe]||se.y+se.h-this.yPos>this.area[oe])&&(this.area[oe]=se.y+se.h-this.yPos);return this.area}getPanelPosition(se,oe,ae=!1){let ie,fe,pe;for(let de=this.area.length-1;de>=0&&this.height-this.area[de]>0;de--)if(fe===void 0)fe=de;else if(de<this.area.length-1&&this.area[de]<=this.area[de+1])ie=de;else break;if(ie!==void 0&&fe!==void 0&&fe-ie>=oe-1){const de=(0,t.max)(this.area.slice(ie));pe={x:ie,y:de}}else return ae?null:(this.yPos+=this.height,this.reset(),this.getPanelPosition(se,oe,!0));return pe}}function F(X){let se=X.url;return!se&&X.dashboard&&(se=`dashboard/db/${b.A.slugifyForUrl(X.dashboard)}`),!se&&X.dashUri&&(se=`dashboard/${X.dashUri}`),se||(se="/"),X.keepTime&&(se=m.kM.appendQueryToUrl(se,`$${a.c.keepTime}`)),X.includeVars&&(se=m.kM.appendQueryToUrl(se,`$${a.c.includeVars}`)),X.params&&(se=m.kM.appendQueryToUrl(se,X.params)),{url:se,title:X.title,targetBlank:X.targetBlank}}function M(X){const se=/(__series_name)|(\$__series_name)|(__value_time)|(__field_name)|(\$__field_name)/g;return X.replace(se,(oe,ae,ie,fe,pe,de)=>ae?"__series.name":ie?"${__series.name}":fe?"__value.time":pe?"__field.name":de?"${__field.name}":oe)}function H(X){if(P.$W.panels["grafana-singlestat-panel"])return X.type="grafana-singlestat-panel",X;let se=!1;return X.changePlugin||(se=!0,X=new W.a9(X)),X.plugin={angularPanelCtrl:{}},X.gauge?.show?(O.plugin.meta=P.$W.panels.gauge,X.changePlugin(O.plugin)):(I.plugin.meta=P.$W.panels.stat,X.changePlugin(I.plugin)),se?X.getSaveModel():X}function _(X,se){if(se.returnDefaultAsNull&&(X==null||X==="default"))return null;if((0,s.fN)(X))return X;const oe=(0,g.l)().getInstanceSettings(X);return oe?(0,s.p$)(oe):{uid:X||void 0}}function Z(X,se,oe){if(X.transformations){const ae=[];for(const ie of X.transformations)ae.push(ie),ie.id===se&&ae.push({...oe});X.transformations=ae}return X}function ne(X){const se=X.fieldConfig;if(!se)return X;if(se.defaults&&se.defaults.mappings&&(se.defaults.mappings=Q(se.defaults.mappings,se.defaults.thresholds)),Array.isArray(se.overrides))for(const oe of se.overrides)for(const ae of oe.properties)ae.id==="mappings"&&(ae.value=Q(ae.value));return X}function te(X){return X.hasOwnProperty("dimensions")&&X.hasOwnProperty("namespace")&&X.hasOwnProperty("region")&&X.hasOwnProperty("metricName")}function Y(X){return X.hasOwnProperty("dimensions")&&X.hasOwnProperty("namespace")&&X.hasOwnProperty("region")&&X.hasOwnProperty("prefixMatching")&&
278X.hasOwnProperty("statistics")}function Q(X,se){if(!X)return;const oe={type:l.d.ValueToText,options:{}},ae=[];for(const ie of X){if(ie.type&&ie.options){ie.type===l.d.ValueToText?oe.options={...oe.options,...ie.options}:ae.push(ie);continue}let fe;const pe=parseFloat(ie.text);if(se&&!isNaN(pe)){const de=(0,f.yQ)(pe,se.steps);de&&de.color&&(fe=de.color)}switch(ie.type){case 1:ie.value!=null&&(ie.value==="null"?ae.push({type:l.d.SpecialValue,options:{match:l.W.Null,result:{text:ie.text,color:fe}}}):oe.options[String(ie.value)]={text:ie.text,color:fe});break;case 2:ae.push({type:l.d.RangeToText,options:{from:+ie.from,to:+ie.to,result:{text:ie.text,color:fe}}});break}}return Object.keys(oe.options).length>0&&ae.unshift(oe),ae}function J(X){return(X.type==="timeseries"||X.type==="xychart"||X.type==="xychart2")&&X.options.tooltipOptions&&(X.options={...X.options,tooltip:X.options.tooltipOptions},delete X.options.tooltipOptions),X}function q(X){return X.type==="timeseries"&&X.fieldConfig?.defaults.custom?.axisPlacement===p.vM.Hidden&&(X.fieldConfig={...X.fieldConfig,overrides:[...X.fieldConfig.overrides,{matcher:{id:h.Ct.byType,options:u.PU.time},properties:[{id:"custom.axisPlacement",value:p.vM.Auto}]}]}),X}},7817:(ee,B,e)=>{"use strict";e.d(B,{G:()=>L});var t=e(2543),n=e(64423),r=e(19379),o=e(80011),s=e(25229),m=e(75234),a=e(43173),l=e(8255),f=e(95943),h=e(15130),u=e(10605),i=e(54742),x=e(39167),g=e(93612),p=e(96673),c=e(87745),y=e(73427),P=e(8535),d=e(88813),D=e(99305),b=e(75421),E=e(82612);const v=new Set(["gridPos","title","description","transparent"]);function C(W,N){const w=[],j={changed:!1,actions:{add:[],remove:[],replace:[],update:[],noop:[]},panels:w};let V=0;const U=new Map;for(let F of N){let{id:M}=F;M||(V||(V=O([W,N])),M=V++,F={...F,id:M}),U.set(M,F)}for(const F of W){const M=U.get(F.id);if(!M){j.changed=!0,j.actions.remove.push(F.id),F.destroy();continue}if(U.delete(F.id),M===F){w.push(F),j.actions.noop.push(F.id);continue}if(F.type===M.type){const _=F.getSaveModel();let Z=!0,ne=!1;for(const[te,Y]of Object.entries(M))if(!(0,t.isEqualWith)(Y,_[te],S))if(j.changed=!0,Z=!1,v.has(te))F[te]=Y,ne=!0;else{ne=!1;break}if(Z){w.push(F),j.actions.noop.push(F.id);continue}if(ne){w.push(F),j.actions.update.push(F.id);continue}}F.destroy();const H=new E.a9(M);H.key=`${H.id}-update-${Date.now()}`,w.push(H),j.changed=!0,j.actions.replace.push(F.id)}for(const F of U.values())w.push(new E.a9(F)),j.changed=!0,j.actions.add.push(F.id);return j}function S(W,N){if(W==null&&(N===1/0||N===-1/0||N==null)||N==null&&(W===1/0||W===-1/0||W==null))return!0}function O(W){let N=0;for(const w of W)for(const j of w)j.id>N&&(N=j.id);return N+1}var I=e(65635);function R(W,N){return W.repeatDirection===f.HG?!1:N.gridPos.x>=W.gridPos.x+W.gridPos.w&&N.gridPos.y===W.gridPos.y}function T(W){for(const N of W)if(delete N.scopedVars,N.panels?.length)for(const w of N.panels)delete w.scopedVars}class L{constructor(N,w,j){this.timeRangeUpdatedDuringEditOrView=!1,this.originalDashboard=null,this.getVariablesFromState=j?.getVariablesFromState??g.SS,this.events=new r.o,this.id=N.id||null,this.uid=N.uid||w?.uid||null,this.revision=N.revision??void 0,this.title=N.title??"No Title",this.description=N.description,this.tags=N.tags??[],this.timezone=N.timezone??"",this.weekStart=N.weekStart??"",this.editable=N.editable!==!1,this.graphTooltip=N.graphTooltip||0,this.time=N.time??{from:"now-6h",to:"now"},this.timepicker=N.timepicker??{},this.liveNow=N.liveNow,this.templating=this.removeNullValuesFromVariables(this.ensureListExist(N.templating)),this.annotations=this.ensureListExist(N.annotations),this.refresh=N.refresh,this.snapshot=N.snapshot,this.schemaVersion=N.schemaVersion??0,this.fiscalYearStartMonth=N.fiscalYearStartMonth??0,this.version=N.version??0,this.links=N.links??[],this.gnetId=N.gnetId||null,this.panels=(0,t.map)(N.panels??[],V=>new E.a9(V)),this.scopeMeta=N.scopeMeta,this.originalDashboard=(0,t.cloneDeep)(N),this.originalTemplating=(0,t.cloneDeep)(this.templating),this.originalTime=(0,t.cloneDeep)(this.time),this.ensurePanelsHaveUniqueIds(),this.formatDate=this.formatDate.bind(this),this.initMeta(w),this.updateSchema(N),this.addBuiltInAnnotationQuery(),this.sortPanelsByGridPos(),this.panelsAffectedByVariableChange=null,this.appEventsSubscription=new n.yU,this.lastRefresh=Date.now(),this.appEventsSubscription.add(y.lE.subscribe(d.og,this.variablesChangedH
278andler.bind(this))),this.appEventsSubscription.add(y.lE.subscribe(d.BS,this.variablesTimeRangeProcessDoneHandler.bind(this))),this.appEventsSubscription.add(y.lE.subscribe(d.eF,this.variablesChangedInUrlHandler.bind(this)))}static{this.nonPersistedProperties={events:!0,meta:!0,panels:!0,templating:!0,originalTime:!0,originalTemplating:!0,originalLibraryPanels:!0,panelInEdit:!0,panelInView:!0,getVariablesFromState:!0,formatDate:!0,appEventsSubscription:!0,panelsAffectedByVariableChange:!0,lastRefresh:!0,timeRangeUpdatedDuringEditOrView:!0,originalDashboard:!0}}addBuiltInAnnotationQuery(){this.annotations.list.some(w=>w.builtIn===1)||this.annotations.list.unshift({datasource:{uid:"-- Grafana --",type:"grafana"},name:"Annotations & Alerts",type:"dashboard",iconColor:l.Mk,enable:!0,hide:!0,builtIn:1})}initMeta(N){N=N||{},N.canShare=N.canShare!==!1,N.canSave=N.canSave!==!1,N.canStar=N.canStar!==!1,N.canEdit=N.canEdit!==!1,N.canDelete=N.canDelete!==!1,N.showSettings=N.canEdit,N.canMakeEditable=N.canSave&&!this.editable,N.hasUnsavedFolderChange=!1,this.editable||(N.canEdit=!1,N.canDelete=!1,N.canSave=!1),this.meta=N}getSaveModelCloneOld(N){const w=(0,t.defaults)(N||{},{saveVariables:!0,saveTimerange:!0});let j={};for(const V in this)L.nonPersistedProperties[V]||!this.hasOwnProperty(V)||(j[V]=(0,t.cloneDeep)(this[V]));return j.templating=this.getTemplatingSaveModel(w),w.saveTimerange||(j.time=this.originalTime),j.panels=this.getPanelSaveModels(),j=(0,u.v)(j),j.getVariables=()=>j.templating.list,j}getSaveModelClone(N){const w=this.getSaveModelCloneOld(N),j=JSON.stringify(w);return JSON.parse(j)}updatePanels(N){const w=C(this.panels,N??[]);return w.changed&&(this.panels=w.panels??[],this.sortPanelsByGridPos(),this.events.publish(new c.Q$)),w}getPanelSaveModels(){return this.panels.filter(N=>this.isSnapshotTruthy()||!(N.repeatPanelId||N.repeatedByRow)).map(N=>{if(N.libraryPanel){const{id:w,title:j,libraryPanel:V,gridPos:U}=N;return{id:w,title:j,gridPos:U,libraryPanel:{uid:V.uid,name:V.name}}}return this.panelInEdit&&this.panelInEdit.id===N.id?this.panelInEdit.getSaveModel():N.getSaveModel()}).map(N=>(this.isSnapshotTruthy()||(delete N.scopedVars,N.type==="row"&&N.panels&&N.panels.length>0&&(N.panels=N.panels.filter(w=>!w.repeatPanelId).map(w=>(delete w.scopedVars,w)))),N))}getTemplatingSaveModel(N){const w=this.originalTemplating?.list??[],V=this.getVariablesFromState(this.uid).map(F=>{const M=i.B.get(F.type).getSaveModel(F,N.saveVariables);if(!N.saveVariables){const H=w.find(({name:_,type:Z})=>_===F.name&&Z===F.type);if(!H)return M;F.type==="adhoc"?M.filters=H.filters:(M.current=H.current,M.options=H.options)}return M});return{list:(0,u.v)(V)}}timeRangeUpdated(N){this.events.publish(new m.sR(N)),(0,P.JD)((0,x.RK)(this.uid,N)),(this.panelInEdit||this.panelInView)&&(this.timeRangeUpdatedDuringEditOrView=!0)}startRefresh(N={refreshAll:!0,panelIds:[]}){if(this.events.publish(new m._),this.lastRefresh=Date.now(),this.panelInEdit&&(N.refreshAll||N.panelIds.includes(this.panelInEdit.id))){this.panelInEdit.refresh();return}const w=this.panels.filter(j=>!this.otherPanelInFullscreen(j)&&(N.refreshAll||N.panelIds.includes(j.id)));if(!this.isSnapshot())for(const j of w)j.refreshWhenInView=!0;for(const j of w)j.refresh()}render(){this.events.publish(new c.XM);for(const N of this.panels)N.render()}panelInitialized(N){const w=N.getQueryRunner().getLastResult();!this.otherPanelInFullscreen(N)&&!w&&N.refresh()}otherPanelInFullscreen(N){return(this.panelInEdit||this.panelInView)&&!(N.isViewing||N.isEditing)}initEditPanel(N){return(0,b.jG)().stopAutoRefresh(),this.panelInEdit=N.getEditClone(),this.timeRangeUpdatedDuringEditOrView=!1,this.panelInEdit}exitPanelEditor(){this.panelInEdit.destroy(),this.panelInEdit=void 0,(0,b.jG)().resumeAutoRefresh(),this.refreshIfPanelsAffectedByVariableChangeOrTimeRangeChanged()}initViewPanel(N){this.panelInView=N,this.timeRangeUpdatedDuringEditOrView=!1,N.setIsViewing(!0)}exitViewPanel(N){this.panelInView=void 0,N.setIsViewing(!1),this.refreshIfPanelsAffectedByVariableChangeOrTimeRangeChanged()}refreshIfPanelsAffectedByVariableChangeOrTimeRangeChanged(){(this.panelsAffectedByVariableChange||this.timeRangeUpdatedDuringEditOrView)&&
278(this.startRefresh({panelIds:this.panelsAffectedByVariableChange??[],refreshAll:this.timeRangeUpdatedDuringEditOrView}),this.panelsAffectedByVariableChange=null,this.timeRangeUpdatedDuringEditOrView=!1)}ensurePanelsHaveUniqueIds(){const N=new Set;let w=this.getNextPanelId();for(const j of this.panelIterator())(!j.id||N.has(j.id))&&(j.id=w++),N.add(j.id)}removeNullValuesFromVariables(N){if(!N.list.length)return N;for(const w of N.list)w.current&&(w.current.value===null||Array.isArray(w.current.value)&&w.current.value.includes(null))&&(w.current=void 0);return N}ensureListExist(N={}){return N.list??=[],N}getNextPanelId(){let N=0;for(const w of this.panelIterator())w.id>N&&(N=w.id);return N+1}*panelIterator(){for(const N of this.panels){yield N;const w=N.panels??[];for(const j of w)yield j}}forEachPanel(N){for(let w=0;w<this.panels.length;w++)N(this.panels[w],w)}getPanelById(N,w=!1){if(this.panelInEdit&&this.panelInEdit.id===N)return this.panelInEdit;if(w){for(const j of this.panelIterator())if(j.id===N)return j;return null}else return this.panels.find(j=>j.id===N)??null}canEditPanel(N){return!!(this.meta.canEdit&&N&&!N.repeatPanelId&&N.type!=="row")}canEditPanelById(N){return this.canEditPanel(this.getPanelById(N))}addPanel(N){N.id=this.getNextPanelId(),this.panels.unshift(new E.a9(N)),this.sortPanelsByGridPos(),this.events.publish(new c.Q$)}updateMeta(N){this.meta={...this.meta,...N},this.events.publish(new c.Cf)}makeEditable(){this.editable=!0,this.updateMeta({canMakeEditable:!1,canEdit:!0,canSave:!0})}sortPanelsByGridPos(){this.panels.sort((N,w)=>N.gridPos.y===w.gridPos.y?N.gridPos.x-w.gridPos.x:N.gridPos.y-w.gridPos.y)}clearUnsavedChanges(N,w){for(const j of this.panels)j.configRev=0;this.panelInEdit&&(this.panelInEdit.hasSavedPanelEditChange=this.panelInEdit.configRev>0,this.panelInEdit.configRev=0),this.originalDashboard=N,this.originalTemplating=N.templating,w.saveTimerange&&(this.originalTime=N.time)}hasUnsavedChanges(){return!!this.panels.find(w=>w.hasChanged)}cleanUpRepeats(){if(this.isSnapshotTruthy()||!this.hasVariables())return;T(this.panels);const N=this.panels.filter(w=>(!w.repeat||w.repeatedByRow)&&w.repeatPanelId);(0,t.pull)(this.panels,...N),N.map(w=>w.destroy()),this.sortPanelsByGridPos()}processRepeats(){if(!(this.isSnapshotTruthy()||!this.hasVariables()||this.panelInView)){this.cleanUpRepeats();for(let N=0;N<this.panels.length;N++){const w=this.panels[N];w.repeat&&this.repeatPanel(w,N)}this.sortPanelsByGridPos(),this.events.publish(new c.Q$)}}cleanUpRowRepeats(N){const w=N.map(V=>V.id),j=N.filter(V=>!V.repeat&&V.repeatPanelId&&w.includes(V.repeatPanelId));(0,t.pull)(N,...j),(0,t.pull)(this.panels,...j)}processRowRepeats(N){if(this.isSnapshotTruthy()||!this.hasVariables())return;let w=N.panels??[];if(!N.collapsed){const j=this.panels.findIndex(V=>V.id===N.id);w=this.getRowPanels(j)}this.cleanUpRowRepeats(w);for(const j of w)if(j.repeat){const V=this.panels.findIndex(U=>U.id===j.id);this.repeatPanel(j,V)}}getPanelRepeatClone(N,w,j){if(w===0)return N;const V=N.getSaveModel();V.id=this.getNextPanelId();const U=new E.a9(V);return this.panels.splice(j+w,0,U),U.repeatPanelId=N.id,U.repeat=void 0,this.panelInView?.id===U.id&&(U.setIsViewing(!0),this.panelInView=U),U}getRowRepeatClone(N,w,j){if(w===0){if(!N.collapsed){const M=this.getRowPanels(j);N.panels=M}return N}const V=new E.a9(N.getSaveModel());let U,F;return N.collapsed?(U=(0,t.cloneDeep)(N.panels)??[],V.panels=U,F=j+w):(U=this.getRowPanels(j),V.panels=U.map(M=>M.getSaveModel()),F=j+(U.length+1)*w),this.panels.splice(F,0,V),this.updateRepeatedPanelIds(V),V}repeatPanel(N,w){const j=this.getPanelRepeatVariable(N);if(!j)return;if(N.type==="row"){this.repeatRow(N,w,j);return}const V=this.getSelectedVariableOptions(j),U=N.maxPerRow||4;let F=0,M=N.gridPos.y;for(let _=0;_<V.length;_++){const Z=V[_];let ne;ne=this.getPanelRepeatClone(N,_,w),ne.scopedVars??={},ne.scopedVars[j.name]=Z,N.repeatDirection===f.Pz?(_>0&&(M+=ne.gridPos.h),ne.gridPos.y=M):(ne.gridPos.w=Math.max(f.cV/V.length,f.cV/U),ne.gridPos.x=F,ne.gridPos.y=M,F+=ne.gridPos.w,F+ne.gridPos.w>f.cV&&(F=0,M+=ne.gridPos.h))}const H=M-N.gridPos.y;if(H>0){const _=w+V.length;for(const Z of this.panels.slice(_))R(N,Z)||(Z.gridPos.y+=H)}}repeatRow(N,w,j){const V=this.getSelectedVariableOptions(j);for(let U=0;U<V.length;U++){const F=V[U],M=this.getRowRepeatClone(N,U,w);A(M,j,F);const H=this.getRowHeight(M),_=M.panels||[];let Z;if(N.collapsed){for(const ne of _)A(ne,j,F),U>0&&this.updateRepeatedPanelIds(ne,!0);M.gridPos.y+=U,Z=w+U+1}else{const ne=w+(_.length+1)*U+1;_.forEach((te,Y)=>{if(A(te,j,F),U>0){const Q=new E.a9(te);this.updateRepeatedPanelIds(Q,!0),Q.gridPos.y+=H*U,this.panels.splice(ne+Y,0,Q)}}),M.panels=[],M.gridPos.y+=H*U,Z=ne+_.length}if(V.length>1)for(const ne of this.panels.slice(Z))ne.gridPos.y+=H}}updateRepeatedPanelIds(N,w){return N.repeatPanelId=N.id,N.id=this.getNextPanelId(),w?N.repeatedByRow=!0:N.repeat=void 0,N}getSelectedVariableOptions(N){let w;return(0,D.ML)(N)?w=N.options.slice(1,N.options.length):w=(0,t.filter)(N.options,{selected:!0}),w}getRowHeight(N){if(!N.panels||N.panels.length===0)return 0;if(N.collapsed)return 1;const w=(0,t.maxBy)(N.panels,({gridPos:j})=>j.y+j.h).gridPos;return w.y+w.h-N.gridPos.y}removePanel(N){this.panels=this.panels.filter(w=>w!==N),N.destroy(),this.events.publish(new c.Q$)}removeRow(N,w){(!w&&N.collapsed||w&&!N.collapsed)&&this.toggleRow(N),this.removePanel(N)}expandRows(){const N=this.panels.filter(w=>w.type==="row"&&w.collapsed);for(const w of N)this.toggleRow(w)}collapseRows(){const N=this.panels.filter(w=>w.type==="row"&&!w.collapsed);for(const w of N)this.toggleRow(w)}isSubMenuVisible(){return this.links.length>0||this.getVariables().some(N=>N.hide!==2)||this.annotations.list.some(N=>!N.hide)}getPanelInfoById(N){const w=this.panels.findIndex(j=>j.id===N);return w>=0?{panel:this.panels[w],index:w}:null}
278duplicatePanel(N){const w=N.getSaveModel();return w.id=this.getNextPanelId(),delete w.repeat,delete w.repeatIteration,delete w.repeatPanelId,delete w.scopedVars,w.alert&&delete w.thresholds,delete w.alert,N.gridPos.x+N.gridPos.w*2<=f.cV?w.gridPos.x+=N.gridPos.w:w.gridPos.y+=N.gridPos.h,this.addPanel(w),w}formatDate(N,w){return(0,o.LE)(N,{format:w,timeZone:this.getTimezone()})}destroy(){this.appEventsSubscription.unsubscribe(),this.events.removeAllListeners();for(const N of this.panels)N.destroy()}toggleRow(N){const w=(0,t.indexOf)(this.panels,N);if(!N.collapsed){const F=this.getRowPanels(w);(0,t.pull)(this.panels,...F),N.panels=F.map(M=>M.getSaveModel()),N.collapsed=!0,F.some(M=>M.hasChanged)&&N.configRev++,this.events.publish(new c.Q$);return}N.collapsed=!1;const j=N.panels??[],V=j.some(F=>F.repeat),U=N.repeat;if(j.length>0){const M=(j[0].gridPos.y??N.gridPos.y)-(N.gridPos.y+N.gridPos.h);let H=w+1,_=N.gridPos.y;for(const ne of j){if(U){const te=this.getPanelRepeatVariable(N);if(ne.scopedVars??={},te){const Y=this.getSelectedVariableOptions(te);ne.scopedVars={...ne.scopedVars,[te.name]:Y[0]}}}ne.gridPos.y??(ne.gridPos.y=N.gridPos.y),ne.gridPos.y-=M,this.panels.splice(H,0,new E.a9(ne)),H+=1,_=Math.max(_,ne.gridPos.y+ne.gridPos.h)}const Z=_-N.gridPos.y-1;for(const ne of this.panels.slice(H))ne.gridPos.y+=Z;N.panels=[],V&&this.processRowRepeats(N)}this.sortPanelsByGridPos(),this.events.publish(new c.Q$)}getRowPanels(N){const w=this.panels.slice(N+1),j=w.findIndex(U=>U.type==="row");return w.slice(0,j>=0?j:this.panels.length)}on(N,w){console.log("DashboardModel.on is deprecated use events.subscribe"),this.events.on(N,w)}off(N,w){console.log("DashboardModel.off is deprecated"),this.events.off(N,w)}cycleGraphTooltip(){this.graphTooltip=(this.graphTooltip+1)%3}sharedTooltipModeEnabled(){return this.graphTooltip>0}sharedCrosshairModeOnly(){return this.graphTooltip===1}getRelativeTime(N){return(0,o.fq)(N,{timeZone:this.getTimezone()})}isSnapshot(){return this.snapshot!==void 0}getTimezone(){return this.timezone?this.timezone:h.TP?.user?.timezone}updateSchema(N){new I.SW(this).updateSchema(N)}hasTimeChanged(){const{time:N,originalTime:w}=this;
278return!((0,t.isEqual)(N,w)||(0,t.isEqual)((0,s.KQ)(N?.from),(0,s.KQ)(w?.from))&&(0,t.isEqual)((0,s.KQ)(N?.to),(0,s.KQ)(w?.to)))}autoFitPanels(N,w){const j=Math.max(...this.panels.map(_=>_.gridPos.h+_.gridPos.y)),V=55;let F=N-V-20;w&&(F+=V);const M=Math.floor(F/(f.sD+f.dU)),H=j/M;for(const _ of this.panels)_.gridPos.y=Math.round(_.gridPos.y/H)||1,_.gridPos.h=Math.round(_.gridPos.h/H)||1}templateVariableValueUpdated(){this.processRepeats(),this.events.emit(p.CoreEvents.bG)}getPanelByUrlId(N){const w=parseInt(N??"0",10),j=this.panels.filter(V=>V.collapsed);for(const V of j)V.panels?.some(F=>F.id===w)&&this.toggleRow(V);return this.getPanelById(w)}toggleLegendsForAll(){const N=this.panels.filter(K),w=N.filter(U=>U.legend.show).length,j=N.length-w,V=w>=j;for(const U of N)U.legend.show=!V,U.render()}toggleExemplarsForAll(){for(const N of this.panels)for(const w of N.targets){if(!(w.datasource&&(w.datasource.type==="prometheus"||w.datasource.type==="grafana-amazonprometheus-datasource"||w.datasource.type==="grafana-azureprometheus-datasource")))continue;const j=w;j.exemplar=!j.exemplar}this.startRefresh()}getVariables(){return this.getVariablesFromState(this.uid)}canEditAnnotations(N){let w=!0;return N?w=!!this.meta.annotationsPermissions?.dashboard.canEdit:w=!!this.meta.annotationsPermissions?.organization.canEdit,(a.$.featureToggles.annotationPermissionUpdate||this.canEditDashboard())&&w}canDeleteAnnotations(N){let w=!0;return N?w=!!this.meta.annotationsPermissions?.dashboard.canDelete:w=!!this.meta.annotationsPermissions?.organization.canDelete,a.$.featureToggles.annotationPermissionUpdate?w:w&&this.canEditDashboard()}canAddAnnotations(){return this.annotations.list.find(w=>w.builtIn===1)?.enable===!1?!1:a.$.featureToggles.annotationPermissionUpdate?!!this.meta.annotationsPermissions?.dashboard.canAdd:!!this.meta.annotationsPermissions?.dashboard.canAdd&&this.canEditDashboard()}canEditDashboard(){return!!(this.meta.canEdit||this.meta.canMakeEditable)}shouldUpdateDashboardPanelFromJSON(N,w){!(0,t.isEqual)(N?.gridPos,w?.gridPos)&&this.events.publish(new c.Q$)}getDefaultTime(){return this.originalTime}getPanelRepeatVariable(N){return this.getVariablesFromState(this.uid).find(w=>w.name===N.repeat)}isSnapshotTruthy(){return this.snapshot}hasVariables(){return this.getVariablesFromState(this.uid).length>0}hasVariablesChanged(){const N=this.originalTemplating?.list??[],w=this.getTemplatingSaveModel({saveVariables:!0}).list;return N.length!==w.length?!1:!(0,t.isEqual)(w,N)}variablesTimeRangeProcessDoneHandler(N){const w=N.payload.variableIds.length>0;this.variablesChangedHandler(new d.og({panelIds:[],refreshAll:!0}),w)}variablesChangedHandler(N,w=!0){if(w&&this.processRepeats(),N.payload.refreshAll||(0,b.jG)().isRefreshOutsideThreshold(this.lastRefresh)){this.startRefresh({refreshAll:!0,panelIds:[]});return}(this.panelInEdit||this.panelInView)&&(this.panelsAffectedByVariableChange=N.payload.panelIds.filter(j=>j!==(this.panelInEdit?.id??this.panelInView?.id))),this.startRefresh(N.payload)}variablesChangedInUrlHandler(N){this.templateVariableValueUpdated(),this.startRefresh(N.payload)}getOriginalDashboard(){return this.originalDashboard}}function K(W){return!!W.legend}function A(W,N,w){W.scopedVars??={},W.scopedVars[N.name]=w}},82612:(ee,B,e)=>{"use strict";e.d(B,{NB:()=>P,a9:()=>D,tD:()=>d,tw:()=>E});var t=e(2543),n=e.n(t),r=e(24726),o=e(19379),s=e(39796),m=e(1906),a=e(69168),l=e(75234),f=e(2863),h=e(65642),u=e(62635),i=e(87745),x=e(96215),g=e(56623);const p={events:!0,isViewing:!0,isEditing:!0,isInView:!0,hasRefreshed:!0,cachedPluginOptions:!0,plugin:!0,queryRunner:!0,replaceVariables:!0,configRev:!0,hasSavedPanelEditChange:!0,getDisplayTitle:!0,dataSupport:!0,key:!0,isNew:!0,refreshWhenInView:!0},c={id:!0,gridPos:!0,type:!0,title:!0,scopedVars:!0,repeat:!0,repeatPanelId:!0,repeatDirection:!0,repeatedByRow:!0,minSpan:!0,collapsed:!0,panels:!0,targets:!0,datasource:!0,timeFrom:!0,timeShift:!0,hideTimeOverride:!0,description:!0,links:!0,fullscreen:!0,isEditing:!0,isViewing:!0,hasRefreshed:!0,events:!0,cacheTimeout:!0,queryCachingTTL:!0,cachedPluginOptions:!0,transparent:!0,pluginVersion:!0,queryRunner:!0,transformations:!0,fieldConfig:!0,maxDataPoints:!0,interval:!0,replaceVariables:!0,libraryPanel:!0,getDisplayTitle:!0,configRev:!0,key:!0},y={gridPos:{x:0,y:0,h:3,w:6},targets:[{refId:"A"}],cachedPluginOptions:{},transparent:!1,options:{},links:[],transformations:[],fieldConfig:{defaults:{},overrides:[]},title:""},P={graph:"timeseries","table-old":"table",singlestat:"stat","grafana-singlestat-panel":"stat","grafana-piechart
278-panel":"piechart","grafana-worldmap-panel":"geomap"},d={"heatmap-new":"heatmap"};class D{constructor(C){this.datasource=null,this.isViewing=!1,this.isEditing=!1,this.isInView=!1,this.configRev=0,this.refreshWhenInView=!0,this.cachedPluginOptions={},this.events=new o.o,this.restoreModel(C),this.replaceVariables=this.replaceVariables.bind(this),this.key=(0,r.A)()}restoreModel(C){for(const O in this)p[O]||!this.hasOwnProperty(O)||C[O]||typeof this[O]!="function"&&typeof this[O]!="symbol"&&delete this[O];for(const O in C)this[O]=C[O];const S=(0,g.p)(this);S&&(this.autoMigrateFrom=this.type,this.type=S),(0,t.defaultsDeep)(this,(0,t.cloneDeep)(y)),this.ensureQueryIds()}generateNewKey(){this.key=(0,r.A)()}ensureQueryIds(){if(this.targets&&(0,t.isArray)(this.targets))for(const C of this.targets)C.refId||(C.refId=(0,s.M)(this.targets))}getOptions(){return this.options}get hasChanged(){return this.configRev>0}updateOptions(C){this.options=C,this.configRev++,this.events.publish(new i.PR),this.render()}updateFieldConfig(C){this.fieldConfig=C,this.configRev++,this.events.publish(new i.PR),this.resendLastResult(),this.render()}getSaveModel(){const C={};for(const S in this)p[S]||!this.hasOwnProperty(S)||(0,t.isEqual)(this[S],y[S])||(C[S]=(0,t.cloneDeep)(this[S]));return this.type==="row"&&this.panels&&this.panels.length>0&&(C.panels=this.panels.map(S=>{if(S.libraryPanel){const{id:O,title:I,libraryPanel:R,gridPos:T}=S;return{id:O,title:I,gridPos:T,libraryPanel:{uid:R.uid,name:R.name}}}return S})),C}setIsViewing(C){this.isViewing=C}updateGridPos(C,S=!0){C.x===this.gridPos.x&&C.y===this.gridPos.y&&C.h===this.gridPos.h&&C.w===this.gridPos.w||(this.gridPos.x=C.x,this.gridPos.y=C.y,this.gridPos.w=C.w,this.gridPos.h=C.h,S&&this.configRev++,this.render())}runAllPanelQueries({dashboardUID:C,dashboardTimezone:S,timeData:O,width:I}){this.getQueryRunner().run({datasource:this.datasource,queries:this.targets,panelId:this.id,panelName:this.title,panelPluginId:this.type,dashboardUID:C,timezone:S,timeRange:O.timeRange,timeInfo:O.timeInfo,maxDataPoints:this.maxDataPoints||Math.floor(I),minInterval:this.interval,scopedVars:this.scopedVars,cacheTimeout:this.cacheTimeout,queryCachingTTL:this.queryCachingTTL,transformations:this.transformations,app:this.isEditing?m.Jk.PanelEditor:this.isViewing?m.Jk.PanelViewer:m.Jk.Dashboard})}refresh(){this.hasRefreshed=!0,this.events.publish(new l._)}render(){this.hasRefreshed?this.events.publish(new i.XM):this.refresh()}getOptionsToRemember(){return Object.keys(this).reduce((C,S)=>p[S]||c[S]?C:{...C,[S]:this[S]},{})}restorePanelOptions(C){const S=this.cachedPluginOptions[C];S&&(Object.keys(S.properties).map(O=>{this[O]=S.properties[O]}),this.fieldConfig=(0,a.H9)(this.fieldConfig,S.fieldConfig))}applyPluginOptionDefaults(C,S){const O=(0,a.F)({plugin:C,currentOptions:this.options,currentFieldConfig:this.fieldConfig,isAfterPluginChange:S});this.fieldConfig=O.fieldConfig,this.options=O.options}async pluginLoaded(C){this.plugin=C;const S=b(C);if(this.autoMigrateFrom){const O=P[this.autoMigrateFrom]!=null,I=this.getOptionsToRemember(),R=this.autoMigrateFrom,T=this.type;this.clearPropertiesBeforePluginChange(),this.type=T,this.plugin=C,this.callPanelTypeChangeHandler(C,R,I,O)}if(C.onPanelMigration&&S!==this.pluginVersion){const O=C.onPanelMigration(this);this.options=await O,this.pluginVersion=S}this.applyPluginOptionDefaults(C,!1),this.resendLastResult()}clearPropertiesBeforePluginChange(){for(const C in this)c[C]||delete this[C];this.options={},this.fieldConfig={defaults:{...this.fieldConfig.defaults,custom:{}},overrides:(0,a.aW)(this.fieldConfig.overrides,a.nx)}}callPanelTypeChangeHandler(C,S,O,I){if(C.onPanelTypeChanged){const R=I?{angular:O}:O.options;Object.assign(this.options,C.onPanelTypeChanged(this,S,R,this.fieldConfig))}}changePlugin(C){const S=C.meta.id,O=this.getOptionsToRemember(),I=this.fieldConfig,R=this.type,T=this.isAngularPlugin()||!!P[R];this.cachedPluginOptions[R]={properties:O,fieldConfig:I},this.clearPropertiesBeforePluginChange(),this.restorePanelOptions(S),this.callPanelTypeChangeHandler(C,R,O,T),this.type=S,this.plugin=C,this.configRev++,this.applyPluginOptionDefaults(C,!0),C.onPanelMigration&&(this.pluginVersion=b(C))}updateQueries(C){const{dataSource:S}=C;this.datasource=S,this.cacheTimeout=C.cacheTimeout,this.queryCachingTTL=C.queryCachingTTL,this.timeFrom=C.timeRange?.from,this.timeShift=C.timeRange?.shift,this.hideTimeOverride=C.timeRange?.hide,this.interval=C.minInterval,this.maxDataPoints=C.maxDataPoints,this.targets=C.queries,this.configRev++,this.events.publish(new i.zq)}addQuery(C){C=C||{refId:"A"},C.refId=(0,s.M)(this.targets),this.targets.push(C),this.configRev++}changeQuery(C,S){C.refId=this.targets[S].refId,this.configRev++,this.targets=this.targets.map((O,I)=>I===S?C:O)}getEditClone(){const C=this.getSaveModel(),S=new D(C);S.isEditing=!0,S.plugin=this.plugin;const O=this.getQueryRunner();return S.getQueryRunner().useLastResultFrom(O),S}getTransformations(){return this.transformations}getFieldOverrideOptions(){if(this.plugin)return{fieldConfig:this.fieldConfig,replaceVariables:this.replaceVariables,fieldConfigRegistry:this.plugin.fieldConfigRegistry,theme:h.Ay.theme2}}getDataSupport(){return this.plugin?.dataSupport??{annotations:!1,alertStates:!1}}getQueryRunner(){return this.queryRunner||(this.queryRunner=new x.Z(this)),this.queryRunner}hasTitle(){return this.title&&this.title.length>0}isAngularPlugin(){return(this.plugin&&this.plugin.angularPanelCtrl)!==void 0||(this.plugin?.meta?.angular?.detected??!1)}destroy(){this.events.removeAllListeners(),this.queryRunner&&this.queryRunner.destroy()}setTransformations(C){this.transformations=C,this.resendLastResult(),this.configRev++,this.events.publish(new i.JI)}setProperty(C,S){this[C]=S,this.configRev++,C==="repeat"&&(this.repeat&&!this.repeatDirection?this.repeatDirection="h":this.repeat||(delete this.repeatDirection,delete this.maxPerRow))}replaceVariables(C,S,O){const I=this.getQueryRunner().getLastRequest(),R=Object.assign({},this.scopedVars,I?.scopedVars,S);return(0,f.w)().replace(C,R,O)}resendLastResult(){this.plugin&&this.getQueryRunner().resendLastResult()}getDisplayTitle(){return this.replaceVariables(this.title,void 0,"text")}initLibraryPanel(C){for(const[S,O]of Object.entries(C.model)){switch(S){case"id":case"gridPos":case"libraryPanel":continue}this[S]=O}this.libraryPanel=C}unlinkLibraryPanel(){delete this.libraryPanel,this.configRev++,this.render()}}function b(v){return v&&v.meta.info.version?v.meta.info.version:h.Ay.buildInfo.version}function E(v){const C={};return Object.entries(v).filter(([S,O])=>
278!p[S]&&v.hasOwnProperty(S)&&!(0,t.isEqual)(O,y[S])).forEach(([S,O])=>{C[S]=O}),(0,u.MA)(C)}},83127:(ee,B,e)=>{"use strict";e.d(B,{B:()=>r});var t=e(33749),n=e(27489);function r(o){const s={dashboardId:o.id,dashboardName:o.title,dashboardUid:o.uid,folderName:o.meta.folderTitle,eventName:t.n_.DashboardView};(0,n.G$)(s)}},56623:(ee,B,e)=>{"use strict";e.d(B,{p:()=>n});var t=e(82612);function n(r){return t.tD[r.type]?t.tD[r.type]:r.type==="graph"?r.xaxis?.mode==="series"?r.legend?.values?"bargauge":"barchart":r.xaxis?.mode==="histogram"?"histogram":"timeseries":t.NB[r.type]}},37918:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>p,O9:()=>f,Ub:()=>x,X1:()=>h,ig:()=>l,p0:()=>u,xS:()=>a});var t=e(65307),n=e(59857),r=e(96673),o=e(7817);const s={initPhase:r.DashboardInitPhase.NotStarted,getModel:()=>null,initError:null,initialDatasource:void 0},m=(0,t.Z0)({name:"dashboard",initialState:s,reducers:{dashboardInitFetching:c=>{c.initPhase=r.DashboardInitPhase.Fetching},dashboardInitServices:c=>{c.initPhase=r.DashboardInitPhase.Services},dashboardInitCompleted:(c,y)=>{c.getModel=()=>y.payload,c.initPhase=r.DashboardInitPhase.Completed},dashboardInitFailed:(c,y)=>{c.initPhase=r.DashboardInitPhase.Failed,c.initError=y.payload,c.getModel=()=>new o.G({...n.Ye,title:"Dashboard init failed"},{canSave:!1,canEdit:!1})},cleanUpDashboard:c=>{c.initPhase=r.DashboardInitPhase.NotStarted,c.initError=null,c.getModel=()=>null},addPanel:(c,y)=>{},setInitialDatasource:(c,y)=>{c.initialDatasource=y.payload}}}),{dashboardInitFetching:a,dashboardInitFailed:l,dashboardInitCompleted:f,dashboardInitServices:h,cleanUpDashboard:u,addPanel:i,setInitialDatasource:x}=m.actions,p={dashboard:m.reducer}},77731:(ee,B,e)=>{"use strict";e.d(B,{B1:()=>d,CW:()=>y,LH:()=>l,OK:()=>f,SD:()=>u,VF:()=>i,_u:()=>p,dH:()=>D,ko:()=>P,no:()=>g,s3:()=>x});var t=e(2543),n=e.n(t),r=e(36490),o=e(65642),s=e(95943),m=e(29043),a=e(17097);const l="New panel";function f(E,v){const C={type:"timeseries",title:l,gridPos:(0,a.Ft)(E),datasource:v?{uid:v}:null,isNew:!0};return E.addPanel(C),C.id}function h(E,v){const C={type:v,title:"Widget title",gridPos:calculateNewPanelGridPos(E),datasource:null,isNew:!0};return E.addPanel(C),C.id}function u(E){const v={type:"row",title:"Row title",gridPos:{x:0,y:0}};E.addPanel(v)}function i(){r.Ny.push("/dashboard/import")}function x(E){const v={type:"add-library-panel",gridPos:(0,a.Ft)(E)};E.addPanel(v)}function g(E,v){if(!v)return;const C=(0,a.Ft)(E),S={type:v.id,title:l,gridPos:{x:C.x,y:C.y,w:v.defaults.gridPos.w,h:v.defaults.gridPos.h}};v.defaults&&((0,t.defaults)(S,v.defaults),S.title=v.defaults.title,m.A.delete(s.tH)),E.addPanel
278(S)}function p(){const E=(0,t.chain)(o.Ay.panels).filter({hideFromList:!1}).map(C=>C).value(),v=m.A.get(s.tH);if(v){const C=JSON.parse(v),S=(0,t.find)(E,{id:C.type});if(S){const O=(0,t.cloneDeep)(S);return O.name=C.title,O.sort=-1,{...O,defaults:{...C}}}}}const c="grafana.dashboards.panelEdit.lastUsedDatasource";function y(E){if(m.A.exists(c)){const v=m.A.getObject(c);if(v?.dashboardUid===E)return v}}function P(E){if(!m.A.exists(c))return;const C=m.A.getObject(c)?.datasourceUid??"";b(E,C)}function d(E){m.A.setObject(c,{dashboardUid:E,datasourceUid:""})}function D(E,v){const C=y(E);if(!C)b(E,v);else{const S=C?.dashboardUid??"";b(S,v)}}function b(E,v){m.A.setObject(c,{dashboardUid:E,datasourceUid:v})}},17097:(ee,B,e)=>{"use strict";e.d(B,{ET:()=>O,FC:()=>d,Ft:()=>L,KJ:()=>b,Mc:()=>E,ZY:()=>C,d7:()=>v,iU:()=>D,nk:()=>I});var t=e(2543),n=e.n(t),r=e(32899),o=e(17548),s=e(25229),m=e(33239),a=e(2863),l=e(45229),f=e(65642),h=e(95943),u=e(29043),i=e(23753),x=e(82612),g=e(12161),p=e(43652),c=e(87390),y=e(8535),P=e(87745);const d=(K,A,W)=>{if(W!==!1){const N=A.alert?"YES":void 0;l.A.publish(new P.bY({title:"Remove panel",text:"Are you sure you want to remove this panel?",icon:"trash-alt",confirmText:N,yesText:"Remove",onConfirm:()=>d(K,A,!1)}));return}K.removePanel(A),(0,y.JD)((0,c.O6)(A.key))},D=(K,A)=>{K.duplicatePanel(A)},b=K=>{let A=K;K instanceof x.a9&&(A=K.getSaveModel()),u.A.set(h.tH,JSON.stringify(A)),l.A.emit(r.r1.alertSuccess,["Panel copied. Click **Add panel** icon to paste."])},E=(K,A)=>{l.A.publish(new P.S8({component:i.Zy,props:{dashboard:K,panel:A}}))},v=(K,A)=>{l.A.publish(new P.S8({component:p.o,props:{panel:A,initialFolderUid:K.meta.folderUid,isOpen:!0}}))},C=K=>{l.A.publish(new P.S8({component:g.l,props:{onConfirm:()=>K.unlinkLibraryPanel(),isOpen:!0}}))},S=K=>{K.refresh()},O=K=>{const A={...K.options};A.legend.showLegend===!0?A.legend.showLegend=!1:A.legend.showLegend=!0,K.updateOptions(A)};function I(K,A){const W={timeInfo:"",timeRange:A};if(K.timeFrom){const N=(0,a.w)().replace(K.timeFrom,K.scopedVars),w=o.describeTextRange(N);if(w.invalid)return W.timeInfo="invalid time override",W;if((0,t.isString)(A.raw.from)){const j=(0,s.AN)(A.from).tz(),V=(0,s.AN)(A.to).tz(),U=m.parse(w.from,void 0,j);W.timeInfo=w.display,W.timeRange={from:U,to:m.parse(w.to,void 0,V),raw:{from:w.from,to:w.to}}}}if(K.timeShift){const N=(0,a.w)().replace(K.timeShift,K.scopedVars);if(o.describeTextRange(N).invalid)return W.timeInfo="invalid timeshift",W;const j="-"+N;W.timeInfo+=" timeshift "+j;const V=m.parseDateMath(j,W.timeRange.from,!1),U=m.parseDateMath(j,W.timeRange.to,!0);W.timeRange={from:V,to:U,raw:{from:V,to:U}}}return K.hideTimeOverride&&(W.timeInfo=""),W}function R(K){const W=document.getElementsByTagName("html")[0].getBoundingClientRect().width;return K.maxDataPoints?K.maxDataPoints:Math.ceil(W*(K.gridPos.w/24))}function T(K,A){const W=K.plugin&&K.plugin.noPadding?0:config.theme.panelPadding*2,N=K.hasTitle()?config.theme.panelHeaderHeight:0;return A-N-W-PANEL_BORDER}function L(K){for(const W of K.panelIterator())W.gridPos.y+=8;return{x:0,y:0,w:12,h:8}}},90593:(ee,B,e)=>{"use strict";e.d(B,{z:()=>r});var t=e(25229),n=e(33239);const r=(o,s)=>{const m={from:(0,t.Ar)(o.from)?(0,t.KQ)(o.from):o.from,to:(0,t.Ar)(o.to)?(0,t.KQ)(o.to):o.to},a=s?s.getTimezone():void 0;return{from:n.parse(m.from,!1,a,s?.fiscalYearStartMonth),to:n.parse(m.to,!0,a,s?.fiscalYearStartMonth),raw:m}}},95710:(ee,B,e)=>{"use strict";e.d(B,{Dd:()=>r,GC:()=>o,dM:()=>n,wM:()=>s,z9:()=>a});var t=e(23289);function n(h,u,i){const x=s(h.templating.list),g=o(h.panels.map(p=>p.type));t.c.dashboardInitialized({uid:h.uid,title:h.title,theme:h.style,schemaVersion:h.schemaVersion,version_before_migration:i,panels_count:h.panels.length,...g,...x,settings_nowdelay:h.timepicker.nowDelay,settings_livenow:!!h.liveNow,duration:u,isScene:!1})}function r(h,u){const i=h.getTrackingInformation();t.c.dashboardInitialized({theme:void 0,duration:u,isScene:!0,...i})}function o(h){return h.reduce((u,i)=>(u[f(i)]=1+u[f(i)]||1,u),{})}function s(h){return h.map(u=>u.type).reduce((u,i)=>(u[l(i)]=1+u[l(i)]||1,u),{})}function m(h){switch(h){case"AdhocVariable":return"adhoc";case"CustomVariable":return"custom";case"QueryVariable":return"query";case"IntervalVariable":return"interval";case"ConstantVariable":return"constant";case"DatasourceVariable":return"datasource";case"TextVariable":return"textbox";case"GroupByVariable":return"groupby";default:return}}function a(h){return h.map(u=>m(u.kind)).filter(u=>u!==void 0).reduce((u,i)=>(u[l(i)]=1+u[l(i)]||1,u),{})}const l=h=>`variable_type_${h}_count`,f=h=>`panel_type_${h}_count`},23628:(ee,B,e)=>{"use strict";e.d(B,{ZF:()=>s,vI:()=>o,o2:()=>m});var t=e(88483),n=e(41119),r=e(68125);function o(a){return new t.c(l=>{let f=0;a.forEach(h=>{const u=new FileReader;u.readAsArrayBuffer(h),u.onload=()=>{const i=u.result;if(i&&i instanceof ArrayBuffer){const g=new TextDecoder("utf-8").decode(i);if(h.type==="application/json"){const p=JSON.parse(g);l.next({dataFrames:[(0,n.Vc)(p)],file:h})}else l.next({dataFrames:(0,r.Jh)(g),file:h});++f>=a.length&&l.complete()}}})})}const s={"text/plain":[".csv",".txt"],"application/json":[".json"]},m=5e5}
278,6079:(ee,B,e)=>{"use strict";e.d(B,{r:()=>l});var t=e(74848),n=e(92138),r=e(45861),o=e(73427),s=e(56840),m=e(26437),a=e(96673);function l({variant:f,onClick:h}){const u=o.TP.hasPermission(a.AccessControlAction.DataSourcesCreate),i=n.I.assureBaseUrl(m.b.DataSourcesNew);return(0,t.jsx)(r.z9,{variant:f||"primary",href:i,disabled:!u,tooltip:u?void 0:"You do not have permission to configure new data sources",onClick:h,target:"_blank",children:(0,t.jsx)(s.x6,{i18nKey:"data-source-picker.add-new-data-source",children:"Configure a new data source"})})}},85032:(ee,B,e)=>{"use strict";e.d(B,{A:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(8073),s=e(37658);function m({ds:l,onClick:f,selected:h,description:u,...i}){const x=(0,r.$j)(),g=a(x,l.meta.builtIn);return(0,t.jsxs)(o.Z,{onClick:f,className:(0,n.cx)(g.card,h?g.selected:void 0),...i,children:[(0,t.jsx)(o.Z.Heading,{className:g.heading,children:(0,t.jsxs)("div",{className:g.headingContent,children:[(0,t.jsxs)("span",{className:g.name,children:[l.name," ",l.isDefault?(0,t.jsx)(s.L,{tags:["default"]}):null]}),(0,t.jsx)("small",{className:g.type,children:u||l.meta.name})]})}),(0,t.jsx)(o.Z.Figure,{className:g.logo,children:(0,t.jsx)("img",{src:l.meta.info.logos.small,alt:`${l.meta.name} Logo`})})]},l.uid)}function a(l,f=!1){return{card:(0,n.css)({cursor:"pointer",backgroundColor:"transparent",marginBottom:0,padding:l.spacing(1),"&:hover":{backgroundColor:l.colors.action.hover}}),heading:(0,n.css)({width:"100%",overflow:"hidden","> button":{width:"100%"}}),headingContent:(0,n.css)({color:l.colors.text.secondary,width:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",justifyContent:"space-between"}),logo:(0,n.css)({width:"32px",height:"32px",padding:l.spacing(0,1),display:"flex",alignItems:"center","> img":{maxHeight:"100%",minWidth:"24px",filter:`invert(${f&&l.isLight?1:0})`}}),name:(0,n.css)({color:l.colors.text.primary,display:"flex",gap:l.spacing(2)}),type:(0,n.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center"}),separator:(0,n.css)({margin:l.spacing(0,1),color:l.colors.border.weak}),selected:(0,n.css)({background:l.colors.action.selected,"&::before":{backgroundImage:l.colors.gradients.brandVertical,borderRadius:l.shape.radius.default,content:'" "',display:"block",height:"100%",position:"absolute",transform:"translateX(-50%)",width:l.spacing(.5),left:0}}),meta:(0,n.css)({display:"block",overflowWrap:"unset",whiteSpace:"nowrap",width:"100%",overflow:"hidden",textOverflow:"ellipsis"})}}},93602:(ee,B,e)=>{"use strict";e.d(B,{S:()=>i});var t=e(74848),n=e(22803),r=e(96540),o=e(85629),s=e(2863),m=e(63142),a=e(56840),l=e(42227),f=e(6079),h=e(85032),u=e(7078);function i(y){const P=(0,r.useRef)(null),[d,D]=(0,l.dR)({keyboardEvents:y.keyboardEvents,containerRef:P}),b=(0,m.$j)(),E=c(b,D),{className:v,current:C,onChange:S,enableKeyboardNavigation:O,onClickEmptyStateCTA:I}=y,R=(0,l.Kr)({alerting:y.alerting,annotations:y.annotations,dashboard:y.dashboard,logs:y.logs,metrics:y.metrics,mixed:y.mixed,pluginId:y.pluginId,tracing:y.tracing,type:y.type,variables:y.variables}),[T,L]=(0,l.TX)(),K=y.filter?R.filter(y.filter):R;return(0,t.jsxs)("div",{ref:P,className:(0,n.cx)(v,E.container),"data-testid":o.Tp.components.DataSourcePicker.dataSourceList,children:[K.length===0&&(0,t.jsx)(x,{className:E.emptyState,onClickCTA:I}),K.sort((0,u.Tj)(C,T,p())).map(A=>(0,t.jsx)(h.A,{"data-testid":"data-source-card",ds:A,onClick:()=>{L(A),S(A)},selected:(0,u.Df)(A,C),...O?d:{}},A.uid))]})}function x({className:y,onClickCTA:P}){const d=(0,m.of)(g);return(0,t.jsxs)("div",{className:(0,n.cx)(y,d.container),children:[(0,t.jsx)("p",{className:d.message,children:(0,t.jsx)(a.x6,{i18nKey:"data-source-picker.list.no-data-source-message",children:"No data sources found"})}),(0,t.jsx)(f.r,{onClick:P})]})}function g(y){return{container:(0,n.css)({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),message:(0,n.css)({marginBottom:y.spacing(3)})}}function p(){return(0,s.w)().getVariables().filter(P=>P.type==="datasource").map(P=>`\${${P.id}}`)}function c(y,P){return{container:(0,n.css)({display:"flex",flexDirection:"column",padding:y.spacing(.5),[`${P}`]:{backgroundColor:y.colors.background.secondary}}
278),emptyState:(0,n.css)({height:"100%",flex:1})}}},41776:(ee,B,e)=>{"use strict";e.d(B,{p:()=>O});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(27489),m=e(43173),a=e(63142),l=e(22787),f=e(63527),h=e(30703),u=e(92807),i=e(40279),x=e(56840),g=e(23628),p=e(22747),c=e(42227),y=e(6079),P=e(85629),d=e(85032),D=e(7078);function b(R){switch(R){case"grafana":return(0,x.t)("data-source-picker.built-in-list.description-grafana","Discover visualizations using mock data");case"-- Mixed --":return(0,x.t)("data-source-picker.built-in-list.description-mixed","Use multiple data sources");case"-- Dashboard --":return(0,x.t)("data-source-picker.built-in-list.description-dashboard","Reuse query results from other visualizations");default:return""}}function E({className:R,current:T,onChange:L,tracing:K,dashboard:A,mixed:W,metrics:N,type:w,annotations:j,variables:V,alerting:U,pluginId:F,logs:M,filter:H}){const Z=(0,c.Kr)({tracing:K,dashboard:A,mixed:W,metrics:N,type:w,annotations:j,variables:V,alerting:U,pluginId:F,logs:M}).filter(ne=>(H?H?.(ne):!0)&&!!ne.meta.builtIn);return(0,t.jsx)("div",{className:R,"data-testid":P.Tp.components.DataSourcePicker.advancedModal.builtInDataSourceList,children:Z.map(ne=>(0,t.jsx)(d.A,{ds:ne,description:b(ne.uid),selected:(0,D.Df)(ne,T),onClick:()=>L(ne)},ne.uid))})}var v=e(93602);const C="dashboards_dspickermodal_clicked",S={SELECT_DS:"select_ds",UPLOAD_FILE:"upload_file",CONFIG_NEW_DS:"config_new_ds",CONFIG_NEW_DS_EMPTY_STATE:"config_new_ds_empty_state",SEARCH:"search",DISMISS:"dismiss"};function O({tracing:R,dashboard:T,mixed:L,metrics:K,type:A,annotations:W,variables:N,alerting:w,pluginId:j,logs:V,uploadFile:U,filter:F,onChange:M,current:H,onDismiss:_,reportedInteractionFrom:Z}){const ne=(0,a.of)(I),[te,Y]=(0,o.useState)(""),Q=Z||"modal",J=()=>{_(),(0,s.rR)(C,{item:S.DISMISS,src:Q})},q=ie=>{M(ie),(0,s.rR)(C,{item:S.SELECT_DS,ds_type:ie.type,src:Q})},X=(0,o.useMemo)(()=>(0,r.once)(()=>{(0,s.rR)(C,{item:"search",src:Q})}),[Q]),se=(0,c.ps)("-- Grafana --"),oe=(0,p.j)((ie,fe)=>{se&&(M(se,[ie]),(0,s.rR)(C,{item:S.UPLOAD_FILE,src:Q}),fe.length<1&&_())}),ae=({className:ie})=>(0,t.jsx)(E,{className:ie,onChange:q,current:H,filter:F,variables:N,tracing:R,metrics:K,type:A,annotations:W,alerting:w,pluginId:j,logs:V,dashboard:T,mixed:L});return(0,t.jsxs)(l.a,{title:(0,x.t)("data-source-picker.modal.title","Select data source"),closeOnEscape:!0,closeOnBackdropClick:!0,isOpen:!0,className:ne.modal,contentClassName:ne.modalContent,onClickBackdrop:J,onDismiss:J,children:[(0,t.jsxs)("div",{className:ne.leftColumn,children:[(0,t.jsx)(f.p,{type:"search",autoFocus:!0,className:ne.searchInput,value:te,prefix:(0,t.jsx)(h.I,{name:"search"}),placeholder:(0,x.t)("data-source-picker.modal.input-placeholder","Select data source"),onChange:ie=>{Y(ie.currentTarget.value),X()}}),(0,t.jsxs)(u.P,{children:[(0,t.jsx)(v.S,{onChange:q,current:H,onClickEmptyStateCTA:()=>(0,s.rR)(C,{item:S.CONFIG_NEW_DS_EMPTY_STATE,src:Q}),filter:ie=>(F?F?.(ie):!0)&&(0,D.Zn)(ie,te)&&!ie.meta.builtIn,variables:N,tracing:R,metrics:K,type:A,annotations:W,alerting:w,pluginId:j,logs:V,dashboard:T,mixed:L}),(0,t.jsx)(ae,{className:ne.appendBuiltInDataSourcesList})]})]}),(0,t.jsxs)("div",{className:ne.rightColumn,children:[(0,t.jsxs)("div",{className:ne.builtInDataSources,children:[(0,t.jsx)("div",{className:ne.builtInDataSourcesList,children:(0,t.jsx)(u.P,{children:(0,t.jsx)(ae,{})})}),U&&m.$.featureToggles.editPanelCSVDragAndDrop&&(0,t.jsx)(i.gH,{readAs:"readAsArrayBuffer",fileListRenderer:()=>{},options:{maxSize:g.o2,multiple:!1,accept:g.ZF,onDrop:oe},children:(0,t.jsx)(i.wI,{})})]}),(0,t.jsxs)("div",{className:ne.newDSSection,children:[(0,t.jsx)("span",{className:ne.newDSDescription,children:(0,t.jsx)(x.x6,{i18nKey:"data-source-picker.modal.configure-new-data-source",children:"Open a new tab and configure a data source"})}),(0,t.jsx)(y.r,{variant:"secondary",onClick:()=>{(0,s.rR)(C,{item:S.CONFIG_NEW_DS,src:Q}),_()}})]})]})]})}function I(R){return{modal:(0,n.css)({width:"80%",height:"80%",maxWidth:"1200px",maxHeight:"900px",[R.breakpoints.down("md")]:{width:"100%"}}),modalContent:(0,n.css)({display:"flex",flexDirection:"row",height:"100%",[R.breakpoints.down("md")]:{flexDirection:"column"}}),leftColumn:(0,n.css)({display:"flex",flexDirection:"column",width:"50%",height:"100%",paddingRight:R.spacing(4),borderRight:`1px solid ${R.colors.border.weak}`,[R.breakpoints.down("md")]:{width:"100%",borderRight:0,paddingRight:0,flex:1,overflowY:"auto"}}),rightColumn:(0,n.css)({display:"flex",flexDirection:"column",width:"50%",height:"100%",
278justifyItems:"space-evenly",alignItems:"stretch",paddingLeft:R.spacing(4),[R.breakpoints.down("md")]:{width:"100%",paddingLeft:0,flex:0}}),builtInDataSources:(0,n.css)({flex:"1 1",marginBottom:R.spacing(4),[R.breakpoints.down("md")]:{flex:0}}),builtInDataSourcesList:(0,n.css)({[R.breakpoints.down("md")]:{display:"none",marginBottom:0},marginBottom:R.spacing(4)}),appendBuiltInDataSourcesList:(0,n.css)({[R.breakpoints.up("md")]:{display:"none"}}),newDSSection:(0,n.css)({display:"flex",flexDirection:"row",width:"100%",justifyContent:"space-between",alignItems:"center"}),newDSDescription:(0,n.css)({flex:"1 0",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:R.colors.text.secondary}),searchInput:(0,n.css)({width:"100%",minHeight:"32px",marginBottom:R.spacing(1)})}}},76792:(ee,B,e)=>{"use strict";e.d(B,{s:()=>W});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(18828),a=e(42211),l=e(93225),f=e(2543),h=e(96540),u=e(85629),i=e(27489),x=e(63142),g=e(63527),p=e(30703),c=e(15245),y=e(92807),P=e(8515),d=e(45861),D=e(65642),b=e(56840),E=e(5478),v=e(8095),C=e(42227),S=e(93602);function O(F){const{dataSource:M}=F,H=(0,x.$j)(),_=R(H,M?.meta.builtIn);return M?(0,t.jsx)("img",{className:_.pickerDSLogo,alt:`${M.meta.name} logo`,src:M.meta.info.logos.small}):I()}function I(){const F=(0,x.of)(R);return(0,t.jsx)("div",{className:F.pickerDSLogo})}
278function R(F,M=!1){return{pickerDSLogo:(0,n.css)({height:"20px",width:"20px",filter:`invert(${M&&F.isLight?1:0})`})}}var T=e(41776),L=e(7078);const K="dashboards_dspicker_clicked",A={SEARCH:"search",OPEN_DROPDOWN:"open_dspicker",SELECT_DS:"select_ds",ADD_FILE:"add_file",OPEN_ADVANCED_DS_PICKER:"open_advanced_ds_picker",CONFIG_NEW_DS_EMPTY_STATE:"config_new_ds_empty_state"};function W(F){const{current:M,onChange:H,hideTextValue:_=!1,width:Z,inputId:ne,noDefault:te=!1,disabled:Y=!1,placeholder:Q="Select data source",...J}=F,q=(0,x.of)(N,F),[X,se]=(0,h.useState)(!1),[oe,ae]=(0,h.useState)(!1),[ie,fe]=(0,h.useState)(""),{onKeyDown:pe,keyboardEvents:de}=(0,E.d)(),le=(0,h.useRef)(null),me=(0,h.useMemo)(()=>(0,f.debounce)(Ee=>{(0,i.rR)(K,{item:A.SEARCH,query:Ee,creator_team:"grafana_plugins_catalog",schema_version:"1.0.0"})},300),[]),[De,Te]=(0,h.useState)(),[Ne,Ce]=(0,h.useState)(),He=(0,C.ps)(M),ke=(0,C.ps)("-- Grafana --"),Me=!M&&te?void 0:He,$e=ie&&X?(0,t.jsx)(I,{}):(0,t.jsx)(O,{dataSource:Me}),tt=[(0,r.cY)(4),(0,r.Ej)({apply({availableHeight:Ee,elements:xe}){xe.floating.style.maxHeight=`${Math.max(200,Ee-20)}px`,xe.floating.style.minHeight="200px"}}),(0,r.UU)({fallbackStrategy:"initialPlacement",crossAxis:!1,boundary:document.body}),(0,r.BN)()],{refs:Ke,floatingStyles:Re}=(0,o.we)({open:X,placement:"bottom-start",onOpenChange:se,middleware:tt,whileElementsMounted:s.ll,strategy:"fixed"}
278),Ve=(0,h.useCallback)(Ee=>{Ke.setReference(Ee),Te(Ee)},[Ke]),Qe=(0,h.useCallback)(()=>{fe(""),se(!1),De?.focus()},[se,De]),{overlayProps:je,underlayProps:ze}=(0,l.e)({onClose:Qe,isDismissable:!0,isOpen:X,shouldCloseOnInteractOutside:Ee=>De?!De.isSameNode(Ee):!1},le),{dialogProps:Ye}=(0,m.s)({"aria-label":"Opened data source picker list"},le);function Ge(){se(!0),De?.focus()}function ce(){ke&&H(ke,[v.dx])}function Pe(Ee){Ee.key==="Tab"&&!Ee.shiftKey&&X&&(Ee.preventDefault(),Ne?.focus()),Ee.key==="Tab"&&Ee.shiftKey&&X&&Qe(),pe(Ee)}function Se(Ee){Ee.shiftKey?(Ee.preventDefault(),De?.focus()):Qe()}return(0,h.useEffect)(()=>{const Ee=de.subscribe({next:xe=>{switch(xe?.code){case"ArrowDown":Ge(),xe.preventDefault();break;case"ArrowUp":Ge(),xe.preventDefault();break;case"Escape":Qe(),xe.preventDefault();break}}});return()=>Ee.unsubscribe()}),(0,t.jsxs)("div",{className:q.container,"data-testid":u.Tp.components.DataSourcePicker.container,children:[(0,t.jsx)("div",{className:q.trigger,onClick:()=>{Ge(),(0,i.rR)(K,{item:A.OPEN_DROPDOWN,creator_team:"grafana_plugins_catalog",schema_version:"1.0.0"})},children:(0,t.jsx)(g.p,{id:ne||"data-source-picker",className:oe?void 0:q.input,"data-testid":u.Tp.components.DataSourcePicker.inputV2,"aria-label":(0,b.t)("datasources.data-source-picker.aria-label-select-a-data-source","Select a data source"),autoComplete:"off",prefix:Me?$e:void 0,suffix:(0,t.jsx)(p.I,{name:X?"search":"angle-down"}),placeholder:_?"":(0,L.q7)(Me)||Q,onFocus:()=>{ae(!0)},onBlur:()=>{ae(!1)},onKeyDown:Pe,value:ie,onChange:Ee=>{Ge(),fe(Ee.currentTarget.value),Ee.currentTarget.value&&me(Ee.currentTarget.value)},ref:Ve,disabled:Y})}),X?(0,t.jsxs)(c.ZL,{children:[(0,t.jsx)("div",{...ze}),(0,t.jsx)("div",{ref:le,...je,...Ye,children:(0,t.jsx)(w,{...J,style:Re,ref:Ke.setFloating,footerRef:Ce,current:Me,filterTerm:ie,keyboardEvents:de,onCh
278ange:(Ee,xe)=>{Qe(),Ee.uid!==Me?.uid&&(H(Ee,xe),(0,i.rR)(K,{item:A.SELECT_DS,ds_type:Ee.type}))},onClose:Qe,onClickAddCSV:ce,onDismiss:Qe,onNavigateOutsiteFooter:Se})})]}):null]})}function N(F,M){return{container:(0,n.css)({position:"relative",cursor:M.disabled?"not-allowed":"pointer",width:F.spacing(M.width||"auto")}),trigger:(0,n.css)({cursor:"pointer",pointerEvents:M.disabled?"none":"auto"}),input:(0,n.css)({"input::placeholder":{color:M.disabled?F.colors.action.disabledText:F.colors.text.primary}})}}const w=h.forwardRef((F,M)=>{const{filterTerm:H,onChange:_,onClose:Z,onClickAddCSV:ne,current:te,filter:Y}=F,Q=(0,h.useCallback)(X=>{_(X)},[_]),J=(0,h.useCallback)(()=>{ne?.(),Z(),(0,i.rR)(K,{item:A.ADD_FILE})},[ne,Z]),q=(0,x.of)(j);return(0,t.jsxs)("div",{style:F.style,ref:M,className:q.container,children:[(0,t.jsx)(y.P,{showScrollIndicators:!0,children:(0,t.jsx)(S.S,{...F,enableKeyboardNavigation:!0,className:q.dataSourceList,current:te,onChange:Q,filter:X=>(Y?Y?.(X):!0)&&(0,L.Zn)(X,H),onClickEmptyStateCTA:()=>(0,i.rR)(K,{item:A.CONFIG_NEW_DS_EMPTY_STATE})})}),(0,t.jsx)(a.n1,{children:(0,t.jsx)(V,{...F,onClickAddCSV:J,onChange:Q,onNavigateOutsiteFooter:F.onNavigateOutsiteFooter})})]})});w.displayName="PickerContent";function j(F){return{container:(0,n.css)({display:"flex",flexDirection:"column",background:F.colors.background.elevated,borderRadius:F.shape.radius.default,boxShadow:F.shadows.z3,overflow:"hidden"}),picker:(0,n.css)({background:F.colors.background.secondary}),dataSourceList:(0,n.css)({flex:1}),footer:(0,n.css)({flex:0,display:"flex",flexDirection:"row-reverse",justifyContent:"space-between",padding:F.spacing(1.5),borderTop:`1px solid ${F.colors.border.weak}`,backgroundColor:F.colors.background.secondary})}}function V({onClose:F,onChange:M,onClickAddCSV:H,..._}){const Z=(0,x.of)(U),ne=_.uploadFile&&D.Ay.featureToggles.editPanelCSVDragAndDrop,te=Q=>{Q.key==="Tab"&&_.onNavigateOutsiteFooter(Q)},Y=Q=>{Q.key==="Tab"&&Q.shiftKey&&_.onNavigateOutsiteFooter(Q)};return(0,t.jsxs)("div",{className:Z.footer,children:[(0,t.jsx)(P.$s,{children:({showModal:Q,hideModal:J})=>(0,t.jsxs)(d.$n,{size:"sm",variant:"secondary",fill:"text",onClick:()=>{F(),Q(T.p,{reportedInteractionFrom:"ds_picker",tracing:_.tracing,dashboard:_.dashboard,mixed:_.mixed,metrics:_.metrics,type:_.type,annotations:_.annotations,variables:_.variables,alerting:_.alerting,pluginId:_.pluginId,logs:_.logs,filter:_.filter,uploadFile:_.uploadFile,current:_.current,onDismiss:J,onChange:(q,X)=>{M(q,X),J()}}),(0,i.rR)(K,{item:A.OPEN_ADVANCED_DS_PICKER})},ref:_.footerRef,onKeyDown:ne?Y:te,children:[(0,t.jsx)(b.x6,{i18nKey:"data-source-picker.open-advanced-button",children:"Open advanced data source picker"}),(0,t.jsx)(p.I,{name:"arrow-right"})]})}),ne&&(0,t.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:H,onKeyDown:te,children:(0,t.jsx)(b.x6,{i18nKey:"datasources.footer.add-csv-or-spreadsheet",children:"Add csv or spreadsheet"})})]})}function U(F){return{footer:(0,n.css)({flex:0,display:"flex",flexDirection:"row-reverse",justifyContent:"space-between",padding:F.spacing(1.5),borderTop:`1px solid ${F.colors.border.weak}`,backgroundColor:F.colors.background.secondary})}}},7078:(ee,B,e)=>{"use strict";e.d(B,{Df:()=>o,Tj:()=>m,Zn:()=>a,q7:()=>s,tw:()=>l});var t=e(22429),n=e(77731),r=e(18615);function o(f,h){return!f||!h?!1:typeof h=="string"?f.uid===h:f.uid===h.uid}function s(f){if(f){if(typeof f=="string")return`${f} - not found`;if("name"in f)return f.name;if(f.uid)return`${f.uid} - not found`}}function m(f,h,u){return(x,g)=>{const p=x.name.toUpperCase(),c=g.name.toUpperCase();if(f&&o(x,f))return-1;if(f&&o(g,f))return 1;const y=h.indexOf(x.uid),P=h.indexOf(g.uid);if(y>-1&&y>P)return-1;if(P>-1&&P>y)return 1;const d=u.includes(x.uid),D=u.includes(g.uid);return d&&!D?-1:D&&!d||x.meta.builtIn&&!g.meta.builtIn?1:g.meta.builtIn&&!x.meta.builtIn||p<c?-1:1}}function a(f,h=""){return f.name.toLowerCase().includes(h.toLowerCase())}function l(f){if(!f.uid)return;const h=(0,t.UA)().getCurrent()?.uid??"";if(f.uid===r.uv)return(0,n.B1)(h);(0,n.dH)(h,f.uid)}},37946:(ee,B,e)=>{"use strict";e.d(B,{I:()=>t});const t={List:"/datasources",Edit:"/datasources/edit/:uid",Dashboards:"/datasources/edit/:uid/dashboards",New:"/datasources/new"}},42227:(ee,B,e)=>{"use strict";e.d(B,{Kr:()=>m,TX:()=>s,dR:()=>l,ps:()=>a});var t=e(96540),n=e(78685),r=e(78282);const o="grafana.features.datasources.components.picker.DataSourceDropDown.history";function s(){const[f=[],h]=(0,n.A)(o,[]),u=(0,t.useCallback)(i=>{i.meta.builtIn||(f.includes(i.uid)?(f.splice(f.findIndex(x=>i.uid===x),1),h([...f,i.uid])):h([...f,i.uid].slice(1,6)))},[f,h]);return[f,u]}function m(f){return(0,r.l)().getList(f)}function a(f){const h=(0,r.l)();return h.getInstanceSettings(f)}function l(f){const{keyboardEvents:h,containerRef:u}=f,i=(0,t.useRef)(0),x="data-role",g="keyboardSelectableItem",p={[x]:g},c=`[${x}="${g}"`,y="data-selectedItem",P=`[${y}="true"]`,d=(0,t.useCallback)(b=>{const E=u?.current?.querySelectorAll(c),v=E?.item(b%E?.length);E?.forEach(C=>C.setAttribute(y,"false")),v&&(v.scrollIntoView({block:"center"}),v.setAttribute(y,"true"))},[u,c]),D=(0,t.useCallback)(()=>{u?.current?.querySelector(P)?.querySelector("button")?.click()},[u,P]);return(0,t.useEffect)(()=>
278{if(!h)return;const b=h.subscribe({next:E=>{switch(E?.code){case"ArrowDown":{d(++i.current),E.preventDefault();break}case"ArrowUp":i.current=i.current>0?i.current-1:i.current,d(i.current),E.preventDefault();break;case"Enter":D();break}}});return()=>b.unsubscribe()},[h,d,D]),(0,t.useEffect)(()=>{const b=new MutationObserver(E=>{E.some(C=>C.addedNodes&&C.addedNodes.length>0||C.removedNodes&&C.removedNodes.length>0)&&d(0)});return u.current&&b.observe(u.current,{childList:!0}),()=>{b.disconnect()}},[u,c,d]),[p,P]}},18548:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>C,Bs:()=>h,C_:()=>g,E1:()=>m,Gc:()=>l,IJ:()=>y,Ks:()=>P,QZ:()=>D,TN:()=>s,Tk:()=>p,UP:()=>E,eB:()=>i,f$:()=>f,gZ:()=>a,jz:()=>o,lg:()=>b,qR:()=>d,rb:()=>x});var t=e(65307),n=e(78479);const r={dataSources:[],plugins:[],categories:[],dataSource:{},layoutMode:n.R.List,searchQuery:"",dataSourcesCount:0,dataSourceTypeSearchQuery:"",isLoadingDataSources:!1,isLoadingDataSourcePlugins:!1,dataSourceMeta:{},isSortAscending:!0},o=(0,t.VP)("dataSources/dataSourceLoaded"),s=(0,t.VP)("dataSources/dataSourcesLoad"),m=(0,t.VP)("dataSources/dataSourcesLoaded"),a=(0,t.VP)("dataSources/dataSourceMetaLoaded"),l=(0,t.VP)("dataSources/dataSourcePluginsLoad"),f=(0,t.VP)("dataSources/dataSourcePluginsLoaded"),h=(0,t.VP)("dataSources/setDataSourcesSearchQuery"),u=(0,t.VP)("dataSources/setDataSourcesLayoutMode"),i=(0,t.VP)("dataSources/setDataSourceTypeSearchQuery"),x=(0,t.VP)("dataSources/setDataSourceName"),g=(0,t.VP)("dataSources/setIsDefault"),p=(0,t.VP)("dataSources/setIsSortAscending"),c=(S=r,O)=>s.match(O)?{...S,isLoadingDataSources:!0}:m.match(O)?{...S,isLoadingDataSources:!1,dataSources:O.payload,dataSourcesCount:O.payload.length}:o.match(O)?{...S,dataSource:O.payload}:h.match(O)?{...S,searchQuery:O.payload}:u.match(O)?{...S,layoutMode:O.payload}:l.match(O)?{...S,plugins:[],isLoadingDataSourcePlugins:!0}:f.match(O)?{...S,plugins:O.payload.plugins,categories:O.payload.categories,isLoadingDataSourcePlugins:!1}:i.match(O)?{...S,dataSourceTypeSearchQuery:O.payload}:a.match(O)?{...S,dataSourceMeta:O.payload}:x.match(O)?{...S,dataSource:{...S.dataSource,name:O.payload}}:g.match(O)?{...S,dataSource:{...S.dataSource,isDefault:O.payload}}:p.match(O)?{...S,isSortAscending:O.payload}:S,y={testingStatus:{},loadError:null,loading:!0,plugin:null},P=(0,t.VP)("dataSourceSettings/initDataSourceSettingsSucceeded"),d=(0,t.VP)("dataSourceSettings/initDataSourceSettingsFailed"),D=(0,t.VP)("dataSourceSettings/testDataSourceStarting"),b=(0,t.VP)("dataSourceSettings/testDataSourceSucceeded"),E=(0,t.VP)("dataSourceSettings/testDataSourceFailed"),C={dataSources:c,dataSourceSettings:(S=y,O)=>P.match(O)?{...S,plugin:O.payload,loadError:null,loading:!1}:d.match(O)?{...S,plugin:null,loadError:O.payload.message,loading:!1}:D.match(O)?{...S,testingStatus:{message:"Testing... this could take up to a couple of minutes",status:"info"}}:b.match(O)?{...S,testingStatus:{status:O.payload?.status,message:O.payload?.message,details:O.payload?.details}}:E.match(O)?{...S,testingStatus:{status:"error",message:O.payload?.message,details:O.payload?.details}}:S}},29869:()=>{"use strict"},71451:(ee,B,e)=>{"use strict";e.d(B,{n:()=>y});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(45861),m=e(97095),a=e(18027),l=e(63527),f=e(43533),h=e(2381),u=e(14226),i=e(30868),x=e(56840),g=e(20012),p=e(4896),c=e(73304);const y=D=>{const{value:b,src:E,name:v,placeholder:C,onChange:S,onClear:O,mediaType:I,folderName:R,size:T,color:L,maxFiles:K}=D,A=(0,o.of)(d),W=(0,o.$j)(),N=(0,r.useRef)(null),w=M=>(0,t.jsx)(c.i,{onChange:S,value:b,mediaType:I,folderName:R,maxFiles:K,hidePopper:M.hidePopper});let j=E;!j&&b&&(j=(0,g.D)(b));const V=L&&{fill:W.visualization.getColorByName(L)},U=()=>b&&j?(0,t.jsx)(i.y,{src:j,className:A.icon,style:{...V}}):(0,t.jsx)(s.z9,{variant:"primary",fill:"text",size:"sm",children:(0,t.jsx)(x.x6,{i18nKey:"dimensions.resource-picker.render-small-resource-picker.set-icon",children:"Set icon"})}),F=()=>(0,t.jsx)(m.C,{children:(0,t.jsx)(a.I,{label:null,grow:!0,children:(0,t.jsx)(l.p,{value:P(E,v),placeholder:C,readOnly:!0,prefix:j&&(0,t.jsx)(i.y,{src:j,className:A.icon,style:{...V}}),suffix:(0,t.jsx)(s.$n,{icon:"times",variant:"secondary",fill:"text",size:"sm",onClick:O})})})});return(0,t.jsx)(f.I,{content:w,children:(M,H,_)=>(0,t.jsxs)(t.Fragment,{children:[N.current&&(0,t.jsx)(h.A,{..._,referenceElement:N.current,onMouseEnter:M,onKeyDown:Z=>{(0,u.Q)(Z,H)},hidePopper:H}),(0,t.jsxs)("div",{ref:N,className:A.pointer,onClick:M,onKeyDown:Z=>{Z.key==="Enter"&&M()},role:"button",tabIndex:0,children:[T===p.Iy.SMALL&&U(),T===p.Iy.NORMAL&&F()]})]})})};function P(D,b){if(D?.startsWith("public/img/icons")){const E=b?.lastIndexOf(".svg")??0;if(E>0)return b.substring(0,E)}return b}const d=D=>({pointer:(0,n.css)({cursor:"pointer","input[readonly]":{cursor:"pointer"}}),icon:(0,n.css)({verticalAlign:"middle",display:"inline-block",fill:"currentColor",width:"25px"})})},73304:(ee,B,e)=>{"use strict";e.d(B,{i:()=>j});var t=e(74848),n=e(22803),r=e(18828),o=e(42211),s=e(93225),m=e(96540),a=e(68143),l=e(63142),f=e(45861),h=e(65642),u=e(56840),i=e(4896),x=e(37386),g=e(40279),p=e(30868);function c({secondaryText:U="Drag and drop here or browse"}){const F=(0,l.of)(P);return(0,t.jsxs)("div",{className:F.iconWrapper,children:[(0,t.jsx)("small",{className:F.small,children:U}),(0,t.jsx)(f.$n,{type:"button",icon:"upload",children:(0,t.jsx)(u.x6,{i18nKey:"dimensions.file-dropzone-custom-c
278hildren.upload",children:"Upload"})})]})}const y=({mediaType:U,setFormData:F,setUpload:M,error:H})=>{const _=(0,l.of)(P),[Z,ne]=(0,m.useState)(!1),[te,Y]=(0,m.useState)(""),Q=()=>(0,t.jsx)(x.D,{label:(0,u.t)("dimensions.file-uploader.preview.label-preview","Preview"),children:(0,t.jsxs)("div",{className:_.iconPreview,children:[U===i.zu.Icon&&(0,t.jsx)(p.y,{src:te,className:_.img}),U===i.zu.Image&&(0,t.jsx)("img",{src:te,alt:"Preview of the uploaded file",className:_.img})]})}),J=X=>{fetch(`/api/storage/delete/upload/${X.file.name}`,{method:"DELETE"}).catch(se=>console.error("cannot delete file",se))},q=U==="icon"?{"image/*":[".svg",".xml"]}:{"image/*":[".jpeg",".png",".gif",".webp"]};return(0,t.jsx)(g.gH,{readAs:"readAsBinaryString",onFileRemove:J,options:{accept:q,multiple:!1,onDrop:X=>{let se=new FormData;se.append("file",X[0]),Y(URL.createObjectURL(X[0])),ne(!0),F(se),M(!0)}},children:H.message!==""&&Z?(0,t.jsx)("p",{children:H.message}):Z?(0,t.jsx)(Q,{}):(0,t.jsx)(c,{})})};function P(U,F){return{container:(0,n.css)({display:"flex",flexDirection:"column",width:"100%"}),dropzone:(0,n.css)({display:"flex",flex:1,flexDirection:"column",alignItems:"center",padding:U.spacing(6),borderRadius:U.shape.radius.default,border:`2px dashed ${U.colors.border.medium}`,backgroundColor:F?U.colors.background.secondary:U.colors.background.primary,cursor:"pointer"}),iconWrapper:(0,n.css)({display:"flex",flexDirection:"column",alignItems:"center"}),acceptMargin:(0,n.css)({margin:U.spacing(2,0,1)}),small:(0,n.css)({color:U.colors.text.secondary,marginBottom:U.spacing(2)}),iconContainer:(0,n.css)({display:"flex",flexDirection:"column",width:"80%",alignItems:"center",alignSelf:"center"}),iconPreview:(0,n.css)({width:"238px",height:"198px",border:`1px solid ${U.colors.border.medium}`,display:"flex",alignItems:"center",justifyContent:"center"}),img:(0,n.css)({width:"147px",height:"147px",fill:U.colors.text.primary})}}var d=e(18857),D=e(12737),b=e(28998),E=e(70713),v=e(91793);const C=(0,m.memo)(function(F){const{columnIndex:M,rowIndex:H,style:_,data:Z}=F,{cards:ne,columnCount:te,onChange:Y,selected:Q}=Z,J=M+H*te,q=ne[J],X=(0,l.of)(O);return(0,t.jsx)("div",{style:_,children:q&&(0,t.jsxs)("div",{className:Q===q.value?(0,n.cx)(X.card,X.selected):X.card,onClick:()=>Y(q.value),onKeyDown:se=>{se.key==="Enter"&&Y(q.value)},role:"button",tabIndex:0,children:[q.imgUrl.endsWith(".svg")?(0,t.jsx)(p.y,{src:q.imgUrl,className:X.img}):(0,t.jsx)("img",{src:q.imgUrl,alt:"",className:X.img}),(0,t.jsx)("h6",{className:X.text,children:q.label.slice(0,-4)})]},q.value)})},v.t7),S=U=>{const{onChange:F,cards:M,value:H}=U,_=(0,l.of)(O);return(0,t.jsx)(E.default,{defaultWidth:680,children:({width:Z,height:ne})=>{const Q=Math.floor(Z/90),J=Math.ceil(M.length/Q);return(0,t.jsx)(v.yi,{width:Z,height:ne,columnCount:Q,columnWidth:90,rowCount:J,rowHeight:90,itemData:{cards:M,columnCount:Q,onChange:F,selected:H},className:_.grid,children:C})}})},O=U=>({card:(0,n.css)({display:"inline-block",width:"90px",height:"90px",margin:"0.75rem",marginLeft:"15px",textAlign:"center",cursor:"pointer",position:"relative",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:U.shape.radius.default,paddingTop:"6px",":hover":{borderColor:U.colors.action.hover,boxShadow:U.shadows.z2}}),selected:(0,n.css)({border:`2px solid ${U.colors.primary.main}`,":hover":{borderColor:U.colors.primary.main}}),img:(0,n.css)({width:"40px",height:"40px",objectFit:"cover",verticalAlign:"middle",fill:U.colors.text.primary}),text:(0,n.css)({color:U.colors.text.primary,whiteSpace:"nowrap",fontSize:"12px",textOverflow:"ellipsis",display:"block",overflow:"hidden"}),grid:(0,n.css)({border:`1px solid ${U.colors.border.medium}`})}),I=U=>U===i.zu.Icon?[i.Iu.Icon,i.Iu.IOT,i.Iu.Marker]:[i.Iu.BG],R=(U,F)=>U.find(M=>F.startsWith(M.value))??U[0],T=U=>{const{value:F,mediaType:M,folderName:H,newValue:_,setNewValue:Z,maxFiles:ne}=U,te=(0,l.of)(L),Y=I(M).map(pe=>({label:pe,value:pe})),[Q,J]=(0,m.useState)(),[q,X]=(0,m.useState)(R(Y,F?.length?F:H)),[se,oe]=(0,m.useState)([]),[ae,ie]=(0,m.useState)([]),fe=pe=>{pe?(pe=pe.toLowerCase(),ie(se.filter(de=>de.search.includes(pe)))):ie(se)};return(0,m.useEffect)(()=>{const pe=q?.value;if(pe){const de=M===i.zu.Icon?le=>le.name.endsWith(".svg"):le=>le.name.endsWith(".png")||le.name.endsWith(".gif");(0,b.tR)().get("-- Grafana --").then(le=>{le.listFiles(pe,ne).subscribe({next:me=>{const De=[];me.forEach(Te=>{if(de(Te)){const Ne=Te.name.lastIndexOf(".");De.push({value:`${pe}/${Te.name}`,label:Te.name,search:(Ne?Te.name.substring(0,Ne):Te.name).toLowerCase(),imgUrl:`public/${pe}/${Te.name}`})}}),oe(De),ie(De)}})})}},[M,q,ne]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.D,{children:(0,t.jsx)(d.l6,{options:Y,onChange:X,value:q,menuShouldPortal:!1})}),(0,t.jsx)(x.D,{children:(0,t.jsx)(D.Z,{value:Q??"",placeholder:(0,u.t)("dimensions.folder-picker-tab.placeholder-search","Search"),onChange:pe=>{fe(pe),J(pe)}})}),ae&&(0,t.jsx)("div",{className:te.cardsWrapper,children:(0,t.jsx)(S,{cards:ae,onCh
278ange:pe=>Z(pe),value:_})})]})},L=U=>({cardsWrapper:(0,n.css)({height:"30vh",minHeight:"50px",marginTop:"5px",maxWidth:"680px"})});var K=e(63527),A=e(72636),W=e(20012);const N=U=>{const{newValue:F,setNewValue:M,mediaType:H}=U,_=(0,l.of)(w),Z=(0,W.D)(F);let ne=F?.substring(F.lastIndexOf("/")+1,F.lastIndexOf("."));return ne.length>20&&(ne=ne.substring(0,20)+"..."),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.D,{children:(0,t.jsx)(K.p,{onChange:te=>M(te.currentTarget.value),value:F})}),(0,t.jsxs)("div",{className:_.iconContainer,children:[(0,t.jsx)(x.D,{label:(0,u.t)("dimensions.urlpicker-tab.label-preview","Preview"),children:(0,t.jsxs)("div",{className:_.iconPreview,children:[H===i.zu.Icon&&(0,t.jsx)(p.y,{src:Z,className:_.img}),H===i.zu.Image&&F&&(0,t.jsx)("img",{src:Z,alt:"Preview of the selected URL",className:_.img})]})}),(0,t.jsx)(A.J,{children:ne})]})]})},w=U=>({iconContainer:(0,n.css)({display:"flex",flexDirection:"column",width:"80%",alignItems:"center",alignSelf:"center"}),iconPreview:(0,n.css)({width:"238px",height:"198px",border:`1px solid ${U.colors.border.medium}`,display:"flex",alignItems:"center",justifyContent:"center"}),img:(0,n.css)({width:"147px",height:"147px",fill:U.colors.text.primary})}),j=U=>{const{value:F,onChange:M,mediaType:H,folderName:_,maxFiles:Z,hidePopper:ne}=U,te=(0,l.of)(V),Y=()=>{M(F),ne?.()},Q=(0,m.useRef)(null),{dialogProps:J}=(0,r.s)({},Q),{overlayProps:q}=(0,s.e)({onClose:Y,isDismissable:!0,isOpen:!0},Q),X=F&&F.includes("://"),[se,oe]=(0,m.useState)(F??""),[ae,ie]=(0,m.useState)(X?i.QC.URL:i.QC.Folder),[fe,pe]=(0,m.useState)(new FormData),[de,le]=(0,m.useState)(!1),[me,De]=(0,m.useState)({message:""}),Te=Me=>`${te.resourcePickerPopoverTab} ${ae===Me&&te.resourcePickerPopoverActiveTab}`,Ne=()=>(0,t.jsx)(T,{value:F,mediaType:H,folderName:_,newValue:se,setNewValue:oe,maxFiles:Z}),Ce=()=>(0,t.jsx)(N,{newValue:se,setNewValue:oe,mediaType:H}),He=()=>(0,t.jsx)(y,{mediaType:H,setFormData:pe,setUpload:le,newValue:se,error:me}),ke=()=>{switch(ae){case i.QC.Folder:return Ne();case i.QC.URL:return Ce();case i.QC.Upload:return He();default:return Ne()}};return(0,t.jsx)(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,t.jsx)("section",{ref:Q,...q,...J,children:(0,t.jsxs)("div",{className:te.resourcePickerPopover,children:[(0,t.jsxs)("div",{className:te.resourcePickerPopoverTabs,children:[(0,t.jsx)("button",{className:Te(i.QC.Folder),onClick:()=>ie(i.QC.Folder),children:(0,t.jsx)(u.x6,{i18nKey:"dimensions.resource-picker-popover.folder",children:"Folder"})}),(0,t.jsx)("button",{className:Te(i.QC.URL),onClick:()=>ie(i.QC.URL),children:(0,t.jsx)(u.x6,{i18nKey:"dimensions.resource-picker-popover.url",children:"URL"})})]}),(0,t.jsxs)("div",{className:te.resourcePickerPopoverContent,children:[ke(),(0,t.jsxs)("div",{className:te.buttonRow,children:[(0,t.jsx)(f.$n,{variant:"secondary",onClick:()=>Y(),fill:"outline",children:(0,t.jsx)(u.x6,{i18nKey:"dimensions.resource-picker-popover.cancel",children:"Cancel"})}),(0,t.jsx)(f.$n,{variant:se&&se!==F?"primary":"secondary",onClick:()=>{de?fetch("/api/storage/upload",{method:"POST",body:fe}).then(Me=>{if(Me.status>=400){Me.json().then($e=>De($e));return}else return Me.json()}).then(Me=>{(0,a.AI)().get(`api/storage/read/${Me.path}`).then(()=>oe(`${h.$W.appUrl}api/storage/read/${Me.path}`)).then(()=>M(`${h.$W.appUrl}api/storage/read/${Me.path}`)).then(()=>ne?.())}).catch(Me=>console.error(Me)):(M(se),ne?.())},children:(0,t.jsx)(u.x6,{i18nKey:"dimensions.resource-picker-popover.select",children:"Select"})})]})]})]})})})},V=U=>({resourcePickerPopover:(0,n.css)({borderRadius:U.shape.radius.default,boxShadow:U.shadows.z3,background:U.colors.background.primary,border:`1px solid ${U.colors.border.weak}`}),resourcePickerPopoverTab:(0,n.css)({width:"50%",textAlign:"center",padding:U.spacing(1,0),background:U.colors.background.secondary,color:U.colors.text.secondary,fontSize:U.typography.bodySmall.fontSize,cursor:"pointer",border:"none","&:focus:not(:focus-visible)":{outline:"none",boxShadow:"none"},":focus-visible":{position:"relative"}}),resourcePickerPopoverActiveTab:(0,n.css)({color:U.colors.text.primary,fontWeight:U.typography.fontWeightMedium,background:U.colors.background.primary}),resourcePickerPopoverContent:(0,n.css)({width:"315px",fontSize:U.typography.bodySmall.fontSize,minHeight:"184px",padding:U.spacing(1),display:"flex",flexDirection:"column"}),resourcePickerPopoverTabs:(0,n.css)({display:"flex",width:"100%",borderRadius:`${U.shape.radiu
278s.default} ${U.shape.radius.default} 0 0`}),buttonRow:(0,n.css)({display:"flex",justifyContent:"center",gap:U.spacing(2),padding:U.spacing(1)})})},40665:(ee,B,e)=>{"use strict";e.d(B,{MediaType:()=>t.zu,ResourceFolderName:()=>t.Iu,findField:()=>s.UI,findFieldIndex:()=>s.gG,getColorDimension:()=>m,getPublicOrAbsoluteUrl:()=>g.D,getResourceDimension:()=>g.$,getScalarDimension:()=>c.H,getScaledDimension:()=>l.hX,getTextDimension:()=>i});var t=e(4896),n=e(76637),r=e(79118),o=e(11576),s=e(32503);function m(y,P,d){return a((0,s.UI)(y,P.field),P,d)}function a(y,P,d){if(!y){const E=d.visualization.getColorByName(P.fixed??"grey");return{isAssumed:!!P.field?.length||!P.fixed,fixed:E,value:()=>E,get:v=>E}}const D=(0,n.Qi)(y);if(D.isByValue||y.config.mappings?.length){const E=(0,r.xg)(y,!0);E!==y.config&&(y={...y,config:E},y.state=void 0);const v=(0,o.J)({field:y,theme:d}),C=S=>v(S).color??"#ccc";return{field:y,get:S=>C(y.values[S]),value:()=>C((0,s.sB)(y))}}const b=D.getCalculator(y,d)(0,0);return{fixed:b,value:()=>b,get:E=>b,field:y}}var l=e(10392),f=e(95004),h=e(55386),u=e(739);function i(y,P){const d=P.field?(0,s.UI)(y,P.field):y?.fields.find(D=>D.type===f.PU.string);return x(d,P)}function x(y,P){let d=P.fixed;const D=P.mode??u.RU.Fixed;if(D===u.RU.Fixed)return{isAssumed:!d,fixed:d,value:()=>d,get:E=>d};if(D===u.RU.Template){const E=v=>`TEMPLATE[${P.fixed} // ${v}]`;return y?{field:y,get:v=>E(y.values[v]),value:()=>E((0,s.sB)(y))}:(d=E(""),{isAssumed:!0,fixed:d,value:()=>d,get:v=>d})}if(!y)return{isAssumed:!0,fixed:d,value:()=>d,get:E=>d};let b=E=>(0,h.cN)(y.display(E));return{field:y,get:E=>b(y.values[E]),value:()=>b((0,s.sB)(y))}}var g=e(20012),p=e(29869),c=e(57444)},20012:(ee,B,e)=>{"use strict";e.d(B,{$:()=>o,D:()=>r});var t=e(739),n=e(32503);function r(s){return s?s.indexOf(":/")>0?s:window.__grafana_public_path__+s:""}function o(s,m){const a=m.mode??t.q_.Fixed;if(a===t.q_.Fixed){const h=r(m.fixed);return{isAssumed:!h,fixed:h,value:()=>h,get:u=>h}}const l=(0,n.UI)(s,m.field);if(!l){const h="";return{isAssumed:!0,fixed:h,value:()=>h,get:u=>h}}if(a===t.q_.Mapping){const h=u=>r(`${u}`);return{field:l,get:u=>h(l.values[u]),value:()=>h((0,n.sB)(l))}}const f=h=>{if(l&&l.display){const u=l.display(h).icon;return r(u??"")}return""};return{field:l,get:h=>f(l.values[h]),value:()=>f((0,n.sB)(l))}}},57444:(ee,B,e)=>{"use strict";e.d(B,{H:()=>r});var t=e(739),n=e(32503);function r(s,m){return o((0,n.UI)(s,m?.field),m)}function o(s,m){if(!s){const f=m.fixed??0;return{isAssumed:!!m.field?.length||!m.fixed,fixed:f,value:()=>f,get:()=>f}}let a=f=>f%m.max;return m.mode===t.WQ.Clamped&&(a=f=>f<m.min?m.min:f>m.max?m.max:f),{field:s,get:f=>{const h=s.values[f];return h===null||typeof h!="number"?0:a(h)},value:()=>(0,n.sB)(s)}}},10392:(ee,B,e)=>{"use strict";e.d(B,{Nn:()=>m,Ru:()=>a,hX:()=>o});var t=e(79118),n=e(739),r=e(32503);function o(l,f){return s((0,r.UI)(l,f?.field),f)}function s(l,f,h){if(!l){const c=f.fixed??0;return{isAssumed:!!f.field?.length||!f.fixed,fixed:c,value:()=>c,get:()=>c}}const u=(0,t.AP)(l),i=f.max-f.min;if(l.values.length<1||i<=0||u.delta<=0)return{fixed:f.min,value:()=>f.min,get:()=>f.min};let g=c=>f.min+c*i;if(h===n.QH.Quad){const c=Math.PI*(f.max/2)**2,y=Math.PI*(f.min/2)**2,P=c-y;g=d=>{let D=y+P*d;return Math.sqrt(D/Math.PI)*2}}const p=c=>{const y=l.values[c];let P=0;return y!==-1/0&&(P=(y-u.min)/u.delta),P>1?P=1:P<0&&(P=0),g(P)};return{get:p,value:()=>p((0,r.sB)(l)),field:l}}function m(l){return l||(l={min:0,max:1}),l.min==null&&(l.min=0),l.max==null&&(l.max=1),l}function a(l,f){let{min:h,max:u}=m(f);if(l||(l={}),l.max==null&&(l.max=u),l.min==null&&(l.min=h),l.min>l.max){const i=l.max;l.max=l.min,l.min=i}return l.min<h&&(l.min=h),l.max>u&&(l.max=u),l.fixed==null&&(l.fixed=l.min+(l.max-l.min)/2),l.field||(l.fixed>u?l.fixed=u:l.fixed<h&&(l.fixed=h)),l}},4896:(ee,B,e)=>{"use strict";e.d(B,{Iu:()=>r,Iy:()=>m,QC:()=>s,nG:()=>n,zu:()=>o});var t=e(739);const n=Object.freeze({fixed:"",mode:t.RU.Field,field:""});var r=(a=>(a.Icon="img/icons/unicons",a.IOT="img/icons/iot",a.Marker="img/icons/marker",a.BG="img/bg",a))(r||{}),o=(a=>(a.Icon="icon",a.Image="image",a))(o||{}),s=(a=>(a.Folder="folder",a.URL="url",a.Upload="upload",a))(s||{}),m=(a=>(a.SMALL="small",a.NORMAL="normal",a))(m||{})},32503:(ee,B,e)=>{"use strict";e.d(B,{B_:()=>f,UI:()=>u,Wb:()=>m,XV:()=>a,b5:()=>l,gG:()=>i,sB:()=>x,wv:()=>h});var t=e(16515),n=e(46644),r=e(43173),o=e(40665),s=e(57444);function m(g,p){if(g?.series&&p.field)for(const c of g.series){const y=(0,o.getColorDimension)(c,p,r.$.theme2);
278if(!y.isAssumed||g.series.length===1)return y}return(0,o.getColorDimension)(void 0,p,r.$.theme2)}function a(g,p){if(g?.series&&p.field)for(const c of g.series){const y=(0,o.getScaledDimension)(c,p);if(!y.isAssumed||g.series.length===1)return y}return(0,o.getScaledDimension)(void 0,p)}function l(g,p){if(g?.series&&p.field)for(const c of g.series){const y=(0,s.H)(c,p);if(!y.isAssumed||g.series.length===1)return y}return(0,s.H)(void 0,p)}function f(g,p){if(g?.series&&p.field)for(const c of g.series){const y=(0,o.getResourceDimension)(c,p);if(!y.isAssumed||g.series.length===1)return y}return(0,o.getResourceDimension)(void 0,p)}function h(g,p){if(g?.series&&p.field)for(const c of g.series){const y=(0,o.getTextDimension)(c,p);if(!y.isAssumed||g.series.length===1)return y}return(0,o.getTextDimension)(void 0,p)}function u(g,p){const c=i(p,g);return c==null?void 0:g.fields[c]}function i(g,p,c){if(!(!p||!g?.length))for(let y=0;y<p.fields.length;y++){const P=p.fields[y];if(g===P.name)return y;const d=(0,t.Ct)(P,p,c);if(g===d)return y}}function x(g){const p=g.state?.calcs;if(p){const P=p[n.gy.lastNotNull];if(P!=null)return P}const c=g.values;let y=c.length-1;for(;y>=0;){const P=c[y--];if(P!=null)return P}}},97486:(ee,B,e)=>{"use strict";e.d(B,{k:()=>v});var t=e(74848),n=e(2543),r=e(96540),o=e(37297),s=e(64394),m=e(60519),a=e(16515),l=e(84229),f=e(60311),h=e(739),u=e(63142),i=e(64400),x=e(12241),g=e(78013),p=e(89381),c=e(1932);function y(C,S,O){return(0,c.jM)(C,I=>{I.defaults.custom===void 0&&(I.defaults.custom={}),I.defaults.max=O;const{custom:R}=I.defaults;switch(R.stacking===void 0&&(R.stacking={group:"A"}),S){case"lines":R.drawStyle=h.GR.Line,R.stacking.mode=h.gs.None,R.fillOpacity=0;break;case"bars":R.drawStyle=h.GR.Bars,R.stacking.mode=h.gs.None,R.fillOpacity=100;break;case"points":R.drawStyle=h.GR.Points,R.stacking.mode=h.gs.None,R.fillOpacity=0;break;case"stacked_lines":R.drawStyle=h.GR.Line,R.stacking.mode=h.gs.Normal,R.fillOpacity=100,R.axisSoftMin=0;break;case"stacked_bars":R.drawStyle=h.GR.Bars,R.stacking.mode=h.gs.Normal,R.fillOpacity=100,R.axisSoftMin=0;break;default:{const T=S;throw new Error(`Invalid graph-style: ${T}`)}}})}function P(C,S,O){return(0,c.jM)(C,I=>{I.defaults.thresholds=O,I.defaults.custom=I.defaults.custom??{},I.defaults.custom.thresholdsStyle=S})}var d=e(56737),D=e(84596),b=e(76732);function E(C){const[S,{inc:O}]=(0,d.A)(1),I=(0,D.A)(C);return(0,r.useMemo)(()=>{I&&!(0,b.J3)(C,I,b.bW)&&O()},[C,I,O]),S}function v({data:C,height:S,width:O,timeZone:I,timeRange:R,onChangeTime:T,loadingState:L,annotations:K,onHiddenSeriesChanged:A,splitOpenFn:W,graphStyle:N,tooltipDisplayMode:w=h.$N.Single,anchorToZero:j=!1,yAxisMaximum:V,thresholdsConfig:U,thresholdsStyle:F,eventBus:M,vizLegendOverrides:H,toggleLegendRef:_}){const Z=(0,u.$j)(),ne=(0,r.useMemo)(()=>(0,o.O)((0,x.V)(x.S),"Explore"),[]),[te,Y]=(0,r.useState)({defaults:{min:j?0:void 0,max:V||void 0,unit:"short",color:{mode:s.Y.PaletteClassic},custom:{drawStyle:h.GR.Line,fillOpacity:0,pointSize:5}},overrides:[]}),Q=(0,r.useMemo)(()=>{const de=y(te,N,V);return P(de,F,U)},[te,N,V,U,F]),J=(0,p.h)(W,R),q=(0,r.useMemo)(()=>(0,m.we)({fieldConfig:Q,data:C,timeZone:I,replaceVariables:de=>de,theme:Z,fieldConfigRegistry:ne,dataLinkPostProcessor:J}),[ne,C,I,Z,Q,J]),X=(0,r.useMemo)(()=>(0,m.we)({fieldConfig:{defaults:{},overrides:[]},data:K,timeZone:I,replaceVariables:de=>de,theme:Z,dataLinkPostProcessor:J}),[K,I,Z,J]),se=E(q),oe=(0,r.useRef)(A),ae=(0,r.useRef)(void 0);(0,r.useEffect)(()=>{if(oe.current){const de=[];q.forEach(le=>{le.fields.map(De=>De.config?.custom?.hideFrom?.viz).every(n.identity)&&de.push((0,a.Ri)(le))}),(ae.current===void 0||!(0,n.isEqual)((0,n.sortBy)(de),(0,n.sortBy)(ae.current)))&&(ae.current=de,oe.current(de))}},[q]);const ie={eventsScope:"explore",eventBus:M,sync:()=>l.y.Off,onToggleSeriesVisibility(de,le){Y((0,g.M)(de,le,te,C))},dataLinkPostProcessor:J};function fe(de,le){Y((0,g.M)(de,le,te,C))}_&&(_.current=fe);const pe=(0,r.useMemo)(()=>({tooltip:{mode:w,sort:h.xB.None},legend:{displayMode:h.lm.List,showLegend:!0,placement:"bottom",calcs:[],...H}}),[w,H]);return(0,t.jsx)(i.XF,{value:ie,children:(0,t.jsx)(f.m,{data:{series:q,timeRange:R,state:L,annotations:X,structureRev:se},pluginId:"timeseries",title:"",width:O,height:S,onChangeTimeRange:T,timeZone:I,options:pe})})}},5929:(ee,B,e)=>{"use strict";e.d(B,{y:()=>D});var t=e(74848),n=e(96540),r=e(42941),o=e(67522),s=e(56840),m=e(15757),a=e(83953),l=e(97486),f=e(77824),h=e(96673);const u=h.EXPLORE_GRAPH_STYLES.map(b=>({value:b,label:b[0].toUpperCase()+b.slice(1).replace(/_/," ")}));function i(b){const{graphStyle:E,onChangeGraphStyle:v}=b;return(0,t.jsx)(f.z,{size:"sm",options:u,value:E,onChange:v})}var x=e(29043);const g="grafana.explore.style.graph",p=b=>{store.set(g,b)},c=()=>P(x.A.get(g)),y="lines",P=b=>h.EXPLORE_GRAPH_STYLES.find(v=>v===b)??y,d=20,D=({data:b,eventBus:E,height:v,width:C,timeRange:S,timeZone:O,annotations:I,onChangeTime:R,splitOpenFn:T,thresholdsConfig:L,thresholdsStyle:K,loadingState:A,statusMessage:W})=>
278{const[N,w]=(0,r.A)(!1),[j,V]=(0,n.useState)(c),U=(0,n.useCallback)(M=>{(0,a.ng)(M),V(M)},[]),F=(0,n.useMemo)(()=>N?b:b.slice(0,d),[b,N]);return(0,t.jsx)(o.NR,{title:(0,s.t)("graph.container.title","Graph"),titleItems:[!N&&d<b.length&&(0,t.jsx)(m.m,{toggleShowAllSeries:w,info:(0,t.jsxs)(s.x6,{i18nKey:"graph.container.show-only-series",children:["Showing only ",{MAX_NUMBER_OF_TIME_SERIES:d}," series"]}),buttonLabel:(0,t.jsxs)(s.x6,{i18nKey:"graph.container.show-all-series",children:["Show all ",{length:b.length}]}),tooltip:(0,s.t)("graph.container.content","Rendering too many series in a single panel may impact performance and make data harder to read. Consider refining your queries.")},"disclaimer")].filter(Boolean),width:C,height:v,loadingState:A,statusMessage:W,actions:(0,t.jsx)(i,{graphStyle:j,onChangeGraphStyle:U}),children:(M,H)=>(0,t.jsx)(l.k,{graphStyle:j,data:F,height:H,width:M,timeRange:S,onChangeTime:R,timeZone:O,annotations:I,splitOpenFn:T,loadingState:A,thresholdsConfig:L,thresholdsStyle:K,eventBus:E})})}},15757:(ee,B,e)=>{"use strict";e.d(B,{m:()=>a});var t=e(74848),n=e(22803),r=e(63142),o=e(30703),s=e(45967),m=e(45861);function a(f){const{toggleShowAllSeries:h,info:u,tooltip:i,buttonLabel:x}
278=f,g=(0,r.of)(l);return(0,t.jsxs)("div",{className:g.disclaimer,children:[(0,t.jsxs)("span",{className:g.warningMessage,children:[(0,t.jsx)(o.I,{name:"exclamation-triangle","aria-hidden":"true"}),u]}),(0,t.jsx)(s.m,{content:i,children:(0,t.jsx)(m.$n,{variant:"secondary",size:"sm",onClick:h,children:x})})]},"disclaimer")}const l=f=>({disclaimer:(0,n.css)({label:"series-disclaimer",display:"flex",alignItems:"center",gap:f.spacing(1)}),warningMessage:(0,n.css)({display:"flex",alignItems:"center",gap:f.spacing(.5),color:f.colors.warning.main,fontSize:f.typography.bodySmall.fontSize})})},67155:(ee,B,e)=>{"use strict";e.d(B,{O:()=>g,v:()=>c});var t=e(74848),n=e(96540),r=e(75505),o=e(41119),s=e(739),m=e(60519),a=e(95004),l=e(2197),f=e(39443),h=e(43173),u=e(24343),i=e(36100),x=e(78529);function g(D){const{timeZone:b,splitOpen:E,range:v,logsSortOrder:C,width:S,dataFrame:O,columnsWithMeta:I,logsFrame:R}=D,[T,L]=(0,n.useState)(void 0),K=R?.timeField.index,A=(0,n.useCallback)(N=>{if(!N.length)return N;const w=(0,o.ES)(N,K,C===s.uH.Descending),[j]=(0,m.we)({data:[w],timeZone:b,theme:h.$.theme2,replaceVariables:V=>V,fieldConfig:{defaults:{custom:{}},overrides:[]}});for(const V of j.fields)V.getLinks=U=>(0,x.QL)({field:V,rowIndex:U.valueRowIndex,splitOpenFn:E,range:v,dataFrame:w}),V.config={...V.config,custom:{inspect:!0,filterable:!0,width:d(V),...V.config.custom},filterable:p(V,R?.bodyField.name??"",R?.timeField.name??"")},V.type=V.type===a.PU.string?(0,o.dF)(V)??a.PU.string:V.type;return j},[C,b,E,v,R?.bodyField.name,R?.timeField.name,K]);if((0,n.useEffect)(()=>{(async()=>{if(!R?.timeField.name||!R?.bodyField.name){L(void 0);return}const w=c(O);let j=y(I);const V=P(j);if(V?w.push(V):w.push({id:"organize",options:{indexByName:{[R.bodyField.name]:0,[R.timeField.name]:1},includeByName:{[R.bodyField.name]:!0,[R.timeField.name]:!0}}}),w.length>0){const U=await(0,r.s)((0,l.m)(w,[O])),F=A(U[0]);L(F)}else L(A(O))})()},[I,O,C,A,R?.bodyField.name,R?.timeField.name]),!T)return null;const W=N=>{const{value:w,key:j,operator:V}=N,{onClickFilterLabel:U,onClickFilterOutLabel:F}=D;!U||!F||(V===i.mc&&U(j,w,O),V===i.Zi&&F(j,w,O))};return(0,t.jsx)(u.X,{data:T,width:S,onCellFilterAdded:D.onClickFilterLabel&&D.onClickFilterOutLabel?W:void 0,height:D.height,footerOptions:{show:!0,reducer:["count"],countRows:!0},initialSortBy:[{displayName:R?.timeField.name||"",desc:C===s.uH.Descending}]})}const p=(D,b,E)=>!(!b||!E||b===D.name||E===D.name||D.config.links?.length);function c(D){return D.fields.filter(b=>{const E=b.typeInfo?.frame==="json.RawMessage"&&b.name==="labels"&&D?.meta?.type!==f.m.LogLines,v=b.name==="labels"&&b.type===a.PU.other&&D?.meta?.type===f.m.LogLines;return E||v}).flatMap(b=>[{id:"extractFields",options:{format:"json",keepTime:!1,replace:!1,source:b.name}}])}function y(D){let b={};return Object.keys(D).filter(E=>D[E].active).forEach(E=>{const v=D[E].index;v!==void 0&&(b[E]=v)}),b}function P(D){let b={};for(const E in D)b[E]=!0;return Object.keys(D).length>0?{id:"organize",options:{indexByName:D,includeByName:b}}:null}function d(D){if(D.type===a.PU.time)return 200}},44720:(ee,B,e)=>{"use strict";e.d(B,{a:()=>a,d:()=>l});var t=e(74848),n=e(22803),r=e(96944),o=e(63142),s=e(3642);const m=(f,h)=>({valueNavigation:(0,n.css)({width:s.QH,fontWeight:"bold"}),valueNavigationWrapper:(0,n.css)({display:"flex",justifyContent:"flex-end"}),itemLabelsWrap:(0,n.css)({borderBottom:h?`1px solid ${f.colors.border.medium}`:""})}),a=f=>f.includes(r.gs)?f.replace(r.gs,""):f,l=({valueLabels:f,expanded:h})=>{const u=(0,o.of)(m,h);return(0,t.jsx)("div",{className:u.itemLabelsWrap,children:(0,t.jsx)("div",{className:u.valueNavigationWrapper,children:f.map((i,x)=>(0,t.jsx)("span",{className:u.valueNavigation,children:a(i.name)},i.name))})})}},3642:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>E,QH:()=>y,Jd:()=>P});var t=e(74848),n=e(22803),r=e(73287),o=e(31200),s=e(27489),m=e(63142),a=e(76319),l=e(56840),f=e(44720),h=e(53593);const u=(v,C)=>({rowWrapper:(0,n.css)({position:"relative",minWidth:y,paddingRight:"5px"}),rowValue:(0,n.css)({whiteSpace:"nowrap",overflowX:"auto",MsOverflowStyle:"none",scrollbarWidth:"none",display:"block",paddingRight:"10px","&::-webkit-scrollbar":{display:"none"},"&:before":{pointerEvents:"none",content:"''",width:"100%",height:"100%",position:"absolute",left:0,top:0,background:`linear-gradient(to right, transparent calc(100% - 25px), ${v.colors.background.primary})`}}),rowValuesWrap:(0,n.css)({paddingLeft:P,width:`calc(${C} * ${y})`,display:"flex"})}),i=({totalNumberOfValues:v,values:C,hideFieldsWithoutValues:S})=>{const O=(0,m.of)(u,v);return(0,t.jsx)("div",{role:"cell",className:O.rowValuesWrap,children:C?.map(I=>S&&(I.value===void 0||I.value===h.M)?null:(0,t.jsx)("span",{className:O.rowWrapper,children:(0,t.jsx)("span",{className:O.rowValue,children:I.value})},I.key))})},x=v=>{const C=v.isDark?"#ce9178":"#a31515",S=v.isDark?"#73bf69":"#56a64b";return{metricName:(0,n.css)({color:S}),metricValue:(0,n.css)({color:C}),expanded:(0,n.css)({display:"block",textIndent:"1em"})}},p=({value:v,index:C,length:S,isExpandedView:O})=>{const I=(0,m.of)(x),R=v.key,T=v.value;return(0,t.jsxs)("span",{className:O?I.expanded:"",children:[(0,t.jsx)("span",{className:I.metricName,children:R}),(0,t.jsx)("span",{children:"="}),(0,t.jsx)("span",{children:'"'}),(0,t.jsx)("span",{className:I.metricValue,children:T}),(0,t.jsx)("span",{children:'"'}),C<S-1&&(0,t.jsx)("span",{children:", "})]},C)},c="20px",y="80px",P="25px",d=(v,C,S)=>({rowWrapper:(0,n.css)({borderBottom:`1px solid ${v.colors.border.medium}`,display:"flex",position:"relative",paddingLeft:"22px",alignItems:S?"":"center",height:S?"":"100%"}),copyToClipboardWrapper:(0,n.css)({position:"absolute",left:0,bottom:S?"":"0",top:S?"4px":"0",margin:"auto",zIndex:1,height:"16px",width:"16px"}),rowLabelWrapWrap:(0,n.css)({position:"relative",width:`calc(100% - (${C} * ${y}) - ${P})`}),rowLabelWrap:(0,n.css)({whiteSpace:"nowrap",overflowX:"auto",MsOverflowStyle:"none",scrollbarWidth:"none",paddingRight:c,"&::-webkit-scrollbar":{display:"none"},"&:after":{pointerEvents:"none",content:"''",width:"100%",height:"100%",position:"absolute",left:0,top:0,background:`linear-gradient(to right, transparent calc(100% - ${c}), ${v.colors.background.primary})`}})});function D(v){let C=[],S=[];for(const O in v)O in v&&v[O]&&!O.includes("Value")?C.push({key:O,value:v[O]}):O in v&&v[O]&&O.includes("Value")&&S.push({key:O,value:v[O]});return{values:S,attributeValues:C}}const E=({listItemData:v,listKey:C,totalNumberOfValues:S,valueLabels:O,isExpandedView:I})=>{const{__name__:R,...T}=v,L=(0,o.Rq)(R),[K,A]=(0,r.A)(),W=O?.length??S,N=(0,m.of)(d,W,I),{values:w,attributeValues:j}=D(T),V=M=>M==="\u221E"||M==="Infinity"?"+Inf":M,U=`${L?R:""}{${L?"":`"${R}", `}${j.map(M=>`${(0,o.Nc)(M.key)}="${V(M.value)}"`)}}`,F=!!(O&&O?.length);return(0,t.jsxs)(t.Fragment,{children:[O!==void 0&&I&&(0,t.jsx)(f.d,{valueLabels:O,expanded:I}),(0,t.jsxs)("div",{className:N.rowWrapper,children:[(0,t.jsx)("span",{className:N.copyToClipboardWrapper,children:(0,t.jsx)(a.K,{tooltip:(0,l.t)("explore.raw-list-item.tooltip-copy-to-cl
278ipboard","Copy to clipboard"),onClick:()=>{(0,s.rR)("grafana_explore_prometheus_instant_query_ui_raw_toggle_expand"),A(U)},name:"copy"})}),(0,t.jsx)("span",{role:"cell",className:N.rowLabelWrapWrap,children:(0,t.jsxs)("div",{className:N.rowLabelWrap,children:[L&&(0,t.jsx)("span",{children:R}),(0,t.jsx)("span",{children:"{"}),!L&&R!==""&&(0,t.jsxs)("span",{children:['"',R,'"',", "]}),(0,t.jsx)("span",{children:j.map((M,H)=>(0,t.jsx)(p,{isExpandedView:I,value:M,index:H,length:j.length},H))}),(0,t.jsx)("span",{children:"}"})]})}),(0,t.jsx)(i,{hideFieldsWithoutValues:F,totalNumberOfValues:W,values:w})]},C)]})}},53593:(ee,B,e)=>{"use strict";e.d(B,{E:()=>r,M:()=>n});var t=e(55386);const n=" ",r=o=>{const s={},m=[],a=o.fields.filter(h=>!["Time"].includes(h.name));let l=a.find(h=>h.name==="__name__")?.values??[];!l.length&&a.length&&a[0].values.length&&(l=Array(a[0].values.length).fill(""));const f=o.fields.filter(h=>!["__name__"].includes(h.name));return l.forEach(function(h,u){s[h]={};const i=s[h][u]??{};for(const x of f){const g=x.name;if(g!=="Time")if(typeof x?.display=="function"){const p=x?.display(x.values[u]);if(!isNaN(p.numeric))i[g]=p.numeric.toString(10);else{const c=(0,t.cN)(p);c?i[g]=c:g.includes("Value #")&&(i[g]=n)}}else console.warn("Field display method is missing!")}m.push({...i,__name__:h})}),m}},52830:(ee,B,e)=>{"use strict";e.d(B,{YZ:()=>l,sz:()=>a,tU:()=>s});var t=e(74848),n=e(96540),r=e(96673),o=e(20718),s=(f=>(f.RichHistory="Query history",f.Starred="Starred",f.Settings="Settings",f))(s||{});const m=(0,n.createContext)({selectedTab:"Query history",setSelectedTab:()=>{},drawerOpened:!1,setDrawerOpened:()=>{}});function a(){return(0,n.useContext)(m)}function l({children:f}
278){const[h,u]=(0,n.useState)("Query history"),[i,x]=(0,n.useState)(!1),g=(0,r.useSelector)(o.i6);return(0,n.useEffect)(()=>{g&&u(g.starredTabAsFirstTab?"Starred":"Query history")},[g,u]),(0,t.jsx)(m.Provider,{value:{selectedTab:h,setSelectedTab:u,drawerOpened:i,setDrawerOpened:x},children:f})}},98838:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>r});var t=e(96540);const n=(0,t.createContext)({openDrawer:()=>{},closeDrawer:()=>{},isDrawerOpen:!1,openAddQueryModal:()=>{},closeAddQueryModal:()=>{},renderSaveQueryButton:()=>null,queryLibraryEnabled:!1});function r(){return(0,t.useContext)(n)}},55555:(ee,B,e)=>{"use strict";e.d(B,{g:()=>r});var t=e(74848),n=e(25229);const r=({timeInMs:s,className:m,humanize:a})=>(0,t.jsx)("span",{className:m,children:o(s,a)}),o=(s,m=!1)=>{const a=s/1e3;if(!m)return`${a.toFixed(1)}s`;const l=(0,n.Ah)(a,"seconds"),f=l.hours(),h=l.minutes(),u=l.seconds();return f?`${f}h ${h}m ${u}s`:h?`${h}m ${u}s`:`${u}s`}},49987:(ee,B,e)=>{"use strict";e.d(B,{H:()=>W});var t=e(74848),n=e(2543),r=e(96540),o=e(49785),s=e(27489),m=e(37386),a=e(77824),l=e(34999),f=e(22787),h=e(45861),u=e(95506),i=e(73427),x=e(56840),g=e(96673),p=e(92138),c=e(43173),y=e(36490),P=e(29043),d=e(65635),D=(N=>(N.UNKNOWN="unknown-error",N.NAVIGATION="navigation-error",N))(D||{}),b=(N=>(N.FETCH_DASHBOARD="fetch-dashboard",N.SET_DASHBOARD_LS="set-dashboard-ls-error",N))(b||{});function E({panel:N,dashboardUid:w,openInNewTab:j,timeRange:V}){let U={meta:{},dashboard:{title:"",uid:"",panels:[N],schemaVersion:d.O2}};if(V){const M=V.raw;U.dashboard.time={from:typeof M.from=="string"?M.from:M.from.toISOString(),to:typeof M.to=="string"?M.to:M.to.toISOString()}}try{P.A.setObject(g.DASHBOARD_FROM_LS_KEY,U)}catch{return{error:"set-dashboard-ls-error",message:"Could not add panel to dashboard. Please try again."}}const F=v(w);if(j)return!e.g.open(c.$.appUrl+F,"_blank")?(P.A.delete(g.DASHBOARD_FROM_LS_KEY),{error:"navigation-error",message:"Could not navigate to the selected dashboard. Please try again."}):void 0;y.Ny.push(p.I.stripBaseFromUrl(F))}function v(N){return N?`d/${N}`:"dashboard/new"}var C=(N=>(N.NewDashboard="new-dashboard",N.ExistingDashboard="existing-dashboard",N))(C||{});function S({onClose:N,buildPanel:w,timeRange:j,options:V,children:U}){const[F,M]=(0,r.useState)(),{handleSubmit:H,control:_,formState:{errors:Z},watch:ne}=(0,o.mN)({defaultValues:{saveTarget:"new-dashboard"}}),te=i.TP.hasPermission(g.AccessControlAction.DashboardsCreate),Y=i.TP.hasPermission(g.AccessControlAction.DashboardsWrite),Q=[];te&&Q.push({label:"New dashboard",value:"new-dashboard"}),Y&&Q.push({label:"Existing dashboard",value:"existing-dashboard"});const J=Q.length>1?ne("saveTarget"):Q[0].value,q=(X,se)=>{M(void 0);const oe=se.saveTarget==="existing-dashboard"?se.dashboardUid:void 0,ae=w(V);(0,s.rR)("e_2_d_submit",{newTab:X,saveTarget:se.saveTarget,queries:ae.targets});const ie=E({dashboardUid:oe,panel:ae,openInNewTab:X,timeRange:j});if(ie){M(ie);return}N()};return(0,r.useEffect)(()=>{(0,s.rR)("e_2_d_open")},[]),(0,t.jsxs)("form",{children:[U,Q.length>1&&(0,t.jsx)(o.xI,{control:_,render:({field:{ref:X,...se}})=>(0,t.jsx)(m.D,{label:(0,x.t)("dashboard-scene.add-to-dashboard-form.label-target-dashboard","Target dashboard"),description:(0,x.t)("dashboard-scene.add-to-dashboard-form.description-choose-where-to-add-the-panel","Choose where to add the panel."),children:(0,t.jsx)(a.z,{options:Q,...se,id:"e2d-save-target"})}),name:"saveTarget"}),J==="existing-dashboard"&&(0,t.jsx)(o.xI,{render:({field:{ref:X,value:se,onChange:oe,...ae}})=>(0,t.jsx)(m.D,{label:(0,x.t)("dashboard-scene.add-to-dashboard-form.label-dashboard","Dashboard"),description:(0,x.t)("dashboard-scene.add-to-dashboard-form.description-select-which-dashboard-panel-created","Select in which dashboard the panel will be created."),error:Z.dashboardUid?.message,invalid:!!Z.dashboardUid,children:(0,t.jsx)(u.b,{...ae,inputId:"e2d-dashboard-picker",defaultOptions:!0,onChange:ie=>oe(ie?.uid)})}),control:_,name:"dashboardUid",shouldUnregister:!0,rules:{required:{value:!0,message:"This field is required."}}}),F&&(0,t.jsx)(l.F,{severity:"error",title:(0,x.t)("dashboard-scene.add-to-dashboard-form.title-error-adding-the-panel","Error adding the panel"),children:F.message}),(0,t.jsxs)(f.a.ButtonRow,{children:[(0,t.jsx)(h.$n,{type:"reset",onClick:N,fill:"outline",variant:"secondary",children:(0,t.jsx)(x.x6,{i18nKey:"dashboard-scene.add-to-dashboard-form.cancel",children:"Cancel"})}),(0,t.jsx)(h.$n,{type:"submit",variant:"secondary",onClick:H((0,n.partial)(q,!0)),icon:"external-link-alt",children:(0,t.jsx)(x.x6,{i18nKey:"dashboard-scene.add-to-dashboard-form.open-in-new-tab",children:"Open in new tab"})}),(0,t.jsx)(h.$n,{type:"submit",variant:"primary",onClick:H((0,n.partial)(q,!1)),icon:"apps",children:(0,t.jsx)(x.x6,{i18nKey:"dashboard-scene.add-to-dashboard-form.open-dashboard",children:"Open dashboard"})})]})]})}function O(N){}var I=e(20718);function R(N,w){let j=[];return N==="table"&&w.panelState?.logs?.columns&&(w.panelState.logs?.labelFieldName&&j.push({id:"extractFields",options:{source:w.panelState.logs.labelFieldName}}),j.push({id:"organize",options:{indexByName:Object.values(w.panelState.logs.columns).reduce((V,U,F)=>({...V,[U]:F}),{}),includeByName:Object.values(w.panelState.logs.columns).reduce((V,U)=>({...V,[U]:!0}),{})}})),j}function T(N){const w=A(N.queries,N.queryResponse,N?.panelState);return{targets:N.queries,type:w,title:"New Panel",gridPos:{x:0,y:0,w:12,h:8},datasource:N.datasource,transformations:R(w,N)}}const L=N=>!N.hide,K=N=>w=>w.refId===N;function A(N,w,j){for(const{refId:V}of N.filter(L)){const U=K(V);if(w.flameGraphFrames.some(U))return"flamegraph";if(w.graphFrames.some(U))return"timeseries";if(w.logsFrames.some(U))return j?.logs?.visualisationType?j.logs.visualisationType:"logs";if(w.nodeGraphFrames.some(U))return"nodeGraph";if(w.traceFrames.some(U))return"traces";if(w.customFrames.some(U))return w.customFrames.find(U)?.meta?.preferredVisualisationPluginId??"table"}return"table"}function W(N){const{exploreId:w,onClose:j}=N,V=(0,g.useSelector)((0,I.qq)(w)),U=()=>T({datasource:V.datasourceInstance?.getRef(),queries:V.queries,queryResponse:V.queryResponse,panelState:V?.panelsState});return(0,t.jsx)(S,{onClose:j,buildPanel:U,timeRange:V.range,options:void 0})}},39338:(ee,B,e)=>{"use strict";e.d(B,{t:()=>r});var t=e(15130),n=e(96673);
278function r(){const o=t.TP.hasPermission(n.AccessControlAction.DashboardsCreate),s=t.TP.hasPermission(n.AccessControlAction.DashboardsWrite);return o&&!s?"Add panel to new dashboard":s&&!o?"Add panel to existing dashboard":"Add panel to dashboard"}},20806:(ee,B,e)=>{"use strict";e.d(B,{s:()=>l});var t=e(74848),n=e(92138),r=e(36490),o=e(22787),s=e(41654),m=e(45861),a=e(56840);function l(f){const{onDismiss:h,path:u,title:i}=f,x=()=>{e.g.open(n.I.assureBaseUrl(u),"_blank"),h()},g=()=>r.Ny.push(u);return(0,t.jsxs)(o.a,{title:i,isOpen:!0,onDismiss:h,children:[(0,t.jsx)(s.B,{direction:"column",gap:1,children:(0,t.jsx)("p",{children:"Do you want to proceed in the current tab or open a new tab?"})}),(0,t.jsxs)(o.a.ButtonRow,{children:[(0,t.jsx)(m.$n,{onClick:h,fill:"outline",variant:"secondary",children:(0,t.jsx)(a.x6,{i18nKey:"explore.confirm-navigation-modal.cancel",children:"Cancel"})}),(0,t.jsx)(m.$n,{type:"submit",variant:"secondary",onClick:x,icon:"external-link-alt",children:(0,t.jsx)(a.x6,{i18nKey:"explore.confirm-navigation-modal.open-in-new-tab",children:"Open in new tab"})}),(0,t.jsx)(m.$n,{type:"submit",variant:"primary",onClick:g,icon:"apps",children:(0,t.jsx)(a.x6,{i18nKey:"explore.confirm-navigation-modal.open",children:"Open"})})]})]})}},9860:(ee,B,e)=>{"use strict";e.d(B,{w:()=>s});var t=e(74848),n=e(96540),r=e(87063),o=e(31439);function s({extensions:l,onSelect:f}){const{categorised:h,uncategorised:u}=a(l),i=u.length>0&&Object.keys(h).length>0;return(0,t.jsx)(r.W,{children:(0,t.jsxs)(t.Fragment,{children:[Object.keys(h).map(x=>(0,t.jsx)(r.W.Group,{label:(0,o.pL)(x,25),children:m(h[x],f)},x)),i&&(0,t.jsx)(r.W.Divider,{},"divider"),m(u,f)]})})}function m(l,f){return l.map(h=>(0,t.jsx)(r.W.Item,{ariaLabel:h.title,icon:h?.icon||"plug",label:(0,o.pL)(h.title,25),onClick:u=>{if(h.path)return f(h);h.onClick?.(u)}},h.id))}function a(l){return(0,n.useMemo)(()=>{const f=[],h={};for(const u of l){if(!u.category){f.push(u);continue}Array.isArray(h[u.category])||(h[u.category]=[]),h[u.category].push(u)}return{uncategorised:f,categorised:h}},[l])}},89381:(ee,B,e)=>{"use strict";e.d(B,{h:()=>r});var t=e(96540),n=e(78529);const r=(o,s)=>(0,t.useMemo)(()=>(0,n.YV)(o,s),[o,s])},55133:(ee,B,e)=>{"use strict";e.d(B,{m:()=>te,s:()=>Q});var t=e(96540),n=e(27963),r=e(64762),o=e(96673),s=e(20718),m=e(2513);const a={parse:J=>{if(!J.left&&!J.right)return{to:{left:{datasource:null,queries:[],range:{from:m.k.from,to:m.k.to}},schemaVersion:0},error:!1};let q,X,se,oe;return typeof J.left=="string"&&([q,se]=u(J.left)),typeof J.right=="string"?[X,oe]=u(J.right):J.right&&(X=h,oe=!0),q||(q=h),{to:{schemaVersion:0,left:q,...X&&{right:X}},error:!!se||!!oe}}},l=(J,...q)=>q.some(X=>J.hasOwnProperty(X));var f=(J=>(J[J.RangeFrom=0]="RangeFrom",J[J.RangeTo=1]="RangeTo",J[J.Datasource=2]="Datasource",J[J.SegmentsStart=3]="SegmentsStart",J))(f||{});const h={datasource:null,queries:[],range:m.k};function u(J){let q;try{q=JSON.parse(J)}catch{return[h,!0]}if(!Array.isArray(q))return[{queries:[],range:m.k,...q},!1];if(q.length<=3)return[h,!0];const X={from:q[0],to:q[1]},se=q[2],oe=q.slice(3),ae=oe.filter(fe=>!l(fe,"ui","mode","__panelsState")),ie=oe.find(fe=>l(fe,"__panelsState"))?.__panelsState;return[{datasource:se,queries:ae,range:X,panelsState:ie},!1]}var i=e(62635),x=e(8692);const g={parse:J=>{if(!J||!J.panes||typeof J.panes!="string")return{to:{schemaVersion:1,panes:{[(0,i.o$)()]:p}},error:!1};let q;try{q=JSON.parse(J.panes)}catch{}if(q==null||typeof q!="object")return{to:{schemaVersion:1,panes:{[(0,i.o$)()]:p}},error:!0};const X=Object.entries(q).map(([se,oe])=>[se,c(oe)]).reduce((se,[oe,ae])=>{let ie=oe;return(ie.length!==3||/^\d+$/.test(ie)||ie.split("").some(fe=>i.WP.indexOf(fe)===-1))&&(ie=(0,i.o$)()),{...se,[ie]:ae}},{});return Object.keys(X).length||(X[(0,i.o$)()]=p),{to:{schemaVersion:1,panes:X},error:!1}},migrate:J=>({schemaVersion:1,panes:{[(0,i.o$)()]:J.left,...J.right&&{[(0,i.o$)()]:J.right}}})},p={datasource:null,queries:[],range:m.k};function c(J){return!J||typeof J!="object"?p:{...p,...(0,x.C)("queries",J)&&Array.isArray(J.queries)&&{queries:J.queries},...(0,x.C)("datasource",J)&&typeof J.datasource=="string"&&{datasource:J.datasource},...(0,x.C)("panelsState",J)&&!!J.panelsState&&typeof J.panelsState=="object"&&{panelsState:J.panelsState},...(0,x.C)("range",J)&&!!J.range&&typeof J.range=="object"&&(0,x.C)("from",J.range)&&(0,x.C)("to",J.range)&&typeof J.range.from=="string"&&typeof J.range.to=="string"&&{range:{from:J.range.from,to:J.range.to}}}}const y=J=>d(J),P=[a,g],d=J=>{const q=D(J),[X,...se]=P.slice(q),{error:oe,to:ae}=X.parse(J);return[se.reduce((fe,pe)=>pe.migrate?pe.migrate(fe):fe,ae),oe]};function D(J){return!J||!("schemaVersion"in J)||!J.schemaVersion?0:typeof J.schemaVersion=="number"?J.schemaVersion:typeof J.schemaVersion=="str
278ing"?Number.parseInt(J.schemaVersion,10):0}var b=e(2543),E=e(19379),v=e(707),C=e(51845),S=e(35231),O=e(19050),I=e(94543),R=e(83953),T=e(80144),L=e(28105),K=e(1906),A=e(28998),W=e(18615);const N=(J,q)=>{const X=!(0,b.isEqual)(q?.datasource,J?.datasource),se=!(0,b.isEqual)(q?.queries,J?.queries),oe=!(0,b.isEqual)(q?.range||m.k,J?.range||m.k),ae=!(0,b.isEqual)(q?.panelsState,J?.panelsState);return{datasource:X,queries:se,range:oe,panelsState:ae}};async function w(J,q,X){if(J)try{return await(0,A.tR)().get(J)}catch{}const se=[...new Set(q.map(oe=>oe.datasource).filter(L.zz).map(oe=>typeof oe=="string"?oe:oe.uid))];try{if(se.length>=1){const oe=(await Promise.allSettled(se.map(ae=>(0,A.tR)().get(ae)))).filter(x.s);if(oe.length>1)return await(0,A.tR)().get(W.uv);if(oe.length===1)return await(0,A.tR)().get(se[0])}}catch{}return(0,A.tR)().get((0,i.HQ)(X)).catch(()=>(0,A.tR)().get()).catch(()=>{})}function j(J){return{...J.getDefaultQuery?.(K.Jk.Explore),refId:"A",datasource:J.getRef()}}function V(J){return J.name===W.uv}function U(J){return J&&V(J)?q=>!!q.datasource:q=>q.datasource?typeof q.datasource=="string"?q.datasource===J?.uid||q.datasource===J?.name:q.datasource.uid===J?.uid:!0}async function F(J){return(await Promise.allSettled(J.map(X=>(0,A.tR)().get(X.datasource).then(se=>({query:X,ds:se}))))).filter(x.s).map(({value:X})=>X.query)}function M(J,q,X){const se=Object.values(J.panes);if(se.length>1){const oe=se.some(({range:ae},ie,[{range:fe}])=>!(0,b.isEqual)(ae,fe));X((0,S.qz)({syncedTimes:!oe}))}Object.entries(J.panes).forEach(async([oe,ae],ie)=>{const{datasource:fe,queries:pe,range:de,panelsState:le}=ae,me=q[oe];if(me!==void 0){const De=N(ae,te(me));Promise.resolve().then(async()=>{De.datasource&&fe&&await X((0,v.wh)({exploreId:oe,datasource:fe}))}).then(async()=>{De.range&&X((0,I.JA)({exploreId:oe,rawRange:(0,R.Z9)(de)})),De.queries&&X((0,O.h9)({exploreId:oe,queries:(0,T.v)(pe)})),(De.queries||De.range)&&(await X((0,O.hS)(oe)),X((0,O.Od)({exploreId:oe}))),De.panelsState&&le&&X((0,C.fx)({exploreId:oe,panelsState:le}))})}else X((0,C.Gd)({exploreId:oe,datasource:fe||"",queries:(0,T.v)(pe),range:(0,R.Z9)(de),panelsState:le,position:ie,eventBridge:new E.o}))}),Object.keys(q).filter(oe=>!Object.keys(J.panes).includes(oe)).forEach(oe=>X((0,S.J8)(oe)))}function H(J,q,X,se,oe){se((0,S.Ve)()),Promise.all(Object.entries(J.panes).map(([ae,{datasource:ie,queries:fe,range:pe,panelsState:de}])=>w(ie,fe,X).then(le=>Promise.resolve(le?fe.length?(0,T.v)(fe).filter(U(le)).map(V(le)?b.identity:me=>({...me,datasource:le.getRef()})):(0,A.tR)().get(V(le)?void 0:le.getRef()).then(me=>[j(me)]):[]).then(async me=>{let De=await F(me);return!De.length&&le&&(De=[j(V(le)?await(0,A.tR)().get():le)]),{exploreId:ae,range:pe,panelsState:de,queries:De,datasource:le}})))).then(async ae=>{const ie=await Promise.all(ae.map(({exploreId:me,range:De,panelsState:Te,queries:Ne,datasource:Ce})=>se((0,C.Gd)({exploreId:me,datasource:Ce,queries:Ne,range:(0,R.Z9)(De),panelsState:Te,eventBridge:new E.o})).unwrap()));if(ie.length>1){const me=ie.some(({state:De},Te,[{state:Ne}])=>!(0,b.isEqual)(De.range.raw,Ne.range.raw));se((0,S.qz)({syncedTimes:!me}))}const fe=ie.reduce((me,{exploreId:De,state:Te})=>({...me,[De]:te(Te)}),{}),pe=oe.getSearchObject();let de={};for(const[me,De]of Object.entries(pe).filter(([Te])=>!["schemaVersion","panes","orgId","left","right"].includes(Te)))de[me]=De;const le=new URLSearchParams({schemaVersion:`${J.schemaVersion}`,panes:JSON.stringify(fe),orgId:`${X}`,...de});oe.replace({pathname:oe.getLocation().pathname,search:le.toString()}),q.current="done"})}function _(J,q){return J.current=v.wh.pending.type===q.type,[S.J8.type,S.ve.fulfilled.type,O.Od.pending.type,I.eM.type,C.fx.type,v.wh.fulfilled.type].includes(q.type)&&!J.current}function Z(J,q,X,se){const oe=Object.entries(J.panes).reduce((ae,[ie,fe])=>fe?{...ae,[ie]:te(fe)}:ae,{});if(!(0,b.isEqual)(q.current.panes,JSON.stringify(oe))){const ae=!!q.current.panes&&Object.values(q.current.panes).filter(Boolean).length===0||X.current==="pending";q.current={panes:JSON.stringify(oe)},se.partial({panes:q.current.panes},ae)}}var ne=e(5556);function te(J){return{datasource:J.datasourceInstance?.uid||"",queries:J.queries.map(i.w4),range:(0,ne.sQ)(J.range.raw),panelsState:Y(J.panelsState)}}function Y(J){let q=(0,b.mapValues)(J,X=>(0,b.isObject)(X)?Y(X):X);if(q=(0,b.omitBy)(q,b.isEmpty),!(0,b.isEmpty)(q))return q}function Q(J){const{location:q}=(0,n.Il)(),X=(0,o.useDispatch)(),se=(0,o.useSelector)(s.Qb),oe=(0,t.useRef)(se),ae=(0,o.useSelector)(le=>le.user.orgId),ie=(0,t.useRef)(J),fe=(0,t.useRef)("notstarted"),pe=(0,t.useRef)(!1),{warning:de}=(0,r._2)();(0,t.useEffect)(()=>{J.panes||(fe.current="notstarted",ie.current=J)},[J]),(0,t.useEffect)(()=>{const le=X((0,o.addListener)({predicate:me=>_(pe,me),effect:async(me,{cancelActiveListeners:De,delay:Te,getState:Ne})=>{De(),await Te(200),Z(Ne().explore,ie,fe,q)}}));return()=>le()},[X,q]),(0,t.useEffect)(()=>{oe.current=se},[se]),(0,t.useEffect)(()=>{const le=ie.current?.panes!==J.panes,[me,De]=y(J);De&&de("Could not parse Explore URL","The requested URL contains invali
278d parameters, a default Explore state has been loaded."),!le&&fe.current==="notstarted"&&(fe.current="pending",H(me,fe,ae,X,q)),ie.current=J,le&&fe.current==="done"&&M(me,oe.current,X)},[X,ae,q,J,de])}},8692:(ee,B,e)=>{"use strict";e.d(B,{C:()=>n,s:()=>t});const t=r=>r.status==="fulfilled";function n(r,o){return r in o}},2513:(ee,B,e)=>{"use strict";e.d(B,{k:()=>n});var t=e(43173);const n={from:`now-${t.$.exploreDefaultTimeOffset}`,to:"now"}},80763:(ee,B,e)=>{"use strict";e.d(B,{M:()=>u,v:()=>x});var t=e(88483),n=e(78282),r=e(27489),o=e(6890),s=e(64762),m=e(6219),a=e(8535),l=e(51845),f=e(35231),h=e(19050);const u=g=>new t.c(p=>{const c=a.M_.getState().explore.panes[g]?.correlations;if(c)p.next(c),p.complete();else{const y=a.M_.subscribe(()=>{const P=a.M_.getState().explore.panes[g]?.correlations;P&&(y(),p.next(P),p.complete())})}});function i(g){return async(p,c)=>{const y=c().explore.panes[g];if(y.datasourceInstance?.uid!==void 0){let P=y.datasourceInstance.meta.mixed?y.queries.map(D=>D.datasource?.uid).filter(D=>D!==null):[y.datasourceInstance.uid];const d=await(0,m.J6)(P);p((0,l.Fb)({exploreId:g,correlations:d.correlations||[]}))}}}function x(g,p,c){return async(y,P)=>{const d=Object.keys(P().explore?.panes),D=P().explore?.panes[d[0]],b=P().explore?.panes[d[1]];if(!D||!b)return;const E=D.datasourceInstance?.meta.mixed?D.queries[0].datasource:D.datasourceInstance?.getRef(),v=b.datasourceInstance?.meta.mixed?b.queries[0].datasource:b.datasourceInstance?.getRef(),[C,S]=await Promise.all([(0,n.l)().get(E),(0,n.l)().get(v)]);if(C?.uid&&S?.uid&&b.correlationEditorHelperData?.resultField){const O={sourceUID:C.uid,targetUID:S.uid,label:g||await(0,m.tZ)(D,b),description:p,type:"query",config:{field:b.correlationEditorHelperData.resultField,target:b.queries[0],transformations:c}};await(0,m.$q)(C.uid,O).then(async()=>{y((0,f.J8)(d[1])),await y(i(d[0])),await y((0,h.Od)({exploreId:d[0]})),(0,r.rR)("grafana_explore_correlation_editor_saved",{sourceDatasourceType:C.type,targetDataSourceType:S.type})}).catch(I=>{y((0,o.dx)((0,s.gi)("Error creating correlation",I))),console.error(I)})}}}},707:(ee,B,e)=>{"use strict";e.d(B,{YR:()=>g,wh:()=>x});var t=e(65307),n=e(27489),r=e(90811),o=e(62635),s=e(6219),m=e(96673),a=e(10951),l=e(51845),f=e(19050),h=e(94543),u=e(83953);const i=(0,t.VP)("explore/updateDatasourceInstance"),x=(0,m.createAsyncThunk)("explore/changeDatasource",async({datasource:p,exploreId:c,options:y},{getState:P,dispatch:d})=>{const D=P().user.orgId,{history:b,instance:E}=await(0,u.BE)(D,p),v=P().explore.panes[c].datasourceInstance;(0,n.rR)("explore_change_ds",{from:(v?.meta?.mixed?"mixed":v?.type)||"unknown",to:E.meta.mixed?"mixed":E.type,exploreId:c}),d(i({exploreId:c,datasourceInstance:E,history:b}));const C=P().explore.panes[c].queries,S=(0,u.dq)(E.uid,C),O=await(0,s.J6)(S);d((0,l.Fb)({exploreId:c,correlations:O.correlations||[]})),y?.importQueries&&await d((0,f.y2)(c,C,v,E)),P().explore.panes[c].isLive&&d((0,h.hO)({exploreId:c,refreshInterval:r.cC.offOption.value})),y?.importQueries&&d((0,f.Od)({exploreId:c}))}),g=(p,c)=>{if(i.match(c)){const{datasourceInstance:y,history:P}=c.payload;return(0,o._u)(p.querySubscription),{...p,datasourceInstance:y,graphResult:null,tableResult:null,logsResult:null,supplementaryQueries:(0,a.Ez)(),queryResponse:(0,u.RA)(),queryKeys:[],history:P}}return p}},51845:(ee,B,e)=>{"use strict";e.d(B,{EA:()=>i,Fb:()=>c,Gd:()=>P,LJ:()=>d,QZ:()=>y,fx:()=>u,nE:()=>x});var t=e(65307),n=e(62635),r=e(6219),o=e(34984),s=e(96673),m=e(707),a=e(19050),l=e(94543),f=e(83953);const h=(0,t.VP)("explore/changeSize"),u=(0,t.VP)("explore/changePanels");function i(D,b,E){return async(v,C)=>{const S=C().explore.panes[D];if(S===void 0)return;const{panelsState:O}=S;v(u({exploreId:D,panelsState:{...O,[b]:E}}))}}const x=(0,t.VP)("explore/changeCorrelationHelperData"),g=(0,t.VP)("explore/initializeExploreAction"),p=(0,t.VP)("explore/setUrlReplaced"),c=(0,t.VP)("explore/saveCorrelationsAction");function y(D,{width:b}){return h({exploreId:D,width:b})}const P=(0,s.createAsyncThunk)("explore/initializeExplore",async({exploreId:D,datasource:b,queries:E,range:v,panelsState:C,correlationHelperData:S,eventBridge:O},{dispatch:I,getState:R,fulfillWithValue:T})=>{let L,K=[];if(b){const A=R().user.orgId,W=await(0,f.BE)(A,b);L=W.instance,K=W.history}if(I(g({exploreId:D,queries:E,range:(0,f.eO)(v,(0,o.O)(R().user)),datasourceInstance:L,history:K,eventBridge:O})),C!==void 0&&I(u({exploreId:D,panelsState:C})),I((0,l.JA)({exploreId:D})),L){const A=(0,f.dq)(L.uid,E),W=await(0,r.J6)(A);I(c({exploreId:D,correlations:W.correlations||[]})),I((0,a.Od)({exploreId:D}))}return S!==void 0&&R().explore.correlationEditorDetails?.editorMode&&I(x({exploreId:D,correlationEditorHelperData:S})),T({exploreId:D,state:R().explore.panes[D]})}),d=(D=(0,f.HZ)(),b)=>{if(D=(0,a.JQ)(D,b),D=(0,m.YR)(D,b),D=(0,l.QP)(D,b),h.match(b)){const E=b.payload.width;return{...D,containerWidth:E}}if(u.match(b)){const{panelsState:E}=b.payload;return{...D,panelsState:E}}if(x.match(b)){const{correlationEditorHelperData:E}=b.payload;return{...D,correlationEditorHelperData:E}}if(c.match(b))return{...D,correlations:b.payload.correlations};if(g.match(b)){const{queries:E,range:v,datasourceInstance:C,history:S,eventBridge:O}=b.payload;return{...D,range:v,queries:E,initialized:!0,eventBridge:O,queryKeys:(0,n.dY)(E),datasourceInstance:C,history:S,queryResponse:(0,f.RA)(),c
278ache:[],correlations:[]}}return D}},11280:(ee,B,e)=>{"use strict";e.d(B,{Bj:()=>y,H9:()=>f,PA:()=>p,Uu:()=>x,VM:()=>h,fP:()=>c,jX:()=>i,ri:()=>a,s1:()=>u,sh:()=>l,wk:()=>g});var t=e(65307),n=e(81970),r=e(53222),o=e(35231);const s=(0,t.VP)("explore/historyUpdated"),m=({updatedQuery:P,deletedId:d})=>async(D,b)=>{const E=b().explore.richHistory,v=E.map(S=>S.id===P?.id?P:S).filter(S=>S.id!==d),C=E.length-v.length;D((0,o.U2)({richHistoryResults:{richHistory:v,total:b().explore.richHistoryTotal-C}}))},a=(P,d,D,b,E)=>async(v,C)=>{const S=E?{quotaExceededError:!1,limitExceededWarning:!1,otherErrors:!1}:{quotaExceededError:!C().explore.richHistoryStorageFull,limitExceededWarning:!C().explore.richHistoryLimitExceededWarningShown},{richHistoryStorageFull:O,limitExceeded:I}=await(0,n.l0)({localOverride:P,datasource:{uid:d,name:D},queries:b,starred:!1,showNotif:S});E||(O&&v((0,o.fj)()),I&&v((0,o.D)()))},l=(P,d)=>async(D,b)=>{const E=await(0,n.oU)(P,d);D(m({updatedQuery:E}))},f=(P,d)=>async D=>{const b=await(0,n.cX)(P,d);D(m({updatedQuery:b}))},h=P=>async d=>{const D=await(0,n.NC)(P);d(m({deletedId:D}))},u=()=>async P=>{await(0,n.X1)(),P((0,o.U2)({richHistoryResults:{richHistory:[],total:0}})),P((0,o.U2)({richHistoryResults:{richHistory:[],total:0}}))},i=()=>async(P,d)=>{const D=d().explore.richHistorySearchFilters;if(D){const b=await(0,n.DI)(D);P((0,o.U2)({richHistoryResults:b}))}},x=()=>async(P,d)=>{const D=d().explore.richHistorySearchFilters,b=d().explore.richHistory;if(D&&b){const E={...D,page:(D?.page||1)+1},v=await(0,n.DI)(E),C=[...b,...v.richHistory];P((0,o.Ju)({filters:E})),P((0,o.U2)({richHistoryResults:{richHistory:C,total:v.total}}))}},g=()=>async P=>{P((0,o.Ju)({filters:void 0})),P((0,o.U2)({richHistoryResults:{richHistory:[],total:0}}))},p=()=>async(P,d)=>{let D=d().explore.richHistorySettings;D||(D=await(0,n.Gx)(),P((0,o.bZ)(D)))},c=P=>async d=>{d((0,o.bZ)(P)),await(0,n.rs)(P)},y=P=>async(d,D)=>{await d((0,o.Ju)({filters:{...P}}));const b=D().explore.richHistorySettings;(0,r.gQ)().lastUsedDataSourcesAvailable&&await d(c({...b,lastUsedDatasourceFilters:P.datasourceFilters}))}},35231:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>W,D:()=>y,J8:()=>v,JA:()=>E,Ju:()=>d,U2:()=>p,Ve:()=>S,am:()=>R,bZ:()=>P,fj:()=>c,nD:()=>D,ow:()=>T,qz:()=>g,tP:()=>b,ve:()=>O});var t=e(65307),n=e(2543),r=e.n(n),o=e(19379),s=e(92138),m=e(36490),a=e(62635),l=e(59373),f=e(96673),h=e(80144),u=e(2513),i=e(51845),x=e(83953);const g=(0,t.VP)("explore/syncTimes"),p=(0,t.VP)("explore/richHistoryUpdated"),c=(0,t.VP)("explore/richHistoryStorageFullAction"),y=(0,t.VP)("explore/richHistoryLimitExceededAction"),P=(0,t.VP)("explore/richHistorySettingsUpdated"),d=(0,t.VP)("explore/richHistorySearchFiltersUpdatedAction"),D=(0,t.VP)("explore/splitSizeUpdateAction"),b=(0,t.VP)("explore/maximizePaneAction"),E=(0,t.VP)("explore/evenPaneResizeAction"),v=(0,t.VP)("explore/splitClose"),C=(0,t.VP)("explore/setPaneState"),S=(0,t.VP)("explore/clearPanes"),O=(0,f.createAsyncThunk)("explore/splitOpen",async(N,{getState:w,dispatch:j})=>{const V=Object.values(w().explore.panes)[0],U=N?.queries??V?.queries??[];Object.keys(w().explore.panes).forEach((H,_)=>{_>=1&&j(v(H))});const F=N?.range||V?.range.raw||u.k;let M=(0,a.o$)();for(;w().explore.panes[M];)M=(0,a.o$)();await j(I({exploreId:M,datasource:N?.datasourceUid||V?.datasourceInstance?.getRef(),queries:(0,h.v)(U),range:F,panelsState:N?.panelsState||V?.panelsState,correlationHelperData:N?.correlationHelperData,eventBridge:new o.o})),V?.range&&await j(g({syncedTimes:(0,n.isEqual)(V.range.raw,F)}))}),I=(0,f.createAsyncThunk)("explore/createNewSplitOpen",async(N,{dispatch:w})=>{await w((0,i.Gd)(N))}),R=(0,t.VP)("explore/changeCorrelationEditorDetails"),T=(N,w)=>async j=>{const{timeRange:V,getExploreUrl:U,openInNewWindow:F}=w,M=await U({queries:N.targets,dsRef:N.datasource,scopedVars:N.scopedVars,timeRange:V,adhocFilters:(0,l.w)().getAdhocFilters(N.datasource?.uid??"",!0)});if(F&&M){F(M);return}m.Ny.push(s.I.stripBaseFromUrl(M))},L=()=>(0,x.HZ)(),K={syncedTimes:!1,panes:{},correlationEditorDetails:{editorMode:!1,correlationDirty:!1,queryEditorDirty:!1,isExiting:!1},richHistoryStorageFull:!1,richHistoryLimitExceededWarningShown:!1,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0,richHistory:[]},W={explore:(N=K,w)=>{if(v.match(w)){const{[w.payload]:V,...U}={...N.panes};return{...N,panes:U,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0,syncedTimes:!1}}if(D.match(w)){const{largerExploreId:V}=w.payload;
278return{...N,largerExploreId:V,maxedExploreId:void 0,evenSplitPanes:V===void 0}}if(b.match(w)){const{exploreId:V}=w.payload;return{...N,largerExploreId:V,maxedExploreId:V,evenSplitPanes:!1}}if(E.match(w))return{...N,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0};if(g.match(w))return{...N,syncedTimes:w.payload.syncedTimes};if(c.match(w))return{...N,richHistoryStorageFull:!0};if(y.match(w))return{...N,richHistoryLimitExceededWarningShown:!0};if(P.match(w)){const V=w.payload;return{...N,richHistorySettings:V}}if(p.match(w)){const{richHistory:V,total:U}=w.payload.richHistoryResults;return{...N,richHistory:V,richHistoryTotal:U}}if(d.match(w)){const V=w.payload.filters;return{...N,richHistorySearchFilters:V}}if(I.pending.match(w))return{...N,panes:{...N.panes,[w.meta.arg.exploreId]:L()}};if(i.Gd?.pending.match(w)){const V=Object.entries(N.panes),U=V.slice(0,w.meta.arg.position),F=V.slice(U.length),M=[...U,[w.meta.arg.exploreId,L()],...F].reduce((H,[_,Z])=>({...H,[_]:Z}),{});return{...N,panes:M}}if(S.match(w))return{...N,panes:{}};if(R.match(w)){const{editorMode:V,label:U,description:F,canSave:M,correlationDirty:H,queryEditorDirty:_,isExiting:Z,postConfirmAction:ne,transformations:te}=w.payload;return{...N,correlationEditorDetails:{editorMode:!!(V??N.correlationEditorDetails?.editorMode),canSave:!!(M??N.correlationEditorDetails?.canSave),label:U??N.correlationEditorDetails?.label,description:F??N.correlationEditorDetails?.description,transformations:te??N.correlationEditorDetails?.transformations,correlationDirty:!!(H??N.correlationEditorDetails?.correlationDirty),queryEditorDirty:!!(_??N.correlationEditorDetails?.queryEditorDirty),isExiting:!!(Z??N.correlationEditorDetails?.isExiting),postConfirmAction:ne}}}const j=w.payload?.exploreId;return typeof j=="string"?{...N,panes:Object.entries(N.panes).reduce((V,[U,F])=>({...V,[U]:U===j?(0,i.LJ)(F,w):F}),{})}:N}}},19050:(ee,B,e)=>{"use strict";e.d(B,{_0:()=>Be,He:()=>Dt,hS:()=>Xe,bO:()=>Et,IL:()=>qt,rR:()=>Ee,y2:()=>Tt,Az:()=>Yt,PD:()=>Mt,JQ:()=>Zt,S6:()=>At,Od:()=>xt,GI:()=>Wn,q9:()=>ye,h1:()=>He,qk:()=>Se,Rk:()=>vn,h9:()=>ce,TO:()=>nn});var t=e(65307),n=e(32017),r=e.n(n),o=e(2543),s=e(49510),m=e(62467),a=e(58307),l=e(69862),f=e(99165),h=e(28105),u=e(46933),i=e(25229),x=e(67770),g=e(94644),p=e(76732),c=e(39443),y=e(95004);function P(ft,Rt){const Bt=d({data:ft.series},{data:Rt.series}).data;return{...ft,series:Bt}}function d(ft,Rt){if(!ft)return C(Rt);Rt.data.forEach($t=>{const an=ft.data.find(Jt=>O(Jt,$t));if(!an){ft.data.push(S($t));return}D(an,$t)});const Bt=[...ft.errors??[],...Rt.errors??[]];Bt.length>0&&(ft.errors=Bt);const jt=ft.error??Rt.error;jt!=null&&(ft.error=jt);const Nt=[...ft.traceIds??[],...Rt.traceIds??[]];return Nt.length>0&&(ft.traceIds=Nt),ft}function D(ft,Rt){const Bt=Math.max(ft.fields.length,Rt.fields.length);for(let jt=0;jt<Bt;jt++){if(!ft.fields[jt])continue;const Nt=b(ft.fields[jt],Rt.fields,jt);if(Nt&&(ft.fields[jt].values=[].concat.apply(Nt.values,ft.fields[jt].values),Nt.nanos)){const $t=ft.fields[jt].nanos?.slice()||[];ft.fields[jt].nanos=Rt.fields[jt].nanos?.concat($t)}}ft.length+=Rt.length,ft.meta={...ft.meta,stats:v(ft.meta?.stats??[],Rt.meta?.stats??[])}}function b(ft,Rt,Bt){const jt=Rt.filter(Nt=>Nt.name===ft.name);return jt.length===1?jt[0]:ft.labels?jt.find(Nt=>(0,p.ab)(ft.labels??{},Nt.labels??{})):Rt[Bt]}const E="Summary: total bytes processed";function v(ft,Rt){const Bt=ft.find($t=>$t.displayName===E),jt=Rt.find($t=>$t.displayName===E);if(jt!=null&&Bt!=null)return[{value:jt.value+Bt.value,displayName:E,unit:Bt.unit}];const Nt=jt??Bt;return Nt!=null?[Nt]:[]}function C(ft){return{...ft,data:ft.data.map(S)}}function S(ft){return{...ft,fields:ft.fields.map(Rt=>({...Rt,values:Rt.values}))}}function O(ft,Rt){if(ft.refId!==Rt.refId||ft.name!==Rt.name)return!1;const Bt=ft.meta?.type,jt=Rt.meta?.type;if(Bt!==jt)return!1;if(Bt===c.m.TimeSeriesMulti){const an=ft.fields.find(gn=>gn.type===y.PU.number),Jt=Rt.fields.find(gn=>gn.type===y.PU.number);return an===void 0||Jt===void 0?!1:(0,p.ab)(an.labels??{},Jt.labels??{})}const Nt=ft.meta?.custom?.frameType,$t=Rt.meta?.custom?.frameType;return Nt==="LabeledTimeValues"&&$t==="LabeledTimeValues"?!0:Nt===$t}var I=e(78282),R=e(43173),T=e(62635),L=e(23237),K=e(6219),A=e(28998),W=e(34984),N=e(12282),w=e(18615),j=e(96673),V=e(6890),U=e(64762),F=e(71393),M=e(81160),H=e(11576),_=e(79609),Z=e(96702),ne=e(41119),te=e(37234),Y=e(74746),Q=e(92391);const J=ft=>{const Rt=[],Bt=[],jt=[],Nt=[],$t=[],an=[],Jt=[],gn=[];for(const mn of ft.series){if(pe(mn)){gn.push(mn);continue}switch(mn.meta?.preferredVisualisationType){case"logs":Nt.push(mn);break;case"graph":Rt.push(mn);break;case"trace":$t.push(mn);break;case"table":Bt.push(mn);break;case"rawPrometheus":jt.push(mn);break;case"nodeGraph":an.push(mn);break;case"flamegraph":Jt.push(mn);break;default:fe(mn)&&Rt.push(mn),Bt.push(mn)}}return{...ft,graphFrames:Rt,tableFrames:Bt,logsFrames:Nt,traceFrames:$t,nodeGraphFrames:an,customFrames:gn,flameGraphFrames:Jt,rawPrometheusFrames:jt,graphResult:null,tableResult:null,logsResult:null,rawPrometheusResult:null}},q=({showCorrelationEditorLinks:ft,queries:Rt,correlations:Bt,defaultTargetDatasource:jt})=>Nt=>{if(ft&&jt)for(const $t of Nt.series)for(const an of $t.fields){an.config.links=[],an.display=an.display||(0,H.H)();const Jt={};$t.fields.map(gn=>{Jt[`${gn.name}`]=`\${__data.fields.['${gn.name}']}`}),an.config.links.push({url:"",origin:_.x0.ExploreCorrelationsEditor,title:`Correlate with ${an.name}`,internal:{datasourceUid:jt.uid,datasourceName:jt.name,query:{datasource:{uid:jt.uid}}},meta:{correlationData:{resultField:an.name,vars:Jt,origVars:Jt}}})}else if(Rt?.length&&Bt?.length){const $t=(0,o.mapValues)((0,o.groupBy)(Rt,"refId"),"0.datasource.uid");(0,K.cA)(Nt.series,Bt,$t)}return Nt},X=ft=>ft.graphFrames.length?{...ft,graphResult:ft.graphFrames}:{...ft,graphResult:null},se=ft=>{if(ft.tableFrames.length===0)return(0,m.of)({...ft,tableResult:null});ft.tableFrames.sort((Nt,$t)=>{const an=Nt.refId,Jt=$t.refId;return an>Jt?1:an<Jt?-1:0});const Rt=ft.tableFrames.every(Nt=>fe(Nt)),Bt={interpolate:Nt=>Nt};return(Rt?(0,m.of)(ft.tableFrames).pipe(Z.c.joinByFieldTransformer.operator({},Bt)):(0,m.of)(ft.tableFrames).pipe(Z.c.mergeTransformer.operator({},Bt))).pipe((0,M.T)(Nt=>{for(const $t of Nt)for(const an of $t.fields)an.display=an.display??(0,H.J)({field:an,theme:R.$.theme2,timeZone:ft.request?.timezone??"browser"});return{...ft,tableResult:Nt}}))},oe=ft=>{const Rt=ft.rawPrometheusFrames;if(!Rt||Rt.length===0)return(0,m.of)({...ft,tableResult:null});Rt.sort(($t,an)=>{const Jt=$t.refId,gn=an.refId;return Jt>gn?1:Jt<gn?-1:0});const Bt=Rt.every($t=>fe($t)),jt={interpolate:$t=>$t};return(Bt?(0,m.of)(Rt).pipe(Z.c.joinByFieldTransformer.operator({},jt)):(0,m.of)(Rt).pipe(Z.c.mergeTransformer.operator({},jt))).pipe((0,M.T)($t=>{const an=$t[0];for(const Jt of an.fields)Jt.display=Jt.display??(0,H.J)({field:Jt,theme:R.$.theme2,timeZone:ft.request?.timezone??"browser"});return{...ft,rawPrometheusResult:an}}))},ae=(ft={})=>Rt=>{if(Rt.logsFrames.length===0)return{...Rt,logsResult:null};const Bt=Rt.request?.intervalMs,jt=(0,te.HT)(Rt.logsFrames,Bt,ft.absoluteRange,ft.queries,ft.deduplicate),Nt=(0,T.uE)(ft.refreshInterval),$t=(0,Y.zy)(jt,Nt),an=$t.rows,Jt=$t.series,gn={...$t,rows:an,series:Jt};return{...Rt,logsResult:gn}};
278function ie(ft,Rt,Bt,jt,Nt,$t,an){return(0,m.of)(ft).pipe((0,M.T)(Jt=>(0,ne.N$)(Jt,Rt)),(0,M.T)(q({defaultTargetDatasource:an,showCorrelationEditorLinks:$t,queries:jt,correlations:Nt})),(0,M.T)(J),(0,M.T)(X),(0,M.T)(Bt),(0,l.Z)(oe),(0,l.Z)(se))}function fe(ft){const Rt=(0,o.groupBy)(ft.fields,Bt=>Bt.type);return!!(Object.keys(Rt).length===2&&Rt[y.PU.time]?.length===1&&Rt[y.PU.number])}function pe(ft){return ft.meta?.preferredVisualisationPluginId?(0,Q.oZ)(ft.meta?.preferredVisualisationPluginId):!1}var de=e(10951),le=e(80763),me=e(51845),De=e(11280),Te=e(35231),Ne=e(94543),Ce=e(83953);const He=ft=>Rt=>{const Bt=Rt.explore.panes[ft];return Bt&&Bt.queryResponse?Bt.queryResponse.state===h.Gu.Loading||Bt.queryResponse.state===h.Gu.Streaming:!1},ke=(0,t.VP)("explore/addQueryRow"),Me=(0,t.VP)("explore/changeQueries"),$e=(0,t.VP)("explore/cancelQueries"),tt=(0,t.VP)("explore/queriesImported"),Ke=(0,t.VP)("explore/queryStoreSubscription"),Re=(0,t.VP)("explore/setSupplementaryQueryEnabledAction"),Ve=(0,t.VP)("explore/storeSupplementaryQueryDataProviderAction"),Qe=(0,t.VP)("explore/cleanSupplementaryQueryDataProviderAction"),je=(0,t.VP)("explore/cleanSupplementaryQueryAction"),ze=(0,t.VP)("explore/storeSupplementaryQueryDataSubscriptionAction"),Ye=(0,t.VP)("explore/updateSupplementaryQueryDataAction"),Ge=(0,t.VP)("explore/queryStreamUpdated"),ce=(0,t.VP)("explore/setQueries"),Pe=(0,t.VP)("changeLoadingState"),Se=(0,t.VP)("explore/setPausedState"),Ee=(0,t.VP)("explore/clearLogs"),xe=(0,t.VP)("explore/scanStart"),ye=(0,t.VP)("explore/scanStop"),Oe=(0,t.VP)("explore/addResultsToCache"),we=(0,t.VP)("explore/clearCache");function Be(ft,Rt){return async(Bt,jt)=>{const Nt=jt().explore.panes[ft];let $t;Nt.datasourceInstance?.meta.mixed?$t=(0,o.findLast)(Nt.queries,Jt=>!!Jt.datasource)?.datasource||void 0:$t=Nt.datasourceInstance?.getRef();const an=await(0,T.Ll)(Nt.queries,Rt,$t);Bt(ke({exploreId:ft,index:Rt,query:an}))}}function Xe(ft){return(Rt,Bt)=>{Rt(ye({exploreId:ft})),Rt($e({exploreId:ft}));const jt=Bt().explore.panes[ft].supplementaryQueries;for(const Nt of de.VW)Rt(Qe({exploreId:ft,type:Nt})),jt[Nt]?.data?.state!==h.Gu.Done&&Rt(je({exploreId:ft,type:Nt}))}}const st=(ft,Rt)=>{const Bt=ft.getRef();return Rt.map(jt=>({...jt,datasource:Bt}))},lt=async(ft,Rt,Bt)=>{let jt=[];if(Rt.meta?.id===ft.meta?.id)jt=Bt;else if((0,u.Ee)(Rt)&&(0,u.FL)(ft)){const Nt=await Rt.exportToAbstractQueries(Bt);jt=await ft.importFromAbstractQueries(Nt)}else ft.importQueries&&(jt=await ft.importQueries(Bt,Rt));return st(ft,jt)},Et=(0,j.createAsyncThunk)("explore/changeQueries",async({queries:ft,exploreId:Rt},{getState:Bt,dispatch:jt})=>{let Nt=!1;const $t=Bt().explore.panes[Rt].queries,an=Bt().explore.panes[Rt].datasourceInstance?.uid,Jt=Bt().explore.correlationEditorDetails,gn=Jt?.editorMode||!1;!(Object.keys(Bt().explore.panes)[0]===Rt)&&gn&&!Jt?.queryEditorDirty&&jt((0,Te.am)({queryEditorDirty:!0}));for(const _t of ft)for(const On of $t){if(_t.refId===On.refId&&_t.datasource?.type!==On.datasource?.type){const Nn=await(0,I.l)().get(On.datasource),Fn=await(0,I.l)().get({uid:_t.datasource?.uid});await jt(Tt(Rt,$t,Nn,Fn,_t.refId)),Nt=!0}if(an===w.uv&&_t.refId===On.refId&&_t.datasource?.uid!==On.datasource?.uid){const Nn=(0,Ce.dq)(w.uv,ft),Fn=await(0,K.J6)(Nn);jt((0,me.Fb)({exploreId:Rt,correlations:Fn.correlations||[]}))}}Nt||jt(Me({queries:ft,exploreId:Rt})),ft.length<$t.length&&jt(xt({exploreId:Rt}))}),Tt=(ft,Rt,Bt,jt,Nt)=>async $t=>{if(!Bt){$t(tt({exploreId:ft,queries:Rt}));return}let an=Rt;if(jt.uid===w.uv)an=Rt.map(gn=>({...gn,datasource:Bt.getRef()}));else if(Bt.uid===w.uv){const gn=(0,o.groupBy)(Rt,_t=>_t.datasource?.uid),mn=await Promise.all(Object.keys(gn).map(async _t=>{const On=await(0,I.l)().get({uid:_t});return await lt(jt,On,gn[_t])}));an=(0,o.flatten)(mn.filter(_t=>_t.length>0))}else{let gn=Rt;if(Nt!==void 0){const mn=Rt.find(_t=>_t.refId===Nt);mn&&(gn=[mn])}an=await lt(jt,Bt,gn)}let Jt=await(0,T.di)(an,jt.getRef());if(Nt!==void 0){an.length===0&&(an=[await(0,T.Ll)([],void 0,jt.getRef())]);const gn=Rt.findIndex(_t=>_t.refId===Nt),mn={...Jt[0],refId:Rt[gn].refId};Jt=[...Rt],Jt[gn]=mn}return $t(tt({exploreId:ft,queries:Jt})),Jt};function Mt(ft,Rt,Bt){return async(jt,Nt)=>{const $t=Nt().explore.panes[ft],{queries:an}=$t,gn=(await Promise.all(an.map(mn=>Bt({...mn},Rt)))).map((mn,_t)=>(0,T.eF)(mn,an,_t));jt(ce({exploreId:ft,queries:gn})),Rt.preventSubmit||jt(xt({exploreId:ft}))}}function wt(ft,Rt){if(!(ft.filterQuery&&!ft.filterQuery(Rt)))return Rt}async function _e(ft,Rt,Bt,jt){const $t=(await Promise.all(jt.map(async an=>{if(an.datasource?.uid===Bt.uid)return wt(Bt,an);{const Jt=await(0,A.tR)().get(an.datasource);return wt(Jt,an)}}))).filter(an=>!!an);$t.length>0&&(ft((0,De.ri)(!0,Bt.uid,Bt.name,$t,R.$.queryHistoryEnabled)),R.$.queryHistoryEnabled&&ft((0,De.ri)(!1,Bt.uid,Bt.name,$t,!1)),await ft((0,De.jX)())
278)}const xt=(0,j.createAsyncThunk)("explore/runQueries",async({exploreId:ft,preserveCache:Rt},{dispatch:Bt,getState:jt})=>{jt().explore?.panes[ft]?.scanning||Bt(Xe(ft));const{defaultCorrelationEditorDatasource:Nt,scopedVars:$t,showCorrelationEditorLinks:an}=await(0,Ce.aj)(jt(),ft),Jt=(0,le.M)(ft);Bt((0,Ne.JA)({exploreId:ft})),Rt!==!0&&Bt(qt(ft));const mn=jt().explore.panes[ft],{datasourceInstance:_t,containerWidth:On,isLive:Nn,range:Fn,scanning:na,queryResponse:aa,querySubscription:yt,refreshInterval:mt,absoluteRange:Ot,cache:Wt,supplementaryQueries:et}=mn;let Je,rt;const it=mn.queries.map(It=>({...It,datasource:It.datasource||_t?.getRef()}));_t!=null&&_e(Bt,jt().explore,_t,it);const Pt=(0,Ce.rk)(Wt,Ot);if(Pt)Je=(0,s.z)([(0,m.of)(Pt),Jt]).pipe((0,l.Z)(([It,Vt])=>ie(It,aa,ae({absoluteRange:Ot,refreshInterval:mt,queries:it}),it,Vt,an,Nt))),rt=Je.subscribe(It=>{Bt(Ge({exploreId:ft,response:It}))});else{if(!(0,T.zT)(it)||!_t)return;const It=_t?.interval;(0,T._u)(yt);const Vt={minInterval:It,maxDataPoints:On,liveStreaming:Nn},en=(0,W.O)(jt().user),ln=(0,T.bI)(ft,it,Vt,Fn,na,en,$t);if(Bt(Pe({exploreId:ft,loadingState:h.Gu.Loading})),Je=(0,s.z)([(0,F.BN)(_t,ln.request).pipe(Nn?(0,f.c)(500):a.D),Jt]).pipe((0,l.Z)(([Qt,xn])=>ie(Qt,aa,ae({absoluteRange:Ot,refreshInterval:mt,queries:it}),it,xn,an,Nt))),rt=Je.subscribe({next(Qt){const xn=jt().explore.panes[ft];if(Bt(Ge({exploreId:ft,response:Qt})),xn.scanning)if(console.log(Qt.series),Qt.state===h.Gu.Done&&Qt.series.length===0){const En=(0,L.Wb)(-1,xn.range);Bt((0,Ne.JA)({exploreId:ft,absoluteRange:En})),Bt(xt({exploreId:ft}))}else(Qt.series[0]?.length>0||Qt.state===h.Gu.Done)&&Bt(ye({exploreId:ft}))},error(Qt){Bt((0,V.dx)((0,U.gi)("Query processing error",Qt))),Bt(Pe({exploreId:ft,loadingState:h.Gu.Error})),console.error(Qt)},complete(){jt().explore.panes[ft].queryResponse.state===h.Gu.Loading&&Bt(Pe({exploreId:ft,loadingState:h.Gu.Done}))}}),Nn)for(const Qt of de.VW)Bt(Qe({exploreId:ft,type:Qt})),Bt(je({exploreId:ft,type:Qt}));else Bt(Xt({exploreId:ft,datasourceInstance:_t,transaction:ln,newQuerySource:Je,supplementaryQueries:et,queries:it,absoluteRange:Ot}))}Bt(Ke({exploreId:ft,querySubscription:rt}))}),At=(0,j.createAsyncThunk)("explore/runLoadMoreQueries",async({exploreId:ft,absoluteRange:Rt},{dispatch:Bt,getState:jt})=>{Bt(Xe(ft));const{datasourceInstance:Nt,containerWidth:$t,queryResponse:an}=jt().explore.panes[ft],{defaultCorrelationEditorDatasource:Jt,scopedVars:gn,showCorrelationEditorLinks:mn}=await(0,Ce.aj)(jt(),ft),_t=(0,le.M)(ft);let On;const Nn=an.logsResult?.queries||[],Fn=an.logsFrames.map(Wt=>Wt.refId),na=Nn.filter(Wt=>Fn.includes(Wt.refId)).map(Wt=>({...Wt,datasource:Wt.datasource||Nt?.getRef(),refId:Wt.refId,supportingQueryType:N.Q$.InfiniteScroll}));if(!(0,T.zT)(na)||!Nt)return;const aa={minInterval:Nt?.interval,maxDataPoints:$t},yt=(0,W.O)(jt().user),mt=(0,T.zq)(yt,{from:(0,i.oZ)(yt,Rt.from),to:(0,i.oZ)(yt,Rt.to)},(0,W.q)(jt().user)),Ot=(0,T.bI)(ft,na,aa,mt,!1,yt,gn);Bt(Pe({exploreId:ft,loadingState:h.Gu.Loading})),On=(0,s.z)([(0,F.BN)(Nt,Ot.request),_t]).pipe((0,l.Z)(([Wt,et])=>Wt.state!==h.Gu.Done?(0,m.of)({...an,state:h.Gu.Loading}):ie(P(an,Wt),an,ae({absoluteRange:Rt,queries:Nn,deduplicate:!0}),na,et,mn,Jt))),On.subscribe({next(Wt){Bt(Ge({exploreId:ft,response:Wt}))},error(Wt){Bt((0,V.dx)((0,U.gi)("Query processing error",Wt))),Bt(Pe({exploreId:ft,loadingState:h.Gu.Error})),console.error(Wt)},complete(){Bt(Pe({exploreId:ft,loadingState:h.Gu.Done}))}})}),bt=async(ft,Rt)=>{const Bt=ft.filter(Nt=>Nt.datasource?.uid!==w.uv),jt=(0,o.groupBy)(Bt,"datasource.uid");return await Promise.all(Object.values(jt).map(async Nt=>({datasource:await(0,I.l)().get(Nt[0].datasource,Rt),targets:Nt})))},Xt=(0,j.createAsyncThunk)("explore/handleSupplementaryQueries",async({datasourceInstance:ft,exploreId:Rt,transaction:Bt,newQuerySource:jt,supplementaryQueries:Nt,queries:$t,absoluteRange:an},{dispatch:Jt})=>{let gn;ft.meta.mixed?gn=await bt(Bt.request.targets,Bt.request.scopedVars):gn=[{datasource:ft,targets:Bt.request.targets}];for(const mn of de.VW){const _t=(0,de.Pm)(gn,mn,{...Bt.request,requestId:`${Bt.request.requestId}_${(0,o.snakeCase)(mn)}`},jt);_t?(Jt(Ve({exploreId:Rt,type:mn,dataProvider:_t})),Cn(Nt[mn].data,$t,an)||(Jt(je({exploreId:Rt,type:mn})),Nt[mn].enabled&&Jt(Yt(Rt,mn)))):Jt(Qe({exploreId:Rt,type:mn}))}});function Cn(ft,Rt,Bt){if(!ft)return!1;const jt=(0,o.zipObject)((0,o.map)(Rt,"refId"),Rt),Nt=(0,o.mapValues)((0,o.groupBy)(ft.data.map(gn=>gn.meta?.custom?.sourceQuery),"refId"),o.head),$t=ft.data.every(gn=>gn.meta?.custom?.logsVolumeType===x.Aj.FullRange),an=r()(jt,Nt),Jt=ft.data.every(gn=>{const mn=gn.meta?.custom?.absoluteRange;return mn?mn&&mn.from<=Bt.from&&Bt.to<=mn.to:!0});return $t&&an&&Jt}function vn(ft,Rt){return(Bt,jt)=>{const Nt=jt().explore.panes[ft].queries,$t=Rt.map((an,Jt)=>(0,T.eF)(an,Nt,Jt));Bt(ce({exploreId:ft,queries:$t})),Bt(xt({exploreId:ft}))}}function Wn(ft){return(Rt,Bt)=>{Rt(xe({exploreId:ft}));const jt=(0,L.Wb)(-1,Bt().explore.panes[ft].range);Rt((0,Ne.JA)({exploreId:ft,absoluteRange:jt})),Rt(xt({exploreId:ft}))}}function Dt(ft){return(Rt,Bt)=>{const jt=Bt().explore.panes[ft].queryResponse,Nt=Bt().explore.panes[ft].absoluteRange,$t=(0,Ce.O2)(Nt);jt.state===h.Gu.Done&&Rt(Oe({exploreId:ft,cacheKey:$t,queryResponse:jt}))}}function qt(ft){return(Rt,Bt)=>{Rt(we({exploreId:ft}))}}function Yt(ft,Rt){return(Bt,jt)=>{const{supplementaryQueries:Nt}=jt().explore.panes[ft],$t=Nt[Rt].dataProvider;if($t){const an=$t.subscribe({next:Jt=>{Bt(Ye({exploreId:ft,type:Rt,data:Jt}))}});Bt(ze({exploreId:ft,type:Rt,dataSubscription:an}))}}}function nn(ft,Rt,Bt){return(jt,Nt)=>{jt(Re({exploreId:ft,enabled:Rt,type:Bt})),(0,de.Oi)(Rt,Bt),Rt&&jt(Yt(ft,Bt))}}const Zt=(ft,Rt)=>{if(ke.match(Rt)){const{queries:Bt}=ft,{index:jt,query:Nt}
278=Rt.payload,$t=[...Bt.slice(0,jt+1),{...Nt},...Bt.slice(jt+1)];return{...ft,queries:$t,queryKeys:(0,T.dY)($t)}}if(Me.match(Rt)){const{queries:Bt}=Rt.payload;return{...ft,queries:Bt}}if($e.match(Rt))return(0,T._u)(ft.querySubscription),{...ft,...ft.queryResponse?{queryResponse:{...ft.queryResponse,state:h.Gu.Done}}:{}};if(ce.match(Rt)){const{queries:Bt}=Rt.payload;return{...ft,queries:Bt.slice(),queryKeys:(0,T.dY)(Bt)}}if(Ke.match(Rt)){const{querySubscription:Bt}=Rt.payload;return{...ft,querySubscription:Bt}}if(Re.match(Rt)){const{enabled:Bt,type:jt}=Rt.payload,{supplementaryQueries:Nt}=ft,$t=Nt[jt].dataSubscription;!Bt&&$t&&$t.unsubscribe();const an={...Nt,[jt]:{...Nt[jt],enabled:Bt,data:void 0}};return{...ft,supplementaryQueries:an}}if(Ve.match(Rt)){const{dataProvider:Bt,type:jt}=Rt.payload,{supplementaryQueries:Nt}=ft,$t=Nt[jt];$t?.dataSubscription&&$t.dataSubscription.unsubscribe();const an={...Nt,[jt]:{...$t,dataProvider:Bt,dataSubscription:void 0}};return{...ft,supplementaryQueries:an}}if(Qe.match(Rt)){const{type:Bt}=Rt.payload,{supplementaryQueries:jt}=ft,Nt=jt[Bt];Nt?.dataSubscription&&Nt.dataSubscription.unsubscribe();const $t={...jt,[Bt]:{...Nt,dataProvider:void 0,dataSubscription:void 0}};return{...ft,supplementaryQueries:$t}}if(je.match(Rt)){const{type:Bt}=Rt.payload,{supplementaryQueries:jt}=ft,Nt={...jt,[Bt]:{...jt[Bt],data:void 0}};return{...ft,supplementaryQueries:Nt}}if(ze.match(Rt)){const{dataSubscription:Bt,type:jt}=Rt.payload,{supplementaryQueries:Nt}=ft,$t={...Nt,[jt]:{...Nt[jt],dataSubscription:Bt}};return{...ft,supplementaryQueries:$t}}if(Ye.match(Rt)){let{data:Bt,type:jt}=Rt.payload;const{supplementaryQueries:Nt}=ft,$t={...Nt,[jt]:{...Nt[jt],data:Bt}};return{...ft,supplementaryQueries:$t}}if(Ge.match(Rt))return tn(ft,Rt);if(tt.match(Rt)){const{queries:Bt}=Rt.payload;return{...ft,queries:Bt,queryKeys:(0,T.dY)(Bt)}}if(Pe.match(Rt)){const{loadingState:Bt}=Rt.payload;return{...ft,queryResponse:{...ft.queryResponse,state:Bt}}}if(Se.match(Rt)){const{isPaused:Bt}=Rt.payload;return{...ft,isPaused:Bt}}if(xe.match(Rt))return{...ft,scanning:!0};if(ye.match(Rt))return{...ft,scanning:!1,scanRange:void 0};if(Oe.match(Rt)){const{cache:jt}=ft,{queryResponse:Nt,cacheKey:$t}=Rt.payload;let an=[...jt];return an.some(gn=>gn.key===$t)||(an=[{key:$t,value:Nt},...an].slice(0,5)),{...ft,cache:an}}if(we.match(Rt))return{...ft,cache:[]};if(Ee.match(Rt)){if(!ft.logsResult)return{...ft,clearedAtIndex:null};if(ft.queryResponse.state===h.Gu.Loading)return{...ft,clearedAtIndex:null,logsResult:{...ft.logsResult,rows:[]}};const Bt=ft.clearedAtIndex?ft.clearedAtIndex+ft.logsResult.rows.length:ft.logsResult.rows.length-1;return{...ft,clearedAtIndex:Bt,logsResult:{...ft.logsResult,rows:[]}}}return ft},tn=(ft,Rt)=>{const{response:Bt}=Rt.payload,{request:jt,error:Nt,graphResult:$t,logsResult:an,tableResult:Jt,rawPrometheusResult:gn,traceFrames:mn,nodeGraphFrames:_t,flameGraphFrames:On,rawPrometheusFrames:Nn,customFrames:Fn}=Bt;return Nt&&(Nt.type===g.v2.Timeout||Nt.type===g.v2.Cancelled)?{...ft}:jt?{...ft,queryResponse:Bt,graphResult:$t,tableResult:Jt,rawPrometheusResult:gn,logsResult:ft.isLive&&an?{...an,rows:(0,Ce.pg)(ft.clearedAtIndex,an.rows)}:an,showLogs:!!an,showMetrics:!!$t,showTable:!!Jt?.length,showTrace:!!mn.length,showNodeGraph:!!_t.length,showRawPrometheus:!!Nn.length,showFlameGraph:!!On.length,showCustom:!!Fn?.length,clearedAtIndex:ft.isLive?ft.clearedAtIndex:null}:{...ft}}},20718:(ee,B,e)=>{"use strict";e.d(B,{Jr:()=>h,K6:()=>a,Kl:()=>x,Qb:()=>o,i6:()=>m,pF:()=>l,qq:()=>u,st:()=>f,vC:()=>i});var t=e(25508),n=e(2543),r=e.n(n);const o=g=>g.explore.panes,s=g=>g.explore,m=g=>g.explore.richHistorySettings,a=(0,t.Mz)(o,Object.entries),l=(0,t.Mz)(a,g=>g.length>1),f=(0,t.Mz)(a,g=>g.some(p=>p[1].correlationEditorHelperData!==void 0)),h=g=>(0,t.Mz)(o,p=>Object.keys(p)[0]===g),u=g=>(0,t.Mz)(o,p=>p[g]),i=(0,t.Mz)(s,g=>g.correlationEditorDetails),x=(0,t.Mz)(a,g=>{const p=g.map(([P,d])=>{const D=[d?.datasourceInstance?.getRef()],b=d?.queries.map(v=>v.datasource)||[],E=[...D,...b].filter(v=>!!v);if(!(E===void 0||E.length===0))return{exploreId:P,datasources:(0,n.uniqBy)(E,v=>v.uid)}}).filter(P=>!!P),y=(0,n.uniqBy)((0,n.flatten)(p.map(P=>P.datasources)),P=>P.uid).map(P=>{let d=[];return p.forEach(D=>{D.datasources.some(b=>b.uid===P.uid)&&d.push(D.exploreId)}),{datasource:P,exploreIds:d}});return{exploreToDS:p,dsToExplore:y}
278})},94543:(ee,B,e)=>{"use strict";e.d(B,{$_:()=>v,GA:()=>I,GH:()=>P,Iy:()=>C,JA:()=>D,QP:()=>R,Xk:()=>O,eM:()=>c,hO:()=>y,iO:()=>b,ke:()=>S,zY:()=>d});var t=e(65307),n=e(25229),r=e(32899),o=e(28105),s=e(2863),m=e(90811),a=e(45229),l=e(56840),f=e(62635),h=e(23237),u=e(75421),i=e(74746),x=e(34984),g=e(35231),p=e(19050);const c=(0,t.VP)("explore/changeRange"),y=(0,t.VP)("explore/changeRefreshInterval"),P=T=>(L,K)=>{const{syncedTimes:A}=K().explore;A?Object.keys(K().explore.panes).forEach(W=>{L(D({...T,exploreId:W})),L((0,p.Od)({exploreId:W,preserveCache:!0}))}):(L(D({...T})),L((0,p.Od)({exploreId:T.exploreId,preserveCache:!0})))},d=T=>L=>{L((0,p.S6)({...T}))},D=T=>(L,K)=>{const{exploreId:A,absoluteRange:W,rawRange:N}=T,w=K().explore.panes[A],j=(0,x.O)(K().user),V=(0,x.q)(K().user),{range:U}=w;let F=U.raw;W&&(F={from:(0,n.oZ)(j,W.from),to:(0,n.oZ)(j,W.to)}),N&&(F=N);const M=(0,f.zq)(j,F,V),H={from:M.from.valueOf(),to:M.to.valueOf()};(0,u.jG)().init({timepicker:{},getTimezone:()=>j,timeRangeUpdated(_){},time:M.raw}),(0,s.w)().updateTimeRange(M),L(c({exploreId:A,range:M,absoluteRange:H}))};function b(T){return(L,K)=>{const A=K().explore.panes[T].range.raw;Object.keys(K().explore.panes).filter(N=>N!==T).forEach(N=>{L(P({exploreId:N,rawRange:A}))});const W=K().explore.syncedTimes;L((0,g.qz)({syncedTimes:!W}))}}function E(T){return(L,K)=>{const A=(0,x.O)(K().user),W=(0,x.q)(K().user);Object.entries(K().explore.panes).forEach(([N,w])=>{const j=(0,f.zq)(A,w.range.raw,W);T(N,w,j,L)})}}function v(){return E((T,L,K,A)=>{const W={from:K.from.valueOf(),to:K.to.valueOf()};A(P({exploreId:T,absoluteRange:W}))})}function C(T){return E((L,K,A,W)=>{const N=(0,h.Wb)(T,A);W(P({exploreId:L,absoluteRange:N}))})}function S(T){return E((L,K,A,W)=>{const N=(0,h.Zk)(A,T);W(P({exploreId:L,absoluteRange:N}))})}function O(){return(T,L)=>{const K=L().explore.panes[Object.keys(L().explore.panes)[0]].range.raw;navigator.clipboard.writeText(JSON.stringify(K)),a.A.emit(r.r1.alertSuccess,[(0,l.t)("time-picker.copy-paste.copy-success-message","Time range copied to clipboard")])}}function I(){return async(T,L)=>{const{range:K,isError:A}=await(0,h.zG)();if(A===!0){a.A.emit(r.r1.alertError,[(0,l.t)("time-picker.copy-paste.default-error-title","Invalid time range"),(0,l.t)("time-picker.copy-paste.default-error-message","{{error}} is not a valid time range",{error:K})]);return}if(L().explore.syncedTimes){T(P({exploreId:Object.keys(L().explore.panes)[0],rawRange:K})),T(P({exploreId:Object.keys(L().explore.panes)[1],rawRange:K}));return}T(P({exploreId:Object.keys(L().explore.panes)[0],rawRange:K}))}}const R=(T,L)=>{if(y.match(L)){const{refreshInterval:K}=L.payload,A=m.cC.isLive(K),W=(0,f.uE)(K),N=(0,i.zy)(T.logsResult,W);return m.cC.isLive(T.refreshInterval)&&!A&&(0,f._u)(T.querySubscription),{...T,refreshInterval:K,queryResponse:{...T.queryResponse,state:A?o.Gu.Streaming:o.Gu.Done},isLive:A,isPaused:A?!1:T.isPaused,logsResult:N}}if(c.match(L)){const{range:K,absoluteRange:A}=L.payload;return{...T,range:K,absoluteRange:A}}return T}},83953:(ee,B,e)=>{"use strict";e.d(B,{BE:()=>b,HZ:()=>d,O2:()=>E,RA:()=>D,Z9:()=>S,aj:()=>T,dq:()=>R,eO:()=>C,ng:()=>P,pg:()=>I,rk:()=>v});var t=e(2543),n=e.n(t),r=e(28105),o=e(22592),s=e(33239),m=e(25229),a=e(78282),l=e(53222),f=e(80977),h=e(18615),u=e(29043),i=e(62635),x=e(28998),g=e(10951),p=e(2513);const c=100,y="grafana.explore.style.graph",P=L=>{u.A.set(y,L)},d=L=>({containerWidth:0,datasourceInstance:null,history:[],queries:[],initialized:!1,range:{from:null,to:null,raw:p.k},absoluteRange:{from:null,to:null},scanning:!1,queryKeys:[],isLive:!1,isPaused:!1,queryResponse:D(),tableResult:null,graphResult:null,logsResult:null,clearedAtIndex:null,rawPrometheusResult:null,eventBridge:null,cache:[],supplementaryQueries:(0,g.Ez)(),panelsState:{},correlations:void 0,...L}),D=()=>({state:r.Gu.NotStarted,series:[],timeRange:(0,o.E2)(),graphFrames:[],logsFrames:[],traceFrames:[],nodeGraphFrames:[],flameGraphFrames:[],customFrames:[],tableFrames:[],rawPrometheusFrames:[],rawPrometheusResult:null,graphResult:null,logsResult:null,tableResult:null});async function b(L,K){let A;
278try{A=await(0,x.tR)().get(K)}catch{A=await(0,x.tR)().get()}if(A.init)try{A.init()}catch(j){console.error(j)}let W=[];const N=(0,l.tU)(),w=await N.getRichHistory({search:"",sortOrder:f.x.Ascending,datasourceFilters:[A.name],starred:!1});if((w.total||0)>0&&w.richHistory.forEach(j=>{j.queries.forEach(V=>{W.push({ts:parseInt(j.id,10),query:V})})}),W.length<c){const j=await N.getRichHistory({search:"",sortOrder:f.x.Ascending,datasourceFilters:[h.uv],starred:!1});(j.total||0)>0&&j.richHistory.forEach(V=>{V.queries.forEach(U=>{U?.datasource?.uid===A.uid&&W.push({ts:parseInt(V.id,10),query:U})})})}if(W.length<c){const j=`grafana.explore.history.${A.meta?.id}`;W=[...W,...u.A.getObject(j,[])]}return W.length>c&&(W.length=c),(0,i.dr)(L,A.uid),{history:W,instance:A}}function E(L){const K={from:L.from,to:L.to};return Object.entries(K).map(([W,N])=>`${encodeURIComponent(W)}=${encodeURIComponent(N.toString())}`).join("&")}function v(L,K){const A=E(K),W=L.findIndex(w=>w.key===A);return W>=0?L[W].value:void 0}function C(L,K){return{from:s.parse(L.from,!1,K),to:s.parse(L.to,!0,K),raw:L}}function S(L){let K=p.k,A={from:O(L.from),to:O(L.to)};return A.from!==null&&A.to!==null&&(K={from:A.from,to:A.to}),K}function O(L){if(L===null)return null;if((0,m.Ar)(L))return L;if(typeof L!="string")return null;const K=L;if(K.indexOf("now")!==-1)return K;if(K.length===8)return(0,m.yT)(K,"YYYYMMDD");if(K.length===15)return(0,m.yT)(K,"YYYYMMDDTHHmmss");if(K.length===19)return(0,m.yT)(K,"YYYY-MM-DD HH:mm:ss");if(K.match(/^\d+$/)){const W=parseInt(K,10);return(0,m.yT)(W)}const A=(0,m.yT)(K);return A.isValid()?A:null}const I=(L,K)=>K?L?K.slice(L+1):K:[],R=(L,K)=>L===h.uv?(0,t.uniq)(K.map(A=>A.datasource?.uid).filter(A=>!!A)):[L];async function T(L,K){const A=L.explore.panes[K].correlationEditorHelperData,W=L.explore.correlationEditorDetails?.editorMode||!1,N=Object.keys(L.explore.panes)[0]===K,w=W&&N,j=w?await(0,a.l)().get():void 0,V=W&&!N&&A!==void 0;let U={};return V&&A!==void 0&&Object.entries(A?.vars).forEach(F=>{U[F[0]]={value:F[1]}}),{defaultCorrelationEditorDatasource:j,scopedVars:U,showCorrelationEditorLinks:w}}},78529:(ee,B,e)=>{"use strict";e.d(B,{JQ:()=>v,O1:()=>S,QL:()=>b,YV:()=>D,_O:()=>R});var t=e(2543),n=e.n(t),r=e(96540),o=e(7102),s=e(39443),m=e(79609),a=e(1906),l=e(38036),f=e(5556),h=e(2863),u=e(27489),i=e(15130),x=e(70191),g=e(46072),p=e(82345),c=e(55133);const P=[T=>!T.internal||i.TP.hasAccessToExplore()],d="grafana_data_link_clicked",D=(T,L)=>A=>{const{field:W,dataLinkScopedVars:N,frame:w,link:j,linkModel:V}=A,{valueRowIndex:U}=A.config;if(U===void 0)return V;const F=b({field:W,rowIndex:U,splitOpenFn:T,range:L,vars:N,dataFrame:w,linksToProcess:[j]});return F.length?(0,t.first)(F):void 0},b=T=>{const{field:L,vars:K,splitOpenFn:A,range:W,rowIndex:N,dataFrame:w}=T,j={...K||{}};j.__value={value:{raw:L.values[N]},text:"Raw value"};let V;if(w){if(V=(0,o.F)({frame:w,rowIndex:N}),j.__data={value:{name:w.name,refId:w.refId,fields:V},text:"Data"},w.meta?.type===s.m.LogLines){const M=(0,g.ww)(w)?.getLogFrameLabels();M!=null&&Object.entries(M[N]).forEach(H=>{j[H[0]]={value:H[1]}})}w.fields.forEach(F=>{V&&V[F.name]&&(j[F.name]={value:V[F.name]})}),j.__targetField={value:V[L.name]}}const U=T.linksToProcess||L.config.links;return U?U.filter(H=>P.every(_=>_(H,j))).map(H=>{let _={};H.meta?.transformations&&H.meta?.transformations.forEach(Y=>{let Q;Y.field?Q=w?.fields.find(q=>q.name===Y.field)?.values[N]:Q=L.values[N],_={..._,...(0,x.k)(Y,Q,L.name)}});const Z={...j,..._},ne=S(H,Z);let te=[];if(ne.variables.length===0){const Y=L.name.toString();te.push({variableName:Y,value:"",match:""})}else te=ne.variables;if(ne.allVariablesDefined)if(H.internal){const Y=J=>{(0,u.rR)(d,{origin:H.origin||m.x0.Datasource,app:a.Jk.Explore,internal:!0}),A?.(J)};return{...(0,l.u)({link:H,internalLink:H.internal,scopedVars:Z,range:W,field:L,onClickFn:T.splitOpenFn?J=>Y(J):void 0,replaceVariables:(0,h.w)().replace.bind((0,h.w)())}),variables:te}}else{const Y=(J,q)=>(0,h.w)().replace(J,{...q,...Z,...j}),Q=(0,p.mQ)().getDataLinkUIModel(H,Y,L);return Q.title||(Q.title=E(Q.href)),Q.target=Q.target??"_blank",{...Q,variables:te}}else return}).filter(H=>!!H):[]};function E(T){T.indexOf("://")<0&&(T=`http://${T}`);let L;try{L=new URL(T).hostname}catch{L=T}return L}function v(T,L){return(0,r.useCallback)((K,A)=>K.fields.flatMap(W=>W.config?.links&&W.config?.links.length?b({field:W,rowIndex:A,range:T,dataFrame:K,splitOpenFn:L}):[]),[T,L])}const C=["__from","__to","__interval","__interval_ms","__org","__user","__range","__rate_interval","__timeFilter","timeFilter"];function S(T,L){let K=[];
278return(0,h.w)().replace.bind((0,h.w)())(O(T),L,void 0,K),K=(0,t.uniqBy)(K,"variableName"),{variables:K,allVariablesDefined:K.filter(W=>!C.includes(W.variableName)).every(W=>W.found)}}function O(T){let L="",K;for(K in T)typeof T[K]=="string"?L+=" "+T[K]:typeof T[K]=="object"&&(L+=" "+O(T[K]));return L}const I=T=>T[1]!==void 0,R=T=>{const L=Object.entries(T).filter(I).map(([K,A])=>{const W=(0,c.m)(A);return W.range={to:A.range.to.valueOf().toString(),from:A.range.from.valueOf().toString()},[K,W]}).reduce((K,[A,W])=>({...K,[A]:W}),{});return f.kM.renderUrl("/explore",{schemaVersion:1,panes:JSON.stringify(L)})}},80144:(ee,B,e)=>{"use strict";e.d(B,{v:()=>n});var t=e(39796);function n(r){const o=new Set(r.map(s=>s.refId).filter(Boolean));return o.size===r.length?r:(o.clear(),r.map(s=>{if(s.refId&&!o.has(s.refId))return o.add(s.refId),s;const m=(0,t.M)(r);return o.add(m),{...s,refId:m}}))}},10951:(ee,B,e)=>{"use strict";e.d(B,{Ez:()=>g,Oi:()=>x,Pm:()=>y,VW:()=>u});var t=e(2543),n=e.n(t),r=e(88483),o=e(44240),s=e(6276),m=e(29405),a=e(67770),l=e(28105),f=e(29043),h=e(37234);const u=[a.cF.LogsVolume,a.cF.LogsSample],i=P=>`grafana.explore.logs.enable${P}`,x=(P,d)=>{f.A.set(i(d),P?"true":"false")},g=()=>{let P={[a.cF.LogsVolume]:{enabled:!0},[a.cF.LogsSample]:{enabled:!1}};for(const d of u){if(d===a.cF.LogsSample)continue;f.A.get(i(d))==="false"&&(P[d]={enabled:!1})}return P},p=(P,d,D)=>new r.c(b=>P.subscribe(E=>{if(E.logsResult&&E.logsResult.rows&&E.logsResult.visibleRange&&E.logsResult.bucketSize!==void 0&&E.state===l.Gu.Done){const v=E.logsResult.bucketSize,C=d.map(I=>I.refId),S=(0,t.groupBy)(E.logsResult.rows,"dataFrame.refId");let O=[];C.forEach(I=>{if(S[I]?.length){const R=(0,h.J9)(S[I],v);O=[...O,...R];const T={logsVolumeType:a.Aj.Limited,absoluteRange:E.logsResult?.visibleRange,datasourceName:D,sourceQuery:d.find(L=>L.refId===I)};b.next({data:O.map(L=>{const K=L.meta?.custom||{};return{...L,meta:{custom:{...K,...T}}}}),state:E.state})}}),b.complete()}})),c=(P,d,D,b)=>{if(P===a.cF.LogsVolume)return p(d,D,b)},y=(P,d,D,b)=>{const v=P.map(({datasource:C,targets:S},O)=>{const I=(0,t.cloneDeep)(D);if(I.requestId=`${I.requestId||""}_${O}`,I.targets=S,(0,a.Nc)(C,d)){if(C.getDataProvider)return C.getDataProvider(d,I);if(C.getSupplementaryRequest){const R=C.getSupplementaryRequest(d,I);return R?d===a.cF.LogsVolume?(0,h.sg)(C,R,{targets:I.targets}):(0,h.Wr)(C,R):void 0}else return}else return c(d,b,S,C.name)}).filter(l.zz);if(v.length!==0)return v.length===1?v[0]:(0,o.h)(...v).pipe((0,m.S)((C,S)=>C.errors&&C.errors.length||S.state===l.Gu.NotStarted?C:S.state===l.Gu.Loading&&C.state===l.Gu.NotStarted?{...C,state:l.Gu.Loading}:S.state&&S.state!==l.Gu.Done?C:{...C,data:[...C.data,...S.data],state:l.Gu.Done},{data:[],state:l.Gu.NotStarted}),(0,s.d)())}},29328:(ee,B,e)=>{"use strict";e.d(B,{Ex:()=>S,$i:()=>C});var t=e(65474),n=e(69862),r=e(11594),o=e(36580),s=e(2863),m=e(78282),a=e(74848),l=e(96540),f=e(18027),h=e(18857),u=e(56840),i=e(91073),x=e(18203),g=e(89931),p=e(4652),c=e(32576),y=e(38610),P=e(4651),d=e(82779);const D=15;function b(){const O=(0,l.useRef)({}),I=(0,l.useCallback)(T=>{switch(T){case P.Tz.math:case P.Tz.reduce:case P.Tz.resample:case P.Tz.threshold:case P.Tz.sql:return O.current[T];case P.Tz.classic:return}},[]),R=(0,l.useCallback)((T,L)=>{switch(T){case P.Tz.math:O.current.math=L;break;case P.Tz.reduce:case P.Tz.resample:case P.Tz.threshold:O.current.reduce=L,O.current.resample=L,O.current.threshold=L;break;case P.Tz.sql:O.current.sql=L}},[]);return{getCachedExpression:I,setCachedExpression:R}}function E(O){const{query:I,queries:R,onRunQuery:T,onChange:L,app:K}=O,{getCachedExpression:A,setCachedExpression:W}=b();(0,l.useEffect)(()=>{W(I.type,I.expression)},[I.expression,I.type,W]);const N=(0,l.useCallback)(V=>{const U=A(V.value),F=(0,d.rV)({...I,type:V.value});L({...F,expression:U??F.expression})},[I,L,A]),w=()=>{const V=R.filter(U=>I.refId!==U.refId).map(U=>({value:U.refId,label:U.refId}));switch(I.type){case P.Tz.math:return(0,a.jsx)(x.z,{onChange:L,query:I,labelWidth:D,onRunQuery:T});case P.Tz.reduce:return(0,a.jsx)(g.Z,{refIds:V,onChange:L,labelWidth:D,query:I,app:K});case P.Tz.resample:return(0,a.jsx)(p.C,{query:I,labelWidth:D,onChange:L,refIds:V});case P.Tz.classic:return(0,a.jsx)(i.z,{onChange:L,query:I,refIds:V});case P.Tz.threshold:return(0,a.jsx)(y.O,{onChange:L,query:I,labelWidth:D,refIds:V});case P.Tz.sql:return(0,a.jsx)(c.k,{onChange:L,query:I,refIds:V})}},j=P.uQ.find(V=>V.value===I.type);return(0,a.jsxs)("div",{children:[(0,a.jsx)(f.I,{label:(0,u.t)("expressions.expression-query-editor.label-operation","Operation"),labelWidth:D,children:(0,a.jsx)(h.l6,{options:P.uQ,value:j,onChange:N,width:25})}),w()]})}class v extends o.iy{constructor(I){super(I),this.instanceSettings=I}applyTemplateVariables(I,R){const T=(0,s.w)();return{...I,expression:T.replace(I.expression,R),window:T.replace(I.window,R)}}getCollapsedText(I){return`Expression: ${I.type}`}query(I){let R=I.targets.map(async L=>{const K=await(0,m.l)().get(L.datasource);return K.interpolateVariablesInQueries?K?.interpolateVariablesInQueries([L],I.scopedVars,I.filters)[0]:L});
278return(0,t.H)(Promise.all(R)).pipe((0,n.Z)(L=>super.query({...I,targets:L})))}newQuery(I){return{refId:"--",datasource:o.dR,type:I?.type??P.Tz.math,...I}}}const C={id:-100,uid:P.Uj,name:o.dR.name,type:o.dR.type,access:"proxy",meta:{baseUrl:"",module:"",type:r.QE.datasource,name:o.dR.type,id:o.dR.type,info:{author:{name:"Grafana Labs"},logos:{small:"public/img/icn-datasource.svg",large:"public/img/icn-datasource.svg"},description:"Adds expression support to Grafana",screenshots:[],links:[],updated:"",version:""}},jsonData:{},readOnly:!0},S=new v(C);S.meta={id:o.dR.type,info:{logos:{small:"public/img/icn-datasource.svg",large:"public/img/icn-datasource.svg"}}},S.components={QueryEditor:E}},91073:(ee,B,e)=>{"use strict";e.d(B,{z:()=>D});var t=e(74848),n=e(97095),r=e(18027),o=e(45861),s=e(30703),m=e(56840),a=e(82779),l=e(22803),f=e(63142),h=e(41654),u=e(15356),i=e(18857),x=e(63527),g=e(2954);const p=g.A.reducerTypes.map(b=>({label:b.text,value:b.value})),c=g.A.evalOperators.map(b=>({label:b.text,value:b.value})),y=g.A.evalFunctions.map(b=>({label:b.text,value:b.value})),P=({condition:b,index:E,onChange:v,onRemoveCondition:C,refIds:S})=>{const O=(0,f.of)(d),I=N=>{v({...b,operator:{type:N.value}})},R=N=>{v({...b,reducer:{type:N.value,params:[]}})},T=N=>{v({...b,query:{params:[N.value]}})},L=N=>{v({...b,evaluator:{params:b.evaluator.params,type:N.value}})},K=(N,w)=>{const j=parseFloat(N.currentTarget.value),V=[...b.evaluator.params];V[w]=j,v({...b,evaluator:{...b.evaluator,params:V}})},A=(0,l.css)({width:"75px"}),W=b.evaluator.type===g.p.IsWithinRange||b.evaluator.type===g.p.IsOutsideRange||b.evaluator.type===g.p.IsOutsideRangeIncluded||b.evaluator.type===g.p.IsWithinRangeIncluded;return(0,t.jsxs)(h.B,{children:[(0,t.jsxs)("div",{style:{flex:1},children:[(0,t.jsxs)(n.C,{children:[E===0?(0,t.jsx)("div",{className:(0,l.cx)(O.button,A),children:"WHEN"}):(0,t.jsx)(u.f,{className:(0,l.cx)(O.buttonSelectText,A),options:c,onChange:I,value:c.find(N=>N.value===b.operator.type)}),(0,t.jsx)(i.l6,{options:p,onChange:R,width:20,value:p.find(N=>N.value===b.reducer.type)}),(0,t.jsx)("div",{className:O.button,children:"OF"}),(0,t.jsx)(i.l6,{onChange:T,options:S,width:"auto",value:S.find(N=>N.value===b.query.params[0])})]}),(0,t.jsxs)(n.C,{children:[(0,t.jsx)(u.f,{className:O.buttonSelectText,options:y,onChange:L,value:y.find(N=>N.value===b.evaluator.type)}),W?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.p,{type:"number",width:10,onChange:N=>K(N,0),value:b.evaluator.params[0]}),(0,t.jsx)("div",{className:O.button,children:"TO"}),(0,t.jsx)(x.p,{type:"number",width:10,onChange:N=>K(N,1),value:b.evaluator.params[1]})]}):b.evaluator.type!==g.p.HasNoValue?(0,t.jsx)(x.p,{type:"number",width:10,onChange:N=>K(N,0),value:b.evaluator.params[0]}):null]})]}),(0,t.jsx)(o.$n,{variant:"secondary",type:"button",onClick:()=>C(E),children:(0,t.jsx)(s.I,{name:"trash-alt"})})]})},d=b=>{const E=(0,l.css)({color:b.colors.primary.text,fontSize:b.typography.bodySmall.fontSize});return{buttonSelectText:E,button:(0,l.cx)((0,l.css)({display:"flex",alignItems:"center",borderRadius:b.shape.radius.default,fontWeight:b.typography.fontWeightMedium,border:`1px solid ${b.colors.border.weak}`,whiteSpace:"nowrap",padding:`0 ${b.spacing(1)}`,backgroundColor:b.colors.background.canvas}),E)}},D=({onChange:b,query:E,refIds:v})=>{const C=(I,R)=>{E.conditions&&b({...E,conditions:[...E.conditions.slice(0,R),I,...E.conditions.slice(R+1)]})},S=()=>{if(E.conditions){const I=E.conditions.at(-1)?.query?.params??[],R={...a.P0,query:{params:I}};b({...E,conditions:E.conditions.length>0?[...E.conditions,R]:[R]})}},O=I=>{if(E.conditions){const R=E.conditions[I],T=E.conditions.filter(L=>L!==R).map((L,K)=>K===0?{...L,operator:{type:"when"}}:L);b({...E,conditions:T})}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(n.C,{children:(0,t.jsx)(r.I,{label:(0,m.t)("expressions.classic-conditions.label-conditions","Conditions"),labelWidth:14,children:(0,t.jsx)("div",{children:E.conditions?.map((I,R)=>{if(I)return(0,t.jsx)(P,{index:R,condition:I,onChange:T=>C(T,R),onRemoveCondition:O,refIds:v},R)})})})}),(0,t.jsx)(o.$n,{variant:"secondary",type:"button",onClick:S,children:(0,t.jsx)(s.I,{name:"plus-circle"})})]})}},18203:(ee,B,e)=>{"use strict";e.d(B,{z:()=>i});var t=e(74848),n=e(22803),r=e(63142),o=e(41654),s=e(18027),m=e(79233),a=e(59243),l=e(30703),f=e(87105),h=e(56840);const u="Math operations on one or more queries. You reference the query by ${refId} ie. $A, $B, $C etc\nThe sum of two scalar values: $A + $B > 10",i=({labelWidth:c,onChange:y,query:P,onRunQuery:d})=>{const D=v=>{y({...P,expression:v.target.value})},b=(0,r.of)(g),E=()=>{P.expression&&d()};return(0,t.jsx)(o.B,{children:(0,t.jsx)(s.I,{label:(0,t.jsx)(m.c,{width:"auto",children:(0,t.jsx)(a.G,{fitContent:!0,content:(0,t.jsxs)("div",{className:b.documentationContainer,children:[(0,t.jsxs)("div",{children:["Run math operations on one or more queries. You reference the query by ","${refId}"," ie. $A, $B, $C etc.",(0,t.jsx)("br",{}),"Example: ",(0,t.jsx)("code",{children:"$A + $B"})]}),(0,t.jsx)("header",{className:b.documentationHeader,children:(0,t.jsx)(h.x6,{i18nKey:"expressions.math.available-math-functions",children:"Available math functions"})}),(0,t.jsxs)("div",{className:b.documentationFunctions,children:[(0,t.jsx)(x,{name:"abs",description:"returns the absolute value of its argument which can be a number or a series"}),(0,t.jsx)(x,{name:"is_inf",description:"returns 1 for Inf values (negative or positive) and 0 for other values. It's able to operate on series or scalar values."}),(0,t.jsx)(x,{name:"is_nan",description:"returns 1 for NaN values and 0 for other values. It's able to operate on series or scalar values."}),(0,t.jsx)(x,{name:"is_null",description:"returns 1 for null values and 0 for other values. It's able to operate on series or scalar values."}),(0,t.jsx)(x,{name:"is_number",description:"returns 1 for all real number values and 0 for non-number. It's able to operate on series or scalar values."}),(0,t.jsx)(x,{name:"log",description:"returns the natural logarithm of its argument, which can be a number or a series"}),(0,t.jsx)(x,{name:"inf, infn, nan, and null",description:"The inf for infinity positive, infn for infinity negative, nan, and null functions all return a single scalar value that matches its name."}),(0,t.jsx)(x,{name:"round",description:"returns a rounded integer value. It's able to operate on series or escalar values."}),(0,t.jsx)(x,{name:"ceil",description:"rounds the number up to the nearest integer value. It's able to operate on series or escalar values."}),(0,t.jsx)(x,{name:"floor",description:"rounds the number down to the nearest integer value. It's able to operate on series or escalar values."})]})]}),title:(0,t.jsxs)(o.B,{gap:1,direction:"row",children:[(0,t.jsx)(l.I,{name:"book-open"})," Math operator"]}),footer:(0,t.jsxs)("div",{children:["See our additional documentation on"," ",(0,t.jsxs)("a",{className:b.documentationLink,target:"_blank",href:"https://grafana.com/docs/grafana/latest/panels/query-a-data-source/use-expressions-to-manipulate-data/about-expressions/#math",rel:"noreferrer",children:[(0,t.jsx)(l.I,{size:"xs",name:"external-link-alt"})," Math expressions"]}),"."]}),closeButton:!0,placement:"bottom-start",children:(0,t.jsxs)("div",{className:b.info,children:["Expression ",(0,t.jsx)(l.I,{name:"info-circle"})]})})}),labelWidth:c,grow:!0,shrink:!0,children:(0,t.jsx)(f.f,{value:P.expression,onChange:D,rows:1,placeholder:u,onBlur:E,style:{minWidth:250,lineHeight:"26px",minHeight:32}})})})},x=({name:c,description:y})=>{const P=(0,r.of)(p);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:P.name,children:c}),(0,t.jsx)("span",{className:P.description,children:y})]})},g=c=>({documentationHeader:(0,n.css)({fontSize:c.typography.h5.fontSize,fontWeight:c.typography.h5.fontWeight}),documentationLink:(0,n.css)({color:c.colors.text.link}),documentationContainer:(0,n.css)({display:"flex",flex:1,flexDirection:"column",gap:c.spacing(2),padding:c.spacing(1,2)}),documentationFunctions:(0,n.css)({display:"grid",gridTemplateColumns:"max-content auto",columnGap:c.spacing(2)}),info:(0,n.css)({display:"flex",flexDirection:"row",alignItems:"center",cursor:"pointer",gap:c.spacing(1)})}),p=c=>({name:(0,n.css)({fontWeight:c.typography.fontWeightBold}),description:(0,n.css)({fontSize:c.typography.bodySmall.fontSize,color:c.colors.text.disabled})})},89931:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>u});var t=e(74848),n=e(1906),r=e(18027),o=e(63527),s=e(34999),m=e(89640),a=e(97095),l=e(18857),f=e(56840),h=e(4651);const u=({labelWidth:i="auto",onChange:x,app:g,refIds:p,query:c})=>{const y=h.Cu.find(O=>O.value===c.reducer),P=O=>{x({...c,expression:O.value})},d=O=>{x({...c,reducer:O.value})},D=O=>{x({...c,settings:O})},b=O=>{let I;switch(O.value){case h.Mt.Strict:I={mode:h.Mt.Strict};break;case h.Mt.ReplaceNonNumbers:let R=0;c.settings?.mode===h.Mt.ReplaceNonNumbers&&(R=c.settings?.replaceWithValue??0),I={mode:h.Mt.ReplaceNonNumbers,replaceWithValue:R};break;default:I={mode:O.value}}D(I)},E=O=>{const I=O.currentTarget.valueAsNumber;D({mode:h.Mt.ReplaceNonNumbers,replaceWithValue:I??0})},v=c.settings?.mode??h.Mt.Strict,C=()=>
278{if(v===h.Mt.ReplaceNonNumbers)return(0,t.jsx)(r.I,{label:(0,f.t)("expressions.reduce.replace-with-number.label-replace-with","Replace with"),labelWidth:i,children:(0,t.jsx)(o.p,{type:"number",width:10,onChange:E,value:c.settings?.replaceWithValue??0})})},S=()=>{const O=g===n.Jk.UnifiedAlerting;return v!==h.Mt.Strict||O?null:(0,t.jsx)(s.F,{title:(0,f.t)("reduce.strictMode.title","Strict Mode Behaviour"),severity:"info",children:(0,t.jsxs)(f.x6,{i18nKey:"reduce.strictMode.description",children:["When ",(0,t.jsx)("code",{children:"Reduce Strict mode"})," is used, the ",(0,t.jsx)("code",{children:"fill(null)"})," function (InfluxQL) will result in"," ",(0,t.jsx)("code",{children:"NaN"}),"."," ",(0,t.jsx)(m.Y,{href:"https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/expression-queries/#reduction-modes",children:"See the documentation for more details."})]})})};return(0,t.jsxs)(t.Fragment,{children:[S(),(0,t.jsx)(a.C,{children:(0,t.jsx)(r.I,{label:(0,f.t)("expressions.reduce.label-input","Input"),labelWidth:i,children:(0,t.jsx)(l.l6,{onChange:P,options:p,value:c.expression,width:"auto"})})}),(0,t.jsxs)(a.C,{children:[(0,t.jsx)(r.I,{label:(0,f.t)("expressions.reduce.label-function","Function"),labelWidth:i,children:(0,t.jsx)(l.l6,{options:h.Cu,value:y,onChange:d,width:20})}),(0,t.jsx)(r.I,{label:(0,f.t)("expressions.reduce.label-mode","Mode"),labelWidth:i,children:(0,t.jsx)(l.l6,{onChange:b,options:h.HZ,value:v,width:25})}),C()]})]})}},4652:(ee,B,e)=>{"use strict";e.d(B,{C:()=>l});var t=e(74848),n=e(97095),r=e(18027),o=e(18857),s=e(63527),m=e(56840),a=e(4651);const l=({labelWidth:f="auto",onChange:h,refIds:u,query:i})=>{const x=a.PN.find(d=>d.value===i.downsampler),g=a.iX.find(d=>d.value===i.upsampler),p=d=>{h({...i,window:d.target.value})},c=d=>{h({...i,expression:d.value})},y=d=>{h({...i,downsampler:d.value})},P=d=>{h({...i,upsampler:d.value})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.C,{children:(0,t.jsx)(r.I,{label:(0,m.t)("expressions.resample.label-input","Input"),labelWidth:f,children:(0,t.jsx)(o.l6,{onChange:c,options:u,value:i.expression,width:20})})}),(0,t.jsxs)(n.C,{children:[(0,t.jsx)(r.I,{label:(0,m.t)("expressions.resample.label-resample-to","Resample to"),labelWidth:f,tooltip:(0,m.t)("expressions.resample.tooltip-s-m-h","10s, 1m, 30m, 1h"),children:(0,t.jsx)(s.p,{onChange:p,value:i.window,width:15})}),(0,t.jsx)(r.I,{label:(0,m.t)("expressions.resample.label-downsample","Downsample"),children:(0,t.jsx)(o.l6,{options:a.PN,value:x,onChange:y,width:25})}),(0,t.jsx)(r.I,{label:(0,m.t)("expressions.resample.label-upsample","Upsample"),children:(0,t.jsx)(o.l6,{options:a.iX,value:g,onChange:P,width:25})})]})]})}},32576:(ee,B,e)=>{"use strict";e.d(B,{k:()=>l});var t=e(74848),n=e(22803),r=e(96540),o=e(97504),s=e(63142);const m=2,a={id:"mysql"},l=({onChange:h,refIds:u,query:i,alerting:x=!1})=>{const g=(0,r.useMemo)(()=>u.map(b=>b.value),[u]),p=`-- Run MySQL-dialect SQL against the tables returned from your data sources. 279-- Data source queries (ie "${g[0]}") are available as tables and referenced by query-name 280-- Fields are available as columns, as returned from the data source. 281SELECT * 282FROM ${g[0]} 283LIMIT 10`,c=(0,s.of)(f),y=(0,r.useRef)(null),[P,d]=(0,r.useState)({height:0}),D=b=>{h({...i,expression:b,format:x?"alerting":void 0})};return(0,r.useEffect)(()=>{if(!y.current)return;const b=new ResizeObserver(E=>{const{height:v}=E[0].contentRect;d({height:v})});return b.observe(y.current),()=>b.disconnect()},[]),(0,r.useEffect)(()=>{i.expression||D(p)},[]),(0,t.jsx)("div",{ref:y,className:c.editorContainer,children:(0,t.jsx)(o.Y,{query:i.expression||p,onChange:D,height:P.height-m,language:a})})},f=()=>
283({editorContainer:(0,n.css)({height:"240px",resize:"vertical",overflow:"auto",minHeight:"100px"})})},38610:(ee,B,e)=>{"use strict";e.d(B,{O:()=>T});var t=e(74848),n=e(22803),r=e(2543),o=e(96540),s=e(63142),m=e(97095),a=e(18027),l=e(18857),f=e(63527),h=e(21285),u=e(41654),i=e(65642),x=e(56840),g=e(2954),p=e(4651),c=e(81988),y=e(66258),P=e(65307);const d=(0,P.VP)("thresold/updateRefId"),D=(0,P.VP)("thresold/updateThresholdType"),b=(0,P.VP)("thresold/updateThresholdParams"),E=(0,P.VP)("thresold/updateHysteresis"),v=(0,P.VP)("thresold/updateUnloadParams"),C=(0,P.vy)({type:p.Tz.threshold,refId:"",conditions:[]},A=>{A.addCase(d,(W,N)=>{W.expression=N.payload}),A.addCase(D,(W,N)=>{const w=N.payload.evalFunction,j=N.payload.onError;if(W.conditions[0].evaluator.type=w,!!W.conditions[0].unloadEvaluator){const U=S(W.conditions[0].evaluator.type);j&&j(void 0),W.conditions[0].evaluator.type=w;const F={type:U,params:W.conditions[0].evaluator?.params??[0,0]};W.conditions[0].unloadEvaluator=F}}),A.addCase(b,(W,N)=>{const{param:w,index:j}=N.payload;W.conditions[0].evaluator.params[j]=w}),A.addCase(E,(W,N)=>{const{hysteresisChecked:w,onError:j}=N.payload;w?W.conditions[0].unloadEvaluator={type:S(W.conditions[0].evaluator.type),params:W.conditions[0].evaluator?.params??[0,0]}:(W.conditions[0].unloadEvaluator=void 0,j&&j(void 0))}),A.addCase(v,(W,N)=>{const{param:w,index:j,onError:V}=N.payload;W.conditions[0].unloadEvaluator?W.conditions[0].unloadEvaluator.params[j]=w:W.conditions[0].unloadEvaluator={type:S(W.conditions[0].evaluator.type),params:W.conditions[0].evaluator?.params??[0,0]};const U=O(W.conditions[0]),{errorMsg:F,errorMsgFrom:M,errorMsgTo:H}=U??{};V&&V(F||M||H)})});function S(A){return A===g.p.IsAbove?g.p.IsBelow:A===g.p.IsBelow?g.p.IsAbove:A===g.p.IsEqual?g.p.IsNotEqual:A===g.p.IsNotEqual?g.p.IsEqual:A===g.p.IsGreaterThanEqual?g.p.IsLessThanEqual:A===g.p.IsLessThanEqual?g.p.IsGreaterThanEqual:A===g.p.IsWithinRange?g.p.IsOutsideRange:A===g.p.IsOutsideRange?g.p.IsWithinRange:A===g.p.IsWithinRangeIncluded?g.p.IsOutsideRangeIncluded:A===g.p.IsOutsideRangeIncluded?g.p.IsWithinRangeIncluded:g.p.IsBelow}function O(A){const{unloadEvaluator:W,evaluator:N}=A;if(!N)return;if(W?.params[0]===void 0||Number.isNaN(W?.params[0]))return{errorMsg:"This value cannot be empty"};const{type:w,params:j}=N,{params:V}=W;if(w===g.p.IsWithinRange||w===g.p.IsOutsideRange||w===g.p.IsWithinRangeIncluded||w===g.p.IsOutsideRangeIncluded){if(V[0]===void 0||Number.isNaN(V[0]))return{errorMsgFrom:"This value cannot be empty"};if(V[1]===void 0||Number.isNaN(V[1]))return{errorMsgTo:"This value cannot be empty"}}const[U,F]=W.params,[M,H]=j;switch(w){case g.p.IsAbove:if(U>M)return{errorMsg:`Enter a number less than or equal to ${M}`};break;case g.p.IsBelow:if(U<M)return{errorMsg:`Enter a number more than or equal to ${M}`};break;case g.p.IsEqual:if(U===M)return{errorMsg:`Enter a different number than ${M}`};break;case g.p.IsNotEqual:if(U!==M)return{errorMsg:`Enter the same number as ${M}`};break;case g.p.IsGreaterThanEqual:if(U>=M)return{errorMsg:`Enter a number less than ${M}`};break;case g.p.IsLessThanEqual:if(U<=M)return{errorMsg:`Enter a number more than ${M}`};break;case g.p.IsOutsideRange:if(U<M)return{errorMsgFrom:`Enter a number more than or equal to ${M}`};if(F>H)return{errorMsgTo:`Enter a number less than or equal to ${H}`};break;case g.p.IsWithinRange:if(U>M)return{errorMsgFrom:`Enter a number less than or equal to ${M}`};if(F<H)return{errorMsgTo:`Enter a number be more than or equal to ${H}`};break;case g.p.IsOutsideRangeIncluded:if(U<=M)return{errorMsgFrom:`Enter a number more than ${M}`};if(F>=H)return{errorMsgTo:`Enter a number less than ${H}`};break;case g.p.IsWithinRangeIncluded:if(U>=M)return{errorMsgFrom:`Enter a number less than ${M}`};if(F<=H)return{errorMsgTo:`Enter a number be more than ${H}`};break;default:throw new Error(`evaluator function type ${w} not supported.`)}}const I=g.p.IsAbove,R={type:"query",evaluator:{type:I,params:[0,0]},query:{params:[]},reducer:{params:[],type:"last"}},T=({labelWidth:A,onChange:W,refIds:N,query:w,onError:j,useHysteresis:V=!1})=>{const U=(0,s.of)(K),F={...w,conditions:w.conditions?.length?w.conditions:[R]},[M,H]=(0,o.useReducer)(C,F),_=M.conditions[0],Z=p.zd.find(se=>
283se.value===M.conditions[0].evaluator?.type),ne=se=>{H(d(se.value))};(0,o.useEffect)(()=>{M&&W(M)},[M]);const te=se=>{H(D({evalFunction:se.value??I,onError:j}))},Y=(se,oe)=>{H(b({param:parseFloat(se.currentTarget.value),index:oe}))},Q=_.evaluator.type===g.p.IsWithinRange||_.evaluator.type===g.p.IsOutsideRange||_.evaluator.type===g.p.IsOutsideRangeIncluded||_.evaluator.type===g.p.IsWithinRangeIncluded,J=!!i.$W.featureToggles?.recoveryThreshold&&V,q=(0,r.uniqueId)("threshold-");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.C,{children:(0,t.jsx)(a.I,{label:(0,x.t)("expressions.threshold.label-input","Input"),labelWidth:A,htmlFor:q,children:(0,t.jsx)(l.l6,{inputId:q,onChange:ne,options:N,value:w.expression,width:20})})}),(0,t.jsxs)(m.C,{children:[(0,t.jsx)(c.E,{onChange:te,value:Z}),Q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.p,{type:"number",width:10,onChange:se=>Y(se,0),defaultValue:_.evaluator.params[0]}),(0,t.jsx)(y.Y,{}),(0,t.jsx)(f.p,{type:"number",width:10,onChange:se=>Y(se,1),defaultValue:_.evaluator.params[1]})]}):(0,t.jsx)(f.p,{type:"number",width:10,onChange:se=>Y(se,0),defaultValue:_.evaluator.params[0]||0})]}),J&&(0,t.jsx)(X,{isRange:Q,onError:j})]});function X({isRange:se,onError:oe}){const ae=!!_.unloadEvaluator,ie=de=>{H(E({hysteresisChecked:de.currentTarget.checked,onError:oe})),fe.current=!0},fe=o.useRef(!0),pe=()=>{fe.current=!1};return(0,t.jsxs)("div",{className:U.hysteresis,children:[(0,t.jsx)("div",{onMouseDown:pe,children:(0,t.jsx)(h.K,{showLabel:!0,label:(0,x.t)("alerting.rule-form.threshold.recovery.title","Custom recovery threshold"),value:ae,onChange:ie,className:U.switch})}),ae&&(0,t.jsx)(L,{isRange:se,condition:_,onError:oe,dispatch:H,allowOnblur:fe})]})}};function L({isRange:A,condition:W,onError:N,dispatch:w,allowOnblur:j}){const V=(0,s.of)(K),U=(te,Y)=>{const Q=parseFloat(te.currentTarget.value);w(v({param:Q,index:Y,onError:N}))},F=O(W),{errorMsg:M,errorMsgFrom:H,errorMsgTo:_}=F??{};if(A)return(0,t.jsx)(Z,{allowOnblur:j});return(0,t.jsx)(ne,{allowOnblur:j});function Z({allowOnblur:te}){switch(W.evaluator.type){case g.p.IsWithinRange:if(W.evaluator.type===g.p.IsWithinRange)return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-outside-range","Stop alerting when outside range"),labelWidth:"auto",children:(0,t.jsxs)(u.B,{direction:"row",gap:0,children:[(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!H,error:H,className:V.noMargin,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,0),defaultValue:W.unloadEvaluator?.params[0]})})}),(0,t.jsx)(y.Y,{}),(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!_,error:_,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,1),defaultValue:W.unloadEvaluator?.params[1]})})})]})})});case g.p.IsOutsideRange:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-inside-range","Stop alerting when inside range"),labelWidth:"auto",children:(0,t.jsxs)(u.B,{direction:"row",gap:0,children:[(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!H,error:H,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,0),defaultValue:W.unloadEvaluator?.params[0]})})}),(0,t.jsx)(y.Y,{}),(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!_,error:_,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,1),defaultValue:W.unloadEvaluator?.params[1]})})})]})})});case g.p.IsOutsideRangeIncluded:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-inside-range","Stop alerting when inside range"),labelWidth:"auto",children:(0,t.jsxs)(u.B,{direction:"row",gap:0,children:[(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!H,error:H,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,0),defaultValue:W.unloadEvaluator?.params[0]})})}),(0,t.jsx)(y.Y,{}),(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!_,error:_,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,1),defaultValue:W.unloadEvaluator?.params[1]})})})]})})});case g.p.IsWithinRangeIncluded:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-outside-range","Stop alerting when outside range"),labelWidth:"auto",children:(0,t.jsxs)(u.B,{direction:"row",gap:0,children:[(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!H,error:H,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,0),defaultValue:W.unloadEvaluator?.params[0]})})}),(0,t.jsx)(y.Y,{}),(0,t.jsx)("div",{className:V.range,children:(0,t.jsx)(a.I,{invalid:!!_,error:_,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>te.current&&U(Y,1),defaultValue:W.unloadEvaluator?.params[1]})})})]})})});default:return null}}function ne({allowOnblur:te}){switch(W.evaluator.type){case g.p.IsAbove:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-bellow","Stop alerting when below"),labelWidth:"auto",invali
283d:!!M,error:M,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>{te.current&&U(Y,0)},defaultValue:W.unloadEvaluator?.params[0]})})});case g.p.IsBelow:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-above","Stop alerting when above"),labelWidth:"auto",invalid:!!M,error:M,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>{te.current&&U(Y,0)},defaultValue:W.unloadEvaluator?.params[0]})})});case g.p.IsEqual:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-equal","Stop alerting when equal to"),labelWidth:"auto",invalid:!!M,error:M,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>{te.current&&U(Y,0)},defaultValue:W.unloadEvaluator?.params[0]})})});case g.p.IsNotEqual:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-not-equal","Stop alerting when not equal to"),labelWidth:"auto",invalid:!!M,error:M,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>{te.current&&U(Y,0)},defaultValue:W.unloadEvaluator?.params[0]})})});case g.p.IsGreaterThanEqual:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-less","Stop alerting when less than"),labelWidth:"auto",invalid:!!M,error:M,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>{te.current&&U(Y,0)},defaultValue:W.unloadEvaluator?.params[0]})})});case g.p.IsLessThanEqual:return(0,t.jsx)(m.C,{className:V.hysteresis,children:(0,t.jsx)(a.I,{label:(0,x.t)("alerting.rule-form.threshold.recovery.stop-alerting-more","Stop alerting when more than"),labelWidth:"auto",invalid:!!M,error:M,children:(0,t.jsx)(f.p,{type:"number",width:10,onBlur:Y=>{te.current&&U(Y,0)},defaultValue:W.unloadEvaluator?.params[0]})})});default:return null}}}const K=A=>({range:(0,n.css)({width:"min-content"}),hysteresis:(0,n.css)({marginTop:A.spacing(2)}),switch:(0,n.css)({paddingLeft:A.spacing(1)}),noMargin:(0,n.css)({margin:0})})},81988:(ee,B,e)=>{"use strict";e.d(B,{E:()=>m});var t=e(74848),n=e(22803),r=e(63142),o=e(15356),s=e(4651);function m({onChange:l,value:f}){const h=(0,r.of)(a);return(0,t.jsx)(o.f,{className:h.buttonSelectText,options:s.zd,onChange:l,value:f})}const a=l=>({buttonSelectText:(0,n.css)({color:l.colors.primary.text,fontSize:l.typography.bodySmall.fontSize,textTransform:"uppercase",padding:`0 ${l.spacing(1)}`})})},66258:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(56840);function s(){const a=(0,r.of)(m);return(0,t.jsx)("div",{className:a.button,children:(0,t.jsx)(o.x6,{i18nKey:"alerting.threshold.to",children:"TO"})})}const m=a=>
283({button:(0,n.css)({height:"32px",color:a.colors.primary.text,fontSize:a.typography.bodySmall.fontSize,display:"flex",alignItems:"center",fontWeight:a.typography.fontWeightBold,padding:`0 ${a.spacing(1)}`})})},44022:(ee,B,e)=>{"use strict";e.d(B,{f:()=>r,z:()=>o});var t=e(36580),n=e(4651);const r=s=>{if(!s)return!1;if((0,t.s9)(s.datasource))return!0;const m=s;return typeof m.type!="string"?!1:Object.values(n.Tz).includes(m.type)};function o(s){return["avg","min","max","sum","count","last","median","diff","diff_abs","percent_diff","percent_diff_abs","count_non_null"].includes(s)}},4651:(ee,B,e)=>{"use strict";e.d(B,{Cu:()=>l,HZ:()=>h,Mt:()=>f,NI:()=>m,PN:()=>u,Tz:()=>s,Uj:()=>o,iX:()=>i,uQ:()=>a,zd:()=>x});var t=e(46644),n=e(65642),r=e(2954);const o="__expr__";var s=(g=>(g.math="math",g.reduce="reduce",g.resample="resample",g.classic="classic_conditions",g.threshold="threshold",g.sql="sql",g))(s||{});const m=g=>{switch(g){case"math":return"Math";case"reduce":return"Reduce";case"resample":return"Resample";case"classic_conditions":return"Classic condition (legacy)";case"threshold":return"Threshold";case"sql":return"SQL"}},a=[{value:"math",label:"Math",description:"Free-form math formulas on time series or number data."},{value:"reduce",label:"Reduce",description:"Takes one or more time series returned from a query or an expression and turns each series into a single number."},{value:"resample",label:"Resample",description:"Changes the time stamps in each time series to have a consistent time interval."},{value:"classic_conditions",label:"Classic condition (legacy)",description:"Takes one or more time series returned from a query or an expression and checks if any of the series match the condition. Disables multi-dimensional alerts for this rule."},{value:"threshold",label:"Threshold",description:"Takes one or more time series returned from a query or an expression and checks if any of the series match the threshold condition."},{value:"sql",label:"SQL",description:"Transform data using SQL. Supports MySQL syntax."}].filter(g=>g.value==="sql"?n.$W.featureToggles?.sqlExpressions:!0),l=[{value:t.gy.min,label:"Min",description:"Get the minimum value"},{value:t.gy.max,label:"Max",description:"Get the maximum value"},{value:t.gy.mean,label:"Mean",description:"Get the average value"},{value:t.gy.median,label:"Median",description:"Get the median value"},{value:t.gy.sum,label:"Sum",description:"Get the sum of all values"},{value:t.gy.count,label:"Count",description:"Get the number of values"},{value:t.gy.last,label:"Last",description:"Get the last value"}];var f=(g=>(g.Strict="",g.ReplaceNonNumbers="replaceNN",g.DropNonNumbers="dropNN",g))(f||{});const h=[{value:"",label:"Strict",description:"Result can be NaN if series contains non-numeric data"},{value:"dropNN",label:"Drop Non-numeric Values",description:"Drop NaN, +/-Inf and null from input series before reducing"},{value:"replaceNN",label:"Replace Non-numeric Values",description:"Replace NaN, +/-Inf and null with a constant value before reducing"}],u=[{value:t.gy.last,label:"Last",description:"Fill with the last value"},{value:t.gy.min,label:"Min",description:"Fill with the minimum value"},{value:t.gy.max,label:"Max",description:"Fill with the maximum value"},{value:t.gy.mean,label:"Mean",description:"Fill with the average value"},{value:t.gy.sum,label:"Sum",description:"Fill with the sum of all values"}],i=[{value:"pad",label:"pad",description:"fill with the last known value"},{value:"backfilling",label:"backfilling",description:"fill with the next known value"},{value:"fillna",label:"fillna",description:"Fill with NaNs"}],x=[{value:r.p.IsAbove,label:"Is above"},{value:r.p.IsBelow,label:"Is below"},{value:r.p.IsEqual,label:"Is equal to"},{value:r.p.IsNotEqual,label:"Is not equal to"},{value:r.p.IsGreaterThanEqual,label:"Is above or equal to"},{value:r.p.IsLessThanEqual,label:"Is below or equal to"},{value:r.p.IsWithinRange,label:"Is within range"},{value:r.p.IsOutsideRange,label:"Is outside range"},{value:r.p.IsWithinRangeIncluded,label:"Is within range included"},{value:r.p.IsOutsideRangeIncluded,label:"Is outside range included"}]},82779:(ee,B,e)=>{"use strict";e.d(B,{D5:()=>f,H3:()=>a,OC:()=>l,P0:()=>m,hJ:()=>u,rV:()=>s,sk:()=>h});var t=e(46644),n=e(2954),r=e(44022),o=e(4651);const s=i=>{switch(i.type){case o.Tz.reduce:i.reducer||(i.reducer=t.gy.mean);break;case o.Tz.resample:i.downsampler||(i.downsampler=t.gy.mean),i.upsampler||(i.upsampler="fillna"),i.reducer=void 0;break;case o.Tz.math:i.expression=void 0;break;case o.Tz.classic:i.conditions||(i.conditions=[m]);break;default:i.reducer=void 0}return i},m={type:"query",reducer:{params:[],type:"avg"},operator:{type:"and"},query:{params:[]},evaluator:{params:[0,0],type:n.p.IsAbove}};function a(i){if((0,r.z)(i))return i}function l(i){if(!f(i))return!1;const x=i.settings?.mode;return x===o.Mt.Strict||x===void 0}function f(i){return i.type===o.Tz.reduce}function h(i){return i.type===o.Tz.threshold}function u(i){return i===n.p.IsWithinRange||i===n.p.IsOutsideRange||i===n.p.IsOutsideRangeIncluded||i===n.p.IsWithinRangeIncluded}},66198:(ee,B,e)=>{"use strict";e.d(B,{Cg:()=>a,Fk:()=>f,R4:()=>i,Rj:()=>m,pq:()=>l});var t=e(43173),n=e(56840),r=e(15130),o=e(18832),s=e(96673);const m="manage-folder",a=g=>`folder-dashboards-${g}`,l=g=>`folder-library-panels-${g}`,f=g=>`folder-alerting-${g}`,h=g=>`folder-permissions-${g}`,u=g=>`folder-settings-${g}`;function i(g,p){const c=p??("parents"in g?g.parents:void 0),y={icon:"folder",id:m,subTitle:(0,o.o)("manage-folder"),url:g.url,text:g.title,children:[{active:!1,icon:"apps",i
283d:a(g.uid),text:(0,n.t)("browse-dashboards.manage-folder-nav.dashboards","Dashboards"),url:g.url}]};if(c&&c.length>0){const P=c[c.length-1],d=c.slice(0,c.length-1);y.parentItem=i(P,d)}return y.children.push({active:!1,icon:"library-panel",id:l(g.uid),text:(0,n.t)("browse-dashboards.manage-folder-nav.panels","Panels"),url:`${g.url}/library-panels`}),r.TP.hasPermission(s.AccessControlAction.AlertingRuleRead)&&t.$.unifiedAlertingEnabled&&y.children.push({active:!1,icon:"bell",id:f(g.uid),text:(0,n.t)("browse-dashboards.manage-folder-nav.alert-rules","Alert rules"),url:`${g.url}/alerting`}),y}function x(g){const p=i({created:"",createdBy:"",hasAcl:!1,updated:"",updatedBy:"",id:1,uid:"loading",title:"Loading",url:"url",canSave:!0,canEdit:!0,canAdmin:!0,canDelete:!0,version:0});return p.children[g].active=!0,{main:p,node:p.children[g]}}},17621:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>f,jl:()=>m});var t=e(65307),n=e(15203);const r={id:0,uid:"loading",title:"loading",url:"",canSave:!1,canDelete:!1,hasChanged:!1,version:1},o=(h,u)=>({...h,...u.payload,hasChanged:!1}),s=(0,t.Z0)({name:"folder",initialState:r,reducers:{loadFolder:o,setFolderTitle:(h,u)=>({...h,title:u.payload,hasChanged:u.payload.trim().length>0})},extraReducers:h=>{h.addMatcher(n.vZ.getFolder.matchFulfilled,o)}}),{loadFolder:m,setFolderTitle:a}=s.actions,f={folder:s.reducer}},93139:(ee,B,e)=>{"use strict";e.d(B,{G:()=>f});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(18857),m=e(34999),a=e(46189);const l=[{label:"Countries",description:"Lookup countries by name, two letter code, or three letter code",value:a.fx},{label:"USA States",description:"Lookup states by name or 2 ",value:"public/gazetteer/usa-states.json"},{label:"Airports",description:"Lookup airports by id or code",value:"public/gazetteer/airports.geojson"}],f=({value:u,onChange:i,context:x,item:g})=>{const p=(0,o.of)(h),[c,y]=(0,r.useState)(),P=g.settings;(0,r.useEffect)(()=>{async function b(){const E=await(0,a.q3)(u);y(E)}b()},[u,y]);const{current:d,options:D}=(0,r.useMemo)(()=>{let b=P?.options?[...P.options]:[...l],E=b?.find(v=>v.value===c?.path);return!E&&c&&(E={label:c.path,value:c.path},b.push(E)),{options:b,current:E}},[c,P?.options]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.l6,{value:d,options:D,onChange:b=>i(b.value),allowCustomValue:!0,formatCreateLabel:b=>`Load from URL: ${b}`}),c&&(0,t.jsxs)(t.Fragment,{children:[c.error&&(0,t.jsx)(m.F,{title:c.error,severity:"warning"}),c.count&&(0,t.jsxs)("div",{className:p.keys,children:[(0,t.jsxs)("b",{children:["(",c.count,")"]}),c.examples(10).map(b=>(0,t.jsxs)("span",{children:[b,","]},b)),c.count>10&&" ..."]})]})]})},h=u=>({keys:(0,n.css)({marginTop:u.spacing(.5),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","> span":{marginLeft:u.spacing(.5)}})})},90267:(ee,B,e)=>{"use strict";e.d(B,{G:()=>P});var t=e(95004),n=e(739),r=e(93139),o=e(74848),s=e(22803),m=e(96540),a=e(85629),l=e(63142),f=e(34999),h=e(30703),u=e(18857),i=e(32881),x=e(87039);const g=[{value:n.aG.Auto,label:"Auto",ariaLabel:a.Tp.components.Transforms.SpatialOperations.location.autoOption,description:"Automatically identify location data based on default field names"},{value:n.aG.Coords,label:"Coords",ariaLabel:a.Tp.components.Transforms.SpatialOperations.location.coords.option,description:"Specify latitude and longitude fields"},{value:n.aG.Geohash,label:"Geohash",ariaLabel:a.Tp.components.Transforms.SpatialOperations.location.geohash.option,description:"Specify geohash field"},{value:n.aG.Lookup,label:"Lookup",ariaLabel:a.Tp.components.Transforms.SpatialOperations.location.lookup.option,description:"Specify Gazetteer and lookup field"}],p="https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/geomap/#location",c=({value:d,onChange:D,context:b,item:E})=>{const[v,C]=(0,m.useState)();(0,m.useEffect)(()=>{E.settings?.source&&E.settings?.data?.length&&E.settings.data[0]&&(0,x.nE)(E.settings.source).then(I=>{E.settings&&E.settings.data&&C((0,x.FM)(E.settings.data[0],I))})},[E.settings]);const S=(0,l.of)(y),O=()=>{if(v){if(v.warning)return(0,o.jsx)(f.F,{title:v.warning,severity:"warning",buttonContent:(0,o.jsx)(h.I,{name:"question-circle",size:"xl"}),className:S.alert,onRemove:()=>{const I=window.open(p,"_blank","noopener,noreferrer");I&&(I.opener=null)}});if(d===n.aG.Auto&&v.description)return(0,o.jsx)("span",{children:v.description})}return null};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.l6,{options:g,value:d,onChange:I=>{D(I.value)}}),(0,o.jsx)(i.Gy,{className:S.hGroup,children:O()})]})},y=d=>({alert:(0,s.css)({"& div":{padding:d.spacing(.5)},marginBottom:"0px",marginTop:"5px",padding:d.spacing(.25)}),hGroup:(0,s.css)({"& div":{width:"100%"}})});function P(d,D,b,E,v){switch(b.addCustomEditor({id:"modeEditor",path:`${D}mode`,name:"Location Mode",editor:c,settings:{data:v,source:E}}),E?.mode){case n.aG.Coords:b.addFieldNamePicker({path:`${D}latitude`,name:"Latitude field",settings:{filter:C=>
283C.type===t.PU.number,noFieldsMessage:"No numeric fields found"}}).addFieldNamePicker({path:`${D}longitude`,name:"Longitude field",settings:{filter:C=>C.type===t.PU.number,noFieldsMessage:"No numeric fields found"}});break;case n.aG.Geohash:b.addFieldNamePicker({path:`${D}geohash`,name:"Geohash field",settings:{filter:C=>C.type===t.PU.string,noFieldsMessage:"No strings fields found"}});break;case n.aG.Lookup:b.addFieldNamePicker({path:`${D}lookup`,name:"Lookup field",settings:{filter:C=>C.type===t.PU.string,noFieldsMessage:"No strings fields found"}}).addCustomEditor({id:"gazetteer",path:`${D}gazetteer`,name:"Gazetteer",editor:r.G})}}},98643:(ee,B,e)=>{"use strict";e.d(B,{RA:()=>i,XR:()=>x,Dc:()=>u,qy:()=>f,Pz:()=>h});var t=e(44294),n=e(34338),r=e(11217),o=e(22796),s=e(95004),m=e(78089);function a(p){if(!p?.length)return;const c=[16,8,4,2,1],y="0123456789bcdefghjkmnpqrstuvwxyz";let P=!0;const d=[],D=[];d[0]=-90,d[1]=90,D[0]=-180,D[1]=180;let b;p.split("").forEach(C=>{b=y.indexOf(C),c.forEach(S=>{l(P?D:d,b,S),P=!P})});const E=(d[0]+d[1])/2;return[(D[0]+D[1])/2,E]}function l(p,c,y){c&y?p[0]=(p[0]+p[1])/2:p[1]=(p[0]+p[1])/2}function f(p){return{name:p.name??"Point",type:s.PU.geo,values:p.values.map(c=>{const y=a(c);if(y)return new t.A((0,o.Rb)(y))}),config:g}}function h(p,c){const y=new Array(p.values.length);for(let P=0;P<p.values.length;P++){const d=p.values[P],D=c.values[P];d===null||D===null||(y[P]=new t.A((0,o.Rb)([d,D])))}return{name:"Point",type:s.PU.geo,values:y,config:g}}function u(p,c){const y=c.values.length,P=new Array(y);for(let d=0;d<y;d++)P[d]=p.find(c.values[d])?.geometry();return{name:"Geometry",type:s.PU.geo,values:P,config:g}}function i(p,c){const y=p.values,P=c.values;if(!y||!P)throw"missing src/dest";if(y.length!==P.length)throw"Source and destination field lengths do not match";const d=p.values.length,D=new Array(d);for(let b=0;b<d;b++){const E=y[b],v=P[b];E&&v?D[b]=new n.A([E,v]):E?D[b]=E:v&&(D[b]=v)}return{name:"Geometry",type:s.PU.geo,values:D,config:g}}function x(p,c){const y=p.values,P=c.values;if(!y||!P)throw"missing src/dest";if(y.length!==P.length)throw"Source and destination field lengths do not match";const d=p.values.length,D=new Array(d);for(let b=0;b<d;b++){const E=y[b],v=P[b];E&&v&&(D[b]=new r.A([(0,m.EX)(E),(0,m.EX)(v)]))}return{name:"Geometry",type:s.PU.geo,values:D,config:g}}const g=Object.freeze({custom:{hideFrom:{tooltip:!0}}})},46189:(ee,B,e)=>{"use strict";e.d(B,{fx:()=>p,q3:()=>c});var t=e(70915),n=e(44294),r=e(41119),o=e(95004),s=e(68143),m=e(11365);function a(y){const P=new m.A().readFeatures(y,{featureProjection:"EPSG:3857"}),d=P.length,D=new Array(d).fill(null),b=[],E=new Map,v=I=>{let R=E.get(I);return R||(R={types:new Set,values:new Array(d).fill(null),count:0},b.push(I),E.set(I,R)),R},C=(...I)=>{for(const R of I)if(!E.has(R))return R;return"___"+I[0]},S={types:new Set,values:new Array(d).fill(null),count:0};for(let I=0;I<d;I++){const R=P[I];D[I]=R.getGeometry();const T=R.getId();T!=null&&(S.values[I]=T,S.types.add((0,r.oE)(T)),S.count++);for(const L of R.getKeys()){const K=R.get(L);if(K===D[I]||K==null)continue;const A=v(L);A.values[I]=K,A.types.add((0,r.oE)(K)),A.count++}}const O=[];if(S.count>0){const I=l(S);O.push({name:C("id","_id","__id"),type:I,values:S.values,config:{}})}O.push({name:C("geo","geometry"),type:o.PU.geo,values:D,config:{}});for(const I of b){const R=E.get(I);if(!R)continue;const T=l(R);O.push({name:I,type:T,values:R.values,config:{}})}return{fields:O,length:d}}function l(y){return y.count<1?o.PU.other:y.types.size>1?(y.values=y.values.map(P=>P!=null?`${P}`:P),o.PU.string):y.types.values().next().value??o.PU.other}var f=e(98643),h=e(22796);function u(y,P){let d=0;const D=new Map;for(const b of P){const E=new n.A((0,h.Rb)([b.longitude,b.latitude])),v={point:()=>E,geometry:()=>E};if(b.name&&(D.set(b.name,v),D.set(b.name.toUpperCase(),v)),b.key&&(D.set(b.key,v),D.set(b.key.toUpperCase(),v)),b.keys)for(const C of b.keys)D.set(C,v),D.set(C.toUpperCase(),v);d++}return{path:y,find:b=>{let E=D.get(b);return!E&&typeof b=="string"&&(E=D.get(b.toUpperCase())),E},count:d,examples:b=>{const E=[];if(D.size<1)E.push("no values found");else for(const v of D.keys())if(E.push(v),E.length>=b)break;return E}}}function i(y,P){let d;if(Array.isArray(P)){const D=P[0];if(D.latitude&&D.longitude&&(D.key||D.keys))return u(y,P)}else Array.isArray(P?.features)&&P?.type==="FeatureCollection"&&(d=a(P));if(!d)try{d=(0,r.Vc)(P)}catch(D){return{path:y,error:`${D}`,find:b=>{},examples:b=>[]}}return x(d,{path:y})}function x(y,P){const d=[];let D,b,E,v,C;for(const I of y.fields)if(I.type===o.PU.geo&&(D=I),!C&&I.type===o.PU.str
283ing&&(C=I),I.name){P.keys&&P.keys.includes(I.name)&&d.push(I);const R=I.name.toUpperCase();switch(R){case"LAT":case"LATITUTE":b=I;break;case"LON":case"LNG":case"LONG":case"LONGITUE":E=I;break;case"GEOHASH":v=I;break;case"ID":case"UID":case"KEY":case"CODE":P.keys||d.push(I);break;default:P.keys||(R.endsWith("_ID")||R.endsWith("_CODE"))&&d.push(I)}}!d.length&&C&&d.push(C);let S=!1;D?S=D.values[0]?.getType()==="Point":v?(D=(0,f.qy)(v),S=!0):b&&E&&(D=(0,f.Pz)(E,b),S=!0);const O=new Map;return d.forEach(I=>{I.values.forEach((R,T)=>{const L=`${R}`;O.set(L.toUpperCase(),T),O.set(L,T)})}),{path:P.path,find:I=>{const R=O.get(I);if(R!=null){const T=D?.values[R];return{frame:y,index:R,point:()=>!T||S?T:new n.A((0,t.q1)(T.getExtent())),geometry:()=>T}}},examples:I=>{const R=[];for(let T of O.keys())if(R.push(T),R.length>I)break;return R},frame:()=>y,count:y.length}}const g={},p="public/gazetteer/countries.json";async function c(y){y||(y=p);let P=g[y];if(!P){try{const d=await(0,s.AI)().get(y);P=i(y,d)}catch(d){console.warn("Error loading placename lookup",y,d),P={path:y,error:"Error loading URL",find:D=>{},examples:D=>[]}}g[y]=P}return P}},87039:(ee,B,e)=>{"use strict";e.d(B,{FM:()=>x,nE:()=>u});var t=e(16515),n=e(95004),r=e(36638),o=e(57866),s=e(739),m=e(98643),a=e(46189);function l(g){return p=>{for(const c of p.fields)if(g(c,p,[]))return c}}function f(g){return p=>{for(const c of p.fields){if(g.has(c.name.toLowerCase()))return c;const y=(0,t.Ct)(c,p);if(g.has(y))return c}}}const h={mode:s.aG.Auto,geohash:f(new Set(["geohash"])),latitude:f(new Set(["latitude","lat"])),longitude:f(new Set(["longitude","lon","lng"])),h3:f(new Set(["h3"])),wkt:f(new Set(["wkt"])),lookup:f(new Set(["lookup"])),geo:g=>g.fields.find(p=>p.type===n.PU.geo)};async function u(g){const p={...h,mode:g?.mode??s.aG.Auto};switch(p.gazetteer=await(0,a.q3)(g?.gazetteer),p.mode){case s.aG.Geohash:g?.geohash?p.geohash=l((0,r.NS)({id:o.Ct.byName,options:g.geohash})):p.geohash=()=>{};break;case s.aG.Lookup:const c=g?.lookup?.length?(0,r.NS)({id:o.Ct.byName,options:g.lookup}):(0,r.NS)({id:o.Ct.byType,options:n.PU.string});p.lookup=l(c);break;case s.aG.Coords:g?.latitude?p.latitude=l((0,r.NS)({id:o.Ct.byName,options:g.latitude})):p.latitude=()=>{},g?.longitude?p.longitude=l((0,r.NS)({id:o.Ct.byName,options:g.longitude})):p.longitude=()=>{};break}return p}function i(g,p){const c={mode:p.mode??s.aG.Auto};if(c.mode===s.aG.Auto){if(c.geo=p.geo(g),c.geo)return c;if(c.latitude=p.latitude(g),c.longitude=p.longitude(g),c.latitude&&c.longitude)return c.mode=s.aG.Coords,c;if(c.geohash=p.geohash(g),c.geohash)return c.mode=s.aG.Geohash,c;if(c.lookup=p.lookup(g),c.lookup)return c.mode=s.aG.Lookup,c}switch(c.mode){case s.aG.Coords:c.latitude=p.latitude(g),c.longitude=p.longitude(g);break;case s.aG.Geohash:c.geohash=p.geohash(g);break;case s.aG.Lookup:c.lookup=p.lookup(g);break}return c}function x(g,p){const c=i(g,p);switch(c.mode){case s.aG.Auto:return c.geo?{field:c.geo}:{warning:"Unable to find location fields"};case s.aG.Coords:return c.latitude&&c.longitude?{field:(0,m.Pz)(c.longitude,c.latitude),derived:!0,description:`${c.mode}: ${c.latitude.name}, ${c.longitude.name}`}:{warning:"Select latitude/longitude fields"};case s.aG.Geohash:return c.geohash?{field:(0,m.qy)(c.geohash),derived:!0,description:`${c.mode}`}:{warning:"Select geohash field"};case s.aG.Lookup:return c.lookup?p.gazetteer?{field:(0,m.Dc)(p.gazetteer,c.lookup),derived:!0,description:`${c.mode}: ${p.gazetteer.path}`}:{warning:"Gazetteer not found"}:{warning:"Select lookup field"}}return{warning:"unable to find geometry"}}},42836:(ee,B,e)=>{"use strict";e.d(B,{q:()=>L});var t=e(74848),n=e(2543),r=e(96540),o=e(70713),s=e(64761),m=e(2197),a=e(60519),l=e(85629),f=e(27489),h=e(2863),u=e(45861),i=e(68079),x=e(24343),g=e(65642),p=e(56840),c=e(37234),y=e(16515),P=e(63142),d=e(32881),D=e(37386),b=e(18857),E=e(21285),v=e(85348),C=e(22803);const S=A=>(0,C.css)({padding:A.spacing(0,2),fontSize:A.typography.bodySmall.fontSize,color:A.colors.text.secondary,overflow:"hidden",textOverflow:"ellipsis"}),O=({children:A})=>{const W=(0,P.of)(S);return(0,t.jsx)("div",{className:W,children:A})};var I=e(89460);const R=({options:A,actions:W,formattedDataDescription:N,onOptionsChange:w,hasTransformations:j,data:V,dataFrames:U,transformationOptions:F,selectedDataFrame:M,onDataFrameChange:H,downloadForExcel:_,toggleDownloadForExcel:Z})=>{const ne=(0,P.of)(I.A);let te=U;M===s.F.joinByField&&(te=V);const Y=te.map((q,X)=>({value:X,label:`${(0,y.Ri)(q)} (${X})`})),Q=[...F,...Y];function J(){let q="";if(!V)return q;const X=[];return M===s.F.joinByField?X.push((0,p.t)("dashboard.inspect-data.series-to-columns","Series joined by time")):V.length>1&&X.push((0,y.Ri)(V[M])),(A.withTransforms||A.withFieldConfig)&&(A.withTransforms&&X.push((0,p.t)("dashboard.inspect-data.panel-transforms","Panel transforms")),A.withTransforms&&A.withFieldConfig,A.withFieldConfig&&X.push((0,p.t)("dashboard.inspect-data.formatted","Formatted data"))),_&&X.push((0,p.t)("dashboard.inspect-data.excel-header","Excel header")),X.join(", ")}return(0,t.jsx)("div",{className:ne.dataDisplayOptions,children:(0,t.jsx)(v.u,{id:"Data options",index:0,title:(0,p.t)("dashboard.inspect-data.data-options","Data options"),headerElement:(0,t.jsx)(O,{children:J()}),isOpen:!1,actions:W,children:(0,t.jsx)("div",{className:ne.options,"data-testid":"dataOptions",children:(0,t.jsxs)(d.gW,{spacing:"none",children:[V.length>1&&(0,t.jsx)(D.D,{label:(0,p.t)("dashboard.inspect-data.dataframe-label","Show data frame"),children:(0,t.jsx)(b.l6,{options:Q,value:M,onChange:H,width:30,"aria-label":(0,p.t)("dashboard.inspect-data.dataframe-aria-label","Select dataframe")})}),(0,t.jsxs)(d.Gy,{children:[j&&w&&(0,t.jsx)(D.D,{label:(0,p.t)("dashboard.inspect-data.transformations-label","Apply panel transformations"),description:(0,p.t)("dashboard.inspect-data.transformations-description","Table data is displayed with transformations defined in the panel Transform tab."),children:(0,t.jsx)(E.d,{value:!!A.withTransforms,onChange:()=>w({...A,withTransforms:!A.withTransforms})})}),w&&(0,t.jsx)(D.D,{label:(0,p.t)("dashboard.inspect-data.formatted-data-label","Formatted data"),description:N||(0,p.t)("dashboard.inspect-data.formatted-data-description","Table data is formatted with options defined in the Field and Override tabs."),children:(0,t.jsx)(E.d,{id:"formatted-data-toggle",value:!!A.withFieldConfig,onChange:()=>w({...A,withFieldConfig:!A.withFieldConfig})})}),(0,t.jsx)(D.D,{label:(0,p.t)("dashboard.inspect-data.download-excel-label","Download for Excel"),description:(0,p.t)("dashboard.inspect-data.download-excel-description","Adds header to CSV for use with Excel"),children:(0,t.jsx)(E.d,{id:"excel-toggle",value:_,onCh
283ange:Z})})]})]})})})})};var T=e(54334);class L extends r.PureComponent{constructor(W){super(W),this.onExportLogsAsTxt=()=>{const{data:N,dataName:w,app:j}=this.props;(0,f.rR)("grafana_logs_download_logs_clicked",{app:j,format:"logs",area:"inspector"});const V=(0,c.HT)(N||[]);(0,T.Zy)(V,w)},this.onExportTracesAsJson=()=>{const{data:N,dataName:w,app:j}=this.props;if(N)for(const V of N){if(V.meta?.preferredVisualisationType!=="trace")continue;const U=(0,T.ek)(V,w+"-traces");(0,f.rR)("grafana_traces_download_traces_clicked",{app:j,grafana_version:g.$W.buildInfo.version,trace_format:U,location:"inspector"})}},this.onExportServiceGraph=()=>{const{data:N,dataName:w,app:j}=this.props;(0,f.rR)("grafana_traces_download_service_graph_clicked",{app:j,grafana_version:g.$W.buildInfo.version,location:"inspector"}),N&&(0,T.ny)(N,w)},this.onDataFrameChange=N=>{this.setState({transformId:N.value===s.F.joinByField?s.F.joinByField:s.F.noop,dataFrameIndex:typeof N.value=="number"?N.value:0,selectedDataFrame:N.value})},this.onToggleDownloadForExcel=()=>{this.setState(N=>({downloadForExcel:!N.downloadForExcel}))},this.state={selectedDataFrame:0,dataFrameIndex:0,transformId:s.F.noop,transformationOptions:K(),transformedData:W.data??[],downloadForExcel:!1}}componentDidUpdate(W,N){if(!this.props.data){this.setState({transformedData:[]});return}if(this.props.options.withTransforms){this.setState({transformedData:this.props.data});return}if(W.data!==this.props.data||N.transformId!==this.state.transformId){const w=this.state.transformationOptions.find(j=>j.value===this.state.transformId);if(w&&w.transformer.id!==s.F.noop){const j=this.state.selectedDataFrame,V=this.state.dataFrameIndex,U=(0,m.m)([w.transformer],this.props.data).subscribe(F=>{this.setState({transformedData:F,selectedDataFrame:j,dataFrameIndex:V},()=>U.unsubscribe())});return}this.setState({transformedData:this.props.data});return}}exportCsv(W,N){const{dataName:w}=this.props,{transformId:j}=this.state,V=W[this.state.dataFrameIndex];N&&(0,f.rR)("grafana_logs_download_clicked",{app:this.props.app,format:"csv"}),(0,T.EM)(V,w,{useExcelHeader:this.state.downloadForExcel},j)}getProcessedData(){const{options:W,panelPluginId:N,fieldConfig:w,timeZone:j}=this.props,V=this.state.transformedData;if(!W.withFieldConfig)return(0,a.K3)(V);let U=w??{defaults:{},overrides:[]};return N==="table"&&w&&(U=this.cleanTableConfigFromFieldConfig(w)),(0,a.we)({data:V,theme:g.$W.theme2,fieldConfig:U,timeZone:j,replaceVariables:(F,M,H)=>(0,h.w)().replace(F,M,H)})}cleanTableConfigFromFieldConfig(W){W=(0,n.cloneDeep)(W),W.defaults.custom={};for(const N of W.overrides)for(const w of N.properties)if(w.id.startsWith("custom.")){const j=N.properties.indexOf(w);N.properties.slice(j,1)}return W}renderActions(W,N,w,j){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.$n,{variant:"primary",onClick:()=>this.exportCsv(W,N),size:"sm",children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.inspect-data.download-csv",children:"Download CSV"})}),N&&!g.$W.exploreHideLogsDownload&&(0,t.jsx)(u.$n,{variant:"primary",onClick:this.onExportLogsAsTxt,size:"sm",children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.inspect-data.download-logs",children:"Download logs"})}),w&&(0,t.jsx)(u.$n,{variant:"primary",onClick:this.onExportTracesAsJson,size:"sm",children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.inspect-data.download-traces",children:"Download traces"})}),j&&(0,t.jsx)(u.$n,{variant:"primary",onClick:this.onExportServiceGraph,size:"sm",children:(0,t.jsx)(p.x6,{i18nKey:"dashboard.inspect-data.download-service",children:"Download service graph"})})]})}render(){const{isLoading:W,options:N,data:w,formattedDataDescription:j,onOptionsChange:V,hasTransformations:U}=this.props,{dataFrameIndex:F,transformationOptions:M,selectedDataFrame:H,downloadForExcel:_}=this.state,Z=(0,I.c)();if(W)return(0,t.jsxs)("div",{children:[(0,t.jsx)(i.y,{inline:!0})," Loading"]});const ne=this.getProcessedData();if(!ne||!ne.length)return(0,t.jsx)("div",{children:(0,t.jsx)(p.x6,{i18nKey:"inspector.inspect-data-tab.no-data",children:"No data"})});const te=ne[F]?F:0,Y=ne[te],Q=ne.some(X=>X?.meta?.preferredVisualisationType==="logs"),J=ne.some(X=>X?.meta?.preferredVisualisationType==="trace"),q=ne.some(X=>X?.meta?.preferredVisualisationType==="nodeGraph");return(0,t.jsxs)("div",{className:Z.wrap,"aria-label":l.Tp.components.PanelInspector.Data.content,children:[(0,t.jsx)("div",{className:Z.toolbar,children:(0,t.jsx)(R,{data:w,hasTransformations:U,options:N,dataFrames:ne,transformationOptions:M,selectedDataFrame:H,downloadForExcel:_,formattedDataDescription:j,onOptionsChange:V,onData
283FrameChange:this.onDataFrameChange,toggleDownloadForExcel:this.onToggleDownloadForExcel,actions:this.renderActions(ne,Q,J,q)})}),(0,t.jsx)("div",{className:Z.content,children:(0,t.jsx)(o.default,{children:({width:X,height:se})=>X===0?null:(0,t.jsx)(x.X,{width:X,height:se,data:Y,showTypeIcons:!0})})})]})}}function K(){return[{value:s.F.joinByField,label:(0,p.t)("dashboard.inspect-data.transformation","Series joined by time"),transformer:{id:s.F.joinByField,options:{byField:void 0}}}]}},55072:(ee,B,e)=>{"use strict";e.d(B,{N:()=>g});var t=e(74848),n=e(22803),r=e(85629),o=e(56840),s=e(11576),m=e(95004),a=e(55386),l=e(63142);const f=({timeZone:c,name:y,stats:P})=>{const d=(0,l.$j)(),D=(0,l.of)(u);return!P||!P.length?null:(0,t.jsxs)("div",{className:D.wrapper,children:[(0,t.jsx)("div",{className:D.heading,children:y}),(0,t.jsx)("table",{className:"filter-table width-30",children:(0,t.jsx)("tbody",{children:P.map((b,E)=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:b.displayName}),(0,t.jsx)("td",{className:D.cell,children:h(b,c,d)})]},`${b.displayName}-${E}`))})})]})};function h(c,y,P){const d=(0,s.J)({field:{type:m.PU.number,config:c},theme:P,timeZone:y});return(0,a.cN)(d(c.value))}const u=c=>({heading:(0,n.css)({fontSize:c.typography.body.fontSize,marginBottom:c.spacing(1)}),wrapper:(0,n.css)({paddingBottom:c.spacing(2)}),cell:(0,n.css)({textAlign:"right"})}),i=({name:c,traceIds:y})=>{const P=(0,l.of)(x);return y.length===0?null:(0,t.jsxs)("div",{className:P.wrapper,children:[(0,t.jsx)("div",{className:P.heading,children:c}),(0,t.jsx)("table",{className:"filter-table width-30",children:(0,t.jsx)("tbody",{children:y.map((d,D)=>(0,t.jsx)("tr",{children:(0,t.jsx)("td",{children:d})},`${d}-${D}`))})})]})},x=c=>({heading:(0,n.css)({fontSize:c.typography.body.fontSize,marginBottom:c.spacing(1)}),wrapper:(0,n.css)({paddingBottom:c.spacing(2)}),cell:(0,n.css)({textAlign:"right"})}),g=({data:c,timeZone:y})=>{if(!c.request)return null;let P=[];const d=c.request.endTime?c.request.endTime-c.request.startTime:-1,D=c.timings?.dataProcessingTime||-1;let b=0;for(const O of c.series)b+=O.length;d>0&&P.push({displayName:(0,o.t)("dashboard.inspect-stats.request-time","Total request time"),value:d,unit:"ms"}),D>0&&P.push({displayName:(0,o.t)("dashboard.inspect-stats.processing-time","Data processing time"),value:D,unit:"ms"}),P.push({displayName:(0,o.t)("dashboard.inspect-stats.queries","Number of queries"),value:c.request.targets?.length??0}),P.push({displayName:(0,o.t)("dashboard.inspect-stats.rows","Total number rows"),value:b});let E=[];for(const O of c.series)O.meta&&O.meta.stats&&(E=E.concat(O.meta.stats));const v=(0,o.t)("dashboard.inspect-stats.table-title","Stats"),C=(0,o.t)("dashboard.inspect-stats.data-title","Data source stats"),S=(0,o.t)("dashboard.inspect-stats.data-traceids","Trace IDs");return(0,t.jsxs)("div",{"aria-label":r.Tp.components.PanelInspector.Stats.content,className:p,children:[(0,t.jsx)(f,{timeZone:y,name:v,stats:P}),(0,t.jsx)(f,{timeZone:y,name:C,stats:E}),(0,t.jsx)(i,{name:S,traceIds:c.traceIds??[]})]})}
283,p=(0,n.css)({height:"100%",overflowY:"scroll"})},96065:(ee,B,e)=>{"use strict";e.d(B,{e:()=>y});var t=e(74848),n=e(22803),r=e(96540),o=e(64423),s=e(28105),m=e(85629),a=e(43173),l=e(41654),f=e(45861),h=e(47931),u=e(35137),i=e(6975),x=e(50275),g=e(56840),p=e(83873),c=e(89460);class y extends r.PureComponent{constructor(d){super(d),this.subs=new o.yU,this.setFormattedJson=D=>{this.formattedJson=D},this.getTextForClipboard=()=>JSON.stringify(this.formattedJson,null,2),this.onToggleExpand=()=>{this.setState(D=>({...D,allNodesExpanded:!this.state.allNodesExpanded}))},this.onToggleMocking=()=>{this.setState(D=>({...D,isMocking:!this.state.isMocking}))},this.getNrOfOpenNodes=()=>this.state.allNodesExpanded===null?3:this.state.allNodesExpanded?20:1,this.state={executedQueries:[],allNodesExpanded:null,isMocking:!1,mockedResponse:"",response:{}}}componentDidMount(){this.subs.add(p.IB.getInspectorStream().subscribe({next:d=>{let D=!0;if(this.props.instanceId&&d?.requestId&&(D=d.requestId.startsWith(this.props.instanceId)),D)return this.onDataSourceResponse(d.response)}}))}componentDidUpdate(d){this.props.data!==d.data&&this.updateQueryList()}updateQueryList(){const{data:d}=this.props,D=d.series,b=[];if(D?.length){let E;D.forEach((v,C)=>{const S=v.meta?.executedQueryString;if(S){const O=v.refId||"?";E?.refId===O?(E.frames++,E.rows+=v.length):(E={refId:O,frames:0,rows:v.length,query:S},b.push(E))}})}this.setState({executedQueries:b})}componentWillUnmount(){this.subs.unsubscribe()}onDataSourceResponse(d){d.config?.hideFromInspector||(d={...d},d.headers&&delete d.headers,d.config&&(d.request=d.config,delete d.config,delete d.request.transformRequest,delete d.request.transformResponse,delete d.request.paramSerializer,delete d.request.jsonpCallbackParam,delete d.request.headers,delete d.request.requestId,delete d.request.inspect,delete d.request.retry,delete d.request.timeout),d.data&&(d.response=d.data,delete d.config,delete d.data,delete d.status,delete d.statusText,delete d.ok,delete d.url,delete d.redirected,delete d.type,delete d.$$config),this.setState({response:d}))}renderExecutedQueries(d){if(!d.length)return null;const D={refId:(0,n.css)({fontWeight:a.$.theme.typography.weight.semibold,color:a.$.theme.colors.textBlue,marginRight:"8px"})};return(0,t.jsx)("div",{children:d.map(b=>(0,t.jsxs)(l.B,{gap:1,direction:"column",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:D.refId,children:[b.refId,":"]}),b.frames>1&&(0,t.jsxs)("span",{children:[b.frames," frames, "]}),(0,t.jsxs)("span",{children:[b.rows," rows"]})]}),(0,t.jsx)("pre",{children:b.query})]},b.refId))})}render(){const{allNodesExpanded:d,executedQueries:D,response:b}=this.state,{onRefreshQuery:E,data:v}=this.props,C=this.getNrOfOpenNodes(),S=(0,c.A)(a.$.theme2),O=Object.keys(b).length>0,I=v.state===s.Gu.Loading;return(0,t.jsxs)("div",{className:S.wrap,children:[(0,t.jsxs)("div",{"aria-label":m.Tp.components.PanelInspector.Query.content,children:[(0,t.jsx)("h3",{className:S.heading,children:(0,t.jsx)(g.x6,{i18nKey:"inspector.query-inspector.query-inspector",children:"Query inspector"})}),(0,t.jsx)("p",{className:"small muted",children:(0,t.jsx)(g.x6,{i18nKey:"inspector.query.description",children:"Query inspector allows you to view raw request and response. To collect this data Grafana needs to issue a new query. Click refresh button below to trigger a new query."})})]}),this.renderExecutedQueries(D),(0,t.jsxs)(l.B,{direction:"row",gap:2,justifyContent:"flex-start",wrap:!0,children:[(0,t.jsx)(f.$n,{icon:"sync",onClick:E,"aria-label":m.Tp.components.PanelInspector.Query.refreshButton,children:(0,t.jsx)(g.x6,{i18nKey:"inspector.query.refresh",children:"Refresh"})}),O&&d&&(0,t.jsx)(f.$n,{icon:"minus",variant:"secondary",onClick:this.onToggleExpand,children:(0,t.jsx)(g.x6,{i18nKey:"inspector.query.collapse-all",children:"Collapse all"})}),O&&!d&&(0,t.jsx)(f.$n,{icon:"plus",variant:"secondary",onClick:this.onToggleExpand,children:(0,t.jsx)(g.x6,{i18nKey:"inspector.query.expand-all",children:"Expand all"})}),O&&(0,t.jsx)(h.b,{getText:this.getTextForClipboard,icon:"copy",variant:"secondary",children:(0,t.jsx)(g.x6,{i18nKey:"inspector.query.copy-to-cl
283ipboard",children:"Copy to clipboard"})})]}),(0,t.jsx)(u.$,{v:2}),(0,t.jsxs)("div",{className:S.content,children:[I&&(0,t.jsx)(i._,{text:(0,g.t)("inspector.query-inspector.text-loading-query-inspector","Loading query inspector...")}),!I&&O&&(0,t.jsx)(x.B,{json:b,open:C,onDidRender:this.setFormattedJson}),!I&&!O&&(0,t.jsx)("p",{className:"muted",children:(0,t.jsx)(g.x6,{i18nKey:"inspector.query.no-data",children:"No request and response collected yet. Hit refresh button"})})]})]})}}},89460:(ee,B,e)=>{"use strict";e.d(B,{A:()=>s,c:()=>o});var t=e(22803),n=e(65240),r=e(65642);const o=(0,n.N)(()=>s(r.$W.theme2)),s=m=>({heading:(0,t.css)({fontSize:m.typography.body.fontSize,marginBottom:m.spacing(1)}),wrap:(0,t.css)({display:"flex",flexDirection:"column",height:"100%",width:"100%",flex:"1 1 0",minHeight:0}),toolbar:(0,t.css)({display:"flex",width:"100%",flexGrow:0,alignItems:"center",justifyContent:"flex-end",marginBottom:m.v1.spacing.sm}),toolbarItem:(0,t.css)({marginLeft:m.v1.spacing.md}),content:(0,t.css)({flexGrow:1,height:"100%"}),editor:(0,t.css)({fontFamily:"monospace",height:"100%",flexGrow:1}),viewer:(0,t.css)({overflow:"scroll"}),dataFrameSelect:(0,t.css)({flexGrow:2}),leftActions:(0,t.css)({display:"flex",flexGrow:1,maxWidth:"85%","@media (max-width: 1345px)":{maxWidth:"75%"}}),options:(0,t.css)({paddingTop:m.v1.spacing.sm}),dataDisplayOptions:(0,t.css)({flexGrow:1,minWidth:"300px",marginRight:m.v1.spacing.sm}),selects:(0,t.css)({display:"flex","> *":{marginRight:m.v1.spacing.sm}})})},26689:(ee,B,e)=>{"use strict";e.d(B,{q:()=>t});var t=(n=>(n.Data="data",n.Meta="meta",n.Error="error",n.Stats="stats",n.JSON="json",n.Query="query",n.Help="help",n))(t||{})},54334:(ee,B,e)=>{"use strict";e.d(B,{ny:()=>W,EM:()=>A,Zy:()=>K,ek:()=>N});var t=e(4213),n=e.n(t),r=e(25229),o=e(80011),s=e(64761),m=e(68125),a=e(18700),l=e(25192),f=e(2543);const u=Object.defineProperty({archiveEnabled:!1,dependencies:{dagMaxNumServices:100,menuEnabled:!0},linkPatterns:[],search:{maxLookback:{label:"2 Days",value:"2d"},maxLimit:1500},tracking:{gaID:null,trackErrors:!0}},"__mergeFields",{value:["dependencies","search","tracking"]});function i(){return defaultConfig}function x(w){return _get(i(),w)}function g(w){let j;const V=new Set(w.map(({spanID:U})=>U));for(let U=0;U<w.length;U++){if(w[U].references&&w[U].references.some(({traceID:_,spanID:Z})=>_===w[U].traceID&&V.has(Z)))continue;if(!j){j=w[U];continue}const M=w[U].references&&w[U].references.length||0,H=j.references&&j.references.length||0;(M<H||M===H&&w[U].startTime<j.startTime)&&(j=w[U])}return j?`${j.process.serviceName}: ${j.operationName}`:""}const p=(0,f.memoize)(g,w=>w.length?w[0].traceID:0);function c(w){const j=new Map,V=w.reduce((F,M)=>(F.some(H=>H.key===M.key&&H.value===M.value)?j.set(`${M.key}:${M.value}`,`Duplicate tag "${M.key}:${M.value}"`):F.push(M),F),[]),U=Array.from(j.values());return{dedupedTags:V,warnings:U}}function y(w,j){const V=w?.slice()??[],U=(j||[]).map(F=>F.toLowerCase());return V.sort((F,M)=>{const H=F.key.toLowerCase(),_=M.key.toLowerCase();for(let Z=0;Z<U.length;Z++){const ne=U[Z];if(H.startsWith(ne)&&!_.startsWith(ne))return-1;if(!H.startsWith(ne)&&_.startsWith(ne))return 1}return H>_?1:H<_?-1:0}),V}function P(w){if(!w?.traceID)return null;const j=w.traceID.toLowerCase();let V=0,U=Number.MAX_SAFE_INTEGER;const F=new Map,M=new Map;w.spans=w.spans.filter(Q=>!!Q.startTime),w.processes=Object.entries(w.processes).reduce((Q,[J,q])=>(Q[J]={...q,tags:y(q.tags)},Q),{});const H=w.spans.length;for(let Q=0;Q<H;Q++){const J=w.spans[Q],{startTime:q,duration:X,processID:se}=J;let oe=J.spanID;q<U&&(U=q),q+X>V&&(V=q+X);const ae=F.get(oe);ae!=null?(console.warn(`Dupe spanID, ${ae+1} x ${oe}`,J,M.get(oe)),_isEqual(J,M.get(oe))&&console.warn(" two spans with same ID have `isEqual(...) === true`"),F.set(oe,ae+1),oe=`${oe}_${ae}`,J.spanID=oe):F.set(oe,1),J.process=w.processes[se],M.set(oe,J)}const _=getTraceSpanIdsAsTree(w,M),Z=[],ne={};_.walk((Q,J,q=0)=>{if(Q==="__root__"||typeof Q!="string")return;const X=M.get(Q);if(!X)return;const{serviceName:se}=X.process;ne[se]=(ne[se]||0)+1,X.relativeStartTime=X.startTime-U,X.depth=q-1,X.hasChildren=J.children.length>0,X.childSpanCount=J.children.length,X.warnings=X.warnings||[],X.tags=X.tags||[],X.references=X.references||[],X.childSpanIds=J.children.slice().sort((ae,ie)=>{const fe=M.get(ae.value),pe=M.get(ie.value);return pe.startTime+pe.duration-(fe.startTime+fe.duration)}).map(ae=>ae.value);const oe=c(X.tags);X.tags=y(oe.dedupedTags,getConfigValue("topTagPrefixes")),X.warnings=X.warnings.concat(oe.warnings),X.references.forEac
283h((ae,ie)=>{const fe=M.get(ae.spanID);fe&&(ae.span=fe,ie>0&&(fe.subsidiarilyReferencedBy=fe.subsidiarilyReferencedBy||[],fe.subsidiarilyReferencedBy.push({spanID:Q,traceID:j,span:X,refType:ae.refType})))}),Z.push(X)});const te=getTraceName(Z);return{services:Object.keys(ne).map(Q=>({name:Q,numberOfSpans:ne[Q]})),spans:Z,traceID:j,traceName:te,processes:w.processes,duration:V-U,startTime:U,endTime:V}}function d(w){const j=w.spans.map(U=>D(U,w.processes)),V=new MutableDataFrame({fields:[{name:"traceID",type:FieldType.string},{name:"spanID",type:FieldType.string},{name:"parentSpanID",type:FieldType.string},{name:"operationName",type:FieldType.string},{name:"serviceName",type:FieldType.string},{name:"serviceTags",type:FieldType.other},{name:"startTime",type:FieldType.number},{name:"duration",type:FieldType.number},{name:"logs",type:FieldType.other},{name:"references",type:FieldType.other,values:[]},{name:"tags",type:FieldType.other},{name:"warnings",type:FieldType.other},{name:"stackTraces",type:FieldType.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"jaeger"}}});for(const U of j)V.add(U);return V}function D(w,j){const V=w.references?.find(U=>U.refType==="CHILD_OF")?.spanID;return{spanID:w.spanID,traceID:w.traceID,parentSpanID:V,operationName:w.operationName,startTime:w.startTime/1e3,duration:w.duration/1e3,logs:w.logs.map(U=>({...U,timestamp:U.timestamp/1e3})),tags:w.tags,warnings:w.warnings??void 0,stackTraces:w.stackTraces,references:w.references?.filter(U=>U.spanID!==V)??[],serviceName:j[w.processID].serviceName,serviceTags:j[w.processID].tags}}function b(w,j){const V=new MutableDataFrame({fields:[{name:"traceID",type:FieldType.string,config:{unit:"string",displayNameFromDS:"Trace ID",links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:j.uid,datasourceName:j.name,query:{query:"${__value.raw}"}}}]}},{name:"traceName",type:FieldType.string,config:{displayNameFromDS:"Trace name"}},{name:"startTime",type:FieldType.time,config:{displayNameFromDS:"Start time"}},{name:"duration",type:FieldType.number,config:{displayNameFromDS:"Duration",unit:"\xB5s"}}],meta:{preferredVisualisationType:"table"}}),U=w.map(E).sort((F,M)=>M?.startTime-F?.startTime);for(const F of U)V.add(F);return V}function E(w){const j=transformTraceData(w);if(j)return{traceID:j.traceID,startTime:j.startTime/1e3,duration:j.duration,traceName:j.traceName}}function v(w){let j={traceID:"",spans:[],processes:{},warnings:null},V=[];for(let U=0;U<w.length;U++){const F=w.get(U);j.traceID||(j.traceID=F.traceID),V.find(M=>M===F.serviceName)||(V.push(F.serviceName),j.processes[`p${V.length}`]={serviceName:F.serviceName,tags:F.serviceTags}),j.spans.push({traceID:F.traceID,spanID:F.spanID,duration:F.duration*1e3,references:F.parentSpanID?[{refType:"CHILD_OF",spanID:F.parentSpanID,traceID:F.traceID}]:[],flags:0,logs:F.logs.map(M=>({...M,timestamp:M.timestamp*1e3})),operationName:F.operationName,processID:Object.keys(j.processes).find(M=>j.processes[M].serviceName===F.serviceName)||"",startTime:F.startTime*1e3,tags:F.tags,warnings:F.warnings?F.warnings:null})}return{data:[j],total:0,limit:0,offset:0,errors:null}}function C(w){const j=w.map(S),V=new MutableDataFrame({fields:[{name:"traceID",type:FieldType.string,values:[]},{name:"spanID",type:FieldType.string,values:[]},{name:"parentSpanID",type:FieldType.string,values:[]},{name:"operationName",type:FieldType.string,values:[]},{name:"serviceName",type:FieldType.string,values:[]},{name:"serviceTags",type:FieldType.other,values:[]},{name:"startTime",type:FieldType.number,values:[]},{name:"duration",type:FieldType.number,values:[]},{name:"logs",type:FieldType.other,values:[]},{name:"tags",type:FieldType.other,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"zipkin"}}});for(const U of j)V.add(U);return V}function S(w){const j={traceID:w.traceId,spanID:w.id,parentSpanID:w.parentId,operationName:w.name,serviceName:w.localEndpoint?.serviceName||w.remoteEndpoint?.serviceName||"unknown",serviceTags:I(w),startTime:w.timestamp/1e3,duration:w.duration/1e3,logs:w.annotations?.map(O)??[],tags:Object.keys(w.tags||{}).reduce((V,U)=>U==="error"?(V.push({key:"error",value:!0}),V.push({key:"errorValue",value:w.tags.error}),V):(V.push({key:U,value:w.tags[U]}),V),[])};return w.kind&&(j.tags=[{key:"kind",value:w.kind},...j.tags??[]]),w.shared&&(j.tags=[{key:"shared",value:w.shared},...j.tags??[]]),j}function O(w){return{timestamp:w.timestamp,fields:[{key:"annotation",value:w.value}]}}function I(w){const j=w.localEndpoint||w.remoteEndpoint;return j?[R("ipv4",j.ipv4),R("ipv6",j.ipv6),R("port",j.port),R("endpointType",w.localEndpoint?"local":"remote")].filter(V=>!!V):[]}function R(w,j){if(j)return{key:w,value:j}}const T=w=>{let j=[];for(let V=0;V<w.length;V++){const U=w.get(V);j.push({traceId:U.traceID,parentId:U.parentSpanID,name:U.operationName,id:U.spanID,timestamp:U.startTime*1e3,duration:U.duration*1e3,...L(U),annotations:U.logs.length?U.logs.map(F=>({timestamp:F.timestamp,value:F.fields[0].value})):void 0,tags:U.tags.length?U.tags.filter(F=>F.key!=="kind"&&F.key!=="endpointType"&&F.key!=="shared").reduce((F,M)=>M.key==="error"?{...F,[M.key]:U.tags.find(H=>H.key==="errorValue").value||""}:{...F,[M.key]:M.value},{}):void 0,kind:U.tags.find(F=>F.key==="kind")?.value,shared:U.tags.find(F=>F.key==="shared")?.value})}return j},L=w=>{const j=w.serviceTags.find(V=>V.key==="endpointType")?.value==="local"?"localEndpoint":"remoteEndpoint";return w.serviceName!=="unknown"?{[j]:{serviceName:w.serviceName,ipv4:w.serviceTags.find(V=>V.key==="ipv4")?.value,ipv6:w.serviceTags.find(V=>V.key==="ipv6")?.value,port:w.serviceTags.find(V=>V.key==="port")?.value}}:void 0};function K(w,j=""){let V="";w.meta?.forEach(M=>{const H=`${M.label}: ${JSON.stringify(M.value)} 284`;V=V+H}),V=V+` 285 286`,w.rows.forEach(M=>{const H=M.timeEpochMs+" "+(0,r.KQ)(M.timeEpochMs).toISOString()+" "+M.entry+` 287`;V=V+H});const U=new Blob([V],{type:"text/plain;charset=utf-8"}),F=`${j?`${j}-logs`:"Logs"}-${(0,o.LE)(new Date)}.txt`;n()(U,F)}function A(w,j,V,U=s.F.noop){const F=(0,m._O)([w],V),M=V?.useExcelHeader?"\uFEFF":"",H=new Blob([M,F],{type:"text/csv;charset=utf-8"}),_=U!==s.F.noop?"-as-"+U.toLocaleLowerCase():"",Z=`${j}-data${_}-${(0,o.LE)(new Date)}.csv`;n()(H,Z)}function W(w,j){const V=new Blob([JSON.stringify(w)],{type:"application/json"}),U=`${j}-${(0,o.LE)(new Date)}.json`;n()(V,U)}function N(w,j){let V="otlp";switch(w.meta?.custom?.traceFormat){case"jaeger":{let U=v(new a.k(w));W(U,j),V="jaeger";break}case"zipkin":{let U=T(new a.k(w));W(U,j),V="zipkin";break}case"otlp":default:{let U=(0,l.xw)(new a.k(w));W(U,j);break}}return V}},8419:(ee,B,e)=>{"use strict";e.d(B,{p:()=>r});var t=e(32899),n=e(45229);function r(s){let m="";try{m=JSON.stringify(s,o(),2)}catch(a){a instanceof Error&&(a.toString().includes("RangeError")||a.toString().includes("allocation size overflow"))?n.A.emit(t.r1.alertError,[a.toString(),"Cannot display JSON, the object is too big."]):n.A.emit(t.r1.alertError,[a instanceof Error?a.toString():a])}return m}function o(){const s=new WeakSet;return(m,a)=>{if(m==="__dataContext"||m==="__sceneObject")return"Filtered out in JSON serialization";if(typeof a=="object"&&a!==null){if(s.has(a))return;s.add(a)}return a}}},61666:(ee,B,e)=>{"use strict";e.d(B,{G7:()=>o,KU:()=>s,eb:()=>m});var t=e(68143),n=e(73427),r=e(96673);const o=(0,r.createAsyncThunk)("users/fetchInvitees",async()=>
287n.TP.hasPermission(r.AccessControlAction.OrgUsersAdd)?await(0,t.AI)().get("/api/org/invites"):[]),s=(0,r.createAsyncThunk)("users/addInvitee",async(a,{dispatch:l})=>{await(0,t.AI)().post("/api/org/invites",a),await l(o())}),m=(0,r.createAsyncThunk)("users/revokeInvite",async a=>(await(0,t.AI)().patch(`/api/org/invites/${a}/revoke`,{}),a))},38748:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>l,Tp:()=>o});var t=e(65307),n=e(61666);const r=(0,t.pU)({selectId:f=>f.code}),o=r.getSelectors(),s=r.getInitialState({status:"idle"}),l={invites:(0,t.Z0)({name:"invites",initialState:s,reducers:{},extraReducers:f=>{f.addCase(n.G7.pending,h=>{h.status="loading"}).addCase(n.G7.fulfilled,(h,{payload:u})=>{r.setAll(h,u),h.status="succeeded"}).addCase(n.G7.rejected,h=>{h.status="failed"}).addCase(n.eb.fulfilled,(h,{payload:u})=>{r.removeOne(h,u),h.status="succeeded"})}}).reducer}},43652:(ee,B,e)=>{"use strict";e.d(B,{b:()=>c,o:()=>y});var t=e(74848),n=e(96540),r=e(40996),o=e(16817),s=e(68143),m=e(43173),a=e(37386),l=e(63527),f=e(41654),h=e(45861),u=e(22787),i=e(67804),x=e(56840),g=e(30124),p=e(12048);const c=({panel:P,initialFolderUid:d,onCreateLibraryPanel:D,onDismiss:b})=>
287{const[E,v]=(0,n.useState)(d),[C,S]=(0,n.useState)(P.title),[O,I]=(0,n.useState)(P.title),[R,T]=(0,n.useState)(!1);(0,n.useEffect)(()=>T(!0),[C]),(0,r.A)(()=>I(C),350,[C]);const{saveLibraryPanel:L}=(0,p.b)(),K=(0,n.useCallback)(()=>{P.libraryPanel={uid:"",name:C},L(P,E).then(N=>{(0,s.NF)(N)?P.libraryPanel=void 0:(b?.(),D?.(N))})},[P,C,L,E,b,D]),A=(0,o.A)(async()=>{try{return!(await(0,g.e9)(C)).some(N=>N.folderUid===E)}catch(N){return(0,s.NF)(N)&&(N.isHandled=!0),!0}finally{T(!1)}},[O,E]),W=!A?.value&&A.value!==void 0&&C===O&&!R;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.D,{label:(0,x.t)("library-panel.add-modal.name","Library panel name"),invalid:W,error:W?(0,x.t)("library-panel.add-modal.error","Library panel with this name already exists"):"",children:(0,t.jsx)(l.p,{id:"share-panel-library-panel-name-input",name:"name",value:C,onChange:N=>S(N.currentTarget.value)})}),(0,t.jsx)(a.D,{label:(0,x.t)("library-panel.add-modal.folder","Save in folder"),description:(0,x.t)("library-panel.add-modal.folder-description","Library panel permissions are derived from the folder permissions"),children:(0,t.jsx)(i.d,{onChange:N=>v(N),value:E,inputId:"share-panel-library-panel-folder-picker"})}),m.$.featureToggles.newDashboardSharingComponent?(0,t.jsxs)(f.B,{gap:1,justifyContent:"start",children:[(0,t.jsx)(h.$n,{onClick:K,disabled:W,children:(0,t.jsx)(x.x6,{i18nKey:"share-panel.new-library-panel.create-button",children:"Create library panel"})}),(0,t.jsx)(h.$n,{variant:"secondary",onClick:b,fill:"outline",children:(0,t.jsx)(x.x6,{i18nKey:"share-panel.new-library-panel.cancel-button",children:"Cancel"})})]}):(0,t.jsxs)(u.a.ButtonRow,{children:[(0,t.jsx)(h.$n,{variant:"secondary",onClick:b,fill:"outline",children:(0,t.jsx)(x.x6,{i18nKey:"library-panel.add-modal.cancel",children:"Cancel"})}),(0,t.jsx)(h.$n,{onClick:K,disabled:W,children:(0,t.jsx)(x.x6,{i18nKey:"library-panel.add-modal.create",children:"Create library panel"})})]})]})},y=({isOpen:P=!1,panel:d,initialFolderUid:D,...b})=>(0,t.jsx)(u.a,{title:(0,x.t)("library-panels.add-library-panel-modal.title-create-library-panel","Create library panel"),isOpen:P,onDismiss:b.onDismiss,children:(0,t.jsx)(c,{panel:d,initialFolderUid:D,onDismiss:b.onDismiss})})},70905:(ee,B,e)=>{"use strict";e.d(B,{E:()=>L});var t=e(74848),n=e(22803),r=e(96540),o=e(70255),s=e(43173),m=e(63142),a=e(30703),l=e(20941),f=e(21348),h=e(56840),u=e(41097),i=e(54044),x=e(28105),g=e(22787),p=e(45861),c=e(37666),y=e(55290),P=e(30124),d=e(65307);const D={loadingState:x.Gu.Loading,dashboardTitles:[]},b=(0,d.VP)("libraryPanels/delete/searchCompleted"),E=(W=D,N)=>b.match(N)?{...W,dashboardTitles:N.payload.dashboards.map(w=>w.title),loadingState:x.Gu.Done}:W;function v(W){return async function(N){const w=await(0,P.xV)(W.uid);N(b({dashboards:w}))}}const C=({libraryPanel:W,onDismiss:N,onConfirm:w})=>{const j=(0,m.of)(c.o),[{dashboardTitles:V,loadingState:U},F]=(0,r.useReducer)(E,D),M=(0,r.useMemo)(()=>(0,y.QC)(F),[F]);(0,r.useEffect)(()=>{M(v(W))},[M,W]);const H=!!V.length,_=U===x.Gu.Done;return(0,t.jsxs)(g.a,{className:j.modal,title:(0,h.t)("library-panels.delete-library-panel-modal.title-delete-library-panel","Delete library panel"),icon:"trash-alt",onDismiss:N,isOpen:!0,children:[_?null:(0,t.jsx)(S,{}),_?(0,t.jsxs)("div",{children:[H?(0,t.jsx)(I,{dashboardTitles:V}):null,H?null:(0,t.jsx)(O,{}),(0,t.jsxs)(g.a.ButtonRow,{children:[(0,t.jsx)(p.$n,{variant:"secondary",onClick:N,fill:"outline",children:(0,t.jsx)(h.x6,{i18nKey:"library-panels.delete-library-panel-modal.cancel",children:"Cancel"})}),(0,t.jsx)(p.$n,{variant:"destructive",onClick:w,disabled:H,children:(0,t.jsx)(h.x6,{i18nKey:"library-panels.delete-library-panel-modal.delete",children:"Delete"})})]})]}):null]})},S=()=>(0,t.jsx)("span",{children:(0,t.jsx)(h.x6,{i18nKey:"library-panels.loading-indicator.loading-library-panel",children:"Loading library panel..."})}),O=()=>{const W=(0,m.of)(c.o);return(0,t.jsx)("div",{className:W.modalText,children:(0,t.jsx)(h.x6,{i18nKey:"library-panels.confirm.delete-panel",children:"Do you want to delete this panel?"})})},I=({dashboardTitles:W})=>{const N=(0,m.of)(c.o),w=W.length===1?"dashboard.":"dashboards.",j=`${W.length} ${w}`;return W.length===0?null:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:N.textInfo,children:["This library panel can not be deleted because it is connected to ",(0,t.jsx)("strong",{children:j})," Remove the library panel from the dashboards listed below and retry."]}),(0,t.jsxs)("table",{className:N.myTable,children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:(0,t.jsx)("th",{children:(0,t.jsx)(h.x6,{i18nKey:"library-panels.has-connected-dashboards.dashboard-name",children:"Dashboard name"})})})}),(0,t.jsx)("tbody",{children:W.map((V,U)=>(0,t.jsx)("tr",{children:(0,t.jsx)("td",{children:V})},`dash-title-${U}`))})]})]})},R=({libraryPanel:W,onClick:N,onDelete:w,showSecondaryActions:j})=>{const[V,U]=(0,r.useState)(!1),F=()=>{w?.(W),U(!1)},M=s.$.panels[W.model.type]??(0,u.$)(W.model.type).meta;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.b,{isCurrent:!1,title:W.name,description:W.description,plugin:M,onClick:()=>N?.(W),onDelete:j?()=>U(!0):void 0,children:(0,t.jsx)(K,{libraryPanel:W})}),V&&(0,t.jsx)(C,{libraryPanel:W,onConfirm:F,onDismiss:()=>U(!1)})]})},T=({showSecondaryActions:W,rootProps:N})=>{const w=(0,m.of)(A);return(0,t.jsx)(i.b.Skeleton,{hasDelete:W,...N,children:(0,t.jsx)(o.A,{containerClassName:w.metaContainer,width:80})})},L=(0,f.j)(R,T);function K({libraryPanel:W}){const N=(0,m.of)(A);return!W.meta?.folderUid&&!W.meta?.folderName?null:W.meta.folderUid?(0,t.jsx)("span",{className:N.metaContainer,children:(0,t.jsxs)(l.N,{href:`/dashboards/f/${W.meta.folderUid}`,children:[(0,t.jsx)(a.I,{name:"folder-upload",size:"sm"}),(0,t.jsx)("span",{children:W.meta.folderName})]})}):(0,t.jsxs)("span",{className:N.metaContainer,children:[(0,t.jsx)(a.I,{name:"folder",size:"sm"}),(0,t.jsx)("span",{children:(0,t.jsx)(h.x6,{i18nKey:"library-panels.folder-link.dashboards",children:"Dashboards"})})]})}function A(W){return{metaContainer:(0,n.css)({display:"flex",alignItems:"center",color:W.colors.text.secondary,fontSize:W.typography.bodySmall.fontSize,paddingTop:W.spacing(.5),svg:{marginRight:W.spacing(.5),marginBottom:3}})}}},24438:(ee,B,e)=>{"use strict";e.d(B,{j:()=>I,s:()=>O});var t=e(74848),n=e(22803),r=e(96540),o=e(40996),s=e(63142),m=e(32881),a=e(12737),l=e(56840),f=e(76459),h=e.n(f),u=e(45861),i=e(18857),x=e(30703),g=e(65642),p=e(83873),c=e(55860),y=e(83458),P=e(96673);function d({onChange:K,maxMenuHeight:A}){const W=(0,s.of)(b),[N,w]=(0,r.useState)(!1),j=(0,r.useCallback)(H=>D(H,w),[]),V=(0,r.useMemo)(()=>h()(j,300),[j]),[U,F]=(0,r.useState)([]),M=(0,r.useCallback)(H=>{const _=H.filter(Z=>!!Z.value).map(Z=>Z.value);K(_),F(H)},[K]);return(0,t.jsxs)("div",{className:W.container,children:[U.length>
2870&&(0,t.jsx)(u.$n,{size:"xs",icon:"trash-alt",fill:"text",className:W.clear,onClick:()=>K([]),children:(0,t.jsx)(l.x6,{i18nKey:"folder-filter.clear-folder-button",children:"Clear folders"})}),(0,t.jsx)(i.Iv,{value:U,onChange:M,isLoading:N,loadOptions:V,maxMenuHeight:A,placeholder:(0,l.t)("folder-filter.select-placeholder","Filter by folder"),noOptionsMessage:"No folders found",prefix:(0,t.jsx)(x.I,{name:"filter"}),"aria-label":(0,l.t)("folder-filter.select-aria-label","Folder filter"),defaultOptions:!0})]})}async function D(K,A){if(A(!0),g.$W.featureToggles.unifiedStorageSearchUI){const U=(await(0,c.S)().search({query:K,kind:["folder"],limit:100,permission:P.PermissionLevelString.View})).view.map(F=>({label:F.name,value:{uid:F.uid,title:F.name}}));return(!K||"dashboards".includes(K.toLowerCase()))&&U.unshift({label:"Dashboards",value:{uid:"general",title:"Dashboards"}}),A(!1),U}const W={query:K,type:y.G.DashFolder,permission:P.PermissionLevelString.View},w=(await(0,p.AI)().search(W)).map(j=>({label:j.title,value:{uid:j.uid,title:j.title}}));return(!K||"dashboards".includes(K.toLowerCase()))&&w.unshift({label:"Dashboards",value:{uid:"general",title:"Dashboards"}}),A(!1),w}function b(K){return{container:(0,n.css)({label:"container",position:"relative",minWidth:"180px",flexGrow:1}),clear:(0,n.css)({label:"clear",fontSize:K.spacing(1.5),position:"absolute",top:-K.spacing(4.5),right:0})}}var E=e(92100),v=e(18552),C=e(95943),S=e(90232),O=(K=>(K.Tight="tight",K.Spacious="spacious",K))(O||{});const I=({onClick:K,variant:A="spacious",currentPanelId:W,currentFolderUID:N,perPage:w=C.FG,showPanelFilter:j=!1,showFolderFilter:V=!1,showSort:U=!1,showSecondaryActions:F=!1})=>{const M=(0,s.of)(R,A),[H,_]=(0,r.useState)(""),[Z,ne]=(0,r.useState)("");(0,o.A)(()=>ne(H),200,[H]);const[te,Y]=(0,r.useState)({}),[Q,J]=(0,r.useState)(N?[N]:[]),[q,X]=(0,r.useState)([]),se=U||j||V,oe=A==="tight"?"lg":"xs";return(0,t.jsx)("div",{className:M.container,children:(0,t.jsxs)(m.gW,{spacing:oe,children:[(0,t.jsxs)("div",{className:(0,n.cx)(M.gridContainer,{[M.tightLayout]:A==="tight"}),children:[(0,t.jsx)("div",{className:M.filterInputWrapper,children:(0,t.jsx)(a.Z,{value:H,onChange:_,placeholder:(0,l.t)("library-panels.library-panels-search.placeholder-search-by-name-or-description","Search by name or description"),width:0,escapeRegex:!1})}),se&&(0,t.jsx)(T,{showSort:U,showPanelFilter:j,showFolderFilter:V,onSortChange:Y,onFolderFilterChange:J,onPanelFilterChange:X,sortDirection:te.value,variant:A})]}),(0,t.jsx)("div",{className:M.libraryPanelsView,children:(0,t.jsx)(S.y,{onClickCard:K,searchString:Z,sortDirection:te.value,panelFilter:q,folderFilter:Q,currentPanelId:W,showSecondaryActions:F,perPage:w})})]})})};function R(K,A){return{filterInputWrapper:(0,n.css)({flexGrow:A==="tight"?1:"initial"}),container:(0,n.css)({width:"100%",overflowY:"auto",padding:K.spacing(1)}),libraryPanelsView:(0,n.css)({width:"100%"}),gridContainer:(0,n.css)({display:"flex",flexDirection:"column",width:"100%",columnGap:K.spacing(1),rowGap:K.spacing(1),paddingBottom:K.spacing(2)}),tightLayout:(0,n.css)({flexDirection:"row",rowGap:K.spacing(1)})}}const T=(0,r.memo)(({variant:K="spacious",showSort:A,showPanelFilter:W,showFolderFilter:N,sortDirection:w,onSortChange:j,onFolderFilterChange:V,onPanelFilterChange:U})=>{const F=(0,s.of)(L),M=(0,r.useCallback)(_=>U(_.map(Z=>Z.id)),[U]),H=(0,r.useCallback)(_=>V(_.map(Z=>Z.uid??"")),[V]);return(0,t.jsxs)("div",{className:(0,n.cx)(F.container,{[F.containerTight]:K==="tight"}),children:[A&&(0,t.jsx)(v.r,{value:w,onChange:j,filter:["alpha-asc","alpha-desc"]}),(N||W)&&(0,t.jsxs)("div",{className:(0,n.cx)(F.filterContainer,{[F.filterContainerTight]:K==="tight"}),children:[N&&(0,t.jsx)(d,{onChange:H}),W&&(0,t.jsx)(E.$,{onChange:M})]})]})});
287T.displayName="SearchControls";function L(K){return{container:(0,n.css)({display:"flex",gap:K.spacing(1),flexGrow:1,flexDirection:"row",justifyContent:"space-between",flexWrap:"wrap"}),containerTight:(0,n.css)({flexGrow:"initial",flexDirection:"column",justifyContent:"normal"}),filterContainer:(0,n.css)({display:"flex",flexDirection:"row",gap:K.spacing(1)}),filterContainerTight:(0,n.css)({flexDirection:"column",marginLeft:"initial"})}}},90232:(ee,B,e)=>{"use strict";e.d(B,{y:()=>p});var t=e(74848),n=e(22803),r=e(96540),o=e(40996),s=e(28105),m=e(63142),a=e(50201),l=e(89640),f=e(41654),h=e(34213),u=e(56840),i=e(70905),x=e(55290),g=e(24381);const p=({onClickCard:y,searchString:P,sortDirection:d,panelFilter:D,folderFilter:b,showSecondaryActions:E,currentPanelId:v,perPage:C=40})=>{const S=(0,m.of)(c),[{libraryPanels:O,page:I,perPage:R,numberOfPages:T,loadingState:L,currentPanelId:K},A]=(0,r.useReducer)(g.w_,{...g.Xb,currentPanelId:v,perPage:C}),W=(0,r.useMemo)(()=>(0,x.QC)(A),[A]);(0,o.A)(()=>W((0,x.IF)({searchString:P,sortDirection:d,panelFilter:D,folderFilterUIDs:b,page:I,perPage:R,currentPanelId:K})),300,[P,d,D,b,I,W]);const N=({uid:V})=>W((0,x.h4)(V,{searchString:P,sortDirection:d,panelFilter:D,folderFilterUIDs:b,page:I,perPage:R})),w=V=>W((0,g.yd)({page:V}));return!(P||D?.length||b?.length)&&L===s.Gu.Done&&O.length<1?(0,t.jsx)(a.p,{variant:"call-to-action",message:(0,u.t)("library-panel.empty-state.message","You haven't created any library panels yet"),children:(0,t.jsxs)(u.x6,{i18nKey:"library-panel.empty-state.more-info",children:["Create a library panel from any existing dashboard panel through the panel context menu."," ",(0,t.jsx)(l.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-library-panels/#create-a-library-panel",children:"Learn more"})]})}):(0,t.jsxs)(f.B,{direction:"column",wrap:"nowrap",children:[L===s.Gu.Loading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.E.Skeleton,{showSecondaryActions:E}),(0,t.jsx)(i.E.Skeleton,{showSecondaryActions:E}),(0,t.jsx)(i.E.Skeleton,{showSecondaryActions:E})]}):O.length<1?(0,t.jsx)(a.p,{variant:"not-found",message:(0,u.t)("library-panels.empty-state.message","No library panels found")}):O?.map((V,U)=>(0,t.jsx)(i.E,{libraryPanel:V,onDelete:N,onClick:y,showSecondaryActions:E},`library-panel=${U}`)),O.length?(0,t.jsx)("div",{className:S.pagination,children:(0,t.jsx)(h.d,{currentPage:I,numberOfPages:T,onNavigate:w,hideWhenSinglePage:!0})}):null]})},c=y=>({pagination:(0,n.css)({alignSelf:"center",marginTop:y.spacing(1)})})},55290:(ee,B,e)=>{"use strict";e.d(B,{IF:()=>g,QC:()=>c,h4:()=>p});var t=e(64423),n=e(65474),r=e(62467),o=e(44240),s=e(39697),m=e(69862),a=e(66847),l=e(69850),f=e(1005),h=e(65961),u=e(67791),i=e(30124),x=e(24381);function g(y){return function(P){const d=new t.yU,D=(0,n.H)((0,i.dq)({searchString:y.searchString,perPage:y.perPage,page:y.page,excludeUid:y.currentPanelId,sortDirection:y.sortDirection,typeFilter:y.panelFilter,folderFilterUIDs:y.folderFilterUIDs})).pipe((0,m.Z)(b=>{const{elements:E}=b;return(0,r.of)({...b,elements:E})}),(0,m.Z)(({perPage:b,elements:E,page:v,totalCount:C})=>(0,r.of)((0,x.c4)({libraryPanels:E,page:v,perPage:b,totalCount:C}))),(0,a.W)(b=>(console.error(b),(0,r.of)((0,x.c4)({...x.Xb,page:y.page,perPage:y.perPage})))),(0,l.j)(()=>d.unsubscribe()),(0,f.u)());d.add((0,o.h)((0,s.O)(50).pipe((0,h.u)((0,x.d9)()),(0,u.Q)(D)),D).subscribe(P))}}function p(y,P){return async function(d){try{await(0,i.h4)(y),g(P)(d)}catch(D){console.error(D)}}}function c(y){return function(P){return P instanceof Function?P(y):y(P)}}},24381:(ee,B,e)=>{"use strict";e.d(B,{Xb:()=>r,c4:()=>s,d9:()=>o,w_:()=>a,yd:()=>m});var t=e(65307),n=e(28105);const r={loadingState:n.Gu.Loading,libraryPanels:[],totalCount:0,perPage:40,page:1,numberOfPages:0,currentPanelId:void 0},o=(0,t.VP)("libraryPanels/view/initSearch"),s=(0,t.VP)("libraryPanels/view/searchCompleted"),m=(0,t.VP)("libraryPanels/view/changePage"),a=(l,f)=>{if(o.match(f))return{...l,loadingState:n.Gu.Loading};if(s.match(f)){const{libraryPanels:h,page:u,perPage:i,totalCount:x}=f.payload,g=Math.ceil(x/i);return{...l,libraryPanels:h,perPage:i,totalCount:x,loadingState:n.Gu.Done,numberOfPages:g,page:u>g?u-1:u}}return m.match(f)?{...l,page:f.payload.page}:l}},75515:(ee,B,e)=>{"use strict";e.d(B,{X:()=>t});function t(n){return!!n.libraryPanel?.uid}},30124:(ee,B,e)=>{"use strict";e.d(B,{DW:()=>d,GN:()=>p,Yr:()=>h,d7:()=>i,dq:()=>f,e9:()=>u,h4:()=>g,jc:()=>x,xV:()=>c});var t=e(75505),n=e(59857),r=e(7817),o=e(93389),s=e(70030),m=e(8285),a=e(83873),l=e(97583);async function f({searchString:D="",perPage:b=100,page:E=1,excludeUid:v="",sortDirection:C="",typeFilter:S=[],folderFilterUIDs:O=[]}={}){const I=new URLSearchParams;I.append("searchString",D),I.append("sortDirection",C),I.append("typeFilter",S.join(",")),I.append("folderFilterUIDs",O.join(",")),I.append("excludeUid",v),I.append("perPage",b.toString(10)),I.append("page",E.toString(10)),I.append("kind",l.i.Panel.toString(10));const{result:R}=await(0,a.AI)().get(`/api/library-elements?${I.toString()}`);return R}async function h(D,b=!1){const E=await(0,t.s)((0,a.AI)().fetch({method:"GET",url:`/api/library-elements/${D}`,showSuccessAlert:!b,showErrorAlert:!b})),{result:v}=E.data,C=new r.G({...n.Ye,schemaVersion:35,panels:[v.model]}),{scopedVars:S,...O}=C.panels[0].getSaveModel();return delete O.gridPos,delete O.id,delete O.libraryPanel,C.destroy(),{...v,model:O}}async function u(D){const{result:b}=await(0,a.AI)().get(`/api/library-elements/name/${D}`);return b}async function i(D,b){const{result:E}=await(0,a.AI)().post("/api/library-elements",{folderUid:b,name:D.libraryPanel.name,model:D,kind:l.i.Panel});return E}async function x(D){const{libraryPanel:b,...E}=D,{uid:v,name:C,version:S,folderUid:O}=b,I=l.i.Panel,{result:R}=await(0,a.AI)().patch(`/api/library-elements/${v}`,{folderUid:O,name:C,model:E,version:S,kind:I});return R}function g(D){return(0,a.AI)().delete(`/api/library-elements/${D}`)}async function p(D){const{result:b}=await(0,a.AI)().get(`/api/library-elements/${D}/connections`);return b}async function c(D){const b=await p(D);return b.length===0?[]:await(0,a.AI)().search({dashboardUIDs:b.map(v=>v.connectionUid)})}function y(D){const b=(0,m.iL)(D),{uid:E,name:v,_loadedPanel:C}=b.state;let S=D.parent;if(!S||!(S instanceof o.U))throw new Error("Trying to save a library panel that does not have a DashboardGridItem parent");return{...C,uid:E,name:v,type:D.state.pluginId,model:(0,s.Z6)(D.clone({$behaviors:void 0}),{x:S.state.x??0,y:S.state.y??0,w:S.state.width??0,h:S.state.height??0},!1,S),kind:l.i.Panel,version:C?.version||0}}async function P(D){const{uid:b,folderUid:E,name:v,model:C,version:S,kind:O}=y(D),{result:I}=await(0,a.AI)().patch(`/api/library-elements/${b}`,{folderUid:E,name:v,model:C,version:S,kind:O});return I}async function d(D){const b=await P(D),E=(0,m.iL)(D);if(!E)throw new Error("Could not find library panel behavior for panel");
287E.setPanelFromLibPanel(b)}},37666:(ee,B,e)=>{"use strict";e.d(B,{o:()=>n});var t=e(22803);function n(r){return{myTable:(0,t.css)({maxHeight:"204px",overflowY:"auto",marginTop:"11px",marginBottom:"28px",borderRadius:r.shape.radius.default,border:`1px solid ${r.colors.action.hover}`,background:r.colors.background.primary,color:r.colors.text.secondary,fontSize:r.typography.h6.fontSize,width:"100%",thead:{color:"#538ade",fontSize:r.typography.bodySmall.fontSize},"th, td":{padding:"6px 13px",height:r.spacing(4)},"tbody > tr:nth-child(odd)":{background:r.colors.background.secondary}}),noteTextbox:(0,t.css)({marginBottom:r.spacing(4)}),textInfo:(0,t.css)({color:r.colors.text.secondary,fontSize:r.typography.size.sm}),dashboardSearch:(0,t.css)({marginTop:r.spacing(2)}),modal:(0,t.css)({width:"500px"}),modalText:(0,t.css)({fontSize:r.typography.h4.fontSize,color:r.colors.text.primary,marginBottom:r.spacing(4),paddingTop:r.spacing(2)})}}},97583:(ee,B,e)=>{"use strict";e.d(B,{i:()=>t});var t=(r=>(r[r.Panel=1]="Panel",r))(t||{}),n=(r=>(r[r.Dashboard=1]="Dashboard",r))(n||{})},12048:(ee,B,e)=>{"use strict";e.d(B,{b:()=>h});var t=e(5805),n=e(68143),r=e(64762),o=e(56840),s=e(30124);async function m(u,i){const x=a(u),g=await f(x,i);return l(u,g),g}function a(u){let{scopedVars:i,...x}=u.getSaveModel();return x={libraryPanel:{name:u.title,uid:void 0},...x},x}function l(u,i){u.restoreModel({...i.model,configRev:0,libraryPanel:i,title:u.title}),u.hasSavedPanelEditChange=!0,u.refresh()}function f(u,i){return u.libraryPanel?u.libraryPanel&&u.libraryPanel.uid===""?(0,s.d7)(u,i):(0,s.jc)(u):Promise.reject()}const h=()=>{const u=(0,r._2)(),[i,x]=(0,t.default)(async(g,p)=>{try{const c=await m(g,p);return u.success((0,o.t)("library-panels.save.success","Library panel saved")),c}catch(c){throw(0,n.NF)(c)&&(c.isHandled=!0,u.error((0,o.t)("library-panels.save.error",'Error saving library panel: "{{errorMsg}}"',{errorMsg:c.message??c.data.message}))),c}},[]);return{state:i,saveLibraryPanel:x}}},79718:(ee,B,e)=>{"use strict";e.d(B,{t:()=>D});var t=e(24726),n=e(38619),r=e(32899),o=e(33184),s=e(36490),m=e(73427),a=e(87745),l=e(22429),f=e(74848),h=e(22803),u=e(63142),i=e(22787),x=e(45861),g=e(56840),p=(b=>(b.Saved="saved",b.EditingStarted="editing-started",b.EditingCanceled="editing-cancelled",b.Deleted="deleted",b))(p||{});function c({onDismiss:b,event:E}){const v=(0,u.of)(y),C=()=>{if(E?.action===p.Deleted){s.Ny.push("/");return}D.reloadPage(),b()};return(0,f.jsxs)(i.a,{isOpen:!0,title:(0,g.t)("live.dashboard-changed-modal.title-dashboard-changed","Dashboard changed"),icon:"copy",onDismiss:b,onClickBackdrop:()=>{},className:v.modal,children:[(0,f.jsx)("div",{className:v.description,children:"The dashboard has been updated by another session. Do you want to continue editing or discard your local changes?"}),(0,f.jsxs)(i.a.ButtonRow,{children:[(0,f.jsx)(x.$n,{onClick:b,variant:"secondary",fill:"outline",children:(0,f.jsx)(g.x6,{i18nKey:"live.dashboard-changed-modal.continue-editing",children:"Continue editing"})}),(0,f.jsx)(x.$n,{onClick:C,variant:"destructive",children:(0,f.jsx)(g.x6,{i18nKey:"live.dashboard-changed-modal.discard-local-changes",children:"Discard local changes"})})]})]})}const y=b=>({modal:(0,h.css)({width:"600px"}),description:(0,h.css)({color:b.colors.text.secondary,paddingBottom:b.spacing(1)})}),P=(0,t.A)();class d{constructor(){this.editing=!1,this.observer={next:E=>{if((0,n.ew)(E)&&this.editing&&E.state===n.ZF.Connected&&this.sendEditingState(),(0,n.Z7)(E)){if(E.message.sessionId===P)return;const{action:v}=E.message;switch(v){case p.EditingStarted:case p.Saved:{if(this.ignoreSave){this.ignoreSave=!1;return}const C=(0,l.UA)().getCurrent();if(C?.uid!==E.message.uid){console.log("dashboard event for different dashboard?",E,C);return}const S=this.editing||C.hasUnsavedChanges();if(v===p.Saved)S?m.lE.publish(new a.S8({component:c,props:{event:E}})):(m.lE.emit(r.r1.alertSuccess,["Dashboard updated"]),this.reloadPage());else if(S&&v===p.EditingStarted&&!this.hasSeenNotice){const O=E.message,I=this.getRecentEditingEvent();(!I||I.message!==O.message)&&(this.hasSeenNotice=!0,m.lE.emit(r.r1.alertWarning,["Another session is editing this dashboard",O.message])),this.lastEditing=O}return}}}}}}setEditingState(E){const v=this.editing=E;this.editing=E,this.hasSeenNotice=!1,v&&m.TP.isEditor&&this.sendEditingState()}sendEditingState(){const{channel:E,uid:v}=this;E&&v&&(0,o.oF)().publish(E,{sessionId:P,uid:v,action:this.editing?p.EditingStarted:p.EditingCanceled,timestamp:Date.now()})}watch(E){const v=(0,o.oF)();v&&E!==this.uid&&(this.channel={scope:n.qD.Grafana,namespace:"dashboard",path:`uid/${E}`},this.leave(),E&&(this.subscription=v.getStream(this.channel).subscribe(this.observer)),this.uid=E)}leave(){this.subscription&&this.subscription.unsubscribe(),this.subscription=void 0,this.uid=void 0}ignoreNextSave(){this.ignoreSave=!0}getRecentEditingEvent(){return this.lastEditing&&this.lastEditing.timestamp&&Date.now()-this.lastEditing.timestamp>5e3&&(this.lastEditing=void 0),this.lastEditing}reloadPage(){s.Ny.reload()}}const D=new d},46383:(ee,B,e)=>{"use strict";e.d(B,{_w:()=>n,o$:()=>m,ot:()=>r});var t=e(41119),n=(a=>(a.NewValuesSameSchema="NewValuesSameSchema",a.FullFrame="FullFrame",a))(n||{});const r=(a,l)=>"type"in a&&a.type===l,o=Object.values(n),s=a=>"type"in a&&o.includes(a.type),m=a=>(0,t.ci)(a)&&"packetInfo"in a},62215:(ee,B,e)=>{"use strict";e.d(B,{FE:()=>a,jE:()=>s,qE:()=>m});var t=e(2543),n=e.n(t),r=e(62635),o=e(46072);const s=(u,i)=>a(u,i),m=u=>{let i=[];return u.forEach(x=>{x.links?.forEach(g=>{if("variables"in g&&g.variables.length>0){const p={href:g.href,title:g.title,origin:g.origin,onClick:g.onClick,target:g.target},c=g.variables.map(P=>{const d=P.variableName,D=P.fieldPath?`.${P.fieldPath}`:"";return`${d}${D}`}),y=g.variables.map(P=>P.found?P.value:"");i.push({keys:c,values:y,links:[p],fieldIndex:x.fieldIndex})}})}),i},a=(u,i)=>h(u).map(g=>{const p=i?i(g,u.rowIndex,u.dataFrame):[],c=g.values[u.rowIndex],y=typeof c=="string"||typeof c=="number"?c.toString():(0,r.MA)(c);return{keys:[g.name],values:[y],links:p,fieldIndex:g.index}});function l(u,i){const x=(0,o.Os)(u);if(x===null)return new Set;const g=new Set(x.extraFields.map(p=>p.index));return x.severityField!==null&&g.add(x.severityField.index),i.keepBody&&g.add(x.bodyField.index),i.keepTimestamp&&g.add(x.timeField.index),g}function f(u,i){const x=u.fields.map((y,P)=>({...y,index:P})),g=l(u,i??{}),[p,c]=partition(x,y=>y.config.custom?.hidden?!1:(y.config.links??[]).length>0?!0:g.has(y.index));return{visible:p,hidden:c}}function h(u,i){const x=u.dataFrame,g=l(x,i??{}),p=[];for(let c=0;c<x.fields.length;c++){const y=x.fields[c];y.values[u.rowIndex]!=null&&(y.config.custom?.hidden||(y.config.links&&y.config.links.length>0||g.has(c))&&p.push({...y,index:c}))}return p}},46072:(ee,B,e)=>{"use strict";e.d(B,{nC:()=>x,ww:()=>g,Os:()=>p});var t=e(10279),n=e(95004),r=e(39443);function o(c,y){const P=c.labels;if(P!==void 0){const d=new Array(y);return d.fill(P),d}else return null}function s(c,y,P){const d=c.getFieldByName("labels");if(d!==void 0&&d.type===n.PU.other){const D=d.values.map(x);return[d,()=>D]}else return[null,()=>o(y,P.length)]}function m(c){const y=new t.L(c),P=y.getFirstFieldOfType(n.PU.time),d=y.getFirstFieldOfType(n.PU.string);if(P===void 0||d===void 0)return null;const D=y.getFieldByName("tsNs")??null,b=y.getFieldByName("level")??y.getFieldByName("detected_level")??null,E=y.getFieldByName("id")??null,[v,C]=s(y,d,c),S=y.fields.filter((O,I)=>I!==P.index&&I!==d.index&&I!==D?.index&&I!==b?.index&&I!==E?.index&&I!==v?.index);return{timeField:P,bodyField:d,timeNanosecondField:D,severityField:b,idField:E,getLogFrameLabels:C,getLogFrameLabelsAsLabels:C,getLabelFieldName:()=>v?.name??null,extraFields:S}}function a(c,y,P){const d=c.getFieldByName(y);if(d!==void 0)return d.type===P?d:void 0}const l="timestamp",f="body",h="severity",u="id",i="labels";function x(c){let y=!1;for(const P in c)if(typeof c[P]!="string"){y=!0;break}if(y){let P={};for(const d in c){const D=c[d];
287P[d]=typeof D=="string"?D:JSON.stringify(D)}return P}return c}function g(c){const y=new t.L(c),P=a(y,l,n.PU.time),d=a(y,f,n.PU.string);if(P===void 0||d===void 0)return null;const D=a(y,h,n.PU.string)??null,b=a(y,u,n.PU.string)??null,E=a(y,i,n.PU.other)??null,v=E===null?null:E.values,C=y.fields.filter((S,O)=>O!==P.index&&O!==d.index&&O!==D?.index&&O!==b?.index&&O!==E?.index);return{timeField:P,bodyField:d,severityField:D,idField:b,getLogFrameLabels:()=>v,timeNanosecondField:null,getLogFrameLabelsAsLabels:()=>v!==null?v.map(x):null,getLabelFieldName:()=>E!==null?E.name:null,extraFields:C}}function p(c){return c.meta?.type===r.m.LogLines?g(c):m(c)}},37234:(ee,B,e)=>{"use strict";e.d(B,{yR:()=>I,cZ:()=>R,HT:()=>M,M0:()=>j,ct:()=>V,f8:()=>ae,J9:()=>U,Wr:()=>se,sg:()=>X});var t=e(88838),n=e(2543),r=e(88483),o=e(50832),s=e(65474),m=e(67770),a=e(739),l=e(41119),f=e(10279),h=e(95004),u=e(64394),i=e(25229),x=e(71642),g=e(63704),p=e(80011),c=e(17548),y=e(28105),P=e(50204),d=e(43173),D=e(8255),b=e(65642);function E(ie,fe){return b.Ay.bootData?.user?.lightTheme?fe:ie}var v=e(12282),C=e(46072),S=e(74746);const O="Line limit",I="Common labels",R={[m.$b.critical]:D.Tj[7],[m.$b.error]:D.Tj[4],[m.$b.warning]:D.Tj[1],[m.$b.info]:D.Tj[0],[m.$b.debug]:D.Tj[5],[m.$b.trace]:D.Tj[2],[m.$b.unknown]:E("#8e8e8e","#bdc4cd")},T=1,L=1e3*T,K=60*L,A=60*K,W=24*A,N=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-6]\d[,\.]\d+([+-][0-2]\d:[0-5]\d|Z)/g;function w(ie,fe,pe){switch(pe){case a.fY.exact:return ie.entry.replace(N,"")===fe.entry.replace(N,"");case a.fY.numbers:return ie.entry.replace(/\d/g,"")===fe.entry.replace(/\d/g,"");case a.fY.signature:return ie.entry.replace(/\w/g,"")===fe.entry.replace(/\w/g,"");default:return!1}}function j(ie,fe){return fe===a.fY.none?ie:ie.reduce((pe,de,le)=>{const me=pe[pe.length-1];return le>0&&w(de,me,fe)?me.duplicates++:pe.push({...de,duplicates:0}),pe},[])}function V(ie,fe){return fe.size===0?ie:ie.filter(pe=>!fe.has(pe.logLevel))}function U(ie,fe){const pe={},de=[];for(const le of ie){let me=pe[le.logLevel];me||(pe[le.logLevel]=me={lastTs:null,datapoints:[],target:le.logLevel,color:R[le.logLevel]},de.push(me));const De=Math.floor(le.timeEpochMs/fe)*fe;De===me.lastTs?me.datapoints[me.datapoints.length-1][0]++:(me.datapoints.push([1,De]),me.lastTs=De);for(const Te of de)Te!==me&&Te.lastTs!==De&&(Te.datapoints.push([0,De]),Te.lastTs=De)}return de.map((le,me)=>{le.datapoints.sort((Ce,He)=>Ce[1]-He[1]);const De=(0,l.Vc)(le),Ne=new f.L(De).getFirstFieldOfType(h.PU.number);return De.fields[Ne.index].config.min=0,De.fields[Ne.index].config.decimals=0,De.fields[Ne.index].config.color={mode:u.Y.Fixed,fixedColor:le.color},De.fields[Ne.index].config.custom={drawStyle:a.GR.Bars,barAlignment:a.Nj.Center,barWidthFactor:.9,barMaxWidth:5,lineColor:le.color,pointColor:le.color,fillColor:le.color,lineWidth:0,fillOpacity:100,stacking:{mode:a.gs.Normal,group:"A"}},De})}function F(ie){return ie.fields.some(fe=>fe.type===h.PU.time)&&ie.fields.some(fe=>fe.type===h.PU.string)}function M(ie,fe,pe,de,le){const{logSeries:me}=_(ie),De=ne(me,de,!!le);if(De){if(De.queries=de,fe&&De.rows.length>0){const Te=De.rows.sort(S.M1),{visibleRange:Ne,bucketSize:Ce,visibleRangeMs:He,requestedRangeMs:ke}=H(Te,fe,pe);De.visibleRange=Ne,De.bucketSize=Ce,De.series=U(Te,Ce),De.meta&&(De.meta=te(De,He,ke))}else De.series=[];return De}return{hasUniqueLabels:!1,rows:[],meta:[],series:[],queries:de}}function H(ie,fe,pe,de=20,le=1e3){let me=pe,De=fe,Te=Math.max(De*de,le),Ne,Ce;if(pe){const He=ie[0].timeEpochMs,ke=ie[ie.length-1].timeEpochMs,Me=He<ke?He:ke,$e=pe.to-Me;if(Ce=pe.to-pe.from,Ne=Math.abs(He-ke),Ne>0){const tt=$e/Ce;De*=tt,Te=Math.max(Math.ceil(De*de),le),me={from:Math.floor(Me/Te)*Te,to:pe.to}}else Ne=1}return{bucketSize:Te,visibleRange:me,visibleRangeMs:Ne,requestedRangeMs:Ce}}function _(ie){const fe=[],pe=[];for(const de of ie){if(F(de)||!de.fields.length){pe.push(de);continue}de.length>0&&fe.push(de)}return{logSeries:pe,metricSeries:fe}}function Z(ie,fe,pe){const de=ie.values[pe],me=(0,i.yT)(de).valueOf();if(fe)return{ts:de,timeEpochMs:me,timeEpochNs:fe.values[pe]};if(ie.nanos!==void 0){const De=ie.nanos[pe].toString().padStart(6,"0"),Te=`${me}${De}`;return{ts:de,timeEpochMs:me,timeEpochNs:Te}}return{ts:de,timeEpochMs:me,timeEpochNs:me+"000000"}}function ne(ie,fe=[],pe=!1){if(ie.length===0)return;const de=[];let le=[];const me=ie.filter(Qe=>Qe.fields.length);me.length&&me.forEach(Qe=>{const je=(0,C.Os)(Qe);if(je!=null){const ze=je.getLogFrameLabelsAsLabels()??void 0,Ye={rawFrame:Qe,logsFrame:je,frameLabels:ze};le.push(Ye),ze&&ze.length>0&&de.push(ze)}});const De=de.flat(),Te=De.length>0?(0,x.yO)(De):{};let Ne=[],Ce=!1;const He=(0,S.kA)();for(const Qe of le){const{logsFrame:je,rawFrame:ze,frameLabels:Ye}=Qe,{timeField:Ge,timeNanosecondField:ce,bodyField:Pe,severityField:Se,idField:Ee}=je;for(let xe=0;xe<ze.length;xe++){const{ts:ye,timeEpochMs:Oe,timeEpochNs:we}=Z(Ge,ce??void 0,xe),Be=Pe.values[xe]??"",Xe=typeof Be=="string"?Be:JSON.stringify(Be),st=g.sQ.hasA
287nsiCodes(Xe),lt=!!Xe.match(/\\n|\\t|\\r/),Et=ze.meta?.custom?.searchWords??ze.meta?.searchWords??[],Tt=st?t.Ay.strip(Xe):Xe,Mt=Ye?.[xe],wt=(0,x.s6)(Mt,Te);Object.keys(wt).length>0&&(Ce=!0);let _e=m.$b.unknown;const xt=Se&&Se.values[xe]||(Mt?.level??Mt?.detected_level);typeof xt=="number"||typeof xt=="string"?_e=(0,S.EK)(xt):_e=(0,S.XM)(Tt);const At=fe.find(Xt=>Xt.refId===ze.refId)?.datasource?.type,bt={entryFieldIndex:Pe.index,rowIndex:xe,dataFrame:ze,logLevel:_e,timeFromNow:(0,p.fq)(ye),timeEpochMs:Oe,timeEpochNs:we,timeLocal:(0,p.LE)(ye,{timeZone:"browser"}),timeUtc:(0,p.LE)(ye,{timeZone:"utc"}),uniqueLabels:wt,hasAnsi:st,hasUnescapedContent:lt,searchWords:Et,entry:Tt,raw:Xe,labels:Mt||{},uid:`${ze.refId}_${Ee?Ee.values[xe]:xe.toString()}`,datasourceType:At};Ee!==null&&(bt.rowId=Ee.values[xe]),!(pe&&He(bt))&&Ne.push(bt)}}const ke=[],$e=ie.filter(Qe=>Qe?.meta?.custom?.limit??Qe?.meta?.limit).reduce((Qe,je)=>(Qe[je.refId??""]=je.meta?.custom?.limit??je.meta?.limit??0,Qe),{}),tt=Object.values($e).reduce((Qe,je)=>Qe+=je,0);tt>0&&ke.push({label:O,value:tt,kind:m.tG.Number});let Ke=0;const Re={};let Ve=!1;for(const Qe of ie){const je=Qe.meta?.custom?.lokiQueryStatKey,{refId:ze}=Qe;if(!Ve&&Qe.meta?.custom?.error&&(ke.push({label:"",value:Qe.meta?.custom.error,kind:m.tG.Error}),Ve=!0),ze&&!Re[ze]){if(je&&Qe.meta?.stats){const Ye=Qe.meta.stats.find(Ge=>Ge.displayName===je);Ye&&(Ke+=Ye.value)}Re[ze]=!0}}if(Ke>0){const{text:Qe,suffix:je}=(0,P.rT)("B")(Ke);ke.push({label:"Total bytes processed",value:`${Qe} ${je}`,kind:m.tG.String})}return(0,n.size)(Te)>0&&ke.push({label:I,value:Te,kind:m.tG.LabelsMap}),{hasUniqueLabels:Ce,meta:ke,rows:Ne}}function te(ie,fe,pe){if(!ie.meta)return[];let de=[...ie.meta];const le=de.findIndex(De=>De.label===O),me=le>=0&&de[le]?.value;if(me&&typeof me=="number"&&me>0){let De;if(me===ie.rows.length&&fe&&pe){if(De=`${me} reached`,!ie.queries?.some(Ne=>"direction"in Ne&&Ne.direction===v.ti.Scan)){const Ne=(fe/pe*100).toFixed(2);De=`${me} lines shown \u2014 ${Ne}% (${c.msRangeToTimeString(fe)}) of ${c.msRangeToTimeString(pe)}`}}else{const Te=d.$.featureToggles.logsInfiniteScrolling?"displayed":"returned";De=`${ie.rows.length} ${ie.rows.length>1?"lines":"line"} ${Te}`}de[le]={label:"",value:De,kind:m.tG.String}}return de}function Y(ie,fe){const pe=fe&&ie===m.$b.unknown?"logs":ie,de=R[ie];return{displayNameFromDS:pe,color:{mode:u.Y.Fixed,fixedColor:de},custom:{drawStyle:a.GR.Bars,barAlignment:a.Nj.Center,lineColor:de,pointColor:de,fillColor:de,lineWidth:1,fillOpacity:100,stacking:{mode:a.gs.Normal,group:"A"}}}}const Q=(ie,fe,pe)=>(ie.fields=ie.fields.map(de=>(de.type===h.PU.number&&(de.config={...de.config,...Y(fe(ie),pe)}),de)),ie);function J(ie){let fe;try{fe=new f.L(ie).getFirstFieldOfType(h.PU.number)}catch{}return fe?.labels?q(fe.labels):m.$b.unknown}function q(ie){const fe=ie.level??ie.detected_level??ie.lvl??ie.loglevel??"";return fe?(0,S.EK)(fe):m.$b.unknown}function X(ie,fe,pe){const de=fe.range,le=pe.targets,me=J,De=de.to.valueOf()-de.from.valueOf(),Te=oe(fe.scopedVars,De);return fe.interval=Te.interval,fe.scopedVars.__interval={value:Te.interval,text:Te.interval},Te.intervalMs!==void 0&&(fe.intervalMs=Te.intervalMs,fe.scopedVars.__interval_ms={value:Te.intervalMs,text:Te.intervalMs}),fe.hideFromInspector=!0,new r.c(Ne=>{let Ce=[];Ne.next({state:y.Gu.Loading,error:void 0,data:[]});const He=ie.query(fe),Me=((0,o.A)(He)?He:(0,s.H)(He)).subscribe({complete:()=>{Ne.complete()},next:$e=>{const{error:tt}=$e;if(tt!==void 0)Ne.next({state:y.Gu.Error,error:tt,data:$e.data}),Ne.error(tt);else{const Ke=(0,n.groupBy)($e.data,"refId");Ce=$e.data.map(Re=>{if(Re.meta?.dataTopic===a.QR.Annotations)return Re;let Ve=Re.refId||"";Ve.startsWith("log-volume-")&&(Ve=Ve.substr(11));const Qe={logsVolumeType:m.Aj.FullRange,absoluteRange:{from:de.from.valueOf(),to:de.to.valueOf()},datasourceName:ie.name,sourceQuery:le.find(je=>je.refId===Ve)};return Re.meta={...Re.meta,custom:{...Re.meta?.custom,...Qe}},Q(Re,me,Ke[Re.refId].length===1)}),Ne.next({state:$e.state,error:void 0,data:Ce})}},error:$e=>{Ne.next({state:y.Gu.Error,error:$e,data:[]}),Ne.error($e)}});return()=>{Me?.unsubscribe()}})}function se(ie,fe){return fe.hideFromInspector=!0,new r.c(pe=>{let de=[];pe.next({state:y.Gu.Loading,error:void 0,data:[]});const le=ie.query(fe),De=((0,o.A)(le)?le:(0,s.H)(le)).subscribe({complete:()=>{pe.next({state:y.Gu.Done,error:void 0,data:de}),pe.complete()},next:Te=>{const{error:Ne}=Te;Ne!==void 0?(pe.next({state:y.Gu.Error,error:Ne,data:[]}),pe.error(Ne)):de=Te.data.map(Ce=>{const He=(0,l.Vc)(Ce),{timeIndex:ke}=(0,l.KR)(He);return(0,l.ES)(He,ke)})},error:Te=>{pe.next({state:y.Gu.Error,error:Te,data:[]}),pe.error(Te)}});return()=>{De?.unsubscribe()}})}function oe(ie,fe){if(ie.__interval_ms){let pe=ie.__interval_ms.value,de="";return fe<L*5?(pe=T,de="1ms"):pe>A?(pe=W,de="1d"):pe>K?(pe=A,de="1h"):pe>L?(pe=K,de="1m"):(pe=L,de="1s"),{interval:de,intervalMs:pe}}else return{interval:"$__interval"}}function ae(ie){const fe=ie.dataFrame;return fe.length===0||fe.length<=ie.rowIndex?null:(0,l.EI)({fields:fe.fields.map(de=>({...de,values:[de.values[ie.rowIndex]]})),refId:fe.refId})}},74746:(ee,B,e)=>{"use strict";e.d(B,{Ck:()=>se,Dk:()=>
287H,Dm:()=>F,Dx:()=>V,EK:()=>S,Ei:()=>W,Hw:()=>w,K7:()=>ie,M1:()=>T,PO:()=>X,R:()=>_,Tj:()=>O,Vu:()=>oe,XM:()=>C,a8:()=>ne,dO:()=>Q,e3:()=>M,kA:()=>te,oR:()=>A,oT:()=>U,qR:()=>N,s:()=>ae,s2:()=>I,tX:()=>Z,zy:()=>K});var t=e(4213),n=e.n(t),r=e(2543),o=e.n(r),s=e(75505),m=e(81160),a=e(67770),l=e(739),f=e(25229),h=e(18700),u=e(95004),i=e(5556),x=e(92138),g=e(22592),p=e(10279),c=e(16515),y=e(80011),P=e(2197),d=e(41119),D=e(65642),b=e(67155),E=e(54334),v=e(62215);function C(pe){if(!pe)return a.$b.unknown;let de=a.$b.unknown,le;for(const[me,De]of Object.entries(a.$b)){const Ne=new RegExp(`\\b${me}\\b`,"i").exec(pe);Ne&&(le===void 0||Ne.index<le)&&(de=De,le=Ne.index)}return de}function S(pe){const de=a.$b[pe.toString().toLowerCase()];if(de)return de;if(typeof pe=="string"){const le=parseInt(pe,10);if(pe.length===le.toString().length)return a.s5[pe]||a.$b.unknown}else if(typeof pe=="number")return a.s5[pe]||a.$b.unknown;return a.$b.unknown}function O(pe,de){const le=pe.filter(Te=>Te.labels[de]!==void 0),me=le.length,De=(0,r.countBy)(le,Te=>Te.labels[de]);return R(De,me)}function I(pe){const de=pe.filter(me=>me!=null),le=(0,r.countBy)(de);return R(le,de.length)}const R=(pe,de)=>(0,r.chain)(pe).map((le,me)=>({count:le,value:me,proportion:le/de})).sortBy("count").reverse().value(),T=(pe,de)=>pe.timeEpochMs<de.timeEpochMs?-1:pe.timeEpochMs>de.timeEpochMs?1:pe.timeEpochNs<de.timeEpochNs?-1:pe.timeEpochNs>de.timeEpochNs?1:0,L=(pe,de)=>pe.timeEpochMs>de.timeEpochMs?-1:pe.timeEpochMs<de.timeEpochMs?1:pe.timeEpochNs>de.timeEpochNs?-1:pe.timeEpochNs<de.timeEpochNs?1:0,K=(pe,de)=>{const le=pe?A(pe.rows,de):[];return pe?{...pe,rows:le}:{hasUniqueLabels:!1,rows:le}},A=(pe,de)=>de===l.uH.Ascending?pe.sort(T):pe.sort(L),W=pe=>pe.labels.__error__,N=pe=>{if(pe.labels.__adaptive_logs_sampled__)return pe.labels.__adaptive_logs_sampled__==="true"?"Logs like this one have been dropped by Adaptive Logs":`${pe.labels.__adaptive_logs_sampled__}% of logs like this one have been dropped by Adaptive Logs`},w=pe=>pe.replace(/\\r\\n|\\n|\\t|\\r/g,de=>de.slice(1)==="t"?" ":` 288`);function j(pe){return pe.map(de=>{const le=(0,v.FE)(de).reduce((me,De)=>{const Te=De.keys[0];return me[Te]=De.values[0],me},{});return{line:de.entry,timestamp:de.timeEpochNs,date:(0,f.KQ)(de.timeEpochMs).toISOString(),fields:{...le,...de.labels}}})}const V=pe=>{let de={from:1/0,to:-1/0};return pe.forEach(le=>{const me=le.meta?.custom||{};me.absoluteRange?.from&&me.absoluteRange?.to&&(de={from:Math.min(de.from,me.absoluteRange.from),to:Math.max(de.to,me.absoluteRange.to)})}),de},U=pe=>{if(pe.length===0)throw new Error("Cannot aggregate data frames: there must be at least one data frame to aggregate");const de={},le={};let me=-1/0;const De={};let Te=[];return pe.forEach(Ne=>{const{level:Ce,valueField:He,timeField:ke}=Z(Ne,pe);if(!(!ke||!He)){De[Ce]={meta:Ne.meta,valueFieldConfig:He?.config??{},timeFieldConfig:ke?.config??{}};for(let Me=0;Me<Ne.length;Me++){const $e=ke.values[Me],tt=He.values[Me];de[Ce]??={},de[Ce][$e]=(de[Ce][$e]||0)+tt,le[$e]=(le[$e]||0)+tt,le[$e]>me&&(me=le[$e])}}}),Object.keys(de).forEach(Ne=>{const Ce=new h.k,{meta:He,timeFieldConfig:ke,valueFieldConfig:Me}=De[Ne];Ce.name=Ne,Ce.meta=He,Ce.addField({name:"Time",type:u.PU.time,config:ke}),Ce.addField({name:"Value",type:u.PU.number,config:Me}),Object.entries(de[Ne]).sort(($e,tt)=>Number($e[0])-Number(tt[0])).forEach(([$e,tt])=>{Ce.add({Time:Number($e),Value:tt})}),Te.push(Ce)}),{dataFrames:Te,maximum:me}},F=pe=>{const de=pe[0]?.meta?.custom;return de&&de.datasourceName?{name:de.datasourceName}:null},M=pe=>pe[0]?.meta?.custom?.logsVolumeType===a.Aj.Limited,H=async(pe,de)=>{if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(pe);{const le=document.createElement("textarea");de.current?.appendChild(le),le.value=pe,le.focus(),le.select(),document.execCommand("copy"),le.remove()}};async function _(pe,de,le,me){if(le&&(pe.nativeEvent.ctrlKey||pe.nativeEvent.metaKey||pe.nativeEvent.shiftKey)){const De=window.open("about:blank"),Te=await le(de,void 0,!1);if(Te&&De){const Ne=i.kM.renderUrl(x.I.assureBaseUrl(`${(0,D.zj)().appSubUrl}explore`),{left:JSON.stringify({datasource:Te.datasource,queries:[Te],range:(0,g.E2)()})});De.location=Ne;return}De?.close()}me(de)}function Z(pe,de){const le=new p.L(pe),me=le.getFirstFieldOfType(u.PU.time),De=le.getFirstFieldOfType(u.PU.number);return me||console.error("Time field missing in data frame"),De||console.error("Value field missing in data frame"),{level:De?(0,c.Ct)(De,pe,de):"logs",valueField:De,timeField:me}}function ne(pe){return pe instanceof Element}function te(){const pe=new Set;return function(de){let le=`${de.dataFrame.refId}_${de.rowId?de.rowId:`${de.timeEpochNs}_${de.entry}`}`;return pe.has(le)?!0:(pe.add(le),!1)}}function Y(pe,de,le){const me=de.fields.find(De=>De.name==="labelTypes")?.values[le];return me?me[pe]??null:null}function Q(pe,de){if(!de.datasourceType)return null;const le=de.dataFrame.fields.find(Te=>Te.name==="id");if(!le)return null;const me=le.values.findIndex(Te=>Te===de.rowId);if(me<0)return null;const De=Y(pe,de.dataFrame,me);return De?J(De,de.datasourceType):null}function J(pe,de){switch(de){case"loki":switch(pe){case"I":return"Indexed label";case"S":return"Structured metadata";case"P":return"Parsed label";default:return null}default:return null}}const q="logs.popover.disabled";function X(){localStorage.setItem(q,"true")}function se(){localStorage.removeItem(q)}function oe(){return!!localStorage.getItem(q)}var ae=(pe=>(pe.Text="text",pe.Json="json",pe.CSV="csv",pe))(ae||{});const ie=async(pe,de,le)=>{switch(pe){case"text":(0,E.Zy)({meta:le,rows:de});break;case"json":const me=j(de),De=new Blob([JSON.stringify(me)],{type:"application/json;charset=utf-8"}),Te=`Logs-${(0,y.LE)(new Date)}.json`;n()(De,Te);break;case"csv":const Ne=new Map;de.forEach(Ce=>{Ce.dataFrame?.refId&&!Ne.has(Ce.dataFrame?.refId)&&Ne.set(Ce.dataFrame?.refId,Ce.dataFrame)}),Ne.forEach(async Ce=>{const He=(0,b.v)(Ce);He.push({id:"organize",options:{excludeByName:{labels:!0,labelTypes:!0}}},fe);const ke=await(0,s.s)((0,P.m)(He,[Ce]));(0,E.EM)(ke[0],`Logs-${Ce.refId}`)})}},fe=()=>pe=>pe.pipe((0,m.T)(de=>de.map(le=>{const me=(0,d.KR)(le),De={name:"Date",values:me.timeField?me.timeField?.values.map(Te=>(0,f.KQ)(Te).toISOString()):[],type:u.PU.other,config:{}};return{...le,fields:[De,...le.fields]}})))},61730:(ee,B,e)=>{"use strict";e.d(B,{m:()=>l});var t=e(74848),n=e(22803),r=e(43173),o=e(63142),s=e(71599),m=e(56840);const a=()=>{const h=(0,o.of)(f);return(0,t.jsx)("p",{className:h.description,children:r.$.featureToggles.newDashboardSharingComponent?(0,m.t)("shared-dashboard.delete-modal.revoke-body-text","Are you sure you want to revoke this access? The dashboard can no longer be shared."):(0,m.t)("public-dashboard.delete-modal.revoke-body-text","Are you sure you want to revoke this URL? The dashboard will no longer be public.")})},l=({onConfirm:h,onDismiss:u})=>{const i=r.$.featureToggles.newDashboardSharingComponent?(0,m.t)("shared-dashboard.delete-modal.revoke-title","Revoke access"):(0,m.t)("public-dashboard.delete-modal.revoke-title","Revoke public URL");return(0,t.jsx)(s.u,{isOpen:!0,body:(0,t.jsx)(a,{}),onConfirm:h,onDismiss:u,title:i,icon:"trash-alt",confirmText:i})},f=h=>({title:(0,n.css)({marginBottom:h.spacing(1)}),description:(0,n.css)({fontSize:h.typography.body.fontSize})})},89223:(ee,B,e)=>{"use strict";e.d(B,{P:()=>o});var t=e(55860);
288class n extends Error{constructor(m,a){super(a),this.type=m}}class r{constructor(){this.rootName="general"}validateNewDashboardName(m,a){return this.validate(m,a,"A dashboard or a folder with the same name already exists")}validateNewFolderName(m){return this.validate(this.rootName,m,"A folder or dashboard in the general folder with the same name already exists")}async validate(m,a,l){a=(a||"").trim();const f=a.toLowerCase();if(a.length===0)throw new n("REQUIRED","Name is required");if(f===this.rootName)throw new n("EXISTING","This is a reserved name and cannot be used for a folder.");const u=await(0,t.S)().search({kind:["dashboard"],query:a,location:m||"general"});for(const i of u.view)if(f===i.name.toLowerCase())throw new n("EXISTING",l)}}const o=new r},74755:(ee,B,e)=>{"use strict";e.d(B,{FG:()=>E,Q9:()=>v,Ql:()=>T,S7:()=>x,c0:()=>R,iP:()=>i,rw:()=>u,vV:()=>O});var t=e(68143),n=e(78282),r=e(6890),o=e(64762),s=e(15203),m=e(28998),a=e(96673),l=e(30124),f=e(97583),h=e(2559);function u(K){return async A=>{try{A((0,h.f7)());const W=await(0,t.AI)().get(`/api/gnet/dashboards/${K}`);await A(d(W.json)),await A(c(W)),A(P())}catch(W){A((0,h.oQ)()),(0,t.NF)(W)&&A((0,r.dx)((0,o.gi)(W.data.message||W)))}}}function i(K){return async A=>{await A(d(K)),await A(y(K)),A(P())}}function x(K){return async A=>{A((0,h.dd)(K)),A(D(K))}}const g=(K,A)=>K?.usage?.libraryPanels?.filter(W=>A.inputs.libraryPanels.some(N=>N.state!==h.J7.Exists&&N.model.uid===W.uid));function p(K,A){let W=K.__inputs;if(A.inputs.libraryPanels?.length){const N=[];K.__inputs?.forEach(w=>{if(!w?.usage?.libraryPanels){N.push(w);return}const j=g(w,A);w.usage={libraryPanels:j},!!j?.length&&N.push(w)}),W=N}return{...K,__inputs:W}}function c(K){return(A,W)=>{const N=W().importDashboard,w=p(K.json,N);A((0,h.Rp)({...K,json:w}))}}function y(K){return(A,W)=>{const N=W().importDashboard,w=p(K,N);A((0,h.dd)(w))}}function P(){return(K,A)=>{const W=A().importDashboard.dashboard;if(W&&W.__inputs){const N=[];W.__inputs.forEach(w=>{const j={name:w.name,label:w.label,info:w.description,value:w.value,type:w.type,pluginId:w.pluginId,options:[]};j.description=S(w),w.type===h.NZ.DataSource?C(w,j):j.info||(j.info="Specify a string constant"),N.push(j)}),K((0,h.y3)(N))}}}function d(K){return async function(A){const W=await b(K);A((0,h.dW)(W))}}function D(K){return async function(A){const{elements:W,variables:N,annotations:w}=K;let j={};for(const V of Object.values(W)){if(V.kind!=="Panel")throw new Error("Only panels are currenlty supported in v2 dashboards");if(V.spec.data.spec.queries.length>0)for(const U of V.spec.data.spec.queries)j=await L(U.spec,j)}for(const V of N)V.kind==="QueryVariable"&&(j=await L(V.spec,j));for(const V of w)j=await L(V.spec,j);A((0,h.y3)(Object.values(j)))}}async function b(K){if(!K||!K.__elements)return[];const A=[];for(const W of Object.values(K.__elements)){if(W.kind!==f.i.Panel)continue;const N=W.model,{type:w,description:j}=N,{uid:V,name:U}=W,F={model:{model:N,uid:V,name:U,version:0,type:w,kind:f.i.Panel,description:j},state:h.J7.New};try{const M=await(0,l.Yr)(V,!0);F.state=h.J7.Exists,F.model=M}
288catch(M){if(M.status!==404)throw M}A.push(F)}return A}function E(){return K=>{K((0,h.SN)())}}function v(K){return async(A,W)=>{const N=W().importDashboard.dashboard,w=W().importDashboard.inputs,j=[];K.dataSources?.forEach((V,U)=>{const F=w.dataSources[U];j.push({name:F.name,type:F.type,pluginId:F.pluginId,value:V.uid})}),K.constants?.forEach((V,U)=>{const F=w.constants[U];j.push({value:V,name:F.name,type:F.type})}),A(s.cU.endpoints.importDashboard.initiate({dashboard:{...N,title:K.title,uid:K.uid||N.uid},overwrite:!0,inputs:j,folderUid:K.folder.uid}))}}const C=(K,A)=>{(0,n.l)().getList({pluginId:K.pluginId}).length===0?A.info="No data sources of type "+K.pluginName+" found":A.info||(A.info="Select a "+K.pluginName+" data source")},S=K=>{if(K.usage&&K.usage.libraryPanels)return`List of affected library panels: ${K.usage.libraryPanels.reduce((W,N,w)=>w===0?N.name:`${W}, ${N.name}`,"")}`};function O(K){return(0,t.AI)().post("/api/folders",K)}const I=1e3;async function R(K,A,W=a.SearchQueryType.Folder){return(0,t.AI)().get("/api/search",{query:K,type:W,permission:A,limit:I})}function T(K){return(0,t.AI)().get(`/api/folders/${K}`)}async function L(K,A={}){if(!K?.datasource&&K?.query){const N=K.query.kind;if(N==="grafana"||N==="datasource")return A;const w=await(0,m.tR)().get({type:N});let j;w?(j={name:w.name,label:w.name,info:`Select a ${w.name} data source`,value:w.uid,type:h.NZ.DataSource,pluginId:w.meta?.id},A[w.meta?.id]=j):(j={name:N,label:N,info:`No data sources of type ${N} found`,value:"",type:h.NZ.DataSource,pluginId:N},A[N]=j)}return A}},2559:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>c,J7:()=>s,NZ:()=>o,Rp:()=>h,SN:()=>l,V9:()=>m,dW:()=>i,dd:()=>u,f7:()=>g,oQ:()=>x,qx:()=>r,y3:()=>f});var t=e(65307),n=e(28105),r=(y=>(y[y.Gcom=0]="Gcom",y[y.Json=1]="Json",y))(r||{}),o=(y=>(y.DataSource="datasource",y.Constant="constant",y.LibraryPanel="libraryPanel",y))(o||{}),s=(y=>(y.New="new",y.Exists="exists",y.Different="different",y))(s||{});const m={meta:{updatedAt:"",orgName:""},dashboard:{},source:1,inputs:{},state:n.Gu.NotStarted},a=(0,t.Z0)({name:"manageDashboards",initialState:m,reducers:{setGcomDashboard:(y,P)=>{y.dashboard={...P.payload.json,id:null},y.meta={updatedAt:P.payload.updatedAt,orgName:P.payload.orgName},y.source=0,y.state=n.Gu.Done},setJsonDashboard:(y,P)=>{y.dashboard={...P.payload,id:null},y.meta=m.meta,y.source=1,y.state=n.Gu.Done},clearDashboard:y=>{y.dashboard={},y.state=n.Gu.NotStarted},setInputs:(y,P)=>{y.inputs={dataSources:P.payload.filter(d=>d.type==="datasource"),constants:P.payload.filter(d=>d.type==="constant"),libraryPanels:y.inputs.libraryPanels||[]}},setLibraryPanelInputs:(y,P)=>{y.inputs.libraryPanels=P.payload},fetchFailed:y=>{y.dashboard={},y.state=n.Gu.Error},fetchDashboard:y=>{y.state=n.Gu.Loading}}}),{clearDashboard:l,setInputs:f,setGcomDashboard:h,setJsonDashboard:u,setLibraryPanelInputs:i,fetchFailed:x,fetchDashboard:g}=a.actions,c={importDashboard:a.reducer}},2495:(ee,B,e)=>{"use strict";e.d(B,{O5:()=>b,r3:()=>i,dX:()=>y,hZ:()=>a,ri:()=>h,WH:()=>P,AC:()=>l,YX:()=>c,bM:()=>d,A_:()=>D,u:()=>v,D0:()=>p,SM:()=>m,M8:()=>g,YD:()=>u,aD:()=>x});var t=e(59253),n=e(73892),r=e(75816);const s=(0,r.xP)({reducerPath:"migrateToCloudGeneratedAPI",baseQuery:(0,n.W)({baseURL:"/api"}),endpoints:()=>({})}).injectEndpoints({endpoints:C=>({getSessionList:C.query({query:()=>({url:"/cloudmigration/migration"})}),createSession:C.mutation({query:S=>({url:"/cloudmigration/migration",method:"POST",body:S.cloudMigrationSessionRequestDto})}),deleteSession:C.mutation({query:S=>({url:`/cloudmigration/migration/${S.uid}`,method:"DELETE"})}),getSession:C.query({query:S=>({url:`/cloudmigration/migration/${S.uid}`})}),createSnapshot:C.mutation({query:S=>({url:`/cloudmigration/migration/${S.uid}/snapshot`,method:"POST",body:S.createSnapshotRequestDto})}),getSnapshot:C.query({query:S=>({url:`/cloudmigration/migration/${S.uid}/snapshot/${S.snapshotUid}`,params:{resultPage:S.resultPage,resultLimit:S.resultLimit,resultSortColumn:S.resultSortColumn,resultSortOrder:S.resultSortOrder,errorsOnly:S.errorsOnly}})}),cancelSnapshot:C.mutation({query:S=>({url:`/cloudmigration/migration/${S.uid}/snapshot/${S.snapshotUid}/cancel`,method:"POST"})}
288),uploadSnapshot:C.mutation({query:S=>({url:`/cloudmigration/migration/${S.uid}/snapshot/${S.snapshotUid}/upload`,method:"POST"})}),getShapshotList:C.query({query:S=>({url:`/cloudmigration/migration/${S.uid}/snapshots`,params:{page:S.page,limit:S.limit,sort:S.sort}})}),getResourceDependencies:C.query({query:()=>({url:"/cloudmigration/resources/dependencies"})}),getCloudMigrationToken:C.query({query:()=>({url:"/cloudmigration/token"})}),createCloudMigrationToken:C.mutation({query:()=>({url:"/cloudmigration/token",method:"POST"})}),deleteCloudMigrationToken:C.mutation({query:S=>({url:`/cloudmigration/token/${S.uid}`,method:"DELETE"})}),getDashboardByUid:C.query({query:S=>({url:`/dashboards/uid/${S.uid}`})}),getLibraryElementByUid:C.query({query:S=>({url:`/library-elements/${S.libraryElementUid}`})})}),overrideExisting:!1}),{useGetSessionListQuery:m,useCreateSessionMutation:a,useDeleteSessionMutation:l,useGetSessionQuery:f,useCreateSnapshotMutation:h,useGetSnapshotQuery:u,useCancelSnapshotMutation:i,useUploadSnapshotMutation:x,useGetShapshotListQuery:g,useGetResourceDependenciesQuery:p,useGetCloudMigrationTokenQuery:c,useCreateCloudMigrationTokenMutation:y,useDeleteCloudMigrationTokenMutation:P,useGetDashboardByUidQuery:d,useGetLibraryElementByUidQuery:D}=s,b=s.injectEndpoints({endpoints:C=>({getLocalPluginList:C.query({queryFn:async()=>{try{return{data:await(0,t.Gd)()}}catch(S){return(0,n.s)(S)}}})})}).enhanceEndpoints({addTagTypes:["cloud-migration-token","cloud-migration-session","cloud-migration-snapshot","cloud-migration-resource-dependencies"],endpoints:{getCloudMigrationToken:{providesTags:["cloud-migration-token"]},createCloudMigrationToken:{invalidatesTags:["cloud-migration-token"]},deleteCloudMigrationToken:{invalidatesTags:["cloud-migration-token"]},getSessionList:{providesTags:["cloud-migration-session"]},getSession:{providesTags:["cloud-migration-session"]},createSession:{invalidatesTags:["cloud-migration-session"]},deleteSession:{invalidatesTags:["cloud-migration-session","cloud-migration-snapshot"]},getShapshotList:{providesTags:["cloud-migration-snapshot"]},getSnapshot:{providesTags:["cloud-migration-snapshot"]},createSnapshot:{invalidatesTags:["cloud-migration-snapshot"]},uploadSnapshot:{invalidatesTags:["cloud-migration-snapshot"]},getResourceDependencies:{providesTags:["cloud-migration-resource-dependencies"]},getDashboardByUid:E,getLibraryElementByUid:E,getLocalPluginList:E}});function E(C){if(!C.query)return;const S=C.query;C.query=(...O)=>{const I=S(...O);return I.showErrorAlert=!1,I}}const{useGetLocalPluginListQuery:v}=b},93922:(ee,B,e)=>{"use strict";e.d(B,{EC:()=>a,L_:()=>s,YS:()=>o,bA:()=>m,wV:()=>l});var t=e(68143),n=e(6890),r=e(74396);function o(f={getBackendSrv:t.AI}){return async h=>{const u=await f.getBackendSrv().get("/api/org");return h((0,r.bK)(u)),u}}function s(f={getBackendSrv:t.AI}){return async(h,u)=>{const i=u().organization.organization;await f.getBackendSrv().put("/api/org",{name:i.name}),h((0,n.YA)(i.name)),h(o(f))}}function m(f,h={getBackendSrv:t.AI}){return async u=>{const i=await h.getBackendSrv().post("/api/user/using/"+f);u((0,n.YA)(i.name))}}function a(f,h={getBackendSrv:t.AI}){return async u=>{const i=await h.getBackendSrv().post("/api/orgs/",f);u(m(i.orgId))}}function l(f={getBackendSrv:t.AI}){return async h=>{const u=await f.getBackendSrv().get("/api/user/orgs");return h((0,r.Bz)(u)),u}}},74396:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>l,Bz:()=>m,bK:()=>s,n:()=>o});var t=e(65307);const n={organization:{},userOrgs:[]},r=(0,t.Z0)({name:"organization",initialState:n,reducers:{organizationLoaded:(f,h)=>({...f,organization:h.payload}),setOrganizationName:(f,h)=>({...f,organization:{...f.organization,name:h.payload}}),userOrganizationsLoaded:(f,h)=>({...f,userOrgs:h.payload})}}),{setOrganizationName:o,organizationLoaded:s,userOrganizationsLoaded:m}=r.actions,l={organization:r.reducer}},88642:(ee,B,e)=>{"use strict";e.d(B,{a:()=>C});var t=e(74848),n=e(22803),r=e(38919),o=e(1906),s=e(85629),m=e(36490),a=e(56838),l=e(63142),f=e(64400),h=e(96540),u=e(30703);const i=h.forwardRef(({icon:I,children:R,onClick:T,...L},K)=>{const A=(0,l.of)(x);return(0,t.jsxs)("button",{...L,className:A.action,onClick:T,children:[(0,t.jsx)(u.I,{name:I,size:"xl"}),R]})});
288i.displayName="CardButton";const x=I=>({action:(0,n.css)({display:"flex",flexDirection:"column",height:"100%",justifySelf:"center",cursor:"pointer",background:I.colors.background.secondary,borderRadius:I.shape.radius.default,color:I.colors.text.primary,border:"unset",width:"100%",justifyContent:"center",alignItems:"center",textAlign:"center","&:hover":{background:I.colors.emphasize(I.colors.background.secondary)}})});var g=e(95943),p=e(56840),c=e(29043),y=e(42795),P=e(62667),d=e(22429),D=e(39385),b=e(8285),E=e(96673),v=e(87390);function C(I){const R=(0,l.of)(O),T=(0,f.d2)(),L=new r.v2(I.data),{dataSummary:K}=L,A=S(I,K),W=(0,E.useDispatch)(),N=window.__grafanaSceneContext;let w;N instanceof D.H$?w=(0,b.vL)(N,(0,b.XA)(I.panelId)):w=(0,d.UA)().getCurrent()?.getPanelById(I.panelId);const j=()=>{if(c.A.setObject(g.wV,P.__.Suggestions),N){N.state.editPanel?.state.optionsPane?.onToggleVizPicker();return}W((0,y.eK)(!0))},V=()=>{if(w){if(w instanceof a.Eb){w.changePluginType("table");return}W((0,v.gW)({panel:w,pluginId:"table"}))}},U=F=>{w&&(w instanceof a.Eb?w.changePluginType(F.pluginId,F.options,F.fieldConfig):W((0,v.gW)({...F,panel:w})),F.transformations&&setTimeout(()=>{m.Ny.partial({tab:"transform"})},100))};return(0,t.jsxs)("div",{className:R.wrapper,children:[(0,t.jsx)("div",{className:R.message,"data-testid":s.Tp.components.Panels.Panel.PanelDataErrorMessage,children:A}),T.app===o.Jk.PanelEditor&&K.hasData&&w&&(0,t.jsxs)("div",{className:R.actions,children:[I.suggestions&&(0,t.jsx)(t.Fragment,{children:I.suggestions.map(F=>(0,t.jsx)(i,{icon:"process",onClick:()=>U(F),children:F.name},F.name))}),(0,t.jsx)(i,{icon:"table",onClick:V,children:(0,t.jsx)(p.x6,{i18nKey:"panel.panel-data-error-view.switch-to-table",children:"Switch to table"})}),(0,t.jsx)(i,{icon:"chart-line",onClick:j,children:(0,t.jsx)(p.x6,{i18nKey:"panel.panel-data-error-view.open-visualization-suggestions",children:"Open visualization suggestions"})})]})]})}function S({data:I,fieldConfig:R,message:T,needsNumberField:L,needsTimeField:K,needsStringField:A},W){return T||(!I.series||I.series.length===0||I.series.every(N=>N.length===0)?R?.defaults.noValue??"No data":A&&!W.hasStringField?"Data is missing a string field":L&&!W.hasNumberField?"Data is missing a number field":K&&!W.hasTimeField?"Data is missing a time field":"Cannot visualize data")}const O=I=>({wrapper:(0,n.css)({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",width:"100%"}),message:(0,n.css)({textAlign:"center",color:I.colors.text.secondary,fontSize:I.typography.size.lg,width:"100%"}),actions:(0,n.css)({marginTop:I.spacing(2),display:"flex",height:"50%",maxHeight:"150px",columnGap:I.spacing(1),rowGap:I.spacing(1),width:"100%",maxWidth:"600px"})})},41097:(ee,B,e)=>{"use strict";e.d(B,{$:()=>f,W:()=>l});var t=e(74848),n=e(96540),r=e(16207),o=e(11594),s=e(34999),m=e(96673);class a extends n.PureComponent{constructor(u){super(u)}render(){const u={display:"flex",alignItems:"center",justifyContent:"center",height:"100%"};return(0,t.jsx)("div",{style:u,children:(0,t.jsx)(s.F,{severity:m.AppNotificationSeverity.Error,...this.props})})}}function l(h,u){const i=class extends n.PureComponent{render(){const p=(0,t.jsxs)(t.Fragment,{children:["Check the server startup logs for more information. ",(0,t.jsx)("br",{}),"If this plugin was loaded from Git, then make sure it was compiled."]});return(0,t.jsx)(a,{title:`Error loading: ${h.id}`,text:p})}},x=new r.m(i);return x.meta=h,x.loadError=!0,x}function f(h,u){const i=class extends n.PureComponent{render(){return(0,t.jsx)(a,{title:`Panel plugin not found: ${h}`})}},x=new r.m(u?()=>null:i);return x.meta={id:h,name:h,sort:100,type:o.QE.panel,module:"",baseUrl:"",info:{author:{name:""},description:"",links:[],logos:{large:"",small:"public/img/grafana_icon.svg"},screenshots:[],updated:"",version:""}},x}},35307:(ee,B,e)=>{"use strict";e.d(B,{m:()=>p});var t=e(74848),n=e(96540),r=e(60188),o=e(60519),s=e(20877),m=e(69168),a=e(2863),l=e(63142),f=e(64400),h=e(36303),u=e(73427),i=e(56840),x=e(92391);const g={defaults:{},overrides:[]};function p(y){const{pluginId:P,data:d,timeZone:D=(0,r.O)(),options:b={},width:E,height:v,title:C,onOptionsChange:S=()=>{},onChangeTimeRange:O=()=>{},onFieldConfigChange:I=()=>{},fieldConfig:R=g}=y,T=(0,l.$j)(),L=(0,a.w)(),K=(0,n.useMemo)(()=>
288L.replace.bind(L),[L]),[A,W]=(0,n.useState)((0,x.PY)(P)),[N,w]=(0,n.useState)(),j=c(A,b,R),{dataLinkPostProcessor:V}=(0,f.d2)(),U=(0,o.rJ)(A,j?.fieldConfig,d,D,T,K,V);if((0,n.useEffect)(()=>{A&&A.hasPluginId(P)||(0,x.TV)(P).then(M=>W(M)).catch(M=>{w(M.message)})},[P,A]),N)return(0,t.jsxs)("div",{children:["Failed to load plugin: ",N]});if(!A||!A.hasPluginId(P))return(0,t.jsx)("div",{children:(0,t.jsx)(i.x6,{i18nKey:"panel.panel-renderer.loading-plugin-panel",children:"Loading plugin panel..."})});if(!A.panel)return(0,t.jsx)("div",{children:"Seems like the plugin you are trying to load does not have a panel component."});if(!U)return(0,t.jsx)("div",{children:(0,t.jsx)(i.x6,{i18nKey:"panel.panel-renderer.no-panel-data",children:"No panel data"})});const F=A.panel;return(0,t.jsx)(h.Xw,{dependencies:[A,d],children:(0,t.jsx)(s.a,{meta:A.meta,children:(0,t.jsx)(F,{id:1,data:U,title:C,timeRange:U.timeRange,timeZone:D,options:j.options,fieldConfig:R,transparent:!1,width:E,height:v,renderCounter:0,replaceVariables:M=>M,onOptionsChange:S,onFieldConfigChange:I,onChangeTimeRange:O,eventBus:u.lE})})})}function c(y,P,d){return(0,n.useMemo)(()=>{if(y)return(0,m.F)({plugin:y,currentOptions:P,currentFieldConfig:d,isAfterPluginChange:!1})},[y,d,P])}},54044:(ee,B,e)=>{"use strict";e.d(B,{b:()=>c});var t=e(74848),n=e(22803),r=e(70255),o=e(11594),s=e(29246),m=e(85629),a=e(63142),l=e(76319),f=e(63509),h=e(21348),u=e(56840),i=e(85622);const x=38,g=({isCurrent:D,title:b,plugin:E,onClick:v,onDelete:C,disabled:S,showBadge:O,description:I,children:R})=>{const T=(0,a.of)(P),L=S||E.state===o.pn.deprecated,K=(0,n.cx)({[T.item]:!0,[T.itemDisabled]:L,[T.current]:D});return(0,t.jsxs)("div",{className:K,"aria-label":m.Tp.components.PluginVisualization.item(E.name),"data-testid":m.Tp.components.PluginVisualization.item(E.name),onClick:L?void 0:v,title:D?"Click again to close this section":E.name,children:[(0,t.jsx)("img",{className:(0,n.cx)(T.img,{[T.disabled]:L}),src:E.info.logos.small,alt:""}),(0,t.jsxs)("div",{className:(0,n.cx)(T.itemContent,{[T.disabled]:L}),children:[(0,t.jsx)("div",{className:T.name,children:b}),I?(0,t.jsx)("span",{className:T.description,children:I}):null,R]}),O&&(0,t.jsx)("div",{className:(0,n.cx)(T.badge,{[T.disabled]:L}),children:(0,t.jsx)(d,{plugin:E})}),C&&(0,t.jsx)(l.K,{name:"trash-alt",onClick:A=>{A.stopPropagation(),C()},className:T.deleteButton,"aria-label":(0,u.t)("panel.panel-type-card.aria-label-delete-button-on-panel-type-card","Delete button on panel type card"),tooltip:(0,u.t)("panel.panel-type-card.tooltip-delete","Delete")})]})};g.displayName="PanelTypeCard";const p=({children:D,hasDescription:b,hasDelete:E,rootProps:v})=>{const C=(0,a.of)(P),S=(0,a.of)(y);return(0,t.jsxs)("div",{className:C.item,...v,children:[(0,t.jsx)(r.A,{className:(0,n.cx)(C.img,S.image),width:x,height:x}),(0,t.jsxs)("div",{className:C.itemContent,children:[(0,t.jsx)("div",{className:C.name,children:(0,t.jsx)(r.A,{width:160})}),b?(0,t.jsx)(r.A,{containerClassName:C.description,width:80}):null,D]}),E&&(0,t.jsx)(r.A,{containerClassName:(0,n.cx)(C.deleteButton,S.deleteButton),width:16,height:16})]})},c=(0,h.j)(g,p),y=()=>({deleteButton:(0,n.css)({lineHeight:1}),image:(0,n.css)({lineHeight:1})}),P=D=>({item:(0,n.css)({position:"relative",display:"flex",flexShrink:0,cursor:"pointer",background:D.colors.background.secondary,borderRadius:D.shape.radius.default,boxShadow:D.shadows.z1,border:`1px solid ${D.colors.background.secondary}`,alignItems:"center",padding:D.spacing(1),width:"100%",overflow:"hidden",[D.transitions.handleMotion("no-preference","reduce")]:{transition:D.transitions.create(["background"],{duration:D.transitions.duration.short})},"&:hover":{background:D.colors.emphasize(D.colors.background.secondary,.03)}}),itemContent:(0,n.css)({overflow:"hidden",position:"relative",padding:D.spacing(0,1)}),itemDisabled:(0,n.css)({cursor:"default","&, &:hover":{background:D.colors.action.disabledBackground}}),current:(0,n.css)({label:"currentVisualizationItem",border:`1px solid ${D.colors.primary.border}`,background:D.colors.action.selected}),disabled:(0,n.css)({opacity:.6,filter:"grayscale(1)",cursor:"default",pointerEvents:"none"}),name:(0,n.css)({textOverflow:"ellipsis",overflow:"hidden",fontSize:D.typography.size.sm,fontWeight:D.typography.fontWeightMedium,width:"100%"}),description:(0,n.css)({display:"block",textOverflow:"ellipsis",overflow:"hidden",color:D.colors.text.secondary,fontSize:D.typography.bodySmall.fontSize,fontWeight:D.typography.fontWeightLight,width:"100%",maxHeight:"4.5em"}),img:(0,n.css)({maxHeight:x,width:x,display:"flex",alignItems:"center"}),badge:(0,n.css)({background:D.colors.background.primary}),deleteButton:(0,n.css)({cursor:"pointer",marginLeft:"auto"})}),d=({plugin:D})=>(0,s.x)(D.signature)?(0,t.jsx)(f.B,{status:D.signature}):(0,t.jsx)(i.p,{state:D.state});d.displayName="PanelPluginBadge"},82472:(ee,B,e)=>{"use strict";e.d(B,{a:()=>D});var t=e(74848),n=e(22803),r=e(96540),o=e(16817),s=e(70713),m=e(63142),a=e(56840),l=e(38919),f=e(43173),h=e(92391);const u=["timeseries","barchart","gauge","stat","piechart","bargauge","table","state-timeline","status-history","logs","candlestick","flamegraph","traces","nodeGraph"];async function i(v,C){const S=new l.v2(v,C);for(const I of u){const T=(await(0,h.TV)(I)).getSuggestionsSupplier();T&&T.getSuggestionsForData(S)}const O=S.getList();if(S.dataSummary.fieldCount===0)for(const I of Object.values(f.$.panels))!I.skipDataQuery||I.hideFromList||O.push({name:I.name,pluginId:I.id,description:I.info.description,cardOptions:{imgSrc:I.info.logos.small}});return O.sort((I,R)=>
288{if(S.dataSummary.preferredVisualisationType){if(I.pluginId===S.dataSummary.preferredVisualisationType)return-1;if(R.pluginId===S.dataSummary.preferredVisualisationType)return 1}return(R.score??l.nQ.OK)-(I.score??l.nQ.OK)})}var x=e(2543),g=e(85629),p=e(45967),c=e(35307);function y({data:v,suggestion:C,onChange:S,width:O}){const I=(0,m.of)(P),{innerStyles:R,outerStyles:T,renderWidth:L,renderHeight:K}=d(O),A=C.cardOptions??{},W={"aria-label":C.name,className:I.vizBox,"data-testid":g.Tp.components.VisualizationPreview.card(C.name),style:T,onClick:()=>{S({pluginId:C.pluginId,options:C.options,fieldConfig:C.fieldConfig})}};if(A.imgSrc)return(0,t.jsx)(p.m,{content:C.description??C.name,children:(0,t.jsxs)("button",{...W,className:(0,n.cx)(I.vizBox,I.imgBox),children:[(0,t.jsx)("div",{className:I.name,children:C.name}),(0,t.jsx)("img",{className:I.img,src:A.imgSrc,alt:C.name})]})});let N=C;return C.cardOptions?.previewModifier&&(N=(0,x.cloneDeep)(C),C.cardOptions.previewModifier(N)),(0,t.jsx)("button",{...W,children:(0,t.jsx)(p.m,{content:C.name,children:(0,t.jsxs)("div",{style:R,className:I.renderContainer,children:[(0,t.jsx)(c.m,{title:"",data:v,pluginId:C.pluginId,width:L,height:K,options:N.options,fieldConfig:N.fieldConfig}),(0,t.jsx)("div",{className:I.hoverPane})]})})})}const P=v=>({hoverPane:(0,n.css)({position:"absolute",top:0,right:0,left:0,borderRadius:v.spacing(2),bottom:0}),vizBox:(0,n.css)({position:"relative",background:"none",borderRadius:v.shape.radius.default,cursor:"pointer",border:`1px solid ${v.colors.border.medium}`,[v.transitions.handleMotion("no-preference","reduce")]:{transition:v.transitions.create(["background"],{duration:v.transitions.duration.short})},"&:hover":{background:v.colors.background.secondary}}),imgBox:(0,n.css)({display:"flex",flexDirection:"column",height:"100%",justifySelf:"center",color:v.colors.text.primary,width:"100%",justifyContent:"center",alignItems:"center",textAlign:"center"}),name:(0,n.css)({paddingBottom:v.spacing(.5),marginTop:v.spacing(-1),fontSize:v.typography.bodySmall.fontSize,whiteSpace:"nowrap",overflow:"hidden",color:v.colors.text.secondary,fontWeight:v.typography.fontWeightMedium,textOverflow:"ellipsis"}),img:(0,n.css)({maxWidth:v.spacing(8),maxHeight:v.spacing(8)}),renderContainer:(0,n.css)({position:"absolute",transformOrigin:"left top",top:"6px",left:"6px"})});function d(v){const S=v,O=v*(1/1.6),I=350,R=I*(1/1.6),T=6,L=(S-T*2)/I,K=(O-T*2)/R;return{renderHeight:R,renderWidth:I,outerStyles:{width:S,height:O},innerStyles:{width:I,height:R,transform:`scale(${L}, ${K})`}}}function D({searchQuery:v,onChange:C,data:S,panel:O,trackSearch:I}){const R=(0,m.of)(E),{value:T}=(0,o.A)(()=>i(S,O),[S,O]),L=(0,r.useMemo)(()=>{const K=b(v,T);return I&&I(v,K.length),K},[v,T,I]);return(0,t.jsx)("div",{children:(0,t.jsx)(s.default,{disableHeight:!0,style:{width:"100%",height:"100%"},children:({width:K})=>{if(!K)return null;K=K-1;const A=Math.floor(K/200),W=8*(A-1),N=Math.floor((K-W)/A);return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:R.filterRow,children:(0,t.jsx)("div",{className:R.infoText,children:(0,t.jsx)(a.x6,{i18nKey:"panel.visualization-suggestions.based-on-current-data",children:"Based on current data"})})}),(0,t.jsxs)("div",{className:R.grid,style:{gridTemplateColumns:`repeat(auto-fill, ${N}px)`},children:[L.map((w,j)=>(0,t.jsx)(y,{data:S,suggestion:w,onChange:C,width:N-1},j)),v&&L.length===0&&(0,t.jsx)("div",{className:R.infoText,children:(0,t.jsx)(a.x6,{i18nKey:"panel.visualization-suggestions.no-results-matched-your-query",children:"No results matched your query"})})]})]})}})})}function b(v,C){if(!v||!C)return C||[];const S=new RegExp(v,"i");return C.filter(O=>S.test(O.name)||S.test(O.pluginId))}const E=v=>({heading:(0,n.css)({...v.typography.h5,margin:v.spacing(0,.5,1)}),filterRow:(0,n.css)({display:"flex",flexDirection:"row",justifyContent:"space-around",alignItems:"center",paddingBottom:"8px"}),infoText:(0,n.css)({fontSize:v.typography.bodySmall.fontSize,color:v.colors.text.secondary,fontStyle:"italic"}),grid:(0,n.css)({display:"grid",gridGap:v.spacing(1),gridTemplateColumns:"repeat(auto-fill, 144px)",marginBottom:v.spacing(1),justifyContent:"space-evenly"})})},72165:(ee,B,e)=>{"use strict";e.d(B,{G:()=>h});var t=e(74848),n=e(22803),r=e(96540),o=e(63142),s=e(74451),m=e(56840),a=e(52193),l=e(54044);const f=({isCurrent:i,plugin:x,onClick:g,disabled:p})=>(0,t.jsx)(l.b,{title:x.name,plugin:x,description:x.info.description,onClick:g,isCurrent:i,disabled:p,showBadge:!0});f.displayName="VizTypePickerPlugin";function h({pluginId:i,searchQuery:x,onChange:g,trackSearch:p}){const c=(0,o.of)(u),y=(0,r.useMemo)(a.A4,[]),P=(0,r.useMemo)(()=>{const d=(0,a.CO)(y,x,i);return p&&p(x,d.length),d},[y,x,i,p]);return P.length===0?(0,t.jsx)(s.Z,{children:(0,t.jsx)(m.x6,{i18nKey:"panel.viz-type-picker.could-anything-matching-query",children:"Could not find anything matching your query"})}):(0,t.jsx)("div",{className:c.grid,children:P.map(d=>(0,t.jsx)(f,{disabled:!1,isCurrent:d.id===i,plugin:d,onClick:D=>g({pluginId:d.id,withModKey:D.metaKey||D.ctrlKey||D.altKey})},d.id))})}const u=i=>({grid:(0,n.css)({maxWidth:"100%",display:"grid",gridGap:i.spacing(.5)}
288),heading:(0,n.css)({...i.typography.h5,margin:i.spacing(0,.5,1)})})},302:(ee,B,e)=>{"use strict";e.d(B,{CH:()=>s,E7:()=>o});var t=e(1682),n=e(82345);const r=m=>{const a=m.field.links;if(!(!a||a.length===0))return{getLinks:l=>{const f={};if(m.view){const{dataFrame:u}=m.view;f.__series={value:{name:u.name,refId:u.refId},text:"Series"};const i=m.colIndex!==void 0?u.fields[m.colIndex]:void 0;if(i){if(f.__field={value:{name:i.name,labels:i.labels},text:"Field"},m.rowIndex!==void 0&&m.rowIndex>=0){const{timeField:x}=getTimeField(u);f.__value={value:{raw:i.values[m.rowIndex],numeric:m.display.numeric,text:formattedValueToString(m.display),time:x?x.values[m.rowIndex]:void 0},text:"Value"}}m.view&&(f.__data={value:{name:u.name,refId:u.refId,fields:getFieldDisplayValuesProxy({frame:u,rowIndex:m.rowIndex})},text:"Data"})}else f.__value={value:{raw:m.display.numeric,numeric:m.display.numeric,text:formattedValueToString(m.display),calc:m.name},text:"Value"}}else console.log("VALUE",m);const h=(u,i,x)=>{const g={...f,...i};return l(u,g,x)};return a.map(u=>getLinkSrv().getDataLinkUIModel(u,h,m))}}},o=(m,a)=>{const l=m.links;if(!(!l||l.length===0))return{getLinks:()=>l.map(f=>(0,n.mQ)().getDataLinkUIModel(f,a||m.replaceVariables,m))}},s=(m,a)=>{const l=t.b4.getPanelLinks(m)?.state.rawLinks;if(!(!l||l.length===0))return{getLinks:()=>l.map(f=>(0,n.mQ)().getDataLinkUIModel(f,a,m))}}},82345:(ee,B,e)=>{"use strict";e.d(B,{Fq:()=>P,Hf:()=>b,mQ:()=>O});var t=e(2543),n=e.n(t),r=e(38036),o=e(79609),s=e(16515),m=e(95004),a=e(92138),l=e(63704),f=e(5556),h=e(37615),u=e(2863),i=e(739),x=e(65642);const g=[{value:`${r.c.keepTime}`,label:"Time range",documentation:"Adds current time range",origin:o.$0.BuiltIn},{value:`${r.c.timeRangeFrom}`,label:"Time range: from",documentation:"Adds current time range's from value",origin:o.$0.BuiltIn},{value:`${r.c.timeRangeTo}`,label:"Time range: to",documentation:"Adds current time range's to value",origin:o.$0.BuiltIn}],p=[{value:`${r.c.seriesName}`,label:"Name",documentation:"Name of the series",origin:o.$0.Series}],c=[{value:`${r.c.valueNumeric}`,label:"Numeric",documentation:"Numeric representation of selected value",origin:o.$0.Value},{value:`${r.c.valueText}`,label:"Text",documentation:"Text representation of selected value",origin:o.$0.Value},{value:`${r.c.valueRaw}`,label:"Raw",documentation:"Raw value",origin:o.$0.Value}],y=I=>I.includes(".")||I.trim().includes(" ")?`["${I}"]`:`.${I}`,P=()=>[...(0,u.w)().getVariables().map(I=>({value:I.name,label:I.name,origin:o.$0.Template})),{value:`${r.c.includeVars}`,label:"All variables",documentation:"Adds current variables",origin:o.$0.Template},...g],d=I=>{const R=[];for(const L of I)for(const K of L.fields)if(K.labels)for(const A of Object.keys(K.labels))R.push(A);const T=(0,t.chain)(R).flatten().uniq().value();return[{value:`${r.c.fieldName}`,label:"Name",documentation:"Field name of the clicked datapoint (in ms epoch)",origin:o.$0.Field},...T.map(L=>({value:`__field.labels${y(L)}`,label:`labels.${L}`,documentation:`${L} label value`,origin:o.$0.Field}))]},D=I=>{let R,T;const L=[],K={};if(I.length!==1)return[];const A=I[0];for(const W of A.fields){const N=(0,s.Ct)(W,A,I);K[N]||(L.push({value:`__data.fields${y(N)}`,label:`${N}`,documentation:`Formatted value for ${N} on the same row`,origin:o.$0.Fields}),K[N]=!0,!R&&W.type===m.PU.number&&(R={...W,name:N}),!T&&W.config.displayName&&W.config.displayName!==W.name&&(T={...W,name:N}))}return L.length&&L.push({value:"__data.fields[0]",label:"Select by index",documentation:"Enter the field order",origin:o.$0.Fields}),R&&(L.push({value:`__data.fields${y(R.name)}.numeric`,label:"Show numeric value",documentation:"the numeric field value",origin:o.$0.Fields}),L.push({value:`__data.fields${y(R.name)}.text`,label:"Show text value",documentation:"the text value",origin:o.$0.Fields})),T&&L.push({value:`__data.fields${y(T.name)}`,label:"Select by title",documentation:"Use the title to pick the field",origin:o.$0.Fields}),L},b=(I,R)=>{const T={value:`${r.c.valueTime}`,label:"Time",documentation:"Time value of the clicked datapoint (in ms epoch)",origin:o.$0.Value};return R===o.uP.Values?[...p,...d(I),...c,T,...D(I),...P()]:[...p,...d(I),...D(I),...P()]},E=I=>{const R=d(I),T={value:`${DataLinkBuiltInVars.valueCalc}`,label:"Calculation name",documentation:"Name of the calculation the value is a result of",origin:VariableOrigin.Value};return[...p,...R,...c,T,...P()]};class v{constructor(){this.getDataLinkUIModel=(R,T,L)=>{let K=R.url;R.onBuildUrl&&(K=R.onBuildUrl({origin:L,replaceVariables:T}));const A={href:a.I.assureBaseUrl(K.replace(/\n/g,"")),title:R.title??"",target:R.targetBlank!==void 0?R.targetBlank?"_blank":"_self":void 0,origin:L};return T&&(A.href=T(A.href,void 0,i.$m.UriEncode),A.title=T(R.title)),R.onClick&&(A.onClick=W=>{R.onClick({origin:L,replaceVariables:T,e:W})}),A.href=(0,x.zj)().disableSanitizeHtml?A.href:l.sQ.sanitizeUrl(A.href),A}}getLinkUrl(R){let T={};R.keepTime&&(T[`$${r.c.keepTime}`]=!0),R.includeVars&&(T[`$${r.c.includeVars}`]=!0);let L=a.I.assureBaseUrl(f.kM.appendQueryToUrl(R.url||"",f.kM.toUrlParams(T)));return L=(0,u.w)().replace(L),(0,x.zj)().disableSanitizeHtml?L:l.sQ.sanitizeUrl(L)}getAnchorInfo(R){const T=(0,u.w)();return{href:this.getLinkUrl(R),title:T.replace(R.title||""),tooltip:T.replace(R.tooltip||"")}}getPanelLinkAnchorInfo(R,T){(0,h.l)("link_srv.ts","getPanelLinkAnchorInfo","getDataLinkUIModel");const L=(K,A,W)=>(0,u.w)().replace(K,{...T,...A},W);return this.getDataLinkUIModel(R,L,{})}}let C;function S(I){C=I}function O(){return C||(C=new v),C}},87390:(ee,B,e)=>{"use strict";e.d(B,{Ap:()=>a,O6:()=>l,Xk:()=>h,gW:()=>f});var t=e(69168),n=e(30124),r=e(41097),o=e(37256),s=e(87745),m=e(89224);function a(i){return async(x,g)=>{if(i.libraryPanel?.uid&&!("model"in i.libraryPanel)){x(u(i));return}i.maxDataPoints&&(i.maxDataPoints=Number(i.maxDataPoints));let p=i.type,c=g().plugins.panels[p];if(!c)try{c=await x((0,o.y7)(p))}catch{c=(0,r.$)(p,p==="row")}
288i.plugin||await i.pluginLoaded(c),x((0,m.XM)({key:i.key,plugin:c}))}}function l(i){return x=>{x((0,m.FC)({key:i}))}}function f({panel:i,pluginId:x,options:g,fieldConfig:p,transformations:c}){return async(y,P)=>{if(i.type===x&&!g&&!p&&!c)return;let D=P().plugins.panels[x];if(D||(D=await y((0,o.y7)(x))),i.type!==x&&i.changePlugin(D),g||p||c){const b=(0,t.F)({plugin:D,currentOptions:g||i.options,currentFieldConfig:p||i.fieldConfig,isAfterPluginChange:!1});i.options=b.options,i.fieldConfig=b.fieldConfig,i.transformations=c||i.transformations,i.configRev++}i.generateNewKey(),y((0,m.XM)({key:i.key,plugin:D}))}}function h(i,x){return async(g,p)=>{const c=x.model.type,y=i.type;if(i.restoreModel({...x.model,gridPos:i.gridPos,id:i.id,libraryPanel:x}),i.getQueryRunner().clearLastResult(),y!==c){let d=p().plugins.panels[c];d||(d=await g((0,o.y7)(c))),await i.pluginLoaded(d),i.generateNewKey(),await g((0,m.XM)({key:i.key,plugin:d}))}else{const P=i.key;i.generateNewKey(),g((0,m.io)({oldKey:P,newKey:i.key}))}i.configRev=0,i.hasSavedPanelEditChange=!0,i.refresh(),i.events.publish(s.zq),i.events.publish(s.PR)}}function u(i){return async(x,g)=>{const p=i.libraryPanel.uid;try{const c=await(0,n.Yr)(p,!0);i.initLibraryPanel(c);const y=g().dashboard.getModel();if(i.repeat&&y){const P=y.panels.findIndex(d=>d.id===i.id);y.repeatPanel(i,P),y.sortPanelsByGridPos(),y.events.publish(new s.Q$)}await x(a(i))}catch(c){console.log("ERROR: ",c),x((0,m.XM)({key:i.key,plugin:(0,r.$)("Unable to load library panel: "+p,!1)}))}}}},89224:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>h,FC:()=>a,XM:()=>o,io:()=>m,nF:()=>s,rG:()=>l});var t=e(65307);const n={},r=(0,t.Z0)({name:"panels",initialState:n,reducers:{panelModelAndPluginReady:(u,i)=>{u[i.payload.key]={plugin:i.payload.plugin}},changePanelKey:(u,i)=>{u[i.payload.newKey]=u[i.payload.oldKey],delete u[i.payload.oldKey]},removePanel:(u,i)=>{delete u[i.payload.key]},removeAllPanels:u=>{Object.keys(u).forEach(i=>delete u[i])},setPanelInstanceState:(u,i)=>{u[i.payload.key].instanceState=i.payload.value}}}),{panelModelAndPluginReady:o,setPanelInstanceState:s,changePanelKey:m,removePanel:a,removeAllPanels:l}=r.actions,h={panels:r.reducer}},52193:(ee,B,e)=>{"use strict";e.d(B,{A4:()=>o,CO:()=>a});var t=e(11594),n=e(8934),r=e(65642);function o(){const l=r.$W.panels;return Object.keys(l).filter(f=>l[f].hideFromList===!1).map(f=>l[f]).sort((f,h)=>f.sort-h.sort)}function s(){return o().filter(l=>!!l.skipDataQuery)}function m(){return o().filter(l=>!l.skipDataQuery)}function a(l,f,h){if(!f.length)return l.filter(p=>p.state===t.pn.deprecated?h===p.id:!0);const u=(0,n.xb)(f).toLowerCase(),i=[],x=[],g="graph".startsWith(u);for(const p of l){if(p.state===t.pn.deprecated&&h!==p.id)continue;const y=p.name.toLowerCase().indexOf(u);y===0?i.push(p):y>0?x.push(p):g&&p.id==="timeseries"&&i.push(p)}return i.concat(x)}},4590:(ee,B,e)=>{"use strict";e.d(B,{_o:()=>u});var t=e(2543),n=e.n(t),r=e(92138),o=e(5556),s=e(17548),m=e(36490),a=e(5114),l=e(82573);const f={kiosk:!0,autofitpanels:!0,orgId:!0,"_dash.hideTimePicker":!0,"_dash.hideVariables":!0,"_dash.hideLinks":!0};class h extends a.Q{constructor(){super({isPlaying:!1}),this.urls=[],this.index=0,this.numberOfLoops=0,this.locationUpdated=this.locationUpdated.bind(this),this.api=(0,l.NF)()}navigateToDashboard(x=!1){const g=this.urls[this.index],p=m.Ny.getSearchObject(),c=(0,t.pickBy)(p,(d,D)=>f[D]),y=r.I.stripBaseFromUrl(g);this.index++,this.validPlaylistUrl=y,this.nextTimeoutId=setTimeout(()=>this.next(),this.interval);const P=y+"?"+o.kM.toUrlParams(c);x?m.Ny.getHistory().replace(P):m.Ny.push(P)}next(){if(clearTimeout(this.nextTimeoutId),this.index>this.urls.length-1){if(this.numberOfLoops++,this.numberOfLoops>=3){window.location.href=this.startUrl;return}this.index=0}this.navigateToDashboard()}prev(){this.index=Math.max(this.index-2,0),this.next()}locationUpdated(x){x.pathname!==this.validPlaylistUrl&&this.stop()}async start(x){this.stop(),this.startUrl=window.location.href,this.index=0,this.setState({isPlaying:!0}),this.locationListenerUnsub=m.Ny.getHistory().listen(this.locationUpdated);const g=[];let p=await this.api.getPlaylist(x);if(!p.items?.length)return;this.interval=s.intervalToMs(p.interval);const c=await(0,l.qY)(p.items);for(const y of c)if(y.dashboards)for(const P of y.dashboards)g.push(P.url);g.length&&(this.urls=g,this.setState({isPlaying:!0}),this.navigateToDashboard(!0))}stop(){this.state.isPlaying&&(this.index=0,this.setState({isPlaying:!1}),this.locationListenerUnsub&&this.locationListenerUnsub(),this.nextTimeoutId&&clearTimeout(this.nextTimeoutId),m.Ny.getSearchObject().kiosk&&m.Ny.partial({kiosk:null}))}}const u=new h},82573:(ee,B,e)=>{"use strict";e.d(B,{GM:()=>d,NF:()=>D,aV:()=>P,qY:()=>y});var t=e(75505),n=e(88673),r=e(68143),o=e(43173),s=e(6890),m=e(64762),a=e(16310),l=e(8095),f=e(8535),h=e(54115),u=e(55860);class i{async getAllPlaylist(){return(0,r.AI)().get("/api/playlists/")}async getPlaylist(E){const v=await(0,r.AI)().get(`/api/playlists/${E}`);return await p(v),v}async createPlaylist(E){await c(()=>(0,r.AI)().post("/api/playlists",E))}async updatePlaylist(E){await c(()=>(0,r.AI)().put(`/api/playlists/${E.uid}`,E))}async deletePlaylist(E){await c(()=>(0,r.AI)().delete(`/api/playlists/${E}`),"Playlist deleted")}}class x{constructor(){this.playlistAsK8sResource=E=>({metadata:{name:E.uid},spec:{title:E.name,interval:E.interval,items:E.items??[]}}),this.server=new h.ws({group:"playlist.grafana.app",version:"v0alpha1",resource:"playlists"})}async getAllPlaylist(){return(await this.server.list()).items.map(g)}async getPlaylist(E){const v=await this.server.get(E),C=g(v);return await p(C),C}async createPlaylist(E){const v=this.playlistAsK8sResource(E);await c(async()=>{await this.server.create(v)})}async updatePlaylist(E){const v=this.playlistAsK8sResource(E);await c(()=>this.server.update(v).then(()=>{}))}async deletePlaylist(E){await c(()=>this.server.delete(E).then(()=>{}),"Playlist deleted")}}function g(b){const{spec:E,metadata:v}=b;return{uid:v.name,name:E.title,interval:E.interval,items:E.items}}async function p(b){if(b?.items){for(const E of b.items)if(E.type==="dashboard_by_id"){E.type="dashboard_by_uid";
288const v=await(0,r.AI)().get(`/api/dashboards/ids/${E.value}`);v?.length&&(E.value=v[0])}}}async function c(b,E="Playlist saved"){try{await b(),(0,f.JD)((0,s.dx)((0,m.tZ)(E)))}catch(v){v instanceof Error&&(0,f.JD)((0,s.dx)((0,m.gi)("Unable to save playlist",v)))}}async function y(b){let E=0;if(!b?.length)return[];const v=[];for(const O of b){const I={query:"*",kind:["dashboard"],limit:1e3};switch(O.type){case"dashboard_by_id":throw new Error("invalid item (with id)");case"dashboard_by_uid":I.uid=[O.value];break;case"dashboard_by_tag":I.tags=[O.value];break}v.push({refId:`${E++}`,queryType:l.nj.Search,search:I})}if(!o.$.featureToggles.panelTitleSearch){const O=(0,u.S)(),I=[];for(let R=0;R<v.length;R++){const T=(await O.search(v[R].search)).view;I.push({...b[R],dashboards:T.map(L=>({...L}))})}return I}const C=await(0,a.o)(),S=await(0,t.s)(C.query({targets:v}));if(S.data.length!==b.length)throw new Error("unexpected result size");return b.map((O,I)=>{const R=new n.R(S.data[I]);return{...O,dashboards:R.map(T=>({...T}))}})}function P(){return{items:[],interval:"5m",name:"",uid:""}}function d(b,E){return E?.length?(E=E.toLowerCase(),b.filter(v=>v.name.toLowerCase().includes(E))):b}function D(){return o.$.featureToggles.kubernetesPlaylists?new x:new i}},59253:(ee,B,e)=>{"use strict";e.d(B,{Ap:()=>g,Bj:()=>l,CB:()=>m,Gd:()=>x,T_:()=>a,XP:()=>p,cu:()=>y,ij:()=>P,xZ:()=>c});var t=e(67458),n=e(68143),r=e(81871),o=e(95256),s=e(4476);async function m(D){const b=await f(D),E=!!b,[v,C,S,O]=await Promise.all([x(),h(D,E),u(D),i(D)]),I=v.find(T=>T.id===D),R=I?.dependencies||b?.json?.dependencies;return{grafanaDependency:R?.grafanaDependency??R?.grafanaVersion??"",pluginDependencies:R?.plugins||[],links:I?.info.links||b?.json?.info.links||[],readme:S||b?.readme,versions:C,statusContext:b?.statusContext??"",iam:b?.json?.iam,lastCommitDate:b?.lastCommitDate,changelog:b?.changelog||O,licenseUrl:b?.licenseUrl,documentationUrl:b?.documentationUrl,raiseAnIssueUrl:b?.raiseAnIssueUrl,signatureType:I?.signatureType||(b?.signatureType!==""?b?.signatureType:void 0),signature:I?.signature,screenshots:b?.json?.info.screenshots||I?.info.screenshots}}async function a(){try{const{items:D}=await(0,n.AI)().get(`${o.P5}/plugins`,{includeDeprecated:!0});return D.filter(s.hY)}catch(D){if((0,n.NF)(D))return D.isHandled=!0,console.error("Failed to fetch plugins from catalog (default https://grafana.com/api/plugins)"),[];throw D}}async function l(){try{return await(0,n.AI)().get(`${o.Sw}/errors`)}catch{return[]}}async function f(D){try{return await(0,n.AI)().get(`${o.P5}/plugins/${D}`,{})}catch(b){(0,n.NF)(b)&&(b.isHandled=!0);return}}async function h(D,b){try{return b?((await(0,n.AI)().get(`${o.P5}/plugins/${D}/versions`)).items||[]).map(v=>({version:v.version,createdAt:v.createdAt,updatedAt:v.updatedAt,isCompatible:v.isCompatible,grafanaDependency:v.grafanaDependency,angularDetected:v.angularDetected})):[]}catch(E){return(0,n.NF)(E)&&(E.isHandled=!0),[]}}async function u(D){try{const b=await(0,n.AI)().get(`${o.Sw}/${D}/markdown/README`);return b?(0,t.G)(b):""}catch(b){return(0,n.NF)(b)&&(b.isHandled=!0),""}}async function i(D){try{const b=await(0,n.AI)().get(`${o.Sw}/${D}/markdown/CHANGELOG`);return b?(0,t.G)(b):""}catch(b){return(0,n.NF)(b)&&(b.isHandled=!0),""}}async function x(){return(await(0,n.AI)().get(`${o.Sw}`,(0,r.F)({embedded:0}))).filter(s.Sq)}async function g(){const{items:D}=await(0,n.AI)().get(`${o.Mi}/plugins`);return D}async function p(){const{items:D}=await(0,n.AI)().get(`${o.Mi}/provisioned-plugins`);return D.map(b=>({slug:b.type}))}async function c(D,b){return await(0,n.AI)().post(`${o.Sw}/${D}/install`,{version:b},{showErrorAlert:!1})}async function y(D){return await(0,n.AI)().post(`${o.Sw}/${D}/uninstall`)}async function P(D,b){return(await(0,n.AI)().datasourceRequest({url:`/api/plugins/${D}/settings`,method:"POST",data:b}))?.data}const d={getRemotePlugins:a,getInstalledPlugins:x,installPlugin:c,uninstallPlugin:y}},40203:(ee,B,e)=>{"use strict";e.d(B,{G:()=>o});var t=e(74848),n=e(22803),r=e(63142);const o=({children:m,wrap:a,className:l})=>
288{const f=(0,r.$j)(),h=s(f,a);return(0,t.jsx)("div",{className:(0,n.cx)(h.container,l),children:m})},s=(m,a)=>({container:(0,n.css)({display:"flex",flexDirection:"row",flexWrap:a?"wrap":"nowrap","& > *":{marginBottom:m.spacing(),marginRight:m.spacing()},"& > *:last-child":{marginRight:0}})})},95256:(ee,B,e)=>{"use strict";e.d(B,{Mi:()=>n,P5:()=>r,Sw:()=>t,fu:()=>o});const t="/api/plugins",n="/api/instance",r="/api/gnet",o="plugins"},4476:(ee,B,e)=>{"use strict";e.d(B,{Gl:()=>b,H2:()=>p,N6:()=>v,Qi:()=>V,Sq:()=>C,TD:()=>A,UI:()=>j,Xc:()=>y,bM:()=>R,by:()=>c,hY:()=>S,j_:()=>E,kH:()=>x,sP:()=>w,td:()=>h,tr:()=>D,wD:()=>N});var t=e(84139),n=e(11594),r=e(44922),o=e(43173),s=e(62061),m=e(73427),a=e(83873),l=e(96673),f=e(13660);function h({local:U=[],remote:F=[],instance:M=[],provisioned:H=[],pluginErrors:_}){const Z=[],ne=P(_),te=M.reduce((Q,J)=>(Q.set(J.pluginSlug,J),Q),new Map),Y=H.reduce((Q,J)=>(Q.add(J.slug),Q),new Set);return U.forEach(Q=>{const J=F.find(X=>X.slug===Q.id),q=ne[Q.id];J||Z.push(u(Q,void 0,q))}),F.forEach(Q=>{const J=U.find(se=>se.id===Q.slug),q=ne[Q.slug];if(!(Q.status===f.Uy.Deprecated&&!J)){const se=u(J,Q,q);if(o.$.pluginAdminExternalManageEnabled){se.isFullyInstalled=se.isCore?!0:(te.has(Q.slug)||Y.has(
288Q.slug))&&se.isInstalled,se.isInstalled=te.has(Q.slug)||se.isInstalled;const oe=te.get(Q.slug);se.isUpdatingFromInstance=te.has(Q.slug)&&se.hasUpdate&&se.installedVersion!==oe?.version,oe?.version&&oe?.version!==Q.version&&(se.hasUpdate=!0),se.isUninstallingFromInstance=!!J&&!te.has(Q.slug),se.isProvisioned=Y.has(Q.slug)}Z.push(se)}}),Z}function u(U,F,M){return!U&&F?i(F,M):U&&!F?x(U,M):g(U,F,M)}function i(U,F){const{name:M,slug:H,description:_,version:Z,orgName:ne,popularity:te,downloads:Y,typeCode:Q,updatedAt:J,createdAt:q,status:X,angularDetected:se,keywords:oe,signatureType:ae,versionSignatureType:ie,versionSignedByOrgName:fe,url:pe}=U,de=!!F;return{description:_,downloads:Y,id:H,info:{logos:{small:`${o.$.appSubUrl}/api/gnet/plugins/${H}/versions/${Z}/logos/small`,large:`${o.$.appSubUrl}/api/gnet/plugins/${H}/versions/${Z}/logos/large`},keywords:oe},name:M,orgName:ne,popularity:te,publishedAt:q,signature:d({remote:U,error:F}),signatureType:ae||ie||void 0,signatureOrg:fe,updatedAt:J,hasUpdate:!1,isPublished:!0,isInstalled:de,isDisabled:de,isManaged:I(H),isPreinstalled:R(H),isDeprecated:X===f.Uy.Deprecated,isCore:U.internal,isDev:!1,isEnterprise:X===f.Uy.Enterprise,type:Q,error:F?.errorCode,angularDetected:se,isFullyInstalled:de,latestVersion:U.version,url:pe}}function x(U,F){const{name:M,info:{description:H,version:_,logos:Z,updated:ne,author:te,keywords:Y},id:Q,dev:J,type:q,signature:X,signatureOrg:se,signatureType:oe,hasUpdate:ae,accessControl:ie,angularDetected:fe}=U,pe=!!F;return{description:H,downloads:0,id:Q,info:{logos:Z,keywords:Y},name:M,orgName:te.name,popularity:0,publishedAt:"",signature:d({local:U,error:F}),signatureOrg:se,signatureType:oe,updatedAt:ne,installedVersion:_,hasUpdate:ae,isInstalled:!0,isDisabled:pe,isCore:X==="internal",isPublished:!1,isDeprecated:!1,isDev:!!J,isEnterprise:!1,isManaged:I(Q),isPreinstalled:R(Q),type:q,error:F?.errorCode,accessControl:ie,angularDetected:fe,isFullyInstalled:!0,iam:U.iam,latestVersion:U.latestVersion}}function g(U,F,M){const H=U?.info.version,_=F?.slug||U?.id||"",Z=U?.type||F?.typeCode,ne=!!M,te=F?.keywords||U?.info.keywords||[];let Y={small:`/public/img/icn-${Z}.svg`,large:`/public/img/icn-${Z}.svg`};return F?Y={small:`${o.$.appSubUrl}/api/gnet/plugins/${_}/versions/${F.version}/logos/small`,large:`${o.$.appSubUrl}/api/gnet/plugins/${_}/versions/${F.version}/logos/large`}:U&&U.info.logos&&(Y=U.info.logos),{description:U?.info.description||F?.description||"",downloads:F?.downloads||0,hasUpdate:U?.hasUpdate||!1,id:_,info:{logos:Y,keywords:te},isCore:!!(F?.internal||U?.signature===n.Ac.internal),isDev:!!U?.dev,isEnterprise:F?.status===f.Uy.Enterprise,isInstalled:!!U||ne,isDisabled:ne,isDeprecated:F?.status===f.Uy.Deprecated,isPublished:!0,isManaged:I(_),isPreinstalled:R(_),name:F?.name||U?.name||"",orgName:F?.orgName||U?.info.author.name||"",popularity:F?.popularity||0,publishedAt:F?.createdAt||"",type:Z,signature:d({local:U,remote:F,error:M}),signatureOrg:U?.signatureOrg||F?.versionSignedByOrgName,signatureType:U?.signatureType||F?.versionSignatureType||F?.signatureType||void 0,updatedAt:F?.updatedAt||U?.info.updated||"",installedVersion:H,error:M?.errorCode,accessControl:U?.accessControl,angularDetected:U?.angularDetected??F?.angularDetected,isFullyInstalled:!!U||ne,iam:U?.i
288am,latestVersion:U?.latestVersion||F?.version||"",url:F?.url||""}}const p=U=>`${o.$.pluginCatalogURL}${U}`;var c=(U=>(U.nameAsc="nameAsc",U.nameDesc="nameDesc",U.updated="updated",U.published="published",U.downloads="downloads",U))(c||{});const y=(U,F)=>{const M={nameAsc:(H,_)=>H.name.localeCompare(_.name),nameDesc:(H,_)=>_.name.localeCompare(H.name),updated:(H,_)=>(0,r.b)(_.updatedAt).valueOf()-(0,r.b)(H.updatedAt).valueOf(),published:(H,_)=>(0,r.b)(_.publishedAt).valueOf()-(0,r.b)(H.publishedAt).valueOf(),downloads:(H,_)=>_.downloads-H.downloads};return M[F]?U.sort(M[F]):U};function P(U=[]){return U.reduce((F,M)=>(F[M.pluginId]=M,F),{})}function d(U){const{error:F,local:M,remote:H}=U;if(F)switch(F.errorCode){case n.ZK.invalidSignature:return n.Ac.invalid;case n.ZK.missingSignature:return n.Ac.missing;case n.ZK.modifiedSignature:return n.Ac.modified}return M?.signature?M.signature:H?.signatureType&&H?.versionSignatureType?n.Ac.valid:n.Ac.missing}const D=()=>(0,a.AI)().get("/api/frontend/settings").then(U=>{o.$.panels=U.panels});function b(U){if(!U)return;const[F]=U.filter(M=>!!M.isCompatible);return F}const E=()=>o.$.pluginAdminEnabled,v=(U,F,M)=>{const H=o.$.pluginAdminExternalManageEnabled,_=m.TP.hasPermission(l.AccessControlAction.PluginsInstall),Z=!!M;return U.type===n.QE.renderer||U.isEnterprise&&!(0,s.a)("enterprise.plugins")||U.isDev||!_&&!H||!U.isPublished||!Z||!F},C=U=>O(U.id),S=U=>O(U.slug);function O(U){const{pluginCatalogHiddenPlugins:F}=o.$;return!F.includes(U)}function I(U){const{pluginCatalogManagedPlugins:F}=o.$;return F?.includes(U)}function R(U){const{pluginCatalogPreinstalledPlugins:F}=o.$,M=F?.find(H=>H.id===U);return{found:!!M?.id,withVersion:!!M?.version}}function T(U){return U?.signature==="internal"}function L(U){return U.split(" - ")[0]}function K(U){return U.reduce((F,{id:M,name:H,type:_,orgName:Z,info:ne})=>{const te=ne.keywords?.join(" ").toLowerCase(),Y=`${M} - ${H} - ${_} - ${Z} - ${te}`;return F.push(Y),F},[])}function A(U,F){const M=K(U);let _=new t.A({intraMode:1,intraSub:0}).filter(M,F);return _===null?null:_.map(Z=>L(M[Z]))}function W(U){return!(U.isProvisioned||U.isCore||U.type===n.QE.renderer||U.isPreinstalled.withVersion||U.isManaged)}function N(U){return!(!W(U)||!U.hasUpdate||U.isUpdatingFromInstance)}function w(U){return!!(!W(U)||U.isEnterprise&&!(0,s.a)("enterprise.plugins")||!U.isPublished||U.isDisabled||!E())}function j(U){return U?U.angularDetected===!1:!1}function V(U){return U.isDisabled&&U.error===n.ZK.angular}},37256:(ee,B,e)=>{"use strict";e.d(B,{JC:()=>O,JJ:()=>P,LR:()=>y,NJ:()=>R,aU:()=>D,ai:()=>C,h9:()=>I,mj:()=>c,nT:()=>S,t5:()=>d,y7:()=>T});var t=e(65307),n=e(65474),r=e(62467),o=e(66847),s=e(45650),m=e(12974),a=e(75505),l=e(43173),f=e(68143),h=e(92391),u=e(19203),i=e(59253),x=e(95256),g=e(4476),p=e(13660);const c=(0,t.zD)(`${x.fu}/fetchAll`,async(L,K)=>{try{K.dispatch({type:`${x.fu}/fetchLocal/pending`}),K.dispatch({type:`${x.fu}/fetchRemote/pending`});const A=l.$.pluginAdminExternalManageEnabled?(0,n.H)((0,i.Ap)()):(0,r.of)(void 0),W=l.$.pluginAdminExternalManageEnabled?(0,n.H)((0,i.XP)()):(0,r.of)(void 0),N=500,w=(0,n.H)((0,i.Bj)()),j=(0,n.H)((0,i.Gd)()),V=(0,n.H)((0,i.T_)()).pipe((0,o.W)(U=>(K.dispatch({type:`${x.fu}/fetchRemote/rejected`}),console.error(U),(0,r.of)([]))));return(0,s.p)({local:j,remote:V,instance:A,provisioned:W,pluginErrors:w}).pipe((0,m.w)({each:N,with:()=>(V.subscribe(async U=>{if(K.dispatch({type:`${x.fu}/fetchRemote/fulfilled`}),U.length>0){const F=await(0,a.s)(j),M=await(0,a.s)(A),H=await(0,a.s)(W),_=await(0,a.s)(w);K.dispatch(D((0,g.td)({local:F,remote:U,instance:M,provisioned:H,pluginErrors:_})))}}),(0,s.p)({local:j,instance:A,provisioned:W,pluginErrors:w}))})).subscribe(({local:U,remote:F,instance:M,provisioned:H,pluginErrors:_})=>{U&&F?(K.dispatch({type:`${x.fu}/fetchLocal/fulfilled`}),K.dispatch({type:`${x.fu}/fetchRemote/fulfilled`}),K.dispatch(D((0,g.td)({local:U,remote:F,instance:M,provisioned:H,pluginErrors:_})))):U&&(K.dispatch({type:`${x.fu}/fetchLocal/fulfilled`}),K.dispatch(D((0,g.td)({local:U,pluginErrors:_}))))},U=>(console.log(U),K.dispatch({type:`${x.fu}/fetchLocal/rejected`}),K.dispatch({type:`${x.fu}/fetchRemote/rejected`}),K.rejectWithValue("Unknown error."))),null}catch{return K.rejectWithValue("Unknown error.")}}),y=(0,t.zD)(`${x.fu}/fetchAllLocal`,async(L,K)=>{try{return(await(0,i.Gd)()).map(W=>(0,g.kH)(W))}catch{return K.rejectWithValue("Unknown error.")}}),P=(0,t.zD)(`${x.fu}/fetchRemotePlugins`,async(L,K)=>{try{return await(0,i.T_)()}catch(A){return(0,f.NF)(A)&&(A.isHandled=!0),K.rejectWithValue([])}}),d=(0,t.zD)(`${x.fu}/fetchDetails`,async(L,K)=>{try{const A=await(0,i.CB)(L);return{id:L,changes:{details:A}}}catch{return K.rejectWithValue("Unknown error.")}}),D=(0,t.VP)(`${x.fu}/addPlugins`),b=(0,t.VP)(`${x.fu}/addLocalPlugins`),E=(0,t.VP)(`${x.fu}/addLocalPlugins`),v=(0,t.VP)(`${x.fu}/addLocalPlugins`),C=(0,t.zD)(`${x.fu}/install`,async({id:L,version:K,installType:A=p.u8.INSTALL},W)=>{const N={isInstalled:!0,installedVersion:K};A===p.u8.UPDATE&&(N.hasUpdate=!1),A===p.u8.DOWNGRADE&&(N.hasUpdate=!0);try{return await(0,i.xZ)(L,K),await(0,g.tr)(),A!==p.u8.INSTALL&&(0,u.sk)(L),{id:L,changes:N}}catch(w){return console.error(w),(0,f.NF)(w)?(w.data.id=L,W.rejectWithValue(w.data)):W.rejectWithValue("Unknown error.")}}),S=(0,t.zD)(`${x.fu}/install`,async()=>({})),O=(0,t.zD)(`${x.fu}/uninstall`,async(L,K)=>{try{return await(0,i.cu)(L),await(0,g.tr)(),(0,u.sk)(L),{id:L,changes:{isInstalled:!1,installedVersion:void 0,isFullyInstalled:!1}}}catch(A){return console.error(A),K.rejectWithValue("Unknown error.")}}),I=(0,t.zD)(`${x.fu}/loadPluginDashboards`,async(L,K)=>{const N=`api/plugins/${K.getState().dataSources.dataSource.type}/dashboards`;return(0,f.AI)().get(N)}),R=(0,t.VP)(`${x.fu}/panelPluginLoaded`),T=L=>async(K,A)=>{let W=A().plugins.panels[L];return W||(W=await(0,h.TV)(L),A().plugins.panels[L]||K(R(W))),W}},54687:(ee,B,e)=>{"use strict";e.d(B,{AI:()=>s,Ff:()=>i});var t=e(65307),n=e(95256),r=e(13660),o=e(37256);const s=(0,t.pU)(),m=x=>new RegExp(`${n.fu}/(.*)/pending`).test(x.type),a=x=>new RegExp(`${n.fu}/(.*)/fulfilled`).test(x.type),l=x=>new RegExp(`${n.fu}/(.*)/rejected`).test(x.type),f=x=>{const g=x.lastIndexOf("/");return x.substring(0,g)},h={items:s.getInitialState(),requests:{},plugins:[],errors:[],searchQuery:"",hasFetched:!1,dashboards:[],isLoadingPluginDashboards:!1,panels:{}}
288,i=(0,t.Z0)({name:"plugins",initialState:h,reducers:{},extraReducers:x=>x.addCase(o.aU,(g,p)=>{s.upsertMany(g.items,p.payload)}).addCase(o.LR.fulfilled,(g,p)=>{s.upsertMany(g.items,p.payload)}).addCase(o.t5.fulfilled,(g,p)=>{s.updateOne(g.items,p.payload)}).addCase(o.ai.fulfilled,(g,p)=>{s.updateOne(g.items,p.payload)}).addCase(o.JC.fulfilled,(g,p)=>{s.updateOne(g.items,p.payload)}).addCase(o.NJ,(g,p)=>{g.panels[p.payload.meta.id]=p.payload}).addCase(o.h9.pending,(g,p)=>{g.isLoadingPluginDashboards=!0,g.dashboards=[]}).addCase(o.h9.fulfilled,(g,p)=>{g.isLoadingPluginDashboards=!1,g.dashboards=p.payload}).addMatcher(m,(g,p)=>{g.requests[f(p.type)]={status:r.IZ.Pending}}).addMatcher(a,(g,p)=>{g.requests[f(p.type)]={status:r.IZ.Fulfilled}}).addMatcher(l,(g,p)=>{g.requests[f(p.type)]={status:r.IZ.Rejected,error:p.payload}})}).reducer},13660:(ee,B,e)=>{"use strict";e.d(B,{IZ:()=>a,Ip:()=>n,LZ:()=>m,Uy:()=>r,og:()=>s,u8:()=>o,vk:()=>t});var t=(l=>(l.Home="plugins-home",l.Browse="plugins-browse",l.Details="plugins-details",l))(t||{}),n=(l=>(l.app="apps",l.datasource="database",l.panel="credit-card",l.renderer="capture",l))(n||{}),r=(l=>(l.Deleted="deleted",l.Active="active",l.Pending="pending",l.Deprecated="deprecated",l.Enterprise="enterprise",l))(r||{}),o=(l=>(l.INSTALL="INSTALL",l.UNINSTALL="UNINSTALL",l.UPDATE="UPDATE",l.REINSTALL="REINSTALL",l.DOWNGRADE="DOWNGRADE",l))(o||{}),s=(l=>(l.OVERVIEW="Overview",l.VERSIONS="Version history",l.CONFIG="Config",l.DASHBOARDS="Dashboards",l.USAGE="Usage",l.IAM="IAM",l.CHANGELOG="Changelog",l.PLUGINDETAILS="Plugin details",l.DATASOURCE_CONNECTIONS="Data source connections",l.SCREENSHOTS="Screenshots",l))(s||{}),m=(l=>(l.OVERVIEW="overview",l.VERSIONS="version-history",l.CONFIG="config",l.DASHBOARDS="dashboards",l.USAGE="usage",l.IAM="iam",l.CHANGELOG="changelog",l.PLUGINDETAILS="right-panel",l.DATASOURCE_CONNECTIONS="datasource-connections",l.SCREENSHOTS="screenshots",l))(m||{}),a=(l=>(l.Pending="Pending",l.Fulfilled="Fulfilled",l.Rejected="Rejected",l))(a||{})},70715:(ee,B,e)=>{"use strict";e.d(B,{A:()=>n,S:()=>o});var t=e(96540);const n=(0,t.createContext)(r());n.displayName="PluginPageContext";function r(){return{sectionNav:{main:{text:"Plugin page"},node:{text:"Plugin page"}}}}function o(s){return{sectionNav:s??r().sectionNav}}},85622:(ee,B,e)=>{"use strict";e.d(B,{p:()=>o});var t=e(74848),n=e(11594),r=e(99887);const o=m=>{const a=s(m.state);return a?(0,t.jsx)(r.E,{className:m.className,color:a.color,title:typeof a.tooltip=="string"?a.tooltip:void 0,tooltip:typeof a.tooltip!="str
288ing"?a.tooltip:void 0,text:a.text,icon:a.icon}):null};function s(m){switch(m){case n.pn.deprecated:return{text:"Deprecated",color:"red",tooltip:"This feature is deprecated and will be removed in a future release"};case n.pn.alpha:return{text:"Alpha",color:"blue",tooltip:"This feature is experimental and future updates might not be backward compatible"};case n.pn.beta:return{text:"Beta",color:"blue",tooltip:"This feature is close to complete but not fully tested"};default:return null}}},28998:(ee,B,e)=>{"use strict";e.d(B,{tR:()=>P,xq:()=>g});var t=e(94644),n=e(32899),r=e(8134),o=e(28105),s=e(2863),m=e(36580),a=e(68143),l=e(78282),f=e(45229),h=e(65642),u=e(29328),i=e(4651),x=e(80185);class g{constructor(D=(0,s.w)()){this.templateSrv=D,this.datasources={},this.settingsMapByName={},this.settingsMapByUid={},this.settingsMapById={},this.runtimeDataSources={},this.defaultName=""}init(D,b){this.datasources={},this.settingsMapByUid={},this.settingsMapByName=D,this.defaultName=b;for(const E of Object.values(D))E.uid||(E.uid=E.name),this.settingsMapByUid[E.uid]=E,this.settingsMapById[E.id]=E;for(const E of Object.values(this.runtimeDataSources))this.datasources[E.uid]=E,this.settingsMapByUid[E.uid]=E.instanceSettings;this.datasources[m.dR.type]=u.Ex,this.datasources[i.Uj]=u.Ex,this.settingsMapByUid[m.dR.uid]=u.$i,this.settingsMapByUid[i.Uj]=u.$i}registerRuntimeDataSource(D){if(this.runtimeDataSources[D.dataSource.uid])throw new Error(`A runtime data source with uid ${D.dataSource.uid} has already been registered`);if(this.settingsMapByUid[D.dataSource.uid])throw new Error(`A data source with uid ${D.dataSource.uid} has already been registered`);this.runtimeDataSources[D.dataSource.uid]=D.dataSource,this.datasources[D.dataSource.uid]=D.dataSource,this.settingsMapByUid[D.dataSource.uid]=D.dataSource.instanceSettings}getDataSourceSettingsByUid(D){return this.settingsMapByUid[D]}getInstanceSettings(D,b){let E=p(D);if((0,m.s9)(E))return u.$i;if(E==="default"||E==null)return this.settingsMapByUid[this.defaultName]??this.settingsMapByName[this.defaultName];if(E[0]==="$"){const v=this.templateSrv.replace(E,b,c);let C;return v==="default"?C=this.settingsMapByName[this.defaultName]:C=this.settingsMapByUid[v]??this.settingsMapByName[v],C?{...C,isDefault:!1,name:E,uid:E,rawRef:{type:C.type,uid:C.uid}}:void 0}return this.settingsMapByUid[E]??this.settingsMapByName[E]??this.settingsMapById[E]}get(D,b){let E=p(D);if(!E){if(y(D)){const C=this.getList({type:D.type});if(!C?.length)return Promise.reject("no datasource of type");const S=C.find(O=>O.isDefault)??C[0];return this.get(S.uid)}return this.get(this.defaultName)}if((0,m.s9)(D))return Promise.resolve(this.datasources[i.Uj]);const v=this.settingsMapByName[E];return v&&(E=v.uid),this.datasources[E]?Promise.resolve(this.datasources[E]):(E=this.templateSrv.replace(E,b,c),E==="default"&&this.defaultName!=="default"?this.get(this.defaultName):this.datasources[E]?Promise.resolve(this.datasources[E]):this.loadDatasource(E))}async loadDatasource(D){if(this.datasources[D])return Promise.resolve(this.datasources[D]);const b=this.getInstanceSettings(D);if(!b)return Promise.reject({message:`Datasource ${D} was not found`});try{const E=await(0,x.cS)(b.meta);if(this.datasources[D])return this.datasources[D];const v=new E.DataSourceClass(b);if(v.components=E.components,!(v instanceof t.mA)){const C=v;C.name=b.name,C.id=b.id,C.type=b.type,C.meta=b.meta,C.uid=b.uid,C.getRef=t.mA.prototype.getRef}return this.datasources[D]=v,this.datasources[v.uid]=v,v}catch(E){return E instanceof Error&&f.A.emit(n.r1.alertError,[b.name+" plugin failed",E.toString()]),Promise.reject({message:`Datasource: ${D} was not found`})}}getAll(){return Object.values(this.settingsMapByName)}getList(D={}){const b=Object.values(this.settingsMapByName).filter(v=>{if(v.meta.id==="grafana"||v.meta.id==="mixed"||v.meta.id==="dashboard"||D.metrics&&!v.meta.metrics||D.tracing&&!v.meta.tracing||D.logs&&v.meta.category!=="logging"&&!v.meta.logs||D.annotations&&!v.meta.annotations||D.alerting&&!v.meta.alerting||D.pluginId&&!(0,r._)(D.pluginId,v.meta)||D.filter&&!D.filter(v))return!1;if(D.type){if(Array.isArray(D.type)){if(!D.type.includes(v.type))return!1}else if(!(v.type===D.type||v.meta.aliasIDs?.includes(D.type)))return!1}return!(!D.all&&v.meta.metrics!==!0&&v.meta.annotations!==!0&&v.meta.tracing!==!0&&v.meta.logs!==!0&&v.meta.alerting!==!0)});if(D.variables)for(const v of this.templateSrv.getVariables()){if(v.type!=="datasource")continue;let C=v.current.value==="default"?this.defaultName:v.current.value;Array.isArray(C)&&(C=C[0]);const S=!Array.isArray(C)&&(this.settingsMapByName[C]||this.settingsMapByUid[C]);if(S){const O=`\${${v.name}}`;b.push({...S,isDefault:!1,name:O,uid:O})}}const E=b.sort((v,C)=>v.name.toLowerCase()>C.name.toLowerCase()?1:v.name.toLowerCase()<C.name.toLowerCase()?-1:0);if(!D.pluginId&&!D.alerting){if(D.mixed){const v=this.getInstanceSettings("-- Mixed --");v&&b.push(v)}if(D.dashboard){const v=this.getInstanceSettings("-- Dashboard --");v&&b.push(v)}if(!D.tracing){const v=this.getInstanceSettings("-- Grafana --");v&&D.filter?.(v)!==!1&&b.push(v)}}return E}getExternal(){return this.getList()}getAnnotationSources(){return this.getList({annotations:!0,variables:!0}).map(D=>({name:D.name,value:D.name,meta:D.meta}))}getMetricSources(D){return this.getList({metrics:!0,variables:!D?.skipVariables}).map(b=>({name:b.name,value:b.name,meta:b.meta}))}async reload(){const D=await(0,a.AI)().get("/api/frontend/settings");h.Ay.datasources=D.datasources,h.Ay.defaultDatasource=D.defaultDatasource,this.init(D.datasources,D.defaultDatasource)}}
288function p(d){return(0,m.s9)(d)?m.dR.uid:typeof d=="string"?d:d?.uid}function c(d){return Array.isArray(d)?d[0]:d}const y=d=>!!(d&&(0,o.Gv)(d)&&"type"in d),P=()=>(0,l.l)()},28337:(ee,B,e)=>{"use strict";e.d(B,{AZ:()=>u,OG:()=>a,TX:()=>l,ZV:()=>h,ov:()=>f});var t=e(74848),n=e(96540);const r=(0,n.createContext)(void 0),o=(0,n.createContext)(void 0),s=(0,n.createContext)(void 0),m=(0,n.createContext)(void 0);function a(){const i=(0,n.useContext)(r);if(!i)throw new Error("No `AddedLinksRegistryContext` found.");return i}function l(){const i=(0,n.useContext)(o);if(!i)throw new Error("No `AddedComponentsRegistryContext` found.");return i}function f(){const i=(0,n.useContext)(s);if(!i)throw new Error("No `AddedFunctionsRegistry` found.");return i}function h(){const i=(0,n.useContext)(m);if(!i)throw new Error("No `ExposedComponentsRegistryContext` found.");return i}const u=({registries:i,children:x})=>(0,t.jsx)(r.Provider,{value:i.addedLinksRegistry,children:(0,t.jsx)(o.Provider,{value:i.addedComponentsRegistry,children:(0,t.jsx)(s.Provider,{value:i.addedFunctionsRegistry,children:(0,t.jsx)(m.Provider,{value:i.exposedComponentsRegistry,children:x})})})})},4745:(ee,B,e)=>{"use strict";e.d(B,{$$:()=>d,Bc:()=>P,Bs:()=>t,Cf:()=>l,E5:()=>c,FL:()=>x,H$:()=>a,O6:()=>m,Ri:()=>n,Td:()=>h,bw:()=>s,cu:()=>y,iS:()=>p,ij:()=>i,o2:()=>r,sm:()=>g,vT:()=>f,z5:()=>u});const t='Invalid usage of extension point. Reason: Extension point id should be prefixed with your plugin id, e.g "myorg-foo-app/toolbar/v1".',n='Invalid usage of extension point. Reason: The extension point is not recorded in the "plugin.json" file. Extension points must be listed in the section "extensions.extensionPoints[]". Returning an empty array of extensions.',r="Title is missing.",o="Description is missing.",s='The "fn" argument is invalid, it should be a function.',m='The "configure" function is invalid. It should be a function.',a='Either "path" or "onClick" is required.',l='The "path" is required and should start with "/a/<pluginId>".',f="The component id does not match the id naming convention. Id should be prefixed with plugin id. e.g 'myorg-basic-app/my-component-id/v1'.",h="An exposed component with the same id already exists.",u='The exposed component was not recorded in the plugin.json. Exposed component extensions must be listed in the section "extensions.exposedComponents[]". Currently, this is only required in development but will be enforced also in production builds in the future.',i='Invalid usage of extension point. Reason: The exposed component is not recorded in the "plugin.json" file. Exposed components must be listed in the dependencies[] section.',x='The extension was not recorded in the plugin.json. Added component extensions must be listed in the section "extensions.addedComponents[]". Currently, this is only required in development but will be enforced also in production builds in the future.',g=`The "title" doesn't match the title recorded in plugin.json.`,p='The extension was not recorded in the plugin.json. Added link extensions must be listed in the section "extensions.addedLinks[]". Currently, this is only required in development but will be enforced also in production builds in the future.',c='The extension was not recorded in the plugin.json. Added function extensions must be listed in the section "extensions.addedFunction[]". Currently, this is only required in development but will be enforced also in production builds in the future.',y=`The "description" doesn't match the description recorded in plugin.json.`,P='The "targets" for the registered extension does not match the targets recorded in plugin.json. Currently, this is only required in development but will be enforced also in production builds in the future.',d=D=>`The app plugin with plugin id "${D}" was not found.`},8001:(ee,B,e)=>{"use strict";e.d(B,{dp:()=>x,m5:()=>u,zN:()=>i});var t=e(2543),n=e.n(t),r=e(49510),o=e(16126),s=e(81160),m=e(54092),a=e(96016),l=e(63629),f=e(31439);const h=p=>(0,r.z)([l.qm.addedComponentsRegistry.asObservable(),l.qm.addedLinksRegistry.asObservable()]).pipe((0,o.p)(([c,y])=>!!c&&!!y),(0,s.T)(([c,y])=>g({...p,addedComponentsRegistry:c,addedLinksRegistry:y}))),u=p=>h(p).pipe((0,s.T)(c=>c.extensions.filter(y=>y.type===m.u.link))),i=p=>h(p).pipe((0,s.T)(c=>c.extensions.filter(y=>y.type===m.u.component)));function x(p){let c,y;return p.addedComponentsRegistry.asObservable().subscribe(P=>{c=P}),p.addedLinksRegistry.asObservable().subscribe(P=>{y=P}),P=>g({...P,addedComponentsRegistry:c,addedLinksRegistry:y})}const g=({context:p,extensionPointId:c,limitPerPlugin:y,addedLinksRegistry:P,addedComponentsRegistry:d})=>{const D=p?(0,f.$Y)(p):{},b=[],E={};for(const C of P?.[c]??[])try{const{pluginId:S}=C;if(y&&E[S]>=y)continue;E[S]===void 0&&(E[S]=0);const O=a.R.child({pluginId:S,extensionPointId:c,path:C.path??"",title:C.title,de
288scription:C.description??"",onClick:typeof C.onClick}),I=(0,f.hS)(S,C,O,D);if(C.configure&&I===void 0)continue;const R=I?.path||C.path,T={id:(0,f.yt)(S,c,C.title),type:m.u.link,pluginId:S,onClick:(0,f.dx)(S,c,C,O,D),icon:I?.icon||C.icon,title:I?.title||C.title,description:I?.description||C.description||"",path:(0,t.isString)(R)?(0,f.YS)(S,R,c):void 0,category:I?.category||C.category};b.push(T),E[S]+=1}catch(S){S instanceof Error&&a.R.error(S.message,{stack:S.stack??"",message:S.message})}const v=d?.[c]??[];for(const C of v){if(y&&E[C.pluginId]>=y)continue;E[C.pluginId]===void 0&&(E[C.pluginId]=0);const S=a.R.child({title:C.title,description:C.description??"",pluginId:C.pluginId}),O={id:(0,f.yt)(C.pluginId,c,C.title),type:m.u.component,pluginId:C.pluginId,title:C.title,description:C.description??"",component:(0,f.nv)(C.pluginId,C.component,S)};b.push(O),E[C.pluginId]+=1}return{extensions:b}}},96016:(ee,B,e)=>{"use strict";e.d(B,{R:()=>u});var t=e(2543),n=e.n(t),r=e(43561),o=e(39741),s=e(67770),m=e(43173);const a="ui-extension-logs",l=1e3,f=1e3*60*10;class h{constructor(x,g,p){this.baseLabels=x,this.channel=p??new BroadcastChannel(a),this.subject=g??new o.m(l,f),p||(this.channel.onmessage=c=>this.subject.next(c.data))}info(x,g){this.log(s.$b.info,x,g)}warning(x,g){m.$.buildInfo.env==="development"&&console.warn(x,{...this.baseLabels,...g}),this.log(s.$b.warning,x,g)}error(x,g){console.error(x,{...this.baseLabels,...g}),this.log(s.$b.error,x,g)}debug(x,g){this.log(s.$b.debug,x,g)}trace(x,g){this.log(s.$b.trace,x,g)}fatal(x,g){this.log(s.$b.fatal,x,g)}log(x,g,p){const c={...p,...this.baseLabels},{pluginId:y,extensionPointId:P}=c,d={level:x,labels:c,timestamp:Date.now(),id:(0,r.Ak)(),message:g,pluginId:(0,t.isString)(y)?y:void 0,extensionPointId:(0,t.isString)(P)?P:void 0};this.subject.next(d),this.channel.postMessage(d)}asObservable(){return this.subject.asObservable()}child(x){return new h({...x,...this.baseLabels},this.subject,this.channel)}}const u=new h},63629:(ee,B,e)=>{"use strict";e.d(B,{a9:()=>W,rH:()=>j,lQ:()=>w,eY:()=>N,qm:()=>V});var t=e(74848),n=e(54092),r=e(73427),o=e(8535),s=e(96673),m=e(96016),a=e(31439),l=e(35231),f=e(19050),h=e(49987),u=e(39338);function i(){try{return[(0,a.xJ)({title:"Add to dashboard",description:"Use the query and panel from explore and create/add it to a dashboard",targets:[n.S.ExploreToolbarAction],icon:"apps",category:"Dashboards",configure:()=>
288{if(r.TP.hasPermission(s.AccessControlAction.DashboardsCreate)||r.TP.hasPermission(s.AccessControlAction.DashboardsWrite))return{}},onClick:(U,{context:F,openModal:M})=>{M({title:(0,u.t)(),body:({onDismiss:H})=>(0,t.jsx)(h.H,{onClose:H,exploreId:F?.exploreId})})}}),(0,a.xJ)({title:"Add correlation",description:"Create a correlation from this query",targets:[n.S.ExploreToolbarAction],icon:"link",configure:U=>U?.shouldShowAddCorrelation?{}:void 0,onClick:(U,{context:F})=>{(0,o.JD)((0,l.am)({editorMode:!0})),(0,o.JD)((0,f.Od)({exploreId:F.exploreId}))}})]}catch(U){return m.R.warning(`Could not configure extensions for Explore due to: "${U}"`),[]}}function x(){return[...i()]}var g=e(4745),p=e(9453),c=e(13752),y=e(39741),P=e(29405),d=e(96222),D=e(81160),b=e(72985);const E="Cannot register to a read-only registry";class v{constructor(F){if(this.resultSubject=new c.B,this.logger=F.log??m.R,this.isReadOnly=!1,F.registrySubject){this.registrySubject=F.registrySubject,this.isReadOnly=!0;return}this.registrySubject=new y.m(1),this.resultSubject.pipe((0,P.S)(this.mapToRegistry.bind(this),F.initialState??{}),(0,d.Z)(F.initialState??{}),(0,D.T)(M=>
288(0,a.ol)(M))).subscribe(this.registrySubject)}register(F){if(this.isReadOnly)throw new Error(E);this.resultSubject.next(F)}asObservable(){return this.registrySubject.asObservable()}getState(){return(0,b._)(this.asObservable())}}const C="Could not register component extension. Reason:";class S extends v{constructor(F={}){super(F)}mapToRegistry(F,M){const{pluginId:H,configs:_}=M;for(const Z of _){const ne=this.logger.child({description:Z.description,title:Z.title,pluginId:H});if(!Z.title){ne.error(`${C} ${g.o2}`);continue}if(H!=="grafana"&&(0,a.V2)()&&(0,p.dt)(H,Z,ne))continue;const te=Array.isArray(Z.targets)?Z.targets:[Z.targets];for(const Y of te){const Q=ne.child({extensionPointId:Y}),J={pluginId:H,component:(0,a.nv)(H,Z.component,Q),description:Z.description,title:Z.title};Q.debug("Added component extension successfully registered"),Y in F?F[Y].push(J):F[Y]=[J]}}return F}readOnly(){return new S({registrySubject:this.registrySubject})}}var O=e(2543);const I="Could not register function extension. Reason:";class R extends v{constructor(F={}){super(F)}mapToRegistry(F,M){const{pluginId:H,configs:_}=M;for(const Z of _){const ne=this.logger.child({title:Z.title,pluginId:H});if(!Z.title){ne.error(`${I} ${g.o2}`);continue}if(!(0,O.isFunction)(Z.fn)){ne.error(`${I} ${g.bw}`);continue}if(H!=="grafana"&&(0,a.V2)()&&(0,p.SY)(H,Z,ne))continue;const te=Array.isArray(Z.targets)?Z.targets:[Z.targets];for(const Y of te){const Q=ne.child({extensionPointId:Y}),J={pluginId:H,fn:Z.fn,description:Z.description,title:Z.title,extensionPointId:Y};Q.debug("Added function extension successfully registered"),Y in F?F[Y].push(J):F[Y]=[J]}}return F}
288readOnly(){return new R({registrySubject:this.registrySubject})}}const T="Could not register link extension. Reason:";class L extends v{constructor(F={}){super(F)}mapToRegistry(F,M){const{pluginId:H,configs:_}=M;for(const Z of _){const{path:ne,title:te,description:Y,configure:Q,onClick:J,targets:q}=Z,X=this.logger.child({path:ne??"",description:Y??"",title:te,pluginId:H,onClick:typeof J});if(!te){X.error(`${T} ${g.o2}`);continue}if(!(0,p.jk)(Q)){X.error(`${T} ${g.O6}`);continue}if(!ne&&!J){X.error(`${T} ${g.H$}`);continue}if(ne&&!(0,p.kl)(H,ne)){X.error(`${T} ${g.Cf}`);continue}if(H!=="grafana"&&(0,a.V2)()&&(0,p.OO)(H,Z,X))continue;const se=Array.isArray(q)?q:[q];for(const oe of se){const ae=X.child({extensionPointId:oe}),{targets:ie,...fe}=Z;oe in F||(F[oe]=[]),ae.debug("Added link extension successfully registered"),F[oe].push({...fe,pluginId:H,extensionPointId:oe})}}return F}readOnly(){return new L({registrySubject:this.registrySubject})}}const K="Could not register exposed component. Reason:";class A extends v{constructor(F={}){super(F)}mapToRegistry(F,{pluginId:M,configs:H}){if(!H)return F;for(const _ of H){const{id:Z,description:ne,title:te}=_,Y=this.logger.child({extensionPointId:Z,description:ne??"",title:te,pluginId:M});if(!Z.startsWith(M)){Y.error(`${K} ${g.vT}`);continue}if(F[Z]){Y.error(`${K} ${g.Td}`);continue}if(!te){Y.error(`${K} ${g.o2}`);continue}M!=="grafana"&&(0,a.V2)()&&(0,p.nl)(M,_,Y)||(Y.debug("Exposed component extension successfully registered"),F[Z]={..._,pluginId:M})}return F}
288readOnly(){return new A({registrySubject:this.registrySubject})}}const W=new S,N=new A,w=new L,j=new R,V={addedComponentsRegistry:W,exposedComponentsRegistry:N,addedLinksRegistry:w,addedFunctionsRegistry:j};w.register({pluginId:"grafana",configs:x()})},31439:(ee,B,e)=>{"use strict";e.d(B,{$Y:()=>S,Ce:()=>U,N9:()=>K,UX:()=>F,Uy:()=>M,V2:()=>w,Xs:()=>_,YS:()=>N,dx:()=>W,hS:()=>A,mi:()=>Z,nv:()=>D,ol:()=>E,pL:()=>L,uS:()=>j,xJ:()=>R,yt:()=>v});var t=e(74848),n=e(22803),r=e(2543),o=e.n(r),s=e(16817),m=e(20877),a=e(25229),l=e(5556),f=e(54092),h=e(27489),u=e(43173),i=e(22787),x=e(45229),g=e(95027),p=e(87745),c=e(96016),y=e(9453);function P(ne,te=""){return(...Y)=>{try{return ne(...Y)}catch(Q){Q instanceof Error&&console.warn(`${te}${Q.message}`)}}}function d(ne){return async te=>{const{title:Y,body:Q,width:J,height:q}=te;x.A.publish(new p.S8({component:D(ne,b({title:Y,body:Q,width:J,height:q}),c.R)}))}}const D=(ne,te,Y)=>J=>{const{error:q,loading:X,value:se}=(0,s.A)(()=>(0,g.x)(ne,{showErrorAlert:!1}));return X?null:q?(Y.error(`Could not fetch plugin meta information for "${ne}", aborting. (${q.message})`,{stack:q.stack??"",message:q.message}),null):se?(0,t.jsx)(m.a,{meta:se,children:(0,t.jsx)(te,{...J})}):(Y.error(`Fetched plugin meta information is empty for "${ne}", aborting.`),null)},b=({title:ne,body:te,width:Y,height:Q})=>{const J=(0,n.css)({width:Y,height:Q});return({onDismiss:X})=>(0,t.jsx)(i.a,{title:ne,className:J,isOpen:!0,onDismiss:X,onClickBackdrop:X,children:(0,t.jsx)(te,{onDismiss:X})})};function E(ne,te=new Map){if(!ne||typeof ne!="object"||Object.isFrozen(ne))return ne;const Y=Array.isArray(ne)?[...ne]:{...ne};if(te.has(ne))return te.get(ne);te.set(ne,Y);const Q=Reflect.ownKeys(Y);for(const J of Q){const q=Array.isArray(Y)?Y[Number(J)]:Y[J];q&&(typeof q=="object"||typeof q=="function")&&(Array.isArray(Y)?Y[Number(J)]=E(q,te):Y[J]=E(q,te))}return Object.freeze(Y)}function v(ne,te,Y){const Q=`${ne}${te}${Y}`;return Array.from(Q).reduce((J,q)=>Math.imul(31,J)+q.charCodeAt(0)|0,0).toString()}const C=Symbol("isReadOnlyProxy");function S(ne){if(!ne||typeof ne!="object"||I(ne))return ne;const te=new WeakMap;return new Proxy(ne,{defineProperty:()=>!1,deleteProperty:()=>!1,isExtensible:()=>!1,set:()=>!1,get(Y,Q,J){if(Q===C)return!0;const q=Reflect.get(Y,Q,J);return(0,a.Ar)(q)?(0,a.KQ)(q):(0,r.isObject)(q)||(0,r.isArray)(q)?(te.has(q)||te.set(q,S(q)),te.get(q)):q}})}function O(ne){return typeof ne=="object"&&ne!==null}function I(ne){return O(ne)&&ne[C]===!0}function R(ne){const te={...ne};return te}function T(ne){}function L(ne,te){return ne.length<te?ne:`${ne.slice(0,te-3).trimEnd()}...`}function K(ne){const te={},Y=[];for(const J of ne){const q=J.category;if(!q){Y.push({text:L(J.title,25),href:J.path,onClick:J.onClick});continue}Array.isArray(te[q])||(te[q]=[]),te[q].push({text:L(J.title,25),href:J.path,onClick:J.onClick})}const Q=Object.keys(te).reduce((J,q)=>(J.push({text:L(q,25),type:"group",subMenu:te[q]}),J),[]);return Y.length>0&&(Q.length>0&&Q.push({text:"divider",type:"divider"}),Array.prototype.push.apply(Q,Y)),Q}function A(ne,te,Y,Q){try{const J=te.configure?.(Q);if(J===void 0)return;let{title:q=te.title,description:X=te.description,path:se=te.path,icon:oe=te.icon,category:ae=te.category,...ie}=J;return(0,y.lq)(J,`The configure() function for "${te.title}" returned a promise, skipping updates.`),se&&(0,y.wy)(ne,se),(0,y.aY)({title:q,description:X},["title","description"]),Object.keys(ie).length>0&&Y.warning(`Extension "${te.title}", is trying to override restricted properties: ${Object.keys(ie).join(", ")} which will be ignored.`),{title:q,description:X,path:se,icon:oe,category:ae}}catch(J){J instanceof Error&&Y.error(`Failed to configure link with title "${te.title}"`,{stack:J.stack??"",message:J.message});return}}function W(ne,te,Y,Q,J){const{onClick:q}=Y;if(q)return function(se){try{(0,h.rR)("ui_extension_link_clicked",{pluginId:ne,extensionPointId:te,title:Y.title,category:Y.category});const oe={context:J,openModal:d(ne),openSidebar:(ie,fe)=>{x.A.publish(new p.Am({props:fe,pluginId:ne,componentTitle:ie}))}};Q.debug(`onClick '${Y.title}' at '${te}'`);const ae=q(se,oe);(0,y.yL)(ae)&&ae.catch(ie=>{ie instanceof Error&&Q.error(ie.message,{message:ie.message,stack:ie.stack??""})})}catch(oe){oe instanceof Error&&Q.error(oe.message,{message:oe.message,stack:oe.stack??""})}}}function N(ne,te,Y){return l.kM.appendQueryToUrl(te,l.kM.toUrlParams({uel_pid:ne,uel_epid:Y}))}const w=()=>u.$.buildInfo.env==="development",j=(ne=[])=>Object.values(u.$.apps).filter(te=>
288ne.includes(te.id)),V=ne=>ne.split("/")[0],U=ne=>Object.values(u.$.apps).filter(te=>te.extensions.addedLinks.some(Y=>Y.targets.includes(ne))||te.extensions.addedComponents.some(Y=>Y.targets.includes(ne))).map(te=>te.id).reduce((te,Y)=>[...te,Y,...H(Y)],[]),F=ne=>new Map(U(ne).map(te=>{const Y=u.$.apps[te];if(!(!Y||!Y.extensions.addedComponents.some(Q=>Q.targets.includes(ne))&&!Y.extensions.addedLinks.some(Q=>Q.targets.includes(ne))))return[te,{addedComponents:Y.extensions.addedComponents.filter(Q=>Q.targets.includes(ne)),addedLinks:Y.extensions.addedLinks.filter(Q=>Q.targets.includes(ne))}]}).filter(te=>te!==void 0)),M=ne=>[V(ne)].reduce((Y,Q)=>[...Y,Q,...H(Q)],[]),H=(ne,te=[])=>{if(!u.$.apps[ne])return[];if(te.includes(ne))return[];const Y=u.$.apps[ne].dependencies.extensions.exposedComponents.map(V);return Y.reduce((Q,J)=>[...Q,...H(J,[...te,ne])],Y).filter(Q=>Q!==ne)},_=()=>{const ne=["cloud-home-app"];return Object.values(u.$.apps).filter(te=>ne.includes(te.id))},Z=()=>{const ne=U(f.S.DashboardPanelMenu),te=_().map(Q=>Q.id),Y=Q=>!te.includes(Q.id);return Object.values(u.$.apps).filter(Q=>Y(Q)&&(Q.preload||ne.includes(Q.id)))}},9453:(ee,B,e)=>{"use strict";e.d(B,{Fe:()=>h,OO:()=>d,PW:()=>y,SY:()=>D,aY:()=>a,dt:()=>b,jk:()=>x,kl:()=>f,lq:()=>l,nl:()=>E,wy:()=>o,xM:()=>P,yL:()=>p});var t=e(43173),n=e(4745);function r(v,C="extension is not a link extension"){if(!isPluginExtensionLink(v))throw new Error(C)}function o(v,C){if(!f(v,C))throw new Error(`Invalid link extension. The "path" is required and should start with "/a/${v}/" (currently: "${C}"). Skipping the extension.`)}function s(v){if(!c(v))throw new Error('Invalid component extension, the "component" property needs to be a valid React component.')}function m(v){if(!x(v.configure))throw new Error(`Invalid extension "${v.title}". The "configure" property must be a function. Skipping the extension.`)}function a(v,C){for(const S of C)if(!g(v[S]))throw new Error(`Invalid extension "${v.title}". Property "${S}" must be a string and cannot be empty. Skipping the extension.`)}function l(v,C="The provided value is a Promise."){if(p(v))throw new Error(C)}function f(v,C){return!!(typeof C=="string"&&C.length>0&&C.startsWith(`/a/${v}/`))}function h({extensionPointId:v,pluginId:C}){return v.startsWith("grafana/")?!0:!!(v.startsWith(`plugins/${C}/`)||v.startsWith(`${C}/`))}function u(v){return v.match(/.*\/v\d+$/)}function i(v){return Object.values(PluginExtensionPoints).map(C=>C.toString()).includes(v)}function x(v){return v?typeof v=="function":!0}function g(v){return typeof v=="string"&&v.length>0}function p(v){return v instanceof Promise||typeof v=="object"&&v!==null&&"then"in v&&"catch"in v}function c(v){const C=O=>typeof O=="object"&&O!==null&&"$$typeof"in O;return typeof v=="function"||(O=>C(O)&&O.$$typeof===Symbol.for("react.memo"))(v)}const y=(v,C)=>{const S=C.meta?.extensions?.extensionPoints;return!S||!S.some(O=>O.id===v)},P=(v,C)=>{const S=C.meta?.dependencies?.extensions?.exposedComponents;return!S||!S.includes(v)},d=(v,C,S)=>{const O="Could not register link extension. Reason:",I=t.$.apps[v],R=I?I.extensions.addedLinks.find(({title:L})=>L===C.title):null;return I?R?(Array.isArray(C.targets)?C.targets:[C.targets]).every(L=>R.targets.includes(L))?(R.description!==C.description&&S.warning(n.cu),!1):(S.error(`${O} ${n.Bc}`),!0):(S.error(`${O} ${n.iS}`),!0):(S.error(`${O} ${n.$$(v)}`),!0)},D=(v,C,S)=>{const O="Could not register function extension. Reason:",I=t.$.apps[v],R=I?I.extensions.addedFunctions.find(({title:L})=>L===C.title):null;return I?R?(Array.isArray(C.targets)?C.targets:[C.targets]).every(L=>R.targets.includes(L))?(R.description!==C.description&&S.warning(n.cu),!1):(S.error(`${O} ${n.Bc}`),!0):(S.error(`${O} ${n.E5}`),!0):(S.error(`${O} ${n.$$(v)}`),!0)},b=(v,C,S)=>{const O="Could not register component extension. Reason:",I=t.$.apps[v],R=I?I.extensions.addedComponents.find(({title:L})=>L===C.title):null;return I?R?(Array.isArray(C.targets)?C.targets:[C.targets]).every(L=>R.targets.includes(L))?(R.description!==C.description&&S.warning(n.cu),!1):(S.error(`${O} ${n.Bc}`),!0):(S.error(`${O} ${n.FL}`),!0):(S.error(`${O} ${n.$$(v)}`),!0)},E=(v,C,S)=>{const O="Could not register exposed component extension. Reason:",I=t.$.apps[v],R=I?I.extensions.exposedComponents.find(({id:T})=>T===C.id):null;return I?R?R.title!==C.title?(S.error(`${O} ${n.sm}`),!0):(R.description!==C.description&&S.warning(n.cu),!1):(S.error(`${O} ${n.z5}`),!0):(S.error(`${O} ${n.$$(v)}`),!0)}},92391:(ee,B,e)=>{"use strict";e.d(B,{Kk:()=>u,PY:()=>i,TV:()=>l,d4:()=>h,oZ:()=>f});var t=e(78830),n=e(11594),r=e(65642),o=e(41097),s=e(80185);const m={},a={};function l(g){const p=m[g];if(p)return p;const c=h(g);if(!c)throw new Error(`Plugin ${g} not found`);return m[g]=x(c),g!==c.type&&(m[c.type]=m[g]),m[g]}function f(g){return!!h(g)}function h(g){const p=r.Ay.panels[g];if(!p){for(const c of Object.values(r.Ay.panels))if(c.aliasIDs?.includes(g))return c}return p}function u(g){return x(g)}function i(g){return a[g]}function x(g){(0,t.M)(g);const p=g.loadingStrategy??n.xf.fetch;return(0,s.j4)({path:g.module,version:g.info?.version,loadingStrategy:p,pluginId:g.id,moduleHash:g.moduleHash,translations:g.translations}).then(c=>{if(c.plugin)return c.plugin;throw(0,t.M)(c),new Error("missing export: plugin")}).then(c=>
288(c.meta=g,a[g.id]=c,c)).catch(c=>(console.warn("Error loading panel plugin: "+g.id,c),(0,o.W)(g,c)))}},19203:(ee,B,e)=>{"use strict";e.d(B,{GD:()=>o,QO:()=>a,ni:()=>m,sk:()=>s});var t=e(95027),n=e(98060);const r={};function o({path:h,version:u,loadingStrategy:i}){const x=l(h);x&&!r[x]&&(r[x]={version:encodeURI(u),loadingStrategy:i})}function s(h){const u=h;r[u]&&delete r[u],(0,t.o)(h)}function m(h,u=n.x8){const i=f(h);if(!i)return`${h}?_cache=${u}`;const g=r[i]?.version||u;return`${h}?_cache=${g}`}function a(h){const u=f(h);if(u)return r[u]}function l(h){const u=/\/?public\/plugins\/([^\/]+)\//,i=h.match(u);return i?i[1]:null}function f(h){const u=Object.keys(r).find(i=>h.includes(i));if(u)return u}},98060:(ee,B,e)=>{"use strict";e.d(B,{$b:()=>n,Bu:()=>r,XV:()=>t,x8:()=>o});const t="package",n=/^plugins.+\.css$/i,r=/^(text|application)\/(x-)?javascript(;|$)/,o=Date.now()},95027:(ee,B,e)=>{"use strict";e.d(B,{o:()=>o,x:()=>r});var t=e(68143);const n={};function r(s,m){const a=n[s];return a?Promise.resolve(a):(0,t.AI)().get(`/api/plugins/${s}/settings`,void 0,void 0,m).then(l=>(n[s]=l,l)).catch(l=>typeof l=="object"&&l!==null&&"status"in l&&l.status===403?(l.isHandled=!0,Promise.reject(l)):Promise.reject(new Error("Unknown Plugin")))}const o=s=>s?delete n[s]:Object.keys(n).forEach(m=>delete n[m])},80185:(ee,B,e)=>{"use strict";e.d(B,{ui:()=>Sr,cS:()=>Qs,j4:()=>Ks});var t={};e.r(t),e.d(t,{default:()=>Oe});var n={};e.r(n),e.d(n,{getPrecision:()=>Et,getScaledDecimals:()=>Xe,getStringPrecision:()=>Tt,grafanaTimeFormat:()=>st,logp:()=>lt,tickStep:()=>Be});var r=e(11594),o=e(78830),s=e(94644),m=e(1906),a=e(74241),l=e(43173),f=e(56840);const ae={"core:plugin/graphite":async()=>await e.e(6134).then(e.bind(e,28947)),"core:plugin/cloudwatch":async()=>await Promise.all([e.e(7445),e.e(7788),e.e(479),e.e(5074),e.e(5610),e.e(3766)]).then(e.bind(e,65610)),"core:plugin/dashboard":async()=>await e.e(2400).then(e.bind(e,52400)),"core:plugin/elasticsearch":async()=>await Promise.all([e.e(7445),e.e(7788),e.e(479),e.e(5074),e.e(4292),e.e(542),e.e(1717)]).then(e.bind(e,70542)),"core:plugin/opentsdb":async()=>await e.e(747).then(e.bind(e,90400)),"core:plugin/grafana":async()=>await e.e(3648).then(e.bind(e,51309)),"core:plugin/influxdb":async()=>await Promise.all([e.e(7445),e.e(7788),e.e(9404)]).then(e.bind(e,94822)),"core:plugin/loki":async()=>await Promise.all([e.e(479),e.e(4162),e.e(4292),e.e(3273),e.e(1477)]).then(e.bind(e,13273)),"core:plugin/mixed":async()=>await e.e(2513).then(e.bind(e,95637)),"core:plugin/prometheus":async()=>await Promise.all([e.e(7445),e.e(7788),e.e(479),e.e(5074),e.e(4292),e.e(6356),e.e(9546)]).then(e.bind(e,6356)),"core:plugin/alertmanager":async()=>await Promise.all([e.e(7445),e.e(7788),e.e(479),e.e(5074),e.e(4737)]).then(e.bind(e,30876)),"core:plugin/text":async()=>await e.e(404).then(e.bind(e,16373)),"core:plugin/timeseries":async()=>await Promise.all([e.e(5872),e.e(362),e.e(7011),e.e(5428),e.e(9170),e.e(563)]).then(e.bind(e,55569)),"core:plugin/trend":async()=>await Promise.all([e.e(5872),e.e(5428),e.e(2666)]).then(e.bind(e,96827)),"core:plugin/state-timeline":async()=>await Promise.all([e.e(5872),e.e(8706),e.e(7011),e.e(6199)]).then(e.bind(e,44372)),"core:plugin/status-history":async()=>await Promise.all([e.e(5872),e.e(8706),e.e(7011),e.e(8259)]).then(e.bind(e,24181)),"core:plugin/candlestick":async()=>await Promise.all([e.e(5872),e.e(362),e.e(7011),e.e(5428),e.e(9170),e.e(3090)]).then(e.bind(e,80959)),"core:plugin/xychart":async()=>await Promise.all([e.e(5872),e.e(348),e.e(5594)]).then(e.bind(e,87254)),"core:plugin/geomap":async()=>await Promise.all([e.e(362),e.e(8706),e.e(3474),e.e(6186),e.e(678),e.e(190)]).then(e.bind(e,99620)),"core:plugin/canvas":async()=>await Promise.all([e.e(5872),e.e(6186),e.e(7523)]).then(e.bind(e,25651)),"core:plugin/dashlist":async()=>await e.e(8995).then(e.bind(e,30783)),"core:plugin/alertlist":async()=>await e.e(3375).then(e.bind(e,12915)),"core:plugin/annolist":async()=>await e.e(4979).then(e.bind(e,80537)),"core:plugin/heatmap":async()=>await Promise.all([e.e(5872),e.e(362),e.e(407),e.e(5995),e.e(7011),e.e(348),e.e(5857)]).then(e.bind(e,17933)),"core:plugin/table":async()=>l.$.featureToggles.tableNextGen?await Promise.all([e.e(893),e.e(7794)]).then(e.bind(e,5631)):await e.e(3525).then(e.bind(e,45730)),"core:plugin/ne
288ws":async()=>await e.e(4940).then(e.bind(e,49405)),"core:plugin/live":async()=>await e.e(5413).then(e.bind(e,8149)),"core:plugin/stat":async()=>await Promise.resolve().then(e.bind(e,75663)),"core:plugin/datagrid":async()=>await Promise.all([e.e(7445),e.e(2218),e.e(5939)]).then(e.bind(e,42218)),"core:plugin/debug":async()=>await Promise.all([e.e(362),e.e(2770)]).then(e.bind(e,54952)),"core:plugin/flamegraph":async()=>await Promise.all([e.e(407),e.e(5995),e.e(20),e.e(5686)]).then(e.bind(e,27281)),"core:plugin/gettingstarted":async()=>await e.e(9142).then(e.bind(e,38627)),"core:plugin/gauge":async()=>await Promise.resolve().then(e.bind(e,71843)),"core:plugin/piechart":async()=>await e.e(6105).then(e.bind(e,96894)),"core:plugin/bargauge":async()=>await e.e(3851).then(e.bind(e,62493)),"core:plugin/barchart":async()=>await Promise.all([e.e(5872),e.e(8706),e.e(3124)]).then(e.bind(e,24131)),"core:plugin/logs":async()=>await Promise.all([e.e(4162),e.e(7112),e.e(7884)]).then(e.bind(e,2001)),"core:plugin/logs-new":async()=>await Promise.all([e.e(4162),e.e(7112),e.e(4340),e.e(3976)]).then(e.bind(e,6567)),"core:plugin/traces":async()=>await Promise.all([e.e(407),e.e(5995),e.e(20),e.e(2609),e.e(4301)]).then(e.bind(e,3627)),"core:plugin/welcome":async()=>await e.e(8463).then(e.bind(e,21369)),"core:plugin/nodeGraph":async()=>await Promise.all([e.e(3474),e.e(9147),e.e(7317)]).then(e.bind(e,39053)),"core:plugin/histogram":async()=>await Promise.all([e.e(5872),e.e(323)]).then(e.bind(e,65672))};var ie=e(63629),fe=e(19203),pe=e(59511),de=e(65024),le=e(82093);const me=window.System;var De=e(34796),Te=e.n(De),Ne=e(54087),Ce=e(80851),He=e(32176),ke=e(31221),Me=e(91520),$e=e(92275),tt=e(82013),Ke=e(2341),Re=e(19538),Ve=e(16207),Qe=e(6199),je=e(33239),ze=e(92243),Ye=e(26527),Ge=e(873),ce=e(65642),Pe=e(73427),Se=e(83873),Ee=e(67020),xe=e(58047),ye=e(49344);function Oe(dt,Ut){Ut=Ut||{};const kt=Ut.delimiter||".";let on=Ut.maxDepth||3,pn=1;const Tn={};function Kn(Mn,Jn){Object.entries(Mn).forEach(([pa,ia])=>{const va=Ut?.safe&&Array.isArray(ia),us=Object.prototype.toString.call(ia)==="[object Object]",ks=Jn?Jn+kt+pa:pa;if(Ut?.maxDepth||(on=pn+1),!va&&us&&Object.keys(ia).length&&pn<on)return++pn,Kn(ia,ks);Tn[ks]=ia})}return Kn(dt,null),Tn}var we=e(77197);function Be(dt,Ut,kt){const on=Math.sqrt(50),pn=Math.sqrt(10),Tn=Math.sqrt(2),Kn=Math.abs(Ut-dt)/Math.max(0,kt);let Mn=Math.pow(10,Math.floor(Math.log(Kn)/Math.LN10));const Jn=Kn/Mn;return Jn>=on?Mn*=10:Jn>=pn?Mn*=5:Jn>=Tn&&(Mn*=2),Ut<dt?-Mn:Mn}function Xe(dt,Ut){return dt-Math.floor(Math.log(Ut)/Math.LN10)}function st(dt,Ut,kt){if(Ut&&kt&&dt){const on=kt-Ut,pn=on/dt/1e3,Tn=864e5,Kn=31536e6;return pn<=45?"HH:mm:ss":pn<=7200||on<=Tn?"HH:mm":pn<=8e4?"MM/DD HH:mm":pn<=2419200||on<=Kn?"MM/DD":"YYYY-MM"}return"HH:mm"}function lt(dt,Ut){return Math.log(dt)/Math.log(Ut)}function Et(dt){const Ut=dt.toString();return Tt(Ut)}function Tt(dt){if(isNaN(dt))return 0;const Ut=dt.indexOf(".");return Ut===-1?0:dt.length-Ut-1}const Mt=Ye;Mt.PanelPlugin=Ve.m,Mt.DataSourcePlugin=s.tD,Mt.AppPlugin=m.hX,Mt.DataSourceApi=s.mA;const wt=["jquery.flot.crosshair","jquery.flot.events","jquery.flot.fillbelow","jquery.flot.gauge","jquery.flot.pie","jquery.flot.selection","jquery.flot.stack","jquery.flot.stackpercent","jquery.flot.time","jquery.flot"].reduce((dt,Ut)=>({...dt,[Ut]:{fakeDep:1}}),{}),_e={"@emotion/css":()=>Promise.resolve().then(e.bind(e,22803)),"@emotion/react":()=>Promise.resolve().then(e.bind(e,17437)),"@grafana/data":Qe,"@grafana/data/unstable":()=>e.e(2223).then(e.bind(e,2223)),"@grafana/runtime":ze,"@grafana/runtime/unstable":()=>e.e(3259).then(e.bind(e,83259)),"@grafana/slate-react":()=>Promise.resolve().then(e.bind(e,29317)),"@grafana/ui":Mt,"@grafana/ui/unstable":()=>Promise.all([e.e(893),e.e(1492)]).then(e.bind(e,58045)),"@kusto/monaco-kusto":()=>Promise.all([e.e(630),e.e(7396),e.e(4350)]).then(e.bind(e,20582)),"app/core/app_events":{default:Pe.lE,__useDefault:!0},"app/core/config":{default:ce.Ay,__useDefault:!0},"app/core/core":{appEvents:Pe.lE,contextSrv:Pe.TP},"app/core/services/backend_srv":{BackendSrv:Se.Mf,getBackendSrv:Se.AI},"app/core/table_model":{default:Ge.A,__useDefault:!0},"app/core/time_series":{default:xe.A,__useDefault:!0},"app/core/time_series2":{default:xe.A,__useDefault:!0},"app/core/utils/datemath":je,"app/core/utils/flatten":t,"app/core/utils/kbn":{default:we.A,__useDefault:!0},"app/core/utils/ticks":n,"app/features/dashboard/impression_store":{impressions:Ee.A},d3:()=>Promise.all([e.e(407),e.e(5995)]).then(e.bind(e,55995)),emotion:()=>Promise.resolve().then(e.bind(e,22803)),i18next:()=>Promise.resolve().then(e.bind(e,72635)),jquery:{default:Te(),__useDefault:!0},...wt,lodash:()=>Promise.resolve().then(e.t.bind(e,2543,23)).then(dt=>({...dt,move:ye.b,__useDefault:!0})),moment:()=>Promise.resolve().then(e.t.bind(e,95093,23)).then(dt=>({...dt,__useDefault:!0})),prismjs:()=>Promise.resolve().then(e.t.bind(e,28848,23)),react:()=>Promise.resolve().then(e.t.bind(e,96540,19)),"react-dom":()=>Promise.resolve().then(e.t.bind(e,40961,19)),"react-inlinesvg":()=>Promise.resolve().then(e.bind(e,55494)),"react-redux":()=>Promise.resolve().then(e.bind(e,71468)),"react-router-dom":()=>Promise.resolve().then(e.bind(e,71519)),"react-router":()=>Promise.resolve().then(e.bind(e,35557)),redux:()=>Promise.resolve().then(e.bind(e,14644)),rxjs:()=>Promise.all([e.e(4251),e.e(5091)]).then(e.bind(e,75091)),"rxjs/operators":()=>Promise.all([e.e(4251),e.e(2975)]).then(e.bind(e,32975)),slate:()=>Promise.resolve().then(e.bind(e,82611)),"slate-plain-serializer":()=>Promise.resolve().then(e.bind(e,52845)),"slate-react":()=>Promise.resolve().then(e.bind(e,29317))};function xt({url:dt,source:Ut,transformSourceMapURL:kt=!1,transformAssets:on=!0}){const pn=dt.split("/public/plugins/"),Tn=pn[0],Kn=pn[1].split("/")[0];let Mn=Ut;return on&&(Mn=Mn.replace(/(\/?)(public\/plugins)/g,`${Tn}/$2`),Mn=Mn.replace(/(["|'])(plugins\/.+?.css)(["|'])/g,`$1${Tn}/public/$2$3`)),kt&&(Mn=Mn.replace(/(\/\/#\ssourceMappingURL=)(.+)\.map/g,`$1${Tn}/public/plugins/${Kn}/$2.map`)),Mn}var At=e(98060);const bt=new Map([]);function Xt(dt){return Object.keys(dt).reduce((Ut,kt)=>{const on=`${At.XV}:${kt}`;return Cn(on,dt[kt]),bt.set(kt,dt[kt]),Ut[kt]=on,Ut},{})}function Cn(dt,Ut){if(me.has(dt))return;let kt;try{kt=me.resolve(dt)}catch(pn){console.log(pn)}if(kt&&me.has(kt))return;const on=kt||dt;typeof Ut=="function"?me.register(dt,[],pn=>({execute:async function(){const Tn=await Ut();pn(Tn)}})):me.set(on,Ut)}function vn(dt){return!!l.$.pluginsCDNBaseURL&&dt.startsWith(l.$.pluginsCDNBaseURL)}function Wn(dt){return dt.startsWith("http")||dt.startsWith("/")?dt:`${l.$.appSubUrl??""}/${dt}`}async function Dt(dt,Ut,kt){const on=await dt(Ut,kt),pn=on.headers.get("content-type")||"";if(At.Bu.test(pn)){let Kn=await on.text();if(vn(on.url)){const Mn=xt({url:on.url,source:Kn});
288return new Response(new Blob([Mn],{type:"text/javascript"}))}return new Response(new Blob([Kn],{type:"text/javascript"}))}return on}function qt(dt,Ut,kt){try{const on=dt.apply(this,[Ut,kt]),pn=nn(on);return(pn.endsWith(".js")||pn.endsWith(".css"))&&!vn(pn)?(0,fe.ni)(pn):pn}catch{if(At.$b.test(Ut)){const pn=Zt(Ut),Tn=dt.apply(this,[pn,kt]);return(0,fe.ni)(Tn)}return console.warn(`SystemJS: failed to resolve '${Ut}'`),Ut}}function Yt(dt,Ut){if(new URL(Ut,window.location.origin).pathname.endsWith(".css")&&!dt){const pn=me.get(Ut)?.default;pn&&(document.adoptedStyleSheets=[...document.adoptedStyleSheets,pn])}}function nn(dt){return dt.startsWith(`${At.XV}:`)?dt:(dt.endsWith("!")&&(dt=dt.slice(0,-1)),["css","js","json","wasm"].some(on=>dt.endsWith(on))?dt:dt+".js")}function Zt(dt){const Ut=dt.split("/")[1];let kt="";for(const[Tn]of me.entries())if(Tn.includes(Ut)){kt=Tn;break}const on=kt.lastIndexOf("/plugins");return on===-1?`${l.$.appSubUrl??""}/public/${dt}`:`${kt.substring(0,on)}/${dt}`}var tn=e(44436),ft=e(48307),Rt=e(44326);function Bt(dt){const Ut=new URL(window.location.href),kt=new URL(dt);return Ut.host===kt.host}async function jt(dt,Ut){let kt="";if(Bt(dt)?(kt=await(await fetch(dt)).text(),kt=xt({url:dt,source:kt,transformSourceMapURL:!0,transformAssets:!1})):vn(dt)&&(kt=await(await fetch(dt)).text(),kt=xt({url:dt,source:kt,transformSourceMapURL:!0,transformAssets:!0})),kt.length===0)throw new Error("Only same domain scripts are allowed in sandboxed plugins");kt=an(kt),Ut.evaluate(kt)}async function Nt(dt){if(vn(dt.module)){const Ut=dt.module;let on=await(await fetch(Ut)).text();if(!$t(on,dt.moduleHash))throw new Error("Invalid SRI for plugin module file");return on=xt({url:Ut,source:on,transformSourceMapURL:!0,transformAssets:!0}),on}else{let Ut=Wn(dt.module);const kt=(0,fe.ni)(Ut);let pn=await(await fetch(kt)).text();if(!$t(pn,dt.moduleHash))throw new Error("Invalid SRI for plugin module file");return pn=xt({url:kt,source:pn,transformSourceMapURL:!0,transformAssets:!1}),pn=an(pn),pn}}async function $t(dt,Ut){if(!l.$.featureToggles.pluginsSriChecks||!Ut||Ut.length===0)return!0;const[kt,on]=Ut.split("-"),pn=kt.replace("sha","SHA-"),Kn=new TextEncoder().encode(dt),Mn=await crypto.subtle.digest(pn,Kn),Jn=btoa(String.fromCharCode(...new Uint8Array(Mn)));return`${kt}-${Jn}`===Ut}function an(dt){return dt.replace(/window\.location/gi,"window.locationSandbox")}function Jt(dt){dt.evaluate(`${Rt.V.toString()};${Rt.V.name}()`)}
288function gn(dt){for(const Ut of Object.values(l.$.datasources))if(Ut.type===dt)return Ut.meta;for(const Ut of Object.values(l.$.panels))if(Ut.id===dt)return Ut;for(const Ut of Object.values(l.$.apps))if(Ut.id===dt)return{id:dt,type:r.QE.app,module:Ut.path,moduleHash:Ut.moduleHash};throw new Error(`Could not find plugin ${dt}`)}var mn=e(99418),_t=e(2543);const On=["iframe"];var Nn=e(7077),Fn=e(28848),na=e.n(Fn),aa=e(48592),yt=e(96540),mt=e(25992);const Ot=!!l.$.featureToggles.frontendSandboxMonitorOnly;function Wt(dt){return!!dt&&typeof dt=="object"&&dt?.hasOwnProperty("plugin")}function et(dt){throw new Error(`Unexpected object: ${dt}. This should never happen.`)}const Je=(0,mt.DW)("sandbox",{monitorOnly:String(Ot)});function rt(dt){return dt instanceof yt.Component}function it(dt,Ut){Je.logWarning(dt,Ut)}function Pt(dt,Ut){Je.logError(dt,Ut)}function It(dt,Ut){Je.logInfo(dt,Ut)}function Vt(dt){return dt?.constructor?.name==="RegExp"}function en(dt){return dt&&(Vt(dt)&&(0,Nn.U)(dt)?new RegExp(dt):Array.isArray(dt)?dt.map(en):typeof dt=="object"?Object.keys(dt).reduce((Ut,kt)=>(Reflect.set(Ut,kt,en(Reflect.get(dt,kt))),Ut),{}):dt)}function ln(dt){return dt&&((0,Nn.U)(dt)?(0,_t.cloneDeep)(dt):Array.isArray(dt)?dt.map(ln):typeof dt=="object"?Object.keys(dt).reduce((Ut,kt)=>(Reflect.set(Ut,kt,ln(Reflect.get(dt,kt))),Ut),{}):dt)}const Qt=Symbol.for("@@SANDBOX_LIVE_VALUE"),xn=!!l.$.featureToggles.frontendSandboxMonitorOnly;function En(dt,Ut){const kt=Reflect.get(dt,"nodeName");if(kt==="body"||dt===document.body)return document.body;if(kt==="head"||dt===document.head||dt===document.documentElement)return dt;if(On.includes(kt)&&(it("<"+kt+"> is not allowed in sandboxed plugins",{pluginId:Ut,param:kt}),!xn))throw new Error("<"+kt+"> is not allowed in sandboxed plugins");if(bn(dt,Ut)||dt.parentNode===document.body||dt.closest("#reactRoot")===null||xn)return dt;{const on=document.createElement(kt);return on.dataset.grafanaPluginSandboxElement="true",on}}function zn(dt){if(typeof dt=="object"&&dt instanceof Element)try{return dt.nodeName!==void 0}catch{return!1}return!1}function Gn(dt){const Ut=Reflect.get(dt,"style");Object.hasOwn(Ut,Qt)||Reflect.defineProperty(Ut,Qt,{})}function St(dt){dt&&(Array.isArray(dt)?(dt.forEach(St),Ht(dt)):typeof dt=="object"&&(Object.values(dt).forEach(St),Ht(dt)))}function Ht(dt){if(dt)return Object.hasOwn(dt,Qt)||Reflect.defineProperty(dt,Qt,{}),dt}function cn(dt){dt&&(Object.hasOwn(dt,Qt)||((0,Nn.U)(dt)&&!(dt instanceof Function)&&(rt(dt)||dt instanceof s.mA||dt instanceof aa.f5)?Reflect.defineProperty(dt,Qt,{}):dt===na().languages&&Object.defineProperty(dt,Qt,{})))}function un(dt){return Object.hasOwn(dt,Qt)}function bn(dt,Ut){return!document.contains(dt)||dt.closest(`[data-plugin-sandbox=${Ut}]`)!==null}let Sn;function wn(){return Sn||(Sn=document.createElement("div"),Sn.setAttribute("id","grafana-plugin-sandbox-body"),Sn.setAttribute("data-plugin-sandbox","true"),Sn.dataset.pluginSandbox="sandboxed-plugin",Sn.style.width="100%",Sn.style.height="0%",Sn.style.overflow="hidden",Sn.style.top="0",Sn.style.left="0",document.body.appendChild(Sn)),Sn}let ea=!1;function Zn(){ea||(ea=!0,_n(),Vn())}function Vn(){const dt=Worker.prototype.postMessage;Object.defineProperty(Worker.prototype,"postMessage",{value:function(...Ut){return dt.apply(this,ln(Ut))}})}function _n(){const dt=window.history.replaceState;Object.defineProperty(window.history,"replaceState",{value:function(...Ut){let kt=Ut;try{kt=(0,_t.cloneDeep)(Ut)}catch(on){it("Error cloning args in window.history.replaceState",{error:String(on)})}return Reflect.apply(dt,this,kt)},writable:!0,configurable:!0,enumerable:!1})}const Ln=new Map,Xn=!!l.$.featureToggles.frontendSandboxMonitorOnly,ma=Symbol.for("@SANDBOX_LIVE_API_PATCHED");function Ca(){return Ln.size===0&&(Qn(Ln),Ha(Ln),ba(Ln),br(Ln),Ds(Ln),Ps(Ln),Ms(Ln),$r(Ln),zr(Ln),sr(Ln),Gs(Ln),ka(Ln)),Ln}function Da(dt,Ut){return it(`Plugin ${Ut.id} tried to set a sandboxed property`,{pluginId:Ut.id,attrOrMethod:String(dt),entity:"window"}),Xn?dt:()=>{throw new Error("Plugins are not allowed to set sandboxed properties")}}function Qn(dt){const Ut=["contentDocument","contentWindow","src","srcdoc","srcObject","srcset"];for(const on of Ut){const pn=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,on);if(pn){let Tn=function(Kn,Mn){const Jn=Mn.id;return it(`Plugin ${Jn} tried to access iframe.${on}`,{pluginId:Jn,attrOrMethod:on,entity:"iframe"}),Xn?Kn:()=>{throw new Error("iframe."+on+" is not allowed in sandboxed plugins")}};var kt=Tn;pn.value&&dt.set(pn.value,Tn),pn.set&&dt.set(pn.set,Tn),pn.get&&dt.set(pn.get,Tn)}}}function Ha(dt){const Ut=Object.getOwnPropertyDescriptor(window,"console");if(Ut?.value){let on=function(pn,Tn){const Kn=Tn.id;if(Xn)return pn;function Mn(...Jn){console.log(`[plugin ${Kn}]`,...Jn)}return{log:Mn,warn:Mn,error:Mn,info:Mn,debug:Mn,table:Mn}};var kt=on;dt.set(Ut.value,on)}Ut?.set&&dt.set(Ut.set,Da)}function ba(dt){function Ut(on,pn){const Tn=pn.id;return it(`Plugin ${Tn} accessed window.alert`,{pluginId:Tn,attrOrMethod:"alert",entity:"window"}),Xn?on:function(...Kn){console.log(`[plugin ${Tn}]`,...Kn)}}const kt=Object.getOwnPropertyDescriptor(window,"alert");kt?.value&&dt.set(kt.value,Ut),kt?.set&&dt.set(kt.set,Da)}function Ps(dt){function Ut(on,pn){const Tn=pn.id;return function(...Mn){for(let Jn=0;Jn<Mn.length;Jn++){const pa=Mn[Jn],ia=String(pa||"").toLowerCase();for(const va of On)if(ia.includes("<"+va)){if(it(`Plugin ${Tn} tried to set ${va} in innerHTML`,{pluginId:Tn,attrOrMethod:"innerHTML",param:va,entity:"HTMLElement"}),Xn)continue;throw new Error("<"+va+"> is not allowed in sandboxed plugins")}ia.match(/onerror|onload|onsuccess|onbeforeunload/)&&(it(`Plugin ${Tn} tried to set forbidden attribute in innerHTML`,{pluginId:Tn,attrOrMethod:"innerHTML",param:pa,entity:"HTMLElement"}),Mn[Jn]=mn.A.sanitize(Mn[Jn]))}if((0,_t.isFunction)(on))return on.apply(this,Mn)}}const kt=[Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML"),Object.getOwnPropertyDescriptor(Element.prototype,"outerHTML"),Object.getOwnPropertyDescriptor(Element.prototype,"insertAdjacentHTML"),Object.getOwnPropertyDescriptor(DOMParser.prototype,"parseFromString")];for(const on of kt)on?.set&&dt.set(on.set,Ut),on?.value&&dt.set(on.value,Ut)}function Ms(dt){function Ut(on,pn){const Tn=pn.id;return function(Mn,Jn){if(Mn&&On.includes(Mn)&&(it(`Plugin ${Tn} tried to create ${Mn}`,{pluginId:Tn,attrOrMethod:"createElement",param:Mn,entity:"document"}),!Xn))return document.createDocumentFragment();if((0,_t.isFunction)(on))return on.apply(this,[Mn,Jn])}}const kt=Object.getOwnPropertyDescriptor(Document.prototype,"createElement");kt?.value&&dt.set(kt.value,Ut)}function Ds(dt){function Ut(Tn,Kn){const Mn=Kn.id;return function(pa,ia){const va=pa?.nodeName?.toLowerCase()||"";if(pa&&On.includes(va)&&(it(`Plugin ${Mn} tried to insert ${va}`,{pluginId:Mn,attrOrMethod:"insertChild",param:va,entity:"HTMLElement"}),!Xn))return document.createDocumentFragment();if((0,_t.isFunction)(Tn))return Tn.call(this,pa,ia)}}function kt(Tn,Kn){const Mn=Kn.id;return function(pa,ia){const va=ia?.nodeName?.toLowerCase()||"";if(ia&&On.includes(va)&&(it(`Plugin ${Mn} tried to insert ${va}`,{pluginId:Mn,attrOrMethod:"insertAdjacentElement",param:va,entity:"HTMLElement"}),!Xn))return document.createDocumentFragment();if((0,_t.isFunction)(Tn))return Tn.call(this,pa,ia)}}const on=[Object.getOwnPropertyDescriptor(Node.prototype,"insertBefore"),Object.getOwnPropertyDescriptor(Node.prototype,"replaceChild")];for(const Tn of on)Tn?.value&&dt.set(Tn.set,Ut);const pn=Object.getOwnPropertyDescriptor(Element.prototype,"insertAdjacentElement");pn?.value&&dt.set(pn.set,kt)}function br(dt){function Ut(Tn,Kn){const Mn=Kn.id;return function(...pa){let ia=pa;const va=pa?.filter(Ba=>!On.includes(Ba.nodeName.toLowerCase()));Xn||(ia=va),ia.length!==va.length&&it(`Plugin ${Mn} tried to append fobiddenElements`,{pluginId:Mn,attrOrMethod:"append",param:pa?.filter(Ba=>On.includes(Ba.nodeName.toLowerCase()))?.join(",")||"",entity:"HTMLElement"}),(0,_t.isFunction)(Tn)&&Tn.apply(this,ia)}}function kt(Tn,Kn,Mn){const Jn=Kn.id;return function(ia){const va=ia?.nodeName?.toLowerCase()||"";if(ia&&On.includes(va)&&(it(`Plugin ${Jn} tried to append ${va}`,{pluginId:Jn,attrOrMethod:"appendChild",param:va,entity:"HTMLElement"}),!Xn))return document.createDocumentFragment();if(Mn&&ia&&va==="script"&&ia instanceof HTMLScriptElement){jt(ia.src,Mn).then(()=>{ia.onload?.call(ia,new Event("load"))}).catch(Ba=>{ia.onerror?.call(ia,new ErrorEvent("error",{error:Ba}
288))});return}if((0,_t.isFunction)(Tn))return Tn.call(this,ia)}}const on=[Object.getOwnPropertyDescriptor(Element.prototype,"append"),Object.getOwnPropertyDescriptor(Element.prototype,"prepend"),Object.getOwnPropertyDescriptor(Element.prototype,"after"),Object.getOwnPropertyDescriptor(Element.prototype,"before"),Object.getOwnPropertyDescriptor(Document.prototype,"append"),Object.getOwnPropertyDescriptor(Document.prototype,"prepend")];for(const Tn of on)Tn?.value&&dt.set(Tn.value,Ut);const pn=Object.getOwnPropertyDescriptor(Node.prototype,"appendChild");pn?.value&&dt.set(pn.value,kt)}function $r(dt){const Ut=Object.getOwnPropertyDescriptor(Worker.prototype,"postMessage");function kt(on){return function(...Tn){try{const Kn=(0,_t.cloneDeep)(Tn);(0,_t.isFunction)(on)&&on.apply(this,Kn)}catch{throw new Error("postMessage arguments are invalid objects")}}}Ut?.value&&dt.set(Ut.value,kt)}function zr(dt){const Ut=Object.getOwnPropertyDescriptor(Document.prototype,"defaultView");Ut?.get&&dt.set(Ut.get,()=>()=>window);const kt=["write"];for(const on of kt){const pn=Object.getOwnPropertyDescriptor(Document.prototype,on);pn?.set&&dt.set(pn.set,Da),pn?.value&&dt.set(pn.value,Da)}}async function sr(dt){const Ut=Reflect.get(window,"monaco");if(!Ut||Object.hasOwn(Ut,ma))return;const kt=Ut.languages.setMonarchTokensProvider;function on(){return function(...pn){return pn.length!==2?kt.apply(Ut,pn):kt.call(Ut,pn[0],en(pn[1]))}}dt.set(Ut.languages.setMonarchTokensProvider,on),Reflect.set(Ut,ma,{})}async function Gs(dt){const Ut=Object.getOwnPropertyDescriptor(window,"postMessage");function kt(on){return function(...Tn){try{const Kn=(0,_t.cloneDeep)(Tn);(0,_t.isFunction)(on)&&on.apply(this,Kn)}catch{throw new Error("postMessage arguments are invalid objects")}}}Ut?.value&&dt.set(Ut.value,kt)}function as(dt){sr(Ln)}function ka(dt){function Ut(kt){return(0,_t.isFunction)(kt)?function(...on){const pn=kt.apply(this,on);return St(pn),pn}:kt}dt.set(_t.cloneDeep,Ut)}var Ya=e(74848);async function Hr(dt,Ut){if(!Wt(dt))return dt;const kt=await Promise.resolve(dt.plugin);if(Reflect.has(kt,"panel")&&Reflect.set(kt,"panel",Ws(Reflect.get(kt,"panel"),Ut)),Reflect.has(kt,"components")){const on=Reflect.get(kt,"components");Object.entries(on).forEach(([pn,Tn])=>{Reflect.set(on,pn,Ws(Tn,Ut))}),Reflect.set(kt,"components",on)}if(Reflect.has(kt,"root")&&Reflect.set(kt,"root",Ws(Reflect.get(kt,"root"),Ut)),Reflect.has(kt,"configPages")){const on=Reflect.get(kt,"configPages")??[];for(const[pn,Tn]of Object.entries(on))!Tn.body||!(0,_t.isFunction)(Tn.body)||Reflect.set(on,pn,{...Tn,body:Ws(Tn.body,Ut)});Reflect.set(kt,"configPages",on)}return dt}const Ws=(dt,Ut)=>{const kt=yt.memo(on=>(0,Ya.jsx)("div",{"data-plugin-sandbox":Ut.id,style:{height:Ut.type===r.QE.app||Ut.type===r.QE.panel?"100%":"auto"},children:(0,Ya.jsx)(dt,{...on})}));return kt.displayName=`GrafanaSandbox(${dt.displayName||dt.name||"Component"})`,kt},Fs=new Map,Wa={};async function Gr({pluginId:dt}){Zn();try{const Ut=gn(dt);return Fs.has(dt)||Fs.set(dt,_r(Ut)),Fs.get(dt)}catch(Ut){const kt=new Error(`Could not import plugin ${dt} inside sandbox: `+Ut);throw Pt(kt,{pluginId:dt,error:String(Ut)}),kt}}async function _r(dt){return It("Loading with sandbox",{pluginId:dt.id}),new Promise(async(Ut,kt)=>{const on=Ca();let pn;function Tn(Mn){if(zn(Mn)){const ia=En(Mn,dt.id);return Gn(ia),ia}else cn(Mn);const Jn=on.get(Mn);if(Jn)return Jn(Mn,dt,pn);const pa=as(Mn);return pa||Mn}pn=(0,tn.A)(window,{distortionCallback:Tn,defaultPolicy:ft.G,liveTargetCallback:un,endowments:Object.getOwnPropertyDescriptors({locationSandbox:window.location,setImmediate:function(Mn,...Jn){return setTimeout(Mn,0,...Jn)},get monaco(){return Reflect.get(window,"monaco")},get Prism(){return Reflect.get(window,"Prism")},get jQuery(){return Reflect.get(window,"jQuery")},get $(){return Reflect.get(window,"jQuery")},get grafanaBootData(){if(Wa[dt.id+"-grafanaBootData"]||(Wa[dt.id+"-grafanaBootData"]=!0,It("Plugin using window.grafanaBootData",{sandbox:"true",pluginId:dt.id,guessedPluginName:dt.id,parent:"window",packageName:"window",key:"grafanaBootData"})),l.$.buildInfo.env==="development")throw new Error(`Error in ${dt.id}: Plugins should not use window.grafanaBootData. Use "config" from "@grafana/runtime" instead.`);return console.error(`${dt.id.toUpperCase()}: Plugins should not use window.grafanaBootData. Use "config" from "@grafana/runtime" instead.`),l.$.bootData},async define(Mn,Jn,pa){let ia,va;Array.isArray(Mn)?(ia=Mn,va=Jn):(ia=Jn,va=pa);try{const Ba=await rr(ia,dt),us=va.apply(null,Ba),ks=await Hr(us,dt);Ut(ks)}catch(Ba){const us=new Error(`Could not execute plugin's define ${dt.id}: `+Ba);Pt(us,{pluginId:dt.id,error:String(Ba)}),kt(us)}}})}),Jt(pn);let Kn="";try{Kn=await Nt(dt)}catch(Mn){const Jn=new Error(`Could not load plugin code ${dt.id}: `+Mn);Pt(Jn,{pluginId:dt.id,error:String(Mn)}),kt(Jn)}try{pn.evaluate(Kn)}catch(Mn){const Jn=new Error(`Could not run plugin ${dt.id} inside sandbox: `+Mn);Pt(Jn,{pluginId:dt.id,error:String(Mn)}),kt(Jn)}})}async function rr(dt,Ut){const kt={},on={id:Ut.id,uri:Ut.module,exports:kt},pn=[];for(const Tn of dt){let Kn=bt.get(Tn);if(typeof Kn=="function"&&(Kn=await Kn()),Kn?.__useDefault&&(Kn=Kn.default),Tn==="module"&&(Kn=on),Tn==="exports"&&(Kn=kt),!Kn){const Mn=new Error(`[sandbox] Could not resolve dependency ${Tn}`);throw Pt(Mn,{pluginId:Ut.id,dependency:Tn,error:String(Mn)}),Mn}pn.push(Kn)}return pn}var or=e(59253),Is=e(95027);let Za=Cr;function ss(dt){Za=dt}async function Qr({pluginId:dt}){return await kr({pluginId:dt})?Za({pluginId:dt}):!1}async function kr({pluginId:dt}){return!l.$.featureToggles.pluginsFrontendSandbox||location.search.includes("nosandbox")&&l.$.buildInfo.env==="development"||!Pe.TP.isSignedIn?!1:Yr({pluginId:dt})}async function Yr({pluginId:dt}){try{const Ut=await(0,Is.x)(dt,{showErrorAlert:!1});return Ut.signatureType!==r.kv.grafana&&Ut.signature!=="internal"}catch{try{const kt=await(0,or.CB)(dt);return kt.signatureType!==r.kv.grafana&&kt.signature!=="internal"}catch{return!1}}}async function Cr({pluginId:dt}){return!!l.$.enableFrontendSandboxForPlugins?.includes(dt)}var Jr=e(37640);const Mr=Xt(_e);me.addImportMap({imports:Mr});const rs=me.constructor.prototype;rs.shouldFetch=function(dt){const Ut=(0,fe.QO)(dt);return/^[^#?]+\.(js)([?#].*)?$/.test(dt)?Ut?.loadingStrategy!==r.xf.script:!0};const os=rs.import;rs.import=function(...dt){return os.apply(this,dt).then(Ut=>Ut&&Ut.__useDefault?Ut.default:Ut)};const Xr=rs.fetch;rs.fetch=function(dt,Ut){return Dt(Xr,dt,Ut)};const _s=rs.resolve;rs.resolve=qt.bind(rs,_s),rs.onload=Yt;async function Ks({path:dt,pluginId:Ut,loadingStrategy:kt,version:on,moduleHash:pn,translations:Tn}){on&&(0,fe.GD)({path:dt,version:on,loadingStrategy:kt}),l.$.featureToggles.localizationForPlugins&&Tn&&await Tr({resolvedLanguage:(0,f.iL)().resolvedLanguage??a.Nm,fallbackLanguage:a.Nm,pluginId:Ut,translations:Tn});const Kn=ae[dt];if(Kn)return typeof Kn=="function"?await Kn():Kn;const Mn=Wn(dt);if(l.$.featureToggles.pluginsSriChecks){const Jn=System.resolve(Mn),pa=System.getImportMap().integrity;pn&&pa&&!pa[Jn]&&me.addImportMap({integrity:{[Jn]:pn}})}return await Qr({pluginId:Ut})?Gr({pluginId:Ut}):me.import(Mn).catch(Jn=>{let pa=new Error("Could not load plugin: "+Jn);throw console.error(pa),Jr.z4.logError(pa,{path:dt,pluginId:Ut,pluginVersion:on??"",expectedHash:pn??"",loadingStrategy:kt.toString(),sriChecksEnabled:(l.$.featureToggles.pluginsSriChecks??!1).toString()}),pa})}function Qs(dt){(0,o.M)(dt);const Ut=dt.loadingStrategy??r.xf.fetch;return Ks({path:dt.module,version:dt.info?.version,loadingStrategy:Ut,pluginId:dt.id,moduleHash:dt.moduleHash,translations:dt.translations}).then(kt=>{if(kt.plugin){const on=kt.plugin;return on.meta=dt,on}if(kt.Datasource){const on=new s.tD(kt.Datasource);return on.setComponentsFromLegacyExports(kt),on.meta=dt,on}throw new Error("Plugin module is missing DataSourcePlugin or Datasource constructor export")})}const $a={};async function Sr(dt){const Ut=dt.id;if($a[Ut])return $a[Ut];(0,o.M)(dt);const kt=await Ks({path:dt.module,version:dt.info?.version,pluginId:dt.id,loadingStrategy:dt.loadingStrategy??r.xf.fetch,moduleHash:dt.moduleHash,translations:dt.translations}),{plugin:on=new m.hX}=kt;return on.init(dt),on.meta=dt,on.setComponentsFromLegacyExports(kt),ie.eY.register({pluginId:Ut,configs:on.exposedComponentConfigs||[]}),ie.a9.register({pluginId:Ut,configs:on.addedComponentConfigs||[]}),ie.lQ.register({pluginId:Ut,configs:on.addedLinkConfigs||[]}),ie.rH.register({pluginId:Ut,configs:on.addedFunctionConfigs||[]}),$a[Ut]=on,on}async function Tr({resolvedLanguage:dt,fallbackLanguage:Ut,pluginId:kt,translations:on}){const pn=on[dt],Tn=on[Ut],Kn=pn??Tn;if(!Kn){console.warn(`Could not find any translation for plugin ${kt}`,{resolvedLanguage:dt,fallbackLanguage:Ut});return}try{const Mn=await me.import(Wn(Kn));if(!Mn.default){console.warn(`Could not find default export for plugin ${kt}`,{resolvedLanguage:dt,fallbackLanguage:Ut,path:Kn});return}const Jn=pn?dt:Ut;(0,f.iL)().addResourceBundle(Jn,kt,Mn.default,void 0,!0)}catch(Mn){console.warn(`Could not load translation for plugin ${kt}`,{resolvedLanguage:dt,fallbackLanguage:Ut,error:Mn,path:Kn})}}},37168:(ee,B,e)=>{"use strict";e.d(B,{X:()=>U,v:()=>F});var t=e(74848),n=e(84057),r=e(65307),o=e(96540),s=e(54148),m=e(20877),a=e(90382),l=e(32899),f=e(11594),h=e(43173),u=e(36490),i=e(34999),x=e(13791),g=e(11098),p=e(1506),c=e(27963),y=e(73427),P=e(56840);
288function d(M){return console.error(M),b("Exception thrown","See console for details")}function D(){return b("Page not found","404 Error")}function b(M,H){const _={text:M,subTitle:H,icon:"exclamation-triangle"};return{node:_,main:_}}var E=e(47797),v=e(28337),C=e(95027),S=e(80185),O=e(37640),I=e(70715);const R={loading:!0,loadingError:!1,pluginNav:null,plugin:null};function T({pluginId:M,pluginNavSection:H}){const{pluginId:_=""}=(0,s.g)();M=M||_;const Z=(0,v.OG)(),ne=(0,v.TX)(),te=(0,v.ZV)(),Y=(0,v.ov)(),Q=(0,s.zy)(),[J,q]=(0,o.useReducer)(L.reducer,R),X=h.$.appSubUrl+Q.pathname+Q.search,{plugin:se,loading:oe,loadingError:ae,pluginNav:ie}=J,fe=(0,O.Wy)(X,H),pe=(0,o.useMemo)(()=>(0,u.SE)(Q.search),[Q.search]),de=(0,o.useMemo)(()=>(0,I.S)(fe),[fe]),le=(0,c.Il)();(0,o.useEffect)(()=>{K(M,q)},[M]);const me=(0,o.useCallback)(Ce=>q(L.actions.changeNav(Ce)),[]);if(!se||M!==se.meta.id){const Ce=le.chrome.state.getValue().layout;return(0,t.jsxs)(x.Y,{navModel:fe,pageNav:{text:""},layout:Ce,children:[oe&&(0,t.jsx)(g.A,{}),!oe&&ae&&(0,t.jsx)(p.L,{entity:"App"})]})}if(!se.root)return(0,t.jsx)(x.Y,{navModel:fe??b("Plugin load error"),children:(0,t.jsx)("div",{children:(0,t.jsx)(P.x6,{i18nKey:"plugins.app-root-page.no-root-app-page-component-found",children:"No root app page component found"})})});const De=se.root&&(0,t.jsx)(m.a,{meta:se.meta,children:(0,t.jsx)(v.AZ,{registries:{addedLinksRegistry:Z.readOnly(),addedComponentsRegistry:ne.readOnly(),exposedComponentsRegistry:te.readOnly(),addedFunctionsRegistry:Y.readOnly()},children:(0,t.jsx)(se.root,{meta:se.meta,basename:Q.pathname,onNavChanged:me,query:pe,path:Q.pathname})})}),Te=()=>{if(!se.meta?.includes)return!0;const Ce=se.meta?.includes.find(ke=>ke.path===Q.pathname);if(!Ce)return!0;if(Ce?.action)return y.TP.hasPermission(Ce.action);if(y.TP.isGrafanaAdmin||y.TP.user.orgRole===a.X.Admin)return!0;const He=Ce?.role||"";return!He||y.TP.isEditor&&He===a.X.Viewer?!0:y.TP.hasRole(He)},Ne=()=>(0,t.jsx)(i.F,{severity:"warning",title:(0,P.t)("plugins.app-root-page.access-denied.title-access-denied","Access denied"),children:(0,t.jsx)(P.x6,{i18nKey:"plugins.app-root-page.access-denied.permission",children:"You do not have permission to see this page."})});return Te()?ie?(0,t.jsx)(t.Fragment,{children:fe?(0,t.jsx)(x.Y,{navModel:fe,pageNav:ie?.node,children:(0,t.jsx)(x.Y.Contents,{isLoading:oe,children:De})}):(0,t.jsx)(x.Y,{children:De})}):(0,t.jsx)(I.A.Provider,{value:de,children:De}):(0,t.jsx)(Ne,{})}
288const L=(0,r.Z0)({name:"prom-builder-container",initialState:R,reducers:{setState:(M,H)=>{Object.assign(M,H.payload)},changeNav:(M,H)=>{let _=H.payload;_&&_.node.children&&(_={..._,node:{..._.main,hideFromBreadcrumbs:!0}}),M.pluginNav=_}}});async function K(M,H){try{const _=await(0,C.x)(M).then(Z=>{const ne=A(Z);return ne?(y.lE.emit(l.r1.alertError,[ne]),H(L.actions.setState({pluginNav:b(ne)})),null):(0,S.ui)(Z)});H(L.actions.setState({plugin:_,loading:!1,loadingError:!1,pluginNav:null}))}catch(_){H(L.actions.setState({plugin:null,loading:!1,loadingError:!0,pluginNav:D()}));const Z=_ instanceof Error?_:new Error((0,E.q6)(_));O.z4.logError(Z),console.error(Z)}}function A(M){return M?M.type!==f.QE.app?"Plugin must be an app":M.enabled?null:"Application Not Enabled":"Unknown Plugin"}const W=T;var N=e(8535);const w=M=>"pluginId"in M&&"id"in M,j=M=>M.startsWith("standalone-plugin-page-/");function V(M){const H=(0,n.rH)(M),_=`/a/${M.pluginId}`,Z=j(M.id)&&M.url||_,ne=j(M.id)&&!M.url?.startsWith("/a/");return{path:`${Z}/*`,sensitive:ne,component:()=>(0,t.jsx)(W,{pluginId:M.pluginId,pluginNavSection:H})}}function U(){const M=(0,N.Gu)(),{navIndex:H}=M;return[...Object.values(H).filter(w).map(V),{path:"/a/:pluginId/*",component:()=>(0,t.jsx)(W,{pluginNavSection:H.home})}]}function F(M){const H=(0,N.Gu)(),{navIndex:_}=H,Z=Object.values(_).filter(w).find(ne=>ne.pluginId===M);return Z?V(Z):{path:"/a/:pluginId/*",component:()=>(0,t.jsx)(W,{pluginNavSection:_.home})}}},37640:(ee,B,e)=>{"use strict";e.d(B,{W3:()=>m,Wy:()=>a,z4:()=>l});var t=e(11594),n=e(25992),r=e(92391),o=e(95027),s=e(80185);async function m(f){const h=await(0,o.x)(f);let u;if(h.type===t.QE.app&&(u=await(0,s.ui)(h)),h.type===t.QE.datasource&&(u=await(0,s.cS)(h)),h.type===t.QE.panel&&(u=await(0,r.Kk)(h)),h.type===t.QE.renderer&&(u={meta:h}),!u)throw new Error("Unknown Plugin type: "+h.type);return u}function a(f,h){if(!h)return;const u=10;let i={...h},x;function g(c,y){return!y.startsWith(c.url??"")||x&&(x.url?.length??0)>(c.url?.length??0)?c:(x&&(x.active=!1),x={...c,active:!0},x)}function p(c,y=0){if(y>u)return c;if(c.children){const P=c.children.map(d=>p(d,y+1));return{...g(c,f),children:P}}return g(c,f)}return i.children=(i?.children??[]).map(p),{main:i,node:x??i}}const l=(0,n.DW)("features.plugins")},1492:(ee,B,e)=>{"use strict";e.d(B,{Pj:()=>l,o:()=>f,Aj:()=>u});var t=e(75816),n=e(73892);const o=(0,t.xP)({reducerPath:"userPreferencesAPI",baseQuery:(0,n.W)({baseURL:"/api"}),endpoints:()=>({})}).injectEndpoints({endpoints:i=>({getUserPreferences:i.query({query:()=>({url:"/user/preferences"})}),patchUserPreferences:i.mutation({query:x=>({url:"/user/preferences",method:"PATCH",body:x.patchPrefsCmd})}),updateUserPreferences:i.mutation({query:x=>({url:"/user/preferences",method:"PUT",body:x.updatePrefsCmd})})}),overrideExisting:!1}),{useGetUserPreferencesQuery:s,usePatchUserPreferencesMutation:m,useUpdateUserPreferencesMutation:a}=o,{useGetUserPreferencesQuery:l,usePatchUserPreferencesMutation:f,useUpdateUserPreferencesMutation:h}=o,u=o.enhanceEndpoints({addTagTypes:["UserPreferences"],endpoints:{getUserPreferences:{providesTags:["UserPreferences"]},updateUserPreferences:{invalidatesTags:["UserPreferences"]},patchUserPreferences:{invalidatesTags:["UserPreferences"]}}})},69289:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>I,Cj:()=>i,HO:()=>d,Mj:()=>p,Nm:()=>g,Q9:()=>P,RS:()=>E,c1:()=>u,g$:()=>D,ny:()=>c,ri:()=>y,uh:()=>b,xu:()=>x});var t=e(65307),n=e(2543),r=e.n(n),o=e(80011),s=e(25229),m=e(5857),a=e(65642),l=e(73427);const f={orgId:a.Ay.bootData.user.orgId,timeZone:a.Ay.bootData.user.timezone,weekStart:a.Ay.bootData.user.weekStart,fiscalYearStartMonth:0,orgsAreLoading:!1,sessionsAreLoading:!1,teamsAreLoading:!1,isUpdating:!1,orgs:[],sessions:[],teams:[],user:null},h=(0,t.Z0)({name:"user/profile",initialState:f,reducers:{updateTimeZone:(R,T)=>{R.timeZone=T.payload.timeZone},updateWeekStart:(R,T)=>{R.weekStart=T.payload.weekStart},updateFiscalYearStartMonth:(R,T)=>{R.fiscalYearStartMonth=T.payload.fiscalYearStartMonth},setUpdating:(R,T)=>{R.isUpdating=T.payload.updating},userLoaded:(R,T)=>{R.user=T.payload.user},initLoadTeams:(R,T)=>{R.teamsAreLoading=!0},teamsLoaded:(R,T)=>{R.teams=T.payload.teams,R.teamsAreLoading=!1},initLoadOrgs:(R,T)=>{R.orgsAreLoading=!0},orgsLoaded:(R,T)=>{R.orgs=T.payload.orgs,R.orgsAreLoading=!1},initLoadSessions:(R,T)=>{R.sessionsAreLoading=!0},sessionsLoaded:(R,T)=>{const L=T.payload.sessions.sort((K,A)=>Number(A.isActive)-Number(K.isActive));R.sessions=L.map(K=>({id:K.id,isActive:K.isActive,seenAt:(0,o.fq)(K.seenAt),createdAt:K.createdAt,clientIp:K.clientIp,browser:K.browser,browserVersion:K.browserVersion,authModule:K.authModule,os:K.os,osVersion:K.osVersion,device:K.device})),R.sessionsAreLoading=!1},userSessionRevoked:(R,T)=>{R.sessions=R.sessions.filter(L=>L.id!==T.payload.tokenId),R.isUpdating=!1}}}),u=R=>async T=>{(0,n.set)(l.TP,"user.fiscalYearStartMonth",R),T(S({fiscalYearStartMonth:R}))},i=R=>async T=>{(!(0,n.isString)(R)||(0,n.isEmpty)(R))&&(R=a.Ay?.bootData?.user?.timezone),(0,n.set)(l.TP,"user.timezone",R),T(v({timeZone:R}))},x=R=>async T=>{R||(R=(0,m.rL)()),(0,n.set)(l.TP,"user.weekStart",R),T(C({weekStart:R})),(0,s.$D)(R)},{setUpdating:g,initLoadOrgs:p,orgsLoaded:c,initLoadTeams:y,teamsLoaded:P,userLoaded:d,userSessionRevoked:D,initLoadSessions:b,sessionsLoaded:E,updateTimeZone:v,updateWeekStart:C,updateFiscalYearStartMonth:S}=h.actions,O=h.reducer,I={user:h.reducer}},34984:(ee,B,e)=>{"use strict";e.d(B,{O:()=>t,q:()=>n});const t=r=>r.timeZone,n=r=>r.fiscalYearStartMonth},53247:(ee,B,e)=>{"use strict";e.d(B,{ED:()=>o,Hv:()=>r,NY:()=>m,hF:()=>s});var t=e(43173);const n=["provisioning","kubernetesDashboards","kubernetesClientDashboardsFolders"],r=()=>{const a=t.$.featureToggles||{};return n.every(l=>a[l])},o=()=>!!(t.$.appUrl&&t.$.appUrl.indexOf("://localhost")<0),s=()=>!!t.$.rendererAvailable,m=()=>{const a=r(),l=o(),f=s();return{hasRequiredFeatures:a,hasPublicAccess:l,hasImageRenderer:f,missingOnlyOptionalFeatures:a&&(!l||!f),missingRequiredFeatures:!a,everythingConfigured:a&&l&&f}}},47195:(ee,B,e)=>{"use strict";e.d(B,{y:()=>r});var t=e(74848),n=e(56840);function r(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.x6,{i18nKey:"dashboard-scene.branch-validation-error.invali
288d-branch-name",children:"Invalid branch name."}),(0,t.jsxs)("ul",{style:{padding:"0 20px"},children:[(0,t.jsx)("li",{children:(0,t.jsx)(n.x6,{i18nKey:"dashboard-scene.branch-validation-error.cannot-start-with",children:"It cannot start with '/' or end with '/', '.', or whitespace."})}),(0,t.jsx)("li",{children:(0,t.jsx)(n.x6,{i18nKey:"dashboard-scene.branch-validation-error.it-cannot-contain-or",children:"It cannot contain '//' or '..'."})}),(0,t.jsx)("li",{children:(0,t.jsx)(n.x6,{i18nKey:"dashboard-scene.branch-validation-error.cannot-contain-invalid-characters",children:"It cannot contain invalid characters: '~', '^', ':', '?', '*', '[', '\\\\', or ']'."})}),(0,t.jsx)("li",{children:(0,t.jsx)(n.x6,{i18nKey:"dashboard-scene.branch-validation-error.least-valid-character",children:"It must have at least one valid character."})})]})]})}},91555:(ee,B,e)=>{"use strict";e.d(B,{mL:()=>t,pd:()=>n,zM:()=>r});const t="/admin/provisioning",n=`${t}/connect`,r=`${t}/getting-started`},55266:(ee,B,e)=>{"use strict";e.d(B,{T:()=>s});var t=e(10378),n=e(143),r=e(19164),o=e(75735);const s=({name:m,folderName:a})=>{const{data:l,isLoading:f}=(0,r.F9)(),h=m||!a,{data:u,isLoading:i}=(0,n.k)(h?t.hT:{name:a});if(f||i)return{isLoading:!0,isInstanceManaged:!1};const x=l?.items??[];if(!x.length)return{folder:u,isInstanceManaged:!1};const g=x.find(c=>c.target==="instance"),p=!!g;if(m){const c=x.find(y=>y.name===m);if(c)return{repository:c,folder:u,isInstanceManaged:p}}if(a){let c=x.find(P=>P.name===a);if(c)return{repository:c,folder:u,isInstanceManaged:p};const y=u?.metadata?.annotations?.[o.Jw];if(y&&(c=x.find(P=>P.name===y),c))return{repository:c,folder:u,isInstanceManaged:p}}return{repository:g,folder:u,isInstanceManaged:p}}},27321:(ee,B,e)=>{"use strict";e.d(B,{F:()=>o});var t=e(10378),n=e(43173),r=e(19164);function o(s){const m=(0,r.F9)(s||!n.$.featureToggles.provisioning?t.hT:void 0);return s||(s=m.data),s?.items?.some(a=>a.target==="instance")}},92784:(ee,B,e)=>{"use strict";e.d(B,{a:()=>n,e:()=>t});function t(r){return r&&/^(?!\/|.*\/\/|.*\.\.|.*@{)(?!.*[~^:?*[\]\\]).+(?<!\/|\.|\s)$/.test(r)}const n=r=>{if(r?.url)return r.branch?`${r.url}/tree/${r.branch}`:r.url}},23117:(ee,B,e)=>{"use strict";e.d(B,{d:()=>r,m:()=>n});class t{constructor(){this.extraRenderActions=[],this.keyedScopedExtraRenderActions=new Map}addExtraRenderAction(s){this.extraRenderActions=this.extraRenderActions.concat(s)}addKeyedExtraRenderAction(s,m){this.keyedScopedExtraRenderActions.set(s,m)}getAllExtraRenderAction(){return this.extraRenderActions}getScopedExtraRenderAction(s){return Array.from(this.keyedScopedExtraRenderActions,a=>a[1]).filter(a=>a.scope===s).map(a=>a.queryActionComponent)}}const n=new t,r=new t},67042:(ee,B,e)=>{"use strict";e.d(B,{c:()=>V,E:()=>U});var t=e(74848),n=e(46942),r=e.n(n),o=e(2543),s=e(55127),m=e.n(s),a=e(96540),l=e(1906),f=e(62392),h=e(48480),u=e(28105),i=e(54092),x=e(85629),g=e(78282),p=e(27489),c=e(33604),y=e(22099),P=e(5585),d=e(99887),D=e(36303),b=e(68805),E=e(43260),v=e(85348),C=e(56840),S=e(98838),O=e(23117),I=e(22803),R=e(63142),T=e(30703),L=e(63527),K=e(12594),A=e(76792);const W=_=>{const{query:Z,queries:ne,onChange:te,collapsedText:Y,renderExtras:Q,hidden:J,hideRefId:q=!1}=_,X=(0,R.of)(w),[se,oe]=(0,a.useState)(!1),[ae,ie]=(0,a.useState)(null),fe=Te=>{oe(!0)},pe=Te=>{if(oe(!1),ae){ie(null);return}Z.refId!==Te&&te({...Z,refId:Te})},de=Te=>{const Ne=Te.currentTarget.value.trim();if(Ne.length===0){ie("An empty query name is not allowed");return}for(const Ce of ne)if(Ce!==Z&&Ne===Ce.refId){ie("Query name already exists");return}ae&&ie(null)},le=Te=>{pe(Te.currentTarget.value.trim())},me=Te=>{Te.key==="Enter"&&pe(Te.currentTarget.value)},De=Te=>{Te.target.select()};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:X.wrapper,children:[!q&&!se&&(0,t.jsxs)("button",{className:X.queryNameWrapper,"aria-label":x.Tp.components.QueryEditorRow.title(Z.refId),title:(0,C.t)("query.query-editor-row-header.query-name-div-title-edit-query-name","Edit query name"),onClick:fe,"data-testid":"query-name-div",type:"button",children:[(0,t.jsx)("span",{className:X.queryName,children:Z.refId}),(0,t.jsx)(T.I,{name:"pen",className:X.queryEditIcon,size:"sm"})]}),!q&&se&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(L.p,{type:"text",defaultValue:Z.refId,onBlur:le,autoF
288ocus:!0,onKeyDown:me,onFocus:De,invalid:ae!==null,onChange:de,className:X.queryNameInput,"data-testid":"query-name-input"}),ae&&(0,t.jsx)(K.P,{horizontal:!0,children:ae})]}),N(_,X),Q&&(0,t.jsx)("div",{className:X.itemWrapper,children:Q()}),J&&(0,t.jsx)("em",{className:X.contextInfo,children:(0,t.jsx)(C.x6,{i18nKey:"query.query-editor-row-header.hidden",children:"Hidden"})})]}),Y&&(0,t.jsx)("div",{className:X.collapsedText,children:Y})]})},N=(_,Z)=>{const{alerting:ne,dataSource:te,onChangeDataSource:Y}=_;return Y?(0,t.jsx)("div",{className:Z.itemWrapper,children:(0,t.jsx)(A.s,{dashboard:!0,variables:!0,alerting:ne,current:te.name,onChange:Y})}):(0,t.jsxs)("em",{className:Z.contextInfo,children:["(",te.name,")"]})},w=_=>({wrapper:(0,I.css)({label:"Wrapper",display:"flex",alignItems:"center",marginLeft:_.spacing(.5),overflow:"hidden"}),queryNameWrapper:(0,I.css)({display:"flex",cursor:"pointer",border:"1px solid transparent",borderRadius:_.shape.radius.default,alignItems:"center",padding:_.spacing(0,0,0,.5),margin:0,background:"transparent",overflow:"hidden","&:hover":{background:_.colors.action.hover,border:`1px dashed ${_.colors.border.strong}`},"&:focus":{border:`2px solid ${_.colors.primary.border}`},"&:hover, &:focus":{".query-name-edit-icon":{visibility:"visible"}}}),queryName:(0,I.css)({fontWeight:_.typography.fontWeightMedium,color:_.colors.primary.text,cursor:"pointer",overflow:"hidden",marginLeft:_.spacing(.5)}),queryEditIcon:(0,I.cx)((0,I.css)({marginLeft:_.spacing(2),visibility:"hidden"}),"query-name-edit-icon"),queryNameInput:(0,I.css)({maxWidth:"300px",margin:"-4px 0"}),collapsedText:(0,I.css)({fontWeight:_.typography.fontWeightRegular,fontSize:_.typography.bodySmall.fontSize,color:_.colors.text.secondary,paddingLeft:_.spacing(1),alignItems:"center",overflow:"hidden",fontStyle:"italic",whiteSpace:"nowrap",textOverflow:"ellipsis"}),contextInfo:(0,I.css)({fontSize:_.typography.bodySmall.fontSize,fontStyle:"italic",color:_.colors.text.secondary,paddingLeft:"10px",paddingRight:"10px"}),itemWrapper:(0,I.css)({display:"flex",marginLeft:"4px"})});var j=e(76874);class V extends a.PureComponent{constructor(){super(...arguments),this.dataSourceSrv=(0,g.l)(),this.id="",this.state={datasource:null,data:void 0,isOpen:!0,showingHelp:!1},this.renderPluginEditor=()=>{const{query:Z,onChange:ne,queries:te,onRunQuery:Y,onAddQuery:Q,range:J,app:q=l.Jk.PanelEditor,history:X}=this.props,{datasource:se,data:oe}=this.state;if(this.isWaitingForDatasourceToLoad())return null;if(se){let ae=this.getQueryEditor(se);if(ae)return(0,t.jsx)(f.p,{instanceSettings:this.props.dataSource,children:(0,t.jsx)(ae,{query:Z,datasource:se,onChange:ne,onRunQuery:Y,onAddQuery:Q,data:oe,range:J,queries:te,app:q,history:X},se?.name)})}return(0,t.jsx)("div",{children:(0,t.jsx)(C.x6,{i18nKey:"query-operation.query-editor-not-exported",children:"Data source plugin does not export any Query Editor component"})})},this.onRemoveQuery=()=>{const{onRemoveQuery:Z,query:ne,onQueryRemoved:te}=this.props;Z(ne),te&&te()},this.onCopyQuery=()=>{const{query:Z,onAddQuery:ne,onQueryCopied:te}=this.props,Y=(0,o.cloneDeep)(Z);ne(Y),te&&te()},this.onHideQuery=()=>{const{query:Z,onChange:ne,onRunQuery:te,onQueryToggled:Y}=this.props;ne({...Z,hide:!Z.hide}),te(),Y&&Y(Z.hide),(0,p.rR)("query_editor_row_hide_query_clicked",{hide:!Z.hide})},this.onToggleHelp=()=>{this.setState(Z=>({showingHelp:!Z.showingHelp}))},this.onClickExample=Z=>{Z.datasource===void 0&&(Z.datasource=(0,h.p$)(this.props.dataSource)),this.props.onChange({...Z,refId:this.props.query.refId}),this.onToggleHelp()},this.renderWarnings=Z=>{const{data:ne,query:te}=this.props,Q=(U(ne,te.refId)?.series??[]).reduce((fe,pe)=>{if(!pe.meta?.notices)return fe;const de=(0,o.filter)(pe.meta.notices,le=>le.severity===Z)??[];return fe.concat(de)},[]),J=(0,o.uniqBy)(Q,"text");if(!(J.length>0))return null;const X="query-"+Z+"s",se=Z==="warning"?"orange":"blue",oe=Z==="warning"?"exclamation-triangle":"file-landscape-alt",ae=J.map(fe=>fe.text),ie=(0,t.jsx)(P.B,{items:ae,renderItem:fe=>(0,t.jsx)(t.Fragment,{children:fe})});return(0,t.jsx)(d.E,{color:se,icon:oe,text:(0,t.jsxs)(t.Fragment,{children:[J.length," ",m()(
288Z,J.length)]}),tooltip:ie},X)},this.renderExtraActions=()=>{const{query:Z,queries:ne,data:te,onAddQuery:Y,dataSource:Q,app:J}=this.props,q=O.d.getAllExtraRenderAction();let X=[];J!==void 0&&(X=O.d.getScopedExtraRenderAction(J));const se=[...q,...X].map((oe,ae)=>oe({query:Z,queries:ne,timeRange:te.timeRange,onAddQuery:Y,dataSource:Q,key:ae})).filter(Boolean);return se.push(this.renderWarnings("info")),se.push(this.renderWarnings("warning")),se.push((0,t.jsx)(H,{query:Z},"adaptive-telemetry-actions")),se},this.renderActions=Z=>{const{query:ne,hideHideQueryButton:te=!1,onReplace:Y,onQueryReplacedFromLibrary:Q}=this.props,{datasource:J,showingHelp:q}=this.state,X=!!ne.hide,se=J?.components?.QueryEditorHelp;return(0,t.jsxs)(t.Fragment,{children:[se&&(0,t.jsx)(E.A,{title:(0,C.t)("query-operation.header.datasource-help","Show data source help"),icon:"question-circle",onClick:this.onToggleHelp,active:q}),this.renderExtraActions(),(0,t.jsx)(F,{query:ne}),(0,t.jsx)(E.q,{title:(0,C.t)("query-operation.header.duplicate-query","Duplicate query"),icon:"copy",onClick:this.onCopyQuery}),(0,t.jsx)(M,{datasourceFilters:J?.name?[J.name]:[],onSelectQuery:oe=>{Q?.(),Y?.(oe)}}),te?null:(0,t.jsx)(E.A,{dataTestId:x.Tp.components.QueryEditorRow.actionButton("Hide response"),title:ne.hide?(0,C.t)("query-operation.header.show-response","Show response"):(0,C.t)("query-operation.header.hide-response","Hide response"),icon:X?"eye-slash":"eye",active:X,onClick:this.onHideQuery}),(0,t.jsx)(E.q,{title:(0,C.t)("query-operation.header.remove-query","Remove query"),icon:"trash-alt",onClick:this.onRemoveQuery})]})},this.renderHeader=Z=>{const{app:ne,query:te,dataSource:Y,onChangeDataSource:Q,onChange:J,queries:q,renderHeaderExtras:X,hideRefId:se}=this.props;return(0,t.jsx)(W,{query:te,queries:q,onChangeDataSource:Q,dataSource:Y,hidden:te.hide,onChange:J,collapsedText:Z.isOpen?null:this.renderCollapsedText(),renderExtras:X,alerting:ne===l.Jk.UnifiedAlerting,hideRefId:se})}}componentDidMount(){const{data:Z,query:ne,id:te}=this.props,Y=U(Z,ne.refId);this.id=(0,o.uniqueId)(te+"_"),this.setState({data:Y}),this.loadDatasource()}getInterpolatedDataSourceUID(){if(this.props.query.datasource){const Z=this.dataSourceSrv.getInstanceSettings(this.props.query.datasource);return Z?.rawRef?.uid??Z?.uid}return this.props.dataSource.rawRef?.uid??this.props.dataSource.uid}async loadDatasource(){let Z;const ne=this.getInterpolatedDataSourceUID();try{Z=await this.dataSourceSrv.get(ne)}catch{Z=await this.dataSourceSrv.get()}typeof this.props.onDataSourceLoaded=="function"&&this.props.onDataSourceLoaded(Z),this.setState({datasource:Z,queriedDataSourceIdentifier:ne})}componentDidUpdate(Z){const{datasource:ne,queriedDataSourceIdentifier:te}=this.state,{data:Y,query:Q}=this.props;if(Z.id!==this.props.id&&(this.id=(0,o.uniqueId)(this.props.id+"_")),Y!==Z.data){const J=U(Y,Q.refId);this.setState({data:J})}if(ne&&te!==this.getInterpolatedDataSourceUID()){this.loadDatasource();return}}getQueryEditor(Z){if(Z)switch(this.props.app){case l.Jk.Explore:return Z.components?.ExploreMetricsQueryField||Z.components?.ExploreLogsQueryField||Z.components?.ExploreQueryField||Z.components?.QueryEditor;case l.Jk.PanelEditor:case l.Jk.Dashboard:default:return Z.components?.QueryEditor}}isWaitingForDatasourceToLoad(){return this.getInterpolatedDataSourceUID()!==this.state.queriedDataSourceIdentifier}renderCollapsedText(){const{datasource:Z}=this.state;return Z?.getQueryDisplayText?Z.getQueryDisplayText(this.props.query):null}render(){const{query:Z,index:ne,visualization:te,collapsable:Y,hideActionButtons:Q}=this.props,{datasource:J,showingHelp:q,data:X}=this.state,se=Z.hide,oe=X?.error&&X.error.refId===Z.refId?X.error:X?.errors?.find(pe=>pe.refId===Z.refId),ae=r()("query-editor-row",{"query-editor-row--disabled":se,"gf-form-disabled":se});if(!J)return null;const ie=this.renderPluginEditor(),fe=J.components?.QueryEditorHelp;return(0,t.jsx)("div",{"data-testid":"query-editor-row","aria-label":x.Tp.components.QueryEditorRows.rows,children:(0,t.jsx)(v.u,{id:this.id,draggable:!Q,collapsable:Y,index:ne,headerElement:this.renderHeader,actions:Q?void 0:this.renderActions,children:(0,t.jsxs)("div",{className:ae,id:this.id,children:[(0,t.jsxs)(D.Xw,{children:[q&&fe&&(0,t.jsx)(b.j,{children:(0,t.jsx)(fe,{onClickExample:pe=>this.onClickExample(pe),query:this.props.query,datasource:J})}),ie]}),oe&&(0,t.jsx)(j.x,{error:oe}),te]})})})}}function U(_,Z){const ne=_.series.filter(J=>J.refId===Z);if(_.state!==u.Gu.Loading&&(_.error||_.errors?.length)&&!_.series.length)return{..._,state:u.Gu.Error};let te=_.state,Y=_.errors?.find(J=>J.refId===Z);!Y&&_.error&&(Y=_.error.refId===Z?_.error:void 0),te!==u.Gu.Loading&&(Y?te=u.Gu.Error:_.state===u.Gu.Error&&(te=u.Gu.Done));const Q=_.timeRange;return{..._,state:te,series:ne,error:Y,errors:Y?[Y]:void 0,timeRange:Q}}function F(_){const{renderSaveQueryButton:Z}=(0,S.Y)();return Z(_.query)}function M({datasourceFilters:_,onSelectQuery:Z}){const{openDrawer:ne,queryLibraryEnabled:te}=(0,S.Y)(),Y=()=>{ne(_,Z)};return te?(0,t.jsx)(E.q,{title:(0,C.t)("query-operation.header.replace-query-from-library","Replace with query from library"),icon:"book",onClick:Y}):null}function H({query:_}){try{const{isLoading:Z,components:ne}=(0,c.f)({extensionPointId:i.S.QueryEditorRowAdaptiveTelemetryV1});return Z||!ne.length?null:(0,y.RC)({props:{query:_,contextHints:["queryeditorrow","header"]},components:ne,limit:1,pluginId:/grafana-adaptive.*/})}catch{return null}}},65966:(ee,B,e)=>{"use strict";e.d(B,{L:()=>h});var t=e(74848),n=e(57095),r=e(96540),o=e(48480),s=e(27489),m=e(78282),a=e(75421),l=e(18615),f=e(67042);class h extends r.PureComponent{constructor(){super(...arguments),this.onRemoveQuery=x=>{this.props.onQueriesChange(this.props.queries.filter(g=>g!==x))},this.onDragStart=x=>{const{queries:g,dsSettings:p}=this.props;(0,s.rR)("query_row_reorder_started",{startIndex:x.source.index,numberOfQueries:g.length,datasourceType:p.type})},this.onDragEnd=x=>{const{queries:g,onQueriesChange:p,dsSettings:c}=this.props;if(!x||!x.destination)return;const y=x.source.index,P=x.destination.index;if(y===P){(0,s.rR)("query_row_reorder_canceled",{startIndex:y,endIndex:P,numberOfQueries:g.length,datasourceType:c.type});return}const d=Array.from(g),[D]=d.splice(y,1);d.splice(P,0,D),p(d),(0,s.rR)("query_row_reorder_ended",{startIndex:y,endIndex:P,numberOfQueries:g.length,datasourceType:c.type})}}onChangeQuery(x,g){const{queries:p,onQueriesChange:c}=this.props;c(p.map((y,P)=>P===g?x:y))}onReplaceQuery(x,g){const{queries:p,onQueriesChange:c,onUpdateDatasources:y,dsSettings:P}=this.props,d=p.map((D,b)=>b===g?x:D);if(c(d),x.datasource?.uid){const E={uid:new Set(d.map(C=>C.datasource?.uid)).size>1?l.uv:x.datasource.uid};P.uid!==E.uid&&y?.(E)}}onDataSourceChange(x,g){const{queries:p,onQueriesChange:c}=this.props;c(p.map((y,P)=>{if(P!==g)return y;const d=(0,o.p$)(x);return y.datasource&&(0,m.l)().getInstanceSettings(y.datasource)?.type===x.type?{...y,datasource:d}:{refId:y.refId,hide:y.hide,datasource:d}}))}render(){const{dsSettings:x,data:g,queries:p,app:c,history:y,eventBus:P,onAddQuery:d,onRunQueries:D,onQueryCopied:b,onQueryRemoved:E,onQueryToggled:v,onQueryReplacedFromLibrary:C,queryRowWrapper:S}=this.props;return(0,t.jsx)(n.DragDropContext,{onDragStart:this.onDragStart,onDragEnd:this.onDragEnd,children:(0,t.jsx)(n.Droppable,{droppableId:"transformations-list",direction:"vertical",children:O=>(0,t.jsxs)("div",{"data-testid":"query-editor-rows",ref:O.innerRef,...O.droppableProps,children:[p.map((I,R)=>{const T=u(I,x),L=x.meta.mixed?A=>this.onDataSourceChange(A,R):void 0,K=(0,t.jsx)(f.c,{id:I.refId,index:R,data:g,query:I,dataSource:T,onCh
288angeDataSource:L,onChange:A=>this.onChangeQuery(A,R),onReplace:A=>this.onReplaceQuery(A,R),onRemoveQuery:this.onRemoveQuery,onAddQuery:d,onRunQuery:D,onQueryCopied:b,onQueryRemoved:E,onQueryToggled:v,onQueryReplacedFromLibrary:C,queries:p,app:c,range:(0,a.jG)().timeRange(),history:y,eventBus:P},I.refId);return S?S(K,I.refId):K}),O.placeholder]})})})}}const u=(i,x)=>i.datasource&&(0,m.l)().getInstanceSettings(i.datasource)||x},76874:(ee,B,e)=>{"use strict";e.d(B,{x:()=>s});var t=e(74848),n=e(22803),r=e(63142),o=e(30703);function s({error:a}){const l=(0,r.of)(m),f=a?.message??a?.data?.message??"Query error";return(0,t.jsxs)("div",{className:l.wrapper,children:[(0,t.jsx)("div",{className:l.icon,children:(0,t.jsx)(o.I,{name:"exclamation-triangle"})}),(0,t.jsxs)("div",{className:l.message,children:[f,a.traceId!=null&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("br",{})," ",(0,t.jsxs)("span",{children:["(Trace ID: ",a.traceId,")"]})]})]})]})}const m=a=>({wrapper:(0,n.css)({marginTop:a.spacing(.5),background:a.colors.background.secondary,display:"flex"}),icon:(0,n.css)({background:a.colors.error.main,color:a.colors.error.contrastText,padding:a.spacing(1)}),message:(0,n.css)({fontSize:a.typography.bodySmall.fontSize,fontFamily:a.typography.fontFamilyMonospace,padding:a.spacing(1)})})},32154:(ee,B,e)=>{"use strict";e.d(B,{g:()=>Z,K:()=>te});var t=e(74848),n=e(22803),r=e(96540),o=e(28105),s=e(22592),m=e(48480),a=e(1906),l=e(85629),f=e(78282),h=e(36490),u=e(32881),i=e(45861),x=e(92807),g=e(22787),p=e(65240),c=e(51115),y=e(16817),P=e(67458),d=e(68143),D=e(6975),b=e(56840);function E({pluginId:Q}){const{value:J,loading:q,error:X}=(0,y.A)(async()=>(0,d.AI)().get(`/api/plugins/${Q}/markdown/query_help`),[]),se=(0,P.G)(J);return q?(0,t.jsx)(D._,{text:(0,b.t)("plugins.plugin-help.loading","Loading help...")}):X?(0,t.jsx)("h3",{children:(0,t.jsx)(b.x6,{i18nKey:"plugins.plugin-help.error",children:"An error occurred when loading help."})}
288):J===""?(0,t.jsx)("h3",{children:(0,t.jsx)(b.x6,{i18nKey:"plugins.plugin-help.not-found",children:"No query help could be found."})}):(0,t.jsx)("div",{className:"markdown-html",dangerouslySetInnerHTML:{__html:se}})}var v=e(65642),C=e(83873),S=e(1404),O=e(41776),I=e(76792),R=e(29328),T=e(73601),L=e(57204),K=e(23117),A=e(65966),W=e(17548),N=e(63142),w=e(79233),j=e(63527),V=e(21285),U=e(85348);const F=r.memo(({options:Q,dataSource:J,data:q,onChange:X})=>{const[se,oe]=(0,r.useState)(Q.timeRange?.from||""),[ae,ie]=(0,r.useState)(Q.timeRange?.shift||""),[fe,pe]=(0,r.useState)(Q.timeRange?.hide??!1),[de,le]=(0,r.useState)(!1),[me,De]=(0,r.useState)(!0),[Te,Ne]=(0,r.useState)(!0),Ce=(0,N.of)(_),He=(0,r.useCallback)(Ee=>{oe(Ee.target.value)},[]),ke=(0,r.useCallback)(Ee=>{ie(Ee.target.value)},[]),Me=(0,r.useCallback)(Ee=>{const xe=H(Ee.target.value),ye=M(xe);ye&&Q.timeRange?.from!==xe&&X({...Q,timeRange:{...Q.timeRange??{},from:xe}}),De(ye)},[X,Q]),$e=(0,r.useCallback)(Ee=>{const xe=H(Ee.target.value),ye=M(xe);ye&&Q.timeRange?.shift!==xe&&X({...Q,timeRange:{...Q.timeRange??{},shift:xe}}),Ne(ye)},[X,Q]),tt=(0,r.useCallback)(()=>{const Ee=!fe;pe(Ee),X({...Q,timeRange:{...Q.timeRange??{},hide:Ee}})}
288,[X,Q,fe]),Ke=(0,r.useCallback)(Ee=>{X({...Q,cacheTimeout:H(Ee.target.value)})},[X,Q]),Re=(0,r.useCallback)(Ee=>{let xe=parseInt(Ee.target.value,10);(isNaN(xe)||xe===0)&&(xe=null),X({...Q,queryCachingTTL:xe})},[X,Q]),Ve=(0,r.useCallback)(Ee=>{let xe=parseInt(Ee.currentTarget.value,10);(isNaN(xe)||xe===0)&&(xe=null),xe!==Q.maxDataPoints&&X({...Q,maxDataPoints:xe})},[X,Q]),Qe=(0,r.useCallback)(Ee=>{const xe=H(Ee.target.value);xe!==Q.minInterval&&X({...Q,minInterval:xe})},[X,Q]),je=(0,r.useCallback)(()=>{le(!0)},[]),ze=(0,r.useCallback)(()=>{le(!1)},[]),Ye=()=>{const Ee=`If your time series store has a query cache this option can override the default cache timeout. Specify a 289 numeric value in seconds.`;return J.meta.queryOptions?.cacheTimeout?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.c,{tooltip:Ee,htmlFor:"cache-timeout-id",children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.render-cache-timeout-option.cache-timeout",children:"Cache timeout"})}),(0,t.jsx)(j.p,{id:"cache-timeout-id",type:"text",placeholder:"60",spellCheck:!1,onBlur:Ke,defaultValue:Q.cacheTimeout??""})]}):null},Ge=()=>{const Ee="Cache time-to-live: How long results from this queries in this panel will be cached, in milliseconds. Defaults to the TTL in the caching configuration for this datasource.";return J.cachingConfig?.enabled?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.c,{tooltip:Ee,children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.render-query-caching-ttloption.cache-ttl",children:"Cache TTL"})}),(0,t.jsx)(j.p,{type:"number",placeholder:`${J.cachingConfig.TTLMs}`,spellCheck:!1,onBlur:Re,defaultValue:Q.queryCachingTTL??void 0})]}):null},ce=()=>{const Ee=q.request?.maxDataPoints,xe=Q.maxDataPoints??"",ye=xe==="";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.c,{htmlFor:"max-data-points-input",tooltip:(0,t.jsx)(t.Fragment,{children:"The maximum data points per series. Used directly by some data sources and used in calculation of auto interval. With streaming data this value is used for the rolling buffer."}),children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.render-max-data-points-option.max-data-points",children:"Max data points"})}),(0,t.jsx)(j.p,{id:"max-data-points-input",type:"number",placeholder:`${Ee}`,spellCheck:!1,onBlur:Ve,defaultValue:xe}),ye&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,n.cx)(Ce.noSquish,Ce.operator),children:"="}),(0,t.jsx)("span",{className:(0,n.cx)(Ce.noSquish,Ce.left),children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.render-max-data-points-option.width-of-panel",children:"Width of panel"})})]})]})},Pe=()=>{const Ee=q.request?.interval,xe=J.interval??"No limit";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.c,{className:Ce.firstColumn,tooltip:(0,t.jsxs)(t.Fragment,{children:["A lower limit for the interval. Recommended to be set to write frequency, for example ",(0,t.jsx)("code",{children:"1m"})," if your data is written every minute. Default value can be set in data source settings for most data sources."]}),htmlFor:"min-interval-input",children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.render-interval-option.min-interval",children:"Min interval"})}),(0,t.jsx)(j.p,{id:"min-interval-input",type:"text",placeholder:`${xe}`,spellCheck:!1,onBlur:Qe,defaultValue:Q.minInterval??""}),(0,t.jsx)(w.c,{className:Ce.firstColumn,tooltip:(0,t.jsxs)(t.Fragment,{children:["The evaluated interval that is sent to data source and is used in ",(0,t.jsx)("code",{children:"$__interval"})," and"," ",(0,t.jsx)("code",{children:"$__interval_ms"}),". This value is not exactly equal to ",(0,t.jsx)("code",{children:"Time range / max data points"}),", it will approximate a series of magic number."]}),children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.render-interval-option.interval",children:"Interval"})}),(0,t.jsx)("span",{className:Ce.noSquish,children:Ee}),(0,t.jsx)("span",{className:(0,n.cx)(Ce.noSquish,Ce.operator),children:"="}),(0,t.jsx)("span",{className:(0,n.cx)(Ce.noSquish,Ce.left),children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.render-interval-option.time-range-max-data-points",children:"Time range / max data points"})})]})},Se=()=>{if(de)return;let Ee=Q.maxDataPoints??"";Ee===""&&q.request&&(Ee=`auto = ${q.request.maxDataPoints}`);const xe=q.request?.interval??Q.minInterval;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:Ce.collapsedText,children:["MD = ",Ee]}),(0,t.jsxs)("span",{className:Ce.collapsedText,children:["Interval = ",xe]})]})};return(0,t.jsx)(U.u,{id:"Query options",index:0,title:(0,b.t)("query.query-group-options-editor.Query options-title-query-options","Query options"),headerElement:Se(),isOpen:de,onOpen:je,onClose:ze,children:(0,t.jsxs)("div",{className:Ce.grid,children:[ce(),Pe(),Ye(),Ge(),(0,t.jsx)(w.c,{htmlFor:"relative-time-input",tooltip:(0,t.jsxs)(t.Fragment,{children:["Overrides the relative time range for individual panels, which causes them to be different than what is selected in the dashboard t
289ime picker in the top-right corner of the dashboard. For example to configure the Last 5 minutes the Relative time should be ",(0,t.jsx)("code",{children:"now-5m"})," and ",(0,t.jsx)("code",{children:"5m"}),", or variables like"," ",(0,t.jsx)("code",{children:"$_relativeTime"}),"."]}),children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.relative-time",children:"Relative time"})}),(0,t.jsx)(j.p,{id:"relative-time-input",type:"text",placeholder:"1h",onChange:He,onBlur:Me,invalid:!me,value:se}),(0,t.jsx)(w.c,{htmlFor:"time-shift-input",className:Ce.firstColumn,tooltip:(0,t.jsxs)(t.Fragment,{children:["Overrides the time range for individual panels by shifting its start and end relative to the time picker. For example to configure the Last 1h the Time shift should be ",(0,t.jsx)("code",{children:"now-1h"})," and ",(0,t.jsx)("code",{children:"1h"}),", or variables like ",(0,t.jsx)("code",{children:"$_timeShift"}),"."]}),children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.time-shift",children:"Time shift"})}),(0,t.jsx)(j.p,{id:"time-shift-input",type:"text",placeholder:"1h",onChange:ke,onBlur:$e,invalid:!Te,value:ae}),(ae||se)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.c,{htmlFor:"hide-time-info-switch",className:Ce.firstColumn,children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-options-editor.hide-time-info",children:"Hide time info"})}),(0,t.jsx)(V.K,{id:"hide-time-info-switch",className:Ce.left,value:fe,onChange:tt})]})]})})});F.displayName="QueryGroupOptionsEditor";function M(Q){return!Q||W.isValidTimeSpan(Q)}function H(Q){return Q===""?null:Q}function _(Q){return{grid:(0,n.css)({display:"grid",gridTemplateColumns:"auto minmax(5em, 1fr) auto 1fr",gap:Q.spacing(.5),gridAutoRows:Q.spacing(4),whiteSpace:"nowrap"}),firstColumn:(0,n.css)({gridColumn:1}),collapsedText:(0,n.css)({marginLeft:Q.spacing(2),fontSize:Q.typography.size.sm,color:Q.colors.text.secondary}),noSquish:(0,n.css)({display:"flex",alignItems:"center",padding:Q.spacing(0,1),fontWeight:Q.typography.fontWeightMedium,fontSize:Q.typography.size.sm,backgroundColor:Q.colors.background.secondary,borderRadius:Q.shape.radius.default}),left:(0,n.css)({justifySelf:"left"}),operator:(0,n.css)({color:Q.v1.palette.orange})}}class Z extends r.PureComponent{constructor(){super(...arguments),this.backendSrv=C.IB,this.dataSourceSrv=(0,f.l)(),this.querySubscription=null,this.state={isDataSourceModalOpen:!!h.Ny.getSearchObject().firstPanel,isLoadingHelp:!1,helpContent:null,isPickerOpen:!1,isHelpOpen:!1,queries:[],data:{state:o.Gu.NotStarted,series:[],timeRange:(0,s.E2)()}},this.onChangeDataSource=async(J,q)=>{const{dsSettings:X}=this.state,se=X?await(0,f.l)().get(X.uid):void 0,oe=await(0,f.l)().get(J.uid),ae=q||await(0,L.y)(oe,J.uid,this.state.queries,se),ie=await this.dataSourceSrv.get(J.name);this.onChange({queries:ae,dataSource:{name:J.name,uid:J.uid,...(0,m.p$)(J)}}),this.setState({queries:ae,dataSource:ie,dsSettings:J}),q&&this.props.onRunQueries()},this.onAddQueryClick=()=>{const{queries:J}=this.state;this.onQueriesChange((0,S.U7)(J,this.newQuery())),this.onScrollBottom()},this.onAddExpressionClick=()=>{this.onQueriesChange((0,S.U7)(this.state.queries,R.Ex.newQuery())),this.onScrollBottom()},this.onScrollBottom=()=>{setTimeout(()=>{this.state.scrollElement&&this.state.scrollElement.scrollTo({top:1e4})},20)},this.onUpdateAndRun=J=>{this.props.onOptionsChange(J),this.props.onRunQueries()},this.onOpenHelp=()=>{this.setState({isHelpOpen:!0})},this.onCloseHelp=()=>{this.setState({isHelpOpen:!1})},this.onCloseDataSourceModal=()=>{this.setState({isDataSourceModalOpen:!1})},this.onAddQuery=J=>{const{dsSettings:q,queries:X}=this.state;this.onQueriesChange((0,S.U7)(X,J,q?(0,m.p$)(q):{type:void 0,uid:void 0})),this.onScrollBottom()},this.onQueriesChange=J=>{this.onChange({queries:J}),this.setState({queries:J})},this.setScrollRef=J=>{this.setState({scrollElement:J})}}async componentDidMount(){const{options:J,queryRunner:q}=this.props;this.querySubscription=q.getData({withTransforms:!1,withFieldConfig:!1}).subscribe({next:X=>this.onPanelDataUpdate(X)}),this.setNewQueriesAndDatasource(J)}componentWillUnmount(){this.querySubscription&&(this.querySubscription.unsubscribe(),this.querySubscription=null)}async componentDidUpdate(){const{options:J}=this.props,q=await(0,f.l)().get(J.dataSource);this.state.dataSource&&q.uid!==this.state.dataSource?.uid&&this.setNewQueriesAndDatasource(J)}
289async setNewQueriesAndDatasource(J){try{const q=await this.dataSourceSrv.get(J.dataSource),X=this.dataSourceSrv.getInstanceSettings(J.dataSource),se=await this.dataSourceSrv.get(),oe=q.getRef(),ae=J.queries.map(ie=>({...(0,S.Ih)(ie)&&q?.getDefaultQuery?.(a.Jk.PanelEditor),datasource:oe,...ie}));this.setState({queries:ae,dataSource:q,dsSettings:X,defaultDataSource:se})}catch(q){console.error("failed to load data source",q)}}onPanelDataUpdate(J){this.setState({data:J})}newQuery(){const{dsSettings:J,defaultDataSource:q}=this.state,X=J&&!J.meta.mixed?(0,m.p$)(J):q?q.getRef():{type:void 0,uid:void 0};return{...this.state.dataSource?.getDefaultQuery?.(a.Jk.PanelEditor),datasource:X}}onChange(J){this.props.onOptionsChange({...this.props.options,...J})}renderTopSection(J){const{onOpenQueryInspector:q,options:X}=this.props,{dataSource:se,data:oe,dsSettings:ae}=this.state;return!ae||!se?null:(0,t.jsx)(te,{data:oe,dataSource:se,options:X,dsSettings:ae,onOptionsChange:this.onUpdateAndRun,onDataSourceChange:this.onChangeDataSource,onOpenQueryInspector:q})}renderQueries(J){const{onRunQueries:q}=this.props,{data:X,queries:se}=this.state;return(0,t.jsx)("div",{"aria-label":l.Tp.components.QueryTab.content,children:(0,t.jsx)(A.L,{queries:se,dsSettings:J,onQueriesChange:this.onQueriesChange,onAddQuery:this.onAddQuery,onRunQueries:q,data:X})})}isExpressionsSupported(J){return(J.meta.backend||J.meta.alerting||J.meta.mixed)===!0}renderExtraActions(){return K.m.getAllExtraRenderAction().map((J,q)=>J({onAddQuery:this.onAddQuery,onChangeDataSource:this.onChangeDataSource,key:q})).filter(Boolean)}renderAddQueryRow(J,q){const X=!(0,T.k)(J.name);return(0,t.jsxs)(u.Gy,{spacing:"md",align:"flex-start",children:[X&&(0,t.jsx)(i.$n,{icon:"plus",onClick:this.onAddQueryClick,variant:"secondary","data-testid":l.Tp.components.QueryTab.addQuery,children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group.add-query",children:"Add query"})}),v.Ay.expressionsEnabled&&this.isExpressionsSupported(J)&&(0,t.jsx)(i.$n,{icon:"plus",onClick:this.onAddExpressionClick,variant:"secondary",className:q.expressionButton,"data-testid":"query-tab-add-expression",children:(0,t.jsx)("span",{children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group.expression",children:"Expression"})})}),this.renderExtraActions()]})}render(){const{isHelpOpen:J,dsSettings:q}=this.state,X=ne();return(0,t.jsx)(x.P,{minHeight:"100%",ref:this.setScrollRef,children:(0,t.jsxs)("div",{className:X.innerWrapper,children:[this.renderTopSection(X),q&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:X.queriesWrapper,children:this.renderQueries(q)}),this.renderAddQueryRow(q,X),J&&(0,t.jsx)(g.a,{title:(0,b.t)("query.query-group.title-data-source-help","Data source help"),isOpen:!0,onDismiss:this.onCloseHelp,children:(0,t.jsx)(E,{pluginId:q.meta.id})})]})]})})}}const ne=(0,p.N)(()=>{const{theme:Q}=v.Ay;return{innerWrapper:(0,n.css)({display:"flex",flexDirection:"column",padding:Q.spacing.md}),dataSourceRow:(0,n.css)({display:"flex",marginBottom:Q.spacing.md}),dataSourceRowItem:(0,n.css)({marginRight:Q.spacing.inlineFormMargin}),dataSourceRowItemOptions:(0,n.css)({flexGrow:1,marginRight:Q.spacing.inlineFormMargin}),queriesWrapper:(0,n.css)({paddingBottom:"16px"}),expressionWrapper:(0,n.css)({}),expressionButton:(0,n.css)({marginRight:Q.spacing.sm})}});function te({dataSource:Q,options:J,data:q,dsSettings:X,onDataSourceChange:se,onOptionsChange:oe,onOpenQueryInspector:ae}){const ie=ne(),[fe,pe]=(0,r.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":l.Tp.components.QueryTab.queryGroupTopSection,children:(0,t.jsxs)("div",{className:ie.dataSourceRow,children:[(0,t.jsx)(c.I,{htmlFor:"data-source-picker",width:"auto",children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-top-section.data-source",children:"Data source"})}),(0,t.jsx)("div",{className:ie.dataSourceRowItem,children:(0,t.jsx)(Y,{options:J,onChange:async(de,le)=>await se?.(de,le),isDataSourceModalOpen:!!h.Ny.getSearchObject().firstPanel})}),Q&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:ie.dataSourceRowItem,children:(0,t.jsx)(i.$n,{variant:"secondary",icon:"question-circle",title:(0,b.t)("query.query-group-top-section.query-tab-help-button-title-open-data-source-help","Open data source help"),onClick:()=>pe(!0),"data-testid":"query-tab-help-button"})}),(0,t.jsx)("div",{className:ie.dataSourceRowItemOptions,children:(0,t.jsx)(F,{options:J,dataSource:Q,data:q,onCh
289ange:de=>{oe?.(de)}})}),ae&&(0,t.jsx)("div",{className:ie.dataSourceRowItem,children:(0,t.jsx)(i.$n,{variant:"secondary",onClick:ae,"aria-label":l.Tp.components.QueryTab.queryInspectorButton,children:(0,t.jsx)(b.x6,{i18nKey:"query.query-group-top-section.query-inspector",children:"Query inspector"})})})]})]})}),fe&&(0,t.jsx)(g.a,{title:(0,b.t)("query.query-group-top-section.title-data-source-help","Data source help"),isOpen:!0,onDismiss:()=>pe(!1),children:(0,t.jsx)(E,{pluginId:X.meta.id})})]})}function Y({options:Q,onChange:J,...q}){const[X,se]=(0,r.useState)(!!q.isDataSourceModalOpen);(0,r.useEffect)(()=>{h.Ny.getSearchObject().firstPanel&&h.Ny.partial({firstPanel:null},!0)},[]);const oe={metrics:!0,mixed:!0,dashboard:!0,variables:!0,current:Q.dataSource,uploadFile:!0,onChange:async(ae,ie)=>{await J(ae,ie),se(!1)}};return(0,t.jsxs)(t.Fragment,{children:[X&&(0,t.jsx)(O.p,{...oe,onDismiss:()=>se(!1)}),(0,t.jsx)(I.s,{...oe})]})}},32380:(ee,B,e)=>{"use strict";e.d(B,{nm:()=>se,Dh:()=>J});var t=e(39741),n=e(13752),r=e(64423),o=e(44240),s=e(39697),m=e(81160),a=e(67791),l=e(93031),f=e(71030),h=e(69850),u=e(1005),i=e(65961),x=e(75234),g=e(2543);function p(oe){let ae=[];const ie=(0,g.partition)(oe,"id"),fe=(0,g.groupBy)(ie[0],"id");return ae=(0,g.map)(fe,pe=>pe.length>1&&!(0,g.every)(pe,c)?(0,g.find)(pe,de=>de.eventType!=="panel-alert"):(0,g.head)(pe)),ae=(0,g.concat)(ae,ie[1]),ae}function c(oe){return oe.eventType==="panel-alert"}var y=e(75421),P=e(62467),d=e(65474),D=e(66847),b=e(69862),E=e(16126),v=e(43173),C=e(78282),S=e(42942),O=e(87745),I=e(87033),R=e(92511);class T{canRun(ae){return ae?!!(!ae.annotationQuery||ae.annotations):!1}run({annotation:ae,datasource:ie,dashboard:fe,range:pe}){if(!this.canRun(ie))return(0,P.of)([]);const de={};return(0,I.b)({dashboard:fe,range:pe,panel:de},ie,ae).pipe((0,m.T)(le=>le.events??[]),(0,D.W)(R.SD))}}var L=e(90696);class K{canRun(ae){return ae?(0,L.E7)(ae)?!0:!!(ae.annotationQuery&&!ae.annotations):!1}run({annotation:ae,datasource:ie,dashboard:fe,range:pe}){return this.canRun(ie)?(0,d.H)(ie.annotationQuery({range:pe,rangeRaw:pe.raw,annotation:ae,dashboard:fe})).pipe((0,D.W)(R.SD)):(0,P.of)([])}}class A{constructor(ae=[new K,new T]){this.runners=ae}canWork({dashboard:ae}){return!!ae.annotations.list.find(A.getAnnotationsToProcessFilter)}work(ae){if(!this.canWork(ae))return(0,R.$)();const{dashboard:ie,range:fe}=ae;let pe=ie.annotations.list.filter(A.getAnnotationsToProcessFilter);v.$.publicDashboardAccessToken&&pe.length>0&&(pe=[pe[0]]);const de=pe.map(le=>{let me;if(v.$.publicDashboardAccessToken){const De=new S.X;me=(0,P.of)(De).pipe((0,D.W)(R.H0))}else me=(0,d.H)((0,C.l)().get(le.datasource)).pipe((0,D.W)(R.H0));return me.pipe((0,b.Z)(De=>{const Te=this.runners.find(Ne=>Ne.canRun(De));return Te?(ie.events.publish(new O.xc(le)),Te.run({annotation:le,datasource:De,dashboard:ie,range:fe}).pipe((0,a.Q)(J().cancellations().pipe((0,E.p)(Ne=>Ne===le))),(0,m.T)(Ne=>(ie.snapshot&&(le.snapshotData=(0,g.cloneDeep)(Ne)),v.$.publicDashboardAccessToken?Ne:(0,R.G9)(le,Ne))),(0,h.j)(()=>{ie.events.publish(new O.yj(le))}))):(0,P.of)([])}))});return(0,o.h)(de).pipe((0,l.U)(),(0,f.T)((le,me)=>le.concat(me)),(0,m.T)(le=>({annotations:le,alertStates:[]})))}static getAnnotationsToProcessFilter(ae){return ae.enable&&!ae.snapshotData}}var W=e(18030),N=e(76190),w=e(15130),j=e(70327),V=e(78467),U=e(95443),F=e(52161),M=e(29609),H=e(7498),_=e(8535),Z=e(96673);class ne{constructor(){this.hasAlertRules={}}canWork({dashboard:ae,range:ie}){return!(!ae.uid||v.$.publicDashboardAccessToken||ie.raw.to!=="now"||this.hasAlertRules[ae.uid]===!1||!(w.TP.hasPermission(Z.AccessControlAction.AlertingRuleRead)&&w.TP.hasPermission(Z.AccessControlAction.AlertingRuleExternalRead)))}work(ae){if(!this.canWork(ae))return(0,R.$)();const{dashboard:ie}=ae,fe=async()=>(await(0,_.JD)(j.hK.endpoints.prometheusRuleNamespaces.initiate({ruleSourceName:F.hY,dashboardUid:ie.uid},{forceRefetch:!0}))).data;return(0,d.H)(fe()).pipe((0,m.T)(de=>(0,V.Kw)(de))).pipe((0,m.T)(de=>{this.hasAlertRules[ie.uid]=!1;const le={};return de.forEach(me=>
289me.rules.forEach(De=>{if(M.R$.alertingRule(De)&&De.annotations&&De.annotations[U.YH.panelID]){this.hasAlertRules[ie.uid]=!0;const Te=Number(De.annotations[U.YH.panelID]),Ne=(0,H.S)(De.state);le[Te]?Ne===N.O.Alerting&&le[Te].state!==N.O.Alerting?le[Te].state=N.O.Alerting:Ne===N.O.Pending&&le[Te].state!==N.O.Alerting&&le[Te].state!==N.O.Pending&&(le[Te].state=N.O.Pending):le[Te]={state:Ne,id:Object.keys(le).length,panelId:Te,dashboardId:ie.id}}})),{alertStates:Object.values(le),annotations:[]}}),(0,D.W)(R.Zr))}}class te{constructor(ae,ie=(0,y.jG)(),fe=[new ne,new W.F,new A]){this.dashboard=ae,this.timeSrv=ie,this.workers=fe,this.run=this.run.bind(this),this.getResult=this.getResult.bind(this),this.cancel=this.cancel.bind(this),this.destroy=this.destroy.bind(this),this.executeRun=this.executeRun.bind(this),this.results=new t.m(1),this.runs=new n.B,this.cancellationStream=new n.B,this.runsSubscription=this.runs.subscribe(pe=>this.executeRun(pe)),this.eventsSubscription=ae.events.subscribe(x._,pe=>{this.run({dashboard:this.dashboard,range:this.timeSrv.timeRange()})})}run(ae){this.runs.next(ae)}getResult(ae){return this.results.asObservable().pipe((0,m.T)(ie=>{const fe=(0,R.FK)(ie.annotations,ae),pe=ie.alertStates.find(de=>!!ae&&de.panelId===ae);return{annotations:p(fe),alertState:pe}}))}executeRun(ae){const fe=this.workers.filter(De=>De.canWork(ae)).map(De=>De.work(ae)),pe=new r.yU,de=(0,o.h)(fe).pipe((0,a.Q)(this.runs.asObservable()),(0,l.U)(),(0,f.T)((De,Te)=>(De.annotations=De.annotations.concat(Te.annotations),De.alertStates=De.alertStates.concat(Te.alertStates),De)),(0,h.j)(()=>{pe.unsubscribe()}),(0,u.u)()),le=new r.yU,me=(0,s.O)(200).pipe((0,i.u)({annotations:[],alertStates:[]}),(0,a.Q)(de),(0,h.j)(()=>{le.unsubscribe()}));le.add(me.subscribe(De=>{this.results.next(De)})),pe.add(de.subscribe(De=>{this.results.next(De)}))}cancel(ae){this.cancellationStream.next(ae)}cancellations(){return this.cancellationStream.asObservable().pipe((0,u.u)())}destroy(){this.results.complete(),this.runs.complete(),this.cancellationStream.complete(),this.runsSubscription.unsubscribe(),this.eventsSubscription.unsubscribe()}}let Y;function Q(oe){Y&&Y.destroy(),Y=oe}function J(){if(!Y)throw new Error("getDashboardQueryRunner can only be used after Grafana instance has started.");return Y}let q;function X(oe){q=oe}function se(oe){q||(q=({dashboard:ie,timeSrv:fe,workers:pe})=>new te(ie,fe,pe));const ae=q(oe);return Q(ae),ae}},42942:(ee,B,e)=>{"use strict";e.d(B,{X:()=>h});var t=e(62467),n=e(65474),r=e(94644),o=e(41119),s=e(68143),m=e(43173),a=e(52161),l=e(8095);const f="-- Public --";class h extends r.mA{constructor(){let i={};super({name:"public-ds",id:0,type:"public-ds",meta:i,uid:f,jsonData:{},access:"proxy",readOnly:!0}),this.annotations={prepareQuery(x){return{...x,queryType:l.nj.Annotations,refId:"anno"}}}}query(i){return i.targets.length?i.targets[0]?.datasource?.uid===a.vv?(0,n.H)(this.getAnnotations(i)):(0,t.of)({data:[]}):(0,t.of)({data:[]})}async getAnnotations(i){const{range:{to:x,from:g}}=i,p={from:g.valueOf(),to:x.valueOf()},c=await(0,s.AI)().get(`/api/public/dashboards/${m.$.publicDashboardAccessToken}/annotations`,p);return{data:[(0,o.Vc)(c)]}}testDatasource(){return Promise.resolve({message:"",status:""})}}},18030:(ee,B,e)=>{"use strict";e.d(B,{F:()=>r});var t=e(62467),n=e(92511);class r{canWork({dashboard:s}){return s?.annotations?.list?.some(m=>m.enable&&!!m.snapshotData)}work(s){if(!this.canWork(s))return(0,n.$)();const m=this.getAnnotationsFromSnapshot(s.dashboard);return(0,t.of)({annotations:m,alertStates:[]})}getAnnotationsFromSnapshot(s){return(s?.annotations?.list?.filter(f=>f.enable)).filter(f=>!!f.snapshotData).reduce((f,h)=>f.concat((0,n.G9)(h,h.snapshotData)),[])}getAnnotationsInSnapshot(s,m){const a=this.getAnnotationsFromSnapshot(s);return(0,n.FK)(a,m)}}},92511:(ee,B,e)=>{"use strict";e.d(B,{$:()=>u,FK:()=>g,G9:()=>p,H0:()=>h,SD:()=>f,Zr:()=>i});var t=e(2543),n=e.n(t),r=e(62467),o=e(97534),s=e(43173),m=e(8535),a=e(64762),l=e(12066);function f(y){return y.cancelled?(0,r.of)([]):(x("AnnotationQueryRunner failed",y),(0,r.of)([]))}function h(y){return x("Failed to retrieve datasource",y),(0,r.of)(void 0)}const u=()=>(0,r.of)({annotations:[],alertStates:[]});
289function i(y){return y.cancelled||x("DashboardQueryRunner failed",y),u()}function x(y,P){const d=(0,o.u)(P);console.error("handleAnnotationQueryRunnerError",d);const D=(0,a.gi)(y,d.message);(0,m.JD)((0,l.dx)(D))}function g(y,P){return P==null?y:y.filter(d=>{let D;if(D=d.source,!D)return!0;if(D.filter){const b=(D.filter.ids??[]).includes(P);if(D.filter.exclude){if(b)return!1}else if(!b)return!1}return d.panelId&&d.source.type==="dashboard"?d.panelId===P:!0})}function p(y,P){y.snapshotData&&(y=(0,t.cloneDeep)(y),delete y.snapshotData);for(const d of P)switch(d.source=y,d.color=s.$.theme2.visualization.getColorByName(y.iconColor),d.type=y.name,d.isRegion=!!(d.timeEnd&&d.time!==d.timeEnd),d.newState?.toLowerCase()){case"pending":d.color="yellow";break;case"alerting":d.color="red";break;case"ok":d.color="green";break;case"normal":d.color="green";break;case"no_data":d.color="gray";break;case"nodata":d.color="gray";break}return P}function c(y){if(!y||!y.length)return[];const P=[];for(const d of y){const D=new DataFrameView(d);for(let b=0;b<d.length;b++){const E=cloneDeep(D.get(b));P.push(E)}}return P}},96215:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>L,S:()=>T});var t=e(2543),n=e(39741),r=e(62467),o=e(69862),s=e(81160),m=e(66847),a=e(28105),l=e(41119),f=e(22592),h=e(60519),u=e(76732),i=e(739),x=e(2197),g=e(1906),p=e(17548),c=e(97534),y=e(36580),P=e(46383),d=e(28998),D=e(59373),b=e(73601),E=e(32380),v=e(49510),C=e(27359);function S(A=[]){A.forEach(W=>{W.meta={...W.meta,dataTopic:i.QR.Annotations}})}function O(A,W){return(0,v.z)([A,W]).pipe((0,o.Z)(N=>{const[w,j]=N;if(j.annotations?.length||j.alertState){w.annotations||(w.annotations=[]);const V=w.annotations.concat((0,C.I)(j.annotations));S(V);const U=j.alertState;return(0,r.of)({...w,annotations:V,alertState:U})}return S(w.annotations),(0,r.of)(w)}))}var I=e(71393);let R=100;function T(){return"Q"+R++}class L{constructor(W){this.templateSrv=(0,D.w)(),this.resendLastResult=()=>{this.lastResult&&this.subject.next(this.lastResult)},this.subject=new n.m(1),this.dataConfigSource=W}getData(W){const{withFieldConfig:N,withTransforms:w}=W;let j=1,V,U=[],F=[],M,H=!0,_=-1;if(this.dataConfigSource.snapshotData){const Z={state:a.Gu.Done,series:this.dataConfigSource.snapshotData.map(ne=>(0,l.Vc)(ne)),timeRange:(0,f.E2)(),structureRev:j};return(0,r.of)(Z)}return this.subject.pipe((0,o.Z)(Z=>{let ne=this.dataConfigSource.getFieldOverrideOptions(),te=this.dataConfigSource.getTransformations();if(Z.series===F&&V?.fieldConfig===ne?.fieldConfig&&M===te)return(0,r.of)({...Z,structureRev:j,series:U});V=ne,M=te,F=Z.series;let Y=(0,r.of)(Z);return w&&(Y=this.applyTransformations(Z)),Y.pipe((0,s.T)(Q=>{let J=Q,q=!1;if(N&&Q.series?.length){if(_===this.dataConfigSource.configRev){let X;for(const se of Q.series)if((0,P.o$)(se)){X=se;break}X&&!X.packetInfo.schemaChanged&&U[0].fields.length===X.fields.length&&(J={...J,series:U.map((se,oe)=>({...se,length:Q.series[oe].length,fields:se.fields.map((ae,ie)=>({...ae,values:Q.series[oe].fields[ie].values,state:{...ae.state,calcs:void 0,range:void 0}}))}))},q=!0)}ne!=null&&(H||!q)&&(_=this.dataConfigSource.configRev,J={...J,series:(0,h.we)({timeZone:Q.request?.timezone??"browser",data:J.series,...ne})},J.annotations&&(J.annotations=(0,h.we)({data:J.annotations,...ne,fieldConfig:{defaults:{},overrides:[]}})),H=!1)}return!q&&!(0,u.J3)(U,J.series,u.bW)&&j++,U=J.series,{...J,structureRev:j}}))}))}applyTransformations(W){const N=this.dataConfigSource.getTransformations();if(N&&N.every(H=>H.disabled)||!N||N.length===0)return(0,r.of)(W);const j={interpolate:H=>this.templateSrv.replace(H,W?.request?.scopedVars)};let V=N.filter(H=>H.topic==null||H.topic===i.QR.Series),U=N.filter(H=>H.topic===i.QR.Annotations),F=(0,x.m)(V,W.series,j),M=(0,x.m)(U,W.annotations??[],j);return(0,t.merge)(F,M).pipe((0,s.T)(H=>{let Z=H.some(ne=>ne.meta?.dataTopic===i.QR.Annotations)?{annotations:H}:{series:H};return{...W,...Z}}),(0,m.W)(H=>(console.warn("Error running transformation:",H),(0,r.of)({...W,state:a.Gu.Error,errors:[(0,c.u)(H)]}))))}async run(W){const{queries:N,timezone:w,datasource:j,panelId:V,panelName:U,panelPluginId:F,dashboardUID:M,timeRange:H,timeInfo:_,cacheTimeout:Z,queryCachingTTL:ne,maxDataPoints:te,scopedVars:Y,minInterval:Q,app:J}=W;if((0,b.k)(j)){this.pipeToSubject((0,b.m)(W,N[0]),V,!0);return}const q=this.shouldAddErrorWhenDatasourceVariableIsMultiple(j,Y),X={app:J??g.Jk.Dashboard,requestId:T(),timezone:w,panelId:V,panelName:U,panelPluginId:F,dashboardUID:M,range:H,timeInfo:_,interval:"",intervalMs:0,targets:(0,t.cloneDeep)(N),maxDataPoints:te,scopedVars:Y||{},cacheTimeout:Z,queryCachingTTL:ne,startTime:Date.now(),rangeRaw:H.raw};try{const se=await K(j,X.scopedVars),oe=se.meta?.mixed;X.targets=X.targets.map(fe=>{const pe=fe.datasource?.type===y.dR.type;return(!fe.datasource||fe.datasource.uid!==se.uid&&!oe&&!pe)&&(fe.datasource=se.getRef()),fe});const ae=Q?this.templateSrv.replace(Q,X.scopedVars):se.interval,ie=p.calculateInterval(H,te,ae);X.scopedVars=Object.assign({}
289,X.scopedVars,{__interval:{text:ie.interval,value:ie.interval},__interval_ms:{text:ie.intervalMs.toString(),value:ie.intervalMs}}),X.interval=ie.interval,X.intervalMs=ie.intervalMs,X.filters=this.templateSrv.getAdhocFilters(se.name,!0),X.panelId=V,X.panelName=U,this.lastRequest=X,this.pipeToSubject((0,I.BN)(se,X),V,!1,q)}catch(se){this.pipeToSubject((0,r.of)({state:a.Gu.Error,error:(0,c.u)(se),series:[],timeRange:X.range}),V)}}pipeToSubject(W,N,w=!1,j=!1){this.subscription&&this.subscription.unsubscribe();let V=W;const U=this.dataConfigSource.getDataSupport();if(U.alertStates||U.annotations){const F=this.dataConfigSource;V=O(W,(0,E.Dh)().getResult(F.id))}this.subscription=V.subscribe({next:F=>{const M=this.lastResult,H=w?F:(0,l.N$)(F,M);if(M!=null&&H.state!==a.Gu.Streaming){let _=(0,u.J3)(M.series??[],H.series??[],(Y,Q)=>Y===Q),Z=(0,u.J3)(M.annotations??[],H.annotations??[],(Y,Q)=>Y===Q),ne=M.state===H.state,te=(0,u.J3)(M.errors??[],H.errors??[],(Y,Q)=>(0,t.isEqual)(Y,Q));if(_&&(H.series=M.series),Z&&(H.annotations=M.annotations),_&&Z&&ne&&te)return}this.lastResult=H,j&&(H.errors=[{message:"Panel is using a variable datasource with multiple values without repeat option. Please configure the panel to be repeated by the same datasource variable."}],H.state=a.Gu.Error),this.subject.next(H)}})}cancelQuery(){this.subscription&&(this.subscription.unsubscribe(),this.lastResult&&(this.lastResult.state===a.Gu.Loading||this.lastResult.state===a.Gu.Streaming)&&this.subject.next({...this.lastResult,state:a.Gu.Done}))}clearLastResult(){this.lastResult=void 0,this.subject=new n.m(1)}destroy(){this.subject&&this.subject.complete(),this.subscription&&this.subscription.unsubscribe()}useLastResultFrom(W){this.lastResult=W.getLastResult(),this.lastResult&&this.subject.next(this.lastResult)}setLastResult(W){this.lastResult=W}getLastResult(){return this.lastResult}getLastRequest(){return this.lastRequest}shouldAddErrorWhenDatasourceVariableIsMultiple(W,N){let w=!1;return W?.uid?.startsWith("${")&&this.templateSrv.replace(W.uid,N,j=>(Array.isArray(j)&&j.length>1&&(w=!0),"")),w}}async function K(A,W){return A&&typeof A=="object"&&"query"in A?A:await(0,d.tR)().get(A,W)}},77526:(ee,B,e)=>{"use strict";e.d(B,{N:()=>n});var t=e(69850);function n(r,o){return(0,t.j)(()=>{o&&r.resolveCancelerIfExists(o)})}},39050:(ee,B,e)=>{"use strict";e.d(B,{B:()=>n});var t=e(76732);const n=(r,o)=>{let s=1;return o?.structureRev&&o.series&&(s=o.structureRev,(0,t.J3)(r.series,o.series,t.bW)||s++),r.structureRev=s,r}},71393:(ee,B,e)=>{"use strict";e.d(B,{BN:()=>w});var t=e(2543),n=e(62467),r=e(44240),o=e(39697),s=e(65474),m=e(81160),a=e(66847),l=e(59099),f=e(1005),h=e(65961),u=e(67791),i=e(69862),x=e(28105),g=e(739),p=e(33239),c=e(1906),y=e(97534),P=e(38353),d=e(43173),D=e(36580),b=e(83873),E=e(1404),v=e(29328),C=e(25992);const S=(0,C.DW)("features.query");var O=e(77526),I=e(5556),R=e(33749),T=e(27489),L=e(22429);function K(U){let F=!1;return H=>{if(!H.request||F||I.kM.getUrlSearchParams().editPanel!=null||H.state!==x.Gu.Done&&H.state!==x.Gu.Error)return;const Z={eventName:R.n_.DataRequest,source:H.request.app,datasourceName:U.name,datasourceId:U.id,datasourceUid:U.uid,datasourceType:U.type,dataSize:0,panelId:0,panelPluginId:H.request?.panelPluginId,duration:H.request.endTime-H.request.startTime,...H?.request?.panelId&&Number.isInteger(H.request.panelId)&&{panelId:H.request.panelId},...H?.request?.panelName&&{panelName:H.request.panelName}};M(Z,H),H.request.app!==c.Jk.Explore&&H.request.app!==c.Jk.Correlations&&A(Z,H),H.series&&H.series.length>0&&(Z.dataSize=H.series.length),(0,T.G$)(Z),F=!0};function M(H,_){const Z={};for(let te=0;te<_.series.length;te++){const Y=_.series[te].refId;Y&&!Z[Y]&&(Z[Y]=_.series[te].meta?.isCachedResponse??!1)}
289H.totalQueries=Object.keys(Z).length,H.cachedQueries=Object.values(Z).filter(te=>te===!0).length;const ne=(0,L.UA)().getCurrent();ne&&(H.dashboardId=ne.id,H.dashboardName=ne.title,H.dashboardUid=ne.uid,H.folderName=ne.meta.folderTitle)}}function A(U,F){F.errors?.length?U.error=F.errors.map(M=>M.message).join(", "):F.error&&(U.error=F.error.message)}function W(U,F){const M=F.panelData.request,H={...F.packets},_=U.key??U.data?.[0]?.refId??"A";H[_]=U;let Z=U.state||x.Gu.Done,ne,te;const Y=[],Q=[];for(const se in H){const oe=H[se];if((oe.error||oe.errors?.length)&&(Z=x.Gu.Error,ne=oe.error,te=oe.errors),oe.data&&oe.data.length)for(const ae of oe.data){if(ae.meta?.dataTopic===g.QR.Annotations){Q.push(ae);continue}Y.push(ae)}}const J=N(M,Z),q={state:Z,series:Y,annotations:Q,error:ne,errors:te,request:M,timeRange:J},X=new Set([...F.panelData.traceIds??[],...U.traceIds??[]]);return X.size>0&&(q.traceIds=Array.from(X)),{packets:H,panelData:q}}function N(U,F){const M=U.range;return!(0,t.isString)(M.raw.from)||F!==x.Gu.Streaming?M:{...M,from:p.parse(M.raw.from,!1),to:p.parse(M.raw.to,!0)}}function w(U,F,M){let H={panelData:{state:x.Gu.Loading,series:[],request:F,timeRange:F.range},packets:{}};if(!F.targets.length)return F.endTime=Date.now(),H.panelData.state=x.Gu.Done,(0,n.of)(H.panelData);const _=j(U,F,M).pipe((0,m.T)(Z=>{if(!(0,t.map)(Z.data))throw new Error(`Expected response data to be array, got ${typeof Z.data}.`);const ne=F.targets.filter(te=>te.hide);for(const te of ne)Z.data=Z.data.filter(Y=>Y.refId!==te.refId);return F.endTime=Date.now(),H=W(Z,H),H.panelData}),(0,a.W)(Z=>(console.error("runRequest.catchError",Z),S.logError(Z),(0,n.of)({...H.panelData,state:x.Gu.Error,error:(0,y.u)(Z)}))),(0,l.M)(K(U)),(0,O.N)(b.IB,F.requestId),(0,f.u)());return(0,r.h)((0,o.O)(200).pipe((0,h.u)(H.panelData),(0,u.Q)(_)),_)}function j(U,F,M){if((0,P.LZ)(U)){const H=(0,P.xt)(U,F);return(0,s.H)(H).pipe((0,i.Z)(_=>V(U,_,M)))}return V(U,F,M)}function V(U,F,M){if(F.targets=F.targets.map(_=>(0,E.Ih)(_)?{...U?.getDefaultQuery?.(c.Jk.PanelEditor),..._}:_),d.$.publicDashboardAccessToken)return(0,s.H)(U.query(F));for(const _ of F.targets)if((0,D.s9)(_.datasource))return v.Ex.query(F);if(M||(F.targets=F.targets.filter(_=>U.filterQuery?.(_)??!0)),F.targets.length===0)return(0,n.of)({data:[]});const H=M?M(F):U.query(F);return(0,s.H)(H)}},57204:(ee,B,e)=>{"use strict";e.d(B,{y:()=>m});var t=e(1906),n=e(46933),r=e(39796),o=e(2863),s=e(36580);async function m(a,l,f,h){let u=f;const i={...a.getRef(),uid:l},x={...a?.getDefaultQuery?.(t.Jk.PanelEditor),datasource:i,refId:"A"};if(h?.meta.id!==a.meta.id){if(a.meta.mixed)return f;if((0,n.Ee)(h)&&(0,n.FL)(a)){const g=await h.exportToAbstractQueries(f);u=await a.importFromAbstractQueries(g)}else if(h&&a.importQueries)u=await a.importQueries(f,h);else{if(h){const g=(0,o.w)(),p=[];let c=a.uid;const y=g.containsTemplate(l);y&&(c=g.replace(a.uid));const P=f.reduce((d,D)=>
289{if(D.datasource){let b=D.datasource.uid;const E=g.containsTemplate(b);if(E&&(b=g.replace(D.datasource.uid)),b===c&&E===y)return D.refId=(0,r.M)(d),d.concat([D])}return d},p);if(P.length>0)return P}return[x]}}return u.length===0?[x]:u.map(g=>(!(0,s.s9)(g.datasource)&&!a.meta.mixed&&(g.datasource=i),g))}},99090:(ee,B,e)=>{"use strict";e.d(B,{G3:()=>m,TF:()=>f,XJ:()=>g,YU:()=>i,d7:()=>u,if:()=>p,r4:()=>s,w7:()=>x});var t=e(83458);const n=null,r=58,o=8,s={label:"A\u2013Z",value:"alpha-asc"},m="search.sections",a="grafana.search.expanded-folder",l=0,f="general",h="Dashboards",u="grafana.search.include.panels",i="grafana.search.layout",x="grafana.search.sort",g={dashboard:t.G.DashDB,folder:t.G.DashFolder,home:t.G.DashHome},p=1e3},5478:(ee,B,e)=>{"use strict";e.d(B,{d:()=>s,n:()=>m});var t=e(96540),n=e(13752),r=e(92138),o=e(36490);function s(){const a=(0,t.useRef)(new n.B);return{keyboardEvents:a.current,onKeyDown:l=>{switch(l.code){case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":case"Enter":case"Escape":a.current.next(l);default:}}}}function m(a,l,f){const h=(0,t.useRef)({x:0,y:-1}),[u,i]=(0,t.useState)({x:0,y:-1}),x=(0,t.useRef)();return(0,t.useEffect)(()=>{x.current=f.view.fields.url,h.current.x=0,h.current.y=-1,i({...h.current})},[f]),(0,t.useEffect)(()=>{const g=a.subscribe({next:p=>{switch(p?.code){case"ArrowDown":{h.current.y++,i({...h.current});break}case"ArrowUp":h.current.y=Math.max(0,h.current.y-1),i({...h.current});break;case"ArrowRight":{l>0&&(h.current.x=Math.min(l,h.current.x+1),i({...h.current}));break}case"ArrowLeft":{l>0&&(h.current.x=Math.max(0,h.current.x-1),i({...h.current}));break}case"Enter":if(!x.current)break;const c=h.current.x*l+h.current.y;if(c<0){h.current.x=0,h.current.y=0,i({...h.current});break}const y=x.current.values?.[c];typeof y=="string"&&o.Ny.push(r.I.stripBaseFromUrl(y))}}});return()=>g.unsubscribe()},[a,l]),u}},67497:(ee,B,e)=>{"use strict";e.d(B,{B9:()=>m,J$:()=>o,KZ:()=>s,MK:()=>r,Pf:()=>n});var t=e(27489);const n=(l,f)=>{(0,t.rR)(`${l}_viewed`,a(f))},r=(l,f)=>{(0,t.rR)(`${l}_result_clicked`,a(f))},o=(l,f)=>{(0,t.rR)(`${l}_query_submitted`,a(f))},s=(l,{error:f,...h})=>{(0,t.rR)(`${l}_query_failed`,{...a(h),error:f})},m=(l,f,h)=>{(0,t.rR)(`grafana_panel_inspect_${l}_${f}_clicked`,h)},a=l=>({layout:l.layout,starredFilter:l.starred??!1,sort:l.sortValue??"",tagCount:l.tagCount??0,queryLength:l.query?.length??0,includePanels:l.includePanels??!1,deleted:l.deleted??!1})},55860:(ee,B,e)=>{"use strict";e.d(B,{S:()=>F});var t=e(43173),n=e(88673),r=e(41119),o=e(11576),s=e(68143),m=e(93854);const a="Loading",l="api/search-v2",f="name_sort";class h{constructor(H){this.fallbackSearcher=H}async search(H){if(H.facet?.length)throw new Error("facets not supported!");return this.doSearchQuery(H)}async starred(H){if(H.facet?.length)throw new Error("facets not supported!");const _=await(0,s.AI)().get("api/user/stars");return _?.length?this.doSearchQuery({uid:_,query:H.query??"*"}):{view:new n.R({length:0,fields:[]}),totalRows:0,loadMoreItems:async(Z,ne)=>{},isItemLoaded:Z=>!0}}async tags(H){const _={...H,query:H.query??"*",sort:void 0,facet:[{field:"tag"}],limit:1},ne=(await(0,s.AI)().post(l,_)).frames.map(te=>(0,r.Vc)(te));if(ne[0]?.name===a)return this.fallbackSearcher.tags(H);for(const te of ne)if(te.fields[0].name==="tag")return x(te);return[]}getSortOptions(){const H=[{value:f,label:"Alphabetically (A-Z)"},{value:"-name_sort",label:"Alphabetically (Z-A)"}];if(t.$.licenseInfo.enabledFeatures.analytics){for(const _ of g)H.push({value:`-${_.name}`,label:`${_.display} (most)`}),H.push({value:`${_.name}`,label:`${_.display} (least)`});for(const _ of p)H.push({value:`-${_.name}`,label:`${_.display} (recent)`}),H.push({value:`${_.name}`,label:`${_.display} (oldest)`})}return Promise.resolve(H)}async doSearchQuery(H){H=await(0,m.u4)(H);const _={...H,query:H.query??"*",limit:H.limit??u},ne=(await(0,s.AI)().post(l,_)).frames.map(se=>(0,r.Vc)(se)),te=ne.length?(0,r.Vc)(ne[0]):{fields:[],length:0};if(te.name===a)return this.fallbackSearcher.search(H);for(const se of te.fields)se.display=(0,o.J)({field:se,theme:t.$.theme2});te.meta?.custom||(te.meta={...te.meta,custom:{count:te.length,max_score:1}});const Y=te.meta.custom;if(Y.locationInfo||(Y.locationInfo={}),Y.sortBy?.length){const se=te.fields.find(oe=>oe.name===Y.sortBy);if(se){const oe=c(se.name);Y.sortBy=oe,se.name=oe}}
289let Q=0,J;const q=async()=>{for(;Q>X.dataFrame.length;){const se=X.dataFrame.length;if(se>=Y.count)return;const oe=await(0,s.AI)().post(l,{..._??{},from:se,limit:i}),ae=(0,r.Vc)(oe.frames[0]);if(!ae){console.log("no results",ae);return}if(ae.fields.length!==X.dataFrame.fields.length){console.log("invalid shape",ae,X.dataFrame);return}const ie=ae.length+X.dataFrame.length;for(let pe=0;pe<ae.fields.length;pe++)X.dataFrame.fields[pe].values.push(...ae.fields[pe].values);X.dataFrame.length=ie;const fe=ae.meta?.custom;if(fe?.locationInfo&&Y)for(const[pe,de]of Object.entries(fe.locationInfo))Y.locationInfo[pe]=de}J=void 0},X=new n.R(te);return{totalRows:Y.count??te.length,view:X,loadMoreItems:async(se,oe)=>(Q=Math.max(Q,oe),J||(J=q()),J),isItemLoaded:se=>se<X.dataFrame.length}}getFolderViewSort(){return"name_sort"}}const u=50,i=100;function x(M){const H=M.fields[0].values,_=M.fields[1].values,Z=[];for(let ne=0;ne<M.length;ne++)Z.push({term:H[ne],count:_[ne]});return Z}const g=[{name:"views_total",display:"Views total"},{name:"views_last_30_days",display:"Views 30 days"},{name:"errors_total",display:"Errors total"},{name:"errors_last_30_days",display:"Errors 30 days"}],p=[{name:"created_at",display:"Created time"},{name:"updated_at",display:"Updated time"}];function c(M){for(const H of g)if(H.name===M)return H.display;for(const H of p)if(H.name===M)return H.display;return M}var y=e(84139);class P{constructor(H){this.parent=H,this.cache=new Map,this.sortPlaceholder="Default (Relevance)"}async search(H){if(H.facet?.length)throw new Error("facets not supported!");if(H.sort!=null)throw new Error("custom sorting is not supported yet");if(H.tags?.length||H.ds_uid?.length)return this.parent.search(H);const Z=(await this.getCache(H.kind)).search(H.query);return{isItemLoaded:()=>!0,loadMoreItems:async(ne,te)=>{},totalRows:Z.length,view:Z}}async getCache(H){const _=H?H.sort().join(","):"*",Z=this.cache.get(_);if(Z)try{return await Z}catch{return this.cache.delete(_),new d(new n.R({name:"error",fields:[],length:0}))}const ne=this.parent.search({kind:H,limit:5e3}).then(te=>new d(te.view));return this.cache.set(_,ne),ne}async starred(H){return this.parent.starred(H)}async getSortOptions(){return this.parent.getSortOptions()}async tags(H){return this.parent.tags(H)}getFolderViewSort(){return this.parent.getFolderViewSort()}}class d{constructor(H){this.full=H,this.ufuzzy=new y.A({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1}),this.names=this.full.fields.name.values,this.empty=new n.R({...this.full.dataFrame,fields:this.full.dataFrame.fields.map(_=>({..._,values:[]})),length:0})}search(H){if(!H?.length||H==="*")return this.full;const _=this.full.dataFrame.fields,Z=this.names,ne=_.map(J=>[]);let[te,Y,Q]=this.ufuzzy.search(Z,H,5);for(let J=0;J<_.length;J++){let q=_[J].values,X=ne[J];if(Y&&Q)for(let se=0;se<Q.length;se++){let oe=Y.idx[Q[se]];X.push(q[oe])}else if(te)for(let se=0;se<te.length;se++){let oe=te[se];X.push(q[oe])}}return this.empty.dataFrame.fields.forEach((J,q)=>{J.values=ne[q]}),this.empty.dataFrame.length=this.empty.dataFrame.fields[0].values.length,this.empty}}var D=e(95004),b=e(83873),E=e(99090);class v{constructor(){this.locationInfo={general:{kind:"folder",name:"Dashboards",url:"/dashboards"}},this.getFolderViewSort=()=>""}async composeQuery(H,_){const Z=await(0,m.u4)(_);return Z.query?.length&&Z.query!=="*"&&(H.query=Z.query),Z.kind?.length===1&&E.XJ[Z.kind[0]]&&(H.type=E.XJ[Z.kind[0]]),Z.uid?H.dashboardUID=Z.uid:Z.location?.length&&(H.folderUIDs=[Z.location]),H}async search(H){if(H.facet?.length)throw new Error("facets not supported!");
289if(H.from!==void 0){if(!H.limit)throw new Error("Must specify non-zero limit parameter when using from");if(H.from/H.limit%1!==0)throw new Error("From parameter must be a multiple of limit")}const _=H.limit??(H.from!==void 0?1:E.if),Z=H.from!==void 0?H.from/_+1:void 0,ne=await this.composeQuery({limit:_,tag:H.tags,sort:H.sort,permission:H.permission,page:Z,deleted:H.deleted},H);return this.doAPIQuery(ne)}async starred(H){if(H.facet?.length)throw new Error("facets not supported!");const _=await this.composeQuery({limit:H.limit??E.if,tag:H.tags,sort:H.sort,starred:H.starred},H);return this.doAPIQuery(_)}async getSortOptions(){return(await b.IB.get("/api/search/sorting")).sortOptions.map(_=>({value:_.name,label:_.displayName}))}async tags(H){return(await b.IB.get("/api/dashboards/tags")).sort((Z,ne)=>ne.count-Z.count)}async doAPIQuery(H){const _=await b.IB.get("/api/search",H),Z=[],ne=[],te=[],Y=[],Q=[],J=[],q=[],X=[],se=[];let oe;for(let fe of _){const pe=fe.type==="dash-folder"?"folder":"dashboard";Z.push(pe),ne.push(fe.title),te.push(fe.uid),Y.push(fe.url),Q.push(fe.tags),q.push(fe.sortMeta),X.push(fe.isDeleted??!1),se.push(fe.permanentlyDeleteDate?new Date(fe.permanentlyDeleteDate):void 0);let de=fe.folderUid;!de&&pe==="dashboard"&&(de=E.TF),J.push(de),fe.sortMetaName?.length&&(oe=fe.sortMetaName),fe.folderUid&&fe.folderTitle?this.locationInfo[fe.folderUid]={kind:"folder",name:fe.folderTitle,url:fe.folderUrl,folderUid:fe.folderUid}:pe==="folder"&&(this.locationInfo[fe.uid]={kind:pe,name:fe.title,url:fe.url,folderUid:fe.folderUid})}const ae={fields:[{name:"kind",type:D.PU.string,config:{},values:Z},{name:"name",type:D.PU.string,config:{},values:ne},{name:"uid",type:D.PU.string,config:{},values:te},{name:"url",type:D.PU.string,config:{},values:Y},{name:"tags",type:D.PU.other,config:{},values:Q},{name:"location",type:D.PU.string,config:{},values:J},{name:"isDeleted",type:D.PU.boolean,config:{},values:X},{name:"permanentlyDeleteDate",type:D.PU.time,config:{},values:se}],length:ne.length,meta:{custom:{count:ne.length,max_score:1,locationInfo:this.locationInfo}}};oe?.length&&q.length&&(ae.meta.custom.sortBy=oe,ae.fields.push({name:oe,type:D.PU.number,config:{},values:q}));for(const fe of ae.fields)fe.display=(0,o.J)({field:fe,theme:t.$.theme2});const ie=new n.R(ae);return{totalRows:ae.length,view:ie,loadMoreItems:async(fe,pe)=>{},isItemLoaded:fe=>!0}}}var C=e(2543),S=e(77197),O=e(85618);const I="Loading",R=`apis/dashboard.grafana.app/v0alpha1/namespaces/${(0,O.G)()}/search`,T="name_sort";class L{constructor(H){this.fallbackSearcher=H,this.locationInfo=j()}async search(H){if(H.facet?.length)throw new Error("facets not supported!");return this.doSearchQuery(H)}async starred(H){if(H.facet?.length)throw new Error("facets not supported!");const _=await(0,s.AI)().get("api/user/stars");return _?.length?this.doSearchQuery({...H,name:_,query:H.query??"*"}):W()}async tags(H){const _=H.query??"*";let Z=`${R}?facet=tags&query=${_}&limit=1`;return(await(0,s.AI)().get(Z)).facets?.tags?.terms||[]}getSortOptions(){const H=[{value:T,label:"Alphabetically (A-Z)"},{value:"-name_sort",label:"Alphabetically (Z-A)"}];if(t.$.licenseInfo.enabledFeatures.analytics)for(const _ of A)H.push({value:`-${_.name}`,label:`${_.display} (most)`}),H.push({value:`${_.name}`,label:`${_.display} (least)`});return Promise.resolve(H)}async doSearchQuery(H){const _=await this.newRequest(H),Z=await this.fetchResponse(_),ne=w(Z,H.sort??"");if(ne.name===I)return this.fallbackSearcher.search(H);const te=ne.meta?.custom||{};if(te.locationInfo=await this.locationInfo,te.sortBy?.length){const X=ne.fields.find(se=>se.name===te.sortBy);if(X){const se=N(X.name);te.sortBy=se,X.name=se}}let Y=0,Q;const J=async()=>{for(;Y>q.dataFrame.length;){const X=q.dataFrame.length;if(X>=te.count)return;const se=`${_}&offset=${X}`,oe=await this.fetchResponse(se),ae=w(oe,H.sort??"");if(!ae){console.log("no results",ae);return}if(ae.fields.length!==q.dataFrame.fields.length){console.log("invalid shape",ae,q.dataFrame);return}const ie=ae.length+q.dataFrame.length;ae.fields.forEach(pe=>{const de=q.dataFrame.fields.find(le=>le.name===pe.name);de&&de.values.push(...pe.values)}),q.dataFrame.length=ie;const fe=ae.meta?.custom;if(fe?.locationInfo&&te)for(const[pe,de]of Object.entries(fe.locationInfo))te.locationInfo[pe]=de}Q=void 0},q=new n.R(ne);return{totalRows:te.count??ne.length,view:q,loadMoreItems:async(X,se)=>
289(Y=Math.max(Y,se),Q||(Q=J()),Q),isItemLoaded:X=>X<q.dataFrame.length}}async fetchResponse(H){const _=await(0,s.AI)().get(H);if(!await this.isFolderCacheStale(_.hits)||(this.locationInfo=j(),!await this.isFolderCacheStale(_.hits)))return _;const te=await this.locationInfo,Y=_.hits.map(J=>J.folder===void 0?{...J,location:"general",folder:"general"}:te[J.folder]===void 0?{...J,location:"sharedwithme",folder:"sharedwithme"}:J),Q=_.totalHits-(_.hits.length-Y.length);return{..._,hits:Y,totalHits:Q}}async isFolderCacheStale(H){const _=await this.locationInfo;return H.some(Z=>Z.folder!==void 0&&_[Z.folder]===void 0)}async newRequest(H){H=await(0,m.u4)(H);let _=R;if(_+=`?query=${encodeURIComponent(H.query??"*")}`,_+=`&limit=${H.limit??K}`,(0,C.isEmpty)(H.location)||(_+=`&folder=${H.location}`),H.kind&&(_+="&"+H.kind.map(Z=>`type=${Z}`).join("&")),H.tags?.length&&(_+="&"+H.tags.map(Z=>`tag=${encodeURIComponent(Z)}`).join("&")),H.sort){const Z=H.sort.replace("_sort","").replace("name","title");_+=`&sort=${Z}`;const ne=Z.startsWith("-")?Z.substring(1):Z;_+=`&field=${ne}`}return H.name?.length&&(_+="&"+H.name.map(Z=>`name=${encodeURIComponent(Z)}`).join("&")),H.uid?.length&&(_+="&"+H.uid.map(Z=>`name=${encodeURIComponent(Z)}`).join("&")),_}getFolderViewSort(){return"name_sort"}}const K=50,A=[{name:"views_total",display:"Views total"},{name:"views_last_30_days",display:"Views 30 days"},{name:"errors_total",display:"Errors total"},{name:"errors_last_30_days",display:"Errors 30 days"}];function W(){return{view:new n.R({length:0,fields:[]}),totalRows:0,loadMoreItems:async(M,H)=>{},isItemLoaded:M=>!0}}function N(M){for(const H of A)if(H.name===M)return H.display;return M}function w(M,H){const _=M.hits;if(_.length<1)return{fields:[],length:0};const Z=_.map(te=>{let Y=te.folder;te.resource==="dashboards"&&(0,C.isEmpty)(Y)&&(Y="general");const Q=Object.fromEntries(Object.entries(te.field??{}).map(([J,q])=>[J,q??"-"]));return{...te,uid:te.name,url:V(te.resource,te.name,te.title),tags:te.tags||[],folder:te.folder||"general",location:Y,name:te.title,kind:te.resource.substring(0,te.resource.length-1),...Q}}),ne=(0,r.Vc)(Z);ne.meta={custom:{count:M.totalHits,max_score:1}},H&&ne.meta.custom&&(ne.meta.custom.sortBy=H.startsWith("-")?H.substring(1):H);for(const te of ne.fields)te.display=(0,o.J)({field:te,theme:t.$.theme2});return ne}async function j(){const M=`${R}?type=folders`;return(0,s.AI)().get(M).then(_=>{const Z={general:{kind:"folder",name:"Dashboards",url:"/dashboards"},sharedwithme:{kind:"sharedwithme",name:"Shared with me",url:""}};for(const ne of _.hits)Z[ne.name]={name:ne.title,kind:"folder",url:V("folders",ne.name,ne.title)};return Z})}function V(M,H,_){if(M==="folders")return`/dashboards/f/${H}`;const Z=S.A.slugifyForUrl(_);return`/d/${H}/${Z}`}let U;function F(){if(!U){const M=new v,H=t.$.featureToggles.panelTitleSearch;if(U=H?new h(M):M,H&&location.search.includes("do-frontend-query"))return new P(U);U=t.$.featureToggles.unifiedStorageSearchUI?new L(M):M}return U}},93854:(ee,B,e)=>{"use strict";e.d(B,{TM:()=>m,cu:()=>a,hI:()=>f,u4:()=>r});var t=e(62963),n=e(22429);async function r(h){return h.query&&h.query.indexOf("folder:current")>=0&&(h={...h,location:await o(),query:h.query.replace("folder:current","").trim()},h.query?.length||(h.query="*")),Promise.resolve(h)}async function o(){try{let h=(0,n.UA)().getCurrent();return h||(await s(500),h=(0,n.UA)().getCurrent()),Promise.resolve(h?.meta?.folderUid)}catch(h){console.error(h)}}function s(h){return new Promise(u=>setTimeout(u,h))}function m(h,u){return h==="dashboard"?"apps":h==="folder"?u?"folder-open":"folder":h==="sharedwithme"?"users-alt":"question-circle"}function a(h,u){return h&&(0,t.I2)(h.uid)?"users-alt":m(h.kind,u)}function l(h){switch(h){case"dashboard":case"folder":case"panel":return h;default:return"dashboard"}}function f(h,u){const i=u?.dataFrame.meta?.custom,x={kind:l(h.kind),uid:h.uid,title:h.name,url:h.url,tags:h.tags??[],managedBy:h.managedBy},g=i?.sortBy;if(g){const p=h[g];(typeof p=="string"||typeof p=="number")&&(x.sortMetaName=g,x.sortMeta=p)}if(h.location){const p=h.location.split("/"),c=p[p.length-1],y=i?.locationInfo[c];y&&(x.parentTitle=y.name,x.parentKind=y.kind,x.parentUID=c)}return x}},83458:(ee,B,e)=>{"use strict";e.d(B,{G:()=>t,P:()=>n});var t=(r=>(r.DashDB="dash-db",r.DashHome="dash-home",r.DashFolder="dash-folder",r))(t||{}),n=(r=>(r.List="list",r.Folders="folders",r))(n||{})},35886:(ee,B,e)=>{"use strict";e.d(B,{N1:()=>s,W1:()=>r});var t=e(99090);const n=m=>m?!!(m.query||m.tag?.length>0||m.starred||m.sort):!1,r=()=>{const m=t.G3+".";for(let a=0;a<window.localStorage.length;a++){const l=window.localStorage.key(a);l?.startsWith(m)&&window.localStorage.removeItem(l)}},o=(m="General")=>`${SECTION_STORAGE_KEY}.${m.toLowerCase()}
289`,s=m=>{const a=Object.entries(m).reduce((l,[f,h])=>{if(h){if(f==="tag"&&!Array.isArray(h))return{...l,tag:[h]}}else return l;return{...l,[f]:h}},{});if(m.folder){const l=`folder:${m.folder}`;return{...a,query:`${l} ${(a.query??"").replace(l,"")}`}}return{...a}}},91259:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>E,EC:()=>d,FW:()=>p,G3:()=>l,L5:()=>b,QM:()=>m,Yh:()=>c,aD:()=>f,c3:()=>D,ch:()=>a,dJ:()=>h,ew:()=>P,jE:()=>u,zh:()=>y});var t=e(65307),n=e(96673);const r={serviceAccount:{},isLoading:!0,tokens:[]},o=(0,t.Z0)({name:"serviceaccount",initialState:r,reducers:{serviceAccountFetchBegin:v=>({...v,isLoading:!0}),serviceAccountFetchEnd:v=>({...v,isLoading:!1}),serviceAccountLoaded:(v,C)=>({...v,serviceAccount:C.payload,isLoading:!1}),serviceAccountTokensLoaded:(v,C)=>({...v,tokens:C.payload,isLoading:!1}),rolesFetchBegin:v=>({...v,rolesLoading:!0}),rolesFetchEnd:v=>({...v,rolesLoading:!1})}}),s=o.reducer,{serviceAccountLoaded:m,serviceAccountTokensLoaded:a,serviceAccountFetchBegin:l,serviceAccountFetchEnd:f,rolesFetchBegin:h,rolesFetchEnd:u}=o.actions,i={serviceAccounts:[],isLoading:!0,roleOptions:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,serviceAccountStateFilter:n.ServiceAccountStateFilter.All},x=(0,t.Z0)({name:"serviceaccounts",initialState:i,reducers:{serviceAccountsFetched:(v,C)=>{const{totalCount:S,perPage:O,...I}=C.payload,R=Math.ceil(S/O);return{...v,...I,totalPages:R,perPage:O,showPaging:R>1,isLoading:!1}},serviceAccountsFetchBegin:v=>({...v,isLoading:!0}),serviceAccountsFetchEnd:v=>({...v,isLoading:!1}),acOptionsLoaded:(v,C)=>({...v,roleOptions:C.payload}),queryChanged:(v,C)=>({...v,query:C.payload,page:0}),pageChanged:(v,C)=>({...v,page:C.payload}),stateFilterChanged:(v,C)=>({...v,serviceAccountStateFilter:C.payload})}}),g=x.reducer,{serviceAccountsFetchBegin:p,serviceAccountsFetchEnd:c,serviceAccountsFetched:y,acOptionsLoaded:P,pageChanged:d,stateFilterChanged:D,queryChanged:b}=x.actions,E={serviceAccountProfile:s,serviceAccounts:g}},69807:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>x,NV:()=>u,Y1:()=>l,j7:()=>a,kH:()=>m,pB:()=>h,s7:()=>f,sF:()=>s,sJ:()=>o});var t=e(65307);const n={supportBundles:[],isLoading:!1,supportBundleCollectors:[],createBundlePageLoading:!1,loadBundlesError:"",createBundleError:""},r=(0,t.Z0)({name:"supportBundles",initialState:n,reducers:{supportBundlesLoaded:(g,p)=>({...g,supportBundles:p.payload,isLoading:!1}),fetchBegin:g=>({...g,isLoading:!0}),fetchEnd:g=>({...g,isLoading:!1}),collectorsFetchBegin:g=>({...g,createBundlePageLoading:!0}),collectorsFetchEnd:g=>({...g,createBundlePageLoading:!1}),supportBundleCollectorsLoaded:(g,p)=>({...g,supportBundleCollectors:p.payload,createBundlePageLoading:!1}),setLoadBundleError:(g,p)=>({...g,loadBundlesError:p.payload,supportBundleCollectors:[]}),setCreateBundleError:(g,p)=>({...g,createBundleError:p.payload})}}),{supportBundlesLoaded:o,fetchBegin:s,fetchEnd:m,supportBundleCollectorsLoaded:a,collectorsFetchBegin:l,collectorsFetchEnd:f,setLoadBundleError:h,setCreateBundleError:u}=r.actions,x={supportBundles:r.reducer}},27104:(ee,B,e)=>{"use strict";e.d(B,{$T:()=>x,$u:()=>a,Ay:()=>P,EC:()=>m,L5:()=>s,Q9:()=>o,dJ:()=>l,jE:()=>f,tC:()=>g});var t=e(65307);const n={teams:[],page:1,query:"",perPage:30,totalPages:0,noTeams:!1,hasFetched:!1},r=(0,t.Z0)({name:"teams",initialState:n,reducers:{teamsLoaded:(d,D)=>{const{totalCount:b,perPage:E,...v}=D.payload,C=Math.ceil(b/E);return{...d,...v,totalPages:C,perPage:E,hasFetched:!0}},queryChanged:(d,D)=>({...d,page:1,query:D.payload}),pageChanged:(d,D)=>({...d,page:D.payload}),sortChanged:(d,D)=>({...d,sort:D.payload,page:1}),rolesFetchBegin:d=>({...d,rolesLoading:!0}),rolesFetchEnd:d=>({...d,rolesLoading:!1})}}),{teamsLoaded:o,queryChanged:s,pageChanged:m,sortChanged:a,rolesFetchBegin:l,rolesFetchEnd:f}=r.actions,h=r.reducer,u={team:{},members:[],groups:[],searchMemberQuery:""},i=(0,t.Z0)({name:"team",initialState:u,reducers:{teamLoaded:(d,D)=>({...d,team:D.payload}),teamMembersLoaded:(d,D)=>({...d,members:D.payload}),setSearchMemberQuery:(d,D)=>({...d,searchMemberQuery:D.payload}),teamGroupsLoaded:(d,D)=>({...d,groups:D.payload})}}),{teamLoaded:x,teamGroupsLoaded:g,teamMembersLoaded:p,setSearchMemberQuery:c}=i.actions,y=i.reducer,P={teams:h,team:y}},59373:(ee,B,e)=>{"use strict";e.d(B,{w:()=>Q});var t=e(2543),n=e(37615),r=e(78282),o=e(2863),s=e(56838),m=e(739),a=e(13241),l=e(54742),f=e(8921),h=e(67933),u=e(93612),i=e(99305);let x={};function g(J){const q=x[J];return q||(x[J]=(0,t.property)(J))}class p{constructor(q,X,se){this.state={name:q.name,value:X,text:se,type:q.type}}getValue(q){let{value:X}=this.state;
289return X==="string"||X==="number"||X==="boolean"?X:String(X)}getValueText(){const{value:q,text:X}=this.state;return typeof X=="string"?q===f.To?f.Zm:X:Array.isArray(X)?X.join(" + "):(console.log("value",X),String(X))}}let c;function y(J,q,X){return c?(c.state.name=J.name,c.state.type=J.type,c.state.value=q,c.state.text=X):c=new p(J,q,X),c}function P(J,q,X,se){if(X=X||{},J==null||(0,h.EW)(X)&&q!==m.$m.QueryParam)return"";if(!Array.isArray(J)&&typeof J=="object"&&(J=`${J}`),typeof q=="function")return q(J,X,P);q||(q=m.$m.Glob);let oe=q.split(":");oe.length>1?(q=oe[0],oe=oe.slice(1)):oe=[];let ae=s.vz.getIfExists(q);ae||(console.error(`Variable format ${q} not found. Using glob format as fallback.`),ae=s.vz.get(m.$m.Glob));const ie=y(X,J,se??J);return ae.formatter(J,oe,ie)}var d=e(84743),D=e.n(d),b=e(38036),E=e(5556),v=e(60188),C=e(75421),S=e(66223),O=e(55386),I=e(95004),R=e(7102),T=e(11576),L=e(16515),K=e(71642);function A(J,q,X){return new Proxy({},{get:(se,oe)=>{if(oe==="name")return J.name;if(oe==="displayName")return(0,L.Ct)(J,q,X);if(oe==="labels"||oe==="formattedLabels")return J.labels?{...J.labels,__values:Object.values(J.labels).sort().join(", "),toString:()=>(0,K.h6)(J.labels,"",!0)}:""}})}function W(J,q,X,se){const oe=N(J,q,X);return P(oe,se)}function N(J,q,X){const se=X?.__dataContext;if(!se)return J;const{frame:oe,rowIndex:ae,field:ie,calculatedValue:fe}=se.value;if(fe)switch(q){case"numeric":return fe.numeric.toString();case"raw":return fe.numeric;case"time":return"";case"text":default:return(0,O.cN)(fe)}if(ae===void 0)return J;if(q==="time"){const me=oe.fields.find(De=>De.type===I.PU.time);return me?me.values[ae]:void 0}const pe=ie.values[ae];if(q==="raw")return pe;const le=(ie.display??V())(pe);switch(q){case"numeric":return le.numeric;case"text":return le.text;default:return(0,O.cN)(le)}}function w(J,q,X,se){const oe=X?.__dataContext;if(!oe||!q)return J;const{frame:ae,rowIndex:ie}=oe.value;if(ie===void 0||q===void 0)return J;const fe={name:ae.name,refId:ae.refId,fields:(0,R.F)({frame:ae,rowIndex:ie})},pe=g(q)(fe)??"";return P(pe,se)}let j;function V(){return j||(j=(0,T.J)()),j}function U(J,q,X,se){const oe=X?.__dataContext;if(!oe||q!=="name")return J;const{frame:ae,frameIndex:ie}=oe.value,fe=(0,L.Ri)(ae,ie);return P(fe,se)}function F(J,q,X,se){const oe=X?.__dataContext;if(!oe||q===void 0||q==="")return J;const{frame:ae,field:ie,data:fe}=oe.value,pe=A(ie,ae,fe),de=g(q)(pe)??"";return P(de,se)}const M={__value:W,__data:w,__series:U,__field:F,[b.c.includeVars]:H,[b.c.keepTime]:_,__timezone:Z};function H(J,q,X){const se=(0,S.z)(X);return E.kM.toUrlParams(se)}function _(){return E.kM.toUrlParams((0,C.jG)().timeRangeForUrl())}function Z(){const J=(0,v.O)({timeZone:(0,C.jG)().timeModel?.getTimezone()});return J==="browser"?D().tz.guess():J}const ne={getFilteredVariables:u.bZ,getVariables:u.UN,getVariableWithName:u._2};class te{constructor(q=ne){this.dependencies=q,this.regex=i.SY,this.index={},this.grafanaVariables=new Map,this._timeRange=null,this._adhocFiltersDeprecationWarningLogged=new Map,this._variables=[]}init(q,X){this._variables=q,this._timeRange=X,this.updateIndex()}get variables(){return(0,n.l)("template_srv.ts","variables","getVariables"),this.getVariables()}getVariables(){return window.__grafanaSceneContext?(0,a.E)(window.__grafanaSceneContext):this.dependencies.getVariables()}get timeRange(){return window.__grafanaSceneContext&&window.__grafanaSceneContext.isActive?s.jh.getTimeRange(window.__grafanaSceneContext).state.value:this._timeRange}updateIndex(){const q=X=>X||X==="";if(this.index=this._variables.reduce((X,se)=>(se.current&&(se.current.isNone||q(se.current.value))&&(X[se.name]=se),X),{}),this.timeRange){const X=this.timeRange.from.valueOf().toString(),se=this.timeRange.to.valueOf().toString();this.index={...this.index,__from:{current:{value:X,text:X}},__to:{current:{value:se,text:se}}}}}updateTimeRange(q){this._timeRange=q,this.updateIndex()}variableInitialized(q){this.index[q.name]=q}getAdhocFilters(q,X){let se=[],oe=(0,r.l)().getInstanceSettings(q);if(!oe)return[];!X&&!this._adhocFiltersDeprecationWarningLogged.get(oe.type)&&((0,n.l)(`DataSource ${oe.type}`,"templateSrv.getAdhocFilters","filters property on the request (DataQueryRequest). Or if this is called from interpolateVariablesInQueries or applyTemplateVariables it is passed as a new argument"),this._adhocFiltersDeprecationWarningLogged.set(oe.type,!0));for(const ae of this.getAdHocVariables()){const ie=ae.datasource?.uid;(ie===oe.uid||ie?.indexOf("$")===0&&this.replace(ie)===oe.uid)&&(se=se.concat(ae.filters))}return se}setGrafanaVariable(q,X){this.grafanaVariables.set(q,X)}setGlobalVariable(q,X){(0,n.l)("template_srv.ts","setGlobalVariable",""),this.index={...this.index,[q]:{current:X}}}getVariableName(q){this.regex.lastIndex=0;const X=this.regex.exec(q);return X?X.slice(1).find(oe=>oe!==void 0):null}containsTemplate(q){if(!q)return!1;
289if(window.__grafanaSceneContext&&window.__grafanaSceneContext.isActive)return this.regex.lastIndex=0,!!this.regex.exec(q);const X=this.getVariableName(q),se=X&&this.getVariableAtIndex(X);return se!=null}variableExists(q){return(0,n.l)("template_srv.ts","variableExists","containsTemplate"),this.containsTemplate(q)}highlightVariablesAsHtml(q){return!q||!(0,t.isString)(q)?q:(q=(0,t.escape)(q),this._replaceWithVariableRegex(q,void 0,(X,se)=>this.getVariableAtIndex(se)?'<span class="template-variable">'+X+"</span>":X))}getAllValue(q){if(q.allValue)return q.allValue;const X=[];for(let se=1;se<q.options.length;se++)X.push(q.options[se].value);return X}getVariableValue(q,X){return X?g(X)(q.value):q.value}getVariableText(q,X){return q.value===X||typeof X!="string"?q.text:X}replace(q,X,se,oe){if(X&&X.__sceneObject){const ae=X.__sceneObject.value.valueOf();return s.jh.interpolate(ae,q,X,se,oe)}return window.__grafanaSceneContext&&window.__grafanaSceneContext.isActive?s.jh.interpolate(window.__grafanaSceneContext,q,X,se,oe):q?(this.regex.lastIndex=0,this._replaceWithVariableRegex(q,se,(ae,ie,fe,pe)=>{const de=this._evaluateVariableExpression(ae,ie,fe,pe,X);return oe&&oe.push({match:ae,variableName:ie,fieldPath:fe,format:pe,value:de,found:de!==ae}),de})):q??""}_evaluateVariableExpression(q,X,se,oe,ae){const ie=this.getVariableAtIndex(X),fe=ae?.[X];if(fe){const me=this.getVariableValue(fe,se),De=this.getVariableText(fe,me);if(me!=null)return P(me,oe,ie,De)}if(!ie){const me=M[X];return me?me(q,se,ae,oe):q}if(oe===m.$m.QueryParam||(0,h.EW)(ie)){const me=l.B.get(ie.type).getValueForUrl(ie),De=(0,h.EW)(ie)?ie.id:ie.current.text;return P(me,oe,ie,De)}const pe=this.grafanaVariables.get(ie.current.value);if(pe)return P(pe,oe,ie);let de=ie.current.value,le=ie.current.text;if(this.isAllValue(de)&&(de=this.getAllValue(ie),le=f.Zm,ie.allValue&&oe!==m.$m.Text&&oe!==m.$m.PercentEncode))return this.replace(de);if(se){const me=this.getVariableValue({value:de,text:le},se);if(me!=null)return P(me,oe,ie,le)}return P(de,oe,ie,le)}_replaceWithVariableRegex(q,X,se){return this.regex.lastIndex=0,q.replace(this.regex,(oe,ae,ie,fe,pe,de,le)=>se(oe,ae||ie||pe,de,fe||le||X))}isAllValue(q){return q===f.To||Array.isArray(q)&&q[0]===f.To}replaceWithText(q,X){return(0,n.l)("template_srv.ts","replaceWithText()","replace(), and specify the :text format"),this.replace(q,X,"text")}getVariableAtIndex(q){if(q)return this.index[q]?this.index[q]:this.dependencies.getVariableWithName(q)}getAdHocVariables(){return this.dependencies.getFilteredVariables(h.EW)}}const Y=new te;(0,o.d)(Y);const Q=()=>Y},13572:(ee,B,e)=>{"use strict";e.d(B,{J:()=>c});var t=e(739),n=e(44017),r=e(74848),o=e(96540),s=e(79609),m=e(2863),a=e(32881),l=e(77824),f=e(56840),h=e(17200),u=e(72598),i=e(16553);const x=[{label:"Size",value:t.J1.Size,description:"Split the buckets based on size"},{label:"Count",value:t.J1.Count,description:"Split the buckets based on count"}],g=[{label:"Split",value:t.J1.Size,description:"Split the buckets based on size"}],p=({value:y,onChange:P,item:d})=>{const[D,b]=(0,o.useState)(!1),E=(0,o.useRef)(0),v=d.settings?.allowInterval??!1,C=({mode:I,scale:R,value:T=""})=>{let L=!0;I!==t.J1.Count&&(v?T!==""&&(0,i.Fv)(T)===void 0&&(L=!1):L=(0,u.N_)(T)),b(!L),P({mode:I,scale:R,value:T})},O=(0,m.w)().getVariables().map(I=>({value:I.name,label:I.label||I.name,origin:s.$0.Template}));return(0,r.jsxs)(a.Gy,{children:[(0,r.jsx)(l.z,{value:y?.mode||t.J1.Size,options:y?.scale?.type===t.L4.Log?g:x,onChange:I=>{E.current++,C({...y,value:"",mode:I})}}),(0,r.jsx)(h.y,{invalid:D,error:"Value needs to be an integer or a variable",value:y?.value??"",placeholder:(0,f.t)("transformers.axis-editor.placeholder-auto","Auto"),onChange:I=>{C({...y,value:I})},suggestions:O},E.current)]})};function c(y,P,d,D){P.addCustomEditor({id:"xBuckets",path:`${y}xBuckets`,name:"X Bucket",editor:p,category:D,defaultValue:{mode:t.J1.Size},settings:{allowInterval:!0}}),P.addCustomEditor({id:"yBuckets",path:`${y}yBuckets`,name:"Y Bucket",editor:p,category:D,defaultValue:{mode:t.J1.Size}}),P.addCustomEditor({id:"yBuckets-scale",path:`${y}yBuckets.scale`,name:"Y Bucket scale",category:D,editor:n.W1,defaultValue:{type:t.L4.Linear}})}},48264:(ee,B,e)=>{"use strict";e.d(B,{Nb:()=>c,VQ:()=>d,eE:()=>p,wY:()=>i,yJ:()=>y});var t=e(81160),n=e(64761),r=e(79319),o=e(95004),s=e(16515),m=e(55386),a=e(39443),l=e(74261),f=e(8721),h=e(739),u=e(16553);const i={id:n.F.heatmap,name:"Create heatmap",description:"Generate heatmap data from source data.",defaultOptions:{},isApplicable:v=>{const{xField:C,yField:S,xs:O,ys:I}=D(v);return C||S||!O.length||!I.length?r.M.NotPossible:r.M.Applicable},isApplicableDescription:"The Heatmap transformation requires fields with Heatmap compatible data. No fields with Heatmap data could be found.",operator:(v,C)=>S=>S.pipe((0,t.T)(O=>i.transformer(v,C)(O))),transformer:v=>C=>{const S=d(C,v);return v.keepOriginalData?[S,...C]:[S]}};function x(v){return v==="+Inf"?1/0:v==="-Inf"?-1/0:+(v??0)}function g(v,C){return x(v)-x(C)}function p(v){return v?.meta?.custom??{}}function c(v){let C=!1;for(let S of v.fields)switch(S.name){case"y":case"yMin":case"yMax":if(C)return!1;C=!0}return C}function y(v){const C=v.frame.fields[0],S=C.values,O=v.frame.fields.filter((j,V)=>j.type===o.PU.number&&V>0),I=S.length*O.length,R=new Array(I),T=new Array(I),L=new Array(I),K=O.map(j=>j.values.slice());
289K.forEach((j,V)=>{for(let U=0;U<j.length;U++)L[K.length*U+V]=j[U]});const A=Array.from({length:O.length},(j,V)=>V);for(let j=0,V=0,U=0;j<I;V=++j%A.length)T[j]=A[V],V===0&&j>=A.length&&U++,R[j]=S[U];let W=O[0].labels?.le!=null?"yMax":"y";switch(v.layout){case h.D7.le:W="yMax";break;case h.D7.ge:W="yMin";break;case h.D7.unknown:W="y";break}const N={yOrdinalDisplay:O.map(j=>(0,s.Ct)(j,v.frame)),yMatchWithLabel:Object.keys(O[0].labels??{})[0]};if(N.yMatchWithLabel&&(N.yOrdinalLabel=O.map(j=>j.labels?.[N.yMatchWithLabel]??""),N.yMatchWithLabel==="le"&&(N.yMinDisplay="0.0")),v.unit?.length||v.decimals!=null){const j=(0,m.j_)(v.unit??"short");N.yMinDisplay&&(N.yMinDisplay=(0,m.cN)(j(0,v.decimals))),N.yOrdinalDisplay=N.yOrdinalDisplay.map(V=>{let U=+V;return Number.isNaN(U)?V:(0,m.cN)(j(U,v.decimals))})}const w={...O[0].config};return w.displayNameFromDS&&delete w.displayNameFromDS,{length:R.length,refId:v.frame.refId,meta:{type:a.m.HeatmapCells,custom:N},fields:[{name:C.type===o.PU.time?"xMax":"x",type:C.type,values:R,config:C.config},{name:W,type:o.PU.number,values:T,config:{unit:"short"}},{name:v.value?.length?v.value:"Value",type:o.PU.number,values:L,config:w,display:O[0].display}]}}function P(v){v=v.slice(),v.sort((S,O)=>g(S.name,O.name));const C=v.map(S=>S.fields[1].values.slice());return C.reverse(),C.forEach((S,O)=>{if(O<C.length-1)for(let I=0;I<S.length;I++)S[I]-=C[O+1][I]}),C.reverse(),v.map((S,O)=>({...S,fields:[S.fields[0],{...S.fields[1],values:C[O]}]}))}function d(v,C){const{xField:S,yField:O,xs:I,ys:R}=D(v);if(!S||!O)throw"no heatmap fields found";if(!I.length||!R.length)throw"no values found";const T=C.xBuckets??{},L=C.yBuckets??{};if(T.scale?.type===h.L4.Log)throw"X axis only supports linear buckets";const K=C.yBuckets?.scale??{type:h.L4.Linear},A=b(I,R,{xSorted:(0,f.g2)(I),xTime:S.type===o.PU.time,xMode:T.mode,xSize:T.mode===h.J1.Size?(0,u.Fv)(T.value??""):T.value?+T.value:void 0,yMode:L.mode,ySize:L.value?+L.value:void 0,yLog:K?.type===h.L4.Log?K?.log:void 0,xMin:C.timeRange?.from.valueOf(),xMax:C.timeRange?.to.valueOf()});return{length:A.x.length,name:(0,s.Ct)(O),meta:{type:a.m.HeatmapCells},fields:[{name:"xMin",type:S.type,values:A.x,config:S.config},{name:"yMin",type:o.PU.number,values:A.y,config:{...O.config,custom:{scaleDistribution:K}}},{name:"Count",type:o.PU.number,values:A.count,config:{unit:"short"}}]}}function D(v){let C,S,O=0;for(let L of v)L.fields.find(A=>A.type===o.PU.time)&&(O+=L.length);let I=Array(O),R=Array(O),T=0;for(let L of v){const K=L.fields.find(W=>W.type===o.PU.time);if(!K)continue;C||(C=K);const A=K.values;for(let W of L.fields)if(W!==K&&W.type===o.PU.number){const N=W.values;for(let w=0;w<A.length;w++,T++)I[T]=A[w],R[T]=N[w];S||(S=W)}}return{xField:C,yField:S,xs:I,ys:R}}function b(v,C,S){let O=v.length,I=S?.xSorted??!1,R=S?.ySorted??!1,T=S?.xMin??(I?v[0]:1/0),L=R?C[0]:1/0,K=S?.xMax??(I?v[O-1]:-1/0),A=R?C[O-1]:-1/0,W=S?.yLog,N=S?.xMin!=null&&S?.xMax!=null,w=S?.yMin!=null&&S?.yMax!=null;for(let se=0;se<O;se++)!I&&!N&&(T=Math.min(T,v[se]),K=Math.max(K,v[se])),!R&&!w&&(!W||C[se]>0)&&(L=Math.min(L,C[se]),A=Math.max(A,C[se]));let j=S?.xSize??0,V=S?.ySize??0,U=S?.xMode,F=S?.yMode;if((!Number.isFinite(j)||j<=0)&&(U=h.J1.Count,j=20),(!Number.isFinite(V)||V<=0)&&(F=h.J1.Count,V=10),U===h.J1.Count){let se=(K-T)/Math.max(j-1,1),oe=S?.xTime?u.q_:u.eO,ae=oe.findIndex(ie=>ie>se)-1;j=oe[Math.max(ae,0)]}if(F===h.J1.Count){let se=(A-L)/Math.max(V-1,1),oe=S?.yTime?u.q_:u.eO,ae=oe.findIndex(ie=>ie>se)-1;V=oe[Math.max(ae,0)]}let M=S?.xCeil?se=>(0,l.Uh)(se,j):se=>(0,l.rs)(se,j),H=S?.yCeil?se=>(0,l.Uh)(se,V):se=>(0,l.rs)(se,V);if(W){V=1/(S?.ySize??1);let se=W===2?Math.log2:Math.log10;H=S?.yCeil?oe=>(0,l.Uh)(se(oe),V):oe=>(0,l.rs)(se(oe),V)}let _=M(T),Z=M(K),ne=H(L),te=H(A),Y=Math.round((Z-_)/j)+1,Q=Math.round((te-ne)/V)+1,[J,q,X]=E(Y,Q,_,j,ne,V,W);for(let se=0;se<O;se++){if(W&&C[se]<=0)continue;const oe=(M(v[se])-_)/j,ae=(H(C[se])-ne)/V,ie=oe*Q+ae;X[ie]++}return{x:J,y:q,count:X}}function E(v,C,S,O,I,R,T){const L=v*C,K=new Array(L),A=new Array(L),W=new Array(L);for(let N=0,w=0,j=S;N<L;w=++N%C)W[N]=0,T?A[N]=T**(I+w*R):A[N]=I+w*R,w===0&&N>=C&&(j+=O),K[N]=j;return[K,A,W]}},16553:(ee,B,e)=>{"use strict";e.d(B,{Fv:()=>b,eO:()=>g,q_:()=>D});var t=e(79243),n=e(74529),r=e(72598);const{abs:o,pow:s}=Math,m=new Map;function a(E,v,C,S){let O=[],I=S.map(t.E);for(let R=v;R<C;R++){let T=o(R),L=(0,t.h)(s(E,R),T);for(let K=0;K<S.length;K++){let A=S[K]*L,W=(A>=0&&R>=0?0:T)+(R>=I[K]?0:I[K]),N=(0,t.h)(A,W);O.push(N),m.set(N,W)}}return O}const l=E=>
289E%1===0,f=[1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5],h=a(10,-16,0,f),u=a(10,0,16,f),i=u.filter(l),x=h.concat(u),g=h.concat(i),p=1*1e3,c=60*p,y=60*c,P=24*y,d=365*P,D=[1,2,4,5,10,20,25,40,50,100,200,250,400,500,p,2*p,4*p,5*p,10*p,15*p,20*p,30*p,c,2*c,4*c,5*c,10*c,15*c,20*c,30*c,y,2*y,4*y,6*y,8*y,12*y,18*y,P,2*P,3*P,4*P,5*P,6*P,7*P,10*P,15*P,30*P,45*P,60*P,90*P,180*P,d,2*d,3*d,4*d,5*d,6*d,7*d,8*d,9*d,10*d],b=E=>{if((0,r.N_)(E)){const C=Number.parseInt(E,10);return Number.isNaN(C)?void 0:C}else{if((0,n.di)(E))return(0,n.WT)((0,n.E9)(E));{const S=E.match(/(\d+)ms$/i);if(S){const O=Number.parseInt(S[1],10);return Number.isNaN(O)?void 0:O}else return}}}},84510:(ee,B,e)=>{"use strict";e.d(B,{$n:()=>r,g_:()=>t,uk:()=>n});var t=(s=>(s.ShortcodeFigure="shortcodeFigure",s.UIImage="uiImage",s))(t||{});const n={calculateField:{name:"Add field from calculation",getHelperDocs:function(s="shortcodeFigure"){return` 290Use this transformation to add a new field calculated from two other fields. Each transformation allows you to add one new field. 291 292- **Mode** - Select a mode: 293 - **Reduce row** - Apply selected calculation on each row of selected fields independently. 294 - **Binary operation** - Apply basic binary operations (for example, sum or multiply) on values in a single row from two selected fields. 295 - **Unary operation** - Apply basic unary operations on values in a single row from a selected field. The available operations are: 296 - **Absolute value (abs)** - Returns the absolute value of a given expression. It represents its distance from zero as a positive number. 297 - **Natural exponential (exp)** - Returns _e_ raised to the power of a given expression. 298 - **Natural logarithm (ln)** - Returns the natural logarithm of a given expression. 299 - **Floor (floor)** - Returns the largest integer less than or equal to a given expression. 300 - **Ceiling (ceil)** - Returns the smallest integer greater than or equal to a given expression. 301 - **Cumulative functions** - Apply functions on the current row and all preceding rows. 302 - **Total** - Calculates the cumulative total up to and including the current row. 303 - **Mean** - Calculates the mean up to and including the current row. 304 - **Window functions** - Apply window functions. The window can either be **trailing** or **centered**. 305 With a trailing window the current row will be the last row in the window. 306 With a centered window the window will be centered on the current row. 307 For even window sizes, the window will be centered between the current row, and the previous row. 308 - **Mean** - Calculates the moving mean or running average. 309 - **Stddev** - Calculates the moving standard deviation. 310 - **Variance** - Calculates the moving variance. 311 - **Row index** - Insert a field with the row index. 312- **Field name** - Select the names of fields you want to use in the calculation for the new field. 313- **Calculation** - If you select **Reduce row** mode, then the **Calculation** field appears. Click in the field to see a list of calculation choices you can use to create the new field. For information about available calculations, refer to [Calculation types][]. 314- **Operation** - If you select **Binary operation** or **Unary operation** mode, then the **Operation** fields appear. These fields allow you to apply basic math operations on values in a single row from selected fields. You can also use numerical values for binary operations. 315 - **All number fields** - Set the left side of a **Binary operation** to apply the calculation to all number fields. 316- **As percentile** - If you select **Row index** mode, then the **As percentile** switch appears. This switch allows you to transform the row index as a percentage of the total number of rows. 317- **Alias** - (Optional) Enter the name of your new field. If you leave this blank, then the field will be named to match the calculation. 318- **Replace all fields** - (Optional) Select this option if you want to hide all other fields and display only your calculated field in the visualization. 319 320In the example below, we added two fields together and named them Sum. 321 322${o("/static/img/docs/transformations/add-field-from-calc-stat-example-7-0.png",s,"A stat visualization including one field called Sum")} 323 `},links:[{title:"Calculation types",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/calculation-types/"}]},concatenate:{name:"Concatenate fields",getHelperDocs:function(){return` 324Use this transformation to combine all fields from all frames into one result. 325 326For example, if you have separate queries retrieving temperature and uptime data (Query A) and air quality index and error information (Query B), applying the concatenate transformation yields a consolidated data frame with all relevant information in one view. 327 328Consider the following: 329 330**Query A:** 331 332| Temp | Uptime | 333| ----- | ------- | 334| 15.4 | 1230233 | 335 336**Query B:** 337 338| AQI | Errors | 339| ----- | ------ |
340| 3.2 | 5 | 341 342After you concatenate the fields, the data frame would be: 343 344| Temp | Uptime | AQI | Errors | 345| ---- | ------- | --- | ------ | 346| 15.4 | 1230233 | 3.2 | 5 | 347 348This transformation simplifies the process of merging data from different sources, providing a comprehensive view for analysis and visualization. 349 `}},configFromData:{name:"Config from query results",getHelperDocs:function(){return` 350Use this transformation to select a query and extract standard options, such as **Min**, **Max**, **Unit**, and **Thresholds**, and apply them to other query results. This feature enables dynamic visualization configuration based on the data returned by a specific query. 351 352#### Options 353 354- **Config query** - Select the query that returns the data you want to use as configuration. 355- **Apply to** - Select the fields or series to which the configuration should be applied. 356- **Apply to options** - Specify a field type or use a field name regex, depending on your selection in **Apply to**. 357 358#### Field mapping table 359 360Below the configuration options, you'll find the field mapping table. This table lists all fields found in the data returned by the config query, along with **Use as** and **Select** options. It provides control over mapping fields to config properties, and for multiple rows, it allows you to choose which value to select. 361 362#### Example 363 364Input[0] (From query: A, name: ServerA) 365 366| Time | Value | 367| ------------- | ----- | 368| 1626178119127 | 10 | 369| 1626178119129 | 30 | 370 371Input[1] (From query: B) 372 373| Time | Value | 374| ------------- | ----- | 375| 1626178119127 | 100 | 376| 1626178119129 | 100 | 377 378Output (Same as Input[0] but now with config on the Value field) 379 380| Time | Value (config: Max=100) | 381| ------------- | ----------------------- | 382| 1626178119127 | 10 | 383| 1626178119129 | 30 | 384 385Each row in the source data becomes a separate field. Each field now has a maximum configuration option set. Options such as **Min**, **Max**, **Unit**, and **Thresholds** are part of the field configuration. If set, they are used by the visualization instead of any options manually configured in the panel editor options pane. 386 387#### Value mappings 388 389You can also transform a query result into value mappings. With this option, every row in the configuration query result defines a single value mapping row. See the following example. 390 391Config query result: 392 393| Value | Text | Color | 394| ----- | ------ | ----- | 395| L | Low | blue | 396| M | Medium | green | 397| H | High | red | 398 399In the field mapping specify: 400 401| Field | Use as | Select | 402| ----- | ----------------------- | ---------- | 403| Value | Value mappings / Value | All values | 404| Text | Value mappings / Text | All values | 405| Color | Value mappings / Color | All values | 406 407Grafana builds value mappings from your query result and applies them to the real data query results. You should see values being mapped and colored according to the config query results. 408 409> **Note:** When you use this transformation for thresholds, the visualization continues to use the panel's base threshold. 410 411 `}},convertFieldType:{name:"Convert field type",getHelperDocs:function(){return` 412Use this transformation to modify the field type of a specified field. 413 414This transformation has the following options: 415 416- **Field** - Select from available fields 417- **as** - Select the FieldType to convert to 418 - **Numeric** - attempts to make the values numbers 419 - **String** - will make the values strings 420 - **Time** - attempts to parse the values as time 421 - The input will be parsed according to the [Moment.js parsing format](https://momentjs.com/docs/#/parsing/) 422 - It will parse the numeric input as a Unix epoch timestamp in milliseconds. 423 You must multiply your input by 1000 if it's in seconds. 424 - Will show an option to specify a DateFormat as input by a string like yyyy-mm-dd or DD MM YYYY hh:mm:ss 425 - **Boolean** - will make the values booleans 426 - **Enum** - will make the values enums 427 - Will show a table to manage the enums 428 - **Other** - attempts to parse the values as JSON 429 430For example, consider the following query that could be modified by selecting the time field as Time and specifying Date Format as YYYY. 431 432#### Sample Query 433 434| Time | Mark | Value | 435|------------|-------|-------| 436| 2017-07-01 | above | 25 | 437| 2018-08-02 | below | 22 | 438| 2019-09-02 | below | 29 | 439| 2020-10-04 | above | 22 | 440 441The result: 442 443#### Transformed Query 444 445| Time | Mark | Value | 446|---------------------|-------|-------| 447| 2017-01-01 00:00:00 | above | 25 | 448| 2018-01-01 00:00:00 | below | 22 | 449| 2019-01-01 00:00:00 | below | 29 | 450| 2020-01-01 00:00:00 | above | 22 | 451 452This transformation allows you to flexibly adapt your data types, ensuring compatibility and consistency in your visualizations. 453 `}},extractFields:{name:"Extract fields",getHelperDocs:function(s="shortcodeFigure"){return` 454Use this transformation to select a source of data and extract content from it in different formats. This transformation has the following fields: 455 456- **Source** - Select the field for the source of data. 457- **Format** - Choose one of the following: 458 - **JSON** - Parse JSON content from the source. 459 - **Key+value pairs** - Parse content in the format 'a=b' or 'c:d' from the source. 460 - **RegExp** - Parse content using a regular expression with [named capturing group(s)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Named_capturing_group) like \`/(?<NewField>.*)/\`. 461 ${o("/media/docs/grafana/panels-visualizations/screenshot-regexp-detail-v11.3-2.png",s,"Example of a regular expression")} 462 - **Auto** - Discover fields automatically. 463- **Replace All Fields** - (Optional) Select this option to hide all other fields and display only your calculated field in the visualization. 464- **Keep Time** - (Optional) Available only if **Replace All Fields** is true. Keeps the time field in the output. 465 466Consider the following dataset: 467 468#### Dataset Example 469 470| Timestamp | json_data | 471|---------------------|---------------| 472| 1636678740000000000 | {"value": 1} | 473| 1636678680000000000 | {"value": 5} | 474| 1636678620000000000 | {"value": 12} | 475 476You could prepare the data to be used by a [Time series panel][] with this configuration: 477 478- Source: json_data 479- Format: JSON 480 - Field: value 481 - Alias: my_value 482- Replace all fields: true 483- Keep time: true 484 485This will generate the following output: 486 487#### Transformed Data 488 489| Timestamp | my_value | 490|---------------------|----------| 491| 1636678740000000000 | 1 | 492| 1636678680000000000 | 5 | 493| 1636678620000000000 | 12 | 494 495This transformation allows you to extract and format data in various ways. You can customize the extraction format based on your specific data needs. 496 `},links:[{title:"Time series panel",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/time-series/"}]}
496,fieldLookup:{name:"Lookup fields from resource",getHelperDocs:function(){return` 497Use this transformation to enrich a field value by looking up additional fields from an external source. 498 499This transformation has the following fields: 500 501- **Field** - Select a text field from your dataset. 502- **Lookup** - Choose from **Countries**, **USA States**, and **Airports**. 503 504This transformation currently supports spatial data. 505 506For example, if you have this data: 507 508#### Dataset Example 509 510| Location | Values | 511|-----------|--------| 512| AL | 0 | 513| AK | 10 | 514| Arizona | 5 | 515| Arkansas | 1 | 516| Somewhere | 5 | 517 518With this configuration: 519 520- Field: location 521- Lookup: USA States 522 523You'll get the following output: 524 525#### Transformed Data 526 527| Location | ID | Name | Lng | Lat | Values | 528|-----------|----|----------|-------------|-----------|--------| 529| AL | AL | Alabama | -80.891064 | 12.448457 | 0 | 530| AK | AK | Arkansas | -100.891064 | 24.448457 | 10 | 531| Arizona | | | | | 5 | 532| Arkansas | | | | | 1 | 533| Somewhere | | | | | 5 | 534 535This transformation lets you augment your data by fetching additional information from external sources, providing a more comprehensive dataset for analysis and visualization. 536 `}},filterByRefId:{name:"Filter data by query refId",getHelperDocs:function(s="shortcodeFigure"){return` 537Use this transformation to hide one or more queries in panels that have multiple queries. 538 539Grafana displays the query identification letters in dark gray text. Click a query identifier to toggle filtering. If the query letter is white, then the results are displayed. If the query letter is dark, then the results are hidden. 540 541> **Note:** This transformation is not available for Graphite because this data source does not support correlating returned data with queries. 542 543In the example below, the panel has three queries (A, B, C). We removed the B query from the visualization. 544 545${o("/static/img/docs/transformations/filter-by-query-stat-example-7-0.png",s,"A stat visualization with results from two queries, A and C")} 546 `}},filterByValue:{name:"Filter data by values",getHelperDocs:function(){return` 547Use this transformation to selectively filter data points directly within your visualization. This transformation provides options to include or exclude data based on one or more conditions applied to a selected field. 548 549This transformation is very useful if your data source does not natively filter by values. You might also use this to narrow values to display if you are using a shared query. 550 551The available conditions for all fields are: 552 553- **Regex** - Match a regex expression. 554- **Is Null** - Match if the value is null. 555- **Is Not Null** - Match if the value is not null. 556- **Equal** - Match if the value is equal to the specified value. 557- **Different** - Match if the value is different than the specified value. 558 559The available conditions for string fields are: 560 561- **Contains substring** - Match if the value contains the specified substring (case insensitive). 562- **Does not contain substring** - Match if the value doesn't contain the specified substring (case insensitive). 563 564The available conditions for number fields are: 565 566- **Greater** - Match if the value is greater than the specified value. 567- **Lower** - Match if the value is lower than the specified value. 568- **Greater or equal** - Match if the value is greater or equal. 569- **Lower or equal** - Match if the value is lower or equal. 570- **Range** - Match a range between a specified minimum and maximum, min and max included. 571 572Consider the following dataset: 573 574#### Dataset Example 575 576| Time | Temperature | Altitude | 577|---------------------|-------------|----------| 578| 2020-07-07 11:34:23 | 32 | 101 | 579| 2020-07-07 11:34:22 | 28 | 125 | 580| 2020-07-07 11:34:21 | 26 | 110 | 581| 2020-07-07 11:34:20 | 23 | 98 | 582| 2020-07-07 10:32:24 | 31 | 95 | 583| 2020-07-07 10:31:22 | 20 | 85 | 584| 2020-07-07 09:30:57 | 19 | 101 | 585 586If you **Include** the data points that have a temperature below 30\xB0C, the configuration will look as follows: 587 588- Filter Type: 'Include' 589- Condition: Rows where 'Temperature' matches 'Lower Than' '30' 590 591And you will get the following result, where only the temperatures below 30\xB0C are included: 592 593#### Transformed Data 594 595| Time | Temperature | Altitude | 596|---------------------|-------------|----------| 597| 2020-07-07 11:34:22 | 28 | 125 |
598| 2020-07-07 11:34:21 | 26 | 110 | 599| 2020-07-07 11:34:20 | 23 | 98 | 600| 2020-07-07 10:31:22 | 20 | 85 | 601| 2020-07-07 09:30:57 | 19 | 101 | 602 603You can add more than one condition to the filter. For example, you might want to include the data only if the altitude is greater than 100. To do so, add that condition to the following configuration: 604 605- Filter type: 'Include' rows that 'Match All' conditions 606- Condition 1: Rows where 'Temperature' matches 'Lower' than '30' 607- Condition 2: Rows where 'Altitude' matches 'Greater' than '100' 608 609When you have more than one condition, you can choose if you want the action (include/exclude) to be applied on rows that **Match all** conditions or **Match any** of the conditions you added. 610 611In the example above, we chose **Match all** because we wanted to include the rows that have a temperature lower than 30\xB0C *AND* an altitude higher than 100. If we wanted to include the rows that have a temperature lower than 30\xB0C *OR* an altitude higher than 100 instead, then we would select **Match any**. This would include the first row in the original data, which has a temperature of 32\xB0C (does not match the first condition) but an altitude of 101 (which matches the second condition), so it is included. 612 613Conditions that are invalid or incompletely configured are ignored. 614 615This versatile data filtering transformation lets you to selectively include or exclude data points based on specific conditions. Customize the criteria to tailor your data presentation to meet your unique analytical needs. 616 `}},filterFieldsByName:{name:"Filter fields by name",getHelperDocs:function(s="shortcodeFigure"){return` 617Use this transformation to selectively remove parts of your query results. There are three ways to filter field names: 618 619- [Using a regular expression](#use-a-regular-expression) 620- [Manually selecting included fields](#manually-select-included-fields) 621- [Using a dashboard variable](#use-a-dashboard-variable) 622 623#### Use a regular expression 624 625When you filter using a regular expression, field names that match the regular expression are included. 626 627For example, from the input data: 628 629| Time | dev-eu-west | dev-eu-north | prod-eu-west | prod-eu-north | 630| ------------------- | ----------- | ------------ | ------------ | ------------- | 631| 2023-03-04 23:56:23 | 23.5 | 24.5 | 22.2 | 20.2 | 632| 2023-03-04 23:56:23 | 23.6 | 24.4 | 22.1 | 20.1 | 633 634The result from using the regular expression 'prod.*' would be: 635 636| Time | prod-eu-west | prod-eu-north | 637| ------------------- | ------------ | ------------- | 638| 2023-03-04 23:56:23 | 22.2 | 20.2 | 639| 2023-03-04 23:56:23 | 22.1 | 20.1 | 640 641The regular expression can include an interpolated dashboard variable by using the \${variableName} syntax. 642 643#### Manually select included fields 644 645Click and uncheck the field names to remove them from the result. Fields that are matched by the regular expression are still included, even if they're unchecked. 646 647#### Use a dashboard variable 648 649Enable 'From variable' to let you select a dashboard variable that's used to include fields. By setting up a [dashboard variable][] with multiple choices, the same fields can be displayed across multiple visualizations. 650 651${o("/static/img/docs/transformations/filter-name-table-before-7-0.png",s,"A table visualization with time, value, Min, and Max columns")} 652 653Here's the table after we applied the transformation to remove the Min field. 654 655${o("/static/img/docs/transformations/filter-name-table-after-7-0.png",s,"A table visualization with time, value, and Max columns")} 656 657Here is the same query using a Stat visualization. 658 659${o("/static/img/docs/transformations/filter-name-stat-after-7-0.png",s,"A stat visualization with value and Max fields")} 660 661This transformation provides flexibility in tailoring your query results to focus on the specific fields you need for effective analysis and visualization. 662 `}}
662,formatString:{name:"Format string",getHelperDocs:function(){return` 663Use this transformation to customize the output of a string field. This transformation has the following fields: 664 665- **Upper case** - Formats the entire string in uppercase characters. 666- **Lower case** - Formats the entire string in lowercase characters. 667- **Sentence case** - Formats the first character of the string in uppercase. 668- **Title case** - Formats the first character of each word in the string in uppercase. 669- **Pascal case** - Formats the first character of each word in the string in uppercase and doesn't include spaces between words. 670- **Camel case** - Formats the first character of each word in the string in uppercase, except the first word, and doesn't include spaces between words. 671- **Snake case** - Formats all characters in the string in lowercase and uses underscores instead of spaces between words. 672- **Kebab case** - Formats all characters in the string in lowercase and uses dashes instead of spaces between words. 673- **Trim** - Removes all leading and trailing spaces from the string. 674- **Substring** - Returns a substring of the string, using the specified start and end positions. 675 676This transformation provides a convenient way to standardize and tailor the presentation of string data for better visualization and analysis.`}},formatTime:{name:"Format time",getHelperDocs:function(){return` 677Use this transformation to customize the output of a time field. Output can be formatted using [Moment.js format strings](https://momentjs.com/docs/#/displaying/). For example, if you want to display only the year of a time field, the format string 'YYYY' can be used to show the calendar year (for example, 1999 or 2012). 678 679**Before Transformation:** 680 681| Timestamp | Event | 682| ------------------- | ------------ | 683| 1636678740000000000 | System Start | 684| 1636678680000000000 | User Login | 685| 1636678620000000000 | Data Updated | 686 687**After applying 'YYYY-MM-DD HH:mm:ss':** 688 689| Timestamp | Event | 690| ------------------- | ------------ | 691| 2021-11-12 14:25:40 | System Start | 692| 2021-11-12 14:24:40 | User Login | 693| 2021-11-12 14:23:40 | Data Updated | 694 695This transformation lets you tailor the time representation in your visualizations, providing flexibility and precision in displaying temporal data. 696 697> **Note:** This transformation is available in Grafana 10.1+ as an alpha feature. 698 `}},groupBy:{name:"Group by",getHelperDocs:function(){return` 699Use this transformation to group the data by a specified field (column) value and process calculations on each group. Click to see a list of calculation choices. For information about available calculations, refer to [Calculation types][]. 700 701Here's an example of original data. 702 703| Time | Server ID | CPU Temperature | Server Status | 704| ------------------- | --------- | --------------- | ------------- | 705| 2020-07-07 11:34:20 | server 1 | 80 | Shutdown | 706| 2020-07-07 11:34:20 | server 3 | 62 | OK | 707| 2020-07-07 10:32:20 | server 2 | 90 | Overload | 708| 2020-07-07 10:31:22 | server 3 | 55 | OK | 709| 2020-07-07 09:30:57 | server 3 | 62 | Rebooting | 710| 2020-07-07 09:30:05 | server 2 | 88 | OK | 711| 2020-07-07 09:28:06 | server 1 | 80 | OK | 712| 2020-07-07 09:25:05 | server 2 | 88 | OK | 713| 2020-07-07 09:23:07 | server 1 | 86 | OK | 714 715This transformation goes in two steps. First you specify one or multiple fields to group the data by. This will group all the same values of those fields together, as if you sorted them. For instance if we group by the Server ID field, then it would group the data this way: 716 717| Time | Server ID | CPU Temperature | Server Status | 718| ------------------- | -------------- | --------------- | ------------- | 719| 2020-07-07 11:34:20 | **server 1** | 80 | Shutdown | 720| 2020-07-07 09:28:06 | **server 1** | 80 | OK | 721| 2020-07-07 09:23:07 | **server 1** | 86 | OK | 722| 2020-07-07 10:32:20 | server 2 | 90 | Overload | 723| 2020-07-07 09:30:05 | server 2 | 88 | OK | 724| 2020-07-07 09:25:05 | server 2 | 88 | OK | 725| 2020-07-07 11:34:20 | **_server 3_** | 62 | OK | 726| 2020-07-07 10:31:22 | **_server 3_** | 55 | OK | 727| 2020-07-07 09:30:57 | **_server 3_** | 62 | Rebooting | 728 729All rows with the same value of Server ID are grouped together. 730 731After choosing which field you want to group your data by, you can add various calculations on the other fields, and apply the calculation to each group of rows. For instance, we could want to calculate the average CPU temperature for each of those servers. So we can add the _mean_ calculation applied on the CPU Temperature field to get the following: 732 733| Server ID | CPU Temperature (mean) | 734| --------- | ---------------------- | 735| server 1 | 82 | 736| server 2 | 88.6 | 737| server 3 | 59.6 | 738 739And we can add more than one calculation. For instance: 740 741- For field Time, we can calculate the _Last_ value, to know when the last data point was received for each server 742- For field Server Status, we can calculate the _Last_ value to know what is the last state value for each server 743- For field Temperature, we can also calculate the _Last_ value to know what is the latest monitored temperature for each server 744 745We would then get: 746 747| Server ID | CPU Temperature (mean) | CPU Temperature (last) | Time (last) | Server Status (last) | 748| --------- | ---------------------- | ---------------------- | ------------------- | -------------------- | 749| server 1 | 82 | 80 | 2020-07-07 11:34:20 | Shutdown | 750| server 2 | 88.6 | 90 | 2020-07-07 10:32:20 | Overload | 751| server 3 | 59.6 | 62 | 2020-07-07 11:34:20 | OK | 752 753This transformation allows you to extract essential information from your time series and present it conveniently. 754 `},links:[{title:"Calculation types",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/calculation-types/"}]},groupingToMatrix:{name:"Grouping to matrix",getHelperDocs:function(){return` 755Use this transformation to combine three fields\u2014which are used as input for the **Column**, **Row**, and **Cell value** fields from the query output\u2014and generate a matrix. The matrix is calculated as follows: 756 757**Original data** 758 759| Server ID | CPU Temperature | Server Status | 760| --------- | --------------- | ------------- | 761| server 1 | 82 | OK | 762| server 2 | 88.6 | OK | 763| server 3 | 59.6 | Shutdown | 764 765We can generate a matrix using the values of 'Server Status' as column names, the 'Server ID' values as row names, and the 'CPU Temperature' as content of each cell. The content of each cell will appear for the existing column ('Server Status') and row combination ('Server ID'). For the rest of the cells, you can select which value to display between: **Null**, **True**, **False**, or **Empty**. 766 767**Output** 768 769| Server IDServer Status | OK | Shutdown | 770| ----------------------- | ---- | -------- | 771| server 1 | 82 | | 772| server 2 | 88.6 | | 773| server 3 | | 59.6 | 774 775Use this transformation to construct a matrix by specifying fields from your query results. The matrix output reflects the relationships between the unique values in these fields. This helps you present complex relationships in a clear and structured matrix format. 776 `}},groupToNestedTable:{name:"Group to nested tables",getHelperDocs:function(s="shortcodeFigure"){return` 777 Use this transformation to group the data by a specified field (column) value and process calculations on each group. Records are generated that share the same grouped field value, to be displayed in a nested table. 778 779 To calculate a statistic for a field, click the selection box next to it and select the **Calculate** option: 780 781 ${o("/static/img/docs/transformations/nested-table-select-calculation.png",s,"A select box showing the Group and Calculate options for the transformation.")} 782 783 Once **Calculate** has been selected, another selection box will appear next to the respective field which will allow statistics to be selected: 784 785 ${o("/static/img/docs/transformations/nested-table-select-stat.png",s,"A select box showing available statistic calculations once the calculate option for the field has been selected.")} 786 787 For information about available calculations, refer to [Calculation types][]. 788 789 Here's an example of original data: 790 791 | Time | Server ID | CPU Temperature | Server Status | 792 | ------------------- | --------- | --------------- | ------------- | 793 | 2020-07-07 11:34:20 | server 1 | 80 | Shutdown | 794 | 2020-07-07 11:34:20 | server 3 | 62 | OK | 795 | 2020-07-07 10:32:20 | server 2 | 90 | Overload | 796 | 2020-07-07 10:31:22 | server 3 | 55 | OK | 797 | 2020-07-07 09:30:57 | server 3 | 62 | Rebooting | 798 | 2020-07-07 09:30:05 | server 2 | 88 | OK | 799 | 2020-07-07 09:28:06 | server 1 | 80 | OK | 800 | 2020-07-07 09:25:05 | server 2 | 88 | OK | 801 | 2020-07-07 09:23:07 | server 1 | 86 | OK | 802 803 This transformation has two steps. First, specify one or more fields by which to group the data. This groups all the same values of those fields together, as if you sorted them. For instance, if you group by the Server ID field, Grafana groups the data this way: 804 805 | Server ID | | 806 | -------------- | ------------- | 807 | server 1 | <table><th><tr><td>Time</td><td>CPU Temperature</td><td>Server Status</td></tr></th><tbody><tr><td>2020-07-07 11:34:20</td><td>80</td><td>Shutdown</td></tr><tr><td>2020-07-07 09:28:06</td><td>80</td><td>OK</td></tr><tr><td>2020-07-07 09:23:07</td><td>86</td><td>OK</td></tr></tbody></table> | 808 | server 2 | <table><th><tr><td>Time</td><td>CPU Temperature</td><td>Server Status</td></tr></th><tbody><tr><td>2020-07-07 10:32:20</td><td>90</td><td>Overload</td></tr><tr><td>2020-07-07 09:30:05</td><td>88</td><td>OK</td></tr><tr><td>2020-07-07 09:25:05</td><td>88</td><td>OK</td></tr></tbody></table> | 809 | server 3 | <table><th><tr><td>Time</td><td>CPU Temperature</td><td>Server Status</td></tr></th><tbody><tr><td>2020-07-07 11:34:20</td><td>62</td><td>OK</td></tr><tr><td>2020-07-07 10:31:22</td><td>55</td><td>OK</td></tr><tr><td>2020-07-07 09:30:57</td><td>62</td><td>Rebooting</td></tr></tbody></table> | 810 811 After choosing the field by which you want to group your data, you can add various calculations on the other fields and apply the calculation to each group of rows. For instance, you might want to calculate the average CPU temperature for each of those servers. To do so, add the **mean calculation** applied on the CPU Temperature field to get the following result: 812 813 | Server ID | CPU Temperatute (mean) | | 814 | -------------- | ------------- | ------------- | 815 | server 1 | 82 | <table><th><tr><td>Time</td><td>Server Status</td></tr></th><tbody><tr><td>2020-07-07 11:34:20</td><td>Shutdown</td></tr><tr><td>2020-07-07 09:28:06</td><td>OK</td></tr><tr><td>2020-07-07 09:23:07</td><td>OK</td></tr></tbody></table> | 816 | server 2 | 88.6 | <table><th><tr><td>Time</td><td>Server Status</td></tr></th><tbody><tr><td>2020-07-07 10:32:20</td><td>Overload</td></tr><tr><td>2020-07-07 09:30:05</td><td>OK</td></tr><tr><td>2020-07-07 09:25:05</td><td>OK</td></tr></tbody></table> | 817 | server 3 | 59.6 | <table><th><tr><td>Time</td><td>Server Status</td></tr></th><tbody><tr><td>2020-07-07 11:34:20</td><td>OK</td></tr><tr><td>2020-07-07 10:31:22</td><td>OK</td></tr><tr><td>2020-07-07 09:30:57</td><td>Rebooting</td></tr></tbody></table> | 818 `},links:[{title:"Calculation types",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/calculation-types/"}]},heatmap:{name:"Create heatmap",getHelperDocs:function(){return` 819Use this transformation to prepare histogram data for visualizing trends over time. Similar to the heatmap visualization, this transformation converts histogram metrics into temporal buckets. 820 821#### X Bucket 822 823This setting determines how the x-axis is split into buckets. 824 825- **Size** - Specify a time interval in the input field. For example, a time range of '1h' creates cells one hour wide on the x-axis. 826- **Count** - For non-time-related series, use this option to define the number of elements in a bucket. 827 828#### Y Bucket 829 830This setting determines how the y-axis is split into buckets. 831 832- **Linear** 833- **Logarithmic** - Choose between log base 2 or log base 10. 834- **Symlog** - Uses a symmetrical logarithmic scale. Choose between log base 2 or log base 10, allowing for negative values. 835 836Assume you have the following dataset: 837 838| Timestamp | Value | 839|-------------------- |-------| 840| 2023-01-01 12:00:00 | 5 | 841| 2023-01-01 12:15:00 | 10 | 842| 2023-01-01 12:30:00 | 15 | 843| 2023-01-01 12:45:00 | 8 | 844 845- With X Bucket set to 'Size: 15m' and Y Bucket as 'Linear', the histogram organizes values into time intervals of 15 minutes on the x-axis and linearly on the y-axis. 846- For X Bucket as 'Count: 2' and Y Bucket as 'Logarithmic (base 10)', the histogram groups values into buckets of two on the x-axis and use a logarithmic scale on the y-axis. 847 `}},histogram:{name:"Histogram",getHelperDocs:function(){return` 848Use this transformation to generate a histogram based on input data, allowing you to visualize the distribution of values. 849 850- **Bucket size** - The range between the lowest and highest items in a bucket (xMin to xMax). 851- **Bucket offset** - The offset for non-zero-based buckets. 852- **Combine series** - Create a unified histogram using all available series. 853 854**Original data** 855 856Series 1: 857 858| A | B | C | 859| - | - | - | 860| 1 | 3 | 5 |
861| 2 | 4 | 6 | 862| 3 | 5 | 7 | 863| 4 | 6 | 8 | 864| 5 | 7 | 9 | 865 866Series 2: 867 868| C | 869| - | 870| 5 | 871| 6 | 872| 7 | 873| 8 | 874| 9 | 875 876**Output** 877 878| xMin | xMax | A | B | C | C | 879| ---- | ---- | --| --| --| --| 880| 1 | 2 | 1 | 0 | 0 | 0 | 881| 2 | 3 | 1 | 0 | 0 | 0 | 882| 3 | 4 | 1 | 1 | 0 | 0 | 883| 4 | 5 | 1 | 1 | 0 | 0 | 884| 5 | 6 | 1 | 1 | 1 | 1 | 885| 6 | 7 | 0 | 1 | 1 | 1 | 886| 7 | 8 | 0 | 1 | 1 | 1 | 887| 8 | 9 | 0 | 0 | 1 | 1 | 888| 9 | 10 | 0 | 0 | 1 | 1 | 889 890Visualize the distribution of values using the generated histogram, providing insights into the data's spread and density. 891 `}},joinByField:{name:"Join by field",getHelperDocs:function(s="shortcodeFigure"){return` 892Use this transformation to merge multiple results into a single table, enabling the consolidation of data from different queries. 893 894This is especially useful for converting multiple time series results into a single wide table with a shared time field. 895 896#### Inner join (for Time Series or SQL-like data) 897 898An inner join merges data from multiple tables where all tables share the same value from the selected field. This type of join excludes data where values do not match in every result. 899 900Use this transformation to combine the results from multiple queries (combining on a passed join field or the first time column) into one result, and drop rows where a successful join cannot occur. This is not optimized for large Time Series datasets. 901 902In the following example, two queries return Time Series data. It is visualized as two separate tables before applying the inner join transformation. 903 904**Query A:** 905 906| Time | Job | Uptime | 907| ------------------- | ------- | --------- | 908| 2020-07-07 11:34:20 | node | 25260122 | 909| 2020-07-07 11:24:20 | postgre | 123001233 | 910| 2020-07-07 11:14:20 | postgre | 345001233 | 911 912**Query B:** 913 914| Time | Server | Errors | 915| ------------------- | -------- | ------ | 916| 2020-07-07 11:34:20 | server 1 | 15 | 917| 2020-07-07 11:24:20 | server 2 | 5 | 918| 2020-07-07 11:04:20 | server 3 | 10 | 919 920The result after applying the inner join transformation looks like the following: 921 922| Time | Job | Uptime | Server | Errors | 923| ------------------- | ------- | --------- | -------- | ------ | 924| 2020-07-07 11:34:20 | node | 25260122 | server 1 | 15 | 925| 2020-07-07 11:24:20 | postgre | 123001233 | server 2 | 5 | 926 927This works in the same way for non-Time Series tabular data as well. 928 929**Students** 930 931| StudentID | Name | Major | 932| --------- | -------- | ---------------- | 933| 1 | John | Computer Science | 934| 2 | Emily | Mathematics | 935| 3 | Michael | Physics | 936| 4 | Jennifer | Chemistry | 937 938**Enrollments** 939 940| StudentID | CourseID | Grade | 941|-----------|----------|-------| 942| 1 | CS101 | A | 943| 1 | CS102 | B | 944| 2 | MATH201 | A | 945| 3 | PHYS101 | B | 946| 5 | HIST101 | B | 947 948The result after applying the inner join transformation looks like the following: 949 950| StudentID | Name | Major | CourseID | Grade | 951| --------- | ------- | ---------------- | ------- | ----- | 952| 1 | John | Computer Science | CS101 | A | 953| 1 | John | Computer Science | CS102 | B | 954| 2 | Emily | Mathematics | MATH201 | A | 955| 3 | Michael | Physics | PHYS101 | B | 956 957The inner join only includes rows where there is a match between the "StudentID" in both tables. In this case, the result does not include "Jennifer" from the "Students" table because there are no matching enrollments for her in the "Enrollments" table. 958 959#### Outer join (for Time Series data) 960 961An outer join includes all data from an inner join and rows where values do not match in every input. While the inner join joins Query A and Query B on the time field, the outer join includes all rows that don't match on the time field. 962 963In the following example, two queries return table data. It is visualized as two tables before applying the outer join transformation. 964 965**Query A:** 966 967| Time | Job | Uptime | 968| ------------------- | ------- | --------- | 969| 2020-07-07 11:34:20 | node | 25260122 | 970| 2020-07-07 11:24:20 | postgre | 123001233 | 971| 2020-07-07 11:14:20 | postgre | 345001233 | 972 973**Query B:** 974 975| Time | Server | Errors | 976| ------------------- | -------- | ------ |
977| 2020-07-07 11:34:20 | server 1 | 15 | 978| 2020-07-07 11:24:20 | server 2 | 5 | 979| 2020-07-07 11:04:20 | server 3 | 10 | 980 981The result after applying the outer join transformation looks like the following: 982 983| Time | Job | Uptime | Server | Errors | 984| ------------------- | ------- | --------- | -------- | ------ | 985| 2020-07-07 11:04:20 | | | server 3 | 10 | 986| 2020-07-07 11:14:20 | postgre | 345001233 | | | 987| 2020-07-07 11:34:20 | node | 25260122 | server 1 | 15 | 988| 2020-07-07 11:24:20 | postgre | 123001233 | server 2 | 5 | 989 990In the following example, a template query displays time series data from multiple servers in a table visualization. The results of only one query can be viewed at a time. 991 992${o("/static/img/docs/transformations/join-fields-before-7-0.png",s,"A table visualization showing results for one server")} 993 994I applied a transformation to join the query results using the time field. Now I can run calculations, combine, and organize the results in this new table. 995 996${o("/static/img/docs/transformations/join-fields-after-7-0.png",s,"A table visualization showing results for multiple servers")} 997 998#### Outer join (for SQL-like data) 999 1000A tabular outer join combining tables so that the result includes matched and unmatched rows from either or both tables. 1001 1002| StudentID | Name | Major | 1003| --------- | --------- | ---------------- | 1004| 1 | John | Computer Science | 1005| 2 | Emily | Mathematics | 1006| 3 | Michael | Physics | 1007| 4 | Jennifer | Chemistry | 1008 1009Can now be joined with: 1010 1011| StudentID | CourseID | Grade | 1012| --------- | -------- | ----- | 1013| 1 | CS101 | A | 1014| 1 | CS102 | B | 1015| 2 | MATH201 | A | 1016| 3 | PHYS101 | B | 1017| 5 | HIST101 | B | 1018 1019The result after applying the outer join transformation looks like the following: 1020 1021| StudentID | Name | Major | CourseID | Grade | 1022| --------- | -------- | ---------------- | -------- | ----- | 1023| 1 | John | Computer Science | CS101 | A | 1024| 1 | John | Computer Science | CS102 | B | 1025| 2 | Emily | Mathematics | MATH201 | A | 1026| 3 | Michael | Physics | PHYS101 | B | 1027| 4 | Jennifer | Chemistry | NULL | NULL | 1028| 5 | NULL | NULL | HIST101 | B | 1029 1030Combine and analyze data from various queries with table joining for a comprehensive view of your information. 1031 `}},joinByLabels:{name:"Join by labels",getHelperDocs:function(){return` 1032Use this transformation to join multiple results into a single table. 1033 1034This is especially useful for converting multiple time series results into a single wide table with a shared **Label** field. 1035 1036- **Join** - Select the label to join by between the labels available or common across all time series. 1037- **Value** - The name for the output result. 1038 1039#### Example 1040 1041##### Input 1042 1043series1{what="Temp", cluster="A", job="J1"} 1044 1045| Time | Value | 1046| ---- | ----- | 1047| 1 | 10 | 1048| 2 | 200 | 1049 1050series2{what="Temp", cluster="B", job="J1"} 1051 1052| Time | Value | 1053| ---- | ----- | 1054| 1 | 10 | 1055| 2 | 200 | 1056 1057series3{what="Speed", cluster="B", job="J1"} 1058 1059| Time | Value | 1060| ---- | ----- | 1061| 22 | 22 | 1062| 28 | 77 | 1063 1064##### Config 1065 1066value: "what" 1067 1068##### Output 1069 1070| cluster | job | Temp | Speed | 1071| ------- | --- | ---- | ----- | 1072| A | J1 | 10 | | 1073| A | J1 | 200 | | 1074| B | J1 | 10 | 22 | 1075| B | J1 | 200 | 77 | 1076 1077Combine and organize time series data effectively with this transformation for comprehensive insights. 1078 `}},labelsToFields:{name:"Labels to fields",getHelperDocs:function(){return` 1079Use this transformation to convert time series results with labels or tags into a table, including each label's keys and values in the result. Display labels as either columns or row values for enhanced data visualization. 1080 1081Given a query result of two time series: 1082 1083- Series 1: labels Server=Server A, Datacenter=EU 1084- Series 2: labels Server=Server B, Datacenter=EU 1085 1086In "Columns" mode, the result looks like this: 1087 1088| Time | Server | Datacenter | Value | 1089| ------------------- | -------- | ---------- | ----- | 1090| 2020-07-07 11:34:20 | Server A | EU | 1 | 1091| 2020-07-07 11:34:20 | Server B | EU | 2 | 1092 1093In "Rows" mode, the result has a table for each series and show each label value like this: 1094 1095| label | value | 1096| ---------- | -------- | 1097| Server | Server A | 1098| Datacenter | EU | 1099 1100| label | value | 1101| ---------- | -------- | 1102| Server | Server B | 1103| Datacenter | EU | 1104 1105#### Value field name 1106 1107If you selected Server as the **Value field name**, then you would get one field for every value of the Server label. 1108 1109| Time | Datacenter | Server A | Server B | 1110| ------------------- | ---------- | -------- | -------- | 1111| 2020-07-07 11:34:20 | EU | 1 | 2 | 1112 1113#### Merging behavior 1114 1115The labels to fields transformer is internally two separate transformations. The first acts on single series and extracts labels to fields. The second is the [merge](#merge) transformation that joins all the results into a single table. The merge transformation tries to join on all matching fields. This merge step is required and cannot be turned off. 1116 1117To illustrate this, here is an example where you have two queries that return time series with no overlapping labels. 1118 1119- Series 1: labels Server=ServerA 1120- Series 2: labels Datacenter=EU 1121 1122This will first result in these two tables: 1123 1124| Time | Server | Value | 1125| ------------------- | ------- | ----- | 1126| 2020-07-07 11:34:20 | ServerA | 10 | 1127 1128| Time | Datacenter | Value | 1129| ------------------- | ---------- | ----- | 1130| 2020-07-07 11:34:20 | EU | 20 | 1131 1132After merge: 1133 1134| Time | Server | Value | Datacenter | 1135| ------------------- | ------- | ----- | ---------- | 1136| 2020-07-07 11:34:20 | ServerA | 10 | | 1137| 2020-07-07 11:34:20 | | 20 | EU | 1138 1139Convert your time series data into a structured table format for a clearer and more organized representation. 1140 `}},limit:{name:"Limit",getHelperDocs:function(){return` 1141Use this transformation to restrict the number of rows displayed, providing a more focused view of your data. This is particularly useful when dealing with large datasets. 1142 1143Below is an example illustrating the impact of the **Limit** transformation on a response from a data source: 1144 1145| Time | Metric | Value | 1146| ------------------- | ----------- | ----- | 1147| 2020-07-07 11:34:20 | Temperature | 25 | 1148| 2020-07-07 11:34:20 | Humidity | 22 | 1149| 2020-07-07 10:32:20 | Humidity | 29 | 1150| 2020-07-07 10:31:22 | Temperature | 22 | 1151| 2020-07-07 09:30:57 | Humidity | 33 | 1152| 2020-07-07 09:30:05 | Temperature | 19 | 1153 1154Here is the result after adding a Limit transformation with a value of '3': 1155 1156| Time | Metric | Value | 1157| ------------------- | ----------- | ----- | 1158| 2020-07-07 11:34:20 | Temperature | 25 | 1159| 2020-07-07 11:34:20 | Humidity | 22 | 1160| 2020-07-07 10:32:20 | Humidity | 29 | 1161 1162Using a negative number, you can keep values from the end of the set. Here is the result after adding a Limit transformation with a value of '-3': 1163 1164| Time | Metric | Value | 1165| ------------------- | ----------- | ----- | 1166| 2020-07-07 10:31:22 | Temperature | 22 | 1167| 2020-07-07 09:30:57 | Humidity | 33 | 1168| 2020-07-07 09:30:05 | Temperature | 19 | 1169 1170 1171This transformation helps you tailor the visual presentation of your data to focus on the most relevant information. 1172 `}},merge:{name:"Merge series/tables",getHelperDocs:function(){return` 1173Use this transformation to combine the results from multiple queries into a single result, which is particularly useful when using the table panel visualization. This transformation merges values into the same row if the shared fields contain the same data. 1174 1175Here's an example illustrating the impact of the **Merge series/tables** transformation on two queries returning table data: 1176 1177**Query A:** 1178 1179| Time | Job | Uptime | 1180| ------------------- | ------- | --------- | 1181| 2020-07-07 11:34:20 | node | 25260122 | 1182| 2020-07-07 11:24:20 | postgre | 123001233 | 1183 1184**Query B:** 1185 1186| Time | Job | Errors | 1187| ------------------- | ------- | ------ |
1188| 2020-07-07 11:34:20 | node | 15 | 1189| 2020-07-07 11:24:20 | postgre | 5 | 1190 1191Here is the result after applying the Merge transformation. 1192 1193| Time | Job | Errors | Uptime | 1194| ------------------- | ------- | ------ | --------- | 1195| 2020-07-07 11:34:20 | node | 15 | 25260122 | 1196| 2020-07-07 11:24:20 | postgre | 5 | 123001233 | 1197 1198This transformation combines values from Query A and Query B into a unified table, enhancing the presentation of data for better insights. 1199 `},links:[{title:"Table panel",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/table/"}]},organize:{name:"Organize fields by name",getHelperDocs:function(){return` 1200Use this transformation to provide the flexibility to rename, reorder, or hide fields returned by a single query in your panel. This transformation is applicable only to panels with a single query. If your panel has multiple queries, consider using an "Outer join" transformation or removing extra queries. 1201 1202#### Transforming fields 1203 1204Grafana displays a list of fields returned by the query, allowing you to perform the following actions: 1205 1206- **Change field order** - Hover over a field, and when your cursor turns into a hand, drag the field to its new position. 1207- **Hide or show a field** - Use the eye icon next to the field name to toggle the visibility of a specific field. 1208- **Rename fields** - Type a new name in the "Rename <field>" box to customize field names. 1209 1210#### Example: 1211 1212##### Original Query Result 1213 1214| Time | Metric | Value | 1215| ------------------- | ----------- | ----- | 1216| 2020-07-07 11:34:20 | Temperature | 25 | 1217| 2020-07-07 11:34:20 | Humidity | 22 | 1218| 2020-07-07 10:32:20 | Humidity | 29 | 1219 1220##### After Applying Field Overrides 1221 1222| Time | Sensor | Reading | 1223| ------------------- | ----------- | ------- | 1224| 2020-07-07 11:34:20 | Temperature | 25 | 1225| 2020-07-07 11:34:20 | Humidity | 22 | 1226| 2020-07-07 10:32:20 | Humidity | 29 | 1227 1228This transformation lets you to tailor the display of query results, ensuring a clear and insightful representation of your data in Grafana. 1229 `}},partitionByValues:{name:"Partition by values",getHelperDocs:function(){return` 1230Use this transformation to streamline the process of graphing multiple series without the need for multiple queries with different 'WHERE' clauses. 1231 1232This is particularly useful when dealing with a metrics SQL table, as illustrated below: 1233 1234| Time | Region | Value | 1235| ------------------- | ------ | ----- | 1236| 2022-10-20 12:00:00 | US | 1520 | 1237| 2022-10-20 12:00:00 | EU | 2936 | 1238| 2022-10-20 01:00:00 | US | 1327 | 1239| 2022-10-20 01:00:00 | EU | 912 | 1240 1241With the **Partition by values** transformation, you can issue a single query and split the results by unique values in one or more columns (fields) of your choosing. The following example uses 'Region': 1242 1243'SELECT Time, Region, Value FROM metrics WHERE Time > "2022-10-20"' 1244 1245| Time | Region | Value | 1246| ------------------- | ------ | ----- | 1247| 2022-10-20 12:00:00 | US | 1520 | 1248| 2022-10-20 01:00:00 | US | 1327 | 1249 1250| Time | Region | Value | 1251| ------------------- | ------ | ----- | 1252| 2022-10-20 12:00:00 | EU | 2936 | 1253| 2022-10-20 01:00:00 | EU | 912 | 1254 1255This transformation simplifies the process and enhances the flexibility of visualizing multiple series within the same time series visualization. 1256 `}},prepareTimeSeries:{name:"Prepare time series",getHelperDocs:function(){return` 1257Use this transformation to address issues when a data source returns time series data in a format that isn't compatible with the desired visualization. This transformation allows you to convert time series data between wide and long formats, providing flexibility in data frame structures. 1258 1259#### Available options 1260 1261##### Wide time series 1262 1263Select this option to transform the time series data frame from the long format to the wide format. If your data source returns time series data in a long format and your visualization requires a wide format, this transformation simplifies the process. 1264 1265A wide time series combines data into a single frame with one shared, ascending time field. Time fields do not repeat and multiple values extend in separate columns. 1266
1267**Example: Converting from long to wide format** 1268 1269| Timestamp | Variable | Value | 1270|---------------------|----------|-------| 1271| 2023-01-01 00:00:00 | Value1 | 10 | 1272| 2023-01-01 00:00:00 | Value2 | 20 | 1273| 2023-01-01 01:00:00 | Value1 | 15 | 1274| 2023-01-01 01:00:00 | Value2 | 25 | 1275 1276**Transformed to:** 1277 1278| Timestamp | Value1 | Value2 | 1279|---------------------|--------|--------| 1280| 2023-01-01 00:00:00 | 10 | 20 | 1281| 2023-01-01 01:00:00 | 15 | 25 | 1282 1283##### Multi-frame time series 1284 1285Multi-frame time series break data into multiple frames that all contain two fields: a time field and a numeric value field. Time is always ascending. String values are represented as field labels. 1286 1287##### Long time series 1288 1289A long time series combines data into one frame, with the first field being an ascending time field. The time field might have duplicates. String values are in separate fields, and there might be more than one. 1290 1291**Example: Converting to long format** 1292 1293| Value1 | Value2 | Timestamp | 1294|--------|--------|---------------------| 1295| 10 | 20 | 2023-01-03 00:00:00 | 1296| 30 | 40 | 2023-01-02 00:00:00 | 1297| 50 | 60 | 2023-01-01 00:00:00 | 1298| 70 | 80 | 2023-01-01 00:00:00 | 1299 1300**Transformed to:** 1301 1302| Timestamp | Value1 | Value2 | 1303|---------------------|--------|--------| 1304| 2023-01-01 00:00:00 | 70 | 80 | 1305| 2023-01-01 01:00:00 | 50 | 60 | 1306| 2023-01-02 01:00:00 | 30 | 40 | 1307| 2023-01-03 01:00:00 | 10 | 20 | 1308 1309 `},links:[{title:"Data frames",url:"https://grafana.com/docs/grafana/latest/developers/plugins/introduction-to-plugin-development/data-frames/"}]},reduce:{name:"Reduce",getHelperDocs:function(){return` 1310Use this transformation to apply a calculation to each field in the data frame and return a single value. This transformation is particularly useful for consolidating multiple time series data into a more compact, summarized format. Time fields are removed when applying this transformation. 1311 1312Consider the input: 1313 1314**Query A:** 1315 1316| Time | Temp | Uptime | 1317| ------------------- | ---- | ------- | 1318| 2020-07-07 11:34:20 | 12.3 | 256122 | 1319| 2020-07-07 11:24:20 | 15.4 | 1230233 | 1320 1321**Query B:** 1322 1323| Time | AQI | Errors | 1324| ------------------- | --- | ------ | 1325| 2020-07-07 11:34:20 | 6.5 | 15 | 1326| 2020-07-07 11:24:20 | 3.2 | 5 | 1327 1328The reduce transformer has two modes: 1329 1330- **Series to rows** - Creates a row for each field and a column for each calculation. 1331- **Reduce fields** - Keeps the existing frame structure, but collapses each field into a single value. 1332 1333For example, if you used the **First** and **Last** calculation with a **Series to rows** transformation, then 1334the result would be: 1335 1336| Field | First | Last | 1337| ------ | ------ | ------- | 1338| Temp | 12.3 | 15.4 | 1339| Uptime | 256122 | 1230233 | 1340| AQI | 6.5 | 3.2 | 1341| Errors | 15 | 5 | 1342 1343The **Reduce fields** with the **Last** calculation, 1344results in two frames, each with one row: 1345 1346**Query A:** 1347 1348| Temp | Uptime | 1349| ---- | ------- | 1350| 15.4 | 1230233 | 1351 1352**Query B:** 1353 1354| AQI | Errors | 1355| --- | ------ | 1356| 3.2 | 5 | 1357 1358This flexible transformation simplifies the process of consolidating and summarizing data from multiple time series into a more manageable and organized format. 1359 `}},renameByRegex:{name:"Rename by regex",getHelperDocs:function(s="shortcodeFigure"){return` 1360Use this transformation to rename parts of the query results using a regular expression and replacement pattern. 1361 1362You can specify a regular expression, which is only applied to matches, along with a replacement pattern that support back references. For example, let's imagine you're visualizing CPU usage per host and you want to remove the domain name. You could set the regex to '/^([^.]+).*/' and the replacement pattern to '$1', 'web-01.example.com' would become 'web-01'. 1363 1364> **Note:** The Rename by regex transformation was improved in Grafana v9.0.0 to allow global patterns of the form '/<stringToReplace>/g'. Depending on the regex match used, this may cause some transformations to behave slightly differently. You can guarantee the same behavior as before by wrapping the match string in forward slashes '(/)', e.g. '(.*)' would become '/(.*)/'. 1365 1366In the following example, we are stripping the 'A-' prefix from field names. In the before image, you can see everything is prefixed with 'A-': 1367 1368${o("/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-before-v11.0.png",s,"A time series with full series n
1368ames")} 1369 1370With the transformation applied, you can see we are left with just the remainder of the string. 1371 1372${o("/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-after-v11.0.png",s,"A time series with shortened series names")} 1373 1374This transformation lets you to tailor your data to meet your visualization needs, making your dashboards more informative and user-friendly. 1375 `}},rowsToFields:{name:"Rows to fields",getHelperDocs:function(){return` 1376Use this transformation to convert rows into separate fields. This can be useful because fields can be styled and configured individually. It can also use additional fields as sources for dynamic field configuration or map them to field labels. The additional labels can then be used to define better display names for the resulting fields. 1377 1378This transformation includes a field table which lists all fields in the data returned by the configuration query. This table gives you control over what field should be mapped to each configuration property (the **Use as** option). You can also choose which value to select if there are multiple rows in the returned data. 1379 1380This transformation requires: 1381 1382- One field to use as the source of field names. 1383 1384 By default, the transform uses the first string field as the source. You can override this default setting by selecting **Field name** in the **Use as** column for the field you want to use instead. 1385 1386- One field to use as the source of values. 1387 1388 By default, the transform uses the first number field as the source. But you can override this default setting by selecting **Field value** in the **Use as** column for the field you want to use instead. 1389 1390Useful when visualizing data in: 1391 1392- Gauge 1393- Stat 1394- Pie chart 1395 1396#### Map extra fields to labels 1397 1398If a field does not map to config property Grafana will automatically use it as source for a label on the output field- 1399 1400**Example:** 1401 1402| Name | DataCenter | Value | 1403| ------- | ---------- | ----- | 1404| ServerA | US | 100 | 1405| ServerB | EU | 200 | 1406 1407**Output:** 1408 1409| ServerA (labels: DataCenter: US) | ServerB (labels: DataCenter: EU) | 1410| -------------------------------- | -------------------------------- | 1411| 10 | 20 | 1412 1413The extra labels can now be used in the field display name provide more complete field names. 1414 1415If you want to extract config from one query and apply it to another you should use the config from query results transformation. 1416 1417#### Example 1418 1419**Input:** 1420 1421| Name | Value | Max | 1422| ------- | ----- | --- | 1423| ServerA | 10 | 100 | 1424| ServerB | 20 | 200 | 1425| ServerC | 30 | 300 | 1426 1427**Output:** 1428 1429| ServerA (config: max=100) | ServerB (config: max=200) | ServerC (config: max=300) | 1430| ------------------------- | ------------------------- | ------------------------- | 1431| 10 | 20 | 30 | 1432 1433As you can see each row in the source data becomes a separate field. Each field now also has a max config option set. Options like **Min**, **Max**, **Unit** and **Thresholds** are all part of field configuration and if set like this will be used by the visualization instead of any options manually configured in the panel editor options pane. 1434 1435This transformation enables the conversion of rows into individual fields, facilitates dynamic field configuration, and maps additional fields to labels. 1436 `}},seriesToRows:{name:"Series to rows",getHelperDocs:function(){return` 1437Use this transformation to combine the result from multiple time series data queries into one single result. This is helpful when using the table panel visualization. 1438 1439The result from this transformation will contain three columns: Time, Metric, and Value. The Metric column is added so you easily can see from which query the metric originates from. Customize this value by defining Label on the source query. 1440 1441In the example below, we have two queries returning time series data. It is visualized as two separate tables before applying the transformation. 1442 1443**Query A:** 1444 1445| Time | Temperature | 1446| ------------------- | ----------- | 1447| 2020-07-07 11:34:20 | 25 | 1448| 2020-07-07 10:31:22 | 22 | 1449| 2020-07-07 09:30:05 | 19 | 1450 1451**Query B:** 1452 1453| Time | Humidity | 1454| ------------------- | -------- | 1455| 2020-07-07 11:34:20 | 24 | 1456| 2020-07-07 10:32:20 | 29 | 1457| 2020-07-07 09:30:57 | 33 | 1458 1459Here is the result after applying the Series to rows transformation. 1460 1461| Time | Metric | Value | 1462| ------------------- | ----------- | ----- | 1463| 2020-07-07 11:34:20 | Temperature | 25 | 1464| 2020-07-07 11:34:20 | Humidity | 22 | 1465| 2020-07-07 10:32:20 | Humidity | 29 | 1466| 2020-07-07 10:31:22 | Temperature | 22 | 1467| 2020-07-07 09:30:57 | Humidity | 33 | 1468| 2020-07-07 09:30:05 | Temperature | 19 | 1469 1470This transformation facilitates the consolidation of results from multiple time series queries, providing a streamlined and unified dataset for efficient analysis and visualization in a tabular format. 1471 1472 `}},sortBy:{name:"Sort by",getHelperDocs:function(){return` 1473Use this transformation to sort each frame within a query result based on a specified field, making your data easier to understand and analyze. By configuring the desired field for sorting, you can control the order in which the data is presented in the table or visualization. 1474 1475Use the **Reverse** switch to inversely order the values within the specified field. This functionality is particularly useful when you want to quickly toggle between ascending and desce
1475nding order to suit your analytical needs. 1476 1477For example, in a scenario where time-series data is retrieved from a data source, the **Sort by** transformation can be applied to arrange the data frames based on the timestamp, either in ascending or descending order, depending on the analytical requirements. This capability ensures that you can easily navigate and interpret time-series data, gaining valuable insights from the organized and visually coherent presentation. 1478 `}},spatial:{name:"Spatial",getHelperDocs:function(){return` 1479Use this transformation to apply spatial operations to query results. 1480 1481- **Action** - Select an action: 1482 - **Prepare spatial field** - Set a geometry field based on the results of other fields. 1483 - **Location mode** - Select a location mode (these options are shared by the **Calculate value** and **Transform** modes): 1484 - **Auto** - Automatically identify location data based on default field names. 1485 - **Coords** - Specify latitude and longitude fields. 1486 - **Geohash** - Specify a geohash field. 1487 - **Lookup** - Specify Gazetteer location fields. 1488 - **Calculate value** - Use the geometry to define a new field (heading/distance/area). 1489 - **Function** - Choose a mathematical operation to apply to the geometry: 1490 - **Heading** - Calculate the heading (direction) between two points. 1491 - **Area** - Calculate the area enclosed by a polygon defined by the geometry. 1492 - **Distance** - Calculate the distance between two points. 1493 - **Transform** - Apply spatial operations to the geometry. 1494 - **Operation** - Choose an operation to apply to the geometry: 1495 - **As line** - Create a single line feature with a vertex at each row. 1496 - **Line builder** - Create a line between two points. 1497 1498This transformation allows you to manipulate and analyze geospatial data, enabling operations such as creating lines between points, calculating spatial properties, and more. 1499 `}},timeSeriesTable:{name:"Time series to table transform",getHelperDocs:function(s="shortcodeFigure"){return` 1500Use this transformation to convert time series results into a table, transforming a time series data frame into a **Trend** field which can then be used with the [sparkline cell type][]. If there are multiple time series queries, each will result in a separate table data frame. These can be joined using join or merge transforms to produce a single table with multiple sparklines per row. 1501 1502${o("/static/img/docs/transformations/table-sparklines.png",s,"A table panel showing multiple values and their corresponding sparklines.")} 1503 1504For each generated **Trend** field value, a calculation function can be selected. This value is displayed next to the sparkline and will be used for sorting table rows. 1505 1506${o("/static/img/docs/transformations/timeseries-table-select-stat.png",s,"A select box showing available statistics that can be calculated.")} 1507 1508 1509> **Note:** This transformation is available in Grafana 9.5+ as an opt-in beta feature. Modify the Grafana [configuration file][] to use it. 1510 `},links:[{title:"sparkline cell type",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/table/#sparkline"},{title:"configuration file",url:"https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/"}]},transpose:{name:"Transpose",getHelperDocs:function(s="shortcodeFigure"){return` 1511Use this transformation to pivot the data frame, converting rows into columns and columns into rows. This transformation is particularly useful when you want to switch the orientation of your data to better suit your visualization needs. 1512If you have multiple types it will default to string type. 1513 1514**Before Transformation:** 1515 1516| env | January | February | 1517| ---- | --------- | -------- | 1518| prod | 1 | 2 | 1519| dev | 3 | 4 | 1520 1521**After applying transpose transformation:** 1522 1523| Field | prod | dev | 1524| ---- | --------- | -------- | 1525| January | 1 | 3 | 1526| February | 2 | 4 | 1527 1528${o("/media/docs/grafana/transformations/screenshot-grafana-11-2-transpose-transformation.png",s,"Before and after transpose transformation")} 1529 `}},regression:{name:"Regression analysis",getHelperDocs:function(s="shortcodeFigure"){return` 1530Use this transformation to create a new data frame containing values predicted by a statistical model. This is useful for finding a trend in chaotic data. It works by fitting a mathematical function to the data, using either linear or polynomial regression. The data frame can then be used in a visualization to display a trendline. 1531 1532There are two different models: 1533 1534- **Linear regression** - Fits a linear function to the data. 1535${o("/static/img/docs/transformations/linear-regression.png",s,"A time series visualization with a straight line representing the linear function")} 1536- **Polynomial regression** - Fits a polynomial function to the data. 1537${o("/static/img/docs/transformations/polynomial-regression.png",s,"A time series visualization with a curved line representing the polynomial function")} 1538 1539> **Note:** This transformation is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available. Enable the \`regressionTransformation\` feature toggle in Grafana to use this feature. Contact Grafana Support to enable this feature in Grafana Cloud. 1540 `}}};function r(){return` 1541 Go to the <a href="https://grafana.com/docs/grafana/latest/panels/transformations/?utm_source=grafana" target="_blank" rel="noreferrer"> 1542 transformation documentation 1543 </a> for more general documentation. 1544 `}function o(s,m,a){return m==="shortcodeFigure"?`{{< figure src="${s}
1544" class="docs-image--no-shadow" max-width= "1100px" alt="${a}" >}}`:``}},90176:(ee,B,e)=>{"use strict";e.d(B,{YD:()=>o,dy:()=>n,kD:()=>r});var t=e(739),n=(m=>(m.Prepare="prepare",m.Calculate="calculate",m.Modify="modify",m))(n||{}),r=(m=>(m.Heading="heading",m.Distance="distance",m.Area="area",m))(r||{}),o=(m=>(m.AsLine="asLine",m.LineBuilder="lineBuilder",m))(o||{});const s={action:"prepare",source:{mode:t.aG.Auto}}},78089:(ee,B,e)=>{"use strict";e.d(B,{EX:()=>h,pp:()=>i,tt:()=>l});var t=e(70915),n=e(11217),r=e(44294),o=e(22796),s=e(52490),m=e(95004),a=e(90176);function l(x){const g=[];for(const p of x.values)p&&g.push(h(p));return new n.A(g)}function f(x){const g=new Array(x.length);if(x.length>1){let p=u(x[0]);for(let c=1;c<x.length;c++){let y=u(x[c]);if(p&&y){let P=Math.atan2(y[0]-p[0],y[1]-p[1])*180/Math.PI;P<0&&(P+=360),g[c-1]=g[c]=P}}}else g.fill(0);return g}function h(x){return x instanceof r.A?x.getCoordinates():(0,t.q1)(x.getExtent())}function u(x){if(x)return(0,o.WP)(h(x))}function i(x,g){const p=x.values,c=new Array(x.values.length),y=g.calc??a.kD.Heading,P=g.field??y;switch(y){case a.kD.Area:{for(let d=0;d<p.length;d++){const D=p[d];D&&(c[d]=(0,s.UG)(D))}return{name:P,type:m.PU.number,config:{unit:"areaM2"},values:c}}case a.kD.Distance:{for(let d=0;d<p.length;d++){const D=p[d];D&&(c[d]=(0,s.R3)(D))}return{name:P,type:m.PU.number,config:{unit:"lengthm"},values:c}}case a.kD.Heading:default:return{name:P,type:m.PU.number,config:{unit:"degree"},values:f(p)}}}},17200:(ee,B,e)=>{"use strict";e.d(B,{c:()=>c,y:()=>P});var t=e(74848),n=e(22803),r=e(34743),o=e(83505),s=e(46885),m=e(96540),a=e(63142),l=e(15245),f=e(92807),h=e(12594),u=e(63527),i=e(87105),x=e(81563);const g=(D,b)=>D-b*Math.floor(D/b),p=8;var c=(D=>(D.InputElement="input",D.TextAreaElement="textarea",D))(c||{});const y=(D,b)=>({suggestionsWrapper:(0,n.css)({boxShadow:D.shadows.z2}),errorTooltip:(0,n.css)({position:"absolute",top:b+p+"px",zIndex:D.zIndex.tooltip}),inputWrapper:(0,n.css)({position:"relative"})}),P=({value:D="",onChange:b,suggestions:E,placeholder:v,error:C,invalid:S,type:O="input",style:I,autoFocus:R=!1})=>{const[T,L]=(0,m.useState)(!1),[K,A]=(0,m.useState)(0),[W,N]=(0,m.useState)(D.toString()),w=(0,m.useRef)(null),[j,V]=(0,m.useState)(0),[U,F]=(0,m.useState)(0),[M,H]=(0,m.useState)(0),_=(0,a.$j)(),Z=y(_,U),ne=(0,m.useRef)();(0,m.useEffect)(()=>{w.current?.scrollTo(0,j)},[j]);const te=[(0,r.UU)({fallbackAxisSideDirection:"start",crossAxis:!1,boundary:document.body}),(0,r.BN)()],{refs:Y,floatingStyles:Q}=(0,o.we)({open:T,placement:"bottom-start",onOpenChange:L,middleware:te,whileElementsMounted:s.ll,strategy:"fixed"}),J=(0,m.useCallback)(fe=>{Y.setReference(fe),ne.current=fe},[Y]),q=(0,m.useRef)(null);(0,m.useEffect)(()=>{V(d(q.current,K))},[K]);const X=m.useCallback((fe,pe=ne.current)=>{const de=pe.selectionStart,le=pe.value;le[M-1]==="$"?pe.value=le.slice(0,M)+fe.value+le.slice(de):pe.value=le.slice(0,M)+`\${${fe.value}}`+le.slice(de),N(pe.value),L(!1),A(0),b(pe.value)},[b,M]),se=m.useCallback(fe=>{if(!T){if(fe.key==="$"||fe.key===" "&&fe.ctrlKey){H(ne.current.selectionStart||0),L(!0);return}return}switch(fe.key){case"Backspace":case"Escape":case"ArrowLeft":case"ArrowRight":return L(!1),A(0);case"Enter":return fe.preventDefault(),X(E[K]);case"ArrowDown":case"ArrowUp":fe.preventDefault();const pe=fe.key==="ArrowDown"?1:-1;return A(de=>g(de+pe,E.length));default:return}},[T,E,K,X]),oe=m.useCallback(fe=>{N(fe.currentTarget.value)},[]),ae=m.useCallback(fe=>{b(fe.currentTarget.value)},[b]);(0,m.useEffect)(()=>{F(ne.current.clientHeight)},[]);const ie={placeholder:v,invalid:S,value:W,onChange:oe,onBlur:ae,onKeyDown:se};return(0,t.jsxs)("div",{className:Z.inputWrapper,style:I??{},children:[T&&(0,t.jsx)(l.ZL,{children:(0,t.jsx)("div",{ref:Y.setFloating,style:Q,className:Z.suggestionsWrapper,children:(0,t.jsx)(f.P,{maxHeight:"300px",onScroll:fe=>V(fe.currentTarget.scrollTop??0),ref:w,children:(0,t.jsx)(x.k,{activeRef:q,suggestions:E,onSuggestionSelect:X,onClose:()=>L(!1),activeIndex:K})})})}),S&&C&&(0,t.jsx)("div",{className:Z.errorTooltip,children:(0,t.jsx)(h.P,{children:C})}
1544),O==="input"?(0,t.jsx)(u.p,{...ie,ref:J,autoFocus:R}):(0,t.jsx)(i.f,{...ie,ref:J,autoFocus:R,rows:5})]})};P.displayName="SuggestionsInput";function d(D,b){return(D?.clientHeight??0)*b}},72598:(ee,B,e)=>{"use strict";e.d(B,{I9:()=>i,N_:()=>h,ZI:()=>a,aG:()=>l,eJ:()=>f,qt:()=>u});var t=e(96540),n=e(16515),r=e(62717),o=e(79609),s=e(2863);const m=(x,g=!1)=>{let p=x.flatMap(c=>c.fields.map(y=>(0,n.Ct)(y,c,x)));if(g){let c=x.flatMap(y=>y.fields.map(P=>P.name));p=[...new Set(c.concat(p))]}return p};function a(x,g=!1){return(0,t.useMemo)(()=>m(x,g),[x,g])}function l(x){const g=new Set;for(const p of x)for(const c of p.fields)if(c.labels)for(const y of Object.keys(c.labels))g.add(y);return g}const f={combine:"Combine",calculateNewFields:"Calculate new fields",createNewVisualization:"Create new visualization",filter:"Filter",performSpatialOperations:"Perform spatial operations",reformat:"Reformat",reorderAndRename:"Reorder and rename"},h=x=>!!(typeof x=="number"||!Number.isNaN(Number(x))||/^\$[A-Za-z0-9_]+$/.test(x));function u(x){const g=[];x&&(g.push({label:"Browser",value:"browser"}),g.push({label:"UTC",value:"utc"}));const p=(0,r.P3)();for(const c of p)g.push({label:c,value:c});return g}function i(){return(0,s.w)().getVariables().map(x=>({value:x.name,label:x.label||x.name,origin:o.$0.Template}))}},1302:(ee,B,e)=>{"use strict";e.d(B,{$u:()=>u,Ay:()=>p,Cj:()=>l,EC:()=>h,Y_:()=>a,dJ:()=>i,g4:()=>f,jE:()=>x,t_:()=>s});var t=e(65307),n=e(65642);const r={users:[],searchQuery:"",page:0,perPage:30,totalPages:1,externalUserMngInfo:n.Ay.externalUserMngInfo,externalUserMngLinkName:n.Ay.externalUserMngLinkName,externalUserMngLinkUrl:n.Ay.externalUserMngLinkUrl,isLoading:!1,rolesLoading:!1},o=(0,t.Z0)({name:"users",initialState:r,reducers:{usersLoaded:(c,y)=>{const{totalCount:P,perPage:d,page:D,orgUsers:b}=y.payload,E=Math.ceil(P/d);return{...c,isLoading:!0,users:b,perPage:d,page:D,totalPages:E}},searchQueryChanged:(c,y)=>({...c,searchQuery:y.payload,page:r.page}),setUsersSearchPage:(c,y)=>({...c,page:y.payload}),pageChanged:(c,y)=>({...c,page:y.payload}),sortChanged:(c,y)=>({...c,sort:y.payload}),usersFetchBegin:c=>({...c,isLoading:!0}),usersFetchEnd:c=>({...c,isLoading:!1}),rolesFetchBegin:c=>({...c,rolesLoading:!0}),rolesFetchEnd:c=>({...c,rolesLoading:!1})}}),{searchQueryChanged:s,setUsersSearchPage:m,usersLoaded:a,usersFetchBegin:l,usersFetchEnd:f,pageChanged:h,sortChanged:u,rolesFetchBegin:i,rolesFetchEnd:x}=o.actions,p={users:o.reducer}},79776:(ee,B,e)=>{"use strict";e.d(B,{o:()=>n});var t=e(43173);function n(r){const o=new URL(t.$.externalUserMngLinkUrl);return t.$.externalUserMngAnalytics&&(t.$.externalUserMngAnalyticsParams&&t.$.externalUserMngAnalyticsParams.split("&").forEach(m=>{const[a,l]=m.split("=");o.searchParams.append(a,l)}),o.searchParams.append("cnt",r)),o.toString()}},54742:(ee,B,e)=>{"use strict";e.d(B,{B:()=>n});var t=e(42954);const n=new t.O},48421:(ee,B,e)=>{"use strict";e.d(B,{$u:()=>g,D4:()=>y,Iv:()=>P,U2:()=>c,VT:()=>p,z_:()=>x});var t=e(2543),n=e.n(t),r=e(28998),o=e(17752),s=e(67933),m=e(39167),a=e(74887),l=e(93612),f=e(88681),h=e(99305),u=e(25206);const i="Filters",x=b=>async(E,v)=>{let C=D(b,v());if(!C&&(E(d(b)),C=D(b,v()),!C))return;const S=C.filters.findIndex(I=>I.key===b.key&&I.value===b.value);if(S===-1){const{value:I,key:R,operator:T}=b,L={value:I,key:R,operator:T};return await E(c((0,h.jX)(C),L))}const O={...C.filters[S],operator:b.operator};return await E(g((0,h.jX)(C),{index:S,filter:O}))},g=(b,E)=>async(v,C)=>{const S=(0,l.dn)(b,C());v((0,a.kb)(b.rootStateKey,(0,u.E2)((0,h.qD)(S,E)))),await v((0,m.us)((0,h.jX)(S),!0))},p=(b,E)=>async(v,C)=>{const S=(0,l.dn)(b,C());v((0,a.kb)(b.rootStateKey,(0,u.D$)((0,h.qD)(S,E)))),await v((0,m.us)((0,h.jX)(S),!0))},c=(b,E)=>async(v,C)=>{const S=(0,l.dn)(b,C());v((0,a.kb)(b.rootStateKey,(0,u.xt)((0,h.qD)(S,E)))),await v((0,m.us)((0,h.jX)(S),!0))},y=(b,E)=>async(v,C)=>{const S=(0,l.dn)(b,C());v((0,a.kb)(b.rootStateKey,(0,u.qZ)((0,h.qD)(S,E)))),await v((0,m.us)((0,h.jX)(S),!0))},P=(b,E)=>async(v,C)=>{const S=(0,l.dn)(b,C());v((0,a.kb)(b.rootStateKey,(0,f.QP)((0,h.qD)(S,{propName:"datasource",propValue:E}))));const I=(await(0,r.tR)().get(E))?.getTagKeys?"Ad hoc filters are applied automatically to all queries that target this data source":"This data source does not support ad hoc filters yet.";v((0,a.kb)(b.rootStateKey,(0,o.BC)({infoText:I})))},d=b=>(E,v)=>{const C=(0,l.y7)(v()),S={...(0,t.cloneDeep)(u.MK),datasource:b.datasource,name:i,id:i,rootStateKey:C},O=!1,I=(0,l.hk)(C,v()),R={type:"adhoc",id:S.id,rootStateKey:C};E((0,a.kb)(C,(0,f.QV)((0,h.qD)(R,{global:O,model:S,index:I}))))},D=(b,E)=>{const v=(0,l.y7)(E),C=(0,l.nx)(v,E);let S;for(const O of Object.values(C.variables))if((0,s.EW)(O)&&O.datasource?.uid===b.datasource.uid){S=O;break}return S}},25206:(ee,B,e)=>{"use strict";e.d(B,{AA:()=>u,D$:()=>l,E2:()=>f,MK:()=>s,qZ:()=>h,xt:()=>a});var t=e(65307),n=e(88813),r=e(93612),o=e(96120);const s={...n.Vg,type:"adhoc",datasource:null,filters:[]},m=(0,t.Z0)({name:"templating/adhoc",initialState:o.j,reducers:{filterAdded:(i,x)=>{const g=(0,r.Fs)(i,x.payload.id);g.type==="adhoc"&&g.filters.push(x.payload.data)},filterRemoved:(i,x)=>{const g=(0,r.Fs)(i,x.payload.id);if(g.type!=="adhoc")return;const p=x.payload.data;g.filters.splice(p,1)},filterUpdated:(i,x)=>{const g=(0,r.Fs)(i,x.payload.id);if(g.type!=="adhoc")return;const{filter:p,index:c}=x.payload.data;g.filters[c]=p},filtersRestored:(i,x)=>{const g=(0,r.Fs)(i,x.payload.id);g.type==="adhoc"&&(g.filters=x.payload.data)}}}),{filterAdded:a,filterRemoved:l,filterUpdated:f,filtersRestored:h}=m.actions,u=m.reducer},8921:(ee,B,e)=>{"use strict";e.d(B,{Ek:()=>s,To:()=>r,Zm:()=>n,ou:()=>o,qF:()=>t,qz:()=>m});const t="00000000-0000-0000-0000-000000000000",n="All",r="$__all",o="None",s="",m="var-"},56404:(ee,B,e)=>{"use strict";e.d(B,{c:()=>f,z:()=>h});var t=e(74848),n=e(92145),r=e(96540),o=e(85629),s=e(63142),m=e(87105),a=e(56840),l=e(25379);const f="Grafana-LegacyVariableQueryEditor",h=({onChange:u,query:i})=>{const x=(0,s.of)(l.$),[g,p]=(0,r.useState)(i),c=d=>{p(d.currentTarget.value)},y=(0,r.useCallback)(d=>{u(d.currentTarget.value,d.currentTarget.value)},[u]),P=(0,n.Bi)();return(0,t.jsx)(m.f,{id:P,rows:2,value:g,onChange:c,onBlur:y,placeholder:(0,a.t)("variables.legacy-variable-query-editor.placeholder-metric-name-or-tags-query","Metric name or tags query"),required:!0,"data-testid":o.Tp.pages.Dashboard.Settings.V
1544ariables.Edit.QueryVariable.queryOptionsQueryInput,cols:52,className:x.textarea})};h.displayName=f},38681:(ee,B,e)=>{"use strict";e.d(B,{y:()=>a});var t=e(74848),n=e(96540),r=e(2863),o=e(80185),s=e(67933),m=e(56404);async function a(f,h=o.cS){if((0,s.zs)(f))return f.variables.editor;if((0,s.X3)(f)){const u=await h(f.meta);if(!u.components.QueryEditor)throw new Error("Missing QueryEditor in plugin definition.");return u.components.QueryEditor??null}return(0,s.Hf)(f)?l:(0,s.d5)(f)?(await h(f.meta)).components.VariableQueryEditor??m.z:null}function l({datasource:f,query:h,onChange:u}){const i=(0,n.useCallback)(x=>{u({refId:"StandardVariableQuery",query:x})},[u]);return(0,t.jsx)(m.z,{query:h.query,onChange:i,datasource:f,templateSrv:(0,r.w)()})}},17752:(ee,B,e)=>{"use strict";e.d(B,{BC:()=>f,DW:()=>m,Eo:()=>u,FN:()=>s,NY:()=>h,T7:()=>l,nS:()=>n,sJ:()=>a,wf:()=>o,y8:()=>i});var t=e(65307);const n={id:"",isValid:!0,errors:{},name:"",extended:null},r=(0,t.Z0)({name:"templating/editor",initialState:n,reducers:{variableEditorMounted:(x,g)=>{x.name=g.payload.name,x.id=g.payload.id},variableEditorUnMounted:(x,g)=>n,changeVariableNameSucceeded:(x,g)=>{x.name=g.payload.data.newName,delete x.errors.name,x.isValid=Object.keys(x.errors).length===0},changeVariableNameFailed:(x,g)=>{x.name=g.payload.newName,x.errors.name=g.payload.errorText,x.isValid=Object.keys(x.errors).length===0},addVariableEditorError:(x,g)=>{x.errors[g.payload.errorProp]=g.payload.errorText,x.isValid=Object.keys(x.errors).length===0},removeVariableEditorError:(x,g)=>{delete x.errors[g.payload.errorProp],x.isValid=Object.keys(x.errors).length===0},changeVariableEditorExtended:(x,g)=>{x.extended={...x.extended,...g.payload}},cleanEditorState:()=>n}}),o=r.reducer,{changeVariableNameSucceeded:s,changeVariableNameFailed:m,variableEditorMounted:a,variableEditorUnMounted:l,changeVariableEditorExtended:f,addVariableEditorError:h,removeVariableEditorError:u,cleanEditorState:i}=r.actions},73829:(ee,B,e)=>{"use strict";e.d(B,{M:()=>t});var t=(n=>(n[n.MaxSize=50]="MaxSize",n))(t||{})},66223:(ee,B,e)=>{"use strict";e.d(B,{z:()=>o});var t=e(2863),n=e(54742),r=e(8921);function o(s){const m={},a=(0,t.w)().getVariables();for(let l=0;l<a.length;l++){const f=a[l],h=s&&s[f.name];f.skipUrlSync||(h?m[r.qz+f.name]=h.value:m[r.qz+f.name]=n.B.get(f.type).getValueForUrl(f))}return m}},67933:(ee,B,e)=>{"use strict";e.d(B,{CH:()=>p,EW:()=>o,Hf:()=>u,P4:()=>r,SP:()=>a,VN:()=>g,VO:()=>s,X3:()=>x,d5:()=>h,iv:()=>m,m8:()=>l,zs:()=>i});var t=e(48592),n=e(56404);const r=c=>c.type==="query",o=c=>c.type==="adhoc",s=c=>c.type==="constant",m=c=>"multi"in c,a=c=>"options"in c,l=c=>"current"in c;function f(c){return c===null?!1:typeof c=="string"}const h=c=>!!c.metricFindQuery&&!c.variables,u=c=>{if(!c.variables||c.variables.getType()!==t.Qz.Standard)return!1;const y=c.variables;return"toDataQuery"in y&&!!y.toDataQuery},i=c=>{if(!c.variables||c.variables.getType()!==t.Qz.Custom)return!1;const y=c.variables;return"query"in y&&"editor"in y&&!!y.query&&!!y.editor},x=c=>c.variables?c.variables.getType()===t.Qz.Datasource:!1;function g(c,y){return c?c.displayName===n.c||h(y):!1}function p(c,y){return c?c.displayName!==n.c&&(x(y)||u(y)||i(y)):!1}},27690:(ee,B,e)=>{"use strict";e.d(B,{i:()=>a});var t=e(74848),n=e(96540),r=e(22787);const o=({nodes:l,edges:f,direction:h,width:u,height:i,onDoubleClick:x})=>{const g=(0,n.useRef)(null),p=(0,n.useRef)(null),c=(0,n.useCallback)(y=>{x&&x(y.nodes[0])},[x]);return(0,n.useEffect)(()=>((async()=>{const P=await e.e(5083).then(e.t.bind(e,83416,23)),d={nodes:s(P,l),edges:m(P,f)},D={width:"100%",height:"100%",autoResize:!0,layout:{improvedLayout:!0,hierarchical:{enabled:!0,direction:h??"DU",sortMethod:"directed"}},interaction:{navigationButtons:!0,dragNodes:!1}};g.current=new P.Network(p.current,d,D),g.current?.on("doubleClick",c)})(),()=>{g.current&&g.current.off("doubleClick")}),[h,f,l,c]),(0,t.jsx)("div",{children:(0,t.jsx)("div",{ref:p,style:{width:u??"100%",height:i??"60vh"}})})};function s(l,f){const h=f.map(u=>({...u,shape:"box"}));return new l.DataSet(h)}function m(l,f){const h=f.map(u=>({...u,arrows:"to",dashes:!0}));return new l.DataSet(h)}function a({edges:l,nodes:f,show:h,title:u,children:i}
1544){const[x,g]=(0,n.useState)(h),p=(0,n.useCallback)(()=>g(!0),[g]),c=(0,n.useCallback)(()=>g(!1),[g]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.a,{isOpen:x,title:u,icon:"info-circle",iconTooltip:"The graph can be moved, zoomed in, and zoomed out.",onClickBackdrop:c,onDismiss:c,children:(0,t.jsx)(o,{nodes:f,edges:l})}),i({showModal:p})]})}},99703:(ee,B,e)=>{"use strict";e.d(B,{WT:()=>n,bX:()=>s,t4:()=>o});var t=e(65307);const n={usages:[],usagesNetwork:[]},r=(0,t.Z0)({name:"templating/inspect",initialState:n,reducers:{initInspect:(m,a)=>{const{usages:l,usagesNetwork:f}=a.payload;m.usages=l,m.usagesNetwork=f}}}),o=r.reducer,{initInspect:s}=r.actions},47969:(ee,B,e)=>{"use strict";e.d(B,{qJ:()=>h,hI:()=>l,hM:()=>p,H7:()=>f,xU:()=>P,P5:()=>S,Jx:()=>g,g0:()=>c,PK:()=>v,Ow:()=>b});var t=e(38036);function n(O,I){const R=new Set;for(const T of O)R.add(I(T));return R}var r=e(82612),o=e(62635),s=e(54742),m=e(67933),a=e(99305);const l=O=>{const I=[];for(const R of O)I.push({id:R.id,label:`${R.id}`});return I},f=(O,I)=>O.filter(R=>I.some(T=>T.from===R.id||T.to===R.id)),h=O=>{const I=[];for(const R of O)for(const T of O){if(R===T)continue;s.B.get(R.type).dependsOn(R,T)&&I.push({from:R.id,to:T.id})}return I};function u(O){const I=(0,a.t4)(O);if(!I)return;const R=I.slice(1).find(T=>T!==void 0);if(!(R in{}))return R}const i=(O,I)=>{a.SY.lastIndex=0;const R=[],L=(0,o.MA)(I,2).match(a.SY);if(!L)return R;for(const K of L){if(!K||K.indexOf("$__")!==-1||K.indexOf("${__")!==-1||K.indexOf("$hashKey")!==-1)continue;const A=u(K);O.some(W=>W.id===A)||R.find(W=>W===A)||A&&R.push(A)}return R},x={alias:[/^m$/,/^measurement$/,/^col$/,/^tag_(\w+|\d+)$/],query:[/^timeFilter$/]},g=(O,I,R)=>{const T=Object.keys(I.value).reduce((K,A)=>{const W=I.value[A];if(!W||typeof W!="string")return K;const N=x[A]?x[A].find(j=>j.test(O)):void 0;let w=(0,a.wJ)(W,O);return A==="repeat"&&W===O&&(w=!0),!N&&w&&(K={...K,[A]:W}),K},{}),L=Object.keys(I.value).reduce((K,A)=>{const W=I.value[A];if(W&&typeof W=="object"&&Object.keys(W).length){let N=W.title||W.name||W.id||A;Array.isArray(I.value)&&I.key==="panels"&&(N=`${N}[${W.id}]`);const w=g(O,{key:A,value:W},{});Object.keys(w).length&&(K={...K,[N]:w})}return K},{});return(Object.keys(T).length||Object.keys(L).length)&&(R={...R,...T,...L}),R},p=(O,I)=>{if(!I)return{unUsed:[],usages:[]};const R=[];let T=[];const L=I.getSaveModelCloneOld();for(const K of O){const A=K.id,W=g(A,{key:"model",value:L},{});!Object.keys(W).length&&!(0,m.EW)(K)&&R.push(K),Object.keys(W).length&&T.push({variable:K,tree:W})}return{unUsed:R,usages:T}};async function c(O,I){return new Promise((R,T)=>{setTimeout(()=>{try{const L=y(O,I);R(b(L))}catch(L){T(L)}},200)})}function y(O,I){if(!I)return[];let R=[];const T=I.getSaveModelCloneOld(),L=i(O,T);for(const K of L){const A=g(K,{key:"model",value:T},{});if(Object.keys(A).length){const W={id:K,name:K};R.push({variable:W,tree:A})}}return R}function P(O,I,R){const T=n(I.descendants(O),K=>K.name);T.add(t.c.includeVars);for(const K of O)T.add(K);return d([...T],R)}function d(O,I){const R=[];for(const T of O)I[T]&&R.push(...I[T]);return new Set(R)}const D=(O,I)=>{const{id:R,value:T}=I,{nodes:L,edges:K}=O;if(T&&typeof T=="string"){const A=`${I.id}-${T}`;return L.push({id:A,label:T}),K.push({from:A,to:R}),O}if(T&&typeof T=="object"){const A=Object.keys(T);for(const W of A){const N=`${I.id}-${W}`;L.push({id:N,label:W}),K.push({from:N,to:R}),O=D(O,{id:N,value:T[W]})}return O}return O},b=O=>{const I=[];for(const R of O){const{variable:T,tree:L}=R,K={variable:T,nodes:[{id:"dashboard",label:"dashboard"}],edges:[],showGraph:!1};I.push(D(K,{id:"dashboard",value:L}))}return I},E=O=>Object.values(O).reduce((R,T)=>typeof T=="object"?R+E(T):R+1,0),v=(O,I)=>{const R=I.find(T=>T.variable.id===O);return R?E(R.tree):0};function C(O){const I=[];for(const R of O)I.push(R),R.panels?.length&&I.push(...C(R.panels.map(T=>new PanelModel(T))));return I}function S(O){const I={};for(const R of O){const T=(0,r.tw)(R),L=[...T.matchAll(/"repeat":"([^"]+)"/g)].map(W=>W[1]),K=T.match(a.SY)?.map(W=>u(W))??[],A=[...L,...K];for(const W of A)W in I?I[W].add(R.id):I[W]=new Set([R.id])}return I}},98732:(ee,B,e)=>{"use strict";e.d(B,{E5:()=>h,Ez:()=>l,mn:()=>u});var t=e(65307),n=e(2543),r=e.n(n),o=e(7389),s=e(93612),m=e(96120),a=e(88813);const l={...a.Vg,type:"interval",auto_count:30,auto_min:"10s",options:[],auto:!1,query:"1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",refresh:o.CO.onTimeRangeChanged,current:{}},f=(0,t.Z0)({name:"templating/interval",initialState:m.j,reducers:{createIntervalOptions:(i,x)=>{const g=(0,s.Fs)(i,x.payload.id);if(g.type!=="interval")return;const p=(0,n.map)(g.query.match(/(["'])(.*?)\1|\w+/g),c=>(c=c.replace(/["']+/g,""),{text:c.trim(),value:c.trim(),selected:!1}));g.auto&&p.length&&p[0].text!=="auto"&&p.unshift({text:"auto",value:"$__auto_interval_"+g.name,selected:!1}),g.options=p}}}),h=f.reducer,{createIntervalOptions:u}=f.actions},99598:(ee,B,e)=>{"use strict";e.d(B,{jR:()=>I,Fu:()=>b,$z:()=>f,O$:()=>E,ho:()=>R,MO:()=>D,an:()=>v,U9:()=>d,fx:()=>S,qh:()=>O,S8:()=>C});var t=e(84139),n=e(65307),r=e(2543),o=e(94452);const s=(T,...L)=>L.reduce((K,A)=>A(K),T);var m=e(8921),a=e(67933);const l=/[^ -~]/m,f={id:"",highlightIndex:-1,queryValue:"",selectedValues:[],options:[],multi:!1},h=1e3,u=new t.A({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1}),i=T=>Array.isArray(T)?T.reduce((L,K)=>((0,r.isString)(K.value)&&(L[K.value]=K),L),{}):{},x=T=>{if(!Array.isArray(T.options))return T.options=[],T;const L=i(T.selectedValues);
1544return T.selectedValues=Object.values(L),T.options=T.options.map(K=>{if(!(0,r.isString)(K.value))return K;const A=!!L[K.value];return K.selected===A?K:{...K,selected:A}}),T.options=g(T.options),T},g=T=>Array.isArray(T)?T.length<=h?T:T.slice(0,h):[],p=T=>{const{options:L,selectedValues:K}=T;return L.length===0||K.length>0||!L[0]||L[0].value!==m.To||(T.selectedValues=[{...L[0],selected:!0}]),T},c=T=>{const{selectedValues:L}=T;return L.length>1&&(T.selectedValues=L.filter(K=>K.value!==m.To)),T},y=T=>T.filter(L=>L.value!==m.To).map(L=>({...L,selected:!0})),P=(0,n.Z0)({name:"templating/optionsPicker",initialState:f,reducers:{showOptions:(T,L)=>{const{query:K,options:A}=L.payload;if(T.highlightIndex=-1,T.options=(0,r.cloneDeep)(A),T.id=L.payload.id,T.queryValue="",T.multi=!1,(0,a.iv)(L.payload)&&(T.multi=L.payload.multi??!1),(0,a.P4)(L.payload)){const{queryValue:W}=L.payload,N=(0,o.E)(K);T.queryValue=N&&W?W:""}return T.selectedValues=T.options.filter(W=>W.selected),s(T,p,x)},hideOptions:(T,L)=>({...f}),toggleOption:(T,L)=>{const{option:K,clearOthers:A,forceSelect:W}=L.payload,{multi:N,selectedValues:w}=T;if(K){const j=!w.find(V=>V.value===K.value&&V.text===K.text);if(K.value===m.To||!N||A)return j||W?T.selectedValues=[{...K,selected:!0}]:T.selectedValues=[],s(T,p,c,x);if(W||j)return T.selectedValues.push({...K,selected:!0}),s(T,p,c,x);T.selectedValues=w.filter(V=>V.value!==K.value&&V.text!==K.text)}else T.selectedValues=[];return s(T,p,c,x)},moveOptionsHighlight:(T,L)=>{let K=T.highlightIndex+L.payload;return K<0?K=-1:K>=T.options.length&&(K=T.options.length-1),{...T,highlightIndex:K}},toggleAllOptions:(T,L)=>{const K=T.selectedValues.find(W=>W.value===m.To),A=T.options.find(W=>W.value===m.To);return T.selectedValues.length>0&&A&&!K?(T.selectedValues=[],T.selectedValues.push({text:A.text??"All",value:A.value,selected:!0}),s(T,x)):K&&T.selectedValues.length===1?(T.selectedValues=y(T.options),s(T,x)):T.selectedValues.length>0&&!A?(T.selectedValues=[],s(T,x)):(T.selectedValues=y(T.options),s(T,x))},updateSearchQuery:(T,L)=>(T.queryValue=L.payload,T),updateOptionsAndFilter:(T,L)=>{const K=T.queryValue.trim();let A=[];if(K==="")A=L.payload;else if(l.test(K))A=L.payload.filter(W=>W.text.includes(K));else{const W=L.payload.map(({text:V})=>Array.isArray(V)?V.toString():V),[N,w,j]=u.search(W,K,5);N?.length&&(w&&j?A=j.map(V=>L.payload[w.idx[V]]):A=N.map(V=>L.payload[V]),A.sort((V,U)=>(V.value===m.To?-1:0)-(U.value===m.To?-1:0)))}if(T.highlightIndex=0,K!==""){let W=A.findIndex(N=>N.value!==m.To);(W===-1||A[W].value!==K)&&(A.unshift({selected:!1,text:"> "+K,value:K}),T.highlightIndex=W===-1?0:W+1)}return T.options=A,s(T,p,x)},updateOptionsFromSearch:(T,L)=>(T.options=L.payload,T.highlightIndex=0,s(T,p,x)),cleanPickerState:()=>f}}),{toggleOption:d,showOptions:D,hideOptions:b,moveOptionsHighlight:E,toggleAllOptions:v,updateSearchQuery:C,updateOptionsAndFilter:S,updateOptionsFromSearch:O,cleanPickerState:I}=P.actions,R=P.reducer},78763:(ee,B,e)=>{"use strict";e.d(B,{C:()=>t});const t=(o,s)=>o&&(s&&!Array.isArray(o.value)?{...o,value:r(o.value),text:r(o.text)}:!s&&Array.isArray(o.value)?{...o,value:n(o.value),text:n(o.text)}:o),n=o=>Array.isArray(o)?o.length>0?o[0]:"":o,r=o=>Array.isArray(o)?o:[o]},39167:(ee,B,e)=>{"use strict";e.d(B,{Y7:()=>Ve,TI:()=>Y,_q:()=>tt,RK:()=>Ce,t9:()=>pe,x7:()=>ae,Hn:()=>ke,mZ:()=>Qe,kl:()=>fe,us:()=>le});var t=e(2543),n=e(7389),r=e(3594),o=e(28105),s=e(48480),m=e(36490),a=e(25992),l=e(43173),f=e(6890),h=e(15130),u=e(75421),i=e(8535),x=e(64762),g=e(73427),p=e(83873),c=e(68220),y=e(28998),P=e(59373),d=e(54742),D=e(8921),b=e(17752),E=e(67933),v=e(47969),C=e(99598),S=e(78763),O=e(88813),I=e(99305),R=e(21275),T=e(37918),L=e(74887),K=e(38221);const A=(ce,Pe=-1,Se=!1,Ee=!1)=>{const xe={};if(Ee){const ye={...initialVariableModelState,id:"__dashboard",name:"__dashboard",type:"system",index:-3,skipUrlSync:!0,hide:VariableHide.hideVariable,current:{value:{name:"A dashboard title",uid:"An dashboard UID",toString:()=>"A dashboard title"}}},Oe={...initialVariableModelState,id:"__org",name:"__org",type:"system",index:-2,skipUrlSync:!0,hide:VariableHide.hideVariable,current:{value:{name:"An org name",id:1,toString:()=>"1"}}},we={...initialVariableModelState,id:"__user",name:"__user",type:"system",index:-1,skipUrlSync:!0,hide:VariableHide.hideVariable,current:{value:{login:"admin",id:1,email:"admin@test",toString:()=>"1"}}};xe[ye.id]=ye,xe[Oe.id]=Oe,xe[we.id]=we}for(let ye=0;ye<ce;ye++)xe[ye]=createQueryVariable({id:ye.toString(),name:`Name-${ye}`,label:`Label-${ye}`,index:ye});return Se&&(xe[NEW_VARIABLE_ID]=createQueryVariable({id:NEW_VARIABLE_ID,name:`Name-${NEW_VARIABLE_ID}`,label:`Label-${NEW_VARIABLE_ID}`,index:ce})),xe},W=(ce,Pe={})=>{const Se={id:"0",rootStateKey:"key",index:0,name:"0"};return{initialState:{0:{...{...ce.initialState,...Se},...Pe}}}},N=()=>combineReducers({dashboard:dashboardReducer,templating:keyedVariablesReducer}),w=()=>combineReducers({templating:keyedVariablesReducer});function j(ce,Pe){return{templating:{lastKey:ce,keys:{[ce]:{...getInitialTemplatingState(),...Pe}}}}}
1544function V(ce,Pe){return ce.find(Ee=>Ee.name===Pe)}function U(ce){return(ce.type==="query"||ce.type==="datasource"||ce.type==="interval")&&ce.refresh===R.CO.onTimeRangeChanged}var F=e(93612),M=e(88681),H=e(74276),_=e(77839);const Z=(ce,Pe)=>(Se,Ee)=>{let xe=0;const ye=Pe.templating.list;for(let we=0;we<ye.length;we++){const Be=ne(ye[we]);Be.rootStateKey=ce,d.B.getIfExists(Be.type)&&Se((0,L.kb)(ce,(0,M.QV)((0,I.qD)(Be,{global:!1,index:xe++,model:Be}))))}(0,P.w)().updateTimeRange((0,u.jG)().timeRange());const Oe=(0,F.SS)(ce,Ee());for(const we of Oe)Se((0,L.kb)(ce,(0,M.wB)((0,I.qD)(we))))};function ne(ce){if(!(0,E.SP)(ce))return ce;let Pe=!1;for(const Se of ce.options)if(Se.selected=!1,Array.isArray(ce.current.value))for(const Ee of ce.current.value)Se.value===Ee&&(Se.selected=Pe=!0);else Se.value===ce.current.value&&(Se.selected=Pe=!0);return!Pe&&ce.options.length&&(ce.options[0].selected=!0),ce}const te=(ce,Pe)=>Se=>{const Ee={...O.Vg,id:"__dashboard",name:"__dashboard",type:"system",index:-3,skipUrlSync:!0,hide:n.zL.hideVariable,current:{value:{name:Pe.title,uid:Pe.uid,toString:()=>Pe.title}}};Se((0,L.kb)(ce,(0,M.QV)((0,I.qD)(Ee,{global:Ee.global,index:Ee.index,model:Ee}))));const xe={...O.Vg,id:"__org",name:"__org",type:"system",index:-2,skipUrlSync:!0,hide:n.zL.hideVariable,current:{value:{name:h.TP.user.orgName,id:h.TP.user.orgId,toString:()=>h.TP.user.orgId.toString()}}};Se((0,L.kb)(ce,(0,M.QV)((0,I.qD)(xe,{global:xe.global,index:xe.index,model:xe}))));const ye={...O.Vg,id:"__user",name:"__user",type:"system",index:-1,skipUrlSync:!0,hide:n.zL.hideVariable,current:{value:{login:h.TP.user.login,id:h.TP.user.id,email:h.TP.user.email,toString:()=>h.TP.user.id.toString()}}};Se((0,L.kb)(ce,(0,M.QV)((0,I.qD)(ye,{global:ye.global,index:ye.index,model:ye}))))},Y=(ce,Pe)=>(Se,Ee)=>{const{rootStateKey:xe}=ce,ye=(0,F.dn)(ce,Ee());if(!(0,E.iv)(ye)||(0,r.R)(ye.current))return;const Oe=(0,S.C)(ye.current,Pe);Se((0,L.kb)(xe,(0,M.QP)((0,I.qD)(ce,{propName:"multi",propValue:Pe})))),Se((0,L.kb)(xe,(0,M.QP)((0,I.qD)(ce,{propName:"current",propValue:Oe}))))},Q=async(ce,Pe)=>{if(!ce.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${ce.id}`);if(J(ce,Pe))throw new Error("Circular dependency in dashboard variables detected. Dashboard may not work as expected.");const Se=q(ce,Pe);X(ce.rootStateKey,Se,Pe)&&await new Promise(Ee=>{const xe=i.M_.subscribe(()=>{if(!ce.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${ce.id}`);X(ce.rootStateKey,Se,i.M_.getState())||(xe(),Ee())})})},J=(ce,Pe,Se=new Set)=>Se.has(ce.id)?!0:(Se=new Set([...Se,ce.id]),q(ce,Pe).some(Ee=>J(Ee,Pe,Se))),q=(ce,Pe)=>{if(!ce.rootStateKey)return[];const Se=[];for(const Ee of(0,F.SS)(ce.rootStateKey,Pe))ce!==Ee&&d.B.getIfExists(ce.type)&&d.B.get(ce.type).dependsOn(ce,Ee)&&Se.push(Ee);return Se},X=(ce,Pe,Se)=>{if(Pe.length===0)return!1;const Ee=(0,F.SS)(ce,Se);return Pe.filter(ye=>Ee.some(Oe=>Oe.id===ye.id&&(Oe.state===o.Gu.NotStarted||Oe.state===o.Gu.Loading))).length>0},se=(ce,Pe)=>async(Se,Ee)=>{const xe=(0,F.dn)(ce,Ee());await Q(xe,Ee());const ye=Pe[D.qz+xe.name];if(ye!==void 0){const Oe=(0,I.QT)(ye);await d.B.get(xe.type).setValueFromUrl(xe,Oe);return}if(xe.hasOwnProperty("refresh")){const Oe=xe;if(Oe.refresh===n.CO.onDashboardLoad||Oe.refresh===n.CO.onTimeRangeChanged){await Se(Qe((0,I.jX)(Oe)));return}}if(xe.type==="custom"){await Se(Qe((0,I.jX)(xe)));return}Se(ze(ce))},oe=ce=>async(Pe,Se)=>{const Ee=m.Ny.getSearchObject(),xe=(0,F.SS)(ce,Se()).map(async ye=>await Pe(se((0,I.jX)(ye),Ee)));await Promise.all(xe)},ae=(ce,Pe)=>async(Se,Ee)=>{const xe=(0,I.QT)(Pe),ye=(0,F.dn)(ce,Ee());(0,I.q$)(ye)!==n.CO.never&&await Se(Qe((0,I.jX)(ye)));const Oe=(0,F.dn)((0,I.jX)(ye),Ee());if(!(0,E.SP)(Oe))return;if(!Oe)throw new Error(`Couldn't find variable with name: ${ye.name}`);let we=Oe.options.find(Be=>Be.text===xe||Be.value===xe);if(!we&&(0,E.iv)(Oe)&&Oe.allValue&&xe===Oe.allValue&&(we={text:D.Zm,value:D.To,selected:!1}),!we){let Be=xe;const Xe=xe;Array.isArray(xe)&&(Be=xe.reduce((st,lt)=>{const Et=Oe.options.find(Tt=>Tt.value===lt);return Et?[].concat(st,[Et.text]):[].concat(st,[lt])},[])),we={text:Be,value:Xe,selected:!1}}(0,E.iv)(Oe)&&(we=(0,S.C)({text:(0,t.castArray)(we.text),value:(0,t.castArray)(we.value),selected:!1},Oe.multi)),await d.B.get(ye.type).setValue(Oe,we)},ie=ce=>{let Pe,Se,Ee,xe;const ye=[];for(Pe=0;Pe<ce.options.length;Pe++)if(xe={...ce.options[Pe]},xe.selected=!1,Array.isArray(ce.current.value))for(Se=0;Se<ce.current.value.length;Se++)Ee=ce.current.value[Se],xe.value===Ee&&(xe.selected=!0,ye.push(xe));else xe.value===ce.current.value&&(xe.selected=!0,ye.push(xe));return ye},fe=(ce,Pe)=>(Se,Ee)=>{const xe=(0,F.dn)(ce,Ee());if(!(0,E.SP)(xe))return Promise.resolve();const ye=xe.current||{},Oe=d.B.get(xe.type).setValue;if(Array.isArray(ye.value)){const st=ie(xe);
1544if(st.length===0){const Et=xe.options[0];return Oe(xe,{value:typeof Et.value=="string"?[Et.value]:Et.value,text:typeof Et.text=="string"?[Et.text]:Et.text,selected:!0})}const lt={value:st.map(Et=>Et.value),text:st.map(Et=>Et.text),selected:!0};return Oe(xe,lt)}let we=null;const Be=(0,I.Nz)(xe),Xe=(0,I.Lz)(xe);if(we=xe.options?.find(st=>st.text===Be||st.value===Xe),we||Pe&&(we=xe.options?.find(st=>st.text===Pe||st.value===Pe),we))return Oe(xe,we);if(xe.options){const st=xe.options[0];if(st)return Oe(xe,st)}return Promise.resolve()},pe=(ce,Pe,Se)=>async Ee=>{const{rootStateKey:xe}=ce;return Ee((0,L.kb)(xe,(0,M.dE)((0,I.qD)(ce,{option:Pe})))),await Ee(le(ce,Se))},de=ce=>{const Pe=new c.TS;return ce.forEach(Se=>{Pe.createNode(Se.name)}),ce.forEach(Se=>{ce.forEach(Ee=>{if(Se!==Ee&&d.B.get(Se.type).dependsOn(Se,Ee))try{Pe.link(Se.name,Ee.name)}catch(xe){const ye=xe instanceof Error?xe.message:"Unknown error";(0,a.FF)("Error linking variables",{error:ye})}})}),Pe},le=(ce,Pe,Se=g.lE)=>async(Ee,xe)=>{const ye=xe(),{rootStateKey:Oe}=ce,we=(0,F.dn)(ce,ye);if((0,F.nx)(Oe,ye).transaction.status===O.x8.Fetching)return(0,I.q$)(we)===n.CO.never&&(await Ee(Ye((0,I.jX)(we))),Ee(ze(ce))),Promise.resolve();const Be=(0,F.SS)(Oe,ye),Xe=de(Be),st=ye.dashboard?.getModel()?.panels??[],lt=(0,v.P5)(st),Et=we.type==="adhoc"?{refreshAll:!0,panelIds:[]}:{refreshAll:!1,panelIds:Array.from((0,v.xU)([we.id],Xe,lt)),variable:(0,F.dn)(ce,ye)},Tt=Xe.getNode(we.name);let Mt=[];return Tt&&(Mt=Tt.getOptimizedInputEdges().map(wt=>{const _e=Be.find(xt=>xt.name===wt.inputNode?.name);return _e?Ee(Qe((0,I.jX)(_e))):Promise.resolve()})),Promise.all(Mt).then(()=>{Pe&&(Se.publish(new O.og(Et)),m.Ny.partial($e(Oe,xe)))})},me=(ce,Pe,Se,Ee)=>(Pe.includes(ce.name)||Pe.push(ce.name),ce.outputEdges.forEach(xe=>{const ye=xe.outputNode;if(ye&&!Pe.includes(ye.name)){const Oe=Se.find(we=>we.name===ye.name);Oe&&Oe.refresh===n.CO.onTimeRangeChanged&&Ee.indexOf(Oe)===-1?(Ee.push(Oe),Pe.push(ye.name)):me(ye,Pe,Se,Ee)}}),Ee),De=(ce,Pe)=>ce.outputEdges.every(Se=>{const Ee=Se.outputNode;if(Ee){const xe=V(Pe,Ee.name);if(xe&&xe.type==="query")return xe.refresh!==n.CO.onTimeRangeChanged}return!0}),Te=(ce,Pe)=>{const Se=(0,F.SS)(ce,Pe),Ee=de(Se),xe=[],ye=[];return Se.forEach(Oe=>{const we=Ee.getNode(Oe.name);if(!xe.includes(Oe.name)&&we){const Be=V(Se,we.name);if(!Be)return;const Xe=U(Be);Xe&&we.outputEdges.length===0&&ye.push(Be),Xe&&ye.includes(Be)&&we.outputEdges.length>0&&(ye.push(Be),me(we,xe,Se,ye)),Xe&&we.outputEdges.length>0&&De(we,Se)&&(ye.includes(Be)||ye.push(Be)),!Xe&&we.outputEdges.length>0&&me(we,xe,Se,ye)}}),ye},Ne=(ce,Pe)=>(0,F.SS)(ce,Pe).filter(xe=>"refresh"in xe&&"options"in xe?xe.refresh===n.CO.onTimeRangeChanged:!1),Ce=(ce,Pe,Se={templateSrv:(0,P.w)(),events:g.lE})=>async(Ee,xe)=>{Se.templateSrv.updateTimeRange(Pe);let ye=[];l.$.featureToggles.refactorVariablesTimeRange?ye=Te(ce,xe()):ye=Ne(ce,xe());const Oe=ye.map(Be=>Be.id),we=ye.map(Be=>Ee(He((0,I.jX)(Be))));try{await Promise.all(we),Se.events.publish(new O.BS({variableIds:Oe}))}catch(Be){console.error(Be),Ee((0,f.dx)(je("Template variable service failed",Be)))}},He=ce=>async(Pe,Se)=>{const Ee=(0,F.dn)(ce,Se());if(!(0,E.SP)(Ee))return;const xe=Ee.options.slice();await Pe(Qe((0,I.jX)(Ee),!0));const ye=(0,F.dn)(ce,Se());if(!(0,E.SP)(ye))return;const Oe=ye.options;JSON.stringify(xe)!==JSON.stringify(Oe)&&Se().dashboard.getModel()?.templateVariableValueUpdated()},ke=(ce,Pe,Se=g.lE)=>async(Ee,xe)=>{const ye=[],Oe=xe().dashboard.getModel(),we=(0,F.SS)(ce,xe());for(const Et of we){const Tt=D.qz+Et.name;if(!Pe.hasOwnProperty(Tt)||!Me(Et,Pe[Tt].value))continue;let Mt=Pe[Tt].value;if(Pe[Tt].removed){const _e=Oe?.templating.list.find(xt=>xt.name===Et.name);_e&&(0,E.m8)(_e)&&(Mt=_e.current.value),_e&&_e.type==="constant"&&(Mt=_e.query)}const wt=d.B.get(Et.type).setValueFromUrl(Et,Mt);ye.push(wt)}const Be=we.filter(Et=>{const Tt=D.qz+Et.name;return Pe.hasOwnProperty(Tt)&&Me(Et,Pe[Tt].value)&&Et.type!=="adhoc"}),Xe=de(we),st=(0,v.P5)(Oe?.panels??[]),lt=(0,v.xU)(Be.map(Et=>Et.id),Xe,st);ye.length&&(await Promise.all(ye),Se.publish(new O.eF({refreshAll:lt.size===0,panelIds:Array.from(lt)})))};function Me(ce,Pe){const Se=d.B.get(ce.type).getValueForUrl(ce);let Ee=(0,I.QT)(Pe);return Array.isArray(Se)&&!Array.isArray(Ee)&&(Ee=[Ee]),!(0,t.isEqual)(Se,Ee)}const $e=(ce,Pe)=>{const Se=m.Ny.getSearchObject(),Ee=Object.keys(Se).filter(xe=>xe.indexOf(D.qz)===-1).reduce((xe,ye)=>(xe[ye]=Se[ye],xe),{});for(const xe of(0,F.SS)(ce,Pe())){if(xe.skipUrlSync)continue;const ye=d.B.get(xe.type);Ee[D.qz+xe.name]=ye.getValueForUrl(xe)}return Ee}
1544,tt=(ce,Pe)=>async(Se,Ee)=>{try{const xe=(0,I.q4)(ce),ye=Ee(),Oe=(0,F.Tk)(ye);Oe&&(0,F.nx)(Oe,ye).transaction.status===O.x8.Fetching&&Se(Ve(Oe)),Se((0,L.kb)(xe,(0,H.kH)({uid:xe}))),Se(te(xe,Pe)),Se(Z(xe,Pe)),Se(Ke(xe)),await Se(oe(xe)),Se((0,L.kb)(xe,(0,H.$O)({uid:xe})))}catch(xe){Se((0,f.dx)(je("Templating init failed",xe))),console.error(xe)}};function Ke(ce,Pe=y.tR){return(Se,Ee)=>{const xe=(0,F.SS)(ce,Ee());for(const ye of xe){if(ye.type!=="adhoc"&&ye.type!=="query")continue;const{datasource:Oe}=ye;if((0,s.fN)(Oe))continue;const we=Pe().getInstanceSettings(Oe),Be=we?(0,s.p$)(we):{uid:Oe};Se((0,L.kb)(ce,(0,M.QP)((0,I.qD)(ye,{propName:"datasource",propValue:Be}))))}}}const Re=ce=>Pe=>{Pe((0,L.kb)(ce,(0,_.v)())),Pe((0,L.kb)(ce,(0,b.y8)())),Pe((0,L.kb)(ce,(0,C.jR)())),Pe((0,L.kb)(ce,(0,H.pu)()))},Ve=(ce,Pe={getBackendSrv:p.AI})=>Se=>{Pe.getBackendSrv().cancelAllInFlightRequests(),Se(Re(ce))},Qe=(ce,Pe=!1)=>async(Se,Ee)=>{const{rootStateKey:xe}=ce;try{if(!(0,I.sN)(xe,Ee()))return;const ye=(0,F.dn)(ce,Ee());Se((0,L.kb)(xe,(0,M.a7)((0,I.qD)(ye)))),await Se(Ye((0,I.jX)(ye))),await d.B.get(ye.type).updateOptions(ye),Se(ze(ce))}catch(ye){if(Se((0,L.kb)(xe,(0,M.Te)((0,I.qD)(ce,{error:ye})))),Pe||(console.error(ye),Se((0,f.dx)(je("Error updating options:",ye,ce)))),Pe)throw ye}},je=(ce,Pe,Se)=>(0,x.gi)(`${Se?`Templating [${Se.id}]`:"Templating"}`,Pe instanceof Error?`${ce} ${Pe.message}`:`${ce}`),ze=ce=>(Pe,Se)=>{const{rootStateKey:Ee}=ce;if(!(0,I.sN)(Ee,Se()))return;const xe=(0,F.dn)(ce,Se());xe.state!==o.Gu.Done&&Pe((0,L.kb)(ce.rootStateKey,(0,M.Pu)((0,I.qD)(xe))))};function Ye(ce,Pe=y.tR){return async function(Se,Ee){const{id:xe,rootStateKey:ye}=ce;if(!(0,I.sN)(ye,Ee()))return;const Oe=(0,F.dn)(ce,Ee());if(Oe.type==="query")try{const we=await Pe().get(Oe.datasource??"");if((0,E.d5)(we)||!(0,E.Hf)(we)||Ge(Oe.query))return;const Be={refId:`${we.name}-${xe}-Variable-Query`,query:Oe.query};Se((0,L.kb)(ye,(0,M.QP)((0,I.qD)(ce,{propName:"query",propValue:Be}))))}catch(we){Se((0,f.dx)(je("Failed to upgrade legacy queries",we))),console.error(we)}}}function Ge(ce){return(0,o.Gv)(ce)&&"refId"in ce&&typeof ce.refId=="string"}},74887:(ee,B,e)=>{"use strict";e.d(B,{Ay:()=>f,L1:()=>o,kb:()=>m});var t=e(99305),n=e(38221),r=e(74276);const o={keys:{}},s=h=>({type:`templating/keyed/${h.action.type.replace(/^templating\//,"")}`,payload:h});function m(h,u){const i=(0,t.q4)(h);return s({key:i,action:u})}const a=h=>typeof h.type=="string"&&h.type.startsWith("templating/keyed")&&"payload"in h&&typeof h.payload.key=="string";function l(h=o,u){if(a(u)){const{key:i,action:x}=u.payload,g=(0,t.q4)(i),p=r.kH.match(x)?g:h.lastKey,c=(0,n.H)(),y=h.keys[g],P=c(y,x);return{...h,lastKey:p,keys:{...h.keys,[g]:P}}}return h}const f={templating:l}},38221:(ee,B,e)=>{"use strict";e.d(B,{H:()=>f,x:()=>h});var t=e(14644),n=e(17752),r=e(99703),o=e(99598),s=e(74276),m=e(96120),a=e(77839);let l;function f(){return l||(l=(0,t.combineReducers)({editor:n.wf,variables:a.Y,optionsPicker:o.ho,transaction:s.Dd,inspect:r.t4})),l}function h(){return{editor:n.nS,variables:m.j,optionsPicker:o.$z,transaction:s.i3,inspect:r.WT}}},93612:(ee,B,e)=>{"use strict";e.d(B,{Fs:()=>D,SS:()=>l,Tk:()=>p,UN:()=>P,_2:()=>d,bZ:()=>y,dn:()=>s,hk:()=>i,nS:()=>u,nx:()=>a,pi:()=>h,wk:()=>x,y7:()=>c});var t=e(41811),n=e(8535),r=e(99305),o=e(38221);function s(b,E=(0,n.Gu)(),v=!0){const{id:C,rootStateKey:S}=b,I=a(S,E).variables[C];if(!I){if(v)throw new Error(`Couldn't find variable with id:${C}`);return}return I}function m(b,E,v=(0,n.Gu)()){return Object.values(a(E,v).variables).filter(b).sort((C,S)=>C.index-S.index)}function a(b,E=(0,n.Gu)()){return E.templating.keys[(0,r.q4)(b)]??(0,o.x)()}function l(b,E=(0,n.Gu)()){return m(f,b,E)}function f(b){return b.type!=="system"}const h=(0,t.default)((b,E)=>l(b,(0,n.Gu)())),u=(b,E)=>l(b,E);function i(b,E=(0,n.Gu)()){return x(Object.values(a(b,E).variables))}function x(b){const E=b.filter(f).sort((v,C)=>v.index-C.index);return E.length>0?E[E.length-1].index+1:0}function g(b,E=getState()){return a(b,E).transaction.isDirty}function p(b=(0,n.Gu)()){return b.templating?.lastKey}
1544function c(b=(0,n.Gu)()){if(!b.templating?.lastKey)throw new Error("Accessing lastKey without initializing it variables");return b.templating.lastKey}function y(b,E=(0,n.Gu)()){const v=p(E);return v?m(b,v,E):[]}function P(b=(0,n.Gu)()){const E=p(b);return E?l(E,b):[]}function d(b,E=(0,n.Gu)()){const v=p(E);if(v)return s({id:b,rootStateKey:v,type:"query"},E,!1)}function D(b,E){return b[E]}},88681:(ee,B,e)=>{"use strict";e.d(B,{Hr:()=>x,Pu:()=>E,QP:()=>p,QV:()=>g,Te:()=>v,a7:()=>b,dE:()=>P,hj:()=>c,l_:()=>d,qi:()=>i,ut:()=>y,wB:()=>D});var t=e(65307),n=e(2543),r=e.n(n),o=e(28105),s=e(54742),m=e(17752),a=e(67933),l=e(99305),f=e(93612),h=e(96120);const u=(0,t.Z0)({name:"templating/shared",initialState:h.j,reducers:{addVariable:(C,S)=>{const O=S.payload.id??S.payload.data.model.name,I=s.B.get(S.payload.type),R=(0,n.cloneDeep)(I.initialState),T=I.beforeAdding?I.beforeAdding(S.payload.data.model):(0,n.cloneDeep)(S.payload.data.model),L={...(0,n.defaults)({},T,R),id:O,index:S.payload.data.index,global:S.payload.data.global};C[O]=L},variableStateNotStarted:(C,S)=>{const O=(0,f.Fs)(C,S.payload.id);O.state=o.Gu.NotStarted,O.error=null},variableStateFetching:(C,S)=>{const O=(0,f.Fs)(C,S.payload.id);O.state=o.Gu.Loading,O.error=null},variableStateCompleted:(C,S)=>{const O=(0,f.Fs)(C,S.payload.id);O&&(O.state=o.Gu.Done,O.error=null)},variableStateFailed:(C,S)=>{const O=(0,f.Fs)(C,S.payload.id);O&&(O.state=o.Gu.Error,O.error=S.payload.data.error)},removeVariable:(C,S)=>{if(delete C[S.payload.id],!S.payload.data.reIndex)return;const O=Object.values(C).sort((I,R)=>I.index-R.index);for(let I=0;I<O.length;I++)O[I].index=I},duplicateVariable:(C,S)=>{function O(w){return w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const I=(0,n.cloneDeep)(C[S.payload.id]),R=new RegExp(`^copy_of_${O(I.name)}(_(\\d+))?$`),T=Object.values(C).map(({name:w})=>w.match(R)).filter(w=>w!=null),L=T.map(w=>w[2]).filter(w=>w!=null),K=T.length===0?null:L.length===0?1:L.map(w=>+w).sort((w,j)=>j-w)[0]+1,A=`copy_of_${I.name}${K?`_${K}`:""}`,W=S.payload.data?.newId??A,N=(0,f.wk)(Object.values(C));C[W]={...(0,n.cloneDeep)(s.B.get(S.payload.type).initialState),...I,id:W,name:A,index:N}},changeVariableOrder:(C,S)=>{const{toIndex:O,fromIndex:I}=S.payload.data,R=Object.values(C);for(let T=0;T<R.length;T++){const L=R[T];L.index===I?L.index=O:L.index>I&&L.index<=O?L.index--:L.index<I&&L.index>=O&&L.index++}},changeVariableType:(C,S)=>{const{id:O}=S.payload,{label:I,name:R,index:T,description:L,rootStateKey:K}=C[O];C[O]={...(0,n.cloneDeep)(s.B.get(S.payload.data.newType).initialState),id:O,rootStateKey:K,label:I,name:R,index:T,description:L}},setCurrentVariableValue:(C,S)=>{if(!S.payload.data.option)return;const O=(0,f.Fs)(C,S.payload.id);if(!(0,a.SP)(O))return;const{option:I}=S.payload.data,R={...I,text:(0,l.QT)(I?.text),value:(0,l.QT)(I?.value)};O.current=R,O.options=O.options.map(T=>{T.value=(0,l.QT)(T.value),T.text=(0,l.QT)(T.text);let L=!1;if(Array.isArray(R.value))for(let K=0;K<R.value.length;K++){const A=R.value[K];if(T.value===A){L=!0;break}}else T.value===R.value&&(L=!0);return T.selected=L,T})},changeVariableProp:(C,S)=>{const O=(0,f.Fs)(C,S.payload.id);O[S.payload.data.propName]=S.payload.data.propValue}},extraReducers:C=>C.addCase(m.FN,(S,O)=>{const I=(0,f.Fs)(S,O.payload.id);I.name=O.payload.data.newName})}),i=u.reducer,{removeVariable:x,addVariable:g,changeVariableProp:p,changeVariableOrder:c,duplicateVariable:y,setCurrentVariableValue:P,changeVariableType:d,variableStateNotStarted:D,variableStateFetching:b,variableStateCompleted:E,variableStateFailed:v}=u.actions},74276:(ee,B,e)=>{"use strict";e.d(B,{$O:()=>f,Dd:()=>h,i3:()=>o,kH:()=>a,pu:()=>l});var t=e(65307),n=e(88813),r=e(88681);const o={uid:null,status:n.x8.NotStarted,isDirty:!1},s=(0,t.Z0)({name:"templating/transaction",initialState:o,reducers:{variablesInitTransaction:(u,i)=>{u.uid=i.payload.uid,u.status=n.x8.Fetching},variablesCompleteTransaction:(u,i)=>{u.uid===i.payload.uid&&(u.status=n.x8.Completed)},variablesClearTransaction:(u,i)=>{u.uid=null,u.status=n.x8.NotStarted,u.isDirty=!1}},extraReducers:u=>u.addMatcher(m,(i,x)=>{i.status===n.x8.Completed&&(i.isDirty=!0)})});function m(u){return r.Hr.match(u)||r.QV.match(u)||r.QP.match(u)||r.hj.match(u)||r.ut.match(u)||r.l_.match(u)}const{variablesInitTransaction:a,variablesClearTransaction:l,variablesCompleteTransaction:f}=s.actions,h=s.reducer},96120:(ee,B,e)=>{"use strict";e.d(B,{j:()=>t});const t={}},77839:(ee,B,e)=>{"use strict";e.d(B,{Y:()=>m,v:()=>s});var t=e(65307),n=e(54742),r=e(88681),o=e(96120);const s=(0,t.VP)("templating/cleanVariables"),m=(a=o.j,l)=>{if(s.match(l)){const f=Object.values(a).filter(u=>u.global);return f?f.reduce((u,i)=>(u[i.id]=i,u),{}):o.j}return l?.payload?.type&&n.B.getIfExists(l?.payload?.type)?n.B.get(l.payload.type).reducer((0,r.qi)(a,l),l):a}},88813:(ee,B,e)=>{"use strict";e.d(B,{BS:()=>l,Vg:()=>m,eF:()=>f,og:()=>a,x8:()=>s});var t=e(7389),n=e(28105),r=e(68388),o=e(8921),s=(h=>(h.NotStarted="Not started",h.Fetching="Fetching",h.Completed="Completed",h))(s||{});const m={id:o.qF,rootStateKey:null,name:"",type:"query",global:!1,index:-1,hide:t.zL.dontHide,ski
1544pUrlSync:!1,state:n.Gu.NotStarted,error:null,description:null};class a extends r.x{static{this.type="variables-changed"}}class l extends r.x{static{this.type="variables-time-range-process-done"}}class f extends r.x{static{this.type="variables-changed-in-url"}}},99305:(ee,B,e)=>{"use strict";e.d(B,{AX:()=>D,Lz:()=>c,ML:()=>g,Nz:()=>p,QT:()=>v,SY:()=>u,Wz:()=>E,iP:()=>P,jX:()=>O,q$:()=>d,q4:()=>S,qD:()=>I,sN:()=>C,t4:()=>i,u7:()=>y,wJ:()=>x});var t=e(2543),n=e.n(t),r=e(7389),o=e(2863),s=e(62635),m=e(8535),a=e(54742),l=e(8921),f=e(93612),h=e(88813);const u=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g,i=T=>(u.lastIndex=0,u.exec(T));function x(...T){const L=T[T.length-1];T[0]=typeof T[0]=="string"?T[0]:(0,s.MA)(T[0]);const A=T.slice(0,-1).join(" ").match(u);return!!(A!==null?A.find(N=>{const w=i(N);return w!==null&&w.indexOf(L)>-1}):!1)}const g=T=>{if(!T||!T.current)return!1;if(T.current.value){const L=Array.isArray(T.current.value);if(L&&T.current.value.length&&T.current.value[0]===l.To||!L&&T.current.value===l.To)return!0}if(T.current.text){const L=Array.isArray(T.current.text);if(L&&T.current.text.length&&T.current.text[0]===l.Zm||!L&&T.current.text===l.Zm)return!0}return!1},p=T=>!T||!T.current||!T.current.text?"":Array.isArray(T.current.text)?T.current.text.toString():typeof T.current.text!="string"?"":T.current.text,c=T=>!T||!T.current||T.current.value===void 0||T.current.value===null?null:Array.isArray(T.current.value)?T.current.value.toString():typeof T.current.value!="string"?null:T.current.value;function y(T,L=(0,o.w)()){return!T||!T.regex?"":L.replace(T.regex,{},"regex")}function P(T,L,K,A){const W={range:void 0,variable:T,searchFilter:L,scopedVars:A};return(T.refresh===r.CO.onTimeRangeChanged||T.refresh===r.CO.onDashboardLoad)&&(W.range=K.timeRange()),W}function d(T){return T?.type==="custom"?r.CO.onDashboardLoad:!T||!("refresh"in T)||T.refresh!==r.CO.onTimeRangeChanged&&T.refresh!==r.CO.onDashboardLoad?r.CO.never:T.refresh}function D(){return a.B.list().filter(T=>T.id!=="system").map(({id:T,name:L,description:K})=>({label:L,value:T,description:K}))}function b(T){return(0,t.isArray)(T)&&(T.length===0?T=void 0:T.length===1&&(T=T[0])),T}function E(T,L){let K=0;const A={};for(const W in T){if(!W.startsWith(l.qz))continue;let N=b(L[W]),w=b(T[W]);(0,t.isEqual)(w,N)||(A[W]={value:T[W]},K++)}for(const W in L){if(!W.startsWith(l.qz))continue;const N=L[W];(0,t.isArray)(N)&&N.length===0||T.hasOwnProperty(W)||(A[W]={value:"",removed:!0},K++)}return K?A:void 0}function v(T){return Array.isArray(T)?T.map(String):T==null?"":typeof T=="number"?T.toString(10):typeof T=="string"?T:typeof T=="boolean"?T.toString():""}function C(T,L=(0,m.Gu)()){return(0,f.nx)(T,L).transaction.status!==h.x8.NotStarted}function S(T){return String(T)}const O=T=>{if(!T.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${T.id}`);return{type:T.type,id:T.id,rootStateKey:T.rootStateKey}};function I(T,L){return{type:T.type,id:T.id,data:L}}function R(){const T=getTemplateSrv().getVariables(),L=locationService.getSearchObject();return Object.keys(L).filter(K=>K.indexOf(VARIABLE_PREFIX)!==-1&&T.some(A=>A.name===K.replace(VARIABLE_PREFIX,""))).reduce((K,A)=>{const W=A.replace(VARIABLE_PREFIX,"");return K[W]=L[A],K},{})}},45216:(ee,B,e)=>{"use strict";var t=e(48307),n=e(9423),r=e(7452),o=e(78624),s=e(4213),m=e(34796),a=e(96540),l=e(5338),f=e(25229),h=e(60188),u=e(53543),i=e(8642),x=e(54734),g=e(92138),p=e(68143),c=e(47700),y=e(48072),P=e(36490),d=e(25076),D=e(43122),b=e(6201),E=e(75234),v=e(83734),C=e(39698),S=e(78282),O=e(46907),I=e(33005),R=e(33604),T=e(33707),L=e(41071),K=e(92293),A=e(78646),W=e(60311),N=e(88806),w=e(14477),j=e(58873),V=e(2874),U=e(65642),F=e(43173),M=e(74848),H=e(2543),_=e(95004),Z=e(36638),ne=e(57866),te=e(16515),Y=e(64761),Q=e(96702),J=e(68779),q=e(18027),X=e(77824),se=e(31286),oe=e(45861),ae=e(56840),ie=e(84510);function fe(z){if(z in ie.uk){const{name:G,getHelperDocs:k,links:re}=ie.uk[z],ue=k(ie.g_.UIImage),ve=pe(ue);if(re?.length){const be=re.map(Ue=>` 1545 Or visit <a href="${Ue.url}" target="_blank">${Ue.title}</a> 1546 1547 `).join("");return{name:G,helperDocs:` 1548 ${ve} 1549 ${(0,ie.$n)()} 1550 ${be} 1551 `}}return{name:G,helperDocs:` 1552 ${ve} 1553 ${(0,ie.$n)()} 1554 `}}return{name:"No documentation found",helperDocs:(0,ie.$n)()}}const pe=z=>z.replace(/\[(.*?)\]\(#.*?\)/g,"$1").replace(/\[[^\]]*\]\[\]/g,"");var de=e(97095),le=e(18857),me=e(42954),De=e(17200),Te=e(72598);function Ne(z){return function({options:k,onChange:re}){const{validator:ue}=z,{value:ve}=k,[be,Ue]=(0,a.useState)(!ue(ve)),We=(0,a.useCallback)(Ze=>{Ue(!ue(Ze)),re({...k,value:Ze})},[Ue,ue,re,k]);return(0,M.jsx)(De.y,{invalid:be,value:ve,error:"Value needs to be a number or a variable",onCh
1554ange:We,placeholder:(0,ae.t)("transformers.basic-matcher-editor.placeholder-value-or-variable","Value or variable"),suggestions:(0,Te.I9)()})}}const Ce=()=>[{name:"Is greater",id:ne.Js.greater,component:Ne({validator:Te.N_})},{name:"Is greater or equal",id:ne.Js.greaterOrEqual,component:Ne({validator:Te.N_})},{name:"Is lower",id:ne.Js.lower,component:Ne({validator:Te.N_})},{name:"Is lower or equal",id:ne.Js.lowerOrEqual,component:Ne({validator:Te.N_})},{name:"Is equal",id:ne.Js.equal,component:Ne({validator:()=>!0})},{name:"Is not equal",id:ne.Js.notEqual,component:Ne({validator:()=>!0})},{name:"Is Substring",id:ne.Js.substring,component:Ne({validator:()=>!0})},{name:"Is not substring",id:ne.Js.notSubstring,component:Ne({validator:()=>!0})}],He=z=>null,ke=()=>[{name:"Is null",id:ne.Js.isNull,component:He},{name:"Is not null",id:ne.Js.isNotNull,component:He}];var Me=e(79233);function $e(z){return function({options:k,onChange:re}){const{validator:ue}=z,[ve,be]=(0,a.useState)({from:!ue(k.from),to:!ue(k.to)}),Ue=(0,a.useCallback)((Ze,at)=>{const ct=!ue(Ze);be({...ve,[at]:ct}),!ct&&re({...k,[at]:Ze})},[k,re,ve,be,ue]),We=(0,Te.I9)();return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(De.y,{value:String(k.from),invalid:ve.from,error:"Value needs to be a number or a variable",placeholder:(0,ae.t)("transformers.range-matcher-editor.placeholder-from","From"),onChange:Ze=>Ue(Ze,"from"),suggestions:We}),(0,M.jsx)(Me.c,{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.range-matcher-editor.and",children:"and"})}),(0,M.jsx)(De.y,{invalid:ve.to,error:"Value needs to be a number or a variable",value:String(k.to),placeholder:(0,ae.t)("transformers.range-matcher-editor.placeholder-to","To"),suggestions:We,onChange:Ze=>Ue(Ze,"to")})]})}}const tt=()=>[{name:"Is between",id:ne.Js.between,component:$e({validator:Te.N_})}];function Ke(z){return function({options:k,onChange:re}){const{validator:ue}=z,{value:ve}=k,[be,Ue]=(0,a.useState)(!ue(ve)),We=(0,a.useCallback)(Ze=>{Ue(!ue(Ze)),re({...k,value:Ze})},[Ue,ue,re,k]);return(0,M.jsx)(De.y,{invalid:be,value:ve,onChange:We,placeholder:(0,ae.t)("transformers.regex-matcher-editor.placeholder-value-or-variable","Value or variable"),suggestions:(0,Te.I9)()})}}const Re=()=>[{name:"Regex",id:ne.Js.regex,component:Ke({validator:()=>!0})}],Ve=new me.O(()=>[...Ce(),...ke(),...tt(),...Re()]),Qe=z=>{const{onDelete:G,onChange:k,filter:re,fieldsInfo:ue}=z,{fieldsAsOptions:ve,fieldByDisplayName:be}=ue,Ue=Ye(re,ve)??"",We=be[Ue],Ze=We?je(We):[],at=ze(re,Ze),ct=Ve.getIfExists(at),gt=(0,a.useCallback)(vt=>{vt?.value&&k({...re,fieldName:vt.value})},[k,re]),pt=(0,a.useCallback)(vt=>{if(!vt?.value)return;const Ft=vt.value,sn=Z.hI.get(Ft).getDefaultOptions(We);k({...re,config:{id:Ft,options:sn}})},[k,re,We]),ht=(0,a.useCallback)(vt=>{k({...re,config:{...re.config,options:vt}})},[k,re]);return!We||!ct||!ct.component?null:(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-value-filter-editor.label-field","Field"),labelWidth:14,children:(0,M.jsx)(le.l6,{className:"min-width-15 max-width-24",placeholder:(0,ae.t)("transformers.filter-by-value-filter-editor.placeholder-field-name","Field name"),options:ve,value:re.fieldName,onChange:gt})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-value-filter-editor.label-match","Match"),children:(0,M.jsx)(le.l6,{className:"width-12",placeholder:(0,ae.t)("transformers.filter-by-value-filter-editor.placeholder-select-test","Select test"),options:Ze,value:at,onChange:pt})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-value-filter-editor.label-value","Value"),grow:!0,children:(0,M.jsx)(ct.component,{field:We,options:re.config.options??{},onChange:ht})}),(0,M.jsx)(se.a,{marginBottom:.5,children:(0,M.jsx)(oe.$n,{icon:"times",onClick:G,variant:"secondary"})})]})},je=z=>{const G=[];for(const k of Z.hI.list())!k.isApplicable(z)||!Ve.getIfExists(k.id)||G.push({value:k.id,label:k.name,description:k.description});return G},ze=(z,G)=>{const k=G.find(re=>re.value===z.config.id);if(k&&k.value)return k.value;if(G[0]?.value)return G[0]?.value},Ye=(z,G)=>{const k=G.find(re=>re.value===z.fieldName);if(k&&k.value)return k.value;if(G[0]?.value)return G[0]?.value},Ge=[{label:"Include",value:J.j4.include},{label:"Exclude",value:J.j4.exclude}],ce=[{label:"Match all",value:J.Sm.all},{label:"Match any",value:J.Sm.any}],Pe=z=>{const{input:G,options:k,onChange:re}=z,ue=Ee(G),ve=(0,a.useCallback)(()=>{const at=G[0],ct=at.fields.find(ht=>ht.type!==_.PU.time);if(!ct)return;const gt=(0,H.cloneDeep)(k.filters),pt=Z.hI.get(ne.Js.isNull);gt.push({fieldName:(0,te.Ct)(ct,at,G),config:{id:pt.id,options:pt.getDefaultOptions(ct)}}),re({...k,filters:gt})},[re,k,G]),be=(0,a.useCallback)(at=>{let ct=(0,H.cloneDeep)(k.filters);ct.splice(at,1),re({...k,filters:ct})},[k,re]),Ue=(0,a.useCallback)((at,ct)=>{let gt=(0,H.cloneDeep)(k.filters);gt[ct]=at,re({...k,filters:gt})},[k,re]),We=(0,a.useCallback)(at=>{re({...k,type:at??J.j4.include})},[k,re]),Ze=(0,a.useCallback)(at=>{re({...k,match:at??J.Sm.all})},[k,re]);return(0,M.jsxs)("div",{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-value-transformer-editor.label-filter-type","Filter type"),labelWidth:16,children:(0,M.jsx)("div",{className:"width-15",children:(0,M.jsx)(X.z,{options:Ge,value:k.type,onCh
1554ange:We,fullWidth:!0})})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-value-transformer-editor.label-conditions","Conditions"),labelWidth:16,children:(0,M.jsx)("div",{className:"width-15",children:(0,M.jsx)(X.z,{options:ce,value:k.match,onChange:Ze,fullWidth:!0})})}),(0,M.jsxs)(se.a,{paddingLeft:2,children:[k.filters.map((at,ct)=>(0,M.jsx)(Qe,{filter:at,fieldsInfo:ue,onChange:gt=>Ue(gt,ct),onDelete:()=>be(ct)},ct)),(0,M.jsx)(oe.$n,{icon:"plus",size:"sm",onClick:ve,variant:"secondary",children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.filter-by-value-transformer-editor.add-condition",children:"Add condition"})})]})]})},Se={id:Y.F.filterByValue,editor:Pe,transformation:Q.c.filterByValueTransformer,name:Q.c.filterByValueTransformer.name,description:"Removes rows of the query results using user-defined filters. This is useful if you can not filter your data in the data source.",categories:new Set([i.m.Filter]),help:fe(Y.F.filterByValue).helperDocs},Ee=z=>(0,a.useMemo)(()=>{const G={fieldsAsOptions:[],fieldByDisplayName:{}};return Array.isArray(z)?z.reduce((k,re)=>re.fields.reduce((ue,ve)=>{const be=(0,te.Ct)(ve,re,z);return ue.fieldByDisplayName[be]||(ue.fieldsAsOptions.push({label:be,value:be,type:ve.type}),ue.fieldByDisplayName[be]=ve),ue},k),G):G},[z]);var xe=e(11594),ye=e(52205),Oe=e(25797),we=e(56424),Be=e(61215);function Xe(z,G){const k={data:z.input,options:z.options},re=new Oe.C({id:"root",title:"root"}),ue=be=>{if(be?.length){const Ue=be[0];let We=re.categories.find(Ze=>Ze.props.id===Ue);return We||(We=new Oe.C({id:Ue,title:Ue}),re.categories.push(We)),We}return re},ve={getValue:be=>(0,H.get)(z.options,be),onChange:(be,Ue)=>{z.onChange((0,Be.Sf)(z.options,be,Ue))}};return(0,we.g5)(G,ve,ue,k),re}function st(z){const G={data:[],options:{}},k={},re=new ye.pv;z(re,G);for(const ue of re.getItems())ue.defaultValue!=null&&(0,H.set)(k,ue.path,ue.defaultValue);return k}var lt=e(13572),Et=e(48264);const Tt=(z,G)=>{const k=G.options??{};(0,lt.J)("",z,k)},Mt=z=>{(0,a.useEffect)(()=>{if(!z.options.xBuckets?.mode){const k=st(Tt);z.onChange({...k,...z.options})}});const G=Xe(z,Tt);return(0,M.jsx)("div",{children:(0,M.jsx)("div",{children:G.items.map(k=>k.render())})})},wt={id:Et.wY.id,editor:Mt,transformation:Et.wY,name:Et.wY.name,description:Et.wY.description,state:xe.pn.alpha,categories:new Set([i.m.CreateNewVisualization]),help:fe(Et.wY.id).helperDocs};var _e=e(22803),xt=e(63142),At=e(63152),bt=e(46644),Xt=e(34107),
1554Cn=e(64394),vn=e(13227),Wn=e(33553),Dt=e(18600);function qt(z,G,k){const re={},ue={};for(const ve of z.fields){const be=(0,te.Ct)(ve,z),Ue=k.index[be],We=Ue.handler;if(!We)continue;const Ze=ve.values[G];if(Ze==null)continue;const at=We.processor(Ze,re,ue,Ue.handlerArguments);at!=null&&(re[We.targetProperty??We.key]=at)}return ue.mappingValues&&(re.mappings=Zt(ue)),re}var Yt=(z=>(z.Name="field.name",z.Value="field.value",z.Label="field.label",z.Ignore="__ignore",z))(Yt||{});const nn=[{key:"field.name",name:"Field name",processor:()=>{}},{key:"field.value",name:"Field value",processor:()=>{}},{key:"field.label",name:"Field label",processor:()=>{}},{key:"__ignore",name:"Ignore",processor:()=>{}},{key:"max",processor:Rt},{key:"min",processor:Rt},{key:"unit",processor:z=>z.toString()},{key:"decimals",processor:Rt},{key:"displayName",name:"Display name",processor:z=>z.toString()},{key:"color",processor:z=>({fixedColor:z,mode:Cn.Y.Fixed})},{key:"threshold1",name:"Threshold",targetProperty:"thresholds",processor:(z,G,k,re)=>{const ue=(0,vn.t)(z);if(!isNaN(ue))return G.thresholds||(G.thresholds={mode:Wn.O.Absolute,steps:[]}),G.thresholds.steps.push({value:ue,color:re.threshold?.color??"red"}),G.thresholds}},{key:"mappings.value",name:"Value mappings / Value",targetProperty:"mappings",defaultReducer:bt.gy.allValues,processor:(z,G,k)=>{if((0,H.isArray)(z))return k.mappingValues=z,G.mappings}},{key:"mappings.color",name:"Value mappings / Color",targetProperty:"mappings",defaultReducer:bt.gy.allValues,processor:(z,G,k)=>{if((0,H.isArray)(z))return k.mappingColors=z,G.mappings}},{key:"mappings.text",name:"Value mappings / Display text",targetProperty:"mappings",defaultReducer:bt.gy.allValues,processor:(z,G,k)=>{if((0,H.isArray)(z))return k.mappingTexts=z,G.mappings}}];function Zt(z){const G={type:Dt.d.ValueToText,options:{}};if(!z.mappingValues)return[];for(let k=0;k<z.mappingValues.length;k++){const re=z.mappingValues[k];re!=null&&(G.options[re.toString()]={color:z.mappingColors&&z.mappingColors[k],text:z.mappingTexts&&z.mappingTexts[k],index:k})}return[G]}let tn=null;function ft(){if(tn===null){tn={};for(const z of nn)tn[z.key]=z}return tn}function Rt(z){const G=(0,vn.t)(z);if(!isNaN(G))return G}function Bt(z,G){for(const k of G)if(z===k.fieldName)return k.handlerKey;return z.toLowerCase()}function jt(z){return z?ft()[z]:null}function Nt(z,G,k){const re={index:{}};let ue=G.find(be=>be.handlerKey==="field.name"),ve=G.find(be=>be.handlerKey==="field.value");for(const be of z.fields){const Ue=(0,te.Ct)(be,z),We=G.find(ct=>ct.fieldName===Ue),Ze=We?We.handlerKey:Ue.toLowerCase();let at=jt(Ze);k&&(at?(at.key==="field.name"&&(re.nameField=be),at.key==="field.value"&&(re.valueField=be)):We||(!re.nameField&&!ue&&be.type===_.PU.string&&(re.nameField=be,at=jt("field.name")),!re.valueField&&!ve&&be.type===_.PU.number&&(re.valueField=be,at=jt("field.value")))),!at&&k&&(at=jt("field.label")),re.index[Ue]={automatic:!We,handler:at,handlerArguments:We?.handlerArguments??{},reducerId:We?.reducerId??at?.defaultReducer??bt.gy.lastNotNull}}return re}var $t=e(63527),an=e(35427);function Jt(z){switch(z){case"threshold1":return!0;default:return!1}}function gn({handlerArguments:z,handlerKey:G,onChange:k}){const re=ue=>{k(ue?{...z,threshold:{...z.threshold,color:ue}}:{...z,threshold:void 0})};return(0,M.jsx)(M.Fragment,{children:G==="threshold1"&&(0,M.jsx)($t.p,{type:"text",value:"Threshold color","aria-label":(0,ae.t)("transformers.field-config-mapping-handler-arguments-editor.aria-label-threshold-color","Threshold color"),disabled:!0,width:20,prefix:(0,M.jsx)(an.sk,{color:z.threshold?.color??"red",onChange:re,enableNamedColors:!0})})})}function mn({frame:z,mappings:G,onChange:k,withReducers:re,withNameAndValue:ue}){const ve=(0,xt.of)(Nn),be=_t(z,G,ue),Ue=nn.map(gt=>On(gt,!1)),We=G.reduce((gt,pt)=>gt||Jt(pt.handlerKey),!1),Ze=(gt,pt)=>{const ht=G.findIndex(vt=>vt.fieldName===gt.fieldName);if(pt)if(ht!==-1){const vt=[...G];vt.splice(ht,1,{...G[ht],handlerKey:pt.value}),k(vt)}else k([...G,{fieldName:gt.fieldName,handlerKey:pt.value}]);else k(ht!==-1?G.filter((vt,Ft)=>Ft!==ht):[...G,{fieldName:gt.fieldName,handlerKey:"__ignore"}])},at=(gt,pt)=>{const ht=G.findIndex(vt=>vt.fieldName===gt.fieldName);if(ht!==-1){const vt=[...G];vt.splice(ht,1,{...G[ht],reducerId:pt}),k(vt)}else k([...G,{fieldName:gt.fieldName,handlerKey:gt.handlerKey,reducerId:pt}])},ct=(gt,pt)=>{const ht=G.findIndex(vt=>vt.fieldName===gt.fieldName);if(ht!==-1){const vt=[...G];vt.splice(ht,1,{...G[ht],handlerArguments:pt}),k(vt)}else k([...G,{fieldName:gt.fieldName,handlerKey:gt.handlerKey,handlerArguments:pt}])};return(0,M.jsxs)("table",{className:ve.table,children:[(0,M.jsx)("thead",{children:(0,M.jsxs)("tr",{children:[(0,M.jsx)("th",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.field-to-config-mapping-editor.field",children:"Field"})}),(0,M.jsx)("th",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.field-to-config-mapping-editor.use-as",children:"Use as"})}),re&&(0,M.jsx)("th",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.field-to-config-mapping-editor.select",children:"Select"})}),We&&(0,M.jsx)("th",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.field-to-config-mapping-editor.additional-settings",children:"Additional settings"})})]})}),(0,M.jsx)("tbody",{children:be.map(gt=>(0,M.jsxs)("tr",{children:[(0,M.jsx)("td",{className:ve.labelCell,children:gt.fieldName}),(0,M.jsx)("td",{className:ve.selectCell,"data-testid":`${gt.fieldName}-config-key`,children:(0,M.jsx)(le.l6,{options:Ue,value:gt.configOption,placeholder:gt.placeholder,isClearable:!0,onChange:pt=>Ze(gt,pt)})}),re&&(0,M.jsx)("td",{"data-testid":`${gt.fieldName}-reducer`,className:ve.selectCell,children:(0,M.jsx)(Xt.S,{stats:[gt.reducerId],defaultStat:gt.reducerId,onChange:pt=>at(gt,pt[0])})}),We&&(0,M.jsx)("td",{"data-testid":`${gt.fieldName}-handler-arg`,className:ve.selectCell,children:(0,M.jsx)(gn,{handlerKey:gt.handlerKey,handlerArguments:gt.handlerArguments,onChange:pt=>ct(gt,pt)})})]},gt.fieldName))})]})}function _t(z,G,k){const re=[],ue=Nt(z,G??[],k);for(const ve of z.fields){const be=(0,te.Ct)(ve,z),Ue=ue.index[be],We=On(Ue.handler,Ue.automatic);re.push({fieldName:be,configOption:Ue.automatic?null:We,placeholder:Ue.automatic?We?.label:"Cho
1554ose",handlerKey:Ue.handler?.key??null,reducerId:Ue.reducerId,handlerArguments:Ue.handlerArguments})}for(const ve of G)if(!re.find(be=>be.fieldName===ve.fieldName)){const be=jt(ve.handlerKey);re.push({fieldName:ve.fieldName,handlerKey:ve.handlerKey,configOption:On(be,!1),missingInFrame:!0,reducerId:ve.reducerId??bt.gy.lastNotNull,handlerArguments:{}})}return Object.values(re)}function On(z,G){if(!z)return null;let k=z.name??(0,H.capitalize)(z.key);return G&&(k=`${k} (auto)`),{label:k,value:z.key}}const Nn=z=>({table:(0,_e.css)({marginTop:z.spacing(1),"td, th":{borderRight:`4px solid ${z.colors.background.primary}`,borderBottom:`4px solid ${z.colors.background.primary}`,whiteSpace:"nowrap"},th:{fontSize:z.typography.bodySmall.fontSize,lineHeight:z.spacing(4),padding:z.spacing(0,1)}}),labelCell:(0,_e.css)({fontSize:z.typography.bodySmall.fontSize,background:z.colors.background.secondary,padding:z.spacing(0,1),maxWidth:"400px",overflow:"hidden",textOverflow:"ellipsis",minWidth:"140px"}),selectCell:(0,_e.css)({padding:0,minWidth:"161px"})});var Fn=e(81160);function na(z,G){let k=null;for(const Ue of G)if(Ue.refId===z.configRefId){k=Ue;break}if(!k)return G;const re={fields:[],length:1},ue=Nt(k,z.mappings??[],!1);for(const Ue of k.fields){const We={...Ue},Ze=(0,te.Ct)(Ue,k),at=ue.index[Ze],ct=(0,bt.Nw)({field:Ue,reducers:[at.reducerId]});We.values=[ct[at.reducerId]],re.fields.push(We)}const ve=[],be=(0,Z.NS)(z.applyTo||{id:ne.Ct.numeric});for(const Ue of G){if(Ue===k&&G.length>1)continue;const We={fields:[],length:Ue.length,refId:Ue.refId};for(const Ze of Ue.fields)if(be(Ze,Ue,G)){const at=qt(re,0,ue);We.fields.push({...Ze,config:{...Ze.config,...at}})}else We.fields.push(Ze);ve.push(We)}return ve}const aa={id:Y.F.configFromData,name:"Config from query results",description:"Set unit, min, max and more from data.",defaultOptions:{configRefId:"config",mappings:[]},operator:z=>G=>G.pipe((0,Fn.T)(k=>na(z,k)))};function yt({input:z,onChange:G,options:k}){const re=(0,xt.of)(Ot),ue=z.map(pt=>pt.refId).filter(pt=>pt!=null).map(pt=>({label:pt,value:pt})),ve=k.configRefId||"config",be=k.applyTo??{id:ne.Ct.byType,options:"number"},Ue=At.g.get(be.id),We=z.find(pt=>pt.refId===ve),Ze=pt=>{G({...k,configRefId:pt.value||"config"})},at=pt=>{G({...k,applyTo:{id:pt.value}})},ct=pt=>{G({...k,applyTo:{id:be.id,options:pt}})},gt=At.g.list().filter(pt=>!pt.excludeFromPicker).map(pt=>({label:pt.name,value:pt.id,description:pt.description}));return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.config-from-query-transformer-editor.label-config-query","Config query"),labelWidth:20,children:(0,M.jsx)(le.l6,{onChange:Ze,options:ue,value:ve,width:30})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.config-from-query-transformer-editor.label-apply-to","Apply to"),labelWidth:20,children:(0,M.jsx)(le.l6,{onChange:at,options:gt,value:be.id,width:30})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.config-from-query-transformer-editor.label-apply-to-options","Apply to options"),labelWidth:20,className:re.matcherOptions,children:(0,M.jsx)(Ue.component,{matcher:Ue.matcher,data:z,options:be.options,onChange:ct})})}),(0,M.jsx)(de.C,{children:We&&(0,M.jsx)(mn,{frame:We,mappings:k.mappings,onChange:pt=>G({...k,mappings:pt}),withReducers:!0})})]})}const mt={id:aa.id,editor:yt,transformation:aa,name:aa.name,description:aa.description,state:xe.pn.beta,categories:new Set([i.m.CalculateNewFields]),help:fe(aa.id).helperDocs},Ot=z=>({matcherOptions:(0,_e.css)({minWidth:"404px"})});var Wt=e(62467),et=e(84691),Je=e(2863),rt=e(21285),it=e(12823),Pt=e(97958);const It=17,Vt=z=>{const{options:G,onChange:k}=z,re=(0,et.pR)(z.options.binary?.left??"",z.names),ue=(0,et.pR)(z.options.binary?.right??"",z.names);(re!==z.options.binary?.left||ue!==z.options.binary?.right)&&k({...G,mode:et.UY.BinaryOperation,binary:{operator:G.binary?.operator,left:re,right:ue}});const{binary:ve}=G;let be=!ve?.left,Ue=!ve?.right;const We=!ve?.left?.matcher,Ze=!ve?.right?.matcher,at=ve?.left?.matcher?.options,ct=ve?.right?.matcher?.options,gt=ve?.left?.matcher?.id===ne.Ct.byName,pt=ve?.right?.matcher?.id===ne.Ct.byName,ht=z.names.map(fa=>(gt&&fa===at&&(be=!0),pt&&fa===ct&&(Ue=!0),{label:fa,value:JSON.stringify({matcher:{id:ne.Ct.byName,options:fa}})})),vt=be?[...ht]:gt?[...ht,{label:at,value:JSON.stringify(ve.left),icon:""}]:[...ht],Ft=Ue?[...ht]:pt?[...ht,{label:ct,value:JSON.stringify(ve.right),icon:""}]:[...ht];
1554vt.push({label:`All ${_.PU.number} fields`,value:JSON.stringify({matcher:{id:ne.Ct.byType,options:_.PU.number}}),icon:(0,Pt.lV)(_.PU.number)}),We&&ve?.left?.fixed&&vt.push({label:ve.left.fixed,value:JSON.stringify(ve.left)??"",icon:""}),Ze&&ve?.right?.fixed&&Ft.push({label:ve.right.fixed,value:JSON.stringify(ve.right)??"",icon:""});const sn=it.b.list().map(fa=>({label:fa.binaryOperationID,value:fa.binaryOperationID})),fn=fa=>{k({...G,mode:et.UY.BinaryOperation,binary:fa})},In=fa=>{const Es=JSON.parse(fa.value??"");Es.matcher?fn({...ve,left:Es}):fn({...ve,left:{fixed:Es.fixed??fa.value?.toString()}})},Dn=fa=>{const Es=JSON.parse(fa.value??"");Es.matcher?fn({...ve,right:Es}):fn({...ve,right:{fixed:Es.fixed??fa.value?.toString()}})},ua=fa=>{fn({...ve,operator:fa.value})};return(0,M.jsx)(M.Fragment,{children:(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.binary-operation-options-editor.label-operation","Operation"),labelWidth:It,children:(0,M.jsx)(le.l6,{allowCustomValue:!0,placeholder:(0,ae.t)("transformers.binary-operation-options-editor.placeholder-fields-or-number","Field(s) or number"),options:vt,className:"min-width-18",value:JSON.stringify(ve?.left),onChange:In})}),(0,M.jsx)(q.I,{children:(0,M.jsx)(le.l6,{className:"width-4",options:sn,value:ve?.operator??sn[0].value,onChange:ua})}),(0,M.jsx)(q.I,{children:(0,M.jsx)(le.l6,{allowCustomValue:!0,placeholder:(0,ae.t)("transformers.binary-operation-options-editor.placeholder-field-or-number","Field or number"),className:"min-width-10",options:Ft,value:JSON.stringify(ve?.right),onChange:Dn})})]})})},en=z=>{const{names:G,onChange:k,options:re}=z,{cumulative:ue}=re,ve=G.map(Ze=>({label:Ze,value:Ze})),be=Ze=>{const at=Ze.length?Ze[0]:bt.gy.sum;Ue({...ue,reducer:at})},Ue=Ze=>{k({...re,mode:et.UY.CumulativeFunctions,cumulative:Ze})},We=Ze=>{Ue({...ue,field:Ze.value})};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.cumulative-options-editor.label-field","Field"),labelWidth:It,children:(0,M.jsx)(le.l6,{placeholder:(0,ae.t)("transformers.cumulative-options-editor.placeholder-field","Field"),options:ve,className:"min-width-18",value:ue?.field,onChange:We})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.cumulative-options-editor.label-calculation","Calculation"),labelWidth:It,children:(0,M.jsx)(Xt.S,{allowMultiple:!1,className:"width-18",stats:[ue?.reducer||bt.gy.sum],onChange:be,defaultStat:bt.gy.sum,filterOptions:Ze=>Ze.id===bt.gy.sum||Ze.id===bt.gy.mean})})]})},ln=z=>{const{options:G,onChange:k}=z,{index:re}=G,ue=ve=>{k({...G,index:{asPercentile:ve.currentTarget.checked}})};return(0,M.jsx)(M.Fragment,{children:(0,M.jsx)(q.I,{labelWidth:It,label:(0,ae.t)("transformers.index-options-editor.label-as-percentile","As percentile"),tooltip:(0,ae.t)("transformers.index-options-editor.tooltip-transform-index-percentile","Transform the row index as a percentile."),children:(0,M.jsx)(rt.K,{value:!!re?.asPercentile,onChange:ue})})})};var Qt=e(41654),xn=e(34343);const En=z=>{const{names:G,selected:k,onChange:re,options:ue}=z,{reduce:ve}=ue,be=at=>{re({...ue,reduce:at})},Ue=at=>{k.indexOf(at)>-1?We(k.filter(ct=>ct!==at)):We([...k,at])},We=at=>{be({...ve,include:at})},Ze=at=>{const ct=at.length?at[0]:bt.gy.sum,{reduce:gt}=ue;be({...gt,reducer:ct})};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.reduce-row-options-editor.label-operation","Operation"),labelWidth:It,shrink:!0,children:(0,M.jsx)(Qt.B,{gap:.5,direction:"row",alignItems:"flex-start",wrap:!0,children:G.map((at,ct)=>(0,M.jsx)(xn.m,{onClick:()=>{Ue(at)},label:at,selected:k.indexOf(at)>-1},`${at}/${ct}`))})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.reduce-row-options-editor.label-calculation","Calculation"),labelWidth:It,children:(0,M.jsx)(Xt.S,{allowMultiple:!1,className:"width-18",stats:[ve?.reducer||bt.gy.sum],onChange:Ze,defaultStat:bt.gy.sum})})]})};var zn=e(48233);const Gn=z=>{const{options:G,onChange:k}=z,{unary:re}=G,ue=ct=>{k({...G,mode:et.UY.UnaryOperation,unary:ct})},ve=ct=>{ue({...re,operator:ct.value})},be=ct=>{ue({...re,fieldName:ct.value})};let Ue=!re?.fieldName;const We=z.names.map(ct=>(ct===re?.fieldName&&(Ue=!0),{label:ct,value:ct})),Ze=zn.j.list().map(ct=>({label:ct.unaryOperationID,value:ct.unaryOperationID})),at=Ue?We:[...We,{label:re?.fieldName,value:re?.fieldName}];return(0,M.jsx)(M.Fragment,{children:(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.unary-operation-editor.label-operation","Operation"),labelWidth:It,children:(0,M.jsx)(le.l6,{options:Ze,value:re?.o
1554perator??Ze[0].value,onChange:ve})}),(0,M.jsx)(q.I,{label:"(",labelWidth:2,children:(0,M.jsx)(le.l6,{placeholder:(0,ae.t)("transformers.unary-operation-editor.placeholder-field","Field"),className:"min-width-11",options:at,value:re?.fieldName,onChange:be})}),(0,M.jsx)(Me.c,{width:2,children:")"})]})})};var St=e(19753);const Ht=z=>{const{options:G,names:k,onChange:re}=z,{window:ue}=G,ve=k.map(ht=>({label:ht,value:ht})),be=[{label:"Trailing",value:et.ip.Trailing},{label:"Centered",value:et.ip.Centered}],Ue=[{label:"Percentage",value:et.Bp.Percentage},{label:"Fixed",value:et.Bp.Fixed}],We=ht=>{re({...G,mode:et.UY.WindowFunctions,window:ht})},Ze=ht=>{We({...ue,field:ht.value})},at=ht=>{We({...ue,windowSize:ht&&ue?.windowSizeMode===et.Bp.Percentage?ht/100:ht})},ct=ht=>{We({...ue,windowSize:ue?.windowSize?ht===et.Bp.Percentage?ue.windowSize/100:ue.windowSize*100:void 0,windowSizeMode:ht})},gt=ht=>{const vt=ht.length?ht[0]:bt.gy.sum;We({...ue,reducer:vt})},pt=ht=>{We({...ue,windowAlignment:ht})};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.window-options-editor.label-field","Field"),labelWidth:It,children:(0,M.jsx)(le.l6,{placeholder:(0,ae.t)("transformers.window-options-editor.placeholder-field","Field"),options:ve,className:"min-width-18",value:ue?.field,onChange:Ze})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.window-options-editor.label-calculation","Calculation"),labelWidth:It,children:(0,M.jsx)(Xt.S,{allowMultiple:!1,className:"width-18",stats:[ue?.reducer||bt.gy.mean],onChange:gt,defaultStat:bt.gy.mean,filterOptions:ht=>ht.id===bt.gy.mean||ht.id===bt.gy.variance||ht.id===bt.gy.stdDev})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.window-options-editor.label-type","Type"),labelWidth:It,children:(0,M.jsx)(X.z,{value:ue?.windowAlignment??et.ip.Trailing,options:be,onChange:pt})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.window-options-editor.label-window-size-mode","Window size mode"),labelWidth:It,children:(0,M.jsx)(X.z,{value:ue?.windowSizeMode??et.Bp.Percentage,options:Ue,onChange:ct})}),(0,M.jsx)(q.I,{label:ue?.windowSizeMode===et.Bp.Percentage?"Window size %":"Window size",labelWidth:It,tooltip:ue?.windowSizeMode===et.Bp.Percentage?"Set the window size as a percentage of the total data":"Window size",children:(0,M.jsx)(St.Q,{placeholder:(0,ae.t)("transformers.window-options-editor.placeholder-auto","Auto"),min:.1,value:ue?.windowSize&&ue.windowSizeMode===et.Bp.Percentage?ue.windowSize*100:ue?.windowSize,onChange:at})})]})},cn=[{value:et.UY.BinaryOperation,label:"Binary operation"},{value:et.UY.UnaryOperation,label:"Unary operation"},{value:et.UY.ReduceRow,label:"Reduce row"},{value:et.UY.Index,label:"Row index"}];F.$.featureToggles.addFieldFromCalculationStatFunctions&&cn.push({value:et.UY.CumulativeFunctions,label:"Cumulative functions"},{value:et.UY.WindowFunctions,label:"Window functions"});const un=new Set([_.PU.time,_.PU.number,_.PU.string]),bn=z=>{const{options:G,onChange:k,input:re}=z,ue=G?.reduce?.include,[ve,be]=(0,a.useState)({names:[],selected:[]});(0,a.useEffect)(()=>{const vt={interpolate:sn=>sn},Ft=(0,Wt.of)(re).pipe(Q.c.ensureColumnsTransformer.operator(null,vt),We(),Ue(),Ze(ue||[])).subscribe(({selected:sn,names:fn})=>{be({names:fn,selected:sn})});return()=>{Ft.unsubscribe()}},[re,ue]);const Ue=()=>{const vt=(0,Je.w)();return Ft=>Ft.pipe((0,Fn.T)(sn=>(sn.push(...vt.getVariables().map(fn=>"$"+fn.name)),sn)))},We=()=>vt=>vt.pipe((0,Fn.T)(Ft=>{const sn=[],fn={};for(const In of Ft)for(const Dn of In.fields){if(!un.has(Dn.type))continue;const ua=(0,te.Ct)(Dn,In,Ft);fn[ua]||(fn[ua]=!0,sn.push(ua))}return sn})),Ze=vt=>Ft=>Ft.pipe((0,Fn.T)(sn=>{if(!vt.length)return{names:sn,selected:[]};const fn=[],In=[];for(const Dn of sn)vt.includes(Dn)&&In.push(Dn),fn.push(Dn);return{names:fn,selected:In}})),at=vt=>{k({...G,replaceFields:vt.currentTarget.checked})},ct=vt=>{const Ft=vt.value??et.UY.BinaryOperation;Ft===et.UY.WindowFunctions&&(G.window=G.window??et.Uj),k({...G,mode:Ft})},gt=vt=>{k({...G,alias:vt.target.value})},pt=G.mode??et.UY.BinaryOperation,ht=pt===et.UY.BinaryOperation&&G.binary?.left.matcher?.id===ne.Ct.byType;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{labelWidth:It,label:(0,ae.t)("transformers.calculate-field-transformer-editor.label-mode","Mode"),children:(0,M.jsx)(le.l6,{className:"width-18",options:cn,value:cn.find(vt=>vt.value===pt),onChange:ct})}),pt===et.UY.BinaryOperation&&(0,M.jsx)(Vt,{options:G,names:ve.names,onChange:z.onChange}),pt===et.UY.UnaryOperation&&(0,M.jsx)(Gn,{names:ve.names,options:G,onChange:z.onChange}),pt===et.UY.ReduceRow&&(0,M.jsx)(En,{names:ve.names,selected:ve.selected,options:G,onChange:z.onChange}),pt===et.UY.CumulativeFunctions&&(0,M.jsx)(en,{names:ve.names,options:G,onChange:z.onChange}),pt===et.UY.WindowFunctions&&(0,M.jsx)(Ht,{names:ve.names,options:G,onChange:z.onChange}),pt===et.UY.Index&&(0,M.jsx)(ln,{options:G,onChange:z.onChange}),(0,M.jsx)(q.I,{labelWidth:It,label:(0,ae.t)("transformers.calculate-field-transformer-editor.label-alias","Alias"),disabled:ht,children:(0,M.jsx)($t.p,{className:"width-18",value:G.alias??"",placeholder:(0,et.sw)(G),onChange:gt})}),(0,M.jsx)(q.I,{labelWidth:It,label:(0,ae.t)("transformers.calculate-field-transformer-editor.label-replace-all-fields","Replace all fields"),children:(0,M.jsx)(rt.
1554K,{value:!!G.replaceFields,onChange:at})})]})},Sn={id:Y.F.calculateField,editor:bn,transformation:Q.c.calculateFieldTransformer,name:Q.c.calculateFieldTransformer.name,description:"Use the row values to calculate a new field.",categories:new Set([i.m.CalculateNewFields]),help:fe(Y.F.calculateField).helperDocs};var wn=e(9287);const ea=[{value:wn.x1.FieldName,label:"Copy frame name to field name"},{value:wn.x1.Label,label:"Add a label with the frame name"},{value:wn.x1.Drop,label:"Ignore the frame name"}];class Zn extends a.PureComponent{constructor(G){super(G),this.onModeChanged=k=>{const{options:re,onChange:ue}=this.props,ve=k.value??wn.x1.FieldName;ue({...re,frameNameMode:ve})},this.onLabelChanged=k=>{const{options:re}=this.props;this.props.onChange({...re,frameNameLabel:k.target.value})}}render(){const{options:G}=this.props,k=G.frameNameMode??wn.x1.FieldName;return(0,M.jsxs)("div",{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.concatenate-transformer-editor.label-name","Name"),labelWidth:16,grow:!0,children:(0,M.jsx)(le.l6,{width:36,options:ea,value:ea.find(re=>re.value===k),onChange:this.onModeChanged})}),k===wn.x1.Label&&(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.concatenate-transformer-editor.label-label","Label"),labelWidth:16,grow:!0,children:(0,M.jsx)($t.p,{width:36,value:G.frameNameLabel??"",placeholder:(0,ae.t)("transformers.concatenate-transformer-editor.placeholder-frame","Frame"),onChange:this.onLabelChanged})})]})}}const Vn={id:Y.F.concatenate,editor:Zn,transformation:Q.c.concatenateTransformer,name:Q.c.concatenateTransformer.name,description:"Combine all fields into a single frame. Values will be appended with undefined values if not the same length.",categories:new Set([i.m.Combine]),help:fe(Y.F.concatenate).helperDocs};var _n=e(62717),Ln=e(62693),Xn=e(48457),ma=e(40665),Ca=e(57095),Da=e(32881),Qn=e(30703),Ha=e(12594),ba=e(76319);const Ps=({transformIndex:z,value:G,index:k,mappedIndex:re,onChangeEnumValue:ue,onRemoveEnumRow:ve,checkIsEnumUniqueValue:be})=>{const Ue=(0,xt.of)(Ms),[We,Ze]=(0,a.useState)(G),[at,ct]=(0,a.useState)(We===""),[gt,pt]=(0,a.useState)(null),ht=(0,a.useRef)(null);(0,a.useEffect)(()=>{ht.current&&ht.current.focus()},[ht]);const vt=Dn=>{Dn.currentTarget.value!==""&&be(Dn.currentTarget.value)&&Dn.currentTarget.value!==G?pt("Enum value already exists"):pt(null),Ze(Dn.currentTarget.value)},Ft=()=>{if(ct(!1),pt(null),We===""||gt!==null){ve(re);return}ue(re,We)},sn=Dn=>{Dn.key==="Enter"&&(Dn.preventDefault(),Ft())},fn=()=>{ct(!0)},In=()=>{ve(re)};return(0,M.jsx)(Ca.Draggable,{draggableId:`${z}/${G}`,index:k,children:Dn=>(0,M.jsxs)("tr",{ref:Dn.innerRef,...Dn.draggableProps,children:[(0,M.jsx)("td",{children:(0,M.jsx)("div",{className:Ue.dragHandle,...Dn.dragHandleProps,children:(0,M.jsx)(Qn.I,{name:"draggabledots",size:"lg"})})}),at?(0,M.jsxs)("td",{children:[(0,M.jsx)($t.p,{ref:ht,type:"text",value:We,onChange:vt,onBlur:Ft,onKeyDown:sn}),gt&&(0,M.jsx)(Ha.P,{children:gt})]}):(0,M.jsx)("td",{onClick:fn,className:Ue.clickableTableCell,children:G&&G!==""?G:"Click to edit"}),(0,M.jsx)("td",{className:Ue.textAlignCenter,children:(0,M.jsx)(Da.Gy,{spacing:"sm",children:(0,M.jsx)(ba.K,{name:"trash-alt",onClick:In,"data-testid":"remove-enum-row","aria-label":(0,ae.t)("transformers.enum-mapping-row.remove-enum-row-aria-label-delete-enum-row","Delete enum row"),tooltip:(0,ae.t)("transformers.enum-mapping-row.remove-enum-row-tooltip-delete","Delete")})})})]},k)},`${z}/${G}`)},Ms=z=>({dragHandle:(0,_e.css)({cursor:"grab"}),textAlignCenter:(0,_e.css)({textAlign:"center"}),clickableTableCell:(0,_e.css)({cursor:"pointer",width:"100px","&:hover":{color:z.colors.text.maxContrast}})}),Ds=Ps,br=({input:z,options:G,transformIndex:k,onChange:re})=>{const ue=(0,xt.of)($r),[ve,be]=(0,a.useState)(G.conversions[k].enumConfig?.text??[]);(0,a.useEffect)(()=>{!G.conversions[k].enumConfig?.text?.length&&z.length&&Ue()},[z]),(0,a.useEffect)(()=>{(()=>{const vt=ve.map(fn=>fn),Ft=G.conversions,sn={text:vt};Ft[k]={...Ft[k],enumConfig:sn},re({...G,conversions:Ft})})()},[k,ve]);const Ue=()=>{const ht=z.flatMap(Ft=>Ft?.fields??[]).find(Ft=>Ft.name===G.conversions[k].targetField);if(!ht)return;const vt=new Set(ht?.values);ve.length>0&&!(0,H.isEqual)(ve,Array.from(vt))&&!window.confirm("This action will over
1554write the existing configuration. Are you sure you want to continue?")||be([...vt])},We=(ht,vt)=>{const Ft=[...ve];Ft.splice(ht,1,vt),be(Ft)},Ze=ht=>{const vt=[...ve];vt.splice(ht,1),be(vt)},at=()=>{be(["",...ve])},ct=(ht,vt)=>{ve.includes(vt)||We(ht,vt)},gt=ht=>ve.includes(ht),pt=ht=>{if(!ht.destination)return;const vt=ve.length-ht.source.index-1,Ft=ve.length-ht.destination.index-1,sn=[...ve],fn=sn[vt];sn.splice(vt,1),sn.splice(Ft,0,fn),be(sn)};return(0,M.jsxs)(de.C,{children:[(0,M.jsxs)(Da.Gy,{children:[(0,M.jsx)(oe.$n,{size:"sm",icon:"plus",onClick:()=>Ue(),className:ue.button,children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.enum-mapping-editor.generate-enum-values-from-data",children:"Generate enum values from data"})}),(0,M.jsx)(oe.$n,{size:"sm",icon:"plus",onClick:()=>at(),className:ue.button,children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.enum-mapping-editor.add-enum-value",children:"Add enum value"})})]}),(0,M.jsx)(Da.gW,{children:(0,M.jsx)("table",{className:ue.compactTable,children:(0,M.jsx)(Ca.DragDropContext,{onDragEnd:pt,children:(0,M.jsx)(Ca.Droppable,{droppableId:"sortable-enum-config-mappings",direction:"vertical",children:ht=>(0,M.jsxs)("tbody",{ref:ht.innerRef,...ht.droppableProps,children:[[...ve].reverse().map((vt,Ft)=>{const sn=ve.length-Ft-1;return(0,M.jsx)(Ds,{transformIndex:k,value:vt,index:Ft,mappedIndex:sn,onChangeEnumValue:ct,onRemoveEnumRow:Ze,checkIsEnumUniqueValue:gt},`${k}/${vt}`)}),ht.placeholder]})})})})})]})},$r=z=>({compactTable:(0,_e.css)({"tbody td":{padding:z.spacing(.5)},marginTop:z.spacing(1),marginBottom:z.spacing(2)}),button:(0,_e.css)({marginTop:z.spacing(1)})}),zr={settings:{width:24,isClearable:!1}},sr=({input:z,options:G,onChange:k})=>{const re=Ln.bx.filter(pt=>pt.value!==_.PU.trace),ue=(0,Te.qt)(!0),ve=(0,_n.P3)();ue.push({label:"Browser",value:"browser"}),ue.push({label:"UTC",value:"utc"});for(const pt of ve)ue.push({label:pt,value:pt});const be=(0,a.useCallback)(pt=>ht=>{const vt=G.conversions;vt[pt]={...vt[pt],targetField:ht??"",dateFormat:void 0},k({...G,conversions:vt})},[k,G]),Ue=(0,a.useCallback)(pt=>ht=>{const vt=G.conversions;vt[pt]={...vt[pt],destinationType:ht.value},k({...G,conversions:vt})},[k,G]),We=(0,a.useCallback)(pt=>ht=>{const vt=G.conversions;vt[pt]={...vt[pt],dateFormat:ht.currentTarget.value},k({...G,conversions:vt})},[k,G]),Ze=(0,a.useCallback)(pt=>ht=>{const vt=G.conversions;vt[pt]={...vt[pt],joinWith:ht.currentTarget.value},k({...G,conversions:vt})},[k,G]),at=(0,a.useCallback)(()=>{k({...G,conversions:[...G.conversions,{targetField:void 0,destinationType:void 0,dateFormat:void 0}]})},[k,G]),ct=(0,a.useCallback)(pt=>{const ht=G.conversions;ht.splice(pt,1),k({...G,conversions:ht})},[k,G]),gt=(0,a.useCallback)(pt=>ht=>{const vt=G.conversions;vt[pt]={...vt[pt],timezone:ht?.value},k({...G,conversions:vt})},[k,G]);return(0,M.jsxs)(M.Fragment,{children:[G.conversions.map((pt,ht)=>{const vt=(0,ma.findField)(z?.[0],pt.targetField);return(0,M.jsxs)("div",{children:[(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.convert-field-type-transformer-editor.label-field","Field"),children:(0,M.jsx)(Xn.O,{context:{data:z},value:pt.targetField??"",onChange:be(ht),item:zr})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.convert-field-type-transformer-editor.label-as","as"),children:(0,M.jsx)(le.l6,{options:re,value:pt.destinationType,placeholder:(0,ae.t)("transformers.convert-field-type-transformer-editor.placeholder-type","Type"),onChange:Ue(ht),width:18})}),pt.destinationType===_.PU.time&&(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.convert-field-type-transformer-editor.label-input-format","Input format"),tooltip:(0,ae.t)("transformers.convert-field-type-transformer-editor.tooltip-input-format","Specify the format of the input field so Grafana can parse the date string correctly."),children:(0,M.jsx)($t.p,{value:pt.dateFormat,placeholder:"e.g. YYYY-MM-DD",onChange:We(ht),width:24})}),pt.destinationType===_.PU.string&&(0,M.jsxs)(M.Fragment,{children:[(pt.joinWith?.length||vt?.type===_.PU.other)&&(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.convert-field-type-transformer-editor.label-join-with","Join with"),tooltip:(0,ae.t)("transformers.convert-field-type-transformer-editor.tooltip-explicit-separator-joining-array-values","Use an explicit separator when joining array values"),children:(0,M.jsx)($t.p,{value:pt.joinWith,placeholder:"JSON",onChange:Ze(ht),width:9})}),vt?.type===_.PU.time&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.convert-field-type-transformer-editor.label-date-format","Date format"),tooltip:(0,ae.t)("transformers.convert-field-type-transformer-editor.tooltip-specify-the-output-format","Specify the output format."),children:(0,M.jsx)($t.p,{value:pt.dateFormat,placeholder:"e.g. YYYY-MM-DD",onChange:We(ht),width:24})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.convert-field-type-transformer-editor.label-set-timezone","Set timezone"),tooltip:(0,ae.t)("transformers.convert-field-type-transformer-editor.tooltip-timezone-manually","Set the timezone of the date manually"),children:(0,M.jsx)(le.l6,{options:ue,value:pt.timezone,onChange:gt(ht),isClearable:!0})})]})]}),(0,M.jsx)(oe.$n,{size:"md",icon:"trash-alt",variant:"secondary",onClick:()=>ct(ht),"aria-label":(0,ae.t)("transformers.convert-field-type-transformer-editor.aria-label-remove-convert-field-type-transformer","Remove c
1554onvert field type transformer")})]}),pt.destinationType===_.PU.enum&&(0,M.jsx)(br,{input:z,options:G,transformIndex:ht,onChange:k})]},`${pt.targetField}-${ht}`)}),(0,M.jsx)(oe.$n,{size:"sm",icon:"plus",onClick:at,variant:"secondary","aria-label":(0,ae.t)("transformers.convert-field-type-transformer-editor.aria-label-add-a-convert-field-type-transformer","Add a convert field type transformer"),children:"Convert field type"})]})},Gs={id:Y.F.convertFieldType,editor:sr,transformation:Q.c.convertFieldTypeTransformer,name:Q.c.convertFieldTypeTransformer.name,description:Q.c.convertFieldTypeTransformer.description,categories:new Set([i.m.Reformat]),help:fe(Y.F.convertFieldType).helperDocs};var as=e(8934);class ka extends a.PureComponent{constructor(G){super(G),this.onFieldToggle=k=>{const{selected:re}=this.state;re.indexOf(k)>-1?this.onChange(re.filter(ue=>ue!==k)):this.onChange([...re,k])},this.onChange=k=>{const{regex:re,isRegexValid:ue}=this.state,ve={...this.props.options,include:{names:k}};re&&ue&&(ve.include=ve.include??{},ve.include.pattern=re),this.setState({selected:k},()=>{this.props.onChange(ve)})},this.onInputBlur=k=>{const{selected:re,regex:ue}=this.state;let ve=!0;try{ue&&(0,as.dO)(ue)}catch{ve=!1}ve?this.props.onChange({...this.props.options,include:{pattern:ue}}):this.props.onChange({...this.props.options,include:{names:re}}),this.setState({isRegexValid:ve})},this.onVariableChange=k=>{this.props.onChange({...this.props.options,include:{variable:k.value}}),this.setState({variable:k.value})},this.onFromVariableChange=k=>{const re=k.currentTarget.checked;this.props.onChange({...this.props.options,byVariable:re}),this.setState({byVariable:re})},this.state={include:G.options.include?.names||[],regex:G.options.include?.pattern,variable:G.options.include?.variable,byVariable:G.options.byVariable||!1,options:[],variables:[],selected:[],isRegexValid:!0}}componentDidMount(){this.initOptions()}componentDidUpdate(G){this.props.input!==G.input&&this.initOptions()}initOptions(){const{input:G,options:k}=this.props,re=Array.from(k.include?.names??[]),ue=(0,Je.w)().getVariables().map(Ue=>({label:"$"+Ue.name,value:"$"+Ue.name})),ve=[],be={};for(const Ue of G)for(const We of Ue.fields){const Ze=(0,te.Ct)(We,Ue,G);let at=be[Ze];at||(at=be[Ze]={name:Ze,count:0},ve.push(at)),at.count++}if(k.include?.pattern)try{const Ue=(0,as.dO)(k.include.pattern);for(const We of ve)Ue.test(We.name)&&re.push(We.name)}catch(Ue){console.error(Ue)}if(re.length){const Ue=ve.filter(We=>re.includes(We.name));this.setState({options:ve,selected:Ue.map(We=>We.name),variables:ue,byVariable:k.byVariable||!1,variable:k.include?.variable,regex:k.include?.pattern})}else this.setState({options:ve,selected:ve.map(Ue=>Ue.name),variables:ue,byVariable:k.byVariable||!1,variable:k.include?.variable,regex:k.include?.pattern})}render(){const{options:G,selected:k,isRegexValid:re}=this.state;return(0,M.jsxs)("div",{children:[(0,M.jsx)(de.C,{label:(0,ae.t)("transformers.filter-by-name-transformer-editor.label-use-variable","Use variable"),children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-name-transformer-editor.label-from-variable","From variable"),children:(0,M.jsx)(rt.K,{value:this.state.byVariable,onChange:this.onFromVariableChange})})}),this.state.byVariable?(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-name-transformer-editor.label-variable","Variable"),children:(0,M.jsx)(le.l6,{value:this.state.variable,onChange:this.onVariableChange,options:this.state.variables||[]})})}):(0,M.jsxs)(de.C,{label:(0,ae.t)("transformers.filter-by-name-transformer-editor.label-identifier","Identifier"),children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.filter-by-name-transformer-editor.label-identifier","Identifier"),invalid:!re,error:re?void 0:"Invalid pattern",children:(0,M.jsx)($t.p,{placeholder:(0,ae.t)("transformers.filter-by-name-transformer-editor.placeholder-regular-expression-pattern","Regular expression pattern"),value:this.state.regex||"",onChange:ue=>this.setState({regex:ue.currentTarget.value}),onBlur:this.onInputBlur,width:25})}),G.map((ue,ve)=>{const be=`${ue.name}${ue.count>1?" ("+ue.count+")":""}`,Ue=k.indexOf(ue.name)>-1;return(0,M.jsx)(xn.m,{onClick:()=>{this.onFieldToggle(ue.name)},label:be,selected:Ue},`${ue.name}/${ve}`)})]})]})}}const Ya={id:Y.F.filterFieldsByName,editor:ka,transformation:Q.c.filterFieldsByNameTransformer,name:Q.c.filterFieldsByNameTransformer.name,description:"Removes part of the query results using a regex pattern. The pattern can be inclusive or exclusive.",categories:new Set([i.m.Filter]),help:fe(Y.F.filterFieldsByName).helperDocs};var Hr=e(42240);const Ws=z=>
1554(0,M.jsx)(Hr.M,{value:{id:ne.jR.byRefId,options:z.options.include||""},onChange:G=>{z.onChange({...z.options,include:G?.options||""})},context:{data:z.input}}),Fs={id:Y.F.filterByRefId,editor:Ws,transformation:Q.c.filterFramesByRefIdTransformer,name:Q.c.filterFramesByRefIdTransformer.name,description:"Filter data by query. This is useful if you are sharing the results from a different panel that has many queries and you want to only visualize a subset of that in this panel.",categories:new Set([i.m.Filter]),help:fe(Y.F.filterByRefId).helperDocs};var Wa=e(40041);const Gr={settings:{width:30,filter:z=>z.type===_.PU.string,placeholderText:"Select text field",noFieldsMessage:"No text fields found"},name:"",id:"",editor:()=>null};function _r({input:z,options:G,onChange:k}){const re=(0,a.useCallback)(We=>{k({...G,stringField:We??""})},[k,G]),ue=(0,a.useCallback)(We=>{const Ze=We.value??Wa.gs.UpperCase;k({...G,outputFormat:Ze})},[k,G]),ve=(0,a.useCallback)(We=>{k({...G,substringStart:We??0})},[k,G]),be=(0,a.useCallback)(We=>{k({...G,substringEnd:We??0})},[k,G]),Ue=Object.values(Wa.gs).map(We=>({label:We,value:We}));return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.format-string-transfomer-editor.label-field","Field"),labelWidth:10,children:(0,M.jsx)(Xn.O,{context:{data:z},value:G.stringField??"",onChange:re,item:Gr})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.format-string-transfomer-editor.label-format","Format"),labelWidth:10,children:(0,M.jsx)(le.l6,{options:Ue,value:G.outputFormat,onChange:ue,width:20})})]}),G.outputFormat===Wa.gs.Substring&&(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.format-string-transfomer-editor.label-substring-range","Substring range"),labelWidth:15,children:(0,M.jsx)(St.Q,{min:0,value:G.substringStart??0,onChange:ve,width:7})}),(0,M.jsx)(q.I,{children:(0,M.jsx)(St.Q,{min:0,value:G.substringEnd??0,onChange:be,width:7})})]})]})}const rr={id:Y.F.formatString,editor:_r,transformation:Q.c.formatStringTransformer,name:Q.c.formatStringTransformer.name,state:xe.pn.beta,description:Q.c.formatStringTransformer.description,categories:new Set([i.m.Reformat])};function or({input:z,options:G,onChange:k}){const re=[],ue=(0,Te.qt)(!0);for(const We of z)for(const Ze of We.fields)if(Ze.type==="time"){const at=(0,te.Ct)(Ze,We,z);re.push({label:at,value:at})}const ve=(0,a.useCallback)(We=>{const Ze=We?.value!==void 0?We.value:"";k({...G,timeField:Ze})},[k,G]),be=(0,a.useCallback)(We=>{const Ze=We.target.value;k({...G,outputFormat:Ze})},[k,G]),Ue=(0,a.useCallback)(We=>{const Ze=We?.value!==void 0?We.value:"";k({...G,timezone:Ze})},[k,G]);return(0,M.jsx)(M.Fragment,{children:(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.format-time-transfomer-editor.label-time-field","Time field"),labelWidth:15,grow:!0,children:(0,M.jsx)(le.l6,{options:re,value:G.timeField,onChange:ve,placeholder:"time",isClearable:!0})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.format-time-transfomer-editor.label-format","Format"),labelWidth:10,tooltip:(0,M.jsxs)(M.Fragment,{children:["The output format for the field specified as a"," ",(0,M.jsx)("a",{href:"https://momentjs.com/docs/#/displaying/",target:"_blank",rel:"noopener noreferrer",children:"Moment.js format string"}),"."]}),interactive:!0,children:(0,M.jsx)($t.p,{onChange:be,value:G.outputFormat})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.format-time-transfomer-editor.label-set-timezone","Set timezone"),tooltip:(0,ae.t)("transformers.format-time-transfomer-editor.tooltip-timezone-manually","Set the timezone of the date manually"),labelWidth:20,children:(0,M.jsx)(le.l6,{options:ue,value:G.timezone,onChange:Ue,isClearable:!0})})]})})}const Is={id:Y.F.formatTime,editor:or,transformation:Q.c.formatTimeTransformer,name:Q.c.formatTimeTransformer.name,state:xe.pn.alpha,description:Q.c.formatTimeTransformer.description,help:fe(Y.F.formatTime).helperDocs};var Za=e(47433),ss=e(34999);const Qr=({input:z,options:G,onChange:k})=>{const re=(0,Te.ZI)(z,!0),ue=(0,a.useCallback)(We=>Ze=>{k({...G,fields:{...G.fields,[We]:Ze}})},[k]);let ve,be=!1;
1554for(const We of Object.values(G.fields))We.aggregations.length>0&&We.operation!==null&&(be=!0),We.operation===Za.R3.groupBy&&(ve=!0);const Ue=be&&!ve;return(0,M.jsxs)(Qt.B,{direction:"column",children:[Ue&&(0,M.jsx)(ss.F,{title:(0,ae.t)("transformers.group-by-transformer-editor.title-calc-alert","Calculations will not have an effect if no fields are being grouped on"),severity:"warning"}),re.map(We=>(0,M.jsx)(Yr,{onConfigChange:ue(We),fieldName:We,config:G.fields[We]},We))]})},kr=[{label:"Group by",value:Za.R3.groupBy},{label:"Calculate",value:Za.R3.aggregate}],Yr=({fieldName:z,config:G,onConfigChange:k})=>{const re=(0,xt.$j)(),ue=Cr(re),ve=(0,a.useCallback)(be=>{k({aggregations:G?.aggregations??[],operation:be?.value??null})},[G,k]);return(0,M.jsx)(q.I,{className:ue.label,label:z,grow:!0,shrink:!0,children:(0,M.jsxs)(Qt.B,{gap:.5,direction:"row",children:[(0,M.jsx)("div",{className:ue.operation,children:(0,M.jsx)(le.l6,{options:kr,value:G?.operation,placeholder:(0,ae.t)("transformers.group-by-field-configuration.placeholder-ignored","Ignored"),onChange:ve,isClearable:!0})}),G?.operation===Za.R3.aggregate&&(0,M.jsx)(Xt.S,{className:ue.aggregations,placeholder:(0,ae.t)("transformers.group-by-field-configuration.placeholder-select-stats","Select stats"),allowMultiple:!0,stats:G.aggregations,onChange:be=>{k({...G,aggregations:be})}})]})})},Cr=z=>({label:(0,_e.css)({label:{minWidth:z.spacing(32)}}),operation:(0,_e.css)({flexShrink:0,height:"100%",width:z.spacing(24)}),aggregations:(0,_e.css)({flexGrow:1})}),Jr={id:Y.F.groupBy,editor:Qr,transformation:Q.c.groupByTransformer,name:Q.c.groupByTransformer.name,description:Q.c.groupByTransformer.description,categories:new Set([i.m.Combine,i.m.CalculateNewFields,i.m.Reformat]),help:fe(Y.F.groupBy).helperDocs};var Mr=e(25260),rs=e(37386);const os=({input:z,options:G,onChange:k})=>{const re=(0,Te.ZI)(z),ue=G.showSubframeHeaders===void 0?Mr.l:G.showSubframeHeaders,ve=(0,a.useCallback)(at=>ct=>{k({...G,fields:{...G.fields,[at]:ct}})},[k]),be=(0,a.useCallback)(()=>{const at=G.showSubframeHeaders===void 0?!Mr.l:!G.showSubframeHeaders;k({showSubframeHeaders:at,fields:{...G.fields}})},[k]);let Ue,We=!1;for(const at of Object.values(G.fields))at.aggregations.length>0&&at.operation!==null&&(We=!0),at.operation===Za.R3.groupBy&&(Ue=!0);const Ze=We&&!Ue;return(0,M.jsxs)(Qt.B,{direction:"column",children:[Ze&&(0,M.jsx)(ss.F,{title:(0,ae.t)("transformers.group-to-nested-table-transformer-editor.title-calc-alert","Calculations will not have an effect if no fields are being grouped on."),severity:"warning"}),(0,M.jsx)("div",{children:re.map(at=>(0,M.jsx)(_s,{onConfigChange:ve(at),fieldName:at,config:G.fields[at]},at))}),(0,M.jsx)(rs.D,{label:(0,ae.t)("transformers.group-to-nested-table-transformer-editor.label-show-field-names-in-nested-tables","Show field names in nested tables"),description:(0,ae.t)("transformers.group-to-nested-table-transformer-editor.description-show-field-names","If enabled nested tables will show field names as a table header"),children:(0,M.jsx)(rt.d,{value:ue,onChange:be})})]})},Xr=[{label:"Group by",value:Za.R3.groupBy},{label:"Calculate",value:Za.R3.aggregate}],_s=({fieldName:z,config:G,onConfigChange:k})=>{const re=(0,xt.$j)(),ue=Ks(re),ve=(0,a.useCallback)(be=>{k({aggregations:G?.aggregations??[],operation:be?.value??null})},[G,k]);return(0,M.jsx)(q.I,{className:ue.label,label:z,grow:!0,shrink:!0,children:(0,M.jsxs)(Qt.B,{gap:.5,direction:"row",wrap:!1,children:[(0,M.jsx)("div",{className:ue.operation,children:(0,M.jsx)(le.l6,{options:Xr,value:G?.operation,placeholder:(0,ae.t)("transformers.group-by-field-configuration.placeholder-ignored","Ignored"),onChange:ve,isClearable:!0})}),G?.operation===Za.R3.aggregate&&(0,M.jsx)(Xt.S,{className:ue.aggregations,placeholder:(0,ae.t)("transformers.group-by-field-configuration.placeholder-select-stats","Select stats"),allowMultiple:!0,stats:G.aggregations,onChange:be=>{k({...G,aggregations:be})}})]})})},Ks=z=>({label:(0,_e.css)({minWidth:z.spacing(32)}),operation:(0,_e.css)({flexShrink:0,height:"100%",width:z.spacing(24)}),aggregations:(0,_e.css)({flexGrow:1})}),Qs={id:Y.F.groupToNestedTable,editor:os,transformation:Q.c.groupToNestedTable,name:Q.c.groupToNestedTable.name,description:Q.c.groupToNestedTable.description,categories:new Set([i.m.Combine,i.m.CalculateNewFields,i.m.Reformat]),state:xe.pn.beta};var $a=e(79319);const Sr=({input:z,options:G,onChange:k})=>{const re=(0,Te.ZI)(z).map(at=>({label:at,value:at})),ue=(0,Je.w)().getVariables().map(at=>({value:"$"+at.name,label:"$"+at.name})),ve=(0,a.useCallback)(at=>{k({...G,columnField:at?.value})},[k,G]),be=(0,a.useCallback)(at=>{k({...G,rowField:at?.value})},[k,G]),Ue=(0,a.useCallback)(at=>{k({...G,valueField:at?.value})},[k,G]),We=[{label:"Null",value:$a.N.Null,description:"Null value"},{label:"True",value:$a.N.True,description:"Boolean true value"},{label:"False",value:$a.N.False,description:"Boolean false value"},{label:"Zero",value:$a.N.Zero,description:"Number 0 value"},{label:"Empty",value:$a.N.Empty,description:"Empty string"}],Ze=(0,a.useCallback)(at=>{k({...G,emptyValue:at?.value})},[k,G]);return(0,M.jsx)(M.Fragment,{children:(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.grouping-to-matrix-transformer-editor.label-column","Column"),labelWidth:8,children:(0,M.jsx)(le.l6,{options:[...re,...ue],value:G.columnField,onChange:ve,isClearable:!0})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.grouping-to-matrix-transformer-editor.label-row","Row"),labelWidth:8,children:(0,M.jsx)(le.l6,{options:[...re,...ue],value:G.rowField,onChange:be,isClearable:!0})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.grouping-to-matrix-transformer-editor.label-cell-value","Cell value"),labelWidth:10,children:(0,M.jsx)(le.l6,{options:[...re,...ue],value:G.valueField,onChange:Ue,isClearable:!0})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.grouping-to-matrix-transformer-editor.label-empty-value","Empty value"),children:(0,M.jsx)(le.l6,{options:We,value:G.emptyValue,onChange:Ze,isClearable:!0})})]})})},Tr={id:Y.F.groupingToMatrix,editor:Sr,transformation:Q.c.groupingToMatrixTransformer,name:Q.c.groupingToMatrixTransformer.name,description:"Takes a three fields combination and produces a Matr
1554ix.",categories:new Set([i.m.Combine,i.m.Reformat]),help:fe(Y.F.groupingToMatrix).helperDocs};var dt=e(74261);const Ut=({input:z,options:G,onChange:k})=>{const[ue,ve]=(0,a.useState)({bucketCount:!(0,Te.N_)(G.bucketCount||""),bucketSize:!(0,Te.N_)(G.bucketSize||""),bucketOffset:!(0,Te.N_)(G.bucketOffset||"")}),be=(0,a.useCallback)(ct=>{ve({...ue,bucketCount:!(0,Te.N_)(ct)}),k({...G,bucketCount:Number(ct)===0?void 0:Number(ct)})},[k,G,ue]),Ue=(0,a.useCallback)(ct=>{ve({...ue,bucketSize:!(0,Te.N_)(ct)}),k({...G,bucketSize:ct})},[k,G,ue,ve]),We=(0,a.useCallback)(ct=>{ve({...ue,bucketOffset:!(0,Te.N_)(ct)}),k({...G,bucketOffset:ct})},[k,G,ue,ve]),Ze=(0,a.useCallback)(()=>{k({...G,combine:!G.combine})},[k,G]),at=(0,Te.I9)();return(0,M.jsxs)("div",{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{invalid:ue.bucketCount,error:"Value needs to be an integer or a variable",labelWidth:18,label:dt.Rt.bucketCount.name,tooltip:dt.Rt.bucketCount.description,children:(0,M.jsx)(De.y,{suggestions:at,value:G.bucketCount,placeholder:(0,ae.t)("transformers.histogram-transformer-editor.placeholder-default","Default: 30"),onChange:be})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{invalid:ue.bucketSize,error:"Value needs to be an integer or a variable",labelWidth:18,label:dt.Rt.bucketSize.name,tooltip:dt.Rt.bucketSize.description,children:(0,M.jsx)(De.y,{suggestions:at,value:G.bucketSize,placeholder:(0,ae.t)("transformers.histogram-transformer-editor.placeholder-auto","Auto"),onChange:Ue})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{labelWidth:18,label:dt.Rt.bucketOffset.name,tooltip:dt.Rt.bucketOffset.description,invalid:ue.bucketOffset,error:"Value needs to be an integer or a variable",children:(0,M.jsx)(De.y,{suggestions:at,value:G.bucketOffset,placeholder:(0,ae.t)("transformers.histogram-transformer-editor.placeholder-none","None"),onChange:We})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{labelWidth:18,label:dt.Rt.combine.name,tooltip:dt.Rt.combine.description,children:(0,M.jsx)(rt.K,{value:G.combine??!1,onChange:Ze})})})]})},kt={id:Y.F.histogram,editor:Ut,transformation:Q.c.histogramTransformer,name:Q.c.histogramTransformer.name,description:Q.c.histogramTransformer.description,categories:new Set([i.m.CreateNewVisualization]),help:fe(Y.F.histogram).helperDocs};var on=e(6684),pn=e(56755);const Tn=[{value:on.W.outer,label:"OUTER (TIME SERIES)",description:"Keep all rows from any table with a value. Join on distinct field values. Performant and best used for time series."},{value:on.W.outerTabular,label:"OUTER (TABULAR)",description:"Join on a field value with duplicated values. Non performant outer join best used for tabular(SQL like) data."},{value:on.W.inner,label:"INNER",description:"Combine data from two tables whenever there are matching values in a fields common to both tables."}];function Kn({input:z,options:G,onChange:k}){const re=(0,pn.sE)(z),ue=(0,pn.m3)(re),ve=(0,Je.w)().getVariables().map(We=>({value:"$"+We.name,label:"$"+We.name})),be=(0,a.useCallback)(We=>{k({...G,byField:We?.value})},[k,G]),Ue=(0,a.useCallback)(We=>{k({...G,mode:We?.value})},[k,G]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.series-to-fields-transformer-editor.label-mode","Mode"),labelWidth:8,grow:!0,children:(0,M.jsx)(le.l6,{options:Tn,value:G.mode??on.W.outer,onChange:Ue})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.series-to-fields-transformer-editor.label-field","Field"),labelWidth:8,grow:!0,children:(0,M.jsx)(le.l6,{options:[...ue,...ve],value:G.byField,onChange:be,placeholder:"time",isClearable:!0})})})]})}const Mn={id:Y.F.joinByField,aliasIds:[Y.F.seriesToColumns],editor:Kn,transformation:Q.c.joinByFieldTransformer,name:Q.c.joinByFieldTransformer.name,description:Q.c.joinByFieldTransformer.description,categories:new Set([i.m.Combine]),help:fe(Y.F.joinByField).helperDocs};var Jn=e(79184);const pa=[{value:Jn.n.Columns,label:"Columns"},{value:Jn.n.Rows,label:"Rows"}],ia=({input:z,options:G,onChange:k})=>{const{labelNames:ue,selected:ve}=(0,a.useMemo)(()=>{let We=[],Ze={};for(const ct of z)for(const gt of ct.fields)if(gt.labels)for(const pt of Object.keys(gt.labels))Ze[pt]||(We.push({value:pt,label:pt}),Ze[pt]=!0);const at=new Set(G.keepLabels?.length?G.keepLabels:Object.keys(Ze));return{labelNames:We,selected:at}},[G.keepLabels,z]),be=We=>{k({...G,valueLabel:We?.value})},Ue=We=>{if(ve.has(We)?ve.delete(We):ve.add(We),ve.size===ue.length||!ve.size){const{keepLabels:Ze,...at}=G;k(at)}else k({...G,keepLabels:[...ve]})};return(0,M.jsxs)("div",{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.labels-as-fields-transformer-editor.label-mode","Mode"),labelWidth:20,children:(0,M.jsx)(X.z,{options:pa,value:G.mode??Jn.n.Columns,onChange:We=>k({...G,mode:We})})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.labels-as-fields-transformer-editor.label-labels","Labels"),labelWidth:20,shrink:!0,children:(0,M.jsx)(Qt.B,{gap:.5,wrap:"wrap",children:ue.map((We,Ze)=>{const at=We.label;return(0,M.jsx)(xn.m,{onClick:()=>Ue(at),label:at,selected:ve.has(at)},`${at}/${Ze}`)})})})}),G.mode!==Jn.n.Rows&&(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.labels-as-fields-transformer-editor.label-value-field-name","Value field name"),labelWidth:20,tooltip:(0,ae.t)("transformers.labels-as-fields-transformer-editor.tooltip-replace-value-field-label","Replace the value field name with a label"),htmlFor:"labels-to-fields-as-name",children:(0,M.jsx)(le.l6,{inputId:"labels-to-fields-as-name",isClearable:!0,allowCustomValue:!1,placeholder:(0,ae.t)("transformers.labels-as-fields-transformer-editor.placeholder-optional-select-label","(Optional) Select label"),options:ue,value:G?.valueLabel,onChange:be,className:"min-width-16"})})})]})},va={id:Y.F.labelsToFields,editor:ia,transformation:Q.c.labelsToFieldsTransformer,name:Q.c.labelsToFieldsTransformer.name,description:`Groups series by time and return labels or tags as fields. 1555 Useful for showing time series with labels in a table where each label key becomes a separate column.`,categories:new Set([i.m.Reformat]),help:fe(Y.F.labelsToFields).helperDocs},Ba=({options:z,onChange:G})=>{const[k,re]=(0,a.useState)(!1),ue=(0,a.useCallback)(ve=>{re(!(0,Te.N_)(ve)),G({...z,limitField:ve})},[G,z]);return(0,M.jsx)(M.Fragment,{children:(0,M.jsx)(de.C,{children:(0,M.jsx)(De.y,{invalid:k,error:"Value needs to be an integer or a variable",value:String(z.limitField),onChange:ue,placeholder:(0,ae.t)("transformers.limit-transformer-editor.placeholder-value-or-variable","Value or variable"),suggestions:(0,Te.I9)()})})})},us={id:Y.F.limit,editor:Ba,transformation:Q.c.limitTransformer,name:Q.c.limitTransformer.name,description:"Limit the number of items displayed.",categories:new Set([i.m.Filter]),help:fe(Y.F.limit).helperDocs},ks=({input:z,options:G,onChange:k})=>z.length<=1?(0,M.jsx)(Ha.P,{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.merge-transformer-editor.merge-effect-applied-single-frame",children:"Merge has no effect when applied on a single frame."})}):null,pi={id:Y.F.merge,editor:ks,transformation:Q.c.mergeTransformer,name:Q.c.mergeTransformer.name,description:`Merge many series/tables and return a single table where mergeable values will be combined into the same row. 1556 Useful for showing multiple series, tables or a combination of both visualized in a table.`,categories:new Set([i.m.Combine]),help:fe(Y.F.merge).helperDocs};var gi=e(95575),Aa=e(66404);const Oo=({options:z,input:G,onChange:k})=>{const{indexByName:re,excludeByName:ue,renameByName:ve,includeByName:be}=z,Ue=(0,Te.ZI)(G),We=(0,a.useMemo)(()=>vi(Ue,re),[Ue,re]),Ze=be&&Object.keys(be).length>0?"include":"exclude",at=(0,a.useCallback)((ht,vt)=>{k({...z,excludeByName:{...ue,[ht]:vt}})},[k,z,ue]),ct=(0,a.useCallback)((ht,vt)=>{const Ft={...z,includeByName:{...be,[ht]:!vt}};k(Ft)},[k,z,be]),gt=(0,a.useCallback)(ht=>
1556{if(!ht||!ht.destination)return;const vt=ht.source.index,Ft=ht.destination.index;vt!==Ft&&k({...z,indexByName:Ro(Ue,vt,Ft)})},[k,z,Ue]),pt=(0,a.useCallback)((ht,vt)=>{k({...z,renameByName:{...z.renameByName,[ht]:vt}})},[k,z]);return G.length>1?(0,M.jsx)(Ha.P,{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.organize-fields-transformer-editor.first-frame-warning",children:"Organize fields only works with a single frame. Consider applying a join transformation or filtering the input first."})}):(0,M.jsx)(Ca.DragDropContext,{onDragEnd:gt,children:(0,M.jsx)(Ca.Droppable,{droppableId:"sortable-fields-transformer",direction:"vertical",children:ht=>(0,M.jsxs)("div",{ref:ht.innerRef,...ht.droppableProps,children:[We.map((vt,Ft)=>{const sn=be&&vt in be?be[vt]:!1,fn=Ze==="include"?sn:!ue[vt],In=Ze==="include"?ct:at;return(0,M.jsx)(Io,{fieldName:vt,renamedFieldName:ve[vt],index:Ft,onToggleVisibility:In,onRenameField:pt,visible:fn},vt)}),ht.placeholder]})})})};Oo.displayName="OrganizeFieldsTransformerEditor";const Io=({fieldName:z,renamedFieldName:G,index:k,visible:re,onToggleVisibility:ue,onRenameField:ve})=>{const be=(0,xt.of)(mi);return(0,M.jsx)(Ca.Draggable,{draggableId:z,index:k,children:Ue=>(0,M.jsxs)(se.a,{marginBottom:.5,display:"flex",gap:0,ref:Ue.innerRef,...Ue.draggableProps,children:[(0,M.jsx)(Me.c,{width:60,as:"div",children:(0,M.jsxs)(Qt.B,{gap:0,justifyContent:"flex-start",alignItems:"center",width:"100%",children:[(0,M.jsx)("span",{...Ue.dragHandleProps,children:(0,M.jsx)(Qn.I,{name:"draggabledots",title:(0,ae.t)("transformers.draggable-field-name.title-drag-and-drop-to-reorder","Drag and drop to reorder"),size:"lg",className:be.draggable})}),(0,M.jsx)(ba.K,{className:be.toggle,size:"md",name:re?"eye":"eye-slash",onClick:()=>ue(z,re),tooltip:re?"Disable":"Enable"}),(0,M.jsx)(Aa.E,{truncate:!0,element:"p",variant:"bodySmall",weight:"bold",children:z})]})}),(0,M.jsx)($t.p,{defaultValue:G||"",placeholder:(0,ae.t)("transformers.draggable-field-name.rename-placeholder","Rename {{fieldName}}",{fieldName:z}),onBlur:We=>ve(z,We.currentTarget.value)})]})})};Io.displayName="DraggableFieldName";const mi=z=>({toggle:(0,_e.css)({margin:z.spacing(0,1),color:z.colors.text.secondary}),draggable:(0,_e.css)({opacity:.4,"&:hover":{color:z.colors.text.maxContrast}})}),Ro=(z,G,k)=>{const re=Array.from(z),[ue]=re.splice(G,1);return re.splice(k,0,ue),re.reduce((ve,be,Ue)=>(ve[be]=Ue,ve),{})},vi=(z,G={})=>{if(!G||Object.keys(G).length===0)return z;const k=(0,gi.X)(G);return z.sort(k)},Ao={id:Y.F.organize,editor:Oo,transformation:Q.c.organizeFieldsTransformer,name:Q.c.organizeFieldsTransformer.name,description:"Allows the user to re-order, hide, or rename fields / columns. Useful when data source doesn't allow overrides for visualizing data.",categories:new Set([i.m.ReorderAndRename]),help:fe(Y.F.organize).helperDocs};var Rs=e(32157),xa=e(85629);const Lo=({options:z,onChange:G})=>{const k=[{label:"Series to rows",value:Rs.rV.SeriesToRows,description:"Create a table with one row for each series value"},{label:"Reduce fields",value:Rs.rV.ReduceFields,description:"Collapse each field into a single value"}],re=(0,a.useCallback)(be=>{const Ue=be.value;G({...z,mode:Ue,includeTimeField:Ue===Rs.rV.ReduceFields?!!z.includeTimeField:!1})},[G,z]),ue=(0,a.useCallback)(()=>{G({...z,includeTimeField:!z.includeTimeField})},[G,z]),ve=(0,a.useCallback)(()=>{G({...z,labelsToFields:!z.labelsToFields})},[G,z]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.reduce-transformer-editor.label-mode","Mode"),"data-testid":xa.Tp.components.Transforms.Reduce.modeLabel,grow:!0,labelWidth:16,children:(0,M.jsx)(le.l6,{options:k,value:k.find(be=>be.value===z.mode)||k[0],onChange:re})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.reduce-transformer-editor.label-calculations","Calculations"),"data-testid":xa.Tp.components.Transforms.Reduce.calculationsLabel,grow:!0,labelWidth:16,children:(0,M.jsx)(Xt.S,{placeholder:(0,ae.t)("transformers.reduce-transformer-editor.placeholder-choose-stat","Choose stat"),allowMultiple:!0,stats:z.reducers||[],onChange:be=>{G({...z,reducers:be})}})}),z.mode===Rs.rV.ReduceFields&&(0,M.jsx)(q.I,{htmlFor:"include-time-field",labelWidth:16,label:(0,ae.t)("transformers.reduce-transformer-editor.label-include-time","Include time"),children:(0,M.jsx)(rt.
1556K,{id:"include-time-field",value:!!z.includeTimeField,onChange:ue})}),z.mode!==Rs.rV.ReduceFields&&(0,M.jsx)(q.I,{htmlFor:"labels-to-fields",labelWidth:16,label:(0,ae.t)("transformers.reduce-transformer-editor.label-labels-to-fields","Labels to fields"),children:(0,M.jsx)(rt.K,{id:"labels-to-fields",value:!!z.labelsToFields,onChange:ve})})]})},yi={id:Y.F.reduce,editor:Lo,transformation:Q.c.reduceTransformer,name:Q.c.reduceTransformer.name,description:Q.c.reduceTransformer.description,categories:new Set([i.m.CalculateNewFields]),help:fe(Y.F.reduce).helperDocs};class xi extends a.PureComponent{constructor(G){super(G),this.handleRegexChange=k=>{const re=k.currentTarget.value;let ue=!0;if(re)try{re&&(0,as.dO)(re)}catch{ue=!1}this.setState(ve=>({...ve,regex:re,isRegexValid:ue}))},this.handleRenameChange=k=>{const re=k.currentTarget.value;this.setState(ue=>({...ue,renamePattern:re}))},this.handleRegexBlur=k=>{const re=k.currentTarget.value;let ue=!0;try{re&&(0,as.dO)(re)}catch{ue=!1}this.setState({isRegexValid:ue},()=>{ue&&this.props.onChange({...this.props.options,regex:re})})},this.handleRenameBlur=k=>{const re=k.currentTarget.value;this.setState({renamePattern:re},()=>this.props.onChange({...this.props.options,renamePattern:re}))},this.state={regex:G.options.regex,renamePattern:G.options.renamePattern,isRegexValid:!0}}render(){const{regex:G,renamePattern:k,isRegexValid:re}=this.state;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.rename-by-regex-transformer-editor.label-match","Match"),labelWidth:16,invalid:!re,error:re?void 0:"Invalid pattern",children:(0,M.jsx)($t.p,{placeholder:(0,ae.t)("transformers.rename-by-regex-transformer-editor.placeholder-regular-expression-pattern","Regular expression pattern"),value:G||"",onChange:this.handleRegexChange,onBlur:this.handleRegexBlur,width:25})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.rename-by-regex-transformer-editor.label-replace","Replace"),labelWidth:16,children:(0,M.jsx)($t.p,{placeholder:(0,ae.t)("transformers.rename-by-regex-transformer-editor.placeholder-replacement-pattern","Replacement pattern"),value:k||"",onChange:this.handleRenameChange,onBlur:this.handleRenameBlur,width:25})})]})}}const Ei={id:Y.F.renameByRegex,editor:xi,transformation:Q.c.renameByRegexTransformer,name:Q.c.renameByRegexTransformer.name,description:"Renames part of the query result by using regular expression with placeholders.",categories:new Set([i.m.ReorderAndRename]),help:fe(Y.F.renameByRegex).helperDocs},Ga=({input:z,options:G,onChange:k})=>null,Pi={id:Y.F.seriesToRows,editor:Ga,transformation:Q.c.seriesToRowsTransformer,name:Q.c.seriesToRowsTransformer.name,description:`Merge many series and return a single series with time, metric and value as columns. 1557 Useful for showing multiple time series visualized in a table.`,categories:new Set([i.m.Combine,i.m.Reformat]),help:fe(Y.F.seriesToRows).helperDocs},Di=({input:z,options:G,onChange:k})=>{const re=(0,Te.ZI)(z).map(We=>({label:We,value:We})),ve=(0,Je.w)().getVariables().map(We=>({label:"$"+We.name,value:"$"+We.name})),be=(0,a.useCallback)((We,Ze)=>{k({...G,sort:[Ze]})},[k,G]),Ue=G.sort?.length?G.sort:[{}];return(0,M.jsx)("div",{children:Ue.map((We,Ze)=>(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.sort-by-transformer-editor.label-field","Field"),labelWidth:10,grow:!0,children:(0,M.jsx)(le.l6,{options:[...re,...ve],value:We.field,placeholder:(0,ae.t)("transformers.sort-by-transformer-editor.placeholder-select-field","Select field"),onChange:at=>{be(Ze,{...We,field:at.value})}})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.sort-by-transformer-editor.label-reverse","Reverse"),children:(0,M.jsx)(rt.K,{value:!!We.desc,onChange:()=>{be(Ze,{...We,desc:!We.desc})}})})]},`${We.field}/${Ze}`))})},bi={id:Y.F.sortBy,editor:Di,transformation:Q.c.sortByTransformer,name:Q.c.sortByTransformer.name,description:Q.c.sortByTransformer.description,categories:new Set([i.m.ReorderAndRename]),help:fe(Y.F.sortBy).helperDocs},Ci=({options:z,onChange:G})=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.transpose-transfomer-editor.label-first-field-name","First field name"),labelWidth:24,children:(0,M.jsx)($t.p,{placeholder:(0,ae.t)("transformers.transpose-transfomer-editor.placeholder-field","Field"),value:z.firstFieldName,onChange:k=>G({...z,firstFieldName:k.currentTarget.value}),width:25})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.transpose-transfomer-editor.label-remaining-fields-name","Remaining fields name"),tooltip:(0,ae.t)("transformers.transpose-transfomer-editor.tooltip-name-for-value-fields","Name for value fields"),labelWidth:24,children:(0,M.jsx)($t.p,{placeholder:(0,ae.t)("transformers.transpose-transfomer-editor.placeholder-value","Value"),value:z.restFieldsName,onChange:k=>G({...z,restFieldsName:k.currentTarget.value}),width:25})})})]}),Zr={id:Y.F.transpose,editor:Ci,transformation:Q.c.transposeTransformer,name:Q.c.transposeTransformer.name,description:Q.c.transposeTransformer.description,categories:new Set([i.m.Reformat])};var jo=e(43243);function Bo({options:z,onChange:G}){const[k,re]=(0,a.useState)(z),ue=Mi(),ve=qr(),be=()=>{k.push({path:""}),re([...k]),Ze()},Ue=at=>{k&&(k.splice(at,1),re([...k]),Ze())},We=(at,ct,gt)=>{k&&(gt==="alias"?k[ct].alias=at.currentTarget.value??"":k[ct].path=at.currentTarget.value??"",re([...k]))},Ze=()=>{G(k)};return(0,M.jsxs)("ol",{className:(0,_e.cx)(ve.list),children:[k&&k.map((at,ct)=>(0,M.jsx)("li",{children:(0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.jsonpath-editor.label-field","Field"),tooltip:ue.field,grow:!0,children:(0,M.jsx)($t.p,{onBlur:Ze,onCh
1557ange:gt=>We(gt,ct,"path"),value:at.path,placeholder:(0,ae.t)("transformers.jsonpath-editor.placeholder-valid-objectvalue",'A valid json path, e.g. "object.value1" or "object.value2[0]"')})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.jsonpath-editor.label-alias","Alias"),tooltip:ue.alias,children:(0,M.jsx)($t.p,{width:12,value:at.alias,onBlur:Ze,onChange:gt=>We(gt,ct,"alias")})}),(0,M.jsx)(q.I,{className:(0,_e.cx)(ve.removeIcon),children:(0,M.jsx)(ba.K,{onClick:()=>Ue(ct),name:"trash-alt",tooltip:(0,ae.t)("transformers.jsonpath-editor.tooltip-remove-path","Remove path")})})]})},ct)),(0,M.jsx)(q.I,{children:(0,M.jsx)(oe.$n,{icon:"plus",onClick:()=>be(),variant:"secondary",children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.jsonpath-editor.add-path",children:"Add path"})})})]})}const Mi=()=>{const z=[{path:"object",description:"=> extract fields from object"},{path:"object.value1",description:"=> extract value1"},{path:"object.value2",description:"=> extract value2"},{path:"object.value2[0]",description:"=> extract value2 first element"},{path:"object.value2[1]",description:"=> extract value2 second element"}];return{field:(0,M.jsxs)("div",{children:["A valid path of an json object.",(0,M.jsx)("div",{children:(0,M.jsx)("strong",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.get-tooltips.json-value",children:"JSON Value:"})})}),(0,M.jsx)("pre",{children:(0,M.jsx)("code",{children:["{",' "object": {',' "value1": "hello world"',' "value2": [1, 2, 3, 4]'," }","}"].join(` 1558`)})}),(0,M.jsx)("strong",{children:"Valid Paths:"}),z.map((G,k)=>(0,M.jsxs)("p",{children:[(0,M.jsx)("code",{children:G.path}),(0,M.jsx)("i",{children:G.description})]},k))]}),alias:"An alias name for the variable in the dashboard. If left blank the given path will be used."}};function qr(){return{list:(0,_e.css)({marginLeft:"20px"}),removeIcon:(0,_e.css)({margin:"0 0 0 4px",alignItems:"center"})}}var ir=e(41119),za=(z=>(z.JSON="json",z.KeyValues="kvp",z.Auto="auto",z.RegExp="regexp",z.Delimiter="delimiter",z))(za||{});const Uo={id:za.JSON,name:"JSON",description:"Parse JSON string",getParser:z=>G=>JSON.parse(G)},eo={id:za.RegExp,name:"RegExp",description:"Parse with RegExp",getParser:z=>{let G=/(?<NewField>.*)/;if((0,as.AP)(z.regExp))try{G=(0,as.dO)(z.regExp)}catch(k){k instanceof Error&&console.warn(k.message)}return k=>k.match(G)?.groups}};function Si(z){const G=[];let k="",re="";const ue={};for(let ve=0;ve<z.length;ve++){let be=z[ve];be===k&&(k="",be=z[++ve]);const Ue=be==="\\";if(Ue&&(be=z[++ve]),Ue||k.length){G.push(be);continue}switch((be==='"'||be==="'")&&(k=be),be){case":":case"=":G.length&&(re&&(ue[re]=""),re=G.join(""),G.length=0);break;case'"':case"'":case" ":case" ":case"\r":case` 1559`:G.length&&re===""&&(ue[G.join("")]="",G.length=0);case",":case";":case"&":case"{":case"}":if(G.length){const We=G.join("");re.length?(ue[re]=We,re=""):re=We,G.length=0}break;default:G.push(be),ve===z.length-1&&re===""&&G.length&&(ue[G.join("")]="",G.length=0)}}return re.length&&(ue[re]=G.join("")),ue}const No={id:za.KeyValues,name:"Key+value pairs",description:"Look for a=b, c: d values in the line",getParser:z=>Si},Wo={id:za.Delimiter,name:"Split by delimiter",description:"Splits at delimited values, such as commas",getParser:({delimiter:z=","})=>{const G=new RegExp(`\\s*${(0,as.jD)(z)}\\s*`,"g");return k=>{const re=k.trim().split(G),ue={};for(const ve of re)ue[ve]=1;return ue}}},Fo=[Uo,No,Wo,eo],Ti={id:za.Auto,name:"Auto",description:"parse new fields automatically",getParser:z=>{const G=Fo.map(k=>k.getParser(z));return k=>{for(const re of G)try{const ue=re(k);if(ue!=null)return ue}catch{}}}},to=new me.O(()=>[...Fo,Ti]),no={id:Y.F.extractFields,name:"Extract fields",description:"Parse fields from the contends of another",defaultOptions:{delimiter:","},operator:(z,G)=>k=>k.pipe((0,Fn.T)(re=>no.transformer(z,G)(re))),transformer:z=>G=>G.map(k=>Oi(k,z))};function Oi(z,G){if(!G.source)return z;const k=(0,ma.findField)(z,G.source);if(!k)return z;const re=to.getIfExists(G.format??za.Auto);if(!re)throw new Error("unkonwn extractor");const ue=z.length,ve=[],be=new Map,Ue=re.getParser(G);for(let Ze=0;Ze<ue;Ze++){let at=k.values[Ze];if((0,H.isString)(at))try{at=Ue(at)}catch{at={}}if(at!=null){if(G.format===za.JSON&&G.jsonPaths&&G.jsonPaths?.length>0){const ct={},gt=G.jsonPaths.filter(pt=>pt.path);gt.length>0&&(gt.forEach(pt=>{const ht=pt.alias&&pt.alias.length>0?pt.alias:pt.path;ct[ht]=(0,H.get)(at,pt.path)??"Not Found"}),at=ct)}for(const[ct,gt]of Object.entries(at)){let pt=be.get(ct);
1559pt==null&&(pt=new Array(ue).fill(void 0),be.set(ct,pt),ve.push(ct)),pt[Ze]=gt}}}const We=ve.map(Ze=>{const at=be.get(Ze);if(!at)throw new Error(`Could not find field with name: ${Ze}`);const ct={name:Ze,values:at,type:at?(0,ir.oE)(at.find(gt=>gt!=null)):_.PU.other,config:{}};return F.$.featureToggles.extractFieldsNameDeduplication&&(ct.name=(0,te.fk)(ct,z)),ct});if(G.keepTime){const Ze=(0,ma.findField)(z,"Time")||(0,ma.findField)(z,"time");Ze&&We.unshift(Ze)}return G.replace||We.unshift(...z.fields),{...z,fields:We}}const Ii={settings:{width:30,placeholderText:"Select field"},name:"",id:"",editor:()=>null},Or=({input:z,options:G={delimiter:","},onChange:k})=>{const re=ct=>{k({...G,source:ct})},ue=ct=>{k({...G,format:ct?.value})},ve=ct=>{k({...G,jsonPaths:ct})},be=ct=>{k({...G,regExp:ct.target.value})},Ue=ct=>{k({...G,delimiter:ct.value})},We=()=>{G.replace&&(G.keepTime=!1),k({...G,replace:!G.replace})},Ze=()=>{k({...G,keepTime:!G.keepTime})},at=to.selectOptions(G.format?[G.format]:void 0);return(0,M.jsxs)("div",{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.extract-fields-transformer-editor.label-source","Source"),labelWidth:16,children:(0,M.jsx)(Xn.O,{context:{data:z},value:G.source??"",onChange:re,item:Ii})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.extract-fields-transformer-editor.label-format","Format"),labelWidth:16,children:(0,M.jsx)(le.l6,{value:at.current[0],options:at.options,onChange:ue,width:24,placeholder:(0,ae.t)("transformers.extract-fields-transformer-editor.placeholder-auto","Auto")})})}),G.format===za.RegExp&&(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:"RegExp",labelWidth:16,interactive:!0,tooltip:"Example: /(?<NewField>.*)/",children:(0,M.jsx)($t.p,{placeholder:"/(?<NewField>.*)/",value:G.regExp,onChange:be})})}),G.format===za.JSON&&(0,M.jsx)(Bo,{options:G.jsonPaths??[],onChange:ve}),G.format===za.Delimiter&&(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.extract-fields-transformer-editor.label-delimiter","Delimiter"),labelWidth:16,children:(0,M.jsx)(jo.G,{value:G.delimiter,options:[{value:","},{value:";"},{value:"|"}],onChange:Ue,placeholder:(0,ae.t)("transformers.extract-fields-transformer-editor.placeholder-select-delimiter","Select delimiter..."),width:24})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.extract-fields-transformer-editor.label-replace-all-fields","Replace all fields"),labelWidth:16,children:(0,M.jsx)(rt.K,{value:G.replace??!1,onChange:We})})}),G.replace&&(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.extract-fields-transformer-editor.label-keep-time","Keep time"),labelWidth:16,children:(0,M.jsx)(rt.K,{value:G.keepTime??!1,onChange:Ze})})})]})},Ri={id:Y.F.extractFields,editor:Or,transformation:no,name:no.name,description:"Parse fields from content (JSON, labels, etc).",categories:new Set([i.m.Reformat]),help:fe(Y.F.extractFields).helperDocs};var ao=e(59695);const Ys={id:Y.F.joinByLabels,name:"Join by labels",description:"Flatten labeled results into a table joined by labels.",defaultOptions:{},operator:(z,G)=>k=>k.pipe((0,Fn.T)(re=>Ys.transformer(z,G)(re))),transformer:z=>G=>!G||!G.length?G:[bl(z,G)]};function bl(z,G){if(!z.value?.length)return so("No value label configured");const k=(0,Te.aG)(G);if(k.size<1)return so("No labels in result");if(!k.has(z.value))return so("Value label not found");let re=z.join?.length?z.join:Array.from(k);re=re.filter(ct=>ct!==z.value);const ue=new Set,ve=new Map,be={};for(const ct of G)for(const gt of ct.fields)if(gt.labels&>.type!==_.PU.time){const pt=re.map(In=>gt.labels[In]),ht=pt.join(",");let vt=ve.get(ht);vt||(vt={keys:pt,values:{}},ve.set(ht,vt));const Ft=gt.labels[z.value],sn=gt.values,fn=vt.values[Ft];fn?vt.values[Ft]=fn.concat(sn):vt.values[Ft]=sn,be[Ft]||(be[Ft]=gt),ue.add(Ft)}const Ue=Array.from(ue),We=re.map(()=>[]),Ze=Ue.map(()=>[]);for(const ct of ve.values()){let gt=-1,pt=!1;for(;!pt;){gt++,pt=!0;for(let ht=0;ht<re.length;ht++)We[ht].push(ct.keys[ht]);for(let ht=0;ht<Ue.length;ht++){const vt=Ue[ht],Ft=ct.values[vt]??[];Ze[ht].push(Ft[gt]),Ft.length>gt+1&&(pt=!1)}}}const at={fields:[],length:Ze[0].length,refId:`${Y.F.joinByLabels}-${G.map(ct=>ct.refId).join("-")}`};for(let ct=0;ct<re.length;ct++)at.fields.push({name:re[ct],config:{},type:_.PU.string,values:We[ct]});for(let ct=0;ct<Ue.length;ct++){const gt=be[Ue[ct]];at.fields.push({name:Ue[ct],config:{},type:gt.type??_.PU.number,values:Ze[ct]})}return at}function so(z){return{meta:{notices:[{severity:"error",text:z}]},fields:[{name:"Error",type:_.PU.string,config:{},values:[z]}],length:0}}function Ai({input:z,options:G,onChange:k}){const re=(0,a.useMemo)(()=>{let We;const Ze=(0,Te.aG)(z),at=Array.from(Ze).map(Ft=>({label:Ft,value:Ft}));let ct=at.find(Ft=>Ft.value===G.value);!ct&&G.value&&(ct={label:`${G.value} (not found)`,value:G.value},at.push(ct)),z.length?Ze.size===0&&(We=(0,M.jsx)(ss.F,{title:(0,ae.t)("transformers.join-by-labels-transformer-editor.info.title-no-labels-found","No labels found"),children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.join-by-labels-transformer-editor.info.input-contain-labels",children:"The input does not contain any labels"})})):We=(0,M.jsx)(ss.F,{title:(0,ae.t)("transformers.join-by-labels-transformer-editor.info.title-no-input-found","No input found"),children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.join-by-labels-transformer-editor.info.no-input-or-labels-found",children:"No input (or labels) found"})}),Ze.delete(G.value);const gt=Array.from(Ze).map(Ft=>({label:Ft,value:Ft}));let pt=gt;const ht=!!G.join?.length;let vt="Join";return ht?pt=gt.filter(Ft=>!G.join.includes(Ft.value)):vt=gt.map(Ft=>Ft.value).join(", "),{warn:We,valueOptions:at,valueOption:ct,joinOptions:gt,addOptions:pt,addText:vt,hasJoin:ht,key:Date.now()}},[G,z]),ue=(We,Ze)=>{if(!G.join)return;const at=G.join.slice();if(Ze)at[We]=Ze;else if(at.splice(We,1),!at.length){k({...G,join:void 0});return}const ct=new Set(at);G.value&&ct.delete(G.value),k({...G,join:Array.from(ct)})},ve=We=>{const Ze=We?.value;if(!Ze)return;const at=G.join?G.join.slice():[];at.push(Ze),k({...G,join:at})},be=10,Ue="No labels found";return(0,M.jsxs)("div",{children:[re.warn,(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{error:"required",invali
1559d:!G.value?.length,label:(0,ae.t)("transformers.join-by-labels-transformer-editor.label-value","Value"),labelWidth:be,tooltip:(0,ae.t)("transformers.join-by-labels-transformer-editor.tooltip-select-label-indicating-values","Select the label indicating the values name"),children:(0,M.jsx)(le.l6,{options:re.valueOptions,value:re.valueOption,onChange:We=>k({...G,value:We.value}),noOptionsMessage:Ue})})}),re.hasJoin?G.join.map((We,Ze)=>(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.join-by-labels-transformer-editor.label-join","Join"),labelWidth:be,error:"Unable to join by the value label",invalid:We===G.value,children:(0,M.jsxs)(Da.Gy,{children:[(0,M.jsx)(le.l6,{options:re.joinOptions,value:re.joinOptions.find(at=>at.value===We),isClearable:!0,onChange:at=>ue(Ze,at?.value),noOptionsMessage:Ue}),!!(re.addOptions.length&&Ze===G.join.length-1)&&(0,M.jsx)(ao.i,{icon:"plus",label:"",options:re.addOptions,onChange:ve,variant:"secondary"})]})})},We+Ze)):(0,M.jsx)(M.Fragment,{children:!!re.addOptions.length&&(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.join-by-labels-transformer-editor.label-join","Join"),labelWidth:be,children:(0,M.jsx)(le.l6,{options:re.addOptions,placeholder:re.addText,onChange:ve,noOptionsMessage:Ue})})})})]})}const ro={id:Ys.id,editor:Ai,transformation:Ys,name:Ys.name,description:Ys.description,state:xe.pn.beta,categories:new Set([i.m.Combine]),help:fe(Ys.id).helperDocs};var Li=e(93139),lr=e(69862),cr=e(65474),Ko=e(46189);
1559const wo={id:Y.F.fieldLookup,name:"Lookup fields from resource",description:"Retrieve matching data based on specified field",defaultOptions:{},operator:z=>G=>G.pipe((0,lr.Z)(k=>(0,cr.H)(ji(k,z))))};async function ji(z,G){const k=Z.sJ.get(ne.Ct.byName).get(G?.lookupField),re=await(0,Ko.q3)(G?.gazetteer??Ko.fx);return re.frame?Vo(z,re,k):Promise.reject("missing frame in gazetteer")}function Vo(z,G,k){const re=G.frame()?.fields;return re?z.map(ue=>{const ve=ue.length,be=[];for(const Ue of ue.fields)if(be.push(Ue),k(Ue,ue,z)){const We=Ue.values,Ze=[];for(const at of re){const ct=new Array(ve);Ze.push(ct),be.push({...at,values:ct})}for(let at=0;at<G.count;at++){const ct=G.find(We[at]);if(ct?.index!=null)for(let gt=0;gt<re.length;gt++)Ze[gt][at]=re[gt].values[ct.index]}}return{...ue,fields:be}}):z}const Bi={settings:{width:30,filter:z=>z.type===_.PU.string,placeholderText:"Select text field",noFieldsMessage:"No text fields found"},name:"",id:"",editor:()=>null},Ui={settings:{}},Ni=({input:z,options:G,onChange:k})=>{const re=(0,a.useCallback)(ve=>{k({...G,lookupField:ve})},[k,G]),ue=(0,a.useCallback)(ve=>{k({...G,gazetteer:ve})},[k,G]);return(0,M.jsxs)("div",{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.field-lookup-transformer-editor.label-field","Field"),labelWidth:12,children:(0,M.jsx)(Xn.O,{context:{data:z},value:G?.lookupField??"",onChange:re,item:Bi})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.field-lookup-transformer-editor.label-lookup","Lookup"),labelWidth:12,children:(0,M.jsx)(Li.G,{value:G?.gazetteer??"",context:{data:z},item:Ui,onChange:ue})})})]})},$o={id:Y.F.fieldLookup,editor:Ni,transformation:wo,name:wo.name,description:"Use a field value to lookup additional fields from an external source. This currently supports spatial data, but will eventually support more formats.",state:xe.pn.alpha,categories:new Set([i.m.PerformSpatialOperations]),help:fe(Y.F.fieldLookup).helperDocs};var zo=e(359),Ho=e(1027);const Go=(z,G,k=[])=>(G===0?k.push(z):z.forEach(re=>{Go(re,G-1,k)}),k);function Wi(z){const G=z[0].length,k=z.length,re=new Map;for(let ue=0;ue<G;ue++){let ve=re;for(let be=0;be<k;be++){let Ue=z[be][ue],We=ve.get(Ue);We==null&&(We=be===k-1?[]:new Map,ve.set(Ue,We)),ve=We}ve.push(ue)}return Go(re,k)}const Fi={asLabels:!0,append:!1,withNames:!1,separator1:"=",separator2:" "};function oo(z,G,k){return G.map((re,ue)=>z.withNames?`${re}${z.separator1}${k[ue]}`:k[ue]).join(z.separator2)}function Ki(z,G){const k={};return z.forEach((re,ue)=>{k[re]=String(G[ue])}),k}const Ir={id:Y.F.partitionByValues,name:"Partition by values",description:"Splits a one-frame dataset into multiple series discriminated by unique/enum values in one or more fields.",defaultOptions:{keepFields:!1},operator:(z,G)=>k=>k.pipe((0,Fn.T)(re=>Ir.transformer(z,G)(re))),transformer:(z,G)=>{const k=(0,zo.R)({names:z.fields});if(!k)return Ho.W.transformer({},G);const re=(0,Z.NS)(k);return ue=>ue.length?_o(ue[0],re,z):ue}};function _o(z,G,k){const re=z.fields.filter(Ue=>G(Ue,z,[z]));if(!re.length)return[z];const ue=re.map(Ue=>Ue.values),ve=re.map(Ue=>Ue.name),be={...Fi,...k?.naming};return Wi(ue).map(Ue=>{let We=z.name,Ze={};if(be.asLabels)Ze=Ki(ve,re.map((ct,gt)=>ue[gt][Ue[0]]));else{let ct=oo(be,ve,re.map((gt,pt)=>ue[pt][Ue[0]]));be?.append&&z.name&&(ct=`${z.name} ${ct}`),We=ct}let at=z.fields;if(!k?.keepFields){const ct=new Set(ve);at=z.fields.filter(gt=>!ct.has(gt.name))}return{name:We,meta:z.meta,length:Ue.length,fields:at.map(ct=>{const gt=ct.values,pt=Array(Ue.length);for(let ht=0;ht<Ue.length;ht++)pt[ht]=gt[Ue[ht]];return{name:ct.name,type:ct.type,config:ct.config,labels:{...ct.labels,...Ze},values:pt}})}})}function wi({input:z,options:G,onChange:k}){const re=(0,pn.sE)(z),ue=(0,pn.m3)(re),ve=(0,a.useMemo)(()=>{const gt=new Set(G.fields);return gt.size<1?ue:ue.filter(pt=>!gt.has(pt.value))},[ue,G]),be=(0,a.useCallback)(gt=>{if(!gt.value)return;const pt=new Set(G.fields);pt.add(gt.value),k({...G,fields:[...pt]})},[k,G]);let Ue;(gt=>{gt[gt.asLabels=0]="asLabels",gt[gt.frameName=1]="frameName"})(Ue||(Ue={}));const We=[{label:"As label",value:0},{label:"As frame name",value:1}],Ze=[{label:"Yes",value:!0},{label:"No",value:!1}],at=(0,a.useCallback)(gt=>{if(!gt)return;const pt=new Set(G.fields);pt.delete(gt),k({...G,fields:[...pt]})},[k,G]);if(z.length>1)return(0,M.jsx)(Ha.P,{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.partition-by-values-editor.partition-values-works-single-frame",children:"Partition by values only w
1559orks with a single frame."})});const ct=[...new Set(G.fields)];return(0,M.jsxs)("div",{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.partition-by-values-editor.label-field","Field"),labelWidth:10,grow:!0,children:(0,M.jsxs)(Da.Gy,{children:[ct.map(gt=>(0,M.jsx)(oe.$n,{icon:"times",variant:"secondary",size:"md",onClick:()=>at(gt),children:gt},gt)),ve.length&&(0,M.jsx)(ao.i,{variant:"secondary",size:"md",options:ve,onChange:be,label:(0,ae.t)("transformers.partition-by-values-editor.label-select-field","Select field"),icon:"plus"})]})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{tooltip:(0,ae.t)("transformers.partion-by-values-editor.tooltip-naming","Sets how the names of the selected fields are displayed. As frame name is usually better for tabular data"),label:(0,ae.t)("transformers.partition-by-values-editor.label-naming","Naming"),labelWidth:10,children:(0,M.jsx)(X.z,{options:We,value:G.naming?.asLabels===void 0||G.naming.asLabels?0:1,onChange:gt=>k({...G,naming:{...G.naming,asLabels:gt===0}})})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{tooltip:(0,ae.t)("transformers.partition-by-values-editor.tooltip-keeps-partition-fields-frames","Keeps the partition fields in the frames"),label:(0,ae.t)("transformers.partition-by-values-editor.label-keep-fields","Keep fields"),labelWidth:16,children:(0,M.jsx)(X.z,{options:Ze,value:G.keepFields,onChange:gt=>k({...G,keepFields:gt})})})})]})}const Vi={id:Y.F.partitionByValues,editor:wi,transformation:Ir,name:Ir.name,description:Ir.description,state:xe.pn.alpha,categories:new Set([i.m.Reformat]),help:fe(Y.F.partitionByValues).helperDocs};var Js=e(39443),io=e(18700),$i=e(8721),sa=(z=>(z.TimeSeriesWide="wide",z.TimeSeriesLong="long",z.TimeSeriesMulti="multi",z.TimeSeriesMany="many",z))(sa||{});function Qo(z){if(!Array.isArray(z)||z.length===0)return z;const G=[];for(const k of ko(z)){const re=k.fields[0];if(!re||re.type!==_.PU.time)continue;const ue=[],ve=[];for(const be of k.fields)switch(be.type){case _.PU.number:case _.PU.boolean:ue.push(be);break;case _.PU.string:ve.push(be);break}for(const be of ue)if(ve.length){const Ue=new Map;for(let We=0;We<k.length;We++){const Ze=re.values[We],at=be.values[We];if(at===void 0||Ze==null)continue;const ct=ve.map(pt=>pt.values[We]).join("/");let gt=Ue.get(ct);if(!gt){gt={key:ct,time:[],value:[],labels:{}};for(const pt of ve)gt.labels[pt.name]=pt.values[We];Ue.set(ct,gt)}gt.time.push(Ze),gt.value.push(at)}for(const We of Ue.values())G.push({name:k.name,refId:k.refId,meta:{...k.meta,type:Js.m.TimeSeriesMulti},fields:[{...re,values:We.time},{...be,values:We.value,labels:We.labels}],length:We.time.length})}else G.push({name:k.name,refId:k.refId,meta:{...k.meta,type:Js.m.TimeSeriesMulti},fields:[re,be],length:k.length})}return G}function ko(z){if(!Array.isArray(z)||z.length===0)return z;const G=[];for(const k of z){let re;const ue=[],ve={},be={},Ue={},We={};for(let ht=0;ht<k.fields.length;ht++){const vt=k.fields[ht];switch(vt.type){case _.PU.string:case _.PU.boolean:vt.name in We||(We[vt.name]=ht,be[vt.name]=!0);break;case _.PU.time:if(!re){re=vt;break}default:if(vt.name in ve){const fn=ve[vt.name];if(vt.type!==fn)continue}else ve[vt.name]=vt.type,ue.push(vt.name);const Ft=JSON.stringify(vt.labels),sn=Ue[Ft];if(sn!==void 0?sn.push(ht):Ue[Ft]=[ht],vt.labels!=null)for(const fn in vt.labels)be[fn]=!0}}if(!re)continue;const Ze=[],at=[],ct=[],gt=[];for(let ht=0;ht<k.length;ht++)Ze.push({time:re.values[ht],wideRowIndex:ht});for(const ht in Ue)at.push(ht);for(const ht in be)ct.push(ht);for(const ht in We)gt.push(ht);Ze.sort((ht,vt)=>ht.time-vt.time),at.sort(),ct.sort(),ue.sort();const pt=new io.k({...k,meta:{...k.meta,type:Js.m.TimeSeriesLong},fields:[{name:re.name,type:re.type}]});for(const ht of ue)pt.addField({name:ht,type:ve[ht]});for(const ht of ct)pt.addField({name:ht,type:_.PU.string});for(const ht of Ze){const{time:vt,wideRowIndex:Ft}=ht;for(const sn of at){const fn={};for(const Dn of gt)fn[Dn]=k.fields[We[Dn]].values[Ft];let In=0;for(const Dn of Ue[sn]){const ua=k.fields[Dn];if(In++===0&&ua.labels!=null)for(const fa in ua.labels)fn[fa]=ua.labels[fa];fn[ua.name]=ua.values[Ft]}fn[re.name]=vt,pt.add(fn)}}G.push(pt)}return G}function lo(z){return _o(z,k=>k.type===_.PU.string).map(k=>(k.meta||(k.meta={}),k.meta.type=Js.m.TimeSeriesMulti,k))}const hs={id:Y.F.prepareTimeSeries,name:"Prepare time series",description:"Will stretch data frames from the wide format into the long format. This is really helpful to be able to keep backwards compatibility for panels not supporting the new wide format.",defaultOptions:{},operator:(z,G)=>k=>k.pipe((0,Fn.T)(re=>hs.transformer(z,G)(re))),transformer:z=>{const G=z?.format??"wide";if(G==="many"||G==="multi")return Qo;if(G==="long")return ko;const k=Z.sJ.get(ne.Ct.firstTimeField).get({});return re=>{if(!re.length)return[];const ue=[];for(const be of re)be.meta?.type===Js.m.TimeSeriesLong?lo(be).forEach(Ue=>ue.push(Ue)):ue.push(be);const ve=(0,$i.Fd)({frames:ue,joinBy:k,keepOriginIndices:!0});return ve?(ve.meta||(ve.meta={}),ve.meta.type=Js.m.TimeSeriesWide,[ve]):[]}}},zi={label:"Wide time series",value:sa.TimeSeriesWide,description:"Creates a single frame joined by time",info:(0,M.jsxs)("ul",{children:[(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.wide-info.single-frame",children:"Single frame"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.wide-info.st-field-is-shared-time",children:"1st field is shared time field"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.wide-info.time-in-ascen
1559ding-order",children:"Time in ascending order"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.wide-info.multiple-value-fields-of-any-type",children:"Multiple value fields of any type"})})]})},Hi={label:"Multi-frame time series",value:sa.TimeSeriesMulti,description:"Creates a new frame for each time/number pair",info:(0,M.jsxs)("ul",{children:[(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.multi-info.multiple-frames",children:"Multiple frames"})}),(0,M.jsx)("li",{children:(0,M.jsxs)(ae.x6,{i18nKey:"transformers.multi-info.frame-fields-value",values:{field1:"time",field2:"value"},children:["Each frame has two fields: ","{{field1}}",", ","{{field2}}"]})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.multi-info.time-in-ascending-order",children:"Time in ascending order"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.multi-info.string-values-are-represented-as-labels",children:"String values are represented as labels"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.multi-info.all-values-are-numeric",children:"All values are numeric"})})]})},Gi={label:"Long time series",value:sa.TimeSeriesLong,description:"Convert each frame to long format",info:(0,M.jsxs)("ul",{children:[(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.long-info.single-frame",children:"Single frame"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.long-info.st-field-is-time",children:"1st field is time field"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.long-info.ascending-order-duplicates",children:"Time in ascending order, but may have duplicates"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.long-info.string-values-separate",children:"String values are represented as separate fields rather than as labels"})}),(0,M.jsx)("li",{children:(0,M.jsx)(ae.x6,{i18nKey:"transformers.long-info.multiple-value-fields-may-exist",children:"Multiple value fields may exist"})})]})},dr=[zi,Hi,Gi];function Yo(z){const{options:G,onChange:k}=z,re=(0,xt.of)(Jo),ue=(0,a.useCallback)(ve=>{k({...G,format:ve.value})},[k,G]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.prepare-time-series-editor.label-format","Format"),labelWidth:12,children:(0,M.jsx)(le.l6,{width:35,options:dr,value:dr.find(ve=>ve.value===sa.TimeSeriesMulti&&G.format===sa.TimeSeriesMany?!0:ve.value===G.format)||dr[0],onChange:ue,className:"flex-grow-1"})})}),(0,M.jsx)(de.C,{children:(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.prepare-time-series-editor.label-info","Info"),labelWidth:12,children:(0,M.jsx)("div",{className:re.info,children:(dr.find(ve=>ve.value===G.format)||dr[0]).info})})})]})}const Jo=z=>({info:(0,_e.css)({marginLeft:"20px"})}),Xo={id:hs.id,editor:Yo,transformation:hs,name:hs.name,description:hs.description,categories:new Set([i.m.Reformat]),help:fe(hs.id).helperDocs};var Zo=e(66648),_i=e(48817),Rr=(z=>(z.linear="linear",z.polynomial="polynomial",z))(Rr||{});const ur={predictionCount:100,modelType:"linear",degree:2},hr={id:Y.F.regression,name:"Regression analysis",operator:(z,G)=>k=>k.pipe((0,Fn.T)(re=>hr.transformer(z,G)(re))),transformer:(z,G)=>k=>{const{predictionCount:re,modelType:ue,degree:ve}={...ur,...z};if(k.length===0)return k;const be=Z.sJ.get(ne.Ct.byName).get(z.yFieldName),Ue=Z.sJ.get(ne.Ct.byName).get(z.xFieldName);let We,Ze,at;for(const Dn of k){const ua=Dn.fields.find(fa=>be(fa,Dn,k));if(ua){Ze=ua;const fa=Dn.fields.find(Es=>Ue(Es,Dn,k));if(fa){We=fa,at=Dn;break}else throw"X and Y fields must be part of the same frame"}}if(!We||!Ze)return k;let ct=We.values[0],gt=We.values[0];for(let Dn=1;Dn<We.values.length;Dn++)We.values[Dn]<ct&&(ct=We.values[Dn]),We.values[Dn]>gt&&(gt=We.values[Dn]);const pt=(gt-ct)/(re-1),ht=[...[...Array(re-1).keys()].map((Dn,ua)=>ua*pt+ct),gt],vt=We.type===_.PU.time?ct:0,Ft=[],sn=[];for(let Dn=0;Dn<We.values.length;Dn++)Ze.values[Dn]!==null&&!isNaN(Ze.values[Dn])&&(sn.push(We.values[Dn]-vt),Ft.push(Ze.values[Dn]));let fn;switch(ue){case"linear":fn=new _i.X(sn,Ft);break;case"polynomial":fn=new Zo.Y(sn,Ft,ve);break;default:return k}const In={name:`${ue} regression`,length:ht.length,fields:[{name:We.name,type:We.type,values:ht,config:{}},{name:`${(0,te.Ct)(Ze,at,k)} predicted`,type:Ze.type,values:ht.map(Dn=>fn.predict(Dn-vt)),config:{}}]};return[...k,In]}},fs={editor:Xn.O,id:"",name:"",settings:{width:24,isClearable:!1}},ws=20,qo=({input:z,options:G,onChange:k})=>{const re=[{label:"Linear",value:Rr.linear},{label:"Polynomial",value:Rr.polynomial}];return(0,a.useEffect)(()=>{let ue,ve;if(!G.xFieldName){const be=Z.sJ.get(ne.Ct.firstTimeField).get({});for(const Ue of z)if(ue=Ue.fields.find(We=>be(We,Ue,z)),ue)break;
1559if(!ue){const Ue=Z.sJ.get(ne.Ct.numeric).get({});for(const We of z)if(ue=We.fields.find(Ze=>Ue(Ze,We,z)),ue)break}}if(!G.yFieldName){const be=Z.sJ.get(ne.Ct.numeric).get({});for(const Ue of z)if(ve=Ue.fields.find(We=>be(We,Ue,z)&&We!==ue),ve)break}ue&&ve&&k({...G,xFieldName:ue.name,yFieldName:ve.name})}),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(q.I,{labelWidth:ws,label:(0,ae.t)("transformers.regression-transformer-editor.label-x-field","X field"),children:(0,M.jsx)(Xn.O,{context:{data:z},value:G.xFieldName??"",item:fs,onChange:ue=>{k({...G,xFieldName:ue})}})}),(0,M.jsx)(q.I,{labelWidth:ws,label:(0,ae.t)("transformers.regression-transformer-editor.label-y-field","Y field"),children:(0,M.jsx)(Xn.O,{context:{data:z},value:G.yFieldName??"",item:fs,onChange:ue=>{k({...G,yFieldName:ue})}})}),(0,M.jsx)(q.I,{labelWidth:ws,label:(0,ae.t)("transformers.regression-transformer-editor.label-model-type","Model type"),children:(0,M.jsx)(le.l6,{value:G.modelType??ur.modelType,onChange:ue=>{k({...G,modelType:ue.value??ur.modelType})},options:re})}),(0,M.jsx)(q.I,{labelWidth:ws,label:(0,ae.t)("transformers.regression-transformer-editor.label-predicted-points","Predicted points"),tooltip:(0,ae.t)("transformers.regression-transformer-editor.tooltip-number-of-xy-points-to-predict","Number of X,Y points to predict"),children:(0,M.jsx)(St.Q,{value:G.predictionCount??ur.predictionCount,onChange:ue=>{k({...G,predictionCount:ue})}})}),G.modelType===Rr.polynomial&&(0,M.jsx)(q.I,{labelWidth:ws,label:(0,ae.t)("transformers.regression-transformer-editor.label-degree","Degree"),children:(0,M.jsx)(le.l6,{value:G.degree??ur.degree,options:[{label:"Quadratic",value:2},{label:"Cubic",value:3},{label:"Quartic",value:4},{label:"Quintic",value:5}],onChange:ue=>{k({...G,degree:ue.value})}})})]})},ei={id:Y.F.regression,editor:qo,transformation:hr,name:hr.name,description:hr.description,categories:new Set([i.m.CalculateNewFields]),help:fe(Y.F.regression).helperDocs},fr={id:Y.F.rowsToFields,name:"Rows to fields",description:"Convert each row into a field with dynamic config.",defaultOptions:{},operator:z=>G=>G.pipe((0,Fn.T)(k=>k.map(re=>bs(z,re))))};function bs(z,G){const k=Nt(G,z.mappings??[],!0),{nameField:re,valueField:ue}=k;if(!re||!ue)return G;const ve=[];for(let be=0;be<re.values.length;be++){const Ue=re.values[be],We=ue.values[be],Ze=qt(G,be,k),at=As(G,be,k),ct={name:`${Ue}`,type:ue.type,values:[We],config:Ze,labels:at};ve.push(ct)}return{fields:ve,length:1,refId:`${Y.F.rowsToFields}-${G.refId}`}}function As(z,G,k){const re={...k.nameField.labels};for(let ue=0;ue<z.fields.length;ue++){const ve=z.fields[ue],be=(0,te.Ct)(ve,z),Ue=k.index[be];if(Ue.handler&&Ue.handler.key!==Yt.Label)continue;const We=ve.values[G];We!=null&&(re[be]=We)}return re}function Ls({input:z,options:G,onChange:k}){return z.length===0?null:(0,M.jsx)("div",{children:(0,M.jsx)(mn,{frame:z[0],mappings:G.mappings??[],onChange:re=>k({...G,mappings:re}),withNameAndValue:!0})})}const Qi={id:fr.id,editor:Ls,transformation:fr,name:fr.name,description:fr.description,state:xe.pn.beta,categories:new Set([i.m.Reformat]),help:fe(fr.id).helperDocs};var ti=e(739),pr=e(90267),La=e(90176),co=e(98643),Xs=e(87039),is=e(78089);const Ar={id:Y.F.spatial,name:"Spatial operations",description:"Apply spatial operations to query results.",defaultOptions:{},operator:z=>G=>G.pipe((0,lr.Z)(k=>(0,cr.H)(Yi(k,z))))};function ki(z){return z.action===La.dy.Modify&&z.modify?.op===La.YD.LineBuilder}async function Yi(z,G){const k=await(0,Xs.nE)(G.source);if(ki(G)){const re=await(0,Xs.nE)(G.modify?.target);return z.map(ue=>{const ve=(0,Xs.FM)(ue,k),be=(0,Xs.FM)(ue,re);if(ve.field&&be.field){const Ue=[...ue.fields],We=(0,co.XR)(ve.field,be.field),Ze=Ue[0];return Ze.type===_.PU.geo&&Ze!==ve.field&&Ze!==be.field?Ue[0]=(0,co.RA)(Ze,We):Ue.unshift(We),{...ue,fields:Ue}}return ue})}return z.map(re=>{let ue=(0,Xs.FM)(re,k);if(ue.field){if(G.action===La.dy.Modify){switch(G.modify?.op){case La.YD.AsLine:let be=ue.field.name;return(!be||be==="Point")&&(be="Line"),{...re,length:1,fields:[{...ue.field,name:be,type:_.PU.geo,values:[(0,is.tt)(ue.field)]}]}}return re}const ve=ue.derived?[ue.field,...re.fields]:re.fields.slice(0);if(G.action===La.dy.Calculate&&(ve.push((0,is.pp)(ue.field,G.calculate??{})),ue.derived=!0),ue.derived)return{...re,fields:ve}}return re})}const Lr=(z,G)=>{const k=G.options??{};z.addSelect({path:"action",name:"Action",description:"",defaultValue:La.dy.Prepare,settings:{options:[{value:La.dy.Prepare,label:"Prepare spatial field",description:"Set a geometry field based on the results of other fields"},{value:La.dy.Calculate,label:"Calculate value",description:"Use the geometry to define a new field (heading/distance/area)"},{value:La.dy.Modify,label:"Transform",description:"Apply spatial operations to the geometry"}]}}),k.action===La.dy.Calculate?z.addSelect({path:"calculate.calc",name:"Function",description:"",defaultValue:La.kD.Heading,settings:{options:[{value:La.kD.Heading,label:"Heading"},{value:La.kD.Area,label:"Area"},{value:La.kD.Distance,label:"Distance"}]}}):k.action===La.dy.Modify&&z.addSelect({path:"modify.op",name:"Operation",description:"",defaultValue:La.YD.AsLine,settings:{options:[{value:La.YD.AsLine,label:"As line",description:"Create a single line feature with a vertex at each row"},{value:La.YD.LineBuilder,label:"Line builder",description:"Create a line between two points"}]}}),ki(k)?(z.addNestedOptions({category:["Source"],path:"source",build:(re,ue)=>{const ve=k.source??{mode:ti.aG.Auto};(0,pr.G)("Point","",re,ve)}}),z.addNestedOptions({category:["Target"],path:"modify",build:(re,ue)=>{const ve=k.modify?.target??{mode:ti.aG.Auto};(0,pr.G)("Point","target.",re,ve)}})):(0,pr.G)("Location","source.",z,k.source)},ni=z=>{(0,a.useEffect)(()=>
1559{if(!z.options.source?.mode){const re=st(Lr);z.onChange({...re,...z.options}),console.log("geometry useEffect",re)}},[]);const G=Ji((0,xt.$j)()),k=Xe(z,Lr);return(0,M.jsxs)("div",{children:[(0,M.jsx)("div",{children:k.items.map(re=>re.render())}),(0,M.jsx)("div",{children:k.categories.map(re=>(0,M.jsxs)("div",{className:G.wrap,children:[(0,M.jsx)("h5",{children:re.props.title}),(0,M.jsx)("div",{className:G.item,children:re.items.map(ue=>ue.render())})]},re.props.id))})]})},Ji=z=>({wrap:(0,_e.css)({marginBottom:"20px"}),item:(0,_e.css)({borderLeft:`4px solid ${z.colors.border.strong}`,paddingLeft:"10px"})}),gr={id:Y.F.spatial,editor:ni,transformation:Ar,name:Ar.name,description:Ar.description,state:xe.pn.alpha,categories:new Set([i.m.PerformSpatialOperations]),help:fe(Y.F.spatial).helperDocs};var Zs=e(39884);const qs={id:Y.F.timeSeriesTable,name:"Time series to table",description:"Convert time series data to table rows so that they can be viewed in tabular or sparkline format.",defaultOptions:{},isApplicable:z=>{for(const G of z)if((0,Zs.aH)(G))return $a.M.Applicable;return $a.M.NotApplicable},isApplicableDescription:"The Time series to table transformation requires at least one time series frame to function. You currently have none.",operator:z=>G=>G.pipe((0,Fn.T)(k=>ps(z,k)))};function ps(z,G){const k={},re={},ue=[];let ve=ai(G);for(const be of Object.keys(ve)){const Ue=G.filter(Ze=>Ze.refId===be);k[be]={},re[be]={};const We=[];Ue.forEach(Ze=>{Ze.fields.forEach(at=>{at.type===_.PU.number&&at.labels&&Object.keys(at.labels).forEach(ct=>{We.includes(ct)||(re[be][ct]=jr(ct,_.PU.string),We.push(ct))})})});for(let Ze=0;Ze<Ue.length;Ze++){const at=Ue[Ze];let ct=null,gt=z[be]?.timeField;if(gt&>.length>0?ct=at.fields.find(pt=>pt.name===gt):ct=at.fields.find(pt=>(0,Zs.hF)(pt)),!(0,Zs.aH)(at)){ue.push(at);continue}for(const pt of at.fields){if(pt.type!==_.PU.number)continue;const ht=z[be]?.stat??bt.gy.lastNotNull,vt=(0,bt.Nw)({field:pt,reducers:[ht]})[ht]??null,Ft=new io.k;ct!==void 0&&(Ft.addField(ct),Ft.addField(pt),k[be][`Trend #${be}`]===void 0&&(k[be][`Trend #${be}`]=jr(`Trend #${be}`,_.PU.frame)),k[be][`Trend #${be}`].values.push({...Ft,value:vt,length:pt.values.length})),We.forEach(sn=>{re[be][sn].values.push(pt.labels?.[sn]??"")})}}}for(const be of Object.keys(ve)){const Ue={},We=new io.k;We.refId=be;const Ze=re[be];if(Ze!==void 0)for(const[ct,gt]of Object.entries(Ze))Ue[ct]===void 0&&(Ue[ct]=gt);for(const ct of Object.values(Ue))We.addField(ct);const at=k[be];for(const ct of Object.values(at))We.addField(ct);We.fields.length>0&&ue.push(We)}return ue}function jr(z,G){return{name:z,type:G,config:{},values:[]}}function ai(z){let G={};for(const k of z)k.refId!==void 0&&(G[k.refId]===void 0?G[k.refId]=1:G[k.refId]++);return G}function js({input:z,options:G,onChange:k}){const re=ai(z),ue=(0,a.useCallback)((Ue,We)=>{const Ze=We?.value!==void 0?We.value:"";k({...G,[Ue]:{...G[Ue],timeField:Ze}})},[k,G]),ve=(0,a.useCallback)((Ue,We)=>{const Ze=We[0];Ze&&(0,bt.Em)(Ze)&&k({...G,[Ue]:{...G[Ue],stat:Ze}})},[k,G]);let be=[];for(const Ue of Object.keys(re)){const We={},Ze=[];for(const at of z)if(at.refId===Ue)for(const ct of at.fields)(0,Zs.hF)(ct)&&(We[ct.name]=ct);for(const at of Object.values(We)){const{name:ct}=at;Ze.push({label:ct,value:ct})}be.push((0,M.jsxs)(de.C,{children:[(0,M.jsx)(q.I,{children:(0,M.jsx)(Me.c,{children:`Trend #${Ue}`})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.time-series-table-transform-editor.label-time-field","Time field"),tooltip:(0,ae.t)("transformers.time-series-table-transform-editor.tooltip-time-field","The time field that will be used for the time series. If not selected the first found will be used."),children:(0,M.jsx)(le.l6,{onChange:ue.bind(null,Ue),options:Ze,value:G[Ue]?.timeField,isClearable:!0})}),(0,M.jsx)(q.I,{label:(0,ae.t)("transformers.time-series-table-transform-editor.label-stat","Stat"),tooltip:(0,ae.t)("transformers.time-series-table-transform-editor.tooltip-statistic-should-calculated-series","The statistic that should be calculated for this time series."),children:(0,M.jsx)(Xt.S,{stats:[G[Ue]?.stat??bt.gy.lastNotNull],onChange:ve.bind(null,Ue),filterOptions:at=>at.id!==bt.gy.allValues&&at.id!==bt.gy.uniqueValues})})]},Ue))}return(0,M.jsx)(M.Fragment,{children:be})}const Xi={id:qs.id,editor:js,transformation:qs,name:qs.name,description:qs.description,state:xe.pn.beta,help:fe(qs.id).helperDocs},Zi=()=>[yi,Ya,Ei,Fs,Se,Ao,Mn,Pi,Vn,Sn,va,Jr,bi,pi,kt,Qi,mt,Xo,Gs,gr,$o,Ri,wt,Tr,us,ro,Vi,...F.$.featureToggles.formatString?[rr]:[],...F.$.featureToggles.regressionTransformation?[ei]:[],...F.$.featureToggles.groupToNestedTableTransformation?[Qs]:[],Is,Xi,Zr];var qi=e(26305),ja=e(1503),el=e(35254),gs=e(71468),ya=e(54148),Sa=e(27489),si=e(72296),uo=e(36303),tl=e(15245),Ma=e(28105),Bs=e(13791),Br=e(45776),Ss=e(21234);function qa({navId:z,header:G}){const{node:k}=(0,Br.C)(z),re=(0,xt.of)(Vs),ue=k.children?.filter(ve=>!ve.hideFromTabs);return(0,M.jsx)(Bs.Y,{navId:k.id,children:(0,M.jsx)(Bs.Y.Contents,{children:(0,M.jsxs)("div",{className:re.content,children:[G,ue&&ue.length>0&&(0,M.jsx)("section",{className:re.grid,children:ue?.map(ve=>(0,M.jsx)(Ss.I,{description:ve.subTitle,text:ve.text,url:ve.url??""},ve.id))})]})})})}const Vs=z=>({content:(0,_e.css)({display:"flex",flexDirection:"column",gap:z.spacing(2)}),grid:(0,_e.css)({display:"grid",gap:z.spacing(3),gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gridAutoRows:"138px",padding:z.spacing(2,0)})});var Ur=e(86678),ta=e(15130),nl=e(49785),ho=e(62061),Us=e(73427),hn=e(96673),$s=e(74267),Ns=e(45967),er=e(27594);const ri=({ldapConnectionInfo:z})=>{const G=(0,a.useMemo)(()=>[{id:"host",header:"Host",disableGrow:!0},{id:"port",header:"Port",disableGrow:!0},{id:"available",cell:re=>re.cell.value?(0,M.jsx)(Qt.B,{justifyContent:"end",children:(0,M.jsx)(Ns.m,{content:"Connection is available",children:(0,M.jsx)(Qn.I,{name:"check"})})}):(0,M.jsx)(Qt.B,{justifyContent:"end",children:(0,M.jsx)(Ns.m,{content:"Connection is not available",children:(0,M.jsx)(Qn.I,{name:"exclamation-triangle"})})})}],[]),k=(0,a.useMemo)(()=>z,[z]);return(0,M.jsx)("section",{children:(0,M.jsxs)(Qt.B,{direction:"column",gap:2,children:[(0,M.jsx)(Aa.E,{color:"primary",element:"h3",children:(0,M.jsx)(ae.x6,{i18nKey:"admin.ldap-status.title",children:"LDAP Connection"})}),(0,M.jsx)(er.j,{data:k,columns:G,getRowId:re=>
1559re.host+re.port}),(0,M.jsx)(fo,{ldapConnectionInfo:z})]})})},fo=({ldapConnectionInfo:z})=>{if(!z.some(ue=>ue.error))return null;const k=[];z.forEach(ue=>{ue.error&&k.push(ue)});const re=k.map((ue,ve)=>(0,M.jsxs)("div",{children:[(0,M.jsxs)("span",{style:{fontWeight:500},children:[`${ue.host}:${ue.port}`,(0,M.jsx)("br",{})]}),(0,M.jsx)("span",{children:ue.error}),ve!==k.length-1&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("br",{}),(0,M.jsx)("br",{})]})]},ve));return(0,M.jsx)(ss.F,{title:(0,ae.t)("admin.ldap-error-box.title-connection-error","Connection error"),severity:hn.AppNotificationSeverity.Error,children:re})};var al=e(80011);const sl="dddd YYYY-MM-DD HH:mm zz",mr=({ldapSyncInfo:z})=>{const G=(0,al.LE)(z.nextSync,{format:sl}),k=[{id:"syncAttribute"},{id:"syncValue"}],re=[{syncAttribute:"Active synchronization",syncValue:z.enabled?"Enabled":"Disabled"},{syncAttribute:"Scheduled",syncValue:z.schedule},{syncAttribute:"Next synchronization",syncValue:G}];return(0,M.jsxs)("section",{children:[(0,M.jsx)(Aa.E,{element:"h3",children:(0,M.jsx)(ae.x6,{i18nKey:"admin.ldap-sync-info.title",children:"LDAP Synchronization"})}),(0,M.jsx)(er.j,{data:re,columns:k,getRowId:ue=>ue.syncAttribute})]})},vr=({groups:z})=>{const G=(0,a.useMemo)(()=>z,[z]),k=(0,a.useMemo)(()=>[{id:"groupDN",header:"LDAP Group"},{id:"orgName",header:"Organization",cell:re=>re.value&&re.row.original.orgRole?re.value:""},{id:"orgRole",header:"Role",cell:re=>re.value||(0,M.jsxs)(Qt.B,{alignItems:"center",wrap:!0,children:[(0,M.jsx)(ae.x6,{i18nKey:"admin.ldap-user-groups.no-org-found",children:"No match"}),(0,M.jsx)(Ns.m,{content:"No matching organizations found",children:(0,M.jsx)(Qn.I,{name:"info-circle"})})]})}],[]);return(0,M.jsx)(er.j,{headerTooltips:{orgName:{content:"Only the first match for an Organization will be used",iconName:"info-circle"}},columns:k,data:G,getRowId:re=>re.orgId+re.orgRole+re.groupDN})},po=({info:z})=>{const G=(0,a.useMemo)(()=>[{id:"userInfo",header:"User Information",disableGrow:!0},{id:"ldapValue"},{id:"cfgAttrValue",header:"LDAP attribute"}],[]),k=(0,a.useMemo)(()=>[{userInfo:"First name",ldapValue:z.name.ldapValue,cfgAttrValue:z.name.cfgAttrValue},{userInfo:"Surname",ldapValue:z.surname.ldapValue,cfgAttrValue:z.surname.cfgAttrValue},{userInfo:"Username",ldapValue:z.login.ldapValue,cfgAttrValue:z.login.cfgAttrValue},{userInfo:"Email",ldapValue:z.email.ldapValue,cfgAttrValue:z.email.cfgAttrValue}],[z]);return(0,M.jsx)(er.j,{columns:G,data:k,getRowId:re=>re.userInfo})},rl=({permissions:z})=>{const G=(0,a.useMemo)(()=>[{id:"permission",header:"Permissions",disableGrow:!0},{id:"value"}],[]),k=(0,a.useMemo)(()=>[{permission:"Grafana admin",value:z.isGrafanaAdmin?(0,M.jsxs)(ae.x6,{i18nKey:"admin.ldap-permissions.admin",children:[(0,M.jsx)(Qn.I,{name:"shield"})," Yes"]}):"No"},{permission:"Status",value:z.isDisabled?(0,M.jsxs)(ae.x6,{i18nKey:"admin.ldap-permissions.inactive",children:[(0,M.jsx)(Qn.I,{name:"times"})," Inactive"]}):(0,M.jsxs)(ae.x6,{i18nKey:"admin.ldap-permissions.active",children:[(0,M.jsx)(Qn.I,{name:"check"})," Active"]})}],[z]);return(0,M.jsx)(er.j,{data:k,columns:G,getRowId:re=>re.permission})},oi=({teams:z})=>{const G=(0,a.useMemo)(()=>[{id:"groupDN",header:"LDAP Group"},{id:"orgName",header:"Organization",cell:({row:{original:{orgName:k}}})=>(0,M.jsx)(M.Fragment,{children:k||"No matching teams found"})},{id:"teamName",header:"Team",cell:({row:{original:{teamName:k,orgName:re}}})=>k&&re?k:""}],[]);return(0,M.jsx)(er.j,{data:z,columns:G,getRowId:k=>k.teamName})},go=({ldapUser:z})=>(0,M.jsxs)(Qt.B,{direction:"column",gap:4,children:[(0,M.jsx)(po,{info:z.info}),(0,M.jsx)(rl,{permissions:z.permissions}),z.roles&&z.roles.length>0&&(0,M.jsx)(vr,{groups:z.roles}),z.teams&&z.teams.length>0?(0,M.jsx)(oi,{teams:z.teams}):(0,M.jsx)(se.a,{children:(0,M.jsx)(Aa.E,{children:(0,M.jsx)(ae.x6,{i18nKey:"admin.ldap-user-info.no-team",children:"No teams found via LDAP"})})})]}),mo={text:"LDAP",subTitle:"Verify your LDAP and user mapping configuration.",icon:"book",id:"LDAP"},ol=({clearUserMappingInfo:z,queryParams:G,loadLdapState:k,loadLdapSyncStatus:re,loadUserMapping:ue,clearUserError:ve,ldapUser:be,userError:Ue,ldapError:We,ldapSyncInfo:Ze,ldapConnectionInfo:at})=>{const[ct,gt]=(0,a.useState)(!0),{register:pt,handleSubmit:ht}=(0,nl.mN)(),vt=(0,a.useCallback)(async In=>ue(In),[ue]);(0,a.useEffect)(()=>{const In=async()=>Promise.all([k(),re()]);async function Dn(){await z(),await In(),G.username&&await vt(G.username),gt(!1)}Dn()},[z,vt,k,re,G]);const Ft=({username:In})=>{In&&vt(In)},sn=()=>{ve()}
1559,fn=Us.TP.hasPermission(hn.AccessControlAction.LDAPUsersRead);return(0,M.jsx)(Bs.Y,{navId:"authentication",pageNav:mo,children:(0,M.jsx)(Bs.Y.Contents,{isLoading:ct,children:(0,M.jsxs)(Qt.B,{direction:"column",gap:4,children:[We&&We.title&&(0,M.jsx)(ss.F,{title:We.title,severity:hn.AppNotificationSeverity.Error,children:We.body}),(0,M.jsx)(ri,{ldapConnectionInfo:at}),(0,ho.a)("ldapsync")&&Ze&&(0,M.jsx)(mr,{ldapSyncInfo:Ze}),fn&&(0,M.jsxs)("section",{children:[(0,M.jsx)("h3",{children:(0,M.jsx)(ae.x6,{i18nKey:"admin.ldap.test-mapping-heading",children:"Test user mapping"})}),(0,M.jsx)("form",{onSubmit:ht(Ft),children:(0,M.jsx)(rs.D,{label:(0,ae.t)("admin.ldap-page.label-username","Username"),children:(0,M.jsx)($t.p,{...pt("username",{required:!0}),width:34,id:"username",type:"text",defaultValue:G.username,addonAfter:(0,M.jsx)(oe.$n,{variant:"primary",type:"submit",children:(0,M.jsx)(ae.x6,{i18nKey:"admin.ldap.test-mapping-run-button",children:"Run"})})})})}),Ue&&Ue.title&&(0,M.jsx)(ss.F,{title:Ue.title,severity:hn.AppNotificationSeverity.Error,onRemove:sn,children:Ue.body}),be&&(0,M.jsx)(go,{ldapUser:be})]})]})})})},ii=z=>({ldapConnectionInfo:z.ldap.connectionInfo,ldapUser:z.ldap.user,ldapSyncInfo:z.ldap.syncInfo,userError:z.ldap.userError,ldapError:z.ldap.ldapError}),Ie={loadLdapState:$s.JI,loadLdapSyncStatus:$s.pm,loadUserMapping:$s.Kg,clearUserError:$s.DX,clearUserMappingInfo:$s.Jc},Le=(0,gs.connect)(ii,Ie)(ol),he=z=>(0,a.lazy)(z);var Ae=e(76070),Fe=e(66513),qe=e(88114),nt=e(17349),ot=e(74869),ut=e(54);function Ct(z=U.$W){return[{path:"/alerting",component:Lt(()=>e.e(3236).then(e.bind(e,11161)))},{path:"/alerting/home",component:Lt(()=>e.e(3236).then(e.bind(e,11161)))},{path:"/alerting/list",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead,hn.AccessControlAction.AlertingRuleExternalRead]),component:Lt(()=>Promise.all([e.e(3952),e.e(3511)]).then(e.bind(e,37935)))},{path:"/alerting/routes",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsRead,hn.AccessControlAction.AlertingNotificationsExternalRead,...qe.rw,...qe.nv,...Fe.xK,...Fe.Zr]),component:Lt(()=>Promise.all([e.e(3952),e.e(9368),e.e(1909)]).then(e.bind(e,13198)))},{path:"/alerting/routes/mute-timing/new",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsWrite,hn.AccessControlAction.AlertingNotificationsExternalWrite,...Fe.Zr]),component:Lt(()=>Promise.all([e.e(3192),e.e(8302)]).then(e.bind(e,35388)))},{path:"/alerting/routes/mute-timing/edit",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsWrite,hn.AccessControlAction.AlertingNotificationsExternalWrite,...Fe.xK,...Fe.Zr]),component:Lt(()=>Promise.all([e.e(3192),e.e(558)]).then(e.bind(e,9334)))},{path:"/alerting/silences",roles:(0,ut.C0)([hn.AccessControlAction.AlertingInstanceRead,hn.AccessControlAction.AlertingInstancesExternalRead,hn.AccessControlAction.AlertingSilenceRead]),component:Lt(()=>e.e(1668).then(e.bind(e,46627)))},{path:"/alerting/silence/new",roles:(0,ut.C0)([hn.AccessControlAction.AlertingInstanceCreate,hn.AccessControlAction.AlertingInstancesExternalWrite,hn.AccessControlAction.AlertingSilenceCreate,hn.AccessControlAction.AlertingSilenceUpdate]),component:Lt(()=>e.e(1649).then(e.bind(e,29668)))},{path:"/alerting/silence/:id/edit",component:Lt(()=>Promise.resolve().then(e.bind(e,24158)))},{path:"/alerting/notifications",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsRead,hn.AccessControlAction.AlertingNotificationsExternalRead,...Ae.w6,...nt.X]),component:Lt(()=>Promise.all([e.e(3952),e.e(4312)]).then(e.bind(e,46787)))},{path:"/alerting/notifications/receivers/new",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsRead,hn.AccessControlAction.AlertingNotificationsExternalRead,...Ae.w6]),component:Lt(()=>Promise.all([e.e(3952),e.e(4312),e.e(9668),e.e(4666),e.e(6315),e.e(8622),e.e(3167)]).then(e.bind(e,15274)))},{path:"/alerting/notifications/receivers/:name/edit",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsWrite,hn.AccessControlAction.AlertingNotificationsExternalWrite,hn.AccessControlAction.AlertingNotificationsRead,hn.AccessControlA
1559ction.AlertingNotificationsExternalRead,...Ae.w6]),component:Lt(()=>Promise.all([e.e(3952),e.e(4312),e.e(9668),e.e(4666),e.e(6315),e.e(8622),e.e(6877)]).then(e.bind(e,51998)))},{path:"/alerting/notifications/templates/*",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsRead,hn.AccessControlAction.AlertingNotificationsExternalRead,...nt.X]),component:Lt(()=>Promise.all([e.e(3952),e.e(4312),e.e(9668),e.e(4666),e.e(9224)]).then(e.bind(e,7070)))},{path:"/alerting/notifications/global-config",roles:(0,ut.C0)([hn.AccessControlAction.AlertingNotificationsWrite,hn.AccessControlAction.AlertingNotificationsExternalWrite]),component:Lt(()=>Promise.all([e.e(3952),e.e(4312),e.e(9668),e.e(4666),e.e(6315),e.e(8504)]).then(e.bind(e,19644)))},{path:"/alerting/groups/",roles:(0,ut.C0)([hn.AccessControlAction.AlertingInstanceRead,hn.AccessControlAction.AlertingInstancesExternalRead]),component:Lt(()=>e.e(8427).then(e.bind(e,13549)))},{path:"/alerting/history/",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead]),component:Lt(()=>Promise.all([e.e(8706),e.e(4302),e.e(44)]).then(e.bind(e,56102)))},{path:"/alerting/import-datasource-managed-rules",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleCreate,hn.AccessControlAction.AlertingRuleExternalRead]),component:U.$W.featureToggles.alertingMigrationUI?Lt(()=>e.e(9886).then(e.bind(e,34184))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/alerting/list"})},{path:"/alerting/recently-deleted/",roles:()=>["Admin"],component:(0,ot.f2)()?Lt(()=>e.e(3734).then(e.bind(e,75174))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/alerting/list"})},{path:"/alerting/import-datasource-managed-rules",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleCreate,hn.AccessControlAction.AlertingRuleExternalRead]),component:U.$W.featureToggles.alertingMigrationUI?Lt(()=>e.e(9886).then(e.bind(e,34184))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/alerting/list"})},{path:"/alerting/new/:type?",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleCreate,hn.AccessControlAction.AlertingRuleExternalWrite]),component:Lt(()=>Promise.all([e.e(3952),e.e(9668),e.e(4656),e.e(9368),e.e(4009)]).then(e.bind(e,70234)))},{path:"/alerting/:id/edit",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleUpdate,hn.AccessControlAction.AlertingRuleExternalWrite]),component:Lt(()=>Promise.all([e.e(3952),e.e(9668),e.e(4656),e.e(9368),e.e(4009)]).then(e.bind(e,70234)))},{path:"/alerting/:id/modify-export",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead]),component:Lt(()=>Promise.all([e.e(3952),e.e(9668),e.e(4656),e.e(9368),e.e(4009)]).then(e.bind(e,28124)))},{path:"/alerting/export-new-rule",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead]),component:Lt(()=>Promise.all([e.e(3952),e.e(9668),e.e(4656),e.e(9368),e.e(4009)]).then(e.bind(e,87144)))},{path:"/alerting/:sourceName/:id/view",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead,hn.AccessControlAction.AlertingRuleExternalRead]),component:Lt(()=>Promise.resolve().then(e.bind(e,28390)))},{path:"/alerting/:sourceName/:name/find",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead,hn.AccessControlAction.AlertingRuleExternalRead]),component:Lt(()=>e.e(5516).then(e.bind(e,15102)))},{path:"/alerting/:dataSourceUid/namespaces/:namespaceId/groups/:groupName/view",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead,hn.AccessControlAction.AlertingRuleExternalRead]),component:Lt(()=>e.e(3196).then(e.bind(e,12003)))},{path:"/alerting/:dataSourceUid/namespaces/:namespaceId/groups/:groupName/edit",pageClass:"page-alerting",roles:(0,ut.C0)([hn.AccessControlAction.AlertingRuleRead,hn.AccessControlAction.AlertingRuleExternalRead]),component:Lt(()=>Promise.all([e.e(4656),e.e(6102)]).then(e.bind(e,56638)))},{path:"/alerting/admin",roles:()=>["Admin"],component:Lt(()=>e.e(9438).then(e.bind(e,605)))}]}function Lt(z){const G=()=>e.e(9029).then(e.bind(e,31642));return he(U.$W.unifiedAlertingEnabled?z:G)}var Kt=e(77256),zt=e(26437);const dn=z=>({alertContent:(0,_e.css)({display:"flex",flexDirection:"row",padding:0,justifyContent:"space-between",alignItems:"center"}),alertParagraph:(0,_e.css)({margin:z.spacing(0,1,0,0),lineHeight:z.spacing(z.components.height.sm)})});function Gt(){const z=(0,xt.of)(dn),G=Us.TP.hasPermission(hn.AccessControlA
1559ction.DataSourcesCreate)||Us.TP.hasPermission(hn.AccessControlAction.DataSourcesWrite),[k,re]=(0,a.useState)(G);return k?(0,M.jsx)(ss.F,{severity:"info",title:"",onRemove:()=>re(!1),children:(0,M.jsxs)("div",{className:z.alertContent,children:[(0,M.jsx)("p",{className:z.alertParagraph,children:(0,M.jsx)(ae.x6,{i18nKey:"connections.connections-redirect-notice.body",children:"Data sources have a new home! You can discover new data sources or manage existing ones in the Connections page, accessible from the main menu."})}),(0,M.jsx)(oe.z9,{"aria-label":(0,ae.t)("connections.connections-redirect-notice.aria-label-link-to-connections","Link to Connections"),icon:"arrow-right",href:zt.b.DataSources,fill:"text",children:(0,M.jsx)(ae.x6,{i18nKey:"connections.connections-redirect-notice.go-to-connections",children:"Go to connections"})})]})}):(0,M.jsx)(M.Fragment,{})}function rn(){return[{path:`/${zt.q}/*`,component:he(()=>Promise.all([e.e(362),e.e(9474),e.e(9553),e.e(2154)]).then(e.bind(e,2248)))}]}var Pn=e(37946),Un=e(20962),jn=e(52161),Bn=(z=>(z.ViewIRMMainPage="grafana_irm_configuration_tracker_main_page_view",z.OpenEssentials="grafana_irm_configuration_tracker_essentials_open",z.CloseEssentials="grafana_irm_configuration_tracker_essentials_closed",z.ClickDataSources="grafana_irm_configuration_tracker_data_sources_clicked",z))(Bn||{});function Yn(z,G){(0,Sa.rR)(z,{...G})}var Pa=e(97507),Hn=e(46202),kn=e(182),Rn=e(92367),yn=e(70327),qn=e(6135),An=e(44109);function ra(){const[z,{data:G,isLoading:k}]=yn.hK.endpoints.rulerRules.useLazyQuery({refetchOnFocus:!0,refetchOnReconnect:!0}),{dsFeatures:re,isLoadingDsFeatures:ue}=(0,An.O3)(jn.hY),ve=re?.rulerConfig;return(0,a.useEffect)(()=>{ve&&z({rulerConfig:ve})},[ve,z]),{isDone:(G?Object.entries(G).flatMap(([We,Ze])=>Ze.flatMap(at=>at.rules)):[]).length>0,isLoading:k||ue}}function oa(z){return z.some(G=>G.grafana_managed_receiver_configs?.some(k=>k.type===qn.J4.OnCall))}const la="<[email protected]>";function ca(z,G){const k=G.find(re=>re.name===z);return k?k.grafana_managed_receiver_configs?.some(re=>re.type==="email"?re.settings?.addresses!==la:!0):!1}var ga=e(5709);const Ia=z=>`/api/plugins/${(0,kn.Wx)()}/resources${z}`,es=ga.H.injectEndpoints({endpoints:z=>({getIncidentsPluginConfig:z.query({query:()=>({url:Ia("/api/ConfigurationTrackerService.GetConfigurationTracker"),data:{},method:"POST",showErrorAlert:!1})})})});var Fa=e(3986);function Cs(){const{installed:z,loading:G}=(0,Fa._)((0,kn.Wx)()),{data:k,isLoading:re}=es.endpoints.getIncidentsPluginConfig.useQuery();return{isInstalled:z??!1,isChatOpsInstalled:k?.isChatOpsInstalled??!1,isIncidentCreated:k?.isIncidentCreated??!1,isLoading:G||re}}var Ua=e(77788);function Nr(){const{installed:z}=(0,Fa._)((0,kn.BO)()),{data:G}=Ua.WG.endpoints.grafanaOnCallIntegrations.useQuery(void 0,{skip:!z,refetchOnFocus:!0,refetchOnReconnect:!0,refetchOnMountOrArgChange:!0});return G??[]}function Ra(){const{data:z,isLoading:G}=Ua.WG.endpoints.onCallConfigChecks.useQuery(void 0,{refetchOnFocus:!0,refetchOnReconnect:!0,refetchOnMountOrArgChange:!0});return{isLoading:G,onCallConfigChecks:z??{is_chatops_connected:!1,is_integration_chatops_connected:!1}}}function ms(){return Nr().map(G=>({label:G.display_name,value:G.value}))}function ls(){const{onCallConfigChecks:{is_chatops_connected:z,is_integration_chatops_connected:G},isLoading:k}=Ra();return{is_chatops_connected:z,is_integration_chatops_connected:G,isLoading:k}}var Na=e(2869);const ts=`/api/plugins/${Na.W.Slo}/resources/v1`,Ja=ga.H.injectEndpoints({endpoints:z=>({getSlos:z.query({query:()=>({url:`${ts}/slo`,showErrorAlert:!1}),providesTags:["GrafanaSlo"]})})});function vs(){const{installed:z}=(0,Fa._)(Na.W.Slo),{data:G,isLoading:k}=Ja.endpoints.getSlos.useQuery(void 0,{skip:!z,refetchOnFocus:!0,refetchOnReconnect:!0,refetchOnMountOrArgChange:!0});return{isLoading:k,hasSlo:!!G?.slos.length,hasSloWithAlert:!!G?.slos?.some(re=>re.alerting)}}function Ka(){const{contactPoints:z,isLoading:G}=(0,Pa.Z3)(),{data:k,isLoading:re}=(0,Hn.yV)({alertmanager:jn.hY}),ue=k?.[0].receiver||"",{isDone:ve,isLoading:be}=ra(),{isChatOpsInstalled:Ue,isInstalled:We,isLoading:Ze}=Cs(),at=ms(),{is_chatops_connected:ct,is_integration_chatops_connected:gt,isLoading:pt}=ls(),{hasSlo:ht,hasSloWithAlert:vt,isLoading:Ft}=vs();return{alerting:{contactPoints:z,defaultContactpoint:ue,isCreateAlertRuleDone:ve},incidents:{isChatOpsInstalled:Ue,isIncidentsInstalled:We},onCall:{onCallOptions:at,is_chatops_connected:ct,is_integration_chatops_connected:gt},slo:{hasSlo:ht,hasSloWithAlert:vt},isLoading:G||re||be||Ze||pt||Ft}}function zs(){const{alerting:{contactPoints:z,defaultContactpoint:G,isCreateAlertRuleDone:k},incidents:{isChatOpsInstalled:re,isIncidentsInstalled:ue},onCall:{onCallOptions:ve,is_chatops_connected:be,is_integration_chatops_connected:Ue},slo:{hasSlo:We,hasSloWithAlert:Ze},isLoading:at}=Ka();function ct(Ft,sn){const fn=(0,Rn.G)(`${sn} + ${Ft}`,{returnTo:location.pathname+location.search});P.Ny.push(fn)}function gt(){let Ft=[{title:"Update default contact point",description:"Update the default contact point to a method other than the example email address.",button:{type:"openLink",urlLink:{url:"/alerting/notifications",queryParams:{search:G,alertmanager:"grafana"}},label:"Edit",labelOnDone:"View",urlLinkOnDone:{url:"/alerting/notifications"}},done:ca(G,z)}];return(0,kn.ZP)()||(Ft=[...Ft,{title:"Connect alerting to OnCall",description:"Create an OnCall integration for an alerting contact point.",button:{type:"openLink",urlLink:{url:"/alerting/notifications/receivers/new"},label:"Connect",urlLinkOnDone:{url:"/alerting/notifications"},labelOnDone:"View"},done:oa(z)}]),Ft=[...Ft,{title:"Create alert rule",description:"Create an alert rule to monitor your system.",button:{type:"openLink",urlLink:{url:"/alerting/new"},label:"Create",urlLinkOnDone:{url:"/alerting/list"},labelOnDone:"View"},done:k},{title:"Create SLO",description:"Create SLOs to monitor your service.",button:{type:"openLink",urlLink:{url:"/a/grafana-slo-app/wizard/ne
1559w"},label:"Create",urlLinkOnDone:{url:"/a/grafana-slo-app/manage-slos"},labelOnDone:"View"},done:We},{title:"Enable SLO alerting",description:"Configure SLO alerting to receive notifications when your SLOs are breached.",button:{type:"openLink",urlLink:{queryParams:{alertsEnabled:"disabled"},url:"/a/grafana-slo-app/manage-slos"},label:"Enable",urlLinkOnDone:{queryParams:{alertsEnabled:"enabled"},url:"/a/grafana-slo-app/manage-slos"},labelOnDone:"View"},done:Ze}],Ft}const pt={sections:[{title:"Detect",description:"Configure Grafana Alerting",steps:gt()},{title:"Respond",description:(0,kn.ZP)()?"Configure IRM":"Configure OnCall and Incident",steps:(0,kn.ZP)()?[{title:"Connect alerting to IRM",description:"Create an IRM integration for an alerting contact point.",button:{type:"openLink",urlLink:{url:"/alerting/notifications/receivers/new"},label:"Connect",urlLinkOnDone:{url:"/alerting/notifications"},labelOnDone:"View"},done:oa(z)},{title:"Connect IRM to your Slack workspace",description:"Receive alerts and oncall notifications, or automatically create an incident channel and manage incidents directly within your chat environment.",button:{type:"openLink",urlLink:{url:`/a/${(0,kn.Wx)()}/integrations/apps/grate.irm.slack`},label:"Connect",urlLinkOnDone:{url:`/a/${(0,kn.Wx)()}/integrations`}},done:re},{title:"Add Slack notifications to IRM integrations",description:"Select ChatOps channels to route notifications",button:{type:"openLink",urlLink:{url:`/a/${(0,kn.BO)()}/integrations/`},label:"Add",urlLinkOnDone:{url:`/a/${(0,kn.BO)()}/integrations/`},labelOnDone:"View"},done:Ue}]:[{title:"Initialize Incident plugin",description:"Initialize the Incident plugin to declare and manage incidents.",button:{type:"openLink",urlLink:{url:`/a/${(0,kn.Wx)()}/walkthrough/generate-key`},label:"Initialize",urlLinkOnDone:{url:`/a/${(0,kn.Wx)()}`},labelOnDone:"View"},done:ue},{title:"Connect your Messaging workspace to OnCall",description:"Receive alerts and oncall notifications within your chat environment.",button:{type:"openLink",urlLink:{url:`/a/${(0,kn.BO)()}/settings`,queryParams:{tab:"ChatOps",chatOpsTab:"Slack"}},label:"Connect",urlLinkOnDone:{url:`/a/${(0,kn.BO)()}/settings`,queryParams:{tab:"ChatOps"}},labelOnDone:"View"},done:be},{title:"Connect your Messaging workspace to Incident",description:"Automatically create an incident channel and manage incidents directly within your chat environment.",button:{type:"openLink",urlLink:{url:`/a/${(0,kn.Wx)()}/integrations/grate.slack`},label:"Connect",urlLinkOnDone:{url:`/a/${(0,kn.Wx)()}/integrations`}},done:re},{title:"Add Messaging workspace channel to OnCall Integration",description:"Select ChatOps channels to route notifications",button:{type:"openLink",urlLink:{url:`/a/${(0,kn.BO)()}/integrations/`},label:"Add",urlLinkOnDone:{url:`/a/${(0,kn.BO)()}/integrations/`},labelOnDone:"View"},done:Ue}]},{title:"Test your configuration",description:"",steps:[{title:(0,kn.ZP)()?"Send test alert":"Send OnCall demo alert via Alerting integration",description:"In the integration page, click Send demo alert, to review your notification",button:{type:"dropDown",label:"Select integration",options:ve,onClickOption:Ft=>ct(Ft,`/a/${(0,kn.BO)()}/integrations/`),stepNotAvailableText:"No integrations available"}},{title:"Create Incident drill",description:"Practice solving an Incident",button:{type:"openLink",urlLink:{url:`/a/${(0,kn.Wx)()}`,queryParams:{declare:"new",drill:"1"}},label:"Start drill"}}]}]},{stepsDone:ht,totalStepsToDo:vt}=pt.sections.reduce((Ft,sn)=>{const fn=sn.steps.filter(Dn=>Dn.done).length,In=sn.steps.reduce((Dn,ua)=>ua.done!==void 0?Dn+1:Dn,0);return{stepsDone:Ft.stepsDone+fn,totalStepsToDo:Ft.totalStepsToDo+In}},{stepsDone:0,totalStepsToDo:0});return{essentialContent:pt,stepsDone:ht,totalStepsToDo:vt,isLoading:at}}const tr=({dataSourceConfigurationData:{dataSourceCompatibleWithAlerting:z},essentialsConfigurationData:{stepsDone:G,totalStepsToDo:k}})=>(0,a.useMemo)(()=>{function re(){const ue=z?"You have connected a datasource.":"Connect at least one data source to start receiving data",ve=z?"View":"Connect";return{id:Hl.CONNECT_DATASOURCE,title:"Connect data source",description:ue,actionButtonTitle:ve,isDone:z}}return[re(),{id:Hl.ESSENTIALS,title:"Essentials",titleIcon:"star",description:"Set up the necessary features to start using Grafana IRM workflows",actionButtonTitle:G===k?"View":"Configure",stepsDone:G,totalStepsToDo:k}]},[z,G,k]);var Wr=e(6975);function da({stepsDone:z,totalStepsToDo:G}){const k=(0,xt.of)(ys);return G===0?null:(0,M.jsx)("div",{className:k.containerStyles,role:"progressbar","aria-valuenow":z,"aria-valuemax":G,children:(0,M.jsx)("div",{className:k.fillerStyles(z/G*100)})})}function Ta({stepsDone:z,totalStepsToDo:G}){return(0,M.jsxs)("span",{children:[(0,M.jsx)(Aa.E,{color:"success",children:z})," of ",G]})}
1559function ys(z){return{containerStyles:(0,_e.css)({height:z.spacing(2),borderRadius:z.shape.radius.pill,backgroundColor:z.colors.border.weak,flex:"auto"}),fillerStyles:G=>(0,_e.css)({height:"100%",width:`${G}%`,backgroundColor:z.colors.success.main,borderRadius:z.shape.radius.pill,textAlign:"right"})}}function xs({config:z,handleActionClick:G,isLoading:k=!1}){const re=(0,xt.of)(Ts);return(0,M.jsx)(Qt.B,{direction:"column",gap:1,justifyContent:"space-around",children:(0,M.jsxs)("div",{className:re.cardContent,children:[(0,M.jsxs)(Qt.B,{direction:"column",gap:1,children:[(0,M.jsxs)(Qt.B,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1,children:[(0,M.jsx)("div",{className:"fs-unmask",children:(0,M.jsxs)(Qt.B,{direction:"row",gap:1,alignItems:"center",children:[z.title,z.titleIcon&&(0,M.jsx)(Qn.I,{name:z.titleIcon}),z.isDone&&!k&&(0,M.jsx)(Qn.I,{name:"check-circle",color:"green",size:"lg"})]})}),z.stepsDone&&z.totalStepsToDo&&!k&&(0,M.jsx)("div",{className:"fs-unmask",children:(0,M.jsxs)(Qt.B,{direction:"row",gap:.5,children:[(0,M.jsx)(Ta,{stepsDone:z.stepsDone,totalStepsToDo:z.totalStepsToDo}),(0,M.jsx)(ae.x6,{i18nKey:"configuration-tracker.config-card.complete",children:"complete"})]})})]}),(0,M.jsxs)(Qt.B,{direction:"column",children:[k?(0,M.jsx)(Wr._,{text:(0,ae.t)("gops.config-card.text-loading-configuration","Loading configuration....")}):z.description,!k&&z.stepsDone&&z.totalStepsToDo&&(0,M.jsx)(da,{stepsDone:z.stepsDone,totalStepsToDo:z.totalStepsToDo})]})]}),(0,M.jsx)(Qt.B,{direction:"row",gap:1,justifyContent:"flex-start",alignItems:"flex-end",children:(0,M.jsx)(oe.$n,{variant:"secondary",onClick:()=>
1559G(z.id,z.isDone),className:"fs-unmask",children:z.actionButtonTitle})})]})})}const Ts=z=>({cardTitle:(0,_e.css)({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%"}),cardContent:(0,_e.css)({background:z.colors.background.secondary,padding:z.spacing(2),borderRadius:z.shape.radius.default,height:"100%",gap:z.spacing(1),display:"flex",flexDirection:"column",justifyContent:"space-between"})});var cs=e(8207),vo=e(88559),Os=e(87063);function Du({onClose:z,essentialsConfig:G,stepsDone:k,totalStepsToDo:re}){return(0,M.jsx)(cs._,{title:(0,ae.t)("gops.essentials.title-essentials","Essentials"),subtitle:"Complete the following configuration tasks",onClose:z,children:(0,M.jsx)(bu,{essentialContent:G,stepsDone:k,totalStepsToDo:re})})}function bu({essentialContent:z,stepsDone:G,totalStepsToDo:k}){return(0,M.jsxs)(Qt.B,{direction:"column",gap:1,children:[(0,M.jsx)(Iu,{stepsDone:G,totalStepsToDo:k}),z.sections.map(re=>(0,M.jsx)(Cu,{section:re},re.title))]})}function Cu({section:z}){const G=(0,xt.of)(Ru);return(0,M.jsxs)("div",{className:G.wrapper,children:[(0,M.jsx)(Aa.E,{element:"h4",children:(0,M.jsx)("span",{className:"fs-unmask",children:z.title})}),(0,M.jsx)(Aa.E,{color:"secondary",children:(0,M.jsx)("span",{className:"fs-unmask",children:z.description})}),(0,M.jsx)(Qt.B,{direction:"column",gap:2,children:z.steps.map((k,re)=>(0,M.jsx)(Su,{step:k},re))})]})}function Mu({done:z}){return z?(0,M.jsx)(Qn.I,{name:"check-circle",color:"green","data-testid":"checked-step",className:"fs-unmask"}):(0,M.jsx)(Qn.I,{name:"circle","data-testid":"unckecked-step",className:"fs-unmask"})}function Su({step:z}){return(0,M.jsxs)(Qt.B,{direction:"row",justifyContent:"space-between","data-testid":"step",children:[(0,M.jsxs)(Qt.B,{direction:"row",alignItems:"center",children:[z.done!==void 0&&(0,M.jsx)(Mu,{done:z.done}),(0,M.jsx)(Aa.E,{variant:"body",children:(0,M.jsx)("span",{className:"fs-unmask",children:z.title})}),(0,M.jsx)(Ns.m,{content:z.description,placement:"right",children:(0,M.jsx)(Qn.I,{name:"question-circle"})})]}),(0,M.jsx)(Ou,{...z.button,done:z.done,"data-testid":"step-button"})]})}function Tu(z){const{urlLink:G,label:k,urlLinkOnDone:re,labelOnDone:ue,done:ve}=z,be=G?.url?(0,Rn.G)(G.url,{returnTo:location.pathname+location.search,...G.queryParams}):"",Ue=re?.url?(0,Rn.G)(re.url,{returnTo:location.pathname+location.search,...re.queryParams}):"",We=ve?Ue:be;return(0,M.jsx)(oe.z9,{href:We,variant:"secondary",className:"fs-unmask",children:ve?ue??k:k})}function Ou({type:z,urlLink:G,urlLinkOnDone:k,label:re,labelOnDone:ue,options:ve,onClickOption:be,done:Ue,stepNotAvailableText:We}){switch(z){case"openLink":return(0,M.jsx)(Tu,{urlLink:G,label:re,urlLinkOnDone:k,labelOnDone:ue,done:Ue});case"dropDown":return ve?.length?(0,M.jsx)(vo.m,{overlay:(0,M.jsx)(Os.W,{className:"fs-unmask",children:ve?.map(Ze=>(0,M.jsx)(Os.W.Item,{label:Ze.label,className:"fs-unmask",onClick:()=>{be?.(Ze.value)}},Ze.value))}),children:(0,M.jsxs)(oe.$n,{variant:"secondary",size:"md",className:"fs-unmask",children:[re,(0,M.jsx)(Qn.I,{name:"angle-down"})]})}):(0,M.jsxs)(Aa.E,{children:[We??"No options available"," "]})}}function Iu({stepsDone:z,totalStepsToDo:G}){return(0,M.jsxs)(Qt.B,{direction:"row",gap:1,alignItems:"center",children:["Your progress",(0,M.jsx)(da,{stepsDone:z,totalStepsToDo:G}),(0,M.jsx)(Ta,{stepsDone:z,totalStepsToDo:G})]})}const Ru=z=>({wrapper:(0,_e.css)({margin:z.spacing(2,0),padding:z.spacing(2),border:`1px solid ${z.colors.border.medium}`,borderRadius:z.shape.radius.default,display:"flex",flexDirection:"column",gap:z.spacing(2)})});var Hl=(z=>(z[z.CONNECT_DATASOURCE=0]="CONNECT_DATASOURCE",z[z.ESSENTIALS=1]="ESSENTIALS",z))(Hl||{});function Au(){return{dataSourceCompatibleWithAlerting:!!(0,jn.k5)()}}function Lu(){const z=(0,xt.of)(ju),G=(0,ya.Zp)(),k=Au(),re=zs(),ue=tr({dataSourceConfigurationData:k,essentialsConfigurationData:re});(0,a.useEffect)(()=>{Yn(Bn.ViewIRMMainPage,{essentialStepsDone:0,essentialStepsToDo:0,dataSourceCompatibleWithAlerting:k.dataSourceCompatibleWithAlerting})},[k.dataSourceCompatibleWithAlerting]);const[ve,be]=(0,Un.l)(),Ue=ve.get("essentials")==="open",We=(at,ct)=>{switch(Yn(Bn.ClickDataSources,{essentialStepsDone:re.stepsDone,essentialStepsToDo:re.totalStepsToDo,dataSourceCompatibleWithAlerting:k.dataSourceCompatibleWithAlerting}),at){case 0:G(ct?Pn.I.List:Pn.I.New);break;case 1:be({essentials:"open"}),Yn(Bn.OpenEssentials,{essentialStepsDone:re.stepsDone,essentialStepsToDo:re.totalStepsToDo,dataSourceCompatibleWithAlerting:k.dataSourceCompatibleWithAlerting});break;default:return}};function Ze(){be({essentials:void 0}),Yn(Bn.CloseEssentials,{essentialStepsDone:re.stepsDone,essentialStepsToDo:re.totalStepsToDo,dataSourceCompatibleWithAlerting:k.dataSourceCompatibleWithAlerting})}return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Aa.E,{element:"h4",variant:"h4",children:(0,M.jsx)(ae.x6,{i18nKey:"gops.configure-irm.configure",children:"Configure"})}),(0,M.jsxs)("section",{className:z.container,children:[ue.map(at=>(0,M.jsx)(xs,{config:at,handleActionClick:We,isLoading:re.isLoading},at.id)),Ue&&(0,M.jsx)(Du,{onClose:Ze,essentialsConfig:re.essentialContent,stepsDone:re.stepsDone,totalStepsToDo:re.totalStepsToDo})]}),(0,M.jsx)(Aa.E,{element:"h4",variant:"h4",children:(0,M.jsx)(ae.x6,{i18nKey:"gops.configure-irm.irm-apps",children:"IRM apps"})})]})}const ju=z=>({container:(0,_e.css)({marginBottom:0,display:"grid",gap:z.spacing(3),gridTemplateColumns:" 1fr 1fr"})});var Gl=e(13660);const Bu=[{path:"/plugins",navId:"plugins",roles:_l([hn.AccessControlA
1559ction.PluginsInstall,hn.AccessControlAction.PluginsWrite],["Admin","ServerAdmin"]),routeName:Gl.vk.Home,component:he(()=>e.e(4519).then(e.bind(e,60514)))},{path:"/plugins/browse",navId:"plugins",roles:_l([hn.AccessControlAction.PluginsInstall,hn.AccessControlAction.PluginsWrite],["Admin","ServerAdmin"]),routeName:Gl.vk.Browse,component:he(()=>e.e(4519).then(e.bind(e,60514)))},{path:"/plugins/:pluginId/",navId:"plugins",roles:_l([hn.AccessControlAction.PluginsInstall,hn.AccessControlAction.PluginsWrite],["Admin","ServerAdmin"]),routeName:Gl.vk.Details,component:he(()=>Promise.all([e.e(362),e.e(9474),e.e(9553),e.e(7891)]).then(e.bind(e,31879)))}];function _l(z,G){return()=>z.some(k=>Us.TP.hasPermission(k))?[]:G}function Uu(){return Bu}var Nu=e(37168);const bc=[{path:"/profile",component:he(()=>Promise.all([e.e(3126),e.e(2472)]).then(e.bind(e,67521)))},{path:"/profile/password",component:he(()=>e.e(9996).then(e.bind(e,9996)))},{path:"/profile/select-org",component:he(()=>e.e(7430).then(e.bind(e,31830)))},{path:"/profile/notifications",component:he(()=>e.e(4140).then(e.bind(e,30946)))}];function Wu(z=U.$W){return z.profileEnabled?bc:(0,H.uniq)(bc.map(k=>k.path)).map(k=>({path:k,component:he(()=>e.e(5173).then(e.bind(e,77267)))}))}const Fu=()=>U.$W.publicDashboardsEnabled?[{path:"/dashboard/public",pageClass:"page-dashboard",routeName:hn.DashboardRoutes.Public,component:he(()=>e.e(5761).then(e.bind(e,69579)))},{path:"/public-dashboards/:accessToken",pageClass:"page-dashboard",routeName:hn.DashboardRoutes.Public,chromeless:!0,component:he(()=>Promise.all([e.e(6088),e.e(1990),e.e(7197)]).then(e.bind(e,99473)))}]:[];var Ku=e(53247),yr=e(91555);function wu(){return(0,Ku.Hv)()?[{path:yr.mL,component:he(()=>e.e(2182).then(e.bind(e,15134)))},{path:yr.zM,component:he(()=>e.e(1037).then(e.bind(e,90886)))},{path:`${yr.pd}/:type`,component:he(()=>e.e(252).then(e.bind(e,36474)))},{path:yr.mL+"/:name",component:he(()=>e.e(6092).then(e.bind(e,6299)))},{path:yr.mL+"/:name/edit",component:he(()=>e.e(8758).then(e.bind(e,33580)))},{path:yr.mL+"/:name/file/*",component:he(()=>e.e(1954).then(e.bind(e,28682)))},{path:yr.mL+"/:name/history/*",component:he(()=>e.e(9898).then(e.bind(e,22192)))},{path:yr.mL+"/:slug/dashboard/preview/*",pageClass:"page-dashboard",routeName:hn.DashboardRoutes.Provisioning,component:he(()=>e.e(8638).then(e.bind(e,39910)))}]:[{path:yr.mL,component:he(()=>e.e(1037).then(e.bind(e,90886)))}]}const Vu=U.Ay.buildInfo.env==="development",$u=[];function zu(){return[...(0,Nu.X)(),{path:"/",pageClass:"page-dashboard",routeName:hn.DashboardRoutes.Home,component:he(()=>Promise.all([e.e(6088),e.e(7051),e.e(1990),e.e(8528),e.e(9136)]).then(e.bind(e,8528)))},{path:"/d/:uid/:slug?",pageClass:"page-dashboard",routeName:hn.DashboardRoutes.Normal,component:he(()=>Promise.all([e.e(6088),e.e(7051),e.e(1990),e.e(8528),e.e(9136)]).then(e.bind(e,8528)))},{path:"/dashboard/new",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.DashboardsCreate]),pageClass:"page-dashboard",routeName:hn.DashboardRoutes.New,component:he(()=>Promise.all([e.e(6088),e.e(7051),e.e(1990),e.e(8528),e.e(2976)]).then(e.bind(e,8528)))},{path:"/dashboard/new-with-ds/:datasourceUid",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.DashboardsCreate]),component:he(()=>Promise.all([e.e(6088),e.e(7051),e.e(1990),e.e(8528),e.e(2976)]).then(e.bind(e,373)))},{path:"/dashboard/:type/:slug",pageClass:"page-dashboard",routeName:hn.DashboardRoutes.Normal,component:he(()=>Promise.all([e.e(6088),e.e(7051),e.e(1990),e.e(8528),e.e(2976)]).then(e.bind(e,8528)))},{path:"/dashboards/embedding-test",component:he(()=>Promise.all([e.e(6088),e.e(7051),e.e(1990),e.e(8528),e.e(2976)]).then(e.bind(e,77437)))},{path:"/d-solo/:uid/:slug?",routeName:hn.DashboardRoutes.Normal,chromeless:!0,component:he(()=>U.Ay.featureToggles.dashboardSceneSolo?e.e(7849).then(e.bind(e,35463)):Promise.all([e.e(6088),e.e(4492)]).then(e.bind(e,49286)))},{path:"/dashboard-solo/:type/:slug",routeName:hn.DashboardRoutes.Normal,chromeless:!0,component:he(()=>U.Ay.featureToggles.dashboardSceneSolo?e.e(7849).then(e.bind(e,35463)):Promise.all([e.e(6088),e.e(4492)]).then(e.bind(e,49286)))},{path:"/dashboard/import",component:he(()=>e.e(2550).then(e.bind(e,79615)))},{path:Pn.I.List,component:()=>(0,M.jsx)(ya.C5,{replace:!0,to:zt.b.DataSources})},{path:Pn.I.Edit,component:_u},{path:Pn.I.Dashboards,component:Gu},{path:Pn.I.New,component:()=>
1559(0,M.jsx)(ya.C5,{replace:!0,to:zt.b.DataSourcesNew})},{path:"/datasources/correlations",component:he(()=>U.Ay.featureToggles.correlations?e.e(9981).then(e.bind(e,88103)):e.e(8014).then(e.bind(e,29181)))},{path:"/dashboards",component:he(()=>Promise.all([e.e(362),e.e(9474),e.e(152)]).then(e.bind(e,22943)))},{path:"/dashboards/f/:uid/:slug",component:he(()=>Promise.all([e.e(362),e.e(9474),e.e(152)]).then(e.bind(e,22943)))},{path:"/dashboards/f/:uid",component:he(()=>Promise.all([e.e(362),e.e(9474),e.e(152)]).then(e.bind(e,22943)))},{path:"/explore",pageClass:"page-explore",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.DataSourcesExplore]),component:he(()=>U.Ay.exploreEnabled?Promise.all([e.e(407),e.e(5995),e.e(4162),e.e(7112),e.e(20),e.e(7051),e.e(3474),e.e(2609),e.e(4340),e.e(9147),e.e(3158),e.e(9604)]).then(e.bind(e,53158)):e.e(4422).then(e.bind(e,89153)))},{path:"/drilldown",component:()=>(0,M.jsx)(qa,{navId:"drilldown"})},{path:"/apps",component:()=>(0,M.jsx)(qa,{navId:"apps"})},{path:"/alerts-and-incidents",component:()=>(0,M.jsx)(qa,{navId:"alerts-and-incidents",header:!(0,Kt.y$)()&&(0,Kt.qc)()||(0,Kt.ES)()?(0,M.jsx)(Lu,{}):void 0})},{path:"/testing-and-synthetics",component:()=>(0,M.jsx)(qa,{navId:"testing-and-synthetics"})},{path:"/monitoring",component:()=>(0,M.jsx)(qa,{navId:"monitoring"})},{path:"/infrastructure",component:()=>
1559(0,M.jsx)(qa,{navId:"infrastructure"})},{path:"/frontend",component:()=>(0,M.jsx)(qa,{navId:"frontend"})},{path:"/admin/general",component:()=>(0,M.jsx)(qa,{navId:"cfg/general"})},{path:"/admin/plugins",component:()=>(0,M.jsx)(qa,{navId:"cfg/plugins"})},{path:"/admin/extensions",navId:"extensions",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.PluginsInstall,hn.AccessControlAction.PluginsWrite]),component:Vu||U.Ay.featureToggles.enableExtensionsAdminPage?he(()=>e.e(5902).then(e.bind(e,79682))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/admin"})},{path:"/admin/access",component:()=>(0,M.jsx)(qa,{navId:"cfg/access"})},{path:"/org",component:he(()=>Promise.all([e.e(3126),e.e(1510)]).then(e.bind(e,73318)))},{path:"/org/new",component:he(()=>e.e(7930).then(e.bind(e,45408)))},{path:"/org/users",component:()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/admin/users"})},{path:"/org/users/invite",component:he(()=>e.e(7720).then(e.bind(e,65914)))},{path:"/org/apikeys",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.ActionAPIKeysRead]),component:he(()=>e.e(4196).then(e.bind(e,77125)))},{path:"/org/serviceaccounts",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.ServiceAccountsRead,hn.AccessControlAction.ServiceAccountsCreate]),component:he(()=>Promise.all([e.e(265),e.e(6777)]).then(e.bind(e,75955)))},{path:"/org/serviceaccounts/create",component:he(()=>Promise.all([e.e(265),e.e(4176)]).then(e.bind(e,41150)))},{path:"/org/serviceaccounts/:id",component:he(()=>Promise.all([e.e(265),e.e(6576)]).then(e.bind(e,88468)))},{path:"/org/teams",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.ActionTeamsRead,hn.AccessControlAction.ActionTeamsCreate]),component:he(()=>Promise.all([e.e(265),e.e(1036)]).then(e.bind(e,34314)))},{path:"/org/teams/new",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.ActionTeamsCreate]),component:he(()=>Promise.all([e.e(265),e.e(5436)]).then(e.bind(e,84974)))},{path:"/org/teams/edit/:uid/:page?",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.ActionTeamsRead,hn.AccessControlAction.ActionTeamsCreate]),component:he(()=>Promise.all([e.e(265),e.e(3126),e.e(2212)]).then(e.bind(e,76172)))},{path:"/admin",component:()=>(0,M.jsx)(qa,{navId:"cfg",header:(0,M.jsx)(Gt,{})})},{path:"/admin/authentication",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.SettingsWrite]),component:U.Ay.licenseInfo.enabledFeatures?.saml||U.Ay.ldapEnabled||U.Ay.featureToggles.ssoSettingsApi?he(()=>e.e(5592).then(e.bind(e,53953))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/admin"})},{path:"/admin/authentication/ldap",component:U.Ay.featureToggles.ssoSettingsLDAP?he(()=>e.e(4582).then(e.bind(e,43124))):Le},{path:"/admin/authentication/:provider",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.SettingsWrite]),component:U.Ay.featureToggles.ssoSettingsApi?he(()=>e.e(5592).then(e.bind(e,81172))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/admin"})},{path:"/admin/settings",component:he(()=>e.e(7659).then(e.bind(e,29154)))},{path:"/admin/upgrading",component:he(()=>e.e(564).then(e.bind(e,50564)))},{path:"/admin/users",component:he(()=>Promise.all([e.e(265),e.e(1743)]).then(e.bind(e,12074)))},{path:"/admin/users/create",component:he(()=>e.e(9239).then(e.bind(e,62648)))},{path:"/admin/users/edit/:id",component:he(()=>Promise.all([e.e(265),e.e(8054)]).then(e.bind(e,698)))},{path:"/admin/orgs",component:he(()=>e.e(9736).then(e.bind(e,55026)))},{path:"/admin/orgs/edit/:id",component:he(()=>Promise.all([e.e(265),e.e(9119)]).then(e.bind(e,88947)))},{path:"/admin/featuretoggles",component:U.Ay.featureToggles.featureToggleAdminPage?he(()=>e.e(7024).then(e.bind(e,75180))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/admin"})},{path:"/admin/stats",component:he(()=>e.e(9299).then(e.bind(e,32882)))},U.Ay.featureToggles.onPremToCloudMigrations&&{path:"/admin/migrate-to-cloud",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.MigrationAssistantMigrate]),component:he(()=>e.e(3704).then(e.bind(e,2681)))},{path:"/login",component:he(()=>Promise.all([e.e(7651),e.e(3883)]).then(e.bind(e,798))),pageClass:"login-page",chromeless:!0},{path:"/invite/:code",component:he(()=>e.e(8576).then(e.bind(e,68620))),chromeless:!0},{path:"/verify",component:U.Ay.verifyEmailEnabled?he(()=>e.e(2018).then(e.bind(e,39637))):()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/signup"}),pageClass:"login-page",chromeless:!0},{path:"/signup",component:U.Ay.disableUserSignUp?()=>(0,M.jsx)(ya.C5,{replace:!0,to:"/login"}):he(()=>e.e(8347).then(e.bind(e,98347))),pageClass:"login-page",chromeless:!0},{path:"/user/password/send-reset-email",chromeless:!0,component:he(()=>e.e(3818).then(e.bind(e,81545)))},{path:"/user/password/reset",component:he(()=>Promise.all([e.e(7651),e.e(641)]).then(e.bind(e,1711))),pageClass:"login-page",chromeless:!0}
1559,{path:"/dashboard/snapshots",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.SnapshotsRead]),component:he(()=>e.e(6590).then(e.bind(e,3839)))},{path:"/playlists",component:he(()=>e.e(1168).then(e.bind(e,22129)))},{path:"/playlists/play/:uid",component:he(()=>e.e(1374).then(e.bind(e,57304)))},{path:"/playlists/new",component:he(()=>e.e(7616).then(e.bind(e,95594)))},{path:"/playlists/edit/:uid",component:he(()=>e.e(7620).then(e.bind(e,33876)))},{path:"/sandbox/benchmarks",component:he(()=>e.e(9354).then(e.bind(e,13591)))},{path:"/sandbox/test",component:he(()=>e.e(5354).then(e.bind(e,12057)))},{path:"/dashboards/f/:uid/:slug/library-panels",component:he(()=>e.e(5804).then(e.bind(e,95576)))},{path:"/dashboards/f/:uid/:slug/alerting",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.AlertingRuleRead]),component:he(()=>e.e(4333).then(e.bind(e,85185)))},{path:"/library-panels",component:he(()=>e.e(8516).then(e.bind(e,21155)))},{path:"/notifications",component:he(()=>e.e(4140).then(e.bind(e,30946)))},{path:"/explore/metrics/*",roles:()=>ta.TP.evaluatePermission([hn.AccessControlAction.DataSourcesExplore]),component:he(()=>e.e(8513).then(e.bind(e,24227)))},{path:"/bookmarks",component:he(()=>e.e(7759).then(e.bind(e,27906)))},...Uu(),...Hu(),...Ct(),...Wu(),...$u,...Fu(),...rn(),...wu(),{path:"/goto/*",component:Qu},{path:"/*",component:Ur.H}].filter(Ma.zz)}function Hu(z=U.Ay){return z.supportBundlesEnabled?[{path:"/support-bundles",component:he(()=>e.e(123).then(e.bind(e,236)))},{path:"/support-bundles/create",component:he(()=>e.e(1515).then(e.bind(e,26484)))}]:[]}function Gu(){const{uid:z=""}=(0,ya.g)();return(0,M.jsx)(ya.C5,{replace:!0,to:zt.b.DataSourcesDashboards.replace(":uid",z)})}function _u(){const{uid:z=""}=(0,ya.g)();return(0,M.jsx)(ya.C5,{replace:!0,to:zt.b.DataSourcesEdit.replace(":uid",z)})}function Qu(){const{pathname:z}=(0,ya.zy)();return(0,a.useEffect)(()=>{window.location.href=z},[z]),null}var Oa=e(8535),li=e(58449),ku=e(77345);const Yu=()=>{const{isOpen:z}=(0,li.sA)();return(0,M.jsx)(ku.k,{isExtensionSidebarOpen:z})};var nr=e(27963),Ql=e(75683),Cc=e(56297);function Ju({error:z,errorInfo:G}){const k=(0,ya.zy)(),re=z?.name==="ChunkLoadError",ue=(0,xt.of)(Xu);return(0,a.useEffect)(()=>{re&&k.search.indexOf("chunkNotFound")===-1&&(window.location.href=g.I.getUrlForPartial(k,{chunkNotFound:!0}))},[k,re]),(0,M.jsx)(Bs.Y,{navId:"error",layout:Ql.k.Canvas,children:(0,M.jsxs)("div",{className:ue.container,children:[re&&(0,M.jsxs)("div",{children:[(0,M.jsx)("h2",{children:(0,M.jsx)(ae.x6,{i18nKey:"route-error.title",children:"Unable to find application file"})}),(0,M.jsx)("br",{}),(0,M.jsx)("h2",{className:"page-heading",children:(0,M.jsx)(ae.x6,{i18nKey:"route-error.description",children:"Grafana has likely been updated. Please try reloading the page."})}),(0,M.jsx)("br",{}),(0,M.jsx)(oe.$n,{size:"md",variant:"secondary",icon:"repeat",onClick:()=>window.location.reload(),children:(0,M.jsx)(ae.x6,{i18nKey:"route-error.reload-button",children:"Reload"})}),(0,M.jsx)(Cc.D,{title:(0,ae.t)("route-error.error-title","Error details"),error:z,errorInfo:G})]}),!re&&(0,M.jsx)(Cc.D,{title:(0,ae.t)("route-error.error-unexpected-title","An unexpected error happened"),error:z,errorInfo:G})]})})}const Xu=z=>({container:(0,_e.css)({width:"500px",margin:z.spacing(8,"auto")})});function Zu(){const z=(0,xt.of)(ah);return(0,M.jsx)("div",{className:z.container,"aria-live":"polite",role:"status","aria-label":(0,ae.t)("bouncing-loader.label","Loading"),children:(0,M.jsx)("div",{className:z.bounce,children:(0,M.jsx)("img",{alt:"",src:"public/img/grafana_icon.svg",className:z.logo})})})}const qu=(0,_e.keyframes)({"0%":{opacity:0,animationTimingFunction:"cubic-bezier(0, 0, 0.5, 1)"},"100%":{opacity:1}}),eh=(0,_e.keyframes)({"0%":{opacity:0},"50%":{opacity:1},"100%":{opacity:0}}),th=(0,_e.keyframes)({"from, to":{transform:"translateY(0px)",animationTimingFunction:"cubic-bezier(0.3, 0, 0.1, 1)"},"50%":{transform:"translateY(-50px)",animationTimingFunction:"cubic-bezier(0.9, 0, 0.7, 1)"}}),nh=(0,_e.keyframes)({"0%":{transform:"scaleX(1.3) scaleY(0.8)",animationTimingFunction:"cubic-bezier(0.3, 0, 0.1, 1)"},"15%":{transform:"scaleX(0.75) scaleY(1.25)",animationTimingFunction:"cubic-bezier(0, 0, 0.7, 0.75)"},"55%":{transform:"scaleX(1.05) scaleY(0.95)",animationTimingFunction:"cubic-bezier(0.9, 0, 1, 1)"},"95%":{transform:"scaleX(0.75) scaleY(1.25)",animationTimingFunction:"cubic-bezier(0, 0, 0, 1)"},"100%":{transform:"scaleX(1.3) scaleY(0.8)",animationTimingFunction:"cubic-bezier(0, 0, 0.7, 1)"}}),ah=z=>({container:(0,_e.css)({opacity:0,[z.transitions.handleMotion("no-preference")]:{animationName:qu,animationIterationCount:1,animationDuration:"0.9s",animationDelay:"0.5s",animationFillMode:"forwards"},[z.transitions.handleMotion("reduce")]:{animationName:eh,animationIterationCount:"infinite",animationDuration:"4s",animationDelay:"0.5s"}}),bounce:(0,_e.css)({textAlign:"center",[z.transitions.handleMotion("no-preference")]:{animationName:th,animationDuration:"0.9s",animationIterationCount:"infinite"}}),logo:(0,_e.css)({display:"inline-block",[z.transitions.handleMotion("no-preference")]:{animationName:nh,animationDuration:"0.9s",animationIterationCount:"infinite"},width:"60px",height:"60px"})});function sh(){const z=(0,xt.of)(rh);return(0,M.jsx)("div",{className:z.loadingPage,children:(0,M.jsx)(Zu,{})})}const rh=z=>({loadingPage:(0,_e.css)({backgroundColor:z.colors.background.primary,flex:1,flexDrection:"column",display:"flex",justifyContent:"center",alignItems:"center"})});function oh(z){const{chrome:G,keybindings:k}=(0,nr.Il)();return G.setMatchedRoute(z.route),(0,a.useLayoutEffect)(()=>{k.clearAndInitGlobalBindings(z.route)},[k,z.route]),(0,a.useEffect)(()=>(Mc(z.route),Sc(),(0,P.Lc)("GrafanaRoute",!1,"Mounted",z.route),()=>{(0,P.Lc)("GrafanaRoute",!1,"Unmounted",z.route),Mc(z.route,!0)}),[]),(0,a.useEffect)(()=>{Sc(),(0,Sa.Jy)(),(0,P.Lc)("GrafanaRoute",!1,"Updated",z)}),(0,P.Lc)("GrafanaRoute",!1,"Rendered",z.route),(0,M.jsx)(uo.tH,{dependencies:[z.route],children:({error:re,errorInfo:ue})=>re?(0,M.jsx)(Ju,{error:re,errorInfo:ue}):(0,M.jsx)(a.Suspense,{fallback:(0,M.jsx)(sh,{}),children:(0,M.jsx)(z.route.component,{...z,queryParams:(0,P.SE)(z.location.search)})})})}function ih({route:z}){const G=(0,ya.zy)(),k=z.roles?z.roles():[];return k?.length&&!k.some(re=>ta.TP.hasRole(re))?(0,M.jsx)(ya.C5,{replace:!0,to:"/"}):(0,M.jsx)(oh,{route:z,location:G})}function lh(z){return z.pageClass?z.pageClass.split(" "):[]}function Mc(z,G=!1){for(const k of lh(z))G?document.body.classList.remove(k):document.body.classList.add(k)}function Sc(){document.body.classList.remove("sidemenu-open--xs");const z=document.getElementById("tooltip");z?.parentElement?.removeChild(z);const G=document.querySelectorAll(".tooltip");for(let k=0;k<G.length;k++){const re=G[k];re.parentElement?.removeChild(re)}}var ch=e(6007),dh=e(90382),kl=e(33184),Tc=e(65240);class uh extends a.PureComponent{constructor(){super(...arguments),this.styles=hh(F.$.theme2),this.state={},this.initListener=()=>{const G=(0,kl.oF)();G&&(this.subscription=G.getConnectionState().subscribe({next:k=>{this.setState({show:!k})}}))}}componentDidMount(){}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}render(){const{show:G}=this.state;return G?!ta.TP.isSignedIn||!F.$.liveEnabled||ta.TP.user.orgRole===dh.X.None?null:(0,M.jsx)("div",{className:this.styles.foot,children:(0,M.jsx)(ss.F,{severity:"warning",className:this.styles.warn,title:(0,ae.t)("live.live-connection-warning.title-connection-to-server-is-lost","Connection to server is lost...")})}):null}}const hh=(0,Tc.N)(z=>({foot:(0,_e.css)({position:"fixed",bottom:0,left:0,right:0,zIndex:1e4,cursor:"wait",margin:z.spacing(2)}),warn:(0,_e.css)({maxWidth:"400px",margin:"auto"})}));var il=e(28337),fh=e(63629),Cl=e(69896),Yl=e(85618),Fr=(z=>(z[z.Persisted=0]="Persisted",z[z.Result=1]="Result",z))(Fr||{});function Oc(z){return{metadata:{name:z},spec:{filters:[],title:z,type:"",category:"",description:""}}}const ph="scope.grafana.app",gh="v0alpha1",mh=(0,Yl.G)(),Ml=`/apis/${ph}/${gh}/namespaces/${mh}`;class vh{constructor(){this.scopesCache=new Map,this.fetchDashboards=async G=>{try{return(await(0,p.AI)().get(Ml+"/find/scope_dashboard_bindings",{scope:G}))?.items??[]}catch{return[]}},this.fetchScopeNavigations=async G=>{try{return(await(0,p.AI)().get(Ml+"/find/scope_navigations",{scope:G}))?.items??[]}catch{return[]}}}async fetchScope(G){if(this.scopesCache.has(G))return this.scopesCache.get(G);const k=new Promise(async re=>{const ue=Oc(G);try{const ve=await(0,p.AI)().get(Ml+`/scopes/${G}`),be={...ue,...ve,metadata:{...ue.metadata,...ve.metadata},spec:{...ue.spec,...ve.spec}};re(be)}catch{this.scopesCache.delete(G),re(ue)}});return this.scopesCache.set(G,k),k}async fetchMultipleScopes(G){return(await Promise.all(G.map(({scopeName:re})=>this.fetchScope(re)))).map((re,ue)=>({scope:re,path:G[ue].path}))}async fetchNode(G,k){try{return((await(0,p.AI)().get(Ml+"/find/scope_node_children",{parent:G,query:k}))?.items??[]).reduce((ue,{metadata:{name:ve},spec:be})=>(ue[ve]={name:ve,...be,expandable:be.nodeType==="container",selectable:be.linkType==="scope",expanded:!1,query:"",reason:Fr.Result,nodes:{}},ue),{})}catch{return{}}}}var ll=e(49426),yh=e(49510),Ic=e(41900);class xh{constructor(G,k,re){this.selectorService=G,this.dashboardsService=k,this.locationService=re,this.subscriptions=[],this.updateState=ve=>{this._state.next({...this._state.getValue(),...ve})},this.changeScopes=ve=>this.selectorService.changeScopes(ve),this.setReadOnly=ve=>{this.state.readOnly!==ve&&this.updateState({readOnly:ve}),ve&&this.selectorService.state.opened&&this.selectorService.closeAndReset()},this.setEnabled=ve=>{this.state.enabled!==ve&&(this.updateState({enabled:ve}),ve&&this.locationService.partial({scopes:this.selectorService.state.selectedScopes.map(({scope:be})=>be.metadata.name)},!0))},this._state=new ll.t({enabled:!1,readOnly:!1}),this._stateObservable=new ll.t({...this._state.getValue(),value:this.selectorService.state.selectedScopes.map(({scope:ve})=>ve),loading:this.selectorService.state.loading,drawerOpened:this.dashboardsService.state.drawerOpened}),this.subscriptions.push((0,yh.z)([this._state.asObservable(),this.get
1559SelectorServiceStateObservable(),this.getDashboardsServiceStateObservable()]).pipe((0,Fn.T)(([ve,be,Ue])=>({...ve,value:be.selectedScopes,loading:be.loading,drawerOpened:Ue.drawerOpened}))).subscribe(this._stateObservable));const ue=new URLSearchParams(re.getLocation().search);this.changeScopes(ue.getAll("scopes")),this.subscriptions.push(re.getLocationObservable().subscribe(ve=>{if(!this.state.enabled)return;const Ue=new URLSearchParams(ve.search).getAll("scopes");Ue.length&&this.changeScopes(Ue)})),this.subscriptions.push(G.subscribeToState((ve,be)=>{const Ue=be.selectedScopes.map(Ze=>Ze.scope.metadata.name),We=ve.selectedScopes.map(Ze=>Ze.scope.metadata.name);(0,H.isEqual)(Ue,We)||this.locationService.partial({scopes:We},!0)}))}get state(){return this._stateObservable.value}get stateObservable(){return this._stateObservable}getSelectorServiceStateObservable(){return this.selectorService.stateObservable.pipe((0,Fn.T)(G=>({selectedScopes:G.selectedScopes.map(({scope:k})=>k),loading:G.loading})),(0,Ic.F)((G,k)=>G.loading===k.loading&&(0,H.isEqual)(G.selectedScopes,k.selectedScopes)))}getDashboardsServiceStateObservable(){return this.dashboardsService.stateObservable.pipe((0,Ic.F)((G,k)=>G.drawerOpened===k.drawerOpened))}cleanUp(){for(const G of this.subscriptions)G.unsubscribe()}}var Eh=e(97256);class Rc{constructor(G){this.subscribeToState=k=>this._state.pipe((0,Eh.J)()).subscribe(([re,ue])=>k(ue,re)),this.updateState=k=>{this._state.next(Object.freeze({...this.state,...k}))},this._state=new ll.t(Object.freeze(G))}get state(){return this._state.getValue()}get stateObservable(){return this._state.asObservable()}}class Ph extends Rc{constructor(G){super({drawerOpened:!1,dashboards:[],scopeNavigations:[],filteredFolders:{},folders:{},forScopeNames:[],loading:!1,searchQuery:""}),this.apiClient=G,this.updateFolder=(k,re)=>{let ue={...this.state.folders},ve={...this.state.filteredFolders},be=ue,Ue=ve;for(let ct=0;ct<k.length-1;ct++)be=be[k[ct]].folders,Ue=Ue[k[ct]].folders;const We=k[k.length-1],Ze=be[We],at=Ue[We];Ze.expanded=re,at.expanded=re,this.updateState({folders:ue,filteredFolders:ve})},this.changeSearchQuery=k=>{k=k??"";const re=this.filterFolders(this.state.folders,k);this.updateState({filteredFolders:re,searchQuery:k})},this.clearSearchQuery=()=>{this.changeSearchQuery("")},this.fetchDashboards=async k=>{if((0,H.isEqual)(this.state.forScopeNames,k))return;if(k.length===0){this.updateState({dashboards:[],filteredFolders:{},folders:{},forScopeNames:[],loading:!1,drawerOpened:!1});return}this.updateState({forScopeNames:k,loading:!0});const ue=await(F.$.featureToggles.useScopesNavigationEndpoint?this.apiClient.fetchScopeNavigations:this.apiClient.fetchDashboards)(k);if((0,H.isEqual)(this.state.forScopeNames,k)){const ve=this.groupSuggestedItems(ue),be=this.filterFolders(ve,this.state.searchQuery);this.updateState({scopeNavigations:ue,filteredFolders:be,folders:ve,loading:!1,drawerOpened:ue.length>0})}},this.groupSuggestedItems=k=>{const re={"":{title:"",expanded:!0,folders:{},suggestedNavigations:{}}};return k.forEach(ue=>{const ve=re[""],be=ue.status.groups??[];be.forEach(We=>{We&&!ve.folders[We]&&(ve.folders[We]={title:We,expanded:!1,folders:{},suggestedNavigations:{}})}),(be.length>0?be.map(We=>We===""?ve.suggestedNavigations:ve.folders[We].suggestedNavigations):[ve.suggestedNavigations]).forEach(We=>{"dashboard"in ue.spec&&"dashboardTitle"in ue.status&&!We[ue.spec.dashboard]?We[ue.spec.dashboard]={url:"/d/"+ue.spec.dashboard,title:ue.status.dashboardTitle,id:ue.spec.dashboard}:"url"in ue.spec&&"title"in ue.status&&!We[ue.spec.url]&&(We[ue.spec.url]={title:ue.status.title||ue.metadata.name,url:ue.spec.url,id:ue.metadata.name})})}),re},this.filterFolders=(k,re)=>(re=(re??"").toLowerCase(),Object.entries(k).reduce((ue,[ve,be])=>{if(be.title.toLowerCase().includes(re))return ue[ve]={...be,expanded:!0},ue;const Ue=this.filterFolders(be.folders,re),We=Object.entries(be.suggestedNavigations).filter(([Ze,at])=>at.title.toLowerCase().includes(re));return(Object.keys(Ue).length>0||We.length>0)&&(ue[ve]={...be,expanded:!0,folders:Ue,suggestedNavigations:Object.fromEntries(We)}),ue},{})),this.toggleDrawer=()=>this.updateState({drawerOpened:!this.state.drawerOpened})}}class Dh extends Rc{constructor(G,k){super({loading:!1,opened:!1,loadingNodeName:void 0,nodes:{"":{name:"",reason:Fr.Result,nodeType:"container",title:"",expandable:!0,selectable:!1,expanded:!0,query:"",nodes:{}}},selectedScopes:[],treeScopes:[]}),this.apiClient=G,this.dashboardsService=k,this.updateNode=async(re,ue,ve)=>{if(re.length<1)return;const be={...this.state.nodes};let Ue=be,We=re[0];if(re.length>1){const ct=re.slice(0,re.length-1);Ue=Mh(be,ct),We=(0,H.last)(re)}const Ze=Ue[We],at=Ze.query!==ve;if(Ze.expanded=ue,Ze.query=ve,ue||at){this.updateState({nodes:be,loadingNodeName:We});const ct=await this.apiClient.fetchNode(We,ve);if(We===this.state.loadingNodeName){const[gt,pt]=bh(this.state.selectedScopes,this.state.treeScopes,re,ct),ht=pt.map(({path:vt})=>
1559vt[vt.length-1]).filter(vt=>vt in Ze.nodes&&!(vt in ct)).reduce((vt,Ft)=>(vt[Ft]={...Ze.nodes[Ft],reason:Fr.Persisted},vt),{});Ze.nodes={...ht,...ct},this.updateState({nodes:be,selectedScopes:gt,treeScopes:pt,loadingNodeName:void 0})}}else this.updateState({nodes:be,loadingNodeName:void 0})},this.toggleNodeSelect=re=>{let ue=[...this.state.treeScopes],ve=this.state.nodes[""];for(let Ze=1;Ze<re.length-1;Ze++)ve=ve.nodes[re[Ze]];const be=re[re.length-1],{linkId:Ue}=ve.nodes[be],We=ue.findIndex(({scopeName:Ze})=>Ze===Ue);if(We===-1){this.apiClient.fetchScope(Ue);const Ze=ue.length===0||Object.values(ve.nodes).some(({linkId:ct})=>ct===ue[0].scopeName),at={scopeName:Ue,path:re};this.updateState({treeScopes:ve?.disableMultiSelect||!Ze?[at]:[...ue,at]})}else ue.splice(We,1),this.updateState({treeScopes:ue})},this.changeScopes=re=>this.setNewScopes(re.map(ue=>({scopeName:ue,path:[]}))),this.setNewScopes=async(re=this.state.treeScopes)=>{if((0,H.isEqual)(re,Lc(this.state.selectedScopes)))return;let ue=re.map(({scopeName:ve,path:be})=>({scope:Oc(ve),path:be}));this.updateState({selectedScopes:ue,treeScopes:re,loading:!0}),this.dashboardsService.fetchDashboards(ue.map(({scope:ve})=>ve.metadata.name)),ue=await this.apiClient.fetchMultipleScopes(re),this.updateState({selectedScopes:ue,loading:!1})},this.removeAllScopes=()=>this.setNewScopes([]),this.open=async()=>{Object.keys(this.state.nodes[""].nodes).length===0&&await this.updateNode([""],!0,"");let re={...this.state.nodes};re=Ac(re);let ue=[...this.state.selectedScopes[0]?.path??["",""]];ue.splice(ue.length-1,1),re=Ch(re,ue),this.updateState({nodes:re,opened:!0})},this.closeAndReset=()=>{this.updateState({opened:!1,treeScopes:Lc(this.state.selectedScopes)})},this.closeAndApply=()=>{this.updateState({opened:!1}),this.setNewScopes()}}}function Ac(z){return Object.entries(z).reduce((G,[k,re])=>(G[k]={...re,expanded:!1,nodes:Ac(re.nodes)},G),{})}function Lc(z){return z.map(({scope:G,path:k})=>({scopeName:G.metadata.name,path:k}))}function bh(z,G,k,re){const ue=Object.values(re),be=G.filter(({path:Ze})=>Ze.length===0).map(({scopeName:Ze})=>Ze).reduce((Ze,at)=>{const ct=ue.find(gt=>gt.selectable&>.linkId===at);return ct&&(Ze[at]=[...k,ct.name]),Ze},{}),Ue=z.map(Ze=>Ze.path.length>0?Ze:{...Ze,path:be[Ze.scope.metadata.name]??[]}),We=G.map(Ze=>Ze.path.length>0?Ze:{...Ze,path:be[Ze.scopeName]??[]});return[Ue,We]}function Ch(z,G){z={...z};let k=z;for(let re=0;re<G.length;re++){const ue=G[re];k[ue]={...k[ue],expanded:!0},k=k[ue].nodes}return z}function Mh(z,G){let k=z;for(const re of G)k=k[re].nodes;return k}const jc=(0,a.createContext)(void 0);function Bc(){return(0,a.useContext)(jc)}function Sh(){const z=new vh,G=new Ph(z),k=new Dh(z,G);return{scopesService:new xh(k,G,P.Ny),scopesSelectorService:k,scopesDashboardsService:G,client:z}}const Th=({children:z,services:G})=>{const k=(0,a.useMemo)(()=>G??Sh(),[G]);return(0,a.useEffect)(()=>()=>{k.scopesService.cleanUp()},[k]),(0,M.jsx)(Cl.j.Provider,{value:F.$.featureToggles.scopeFilters?k.scopesService:void 0,children:(0,M.jsx)(jc.Provider,{value:F.$.featureToggles.scopeFilters?k:void 0,children:z})})};var Oh=e(61574),Uc=e(35557),Nc=e(8515),Ih=e(46942),Rh=e.n(Ih),Ah=e(33149),Lh=e(45897),Jl=e(51702),xr=e(29043),Wc=e(18828),Fc=e(42211),Kc=e(93225),jh=e(47327),Bh=e(50201),wc=e(65178),Uh=e(35822);const Sl=0,Nh=z=>{const G=a.useRef(null),k=a.useRef(null),re=a.useRef(z.items);re.current=z.items;const ue=(0,Uh.useVirtual)({size:re.current.length,parentRef:k}),{query:ve,search:be,currentRootActionId:Ue,activeIndex:We,options:Ze}=(0,ja.useKBar)(pt=>({search:pt.searchQuery,currentRootActionId:pt.currentRootActionId,activeIndex:pt.activeIndex}));a.useEffect(()=>{const pt=ht=>{ht.key==="ArrowUp"||ht.ctrlKey&&ht.key==="p"?(ht.preventDefault(),ve.setActiveIndex(vt=>{let Ft=vt>Sl?vt-1:vt;if(typeof re.current[Ft]=="string"){if(Ft===0)return vt;Ft-=1}return Ft})):ht.key==="ArrowDown"||ht.ctrlKey&&ht.key==="n"?(ht.preventDefault(),ve.setActiveIndex(vt=>{let Ft=vt<re.current.length-1?vt+1:vt;if(typeof re.current[Ft]=="string"){if(Ft===re.current.length-1)return vt;Ft+=1}return Ft})):ht.key==="Enter"&&(ht.preventDefault(),G.current?.click())};return window.addEventListener("keydown",pt),()=>window.removeEventListener("keydown",pt)},[ve]);const{scrollToIndex:at}=ue;a.useEffect(()=>{at(We,{align:We<=1?"end":"auto"})},[We,at]),a.useEffect(()=>
1559{ve.setActiveIndex(typeof z.items[Sl]=="string"?Sl+1:Sl)},[be,Ue,z.items,ve]);const ct=a.useCallback((pt,ht)=>{if(typeof ht=="string")return;const vt=ht.url;ht.command?(ht.command.perform(ht),ve.toggle()):vt?pt.ctrlKey||pt.metaKey||pt.shiftKey||ve.toggle():(ve.setSearch(""),ve.setCurrentRootAction(ht.id)),Ze.callbacks?.onSelectAction?.(ht)},[ve,Ze]),gt=(0,wc.usePointerMovedSinceMount)();return(0,M.jsx)("div",{ref:k,style:{maxHeight:z.maxHeight||400,position:"relative",overflow:"auto"},children:(0,M.jsx)("div",{role:"listbox",id:ja.KBAR_LISTBOX,style:{height:`${ue.totalSize}px`,width:"100%"},children:ue.virtualItems.map(pt=>{const ht=re.current[pt.index],{target:vt,url:Ft}=ht,sn=typeof ht!="string"&&{onPointerMove:()=>gt&&We!==pt.index&&ve.setActiveIndex(pt.index),onPointerDown:()=>ve.setActiveIndex(pt.index),onClick:ua=>ct(ua,ht)},fn=pt.index===We,In={id:(0,ja.getListboxItemId)(pt.index),role:"option","aria-selected":fn,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${pt.start}px)`},...sn},Dn=a.cloneElement(z.onRender({item:ht,active:fn}),{ref:pt.measureRef});return Ft?(0,M.jsx)("a",{href:typeof Ft=="function"?Ft(be):Ft,target:vt,ref:fn?G:null,...In,children:Dn},pt.index):(0,M.jsx)("div",{ref:fn?G:null,...In,children:Dn},pt.index)})})})},Vc=a.forwardRef(({action:z,active:G,currentRootActionId:k},re)=>{const ue=a.useMemo(()=>{if(!k)return z.ancestors;const We=z.ancestors.findIndex(Ze=>Ze.id===k);return z.ancestors.slice(We+1)},[z.ancestors,k]),ve=(0,xt.of)(Wh);let be=z.name;const Ue=We=>!!(We.command?.perform||We.url);return z.children.length&&!Ue(z)&&!be.endsWith("...")&&(be+="..."),(0,M.jsx)("div",{ref:re,className:(0,_e.cx)(ve.row,G&&ve.activeRow),children:(0,M.jsxs)("div",{className:ve.actionContainer,children:[z.icon,(0,M.jsxs)("div",{className:ve.textContainer,children:[ue.map(We=>(0,M.jsx)(a.Fragment,{children:!Ue(We)&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("span",{className:ve.breadcrumbAncestor,children:We.name}),(0,M.jsx)("span",{className:ve.breadcrumbSeparator,children:"\u203A"})]})},We.id)),(0,M.jsx)("span",{children:be})]}),z.subtitle&&(0,M.jsx)("span",{className:ve.subtitleText,children:z.subtitle})]})})});Vc.displayName="ResultItem";const Wh=z=>({row:(0,_e.css)({padding:z.spacing(1,2),display:"flex",alightItems:"center",justifyContent:"space-between",cursor:"pointer",position:"relative",borderRadius:z.shape.radius.default,margin:z.spacing(0,1)}),activeRow:(0,_e.css)({color:z.colors.text.maxContrast,background:z.colors.emphasize(z.colors.background.primary,.03),"&:before":{display:"block",content:'" "',position:"absolute",left:0,top:0,bottom:0,width:z.spacing(.5),borderRadius:z.shape.radius.default,backgroundImage:z.colors.gradients.brandVertical}}),actionContainer:(0,_e.css)({display:"flex",gap:z.spacing(1),alignItems:"baseline",fontSize:z.typography.fontSize,width:"100%"}),textContainer:(0,_e.css)({display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),breadcrumbAncestor:(0,_e.css)({color:z.colors.text.secondary}),breadcrumbSeparator:(0,_e.css)({color:z.colors.text.secondary,marginLeft:z.spacing(1),marginRight:z.spacing(1)}),subtitleText:(0,_e.css)({...z.typography.bodySmall,color:z.colors.text.secondary,display:"block",flexBasis:"20%",flexGrow:1,flexShrink:0,maxWidth:"fit-content",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})});var Fh=e(76459),Kh=e.n(Fh),wh=e(67020),$c=e(55860);const Vh=6,zc=5,$h=4,Xl=3,zh=2,Hh=1,Gh=100,Hc=5,_h=Kh()(kh,200);async function Qh(){if(!ta.TP.user.isSignedIn)return[];const z=(await wh.A.getDashboardOpened()).slice(0,Hc),k=(await(0,$c.S)().search({kind:["dashboard"],limit:Hc,uid:z})).view.toArray();return k.sort((ue,ve)=>{const be=z.indexOf(ue.uid),Ue=z.indexOf(ve.uid);return be-Ue}),k.map(ue=>{const{url:ve,name:be}=ue;return{id:`recent-dashboards${ve}`,name:`${be}`,section:(0,ae.t)("command-palette.section.recent-dashboards","Recent dashboards"),priority:Vh,url:ve}})}async function kh(z){if(z.length===0||!ta.TP.user.isSignedIn&&!F.$.bootData.settings.anonymousEnabled)return[];const G=await(0,$c.S)().search({kind:["dashboard","folder"],query:z,limit:Gh});return G.view.map(re=>{const{url:ue,name:ve,kind:be,location:Ue}=re;return{id:`go/${be}${ue}`,name:`${ve}`,section:be==="dashboard"?(0,ae.t)("command-palette.section.dashboard-search-results","Dashboards"):(0,ae.t)("command-palette.section.folder-search-results","Folders"),priority:Hh,url:ue,subtitle:G.view.dataFrame.meta?.custom?.locationInfo[Ue]?.name}})}function Yh(z,G){const[k,re]=(0,a.useState)([]),[ue,ve]=(0,a.useState)(!1),be=(0,a.useRef)(0);return(0,a.useEffect)(()=>{const Ue=Date.now();G&&z.length>0?(ve(!0),_h(z).then(We=>{Ue>be.current&&(re(We),ve(!1),be.current=Ue)})):(re([]),ve(!1),be.current=Ue)},[G,z]),{searchResults:k,isFetchingSearchResults:ue}}var ar=e(30362),Jh=e(79776);const Gc=U.$W.featureToggles.inviteUserExperimental&&U.$W.externalUserMngLinkUrl&&ta.TP.hasPermission(hn.AccessControlA
1559ction.OrgUsersAdd),_c=(z,G)=>{(0,Sa.rR)("invite_user_button_clicked",{placement:z});const k=(0,Jh.o)(G);window.open(k.toString(),"_blank")};var cl=e(44410);function Qc(z){return"navModel."+(z.id??z.url??z.text??z.subTitle)}function kc(z,G=[]){const k=[];for(let re of z){re.id==="help"&&(re=(0,ar.CS)({...re}),delete re.url);const{url:ue,target:ve,text:be,isCreateAction:Ue,children:We,onClick:Ze,keywords:at}=re,ct=!!We?.length;if(!(ue||Ze||ct))continue;let gt=ue;ue&&(re.id==="connections-add-new-connection"||re.id==="standalone-plugin-page-/connections/add-new-connection")&&(gt=sn=>{const fn=at?.find(In=>In.toLowerCase().includes(sn.toLowerCase()));return fn?`${ue}?search=${fn}`:ue});const pt=Ue?(0,ae.t)("command-palette.section.actions","Actions"):(0,ae.t)("command-palette.section.pages","Pages"),ht=Ue?zc:$h,vt=G.map(sn=>sn.text).join(" > "),Ft={id:Qc(re),name:be,section:pt,url:gt,target:ve,parent:G.length>0&&!Ue?Qc(G[G.length-1]):void 0,perform:Ze,keywords:at?.join(" "),priority:ht,subtitle:Ue?void 0:vt};if(k.push(Ft),We?.length){const sn=kc(We,[...G,re]);k.push(...sn)}}return k}const Xh=(z,G)=>{const k=[{id:"preferences/theme",name:(0,ae.t)("command-palette.action.change-theme","Change theme..."),keywords:"interface color dark light",section:(0,ae.t)("command-palette.section.preferences","Preferences"),priority:Xl},{id:"preferences/dark-theme",name:(0,ae.t)("command-palette.action.dark-theme","Dark"),keywords:"dark theme",perform:()=>(0,cl.K)("dark"),parent:"preferences/theme",priority:Xl},{id:"preferences/light-theme",name:(0,ae.t)("command-palette.action.light-theme","Light"),keywords:"light theme",perform:()=>(0,cl.K)("light"),parent:"preferences/theme",priority:Xl}],re=kc(z);return Gc&&re.push({id:"invite-user",name:(0,ae.t)("navigation.invite-user.invite-new-member-button","Invite new member"),section:(0,ae.t)("command-palette.section.actions","Actions"),priority:zc,perform:()=>{_c("command_palette_actions","invite-user-command-palette")}}),[...k,...G,...re]};var Tl=e(54092);
1559const Zh={};function qh(){const{links:z}=(0,O.U)({extensionPointId:Tl.S.CommandPalette,context:Zh,limitPerPlugin:3});return(0,a.useMemo)(()=>z.map(G=>({section:G.category??"Extensions",priority:zh,id:G.id,name:G.title,target:G.path,perform:()=>G.onClick&&G.onClick()})),[z])}function ef(z){const[G,k]=(0,a.useState)([]),[re,ue]=(0,a.useState)([]),ve=qh(),be=(0,hn.useSelector)(Ue=>Ue.navBarTree);return(0,a.useEffect)(()=>{const Ue=Xh(be,ve);k(Ue)},[be,ve]),(0,a.useEffect)(()=>{z||Qh().then(Ue=>ue(Ue)).catch(Ue=>{console.error("Error loading recent dashboard actions",Ue)})},[z]),z?G:[...re,...G]}var tf=e(84139);const Yc={name:"none",priority:ja.Priority.NORMAL};function Zl(z,G){return G.priority-z.priority}function nf(){const{search:z,actions:G,rootActionId:k}=(0,ja.useKBar)(at=>({search:at.searchQuery,actions:at.actions,rootActionId:at.currentRootActionId})),re=a.useMemo(()=>Object.keys(G).reduce((at,ct)=>{const gt=G[ct];if(!gt.parent&&!k&&at.push(gt),gt.id===k)for(let pt=0;pt<gt.children.length;pt++)at.push(gt.children[pt]);return at},[]).sort(Zl),[G,k]),ue=a.useCallback(at=>{let ct=[];for(let gt=0;gt<at.length;gt++)ct.push(at[gt]);return function gt(pt,ht=ct){for(let vt=0;vt<pt.length;vt++)if(pt[vt].children.length>0){let Ft=pt[vt].children;for(let sn=0;sn<Ft.length;sn++)ht.push(Ft[sn]);gt(pt[vt].children,ht)}return ht}(at)},[]),ve=!z,be=a.useMemo(()=>ve?re:ue(re),[ue,re,ve]),Ue=af(be,z),We=a.useMemo(()=>{let at={},ct=[],gt=[];for(let ht=0;ht<Ue.length;ht++){const vt=Ue[ht],Ft=vt.action,sn=vt.score||ja.Priority.NORMAL,fn={name:typeof Ft.section=="string"?Ft.section:Ft.section?.name||Yc.name,priority:typeof Ft.section=="string"?sn:Ft.section?.priority||0+sn};at[fn.name]||(at[fn.name]=[],ct.push(fn)),at[fn.name].push({priority:Ft.priority+sn,action:Ft})}gt=ct.sort(Zl).map(ht=>({name:ht.name,actions:at[ht.name].sort(Zl).map(vt=>vt.action)}));let pt=[];for(let ht=0;ht<gt.length;ht++){let vt=gt[ht];vt.name!==Yc.name&&pt.push(vt.name);for(let Ft=0;Ft<vt.actions.length;Ft++)pt.push(vt.actions[Ft])}return pt},[Ue]),Ze=a.useMemo(()=>k,[We]);return a.useMemo(()=>({results:We,rootActionId:Ze}),[Ze,We])}function af(z,G){const k=rf(),re=a.useMemo(()=>({filtered:z,search:G}),[z,G]),{filtered:ue,search:ve}=(0,wc.useThrottledValue)(re);return a.useMemo(()=>{if(ve.trim()==="")return ue.map(We=>({score:0,action:We}));const be=ue.map(({name:We,keywords:Ze})=>`${We} ${Ze??""}`.toLowerCase()),Ue=[];if(ve.length>sf){const We=ve.toLowerCase();for(let Ze=0;Ze<be.length;Ze++){const ct=be[Ze].indexOf(We);if(ct>-1){const gt=ct*-1,pt=ue[Ze];Ue.push({score:gt,action:pt})}}}else{const We=k.split(ve).length,Ze=1/0,at=We<5?4:0,[,ct,gt]=k.search(be,ve,at,Ze);if(ct&>)for(let pt=0;pt<gt.length;pt++){const ht=gt[pt],vt=gt.length-pt,Ft=ue[ct.idx[ht]];Ue.push({score:vt,action:Ft})}}return Ue},[ue,ve,k])}const sf=25;function rf(){const z=a.useRef();return z.current||(z.current=new tf.A({intraMode:0,intraIns:0})),z.current}function lf(){const z=Jc(),G=(0,xt.of)(Xc,z),{query:k,showing:re,searchQuery:ue}=(0,ja.useKBar)(ct=>({showing:ct.visualState===ja.VisualState.showing,searchQuery:ct.searchQuery})),ve=ef(ue);(0,ja.useRegisterActions)(ve,[ve]);const{searchResults:be,isFetchingSearchResults:Ue}=Yh(ue,re),We=(0,a.useRef)(null),{overlayProps:Ze}=(0,Kc.e)({isOpen:re,onClose:()=>k.setVisualState(ja.VisualState.animatingOut)},We),{dialogProps:at}=(0,Wc.s)({},We);return(0,a.useEffect)(()=>{re&&(0,Sa.rR)("command_palette_opened")},[re]),ve.length>0?(0,M.jsx)(ja.KBarPortal,{children:(0,M.jsx)(ja.KBarPositioner,{className:G.positioner,children:(0,M.jsx)(ja.KBarAnimator,{className:G.animator,children:(0,M.jsx)(Fc.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,M.jsxs)("div",{...Ze,...at,children:[(0,M.jsxs)("div",{className:G.searchContainer,children:[(0,M.jsx)(Qn.I,{name:"search",size:"md"}),(0,M.jsx)(ja.KBarSearch,{defaultPlaceholder:(0,ae.t)("command-palette.search-box.placeholder","Search or jump to..."),className:G.search}),(0,M.jsx)("div",{className:G.loadingBarContainer,children:Ue&&(0,M.jsx)(jh.G,{width:500,delay:0})})]}),(0,M.jsx)("div",{className:G.resultsContainer,children:(0,M.jsx)(cf,{isFetchingSearchResults:Ue,searchResults:be})})]})})})})}):null}const cf=({isFetchingSearchResults:z,searchResults:G})=>{const{results:k,rootActionId:re}=nf(),ue=Jc(),ve=(0,xt.of)(Xc,ue),be=(0,ae.t)("command-palette.section.dashboard-search-results","Dashboards"),Ue=(0,ae.t)("command-palette.section.folder-search-results","Folders"),We=(0,a.useMemo)(()=>G.filter(gt=>gt.id.startsWith("go/dashboard")).map(gt=>new ja.ActionImpl(gt,{store:{}}
1559)),[G]),Ze=(0,a.useMemo)(()=>G.filter(gt=>gt.id.startsWith("go/folder")).map(gt=>new ja.ActionImpl(gt,{store:{}})),[G]),at=(0,a.useMemo)(()=>{const gt=[...k];return Ze.length>0&&(gt.push(Ue),gt.push(...Ze)),We.length>0&&(gt.push(be),gt.push(...We)),gt},[k,be,We,Ue,Ze]),ct=!z&&at.length===0;return(0,a.useEffect)(()=>{ct&&(0,Sa.rR)("grafana_empty_state_shown",{source:"command_palette"})},[ct]),ct?(0,M.jsx)(Bh.p,{variant:"not-found",role:"alert",message:(0,ae.t)("command-palette.empty-state.message","No results found")}):(0,M.jsx)(Nh,{items:at,maxHeight:650,onRender:({item:gt,active:pt})=>{const ht=at[0]===gt;return typeof gt=="string"?(0,M.jsx)("div",{className:(0,_e.cx)(ve.sectionHeader,ht&&ve.sectionHeaderFirst),children:gt}):(0,M.jsx)(Vc,{action:gt,active:pt,currentRootActionId:re})}})},Jc=()=>{const G=document.querySelector(`[data-testid="${xa.Tp.components.NavToolbar.commandPaletteTrigger}"]`)?.getBoundingClientRect().right??0;return document.body.clientWidth-G},Xc=(z,G)=>({positioner:(0,_e.css)({zIndex:z.zIndex.portal,marginTop:"0px",paddingTop:"4px !important","&::before":{content:'""',position:"fixed",top:0,right:0,bottom:0,left:0,background:z.components.overlay.background}}),animator:(0,_e.css)({width:"100%",maxWidth:z.breakpoints.values.md,background:z.colors.background.primary,color:z.colors.text.primary,borderRadius:z.shape.radius.default,border:`1px solid ${z.colors.border.weak}`,overflow:"hidden",boxShadow:z.shadows.z3,[z.breakpoints.up("lg")]:{position:"fixed",right:G,left:G,maxWidth:"unset",width:"unset"}}),loadingBarContainer:(0,_e.css)({position:"absolute",left:0,right:0,bottom:0}),searchContainer:(0,_e.css)({alignItems:"center",background:z.components.input.background,borderBottom:`1px solid ${z.colors.border.weak}`,display:"flex",gap:z.spacing(1),padding:z.spacing(1,2),position:"relative"}),search:(0,_e.css)({fontSize:z.typography.fontSize,width:"100%",boxSizing:"border-box",outline:"none",border:"none",color:z.components.input.text}),spinner:(0,_e.css)({height:"22px"}),resultsContainer:(0,_e.css)({paddingBottom:z.spacing(1)}),sectionHeader:(0,_e.css)({padding:z.spacing(1.5,2,2,2),fontSize:z.typography.bodySmall.fontSize,fontWeight:z.typography.fontWeightMedium,color:z.colors.text.secondary,borderTop:`1px solid ${z.colors.border.weak}`,marginTop:z.spacing(1)}),sectionHeaderFirst:(0,_e.css)({paddingBottom:z.spacing(1),borderTop:"none",marginTop:0})});var yo=e(24120),dl=e(88483),ql=e(92807),Zc=e(5556),df=e(70958);function uf({folder:z,folderPath:G,folders:k,onFolderUpdate:re}){const ue=(0,xt.of)(hf);return(0,M.jsxs)("div",{className:ue.container,role:"treeitem","aria-selected":z.expanded,children:[(0,M.jsxs)("button",{className:ue.expand,"data-testid":`scopes-dashboards-${z.title}-expand`,"aria-label":z.expanded?(0,ae.t)("scopes.dashboards.collapse","Collapse"):(0,ae.t)("scopes.dashboards.expand","Expand"),onClick:()=>{re(G,!z.expanded)},children:[(0,M.jsx)(Qn.I,{name:z.expanded?"angle-down":"angle-right",className:ue.icon}),z.title]}),z.expanded&&(0,M.jsx)("div",{className:ue.children,children:(0,M.jsx)(qc,{folders:k,folderPath:G,onFolderUpdate:re})})]})}const hf=z=>({container:(0,_e.css)({display:"flex",flexDirection:"column",padding:z.spacing(.5,0)}),expand:(0,_e.css)({alignItems:"flex-start",background:"none",border:0,display:"flex",gap:z.spacing(1),margin:0,padding:0,textAlign:"left",wordBreak:"break-word"}),icon:(0,_e.css)({marginTop:z.spacing(.25)}),children:(0,_e.css)({paddingLeft:z.spacing(4)})});function ff({to:z,title:G,id:k}){const re=(0,xt.of)(mf),ue=(0,a.useMemo)(()=>pf(z),[z]);return(0,M.jsxs)(Uc.Link,{to:z,className:re.container,"data-testid":`scopes-dashboards-${k}`,role:"treeitem",children:[(0,M.jsx)(Qn.I,{name:ue,className:re.icon})," ",G]})}function pf(z){const G=g.I.stripBaseFromUrl(z);for(const[k,re]of gf.entries())if(G.startsWith(k))return re;return"link"}const gf=new Map([["http","external-link-alt"],["/d","apps"],["/explore/metrics","drilldown"],["/a/grafana-metricsdrilldown-app/","drilldown"],["/a/grafana-lokiexplore-app/","drilldown"],["/a/grafana-exploretraces-app/","drilldown"],["/a/grafana-pyroscope-app/","drilldown"]]),mf=z=>({container:(0,_e.css)({display:"flex",alignItems:"flex-start",ga
1559p:z.spacing(1),padding:z.spacing(.5,0),textAlign:"left",wordBreak:"break-word","&:last-child":(0,_e.css)({paddingBottom:0}),"&:hover, &:focus":(0,_e.css)({textDecoration:"underline"})}),icon:(0,_e.css)({marginTop:z.spacing(.25)})});function qc({folders:z,folderPath:G,onFolderUpdate:k}){const[re]=(0,df.s)(),ue=G[G.length-1],ve=z[ue];return(0,M.jsxs)("div",{role:"tree",children:[Object.entries(ve.folders).map(([be,Ue])=>(0,M.jsx)(uf,{folder:Ue,folders:ve.folders,folderPath:[...G,be],onFolderUpdate:k},be)),Object.values(ve.suggestedNavigations).map(be=>(0,M.jsx)(ff,{to:Zc.kM.renderUrl(be.url,re),title:be.title,id:be.id},be.id))]})}var ed=e(40996),td=e(12737);function vf({disabled:z,query:G,onChange:k}){const re=(0,xt.of)(yf),[ue,ve]=(0,a.useState)({value:G,dirty:!1}),[be]=(0,ed.A)(()=>{ue.dirty&&k(ue.value)},500,[ue.dirty,ue.value]);return(0,a.useEffect)(()=>{(be()||!ue.dirty)&&ue.value!==G&&ve({value:G,dirty:!1})},[be,ue,G]),(0,M.jsx)("div",{className:re.container,children:(0,M.jsx)(td.Z,{disabled:z,placeholder:(0,ae.t)("scopes.dashboards.search","Search"),value:ue.value,"data-testid":"scopes-dashboards-search",onChange:Ue=>ve({value:Ue,dirty:!0})})})}const yf=z=>({container:(0,_e.css)({flex:"0 1 auto"})});function xf(){const z=(0,xt.of)(Ef),G=(0,Cl.b)(),k=Bc();if((0,yo.A)(k?.scopesDashboardsService.stateObservable??new dl.c,k?.scopesDashboardsService.state),!k||!G||!G.state.enabled||!G.state.drawerOpened||G.state.readOnly)return null;const{scopesDashboardsService:re}=k,{loading:ue,forScopeNames:ve,dashboards:be,scopeNavigations:Ue,searchQuery:We,filteredFolders:Ze}=re.state,{changeSearchQuery:at,updateFolder:ct,clearSearchQuery:gt}=re;if(!ue){if(ve.length===0)return(0,M.jsx)("div",{className:(0,_e.cx)(z.container,z.noResultsContainer),"data-testid":"scopes-dashboards-notFoundNoScopes",children:(0,M.jsx)(ae.x6,{i18nKey:"scopes.dashboards.noResultsNoScopes",children:"No scopes selected"})});if(be.length===0&&Ue.length===0)return(0,M.jsx)("div",{className:(0,_e.cx)(z.container,z.noResultsContainer),"data-testid":"scopes-dashboards-notFoundForScope",children:(0,M.jsx)(ae.x6,{i18nKey:"scopes.dashboards.noResultsForScopes",children:"No dashboards or links found for the selected scopes"})})}return(0,M.jsxs)("div",{className:z.container,"data-testid":"scopes-dashboards-container",children:[(0,M.jsx)(vf,{disabled:ue,query:We,onChange:at}),ue?(0,M.jsx)(Wr._,{className:z.loadingIndicator,text:(0,ae.t)("scopes.dashboards.loading","Loading dashboards"),"data-testid":"scopes-dashboards-loading"}):Ze[""]?(0,M.jsx)(ql.P,{children:(0,M.jsx)(qc,{folders:Ze,folderPath:[""],onFolderUpdate:ct})}):(0,M.jsxs)("p",{className:z.noResultsContainer,"data-testid":"scopes-dashboards-notFoundForFilter",children:[(0,M.jsx)(ae.x6,{i18nKey:"scopes.dashboards.noResultsForFilter",children:"No results found for your query"}),(0,M.jsx)(oe.$n,{variant:"secondary",onClick:gt,"data-testid":"scopes-dashboards-notFoundForFilter-clear",children:(0,M.jsx)(ae.x6,{i18nKey:"scopes.dashboards.noResultsForFilterClear",children:"Clear search"})})]})]})}const Ef=z=>({container:(0,_e.css)({backgroundColor:z.colors.background.primary,borderRight:`1px solid ${z.colors.border.weak}`,display:"flex",flexDirection:"column",height:"100%",gap:z.spacing(1),padding:z.spacing(2),width:z.spacing(37.5)}),noResultsContainer:(0,_e.css)({alignItems:"center",display:"flex",flexDirection:"column",gap:z.spacing(1),height:"100%",justifyContent:"center",margin:0,textAlign:"center"}),loadingIndicator:(0,_e.css)({alignSelf:"center"})});var Pf=e(59875),nd=e(86634),ad=e(38206),Ol=e(1492);function Df(){return(0,M.jsx)(oe.$n,{icon:"add-user",size:"sm",variant:"secondary",fill:"solid",fullWidth:!0,onClick:()=>{_c("bottom_mega_menu","invite-user-bottom-mega-menu")},children:(0,ae.t)("navigation.invite-user.invite-new-member-button","Invite new member")})}var bf=e(89409),Cf=e(78685),Mf=e(30360),Il=e(1906),sd=e(991),Sf=e(90666);const Tf=({children:z})=>{const G=(0,xt.of)(Of);return(0,M.jsxs)(M.Fragment,{children:[z,(0,M.jsx)("span",{className:G.highlight})]})},Of=z=>({highlight:(0,_e.css)({backgroundColor:z.colors.success.main,borderRadius:z.shape.radiu
1559s.circle,width:"6px",height:"6px",display:"inline-block;",position:"absolute",top:"50%",transform:"translateY(-50%)"})});var If=e(20941);function rd({children:z,isActive:G,onClick:k,target:re,url:ue,onPin:ve,isPinned:be}){const Ue=(0,xt.$j)(),We=Rf(Ue,G),Ze=!re&&ue.startsWith("/")?If.N:"a",at=(0,M.jsxs)("div",{className:We.linkContent,children:[z,re==="_blank"&&(0,M.jsx)(Qn.I,{"data-testid":"external-link-icon",name:"external-link-alt"})]});return(0,M.jsxs)("div",{className:(0,_e.cx)(We.wrapper,{[We.wrapperActive]:G,[We.wrapperBookmark]:F.$.featureToggles.pinNavItems}),children:[(0,M.jsx)(Ze,{"data-testid":xa.Tp.components.NavMenu.item,className:We.container,href:ue,target:re,onClick:k,...G&&{"aria-current":"page"},children:at}),F.$.featureToggles.pinNavItems&&ta.TP.isSignedIn&&ue&&ue!=="/bookmarks"&&(0,M.jsx)(ba.K,{name:"bookmark",className:"pin-icon",iconType:be?"solid":"default",onClick:()=>ve(ue),"aria-label":be?(0,ae.t)("navigation.item.remove-bookmark","Remove from Bookmarks"):(0,ae.t)("navigation.item.add-bookmark","Add to Bookmarks")})]})}rd.displayName="MegaMenuItemText";const Rf=(z,G)=>({wrapper:(0,_e.css)({display:"flex",justifyContent:"space-between",width:"100%",height:"100%"}),wrapperBookmark:(0,_e.css)({".pin-icon":{visibility:"hidden"},"&:hover, &:focus-within":{a:{width:"calc(100% - 20px)"},".pin-icon":{visibility:"visible"}}}),wrapperActive:(0,_e.css)({backgroundColor:z.colors.action.selected,borderTopRightRadius:z.shape.radius.default,borderBottomRightRadius:z.shape.radius.default,position:"relative","&::before":{backgroundImage:z.colors.gradients.brandVertical,borderRadius:z.shape.radius.default,content:'" "',display:"block",height:"100%",position:"absolute",transform:"translateX(-50%)",width:z.spacing(.5)}}),container:(0,_e.css)({alignItems:"center",color:G?z.colors.text.primary:z.colors.text.secondary,height:"100%",position:"relative",width:"100%","&:hover span, &:focus-visible span":{color:z.colors.text.primary,textDecoration:"underline"},"&:focus-visible":{boxShadow:"none",outline:`2px solid ${z.colors.primary.main}`,outlineOffset:"-2px",transition:"none"}}),linkContent:(0,_e.css)({alignItems:"center",display:"flex",gap:"0.5rem",height:"100%",width:"100%",justifyContent:"space-between"})}),Rl=2;function od({link:z,activeItem:G,level:k=0,onClick:re,onPin:ue,isPinned:ve}){const{chrome:be}=(0,nr.Il)(),We=be.useState().megaMenuDocked,Ze=(0,ya.zy)(),at=z.highlightText?Tf:a.Fragment,ct=(0,ar.m0)(z,G),gt=z===G||k===Rl&&ct,[pt,ht]=(0,Cf.A)(`grafana.navigation.expanded[${z.text}]`,!!ct),vt=k<Rl&&!!(id(z)||z.emptyMessage),Ft=(0,a.useRef)(null),sn=(0,xt.of)(Af);if((0,a.useEffect)(()=>{ct&&ht(!0)},[ct,Ze,We,ht]),(0,a.useEffect)(()=>{gt&&Ft.current&&Lf(Ft.current)&&Ft.current.scrollIntoView({block:"center"})},[gt]),!z.url)return null;let fn=null;z.icon?fn=(0,M.jsx)(Qn.I,{className:sn.icon,name:(0,Mf.Uo)(z.icon)??"link",size:"lg"}):z.img&&(fn=(0,M.jsx)(Qt.B,{width:3,justifyContent:"center",children:(0,M.jsx)("img",{className:sn.img,src:z.img,alt:""})}));function In(Dn){return Dn?"angle-up":"angle-down"}return(0,M.jsxs)("li",{ref:Ft,className:sn.listItem,children:[(0,M.jsxs)("div",{className:(0,_e.cx)(sn.menuItem,{[sn.menuItemWithIcon]:!!(k===0&&fn)}),children:[k!==0&&(0,M.jsx)(Sf.T,{level:k===Rl?k-1:k,spacing:3}),k===Rl&&(0,M.jsx)("div",{className:sn.itemConnector}),(0,M.jsx)("div",{className:sn.collapsibleSectionWrapper,children:(0,M.jsx)(rd,{isActive:gt,onClick:()=>{z.onClick?.(),re?.()},target:z.target,url:z.url,onPin:()=>ue(z),isPinned:ve(z.url),children:(0,M.jsxs)("div",{className:(0,_e.cx)(sn.labelWrapper,{[sn.hasActiveChild]:ct,[sn.labelWrapperWithIcon]:!!(k===0&&fn)}),children:[k===0&&fn&&(0,M.jsx)(at,{children:fn}),(0,M.jsx)(Aa.E,{truncate:!0,children:z.text}),z.isNew&&(0,M.jsx)(sd.y,{featureState:Il.Ay.new})]})})}),(0,M.jsx)("div",{className:sn.collapseButtonWrapper,children:vt&&(0,M.jsx)(ba.K,{"aria-label":pt?(0,ae.t)("navigation.megamenu-item.collapse-aria-label","Collapse section: {{sectionName}}",{sectionName:z.text}):(0,ae.t)("navigation.megamenu-item.expand-aria-label","Expand section: {{sectionName}}",{sectionName:z.text}),className:sn.collapseButton,onClick:()=>ht(!pt),name:In(!!pt),size:"md",variant:"secondary"})})]}),vt&&pt&&(0,M.jsx)("ul",{className:sn.children,children:id(z)?z.children.filter(Dn=>!Dn.isCreateAction).map(Dn=>(0,M.jsx)(od,{link:Dn,activeItem:G,onClick:re,level:k+1,onPin:ue,isPinned:ve},`${z.text}-${Dn.text}`)):(0,M.jsx)("div",{className:sn.emptyMessage,"aria-live":"polite",children:z.emptyMessage})})]})}const Af=z=>({icon:(0,_e.css)({width:z.spacing(3)}
1559),img:(0,_e.css)({height:z.spacing(2),width:z.spacing(2)}),listItem:(0,_e.css)({flex:1,maxWidth:"100%"}),menuItem:(0,_e.css)({display:"flex",alignItems:"center",gap:z.spacing(1),height:z.spacing(4),paddingLeft:z.spacing(.5),position:"relative"}),menuItemWithIcon:(0,_e.css)({paddingLeft:z.spacing(0)}),collapseButtonWrapper:(0,_e.css)({display:"flex",justifyContent:"center",width:z.spacing(3),flexShrink:0}),itemConnector:(0,_e.css)({position:"relative",height:"100%",width:z.spacing(1.5),"&::before":{borderLeft:`1px solid ${z.colors.border.medium}`,content:'""',height:"100%",right:0,position:"absolute",transform:"translateX(50%)"}}),collapseButton:(0,_e.css)({margin:0}),collapsibleSectionWrapper:(0,_e.css)({alignItems:"center",display:"flex",flex:1,height:"100%",minWidth:0}),labelWrapper:(0,_e.css)({display:"flex",alignItems:"center",gap:z.spacing(2),minWidth:0,paddingLeft:z.spacing(1)}),labelWrapperWithIcon:(0,_e.css)({paddingLeft:z.spacing(.5)}),hasActiveChild:(0,_e.css)({color:z.colors.text.primary}),children:(0,_e.css)({display:"flex",listStyleType:"none",flexDirection:"column"}),emptyMessage:(0,_e.css)({color:z.colors.text.secondary,fontStyle:"italic",padding:z.spacing(1,1.5,1,7)})});function id(z){return!!(z.children&&z.children.length>0)}function Lf(z){const G=z.getBoundingClientRect();return G.bottom<0||G.top>=window.innerHeight}var jf=e(5071);const xo="300px",ec=(0,a.memo)((0,a.forwardRef)(({onClose:z,...G},k)=>{const re=(0,hn.useSelector)(sn=>sn.navBarTree),ue=(0,xt.of)(Bf),ve=(0,ya.zy)(),{chrome:be}=(0,nr.Il)(),Ue=(0,hn.useDispatch)(),We=be.useState(),[Ze]=(0,Ol.o)(),at=(0,jf.s)(),ct=re.filter(sn=>sn.id!=="profile"&&sn.id!=="help").map(sn=>(0,ar.J0)(sn,We.megaMenuDocked));if(F.$.featureToggles.pinNavItems){const sn=ct.find(fn=>fn.id==="bookmarks");sn&&(sn.children=at.reduce((fn,In)=>{const Dn=(0,ar.Wk)(ct,In);if(!Dn)return fn;const ua={id:Dn.id,text:Dn.text,url:Dn.url,parentItem:{id:"bookmarks",text:"Bookmarks"}};return fn.push((0,ar.J0)(ua,We.megaMenuDocked)),fn},[]))}const gt=(0,ar.A6)(ct,We.sectionNav.node,ve.pathname),pt=()=>{be.setMegaMenuOpen(!We.megaMenuOpen)},ht=()=>{be.setMegaMenuDocked(!We.megaMenuDocked),We.megaMenuDocked&&be.setMegaMenuOpen(!1)},vt=(0,a.useCallback)(sn=>!sn||!at?.length?!1:at?.includes(sn),[at]),Ft=sn=>{const fn=sn.url;if(fn&&F.$.featureToggles.pinNavItems){const In=vt(fn),Dn=In?at.filter(fa=>fn!==fa):[...at,fn],ua=In?"grafana_nav_item_unpinned":"grafana_nav_item_pinned";(0,Sa.rR)(ua,{path:fn}),Ze({patchPrefsCmd:{navbar:{bookmarkUrls:Dn}}}).then(fa=>{fa.error||Ue((0,ad.ve)({item:sn,isSaved:!In}))})}};return(0,M.jsxs)("div",{"data-testid":xa.Tp.components.NavMenu.Menu,ref:k,...G,children:[(0,M.jsx)(bf.fn,{handleDockedMenu:ht,handleMegaMenu:pt,onClose:z}),(0,M.jsxs)("nav",{className:ue.content,children:[(0,M.jsx)(ql.P,{height:"100%",overflowX:"hidden",showScrollIndicators:!0,children:(0,M.jsx)("ul",{className:ue.itemList,"aria-label":(0,ae.t)("navigation.megamenu.list-label","Navigation"),children:ct.map((sn,fn)=>(0,M.jsx)(od,{link:sn,isPinned:vt,onClick:We.megaMenuDocked?void 0:z,activeItem:gt,onPin:Ft},sn.text))})}),Gc&&(0,M.jsx)("div",{className:ue.inviteNewMemberButton,children:(0,M.jsx)(Df,{})})]})]})}));ec.displayName="MegaMenu";const Bf=z=>({content:(0,_e.css)({display:"flex",flexDirection:"column",minHeight:0,flexGrow:1,position:"relative"}),mobileHeader:(0,_e.css)({display:"flex",justifyContent:"space-between",padding:z.spacing(1,1,1,2),borderBottom:`1px solid ${z.colors.border.weak}`,[z.breakpoints.up("md")]:{display:"none"}}),itemList:(0,_e.css)({boxSizing:"border-box",display:"flex",flexDirection:"column",listStyleType:"none",padding:z.spacing(1,1,2,1),[z.breakpoints.up("md")]:{width:xo}}),inviteNewMemberButton:(0,_e.css)({display:"flex",padding:z.spacing(1.5,1,1.5,1),borderTop:`1px solid ${z.colors.border.weak}`}),dockMenuButton:(0,_e.css)({display:"none",position:"relative",top:z.spacing(1),[z.breakpoints.up("xl")]:{display:"inline-flex"}})});function Uf({}){const z=(0,xt.$j)(),{chrome:G}=(0,nr.Il)(),k=G.useState(),re=(0,a.useRef)(null),ue=(0,a.useRef)(null),ve=z.transitions.duration.shortest,be=(0,xt.of)(Wf,ve),Ue=k.megaMenuOpen&&!k.megaMenuDocked,We=()=>G.setMegaMenuOpen(!1),{overlayProps:Ze,underlayProps:at}
1559=(0,Kc.e)({isDismissable:!0,isOpen:!0,onClose:We,shouldCloseOnInteractOutside:pt=>!document.querySelector(`[data-testid="${xa.Tp.components.Select.menu}"]`)?.contains(pt)},re),{dialogProps:ct}=(0,Wc.s)({},re),gt=(0,xt.of)(Nf);return(0,M.jsx)("div",{className:gt.wrapper,children:(0,M.jsxs)(Pf.Sf,{children:[(0,M.jsx)(nd.A,{nodeRef:re,in:Ue,unmountOnExit:!0,classNames:be.overlay,timeout:{enter:ve,exit:0},children:(0,M.jsx)(M.Fragment,{children:Ue&&(0,M.jsx)(Fc.n1,{contain:!0,autoFocus:!0,restoreFocus:!0,children:(0,M.jsx)(ec,{className:gt.menu,onClose:We,ref:re,...Ze,...ct})})})}),(0,M.jsx)(nd.A,{nodeRef:ue,in:Ue,unmountOnExit:!0,classNames:be.backdrop,timeout:{enter:ve,exit:0},children:(0,M.jsx)("div",{ref:ue,className:gt.backdrop,...at})})]})})}const Nf=z=>({backdrop:(0,_e.css)({backgroundColor:z.components.overlay.background,bottom:0,left:0,position:"fixed",right:0,top:0,zIndex:z.zIndex.modalBackdrop}),menu:(0,_e.css)({display:"flex",bottom:0,flexDirection:"column",left:0,right:0,zIndex:z.zIndex.modal,position:"fixed",top:0,backgroundColor:z.colors.background.primary,flex:"1 1 0",[z.breakpoints.up("md")]:{right:"unset"}}),wrapper:(0,_e.css)({position:"fixed",display:"grid",gridAutoFlow:"column",height:"100%",zIndex:z.zIndex.sidemenu})}),Wf=(z,G)=>{const k={[z.transitions.handleMotion("no-preference")]:{transitionDuration:`${G}ms`,transitionTimingFunction:z.transitions.easing.easeInOut},[z.breakpoints.down("md")]:{overflow:"hidden"}},re={...k,transitionProperty:"box-shadow, width",".scrollbar-view":{overflow:"hidden !important"}},ue={...k,transitionProperty:"opacity"},ve={width:"100%",[z.breakpoints.up("md")]:{borderRight:`1px solid ${z.colors.border.weak}`,boxShadow:z.shadows.z3,width:xo}},be={boxShadow:"none",width:0},Ue={opacity:1},We={opacity:0};return{backdrop:{enter:(0,_e.css)(We),enterActive:(0,_e.css)(ue,Ue),enterDone:(0,_e.css)(Ue)},overlay:{enter:(0,_e.css)(be),enterActive:(0,_e.css)(re,ve),enterDone:(0,_e.css)(ve)}}};var ci=e(32899),wa=e(45229);function Ff(z,G){if(z===G)return!0;if(!(z instanceof Object)||!(G instanceof Object))return!1;const k=Object.keys(z),re=k.length;for(let ue=0;ue<re;ue++)if(!(k[ue]in G))return!1;for(let ue=0;ue<re;ue++)if(z[k[ue]]!==G[k[ue]])return!1;return re===Object.keys(G).length}var ld=e(18607);const Kf="grafana_unified_history_entry_clicked",wf="grafana_unified_history_duplicated_entry_rendered",Vf="grafana_unified_history_drawer_interaction",$f="grafana_unified_history_show_more",cd=({entryURL:z,subEntry:G})=>{(0,Sa.rR)(Kf,{entryURL:z,subEntry:G})},zf=({entryName:z,lastEntryURL:G,newEntryURL:k})=>{(0,Sa.rR)(wf,{entryName:z,lastEntryURL:G,newEntryURL:k})},dd=({type:z})=>{(0,Sa.rR)(Vf,{type:z})},Hf=()=>{(0,Sa.rR)($f)},tc="grafana.navigation.docked",ud="grafana.navigation.open",ul="grafana.navigation.history";class Gf{constructor(){this.searchBarStorageKey="SearchBar_Hidden",this.routeChangeHandled=!0,this.megaMenuDocked=!!(window.innerWidth>=F.$.theme2.breakpoints.values.xl&&xr.A.getBool(tc,window.innerWidth>=F.$.theme2.breakpoints.values.xl)),this.sessionStorageData=window.sessionStorage.getItem("returnToPrevious"),this.returnToPreviousData=this.sessionStorageData?JSON.parse(this.sessionStorageData):void 0,this.state=new ll.t({chromeless:!0,sectionNav:{node:{text:(0,ae.t)("nav.home.title","Home")},main:{text:""}},megaMenuOpen:this.megaMenuDocked&&xr.A.getBool(ud,!0),megaMenuDocked:this.megaMenuDocked,kioskMode:null,layout:Ql.k.Canvas,returnToPrevious:this.returnToPreviousData}),this.setReturnToPrevious=G=>{const k=this.state.getValue().returnToPrevious;(0,Sa.rR)("grafana_return_to_previous_button_created",{page:G.href,previousPage:k?.href}),this.update({returnToPrevious:G}),window.sessionStorage.setItem("returnToPrevious",JSON.stringify(G))},this.clearReturnToPrevious=G=>{const k=this.state.getValue().returnToPrevious;k&&(0,Sa.rR)("grafana_return_to_previous_button_dismissed",{action:G,page:k.href}),this.update({returnToPrevious:void 0}),window.sessionStorage.removeItem("returnToPrevious")},this.setMegaMenuOpen=G=>{const{megaMenuDocked:k}=this.state.getValue();k&&xr.A.set(ud,G),(0,Sa.rR)("grafana_mega_menu_open",{state:G}),this.update({megaMenuOpen:G})},this.setMegaMenuDocked=(G,k=!0)=>{k&&xr.A.set(tc,G),(0,Sa.rR)("grafana_mega_menu_docked",{state:G}),this.update({megaMenuDocked:G})},this.onToggleKioskMode=()=>{const G=this.getNextKioskMode();this.update({kioskMode:G}),P.Ny.partial({kiosk:this.getKioskUrlValue(G)}),(0,Sa.rR)("grafana_kiosk_mode",{action:"toggle",mode:G})}}setMatchedRoute(G){this.currentRoute!==G&&(this.currentRoute=G,this.routeChangeHandled=!1)}update(G){const k=this.state.getValue(),re={...k};this.routeChangeHandled||(re.actions=void 0,re.pageNav=void 0,re.sectionNav={node:{text:(0,ae.t)("nav.home.title","Home")},main:{text:""}}
1559,re.chromeless=this.currentRoute?.chromeless,re.layout=Ql.k.Standard,this.routeChangeHandled=!0),Object.assign(re,G),re.chromeless=re.kioskMode===hn.KioskMode.Full||this.currentRoute?.chromeless,this.ignoreStateUpdate(re,k)||(F.$.featureToggles.unifiedHistory&&xr.A.setObject(ul,this.getUpdatedHistory(re)),this.state.next(re))}getUpdatedHistory(G){const k=(0,ld.Z)(G.sectionNav.node,G.pageNav,{text:"Home",url:"/"},!0),re=G.pageNav||G.sectionNav.node;let ue=xr.A.getObject(ul,[]);if(xr.A.getObject("CLICKING_HISTORY"))return xr.A.setObject("CLICKING_HISTORY",!1),ue;if(!re)return ue;const be=ue[0],Ue={name:re.text,views:[],breadcrumbs:k,time:Date.now(),url:window.location.href};return be&&Ue.url.split("?")[0]===be.url.split("?")[0]?ue[0]=Ue:(be&&be.name===Ue.name&&zf({entryName:Ue.name,lastEntryURL:be.url,newEntryURL:Ue.url}),ue=[Ue,...ue]),ue}ignoreStateUpdate(G,k){return!!(Ff(G,k)||(G.sectionNav!==k.sectionNav||G.pageNav!==k.pageNav)&&G.actions===k.actions&&G.layout===k.layout&&nc(G.sectionNav.node,k.sectionNav.node)&&nc(G.pageNav,k.pageNav))}useState(){return(0,yo.A)(this.state,this.state.getValue())}exitKioskMode(){this.update({kioskMode:void 0}),P.Ny.partial({kiosk:null}),(0,Sa.rR)("grafana_kiosk_mode",{action:"exit"})}setKioskModeFromUrl(G){let k;switch(G){case"1":case!0:k=hn.KioskMode.Full}k&&k!==this.state.getValue().kioskMode&&this.update({kioskMode:k})}getKioskUrlValue(G){switch(G){case hn.KioskMode.Full:return!0;default:return null}}getNextKioskMode(){return wa.A.emit(ci.r1.alertInfo,[(0,ae.t)("navigation.kiosk.tv-alert","Press ESC to exit kiosk mode")]),hn.KioskMode.Full}}function nc(z,G){if(z===G)return!0;const k=z?.children?.find(ue=>ue.active),re=G?.children?.find(ue=>ue.active);return z?.text===G?.text&&z?.url===G?.url&&k?.url===re?.url&&nc(z?.parentItem,G?.parentItem)}var ac=e(92270),_f=e(93256);const hd=({label:z,onClick:G,onDismiss:k})=>{const re=(0,xt.of)(Qf);return(0,M.jsxs)(_f.e,{className:re.buttonGroup,children:[(0,M.jsx)(oe.$n,{icon:"angle-left",size:"sm",variant:"primary",fill:"outline",onClick:G,title:z,className:re.mainDismissableButton,"data-testid":xa.Tp.components.ReturnToPrevious.backButton,children:z}),(0,M.jsx)(oe.$n,{icon:"times","aria-label":(0,ae.t)("return-to-previous.dismissable-button","Close"),variant:"primary",fill:"outline",size:"sm",onClick:k,"data-testid":xa.Tp.components.ReturnToPrevious.dismissButton})]})},Qf=z=>({mainDismissableButton:(0,_e.css)({width:"100%","> span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"270px",display:"inline-block"}}),buttonGroup:(0,_e.css)({width:"fit-content",backgroundColor:z.colors.background.secondary})});hd.displayName="DismissableButton";const fd=({href:z,title:G})=>{const k=(0,xt.of)(kf),{chrome:re}=(0,nr.Il)(),ue=(0,a.useCallback)(()=>{P.Ny.push(z),re.clearReturnToPrevious("clicked")},[z,re]),ve=(0,a.useCallback)(()=>{re.clearReturnToPrevious("dismissed")},[re]);return(0,M.jsx)("div",{className:k.returnToPrevious,"data-testid":xa.Tp.components.ReturnToPrevious.buttonGroup,children:(0,M.jsx)(hd,{label:(0,ae.t)("return-to-previous.button.label","Back to {{title}}",{title:G}),onClick:ue,onDismiss:ve})})},kf=z=>({returnToPrevious:(0,_e.css)({label:"return-to-previous",display:"flex",justifyContent:"center",left:"50%",transform:"translateX(-50%)",zIndex:z.zIndex.tooltip,position:"fixed",bottom:z.spacing.x4,boxShadow:z.shadows.z3})});fd.displayName="ReturnToPrevious";var Kr=e(7895),Yf=e(95943),sc=e(43550),pd=e(92948);function Jf({href:z,isCurrent:G,text:k,index:re,flexGrow:ue}){const ve=(0,xt.of)(Xf),be=()=>{(0,Sa.rR)("grafana_breadcrumb_clicked",{url:z})};return(0,M.jsx)("li",{className:ve.breadcrumbWrapper,style:{flexGrow:ue},children:G?(0,M.jsx)("span",{"data-testid":xa.XF.Breadcrumbs.breadcrumb(k),className:ve.breadcrumb,"aria-current":"page",title:k,children:k}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("a",{onClick:be,"data-testid":xa.XF.Breadcrumbs.breadcrumb(k),className:(0,_e.cx)(ve.breadcrumb,ve.breadcrumbLink),title:k,href:z,children:k}),(0,M.jsx)("div",{className:ve.separator,"aria-hidden":!0,children:(0,M.jsx)(Qn.I,{name:"angle-right"})})]})})}const Xf=z=>({breadcrumb:(0,_e.css)({display:"block",textOverflow:"ellipsis",overflow:"hidden",
1559whiteSpace:"nowrap",color:z.colors.text.secondary}),breadcrumbLink:(0,_e.css)({color:z.colors.text.primary,"&:hover":{textDecoration:"underline"}}),breadcrumbWrapper:(0,_e.css)({alignItems:"center",color:z.colors.text.primary,display:"flex",flex:1,gap:z.spacing(.5),minWidth:0,maxWidth:"max-content",padding:z.spacing(.5,0,.5,.5),[z.breakpoints.down("sm")]:{display:"none","&:nth-last-child(2)":{display:"flex",minWidth:"40px"},"&:last-child":{display:"flex"}}}),separator:(0,_e.css)({color:z.colors.text.secondary})});function Zf({breadcrumbs:z,className:G}){const k=(0,xt.of)(ep);return(0,M.jsx)("nav",{"aria-label":(0,ae.t)("navigation.breadcrumbs.aria-label","Breadcrumbs"),className:G,children:(0,M.jsx)("ol",{className:k.breadcrumbs,children:z.map((re,ue)=>(0,a.createElement)(Jf,{...re,isCurrent:ue===z.length-1,key:ue,index:ue,flexGrow:qf(ue,z.length)}))})})}function qf(z,G){return G<5&&z>0&&z<G-2||G>6&&z>1&&z<G-3?4:10}const ep=z=>({breadcrumbs:(0,_e.css)({display:"flex",alignItems:"center",flexWrap:"nowrap",overflow:"hidden"})});var Eo=e(5423);function tp(){const z=np((0,xt.$j)()),{availableComponents:G,dockedComponentId:k,setDockedComponentId:re,isOpen:ue,isEnabled:ve}=(0,li.sA)();if(!ve||G.size===0)return null;const be=Array.from(G.entries()).flatMap(([We,{addedComponents:Ze}])=>Ze.map(at=>({...at,pluginId:We})));if(be.length===0)return null;if(be.length===1)return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Kr.I,{icon:"ai-sparkle","data-testid":"extension-toolbar-button",className:(0,_e.cx)(z.button,ue&&z.buttonActive),tooltip:be[0].description,onClick:()=>{re(ue?void 0:(0,li.pF)(be[0].pluginId,be[0]))}}),(0,M.jsx)(Eo.K,{})]});const Ue=(0,M.jsx)(Os.W,{children:be.map(We=>{const Ze=(0,li.pF)(We.pluginId,We);return(0,M.jsx)(Os.W.Item,{active:k===Ze,label:We.title,onClick:()=>{re(ue&&k===Ze?void 0:Ze)}},Ze)})});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(vo.m,{overlay:Ue,placement:"bottom-end",children:(0,M.jsx)(Kr.I,{className:(0,_e.cx)(z.button,ue&&z.buttonActive),icon:"ai-sparkle","data-testid":"extension-toolbar-button",variant:"default",tooltip:(0,ae.t)("navigation.extension-sidebar.button-tooltip","Open AI assistants and sidebar apps")})}),(0,M.jsx)(Eo.K,{})]})}function np(z){return{button:(0,_e.css)({aspectRatio:"1 / 1 !important",width:"28px",height:"28px",padding:0,justifyContent:"center",borderRadius:z.shape.radius.circle,margin:z.spacing(0,.25)}),buttonActive:(0,_e.css)({borderRadius:z.shape.radius.circle,backgroundColor:z.colors.primary.transparent,border:`1px solid ${z.colors.primary.borderTransparent}`,color:z.colors.text.primary})}}var rc=e(42941),Po=e(78012),ds=e(87745),ap=e(95093),hl=e.n(ap),sp=e(35137),gd=e(8073),rp=e(53431),op=e(12810);function ip({onClose:z}){const G=Po.M.getObject(ul,[]).filter(Ue=>hl()(Ue.time).isAfter(hl()().subtract(2,"day").startOf("day"))),[k,re]=(0,a.useState)(5),ue=G.find(Ue=>Ue.url===window.location.href||Ue.views.some(We=>We.url===window.location.href))?.time,ve=G.slice(0,k).reduce((Ue,We)=>{const Ze=hl()(We.time);let at="";return Ze.isSame(hl()(),"day")?at=(0,ae.t)("nav.history-wrapper.today","Today"):Ze.isSame(hl()().subtract(1,"day"),"day")?at=(0,ae.t)("nav.history-wrapper.yesterday","Yesterday"):at=Ze.format("YYYY-MM-DD"),Ue[at]=[...Ue[at]||[],We],Ue},{}),be=(0,xt.of)(md);return(0,M.jsxs)(Qt.B,{direction:"column",alignItems:"flex-start",children:[(0,M.jsx)(se.a,{width:"100%",children:Object.keys(ve).map((Ue,We)=>(0,M.jsxs)(Qt.B,{direction:"column",gap:1,children:[(0,M.jsx)(se.a,{paddingLeft:2,children:(0,M.jsx)(Aa.E,{color:"secondary",children:Ue})}),(0,M.jsx)("div",{className:be.timeline,children:ve[Ue].map((Ze,at)=>(0,M.jsx)(lp,{entry:Ze,isSelected:Ze.time===ue,onClick:()=>z()},at))})]},We))}),G.length>k&&(0,M.jsx)(se.a,{paddingLeft:2,children:(0,M.jsx)(oe.$n,{variant:"secondary",fill:"text",onClick:()=>{re(k+5),Hf()},children:(0,ae.t)("nav.history-wrapper.show-more","Show more")})})]})}function lp({entry:z,isSelected:G,onClick:k}){const re=(0,xt.of)(md),ue=(0,xt.$j)(),[ve,be]=(0,a.useState)(G&&z.views.length>0),{breadcrumbs:Ue,views:We,time:Ze,url:at,sparklineData:ct}=z,gt=ve?(0,ae.t)("nav.history-wrapper.collapse","Collapse"):(0,ae.t)("nav.history-wrapper.expand","Expand"),pt=ve?(0,ae.t)("nav.history-wrapper.icon-selected","Selected Entry"):(0,ae.t)("nav.history-wrapper.icon-unselected","Normal Entry"),ht=G&&z.views.find(vt=>vt.url===window.location.href)?.time;return(0,M.jsx)(se.a,{marginBottom:1,children:(0,M.jsxs)(Qt.B,{direction:"column",gap:1,children:[(0,M.jsxs)(Qt.B,{alignItems:"baseline",children:[We.length>0?(0,M.jsx)(ba.K,{name:ve?"angle-down":"angle-right",onClick:()=>be(!ve),"aria-label":gt,className:re.iconButton}):(0,M.jsx)(sp.$,{h:2}),(0,M.jsx)(Qn.I,{size:"sm",name:G?"circle-mono":"circle","aria-label":pt,className:ve?re.iconButtonDot:re.iconButtonCircle}),(0,M.jsx)(gd.Z,{onClick:()=>{Po.M.setObject("CLICKING_HISTORY",!0),k(),cd({entryURL:at})},href:at,isCompact:!0,className:G?re.card:(0,_e.cx)(re.card,re.cardSelected),children:(0,M.jsxs)(Qt.B,{direction:"column",children:[(0,M.jsx)("div",{children:Ue.map((vt,Ft)=>(0,M.jsxs)(Aa.E,{children:[vt.text," ",Ft!==Ue.length-1?"> ":""]},Ft))}),(0,M.jsx)(Aa.E,{variant:"bodySmall",color:"secondary",children:(0,op.Y)(Ze,{timeStyle:"short"})}),ct&&(0,M.jsx)(rp.O,{theme:ue,width:240,height:40,config:{custom:{fillColor:"rgba(130, 181, 216, 0.1)",lineColor:"#82B5D8"}},sparkline:{y:{type:_.PU.number,name:"test",config:{},values:ct.values,state:{range:{...ct.range}}}}})]})})]}),ve&&(0,M.jsx)("div",{className:re.expanded,children:We.map((vt,Ft)=>(0,M.jsx)(gd.Z,{href:vt.url,onClick:()=>{Po.M.setObject("CLICKING_HISTORY",!0),k(),cd({entryURL:vt.url,subEntry:"timeRange"})},isCompact:!0,className:vt.time===ht?void 0:re.subCard,children:(0,M.jsxs)(Qt.B,{direction:"column",gap:0,children:[(0,M.jsx)(Aa.E,{variant:"bodySmall",children:vt.name}),vt.description&&(0,M.jsx)(Aa.E,{color:"secondary",variant:"bodySmall",children:vt.description})]})},Ft))})]})})}const md=z=>({card:(0,_e.css)({label:"card",background:"none",margin:z.spacing(.5,0)}),cardSelected:(0,_e.css)({label:"card-selected",background:"none"}),subCard:(0,_e.css)({label:"subcard",background:"none",margin:0}),iconButton:(0,_e.css)({label:"expand-button",margin:0}),iconButtonCircle:(0,_e.css)({label:"blue-circle-icon",margin:0,background:z.colors.background.primary,fill:z.colors.primary.main,cursor:"default","&:hover:before":{background:"none"},zIndex:0}),iconButtonDot:(0,_e.css)({label:"blue-dot-icon",margin:0,color:z.colors.primary.main,border:z.shape.radiu
1559s.circle,cursor:"default","&:hover:before":{background:"none"},zIndex:0}),expanded:(0,_e.css)({label:"expanded",display:"flex",flexDirection:"column",marginLeft:z.spacing(6),gap:z.spacing(1),position:"relative","&:before":{content:'""',position:"absolute",left:0,top:0,height:"100%",width:"1px",background:z.colors.border.weak}}),timeline:(0,_e.css)({label:"timeline",position:"relative",height:"100%",width:"100%",paddingLeft:z.spacing(2),"&:before":{content:'""',position:"absolute",left:z.spacing(5.75),top:0,height:"100%",width:"1px",borderLeft:`1px dashed ${z.colors.border.strong}`}})});function cp(){const[z,G]=(0,rc.A)(!1),k=(0,xt.of)(dp);return(0,a.useEffect)(()=>{const re=wa.l.subscribe(ds.sj,ue=>{if(Po.M.getObject("CLICKING_HISTORY")){Po.M.setObject("CLICKING_HISTORY",!1);return}const be=Po.M.getObject(ul,[]);let Ue=be[0];const We=ue.payload.url;return Ue.views[0]?.url!==We&&(Ue.views=[{name:ue.payload.name,description:ue.payload.description,url:We,time:Date.now()},...Ue.views],Po.M.setObject(ul,[...be])),()=>{re.unsubscribe()}})},[]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Kr.I,{onClick:()=>{G(),dd({type:"open"})},iconOnly:!0,icon:"history","aria-label":(0,ae.t)("nav.history-container.drawer-tittle","History")}),(0,M.jsx)(Eo.K,{className:k.separator}),z&&(0,M.jsx)(cs._,{title:(0,ae.t)("nav.history-container.drawer-tittle","History"),onClose:()=>{G(),dd({type:"close"})},size:"sm",children:(0,M.jsx)(ip,{onClose:()=>G(!1)})})]})}const dp=z=>({separator:(0,_e.css)({[z.breakpoints.down("sm")]:{display:"none"}})});function vd(z){const G=[];for(const k of z)k.isCreateAction&&G.push(k),k.children&&G.push(...vd(k.children));return G}const up=({})=>{const z=(0,hn.useSelector)(be=>be.navBarTree),[G,k]=(0,a.useState)(!1),re=(0,a.useMemo)(()=>vd(z),[z]),ue=re.length>0;if(!ue)return null;const ve=()=>(0,M.jsx)(Os.W,{children:re.map((be,Ue)=>(0,M.jsx)(Os.W.Item,{url:be.url,label:be.text,onClick:()=>(0,Sa.rR)("grafana_menu_item_clicked",{url:be.url,from:"quickadd"})},Ue))});return ue?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(vo.m,{overlay:ve,placement:"bottom-end",onVisibleChange:k,children:(0,M.jsx)(Kr.I,{iconOnly:!0,icon:"plus",isOpen:G,"aria-label":(0,ae.t)("navigation.quick-add.aria-label","New")})}),(0,M.jsx)(Eo.K,{})]}):null};var fl=e(94535),hp=e(89640),yd=e(45450),fp=e(35555),pp=e(3271);function gp({theme:z}){return(0,M.jsx)(fp.D.Provider,{value:z,children:(0,M.jsx)(mp,{})})}function mp(){const z=(0,xt.of)(vp);return(0,M.jsx)(se.a,{backgroundColor:"canvas",display:"flex",direction:"column",grow:1,children:(0,M.jsxs)(Qt.B,{gap:0,direction:"column",children:[(0,M.jsxs)(se.a,{display:"flex",justifyContent:"space-between",alignItems:"center",gap:.5,backgroundColor:"primary",height:3,paddingY:.5,paddingX:1,children:[(0,M.jsxs)(Qt.B,{alignItems:"center",gap:.5,children:[(0,M.jsx)(pd.M.MenuLogo,{className:z.img}),(0,M.jsxs)("div",{className:z.breadcrumbs,children:[(0,M.jsx)(ae.x6,{i18nKey:"theme-preview.breadcrumbs.home",children:"Home"}),(0,M.jsx)(Qn.I,{className:z.breadcrumbSeparator,name:"angle-right"}),(0,M.jsx)(ae.x6,{i18nKey:"theme-preview.breadcrumbs.dashboards",children:"Dashboards"})]})]}),(0,M.jsxs)(Qt.B,{alignItems:"center",gap:.5,children:[(0,M.jsx)("div",{className:z.formInput}),(0,M.jsx)(se.a,{borderStyle:"solid",borderColor:"medium",borderRadius:"circle",height:1,width:1,backgroundColor:"secondary",marginLeft:.5})]})]}),(0,M.jsx)(pp.c,{spacing:0}),(0,M.jsx)(se.a,{padding:2.5,display:"flex",direction:"column",flex:1,children:(0,M.jsxs)("div",{className:z.panel,children:[(0,M.jsx)("div",{className:z.panelHeader,children:(0,M.jsx)(ae.x6,{i18nKey:"theme-preview.panel.title",children:"Panel"})}),(0,M.jsxs)(se.a,{padding:.5,display:"flex",direction:"column",gap:.5,grow:1,children:[(0,M.jsx)("div",{className:z.formLabel,children:(0,M.jsx)(ae.x6,{i18nKey:"theme-preview.panel.form-label",children:"Form label"})}),(0,M.jsx)("div",{className:z.formInput})]}),(0,M.jsxs)(se.a,{display:"flex",gap:.5,padding:1,justifyContent:"flex-end",children:[(0,M.jsx)("div",{className:(0,_e.cx)(z.action,z.actionSecondary)}),(0,M.jsx)("div",{className:(0,_e.cx)(z.action,z.actionDanger)}),(0,M.jsx)("div",{className:(0,_e.cx)(z.action,z.actionPrimary)})]})]})})]})})}const vp=z=>({breadcrumbs:(0,_e.css)({alignItems:"center",color:z.colors.text.primary,display:"flex",fontSize:Math.round(z.typography.fontSize/3),gap:z.spacing(.25),lineHeight:Math.round(z.typography.body.lineHeight/3),paddingLeft:z.spacing(.5)}
1559),breadcrumbSeparator:(0,_e.css)({height:z.spacing(.75),width:z.spacing(.75)}),img:(0,_e.css)({height:z.spacing(1),width:z.spacing(1)}),panel:(0,_e.css)({background:z.components.panel.background,border:`1px solid ${z.components.panel.borderColor}`,borderRadius:z.shape.radius.default,display:"flex",flexDirection:"column",flexGrow:1}),panelHeader:(0,_e.css)({alignItems:"center",color:z.colors.text.primary,display:"flex",fontSize:Math.round(z.typography.fontSize/3),height:z.spacing(2),lineHeight:Math.round(z.typography.body.lineHeight/3),padding:z.spacing(.5)}),formLabel:(0,_e.css)({color:z.colors.text.primary,fontSize:Math.round(z.typography.fontSize/3),lineHeight:Math.round(z.typography.body.lineHeight/3)}),formInput:(0,_e.css)({background:z.components.input.background,border:`1px solid ${z.colors.border.medium}`,borderRadius:z.shape.radius.default,height:z.spacing(1),width:z.spacing(6)}),action:(0,_e.css)({borderRadius:z.shape.radius.default,height:z.spacing(1),width:z.spacing(2.5)}),actionSecondary:(0,_e.css)({background:z.colors.secondary.main}),actionDanger:(0,_e.css)({background:z.colors.error.main}),actionPrimary:(0,_e.css)({background:z.colors.primary.main})});function yp({themeOption:z,isExperimental:G,isSelected:k,onSelect:re}){const ue=z.build(),ve=Ep(z),be=(0,xt.of)(xp);return(0,M.jsxs)("div",{className:be.card,onClick:re,children:[(0,M.jsxs)("div",{className:be.header,children:[(0,M.jsx)(yd.J,{id:`theme-${ue.name}`,name:"theme",label:ve,onClick:Ue=>{Ue.stopPropagation()},onChange:re,checked:k}),G&&(0,M.jsx)(sd.y,{featureState:Il.Ay.experimental})]}),(0,M.jsx)(gp,{theme:ue})]})}const xp=z=>({card:(0,_e.css)({border:`1px solid ${z.colors.border.weak}`,borderRadius:z.shape.radius.default,display:"flex",flexDirection:"column",overflow:"hidden",cursor:"pointer","&:hover":{border:`1px solid ${z.colors.border.medium}`}}),header:(0,_e.css)({alignItems:"center",borderBottom:`1px solid ${z.colors.border.weak}`,display:"flex",justifyContent:"space-between",padding:z.spacing(1),"> label":{cursor:"pointer"}})});function Ep(z){switch(z.id){case"dark":return(0,ae.t)("shared.preferences.theme.dark-label","Dark");case"light":return(0,ae.t)("shared.preferences.theme.light-label","Light");case"system":return(0,ae.t)("shared.preferences.theme.system-label","System preference");default:return z.name}}var Pp=e(61074);function Dp({onClose:z}){const G=(0,xt.of)(bp),k=(0,Pp.F)(),re=(0,xt.$j)(),ue=be=>{(0,Sa.rR)("grafana_preferences_theme_changed",{toTheme:be.id,preferenceType:"theme_drawer"}),(0,cl.K)(be.id,!1)},ve=(0,M.jsxs)(ae.x6,{i18nKey:"shared-preferences.fields.theme-description",children:["Enjoying the experimental themes? Tell us what you'd like to see"," ",(0,M.jsx)(hp.Y,{variant:"bodySmall",external:!0,href:"https://docs.google.com/forms/d/e/1FAIpQLSeRKAY8nUMEVIKSYJ99uOO-dimF6Y69_If1Q1jTLOZRWqK1cw/viewform?usp=dialog",children:"here."})]});return(0,M.jsx)(cs._,{title:(0,ae.t)("profile.change-theme","Change theme"),onClose:z,size:"md",subtitle:F.$.feedbackLinksEnabled?ve:void 0,children:(0,M.jsx)("div",{className:G.grid,role:"radiogroup",children:k.map(be=>(0,M.jsx)(yp,{themeOption:be,isExperimental:be.isExtra,onSelect:()=>ue(be),isSelected:re.name===be.name},be.id))})})}const bp=z=>({grid:(0,_e.css)({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gridAutoRows:"250px",gap:z.spacing(2)})});var Cp=e(73745),Mp=e(49185),di=e(46831),Sp=e(30054);function Tp({feedUrl:z}){const G=(0,xt.of)(Op),{state:k,getNews:re}=(0,Sp.n)(z),[ue,ve]=(0,Mp.A)();return(0,a.useEffect)(()=>{re()},[re]),k.error?(0,M.jsx)("div",{className:G.innerWrapper,children:k.error&&k.error.message}):(0,M.jsxs)("div",{ref:ue,children:[k.loading?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(di.K.Skeleton,{showImage:!0,width:ve.width}),(0,M.jsx)(di.K.Skeleton,{showImage:!0,width:ve.width}),(0,M.jsx)(di.K.Skeleton,{showImage:!0,width:ve.width}),(0,M.jsx)(di.K.Skeleton,{showImage:!0,width:ve.width}),(0,M.jsx)(di.K.Skeleton,{showImage:!0,width:ve.width})]}):(0,M.jsx)(M.Fragment,{children:ve.width>0&&k.value?.map((be,Ue)=>(0,M.jsx)(di.K,{index:Ue,showImage:!0,width:ve.width,data:k.value},Ue))}),(0,M.jsx)("div",{className:G.grot,children:(0,M.jsx)("a",{href:"https://grafana.com/blog/",target:"_blank",rel:"noreferrer",title:(0,ae.t)("news.link-title","Go to Grafana labs blog"),children:(0,M.jsx)("img",{src:"public/img/grot-news.svg",alt:"Grot reading news"})})})]})}const Op=z=>({innerWrapper:(0,_e.css)({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),grot:(0,_e.css)({display:"flex",alignItems:"center",justifyContent:"center",padding:z.spacing(5,0),img:{width:"186px",height:"186px"}})});function Ip({onClose:z}){const G=(0,xt.of)(Rp);return(0,M.jsx)(cs._,{title:(0,M.jsxs)("div",{className:G.title,children:[(0,M.jsx)(Aa.E,{element:"h2",children:(0,ae.t)("news.title","Latest from the blog")}),(0,M.jsx)("a",{href:"https://grafana.com/blog/",target:"_blank",rel:"noreferrer",title:(0,ae.t)("news.link-title","Go to Grafana labs blog"),className:G.grot,children:(0,M.jsx)("img",{src:"public/img/grot-news.svg",alt:"Grot reading news"})}),(0,M.jsx)("div",{className:G.actions,children:(0,M.jsx)(ba.K,{name:"times",variant:"secondary",onClick:z,"data-testid":xa.Tp.components.Drawer.General.close,tooltip:(0,ae.t)("news.drawer.close","Close drawer")})})]}),onClose:z,size:"md",children:(0,M.jsx)(Tp,{feedUrl:Cp.$})})}const Rp=z=>({title:(0,_e.css)({display:"flex",alignItems:"center",justifyContent:"center",gap:z.spacing(2),borderBottom:`1px solid ${z.colors.border.weak}`}),grot:(0,_e.css)({display:"flex",alignItems:"center",justifyContent:"center",padding:z.spacing(2,0),img:{width:"75px",height:"75px"}}),actions:(0,_e.css)({position:"absolute",right:z.spacing(1),top:z.spacing(2)})});function xd({node:z,children:G}){const k=(0,xt.of)(Ap),re=(0,ar.J0)((0,H.cloneDeep)(z),!1);return re?(0,M.jsxs)(Os.W,{header:(0,M.jsxs)("div",{onClick:ue=>ue.stopPropagation(),className:k.header,children:[(0,M.jsx)("div",{children:re.text}),re.subTitle&&(0,M.jsx)("div",{className:k.subTitle,children:re.subTitle})]}),children:[re.children?.map(ue=>ue.url?(0,M.jsx)(fl.D,{url:ue.url,label:ue.text,icon:ue.icon,target:ue.target},ue.id):(0,M.jsx)(fl.D,{icon:ue.icon,onClick:ue.onClick,label:ue.text},ue.id)),G]}):null}const Ap=z=>({header:(0,_e.css)({fontSize:z.typography.h5.fontSize,fontWeight:z.typography.h5.fontWeight,padding:z.spacing(.5,1),whiteSpace:"nowrap"}),subTitle:(0,_e.css)({color:z.colors.text.secondary,fontSize:z.typography.bodySmall.fontSize})});function Lp({profileNode:z,onToggleKioskMode:G}){const k=(0,xt.of)(jp),re=(0,ar.J0)((0,H.cloneDeep)(z),!1),[ue,ve]=(0,rc.A)(!1),[be,Ue]=(0,rc.A)(!1);if(!re)return null;const We=()=>(0,M.jsx)(xd,{node:z,children:(0,M.jsxs)(M.Fragment,{children:[F.$.featureToggles.grafanaconThemes&&(0,M.jsx)(fl.D,{icon:"palette",onClick:Ue,label:(0,ae.t)("profile.change-theme","Change theme")}),(0,M.jsx)(Os.W.Item,{icon:"monitor",onClick:G,label:(0,ae.t)("profile.enable-kiosk-mode","Enable kiosk mode")}),F.$.newsFeedEnabled&&(0,M.jsx)(fl.D,{icon:"rss",onClick:ve,label:(0,ae.t)("navigation.rss-button","Latest from the blog")}),(0,M.jsx)(Os.W.Divider,{}),!F.$.auth.disableSignoutMenu&&(0,M.jsx)(fl.D,{url:`${F.$.appSubUrl}/logout`,label:(0,ae.t)("nav.sign-out.title","Sign out"),icon:"arrow-from-right",target:"_self"})]})});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(vo.m,{overlay:We,placement:"bottom-end",children:(0,M.jsx)(Kr.I,{className:k.profileButton,imgSrc:Us.TP.user.gravatarUrl,imgAlt:"User avatar","aria-label":(0,ae.t)("navigation.profile.aria-label","Profile")})}),ue&&(0,M.jsx)(Ip,{onClose:ve}),be&&(0,M.jsx)(Dp,{onClose:Ue})]})}const jp=z=>({profileButton:(0,_e.css)({padding:z.spacing(0,.5),img:{borderRadius:z.shape.radiu
1559s.circle,height:"24px",marginRight:0,width:"24px"}})});var Ed=e(63704);function Bp(){const z=(0,ya.zy)(),G=(0,xt.of)(Up);let k=Ed.sQ.sanitizeUrl(g.I.getUrlForPartial(z,{forceLogin:"true"}));return k.startsWith("//")&&(k=k.replace(/\/+/g,"/")),(0,M.jsx)("a",{className:G.link,href:k,target:"_self",children:(0,M.jsx)(ae.x6,{i18nKey:"app-chrome.top-bar.sign-in",children:"Sign in"})})}const Up=z=>({link:(0,_e.css)({paddingLeft:z.spacing(1),paddingRight:z.spacing(1),whiteSpace:"nowrap","&:hover":{textDecoration:"underline"}})});var Np=e(68079);function Wp({nodes:z,scopes:G,disabled:k,loading:re,onInputClick:ue,onRemoveAllClick:ve}){const be=(0,xt.of)(Fp),[Ue,We]=(0,a.useState)(!1);(0,a.useEffect)(()=>{We(!1)},[G]);const Ze=(0,a.useMemo)(()=>{const gt=G.reduce((pt,{scope:ht,path:vt})=>{let Ft=z;const sn=vt.reduce((Dn,ua)=>{const fa=Ft?.[ua];if(!fa)return Dn;const{title:Es,nodes:zl}=fa;return Ft=zl,Dn.push(Es),Dn},[]);sn[0]===""&&sn.splice(0,1);const fn=sn.length>0?sn.pop():ht.spec.title,In=sn.length>0?sn.join(" > "):"";return pt[In]=pt[In]?`${pt[In]}, ${fn}`:fn,pt},{});return(0,M.jsx)(M.Fragment,{children:Object.entries(gt).map(([pt,ht])=>(0,M.jsx)("p",{className:be.scopePath,children:pt?`${pt} > ${ht}`:ht},pt))})},[z,G,be]),at=(0,a.useMemo)(()=>G.map(({scope:gt})=>gt.spec.title).join(", "),[G]),ct=(0,a.useMemo)(()=>(0,M.jsx)($t.p,{readOnly:!0,placeholder:(0,ae.t)("scopes.selector.input.placeholder","Select scopes..."),disabled:k,loading:re,value:at,"aria-label":(0,ae.t)("scopes.selector.input.placeholder","Select scopes..."),"data-testid":"scopes-selector-input",suffix:G.length>0&&!k?(0,M.jsx)(ba.K,{"aria-label":(0,ae.t)("scopes.selector.input.removeAll","Remove all scopes"),name:"times",onClick:()=>ve()}):void 0,onMouseOver:()=>We(!0),onMouseOut:()=>We(!1),onClick:()=>{k||ue()}}),[k,re,ue,ve,G,at]);return(0,M.jsx)(Ns.m,{content:Ze,show:G.length===0?!1:Ue,children:ct})}const Fp=z=>({scopePath:(0,_e.css)({color:z.colors.text.primary,fontSize:z.typography.pxToRem(12),margin:z.spacing(0,0)})});function Kp({anyChildExpanded:z,query:G,resultsNodes:k}){const re=(0,xt.of)(wp);return z?null:(0,M.jsx)("h6",{className:re.container,"data-testid":"scopes-tree-headline",children:G?k.length===0?(0,M.jsx)(ae.x6,{i18nKey:"scopes.tree.headline.noResults",children:"No results found for your query"}):(0,M.jsx)(ae.x6,{i18nKey:"scopes.tree.headline.results",children:"Results"}):(0,M.jsx)(ae.x6,{i18nKey:"scopes.tree.headline.recommended",children:"Recommended"})})}const wp=z=>({container:(0,_e.css)({color:z.colors.text.secondary,margin:z.spacing(1,0)})});var Vp=e(32635);function Pd({anyChildExpanded:z,groupedNodes:G,lastExpandedNode:k,loadingNodeName:re,node:ue,nodePath:ve,nodeReason:be,scopeNames:Ue,scopes:We,type:Ze,onNodeSelectToggle:at,onNodeUpdate:ct}){const gt=(0,xt.of)($p),pt=G[be]||[];if(pt.length===0)return null;const ht=(0,M.jsx)("div",{role:"tree",className:z?gt.expandedContainer:void 0,children:pt.map(vt=>{const Ft=vt.selectable&&Ue.includes(vt.linkId);if(z&&!vt.expanded)return null;const sn=[...ve,vt.name],fn=sn.join(".");return(0,M.jsxs)("div",{role:"treeitem","aria-selected":vt.expanded,className:z?gt.expandedContainer:void 0,children:[(0,M.jsxs)("div",{className:(0,_e.cx)(gt.title,vt.selectable&&!vt.expanded&>.titlePadding),children:[vt.selectable&&!vt.expanded?ue.disableMultiSelect?(0,M.jsx)(yd.J,{id:fn,name:fn,checked:Ft,label:"","data-testid":`scopes-tree-${Ze}-${vt.name}-radio`,onClick:()=>{at(sn)}}):(0,M.jsx)(Vp.S,{checked:Ft,"data-testid":`scopes-tree-${Ze}-${vt.name}-checkbox`,onChange:()=>{at(sn)}}):null,vt.expandable?(0,M.jsxs)("button",{className:gt.expand,"data-testid":`scopes-tree-${Ze}-${vt.name}-expand`,"aria-label":vt.expanded?(0,ae.t)("scopes.tree.collapse","Collapse"):(0,ae.t)("scopes.tree.expand","Expand"),onClick:()=>{ct(sn,!vt.expanded,vt.query)},children:[(0,M.jsx)(Qn.I,{name:vt.expanded?"angle-down":"angle-right"}),vt.title]}):(0,M.jsx)("span",{"data-testid":`scopes-tree-${Ze}-${vt.name}-title`,children:vt.title})]}),(0,M.jsx)("div",{className:gt.children,children:vt.expanded&&(0,M.jsx)(Dd,{nodes:ue.nodes,nodePath:sn,loadingNodeName:re,scopes:We,onNodeUpdate:ct,onNodeSelectToggle:at})})]},vt.name)}
1559)});return k?(0,M.jsx)(ql.P,{minHeight:`${Math.min(5,pt.length)*30}px`,maxHeight:be===Fr.Persisted?`${Math.min(5,pt.length)*30}px`:"100%",children:ht}):ht}const $p=z=>({expandedContainer:(0,_e.css)({display:"flex",flexDirection:"column",maxHeight:"100%"}),title:(0,_e.css)({alignItems:"center",display:"flex",gap:z.spacing(1),fontSize:z.typography.pxToRem(14),lineHeight:z.typography.pxToRem(22),padding:z.spacing(.5,0),"& > label":(0,_e.css)({gap:0})}),titlePadding:(0,_e.css)({paddingLeft:z.spacing(.5)}),expand:(0,_e.css)({alignItems:"center",background:"none",border:0,display:"flex",gap:z.spacing(1),margin:0,padding:0}),children:(0,_e.css)({display:"flex",flexDirection:"column",overflowY:"hidden",maxHeight:"100%",paddingLeft:z.spacing(4)})});var zp=e(70255);function Hp({children:z,nodeLoading:G}){const k=(0,xt.of)(Gp);return G?(0,M.jsx)(zp.A,{count:5,className:k.loader}):z}const Gp=z=>({loader:(0,_e.css)({margin:z.spacing(.5,0)})});function _p({anyChildExpanded:z,nodePath:G,query:k,onNodeUpdate:re}){const ue=(0,xt.of)(Qp),[ve,be]=(0,a.useState)({value:k,dirty:!1});return(0,a.useEffect)(()=>{!ve.dirty&&ve.value!==k&&be({value:k,dirty:!1})},[ve,k]),(0,ed.A)(()=>{ve.dirty&&re(G,!0,ve.value)},500,[ve.dirty,ve.value]),z?null:(0,M.jsx)(td.Z,{placeholder:(0,ae.t)("scopes.tree.search","Search"),value:ve.value,className:ue.input,"data-testid":"scopes-tree-search",escapeRegex:!1,onChange:Ue=>{be({value:Ue,dirty:!0})}})}const Qp=z=>({input:(0,_e.css)({margin:z.spacing(1,0),minHeight:z.spacing(4),height:z.spacing(4),maxHeight:z.spacing(4),width:`calc(100% - ${z.spacing(.5)})`})});function Dd({nodes:z,nodePath:G,loadingNodeName:k,scopes:re,onNodeUpdate:ue,onNodeSelectToggle:ve}){const be=G[G.length-1],Ue=z[be],We=Object.values(Ue.nodes),Ze=k===be,at=re.map(({scopeName:ht})=>ht),ct=We.some(({expanded:ht})=>ht),gt=(0,a.useMemo)(()=>(0,H.groupBy)(We,"reason"),[We]),pt=!ct&&Ue.expanded;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_p,{anyChildExpanded:ct,nodePath:G,query:Ue.query,onNodeUpdate:ue}),(0,M.jsxs)(Hp,{nodeLoading:Ze,children:[(0,M.jsx)(Pd,{anyChildExpanded:ct,groupedNodes:gt,lastExpandedNode:pt,loadingNodeName:k,node:Ue,nodePath:G,nodeReason:Fr.Persisted,scopes:re,scopeNames:at,type:"persisted",onNodeSelectToggle:ve,onNodeUpdate:ue}),(0,M.jsx)(Kp,{anyChildExpanded:ct,query:Ue.query,resultsNodes:gt[Fr.Result]??[]}),(0,M.jsx)(Pd,{anyChildExpanded:ct,groupedNodes:gt,lastExpandedNode:pt,loadingNodeName:k,node:Ue,nodePath:G,nodeReason:Fr.Result,scopes:re,scopeNames:at,type:"result",onNodeSelectToggle:ve,onNodeUpdate:ue})]})]})}const kp=()=>{const{chrome:z}=(0,nr.Il)(),G=z.useState(),k=!G.chromeless&&G.megaMenuDocked&&G.megaMenuOpen,re=(0,xt.of)(Yp,k),ue=(0,Cl.b)(),ve=Bc(),be=(0,yo.A)(ve?.scopesSelectorService.stateObservable??new dl.c,ve?.scopesSelectorService.state);if(!ve||!ue||!ue.state.enabled||!be)return null;const{nodes:Ue,loadingNodeName:We,selectedScopes:Ze,opened:at,treeScopes:ct}=be,{scopesService:gt,scopesSelectorService:pt,scopesDashboardsService:ht}=ve,{readOnly:vt,drawerOpened:Ft,loading:sn}=ue.state,{open:fn,removeAllScopes:In,closeAndApply:Dn,closeAndReset:ua,updateNode:fa,toggleNodeSelect:Es}=pt,zl=vt?(0,ae.t)("scopes.dashboards.toggle.disabled","Suggested dashboards list is disabled due to read only mode"):Ft?(0,ae.t)("scopes.dashboards.toggle.collapse","Collapse suggested dashboards list"):(0,ae.t)("scopes.dashboards.toggle.expand","Expand suggested dashboards list");return(0,M.jsxs)("div",{className:re.container,children:[(0,M.jsx)(ba.K,{name:"web-section-alt",className:re.dashboards,"aria-label":zl,tooltip:zl,"data-testid":"scopes-dashboards-expand",disabled:vt,onClick:ht.toggleDrawer}),(0,M.jsx)(Wp,{nodes:Ue,scopes:Ze,disabled:vt,loading:sn,onInputClick:()=>{gt.state.readOnly||fn()},onRemoveAllClick:In}),at&&(0,M.jsx)(cs._,{title:(0,ae.t)("scopes.selector.title","Select scopes"),size:"sm",onClose:ua,children:(0,M.jsxs)("div",{className:re.drawerContainer,children:[(0,M.jsx)("div",{className:re.treeContainer,children:sn?(0,M.jsx)(Np.y,{"data-testid":"scopes-selector-loading"}):(0,M.jsx)(Dd,{nodes:Ue,nodePath:[""],loadingNodeName:We,scopes:ct,onNodeUpdate:fa,onNodeSelectToggle:Es}
1559)}),(0,M.jsxs)("div",{className:re.buttonsContainer,children:[(0,M.jsx)(oe.$n,{variant:"primary","data-testid":"scopes-selector-apply",onClick:Dn,children:(0,M.jsx)(ae.x6,{i18nKey:"scopes.selector.apply",children:"Apply"})}),(0,M.jsx)(oe.$n,{variant:"secondary","data-testid":"scopes-selector-cancel",onClick:ua,children:(0,M.jsx)(ae.x6,{i18nKey:"scopes.selector.cancel",children:"Cancel"})})]})]})})]})},Yp=(z,G)=>({container:(0,_e.css)({display:"flex",flexDirection:"row",paddingLeft:G?z.spacing(2):"unset"}),dashboards:(0,_e.css)({color:z.colors.text.secondary,marginRight:z.spacing(2),"&:hover":(0,_e.css)({color:z.colors.text.primary})}),drawerContainer:(0,_e.css)({display:"flex",flexDirection:"column",height:"100%"}),treeContainer:(0,_e.css)({display:"flex",flexDirection:"column",maxHeight:"100%",overflowY:"hidden",paddingLeft:z.spacing(.5)}),buttonsContainer:(0,_e.css)({display:"flex",gap:z.spacing(1),marginTop:z.spacing(8)})});var pl=e(31937);function Jp({actions:z,breadcrumbActions:G,scopes:k}){const re=(0,xt.of)(Xp);return(0,M.jsx)("div",{"data-testid":xa.XF.NavToolbar.container,className:re.actionsBar,children:(0,M.jsxs)(Qt.B,{alignItems:"center",justifyContent:"flex-start",flex:1,wrap:"nowrap",minWidth:0,children:[k?.state.enabled?(0,M.jsx)(kp,{}):void 0,(0,M.jsxs)(Qt.B,{alignItems:"center",justifyContent:"flex-end",flex:1,wrap:"nowrap",minWidth:0,children:[G,G&&z&&(0,M.jsx)(Eo.K,{}),z]})]})})}const Xp=z=>({actionsBar:(0,_e.css)({alignItems:"center",backgroundColor:z.colors.background.primary,borderBottom:`1px solid ${z.colors.border.weak}`,display:"flex",height:(0,pl.vn)(),padding:z.spacing(0,1,0,2)})});var Zp=e(35484),qp=e(9628);const eg=a.memo(()=>{const{query:z}=(0,ja.useKBar)(re=>({kbarSearchQuery:re.searchQuery,kbarIsOpen:re.visualState===ja.VisualState.showing})),G=(0,Jl.i)("lg"),k=()=>
1559{z.toggle()};return G?(0,M.jsx)(tg,{onClick:k}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Kr.I,{iconOnly:!0,icon:"search","aria-label":(0,ae.t)("nav.search.placeholderCommandPalette","Search..."),onClick:k}),(0,M.jsx)(Eo.K,{})]})});function tg({onClick:z}){const G=(0,xt.of)(ng),k=(0,a.useMemo)(()=>(0,qp.gn)(),[]);return(0,M.jsx)("div",{className:G.wrapper,"data-testid":xa.Tp.components.NavToolbar.commandPaletteTrigger,children:(0,M.jsxs)("div",{className:G.inputWrapper,children:[(0,M.jsx)("div",{className:G.prefix,children:(0,M.jsx)(Qn.I,{name:"search"})}),(0,M.jsx)("button",{className:G.fakeInput,onClick:z,children:(0,ae.t)("nav.search.placeholderCommandPalette","Search...")}),(0,M.jsx)("div",{className:G.suffix,children:(0,M.jsx)(Aa.E,{variant:"bodySmall",children:`${k}+k`})})]})})}const ng=z=>{const G=(0,$t.n)({theme:z});return{wrapper:(0,_e.cx)(G.wrapper,(0,_e.css)({width:"auto",minWidth:140,maxWidth:350,flexGrow:1})),inputWrapper:G.inputWrapper,prefix:G.prefix,suffix:(0,_e.css)([G.suffix,{display:"flex",gap:z.spacing(.5)}]),fakeInput:(0,_e.css)([G.input,{textAlign:"left",paddingLeft:28,color:z.colors.text.disabled,"&:focus":{outline:"unset",boxShadow:"unset"},"&:focus-visible":(0,Zp.getFocusStyles)(z)}]),button:(0,_e.css)({width:"100%",textAlign:"center","> *":{width:"100%",textAlign:"center",justifyContent:"center",gap:"1ch"}})}},ag=(0,a.memo)(function({onToggleMegaMenu:G,onToggleKioskMode:k,pageNav:re,sectionNav:ue,scopes:ve,actions:be,breadcrumbActions:Ue,showToolbarLevel:We}){const{chrome:Ze}=(0,nr.Il)(),at=Ze.useState(),ct=!at.chromeless&&at.megaMenuDocked&&at.megaMenuOpen,gt=(0,xt.of)(sg,ct),pt=(0,hn.useSelector)(ua=>ua.navIndex),ht=(0,H.cloneDeep)(pt.help),vt=ht?(0,ar.CS)(ht):void 0,Ft=pt.profile,sn=(0,hn.useSelector)(ua=>ua.navIndex)[sc.Id],fn=(0,ld.Z)(ue,re,sn),In=U.$W.featureToggles.unifiedHistory,Dn=!(0,Jl.i)("sm");return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)("div",{className:gt.layout,children:[(0,M.jsxs)(Qt.B,{minWidth:0,gap:.5,alignItems:"center",flex:{xs:2,lg:1},children:[!ct&&(0,M.jsx)(Kr.I,{narrow:!0,id:Yf.Ut,onClick:G,tooltip:(0,ae.t)("navigation.megamenu.open","Open menu"),children:(0,M.jsxs)(Qt.B,{gap:0,alignItems:"center",children:[(0,M.jsx)(pd.M.MenuLogo,{className:gt.img}),(0,M.jsx)(Qn.I,{size:"sm",name:"angle-down"})]})}),(0,M.jsx)(Zf,{breadcrumbs:fn,className:gt.breadcrumbsWrapper}),!We&&Ue]}),(0,M.jsxs)(Qt.B,{gap:.5,alignItems:"center",justifyContent:"flex-end",flex:1,"data-testid":We?void 0:xa.XF.NavToolbar.container,minWidth:{xs:"unset",lg:0},children:[(0,M.jsx)(eg,{}),In&&!Dn&&(0,M.jsx)(cp,{}),!Dn&&(0,M.jsx)(up,{}),vt&&(0,M.jsx)(vo.m,{overlay:()=>(0,M.jsx)(xd,{node:vt}),placement:"bottom-end",children:(0,M.jsx)(Kr.I,{iconOnly:!0,icon:"question-circle","aria-label":(0,ae.t)("navigation.help.aria-label","Help")})}),(0,M.jsx)(Eo.K,{}),U.$W.featureToggles.extensionSidebar&&!Dn&&(0,M.jsx)(tp,{}),!We&&be,!Us.TP.user.isSignedIn&&(0,M.jsx)(Bp,{}),Ft&&(0,M.jsx)(Lp,{profileNode:Ft,onToggleKioskMode:k})]})]}),We&&(0,M.jsx)(Jp,{scopes:ve,actions:be,breadcrumbActions:Ue})]})}),sg=(z,G)=>({layout:(0,_e.css)({height:(0,pl.vn)(),display:"flex",gap:z.spacing(2),alignItems:"center",padding:z.spacing(0,1),paddingLeft:G?z.spacing(3.5):z.spacing(.75),borderBottom:`1px solid ${z.colors.border.weak}`,justifyContent:"space-between"}),breadcrumbsWrapper:(0,_e.css)({display:"flex",overflow:"hidden",[z.breakpoints.down("sm")]:{minWidth:"40%"}}),img:(0,_e.css)({alignSelf:"center",height:z.spacing(3),width:z.spacing(3)}),kioskToggle:(0,_e.css)({[z.breakpoints.down("lg")]:{display:"none"}})});function rg({children:z}){const{chrome:G}=(0,nr.Il)(),{isOpen:k,isEnabled:re,extensionSidebarWidth:ue,setExtensionSidebarWidth:ve}=(0,li.sA)(),be=G.useState(),Ue=(0,Cl.b)(),We=!be.chromeless&&be.megaMenuDocked&&be.megaMenuOpen,Ze=!!(Ue?.state.enabled&&Ue?.state.drawerOpened&&!Ue?.state.readOnly),at=(0,pl.UH)(),ct=at*(0,pl.vn)(),gt=(0,xt.of)(ig,ct),pt=(0,xt.of)(lg,ue),ht=(0,xt.of)(Lh.l);og(G),(0,ar.n0)(be.megaMenuOpen,be.megaMenuDocked);const vt=(0,_e.cx)({[gt.content]:!0,[gt.contentChromeless]:be.chromeless,[gt.contentWithSidebar]:k&&!be.chromeless}),Ft=()=>{G.setMegaMenuOpen(!be.megaMenuOpen)},{pathname:sn,search:fn}=P.Ny.getLocation(),In=sn+fn,Dn=be.returnToPrevious&&In!==be.returnToPrevious.href;return(0,a.useEffect)(()=>{be.returnToPrevious&&In===be.returnToPrevious.href&&G.clearReturnToPrevious("auto_dismissed")},[G,In]),(0,a.useEffect)(()=>{const ua=(0,P.SE)(fn);G.setKioskModeFromUrl(ua.kiosk)},[G,fn]),(0,M.jsxs)("div",{className:Rh()("main-view",{"main-view--chrome-hidden":be.chromeless}),children:[!be.chromeless&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(oe.z9,{className:gt.skipLink,href:"#pageContent",children:(0,M.jsx)(ae.x6,{i18nKey:"app-chrome.skip-content-button",children:"Skip to main content"})}),We&&(0,M.jsx)(ec,{className:gt.dockedMegaMenu,onClose:()=>G.setMegaMenuOpen(!1)}),(0,M.jsx)("header",{className:(0,_e.cx)(gt.topNav,We&>.topNavMenuDocked),children:(0,M.jsx)(ag,{sectionNav:be.sectionNav.node,pageNav:be.pageNav,onToggleMegaMenu:Ft,onToggleKioskMode:G.onToggleKioskMode,actions:be.actions,breadcrumbActions:be.breadcrumbActions,scopes:Ue,showToolbarLevel:at===2})})]}),(0,M.jsx)("div",{className:vt,children:(0,M.jsxs)("div",{className:(0,_e.cx)(gt.panes,{[gt.panesWithSidebar]:k}),children:[!be.chromeless&&(0,M.jsx)("div",{className:(0,_e.cx)(gt.scopesDashboardsContainer,{[gt.scopesDashboardsContainerDocked]:We}),children:(0,M.jsx)(xf,{})}),(0,M.jsx)("main",{className:(0,_e.cx)(gt.pageContainer,{[gt.pageContainerMenuDocked]:We||Ze,[gt.pageContainerMenuDockedScopes]:We&&Ze,[gt.pageContainerWithSidebar]:!be.chromeless&&k,[pt.contentWidth]:!be.chromeless&&k}),id:"pageContent",children:z}),!be.chromeless&&re&&k&&(0,M.jsx)(Ah.c,{className:gt.sidebarContainer,defaultSize:{width:ue},enable:{left:!0},onResize:(ua,fa,Es)=>ve(Es.getBoundingClientRect().width),handleClasses:{left:ht.dragHandleBaseVertical},minWidth:ac.nf,maxWidth:ac.T0,children:(0,M.jsx)(ac.EE,{})})]})}),!be.chromeless&&!be.megaMenuDocked&&(0,M.jsx)(Uf,{}),!be.chromeless&&(0,M.jsx)(lf,{}),Dn&&be.returnToPrevious&&(0,M.jsx)(fd,{href:be.returnToPrevious.href,title:be.returnToPrevious.title})]})}function og(z){const G=xr.A.getBool(tc,!0),k=(0,Jl.i)("xl");(0,a.useEffect)(()=>
1559{if(!G)return;const re=z.state.getValue();k&&!re.megaMenuDocked?(z.setMegaMenuDocked(!0,!1),z.setMegaMenuOpen(!0)):!k&&re.megaMenuDocked&&(z.setMegaMenuDocked(!1,!1),z.setMegaMenuOpen(!1))},[k,z,G])}const ig=(z,G)=>({content:(0,_e.css)({label:"page-content",display:"flex",flexDirection:"column",paddingTop:G,flexGrow:1,height:"auto"}),contentWithSidebar:(0,_e.css)({height:"100vh",overflow:"hidden"}),contentChromeless:(0,_e.css)({paddingTop:0}),dockedMegaMenu:(0,_e.css)({background:z.colors.background.primary,borderRight:`1px solid ${z.colors.border.weak}`,display:"none",height:"100%",position:"fixed",top:0,width:xo,zIndex:2,[z.breakpoints.up("xl")]:{display:"flex",flexDirection:"column"}}),scopesDashboardsContainer:(0,_e.css)({position:"fixed",height:`calc(100% - ${G}px)`,zIndex:1}),scopesDashboardsContainerDocked:(0,_e.css)({left:xo}),topNav:(0,_e.css)({display:"flex",position:"fixed",zIndex:z.zIndex.navbarFixed,left:0,right:0,background:z.colors.background.primary,flexDirection:"column"}),topNavMenuDocked:(0,_e.css)({left:xo}),panes:(0,_e.css)({display:"flex",flexDirection:"column",flexGrow:1,label:"page-panes"}),panesWithSidebar:(0,_e.css)({height:"100%",overflow:"hidden",position:"relative"}),pageContainerMenuDocked:(0,_e.css)({paddingLeft:xo}),pageContainerMenuDockedScopes:(0,_e.css)({paddingLeft:`calc(${xo} * 2)`}),pageContainer:(0,_e.css)({label:"page-container",display:"flex",flexDirection:"column",flexGrow:1}),pageContainerWithSidebar:(0,_e.css)({overflow:"auto",height:"100%",minHeight:0}),skipLink:(0,_e.css)({position:"fixed",top:-1e3,":focus":{left:z.spacing(1),top:z.spacing(1),zIndex:z.zIndex.portal}}),sidebarContainer:(0,_e.css)({position:"fixed !important",top:G,bottom:0,zIndex:2,right:0})}),lg=(z,G=0)=>({contentWidth:(0,_e.css)({maxWidth:`calc(100% - ${G}px) !important`})});var gl=e(6890),bd=e(12066),Al=e(64762),cg=e(94701);function dg({appNotification:z,onClearNotification:G}){const k=(0,xt.of)(ug);(0,cg.A)(()=>{setTimeout(()=>{G(z.id)},hn.timeoutMap[z.severity])});const re=z.component||z.text||z.traceId,ue=z.traceId;return(0,M.jsx)(ss.F,{severity:z.severity,title:z.title,onRemove:()=>G(z.id),elevated:!0,children:re&&(0,M.jsxs)("div",{className:k.wrapper,children:[(0,M.jsx)("span",{children:z.component||z.text}),ue&&(0,M.jsx)("span",{className:k.trace,children:(0,M.jsxs)(ae.x6,{i18nKey:"app-notification.item.trace-id",children:["Trace ID: ",{traceId:ue}]})})]})})}function ug(z){return{wrapper:(0,_e.css)({display:"flex",flexDirection:"column"}),trace:(0,_e.css)({fontSize:z.typography.pxToRem(10)})}}function hg(){const z=(0,hn.useSelector)(ue=>(0,bd.fX)(ue.appNotifications)),G=(0,hn.useDispatch)(),k=(0,xt.of)(fg);(0,a.useEffect)(()=>{wa.A.on(ci.r1.alertWarning,ue=>G((0,gl.dx)((0,Al.q8)(...ue)))),wa.A.on(ci.r1.alertSuccess,ue=>G((0,gl.dx)((0,Al.tZ)(...ue)))),wa.A.on(ci.r1.alertError,ue=>G((0,gl.dx)((0,Al.gi)(...ue)))),wa.A.on(ci.r1.alertInfo,ue=>G((0,gl.dx)((0,Al.Cf)(...ue))))},[G]);const re=ue=>{G((0,gl.Do)(ue))};return(0,M.jsx)("div",{className:k.wrapper,children:(0,M.jsx)(Qt.B,{direction:"column",children:z.map((ue,ve)=>(0,M.jsx)(dg,{appNotification:ue,onClearNotification:re},`${ue.id}-${ve}`))})})}function fg(z){return{wrapper:(0,_e.css)({label:"app-notifications-list",zIndex:z.zIndex.portal,minWidth:400,maxWidth:600,position:"fixed",right:6,top:88})}}var pg=e(71599);function gg(z){const[G,k]=(0,a.useState)({component:null,props:{}}),re=(0,a.useMemo)(()=>{function ue(be,Ue){k({component:be,props:Ue})}function ve(){k({component:null,props:{}})}return{component:G.component,props:{...G.props,isOpen:!0,onDismiss:ve},showModal:ue,hideModal:ve}},[G]);return(0,a.useEffect)(()=>{wa.A.subscribe(ds.S8,({payload:ve})=>{k({component:ve.component,props:ve.props})}),wa.A.subscribe(ds.bY,ve=>{mg(ve,k)});let ue="";P.Ny.getHistory().listen(ve=>{ve.pathname!==ue&&k({component:null,props:{}}),ue=ve.pathname})},[]),(0,M.jsx)(Nc.wE.Provider,{value:re,children:z.children})}function mg({payload:z},G){const{confirmText:k,onConfirm:re=()=>{},onDismiss:ue,text2:ve,altActionText:be,onAltAction:Ue,noText:We,text:Ze,text2htmlBind:at,yesText:ct="Yes",icon:gt,title:pt="Confirm",yesButtonVariant:ht}=z,vt=()=>G({component:null,props:{}}),Ft={confirmText:ct,confirmButtonVariant:ht,confirmationText:k,icon:gt,title:pt,body:Ze,description:ve&&at?Ed.sQ.sanitize(ve):ve,isOpen:!0,dismissText:We,onConfirm:()=>{re(),vt()},onDismiss:()=>{ue?.(),vt()},onAlternative:Ue?()=>{Ue(),vt()}:void 0,alternativeText:be};G({component:pg.u,props:Ft})}var vg=e(52830);function yg(z){return z.providers.reduce((G,k)=>(0,M.jsx)(k,{children:G}),z.children)}function xg(z){return(0,M.jsx)(Oh.Ix,{history:P.Ny.getHistory(),children:(0,M.jsx)(P._K,{service:P.Ny,children:(0,M.jsx)(Uc.CompatRouter,{children:(0,M.jsx)(vg.YZ,{children:(0,M.jsx)(yg,{providers:z.providers,children:(0,M.jsxs)(gg,{children:[(0,M.jsxs)(rg,{children:[(0,M.jsx)(hg,{}),(0,M.jsxs)(Qt.B,{gap:0,grow:1,direction:"column",children:[z.pageBanners.map((G,k)=>(0,M.jsx)(G,{},k.toString())),z.routes]}),z.bodyRenderHooks.map((G,k)=>(0,M.jsx)(G,{},k.toString()))]}),(0,M.jsx)(Nc.EO,{})]})})})})})})}let Cd=[],Md=[];const Sd=[];function tx(z){Sd.push(z)}function nx(z){Cd.push(z)}function ax(z){Md.push(z)}class Eg extends a.Component{constructor(G){super(G),this.iconCacheID=`grafana-icon-cache-${F.$.buildInfo.commit}`,this.renderRoute=k=>(0,M.jsx)(ya.qh,{caseSensitive:k.sensitive===void 0?!1:k.sensitive,path:k.path,element:(0,M.jsx)(ih,{route:k})},k.path),this.state={}}async componentDidMount(){this.setState({ready:!0}),$(".preloader").remove();const G=await window.caches.keys();for(const k of G)k.startsWith("grafana-icon-cache")&&k!==this.iconCacheID&&window.caches.delete(k)}renderRoutes(){return(0,M.jsx)(ya.BV,{children:zu().map(G=>this.renderRoute(G))})}render(){const{app:G}=this.props,{ready:k}=this.state;(0,P.Lc)("AppWrapper",!1,"rendering");const re=Ue=>{(0,Sa.rR)("command_palette_action_selected",{actionId:Ue.id,actionName:Ue.name})},ue={routes:k&&this.renderRoutes(),pageBanners:Md,bodyRenderHooks:Cd,providers:Sd},ve=F.$.featureToggles.timeRangeProvider?si.A:a.Fragment,be=F.$.featureToggles.extensionSidebar?li.kn:a.Fragment;return(0,M.jsx)(gs.Provider,{store:Oa.M_,children:(0,M.jsx)(uo.Xw,{style:"page",children:(0,M.jsx)(nr.YE.Provider,{value:G.context,children:(0,M.jsx)(ch.N,{value:F.$.theme2,children:(0,M.jsx)(el.A,{name:this.iconCacheID,children:(0,M.jsx)(ja.KBarProvider,{actions:[],options:{enableHistory:!0,callbacks:{onSelectAction:re}},children:(0,M.jsx)(ve,{children:(0,M.jsx)(Th,{children:(0,M.jsx)(il.AZ,{registries:fh.qm,children:(0,M.jsxs)(be,{children:[(0,M.jsx)(Yu,{}),(0,M.jsxs)("div",{className:"grafana-app",children:[(0,M.jsx)(xg,{...ue}),(0,M.jsx)(uh,{}),(0,M.jsx)(tl.qB,{})]})]})})})})})})})})})})}}var Pg=e(35222);const Dg=(0,a.lazy)(()=>Promise.resolve().then(e.bind(e,39989)).then(z=>({default:z.NestedFolderPicker}))),bg=z=>(0,M.jsx)(a.Suspense,{fallback:(0,M.jsx)(Pg.A,{}),children:(0,M.jsx)(Dg,{...z})});var Td=e(83162),Cg=e(70715);function Mg({actions:z,children:G,info:k,pageNav:re,layout:ue,renderTitle:ve,subTitle:be}){const Ue=(0,a.useContext)(Cg.A);return(0,M.jsx)(Bs.Y,{navModel:Ue.sectionNav,pageNav:re,layout:ue,actions:z,renderTitle:ve,info:k,subTitle:be,children:(0,M.jsx)(Bs.Y.Contents,{children:G})})}var Sg=e(45928),Tg=e(43561),Og=e(25992),Ig=e(81041);function Od(){return typeof window.SharedWorker<"u"}
1559class Rg{constructor(G,k){if(!Od())throw new Error("SharedWorker is not supported");const re=G.toString(),ue=new URL(".",G).toString(),ve=`importScripts('${re}');`,be=URL.createObjectURL(new Blob([`__webpack_worker_public_path__ = '${ue}'; ${ve}`],{type:"application/javascript"})),Ue=new SharedWorker(be,k);return URL.revokeObjectURL(be),Ue}}function Ag(z){return!z||typeof z!="object"?!1:"totalJSHeapSize"in z&&"usedJSHeapSize"in z&&"jsHeapSizeLimit"in z}function Lg(z){return!z||typeof z!="object"?!1:"memory"in z&&Ag(z.memory)}function Id(z){const G={};function k(re,ue){if(typeof re=="object"&&re!==null){if(Array.isArray(re))throw new Error("Array values are not supported.");for(const ve in re)re.hasOwnProperty(ve)&&k(re[ve],ue?`${ue}_${ve}`:ve)}else typeof re=="string"?G[ue]=re:typeof re=="number"&&(Number.isInteger(re)?G[ue]=re.toString():G[ue]=re.toFixed(4))}return k(z,"crash"),G}const Rd=(0,Og.DW)("core.crash-detection");function jg(){if(!Od())return;let z=Date.now();document.body.addEventListener("click",()=>z=Date.now(),!0),document.body.addEventListener("keypress",()=>z=Date.now(),!0),(0,Sg.initCrashDetection)({id:(0,Tg.Ak)(5),dbName:"grafana.crashes",createClientWorker(){return new Ig.c(new URL(e.p+e.u(7235),e.b))},createDetectorWorker(){return new Rg(new URL(e.p+e.u(8220),e.b))},reportCrash:async G=>{const k=Id(G);return Rd.logWarning("browser crash detected",k),!0},reportStaleTab:async G=>{const k=Id(G);return Rd.logWarning("stale browser tab detected",k),!0},updateInfo:G=>{G.app={version:F.$.buildInfo.version,url:window.location.href},G.user={email:ta.TP.user.email,login:ta.TP.user.login,name:ta.TP.user.name,lastInteraction:z},Lg(performance)&&(G.memory={heapUtilization:performance.memory.usedJSHeapSize/performance.memory.totalJSHeapSize,limitUtilization:performance.memory.totalJSHeapSize/performance.memory.jsHeapSizeLimit,usedJSHeapSize:performance.memory.usedJSHeapSize,totalJSHeapSize:performance.memory.totalJSHeapSize,jsHeapSizeLimit:performance.memory.jsHeapSizeLimit})}})}var Bg=e(17016);function Ug(z){const G=z.target instanceof Element&&Ng(z.target);if(!(z.ctrlKey||z.metaKey||z.defaultPrevented)&&G){let k=G.getAttribute("href");const re=G.getAttribute("target");if(k&&!re){const ue=Zc.kM.parseKeyValue(k.split("?")[1]),ve=ue.orgId&&Number(ue.orgId)!==U.$W.bootData.user.orgId;if((0,P.Lc)("utils",!1,"intercepting link click",z),z.preventDefault(),k=g.I.stripBaseFromUrl(k),k[0]!=="/"||ve)if(k.indexOf("://")>0||k.indexOf("mailto:")===0||ve){window.location.href=k;return}else if(k.indexOf("#")===0){window.location.hash=k;return}else k=`/${k}`;P.Ny.push(k)}}}function Ng(z){for(;z!==null&&z.tagName;){if(z.tagName.toUpperCase()==="A")return z;z=z.parentElement}return null}var Ad=e(6219),Wg=e(78529);class Fg{attachCorrelationsToDataFrames(G,k,re){return(0,Ad.cA)(G,k,re)}correlationsDataLinkPostProcessorFactory(G){return(0,Wg.YV)(void 0,G)}getCorrelationsBySourceUIDs(G){return(0,Ad.J6)(G)}}var Kg=e(4590);class wg{constructor(G){this.hasUpdates=!1,this.checked=Date.now(),this.prevLocationPath="",this.interval=G??1e3*60*5}start(){const G=(0,kl.oF)();G&&G.getConnectionState().subscribe(k=>{k&&this._checkForUpdates()}),P.Ny.getHistory().listen(this.locationUpdated.bind(this)),this.prevLocationPath=P.Ny.getLocation().pathname}locationUpdated(G){if(this.prevLocationPath===G.pathname)return;const k=G.pathname.split("/");k[1]==="/"&&this.prevLocationPath!=="/"?this.reloadIfUpdateDetected():k[1]==="d"&&!Kg._o.state.isPlaying?this.reloadIfUpdateDetected():this.hasUpdates&&(0,Sa.rR)("new_frontend_assets_reload_ignored",{newLocation:G.pathname,prevLocation:this.prevLocationPath}),this.prevLocationPath=G.pathname}async _checkForUpdates(){if(this.hasUpdates||Date.now()-this.checked<this.interval)return;this.checked=Date.now();const G=this.previous,k=await(0,p.AI)().get("/api/frontend/assets");G&&!(0,H.isEqual)(G,k)&&(this.hasUpdates=!0,(0,Sa.rR)("new_frontend_assets_detected",{assets:G.assets!==k.assets,plugins:G.plugins!==k.plugins,version:G.version!==k.version,flags:G.flags!==k.flags})),this.previous=k}reloadIfUpdateDetected(){this.hasUpdates&&((0,Sa.rR)("new_frontend_assets_reload",{}),window.location.reload()),this._checkForUpdates()}}var Ld=e(83873),jd=e(25240);class Vg{constructor(G){this.config={flushInterval:1e4,debug:!1},this.backends=[],this.flush=()=>{for(const k of this.backends)k.flush()},this.addBackend=k=>{(0,jd.S5)("Adding backend",!1,k),this.backends.push(k)},this.addEvent=(k,re)=>{const ue=this.getMeta(),ve={...k,meta:{...ue,...re}};for(const be of this.backends)(be.supportedEvents.length===0||be.supp
1559ortedEvents.indexOf(ve.type)>-1)&&be.addEvent(ve);(0,jd.S5)(`${k.type} event`,!1,{...k.payload,meta:ve.meta})},this.getMeta=()=>({sessionId:"",userId:ta.TP.user.id,userLogin:ta.TP.user.login,userSignedIn:ta.TP.user.isSignedIn,orgRole:ta.TP.user.orgRole,orgId:ta.TP.user.orgId,screenSize:{width:window.innerWidth,height:window.innerHeight},windowSize:{width:window.screen.width,height:window.screen.height},userAgent:window.navigator.userAgent,ts:new Date().getTime(),timeSinceNavigationStart:performance.now(),path:window.location.pathname,url:window.location.href}),this.config={...this.config,...G},setInterval(this.flush,this.config.flushInterval)}}var $g=e(78731),zg=e(57852),Hg=e(62635),Gg=e(37010),_g=e(23753),Do=e(75421),Qg=e(47981),Ll=e(12469);class kg{constructor(G,k){this.locationService=G,this.chromeService=k,this.panelId=null,wa.A.subscribe(zg.Tp,re=>{this.panelId=re.payload.panelId})}clearAndInitGlobalBindings(G){Ll.R.reset(),G.chromeless||(this.bind("?",this.showHelpModal),this.bind("g h",this.goToHome),this.bind("g d",this.goToDashboards),this.bind("g e",this.goToExplore),this.bind("g a",this.openAlerting),this.bind("g p",this.goToProfile),this.bind("esc",this.exit),this.bindGlobalEsc()),this.bind("c t",()=>(0,cl.O)(!1)),this.bind("c r",()=>(0,cl.O)(!0))}bindGlobalEsc(){this.bindGlobal("esc",this.globalEsc)}globalEsc(){const k=document.activeElement;if(!(document.querySelectorAll(".slate-typeahead--open").length>0)){if(k&&k instanceof HTMLElement&&(k.nodeName==="INPUT"||k.nodeName==="TEXTAREA"||k.hasAttribute("data-slate-editor"))){k.blur();return}this.exit()}}closeSearch(){this.locationService.partial({search:null})}openAlerting(){this.locationService.push("/alerting")}goToDashboards(){this.locationService.push("/dashboards")}goToHome(){this.locationService.push("/")}goToProfile(){this.locationService.push("/profile")}goToExplore(){this.locationService.push("/explore")}showHelpModal(){wa.A.publish(new ds.S8({component:Qg.N}))}exit(){const G=this.locationService.getSearchObject();if(G.editview){this.locationService.partial({editview:null,editIndex:null});return}if(G.inspect){this.locationService.partial({inspect:null,inspectTab:null});return}if(G.editPanel){this.locationService.partial({editPanel:null,tab:null});return}if(G.viewPanel){this.locationService.partial({viewPanel:null,tab:null});return}const{kioskMode:k}=this.chromeService.state.getValue();k&&this.chromeService.exitKioskMode(),G.search&&this.closeSearch()}showDashEditView(){this.locationService.partial({editview:"settings"})}bind(G,k){Ll.R.bind(G,re=>{re.preventDefault(),re.stopPropagation(),re.returnValue=!1,k.call(this)},"keydown")}bindGlobal(G,k){Ll.R.bindGlobal(G,re=>{re.preventDefault(),re.stopPropagation(),re.returnValue=!1,k.call(this)},"keydown")}unbind(G,k){Ll.R.unbind(G,k)}bindWithPanelId(G,k){this.bind(G,this.withFocusedPanel(k))}withFocusedPanel(G){return()=>{if(typeof this.panelId=="number"){G(this.panelId);return}}}setupTimeRangeBindings(G=!0){this.bind("t a",()=>{wa.A.publish(new ds.Rh({updateUrl:G}))}),this.bind("t z",()=>{wa.A.publish(new ds.U0({scale:2,updateUrl:G}))}),this.bind("ctrl+z",()=>{wa.A.publish(new ds.U0({scale:2,updateUrl:G}))}),this.bind("t left",()=>{wa.A.publish(new ds.Io({direction:ds.xL.Left,updateUrl:G}))}),this.bind("t right",()=>{wa.A.publish(new ds.Io({direction:ds.xL.Right,updateUrl:G}))}),this.bind("t c",()=>{wa.A.publish(new ds.Bt)}),this.bind("t v",()=>{wa.A.publish(new ds.VZ({updateUrl:G}))})}setupDashboardBindings(G){this.bind("mod+o",()=>{G.graphTooltip=(G.graphTooltip+1)%3,G.events.publish(new ci.Tq),G.startRefresh()}),this.bind("mod+s",()=>{G.meta.canSave&&wa.A.publish(new ds.S8({component:Gg.$,props:{dashboard:G}}))}),this.setupTimeRangeBindings(),this.bindWithPanelId("e",k=>{if(G.canEditPanelById(k)){const re=this.locationService.getSearchObject().editPanel!==void 0;this.locationService.partial({editPanel:re?null:k})}}),this.bindWithPanelId("v",k=>{const re=this.locationService.getSearchObject().viewPanel!==void 0;this.locationService.partial({viewPanel:re?null:k})}),this.bindWithPanelId("p l",k=>{const re=G.getPanelById(k),ue={...re.options};ue.legend.showLegend?ue.legend.showLegend=!1:ue.legend.showLegend=!0,re.updateOptions(ue)}),this.bindWithPanelId("i",k=>{this.locationService.partial({inspect:k})}),Us.TP.hasAccessToExplore()&&this.bindWithPanelId("p x",async k=>{const re=G.getPanelById(k),ue=await(0,Hg.Xe)({queries:re.targets,dsRef:re.datasource,scopedVars:re.scopedVars,timeRange:(0,Do.jG)().timeRange()});if(ue){const ve=g.I.stripBaseFromUrl(ue);ve&&this.locationService.push(ve)}}),this.bindWithPanelId("p r",k=>{G.canEditPanelById(k)&&!(G.panelInView||G.panelInEdit)&&wa.A.publish(new ds.Vz(k))}),this.bindWithPanelId("p d",k=>
1559{if(G.canEditPanelById(k)){const re=G.getPanelInfoById(k).index;G.duplicatePanel(G.panels[re])}}),this.bindWithPanelId("p s",k=>{const re=G.getPanelInfoById(k);wa.A.publish(new ds.S8({component:_g.Zy,props:{dashboard:G,panel:re?.panel}}))}),this.bind("d l",()=>{G.toggleLegendsForAll()}),this.bind("d x",()=>{G.toggleExemplarsForAll()}),this.bind("d shift+c",()=>{G.collapseRows()}),this.bind("d shift+e",()=>{G.expandRows()}),this.bind("d n",()=>{this.locationService.push("/dashboard/new")}),this.bind("d r",()=>{G.startRefresh()}),this.bind("d s",()=>{this.showDashEditView()}),this.bind("d k",()=>{this.chromeService.onToggleKioskMode()}),this.bind("d a",()=>{const re=this.locationService.getSearchObject().autofitpanels?"":"&autofitpanels";window.location.href=window.location.href+re})}}var Bd=e(60017);async function sx(){if(window.location.search.indexOf("why-render")!==-1){const{default:z}=await e.e(3718).then(e.t.bind(e,13718,23));z(React,{trackAllPureComponents:!0})}}var Yg=e(25157);const Jg=(0,a.lazy)(()=>e.e(192).then(e.bind(e,48278)));function Xg(){const z=(0,ut.Wd)(jn.hY),G=F.$.unifiedAlertingEnabled;ta.TP.hasPermission(z.read)&&(0,Yg.fP)({show:()=>G,component:({dashboard:k})=>G?(0,M.jsx)(a.Suspense,{fallback:null,children:k&&(0,M.jsx)(Jg,{dashboardUid:k.uid})},"alert-rules-button"):null,index:-2})}var Zg=e(69874);function qg(z){return(0,M.jsx)(em,{...z})}const em=(0,a.lazy)(async()=>{const{EmbeddedDashboard:z}=await e.e(2859).then(e.bind(e,72340));return{default:z}});var tm=e(4405),nm=e(65556),ml=e(35392),am=e(1005),sm=e(96222),_a=e(38619),ui=e(51388),Ud=e(39741),oc=e(97534),Er=e(46383);const rm=z=>G=>new dl.c(k=>{let re=[],ue=!0;const ve=()=>{k.next(re),re=[]},be=z.subscribe({next:We=>{ue=We,ue&&re.length&&ve()}}),Ue=G.subscribe({next(We){ue?re.length?ve():k.next([We]):re.push(We)},error(We){k.error(We)},complete(){k.complete()}});return()=>{Ue.unsubscribe(),be.unsubscribe()}});var om=(z=>(z[z.Error=0]="Error",z[z.NewValuesSameSchema=1]="NewValuesSameSchema",z[z.ChangedSchema=2]="ChangedSchema",z))(om||{});const im=z=>({values:z.reduce((G,{values:k})=>{for(let re=0;re<k.length;re++){G[re]||(G[re]=[]);for(let ue=0;ue<k[re].length;ue++)G[re].push(k[re][ue])}return G},[]),type:1}),Nd=(z,G)=>z.filter(k=>k.type===G);class lm{constructor(G){this.deps=G,this.stream=new Ud.m(1),this.shutdown=()=>{this.stream.complete(),this.liveEventsSubscription.unsubscribe(),this.deps.onShutdown()},this.shutdownIfNoSubscribers=()=>{this.stream.observed||this.shutdown()},this.onError=k=>{console.log("LiveQuery [error]",{err:k},this.deps.channelId),this.stream.next({type:0,error:(0,oc.u)(k)}),this.shutdown()},this.onComplete=()=>{console.log("LiveQuery [complete]",this.deps.channelId),this.shutdown()},this.onNext=k=>{if((0,_a.Z7)(k)){this.process(k.message);return}const re=(0,_a.ew)(k);if(re&&k.error){const ue=(0,oc.u)(k.error);this.stream.next({type:0,error:{...ue,message:`Streaming channel error: ${ue.message}`}})}re&&(k.state===_a.ZF.Connected||k.state===_a.ZF.Pending)&&k.message&&this.process(k.message)},this.process=k=>{this.frameBuffer.push(k).schemaChanged?this.stream.next({type:2}):this.stream.next({type:1,values:this.frameBuffer.getValuesFromLastPacket()})},this.resizeBuffer=k=>{k&&this.frameBuffer.needsResizing(k)&&this.frameBuffer.resize(k)},this.prepareInternalStreamForNewSubscription=k=>{!this.frameBuffer.hasAtLeastOnePacket()&&k.frame&&this.process(k.frame)},this.clearShutdownTimeout=()=>{this.shutdownTimeoutId&&(clearTimeout(this.shutdownTimeoutId),this.shutdownTimeoutId=void 0)},this.get=(k,re)=>{this.clearShutdownTimeout();const ue=(0,ui.m8)(k.buffer);this.resizeBuffer(ue),this.prepareInternalStreamForNewSubscription(k);const ve=k?.buffer?.action===ui.Kh.Replace,be=k.filter?.fields,We=be?.length?({name:ht})=>be.includes(ht):void 0;let Ze;const at=(ht,vt)=>(Ze=We?this.frameBuffer.getMatchingFieldIndexes(We):void 0,ve?vt?{key:re,state:Ma.Gu.Error,data:[{type:Er._w.FullFrame,frame:this.frameBuffer.serialize(We,ue,{maxLength:0})}],error:vt}:ht.length?{key:re,state:Ma.Gu.Streaming,data:[{type:Er._w.FullFrame,frame:this.frameBuffer.serialize(We,ue,{maxLength:this.frameBuffer.packetInfo.length})}],error:vt}:(console.warn(`expected to find at least one non error message ${ht.map(({type:Ft})=>Ft)}`),{key:re,state:Ma.Gu.Streaming,data:[{type:Er._w.FullFrame,frame:this.frameBuffer.serialize(We,ue,{maxLength:0})}],error:vt}):{key:re,state:vt?Ma.Gu.Error:Ma.Gu.Streaming,data:[{type:Er._w.FullFrame,frame:this.frameBuffer.serialize(We,ue)}],error:vt}),ct=ht=>{const vt=ht.length?ht[ht.length-1]:void 0,Ft=ve&&vt?vt.values:im(ht).values,sn=Ze?Ft.filter((fn,In)=>Ze?.includes(In)):Ft;return{key:re,state:Ma.Gu.Streaming,data:[{type:Er._w.NewValuesSameSchema,values:sn}]}};let gt=!0;const pt=this.stream.pipe(rm(this.deps.subscriberReadiness),(0,Fn.T)((ht,vt)=>{const Ft=Nd(ht,0),sn=Ft.length?Ft[Ft.length-1].error:void 0;if(gt)return gt=!1,at(ht,sn);if(Ft.length)return at(ht,sn);if(ht.some(Dn=>Dn.type===2))return at(ht,void 0);const In=Nd(ht,1);return In.length!==ht.length&&console.warn(`unsupported message type ${ht.map(({type:Dn})=>Dn)}`),ct(In)}));return new dl.c(ht=>{const vt=pt.subscribe({next:Ft=>{ht.next(Ft)},error:Ft=>{ht.error(Ft)},complete:()=>{ht.complete()}});return()=>{vt.unsubscribe(),this.stream.observed||(this.clearShutdownTimeout(),this.shutdownTimeoutId=setTimeout(this.shutdownIfNoSubscribers,this.deps.shutdownDelayInMs))}})},this.frameBuffer=ui.k9.empty(G.defaultStreamingFrameOptions),this.liveEventsSubscription=G.liveEventsObservable.subscribe({error:this.onError,complete:this.onComplete,next:this.onNext})}}var jl=e(13752);
1559class cm{constructor(G,k){this.opened=Date.now(),this.stream=new jl.B,this.disconnectIfNoListeners=()=>{this.stream.observers.length===0&&this.disconnect()},this.publish=re=>this.subscription?.publish(re),this.id=G,this.addr=k,this.currentStatus={type:_a.o4.Status,id:G,timestamp:this.opened,state:_a.ZF.Pending},(0,_a.aj)(k)||(this.currentStatus.state=_a.ZF.Invalid,this.currentStatus.error="invalid channel address")}initalize(){if(this.initalized)throw new Error("Channel already initalized: "+this.id);this.initalized=!0,this.subscription.on("publication",G=>{try{G.data&&(G.data.schema&&(this.lastMessageWithSchema=G.data),this.stream.next({type:_a.o4.Message,message:G.data})),this.currentStatus.error&&(this.currentStatus.timestamp=Date.now(),delete this.currentStatus.error,this.sendStatus())}catch(k){console.log("publish error",this.addr,k),this.currentStatus.error=k,this.currentStatus.timestamp=Date.now(),this.sendStatus()}}).on("error",G=>{this.currentStatus.timestamp=Date.now(),this.currentStatus.error=G.error.message,this.sendStatus()}).on("subscribed",G=>{this.currentStatus.timestamp=Date.now(),this.currentStatus.state=_a.ZF.Connected,delete this.currentStatus.error,G.data?.schema&&(this.lastMessageWithSchema=G.data),this.sendStatus(G.data)}).on("unsubscribed",()=>{this.currentStatus.timestamp=Date.now(),this.currentStatus.state=_a.ZF.Disconnected,this.sendStatus()}).on("subscribing",()=>{this.currentStatus.timestamp=Date.now(),this.currentStatus.state=_a.ZF.Connecting,this.sendStatus()}).on("join",G=>{this.stream.next({type:_a.o4.Join,user:G.info.user})}).on("leave",G=>{this.stream.next({type:_a.o4.Leave,user:G.info.user})})}sendStatus(G){const k={...this.currentStatus};G&&(k.message=G),this.stream.next(k)}getStream(){return new dl.c(G=>{const k={...this.currentStatus};this.lastMessageWithSchema?.schema&&(k.message={schema:this.lastMessageWithSchema?.schema}),G.next({...this.currentStatus,message:this.lastMessageWithSchema});const re=this.stream.subscribe(G);return()=>{re.unsubscribe(),this.stream.observers.length===0&&setTimeout(this.disconnectIfNoListeners,250)}})}async getPresence(){return this.subscription?this.subscription.presence().then(G=>({users:Object.keys(G.clients)})):Promise.reject("not subscribed")}disconnect(){this.currentStatus.state=_a.ZF.Shutdown,this.currentStatus.timestamp=Date.now(),this.subscription&&(this.subscription.unsubscribe(),this.subscription.removeAllListeners(),this.subscription=void 0),this.stream.complete(),this.stream.next({...this.currentStatus}),this.stream.complete(),this.shutdownCallback&&this.shutdownCallback()}shutdownWithError(G){this.currentStatus.error=G,this.sendStatus(),this.disconnect()}}function rx(z,G,k){return{id:G,opened:Date.now(),addr:k,getStream:()=>of({type:LiveChannelEventType.Status,id:G,timestamp:Date.now(),state:LiveChannelConnectionState.Invalid,error:z}),disconnect:()=>{}}}const dm={maxLength:100,maxDelta:1/0,action:ui.Kh.Append},um=5e3;class hm{constructor(G){this.deps=G,this.open=new Map,this.liveDataStreamByChannelId={},this.onConnect=ue=>{this.connectionState.next(!0)},this.onDisconnect=ue=>{this.connectionState.next(!1)},this.onServerSideMessage=ue=>{console.log("Publication from server-side channel",ue)},this.getConnectionState=()=>this.connectionState.asObservable(),this.getStream=ue=>this.getChannel(ue).getStream(),this.createSubscriptionKey=ue=>ue.key??`xstr/${fm++}`,this.getLiveDataStream=ue=>{const ve=(0,_a.Qp)(ue.addr),be=this.liveDataStreamByChannelId[ve];if(be)return be;const Ue=this.getChannel(ue.addr);return this.liveDataStreamByChannelId[ve]=new lm({channelId:ve,onShutdown:()=>{delete this.liveDataStreamByChannelId[ve]},liveEventsObservable:Ue.getStream(),subscriberReadiness:this.dataStreamSubscriberReadiness,defaultStreamingFrameOptions:dm,shutdownDelayInMs:um}),this.liveDataStreamByChannelId[ve]},this.getDataStream=ue=>{const ve=this.createSubscriptionKey(ue);return this.getLiveDataStream(ue).get(ue,ve)},this.getQueryData=async ue=>(this.centrifuge.state!==ml.Uw.Connected&&await this.connectionBlocker,this.centrifuge.rpc("grafana.query",ue.body)),this.getPresence=ue=>this.getChannel(ue).getPresence(),this.publish=async(ue,ve,be)=>this.getChannel(ue).publish(ve),this.dataStreamSubscriberReadiness=G.dataStreamSubscriberReadiness.pipe((0,am.u)(),(0,sm.Z)(!0));let k=`${G.appUrl.replace(/^http/,"ws")}/api/live/ws`;const re=G.grafanaAuthToken;re!==null&&re!==""&&(k+="?auth_token="+re),this.centrifuge=new ml.Ft(k,{timeout:3e4}),G.liveEnabled&&G.orgRole!==""&&this.centrifuge.connect(),this.connectionState=new ll.t(this.centrifuge.state===ml.Uw.Connected),this.connectionBlocker=new Promise(ue=>{if(this.centrifuge.state===ml.Uw.Connected)return ue();const ve=()=>{ue(),this.centrifuge.removeListener("connected",ve)};this.centrifuge.addListener("connected",ve)}),this.centrifuge.on("connected",this.onConnect),this.centrifuge.on("connecting",this.onDisconnect),this.centrifuge.on("disconnected",this.onDisconnect),this.centrifuge.on("publication",this.onServerSideMe
1559ssage)}getChannel(G){const k=`${this.deps.orgId}/${G.scope}/${G.namespace}/${G.path}`;let re=this.open.get(k);return re!=null||(re=new cm(k,G),re.currentStatus.state===_a.ZF.Invalid)||(re.shutdownCallback=()=>{this.open.delete(k),this.centrifuge.removeSubscription(this.centrifuge.getSubscription(k))},this.open.set(k,re),this.initChannel(re).catch(ue=>{re&&(re.currentStatus.state=_a.ZF.Invalid,re.shutdownWithError(ue)),this.open.delete(k)})),re}async initChannel(G){this.centrifuge.state!==ml.Uw.Connected&&await this.connectionBlocker;const k=this.centrifuge.newSubscription(G.id,{data:G.addr.data});G.subscription=k,G.initalize(),k.subscribe()}}let fm=0;class pm{constructor(G){this.deps=G,this.getConnectionState=()=>this.deps.centrifugeSrv.getConnectionState(),this.getDataStream=k=>{let re;const ue=ve=>{const be=ve.data[0];if(!re&&!(0,Er.ot)(be,Er._w.FullFrame)){console.warn(`expected first packet to contain a full frame, received ${be?.type}`);return}switch(be.type){case Er._w.FullFrame:{re=ui.k9.deserialize(be.frame);return}case Er._w.NewValuesSameSchema:{re.pushNewValues(be.values);return}}};return this.deps.centrifugeSrv.getDataStream(k).pipe((0,Fn.T)(ve=>(ue(ve),{...ve,data:[re??ui.k9.empty()]})))},this.getStream=k=>this.deps.centrifugeSrv.getStream(k),this.publish=async(k,re,ue)=>ue?.useSocket?this.deps.centrifugeSrv.publish(k,re):this.deps.backendSrv.post("api/live/publish",{channel:(0,_a.Qp)(k),data:re}),this.getPresence=k=>this.deps.centrifugeSrv.getPresence(k)}}function gm(){const z={appUrl:`${window.location.origin}${F.$.appSubUrl}`,orgId:ta.TP.user.orgId,orgRole:ta.TP.user.orgRole,liveEnabled:F.$.liveEnabled,dataStreamSubscriberReadiness:tm.a.ok.asObservable(),grafanaAuthToken:(0,nm.r)()},G=new hm(z);(0,kl.S8)(new pm({centrifugeSrv:G,backendSrv:(0,p.AI)()}))}function ox(){return getGrafanaLiveSrv()}var mm=e(88642),vm=e(35307),hi=e(28998),Wd=e(8001),Bl=e(31595),bo=e(4745),Ul=e(96016),ym=e(16817),xm=e(95027),Em=e(80185);const Fd=new Set,Pm=({id:z})=>!Fd.has(z),Dm=z=>z.forEach(({id:G})=>Fd.add(G));async function ic(z=[]){const G=z.filter(Pm);G.length!==0&&(Dm(z),await Promise.all(G.map(bm)))}async function bm(z){try{const G=await(0,xm.x)(z.id);await(0,Em.ui)(G)}catch(G){console.error(`[Plugins] Failed to preload plugin: ${z.path} (version: ${z.version})`,G)}}var Qa=e(31439);function Nl(z=[]){const{loading:G}=(0,ym.A)(async()=>{const k=(0,Qa.uS)(z);k.length&&await ic(k)});return{isLoading:G}}var Co=e(9453);function Cm(z){const G=(0,il.ZV)(),k=(0,yo.A)(G.asObservable()),re=(0,Bl.Q)(),{isLoading:ue}=Nl((0,Qa.Uy)(z));return(0,a.useMemo)(()=>{const ve=(0,Qa.V2)()&&re;if(ue)return{isLoading:!0,component:null};if(!k?.[z])return{isLoading:!1,component:null};const be=k[z],Ue=Ul.R.child({title:be.title,description:be.description??"",pluginId:be.pluginId});return ve&&(0,Co.xM)(z,re)?(Ue.error(bo.ij),{isLoading:!1,component:null}):{isLoading:!1,component:(0,Qa.nv)(be.pluginId,be.component,Ue)}},[z,re,k,ue])}function Mm({limitPerPlugin:z,extensionPointId:G}){const k=(0,il.TX)(),re=(0,yo.A)(k.asObservable()),ue=(0,Bl.Q)(),{isLoading:ve}=Nl((0,Qa.Ce)(G));return(0,a.useMemo)(()=>{const be=(0,Qa.V2)()&&ue,Ue=[],We={},Ze=ue?.meta.id??"",at=Ul.R.child({pluginId:Ze,extensionPointId:G});if(be&&!(0,Co.Fe)({extensionPointId:G,pluginId:Ze})&&at.error(bo.Bs),be&&(0,Co.PW)(G,ue))return at.error(bo.Ri),{isLoading:!1,components:[]};if(ve)return{isLoading:!0,components:[]};for(const ct of re?.[G]??[]){const{pluginId:gt}=ct;if(z&&We[gt]>=z)continue;We[gt]===void 0&&(We[gt]=0);const pt=Sm(ct,G);Ue.push(pt),We[gt]+=1}return{isLoading:!1,components:Ue}},[G,z,ue,re,ve])}function Sm(z,G){const{component:k,...re}=z;function ue(ve){return(0,M.jsx)(k,{...ve})}return ue.displayName=k.displayName,ue.defaultProps=k.defaultProps,ue.propTypes=k.propTypes,ue.contextTypes=k.contextTypes,ue.meta={pluginId:re.pluginId,title:re.title??"",description:re.description??"",id:(0,Qa.yt)(re.pluginId,G,re.title),type:Tl.u.component},ue}function Tm({limitPerPlugin:z,extensionPointId:G}){const k=(0,il.ov)(),re=(0,yo.A)(k.asObservable()),ue=(0,Bl.Q)(),ve=(0,Qa.Ce)(G),{isLoading:be}=Nl(ve);return(0,a.useMemo)(()=>{const Ue=(0,Qa.V2)()&&ue,We=[],Ze={},at=ue?.meta.id??"",ct=Ul.R.child({pluginId:at,extensionPointId:G});if(Ue&&!(0,Co.Fe)({extensionPointId:G,pluginId:at})&&ct.error(bo.Bs),Ue&&(0,Co.PW)(G,ue))return ct.error(bo.Ri),{isLoading:!1,functions:[]};if(be)return{isLoading:!0,functions:[]};for(const gt of re?.[G]??[]){const{pluginId:pt}=gt;z&&Ze[pt]>=z||(Ze[pt]===void 0&&(Ze[pt]=0),We.push({id:(0,Qa.yt)(pt,G,gt.title),type:Tl.u.function,title:gt.title,de
1559scription:gt.description??"",pluginId:pt,fn:gt.fn}),Ze[pt]+=1)}return{isLoading:!1,functions:We}},[G,z,ue,re,be])}function Om({limitPerPlugin:z,extensionPointId:G,context:k}){const re=(0,il.OG)(),ue=(0,Bl.Q)(),ve=(0,yo.A)(re.asObservable()),{isLoading:be}=Nl((0,Qa.Ce)(G));return(0,a.useMemo)(()=>{const Ue=(0,Qa.V2)()&&ue!==null,We=ue?.meta.id??"",Ze=Ul.R.child({pluginId:We,extensionPointId:G});if(Ue&&!(0,Co.Fe)({extensionPointId:G,pluginId:We}))return Ze.error(bo.Bs),{isLoading:!1,links:[]};if(Ue&&(0,Co.PW)(G,ue))return Ze.error(bo.Ri),{isLoading:!1,links:[]};if(be)return{isLoading:!0,links:[]};if(!ve||!ve[G])return{isLoading:!1,links:[]};const at=k?(0,Qa.$Y)(k):{},ct=[],gt={};for(const pt of ve[G]??[]){const{pluginId:ht}=pt,vt=Ze.child({path:pt.path??"",title:pt.title,description:pt.description??"",onClick:typeof pt.onClick});if(z&>[ht]>=z){vt.debug(`Skipping link extension from plugin "${ht}". Reason: Limit reached.`);continue}gt[ht]===void 0&&(gt[ht]=0);const Ft=(0,Qa.hS)(ht,pt,vt,at);if(pt.configure&&Ft===void 0)continue;const sn=Ft?.path||pt.path,fn={id:(0,Qa.yt)(ht,G,pt.title),type:Tl.u.link,pluginId:ht,onClick:(0,Qa.dx)(ht,G,pt,vt,at),icon:Ft?.icon||pt.icon,title:Ft?.title||pt.title,description:Ft?.description||pt.description||"",path:(0,H.isString)(sn)?(0,Qa.YS)(ht,sn,G):void 0,category:Ft?.category||pt.category};ct.push(fn),gt[ht]+=1}return{isLoading:!1,links:ct}},[k,G,z,ve,ue,be])}var Kd=e(92391),Im=e(57532),wd=e(17548),Rm=e(96215),Am=e(39050),lc=e(71393);class Lm{constructor(){this.subject=new Ud.m(1)}get(){return this.subject.asObservable()}run(G){const{queries:k,timezone:re,datasource:ue,panelId:ve,app:be,dashboardUID:Ue,timeRange:We,timeInfo:Ze,cacheTimeout:at,queryCachingTTL:ct,maxDataPoints:gt,scopedVars:pt,minInterval:ht}=G;this.subscription&&this.subscription.unsubscribe();const vt={app:be??Il.Jk.Unknown,requestId:(0,Rm.S)(),timezone:re,panelId:ve,dashboardUID:Ue,range:We,timeInfo:Ze,interval:"",intervalMs:0,targets:(0,H.cloneDeep)(k),maxDataPoints:gt,scopedVars:pt||{},cacheTimeout:at,queryCachingTTL:ct,startTime:Date.now()};vt.rangeRaw=We.raw,(0,cr.H)(jm(ue,vt.scopedVars)).pipe((0,Im.$)()).subscribe({next:Ft=>{vt.targets=vt.targets.map(In=>(In.datasource||(In.datasource=Ft.getRef()),In));const sn=ht?(0,Je.w)().replace(ht,vt.scopedVars):Ft.interval,fn=wd.calculateInterval(We,gt,sn);vt.scopedVars=Object.assign({},vt.scopedVars,{__interval:{text:fn.interval,value:fn.interval},__interval_ms:{text:fn.intervalMs.toString(),value:fn.intervalMs}}),vt.interval=fn.interval,vt.intervalMs=fn.intervalMs,this.subscription=(0,lc.BN)(Ft,vt).subscribe({next:In=>{const Dn=(0,ir.N$)(In,this.lastResult);this.lastResult=(0,Am.B)(Dn,this.lastResult),this.subject.next(this.lastResult)}})},error:Ft=>console.error("PanelQueryRunner Error",Ft)})}cancel(){this.subscription&&(this.subscription.unsubscribe(),this.lastResult&&this.lastResult.state===Ma.Gu.Loading&&this.subject.next({...this.lastResult,state:Ma.Gu.Done}))}destroy(){this.subject&&this.subject.complete(),this.subscription&&this.subscription.unsubscribe()}}async function jm(z,G){return z&&"query"in z?z:(0,hi.tR)().get(z,G)}var Vd=e(22429);function Bm(){window.grafanaRuntime={getDashboardSaveModel:()=>{const z=(0,Vd.UA)().getCurrent();if(z)return z.getSaveModelCloneOld()},getDashboardTimeRange:()=>{const z=(0,Do.jG)().timeRange();return{from:z.from.valueOf(),to:z.to.valueOf(),raw:z.raw}},getPanelData:()=>{const z=(0,Vd.UA)().getCurrent();if(z)return z.panels.reduce((G,k)=>(G[k.id]=k.getQueryRunner().getLastResult(),G),{})}}}var Um=e(35886),vl=e(54742),$n=e(99305),$d=e(48480),Nm=e(99584),Pr=e(17752);function zd(z){return z.extended&&"infoText"in z.extended?z.extended:null}function Hd(z){return z.extended&&"dataSourceTypes"in z.extended?z.extended:null}function cc(z){return z.extended&&"dataSource"in z.extended?z.extended:null}var ha=e(93612),yl=e(48421);const Wm=(z,G)=>{const{rootStateKey:k}=G.variable;if(!k)return console.error("AdHocVariableEditor: variable has no rootStateKey"),{extended:zd(Pr.nS)};const{editor:re}=(0,ha.nx)(k,z);return{extended:zd(re)}},Fm={changeVariableDatasource:yl.Iv},Km=(0,gs.connect)(Wm,Fm);class wm extends a.PureComponent{constructor(){super(...arguments),this.onDatasourceChanged=G=>{this.props.changeVariableDatasource((0,$n.jX)(this.props.variable),(0,$d.p$)(G))}}componentDidMount(){const{rootStateKey:G}=this.props.variable;if(!G){console.error("AdHocVariableEditor: variable has no rootStateKey");return}}render(){const{variable:G,extended:k}=this.props;return(0,M.jsx)(Nm.Q,{datasource:G.datasource??void 0,onDataSourceChange:this.onDatasourceChanged,infoText:k?.infoText})}}const Vm=Km(wm);var Gd=e(61875),dc=e(76671);const _d=90,Qd=({datasource:z,onChange:G,disabled:k,filterKey:re,allFilters:ue})=>{const ve=()=>kd(z,re,ue),be=()=>Hm(z,re,ue);return re===null?(0,M.jsx)("div",{className:"gf-form","data-testid":"AdHocFilterKey-add-key-wrapper",children:(0,M.jsx)(dc.s,{disabled:k,className:"query-segment-key",Component:zm,value:re,onChange:G,loadOptions:ve,inputMinWidth:_d})}):(0,M.jsx)("div",{className:"gf-form","data-testid":"AdHocFilterKey-key-wrapper",children:(0,M.jsx)(dc.s,{disabled:k,className:"query-segment-key",value:re,onChange:G,loadOptions:be,inputMinWidth:_d})})},Wl="-- remove filter --",$m={label:Wl,value:Wl},zm=(0,M.jsx)("span",{className:"gf-form-label query-part","aria-label":"Add Filter",children:(0,M.jsx)(Qn.I,{name:"plus"})}),kd=async(z,G,k)=>{const re=await(0,hi.tR)().get(z);if(!re||!re.getTagKeys)return[];const ue=k.filter(Ue=>Ue.key!==G),ve=await re.getTagKeys({filters:ue});return(Array.isArray(ve)?ve:ve.data).map(Ue=>({label:Ue.text,value:Ue.text}))},Hm=async(z,G,k)=>{const re=await kd(z,G,k);return[$m,...re]},Gm=({datasource:z,disabled:G,onChange:k,filterKey:re,filterValue:ue,placeHolder:ve,allFilters:be})=>
1559{const Ue=(0,xt.of)(Qm),We=()=>_m(z,re,be);return(0,M.jsx)("div",{className:"gf-form","data-testid":"AdHocFilterValue-value-wrapper",children:(0,M.jsx)(dc.s,{className:Ue.segment,disabled:G,placeholder:ve,value:ue,onChange:k,loadOptions:We})})},_m=async(z,G,k)=>{const re=await(0,hi.tR)().get(z);if(!re||!re.getTagValues)return[];const ue=(0,Do.jG)().timeRange(),ve=k.filter(We=>We.key!==G),be=await re.getTagValues({key:G,filters:ve,timeRange:ue});return(Array.isArray(be)?be:be.data).map(We=>({label:We.text,value:We.text}))};function Qm(){return{segment:(0,_e.css)({display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"500px"})}}const km=["=","!=","<",">","=~","!~"].map(z=>({label:z,value:z})),Ym=({value:z,disabled:G,onChange:k})=>(0,M.jsx)(Gd.Y,{className:"query-segment-operator",value:z,disabled:G,options:km,onChange:k}),Yd=({datasource:z,filter:{key:G,operator:k,value:re},onKeyChange:ue,onOperatorChange:ve,onValueChange:be,placeHolder:Ue,allFilters:We,disabled:Ze})=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Qd,{disabled:Ze,datasource:z,filterKey:G,onChange:ue,allFilters:We}),(0,M.jsx)("div",{className:"gf-form",children:(0,M.jsx)(Ym,{disabled:Ze,value:k,onChange:ve})}),(0,M.jsx)(Gm,{disabled:Ze,datasource:z,filterKey:G,filterValue:re,allFilters:We,onChange:be,placeHolder:Ue})]}),Jm=({datasource:z,appendBefore:G,onCompleted:k,allFilters:re})=>{const[ue,ve]=(0,a.useState)(null),[be,Ue]=(0,a.useState)("="),We=(0,a.useCallback)(ct=>{if(ct.value!==Wl){ve(ct.value??"");return}ve(null)},[ve]),Ze=(0,a.useCallback)(ct=>Ue(ct.value??""),[Ue]),at=(0,a.useCallback)(ct=>{k({value:ct.value??"",operator:be,key:ue}),ve(null),Ue("=")},[k,be,ue]);return ue===null?(0,M.jsx)(Qd,{datasource:z,filterKey:ue,onChange:We,allFilters:re}):(0,M.jsxs)(a.Fragment,{children:[G,(0,M.jsx)(Yd,{datasource:z,filter:{key:ue,value:"",operator:be},placeHolder:(0,ae.t)("variable.adhoc.placeholder","Select value"),onKeyChange:We,onOperatorChange:Ze,onValueChange:at,allFilters:re})]},"filter-builder")},Jd=({label:z})=>(0,M.jsx)("div",{className:"gf-form",children:(0,M.jsx)("span",{className:"gf-form-label query-keyword",children:z})});class Xm extends a.PureComponent{constructor(){super(...arguments),this.connectorLabel=(0,ae.t)("variables.ad-hoc-filter.label-and","AND"),this.onChange=(G,k)=>re=>{const{filters:ue}=this.props,{value:ve}=re;return re.value===Wl?this.props.removeFilter(G):this.props.changeFilter(G,{...ue[G],[k]:ve})},this.appendFilterToVariable=G=>{this.props.addFilter(G)}}render(){const{filters:G,disabled:k}=this.props;return(0,M.jsxs)("div",{className:"gf-form-inline",children:[this.renderFilters(G,k),!k&&(0,M.jsx)(Jm,{datasource:this.props.datasource,appendBefore:G.length>0?(0,M.jsx)(Jd,{label:this.connectorLabel}):null,onCompleted:this.appendFilterToVariable,allFilters:this.getAllFilters()})]})}getAllFilters(){return this.props.baseFilters?this.props.baseFilters.concat(this.props.filters):this.props.filters}renderFilters(G,k){return G.length===0&&k?(0,M.jsx)(Gd.Y,{disabled:k,value:"No filters",options:[],onChange:()=>{}}):G.reduce((re,ue,ve)=>(re.length>0&&re.push((0,M.jsx)(Jd,{label:this.connectorLabel},`condition-${ve}`)),re.push(this.renderFilterSegments(ue,ve,k)),re),[])}renderFilterSegments(G,k,re){return(0,M.jsx)(a.Fragment,{children:(0,M.jsx)(Yd,{disabled:re,datasource:this.props.datasource,filter:G,onKeyChange:this.onChange(k,"key"),onOperatorChange:this.onChange(k,"operator"),onValueChange:this.onChange(k,"value"),allFilters:this.getAllFilters()})},`filter-${k}`)}}const Zm={addFilter:yl.U2,removeFilter:yl.VT,changeFilter:yl.$u},qm=(0,gs.connect)(null,Zm);class e0 extends a.PureComponent{constructor(){super(...arguments),this.addFilter=G=>{this.props.addFilter((0,$n.jX)(this.props.variable),G)},this.removeFilter=G=>{this.props.removeFilter((0,$n.jX)(this.props.variable),G)},this.changeFilter=(G,k)=>{this.props.changeFilter((0,$n.jX)(this.props.variable),{index:G,filter:k})}}render(){const{filters:G,datasource:k,baseFilters:re}=this.props.variable;return(0,M.jsx)(Xm,{datasource:k,filters:G,baseFilters:re,disabled:this.props.readOnly,addFilter:this.addFilter,removeFilter:this.removeFilter,changeFilter:this.changeFilter})}}const Xd=qm(e0);Xd.displayName="AdHocPicker";var Zd=e(25206);const t0=z=>z.map(G=>r0(G).map(a0).join("|")),n0=z=>{if((0,H.isArray)(z))return z.map(qd).filter(o0);const G=qd(z);return G===null?[]:[G]};function a0(z){return z==null?"":/\|/g[Symbol.replace](z,"__gfp__")}function s0(z){return z==null?"":/__gfp__/g[Symbol.replace](z,"|")}function r0(z){return[z.key,z.operator,z.value]}function qd(z){if(!(0,H.isString)(z)||z.length===0)return null;const G=z.split("|").map(s0);return{key:G[0],operator:G[1],value:G[2]}}function o0(z){return z!==null&&(0,H.isString)(z.value)}const eu=async()=>{},i0=()=>({id:"adhoc",description:"Add key/value filters on the fly.",name:"Ad hoc filters",initialState:Zd.MK,reducer:Zd.AA,picker:Xd,editor:Vm,depen
1559dsOn:()=>!1,setValue:eu,setValueFromUrl:async(z,G)=>{const k=n0(G);await(0,Oa.JD)((0,yl.D4)((0,$n.jX)(z),k))},updateOptions:eu,getSaveModel:z=>{const{index:G,id:k,state:re,global:ue,rootStateKey:ve,...be}=(0,H.cloneDeep)(z);return be},getValueForUrl:z=>{const G=z?.filters??[];return t0(G)}});var uc=e(14644),l0=e(8135),ns=e(8921),Xa=e(67933),tu=e(13288),c0=e(44240),Fl=e(16126),d0=e(38975),u0=e(67791),h0=e(66847),f0=e(69850),p0=e(24726),Va=e(39167),Ea=e(74887),Dr=e(65307),Mo=e(7389),xl=e(96120),fi=e(88813);const g0={...fi.Vg,type:"query",datasource:null,query:"",regex:"",sort:Mo.ZG.disabled,refresh:Mo.CO.onDashboardLoad,multi:!1,includeAll:!1,allValue:null,options:[],current:{},definition:""},m0=(z,G)=>{if(G===Mo.ZG.disabled)return z;const k=Math.ceil(G/2),re=G%2===0;return k===1?z=(0,H.sortBy)(z,"text"):k===2?z=(0,H.sortBy)(z,ue=>{if(!ue.text)return-1;const ve=ue.text.match(/.*?(\d+).*/);return!ve||ve.length<2?-1:parseInt(ve[1],10)}):k===3?z=(0,H.sortBy)(z,ue=>(0,H.toLower)(ue.text)):k===4&&z.sort((ue,ve)=>ue.text?ve.text?ue.text.localeCompare(ve.text,void 0,{numeric:!0}):1:-1),re&&(z=z.reverse()),z},v0=(z,G)=>{const k=[];let re=null;G.lastIndex=0;do re=G.exec(z),re&&k.push(re);while(G.global&&re&&re[0]!==""&&re[0]!==void 0);return k},y0=(z,G,k)=>{let re,ue=[];z&&(re=(0,as.dO)(z));for(let ve=0;ve<k.length;ve++){const be=k[ve];let Ue=be.text===void 0||be.text===null?be.value:be.text,We=be.value===void 0||be.value===null?be.text:be.value;if((0,H.isNumber)(We)&&(We=We.toString()),(0,H.isNumber)(Ue)&&(Ue=Ue.toString()),re){const Ze=v0(We,re);if(!Ze.length)continue;const at=Ze.find(ht=>ht.groups&&ht.groups.value),ct=Ze.find(ht=>ht.groups&&ht.groups.text),gt=Ze.find(ht=>ht.length>1),pt=Ze.length>1&>if(at||ct)We=at?.groups?.value??ct?.groups?.text,Ue=ct?.groups?.text??at?.groups?.value;else if(pt){for(let ht=0;ht<Ze.length;ht++){const vt=Ze[ht];ue.push({text:vt[1],value:vt[1],selected:!1})}continue}else gt&&(Ue=gt[1],We=gt[1])}ue.push({text:Ue,value:We,selected:!1})}return ue=(0,H.uniqBy)(ue,"value"),m0(ue,G)},nu=(0,Dr.Z0)({name:"templating/query",initialState:xl.j,reducers:{updateVariableOptions:(z,G)=>{const{results:k,templatedRegex:re}=G.payload.data,ue=(0,ha.Fs)(z,G.payload.id);if(ue.type!=="query")return;const{includeAll:ve,sort:be}=ue,Ue=y0(re,be,k);ve&&Ue.unshift({text:ns.Zm,value:ns.To,selected:!1}),Ue.length||Ue.push({text:ns.ou,value:ns.Ek,isNone:!0,selected:!1}),ue.options=Ue}}}),x0=nu.reducer,{updateVariableOptions:E0}=nu.actions;function P0(){return z=>z.pipe((0,Fn.T)(D0))}function D0(z){const G=z.series;if(!G||!G.length)return[];if(M0(G))return G;const k=(0,ir.Bt)(G),re=[];let ue=-1,ve=-1,be=-1,Ue=-1;for(const We of k)for(let Ze=0;Ze<We.fields.length;Ze++){const at=We.fields[Ze],ct=(0,te.Ct)(at,We,G).toLowerCase();at.type===_.PU.string&&be===-1&&(be=Ze),ct==="text"&&at.type===_.PU.string&&ve===-1&&(ve=Ze),ct==="value"&&at.type===_.PU.string&&ue===-1&&(ue=Ze),ct==="expandable"&&(at.type===_.PU.boolean||at.type===_.PU.number)&&Ue===-1&&(Ue=Ze)}if(be===-1)throw new Error("Couldn't find any field of type string in the results.");for(const We of k)for(let Ze=0;Ze<We.length;Ze++){const at=Ue!==-1?We.fields[Ue].values[Ze]:void 0,ct=We.fields[be].values[Ze],gt=ve!==-1?We.fields[ve].values[Ze]:null,pt=ue!==-1?We.fields[ue].values[Ze]:null;if(ue===-1&&ve===-1){re.push({text:ct,value:ct,expandable:at});continue}if(ue===-1&&ve!==-1){re.push({text:gt,value:gt,expandable:at});continue}if(ue!==-1&&ve===-1){re.push({text:pt,value:pt,expandable:at});continue}re.push({text:gt,value:pt,expandable:at})}return re}function b0(z){return G=>G.pipe((0,Fn.T)(k=>{const{variable:re,dispatch:ue,getTemplatedRegexFunc:ve}=z;if(!re.rootStateKey){console.error("updateOptionsState: variable.rootStateKey is not defined");return}const be=ve(re),Ue=(0,$n.qD)(re,{results:k,templatedRegex:be});ue((0,Ea.kb)(re.rootStateKey,E0(Ue)))}))}function C0(z){return G=>G.pipe((0,lr.Z)(()=>{const{dispatch:k,variable:re,searchFilter:ue}=z;return ue?(0,Wt.of)():(0,cr.H)(k((0,Va.kl)((0,$n.jX)(re))))}))}function M0(z){if(!z)return!1;if(!z.length)return!0;const G=z[0];if((0,ir.ci)(G))return!1;for(const k in G){if(!G.hasOwnProperty(k)||G[k]!==null&&typeof G[k]!="str
1559ing"&&typeof G[k]!="number")continue;const re=k.toLowerCase();if(re==="text"||re==="value")return!0}return!1}var Kl=e(48592),S0=e(22592);class T0{constructor(){this.runners=[new O0,new I0,new R0,new L0]}getRunnerForDatasource(G){const k=this.runners.find(re=>re.canRun(G));if(k)return k;throw new Error("Couldn't find a query runner that matches supplied arguments.")}isQueryRunnerAvailableForDatasource(G){return this.runners.some(k=>k.canRun(G))}}class O0{constructor(){this.type=Kl.Qz.Legacy}canRun(G){return(0,Xa.d5)(G)}getTarget({datasource:G,variable:k}){if((0,Xa.d5)(G))return k.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:G,variable:k,searchFilter:re,timeSrv:ue},ve){if(!(0,Xa.d5)(G))return El();const be=(0,$n.iP)(k,re,ue,ve.scopedVars);return(0,cr.H)(G.metricFindQuery(k.query,be)).pipe((0,lr.Z)(Ue=>{if(!Ue||!Ue.length)return El();const We=Ue;return(0,Wt.of)({series:We,state:Ma.Gu.Done,timeRange:be.range})}))}}class I0{constructor(){this.type=Kl.Qz.Standard}canRun(G){return(0,Xa.Hf)(G)}getTarget({datasource:G,variable:k}){if((0,Xa.Hf)(G))return G.variables.toDataQuery(k.query);throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:G,runRequest:k},re){return(0,Xa.Hf)(G)?G.variables.query?k(G,re,G.variables.query.bind(G.variables)):k(G,re):El()}}class R0{constructor(){this.type=Kl.Qz.Custom}canRun(G){return(0,Xa.zs)(G)}getTarget({datasource:G,variable:k}){if((0,Xa.zs)(G))return k.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:G,runRequest:k},re){return(0,Xa.zs)(G)?k(G,re,G.variables.query.bind(G.variables)):El()}}const A0="variable-query";class L0{constructor(){this.type=Kl.Qz.Datasource}canRun(G){return(0,Xa.X3)(G)}getTarget({datasource:G,variable:k}){if((0,Xa.X3)(G))return{...k.query,refId:k.query.refId??A0};throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:G,runRequest:k},re){return(0,Xa.X3)(G)?k(G,re):El()}}function El(){return(0,Wt.of)({state:Ma.Gu.Done,series:[],timeRange:(0,S0.E2)()})}class j0{constructor(G={dispatch:Oa.JD,getState:Oa.Gu,getVariable:ha.dn,getTemplatedRegex:$n.u7,getTimeSrv:Do.jG,queryRunners:new T0,runRequest:lc.BN}){this.dependencies=G,this.updateOptionsRequests=new jl.B,this.updateOptionsResults=new jl.B,this.cancelRequests=new jl.B,this.onNewRequest=this.onNewRequest.bind(this),this.subscription=this.updateOptionsRequests.subscribe(this.onNewRequest)}queueRequest(G){this.updateOptionsRequests.next(G)}getResponse(G){return this.updateOptionsResults.asObservable().pipe((0,Fl.p)(k=>k.identifier===G))}cancelRequest(G){this.cancelRequests.next({identifier:G})}destroy(){this.subscription.unsubscribe()}onNewRequest(G){const{datasource:k,identifier:re,searchFilter:ue}=G;try{const{dispatch:ve,runRequest:be,getTemplatedRegex:Ue,getVariable:We,queryRunners:Ze,getTimeSrv:at,getState:ct}=this.dependencies,gt=(0,ha.y7)(ct());this.updateOptionsResults.next({identifier:re,state:Ma.Gu.Loading});const pt=We(re,ct());if(pt.type!=="query")return;const ht=at(),vt={variable:pt,datasource:k,searchFilter:ue,timeSrv:ht,runRequest:be};if(!Ze.isQueryRunnerAvailableForDatasource(k)){const In=new Error("Query Runner is not available for datasource.");this.updateOptionsResults.next({identifier:re,state:Ma.Gu.Error,error:In});return}const Ft=Ze.getRunnerForDatasource(k),sn=Ft.getTarget({datasource:k,variable:pt}),fn=this.getRequest(pt,G,sn);Ft.runRequest(vt,fn).pipe((0,Fl.p)(()=>{const In=(0,ha.y7)(ct());return gt===In}),(0,Fl.p)(In=>In.state===Ma.Gu.Done||In.state===Ma.Gu.Error),(0,d0.s)(1),(0,lr.Z)(In=>In.state===Ma.Gu.Error?(0,tu.$)(()=>In.error):(0,Wt.of)(In)),P0(),b0({variable:pt,dispatch:ve,getTemplatedRegexFunc:Ue}),C0({variable:pt,dispatch:ve,searchFilter:ue}),(0,u0.Q)((0,c0.h)(this.updateOptionsRequests,this.cancelRequests).pipe((0,Fl.p)(In=>{let Dn=!1;return In.identifier.id===re.id&&(Dn=!0,this.updateOptionsResults.next({identifier:re,state:Ma.Gu.Loading,cancelled:Dn})),Dn}))),(0,h0.W)(In=>In.cancelled?(0,Wt.of)({}):(this.updateOptionsResults.next({identifier:re,state:Ma.Gu.Error,error:In}),(0,tu.$)(()=>In))),(0,f0.j)(()=>{this.updateOptionsResults.next({identifier:re,state:Ma.Gu.Done})})).subscribe()}catch(ve){this.updateOptionsResults.next({identifier:re,state:Ma.Gu.Error,error:ve})}}
1559getRequest(G,k,re){const{searchFilter:ue}=k,ve={variable:{text:G.current.text,value:G.current.value}},We={...ue?{searchFilter:{text:ue,value:ue}}:{},...ve},Ze=this.dependencies.getTimeSrv().timeRange();return{app:Il.Jk.Dashboard,requestId:(0,p0.A)(),timezone:"",range:Ze,interval:"",intervalMs:0,targets:[re],scopedVars:We,startTime:Date.now()}}}let au;function B0(z){au=z}function hc(){return au}const U0=z=>{if(!N0(z))return z.name;const{current:G}=z;return Array.isArray(G.text)?G.text.join(" + "):G.text},N0=z=>Array.isArray(z?.options)||typeof z?.current=="object";var wr=(z=>(z[z.moveUp=38]="moveUp",z[z.moveDown=40]="moveDown",z[z.select=32]="select",z[z.cancel=27]="cancel",z[z.selectAndClose=13]="selectAndClose",z))(wr||{});class W0 extends a.PureComponent{constructor(){super(...arguments),this.onKeyDown=G=>{if(wr[G.keyCode]&&G.keyCode!==wr.select){const k=G.ctrlKey||G.metaKey||G.shiftKey;this.props.onNavigate(G.keyCode,k),G.preventDefault()}},this.onChange=G=>{this.props.onChange(G.target.value)}}render(){const{value:G,id:k,onNavigate:re,...ue}=this.props;return(0,M.jsx)("input",{...ue,ref:ve=>{ve&&(ve.focus(),ve.setAttribute("style",`width:${Math.max(ve.width,150)}px`))},id:k,type:"text",className:"gf-form-input",value:G??"",onChange:this.onChange,onKeyDown:this.onKeyDown,placeholder:(0,ae.t)("variable.dropdown.placeholder","Enter variable value")})}}var F0=e(17503),K0=e(11297);const w0=({loading:z,disabled:G,onClick:k,text:re,onCancel:ue,id:ve})=>{const be=(0,xt.of)(ru),Ue=(0,a.useCallback)(We=>{We.stopPropagation(),We.preventDefault(),k()},[k]);return z?(0,M.jsxs)("div",{className:be.container,"data-testid":xa.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${re}`),title:re,id:ve,children:[(0,M.jsx)(su,{text:re}),(0,M.jsx)(F0.I,{loading:!0,onCancel:ue})]}):(0,M.jsxs)("button",{onClick:Ue,className:be.container,"data-testid":xa.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${re}`),"aria-expanded":!1,"aria-controls":`options-${ve}`,id:ve,title:re,disabled:G,children:[(0,M.jsx)(su,{text:re}),(0,M.jsx)(Qn.I,{"aria-hidden":!0,name:"angle-down",size:"sm"})]})},su=({text:z})=>{const G=(0,xt.of)(ru);return(0,M.jsx)("span",{className:G.textAndTags,children:z===ns.Zm?(0,ae.t)("variable.picker.link-all","All"):z})},ru=z=>{const G=(0,K0.$)(z);return{container:(0,_e.css)({maxWidth:"500px",paddingRight:"10px",padding:z.spacing(0,1),backgroundColor:z.components.input.background,border:`1px solid ${z.components.input.borderColor}`,borderRadius:z.shape.radius.default,display:"flex",alignItems:"center",color:z.colors.text.primary,height:z.spacing(z.components.height.md),[`.${G.badge}`]:{margin:"0 5px"},"&:disabled":{backgroundColor:z.colors.action.disabledBackground,color:z.colors.action.disabledText,border:`1px solid ${z.colors.action.disabledBackground}`}}),textAndTags:(0,_e.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginRight:z.spacing(.25),userSelect:"none"})}};class V0 extends a.PureComponent{constructor(){super(...arguments),this.onToggle=G=>k=>{const re=k.shiftKey||k.ctrlKey||k.metaKey;this.handleEvent(k),this.props.onToggle(G,re)},this.onToggleAll=G=>{this.handleEvent(G),this.props.onToggleAll()}}handleEvent(G){G.preventDefault(),G.stopPropagation()}render(){const{multi:G,values:k,highlightIndex:re,selectedValues:ue,onToggle:ve,onToggleAll:be,theme:Ue,...We}=this.props,Ze=fc(Ue);return(0,M.jsx)("div",{className:Ze.variableValueDropdown,children:(0,M.jsx)("div",{className:Ze.variableOptionsWrapper,children:(0,M.jsxs)("ul",{className:Ze.variableOptionsColumn,"aria-label":xa.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown,...We,children:[this.renderMultiToggle(),k.map((at,ct)=>this.renderOption(at,ct))]})})})}renderOption(G,k){const{highlightIndex:re,multi:ue,theme:ve}=this.props,be=fc(ve),Ue=G.value===ns.To;return(0,M.jsx)("li",{children:(0,M.jsxs)("button",{"data-testid":xa.Tp.components.Variables.variableOption,role:"checkbox",type:"button","aria-checked":G.selected,className:(0,_e.cx)((0,oe.my)(ve),be.variableOption,{[be.highlighted]:k===re,[be.variableAllOption]:Ue},be.noStyledButton),onClick:this.onToggle(G),children:[(0,M.jsx)("span",{className:(0,_e.cx)(be.variableOptionIcon,{[be.variableOptionIconSelected]:G.selected,[be.hideVariableOptionIcon]:!ue})}),(0,M.jsx)("span",{"data-testid":xa.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(`${G.text}`),children:Ue?(0,ae.t)("variable.picker.option-all","All"):G.text})]})},`${G.value}`)}renderMultiToggle(){const{multi:G,selectedValues:k,theme:re,values:ue}=this.props,ve=fc(re),be=ue.some(We=>We.value===ns.To);if(!G)return null;const Ue=()=>(0,M.jsx)(ae.x6,{i18nKey:"variable.picker.option-tooltip",children:"Clear selections"});return(0,M.jsx)(Ns.m,{content:Ue,placement:"top",children:(0,M.jsxs)("button",{className:(0,_e.cx)((0,oe.my)(re),ve.variableOption,ve.variableOptionColumnHeader,ve.noStyledButton,{[ve.noPaddingBotton]:be}),role:"checkbox","aria-checked":k.length>1?"mixed":"false",onClick:this.onToggleAll,"aria-label":(0,ae.t)("variables.variable-options.aria-label-toggle-all-values","Toggle all values"),"data-placement":"top",children:[(0,M.jsx)("span",{className:(0,_e.cx)(ve.variableOptionIcon,{[ve.variableOptionIconManySelected]:k.length>1})}),(0,M.jsxs)(ae.x6,{i18nKey:"variable.picker.option-selected-values",values:{numSelected:k.length},children:["Selected (","{{numSelected}}",")"]})]})})}}const fc=(0,Tc.N)(z=>{const G=z.isDark?"public/img/checkbox.png":"public/img/checkbox_white.png";return{hideVariableOptionIcon:(0,_e.css)({display:"none"}),highlighted:(0,_e.css)({backgroundColor:z.colors.action.hover}),noStyledButton:(0,_e.css)({width:"100%",textAlign:"left"}),variableOption:(0,_e.css)({display:"block",padding:"2px 27px 0 8px",position:"relative",whiteSpace:"nowrap",minWidth:"115px","&:hover":{backgroundColor:z.colors.action.hover}}),variableOptionColumnHeader:(0,_e.css)({paddingTop:"5px",paddingBottom:"5px",marginBottom:"5px"}),variableOptionIcon:(0,_e.css)({display:"inline-block",width:"24px",height:"18px",position:"relative",top:"4px",background:`url(${G}) left top no-repeat`}),variableOptionIconManySelected:(0,_e.css)({background:`url(${G}) 0px -36px no-repeat`}),variableOptionIconSelected:(0,_e.css)({background:`url(${G}
1559) 0px -18px no-repeat`}),variableValueDropdown:(0,_e.css)({backgroundColor:z.colors.background.primary,border:`1px solid ${z.colors.border.weak}`,borderRadius:z.shape.borderRadius(2),boxShadow:z.shadows.z2,position:"absolute",top:z.spacing(z.components.height.md),maxHeight:"400px",minHeight:"150px",minWidth:"150px",overflowY:"auto",overflowX:"hidden",zIndex:z.zIndex.typeahead}),variableOptionsColumn:(0,_e.css)({maxHeight:"350px",display:"table-cell",lineHeight:"26px",listStyleType:"none"}),variableOptionsWrapper:(0,_e.css)({display:"table",width:"100%"}),variableAllOption:(0,_e.css)({borderBottom:`1px solid ${z.colors.border.weak}`,paddingBottom:z.spacing(1)}),noPaddingBotton:(0,_e.css)({paddingBottom:0})}}),$0=(0,xt.cV)(V0);var z0=e(94452),ou=e(3594),Vr=e(88681),Hs=e(99598);const H0=(z,G,k)=>async(re,ue)=>{if(G===wr.cancel)return await re(wl(z));if(G===wr.select)return re(pc(z,k));if(G===wr.selectAndClose)return(0,ha.nx)(z,ue()).optionsPicker.multi?re(pc(z,k)):(re(pc(z,k,!0)),re(wl(z)));if(G===wr.moveDown)return re((0,Ea.kb)(z,(0,Hs.O$)(1)));if(G===wr.moveUp)return re((0,Ea.kb)(z,(0,Hs.O$)(-1)))},G0=(z,G="")=>async(k,re)=>{const{rootStateKey:ue}=z,{id:ve,queryValue:be}=(0,ha.nx)(ue,re()).optionsPicker,Ue={id:ve,rootStateKey:ue,type:"query"},We=(0,ha.dn)(Ue,re());if(!("options"in We)||(k((0,Ea.kb)(ue,(0,Hs.S8)(G))),(0,H.trim)(be)===(0,H.trim)(G)))return;const{query:Ze,options:at}=We,ct=typeof Ze=="string"?Ze:Ze.target;return(0,z0.E)(ct)?Y0(k,re,G,ue):k((0,Ea.kb)(ue,(0,Hs.fx)(at)))},_0=async z=>{if((0,ou.R)(z.current))return;await vl.B.get(z.type).setValue(z,z.current,!0)},wl=(z,G)=>async(k,re)=>{const ue=(0,ha.nx)(z,re()).optionsPicker,ve={id:ue.id,rootStateKey:z,type:"query"},be=(0,ha.dn)(ve,re());if(!(0,Xa.SP)(be))return;const Ue={option:J0(ue)},We={propName:"queryValue",propValue:ue.queryValue};k((0,Ea.kb)(z,(0,Vr.dE)((0,$n.qD)(be,Ue)))),k((0,Ea.kb)(z,(0,Vr.QP)((0,$n.qD)(be,We))));const Ze=(0,ha.dn)(ve,re());if((0,Xa.SP)(Ze)&&(k((0,Ea.kb)(z,(0,Hs.Fu)())),(0,$n.Lz)(be)!==(0,$n.Lz)(Ze)))return G?G(Ze):await _0(Ze)},Q0=(z,G)=>async(k,re)=>{const{id:ue,rootStateKey:ve}=z,be=(0,ha.nx)(ve,re()).optionsPicker;be.id&&be.id!==ue&&await k(wl(ve,G));const Ue=(0,ha.dn)(z,re());(0,Xa.SP)(Ue)&&k((0,Ea.kb)(ve,(0,Hs.MO)(Ue)))},pc=(z,G,k=!1)=>(re,ue)=>{const{highlightIndex:ve,options:be}=(0,ha.nx)(z,ue()).optionsPicker,Ue=be[ve];re((0,Ea.kb)(z,(0,Hs.U9)({option:Ue,forceSelect:k,clearOthers:G})))},k0=async(z,G,k,re)=>{try{const{id:ue}=(0,ha.nx)(re,G()).optionsPicker,ve={id:ue,rootStateKey:re,type:"query"},be=(0,ha.dn)(ve,G());if(!(0,Xa.SP)(be))return;await vl.B.get(be.type).updateOptions(be,k);const We=(0,ha.dn)(ve,G());if(!(0,Xa.SP)(We))return;z((0,Ea.kb)(re,(0,Hs.qh)(We.options)))}catch(ue){console.error(ue)}},Y0=(0,H.debounce)(k0,500);function J0(z){const{options:G,selectedValues:k,queryValue:re,multi:ue}=z;if(G.length===0&&re&&re.length>0)return{text:re,value:re,selected:!1};if(!ue)return k.find(Ue=>Ue.selected);const ve=[],be=[];for(const Ue of k)Ue.selected&&(ve.push(Ue.text.toString()),be.push(Ue.value.toString()));return{value:be,text:ve,selected:!0}}const Pl=()=>{const z=ve=>({...(0,uc.bindActionCreators)({openOptions:Q0,commitChangesToVariable:wl,navigateOptions:H0},ve),filterOrSearchOptions:(be,Ue="")=>{ve(G0(be,Ue))},toggleAllOptions:be=>ve((0,Ea.kb)(be.rootStateKey,(0,Hs.an)())),toggleOption:(be,Ue,We,Ze)=>ve((0,Ea.kb)(be.rootStateKey,(0,Hs.U9)({option:Ue,clearOthers:We,forceSelect:Ze})))}),G=(ve,be)=>{const{rootStateKey:Ue}=be.variable;return Ue?{picker:(0,ha.nx)(Ue,ve).optionsPicker}:(console.error("OptionPickerFactory: variable has no rootStateKey"),{picker:Hs.$z})},k=(0,gs.connect)(G,z);class re extends a.PureComponent{constructor(){super(...arguments),this.onShowOptions=()=>this.props.openOptions((0,$n.jX)(this.props.variable),this.props.onVariableChange),this.onHideOptions=()=>{if(!this.props.variable.rootStateKey){console.error("Variable has no rootStateKey");return}this.props.commitChangesToVariable(this.props.variable.rootStateKey,this.props.onVariableChange)},this.onToggleOption=(be,Ue)=>{((0,Xa.iv)(this.props.variable)&&this.props.variable.multi?this.onToggleMultiValueVariable:this.onToggleSingleValueVariable)(be,Ue)},this.onToggleSingleValueVariable=(be,Ue)=>{this.props.toggleOption((0,$n.jX)(this.props.variable),be,Ue,!1),this.onHideOptions()},this.onToggleMultiValueVariable=(be,Ue)=>{this.props.toggleOption((0,$n.jX)(this.props.variable),be,Ue,!1)},this.onToggleAllOptions=()=>{this.props.toggleAllOptions((0,$n.jX)(this.props.variable))},this.onFilterOrSearchOptions=be=>{this.props.filterOrSearchOptions((0,$n.jX)(this.props.variable),be)},this.onNavigate=(be,Ue)=>{if(!this.props.variable.rootStateKey){console.error("Variable has no rootStateKey");return}this.props.navigateOptions(this.props.variable.rootStateKey,be,Ue)},this.onCancel=()=>{hc().cancelRequest((0,$n.jX)(this.props.variable))}}render(){const{variable:be,picker:Ue}=this.props,We=Ue.id===be.id,Ze=X0();return(0,M.jsx)("div",{className:Ze.variableLinkWrapper,"data-testid":xa.Tp.components.Variables.variableLinkWrapper,children:We?this.renderOptions(Ue):this.renderLink(be)})}
1559renderLink(be){const Ue=U0(be),We=be.state===Ma.Gu.Loading;return(0,M.jsx)(w0,{id:ns.qz+be.id,text:Ue,onClick:this.onShowOptions,loading:We,onCancel:this.onCancel,disabled:this.props.readOnly})}renderOptions(be){const{id:Ue}=this.props.variable;return(0,M.jsxs)(l0.N,{onClick:this.onHideOptions,children:[(0,M.jsx)(W0,{id:ns.qz+Ue,value:be.queryValue,onChange:this.onFilterOrSearchOptions,onNavigate:this.onNavigate,"aria-expanded":!0,"aria-controls":`options-${Ue}`}),(0,M.jsx)($0,{values:be.options,onToggle:this.onToggleOption,onToggleAll:this.onToggleAllOptions,highlightIndex:be.highlightIndex,multi:be.multi,selectedValues:be.selectedValues,id:`options-${Ue}`})]})}}const ue=k(re);return ue.displayName="OptionsPicker",ue},X0=()=>({variableLinkWrapper:(0,_e.css)({display:"inline-block",position:"relative"})});var Z0=e(23675);class q0 extends a.PureComponent{constructor(){super(...arguments),this.onChange=G=>{this.props.onPropChange({propName:"query",propValue:G.currentTarget.value,updateOptions:!0})}}render(){return(0,M.jsx)(Z0.d,{constantValue:this.props.variable.query,onChange:this.onChange})}}const ev={...fi.Vg,type:"constant",hide:Mo.zL.hideVariable,query:"",current:{},options:[]},iu=(0,Dr.Z0)({name:"templating/constant",initialState:xl.j,reducers:{createConstantOptionsFromQuery:(z,G)=>{const k=(0,ha.Fs)(z,G.payload.id);k.type==="constant"&&(k.options=[{text:k.query.trim(),value:k.query.trim(),selected:!1}])}}}),tv=iu.reducer,{createConstantOptionsFromQuery:nv}=iu.actions,av=z=>async G=>{const{rootStateKey:k}=z;await G((0,Ea.kb)(k,nv((0,$n.qD)(z)))),await G((0,Va.kl)(z))},sv=()=>({id:"constant",description:"Define a hidden constant variable, useful for metric prefixes in dashboards you want to share.",name:"Constant",initialState:ev,reducer:tv,picker:Pl(),editor:q0,dependsOn:()=>!1,setValue:async(z,G,k=!1)=>{await(0,Oa.JD)((0,Va.t9)((0,$n.jX)(z),G,k))},setValueFromUrl:async(z,G)=>{await(0,Oa.JD)((0,Va.x7)((0,$n.jX)(z),G))},updateOptions:async z=>{await(0,Oa.JD)(av((0,$n.jX)(z)))},getSaveModel:z=>{const{index:G,id:k,state:re,global:ue,current:ve,options:be,rootStateKey:Ue,...We}=(0,H.cloneDeep)(z);return We},getValueForUrl:z=>z.current.value,beforeAdding:z=>{const{current:G,options:k,query:re,...ue}=(0,H.cloneDeep)(z),ve={selected:!0,text:re,value:re};return{...ue,current:ve,options:[ve],query:re}}});function rv(z,...G){const k=(0,gs.connect)(...G)(z);return re=>(0,M.jsx)(k,{...re,store:Oa.M_})}function ix(z,...G){const k=connect(...G)(z);return re=>jsx(Provider,{store,children:jsx(k,{...re,store})})}var ov=e(70430);class iv extends a.PureComponent{constructor(){super(...arguments),this.onSelectionOptionsChange=async({propName:G,propValue:k})=>{this.props.onPropChange({propName:G,propValue:k,updateOptions:!0})},this.onQueryChange=G=>{this.props.onPropChange({propName:"query",propValue:G.currentTarget.value,updateOptions:!0})}}render(){return(0,M.jsx)(ov.w,{query:this.props.variable.query,multi:this.props.variable.multi,allValue:this.props.variable.allValue,includeAll:this.props.variable.includeAll,onQueryChange:this.onQueryChange,onMultiChange:G=>this.onSelectionOptionsChange({propName:"multi",propValue:G.currentTarget.checked}),onIncludeAllChange:G=>this.onSelectionOptionsChange({propName:"includeAll",propValue:G.currentTarget.checked}),onAllValueChange:G=>this.onSelectionOptionsChange({propName:"allValue",propValue:G.currentTarget.value})})}}const lv=(z,G)=>({}),cv={changeVariableMultiValue:Va.TI},dv=rv(iv,lv,cv),uv={...fi.Vg,type:"custom",multi:!1,includeAll:!1,allValue:null,query:"",options:[],current:{}},lu=(0,Dr.Z0)({name:"templating/custom",initialState:xl.j,reducers:{createCustomOptionsFromQuery:(z,G)=>{const k=(0,ha.Fs)(z,G.payload.id);if(k.type!=="custom")return;const{includeAll:re}=k,be=(G.payload.data.match(/(?:\\,|[^,])+/g)??[]).map(Ue=>{Ue=Ue.replace(/\\,/g,",");const We=/^(.+)\s:\s(.+)$/g.exec(Ue)??[];if(We.length===3){const[,Ze,at]=We;return{text:Ze.trim(),value:at.trim(),selected:!1}}else return{text:Ue.trim(),value:Ue.trim(),selected:!1}});re&&be.unshift({text:ns.Zm,value:ns.To,selected:!1}),k.options=be}}}),hv=lu.reducer,{createCustomOptionsFromQuery:fv}=lu.actions,pv=z=>async(G,k)=>{const{rootStateKey:re}=z,ue=(0,ha.dn)(z,k());if(ue.type!=="custom")return;const ve=(0,Je.w)().replace(ue.query);await G((0,Ea.kb)(re,fv((0,$n.qD)(z,ve)))),await G((0,Va.kl)(z))},gv=()=>({id:"custom",description:"Define variable values manually",name:"Custom",initialState:uv,reducer:hv,picker:Pl(),editor:dv,dependsOn:(z,G)=>(0,$n.wJ)(z.query,G.name),setValue:async(z,G,k=!1)=>{await(0,Oa.JD)((0,Va.t9)((0,$n.jX)(z),G,k))},setValueFromUrl:async(z,G)=>{await(0,Oa.JD)((0,Va.x7)((0,$n.jX)(z),G))},updateOptions:async z=>{await(0,Oa.JD)(pv((0,$n.jX)(z)))},getSaveModel:z=>{const{index:G,id:k,state:re,global:ue,rootStateKey:ve,...be}=(0,H.cloneDeep)(z);return be},getValueForUrl:z=>(0,$n.ML)(z)?ns.Zm:z.current.value});var mv=e(42272),vv=e(8134);const yv={...fi.Vg,type:"datasource",current:{},regex:"",options:[],query:"",multi:!1,includeAll:!1,refresh:Mo.CO.onDashboardLoad},cu=(0,Dr.Z0)({name:"templating/datasource",initialState:xl.j,reducers:{createDataSourceOptions:(z,G)=>{const{sources:k,regex:re}=G.payload.data,ue=[],ve=(0,ha.Fs)(z,G.payload.id);if(ve.type==="datasource"){for(let be=0;be<k.length;be++){const Ue=k[be];(0,vv._)(ve.query,Ue.meta)&&(xv(Ue,re)&&ue.push({text:Ue.name,value:Ue.uid,selected:!1}),Ev(Ue,re)&&ue.push({text:"default",value:"default",selected:!1}))}ue.length===0&&ue.push({text:"No data sources found",value:"",selected:!1}),ve.includeAll&&ue.unshift({text:ns.Zm,value:ns.To,selected:!1}),ve.options=ue}}}});function xv(z,G){return G?G.exec(z.name):!0}function Ev(z,G){return z.isDefault?G?G.exec("default"):!0:!1}const Pv=cu.reducer,{createDataSourceOptions:Dv}=cu.actions,bv=(z,G={getDatasourceSrv:hi.tR})=>async(k,re)=>{const{rootStateKey:ue}=z,ve=G.getDatasourceSrv().getList({metrics:!0,variables:!1}),be=(0,ha.dn)(z,re());if(be.type!=="datasource")return;let Ue;be.regex&&(Ue=(0,Je.w)().replace(be.regex,void 0,"regex"),Ue=(0,as.dO)(Ue)),k((0,Ea.kb)(ue,Dv((0,$n.qD)(z,{sources:ve,regex:Ue})))),await k((0,Va.kl)(z))},Cv=(z,G={getDatasourceSrv:hi.tR})=>k=>{const re=G.getDatasourceSrv().getList({metrics:!0,variables:!0}
1559),ue=(0,H.chain)(re).uniqBy("meta.id").map(ve=>({text:ve.meta.name,value:ve.meta.id})).value();ue.unshift({text:"",value:""}),k((0,Ea.kb)(z,(0,Pr.BC)({dataSourceTypes:ue})))},Mv=(z,G)=>{const{variable:{rootStateKey:k}}=G;if(!k)return console.error("DataSourceVariableEditor: variable has no rootStateKey"),{extended:Hd(Pr.nS)};const{editor:re}=(0,ha.nx)(k,z);return{extended:Hd(re)}},Sv={initDataSourceVariableEditor:Cv,changeVariableMultiValue:Va.TI},Tv=(0,gs.connect)(Mv,Sv);class Ov extends a.PureComponent{constructor(){super(...arguments),this.onRegExBlur=G=>{this.props.onPropChange({propName:"regex",propValue:G.currentTarget.value,updateOptions:!0})},this.onSelectionOptionsChange=async({propValue:G,propName:k})=>{this.props.onPropChange({propName:k,propValue:G,updateOptions:!0})},this.onMultiChanged=G=>{this.props.changeVariableMultiValue((0,$n.jX)(this.props.variable),G.currentTarget.checked)},this.onIncludeAllChanged=G=>{this.onSelectionOptionsChange({propName:"includeAll",propValue:G.currentTarget.checked})},this.onAllValueChanged=G=>{this.onSelectionOptionsChange({propName:"allValue",propValue:G.currentTarget.value})}
1559,this.getSelectedDataSourceTypeValue=()=>{const{extended:G}=this.props;if(!G?.dataSourceTypes.length)return"";const k=G.dataSourceTypes.find(ue=>ue.value===this.props.variable.query);return(k?k.value:G.dataSourceTypes[0].value)??""},this.onDataSourceTypeChanged=G=>{this.props.onPropChange({propName:"query",propValue:G.value,updateOptions:!0})}}componentDidMount(){const{rootStateKey:G}=this.props.variable;if(!G){console.error("DataSourceVariableEditor: variable has no rootStateKey");return}this.props.initDataSourceVariableEditor(G)}render(){const{variable:G,extended:k}=this.props,re=k?.dataSourceTypes?.length?k.dataSourceTypes?.map(ue=>({value:ue.value??"",label:ue.text})):[];return(0,M.jsx)(mv.y,{query:G.query,regex:G.regex,multi:G.multi,includeAll:G.includeAll,optionTypes:re,onChange:this.onDataSourceTypeChanged,onRegExBlur:this.onRegExBlur,onMultiChange:this.onMultiChanged,onIncludeAllChange:this.onIncludeAllChanged,onAllValueChange:this.onAllValueChanged})}}const Iv=Tv(Ov),Rv=()=>({id:"datasource",description:"Enables you to dynamically switch the data source for multiple panels.",name:"Data source",initialState:yv,reducer:Pv,picker:Pl(),editor:Iv,dependsOn:(z,G)=>z.regex?(0,$n.wJ)(z.regex,G.name):!1,setValue:async(z,G,k=!1)=>{await(0,Oa.JD)((0,Va.t9)((0,$n.jX)(z),G,k))},setValueFromUrl:async(z,G)=>{await(0,Oa.JD)((0,Va.x7)((0,$n.jX)(z),G))},updateOptions:async z=>{await(0,Oa.JD)(bv((0,$n.jX)(z)))},getSaveModel:z=>{const{index:G,id:k,state:re,global:ue,rootStateKey:ve,...be}=(0,H.cloneDeep)(z);return{...be,options:[]}},getValueForUrl:z=>(0,$n.ML)(z)?ns.Zm:z.current.value});var Av=e(66223),Lv=e(1096);const du=(0,a.memo)(({onPropChange:z,variable:G})=>{const k=be=>{z({propName:"auto",propValue:be.target.checked,updateOptions:!0})},re=be=>{z({propName:"query",propValue:be.currentTarget.value,updateOptions:!0})},ue=be=>{z({propName:"auto_count",propValue:be.value,updateOptions:!0})},ve=be=>{z({propName:"auto_min",propValue:be.currentTarget.value,updateOptions:!0})};return(0,M.jsx)(Lv.s,{intervals:G.query,autoStepCount:G.auto_count,autoEnabled:G.auto,onAutoCountChanged:ue,onIntervalsChange:re,onAutoEnabledChange:k,onAutoMinIntervalChanged:ve,autoMinInterval:G.auto_min})});du.displayName="IntervalVariableEditor";var jv=e(59373),gc=e(98732);const Bv=z=>async G=>{const{rootStateKey:k}=z;await G((0,Ea.kb)(k,(0,gc.mn)((0,$n.qD)(z)))),await G(mc(z)),await G((0,Va.kl)(z))},mc=(z,G={calculateInterval:wd.calculateInterval,getTimeSrv:Do.jG,templateSrv:(0,jv.w)()})=>(k,re)=>{const ue=(0,ha.dn)(z,re());if(ue.type==="interval"&&ue.auto){const ve=G.calculateInterval(G.getTimeSrv().timeRange(),ue.auto_count,ue.auto_min);G.templateSrv.setGrafanaVariable("$__auto_interval_"+ue.name,ve.interval),G.templateSrv.setGrafanaVariable("$__auto_interval",ve.interval)}},Uv=()=>({id:"interval",description:"Define a timespan interval (ex 1m, 1h, 1d)",name:"Interval",initialState:gc.Ez,reducer:gc.E5,picker:Pl(),editor:du,dependsOn:()=>!1,setValue:async(z,G,k=!1)=>{await(0,Oa.JD)(mc((0,$n.jX)(z))),await(0,Oa.JD)((0,Va.t9)((0,$n.jX)(z),G,k))},setValueFromUrl:async(z,G)=>{await(0,Oa.JD)(mc((0,$n.jX)(z))),await(0,Oa.JD)((0,Va.x7)((0,$n.jX)(z),G))},updateOptions:async z=>{await(0,Oa.JD)(Bv((0,$n.jX)(z)))},getSaveModel:z=>{const{index:G,id:k,state:re,global:ue,rootStateKey:ve,...be}=(0,H.cloneDeep)(z);return be},getValueForUrl:z=>z.current.value});var Nv=e(6841),Wv=e(64423),Fv=e(38681);function Kv(z,G,k){return{next:ue=>{if(ue.state===Ma.Gu.Error){k.unsubscribe(),G(ue.error);return}if(ue.state===Ma.Gu.Done){k.unsubscribe(),z();return}},error:ue=>{k.unsubscribe(),G(ue)},complete:()=>{k.unsubscribe(),z()}}}const wv=(z,G)=>async(k,re)=>{try{const{rootStateKey:ue}=z;if(!(0,$n.sN)(ue,re()))return;const ve=(0,ha.dn)(z,re());if(ve.type!=="query")return;(0,ha.nx)(ue,re()).editor.id===ve.id&&k((0,Ea.kb)(ue,(0,Pr.Eo)({errorProp:"update"})));const be=await(0,S.l)().get(ve.datasource??"");await new Promise((Ue,We)=>{const Ze=new Wv.yU,at=Kv(Ue,We,Ze),ct=hc().getResponse(z).subscribe(at);Ze.add(ct),hc().queueRequest({identifier:z,datasource:be,searchFilter:G})})}catch(ue){if(ue instanceof Error){const ve=(0,oc.u)(ue),{rootStateKey:be}=z;throw(0,ha.nx)(be,re()).editor.id===z.id&&k((0,Ea.kb)(be,(0,Pr.NY)({errorProp:"update",errorText:ve.message??""}))),ve}}},Vv=z=>async(G,k)=>{const re=(0,ha.dn)(z,k());re.type==="query"&&await G(uu((0,$n.jX)(re),re.datasource))},uu=(z,G)=>async(k,re)=>{try{const{rootStateKey:ue}=z,{editor:ve}=(0,ha.nx)(ue,re()),Ue=cc(ve)?.dataSource,We=await(0,S.l)().get(G??"");Ue&&Ue.type!==We?.type&&k((0,Ea.kb)(ue,(0,Vr.QP)((0,$n.qD)(z,{propName:"query",propValue:""}))));const Ze=await(0,Fv.y)(We);k((0,Ea.kb)(ue,(0,Pr.BC)({dataSource:We,VariableQueryEditor:Ze})))}catch(ue){console.error(ue)}},$v=(z,G,k)=>async(re,ue)=>{const{rootStateKey:ve}=z,be=(0,ha.dn)(z,ue());if(be.type==="query"){if(zv(be.name,G)){const Ue="Query cannot contain a reference to itself. Variable: $"+be.name;re((0,Ea.kb)(ve,(0,Pr.NY)({errorProp:"query",errorText:Ue})));return}re((0,Ea.kb)(ve,(0,Pr.Eo)({errorProp:"query"}
1559))),re((0,Ea.kb)(ve,(0,Vr.QP)((0,$n.qD)(z,{propName:"query",propValue:G})))),k!==void 0?re((0,Ea.kb)(ve,(0,Vr.QP)((0,$n.qD)(z,{propName:"definition",propValue:k})))):typeof G=="string"&&re((0,Ea.kb)(ve,(0,Vr.QP)((0,$n.qD)(z,{propName:"definition",propValue:G})))),await re((0,Va.mZ)(z))}};function zv(z,G){if(typeof G=="string"&&G.match(new RegExp("\\$"+z+"(/| |$)")))return!0;const k=hu(G);for(let re in k)if(k.hasOwnProperty(re)){const ue=k[re];if(typeof ue=="string"&&ue.match(new RegExp("\\$"+z+"(/| |$)")))return!0}return!1}function hu(z){return typeof z!="object"||z===null?{query:z}:Object.keys(z).reduce((re,ue)=>{const ve=z[ue];if(typeof ve!="object"||ve===null)return re[ue]=ve,re;const be=hu(ve);for(let Ue in be)be.hasOwnProperty(Ue)&&(re[`${ue}_${Ue}`]=be[Ue]);return re},{})}const Hv=(z,G)=>{const{rootStateKey:k}=G.variable;if(!k)return console.error("QueryVariableEditor: variable has no rootStateKey"),{extended:cc(Pr.nS)};const{editor:re}=(0,ha.nx)(k,z);return{extended:cc(re)}},Gv={initQueryVariableEditor:Vv,changeQueryVariableDataSource:uu,changeQueryVariableQuery:$v,changeVariableMultiValue:Va.TI},_v=(0,gs.connect)(Hv,Gv);class Qv extends a.PureComponent{constructor(){super(...arguments),this.state={regex:null,tagsQuery:null,tagValuesQuery:null},this.onDataSourceChange=G=>{this.props.onPropChange({propName:"datasource",propValue:G.isDefault?null:(0,$d.p$)(G)})},this.onLegacyQueryChange=async(G,k)=>{this.props.variable.query!==G&&this.props.changeQueryVariableQuery((0,$n.jX)(this.props.variable),G,k)},this.onQueryChange=async G=>{if(this.props.variable.query!==G){let k="";G&&G.hasOwnProperty("query")&&typeof G.query=="string"&&(k=G.query),this.props.changeQueryVariableQuery((0,$n.jX)(this.props.variable),G,k)}},this.onRegExBlur=async G=>{const k=G.currentTarget.value;this.props.variable.regex!==k&&this.props.onPropChange({propName:"regex",propValue:k,updateOptions:!0})},this.onRefreshChange=G=>{this.props.onPropChange({propName:"refresh",propValue:G})},this.onSortChange=async G=>{this.props.onPropChange({propName:"sort",propValue:G.value,updateOptions:!0})},this.onMultiChange=G=>{this.props.onPropChange({propName:"multi",propValue:G.currentTarget.checked})},this.onIncludeAllChange=G=>{this.props.onPropChange({propName:"includeAll",propValue:G.currentTarget.checked})},this.onAllValueChange=G=>{this.props.onPropChange({propName:"allValue",propValue:G.currentTarget.value})}}async componentDidMount(){await this.props.initQueryVariableEditor((0,$n.jX)(this.props.variable))}componentDidUpdate(G){G.variable.datasource!==this.props.variable.datasource&&this.props.changeQueryVariableDataSource((0,$n.jX)(this.props.variable),this.props.variable.datasource)}render(){const{extended:G,variable:k}=this.props;if(!G||!G.dataSource)return null;const re=(0,Do.jG)().timeRange();return(0,M.jsx)(Nv.u,{datasource:k.datasource??void 0,onDataSourceChange:this.onDataSourceChange,query:k.query,onQueryChange:this.onQueryChange,onLegacyQueryChange:this.onLegacyQueryChange,timeRange:re,regex:k.regex,onRegExChange:this.onRegExBlur,sort:k.sort,onSortChange:this.onSortChange,refresh:k.refresh,onRefreshChange:this.onRefreshChange,isMulti:k.multi,includeAll:k.includeAll,allValue:k.allValue??"",onMultiChange:this.onMultiChange,onIncludeAllChange:this.onIncludeAllChange,onAllValueChange:this.onAllValueChange})}}const kv=_v(Qv),Yv=()=>({id:"query",description:"Variable values are fetched from a datasource query",name:"Query",initialState:g0,reducer:x0,picker:Pl(),editor:kv,dependsOn:(z,G)=>(0,$n.wJ)(z.query,z.datasource?.uid,z.regex,G.name),setValue:async(z,G,k=!1)=>{await(0,Oa.JD)((0,Va.t9)((0,$n.jX)(z),G,k))},setValueFromUrl:async(z,G)=>{await(0,Oa.JD)((0,Va.x7)((0,$n.jX)(z),G))},updateOptions:async(z,G)=>{await(0,Oa.JD)(wv((0,$n.jX)(z),G))},getSaveModel:z=>{const{index:G,id:k,state:re,global:ue,queryValue:ve,rootStateKey:be,...Ue}=(0,H.cloneDeep)(z);return z.refresh!==Mo.CO.never?{...Ue,options:[]}:Ue},getValueForUrl:z=>(0,$n.ML)(z)?ns.Zm:z.current.value}),Jv=()=>({id:"system",description:"",name:"system",initialState:{...fi.Vg,type:"system",hide:Mo.zL.hideVariable,skipUrlSync:!0,current:{value:{toString:()=>""}},state:Ma.Gu.Done},reducer:z=>z,picker:null,editor:null,dependsOn:()=>!1,setValue:async(z,G,k=!1)=>{},setValueFromUrl:async(z,G)=>{},updateOptions:async z=>{},getSaveModel:z=>({}),getValueForUrl:z=>""});var Xv=e(32442),Zv=e(49602);function qv({onPropChange:z,variable:{query:G}}){const k=(0,a.useCallback)((ve,be)=>{ve.preventDefault(),z({propName:"originalQuery",propValue:ve.currentTarget.value,updateOptions:!1}),z({propName:"query",propValue:ve.currentTarget.value,updateOptions:be})},[z]),re=(0,a.useCallback)(ve=>k(ve,!1),[k]),ue=(0,a.useCallback)(ve=>k(ve,!0),[k]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Xv.Y,{children:(0,M.jsx)(ae.x6,{i18nKey:"variables.text-box-variable-editor.text-options",children:"Text options"})}),(0,M.jsx)(Zv._,{value:G,name:"Default value",placeholder:(0,ae.t)("variables.text-box-variable-editor.placeholder-default-value-if-any","default value, if any"),onChange:re,onBlur:ue,width:30,testId:xa.Tp.pages.Dashboard.Settings.V
1559ariables.Edit.TextBoxVariable.textBoxOptionsQueryInputV2})]})}function ey({variable:z,onVariableChange:G,readOnly:k}){const re=(0,hn.useDispatch)(),[ue,ve]=(0,a.useState)(z.current.value);(0,a.useEffect)(()=>{ve(z.current.value)},[z]);const be=(0,a.useCallback)(()=>{if(!z.rootStateKey){console.error("Cannot update variable without rootStateKey");return}if(z.current.value!==ue){if(re((0,Ea.kb)(z.rootStateKey,(0,Vr.QP)((0,$n.qD)({id:z.id,type:z.type},{propName:"query",propValue:ue})))),G){G({...z,current:(0,ou.R)(z.current)?{}:{...z.current,value:ue}});return}vl.B.get(z.type).updateOptions(z)}},[z,ue,re,G]),Ue=(0,a.useCallback)(at=>ve(at.target.value),[ve]),We=at=>be(),Ze=at=>{at.keyCode===13&&(at.preventDefault(),be())};return(0,M.jsx)($t.p,{type:"text",value:ue,onChange:Ue,onBlur:We,disabled:k,onKeyDown:Ze,placeholder:(0,ae.t)("variable.textbox.placeholder","Enter variable value"),id:ns.qz+z.id})}const ty={...fi.Vg,type:"textbox",query:"",current:{},options:[],originalQuery:null},fu=(0,Dr.Z0)({name:"templating/textbox",initialState:xl.j,reducers:{createTextBoxOptions:(z,G)=>{const k=(0,ha.Fs)(z,G.payload.id);if(k.type!=="textbox")return;const re={text:k.query.trim(),value:k.query.trim(),selected:!1};k.options=[re],k.current=re}}}),ny=fu.reducer,{createTextBoxOptions:ay}=fu.actions,sy=z=>async(G,k)=>{const{rootStateKey:re,type:ue}=z;G((0,Ea.kb)(re,ay((0,$n.qD)(z))));const ve=(0,ha.dn)(z,k());ve.type==="textbox"&&await vl.B.get(ue).setValue(ve,ve.options[0],!0)},ry=(z,G)=>async(k,re)=>{const{rootStateKey:ue}=z,ve=(0,ha.dn)(z,re());if(ve.type!=="textbox")return;const be=(0,$n.QT)(G);k((0,Ea.kb)(ue,(0,Vr.QP)((0,$n.qD)(ve,{propName:"query",propValue:be})))),await k((0,Va.x7)((0,$n.jX)(ve),be))},oy=()=>({id:"textbox",description:"Define a textbox variable, where users can enter any arbitrary string",name:"Text box",initialState:ty,reducer:ny,picker:ey,editor:qv,dependsOn:(z,G)=>!1,setValue:async(z,G,k=!1)=>{await(0,Oa.JD)((0,Va.t9)((0,$n.jX)(z),G,k))},setValueFromUrl:async(z,G)=>{await(0,Oa.JD)(ry((0,$n.jX)(z),G))},updateOptions:async z=>{await(0,Oa.JD)(sy((0,$n.jX)(z)))},getSaveModel:(z,G)=>{const{index:k,id:re,state:ue,global:ve,originalQuery:be,rootStateKey:Ue,...We}=(0,H.cloneDeep)(z);if(z.query!==be&&!G){const Ze=be??"",at={selected:!1,text:Ze,value:Ze};return{...We,query:Ze,current:at,options:[at]}}return We},getValueForUrl:z=>z.current.value,beforeAdding:z=>({...(0,H.cloneDeep)(z),originalQuery:z.query})});var iy=e(10378),vc=e(15203),yc=e(62905),xc=e(2495),pu=e(75816),gu=e(73892);const ly=(0,Yl.T)("advisor.grafana.app","v0alpha1"),cy=(0,pu.xP)({reducerPath:"advisorAPI",baseQuery:(0,gu.W)({baseURL:ly}),endpoints:()=>({})}),dy=["Check","CheckType"],Vl=cy.enhanceEndpoints({addTagTypes:dy}).injectEndpoints({endpoints:z=>({listCheck:z.query({query:G=>({url:"/checks",params:{pretty:G.pretty,allowWatchBookmarks:G.allowWatchBookmarks,continue:G.continue,fieldSelector:G.fieldSelector,labelSelector:G.labelSelector,limit:G.limit,resourceVersion:G.resourceVersion,resourceVersionMatch:G.resourceVersionMatch,sendInitialEvents:G.sendInitialEvents,timeoutSeconds:G.timeoutSeconds,watch:G.watch}}),providesTags:["Check"]}),createCheck:z.mutation({query:G=>({url:"/checks",method:"POST",body:G.check,params:{pretty:G.pretty,dryRun:G.dryRun,fieldManager:G.fieldManager,fieldValidation:G.fieldValidation}}),invalidatesTags:["Check"]}),getCheck:z.query({query:G=>({url:`/checks/${G.name}`,params:{pretty:G.pretty}}),providesTags:["Check"]}),deleteCheck:z.mutation({query:G=>({url:`/checks/${G.name}`,method:"DELETE",params:{pretty:G.pretty,dryRun:G.dryRun,gracePeriodSeconds:G.gracePeriodSeconds,ignoreStoreReadErrorWithClusterBreakingPotential:G.ignoreStoreReadErrorWithClusterBreakingPotential,orphanDependents:G.orphanDependents,propagationPolicy:G.propagationPolicy}}),invalidatesTags:["Check"]}),updateCheck:z.mutation({query:G=>({url:`/checks/${G.name}`,method:"PATCH",body:G.patch,params:{pretty:G.pretty,dryRun:G.dryRun,fieldManager:G.fieldManager,fieldValidation:G.fieldValidation,force:G.force}}),invalidatesTags:["Check"]}),listCheckType:z.query({query:G=>({url:"/checktypes",params:{pretty:G.pretty,allowWatchBookmarks:G.allowWatchBookmarks,continue:G.continue,fieldSelector:G.fieldSelector,labelSelector:G.labelSelector,limit:G.limit,resourceVersion:G.resourceVersion,resourceVersionMatch:G.resourceVersionMatch,sendInitialEvents:G.sendInitialEvents,timeoutSeconds:G.timeoutSeconds,watch:G.watch}}),providesTags:["CheckType"]})}),overrideExisting:!1}),{useGetCheckQuery:cx,useCreateCheckMutation:dx,useDeleteCheckMutation:ux,useUpd
1559ateCheckMutation:hx}=Vl;var Ec=e(143);const uy=(0,Yl.T)("iam.grafana.app","v0alpha1"),hy=(0,pu.xP)({baseQuery:(0,gu.W)({baseURL:uy}),reducerPath:"iamAPI",endpoints:()=>({})}),fy=["Display"],mu=hy.enhanceEndpoints({addTagTypes:fy}).injectEndpoints({endpoints:z=>({getDisplayMapping:z.query({query:G=>({url:"/display",params:{key:G.key}}),providesTags:["Display"]})}),overrideExisting:!1}),Pc=mu.enhanceEndpoints({}),{useGetDisplayMappingQuery:fx}=mu;var Dc=e(19164);const py={navBarTree:ad.I_,navIndex:sc._h,appNotifications:bd.g5};var gy=e(52695),So=e(36200),To=e(11018);const my=(0,uc.combineReducers)({promRules:(0,So.Xw)("promRules",To.mB,({rulesSourceName:z})=>z).reducer,rulerRules:(0,So.Xw)("rulerRules",To.eB,({rulesSourceName:z})=>z).reducer,saveAMConfig:(0,So.J7)("saveAMConfig",To.RW).reducer,deleteAMConfig:(0,So.J7)("deleteAMConfig",To.nO).reducer,amAlertGroups:(0,So.Xw)("amAlertGroups",To.D3,z=>z).reducer,testReceivers:(0,So.J7)("testReceivers",To.bO).reducer,managedAlertStateHistory:(0,So.J7)("managedAlertStateHistory",To.JH).reducer});var vy=e(2954);const yy={items:[],searchQuery:"",isLoading:!1},xy={notificationChannelTypes:[],notificationChannel:{},notifiers:[]};function Ey(z,G){const k=vy.A.getStateDisplayModel(G),re={...z,stateText:k.text,stateIcon:k.iconClass,stateClass:k.stateClass,stateAge:(0,f.KQ)(z.newStateDate).fromNow(!0)};
1559return re.state!=="paused"&&(re.executionError&&(re.info="Execution Error: "+re.executionError),re.evalData&&re.evalData.noData&&(re.info="Query returned no data")),re}const vu=(0,Dr.Z0)({name:"alertRules",initialState:yy,reducers:{loadAlertRules:z=>({...z,isLoading:!0}),loadedAlertRules:(z,G)=>{const re=G.payload.map(ue=>Ey(ue,ue.state));return{...z,items:re,isLoading:!1}},setSearchQuery:(z,G)=>({...z,searchQuery:G.payload})}}),yu=(0,Dr.Z0)({name:"notificationChannel",initialState:xy,reducers:{setNotificationChannels:(z,G)=>({...z,notificationChannelTypes:My(G.payload),notifiers:G.payload}),notificationChannelLoaded:(z,G)=>{const k=G.payload,ue=z.notifiers.find(ve=>ve.type===k.type).options.filter(ve=>ve.secure);return ue.length>0&&ue.some(ve=>k.settings[ve.propertyName]!=="")?Cy(z,G.payload,ue):{...z,notificationChannel:k}},resetSecureField:(z,G)=>({...z,notificationChannel:{...z.notificationChannel,secureFields:{...z.notificationChannel.secureFields,[G.payload]:!1}}})}}),{loadAlertRules:gx,loadedAlertRules:mx,setSearchQuery:vx}=vu.actions,{setNotificationChannels:yx,notificationChannelLoaded:xx,resetSecureField:Ex}=yu.actions,Py=vu.reducer,Dy=yu.reducer,by={alertRules:Py,notificationChannel:Dy,unifiedAlerting:my};function Cy(z,G,k){const re={},ue={};return k.forEach(ve=>{ue[ve.propertyName]=G.settings[ve.propertyName],re[ve.propertyName]=""}),{...z,notificationChannel:{...G,settings:{...G.settings,...re},secureSettings:{...ue}}}}function My(z){return z.map(G=>({value:G.type,label:G.name,...G,typeName:G.type})).sort((G,k)=>G.name>k.name?1:-1)}var Sy=e(78653),Ty=e(21875),Oy=e(87186),Iy=e(42795),Ry=e(37918),Ay=e(18548),Ly=e(35231),jy=e(17621),By=e(38748),Uy=e(2559),Ny=e(74396),Wy=e(89224),Fy=e(54687),Ky=e(69289),wy=e(91259),Vy=e(69807),$y=e(27104),zy=e(1302),Hy=e(20018);const Gy={...py,...by,...$y.Ay,...Sy.Ay,...jy.Ay,...Ry.Ay,...Ly.Ay,...Ay.Ay,...zy.Ay,...wy.Ay,...Ky.Ay,...By.Ay,...Ny.Ay,...Oy.Ay,...gy.Ay,...Uy.Ay,...Iy.Ay,...Wy.Ay,...Ea.Ay,...Vy.Ay,...Ty.Ay,plugins:Fy.Ff,[ga.H.reducerPath]:ga.H.reducer,[yc.Sm.reducerPath]:yc.Sm.reducer,[vc.cU.reducerPath]:vc.cU.reducer,[xc.O5.reducerPath]:xc.O5.reducer,[Pc.reducerPath]:Pc.reducer,[Ol.Aj.reducerPath]:Ol.Aj.reducer,[Dc.Ko.reducerPath]:Dc.Ko.reducer,[Ec.b.reducerPath]:Ec.b.reducer,[Vl.reducerPath]:Vl.reducer},xu={},Px=z=>{Object.assign(xu,z)},_y=()=>{const z=(0,uc.combineReducers)({...Gy,...xu});return(G,k)=>{if(k.type!==Hy.N.type)return z(G,k);const{cleanupAction:re}=k.payload;return re(G),z(G,k)}};function Dx(z){addReducer(z)}const Qy=(0,Dr.Nc)(),Eu=[];function bx(z){Eu.push(z)}function ky(z){const G=(0,Dr.U1)({reducer:_y(),middleware:k=>k({thunk:!0,serializableCheck:!1,immutableCheck:!1}).concat(Qy.middleware,ga.H.middleware,yc.Sm.middleware,vc.cU.middleware,xc.O5.middleware,Ol.Aj.middleware,Pc.middleware,Dc.Ko.middleware,Ec.b.middleware,Vl.middleware,...Eu),devTools:!1,preloadedState:{navIndex:(0,sc.s2)(),...z}});return(0,iy.$k)(G.dispatch),(0,Oa.k3)(G),G}const Pu=e(39572),$l=Pu.keys().map(z=>Pu(z));class Yy{async init(){try{parent.postMessage("GrafanaAppInit","*");const G=(0,ae.JL)(U.Ay.bootData.user.language);G.then(({language:Ze})=>(0,U._R)({language:Ze})),(0,p.u5)(Ld.IB),await Zy(),(0,Bd.j)("frontend_app_init"),(0,f.xS)(U.Ay.locale),(0,f.$D)(U.Ay.bootData.user.weekStart),(0,W.Y)(vm.m),(0,N.l)(Mg),(0,c.N)(bg),(0,w.e)(mm.a),(0,y.T)(P.Ny),(0,d.l)(new Fg),(0,D.p)(qg),(0,h.G)(()=>U.Ay.bootData.user.timezone),gm(),(0,b.l)(ta.TP.user),(0,Zg.initAuthConfig)(),(0,E.H8)(wa.A),await G,Jy(),ky(),Xy(),Xg(),u.D.setInit(Td.H),u.G.setInit(Td.u),i.h.setInit(Zi),vl.B.setInit(()=>[Yv(),gv(),oy(),sv(),Rv(),Uv(),i0(),Jv()]),x.l.setInit(qi.A),(0,Bg.f)(),(0,v.HC)(()=>new Lm),B0(new j0),(0,v.pC)(lc.BN),(0,C.se)({importPanelPlugin:Kd.TV,getPanelPluginFromCac
1559he:Kd.PY}),U.Ay.featureToggles.useSessionStorageForRedirection&&qy(),g.I.initialize({config:U.Ay,getTimeRangeForUrl:(0,Do.jG)().timeRangeForUrl,getVariablesUrlParams:Av.z}),document.addEventListener("click",Ug);const k=new hi.xq;k.init(U.Ay.datasources,U.Ay.defaultDatasource),(0,S.h)(k),Bm();const re=U.Ay.featureToggles.rendererDisableAppPluginsPreload&&ta.TP.user.authenticatedBy==="render";if(ta.TP.user.orgRole!==""&&!re){const Ze=(0,Qa.Xs)(),at=(0,Qa.mi)();ic(at),await ic(Ze)}(0,O.q)(Om),(0,I.A)(Cm),(0,R.R)(Mm),(0,T.U)(Tm),(0,j.C)(Wd.m5),(0,V.h)(Wd.zN);const ue=P.Ny.getSearchObject(),ve=new Gf,be=new kg(P.Ny,ve),Ue=new wg;Ue.start(),ve.setKioskModeFromUrl(ue.kiosk);try{(0,Um.W1)()}catch(Ze){console.warn("Failed to clean up old expanded folders",Ze)}this.context={backend:Ld.IB,location:P.Ny,chrome:ve,keybindings:be,newAssetsChecker:Ue,config:U.Ay},(0,L._)(nr.ni),(0,K._)(pl.k9),U.Ay.featureToggles.crashDetection&&jg(),(0,l.H)(document.getElementById("reactRoot")).render((0,a.createElement)(Eg,{app:this}))}catch(G){console.error("Failed to start Grafana",G),window.__grafana_load_failed()}finally{(0,Bd.z)("frontend_app_init")}}}function Jy(){$l.length>0&&$l[0].addExtensionReducers()}function Xy(){$l.length>0&&$l[0].init()}async function Zy(){if((0,A.H2)(new Vg({debug:!1})),window.addEventListener("load",z=>{const G="frontend_boot_load_time_seconds";performance&&(performance.mark(G),Dl("first-paint","frontend_boot_","_time_seconds"),Dl("first-contentful-paint","frontend_boot_","_time_seconds"),Dl(G),Dl("frontend_boot_js_done_time_seconds"),Dl("frontend_boot_css_time_seconds"))}),ta.TP.user.orgRole!==""){const{PerformanceBackend:z}=await e.e(4857).then(e.bind(e,4857));(0,A.pl)(new z({}))}if(U.Ay.grafanaJavascriptAgent.enabled){const z=[U.Ay.rudderstackConfigUrl,U.Ay.rudderstackDataPlaneUrl,U.Ay.rudderstackIntegrationsUrl].filter(Boolean).map(k=>new RegExp(`${k}.*.`)),{GrafanaJavascriptAgentBackend:G}=await e.e(4579).then(e.bind(e,14579));(0,A.pl)(new G({...U.Ay.grafanaJavascriptAgent,app:{version:U.Ay.buildInfo.version,environment:U.Ay.buildInfo.env},buildInfo:U.Ay.buildInfo,user:{id:String(U.Ay.bootData.user?.id),email:U.Ay.bootData.user?.email},ignoreUrls:z}))}if(U.Ay.googleAnalyticsId){const{GAEchoBackend:z}=await e.e(9820).then(e.bind(e,59820));(0,A.pl)(new z({googleAnalyticsId:U.Ay.googleAnalyticsId}))}if(U.Ay.googleAnalytics4Id){const{GA4EchoBackend:z}=await e.e(7018).then(e.bind(e,47018));(0,A.pl)(new z({googleAnalyticsId:U.Ay.googleAnalytics4Id,googleAnalytics4SendManualPageViews:U.Ay.googleAnalytics4SendManualPageViews}))}if(U.Ay.rudderstackWriteKey&&U.Ay.rudderstackDataPlaneUrl){const{RudderstackBackend:z}=await e.e(4564).then(e.bind(e,34564));(0,A.pl)(new z({writeKey:U.Ay.rudderstackWriteKey,dataPlaneUrl:U.Ay.rudderstackDataPlaneUrl,user:U.Ay.bootData.user,sdkUrl:U.Ay.rudderstackSdkUrl,configUrl:U.Ay.rudderstackConfigUrl,integrationsUrl:U.Ay.rudderstackIntegrationsUrl,buildInfo:U.Ay.buildInfo}))}if(U.Ay.applicationInsightsConnectionString){const{ApplicationInsightsBackend:z}=await e.e(2699).then(e.bind(e,2699));(0,A.pl)(new z({connectionString:U.Ay.applicationInsightsConnectionString,endpointUrl:U.Ay.applicationInsightsEndpointUrl}))}if(U.Ay.analyticsConsoleReporting){const{BrowserConsoleBackend:z}=await e.e(5747).then(e.bind(e,75747));(0,A.pl)(new z)}}function Dl(z,G="",k=""){const re=performance.getEntriesByName(z).at(0);if(re){const ue=re.name.replace(/-/g,"_");(0,$g.n)(`${G}${ue}${k}`,Math.round(re.startTime)/1e3)}}function qy(){const z=P.Ny.getSearch(),G="redirectTo";if(z.has("auth_token")){window.sessionStorage.removeItem(ta.OG);return}if(z.has(G)&&window.location.pathname!=="/"){const ue=z.get(G);window.sessionStorage.setItem(ta.OG,encodeURIComponent(ue)),z.delete(G),window.history.replaceState({},"",`${window.location.pathname}${z.size>0?`?${z}`:""}`);return}if(!ta.TP.user.isSignedIn)return;const k=window.sessionStorage.getItem(ta.OG);if(!k)return;window.sessionStorage.removeItem(ta.OG);const re=decodeURIComponent(k);re.startsWith("/goto/")?window.location.replace(re):P.Ny.replace(re)}const ex=new Yy;window.public_cdn_path&&(e.p=window.public_cdn_path),window.__grafana_public_path__=e.p.substring(0,e.p.lastIndexOf("build/"))||e.p,window.nonce&&(e.nc=window.nonce),window.__grafana_app_bundle_loaded=!0,(async()=>Promise.resolve())().then(()=>{ex.init()})},84266:(ee,B,e)=>{"use strict";e.d(B,{Or:()=>r,Oz:()=>m,RC:()=>n,ho:()=>o,nA:()=>s,uz:()=>t});const t=Symbol("routes_metadata");var n=(a=>(a.Active="active",a.Expired="expired",a.Pending="pending",a))(n||{}),r=(a=>(a.Unprocessed="unprocessed",a.Active="active",a.Suppressed="suppressed",a))(r||{}),o=(a=>(a.equal="=",a.notEqual="!=",a.regex="=~",a.notRegex="!~",a))(o||{}),s=(a=>(a.Internal="internal",a.External="external",a.All="all",a))(s||{}),m=(a=>(a.cortex="cortex",a.mimir="mimir",a.prometheus="prometheus",a))(m||{})},38242:(ee,B,e)=>{"use strict";e.d(B,{Dw:()=>m,Rx:()=>r,_M:()=>a,_W:()=>s,d$:()=>n});const t={statistics:[]};var n=(f=>(f[f.Insights=1]="Insights",f[f.Search=0]="Search",f))(n||{}),r=(f=>(f[f.Builder=0]="Builder",f[f.Code=1]="Code",f))(r||{});const o={parameters:[]};var s=(f=>(f.And="and",f.Function="function",f.FunctionParameter="functionParameter",f.GroupBy="groupBy",f.Operator="operator",f.Or="or",f.Property="property",f))(s||{}),m=(f=>(f.String="string",f))(m||{}),a=(f=>(f.CWLI="CWLI",f.PPL="PPL",f.SQL="SQL",f))(a||{});const l={logGroupNames:[],logGroups:[],statsGroups:[]}},51515:(ee,B,e)=>{"use strict";e.d(B,{Rx:()=>t.Rx,YZ:()=>n,_M:()=>t._M,b4:()=>r,d$:()=>t.d$});var t=e(38242),n=(o=>(o.Scheduled="Scheduled",o.Running="Running",o.Complete="Complete",o.Failed="Failed",o.Cancelled="Cancelled",o.Timeout="Timeout",o))(n||{}),r=(o=>(o.Regions="regions",o.Namespaces="namespaces",o.Metrics="metrics",o.DimensionKeys="dimensionKeys",o.DimensionValues="dimensionValues",o.EBSVolumeIDs="ebsVolumeIDs",o.EC2InstanceAttributes="ec2InstanceAttributes",o.ResourceArns="resourceARNs",o.Statistics="statistics",o.LogGroups="logGroups",o.Accounts="accounts",o))(r||{})},9931:(ee,B,e)=>{"use strict";e.d(B,{K:()=>t});const t="-- Dashboard --",n="dashboard"},73601:(ee,B,e)=>{"use strict";e.d(B,{k:()=>l,m:()=>f});var t=e(88483),n=e(739),r=e(28105),o=e(22592),s=e(22429),m=e(82612),a=e(9931);function l(i){return i?typeof i=="string"?i===a.K:"meta"in i&&i.meta.name===a.K||i.uid===a.K:!1}function f(i,x){return new t.c(g=>{const p=(0,s.UA)().getCurrent(),c=h(i.queries);if(!c){g.next(u("Missing panel reference ID"));return}let y=p?.getPanelById(c,!0);if(y instanceof m.a9||(y=new m.a9(y)),!y){g.next(u("Unknown Panel: "+c));return}const P=y.getQueryRunner(),d=P.getData({withTransforms:!!x?.withTransforms,withFieldConfig:!1}).subscribe({next:D=>{x?.topic===n.QR.Annotations&&(D={...D,series:D.annotations??[],annotations:void 0}),g.next(D)}});if(!y.isInView&&y.refreshWhenInView||p?.otherPanelInFullscreen(y)){const{datasource:D,targets:b}=y,E={...i,datasource:D,panelId:c,queries:b};y.refreshWhenInView=!1,P.run(E)}return()=>{d.unsubscribe()}})}function h(i){if(!(!i||!i.length))return i[0].panelId}function u(i){return{state:r.Gu.Error,series:[],request:{},error:{message:i},timeRange:(0,o.E2)()}}},16310:(ee,B,e)=>{"use strict";e.d(B,{i:()=>Te,o:()=>Ne});var t=e(2543),n=e(65474),r=e(62467),o=e(44240),s=e(81160),m=e(77154),a=e(28105),l=e(38619),f=e(18700),h=e(88673),u=e(41119),i=e(36580),x=e(2863),g=e(33184),p=e(68143),c=e(78282),y=e(65635),P=e(22429),d=e(74848),D=e(22803),b=e(96540),E=e(63142),v=e(16780),C=e(37386),S=e(18857),O=e(21285),I=e(93732),R=e(78767),T=e(8095),L=e(95093),K=e.n(L),A=e(62717),W=e(25229),N=e(59310),w=e(45861),j=e(41654),V=e(11527),U=e(63527),F=e(27228),M=e(44229),H=e(56840);
1559const _=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"].map((Ce,He)=>({label:Ce,value:He+1})),Z=({value:Ce,onChange:He})=>{const ke=(0,E.of)(ne),Me=Date.now(),$e=(0,A.QZ)(Ce.timezone??"utc",Me),tt=(0,P.UA)().getCurrent()?.getTimezone()===Ce.timezone,[Ke,Re]=(0,b.useState)(!1),Ve=()=>{Re(!Ke)},Qe=Be=>{if(!Be)return;const Xe=K()();if(Be){const st=Be.split(":");Xe.set("hour",parseInt(st[0],10)),Xe.set("minute",parseInt(st[1],10))}return Xe},je=()=>{let Be="Everyday";return Ce.fromDayOfWeek&&!Ce.toDayOfWeek&&(Be=_[Ce.fromDayOfWeek-1].label),Be},ze=()=>{const Be=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(F.U,{title:$e?.name}),(0,d.jsx)(M.X,{timeZone:Ce.timezone,timestamp:Me})]});return tt?(0,d.jsxs)(d.Fragment,{children:["Dashboard timezone (",Be,")"]}):Be},Ye=(Be,Xe)=>{const st=Be?Be.format("HH:mm"):void 0;He(Xe==="from"?{...Ce,from:st}:{...Ce,to:st})},Ge=Be=>{He({...Ce,timezone:Be})},ce=Be=>{He({...Ce,mode:Be})},Pe=Be=>{He({...Ce,cronExpr:Be})},Se=Be=>{He({...Ce,duration:Be})},Ee=Be=>{const Xe=Be?Be.value:void 0,st=Be?Ce.toDayOfWeek:void 0;He({...Ce,fromDayOfWeek:Xe,toDayOfWeek:st})},xe=Be=>{He({...Ce,toDayOfWeek:Be?Be.value:void 0})},ye=()=>Ke?(0,d.jsx)(N.U,{value:Ce.timezone,includeInternal:!0,onChange:Be=>Ge(Be),onBlur:()=>Re(!1),openMenuOnFocus:!1,width:100,autoFocus:!0}):(0,d.jsxs)("div",{className:ke.timezoneContainer,children:[(0,d.jsx)("div",{className:ke.timezone,children:ze()}),(0,d.jsx)(w.$n,{variant:"secondary",onClick:Ve,size:"sm",children:"Change timezone"})]}),Oe=Qe(Ce.from),we=Qe(Ce.to);return(0,d.jsxs)(v.n,{className:ke.wrapper,children:[(0,d.jsx)(C.D,{label:(0,H.t)("dashboard-settings.time-regions.advanced-label","Advanced"),description:(0,d.jsxs)(d.Fragment,{children:[(0,H.t)("dashboard-settings.time-regions.advanced-description-use","Use "),(0,d.jsx)("a",{href:"https://crontab.run/",target:"_blank",children:(0,H.t)("dashboard-settings.time-regions.advanced-description-cron","Cron syntax")}),(0,H.t)("dashboard-settings.time-regions.advanced-description-rest"," to define a recurrence schedule and duration")]}),children:(0,d.jsx)(O.d,{id:"time-regions-adanced-mode-toggle",value:Ce.mode==="cron",onChange:Be=>ce(Be.currentTarget.checked?"cron":null)})}),Ce.mode==null&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(C.D,{label:"From",children:(0,d.jsxs)(j.B,{gap:.5,children:[(0,d.jsx)(S.l6,{options:_,isClearable:!0,placeholder:"Everyday",value:Ce.fromDayOfWeek??null,onChange:Be=>Ee(Be),width:20}),(0,d.jsx)(V.R,{value:(0,W.Ar)(Oe)?Oe:void 0,onChange:Be=>Ye(Be&&(0,W.AN)(Be),"from"),allowEmpty:!0,placeholder:"HH:mm",size:"sm"})]})}),(0,d.jsx)(C.D,{label:"To",children:(0,d.jsxs)(j.B,{gap:.5,children:[(Ce.fromDayOfWeek||Ce.toDayOfWeek)&&(0,d.jsx)(S.l6,{options:_,isClearable:!0,placeholder:je(),value:Ce.toDayOfWeek??null,onChange:Be=>xe(Be),width:20}),(0,d.jsx)(V.R,{value:(0,W.Ar)(we)?we:void 0,onChange:Be=>Ye(Be&&(0,W.AN)(Be),"to"),allowEmpty:!0,placeholder:"HH:mm",size:"sm"})]})})]}),Ce.mode==="cron"&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(C.D,{label:"Cron expression",children:(0,d.jsx)(U.p,{onChange:Be=>Pe(Be.target.value),value:Ce.cronExpr,placeholder:"0 9 * * 1-5",width:40})}),(0,d.jsx)(C.D,{label:"Duration",children:(0,d.jsx)(U.p,{onChange:Be=>Se(Be.target.value),value:Ce.duration,placeholder:"8h",width:40})})]}),(0,d.jsx)(C.D,{label:"Timezone",children:ye()})]})},ne=Ce=>({wrapper:(0,D.css)({maxWidth:Ce.spacing(60),marginBottom:Ce.spacing(2)}),timezoneContainer:(0,D.css)({padding:"5px",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",fontSize:"12px"}),timezone:(0,D.css)({marginRight:"5px"})}),te="Enabling this returns annotations that match any of the tags specified below",Y=(0,d.jsx)("div",{children:"Specify a list of tags to match. To specify a key and value tag use `key:value` syntax."}),Q=[{label:"Dashboard",value:T.St.Dashboard,description:"Query for events created on this dashboard and show them in the panels where they where created"},{label:"Tags",value:T.St.Tags,description:"This will fetch any annotation events that match the tags filter"}],J=[{label:"Annotations & Alerts",value:T.nj.Annotations,description:"Show annotations or alerts managed by grafana"},{label:"Time regions",value:T.nj.TimeRegions,description:"Configure a repeating time region"}],q=[10,50,100,200,300,500,1e3,2e3].map(Ce=>({label:String(Ce),value:Ce}));function X({query:Ce,onChange:He}){const ke=Ce,{limit:Me,matchAny:$e,tags:tt,type:Ke,queryType:Re}=ke;let Ve=Re??T.nj.Annotations;const Qe=(0,b.useMemo)(()=>(0,P.UA)().dashboard?.getTimezone(),[]),je=(0,E.of)(se),ze=Ee=>He({...ke,type:Ee.value}),Ye=Ee=>He({...ke,limit:Ee.value}),Ge=Ee=>He({...ke,matchAny:Ee.target.checked}),ce=Ee=>He({...ke,tags:Ee}),Pe=Ee=>{const xe={...ke,queryType:Ee.value};xe.queryType===T.nj.TimeRegions?xe.timeRegion||(xe.timeRegion={timezone:Qe}):delete xe.timeRegion,He(xe)},Se=Ee=>{He({...ke,timeRegion:Ee})};return(0,d.jsxs)(v.n,{className:je.container,children:[(0,d.jsx)(C.D,{label:"Query type",children:(0,d.jsx)(S.l6,{inputId:"grafana-annotations__query-type",options:J,value:Ve,onChange:Pe})}),Ve===T.nj.Annotations&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(C.D,{label:"Filter by",children:(0,d.jsx)(S.l6,{inputId:"grafana-annotations__filter-by",options:Q,value:Ke,onChange:ze})}),(0,d.jsx)(C.D,{label:"Max limit",children:(0,d.jsx)(S.l6,{inputId:"grafana-annotations__limit",width:16,options:q,value:Me,onChange:Ye})}),Ke===T.St.Tags&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(C.D,{label:"Match any",description:te,children:(0,d.jsx)(O.d,{id:"grafana-annotations__match-any",value:$e,onChange:Ge})}),(0,d.jsx)(C.D,{label:"Tags",description:Y,children:(0,d.jsx)(I.$,{allowCustomValue:!0,inputId:"grafana-annotations__tags",onChange:ce,tagOptions:R.vy,tags:tt??[]})})]})]}),Ve===T.nj.TimeRegions&&ke.timeRegion&&(0,d.jsx)(Z,{value:ke.timeRegion,onChange:Se})]})}const se=Ce=>({container:(0,D.css)({maxWidth:Ce.spacing(60),marginBottom:Ce.spacing(2)})});var oe=e(95004),ae=e(14465),ie=e(74529);const fe=24*3600;function pe(Ce,He,ke,Me,$e,tt){let Ke=Me-Ce;Ke<0&&(Ke+=7);let Re=He*3600+ke*60,Ve=$e*3600+tt*60,Qe=0;return Ke===0&&Ve<Re?Qe=7*fe-(Re-Ve):Qe=Ke*fe-Re+Ve,Qe}function de(Ce,He,ke,Me){if(Ce==null&&He==null)return;const $e={cronExpr:"",duration:0},tt=Ce==null&&ke==null,Ke=Ce!=null&&He==null&&Me==null;He??="00:00";let[Re,Ve]=He.split(":").map(Ge=>+Ge);$e.cronExpr=`${Ve} ${Re} * * ${Ce??"*"}`,Ce??=1,ke??=Ce,Ke&&(Me="00:00",ke+=ke===7?-6:1),Me??=He;let[Qe,je]=Me.split(":").map(Ge=>+Ge),ze=Re*3600+Ve*60,Ye=Qe*3600+je*60;return tt&&Ye<ze&&(ke+=ke===7?-6:1),$e.duration=pe(Ce,Re,Ve,ke,Qe,je),$e}function le(Ce,He){const ke=[];let Me="",$e=0,{fromDayOfWeek:tt,from:Ke,toDayOfWeek:Re,to:Ve,duration:Qe=""}=Ce;if(Ce.mode==="cron")Me=Ce.cronExpr??"",$e=(0,ie.WT)((0,ie.E9)(Qe));else{Ke=Ke===""?void 0:Ke,Ve=Ve===""?void 0:Ve;const je=de(tt,Ke,Re,Ve);je!=null&&(Me=je.cronExpr,$e=je.duration*1e3)}if(Me==="")return[];try{let je=Ce.timezone==="browser"?void 0:Ce.timezone==="utc"?"Etc/UTC":Ce.timezone,ze=new ae.l4(Me,{timezone:je}),Ye=new Date(He.from.valueOf()-$e),Ge=He.to.valueOf(),ce=ze.nextRun(Ye);for(;ce!=null;){let Pe=+ce;if(Pe>Ge)break;ke.push({from:Pe,to:Pe+$e}),ce=ze.nextRun(ce)}}catch(je){console.error(je)}return ke}function me(Ce,He,ke){const{mode:Me,duration:$e,cronExpr:tt,from:Ke,fromDayOfWeek:Re}=He,Ve=Me==null&&(Re!=null||Ke!=null),Qe=Me==="cron"&&tt!=null&&$e!=null;if(Ve||Qe){const je=le(He,ke);if(je.length>0)return{fields:[{name:"time",type:oe.PU.time,values:je.map(Ye=>Ye.from),config:{}},{name:"timeEnd",type:oe.PU.time,values:je.map(Ye=>Ye.to),config:{}},{name:"text",type:oe.PU.string,values:Array(je.length).fill(Ce),config:{}}],length:je.length}}}let De=100;class Te extends i.iy{constructor(He){super(He),this.annotations={QueryEditor:X,prepareAnnotation(ke){return ke.target=ke.target??{type:ke.type??T.St.Dashboard,limit:ke.limit??100,tags:ke.tags??[],matchAny:ke.matchAny??!1},ke},prepareQuery(ke){let Me;if((0,t.isString)(ke.datasource)){const Ke=(0,y.og)(ke.datasource,{returnDefaultAsNull:!1});Ke&&(Me=Ke)}else Me=ke.datasource;const{filter:$e,...tt}=ke;return{...tt,refId:ke.name,queryType:T.nj.Annotations,datasource:Me}}}}getDefaultQuery(){return{queryType:T.nj.RandomWalk}}query(He){const ke=[],Me=[],$e=(0,x.w)();for(const tt of He.targets){if(tt.queryType===T.nj.Annotations)return(0,n.H)(this.getAnnotations({range:He.range,rangeRaw:He.range.raw,annotation:tt,dashboard:(0,P.UA)().getCurrent()}));if(!tt.hide){if(tt.queryType===T.nj.Snapshot){ke.push((0,r.of)({data:(tt.snapshot??[]).map(Ke=>(0,m.or)(Ke)),state:a.Gu.Done}));continue}if(tt.queryType===T.nj.TimeRegions){const Ke=me("",tt.timeRegion,He.range);ke.push((0,r.of)({data:Ke?[Ke]:[],state:a.Gu.Done}));continue}if(tt.queryType===T.nj.LiveMeasurements){let Ke=$e.replace(tt.channel,He.scopedVars);const{filter:Re}=tt,Ve=(0,l.DG)(Ke);if(!(0,l.aj)(Ve))continue;const Qe={maxLength:He.maxDataPoints??500};tt.buffer?(Qe.maxDelta=tt.buffer,Qe.maxLength=Qe.maxLength*2):He.rangeRaw?.to==="now"&&(Qe.maxDelta=He.range.to.valueOf()-He.range.from.valueOf()),ke.push((0,g.oF
1559)().getDataStream({key:`${He.requestId}.${De++}`,addr:Ve,filter:Re,buffer:Qe}))}else tt.queryType||(tt.queryType=T.nj.RandomWalk),Me.push(tt)}}return Me.length&&ke.push(super.query({...He,targets:Me})),ke.length?ke.length===1?ke[0]:(0,o.h)(...ke):(0,r.of)()}listFiles(He,ke){return this.query({targets:[{refId:"A",queryType:T.nj.List,path:He}],maxDataPoints:ke}).pipe((0,s.T)(Me=>{const $e=Me.data[0]??new f.k;return new h.R($e)}))}metricFindQuery(){return Promise.resolve([])}async getAnnotations(He){const ke=He.annotation.target;if(ke?.queryType===T.nj.TimeRegions){const Re=me(He.annotation.name,ke.timeRegion,He.range);return Promise.resolve({data:Re?[Re]:[]})}const Me=He.annotation,$e=Me.target,tt={from:He.range.from.valueOf(),to:He.range.to.valueOf(),limit:$e.limit,tags:$e.tags,matchAny:$e.matchAny};if($e.type===T.St.Dashboard){if(!He.dashboard?.uid)return Promise.resolve({data:[]});tt.dashboardUID=He.dashboard.uid,delete tt.tags}else{if(!Array.isArray($e.tags)||$e.tags.length===0)return Promise.resolve({data:[]});const Re=(0,x.w)(),Ve="__delimiter__",Qe=[];for(const je of tt.tags){const ze=Re.replace(je,{},Ye=>typeof Ye=="string"?Ye:Ye.join(Ve));for(const Ye of ze.split(Ve))Qe.push(Ye)}tt.tags=Qe}const Ke=await(0,p.AI)().get("/api/annotations",tt,`grafana-data-source-annotations-${Me.name}-${He.dashboard?.uid}`);return{data:[(0,u.Vc)(Ke)]}}testDatasource(){return Promise.resolve({message:"",status:""})}}async function Ne(){return await(0,c.l)().get("-- Grafana --")}},8095:(ee,B,e)=>{"use strict";e.d(B,{St:()=>o,dx:()=>r,nj:()=>t,uJ:()=>n});var t=(s=>(s.LiveMeasurements="measurements",s.Annotations="annotations",s.Snapshot="snapshot",s.TimeRegions="timeRegions",s.RandomWalk="randomWalk",s.List="list",s.Read="read",s.Search="search",s.SearchNext="searchNext",s))(t||{});const n={refId:"A",queryType:"randomWalk"},r={refId:"A",datasource:{type:"grafana",uid:"grafana"},queryType:"snapshot",snapshot:[]};var o=(s=>(s.Dashboard="dashboard",s.Tags="tags",s))(o||{})},22747:(ee,B,e)=>{"use strict";e.d(B,{H:()=>a,j:()=>f});var t=e(77154),n=e(45229),r=e(52161),o=e(23628),s=e(87745),m=e(8095);function a(h,u){return new Promise(i=>{if(h.datasource?.uid===r.vv){l(u,h),i(!0);return}n.A.publish(new s.bY({title:"Change to panel embedded data",text:"If you want to change the data shown in this panel Grafana will need to remove the panels current query and replace it with a snapshot of the current data. This enables you to edit the data.",yesText:"Continue",icon:"pen",onConfirm:()=>{l(u,h),i(!0)},onDismiss:()=>{i(!1)}}))})}function l(h,u){const i=h.map(g=>(0,t.Nw)(g)),x={refId:"A",queryType:m.nj.Snapshot,snapshot:i,datasource:{uid:r.vv}};u.updateQueries({dataSource:{uid:r.vv},queries:[x]}),u.refresh()}function f(h){return(u,i,x)=>{o.vI(u).subscribe(async g=>{const p=[];g.dataFrames.forEach(c=>
1559{const y=(0,t.Nw)(c);p.push(y)}),h({...m.dx,snapshot:p,file:g.file},i)})}}},7795:(ee,B,e)=>{"use strict";e.d(B,{Q$:()=>r,U3:()=>n,ti:()=>o});var t=(s=>(s.Builder="builder",s.Code="code",s))(t||{}),n=(s=>(s.Instant="instant",s.Range="range",s.Stream="stream",s))(n||{}),r=(s=>(s.DataSample="dataSample",s.InfiniteScroll="infiniteScroll",s.LogsSample="logsSample",s.LogsVolume="logsVolume",s))(r||{}),o=(s=>(s.Backward="backward",s.Forward="forward",s.Scan="scan",s))(o||{})},77236:(ee,B,e)=>{"use strict";e.d(B,{AW:()=>m,Ay:()=>l,RQ:()=>o,dZ:()=>t,fV:()=>s,vB:()=>a});const t=[{label:"avg",insertText:"avg",documentation:"Calculate the average over dimensions"},{label:"bottomk",insertText:"bottomk",documentation:"Smallest k elements by sample value"},{label:"count",insertText:"count",documentation:"Count number of elements in the vector"},{label:"max",insertText:"max",documentation:"Select maximum over dimensions"},{label:"min",insertText:"min",documentation:"Select minimum over dimensions"},{label:"stddev",insertText:"stddev",documentation:"Calculate population standard deviation over dimensions"},{label:"stdvar",insertText:"stdvar",documentation:"Calculate population standard variance over dimensions"},{label:"sum",insertText:"sum",documentation:"Calculate sum over dimensions"},{label:"topk",insertText:"topk",documentation:"Largest k elements by sample value"}],n=[{label:"json",insertText:"json",documentation:"Extracting labels from the log line using json parser."},{label:"regexp",insertText:'regexp ""',documentation:"Extracting labels from the log line using regexp parser.",move:-1},{label:"logfmt",insertText:"logfmt",documentation:"Extracting labels from the log line using logfmt parser."},{label:"pattern",insertText:"pattern",documentation:"Extracting labels from the log line using pattern parser. Only available in Loki 2.3+."},{label:"unpack",insertText:"unpack",detail:"unpack identifier",documentation:'Parses a JSON log line, unpacking all embedded labels in the pack stage. A special property "_entry" will also be used to replace the original log line. Only available in Loki 2.2+.'}],r=[{label:"unwrap",insertText:"unwrap",detail:"unwrap identifier",documentation:"Take labels and use the values as sample data for metric aggregations."},{label:"label_format",insertText:"label_format",documentation:"Use to rename, modify or add labels. For example, | label_format foo=bar ."},{label:"line_format",insertText:"line_format",documentation:'Rewrites log line content. For example, | line_format "{{.query}} {{.duration}}" .'}],o=[{insertText:"avg_over_time",label:"avg_over_time",detail:"avg_over_time(range-vector)",documentation:"The average of all values in the specified interval."},{insertText:"bytes_over_time",label:"bytes_over_time",detail:"bytes_over_time(range-vector)",documentation:"Counts the amount of bytes used by each log stream for a given range"},{insertText:"bytes_rate",label:"bytes_rate",detail:"bytes_rate(range-vector)",documentation:"Calculates the number of bytes per second for each stream."},{insertText:"first_over_time",label:"first_over_time",detail:"first_over_time(range-vector)",documentation:"The first of all values in the specified interval. Only available in Loki 2.3+."},{insertText:"last_over_time",label:"last_over_time",detail:"last_over_time(range-vector)",documentation:"The last of all values in the specified interval. Only available in Loki 2.3+."},{insertText:"sum_over_time",label:"sum_over_time",detail:"sum_over_time(range-vector)",documentation:"The sum of all values in the specified interval."},{insertText:"count_over_time",label:"count_over_time",detail:"count_over_time(range-vector)",documentation:"The count of all values in the specified interval."},{insertText:"max_over_time",label:"max_over_time",detail:"max_over_time(range-vector)",documentation:"The maximum of all values in the specified interval."},{insertText:"min_over_time",label:"min_over_time",detail:"min_over_time(range-vector)",documentation:"The minimum of all values in the specified interval."},{insertText:"quantile_over_time",label:"quantile_over_time",detail:"quantile_over_time(scalar, range-vector)",documentation:"The \u03C6-quantile (0 \u2264 \u03C6 \u2264 1) of the values in the specified interval."},{insertText:"rate",label:"rate",detail:"rate(v range-vector)",documentation:"Calculates the number of entries per second."},{insertText:"stddev_over_time",label:"stddev_over_time",detail:"stddev_over_time(range-vector)",documentation:"The population standard deviation of the values in the specified interval."},{insertText:"stdvar_over_time",label:"stdvar_over_time",detail:"stdvar_over_time(range-vector)",documentation:"The population standard variance of the values in the specified interval."}],s=[{insertText:"vector",label:"vector",detail:"vector(scalar)",documentation:"Returns the scalar as a vector with no labels."}],m=[...t,...o,...s],a={comment:{pattern:/#.*/},"context-aggregation":{pattern:/((without|by)\s*)\([^)]*\)/,lookbehind:!0,inside:{"label-key":{pattern:/[^(),\s][^,)]*[^),\s]*/,alias:"attr-name"},punctuation:/[()]/}},"context-labels":{pattern:/\{[^}]*(?=}?)/,greedy:!0,inside:{comment:{pattern:/#.*/},"label-key":{pattern:/[a-zA-Z_]\w*(?=\s*(=|!=|=~|!~))/,alias:"attr-name",greedy:!0},"label-value":{pattern:/"(?:\\.|[^\\"])*"/,greedy:!0,alias:"attr-value"},punctuation:/[{]/}},"context-pipe":{pattern:/\s\|[^=~]\s?\w*/i,inside:{"pipe-operator":{pattern:/\|/i,alias:"operator"},"pipe-operations":{pattern:new RegExp(`${[...n,...r].map(f=>f.label).join("|")}`,"i"),alias:"keyword"}}},function:new RegExp(`\\b(?:${m.map(f=>f.label).join("|")})(?=\\s*\\()`,"i"),"context-range":[{pattern:/\[[^\]]*(?=\])/,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}},{pattern:/(offset\s+)\w+/,lookbehind:!0,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}}],quote:{pattern:/"(?:\\.|[^\\"])*"/,alias:"string",greedy:!0},backticks:{pattern:/`(?:\\.|[^\\`])*`/,alias:"string",greedy:!0},number:/\b-?\d+((\.\d*)?([eE][+-]?\d+)?)?\b/,operator:/\s?(\|[=~]?|!=?|<(?:=>?|<|>)?|>[>=]?)\s?/i,punctuation:/[{}(),.]/},l=a},12282:(ee,B,e)=>{"use strict";e.d(B,{HD:()=>r,Q$:()=>t.Q$,U3:()=>t.U3,ie:()=>o,ti:()=>t.ti});var t=e(7795),n=(s=>(s.Stream="streams",s.Vector="vector",s.Matrix="matrix",s))(n||{}),r=(s=>
1559(s.Indexed="I",s.StructuredMetadata="S",s.Parsed="P",s))(r||{}),o=(s=>(s[s.LabelNames=0]="LabelNames",s[s.LabelValues=1]="LabelValues",s))(o||{})},18615:(ee,B,e)=>{"use strict";e.d(B,{N8:()=>b,bG:()=>d,qM:()=>D,uv:()=>P});var t=e(2543),n=e.n(t),r=e(62467),o=e(65474),s=e(45650),m=e(69862),a=e(81160),l=e(9084),f=e(66847),h=e(93031),u=e(71030),i=e(94644),x=e(28105),g=e(2863),p=e(78282),c=e(97534),y=e(9931);const P="-- Mixed --",d="mixed-",D=(v,C)=>`${d}${v}-${C||""}`;class b extends i.mA{constructor(C){super(C)}query(C){const S=C.targets.filter(R=>R.datasource?.uid!==P);if(!S.length)return(0,r.of)({data:[]});const O=(0,t.groupBy)(S,"datasource.uid"),I=[];for(const R in O)R===y.K?O[R].forEach(T=>{I.push(...this.getBatchesForQueries([T],C))}):I.push(...this.getBatchesForQueries(O[R],C));return I.length?this.batchQueries(I,C):(0,r.of)({data:[]})}getBatchesForQueries(C,S){const O=C[0].datasource,I=[],R=(0,g.w)().replace(O?.uid,S.scopedVars,(T,L)=>{if(!Array.isArray(T))return T;for(const K of T){if(K==="default")continue;const A=(0,p.l)().getInstanceSettings(K);I.push({datasource:(0,p.l)().get(K),queries:(0,t.cloneDeep)(C),scopedVars:{...S.scopedVars,[L.name]:{value:K,text:A?.name}}})}return""});return R!==""&&I.push({datasource:(0,p.l)().get(R),queries:(0,t.cloneDeep)(C),scopedVars:{...S.scopedVars}}),I}batchQueries(C,S){const O=C.filter(this.isQueryable).map((I,R)=>(0,o.H)(I.datasource).pipe((0,m.Z)(T=>{const L=(0,t.cloneDeep)(S);return L.requestId=D(R,L.requestId),L.targets=I.queries,L.scopedVars=I.scopedVars,(0,o.H)(T.query(L)).pipe((0,a.T)(K=>({...K,data:K.data||[],state:x.Gu.Loading,key:D(R,K.key)})),(0,l.$)(),(0,f.W)(K=>(K=(0,c.u)(K),K.message=`${T.name}: ${K.message}`,(0,r.of)([{data:[],state:x.Gu.Error,error:K,key:D(R,L.requestId)}]))))})));return(0,s.p)(O).pipe(E(),(0,a.T)(this.finalizeResponses),(0,h.U)())}testDatasource(){return Promise.resolve({message:"",status:""})}isQueryable(C){return C&&Array.isArray(C.queries)&&C.queries.length>0}finalizeResponses(C){const{length:S}=C;if(S===0)return C;const O=C.find(I=>I.state===x.Gu.Error);return O?C.push(O):C[S-1].state=x.Gu.Done,C}}function E(){return(0,u.T)((v,C)=>C.reduce((S,O)=>(S.push.apply(S,O),S),v),[])}},25192:(ee,B,e)=>{"use strict";e.d(B,{cd:()=>E,xw:()=>p});var t=e(18700),n=e(95004);const r={filters:[],groupBy:[]};var o=(w=>(w.Instant="instant",w.Range="range",w))(o||{}),s=(w=>(w.Done="done",w.Error="error",w.Pending="pending",w.Streaming="streaming",w))(s||{}),m=(w=>(w.Raw="raw",w.Spans="spans",w.Traces="traces",w))(m||{}),a=(w=>(w.Event="event",w.Instrumentation="instrumentation",w.Intrinsic="intrinsic",w.Link="link",w.Resource="resource",w.Span="span",w.Unscoped="unscoped",w))(a||{});function l(w){if(w.stringValue)return w.stringValue;if(w.boolValue!==void 0)return!!w.boolValue;if(w.intValue!==void 0)return Number.parseInt(String(w.intValue),10);if(w.doubleValue)return Number.parseFloat(String(w.doubleValue));if(w.arrayValue){const j=[];for(const V of w.arrayValue.values)j.push(l(V));return j}return""}function f(w){const j=[];let V="OTLPResourceNoServiceName";if(!w)return{serviceName:V,serviceTags:j};for(const U of w.attributes)U.key===SemanticResourceAttributes.SERVICE_NAME&&(V=U.value.stringValue||V),j.push({key:U.key,value:l(U.value)});return{serviceName:V,serviceTags:j}}function h(w){const j=[];if(w.attributes)for(const V of w.attributes)j.push({key:V.key,value:l(V.value)});return j}function u(w){let j;if(w.kind){const V=w.kind.toString().toLowerCase().split("_");j=V.length?V[V.length-1]:w.kind.toString()}return j}function i(w){const j=[];if(w.links)for(const V of w.links){const{traceId:U,spanId:F}=V,M=[];if(V.attributes)for(const H of V.attributes)M.push({key:H.key,value:l(H.value)});j.push({traceID:U,spanID:F,tags:M})}return j}function x(w){const j=[];if(w.events)for(const V of w.events){const U=[];if(V.attributes)for(const F of V.attributes)U.push({key:F.key,value:l(F.value)});j.push({fields:U,timestamp:V.timeUnixNano/1e6,name:V.name})}return j}function g(w,j=!1){const V=new MutableDataFrame({fields:[{name:"traceID",type:FieldType.string,values:[]},{name:"spanID",type:FieldType.string,values:[]},{name:"parentSpanID",type:FieldType.string,values:[]},{name:"operationName",type:FieldType.string,values:[]},{name:"serviceName",type:FieldType.string,values:[]},{name:"kind",type:FieldType.string,values:[]},{name:"statusCode",type:FieldType.number,values:[]},{name:"statusMessage",type:FieldType.string,values:[]},{name:"instrumentationLibraryName",type:FieldType.string,values:[]},{name:"instrumentationLibraryVersion",type:FieldType.string,values:[]},{name:"traceState",type:FieldType.string,values:[]},{name:"serviceTags",type:FieldType.other,values:[]},{name:"startTime",type:FieldType.number,values:[]},{name:"duration",type:FieldType.number,values:[]},{name:"logs",type:FieldType.other,values:[]},{name:"references",type:FieldType.other,values:[]},{name:"tags",type:FieldType.other,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"otlp"}}});try{for(const F of w){const{serviceName:M,serviceTags:H}=f(F.resource);for(const _ of F.instrumentationLibrarySpans)for(const Z of _.spans)V.add({traceID:Z.traceId.length>16?Z.traceId.slice(16):Z.traceId,spanID:Z.spanId,parentSpanID:Z.parentSpanId||"",operationName:Z.name||"",serviceName:M,kind:u(Z),statusCode:Z.status?.code,statusMessage:Z.status?.message,instrumentationLibraryName:_.instrumentationLibrary?.name,instrumentationLibraryVersion:_.instrumentationLibrary?.version,traceState:Z.traceState,serviceTags:H,startTime:Z.startTimeUnixNano/1e6,duration:(Z.endTimeUnixNano-Z.startTimeUnixNano)/1e6,tags:h(Z),logs:x(Z),references:i(Z)})}}catch(F){return console.error(F),{error:{message:"JSON is not val
1559id OpenTelemetry format: "+F},data:[]}}let U=[V];return j&&U.push(...createNodeGraphFrames(V)),{data:U}}function p(w){let j={batches:[]},V={};for(let U=0;U<w.length;U++){const F=w.get(U);V[F.serviceName]||(V[F.serviceName]=j.batches.length,j.batches.push({resource:{attributes:[],droppedAttributesCount:0},instrumentationLibrarySpans:[{spans:[]}]}));let M=V[F.serviceName];j.batches[M].resource.attributes.length===0&&(j.batches[M].resource.attributes=y(F.serviceTags)),j.batches[M].instrumentationLibrarySpans[0].instrumentationLibrary||F.instrumentationLibraryName&&(j.batches[M].instrumentationLibrarySpans[0].instrumentationLibrary={name:F.instrumentationLibraryName,version:F.instrumentationLibraryVersion?F.instrumentationLibraryVersion:""}),j.batches[M].instrumentationLibrarySpans[0].spans.push({traceId:F.traceID.padStart(32,"0"),spanId:F.spanID,parentSpanId:F.parentSpanID||"",traceState:F.traceState||"",name:F.operationName,kind:c(F.kind),startTimeUnixNano:F.startTime*1e6,endTimeUnixNano:(F.startTime+F.duration)*1e6,attributes:F.tags?y(F.tags):[],droppedAttributesCount:0,droppedEventsCount:0,droppedLinksCount:0,status:d(F),events:D(F.logs),links:b(F.references)})}return j}function c(w){let j;if(w)switch(w){case"server":j="SPAN_KIND_SERVER";break;case"client":j="SPAN_KIND_CLIENT";break;case"producer":j="SPAN_KIND_PRODUCER";break;case"consumer":j="SPAN_KIND_CONSUMER";break;case"internal":j="SPAN_KIND_INTERNAL";break}return j}function y(w){return w.reduce((j,V)=>[...j,{key:V.key,value:P(V)}],[])}function P(w){if(typeof w.value=="string")return{stringValue:w.value};if(typeof w.value=="boolean")return{boolValue:w.value};if(typeof w.value=="number")return w.value%1===0?{intValue:w.value}:{doubleValue:w.value};if(typeof w.value=="object"&&Array.isArray(w.value)){const j=[];for(const V of w.value)j.push(P(V));return{arrayValue:{values:j}}}return{stringValue:w.value}}function d(w){let j;return w.statusCode!==void 0&&(j={code:w.statusCode,message:w.statusMessage?w.statusMessage:""}),j}function D(w){if(!w||!w.length)return;let j=[];for(const V of w){let U={timeUnixNano:V.timestamp*1e6,attributes:[],droppedAttributesCount:0,name:V.name||""};for(const F of V.fields)U.attributes.push({key:F.key,value:P(F)});j.push(U)}return j}function b(w){if(!w||!w.length)return;let j=[];for(const V of w){let U={traceId:V.traceID,spanId:V.spanID,attributes:[],droppedAttributesCount:0};if(V.tags?.length)for(const F of V.tags)U.attributes?.push({key:F.key,value:P(F)});j.push(U)}return j}const E="Related profiles";function v(w,j,V=!1){const U=w.data[0];if(!U)return N;const M=j?.jsonData?.tracesToProfiles;let H;if(M?.datasourceUid&&(H=getDataSourceSrv().getInstanceSettings(M.datasourceUid)),M&&H){const Z=M.customQuery?M.query:void 0,ne={title:E,url:"",internal:{datasourceUid:H.uid,datasourceName:H.name,query:{labelSelector:Z||"{${__tags}}",groupBy:[],profileTypeId:M.profileTypeId??"",queryType:"profile",spanSelector:['${__span.tags["pyroscope.profile.id"]}'],refId:"profile"}},origin:DataLinkConfigOrigin.Datasource};U.fields.forEach(te=>{te.name==="tags"&&(te.config.links=[ne])})}let _=[...w.data];return V&&_.push(...createNodeGraphFrames(toDataFrame(U))),{...w,data:_}}function C(w){return{traceID:w.traceID,startTime:parseInt(w.startTimeUnixNano,10)/1e6,traceDuration:w.durationMs,traceService:w.rootServiceName||"",traceName:w.rootTraceName||""}}function S(w,j){return w.data?.filter(V=>V.name==="exemplar"&&V.meta?.dataTopic==="annotations").map(V=>{const U=V.fields.find(F=>F.name==="traceId");if(U){const F=O(j);U.config.links=U.config.links?.length?[...U.config.links,...F]:F}return V}),w}function O(w){const j=[];return w.uid&&j.push({title:"View trace",url:"",internal:{query:{query:"${__value.raw}",queryType:"traceql"},datasourceUid:w.uid,datasourceName:w?.name??"Data source not found"}}),j}function I(w,j,V){switch(V){case SearchTableType.Spans:return L(w,j);case SearchTableType.Raw:return R(w);default:return T(w,j)}}function R(w){return[createDataFrame({name:"Raw response",refId:"raw",fields:[{name:"response",type:FieldType.string,values:[JSON.stringify(w,null,2)]}]})]}
1559function T(w,j){const V=createDataFrame({name:"Traces",refId:"traces",fields:[{name:"traceID",type:FieldType.string,config:{unit:"string",displayNameFromDS:"Trace ID",custom:{width:200},links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:j.uid,datasourceName:j.name,query:{query:"${__value.raw}",queryType:"traceql"}}}]}},{name:"startTime",type:FieldType.time,config:{displayNameFromDS:"Start time",custom:{width:200}}},{name:"traceService",type:FieldType.string,config:{displayNameFromDS:"Service"}},{name:"traceName",type:FieldType.string,config:{displayNameFromDS:"Name"}},{name:"traceDuration",type:FieldType.number,config:{displayNameFromDS:"Duration",unit:"ms",custom:{width:120}}},{name:"nested",type:FieldType.nestedFrames}],meta:{preferredVisualisationType:"table",uniqueRowIdFields:[0]}});return w?.length?(V.length=w.length,w.sort((U,F)=>parseInt(F?.startTimeUnixNano,10)/1e6-parseInt(U?.startTimeUnixNano,10)/1e6).forEach(U=>{const F=C(U);V.fields[0].values.push(F.traceID),V.fields[1].values.push(F.startTime),V.fields[2].values.push(F.traceService),V.fields[3].values.push(F.traceName),V.fields[4].values.push(F.traceDuration?F.traceDuration:"<1ms"),U.spanSets?V.fields[5].values.push(U.spanSets.map(M=>A(U,M,j))):U.spanSet&&V.fields[5].values.push([A(U,U.spanSet,j)])}),[V]):[V]}function L(w,j){const V={};let U=!1;w?.forEach(M=>K(M).forEach(H=>{H.attributes?.forEach(_=>{V[_.key]={name:_.key,type:FieldType.string,config:{displayNameFromDS:_.key}}}),H.spans.forEach(_=>{_.name&&(U=!0),_.attributes?.forEach(Z=>{V[Z.key]={name:Z.key,type:FieldType.string,config:{displayNameFromDS:Z.key}}})})}));const F=new MutableDataFrame({name:"Spans",refId:"traces",fields:[{name:"traceIdHidden",type:FieldType.string,config:{custom:{hidden:!0}}},{name:"traceService",type:FieldType.string,config:{displayNameFromDS:"Trace Service",custom:{width:200}}},{name:"traceName",type:FieldType.string,config:{displayNameFromDS:"Trace Name",custom:{width:200}}},{name:"spanID",type:FieldType.string,config:{unit:"string",displayNameFromDS:"Span ID",custom:{width:200},links:[{title:"Span: ${__value.raw}",url:"",internal:{datasourceUid:j.uid,datasourceName:j.name,query:{query:"${__data.fields.traceIdHidden}",queryType:"traceql"},panelsState:{trace:{spanId:"${__value.raw}"}}}}]}},{name:"time",type:FieldType.time,config:{displayNameFromDS:"Start time"}},{name:"name",type:FieldType.string,config:{displayNameFromDS:"Name",custom:{hidden:!U}}},...Object.values(V).sort((M,H)=>M.name.localeCompare(H.name)),{name:"duration",type:FieldType.number,config:{displayNameFromDS:"Duration",unit:"ns",custom:{width:120}}}],meta:{preferredVisualisationType:"table"}});return!w||!w.length?[F]:(w.sort((M,H)=>parseInt(H?.startTimeUnixNano,10)/1e6-parseInt(M?.startTimeUnixNano,10)/1e6).forEach(M=>{K(M).forEach(H=>{H.spans.forEach(_=>{F.add(W(_,H,M))})})}),[F])}const K=w=>w.spanSets||(w.spanSet?[w.spanSet]:[]),A=(w,j,V)=>{const U={};let F=!1;j.attributes?.map(_=>{U[_.key]={name:_.key,type:FieldType.string,config:{displayNameFromDS:_.key},values:[]}}),j.spans.forEach(_=>{_.name&&(F=!0),_.attributes?.forEach(Z=>{U[Z.key]={name:Z.key,type:FieldType.string,config:{displayNameFromDS:Z.key},values:[]}})});const M=new MutableDataFrame({fields:[{name:"traceIdHidden",type:FieldType.string,config:{custom:{hidden:!0}},values:[]},{name:"spanID",type:FieldType.string,values:[],config:{unit:"string",displayNameFromDS:"Span ID",custom:{width:200},links:[{title:"Span: ${__value.raw}",url:"",internal:{datasourceUid:V.uid,datasourceName:V.name,query:{query:"${__data.fields.traceIdHidden}",queryType:"traceql"},panelsState:{trace:{spanId:"${__value.raw}"}}}}]}},{name:"time",type:FieldType.time,config:{displayNameFromDS:"Start time",custom:{width:200}}},{name:"name",type:FieldType.string,values:[],config:{displayNameFromDS:"Name",custom:{hidden:!F}}},...Object.values(U).sort((_,Z)=>_.name.localeCompare(Z.name)),{name:"duration",type:FieldType.number,values:[],config:{displayNameFromDS:"Duration",unit:"ns",custom:{width:120}}}],meta:{preferredVisualisationType:"table"}}),H=createTheme();for(const _ of M.fields)_.display=getDisplayProcessor({field:_,theme:H});return j.spans.forEach(_=>{M.add(W(_,j,w))}),M};function W(w,j,V){const U=parseInt(w.startTimeUnixNano,10)/1e6,F={traceIdHidden:V.traceID,traceService:V.rootServiceName||"",traceName:V.rootTraceName||"",spanID:w.spanID,time:U,duration:parseInt(w.durationNanos,10),name:w.name};let M=[];return j.attributes&&(M=M.concat(j.attributes)),w.attributes&&(M=M.concat(w.attributes)),M.forEach(H=>{(H.value.boolValue||H.value.Value?.bool_value)&&(F[H.key]=H.value.boolValue||H.value.Value?.bool_value),(H.value.doubleValue||H.value.Value?.double_value)&&(F[H.key]=H.value.doubleValue||H.value.Value?.double_value),(H.value.intValue||H.value.Value?.
1559int_value)&&(F[H.key]=H.value.intValue||H.value.Value?.int_value),(H.value.stringValue||H.value.Value?.string_value)&&(F[H.key]=H.value.stringValue||H.value.Value?.string_value)}),F}const N={data:[new t.k({fields:[{name:"trace",type:n.PU.trace,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"otlp"}}})]}},21834:(ee,B,e)=>{"use strict";e.d(B,{nE:()=>r,r6:()=>n,xB:()=>t});var t=(o=>(o[o.AlphaAsc=1]="AlphaAsc",o[o.AlphaDesc=2]="AlphaDesc",o[o.Importance=3]="Importance",o[o.TimeAsc=4]="TimeAsc",o[o.TimeDesc=5]="TimeDesc",o))(t||{}),n=(o=>(o.Default="default",o.Custom="custom",o))(n||{}),r=(o=>(o.List="list",o.Stat="stat",o))(r||{})},4598:(ee,B,e)=>{"use strict";e.d(B,{d:()=>D,l:()=>b});var t=e(74848),n=e(2543),r=e(96540),o=e(38919),s=e(44232),m=e(739),a=e(98005),l=e(6399),f=e(54735),h=e(33352),u=e(65642),i=e(16515),x=e(95004),g=e(76637),p=e(63142),c=e(78055),y=e(36192);const P=(0,r.memo)(({data:E,placement:v,calcs:C,displayMode:S,...O})=>{const I=(0,p.$j)();let R=[];return(0,i.Fm)(E),E.forEach((T,L)=>{T.fields.forEach((K,A)=>{const W=A+1;if(K.type===x.PU.time||K.config.custom?.hideFrom?.legend)return;const N=K.state?.displayName??K.name,w=(0,g.lz)(K,I).color,j={label:N.toString(),color:w,yAxis:K.config.custom?.axisPlacement===m.vM.Right?2:1,disabled:K.state?.hideFrom?.viz,getDisplayValues:()=>(0,y.UO)(C,K,I),getItemKey:()=>`${N}-${L}-${W}`};R.push(j)})}),(0,t.jsx)(f.KU.Legend,{placement:v,...O,children:(0,t.jsx)(c.t,{placement:v,items:R,displayMode:S,sortBy:O.sortBy,sortDesc:O.sortDesc,isSortable:!0})})});P.displayName="BarGaugeLegend";var d=e(88879);class D extends r.PureComponent{constructor(){super(...arguments),this.renderComponent=(v,C)=>{const{options:S,fieldConfig:O}=this.props,{value:I,alignmentFactors:R,orientation:T,width:L,height:K,count:A}=v,{field:W,display:N,view:w,colIndex:j}=I,{openMenu:V,targetClassName:U}=C,F=this.getItemSpacing(),M=(K+F)*A-F>this.props.height;let H;return w&&(0,n.isNumber)(j)&&(H=w.getFieldDisplayProcessor(j)),(0,t.jsx)(a.xE,{value:b(A,O.defaults,N),width:L,height:K,orientation:T,field:W,text:S.text,display:H,theme:u.$W.theme2,itemSpacing:F,displayMode:S.displayMode,onClick:V,className:U,alignmentFactors:A>1?R:void 0,showUnfilled:S.showUnfilled,valueDisplayMode:S.valueMode,namePlacement:S.namePlacement,isOverflow:M})},this.renderValue=v=>{const{value:C,orientation:S}=v,{hasLinks:O,getLinks:I}=C;return O&&I?(0,t.jsx)("div",{style:{width:"100%",display:S===o.wV.Vertical?"flex":"initial"},children:(0,t.jsx)(l.e,{style:{height:"100%"},links:I,children:R=>this.renderComponent(v,R)})}):this.renderComponent(v,{})},this.getValues=()=>{const{data:v,options:C,replaceVariables:S,fieldConfig:O,timeZone:I}=this.props;return(0,s.PI)({fieldConfig:O,reduceOptions:C.reduceOptions,replaceVariables:S,theme:u.$W.theme2,data:v.series,timeZone:I})}}getItemSpacing(){return this.props.options.displayMode==="lcd"?2:10}getOrientation(){const{options:v,width:C,height:S}=this.props,{orientation:O}=v;return O===o.wV.Auto?C>S?o.wV.Vertical:o.wV.Horizontal:O}calcBarSize(){const{options:v}=this.props,C=this.getOrientation(),S=v.sizing===m.T6.Manual,O=C===o.wV.Vertical,I=C===o.wV.Horizontal,R=S&&O?v.minVizWidth:d.K.minVizWidth,T=S&&I?v.minVizHeight:d.K.minVizHeight,L=S&&I?v.maxVizHeight:d.K.maxVizHeight;return{minVizWidth:R,minVizHeight:T,maxVizHeight:L}}getLegend(){const{options:v,data:C}=this.props,{legend:S}=v;return S.showLegend&&C&&C.series.length>0?(0,t.jsx)(P,{data:C.series,...S}):null}render(){const{height:v,width:C,options:S,data:O,renderCounter:I}=this.props,{minVizWidth:R,minVizHeight:T,maxVizHeight:L}=this.calcBarSize();return(0,t.jsx)(f.KU,{width:C,height:v,legend:this.getLegend(),children:(K,A)=>(0,t.jsx)(h.S,{source:O,getAlignmentFactors:s.XS,getValues:this.getValues,renderValue:this.renderValue,renderCounter:I,width:K,height:A,maxVizHeight:L,minVizWidth:R,minVizHeight:T,itemSpacing:this.getItemSpacing(),orientation:S.orientation})})}}function b(E,v,C){return E===1&&!v.displayName?{...C,title:void 0}:C}},88879:(ee,B,e)=>{"use strict";e.d(B,{K:()=>n});var t=e(739);const n={displayMode:t.eX.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:t.TZ.Auto,showUnfilled:!0,sizing:t.T6.Auto,valueMode:t.$l.Color}},71843:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{plugin:()=>E});var t=e(16207),n=e(739),r=e(14099),o=e(87252),s=e(59795);const m=v=>(0,s._$)(v),a=(v,C,S)=>{const O=(0,s.gl)(v,C,S);if(C==="singlestat"&&S.angular){const I=S.angular.gauge;I&&(O.showThresholdMarkers=I.thresholdMarkers,O.showThresholdLabels=I.thresholdLabels)}return O};var l=e(74848),f=e(96540),h=e(11576),u=e(44232),i=e(18627),x=e(6399),g=e(33352),p=e(65642),c=e(4598);const y={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:n.T6.Auto};class P extends f.PureComponent{constructor(){super(...arguments),this.renderComponent=(C,S)=>{const{options:O,fieldConfig:I}=this.props,{width:R,height:T,count:L,value:K}=C,{field:A,display:W}=K,{openMenu:N,targetClassName:w}=S;return(0,l.jsx)(i._,{value:(0,c.l)(L,I.defaults,W),width:R,height:T,field:A,text:O.text,showThresholdLabels:O.showThresholdLabels,showThresholdMarkers:O.showThresholdMarkers,theme:p.$W.theme2,onClick:N,className:w,orientation:O.orientation})},this.renderValue=C=>{const{value:S}=C,{getLinks:O,hasLinks:I}=S;return I&&O?(0,l.jsx)(x.e,{links:O,style:{flexGrow:1},children:R=>this.renderComponent(C,R)}):this.renderComponent(C,{})},this.getValues=()=>{const{data:C,options:S,replaceVariables:O,fieldConfig:I,timeZone:R}=this.props;for(let T of C.series)for(let L of T.fields)if(L.config.unit==="percent"||L.config.unit==="percentunit"){const K=L.config.min??0,A=L.config.max??(L.config.unit==="percent"?100:1);L.state=L.state??{},L.state.range={min:K,max:A,delta:A-K},L.display=(0,h.J)({field:L,theme:p.$W.theme2})}return(0,u.PI)({fieldConfig:I,reduceOptions:S.reduceOptions,replaceVariables:O,theme:p.$W.theme2,data:C.series,timeZone:R})},this.calculateGaugeSize=()=>{const{options:C}=this.props,S=C.orientation,O=C.sizing===n.T6.Manual,I=S===n.wV.Vertical,R=S===n.wV.Horizontal,T=O&&I?C.minVizWidth:y.minVizWidth,L=O&&R?C.minVizHeight:y.minVizHeight;return{minVizWidth:T,minVizHeight:L}}}render(){const{height:C,width:S,data:O,renderCounter:I,options:R}=this.props,{minVizHeight:T,minVizWidth:L}=this.calculateGaugeSize();return(0,l.jsx)(g.S,{getValues:this.getValues,renderValue:this.renderValue,width:S,height:C,source:O,autoGrid:!0,renderCounter:I,orientation:R.orientation,minVizHeight:T,minVizWidth:L})}}var d=e(33553),D=e(73495);class b{getSuggestionsForData(C){const{dataSummary:S}=C;if(!S.hasData||!S.hasNumberField||S.numberFieldCount>=50)return;const O=C.getListAppender({name:D.m.Gauge,pluginId:"gauge",options:{},fieldConfig:{defaults:{thresholds:{steps:[{value:-1/0,color:"green"},{value:70,color:"orange"},{value:85,color:"red"}],mode:d.O.Percentage},custom:{}},overrides:[]},cardOptions:{previewModifier:I=>{I.options.reduceOptions.values&&(I.options.reduceOptions.limit=2)}}});S.hasStringField&&S.frameCount===1&&S.rowCountTotal<10?(O.append({name:D.m.Gauge,options:{reduceOptions:{values:!0,calcs:[]}}}),O.append({name:D.m.GaugeNoThresholds,options:{reduceOptions:{values:!0,calcs:[]},showThresholdMarkers:!1}})):(O.append({name:D.m.Gauge,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]}}}),O.append({name:D.m.GaugeNoThresholds,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},showThresholdMarkers:!1}}))}}const E=new t.m(P).useFieldConfig({useCustomConfig:v=>{v.addNumberInput({path:"neutral",name:"Neutral",description:"Leave empty to use Min as neutral point",category:["Gauge"],settings:{placeholder:"auto"}})}}).setPanelOptions(v=>{(0,o.L)(v),(0,o.h)(v),v.addBooleanSwitch({path:"showThresholdLabels",name:"Show threshold labels",description:"Render the threshold values around the gauge bar",defaultValue:y.showThresholdLabels}).addBooleanSwitch({path:"showThresholdMarkers",name:"Show threshold markers",description:"Renders the thresholds as an outer bar",defaultValue:y.showThresholdMarkers}).addRadio({path:"sizing",name:"Gauge size",settings:{options:[{value:n.T6.Auto,label:"Auto"},{value:n.T6.Manual,label:"Manual"}]},defaultValue:y.sizing,showIf:C=>C.orientation!==n.wV.Auto}).addSliderInput({path:"minVizWidth",name:"Min width",description:"Minimum column width (vertical orientation)",defaultValue:y.minVizWidth,settings:{min:0,max:600,step:1},showIf:C=>C.sizing===n.T6.Manual&&C.orientation===n.wV.Vertical}).addSliderInput({path:"minVizHeight",name:"Min height",description:"Minimum row height (horizontal orientation)",defaultValue:y.minVizHeight,settings:{min:0,max:600,step:1},showIf:C=>C.sizing===n.T6.Manual&&C.orientation===n.wV.Horizontal}),r.I(v)}).setPanelChangeHandler(a).setSuggestionsSupplier(new b).setMigrationHandler(m)},42240:(ee,B,e)=>{"use strict";e.d(B,{M:()=>m,x:()=>s});var t=e(74848),n=e(96540),r=e(57866),o=e(88531);
1559const s=({value:a,context:l,onChange:f})=>{const h=(0,n.useCallback)(u=>{f(u?.length?{id:r.jR.byRefId,options:u}:void 0)},[f]);return(0,t.jsx)(o.XL,{value:a?.options,onChange:h,data:l.data,placeholder:"Change filter"})},m=({value:a,context:l,onChange:f})=>{const h=(0,n.useCallback)(u=>{f(u?.length?{id:r.jR.byRefId,options:(0,o.h)(u)}:void 0)},[f]);return(0,t.jsx)(o.gK,{value:a?.options,onChange:h,data:l.data,placeholder:"Change filter"})}},46831:(ee,B,e)=>{"use strict";e.d(B,{K:()=>h});var t=e(74848),n=e(22803),r=e(70255),o=e(63704),s=e(80011),m=e(63142),a=e(21348);function l({width:i,showImage:x,data:g,index:p}){const c=(0,m.of)(u),y=i>600,P=g.get(p),d=encodeURI(P.title);return(0,t.jsxs)("article",{"aria-labelledby":d,className:(0,n.cx)(c.item,y&&c.itemWide),children:[x&&P.ogImage&&(0,t.jsx)("a",{tabIndex:-1,href:o.sQ.sanitizeUrl(P.link),target:"_blank",rel:"noopener noreferrer",className:(0,n.cx)(c.socialImage,y&&c.socialImageWide),"aria-hidden":!0,children:(0,t.jsx)("img",{src:P.ogImage,alt:P.title})}),(0,t.jsxs)("div",{className:c.body,children:[(0,t.jsxs)("time",{className:c.date,dateTime:(0,s.LE)(P.date,{format:"MMM DD"}),children:[(0,s.LE)(P.date,{format:"MMM DD"})," "]}),(0,t.jsx)("a",{className:c.link,href:o.sQ.sanitizeUrl(P.link),target:"_blank",rel:"noopener noreferrer",children:(0,t.jsx)("h3",{className:c.title,id:d,children:P.title})}),(0,t.jsx)("div",{className:c.content,dangerouslySetInnerHTML:{__html:o.sQ.sanitize(P.content)}})]})]})}const f=({width:i,showImage:x,rootProps:g})=>{const p=(0,m.of)(u),c=i>600;return(0,t.jsxs)("div",{className:(0,n.cx)(p.item,c&&p.itemWide),...g,children:[x&&(0,t.jsx)(r.A,{containerClassName:(0,n.cx)(p.socialImage,c&&p.socialImageWide),width:c?"250px":"100%",height:c?"150px":i*.5}),(0,t.jsxs)("div",{className:p.body,children:[(0,t.jsx)(r.A,{containerClassName:p.date,width:60}),(0,t.jsx)(r.A,{containerClassName:p.title,width:250}),(0,t.jsx)(r.A,{containerClassName:p.content,width:"100%",count:6})]})]})},h=(0,a.j)(l,f),u=i=>
1559({container:(0,n.css)({height:"100%"}),item:(0,n.css)({display:"flex",padding:i.spacing(1),position:"relative",marginBottom:i.spacing(.5),marginRight:i.spacing(1),borderBottom:`2px solid ${i.colors.border.weak}`,background:i.colors.background.primary,flexDirection:"column",flexShrink:0}),itemWide:(0,n.css)({flexDirection:"row"}),body:(0,n.css)({display:"flex",flexDirection:"column",flex:1}),socialImage:(0,n.css)({display:"flex",alignItems:"center",marginBottom:i.spacing(1),"> img":{width:"100%",borderRadius:`${i.shape.radius.default} ${i.shape.radius.default} 0 0`}}),socialImageWide:(0,n.css)({marginRight:i.spacing(2),marginBottom:0,"> img":{width:"250px",borderRadius:i.shape.radius.default}}),link:(0,n.css)({color:i.colors.text.link,display:"inline-block","&:hover":{color:i.colors.text.link,textDecoration:"underline"}}),title:(0,n.css)({fontSize:"16px",marginBottom:i.spacing(.5)}),content:(0,n.css)({p:{marginBottom:i.spacing(.5),color:i.colors.text.primary}}),date:(0,n.css)({marginBottom:i.spacing(.5),fontWeight:500,borderRadius:`0 0 0 ${i.shape.radius.default}`,color:i.colors.text.secondary})})},73745:(ee,B,e)=>{"use strict";e.d(B,{$:()=>t});const t="https://grafana.com/blog/news.xml"},30054:(ee,B,e)=>{"use strict";e.d(B,{n:()=>i});var t=e(41053),n=e(88673);function r(x){const p=new DOMParser().parseFromString(x,"text/xml");return{items:Array.from(p.querySelectorAll("entry")).map(y=>({title:a(y,"title"),link:y.querySelector("link")?.getAttribute("href")??"",content:a(y,"content"),pubDate:a(y,"published"),ogImage:y.querySelector("meta[property='og:image']")?.getAttribute("content")}))}}function o(x){const p=new DOMParser().parseFromString(x,"text/xml");return{items:Array.from(p.querySelectorAll("item")).map(y=>({title:a(y,"title"),link:a(y,"link"),content:a(y,"description"),pubDate:a(y,"pubDate"),ogImage:y.querySelector("meta[property='og:image']")?.getAttribute("content")}))}}async function s(x){return await(await fetch(x)).text()}function m(x){return new DOMParser().parseFromString(x,"text/xml").querySelector("feed")!==null}function a(x,g){return x.querySelector(g)?.textContent??""}async function l(x){const g=await s(x);return m(g)?r(g):o(g)}var f=e(25229),h=e(95004);function u(x){const g=[],p=[],c=[],y=[],P=[];for(const d of x.items){const D=(0,f.KQ)(d.pubDate);try{if(g.push(D.valueOf()),p.push(d.title),c.push(d.link),P.push(d.ogImage),d.content){const b=d.content.replace(/<\/?[^>]+(>|$)/g,"");y.push(b)}}catch(b){console.warn("Error reading news item:",b,d)}}return{fields:[{name:"date",type:h.PU.time,config:{displayName:"Date"},values:g},{name:"title",type:h.PU.string,config:{},values:p},{name:"link",type:h.PU.string,config:{},values:c},{name:"content",type:h.PU.string,config:{},values:y},{name:"ogImage",type:h.PU.string,config:{},values:P}],length:g.length}}function i(x){const[g,p]=(0,t.A)(async()=>{const c=await l(x),y=u(c);return new n.R(y)},[x],{loading:!0});return{state:g,getNews:p}}},87252:(ee,B,e)=>{"use strict";e.d(B,{L:()=>m,h:()=>a});var t=e(53543),n=e(46644),r=e(16515),o=e(8934),s=e(739);function m(l,f=!0){const h=["Value options"];l.addRadio({path:"reduceOptions.values",name:"Show",description:"Calculate a single value per column or series or show each row",settings:{options:[{value:!1,label:"Calculate"},{value:!0,label:"All values"}]},category:h,defaultValue:!1}),l.addNumberInput({path:"reduceOptions.limit",name:"Limit",description:"Max number of rows to display",category:h,settings:{placeholder:"25",integer:!0,min:1,max:5e3},showIf:u=>u.reduceOptions.values===!0}),l.addCustomEditor({id:"reduceOptions.calcs",path:"reduceOptions.calcs",name:"Calculation",description:"Choose a reducer function / calculation",category:h,editor:t.D.get("stats-picker").editor,defaultValue:[n.gy.lastNotNull],showIf:u=>u.reduceOptions.values===!1}),f&&l.addSelect({path:"reduceOptions.fields",name:"Fields",description:"Select the fields that should be included in the panel",category:h,settings:{allowCustomValue:!0,options:[],getOptions:async u=>{const i=[{value:"",label:"Numeric Fields"},{value:"/.*/",label:"All Fields"}];if(u&&u.data)for(const x of u.data)for(const g of x.fields){const p=(0,r.Ct)(g,x,u.data),c=`/^${(0,o.jD)(p)}$/`;i.push({value:c,label:p})}return Promise.resolve(i)}},defaultValue:""})}
1559function a(l,f){l.addRadio({path:"orientation",name:"Orientation",description:"Layout orientation",category:f,settings:{options:[{value:s.wV.Auto,label:"Auto"},{value:s.wV.Horizontal,label:"Horizontal"},{value:s.wV.Vertical,label:"Vertical"}]},defaultValue:s.wV.Auto})}},75663:(ee,B,e)=>{"use strict";e.r(B),e.d(B,{plugin:()=>E});var t=e(16207),n=e(739),r=e(14099),o=e(59795),s=e(64394);const m=(v,C,S)=>{const O=(0,o.gl)(v,C,S);if(S.angular&&(C==="singlestat"||C==="grafana-singlestat-panel")){const I=S.angular;if(O.graphMode=n.$p.None,I.sparkline&&I.sparkline.show&&(O.graphMode=n.$p.Area),I.colorBackground)O.colorMode=n.yp.Background;else if(I.colorValue)O.colorMode=n.yp.Value;else if(O.colorMode=n.yp.None,I.sparkline?.lineColor&&O.graphMode===n.$p.Area){const R=v.fieldConfig??{};R.defaults.color={mode:s.Y.Fixed,fixedColor:I.sparkline.lineColor},v.fieldConfig=R}I.valueName==="name"&&(O.textMode=n.SV.Name)}return O};var a=e(74848),l=e(2543),f=e(96540),h=e(95004),u=e(44232),i=e(60519),x=e(97611),g=e(6399),p=e(33352),c=e(65642);class y extends f.PureComponent{constructor(){super(...arguments),this.renderComponent=(C,S)=>{const{timeRange:O,options:I}=this.props,{value:R,alignmentFactors:T,width:L,height:K,count:A}=C,{openMenu:W,targetClassName:N}=S;let w=R.sparkline;return w&&(w.timeRange=O),(0,a.jsx)(x.yV,{value:R.display,count:A,sparkline:w,colorMode:I.colorMode,graphMode:I.graphMode,justifyMode:I.justifyMode,textMode:this.getTextMode(),alignmentFactors:T,text:I.text,width:L,height:K,theme:c.$W.theme2,onClick:W,className:N,disableWideLayout:!I.wideLayout,percentChangeColorMode:I.percentChangeColorMode})},this.renderValue=C=>{const{value:S}=C,{getLinks:O,hasLinks:I}=S;return I&&O?(0,a.jsx)(g.e,{links:O,children:R=>this.renderComponent(C,R)}):this.renderComponent(C,{})},this.getValues=()=>{const{data:C,options:S,replaceVariables:O,fieldConfig:I,timeZone:R}=this.props;let T;for(let L of C.series)for(let K of L.fields){let{config:A}=K;if(K.type===h.PU.number){if(K.state?.range)continue;!T&&(!(0,l.isNumber)(A.min)||!(0,l.isNumber)(A.max))&&(T=(0,i.nJ)(C.series));const W=A.min??T.min,N=A.max??T.max;K.state=K.state??{},K.state.range={min:W,max:N,delta:N-W}}}return(0,u.PI)({fieldConfig:I,reduceOptions:S.reduceOptions,replaceVariables:O,theme:c.$W.theme2,data:C.series,sparkline:S.graphMode!==n.$p.None,percentChange:S.showPercentChange,timeZone:R})}}getTextMode(){const{options:C,fieldConfig:S,title:O}=this.props;return C.textMode===n.SV.Auto&&(S.defaults.displayName||!O)?n.SV.ValueAndName:C.textMode}render(){const{height:C,options:S,width:O,data:I,renderCounter:R}=this.props;return(0,a.jsx)(p.S,{getValues:this.getValues,getAlignmentFactors:u.XS,renderValue:this.renderValue,width:O,height:C,source:I,itemSpacing:3,renderCounter:R,autoGrid:!0,orientation:S.orientation})}}var P=e(87252);const d={colorMode:n.yp.Value,graphMode:n.$p.Area,justifyMode:n.F8.Auto,percentChangeColorMode:n.CD.Standard,showPercentChange:!1,textMode:n.SV.Auto,wideLayout:!0};var D=e(73495);class b{getSuggestionsForData(C){const{dataSummary:S}=C;if(!S.hasData)return;const O=C.getListAppender({name:D.m.Stat,pluginId:"stat",options:{},fieldConfig:{defaults:{unit:"short",custom:{}},overrides:[]},cardOptions:{previewModifier:I=>{I.options.reduceOptions.values&&(I.options.reduceOptions.limit=1)}}});S.hasStringField&&S.hasNumberField&&S.frameCount===1&&S.rowCountTotal<10&&(O.append({name:D.m.Stat,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"}}}),O.append({name:D.m.StatColoredBackground,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"}
1559,colorMode:n.yp.Background}})),S.stringFieldCount===1&&S.frameCount===1&&S.rowCountTotal<10&&S.fieldCount===1&&O.append({name:D.m.Stat,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"},colorMode:n.yp.None}}),S.hasNumberField&&S.hasTimeField&&(O.append({options:{reduceOptions:{values:!1,calcs:["lastNotNull"]}}}),O.append({name:D.m.StatColoredBackground,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},graphMode:n.$p.None,colorMode:n.yp.Background}}))}}const E=new t.m(y).useFieldConfig().setPanelOptions(v=>{const C=["Stat styles"];(0,P.L)(v),(0,P.h)(v,C),r.I(v),v.addSelect({path:"textMode",name:"Text mode",description:"Control if name and value is displayed or just name",category:C,settings:{options:[{value:n.SV.Auto,label:"Auto"},{value:n.SV.Value,label:"Value"},{value:n.SV.ValueAndName,label:"Value and name"},{value:n.SV.Name,label:"Name"},{value:n.SV.None,label:"None"}]},defaultValue:d.textMode}).addRadio({path:"wideLayout",name:"Wide layout",category:C,settings:{options:[{value:!0,label:"On"},{value:!1,label:"Off"}]},defaultValue:d.wideLayout,showIf:S=>S.textMode===n.SV.ValueAndName}),v.addSelect({path:"colorMode",name:"Color mode",defaultValue:n.yp.Value,category:C,settings:{options:[{value:n.yp.None,label:"None"},{value:n.yp.Value,label:"Value"}
1559,{value:n.yp.Background,label:"Background Gradient"},{value:n.yp.BackgroundSolid,label:"Background Solid"}]}}).addRadio({path:"graphMode",name:"Graph mode",description:"Stat panel graph / sparkline mode",category:C,defaultValue:d.graphMode,settings:{options:[{value:n.$p.None,label:"None"},{value:n.$p.Area,label:"Area"}]}}).addRadio({path:"justifyMode",name:"Text alignment",defaultValue:d.justifyMode,category:C,settings:{options:[{value:n.F8.Auto,label:"Auto"},{value:n.F8.Center,label:"Center"}]}}).addBooleanSwitch({path:"showPercentChange",name:"Show percent change",defaultValue:d.showPercentChange,category:C,showIf:S=>!S.reduceOptions.values}).addSelect({path:"percentChangeColorMode",name:"Percent change color mode",defaultValue:d.percentChangeColorMode,category:C,settings:{options:[{value:n.CD.Standard,label:"Standard"},{value:n.CD.Inverted,label:"Inverted"},{value:n.CD.SameAsValue,label:"Same as Value"}]},showIf:S=>S.showPercentChange})}).setNoPadding().setPanelChangeHandler(m).setSuggestionsSupplier(new b).setMigrationHandler(o._$)},17914:(ee,B,e)=>{"use strict";e.d(B,{Z:()=>m});var t=e(74848),n=e(32881),r=e(77824),o=e(44580);const s=[{label:"Never",value:!1},{label:"Threshold",value:36e5}],m=({value:a,onChange:l,item:f})=>{const h=typeof a=="number";return s[1].value=h?a:36e5,(0,t.jsxs)(n.Gy,{children:[(0,t.jsx)(r.z,{value:a,options:s,onChange:l}),h&&(0,t.jsx)(o.g,{value:a,onChange:l,inputPrefix:o.F.GreaterThan,isTime:f.settings?.isTime??!1})]})}},32471:(ee,B,e)=>{"use strict";e.d(B,{F:()=>h});var t=e(74848),n=e(96540),r=e(32881),o=e(77824),s=e(18857),m=e(76319);const a=[{label:"Solid",value:"solid"},{label:"Dash",value:"dash"},{label:"Dots",value:"dot"}],l=["10, 10","10, 15","10, 20","10, 25","10, 30","10, 40","15, 10","20, 10","25, 10","30, 10","40, 10","50, 10","5, 10","30, 3, 3"].map(i=>({label:i,value:i})),f=["0, 10","0, 20","0, 30","0, 40","0, 3, 3"].map(i=>({label:i,value:i})),h=({value:i,onChange:x})=>{const g=(0,n.useMemo)(()=>i?.fill==="dash"?l:f,[i]),p=(0,n.useMemo)(()=>{if(!i?.dash?.length)return g[0];const c=i.dash?.join(", "),y=g.find(P=>P.value===c);return y||{label:c,value:c}},[i,g]);return(0,t.jsxs)(r.Gy,{children:[(0,t.jsx)(o.z,{value:i?.fill||"solid",options:a,onChange:c=>{let y;c==="dot"?y=u(f[0].value):c==="dash"&&(y=u(l[0].value)),x({...i,fill:c,dash:y})}}),i?.fill&&i?.fill!=="solid"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.l6,{allowCustomValue:!0,options:g,value:p,width:20,onChange:c=>{x({...i,dash:u(c.value??"")})},formatCreateLabel:c=>`Segments: ${u(c).join(", ")}`}),(0,t.jsxs)("div",{children:["\xA0",(0,t.jsx)("a",{title:"The input expects a segment list",href:"https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Parameters",target:"_blank",rel:"noreferrer",children:(0,t.jsx)(m.K,{name:"question-circle",tooltip:"Help"})})]})]})]})};function u(i){const x=[];for(const g of i.split(/(?:,| )+/)){const p=Number.parseInt(g,10);isNaN(p)||x.push(p)}return x}},44580:(ee,B,e)=>{"use strict";e.d(B,{F:()=>o,g:()=>s});var t=e(74848),n=e(17548),r=e(63527),o=(m=>(m.LessThan="lessthan",m.GreaterThan="greaterthan",m))(o||{});const s=({value:m,onChange:a,inputPrefix:l,isTime:f})=>{let h=n.secondsToHms(m/1e3);f||(h="10");const u=p=>{let c=!1;if(p)try{f&&n.isValidTimeSpan(p)?c=n.intervalToMs(p):c=Number(p)}catch(y){console.warn("ERROR",y)}a(c)},i=p=>{p.key==="Enter"&&u(p.currentTarget.value)},x=p=>{u(p.currentTarget.value)},g=l==="greaterthan"?(0,t.jsx)("div",{children:">"}):l==="lessthan"?(0,t.jsx)("div",{children:"<"}):null;return(0,t.jsx)(r.p,{autoFocus:!1,placeholder:"never",width:10,defaultValue:h,onKeyDown:i,onBlur:x,prefix:g,spellCheck:!1})}},76548:(ee,B,e)=>{"use strict";e.d(B,{e:()=>m});var t=e(74848),n=e(32881),r=e(77824),o=e(44580);const s=[{label:"Never",value:!1},{label:"Always",value:!0},{label:"Threshold",value:36e5}],m=({value:a,onChange:l,item:f})=>{const h=typeof a=="number";return s[2].value=h?a:36e5,(0,t.jsxs)(n.Gy,{children:[(0,t.jsx)(r.z,{value:a,options:s,onChange:l}),h&&(0,t.jsx)(o.g,{value:a,onChange:l,inputPrefix:o.F.LessThan,isTime:f.settings?.isTime??!1})]})}},99709:(ee,B,e)=>{"use strict";e.d(B,{D:()=>o});var t=e(74848),n=e(96540),r=e(18857);const o=({item:s,value:m,onChange:a,id:l})=>{const f=(0,n.useCallback)(h=>{a({mode:h.value})},[a]);return(0,t.jsx)(r.l6,{inputId:l,value:m.mode,options:s.settings?.options??[],onChange:f})}},12241:(ee,B,e)=>{"use strict";e.d(B,{S:()=>g,V:()=>c});var t=e(83340),n=e(64394),r=e(95004),o=e(38809),s=e(739),m=e(99555),a=e(81082),l=e(44017),f=e(45013),h=e(17914),u=e(32471),i=e(76548),x=e(99709);const g={drawStyle:s.GR.Line,lineInterpolation:s.dx.Linear,lineWidth:1,fillOpacity:0,gradientMode:s.on.None,barAlignment:s.Nj.Center,barWidthFactor:.6,stacking:{mode:s.gs.None,group:"A"}
1559,axisGridShow:!0,axisCenteredZero:!1,axisBorderShow:!1},p=["Graph styles"];function c(y,P=!0){return{standardOptions:{[t.uo.Color]:{settings:{byValueSupport:!0,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:n.Y.PaletteClassic}},[t.uo.Links]:{settings:{showOneClick:!0}},[t.uo.Actions]:{hideFromDefaults:!1}},useCustomConfig:d=>{d.addRadio({path:"drawStyle",name:"Style",category:p,defaultValue:y.drawStyle,settings:{options:m.t.drawStyle}}).addRadio({path:"lineInterpolation",name:"Line interpolation",category:p,defaultValue:y.lineInterpolation,settings:{options:m.t.lineInterpolation},showIf:D=>D.drawStyle===s.GR.Line}).addRadio({path:"barAlignment",name:"Bar alignment",category:p,defaultValue:y.barAlignment,settings:{options:m.t.barAlignment},showIf:D=>D.drawStyle===s.GR.Bars}).addSliderInput({path:"barWidthFactor",name:"Bar width factor",category:p,defaultValue:y.barWidthFactor,settings:{min:.1,max:1,step:.1,ariaLabelForHandle:"Bar width factor"},showIf:D=>D.drawStyle===s.GR.Bars}).addSliderInput({path:"lineWidth",name:"Line width",category:p,defaultValue:y.lineWidth,settings:{min:0,max:10,step:1,ariaLabelForHandle:"Line width"},showIf:D=>D.drawStyle!==s.GR.Points}).addSliderInput({path:"fillOpacity",name:"Fill opacity",category:p,defaultValue:y.fillOpacity,settings:{min:0,max:100,step:1,ariaLabelForHandle:"Fill opacity"},showIf:D=>D.drawStyle!==s.GR.Points}).addRadio({path:"gradientMode",name:"Gradient mode",category:p,defaultValue:m.t.fillGradient[0].value,settings:{options:m.t.fillGradient},showIf:D=>D.drawStyle!==s.GR.Points}).addFieldNamePicker({path:"fillBelowTo",name:"Fill below to",category:p,hideFromDefaults:!0,settings:{filter:D=>D.type===r.PU.number}}).addCustomEditor({id:"lineStyle",path:"lineStyle",name:"Line style",category:p,showIf:D=>D.drawStyle===s.GR.Line,editor:u.F,override:u.F,process:o.hS,shouldApply:D=>D.type===r.PU.number}).addCustomEditor({id:"spanNulls",path:"spanNulls",name:"Connect null values",category:p,defaultValue:!1,editor:i.e,override:i.e,showIf:D=>D.drawStyle===s.GR.Line,shouldApply:D=>D.type!==r.PU.time,process:o.hS,settings:{isTime:P}}).addCustomEditor({id:"insertNulls",path:"insertNulls",name:"Disconnect values",category:p,defaultValue:!1,editor:h.Z,override:h.Z,showIf:D=>D.drawStyle===s.GR.Line,shouldApply:D=>D.type!==r.PU.time,process:o.hS,settings:{isTime:P}}).addRadio({path:"showPoints",name:"Show points",category:p,defaultValue:m.t.showPoints[0].value,settings:{options:m.t.showPoints},showIf:D=>D.drawStyle!==s.GR.Points}).addSliderInput({path:"pointSize",name:"Point size",category:p,defaultValue:5,settings:{min:1,max:40,step:1,ariaLabelForHandle:"Point size"},showIf:D=>D.showPoints!==s.yL.Never||D.drawStyle===s.GR.Points}),a.I(d,y.stacking,p),d.addSelect({category:p,name:"Transform",path:"transform",settings:{options:[{label:"Constant",value:s.NU.Constant,description:"The first value will be shown as a constant line"},{label:"Negative Y",value:s.NU.NegativeY,description:"Flip the results to negative values on the y axis"}],isClearable:!0},hideFromDefaults:!0}),l.rg(d,y),f.e(d),d.addCustomEditor({id:"thresholdsStyle",path:"thresholdsStyle",name:"Show thresholds",category:["Thresholds"],defaultValue:{mode:s.Ly.Off},settings:{options:m.t.thresholdsDisplayModes},editor:x.D,override:x.D,process:o.hS,shouldApply:()=>!0})}}}},8535:(ee,B,e)=>{"use strict";e.d(B,{Gu:()=>o,JD:()=>s,M_:()=>n,k3:()=>r});var t=e(74887);let n;function r(m){n=m}function o(){return!n||!n.getState?{templating:{...t.L1,lastKey:"key"}}:n.getState()}function s(m){if(!(!n||!n.getState))return n.dispatch(m)}},73495:(ee,B,e)=>{"use strict";e.d(B,{m:()=>t});var t=(n=>(n.LineChart="Line chart",n.LineChartSmooth="Line chart smooth",n.LineChartGradientColorScheme="Line chart with gradient color scheme",n.AreaChart="Area chart",n.AreaChartStacked="Area chart stacked",n.AreaChartStackedPercent="Area chart 100% stacked",n.BarChart="Bar chart",n.BarChartGradientColorScheme="Bar chart with gradient color scheme",n.BarChartStacked="Bar chart stacked",n.BarChartStackedPercent="Bar chart 100% stacked",n.BarChartHorizontal="Bar chart horizontal",n.BarChartHorizontalStacked="Bar chart horizontal stacked",n.BarChartHorizontalStackedPercent="Bar chart horizontal 100% stacked",n.Candlestick="Candlestick",n.PieChart="Pie chart",n.PieChartDonut="Pie chart donut",n.Stat="Stat",n.StatColoredBackgroun
1559d="Stat colored background",n.Gauge="Gauge",n.GaugeNoThresholds="Gauge no thresholds",n.BarGaugeBasic="Bar gauge basic",n.BarGaugeLCD="Bar gauge LCD",n.Table="Table",n.StateTimeline="State timeline",n.StatusHistory="Status history",n.TextPanel="Text",n.DashboardList="Dashboard list",n.Logs="Logs",n.FlameGraph="Flame graph",n.Trace="Trace",n.NodeGraph="Node graph",n))(t||{})},24619:(ee,B,e)=>{"use strict";e.d(B,{$k:()=>m,Gi:()=>n,JS:()=>l,N1:()=>f,Q8:()=>h,Si:()=>r,cF:()=>t,lh:()=>a,qr:()=>s,s1:()=>o});var t=(u=>(u.Firing="firing",u.Inactive="inactive",u.Pending="pending",u.Recovering="recovering",u))(t||{}),n=(u=>(u.Normal="Normal",u.Alerting="Alerting",u.Pending="Pending",u.Recovering="Recovering",u.NoData="NoData",u.Error="Error",u))(n||{});function r(u){return Object.values(t).includes(u)}function o(u){return Object.values(n).some(i=>i===u)}function s(u){const i=Object.values(t);return u!=null&&!i.includes(u)}function m(u){const i=u.match(/\((.*?)\)/);return i?i[1]:""}function a(u){return s(u)?u.split(" ")[0]:u}var l=(u=>(u.Alerting="alerting",u.Recording="recording",u))(l||{}),f=(u=>(u.Cortex="Cortex",u.Mimir="Mimir",u.Prometheus="Prometheus",u.Thanos="Thanos",u))(f||{}),h=(u=>(u.Alerting="Alerting",u.NoData="NoData",u.KeepLast="KeepLast",u.OK="OK",u.Error="Error",u))(h||{})},86791:(ee,B,e)=>{"use strict";e.d(B,{$7:()=>o,SA:()=>n,l$:()=>s});var t=e(24619);function n(m,a){return(0,t.lh)(m.state)===a}var r=(m=>(m.Firing="firing",m))(r||{}),o=(m=>(m.Alerting="alerting",m.Pending="pending",m.Recovering="recovering",m.Normal="inactive",m.NoData="nodata",m.Error="error",m))(o||{});const s=Symbol("grafana")},82013:()=>{(function(ee){var B={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function e(t){var n={x:-1,y:-1,locked:!1};t.setCrosshair=function(m){if(!m)n.x=-1;else{var a=t.p2c(m);n.x=Math.max(0,Math.min(a.left,t.width())),n.y=Math.max(0,Math.min(a.top,t.height()))}t.triggerRedrawOverlay()},t.clearCrosshair=t.setCrosshair,t.lockCrosshair=function(m){m&&t.setCrosshair(m),n.locked=!0},t.unlockCrosshair=function(){n.locked=!1};function r(s){n.locked||n.x!=-1&&(n.x=-1,t.triggerRedrawOverlay())}function o(s){if(!n.locked){if(t.getSelection&&t.getSelection()){n.x=-1;return}var m=t.offset();n.x=Math.max(0,Math.min(s.pageX-m.left,t.width())),n.y=Math.max(0,Math.min(s.pageY-m.top,t.height())),t.triggerRedrawOverlay()}}t.hooks.bindEvents.push(function(s,m){s.getOptions().crosshair.mode&&(m.mouseout(r),m.mousemove(o))}),t.hooks.drawOverlay.push(function(s,m){var a=s.getOptions().crosshair;if(a.mode){var l=s.getPlotOffset();if(m.save(),m.translate(l.left,l.top),n.x!=-1){var f=s.getOptions().crosshair.lineWidth%2?.5:0;if(m.strokeStyle=a.color,m.lineWidth=a.lineWidth,m.lineJoin="round",m.beginPath(),a.mode.indexOf("x")!=-1){var h=Math.floor(n.x)+f;m.moveTo(h,0),m.lineTo(h,s.height())}if(a.mode.indexOf("y")!=-1){var u=Math.floor(n.y)+f;m.moveTo(0,u),m.lineTo(s.width(),u)}m.stroke()}m.restore()}}),t.hooks.shutdown.push(function(s,m){m.unbind("mouseout",r),m.unbind("mousemove",o)})}ee.plot.plugins.push({init:e,options:B,name:"crosshair",version:"1.0"})})(jQuery)},2341:()=>{(function(ee){function B(e){e.hooks.processDatapoints.push(function(t,n,r){n.dashes.show&&t.hooks.draw.push(function(o,s){var m=o.getPlotOffset(),a=n.xaxis,l=n.yaxis;function f(x,g){var p=r.points,c=r.pointsize,y=null,P=null,d=0,D=!0,b,E;n.dashes.dashLength[0]?(b=n.dashes.dashLength[0],n.dashes.dashLength[1]?E=n.dashes.dashLength[1]:E=b):E=b=n.dashes.dashLength,s.beginPath();for(var v=c;v<p.length;v+=c){let N=function(w){var j=Math.sqrt(Math.pow(L-R,2)+Math.pow(K-T,2));if(j<=w)return{deltaX:L-R,deltaY:K-T,distance:j,remainder:w-j};var V=L>R?1:-1,U=K>T?1:-1;return{deltaX:V*Math.sqrt(Math.pow(w,2)/(1+Math.pow((K-T)/(L-R),2))),deltaY:U*Math.sqrt(Math.pow(w,2)-Math.pow(w,2)/(1+Math.pow((K-T)/(L-R),2))),distance:w,remainder:0}};var W=N,C=p[v-c],S=p[v-c+1],O=p[v],I=p[v+1];if(!(C==null||O==null)){if(S<=I&&S<l.min){if(I<l.min)continue;C=(l.min-S)/(I-S)*(O-C)+C,S=l.min}else if(I<=S&&I<l.min){if(S<l.min)continue;O=(l.min-S)/(I-S)*(O-C)+C,I=l.min}if(S>=I&&S>l.max){if(I>l.max)continue;C=(l.max-S)/(I-S)*(O-C)+C,S=l.max}else if(I>=S&&I>l.max){if(S>l.max)continue;O=(l.max-S)/(I-S)*(O-C)+C,I=l.max}if(C<=O&&C<a.min){if(O<a.min)continue;S=(a.min-C)/(O-C)*(I-S)+S,C=a.min}else if(O<=C&&O<a.min){if(C<a.min)continue;I=(a.min-C)/(O-C)*(I-S)+S,O=a.min}if(C>=O&&C>a.max){if(O>a.max)continue;S=(a.max-C)/(O-C)*(I-S)+S,C=a.max}else if(O>=C&&O>a.max){if(C>a.max)continue;I=(a.max-C)/(O-C)*(I-S)+S,O=a.max}(C!=y||S!=P)&&s.moveTo(a.p2c(C)+x,l.p2c(S)+g);var R=a.p2c(C)+x,T=l.p2c(S)+g,L=a.p2c(O)+x,K=l.p2c(I)+g,A;do A=N(d>0?d:D?b:E),(A.deltaX!=0||A.deltaY!=0)&&(D?s.lineTo(R+A.deltaX,T+A.deltaY):s.moveTo(R+A.deltaX,T+A.deltaY)),D=!D,d=A.remainder,R+=A.deltaX,T+=A.deltaY;while(A.distance>0);y=O,P=I}}s.stroke()}s.save(),s.translate(m.left,m.top),s.lineJoin="round";var h=n.dashes.lineWidth,u=n.shadowSize;if(h>0&&u>0){s.lineWidth=u,s.strokeStyle="rgba(0,0,0,0.1)";var i=Math.PI/18;f(Math.sin(i)*(h/2+u/2),Math.cos(i)*(h/2+u/2)),s.lineWidth=u/2,f(Math.sin(i)*(h/2+u/4),Math.cos(i)*(h/2+u/4))}s.lineWidth=h,s.strokeStyle=n.color,h>
15590&&f(0,0),s.restore()})})}ee.plot.plugins.push({init:B,options:{series:{dashes:{show:!1,lineWidth:2,dashLength:10}}},name:"dashes",version:"0.1"})})(jQuery)},92275:()=>{(function(ee){"use strict";var B={series:{fillBelowTo:null}};function e(t){function n(s,m){var a;for(a=0;a<m.length;++a)if(m[a].id===s.fillBelowTo)return m[a];return null}function r(s,m,a,l,f,h,u,i){var x,g,p,c,y,P;return x=a-s,g=l-m,p=u-f,c=i-h,y=(-g*(s-f)+x*(m-h))/(-p*g+x*c),P=(p*(m-h)-c*(s-f))/(-p*g+x*c),y>=0&&y<=1&&P>=0&&P<=1?[s+P*x,m+P*g]:null}function o(s,m,a){if(a.fillBelowTo===null)return;var l,f,h,u,i,x,g;function p(E,v){m.beginPath(),m.moveTo(a.xaxis.p2c(E)+x.left,a.yaxis.p2c(v)+x.top)}function c(){m.closePath(),m.fill()}function y(){if(h.length/f!==i.length/u)return console.error("Refusing to graph inconsistent number of points"),!1;var E;for(E=0;E<h.length/f;E++)if(h[E*f]!==null&&i[E*u]!==null&&h[E*f]!==i[E*u])return console.error("Refusing to graph points without matching value"),!1;return!0}function P(E,v){console.assert(v>E,"expects the end index to be greater than the start index");var C=E===0||h[E-1]===null||i[E-1]===null,S=!1,O,I;for(O=E;O<v;O++)if(h[O*f+1]===null||i[O*f+1]===null)S=!1,C=!0;else if(h[O*f+1]===i[O*u+1])S=!0,C=!1;else if(h[O*f+1]>i[O*u+1]){C?p(h[O*f],h[O*f+1]):S?p(h[(O-1)*f],h[(O-1)*f+1]):(I=d(O),p(I[0],I[1])),b(O,v);return}else C=!1,S=!1}function d(E){console.assert(E>0,"expects the second point in the series line segment");var v,C;for(v=1;v<i.length/u;v++)if(C=r(h[(E-1)*f],h[(E-1)*f+1],h[E*f],h[E*f+1],i[(v-1)*u],i[(v-1)*u+1],i[v*u],i[v*u+1]),C!==null)return C;console.error("intersectionPoint() should only be called when an intersection happens")}function D(E,v){console.assert(E>=v,"the start should be the rightmost point, and the end should be the leftmost (excluding the equal or intersecting point)");var C;for(C=E;C>=v;C--)m.lineTo(l.xaxis.p2c(i[C*u])+x.left,l.yaxis.p2c(i[C*u+1])+x.top);c()}function b(E,v){console.assert(E<=v,"the start should be the rightmost point, and the end should be the leftmost (excluding the equal or intersecting point)");var C,S;for(C=E;C<v;C++)if(h[C*f+1]===null&&C>E){D(C-1,E),P(C,v);return}else if(h[C*f+1]===i[C*u+1]){D(C,E),P(C,v);return}else if(h[C*f+1]<i[C*u+1]){S=d(C),m.lineTo(a.xaxis.p2c(S[0])+x.left,a.yaxis.p2c(S[1])+x.top),D(C,E),P(C,v);return}else m.lineTo(a.xaxis.p2c(h[C*f])+x.left,a.yaxis.p2c(h[C*f+1])+x.top);D(v,E)}l=n(a,s.getData()),l&&(f=a.datapoints.pointsize,h=a.datapoints.points,u=l.datapoints.pointsize,i=l.datapoints.points,x=s.getPlotOffset(),y()&&(g=ee.color.parse(a.color),g.a=.4,g.normalize(),m.fillStyle=g.toString(),P(0,h.length/f)))}t.hooks.drawSeries.push(o)}ee.plot.plugins.push({init:e,options:B,name:"fillbelow",version:"0.1.0"})})(jQuery)},19538:()=>{/*! 1560 * jquery.flot.gauge v1.1.0 * 1561 * 1562 * Flot plugin for rendering gauge charts. 1563 * 1564 * Copyright (c) 2015 @toyoty99. 1565 * Licensed under the MIT license. 1566 */(function(ee){var B=function(){var a,l,f,h,u,i,x=function(E,v){a=v,l=E.getPlaceholder(),f=E.getOptions(),h=f.series.gauges,u=E.getData(),i=e(h.debug)};x.prototype.calculateLayout=function(){var E=l.width(),v=l.height(),C=Math.min(u.length,h.layout.columns),S=Math.ceil(u.length/C),O=h.layout.margin,I=h.layout.hMargin,R=h.layout.vMargin,T=(E-O*2-I*(C-1))/C,L=(v-O*2-R*(S-1))/S;if(h.layout.square){var K=Math.min(T,L);T=K,L=K}g(h,T);var A=h.cell.margin,W=0,N=0;h.label.show&&(W=h.label.margin,N=h.label.font.size);var w=0,j=0;h.value.show&&(w=h.value.margin,j=h.value.font.size);var V=0;h.threshold.show&&(V=h.threshold.width);var U=0,F=0;h.threshold.label.show&&(U=h.threshold.label.margin,F=h.threshold.label.font.size);
1566for(var M=T/2-A-V-U*2-F,H=h.gauge.startAngle,_=h.gauge.endAngle,Z=(_-H)/100,ne=-1,te=H;te<_;te+=Z)ne=Math.max(ne,Math.sin(r(te)));ne=Math.max(ne,Math.sin(r(_)));var Y=(L-A*2-W*2-N)/(1+ne);Y*ne<w+j/2&&(Y=L-A*2-W*2-N-w-j/2);var Q=Y-U*2-F-V,J=Math.min(M,Q),q=h.gauge.width;q>=J&&(q=Math.max(3,J/3));var X=U*2+F+V+J,se=Math.max(X*(1+ne),X+w+j/2);return{canvasWidth:E,canvasHeight:v,margin:O,hMargin:I,vMargin:R,columns:C,rows:S,cellWidth:T,cellHeight:L,cellMargin:A,labelMargin:W,labelFontSize:N,valueMargin:w,valueFontSize:j,width:q,radius:J,thresholdWidth:V,thresholdLabelMargin:U,thresholdLabelFontSize:F,gaugeOuterHeight:se}};function g(E,v){E.gauge.width==="auto"&&(E.gauge.width=Math.max(5,v/8)),E.label.margin==="auto"&&(E.label.margin=Math.max(1,v/20)),E.label.font.size==="auto"&&(E.label.font.size=Math.max(5,v/8)),E.value.margin==="auto"&&(E.value.margin=Math.max(1,v/30)),E.value.font.size==="auto"&&(E.value.font.size=Math.max(5,v/9)),E.threshold.width==="auto"&&(E.threshold.width=Math.max(3,v/100)),E.threshold.label.margin==="auto"&&(E.threshold.label.margin=Math.max(3,v/40)),E.threshold.label.font.size==="auto"&&(E.threshold.label.font.size=Math.max(5,v/15))}x.prototype.calculateAutoValues=g,x.prototype.calculateCellLayout=function(E,v,C){var S=t(v.columns,C),O=n(v.columns,C),I=v.margin+(v.cellWidth+v.hMargin)*S,R=v.margin+(v.cellHeight+v.vMargin)*O,T=I+v.cellWidth/2,L=R+v.cellMargin+v.labelMargin*2+v.labelFontSize+v.thresholdWidth+v.thresholdLabelFontSize+v.thresholdLabelMargin*2+v.radius,K=v.cellHeight-v.cellMargin*2-v.labelMargin*2-v.labelFontSize-v.gaugeOuterHeight,A=0;return E.cell.vAlign==="middle"?A=K/2:E.cell.vAlign==="bottom"&&(A=K),L+=A,{col:S,row:O,x:I,y:R,offsetY:A,cellWidth:v.cellWidth,cellHeight:v.cellHeight,cellMargin:v.cellMargin,cx:T,cy:L}},x.prototype.drawBackground=function(E){h.frame.show&&(a.save(),a.strokeStyle=f.grid.borderColor,a.lineWidth=f.grid.borderWidth,a.strokeRect(0,0,E.canvasWidth,E.canvasHeight),f.grid.backgroundColor&&(a.fillStyle=f.grid.backgroundColor,a.fillRect(0,0,E.canvasWidth,E.canvasHeight)),a.restore())}
1566,x.prototype.drawCellBackground=function(E,v){a.save(),E.cell.border&&E.cell.border.show&&E.cell.border.color&&E.cell.border.width&&(a.strokeStyle=E.cell.border.color,a.lineWidth=E.cell.border.width,a.strokeRect(v.x,v.y,v.cellWidth,v.cellHeight)),E.cell.background&&E.cell.background.color&&(a.fillStyle=E.cell.background.color,a.fillRect(v.x,v.y,v.cellWidth,v.cellHeight)),a.restore()},x.prototype.drawGauge=function(E,v,C,S,O){var I=E.gauge.shadow.show?E.gauge.shadow.blur:0,R=y(E,O),T=p(E,v,O);d(C.cx,C.cy,v.radius,v.width,r(E.gauge.startAngle),r(E.gauge.endAngle),E.gauge.border.color,E.gauge.border.width,E.gauge.background.color,I),d(C.cx,C.cy,v.radius-1,v.width-2,r(T.a1),r(T.a2),R,1,R,I),E.gauge.neutralValue!=null&&c(E,v,C,R)};function p(E,v,C){let S={};var O=E.gauge.neutralValue;return O!=null?C<O?(S.a1=P(E,v,C),S.a2=P(E,v,O)):(S.a1=P(E,v,O),S.a2=P(E,v,C)):(S.a1=E.gauge.startAngle,S.a2=P(E,v,C)),S}function c(E,v,C,S){var O=(E.gauge.max-E.gauge.min)/600;o(a,C.cx,C.cy,v.radius-2,v.width-4,r(P(E,v,E.gauge.neutralValue-O)),r(P(E,v,E.gauge.neutralValue+O)),S,2,E.gauge.background.color)}function y(E,v){for(var C,S=0;S<E.threshold.values.length;S++){var O=E.threshold.values[S];if(C=O.color,v<O.value)break}return C}function P(E,v,C){var S=E.gauge.startAngle+(E.gauge.endAngle-E.gauge.startAngle)*((C-E.gauge.min)/(E.gauge.max-E.gauge.min));return S<E.gauge.startAngle?S=E.gauge.startAngle:S>E.gauge.endAngle&&(S=E.gauge.endAngle),S}x.prototype.drawThreshold=function(E,v,C){for(var S=E.gauge.startAngle,O=0;O<E.threshold.values.length;O++){var I=E.threshold.values[O];c1=I.color,a2=P(E,v,I.value),o(a,C.cx,C.cy,v.radius+v.thresholdWidth,v.thresholdWidth-2,r(S),r(a2),c1,1,c1),S=a2}};function d(E,v,C,S,O,I,R,T,L,K){O!==I&&(a.save(),o(a,E,v,C,S,O,I,R,T,L),K&&(o(a,E,v,C,S,O,I),a.clip(),a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=10,a.shadowColor="gray",o(a,E,v,C+1,S+2,O,I,R,1)),a.restore())}x.prototype.drawLable=function(E,v,C,S,O){b(C.cx,C.y+C.cellMargin+v.labelMargin+C.offsetY,"flotGaugeLabel"+S,E.label.formatter?E.label.formatter(O.label,O.data[0][1]):text,E.label)},x.prototype.drawValue=function(E,v,C,S,O){b(C.cx,C.cy-E.value.font.size/2,"flotGaugeValue"+S,E.value.formatter?E.value.formatter(O.label,O.data[0][1]):text,E.value)},x.prototype.drawThresholdValues=function(E,v,C,S){D(E,v,C,"Min"+S,E.gauge.min,E.gauge.startAngle),D(E,v,C,"Max"+S,E.gauge.max,E.gauge.endAngle);for(var O=0;O<E.threshold.values.length;O++){var I=E.threshold.values[O];if(I.value>E.gauge.min&&I.value<E.gauge.max){var R=P(E,v,I.value);D(E,v,C,S+"_"+O,I.value,R)}}var T=E.gauge.neutralValue;T!=null&&T>E.gauge.min&&T<E.gauge.max&&D(E,v,C,"Neutral"+S,T,P(E,v,T))};function D(E,v,C,S,O,I){b(C.cx+(v.thresholdLabelMargin+v.thresholdLabelFontSize/2+v.radius)*Math.cos(r(I)),C.cy+(v.thresholdLabelMargin+v.thresholdLabelFontSize/2+v.radius)*Math.sin(r(I)),"flotGaugeThresholdValue"+S,E.threshold.label.formatter?E.threshold.label.formatter(O):O,E.threshold.label,I)}function b(E,v,C,S,O,I){var R=ee(l).find("#"+C),T=R.length;T||(R=ee("<span></span>"),R.attr("id",C),R.attr("class","flot-temp-elem"),l.append(R)),R.css("position","absolute"),R.css("top",v+"px"),R.css("white-space","nowrap"),O.font.size&&R.css("font-size",O.font.size+"px"),O.font.family&&R.css("font-family",O.font.family),O.color&&R.css("color",O.color),O.background.color&&R.css("background-color",O.background.color),O.background.opacity&&R.css("opacity",O.background.opacity),R.text(S),R.css("left",E+"px"),R.css("left",parseInt(R.css("left"))-R.width()/2+"px"),!T&&I&&(R.css("top",parseInt(R.css("top"))-R.height()/2+"px"),R.css("transform","rotate("+(180*I+90)+"deg)"))}return x}();function e(a){return typeof Logger<"u"?new Logger(a):null}function t(a,l){return l%a}function n(a,l){return Math.floor(l/a)}function r(a){return a*Math.PI}function o(a,l,f,h,u,i,x,g,p,c){if(i!==x){var y=!1;a.save(),a.beginPath(),a.arc(l,f,h,i,x,y),a.lineTo(l+(h-u)*Math.cos(x),f+(h-u)*Math.sin(x)),a.arc(l,f,h-u,x,i,!y),a.closePath(),p&&(a.lineWidth=p),g&&(a.strokeStyle=g,a.stroke()),c&&(a.fillStyle=c,a.fill()),a.restore()}}function s(a){a.hooks.processOptions.push(function(l,f){var h=e(f.series.gauges.debug);f.series.gauges.show&&(f.grid.show=!1,f.legend.show=!1);var u=f.series.gauges.threshold.values;u.sort(function(i,x){return i.value<x.value?-1:i.value>x.value?1:0})}),a.hooks.draw.push(function(l,f){var h=l.getOptions(),u=h.series.gauges,i=e(u.debug);if(u.show){var x=l.getData();if(!(!x||!x.length)){var g=new B(l,f),p=g.calculateLayout();
1566u.debug.layout,g.drawBackground(p);for(var c=0;c<x.length;c++){var y=x[c],P=ee.extend({},u,y.gauges);y.gauges&&g.calculateAutoValues(P,p.cellWidth);var d=g.calculateCellLayout(P,p,c);g.drawCellBackground(P,d),P.debug.layout,P.label.show&&g.drawLable(P,p,d,c,y),g.drawGauge(P,p,d,y.label,y.data[0][1]),P.threshold.show&&g.drawThreshold(P,p,d),P.threshold.label.show&&g.drawThresholdValues(P,p,d,c),P.value.show&&g.drawValue(P,p,d,c,y)}}}})}var m={series:{gauges:{debug:{log:!1,layout:!1,alert:!1},show:!1,layout:{margin:5,columns:3,hMargin:5,vMargin:5,square:!1},frame:{show:!0},cell:{background:{color:null},border:{show:!0,color:"black",width:1},margin:5,vAlign:"middle"},gauge:{width:"auto",startAngle:.9,endAngle:2.1,min:0,max:100,background:{color:"white"},border:{color:"lightgray",width:2},shadow:{show:!0,blur:5}},label:{show:!0,margin:"auto",background:{color:null,opacity:0},font:{size:"auto",family:"sans-serif"},color:null,formatter:function(a,l){return a}},value:{show:!0,margin:"auto",background:{color:null,opacity:0},font:{size:"auto",family:"sans-serif"},color:null,formatter:function(a,l){return parseInt(l)}},threshold:{show:!0,width:"auto",label:{show:!0,margin:"auto",background:{color:null,opacity:0}
1566,font:{size:"auto",family:",sans-serif"},color:null,formatter:function(a){return a}},values:[]}}}};ee.plot.plugins.push({init:s,options:m,name:"gauge",version:"1.1.0"})})(jQuery)},54087:()=>{(function(ee){ee.color={},ee.color.make=function(e,t,n,r){var o={};return o.r=e||0,o.g=t||0,o.b=n||0,o.a=r??1,o.add=function(s,m){for(var a=0;a<s.length;++a)o[s.charAt(a)]+=m;return o.normalize()},o.scale=function(s,m){for(var a=0;a<s.length;++a)o[s.charAt(a)]*=m;return o.normalize()},o.toString=function(){return o.a>=1?"rgb("+[o.r,o.g,o.b].join(",")+")":"rgba("+[o.r,o.g,o.b,o.a].join(",")+")"},o.normalize=function(){function s(m,a,l){return a<m?m:a>l?l:a}return o.r=s(0,parseInt(o.r),255),o.g=s(0,parseInt(o.g),255),o.b=s(0,parseInt(o.b),255),o.a=s(0,o.a,1),o},o.clone=function(){return ee.color.make(o.r,o.b,o.g,o.a)},o.normalize()},ee.color.extract=function(e,t){var n;do{if(n=e.css(t).toLowerCase(),n!=""&&n!="transparent")break;e=e.parent()}while(e.length&&!ee.nodeName(e.get(0),"body"));return n=="rgba(0, 0, 0, 0)"&&(n="transparent"),ee.color.parse(n)},ee.color.parse=function(e){var t,n=ee.color.make;if(t=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))return n(parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10));if(t=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return n(parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),parseFloat(t[4]));if(t=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))return n(parseFloat(t[1])*2.55,parseFloat(t[2])*2.55,parseFloat(t[3])*2.55);if(t=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return n(parseFloat(t[1])*2.55,parseFloat(t[2])*2.55,parseFloat(t[3])*2.55,parseFloat(t[4]));if(t=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))return n(parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16));if(t=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))return n(parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16));var r=ee.trim(e).toLowerCase();return r=="transparent"?n(255,255,255,0):(t=B[r]||[0,0,0],n(t[0],t[1],t[2]))};var B={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery),function(ee){var B=Object.prototype.hasOwnProperty;ee.fn.detach||(ee.fn.detach=function(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})});function e(r,o){var s=o.children("."+r)[0];if(s==null&&(s=document.createElement("canvas"),s.className=r,ee(s).css({direction:"ltr",position:"absolute",left:0,top:0}).appendTo(o),!s.getContext))if(window.G_vmlCanvasManager)s=window.G_vmlCanvasManager.initElement(s);else throw new Error("Canvas is not available. If you're using IE with a fall-back such as Excanvas, then there's either a mistake in your conditional include, or the page has no DOCTYPE and is rendering in Quirks Mode.");this.element=s;var m=this.context=s.getContext("2d"),a=window.devicePixelRatio||1,l=m.webkitBackingStorePixelRatio||m.mozBackingStorePixelRatio||m.msBackingStorePixelRatio||m.oBackingStorePixelRatio||m.backingStorePixelRatio||1;this.pixelRatio=a/l,this.resize(o.width(),o.height()),this.textContainer=null,this.text={},this._textCache={},this._textSizeCache=window.flotTextSizeCache=window.flotTextSizeCache||{}}e.prototype.resize=function(r,o){if(r<=0||o<=0)throw new Error("Invalid dimensions for plot, width = "+r+", height = "+o);var s=this.element,m=this.context,a=this.pixelRatio;this.width!=r&&(s.width=r*a,s.style.width=r+"px",this.width=r),this.height!=o&&(s.height=o*a,s.style.height=o+"px",this.height=o
1566),m.restore(),m.save(),m.scale(a,a)},e.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},e.prototype.render=function(){var r=this._textCache;for(var o in r)if(B.call(r,o)){var s=this.getTextLayer(o),m=r[o];s.hide();for(var a in m)if(B.call(m,a)){var l=m[a];for(var f in l)if(B.call(l,f)){for(var h=l[f].positions,u=0,i;i=h[u];u++)i.active?i.rendered||(s.append(i.element),i.rendered=!0):(h.splice(u--,1),i.rendered&&i.element.detach());h.length==0&&delete l[f]}}s.show()}},e.prototype.getTextLayer=function(r){var o=this.text[r];return o==null&&(this.textContainer==null&&(this.textContainer=ee("<div class='flot-text flot-temp-elem'></div>").css({position:"absolute",top:0,left:0,bottom:0,right:0,"font-size":"smaller",color:"#545454"}).insertAfter(this.element)),o=this.text[r]=ee("<div></div>").addClass(r).css({position:"absolute",top:0,left:0,bottom:0,right:0}).appendTo(this.textContainer)),o},e.prototype.getTextInfo=function(r,o,s,m,a){var l,f,h,u;if(o=""+o,typeof s=="object"?l=s.style+" "+s.variant+" "+s.weight+" "+s.size+"px/"+s.lineHeight+"px "+s.family:l=s,f=this._textCache[r],f==null&&(f=this._textCache[r]={}),h=f[l],h==null&&(h=f[l]={}),u=h[o],u==null){var i=ee("<div></div>").html(o).css({position:"absolute","max-width":a,top:-9999}).appendTo(this.getTextLayer(r));typeof s=="object"?i.css({font:l,color:s.color}):typeof s=="string"&&i.addClass(s),u=h[o]={element:i,positions:[]};var x=this._textSizeCache[o];x?(u.width=x.width,u.height=x.height):(u.width=i.outerWidth(!0),u.height=i.outerHeight(!0),this._textSizeCache[o]={width:u.width,height:u.height}),i.detach()}return u},e.prototype.addText=function(r,o,s,m,a,l,f,h,u){var i=this.getTextInfo(r,m,a,l,f),x=i.positions;h=="center"?o-=i.width/2:h=="right"&&(o-=i.width),u=="middle"?s-=i.height/2:u=="bottom"&&(s-=i.height);for(var g=0,p;p=x[g];g++)if(p.x==o&&p.y==s){p.active=!0;return}p={active:!0,rendered:!1,element:x.length?i.element.clone():i.element,x:o,y:s},x.push(p),p.element.css({top:Math.round(s),left:Math.round(o),"text-align":h})},e.prototype.removeText=function(r,o,s,m,a,l){if(m==null){var f=this._textCache[r];if(f!=null){for(var h in f)if(B.call(f,h)){var u=f[h];for(var i in u)if(B.call(u,i))for(var x=u[i].positions,g=0,p;p=x[g];g++)p.active=!1}}}else for(var x=this.getTextInfo(r,m,a,l).positions,g=0,p;p=x[g];g++)p.x==o&&p.y==s&&(p.active=!1)};function t(r,o,s,m){var a=[],l={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:!0,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:.85,sorted:null},xaxis:{show:null,position:"bottom",mode:null,font:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null},yaxis:{autoscaleMargin:.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:2,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,align:"left",horizontal:!1,zero:!0},shadowSize:3,highlightColor:null},grid:{show:!0,aboveData:!1,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,margin:0,labelMargin:5,eventSectionHeight:0,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:10},interaction:{redrawOverlayInterval:16.666666666666668},hooks:{}},f=null,h=null,u=null,i=null,x=null,g=[],p=[],c={left:0,right:0,top:0,bottom:0},y=0,P=0,d={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],processRange:[],drawBackground:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},D=this;D.setData=C,D.setupGrid=H,D.draw=Q,D.getPlaceholder=function(){return r},D.getCanvas=function(){return f.element},D.getPlotOffset=function(){return c},D.width=function(){return y},D.height=function(){return P},D.offset=function(){var ce=u.offset();return ce.left+=c.left,ce.top+=c.top,ce},D.getData=function(){return a},D.getAxes=function(){var ce={},Pe;return ee.each(g.concat(p),function(Se,Ee){Ee&&(ce[Ee.direction+(Ee.n!=1?Ee.n:"")+"axis"]=Ee)}),ce},D.getXAxes=function(){return g},D.getYAxes=function(){return p},D.c2p=R,D.p2c=T,D.getOptions=function(){return l},D.highlight=Ve,D.unhighlight=Qe,D.triggerRedrawOverlay=Ke,D.pointOffset=function(ce){return{left:parseInt(g[O(ce,"x")-1].p2c(+ce.x)+c.left,10),top:parseInt(p[O(ce,"y")-1].p2c(+ce.y)+c.top,10)}},D.shutdown=w,D.destroy=function(){w(),r.removeData("plot").empty(),a=[],l=null,f=null,h=null,u=null,i=null,x=null,g=[],p=[],d=null,De=[],D=null},D.resize=function(){var ce=r.width(),Pe=r.height();f.resize(ce,Pe),h.resize(ce,Pe)},D.hooks=d,E(D),v(s),W(),C(o),H(),Q(),N();function b(ce,Pe){Pe=[D].concat(Pe);for(var Se=0;Se<ce.length;++Se)ce[Se].apply(this,Pe)}function E(){for(var ce={Canvas:e},Pe=0;Pe<m.length;++Pe){var Se=m[Pe];Se.init(D,ce),Se.options&&ee.extend(!0,l,Se.options)}}function v(ce){ee.extend(!0,l,ce),ce&&ce.colors&&(l.colors=ce.colors),l.xaxis.color==null&&(l.xaxis.color=ee.color.parse(l.grid.color).scale("a",.22).toString()),l.yaxis.color==null&&(l.yaxis.color=ee.color.parse(l.grid.color).scale("a",.22).toString()),l.xaxis.tickColor==null&&(l.xaxis.tickColor=l.grid.tickColor||l.xaxis.color),l.yaxis.tickColor==null&&(l.yaxis.tickColor=l.grid.tickColor||l.yaxis.color),l.grid.borderColor==null&&(l.grid.borderColor=l.grid.color),l.grid.tickColor==null&&(l.grid.tickColor=ee.color.parse(l.grid.color).scale("a",.22).toString());var Pe,Se,Ee,xe=r.css("font-size"),ye=xe?+xe.replace("px",""):13,Oe={style:r.css("font-style"),size:Math.round(.8*ye),variant:r.css("font-variant"),weight:r.css("font-weight"),family:r.css("font-family")};for(Ee=l.xaxes.length||1,Pe=0;Pe<Ee;++Pe)Se=l.xaxes[Pe],Se&&!Se.tickColor&&(Se.tickColor=Se.color),Se=ee.extend(!0,{},l.xaxis,Se),l.xaxes[Pe]=Se,Se.font&&(Se.font=ee.extend({},Oe,Se.font),Se.font.color||(Se.font.color=Se.color),Se.font.lineHeight||(Se.font.lineHeight=Math.round(Se.font.size*1.15)));for(Ee=l.yaxes.length||1,Pe=0;Pe<Ee;++Pe)Se=l.yaxes[Pe],Se&&!Se.tickColor&&(Se.tickColor=Se.color),Se=ee.extend(!0,{},l.yaxis,Se),l.yaxes[Pe]=Se,Se.font&&(Se.font=ee.extend({},Oe,Se.font),Se.font.color||(Se.font.color=Se.color),Se.font.lineHeight||(Se.font.lineHeight=Math.round(Se.font.size*1.15)));for(l.xaxis.noTicks&&l.xaxis.ticks==null&&(l.xaxis.ticks=l.xaxis.noTicks),l.yaxis.noTicks&&l.yaxis.ticks==null&&(l.yaxis.ticks=l.yaxis.noTicks),l.x2axis&&(l.xaxes[1]=ee.extend(!0,{},l.xaxis,l.x2axis),l.xaxes[1].position="top",l.x2axis.min==null&&(l.xaxes[1].min=null),l.x2axis.max==null&&(l.xaxes[1].max=null)),l.y2axis&&(l.yaxes[1]=ee.extend(!0,{},l.yaxis,l.y2axis),l.yaxes[1].position="right",l.y2axis.min==null&&(l.yaxes[1].min=null),l.y2axis.max==null&&(l.yaxes[1].max=null)),l.grid.coloredAreas&&(l.grid.markings=l.grid.coloredAreas),l.grid.coloredAreasColor&&(l.grid.markingsColor=l.grid.coloredAreasColor),l.lines&&ee.extend(!0,l.series.lines,l.lines),l.points&&ee.extend(!0,l.series.points,l.points),l.bars&&ee.extend(!0,l.series.bars,l.bars),l.shadowSize!=null&&(l.series.shadowSize=l.shadowSize),l.highlightColor!=null&&(l.series.highlightColor=l.highlightColor),Pe=0;Pe<l.xaxes.length;++Pe)L(g,Pe+1).options=l.xaxes[Pe];for(Pe=0;Pe<l.yaxes.length;++Pe)L(p,Pe+1).options=l.yaxes[Pe];for(var we in d)l.hooks[we]&&l.hooks[we].length&&(d[we]=d[we].concat(l.hooks[we]));b(d.processOptions,[l])}function C(ce){a=S(ce),K(),A()}function S(ce){for(var Pe=[],Se=0;Se<ce.length;++Se){var Ee=ee.extend(!0,{},l.series);ce[Se].data!=null?(Ee.data=ce[Se].data,delete ce[Se].data,ee.extend(!0,Ee,ce[Se]),ce[Se].data=Ee.data):Ee.data=ce[Se],Pe.push(Ee)}return Pe}function O(ce,Pe){var Se=ce[Pe+"axis"];return typeof Se=="object"&&(Se=Se.n),typeof Se!="number"&&(Se=1),Se}function I(){return ee.grep(g.concat(p),function(ce){return ce})}function R(ce){var Pe={},Se,Ee;for(Se=0;Se<g.length;++Se)Ee=g[Se],Ee&&(Pe["x"+Ee.n]=Ee.c2p(ce.left));for(Se=0;Se<p.length;++Se)Ee=p[Se],Ee&&(Pe["y"+Ee.n]=Ee.c2p(ce.top));return Pe.x1!==void 0&&(Pe.x=Pe.x1),Pe.y1!==void 0&&(Pe.y=Pe.y1),Pe}function T(ce){var Pe={},Se,Ee,xe;for(Se=0;Se<g.length;++Se)if(Ee=g[Se],Ee&&Ee.used&&(xe="x"+Ee.n,ce[xe]==null&&Ee.n==1&&(xe="x"),ce[xe]!=null)){Pe.left=Ee.p2c(ce[xe]);break}for(Se=0;Se<p.length;++Se)if(Ee=p[Se],Ee&&Ee.used&&(xe="y"+Ee.n,ce[xe]==null&&Ee.n==1&&(xe="y"),ce[xe]!=null)){Pe.top=Ee.p2c(ce[xe]);break}return Pe}function L(ce,Pe){return ce[Pe-1]||(ce[Pe-1]={n:Pe,direction:ce==g?"x":"y",options:ee.extend(!0,{},ce==g?l.xaxis:l.yaxis)}),ce[Pe-1]}function K(){var ce=a.length,Pe=-1,Se;for(Se=0;Se<a.length;++Se){var Ee=a[Se].color;Ee!=null&&(ce--,typeof Ee=="number"&&Ee>Pe&&(Pe=Ee))}
1566ce<=Pe&&(ce=Pe+1);var xe,ye=[],Oe=l.colors,we=Oe.length,Be=0;for(Se=0;Se<ce;Se++)xe=ee.color.parse(Oe[Se%we]||"#666"),Se%we==0&&Se&&(Be>=0?Be<.5?Be=-Be-.2:Be=0:Be=-Be),ye[Se]=xe.scale("rgb",1+Be);var Xe=0,st;for(Se=0;Se<a.length;++Se){if(st=a[Se],st.color==null?(st.color=ye[Xe].toString(),++Xe):typeof st.color=="number"&&(st.color=ye[st.color].toString()),st.lines.show==null){var lt,Et=!0;for(lt in st)if(st[lt]&&st[lt].show){Et=!1;break}Et&&(st.lines.show=!0)}st.lines.zero==null&&(st.lines.zero=!!st.lines.fill),st.xaxis=L(g,O(st,"x")),st.yaxis=L(p,O(st,"y"))}}function A(){var ce=Number.POSITIVE_INFINITY,Pe=Number.NEGATIVE_INFINITY,Se=Number.MAX_VALUE,Ee,xe,ye,Oe,we,Be,Xe,st,lt,Et,Tt,Mt,wt,_e,xt,At;function bt(Zt,tn,ft){tn<Zt.datamin&&tn!=-Se&&(Zt.datamin=tn),ft>Zt.datamax&&ft!=Se&&(Zt.datamax=ft)}for(ee.each(I(),function(Zt,tn){tn.datamin=ce,tn.datamax=Pe,tn.used=!1}),Ee=0;Ee<a.length;++Ee)Be=a[Ee],Be.datapoints={points:[]},b(d.processRawData,[Be,Be.data,Be.datapoints]);for(Ee=0;Ee<a.length;++Ee){if(Be=a[Ee],xt=Be.data,At=Be.datapoints.format,!At){if(At=[],At.push({x:!0,number:!0,required:!0}),At.push({y:!0,number:!0,required:!0}),Be.stack||Be.bars.show||Be.lines.show&&Be.lines.fill){var Xt=!!(Be.bars.show&&Be.bars.zero||Be.lines.show&&Be.lines.zero);At.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:Xt}),Be.bars.horizontal&&(delete At[At.length-1].y,At[At.length-1].x=!0)}Be.datapoints.format=At}if(Be.datapoints.pointsize==null){Be.datapoints.pointsize=At.length,st=Be.datapoints.pointsize,Xe=Be.datapoints.points;
1566var Cn=Be.lines.show&&Be.lines.steps;for(Be.xaxis.used=Be.yaxis.used=!0,xe=ye=0;xe<xt.length;++xe,ye+=st){_e=xt[xe];var vn=_e==null;if(!vn)for(Oe=0;Oe<st;++Oe)Mt=_e[Oe],wt=At[Oe],wt&&(wt.number&&Mt!=null&&(Mt=+Mt,isNaN(Mt)?Mt=null:Mt==1/0?Mt=Se:Mt==-1/0&&(Mt=-Se)),Mt==null&&(wt.required&&(vn=!0),wt.defaultValue!=null&&(Mt=wt.defaultValue))),Xe[ye+Oe]=Mt;if(vn)for(Oe=0;Oe<st;++Oe)Mt=Xe[ye+Oe],Mt!=null&&(wt=At[Oe],wt.autoscale!==!1&&(wt.x&&bt(Be.xaxis,Mt,Mt),wt.y&&bt(Be.yaxis,Mt,Mt))),Xe[ye+Oe]=null;if(Cn&&ye>0&&(!vn||Xe[ye-st]!=null)){for(Oe=0;Oe<st;++Oe)Xe[ye+st+Oe]=Xe[ye+Oe];Xe[ye+1]=Xe[ye-st+1]||0,vn&&(Xe[ye]=_e[0]),ye+=st}}}}for(Ee=0;Ee<a.length;++Ee){if(Be=a[Ee],Xe=Be.datapoints.points,st=Be.datapoints.pointsize,Be.transform==="negative-Y")for(xe=0;xe<Xe.length;xe+=st)Xe[xe]!=null&&(Mt=Xe[xe+1],Xe[xe+1]=-Mt);b(d.processDatapoints,[Be,Be.datapoints])}for(Ee=0;Ee<a.length;++Ee){Be=a[Ee],Xe=Be.datapoints.points,st=Be.datapoints.pointsize,At=Be.datapoints.format;var Wn=ce,Dt=ce,qt=Pe,Yt=Pe;for(xe=0;xe<Xe.length;xe+=st)if(Xe[xe]!=null)for(Oe=0;Oe<st;++Oe)Mt=Xe[xe+Oe],wt=At[Oe],!(!wt||wt.autoscale===!1||Mt==Se||Mt==-Se)&&(wt.x&&(Mt<Wn&&(Wn=Mt),Mt>qt&&(qt=Mt)),wt.y&&(Mt<Dt&&(Dt=Mt),Mt>Yt&&(Yt=Mt)));if(Be.bars.show){var nn;switch(Be.bars.align){case"left":nn=0;break;case"right":nn=-Be.bars.barWidth;break;default:nn=-Be.bars.barWidth/2}Be.bars.horizontal?(Dt+=nn,Yt+=nn+Be.bars.barWidth):(Wn+=nn,qt+=nn+Be.bars.barWidth)}bt(Be.xaxis,Wn,qt),bt(Be.yaxis,Dt,Yt)}ee.each(I(),function(Zt,tn){tn.datamin==ce&&(tn.datamin=null),tn.datamax==Pe&&(tn.datamax=null)})}function W(){r.find(".flot-temp-elem").remove(),r.css("position")=="static"&&r.css("position","relative"),f=new e("flot-base",r),h=new e("flot-overlay",r),i=f.context,x=h.context,u=ee(h.element).unbind();var ce=r.data("plot");ce&&(ce.shutdown(),h.clear()),r.data("plot",D)}function N(){l.grid.hoverable&&(u.mousemove(Ce),u.bind("mouseleave",He),ee(document).bind("touchend",Me)),l.grid.clickable&&u.click(ke),b(d.bindEvents,[u])}function w(){Te&&clearTimeout(Te),u.unbind("mousemove",Ce),u.unbind("mouseleave",He),u.unbind("click",ke),ee(document).unbind("touchend",Me),b(d.shutdown,[u])}function j(ce){function Pe(Oe){return Oe}var Se,Ee,xe=ce.options.transform||Pe,ye=ce.options.inverseTransform;ce.direction=="x"?(Se=ce.scale=y/Math.abs(xe(ce.max)-xe(ce.min)),Ee=Math.min(xe(ce.max),xe(ce.min))):(Se=ce.scale=P/Math.abs(xe(ce.max)-xe(ce.min)),Se=-Se,Ee=Math.max(xe(ce.max),xe(ce.min))),xe==Pe?ce.p2c=function(Oe){return(Oe-Ee)*Se}:ce.p2c=function(Oe){return(xe(Oe)-Ee)*Se},ye?ce.c2p=function(Oe){return ye(Ee+Oe/Se)}:ce.c2p=function(Oe){return Ee+Oe/Se}}function V(ce){for(var Pe=ce.options,Se=ce.ticks||[],Ee=Pe.labelWidth||0,xe=Pe.labelHeight||0,ye=Ee||(ce.direction=="x"?Math.floor(f.width/(Se.length||1)):null),Oe=ce.direction+"Axis "+ce.direction+ce.n+"Axis",we="flot-"+ce.direction+"-axis flot-"+ce.direction+ce.n+"-axis "+Oe,Be=Pe.font||"flot-tick-label tickLabel",Xe=0;Xe<Se.length;++Xe){var st=Se[Xe];if(st.label){var lt=f.getTextInfo(we,st.label,Be,null,ye);Ee=Math.max(Ee,lt.width+1),xe=Math.max(xe,lt.height)}}ce.labelWidth=Pe.labelWidth||Ee,ce.labelHeight=Pe.labelHeight||xe}function U(ce){var Pe=ce.labelWidth,Se=ce.labelHeight,Ee=ce.options.position,xe=ce.direction==="x",ye=ce.options.tickLength,Oe=l.grid.axisMargin,we=l.grid.labelMargin,Be=l.grid.eventSectionHeight,Xe=!0,st=!0,lt=!0,Et=!1;ee.each(xe?g:p,function(Tt,Mt){Mt&&(Mt.show||Mt.reserveSpace)&&(Mt===ce?Et=!0:Mt.options.position===Ee&&(Et?st=!1:Xe=!1),Et||(lt=!1))}),st&&(Oe=0),ye==null&&(ye=lt?"full":5),isNaN(+ye)||(we+=+ye),xe?(Se+=we,Se+=Be,Ee=="bottom"?(c.bottom+=Se+Oe,ce.box={top:f.height-c.bottom,height:Se}):(ce.box={top:c.top+Oe,height:Se},c.top+=Se+Oe)):(Pe+=we,Ee=="left"?(ce.box={left:c.left+Oe,width:Pe},c.left+=Pe+Oe):(c.right+=Pe+Oe,ce.box={left:f.width-c.right,width:Pe})),ce.position=Ee,ce.tickLength=ye,ce.box.padding=we,ce.box.eventSectionPadding=Be,ce.innermost=Xe}function F(ce){ce.direction=="x"?(ce.box.left=c.left-ce.labelWidth/2,ce.box.width=f.width-c.left-c.right+ce.labelWidth):(ce.box.top=c.top-ce.labelHeight/2,ce.box.height=f.height-c.bottom-c.top+ce.labelHeight)}function M(){var ce=l.grid.minBorderMargin,Pe,Se;if(ce==null)for(ce=0,Se=0;Se<a.length;++Se)ce=Math.max(ce,2*(a[Se].points.radius+a[Se].points.lineWidth/2));var Ee={left:ce,right:ce,top:ce,bottom:ce};ee.each(I(),function(xe,ye){ye.reserveSpace&&ye.ticks&&ye.ticks.length&&(ye.direction==="x"?(Ee.left=Math.max(Ee.left,ye.labelWidth/2),Ee.right=Math.max(Ee.right,ye.labelWidth/2)):(Ee.bottom=Math.max(Ee.bottom,ye.labelHeight/2),Ee.top=Math.max(Ee.top,ye.labelHeight/2)))}),c.left=Math.ceil(Math.max(Ee.left,c.left)),c.right=Math.ceil(Math.max(Ee.right,c.right)),c.top=Math.ceil(Math.max(Ee.top,c.top)),c.bottom=Math.ceil(Math.max(Ee.bottom,c.bottom))}function H(){var ce,Pe=I(),Se=l.grid.show;for(var Ee in c){var xe=l.grid.margin||0;c[Ee]=typeof xe=="number"?xe:xe[Ee]||0}b(d.processOffset,[c]);for(var Ee in c)typeof l.grid.borderWidth=="object"?c[Ee]+=Se?l.grid.borderWidth[Ee]:0:c[Ee]+=Se?l.grid.borderWidth:0;if(ee.each(Pe,function(we,Be){var Xe=Be.options;Be.show=Xe.show==null?Be.used:Xe.show,Be.reserveSpace=Xe.reserveSpace==null?Be.show:Xe.reserveSpace,_(Be)}),b(d.processRange,[]),Se){for(var ye=ee.grep(Pe,function(we){return we.show||we.reserveSpace}),Oe=!1,ce=0;ce<2&&(ee.each(ye,function(Be,Xe){ne(Xe),te(Xe),Oe=Y(Xe,Xe.ticks)||Oe,V(Xe)}),Oe&&d.processRange.length>0);ce++)b(d.processRange,[]),Oe=!1;for(ce=ye.length-1;ce>=0;--ce)U(ye[ce]);M(),ee.each(ye,function(we,Be){F(Be)})}y=f.width-c.left-c.right,P=f.height-c.bottom-c.top,ee.each(Pe,function(we,Be){j(Be)}),Se&&se(),me()}function _(ce){var Pe=ce.options,Se=+(Pe.min!=null?Pe.min:ce.datamin),Ee=+(Pe.max!=null?Pe.max:ce.datamax),xe=Ee-Se;if(xe==0){var ye=.25,Oe=Math.abs(Ee==0?1:Ee*ye);Pe.min==null&&(Se-=Oe),(Pe.max==null||Pe.min!=null)&&(Ee+=Oe)}else{var we=Pe.autoscaleMargin;we!=null&&(Pe.min==null&&(Se-=xe*we,Se<0&&ce.datamin!=null&&ce.datamin>=0&&(Se=0)),Pe.max==null&&(Ee+=xe*we,Ee>0&&ce.datamax!=null&&ce.datamax<=0&&(Ee=0)))}ce.min=Se,ce.max=Ee}function Z(ce){if(ce=Math.abs(String(ce).replace(".","")),ce==0)return 0;for(;ce!=0&&ce%10==0;)ce/=10;return Math.floor(Math.log(ce)/Math.LN10)+1}function ne(ce){var Pe=ce.options,Se;typeof Pe.ticks=="number"&&Pe.ticks>0?Se=Pe.ticks:Se=.3*Math.sqrt(ce.direction=="x"?f.width:f.height);var Ee=(ce.max-ce.min)/Se,xe=-Math.floor(Math.log(Ee)/Math.LN10),ye=Pe.tickDecimals;ye!=null&&xe>ye&&(xe=ye);var Oe=Math.pow(10,-xe),we=Ee/Oe,Be;if(we<1.5?Be=1:we<3?(Be=2,we>2.25&&(ye==null||xe+1<=ye)&&(Be=2.5,++xe)):we<7.5?Be=5:Be=10,Be*=Oe,Pe.minTickSize!=null&&Be<Pe.minTickSize&&(Be=Pe.minTickSize),ce.delta=Ee,ce.tickDecimals=Math.max(0,ye??xe),ce.tickSize=Pe.tickSize||Be,Pe.mode=="time"&&!ce.tickGenerator)throw new Error("Time mode requires the flot.time plugin.");
1566if(ce.tickGenerator||(ce.tickGenerator=function(Tt){var Mt=[],wt=n(Tt.min,Tt.tickSize),_e=0,xt=Number.NaN,At;do At=xt,xt=wt+_e*Tt.tickSize,Mt.push(xt),++_e;while(xt<Tt.max&&xt!=At);return Mt},ce.tickFormatter=function(Tt,Mt){var wt=Mt.tickDecimals?Math.pow(10,Mt.tickDecimals):1,_e=""+Math.round(Tt*wt)/wt;if(Mt.tickDecimals!=null){var xt=_e.indexOf("."),At=xt==-1?0:_e.length-xt-1;if(At<Mt.tickDecimals)return(At?_e:_e+".")+(""+wt).substr(1,Mt.tickDecimals-At)}return _e}),ee.isFunction(Pe.tickFormatter)&&(ce.tickFormatter=function(Tt,Mt){return""+Pe.tickFormatter(Tt,Mt)}),Pe.alignTicksWithAxis!=null){var Xe=(ce.direction=="x"?g:p)[Pe.alignTicksWithAxis-1];if(Xe&&Xe.used&&Xe!=ce){var st=ce.tickGenerator(ce);if(st.length>0&&(Pe.min==null&&(ce.min=Math.min(ce.min,st[0])),Pe.max==null&&st.length>1&&(ce.max=Math.max(ce.max,st[st.length-1]))),ce.tickGenerator=function(Tt){var Mt=[],wt,_e;for(_e=0;_e<Xe.ticks.length;++_e)wt=(Xe.ticks[_e].v-Xe.min)/(Xe.max-Xe.min),wt=Tt.min+wt*(Tt.max-Tt.min),Mt.push(wt);return Mt},!ce.mode&&Pe.tickDecimals==null){var lt=Math.max(0,-Math.floor(Math.log(ce.delta)/Math.LN10)+1),Et=ce.tickGenerator(ce);Et.length>1&&/\..*0$/.test((Et[1]-Et[0]).toFixed(lt))||(ce.tickDecimals=lt)}}}}function te(ce){var Pe=ce.options.ticks,Se=[];Pe==null||typeof Pe=="number"&&Pe>0?Se=ce.tickGenerator(ce):Pe&&(ee.isFunction(Pe)?Se=Pe(ce):Se=Pe);var Ee,xe;for(ce.ticks=[],Ee=0;Ee<Se.length;++Ee){var ye=null,Oe=Se[Ee];typeof Oe=="object"?(xe=+Oe[0],Oe.length>1&&(ye=Oe[1])):xe=+Oe,ye==null&&(ye=ce.tickFormatter(xe,ce)),isNaN(xe)||ce.ticks.push({v:xe,label:ye})}}function Y(ce,Pe){var Se=!1;return ce.options.autoscaleMargin&&Pe.length>0&&(ce.options.min==null&&(ce.min=Math.min(ce.min,Pe[0].v),Se=!0),ce.options.max==null&&Pe.length>1&&(ce.max=Math.max(ce.max,Pe[Pe.length-1].v),Se=!0)),Se}function Q(){f.clear(),b(d.drawBackground,[i]);var ce=l.grid;ce.show&&ce.backgroundColor&&q(),ce.show&&!ce.aboveData&&X();for(var Pe=0;Pe<a.length;++Pe)b(d.drawSeries,[i,a[Pe]]),ae(a[Pe]);b(d.draw,[i]),ce.show&&ce.aboveData&&X(),f.render(),Ke()}function J(ce,Pe){for(var Se,Ee,xe,ye,Oe=I(),we=0;we<Oe.length;++we)if(Se=Oe[we],Se.direction==Pe&&(ye=Pe+Se.n+"axis",!ce[ye]&&Se.n==1&&(ye=Pe+"axis"),ce[ye])){Ee=ce[ye].from,xe=ce[ye].to;break}if(ce[ye]||(Se=Pe=="x"?g[0]:p[0],Ee=ce[Pe+"1"],xe=ce[Pe+"2"]),Ee!=null&&xe!=null&&Ee>xe){var Be=Ee;Ee=xe,xe=Be}return{from:Ee,to:xe,axis:Se}}function q(){i.save(),i.translate(c.left,c.top),i.fillStyle=Ge(l.grid.backgroundColor,P,0,"rgba(255, 255, 255, 0)"),i.fillRect(0,0,y,P),i.restore()}function X(){var ce,Pe,Se,Ee;i.save(),i.translate(c.left,c.top);var xe=l.grid.markings;if(xe)for(ee.isFunction(xe)&&(Pe=D.getAxes(),Pe.xmin=Pe.xaxis.min,Pe.xmax=Pe.xaxis.max,Pe.ymin=Pe.yaxis.min,Pe.ymax=Pe.yaxis.max,xe=xe(Pe)),ce=0;ce<xe.length;++ce){var ye=xe[ce],Oe=J(ye,"x"),we=J(ye,"y");if(Oe.from==null&&(Oe.from=Oe.axis.min),Oe.to==null&&(Oe.to=Oe.axis.max),we.from==null&&(we.from=we.axis.min),we.to==null&&(we.to=we.axis.max),!(Oe.to<Oe.axis.min||Oe.from>Oe.axis.max||we.to<we.axis.min||we.from>we.axis.max)){Oe.from=Math.max(Oe.from,Oe.axis.min),Oe.to=Math.min(Oe.to,Oe.axis.max),we.from=Math.max(we.from,we.axis.min),we.to=Math.min(we.to,we.axis.max);var Be=Oe.from===Oe.to,Xe=we.from===we.to;if(!(Be&&Xe))if(Oe.from=Math.floor(Oe.axis.p2c(Oe.from)),Oe.to=Math.floor(Oe.axis.p2c(Oe.to)),we.from=Math.floor(we.axis.p2c(we.from)),we.to=Math.floor(we.axis.p2c(we.to)),Be||Xe){var st=ye.lineWidth||l.grid.markingsLineWidth,lt=st%2?.5:0;i.beginPath(),i.strokeStyle=ye.color||l.grid.markingsColor,i.lineWidth=st,Be?(i.moveTo(Oe.to+lt,we.from),i.lineTo(Oe.to+lt,we.to)):(i.moveTo(Oe.from,we.to+lt),i.lineTo(Oe.to,we.to+lt)),i.stroke()}else i.fillStyle=ye.color||l.grid.markingsColor,i.fillRect(Oe.from,we.to,Oe.to-Oe.from,we.from-we.to)}}Pe=I(),Se=l.grid.borderWidth;for(var Et=0;Et<Pe.length;++Et){var Tt=Pe[Et],Mt=Tt.box,wt=Tt.tickLength,_e,xt,At,bt;if(!(!Tt.show||Tt.ticks.length==0)){for(i.lineWidth=1,Tt.direction=="x"?(_e=0,wt=="full"?xt=Tt.position=="top"?0:P:xt=Mt.top-c.top+(Tt.position=="top"?Mt.height:0)):(xt=0,wt=="full"?_e=Tt.position=="left"?0:y:_e=Mt.left-c.left+(Tt.position=="left"?Mt.width:0)),Tt.innermost||(i.strokeStyle=Tt.options.color,i.beginPath(),At=bt=0,Tt.direction=="x"?At=y+1:bt=P+1,i.lineWidth==1&&(Tt.direction=="x"?xt=Math.floor(xt)+.5:_e=Math.floor(_e)+.5),i.moveTo(_e,xt),i.lineTo(_e+At,xt+bt),i.stroke()),i.strokeStyle=Tt.options.tickColor,i.beginPath(),ce=0;ce<Tt.ticks.length;++ce){var Xt=Tt.ticks[ce].v;At=bt=0,!(isNaN(Xt)||Xt<Tt.min||Xt>Tt.max||wt=="full"&&(typeof Se=="object"&&Se[Tt.position]>0||Se>0)&&(Xt==Tt.min||Xt==Tt.max))&&(Tt.direction=="x"?(_e=Tt.p2c(Xt),bt=wt=="full"?-P:wt,Tt.position=="top"&&(bt=-bt)):(xt=Tt.p2c(Xt),At=wt=="full"?-y:wt,Tt.position=="left"&&(At=-At)),i.lineWidth==1&&(Tt.direction=="x"?_e=Math.floor(_e)+.5:xt=Math.floor(xt)+.5),i.moveTo(_e,xt),i.lineTo(_e+At,xt+bt))}i.stroke()}}Se&&(Ee=l.grid.borderColor,typeof Se=="object"||typeof Ee=="object"?(typeof Se!="object"&&(Se={top:Se,right:Se,bottom:Se,left:Se}),typeof Ee!="object"&&(Ee={top:Ee,right:Ee,bottom:Ee,left:Ee}),Se.top>0&&(i.strokeStyle=Ee.top,i.lineWidth=Se.top,i.beginPath(),i.moveTo(0-Se.left,0-Se.top/2),i.lineTo(y,0-Se.top/2),i.stroke()),Se.right>0&&(i.strokeStyle=Ee.right,i.lineWidth=Se.right,i.beginPath(),i.moveTo(y+Se.right/2,0-Se.top),i.lineTo(y+Se.right/2,P),i.stroke()),Se.bottom>0&&(i.strokeStyle=Ee.bottom,i.lineWidth=Se.bottom,i.beginPath(),i.moveTo(y+Se.right,P+Se.bottom/2),i.lineTo(0,P+Se.bottom/2),i.stroke()),Se.left>0&&(i.strokeStyle=Ee.left,i.lineWidth=Se.left,i.beginPath(),i.moveTo(0-Se.left/2,P+Se.bottom),i.lineTo(0-Se.left/2,0),i.stroke())):(i.lineWidth=Se,i.strokeStyle=l.grid.borderColor,i.strokeRect(-Se/2,-Se/2,y+Se,P+Se))),i.restore(
1566)}function se(){ee.each(I(),function(ce,Pe){var Se=Pe.box,Ee=Pe.direction+"Axis "+Pe.direction+Pe.n+"Axis",xe="flot-"+Pe.direction+"-axis flot-"+Pe.direction+Pe.n+"-axis "+Ee,ye=Pe.options.font||"flot-tick-label tickLabel",Oe,we,Be,Xe,st;if(f.removeText(xe),!(!Pe.show||Pe.ticks.length==0))for(var lt=0;lt<Pe.ticks.length;++lt)Oe=Pe.ticks[lt],!(!Oe.label||Oe.v<Pe.min||Oe.v>Pe.max)&&(Pe.direction=="x"?(Xe="center",we=c.left+Pe.p2c(Oe.v),Pe.position=="bottom"?Be=Se.top+Se.padding+Se.eventSectionPadding:(Be=Se.top+Se.height-Se.padding,st="bottom")):(st="middle",Be=c.top+Pe.p2c(Oe.v),Pe.position=="left"?(we=Se.left+Se.width-Se.padding,Xe="right"):we=Se.left+Se.padding),f.addText(xe,we,Be,Oe.label,ye,null,null,Xe,st))})}function oe(ce){for(var Pe=[],Se=null,Ee=null,xe=ce.datapoints,ye=[],Oe=0;Oe<xe.pointsize-2;Oe++)ye.push(0);for(var we=0;we<xe.points.length;we+=xe.pointsize){var Be=xe.points[we],Xe=xe.points[we+1];we===xe.points.length-xe.pointsize?Ee=null:Ee=xe.points[we+xe.pointsize],Be!==null&&Xe!==null&&Se===null&&Ee===null&&(Pe.push(Be),Pe.push(Xe),Pe.push.apply(Pe,ye)),Se=Be}var st=xe.points;xe.points=Pe,ce.points.radius=ce.lines.lineWidth/2,fe(ce),xe.points=st}function ae(ce){ce.lines.show&&(ie(ce),!ce.points.show&&!ce.bars.show&&oe(ce)),ce.bars.show&&de(ce),ce.points.show&&fe(ce)}function ie(ce){function Pe(we,Be,Xe,st,lt){var Et=we.points,Tt=we.pointsize,Mt=null,wt=null;i.beginPath();for(var _e=Tt;_e<Et.length;_e+=Tt){var xt=Et[_e-Tt],At=Et[_e-Tt+1],bt=Et[_e],Xt=Et[_e+1];if(!(xt==null||bt==null)){if(At<=Xt&&At<lt.min){if(Xt<lt.min)continue;xt=(lt.min-At)/(Xt-At)*(bt-xt)+xt,At=lt.min}else if(Xt<=At&&Xt<lt.min){if(At<lt.min)continue;bt=(lt.min-At)/(Xt-At)*(bt-xt)+xt,Xt=lt.min}if(At>=Xt&&At>lt.max){if(Xt>lt.max)continue;xt=(lt.max-At)/(Xt-At)*(bt-xt)+xt,At=lt.max}else if(Xt>=At&&Xt>lt.max){if(At>lt.max)continue;bt=(lt.max-At)/(Xt-At)*(bt-xt)+xt,Xt=lt.max}if(xt<=bt&&xt<st.min){if(bt<st.min)continue;At=(st.min-xt)/(bt-xt)*(Xt-At)+At,xt=st.min}else if(bt<=xt&&bt<st.min){if(xt<st.min)continue;Xt=(st.min-xt)/(bt-xt)*(Xt-At)+At,bt=st.min}if(xt>=bt&&xt>st.max){if(bt>st.max)continue;At=(st.max-xt)/(bt-xt)*(Xt-At)+At,xt=st.max}else if(bt>=xt&&bt>st.max){if(xt>st.max)continue;Xt=(st.max-xt)/(bt-xt)*(Xt-At)+At,bt=st.max}(xt!=Mt||At!=wt)&&i.moveTo(st.p2c(xt)+Be,lt.p2c(At)+Xe),Mt=bt,wt=Xt,i.lineTo(st.p2c(bt)+Be,lt.p2c(Xt)+Xe)}}i.stroke()}function Se(we,Be,Xe){for(var st=we.points,lt=we.pointsize,Et=Math.min(Math.max(0,Xe.min),Xe.max),Tt=0,Mt,wt=!1,_e=1,xt=0,At=0;!(lt>0&&Tt>st.length+lt);){Tt+=lt;var bt=st[Tt-lt],Xt=st[Tt-lt+_e],Cn=st[Tt],vn=st[Tt+_e];if(wt){if(lt>0&&bt!=null&&Cn==null){At=Tt,lt=-lt,_e=2;continue}if(lt<0&&Tt==xt+lt){i.fill(),wt=!1,lt=-lt,_e=1,Tt=xt=At+lt;continue}}if(!(bt==null||Cn==null)){if(bt<=Cn&&bt<Be.min){if(Cn<Be.min)continue;Xt=(Be.min-bt)/(Cn-bt)*(vn-Xt)+Xt,bt=Be.min}else if(Cn<=bt&&Cn<Be.min){if(bt<Be.min)continue;vn=(Be.min-bt)/(Cn-bt)*(vn-Xt)+Xt,Cn=Be.min}if(bt>=Cn&&bt>Be.max){if(Cn>Be.max)continue;Xt=(Be.max-bt)/(Cn-bt)*(vn-Xt)+Xt,bt=Be.max}else if(Cn>=bt&&Cn>Be.max){if(bt>Be.max)continue;vn=(Be.max-bt)/(Cn-bt)*(vn-Xt)+Xt,Cn=Be.max}if(wt||(i.beginPath(),i.moveTo(Be.p2c(bt),Xe.p2c(Et)),wt=!0),Xt>=Xe.max&&vn>=Xe.max){i.lineTo(Be.p2c(bt),Xe.p2c(Xe.max)),i.lineTo(Be.p2c(Cn),Xe.p2c(Xe.max));continue}else if(Xt<=Xe.min&&vn<=Xe.min){i.lineTo(Be.p2c(bt),Xe.p2c(Xe.min)),i.lineTo(Be.p2c(Cn),Xe.p2c(Xe.min));continue}var Wn=bt,Dt=Cn;Xt<=vn&&Xt<Xe.min&&vn>=Xe.min?(bt=(Xe.min-Xt)/(vn-Xt)*(Cn-bt)+bt,Xt=Xe.min):vn<=Xt&&vn<Xe.min&&Xt>=Xe.min&&(Cn=(Xe.min-Xt)/(vn-Xt)*(Cn-bt)+bt,vn=Xe.min),Xt>=vn&&Xt>Xe.max&&vn<=Xe.max?(bt=(Xe.max-Xt)/(vn-Xt)*(Cn-bt)+bt,Xt=Xe.max):vn>=Xt&&vn>
1566Xe.max&&Xt<=Xe.max&&(Cn=(Xe.max-Xt)/(vn-Xt)*(Cn-bt)+bt,vn=Xe.max),bt!=Wn&&i.lineTo(Be.p2c(Wn),Xe.p2c(Xt)),i.lineTo(Be.p2c(bt),Xe.p2c(Xt)),i.lineTo(Be.p2c(Cn),Xe.p2c(vn)),Cn!=Dt&&(i.lineTo(Be.p2c(Cn),Xe.p2c(vn)),i.lineTo(Be.p2c(Dt),Xe.p2c(vn)))}}}i.save(),i.translate(c.left,c.top),i.lineJoin="round";var Ee=ce.lines.lineWidth,xe=ce.shadowSize;if(Ee>0&&xe>0){i.lineWidth=xe,i.strokeStyle="rgba(0,0,0,0.1)";var ye=Math.PI/18;Pe(ce.datapoints,Math.sin(ye)*(Ee/2+xe/2),Math.cos(ye)*(Ee/2+xe/2),ce.xaxis,ce.yaxis),i.lineWidth=xe/2,Pe(ce.datapoints,Math.sin(ye)*(Ee/2+xe/4),Math.cos(ye)*(Ee/2+xe/4),ce.xaxis,ce.yaxis)}i.lineWidth=Ee,i.strokeStyle=ce.color;var Oe=le(ce.lines,ce.color,0,P);Oe&&(i.fillStyle=Oe,Se(ce.datapoints,ce.xaxis,ce.yaxis)),Ee>0&&Pe(ce.datapoints,0,0,ce.xaxis,ce.yaxis),i.restore()}function fe(ce){function Pe(we,Be,Xe,st,lt,Et,Tt,Mt){for(var wt=we.points,_e=we.pointsize,xt=0;xt<wt.length;xt+=_e){var At=wt[xt],bt=wt[xt+1];At==null||At<Et.min||At>Et.max||bt<Tt.min||bt>Tt.max||(i.beginPath(),At=Et.p2c(At),bt=Tt.p2c(bt)+st,Mt=="circle"?i.arc(At,bt,Be,0,lt?Math.PI:Math.PI*2,!1):Mt(i,At,bt,Be,lt),i.closePath(),Xe&&(i.fillStyle=Xe,i.fill()),i.stroke())}}i.save(),i.translate(c.left,c.top);var Se=ce.points.lineWidth,Ee=ce.shadowSize,xe=ce.points.radius,ye=ce.points.symbol;if(Se==0&&(Se=1e-4),Se>0&&Ee>0){var Oe=Ee/2;i.lineWidth=Oe,i.strokeStyle="rgba(0,0,0,0.1)",Pe(ce.datapoints,xe,null,Oe+Oe/2,!0,ce.xaxis,ce.yaxis,ye),i.strokeStyle="rgba(0,0,0,0.2)",Pe(ce.datapoints,xe,null,Oe/2,!0,ce.xaxis,ce.yaxis,ye)}i.lineWidth=Se,i.strokeStyle=ce.color,Pe(ce.datapoints,xe,le(ce.points,ce.color),0,!1,ce.xaxis,ce.yaxis,ye),i.restore()}function pe(ce,Pe,Se,Ee,xe,ye,Oe,we,Be,Xe,st){var lt,Et,Tt,Mt,wt,_e,xt,At,bt;Xe?(At=_e=xt=!0,wt=!1,lt=Se,Et=ce,Mt=Pe+Ee,Tt=Pe+xe,Et<lt&&(bt=Et,Et=lt,lt=bt,wt=!0,_e=!1)):(wt=_e=xt=!0,At=!1,lt=ce+Ee,Et=ce+xe,Tt=Se,Mt=Pe,Mt<Tt&&(bt=Mt,Mt=Tt,Tt=bt,At=!0,xt=!1)),!(Et<Oe.min||lt>Oe.max||Mt<we.min||Tt>we.max)&&(lt<Oe.min&&(lt=Oe.min,wt=!1),Et>Oe.max&&(Et=Oe.max,_e=!1),Tt<we.min&&(Tt=we.min,At=!1),Mt>we.max&&(Mt=we.max,xt=!1),lt=Oe.p2c(lt),Tt=we.p2c(Tt),Et=Oe.p2c(Et),Mt=we.p2c(Mt),ye&&(Be.fillStyle=ye(Tt,Mt),Be.fillRect(lt,Mt,Et-lt,Tt-Mt)),st>0&&(wt||_e||xt||At)&&(Be.beginPath(),Be.moveTo(lt,Tt),wt?Be.lineTo(lt,Mt):Be.moveTo(lt,Mt),xt?Be.lineTo(Et,Mt):Be.moveTo(Et,Mt),_e?Be.lineTo(Et,Tt):Be.moveTo(Et,Tt),At?Be.lineTo(lt,Tt):Be.moveTo(lt,Tt),Be.stroke()))}function de(ce){function Pe(xe,ye,Oe,we,Be,Xe){for(var st=xe.points,lt=xe.pointsize,Et=0;Et<st.length;Et+=lt)st[Et]!=null&&pe(st[Et],st[Et+1],st[Et+2],ye,Oe,we,Be,Xe,i,ce.bars.horizontal,ce.bars.lineWidth)}i.save(),i.translate(c.left,c.top),i.lineWidth=ce.bars.lineWidth,i.strokeStyle=ce.color;var Se;switch(ce.bars.align){case"left":Se=0;break;case"right":Se=-ce.bars.barWidth;break;default:Se=-ce.bars.barWidth/2}var Ee=ce.bars.fill?function(xe,ye){return le(ce.bars,ce.color,xe,ye)}:null;Pe(ce.datapoints,Se,Se+ce.bars.barWidth,Ee,ce.xaxis,ce.yaxis),i.restore()}function le(ce,Pe,Se,Ee){var xe=ce.fill;if(!xe)return null;if(ce.fillColor)return Ge(ce.fillColor,Se,Ee,Pe);var ye=ee.color.parse(Pe);return ye.a=typeof xe=="number"?xe:.4,ye.normalize(),ye.toString()}function me(){if(l.legend.container!=null?ee.find(l.legend.container).html(""):r.find(".legend").remove(),!!l.legend.show){for(var ce=[],Pe=[],Se=!1,Ee=l.legend.labelFormatter,xe,ye,Oe=0;Oe<a.length;++Oe)xe=a[Oe],xe.label&&(ye=Ee?Ee(xe.label,xe):xe.label,ye&&Pe.push({label:ye,color:xe.color}));if(l.legend.sorted)if(ee.isFunction(l.legend.sorted))Pe.sort(l.legend.sorted);else if(l.legend.sorted=="reverse")Pe.reverse();else{var we=l.legend.sorted!="descending";Pe.sort(function(_e,xt){return _e.label==xt.label?0:_e.label<xt.label!=we?1:-1})}for(var Oe=0;Oe<Pe.length;++Oe){var Be=Pe[Oe];Oe%l.legend.noColumns==0&&(Se&&ce.push("</tr>"),ce.push("<tr>"),Se=!0),ce.push('<td class="legendColorBox"><div style="border:1px solid '+l.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+Be.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+Be.label+"</td>")}if(Se&&ce.push("</tr>"),ce.length!=0){var Xe='<table style="font-size:smaller;color:'+l.grid.color+'">'+ce.join("")+"</table>";if(l.legend.container!=null)ee(l.legend.container).html(Xe);else{var st="",lt=l.legend.position,Et=l.legend.margin;Et[0]==null&&(Et=[Et,Et]),lt.charAt(0)=="n"?st+="top:"+(Et[1]+c.top)+"px;":lt.charAt(0)=="s"&&(st+="bottom:"+(Et[1]+c.bottom)+"px;"),lt.charAt(1)=="e"?st+="right:"+(Et[0]+c.right)+"px;":lt.charAt(1)=="w"&&(st+="left:"+(Et[0]+c.left)+"px;");var Tt=ee('<div class="legend">'+Xe.replace('style="','style="position:absolute;'+st+";")+"</div>").appendTo(r);if(l.legend.backgroundOpacity!=0){var Mt=l.legend.backgroundColor;Mt==null&&(Mt=l.grid.backgroundColor,Mt&&typeof Mt=="string"?Mt=ee.color.parse(Mt):Mt=ee.color.extract(Tt,"background-color"),Mt.a=1,Mt=Mt.toString());var wt=Tt.children();ee('<div style="position:absolute;width:'+wt.width()+"px;height:"+wt.height()+"px;
1566"+st+"background-color:"+Mt+';"> </div>').prependTo(Tt).css("opacity",l.legend.backgroundOpacity)}}}}}var De=[],Te=null;function Ne(ce,Pe,Se){var Ee=l.grid.mouseActiveRadius,xe=Ee*Ee+1,ye=null,Oe=!1,we,Be,Xe;for(we=a.length-1;we>=0;--we)if(Se(a[we])){var st=a[we],lt=st.xaxis,Et=st.yaxis,Tt=st.datapoints.points,Mt=lt.c2p(ce),wt=Et.c2p(Pe),_e=Ee/lt.scale,xt=Ee/Et.scale;if(Xe=st.datapoints.pointsize,lt.options.inverseTransform&&(_e=Number.MAX_VALUE),Et.options.inverseTransform&&(xt=Number.MAX_VALUE),st.lines.show||st.points.show)for(Be=0;Be<Tt.length;Be+=Xe){var At=Tt[Be],bt=Tt[Be+1];if(At!=null&&!(At-Mt>_e||At-Mt<-_e||bt-wt>xt||bt-wt<-xt)){var Xt=Math.abs(lt.p2c(At)-ce),Cn=Math.abs(Et.p2c(bt)-Pe),vn=Xt*Xt+Cn*Cn;vn<xe&&(xe=vn,ye=[we,Be/Xe])}}if(st.bars.show&&!ye){var Wn,Dt;switch(st.bars.align){case"left":Wn=0;break;case"right":Wn=-st.bars.barWidth;break;default:Wn=-st.bars.barWidth/2}for(Dt=Wn+st.bars.barWidth,Be=0;Be<Tt.length;Be+=Xe){var At=Tt[Be],bt=Tt[Be+1],qt=Tt[Be+2];At!=null&&(a[we].bars.horizontal?Mt<=Math.max(qt,At)&&Mt>=Math.min(qt,At)&&wt>=bt+Wn&&wt<=bt+Dt:Mt>=At+Wn&&Mt<=At+Dt&&wt>=Math.min(qt,bt)&&wt<=Math.max(qt,bt))&&(ye=[we,Be/Xe])}}}return ye?(we=ye[0],Be=ye[1],Xe=a[we].datapoints.pointsize,{datapoint:a[we].datapoints.points.slice(Be*Xe,(Be+1)*Xe),dataIndex:Be,series:a[we],seriesIndex:we}):null}function Ce(ce){l.grid.hoverable&&tt("plothover",ce,function(Pe){return Pe.hoverable!=!1})}function He(ce){l.grid.hoverable&&tt("plothover",ce,function(Pe){return!1})}function ke(ce){D.isSelecting||tt("plotclick",ce,function(Pe){return Pe.clickable!=!1})}function Me(ce){if(ce.cancelable){if(!u.is(ce.target)&&u.has(ce.target).length===0){tt("plotleave",ce,function(Pe){});return}Ce($e(ce)),ce.preventDefault()}}function $e(ce){if(!ce||!ce.originalEvent||ce.pageX&&ce.pageY)return ce;var Pe=ce.originalEvent;if(Pe.changedTouches.length===0)return ce;var Se=Pe.changedTouches[0];return ce.pageX=Se.pageX,ce.pageY=Se.pageY,ce}function tt(ce,Pe,Se){var Ee=u.offset(),xe=Pe.pageX-Ee.left-c.left,ye=Pe.pageY-Ee.top-c.top,Oe=R({left:xe,top:ye});Oe.pageX=Pe.pageX,Oe.pageY=Pe.pageY,Oe.ctrlKey=Pe.ctrlKey,Oe.metaKey=Pe.metaKey;var we=Ne(xe,ye,Se);if(we&&(we.pageX=parseInt(we.series.xaxis.p2c(we.datapoint[0])+Ee.left+c.left,10),we.pageY=parseInt(we.series.yaxis.p2c(we.datapoint[1])+Ee.top+c.top,10)),l.grid.autoHighlight){for(var Be=0;Be<De.length;++Be){var Xe=De[Be];Xe.auto==ce&&!(we&&Xe.series==we.series&&Xe.point[0]==we.datapoint[0]&&Xe.point[1]==we.datapoint[1])&&Qe(Xe.series,Xe.point)}we&&Ve(we.series,we.datapoint,ce)}r.trigger(ce,[Oe,we])}function Ke(){var ce=l.interaction.redrawOverlayInterval;if(ce==-1){Re();return}Te||(Te=setTimeout(Re,ce))}function Re(){Te=null,x.save(),h.clear(),x.translate(c.left,c.top);var ce,Pe;for(ce=0;ce<De.length;++ce)Pe=De[ce],Pe.series.bars.show?Ye(Pe.series,Pe.point):ze(Pe.series,Pe.point);
1566x.restore(),b(d.drawOverlay,[x])}function Ve(ce,Pe,Se){if(typeof ce=="number"&&(ce=a[ce]),typeof Pe=="number"){var Ee=ce.datapoints.pointsize;Pe=ce.datapoints.points.slice(Ee*Pe,Ee*(Pe+1))}var xe=je(ce,Pe);xe==-1?(De.push({series:ce,point:Pe,auto:Se}),Ke()):Se||(De[xe].auto=!1)}function Qe(ce,Pe){if(ce==null&&Pe==null){De=[],Ke();return}if(typeof ce=="number"&&(ce=a[ce]),typeof Pe=="number"){var Se=ce.datapoints.pointsize;Pe=ce.datapoints.points.slice(Se*Pe,Se*(Pe+1))}var Ee=je(ce,Pe);Ee!=-1&&(De.splice(Ee,1),Ke())}function je(ce,Pe){for(var Se=0;Se<De.length;++Se){var Ee=De[Se];if(Ee.series==ce&&Ee.point[0]==Pe[0]&&Ee.point[1]==Pe[1])return Se}return-1}function ze(ce,Pe){var Se=Pe[0],Ee=Pe[1],xe=ce.xaxis,ye=ce.yaxis,Oe=typeof ce.highlightColor=="string"?ce.highlightColor:ee.color.parse(ce.color).scale("a",.5).toString();if(!(Se<xe.min||Se>xe.max||Ee<ye.min||Ee>ye.max)){var we=ce.points.radius+ce.points.lineWidth/2;x.lineWidth=we,x.strokeStyle=Oe;var Be=1.5*we;Se=xe.p2c(Se),Ee=ye.p2c(Ee),x.beginPath(),ce.points.symbol=="circle"?x.arc(Se,Ee,Be,0,2*Math.PI,!1):ce.points.symbol(x,Se,Ee,Be,!1),x.closePath(),x.stroke()}}function Ye(ce,Pe){var Se=typeof ce.highlightColor=="string"?ce.highlightColor:ee.color.parse(ce.color).scale("a",.5).toString(),Ee=Se,xe;switch(ce.bars.align){case"left":xe=0;break;case"right":xe=-ce.bars.barWidth;break;default:xe=-ce.bars.barWidth/2}x.lineWidth=ce.bars.lineWidth,x.strokeStyle=Se,pe(Pe[0],Pe[1],Pe[2]||0,xe,xe+ce.bars.barWidth,function(){return Ee},ce.xaxis,ce.yaxis,x,ce.bars.horizontal,ce.bars.lineWidth)}function Ge(ce,Pe,Se,Ee){if(typeof ce=="string")return ce;for(var xe=i.createLinearGradient(0,Se,0,Pe),ye=0,Oe=ce.colors.length;ye<Oe;++ye){var we=ce.colors[ye];if(typeof we!="string"){var Be=ee.color.parse(Ee);we.brightness!=null&&(Be=Be.scale("rgb",we.brightness)),we.opacity!=null&&(Be.a*=we.opacity),we=Be.toString()}xe.addColorStop(ye/(Oe-1),we)}return xe}}ee.plot=function(r,o,s){var m=new t(ee(r),o,s,ee.plot.plugins);return m},ee.plot.version="0.8.3",ee.plot.plugins=[],ee.fn.plot=function(r,o){return this.each(function(){ee.plot(this,r,o)})};function n(r,o){return o*Math.floor(r/o)}}(jQuery)},80851:()=>{(function(ee){function B(e){var t={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},n={},r=null;function o(c){t.active&&(u(c),e.getPlaceholder().trigger("plotselecting",[a()]))}function s(c){c.which==1&&(document.body.focus(),document.onselectstart!==void 0&&n.onselectstart==null&&(n.onselectstart=document.onselectstart,document.onselectstart=function(){return!1}),document.ondrag!==void 0&&n.ondrag==null&&(n.ondrag=document.ondrag,document.ondrag=function(){return!1}),h(t.first,c),t.active=!0,r=function(y){m(y)},ee(document).one("mouseup",r))}function m(c){return r=null,document.onselectstart!==void 0&&(document.onselectstart=n.onselectstart),document.ondrag!==void 0&&(document.ondrag=n.ondrag),t.active=!1,u(c),p()?l(c):(e.getPlaceholder().trigger("plotunselected",[]),e.getPlaceholder().trigger("plotselecting",[null])),setTimeout(function(){e.isSelecting=!1},10),!1}function a(){if(!p()||!t.show)return null;var c={},y=t.first,P=t.second,d=e.getAxes(),D=!0;return ee.each(d,function(b,E){E.used&&(anyUsed=!1)}),ee.each(d,function(b,E){if(E.used||D){var v=E.c2p(y[E.direction]),C=E.c2p(P[E.direction]);c[b]={from:Math.min(v,C),to:Math.max(v,C)}}}),c}function l(c){var y=a();y.ctrlKey=c.ctrlKey,y.metaKey=c.metaKey,e.getPlaceholder().trigger("plotselected",[y]),y.xaxis&&y.yaxis&&e.getPlaceholder().trigger("selected",[{x1:y.xaxis.from,y1:y.yaxis.from,x2:y.xaxis.to,y2:y.yaxis.to}])}function f(c,y,P){return y<c?c:y>P?P:y}function h(c,y){var P=e.getOptions(),d=e.getPlaceholder().offset(),D=e.getPlotOffset();c.x=f(0,y.pageX-d.left-D.left,e.width()),c.y=f(0,y.pageY-d.top-D.top,e.height()),P.selection.mode=="y"&&(c.x=c==t.first?0:e.width()),P.selection.mode=="x"&&(c.y=c==t.first?0:e.height())}function u(c){c.pageX!=null&&(h(t.second,c),p()?(e.isSelecting=!0,t.show=!0,e.triggerRedrawOverlay()):i(!0))}function i(c){t.show&&(t.show=!1,e.triggerRedrawOverlay(),c||e.getPlaceholder().trigger("plotunselected",[]))}function x(c,y){var P,d,D,b,E=e.getAxes();for(var v in E)if(P=E[v],P.direction==y&&(b=y+P.n+"axis",!c[b]&&P.n==1&&(b=y+"axis"),c[b])){d=c[b].from,D=c[b].to;break}if(c[b]||(P=y=="x"?e.getXAxes()[0]:e.getYAxes()[0],d=c[y+"1"],D=c[y+"2"]),d!=null&&D!=null&&d>D){var C=d;d=D,D=C}return{from:d,to:D,axis:P}}function g(c,y){var P,d,D=e.getOptions();D.selection.mode=="y"?(t.first.x=0,t.second.x=e.width()):(d=x(c,"x"),t.first.x=d.axis.p2c(d.from),t.second.x=d.axis.p2c(d.to)),D.selection.mode=="x"?(t.first.y=0,t.second.y=e.he
1566ight()):(d=x(c,"y"),t.first.y=d.axis.p2c(d.from),t.second.y=d.axis.p2c(d.to)),t.show=!0,e.triggerRedrawOverlay(),!y&&p()&&l()}function p(){var c=e.getOptions().selection.minSize;return Math.abs(t.second.x-t.first.x)>=c&&Math.abs(t.second.y-t.first.y)>=c}e.clearSelection=i,e.setSelection=g,e.getSelection=a,e.hooks.bindEvents.push(function(c,y){var P=c.getOptions();P.selection.mode!=null&&(y.mousemove(o),y.mousedown(s))}),e.hooks.drawOverlay.push(function(c,y){if(t.show&&p()){var P=c.getPlotOffset(),d=c.getOptions();y.save(),y.translate(P.left,P.top);var D=ee.color.parse(d.selection.color);y.strokeStyle=D.scale("a",.8).toString(),y.lineWidth=1,y.lineJoin=d.selection.shape,y.fillStyle=D.scale("a",.4).toString();var b=Math.min(t.first.x,t.second.x)+.5,E=Math.min(t.first.y,t.second.y)+.5,v=Math.abs(t.second.x-t.first.x)-1,C=Math.abs(t.second.y-t.first.y)-1;y.fillRect(b,E,v,C),y.strokeRect(b,E,v,C),y.restore()}}),e.hooks.shutdown.push(function(c,y){y.unbind("mousemove",o),y.unbind("mousedown",s),r&&(ee(document).unbind("mouseup",r),document.onselectstart!==void 0&&(document.onselectstart=n.onselectstart),document.ondrag!==void 0&&(document.ondrag=n.ondrag))})}ee.plot.plugins.push({init:B,options:{selection:{mode:null,color:"#e8cfac",shape:"round",minSize:5}},name:"selection",version:"1.1"})})(jQuery)},31221:()=>{(function(ee){var B={series:{stack:null}};function e(t){function n(o,s){for(var m=null,a=0;a<s.length&&o!=s[a];++a)s[a].stack==o.stack&&(m=s[a]);return m}function r(o,s,m){if(!(s.stack==null||s.stack===!1)){var a=n(s,o.getData());if(a){for(var l=m.pointsize,f=m.points,h=a.datapoints.pointsize,u=a.datapoints.points,i=[],x,g,p,c,y,P,d=s.lines.show,D=s.bars.horizontal,b=l>2&&(D?m.format[2].x:m.format[2].y),E=d&&s.lines.steps,v=D?1:0,C=D?0:1,S=0,O=0,I,R;!(S>=f.length&&O>=u.length);){if(I=i.length,S<f.length&&f[S]==null){for(R=0;R<l;++R)i.push(f[S+R]);S+=l}else if(S>=f.length){for(R=0;R<l;++R)i.push(u[O+R]);b&&(i[I+2]=u[O+C]),O+=h}else if(O>=u.length){for(R=0;R<l;++R)i.push(f[S+R]);S+=l}else if(O<u.length&&u[O]==null)O+=h;else{if(x=f[S+v],g=f[S+C],c=u[O+v],y=u[O+C],P=0,x==c){for(R=0;R<l;++R)i.push(f[S+R]);i[I+C]+=y,P=y,S+=l,O+=h}else if(x>c){if(S==0){for(R=0;R<l;++R)i.push(u[O+R]);P=y}if(S>0&&f[S-l]!=null){for(p=0,i.push(c),i.push(p+y),R=2;R<l;++R)i.push(f[S+R]);P=y}O+=h}else{for(R=0;R<l;++R)i.push(f[S+R]);O>0&&u[O-h]!=null&&(P=0),i[I+C]+=P,S+=l}fromgap=!1,I!=i.length&&b&&(i[I+2]=P)}if(E&&I!=i.length&&I>0&&i[I]!=null&&i[I]!=i[I-l]&&i[I+1]!=i[I-l+1]){for(R=0;R<l;++R)i[I+l+R]=i[I+R];i[I+1]=i[I-l+1]}}m.points=i}}}t.hooks.processDatapoints.push(r)}ee.plot.plugins.push({init:e,options:B,name:"stack",version:"1.2"})})(jQuery)},91520:()=>{(function(ee){var B={series:{stackpercent:null}};function e(t){var n={},r=!1,o={};function s(l,f,h,u){if(r||(r=!0,o=m(l.getData())),f.stackpercent==!0){var i=h.length;f.percents=[];var x=0,g=1;f.bars&&f.bars.horizontal&&f.bars.horizontal===!0&&(x=1,g=0);for(var p=0;p<i;p++){var c=o[h[p][x]+""];c>0?f.percents.push(h[p][g]*100/c):f.percents.push(0)}}}function m(l){var f=l.length,h={};if(f>0){for(var u=0;u<f;u++)if(l[u].stackpercent){var i=0,x=1;l[u].bars&&l[u].bars.horizontal&&l[u].bars.horizontal===!0&&(i=1,x=0);for(var g=l[u].data.length,p=0;p<g;p++){var c=0;l[u].data[p][1]!=null&&(c=l[u].data[p][x]),h[l[u].data[p][i]+""]?h[l[u].data[p][i]+""]+=c:h[l[u].data[p][i]+""]=c}}}return h}function a(l,f,h){if(f.stackpercent){r||(o=m(l.getData()));var u=[],i=0,x=1;f.bars&&f.bars.horizontal&&f.bars.horizontal===!0&&(i=1,x=0);for(var g=0;g<h.points.length;g+=3)n[h.points[g+i]]||(n[h.points[g+i]]=0),u[g+i]=h.points[g+i],u[g+x]=h.points[g+x]+n[h.points[g+i]],u[g+2]=n[h.points[g+i]],n[h.points[g+i]]+=h.points[g+x],o[u[g+i]+""]>0?(u[g+x]=u[g+x]*100/o[u[g+i]+""],u[g+2]=u[g+2]*100/o[u[g+i]+""]):(u[g+x]=0,u[g+2]=0);h.points=u}}t.hooks.processRawData.push(s),t.hooks.processDatapoints.push(a)}ee.plot.plugins.push({init:e,options:B,name:"stackpercent",version:"0.1"})})(jQuery)},32176:()=>{(function(ee){var B={xaxis:{timezone:null,timeformat:null,twelveHourClock:!1,monthNames:null}};function e(f,h){return h*Math.floor(f/h)}function t(f,h,u,i){if(typeof f.strftime=="function")return f.strftime(h);var x=function(b,E){return b=""+b,E=""+(E??"0"),b.length==1?E+b:b},g=[],p=!1,c=f.getHours(),y=c<12;u==null&&(u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),i==null&&(i=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);var P;
1566c>12?P=c-12:c==0?P=12:P=c;for(var d=0;d<h.length;++d){var D=h.charAt(d);if(p){switch(D){case"a":D=""+i[f.getDay()];break;case"b":D=""+u[f.getMonth()];break;case"d":D=x(f.getDate(),"");break;case"e":D=x(f.getDate()," ");break;case"h":case"H":D=x(c);break;case"I":D=x(P);break;case"l":D=x(P," ");break;case"m":D=x(f.getMonth()+1,"");break;case"M":D=x(f.getMinutes());break;case"q":D=""+(Math.floor(f.getMonth()/3)+1);break;case"S":D=x(f.getSeconds());break;case"y":D=x(f.getFullYear()%100);break;case"Y":D=""+f.getFullYear();break;case"p":D=y?"am":"pm";break;case"P":D=y?"AM":"PM";break;case"w":D=""+f.getDay();break}g.push(D),p=!1}else D=="%"?p=!0:g.push(D)}return g.join("")}function n(f){function h(g,p,c,y){g[p]=function(){return c[y].apply(c,arguments)}}var u={date:f};f.strftime!=null&&h(u,"strftime",f,"strftime"),h(u,"getTime",f,"getTime"),h(u,"setTime",f,"setTime");for(var i=["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds"],x=0;x<i.length;x++)h(u,"get"+i[x],f,"getUTC"+i[x]),h(u,"set"+i[x],f,"setUTC"+i[x]);return u}function r(f,h){if(h.timezone=="browser")return new Date(f);if(!h.timezone||h.timezone=="utc")return n(new Date(f));if(typeof timezoneJS<"u"&&typeof timezoneJS.Date<"u"){var u=new timezoneJS.Date;return u.setTimezone(h.timezone),u.setTime(f),u}else return n(new Date(f))}var o={second:1e3,minute:60*1e3,hour:60*60*1e3,day:24*60*60*1e3,month:30*24*60*60*1e3,quarter:3*30*24*60*60*1e3,year:365.2425*24*60*60*1e3},s=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"]],m=s.concat([[3,"month"],[6,"month"],[1,"year"]]),a=s.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);function l(f){f.hooks.processOptions.push(function(h,u){ee.each(h.getAxes(),function(i,x){var g=x.options;g.mode=="time"&&(x.tickGenerator=function(p){var c=[],y=r(p.min,g),P=0,d=g.tickSize&&g.tickSize[1]==="quarter"||g.minTickSize&&g.minTickSize[1]==="quarter"?a:m;g.minTickSize!=null&&(typeof g.tickSize=="number"?P=g.tickSize:P=g.minTickSize[0]*o[g.minTickSize[1]]);for(var D=0;D<d.length-1&&!(p.delta<(d[D][0]*o[d[D][1]]+d[D+1][0]*o[d[D+1][1]])/2&&d[D][0]*o[d[D][1]]>=P);++D);var b=d[D][0],E=d[D][1];if(E=="year"){if(g.minTickSize!=null&&g.minTickSize[1]=="year")b=Math.floor(g.minTickSize[0]);else{var v=Math.pow(10,Math.floor(Math.log(p.delta/o.year)/Math.LN10)),C=p.delta/o.year/v;C<1.5?b=1:C<3?b=2:C<7.5?b=5:b=10,b*=v}b<1&&(b=1)}p.tickSize=g.tickSize||[b,E];var S=p.tickSize[0];E=p.tickSize[1];var O=S*o[E];E=="second"?y.setSeconds(e(y.getSeconds(),S)):E=="minute"?y.setMinutes(e(y.getMinutes(),S)):E=="hour"?y.setHours(e(y.getHours(),S)):E=="month"?y.setMonth(e(y.getMonth(),S)):E=="quarter"?y.setMonth(3*e(y.getMonth()/3,S)):E=="year"&&y.setFullYear(e(y.getFullYear(),S)),y.setMilliseconds(0),O>=o.minute&&y.setSeconds(0),O>=o.hour&&y.setMinutes(0),O>=o.day&&y.setHours(0),O>=o.day*4&&y.setDate(1),O>=o.month*2&&y.setMonth(e(y.getMonth(),3)),O>=o.quarter*2&&y.setMonth(e(y.getMonth(),6)),O>=o.year&&y.setMonth(0);var I=0,R=Number.NaN,T;do if(T=R,R=y.getTime(),c.push(R),E=="month"||E=="quarter")if(S<1){y.setDate(1);var L=y.getTime();y.setMonth(y.getMonth()+(E=="quarter"?3:1));var K=y.getTime();y.setTime(R+I*o.hour+(K-L)*S),I=y.getHours(),y.setHours(0)}else y.setMonth(y.getMonth()+S*(E=="quarter"?3:1));else E=="year"?y.setFullYear(y.getFullYear()+S):y.setTime(R+O);while(R<p.max&&R!=T);return c},x.tickFormatter=function(p,c){var y=r(p,c.options);if(g.timeformat!=null)return t(y,g.timeformat,g.monthNames,g.dayNames);var P=c.options.tickSize&&c.options.tickSize[1]=="quarter"||c.options.minTickSize&&c.options.minTickSize[1]=="quarter",d=c.tickSize[0]*o[c.tickSize[1]],D=c.max-c.min,b=g.twelveHourClock?" %p":"",E=g.twelveHourClock?"%I":"%H",v;d<o.minute?v=E+":%M:%S"+b:d<o.day?D<2*o.day?v=E+":%M"+b:v="%b %d "+E+":%M"+b:d<o.month?v="%b %d":P&&d<o.quarter||!P&&d<o.year?D<o.year?v="%b":v="%b %Y":P&&d<o.year?D<o.year?v="Q%q":v="Q%q %Y":v="%Y";var C=t(y,v,g.monthNames,g.dayNames);return C})})})}ee.plot.plugins.push({init:l,options:B,name:"time",version:"1.0"}),ee.plot.formatDate=t})(jQuery)}}]); 1567 1568//# sourceMappingURL=8882.c0449923aae3dcaa9d23.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.