D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
build
/
Filename :
226.da3f7c34e888f96ba08d.js
back
Copy
(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[226],{61576:(j,I,e)=>{"use strict";e.d(I,{n:()=>i});var t=e(27702),n=e(44910);function i(s){const{children:r,instanceSettings:g}=s,d=(0,t.useMemo)(()=>({instanceSettings:g,meta:g.meta}),[g]);return t.createElement(n._.Provider,{value:d},r)}},44910:(j,I,e)=>{"use strict";e.d(I,{_:()=>n});var t=e(27702);const n=(0,t.createContext)(void 0)},90665:(j,I,e)=>{"use strict";e.d(I,{b:()=>i});var t=e(27702),n=e(44910);function i(s){const{children:r,...g}=s;return t.createElement(n._.Provider,{value:g},r)}},58971:(j,I,e)=>{"use strict";e.d(I,{v:()=>t});function t(n){return"instanceSettings"in n&&"meta"in n}},93752:(j,I,e)=>{"use strict";e.d(I,{g:()=>i});var t=e(27702),n=e(44910);function i(){const s=(0,t.useContext)(n._);if(!s)throw new Error("usePluginContext must be used within a PluginContextProvider");return s}},46580:(j,I,e)=>{"use strict";e.d(I,{P:()=>s,i:()=>i});var t=e(29241),n=e(32053);class i{constructor(d,l){return this.fields=[],this.length=0,s(d,l)}}function s(g,d){const l={fields:[],length:g.length};if(!g?.length)return l;if(d){for(const o of d)l.fields.push(r(o,g.map(m=>m[o])));return l}const u=g.find(o=>o!=null);return u!=null&&(typeof u=="object"?l.fields=Object.keys(u).map(o=>r(o,g.map(m=>m[o]))):l.fields.push(r(t.M5,g))),l}function r(g,d){const l={name:g,config:{},values:d,type:t.fS.other};return l.type=(0,n.fu)(l)??t.fS.other,l}},52141:(j,I,e)=>{"use strict";e.d(I,{a:()=>i});var t=e(64282),n=e(72164);class i extends n.v{constructor(r){super(void 0,g=>new t.d({...r,buffer:g}))}}},66784:(j,I,e)=>{"use strict";e.d(I,{Ib:()=>r,Jy:()=>s,Y:()=>l,vP:()=>d});var t=e(29241),n=e(32053);const i={Inf:1/0,NegInf:-1/0,Undef:void 0,NaN:NaN};function s(u,o){for(const m in u){const c=i[m];for(const p of u[m])p<o.length&&(o[p]=c)}}function r(u,o){for(let m=0;m<o.length;m++)o[m]=u[o[m]]}function g(u,o){for(const m of o)if(m!=null)return(0,n._m)(u,m);return t.fS.other}function d(u){const{schema:o,data:m}=u;if(!o||!o.fields)throw new Error("JSON needs a fields definition");const c=m?m.values.reduce((f,E)=>Math.max(f,E.length),0):0,p=o.fields.map((f,E)=>{let h=m?m.values[E]:[],y=h.length,v=f.type;y!==c&&(h.length=c,h.fill(void 0,y));let D=m?.entities?.[E];D&&s(D,h);let a=m?.enums?.[E];a&&(r(a,h),v=t.fS.string);const C=m?.nanos?.[E],P={...f,type:v??g(f.name,h),config:f.config??{},values:h,entities:D??{}};return C!=null&&(P.nanos=C),P});return{...o,fields:p,length:c}}function l(u){const o={values:[]},m=[];let c=!1;const p={refId:u.refId,meta:u.meta,name:u.name,fields:u.fields.map(f=>{const{values:E,nanos:h,state:y,display:v,...D}=f;return delete D.entities,o.values.push(E),h!=null?(m.push(h),c=!0):m.push(null),D})};return c&&(o.nanos=m),{schema:p,data:o}}},27938:(j,I,e)=>{"use strict";e.d(I,{U:()=>n});var t=e(36829);class n extends t.G{constructor(s){super(),this.data=s,this.index=0;const r={},g={};for(let d=0;d<s.fields.length;d++){const l=s.fields[d];if(!l.name)continue;g[l.name]=l;const u=()=>l.values.get(this.index);r.hasOwnProperty(l.name)||Object.defineProperty(r,l.name,{enumerable:!0,get:u}),r.hasOwnProperty(d.toString())||Object.defineProperty(r,d,{enumerable:!1,get:u})}this.obj=r,this.fields=g}get dataFrame(){return this.data}get length(){return this.data.length}getFieldDisplayProcessor(s){if(!this.dataFrame||!this.dataFrame.fields)return;const r=this.dataFrame.fields[s];if(!(!r||!r.display))return r.display}get(s){return this.index=s,this.obj}toArray(){return new Array(this.data.length).fill(0).map((s,r)=>({...this.get(r)}))}}},31832:(j,I,e)=>{"use strict";e.d(I,{N:()=>i});var t=e(29241),n=e(32053);class i{constructor(r){this.fields=[],this.fieldByName={},this.fieldByType={},this.fields=r.fields.map((g,d)=>({...g,index:d}));for(let g=0;g<r.fields.length;g++){const d=r.fields[g];if(d.type===t.fS.other){const l=(0,n.fu)(d);l&&(d.type=l)}this.fieldByType[d.type]||(this.fieldByType[d.type]=[]),this.fieldByType[d.type].push({...d,index:g}),this.fieldByName[d.name]?console.warn("Duplicate field names in DataFrame: ",d.name):this.fieldByName[d.name]={...d,index:g}}}getFields(r){if(!r)return[...this.fields];const g=this.fieldByType[r];return g?[...g]:[]}hasFieldOfType(r){const g=this.fieldByType[r];return g&&g.length>0}getFirstFieldOfType(r,g=!1){return this.fieldByType[r]?.find(u=>g||!u.config.custom?.hidden)}hasFieldNamed(r){return!!this.fieldByName[r]}hasFieldWithNameAndType(r,g){return!!this.fieldByName[r]&&this.fieldByType[g].filter(d=>d.name===r).length>0}getFieldByName(r){return this.fieldByName[r]}getFieldsByLabel(r,g){return Object.values(this.fieldByName).filter(d=>d.labels&&d.labels[r]===g)}}},72164:(j,I,e)=>{"use strict";e.d(I,{Y:()=>g,v:()=>d});var t=e(89949),n=e(29241),i=e(32053);function s(l,u){return u.type||(u.name==="time"||u.name==="Time"?u.type=n.fS.time:u.type=(0,i.LI)(l)),u.type===n.fS.number?o=>parseFloat(o):u.type===n.fS.boolean?o=>!(o[0]==="F"||o[0]==="f"||o[0]==="0"):o=>o}var r=e(36829);const g=void 0;class d extends r.G{constructor(u,o){if(super(),this.fields=[],this.first=[],this.parsers=void 0,this.creator=o||(m=>m??[]),u){const{name:m,refId:c,meta:p,fields:f}=u;if(m&&(this.name=m),c&&(this.refId=c),p&&(this.meta=p),f)for(const E of f)this.addField(E)}Object.defineProperty(this,"length",{enumerable:!0,get:()=>this.first.length})}get length(){return this.first.length}addFieldFor(u,o){return this.addField({name:o||"",type:(0,i.LI)(u)})}addField(u,o){let m;u.values&&(m=u.values);let c=u.type;!c&&(u.name==="time"||u.name==="Time")?c=n.fS.time:(!c&&m&&m.length&&(c=(0,i.LI)(m[0])),c||(c=n.fS.other));let p=u.name;p||(p=`Field ${this.fields.length+1}`);const f={...u,name:p,type:c,config:u.config||{},values:this.creator(m)};if(c===n.fS.other&&(c=(0,i.fu)(f),c&&(f.type=c)),this.fields.push(f),this.first=this.fields[0].values,o)for(;f.values.length<o;)f.values.push(g);else this.validate();return f}validate(){const u=this.fields.reduce((o,m)=>Math.max(o,m.values.length),0);for(const o of this.fields)for(;o.values.length!==u;)o.values.push(g)}setParser(u,o){return this.parsers||(this.parsers=new Map),this.parsers.set(u,o),o}parseValue(u,o){let m=this.parsers?.get(u);return m||(m=this.setParser(u,s(o,u))),m(o)}appendRow(u){for(let o=this.fields.length;o<u.length;o++)this.addField({name:`Field ${o+1}`,type:(0,i.LI)(u[o])});if(this.length<1)for(let o=0;o<this.fields.length;o++){const m=this.fields[o];(!m.type||m.type===n.fS.other)&&(m.type=(0,i.LI)(u[o]))}for(let o=0;o<this.fields.length;o++){const m=this.fields[o];let c=u[o];m.type!==n.fS.string&&(0,t.isString)(c)&&(c=this.parseValue(m,c)),m.values.push(c)}}push(...u){for(const o of u)this.add(o);return this.length}reverse(){for(const u of this.fields)u.values.reverse();return this}add(u){const o=u;for(const m of this.fields){let c=o[m.name];m.type!==n.fS.string&&(0,t.isString)(c)&&(c=this.parseValue(m,c)),c===void 0&&(c=g),m.values.push(c)}}set(u,o){if(u>this.length)throw new Error("Unable to set value beyond current length");const m=o||{};for(const c of this.fields)c.values[u]=m[c.name]}get(u){const o={};for(const m of this.fields)o[m.name]=m.values[u];return o}toJSON(){return(0,i.og)(this)}}},47838:(j,I,e)=>{"use strict";e.d(I,{Av:()=>m,Ko:()=>f,MB:()=>h,T0:()=>d,_A:()=>c});var t=e(29241),n=e(14951),i=e(48962),s=e(76772),r=e(32053),g=e(66784),d=(C=>(C.Append="append",C.Replace="replace",C))(d||{});const l="__name__";var u=(C=>(C[C.wide=0]="wide",C[C.labels=1]="labels",C))(u||{});const o=class{constructor(C){this.options=C,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=(P,b,M)=>{const T=b?Object.assign({},{...this.options,...b}):this.options,S=(0,r.Aw)(this,P),x=D(S.fields.map(B=>B.values),typeof M?.maxLength=="number"?Math.min(M.maxLength,T.maxLength):T.maxLength,this.timeFieldIndex,T.maxDelta);S.fields=S.fields.map(B=>({...B,values:B.values.slice(x)}));const O=S.fields[0]?.values?.length??0;return{...S,labels:this.labels,schemaFields:this.schemaFields,name:this.name,refId:this.refId,meta:this.meta,length:O,timeFieldIndex:this.timeFieldIndex,pushMode:this.pushMode,packetInfo:this.packetInfo,options:T}},this.initFromSerialized=P=>{this.name=P.name,this.refId=P.refId,this.meta=P.meta,this.length=P.length,this.labels=P.labels,this.schemaFields=P.schemaFields,this.timeFieldIndex=P.timeFieldIndex,this.pushMode=P.pushMode,this.packetInfo.length=P.packetInfo.length,this.packetInfo.number=P.packetInfo.number,this.packetInfo.action="replace",this.packetInfo.schemaChanged=!0,this.fields=P.fields.map(b=>({...b,type:b.type??t.fS.other,config:b.config??{},values:b.values??[]})),v(this.fields.map(b=>b.values),this.options.maxLength,this.timeFieldIndex,this.options.maxDelta)},this.needsResizing=({maxLength:P,maxDelta:b})=>{const M=P&&this.options.maxLength<P,T=b&&this.options.maxDelta<b,S=b&&this.options.maxDelta===1/0;return!!(M||T||S)},this.resize=({maxLength:P,maxDelta:b})=>{b&&(this.options.maxDelta===1/0?this.options.maxDelta=b:this.options.maxDelta=Math.max(b,this.options.maxDelta)),this.options.maxLength=Math.max(this.options.maxLength,P??0)},this.pushNewValues=P=>{if(!P?.length)return;this.packetInfo.action=this.options.action,this.packetInfo.number++,this.packetInfo.length=P[0].length,this.packetInfo.schemaChanged=!1,this.options.action==="append"?y(this.fields.map(M=>M.values),P,this.options.maxLength,this.timeFieldIndex,this.options.maxDelta):(P.forEach((M,T)=>{this.fields[T]&&(this.fields[T].values=M)}),v(this.fields.map(M=>M.values),this.options.maxLength,this.timeFieldIndex,this.options.maxDelta));const b=this.fields?.[0]?.values.length;b!==void 0&&(this.length=b)},this.resetStateCalculations=()=>{this.fields.forEach(P=>{P.state={...P.state??{},calcs:void 0,range:void 0}})},this.getMatchingFieldIndexes=P=>this.fields.map((b,M)=>P(b)?M:void 0).filter(b=>b!==void 0),this.getValuesFromLastPacket=()=>this.fields.map(P=>{const b=P.values;return b.slice(Math.max(b.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})}get alwaysReplace(){return this.options.action==="replace"}push(C){const{schema:P,data:b}=C;if(this.packetInfo.number++,this.packetInfo.length=0,this.packetInfo.schemaChanged=!1,P){this.pushMode=0,this.timeFieldIndex=P.fields.findIndex(x=>x.type===t.fS.time);const M=P.fields[0];this.timeFieldIndex===1&&M.type===t.fS.string&&(M.name==="labels"||M.name==="Labels")&&(this.pushMode=1,this.timeFieldIndex=0);const T=this.pushMode===1?P.fields.slice(1):P.fields;this.refId=P.refId,P.meta&&(this.meta={...P.meta});const{displayNameFormat:S}=this.options;if(a(this.schemaFields,T)){const x=T.length;this.fields.forEach((O,B)=>{const A=T[B%x];O.config=A.config??{},O.labels=A.labels}),S&&this.fields.forEach(O=>{const B={[l]:O.name,...O.labels};O.config.displayNameFromDS=(0,s.W)(S,B)})}else{this.packetInfo.schemaChanged=!0;const x=this.pushMode===0;this.fields=T.map(O=>{const B=O.config??{};if(S){const A={[l]:O.name,...O.labels};B.displayNameFromDS=(0,s.W)(S,A)}return{config:B,name:O.name,labels:O.labels,type:O.type??t.fS.other,values:x?this.fields.find(A=>A.name===O.name&&O.type===A.type)?.values??Array(this.length).fill(void 0):[]}})}this.schemaFields=T}if(b&&b.values.length&&b.values[0].length){let{values:M,entities:T}=b;if(T&&T.forEach((x,O)=>{x&&(0,g.Jy)(x,M[O])}),this.pushMode===1){const x=p(M);for(const A of x.keys())this.labels.has(A)||(this.packetInfo.schemaChanged=!0,this.addLabel(A));let O=Array(this.schemaFields.length).fill([]),B=[];this.labels.forEach(A=>{B.push(x.get(A)??O)}),M=(0,i.v_)(B)}if(M.length!==this.fields.length){if(this.fields.length)throw new Error(`push message mismatch. Expected: ${this.fields.length}, received: ${M.length} (labels=${this.pushMode===1})`);this.fields=M.map((x,O)=>{let B=`Field ${O}`,A=(0,r.LI)(x[0]);return O===0&&A===t.fS.number&&x[0]>1600016688632&&(A=t.fS.time,B="Time"),{name:B,type:A,config:{},values:[]}})}let S=M;this.packetInfo.length=M[0].length,this.alwaysReplace||!this.length?this.packetInfo.action="replace":(this.packetInfo.action="append",S=this.fields.map(x=>x.values),y(S,M,this.options.maxLength,this.timeFieldIndex,this.options.maxDelta)),S.forEach((x,O)=>{const B=this.fields[O],{state:A}=B;B.values=x,A&&(A.calcs=void 0)}),this.length=S[0].length}return{...this.packetInfo}}addLabel(C){const{displayNameFormat:P}=this.options,b=this.labels.size,M=E(C);if(b===0)this.fields.forEach((T,S)=>{if(S>0&&(T.labels=M,P)){const x={[l]:T.name,...M};T.config.displayNameFromDS=(0,s.W)(P,x)}});else for(let T=1;T<this.schemaFields.length;T++){let S=this.schemaFields[T];const x=S.config??{};if(P){const O={[l]:S.name,...M};x.displayNameFromDS=(0,s.W)(P,O)}this.fields.push({...S,config:x,labels:M,values:Array(this.length).fill(void 0)})}this.labels.add(C)}};let m=o;m.deserialize=C=>{const P=new o(C.options);return P.initFromSerialized(C),P},m.empty=C=>new o(c(C)),m.fromDataFrameJSON=(C,P)=>{const b=new o(c(P));return b.push(C),b};function c(C){return{maxLength:C?.maxLength??1e3,maxDelta:C?.maxDelta??1/0,action:C?.action??"append",displayNameFormat:C?.displayNameFormat}}function p(C){let P=new Set(C[0]),b=new Map;P.forEach(M=>{let T=Array(C.length-1).fill(null).map(()=>[]);b.set(M,T)});for(let M=0;M<C[0].length;M++){let T=b.get(C[0][M]);for(let S=1;S<C.length;S++)T[S-1].push(C[S][M])}return b}function f(C,P,b,M){let T;b=b||0,M=M||P.length-1;let S=M<=2147483647;for(;M-b>1;)T=S?b+M>>1:Math.floor((b+M)/2),P[T]<C?b=T:M=T;return C-P[b]<=P[M]-C?b:M}function E(C){if(!C.length)return{};if(C.charAt(0)==="{")return(0,n.J8)(C);const P={};return C.split(",").forEach(b=>{const[M,T]=b.trim().split("=");P[M]=T}),P}function h(C){const P=C.packetInfo;return P?.action?P:void 0}function y(C,P,b=1/0,M=0,T=1/0){for(let S=0;S<C.length;S++)for(let x=0;x<P[S].length;x++)C[S].push(P[S][x]);return v(C,b,M,T)}function v(C,P=1/0,b=0,M=1/0){const T=D(C,P,b,M);if(T)for(let S=0;S<C.length;S++)C[S].splice(0,T);return T}function D(C,P=1/0,b=0,M=1/0){if(!C[0]?.length)return 0;const T=C[0].length;let S=0;if(T>P&&(S=T-P),M!==1/0&&b>=0){const x=C[b],O=x[S],B=x[T-1];B-O>M&&(S=f(B-M,x,S))}return S}function a(C,P){if(C?.length!==P.length)return!1;for(let b=0;b<C.length;b++){const M=C[b],T=P[b];if(M.name!==T.name||M.type!==T.type)return!1}return!0}},45641:(j,I,e)=>{"use strict";e.d(I,{$q:()=>i,GV:()=>n,YP:()=>g,jC:()=>s,q2:()=>t,r7:()=>r});const t=(d,l)=>({name:d,columns:l}),n=d=>d.columns,i=(d,l)=>d.columns[l],s=(d,l,u)=>d.columns[l].values[u],r=(d,l,u)=>d.columns.map(o=>o.values[u]),g=(d,l)=>d[l]},64987:(j,I,e)=>{"use strict";e.d(I,{Ch:()=>i,Vv:()=>g,nl:()=>s});var t=e(89949),n=e.n(t);function i(d,l,u){if(d===l)return!0;if(d?.fields?.length!==l?.fields?.length||d.name!==l.name)return!1;for(let o=0;o<d.fields.length;o++){const m=d.fields[o],c=l.fields[o];if(m.type!==c.type||m.name!==c.name)return!1;if(u)continue;if(m.labels&&c.labels&&!g(m.labels,c.labels))return!1;const p=m.config,f=c.config;let E=Object.keys(p),h=Object.keys(f);if(E.length!==h.length)return!1;for(const y of E){if(!(y in f))return!1;if(y!=="interval"&&!(0,t.isEqual)(p[y],f[y]))return!1}}return!0}function s(d,l,u){if(d===l)return!0;if(d?.length!==l?.length)return!1;for(let o=0;o<d.length;o++)if(!u(d[o],l[o]))return!1;return!0}const r=(d,l)=>d===l;function g(d,l,u=r){if(d===l)return!0;const o=Object.keys(d),m=Object.keys(l);if(o.length!==m.length)return!1;for(let c of o)if(!u(d[c],l[c]))return!1;return!0}},88570:(j,I,e)=>{"use strict";e.d(I,{$q:()=>g.$q,Av:()=>m.Av,Aw:()=>r.Aw,Ch:()=>u.Ch,DP:()=>r.DP,F9:()=>r.F9,GV:()=>g.GV,Ib:()=>l.Ib,Ji:()=>r.Ji,Jy:()=>l.Jy,LI:()=>r.LI,N:()=>n.N,Pc:()=>d.P,SX:()=>r.SX,T0:()=>m.T0,US:()=>t.U,Vv:()=>u.Vv,Y:()=>l.Y,Y6:()=>r.Y6,YP:()=>g.YP,Yi:()=>s.Y,Zr:()=>r.Zr,_m:()=>r._m,a2:()=>i.a,aK:()=>r.aK,aY:()=>r.aY,at:()=>r.at,fh:()=>r.fh,fu:()=>r.fu,g0:()=>r.g0,iB:()=>d.i,jC:()=>g.jC,m$:()=>o.m$,nl:()=>u.nl,og:()=>r.og,pP:()=>o.pP,q2:()=>g.q2,r7:()=>g.r7,sV:()=>r.sV,vA:()=>s.v,vP:()=>l.vP,xI:()=>o.xI,zR:()=>r.zR});var t=e(27938),n=e(31832),i=e(52141),s=e(72164),r=e(32053),g=e(45641),d=e(46580),l=e(66784),u=e(64987),o=e(59425),m=e(47838)},32053:(j,I,e)=>{"use strict";e.d(I,{Aw:()=>O,DP:()=>h,F9:()=>V,Ji:()=>a,LI:()=>y,SX:()=>D,Y6:()=>T,Zr:()=>b,_m:()=>E,aK:()=>M,aY:()=>C,at:()=>w,fh:()=>S,fu:()=>v,g0:()=>P,og:()=>x,sV:()=>B,zR:()=>W});var t=e(89949),n=e.n(t),i=e(99633),s=e(72927),r=e(75578),g=e(29241),d=e(53933),l=e(46580),u=e(66784);function o(N){const F=N.columns.map(k=>{const{text:H,type:R,..._}=k;return{name:H?.length?H:k,config:_||{},values:[],type:R&&Object.values(g.fS).includes(R)?R:g.fS.other}});if(!(0,t.isArray)(N.rows))throw new Error(`Expected table rows to be array, got ${typeof N.rows}.`);for(const k of N.rows)for(let H=0;H<F.length;H++)F[H].values.push(k[H]);for(const k of F)if(k.type===g.fS.other){const H=v(k);H&&(k.type=H)}return{fields:F,refId:N.refId,meta:N.meta,name:N.name,length:N.rows.length}}function m(N){const F=[],k=[],H=N.datapoints||N.points;for(const _ of H)k.push(_[0]),F.push(_[1]);const R=[{name:g.Ls,type:g.fS.time,config:{},values:F},{name:g.M5,type:g.fS.number,config:{unit:N.unit},values:k,labels:N.tags}];return N.title&&(R[1].config.displayNameFromDS=N.title),{name:N.target||N.name,refId:N.refId,meta:N.meta,fields:R,length:k.length}}function c(N){const F=[],k=[];for(let H=0;H<N.data.length;H++){const R=N.data[H];F.push(R[1]),k.push(R[0])}return{name:N.label,fields:[{name:N.label||g.M5,type:g.fS.number,config:{},values:F},{name:g.Ls,type:g.fS.time,config:{unit:"dateTimeAsIso"},values:k}],length:F.length}}function p(N){const F=[{name:N.target,type:g.fS.other,labels:N.tags,config:{unit:N.unit,filterable:N.filterable},values:[]}];for(const k of N.datapoints)F[0].values.push(k);return{name:N.target,refId:N.target,meta:{json:!0},fields:F,length:N.datapoints.length}}const f=/^\s*(-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?|NAN)\s*$/i;function E(N,F){return N&&(N=N.toLowerCase(),N==="date"||N==="time")?g.fS.time:y(F)}function h(N){return N instanceof Date||(0,i.v9)(N)?g.fS.time:(0,t.isNumber)(N)?g.fS.number:(0,t.isString)(N)?g.fS.string:(0,t.isBoolean)(N)?g.fS.boolean:g.fS.other}function y(N){return N instanceof Date||(0,i.v9)(N)?g.fS.time:(0,t.isNumber)(N)?g.fS.number:(0,t.isString)(N)?f.test(N)?g.fS.number:N==="true"||N==="TRUE"||N==="True"||N==="false"||N==="FALSE"||N==="False"?g.fS.boolean:g.fS.string:(0,t.isBoolean)(N)?g.fS.boolean:g.fS.other}function v(N){if(N.name){const F=N.name.toLowerCase();if(F==="date"||F==="time")return g.fS.time}for(let F=0;F<N.values.length;F++){const k=N.values[F];if(k!=null)return y(k)}}const D=(N,F=!1)=>{for(const k of N.fields)if(!k.type||k.type===g.fS.other||F)return{...N,fields:N.fields.map(H=>H.type&&H.type!==g.fS.other&&!F?H:{...H,type:v(H)||g.fS.other})};return N},a=N=>!!(N&&N.hasOwnProperty("columns")),C=N=>!!(N&&N.hasOwnProperty("fields"));function P(N){if("fields"in N)return"length"in N&&N.fields[0]?.values?.get?N:w(N);if(N.hasOwnProperty("type")&&N.type==="docs")return p(N);if(N.hasOwnProperty("datapoints")||N.hasOwnProperty("points"))return m(N);if(N.hasOwnProperty("data"))return N.hasOwnProperty("schema")?(0,u.vP)(N):c(N);if(N.hasOwnProperty("columns"))return o(N);if(Array.isArray(N))return(0,l.P)(N);throw console.warn("Can not convert",N),new Error("Unsupported data format")}const b=N=>{const{fields:F}=N,k=N.length,H=[];if(F.length===2){const{timeField:R,timeIndex:_}=B(N);if(R){const Y=F[_===0?1:0],X=F[_];for(let Q=0;Q<k;Q++)H.push([Y.values[Q],X.values[Q]]);return{alias:N.name,target:(0,r.CZ)(Y,N),datapoints:H,unit:F[0].config?F[0].config.unit:void 0,refId:N.refId,meta:N.meta}}}for(let R=0;R<k;R++){const _=[];for(let G=0;G<F.length;G++)_.push(F[G].values[R]);H.push(_)}return N.meta&&N.meta.json?{alias:F[0].name||N.name,target:F[0].name||N.name,datapoints:F[0].values,filterable:F[0].config?F[0].config.filterable:void 0,type:"docs"}:{columns:F.map(R=>{const{name:_,config:G}=R;if(G){const{...Y}=G;return Y.text=_,Y}return{text:_}}),type:"table",refId:N.refId,meta:N.meta,rows:H}};function M(N,F,k=!1){const H=N.fields[F];if(!H)return N;const R=[];for(let G=0;G<N.length;G++)R.push(G);const _=(0,s.Mo)(H,k);return R.sort(_),{...N,fields:N.fields.map(G=>{const Y={...G,values:G.values.map((Q,se)=>G.values[R[se]])},{nanos:X}=G;return X!==void 0&&(Y.nanos=X.map((Q,se)=>X[R[se]])),Y})}}function T(N){return{...N,fields:N.fields.map(F=>{const k=[...F.values];k.reverse();const H={...F,values:k},{nanos:R}=F;if(R!==void 0){const _=[...R];_.reverse(),H.nanos=_}return H})}}function S(N,F){const k=[];for(const H of N.fields)k.push(H.values[F]);return k}function x(N){return O(N)}function O(N,F){return{fields:(F?N.fields.filter(F):N.fields).map(R=>{let _=R.values;return{name:R.name,type:R.type,config:R.config,values:_,labels:R.labels}}),refId:N.refId,meta:N.meta,name:N.name}}const B=N=>{for(let F=0;F<N.fields.length;F++)if(N.fields[F].type===g.fS.time)return{timeField:N.fields[F],timeIndex:F};return{}};function A(N){const F=D(P(N));if(F.fields&&F.fields.length)for(const k of F.fields)k.state=null;return F}function V(N){return!N||!(0,t.isArray)(N)?[]:N.map(F=>A(F))}function W(N,F){const{series:k,annotations:H}=N;if(N.state===d.Gu.Loading&&k.length===0)return F||(F=N),{...F,state:d.Gu.Loading,request:N.request};const R=performance.now(),_=k.map(X=>A(X)),G=V(H),Y=performance.now();return{...N,series:_,annotations:G,timings:{dataProcessingTime:Y-R}}}function w(N){let F=0;const k=N.fields.map((H,R)=>{const{state:_,...G}=H;return G.name||(G.name=`Field ${R+1}`),G.config||(G.config={}),G.values?G.values.length>F&&(F=G.values.length):G.values=new Array(F),G.type||(G.type=v(G)??g.fS.other),G});return{...N,fields:k,length:F}}},59425:(j,I,e)=>{"use strict";e.d(I,{m$:()=>r,pP:()=>i,xI:()=>s});var t=e(29241),n=e(32053);function i(g){return g.fields.length>2?!1:!!g.fields.find(d=>d.type===t.fS.time)}function s(g){return!g.find(d=>!i(d))}function r(g){for(let d=0;d<g.length;d++){const l=(0,n.sV)(g[d]);if(l.timeField!==void 0&&l.timeIndex!==void 0)return!0}return!1}},31317:(j,I,e)=>{"use strict";e.d(I,{K:()=>i,Z:()=>s});var t=e(8508);let n=()=>t.Ys;const i=r=>{n=r??n},s=r=>r?.timeZone??n()??t.Ys},1726:(j,I,e)=>{"use strict";e.r(I),e.d(I,{isMathString:()=>r,isValid:()=>d,parse:()=>g,parseDateMath:()=>l,roundToFiscal:()=>u});var t=e(89949),n=e.n(t),i=e(99633);const s=["y","M","w","d","h","m","s","Q"];function r(o){return o?!!(typeof o=="string"&&(o.substring(0,3)==="now"||o.includes("||"))):!1}function g(o,m,c,p){if(o){if(typeof o!="string")return(0,i.v9)(o)?o:(0,t.isDate)(o)?(0,i.CQ)(o):void 0;{let f,E="",h,y;return o.substring(0,3)==="now"?(f=(0,i.GY)(c),E=o.substring(3)):(h=o.indexOf("||"),h===-1?(y=o,E=""):(y=o.substring(0,h),E=o.substring(h+2)),f=(0,i.CQ)(y,i.VJ)),E.length?l(E,f,m,p):f}}}function d(o){const m=g(o);return m&&(0,i.v9)(m)?m.isValid():!1}function l(o,m,c,p=0){const f=o.replace(/\s/g,""),E=m;let h=0;const y=f.length;for(;h<y;){const v=f.charAt(h++);let D,a,C,P=!1;if(v==="/")D=0;else if(v==="+")D=1;else if(v==="-")D=2;else return;if(isNaN(parseInt(f.charAt(h),10)))a=1;else if(f.length===2)a=parseInt(f.charAt(h),10);else{const b=h;for(;!isNaN(parseInt(f.charAt(h),10));)if(h++,h>10)return;a=parseInt(f.substring(b,h),10)}if(D===0&&a!==1)return;if(C=f.charAt(h++),C==="f"&&(C=f.charAt(h++),P=!0),(0,t.includes)(s,C))D===0?P?u(p,E,C,c):c?E.endOf(C):E.startOf(C):D===1?E.add(a,C):D===2&&E.subtract(a,C);else return}return E}function u(o,m,c,p){switch(c){case"y":return p?u(o,m,c,!1).add(11,"M").endOf("M"):m.subtract((m.month()-o+12)%12,"M").startOf("M"),m;case"Q":return p?u(o,m,c,!1).add(2,"M").endOf("M"):m.subtract((m.month()-o+12)%3,"M").startOf("M"),m;default:return}}},32082:(j,I,e)=>{"use strict";e.d(I,{IA:()=>m,Ks:()=>d,RA:()=>g,fI:()=>c,iX:()=>l,jO:()=>o,qb:()=>u,vT:()=>r});var t=e(25430),n=e(71213),i=e(72124);const s={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 r(f,E=!0){if((0,t.Z)(f.start,f.end))return"";const h=(0,i.Z)(f);return Object.entries(h).reduce((y,[v,D])=>D&&D!==0&&!(v==="seconds"&&!E&&y)?y+`${y!==""?" ":""}${D}${s[v][0]}`:y,"")}function g(f){return f.split(" ").reduce((E,h)=>{const y=h.match(/(\d+)(.+)/),v=y?.[1],D=y?.[2];if(!(v&&D))return E;const a=Object.entries(s).find(([P,b])=>b?.includes(y[2])),C=parseInt(v,10);return a?{...E,[a[0]]:C}:E},{})}function d(f,E){return(0,n.Z)(f,E)}function l(f){const E=new Date;return d(E,f).getTime()-E.getTime()}function u(f){return!isNaN(Date.parse(f))}function o(f){for(const E of f.trim().split(" ")){const h=E.match(/(\d+)(.+)/);if(h===null||h.length!==3||!Object.entries(s).find(([v,D])=>D?.includes(h[2]))?.[0])return!1}return!0}function m(f){return p(f,["h","m","s","ms","us","\xB5s","ns"])}function c(f){return p(f,["y","M","w","d","h","m","s","ms","us","\xB5s","ns"])}function p(f,E){for(const h of f.trim().split(" ")){const y=h.match(/([0-9]*[.]?[0-9]+)(.+)/);if(y===null||y.length!==3||!E.includes(y[2]))return!1}return!0}},65347:(j,I,e)=>{"use strict";e.d(I,{Ji:()=>s,U6:()=>r,zf:()=>i});const t="YYYY-MM-DD HH:mm:ss",n="YYYY-MM-DD HH:mm:ss.SSS";class i{constructor(){this.fullDate=t,this.fullDateMS=n,this.interval={millisecond:"HH:mm:ss.SSS",second:"HH:mm:ss",minute:"HH:mm",hour:"MM/DD HH:mm",day:"MM/DD",month:"YYYY-MM",year:"YYYY"}}update(l){this.fullDate=l.fullDate,this.interval=l.interval,l.useBrowserLocale&&this.useBrowserLocale()}useBrowserLocale(){this.fullDate=s({year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),this.fullDateMS=this.fullDate.replace("ss","ss.SSS"),this.interval.millisecond=s({hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},null,this.interval.second).replace("ss","ss.SSS"),this.interval.second=s({hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},null,this.interval.second),this.interval.minute=s({hour:"2-digit",minute:"2-digit",hour12:!1},null,this.interval.minute),this.interval.hour=s({month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1},null,this.interval.hour),this.interval.day=s({month:"2-digit",day:"2-digit",hour12:!1},null,this.interval.day),this.interval.month=s({year:"numeric",month:"2-digit",hour12:!1},null,this.interval.month)}getTimeFieldUnit(l){return`time:${l?this.fullDateMS:this.fullDate}`}}function s(d,l,u){if(g())return u??t;!l&&navigator&&(l=[...navigator.languages]);const o=new Intl.DateTimeFormat(l||void 0,d),m=o.formatToParts(new Date),p={year:"YYYY",month:"MM",day:"DD",hour:o.resolvedOptions().hour12?"hh":"HH",minute:"mm",second:"ss",weekday:"ddd",era:"N",dayPeriod:"A",timeZoneName:"Z"};return m.map(f=>p[f.type]||f.value).join("")}const r=new i,g=()=>!("DateTimeFormat"in Intl)||!("formatToParts"in Intl.DateTimeFormat.prototype)},60956:(j,I,e)=>{"use strict";e.d(I,{E8:()=>d,Fm:()=>l,Hk:()=>u,dq:()=>r,lf:()=>g});var t=e(24588),n=e.n(t),i=e(31317),s=e(65347);const r=(c,p)=>m(c,(0,i.Z)(p)).format(o(p)),g=(c,p)=>m(c,(0,i.Z)(p)).format(),d=(c,p)=>m(c,(0,i.Z)(p)).fromNow(),l=(c,p)=>m(c,(0,i.Z)(p)).format(`${s.U6.fullDate} z`),u=(c,p)=>m(c,(0,i.Z)(p)).format("z"),o=c=>c?.defaultWithMS?c?.format??s.U6.fullDateMS:c?.format??s.U6.fullDate,m=(c,p)=>{const f=c,E=n().tz.zone(p);if(E&&E.name)return n().utc(f).tz(E.name);switch(p){case"utc":return n().utc(f);default:return n().utc(f).local()}}},51573:(j,I,e)=>{"use strict";e.d(I,{$8:()=>s.$8,CQ:()=>i.CQ,C_:()=>i.C_,D2:()=>i.D2,E8:()=>g.E8,Fm:()=>g.Fm,GY:()=>i.GY,Hk:()=>g.Hk,IA:()=>l.IA,J:()=>d.J,Ji:()=>r.Ji,K7:()=>u.K,Kd:()=>i.Kd,Ks:()=>l.Ks,Ls:()=>i.Ls,Pr:()=>s.Pr,RA:()=>l.RA,RQ:()=>s.RQ,Rn:()=>t,U6:()=>r.U6,VJ:()=>i.VJ,Vs:()=>s.Vs,ZV:()=>s.ZV,Ze:()=>u.Z,cT:()=>n,dq:()=>g.dq,fI:()=>l.fI,iX:()=>l.iX,i_:()=>i.i_,ig:()=>i.ig,jN:()=>i.jN,jO:()=>l.jO,k4:()=>i.k4,lf:()=>g.lf,np:()=>i.Ks,qb:()=>l.qb,v9:()=>i.v9,vT:()=>l.vT,zf:()=>r.zf,zh:()=>i.zh});var t=e(1726),n=e(76305),i=e(99633),s=e(80369),r=e(65347),g=e(60956),d=e(58018),l=e(32082),u=e(31317)},99633:(j,I,e)=>{"use strict";e.d(I,{CQ:()=>m,C_:()=>c,D2:()=>d,GY:()=>p,Kd:()=>r,Ks:()=>o,Ls:()=>h,VJ:()=>i,i_:()=>s,ig:()=>f,jN:()=>E,k4:()=>g,v9:()=>l,zh:()=>u});var t=e(79913),n=e.n(t);const i=n().ISO_8601,s=y=>{n().locale(y)},r=()=>n().locale(),g=()=>n().localeData(),d=y=>y===null||typeof y=="string"||typeof y=="number"||y instanceof Date||Array.isArray(y)&&y.every(v=>typeof v=="string"||typeof v=="number")||l(y),l=y=>n().isMoment(y),u=(y,v)=>n().utc(y,v),o=(y,v)=>n().duration(y,v),m=(y,v)=>n()(y,v),c=y=>m(y),p=(y,v,D)=>y==="utc"?u(v,D):m(v,D),f=y=>n().weekdays().findIndex(v=>v.toLowerCase()===y.toLowerCase()),E=y=>["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"].findIndex(v=>v.toLowerCase()===y.toLowerCase()),h=y=>{const v="-weekStart",D=r().replace(v,""),a=y?E(y):-1;a!==-1?n().locale(D+v,{parentLocale:D,week:{dow:a}}):s(D)}},58018:(j,I,e)=>{"use strict";e.d(I,{J:()=>u});var t=e(89949),n=e.n(t),i=e(24588),s=e.n(i),r=e(31317),g=e(1726),d=e(65347),l=e(99633);const u=(c,p)=>(0,l.v9)(c)?c:typeof c=="string"?o(c,p):m(c,p),o=(c,p)=>{if(c.indexOf("now")!==-1)return(0,g.isValid)(c)&&(0,g.parse)(c,p?.roundUp,p?.timeZone,p?.fiscalYearStartMonth)||s()();const f=(0,r.Z)(p),E=s().tz.zone(f),h=p?.format??d.U6.fullDate;if(E&&E.name)return s().tz(c,h,E.name);switch((0,t.lowerCase)(f)){case"utc":return s().utc(c,h);default:return s()(c,h)}},m=(c,p)=>{const f=c,E=(0,r.Z)(p),h=s().tz.zone(E);if(h&&h.name)return s().tz(f,h.name);switch((0,t.lowerCase)(E)){case"utc":return s().utc(f);default:return s()(f)}}},76305:(j,I,e)=>{"use strict";e.r(I),e.d(I,{calculateInterval:()=>C,convertRawToRange:()=>E,describeInterval:()=>M,describeTextRange:()=>m,describeTimeRange:()=>c,describeTimeRangeAbbreviation:()=>f,intervalToMs:()=>S,intervalToSeconds:()=>T,isFiscal:()=>y,isRelativeTimeRange:()=>v,isValidTimeSpan:()=>p,msRangeToTimeString:()=>a,relativeToTimeRange:()=>B,roundInterval:()=>x,secondsToHms:()=>D,timeRangeToRelative:()=>O});var t=e(89949),n=e.n(t),i=e(1726),s=e(60956),r=e(99633),g=e(58018);const d={s:{display:"second"},m:{display:"minute"},h:{display:"hour"},d:{display:"day"},w:{display:"week"},M:{display:"month"},y:{display:"year"}},l=[{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-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-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/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"}],u=[{from:"now",to:"now+1m",display:"Next minute"},{from:"now",to:"now+5m",display:"Next 5 minutes"},{from:"now",to:"now+15m",display:"Next 15 minutes"},{from:"now",to:"now+30m",display:"Next 30 minutes"},{from:"now",to:"now+1h",display:"Next hour"},{from:"now",to:"now+3h",display:"Next 3 hours"},{from:"now",to:"now+6h",display:"Next 6 hours"},{from:"now",to:"now+12h",display:"Next 12 hours"},{from:"now",to:"now+24h",display:"Next 24 hours"},{from:"now",to:"now+2d",display:"Next 2 days"},{from:"now",to:"now+7d",display:"Next 7 days"},{from:"now",to:"now+30d",display:"Next 30 days"},{from:"now",to:"now+90d",display:"Next 90 days"},{from:"now",to:"now+6M",display:"Next 6 months"},{from:"now",to:"now+1y",display:"Next year"},{from:"now",to:"now+2y",display:"Next 2 years"},{from:"now",to:"now+5y",display:"Next 5 years"}],o={};(0,t.each)(l,A=>{o[A.from+" to "+A.to]=A}),(0,t.each)(u,A=>{o[A.from+" to "+A.to]=A});function m(A){const V=A.indexOf("+")!==0;A.indexOf("now")===-1&&(A=(V?"now-":"now")+A);let W=o[A+" to now"];if(W)return W;V?W={from:A,to:"now"}:W={from:"now",to:A};const w=/^now([-+])(\d+)(\w)/.exec(A);if(w){const N=w[3],F=parseInt(w[2],10),k=d[N];k&&(W.display=V?"Last ":"Next ",W.display+=F+" "+k.display,W.section=k.section,F>1&&(W.display+="s"))}else W.display=W.from+" to "+W.to,W.invalid=!0;return W}function c(A,V){const W=o[A.from.toString()+" to "+A.to.toString()];if(W)return W.display;const w={timeZone:V};if((0,r.v9)(A.from)&&(0,r.v9)(A.to))return(0,s.dq)(A.from,w)+" to "+(0,s.dq)(A.to,w);if((0,r.v9)(A.from)){const N=i.parse(A.to,!0,"utc");return N?(0,s.dq)(A.from,w)+" to "+(0,s.E8)(N,w):""}if((0,r.v9)(A.to)){const N=i.parse(A.from,!1,"utc");return N?(0,s.E8)(N,w)+" to "+(0,s.dq)(A.to,w):""}return A.to.toString()==="now"?m(A.from).display:A.from.toString()+" to "+A.to.toString()}const p=A=>A.indexOf("$")===0||A.indexOf("+$")===0?!0:m(A).invalid!==!0,f=(A,V)=>{if((0,r.v9)(A.from))return(0,s.Hk)(A.from,{timeZone:V});const W=i.parse(A.from,!0);return W?(0,s.Hk)(W,{timeZone:V}):""},E=(A,V,W,w)=>{const N=(0,g.J)(A.from,{roundUp:!1,timeZone:V,fiscalYearStartMonth:W,format:w}),F=(0,g.J)(A.to,{roundUp:!0,timeZone:V,fiscalYearStartMonth:W,format:w});return i.isMathString(A.from)||i.isMathString(A.to)?{from:N,to:F,raw:A}:{from:N,to:F,raw:{from:N,to:F}}};function h(A){return typeof A=="string"?A.indexOf("now")>=0:!1}function y(A){return typeof A.raw.from=="string"&&A.raw.from.indexOf("f")>0?!0:typeof A.raw.to=="string"&&A.raw.to.indexOf("f")>0}function v(A){return h(A.from)||h(A.to)}function D(A){const V=Math.floor(A/31536e3);if(V)return V+"y";const W=Math.floor(A%31536e3/86400);if(W)return W+"d";const w=Math.floor(A%31536e3%86400/3600);if(w)return w+"h";const N=Math.floor(A%31536e3%86400%3600/60);if(N)return N+"m";const F=Math.floor(A%31536e3%86400%3600%60);if(F)return F+"s";const k=Math.floor(A*1e3);return k?k+"ms":"less than a millisecond"}function a(A){const V=Number((A/1e3).toFixed()),W=Math.floor(V/60/60),w=Math.floor(V/60)-W*60,N=Number((V%60).toFixed());let F=W?W+"h":"",k=w?w+"min":"",H=N?N+"sec":"";return F&&k?F=F+" ":F=F,(k||F)&&H?k=k+" ":k=k,F+k+H||"less than 1sec"}function C(A,V,W){let w=1;W&&(w=S(W));let N=x((A.to.valueOf()-A.from.valueOf())/V);return w>N&&(N=w),{intervalMs:N,interval:D(N/1e3)}}const P=/(-?\d+(?:\.\d+)?)(ms|[Mwdhmsy])/,b={y:31536e3,M:2592e3,w:604800,d:86400,h:3600,m:60,s:1,ms:.001};function M(A){if(Number(A))return{sec:b.s,type:"s",count:parseInt(A,10)};const V=A.match(P);if(!V||!(0,t.has)(b,V[2]))throw new Error(`Invalid interval string, has to be either unit-less or end with one of the following units: "${Object.keys(b).join(", ")}"`);return{sec:b[V[2]],type:V[2],count:parseInt(V[1],10)}}function T(A){const V=M(A);return V.sec*V.count}function S(A){const V=M(A);return V.sec*1e3*V.count}function x(A){switch(!0){case A<10:return 1;case A<15:return 10;case A<35:return 20;case A<75:return 50;case A<150:return 100;case A<350:return 200;case A<750:return 500;case A<1500:return 1e3;case A<3500:return 2e3;case A<7500:return 5e3;case A<12500:return 1e4;case A<17500:return 15e3;case A<25e3:return 2e4;case A<45e3:return 3e4;case A<9e4:return 6e4;case A<21e4:return 12e4;case A<45e4:return 3e5;case A<75e4:return 6e5;case A<105e4:return 9e5;case A<15e5:return 12e5;case A<27e5:return 18e5;case A<54e5:return 36e5;case A<9e6:return 72e5;case A<162e5:return 108e5;case A<324e5:return 216e5;case A<864e5:return 432e5;case A<6048e5:return 864e5;case A<18144e5:return 6048e5;case A<36288e5:return 2592e6;default:return 31536e6}}function O(A,V=(0,r.CQ)()){const W=V.unix()-A.from.unix(),w=V.unix()-A.to.unix();return{from:W,to:w}}function B(A,V=(0,r.CQ)()){const W=(0,r.CQ)(V).subtract(A.from,"s"),w=A.to===0?(0,r.CQ)(V):(0,r.CQ)(V).subtract(A.to,"s");return{from:W,to:w,raw:{from:W,to:w}}}},80369:(j,I,e)=>{"use strict";e.d(I,{$8:()=>o,Pr:()=>l,RQ:()=>g,Vs:()=>d,ZV:()=>u});var t=e(89949),n=e.n(t),i=e(24588),s=e.n(i),r=e(31317),g=(h=>(h.default="",h.localBrowserTime="browser",h.utc="utc",h))(g||{});const d=h=>{switch((0,r.Z)({timeZone:h})){case"browser":return"Local browser time";case"utc":return"UTC";default:return h}},l=(h,y)=>{const v=m(h,y);return v||p(h,y)},u=(0,t.memoize)((h=!1)=>{const y=[];return h===!0?y.push("","browser","utc"):h&&y.push(...h),s().tz.names().reduce((v,D)=>{const a=E[D];return!Array.isArray(a)||a.length===0||v.push(D),v},y)}),o=(0,t.memoize)((h=!1)=>{const v=u(h).reduce((D,a)=>{const C=a.indexOf("/");if(C===-1){const b="";return D[b]=D[b]??[],D[b].push(a),D}const P=a.slice(0,C);return D[P]=D[P]??[],D[P].push(a),D},{});return Object.keys(v).map(D=>({name:D,zones:v[D]}))}),m=(h,y)=>{switch(h){case"utc":return{name:"Coordinated Universal Time",ianaName:"UTC",zone:h,countries:[],abbreviation:"UTC, GMT",offsetInMins:0};case"":{const v=(0,r.Z)(),a=(v==="browser"||v==="utc"?m(v,y):p(v,y))??{};return{countries:E[v]??[],abbreviation:"",offsetInMins:0,...a,ianaName:a.ianaName,name:"Default",zone:h}}case"browser":{const v=s().tz.guess(!0),D=p(v,y)??{};return{countries:E[v]??[],abbreviation:"Your local time",offsetInMins:new Date().getTimezoneOffset(),...D,name:"Browser Time",ianaName:D.ianaName,zone:h}}default:return}},c=h=>/^(\+|\-).+/.test(h)?"":h,p=(h,y)=>{const v=s().tz.zone(h);if(v)return{name:h,ianaName:v.name,zone:h,countries:E[h]??[],abbreviation:c(v.abbr(y)),offsetInMins:v.utcOffset(y)}},f={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:"Serbia",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"},E=(()=>s().tz.countries().reduce((h,y)=>s().tz.zonesForCountry(y).reduce((D,a)=>{D[a]||(D[a]=[]);const C=f[y];return C&&D[a].push({code:y,name:C}),D},h),{}))()},62435:(j,I,e)=>{"use strict";e.d(I,{F:()=>s});var t=e(52751),n=e(48592),i=e(56361);class s{constructor(){this.subscribers=new Map,this.emitter=new t.Z}publish(d){this.emitter.emit(d.type,d)}subscribe(d,l){return this.getStream(d).subscribe({next:l})}getStream(d){return new n.y(l=>{const u=o=>{l.next(o)};return this.emitter.on(d.type,u),this.subscribers.set(u,l),()=>{this.emitter.off(d.type,u),this.subscribers.delete(u)}})}newScopedBus(d,l){return new r([d],this,l)}emit(d,l){typeof d=="string"?this.emitter.emit(d,{type:d,payload:l}):this.emitter.emit(d.name,{type:d.name,payload:l})}on(d,l,u){if(l.wrapper=o=>{l(o.payload)},typeof d=="string"?this.emitter.on(d,l.wrapper):this.emitter.on(d.name,l.wrapper),u){const o=u.$on("$destroy",()=>{this.off(d,l),o()})}}off(d,l){if(typeof d=="string"){this.emitter.off(d,l.wrapper);return}this.emitter.off(d.name,l.wrapper)}removeAllListeners(){this.emitter.removeAllListeners();for(const[d,l]of this.subscribers)l.complete(),this.subscribers.delete(d)}}class r{constructor(d,l,u){this.path=d,this.eventBus=l,this.filter=o=>this.filterConfig.onlyLocal?o.origin===this:!0,this.filterConfig=u??{onlyLocal:!1}}publish(d){d.origin||(d.origin=this),this.eventBus.publish(d)}getStream(d){return this.eventBus.getStream(d).pipe((0,i.h)(this.filter))}subscribe(d,l){return this.getStream(d).subscribe({next:l})}removeAllListeners(){this.eventBus.removeAllListeners()}newScopedBus(d,l){return new r([...this.path,d],this,l)}}},84714:(j,I,e)=>{"use strict";e.d(I,{Ix:()=>d,Pl:()=>g,es:()=>n,n1:()=>r,v9:()=>s,xH:()=>i});var t=e(96509);class n extends t.R{}n.type="data-hover";class i extends t.m{}i.type="data-hover-clear";class s extends t.R{}s.type="data-select";class r extends t.R{}r.type="annotation-event";class g extends t.R{}g.type="dashboard-loaded";class d extends t.m{}d.type="datasource-updated-successfully"},74817:(j,I,e)=>{"use strict";e.d(I,{X:()=>n});const t=new Set;function n(i){if(t.has(i))throw new Error(`There is already an event defined with type '${i}'`);return t.add(i),{name:i}}},56461:(j,I,e)=>{"use strict";e.d(I,{Fb:()=>i.F,Ix:()=>s.Ix,Pl:()=>s.Pl,R_:()=>n.R,Xw:()=>t.X,es:()=>s.es,mA:()=>n.m,n1:()=>s.n1,v9:()=>s.v9,xH:()=>s.xH});var t=e(74817),n=e(96509),i=e(62435),s=e(84714)},96509:(j,I,e)=>{"use strict";e.d(I,{R:()=>n,m:()=>t});class t{constructor(){this.type=this.__proto__.constructor.type}}class n extends t{constructor(s){super(),this.payload=s}}},35925:(j,I,e)=>{"use strict";e.d(I,{Z:()=>n});var t=e(25359);class n extends t.B{}},61965:(j,I,e)=>{"use strict";e.d(I,{U:()=>c,g:()=>f});var t=e(89949),n=e.n(t),i=e(32053),s=e(58018),r=e(99633),g=e(29241),d=e(17373),l=e(6850),u=e(21609),o=e(11024);const m={dateTimeAsIso:!0,dateTimeAsIsoNoDateIfToday:!0,dateTimeAsUS:!0,dateTimeAsUSNoDateIfToday:!0,dateTimeAsLocal:!0,dateTimeAsLocalNoDateIfToday:!0,dateTimeFromNow:!0};function c(h){if(!h||(0,t.isEmpty)(h)||!h.field)return p;const y=h.field,v=y.config??{},{palette:D}=h.theme.visualization;let a=v.unit,C=a&&(m[a]||a.startsWith("time:")),P=!1;if(y.type===g.fS.time&&!C){if(a="dateTimeAsSystem",C=!0,y.values&&y.values.length>1){let A=y.values[0],V=y.values[y.values.length-1];typeof A=="string"?(A=(0,s.J)(A).unix(),V=(0,s.J)(V).unix()):(A/=1e3,V/=1e3),P=Math.abs(V-A)<60}}else y.type===g.fS.boolean?(0,u.br)(a)||(a="bool"):!a&&y.type===g.fS.string&&(a="string");const b=a?.startsWith("currency"),M=(0,u.br)(a),T=y.type===g.fS.number,x=!C&&!b&&!M&&!(a==="locale")&&T&&v.decimals==null,O=(0,u.Cf)(a||"none"),B=(0,o.NI)(y,h.theme);return(A,V)=>{const{mappings:W}=v,w=a==="string";C&&typeof A=="string"&&(A=(0,r.zh)(A).valueOf());let N=w?NaN:(0,d.I)(A),F,k,H,R,_,G;if(W&&W.length>0){const X=(0,l.vh)(W,A);X&&(X.text!=null&&(F=X.text),X.color!=null&&(R=h.theme.visualization.getColorByName(X.color)),X.icon!=null&&(_=X.icon))}else if(y.type===g.fS.enum){if(A==null)return{text:"",numeric:NaN};const X=+A;if(v&&v.type&&v.type.enum){const{text:Q,color:se}=v.type.enum;if(F=Q?Q[X]:`${A}`,R=se?se[X]:void 0,R==null){const Z=D[X%D.length];R=h.theme.visualization.getColorByName(Z)}}}if(!Number.isNaN(N)){if(F==null&&!(0,t.isBoolean)(A)){let X;x&&V!=null?(X=O(N,V,null,h.timeZone,P),X.text=+X.text+""):X=O(N,v.decimals,null,h.timeZone,P),F=X.text,H=X.suffix,k=X.prefix}if(R==null){const X=B(N);R=X.color,G=X.percent}}if(F==null&&(0,t.isArray)(A)&&(F=(0,t.join)(A,", ")),F==null&&(F=(0,t.toString)(A),F||(v.noValue?F=v.noValue:F="")),!R){const X=B(-1/0);R=X.color,G=X.percent}const Y={text:F,numeric:N,prefix:k,suffix:H,color:R};return _!=null&&(Y.icon=_),G!=null&&(Y.percent=G),Y}}function p(h){return{text:(0,t.toString)(h),numeric:(0,d.I)(h)}}function f(){return h=>({text:(0,i.DP)(h)==="other"?`${JSON.stringify(h,E())}`:`${h}`,numeric:null})}const E=()=>{const h=new WeakSet;return(y,v)=>{if(typeof v=="object"&&v!==null){if(h.has(v))return;h.add(v)}return v}}},58192:(j,I,e)=>{"use strict";e.d(I,{QY:()=>f,WO:()=>m,YO:()=>E,fD:()=>p});var t=e(7975),n=e(57097),i=e.n(n),s=e(71685),r=e(96750),g=e(66656),d=e(93666),l=e(25359),u=e(11024),o=e(77104);const m=new l.B(()=>[{id:d.S.Fixed,name:"Single color",description:"Set a specific color",getCalculator:h},{id:d.S.Shades,name:"Shades of a color",description:"Select shades of a specific color",getCalculator:y},{id:d.S.Thresholds,name:"From thresholds",isByValue:!0,description:"Derive colors from thresholds",getCalculator:(v,D)=>(a,C,P)=>{const b=P??o.yM;return D.visualization.getColorByName(b.color)}},new c({id:d.S.PaletteClassic,name:"Classic palette",isContinuous:!1,isByValue:!1,getColors:v=>v.visualization.palette}),new c({id:d.S.PaletteClassicByName,name:"Classic palette (by series name)",isContinuous:!1,isByValue:!1,useSeriesName:!0,getColors:v=>v.visualization.palette.filter(D=>r.getContrastRatio(v.visualization.getColorByName(D),v.colors.background.primary)>=v.colors.contrastThreshold)}),new c({id:d.S.ContinuousGrYlRd,name:"Green-Yellow-Red",isContinuous:!0,isByValue:!0,getColors:v=>["green","yellow","red"]}),new c({id:d.S.ContinuousRdYlGr,name:"Red-Yellow-Green",isContinuous:!0,isByValue:!0,getColors:v=>["red","yellow","green"]}),new c({id:d.S.ContinuousBlYlRd,name:"Blue-Yellow-Red",isContinuous:!0,isByValue:!0,getColors:v=>["dark-blue","super-light-yellow","dark-red"]}),new c({id:d.S.ContinuousYlRd,name:"Yellow-Red",isContinuous:!0,isByValue:!0,getColors:v=>["super-light-yellow","dark-red"]}),new c({id:d.S.ContinuousBlPu,name:"Blue-Purple",isContinuous:!0,isByValue:!0,getColors:v=>["blue","purple"]}),new c({id:d.S.ContinuousYlBl,name:"Yellow-Blue",isContinuous:!0,isByValue:!0,getColors:v=>["super-light-yellow","dark-blue"]}),new c({id:d.S.ContinuousBlues,name:"Blues",isContinuous:!0,isByValue:!0,getColors:v=>["panel-bg","dark-blue"]}),new c({id:d.S.ContinuousReds,name:"Reds",isContinuous:!0,isByValue:!0,getColors:v=>["panel-bg","dark-red"]}),new c({id:d.S.ContinuousGreens,name:"Greens",isContinuous:!0,isByValue:!0,getColors:v=>["panel-bg","dark-green"]}),new c({id:d.S.ContinuousPurples,name:"Purples",isContinuous:!0,isByValue:!0,getColors:v=>["panel-bg","dark-purple"]})]);class c{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.hD)(this.colorCache)),this.interpolator}getCalculator(D,a){const C=this.getColors(a);return this.isByValue?this.isContinuous?(P,b,M)=>this.getInterpolator()(b):(P,b,M)=>C[b*(C.length-1)]:this.useSeriesName?(P,b,M)=>C[Math.abs(i()(D.name))%C.length]:(P,b,M)=>{const T=D.state?.seriesIndex??0;return C[T%C.length]}}}function p(v){return m.get(v.config.color?.mode??d.S.Thresholds)}function f(v){return m.get(v??d.S.Thresholds)}function E(v,D){const a=p(v);if(!a.isByValue)return{color:a.getCalculator(v,D)(0,0),threshold:o.yM,percent:1};const C=(0,u.NI)(v,D),P=v.config.color?.seriesBy??"last",M=(0,g.Kx)({field:v,reducers:[P]})[P]??0;return C(M)}function h(v,D){return()=>D.visualization.getColorByName(v.config.color?.fixedColor??d.R)}function y(v,D){return()=>{const a=D.visualization.getColorByName(v.config.color?.fixedColor??d.R),C=[a],P=6,b=10,M=35,T=35;for(let x=1;x<P;x++)C.push((0,s.Z)(a).spin(x/P*b).brighten(x/P*M).toHexString()),C.push((0,s.Z)(a).spin(-(x/P)*b).darken(x/P*T).toHexString());const S=v.state?.seriesIndex??0;return C[S%C.length]}}},91466:(j,I,e)=>{"use strict";e.d(I,{E1:()=>p,HU:()=>m,cB:()=>h,dE:()=>E,gG:()=>C,nG:()=>y,n_:()=>c,pZ:()=>f,r5:()=>T,sg:()=>P});var t=e(89949),n=e.n(t),i=e(27938),s=e(32053),r=e(76178),g=e(66656),d=e(19221),l=e(29241),u=e(61965),o=e(75578);const m="__series.name",c="__field.displayName",p="__field.labels",f="__calc",E="__cell_",h=25,y=x=>{const{replaceVariables:O,reduceOptions:B,timeZone:A,theme:V}=x,W=B.calcs.length?B.calcs:[g.gz.last],w=[],N=(0,r.sq)(B.fields?{id:d.mi.byRegexp,options:B.fields}:{id:d.mi.numeric}),F=x.data??[],k=B.limit?B.limit:h;let H=!1;for(let R=0;R<F.length&&!H;R++){const _=F[R],{timeField:G}=(0,s.sV)(_),Y=new i.U(_);for(let X=0;X<_.fields.length&&!H;X++){const Q=_.fields[X],se=Q.getLinks;if(!N(Q,_,F))continue;let Z=Q.config;Q.state?.range&&(Z={...Z,...Q.state?.range});let le=Q.config.displayName??"";const oe=Q.display??(0,u.U)({field:Q,theme:x.theme,timeZone:A});if(B.values)for(let q=0;q<Q.values.length;q++){Q.state=D(Q,w.length);const ne=S(Q,q),ge=oe(Q.values[q]),ae=v(_,Q,q,O,ne),re=a(ae,x.fieldConfig,V);if(w.push({name:"",field:Z,display:{...ge,title:ae,color:re??ge.color},view:Y,colIndex:X,rowIndex:q,getLinks:se?()=>se({valueRowIndex:q}):()=>[],hasLinks:C(Q)}),w.length>=k){H=!0;break}}else{const q=(0,g.Kx)({field:Q,reducers:W});for(const ne of W){const ge=Q.state?.scopedVars??{};ge[f]={value:ne,text:ne};const ae=oe(q[ne]);le!==""?ae.title=O(le,ge):ae.title=(0,o.CZ)(Q,_,F);let re;x.sparkline&&(re={y:_.fields[X],x:G},ne===g.gz.last?re.highlightIndex=re.y.values.length-1:ne===g.gz.first&&(re.highlightIndex=0)),w.push({name:ne,field:Z,display:ae,sparkline:re,view:Y,colIndex:X,getLinks:se?()=>se({calculatedValue:ae}):()=>[],hasLinks:C(Q)})}}}}return w.length===0&&w.push(b(x)),w};function v(x,O,B,A,V){const W=O.config.displayName;if(W)return W.indexOf(E)?A(T(W),V):A(W,V);let w=[],N=0;for(const F of x.fields)if(F!==O)if(F.type===l.fS.string){const k=F.values[B]??"",H=F.display?F.display(k).text:k;H.length>0&&w.push(H)}else F.type===l.fS.number&&N++;return(N||w.length===0)&&w.push((0,o.CZ)(O,x)),w.join(" ")}function D(x,O){return{...x.state,seriesIndex:O}}function a(x,O,B){for(const A of O.overrides)if(A.matcher.id==="byName"&&A.matcher.options===x){for(const V of A.properties)if(V.id==="color"&&V.value)return B.visualization.getColorByName(V.value.fixedColor)}return null}function C(x){return x.config?.links?.length?x.config.links.length>0:!1}function P(x){let O="",B="",A="",V="";for(let W=0;W<x.length;W++){const w=x[W].display;w.text&&w.text.length>B.length&&(B=w.text),w.title&&w.title.length>O.length&&(O=w.title),w.prefix&&w.prefix.length>A.length&&(A=w.prefix),w.suffix&&w.suffix.length>V.length&&(V=w.suffix)}return{text:B,title:O,suffix:V,prefix:A}}function b(x){const O="No data",{fieldConfig:B,timeZone:A}=x,{defaults:V}=B,w=(0,u.U)({field:{type:l.fS.other,config:V},theme:x.theme,timeZone:A})(null),N=M(w,O);return{name:O,field:{...V,max:V.max??0,min:V.min??0},display:{text:N,numeric:0,color:w.color},hasLinks:!1}}function M(x,O){return!x||(0,t.isEmpty)(x.text)?O:x.text}function T(x){return x.replace(/\${__cell_(\d+)(.*?)}|\[\[__cell_(\d+)(.*?)\]\]|\$__cell_(\d+)(\S*)/g,(O,B,A,V,W,w,N)=>`\${__data.fields[${B??V??w}]${A??W??N}}`)}function S(x,O){return x.state?.scopedVars?.__dataContext?{...x.state?.scopedVars,__dataContext:{value:{...x.state?.scopedVars?.__dataContext.value,rowIndex:O}}}:x.state?.scopedVars}},21708:(j,I,e)=>{"use strict";e.d(I,{Cc:()=>S,Of:()=>T,SM:()=>v,Xu:()=>y,gb:()=>b,oB:()=>M});var t=e(89949),n=e.n(t),i=e(27702),s=e(35719),r=e(64167),g=e(32053),d=e(64987),l=e(96750),u=e(66656),o=e(76178),m=e(29241),c=e(93666),p=e(94469),f=e(3569),E=e(61965),h=e(41199);function y(O){let B=null,A=null;const V=[u.gz.min,u.gz.max];for(const W of O)for(const w of W.fields)if(w.type===m.fS.number){const N=(0,u.Kx)({field:w,reducers:V}),F=N[u.gz.min],k=N[u.gz.max];(B===null||F<B)&&(B=F),(A===null||k>A)&&(A=k)}return{min:B,max:A,delta:(A??0)-(B??0)}}function v(O){if(!O.data)return[];const B=O.fieldConfig;if(!B)return O.data;const A=O.fieldConfigRegistry??h.N;let V=0,W;const w=[];if(B.overrides)for(const N of B.overrides){const F=o.Ls.get(N.matcher.id);F&&w.push({match:F.get(N.matcher.options),properties:N.properties})}return O.data.map((N,F)=>{const k={...N};k.fields=k.fields.map(H=>({...H,config:(0,t.cloneDeep)(H.config),state:{...H.state}}));for(const H of k.fields){const R=H.config;H.state.scopedVars={__dataContext:{value:{data:O.data,frame:k,frameIndex:F,field:H}}};const _={field:H,data:O.data,dataFrameIndex:F,replaceVariables:O.replaceVariables,fieldConfigRegistry:A};C(R,B.defaults,_);for(const X of w)if(X.match(H,k,O.data))for(const Q of X.properties)a(R,Q,_);let G=H.type;if(!G||G===m.fS.other){const X=(0,g.fu)(H);X&&(G=X)}let Y;if(H.type===m.fS.number){!W&&(!(0,t.isNumber)(R.min)||!(0,t.isNumber)(R.max))&&(W=y(O.data));const X=R.min??W.min,Q=R.max??W.max;Y={min:X,max:Q,delta:Q-X}}H.state.seriesIndex=V,H.state.range=Y,H.type=G,H.type!==m.fS.time&&V++,H.display=(0,E.U)({field:H,theme:O.theme,timeZone:O.timeZone}),H.config.unit!=="dateTimeFromNow"&&(H.display=D(H.display,2500)),H.getLinks=M(k,H,H.state.scopedVars,_.replaceVariables,O.timeZone)}return k})}function D(O,B=2500){const A=new Map;for(let V=-1;V<=15;V++)A.set(V,new Map);return(V,W)=>{let w=A.get(W??-1),N=w.get(V);return N||(w.size===B&&w.clear(),N=O(V,W),N.color&&(N.color=(0,l.asHexString)(N.color)),w.set(V,N)),N}}function a(O,B,A){const W=A.fieldConfigRegistry.getIfExists(B.id);if(!W)return;const w=W.process(B.value,A,W.settings);w==null?W.isCustom&&O.custom?(0,t.unset)(O.custom,W.path):(0,t.unset)(O,W.path):W.isCustom?(O.custom||(O.custom={}),(0,t.set)(O.custom,W.path,w)):(0,t.set)(O,W.path,w)}function C(O,B,A){O.links&&B.links&&(O.links=[...O.links,...B.links]);for(const V of A.fieldConfigRegistry.list())V.isCustom&&!O.custom&&(O.custom={}),P(V.isCustom?O.custom:O,V.isCustom?B.custom:B,V,A);b(O)}function P(O,B,A,V){const W=(0,t.get)(O,A.path);if(W==null){const w=V.fieldConfigRegistry.getIfExists(A.id);if(!w)return;if(w&&w.shouldApply(V.field)){const N=w.process((0,t.get)(B,w.path),V,w.settings);N!=null&&(0,t.set)(O,w.path,N)}}}function b(O){const{thresholds:B}=O;if(O.color?O.color.mode||delete O.color:B&&(O.color={mode:c.S.Thresholds}),O.hasOwnProperty("min")&&O.hasOwnProperty("max")&&O.min>O.max){const A=O.max;O.max=O.min,O.min=A}}const M=(O,B,A,V,W)=>w=>!B.config.links||B.config.links.length===0?[]:B.config.links.map(N=>{const F=x(O,B,A),k={...A,__dataContext:F},H=(G,Y,X)=>V(G,{...k,...Y},X);if(w.valueRowIndex!==void 0&&!isNaN(w.valueRowIndex)?F.value.rowIndex=w.valueRowIndex:F.value.calculatedValue=w.calculatedValue,N.onClick)return{href:N.url,title:V(N.title||"",k),target:N.targetBlank?"_blank":void 0,onClick:(G,Y)=>{N.onClick({origin:Y??B,e:G,replaceVariables:H})},origin:B};if(N.internal)return(0,f._)({link:N,internalLink:N.internal,scopedVars:k,field:B,range:N.internal.range??{},replaceVariables:V});let R=N.onBuildUrl?N.onBuildUrl({origin:B,replaceVariables:H}):N.url;return R&&(R=p.u.assureBaseUrl(R.replace(/\n/g,"")),R=V(R,k,r.b8.UriEncode),R=p.u.processUrl(R)),{href:R,title:V(N.title||"",k),target:N.targetBlank?"_blank":void 0,origin:B}});function T(O){if(!O||O.length===0)return[];const B=[...O],A=(0,E.g)();for(let V=0;V<B.length;V++){const W={...B[V]},w=[...W.fields];for(let N=0;N<w.length;N++)w[N]={...w[N],display:A};B[V]={...W,fields:w}}return B}function S(O,B,A,V,W,w){const N=O?.fieldConfigRegistry,F=(0,i.useRef)(0),k=(0,s.Z)(A?.series);return(0,i.useMemo)(()=>{if(!N||!B||!A)return;const H=A?.series;return A.structureRev==null&&H&&k&&!(0,d.nl)(H,k,d.Ch)&&F.current++,{structureRev:F.current,...A,series:v({data:H,fieldConfig:B,fieldConfigRegistry:N,replaceVariables:w,theme:W,timeZone:V})}},[N,B,A,k,V,W,w])}function x(O,B,A){return A?.__dataContext?{value:{...A.__dataContext.value}}:{value:{frame:O,field:B,data:[O]}}}},75578:(j,I,e)=>{"use strict";e.d(I,{$w:()=>l,CZ:()=>d,UY:()=>g,nf:()=>r});var t=e(89949),n=e.n(t),i=e(29241),s=e(14951);function r(m,c){if(m.name)return m.name;const p=[];for(const f of m.fields)if(f.type!==i.fS.time){if(p.length>1)break;p.push(d(f,m))}return p.length===1?p[0]:c===void 0?m.fields.filter(f=>f.type!==i.fS.time).map(f=>d(f,m)).join(", "):m.refId?`Series (${m.refId})`:`Series (${c})`}function g(m){m.forEach(c=>{c.fields.forEach(p=>{d(p,c,m)})})}function d(m,c,p){const f=m.state?.displayName,E=!!(p&&p.length>1);if(f&&E===m.state?.multipleFrames)return f;const h=l(m,c,p);return m.state=m.state||{},m.state.displayName=h,m.state.multipleFrames=E,h}function l(m,c,p){const f=m.config?.displayName&&m.config?.displayName.length;let E=f?m.config.displayName:m.name;if(f)return E;if(c&&m.config?.displayNameFromDS)return m.config.displayNameFromDS;if(m.type===i.fS.time&&!m.labels)return E??i.Ls;let h=[],y=!1;if(p&&p.length>1){for(let a=1;a<p.length;a++)if(p[a].name!==p[a-1].name){y=!0;break}}let v=!1,D=!1;if(y&&c?.name&&(h.push(c.name),v=!0),m.name&&m.name!==i.M5&&h.push(m.name),m.labels&&c){let a=o(p??[c]);if(a)m.labels[a]&&(h.push(m.labels[a]),D=!0);else{let C=(0,s.aA)(m.labels);C&&(h.push(C),D=!0)}}return c&&!v&&!D&&m.name===i.M5&&c.name&&c.name.length>0&&(h.push(c.name),v=!0),h.length?E=h.join(" "):m.name?E=m.name:E=i.M5,E===m.name&&(E=u(m,c)),E}function u(m,c){let p=0,f=!1;if(c)for(let E=0;E<c.fields.length;E++){const h=c.fields[E];if((0,t.isEqual)(m,h)){if(f=!0,p>0){p++;break}}else if(m.name===h.name&&(p++,f))break}return p?`${m.name} ${p}`:m.name}function o(m){let c=null;for(let p=0;p<m.length;p++){const f=m[p];for(const E of f.fields)if(E.labels){for(const h in E.labels)if(c===null)c=h;else if(h!==c)return null}}return c}},70732:(j,I,e)=>{"use strict";e.d(I,{z:()=>r});var t=e(89949),n=e.n(t),i=e(21609),s=e(61965);function r(g){return new Proxy({},{get:(d,l)=>{let u=g.frame.fields.find(p=>l===p.name);if(!u){const p=(0,t.toNumber)(l);u=g.frame.fields[p]}if(u||(u=g.frame.fields.find(p=>l===p.config.displayName)),u||(u=g.frame.fields.find(p=>p.labels?l===p.labels.name:!1)),!u)return;const o=u.display??(0,s.U)(),m=u.values[g.rowIndex],c=o(m);return c.toString=()=>(0,i.zc)(c),c}})}},33094:(j,I,e)=>{"use strict";e.d(I,{AE:()=>s.AE,CZ:()=>o.CZ,Cc:()=>l.Cc,E1:()=>t.E1,HU:()=>t.HU,N6:()=>i.N,NI:()=>m.NI,NN:()=>s.NN,Of:()=>l.Of,Oh:()=>s.Oh,QY:()=>r.QY,SM:()=>l.SM,SO:()=>i.S,UY:()=>o.UY,U_:()=>n.U,VB:()=>s.VB,W0:()=>s.W0,W4:()=>s.W4,WO:()=>r.WO,YO:()=>r.YO,ZD:()=>g.Z,ZN:()=>s.ZN,bP:()=>d.bP,cB:()=>t.cB,dE:()=>t.dE,dz:()=>m.dz,fD:()=>r.fD,gE:()=>n.g,gG:()=>t.gG,gb:()=>l.gb,kG:()=>s.kG,m1:()=>d.m1,nG:()=>t.nG,n_:()=>t.n_,nf:()=>o.nf,op:()=>s.op,pZ:()=>t.pZ,r5:()=>t.r5,sg:()=>t.sg,uj:()=>s.uj,xD:()=>m.xD,zv:()=>u.z});var t=e(91466),n=e(61965),i=e(41199),s=e(27001),r=e(58192),g=e(35925),d=e(77104),l=e(21708),u=e(70732),o=e(75578),m=e(11024)},27001:(j,I,e)=>{"use strict";e.d(I,{AE:()=>g,NN:()=>s,Oh:()=>n,VB:()=>u,W0:()=>i,W4:()=>o,ZN:()=>l,kG:()=>t,op:()=>d,uj:()=>r});const t=(m,c,p)=>m,n=(m,c,p)=>{if(m!=null)return parseFloat(m)},i=(m,c,p)=>(delete c.field?.state?.displayName,d(m,c,p)),s=(m,c,p)=>m,r=(m,c,p)=>m,g=(m,c,p)=>m,d=(m,c,p)=>m==null?m:p&&p.expandTemplateVars&&c.replaceVariables?c.replaceVariables(m,c.field.state.scopedVars):`${m}`,l=(m,c,p)=>m,u=(m,c,p)=>m,o=(m,c,p)=>m},11024:(j,I,e)=>{"use strict";e.d(I,{NI:()=>d,dz:()=>u,xD:()=>o});var t=e(89949),n=e.n(t),i=e(66656),s=e(29241),r=e(58192),g=e(77104);function d(m,c){if(m.type===s.fS.boolean)return l(m,c);const f=(0,r.fD)(m).getCalculator(m,c),E=m.state?.range??u(m);return h=>{let y=0;h!==-1/0&&(y=(h-E.min)/E.delta,Number.isNaN(y)&&(y=0));const v=(0,g.pD)(m,h,y);return{percent:y,threshold:v,color:f(h,y,v)}}}function l(m,c){const p={color:c.visualization.getColorByName("green"),percent:1,threshold:void 0},f={color:c.visualization.getColorByName("red"),percent:0,threshold:void 0},E=(0,r.fD)(m);if(E.isContinuous&&E.getColors){const h=E.getColors(c);p.color=h[h.length-1],f.color=h[0]}return h=>h?p:f}function u(m){if(m.type!==s.fS.number)return{min:0,max:100,delta:100};let c=m.config.min,p=m.config.max;if(!(0,t.isNumber)(c)||!(0,t.isNumber)(p))if(m.values&&m.values.length){const f=(0,i.Kx)({field:m,reducers:[i.gz.min,i.gz.max]});(0,t.isNumber)(c)||(c=f[i.gz.min]),(0,t.isNumber)(p)||(p=f[i.gz.max])}else c=0,p=100;return{min:c,max:p,delta:p-c}}function o(m,c){const{config:p}=m;let{min:f,max:E}=p;return(0,t.isNumber)(f)&&(0,t.isNumber)(E)?p:c||!m.state?.range?{...p,...u(m)}:{...p,...m.state.range}}},41199:(j,I,e)=>{"use strict";e.d(I,{N:()=>i,S:()=>s});var t=e(25359),n=e(35925);const i=new n.Z,s=new t.B},77104:(j,I,e)=>{"use strict";e.d(I,{bP:()=>g,m1:()=>s,pD:()=>r,yM:()=>i});var t=e(93666),n=e(5168);const i={value:0,color:t.R};function s(d,l){if(!l||l.length===0)return i;let u=l[0];for(const o of l)if(d>=o.value)u=o;else break;return u}function r(d,l,u){const{thresholds:o}=d.config;return o?.mode===n.H.Percentage?s(u*100,o?.steps):s(l,o?.steps)}function g(d){return d.sort((l,u)=>l.value-u.value)}},18752:(j,I,e)=>{"use strict";e.d(I,{q:()=>t.q1});var t=e(64167)},13597:(j,I,e)=>{"use strict";e.r(I),e.d(I,{AnnotationChangeEvent:()=>m.n1,AppendedVectors:()=>s.l$,ArrayDataFrame:()=>r.iB,ArrayVector:()=>s.Gt,AsNumberVector:()=>s.sq,BinaryOperationID:()=>t.LH,BinaryOperationVector:()=>s.rM,BusEventBase:()=>m.mA,BusEventWithPayload:()=>m.R_,ByNamesMatcherMode:()=>g.Ys,CSVHeaderStyle:()=>t.x5,CSVReader:()=>t.QM,CircularDataFrame:()=>r.a2,CircularVector:()=>s.dV,ConstantVector:()=>s.uI,DEFAULT_FIELD_DISPLAY_VALUES_LIMIT:()=>o.cB,DashboardLoadedEvent:()=>m.Pl,DataFrameView:()=>r.US,DataHoverClearEvent:()=>m.xH,DataHoverEvent:()=>m.es,DataLinkBuiltInVars:()=>t.WC,DataSelectEvent:()=>m.v9,DataSourcePluginContextProvider:()=>a.n,DataSourceUpdatedSuccessfully:()=>m.Ix,DataTransformerID:()=>g.Wk,DocsId:()=>t.xV,EventBusSrv:()=>m.Fb,FieldCache:()=>r.N,FieldConfigEditorBuilder:()=>t.vo,FieldConfigOptionsRegistry:()=>o.ZD,FieldMatcherID:()=>g.mi,FormattedVector:()=>s.$Y,FrameGeometrySourceMode:()=>f.q,FrameMatcherID:()=>g.E4,ISO_8601:()=>d.VJ,IndexVector:()=>s.rm,InternalTimeZones:()=>d.RQ,LayoutModes:()=>E.l,LegacyMappingType:()=>t.HU,MISSING_VALUE:()=>r.Yi,MatcherID:()=>g.Ff,MutableDataFrame:()=>r.vA,NodeGraphDataFrameFieldNames:()=>t.zG,PanelOptionsEditorBuilder:()=>t.rt,PanelPlugin:()=>h.c,PluginContextProvider:()=>D.b,ReducerID:()=>g.gz,Registry:()=>t.Bz,SortedVector:()=>s.oH,StreamingDataFrame:()=>r.Av,StreamingFrameAction:()=>r.T0,SystemDateFormatsState:()=>d.zf,TransformerCategory:()=>g.wf,VAR_CALC:()=>o.pZ,VAR_CELL_PREFIX:()=>o.dE,VAR_FIELD_LABELS:()=>o.E1,VAR_FIELD_NAME:()=>o.n_,VAR_SERIES_NAME:()=>o.HU,ValueMatcherID:()=>g.mE,addDurationToDate:()=>d.Ks,anySeriesWithTimeField:()=>r.m$,anyToNumber:()=>t.IX,applyFieldOverrides:()=>o.SM,applyRawFieldOverrides:()=>o.Of,arrayToDataFrame:()=>r.Pc,arrayUtils:()=>t.sq,binaryOperators:()=>t.nk,booleanOverrideProcessor:()=>o.W4,booleanValueFormatter:()=>u.IR,buildHistogram:()=>g.gY,cacheFieldDisplayNames:()=>o.UY,classicColors:()=>t.ZC,colorManipulator:()=>c.r8,compareArrayValues:()=>r.nl,compareDataFrameStructures:()=>r.Ch,containsSearchFilter:()=>t.bf,convertOldAngularValueMappings:()=>t.Jb,createDataFrame:()=>r.at,createDimension:()=>r.q2,createFieldConfigRegistry:()=>v.j,createTheme:()=>c.jG,dataFrameFromJSON:()=>r.vP,dataFrameToJSON:()=>r.Y,dataLinksOverrideProcessor:()=>o.NN,dateMath:()=>d.Rn,dateTime:()=>d.CQ,dateTimeAsMoment:()=>d.C_,dateTimeForTimeZone:()=>d.GY,dateTimeFormat:()=>d.dq,dateTimeFormatISO:()=>d.lf,dateTimeFormatTimeAgo:()=>d.E8,dateTimeFormatWithAbbrevation:()=>d.Fm,dateTimeParse:()=>d.J,decodeFieldValueEntities:()=>r.Jy,decodeFieldValueEnums:()=>r.Ib,deprecationWarning:()=>t.d9,displayNameOverrideProcessor:()=>o.W0,doStandardCalcs:()=>g.uP,durationToMilliseconds:()=>d.iX,ensureTimeField:()=>g.J_,escapeRegex:()=>l.yI,escapeStringForRegex:()=>l.GE,eventFactory:()=>m.Xw,fieldColorModeRegistry:()=>o.WO,fieldMatchers:()=>g.Ls,fieldReducers:()=>g.TB,filterFieldConfigOverrides:()=>y.aS,findCommonLabels:()=>t.FT,findHighlightChunksInText:()=>l.Xt,findMatchesInText:()=>l.lu,findUniqueLabels:()=>t.IU,fixCellTemplateExpressions:()=>o.r5,formatLabels:()=>t.aA,formattedValueToString:()=>u.zc,frameMatchers:()=>g.Ac,getActiveThreshold:()=>o.m1,getAllValuesFromDimension:()=>r.r7,getBuiltInThemes:()=>c.d5,getColumnFromDimension:()=>r.$q,getColumnsFromDimension:()=>r.GV,getDataFrameRow:()=>r.fh,getDataSourceRef:()=>t.iU,getDataSourceUID:()=>t.BT,getDimensionByName:()=>r.YP,getDisplayProcessor:()=>o.U_,getDisplayValueAlignmentFactors:()=>o.sg,getFieldColorMode:()=>o.QY,getFieldColorModeForField:()=>o.fD,getFieldConfigWithMinMax:()=>o.xD,getFieldDisplayName:()=>o.CZ,getFieldDisplayValues:()=>o.nG,getFieldDisplayValuesProxy:()=>o.zv,getFieldMatcher:()=>g.sq,getFieldSeriesColor:()=>o.YO,getFieldTypeFromValue:()=>r.DP,getFlotPairs:()=>t.k8,getFlotPairsConstant:()=>t.HE,getFrameDisplayName:()=>o.nf,getFrameMatchers:()=>g.b9,getHistogramFields:()=>g.qr,getLinksSupplier:()=>b.oB,getLocale:()=>d.Kd,getLocaleData:()=>d.k4,getMinMaxAndDelta:()=>o.dz,getPanelOptionsWithDefaults:()=>y.d4,getProcessedDataFrames:()=>r.F9,getRawDisplayProcessor:()=>o.gE,getScaleCalculator:()=>o.NI,getSearchFilterScopedVar:()=>t._6,getSeriesTimeStep:()=>t.e4,getThemeById:()=>c.jY,getTimeField:()=>r.sV,getTimeZone:()=>d.Ze,getTimeZoneGroups:()=>d.$8,getTimeZoneInfo:()=>d.Pr,getTimeZones:()=>d.ZV,getValueFormat:()=>u.Cf,getValueFormats:()=>u.QW,getValueFormatterIndex:()=>u.Td,getValueFromDimension:()=>r.jC,getValueMatcher:()=>g.IG,getWeekdayIndex:()=>d.ig,getWeekdayIndexByEnglishName:()=>d.jN,guessDecimals:()=>t.dP,guessFieldTypeForField:()=>r.fu,guessFieldTypeFromNameAndValue:()=>r._m,guessFieldTypeFromValue:()=>r.LI,guessFieldTypes:()=>r.SX,hasLinks:()=>o.gG,hasMsResolution:()=>t.fp,histogramBucketSizes:()=>g.Zi,histogramFieldInfo:()=>g.py,histogramFieldsToFrame:()=>g.zM,histogramFrameBucketMaxFieldName:()=>g.cO,histogramFrameBucketMinFieldName:()=>g.wL,histogramTransformer:()=>g.Op,identityOverrideProcessor:()=>o.kG,incrRound:()=>g.Jz,incrRoundDn:()=>g.mB,incrRoundUp:()=>g.UO,intervalToAbbreviatedDurationString:()=>d.vT,isBooleanUnit:()=>u.br,isCustomFieldProp:()=>y.Lc,isDataFrame:()=>r.aY,isDataSourcePluginContext:()=>P.v,isDataSourceRef:()=>t.cv,isDateTime:()=>d.v9,isDateTimeInput:()=>d.D2,isEmptyObject:()=>t.Qr,isHistogramFrameBucketMaxFieldName:()=>g.kl,isHistogramFrameBucketMinFieldName:()=>g.Ok,isLikelyAscendingVector:()=>g.lP,isStandardFieldProp:()=>y._k,isTableData:()=>r.Ji,isTimeSeriesFrame:()=>r.pP,isTimeSeriesFrames:()=>r.xI,isValidDate:()=>d.qb,isValidDuration:()=>d.jO,isValidGoDuration:()=>d.IA,isValidGrafanaDuration:()=>d.fI,localTimeFormat:()=>d.Ji,locale:()=>u.SP,locationUtil:()=>t.uT,makeClassES5Compatible:()=>t.s2,mapInternalLinkToExplore:()=>t._N,matchAllLabels:()=>t.VS,monacoLanguageRegistry:()=>p.F,numberOverrideProcessor:()=>o.Oh,objRemoveUndefined:()=>t.Hh,onUpdateDatasourceJsonDataOption:()=>t._R,onUpdateDatasourceJsonDataOptionChecked:()=>t.hz,onUpdateDatasourceJsonDataOptionSelect:()=>t.nx,onUpdateDatasourceOption:()=>t.z_,onUpdateDatasourceResetOption:()=>t.HD,onUpdateDatasourceSecureJsonDataOption:()=>t.fi,onUpdateDatasourceSecureJsonDataOptionSelect:()=>t.TX,outerJoinDataFrames:()=>g.JP,parseDuration:()=>d.RA,parseFlags:()=>l.TL,parseLabels:()=>t.J8,preProcessPanelData:()=>r.zR,rangeUtil:()=>d.cT,readCSV:()=>t.uP,reduceField:()=>g.Kx,renderLegendFormat:()=>t.Wn,renderMarkdown:()=>l.ap,renderTextPanelMarkdown:()=>l.xH,restoreCustomOverrideRules:()=>y.__,reverseDataFrame:()=>r.Y6,roundDecimals:()=>t.O9,scaledUnits:()=>u.Qj,selectOverrideProcessor:()=>o.AE,serializeStateToUrlParam:()=>t.S,setLocale:()=>d.i_,setTimeZoneResolver:()=>d.K7,setWeekStart:()=>d.Ls,shallowCompare:()=>r.Vv,simpleCountUnit:()=>u.SR,sortDataFrame:()=>r.aK,sortThresholds:()=>o.bP,standardEditorsRegistry:()=>o.SO,standardFieldConfigEditorRegistry:()=>o.N6,standardTransformers:()=>g.YR,standardTransformersRegistry:()=>g.Ze,stringFormater:()=>u.vb,stringOverrideProcessor:()=>o.op,stringStartsAsRegEx:()=>l.oH,stringToJsRegex:()=>l.jO,stringToMs:()=>l.e0,systemDateFormats:()=>d.U6,textUtil:()=>l.QX,thresholdsOverrideProcessor:()=>o.ZN,timeZoneAbbrevation:()=>d.Hk,timeZoneFormatUserFriendly:()=>d.Vs,toCSV:()=>t.MJ,toDataFrame:()=>r.g0,toDataFrameDTO:()=>r.og,toDuration:()=>d.np,toFilteredDataFrameDTO:()=>r.Aw,toFixed:()=>u.FH,toFixedScaled:()=>u.bn,toFixedUnit:()=>u.q2,toFloatOrUndefined:()=>l.dz,toIntegerOrUndefined:()=>l.By,toLegacyResponseData:()=>r.Zr,toNumberString:()=>l.PF,toOption:()=>t.Er,toPascalCase:()=>l.Mh,toUtc:()=>d.zh,transformDataFrame:()=>g.Hz,unEscapeStringFromRegex:()=>l.x6,unitOverrideProcessor:()=>o.VB,updateDatasourcePluginJsonDataOption:()=>t.tp,updateDatasourcePluginOption:()=>t.fd,updateDatasourcePluginResetOption:()=>t.Mf,updateDatasourcePluginSecureJsonDataOption:()=>t.uw,urlUtil:()=>t.Cj,useFieldOverrides:()=>o.Cc,usePluginContext:()=>C.g,validateFieldConfig:()=>o.gb,valueMappingsOverrideProcessor:()=>o.uj,valueMatchers:()=>g.U8,vectorator:()=>s.sD,withLoadingIndicator:()=>t.xc});var t=e(91648),n=e(312),i={};for(const M in n)["default","LayoutModes","PanelPlugin","getPanelOptionsWithDefaults","filterFieldConfigOverrides","restoreCustomOverrideRules","isCustomFieldProp","isStandardFieldProp","createFieldConfigRegistry","PluginContextProvider","DataSourcePluginContextProvider","usePluginContext","isDataSourcePluginContext","getLinksSupplier","BinaryOperationID","CSVHeaderStyle","CSVReader","DataLinkBuiltInVars","DocsId","FieldConfigEditorBuilder","LegacyMappingType","NodeGraphDataFrameFieldNames","PanelOptionsEditorBuilder","Registry","anyToNumber","arrayUtils","binaryOperators","classicColors","containsSearchFilter","convertOldAngularValueMappings","deprecationWarning","findCommonLabels","findUniqueLabels","formatLabels","getDataSourceRef","getDataSourceUID","getFlotPairs","getFlotPairsConstant","getSearchFilterScopedVar","getSeriesTimeStep","guessDecimals","hasMsResolution","isDataSourceRef","isEmptyObject","locationUtil","makeClassES5Compatible","mapInternalLinkToExplore","matchAllLabels","objRemoveUndefined","onUpdateDatasourceJsonDataOption","onUpdateDatasourceJsonDataOptionChecked","onUpdateDatasourceJsonDataOptionSelect","onUpdateDatasourceOption","onUpdateDatasourceResetOption","onUpdateDatasourceSecureJsonDataOption","onUpdateDatasourceSecureJsonDataOptionSelect","parseLabels","readCSV","renderLegendFormat","roundDecimals","serializeStateToUrlParam","toCSV","toOption","updateDatasourcePluginJsonDataOption","updateDatasourcePluginOption","updateDatasourcePluginResetOption","updateDatasourcePluginSecureJsonDataOption","urlUtil","withLoadingIndicator"].indexOf(M)<0&&(i[M]=()=>n[M]);e.d(I,i);var s=e(91382),r=e(88570),g=e(80254),d=e(51573),l=e(48154),u=e(3877),o=e(33094),m=e(56461),c=e(47043),p=e(37934),f=e(18752),E=e(47435),h=e(97585),y=e(83335),v=e(26946),D=e(90665),a=e(61576),C=e(93752),P=e(58971),b=e(21708)},37934:(j,I,e)=>{"use strict";e.d(I,{F:()=>t.F});var t=e(60519)},60519:(j,I,e)=>{"use strict";e.d(I,{F:()=>n});var t=e(25359);const n=new t.B},97585:(j,I,e)=>{"use strict";e.d(I,{c:()=>l});var t=e(89949),n=e.n(t),i=e(35925),s=e(9232),r=e(58939),g=e(2471),d=e(26946);class l extends s.Sg{constructor(o){super(),this._fieldConfigDefaults={defaults:{},overrides:[]},this._initConfigRegistry=()=>new i.Z,this.dataSupport={annotations:!1,alertStates:!1},this.panel=o}get defaults(){let o=this._defaults||{};if(!this._defaults&&this.optionsSupplier){const m=new g.rt;this.optionsSupplier(m,{data:[]});for(const c of m.getItems())c.defaultValue!=null&&(0,t.set)(o,c.path,c.defaultValue)}return o}get fieldConfigDefaults(){const o=this._fieldConfigDefaults.defaults;o.custom={};for(const m of this.fieldConfigRegistry.list())m.defaultValue!==void 0&&(0,t.set)(o,m.id,m.defaultValue);return{defaults:{...o},overrides:this._fieldConfigDefaults.overrides}}setDefaults(o){return(0,r.d)("PanelPlugin","setDefaults","setPanelOptions"),this._defaults=o,this}get fieldConfigRegistry(){return this._fieldConfigRegistry||(this._fieldConfigRegistry=this._initConfigRegistry()),this._fieldConfigRegistry}setEditor(o){return(0,r.d)("PanelPlugin","setEditor","setPanelOptions"),this.editor=o,this}setNoPadding(){return this.noPadding=!0,this}setMigrationHandler(o){return this.onPanelMigration=o,this}setPanelChangeHandler(o){return this.onPanelTypeChanged=o,this}setPanelOptions(o){return this.optionsSupplier=o,this}getPanelOptionsSupplier(){return this.optionsSupplier??(()=>{})}setDataSupport(o){return this.dataSupport={...this.dataSupport,...o},this}useFieldConfig(o={}){return this._initConfigRegistry=()=>(0,d.j)(o,this.meta.name),this}setSuggestionsSupplier(o){return this.suggestionsSupplier=o,this}getSuggestionsSupplier(){return this.suggestionsSupplier}hasPluginId(o){return this.meta.id===o}}},83335:(j,I,e)=>{"use strict";e.d(I,{Lc:()=>f,__:()=>p,_k:()=>E,aS:()=>u,d4:()=>d});var t=e(89949),n=e.n(t),i=e(58192),s=e(93666),r=e(25587),g=e(5168);function d({plugin:h,currentOptions:y,currentFieldConfig:v,isAfterPluginChange:D}){const a=(0,t.mergeWith)({},h.defaults,y||{},(b,M)=>{if((0,t.isArray)(M))return M}),C=l(v,h),P=m(h,C,D);return{options:a,fieldConfig:P}}function l(h,y){const v=y.fieldConfigDefaults,D={defaults:(0,t.mergeWith)({},v.defaults,h?h.defaults:{},(a,C)=>{if((0,t.isArray)(C))return C}),overrides:h?.overrides??[]};o(D.defaults,"",y.fieldConfigRegistry),D.defaults.thresholds&&c(D.defaults.thresholds),D.overrides=u(D.overrides,a=>y.fieldConfigRegistry.getIfExists(a.id)!==void 0);for(const a of D.overrides)for(const C of a.properties)C.id==="thresholds"&&c(C.value);return D}function u(h,y){return h.map(v=>{const D=v.properties.filter(y);return{...v,properties:D}}).filter(v=>v.properties.length>0)}function o(h,y,v){let D=!1;for(const a of Object.keys(h)){const C=h[a],P=`${y}${a}`,b=!!v.getIfExists(P);if(b){D=!0;continue}(0,t.isArray)(C)||!(0,t.isObject)(C)?b||(0,t.unset)(h,a):o(C,`${P}.`,v)||(0,t.unset)(h,a)}return D}function m(h,y,v){if(!v)return y;const D=h.fieldConfigRegistry.getIfExists(r.qb.Color);if(D&&D.settings){const a=D.settings,C=i.WO.getIfExists(y.defaults.color?.mode);if(!a.byValueSupport&&(!C||C.isByValue))return y.defaults.color={mode:s.S.PaletteClassic},y;if(a.byValueSupport&&a.preferThresholdsMode&&C?.id!==s.S.Fixed&&(!C||!C.isByValue))return y.defaults.color={mode:s.S.Thresholds},y;if(a.bySeriesSupport&&C?.isByValue)return y.defaults.color={mode:s.S.PaletteClassic},y}return y}function c(h){h.mode||(h.mode=g.H.Absolute),h.steps?h.steps.length&&(h.steps[0].value=-1/0):h.steps=[]}function p(h,y){const v={defaults:{...h.defaults,custom:y.defaults.custom},overrides:[...h.overrides]};for(const D of y.overrides)for(const a of D.properties)if(f(a)){const C=v.overrides.find(P=>(0,t.isEqual)(P.matcher,D.matcher));C?C!==D&&C.properties.push(a):v.overrides.push(D)}return v}function f(h){return h.id.startsWith("custom.")}function E(h){return!f(h)}},26946:(j,I,e)=>{"use strict";e.d(I,{j:()=>s});var t=e(35925),n=e(41199),i=e(2471);function s(g={},d){const l=new t.Z,u=n.N.list(),o={};if(g.useCustomConfig){const m=new i.vo;g.useCustomConfig(m);for(const c of m.getRegistry().list())if(c.isCustom=!0,c.id="custom."+c.id,r(c,u)){const p=o[c.category[0]]??[];p.push(c),o[c.category[0]]=p}else l.register(c)}for(let m of u)if(!(g.disableStandardOptions&&g.disableStandardOptions.indexOf(m.id)>-1)){if(g.standardOptions){const c=g.standardOptions[m.id]?.hideFromDefaults,p=g.standardOptions[m.id]?.defaultValue,f=g.standardOptions[m.id]?.settings;c&&(m={...m,hideFromDefaults:c}),p&&(m={...m,defaultValue:p}),f&&(m={...m,settings:m.settings?{...m.settings,...f}:f})}if(l.register(m),m.category&&o[m.category[0]])for(let c of o[m.category[0]])l.register(c)}for(const m of l.list())if(m.path.indexOf("[")>0)throw new Error(`[${d}] Field config paths do not support arrays: ${m.id}`);return l}function r(g,d){return!!d.find(l=>g.category&&l.category&&g.category[0]===l.category[0])}},48154:(j,I,e)=>{"use strict";e.d(I,{By:()=>t.By,GE:()=>t.GE,Mh:()=>t.Mh,PF:()=>t.PF,QX:()=>r,TL:()=>i.TL,Xt:()=>i.Xt,ap:()=>n.a,dz:()=>t.dz,e0:()=>t.e0,jO:()=>t.jO,lu:()=>i.lu,oH:()=>t.oH,x6:()=>t.x6,xH:()=>n.x,yI:()=>t.yI});var t=e(95676),n=e(18112),i=e(61329),s=e(42690);const r={escapeHtml:s.Xv,hasAnsiCodes:s.oT,sanitize:s.Nw,sanitizeTextPanelContent:s.he,sanitizeUrl:s.Nm,sanitizeSVGContent:s.Is,sanitizeTrustedTypes:s.cd,sanitizeTrustedTypesRSS:s.pQ}},18112:(j,I,e)=>{"use strict";e.d(I,{a:()=>g,x:()=>d});var t=e(18353),n=e(53938),i=e(42690);let s=!1;const r={headerIds:!1,pedantic:!1,gfm:!0,smartLists:!0,smartypants:!1,xhtml:!1,breaks:!1};function g(l,u){s||(t.TU.use((0,n.d)()),t.TU.setOptions({...r}),s=!0);let o;u?.breaks&&(o={...r,breaks:!0});const m=(0,t.TU)(l||"",o);return u?.noSanitize?m:(0,i.he)(m)}function d(l,u){s||(t.TU.use((0,n.d)()),t.TU.setOptions({...r}),s=!0);const o=(0,t.TU)(l||"");return u?.noSanitize?o:(0,i.he)(o)}},42690:(j,I,e)=>{"use strict";e.d(I,{Is:()=>c,Nm:()=>p,Nw:()=>l,Xv:()=>E,cd:()=>o,he:()=>m,oT:()=>f,pQ:()=>u});var t=e(54852),n=e(17032),i=e.n(n),s=e(3182),r=e.n(s);const g=Object.keys(s.whiteList).reduce((h,y)=>(h[y]=s.whiteList[y]?.concat(["class","style"]),h),{}),d=new s.FilterXSS({whiteList:g,css:{whiteList:{...s.getDefaultCSSWhiteList(),"flex-direction":!0,"flex-wrap":!0,"flex-basis":!0,"flex-grow":!0,"flex-shrink":!0,"flex-flow":!0,gap:!0,order:!0,"justify-content":!0,"justify-items":!0,"justify-self":!0,"align-items":!0,"align-content":!0,"align-self":!0}}});function l(h){try{return i().sanitize(h,{USE_PROFILES:{html:!0},FORBID_TAGS:["form","input"]})}catch{return console.error("String could not be sanitized",h),E(h)}}function u(h){return i().sanitize(h,{RETURN_TRUSTED_TYPE:!0,ADD_ATTR:["xmlns:atom","version","property","content"],ADD_TAGS:["rss","meta","channel","title","link","description","atom:link","item","pubDate","guid"],PARSER_MEDIA_TYPE:"application/xhtml+xml"})}function o(h){return i().sanitize(h,{RETURN_TRUSTED_TYPE:!0})}function m(h){try{return d.process(h)}catch{return console.error("String could not be sanitized",h),"Text string could not be sanitized"}}function c(h){return i().sanitize(h,{USE_PROFILES:{svg:!0,svgFilters:!0}})}function p(h){return(0,t.N)(h)}function f(h){return/\u001b\[\d{1,2}m/.test(h)}function E(h){return String(h).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}},95676:(j,I,e)=>{"use strict";e.d(I,{By:()=>p,GE:()=>d,Mh:()=>E,PF:()=>c,dz:()=>f,e0:()=>m,jO:()=>o,oH:()=>u,x6:()=>l,yI:()=>h});var t=e(89949),n=e.n(t);const s="([\\"+["(","[","{","}","]",")","\\","|","*","+","-",".","?","<",">","#","&","^","$"].join("\\")+"])",r=new RegExp(s,"g"),g=new RegExp("(\\\\)"+s,"g");function d(y){return y&&y.replace(r,"\\$1")}function l(y){return y&&y.replace(g,"$2")}function u(y){return y?y[0]==="/":!1}function o(y){if(!u(y))return new RegExp(`^${y}$`);const v=y.match(new RegExp("^/(.*?)/(g?i?m?y?s?)$"));if(!v)throw new Error(`'${y}' is not a valid regular expression.`);return new RegExp(v[1],v[2])}function m(y){if(!y)return 0;const v=parseInt(y,10),D=y.slice(String(v).length),a=1e3,C=a*60,P=C*60,b=P*24;switch(D){case"s":return v*a;case"m":return v*C;case"h":return v*P;case"d":return v*b;default:if(!D)return isNaN(v)?0:v;throw new Error("Not supported unit: "+D)}}function c(y){return y!=null&&Number.isFinite(y)?y.toString():""}function p(y){if(!y)return;const v=parseInt(y,10);return isNaN(v)?void 0:v}function f(y){if(!y)return;const v=parseFloat(y);return isNaN(v)?void 0:v}function E(y){const v=(0,t.camelCase)(y);return v.charAt(0).toUpperCase()+v.substring(1)}function h(y){return y.replace(/[\\^$*+?.()|[\]{}\/]/g,"\\$&")}},61329:(j,I,e)=>{"use strict";e.d(I,{TL:()=>g,Xt:()=>t,lu:()=>i});function t({searchWords:d,textToHighlight:l}){const u=[];for(const o of d)u.push(...i(l,o));return u}const n=d=>d.replace(/[[{(][\w,.\/:;<=>?:*+]+$/,"");function i(d,l){if(!d||!l)return[];const u=[],{cleaned:o,flags:m}=g(n(l));let c;try{c=new RegExp(`(?:${o})`,m)}catch{return u}return d.replace(c,(p,...f)=>{if(p){const E=f[f.length-2];u.push({text:p,start:E,length:p.length,end:E+p.length})}return""}),u}const s="-",r=/\(\?([ims-]+)\)/g;function g(d){const l=new Set(["g"]);return{cleaned:d.replace(r,(o,m)=>{const c=m.startsWith(s);for(let p=0;p<m.length;++p){const f=m.charAt(p);c||m.charAt(p-1)===s?l.delete(f):f!==s&&l.add(f)}return""}),flags:Array.from(l).join("")}}},96750:(j,I,e)=>{"use strict";e.r(I),e.d(I,{alpha:()=>f,asHexString:()=>g,asRgbString:()=>d,darken:()=>E,decomposeColor:()=>u,emphasize:()=>p,getContrastRatio:()=>m,getLuminance:()=>c,hexToRgb:()=>i,hslToRgb:()=>l,lighten:()=>h,recomposeColor:()=>o,rgbToHex:()=>r});var t=e(71685);function n(y,v=0,D=1){return Math.min(Math.max(v,y),D)}function i(y){y=y.slice(1);const v=new RegExp(`.{1,${y.length>=6?2:1}}`,"g");let D=y.match(v);return D&&D[0].length===1&&(D=D.map(a=>a+a)),D?`rgb${D.length===4?"a":""}(${D.map((a,C)=>C<3?parseInt(a,16):Math.round(parseInt(a,16)/255*1e3)/1e3).join(", ")})`:""}function s(y){const v=y.toString(16);return v.length===1?`0${v}`:v}function r(y){if(y.indexOf("#")===0)return y;const{values:v}=u(y);return`#${v.map(D=>s(D)).join("")}`}function g(y){if(y[0]==="#")return y;const v=(0,t.Z)(y);return v.getAlpha()===1?v.toHexString():v.toHex8String()}function d(y){return y.startsWith("rgb")?y:(0,t.Z)(y).toRgbString()}function l(y){const v=u(y),{values:D}=v,a=D[0],C=D[1]/100,P=D[2]/100,b=C*Math.min(P,1-P),M=(x,O=(x+a/30)%12)=>P-b*Math.max(Math.min(O-3,9-O,1),-1);let T="rgb";const S=[Math.round(M(0)*255),Math.round(M(8)*255),Math.round(M(4)*255)];return v.type==="hsla"&&(T+="a",S.push(D[3])),o({type:T,values:S})}function u(y){if(typeof y!="string")return y;if(y.charAt(0)==="#")return u(i(y));const v=y.indexOf("("),D=y.substring(0,v);if(["rgb","rgba","hsl","hsla","color"].indexOf(D)===-1)throw new Error(`Unsupported '${y}' color. The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()`);let a=y.substring(v+1,y.length-1),C;if(D==="color"){if(a=a.split(" "),C=a.shift(),a.length===4&&a[3].charAt(0)==="/"&&(a[3]=a[3].slice(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(C)===-1)throw new Error(`Unsupported ${C} color space. The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`)}else a=a.split(",");return a=a.map(P=>parseFloat(P)),{type:D,values:a,colorSpace:C}}function o(y){const{type:v,colorSpace:D}=y;let a=y.values;return v.indexOf("rgb")!==-1?a=a.map((C,P)=>P<3?parseInt(C,10):C):v.indexOf("hsl")!==-1&&(a[1]=`${a[1]}%`,a[2]=`${a[2]}%`),v.indexOf("color")!==-1?a=`${D} ${a.join(" ")}`:a=`${a.join(", ")}`,`${v}(${a})`}function m(y,v,D){const a=c(y),C=c(v,D);return(Math.max(a,C)+.05)/(Math.min(a,C)+.05)}function c(y,v){const D=u(y);let a=D.type==="hsl"?u(l(y)).values:D.values;if(v&&D.type==="rgba"){const P=u(v),b=a[3];a[0]=a[0]*b+P.values[0]*(1-b),a[1]=a[1]*b+P.values[1]*(1-b),a[2]=a[2]*b+P.values[2]*(1-b)}const C=a.map(P=>(D.type!=="color"&&(P/=255),P<=.03928?P/12.92:((P+.055)/1.055)**2.4));return Number((.2126*C[0]+.7152*C[1]+.0722*C[2]).toFixed(3))}function p(y,v=.15){return c(y)>.5?E(y,v):h(y,v)}function f(y,v){if(y==="")return"#000000";if(v=n(v),y[0]==="#"){if(y.length===9)y=y.substring(0,7);else if(y.length<=5){let a="#";for(let C=1;C<4;C++)a+=y[C]+y[C];y=a}return y+Math.round(v*255).toString(16).padStart(2,"0")}else{if(y[3]==="(")return y.replace(")",`, ${v})`);if(y[4]==="(")return y.substring(0,y.lastIndexOf(","))+`, ${v})`}const D=u(y);return D.type==="color"?D.values[3]=`/${v}`:D.values[3]=v,o(D)}function E(y,v){const D=u(y);if(v=n(v),D.type.indexOf("hsl")!==-1)D.values[2]*=1-v;else if(D.type.indexOf("rgb")!==-1||D.type.indexOf("color")!==-1)for(let a=0;a<3;a+=1)D.values[a]*=1-v;return o(D)}function h(y,v){const D=u(y);if(v=n(v),D.type.indexOf("hsl")!==-1)D.values[2]+=(100-D.values[2])*v;else if(D.type.indexOf("rgb")!==-1)for(let a=0;a<3;a+=1)D.values[a]+=(255-D.values[a])*v;else if(D.type.indexOf("color")!==-1)for(let a=0;a<3;a+=1)D.values[a]+=(1-D.values[a])*v;return o(D)}},45540:(j,I,e)=>{"use strict";e.d(I,{j:()=>W});function t(){const N=["xs","sm","md","lg","xl","xxl"],F="px",k={xs:0,sm:544,md:769,lg:992,xl:1200,xxl:1440};function H(_){return`@media (min-width:${typeof _=="number"?_:k[_]}${F})`}function R(_){return`@media (max-width:${(typeof _=="number"?_:k[_])-5/100}${F})`}return{values:k,up:H,down:R,keys:N,unit:F}}var n=e(89949),i=e(96750);const s={white:"#FFFFFF",black:"#000000",gray25:"#2c3235",gray15:"#22252b",gray10:"#181b1f",gray05:"#111217",darkLayer0:"#18181A",darkLayer1:"#212124",darkLayer2:"#2a2a2f",darkBorder1:"#34343B",darkBorder2:"#64646B",gray90:"#F4F5F5",gray100:"#F4F5F5",gray80:"#D0D1D3",lightBorder1:"#E4E7E7",blueDarkMain:"#3D71D9",blueDarkText:"#6E9FFF",redDarkMain:"#D10E5C",redDarkText:"#FF5286",greenDarkMain:"#1A7F4B",greenDarkText:"#6CCF8E",orangeDarkMain:"#FF9900",orangeDarkText:"#fbad37",blueLightMain:"#3871DC",blueLightText:"#1F62E0",redLightMain:"#E0226E",redLightText:"#CF0E5B",greenLightMain:"#1B855E",greenLightText:"#0A764E",orangeLightMain:"#FF9900",orangeLightText:"#B5510D"};class r{constructor(){this.mode="dark",this.whiteBase="204, 204, 220",this.border={weak:`rgba(${this.whiteBase}, 0.12)`,medium:`rgba(${this.whiteBase}, 0.20)`,strong:`rgba(${this.whiteBase}, 0.30)`},this.text={primary:`rgb(${this.whiteBase})`,secondary:`rgba(${this.whiteBase}, 0.65)`,disabled:`rgba(${this.whiteBase}, 0.6)`,link:s.blueDarkText,maxContrast:s.white},this.primary={main:s.blueDarkMain,text:s.blueDarkText,border:s.blueDarkText},this.secondary={main:`rgba(${this.whiteBase}, 0.10)`,shade:`rgba(${this.whiteBase}, 0.14)`,transparent:`rgba(${this.whiteBase}, 0.08)`,text:this.text.primary,contrastText:`rgb(${this.whiteBase})`,border:`rgba(${this.whiteBase}, 0.08)`},this.info=this.primary,this.error={main:s.redDarkMain,text:s.redDarkText},this.success={main:s.greenDarkMain,text:s.greenDarkText},this.warning={main:s.orangeDarkMain,text:s.orangeDarkText},this.background={canvas:s.gray05,primary:s.gray10,secondary:s.gray15},this.action={hover:`rgba(${this.whiteBase}, 0.16)`,selected:`rgba(${this.whiteBase}, 0.12)`,selectedBorder:s.orangeDarkMain,focus:`rgba(${this.whiteBase}, 0.16)`,hoverOpacity:.08,disabledText:this.text.disabled,disabledBackground:`rgba(${this.whiteBase}, 0.04)`,disabledOpacity:.38},this.gradients={brandHorizontal:"linear-gradient(270deg, #F55F3E 0%, #FF8833 100%)",brandVertical:"linear-gradient(0.01deg, #F55F3E 0.01%, #FF8833 99.99%)"},this.contrastThreshold=3,this.hoverFactor=.03,this.tonalOffset=.15}}class g{constructor(){this.mode="light",this.blackBase="36, 41, 46",this.primary={main:s.blueLightMain,border:s.blueLightText,text:s.blueLightText},this.text={primary:`rgba(${this.blackBase}, 1)`,secondary:`rgba(${this.blackBase}, 0.75)`,disabled:`rgba(${this.blackBase}, 0.50)`,link:this.primary.text,maxContrast:s.black},this.border={weak:`rgba(${this.blackBase}, 0.12)`,medium:`rgba(${this.blackBase}, 0.30)`,strong:`rgba(${this.blackBase}, 0.40)`},this.secondary={main:`rgba(${this.blackBase}, 0.08)`,shade:`rgba(${this.blackBase}, 0.15)`,transparent:`rgba(${this.blackBase}, 0.08)`,contrastText:`rgba(${this.blackBase}, 1)`,text:this.text.primary,border:this.border.weak},this.info={main:s.blueLightMain,text:s.blueLightText},this.error={main:s.redLightMain,text:s.redLightText,border:s.redLightText},this.success={main:s.greenLightMain,text:s.greenLightText},this.warning={main:s.orangeLightMain,text:s.orangeLightText},this.background={canvas:s.gray90,primary:s.white,secondary:s.gray100},this.action={hover:`rgba(${this.blackBase}, 0.12)`,selected:`rgba(${this.blackBase}, 0.08)`,selectedBorder:s.orangeLightMain,hoverOpacity:.08,focus:`rgba(${this.blackBase}, 0.12)`,disabledBackground:`rgba(${this.blackBase}, 0.04)`,disabledText:this.text.disabled,disabledOpacity:.38},this.gradients={brandHorizontal:"linear-gradient(90deg, #FF8833 0%, #F53E4C 100%)",brandVertical:"linear-gradient(0.01deg, #F53E4C -31.2%, #FF8833 113.07%)"},this.contrastThreshold=3,this.hoverFactor=.03,this.tonalOffset=.2}}function d(w){const N=new r,F=new g,k=(w.mode??"dark")==="dark"?N:F,{primary:H=k.primary,secondary:R=k.secondary,info:_=k.info,warning:G=k.warning,success:Y=k.success,error:X=k.error,tonalOffset:Q=k.tonalOffset,hoverFactor:se=k.hoverFactor,contrastThreshold:Z=k.contrastThreshold,...le}=w;function oe(ne,ge=Z){return(0,i.getContrastRatio)(N.text.maxContrast,ne,k.background.primary)>=ge?N.text.maxContrast:F.text.maxContrast}const q=({color:ne,name:ge})=>{if(ne={...ne,name:ge},!ne.main)throw new Error(`Missing main color for ${ge}`);return ne.text||(ne.text=ne.main),ne.border||(ne.border=ne.text),ne.shade||(ne.shade=k.mode==="light"?(0,i.darken)(ne.main,Q):(0,i.lighten)(ne.main,Q)),ne.transparent||(ne.transparent=(0,i.alpha)(ne.main,.15)),ne.contrastText||(ne.contrastText=oe(ne.main)),ne};return(0,n.merge)({...k,primary:q({color:H,name:"primary"}),secondary:q({color:R,name:"secondary"}),info:q({color:_,name:"info"}),error:q({color:X,name:"error"}),success:q({color:Y,name:"success"}),warning:q({color:G,name:"warning"}),getContrastText:oe,emphasize:(ne,ge)=>(0,i.emphasize)(ne,ge??se)},le)}function l(w,N){const F={padding:1,headerHeight:4,background:w.background.primary,borderColor:w.border.weak,boxShadow:"none"},k={borderColor:w.border.medium,borderHover:w.border.strong,text:w.text.primary,background:w.mode==="dark"?w.background.canvas:w.background.primary};return{height:{sm:3,md:4,lg:6},input:k,panel:F,dropdown:{background:k.background},tooltip:{background:w.background.secondary,text:w.text.primary},dashboard:{background:w.background.canvas,padding:1},overlay:{background:w.mode==="dark"?"rgba(63, 62, 62, 0.45)":"rgba(208, 209, 211, 0.24)"},sidemenu:{width:57},menuTabs:{height:41},textHighlight:{text:w.warning.contrastText,background:w.warning.main},horizontalDrawer:{defaultHeight:400},table:{rowHoverBackground:w.emphasize(w.background.primary,.03)}}}function u(w){return w.mode==="dark"?{z1:"0px 1px 2px rgba(1, 4, 9, 0.75)",z2:"0px 4px 8px rgba(1, 4, 9, 0.75)",z3:"0px 8px 24px rgb(1, 4, 9)"}:{z1:"0px 1px 2px rgba(24, 26, 27, 0.2)",z2:"0px 4px 8px rgba(24, 26, 27, 0.2)",z3:"0px 13px 20px 1px rgba(24, 26, 27, 0.18)"}}function o(w){const N=w.borderRadius??2;return{radius:{default:"2px",pill:"9999px",circle:"100%"},borderRadius:H=>`${(H??1)*N}px`}}function m(w={}){const{gridSize:N=8}=w,F=H=>typeof H=="string"?H:H*N,k=(...H)=>(H.length===0&&(H[0]=1),H.map(R=>{const _=F(R);return typeof _=="number"?`${_}px`:_}).join(" "));return k.gridSize=N,k}const c={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},p={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function f(w=["all"],N={}){const{duration:F=p.standard,easing:k=c.easeInOut,delay:H=0}=N;return(Array.isArray(w)?w:[w]).map(R=>`${R} ${typeof F=="string"?F:h(F)} ${k} ${typeof H=="string"?H:h(H)}`).join(",")}function E(w){if(!w)return 0;const N=w/36;return Math.round((4+15*N**.25+N/5)*10)}function h(w){return`${Math.round(w)}ms`}function y(){return{create:f,duration:p,easing:c,getAutoHeightDuration:E}}const v='"Inter", "Helvetica", "Arial", sans-serif',D="'Roboto Mono', monospace";function a(w,N={}){const{fontFamily:F=v,fontFamilyMonospace:k=D,fontSize:H=14,fontWeightLight:R=300,fontWeightRegular:_=400,fontWeightMedium:G=500,fontWeightBold:Y=500,htmlFontSize:X=14}=N,Q=H/14,se=q=>`${q/X*Q}rem`,Z=(q,ne,ge,ae,re)=>{if(ge%2!==0||ne%2!==0)throw new Error("Font size and line height should be integer multiples of 2 to prevent issues with alignment");return{fontFamily:F,fontWeight:q,fontSize:se(ne),lineHeight:ge/ne,...F===v?{letterSpacing:`${C(ae/ne)}em`}:{},...re}},le={h1:Z(_,28,32,-.25),h2:Z(_,24,28,0),h3:Z(_,22,24,0),h4:Z(_,18,22,.25),h5:Z(_,16,22,0),h6:Z(G,14,22,.15),body:Z(_,H,22,.15),bodySmall:Z(_,12,18,.15)};return{htmlFontSize:X,pxToRem:se,fontFamily:F,fontFamilyMonospace:k,fontSize:H,fontWeightLight:R,fontWeightRegular:_,fontWeightMedium:G,fontWeightBold:Y,size:{base:"14px",xs:"10px",sm:"12px",md:"14px",lg:"18px"},...le}}function C(w){return Math.round(w*1e5)/1e5}var P=e(40125);function b(w){const N={name:"Grafana Default",typography:{fontFamily:{sansSerif:w.typography.fontFamily,monospace:w.typography.fontFamilyMonospace},size:{base:`${w.typography.fontSize}px`,xs:w.typography.size.xs,sm:w.typography.size.sm,md:w.typography.size.md,lg:w.typography.size.lg},heading:{h1:w.typography.h1.fontSize,h2:w.typography.h2.fontSize,h3:w.typography.h3.fontSize,h4:w.typography.h4.fontSize,h5:w.typography.h5.fontSize,h6:w.typography.h6.fontSize},weight:{light:w.typography.fontWeightLight,regular:w.typography.fontWeightRegular,semibold:w.typography.fontWeightMedium,bold:w.typography.fontWeightBold},lineHeight:{xs:w.typography.bodySmall.lineHeight,sm:w.typography.bodySmall.lineHeight,md:w.typography.body.lineHeight,lg:w.typography.h2.lineHeight},link:{decoration:"none",hoverDecoration:"none"}},breakpoints:{xs:`${w.breakpoints.values.xs}px`,sm:`${w.breakpoints.values.sm}px`,md:`${w.breakpoints.values.md}px`,lg:`${w.breakpoints.values.lg}px`,xl:`${w.breakpoints.values.xl}px`,xxl:`${w.breakpoints.values.xxl}px`},spacing:{base:w.spacing.gridSize,insetSquishMd:w.spacing(.5,1),d:w.spacing(2),xxs:w.spacing(.25),xs:w.spacing(.5),sm:w.spacing(1),md:w.spacing(2),lg:w.spacing(3),xl:w.spacing(4),gutter:w.spacing(4),formSpacingBase:w.spacing.gridSize,formMargin:`${w.spacing.gridSize*4}px`,formFieldsetMargin:`${w.spacing.gridSize*2}px`,formInputHeight:w.spacing.gridSize*4,formButtonHeight:w.spacing.gridSize*4,formInputPaddingHorizontal:`${w.spacing.gridSize}px`,formInputAffixPaddingHorizontal:`${w.spacing.gridSize/2}px`,formInputMargin:`${w.spacing.gridSize*2}px`,formLabelPadding:"0 0 0 2px",formLabelMargin:`0 0 ${w.spacing.gridSize/2+"px"} 0`,formValidationMessagePadding:"4px 8px",formValidationMessageMargin:"4px 0 0 0",inlineFormMargin:"4px"},border:{radius:{sm:w.shape.borderRadius(1),md:w.shape.borderRadius(2),lg:w.shape.borderRadius(3)},width:{sm:"1px"}},height:{sm:w.spacing.gridSize*w.components.height.sm,md:w.spacing.gridSize*w.components.height.md,lg:w.spacing.gridSize*w.components.height.lg},panelPadding:w.components.panel.padding*w.spacing.gridSize,panelHeaderHeight:w.spacing.gridSize*w.components.panel.headerHeight,zIndex:w.zIndex},F={...M,black:"#000000",white:"#ffffff",dark1:"#141414",dark2:"#161719",dark3:"#1f1f20",dark4:"#212124",dark5:"#222426",dark6:"#262628",dark7:"#292a2d",dark8:"#2f2f32",dark9:"#343436",dark10:"#424345",gray1:"#555555",gray2:"#8e8e8e",gray3:"#b3b3b3",gray4:"#d8d9da",gray5:"#ececec",gray6:"#f4f5f8",gray7:"#fbfbfb",redBase:"#e02f44",redShade:"#c4162a",greenBase:"#299c46",greenShade:"#23843b",red:"#d44a3a",yellow:"#ecbb13",purple:"#9933cc",variable:"#32d1df",orange:"#eb7b18",orangeDark:"#ff780a"},k={bg1:w.colors.background.primary,bg2:w.colors.background.secondary,bg3:w.colors.action.hover,dashboardBg:w.colors.background.canvas,bgBlue1:w.colors.primary.main,bgBlue2:w.colors.primary.shade},H={border1:w.colors.border.weak,border2:w.colors.border.medium,border3:w.colors.border.strong},R={textStrong:w.colors.text.maxContrast,textHeading:w.colors.text.primary,text:w.colors.text.primary,textSemiWeak:w.colors.text.secondary,textWeak:w.colors.text.secondary,textFaint:w.colors.text.disabled,textBlue:w.colors.primary.text},_={formLabel:w.colors.text.primary,formDescription:w.colors.text.secondary,formInputBg:w.components.input.background,formInputBgDisabled:w.colors.action.disabledBackground,formInputBorder:w.components.input.borderColor,formInputBorderHover:w.components.input.borderHover,formInputBorderActive:w.colors.primary.border,formInputBorderInvalid:w.colors.error.border,formInputPlaceholderText:w.colors.text.disabled,formInputText:w.components.input.text,formInputDisabledText:w.colors.action.disabledText,formFocusOutline:w.colors.primary.main,formValidationMessageText:w.colors.error.contrastText,formValidationMessageBg:w.colors.error.main};return{...N,type:w.colors.mode==="dark"?P.Q.Dark:P.Q.Light,isDark:w.isDark,isLight:w.isLight,name:w.name,palette:{...F,brandPrimary:F.orange,brandSuccess:w.colors.success.main,brandWarning:w.colors.warning.main,brandDanger:w.colors.error.main,queryRed:w.colors.error.text,queryGreen:w.colors.success.text,queryPurple:"#fe85fc",queryOrange:F.orange,online:w.colors.success.main,warn:w.colors.success.main,critical:w.colors.success.main},colors:{...k,...H,..._,...R,bodyBg:w.colors.background.canvas,panelBg:w.components.panel.background,panelBorder:w.components.panel.borderColor,pageHeaderBg:w.colors.background.canvas,pageHeaderBorder:w.colors.background.canvas,dropdownBg:_.formInputBg,dropdownShadow:F.black,dropdownOptionHoverBg:k.bg2,link:w.colors.text.primary,linkDisabled:w.colors.text.disabled,linkHover:w.colors.text.maxContrast,linkExternal:w.colors.text.link},shadows:{listItem:"none"},visualization:w.visualization}}const M={gray98:"#f7f8fa",gray97:"#f1f5f9",gray95:"#e9edf2",gray90:"#dce1e6",gray85:"#c7d0d9",gray70:"#9fa7b3",gray60:"#7b8087",gray33:"#464c54",gray25:"#2c3235",gray15:"#202226",gray10:"#141619",gray05:"#0b0c0e",blue95:"#5794f2",blue85:"#33a2e5",blue80:"#3274d9",blue77:"#1f60c4",red88:"#e02f44"};var T=e(93666);function S(w){const N=w.mode==="light"?O():x(),F={};for(const R of N)for(const _ of R.shades)if(F[_.name]=_.color,_.aliases)for(const G of _.aliases)F[G]=_.color;F.transparent="rgba(0,0,0,0)",F["panel-bg"]=w.background.primary,F.text=w.text.primary;const k=R=>{if(!R)return T.R;const _=F[R];if(_)return _;if(R[0]==="#"||R.indexOf("rgb")>-1)return R;const G=A[R.toLowerCase()];return G?(F[R]=G,G):R},H=B();return{hues:N,palette:H,getColorByName:k}}function x(){return[{name:"red",shades:[{color:"#FFA6B0",name:"super-light-red"},{color:"#FF7383",name:"light-red"},{color:"#F2495C",name:"red",primary:!0},{color:"#E02F44",name:"semi-dark-red"},{color:"#C4162A",name:"dark-red"}]},{name:"orange",shades:[{color:"#FFCB7D",name:"super-light-orange",aliases:[]},{color:"#FFB357",name:"light-orange",aliases:[]},{color:"#FF9830",name:"orange",aliases:[],primary:!0},{color:"#FF780A",name:"semi-dark-orange",aliases:[]},{color:"#FA6400",name:"dark-orange",aliases:[]}]},{name:"yellow",shades:[{color:"#FFF899",name:"super-light-yellow",aliases:[]},{color:"#FFEE52",name:"light-yellow",aliases:[]},{color:"#FADE2A",name:"yellow",aliases:[],primary:!0},{color:"#F2CC0C",name:"semi-dark-yellow",aliases:[]},{color:"#E0B400",name:"dark-yellow",aliases:[]}]},{name:"green",shades:[{color:"#C8F2C2",name:"super-light-green",aliases:[]},{color:"#96D98D",name:"light-green",aliases:[]},{color:"#73BF69",name:"green",aliases:[],primary:!0},{color:"#56A64B",name:"semi-dark-green",aliases:[]},{color:"#37872D",name:"dark-green",aliases:[]}]},{name:"blue",shades:[{color:"#C0D8FF",name:"super-light-blue",aliases:[]},{color:"#8AB8FF",name:"light-blue",aliases:[]},{color:"#5794F2",name:"blue",aliases:[],primary:!0},{color:"#3274D9",name:"semi-dark-blue",aliases:[]},{color:"#1F60C4",name:"dark-blue",aliases:[]}]},{name:"purple",shades:[{color:"#DEB6F2",name:"super-light-purple",aliases:[]},{color:"#CA95E5",name:"light-purple",aliases:[]},{color:"#B877D9",name:"purple",aliases:[],primary:!0},{color:"#A352CC",name:"semi-dark-purple",aliases:[]},{color:"#8F3BB8",name:"dark-purple",aliases:[]}]}]}function O(){return[{name:"red",shades:[{color:"#FF7383",name:"super-light-red"},{color:"#F2495C",name:"light-red"},{color:"#E02F44",name:"red",primary:!0},{color:"#C4162A",name:"semi-dark-red"},{color:"#AD0317",name:"dark-red"}]},{name:"orange",shades:[{color:"#FFB357",name:"super-light-orange",aliases:[]},{color:"#FF9830",name:"light-orange",aliases:[]},{color:"#FF780A",name:"orange",aliases:[],primary:!0},{color:"#FA6400",name:"semi-dark-orange",aliases:[]},{color:"#E55400",name:"dark-orange",aliases:[]}]},{name:"yellow",shades:[{color:"#FFEE52",name:"super-light-yellow",aliases:[]},{color:"#FADE2A",name:"light-yellow",aliases:[]},{color:"#F2CC0C",name:"yellow",aliases:[],primary:!0},{color:"#E0B400",name:"semi-dark-yellow",aliases:[]},{color:"#CC9D00",name:"dark-yellow",aliases:[]}]},{name:"green",shades:[{color:"#96D98D",name:"super-light-green",aliases:[]},{color:"#73BF69",name:"light-green",aliases:[]},{color:"#56A64B",name:"green",aliases:[],primary:!0},{color:"#37872D",name:"semi-dark-green",aliases:[]},{color:"#19730E",name:"dark-green",aliases:[]}]},{name:"blue",shades:[{color:"#8AB8FF",name:"super-light-blue",aliases:[]},{color:"#5794F2",name:"light-blue",aliases:[]},{color:"#3274D9",name:"blue",aliases:[],primary:!0},{color:"#1F60C4",name:"semi-dark-blue",aliases:[]},{color:"#1250B0",name:"dark-blue",aliases:[]}]},{name:"purple",shades:[{color:"#CA95E5",name:"super-light-purple",aliases:[]},{color:"#B877D9",name:"light-purple",aliases:[]},{color:"#A352CC",name:"purple",aliases:[],primary:!0},{color:"#8F3BB8",name:"semi-dark-purple",aliases:[]},{color:"#7C2EA3",name:"dark-purple",aliases:[]}]}]}function B(){return["green","semi-dark-yellow","light-blue","semi-dark-orange","red","blue","purple","#705DA0","dark-green","yellow","#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"]}const A={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},V={navbarFixed:1e3,sidemenu:1020,dropdown:1030,typeahead:1030,tooltip:1040,modalBackdrop:1050,modal:1060,portal:1061};function W(w={}){const{colors:N={},spacing:F={},shape:k={},typography:H={}}=w,R=d(N),_=t(),G=m(F),Y=o(k),X=a(R,H),Q=u(R),se=y(),Z=l(R,Q),le=S(R),oe={name:R.mode==="dark"?"Dark":"Light",isDark:R.mode==="dark",isLight:R.mode==="light",colors:R,breakpoints:_,spacing:G,shape:Y,components:Z,typography:X,shadows:Q,transitions:se,visualization:le,zIndex:{...V},flags:{}};return{...oe,v1:b(oe)}}},47043:(j,I,e)=>{"use strict";e.d(I,{d5:()=>n.d,jG:()=>t.j,jY:()=>n.j,r8:()=>i});var t=e(45540),n=e(11391),i=e(96750)},11391:(j,I,e)=>{"use strict";e.d(I,{d:()=>s,j:()=>i});var t=e(25359),n=e(45540);function i(u){return(r.getIfExists(u)??r.get("dark")).build()}function s(u){return r.list().filter(o=>u?!0:!o.isExtra)}const r=new t.B(()=>[{id:"system",name:"System preference",build:g},{id:"dark",name:"Dark",build:()=>(0,n.j)({colors:{mode:"dark"}})},{id:"light",name:"Light",build:()=>(0,n.j)({colors:{mode:"light"}})},{id:"blue-night",name:"Blue night",build:l,isExtra:!0},{id:"midnight",name:"Midnight",build:d,isExtra:!0}]);function g(){const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";return i(o)}function d(){const u="204, 204, 220";return(0,n.j)({name:"Midnight",colors:{mode:"dark",background:{canvas:"#000000",primary:"#000000",secondary:"#181818"},border:{weak:`rgba(${u}, 0.17)`,medium:`rgba(${u}, 0.25)`,strong:`rgba(${u}, 0.35)`}}})}function l(){return(0,n.j)({name:"Blue night",colors:{mode:"dark",background:{canvas:"#15161d",primary:"#15161d",secondary:"#1d1f2e"},border:{weak:"#2e304f",medium:"#2e304f",strong:"#2e304f"}}})}},66656:(j,I,e)=>{"use strict";e.d(I,{Kx:()=>d,TB:()=>l,gz:()=>g,uP:()=>u});var t=e(89949),n=e.n(t),i=e(53933),s=e(29241),r=e(25359),g=(y=>(y.sum="sum",y.max="max",y.min="min",y.logmin="logmin",y.mean="mean",y.variance="variance",y.stdDev="stdDev",y.last="last",y.first="first",y.count="count",y.range="range",y.diff="diff",y.diffperc="diffperc",y.delta="delta",y.step="step",y.firstNotNull="firstNotNull",y.lastNotNull="lastNotNull",y.changeCount="changeCount",y.distinctCount="distinctCount",y.allIsZero="allIsZero",y.allIsNull="allIsNull",y.allValues="allValues",y.uniqueValues="uniqueValues",y))(g||{});function d(y){const{field:v,reducers:D}=y;if(!v||!D||D.length<1)return{};if(v.state?.calcs){const S=[];for(const x of D)v.state.calcs.hasOwnProperty(x)||S.push(x);if(S.length<1)return{...v.state.calcs}}v.state||(v.state={});const a=l.list(D);if(v.values.length<1){const S={...v.state.calcs};for(const x of a)S[x.id]=x.emptyInputResult!==null?x.emptyInputResult:null;return v.state.calcs=S}const{nullValueMode:P}=v.config,b=P===i.Gl.Ignore,M=P===i.Gl.AsZero;if(a.length===1&&a[0].reduce){const S=a[0].reduce(v,b,M);return v.state.calcs={...v.state.calcs,...S},S}let T=u(v,b,M);for(const S of a)!T.hasOwnProperty(S.id)&&S.reduce&&(T={...T,...S.reduce(v,b,M)});return v.state.calcs={...v.state.calcs,...T},T}const l=new r.B(()=>[{id:"lastNotNull",name:"Last *",description:"Last non-null value",standard:!0,aliasIds:["current"],reduce:p},{id:"last",name:"Last",description:"Last value",standard:!0,reduce:c},{id:"firstNotNull",name:"First *",description:"First non-null value",standard:!0,reduce:m},{id:"first",name:"First",description:"First Value",standard:!0,reduce:o},{id:"min",name:"Min",description:"Minimum Value",standard:!0},{id:"max",name:"Max",description:"Maximum Value",standard:!0},{id:"mean",name:"Mean",description:"Average Value",standard:!0,aliasIds:["avg"]},{id:"variance",name:"Variance",description:"Variance of all values in a field",standard:!1,reduce:f},{id:"stdDev",name:"StdDev",description:"Standard deviation of all values in a field",standard:!1,reduce:f},{id:"sum",name:"Total",description:"The sum of all values",emptyInputResult:0,standard:!0,aliasIds:["total"]},{id:"count",name:"Count",description:"Number of values in response",emptyInputResult:0,standard:!0},{id:"range",name:"Range",description:"Difference between minimum and maximum values",standard:!0},{id:"delta",name:"Delta",description:"Cumulative change in value",standard:!0},{id:"step",name:"Step",description:"Minimum interval between values",standard:!0},{id:"diff",name:"Difference",description:"Difference between first and last values",standard:!0},{id:"logmin",name:"Min (above zero)",description:"Used for log min scale",standard:!0},{id:"allIsZero",name:"All Zeros",description:"All values are zero",emptyInputResult:!1,standard:!0},{id:"allIsNull",name:"All Nulls",description:"All values are null",emptyInputResult:!0,standard:!0},{id:"changeCount",name:"Change Count",description:"Number of times the value changes",standard:!1,reduce:E},{id:"distinctCount",name:"Distinct Count",description:"Number of distinct values",standard:!1,reduce:h},{id:"diffperc",name:"Difference percent",description:"Percentage difference between first and last values",standard:!0},{id:"allValues",name:"All values",description:"Returns an array with all values",standard:!1,reduce:y=>({allValues:y.values})},{id:"uniqueValues",name:"All unique values",description:"Returns an array with all unique values",standard:!1,reduce:y=>({uniqueValues:[...new Set(y.values)]})}]);function u(y,v,D){const a={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},C=y.values;a.count=v?C.length:C.filter(b=>b!=null).length;const P=y.type===s.fS.number||s.fS.time;for(let b=0;b<C.length;b++){let M=C[b];if(b===0&&(a.first=M),a.last=M,M===null){if(v)continue;D&&(M=0)}if(M!=null){const T=a.firstNotNull===null;if(T&&(a.firstNotNull=M),P){if(a.sum+=M,a.allIsNull=!1,a.nonNullCount++,!T){const S=M-a.lastNotNull;a.step>S&&(a.step=S),a.lastNotNull>M?(a.previousDeltaUp=!1,b===C.length-1&&(a.delta+=M)):(a.previousDeltaUp?a.delta+=S:a.delta+=M,a.previousDeltaUp=!0)}M>a.max&&(a.max=M),M<a.min&&(a.min=M),M<a.logmin&&M>0&&(a.logmin=M)}M!==0&&(a.allIsZero=!1),a.lastNotNull=M}}return a.max===-Number.MAX_VALUE&&(a.max=null),a.min===Number.MAX_VALUE&&(a.min=null),a.step===Number.MAX_VALUE&&(a.step=null),a.nonNullCount>0&&(a.mean=a.sum/a.nonNullCount),a.allIsNull&&(a.allIsZero=!1),a.max!==null&&a.min!==null&&(a.range=a.max-a.min),(0,t.isNumber)(a.firstNotNull)&&(0,t.isNumber)(a.lastNotNull)&&(a.diff=a.lastNotNull-a.firstNotNull),(0,t.isNumber)(a.firstNotNull)&&(0,t.isNumber)(a.diff)&&(a.diffperc=a.diff/a.firstNotNull),a}function o(y,v,D){return{first:y.values[0]}}function m(y,v,D){const a=y.values;for(let C=0;C<a.length;C++){const P=a[C];if(P!=null&&P!==void 0)return{firstNotNull:P}}return{firstNotNull:null}}function c(y,v,D){const a=y.values;return{last:a[a.length-1]}}function p(y,v,D){const a=y.values;let C=a.length-1;for(;C>=0;){const P=a[C--];if(P!=null&&P!==void 0)return{lastNotNull:P}}return{lastNotNull:null}}function f(y,v,D){if(!(y.type===s.fS.number||y.type===s.fS.time))return{variance:0,stdDev:0};let a=0,C=0,P=0;const b=y.values;for(let M=0;M<b.length;M++){const T=b[M];if(T!=null){P++;let S=C;C+=(T-S)/P,a+=(T-S)*(T-C)}}if(P>0){const M=a/P;return{variance:M,stdDev:Math.sqrt(M)}}return{variance:0,stdDev:0}}function E(y,v,D){const a=y.values;let C=0,P=!0,b=null;for(let M=0;M<a.length;M++){let T=a[M];if(T===null){if(v)continue;D&&(T=0)}!P&&b!==T&&C++,P=!1,b=T}return{changeCount:C}}function h(y,v,D){const a=y.values,C=new Set;for(let P=0;P<a.length;P++){let b=a[P];if(b===null){if(v)continue;D&&(b=0)}C.add(b)}return{distinctCount:C.size}}},80254:(j,I,e)=>{"use strict";e.d(I,{Ac:()=>i.Ac,E4:()=>t.E4,Ff:()=>t.Ff,Hz:()=>g.H,IG:()=>i.IG,JP:()=>u._9,J_:()=>m.J_,Jz:()=>o.Jz,Kx:()=>r.Kx,Ls:()=>i.Ls,Ok:()=>o.Ok,Op:()=>o.Op,TB:()=>r.TB,U8:()=>i.U8,UO:()=>o.UO,Wk:()=>n.W,YR:()=>s.Y,Ys:()=>l.Ys,Ze:()=>d.Z,Zi:()=>o.Zi,b9:()=>i.b9,cO:()=>o.cO,gY:()=>o.gY,gz:()=>r.gz,kl:()=>o.kl,lP:()=>u.lP,mB:()=>o.mB,mE:()=>t.mE,mi:()=>t.mi,py:()=>o.py,qr:()=>o.qr,sq:()=>i.sq,uP:()=>r.uP,wL:()=>o.wL,wf:()=>d.w,zM:()=>o.zM});var t=e(19221),n=e(14544),i=e(76178),s=e(44885),r=e(66656),g=e(83667),d=e(52273),l=e(1141),u=e(48962),o=e(35596),m=e(95381)},76178:(j,I,e)=>{"use strict";e.d(I,{Ac:()=>f,IG:()=>v,Ls:()=>p,U8:()=>E,b9:()=>y,sq:()=>h});var t=e(25359),n=e(7303),i=e(84297),s=e(1141),r=e(69759),g=e(53557),d=e(46079),l=e(18257),u=e(16909),o=e(38975),m=e(25922),c=e(64397);const p=new t.B(()=>[...(0,r.Ty)(),...(0,n.N)(),...(0,s.Lk)(),...(0,d.z)(),i.b]),f=new t.B(()=>[...(0,r.fX)(),...(0,s.cC)(),...(0,g.n)()]),E=new t.B(()=>[...(0,u.a)(),...(0,o.H)(),...(0,l.T)(),...(0,m.G)(),...(0,c.G)()]);function h(D){const a=p.get(D.id);if(!a)throw new Error("Unknown field matcher: "+D.id);return a.get(D.options)}function y(D){const a=f.get(D.id);if(!a)throw new Error("Unknown frame matcher: "+D.id);return a.get(D.options)}function v(D){const a=E.get(D.id);if(!a)throw new Error("Unknown value matcher: "+D.id);return a.get(D.options)}},1141:(j,I,e)=>{"use strict";e.d(I,{Lk:()=>f,Ys:()=>r,cC:()=>E});var t=e(75578),n=e(95676),i=e(29241),s=e(19221),r=(h=>(h.exclude="exclude",h.include="include",h))(r||{});const g={id:s.mi.byName,name:"Field Name",description:"match the field name",defaultOptions:"",get:h=>{const v=l(new Set([h]));return(D,a,C)=>h===D.name||h===(0,t.CZ)(D,a,C)||!!(v&&v(D,a,C))},getOptionsDisplayText:h=>`Field name: ${h}`},d={id:s.mi.byNames,name:"Field Names",description:"match any of the given the field names",defaultOptions:{mode:"include",names:[]},get:h=>{const{names:y,mode:v="include"}=h,D=new Set(y??[]),a=l(D),C=(P,b,M)=>D.has(P.name)||D.has((0,t.CZ)(P,b,M))||!!(a&&a(P,b,M));return v==="exclude"?(P,b,M)=>!C(P,b,M):C},getOptionsDisplayText:h=>{const{names:y,mode:v}=h,D=(y??[]).join(", ");return v==="exclude"?`All except: ${D}`:`All of: ${D}`}};function l(h){let y;return window?.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback&&(h.has(i.M5)?y=(D,a)=>!!D.labels&&D.labels?.__name__===D.name:(h.has("Time")||h.has("time"))&&(y=(D,a)=>a.meta?.typeVersion==null&&D.type===i.fS.time)),y}const u={id:s.mi.byRegexp,name:"Field Name by Regexp",description:"match the field name by a given regexp pattern",defaultOptions:"/.*/",get:h=>{const y=c(h);return(v,D,a)=>{const C=(0,t.CZ)(v,D,a);return!!y&&y.test(C)}},getOptionsDisplayText:h=>`Field name by pattern: ${h}`},o={id:s.mi.byFrameRefID,name:"Fields by frame refId",description:"match all fields returned in data frame with refId.",defaultOptions:"",get:h=>(y,v,D)=>v.refId===h,getOptionsDisplayText:h=>`Math all fields returned by query with reference ID: ${h}`},m={id:s.mi.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:h=>{const y=u.get(h?.pattern||""),v=d.get({mode:"include",names:h?.names??[]});return(D,a,C)=>v(D,a,C)||y(D,a,C)},getOptionsDisplayText:h=>{const y=h?.pattern??"",v=h?.names?.join(",")??"";return`Field name by pattern: ${y} or names: ${v}`}},c=h=>{if(h)try{return(0,n.jO)(h)}catch(y){console.error(y);return}},p={id:s.E4.byName,name:"Frame Name",description:"match the frame name",defaultOptions:"/.*/",get:h=>{const y=(0,n.jO)(h);return v=>y.test(v.name||"")},getOptionsDisplayText:h=>`Frame name: ${h}`};function f(){return[g,u,d,m,o]}function E(){return[p]}},69759:(j,I,e)=>{"use strict";e.d(I,{Qw:()=>p,Ty:()=>D,fX:()=>a,m3:()=>o});var t=e(29241),n=e(76178),i=e(19221);const s={id:i.Ff.anyMatch,name:"Any",description:"Any child matches (OR)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const P=C.map(b=>(0,n.sq)(b));return(b,M,T)=>{for(const S of P)if(S(b,M,T))return!0;return!1}},getOptionsDisplayText:C=>{let P="";for(const b of C){P.length>0&&(P+=" OR ");const M=n.Ls.get(b.id);P+=M.getOptionsDisplayText?M.getOptionsDisplayText(b):M.name}return P}},r={id:i.Ff.anyMatch,name:"Any",description:"Any child matches (OR)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const P=C.map(b=>(0,n.b9)(b));return b=>{for(const M of P)if(M(b))return!0;return!1}},getOptionsDisplayText:C=>{let P="";for(const b of C){P.length>0&&(P+=" OR ");const M=n.Ac.get(b.id);P+=M.getOptionsDisplayText?M.getOptionsDisplayText(b):M.name}return P}},g={id:i.Ff.allMatch,name:"All",description:"Everything matches (AND)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const P=C.map(b=>(0,n.sq)(b));return(b,M,T)=>{for(const S of P)if(!S(b,M,T))return!1;return!0}},getOptionsDisplayText:C=>{let P="";for(const b of C){P.length>0&&(P+=" AND ");const M=n.Ls.get(b.id);P+=M.getOptionsDisplayText?M.getOptionsDisplayText(b):M.name}return P}},d={id:i.Ff.allMatch,name:"All",description:"Everything matches (AND)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const P=C.map(b=>(0,n.b9)(b));return b=>{for(const M of P)if(!M(b))return!1;return!0}},getOptionsDisplayText:C=>{let P="";for(const b of C){P.length>0&&(P+=" AND ");const M=n.Ac.get(b.id);P+=M.getOptionsDisplayText?M.getOptionsDisplayText(b):M.name}return P}},l={id:i.Ff.invertMatch,name:"NOT",description:"Inverts other matchers",excludeFromPicker:!0,get:C=>{const P=(0,n.sq)(C);return(b,M,T)=>!P(b,M,T)},getOptionsDisplayText:C=>{const P=n.Ls.get(C.id);return"NOT "+(P.getOptionsDisplayText?P.getOptionsDisplayText(C.options):P.name)}},u={id:i.Ff.invertMatch,name:"NOT",description:"Inverts other matchers",excludeFromPicker:!0,get:C=>{const P=(0,n.b9)(C);return b=>!P(b)},getOptionsDisplayText:C=>{const P=n.Ac.get(C.id);return"NOT "+(P.getOptionsDisplayText?P.getOptionsDisplayText(C.options):P.name)}},o=C=>!0,m=C=>!0,c=C=>!1,p=C=>C.type!==t.fS.time,f=C=>!1,E={id:i.Ff.alwaysMatch,name:"All Fields",description:"Always Match",get:C=>o,getOptionsDisplayText:C=>"Always"},h={id:i.Ff.alwaysMatch,name:"All Frames",description:"Always Match",get:C=>m,getOptionsDisplayText:C=>"Always"},y={id:i.Ff.neverMatch,name:"No Fields",description:"Never Match",excludeFromPicker:!0,get:C=>c,getOptionsDisplayText:C=>"Never"},v={id:i.Ff.neverMatch,name:"No Frames",description:"Never Match",get:C=>f,getOptionsDisplayText:C=>"Never"};function D(){return[s,g,l,E,y]}function a(){return[r,d,u,h,v]}},52273:(j,I,e)=>{"use strict";e.d(I,{Z:()=>i,w:()=>n});var t=e(25359),n=(s=>(s.Combine="combine",s.CalculateNewFields="calculateNewFields",s.CreateNewVisualization="createNewVisualization",s.Filter="filter",s.PerformSpatialOperations="performSpatialOperations",s.Reformat="reformat",s.ReorderAndRename="reorderAndRename",s))(n||{});const i=new t.B},83667:(j,I,e)=>{"use strict";e.d(I,{H:()=>u});var t=e(45383),n=e(22479),i=e(39343),s=e(76178),r=e(52273);const g=(m,c)=>p=>{const f=r.Z.get(m.id);if(!f)return p;const h={...f.transformation.defaultOptions??{},...m.options},y=m.filter?.options?(0,s.b9)(m.filter):void 0;return p.pipe((0,n.z)(v=>(0,t.of)(d(v,y)).pipe(f.transformation.operator(h,c),l(v,f,y))))};function d(m,c){return c?m.filter(p=>c(p)):m}const l=(m,c,p)=>f=>f.pipe((0,i.U)(E=>{if(E===m)return E;for(const h of E)h.meta||(h.meta={}),h.meta.transformations?h.meta.transformations=[...h.meta.transformations,c.id]:h.meta.transformations=[c.id];if(p){let h=0;const y=m.filter((v,D)=>{const a=!p(v);return a&&!h&&(h=D),a});y.length&&E.splice(h,0,...y)}return E}));function u(m,c,p){const f=(0,t.of)(c);if(!m.length)return f;const E=[],h=p??{interpolate:y=>y};for(let y=0;y<m.length;y++){const v=m[y];if(o(v))E.push(v(h));else{if(v.disabled)continue;E.push(g(v,h))}}return f.pipe.apply(f,E)}function o(m){return typeof m=="function"}},44885:(j,I,e)=>{"use strict";e.d(I,{Y:()=>We});var t=e(18441),n=e(2791),i=e(95381),s=e(64454),r=e(82039),g=e(95312),d=e(19221),l=e(14544);const u={id:l.W.filterByRefId,name:"Filter data by query refId",description:"select a subset of results",defaultOptions:{},operator:(ke,et)=>we=>{const _e={};return ke.include&&(_e.include={id:d.E4.byRefId,options:ke.include}),ke.exclude&&(_e.exclude={id:d.E4.byRefId,options:ke.exclude}),we.pipe(r.u.operator(_e,et))}};var o=e(20371),m=e(24588),c=e.n(m),p=e(39343),f=e(31317),E=e(80369),h=e(29241);const y={id:l.W.formatTime,name:"Format Time",description:"Set the output format of a time field",defaultOptions:{timeField:"",outputFormat:"",useTimezone:!0},operator:ke=>et=>et.pipe((0,p.U)(we=>{const _e=v(ke.timeField,ke.outputFormat,ke.useTimezone);return!Array.isArray(we)||we.length===0?we:we.map(Ge=>({...Ge,fields:_e(Ge.fields)}))}))},v=(ke,et,we)=>_e=>{const Ge=(0,f.Z)();return _e.map(qe=>{if(qe.name===ke){const st=qe.values.map(Me=>{const be=c()(Me);if(we){const Ke=(0,E.Pr)(Ge,Me),Ye=Ke!==void 0?Ke.ianaName:"UTC";return be.tz(Ye).format(et)}else return be.format(et)});return{...qe,type:h.fS.string,values:st}}return qe})};var D=e(11770),a=e(75578),C=e(49721),P=e(76178);const b="Time",M="Time",T="Value",S=C.U.Empty,x=window?.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback,O={id:l.W.groupingToMatrix,name:"Grouping to Matrix",description:"Groups series by field and return a matrix visualisation",defaultOptions:{columnField:b,rowField:M,valueField:T},operator:ke=>et=>et.pipe((0,p.U)(we=>{const _e=ke.columnField||b,Ge=ke.rowField||M,qe=ke.valueField||T,st=ke.emptyValue||S;if(we.length!==1)return we;const Me=we[0],be=A(Me,_e),Ke=A(Me,Ge),Ye=A(Me,qe),tt=`${Ge}\\${_e}`;if(!be||!Ke||!Ye)return we;const nt=B(be.values),Pt=B(Ke.values),xt={};for(let Rt=0;Rt<Ye.values.length;Rt++){const ct=be.values[Rt],it=Ke.values[Rt],me=Ye.values[Rt];xt[ct]||(xt[ct]={}),xt[ct][it]=me}const bt=[{name:tt,values:Pt,type:h.fS.string,config:{}}];for(const Rt of nt){let ct=[];for(const it of Pt){const me=xt[Rt][it]??V(st);ct.push(me)}x&&typeof Rt=="number"&&(Ye.config={...Ye.config,displayNameFromDS:void 0}),bt.push({name:Rt.toString(),values:ct,config:Ye.config,type:Ye.type})}return[{fields:bt,length:Pt.length}]}))};function B(ke){const et=new Set;for(let we=0;we<ke.length;we++)et.add(ke[we]);return Array.from(et)}function A(ke,et){for(let we=0;we<ke.fields.length;we++){const _e=ke.fields[we];let Ge;if(x?Ge=P.Ls.get(d.mi.byName).get(et)(_e,ke,[ke]):Ge=et===(0,a.CZ)(_e),Ge)return _e}return null}function V(ke){switch(ke){case C.U.False:return!1;case C.U.True:return!0;case C.U.Null:return null;case C.U.Empty:default:return""}}var W=e(35596),w=e(69811),N=e(23830);const F=10,k={id:l.W.limit,name:"Limit",description:"Limit the number of items to the top N",defaultOptions:{limitField:F},operator:ke=>et=>et.pipe((0,p.U)(we=>{const _e=ke.limitField||F;return we.map(Ge=>Ge.length>_e?{...Ge,fields:Ge.fields.map(qe=>({...qe,values:qe.values.slice(0,_e)})),length:_e}:Ge)}))};var H=e(99581),R=e(31323),_=e(6788);const G={id:l.W.rename,name:"Rename fields by name",description:"Rename fields based on configuration given by user",defaultOptions:{renameByName:{}},operator:ke=>et=>et.pipe((0,p.U)(we=>{const _e=Y(ke.renameByName);return!Array.isArray(we)||we.length===0?we:we.map(Ge=>({...Ge,fields:_e(Ge)}))}))},Y=ke=>et=>!ke||Object.keys(ke).length===0?et.fields:et.fields.map(we=>{const _e=(0,a.CZ)(we,et),Ge=ke[_e];return typeof Ge!="string"||Ge.length===0?we:{...we,config:{...we.config,displayName:Ge},state:{...we.state,displayName:Ge}}}),X={id:l.W.organize,name:"Organize fields by name",description:"Order, filter and rename fields based on configuration given by user",defaultOptions:{excludeByName:{},indexByName:{},renameByName:{}},operator:(ke,et)=>we=>we.pipe(g.w.operator({exclude:{names:Q(ke.excludeByName)}},et),_.t.operator(ke,et),G.operator(ke,et))},Q=ke=>ke?Object.keys(ke).filter(et=>ke[et]):[];var se=e(85722),Z=e(95676);const le={id:l.W.renameByRegex,name:"Rename fields by regex",description:"Rename fields based on regular expression by users.",defaultOptions:{regex:"(.*)",renamePattern:"$1"},operator:ke=>et=>et.pipe((0,p.U)(we=>!Array.isArray(we)||we.length===0?we:we.map(oe(ke))))},oe=ke=>et=>{const we=(0,Z.jO)(ke.regex),_e=et.fields.map(Ge=>{const qe=(0,a.CZ)(Ge,et);if(!we.test(qe))return Ge;const st=qe.replace(we,ke.renamePattern);return{...Ge,config:{...Ge.config,displayName:st},state:{...Ge.state,displayName:st}}});return{...et,fields:_e}};var q=e(89949),ne=e(72164),ge=e(32053),ae=e(59425);const re={id:l.W.seriesToRows,name:"Series to rows",description:"Combines multiple series into a single serie and appends a column with metric name per value.",defaultOptions:{},operator:ke=>et=>et.pipe((0,p.U)(we=>{if(!Array.isArray(we)||we.length<=1||(we=we.filter(Me=>Me.length>0),!(0,ae.xI)(we)))return we;const _e={},Ge=new Set,qe=new ne.v,st={name:h.rN,values:[],config:{},type:h.fS.string};for(let Me=0;Me<we.length;Me++){const be=we[Me];for(let Ke=0;Ke<be.fields.length;Ke++){const Ye=be.fields[Ke];if(Ye.type===h.fS.time){_e[Me]=Ke,Ge.has(h.Ls)||(qe.addField(De(Ye,h.Ls)),qe.addField(st),Ge.add(h.Ls));continue}Ge.has(h.M5)||(qe.addField(De(Ye,h.M5)),Ge.add(h.M5))}}for(let Me=0;Me<we.length;Me++){const be=we[Me];for(let Ke=0;Ke<be.length;Ke++){const Ye=_e[Me],tt=Ye===0?1:0;qe.add({[h.Ls]:be.fields[Ye].values[Ke],[h.rN]:(0,a.nf)(be),[h.M5]:be.fields[tt].values[Ke]})}}return[(0,ge.aK)(qe,0,!0)]}))},De=(ke,et)=>({...(0,q.omit)(ke,["values","state","labels","config","name"]),name:et,values:[],config:{...(0,q.omit)(ke.config,["displayName","displayNameFromDS"])}}),he={id:l.W.sortBy,name:"Sort by",description:"Sort fields in a frame.",defaultOptions:{fields:{}},operator:ke=>et=>et.pipe((0,p.U)(we=>!Array.isArray(we)||we.length===0||!ke?.sort?.length?we:ye(we,ke.sort)))};function ye(ke,et){return ke.map(we=>{const _e=ce(we,et);return _e.length&&_e[0].index!=null?(0,ge.aK)(we,_e[0].index,_e[0].desc):we})}function ce(ke,et){return et.map(we=>we.index!=null?we:{...we,index:ke.fields.findIndex(_e=>we.field===(0,a.CZ)(_e,ke))})}const We={noopTransformer:R.d,filterFieldsTransformer:r.P,filterFieldsByNameTransformer:g.w,filterFramesTransformer:r.u,filterFramesByRefIdTransformer:u,filterByValueTransformer:o.JA,formatTimeTransformer:y,orderFieldsTransformer:_.t,organizeFieldsTransformer:X,reduceTransformer:se.mf,concatenateTransformer:n.aE,calculateFieldTransformer:t.U,joinByFieldTransformer:w.M,seriesToColumnsTransformer:w.M,seriesToRowsTransformer:re,renameFieldsTransformer:G,labelsToFieldsTransformer:N.r,ensureColumnsTransformer:s.W,groupByTransformer:D.i,sortByTransformer:he,mergeTransformer:H.R,renameByRegexTransformer:le,histogramTransformer:W.Op,convertFieldTypeTransformer:i.mg,groupingToMatrixTransformer:O,limitTransformer:k}},18441:(j,I,e)=>{"use strict";e.d(I,{U:()=>v,h:()=>P,ie:()=>E});var t=e(89949),n=e.n(t),i=e(39343),s=e(32053),r=e(75578),g=e(29241),d=e(53933),l=e(32338),u=e(66656),o=e(76178),m=e(19221),c=e(64454),p=e(14544),f=e(31323),E=(b=>(b.ReduceRow="reduceRow",b.BinaryOperation="binary",b.Index="index",b))(E||{});const h={reducer:u.gz.sum},y={left:"",operator:l.L.Add,right:""},v={id:p.W.calculateField,name:"Add field from calculation",description:"Use the row values to calculate a new field",defaultOptions:{mode:"reduceRow",reduce:{reducer:u.gz.sum}},operator:(b,M)=>T=>{const S=b&&b.timeSeries!==!1?c.W.operator(null,M):f.d.operator({},M);return b.alias!=null&&(b.alias=M.interpolate(b.alias)),T.pipe(S,(0,i.U)(x=>{const O=b.mode??"reduceRow";let B;if(O==="reduceRow")B=D((0,t.defaults)(b.reduce,h),x);else if(O==="binary"){const A={...b.binary,left:M.interpolate(b.binary?.left),right:M.interpolate(b.binary?.right)};B=C((0,t.defaults)(A,y),x)}else if(O==="index")return x.map(A=>{const V={name:b.alias??"Row",type:g.fS.number,values:[...Array(A.length).keys()],config:{}};return{...A,fields:b.replaceFields?[V]:[...A.fields,V]}});return B?x.map(A=>{const V=B(A);if(!V)return A;const W={name:P(b),type:g.fS.number,config:{},values:V};let w=[];if(b.replaceFields){const{timeField:N}=(0,s.sV)(A);N&&b.timeSeries!==!1?w=[N,W]:w=[W]}else w=[...A.fields,W];return{...A,fields:w}}):x}))}};function D(b,M){let T=(0,o.sq)({id:m.mi.numeric});b.include&&b.include.length&&(T=(0,o.sq)({id:m.mi.byNames,options:{names:b.include}}));const S=u.TB.get(b.reducer);if(!S)throw new Error(`Unknown reducer: ${b.reducer}`);const x=S.reduce??u.uP,O=b.nullValueMode===d.Gl.Ignore,B=b.nullValueMode===d.Gl.AsZero;return A=>{const V=[];for(const F of A.fields)T(F,A,M)&&V.push(F.values);const W=V.length,w={name:"temp",values:new Array(W),type:g.fS.number,config:{}},N=[];for(let F=0;F<A.length;F++){for(let k=0;k<W;k++)w.values[k]=V[k][F];N.push(x(w,O,B)[b.reducer])}return N}}function a(b,M,T){if(!M)return;for(const x of b.fields)if(M===(0,r.CZ)(x,b,T))return x.type===g.fS.boolean?x.values.map(O=>O?1:0):x.values;const S=parseFloat(M);if(!isNaN(S))return new Array(b.length).fill(S)}function C(b,M){const T=l.n.getIfExists(b.operator);return S=>{const x=a(S,b.left,M),O=a(S,b.right,M);if(!x||!O||!T)return;const B=new Array(x.length);for(let A=0;A<B.length;A++)B[A]=T.operation(x[A],O[A]);return B}}function P(b){if(b.alias?.length)return b.alias;switch(b.mode){case"binary":{const{binary:M}=b;return`${M?.left??""} ${M?.operator??""} ${M?.right??""}`}case"reduceRow":{const M=u.TB.getIfExists(b.reduce?.reducer);if(M)return M.name}break;case"index":return"Row"}return"math"}},2791:(j,I,e)=>{"use strict";e.d(I,{HO:()=>s,aE:()=>r});var t=e(39343),n=e(29241),i=e(14544),s=(d=>(d.Drop="drop",d.FieldName="field",d.Label="label",d))(s||{});const r={id:i.W.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:d=>l=>l.pipe((0,t.U)(u=>!Array.isArray(u)||u.length<2?u:[g(u,d)]))};function g(d,l){let u=!0,o=d[0].length;const m=l.frameNameLabel??"frame";let c=[];for(const p of d){o!==p.length&&(u=!1,o=Math.max(o,p.length));for(const f of p.fields){const E={...f};E.state=void 0,p.name&&(l.frameNameMode==="drop"||(l.frameNameMode==="label"?(E.labels={...f.labels},E.labels[m]=p.name):!E.name||E.name===n.M5?E.name=p.name:E.name=`${p.name} \xB7 ${f.name}`)),c.push(E)}}return u||(c=c.map(p=>{if(p.values.length===o)return p;const f=p.values;return f.length=o,{...p,values:f}})),{fields:c,length:o}}},95381:(j,I,e)=>{"use strict";e.d(I,{J_:()=>h,mg:()=>d,p8:()=>u});var t=e(39343),n=e(58018),i=e(29241),s=e(76178),r=e(19221),g=e(14544);const d={id:g.W.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}]},operator:(v,D)=>a=>a.pipe((0,t.U)(C=>d.transformer(v,D)(C))),transformer:v=>D=>!Array.isArray(D)||D.length===0?D:l(v,D)??[]};function l(v,D){if(!v.conversions.length)return D;const a=D.map(C=>({...C}));for(const C of v.conversions){if(!C.targetField)continue;const P=s.Ls.get(r.mi.byName).get(C.targetField);for(const b of a)b.fields=b.fields.map(M=>P(M,b,a)?u(M,C):M)}return a}function u(v,D){switch(D.destinationType){case i.fS.time:return h(v,D.dateFormat);case i.fS.number:return c(v);case i.fS.string:return f(v,D.dateFormat);case i.fS.boolean:return p(v);case i.fS.enum:return y(v,D.enumConfig);case i.fS.other:return E(v);default:return v}}const o=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3,})?(?:Z|[-+]\d{2}:?\d{2})$/;function m(v,D){let a=D?{format:D}:void 0;const C=v.values.slice();let P=C.find(M=>M!=null),b=typeof P=="string"&&o.test(P);for(let M=0;M<C.length;M++)if(C[M]){let T=b?Date.parse(C[M]):(0,n.J)(C[M],a).valueOf();C[M]=Number.isFinite(T)?T:null}else C[M]=null;return{...v,type:i.fS.time,values:C}}function c(v){const D=v.values.slice(),a=D.some(C=>typeof C=="string");for(let C=0;C<D.length;C++){let P=D[C];a&&P!=null&&typeof P=="string"&&(P=P.replace(/,/g,""));const b=+P;D[C]=Number.isFinite(b)?b:null}return{...v,type:i.fS.number,values:D}}function p(v){const D=v.values.slice();for(let a=0;a<D.length;a++)D[a]=!!D[a];return{...v,type:i.fS.boolean,values:D}}function f(v,D){let a=v.values;switch(v.type){case i.fS.time:a=a.map(C=>(0,n.J)(C).format(D));break;case i.fS.other:a=a.map(C=>JSON.stringify(C));break;default:a=a.map(C=>`${C}`)}return{...v,type:i.fS.string,values:a}}function E(v){const D=v.values.slice();for(let a=0;a<D.length;a++)try{D[a]=JSON.parse(D[a])}catch{D[a]=null}return{...v,type:i.fS.other,values:D}}function h(v,D){const a=typeof v.values[0]=="number";return v.type===i.fS.time&&a?v:a?{...v,type:i.fS.time}:m(v,D)}function y(v,D){const a={...D},C=v.values.slice(),P=new Map;if(a.text)for(let b=0;b<a.text.length;b++)P.set(a.text[b],b);else a.text=[];for(let b=0;b<C.length;b++){const M=C[b];P.has(M)||(a.text[P.size]=M,P.set(M,P.size)),C[b]=P.get(M)}return{...v,config:{...v.config,type:{enum:a}},type:i.fS.enum,values:C}}},64454:(j,I,e)=>{"use strict";e.d(I,{W:()=>r});var t=e(39343),n=e(32053),i=e(14544),s=e(69811);const r={id:i.W.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:(d,l)=>u=>u.pipe((0,t.U)(o=>r.transformer(d,l)(o))),transformer:(d,l)=>u=>{const o=g(u);return u.length>1&&o?s.M.transformer({byField:o},l)(u):u}};function g(d){let l;for(const u of d){const{timeField:o}=(0,n.sV)(u);if(!o)return;if(!l)l=o.name;else if(l!==o.name)return}return l}},82039:(j,I,e)=>{"use strict";e.d(I,{P:()=>r,u:()=>g});var t=e(39343),n=e(76178),i=e(14544),s=e(31323);const r={id:i.W.filterFields,name:"Filter Fields",description:"select a subset of fields",defaultOptions:{},operator:(d,l)=>u=>!d.include&&!d.exclude?u.pipe(s.d.operator({},l)):(typeof d.include?.options=="string"?d.include.options=l.interpolate(d.include?.options):typeof d.include?.options?.pattern=="string"&&(d.include.options.pattern=l.interpolate(d.include?.options.pattern)),typeof d.exclude?.options=="string"?d.exclude.options=l.interpolate(d.exclude?.options):typeof d.exclude?.options?.pattern=="string"&&(d.exclude.options.pattern=l.interpolate(d.exclude?.options.pattern)),u.pipe((0,t.U)(o=>{const m=d.include?(0,n.sq)(d.include):null,c=d.exclude?(0,n.sq)(d.exclude):null,p=[];for(const f of o){const E=[];for(let y=0;y<f.fields.length;y++){const v=f.fields[y];if(c){if(c(v,f,o))continue;m||E.push(v)}m&&m(v,f,o)&&E.push(v)}if(!E.length)continue;const h={...f,fields:E};p.push(h)}return p})))},g={id:i.W.filterFrames,name:"Filter Frames",description:"select a subset of frames",defaultOptions:{},operator:(d,l)=>u=>!d.include&&!d.exclude?u.pipe(s.d.operator({},l)):u.pipe((0,t.U)(o=>{const m=d.include?(0,n.b9)(d.include):null,c=d.exclude?(0,n.b9)(d.exclude):null,p=[];for(const f of o){if(c){if(c(f))continue;m||p.push(f)}m&&m(f)&&p.push(f)}return p}))}},95312:(j,I,e)=>{"use strict";e.d(I,{f:()=>r,w:()=>s});var t=e(19221),n=e(82039),i=e(14544);const s={id:i.W.filterFieldsByName,name:"Filter fields by name",description:"select a subset of fields",defaultOptions:{},operator:(g,d)=>l=>l.pipe(n.P.operator({include:r(g.include),exclude:r(g.exclude)},d))},r=g=>{if(!g)return;const{names:d,pattern:l}=g;if(!((!Array.isArray(d)||d.length===0)&&!l))return l?!Array.isArray(d)||d.length===0?{id:t.mi.byRegexp,options:l}:{id:t.mi.byRegexpOrNames,options:g}:{id:t.mi.byNames,options:{names:d}}}},20371:(j,I,e)=>{"use strict";e.d(I,{ER:()=>d,JA:()=>l,PQ:()=>g});var t=e(39343),n=e(75578),i=e(76178),s=e(14544),r=e(31323),g=(m=>(m.exclude="exclude",m.include="include",m))(g||{}),d=(m=>(m.all="all",m.any="any",m))(d||{});const l={id:s.W.filterByValue,name:"Filter data by values",description:"select a subset of results based on values",defaultOptions:{filters:[],type:"include",match:"any"},operator:(m,c)=>p=>{const f=m.filters,E=m.match==="all",h=m.type==="include";return!Array.isArray(f)||f.length===0?p.pipe(r.d.operator({},c)):p.pipe((0,t.U)(y=>{if(!Array.isArray(y)||y.length===0)return y;const v=new Set;for(const C of y){const P=o(C,y),b=u(f,P);for(let M=0;M<C.length;M++){if(v.has(M))continue;let T=!0;for(const S of b){const x=S(M,C,y);if(!E&&x){T=!0;break}if(E&&!x){T=!1;break}T=x}T&&v.add(M)}}const D=[],a=h?v.size:y[0].length-v.size;for(const C of y){const P=[];for(const b of C.fields){const M=[];for(let T=0;T<C.length;T++){if(h&&v.has(T)){M.push(b.values[T]);continue}if(!h&&!v.has(T)){M.push(b.values[T]);continue}}P.push({...b,values:M,state:{}})}D.push({...C,fields:P,length:a})}return D}))}},u=(m,c)=>{const p=()=>!1;return m.map(f=>{const E=c[f.fieldName]??-1;if(E<0)return console.warn(`[FilterByValue] Could not find index for field name: ${f.fieldName}`),p;const h=(0,i.IG)(f.config);return(y,v,D)=>h(y,v.fields[E],v,D)})},o=(m,c)=>m.fields.reduce((p,f,E)=>{const h=(0,n.CZ)(f,m,c);return p[h]=E,p},{})},11770:(j,I,e)=>{"use strict";e.d(I,{i:()=>l,x:()=>d});var t=e(39343),n=e(32053),i=e(75578),s=e(29241),r=e(66656),g=e(14544),d=(c=>(c.aggregate="aggregate",c.groupBy="groupby",c))(d||{});const l={id:g.W.groupBy,name:"Group by",description:"Group the data by a field values then process calculations for each group.",defaultOptions:{fields:{}},operator:c=>p=>p.pipe((0,t.U)(f=>{if(!Object.keys(c.fields).find(y=>c.fields[y].operation==="groupby"))return f;const h=[];for(const y of f){const v=[];for(const C of y.fields)u(C,c)&&v.push(C);if(v.length===0)continue;const D=new Map;for(let C=0;C<y.length;C++){const P=String(v.map(M=>M.values[C])),b=D.get(P)??{};D.has(P)||D.set(P,b);for(let M of y.fields){const T=(0,i.CZ)(M);b[T]||(b[T]={name:T,type:M.type,config:{...M.config},values:[]}),b[T].values.push(M.values[C])}}const a=[];for(const C of v){const P=[],b=(0,i.CZ)(C);D.forEach(M=>{P.push(M[b].values[0])}),a.push({name:C.name,type:C.type,config:{...C.config},values:P})}for(const C of y.fields){if(!o(C,c))continue;const P=(0,i.CZ)(C),b=c.fields[P].aggregations,M={};D.forEach(T=>{const S=T[P],x=(0,r.Kx)({field:S,reducers:b});for(const O of b)Array.isArray(M[O])||(M[O]=[]),M[O].push(x[O])});for(const T of b){const S={name:`${P} (${T})`,values:M[T],type:s.fS.other,config:{}};S.type=m(T,C,S),a.push(S)}}h.push({fields:a,length:D.size})}return h}))},u=(c,p)=>{const f=(0,i.CZ)(c);return p?.fields[f]?.operation==="groupby"},o=(c,p)=>{const f=(0,i.CZ)(c);return p?.fields[f]?.operation==="aggregate"&&Array.isArray(p?.fields[f].aggregations)&&p?.fields[f].aggregations.length>0},m=(c,p,f)=>{switch(c){case r.gz.allIsNull:return s.fS.boolean;case r.gz.last:case r.gz.lastNotNull:case r.gz.first:case r.gz.firstNotNull:return p.type;default:return(0,n.fu)(f)??s.fS.string}}},35596:(j,I,e)=>{"use strict";e.d(I,{Jz:()=>C,Ok:()=>E,Op:()=>p,UO:()=>P,Zi:()=>u,cO:()=>h,gY:()=>a,kl:()=>y,mB:()=>b,py:()=>c,qr:()=>v,wL:()=>f,zM:()=>T});var t=e(39343),n=e(61965),i=e(45540),s=e(43987),r=e(29241),g=e(27107),d=e(14544),l=e(48962);const u=[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],o=[null],m=(S,x)=>S-x,c={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:d.W.histogram,name:"Histogram",description:"Calculate a histogram from input data.",defaultOptions:{fields:{}},operator:(S,x)=>O=>O.pipe((0,t.U)(B=>p.transformer(S,x)(B))),transformer:S=>x=>{if(!Array.isArray(x)||x.length===0)return x;const O=a(x,S);return O==null?[]:[T(O)]}},f="xMin";function E(S){return S===f||S==="BucketMin"}const h="xMax";function y(S){return S===h||S==="BucketMax"}function v(S){let x,O;const B=[];for(const A of S.fields)E(A.name)?x=A:y(A.name)?O=A:A.type===r.fS.number&&B.push(A);if(!O&&x&&x.values.length>1){let A=x.values,V=(0,g.O)(A[1]-A[0],6);O={...x,name:h,values:A.map(W=>W+V)}}if(!x&&O&&O?.values.length>1){let A=O.values,V=(0,g.O)(A[1]-A[0],6);x={...O,name:f,values:A.map(W=>W-V)}}if(x&&O&&B.length)return{xMin:x,xMax:O,counts:B}}const D=20;function a(S,x){let O=x?.bucketSize,B=x?.bucketOffset??0;if(!O||O<0){let R=[];for(const se of S)for(const Z of se.fields)Z.type===r.fS.number&&(R=R.concat(Z.values));R=R.filter(se=>se!=null),R.sort((se,Z)=>se-Z);let _=1/0;if(R.length===1)_=1;else for(let se=1;se<R.length;se++){let Z=R[se]-R[se-1];Z!==0&&(_=Math.min(_,Z))}let G=R[0];const Q=(R[R.length-1]-G)/D;for(let se=0;se<u.length;se++){let Z=u[se];if(Q<Z&&Z>=_){O=Z;break}}}const A=R=>b(R-B,O)+B;let V=((""+O).match(/\.\d+$/)??["."])[0].length-1,W=[],w=[],N;for(const R of S)for(const _ of R.fields)if(_.type===r.fS.number){let G=M(_.values,A,o,m);W.push(G),w.push({..._,config:{..._.config,unit:_.config.unit==="short"?"short":void 0}}),!N&&_.config.unit&&(N=_.config)}if(!w.length)return null;let F=(0,l.v_)(W);for(let R=1;R<F.length;R++){let _=F[R];for(let G=0;G<_.length;G++)_[G]==null&&(_[G]=0)}const k={name:f,values:F[0],type:r.fS.number,state:void 0,config:V===0?N??{}:{...N,decimals:V}},H={...k,name:h,values:F[0].map(R=>R+O)};if(x?.combine){const R=new Array(F[0].length).fill(0);for(let _=1;_<F.length;_++)for(let G=0;G<R.length;G++)R[G]+=F[_][G];w=[{...w[0],name:"count",values:R,type:r.fS.number,state:void 0}]}else w.forEach((R,_)=>{R.values=F[_+1]});return{xMin:k,xMax:H,counts:w}}function C(S,x){return Math.round(S/x)*x}function P(S,x){return Math.ceil(S/x)*x}function b(S,x){return Math.floor(S/x)*x}function M(S,x,O,B){let A=new Map;for(let N=0;N<S.length;N++){let F=S[N];F!=null&&(F=x(F));let k=A.get(F);k?k.count++:A.set(F,{value:F,count:1})}O&&O.forEach(N=>A.delete(N));let V=[...A.values()];B&&V.sort((N,F)=>B(N.value,F.value));let W=Array(V.length),w=Array(V.length);for(let N=0;N<V.length;N++)W[N]=V[N].value,w[N]=V[N].count;return[W,w]}function T(S,x){if(!S.xMin.display){const O=(0,n.U)({field:S.xMin,theme:x??(0,i.j)()});S.xMin.display=O,S.xMax.display=O}return S.counts[0].display=(0,n.U)({field:S.counts[0],theme:x??(0,i.j)()}),{length:S.xMin.values.length,meta:{type:s.P.Histogram},fields:[S.xMin,S.xMax,...S.counts]}}},69811:(j,I,e)=>{"use strict";e.d(I,{M:()=>d,c:()=>g});var t=e(39343),n=e(76178),i=e(19221),s=e(14544),r=e(48962),g=(l=>(l.outer="outer",l.inner="inner",l.outerTabular="outerTabular",l))(g||{});const d={id:s.W.joinByField,aliasIds:[s.W.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,u)=>o=>o.pipe((0,t.U)(m=>d.transformer(l,u)(m))),transformer:l=>{let u;return o=>{if(o.length>1){l.byField&&!u&&(u=n.Ls.get(i.mi.byName).get(l.byField));const m=(0,r._9)({frames:o,joinBy:u,mode:l.mode});if(m)return[m]}return o}}}},48962:(j,I,e)=>{"use strict";e.d(I,{Y3:()=>u,_9:()=>o,lP:()=>y,v_:()=>h});var t=e(12008),n=e(32053),i=e(29241),s=e(76178),r=e(19221),g=e(69811);function d(v){const{timeField:D}=(0,n.sV)(v[0]);if(D)return s.Ls.get(r.mi.firstTimeField).get({});let a=[];for(const C of v[0].fields)C.type===i.fS.number&&a.push(C.name);for(let C=1;C<v.length;C++){const P=[];for(const b of v[0].fields)b.type===i.fS.number&&P.push(b.name);a=a.filter(b=>!P.includes(b))}return s.Ls.get(r.mi.byName).get(a[0])}function l(v){return v.joinBy??d(v.frames)}function u(v,D){if(D>=0){let a=v.fields[D];a.type!==i.fS.string&&!y(a.values)&&(v=(0,n.aK)(v,D))}return v}function o(v){if(!v.frames?.length)return;if(v.frames.length===1){let S=v.frames[0],x=S;const O=l(v);let B=x.fields.findIndex(A=>O(A,x,v.frames));if(v.keepOriginIndices&&(x={...S,fields:S.fields.map((A,V)=>{const W={...A},w={frameIndex:0,fieldIndex:V};return W.state?W.state.origin=w:W.state={origin:w},W})},B>0)){const A=x.fields[B],V=x.fields.filter((W,w)=>w!==B);V.unshift(A),x.fields=V,B=0}if(B>=0&&(x=u(x,B)),v.keep){let A=x.fields.filter((V,W)=>W===B||v.keep(V,x,v.frames));S!==x?x.fields=A:x={...S,fields:A}}return x}const D=[],a=[],C=[],P=[];let b=1;const M=l(v);for(let S=0;S<v.frames.length;S++){const x=v.frames[S];if(!x||!x.fields?.length)continue;const O=[c];let B,A=[],V=[];for(let w=0;w<x.fields.length;w++){const N=x.fields[w];if(N.state=N.state||{},!B&&M(N,x,v.frames))B=N;else{if(v.keep&&!v.keep(N,x,v.frames))continue;let F=N.config.custom?.spanNulls;O.push(F===!0?c:F===-1?p:f);let k=N.labels??{},H=N.name;x.name&&(N.name===i.M5?H=x.name:k={...k,name:x.name}),A.push({...N,name:H,labels:k})}v.keepOriginIndices&&(N.state.origin={frameIndex:S,fieldIndex:w})}if(!B)continue;C.length===0&&C.push(B),D.push(O);const W=[B.values];for(const w of A)W.push(w.values),C.push(w),delete w.state?.displayName,V.push(b),b++;P.push(V),a.push(W)}let T=[];return v.mode===g.c.outerTabular?T=m(a,P,C.length,D):T=h(a,D,v.mode),{length:T[0].length,fields:C.map((S,x)=>({...S,values:T[x]}))}}function m(v,D,a,C){let P={};for(let M=0;M<v.length;M++){let T=v[M],S=T[0];for(let x=0;x<v.length;x++){if(x===M)continue;let O=v[x],B=O[0];for(let A=0;A<S.length;A++){const V=S[A],W=a-1;let w=[V].concat(new Array(W)),N=0;for(let F=1;F<T.length;F++){const k=D[M][N];w[k]=T[F][A],N++}for(let F=0;F<B.length;F++)if(S[A]===B[F]){let k=0;for(let H=1;H<O.length;H++){const R=D[x][k];w[R]=O[H][F],k++}break}P[JSON.stringify(w)]=w}}}let b=[];for(let M=0;M<a;M++)b.push(new Array(0));for(let M in P){const T=P[M];for(let S=0;S<T.length;S++)b[S].push(T[S])}return b}const c=0,p=1,f=2;function E(v,D,a){for(let C=0,P,b=-1;C<D.length;C++){let M=D[C];if(M>b){for(P=M-1;P>=0&&v[P]==null;)v[P--]=null;for(P=M+1;P<a&&v[P]==null;)v[b=P++]=null}}}function h(v,D,a=g.c.outer){let C;if(a===g.c.inner)C=new Set((0,t.Z)(v.map(T=>T[0])));else{C=new Set;for(let T=0;T<v.length;T++){let x=v[T][0],O=x.length;for(let B=0;B<O;B++)C.add(x[B])}}let P=[Array.from(C).sort((T,S)=>T-S)],b=P[0].length,M=new Map;for(let T=0;T<b;T++)M.set(P[0][T],T);for(let T=0;T<v.length;T++){let S=v[T],x=S[0];for(let O=1;O<S.length;O++){let B=S[O],A=Array(b).fill(void 0),V=D?D[T][O]:p,W=[];for(let w=0;w<B.length;w++){let N=B[w],F=M.get(x[w]);N===null?V!==c&&(A[F]=N,V===f&&W.push(F)):A[F]=N}E(A,W,b),P.push(A)}}return P}function y(v,D=50){const a=v.length;if(a<=1)return!0;let C=0,P=a-1;for(;C<=P&&v[C]==null;)C++;for(;P>=C&&v[P]==null;)P--;if(P<=C)return!0;const b=Math.max(1,Math.floor((P-C+1)/D));for(let M=v[C],T=C+b;T<=P;T+=b){const S=v[T];if(S!=null){if(S<=M)return!1;M=S}}return!0}},23830:(j,I,e)=>{"use strict";e.d(I,{k:()=>r,r:()=>g});var t=e(39343),n=e(75578),i=e(29241),s=e(14544),r=(l=>(l.Columns="columns",l.Rows="rows",l))(r||{});const g={id:s.W.labelsToFields,name:"Labels to fields",description:"Extract time series labels to fields (columns or rows)",defaultOptions:{},operator:(l,u)=>o=>o.pipe((0,t.U)(m=>g.transformer(l,u)(m))),transformer:l=>u=>{if(l.mode==="rows")return d(u,l.keepLabels);const o=[],m=l.keepLabels?.length?new Set(l.keepLabels):void 0;for(const c of u){const p=[],f={};for(const E of c.fields){if(!E.labels){p.push(E);continue}const h={...E,config:{...E.config,displayName:void 0,displayNameFromDS:void 0},labels:void 0};p.push(h);for(const y of Object.keys(E.labels)){if(m&&!m.has(y))continue;if(l.valueLabel===y){h.name=E.labels[y];continue}(f[y]??(f[y]=new Set)).add(E.labels[y])}}for(const E in f)for(const h of f[E]){const y=new Array(c.length).fill(h);p.push({name:E,type:i.fS.string,values:y,config:{}})}o.push({...c,fields:p,length:c.length})}return o}};function d(l,u){const o=[];for(const m of l)for(const c of m.fields)if(c.labels){const p=[],f=[];if(u)for(const E of u)p.push(E),f.push(c.labels[E]);else for(const[E,h]of Object.entries(c.labels))p.push(E),f.push(h);f.length&&o.push({...m,name:(0,n.CZ)(c,m,l),fields:[{name:"label",type:i.fS.string,config:{},values:p},{name:"value",type:i.fS.string,config:{},values:f}],length:f.length})}return o}},99581:(j,I,e)=>{"use strict";e.d(I,{R:()=>g});var t=e(89949),n=e.n(t),i=e(39343),s=e(72164),r=e(14544);const g={id:r.W.merge,name:"Merge series/tables",description:"Merges multiple series/tables into a single serie/table",defaultOptions:{},operator:p=>f=>f.pipe((0,i.U)(E=>{if(!Array.isArray(E)||E.length<=1)return E;const h=E.filter(T=>T.fields.length>0);if(h.length===0)return[E[0]];const y=new Set,v={},D=[],a=new s.v;for(let T=0;T<h.length;T++){const S=h[T];for(let x=0;x<S.fields.length;x++){const O=S.fields[x];y.has(O.name)||(a.addField(d(O)),y.add(O.name)),v[O.name]=v[O.name]||{},v[O.name][T]=x,h.length-1===T&&m(v,O,h)&&D.push(O.name)}}if(D.length===0)return E;const C={},P=[],b=l(h,v,D),M=u(h,y,v);for(let T=0;T<h.length;T++){const S=h[T];for(let x=0;x<S.length;x++){const O=b(T,x),B=M(T,x);if(!Array.isArray(C[O])){C[O]=[B],P.push(c(O,C));continue}let A=!1;C[O]=C[O].map(V=>o(V,B)?(A=!0,{...V,...B}):V),A||(C[O].push(B),P.push(c(O,C)))}}for(const T of P){const S=C[T.key][T.index];S&&a.add(S)}return[a]}))},d=p=>({...(0,t.omit)(p,["values","state","labels","config"]),values:[],config:{...(0,t.omit)(p.config,"displayName")}}),l=(p,f,E)=>{const h=E.reduce((y,v)=>Object.keys(f[v]).reduce((D,a)=>(D[a]=D[a]||[],D[a].push(f[v][a]),D),y),{});return(y,v)=>h[y].reduce((D,a)=>D+p[y].fields[a].values[v],"")},u=(p,f,E)=>(h,y)=>{const v={},D=Array.from(f);for(const a of D){const C=E[a];if(!C)continue;const P=C[h];if(typeof P!="number")continue;const b=p[h];if(!b||!b.fields)continue;const M=b.fields[P];!M||!M.values||(v[a]=M.values[y])}return v},o=(p,f)=>{let E=!0;for(const h in f)if(!(typeof p[h]>"u")&&p[h]!==null&&p[h]!==f[h]){E=!1;break}return E},m=(p,f,E)=>Object.keys(p[f.name]).length===E.length,c=(p,f)=>({key:p,index:f[p].length-1})},31323:(j,I,e)=>{"use strict";e.d(I,{d:()=>n});var t=e(14544);const n={id:t.W.noop,name:"noop",description:"No-operation transformer",defaultOptions:{},operator:i=>s=>s,transformer:i=>s=>s}},6788:(j,I,e)=>{"use strict";e.d(I,{$:()=>d,t:()=>g});var t=e(89949),n=e.n(t),i=e(39343),s=e(75578),r=e(14544);const g={id:r.W.order,name:"Order fields by name",description:"Order fields based on configuration given by user",defaultOptions:{indexByName:{}},operator:o=>m=>m.pipe((0,i.U)(c=>{const p=l(o.indexByName);return!Array.isArray(c)||c.length===0?c:c.map(f=>({...f,fields:p(f.fields,c,f)}))}))},d=o=>(m,c)=>u(m,o)-u(c,o),l=o=>(m,c,p)=>{if(!Array.isArray(m)||m.length===0||!o||Object.keys(o).length===0)return m;const f=d(o);return(0,t.clone)(m).sort((E,h)=>f((0,s.CZ)(E,p,c),(0,s.CZ)(h,p,c)))},u=(o,m)=>Number.isInteger(m[o])?m[o]:Number.MAX_SAFE_INTEGER},85722:(j,I,e)=>{"use strict";e.d(I,{AL:()=>u,mf:()=>o});var t=e(39343),n=e(32053),i=e(75578),s=e(29241),r=e(66656),g=e(76178),d=e(69759),l=e(14544),u=(E=>(E.SeriesToRows="seriesToRows",E.ReduceFields="reduceFields",E))(u||{});const o={id:l.W.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:[r.gz.max]},operator:E=>h=>h.pipe((0,t.U)(y=>{if(!E?.reducers?.length)return y;const v=E.fields?(0,g.sq)(E.fields):E.includeTimeField&&E.mode==="reduceFields"?d.m3:d.Qw;if(E.mode==="reduceFields")return f(y,v,E.reducers);const D=m(y,v,E.reducers,E.labelsToFields);return D?[D]:[]}))};function m(E,h,y,v){const D=r.TB.list(y),a=D.map(b=>b.id),C=[],P=v?c(E):[];for(const b of E){const M=b.fields.filter(A=>h(A,b,E)),T=M.length,S=[],x=new Array(T);S.push({name:"Field",type:s.fS.string,values:x,config:{}});const O={};if(v)for(const A of P)O[A]=new Array(T),S.push({name:A,type:s.fS.string,values:O[A],config:{}});const B={};for(const A of D)B[A.id]=new Array(T),S.push({name:A.name,type:s.fS.other,values:B[A.id],config:{}});for(let A=0;A<M.length;A++){const V=M[A],W=(0,r.Kx)({field:V,reducers:a});if(v){if(x[A]=V.name,V.labels)for(const w of Object.keys(V.labels))O[w][A]=V.labels[w]}else x[A]=(0,i.CZ)(V,b,E);for(const w of D){const N=W[w.id];B[w.id][A]=N}}for(const A of S)if(A.type===s.fS.other){const V=(0,n.fu)(A);V&&(A.type=V)}C.push({...b,fields:S,length:T})}return p(C)}function c(E){const h=new Set;for(const y of E)for(const v of y.fields)if(v.labels)for(const D of Object.keys(v.labels))h.add(D);return[...h]}function p(E){if(!E?.length)return;const h=E[0];for(let y=1;y<E.length;y++){const v=E[y];for(let D=0;D<h.fields.length;D++){const a=h.fields[D];for(let C=0;C<v.fields.length;C++){const P=v.fields[C],b=D===0&&C===0,M=a.type===P.type&&a.name===P.name;if(b||M){const T=a.values,S=P.values;a.values=T.concat(S)}}}}return h.name=void 0,h.length=h.fields[0].values.length,h}function f(E,h,y){const D=r.TB.list(y).map(C=>C.id),a=[];for(const C of E){const P=[];for(const b of C.fields)if(h(b,C,E)){const M=(0,r.Kx)({field:b,reducers:D});for(const T of D){const S=M[T],x={...b,values:[S]};x.state=void 0,D.length>1&&(x.labels||(x.labels={}),x.labels.reducer=r.TB.get(T).name),P.push(x)}}P.length&&a.push({...C,fields:P,length:1})}return a}},61045:()=>{},66770:()=>{},41999:(j,I,e)=>{"use strict";e.d(I,{Z:()=>t});var t=(n=>(n.NoData="no_data",n.Paused="paused",n.Alerting="alerting",n.OK="ok",n.Pending="pending",n.Unknown="unknown",n))(t||{})},22001:(j,I,e)=>{"use strict";e.d(I,{L:()=>t});var t=(n=>(n.Field="field",n.Text="text",n.Skip="skip",n))(t||{})},62247:(j,I,e)=>{"use strict";e.d(I,{CQ:()=>r,k8:()=>s,zj:()=>i});var t=e(9232),n=e(15766),i=(g=>(g.CloudAlerting="cloud-alerting",g.UnifiedAlerting="unified-alerting",g.Dashboard="dashboard",g.Explore="explore",g.Correlations="correlations",g.Unknown="unknown",g.PanelEditor="panel-editor",g.PanelViewer="panel-viewer",g))(i||{});class s extends t.Sg{constructor(){super(...arguments),this._extensionConfigs=[]}init(d){}setRootPage(d){return this.root=d,this}setComponentsFromLegacyExports(d){if(d.ConfigCtrl&&(this.angularConfigCtrl=d.ConfigCtrl),this.meta&&this.meta.includes){for(const l of this.meta.includes)if(l.type===t.$_.page&&l.component&&!d[l.component]){console.warn("App Page uses unknown component: ",l.component,this.meta);continue}}}get extensionConfigs(){return this._extensionConfigs}configureExtensionLink(d){return this._extensionConfigs.push({...d,type:n.D.link}),this}configureExtensionComponent(d){return this._extensionConfigs.push({...d,type:n.D.component}),this}}var r=(g=>(g.alpha="alpha",g.beta="beta",g))(r||{})},47494:(j,I,e)=>{"use strict";e.d(I,{e:()=>t});var t=(n=>(n.OpenSource="Open Source",n.Pro="Pro",n.Enterprise="Enterprise",n))(t||{})},34239:(j,I,e)=>{"use strict";e.d(I,{Hx:()=>t,Z3:()=>n,bm:()=>i});const t=0,n=100,i="SAML"},79248:(j,I,e)=>{"use strict";e.d(I,{m:()=>t});var t=(n=>(n[n.Off=0]="Off",n[n.Crosshair=1]="Crosshair",n[n.Tooltip=2]="Tooltip",n))(t||{})},53933:(j,I,e)=>{"use strict";e.d(I,{Gl:()=>i,Gu:()=>t,dC:()=>n,fQ:()=>s});var t=(r=>(r.NotStarted="NotStarted",r.Loading="Loading",r.Streaming="Streaming",r.Done="Done",r.Error="Error",r))(t||{});const n=["graph","table","logs","trace","nodeGraph","flamegraph","rawPrometheus"];var i=(r=>(r.Null="null",r.Ignore="connected",r.AsZero="null as zero",r))(i||{});const s=r=>!!r},29241:(j,I,e)=>{"use strict";e.d(I,{Ls:()=>i,M5:()=>n,fS:()=>t,rN:()=>s});var t=(r=>(r.time="time",r.number="number",r.string="string",r.boolean="boolean",r.trace="trace",r.geo="geo",r.enum="enum",r.other="other",r.frame="frame",r))(t||{});const n="Value",i="Time",s="Metric"},43987:(j,I,e)=>{"use strict";e.d(I,{P:()=>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||{})},24094:(j,I,e)=>{"use strict";e.d(I,{L8:()=>i,n1:()=>t,o3:()=>s,sN:()=>n});var t=(r=>(r.Datasource="Datasource",r.Correlations="Correlations",r))(t||{}),n=(r=>(r.Regex="regex",r.Logfmt="logfmt",r))(n||{}),i=(r=>(r.Series="series",r.Field="field",r.Fields="fields",r.Value="value",r.BuiltIn="built-in",r.Template="template",r))(i||{}),s=(r=>(r.Values="values",r))(s||{})},68246:(j,I,e)=>{"use strict";e.d(I,{MF:()=>s,Ru:()=>r,eA:()=>g,hf:()=>i,iL:()=>d});var t=e(29403),n=e(9232);class i extends n.Sg{constructor(u){super(),this.DataSourceClass=u,this.components={}}setConfigEditor(u){return this.components.ConfigEditor=u,this}setConfigCtrl(u){return this.angularConfigCtrl=u,this}setQueryCtrl(u){return this.components.QueryCtrl=u,this}setAnnotationQueryCtrl(u){return this.components.AnnotationsQueryCtrl=u,this}setQueryEditor(u){return this.components.QueryEditor=u,this}setExploreQueryField(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){this.angularConfigCtrl=u.ConfigCtrl,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 s{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}getRef(){return{type:this.type,uid:this.uid}}}var r=(l=>(l.Logs="Logs",l.Metrics="Metrics",l.Tracing="Tracing",l))(r||{}),g=(l=>(l.Cancelled="cancelled",l.Timeout="timeout",l.Unknown="unknown",l))(g||{});class d{}d=(0,t.s)(d),s=(0,t.s)(s)},913:()=>{},55411:()=>{},93666:(j,I,e)=>{"use strict";e.d(I,{R:()=>n,S:()=>t});var t=(i=>(i.Thresholds="thresholds",i.PaletteClassic="palette-classic",i.PaletteClassicByName="palette-classic-by-name",i.PaletteSaturated="palette-saturated",i.ContinuousGrYlRd="continuous-GrYlRd",i.ContinuousRdYlGr="continuous-RdYlGr",i.ContinuousBlYlRd="continuous-BlYlRd",i.ContinuousYlRd="continuous-YlRd",i.ContinuousBlPu="continuous-BlPu",i.ContinuousYlBl="continuous-YlBl",i.ContinuousBlues="continuous-blues",i.ContinuousReds="continuous-reds",i.ContinuousGreens="continuous-greens",i.ContinuousPurples="continuous-purples",i.Fixed="fixed",i.Shades="shades",i))(t||{});const n="#808080"},25587:(j,I,e)=>{"use strict";e.d(I,{Y4:()=>t,qb:()=>i,v3:()=>n});function t(s){return r=>r.__systemRef===s}const n=s=>typeof s?.__systemRef=="string";var i=(s=>(s.Unit="unit",s.Min="min",s.Max="max",s.Decimals="decimals",s.DisplayName="displayName",s.NoValue="noValue",s.Thresholds="thresholds",s.Mappings="mappings",s.Links="links",s.Color="color",s.Filterable="filterable",s))(i||{})},26936:()=>{},97495:()=>{},67228:()=>{},8553:(j,I,e)=>{"use strict";e.d(I,{Mo:()=>n,_S:()=>t,iJ:()=>i});const t={google:!0,microsoft:!0,github:!0,gitlab:!0,okta:!0,discord:!0,hipchat:!0,"google-hangouts-alt":!0,pagerduty:!0,line:!0,anchor:!0,"adjust-circle":!0,"angle-double-down":!0,"angle-double-right":!0,"angle-double-up":!0,"angle-down":!0,"angle-left":!0,"angle-right":!0,"angle-up":!0,"align-left":!0,"align-right":!0,apps:!0,arrow:!0,"arrow-down":!0,"arrow-from-right":!0,"arrow-left":!0,"arrow-random":!0,"arrow-right":!0,"arrow-to-right":!0,"arrow-up":!0,"arrows-h":!0,"arrows-v":!0,"expand-arrows":!0,at:!0,backward:!0,bars:!0,bell:!0,"bell-slash":!0,bolt:!0,book:!0,bookmark:!0,"book-open":!0,"brackets-curly":!0,bug:!0,building:!0,"calculator-alt":!0,"calendar-alt":!0,"calendar-slash":!0,camera:!0,capture:!0,"channel-add":!0,"chart-line":!0,check:!0,"check-circle":!0,"check-square":!0,circle:!0,"circle-mono":!0,"clipboard-alt":!0,"clock-nine":!0,cloud:!0,"cloud-download":!0,"cloud-upload":!0,"code-branch":!0,cog:!0,columns:!0,"comment-alt":!0,"comment-alt-message":!0,"comment-alt-share":!0,"comments-alt":!0,compass:!0,copy:!0,"corner-down-right-alt":!0,"create-dashboard":!0,"credit-card":!0,crosshair:!0,cube:!0,dashboard:!0,database:!0,"dice-three":!0,"document-info":!0,"download-alt":!0,draggabledots:!0,edit:!0,"ellipsis-v":!0,envelope:!0,"exchange-alt":!0,"exclamation-triangle":!0,"exclamation-circle":!0,"external-link-alt":!0,eye:!0,"eye-slash":!0,"ellipsis-h":!0,"fa fa-spinner":!0,favorite:!0,"file-alt":!0,"file-blank":!0,"file-copy-alt":!0,"file-download":!0,"file-landscape-alt":!0,filter:!0,flip:!0,folder:!0,font:!0,fire:!0,"folder-open":!0,"folder-plus":!0,"folder-upload":!0,forward:!0,"gf-bar-alignment-after":!0,"gf-bar-alignment-before":!0,"gf-bar-alignment-center":!0,"gf-glue":!0,"gf-grid":!0,"gf-interpolation-linear":!0,"gf-interpolation-smooth":!0,"gf-interpolation-step-after":!0,"gf-interpolation-step-before":!0,"gf-landscape":!0,"gf-layout-simple":!0,"gf-logs":!0,"gf-movepane-left":!0,"gf-movepane-right":!0,"gf-portrait":!0,"gf-service-account":!0,"gf-show-context":!0,"gf-pin":!0,grafana:!0,"graph-bar":!0,"grafana-ml":!0,heart:!0,"heart-rate":!0,"heart-break":!0,history:!0,"history-alt":!0,home:!0,"home-alt":!0,"horizontal-align-center":!0,"horizontal-align-left":!0,"horizontal-align-right":!0,hourglass:!0,import:!0,info:!0,"info-circle":!0,k6:!0,"key-skeleton-alt":!0,keyboard:!0,"layer-group":!0,"layers-alt":!0,"library-panel":!0,"line-alt":!0,link:!0,"list-ui-alt":!0,"list-ul":!0,"list-ol":!0,lock:!0,"map-marker":!0,"map-marker-plus":!0,"map-marker-minus":!0,message:!0,minus:!0,"minus-circle":!0,"mobile-android":!0,monitor:!0,palette:!0,"panel-add":!0,"pathfinder-unite":!0,pause:!0,pen:!0,percentage:!0,play:!0,plug:!0,plus:!0,"plus-circle":!0,"plus-square":!0,power:!0,"presentation-play":!0,process:!0,"question-circle":!0,"record-audio":!0,repeat:!0,rocket:!0,"ruler-combined":!0,save:!0,search:!0,"search-minus":!0,"search-plus":!0,"share-alt":!0,shield:!0,"shield-exclamation":!0,signal:!0,signin:!0,signout:!0,sitemap:!0,slack:!0,"sliders-v-alt":!0,"sort-amount-down":!0,"sort-amount-up":!0,"square-shape":!0,star:!0,"step-backward":!0,stopwatch:!0,"stopwatch-slash":!0,sync:!0,"sync-slash":!0,table:!0,"tag-alt":!0,"telegram-alt":!0,"text-fields":!0,"thumbs-up":!0,times:!0,"times-circle":!0,"toggle-on":!0,"toggle-off":!0,"trash-alt":!0,unlock:!0,upload:!0,user:!0,"users-alt":!0,"user-arrows":!0,"vertical-align-bottom":!0,"vertical-align-center":!0,"vertical-align-top":!0,"wrap-text":!0,rss:!0,x:!0};function n(s){return!s||typeof s!="string"?!1:s in t}function i(s){if(n(s))return s}},312:(j,I,e)=>{"use strict";e.r(I),e.d(I,{AbstractLabelOperator:()=>d.K2,AlertState:()=>Z.Z,AnnotationEventFieldSource:()=>l.L,AppEvents:()=>_.SI,AppPlugin:()=>T.k8,CoreApp:()=>T.zj,CustomVariableSupport:()=>Y.Mg,DEFAULT_SAML_NAME:()=>t.bm,DashboardCursorSync:()=>g.m,DataFrameType:()=>s.P,DataLinkConfigOrigin:()=>r.n1,DataQueryErrorType:()=>S.eA,DataSourceApi:()=>S.MF,DataSourcePlugin:()=>S.hf,DataSourceVariableSupport:()=>Y.gv,DataTopic:()=>d.w5,DefaultTimeZone:()=>p.Ys,ExploreMode:()=>S.Ru,FALLBACK_COLOR:()=>A.R,FeatureState:()=>T.CQ,FieldColorModeId:()=>A.S,FieldConfigProperty:()=>b.qb,FieldType:()=>i.fS,GAUGE_DEFAULT_MAXIMUM:()=>t.Z3,GAUGE_DEFAULT_MINIMUM:()=>t.Hx,GrafanaPlugin:()=>O.Sg,GrafanaThemeType:()=>V.Q,LanguageProvider:()=>S.iL,LegacyGraphHoverClearEvent:()=>_.oi,LegacyGraphHoverEvent:()=>_.IA,LiveChannelConnectionState:()=>G.yS,LiveChannelEventType:()=>G.FU,LiveChannelScope:()=>G.z,LiveChannelType:()=>G.SK,LoadingState:()=>n.Gu,LogLevel:()=>u.in,LogRowContextQueryDirection:()=>u.M4,LogsDedupDescription:()=>u.Uv,LogsDedupStrategy:()=>u.Y4,LogsMetaKind:()=>u.Ku,LogsSortOrder:()=>u.UV,LogsVolumeType:()=>u.o8,MappingType:()=>E.H,NullValueMode:()=>n.Gl,OrgRole:()=>W.B,PageLayoutType:()=>o.Q,PanelEvents:()=>_.Kh,PluginErrorCode:()=>O.w2,PluginExtensionPoints:()=>re.y,PluginExtensionTypes:()=>re.D,PluginIncludeType:()=>O.$_,PluginSignatureStatus:()=>O.Xy,PluginSignatureType:()=>O._Z,PluginState:()=>O.BV,PluginType:()=>O.zV,SpecialValue:()=>P.U,SpecialValueMatch:()=>E.e,StandardVariableSupport:()=>Y.v6,SupplementaryQueryType:()=>u.v8,SupportedTransformationType:()=>r.sN,TIME_FORMAT:()=>p.T_,TIME_SERIES_METRIC_FIELD_NAME:()=>i.rN,TIME_SERIES_TIME_FIELD_NAME:()=>i.Ls,TIME_SERIES_VALUE_FIELD_NAME:()=>i.M5,ThresholdsMode:()=>f.H,VariableHide:()=>B.bU,VariableOrigin:()=>r.L8,VariableRefresh:()=>B.Bd,VariableSort:()=>B.$U,VariableSuggestionsScope:()=>r.o3,VariableSupportBase:()=>Y.Tq,VariableSupportType:()=>Y.j2,VisualizationSuggestionScore:()=>x._,VisualizationSuggestionsBuilder:()=>x.mi,VisualizationSuggestionsListAppender:()=>x.sf,VizOrientation:()=>x.wm,availableIconsIndex:()=>ae._S,getDefaultRelativeTimeRange:()=>p.Rr,getDefaultTimeRange:()=>p.JK,hasLogsContextSupport:()=>u.Q4,hasLogsContextUiSupport:()=>u.xW,hasQueryExportSupport:()=>d.p,hasQueryImportSupport:()=>d.CZ,hasSupplementaryQuerySupport:()=>u.mN,hasToggleableQueryFiltersSupport:()=>u.Vw,isIconName:()=>ae.Mo,isLiveChannelJoinEvent:()=>G.mx,isLiveChannelLeaveEvent:()=>G.gH,isLiveChannelMessageEvent:()=>G.RL,isLiveChannelStatusEvent:()=>G.se,isSystemOverride:()=>b.v3,isSystemOverrideWithRef:()=>b.Y4,isTruthy:()=>n.fQ,isUnsignedPluginSignature:()=>se.x,isValidLiveChannelAddress:()=>G.nU,makeArrayIndexableVector:()=>M.U,parseLiveChannelAddress:()=>G.H7,preferredVisualizationTypes:()=>n.dC,toIconName:()=>ae.iJ,toLiveChannelId:()=>G.Aj});var t=e(34239),n=e(53933),i=e(29241),s=e(43987),r=e(24094),g=e(79248),d=e(69376),l=e(22001),u=e(51451),o=e(38192),m=e(66018),c=e.n(m),ge={};for(const De in m)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType"].indexOf(De)<0&&(ge[De]=()=>m[De]);e.d(I,ge);var p=e(8508),f=e(5168),E=e(51046),h=e(913),y=e.n(h),ge={};for(const De in h)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch"].indexOf(De)<0&&(ge[De]=()=>h[De]);e.d(I,ge);var v=e(67228),D=e.n(v),ge={};for(const De in v)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch"].indexOf(De)<0&&(ge[De]=()=>v[De]);e.d(I,ge);var a=e(61045),C=e.n(a),ge={};for(const De in a)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch"].indexOf(De)<0&&(ge[De]=()=>a[De]);e.d(I,ge);var P=e(49721),b=e(25587),M=e(79866),T=e(62247),S=e(68246),x=e(90482),O=e(9232),B=e(82986),A=e(93666),V=e(40125),W=e(50686),w=e(26936),N=e.n(w),ge={};for(const De in w)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","AppPlugin","CoreApp","FeatureState","DataQueryErrorType","DataSourceApi","DataSourcePlugin","ExploreMode","LanguageProvider","VisualizationSuggestionScore","VisualizationSuggestionsBuilder","VisualizationSuggestionsListAppender","VizOrientation","GrafanaPlugin","PluginErrorCode","PluginIncludeType","PluginSignatureStatus","PluginSignatureType","PluginState","PluginType","VariableHide","VariableRefresh","VariableSort","FALLBACK_COLOR","FieldColorModeId","GrafanaThemeType","OrgRole"].indexOf(De)<0&&(ge[De]=()=>w[De]);e.d(I,ge);var F=e(97262),k=e.n(F),ge={};for(const De in F)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","AppPlugin","CoreApp","FeatureState","DataQueryErrorType","DataSourceApi","DataSourcePlugin","ExploreMode","LanguageProvider","VisualizationSuggestionScore","VisualizationSuggestionsBuilder","VisualizationSuggestionsListAppender","VizOrientation","GrafanaPlugin","PluginErrorCode","PluginIncludeType","PluginSignatureStatus","PluginSignatureType","PluginState","PluginType","VariableHide","VariableRefresh","VariableSort","FALLBACK_COLOR","FieldColorModeId","GrafanaThemeType","OrgRole"].indexOf(De)<0&&(ge[De]=()=>F[De]);e.d(I,ge);var H=e(55411),R=e.n(H),ge={};for(const De in H)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","AppPlugin","CoreApp","FeatureState","DataQueryErrorType","DataSourceApi","DataSourcePlugin","ExploreMode","LanguageProvider","VisualizationSuggestionScore","VisualizationSuggestionsBuilder","VisualizationSuggestionsListAppender","VizOrientation","GrafanaPlugin","PluginErrorCode","PluginIncludeType","PluginSignatureStatus","PluginSignatureType","PluginState","PluginType","VariableHide","VariableRefresh","VariableSort","FALLBACK_COLOR","FieldColorModeId","GrafanaThemeType","OrgRole"].indexOf(De)<0&&(ge[De]=()=>H[De]);e.d(I,ge);var _=e(3935),G=e(81087),Y=e(79726),X=e(97495),Q=e.n(X),ge={};for(const De in X)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","AppPlugin","CoreApp","FeatureState","DataQueryErrorType","DataSourceApi","DataSourcePlugin","ExploreMode","LanguageProvider","VisualizationSuggestionScore","VisualizationSuggestionsBuilder","VisualizationSuggestionsListAppender","VizOrientation","GrafanaPlugin","PluginErrorCode","PluginIncludeType","PluginSignatureStatus","PluginSignatureType","PluginState","PluginType","VariableHide","VariableRefresh","VariableSort","FALLBACK_COLOR","FieldColorModeId","GrafanaThemeType","OrgRole","AppEvents","LegacyGraphHoverClearEvent","LegacyGraphHoverEvent","PanelEvents","LiveChannelConnectionState","LiveChannelEventType","LiveChannelScope","LiveChannelType","isLiveChannelJoinEvent","isLiveChannelLeaveEvent","isLiveChannelMessageEvent","isLiveChannelStatusEvent","isValidLiveChannelAddress","parseLiveChannelAddress","toLiveChannelId","CustomVariableSupport","DataSourceVariableSupport","StandardVariableSupport","VariableSupportBase","VariableSupportType"].indexOf(De)<0&&(ge[De]=()=>X[De]);e.d(I,ge);var se=e(81538),Z=e(41999),le=e(93684),oe=e.n(le),ge={};for(const De in le)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","AppPlugin","CoreApp","FeatureState","DataQueryErrorType","DataSourceApi","DataSourcePlugin","ExploreMode","LanguageProvider","VisualizationSuggestionScore","VisualizationSuggestionsBuilder","VisualizationSuggestionsListAppender","VizOrientation","GrafanaPlugin","PluginErrorCode","PluginIncludeType","PluginSignatureStatus","PluginSignatureType","PluginState","PluginType","VariableHide","VariableRefresh","VariableSort","FALLBACK_COLOR","FieldColorModeId","GrafanaThemeType","OrgRole","AppEvents","LegacyGraphHoverClearEvent","LegacyGraphHoverEvent","PanelEvents","LiveChannelConnectionState","LiveChannelEventType","LiveChannelScope","LiveChannelType","isLiveChannelJoinEvent","isLiveChannelLeaveEvent","isLiveChannelMessageEvent","isLiveChannelStatusEvent","isValidLiveChannelAddress","parseLiveChannelAddress","toLiveChannelId","CustomVariableSupport","DataSourceVariableSupport","StandardVariableSupport","VariableSupportBase","VariableSupportType","AlertState"].indexOf(De)<0&&(ge[De]=()=>le[De]);e.d(I,ge);var q=e(66770),ne=e.n(q),ge={};for(const De in q)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isTruthy","preferredVisualizationTypes","FieldType","TIME_SERIES_METRIC_FIELD_NAME","TIME_SERIES_TIME_FIELD_NAME","TIME_SERIES_VALUE_FIELD_NAME","DataFrameType","DataLinkConfigOrigin","SupportedTransformationType","VariableOrigin","VariableSuggestionsScope","DashboardCursorSync","AbstractLabelOperator","DataTopic","hasQueryExportSupport","hasQueryImportSupport","AnnotationEventFieldSource","LogLevel","LogRowContextQueryDirection","LogsDedupDescription","LogsDedupStrategy","LogsMetaKind","LogsSortOrder","LogsVolumeType","SupplementaryQueryType","hasLogsContextSupport","hasLogsContextUiSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","AppPlugin","CoreApp","FeatureState","DataQueryErrorType","DataSourceApi","DataSourcePlugin","ExploreMode","LanguageProvider","VisualizationSuggestionScore","VisualizationSuggestionsBuilder","VisualizationSuggestionsListAppender","VizOrientation","GrafanaPlugin","PluginErrorCode","PluginIncludeType","PluginSignatureStatus","PluginSignatureType","PluginState","PluginType","VariableHide","VariableRefresh","VariableSort","FALLBACK_COLOR","FieldColorModeId","GrafanaThemeType","OrgRole","AppEvents","LegacyGraphHoverClearEvent","LegacyGraphHoverEvent","PanelEvents","LiveChannelConnectionState","LiveChannelEventType","LiveChannelScope","LiveChannelType","isLiveChannelJoinEvent","isLiveChannelLeaveEvent","isLiveChannelMessageEvent","isLiveChannelStatusEvent","isValidLiveChannelAddress","parseLiveChannelAddress","toLiveChannelId","CustomVariableSupport","DataSourceVariableSupport","StandardVariableSupport","VariableSupportBase","VariableSupportType","AlertState"].indexOf(De)<0&&(ge[De]=()=>q[De]);e.d(I,ge);var ae=e(8553),re=e(15766)},47435:(j,I,e)=>{"use strict";e.d(I,{l:()=>t});var t=(n=>(n.Grid="grid",n.List="list",n))(t||{})},3935:(j,I,e)=>{"use strict";e.d(I,{IA:()=>r,Kh:()=>s,SI:()=>i,oi:()=>g});var t=e(74817),n=e(96509);const i={alertSuccess:(0,t.X)("alert-success"),alertWarning:(0,t.X)("alert-warning"),alertError:(0,t.X)("alert-error")},s={refresh:(0,t.X)("refresh"),componentDidMount:(0,t.X)("component-did-mount"),dataReceived:(0,t.X)("data-received"),dataError:(0,t.X)("data-error"),dataFramesReceived:(0,t.X)("data-frames-received"),dataSnapshotLoad:(0,t.X)("data-snapshot-load"),editModeInitialized:(0,t.X)("init-edit-mode"),initPanelActions:(0,t.X)("init-panel-actions"),initialized:(0,t.X)("panel-initialized"),panelTeardown:(0,t.X)("panel-teardown"),render:(0,t.X)("render")};class r extends n.R{}r.type="graph-hover";class g extends n.m{constructor(){super(...arguments),this.payload={point:{}}}}g.type="graph-hover-clear"},81087:(j,I,e)=>{"use strict";e.d(I,{Aj:()=>m,FU:()=>s,H7:()=>u,RL:()=>l,SK:()=>n,gH:()=>d,mx:()=>g,nU:()=>o,se:()=>r,yS:()=>i,z:()=>t});var t=(c=>(c.DataSource="ds",c.Plugin="plugin",c.Grafana="grafana",c.Stream="stream",c))(t||{}),n=(c=>(c.DataStream="stream",c.DataFrame="frame",c.JSON="json",c))(n||{}),i=(c=>(c.Pending="pending",c.Connected="connected",c.Connecting="connecting",c.Disconnected="disconnected",c.Shutdown="shutdown",c.Invalid="invalid",c))(i||{}),s=(c=>(c.Status="status",c.Join="join",c.Leave="leave",c.Message="message",c))(s||{});function r(c){return c.type==="status"}function g(c){return c.type==="join"}function d(c){return c.type==="leave"}function l(c){return c.type==="message"}function u(c){if(c?.length){let p=c.trim().split("/");if(p.length>=3)return{scope:p[0],namespace:p[1],path:p.slice(2).join("/")}}}function o(c){return!!(c?.path&&c.namespace&&c.scope)}function m(c){if(!c.scope)return"";let p=c.scope;return!c.namespace||(p+="/"+c.namespace,!c.path)?p:p+"/"+c.path}},51451:(j,I,e)=>{"use strict";e.d(I,{Ku:()=>i,M4:()=>r,Q4:()=>g,UV:()=>t.UV,Uv:()=>s,Vw:()=>m,Y4:()=>t.Y4,in:()=>n,mN:()=>u,o8:()=>l,v8:()=>d,xW:()=>o});var t=e(64167),n=(c=>(c.emerg="critical",c.fatal="critical",c.alert="critical",c.crit="critical",c.critical="critical",c.warn="warning",c.warning="warning",c.err="error",c.eror="error",c.error="error",c.info="info",c.information="info",c.informational="info",c.notice="info",c.dbug="debug",c.debug="debug",c.trace="trace",c.unknown="unknown",c))(n||{}),i=(c=>(c[c.Number=0]="Number",c[c.String=1]="String",c[c.LabelsMap=2]="LabelsMap",c[c.Error=3]="Error",c))(i||{}),s=(c=>(c.none="No de-duplication",c.exact="De-duplication of successive lines that are identical, ignoring ISO datetimes.",c.numbers="De-duplication of successive lines that are identical when ignoring numbers, e.g., IP addresses, latencies.",c.signature="De-duplication of successive lines that have identical punctuation and whitespace.",c))(s||{}),r=(c=>(c.Backward="BACKWARD",c.Forward="FORWARD",c))(r||{});const g=c=>{if(!c)return!1;const p=c;return p.getLogRowContext!==void 0&&p.showContextToggle!==void 0};var d=(c=>(c.LogsVolume="LogsVolume",c.LogsSample="LogsSample",c))(d||{}),l=(c=>(c.FullRange="FullRange",c.Limited="Limited",c))(l||{});const u=(c,p)=>{if(!c)return!1;const f=c;return f.getDataProvider!==void 0&&f.getSupplementaryQuery!==void 0&&f.getSupportedSupplementaryQueryTypes().includes(p)},o=c=>c?c.getLogRowContextUi!==void 0:!1,m=c=>c!==null&&typeof c=="object"&&"toggleQueryFilter"in c&&"queryHasFilter"in c},38192:(j,I,e)=>{"use strict";e.d(I,{Q:()=>t});var t=(n=>(n[n.Standard=0]="Standard",n[n.Canvas=1]="Canvas",n[n.Custom=2]="Custom",n))(t||{})},50686:(j,I,e)=>{"use strict";e.d(I,{B:()=>t});var t=(n=>(n.None="None",n.Viewer="Viewer",n.Editor="Editor",n.Admin="Admin",n))(t||{})},90482:(j,I,e)=>{"use strict";e.d(I,{_:()=>r,mi:()=>g,sf:()=>d,wm:()=>s});var t=e(89949),n=e.n(t),i=e(29241),s=(l=>(l.Auto="auto",l.Vertical="vertical",l.Horizontal="horizontal",l))(s||{}),r=(l=>(l[l.Best=100]="Best",l[l.Good=70]="Good",l[l.OK=50]="OK",l))(r||{});class g{constructor(u,o){this.list=[],this.data=u,this.panel=o,this.dataSummary=this.computeDataSummary()}getListAppender(u){return new d(this.list,u)}computeDataSummary(){const u=this.data?.series||[];let o=0,m=0,c=0,p=0,f=0,E=0,h;for(const y of u){p+=y.length,y.meta?.preferredVisualisationType&&(h=y.meta.preferredVisualisationType);for(const v of y.fields)switch(E++,v.type){case i.fS.number:o+=1;break;case i.fS.time:m+=1;break;case i.fS.string:c+=1;break}y.length>f&&(f=y.length)}return{numberFieldCount:o,timeFieldCount:m,stringFieldCount:c,rowCountTotal:p,rowCountMax:f,fieldCount:E,preferredVisualisationType:h,frameCount:u.length,hasData:p>0,hasTimeField:m>0,hasNumberField:o>0,hasStringField:c>0}}getList(){return this.list}}class d{constructor(u,o){this.list=u,this.defaults=o}append(u){this.list.push((0,t.defaultsDeep)(u,this.defaults))}}},9232:(j,I,e)=>{"use strict";e.d(I,{$_:()=>g,BV:()=>t,Sg:()=>d,Xy:()=>i,_Z:()=>s,w2:()=>r,zV:()=>n});var t=(l=>(l.alpha="alpha",l.beta="beta",l.stable="stable",l.deprecated="deprecated",l))(t||{}),n=(l=>(l.panel="panel",l.datasource="datasource",l.app="app",l.renderer="renderer",l.secretsmanager="secretsmanager",l))(n||{}),i=(l=>(l.internal="internal",l.valid="valid",l.invalid="invalid",l.modified="modified",l.missing="missing",l))(i||{}),s=(l=>(l.grafana="grafana",l.commercial="commercial",l.community="community",l.private="private",l.core="core",l))(s||{}),r=(l=>(l.missingSignature="signatureMissing",l.invalidSignature="signatureInvalid",l.modifiedSignature="signatureModified",l))(r||{}),g=(l=>(l.dashboard="dashboard",l.page="page",l.panel="panel",l.datasource="datasource",l))(g||{});class d{addConfigPage(u){return this.configPages||(this.configPages=[]),this.configPages.push(u),this}setChannelSupport(u){return console.warn("[deprecation] plugin is using ignored option: setChannelSupport",this.meta),this}constructor(){this.meta={}}}},15766:(j,I,e)=>{"use strict";e.d(I,{D:()=>t,y:()=>n});var t=(i=>(i.link="link",i.component="component",i))(t||{}),n=(i=>(i.DashboardPanelMenu="grafana/dashboard/panel/menu",i.DataSourceConfig="grafana/datasources/config",i.ExploreToolbarAction="grafana/explore/toolbar/action",i))(n||{})},81538:(j,I,e)=>{"use strict";e.d(I,{x:()=>n});var t=e(9232);function n(i){return i&&i!==t.Xy.valid&&i!==t.Xy.internal}},69376:(j,I,e)=>{"use strict";e.d(I,{CZ:()=>i,K2:()=>n,p:()=>s,w5:()=>t});var t=(r=>(r.Annotations="annotations",r))(t||{}),n=(r=>(r.Equal="Equal",r.NotEqual="NotEqual",r.EqualRegEx="EqualRegEx",r.NotEqualRegEx="NotEqualRegEx",r))(n||{});const i=r=>r.importFromAbstractQueries!==void 0,s=r=>r.exportToAbstractQueries!==void 0},66018:()=>{},93684:()=>{},82986:(j,I,e)=>{"use strict";e.d(I,{$U:()=>n,Bd:()=>t,bU:()=>i});var t=(s=>(s[s.never=0]="never",s[s.onDashboardLoad=1]="onDashboardLoad",s[s.onTimeRangeChanged=2]="onTimeRangeChanged",s))(t||{}),n=(s=>(s[s.disabled=0]="disabled",s[s.alphabeticalAsc=1]="alphabeticalAsc",s[s.alphabeticalDesc=2]="alphabeticalDesc",s[s.numericalAsc=3]="numericalAsc",s[s.numericalDesc=4]="numericalDesc",s[s.alphabeticalCaseInsensitiveAsc=5]="alphabeticalCaseInsensitiveAsc",s[s.alphabeticalCaseInsensitiveDesc=6]="alphabeticalCaseInsensitiveDesc",s))(n||{}),i=(s=>(s[s.dontHide=0]="dontHide",s[s.hideLabel=1]="hideLabel",s[s.hideVariable=2]="hideVariable",s))(i||{})},40125:(j,I,e)=>{"use strict";e.d(I,{Q:()=>t});var t=(n=>(n.Light="light",n.Dark="dark",n))(t||{})},5168:(j,I,e)=>{"use strict";e.d(I,{H:()=>t});var t=(n=>(n.Absolute="absolute",n.Percentage="percentage",n))(t||{})},8508:(j,I,e)=>{"use strict";e.d(I,{JK:()=>r,Rr:()=>g,T_:()=>s,Ys:()=>i});var t=e(64167),n=e(99633);const i=t.iT,s="YYYY-MM-DD HH:mm:ss";function r(){const d=(0,n.CQ)();return{from:(0,n.CQ)(d).subtract(6,"hour"),to:d,raw:{from:"now-6h",to:"now"}}}function g(){return{from:600,to:0}}},97262:()=>{},49721:(j,I,e)=>{"use strict";e.d(I,{U:()=>t});var t=(n=>(n.True="true",n.False="false",n.Null="null",n.Empty="empty",n))(t||{})},51046:(j,I,e)=>{"use strict";e.d(I,{H:()=>t,e:()=>n});var t=(i=>(i.ValueToText="value",i.RangeToText="range",i.RegexToText="regex",i.SpecialValue="special",i))(t||{}),n=(i=>(i.True="true",i.False="false",i.Null="null",i.NaN="nan",i.NullAndNaN="null+nan",i.Empty="empty",i))(n||{})},79726:(j,I,e)=>{"use strict";e.d(I,{Mg:()=>s,Tq:()=>n,gv:()=>r,j2:()=>t,v6:()=>i});var t=(g=>(g.Legacy="legacy",g.Standard="standard",g.Custom="custom",g.Datasource="datasource",g))(t||{});class n{}class i extends n{getType(){return"standard"}}class s extends n{getType(){return"custom"}}class r extends n{getType(){return"datasource"}}},79866:(j,I,e)=>{"use strict";e.d(I,{U:()=>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,i){this[n]=i},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}});function t(n){return new Proxy(n,{get(i,s,r){if(typeof s!="symbol"){const g=+s;if(String(g)===s)return i.get(g)}return Reflect.get(i,s,r)},set(i,s,r,g){if(typeof s!="symbol"){const d=+s;if(String(d)===s)return i.set(d,r),!0}return Reflect.set(i,s,r,g)}})}},2471:(j,I,e)=>{"use strict";e.d(I,{vo:()=>r,rt:()=>l,j:()=>d});var t=e(41199),n=e(27001),i=e(25359);class s{constructor(){this.properties=[]}addCustomEditor(o){return this.properties.push(o),this}getRegistry(){return new i.B(()=>this.properties)}getItems(){return this.properties}}class r extends s{addNumberInput(o){return this.addCustomEditor({...o,id:o.path,override:t.S.get("number").editor,editor:t.S.get("number").editor,process:n.Oh,shouldApply:o.shouldApply??(()=>!0),settings:o.settings||{}})}addSliderInput(o){return this.addCustomEditor({...o,id:o.path,override:t.S.get("slider").editor,editor:t.S.get("slider").editor,process:n.Oh,shouldApply:o.shouldApply??(()=>!0),settings:o.settings||{}})}addTextInput(o){return this.addCustomEditor({...o,id:o.path,override:t.S.get("text").editor,editor:t.S.get("text").editor,process:n.op,shouldApply:o.shouldApply??(()=>!0),settings:o.settings||{}})}addSelect(o){return this.addCustomEditor({...o,id:o.path,override:t.S.get("select").editor,editor:t.S.get("select").editor,process:n.AE,shouldApply:o.shouldApply?o.shouldApply:()=>!0,settings:o.settings||{options:[]}})}addRadio(o){return this.addCustomEditor({...o,id:o.path,override:t.S.get("radio").editor,editor:t.S.get("radio").editor,process:n.AE,shouldApply:o.shouldApply?o.shouldApply:()=>!0,settings:o.settings||{options:[]}})}addBooleanSwitch(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("boolean").editor,override:t.S.get("boolean").editor,process:n.W4,shouldApply:o.shouldApply?o.shouldApply:()=>!0,settings:o.settings||{}})}addColorPicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("color").editor,override:t.S.get("color").editor,process:n.kG,shouldApply:o.shouldApply?o.shouldApply:()=>!0,settings:o.settings||{}})}addUnitPicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("unit").editor,override:t.S.get("unit").editor,process:n.VB,shouldApply:o.shouldApply?o.shouldApply:()=>!0,settings:o.settings||{}})}addFieldNamePicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("field-name").editor,override:t.S.get("field-name").editor,process:n.kG,shouldApply:o.shouldApply?o.shouldApply:()=>!0,settings:o.settings||{}})}addGenericEditor(o,m){return this.addCustomEditor({...o,id:o.path,editor:m,override:m,process:n.kG,shouldApply:o.shouldApply?o.shouldApply:()=>!0,settings:o.settings||{}})}}class g{constructor(o){this.cfg=o,this.path="",this.id="nested-panel-options",this.name="nested",this.editor=()=>null,this.getBuilder=()=>this.cfg.build,this.getNestedValueAccess=m=>{const c=this.cfg.values;return c?c(m):{getValue:p=>m.getValue(`${this.path}.${p}`),onChange:(p,f)=>m.onChange(`${this.path}.${p}`,f)}},this.path=o.path,this.category=o.category,this.defaultValue=o.defaultValue}}function d(u){return u.id==="nested-panel-options"}class l extends s{addNestedOptions(o){const m=new g(o);return this.addCustomEditor(m)}addNumberInput(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("number").editor})}addSliderInput(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("slider").editor})}addTextInput(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("text").editor})}addStringArray(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("strings").editor})}addSelect(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("select").editor})}addMultiSelect(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("multi-select").editor})}addRadio(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("radio").editor})}addBooleanSwitch(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("boolean").editor})}addColorPicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("color").editor,settings:o.settings||{}})}addTimeZonePicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("timezone").editor,settings:o.settings||{}})}addUnitPicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("unit").editor})}addFieldNamePicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("field-name").editor})}addDashboardPicker(o){return this.addCustomEditor({...o,id:o.path,editor:t.S.get("dashboard-uid").editor})}}},17373:(j,I,e)=>{"use strict";e.d(I,{I:()=>i});var t=e(89949),n=e.n(t);function i(s){return typeof s=="number"?s:s===""||s===null||s===void 0||Array.isArray(s)?NaN:typeof s=="boolean"?s?1:0:(0,t.toNumber)(s)}},99025:(j,I,e)=>{"use strict";e.r(I),e.d(I,{moveItemImmutably:()=>n,sortValues:()=>r});var t=e(64167);function n(g,d,l){const u=[...g];return Array.prototype.splice.call(u,l,0,Array.prototype.splice.call(u,d,1)[0]),u}const i=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),s=(g,d)=>g-d;function r(g){return(d,l)=>{if(d===l)return 0;if(l==null||typeof l=="string"&&l.trim()==="")return-1;if(d==null||typeof d=="string"&&d?.trim()==="")return 1;let u=i.compare;return typeof d=="number"&&typeof l=="number"&&(u=s),g===t.As.Descending?u(l,d):u(d,l)}}},32338:(j,I,e)=>{"use strict";e.d(I,{L:()=>n,n:()=>i});var t=e(25359),n=(s=>(s.Add="+",s.Subtract="-",s.Divide="/",s.Multiply="*",s))(n||{});const i=new t.B(()=>[{id:"+",name:"Add",operation:(s,r)=>s+r},{id:"-",name:"Subtract",operation:(s,r)=>s-r},{id:"*",name:"Multiply",operation:(s,r)=>s*r},{id:"/",name:"Divide",operation:(s,r)=>s/r}])},92827:(j,I,e)=>{"use strict";e.d(I,{MJ:()=>v,QM:()=>p,uP:()=>m,x5:()=>o});var t=e(89949),n=e.n(t),i=e(64802),s=e.n(i),r=e(72164),g=e(32053),d=e(75578),l=e(29241),u=e(21609),o=(D=>(D[D.full=0]="full",D[D.name=1]="name",D[D.none=2]="none",D))(o||{});function m(D,a){return new p(a).readCSV(D)}var c=(D=>(D[D.Starting=0]="Starting",D[D.InHeader=1]="InHeader",D[D.ReadingRows=2]="ReadingRows",D))(c||{});class p{constructor(a){this.chunk=(C,P)=>{for(let b=0;b<C.data.length;b++){const M=C.data[b];if(M.length<1)continue;const T=M[0];if(T){if(T.startsWith("#")){const S=T.indexOf("#",2);if(S>0){const x=T.slice(1,S),O=x==="name";if(O||{unit:"#"}.hasOwnProperty(x)){this.state===2&&(this.current=new r.v({fields:[]}),this.data.push(this.current));const A=T.slice(S+1);if(O){this.current.addFieldFor(void 0,A);for(let V=1;V<M.length;V++)this.current.addFieldFor(void 0,M[V])}else{const{fields:V}=this.current;for(let W=0;W<V.length;W++){V[W].config||(V[W].config={});const w=V[W].config;w[x]=W===0?A:M[W]}}this.state=1;continue}}else if(this.state===0){this.state=1;continue}continue}if(this.state===0){if((0,g.LI)(T)===l.fS.string){for(const x of M)this.current.addFieldFor(void 0,x);this.state=1;continue}this.state=1}}if(this.state,this.state=2,M.length>this.current.fields.length){const{fields:S}=this.current;for(let x=S.length;x<M.length;x++)this.current.addFieldFor(M[x]);this.callback&&this.callback.onHeader(this.current.fields)}this.current.appendRow(M),this.callback&&this.callback.onRow(M)}},a||(a={}),this.config=a.config||{},this.callback=a.callback,this.current=new r.v({fields:[]}),this.state=0,this.data=[]}readCSV(a){this.current=new r.v({fields:[]}),this.data=[this.current];const C={...this.config,dynamicTyping:!1,skipEmptyLines:!0,comments:!1,chunk:this.chunk};return s().parse(a,C),this.data}}function f(D,a){if(D==null)return"";const C=D.toString();return C.includes('"')?a.quoteChar+C.replace(/"/gi,'""')+a.quoteChar:C.includes(` `)||a.delimiter&&C.includes(a.delimiter)?a.quoteChar+C+a.quoteChar:C}function E(D,a){return D.display?C=>{const P=D.display(C);return f((0,u.zc)(P),a)}:C=>f(C,a)}function h(D,a,C){const P=D==="name",b=D==="type";for(const M of a){const T=M.config;if(P||b||T&&T.hasOwnProperty(D)){let S="#"+D+"#";for(let x=0;x<a.length;x++){x>0&&(S=S+C.delimiter);let O=a[x].name;b?O=a[x].type:P||(O=a[x].config[D]),O&&(S=S+f(O,C))}return S+C.newline}}return""}function y(){const D=["x","y"];return D.toLocaleString?D.toLocaleString().charAt(1):","}function v(D,a){if(!D)return"";a=(0,t.defaults)(a,{delimiter:y(),newline:`\r `,quoteChar:'"',encoding:"",headerStyle:1,useExcelHeader:!1});let C=a.useExcelHeader?`sep=${a.delimiter}${a.newline}`:"";for(let P=0;P<D.length;P++){const b=D[P],{fields:M}=b;if(M.length===0)continue;if(a.headerStyle===0)C=C+h("name",M,a)+h("type",M,a)+h("unit",M,a)+h("dateFormat",M,a);else if(a.headerStyle===1){for(let S=0;S<M.length;S++)S>0&&(C+=a.delimiter),C+=`"${(0,d.CZ)(M[S],b).replace(/"/g,'""')}"`;C+=a.newline}const T=M[0].values.length;if(T>0){const S=M.map(x=>E(x,a));for(let x=0;x<T;x++){for(let O=0;O<M.length;O++){O>0&&(C=C+a.delimiter);const B=M[O].values[x];B!==null&&(C=C+S[O](B))}x!==T-1&&(C=C+a.newline)}}P!==D.length-1&&(C=C+a.newline)}return C}},3569:(j,I,e)=>{"use strict";e.d(I,{W:()=>i,_:()=>s});var t=e(94469),n=e(78968);const i={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 s(l){const{onClickFn:u,replaceVariables:o,link:m,scopedVars:c,range:p,field:f,internalLink:E}=l,h=g(m.internal?.query,c,o),y=g(m.internal?.panelsState,c,o),v=m.title?m.title:E.datasourceName;return{title:o(v,c),href:r(E.datasourceUid,h,p,y),onClick:u?()=>{u({datasourceUid:E.datasourceUid,queries:[h],panelsState:y,range:p})}:void 0,target:m?.targetBlank?"_blank":"_self",origin:f}}function r(l,u,o,m){return t.u.assureBaseUrl(`/explore?left=${encodeURIComponent((0,n.S)({range:o.raw,datasource:l,queries:[u],panelsState:m}))}`)}function g(l,u,o){if(!l)return l;if(typeof l=="string")return o(l,u);const m=JSON.parse(JSON.stringify(l));return d(m,u,o)}function d(l,u,o){for(const m of Object.keys(l))typeof l[m]=="string"?l[m]=o(l[m],u):typeof l[m]=="object"&&l[m]!==null&&(l[m]=d(l[m],u,o));return l}},17312:(j,I,e)=>{"use strict";e.d(I,{BT:()=>r,HD:()=>c,Mf:()=>h,TX:()=>m,_R:()=>d,cv:()=>s,fd:()=>p,fi:()=>l,hz:()=>o,iU:()=>i,nx:()=>u,tp:()=>f,uw:()=>E,z_:()=>g});var t=e(89949),n=e.n(t);function i(y){return{uid:y.uid,type:y.type}}function s(y){return typeof y=="object"&&typeof y?.uid=="string"}function r(y){if(s(y))return y.uid;if((0,t.isString)(y))return y}const g=(y,v)=>D=>{p(y,v,D.currentTarget.value)},d=(y,v)=>D=>{f(y,v,D.currentTarget.value)},l=(y,v)=>D=>{E(y,v,D.currentTarget.value)},u=(y,v)=>D=>{f(y,v,D.value)},o=(y,v)=>D=>{f(y,v,D.currentTarget.checked)},m=(y,v)=>D=>{E(y,v,D.value)},c=(y,v)=>D=>{h(y,v)};function p(y,v,D){const a=y.options;y.onOptionsChange({...a,[v]:D})}const f=(y,v,D)=>{const a=y.options;y.onOptionsChange({...a,jsonData:{...a.jsonData,[v]:D}})},E=(y,v,D)=>{const a=y.options;y.onOptionsChange({...a,secureJsonData:{...a.secureJsonData?a.secureJsonData:{},[v]:D}})},h=(y,v)=>{const D=y.options;y.onOptionsChange({...D,secureJsonData:{...D.secureJsonData?D.secureJsonData:{},[v]:""},secureJsonFields:{...D.secureJsonFields,[v]:!1}})}},58939:(j,I,e)=>{"use strict";e.d(I,{d:()=>n});const t={},n=(i,s,r)=>{let g=`[Deprecation warning] ${i}: ${s} is deprecated`;r&&(g+=`. Use ${r} instead`);const d=Date.now(),l=t[g];(!l||d-l>1e4)&&(console.warn(g),t[g]=d)}},63699:(j,I,e)=>{"use strict";e.d(I,{x:()=>t});var t=(n=>(n[n.Transformations=0]="Transformations",n[n.FieldConfig=1]="FieldConfig",n[n.FieldConfigOverrides=2]="FieldConfigOverrides",n))(t||{})},56715:(j,I,e)=>{"use strict";e.d(I,{H:()=>i,k:()=>n});var t=e(53933);function n({xField:s,yField:r,nullValueMode:g}){const d=s.values,l=r.values,u=d.length;if(l.length!==u)throw new Error("Unexpected field length");const o=g===t.Gl.Ignore,m=g===t.Gl.AsZero,c=[];for(let p=0;p<u;p++){const f=d[p];let E=l[p];if(E===null){if(o)continue;m&&(E=0)}f!==null&&c.push([f,E])}return c}function i(s,r){if(!r.from||!r.to||!s||s.length===0)return[];const g=r.from.valueOf(),d=r.to.valueOf(),l=s[0][1];return[[g,l],[d,l]]}},91648:(j,I,e)=>{"use strict";e.d(I,{LH:()=>c.L,x5:()=>r.x5,QM:()=>r.QM,WC:()=>D.W,xV:()=>a.x,vo:()=>E.vo,HU:()=>M.HU,zG:()=>p.z,rt:()=>E.rt,Bz:()=>n.B,IX:()=>P.I,sq:()=>t,nk:()=>c.n,ZC:()=>u,bf:()=>T.b,Jb:()=>M.Jb,d9:()=>s.d,FT:()=>g.FT,IU:()=>g.IU,aA:()=>g.aA,iU:()=>i.iU,BT:()=>i.BT,k8:()=>h.k,HE:()=>h.H,_6:()=>T._,e4:()=>o,dP:()=>d.d,fp:()=>m,cv:()=>i.cv,Qr:()=>l.Q,uT:()=>y.u,s2:()=>C.s,_N:()=>D._,VS:()=>g.VS,Hh:()=>l.H,_R:()=>i._R,hz:()=>i.hz,nx:()=>i.nx,z_:()=>i.z_,HD:()=>i.HD,fi:()=>i.fi,TX:()=>i.TX,J8:()=>g.J8,uP:()=>r.uP,Wn:()=>S.W,O9:()=>d.O,S:()=>v.S,MJ:()=>r.MJ,Er:()=>f.E,tp:()=>i.tp,fd:()=>i.fd,Mf:()=>i.Mf,uw:()=>i.uw,Cj:()=>v.Cj,xc:()=>b.x});var t=e(99025),n=e(25359),i=e(17312),s=e(58939),r=e(92827),g=e(14951),d=e(27107),l=e(59421);const 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","#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"],o=x=>{let O,B,A=Number.MAX_VALUE;for(let V=0;V<x.values.length;V++){const W=x.values[V];if(O!==void 0){const w=W-O;B===void 0&&(A=w),w<A&&(A=w)}O=W}return A},m=x=>{for(let O=0;O<x.values.length;O++){const B=x.values[O];if(B!=null){const A=B.toString();if(A.length===13&&A%1e3!==0)return!0}}return!1};var c=e(32338),p=e(12503),f=e(81078),E=e(2471),h=e(56715),y=e(94469),v=e(78968),D=e(3569),a=e(63699),C=e(29403),P=e(17373),b=e(35412),M=e(6850),T=e(83505),S=e(76772)},14951:(j,I,e)=>{"use strict";e.d(I,{FT:()=>i,IU:()=>s,J8:()=>n,VS:()=>r,aA:()=>g});const t=/\b(\w+)(!?=~?)"([^"\n]*?)"/g;function n(d){const l={};return d.replace(t,(u,o,m,c)=>(l[o]=c,"")),l}function i(d){return d.reduce((l,u)=>{if(!u)throw new Error("Need parsed labels to find common labels.");return Object.keys(u).forEach(o=>{(l[o]===void 0||l[o]!==u[o])&&delete l[o]}),Object.keys(l).forEach(o=>{u[o]===void 0&&delete l[o]}),l},{...d[0]})}function s(d,l){const u={...d};return Object.keys(l).forEach(o=>{delete u[o]}),u}function r(d,l){if(!d)return!0;for(const[u,o]of Object.entries(d))if(!l||l[u]!==o)return!1;return!0}function g(d,l="",u){if(!d||Object.keys(d).length===0)return l;const m=Object.keys(d).sort().map(c=>`${c}="${d[c]}"`).join(", ");return u?m:["{",m,"}"].join("")}},94469:(j,I,e)=>{"use strict";e.d(I,{u:()=>m});var t=e(48154),n=e(78968);let i={appSubUrl:""},s,r;const g=c=>{try{return new URL(c)}catch{return}},d=c=>{const p=g(c);if(p&&p.origin!==window.location.origin)return c;const f=i.appSubUrl??"",E=f.endsWith("/")?1:0,h=c.startsWith("http");let y=f;return(!c.startsWith("/")||h)&&(y=`${window.location.origin}${f}`),c.length>0&&(c.indexOf(y+"/")===0||c===y)?c.slice(y.length-E):c},l=c=>c.startsWith("/")?`${i.appSubUrl}${d(c)}`:c,m={initialize:c=>{i=c.config,s=c.getTimeRangeForUrl,r=c.getVariablesUrlParams},stripBaseFromUrl:d,assureBaseUrl:l,updateSearchParams:(c,p)=>{const f=new URLSearchParams(p);try{const E=new URL(c);return f.forEach((h,y)=>E.searchParams.set(y,h)),E.href}catch{const E=new URLSearchParams(c);return f.forEach((h,y)=>{E.set(y,h)}),"?"+E.toString()}},getTimeRangeUrlParams:()=>s?n.Cj.toUrlParams(s()):null,getVariablesUrlParams:c=>{if(!r)return null;const p=r(c);return n.Cj.toUrlParams(p)},getUrlForPartial:(c,p)=>{const f=n.Cj.parseKeyValue(c.search.startsWith("?")?c.search.substring(1):c.search);for(const E of Object.keys(p))p[E]===null||p[E]===void 0?delete f[E]:f[E]=p[E];return l(n.Cj.renderUrl(c.pathname,f))},processUrl:c=>i.disableSanitizeHtml?c:t.QX.sanitizeUrl(c)}},29403:(j,I,e)=>{"use strict";e.d(I,{s:()=>t});function t(n){return new Proxy(n,{apply(i,s,r){return(typeof Reflect>"u"||!Reflect.construct)&&alert("Browser is too old"),Reflect.construct(i,r,s.constructor)}})}},12503:(j,I,e)=>{"use strict";e.d(I,{z:()=>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))(t||{})},27107:(j,I,e)=>{"use strict";e.d(I,{O:()=>t,d:()=>n});function t(i,s=0){if(Number.isInteger(i))return i;let r=10**s,g=i*r*(1+Number.EPSILON);return Math.round(g)/r}function n(i){return((""+i).split(".")[1]||"").length}},59421:(j,I,e)=>{"use strict";e.d(I,{H:()=>t,Q:()=>n});const t=i=>Object.keys(i).reduce((s,r)=>(i[r]!==void 0&&(s[r]=i[r]),s),{}),n=i=>typeof i=="object"&&i!==null&&Object.keys(i).length===0},81078:(j,I,e)=>{"use strict";e.d(I,{E:()=>t});const t=n=>({label:n,value:n})},78968:(j,I,e)=>{"use strict";e.d(I,{Cj:()=>l,S:()=>u});/** * @preserve jquery-param (c) 2015 KNOWLEDGECODE | MIT */function t(o,m){return m&&Object.keys(m).length>0&&(o+="?"+i(m)),o}function n(o,m){return encodeURIComponent(o).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,m?"%20":"+").replace(/[!'()*]/g,function(c){return"%"+c.charCodeAt(0).toString(16).toUpperCase()})}function i(o){const m=[],c=/\[\]$/,p=h=>Object.prototype.toString.call(h)==="[object Array]",f=(h,y)=>{if(y=typeof y=="function"?y():y===null||y===void 0?"":y,typeof y!="boolean")m[m.length]=n(h,!0)+"="+n(y,!0);else{const v=y?"":"="+n("false",!0);m[m.length]=n(h,!0)+v}},E=(h,y)=>{let v,D,a;if(h)if(p(y))for(v=0,D=y.length;v<D;v++)c.test(h)?f(h,y[v]):E(h,y[v]);else if(y&&String(y)==="[object Object]")for(a in y)E(h+"["+a+"]",y[a]);else f(h,y);else if(p(y))for(v=0,D=y.length;v<D;v++)f(y[v].name,y[v].value);else for(a in y)E(a,y[a]);return m};return E("",o).join("&")}function s(o,m){if(m!=null&&m!==""){const c=o.indexOf("?");c!==-1?o.length-c>1&&(o+="&"):o+="?",o+=m}return o}function r(){const m=window.location.search.substring(1).split("&"),c={};for(const p of m){const f=p.split("=");if(f.length>1){const E=decodeURIComponent(f[0]),h=decodeURIComponent(f[1]);E in c?c[E]=[...c[E],h]:c[E]=[h]}else if(f.length===1){const E=decodeURIComponent(f[0]);c[E]=!0}}return c}function g(o){const m={},c=(o||"").split("&");for(let p of c){let f,E,h;if(p&&(E=p=p.replace(/\+/g,"%20"),f=p.indexOf("="),f!==-1&&(E=p.substring(0,f),h=p.substring(f+1)),E=d(E),E!==void 0)){h=h!==void 0?d(h):!0;let y;typeof h=="string"&&h!==""?y=h==="true"||h==="false"?h==="true":h:y=h,m.hasOwnProperty(E)?Array.isArray(m[E])?m[E].push(h):m[E]=[m[E],isNaN(y)?h:y]:m[E]=isNaN(y)?h:y}}return m}function d(o){try{return decodeURIComponent(o)}catch{return}}const l={renderUrl:t,toUrlParams:i,appendQueryToUrl:s,getUrlSearchParams:r,parseKeyValue:g};function u(o,m){return m!==void 0&&console.warn("`compact` parameter is deprecated and will be removed in a future release"),JSON.stringify(o)}},6850:(j,I,e)=>{"use strict";e.d(I,{HU:()=>g,Jb:()=>d,vh:()=>s});var t=e(77104),n=e(95676),i=e(51046);function s(u,o){for(const m of u)switch(m.type){case i.H.ValueToText:if(o==null)continue;const c=m.options[o];if(c)return c;break;case i.H.RangeToText:if(o==null)continue;const p=parseFloat(o);if(isNaN(p)||!isNaN(m.options.from)&&p<m.options.from||!isNaN(m.options.to)&&p>m.options.to)continue;return m.options.result;case i.H.RegexToText:if(o==null||typeof o!="string")continue;const h=(0,n.jO)(m.options.pattern);if(o.match(h)){const y={...m.options.result};return y.text!=null&&(y.text=o.replace(h,m.options.result.text||"")),y}case i.H.SpecialValue:switch(m.options.match){case i.e.Null:{if(o==null)return m.options.result;break}case i.e.NaN:{if(isNaN(o))return m.options.result;break}case i.e.NullAndNaN:{if(isNaN(o)||o==null)return m.options.result;break}case i.e.True:{if(o===!0||o==="true")return m.options.result;break}case i.e.False:{if(o===!1||o==="false")return m.options.result;break}case i.e.Empty:{if(o==="")return m.options.result;break}}}return null}function r(u){return(typeof u=="number"||typeof u=="string"&&u.trim()!=="")&&!isNaN(u)}var g=(u=>(u[u.ValueToText=1]="ValueToText",u[u.RangeToText=2]="RangeToText",u))(g||{});function d(u,o){const m=[];let c=u.mappingType;if(u.mappingType||(u.valueMaps&&u.valueMaps.length?c=1:u.rangeMaps&&u.rangeMaps.length&&(c=2)),c===1)for(let p=0;p<u.valueMaps.length;p++){const f=u.valueMaps[p];m.push(l({...f,id:p,type:i.H.ValueToText},u.fieldConfig?.defaults?.thresholds||o))}else if(c===2)for(let p=0;p<u.rangeMaps.length;p++){const f=u.rangeMaps[p];m.push(l({...f,id:p,type:i.H.RangeToText},u.fieldConfig?.defaults?.thresholds||o))}return m}function l(u,o){const m={type:i.H.ValueToText,options:{}},c=[];let p;const f=parseFloat(u.text);if(o&&!isNaN(f)){const E=(0,t.m1)(f,o.steps);E&&E.color&&(p=E.color)}switch(u.type){case 1:case i.H.ValueToText:u.value!=null&&(u.value==="null"?c.push({type:i.H.SpecialValue,options:{match:i.e.Null,result:{text:u.text,color:p}}}):m.options[String(u.value)]={text:u.text,color:p});break;case 2:case i.H.RangeToText:u.from==="null"||u.to==="null"?c.push({type:i.H.SpecialValue,options:{match:i.e.Null,result:{text:u.text,color:p}}}):c.push({type:i.H.RangeToText,options:{from:+u.from,to:+u.to,result:{text:u.text,color:p}}});break}return Object.keys(m.options).length>0&&c.unshift(m),c[0]}},83505:(j,I,e)=>{"use strict";e.d(I,{_:()=>i,b:()=>n});const t="__searchFilter",n=s=>s&&typeof s=="string"?s.indexOf(t)!==-1:!1,i=s=>{const{query:r,wildcardChar:g}=s;if(!n(r))return{};let{options:d}=s;return d=d||{searchFilter:""},{__searchFilter:{value:d.searchFilter?`${d.searchFilter}${g}`:`${g}`,text:""}}}},35412:(j,I,e)=>{"use strict";e.d(I,{x:()=>r});var t=e(6857),n=e(80852),i=e(58885),s=e(24321);function r({whileLoading:g,source:d}){return(0,t.T)((0,n.H)(200).pipe((0,i.h)(g),(0,s.R)(d)),d)}},3877:(j,I,e)=>{"use strict";e.d(I,{Cf:()=>t.Cf,FH:()=>t.FH,IR:()=>t.IR,QW:()=>t.QW,Qj:()=>t.Qj,SP:()=>t.SP,SR:()=>t.SR,Td:()=>t.Td,bn:()=>t.bn,br:()=>t.br,q2:()=>t.q2,vb:()=>t.vb,zc:()=>t.zc});var t=e(21609)},51455:(j,I,e)=>{"use strict";e.d(I,{Aq:()=>n,Yh:()=>d,dT:()=>r,i7:()=>l});var t=e(21609);function n(u,o){const m=["","K","M","B","T"],c=(0,t.Qj)(1e3,m);return(p,f,E)=>{if(p==null)return{text:""};const h=p<0;h&&(p=Math.abs(p));const y=c(p,f,E);return o?y.suffix=y.suffix!==void 0?`${y.suffix}${u}`:void 0:y.prefix=u,h&&(y.prefix=`-${y.prefix?.length?y.prefix:""}`),y}}const i=["f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"],s=i.indexOf("");function r(u){const o=i.findIndex(m=>m.normalize("NFKD")===u.normalize("NFKD"));return o<0?0:o-s}const g=["","Ki","Mi","Gi","Ti","Pi","Ei","Zi","Yi"];function d(u,o=0){const m=g.map(c=>" "+c+u);return(0,t.Qj)(1024,m,o)}function l(u,o=0){const m=i.map(c=>" "+c+u);return(0,t.Qj)(1e3,m,s+o)}},21609:(j,I,e)=>{"use strict";e.d(I,{IR:()=>ge,zc:()=>Y,Cf:()=>We,QW:()=>et,Td:()=>ke,br:()=>ne,SP:()=>De,Qj:()=>re,SR:()=>he,vb:()=>ye,FH:()=>Z,bn:()=>oe,q2:()=>q});var t=e(89949);function n(we,_e){return we===null?{text:""}:{text:Z(we,_e),suffix:"%"}}function i(we,_e){return we===null?{text:""}:{text:Z(100*we,_e),suffix:"%"}}function s(we,_e){if(we==null)return{text:""};const Ge=r(we,_e);return Ge.text.substring(0,1)==="-"?Ge.text="-0x"+Ge.text.substring(1):Ge.text="0x"+Ge.text,Ge}function r(we,_e){return we==null?{text:""}:{text:parseFloat(Z(we,_e)).toString(16).toUpperCase()}}function g(we,_e){return we==null?{text:""}:{text:we.toExponential(_e??void 0)}}var d=e(60956),l=e(65347),u=e(99633),o=(we=>(we.Year="year",we.Month="month",we.Week="week",we.Day="day",we.Hour="hour",we.Minute="minute",we.Second="second",we.Millisecond="millisecond",we))(o||{});const m=["year","month","week","day","hour","minute","second","millisecond"],c={year:31536e3,month:2592e3,week:604800,day:86400,hour:3600,minute:60,second:1,millisecond:.001};function p(we,_e){return we===null?{text:""}:Math.abs(we)<1e3?{text:Z(we,_e),suffix:" ns"}:Math.abs(we)<1e6?oe(we/1e3,_e," \xB5s"):Math.abs(we)<1e9?oe(we/1e6,_e," ms"):Math.abs(we)<6e10?oe(we/1e9,_e," s"):Math.abs(we)<36e11?oe(we/6e10,_e," min"):Math.abs(we)<864e11?oe(we/36e11,_e," hour"):oe(we/864e11,_e," day")}function f(we,_e){return we===null?{text:""}:Math.abs(we)<1e3?{text:Z(we,_e),suffix:" \xB5s"}:Math.abs(we)<1e6?oe(we/1e3,_e," ms"):oe(we/1e6,_e," s")}function E(we,_e,Ge){return we===null?{text:""}:Math.abs(we)<1e3?{text:Z(we,_e),suffix:" ms"}:Math.abs(we)<6e4?oe(we/1e3,_e," s"):Math.abs(we)<36e5?oe(we/6e4,_e," min"):Math.abs(we)<864e5?oe(we/36e5,_e," hour"):Math.abs(we)<31536e6?oe(we/864e5,_e," day"):oe(we/31536e6,_e," year")}function h(we,_e){if(we!=null&&_e!==null&&_e!==void 0)return we-_e}function y(we,_e){return we===null?{text:""}:we===0?{text:"0",suffix:" s"}:Math.abs(we)<1e-6?oe(we*1e9,_e," ns"):Math.abs(we)<.001?oe(we*1e6,_e," \xB5s"):Math.abs(we)<1?oe(we*1e3,_e," ms"):Math.abs(we)<60?{text:Z(we,_e),suffix:" s"}:Math.abs(we)<3600?oe(we/60,_e," min"):Math.abs(we)<86400?oe(we/3600,_e," hour"):Math.abs(we)<604800?oe(we/86400,_e," day"):Math.abs(we)<31536e3?oe(we/604800,_e," week"):oe(we/31556900,_e," year")}function v(we,_e){return we===null?{text:""}:Math.abs(we)<60?{text:Z(we,_e),suffix:" min"}:Math.abs(we)<1440?oe(we/60,_e," hour"):Math.abs(we)<10080?oe(we/1440,_e," day"):Math.abs(we)<604800?oe(we/10080,_e," week"):oe(we/525948,_e," year")}function D(we,_e){return we===null?{text:""}:Math.abs(we)<24?{text:Z(we,_e),suffix:" hour"}:Math.abs(we)<168?oe(we/24,_e," day"):Math.abs(we)<8760?oe(we/168,_e," week"):oe(we/8760,_e," year")}function a(we,_e){return we===null?{text:""}:Math.abs(we)<7?{text:Z(we,_e),suffix:" day"}:Math.abs(we)<365?oe(we/7,_e," week"):oe(we/365,_e," year")}function C(we,_e,Ge){if(we===null)return{text:""};if(we===0)return{text:"0",suffix:" "+Ge+"s"};if(we<0){const be=C(-we,_e,Ge);return be.suffix||(be.suffix=""),be.suffix+=" ago",be}we*=c[Ge]*1e3;const qe=[];let st=!1,Me=0;_e!=null&&(Me=_e);for(let be=0;be<m.length&&Me>=0;be++){const Ke=c[m[be]]*1e3,Ye=we/Ke;if(Ye>=1||st){st=!0;const tt=Math.floor(Ye),nt=m[be]+(tt!==1?"s":"");qe.push(tt+" "+nt),we=we%Ke,Me--}}return{text:qe.join(", ")}}function P(we,_e){if(we===null)return{text:""};if(we<1e3)return{text:(0,u.zh)(we).format("SSS\\m\\s")};if(we<6e4){let Me="ss\\s:SSS\\m\\s";return _e===0&&(Me="ss\\s"),{text:(0,u.zh)(we).format(Me)}}if(we<36e5){let Me="mm\\m:ss\\s:SSS\\m\\s";return _e===0?Me="mm\\m":_e===1&&(Me="mm\\m:ss\\s"),{text:(0,u.zh)(we).format(Me)}}let Ge="mm\\m:ss\\s:SSS\\m\\s";const qe=`${("0"+Math.floor((0,u.Ks)(we,"milliseconds").asHours())).slice(-2)}h`;return _e===0?Ge="":_e===1?Ge="mm\\m":_e===2&&(Ge="mm\\m:ss\\s"),{text:Ge?`${qe}:${(0,u.zh)(we).format(Ge)}`:qe}}function b(we,_e){return C(we,_e,"millisecond")}function M(we,_e){return C(we,_e,"second")}function T(we){if(we<0){const Me=T(-we);return Me.suffix||(Me.suffix=""),Me.suffix+=" ago",Me}const _e=[],Ge=Math.floor(we/3600),qe=Math.floor(we%3600/60),st=Math.floor(we%3600%60);return Ge>9?_e.push(""+Ge):_e.push("0"+Ge),qe>9?_e.push(""+qe):_e.push("0"+qe),st>9?_e.push(""+st):_e.push("0"+st),{text:_e.join(":")}}function S(we){if(we<0){const st=S(-we);return st.suffix||(st.suffix=""),st.suffix+=" ago",st}let _e="";const Ge=Math.floor(we/(24*3600));Ge>0&&(_e=Ge+" d ");const qe=T(we-Ge*24*3600);return{text:_e+qe.text}}function x(we,_e){return y(we/100,_e)}function O(we,_e){return P(we,_e)}function B(we,_e){return P(we*1e3,_e)}function A(we,_e){return(Ge,qe,st,Me)=>_e&&(0,u.CQ)().isSame(Ge,"day")?{text:(0,d.dq)(Ge,{format:_e,timeZone:Me})}:{text:(0,d.dq)(Ge,{format:we,timeZone:Me})}}const V=A("YYYY-MM-DD HH:mm:ss"),W=A("YYYY-MM-DD HH:mm:ss","HH:mm:ss"),w=A("MM/DD/YYYY h:mm:ss a"),N=A("MM/DD/YYYY h:mm:ss a","h:mm:ss a");function F(){return A((0,l.Ji)({year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}))}function k(){return A((0,l.Ji)({year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),(0,l.Ji)({hour:"2-digit",minute:"2-digit",second:"2-digit"}))}function H(we,_e,Ge,qe,st){return{text:(0,d.dq)(we,{format:st?l.U6.fullDateMS:l.U6.fullDate,timeZone:qe})}}function R(we,_e,Ge,qe){return{text:(0,d.E8)(we,{timeZone:qe})}}var _=e(51455);const G=()=>[{name:"Misc",formats:[{name:"Number",id:"none",fn:q("")},{name:"String",id:"string",fn:ye},{name:"short",id:"short",fn:re(1e3,[""," K"," Mil"," Bil"," Tri"," Quadr"," Quint"," Sext"," Sept"])},{name:"Percent (0-100)",id:"percent",fn:n},{name:"Percent (0.0-1.0)",id:"percentunit",fn:i},{name:"Humidity (%H)",id:"humidity",fn:q("%H")},{name:"Decibel",id:"dB",fn:q("dB")},{name:"Candela (cd)",id:"candela",fn:(0,_.i7)("cd")},{name:"Hexadecimal (0x)",id:"hex0x",fn:s},{name:"Hexadecimal",id:"hex",fn:r},{name:"Scientific notation",id:"sci",fn:g},{name:"Locale format",id:"locale",fn:De},{name:"Pixels",id:"pixel",fn:q("px")}]},{name:"Acceleration",formats:[{name:"Meters/sec\xB2",id:"accMS2",fn:q("m/sec\xB2")},{name:"Feet/sec\xB2",id:"accFS2",fn:q("f/sec\xB2")},{name:"G unit",id:"accG",fn:q("g")}]},{name:"Angle",formats:[{name:"Degrees (\xB0)",id:"degree",fn:q("\xB0")},{name:"Radians",id:"radian",fn:q("rad")},{name:"Gradian",id:"grad",fn:q("grad")},{name:"Arc Minutes",id:"arcmin",fn:q("arcmin")},{name:"Arc Seconds",id:"arcsec",fn:q("arcsec")}]},{name:"Area",formats:[{name:"Square Meters (m\xB2)",id:"areaM2",fn:q("m\xB2")},{name:"Square Feet (ft\xB2)",id:"areaF2",fn:q("ft\xB2")},{name:"Square Miles (mi\xB2)",id:"areaMI2",fn:q("mi\xB2")},{name:"Acres (ac)",id:"acres",fn:q("ac")},{name:"Hectares (ha)",id:"hectares",fn:q("ha")}]},{name:"Computation",formats:[{name:"FLOP/s",id:"flops",fn:(0,_.i7)("FLOPS")},{name:"MFLOP/s",id:"mflops",fn:(0,_.i7)("FLOPS",2)},{name:"GFLOP/s",id:"gflops",fn:(0,_.i7)("FLOPS",3)},{name:"TFLOP/s",id:"tflops",fn:(0,_.i7)("FLOPS",4)},{name:"PFLOP/s",id:"pflops",fn:(0,_.i7)("FLOPS",5)},{name:"EFLOP/s",id:"eflops",fn:(0,_.i7)("FLOPS",6)},{name:"ZFLOP/s",id:"zflops",fn:(0,_.i7)("FLOPS",7)},{name:"YFLOP/s",id:"yflops",fn:(0,_.i7)("FLOPS",8)}]},{name:"Concentration",formats:[{name:"parts-per-million (ppm)",id:"ppm",fn:q("ppm")},{name:"parts-per-billion (ppb)",id:"conppb",fn:q("ppb")},{name:"nanogram per cubic meter (ng/m\xB3)",id:"conngm3",fn:q("ng/m\xB3")},{name:"nanogram per normal cubic meter (ng/Nm\xB3)",id:"conngNm3",fn:q("ng/Nm\xB3")},{name:"microgram per cubic meter (\u03BCg/m\xB3)",id:"con\u03BCgm3",fn:q("\u03BCg/m\xB3")},{name:"microgram per normal cubic meter (\u03BCg/Nm\xB3)",id:"con\u03BCgNm3",fn:q("\u03BCg/Nm\xB3")},{name:"milligram per cubic meter (mg/m\xB3)",id:"conmgm3",fn:q("mg/m\xB3")},{name:"milligram per normal cubic meter (mg/Nm\xB3)",id:"conmgNm3",fn:q("mg/Nm\xB3")},{name:"gram per cubic meter (g/m\xB3)",id:"congm3",fn:q("g/m\xB3")},{name:"gram per normal cubic meter (g/Nm\xB3)",id:"congNm3",fn:q("g/Nm\xB3")},{name:"milligrams per decilitre (mg/dL)",id:"conmgdL",fn:q("mg/dL")},{name:"millimoles per litre (mmol/L)",id:"conmmolL",fn:q("mmol/L")}]},{name:"Currency",formats:[{name:"Dollars ($)",id:"currencyUSD",fn:(0,_.Aq)("$")},{name:"Pounds (\xA3)",id:"currencyGBP",fn:(0,_.Aq)("\xA3")},{name:"Euro (\u20AC)",id:"currencyEUR",fn:(0,_.Aq)("\u20AC")},{name:"Yen (\xA5)",id:"currencyJPY",fn:(0,_.Aq)("\xA5")},{name:"Rubles (\u20BD)",id:"currencyRUB",fn:(0,_.Aq)("\u20BD")},{name:"Hryvnias (\u20B4)",id:"currencyUAH",fn:(0,_.Aq)("\u20B4")},{name:"Real (R$)",id:"currencyBRL",fn:(0,_.Aq)("R$")},{name:"Danish Krone (kr)",id:"currencyDKK",fn:(0,_.Aq)("kr",!0)},{name:"Icelandic Kr\xF3na (kr)",id:"currencyISK",fn:(0,_.Aq)("kr",!0)},{name:"Norwegian Krone (kr)",id:"currencyNOK",fn:(0,_.Aq)("kr",!0)},{name:"Swedish Krona (kr)",id:"currencySEK",fn:(0,_.Aq)("kr",!0)},{name:"Czech koruna (czk)",id:"currencyCZK",fn:(0,_.Aq)("czk")},{name:"Swiss franc (CHF)",id:"currencyCHF",fn:(0,_.Aq)("CHF")},{name:"Polish Z\u0142oty (PLN)",id:"currencyPLN",fn:(0,_.Aq)("PLN")},{name:"Bitcoin (\u0E3F)",id:"currencyBTC",fn:(0,_.Aq)("\u0E3F")},{name:"Milli Bitcoin (\u0E3F)",id:"currencymBTC",fn:(0,_.Aq)("mBTC")},{name:"Micro Bitcoin (\u0E3F)",id:"currency\u03BCBTC",fn:(0,_.Aq)("\u03BCBTC")},{name:"South African Rand (R)",id:"currencyZAR",fn:(0,_.Aq)("R")},{name:"Indian Rupee (\u20B9)",id:"currencyINR",fn:(0,_.Aq)("\u20B9")},{name:"South Korean Won (\u20A9)",id:"currencyKRW",fn:(0,_.Aq)("\u20A9")},{name:"Indonesian Rupiah (Rp)",id:"currencyIDR",fn:(0,_.Aq)("Rp")},{name:"Philippine Peso (PHP)",id:"currencyPHP",fn:(0,_.Aq)("PHP")},{name:"Vietnamese Dong (VND)",id:"currencyVND",fn:(0,_.Aq)("\u0111",!0)},{name:"Turkish Lira (\u20BA)",id:"currencyTRY",fn:(0,_.Aq)("\u20BA",!0)}]},{name:"Data",formats:[{name:"bytes(IEC)",id:"bytes",fn:(0,_.Yh)("B")},{name:"bytes(SI)",id:"decbytes",fn:(0,_.i7)("B")},{name:"bits(IEC)",id:"bits",fn:(0,_.Yh)("b")},{name:"bits(SI)",id:"decbits",fn:(0,_.i7)("b")},{name:"kibibytes",id:"kbytes",fn:(0,_.Yh)("B",1)},{name:"kilobytes",id:"deckbytes",fn:(0,_.i7)("B",1)},{name:"mebibytes",id:"mbytes",fn:(0,_.Yh)("B",2)},{name:"megabytes",id:"decmbytes",fn:(0,_.i7)("B",2)},{name:"gibibytes",id:"gbytes",fn:(0,_.Yh)("B",3)},{name:"gigabytes",id:"decgbytes",fn:(0,_.i7)("B",3)},{name:"tebibytes",id:"tbytes",fn:(0,_.Yh)("B",4)},{name:"terabytes",id:"dectbytes",fn:(0,_.i7)("B",4)},{name:"pebibytes",id:"pbytes",fn:(0,_.Yh)("B",5)},{name:"petabytes",id:"decpbytes",fn:(0,_.i7)("B",5)}]},{name:"Data rate",formats:[{name:"packets/sec",id:"pps",fn:(0,_.i7)("p/s")},{name:"bytes/sec(IEC)",id:"binBps",fn:(0,_.Yh)("B/s")},{name:"bytes/sec(SI)",id:"Bps",fn:(0,_.i7)("B/s")},{name:"bits/sec(IEC)",id:"binbps",fn:(0,_.Yh)("b/s")},{name:"bits/sec(SI)",id:"bps",fn:(0,_.i7)("b/s")},{name:"kibibytes/sec",id:"KiBs",fn:(0,_.Yh)("B/s",1)},{name:"kibibits/sec",id:"Kibits",fn:(0,_.Yh)("b/s",1)},{name:"kilobytes/sec",id:"KBs",fn:(0,_.i7)("B/s",1)},{name:"kilobits/sec",id:"Kbits",fn:(0,_.i7)("b/s",1)},{name:"mebibytes/sec",id:"MiBs",fn:(0,_.Yh)("B/s",2)},{name:"mebibits/sec",id:"Mibits",fn:(0,_.Yh)("b/s",2)},{name:"megabytes/sec",id:"MBs",fn:(0,_.i7)("B/s",2)},{name:"megabits/sec",id:"Mbits",fn:(0,_.i7)("b/s",2)},{name:"gibibytes/sec",id:"GiBs",fn:(0,_.Yh)("B/s",3)},{name:"gibibits/sec",id:"Gibits",fn:(0,_.Yh)("b/s",3)},{name:"gigabytes/sec",id:"GBs",fn:(0,_.i7)("B/s",3)},{name:"gigabits/sec",id:"Gbits",fn:(0,_.i7)("b/s",3)},{name:"tebibytes/sec",id:"TiBs",fn:(0,_.Yh)("B/s",4)},{name:"tebibits/sec",id:"Tibits",fn:(0,_.Yh)("b/s",4)},{name:"terabytes/sec",id:"TBs",fn:(0,_.i7)("B/s",4)},{name:"terabits/sec",id:"Tbits",fn:(0,_.i7)("b/s",4)},{name:"pebibytes/sec",id:"PiBs",fn:(0,_.Yh)("B/s",5)},{name:"pebibits/sec",id:"Pibits",fn:(0,_.Yh)("b/s",5)},{name:"petabytes/sec",id:"PBs",fn:(0,_.i7)("B/s",5)},{name:"petabits/sec",id:"Pbits",fn:(0,_.i7)("b/s",5)}]},{name:"Date & time",formats:[{name:"Datetime ISO",id:"dateTimeAsIso",fn:V},{name:"Datetime ISO (No date if today)",id:"dateTimeAsIsoNoDateIfToday",fn:W},{name:"Datetime US",id:"dateTimeAsUS",fn:w},{name:"Datetime US (No date if today)",id:"dateTimeAsUSNoDateIfToday",fn:N},{name:"Datetime local",id:"dateTimeAsLocal",fn:F()},{name:"Datetime local (No date if today)",id:"dateTimeAsLocalNoDateIfToday",fn:k()},{name:"Datetime default",id:"dateTimeAsSystem",fn:H},{name:"From Now",id:"dateTimeFromNow",fn:R}]},{name:"Energy",formats:[{name:"Watt (W)",id:"watt",fn:(0,_.i7)("W")},{name:"Kilowatt (kW)",id:"kwatt",fn:(0,_.i7)("W",1)},{name:"Megawatt (MW)",id:"megwatt",fn:(0,_.i7)("W",2)},{name:"Gigawatt (GW)",id:"gwatt",fn:(0,_.i7)("W",3)},{name:"Milliwatt (mW)",id:"mwatt",fn:(0,_.i7)("W",-1)},{name:"Watt per square meter (W/m\xB2)",id:"Wm2",fn:q("W/m\xB2")},{name:"Volt-Ampere (VA)",id:"voltamp",fn:(0,_.i7)("VA")},{name:"Kilovolt-Ampere (kVA)",id:"kvoltamp",fn:(0,_.i7)("VA",1)},{name:"Volt-Ampere reactive (VAr)",id:"voltampreact",fn:(0,_.i7)("VAr")},{name:"Kilovolt-Ampere reactive (kVAr)",id:"kvoltampreact",fn:(0,_.i7)("VAr",1)},{name:"Watt-hour (Wh)",id:"watth",fn:(0,_.i7)("Wh")},{name:"Watt-hour per Kilogram (Wh/kg)",id:"watthperkg",fn:(0,_.i7)("Wh/kg")},{name:"Kilowatt-hour (kWh)",id:"kwatth",fn:(0,_.i7)("Wh",1)},{name:"Kilowatt-min (kWm)",id:"kwattm",fn:(0,_.i7)("W-Min",1)},{name:"Ampere-hour (Ah)",id:"amph",fn:(0,_.i7)("Ah")},{name:"Kiloampere-hour (kAh)",id:"kamph",fn:(0,_.i7)("Ah",1)},{name:"Milliampere-hour (mAh)",id:"mamph",fn:(0,_.i7)("Ah",-1)},{name:"Joule (J)",id:"joule",fn:(0,_.i7)("J")},{name:"Electron volt (eV)",id:"ev",fn:(0,_.i7)("eV")},{name:"Ampere (A)",id:"amp",fn:(0,_.i7)("A")},{name:"Kiloampere (kA)",id:"kamp",fn:(0,_.i7)("A",1)},{name:"Milliampere (mA)",id:"mamp",fn:(0,_.i7)("A",-1)},{name:"Volt (V)",id:"volt",fn:(0,_.i7)("V")},{name:"Kilovolt (kV)",id:"kvolt",fn:(0,_.i7)("V",1)},{name:"Millivolt (mV)",id:"mvolt",fn:(0,_.i7)("V",-1)},{name:"Decibel-milliwatt (dBm)",id:"dBm",fn:(0,_.i7)("dBm")},{name:"Milliohm (m\u03A9)",id:"mohm",fn:(0,_.i7)("\u03A9",-1)},{name:"Ohm (\u03A9)",id:"ohm",fn:(0,_.i7)("\u03A9")},{name:"Kiloohm (k\u03A9)",id:"kohm",fn:(0,_.i7)("\u03A9",1)},{name:"Megaohm (M\u03A9)",id:"Mohm",fn:(0,_.i7)("\u03A9",2)},{name:"Farad (F)",id:"farad",fn:(0,_.i7)("F")},{name:"Microfarad (\xB5F)",id:"\xB5farad",fn:(0,_.i7)("F",-2)},{name:"Nanofarad (nF)",id:"nfarad",fn:(0,_.i7)("F",-3)},{name:"Picofarad (pF)",id:"pfarad",fn:(0,_.i7)("F",-4)},{name:"Femtofarad (fF)",id:"ffarad",fn:(0,_.i7)("F",-5)},{name:"Henry (H)",id:"henry",fn:(0,_.i7)("H")},{name:"Millihenry (mH)",id:"mhenry",fn:(0,_.i7)("H",-1)},{name:"Microhenry (\xB5H)",id:"\xB5henry",fn:(0,_.i7)("H",-2)},{name:"Lumens (Lm)",id:"lumens",fn:(0,_.i7)("Lm")}]},{name:"Flow",formats:[{name:"Gallons/min (gpm)",id:"flowgpm",fn:q("gpm")},{name:"Cubic meters/sec (cms)",id:"flowcms",fn:q("cms")},{name:"Cubic feet/sec (cfs)",id:"flowcfs",fn:q("cfs")},{name:"Cubic feet/min (cfm)",id:"flowcfm",fn:q("cfm")},{name:"Litre/hour",id:"litreh",fn:q("L/h")},{name:"Litre/min (L/min)",id:"flowlpm",fn:q("L/min")},{name:"milliLitre/min (mL/min)",id:"flowmlpm",fn:q("mL/min")},{name:"Lux (lx)",id:"lux",fn:q("lux")}]},{name:"Force",formats:[{name:"Newton-meters (Nm)",id:"forceNm",fn:(0,_.i7)("Nm")},{name:"Kilonewton-meters (kNm)",id:"forcekNm",fn:(0,_.i7)("Nm",1)},{name:"Newtons (N)",id:"forceN",fn:(0,_.i7)("N")},{name:"Kilonewtons (kN)",id:"forcekN",fn:(0,_.i7)("N",1)}]},{name:"Hash rate",formats:[{name:"hashes/sec",id:"Hs",fn:(0,_.i7)("H/s")},{name:"kilohashes/sec",id:"KHs",fn:(0,_.i7)("H/s",1)},{name:"megahashes/sec",id:"MHs",fn:(0,_.i7)("H/s",2)},{name:"gigahashes/sec",id:"GHs",fn:(0,_.i7)("H/s",3)},{name:"terahashes/sec",id:"THs",fn:(0,_.i7)("H/s",4)},{name:"petahashes/sec",id:"PHs",fn:(0,_.i7)("H/s",5)},{name:"exahashes/sec",id:"EHs",fn:(0,_.i7)("H/s",6)}]},{name:"Mass",formats:[{name:"milligram (mg)",id:"massmg",fn:(0,_.i7)("g",-1)},{name:"gram (g)",id:"massg",fn:(0,_.i7)("g")},{name:"pound (lb)",id:"masslb",fn:q("lb")},{name:"kilogram (kg)",id:"masskg",fn:(0,_.i7)("g",1)},{name:"metric ton (t)",id:"masst",fn:q("t")}]},{name:"Length",formats:[{name:"millimeter (mm)",id:"lengthmm",fn:(0,_.i7)("m",-1)},{name:"inch (in)",id:"lengthin",fn:q("in")},{name:"feet (ft)",id:"lengthft",fn:q("ft")},{name:"meter (m)",id:"lengthm",fn:(0,_.i7)("m")},{name:"kilometer (km)",id:"lengthkm",fn:(0,_.i7)("m",1)},{name:"mile (mi)",id:"lengthmi",fn:q("mi")}]},{name:"Pressure",formats:[{name:"Millibars",id:"pressurembar",fn:(0,_.i7)("bar",-1)},{name:"Bars",id:"pressurebar",fn:(0,_.i7)("bar")},{name:"Kilobars",id:"pressurekbar",fn:(0,_.i7)("bar",1)},{name:"Pascals",id:"pressurepa",fn:(0,_.i7)("Pa")},{name:"Hectopascals",id:"pressurehpa",fn:q("hPa")},{name:"Kilopascals",id:"pressurekpa",fn:q("kPa")},{name:"Inches of mercury",id:"pressurehg",fn:q('"Hg')},{name:"PSI",id:"pressurepsi",fn:re(1e3,["psi","ksi","Mpsi"])}]},{name:"Radiation",formats:[{name:"Becquerel (Bq)",id:"radbq",fn:(0,_.i7)("Bq")},{name:"curie (Ci)",id:"radci",fn:(0,_.i7)("Ci")},{name:"Gray (Gy)",id:"radgy",fn:(0,_.i7)("Gy")},{name:"rad",id:"radrad",fn:(0,_.i7)("rad")},{name:"Sievert (Sv)",id:"radsv",fn:(0,_.i7)("Sv")},{name:"milliSievert (mSv)",id:"radmsv",fn:(0,_.i7)("Sv",-1)},{name:"microSievert (\xB5Sv)",id:"radusv",fn:(0,_.i7)("Sv",-2)},{name:"rem",id:"radrem",fn:(0,_.i7)("rem")},{name:"Exposure (C/kg)",id:"radexpckg",fn:(0,_.i7)("C/kg")},{name:"roentgen (R)",id:"radr",fn:(0,_.i7)("R")},{name:"Sievert/hour (Sv/h)",id:"radsvh",fn:(0,_.i7)("Sv/h")},{name:"milliSievert/hour (mSv/h)",id:"radmsvh",fn:(0,_.i7)("Sv/h",-1)},{name:"microSievert/hour (\xB5Sv/h)",id:"radusvh",fn:(0,_.i7)("Sv/h",-2)}]},{name:"Rotational Speed",formats:[{name:"Revolutions per minute (rpm)",id:"rotrpm",fn:q("rpm")},{name:"Hertz (Hz)",id:"rothz",fn:(0,_.i7)("Hz")},{name:"Kilohertz (kHz)",id:"rotkhz",fn:(0,_.i7)("Hz",1)},{name:"Megahertz (MHz)",id:"rotmhz",fn:(0,_.i7)("Hz",2)},{name:"Gigahertz (GHz)",id:"rotghz",fn:(0,_.i7)("Hz",3)},{name:"Radians per second (rad/s)",id:"rotrads",fn:q("rad/s")},{name:"Degrees per second (\xB0/s)",id:"rotdegs",fn:q("\xB0/s")}]},{name:"Temperature",formats:[{name:"Celsius (\xB0C)",id:"celsius",fn:q("\xB0C")},{name:"Fahrenheit (\xB0F)",id:"fahrenheit",fn:q("\xB0F")},{name:"Kelvin (K)",id:"kelvin",fn:q("K")}]},{name:"Time",formats:[{name:"Hertz (1/s)",id:"hertz",fn:(0,_.i7)("Hz")},{name:"nanoseconds (ns)",id:"ns",fn:p},{name:"microseconds (\xB5s)",id:"\xB5s",fn:f},{name:"milliseconds (ms)",id:"ms",fn:E},{name:"seconds (s)",id:"s",fn:y},{name:"minutes (m)",id:"m",fn:v},{name:"hours (h)",id:"h",fn:D},{name:"days (d)",id:"d",fn:a},{name:"duration (ms)",id:"dtdurationms",fn:b},{name:"duration (s)",id:"dtdurations",fn:M},{name:"duration (hh:mm:ss)",id:"dthms",fn:T},{name:"duration (d hh:mm:ss)",id:"dtdhms",fn:S},{name:"Timeticks (s/100)",id:"timeticks",fn:x},{name:"clock (ms)",id:"clockms",fn:O},{name:"clock (s)",id:"clocks",fn:B}]},{name:"Throughput",formats:[{name:"counts/sec (cps)",id:"cps",fn:he("c/s")},{name:"ops/sec (ops)",id:"ops",fn:he("ops/s")},{name:"requests/sec (rps)",id:"reqps",fn:he("req/s")},{name:"reads/sec (rps)",id:"rps",fn:he("rd/s")},{name:"writes/sec (wps)",id:"wps",fn:he("wr/s")},{name:"I/O ops/sec (iops)",id:"iops",fn:he("io/s")},{name:"events/sec (eps)",id:"eps",fn:he("evt/s")},{name:"messages/sec (mps)",id:"mps",fn:he("msg/s")},{name:"records/sec (rps)",id:"recps",fn:he("rec/s")},{name:"rows/sec (rps)",id:"rowsps",fn:he("rows/s")},{name:"counts/min (cpm)",id:"cpm",fn:he("c/m")},{name:"ops/min (opm)",id:"opm",fn:he("ops/m")},{name:"requests/min (rpm)",id:"reqpm",fn:he("req/m")},{name:"reads/min (rpm)",id:"rpm",fn:he("rd/m")},{name:"writes/min (wpm)",id:"wpm",fn:he("wr/m")},{name:"events/min (epm)",id:"epm",fn:he("evts/m")},{name:"messages/min (mpm)",id:"mpm",fn:he("msgs/m")},{name:"records/min (rpm)",id:"recpm",fn:he("rec/m")},{name:"rows/min (rpm)",id:"rowspm",fn:he("rows/m")}]},{name:"Velocity",formats:[{name:"meters/second (m/s)",id:"velocityms",fn:q("m/s")},{name:"kilometers/hour (km/h)",id:"velocitykmh",fn:q("km/h")},{name:"miles/hour (mph)",id:"velocitymph",fn:q("mph")},{name:"knot (kn)",id:"velocityknot",fn:q("kn")}]},{name:"Volume",formats:[{name:"millilitre (mL)",id:"mlitre",fn:(0,_.i7)("L",-1)},{name:"litre (L)",id:"litre",fn:(0,_.i7)("L")},{name:"cubic meter",id:"m3",fn:q("m\xB3")},{name:"Normal cubic meter",id:"Nm3",fn:q("Nm\xB3")},{name:"cubic decimeter",id:"dm3",fn:q("dm\xB3")},{name:"gallons",id:"gallons",fn:q("gal")}]},{name:"Boolean",formats:[{name:"True / False",id:"bool",fn:ge("True","False")},{name:"Yes / No",id:"bool_yes_no",fn:ge("Yes","No")},{name:"On / Off",id:"bool_on_off",fn:ge("On","Off")}]}];function Y(we){return`${we.prefix??""}${we.text}${we.suffix??""}`}let X=[];const Q={};let se=!1;function Z(we,_e){if(we===null)return"";if(we===Number.NEGATIVE_INFINITY||we===Number.POSITIVE_INFINITY)return we.toLocaleString();if(_e==null&&(_e=le(we)),we===0)return we.toFixed(_e);const Ge=_e?Math.pow(10,Math.max(0,_e)):1,qe=String(Math.round(we*Ge)/Ge);if(qe.indexOf("e")!==-1||we===0)return qe;const st=qe.indexOf("."),Me=st===-1?0:qe.length-st-1;return Me<_e?(Me?qe:qe+".")+String(Ge).slice(1,_e-Me+1):qe}function le(we){const _e=Math.abs(we);let qe=-Math.floor(Math.log(_e)/Math.LN10)+1;const st=Math.pow(10,-qe);return _e/st>2.25&&++qe,we%1===0&&(qe=0),Math.max(0,qe)}function oe(we,_e,Ge){return{text:Z(we,_e),suffix:Ge}}function q(we,_e){return(Ge,qe)=>{if(Ge===null)return{text:""};const st=Z(Ge,qe);return we?_e?{text:st,prefix:we}:{text:st,suffix:" "+we}:{text:st}}}function ne(we){return we&&we.startsWith("bool")}function ge(we,_e){return Ge=>({text:Ge?we:_e})}const ae=(we,_e)=>Math.log10(_e)/Math.log10(we);function re(we,_e,Ge=0){return(qe,st)=>{if(qe==null)return{text:""};if(qe===Number.NEGATIVE_INFINITY||qe===Number.POSITIVE_INFINITY||isNaN(qe))return{text:qe.toLocaleString()};const Me=qe===0?0:Math.floor(ae(we,Math.abs(qe))),be=_e[(0,t.clamp)(Ge+Me,0,_e.length-1)];return{text:Z(qe/we**(0,t.clamp)(Me,-Ge,_e.length-Ge-1),st),suffix:be}}}function De(we,_e){return we==null?{text:""}:{text:we.toLocaleString(void 0,{maximumFractionDigits:_e??void 0})}}function he(we){const Ge=re(1e3,["","K","M","B","T"]);return(qe,st,Me)=>{if(qe===null)return{text:""};const be=Ge(qe,st,Me);return be.suffix+=" "+we,be}}function ye(we){return{text:`${we}`}}function ce(){X=G();for(const we of X)for(const _e of we.formats)Q[_e.id]=_e.fn;[{from:"farenheit",to:"fahrenheit"}].forEach(we=>{const _e=Q[we.to];_e&&(Q[we.from]=_e)}),se=!0}function We(we){if(!we)return q("");se||ce();const _e=Q[we];if(!_e&&we){let Ge=we.indexOf(":");if(Ge>0){const qe=we.substring(0,Ge),st=we.substring(Ge+1);if(qe==="prefix")return q(st,!0);if(qe==="suffix")return q(st,!1);if(qe==="time")return A(st);if(qe==="si"){const Me=(0,_.dT)(st.charAt(0)),be=Me===0?st:st.substring(1);return(0,_.i7)(be,Me)}if(qe==="count")return he(st);if(qe==="currency")return(0,_.Aq)(st);if(qe==="bool"){if(Ge=st.indexOf("/"),Ge>=0){const Me=st.substring(0,Ge),be=st.substring(Ge+1);return ge(Me,be)}return ge(st,"-")}}return q(we)}return _e}function ke(){return se||ce(),Q}function et(){return se||ce(),X.map(we=>({text:we.name,submenu:we.formats.map(_e=>({text:_e.name,value:_e.id}))}))}},21066:(j,I,e)=>{"use strict";e.d(I,{G:()=>t});class t extends Array{get buffer(){return this}set buffer(i){this.length=0;const s=i?.length;if(s){let r=65e3,g=Math.ceil(s/r);for(let d=0;d<g;d++)this.push.apply(this,i.slice(d*r,(d+1)*r))}}constructor(i){super(),this.buffer=i??[]}toJSON(){return[...this]}}},64282:(j,I,e)=>{"use strict";e.d(I,{d:()=>i});var t=e(79866),n=e(36829);class i extends n.G{constructor(r){return super(),this.buffer=r.buffer||[],this.capacity=this.buffer.length,this.tail=r.append!=="head",this.index=0,this.add=this.getAddFunction(),r.capacity&&this.setCapacity(r.capacity),(0,t.U)(this)}getAddFunction(){return this.capacity>this.buffer.length?this.tail?r=>{this.buffer.push(r),this.buffer.length>=this.capacity&&(this.add=this.getAddFunction())}:r=>{this.buffer.unshift(r),this.buffer.length>=this.capacity&&(this.add=this.getAddFunction())}:this.tail?r=>{this.buffer[this.index]=r,this.index=(this.index+1)%this.buffer.length}:r=>{let g=this.index-1;g<0&&(g=this.buffer.length-1),this.buffer[g]=r,this.index=g}}setCapacity(r){if(this.capacity===r)return;const g=this.toArray();if(r>this.length)this.buffer=g;else if(r<this.capacity){const d=this.length-r;this.tail?this.buffer=g.slice(d,g.length):this.buffer=g.slice(0,g.length-d)}this.capacity=r,this.index=0,this.add=this.getAddFunction()}setAppendMode(r){const g=r!=="head";g!==this.tail&&(this.buffer=this.toArray().reverse(),this.index=0,this.tail=g,this.add=this.getAddFunction())}reverse(){return this.buffer.reverse()}get(r){return this.buffer[(r+this.index)%this.buffer.length]}set(r,g){this.buffer[(r+this.index)%this.buffer.length]=g}get length(){return this.buffer.length}}},36829:(j,I,e)=>{"use strict";e.d(I,{G:()=>n,s:()=>s});var t=e(58704);class n{*iterator(){for(let g=0;g<this.length;g++)yield this.get(g)}set(g,d){throw"unsupported operation"}add(g){throw"unsupported operation"}push(...g){for(const d of g)this.add(d);return this.length}[Symbol.iterator](){return this.iterator()}forEach(g){return s(this).forEach(g)}map(g){return s(this).map(g)}filter(g){return s(this).filter(g)}at(g){return this.get(g)}toArray(){return(0,t.n)(this)}join(g){return this.toArray().join(g)}toJSON(){return this.toArray()}pop(){throw new Error("Method not implemented.")}concat(...g){throw new Error("Method not implemented.")}reverse(){throw new Error("Method not implemented.")}shift(){throw new Error("Method not implemented.")}sort(g){throw new Error("Method not implemented.")}splice(g,d,...l){throw new Error("Method not implemented.")}unshift(...g){throw new Error("Method not implemented.")}fill(g,d,l){throw new Error("Method not implemented.")}copyWithin(g,d,l){throw new Error("Method not implemented.")}[Symbol.unscopables](){throw new Error("Method not implemented.")}slice(g,d){return this.toArray().slice(g,d)}indexOf(g,d){return this.toArray().indexOf(g,d)}lastIndexOf(g,d){return this.toArray().lastIndexOf(g,d)}every(g,d){return this.toArray().every(g,d)}some(g,d){return this.toArray().some(g,d)}reduce(g,d){throw new Error("Method not implemented.")}reduceRight(g,d){throw new Error("Method not implemented.")}find(g,d){return this.toArray().find(g,d)}findIndex(g,d){return this.toArray().findIndex(g,d)}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.toArray().values()}includes(g,d){return this.toArray().includes(g,d)}flatMap(g,d){return this.toArray().flatMap(g,d)}flat(g){throw new Error("Method not implemented.")}}const i=[];function s(r){return{*[Symbol.iterator](){for(let g=0;g<r.length;g++)yield r.get(g)},forEach(g){for(let d=0;d<r.length;d++)g(r.get(d),d,i)},map(g){const d=[];for(let l=0;l<r.length;l++)d.push(g(r.get(l),l,i));return d},filter(g){const d=[];let l=0;for(const u of this)g(u,l++,i)&&d.push(u);return d}}}},93882:(j,I,e)=>{"use strict";e.d(I,{o:()=>s});var t=e(79866),n=e(36829),i=e(58704);class s extends n.G{constructor(g,d){return super(),this.source=g,this.order=d,(0,t.U)(this)}get length(){return this.source.length}get(g){return this.source.get(this.order[g])}toArray(){return(0,i.n)(this)}toJSON(){return(0,i.n)(this)}getOrderArray(){return this.order}}},91382:(j,I,e)=>{"use strict";e.d(I,{l$:()=>s,Gt:()=>r.G,sq:()=>f,rM:()=>l,dV:()=>g.d,uI:()=>d,$Y:()=>m,rm:()=>p,oH:()=>u.o,sD:()=>n.s});var t=e(79866),n=e(36829),i=e(58704);class s extends n.G{constructor(h=0){return super(),this.length=0,this.source=[],this.length=h,(0,t.U)(this)}setLength(h){if(h>this.length)this.length=h;else if(h<this.length){const y=[];for(const v of this.source)if(y.push(v),v.end>h){v.end=h;break}this.source=y,this.length=h}}append(h){const y={start:this.length,end:this.length+h.length,values:h};return this.length=y.end,this.source.push(y),y}get(h){for(let y=0;y<this.source.length;y++){const v=this.source[y];if(h>=v.start&&h<v.end)return v.values[h-v.start]}}toArray(){return(0,i.n)(this)}toJSON(){return(0,i.n)(this)}}var r=e(21066),g=e(64282);class d extends Array{constructor(h,y){return super(),new Array(y).fill(h)}}class l extends Array{constructor(h,y,v){super();const D=new Array(h.length);for(let a=0;a<D.length;a++)D[a]=v(h[a],y[a]);return D}}var u=e(93882),o=e(21609);class m extends Array{constructor(h,y){return super(),h.map(v=>(0,o.zc)(y(v)))}}var c=e(29241);class p extends Array{constructor(h){super();const y=new Array(h);for(let v=0;v<h;v++)y[v]=v;return y}static newField(h){return{name:"",values:new p(h),type:c.fS.number,config:{min:0,max:h-1}}}}class f extends Array{constructor(h){return super(),h.map(y=>+y)}}},58704:(j,I,e)=>{"use strict";e.d(I,{n:()=>t});function t(n){const i=Array(n.length);for(let s=0;s<n.length;s++)i[s]=n.get(s);return i}},9175:(j,I,e)=>{"use strict";e.d(I,{Si:()=>n,ct:()=>t,fV:()=>i,mR:()=>s});var t=(r=>(r.DashboardView="dashboard-view",r.DataRequest="data-request",r))(t||{});const n=r=>!!r.payload.page,i=r=>!!r.payload.interactionName,s=r=>!!r.payload.experimentId},86312:(j,I,e)=>{"use strict";e.d(I,{SZ:()=>d,ff:()=>g,r_:()=>s,sm:()=>r});var t=e(34667),n=e(26129),i=e(77948);const s=l=>{(0,i.RP)().addEvent({type:i.ee.MetaAnalytics,payload:l})},r=()=>{const l=n.E1.getLocation(),u=`${t.config.appSubUrl??""}${l.pathname}${l.search}${l.hash}`;(0,i.RP)().addEvent({type:i.ee.Pageview,payload:{page:u}})},g=(l,u)=>{(0,i.RP)().addEvent({type:i.ee.Interaction,payload:{interactionName:l,properties:u}})},d=(l,u,o)=>{(0,i.RP)().addEvent({type:i.ee.ExperimentView,payload:{experimentId:l,experimentGroup:u,experimentVariant:o}})}},94372:(j,I,e)=>{"use strict";e.d(I,{q:()=>o});var t=e(27702),n=e(17312),i=e(81538),s=e(74639),r=e(28580),g=e(64022),d=e(97918),l=e(10864),u=e(42751);class o extends t.PureComponent{constructor(c){super(c),this.dataSourceSrv=(0,l.F)(),this.state={},this.onChange=(p,f)=>{if(f.action==="clear"&&this.props.onClear){this.props.onClear();return}const E=this.dataSourceSrv.getInstanceSettings(p.value);E&&(this.props.onChange(E),this.setState({error:void 0}))}}componentDidMount(){const{current:c}=this.props;this.dataSourceSrv.getInstanceSettings(c)||this.setState({error:"Could not find data source "+c})}getCurrentValue(){const{current:c,hideTextValue:p,noDefault:f}=this.props;if(!c&&f)return;const E=this.dataSourceSrv.getInstanceSettings(c);if(E)return{label:E.name.slice(0,37),value:E.uid,imgUrl:E.meta.info.logos.small,hideText:p,meta:E.meta};const h=(0,n.BT)(c);return h===u.hr.uid||h===u.hr.name?{label:h,value:h,hideText:p}:{label:(h??"no name")+" - not found",value:h??void 0,imgUrl:"",hideText:p}}getDataSourceOptions(){const{alerting:c,tracing:p,metrics:f,mixed:E,dashboard:h,variables:y,annotations:v,pluginId:D,type:a,filter:C,logs:P}=this.props;return this.dataSourceSrv.getList({alerting:c,tracing:p,metrics:f,logs:P,dashboard:h,mixed:E,variables:y,annotations:v,pluginId:D,filter:C,type:a}).map(M=>({value:M.name,label:`${M.name}${M.isDefault?" (default)":""}`,imgUrl:M.meta.info.logos.small,meta:M.meta}))}render(){const{autoFocus:c,onBlur:p,onClear:f,openMenuOnFocus:E,placeholder:h,width:y,inputId:v,disabled:D=!1,isLoading:a=!1}=this.props,{error:C}=this.state,P=this.getDataSourceOptions(),b=this.getCurrentValue(),M=typeof f=="function";return t.createElement("div",{"aria-label":"Data source picker select container","data-testid":s.wl.components.DataSourcePicker.container},t.createElement(r.Ph,{isLoading:a,disabled:D,"aria-label":"Select a data source","data-testid":s.wl.components.DataSourcePicker.inputV2,inputId:v||"data-source-picker",className:"ds-picker select-container",isMulti:!1,isClearable:M,backspaceRemovesValue:!1,onChange:this.onChange,options:P,autoFocus:c,onBlur:p,width:y,openMenuOnFocus:E,maxMenuHeight:500,placeholder:h,noOptionsMessage:"No datasources found",value:b??null,invalid:!!C||!!this.props.invalid,getOptionLabel:T=>T.meta&&(0,i.x)(T.meta.signature)&&T!==b?t.createElement(g.Lh,{align:"center",justify:"space-between",height:"auto"},t.createElement("span",null,T.label)," ",t.createElement(d.o,{status:T.meta.signature})):T.label||""}))}}o.defaultProps={autoFocus:!1,openMenuOnFocus:!1,placeholder:"Select data source"}},72566:(j,I,e)=>{"use strict";e.d(I,{$:()=>i,Z:()=>n});var t=e(27702);let n=({message:s})=>t.createElement("div",null,"Unable to render data: ",s,".");function i(s){n=s}},22323:(j,I,e)=>{"use strict";e.d(I,{$:()=>n,L:()=>i});var t=e(27702);let n=()=>t.createElement("div",null,"PanelRenderer can only be used after Grafana instance has been started.");function i(s){n=s}},1695:(j,I,e)=>{"use strict";e.d(I,{T:()=>n,t:()=>i});var t=e(27702);let n=({children:s})=>t.createElement("div",null,s);function i(s){n=s}},34667:(j,I,e)=>{"use strict";e.d(I,{O:()=>r,config:()=>o});var t=e(89949),n=e.n(t),i=e(65347),s=e(11391);class r{constructor(c){this.snapshotEnabled=!0,this.datasources={},this.panels={},this.apps={},this.auth={},this.minRefreshInterval="",this.appUrl="",this.appSubUrl="",this.windowTitlePrefix="",this.newPanelTitle="",this.externalUserMngLinkUrl="",this.externalUserMngLinkName="",this.externalUserMngInfo="",this.allowOrgCreate=!1,this.feedbackLinksEnabled=!0,this.disableLoginForm=!1,this.defaultDatasource="",this.alertingEnabled=!1,this.alertingErrorOrTimeout="",this.alertingNoDataOrNullValues="",this.alertingMinInterval=1,this.angularSupportEnabled=!1,this.authProxyEnabled=!1,this.exploreEnabled=!1,this.queryHistoryEnabled=!1,this.helpEnabled=!1,this.profileEnabled=!1,this.newsFeedEnabled=!0,this.ldapEnabled=!1,this.jwtHeaderName="",this.jwtUrlLogin=!1,this.sigV4AuthEnabled=!1,this.azureAuthEnabled=!1,this.secureSocksDSProxyEnabled=!1,this.samlEnabled=!1,this.samlName="",this.autoAssignOrg=!0,this.verifyEmailEnabled=!1,this.oauth={},this.rbacEnabled=!0,this.disableUserSignUp=!1,this.loginHint="",this.passwordHint="",this.loginError=void 0,this.viewersCanEdit=!1,this.editorsCanAdmin=!1,this.disableSanitizeHtml=!1,this.trustedTypesDefaultPolicyEnabled=!1,this.cspReportOnlyEnabled=!1,this.liveEnabled=!0,this.featureToggles={},this.anonymousEnabled=!1,this.licenseInfo={},this.rendererAvailable=!1,this.dashboardPreviews={systemRequirements:{met:!1,requiredImageRendererPluginVersion:""},thumbnailsExist:!1},this.rendererVersion="",this.secretsManagerPluginEnabled=!1,this.supportBundlesEnabled=!1,this.http2Enabled=!1,this.grafanaJavascriptAgent={enabled:!1,customEndpoint:"",apiKey:"",errorInstrumentalizationEnabled:!0,consoleInstrumentalizationEnabled:!1,webVitalsInstrumentalizationEnabled:!1},this.pluginCatalogURL="https://grafana.com/grafana/plugins/",this.pluginAdminEnabled=!0,this.pluginAdminExternalManageEnabled=!1,this.pluginCatalogHiddenPlugins=[],this.pluginsCDNBaseURL="",this.expressionsEnabled=!1,this.awsAllowedAuthProviders=[],this.awsAssumeRoleEnabled=!1,this.azure={managedIdentityEnabled:!1,workloadIdentityEnabled:!1,userIdentityEnabled:!1},this.caching={enabled:!1},this.unifiedAlertingEnabled=!1,this.unifiedAlerting={minInterval:"",alertStateHistoryBackend:void 0,alertStateHistoryPrimary:void 0},this.recordedQueries={enabled:!0},this.featureHighlights={enabled:!1},this.reporting={enabled:!0},this.googleAnalytics4SendManualPageViews=!1,this.sqlConnectionLimits={maxOpenConns:100,maxIdleConns:100,connMaxLifetime:14400},this.disableFrontendSandboxForPlugins=[],this.bootData=c.bootData,this.isPublicDashboardView=c.bootData.settings.isPublicDashboardView;const p={datasources:{},windowTitlePrefix:"Grafana - ",panels:{},newPanelTitle:"Panel Title",playlist_timespan:"1m",unsaved_changes_warning:!0,appUrl:"",appSubUrl:"",buildInfo:{version:"1.0",commit:"1",env:"production"},viewersCanEdit:!1,editorsCanAdmin:!1,disableSanitizeHtml:!1};(0,t.merge)(this,p,c),this.buildInfo=c.buildInfo||p.buildInfo,this.dateFormats&&i.U6.update(this.dateFormats),this.buildInfo.env==="development"&&d(this),g(this),this.featureToggles.disableAngular&&(this.angularSupportEnabled=!1),this.theme2=(0,s.j)(this.bootData.user.theme),this.bootData.user.lightTheme=this.theme2.isLight,this.theme=this.theme2.v1}}function g(m){const c=m.featureToggles,p="grafana.featureToggles",f=window.localStorage.getItem(p);if(f){const E=f.split(",");for(const h of E){const[y,v]=h.split("="),D=v==="true"||v==="1";c[y]=D,console.log(`Setting feature toggle ${y} = ${D} via localstorage`)}}}function d(m){if(window.location.href.indexOf("__feature")===-1)return;new URLSearchParams(window.location.search).forEach((p,f)=>{if(f.startsWith("__feature.")){const E=m.featureToggles,h=f.substring(10),y=p==="true"||p==="";y!==E[f]&&(E[h]=y,console.log(`Setting feature toggle ${h} = ${y} via url`))}})}const l=window.grafanaBootData||{settings:{},user:{},navTree:[]},u=l.settings;u.bootData=l;const o=new r(u)},80549:(j,I,e)=>{"use strict";e.r(I),e.d(I,{CopyPanelEvent:()=>o.EK,DataSourcePicker:()=>S.q,DataSourceWithBackend:()=>D.CK,EchoEventType:()=>r.ee,FakeEchoSrv:()=>r.rX,GrafanaBootConfig:()=>p.O,HealthCheckError:()=>D.ZA,HealthStatus:()=>D.QO,HistoryWrapper:()=>u._i,MetaAnalyticsEventName:()=>f.ct,PanelDataErrorView:()=>P.Z,PanelRenderer:()=>C.$,PluginPage:()=>T.T,RefreshEvent:()=>o.U5,StreamingFrameAction:()=>l.T0,SystemJS:()=>E.i3,ThemeChangedEvent:()=>o.hD,TimeRangeUpdatedEvent:()=>o.md,config:()=>p.config,createDataSourcePluginEventProperties:()=>O,createPluginEventProperties:()=>x,createQueryRunner:()=>M.AQ,featureEnabled:()=>y.v,frameToMetricFindValue:()=>a.S9,getAngularLoader:()=>n.w,getAppEvents:()=>o.N$,getBackendSrv:()=>t.i,getDataSourceSrv:()=>i.F,getEchoSrv:()=>r.RP,getGrafanaLiveSrv:()=>l.gj,getLegacyAngularInjector:()=>d.V,getLocationSrv:()=>s.w,getPluginComponentExtensions:()=>m.QK,getPluginExtensions:()=>m.I4,getPluginImportUtils:()=>E.bP,getPluginLinkExtensions:()=>m.dj,getRunRequest:()=>M.Pl,getTemplateSrv:()=>g.J,isExperimentViewEvent:()=>f.mR,isFetchError:()=>t.kW,isInteractionEvent:()=>f.fV,isPageviewEvent:()=>f.Si,isPluginExtensionComponent:()=>c.M,isPluginExtensionLink:()=>c.c,loadPluginCss:()=>E.iS,locationSearchToObject:()=>u.Ox,locationService:()=>u.E1,logDebug:()=>v.o7,logError:()=>v.H,logInfo:()=>v.PN,logWarning:()=>v.KE,navigationLogger:()=>u.GQ,registerEchoBackend:()=>r.e6,reportExperimentView:()=>h.SZ,reportInteraction:()=>h.ff,reportMetaAnalytics:()=>h.r_,reportPageview:()=>h.sm,setAngularLoader:()=>n.W,setAppEvents:()=>o.Xw,setBackendSrv:()=>t.jW,setDataSourceSrv:()=>i.w,setEchoSrv:()=>r.tz,setGrafanaLiveSrv:()=>l.cA,setLegacyAngularInjector:()=>d.t,setLocationService:()=>u.ZG,setLocationSrv:()=>s.x,setPluginExtensionGetter:()=>m.oI,setPluginImportUtils:()=>E.Qf,setQueryRunnerFactory:()=>M.pD,setRunRequest:()=>M.Iw,setTemplateSrv:()=>g.l,toDataQueryError:()=>b.P,toDataQueryResponse:()=>a.z1,usePluginInteractionReporter:()=>w});var t=e(73289),n=e(9772),i=e(10864),s=e(27380),r=e(77948),g=e(39317),d=e(32416),l=e(43685),u=e(26129),o=e(32713),m=e(82123),c=e(62724),p=e(34667),f=e(9175),E=e(97073),h=e(86312),y=e(80978),v=e(91106),D=e(42751),a=e(35306),C=e(22323),P=e(72566),b=e(40545),M=e(89633),T=e(1695),S=e(94372);function x(F){return{grafana_version:p.config.buildInfo.version,plugin_type:String(F.type),plugin_version:F.info.version,plugin_id:F.id,plugin_name:F.name}}function O(F){return{...x(F.meta),datasource_uid:F.uid}}var B=e(27702),A=e(93752),V=e(58971);const W="grafana_plugin_";function w(){const F=(0,A.g)();return(0,B.useMemo)(()=>{const k=(0,V.v)(F)?O(F.instanceSettings):x(F.meta);return(H,R)=>{if(!N(H))throw new Error(`Interactions reported in plugins should start with: "${W}".`);return(0,h.ff)(H,{...R,...k})}},[F])}function N(F){return F.startsWith(W)&&F.length>W.length}},9772:(j,I,e)=>{"use strict";e.d(I,{W:()=>n,w:()=>i});let t;function n(s){t=s}function i(){return t}},77948:(j,I,e)=>{"use strict";e.d(I,{RP:()=>s,e6:()=>r,ee:()=>t,rX:()=>g,tz:()=>i});var t=(d=>(d.Performance="performance",d.MetaAnalytics="meta-analytics",d.Pageview="pageview",d.Interaction="interaction",d.ExperimentView="experimentview",d.GrafanaJavascriptAgent="grafana-javascript-agent",d))(t||{});let n;function i(d){if(n instanceof g)for(const l of n.buffer)d.addEvent(l.event,l.meta);n=d}function s(){return n||(n=new g),n}const r=d=>{s().addBackend(d)};class g{constructor(){this.buffer=[]}flush(){this.buffer=[]}addBackend(l){}addEvent(l,u){this.buffer.push({event:l,meta:u})}}},26129:(j,I,e)=>{"use strict";e.d(I,{E1:()=>u,GQ:()=>c,Ox:()=>l,ZG:()=>o,_i:()=>d});var t=e(10075),n=e(78968),i=e(58939),s=e(12343),r=e(46414),g=e(34667);class d{constructor(f){this.history=f||t.lX({basename:g.config.appSubUrl??"/"}),this.partial=this.partial.bind(this),this.push=this.push.bind(this),this.replace=this.replace.bind(this),this.getSearch=this.getSearch.bind(this),this.getHistory=this.getHistory.bind(this),this.getLocation=this.getLocation.bind(this)}getHistory(){return this.history}getSearch(){return new URLSearchParams(this.history.location.search)}partial(f,E){const h=this.history.location,y=this.getSearchObject();for(const D of Object.keys(f))f[D]===null||f[D]===void 0?delete y[D]:y[D]=f[D];const v=n.Cj.renderUrl(h.pathname,y);E?this.history.replace(v,this.history.location.state):this.history.push(v,this.history.location.state)}push(f){this.history.push(f)}replace(f){this.history.replace(f)}reload(){const f=this.history.location.state?.routeReloadCounter;this.history.replace({...this.history.location,state:{routeReloadCounter:f?f+1:1}})}getLocation(){return this.history.location}getSearchObject(){return l(this.history.location.search)}update(f){if((0,i.d)("LocationSrv","update","partial, push or replace"),f.partial&&f.query)this.partial(f.query,f.partial);else{const E={pathname:f.path};f.query&&(E.search=n.Cj.toUrlParams(f.query)),f.replace?this.replace(E):this.push(E)}}}function l(p){let f=typeof p=="number"?String(p):p;return f.length>0?f.startsWith("?")?n.Cj.parseKeyValue(f.substring(1)):n.Cj.parseKeyValue(f):{}}let u=new d;const o=p=>{throw new Error("locationService can be only overriden in test environment")},m=(0,s.h)("Router"),c=m.logger;(0,r.x)("location",u,m)},27380:(j,I,e)=>{"use strict";e.d(I,{w:()=>i,x:()=>n});let t;function n(s){t=s}function i(){return t}},89633:(j,I,e)=>{"use strict";e.d(I,{AQ:()=>i,Iw:()=>r,Pl:()=>g,pD:()=>n});let t;const n=d=>{if(t)throw new Error("Runner should only be set when Grafana is starting.");t=d},i=()=>{if(!t)throw new Error("`createQueryRunner` can only be used after Grafana instance has started.");return t()};let s;function r(d){if(s)throw new Error("runRequest function should only be set once, when Grafana is starting.");s=d}function g(){if(!s)throw new Error("getRunRequest can only be used after Grafana instance has started.");return s}},32713:(j,I,e)=>{"use strict";e.d(I,{EK:()=>r,N$:()=>l,U5:()=>n,Xw:()=>d,hD:()=>i,md:()=>s});var t=e(96509);class n extends t.m{}n.type="refresh";class i extends t.R{}i.type="theme-changed";class s extends t.R{}s.type="time-range-updated";class r extends t.R{}r.type="copy-panel";let g;function d(u){g=u}function l(){return g}},73289:(j,I,e)=>{"use strict";e.d(I,{i:()=>s,jW:()=>i,kW:()=>t});function t(r){return typeof r=="object"&&r!==null&&"status"in r&&"data"in r}let n;const i=r=>{n=r},s=()=>n},10864:(j,I,e)=>{"use strict";e.d(I,{F:()=>i,w:()=>n});let t;function n(s){t=s}function i(){return t}},32416:(j,I,e)=>{"use strict";e.d(I,{V:()=>i,t:()=>n});let t;const n=s=>{t=s},i=()=>t},43685:(j,I,e)=>{"use strict";e.d(I,{T0:()=>t.T0,cA:()=>i,gj:()=>s});var t=e(47838);let n;const i=r=>{n=r},s=()=>n},82123:(j,I,e)=>{"use strict";e.d(I,{I4:()=>r,QK:()=>d,dj:()=>g,oI:()=>i});var t=e(62724);let n;function i(l){if(n)throw new Error("setPluginExtensionGetter() function should only be called once, when Grafana is starting.");n=l}function s(){if(!n)throw new Error("getPluginExtensionGetter() can only be used after the Grafana instance has started.");return n}const r=l=>s()(l),g=l=>{const{extensions:u}=r(l);return{extensions:u.filter(t.c)}},d=l=>{const{extensions:u}=r(l);return{extensions:u.filter(t.M)}}},62724:(j,I,e)=>{"use strict";e.d(I,{M:()=>i,c:()=>n});var t=e(15766);function n(s){return s?s.type===t.D.link&&("path"in s||"onClick"in s):!1}function i(s){return s?s.type===t.D.component&&"component"in s:!1}},39317:(j,I,e)=>{"use strict";e.d(I,{J:()=>i,l:()=>n});let t;const n=s=>{t=s},i=()=>t},42751:(j,I,e)=>{"use strict";e.d(I,{B9:()=>b,CK:()=>P,PI:()=>M,Pr:()=>v,QO:()=>a,ZA:()=>D,hr:()=>y});var t=e(45383),n=e(78209),i=e(6857),s=e(90996),r=e(56469),g=e(68246),d=e(17312),l=e(81087),u=e(66784),o=e(29403),m=e(34667),c=e(10864),p=e(43685),f=e(73289),E=e(47838),h=e(35306);const y=Object.freeze({type:"__expr__",uid:"__expr__",name:"Expression"});function v(T){if(!T)return!1;const S=typeof T=="string"?T:T.type;return S===y.type||S===y.name||S==="-100"}class D extends Error{constructor(S,x){super(S),this.details=x,this.name="HealthCheckError"}}var a=(T=>(T.Unknown="UNKNOWN",T.OK="OK",T.Error="ERROR",T))(a||{}),C=(T=>(T.PluginID="X-Plugin-Id",T.DatasourceUID="X-Datasource-Uid",T.DashboardUID="X-Dashboard-Uid",T.PanelID="X-Panel-Id",T.QueryGroupID="X-Query-Group-Id",T.FromExpression="X-Grafana-From-Expr",T))(C||{});class P extends g.MF{constructor(S){super(S),this.streamOptionsProvider=M}query(S){const{intervalMs:x,maxDataPoints:O,queryCachingTTL:B,range:A,requestId:V,hideFromInspector:W=!1}=S;let w=S.targets;this.filterQuery&&(w=w.filter(Y=>this.filterQuery(Y)));let N=!1;const F=new Set,k=new Set,H=w.map(Y=>{let X=this.getRef(),Q=this.id,se=!0;if(v(Y.datasource))return N=!0,{...Y,datasource:y};if(Y.datasource){const Z=(0,c.F)().getInstanceSettings(Y.datasource,S.scopedVars);if(!Z)throw new Error(`Unknown Datasource: ${JSON.stringify(Y.datasource)}`);const le=Z.rawRef??(0,d.iU)(Z),oe=Z.id;(le.uid!==X.uid||Q!==oe)&&(X=le,Q=oe,se=!1)}return X.type?.length&&F.add(X.type),X.uid?.length&&k.add(X.uid),{...se?this.applyTemplateVariables(Y,S.scopedVars):Y,datasource:X,datasourceId:Q,intervalMs:x,maxDataPoints:O,queryCachingTTL:B}});if(!H.length)return(0,t.of)({data:[]});const R={queries:H};if(A&&(R.from=A.from.valueOf().toString(),R.to=A.to.valueOf().toString()),m.config.featureToggles.queryOverLive)return(0,p.gj)().getQueryData({request:S,body:R});const _={};_["X-Plugin-Id"]=Array.from(F).join(", "),_["X-Datasource-Uid"]=Array.from(k).join(", ");let G="/api/ds/query?ds_type="+this.type;return N&&(_["X-Grafana-From-Expr"]="true",G+="&expression=true"),V&&(G+=`&requestId=${V}`),S.dashboardUID&&(_["X-Dashboard-Uid"]=S.dashboardUID),S.panelId&&(_["X-Panel-Id"]=`${S.panelId}`),S.queryGroupId&&(_["X-Query-Group-Id"]=`${S.queryGroupId}`),(0,f.i)().fetch({url:G,method:"POST",data:R,requestId:V,hideFromInspector:W,headers:_}).pipe((0,s.w)(Y=>{const X=(0,h.z1)(Y,H);return X.data?.length&&X.data.find(Q=>Q.meta?.channel)?b(X,S,this.streamOptionsProvider):(0,t.of)(X)}),(0,r.K)(Y=>(0,t.of)((0,h.z1)(Y))))}getRequestHeaders(){const S={};return S["X-Plugin-Id"]=this.type,S["X-Datasource-Uid"]=this.uid,S}interpolateVariablesInQueries(S,x){return S.map(O=>this.applyTemplateVariables(O,x))}applyTemplateVariables(S,x){return S}async getResource(S,x,O){const B=this.getRequestHeaders();return(await(0,n.n)((0,f.i)().fetch({...O,method:"GET",headers:O?.headers?{...O.headers,...B}:B,params:x??O?.params,url:`/api/datasources/uid/${this.uid}/resources/${S}`}))).data}async postResource(S,x,O){const B=this.getRequestHeaders();return(await(0,n.n)((0,f.i)().fetch({...O,method:"POST",headers:O?.headers?{...O.headers,...B}:B,data:x??{...x},url:`/api/datasources/uid/${this.uid}/resources/${S}`}))).data}async callHealthCheck(){return(0,n.n)((0,f.i)().fetch({method:"GET",url:`/api/datasources/uid/${this.uid}/health`,showErrorAlert:!1,headers:this.getRequestHeaders()})).then(S=>S.data).catch(S=>S.data)}async testDatasource(){return this.callHealthCheck().then(S=>S.status==="OK"?{status:"success",message:S.message}:Promise.reject({status:"error",message:S.message,error:new D(S.message,S.details)}))}}function b(T,S,x){const O=(0,p.gj)();if(!O)return(0,t.of)(T);const B=[],A=[];for(const V of T.data){const W=(0,l.H7)(V.meta?.channel);if(W){const w=V;A.push(O.getDataStream({addr:W,buffer:x(S,w),frame:(0,u.Y)(V)}))}else B.push(V)}return B.length&&A.push((0,t.of)({...T,data:B})),A.length===1?A[0]:(0,i.T)(...A)}const M=(T,S)=>{const x={maxLength:T.maxDataPoints??500,action:E.T0.Append};return T.rangeRaw?.to==="now"&&(x.maxDelta=T.range.to.valueOf()-T.range.from.valueOf()),x};P=(0,o.s)(P)},80978:(j,I,e)=>{"use strict";e.d(I,{v:()=>n});var t=e(34667);const n=i=>{const{enabledFeatures:s}=t.config.licenseInfo;return s&&s[i]}},91106:(j,I,e)=>{"use strict";e.d(I,{H:()=>d,KE:()=>r,PN:()=>s,o7:()=>g});var t=e(75308),n=e(91712),i=e(34667);function s(l,u){i.config.grafanaJavascriptAgent.enabled&&t.s.api.pushLog([l],{level:n.in.INFO,context:u})}function r(l,u){i.config.grafanaJavascriptAgent.enabled&&t.s.api.pushLog([l],{level:n.in.WARN,context:u})}function g(l,u){i.config.grafanaJavascriptAgent.enabled&&t.s.api.pushLog([l],{level:n.in.DEBUG,context:u})}function d(l,u){i.config.grafanaJavascriptAgent.enabled&&t.s.api.pushError(l)}},97073:(j,I,e)=>{"use strict";e.d(I,{Qf:()=>d,bP:()=>l,i3:()=>s,iS:()=>r});var t=e(34105),n=e.n(t),i=e(34667);const s=n();function r(u){const o=i.config.bootData.user.lightTheme?u.light:u.dark;return s.import(`${o}!css`)}let g;function d(u){if(g)throw new Error("pluginImportUtils should only be set once, when Grafana is starting.");g=u}function l(){if(!g)throw new Error("pluginImportUtils can only be used after Grafana instance has started.");return g}},35306:(j,I,e)=>{"use strict";e.d(I,{S9:()=>m,z1:()=>d});var t=e(53933),n=e(66784),i=e(32053),s=e(29241),r=e(40545);const g={severity:"info",text:"Cached response"};function d(c,p){const f={data:[],state:t.Gu.Done},E="traceId"in c?c.traceId:void 0;if(E!=null&&(f.traceIds=[E]),c.data?.results){const h=c.data.results,y=p?.length?p.map(a=>a.refId):Object.keys(h),v=l(c),D=[];for(const a of y){const C=h[a];C&&(C.refId=a,D.push(C))}for(const a of D){if(a.error){const C={refId:a.refId,message:a.error,status:a.status};E!=null&&(C.traceId=E),f.error||(f.error={...C}),f.errors?f.errors.push({...C}):f.errors=[{...C}],f.state=t.Gu.Error}if(a.frames?.length){for(let C of a.frames){v&&(C=u(C));const P=(0,n.vP)(C);P.refId||(P.refId=a.refId),f.data.push(P)}continue}if(a.series?.length)for(const C of a.series)C.refId||(C.refId=a.refId),f.data.push((0,i.g0)(C));if(a.tables?.length)for(const C of a.tables)C.refId||(C.refId=a.refId),f.data.push((0,i.g0)(C))}}return c.status&&c.status!==200&&(f.state!==t.Gu.Error&&(f.state=t.Gu.Error),f.error||(f.error=(0,r.P)(c))),f}function l(c){const p=c?.headers;return!p||!p.get?!1:p.get("X-Cache")==="HIT"}function u(c){return{...c,schema:{...c.schema,fields:[...c.schema?.fields??[]],meta:{...c.schema?.meta,notices:[...c.schema?.meta?.notices??[],g],isCachedResponse:!0}}}}function o(c){const p=d(c);if(p.error?.data?.message)return{status:"error",message:p.error.data.message,details:p.error?.data?.error?{message:p.error.data.error}:void 0};if(p.error?.refId&&p.error?.message)return{status:"error",message:p.error.message};throw c}function m(c){if(!c||!c.length)return[];const p=[];let f=c.fields.find(E=>E.type===s.fS.string);if(f||(f=c.fields.find(E=>E.type!==s.fS.time)),f)for(let E=0;E<f.values.length;E++)p.push({text:""+f.values[E]});return p}},63439:(j,I,e)=>{"use strict";e.d(I,{b:()=>l});var t=e(42844),n=e(27702),i=e(71685),s=e(74639),r=e(66310),g=e(66670),d=e(73453);const l=n.forwardRef(({title:m,onRemove:c,children:p,buttonContent:f,elevated:E,bottomSpacing:h,topSpacing:y,className:v,severity:D="error",...a},C)=>{const P=(0,r.l4)(),M=o(P,D,!!m,E,h,y),T={error:"alert",warning:"alert",info:"status",success:"status"},S=a.role||T[D],x=a["aria-label"]||m;return n.createElement("div",{ref:C,className:(0,t.cx)(M.alert,v),"data-testid":s.wl.components.Alert.alertV2(D),role:S,"aria-label":x,...a},n.createElement("div",{className:M.icon},n.createElement(d.J,{size:"xl",name:u(D)})),n.createElement("div",{className:M.body},n.createElement("div",{className:M.title},m),p&&n.createElement("div",{className:M.content},p)),c&&!f&&n.createElement("div",{className:M.close},n.createElement(g.zx,{"aria-label":"Close alert",icon:"times",onClick:c,type:"button",fill:"text",variant:"secondary"})),c&&f&&n.createElement("div",{className:M.buttonWrapper},n.createElement(g.zx,{"aria-label":"Close alert",variant:"secondary",onClick:c,type:"button"},f)))});l.displayName="Alert";const u=m=>{switch(m){case"error":return"exclamation-circle";case"warning":return"exclamation-triangle";case"info":return"info-circle";case"success":return"check"}},o=(m,c,p,f,E,h)=>{const y=m.colors[c],v=m.shape.borderRadius(),D=(0,i.Z)(y.border).setAlpha(.2).toString();return{alert:(0,t.css)({label:"alert",flexGrow:1,position:"relative",borderRadius:v,display:"flex",flexDirection:"row",alignItems:"stretch",background:y.transparent,boxShadow:f?m.shadows.z3:"none",padding:m.spacing(1,2),border:`1px solid ${D}`,marginBottom:m.spacing(E??2),marginTop:m.spacing(h??0),"&:before":{content:'""',position:"absolute",top:0,left:0,bottom:0,right:0,background:m.colors.background.primary,zIndex:-1}}),icon:(0,t.css)({padding:m.spacing(1,2,0,0),color:y.text,display:"flex"}),title:(0,t.css)({fontWeight:m.typography.fontWeightMedium}),body:(0,t.css)({padding:m.spacing(1,0),flexGrow:1,display:"flex",flexDirection:"column",justifyContent:"center",overflowWrap:"break-word",wordBreak:"break-word"}),content:(0,t.css)({paddingTop:p?m.spacing(.5):0,maxHeight:"50vh",overflowY:"auto"}),buttonWrapper:(0,t.css)({marginLeft:m.spacing(1),display:"flex",alignItems:"center",alignSelf:"center"}),close:(0,t.css)({position:"relative",color:m.colors.text.secondary,background:"none",display:"flex",top:"-6px",right:"-14px"})}}},32170:(j,I,e)=>{"use strict";e.d(I,{h:()=>p});var t=e(42844),n=e(89949),i=e(27702),s=e(66310),r=e(22209),g=e(28676);const d=i.memo(()=>{const E=(0,s.wW)(l);return i.createElement("div",{className:E.ellipsis},i.createElement("span",{className:E.firstDot},"."),i.createElement("span",{className:E.secondDot},"."),i.createElement("span",{className:E.thirdDot},"."))});d.displayName="EllipsisAnimated";const l=()=>({ellipsis:(0,t.css)({display:"inline"}),firstDot:(0,t.css)({animation:`${u} 2s linear infinite`}),secondDot:(0,t.css)({animation:`${o} 2s linear infinite`}),thirdDot:(0,t.css)({animation:`${m} 2s linear infinite`})}),u=(0,t.keyframes)` 0% { opacity: 1; } 65% { opacity: 1; } 66% { opacity: 0.5; } 100% { opacity: 0; } `,o=(0,t.keyframes)` 0% { opacity: 0; } 21% { opacity: 0.5; } 22% { opacity: 1; } 65% { opacity: 1; } 66% { opacity: 0.5; } 100% { opacity: 0; } `,m=(0,t.keyframes)` 0% { opacity: 0; } 43% { opacity: 0.5; } 44% { opacity: 1; } 65% { opacity: 1; } 66% { opacity: 0.5; } 100% { opacity: 0; } `,c=2*1e3;function p(E){const{invalid:h,loading:y,onFinishChange:v,saveErrorMessage:D="Error saving this value",error:a,children:C,disabled:P,...b}=E,[M,T]=i.useState({isLoading:!1,showSuccess:!1,showError:h}),S=(0,i.useRef)(null);i.useEffect(()=>{let V;if(M.showSuccess){const W=M.showError?0:c;V=setTimeout(()=>{T({...M,showSuccess:!1})},W)}return()=>{window.clearTimeout(V)}},[M]);const x=(0,i.useCallback)(V=>{h||(T({...M,isLoading:!0,showSuccess:!1}),v(V).then(()=>{T({isLoading:!1,showSuccess:!0,showError:!1})}).catch(()=>{T({...M,isLoading:!1,showError:!0})}))},[h,M,v]),O=(0,i.useMemo)(()=>(0,n.debounce)(x,600,{leading:!1}),[x]),B=h||M.showError||void 0,A=(0,s.wW)(f);return i.createElement(i.Fragment,null,i.createElement(r.g,{...b,loading:y||void 0,invalid:B,disabled:P,error:a||M.showError&&D,ref:S,className:A.widthFitContent},i.cloneElement(C(V=>{O(V)}))),M.isLoading&&i.createElement(g.K,{referenceElement:S.current,placement:"right",alternativePlacement:"bottom"},"Saving ",i.createElement(d,null)),M.showSuccess&&i.createElement(g.K,{suffixIcon:"check",referenceElement:S.current,placement:"right",alternativePlacement:"bottom"},"Saved!"))}p.displayName="AutoSaveField";const f=()=>({widthFitContent:(0,t.css)({width:"fit-content"})})},25357:(j,I,e)=>{"use strict";e.d(I,{C:()=>d});var t=e(42844),n=e(27702),i=e(71685),s=e(66310),r=e(73453),g=e(80011);const d=n.memo(({icon:u,color:o,text:m,tooltip:c,className:p,...f})=>{const E=(0,s.wW)((0,n.useCallback)(y=>l(y,o),[o])),h=n.createElement("div",{className:(0,t.cx)(E.wrapper,p),...f},u&&n.createElement(r.J,{name:u,size:"sm"}),m);return c?n.createElement(g.u,{content:c,placement:"auto"},h):h});d.displayName="Badge";const l=(u,o)=>{let m=u.visualization.getColorByName(o),c="",p="",f="";return u.isDark?(p=(0,i.Z)(m).setAlpha(.15).toString(),c=(0,i.Z)(m).darken(30).toString(),f=(0,i.Z)(m).lighten(15).toString()):(p=(0,i.Z)(m).setAlpha(.15).toString(),c=(0,i.Z)(m).lighten(20).toString(),f=(0,i.Z)(m).darken(20).toString()),{wrapper:(0,t.css)({display:"inline-flex",padding:"1px 4px",borderRadius:u.shape.radius.default,background:p,border:`1px solid ${c}`,color:f,fontWeight:u.typography.fontWeightRegular,gap:"2px",fontSize:u.typography.bodySmall.fontSize,lineHeight:u.typography.bodySmall.lineHeight,alignItems:"center"})}}},24919:(j,I,e)=>{"use strict";e.d(I,{xf:()=>C});var t=e(42844),n=e(27702),i=e(71685),s=e(34239),r=e(90482),g=e(5168),d=e(21609),l=e(93666),u=e(58192),o=e(74639),m=e(64167),c=e(11724),p=e(66670),f=e(70944);const E=18,h=50,y=150,v=1.5,D=1,a=10;class C extends n.PureComponent{render(){const{onClick:w,className:N,theme:F}=this.props,{title:k}=this.props.value,H=M(this.props);return w?n.createElement("button",{type:"button",style:H.wrapper,onClick:w,className:(0,t.cx)((0,p.gN)(F),N)},n.createElement("div",{style:H.title},k),this.renderBarAndValue()):n.createElement("div",{style:H.wrapper,className:N},k&&n.createElement("div",{style:H.title},k),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:N,valueDisplayMode:F}=this.props,k=O(this.props);return n.createElement("div",{style:k.wrapper},F!==m.M8.Hidden&&n.createElement(f.W,{"data-testid":o.wl.components.Panels.Visualization.BarGauge.valueV2,value:w,style:k.value}),N&&n.createElement("div",{style:k.emptyBar}),n.createElement("div",{style:k.bar}))}renderRetroBars(){const{display:w,field:N,value:F,itemSpacing:k,alignmentFactors:H,orientation:R,lcdCellWidth:_,text:G,valueDisplayMode:Y,theme:X}=this.props,{valueHeight:Q,valueWidth:se,maxBarHeight:Z,maxBarWidth:le,wrapperWidth:oe,wrapperHeight:q}=T(this.props),ne=N.min??s.Hx,ge=N.max??s.Z3,ae=P(R),re=ge-ne,De=ae?Z:le,he=k,ye=Math.floor(De/_),ce=Math.floor((De-he*ye)/ye),We=A(this.props),et=V(H||F,We,se,Q,R,G),we={width:`${oe}px`,height:`${q}px`,display:"flex"};ae?(we.flexDirection="column-reverse",we.alignItems="center"):(we.flexDirection="row",we.alignItems="center",et.justifyContent="flex-end");const _e=[];for(let Ge=0;Ge<ye;Ge++){const qe=ne+re/ye*Ge,st=S(qe,F,w),Me={borderRadius:X.shape.radius.default};st.isLit?Me.backgroundImage=`radial-gradient(${st.background} 10%, ${st.backgroundShade})`:Me.backgroundColor=st.background,ae?(Me.height=`${ce}px`,Me.width=`${le}px`,Me.marginTop=`${he}px`):(Me.width=`${ce}px`,Me.height=`${Z}px`,Me.marginRight=`${he}px`),_e.push(n.createElement("div",{key:Ge.toString(),style:Me}))}return n.createElement("div",{style:we},_e,Y!==m.M8.Hidden&&n.createElement(f.W,{"data-testid":o.wl.components.Panels.Visualization.BarGauge.valueV2,value:F,style:et}))}}C.defaultProps={lcdCellWidth:12,value:{text:"100",numeric:100},displayMode:m.QH.Gradient,orientation:r.wm.Horizontal,field:{min:0,max:100,thresholds:{mode:g.H.Absolute,steps:[]}},itemSpacing:8,showUnfilled:!0};function P(W){return W===r.wm.Vertical}function b(W){const{height:w,width:N,alignmentFactors:F,orientation:k,text:H}=W,R=F?F.title:W.value.title;if(!R)return{fontSize:0,width:0,height:0,placement:"above"};if(P(k)){const se=H?.titleSize??14;return{fontSize:se,width:N,height:se*v,placement:"below"}}if(w>40){if(H?.titleSize)return{fontSize:H?.titleSize,width:0,height:H.titleSize*v,placement:"above"};const Z=Math.max(Math.min(w*.45,h),17);return{fontSize:Z/v,width:0,height:Z,placement:"above"}}const Y=Math.max(w*.6,E)/v,X=(0,c.X1)(R,Y),Q=Math.min(X.width+15,N*.4);return{fontSize:H?.titleSize??Y,height:0,width:Q,placement:"left"}}function M(W){const w={display:"flex",overflow:"hidden",width:"100%"},N=b(W),F={fontSize:`${N.fontSize}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%",alignItems:"center",alignSelf:"center"};return P(W.orientation)?(w.flexDirection="column-reverse",F.textAlign="center"):N.placement==="above"?w.flexDirection="column":(w.flexDirection="row",F.width=`${N.width}px`,F.textAlign="right",F.paddingRight="10px"),{wrapper:w,title:F}}function T(W){const{height:w,width:N,orientation:F,text:k,alignmentFactors:H,valueDisplayMode:R}=W,_=b(W),G=H??W.value,Y=(0,d.zc)(G);let X=0,Q=0,se=0,Z=0,le=0,oe=0;const q=k?.valueSize??Math.max(_.fontSize,12),ge=(0,c.X1)(Y,q).width+a*2;return P(F)?(k?.valueSize?se=k.valueSize*D:se=Math.min(Math.max(w*.1,E),h),Z=N,R===m.M8.Hidden&&(se=0,Z=0),X=w-(_.height+se),Q=N,le=N,oe=w-_.height):(R===m.M8.Hidden?(se=0,Z=0):(se=w-_.height,Z=Math.max(Math.min(N*.2,y),ge)),X=w-_.height,Q=N-Z-_.width,_.placement==="above"?(le=N,oe=w-_.height):(le=N-_.width,oe=w)),{valueWidth:Z,valueHeight:se,maxBarWidth:Q,maxBarHeight:X,wrapperHeight:oe,wrapperWidth:le}}function S(W,w,N){if(W===null)return{background:l.R,border:l.R};const F=N?N(W).color:null;return F?w===null||isNaN(w.numeric)||W!==null&&W>w.numeric?{background:(0,i.Z)(F).setAlpha(.18).toRgbString(),border:"transparent",isLit:!1}:{background:(0,i.Z)(F).setAlpha(.95).toRgbString(),backgroundShade:(0,i.Z)(F).setAlpha(.55).toRgbString(),border:(0,i.Z)(F).setAlpha(.9).toRgbString(),isLit:!0}:{background:l.R,border:l.R}}function x(W,w,N){const F=Math.min((W-w)/(N-w),1);return isNaN(F)?0:F}function O(W){const{displayMode:w,field:N,value:F,alignmentFactors:k,orientation:H,theme:R,text:_}=W,{valueWidth:G,valueHeight:Y,maxBarHeight:X,maxBarWidth:Q}=T(W),se=N.min??s.Hx,Z=N.max??s.Z3,le=x(F.numeric,se,Z),oe=A(W),q=F.color??l.R,ge=V(k||F,oe,G,Y,H,_),ae=w==="basic",re={display:"flex",flexGrow:1},De={borderRadius:R.shape.radius.default,position:"relative",zIndex:1},he={background:R.colors.background.secondary,flexGrow:1,display:"flex",borderRadius:R.shape.radius.default,position:"relative"};if(P(H)){const ye=Math.max(le*X,1);re.flexDirection="column",re.justifyContent="flex-end",De.transition="height 1s",De.height=`${ye}px`,De.width=`${Q}px`,he.bottom="-3px",he.width=`${G}px`,ae?(De.background=`${(0,i.Z)(q).setAlpha(.35).toRgbString()}`,De.borderTop=`2px solid ${q}`):De.background=B(W,X)}else{const ye=Math.max(le*Q,1);re.flexDirection="row-reverse",re.justifyContent="flex-end",re.alignItems="stretch",De.transition="width 1s",De.height=`${X}px`,De.width=`${ye}px`,he.left="-3px",he.height=`${Y}px`,ae?(De.background=`${(0,i.Z)(q).setAlpha(.35).toRgbString()}`,De.borderRight=`2px solid ${q}`):De.background=B(W,Q)}return{wrapper:re,bar:De,value:ge,emptyBar:he}}function B(W,w){const{field:N,value:F,orientation:k,theme:H}=W,R=P(k)?"0deg":"90deg",_=N.min,G=N.max;let Y="",X=0,Q=(0,u.QY)(N.color?.mode);if(Q.id===l.S.Thresholds){const se=N.thresholds;for(let Z=0;Z<se.steps.length;Z++){const le=se.steps[Z],oe=W.theme.visualization.getColorByName(le.color),q=se.mode===g.H.Percentage?le.value/100:x(le.value,_,G),ne=q*w,ge=Math.round(ne-(ne-X)/2),ae=se.mode===g.H.Percentage?_+(G-_)*q:le.value;if(Y==="")Y=`linear-gradient(${R}, ${oe}, ${oe}`;else{if(F.numeric<ae)break;X=ne,Y+=` ${ge}px, ${oe}`}}return Y+")"}if(Q.isContinuous&&Q.getColors){const se=Q.getColors(H);for(let Z=0;Z<se.length;Z++){const le=se[Z];if(Y==="")Y=`linear-gradient(${R}, ${le} 0px`;else{const q=Z/(se.length-1)*w;Y+=`, ${le} ${q}px`}}return Y+")"}return F.color??l.R}function A(W){if(W.valueDisplayMode==="text")return W.theme.colors.text.primary;const{value:w}=W;return w.color?w.color:l.R}function V(W,w,N,F,k,H){const R={color:w,height:`${F}px`,width:`${N}px`,display:"flex",alignItems:"center",lineHeight:D};let _=N;const G=(0,d.zc)(W);return P(k)?(R.fontSize=H?.valueSize??(0,c.MX)(G,_,F,D),R.justifyContent="center"):(R.fontSize=H?.valueSize??(0,c.MX)(G,_-a*2,F,D),R.justifyContent="flex-end",R.paddingLeft=`${a}px`,R.paddingRight=`${a}px`,_-=a),R}},50323:(j,I,e)=>{"use strict";e.d(I,{w6:()=>O,pc:()=>M,IG:()=>T,ap:()=>S,jG:()=>x});var t=e(42844),n=e(27702),i=e(66670),s=e(70944),r=e(71685),g=e(90482),d=e(29241),l=e(21609),u=e(64167),o=e(5354),m=e(11724),c=e(61398);const p=1.2,f=30,E=500;class h{constructor(A){this.props=A;const{width:V,height:W,value:w,text:N}=A;this.valueColor=w.color??"gray",this.panelPadding=W>100?12:8,this.textValues=b(A),this.justifyCenter=P(A.justifyMode,this.textValues.title),this.valueToAlignTo=this.textValues.valueToAlignTo,this.titleToAlignTo=this.textValues.titleToAlignTo,this.titleFontSize=0,this.valueFontSize=0,this.chartHeight=0,this.chartWidth=0,this.maxTextWidth=V-this.panelPadding*2,this.maxTextHeight=W-this.panelPadding*2,N&&(N.titleSize&&(this.titleFontSize=N.titleSize,this.titleToAlignTo=void 0),N.valueSize&&(this.valueFontSize=N.valueSize,this.valueToAlignTo=""))}getTitleStyles(){const A={fontSize:`${this.titleFontSize}px`,lineHeight:p};return this.props.parentOrientation===g.wm.Horizontal&&this.justifyCenter&&(A.paddingRight="0.75ch"),(this.props.colorMode===M.Background||this.props.colorMode===M.BackgroundSolid)&&(A.color=(0,o.bM)(this.valueColor,this.props.theme.isDark)),A}getValueStyles(){const A={fontSize:this.valueFontSize,fontWeight:E,lineHeight:p,position:"relative",zIndex:1};switch(this.justifyCenter&&(A.textAlign="center"),this.props.colorMode){case M.Value:A.color=this.valueColor;break;case M.Background:case M.BackgroundSolid:A.color=(0,o.bM)(this.valueColor,this.props.theme.isDark);break;case M.None:A.color=this.props.theme.colors.text.primary;break}return A}getValueAndTitleContainerStyles(){const A={display:"flex"};return this.justifyCenter&&(A.alignItems="center",A.justifyContent="center",A.flexGrow=1),A}getPanelStyles(){const{width:A,height:V,theme:W,colorMode:w}=this.props,N={width:`${A}px`,height:`${V}px`,padding:`${this.panelPadding}px`,borderRadius:W.shape.borderRadius(),position:"relative",display:"flex"},F=W.isDark?1:-.7;switch(w){case M.Background:const k=(0,r.Z)(this.valueColor).darken(15*F).spin(8).toRgbString(),H=(0,r.Z)(this.valueColor).darken(5*F).spin(-8).toRgbString();N.background=`linear-gradient(120deg, ${k}, ${H})`;break;case M.BackgroundSolid:N.background=(0,r.Z)(this.valueColor).toString();break;case M.Value:N.background="transparent";break}return this.justifyCenter&&(N.alignItems="center",N.flexDirection="row"),N}renderChart(){const{sparkline:A,colorMode:V}=this.props;if(!A||A.y?.type!==d.fS.number)return null;let W,w;switch(V){case M.Background:case M.BackgroundSolid:W="rgba(255,255,255,0.4)",w=(0,r.Z)(this.valueColor).brighten(40).toRgbString();break;case M.None:case M.Value:default:w=this.valueColor,W=(0,r.Z)(this.valueColor).setAlpha(.2).toRgbString();break}const N={custom:{drawStyle:u.l8.Line,lineWidth:1,fillColor:W,lineColor:w}};return n.createElement("div",{style:this.getChartStyles()},n.createElement(c.b,{height:this.chartHeight,width:this.chartWidth,sparkline:A,config:N,theme:this.props.theme}))}getChartStyles(){return{position:"absolute",right:0,bottom:0}}}class y extends h{constructor(A){super(A);const V=this.titleToAlignTo?.length?.3:1;this.valueToAlignTo.length&&(this.valueFontSize=(0,m.MX)(this.valueToAlignTo,this.maxTextWidth*V,this.maxTextHeight,p,void 0,E)),this.titleToAlignTo?.length&&(this.titleFontSize=(0,m.MX)(this.titleToAlignTo,this.maxTextWidth*.6,this.maxTextHeight,p,f),this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize))}getValueAndTitleContainerStyles(){const A=super.getValueAndTitleContainerStyles();return A.flexDirection="row",A.alignItems="center",A.flexGrow=1,this.justifyCenter||(A.justifyContent="space-between"),A}renderChart(){return null}getPanelStyles(){const A=super.getPanelStyles();return A.alignItems="center",A}}class v extends h{constructor(A){super(A);const{width:V,height:W}=A,w=.5,N=.6,F=1-N,k=.4;this.chartWidth=V,this.chartHeight=W*w,this.titleToAlignTo?.length&&(this.titleFontSize=(0,m.MX)(this.titleToAlignTo,this.maxTextWidth*N,this.maxTextHeight*k,p,f)),this.valueToAlignTo.length&&(this.valueFontSize=(0,m.MX)(this.valueToAlignTo,this.maxTextWidth*F,this.maxTextHeight*w,p,void 0,E))}getValueAndTitleContainerStyles(){const A=super.getValueAndTitleContainerStyles();return A.flexDirection="row",A.flexGrow=1,this.justifyCenter||(A.justifyContent="space-between"),A}getPanelStyles(){const A=super.getPanelStyles();return A.flexDirection="row",A.justifyContent="space-between",A}}class D extends h{constructor(A){super(A);const{width:V,height:W}=A,w=.15,N=.25;let F=0;this.chartHeight=W*N,this.chartWidth=V,this.titleToAlignTo?.length&&(this.titleFontSize=(0,m.MX)(this.titleToAlignTo,this.maxTextWidth,W*w,p,f),F=this.titleFontSize*p),this.valueToAlignTo.length&&(this.valueFontSize=(0,m.MX)(this.valueToAlignTo,this.maxTextWidth,this.maxTextHeight-this.chartHeight-F,p,void 0,E)),this.titleToAlignTo?.length&&(this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize)),this.chartHeight=W-this.titleFontSize*p-this.valueFontSize*p}getValueAndTitleContainerStyles(){const A=super.getValueAndTitleContainerStyles();return A.flexDirection="column",A.justifyContent="center",A}getPanelStyles(){const A=super.getPanelStyles();return A.flexDirection="column",A}}class a extends h{constructor(A){super(A);const{height:V}=A,W=.15;let w=0;this.titleToAlignTo?.length&&(this.titleFontSize=(0,m.MX)(this.titleToAlignTo,this.maxTextWidth,V*W,p,f),w=this.titleFontSize*p),this.valueToAlignTo.length&&(this.valueFontSize=(0,m.MX)(this.valueToAlignTo,this.maxTextWidth,this.maxTextHeight-w,p,void 0,E)),this.titleToAlignTo?.length&&(this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize))}getValueAndTitleContainerStyles(){const A=super.getValueAndTitleContainerStyles();return A.flexDirection="column",A.flexGrow=1,A}renderChart(){return null}getPanelStyles(){const A=super.getPanelStyles();return A.alignItems="center",A}}function C(B){const{width:A,height:V,sparkline:W}=B;return A/V>2.5?V>50&&W&&W.y.values.length>1?new v(B):new y(B):V>100&&W&&W.y.values.length>1?new D(B):new a(B)}function P(B,A){return B===S.Center?!0:(A??"").length===0}function b(B){const{value:A,alignmentFactors:V,count:W}=B;let{textMode:w}=B;const N=V?V.title:A.title,F=(0,l.zc)(V||A);switch(w===x.Auto&&(W??1)===1&&(w=x.Value),w){case x.Name:return{...A,title:void 0,prefix:void 0,suffix:void 0,text:A.title||"",titleToAlignTo:void 0,valueToAlignTo:N??"",tooltip:(0,l.zc)(A)};case x.Value:return{...A,title:void 0,titleToAlignTo:void 0,valueToAlignTo:F,tooltip:A.title};case x.None:return{numeric:A.numeric,color:A.color,title:void 0,text:"",titleToAlignTo:void 0,valueToAlignTo:"1",tooltip:`Name: ${A.title} Value: ${(0,l.zc)(A)}`};case x.ValueAndName:default:return{...A,titleToAlignTo:N,valueToAlignTo:F}}}var M=(B=>(B.Background="background",B.BackgroundSolid="background_solid",B.None="none",B.Value="value",B))(M||{}),T=(B=>(B.None="none",B.Line="line",B.Area="area",B))(T||{}),S=(B=>(B.Auto="auto",B.Center="center",B))(S||{}),x=(B=>(B.Auto="auto",B.Value="value",B.ValueAndName="value_and_name",B.Name="name",B.None="none",B))(x||{});class O extends n.PureComponent{render(){const{onClick:A,className:V,hasLinks:W,theme:w}=this.props,N=C(this.props),F=N.getPanelStyles(),k=N.getValueAndTitleContainerStyles(),H=N.getValueStyles(),R=N.getTitleStyles(),_=N.textValues,G=W?void 0:_.tooltip;return A?n.createElement("button",{type:"button",className:(0,t.cx)((0,i.gN)(w),V),style:F,onClick:A,title:G},n.createElement("div",{style:k},_.title&&n.createElement("div",{style:R},_.title),n.createElement(s.W,{value:_,style:H})),N.renderChart()):n.createElement("div",{className:V,style:F,title:G},n.createElement("div",{style:k},_.title&&n.createElement("div",{style:R},_.title),n.createElement(s.W,{value:_,style:H})),N.renderChart())}}O.defaultProps={justifyMode:"auto"}},36162:(j,I,e)=>{"use strict";e.d(I,{_:()=>d});var t=e(42844),n=e(27702),i=e(3819),s=e.n(i),r=e(66310),g=e(77709);const d=(0,n.forwardRef)(({name:u,value:o,hidden:m,facets:c,onClick:p,className:f,loading:E,searchTerm:h,active:y,style:v,title:D,highlightParts:a,...C},P)=>{const b=(0,r.l4)(),M=l(b),T=h?[h]:[],S=(0,n.useCallback)(O=>{p&&!m&&p(u,o,O)},[p,u,m,o]);let x=o||u;return c&&(x=`${x} (${c})`),n.createElement("button",{key:x,ref:P,onClick:S,style:v,title:D||x,type:"button",role:"option","aria-selected":!!y,className:(0,t.cx)(M.base,y&&M.active,E&&M.loading,m&&M.hidden,f,p&&!m&&M.hover),...C},a!==void 0?n.createElement(g.H,{text:x,highlightClassName:M.matchHighLight,highlightParts:a}):n.createElement(s(),{textToHighlight:x,searchWords:T,autoEscape:!0,highlightClassName:M.matchHighLight}))});d.displayName="Label";const l=u=>({base:(0,t.css)({display:"inline-block",cursor:"pointer",fontSize:u.typography.size.sm,lineHeight:u.typography.bodySmall.lineHeight,backgroundColor:u.colors.background.secondary,color:u.colors.text.primary,whiteSpace:"nowrap",textShadow:"none",padding:u.spacing(.5),borderRadius:u.shape.borderRadius(),border:"none",marginRight:u.spacing(1),marginBottom:u.spacing(.5)}),loading:(0,t.css)({fontWeight:u.typography.fontWeightMedium,backgroundColor:u.colors.primary.shade,color:u.colors.text.primary,animation:"pulse 3s ease-out 0s infinite normal forwards","@keyframes pulse":{"0%":{color:u.colors.text.primary},"50%":{color:u.colors.text.secondary},"100%":{color:u.colors.text.disabled}}}),active:(0,t.css)({fontWeight:u.typography.fontWeightMedium,backgroundColor:u.colors.primary.main,color:u.colors.primary.contrastText}),matchHighLight:(0,t.css)({background:"inherit",color:u.components.textHighlight.text,backgroundColor:u.components.textHighlight.background}),hidden:(0,t.css)({opacity:.6,cursor:"default",border:"1px solid transparent"}),hover:(0,t.css)({["&:hover"]:{opacity:.85,cursor:"pointer"}})})},66670:(j,I,e)=>{"use strict";e.d(I,{Qj:()=>m,_7:()=>y,c9:()=>E,fW:()=>c,gN:()=>h,zx:()=>o});var t=e(42844),n=e(27702),i=e(66310),s=e(97289),r=e(26468),g=e(73453),d=e(80011);const l=null,u=null,o=n.forwardRef(({variant:v="primary",size:D="md",fill:a="solid",icon:C,fullWidth:P,children:b,className:M,type:T="button",tooltip:S,tooltipPlacement:x,...O},B)=>{const A=(0,i.l4)(),V=c({theme:A,size:D,variant:v,fill:a,fullWidth:P,iconOnly:!b}),W=n.createElement("button",{className:(0,t.cx)(V.button,M),type:T,...O,ref:S?void 0:B},C&&n.createElement(g.J,{name:C,size:D,className:V.icon}),b&&n.createElement("span",{className:V.content},b));return S?n.createElement(d.u,{ref:B,content:S,placement:x},W):W});o.displayName="Button";const m=n.forwardRef(({variant:v="primary",size:D="md",fill:a="solid",icon:C,fullWidth:P,children:b,className:M,onBlur:T,onFocus:S,disabled:x,tooltip:O,tooltipPlacement:B,...A},V)=>{const W=(0,i.l4)(),w=c({theme:W,fullWidth:P,size:D,variant:v,fill:a,iconOnly:!b}),N=(0,t.cx)(w.button,{[(0,t.css)(w.disabled,{pointerEvents:"none"})]:x},M),F=n.createElement("a",{className:N,...A,tabIndex:x?-1:0,ref:O?void 0:V},C&&n.createElement(g.J,{name:C,size:D,className:w.icon}),b&&n.createElement("span",{className:w.content},b));return O?n.createElement(d.u,{ref:V,content:O,placement:B},F):F});m.displayName="LinkButton";const c=v=>{const{theme:D,variant:a,fill:C="solid",size:P,iconOnly:b,fullWidth:M}=v,{height:T,padding:S,fontSize:x}=(0,r.iL)(P,D),O=E(D,a,C),B=f(D,a,C),A=(0,s.getFocusStyles)(D),V=D.spacing.gridSize*S-1;return{button:(0,t.css)({label:"button",display:"inline-flex",alignItems:"center",fontSize:x,fontWeight:D.typography.fontWeightMedium,fontFamily:D.typography.fontFamily,padding:`0 ${V}px`,height:D.spacing(T),lineHeight:`${D.spacing.gridSize*T-2}px`,verticalAlign:"middle",cursor:"pointer",borderRadius:D.shape.radius.default,"&:focus":A,"&:focus-visible":A,"&:focus:not(:focus-visible)":(0,s.getMouseFocusStyles)(D),...M&&{flexGrow:1,justifyContent:"center"},...O,":disabled":B,"&[disabled]":B}),disabled:(0,t.css)(B),img:(0,t.css)({width:"16px",height:"16px",margin:D.spacing(0,1,0,.5)}),icon:b?(0,t.css)({marginRight:D.spacing(-S/2),marginLeft:D.spacing(-S/2)}):(0,t.css)({marginRight:D.spacing(S/2)}),content:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center",whiteSpace:"nowrap",overflow:"hidden",height:"100%"})}};function p(v,D,a){let C=D.border,P="transparent",b="transparent";return D.name==="secondary"&&(P=D.border,b=v.colors.emphasize(D.border,.25),C=v.colors.border.strong),a==="outline"?{background:"transparent",color:D.text,border:`1px solid ${C}`,transition:v.transitions.create(["background-color","border-color","color"],{duration:v.transitions.duration.short}),"&:hover":{background:D.transparent,borderColor:v.colors.emphasize(C,.25),color:D.text}}:a==="text"?{background:"transparent",color:D.text,border:"1px solid transparent",transition:v.transitions.create(["background-color","color"],{duration:v.transitions.duration.short}),"&:focus":{outline:"none",textDecoration:"none"},"&:hover":{background:D.transparent,textDecoration:"none"}}:{background:D.main,color:D.contrastText,border:`1px solid ${P}`,transition:v.transitions.create(["background-color","box-shadow","border-color","color"],{duration:v.transitions.duration.short}),"&:hover":{background:D.shade,color:D.contrastText,boxShadow:v.shadows.z1,borderColor:b}}}function f(v,D,a){const C={cursor:"not-allowed",boxShadow:"none",color:v.colors.text.disabled,transition:"none"};return a==="text"?{...C,background:"transparent",border:"1px solid transparent"}:a==="outline"?{...C,background:"transparent",border:`1px solid ${v.colors.border.weak}`}:{...C,background:v.colors.action.disabledBackground,border:"1px solid transparent"}}function E(v,D,a){switch(D){case"secondary":return p(v,v.colors.secondary,a);case"destructive":return p(v,v.colors.error,a);case"success":return p(v,v.colors.success,a);case"primary":default:return p(v,v.colors.primary,a)}}const h=v=>(0,t.css)({background:"transparent",color:v.colors.text.primary,border:"none",padding:0}),y=v=>(0,t.css)({background:"transparent",border:"none",padding:0,fontFamily:"inherit",color:"inherit",height:"100%","&:hover":{background:"transparent",color:"inherit"}})},77720:(j,I,e)=>{"use strict";e.d(I,{h:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=(0,n.forwardRef)(({className:g,children:d,...l},u)=>{const o=(0,i.wW)(r);return n.createElement("div",{ref:u,className:(0,t.cx)("button-group",o.wrapper,g),...l},d)});s.displayName="ButtonGroup";const r=g=>({wrapper:(0,t.css)({display:"flex","> .button-group:not(:first-child) > button, > button:not(:first-child)":{borderTopLeftRadius:0,borderBottomLeftRadius:0},"> .button-group:not(:last-child) > button, > button:not(:last-child)":{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0}})})},77075:(j,I,e)=>{"use strict";e.d(I,{f:()=>s});var t=e(42844),n=e(27702),i=e(80402);const s=({className:g,children:d})=>{const l=r();return n.createElement("div",{className:(0,t.cx)(l,g)},d)},r=(0,i.B)(()=>(0,t.css)({display:"flex",button:{flexGrow:1,justifyContent:"center"},"> *":{flexGrow:1},label:{flexGrow:1,textAlign:"center"}}))},58964:(j,I,e)=>{"use strict";e.d(I,{O:()=>o});var t=e(42844),n=e(63178),i=e(27702),s=e(80402),r=e(66310),g=e(66670),d=e(22839),l=e(73453);const u=(0,s.B)(m=>({popup:(0,t.css)({label:"popup",zIndex:m.zIndex.dropdown}),icons:{right:(0,t.css)({margin:"1px 0 0 4px"}),left:(0,t.css)({margin:"-1px 4px 0 0"})}})),o=m=>{const{onChange:c,className:p,loadData:f,icon:E,buttonProps:h,hideDownIcon:y,variant:v,disabled:D,...a}=m,C=(0,r.l4)(),P=u(C);let b=m.children;return y||(b=[m.children,i.createElement(l.J,{key:"down-icon",name:"angle-down",className:P.icons.right})]),i.createElement(n.Z,{onChange:(0,d.K)(c),loadData:(0,d.p)(f),dropdownClassName:P.popup,...a,expandIcon:null},i.createElement(g.zx,{icon:E,disabled:D,variant:v,...h??{}},b))};o.displayName="ButtonCascader"},60801:(j,I,e)=>{"use strict";e.d(I,{_:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({message:g,callToActionElement:d,footer:l,className:u})=>{const o=(0,i.wW)(r);return n.createElement("div",{className:(0,t.cx)([o.wrapper,u])},g&&n.createElement("div",{className:o.message},g),d,l&&n.createElement("div",{className:o.footer},l))},r=g=>({wrapper:(0,t.css)({label:"call-to-action-card",padding:g.spacing(3),background:g.colors.background.secondary,borderRadius:g.shape.radius.default,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1}),message:(0,t.css)({marginBottom:g.spacing(3),fontStyle:"italic"}),footer:(0,t.css)({marginTop:g.spacing(3)})})},50230:(j,I,e)=>{"use strict";e.d(I,{L:()=>P,Z:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(97289),r=e(90527);const g=n.createContext(null),d=({disabled:b,href:M,onClick:T,children:S,isSelected:x,className:O,...B})=>{const A=(0,n.useMemo)(()=>n.Children.toArray(S).some(F=>n.isValidElement(F)&&F.type.displayName===l.displayName),[S]),V=b||!T&&!M,W=T&&!b?T:void 0,w=(0,i.l4)(),N=(0,r.$)(w,b,V,x);return n.createElement(r._,{disableEvents:b,disableHover:V,isSelected:x,className:(0,t.cx)(N.container,O),...B},n.createElement(g.Provider,{value:{href:M,onClick:W,disabled:b,isSelected:x}},!A&&n.createElement(l,null),S))},l=({children:b,className:M,"aria-label":T})=>{const S=(0,n.useContext)(g),x=(0,i.wW)(u),{href:O,onClick:B,isSelected:A}=S??{href:void 0,onClick:void 0,isSelected:void 0};return n.createElement("h2",{className:(0,t.cx)(x.heading,M)},O?n.createElement("a",{href:O,className:x.linkHack,"aria-label":T,onClick:B},b):B?n.createElement("button",{onClick:B,className:x.linkHack,"aria-label":T,type:"button"},b):n.createElement(n.Fragment,null,b),A!==void 0&&n.createElement("input",{"aria-label":"option",type:"radio",readOnly:!0,checked:A}))};l.displayName="Heading";const u=b=>({heading:(0,t.css)({gridArea:"Heading",justifySelf:"start",display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:0,fontSize:b.typography.size.md,letterSpacing:"inherit",lineHeight:b.typography.body.lineHeight,color:b.colors.text.primary,fontWeight:b.typography.fontWeightMedium}),linkHack:(0,t.css)({all:"unset","&::after":{position:"absolute",content:'""',top:0,bottom:0,left:0,right:0,borderRadius:b.shape.borderRadius(1)},"&:focus-visible":{outline:"none",outlineOffset:0,boxShadow:"none","&::after":{...(0,s.getFocusStyles)(b),zIndex:1}}})}),o=({children:b,className:M})=>{const T=(0,i.wW)(m);return n.createElement("div",{className:(0,t.cx)(T.tagList,M)},b)};o.displayName="Tags";const m=b=>({tagList:(0,t.css)({position:"relative",gridArea:"Tags",alignSelf:"center"})}),c=({children:b,className:M})=>{const T=(0,i.wW)(p);return n.createElement("p",{className:(0,t.cx)(T.description,M)},b)};c.displayName="Description";const p=b=>({description:(0,t.css)({width:"100%",gridArea:"Description",margin:b.spacing(1,0,0),color:b.colors.text.secondary,lineHeight:b.typography.body.lineHeight})}),f=({children:b,align:M="start",className:T})=>{const S=(0,i.wW)(E);return n.createElement("div",{className:(0,t.cx)(S.media,T,(0,t.css)({alignSelf:M}))},b)};f.displayName="Figure";const E=b=>({media:(0,t.css)({position:"relative",gridArea:"Figure",marginRight:b.spacing(2),width:"40px","> img":{width:"100%"},"&:empty":{display:"none"}})}),h=(0,n.memo)(({children:b,className:M,separator:T="|"})=>{const S=(0,i.wW)(y);let x=b;const O=n.Children.toArray(b).filter(Boolean);return O.length?(x=O.map((B,A)=>n.createElement("div",{key:`element_${A}`,className:S.metadataItem},B)),O.length>1&&T&&(x=O.reduce((B,A,V)=>[B,n.createElement("span",{key:`separator_${V}`,className:S.separator},T),A])),n.createElement("div",{className:(0,t.cx)(S.metadata,M)},x)):null});h.displayName="Meta";const y=b=>({metadata:(0,t.css)({gridArea:"Meta",display:"flex",alignItems:"center",width:"100%",fontSize:b.typography.size.sm,color:b.colors.text.secondary,margin:b.spacing(.5,0,0),lineHeight:b.typography.bodySmall.lineHeight,overflowWrap:"anywhere"}),metadataItem:(0,t.css)({zIndex:0}),separator:(0,t.css)({margin:`0 ${b.spacing(1)}`})}),v=({children:b,disabled:M,variant:T,className:S})=>{const x=(0,i.wW)(D),B=(0,n.useContext)(g)?.disabled||M,A=T==="primary"?x.actions:x.secondaryActions;return n.createElement("div",{className:(0,t.cx)(A,S)},n.Children.map(b,V=>n.isValidElement(V)?(0,n.cloneElement)(V,{disabled:B,...V.props}):null))},D=b=>({actions:(0,t.css)({gridArea:"Actions",marginTop:b.spacing(2),"& > *":{marginRight:b.spacing(1)}}),secondaryActions:(0,t.css)({display:"flex",gridArea:"Secondary",alignSelf:"center",color:b.colors.text.secondary,marginTtop:b.spacing(2),"& > *":{marginRight:`${b.spacing(1)} !important`}})}),a=({children:b,disabled:M,className:T})=>n.createElement(v,{variant:"primary",disabled:M,className:T},b);a.displayName="Actions";const C=({children:b,disabled:M,className:T})=>n.createElement(v,{variant:"secondary",disabled:M,className:T},b);C.displayName="SecondaryActions";const P=b=>({inner:(0,t.css)({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",flexWrap:"wrap"}),...u(b),...y(b),...p(b),...E(b),...D(b),...m(b)});d.Heading=l,d.Tags=o,d.Figure=f,d.Meta=h,d.Actions=a,d.SecondaryActions=C,d.Description=c},90527:(j,I,e)=>{"use strict";e.d(I,{$:()=>u,_:()=>l});var t=e(42844),n=e(27702),i=e(66310),s=e(80402),r=e(97289);const g=({children:o,href:m})=>{const{inner:c}=(0,i.wW)(d);return m?n.createElement("a",{className:c,href:m},o):n.createElement(n.Fragment,null,o)},d=o=>({inner:(0,t.css)({display:"flex",width:"100%",padding:o.spacing(2)})}),l=({children:o,disableEvents:m,disableHover:c,isSelected:p,className:f,href:E,...h})=>{const y=(0,i.l4)(),{oldContainer:v}=u(y,m,c,p);return n.createElement("div",{...h,className:(0,t.cx)(v,f)},n.createElement(g,{href:E},o))},u=(0,s.B)((o,m=!1,c=!1,p)=>{const f=p!==void 0;return{container:(0,t.css)({display:"grid",position:"relative",gridTemplateColumns:"auto 1fr auto",gridTemplateRows:"1fr auto auto auto",gridAutoColumns:"1fr",gridAutoFlow:"row",gridTemplateAreas:` "Figure Heading Tags" "Figure Meta Tags" "Figure Description Tags" "Figure Actions Secondary"`,width:"100%",padding:o.spacing(2),background:o.colors.background.secondary,borderRadius:o.shape.borderRadius(),marginBottom:"8px",pointerEvents:m?"none":"auto",transition:o.transitions.create(["background-color","box-shadow","border-color","color"],{duration:o.transitions.duration.short}),...!c&&{"&:hover":{background:o.colors.emphasize(o.colors.background.secondary,.03),cursor:"pointer",zIndex:1},"&:focus":r.getFocusStyles(o)},...f&&{cursor:"pointer"},...p&&{outline:`solid 2px ${o.colors.primary.border}`}}),oldContainer:(0,t.css)({display:"flex",width:"100%",background:o.colors.background.secondary,borderRadius:o.shape.borderRadius(),position:"relative",pointerEvents:m?"none":"auto",marginBottom:o.spacing(1),transition:o.transitions.create(["background-color","box-shadow","border-color","color"],{duration:o.transitions.duration.short}),...!c&&{"&:hover":{background:o.colors.emphasize(o.colors.background.secondary,.03),cursor:"pointer",zIndex:1},"&:focus":r.getFocusStyles(o)}})}})},97560:(j,I,e)=>{"use strict";e.d(I,{v:()=>m});var t=e(42844),n=e(82152),i=e(63178),s=e(27702),r=e(73453),g=e(1128),d=e(28580),l=e(22839);const u=(0,t.css)({"&:focus":{outline:"none"}}),o="/";class m extends s.PureComponent{constructor(p){super(p),this.flattenOptions=(y,v=[])=>{let D=[];for(const a of y){const C=[...v];C.push(a),a.items?D=[...D,...this.flattenOptions(a.items,C)]:D.push({singleLabel:C[C.length-1].label,label:C.map(P=>P.label).join(this.props.separator||` ${o} `),value:C.map(P=>P.value)})}return D},this.getSearchableOptions=(0,n.Z)(y=>this.flattenOptions(y)),this.onChange=(y,v)=>{const D=this.props.hideActiveLevelLabel?"":this.props.displayAllSelectedLevels?v.map(a=>a.label).join(this.props.separator||o):v[v.length-1].label;this.setState({rcValue:y,focusCascade:!0,activeLabel:D}),this.props.onSelect(v[v.length-1].value)},this.onSelect=y=>{const v=y.value||[];this.setState({activeLabel:this.props.displayAllSelectedLevels?y.label:y.singleLabel||"",rcValue:v,isSearching:!1}),this.props.onSelect(v[v.length-1])},this.onCreateOption=y=>{this.setState({activeLabel:y,rcValue:[],isSearching:!1}),this.props.onSelect(y)},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=y=>{["ArrowDown","ArrowUp","Enter","ArrowLeft","ArrowRight","Backspace"].includes(y.key)||this.setState({focusCascade:!1,isSearching:!0})},this.onSelectInputChange=y=>{y===""&&this.setState({isSearching:!1})};const f=this.getSearchableOptions(p.options),{rcValue:E,activeLabel:h}=this.setInitialValue(f,p.initialValue);this.state={isSearching:!1,focusCascade:!1,rcValue:E,activeLabel:h}}setInitialValue(p,f){if(!f)return{rcValue:[],activeLabel:""};for(const E of p){const h=E.value||[];if(h.indexOf(f)===h.length-1)return{rcValue:h,activeLabel:this.props.displayAllSelectedLevels?E.label:E.singleLabel||""}}return this.props.allowCustomValue?{rcValue:[],activeLabel:f}:{rcValue:[],activeLabel:""}}render(){const{allowCustomValue:p,formatCreateLabel:f,placeholder:E,width:h,changeOnSelect:y,options:v}=this.props,{focusCascade:D,isSearching:a,rcValue:C,activeLabel:P}=this.state,b=this.getSearchableOptions(v);return s.createElement("div",null,a?s.createElement(d.Ph,{allowCustomValue:p,placeholder:E,autoFocus:!D,onChange:this.onSelect,onBlur:this.onBlur,options:b,onCreateOption:this.onCreateOption,formatCreateLabel:f,width:h,onInputChange:this.onSelectInputChange}):s.createElement(i.Z,{onChange:(0,l.K)(this.onChange),options:v,changeOnSelect:y,value:C.value,fieldNames:{label:"label",value:"value",children:"items"},expandIcon:null,open:this.props.alwaysOpen},s.createElement("div",{className:u},s.createElement(g.I,{autoFocus:this.props.autoFocus,width:h,placeholder:E,onBlur:this.onBlurCascade,value:P,onKeyDown:this.onInputKeyDown,onChange:()=>{},suffix:D?s.createElement(r.J,{name:"angle-up"}):s.createElement(r.J,{name:"angle-down",style:{marginBottom:0,marginLeft:"4px"}})}))))}}m.defaultProps={changeOnSelect:!0}},22839:(j,I,e)=>{"use strict";e.d(I,{K:()=>t,p:()=>n});const t=r=>(g,d)=>{r&&r(g.map(l=>String(l)),i(d))},n=r=>g=>{r&&r(i(g))},i=r=>r.map(s),s=r=>({value:r.value??"",label:r.label})},8430:(j,I,e)=>{"use strict";e.d(I,{L:()=>n});var t=e(27702);class n extends t.PureComponent{constructor(){super(...arguments),this.myRef=(0,t.createRef)(),this.state={hasEventListener:!1},this.onOutsideClick=s=>{const r=this.myRef.current;(!r||!r.contains(s.target))&&this.props.onClick()}}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 t.createElement("div",{ref:this.myRef},this.props.children)}}n.defaultProps={includeButtonPress:!0,parent:typeof window<"u"?window:void 0,useCapture:!1}},71585:(j,I,e)=>{"use strict";e.d(I,{m:()=>u});var t=e(42844),n=e(27702),i=e(70610),s=e(66310),r=e(66670),g=e(73453),d=e(28676);const l=2*1e3;function u({onClipboardCopy:c,onClipboardError:p,children:f,getText:E,icon:h,variant:y,...v}){const D=(0,s.wW)(m),[a,C]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let M;return a&&(M=setTimeout(()=>{C(!1)},l)),()=>{window.clearTimeout(M)}},[a]);const P=(0,n.useRef)(null),b=(0,n.useCallback)(async()=>{const M=E();try{await o(M,P),C(!0),c?.(M)}catch(T){p?.(M,T)}},[E,c,p]);return n.createElement(n.Fragment,null,a&&n.createElement(d.K,{placement:"top",referenceElement:P.current},n.createElement(i.c,{i18nKey:"clipboard-button.inline-toast.success"},"Copied")),n.createElement(r.zx,{onClick:b,icon:h,variant:a?"success":y,"aria-label":a?"Copied":void 0,...v,className:(0,t.cx)(D.button,a&&D.successButton,v.className),ref:P},f,a&&n.createElement("div",{className:D.successOverlay},n.createElement(g.J,{name:"check"}))))}const o=async(c,p)=>{if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(c);{const f=document.createElement("textarea");p.current?.appendChild(f),f.value=c,f.focus(),f.select(),document.execCommand("copy"),f.remove()}},m=c=>({button:(0,t.css)({position:"relative"}),successButton:(0,t.css)({"> *":(0,t.css)({visibility:"hidden"})}),successOverlay:(0,t.css)({position:"absolute",top:0,bottom:0,right:0,left:0,visibility:"visible"})})},62499:(j,I,e)=>{"use strict";e.d(I,{s:()=>u});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(62108),g=e(73453),d=e(66310),l=e(97289);const u=({label:m,isOpen:c,onToggle:p,className:f,contentClassName:E,children:h,labelId:y,loading:v=!1,headerDataTestId:D,contentDataTestId:a})=>{const[C,P]=(0,s.useState)(c),b=(0,d.wW)(o),M=x=>{x.target instanceof HTMLElement&&x.target.tagName==="A"||(x.preventDefault(),x.stopPropagation(),p?.(!C),P(!C))},{current:T}=(0,s.useRef)((0,n.uniqueId)()),S=y??`collapse-label-${T}`;return s.createElement(s.Fragment,null,s.createElement("div",{onClick:M,className:(0,t.cx)(b.header,f)},s.createElement("button",{type:"button",id:`collapse-button-${T}`,className:b.button,onClick:M,"aria-expanded":C&&!v,"aria-controls":`collapse-content-${T}`,"aria-labelledby":S},v?s.createElement(r.$,{className:b.spinner}):s.createElement(g.J,{name:C?"angle-up":"angle-down",className:b.icon})),s.createElement("div",{className:b.label,id:`collapse-label-${T}`,"data-testid":D},m)),C&&s.createElement("div",{id:`collapse-content-${T}`,className:(0,t.cx)(b.content,E),"data-testid":a},h))},o=m=>({header:(0,t.css)({display:"flex",cursor:"pointer",boxSizing:"border-box",flexDirection:"row-reverse",position:"relative",justifyContent:"space-between",fontSize:m.typography.size.lg,padding:`${m.spacing(.5)} 0`,"&:focus-within":(0,l.getFocusStyles)(m)}),button:(0,t.css)({all:"unset","&:focus-visible":{outline:"none",outlineOffset:"unset",transition:"none",boxShadow:"none"}}),icon:(0,t.css)({color:m.colors.text.secondary}),content:(0,t.css)({padding:`${m.spacing(2)} 0`}),spinner:(0,t.css)({display:"flex",alignItems:"center",width:m.spacing(2)}),label:(0,t.css)({display:"flex"})})},41640:(j,I,e)=>{"use strict";e.d(I,{U:()=>l,y:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(66670),r=e(73453);const g=u=>({collapse:(0,t.css)({label:"collapse",marginBottom:u.spacing(1),backgroundColor:u.colors.background.primary,border:`1px solid ${u.colors.border.weak}`,position:"relative",borderRadius:u.shape.radius.default,width:"100%",display:"flex",flexDirection:"column",flex:"1 1 0"}),collapseBody:(0,t.css)({label:"collapse__body",padding:u.spacing(u.components.panel.padding),paddingTop:0,flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),bodyContentWrapper:(0,t.css)({label:"bodyContentWrapper",flex:1,overflow:"hidden"}),loader:(0,t.css)({label:"collapse__loader",height:"2px",position:"relative",overflow:"hidden",background:"none",margin:u.spacing(.5)}),loaderActive:(0,t.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:u.colors.primary.main},"@keyframes loader":{from:{left:"-25%",opacity:.1},to:{left:"100%",opacity:1}}}),header:(0,t.css)({label:"collapse__header",padding:u.spacing(1,2,1,2),display:"flex",transition:"all 0.1s linear"}),headerCollapsed:(0,t.css)({label:"collapse__header--collapsed",padding:u.spacing(1,2,1,2)}),headerLabel:(0,t.css)({label:"collapse__header-label",fontWeight:u.typography.fontWeightMedium,marginRight:u.spacing(1),fontSize:u.typography.size.md,display:"flex",flex:"0 0 100%"}),icon:(0,t.css)({label:"collapse__icon",margin:u.spacing(.25,1,0,-1)})}),d=({isOpen:u,onToggle:o,...m})=>{const[c,p]=(0,n.useState)(u);return n.createElement(l,{isOpen:c,collapsible:!0,...m,onToggle:()=>{p(!c),o&&o(!c)}})},l=({isOpen:u,label:o,loading:m,collapsible:c,onToggle:p,className:f,children:E})=>{const h=(0,i.wW)(s.gN),y=(0,i.wW)(g),v=()=>{p&&p(!u)},D=(0,t.cx)([y.collapse,f]),a=m?(0,t.cx)([y.loader,y.loaderActive]):(0,t.cx)([y.loader]),C=c?(0,t.cx)([y.header]):(0,t.cx)([y.headerCollapsed]);return n.createElement("div",{className:D},n.createElement("button",{type:"button",className:(0,t.cx)(h,C),onClick:v},c&&n.createElement(r.J,{className:y.icon,name:u?"angle-down":"angle-right"}),n.createElement("div",{className:(0,t.cx)([y.headerLabel])},o)),u&&n.createElement("div",{className:(0,t.cx)([y.collapseBody])},n.createElement("div",{className:a}),n.createElement("div",{className:y.bodyContentWrapper},E)))};l.displayName="Collapse"},36631:(j,I,e)=>{"use strict";e.d(I,{Z:()=>u});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(71685),g=e(66310),d=e(1128);const l=(0,s.forwardRef)(({color:c,onChange:p,isClearable:f=!1,onClick:E,onBlur:h,disabled:y,buttonAriaLabel:v,...D},a)=>{const[C,P]=(0,s.useState)(c),[b,M]=(0,s.useState)(c),T=(0,s.useMemo)(()=>(0,n.debounce)(p,100),[]);(0,s.useEffect)(()=>{const O=(0,r.Z)(c);O.isValid()&&c!==b&&(P(O.toString()),M(c))},[c,b]);const S=O=>{const{value:B}=O.currentTarget;if(P(B),B===""&&f){T(B);return}const A=(0,r.Z)(B);A.isValid()&&T(A.toString())},x=O=>{(0,r.Z)(C).isValid()||P(c),h?.(O)};return s.createElement(d.I,{...D,value:C,onChange:S,disabled:y,onClick:E,onBlur:x,addonBefore:s.createElement(o,{onClick:E,ariaLabel:v,disabled:y,color:c}),ref:a})});l.displayName="ColorInput";const u=l,o=({color:c,onClick:p,disabled:f,ariaLabel:E})=>{const h=(0,g.wW)(m);return s.createElement("button",{type:"button",onClick:p,"aria-label":E,disabled:f||!p,className:(0,t.cx)(h,(0,t.css)({backgroundColor:c}))})},m=c=>(0,t.css)({height:"100%",width:`${c.spacing.gridSize*4}px`,borderRadius:`${c.shape.borderRadius()} 0 0 ${c.shape.borderRadius()}`,border:`1px solid ${c.colors.border.medium}`})},56025:(j,I,e)=>{"use strict";e.d(I,{sp:()=>p,zH:()=>c});var t=e(42844),n=e(27702),i=e(66310),s=e(80402),r=e(54826),g=e(71235),d=e(75965),l=e(50361),u=e(79262),o=e(74011);const m=(E,h="ColorPicker")=>{var y;return y=class extends n.Component{constructor(){super(...arguments),this.pickerTriggerRef=(0,n.createRef)()}render(){const{theme:v,children:D,onChange:a}=this.props,C=f(v),P=n.createElement(E,{...this.props,children:null,onChange:a});return n.createElement(d.D,{content:P,hideAfter:300},(b,M,T)=>n.createElement(n.Fragment,null,this.pickerTriggerRef.current&&n.createElement(g.J,{...T,referenceElement:this.pickerTriggerRef.current,wrapperClassName:C.colorPicker,onMouseLeave:M,onMouseEnter:b,onKeyDown:S=>(0,r.i)(S,M)}),D?D({ref:this.pickerTriggerRef,showColorPicker:b,hideColorPicker:M}):n.createElement(u.b,{ref:this.pickerTriggerRef,onClick:b,onMouseLeave:M,color:v.visualization.getColorByName(this.props.color||"#000000")})))}},y.displayName=h,y},c=(0,i.HE)(m(l.h,"ColorPicker")),p=(0,i.HE)(m(o.j,"SeriesColorPicker")),f=(0,s.B)(E=>({colorPicker:(0,t.css)({position:"absolute",zIndex:E.zIndex.tooltip,color:E.colors.text.primary,maxWidth:"400px",fontSize:E.typography.size.sm,padding:"15px !important",'& [data-placement^="top"]':{paddingLeft:"0 !important",paddingRight:"0 !important"},'& [data-placement^="bottom"]':{paddingLeft:"0 !important",paddingRight:"0 !important"},'& [data-placement^="left"]':{paddingTop:"0 !important"},'& [data-placement^="right"]':{paddingTop:"0 !important"}})}))},56887:(j,I,e)=>{"use strict";e.d(I,{T:()=>o});var t=e(42844),n=e(27702),i=e(27463),s=e(9393),r=e(96750),g=e(66310),d=e(8430),l=e(36631),u=e(85265);const o=(0,n.forwardRef)(({value:c="",onChange:p,returnColorAs:f="rgb",...E},h)=>{const[y,v]=(0,n.useState)(c),[D,a]=(0,n.useState)(!1),C=(0,g.l4)(),P=(0,g.wW)(m),b=(0,g.wW)(u.W);return(0,s.Z)(M=>{if(M===c)return;if(!M){p("");return}const T=C.visualization.getColorByName(M);p(f==="rgb"?r.asRgbString(T):r.asHexString(T))},500,[y]),n.createElement(d.L,{onClick:()=>a(!1)},n.createElement("div",{className:P.wrapper},D&&!E.disabled&&n.createElement(i.ef,{"data-testid":"color-popover",color:y,onChange:v,className:(0,t.cx)(b.root,P.picker)}),n.createElement(l.Z,{...E,theme:C,color:y,onChange:v,buttonAriaLabel:"Open color picker",onClick:()=>a(!0),onBlur:()=>a(!1),ref:h,isClearable:!0})))});o.displayName="ColorPickerInput";const m=c=>({wrapper:(0,t.css)({position:"relative"}),picker:(0,t.css)({"&.react-colorful":{position:"absolute",width:"100%",zIndex:11,bottom:"36px"}}),inner:(0,t.css)({position:"absolute"})})},50361:(j,I,e)=>{"use strict";e.d(I,{h:()=>y});var t=e(42844),n=e(91546),i=e(27702),s=e(96750),r=e(66310),g=e(80402),d=e(79262),l=e(89949);function u(D,a){const C=new Array(D.length);for(let P=0;P<D.length;P++){const b=D.length-1-P;C[P]=a(D[b],b,D)}return C}const m=({hue:D,selectedColor:a,onColorSelect:C,...P})=>{const b=(0,l.upperFirst)(D.name),M=(0,r.wW)(c);return i.createElement("div",{className:M.colorRow},i.createElement("div",{className:M.colorLabel},b),i.createElement("div",{...P,className:M.swatchRow},u(D.shades,T=>i.createElement(d.b,{key:T.name,"aria-label":T.name,variant:T.primary?d.$.Large:d.$.Small,isSelected:T.name===a,color:T.color,onClick:()=>C(T.name)}))))},c=D=>({colorRow:(0,t.css)({display:"grid",gridTemplateColumns:"25% 1fr",gridColumnGap:D.spacing(2),padding:D.spacing(.5,0),"&:hover":{background:D.colors.background.secondary}}),colorLabel:(0,t.css)({paddingLeft:D.spacing(2),display:"flex",alignItems:"center"}),swatchRow:(0,t.css)({display:"flex",gap:D.spacing(1),alignItems:"center",justifyContent:"space-around",flexDirection:"row"})}),p=({color:D,onChange:a})=>{const C=(0,r.l4)(),P=(0,r.wW)(f),b=[];for(const M of C.visualization.hues)b.push(i.createElement(m,{key:M.name,selectedColor:D,hue:M,onColorSelect:a}));return i.createElement(i.Fragment,null,i.createElement("div",{className:P.swatches},b),i.createElement("div",{className:P.extraColors},i.createElement(d.b,{isSelected:D==="transparent",color:"rgba(0,0,0,0)",label:"Transparent",onClick:()=>a("transparent")}),i.createElement(d.b,{isSelected:D==="text",color:C.colors.text.primary,label:"Text color",onClick:()=>a("text")})))},f=D=>({container:(0,t.css)({display:"flex",flexDirection:"column"}),extraColors:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"space-around",gap:D.spacing(1),padding:D.spacing(1,0)}),swatches:(0,t.css)({display:"grid",flexGrow:1})});var E=e(85265);class h extends i.Component{constructor(a){super(a),this.getTabClassName=C=>{const{activePicker:P}=this.state;return`ColorPickerPopover__tab ${P===C&&"ColorPickerPopover__tab--active"}`},this.handleChange=C=>{const{onChange:P,enableNamedColors:b,theme:M}=this.props;if(b)return P(C);P(s.asHexString(M.visualization.getColorByName(C)))},this.onTabChange=C=>()=>this.setState({activePicker:C}),this.renderPicker=()=>{const{activePicker:C}=this.state,{color:P}=this.props;switch(C){case"spectrum":return i.createElement(E.Z,{color:P,onChange:this.handleChange});case"palette":return i.createElement(p,{color:P,onChange:this.handleChange});default:return this.renderCustomPicker(C)}},this.renderCustomPicker=C=>{const{customPickers:P,color:b,theme:M}=this.props;return P?i.createElement(P[C].tabComponent,{color:b,theme:M,onChange:this.handleChange}):null},this.renderCustomPickerTabs=()=>{const{customPickers:C}=this.props;return C?i.createElement(i.Fragment,null,Object.keys(C).map(P=>i.createElement("button",{className:this.getTabClassName(P),onClick:this.onTabChange(P),key:P,type:"button"},C[P].name))):null},this.state={activePicker:"palette"}}render(){const{theme:a}=this.props,C=v(a);return i.createElement(n.MT,{contain:!0,restoreFocus:!0,autoFocus:!0},i.createElement("div",{tabIndex:-1,className:C.colorPickerPopover},i.createElement("div",{className:C.colorPickerPopoverTabs},i.createElement("button",{className:this.getTabClassName("palette"),onClick:this.onTabChange("palette"),type:"button"},"Colors"),i.createElement("button",{className:this.getTabClassName("spectrum"),onClick:this.onTabChange("spectrum"),type:"button"},"Custom"),this.renderCustomPickerTabs()),i.createElement("div",{className:C.colorPickerPopoverContent},this.renderPicker())))}}const y=(0,r.HE)(h);y.displayName="ColorPickerPopover";const v=(0,g.B)(D=>({colorPickerPopover:(0,t.css)({borderRadius:D.shape.borderRadius(),boxShadow:D.shadows.z3,background:D.colors.background.primary,border:`1px solid ${D.colors.border.weak}`,".ColorPickerPopover__tab":{width:"50%",textAlign:"center",padding:D.spacing(1,0),background:D.colors.background.secondary,color:D.colors.text.secondary,fontSize:D.typography.bodySmall.fontSize,cursor:"pointer",border:"none","&:focus:not(:focus-visible)":{outline:"none",boxShadow:"none"},":focus-visible":{position:"relative"}},".ColorPickerPopover__tab--active":{color:D.colors.text.primary,fontWeight:D.typography.fontWeightMedium,background:D.colors.background.primary}}),colorPickerPopoverContent:(0,t.css)({width:"246px",fontSize:D.typography.bodySmall.fontSize,minHeight:"184px",padding:D.spacing(1),display:"flex",flexDirection:"column"}),colorPickerPopoverTabs:(0,t.css)({display:"flex",width:"100%",borderRadius:`${D.shape.borderRadius()} ${D.shape.borderRadius()} 0 0`})}))},79262:(j,I,e)=>{"use strict";e.d(I,{$:()=>d,b:()=>l});var t=e(42844),n=e(91546),i=e(27702),s=e(71685),r=e(74639),g=e(66310),d=(o=>(o.Small="small",o.Large="large",o))(d||{});const l=i.forwardRef(({color:o,label:m,variant:c="small",isSelected:p,"aria-label":f,...E},h)=>{const y=(0,g.l4)(),{isFocusVisible:v,focusProps:D}=(0,n.Fx)(),a=u(y,c,o,v,p),C=!!m,P=`${f||m} color`;return i.createElement("div",{ref:h,className:a.wrapper,"data-testid":r.wl.components.ColorSwatch.name,...E},C&&i.createElement("span",{className:a.label},m),i.createElement("button",{className:a.swatch,...D,"aria-label":P,type:"button"}))}),u=(o,m,c,p,f)=>{const E=(0,s.Z)(c),y=m==="small"?"16px":"32px";let v="none";return E.getAlpha()<.1&&(v=`2px solid ${o.colors.border.medium}`),{wrapper:(0,t.css)({display:"flex",alignItems:"center",cursor:"pointer"}),label:(0,t.css)({marginRight:o.spacing(1)}),swatch:(0,t.css)({width:y,height:y,background:`${c}`,border:v,borderRadius:o.shape.radius.circle,outlineOffset:"1px",outline:p?`2px solid ${o.colors.primary.main}`:"none",boxShadow:f?`inset 0 0 0 2px ${c}, inset 0 0 0 4px ${o.colors.getContrastText(c)}`:"none",transition:o.transitions.create(["transform"],{duration:o.transitions.duration.short}),"&:hover":{transform:"scale(1.1)"},"@media (forced-colors: active)":{forcedColorAdjust:"none"}})}};l.displayName="ColorSwatch"},74011:(j,I,e)=>{"use strict";e.d(I,{j:()=>g,q:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(17752),r=e(50361);const g=u=>{const o=(0,i.wW)(l),{yaxis:m,onToggleAxis:c,color:p,...f}=u,E=c?{yaxis:{name:"Y-Axis",tabComponent(){return n.createElement(s.r,{key:"yaxisSwitch",label:"Use right y-axis",className:o.colorPickerAxisSwitch,labelClass:o.colorPickerAxisSwitchLabel,checked:m===2,onChange:()=>{c&&c()}})}}}:void 0;return n.createElement(r.h,{...f,color:p||"#000000",customPickers:E})},d=(0,i.HE)(g),l=()=>({colorPickerAxisSwitch:(0,t.css)({width:"100%"}),colorPickerAxisSwitchLabel:(0,t.css)({display:"flex",flexGrow:1})})},85265:(j,I,e)=>{"use strict";e.d(I,{W:()=>o,Z:()=>m});var t=e(42844),n=e(27702),i=e(27463),s=e(9393),r=e(71685),g=e(96750),d=e(66310),l=e(36631);const u=({color:c,onChange:p})=>{const[f,E]=(0,n.useState)(c);(0,s.Z)(D=>{p(g.asHexString(h.visualization.getColorByName(D)))},500,[f]);const h=(0,d.l4)(),y=(0,d.wW)(o),v=(0,n.useMemo)(()=>f.startsWith("rgba")?f:(0,r.Z)(h.visualization.getColorByName(c)).toRgbString(),[f,h,c]);return n.createElement("div",{className:y.wrapper},n.createElement(i.ef,{className:y.root,color:v,onChange:E}),n.createElement(l.Z,{theme:h,color:v,onChange:E,className:y.colorInput}))},o=c=>({wrapper:(0,t.css)({flexGrow:1}),root:(0,t.css)({"&.react-colorful":{width:"auto"},".react-colorful":{"&__saturation":{borderRadius:`${c.shape.borderRadius(1)} ${c.shape.borderRadius(1)} 0 0`},"&__alpha":{borderRadius:`0 0 ${c.shape.borderRadius(1)} ${c.shape.borderRadius(1)}`},"&__alpha, &__hue":{height:c.spacing(2),position:"relative"},"&__pointer":{height:c.spacing(2),width:c.spacing(2)}}}),colorInput:(0,t.css)({marginTop:c.spacing(2)})}),m=u},55205:(j,I,e)=>{"use strict";e.d(I,{p:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(80402),r=e(66670);class g extends n.PureComponent{constructor(){super(...arguments),this.mainButtonRef=n.createRef(),this.confirmButtonRef=n.createRef(),this.state={showConfirm:!1},this.onClickButton=o=>{o&&o.preventDefault(),this.setState({showConfirm:!0},()=>{this.props.autoFocus&&this.confirmButtonRef.current&&this.confirmButtonRef.current.focus()}),this.props.onClick&&this.props.onClick()},this.onClickCancel=o=>{o&&o.preventDefault(),this.setState({showConfirm:!1},()=>{this.mainButtonRef.current?.focus()}),this.props.onCancel&&this.props.onCancel()},this.onConfirm=o=>{o&&o.preventDefault(),this.props.onConfirm(),this.props.closeOnConfirm&&this.setState({showConfirm:!1})}}render(){const{theme:o,className:m,size:c,disabled:p,confirmText:f,confirmVariant:E,children:h}=this.props,y=l(o),v=(0,t.cx)(m,this.state.showConfirm?y.buttonHide:y.buttonShow,p&&y.buttonDisabled),D=(0,t.cx)(y.confirmButton,this.state.showConfirm?y.confirmButtonShow:y.confirmButtonHide),a=p?()=>{}:this.onClickButton;return n.createElement("span",{className:y.buttonContainer},n.createElement("div",{className:(0,t.cx)(p&&y.disabled)},n.createElement("span",{className:v},typeof h=="string"?n.createElement(r.zx,{size:c,fill:"text",onClick:a,ref:this.mainButtonRef},h):n.cloneElement(h,{onClick:a,ref:this.mainButtonRef}))),n.createElement("span",{className:D},n.createElement(r.zx,{size:c,variant:E,onClick:this.onConfirm,ref:this.confirmButtonRef},f),n.createElement(r.zx,{size:c,fill:"text",onClick:this.onClickCancel},"Cancel")))}}const d=(0,i.HE)(g),l=(0,s.B)(u=>({buttonContainer:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"flex-end"}),buttonDisabled:(0,t.css)({textDecoration:"none",color:u.colors.text.primary,opacity:.65,pointerEvents:"none"}),buttonShow:(0,t.css)({opacity:1,transition:"opacity 0.1s ease",zIndex:2}),buttonHide:(0,t.css)({opacity:0,transition:"opacity 0.1s ease, visibility 0 0.1s",visibility:"hidden",zIndex:0}),confirmButton:(0,t.css)({alignItems:"flex-start",background:u.colors.background.primary,display:"flex",position:"absolute",pointerEvents:"none"}),confirmButtonShow:(0,t.css)({zIndex:1,opacity:1,transition:"opacity 0.08s ease-out, transform 0.1s ease-out",transform:"translateX(0)",pointerEvents:"all"}),confirmButtonHide:(0,t.css)({opacity:0,visibility:"hidden",transition:"opacity 0.12s ease-in, transform 0.14s ease-in, visibility 0s 0.12s",transform:"translateX(100px)"}),disabled:(0,t.css)({cursor:"not-allowed"})}));d.defaultProps={size:"md",confirmText:"Save",disabled:!1,confirmVariant:"primary"},d.displayName="ConfirmButton"},15202:(j,I,e)=>{"use strict";e.d(I,{m:()=>s});var t=e(27702),n=e(66670),i=e(55205);const s=({size:r,disabled:g,onConfirm:d,"aria-label":l,closeOnConfirm:u})=>t.createElement(i.p,{confirmText:"Delete",confirmVariant:"destructive",size:r||"md",disabled:g,onConfirm:d,closeOnConfirm:u},t.createElement(n.zx,{"aria-label":l,variant:"destructive",icon:"times",size:r||"sm"}))},3613:(j,I,e)=>{"use strict";e.d(I,{s:()=>u});var t=e(42844),n=e(27702),i=e(74639),s=e(64022),r=e(1128),g=e(66310),d=e(66670),l=e(13741);const u=({isOpen:m,title:c,body:p,description:f,confirmText:E,confirmVariant:h="destructive",confirmationText:y,dismissText:v="Cancel",dismissVariant:D="secondary",alternativeText:a,modalClass:C,icon:P="exclamation-triangle",onConfirm:b,onDismiss:M,onAlternative:T,confirmButtonVariant:S="destructive"})=>{const[x,O]=(0,n.useState)(!!y),B=(0,g.wW)(o),A=(0,n.useRef)(null),V=w=>{O(y?.toLowerCase().localeCompare(w.currentTarget.value.toLowerCase())!==0)};(0,n.useEffect)(()=>{m&&A.current?.focus()},[m]),(0,n.useEffect)(()=>{m&&O(!!y)},[m,y]);const W=async()=>{O(!0);try{await b()}finally{O(!1)}};return n.createElement(l.u,{className:(0,t.cx)(B.modal,C),title:c,icon:P,isOpen:m,onDismiss:M},n.createElement("div",{className:B.modalText},p,f?n.createElement("div",{className:B.modalDescription},f):null,y?n.createElement("div",{className:B.modalConfirmationInput},n.createElement(s.Lh,null,n.createElement(r.I,{placeholder:`Type "${y}" to confirm`,onChange:V}))):null),n.createElement(l.u.ButtonRow,null,n.createElement(d.zx,{variant:D,onClick:M,fill:"outline"},v),n.createElement(d.zx,{variant:S,onClick:W,disabled:x,ref:A,"data-testid":i.wl.pages.ConfirmModal.delete},E),T?n.createElement(d.zx,{variant:"primary",onClick:T},a):null))},o=m=>({modal:(0,t.css)({width:"500px"}),modalText:(0,t.css)({fontSize:m.typography.h5.fontSize,color:m.colors.text.primary}),modalDescription:(0,t.css)({fontSize:m.typography.body.fontSize}),modalConfirmationInput:(0,t.css)({paddingTop:m.spacing(1)})})},14986:(j,I,e)=>{"use strict";e.d(I,{x:()=>g});var t=e(27702),n=e(78089),i=e(74639),s=e(89746),r=e(52995);const g=t.memo(({x:d,y:l,onClose:u,focusOnOpen:o=!0,renderMenuItems:m,renderHeader:c})=>{const p=(0,t.useRef)(null),[f,E]=(0,t.useState)({});(0,t.useLayoutEffect)(()=>{const a=p.current;if(a){const C=a.getBoundingClientRect(),P=5,b={right:window.innerWidth<d+C.width,bottom:window.innerHeight<l+C.height+P};E({position:"fixed",left:b.right?d-C.width-P:d-P,top:b.bottom?l-C.height-P:l+P})}},[d,l]),(0,n.Z)(p,()=>{u?.()});const h=c?.(),y=m?.(),v=a=>{o&&a(0)},D=a=>{a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),u?.())};return t.createElement(r.h_,null,t.createElement(s.v,{header:h,ref:p,style:f,ariaLabel:i.wl.components.Menu.MenuComponent("Context"),onOpen:v,onClick:u,onKeyDown:D},y))});g.displayName="ContextMenu"},78383:(j,I,e)=>{"use strict";e.d(I,{z:()=>i});var t=e(27702),n=e(14986);const i=({children:s,renderMenuItems:r,focusOnOpen:g=!0})=>{const[d,l]=(0,t.useState)(!1),[u,o]=(0,t.useState)({x:0,y:0});return t.createElement(t.Fragment,null,s({openMenu:m=>{l(!0),o({x:m.pageX,y:m.pageY})}}),d&&t.createElement(n.x,{onClose:()=>l(!1),x:u.x,y:u.y,renderMenuItems:r,focusOnOpen:g}))}},29372:(j,I,e)=>{"use strict";e.d(I,{$:()=>o,Z:()=>m});var t=e(42844),n=e(27702),i=e(37381),s=e(66310),r=e(89898),g=e.n(r),d=e(73453);const l=({children:p})=>{const[f,E]=(0,n.useState)(!1),[h,y]=(0,n.useState)(!1),v=(0,n.useRef)(null),D=(0,n.useRef)(null),a=(0,s.wW)(u);return(0,n.useEffect)(()=>{const C=new IntersectionObserver(P=>{P.forEach(b=>{b.target===v.current?E(!b.isIntersecting):b.target===D.current&&y(!b.isIntersecting)})});return[v,D].forEach(P=>{P.current&&C.observe(P.current)}),()=>C.disconnect()},[]),n.createElement(n.Fragment,null,n.createElement("div",{className:(0,t.cx)(a.scrollIndicator,a.scrollTopIndicator,{[a.scrollIndicatorVisible]:f})},n.createElement(d.J,{className:g()(a.scrollIcon,a.scrollTopIcon),name:"angle-up"})),n.createElement("div",{className:a.scrollContent},n.createElement("div",{ref:v}),p,n.createElement("div",{ref:D})),n.createElement("div",{className:(0,t.cx)(a.scrollIndicator,a.scrollBottomIndicator,{[a.scrollIndicatorVisible]:h})},n.createElement(d.J,{className:g()(a.scrollIcon,a.scrollBottomIcon),name:"angle-down"})))},u=p=>({scrollContent:(0,t.css)({flex:1,position:"relative"}),scrollIndicator:(0,t.css)({height:p.spacing(6),left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,transition:p.transitions.create("opacity"),zIndex:1}),scrollTopIndicator:(0,t.css)({background:`linear-gradient(0deg, transparent, ${p.colors.background.canvas})`,top:0}),scrollBottomIndicator:(0,t.css)({background:`linear-gradient(180deg, transparent, ${p.colors.background.canvas})`,bottom:0}),scrollIndicatorVisible:(0,t.css)({opacity:1}),scrollIcon:(0,t.css)({left:"50%",position:"absolute",transform:"translateX(-50%)"}),scrollTopIcon:(0,t.css)({top:0}),scrollBottomIcon:(0,t.css)({bottom:0})}),o=({autoHide:p=!1,autoHideTimeout:f=200,setScrollTop:E,className:h,testId:y,autoHeightMin:v="0",autoHeightMax:D="100%",hideTracksWhenNotNeeded:a=!1,hideHorizontalTrack:C,hideVerticalTrack:P,scrollRefCallback:b,showScrollIndicators:M=!1,updateAfterMountMs:T,scrollTop:S,onScroll:x,children:O})=>{const B=(0,n.useRef)(null),A=(0,s.wW)(c);(0,n.useEffect)(()=>{B.current&&b&&b(B.current.view)},[B,b]),(0,n.useEffect)(()=>{B.current&&S!=null&&B.current.scrollTop(S)},[S]),(0,n.useEffect)(()=>{T&&setTimeout(()=>{const R=B.current;R?.update&&R.update()},T)},[T]);function V(R,_,G){return G.style&&_&&(G.style.display="none"),n.createElement("div",{...G,className:R})}const W=(0,n.useCallback)(R=>V("track-horizontal",C,R),[C]),w=(0,n.useCallback)(R=>V("track-vertical",P,R),[P]),N=(0,n.useCallback)(R=>n.createElement("div",{...R,className:"thumb-horizontal"}),[]),F=(0,n.useCallback)(R=>n.createElement("div",{...R,className:"thumb-vertical"}),[]),k=(0,n.useCallback)(R=>(R.style&&R.style.WebkitOverflowScrolling==="touch"&&(R.style.WebkitOverflowScrolling="auto"),n.createElement("div",{...R,className:"scrollbar-view"})),[]),H=(0,n.useCallback)(()=>{B.current&&E&&E(B.current.getValues())},[E]);return n.createElement(i.ZP,{"data-testid":y,ref:B,className:(0,t.cx)(A.customScrollbar,h,{[A.scrollbarWithScrollIndicators]:M}),onScrollStop:H,autoHeight:!0,autoHide:p,autoHideTimeout:f,hideTracksWhenNotNeeded:a,autoHeightMax:D,autoHeightMin:v,renderTrackHorizontal:W,renderTrackVertical:w,renderThumbHorizontal:N,renderThumbVertical:F,renderView:k,onScroll:x},M?n.createElement(l,null,O):O)},m=o,c=p=>({customScrollbar:(0,t.css)({display:"flex",flexGrow:1,".scrollbar-view":{display:"flex",flexGrow:1,flexDirection:"column"},".track-vertical":{borderRadius:p.shape.borderRadius(2),width:`${p.spacing(1)} !important`,right:0,bottom:p.spacing(.25),top:p.spacing(.25)},".track-horizontal":{borderRadius:p.shape.borderRadius(2),height:`${p.spacing(1)} !important`,right:p.spacing(.25),bottom:p.spacing(.25),left:p.spacing(.25)},".thumb-vertical":{background:p.colors.action.focus,borderRadius:p.shape.borderRadius(2),opacity:0},".thumb-horizontal":{background:p.colors.action.focus,borderRadius:p.shape.borderRadius(2),opacity:0},"&:hover":{".thumb-vertical, .thumb-horizontal":{opacity:1,transition:"opacity 0.3s ease-in-out"}}}),scrollbarWithScrollIndicators:(0,t.css)({".scrollbar-view":{position:"static !important"}})})},73e3:(j,I,e)=>{"use strict";e.d(I,{k:()=>i});var t=e(27702),n=e(66670);function i({link:s,buttonProps:r}){return t.createElement("a",{href:s.href,target:s.target,rel:"noreferrer",onClick:s.onClick?g=>{!(g.ctrlKey||g.metaKey||g.shiftKey)&&s.onClick&&(g.preventDefault(),s.onClick(g))}:void 0},t.createElement(n.zx,{icon:"external-link-alt",variant:"primary",size:"sm",...r},s.title))}},22965:(j,I,e)=>{"use strict";e.d(I,{v:()=>O});var t=e(42844),n=e(6570),i=e.n(n),s=e(27702),r=e(7965),g=e(35719),d=e(10418),l=e(73817),u=e(24094),o=e(3569),m=e(80553),c=e(54916),p=e(66310),f=e(29372),E=e(1128),h=e(52995),y=e(89949),v=e(79812),D=e(59390);const a=A=>({list:(0,t.css)({borderBottom:`1px solid ${A.colors.border.weak}`,"&:last-child":{border:"none"}}),wrapper:(0,t.css)({background:A.colors.background.primary,width:"250px"}),item:(0,t.css)({background:"none",padding:"2px 8px",color:A.colors.text.primary,cursor:"pointer","&:hover":{background:A.colors.action.hover}}),label:(0,t.css)({color:A.colors.text.secondary}),activeItem:(0,t.css)({background:A.colors.background.secondary,"&:hover":{background:A.colors.background.secondary}}),itemValue:(0,t.css)({fontFamily:A.typography.fontFamilyMonospace,fontSize:A.typography.size.sm})}),C=({suggestions:A,...V})=>{const W=(0,s.useRef)(null);(0,v.Z)(W,()=>{V.onClose&&V.onClose()});const w=(0,s.useMemo)(()=>(0,y.groupBy)(A,F=>F.origin),[A]),N=(0,p.wW)(a);return s.createElement("div",{role:"menu",ref:W,className:N.wrapper},Object.keys(w).map((F,k)=>{const H=k===0?0:Object.keys(w).reduce((R,_,G)=>G>=k?R:R+w[_].length,0);return s.createElement(P,{...V,suggestions:w[F],label:`${(0,y.capitalize)(F)}`,activeIndex:V.activeIndex,activeIndexOffset:H,key:F})}))};C.displayName="DataLinkSuggestions";const P=s.memo(({activeIndex:A,activeIndexOffset:V,label:W,onClose:w,onSuggestionSelect:N,suggestions:F,activeRef:k})=>{const H=(0,p.wW)(a);return s.createElement(s.Fragment,null,s.createElement(D.a,{className:H.list,items:F,renderItem:(R,_)=>{const G=_+V===A;return s.createElement("div",{role:"menuitem",tabIndex:0,className:(0,t.cx)(H.item,G&&H.activeItem),ref:G?k:void 0,onClick:()=>{N(R)},title:R.documentation},s.createElement("span",{className:H.itemValue},s.createElement("span",{className:H.label},W)," ",R.label))}}))});P.displayName="DataLinkSuggestionsList";class b{getBoundingClientRect(){const V=window.getSelection(),W=V&&V.anchorNode;return W&&W.parentElement?W.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 M=(A,V)=>A-V*Math.floor(A/V),T={builtInVariable:{pattern:/(\${\S+?})/}},S=[(0,c.Z)({onlyIn:A=>A.type==="code_block",getSyntax:()=>"links"},{...i().languages,links:T})],x=A=>({input:(0,E.H)({theme:A,invalid:!1}).input,editor:(0,t.css)({".token.builtInVariable":{color:A.colors.success.text},".token.variable":{color:A.colors.primary.text}}),suggestionsWrapper:(0,t.css)({boxShadow:A.shadows.z2}),wrapperOverrides:(0,t.css)({width:"100%","> .slate-query-field__wrapper":{padding:0,backgroundColor:"transparent",border:"none"}})}),O=(0,s.memo)(({value:A,onChange:V,suggestions:W,placeholder:w="http://your-grafana.com/d/000000010/annotations"})=>{const N=(0,s.useRef)(null),F=(0,p.wW)(x),[k,H]=(0,s.useState)(!1),[R,_]=(0,s.useState)(0),[G,Y]=(0,s.useState)((0,m.l1)(A)),X=(0,g.Z)(G),[Q,se]=(0,s.useState)(0),Z=(0,s.useRef)({showingSuggestions:k,suggestions:W,suggestionsIndex:R,linkUrl:G,onChange:V});Z.current={showingSuggestions:k,suggestions:W,suggestionsIndex:R,linkUrl:G,onChange:V};const le=(0,s.useRef)(null);(0,s.useEffect)(()=>{se(B(le.current,R))},[R]);const oe=(0,s.useMemo)(()=>new b,[]),q=s.useCallback((re,De)=>{if(!Z.current.showingSuggestions)return re.key==="="||re.key==="$"||re.keyCode===32&&re.ctrlKey?H(!0):De();switch(re.key){case"Backspace":case"Escape":return H(!1),_(0);case"Enter":return re.preventDefault(),ge(Z.current.suggestions[Z.current.suggestionsIndex]);case"ArrowDown":case"ArrowUp":re.preventDefault();const he=re.key==="ArrowDown"?1:-1;return _(ye=>M(ye+he,Z.current.suggestions.length));default:return De()}},[]);(0,s.useEffect)(()=>{X&&X.selection.isFocused&&!G.selection.isFocused&&Z.current.onChange(d.Z.serialize(G))},[G,X]);const ne=s.useCallback(({value:re})=>{Y(re)},[]),ge=(re,De=N.current)=>{const ye=ae()==="$";re.origin!==u.L8.Template||re.value===o.W.includeVars?De.insertText(`${ye?"":"$"}{${re.value}}`):De.insertText(`${ye?"":"$"}{${re.value}:queryparam}`),Y(De.value),H(!1),_(0),Z.current.onChange(d.Z.serialize(De.value))},ae=()=>{const re=document.getElementById("data-link-input");let De="",he,ye;return window.getSelection&&(he=window.getSelection(),he&&he.rangeCount>0&&(ye=he.getRangeAt(0).cloneRange(),ye.collapse(!0),ye.setStart(re,0),De=ye.toString().slice(-1))),De};return s.createElement("div",{className:F.wrapperOverrides},s.createElement("div",{className:"slate-query-field__wrapper"},s.createElement("div",{id:"data-link-input",className:"slate-query-field"},k&&s.createElement(h.h_,null,s.createElement(r.r,{referenceElement:oe,placement:"bottom-end",modifiers:[{name:"preventOverflow",enabled:!0,options:{rootBoundary:"viewport"}},{name:"arrow",enabled:!1},{name:"offset",options:{offset:[250,0]}}]},({ref:re,style:De,placement:he})=>s.createElement("div",{ref:re,style:De,"data-placement":he,className:F.suggestionsWrapper},s.createElement(f.Z,{scrollTop:Q,autoHeightMax:"300px",setScrollTop:({scrollTop:ye})=>se(ye)},s.createElement(C,{activeRef:le,suggestions:Z.current.suggestions,onSuggestionSelect:ge,onClose:()=>H(!1),activeIndex:R}))))),s.createElement(l.ML,{schema:m.Yi,ref:N,placeholder:w,value:Z.current.linkUrl,onChange:ne,onKeyDown:(re,De,he)=>q(re,he),plugins:S,className:(0,t.cx)(F.editor,F.input,(0,t.css)({padding:"3px 8px"}))}))))});O.displayName="DataLinkInput";function B(A,V){return(A?.clientHeight??0)*V}},50741:(j,I,e)=>{"use strict";e.d(I,{V:()=>l});var t=e(42844),n=e(27702),i=e(74639),s=e(97902),r=e(78383),g=e(66711),d=e(79655);const l=({children:u,links:o,style:m})=>{const c=[{items:(0,s.R)(o),label:"Data links"}],p=c[0].items.length,f=()=>c.map((h,y)=>n.createElement(g.k,{key:`${h.label}${y}`,label:h.label},(h.items||[]).map(v=>n.createElement(d.s,{key:v.label,url:v.url,label:v.label,target:v.target,icon:v.icon,active:v.active,onClick:v.onClick})))),E=(0,t.css)({cursor:"context-menu"});if(p>1)return n.createElement(r.z,{renderMenuItems:f},({openMenu:h})=>u({openMenu:h,targetClassName:E}));{const h=o()[0];return n.createElement("a",{href:h.href,onClick:h.onClick,target:h.target,title:h.title,style:{...m,overflow:"hidden",display:"flex"},"aria-label":i.wl.components.DataLinksContextMenu.singleLink},u({}))}}},36537:(j,I,e)=>{"use strict";e.d(I,{d:()=>a});var t=e(42844),n=e(89949),i=e(27702),s=e(66310),r=e(80402),g=e(66670),d=e(13741),l=e(97902),u=e(22209),o=e(1128),m=e(42074),c=e(22965);const p=P=>({listItem:(0,t.css)({marginBottom:P.spacing()}),infoText:(0,t.css)({paddingBottom:P.spacing(2),marginLeft:"66px",color:P.colors.text.secondary})}),f=i.memo(({index:P,value:b,onChange:M,suggestions:T,isLast:S})=>{const x=(0,s.wW)(p),O=(V,W)=>{M(P,{...b,url:V},W)},B=V=>{M(P,{...b,title:V.target.value})},A=()=>{M(P,{...b,targetBlank:!b.targetBlank})};return i.createElement("div",{className:x.listItem},i.createElement(u.g,{label:"Title"},i.createElement(o.I,{value:b.title,onChange:B,placeholder:"Show details"})),i.createElement(u.g,{label:"URL",invalid:(0,l.g)(b.url),error:"Data link is an Explore URL in a deprecated format. Please visit the URL to be redirected, and edit this data link to use that URL."},i.createElement(c.v,{value:b.url,onChange:O,suggestions:T})),i.createElement(u.g,{label:"Open in new tab"},i.createElement(m.r,{value:b.targetBlank||!1,onChange:A})),S&&i.createElement("div",{className:x.infoText},"With data links you can reference data variables like series name, labels and values. Type CMD+Space, CTRL+Space, or $ to open variable suggestions."))});f.displayName="DataLinkEditor";const E=({link:P,index:b,getSuggestions:M,onSave:T,onCancel:S})=>{const[x,O]=(0,i.useState)(P);return i.createElement(i.Fragment,null,i.createElement(f,{value:x,index:b,isLast:!1,suggestions:M(),onChange:(B,A)=>{O(A)}}),i.createElement(d.u.ButtonRow,null,i.createElement(g.zx,{variant:"secondary",onClick:()=>S(b),fill:"outline"},"Cancel"),i.createElement(g.zx,{onClick:()=>{T(b,x)}},"Save")))};var h=e(59904),y=e(67437);const v=({link:P,onEdit:b,onRemove:M})=>{const T=(0,s.l4)(),S=D(T),{title:x="",url:O=""}=P,B=x.trim()!=="",A=O.trim()!=="",V=(0,l.g)(O);return i.createElement("div",{className:S.wrapper},i.createElement("div",{className:S.titleWrapper},i.createElement("div",{className:(0,t.cx)(S.url,!A&&S.notConfigured,V&&S.errored)},B?x:"Data link title not provided"),i.createElement("div",{className:S.actionButtons},i.createElement(y.h,{name:"pen",onClick:b,tooltip:"Edit data link title"}),i.createElement(y.h,{name:"times",onClick:M,tooltip:"Remove data link title"}))),i.createElement("div",{className:(0,t.cx)(S.url,!A&&S.notConfigured,V&&S.errored),title:O},A?O:"Data link url not provided"),V&&i.createElement(h.S,null,"Explore data link may not work in the future. Please edit."))},D=(0,r.B)(P=>({wrapper:(0,t.css)({marginBottom:P.spacing(2),width:"100%","&:last-child":{marginBottom:0},display:"flex",flexDirection:"column"}),titleWrapper:(0,t.css)({label:"data-links-list-item-title",justifyContent:"space-between",display:"flex",width:"100%",alignItems:"center"}),actionButtons:(0,t.css)({marginLeft:P.spacing(1),display:"flex"}),errored:(0,t.css)({color:P.colors.error.text,fontStyle:"italic"}),notConfigured:(0,t.css)({fontStyle:"italic"}),title:(0,t.css)({color:P.colors.text.primary,fontSize:P.typography.size.sm,fontWeight:P.typography.fontWeightMedium}),url:(0,t.css)({color:P.colors.text.secondary,fontSize:P.typography.size.sm,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"90%"})})),a=({links:P,onChange:b,getSuggestions:M,data:T})=>{const S=(0,s.l4)(),[x,O]=(0,i.useState)(null),[B,A]=(0,i.useState)(!1),V=C(S),W=P??[],w=x!==null,N=(R,_)=>{if(B)if(_.title.trim()===""&&_.url.trim()===""){A(!1),O(null);return}else O(null),A(!1);const G=(0,n.cloneDeep)(W);G[R]=_,b(G),O(null)},F=()=>{let R=(0,n.cloneDeep)(W);O(R.length),A(!0)},k=R=>{B&&A(!1),O(null)},H=R=>{const _=(0,n.cloneDeep)(W);_.splice(R,1),b(_)};return i.createElement(i.Fragment,null,W.length>0&&i.createElement("div",{className:V.wrapper},W.map((R,_)=>i.createElement(v,{key:`${R.title}/${_}`,index:_,link:R,onChange:N,onEdit:()=>O(_),onRemove:()=>H(_),data:T}))),w&&x!==null&&i.createElement(d.u,{title:"Edit link",isOpen:!0,closeOnBackdropClick:!1,onDismiss:()=>{k(x)}},i.createElement(E,{index:x,link:B?{title:"",url:""}:W[x],data:T,onSave:N,onCancel:k,getSuggestions:M})),i.createElement(g.zx,{size:"sm",icon:"plus",onClick:F,variant:"secondary"},"Add link"))},C=(0,r.B)(P=>({wrapper:(0,t.css)({marginBottom:P.spacing(2)})}))},90282:(j,I,e)=>{"use strict";e.d(I,{Z:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(73453),r=e(73e3);function g({links:l}){const u=(0,i.wW)(d);if(l.length===1)return n.createElement(r.k,{link:l[0]});const o=l.filter(c=>c.target==="_blank"),m=l.filter(c=>c.target==="_self");return n.createElement(n.Fragment,null,m.map((c,p)=>n.createElement(r.k,{key:p,link:c})),n.createElement("div",{className:u.wrapper},n.createElement("p",{className:u.externalLinksHeading},"External links"),o.map((c,p)=>n.createElement("a",{key:p,href:c.href,target:c.target,className:u.externalLink},n.createElement(s.J,{name:"external-link-alt"}),c.title))))}const d=l=>({wrapper:(0,t.css)({flexBasis:"150px",width:"100px",marginTop:l.spacing(1)}),externalLinksHeading:(0,t.css)({color:l.colors.text.secondary,fontWeight:l.typography.fontWeightRegular,fontSize:l.typography.size.sm,margin:0}),externalLink:(0,t.css)({color:l.colors.text.link,fontWeight:l.typography.fontWeightRegular,display:"block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis","&:hover":{textDecoration:"underline"},div:{marginRight:l.spacing(1)}})})},80143:(j,I,e)=>{"use strict";e.d(I,{O:()=>s});var t=e(27702),n=e(42074),i=e(48024);function s({options:r,onOptionsChange:g}){return t.createElement(t.Fragment,null,t.createElement("h3",{className:"page-heading"},"Alerting"),t.createElement("div",{className:"gf-form-group"},t.createElement("div",{className:"gf-form-inline"},t.createElement("div",{className:"gf-form"},t.createElement(i._,{labelWidth:29,label:"Manage alert rules in Alerting UI",disabled:r.readOnly,tooltip:"Manage alert rules for this data source. To manage other alerting resources, add an Alertmanager data source."},t.createElement(n.x,{value:r.jsonData.manageAlerts!==!1,onChange:d=>g({...r,jsonData:{...r.jsonData,manageAlerts:d.currentTarget.checked}})}))))))}},43516:(j,I,e)=>{"use strict";e.d(I,{W:()=>d});var t=e(27702),n=e(66670),i=e(48024),s=e(71107),r=e(1128),g=e(60105);const d=({hasCert:l,label:u,onChange:o,onClick:m,placeholder:c})=>t.createElement(s.Z,null,t.createElement(i._,{label:u,labelWidth:14,disabled:l},l?t.createElement(r.I,{type:"text",value:"configured",width:24}):t.createElement(g.K,{rows:7,onChange:o,placeholder:c,required:!0})),l&&t.createElement(n.zx,{variant:"secondary",onClick:m,style:{marginLeft:4}},"Reset"))},93741:(j,I,e)=>{"use strict";e.d(I,{H:()=>c});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(80402),g=e(66670),d=e(14496),l=e(73453),u=e(88885);const o=(0,r.B)(()=>({layout:(0,t.css)({display:"flex",alignItems:"center",marginBottom:"4px","> *":{marginLeft:"4px",marginBottom:0,height:"100%","&:first-child, &:last-child":{marginLeft:0}}})})),m=({header:f,onBlur:E,onChange:h,onRemove:y,onReset:v})=>{const D=o();return s.createElement("div",{className:D.layout},s.createElement(d.W,{label:"Header",name:"name",placeholder:"X-Custom-Header",labelWidth:5,value:f.name||"",onChange:a=>h({...f,name:a.target.value}),onBlur:E}),s.createElement(u.c,{label:"Value","aria-label":"Value",name:"value",isConfigured:f.configured,value:f.value,labelWidth:5,inputWidth:f.configured?11:12,placeholder:"Header Value",onReset:()=>v(f.id),onChange:a=>h({...f,value:a.target.value}),onBlur:E}),s.createElement(g.zx,{type:"button","aria-label":"Remove header",variant:"secondary",size:"xs",onClick:a=>y(f.id)},s.createElement(l.J,{name:"trash-alt"})))};m.displayName="CustomHeaderRow";class c extends s.PureComponent{constructor(E){super(E),this.state={headers:[]},this.updateSettings=()=>{const{headers:D}=this.state,a=Object.fromEntries(Object.entries(this.props.dataSourceConfig.jsonData).filter(([P,b])=>!P.startsWith("httpHeaderName"))),C=Object.fromEntries(Object.entries(this.props.dataSourceConfig.secureJsonData||{}).filter(([P,b])=>!P.startsWith("httpHeaderValue")));for(const[P,b]of D.entries())a[`httpHeaderName${P+1}`]=b.name,b.configured||(C[`httpHeaderValue${P+1}`]=b.value);this.props.onChange({...this.props.dataSourceConfig,jsonData:a,secureJsonData:C})},this.onHeaderAdd=()=>{this.setState(D=>({headers:[...D.headers,{id:(0,n.uniqueId)(),name:"",value:"",configured:!1}]}))},this.onHeaderChange=(D,a)=>{this.setState(({headers:C})=>({headers:C.map((P,b)=>D!==b?P:{...a})}))},this.onHeaderReset=D=>{this.setState(({headers:a})=>({headers:a.map((C,P)=>C.id!==D?C:{...C,value:"",configured:!1})}))},this.onHeaderRemove=D=>{this.setState(({headers:a})=>({headers:a.filter(C=>C.id!==D)}),this.updateSettings)};const{jsonData:h,secureJsonData:y,secureJsonFields:v}=this.props.dataSourceConfig;this.state={headers:Object.keys(h).sort().filter(D=>D.startsWith("httpHeaderName")).map((D,a)=>({id:(0,n.uniqueId)(),name:h[D],value:y!==void 0?y[D]:"",configured:v&&v[`httpHeaderValue${a+1}`]||!1}))}}render(){const{headers:E}=this.state,{dataSourceConfig:h}=this.props;return s.createElement("div",{className:"gf-form-group"},s.createElement("div",{className:"gf-form"},s.createElement("h6",null,"Custom HTTP Headers")),s.createElement("div",null,E.map((y,v)=>s.createElement(m,{key:y.id,header:y,onChange:D=>{this.onHeaderChange(v,D)},onBlur:this.updateSettings,onRemove:this.onHeaderRemove,onReset:this.onHeaderReset}))),!h.readOnly&&s.createElement("div",{className:"gf-form"},s.createElement(g.zx,{variant:"secondary",icon:"plus",type:"button",onClick:y=>{this.onHeaderAdd()}},"Add header")))}}var p=null},49257:(j,I,e)=>{"use strict";e.d(I,{E:()=>M});var t=e(42844),n=e(27702),i=e(74639),s=e(66310),r=e(14496),g=e(60644),d=e(48024),l=e(83670),u=e(73453),o=e(28580),m=e(42074),c=e(72699),p=e(88885);const f=({dataSourceConfig:T,onChange:S})=>{const x=T.secureJsonData?T.secureJsonData.basicAuthPassword:"",O=()=>{S({...T,secureJsonData:{...T.secureJsonData,basicAuthPassword:""},secureJsonFields:{...T.secureJsonFields,basicAuthPassword:!1}})},B=A=>{S({...T,secureJsonData:{...T.secureJsonData,basicAuthPassword:A.currentTarget.value}})};return n.createElement(n.Fragment,null,n.createElement(d._,{disabled:T.readOnly},n.createElement(r.W,{label:"User",labelWidth:10,inputWidth:18,placeholder:"user",value:T.basicAuthUser,onChange:A=>S({...T,basicAuthUser:A.currentTarget.value})})),n.createElement(d._,{disabled:T.readOnly},n.createElement(p.c,{isConfigured:!!(T.secureJsonFields&&T.secureJsonFields.basicAuthPassword),value:x||"",inputWidth:18,labelWidth:10,onReset:O,onChange:B})))};var E=e(93741);const h=26,y=({dataSourceConfig:T,onChange:S,showForwardOAuthIdentityOption:x=!0})=>n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline"},n.createElement(d._,{label:"TLS Client Auth",labelWidth:h,disabled:T.readOnly},n.createElement(m.x,{id:"http-settings-tls-client-auth",value:T.jsonData.tlsAuth||!1,onChange:O=>S({...T.jsonData,tlsAuth:O.currentTarget.checked})})),n.createElement(d._,{label:"With CA Cert",tooltip:"Needed for verifying self-signed TLS Certs",labelWidth:h,disabled:T.readOnly},n.createElement(m.x,{id:"http-settings-ca-cert",value:T.jsonData.tlsAuthWithCACert||!1,onChange:O=>S({...T.jsonData,tlsAuthWithCACert:O.currentTarget.checked})}))),n.createElement("div",{className:"gf-form-inline"},n.createElement(d._,{label:"Skip TLS Verify",labelWidth:h,disabled:T.readOnly},n.createElement(m.x,{id:"http-settings-skip-tls-verify",value:T.jsonData.tlsSkipVerify||!1,onChange:O=>S({...T.jsonData,tlsSkipVerify:O.currentTarget.checked})}))),x&&n.createElement("div",{className:"gf-form-inline"},n.createElement(d._,{label:"Forward OAuth Identity",tooltip:"Forward the user's upstream OAuth identity to the data source (Their access token gets passed along).",labelWidth:h,disabled:T.readOnly},n.createElement(m.x,{id:"http-settings-forward-oauth",value:T.jsonData.oauthPassThru||!1,onChange:O=>S({...T.jsonData,oauthPassThru:O.currentTarget.checked})}))));var v=e(79510),D=e(86509);const a=[{label:"Server (default)",value:"proxy"},{label:"Browser",value:"direct"}],C={label:"Server (default)",value:"proxy"},P=()=>n.createElement("div",{className:"grafana-info-box m-t-2"},n.createElement("p",null,"Access mode controls how requests to the data source will be handled.",n.createElement("strong",null,"\xA0",n.createElement("i",null,"Server"))," ","should be the preferred way if nothing else is stated."),n.createElement("div",{className:"alert-title"},"Server access mode (Default):"),n.createElement("p",null,"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."),n.createElement("div",{className:"alert-title"},"Browser access mode:"),n.createElement("p",null,"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.")),b=26,M=T=>{const{defaultUrl:S,dataSourceConfig:x,onChange:O,showAccessOptions:B,sigV4AuthToggleEnabled:A,showForwardOAuthIdentityOption:V,azureAuthSettings:W,renderSigV4Editor:w,secureSocksDSProxyEnabled:N,urlLabel:F,urlDocs:k}=T,[H,R]=(0,n.useState)(!1),[_,G]=(0,n.useState)(!1),Y=(0,s.l4)();let X;const Q=(0,n.useCallback)(ne=>{const ge=W?.azureAuthSupported&&W.getAzureAuthEnabled(x)||!1;if(G(ge),ge){const ae=x.jsonData.oauthPassThru!==void 0?x.jsonData.oauthPassThru:!1;ne={...ne,jsonData:{...x.jsonData,oauthPassThru:ge?!1:ae}}}O({...x,...ne})},[W,x,O]);switch(x.access){case"direct":X=n.createElement(n.Fragment,null,"Your access method is ",n.createElement("em",null,"Browser"),", this means the URL needs to be accessible from the browser.",k);break;case"proxy":X=n.createElement(n.Fragment,null,"Your access method is ",n.createElement("em",null,"Server"),", this means the URL needs to be accessible from the grafana backend/server.",k);break;default:X=n.createElement(n.Fragment,null,"Specify a complete HTTP URL (for example http://your_server:8080) ",k)}const se=n.createElement(o.Ph,{"aria-label":"Access",className:"width-20 gf-form-input",options:a,value:a.filter(ne=>ne.value===x.access)[0]||C,onChange:ne=>Q({access:ne.value}),disabled:x.readOnly}),Z=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/.test(x.url),le=(0,t.css)({boxShadow:`inset 0 0px 5px ${Y.v1.palette.red}`}),oe=(0,t.cx)({["width-20"]:!0,[le]:!Z}),q=n.createElement(l.I,{className:oe,placeholder:S,value:x.url,"aria-label":i.wl.components.DataSource.DataSourceHttpSettings.urlInput,onChange:ne=>Q({url:ne.currentTarget.value}),disabled:x.readOnly});return n.createElement("div",{className:"gf-form-group"},n.createElement(n.Fragment,null,n.createElement("h3",{className:"page-heading"},"HTTP"),n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form"},n.createElement(r.W,{interactive:!!k,label:F??"URL",labelWidth:13,tooltip:X,inputEl:q})),B&&n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(r.W,{label:"Access",labelWidth:13,inputWidth:20,inputEl:se})),n.createElement("div",{className:"gf-form"},n.createElement("button",{type:"button",className:"gf-form-label query-keyword pointer",onClick:()=>R(ne=>!ne)},"Help\xA0",n.createElement(u.J,{name:H?"angle-down":"angle-right",style:{marginBottom:0}})))),H&&n.createElement(P,null)),x.access==="proxy"&&n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form"},n.createElement(g.c,{width:13,tooltip:"Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source."},"Allowed cookies"),n.createElement(c.B,{tags:x.jsonData.keepCookies,width:40,onChange:ne=>Q({jsonData:{...x.jsonData,keepCookies:ne}}),disabled:x.readOnly})),n.createElement("div",{className:"gf-form"},n.createElement(r.W,{label:"Timeout",type:"number",labelWidth:13,inputWidth:20,tooltip:"HTTP request timeout in seconds",placeholder:"Timeout in seconds","aria-label":"Timeout in seconds",value:x.jsonData.timeout,onChange:ne=>{Q({jsonData:{...x.jsonData,timeout:parseInt(ne.currentTarget.value,10)}})},disabled:x.readOnly}))))),n.createElement(n.Fragment,null,n.createElement("h3",{className:"page-heading"},"Auth"),n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form-inline"},n.createElement(d._,{label:"Basic auth",labelWidth:b,disabled:x.readOnly},n.createElement(m.x,{id:"http-settings-basic-auth",value:x.basicAuth,onChange:ne=>{Q({basicAuth:ne.currentTarget.checked})}})),n.createElement(d._,{label:"With Credentials",tooltip:"Whether credentials such as cookies or auth headers should be sent with cross-site requests.",labelWidth:b,disabled:x.readOnly},n.createElement(m.x,{id:"http-settings-with-credentials",value:x.withCredentials,onChange:ne=>{Q({withCredentials:ne.currentTarget.checked})}}))),W?.azureAuthSupported&&n.createElement("div",{className:"gf-form-inline"},n.createElement(d._,{label:"Azure Authentication",tooltip:"Use Azure authentication for Azure endpoint.",labelWidth:b,disabled:x.readOnly},n.createElement(m.x,{id:"http-settings-azure-auth",value:_,onChange:ne=>{Q(W.setAzureAuthEnabled(x,ne.currentTarget.checked))}}))),A&&n.createElement("div",{className:"gf-form-inline"},n.createElement(d._,{label:"SigV4 auth",labelWidth:b,disabled:x.readOnly},n.createElement(m.x,{id:"http-settings-sigv4-auth",value:x.jsonData.sigV4Auth||!1,onChange:ne=>{Q({jsonData:{...x.jsonData,sigV4Auth:ne.currentTarget.checked}})}}))),x.access==="proxy"&&n.createElement(y,{dataSourceConfig:x,onChange:ne=>Q({jsonData:ne}),showForwardOAuthIdentityOption:_?!1:V})),x.basicAuth&&n.createElement(n.Fragment,null,n.createElement("h6",null,"Basic Auth Details"),n.createElement("div",{className:"gf-form-group"},n.createElement(f,{...T}))),W?.azureAuthSupported&&_&&W.azureSettingsUI&&n.createElement(W.azureSettingsUI,{dataSourceConfig:x,onChange:O}),x.jsonData.sigV4Auth&&A&&w,(x.jsonData.tlsAuth||x.jsonData.tlsAuthWithCACert)&&n.createElement(D.s,{dataSourceConfig:x,onChange:O}),x.access==="proxy"&&n.createElement(E.H,{dataSourceConfig:x,onChange:O})),N&&n.createElement(v.i,{options:x,onOptionsChange:O}))}},79510:(j,I,e)=>{"use strict";e.d(I,{i:()=>s});var t=e(27702),n=e(42074),i=e(48024);function s({options:r,onOptionsChange:g}){return t.createElement(t.Fragment,null,t.createElement("h3",{className:"page-heading"},"Secure Socks Proxy"),t.createElement("div",{className:"gf-form-group"},t.createElement("div",{className:"gf-form-inline"},t.createElement("div",{className:"gf-form"},t.createElement(i._,{labelWidth:26,label:"Enabled",tooltip:"Connect to this datasource via the secure socks proxy."},t.createElement(n.x,{value:r.jsonData.enableSecureSocksProxy??!1,onChange:d=>g({...r,jsonData:{...r.jsonData,enableSecureSocksProxy:d.currentTarget.checked}})}))))))}},86509:(j,I,e)=>{"use strict";e.d(I,{s:()=>d});var t=e(42844),n=e(27702),i=e(14496),s=e(73453),r=e(80011),g=e(43516);const d=({dataSourceConfig:l,onChange:u})=>{const o=l.secureJsonFields&&l.secureJsonFields.tlsCACert,m=l.secureJsonFields&&l.secureJsonFields.tlsClientCert,c=l.secureJsonFields&&l.secureJsonFields.tlsClientKey,p=l.jsonData&&l.jsonData.serverName,f=y=>v=>{v.preventDefault();const D={...l.secureJsonFields};D[y]=!1,u({...l,secureJsonFields:D})},E=y=>v=>{const D={...l.secureJsonData};D[y]=v.currentTarget.value,u({...l,secureJsonData:D})},h=y=>{const v={...l.jsonData,serverName:y.currentTarget.value};u({...l,jsonData:v})};return n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:(0,t.cx)("gf-form",(0,t.css)({alignItems:"baseline"}))},n.createElement("h6",null,"TLS/SSL Auth Details"),n.createElement(r.u,{placement:"right-end",content:"TLS/SSL Certs are encrypted and stored in the Grafana database.",theme:"info"},n.createElement(s.J,{name:"info-circle",size:"xs",style:{marginLeft:"10px"}}))),n.createElement("div",null,l.jsonData.tlsAuthWithCACert&&n.createElement(g.W,{hasCert:!!o,onChange:E("tlsCACert"),placeholder:"Begins with -----BEGIN CERTIFICATE-----",label:"CA Cert",onClick:f("tlsCACert")}),l.jsonData.tlsAuth&&n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form"},n.createElement(i.W,{label:"ServerName",labelWidth:7,inputWidth:30,placeholder:"domain.example.com",value:p&&l.jsonData.serverName,onChange:h})),n.createElement(g.W,{hasCert:!!m,label:"Client Cert",onChange:E("tlsClientCert"),placeholder:"Begins with -----BEGIN CERTIFICATE-----",onClick:f("tlsClientCert")}),n.createElement(g.W,{hasCert:!!c,label:"Client Key",placeholder:"Begins with -----BEGIN RSA PRIVATE KEY-----",onChange:E("tlsClientKey"),onClick:f("tlsClientKey")}))))}},76911:(j,I,e)=>{"use strict";e.d(I,{M:()=>l});var t=e(42844),n=e(27702),i=e(33900),s=e(66310),r=e(8430),g=e(73453),d=e(8655);const l=(0,n.memo)(m=>{const c=(0,s.wW)(o),{isOpen:p,onClose:f}=m;return p?n.createElement(r.L,{useCapture:!0,includeButtonPress:!1,onClick:f},n.createElement("div",{className:c.modal,"data-testid":"date-picker"},n.createElement(u,{...m}))):null});l.displayName="DatePicker";const u=(0,n.memo)(({value:m,minDate:c,maxDate:p,onChange:f})=>{const E=(0,s.wW)(d.mg);return n.createElement(i.ZP,{className:E.body,tileClassName:E.title,value:m||new Date,minDate:c,maxDate:p,nextLabel:n.createElement(g.J,{name:"angle-right"}),prevLabel:n.createElement(g.J,{name:"angle-left"}),onChange:h=>{h&&!Array.isArray(h)&&f(h)},locale:"en"})});u.displayName="Body";const o=m=>({modal:(0,t.css)({zIndex:m.zIndex.modal,position:"absolute",boxShadow:m.shadows.z3,backgroundColor:m.colors.background.primary,border:`1px solid ${m.colors.border.weak}`,borderRadius:"2px 0 0 2px","button:disabled":{color:m.colors.text.disabled}})})},37691:(j,I,e)=>{"use strict";e.d(I,{d:()=>l});var t=e(42844),n=e(27702),i=e(99633),s=e(66310),r=e(1128),g=e(76911);const d=o=>(0,i.CQ)(o).format("L"),l=({value:o,minDate:m,maxDate:c,onChange:p,closeOnSelect:f,placeholder:E="Date",...h})=>{const[y,v]=n.useState(!1),D=(0,s.wW)(u);return n.createElement("div",{className:D.container},n.createElement(r.I,{type:"text",autoComplete:"off",placeholder:E,value:o&&d(o),onClick:()=>v(!0),onChange:a=>{a.target.value===""&&p("")},className:D.input,...h}),n.createElement(g.M,{isOpen:y,value:o&&typeof o!="string"?o:(0,i.CQ)().toDate(),minDate:m,maxDate:c,onChange:a=>{p(a),f&&v(!1)},onClose:()=>v(!1)}))},u=()=>({container:(0,t.css)({position:"relative"}),input:(0,t.css)({"input[type='date']::-webkit-inner-spin-button, input[type='date']::-webkit-calendar-picker-indicator":{display:"none",WebkitAppearance:"none"}})})},48419:(j,I,e)=>{"use strict";e.d(I,{x:()=>P});var t=e(42844),n=e(45809),i=e(91546),s=e(6714),r=e(27702),g=e(33900),d=e(76566),l=e(24352),u=e(60956),o=e(99633),m=e(52995),c=e(66670),p=e(48024),f=e(1128),E=e(73453),h=e(64022),y=e(66310),v=e(32173),D=e(19820),a=e(8655),C=e(87192);const P=({date:S,maxDate:x,minDate:O,label:B,onChange:A,disabledHours:V,disabledMinutes:W,disabledSeconds:w,showSeconds:N=!0})=>{const[F,k]=(0,r.useState)(!1),H=(0,r.useRef)(null),{overlayProps:R,underlayProps:_}=(0,s.Ir)({onClose:()=>k(!1),isDismissable:!0,isOpen:F,shouldCloseOnInteractOutside:re=>{const De=document.getElementsByClassName(D.F)[0];return!(De&&De.contains(re))}},H),{dialogProps:G}=(0,n.R)({},H),Y=(0,y.l4)(),{modalBackdrop:X}=(0,v.J)(Y),Q=(0,l.Z)(`(min-width: ${Y.breakpoints.values.lg}px)`),se=(0,y.wW)(T),[Z,le]=(0,r.useState)(),[oe,q]=(0,r.useState)(),ne=(0,d.D)(Z,oe,{placement:"bottom-start"}),ge=(0,r.useCallback)(re=>{k(!1),A(re)},[A]),ae=(0,r.useCallback)(re=>{re.preventDefault(),k(!0)},[k]);return r.createElement("div",{"data-testid":"date-time-picker",style:{position:"relative"}},r.createElement(b,{date:S,onChange:A,isFullscreen:Q,onOpen:ae,label:B,ref:le,showSeconds:N}),F?Q?r.createElement(m.h_,null,r.createElement(i.MT,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("div",{ref:H,...R,...G},r.createElement(M,{date:S,onChange:ge,isFullscreen:!0,onClose:()=>k(!1),maxDate:x,minDate:O,ref:q,style:ne.styles.popper,showSeconds:N,disabledHours:V,disabledMinutes:W,disabledSeconds:w})))):r.createElement(m.h_,null,r.createElement("div",{className:X,..._}),r.createElement(i.MT,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("div",{ref:H,...R,...G},r.createElement("div",{className:se.modal},r.createElement(M,{date:S,maxDate:x,minDate:O,onChange:ge,isFullscreen:!1,onClose:()=>k(!1),showSeconds:N,disabledHours:V,disabledMinutes:W,disabledSeconds:w}))))):null)},b=r.forwardRef(({date:S,label:x,onChange:O,isFullscreen:B,onOpen:A,showSeconds:V=!0},W)=>{const w=V?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm",[N,F]=(0,r.useState)(()=>({value:S?(0,u.dq)(S):(0,u.dq)((0,o.CQ)()),invalid:!1}));(0,r.useEffect)(()=>{S&&F({invalid:!(0,C.J)((0,u.dq)(S,{format:w})),value:(0,o.v9)(S)?(0,u.dq)(S,{format:w}):S})},[S,w]);const k=(0,r.useCallback)(_=>{const G=!(0,C.J)(_.currentTarget.value);F({value:_.currentTarget.value,invalid:G})},[]),H=(0,r.useCallback)(()=>{(0,o.v9)(N.value)&&O((0,o.CQ)(N.value))},[N.value,O]),R=r.createElement(c.zx,{"aria-label":"Time picker",icon:"calendar-alt",variant:"secondary",onClick:A});return r.createElement(p._,{label:x,invalid:!!(N.value&&N.invalid),className:(0,t.css)({marginBottom:0})},r.createElement(f.I,{onChange:k,addonAfter:R,value:N.value,onBlur:H,"data-testid":"date-time-input",placeholder:"Select date/time",ref:W}))});b.displayName="DateTimeInput";const M=r.forwardRef(({date:S,onClose:x,onChange:O,isFullscreen:B,maxDate:A,minDate:V,style:W,showSeconds:w=!0,disabledHours:N,disabledMinutes:F,disabledSeconds:k},H)=>{const R=(0,y.wW)(a.mg),_=(0,y.wW)(T),[G,Y]=(0,r.useState)(()=>S&&S.isValid()?S.toDate():new Date),X=(0,r.useCallback)(se=>{se&&!Array.isArray(se)&&Y(Z=>(se.setHours(Z.getHours()),se.setMinutes(Z.getMinutes()),se.setSeconds(Z.getSeconds()),se))},[]),Q=(0,r.useCallback)(se=>{Y(se.toDate())},[]);return r.createElement("div",{className:(0,t.cx)(_.container,{[_.fullScreen]:B}),style:W,ref:H},r.createElement(g.ZP,{next2Label:null,prev2Label:null,value:G,nextLabel:r.createElement(E.J,{name:"angle-right"}),nextAriaLabel:"Next month",prevLabel:r.createElement(E.J,{name:"angle-left"}),prevAriaLabel:"Previous month",onChange:X,locale:"en",className:R.body,tileClassName:R.title,maxDate:A,minDate:V}),r.createElement("div",{className:_.time},r.createElement(D.y,{showSeconds:w,onChange:Q,value:(0,o.CQ)(G),disabledHours:N,disabledMinutes:F,disabledSeconds:k})),r.createElement(h.Lh,null,r.createElement(c.zx,{type:"button",onClick:()=>O((0,o.CQ)(G))},"Apply"),r.createElement(c.zx,{variant:"secondary",type:"button",onClick:x},"Cancel")))});M.displayName="DateTimeCalendar";const T=S=>({container:(0,t.css)({padding:S.spacing(1),border:`1px ${S.colors.border.weak} solid`,borderRadius:S.shape.borderRadius(1),backgroundColor:S.colors.background.primary,zIndex:S.zIndex.modal}),fullScreen:(0,t.css)({position:"absolute"}),time:(0,t.css)({marginBottom:S.spacing(2)}),modal:(0,t.css)({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:S.zIndex.modal,maxWidth:"280px"})})},2184:(j,I,e)=>{"use strict";e.d(I,{x:()=>a});var t=e(42844),n=e(45809),i=e(91546),s=e(6714),r=e(27702),g=e(76566),d=e(66310),l=e(70610),u=e(66670),o=e(29372),m=e(22209),c=e(73453),p=e(1128),f=e(80011),E=e(21494),h=e(36042),y=e(61899),v=e(97287);const D=y.r.filter(T=>(0,v.jD)(T.from));function a(T){const{timeRange:S,onChange:x}=T,[O,B]=(0,r.useState)(!1),A=(0,r.useCallback)(()=>B(!1),[]),V=(0,v.C_)(S),[W,w]=(0,r.useState)({value:V.from,validation:(0,v.x5)(V.from)}),[N,F]=(0,r.useState)({value:V.to,validation:(0,v.x5)(V.to)}),k=(0,r.useRef)(null),{overlayProps:H,underlayProps:R}=(0,s.Ir)({onClose:()=>B(!1),isDismissable:!0,isOpen:O},k),{dialogProps:_}=(0,n.R)({},k),[G,Y]=(0,r.useState)(null),[X,Q]=(0,r.useState)(null),se=(0,g.D)(G,X,{placement:"auto-start"}),Z=(0,d.wW)(b(W.validation.errorMessage,N.validation.errorMessage)),le=ne=>{const ge=(0,v.aw)(ne);ge&&(A(),w({...W,value:ne.from}),F({...N,value:ne.to}),x(ge))},oe=(0,r.useCallback)(ne=>{ne.stopPropagation(),ne.preventDefault(),B(!O)},[O]),q=ne=>{if(ne.preventDefault(),!N.validation.isValid||!W.validation.isValid)return;const ge=(0,v.aw)({from:W.value,to:N.value,display:""});ge&&(x(ge),B(!1))};return r.createElement("div",{className:Z.container,ref:Y},r.createElement("button",{className:Z.pickerInput,type:"button",onClick:oe},r.createElement("span",{className:Z.clockIcon},r.createElement(c.J,{name:"clock-nine"})),r.createElement("span",null,V.from," to ",V.to),r.createElement("span",{className:Z.caretIcon},r.createElement(c.J,{name:O?"angle-up":"angle-down",size:"lg"}))),O&&r.createElement("div",null,r.createElement("div",{role:"presentation",className:Z.backdrop,...R}),r.createElement(i.MT,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("div",{ref:k,...H,..._},r.createElement("div",{className:Z.content,ref:Q,style:se.styles.popper,...se.attributes},r.createElement("div",{className:Z.body},r.createElement(o.Z,{className:Z.leftSide,hideHorizontalTrack:!0},r.createElement(h.V,{title:(0,l.t)("time-picker.time-range.example-title","Example time ranges"),options:D,onChange:le,value:V})),r.createElement("div",{className:Z.rightSide},r.createElement("div",{className:Z.title},r.createElement(E.r,null,r.createElement(f.u,{content:r.createElement(C,null),placement:"bottom",theme:"info"},r.createElement("div",null,r.createElement(l.c,{i18nKey:"time-picker.time-range.specify"},"Specify time range ",r.createElement(c.J,{name:"info-circle"})))))),r.createElement(m.g,{label:"From",invalid:!W.validation.isValid,error:W.validation.errorMessage},r.createElement(p.I,{onClick:ne=>ne.stopPropagation(),onBlur:()=>w({...W,validation:(0,v.x5)(W.value)}),onChange:ne=>w({...W,value:ne.currentTarget.value}),value:W.value})),r.createElement(m.g,{label:"To",invalid:!N.validation.isValid,error:N.validation.errorMessage},r.createElement(p.I,{onClick:ne=>ne.stopPropagation(),onBlur:()=>F({...N,validation:(0,v.x5)(N.value)}),onChange:ne=>F({...N,value:ne.currentTarget.value}),value:N.value})),r.createElement(u.zx,{"aria-label":"TimePicker submit button",onClick:q},"Apply time range"))))))))}const C=()=>{const T=(0,d.wW)(P);return r.createElement(r.Fragment,null,r.createElement("div",{className:T.supported},"Supported formats: ",r.createElement("code",{className:T.tooltip},"now-[digit]s/m/h/d/w")),r.createElement("div",null,"Example: to select a time range from 10 minutes ago to now"),r.createElement("code",{className:T.tooltip},"From: now-10m To: now"),r.createElement("div",{className:T.link},"For more information see"," ",r.createElement("a",{href:"https://grafana.com/docs/grafana/latest/dashboards/time-range-controls/"},"docs ",r.createElement(c.J,{name:"external-link-alt"})),"."))},P=T=>({supported:(0,t.css)({marginBottom:T.spacing(1)}),tooltip:(0,t.css)({margin:0}),link:(0,t.css)({marginTop:T.spacing(1)})}),b=(T,S)=>x=>{const O=(0,p.H)({theme:x,invalid:!1}),A=250+M(x,T)+M(x,S);return{backdrop:(0,t.css)({position:"fixed",zIndex:x.zIndex.modalBackdrop,top:0,right:0,bottom:0,left:0}),container:(0,t.css)({display:"flex",position:"relative"}),pickerInput:(0,t.cx)(O.input,O.wrapper,(0,t.css)({display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",paddingRight:0,paddingLeft:0,lineHeight:`${x.spacing.gridSize*x.components.height.md-2}px`})),caretIcon:(0,t.cx)(O.suffix,(0,t.css)({position:"relative",marginLeft:x.spacing(.5)})),clockIcon:(0,t.cx)(O.prefix,(0,t.css)({position:"relative",marginRight:x.spacing(.5)})),content:(0,t.css)({background:x.colors.background.primary,boxShadow:x.shadows.z3,position:"absolute",zIndex:x.zIndex.modal,width:"500px",top:"100%",borderRadius:x.shape.radius.default,border:`1px solid ${x.colors.border.weak}`,left:0,whiteSpace:"normal"}),body:(0,t.css)({display:"flex",height:`${A}px`}),description:(0,t.css)({color:x.colors.text.secondary,fontSize:x.typography.size.sm}),leftSide:(0,t.css)({width:"50% !important",borderRight:`1px solid ${x.colors.border.medium}`}),rightSide:(0,t.css)({width:"50%",padding:x.spacing(1)}),title:(0,t.css)({marginBottom:x.spacing(1)})}};function M(T,S){return S?S.length>34?T.spacing.gridSize*6.5:T.spacing.gridSize*4:0}},97287:(j,I,e)=>{"use strict";e.d(I,{C_:()=>i,aw:()=>n,jD:()=>r,x5:()=>s});const t=/^now$|^now\-(\d{1,10})([wdhms])$/,n=u=>({from:g(u.from),to:g(u.to)}),i=u=>{const o=l(u.from),m=l(u.to);return{from:o,to:m,display:`${o} to ${m}`}},s=(u,o=Date.now())=>r(u)?g(u)>Math.ceil(o/1e3)?{isValid:!1,errorMessage:"Can not enter value prior to January 1, 1970."}:{isValid:!0}:{isValid:!1,errorMessage:"Value not in relative time format."},r=u=>t.test(u),g=u=>{const o=t.exec(u);if(!o||o.length!==3)return 0;const[,m,c]=o,p=parseInt(m,10);return isNaN(p)?0:p*d[c]},d={w:604800,d:86400,h:3600,m:60,s:1},l=u=>u<=0?"now":u>=d.w&&u%d.w===0?`now-${u/d.w}w`:u>=d.d&&u%d.d===0?`now-${u/d.d}d`:u>=d.h&&u%d.h===0?`now-${u/d.h}h`:u>=d.m&&u%d.m===0?`now-${u/d.m}m`:`now-${u}s`},19820:(j,I,e)=>{"use strict";e.d(I,{F:()=>u,y:()=>o});var t=e(42844),n=e(76133),i=e(27702),s=e(99633),r=e(66310),g=e(73453),d=e(97289),l=e(26468);const u="time-of-day-picker-panel",o=({minuteStep:p=1,showHour:f=!0,showSeconds:E=!1,onChange:h,value:y,size:v="auto",disabled:D,disabledHours:a,disabledMinutes:C,disabledSeconds:P})=>{const b=(0,r.wW)(c);return i.createElement(n.Z,{className:(0,t.cx)((0,l.ht)()[v],b.input),popupClassName:(0,t.cx)(b.picker,u),defaultValue:(0,s.C_)(),onChange:M=>h((0,s.CQ)(M)),allowEmpty:!1,showSecond:E,value:(0,s.C_)(y),showHour:f,minuteStep:p,inputIcon:i.createElement(m,{wrapperStyle:b.caretWrapper}),disabled:D,disabledHours:a,disabledMinutes:C,disabledSeconds:P})},m=({wrapperStyle:p=""})=>i.createElement("div",{className:p},i.createElement(g.J,{name:"angle-down"})),c=p=>{const f=p.components.input.background,E=p.v1.palette.black,h=p.colors.background.secondary,y=p.shape.borderRadius(1),v=p.components.input.borderColor;return{caretWrapper:(0,t.css)({position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",display:"inline-block",textAlign:"right",color:p.colors.text.secondary}),picker:(0,t.css)({".rc-time-picker-panel-select":{fontSize:"14px",backgroundColor:f,borderColor:v,li:{outlineWidth:"2px","&.rc-time-picker-panel-select-option-selected":{backgroundColor:"inherit",border:`1px solid ${p.v1.palette.orange}`,borderRadius:y},"&:hover":{background:h},"&.rc-time-picker-panel-select-option-disabled":{color:p.colors.action.disabledText}}},".rc-time-picker-panel-inner":{boxShadow:`0px 4px 4px ${E}`,backgroundColor:f,borderColor:v,borderRadius:y,marginTop:"3px",".rc-time-picker-panel-input-wrap":{marginRight:"2px","&, .rc-time-picker-panel-input":{backgroundColor:f,paddingTop:"2px"}},".rc-time-picker-panel-combobox":{display:"flex"}}}),input:(0,t.css)({".rc-time-picker-input":{backgroundColor:f,borderRadius:y,borderColor:v,height:p.spacing(4),"&:focus":(0,d.getFocusStyles)(p),"&:disabled":{backgroundColor:p.colors.action.disabledBackground,color:p.colors.action.disabledText,border:`1px solid ${p.colors.action.disabledBackground}`,"&:focus":{boxShadow:"none"}}}})}}},95059:(j,I,e)=>{"use strict";e.d(I,{K:()=>h});var t=e(42844),n=e(27702),i=e(99633),s=e(8508),r=e(74639),g=e(80402),d=e(66310),l=e(8430),u=e(73453),o=e(1128),m=e(14749),c=e(49430),p=e(61899),f=e(87192);const E=()=>{},h=({value:v,onChange:D,onChangeTimeZone:a=E,clearable:C,hideTimeZone:P=!0,timeZone:b="browser",placeholder:M="Select time range",isReversed:T=!0,hideQuickRanges:S=!1,disabled:x=!1,showIcon:O=!1})=>{const[B,A]=(0,n.useState)(!1),V=(0,d.l4)(),W=y(V,x),w=H=>{H.stopPropagation(),H.preventDefault(),!x&&A(!B)},N=()=>{A(!1)},F=H=>{N(),D(H)},k=H=>{H.stopPropagation();const R=(0,i.CQ)(null),_=(0,i.CQ)(null);D({from:R,to:_,raw:{from:R,to:_}})};return n.createElement("div",{className:W.container},n.createElement("button",{type:"button",className:W.pickerInput,"aria-label":r.wl.components.TimePicker.openButton,onClick:w},O&&n.createElement(u.J,{name:"clock-nine",size:"sm",className:W.icon}),n.createElement(c.q,{value:v,timeZone:b,placeholder:M}),!x&&n.createElement("span",{className:W.caretIcon},(0,f.v)(v)&&C&&n.createElement(u.J,{className:W.clearIcon,name:"times",size:"lg",onClick:k}),n.createElement(u.J,{name:B?"angle-up":"angle-down",size:"lg"}))),B&&n.createElement(l.L,{includeButtonPress:!1,onClick:N},n.createElement(m.x,{timeZone:b,value:(0,f.v)(v)?v:(0,s.JK)(),onChange:F,quickOptions:p.r,onChangeTimeZone:a,className:W.content,hideTimeZone:P,isReversed:T,hideQuickRanges:S})))},y=(0,g.B)((v,D=!1)=>{const a=(0,o.H)({theme:v,invalid:!1});return{container:(0,t.css)({display:"flex",position:"relative"}),content:(0,t.css)({marginLeft:0,position:"absolute",top:"116%",zIndex:v.zIndex.dropdown}),pickerInput:(0,t.cx)(a.input,D&&a.inputDisabled,a.wrapper,(0,t.css)({display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",paddingRight:0,lineHeight:`${v.spacing.gridSize*4-2}px`})),caretIcon:(0,t.cx)(a.suffix,(0,t.css)({position:"relative",top:"-1px",marginLeft:v.spacing(.5)})),clearIcon:(0,t.css)({marginRight:v.spacing(.5),"&:hover":{color:v.colors.text.maxContrast}}),placeholder:(0,t.css)({color:v.colors.text.disabled,opacity:1}),icon:(0,t.css)({marginRight:v.spacing(.5)})}})},37424:(j,I,e)=>{"use strict";e.d(I,{IF:()=>P,Xc:()=>a,sU:()=>b});var t=e(42844),n=e(45809),i=e(91546),s=e(6714),r=e(27702),g=e(99633),d=e(60956),l=e(80369),u=e(76305),o=e(1726),m=e(74639),c=e(66310),p=e(70610),f=e(77720),E=e(32173),h=e(30973),y=e(80011),v=e(14749),D=e(61899);function a(x){const[O,B]=(0,r.useState)(!1),{value:A,onMoveBackward:V,onMoveForward:W,onZoom:w,timeZone:N,fiscalYearStartMonth:F,timeSyncButton:k,isSynced:H,history:R,onChangeTimeZone:_,onChangeFiscalYearStartMonth:G,hideQuickRanges:Y,widthOverride:X,isOnCanvas:Q}=x,se=We=>{x.onChange(We),B(!1)},Z=We=>{We.stopPropagation(),We.preventDefault(),B(!O)},le=()=>{B(!1)},oe=(0,r.createRef)(),{overlayProps:q,underlayProps:ne}=(0,s.Ir)({onClose:le,isDismissable:!0,isOpen:O},oe),{dialogProps:ge}=(0,n.R)({},oe),ae=(0,c.l4)(),re=(0,c.wW)(T),{modalBackdrop:De}=(0,E.J)(ae),he=(0,g.v9)(A.raw.from)||(0,g.v9)(A.raw.to),ye=H?"active":Q?"canvas":"default",ce=M(A,N);return r.createElement(f.h,{className:re.container},he&&r.createElement(h.h,{"aria-label":(0,p.t)("time-picker.range-picker.backwards-time-aria-label","Move time range backwards"),variant:ye,onClick:V,icon:"angle-left",narrow:!0}),r.createElement(y.u,{content:r.createElement(P,{timeRange:A,timeZone:N}),placement:"bottom",interactive:!0},r.createElement(h.h,{"data-testid":m.wl.components.TimePicker.openButton,"aria-label":(0,p.t)("time-picker.range-picker.current-time-selected","Time range selected: {{currentTimeRange}}",{currentTimeRange:ce}),"aria-controls":"TimePickerContent",onClick:Z,icon:"clock-nine",isOpen:O,variant:ye},r.createElement(b,{...x}))),O&&r.createElement("div",null,r.createElement("div",{role:"presentation",className:(0,t.cx)(De,re.backdrop),...ne}),r.createElement(i.MT,{contain:!0,autoFocus:!0},r.createElement("section",{className:re.content,ref:oe,...q,...ge},r.createElement(v.x,{timeZone:N,fiscalYearStartMonth:F,value:A,onChange:se,quickOptions:D.r,history:R,showHistory:!0,widthOverride:X,onChangeTimeZone:_,onChangeFiscalYearStartMonth:G,hideQuickRanges:Y})))),k,he&&r.createElement(h.h,{"aria-label":(0,p.t)("time-picker.range-picker.forwards-time-aria-label","Move time range forwards"),onClick:W,icon:"angle-right",narrow:!0,variant:ye}),r.createElement(y.u,{content:C,placement:"bottom"},r.createElement(h.h,{"aria-label":(0,p.t)("time-picker.range-picker.zoom-out-button","Zoom out time range"),onClick:w,icon:"search-minus",variant:ye})))}a.displayName="TimeRangePicker";const C=()=>r.createElement(r.Fragment,null,r.createElement(p.c,{i18nKey:"time-picker.range-picker.zoom-out-tooltip"},"Time range zoom out ",r.createElement("br",null)," CTRL+Z")),P=({timeRange:x,timeZone:O})=>{const B=(0,c.wW)(S);return r.createElement(r.Fragment,null,(0,d.dq)(x.from,{timeZone:O}),r.createElement("div",{className:"text-center"},r.createElement(p.c,{i18nKey:"time-picker.range-picker.to"},"to")),(0,d.dq)(x.to,{timeZone:O}),r.createElement("div",{className:"text-center"},r.createElement("span",{className:B.utc},(0,l.Vs)(O))))},b=(0,r.memo)(({hideText:x,value:O,timeZone:B})=>{const A=(0,c.wW)(S);return x?null:r.createElement("span",{className:A.container},r.createElement("span",null,M(O,B)),r.createElement("span",{className:A.utc},u.describeTimeRangeAbbreviation(O,B)))});b.displayName="TimePickerButtonLabel";const M=(x,O)=>{const B={to:o.isMathString(x.raw.to)?x.raw.to:x.to,from:o.isMathString(x.raw.from)?x.raw.from:x.from};return u.describeTimeRange(B,O)},T=x=>({container:(0,t.css)({position:"relative",display:"flex",verticalAlign:"middle"}),backdrop:(0,t.css)({display:"none",[x.breakpoints.down("sm")]:{display:"block"}}),content:(0,t.css)({position:"absolute",right:0,top:"116%",zIndex:x.zIndex.dropdown,[x.breakpoints.down("sm")]:{position:"fixed",right:"50%",top:"50%",transform:"translate(50%, -50%)",zIndex:x.zIndex.modal}})}),S=x=>({container:(0,t.css)({display:"flex",alignItems:"center",whiteSpace:"nowrap"}),utc:(0,t.css)({color:x.v1.palette.orange,fontSize:x.typography.size.sm,paddingLeft:"6px",lineHeight:"28px",verticalAlign:"bottom",fontWeight:x.typography.fontWeightMedium})})},8655:(j,I,e)=>{"use strict";e.d(I,{mg:()=>c,uT:()=>l});var t=e(42844),n=e(27702),i=e(33900),s=e(99633),r=e(58018),g=e(66310),d=e(73453);function l({onChange:p,from:f,to:E,timeZone:h}){const y=u(f,E),v=o(p,h),D=(0,g.wW)(c);return n.createElement(i.ZP,{selectRange:!0,next2Label:null,prev2Label:null,className:D.body,tileClassName:D.title,value:y,nextLabel:n.createElement(d.J,{name:"angle-right"}),prevLabel:n.createElement(d.J,{name:"angle-left"}),onChange:v,locale:"en"})}l.displayName="Body";function u(p,f,E=new Date){const h=p.toDate(),y=f.toDate(),v=(0,s.CQ)(h).isValid()?h:E,D=(0,s.CQ)(y).isValid()?y:E;return v>D?[D,v]:[v,D]}function o(p,f){return(0,n.useCallback)(E=>{if(!Array.isArray(E))return console.error("onCalendarChange: should be run in selectRange={true}");if(E[0]&&E[1]){const h=(0,r.J)(m(E[0]),{timeZone:f}),y=(0,r.J)(m(E[1]),{timeZone:f});p(h,y)}},[p,f])}function m(p){return[p.getFullYear(),p.getMonth(),p.getDate(),p.getHours(),p.getMinutes(),p.getSeconds()]}const c=p=>{const f=".react-calendar__tile--hasActive:not(.react-calendar__tile--range)";return{title:(0,t.css)({color:p.colors.text.primary,backgroundColor:p.colors.background.primary,fontSize:p.typography.size.md,border:"1px solid transparent","&:hover":{position:"relative"},"&:disabled":{color:p.colors.action.disabledText}}),body:(0,t.css)({zIndex:p.zIndex.modal,backgroundColor:p.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:p.colors.text.primary,border:0,fontWeight:p.typography.fontWeightMedium},".react-calendar__month-view__weekdays":{backgroundColor:"inherit",textAlign:"center",color:p.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},[`${f}, .react-calendar__tile--active, .react-calendar__tile--active:hover`]:{color:p.colors.primary.contrastText,fontWeight:p.typography.fontWeightMedium,background:p.colors.primary.main,boxShadow:"none",border:"0px"},".react-calendar__tile--rangeEnd, .react-calendar__tile--rangeStart":{padding:0,border:"0px",color:p.colors.primary.contrastText,fontWeight:p.typography.fontWeightMedium,background:p.colors.primary.main,abbr:{backgroundColor:p.colors.primary.main,borderRadius:"100px",display:"block",paddingTop:"2px",height:"26px"}},[`${f}, .react-calendar__tile--rangeStart`]:{borderTopLeftRadius:"20px",borderBottomLeftRadius:"20px"},[`${f}, .react-calendar__tile--rangeEnd`]:{borderTopRightRadius:"20px",borderBottomRightRadius:"20px"}})}}},14749:(j,I,e)=>{"use strict";e.d(I,{x:()=>ye});var t=e(42844),n=e(27702),i=e(99633),s=e(76305),r=e(74639),g=e(33716),d=e(66310),l=e(80402),u=e(97289),o=e(70610),m=e(29372),c=e(73453),p=e(89949),f=e(80369),E=e(40705),h=e(22209),y=e(28580),v=e(66670),D=e(15672),a=e(11959),C=e(28981),P=e(45701),b=e(61899);const M=Me=>{const{timeZone:be,fiscalYearStartMonth:Ke,timestamp:Ye=Date.now(),onChangeTimeZone:tt,onChangeFiscalYearStartMonth:nt}=Me,[Pt,xt]=(0,n.useState)(!1),[bt,Rt]=(0,n.useState)("tz"),ct=(0,n.useCallback)(Ce=>{Ce&&Ce.stopPropagation(),xt(!Pt)},[Pt,xt]),it=(0,d.l4)(),me=T(it);if(!(0,p.isString)(be))return null;const Ee=(0,f.Pr)(be,Ye);return Ee?n.createElement("div",null,n.createElement("section",{"aria-label":(0,o.t)("time-picker.footer.time-zone-selection","Time zone selection"),className:me.container},n.createElement("div",{className:me.timeZoneContainer},n.createElement("div",{className:me.timeZone},n.createElement(P.d,{title:Ee.name}),n.createElement("div",{className:me.spacer}),n.createElement(a.K,{info:Ee})),n.createElement(C.v,{timeZone:be,timestamp:Ye})),n.createElement("div",{className:me.spacer}),n.createElement(v.zx,{variant:"secondary",onClick:ct,size:"sm"},n.createElement(o.c,{i18nKey:"time-picker.footer.change-settings-button"},"Change time settings"))),Pt?n.createElement("div",{className:me.editContainer},n.createElement("div",null,n.createElement(E.S,{value:bt,options:[{label:(0,o.t)("time-picker.footer.time-zone-option","Time zone"),value:"tz"},{label:(0,o.t)("time-picker.footer.fiscal-year-option","Fiscal year"),value:"fy"}],onChange:Rt})),bt==="tz"?n.createElement("section",{"data-testid":r.wl.components.TimeZonePicker.containerV2,className:(0,t.cx)(me.timeZoneContainer,me.timeSettingContainer)},n.createElement(D.O,{includeInternal:!0,onChange:Ce=>{ct(),(0,p.isString)(Ce)&&tt(Ce)},onBlur:ct,menuShouldPortal:!1})):n.createElement("section",{"aria-label":r.wl.components.TimeZonePicker.containerV2,className:(0,t.cx)(me.timeZoneContainer,me.timeSettingContainer)},n.createElement(h.g,{className:me.fiscalYearField,label:(0,o.t)("time-picker.footer.fiscal-year-start","Fiscal year start month")},n.createElement(y.Ph,{value:Ke,menuShouldPortal:!1,options:b.E,onChange:Ce=>{nt&&nt(Ce.value??0)}})))):null):null},T=(0,l.B)(Me=>({container:(0,t.css)({borderTop:`1px solid ${Me.colors.border.weak}`,padding:"11px",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}),editContainer:(0,t.css)({borderTop:`1px solid ${Me.colors.border.weak}`,padding:"11px",justifyContent:"space-between",alignItems:"center"}),spacer:(0,t.css)({marginLeft:"7px"}),timeSettingContainer:(0,t.css)({paddingTop:Me.spacing(1)}),fiscalYearField:(0,t.css)({marginBottom:0}),timeZoneContainer:(0,t.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1}),timeZone:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"baseline",flexGrow:1})}));var S=e(21494),x=e(58018),O=e(60956),B=e(1726),A=e(80011),V=e(1128),W=e(45809),w=e(91546),N=e(6714),F=e(32173),k=e(8655);function H({onClose:Me,onApply:be}){const Ke=(0,d.wW)(R);return n.createElement("div",{className:Ke.container},n.createElement(v.zx,{className:Ke.apply,onClick:be},n.createElement(o.c,{i18nKey:"time-picker.calendar.apply-button"},"Apply time range")),n.createElement(v.zx,{variant:"secondary",onClick:Me},n.createElement(o.c,{i18nKey:"time-picker.calendar.cancel-button"},"Cancel")))}H.displayName="Footer";const R=Me=>({container:(0,t.css)({backgroundColor:Me.colors.background.primary,display:"flex",justifyContent:"center",padding:"10px",alignItems:"stretch"}),apply:(0,t.css)({marginRight:"4px",width:"100%",justifyContent:"center"})});function _({onClose:Me}){const be=(0,d.wW)(G);return n.createElement("div",{className:be.container},n.createElement(S.r,null,n.createElement(o.c,{i18nKey:"time-picker.calendar.select-time"},"Select a time range")),n.createElement(v.zx,{"aria-label":r.wl.components.TimePicker.calendar.closeButton,icon:"times",variant:"secondary",onClick:Me}))}_.displayName="Header";const G=Me=>({container:(0,t.css)({backgroundColor:Me.colors.background.primary,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"7px"})}),Y=(Me,be=!1)=>({container:(0,t.css)({top:0,position:"absolute",[`${be?"left":"right"}`]:"544px",boxShadow:Me.shadows.z3,backgroundColor:Me.colors.background.primary,zIndex:-1,border:`1px solid ${Me.colors.border.weak}`,borderRadius:"2px 0 0 2px","&:after":{display:"block",backgroundColor:Me.colors.background.primary,width:"19px",height:"100%",content:`${be?'""':'" "'}`,position:"absolute",top:0,right:"-19px",borderLeft:`1px solid ${Me.colors.border.weak}`}}),modal:(0,t.css)({boxShadow:Me.shadows.z3,left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)",zIndex:Me.zIndex.modal}),content:(0,t.css)({margin:"0 auto",width:"268px"})});function X(Me){const be=(0,d.l4)(),{modalBackdrop:Ke}=(0,F.J)(be),Ye=Y(be,Me.isReversed),{isOpen:tt,isFullscreen:nt,onClose:Pt}=Me,xt=n.createRef(),{dialogProps:bt}=(0,W.R)({"aria-label":r.wl.components.TimePicker.calendar.label},xt),{overlayProps:Rt}=(0,N.Ir)({isDismissable:!0,isOpen:tt,onClose:Pt},xt);return tt?nt?n.createElement(w.MT,{contain:!0,restoreFocus:!0,autoFocus:!0},n.createElement("section",{className:Ye.container,ref:xt,...Rt,...bt},n.createElement(_,{...Me}),n.createElement(k.uT,{...Me}))):n.createElement(N.Xj,null,n.createElement("div",{className:Ke}),n.createElement(w.MT,{contain:!0,autoFocus:!0,restoreFocus:!0},n.createElement("section",{className:Ye.modal,ref:xt,...Rt,...bt},n.createElement("div",{className:Ye.content,"aria-label":r.wl.components.TimePicker.calendar.label},n.createElement(_,{...Me}),n.createElement(k.uT,{...Me}),n.createElement(H,{...Me}))))):null}const Q=(0,n.memo)(X);X.displayName="TimePickerCalendar";const se={default:()=>(0,o.t)("time-picker.range-content.default-error",'Please enter a past date or "now"'),range:()=>(0,o.t)("time-picker.range-content.range-error",`"From" can't be after "To"`)},Z=Me=>{const{value:be,isFullscreen:Ke=!1,timeZone:Ye,onApply:tt,isReversed:nt,fiscalYearStartMonth:Pt}=Me,[xt,bt]=oe(be.raw.from,be.raw.to,Ye),Rt=(0,d.wW)(ge),[ct,it]=(0,n.useState)(xt),[me,Ee]=(0,n.useState)(bt),[Ce,Ae]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const[Ue,ue]=oe(be.raw.from,be.raw.to,Ye);it(Ue),Ee(ue)},[be.raw.from,be.raw.to,Ye]);const ze=(0,n.useCallback)(Ue=>{Ue.preventDefault(),Ae(!0)},[Ae]),Ie=(0,n.useCallback)(()=>{if(me.invalid||ct.invalid)return;const Ue={from:ct.value,to:me.value},ue=s.convertRawToRange(Ue,Ye,Pt);tt(ue)},[ct.invalid,ct.value,tt,Ye,me.invalid,me.value,Pt]),xe=(0,n.useCallback)((Ue,ue)=>{const[pe,$e]=oe(Ue,ue,Ye);it(pe),Ee($e)},[Ye]),Te=Ue=>{Ue.key==="Enter"&&Ie()},Oe=s.convertRawToRange({from:"now/fy",to:"now/fy"},Ye,Pt),ie=(0,o.t)("time-picker.range-content.fiscal-year","Fiscal year"),Le=n.createElement("div",{className:Rt.tooltip},s.isFiscal(be)?n.createElement(A.u,{content:`${ie}: ${Oe.from.format("MMM-DD")} - ${Oe.to.format("MMM-DD")}`},n.createElement(c.J,{name:"info-circle"})):null),Be=n.createElement(v.zx,{"aria-label":r.wl.components.TimePicker.calendar.openButton,icon:"calendar-alt",variant:"secondary",type:"button",onClick:ze});return n.createElement("div",null,n.createElement("div",{className:Rt.fieldContainer},n.createElement(h.g,{label:(0,o.t)("time-picker.range-content.from-input","From"),invalid:ct.invalid,error:ct.errorMessage},n.createElement(V.I,{onClick:Ue=>Ue.stopPropagation(),onChange:Ue=>xe(Ue.currentTarget.value,me.value),addonAfter:Be,onKeyDown:Te,"aria-label":r.wl.components.TimePicker.fromField,value:ct.value})),Le),n.createElement("div",{className:Rt.fieldContainer},n.createElement(h.g,{label:(0,o.t)("time-picker.range-content.to-input","To"),invalid:me.invalid,error:me.errorMessage},n.createElement(V.I,{onClick:Ue=>Ue.stopPropagation(),onChange:Ue=>xe(ct.value,Ue.currentTarget.value),addonAfter:Be,onKeyDown:Te,"aria-label":r.wl.components.TimePicker.toField,value:me.value})),Le),n.createElement(v.zx,{"data-testid":r.wl.components.TimePicker.applyTimeRange,type:"button",onClick:Ie},n.createElement(o.c,{i18nKey:"time-picker.range-content.apply-button"},"Apply time range")),n.createElement(Q,{isFullscreen:Ke,isOpen:Ce,from:(0,x.J)(ct.value),to:(0,x.J)(me.value),onApply:Ie,onClose:()=>Ae(!1),onChange:xe,timeZone:Ye,isReversed:nt}))};function le(Me,be,Ke){const Ye={from:Me,to:be},tt=s.convertRawToRange(Ye,Ke);return!(tt.from.isSame(tt.to)||tt.from.isBefore(tt.to))}function oe(Me,be,Ke){const Ye=q(Me,Ke),tt=q(be,Ke),nt=!ne(Ye,!1,Ke),Pt=!ne(tt,!0,Ke),xt=le(Ye,tt,Ke)&&!Pt;return[{value:Ye,invalid:nt||xt,errorMessage:xt&&!nt?se.range():se.default()},{value:tt,invalid:Pt,errorMessage:se.default()}]}function q(Me,be){return(0,i.v9)(Me)?(0,O.dq)(Me,{timeZone:be}):Me}function ne(Me,be,Ke){return(0,i.v9)(Me)?Me.isValid():B.isMathString(Me)?B.isValid(Me):(0,x.J)(Me,{roundUp:be,timeZone:Ke}).isValid()}function ge(Me){return{fieldContainer:(0,t.css)({display:"flex"}),tooltip:(0,t.css)({paddingLeft:Me.spacing(1),paddingTop:Me.spacing(3)})}}var ae=e(36042);const re=(Me,be)=>s.convertRawToRange({from:Me.from,to:Me.to},be),De=(Me,be)=>{const Ke=(0,O.dq)(Me.from,{timeZone:be}),Ye=(0,O.dq)(Me.to,{timeZone:be});return{from:Ke,to:Ye,display:`${Ke} to ${Ye}`}},he=Me=>{const{quickOptions:be=[],isReversed:Ke,isFullscreen:Ye,hideQuickRanges:tt,timeZone:nt,fiscalYearStartMonth:Pt,value:xt,onChange:bt,history:Rt,showHistory:ct,className:it,hideTimeZone:me,onChangeTimeZone:Ee,onChangeFiscalYearStartMonth:Ce}=Me,Ae=!Rt?.length,ze=Ye&&ct||!Ye&&(ct&&!Ae||!tt),Ie=(0,d.l4)(),xe=_e(Ie,Ke,tt,ze,Ye),Te=et(Rt,nt),Oe=we(xt.raw,be),[ie,Le]=(0,n.useState)(""),Be=be.filter(ue=>ue.display.toLowerCase().includes(ie.toLowerCase())),Ue=ue=>bt(re(ue));return n.createElement("div",{id:"TimePickerContent",className:(0,t.cx)(xe.container,it)},n.createElement("div",{className:xe.body},(!Ye||!tt)&&n.createElement("div",{className:xe.rightSide},n.createElement("div",{className:xe.timeRangeFilter},n.createElement(g.H,{width:0,autoFocus:!0,value:ie,onChange:Le,placeholder:(0,o.t)("time-picker.content.filter-placeholder","Search quick ranges")})),n.createElement(m.$,null,!Ye&&n.createElement(ce,{...Me,historyOptions:Te}),!tt&&n.createElement(ae.V,{options:Be,onChange:Ue,value:Oe}))),Ye&&n.createElement("div",{className:xe.leftSide},n.createElement(We,{...Me,historyOptions:Te}))),!me&&Ye&&n.createElement(M,{timeZone:nt,fiscalYearStartMonth:Pt,onChangeTimeZone:Ee,onChangeFiscalYearStartMonth:Ce}))},ye=Me=>{const{widthOverride:be}=Me,Ke=(0,d.l4)(),Ye=(be||window.innerWidth)>=Ke.breakpoints.values.lg;return n.createElement(he,{...Me,isFullscreen:Ye})},ce=Me=>{const{value:be,hideQuickRanges:Ke,onChange:Ye,timeZone:tt,historyOptions:nt=[],showHistory:Pt}=Me,xt=(0,d.l4)(),bt=Ge(xt),Rt=(0,i.v9)(be.raw.from)||(0,i.v9)(be.raw.to),[ct,it]=(0,n.useState)(!Rt),me=Ke?!1:ct,Ee=Ce=>Ye(re(Ce,tt));return n.createElement("fieldset",null,n.createElement("div",{className:bt.header},n.createElement("button",{type:"button",className:bt.expandButton,onClick:()=>{Ke||it(!me)},"data-testid":r.wl.components.TimePicker.absoluteTimeRangeTitle,"aria-expanded":!me,"aria-controls":"expanded-timerange"},n.createElement(S.r,null,n.createElement(o.c,{i18nKey:"time-picker.absolute.title"},"Absolute time range")),!Ke&&n.createElement(c.J,{name:me?"angle-down":"angle-up"}))),!me&&n.createElement("div",{className:bt.body,id:"expanded-timerange"},n.createElement("div",{className:bt.form},n.createElement(Z,{value:be,onApply:Ye,timeZone:tt,isFullscreen:!1})),Pt&&n.createElement(ae.V,{title:(0,o.t)("time-picker.absolute.recent-title","Recently used absolute ranges"),options:nt,onChange:Ee,placeholderEmpty:null})))},We=Me=>{const{onChange:be,value:Ke,timeZone:Ye,fiscalYearStartMonth:tt,isReversed:nt,historyOptions:Pt}=Me,xt=(0,d.l4)(),bt=qe(xt,Me.hideQuickRanges),Rt=ct=>be(re(ct,Ye));return n.createElement(n.Fragment,null,n.createElement("div",{className:bt.container},n.createElement("div",{className:bt.title,"data-testid":r.wl.components.TimePicker.absoluteTimeRangeTitle},n.createElement(S.r,null,n.createElement(o.c,{i18nKey:"time-picker.absolute.title"},"Absolute time range"))),n.createElement(Z,{value:Ke,timeZone:Ye,fiscalYearStartMonth:tt,onApply:be,isFullscreen:!0,isReversed:nt})),Me.showHistory&&n.createElement("div",{className:bt.recent},n.createElement(ae.V,{title:(0,o.t)("time-picker.absolute.recent-title","Recently used absolute ranges"),options:Pt||[],onChange:Rt,placeholderEmpty:n.createElement(ke,null)})))},ke=(0,n.memo)(()=>{const Me=(0,d.l4)(),be=st(Me);return n.createElement("div",{className:be.container},n.createElement(o.c,{i18nKey:"time-picker.content.empty-recent-list"},n.createElement("div",null,n.createElement("span",null,"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.")),n.createElement("div",null,n.createElement("a",{className:be.link,href:"https://grafana.com/docs/grafana/latest/dashboards/time-range-controls",target:"_new"},"Read the documentation"),n.createElement("span",null," to find out more about how to enter custom time ranges."))))});function et(Me,be){return!Array.isArray(Me)||Me.length===0?[]:Me.map(Ke=>De(Ke,be))}ke.displayName="EmptyRecentList";const we=(Me,be)=>(0,n.useMemo)(()=>{if(s.isRelativeTimeRange(Me))return be.find(Ke=>Ke.from===Me.from&&Ke.to===Me.to)},[Me,be]),_e=(0,l.B)((Me,be,Ke,Ye,tt)=>({container:(0,t.css)({background:Me.colors.background.primary,boxShadow:Me.shadows.z3,width:`${tt?"546px":"262px"}`,borderRadius:"2px",border:`1px solid ${Me.colors.border.weak}`,[`${be?"left":"right"}`]:0}),body:(0,t.css)({display:"flex",flexDirection:"row-reverse",height:`${Ye?"381px":"217px"}`,maxHeight:"100vh"}),leftSide:(0,t.css)({display:"flex",flexDirection:"column",borderRight:`${be?"none":`1px solid ${Me.colors.border.weak}`}`,width:`${Ke?"100%":"60%"}`,overflow:"hidden",order:be?1:0}),rightSide:(0,t.css)({width:`${tt?"40%":"100%"}; !important`,borderRight:be?`1px solid ${Me.colors.border.weak}`:"none",display:"flex",flexDirection:"column"}),timeRangeFilter:(0,t.css)({padding:Me.spacing(1)}),spacing:(0,t.css)({marginTop:"16px"})})),Ge=(0,l.B)(Me=>({header:(0,t.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${Me.colors.border.weak}`,padding:"7px 9px 7px 9px"}),expandButton:(0,t.css)({backgroundColor:"transparent",border:"none",display:"flex",width:"100%","&:focus-visible":(0,u.getFocusStyles)(Me)}),body:(0,t.css)({borderBottom:`1px solid ${Me.colors.border.weak}`}),form:(0,t.css)({padding:"7px 9px 7px 9px"})})),qe=(0,l.B)((Me,be)=>({container:(0,t.css)({paddingTop:"9px",paddingLeft:"11px",paddingRight:be?"11px":"20%"}),title:(0,t.css)({marginBottom:"11px"}),recent:(0,t.css)({flexGrow:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",paddingTop:Me.spacing(1)})})),st=(0,l.B)(Me=>({container:(0,t.css)({padding:"12px",margin:"12px","a, span":{fontSize:"13px"}}),link:(0,t.css)({color:Me.colors.text.link})}))},21494:(j,I,e)=>{"use strict";e.d(I,{r:()=>r});var t=e(42844),n=e(27702),i=e(66310);const s=g=>({text:(0,t.css)({fontSize:g.typography.size.md,fontWeight:g.typography.fontWeightMedium,color:g.colors.text.primary,margin:0,display:"flex"})}),r=(0,n.memo)(({children:g})=>{const d=(0,i.wW)(s);return n.createElement("h3",{className:d.text},g)});r.displayName="TimePickerTitle"},49430:(j,I,e)=>{"use strict";e.d(I,{q:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(37424),r=e(87192);const g=(0,n.memo)(function({hideText:u,value:o,timeZone:m="browser",placeholder:c="No time range selected",className:p}){const f=(0,i.wW)(d);return u?null:n.createElement("span",{className:p},(0,r.v)(o)?n.createElement(s.sU,{value:o,timeZone:m}):n.createElement("span",{className:f.placeholder},c))}),d=l=>({placeholder:(0,t.css)({color:l.colors.text.disabled,opacity:1})})},36042:(j,I,e)=>{"use strict";e.d(I,{V:()=>p});var t=e(42844),n=e(27702),i=e(80402),s=e(70610),r=e(21494),g=e(66117),d=e(66310),l=e(97289);const u=y=>({container:(0,t.css)({display:"flex",alignItems:"center",flexDirection:"row-reverse",justifyContent:"space-between"}),selected:(0,t.css)({background:y.colors.action.selected,fontWeight:y.typography.fontWeightMedium}),radio:(0,t.css)({opacity:0,width:"0 !important","&:focus-visible + label":(0,l.getFocusStyles)(y)}),label:(0,t.css)({cursor:"pointer",flex:1,padding:"7px 9px 7px 9px","&:hover":{background:y.colors.action.hover,cursor:"pointer"}})}),o=(0,n.memo)(({value:y,onSelect:v,selected:D=!1,name:a})=>{const C=(0,d.wW)(u),P=(0,g.Z)();return n.createElement("li",{className:(0,t.cx)(C.container,D&&C.selected)},n.createElement("input",{className:C.radio,checked:D,name:a,type:"checkbox",id:P,onChange:()=>v(y)}),n.createElement("label",{className:C.label,htmlFor:P},y.display))});o.displayName="TimeRangeOption";const m=(0,i.B)(()=>({title:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px 5px 9px"})})),c=(0,i.B)(()=>({grow:(0,t.css)({flexGrow:1,alignItems:"flex-start"})})),p=y=>{const v=m(),{title:D,options:a,placeholderEmpty:C}=y;return typeof C<"u"&&a.length<=0?n.createElement(n.Fragment,null,C):D?n.createElement("section",{"aria-label":D},n.createElement("fieldset",null,n.createElement("div",{className:v.title},n.createElement(r.r,null,D)),n.createElement(f,{...y}))):n.createElement(f,{...y})},f=({options:y,value:v,onChange:D,title:a})=>{const C=c();return n.createElement(n.Fragment,null,n.createElement("ul",{"aria-roledescription":(0,s.t)("time-picker.time-range.aria-role","Time range selection")},y.map((P,b)=>n.createElement(o,{key:E(P,b),value:P,selected:h(P,v),onSelect:D,name:a??(0,s.t)("time-picker.time-range.default-title","Time ranges")}))),n.createElement("div",{className:C.grow}))};function E(y,v){return`${y.from}-${y.to}-${v}`}function h(y,v){return!v||!y?!1:v.from===y.from&&v.to===y.to}},15672:(j,I,e)=>{"use strict";e.d(I,{O:()=>D});var t=e(89949),n=e(27702),i=e(80369),s=e(70610),r=e(28580),g=e(42844),d=e(66310);const l=T=>{const{children:S,label:x}=T,O=(0,d.wW)(u);return x?n.createElement("div",null,n.createElement("div",{className:O.header},n.createElement("span",{className:O.label},x)),S):n.createElement("div",null,S)},u=T=>({header:(0,g.css)({padding:"7px 10px",width:"100%",borderTop:`1px solid ${T.colors.border.weak}`,textTransform:"capitalize"}),label:(0,g.css)({fontSize:T.typography.size.sm,color:T.colors.text.secondary,fontWeight:T.typography.fontWeightMedium})});var o=e(28981),m=e(80402),c=e(73453),p=e(11959),f=e(45701);const E="tz-utc-offset",h=T=>{const{children:S,innerProps:x,innerRef:O,data:B,isSelected:A,isFocused:V}=T,W=(0,d.l4)(),w=v(W),N=Date.now(),F=(0,g.cx)(w.container,V&&w.containerFocused);if(!(0,t.isString)(B.value))return null;const k=(0,i.Pr)(B.value,N);return n.createElement("div",{className:F,...x,ref:O,"aria-label":"Select option"},n.createElement("div",{className:(0,g.cx)(w.leftColumn,w.row)},n.createElement("div",{className:(0,g.cx)(w.leftColumn,w.wideRow)},n.createElement(f.d,{title:S}),n.createElement("div",{className:w.spacer}),n.createElement(p.K,{info:k})),n.createElement("div",{className:w.rightColumn},n.createElement(o.v,{timeZone:k?.ianaName||B.value,timestamp:N,className:E}),A&&n.createElement("span",null,n.createElement(c.J,{name:"check"})))))},y=T=>{const{children:S,innerProps:x,innerRef:O,data:B,isSelected:A,isFocused:V}=T,W=(0,d.l4)(),w=v(W),N=Date.now(),F=(0,g.cx)(w.container,V&&w.containerFocused);if(!(0,t.isString)(B.value))return null;const k=(0,i.Pr)(B.value,N);return n.createElement("div",{className:F,...x,ref:O,"aria-label":"Select option"},n.createElement("div",{className:w.body},n.createElement("div",{className:w.row},n.createElement("div",{className:w.leftColumn},n.createElement(f.d,{title:S})),n.createElement("div",{className:w.rightColumn},A&&n.createElement("span",null,n.createElement(c.J,{name:"check"})))),n.createElement("div",{className:w.row},n.createElement("div",{className:w.leftColumn},n.createElement(p.K,{info:k})),n.createElement("div",{className:w.rightColumn},n.createElement(o.v,{timestamp:N,timeZone:k?.ianaName||B.value,className:E})))))},v=(0,m.B)(T=>({container:(0,g.css)({display:"flex",alignItems:"center",flexDirection:"row",flexShrink:0,whiteSpace:"nowrap",cursor:"pointer",padding:"6px 8px 4px","&:hover":{background:T.colors.action.hover}}),containerFocused:(0,g.css)({background:T.colors.action.hover}),body:(0,g.css)({display:"flex",fontWeight:T.typography.fontWeightMedium,flexDirection:"column",flexGrow:1}),row:(0,g.css)({display:"flex",flexDirection:"row"}),leftColumn:(0,g.css)({flexGrow:1,textOverflow:"ellipsis"}),rightColumn:(0,g.css)({justifyContent:"flex-end",alignItems:"center"}),wideRow:(0,g.css)({display:"flex",flexDirection:"row",alignItems:"baseline"}),spacer:(0,g.css)({marginLeft:"6px"})})),D=T=>{const{onChange:S,width:x,autoFocus:O=!1,onBlur:B,value:A,includeInternal:V=!1,disabled:W=!1,inputId:w,menuShouldPortal:N=!0,openMenuOnFocus:F=!0}=T,k=a(V),H=C(k,A),R=b(),_=x&&x<=45?y:h,G=(0,n.useCallback)(Y=>{if(!Y||!(0,t.isString)(Y.value))return S(A);S(Y.value)},[S,A]);return n.createElement(r.Ph,{inputId:w,value:H,placeholder:(0,s.t)("time-picker.zone.select-search-input","Type to search (country, city, abbreviation)"),autoFocus:O,menuShouldPortal:N,openMenuOnFocus:F,width:x,filterOption:R,options:k,onChange:G,onBlur:B,components:{Option:_,Group:l},disabled:W,"aria-label":(0,s.t)("time-picker.zone.select-aria-label","Time zone picker")})},a=T=>{const S=Date.now();return(0,i.$8)(T).map(O=>{const B=O.zones.reduce((A,V)=>{const W=(0,i.Pr)(V,S);return W&&A.push({label:W.name,value:W.zone,searchIndex:M(W,S)}),A},[]);return{label:O.name,options:B}})},C=(T,S)=>(0,n.useMemo)(()=>{if(S===void 0)return;const x=(0,t.toLower)(S);return T.find(B=>B.label?x.startsWith((0,t.toLower)(B.label)):P(x))?.options.find(B=>(0,t.isEmpty)(x)?B.value===i.RQ.default:(0,t.toLower)(B.value)===x)},[T,S]),P=T=>{switch(T){case i.RQ.default:case i.RQ.localBrowserTime:case i.RQ.utc:return!0;default:return!1}},b=()=>(0,n.useCallback)((T,S)=>!S||!T.data||!T.data.searchIndex?!0:T.data.searchIndex.indexOf((0,t.toLower)(S))>-1,[]),M=(T,S)=>{const x=[(0,t.toLower)(T.name),(0,t.toLower)(T.abbreviation),(0,t.toLower)((0,o.k)(S,T.zone))];for(const O of T.countries)x.push((0,t.toLower)(O.name)),x.push((0,t.toLower)(O.code));return x.join("|")}},11959:(j,I,e)=>{"use strict";e.d(I,{K:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({info:d})=>{const l=(0,i.wW)(g),u=r(d);return d?n.createElement("div",{className:l.description},u):null},r=d=>(0,n.useMemo)(()=>{const l=[];if(!d)return"";if(d.name==="Europe/Simferopol")return"Ukraine, EEST";if(d.countries.length>0){const u=d.countries[0];l.push(u.name)}return d.abbreviation&&l.push(d.abbreviation),l.join(", ")},[d]),g=d=>({description:(0,t.css)({fontWeight:"normal",fontSize:d.typography.size.sm,color:d.colors.text.secondary,whiteSpace:"normal",textOverflow:"ellipsis"})})},28981:(j,I,e)=>{"use strict";e.d(I,{k:()=>l,v:()=>d});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(60956),g=e(66310);const d=o=>{const{timestamp:m,timeZone:c,className:p}=o,f=(0,g.wW)(u);return(0,n.isString)(c)?s.createElement(s.Fragment,null,s.createElement("span",{className:(0,t.cx)(f.offset,p)},l(m,c))):null},l=(o,m)=>{const c=(0,r.dq)(o,{timeZone:m,format:"Z"});return c==="+00:00"?"UTC":`UTC${c}`},u=o=>{const m=(0,t.css)({fontWeight:"normal",fontSize:o.typography.size.sm,color:o.colors.text.secondary,whiteSpace:"normal"});return{offset:(0,t.css)(m,{color:o.colors.text.primary,background:o.colors.background.secondary,padding:"2px 5px",borderRadius:"2px",marginLeft:"4px"})}}},45701:(j,I,e)=>{"use strict";e.d(I,{d:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({title:g})=>{const d=(0,i.wW)(r);return g?n.createElement("span",{className:d.title},g):null},r=g=>({title:(0,t.css)({fontWeight:g.typography.fontWeightRegular,textOverflow:"ellipsis"})})},63014:(j,I,e)=>{"use strict";e.d(I,{z:()=>r});var t=e(27702),n=e(74639),i=e(28580);const s=[{value:"",label:"Default"},{value:"saturday",label:"Saturday"},{value:"sunday",label:"Sunday"},{value:"monday",label:"Monday"}],r=g=>{const{onChange:d,width:l,autoFocus:u=!1,onBlur:o,value:m,disabled:c=!1,inputId:p}=g,f=(0,t.useCallback)(E=>{E.value!==void 0&&d(E.value)},[d]);return t.createElement(i.Ph,{inputId:p,value:s.find(E=>E.value===m)?.value,placeholder:n.wl.components.WeekStartPicker.placeholder,autoFocus:u,openMenuOnFocus:!0,width:l,options:s,onChange:f,onBlur:o,disabled:c})}},61899:(j,I,e)=>{"use strict";e.d(I,{E:()=>n,r:()=>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}]},87192:(j,I,e)=>{"use strict";e.d(I,{J:()=>s,v:()=>r});var t=e(99633),n=e(1726),i=e(58018);function s(g,d,l){return(0,t.v9)(g)?g.isValid():n.isMathString(g)?n.isValid(g):(0,i.J)(g,{roundUp:d,timeZone:l}).isValid()}function r(g){return n.isValid(g.from)&&n.isValid(g.to)}},238:(j,I,e)=>{"use strict";e.d(I,{i:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({direction:g="horizontal"})=>{const d=(0,i.l4)(),l=r(d);return g==="vertical"?n.createElement("div",{className:l.verticalDivider}):n.createElement("hr",{className:l.horizontalDivider})};s.displayName="Divider";const r=g=>({horizontalDivider:(0,t.css)({borderTop:`1px solid ${g.colors.border.weak}`,margin:g.spacing(2,0),width:"100%"}),verticalDivider:(0,t.css)({borderRight:`1px solid ${g.colors.border.weak}`,margin:g.spacing(0,.5),height:"100%"})})},14574:(j,I,e)=>{"use strict";e.d(I,{d:()=>c});var t=e(42844),n=e(45809),i=e(91546),s=e(6714),r=e(63451),g=e(27702),d=e(74639),l=e(66310),u=e(66670),o=e(29372),m=e(21323);function c({children:E,onClose:h,closeOnMaskClick:y=!0,scrollableContent:v=!1,title:D,subtitle:a,width:C,size:P="md",tabs:b}){const M=(0,l.wW)(f),T=g.useRef(null),{dialogProps:S,titleProps:x}=(0,n.R)({},T),{overlayProps:O}=(0,s.Ir)({isDismissable:!1,isOpen:!0,onClose:h},T);p();const B=(0,t.cx)(M.drawer,!C&&M.sizes[P]),A=g.createElement("div",{className:M.content},E);return g.createElement(r.Z,{open:!0,onClose:h,placement:"right",width:C??"",getContainer:".main-view",className:M.drawerContent,rootClassName:B,motion:{motionAppear:!0,motionName:M.drawerMotion},maskClassName:M.mask,maskClosable:y,maskMotion:{motionAppear:!0,motionName:M.maskMotion}},g.createElement(i.MT,{restoreFocus:!0,contain:!0,autoFocus:!0},g.createElement("div",{"aria-label":typeof D=="string"?d.wl.components.Drawer.General.title(D):d.wl.components.Drawer.General.title("no title"),className:M.container,...O,...S,ref:T},typeof D=="string"&&g.createElement("div",{className:(0,t.cx)(M.header,!!b&&M.headerWithTabs)},g.createElement("div",{className:M.actions},g.createElement(u.zx,{icon:"times",variant:"secondary",fill:"text",onClick:h,"aria-label":d.wl.components.Drawer.General.close})),g.createElement("div",{className:M.titleWrapper},g.createElement(m.x,{element:"h3",...x},D),a&&g.createElement("div",{className:M.subtitle},a),b&&g.createElement("div",{className:M.tabsWrapper},b))),typeof D!="string"&&D,g.createElement("div",{className:M.contentScroll},v?g.createElement(o.$,{autoHeightMin:"100%"},A):A))))}function p(){(0,g.useEffect)(()=>{if(document.body)return document.body.classList.add("body-drawer-open"),()=>{document.body.classList.remove("body-drawer-open")}},[])}const f=E=>({container:(0,t.css)({display:"flex",flexDirection:"column",height:"100%",flex:"1 1 0",minHeight:"100%"}),drawer:(0,t.css)({".main-view &":{top:81},".main-view--search-bar-hidden &":{top:41},".main-view--chrome-hidden &":{top:0},".rc-drawer-content-wrapper":{boxShadow:E.shadows.z3,[E.breakpoints.down("sm")]:{width:`calc(100% - ${E.spacing(2)}) !important`,minWidth:"0 !important"}}}),sizes:{sm:(0,t.css)({".rc-drawer-content-wrapper":{label:"drawer-sm",width:"25vw",minWidth:E.spacing(48)}}),md:(0,t.css)({".rc-drawer-content-wrapper":{label:"drawer-md",width:"50vw",minWidth:E.spacing(60)}}),lg:(0,t.css)({".rc-drawer-content-wrapper":{label:"drawer-lg",width:"75vw",minWidth:E.spacing(93),[E.breakpoints.down("md")]:{width:`calc(100% - ${E.spacing(2)}) !important`,minWidth:0}}})},drawerContent:(0,t.css)({backgroundColor:`${E.colors.background.primary} !important`,display:"flex",flexDirection:"column",overflow:"hidden",zIndex:E.zIndex.dropdown}),drawerMotion:(0,t.css)({"&-appear":{transform:"translateX(100%)",transition:"none !important","&-active":{transition:`${E.transitions.create("transform")} !important`,transform:"translateX(0)"}}}),mask:(0,t.css)({backgroundColor:"transparent",position:"fixed","&:before":{backgroundColor:`${E.components.overlay.background} !important`,backdropFilter:"blur(1px)",bottom:0,content:'""',left:0,position:"fixed",right:0,".main-view &":{top:81},".main-view--search-bar-hidden &":{top:41},".main-view--chrome-hidden &":{top:0}}}),maskMotion:(0,t.css)({"&-appear":{opacity:0,"&-active":{opacity:1,transition:E.transitions.create("opacity")}}}),header:(0,t.css)({flexGrow:0,padding:E.spacing(3,2),borderBottom:`1px solid ${E.colors.border.weak}`}),headerWithTabs:(0,t.css)({borderBottom:"none"}),actions:(0,t.css)({position:"absolute",right:E.spacing(1),top:E.spacing(2)}),titleWrapper:(0,t.css)({overflowWrap:"break-word"}),subtitle:(0,t.css)({color:E.colors.text.secondary,paddingTop:E.spacing(1)}),content:(0,t.css)({padding:E.spacing(2),height:"100%",flexGrow:1}),contentScroll:(0,t.css)({minHeight:0,flex:1}),tabsWrapper:(0,t.css)({paddingLeft:E.spacing(2),margin:E.spacing(2,-1,-3,-3)})})},70725:(j,I,e)=>{"use strict";e.d(I,{d:()=>f});var t=e(42844),n=e(13168),i=e(91546),s=e(5980),r=e(5927),g=e(27702),d=e(66310),l=e(77720),u=e(8430),o=e(89746),m=e(79655),c=e(30973);const p=h=>{const{className:y,options:v,value:D,onChange:a,narrow:C,variant:P,...b}=h,M=(0,d.wW)(E),T=(0,r.W)({}),S=g.useRef(null),{menuTriggerProps:x,menuProps:O}=(0,s.u4)({},T,S),{buttonProps:B}=(0,n.U)(x,S),A=V=>{a(V),T.close()};return g.createElement(l.h,{className:M.wrapper},g.createElement(c.h,{className:y,isOpen:T.isOpen,narrow:C,variant:P,ref:S,...B,...b},D?.label||(D?.value!=null?String(D?.value):null)),T.isOpen&&g.createElement("div",{className:M.menuWrapper},g.createElement(u.L,{onClick:T.close,parent:document,includeButtonPress:!1},g.createElement(i.MT,{contain:!0,autoFocus:!0,restoreFocus:!0},g.createElement(o.v,{tabIndex:-1,onClose:T.close,...O,autoFocus:!!O.autoFocus},v.map(V=>g.createElement(m.s,{key:`${V.value}`,label:V.label??String(V.value),onClick:()=>A(V),active:V.value===D?.value,ariaChecked:V.value===D?.value,ariaLabel:V.ariaLabel||V.label,role:"menuitemradio"})))))))};p.displayName="ButtonSelect";const f=g.memo(p),E=h=>({wrapper:(0,t.css)({position:"relative",display:"inline-flex"}),menuWrapper:(0,t.css)({position:"absolute",zIndex:h.zIndex.dropdown,top:h.spacing(4),right:0})})},80434:(j,I,e)=>{"use strict";e.d(I,{L:()=>l});var t=e(42844),n=e(91546),i=e(27702),s=e(66609),r=e(42358),g=e(66258),d=e(52995);const l=i.memo(({children:o,overlay:m,placement:c,offset:p,onVisibleChange:f})=>{const[E,h]=(0,i.useState)(!1),y=(0,i.useRef)(null);(0,i.useEffect)(()=>{f?.(E)},[f,E]);const{getArrowProps:v,getTooltipProps:D,setTooltipRef:a,setTriggerRef:C,visible:P}=(0,s.O)({visible:E,placement:c,onVisibleChange:h,interactive:!0,delayHide:0,delayShow:0,offset:p??[0,8],trigger:["click"]}),b=150,M=u(b),T=()=>{h(!1)},S=x=>{(x.key==="Escape"||x.key==="Tab")&&h(!1)};return i.createElement(i.Fragment,null,i.cloneElement(o,{ref:C}),P&&i.createElement(d.h_,null,i.createElement(n.MT,{autoFocus:!0,restoreFocus:!0,contain:!0},i.createElement("div",{ref:a,...D(),onClick:T,onKeyDown:S},i.createElement("div",{...v({className:"tooltip-arrow"})}),i.createElement(r.Z,{nodeRef:y,appear:!0,in:!0,timeout:{appear:b,exit:0,enter:0},classNames:M},i.createElement("div",{ref:y},g.renderOrCallToRender(m,{})))))))});l.displayName="Dropdown";const u=o=>({appear:(0,t.css)({opacity:"0",position:"relative",transform:"scaleY(0.5)",transformOrigin:"top"}),appearActive:(0,t.css)({opacity:"1",transform:"scaleY(1)",transition:`transform ${o}ms cubic-bezier(0.2, 0, 0.2, 1), opacity ${o}ms cubic-bezier(0.2, 0, 0.2, 1)`})})},10701:(j,I,e)=>{"use strict";e.d(I,{K:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({children:g})=>{const d=(0,i.wW)(r);return n.createElement("div",{className:d.container},g)},r=g=>({container:(0,t.css)({borderLeft:`3px solid ${g.colors.info.main}`,backgroundColor:`${g.colors.background.secondary}`,padding:g.spacing(2),minWidth:"350px",borderRadius:g.shape.radius.default,marginBottom:g.spacing(4)})})},37647:(j,I,e)=>{"use strict";e.d(I,{Pf:()=>d,SV:()=>r,z4:()=>g});var t=e(27702),n=e(75308),i=e(63439),s=e(13431);class r extends t.PureComponent{constructor(){super(...arguments),this.state={error:null,errorInfo:null}}componentDidCatch(u,o){n.s?.api?.pushError(u),this.setState({error:u,errorInfo:o}),this.props.onError&&this.props.onError(u)}componentDidUpdate(u){const{dependencies:o,onRecover:m}=this.props;if(this.state.error&&o&&u.dependencies){for(let c=0;c<o.length;c++)if(o[c]!==u.dependencies[c]){this.setState({error:null,errorInfo:null}),m&&m();break}}}render(){const{children:u}=this.props,{error:o,errorInfo:m}=this.state;return u({error:o,errorInfo:m})}}class g extends t.PureComponent{render(){const{title:u,children:o,style:m,dependencies:c}=this.props;return t.createElement(r,{dependencies:c},({error:p,errorInfo:f})=>f?m==="alertbox"?t.createElement(i.b,{title:u||""},t.createElement("details",{style:{whiteSpace:"pre-wrap"}},p&&p.toString(),t.createElement("br",null),f.componentStack)):t.createElement(s.X,{title:u||"",error:p,errorInfo:f}):o)}}g.defaultProps={title:"An unexpected error happened",style:"alertbox"};function d(l,u={}){const o=m=>t.createElement(g,{...u},t.createElement(l,{...m}));return o.displayName="WithErrorBoundary",o}},13431:(j,I,e)=>{"use strict";e.d(I,{X:()=>r});var t=e(42844),n=e(27702),i=e(80402);const s=(0,i.B)(()=>(0,t.css)({width:"500px",margin:"64px auto"})),r=({error:g,errorInfo:d,title:l})=>n.createElement("div",{className:s()},n.createElement("h2",null,l),n.createElement("details",{style:{whiteSpace:"pre-wrap"}},g&&g.toString(),n.createElement("br",null),d&&d.componentStack));r.displayName="ErrorWithStack"},79399:(j,I,e)=>{"use strict";e.d(I,{A_:()=>E,Yo:()=>c});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(32335),g=e(42079),d=e(21609),l=e(66310),u=e(63439),o=e(73453),m=e(35845);function c({options:a,children:C,readAs:P,onLoad:b,fileListRenderer:M,onFileRemove:T}){const[S,x]=(0,s.useState)([]),[O,B]=(0,s.useState)([]),A=(0,d.Cf)("decbytes")(a?.maxSize?a?.maxSize:0),V=(0,s.useCallback)((Q,se)=>{x(Z=>Z.map(le=>(le.id===Q.id&&se(le),le)))},[]),W=(0,s.useCallback)((Q,se,Z)=>{let le=Q.map(v);if(a?.multiple===!1?x(le):x(oe=>[...oe,...le]),G(se),a?.onDrop)a.onDrop(Q,se,Z);else for(const oe of le){const q=new FileReader,ne=()=>{P?q[P](oe.file):q.readAsText(oe.file)};V(oe,ge=>{ge.abortUpload=()=>{q.abort()},ge.retryUpload=()=>{V(oe,ae=>{ae.error=null,ae.progress=void 0}),ne()}}),q.onabort=()=>{V(oe,ge=>{ge.error=new DOMException("Aborted")})},q.onprogress=ge=>{V(oe,ae=>{ae.progress=ge.loaded})},q.onload=()=>{b?.(q.result)},q.onerror=()=>{V(oe,ge=>{ge.error=q.error})},ne()}},[b,a,P,V]),w=Q=>{const se=S.filter(Z=>Q.id!==Z.id);x(se),T?.(Q)},{getRootProps:N,getInputProps:F,isDragActive:k}=(0,r.uI)({...a,useFsAccessApi:!1,onDrop:W,accept:f(a?.accept)}),H=(0,l.l4)(),R=D(H,k),_=S.map(Q=>M?M(Q,w):s.createElement(m.K,{key:Q.id,file:Q,removeFile:w})),G=Q=>{let se=[];Q.map(Z=>{Z.errors.map(le=>{se.findIndex(oe=>oe.code===le.code&&oe.message===le.message)===-1&&se.push(le)})}),B(se)},Y=Q=>s.createElement("div",{className:R.errorAlert},s.createElement(u.b,{title:"Upload failed",severity:"error",onRemove:X},Q.map(se=>{switch(se.code){case g.jK.FileTooLarge:return s.createElement("div",{key:se.message+se.code},"File is larger than ",(0,d.zc)(A));default:return s.createElement("div",{key:se.message+se.code},se.message)}}))),X=()=>{B([])};return s.createElement("div",{className:R.container},s.createElement("div",{"data-testid":"dropzone",...N({className:R.dropzone})},s.createElement("input",{...F()}),C??s.createElement(E,{primaryText:h(S,a)})),O.length>0&&Y(O),s.createElement("small",{className:(0,t.cx)(R.small,R.acceptContainer)},a?.maxSize&&`Max file size: ${(0,d.zc)(A)}`,a?.maxSize&&a?.accept&&s.createElement("span",{className:R.acceptSeparator},"|"),a?.accept&&y(a.accept)),_)}function p(a){return["txt","json","csv","xls","yml"].some(C=>a.match(C))?"text/plain":"application/octet-stream"}function f(a){return(0,n.isString)(a)?{[p(a)]:[a]}:Array.isArray(a)?a.reduce((C,P)=>{const b=p(P);return C[b]=C[b]?[...C[b],P]:[P],C},{}):a}function E({primaryText:a="Drop file here or click to upload",secondaryText:C=""}){const P=(0,l.l4)(),b=D(P);return s.createElement("div",{className:(0,t.cx)(b.defaultDropZone),"data-testid":"file-drop-zone-default-children"},s.createElement(o.J,{className:(0,t.cx)(b.icon),name:"upload",size:"xl"}),s.createElement("h6",{className:(0,t.cx)(b.primaryText)},a),s.createElement("small",{className:b.small},C))}function h(a,C){return C?.multiple===void 0||C?.multiple?"Upload file":a.length?"Replace file":"Upload file"}function y(a){return(0,n.isString)(a)?`Accepted file type: ${a}`:Array.isArray(a)?`Accepted file types: ${a.join(", ")}`:`Accepted file types: ${Object.values(a).flat().join(", ")}`}function v(a){return{id:(0,n.uniqueId)("file"),file:a,error:null}}function D(a,C){return{container:(0,t.css)({display:"flex",flexDirection:"column",width:"100%",padding:a.spacing(2),borderRadius:"2px",border:`1px dashed ${a.colors.border.strong}`,backgroundColor:C?a.colors.background.secondary:a.colors.background.primary,cursor:"pointer",alignItems:"center",justifyContent:"center"}),dropzone:(0,t.css)({height:"100%",width:"100%",display:"flex",flexDirection:"column"}),defaultDropZone:(0,t.css)({textAlign:"center"}),icon:(0,t.css)({marginBottom:a.spacing(1)}),primaryText:(0,t.css)({marginBottom:a.spacing(1)}),acceptContainer:(0,t.css)({textAlign:"center",margin:0}),acceptSeparator:(0,t.css)({margin:`0 ${a.spacing(1)}`}),small:(0,t.css)({color:a.colors.text.secondary}),errorAlert:(0,t.css)({paddingTop:"10px"})}}},35845:(j,I,e)=>{"use strict";e.d(I,{K:()=>o});var t=e(42844),n=e(27702),i=e(21609),s=e(66310),r=e(56160),g=e(66670),d=e(73453),l=e(67437);const u="Remove file";function o({file:c,removeFile:p}){const f=(0,s.wW)(m),{file:E,progress:h,error:y,abortUpload:v,retryUpload:D}=c,a=()=>y?n.createElement(n.Fragment,null,n.createElement("span",{className:f.error},y.message),D&&n.createElement(l.h,{name:"sync",tooltip:"Retry",tooltipPlacement:"top",onClick:D}),p&&n.createElement(l.h,{className:D?f.marginLeft:"",name:"trash-alt",onClick:()=>p(c),tooltip:u})):h&&E.size>h?n.createElement(n.Fragment,null,n.createElement("progress",{className:f.progressBar,max:E.size,value:h}),n.createElement("span",{className:f.paddingLeft},Math.round(h/E.size*100),"%"),v&&n.createElement(g.zx,{variant:"secondary",type:"button",fill:"text",onClick:v},"Cancel upload")):p&&n.createElement(l.h,{name:"trash-alt",onClick:()=>p(c),tooltip:u,tooltipPlacement:"top"}),C=(0,i.Cf)("decbytes")(E.size);return n.createElement("div",{className:f.fileListContainer},n.createElement("span",{className:f.fileNameWrapper},n.createElement(d.J,{name:"file-blank",size:"lg","aria-hidden":!0}),n.createElement("span",{className:f.padding},(0,r.O)(E.name)),n.createElement("span",null,(0,i.zc)(C))),n.createElement("div",{className:f.fileNameWrapper},a()))}function m(c){return{fileListContainer:(0,t.css)({width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:c.spacing(2),border:`1px dashed ${c.colors.border.medium}`,backgroundColor:`${c.colors.background.secondary}`,marginTop:c.spacing(1)}),fileNameWrapper:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center"}),padding:(0,t.css)({padding:c.spacing(0,1)}),paddingLeft:(0,t.css)({paddingLeft:c.spacing(2)}),marginLeft:(0,t.css)({marginLeft:c.spacing(1)}),error:(0,t.css)({paddingRight:c.spacing(2),color:c.colors.error.text}),progressBar:(0,t.css)({borderRadius:c.shape.radius.default,height:"4px","::-webkit-progress-bar":{backgroundColor:c.colors.border.weak,borderRadius:c.shape.radius.default},"::-webkit-progress-value":{backgroundColor:c.colors.primary.main,borderRadius:c.shape.radius.default}})}}},63844:(j,I,e)=>{"use strict";e.d(I,{A_:()=>t.A_,K$:()=>n.K,Yo:()=>t.Yo});var t=e(79399),n=e(35845)},2576:(j,I,e)=>{"use strict";e.d(I,{p:()=>o});var t=e(42844),n=e(27702),i=e(66117),s=e(74639),r=e(66310),g=e(97289),d=e(56160),l=e(66670),u=e(73453);const o=({onFileUpload:c,className:p,children:f="Upload file",accept:E="*",size:h="md",showFileName:y})=>{const v=(0,r.wW)(m(h)),[D,a]=(0,n.useState)(""),C=(0,i.Z)(),P=(0,n.useCallback)(b=>{const M=b.currentTarget?.files?.[0];M&&a(M.name??""),c(b)},[c]);return n.createElement(n.Fragment,null,n.createElement("input",{type:"file",id:C,className:v.fileUpload,onChange:P,multiple:!1,accept:E,"data-testid":s.wl.components.FileUpload.inputField}),n.createElement("label",{htmlFor:C,className:(0,t.cx)(v.labelWrapper,p)},n.createElement(u.J,{name:"upload",className:v.icon}),f),y&&D&&n.createElement("span",{"aria-label":"File name",className:v.fileName,"data-testid":s.wl.components.FileUpload.fileNameSpan},(0,d.O)(D)))},m=c=>p=>{const f=(0,l.fW)({theme:p,variant:"primary",size:c,iconOnly:!1}),E=(0,g.getFocusStyles)(p);return{fileUpload:(0,t.css)({height:"0.1px",opacity:"0",overflow:"hidden",position:"absolute",width:"0.1px",zIndex:-1,"&:focus + label":E,"&:focus-visible + label":E}),labelWrapper:f.button,icon:f.icon,fileName:(0,t.css)({marginLeft:p.spacing(.5)})}}},33716:(j,I,e)=>{"use strict";e.d(I,{H:()=>d});var t=e(27702),n=e(95676);function i(...l){const u=t.useRef(null);return t.useEffect(()=>{l.forEach(o=>{o&&(typeof o=="function"?o(u.current):o.current=u.current)})},[l]),u}var s=e(66670),r=e(73453),g=e(1128);const d=t.forwardRef(({value:l,width:u,onChange:o,escapeRegex:m=!0,...c},p)=>{const f=t.useRef(null),E=i(p,f),h=l!==""?t.createElement(s.zx,{icon:"times",fill:"text",size:"sm",onClick:y=>{f.current?.focus(),o(""),y.stopPropagation()}},"Clear"):null;return t.createElement(g.I,{prefix:t.createElement(r.J,{name:"search"}),suffix:h,width:u,type:"text",value:m?(0,n.x6)(l??""):l,onChange:y=>o(m?(0,n.GE)(y.currentTarget.value):y.currentTarget.value),...c,ref:E})});d.displayName="FilterInput"},81520:(j,I,e)=>{"use strict";e.d(I,{B:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(66670),r=e(73453);const g=({label:l,selected:u,onClick:o,icon:m="check"})=>{const c=(0,i.wW)(d),p=(0,i.wW)(s.gN);return n.createElement("button",{type:"button",className:(0,t.cx)(p,c.wrapper,u&&c.selected),onClick:o},n.createElement("span",null,l),u&&n.createElement(r.J,{name:m,className:c.icon}))},d=l=>({wrapper:(0,t.css)({background:l.colors.background.secondary,borderRadius:l.shape.borderRadius(8),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,t.css)({color:l.colors.text.primary,background:l.colors.action.selected,"&:hover":{background:l.colors.action.focus}}),icon:(0,t.css)({marginLeft:l.spacing(.5)})})},14496:(j,I,e)=>{"use strict";e.d(I,{W:()=>r});var t=e(42844),n=e(27702),i=e(60644);const s={labelWidth:6,inputWidth:12},r=({label:d,tooltip:l,labelWidth:u,inputWidth:o,inputEl:m,className:c,interactive:p,...f})=>{const E=g();return n.createElement("div",{className:(0,t.cx)(E.formField,c)},n.createElement(i.c,{width:u,tooltip:l,interactive:p},d),m||n.createElement("input",{type:"text",className:`gf-form-input ${o?`width-${o}`:""}`,...f,disabled:f.disabled}))};r.displayName="FormField",r.defaultProps=s;const g=()=>({formField:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative"})})},60644:(j,I,e)=>{"use strict";e.d(I,{c:()=>d});var t=e(89898),n=e.n(t),i=e(27702),s=e(73453),r=e(80011);const d=({children:l,isFocused:u,isInvalid:o,className:m,htmlFor:c,tooltip:p,width:f,interactive:E,...h})=>{const y=n()(m,`gf-form-label width-${f||"10"}`,{"gf-form-label--is-focused":u,"gf-form-label--is-invalid":o});return i.createElement("label",{className:y,...h,htmlFor:c},l,p&&i.createElement(r.u,{placement:"top",content:p,theme:"info",interactive:E},i.createElement(s.J,{tabIndex:0,name:"info-circle",size:"sm",style:{marginLeft:"10px"}})))}},70944:(j,I,e)=>{"use strict";e.d(I,{W:()=>i});var t=e(27702);function n(s){return s<20?.9:s<26?.8:.6}const i=({value:s,className:r,style:g,...d})=>{const l=(s.prefix??"").length>0,u=(s.suffix??"").length>0;let o;if(g&&g.fontSize&&typeof g.fontSize=="number"){const m=g.fontSize,c=n(m);o={fontSize:m*c}}return t.createElement("div",{className:r,style:g,...d},t.createElement("div",null,l&&t.createElement("span",null,s.prefix),t.createElement("span",null,s.text),u&&t.createElement("span",{style:o},s.suffix)))};i.displayName="FormattedDisplayValue"},83967:(j,I,e)=>{"use strict";e.d(I,{X:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(97289),r=e(79978);const g=n.forwardRef(({label:l,description:u,value:o,htmlValue:m,onChange:c,disabled:p,className:f,indeterminate:E,invalid:h,...y},v)=>{const D=(0,n.useCallback)(b=>{c&&c(b)},[c]),a=(0,i.l4)(),C=d(a,h),P=E?"mixed":void 0;return n.createElement("label",{className:(0,t.cx)(C.wrapper,f)},n.createElement("div",{className:C.checkboxWrapper},n.createElement("input",{type:"checkbox",className:(0,t.cx)(C.input,E&&C.inputIndeterminate),checked:o,disabled:p,onChange:D,value:m,"aria-checked":P,...y,ref:v}),n.createElement("span",{className:C.checkmark})),l&&n.createElement("span",{className:C.label},l),u&&n.createElement("span",{className:C.description},u))}),d=(l,u=!1)=>{const o=(0,r.F)(l),m=2,c=1,p=f=>u?l.colors.error.border:f;return{wrapper:(0,t.css)({display:"inline-grid",alignItems:"center",columnGap:l.spacing(c),gridAutoRows:"max-content",position:"relative",verticalAlign:"middle"}),input:(0,t.css)({position:"absolute",zIndex:1,top:0,left:0,width:"100% !important",height:"100%",opacity:0,"&:focus + span, &:focus-visible + span":(0,s.getFocusStyles)(l),"&:focus:not(:focus-visible) + span":(0,s.getMouseFocusStyles)(l),"&:checked + span":{background:l.colors.primary.main,border:`1px solid ${p(l.colors.primary.main)}`,"&:hover":{background:l.colors.primary.shade},"&:after":{content:'""',position:"absolute",zIndex:2,left:"4px",top:0,width:"6px",height:"12px",border:`solid ${l.colors.primary.contrastText}`,borderWidth:"0 3px 3px 0",transform:"rotate(45deg)"}},"&:disabled + span":{backgroundColor:l.colors.action.disabledBackground,cursor:"not-allowed",border:`1px solid ${p(l.colors.action.disabledBackground)}`,"&:hover":{backgroundColor:l.colors.action.disabledBackground},"&:after":{borderColor:l.colors.action.disabledText}}}),inputIndeterminate:(0,t.css)({"&[aria-checked='mixed'] + span":{border:`1px solid ${p(l.colors.primary.main)}`,background:l.colors.primary.main,"&:hover":{background:l.colors.primary.shade},"&:after":{content:'""',position:"absolute",zIndex:2,left:"2px",right:"2px",top:"calc(50% - 1.5px)",height:"3px",border:`1.5px solid ${l.colors.primary.contrastText}`,backgroundColor:l.colors.primary.contrastText,width:"auto",transform:"none"}},"&:disabled[aria-checked='mixed'] + span":{backgroundColor:l.colors.action.disabledBackground,border:`1px solid ${p(l.colors.error.transparent)}`,"&:after":{borderColor:l.colors.action.disabledText}}}),checkboxWrapper:(0,t.css)({display:"flex",alignItems:"center",gridColumnStart:1,gridRowStart:1}),checkmark:(0,t.css)({position:"relative",zIndex:2,display:"inline-block",width:l.spacing(m),height:l.spacing(m),borderRadius:l.shape.borderRadius(),background:l.components.input.background,border:`1px solid ${p(l.components.input.borderColor)}`,"&:hover":{cursor:"pointer",borderColor:p(l.components.input.borderHover)}}),label:(0,t.cx)(o.label,(0,t.css)({gridColumnStart:2,gridRowStart:1,position:"relative",zIndex:2,cursor:"pointer",maxWidth:"fit-content",lineHeight:l.typography.bodySmall.lineHeight,marginBottom:0})),description:(0,t.cx)(o.description,(0,t.css)({gridColumnStart:2,gridRowStart:2,lineHeight:l.typography.bodySmall.lineHeight,marginTop:0}))}};g.displayName="Checkbox"},22209:(j,I,e)=>{"use strict";e.d(I,{g:()=>u});var t=e(42844),n=e(27702),i=e(80402),s=e(66310),r=e(66258),g=e(59904),d=e(79978);const l=(0,i.B)(m=>({field:(0,t.css)({display:"flex",flexDirection:"column",marginBottom:m.spacing(2)}),fieldHorizontal:(0,t.css)({flexDirection:"row",justifyContent:"space-between",flexWrap:"wrap"}),fieldValidationWrapper:(0,t.css)({marginTop:m.spacing(.5)}),fieldValidationWrapperHorizontal:(0,t.css)({flex:"1 1 100%"}),validationMessageHorizontalOverflow:(0,t.css)({width:0,overflowX:"visible","& > *":{whiteSpace:"nowrap"}})})),u=n.forwardRef(({label:m,description:c,horizontal:p,invalid:f,loading:E,disabled:h,required:y,error:v,children:D,className:a,validationMessageHorizontalOverflow:C,htmlFor:P,...b},M)=>{const T=(0,s.l4)(),S=l(T),x=P??(0,r.getChildId)(D),O=typeof m=="string"?n.createElement(d._,{htmlFor:x,description:c},`${m}${y?" *":""}`):m,B=o({invalid:f,disabled:h,loading:E});return n.createElement("div",{className:(0,t.cx)(S.field,p&&S.fieldHorizontal,a),...b},O,n.createElement("div",null,n.createElement("div",{ref:M},n.cloneElement(D,B)),f&&v&&!p&&n.createElement("div",{className:(0,t.cx)(S.fieldValidationWrapper,{[S.validationMessageHorizontalOverflow]:!!C})},n.createElement(g.S,null,v))),f&&v&&p&&n.createElement("div",{className:(0,t.cx)(S.fieldValidationWrapper,S.fieldValidationWrapperHorizontal,{[S.validationMessageHorizontalOverflow]:!!C})},n.createElement(g.S,null,v)))});u.displayName="Field";function o(m){for(const c in m)m[c]===void 0&&delete m[c];return m}},56948:(j,I,e)=>{"use strict";e.d(I,{F:()=>n});var t=e(46089);const n=({name:i,control:s,children:r,...g})=>{const{fields:d,append:l,prepend:u,remove:o,swap:m,move:c,insert:p}=(0,t.Dq)({control:s,name:i,...g});return r({fields:d,append:l,prepend:u,remove:o,swap:m,move:c,insert:p})}},5229:(j,I,e)=>{"use strict";e.d(I,{C:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(80402),r=e(12375);const g=({label:l,children:u,className:o,...m})=>{const c=(0,i.l4)(),p=d(c);return n.createElement("fieldset",{className:(0,t.cx)(p.wrapper,o),...m},l&&n.createElement(r.D,null,l),u)},d=(0,s.B)(l=>({wrapper:(0,t.css)({marginBottom:l.spacing(4),"&:last-child":{marginBottom:0}})}))},59904:(j,I,e)=>{"use strict";e.d(I,{S:()=>d});var t=e(42844),n=e(27702),i=e(80402),s=e(66310),r=e(73453);const g=(0,i.B)(l=>{const u=` font-size: ${l.typography.size.sm}; font-weight: ${l.typography.fontWeightMedium}; padding: ${l.spacing(.5,1)}; color: ${l.colors.error.contrastText}; background: ${l.colors.error.main}; border-radius: ${l.shape.borderRadius()}; position: relative; display: inline-block; align-self: flex-start; a { color: ${l.colors.error.contrastText}; text-decoration: underline; } a:hover { text-decoration: none; } `;return{vertical:(0,t.css)(u,{margin:l.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 ${l.colors.error.main} transparent`,borderStyle:"solid"}}),horizontal:(0,t.css)(u,{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,t.css)({marginRight:l.spacing()})}}),d=({children:l,horizontal:u,className:o})=>{const m=(0,s.l4)(),c=g(m),p=(0,t.cx)(u?c.horizontal:c.vertical,o);return n.createElement("div",{role:"alert",className:p},n.createElement(r.J,{className:c.fieldValidationMessageIcon,name:"exclamation-triangle"}),l)}},23839:(j,I,e)=>{"use strict";e.d(I,{l:()=>s});var t=e(42844),n=e(27702),i=e(46089);function s({defaultValues:r,onSubmit:g,validateOnMount:d=!1,validateFieldsOnMount:l,children:u,validateOn:o="onSubmit",maxWidth:m=600,...c}){const{handleSubmit:p,trigger:f,formState:E,...h}=(0,i.cI)({mode:o,defaultValues:r});return(0,n.useEffect)(()=>{d&&f(l)},[f,l,d]),n.createElement("form",{className:(0,t.css)({maxWidth:m!=="none"?m+"px":m,width:"100%"}),onSubmit:p(g),...c},u({errors:E.errors,formState:E,...h}))}},48024:(j,I,e)=>{"use strict";e.d(I,{_:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(66258),r=e(59904),g=e(53901);const d=({children:u,label:o,tooltip:m,labelWidth:c="auto",invalid:p,loading:f,disabled:E,required:h,className:y,htmlFor:v,grow:D,shrink:a,error:C,transparent:P,interactive:b,...M})=>{const T=(0,i.l4)(),S=l(T,D,a),x=v??(0,s.getChildId)(u),O=typeof o=="string"?n.createElement(g.W,{interactive:b,width:c,tooltip:m,htmlFor:x,transparent:P},`${o}${h?" *":""}`):o;return n.createElement("div",{className:(0,t.cx)(S.container,y),...M},O,n.createElement("div",{className:S.childContainer},n.cloneElement(u,{invalid:p,disabled:E,loading:f}),p&&C&&n.createElement("div",{className:(0,t.cx)(S.fieldValidationWrapper)},n.createElement(r.S,null,C))))};d.displayName="InlineField";const l=(u,o,m)=>({container:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative",flex:`${o?1:0} ${m?1:0} auto`,margin:`0 ${u.spacing(.5)} ${u.spacing(.5)} 0`}),childContainer:(0,t.css)({flex:`${o?1:0} ${m?1:0} auto`}),fieldValidationWrapper:(0,t.css)({marginTop:u.spacing(.5)})})},71107:(j,I,e)=>{"use strict";e.d(I,{Z:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({children:g,className:d,...l})=>{const u=(0,i.wW)(r);return n.createElement("div",{className:(0,t.cx)(u.container,d),...l},g)},r=g=>({container:(0,t.css)({label:"InlineFieldRow",display:"flex",flexDirection:"row",flexWrap:"wrap",alignContent:"flex-start",rowGap:g.spacing(.5)})})},53901:(j,I,e)=>{"use strict";e.d(I,{W:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(73453),r=e(80011);const g=({children:l,className:u,tooltip:o,width:m,transparent:c,interactive:p,as:f="label",...E})=>{const h=(0,i.wW)((0,n.useCallback)(y=>d(y,c,m),[c,m]));return n.createElement(f,{className:(0,t.cx)(h.label,u),...E},l,o&&n.createElement(r.u,{interactive:p,placement:"top",content:o,theme:"info"},n.createElement(s.J,{tabIndex:0,name:"info-circle",size:"sm",className:h.icon})))},d=(l,u=!1,o)=>({label:(0,t.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:u?"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:o?o!=="auto"?`${8*o}px`:o:"100%",color:l.colors.text.primary}),icon:(0,t.css)({color:l.colors.text.secondary,marginLeft:"10px",":hover":{color:l.colors.text.primary}})})},88413:(j,I,e)=>{"use strict";e.d(I,{m:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({children:g,className:d,grow:l,...u})=>{const o=(0,i.wW)(m=>r(m,l));return n.createElement("div",{className:(0,t.cx)(o.container,d),...u},g)};s.displayName="InlineSegmentGroup";const r=(g,d)=>({container:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative",flex:`${d?1:0} 0 auto`,marginBottom:g.spacing(.5)})})},79978:(j,I,e)=>{"use strict";e.d(I,{F:()=>g,_:()=>d});var t=e(42844),n=e(27702),i=e(80402),s=e(66310),r=e(73453);const g=(0,i.B)(l=>({label:(0,t.css)({label:"Label",fontSize:l.typography.size.sm,fontWeight:l.typography.fontWeightMedium,lineHeight:1.25,marginBottom:l.spacing(.5),color:l.colors.text.primary,maxWidth:"480px"}),labelContent:(0,t.css)({display:"flex",alignItems:"center"}),description:(0,t.css)({label:"Label-description",color:l.colors.text.secondary,fontSize:l.typography.size.sm,fontWeight:l.typography.fontWeightRegular,marginTop:l.spacing(.25),display:"block"}),categories:(0,t.css)({label:"Label-categories",display:"inline-flex",alignItems:"center"}),chevron:(0,t.css)({margin:l.spacing(0,.25)})})),d=({children:l,description:u,className:o,category:m,...c})=>{const p=(0,s.l4)(),f=g(p),E=m?.map((h,y)=>n.createElement("span",{className:f.categories,key:`${h}/${y}`},n.createElement("span",null,h),n.createElement(r.J,{name:"angle-right",className:f.chevron})));return n.createElement("div",{className:(0,t.cx)(f.label,o)},n.createElement("label",{...c},n.createElement("div",{className:f.labelContent},E,l),u&&n.createElement("span",{className:f.description},u)))}},83670:(j,I,e)=>{"use strict";e.d(I,{G:()=>r,I:()=>g});var t=e(89898),n=e.n(t),i=e(27702),s=e(61203),r=(d=>(d.Invalid="invalid",d.Valid="valid",d))(r||{});class g extends i.PureComponent{constructor(){super(...arguments),this.state={error:null},this.validatorAsync=l=>u=>{const o=(0,s.Gu)(u.target.value,l);this.setState(m=>({...m,error:o?o[0]:null}))},this.populateEventPropsWithStatus=(l,u)=>{const o={...l};return u&&Object.keys(s.JU).forEach(m=>{((0,s.z3)(m,u)||l[m])&&(o[m]=async c=>{c.persist(),(0,s.z3)(m,u)&&await this.validatorAsync(u[m]).apply(this,[c]),l[m]&&l[m].apply(null,[c,this.status])})}),o}}get status(){return this.state.error?"invalid":"valid"}get isInvalid(){return this.status==="invalid"}render(){const{validationEvents:l,className:u,hideErrorMessage:o,inputRef:m,...c}=this.props,{error:p}=this.state,f=n()("gf-form-input",{invalid:this.isInvalid},u),E=this.populateEventPropsWithStatus(c,l);return i.createElement("div",{style:{flexGrow:1}},i.createElement("input",{...E,ref:m,className:f}),p&&!o&&i.createElement("span",null,p))}}g.defaultProps={className:""}},39520:(j,I,e)=>{"use strict";e.d(I,{B:()=>s,Z:()=>r});var t=e(27702),n=e(38581),i=e(73453);const s=g=>{const d=g.selectProps.menuIsOpen;return t.createElement(n.c.IndicatorsContainer,{...g},t.createElement(i.J,{name:d?"angle-up":"angle-down",style:{marginTop:"7px"}}))},r=s},33261:(j,I,e)=>{"use strict";e.d(I,{P:()=>i,Z:()=>s});var t=e(27702),n=e(38581);const i=r=>{const{children:g}=r;return t.createElement(n.c.NoOptionsMessage,{...r},t.createElement("div",{className:"gf-form-select-box__desc-option"},t.createElement("div",{className:"gf-form-select-box__desc-option__body"},g)))},s=i},49918:(j,I,e)=>{"use strict";e.d(I,{qb:()=>P,Ph:()=>C});var t=e(89898),n=e.n(t),i=e(27702),s=e(38581),r=e(98330),g=e(19590),d=e(2004),l=e(66310),u=e(29372),o=e(42197),m=e(91987),c=e(69213),p=e(80011),f=e(39520),E=e(33261),h=e(73453);const y=T=>{const{children:S,isSelected:x,data:O}=T;return i.createElement(s.c.Option,{...T},i.createElement("div",{className:"gf-form-select-box__desc-option"},O.imgUrl&&i.createElement("img",{className:"gf-form-select-box__desc-option__img",src:O.imgUrl,alt:""}),i.createElement("div",{className:"gf-form-select-box__desc-option__body"},i.createElement("div",null,S),O.description&&i.createElement("div",{className:"gf-form-select-box__desc-option__desc"},O.description)),x&&i.createElement(h.J,{name:"check","aria-hidden":"true"})))},v=null,D=T=>i.createElement(s.c.MenuList,{...T},i.createElement(u.$,{autoHide:!1,autoHeightMax:"inherit"},T.children)),a=class extends i.PureComponent{render(){const{defaultValue:T,getOptionLabel:S,getOptionValue:x,onChange:O,options:B,placeholder:A,width:V,value:W,className:w,isDisabled:N,isLoading:F,isSearchable:k,isClearable:H,backspaceRemovesValue:R,isMulti:_,autoFocus:G,openMenuOnFocus:Y,onBlur:X,maxMenuHeight:Q,noOptionsMessage:se,isOpen:Z,components:le,tooltipContent:oe,tabSelectsValue:q,onCloseMenu:ne,onOpenMenu:ge,allowCustomValue:ae,formatCreateLabel:re,"aria-label":De}=this.props;let he="";V&&(he="width-"+V);let ye=r.ZP;const ce={};ae&&(ye=d.Z,ce.formatCreateLabel=re??(et=>et));const We=n()("gf-form-input","gf-form-input--form-dropdown",he,w),ke={...a.defaultProps.components,...le};return i.createElement(b,{onCloseMenu:ne,onOpenMenu:ge,tooltipContent:oe,isOpen:Z},(et,we)=>i.createElement(ye,{captureMenuScroll:!1,classNamePrefix:"gf-form-select-box",className:We,components:ke,defaultValue:T,value:W,getOptionLabel:S,getOptionValue:x,menuShouldScrollIntoView:!1,isSearchable:k,onChange:O,options:B,placeholder:A||"Choose",styles:(0,c.Z)(this.context),isDisabled:N,isLoading:F,isClearable:H,autoFocus:G,onBlur:X,openMenuOnFocus:Y,maxMenuHeight:Q,noOptionsMessage:se,isMulti:_,backspaceRemovesValue:R,menuIsOpen:Z,onMenuOpen:et,onMenuClose:we,tabSelectsValue:q,"aria-label":De,...ce}))}};let C=a;C.contextType=l.Ni,C.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:y,SingleValue:m.P,IndicatorsContainer:f.Z,MenuList:D,Group:o.n}};class P extends i.PureComponent{render(){const{defaultValue:S,getOptionLabel:x,getOptionValue:O,onChange:B,placeholder:A,width:V,value:W,className:w,loadOptions:N,defaultOptions:F,isLoading:k,loadingMessage:H,noOptionsMessage:R,isDisabled:_,isSearchable:G,isClearable:Y,backspaceRemovesValue:X,autoFocus:Q,onBlur:se,openMenuOnFocus:Z,maxMenuHeight:le,isMulti:oe,tooltipContent:q,onCloseMenu:ne,onOpenMenu:ge,isOpen:ae}=this.props;let re="";V&&(re="width-"+V);const De=n()("gf-form-input","gf-form-input--form-dropdown",re,w);return i.createElement(b,{onCloseMenu:ne,onOpenMenu:ge,tooltipContent:q,isOpen:ae},(he,ye)=>i.createElement(g.Z,{captureMenuScroll:!1,classNamePrefix:"gf-form-select-box",className:De,components:{Option:y,SingleValue:m.P,IndicatorsContainer:f.Z,NoOptionsMessage:E.Z},defaultValue:S,value:W,getOptionLabel:x,getOptionValue:O,menuShouldScrollIntoView:!1,onChange:B,loadOptions:N,isLoading:k,defaultOptions:F,placeholder:A||"Choose",styles:(0,c.Z)(this.context),loadingMessage:H,noOptionsMessage:R,isDisabled:_,isSearchable:G,isClearable:Y,autoFocus:Q,onBlur:se,openMenuOnFocus:Z,maxMenuHeight:le,isMulti:oe,backspaceRemovesValue:X}))}}P.contextType=l.Ni,P.defaultProps={className:"",components:{},loadingMessage:()=>"Loading...",isDisabled:!1,isClearable:!1,isMulti:!1,isSearchable:!0,backspaceRemovesValue:!0,autoFocus:!1,openMenuOnFocus:!1,maxMenuHeight:300};class b extends i.PureComponent{constructor(){super(...arguments),this.state={isOpenInternal:!1},this.onOpenMenu=()=>{const{onOpenMenu:S}=this.props;S&&S(),this.setState({isOpenInternal:!0})},this.onCloseMenu=()=>{const{onCloseMenu:S}=this.props;S&&S(),this.setState({isOpenInternal:!1})}}render(){const{children:S,isOpen:x,tooltipContent:O}=this.props,{isOpenInternal:B}=this.state;let A;return(B||x)&&(A=!1),O?i.createElement(p.u,{show:A,content:O,placement:"bottom"},i.createElement("div",null,S(this.onOpenMenu,this.onCloseMenu))):i.createElement("div",null,S(this.onOpenMenu,this.onCloseMenu))}}const M=null},17752:(j,I,e)=>{"use strict";e.d(I,{r:()=>g});var t=e(89949),n=e.n(t),i=e(27702),s=e(73453),r=e(80011);class g extends i.PureComponent{constructor(){super(...arguments),this.state={id:(0,t.uniqueId)()},this.internalOnChange=l=>{l.stopPropagation(),this.props.onChange(l)}}render(){const{labelClass:l="",switchClass:u="",label:o,checked:m,disabled:c,transparent:p,className:f,tooltip:E,tooltipPlacement:h}=this.props,y=this.state.id,v=`gf-form-label ${l} ${p?"gf-form-label--transparent":""} pointer`,D=`gf-form-switch ${u} ${p?"gf-form-switch--transparent":""}`;return i.createElement("div",{className:"gf-form-switch-container-react"},i.createElement("label",{htmlFor:y,className:`gf-form gf-form-switch-container ${f||""}`},o&&i.createElement("div",{className:v},o,E&&i.createElement(r.u,{placement:h||"auto",content:E,theme:"info"},i.createElement(s.J,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}}))),i.createElement("div",{className:D},i.createElement("input",{disabled:c,id:y,type:"checkbox",checked:m,onChange:this.internalOnChange}),i.createElement("span",{className:"gf-form-switch__slider"}))))}}},12375:(j,I,e)=>{"use strict";e.d(I,{D:()=>r});var t=e(42844),n=e(27702),i=e(66310);const s=g=>({legend:(0,t.css)({fontSize:g.typography.h3.fontSize,fontWeight:g.typography.fontWeightRegular,margin:g.spacing(0,0,2,0)})}),r=({children:g,className:d,...l})=>{const u=(0,i.wW)(s);return n.createElement("legend",{className:(0,t.cx)(u.legend,d),...l},g)}},40705:(j,I,e)=>{"use strict";e.d(I,{S:()=>c});var t=e(42844),n=e(89949),i=e(27702),s=e(8553),r=e(66310),g=e(73453),d=e(80402),l=e(97289),u=e(26468);const o=i.forwardRef(({children:f,active:E=!1,disabled:h=!1,size:y="md",onChange:v,onClick:D,id:a,name:C=void 0,description:P,fullWidth:b,"aria-label":M},T)=>{const S=(0,r.l4)(),x=m(S,y,b);return i.createElement(i.Fragment,null,i.createElement("input",{type:"radio",className:x.radio,onChange:v,onClick:D,disabled:h,id:a,checked:E,name:C,"aria-label":M||P,ref:T}),i.createElement("label",{className:x.radioLabel,htmlFor:a,title:P||M},f))});o.displayName="RadioButton";const m=(0,d.B)((f,E,h)=>{const{fontSize:y,height:v,padding:D}=(0,u.iL)(E,f),a=f.colors.text.secondary,C=f.colors.text.primary,P=v*f.spacing.gridSize-4-2;return{radio:(0,t.css)({position:"absolute",opacity:0,zIndex:-1e3,"&:checked + label":{color:f.colors.text.primary,fontWeight:f.typography.fontWeightMedium,background:f.colors.action.selected,zIndex:3},"&:focus + label, &:focus-visible + label":(0,l.getFocusStyles)(f),"&:focus:not(:focus-visible) + label":(0,l.getMouseFocusStyles)(f),"&:disabled + label":{color:f.colors.text.disabled,cursor:"not-allowed"}}),radioLabel:(0,t.css)({display:"inline-block",position:"relative",fontSize:y,height:`${P}px`,lineHeight:`${P}px`,color:a,padding:f.spacing(0,D),borderRadius:f.shape.borderRadius(),background:f.colors.background.primary,cursor:"pointer",zIndex:1,flex:h?"1 0 0":"none",textAlign:"center",userSelect:"none",whiteSpace:"nowrap","&:hover":{color:C}})}});function c({options:f,value:E,onChange:h,onClick:y,disabled:v,disabledOptions:D,size:a="md",id:C,className:P,fullWidth:b=!1,autoFocus:M=!1,invalid:T=!1}){const S=(0,i.useCallback)(W=>()=>{h&&h(W.value)},[h]),x=(0,i.useCallback)(W=>()=>{y&&y(W.value)},[y]),O=C??(0,n.uniqueId)("radiogroup-"),B=(0,i.useRef)(O),A=(0,r.wW)(p),V=(0,i.useRef)(null);return(0,i.useEffect)(()=>{M&&V.current&&V.current.focus()},[M]),i.createElement("div",{className:(0,t.cx)(A.radioGroup,b&&A.fullWidth,T&&A.invalid,P)},f.map((W,w)=>{const N=D&&W.value&&D.includes(W.value),F=W.icon?(0,s.iJ)(W.icon):void 0,k=!!(W.imgUrl||W.label||W.component);return i.createElement(o,{size:a,disabled:N||v,active:E===W.value,key:`o.label-${w}`,"aria-label":W.ariaLabel,onChange:S(W),onClick:x(W),id:`option-${W.value}-${O}`,name:B.current,description:W.description,fullWidth:b,ref:E===W.value?V:void 0},F&&i.createElement(g.J,{name:F,className:(0,t.cx)(k&&A.icon)}),W.imgUrl&&i.createElement("img",{src:W.imgUrl,alt:W.label,className:A.img}),W.label," ",W.component?i.createElement(W.component,null):null)}))}c.displayName="RadioButtonGroup";const p=f=>({radioGroup:(0,t.css)({display:"inline-flex",flexDirection:"row",flexWrap:"nowrap",border:`1px solid ${f.components.input.borderColor}`,borderRadius:f.shape.borderRadius(),padding:"2px"}),fullWidth:(0,t.css)({display:"flex"}),icon:(0,t.css)({marginRight:"6px"}),img:(0,t.css)({width:f.spacing(2),height:f.spacing(2),marginRight:f.spacing(1)}),invalid:(0,t.css)({border:`1px solid ${f.colors.error.border}`})})},20839:(j,I,e)=>{"use strict";e.d(I,{x:()=>d});var t=e(42844),n=e(89949),i=e(27702),s=e(66310);const r=({id:u,name:o,label:m,checked:c,disabled:p,description:f,onChange:E})=>{const h=(0,s.wW)(g);return i.createElement("label",{title:f,className:h.label},i.createElement("input",{id:u,name:o,type:"radio",checked:c,disabled:p,className:h.input,onChange:()=>E&&E(u)}),m)},g=u=>({input:(0,t.css)({position:"relative",appearance:"none",outline:"none",backgroundColor:u.colors.background.canvas,width:`${u.spacing(2)} !important`,height:u.spacing(2),border:`1px solid ${u.colors.border.medium}`,borderRadius:u.shape.radius.circle,margin:"3px 0",":checked":{backgroundColor:u.v1.palette.white,border:`5px solid ${u.colors.primary.main}`},":disabled":{backgroundColor:`${u.colors.action.disabledBackground} !important`,borderColor:u.colors.border.weak},":disabled:checked":{border:`1px solid ${u.colors.border.weak}`},":disabled:checked::after":{content:'""',width:"6px",height:"6px",backgroundColor:u.colors.text.disabled,borderRadius:u.shape.radius.circle,display:"inline-block",position:"absolute",top:"4px",left:"4px"},":focus":{outline:"none !important",boxShadow:`0 0 0 1px ${u.colors.background.canvas}, 0 0 0 3px ${u.colors.primary.main}`}}),label:(0,t.css)({fontSize:u.typography.fontSize,lineHeight:"22px",display:"grid",gridTemplateColumns:`${u.spacing(2)} auto`,gap:u.spacing(1)})});function d({name:u,id:o,options:m,value:c,onChange:p,className:f,disabled:E,disabledOptions:h=[]}){const y=(0,s.wW)(l),v=o??(0,n.uniqueId)("radiogroup-list-");return i.createElement("div",{id:o,className:(0,t.cx)(y.container,f),role:"radiogroup"},m.map((D,a)=>{const C=`${v}-${a}`,P=c&&c===D.value,b=E||h.some(T=>T===D.value),M=()=>p&&D.value&&p(D.value);return i.createElement(r,{key:C,id:C,name:u,label:D.label,description:D.description,checked:P,disabled:b,onChange:M})}))}const l=u=>({container:(0,t.css)({display:"grid",gap:u.spacing(1)})})},26468:(j,I,e)=>{"use strict";e.d(I,{GL:()=>i,RK:()=>s,ht:()=>g,iL:()=>l,nf:()=>r});var t=e(42844),n=e(97289);const i=u=>(0,t.css)({"&:focus":(0,n.getFocusStyles)(u)}),s=(u,o=!1)=>{const m=o?u.colors.error.border:u.components.input.borderColor,c=o?u.colors.error.shade:u.components.input.borderHover,p=u.components.input.background,f=u.components.input.text,E=u.isDark?"#2e2f35":"#bab4ca";return(0,t.cx)(r(u),(0,t.css)({background:p,lineHeight:u.typography.body.lineHeight,fontSize:u.typography.size.md,color:f,border:`1px solid ${m}`,"&:-webkit-autofill, &:-webkit-autofill:hover":{boxShadow:`inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${p}!important`,WebkitTextFillColor:`${f} !important`,borderColor:E},"&:-webkit-autofill:focus":{boxShadow:`0 0 0 2px ${u.colors.background.primary}, 0 0 0px 4px ${u.colors.primary.main}, inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${p}!important`,WebkitTextFillColor:`${f} !important`},"&:hover":{borderColor:c},"&:focus":{outline:"none"},"&:disabled":{backgroundColor:u.colors.action.disabledBackground,color:u.colors.action.disabledText,border:`1px solid ${u.colors.action.disabledBackground}`,"&:hover":{borderColor:m}},"&::placeholder":{color:u.colors.text.disabled,opacity:1}}))},r=u=>(0,t.css)({padding:u.spacing(0,1,0,1)}),g=()=>({sm:(0,t.css)({width:d("sm")}),md:(0,t.css)({width:d("md")}),lg:(0,t.css)({width:d("lg")}),auto:(0,t.css)({width:d("auto")})}),d=u=>{switch(u){case"sm":return"200px";case"md":return"320px";case"lg":return"580px";case"auto":default:return"auto"}};function l(u,o){switch(u){case"sm":return{padding:1,fontSize:o.typography.size.sm,height:o.components.height.sm};case"lg":return{padding:3,fontSize:o.typography.size.lg,height:o.components.height.lg};case"md":default:return{padding:2,fontSize:o.typography.size.md,height:o.components.height.md}}}},59870:(j,I,e)=>{"use strict";e.d(I,{a:()=>f});var t=e(7610),n=e.n(t),i=e(27702),s=e(21609),r=e(34239),g=e(5168),d=e(11724),l=e(66670),u=e(93666),o=e(77104);const m={mode:g.H.Absolute,steps:[{value:-1/0,color:"green"},{value:80,color:"red"}]};function c(E,h,y){const v=y!=null,D=Math.min(E*.15/1.5,20),a=D*1.5,C=v?h-a:h,P=Math.min(C,E);return{showLabel:v,gaugeHeight:P,titleFontSize:D}}function p(E,h,y,v){if(h.color?.mode!==u.S.Thresholds)return[{value:h.min??r.Hx,color:y.color??u.R}];const D=h.thresholds??m,a=D.mode===g.H.Percentage,C=D.steps;let P=h.min??r.Hx,b=h.max??r.Z3;a&&(P=0,b=100);const M=(0,o.m1)(P,C),T=(0,o.m1)(b,C),S=[{value:+P.toFixed(E),color:v.visualization.getColorByName(M.color)}];let x=!0;for(let O=0;O<C.length;O++){const B=C[O];if(x){M===B&&(x=!1);continue}const A=C[O-1];if(S.push({value:B.value,color:v.visualization.getColorByName(A.color)}),B===T)break}return S.push({value:+b.toFixed(E),color:v.visualization.getColorByName(T.color)}),S}class f extends i.PureComponent{constructor(){super(...arguments),this.canvasElement=null,this.renderVisualization=()=>{const{width:h,value:y,height:v,onClick:D,text:a,theme:C}=this.props,P=c(h,v,y.title),b=i.createElement("div",{style:{height:`${P.gaugeHeight}px`,width:"100%"},ref:M=>this.canvasElement=M});return i.createElement(i.Fragment,null,D?i.createElement("button",{className:(0,l.gN)(C),type:"button",onClick:D},b):b,P.showLabel&&i.createElement("div",{style:{textAlign:"center",fontSize:a?.titleSize??P.titleFontSize,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",position:"relative",width:"100%",top:"-4px",cursor:"default"}},y.title))}}componentDidMount(){this.draw()}componentDidUpdate(){this.draw()}draw(){const{field:h,showThresholdLabels:y,showThresholdMarkers:v,width:D,height:a,theme:C,value:P}=this.props,b=c(D,a,P.title),M=Math.min(D,b.gaugeHeight),T=C.colors.background.secondary,S=y?1.5:1,x=Math.min(M/5.5,40)/S,O=x/5,B=(0,s.zc)(P),V=Math.min(D,M*1.3)*.9-((x+(v?O:0)+(y?10:0))*2+10),W=this.props.text?.valueSize??(0,d.MX)(B,V,M,1,x*1.7),w=Math.max(W/2.5,12);let N=h.min??r.Hx,F=h.max??r.Z3,k=P.numeric;h.thresholds?.mode===g.H.Percentage&&(N=0,F=100,P.percent===void 0?k=(k-N)/(F-N)*100:k=P.percent*100);const H=h.decimals===void 0?2:h.decimals;v&&(N=+N.toFixed(H),F=+F.toFixed(H));const R={series:{gauges:{gauge:{min:N,max:F,neutralValue:h.custom?.neutral,background:{color:T},border:{color:null},shadow:{show:!1},width:x},frame:{show:!1},label:{show:!1},layout:{margin:0,thresholdWidth:0,vMargin:0},cell:{border:{width:0}},threshold:{values:p(H,h,P,C),label:{show:y,margin:O+1,font:{size:w}},show:v,width:O},value:{color:P.color,formatter:()=>B,font:{size:W,family:C.typography.fontFamily}},show:!0}}},_={data:[[0,k]],label:P.title};try{this.canvasElement&&n().plot(this.canvasElement,[_],R)}catch(G){console.error("Gauge rendering error",G,R,P)}}render(){return i.createElement("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",overflow:"hidden"},className:this.props.className},this.renderVisualization())}}f.defaultProps={showThresholdMarkers:!0,showThresholdLabels:!1,field:{min:0,max:100,thresholds:m}}},41115:(j,I,e)=>{"use strict";e.d(I,{k:()=>h});var t=e(7610),n=e.n(t),i=e(89949),s=e(27702),r=e(45641),g=e(64167),d=e(727),l=e(36149),u=e(73014),o=e(84143);const m=({dimensions:v,activeDimensions:D,pos:a,timeZone:C})=>{let P=null;if(D.xAxis===null)return null;D.yAxis&&(P=D.yAxis[0]);const b=D.xAxis[1]?(0,r.jC)(v.xAxis,D.xAxis[0],D.xAxis[1]):a.x,M=(0,o.wu)(v.yAxis.columns,v.xAxis.columns,b,C),T=M.time,S=M.results.map((x,O)=>({color:x.color,label:x.label,value:x.value,isActive:P===O}));return s.createElement(u.c,{series:S,timestamp:T})};m.displayName="MultiModeGraphTooltip";var c=e(21609),p=e(75578);const f=({dimensions:v,activeDimensions:D,timeZone:a})=>{if(D.yAxis===null||D.yAxis[1]===void 0||D.xAxis===null||D.xAxis[1]===void 0)return null;const C=(0,r.jC)(v.xAxis,D.xAxis[0],D.xAxis[1]),P=(0,r.$q)(v.xAxis,D.xAxis[0]),b=P.display?(0,c.zc)(P.display(C)):C,M=(0,r.$q)(v.yAxis,D.yAxis[0]),T=(0,r.jC)(v.yAxis,D.yAxis[0],D.yAxis[1]),S=M.display,x=S(T);return s.createElement(u.c,{series:[{color:x.color,label:(0,p.CZ)(M),value:(0,c.zc)(x)}],timestamp:b})};f.displayName="SingleModeGraphTooltip";const E=({mode:v=g.f3.Single,dimensions:D,activeDimensions:a,pos:C,timeZone:P})=>!a||!a.xAxis?null:v==="single"?s.createElement(f,{dimensions:D,activeDimensions:a,timeZone:P}):s.createElement(m,{dimensions:D,activeDimensions:a,pos:C,timeZone:P});E.displayName="GraphTooltip";class h extends s.PureComponent{constructor(){super(...arguments),this.state={isTooltipVisible:!1,isContextVisible:!1},this.element=null,this.onPlotSelected=(D,a)=>{const{onHorizontalRegionSelected:C}=this.props;C&&C(a.xaxis.from,a.xaxis.to)},this.onPlotHover=(D,a,C)=>{this.setState({isTooltipVisible:!0,activeItem:C,pos:a})},this.onPlotClick=(D,a,C)=>{this.setState({isContextVisible:!0,isTooltipVisible:!1,contextItem:C,contextPos:a})},this.renderTooltip=()=>{const{children:D,series:a,timeZone:C}=this.props,{pos:P,activeItem:b,isTooltipVisible:M}=this.state;let T;if(!M||!P||a.length===0||(s.Children.forEach(D,N=>{if(T)return;(N&&N.type&&(N.type.displayName||N.type.name))===d.I.displayName&&(T=N)}),!T))return null;const S=T.props,x=S.mode||"single";if(!b&&x==="single")return null;const O=S.tooltipComponent||E,B=b?b.series.seriesIndex:0,A=b?b.dataIndex:void 0,V={xAxis:[B,A],yAxis:b?[b.series.seriesIndex,b.dataIndex]:null},W={dimensions:{xAxis:(0,r.q2)("xAxis",a.map(N=>N.timeField)),yAxis:(0,r.q2)("yAxis",a.map(N=>N.valueField))},activeDimensions:V,pos:P,mode:S.mode||g.f3.Single,timeZone:C},w=s.createElement(O,{...W});return s.cloneElement(T,{content:w,position:{x:P.pageX,y:P.pageY},offset:{x:10,y:10}})},this.renderContextMenu=()=>{const{series:D}=this.props,{contextPos:a,contextItem:C,isContextVisible:P}=this.state;if(!P||!a||!C||D.length===0)return null;const b=C?C.series.seriesIndex:0,M=C?C.dataIndex:void 0,T={xAxis:[b,M],yAxis:C?[C.series.seriesIndex,C.dataIndex]:null},S={xAxis:(0,r.q2)("xAxis",D.map(A=>A.timeField)),yAxis:(0,r.q2)("yAxis",D.map(A=>A.valueField))},x=()=>this.setState({isContextVisible:!1}),O=()=>({datapoint:C.datapoint,dataIndex:C.dataIndex,series:C.series,seriesIndex:C.series.seriesIndex,pageX:a.pageX,pageY:a.pageY}),B={x:a.pageX,y:a.pageY,onClose:x,getContextMenuSource:O,timeZone:this.props.timeZone,dimensions:S,contextDimensions:T};return s.createElement(l.w,{...B})},this.getBarWidth=()=>{const{series:D}=this.props;return Math.min(...D.map(a=>a.timeStep))}}componentDidUpdate(D,a){D!==this.props&&this.draw()}componentDidMount(){this.draw(),this.element&&(this.$element=n()(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(D){return D.length===0?[{show:!0,min:-1,max:1}]:(0,i.uniqBy)(D.map(a=>{const C=a.yAxis?a.yAxis.index:1,P=a.yAxis&&a.yAxis.min&&!isNaN(a.yAxis.min)?a.yAxis.min:null,b=a.yAxis&&a.yAxis.tickDecimals&&!isNaN(a.yAxis.tickDecimals)?a.yAxis.tickDecimals:null;return{show:!0,index:C,position:C===1?"left":"right",min:P,tickDecimals:b}}),a=>a.index)}draw(){if(this.element===null)return;const{width:D,series:a,timeRange:C,showLines:P,showBars:b,showPoints:M,isStacked:T,lineWidth:S,timeZone:x,onHorizontalRegionSelected:O}=this.props;if(!D)return;const B=D/100,A=C.from.valueOf(),V=C.to.valueOf(),W=this.getYAxes(a),w={legend:{show:!1},series:{stack:T,lines:{show:P,lineWidth:S,zero:!1},points:{show:M,fill:1,fillColor:!1,radius:2},bars:{show:b,fill:1,barWidth:b?this.getBarWidth()/1.5:1,zero:!1,lineWidth:S},shadowSize:0},xaxis:{timezone:x,show:!0,mode:"time",min:A,max:V,label:"Datetime",ticks:B,timeformat:(0,o.mc)(B,A,V),tickFormatter:o.sV},yaxes:W,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:O?"x":null,color:"#666"},crosshair:{mode:"x"}};try{n().plot(this.element,a.filter(N=>N.isVisible),w)}catch(N){throw console.error("Graph rendering error",N,w,a),new Error("Error rendering panel")}}render(){const{ariaLabel:D,height:a,width:C,series:P}=this.props,b=P.length===0,M=this.renderTooltip(),T=this.renderContextMenu();return s.createElement("div",{className:"graph-panel","aria-label":D},s.createElement("div",{className:"graph-panel__chart",ref:S=>this.element=S,style:{height:a,width:C},onMouseLeave:()=>{this.setState({isTooltipVisible:!1})}}),b&&s.createElement("div",{className:"datapoints-warning"},"No data"),M,T)}}h.defaultProps={showLines:!0,showPoints:!1,showBars:!1,isStacked:!1,lineWidth:1};const y=null},36149:(j,I,e)=>{"use strict";e.d(I,{b:()=>p,w:()=>c});var t=e(42844),n=e(27702),i=e(45641),s=e(60956),r=e(66310),g=e(14986),d=e(70944),l=e(64022),u=e(66711),o=e(79655),m=e(31297);const c=({getContextMenuSource:E,timeZone:h,itemsGroup:y,dimensions:v,contextDimensions:D,...a})=>{const C=E(),P=y?y.map(T=>({...T,items:T.items?.filter(S=>S.label)})):[],b=()=>{if(!C)return null;let T;if(v?.yAxis&&D?.yAxis?.[1]){const x=(0,i.jC)(v.yAxis,D.yAxis[0],D.yAxis[1]),O=C.series.valueField.display;T=O(x)}const S=(0,s.dq)(C.datapoint[0],{defaultWithMS:C.series.hasMsResolution,timeZone:h});return n.createElement(p,{timestamp:S,seriesColor:C.series.color,displayName:C.series.alias||C.series.label,displayValue:T})},M=()=>P?.map((T,S)=>n.createElement(u.k,{key:`${T.label}${S}`,label:T.label},(T.items||[]).map(x=>n.createElement(o.s,{key:`${x.label}`,url:x.url,label:x.label,target:x.target,icon:x.icon,active:x.active,onClick:x.onClick}))));return n.createElement(g.x,{...a,renderMenuItems:M,renderHeader:b})},p=({timestamp:E,seriesColor:h,displayName:y,displayValue:v})=>{const D=(0,r.wW)(f);return n.createElement("div",{className:D.wrapper},n.createElement("strong",null,E),n.createElement(l.Lh,null,n.createElement("div",null,n.createElement(m.F,{color:h}),n.createElement("span",{className:D.displayName},y)),v&&n.createElement(d.W,{value:v})))};function f(E){return{wrapper:(0,t.css)({padding:E.spacing(.5,1),fontSize:E.typography.size.sm,zIndex:E.zIndex.tooltip}),displayName:(0,t.css)({whiteSpace:"nowrap",paddingLeft:E.spacing(.5)})}}},7241:(j,I,e)=>{"use strict";e.d(I,{U:()=>s});var t=e(89949),n=e.n(t),i=e(27702);class s extends i.Component{constructor(g){super(g),this.onSeriesToggle=this.onSeriesToggle.bind(this),this.state={hiddenSeries:[],toggledSeries:g.series}}componentDidUpdate(g){const{series:d}=this.props;(0,t.isEqual)(g.series,d)||this.setState({hiddenSeries:[],toggledSeries:d})}onSeriesToggle(g,d){const{series:l,onHiddenSeriesChanged:u}=this.props,{hiddenSeries:o}=this.state;if(d.ctrlKey||d.metaKey||d.shiftKey){const f=o.indexOf(g)>-1?o.filter(h=>h!==g):o.concat([g]),E=l.map(h=>({...h,isVisible:f.indexOf(h.label)===-1}));this.setState({hiddenSeries:f,toggledSeries:E},()=>u?u(f):void 0);return}const m=l.map(f=>f.label),c=o.length+1===m.length?[]:(0,t.difference)(m,[g]),p=l.map(f=>({...f,isVisible:c.indexOf(f.label)===-1}));this.setState({hiddenSeries:c,toggledSeries:p},()=>u?u(c):void 0)}render(){const{children:g}=this.props,{toggledSeries:d}=this.state;return g({onSeriesToggle:this.onSeriesToggle,toggledSeries:d})}}},21783:(j,I,e)=>{"use strict";e.d(I,{U:()=>u});var t=e(42844),n=e(27702),i=e(80402),s=e(29372),r=e(71982),g=e(41115);const d=(0,i.B)(({placement:o})=>({wrapper:(0,t.css)({display:"flex",flexDirection:o==="bottom"?"column":"row"}),graphContainer:(0,t.css)({minHeight:"65%",flexGrow:1}),legendContainer:(0,t.css)({padding:"10px 0",maxHeight:o==="bottom"?"35%":"none"})})),l=(o,m=!1,c=!1)=>{const p=o.reduce((E,h)=>E+(h[1]||0),0)===0,f=!o.reduce((E,h)=>E&&h[1]!==null,!0);return m&&f||c&&p},u=o=>{const{series:m,timeRange:c,width:p,height:f,showBars:E,showLines:h,showPoints:y,sortLegendBy:v,sortLegendDesc:D,legendDisplayMode:a,legendVisibility:C,placement:P,onSeriesToggle:b,onToggleSort:M,hideEmpty:T,hideZero:S,isStacked:x,lineWidth:O,onHorizontalRegionSelected:B,timeZone:A,children:V,ariaLabel:W}=o,{graphContainer:w,wrapper:N,legendContainer:F}=d(o),k=m.reduce((H,R)=>l(R.data,T,S)?H:H.concat([{label:R.label,color:R.color||"",disabled:!R.isVisible,yAxis:R.yAxis.index,getDisplayValues:()=>R.info||[]}]),[]);return n.createElement("div",{className:N,"aria-label":W},n.createElement("div",{className:w},n.createElement(g.k,{series:m,timeRange:c,timeZone:A,showLines:h,showPoints:y,showBars:E,width:p,height:f,isStacked:x,lineWidth:O,onHorizontalRegionSelected:B},V)),C&&n.createElement("div",{className:F},n.createElement(s.$,{hideHorizontalTrack:!0},n.createElement(r.l,{items:k,displayMode:a,placement:P,sortBy:v,sortDesc:D,onLabelClick:(H,R)=>{b&&b(H.label,R)},onToggleSort:M}))))}},84143:(j,I,e)=>{"use strict";e.d(I,{mc:()=>l,sV:()=>d,wu:()=>g});var t=e(21609),n=e(75578),i=e(60956),s=e(65347);const r=(u,o)=>{let m=0,c=u.values.length-1,p;for(;;){if(m>c)return Math.max(c,0);p=Math.floor((m+c)/2);const f=u.values[p];if(f===o)return p;f&&f<o?m=p+1:c=p-1}},g=(u,o,m,c)=>{let p,f,E,h,y;const v=[];let D,a;for(p=0;p<u.length;p++){f=u[p];const C=o[p];E=r(C,m),h=m-C.values[E],y=C.values[E],(D===void 0||h>=0&&(h<D||D<0)||h<0&&h>D)&&(D=h,a=C.display?(0,t.zc)(C.display(y)):y);const P=f.display(f.values[E]);v.push({value:(0,t.zc)(P),datapointIndex:E,seriesIndex:p,color:P.color,label:(0,n.CZ)(f),time:C.display?(0,t.zc)(C.display(y)):y})}return{results:v,time:a}},d=(u,o)=>(0,i.dq)(u,{format:o?.options?.timeformat,timeZone:o?.options?.timezone}),l=(u,o,m)=>{if(o&&m&&u){const c=m-o,p=c/u/1e3,f=86400010,E=31536e6;return p<=10?s.U6.interval.millisecond:p<=45?s.U6.interval.second:c<=f?s.U6.interval.minute:p<=8e4?s.U6.interval.hour:c<=E?s.U6.interval.day:p<=31536e3?s.U6.interval.month:s.U6.interval.year}return s.U6.interval.minute}},18869:(j,I,e)=>{"use strict";e.d(I,{d:()=>h,j:()=>f});var t=e(27702),n=e(19973),i=e(44727),s=e(76178),r=e(19221),g=e(29241),d=e(84714),l=e(3935),u=e(70823),o=e(34072),m=e(81144),c=e(48473),p=e(90537);const f="__fixed";function E(y,v,D=[]){for(const a of D)if(typeof a=="function"){if(!a(y,v))return!1}else if(v[a]!==y[a])return!1;return!0}class h extends t.Component{constructor(v){super(v),this.panelContext={},this.subscription=new n.w0,this.getTimeRange=()=>this.props.timeRange;let D=this.prepState(v);D.alignedData=D.config.prepData([D.alignedFrame]),this.state=D,this.plotInstance=t.createRef()}prepState(v,D=!0){let a=null;const{frames:C,fields:P,preparePlotFrame:b}=v,T=(b||p.Rn)(C,P||{x:s.Ls.get(r.mi.firstTimeField).get({}),y:s.Ls.get(r.mi.byTypes).get(new Set([g.fS.number,g.fS.enum]))},v.timeRange);if((0,c.Zp)("GraphNG",!1,"data aligned",T),T){let S=this.state?.config;D&&(S=v.prepConfig(T,this.props.frames,this.getTimeRange),(0,c.Zp)("GraphNG",!1,"config prepared",S)),a={alignedFrame:T,config:S},(0,c.Zp)("GraphNG",!1,"data prepared",a.alignedData)}return a}handleCursorUpdate(v){const D=v.payload?.point?.time,a=this.plotInstance.current;if(a&&D){const C=a.valToPos(D,"x");let P;if(C&&(P=(0,c.ah)(a,a.posToIdx(C))),!P||!C)return;a.setCursor({left:C,top:P})}}componentDidMount(){this.panelContext=this.context;const{eventBus:v}=this.panelContext;this.subscription.add(v.getStream(d.es).pipe((0,i.p)(50)).subscribe({next:D=>{v!==D.origin&&this.handleCursorUpdate(D)}})),this.subscription.add(v.getStream(l.IA).pipe((0,i.p)(50)).subscribe({next:D=>this.handleCursorUpdate(D)})),this.subscription.add(v.getStream(d.xH).pipe((0,i.p)(50)).subscribe({next:()=>{const D=this.plotInstance?.current;D&&D.setCursor({left:-10,top:-10})}}))}componentDidUpdate(v){const{frames:D,structureRev:a,timeZone:C,propsToDiff:P}=this.props,b=!E(v,this.props,P);if(D!==v.frames||b||C!==v.timeZone){let M=this.prepState(this.props,!1);M&&((this.state.config===void 0||C!==v.timeZone||a!==v.structureRev||!a||b)&&(M.config=this.props.prepConfig(M.alignedFrame,this.props.frames,this.getTimeRange),(0,c.Zp)("GraphNG",!1,"config recreated",M.config)),M.alignedData=M.config.prepData([M.alignedFrame]),this.setState(M))}}componentWillUnmount(){this.subscription.unsubscribe()}render(){const{width:v,height:D,children:a,renderLegend:C}=this.props,{config:P,alignedFrame:b,alignedData:M}=this.state;return P?t.createElement(o.AY,{width:v,height:D,legend:C(P)},(T,S)=>t.createElement(m.N,{config:P,data:M,width:T,height:S,plotRef:x=>this.plotInstance.current=x},a?a(P,b):null)):null}}h.contextType=u.bb},62514:(j,I,e)=>{"use strict";e.d(I,{z:()=>i});var t=e(27702);const n=t.createContext({}),i=()=>{const{data:s,dimFields:r,mapSeriesIndexToDataFrameFieldIndex:g}=(0,t.useContext)(n),d=(0,t.useCallback)(()=>{const l=r.x;let u=null;for(let o=0;o<s.fields.length;o++)if(l(s.fields[o],s,[s])){u=s.fields[o];break}return u},[s,r]);return{dimFields:r,mapSeriesIndexToDataFrameFieldIndex:g,getXAxisField:d,alignedData:s}}},39596:(j,I,e)=>{"use strict";e.d(I,{w:()=>i});var t=e(90537);const n={threshold:(r,g,d)=>r+d,midpoint:(r,g,d)=>(r+g)/2,plusone:(r,g,d)=>r+1};function i(r){if(r.frame.length===0)return r.frame;let g=!0,{frame:d,refFieldName:l,refFieldPseudoMax:u,refFieldPseudoMin:o,insertMode:m}=r;m||(m=n.threshold);const c=(0,t.N$)(d,l);if(c==null)return d;c.state={...c.state,nullThresholdApplied:!0};const p=d.fields.map(E=>E.config.custom?.insertNulls||c.config.interval||null),f=new Set(p);if(f.delete(null),f.size===0)return d;if(f.size===1){const E=f.values().next().value;if(E<=0)return d;const h=c.values,y=d.fields.map(D=>D.values),v=s(h,y,E,o,u,m,g);return v===y?d:{...d,length:v[0].length,fields:d.fields.map((D,a)=>({...D,values:v[a]}))}}return d}function s(r,g,d,l=null,u=null,o,m){const c=r.length,p=[];if(l!=null&&l<r[0]){let y=Math.ceil((r[0]-l)/d),v=r[0]-y*d;for(;v<r[0];)p.push(o(v-d,v,d)),v+=d}p.push(r[0]);let f=r[0];for(let y=1;y<c;y++){const v=r[y];for(;v-f>d&&(p.push(o(f,v,d)),f+=d,!!m););p.push(v),f=v}if(u!=null&&u>f)for(;f+d<u;)p.push(o(f,u,d)),f+=d;const E=p.length;if(E===c)return g;const h=[];for(let y of g){let v;if(y!==r){v=Array(E);for(let D=0,a=0;D<E;D++)v[D]=r[a]===p[D]?y[a++]:null}else v=p;h.push(v)}return h}},26453:(j,I,e)=>{"use strict";e.d(I,{I:()=>t});function t(n){return{...n,fields:n.fields.map(i=>{const s=+i.config?.noValue;if(Number.isNaN(s))return i;{const r=i.values.slice();for(let g=0;g<r.length;g++)r[g]===null&&(r[g]=s);return{...i,values:r}}})}}},90537:(j,I,e)=>{"use strict";e.d(I,{z1:()=>m,N$:()=>l,Rn:()=>o});var t=e(29241),n=e(48962),i=e(64167),s=e(18869),r=e(39596);function g(p,f,E){let h,y;for(let v=0;v<f.length;v++)if(f[v]==null)y==null&&h!=null&&(y=v);else{if(y!=null){if(p[v]-h<E)for(;y<v;)f[y++]=void 0;y=null}h=p[v]}return f}function d(p){return p.type===t.fS.number&&p.config.custom?.drawStyle===i.l8.Bars&&!p.config.custom?.hideFrom?.viz}function l(p,f){return p.fields.find(E=>f!=null?E.name===f:E.type===t.fS.time)}function u(p,f){const E=l(p,f);let h=E?.values;for(let y=0;y<p.fields.length;y++){let v=p.fields[y];if(v===E||d(v))continue;let D=v.config.custom?.spanNulls;typeof D=="number"&&D!==-1&&(v.values=g(h,v.values,D))}return p}function o(p,f,E){let h;e:for(let a of p)for(let C of a.fields)if(f.x(C,a,p)){h=C;break e}p=p.map(a=>h?.state?.nullThresholdApplied?a:(0,r.w)({frame:a,refFieldName:h.name,refFieldPseudoMin:E?.from.valueOf(),refFieldPseudoMax:E?.to.valueOf()}));let y=0;p.forEach(a=>{a.fields.forEach(C=>{d(C)&&(C.config.custom={...C.config.custom,spanNulls:-1},y++)})});let v=1/0;y>1&&p.forEach(a=>{if(!a.fields.some(d))return;const C=h.values;for(let P=0;P<C.length;P++)P>0&&(v=Math.min(v,C[P]-C[P-1]))});let D=(0,n._9)({frames:p,joinBy:f.x,keep:f.y,keepOriginIndices:!0});return D?(D=u(D,h.name),v!==1/0&&(D.fields.forEach((a,C)=>{let P=a.values;if(C===0){let b=P[P.length-1];P.push(b+v,b+2*v)}else d(a)?P.push(null,null):P.push(void 0,void 0)}),D.length+=2),D):null}function m(p,f){const E="na",h=`${p.min!==void 0?p.min:E}-${p.max!==void 0?p.max:E}`,y=`${p.custom?.axisSoftMin!==void 0?p.custom.axisSoftMin:E}-${p.custom?.axisSoftMax!==void 0?p.custom.axisSoftMax:E}`,v=`${p.custom?.axisPlacement!==void 0?p.custom?.axisPlacement:i.LB.Auto}`,D=p.unit??s.j,a=p.custom?.scaleDistribution?c(p.custom.scaleDistribution):i.wf.Linear,C=p.custom?.axisLabel?p.custom.axisLabel:E;return`${D}/${h}/${y}/${v}/${a}/${C}/${f}`}function c(p){return p.type===i.wf.Log?`${p.type}${p.log}`:p.type}},73453:(j,I,e)=>{"use strict";e.d(I,{J:()=>dr});var t=e(42844),n=e(27702),i=e(98432),s=e(8553),r=e(66310),g=e(79161),d=e(94654),l=e(70726),u=e(30735),o=e(97048),m=e(43053),c=e(76059),p=e(41477),f=e(25173),E=e(89833),h=e(59658),y=e(85429),v=e(26925),D=e(22346),a=e(85334),C=e(10958),P=e(84060),b=e(92270),M=e(7803),T=e(26183),S=e(94526),x=e(49893),O=e(79691),B=e(35644),A=e(47255),V=e(76375),W=e(88921),w=e(59622),N=e(35988),F=e(63536),k=e(65976),H=e(69343),R=e(694),_=e(95e3),G=e(53505),Y=e(45299),X=e(65774),Q=e(39239),se=e(53516),Z=e(94149),le=e(62373),oe=e(42601),q=e(39295),ne=e(19570),ge=e(369),ae=e(71942),re=e(97623),De=e(7955),he=e(41429),ye=e(88447),ce=e(61501),We=e(85995),ke=e(48509),et=e(43305),we=e(16584),_e=e(42644),Ge=e(79603),qe=e(65291),st=e(45230),Me=e(7835),be=e(63050),Ke=e(62216),Ye=e(49024),tt=e(67226),nt=e(49162),Pt=e(88297),xt=e(70973),bt=e(26055),Rt=e(56271),ct=e(5810),it=e(3408),me=e(67628),Ee=e(50778),Ce=e(7274),Ae=e(70471),ze=e(75603),Ie=e(91196),xe=e(48411),Te=e(16243),Oe=e(78372),ie=e(8380),Le=e(48578),Be=e(83143),Ue=e(18625),ue=e(91157),pe=e(24062),$e=e(35548),Se=e(26407),Ve=e(23841),He=e(19827),Ze=e(5386),Qe=e(60093),rt=e(69980),pt=e(50319),It=e(67743),_t=e(27207),tn=e(7532),qt=e(6127),cn=e(61449),on=e(79748),ln=e(80384),Un=e(51164),yt=e(58929),ft=e(98723),Tt=e(90577),Bt=e(52677),Nt=e(98851),Ft=e(20323),Gt=e(2533),dn=e(51284),sn=e(63742),Bn=e(35398),wt=e(57710),Vt=e(91290),Ht=e(27714),Xt=e(42148),mn=e(1316),pn=e(39423),Pn=e(31277),zn=e(71580),Hn=e(71171),Ea=e(98790),aa=e(36746),na=e(4403),xa=e(80579),Ca=e(3802),Ba=e(22465),ka=e(11774),Ua=e(98361),$a=e(45453),Mt=e(99703),Dt=e(52370),ht=e(34924),Lt=e(40159),rn=e(76419),zt=e(26216),En=e(96864),Tn=e(83507),An=e(25119),xn=e(95428),ia=e(37917),oa=e(72461),_n=e(39228),sa=e(59619),ca=e(43743),jn=e(24099),ns=e(55054),Ta=e(8),Ja=e(3265),ps=e(13965),Jn=e(6666),Ya=e(97091),xs=e(34604),ss=e(75864),Xa=e(28122),Ps=e(48491),hs=e(97612),qs=e(32411),Sr=e(36319),Tr=e(96861),lr=e(25169),cr=e(34052),Ds=e(88175),kn=e(36277),ya=e(62695),ma=e(65023),Sa=e(51433),er=e(46558);let ws=!1,Za="public/img/icons/";function jt(Ss,sr){i.V[Za+sr]={content:Ss,status:"loaded"}}function va(){ws=!0;const Ss=typeof window<"u"&&window.__grafana_public_path__;Ss&&(Za=Ss+"img/icons/"),jt(g,"unicons/at.svg"),jt(d,"unicons/adjust-circle.svg"),jt(l,"unicons/angle-double-down.svg"),jt(u,"unicons/angle-double-right.svg"),jt(o,"unicons/angle-down.svg"),jt(m,"unicons/angle-left.svg"),jt(c,"unicons/angle-right.svg"),jt(p,"unicons/angle-up.svg"),jt(f,"unicons/apps.svg"),jt(E,"unicons/arrow.svg"),jt(h,"unicons/arrow-down.svg"),jt(y,"unicons/arrow-from-right.svg"),jt(v,"unicons/arrow-left.svg"),jt(D,"unicons/arrow-random.svg"),jt(a,"unicons/arrow-right.svg"),jt(C,"unicons/arrow-to-right.svg"),jt(P,"unicons/arrow-up.svg"),jt(b,"unicons/arrows-h.svg"),jt(M,"unicons/backward.svg"),jt(T,"unicons/bars.svg"),jt(S,"unicons/bell.svg"),jt(x,"unicons/bell-slash.svg"),jt(O,"unicons/bolt.svg"),jt(B,"unicons/book.svg"),jt(A,"unicons/book-open.svg"),jt(V,"unicons/brackets-curly.svg"),jt(W,"unicons/bug.svg"),jt(w,"unicons/building.svg"),jt(N,"unicons/calculator-alt.svg"),jt(F,"unicons/calendar-alt.svg"),jt(k,"unicons/calendar-slash.svg"),jt(H,"unicons/camera.svg"),jt(R,"unicons/channel-add.svg"),jt(_,"unicons/chart-line.svg"),jt(G,"unicons/check.svg"),jt(Y,"unicons/check-circle.svg"),jt(X,"unicons/circle.svg"),jt(Q,"unicons/clipboard-alt.svg"),jt(se,"unicons/clock-nine.svg"),jt(Z,"unicons/cloud.svg"),jt(le,"unicons/cloud-download.svg"),jt(oe,"unicons/code-branch.svg"),jt(q,"unicons/cog.svg"),jt(ne,"unicons/columns.svg"),jt(ge,"unicons/comment-alt.svg"),jt(ae,"unicons/comment-alt-share.svg"),jt(re,"unicons/comments-alt.svg"),jt(De,"unicons/compass.svg"),jt(he,"unicons/copy.svg"),jt(ye,"unicons/corner-down-right-alt.svg"),jt(ce,"unicons/cube.svg"),jt(We,"unicons/dashboard.svg"),jt(ke,"unicons/database.svg"),jt(et,"unicons/document-info.svg"),jt(we,"unicons/download-alt.svg"),jt(_e,"unicons/draggabledots.svg"),jt(Ge,"unicons/edit.svg"),jt(qe,"unicons/ellipsis-v.svg"),jt(st,"unicons/ellipsis-h.svg"),jt(Me,"unicons/envelope.svg"),jt(be,"unicons/exchange-alt.svg"),jt(Ke,"unicons/exclamation-circle.svg"),jt(Ye,"unicons/exclamation-triangle.svg"),jt(tt,"unicons/external-link-alt.svg"),jt(nt,"unicons/eye.svg"),jt(Pt,"unicons/eye-slash.svg"),jt(xt,"unicons/file-alt.svg"),jt(bt,"unicons/file-blank.svg"),jt(Rt,"unicons/filter.svg"),jt(ct,"unicons/folder.svg"),jt(it,"unicons/folder-open.svg"),jt(me,"unicons/folder-plus.svg"),jt(Ee,"unicons/folder-upload.svg"),jt(Ce,"unicons/forward.svg"),jt(Ae,"unicons/graph-bar.svg"),jt(ze,"unicons/history.svg"),jt(Ie,"unicons/home-alt.svg"),jt(xe,"unicons/import.svg"),jt(Te,"unicons/info.svg"),jt(Oe,"unicons/info-circle.svg"),jt(ie,"unicons/k6.svg"),jt(Le,"unicons/key-skeleton-alt.svg"),jt(Be,"unicons/keyboard.svg"),jt(Ue,"unicons/link.svg"),jt(ue,"unicons/list-ul.svg"),jt(pe,"unicons/lock.svg"),jt($e,"unicons/minus.svg"),jt(Se,"unicons/minus-circle.svg"),jt(Ve,"unicons/mobile-android.svg"),jt(He,"unicons/monitor.svg"),jt(Ze,"unicons/pause.svg"),jt(Qe,"unicons/pen.svg"),jt(rt,"unicons/play.svg"),jt(pt,"unicons/plug.svg"),jt(It,"unicons/plus.svg"),jt(_t,"unicons/plus-circle.svg"),jt(tn,"unicons/power.svg"),jt(qt,"unicons/presentation-play.svg"),jt(cn,"unicons/process.svg"),jt(on,"unicons/question-circle.svg"),jt(ln,"unicons/repeat.svg"),jt(Un,"unicons/rocket.svg"),jt(yt,"unicons/rss.svg"),jt(ft,"unicons/save.svg"),jt(Tt,"unicons/search.svg"),jt(Bt,"unicons/search-minus.svg"),jt(Nt,"unicons/search-plus.svg"),jt(Ft,"unicons/share-alt.svg"),jt(Gt,"unicons/shield.svg"),jt(dn,"unicons/signal.svg"),jt(sn,"unicons/signin.svg"),jt(Bn,"unicons/signout.svg"),jt(wt,"unicons/sitemap.svg"),jt(Vt,"unicons/slack.svg"),jt(Ht,"unicons/sliders-v-alt.svg"),jt(Xt,"unicons/sort-amount-down.svg"),jt(mn,"unicons/sort-amount-up.svg"),jt(pn,"unicons/square-shape.svg"),jt(Pn,"unicons/star.svg"),jt(zn,"unicons/step-backward.svg"),jt(Hn,"unicons/sync.svg"),jt(Ea,"unicons/stopwatch.svg"),jt(aa,"unicons/table.svg"),jt(na,"unicons/tag-alt.svg"),jt(xa,"unicons/times.svg"),jt(Ca,"unicons/trash-alt.svg"),jt(Ba,"unicons/unlock.svg"),jt(ka,"unicons/upload.svg"),jt(Ua,"unicons/user.svg"),jt($a,"unicons/users-alt.svg"),jt(Mt,"unicons/wrap-text.svg"),jt(Dt,"unicons/cloud-upload.svg"),jt(ht,"unicons/credit-card.svg"),jt(Lt,"unicons/file-copy-alt.svg"),jt(rn,"unicons/fire.svg"),jt(zt,"unicons/hourglass.svg"),jt(En,"unicons/layer-group.svg"),jt(Tn,"unicons/layers-alt.svg"),jt(An,"unicons/line-alt.svg"),jt(xn,"unicons/list-ui-alt.svg"),jt(ia,"unicons/message.svg"),jt(oa,"unicons/palette.svg"),jt(_n,"unicons/percentage.svg"),jt(sa,"unicons/shield-exclamation.svg"),jt(ca,"unicons/plus-square.svg"),jt(jn,"unicons/x.svg"),jt(ns,"unicons/capture.svg"),jt(Ta,"custom/gf-grid.svg"),jt(Ja,"custom/gf-landscape.svg"),jt(ps,"custom/gf-layout-simple.svg"),jt(Jn,"custom/gf-portrait.svg"),jt(Ya,"custom/gf-bar-alignment-after.svg"),jt(xs,"custom/gf-bar-alignment-before.svg"),jt(ss,"custom/gf-bar-alignment-center.svg"),jt(Xa,"custom/gf-interpolation-linear.svg"),jt(Ps,"custom/gf-interpolation-smooth.svg"),jt(hs,"custom/gf-interpolation-step-after.svg"),jt(qs,"custom/gf-interpolation-step-before.svg"),jt(Sr,"custom/gf-logs.svg"),jt(Tr,"custom/gf-movepane-left.svg"),jt(lr,"custom/gf-movepane-right.svg"),jt(cr,"mono/favorite.svg"),jt(Ds,"mono/grafana.svg"),jt(kn,"mono/heart.svg"),jt(ya,"mono/heart-break.svg"),jt(ma,"mono/panel-add.svg"),jt(Sa,"mono/library-panel.svg"),jt(er,"unicons/record-audio.svg")}var Vs=e(94851);const Fr=Ss=>({container:(0,t.css)({label:"Icon",display:"inline-block",lineHeight:0}),icon:(0,t.css)({verticalAlign:"middle",display:"inline-block",fill:"currentColor"}),orange:(0,t.css)({fill:Ss.v1.palette.orange})}),dr=n.forwardRef(({size:Ss="md",type:sr="default",name:Ts,className:ks,style:Va,title:Jr="",...Ct},gt)=>{const kt=(0,r.wW)(Fr);if(Ts?.startsWith("fa fa-"))return n.createElement("i",{className:Zr(Ts,ks),...Ct,style:Va});if(ws||va(),(0,s.Mo)(Ts)||console.warn("Icon component passed an invalid icon name",Ts),!Ts||Ts.includes(".."))return n.createElement("div",{ref:gt},"invalid icon name");const Kt=(0,Vs.B)(Ss),an=Kt,yn=Ts.startsWith("gf-bar-align")?16:Ts.startsWith("gf-interp")?30:Kt,hn=(0,Vs.y)(Ts,sr),Ln=`${Za}${hn}/${Ts}.svg`;return n.createElement("div",{className:kt.container,...Ct,ref:gt},n.createElement(i.Z,{src:Ln,width:yn,height:an,title:Jr,className:(0,t.cx)(kt.icon,ks,sr==="mono"?{[kt.orange]:Ts==="favorite"}:""),style:Va}))});dr.displayName="Icon";function Zr(Ss,sr){return(0,t.cx)(Ss,{"fa-spin":Ss==="fa fa-spinner"},sr)}},94851:(j,I,e)=>{"use strict";e.d(I,{B:()=>i,y:()=>n});const t=["grafana","favorite","heart-break","heart","panel-add","library-panel","circle-mono"];function n(s,r){return s?.startsWith("gf-")?"custom":t.includes(s)?"mono":r==="default"?"unicons":r==="solid"?"solid":"mono"}function i(s){switch(s){case"xs":return 12;case"sm":return 14;case"md":return 16;case"lg":return 18;case"xl":return 24;case"xxl":return 36;case"xxxl":return 48}}},67437:(j,I,e)=>{"use strict";e.d(I,{h:()=>m});var t=e(42844),n=e(27702),i=e(58939),s=e(96750),r=e(66310),g=e(80402),d=e(97289),l=e(73453),u=e(94851),o=e(80011);const m=n.forwardRef((p,f)=>{const{size:E="md",variant:h="secondary"}=p,y=(0,r.l4)();let v;E==="xxl"||E==="xxxl"?((0,i.d)("IconButton",'size="xxl" and size="xxxl"','size="xl"'),v="xl"):v=E;const D=c(y,v,h);let a,C;if("tooltip"in p){const{tooltip:P}=p;a=typeof P=="string"?P:void 0}else if("ariaLabel"in p||"aria-label"in p){const{ariaLabel:P,["aria-label"]:b}=p;a=b||P,C=f}if("tooltip"in p){const{name:P,iconType:b,className:M,tooltip:T,tooltipPlacement:S,...x}=p;return n.createElement(o.u,{ref:f,content:T,placement:S},n.createElement("button",{...x,ref:C,"aria-label":a,className:(0,t.cx)(D.button,M),type:"button"},n.createElement(l.J,{name:P,size:v,className:D.icon,type:b})))}else{const{name:P,iconType:b,className:M,...T}=p;return n.createElement("button",{...T,ref:C,"aria-label":a,className:(0,t.cx)(D.button,M),type:"button"},n.createElement(l.J,{name:P,size:v,className:D.icon,type:b}))}});m.displayName="IconButton";const c=(0,g.B)((p,f,E)=>{const h=(0,u.B)(f)+p.spacing.gridSize;let y=p.colors.text.primary;return E==="primary"?y=p.colors.primary.text:E==="destructive"&&(y=p.colors.error.text),{button:(0,t.css)({zIndex:0,position:"relative",margin:p.spacing(0,.5,0,0),boxShadow:"none",border:"none",display:"inline-flex",background:"transparent",justifyContent:"center",alignItems:"center",padding:0,color:y,"&[disabled], &:disabled":{cursor:"not-allowed",color:p.colors.action.disabledText,opacity:.65},"&:before":{zIndex:-1,position:"absolute",opacity:0,width:`${h}px`,height:`${h}px`,borderRadius:p.shape.radius.default,content:'""',transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionProperty:"opacity"},"&:focus, &:focus-visible":(0,d.getFocusStyles)(p),"&:focus:not(:focus-visible)":(0,d.getMouseFocusStyles)(p),"&:hover":{"&:before":{backgroundColor:E==="secondary"?p.colors.action.hover:s.alpha(y,.12),opacity:1}}}),icon:(0,t.css)({verticalAlign:"baseline"})}})},96198:(j,I,e)=>{"use strict";e.d(I,{Z:()=>d,a:()=>u});var t=e(42844),n=e(27702),i=e(62247),s=e(66310),r=e(25357),g=e(86064);const d=n.memo(n.forwardRef(({title:m,featureState:c,...p},f)=>{const E=(0,s.wW)(l),h=c?n.createElement(n.Fragment,null,n.createElement("div",{className:E.badge},n.createElement(u,{featureState:c})),n.createElement("h3",null,m)):n.createElement("h3",null,m);return n.createElement(g.v,{branded:!0,title:h,urlTitle:"Read documentation",ref:f,...p})}));d.displayName="FeatureInfoBox";const l=m=>({badge:(0,t.css)({marginBottom:m.spacing(1)})}),u=({featureState:m,tooltip:c})=>{const p=o(m);return n.createElement(r.C,{text:p.text,color:p.color,icon:p.icon,tooltip:c})};function o(m){switch(m){case i.CQ.alpha:return{text:"Alpha",icon:"exclamation-triangle",color:"orange"}}return{text:"Beta",icon:"rocket",color:"blue"}}},86064:(j,I,e)=>{"use strict";e.d(I,{v:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(80402),r=e(63439),g=e(73453);const d=n.memo(n.forwardRef(({title:u,className:o,children:m,branded:c,url:p,urlTitle:f,onDismiss:E,severity:h="info",...y},v)=>{const D=(0,i.wW)(l);return n.createElement(r.b,{severity:h,className:o,...y,ref:v,title:u},n.createElement("div",null,m),p&&n.createElement("a",{href:p,className:(0,t.cx)("external-link",D.docsLink),target:"_blank",rel:"noreferrer"},n.createElement(g.J,{name:"book"})," ",f||"Read more"))}));d.displayName="InfoBox";const l=(0,s.B)(u=>({docsLink:(0,t.css)({display:"inline-block",marginTop:u.spacing(2)})}))},28676:(j,I,e)=>{"use strict";e.d(I,{K:()=>d});var t=e(42844),n=e(27702),i=e(76566),s=e(66310),r=e(73453),g=e(52995);function d({referenceElement:c,children:p,suffixIcon:f,placement:E,alternativePlacement:h}){const[y,v]=(0,n.useState)(null),[D,a]=(0,n.useState)(E),C=(0,i.D)(c,y,{placement:D}),P=(0,s.wW)(l),b=(0,s.wW)(m);return n.useEffect(()=>{h&&u(E,y,c)&&a(h)},[h,E,y,c]),n.createElement(g.h_,null,n.createElement("div",{style:{display:"inline-block",...C.styles.popper},...C.attributes.popper,ref:v,"aria-live":"polite"},n.createElement("span",{className:(0,t.cx)(P.root,b[D])},p&&n.createElement("span",null,p),f&&n.createElement(r.J,{name:f}))))}const l=c=>({root:(0,t.css)({...c.typography.bodySmall,willChange:"transform",background:c.components.tooltip.background,color:c.components.tooltip.text,padding:c.spacing(.5,1.5),borderRadius:100,display:"inline-flex",gap:c.spacing(.5),alignItems:"center"})}),u=(c,p,f)=>{const E=p?.getBoundingClientRect(),h=f?.getBoundingClientRect();if(!E||!h)return!1;switch(c){case"right":return E.width+h.right>window.innerWidth;case"bottom":return E.height+h.bottom>window.innerHeight;case"left":return h.left-E.width<0;case"top":return h.top-E.height<0;default:return!1}},o=(c,p)=>(0,t.keyframes)({from:{opacity:0,transform:`translate(${c}, ${p})`},to:{opacity:1,transform:"translate(0, 0px)"}}),m=c=>{const f=o(0,c.spacing(1)),E=o(0,c.spacing(1*-1)),h=o(c.spacing(1),0),y=o(c.spacing(1*-1),0);return{top:(0,t.css)({marginBottom:c.spacing(1),animation:`${f} ease-out 100ms`}),bottom:(0,t.css)({marginTop:c.spacing(1),animation:`${E} ease-out 100ms`}),left:(0,t.css)({marginRight:c.spacing(1),animation:`${h} ease-out 100ms`}),right:(0,t.css)({marginLeft:c.spacing(1),animation:`${y} ease-out 100ms`})}}},31465:(j,I,e)=>{"use strict";e.d(I,{H:()=>s});var t=e(27702),n=e(11724),i=e(1128);const s=t.forwardRef((g,d)=>{const{defaultValue:l="",minWidth:u=10,maxWidth:o,onCommitChange:m,onKeyDown:c,onBlur:p,...f}=g,[E,h]=t.useState(l),[y,v]=t.useState(u);return(0,t.useEffect)(()=>{v(r(E.toString(),u,o))},[E,o,u]),t.createElement(i.I,{...f,ref:d,value:E.toString(),onChange:D=>{h(D.currentTarget.value)},width:y,onBlur:D=>{p?p(D):m&&m(D)},onKeyDown:D=>{c?c(D):D.key==="Enter"&&m&&m(D)},"data-testid":"autosize-input"})});function r(g,d,l){if(!g)return d;const u=3,o=(0,n.X1)(g.toString(),14).width/8+u;return d&&o<d?d:l&&o>l?l:o}s.displayName="AutoSizeInput"},1128:(j,I,e)=>{"use strict";e.d(I,{H:()=>u,I:()=>l});var t=e(42844),n=e(27702),i=e(17236),s=e(66310),r=e(80402),g=e(26468),d=e(62108);const l=n.forwardRef((o,m)=>{const{className:c,addonAfter:p,addonBefore:f,prefix:E,suffix:h,invalid:y,loading:v,width:D=0,...a}=o,[C,P]=(0,i.Z)(),[b,M]=(0,i.Z)(),T=(0,s.l4)(),S=u({theme:T,invalid:!!y,width:D});return n.createElement("div",{className:(0,t.cx)(S.wrapper,c),"data-testid":"input-wrapper"},!!f&&n.createElement("div",{className:S.addon},f),n.createElement("div",{className:S.inputWrapper},E&&n.createElement("div",{className:S.prefix,ref:C},E),n.createElement("input",{ref:m,className:S.input,...a,style:{paddingLeft:E?P.width+12:void 0,paddingRight:h||v?M.width+12:void 0}}),(h||v)&&n.createElement("div",{className:S.suffix,ref:b},v&&n.createElement(d.$,{className:S.loadingIndicator,inline:!0}),h)),!!p&&n.createElement("div",{className:S.addon},p))});l.displayName="Input";const u=(0,r.B)(({theme:o,invalid:m=!1,width:c})=>{const p="28px",f=(0,t.css)({position:"absolute",top:0,zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",flexGrow:0,flexShrink:0,fontSize:o.typography.size.md,height:"100%",minWidth:p,color:o.colors.text.secondary});return{wrapper:(0,t.cx)((0,t.css)({label:"input-wrapper",display:"flex",width:c?o.spacing(c):"100%",height:o.spacing(o.components.height.md),borderRadius:o.shape.borderRadius(),"&:hover":{"> .prefix, .suffix, .input":{borderColor:m?o.colors.error.border:o.colors.primary.border},"input[type='number']":{appearance:"textfield"},"input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button":{WebkitAppearance:"inner-spin-button !important",opacity:1}}})),inputWrapper:(0,t.css)({label:"input-inputWrapper",position:"relative",flexGrow:1,zIndex:1,"&:not(:first-child):last-child":{"> input":{borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0}},"&:first-child:not(:last-child)":{"> input":{borderRight:"none",borderTopRightRadius:0,borderBottomRightRadius:0}},"&:not(:first-child):not(:last-child)":{"> input":{borderRight:"none",borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0}},input:{"&:not(:first-child)":{paddingLeft:p},"&:not(:last-child)":{paddingRight:p},"&[readonly]":{cursor:"default"}}}),input:(0,t.cx)((0,g.GL)(o),(0,g.RK)(o,m),(0,t.css)({label:"input-input",position:"relative",zIndex:0,flexGrow:1,borderRadius:o.shape.borderRadius(),height:"100%",width:"100%"})),inputDisabled:(0,t.css)({backgroundColor:o.colors.action.disabledBackground,color:o.colors.action.disabledText,border:`1px solid ${o.colors.action.disabledBackground}`,"&:focus":{boxShadow:"none"}}),addon:(0,t.css)({label:"input-addon",display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:0,position:"relative","&:first-child":{borderTopRightRadius:0,borderBottomRightRadius:0,"> :last-child":{borderTopRightRadius:0,borderBottomRightRadius:0}},"&:last-child":{borderTopLeftRadius:0,borderBottomLeftRadius:0,"> :first-child":{borderTopLeftRadius:0,borderBottomLeftRadius:0}},"> *:focus":{zIndex:2}}),prefix:(0,t.cx)(f,(0,t.css)({label:"input-prefix",paddingLeft:o.spacing(1),paddingRight:o.spacing(.5),borderRight:"none",borderTopRightRadius:0,borderBottomRightRadius:0})),suffix:(0,t.cx)(f,(0,t.css)({label:"input-suffix",paddingLeft:o.spacing(1),paddingRight:o.spacing(1),marginBottom:"-2px",borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,right:0})),loadingIndicator:(0,t.css)({"& + *":{marginLeft:o.spacing(.5)}})}})},16310:(j,I,e)=>{"use strict";e.d(I,{g:()=>n});var t=e(46089);const n=t.Qr},39695:(j,I,e)=>{"use strict";e.d(I,{e:()=>h});var t=e(42844),n=e(89949),i=e(27702),s=e(10350),r=e(53933),g=e(66310),d=e(73453),l=e(50852),u=e(80011),o=e(67437);const m=(0,t.css)({display:"flex",alignItems:"center",height:"100%"});function c({row:a,__rowID:C}){return i.createElement("div",{className:m},i.createElement(o.h,{tooltip:"toggle row expanded","aria-controls":C,name:a.isExpanded?"angle-down":"angle-right","aria-expanded":a.isExpanded,...a.getToggleRowExpandedProps()}))}const p="__expander";function f(a){return[{id:p,Cell:c,disableSortBy:!0,width:0},...a.map(C=>({id:C.id,accessor:C.id,Header:C.header||(()=>null),sortType:C.sortType||"alphanumeric",disableSortBy:!C.sortType,width:C.disableGrow?0:void 0,visible:C.visible,...C.cell&&{Cell:C.cell}}))]}const E=a=>{const C=a.colors.emphasize(a.colors.background.primary,.03);return{container:(0,t.css)({display:"flex",gap:a.spacing(2),flexDirection:"column",width:"100%"}),table:(0,t.css)({borderRadius:a.shape.borderRadius(),width:"100%",td:{padding:a.spacing(1)},"td, th":{minWidth:a.spacing(3)}}),disableGrow:(0,t.css)({width:0}),header:(0,t.css)({borderBottom:`1px solid ${a.colors.border.weak}`,"&, & > button":{position:"relative",whiteSpace:"nowrap",padding:a.spacing(1)},"& > button":{"&:after":{content:'"\\00a0"'},width:"100%",height:"100%",background:"none",border:"none",paddingRight:a.spacing(2.5),textAlign:"left",fontWeight:a.typography.fontWeightMedium}}),row:(0,t.css)({label:"row",borderBottom:`1px solid ${a.colors.border.weak}`,"&:hover":{backgroundColor:C},"&:last-child":{borderBottom:0}}),expandedRow:(0,t.css)({label:"expanded-row-content",borderBottom:"none"}),expandedContentRow:(0,t.css)({label:"expanded-row-content",td:{borderBottom:`1px solid ${a.colors.border.weak}`,position:"relative",padding:a.spacing(2,2,2,5),"&:before":{content:'""',position:"absolute",width:"1px",top:0,left:"16px",bottom:a.spacing(2),background:a.colors.border.medium}}}),sortableHeader:(0,t.css)({"&&":{padding:0}})}};function h({className:a,columns:C,data:P,getRowId:b,headerTooltips:M,pageSize:T=0,renderExpandedRow:S}){const x=(0,g.wW)(E),O=(0,i.useMemo)(()=>f(C),[C]),B=y(),A=(0,i.useCallback)(R=>`${B}-${R.id}`.replace(/\s/g,""),[B]),V=[s.useSortBy,s.useExpanded],W=T>0;W&&V.push(s.usePagination);const w=(0,s.useTable)({columns:O,data:P,autoResetExpanded:!1,autoResetSortBy:!1,disableMultiSort:!0,getRowId:b,initialState:{hiddenColumns:[!S&&p,...O.filter(R=>!(!R.visible||R.visible(P))).map(R=>R.id).filter(r.fQ)].filter(r.fQ)}},...V),{getTableProps:N,getTableBodyProps:F,headerGroups:k,prepareRow:H}=w;return(0,i.useEffect)(()=>{W&&w.setPageSize(T)},[W,T,w.setPageSize,w]),i.createElement("div",{className:x.container},i.createElement("table",{...N(),className:(0,t.cx)(x.table,a)},i.createElement("thead",null,k.map(R=>{const{key:_,...G}=R.getHeaderGroupProps();return i.createElement("tr",{key:_,...G},R.headers.map(Y=>{const{key:X,...Q}=Y.getHeaderProps(),se=M?.[Y.id];return i.createElement("th",{key:X,className:(0,t.cx)(x.header,{[x.disableGrow]:Y.width===0,[x.sortableHeader]:Y.canSort}),...Q,...Y.isSorted&&{"aria-sort":Y.isSortedDesc?"descending":"ascending"}},i.createElement(D,{column:Y,headerTooltip:se}))}))})),i.createElement("tbody",{...F()},(W?w.page:w.rows).map(R=>{H(R);const{key:_,...G}=R.getRowProps(),Y=A(R),X=R.isExpanded;return i.createElement(i.Fragment,{key:_},i.createElement("tr",{...G,className:(0,t.cx)(x.row,X&&x.expandedRow)},R.cells.map(Q=>{const{key:se,...Z}=Q.getCellProps();return i.createElement("td",{key:se,...Z},Q.render("Cell",{__rowID:Y}))})),X&&S&&i.createElement("tr",{...G,id:Y,className:x.expandedContentRow},i.createElement("td",{colSpan:R.cells.length},S(R.original))))}))),W&&i.createElement("span",null,i.createElement(l.t,{currentPage:w.state.pageIndex+1,numberOfPages:w.pageOptions.length,onNavigate:R=>w.gotoPage(R-1)})))}const y=()=>(0,i.useMemo)(()=>(0,n.uniqueId)("InteractiveTable"),[]),v=a=>({sortIcon:(0,t.css)({position:"absolute",top:a.spacing(1)}),headerTooltipIcon:(0,t.css)({marginLeft:a.spacing(.5)})});function D({column:{canSort:a,render:C,isSorted:P,isSortedDesc:b,getSortByToggleProps:M},headerTooltip:T}){const S=(0,g.wW)(v),{onClick:x}=M(),O=i.createElement(i.Fragment,null,C("Header"),T&&i.createElement(u.u,{theme:"info-alt",content:T.content,placement:"top-end"},i.createElement(d.J,{className:S.headerTooltipIcon,name:T.iconName||"info-circle","data-testid":"header-tooltip-icon"})),P&&i.createElement("span",{"aria-hidden":"true",className:S.sortIcon},i.createElement(d.J,{name:b?"angle-down":"angle-up"})));return a?i.createElement("button",{type:"button",onClick:x},O):O}},78838:(j,I,e)=>{"use strict";e.d(I,{g:()=>i});var t=e(27702),n=e(17185);class i extends t.PureComponent{constructor(){super(...arguments),this.wrapperRef=(0,t.createRef)(),this.renderJson=()=>{const{json:r,config:g,open:d,onDidRender:l}=this.props,u=this.wrapperRef.current,o=new n.u(r,d,g);u.hasChildNodes()?u.replaceChild(o.render(),u.lastChild):u.appendChild(o.render()),l&&l(o.json)}}componentDidMount(){this.renderJson()}componentDidUpdate(){this.renderJson()}render(){const{className:r}=this.props;return t.createElement("div",{className:r,ref:this.wrapperRef})}}i.defaultProps={open:3,config:{animateOpen:!0}}},17185:(j,I,e)=>{"use strict";e.d(I,{u:()=>y});var t=e(89949);function n(v){return v.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function i(v){return!!v&&typeof v==="object"}function s(v){if(v===void 0)return"";if(v===null||typeof v=="object"&&!v.constructor)return"Object";const a=/function ([^(]*)/.exec(v.constructor.toString());return a&&a.length>1?a[1]:""}function r(v){return v===null?"null":typeof v}function g(v,D){const a=r(v);return a==="null"||a==="undefined"?a:(a==="string"&&(D='"'+n(D)+'"'),a==="function"?v.toString().replace(/[\r\n]/g,"").replace(/\{.*\}/,"")+"{\u2026}":D)}let d="";function l(v){return i(v)?(d=s(v),Array.isArray(v)&&(d+="["+v.length+"]")):d=g(v,v.toString()),d}function u(v){return`json-formatter-${v}`}function o(v,D,a){const C=document.createElement(v);return D&&C.classList.add(u(D)),a!==void 0&&(a instanceof Node?C.appendChild(a):C.appendChild(document.createTextNode(String(a)))),C}const m=/(^\d{1,4}[\.|\\/|-]\d{1,2}[\.|\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/,c=/\d{2}:\d{2}:\d{2} GMT-\d{4}/,p=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,f=10,E=typeof window<"u"&&window.requestAnimationFrame||(v=>(v(),0)),h={animateOpen:!0,animateClose:!0};class y{constructor(D,a=1,C=h,P){this.json=D,this.open=a,this.config=C,this.key=P,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"&&(m.test(this.json)||p.test(this.json)||c.test(this.json))}get isUrl(){return this.type==="string"&&this.json.indexOf("http")===0}get isArray(){return Array.isArray(this.json)}get isObject(){return i(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 s(this.json)}get type(){return r(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(u("open")))}openAtDepth(D=1){D<0||(this.open=D,this.isOpen=D!==0,this.element&&(this.removeChildren(!1),D===0?this.element.classList.remove(u("open")):(this.appendChildren(this.config.animateOpen),this.element.classList.add(u("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=o("span");return D.appendChild(o("span","bracket","[")),this.isNumberArray()?(this.json.forEach((a,C)=>{C>0&&D.appendChild(o("span","array-comma",",")),D.appendChild(o("span","number",a))}),this.skipChildren=!0):D.appendChild(o("span","number",this.json.length)),D.appendChild(o("span","bracket","]")),D}render(D=!1){this.element=o("div","row");const a=o("a","toggler-link"),C=o("span","toggler");if(this.isObject&&a.appendChild(C),this.hasKey&&a.appendChild(o("span","key",`${this.key}:`)),this.isObject){const b=o("span","value"),M=o("span"),T=o("span","constructor-name",this.constructorName);if(M.appendChild(T),this.isArray){const S=this.renderArray();M.appendChild(S)}b.appendChild(M),a.appendChild(b)}else{const b=this.isUrl?o("a"):o("span");b.classList.add(u(this.type)),this.isDate&&b.classList.add(u("date")),this.isUrl&&(b.classList.add(u("url")),b.setAttribute("href",this.json));const M=g(this.json,this.json);b.appendChild(document.createTextNode(M)),a.appendChild(b)}const P=o("div","children");return this.isObject&&P.classList.add(u("object")),this.isArray&&P.classList.add(u("array")),this.isEmpty&&P.classList.add(u("empty")),this.config&&this.config.theme&&this.element.classList.add(u(this.config.theme)),this.isOpen&&this.element.classList.add(u("open")),D||this.element.appendChild(a),this.skipChildren?a.removeChild(C):this.element.appendChild(P),this.isObject&&this.isOpen&&this.appendChildren(),this.isObject&&a.addEventListener("click",this.toggleOpen.bind(this)),this.element}appendChildren(D=!1){const a=this.element&&this.element.querySelector(`div.${u("children")}`);if(!(!a||this.isEmpty))if(D){let C=0;const P=()=>{const b=this.keys[C],M=new y(this.json[b],this.open-1,this.config,b);a.appendChild(M.render()),C+=1,C<this.keys.length&&(C>f?P():E(P))};E(P)}else this.keys.forEach(C=>{const P=new y(this.json[C],this.open-1,this.config,C);a.appendChild(P.render())})}removeChildren(D=!1){const a=this.element&&this.element.querySelector(`div.${u("children")}`);if(D){let C=0;const P=()=>{a&&a.children.length&&(a.removeChild(a.children[0]),C+=1,C>f?P():E(P))};E(P)}else a&&(a.innerHTML="")}}},64022:(j,I,e)=>{"use strict";e.d(I,{Ar:()=>r,Lh:()=>g,W2:()=>l,wc:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=(c=>(c[c.Horizontal=0]="Horizontal",c[c.Vertical=1]="Vertical",c))(s||{});const r=({children:c,orientation:p=0,spacing:f="sm",justify:E="flex-start",align:h="normal",wrap:y=!1,width:v="100%",height:D="100%",...a})=>{const C=(0,i.wW)((0,n.useCallback)(P=>u(P,p,f,E,h,y),[h,E,p,f,y]));return n.createElement("div",{className:C.layout,style:{width:v,height:D},...a},n.Children.toArray(c).filter(Boolean).map((P,b)=>n.createElement("div",{className:C.childWrapper,key:b},P)))},g=({children:c,spacing:p,justify:f,align:E="center",wrap:h,width:y,height:v})=>n.createElement(r,{spacing:p,justify:f,orientation:0,align:E,width:y,height:v,wrap:h},c),d=({children:c,spacing:p,justify:f,align:E,width:h,height:y})=>n.createElement(r,{spacing:p,justify:f,orientation:1,align:E,width:h,height:y},c),l=({children:c,padding:p,margin:f,grow:E,shrink:h})=>{const y=(0,i.wW)((0,n.useCallback)(v=>m(v,p,f),[p,f]));return n.createElement("div",{className:(0,t.cx)(y.wrapper,E!==void 0&&(0,t.css)({flexGrow:E}),h!==void 0&&(0,t.css)({flexShrink:h}))},c)},u=(c,p,f,E,h,y)=>{const v=f!=="none"?c.spacing(o[f]):0,D=p===0&&!y||p===1?0:`-${v}`,a=p===1?"vertical-group":"horizontal-group";return{layout:(0,t.css)({label:a,display:"flex",flexDirection:p===1?"column":"row",flexWrap:y?"wrap":"nowrap",justifyContent:E,alignItems:h,height:"100%",maxWidth:"100%",marginBottom:D}),childWrapper:(0,t.css)({label:"layoutChildrenWrapper",marginBottom:p===0&&!y?0:v,marginRight:p===0?v:0,display:"flex",alignItems:h,"&:last-child":{marginBottom:p===1?0:void 0,marginRight:p===0?0:void 0}})}},o={none:0,xs:.5,sm:1,md:2,lg:3},m=(c,p,f)=>{const E=p&&p!=="none"&&c.spacing(o[p])||0,h=f&&f!=="none"&&c.spacing(o[f])||0;return{wrapper:(0,t.css)({label:"container",margin:h,padding:E})}}},9848:(j,I,e)=>{"use strict";e.d(I,{r:()=>r});var t=e(27702),n=e(85014),i=e(94469),s=e(48154);const r=(0,t.forwardRef)(({href:g,children:d,...l},u)=>{const o=i.u.stripBaseFromUrl(s.QX.sanitizeUrl(g??""));return t.createElement(n.Link,{ref:u,to:o,...l},d)});r.displayName="Link"},90038:(j,I,e)=>{"use strict";e.d(I,{h:()=>o});var t=e(42844),n=e(27702),i=e(94469),s=e(48154),r=e(66310),g=e(73453),d=e(67106),l=e(9848);const u={h1:"xl",h2:"xl",h3:"lg",h4:"lg",h5:"md",h6:"md",body:"md",bodySmall:"xs"},o=(0,n.forwardRef)(({href:c,color:p="link",external:f=!1,inline:E=!0,variant:h="body",weight:y,icon:v,children:D,...a},C)=>{const P=i.u.stripBaseFromUrl(s.QX.sanitizeUrl(c??"")),b=(0,r.l4)(),M=m(b,E,h,y,p),T=v||"external-link-alt";return f?n.createElement("a",{href:P,ref:C,...a,target:"_blank",rel:"noreferrer",className:M},D,n.createElement(g.J,{size:u[h]||"md",name:T})):n.createElement(l.r,{ref:C,href:P,...a,className:M},D,v&&n.createElement(g.J,{name:v,size:u[h]||"md"}))});o.displayName="TextLink";const m=(c,p,f,E,h)=>(0,t.css)([f&&{...c.typography[f]},E&&{fontWeight:(0,d.RC)(E,c)},h&&{color:c.colors.text[h]},{alignItems:"center",gap:"0.25em",display:"inline-flex",textDecoration:"none","&:hover":{textDecoration:"underline",color:c.colors.text.link}},p&&{textDecoration:"underline","&:hover":{textDecoration:"none"}}])},20868:(j,I,e)=>{"use strict";e.d(I,{L:()=>r});var t=e(42844),n=e(27702),i=e(80402);const s=(0,i.B)((g=!1)=>({list:(0,t.css)({listStyleType:"none",margin:0,padding:0}),item:(0,t.css)({display:g&&"inline-block"||"block"})}));class r extends n.PureComponent{constructor(d){super(d)}render(){const{items:d,renderItem:l,getItemKey:u,className:o,inline:m}=this.props,c=s(m);return n.createElement("ul",{className:(0,t.cx)(c.list,o)},d.map((p,f)=>n.createElement("li",{className:c.item,key:u?u(p):f},l(p,f))))}}},71573:(j,I,e)=>{"use strict";e.d(I,{Y:()=>i});var t=e(27702),n=e(20868);class i extends t.PureComponent{render(){return t.createElement(n.L,{inline:!0,...this.props})}}},59390:(j,I,e)=>{"use strict";e.d(I,{a:()=>i});var t=e(27702),n=e(20868);class i extends t.PureComponent{render(){return t.createElement(n.L,{...this.props})}}},98557:(j,I,e)=>{"use strict";e.d(I,{F:()=>d});var t=e(42844),n=e(27702),i=e(66310);const s=2.4,r=500,g=4e3;function d({width:u,ariaLabel:o="Loading bar"}){const m=(0,i.wW)(l),c=Math.min(Math.max(Math.round(u*s),r),g),p={width:"100%",animation:`${m.animation} ${c}ms infinite linear`,willChange:"transform"};return n.createElement("div",{style:p},n.createElement("div",{"aria-label":o,className:m.bar}))}const l=()=>({animation:(0,t.keyframes)({"0%":{transform:"translateX(-50%)"},"100%":{transform:"translateX(100%)"}}),bar:(0,t.css)({width:"28%",height:1,background:"linear-gradient(90deg, rgba(110, 159, 255, 0) 0%, #6E9FFF 80.75%, rgba(110, 159, 255, 0) 100%)"})})},52419:(j,I,e)=>{"use strict";e.d(I,{u:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(62108);const r=({text:d,className:l,...u})=>{const o=(0,i.wW)(g);return n.createElement("div",{className:(0,t.cx)(o.container,l),...u},d," ",n.createElement(s.$,{inline:!0}))},g=d=>({container:(0,t.css)({marginBottom:d.spacing(4)})})},86912:(j,I,e)=>{"use strict";e.d(I,{b:()=>s});var t=e(27702),n=e(28580),i=e(38588);const s=({value:r,onChange:g,context:d,item:l})=>{const u=l.settings??{},o=(0,i.IX)(d.data,u?.filter),m=(0,i.nw)(o,r),c=(0,t.useCallback)(f=>{if(!(f&&!(0,i.w3)(f.value,o)))return g(f?.value)},[o,g]),p=m.find(f=>f.value===r);return t.createElement(t.Fragment,null,t.createElement(n.Ph,{value:p,placeholder:u.placeholderText??"Select field",options:m,onChange:c,noOptionsMessage:u.noFieldsMessage,width:u.width,isClearable:u.isClearable!==!1}))}},27857:(j,I,e)=>{"use strict";e.d(I,{$w:()=>m,OL:()=>l});var t=e(27702),n=e(29241),i=e(19221),s=e(76178),r=e(4680),g=e(28580);const d=(0,t.memo)(c=>{const{data:p,options:f,onChange:E,id:h}=c,y=u(p),v=o(y,f),D=(0,t.useCallback)(C=>E(C.value),[E]),a=v.find(C=>C.value===f);return t.createElement(g.Ph,{inputId:h,value:a,options:v,onChange:D})});d.displayName="FieldTypeMatcherEditor";const l=[{value:n.fS.number,label:"Number",icon:(0,r.WZ)(n.fS.number)},{value:n.fS.string,label:"String",icon:(0,r.WZ)(n.fS.string)},{value:n.fS.time,label:"Time",icon:(0,r.WZ)(n.fS.time)},{value:n.fS.boolean,label:"Boolean",icon:(0,r.WZ)(n.fS.boolean)},{value:n.fS.trace,label:"Traces",icon:(0,r.WZ)(n.fS.trace)},{value:n.fS.enum,label:"Enum",icon:(0,r.WZ)(n.fS.enum)},{value:n.fS.other,label:"Other",icon:(0,r.WZ)(n.fS.other)}],u=c=>(0,t.useMemo)(()=>{const p=new Map;for(const f of l)p.set(f.value,0);for(const f of c)for(const E of f.fields){const h=E.type||n.fS.other;let y=p.get(h);y||(y=0),p.set(h,y+1)}return p},[c]),o=(c,p)=>(0,t.useMemo)(()=>{let f=!1;const E=[];for(const h of l){const y=c.get(h.value),v=p===h.value;(y||v)&&E.push({...h,label:`${h.label} (${c.get(h.value)})`}),v&&(f=!0)}return p&&!f&&E.push({value:p,label:`${p} (No matches)`}),E},[c,p]),m={id:i.mi.byType,component:d,matcher:s.Ls.get(i.mi.byType),name:"Fields with type",description:"Set properties for fields of a specific type (number, string, boolean)",optionsToLabel:c=>c}},45346:(j,I,e)=>{"use strict";e.d(I,{J8:()=>o,fN:()=>f});var t=e(42844),n=e(27702),i=e(66656),s=e(19221),r=e(76178),g=e(64167),d=e(66310),l=e(1128),u=e(28580);const o=[{label:"==",value:g.Bd.EQ},{label:"!=",value:g.Bd.NEQ},{label:">",value:g.Bd.GT},{label:">=",value:g.Bd.GTE},{label:"<",value:g.Bd.LT},{label:"<=",value:g.Bd.LTE}];function m(E){return E===i.gz.allIsNull||E===i.gz.allIsZero}const c=({options:E,onChange:h})=>{const y=(0,d.wW)(p),v=(0,n.useMemo)(()=>i.TB.selectOptions([E?.reducer]),[E?.reducer]),D=(0,n.useCallback)(M=>h({...E,reducer:M.value}),[E,h]),a=(0,n.useCallback)(M=>h({...E,op:M.value}),[E,h]),C=(0,n.useCallback)(M=>{const T=M.currentTarget.valueAsNumber;return h({...E,value:T})},[E,h]),P=E??{},b=m(E.reducer);return n.createElement("div",{className:y.spot},n.createElement(u.Ph,{value:v.current,options:v.options,onChange:D,placeholder:"Select field reducer"}),P.reducer&&!b&&n.createElement(n.Fragment,null,n.createElement(u.Ph,{value:o.find(M=>M.value===P.op),options:o,onChange:a,"aria-label":"Comparison operator",width:19}),n.createElement(l.I,{type:"number",value:P.value,onChange:C})))},p=E=>({spot:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center",alignContent:"flex-end",gap:"4px"})}),f={id:s.mi.byValue,component:c,matcher:r.Ls.get(s.mi.byValue),name:"Fields with values",description:"Set properties for fields with reducer condition",optionsToLabel:E=>`${E?.reducer} ${E?.op} ${E?.value}`}},85219:(j,I,e)=>{"use strict";e.d(I,{O:()=>d,S:()=>o});var t=e(27702),n=e(75578),i=e(19221),s=e(76178),r=e(28580);const g=(m,c,p)=>{if(!p)return;let f=m.find(E=>!c.some(h=>E===h));if(f)return f};function d({value:m,data:c,onChange:p,placeholder:f}){const E=(0,t.useMemo)(()=>l(c),[c]),[h,y]=(0,t.useState)({refIds:[],value:void 0}),v=(0,t.useMemo)(()=>E.find(a=>a.value===m)??g(E,h.refIds,h.value),[m,E,h]),D=(0,t.useCallback)(a=>{p(a?.value)},[p]);return(E!==h.refIds||v?.value!==h.value)&&y({refIds:E,value:v?.value}),t.createElement(r.Ph,{options:E,onChange:D,isClearable:!0,placeholder:f??"Select query refId",value:v})}function l(m){const c=new Map;for(const f of m){const E=f.refId??"",h=c.get(E)??[];h.length===0&&c.set(E,h),h.push(f)}const p=[];for(const[f,E]of c.entries())p.push({value:f,label:`Query: ${f??"(missing refId)"}`,description:u(E)});return p}function u(m){return`Frames (${m.length}): ${m.slice(0,Math.min(3,m.length)).map(c=>(0,n.nf)(c)).join(", ")} ${m.length>3?"...":""}`}const o={id:i.mi.byFrameRefID,component:m=>t.createElement(d,{value:m.options,data:m.data,onChange:m.onChange}),matcher:s.Ls.get(i.mi.byFrameRefID),name:"Fields returned by query",description:"Set properties for fields from a specific query",optionsToLabel:m=>m}},78425:(j,I,e)=>{"use strict";e.d(I,{i:()=>y});var t=e(25359),n=e(27702),i=e(19221),s=e(76178),r=e(1128);const g=(0,n.memo)(v=>{const{options:D,onChange:a}=v,C=(0,n.useCallback)(P=>a(P.target.value),[a]);return n.createElement(r.I,{placeholder:"Enter regular expression",defaultValue:D,onBlur:C})});g.displayName="FieldNameByRegexMatcherEditor";const d={id:i.mi.byRegexp,component:g,matcher:s.Ls.get(i.mi.byRegexp),name:"Fields with name matching regex",description:"Set properties for fields with names matching a regex",optionsToLabel:v=>v};var l=e(28580),u=e(38588);const o=(0,n.memo)(v=>{const{data:D,options:a,onChange:C,id:P}=v,b=(0,u.IX)(D),M=(0,u.nw)(b,a),T=(0,n.useCallback)(x=>{if((0,u.w3)(x.value,b))return C(x.value)},[b,C]),S=M.find(x=>x.value===a);return n.createElement(l.Ph,{value:S,options:M,onChange:T,inputId:P})});o.displayName="FieldNameMatcherEditor";const m={id:i.mi.byName,component:o,matcher:s.Ls.get(i.mi.byName),name:"Fields with name",description:"Set properties for a specific field",optionsToLabel:v=>v},c=(0,n.memo)(v=>{const{data:D,options:a,onChange:C}=v,{readOnly:P,prefix:b}=a,M=(0,u.IX)(D),T=(0,u.nw)(M,void 0),S=(0,n.useCallback)(x=>{if(Array.isArray(x))return C({...a,names:x.reduce((O,B)=>((0,u.w3)(B.value,M)&&O.push(B.value),O),[])})},[M,C,a]);if(P){const x=(a.names??[]).join(", ");return n.createElement(r.I,{value:x,readOnly:!0,disabled:!0,prefix:b})}return n.createElement(l.NU,{value:a.names,options:T,onChange:S})});c.displayName="FieldNameMatcherEditor";const p={id:i.mi.byNames,component:c,matcher:s.Ls.get(i.mi.byNames),name:"Fields with name",description:"Set properties for a specific field",optionsToLabel:v=>(v.names??[]).join(", "),excludeFromPicker:!0};var f=e(27857),E=e(45346),h=e(85219);const y=new t.B(()=>[m,d,f.$w,h.S,p,E.fN])},38588:(j,I,e)=>{"use strict";e.d(I,{IX:()=>g,g2:()=>r,nw:()=>d,w3:()=>s});var t=e(27702),n=e(75578),i=e(4680);function s(l,u){return l?u.display.has(l)||u.raw.has(l):!1}function r(l,u){const o={display:new Set,raw:new Set,fields:new Map};for(const m of l)for(const c of m.fields){if(u&&!u(c))continue;const p=(0,n.CZ)(c,m,l);o.display.add(p),o.fields.set(p,c),c.name&&p!==c.name&&(o.raw.add(c.name),o.fields.set(c.name,c))}return o}function g(l,u){return(0,t.useMemo)(()=>r(l,u),[l,u])}function d(l,u,o,m){return(0,t.useMemo)(()=>{let c=!1;const p=[];o&&p.push(o);for(const f of l.display){!c&&f===u&&(c=!0);const E=l.fields.get(f);(!m||m===E?.type)&&p.push({value:f,label:f,icon:E?(0,i.e7)(E):void 0})}for(const f of l.raw)l.display.has(f)||(!c&&f===u&&(c=!0),p.push({value:f,label:`${f} (base field name)`}));return u&&!c&&p.push({value:u,label:`${u} (not found)`}),p},[l,u,o,m])}},89746:(j,I,e)=>{"use strict";e.d(I,{v:()=>u});var t=e(42844),n=e(27702),i=e(66310),s=e(53709),r=e(66711),g=e(79655),d=e(55238);const l=n.forwardRef(({header:m,children:c,ariaLabel:p,onOpen:f,onClose:E,onKeyDown:h,...y},v)=>{const D=(0,i.wW)(o),a=(0,n.useRef)(null);(0,n.useImperativeHandle)(v,()=>a.current);const[C]=(0,d.d)({localRef:a,onOpen:f,onClose:E,onKeyDown:h});return n.createElement("div",{...y,tabIndex:-1,ref:a,className:D.wrapper,role:"menu","aria-label":p,onKeyDown:C},m&&n.createElement("div",{className:(0,t.cx)(D.header,!!c&&n.Children.toArray(c).length>0&&D.headerBorder)},m),c)});l.displayName="Menu";const u=Object.assign(l,{Item:g.s,Divider:s.R,Group:r.k}),o=m=>({header:(0,t.css)({padding:`${m.spacing(.5,1,1,1)}`}),headerBorder:(0,t.css)({borderBottom:`1px solid ${m.colors.border.weak}`}),wrapper:(0,t.css)({background:`${m.colors.background.primary}`,boxShadow:`${m.shadows.z3}`,display:"inline-block",borderRadius:`${m.shape.borderRadius()}`,padding:`${m.spacing(.5,0)}`})})},53709:(j,I,e)=>{"use strict";e.d(I,{R:()=>s});var t=e(42844),n=e(27702),i=e(66310);function s(){const g=(0,i.wW)(r);return n.createElement("div",{className:g.divider})}const r=g=>({divider:(0,t.css)({height:1,backgroundColor:g.colors.border.weak,margin:g.spacing(.5,0)})})},66711:(j,I,e)=>{"use strict";e.d(I,{k:()=>g});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(66310);const g=({label:l,ariaLabel:u,children:o})=>{const m=(0,r.wW)(d),c=`group-label-${(0,n.uniqueId)()}`;return s.createElement("div",{role:"group","aria-labelledby":!u&&l?c:void 0,"aria-label":u},l&&s.createElement("label",{id:c,className:m.groupLabel,"aria-hidden":!0},l),o)};g.displayName="MenuGroup";const d=l=>({groupLabel:(0,t.css)({color:l.colors.text.secondary,fontSize:l.typography.size.sm,padding:l.spacing(.5,1)})})},79655:(j,I,e)=>{"use strict";e.d(I,{s:()=>m});var t=e(42844),n=e(27702),i=e(66310),s=e(97289),r=e(73453),g=e(74639),d=e(55238);const l=p=>{if(!p)return!1;const f=p.parentElement.getBoundingClientRect(),E=p.getBoundingClientRect();return E.width!==0&&f.right+E.width+10>window.innerWidth},u=n.memo(({items:p,isOpen:f,openedWithArrow:E,setOpenedWithArrow:h,close:y,customStyle:v})=>{const D=(0,i.wW)(o),a=(0,n.useRef)(null),[C]=(0,d.d)({localRef:a,isMenuOpen:f,openedWithArrow:E,setOpenedWithArrow:h,close:y}),[P,b]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{f&&a.current&&b(l(a.current))},[f]),n.createElement(n.Fragment,null,n.createElement("div",{className:D.iconWrapper,"aria-label":g.wl.components.Menu.SubMenu.icon},n.createElement(r.J,{name:"angle-right",className:D.icon,"aria-hidden":!0})),f&&n.createElement("div",{ref:a,className:(0,t.cx)(D.subMenu,{[D.pushLeft]:P}),"aria-label":g.wl.components.Menu.SubMenu.container,style:v},n.createElement("div",{tabIndex:-1,className:D.itemsWrapper,role:"menu",onKeyDown:C},p)))});u.displayName="SubMenu";const o=p=>({iconWrapper:(0,t.css)({display:"flex",flex:1,justifyContent:"end"}),icon:(0,t.css)({opacity:.7,marginLeft:p.spacing(1),color:p.colors.text.secondary}),itemsWrapper:(0,t.css)({background:p.colors.background.primary,boxShadow:p.shadows.z3,display:"inline-block",borderRadius:p.shape.borderRadius()}),pushLeft:(0,t.css)({right:"100%",left:"unset"}),subMenu:(0,t.css)({position:"absolute",top:0,left:"100%",zIndex:p.zIndex.dropdown})}),m=n.memo(n.forwardRef((p,f)=>{const{url:E,icon:h,label:y,ariaLabel:v,ariaChecked:D,target:a,onClick:C,className:P,active:b,disabled:M,destructive:T,childItems:S,role:x="menuitem",tabIndex:O=-1,customSubMenuContainerStyles:B,shortcut:A,testId:V}=p,W=(0,i.wW)(c),[w,N]=(0,n.useState)(b),[F,k]=(0,n.useState)(!1),[H,R]=(0,n.useState)(!1),_=(0,n.useCallback)(()=>{M||(k(!0),N(!0))},[M]),G=(0,n.useCallback)(()=>{M||(k(!1),N(!1))},[M]),Y=S&&S.length>0,X=Y?"div":E===void 0?"button":"a",Q=(0,t.cx)({[W.item]:!0,[W.active]:w,[W.disabled]:M,[W.destructive]:T&&!M},P),se={[X==="button"?"disabled":"aria-disabled"]:M,...X==="a"&&M&&{href:void 0,onClick:void 0},...M&&{tabIndex:-1,["data-disabled"]:M}},Z=(0,n.useRef)(null);(0,n.useImperativeHandle)(f,()=>Z.current);const le=ne=>{switch(ne.key){case"ArrowRight":ne.preventDefault(),ne.stopPropagation(),Y&&(k(!0),R(!0),N(!0));break;default:break}},oe=()=>{k(!1),N(!1),Z?.current?.focus()},q=!!(A&&A.length>0);return n.createElement(X,{target:a,className:Q,rel:a==="_blank"?"noopener noreferrer":void 0,href:E,onClick:C,onMouseEnter:_,onMouseLeave:G,onKeyDown:le,role:E===void 0?x:void 0,"data-role":"menuitem",ref:Z,"data-testid":V,"aria-label":v,"aria-checked":D,tabIndex:O,...se},n.createElement(n.Fragment,null,h&&n.createElement(r.J,{name:h,className:W.icon,"aria-hidden":!0}),y,n.createElement("div",{className:(0,t.cx)(W.rightWrapper,{[W.withShortcut]:q})},q&&n.createElement("div",{className:W.shortcut},n.createElement(r.J,{name:"keyboard","aria-hidden":!0}),A),Y&&n.createElement(u,{items:S,isOpen:F,openedWithArrow:H,setOpenedWithArrow:R,close:oe,customStyle:B}))))}));m.displayName="MenuItem";const c=p=>({item:(0,t.css)({background:"none",cursor:"pointer",whiteSpace:"nowrap",color:p.colors.text.primary,display:"flex",alignItems:"center",padding:p.spacing(.5,2),minHeight:p.spacing(4),margin:0,border:"none",width:"100%",position:"relative","&:hover, &:focus, &:focus-visible":{background:p.colors.action.hover,color:p.colors.text.primary,textDecoration:"none"},"&:focus-visible":(0,s.getFocusStyles)(p)}),active:(0,t.css)({background:p.colors.action.hover}),destructive:(0,t.css)({color:p.colors.error.text,svg:{color:p.colors.error.text},"&:hover, &:focus, &:focus-visible":{background:p.colors.error.main,color:p.colors.error.contrastText,svg:{color:p.colors.error.contrastText}}}),disabled:(0,t.css)({color:p.colors.action.disabledText,"&:hover, &:focus, &:focus-visible":{cursor:"not-allowed",background:"none",color:p.colors.action.disabledText}}),icon:(0,t.css)({opacity:.7,marginRight:"10px",marginLeft:"-4px",color:p.colors.text.secondary}),rightWrapper:(0,t.css)({display:"flex",alignItems:"center",marginLeft:"auto"}),shortcutIcon:(0,t.css)({marginRight:p.spacing(1)}),withShortcut:(0,t.css)({minWidth:p.spacing(10.5)}),shortcut:(0,t.css)({display:"flex",alignItems:"center",gap:p.spacing(1),marginLeft:p.spacing(2),color:p.colors.text.secondary,opacity:.7})})},55238:(j,I,e)=>{"use strict";e.d(I,{d:()=>r});var t=e(27702),n=e(19559);const i=(g,d)=>(g%d+d)%d,s=-1,r=({localRef:g,isMenuOpen:d,openedWithArrow:l,setOpenedWithArrow:u,close:o,onOpen:m,onClose:c,onKeyDown:p})=>{const[f,E]=(0,t.useState)(s);return(0,t.useEffect)(()=>{d&&l&&(E(0),u?.(!1))},[d,l,u]),(0,t.useEffect)(()=>{const y=g?.current?.querySelectorAll('[data-role="menuitem"]:not([data-disabled])');y?.[f]?.focus(),y?.forEach((v,D)=>{v.tabIndex=D===f?0:-1})},[g,f]),(0,n.Z)(()=>{m?.(E)}),[y=>{const v=g?.current?.querySelectorAll('[data-role="menuitem"]:not([data-disabled])'),D=v?.length??0;switch(y.key){case"ArrowUp":y.preventDefault(),y.stopPropagation(),E(i(f-1,D));break;case"ArrowDown":y.preventDefault(),y.stopPropagation(),E(i(f+1,D));break;case"ArrowLeft":y.preventDefault(),y.stopPropagation(),E(s),o?.();break;case"Home":y.preventDefault(),y.stopPropagation(),E(0);break;case"End":y.preventDefault(),y.stopPropagation(),E(D-1);break;case"Enter":y.preventDefault(),y.stopPropagation(),v?.[f]?.click();break;case"Escape":c?.();break;case"Tab":y.preventDefault(),c?.();break;default:break}p?.(y)}]}},13741:(j,I,e)=>{"use strict";e.d(I,{u:()=>m});var t=e(42844),n=e(45809),i=e(91546),s=e(6714),r=e(27702),g=e(66310),d=e(67437),l=e(64022),u=e(22106),o=e(32173);function m(f){const{title:E,children:h,isOpen:y=!1,closeOnEscape:v=!0,closeOnBackdropClick:D=!0,className:a,contentClassName:C,onDismiss:P,onClickBackdrop:b,trapFocus:M=!0}=f,T=(0,g.l4)(),S=(0,o.J)(T),x=(0,r.useRef)(null),{overlayProps:O,underlayProps:B}=(0,s.Ir)({isKeyboardDismissDisabled:!v,isOpen:y,onClose:P},x),{dialogProps:A,titleProps:V}=(0,n.R)({},x);if(!y)return null;const W=(0,t.cx)(S.modalHeader,typeof E!="string"&&S.modalHeaderWithTabs);return r.createElement(s.Xj,null,r.createElement("div",{role:"presentation",className:S.modalBackdrop,onClick:b||(D?P:void 0),...B}),r.createElement(i.MT,{contain:M,autoFocus:!0,restoreFocus:!0},r.createElement("div",{className:(0,t.cx)(S.modal,a),ref:x,...O,...A},r.createElement("div",{className:W},typeof E=="string"&&r.createElement(p,{...f,title:E,id:V.id}),typeof E!="string"&&E,r.createElement("div",{className:S.modalHeaderClose},r.createElement(d.h,{name:"times",size:"xl",onClick:P,tooltip:"Close"}))),r.createElement("div",{className:(0,t.cx)(S.modalContent,C)},h))))}function c({leftItems:f,children:E}){const h=(0,g.l4)(),y=(0,o.J)(h);return f?r.createElement("div",{className:y.modalButtonRow},r.createElement(l.Lh,{justify:"space-between"},r.createElement(l.Lh,{justify:"flex-start",spacing:"md"},f),r.createElement(l.Lh,{justify:"flex-end",spacing:"md"},E))):r.createElement("div",{className:y.modalButtonRow},r.createElement(l.Lh,{justify:"flex-end",spacing:"md",wrap:!0},E))}m.ButtonRow=c;function p({icon:f,iconTooltip:E,title:h,id:y}){return r.createElement(u.x,{icon:f,iconTooltip:E,title:h,id:y})}},22106:(j,I,e)=>{"use strict";e.d(I,{x:()=>s});var t=e(27702),n=e(66310),i=e(32173);const s=({icon:r,iconTooltip:g,title:d,children:l,id:u})=>{const o=(0,n.wW)(i.J);return t.createElement(t.Fragment,null,t.createElement("h2",{className:o.modalHeaderTitle,id:u},d),l)}},64067:(j,I,e)=>{"use strict";e.d(I,{Q:()=>n});var t=e(27702);const n=({children:i})=>t.createElement("div",{className:"share-modal-body"},t.createElement("div",{className:"share-modal-header"},t.createElement("div",{className:"share-modal-content"},i)))},64472:(j,I,e)=>{"use strict";e.d(I,{H:()=>r});var t=e(27702),n=e(54281),i=e(15372),s=e(22106);const r=({icon:g,title:d,tabs:l,activeTab:u,onChangeTab:o})=>t.createElement(s.x,{icon:g,title:d},t.createElement(i.J,{hideBorder:!0},l.map((m,c)=>t.createElement(n.O,{key:`${m.value}-${c}`,label:m.label,icon:m.icon,suffix:m.tabSuffix,active:m.value===u,onChangeTab:()=>o(m)}))))},60729:(j,I,e)=>{"use strict";e.d(I,{$i:()=>i,JY:()=>r,Y0:()=>s,kr:()=>n});var t=e(27702);const n=t.createContext({component:null,props:{},showModal:()=>{},hideModal:()=>{}});class i extends t.Component{constructor(d){super(d),this.showModal=(l,u)=>{this.setState({component:l,props:u})},this.hideModal=()=>{this.setState({component:null,props:{}})},this.state={component:d.component||null,props:d.props||{},showModal:this.showModal,hideModal:this.hideModal}}render(){return t.createElement(n.Provider,{value:this.state},this.props.children)}}const s=()=>t.createElement(n.Consumer,null,({component:g,props:d})=>g?t.createElement(g,{...d}):null),r=n.Consumer},32173:(j,I,e)=>{"use strict";e.d(I,{J:()=>i});var t=e(42844),n=e(80402);const i=(0,n.B)(s=>{const r=s.shape.borderRadius(1);return{modal:(0,t.css)({position:"fixed",zIndex:s.zIndex.modal,background:s.colors.background.primary,boxShadow:s.shadows.z3,borderRadius:r,border:`1px solid ${s.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:s.zIndex.modalBackdrop,top:0,right:0,bottom:0,left:0,backgroundColor:s.components.overlay.background,backdropFilter:"blur(1px)"}),modalHeader:(0,t.css)({label:"modalHeader",display:"flex",alignItems:"center",minHeight:"42px",margin:s.spacing(1,2,0,2)}),modalHeaderWithTabs:(0,t.css)({borderBottom:`1px solid ${s.colors.border.weak}`}),modalHeaderTitle:(0,t.css)({fontSize:s.typography.size.lg,margin:s.spacing(0,4,0,1),display:"flex",alignItems:"center",position:"relative",top:"2px"}),modalHeaderIcon:(0,t.css)({marginRight:s.spacing(2),fontSize:"inherit","&:before":{verticalAlign:"baseline"}}),modalHeaderClose:(0,t.css)({height:"100%",display:"flex",alignItems:"center",color:s.colors.text.secondary,flexGrow:1,justifyContent:"flex-end"}),modalContent:(0,t.css)({overflow:"auto",padding:s.spacing(3),width:"100%"}),modalButtonRow:(0,t.css)({paddingTop:s.spacing(3)})}})},11649:(j,I,e)=>{"use strict";e.d(I,{p:()=>p});var t=e(42844),n=e(27702),i=e(60519),s=e(74639),r=e(66310),g=e(15939),d=e(94661);function l(E){for(let h=E.length-1;h>0;h--){const y=E.charAt(h);if(y==="$")return{index:h,prefix:E.substring(h)};if(y===" "||y===" "||y==='"'||y==="'")return{index:h+1,prefix:E.substring(h+1)}}return{index:0,prefix:E}}function u(E,h,y,v){const D=[];for(const a of y)h&&!a.label.startsWith(h)||D.push({...a,kind:o(E,a.kind),range:v,insertText:a.insertText??a.label});return D}function o(E,h){switch(h){case d.k.Method:return E.languages.CompletionItemKind.Method;case d.k.Field:return E.languages.CompletionItemKind.Field;case d.k.Property:return E.languages.CompletionItemKind.Property;case d.k.Constant:return E.languages.CompletionItemKind.Constant;case d.k.Text:return E.languages.CompletionItemKind.Text}return E.languages.CompletionItemKind.Text}function m(E,h,y,v){if(!(!h||!y))return E.languages.registerCompletionItemProvider(h,{triggerCharacters:["$"],provideCompletionItems:(D,a,C)=>{if(D.id!==v)return;const P={startLineNumber:a.lineNumber,endLineNumber:a.lineNumber,startColumn:a.column,endColumn:a.column};if(C.triggerCharacter==="$")return P.startColumn=a.column-1,{suggestions:u(E,"$",y(),P)};const b=D.getValueInRange({startLineNumber:a.lineNumber,startColumn:1,endLineNumber:a.lineNumber,endColumn:a.column}),{index:M,prefix:T}=l(b);P.startColumn=M+1;const S=u(E,T,y(),P);if(S.length)return{suggestions:S}}})}class c extends n.PureComponent{constructor(h){super(h),this.loadCustomLanguage=()=>{const{language:y}=this.props,v=i.F.getIfExists(y);return v?v.init():Promise.resolve()},this.getEditorValue=()=>"",this.onBlur=()=>{const{onBlur:y}=this.props;y&&y(this.getEditorValue())},this.onSave=()=>{const{onSave:y}=this.props;y&&y(this.getEditorValue())},this.handleBeforeMount=y=>{this.monaco=y;const{onBeforeEditorMount:v}=this.props;v?.(y)},this.handleOnMount=(y,v)=>{const{getSuggestions:D,language:a,onChange:C,onEditorDidMount:P}=this.props;this.modelId=y.getModel()?.id,this.getEditorValue=()=>y.getValue(),D&&this.modelId&&(this.completionCancel=m(v,a,D,this.modelId)),y.onKeyDown(M=>{M.keyCode===v.KeyCode.KeyS&&(M.ctrlKey||M.metaKey)&&(M.preventDefault(),this.onSave())});const b=this.loadCustomLanguage();C&&y.getModel()?.onDidChangeContent(()=>C(y.getValue())),P&&b.then(()=>P(y,v))}}componentWillUnmount(){this.completionCancel&&this.completionCancel.dispose()}componentDidUpdate(h){const{getSuggestions:y,language:v}=this.props,D=h.language!==v;if(h.getSuggestions!==y||D){if(this.completionCancel&&this.completionCancel.dispose(),!this.monaco){console.warn("Monaco instance not loaded yet");return}y&&this.modelId&&(this.completionCancel=m(this.monaco,v,y,this.modelId))}D&&this.loadCustomLanguage()}render(){const{theme:h,language:y,width:v,height:D,showMiniMap:a,showLineNumbers:C,readOnly:P,monacoOptions:b}=this.props,M=this.props.value??"",T=M.length>100,S=this.props.containerStyles??f(h).container,x={wordWrap:"off",tabSize:2,codeLens:!1,contextmenu:!1,minimap:{enabled:T&&a,renderCharacters:!1},readOnly:P,lineNumbersMinChars:4,lineDecorationsWidth:1*h.spacing.gridSize,overviewRulerBorder:!1,automaticLayout:!0,padding:{top:.5*h.spacing.gridSize,bottom:.5*h.spacing.gridSize},fixedOverflowWidgets:!0};return C||(x.glyphMargin=!1,x.folding=!1,x.lineNumbers="off",x.lineNumbersMinChars=0),n.createElement("div",{className:S,onBlur:this.onBlur,"aria-label":s.wl.components.CodeEditor.container},n.createElement(g.o,{width:v,height:D,language:y,value:M,options:{...x,...b??{}},beforeMount:this.handleBeforeMount,onMount:this.handleOnMount,keepCurrentModel:!0}))}}const p=(0,r.HE)(c),f=E=>({container:(0,t.css)({borderRadius:E.shape.borderRadius(),border:`1px solid ${E.components.input.borderColor}`})})},15939:(j,I,e)=>{"use strict";e.d(I,{o:()=>g});var t=e(27702),n=e(52419),i=e(13431),s=e(25111);const r=d=>{const l=(0,s.Z)(async()=>await d);return{...l,dependency:l.value}},g=d=>{const{loading:l,error:u,dependency:o}=r(e.e(2462).then(e.bind(e,23425)));if(l)return t.createElement(n.u,{text:""});if(u)return t.createElement(i.X,{title:"React Monaco Editor failed to load",error:u,errorInfo:{componentStack:u?.stack||""}});const m=o.ReactMonacoEditor;return t.createElement(m,{...d})}},94661:(j,I,e)=>{"use strict";e.d(I,{k:()=>t});var t=(n=>(n.Method="method",n.Field="field",n.Property="property",n.Constant="constant",n.Text="text",n))(t||{})},16640:(j,I,e)=>{"use strict";e.d(I,{T:()=>n});var t=e(94661);function n(i){const s="${"+i.value+"}",r=i.value===i.label?i.origin:`${i.label} / ${i.origin}`;return{label:s,kind:t.k.Property,detail:r,documentation:i.documentation}}},58456:(j,I,e)=>{"use strict";e.d(I,{X:()=>o});var t=e(42844),n=e(27702),i=e(74639),s=e(9848),r=e(84693),g=e(66310),d=e(97289),l=e(73453),u=e(67437);const o=n.memo(({title:c,section:p,parent:f,pageIcon:E,onGoBack:h,children:y,titleHref:v,parentHref:D,leftItems:a,isFullscreen:C,className:P,"aria-label":b,buttonOverflowAlignment:M="right",forceShowLeftItems:T=!1})=>{const S=(0,g.wW)(m),x=(0,t.cx)("page-toolbar",S.toolbar,{["page-toolbar--fullscreen"]:C,[S.noPageIcon]:!E},P),O=n.createElement(n.Fragment,null,n.createElement("span",{className:S.truncateText},c),p&&n.createElement("span",{className:S.pre}," / ",p));return n.createElement("nav",{className:x,"aria-label":b},n.createElement("div",{className:S.leftWrapper},E&&!h&&n.createElement("div",{className:S.pageIcon},n.createElement(l.J,{name:E,size:"lg","aria-hidden":!0})),h&&n.createElement("div",{className:S.pageIcon},n.createElement(u.h,{name:"arrow-left",tooltip:"Go back (Esc)",tooltipPlacement:"bottom",size:"xxl","aria-label":i.wl.components.BackButton.backArrow,onClick:h})),n.createElement("nav",{"aria-label":"Search links",className:S.navElement},f&&D&&n.createElement(n.Fragment,null,n.createElement(s.r,{"aria-label":`Search dashboard in the ${f} folder`,className:(0,t.cx)(S.titleText,S.parentLink,S.titleLink,S.truncateText),href:D},f," ",n.createElement("span",{className:S.parentIcon})),v&&n.createElement("span",{className:(0,t.cx)(S.titleText,S.titleDivider),"aria-hidden":!0},"/")),(c||!!a?.length)&&n.createElement("div",{className:S.titleWrapper},c&&n.createElement("h1",{className:S.h1Styles},v?n.createElement(s.r,{"aria-label":"Search dashboard by name",className:(0,t.cx)(S.titleText,S.titleLink),href:v},O):n.createElement("div",{className:S.titleText},O)),a?.map((B,A)=>n.createElement("div",{className:(0,t.cx)(S.leftActionItem,{[S.forceShowLeftActionItems]:T}),key:A},B))))),n.createElement(r.R,{alignment:M},n.Children.toArray(y).filter(Boolean)))});o.displayName="PageToolbar";const m=c=>{const{spacing:p,typography:f}=c,E=(0,d.getFocusStyles)(c);return{pre:(0,t.css)({whiteSpace:"pre"}),toolbar:(0,t.css)({alignItems:"center",background:c.colors.background.canvas,display:"flex",gap:c.spacing(2),justifyContent:"space-between",padding:c.spacing(1.5,2),[c.breakpoints.down("md")]:{paddingLeft:"53px"}}),noPageIcon:(0,t.css)({[c.breakpoints.down("md")]:{paddingLeft:c.spacing(2)}}),leftWrapper:(0,t.css)({display:"flex",flexWrap:"nowrap",maxWidth:"70%"}),pageIcon:(0,t.css)({display:"none",[c.breakpoints.up("sm")]:{display:"flex",paddingRight:c.spacing(1),alignItems:"center"}}),truncateText:(0,t.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),titleWrapper:(0,t.css)({display:"flex",margin:0,minWidth:0}),navElement:(0,t.css)({display:"flex",alignItems:"center",minWidth:0}),h1Styles:(0,t.css)({margin:p(0,1,0,0),lineHeight:"inherit",flexGrow:1,minWidth:0}),parentIcon:(0,t.css)({marginLeft:c.spacing(.5)}),titleText:(0,t.css)({display:"flex",fontSize:f.size.lg,margin:0,maxWidth:"300px",borderRadius:c.shape.radius.default}),titleLink:(0,t.css)({"&:focus-visible":E}),titleDivider:(0,t.css)({padding:p(0,.5,0,.5),display:"none",[c.breakpoints.up("md")]:{display:"unset"}}),parentLink:(0,t.css)({display:"none",[c.breakpoints.up("md")]:{display:"unset",flex:1}}),leftActionItem:(0,t.css)({display:"none",alignItems:"center",paddingRight:p(.5),[c.breakpoints.up("md")]:{display:"flex"}}),forceShowLeftActionItems:(0,t.css)({display:"flex"})}}},50852:(j,I,e)=>{"use strict";e.d(I,{t:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(66670),r=e(73453);const g=({currentPage:l,numberOfPages:u,onNavigate:o,hideWhenSinglePage:m,showSmallVersion:c,className:p})=>{const f=(0,i.wW)(d),E=c?1:8,h=(0,n.useMemo)(()=>{const y=[...new Array(u).keys()],v=u>E,D=(a,C)=>n.createElement("li",{key:a,className:f.item},n.createElement(s.zx,{size:"sm",variant:C,onClick:()=>o(a)},a));return y.reduce((a,C)=>{const P=C+1,b=P===l?"primary":"secondary",M=E,T=u-E+1,S=T-M,x=P===1||P===u,O=S>-1&&l>=M&&l<=T,B=c?1:3,A=c?0:2;return v?x||l<M&&P<M||S>=0&&l>T&&P>T||S<0&&l>=M&&P>T||O&&P>=l-A&&P<=l+A?a.push(D(P,b)):(P===M&&l<M||P===T&&l>T||O&&(P===l-B||P===l+B))&&a.push(n.createElement("li",{key:P,className:f.item},n.createElement(r.J,{className:f.ellipsis,name:"ellipsis-v"}))):a.push(D(P,b)),a},[])},[l,u,o,E,c,f.ellipsis,f.item]);return m&&u<=1?null:n.createElement("div",{className:(0,t.cx)(f.container,p)},n.createElement("ol",null,n.createElement("li",{className:f.item},n.createElement(s.zx,{"aria-label":"previous page",size:"sm",variant:"secondary",onClick:()=>o(l-1),disabled:l===1},n.createElement(r.J,{name:"angle-left"}))),h,n.createElement("li",{className:f.item},n.createElement(s.zx,{"aria-label":"next page",size:"sm",variant:"secondary",onClick:()=>o(l+1),disabled:l===u},n.createElement(r.J,{name:"angle-right"})))))},d=()=>({container:(0,t.css)({float:"right"}),item:(0,t.css)({display:"inline-block",paddingLeft:"10px",marginBottom:"5px"}),ellipsis:(0,t.css)({transform:"rotate(90deg)"})})},1573:(j,I,e)=>{"use strict";e.d(I,{g:()=>o});var t=e(42844),n=e(27702),i=e(66310);const s={gray98:"#f7f8fa",gray97:"#f1f5f9",gray95:"#e9edf2",gray90:"#dce1e6",gray85:"#c7d0d9",gray70:"#9fa7b3",gray60:"#7b8087",gray33:"#464c54",gray25:"#2c3235",gray15:"#202226",gray10:"#141619",gray05:"#0b0c0e",blue95:"#5794f2",blue85:"#33a2e5",blue80:"#3274d9",blue77:"#1f60c4",red88:"#e02f44"},r=8,g={name:"Grafana Default",typography:{fontFamily:{sansSerif:'"Inter", "Helvetica", "Arial", sans-serif',monospace:"'Roboto Mono', monospace"},size:{base:"14px",xs:"10px",sm:"12px",md:"14px",lg:"18px"},heading:{h1:"28px",h2:"24px",h3:"21px",h4:"18px",h5:"16px",h6:"14px"},weight:{light:300,regular:400,semibold:500,bold:500},lineHeight:{xs:1,sm:1.1,md:1.5,lg:2},link:{decoration:"none",hoverDecoration:"none"}},breakpoints:{xs:"0",sm:"544px",md:"769px",lg:"992px",xl:"1200px",xxl:"1440px"},spacing:{base:r,insetSquishMd:"4px 8px",d:"16px",xxs:"2px",xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px",gutter:"30px",formSpacingBase:r,formMargin:`${r*4}px`,formFieldsetMargin:`${r*2}px`,formInputHeight:r*4,formButtonHeight:r*4,formInputPaddingHorizontal:`${r}px`,formInputAffixPaddingHorizontal:`${r/2}px`,formInputMargin:`${r*2}px`,formLabelPadding:"0 0 0 2px",formLabelMargin:`0 0 ${r/2+"px"} 0`,formValidationMessagePadding:"4px 8px",formValidationMessageMargin:"4px 0 0 0",inlineFormMargin:"4px"},border:{radius:{sm:"2px",md:"3px",lg:"5px"},width:{sm:"1px"}},height:{sm:24,md:32,lg:48},panelPadding:8,panelHeaderHeight:28,zIndex:{navbarFixed:1e3,sidemenu:1020,dropdown:1030,typeahead:1030,tooltip:1040,modalBackdrop:1050,modal:1060,portal:1061}},d=null;var l=e(73453),u=e(80011);const o=({error:c,onClick:p})=>{const f=(0,i.wW)(m);return c?n.createElement(u.u,{theme:"error",content:c},n.createElement(l.J,{onClick:p,className:(0,t.cx)(f.icon,{[f.clickable]:!!p}),size:"sm",name:"exclamation-triangle"})):null},m=()=>({clickable:(0,t.css)({cursor:"pointer"}),icon:(0,t.css)({color:`${s.red88}`})})},44790:(j,I,e)=>{"use strict";e.d(I,{T:()=>d});var t=e(42844),n=e(27702),i=e(74639),s=e(66310),r=e(73453),g=e(80011);const d=({onCancel:u,loading:o})=>{const m=(0,s.wW)(l);return o?n.createElement(g.u,{content:"Cancel query"},n.createElement(r.J,{className:(0,t.cx)("spin-clockwise",{[m.clickable]:!!u}),name:"sync",size:"sm",onClick:u,"aria-label":i.wl.components.LoadingIndicator.icon})):null},l=()=>({clickable:(0,t.css)({cursor:"pointer"})})},98627:(j,I,e)=>{"use strict";e.d(I,{f:()=>P});var t=e(42844),n=e(27702),i=e(96284),s=e(53933),r=e(74639),g=e(66310),d=e(97289);function l({children:x,delay:O}){const[B,A]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{window.setTimeout(()=>{A(!0)},O)},[x,O]),n.createElement(n.Fragment,null,B?x:null)}var u=e(73453),o=e(98557),m=e(80011),c=e(80434),p=e(30973);function f({menu:x,title:O,placement:B="bottom",offset:A,dragClassCancel:V,menuButtonClass:W,onOpenMenu:w}){const N=O?r.wl.components.Panels.Panel.menu(O):"panel-menu-button",F=(0,n.useCallback)(k=>{k&&w&&w()},[w]);return n.createElement(c.L,{overlay:x,placement:B,offset:A,onVisibleChange:F},n.createElement(p.h,{"aria-label":`Menu for panel with ${O?`title ${O}`:"no title"}`,title:"Menu",icon:"ellipsis-v",iconSize:"md",narrow:!0,"data-testid":N,className:(0,t.cx)(W,V)}))}function E({menu:x,title:O,dragClass:B,children:A,offset:V=-32,onOpenMenu:W}){const w=(0,g.wW)(h),N=(0,n.useRef)(null),F=r.wl.components.Panels.Panel.HoverWidget,k=(0,n.useCallback)(R=>{N.current?.setPointerCapture(R.pointerId)},[]),H=(0,n.useCallback)(R=>{N.current?.releasePointerCapture(R.pointerId)},[]);return A===void 0||n.Children.count(A)===0?null:n.createElement("div",{className:(0,t.cx)(w.container,"show-on-hover"),style:{top:V},"data-testid":F.container},B&&n.createElement("div",{className:(0,t.cx)(w.square,w.draggable,B),onPointerDown:k,onPointerUp:H,ref:N,"data-testid":F.dragIcon},n.createElement(u.J,{name:"expand-arrows",className:w.draggableIcon})),!O&&n.createElement("h6",{className:(0,t.cx)(w.untitled,{[w.draggable]:!!B},B)},"Untitled"),A,x&&n.createElement(f,{menu:x,title:O,placement:"bottom",menuButtonClass:w.menuButton,onOpenMenu:W}))}function h(x){return{container:(0,t.css)({label:"hover-container-widget",transition:"all .1s linear",display:"flex",position:"absolute",zIndex:1,right:0,boxSizing:"content-box",alignItems:"center",background:x.colors.background.secondary,color:x.colors.text.primary,border:`1px solid ${x.colors.border.weak}`,borderRadius:x.shape.radius.default,height:x.spacing(4),boxShadow:x.shadows.z1}),square:(0,t.css)({display:"flex",justifyContent:"center",alignItems:"center",width:x.spacing(4),height:"100%"}),draggable:(0,t.css)({cursor:"move",[x.breakpoints.down("md")]:{display:"none"}}),menuButton:(0,t.css)({background:"inherit",border:"none","&:hover":{background:x.colors.secondary.main}}),untitled:(0,t.css)({color:x.colors.text.disabled,fontStyle:"italic",padding:x.spacing(0,1),marginBottom:0}),draggableIcon:(0,t.css)({transform:"rotate(45deg)",color:x.colors.text.secondary,"&:hover":{color:x.colors.text.primary}})}}var y=e(70216);function v({description:x,className:O}){const B=(0,g.wW)(D),A=()=>{const V=typeof x=="function"?x():x;return n.createElement("div",{className:"panel-info-content markdown-html"},n.createElement("div",{dangerouslySetInnerHTML:{__html:V}}))};return x!==""?n.createElement(m.u,{interactive:!0,content:A},n.createElement(y.a,{className:(0,t.cx)(O,B.description)},n.createElement(u.J,{name:"info-circle",size:"md"}))):null}const D=x=>({description:(0,t.css)({code:{whiteSpace:"normal",wordWrap:"break-word"},"pre > code":{display:"block"}})});function a({message:x,onClick:O,ariaLabel:B="status"}){const A=(0,g.wW)(C);return n.createElement(p.h,{className:A.buttonStyles,onClick:O,variant:"destructive",icon:"exclamation-triangle",iconSize:"md",tooltip:x||"","aria-label":B})}const C=x=>{const{headerHeight:O,padding:B}=x.components.panel;return{buttonStyles:(0,t.css)({label:"panel-header-state-button",display:"flex",alignItems:"center",justifyContent:"center",padding:x.spacing(B),width:x.spacing(O),height:x.spacing(O),borderRadius:x.shape.radius.default})}};function P({width:x,height:O,children:B,padding:A="md",title:V="",description:W="",displayMode:w="default",titleItems:N,menu:F,dragClass:k,dragClassCancel:H,hoverHeader:R=!1,hoverHeaderOffset:_,loadingState:G,statusMessage:Y,statusMessageOnClick:X,leftItems:Q,actions:se,onCancelQuery:Z,onOpenMenu:le}){const oe=(0,g.l4)(),q=(0,g.wW)(S),ne=!R,ge="show-on-hover",ae=M(oe,ne),{contentStyle:re,innerWidth:De,innerHeight:he}=T(A,oe,ae,O,x),ye={height:ae,cursor:k?"move":"auto"},ce={width:x,height:O};w==="transparent"&&(ce.backgroundColor="transparent",ce.border="none");const[We,{width:ke}]=(0,i.Z)();Q&&(se=Q);const et=V?r.wl.components.Panels.Panel.title(V):"Panel",we=n.createElement(n.Fragment,null,V&&n.createElement("h6",{title:V,className:q.title},V),n.createElement("div",{className:(0,t.cx)(q.titleItems,H),"data-testid":"title-items-container"},n.createElement(v,{description:W,className:H}),N),G===s.Gu.Streaming&&n.createElement(m.u,{content:Z?"Stop streaming":"Streaming"},n.createElement(y.a,{className:H,"data-testid":"panel-streaming",onClick:Z},n.createElement(u.J,{name:"circle-mono",size:"md",className:q.streaming}))),G===s.Gu.Loading&&Z&&n.createElement(l,{delay:2e3},n.createElement(m.u,{content:"Cancel query"},n.createElement(y.a,{className:(0,t.cx)(H,q.pointer),"data-testid":"panel-cancel-query",onClick:Z},n.createElement(u.J,{name:"sync-slash",size:"md"})))),n.createElement("div",{className:q.rightAligned},se&&n.createElement("div",{className:q.rightActions},b(se,_e=>_e))));return n.createElement("div",{className:q.container,style:ce,"data-testid":et,tabIndex:0,ref:We},n.createElement("div",{className:q.loadingBarContainer},G===s.Gu.Loading?n.createElement(o.F,{width:ke,ariaLabel:"Panel loading bar"}):null),R&&n.createElement(n.Fragment,null,n.createElement(E,{menu:F,title:V,offset:_,dragClass:k,onOpenMenu:le},we),Y&&n.createElement("div",{className:q.errorContainerFloating},n.createElement(a,{message:Y,onClick:X,ariaLabel:"Panel status"}))),ne&&n.createElement("div",{className:(0,t.cx)(q.headerContainer,k),style:ye,"data-testid":"header-container"},Y&&n.createElement("div",{className:H},n.createElement(a,{message:Y,onClick:X,ariaLabel:"Panel status"})),we,F&&n.createElement(f,{menu:F,title:V,placement:"bottom-end",menuButtonClass:(0,t.cx)(q.menuItem,H,ge),onOpenMenu:le})),n.createElement("div",{className:(0,t.cx)(q.content,O===void 0&&q.containNone),style:re},typeof B=="function"?B(De,he):B))}const b=(x,O)=>{const B=n.Children.toArray(x).filter(Boolean);return B.length>0?O(B):null},M=(x,O)=>O?x.spacing.gridSize*x.components.panel.headerHeight:0,T=(x,O,B,A,V)=>{const W=(x==="md"?O.components.panel.padding:0)*O.spacing.gridSize,w=W*2,N=1*2;let F=0;V&&(F=V-w-N);const k={padding:W};let H=0;return A&&(H=A-B-w-N),{contentStyle:k,innerWidth:F,innerHeight:H}},S=x=>{const{background:O,borderColor:B,padding:A}=x.components.panel;return{container:(0,t.css)({label:"panel-container",backgroundColor:O,border:`1px solid ${B}`,position:"relative",borderRadius:x.shape.borderRadius(1),height:"100%",display:"flex",flexDirection:"column",".show-on-hover":{opacity:"0",visibility:"hidden"},"&:focus-visible, &:hover":{".show-on-hover":{opacity:"1",visibility:"visible"}},"&:focus-visible":(0,d.getFocusStyles)(x),"&:focus-within:not(:focus)":{".show-on-hover":{visibility:"visible",opacity:"1"}}}),loadingBarContainer:(0,t.css)({label:"panel-loading-bar-container",position:"absolute",top:0,width:"100%",overflow:"hidden"}),containNone:(0,t.css)({contain:"none"}),content:(0,t.css)({label:"panel-content",flexGrow:1,contain:"strict"}),headerContainer:(0,t.css)({label:"panel-header",display:"flex",alignItems:"center"}),pointer:(0,t.css)({cursor:"pointer"}),streaming:(0,t.css)({label:"panel-streaming",marginRight:0,color:x.colors.success.text,"&:hover":{color:x.colors.success.text}}),title:(0,t.css)({label:"panel-title",marginBottom:0,padding:x.spacing(0,A),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontSize:x.typography.h6.fontSize,fontWeight:x.typography.h6.fontWeight}),items:(0,t.css)({display:"flex"}),item:(0,t.css)({display:"flex",justifyContent:"center",alignItems:"center"}),hiddenMenu:(0,t.css)({visibility:"hidden"}),menuItem:(0,t.css)({label:"panel-menu",border:"none",background:x.colors.secondary.main,"&:hover":{background:x.colors.secondary.shade}}),errorContainerFloating:(0,t.css)({label:"error-container",position:"absolute",left:0,top:0,zIndex:x.zIndex.tooltip}),rightActions:(0,t.css)({display:"flex",padding:x.spacing(0,A),gap:x.spacing(1)}),rightAligned:(0,t.css)({label:"right-aligned-container",marginLeft:"auto",display:"flex",alignItems:"center"}),titleItems:(0,t.css)({display:"flex",height:"100%"})}}},70823:(j,I,e)=>{"use strict";e.d(I,{R9:()=>r,_w:()=>s,bb:()=>i});var t=e(27702),n=e(62435);const i=t.createContext({eventsScope:"global",eventBus:new n.F}),s=i.Provider,r=()=>t.useContext(i)},70216:(j,I,e)=>{"use strict";e.d(I,{a:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(97289),r=e(66670);const g=(0,n.forwardRef)(({className:l,children:u,href:o,onClick:m,target:c,title:p,...f},E)=>{const h=(0,i.wW)(d);return o?n.createElement("a",{ref:E,href:o,onClick:m,target:c,title:p,className:(0,t.cx)(h.linkItem,l),...f},u):m?n.createElement(r.zx,{ref:E,className:(0,t.cx)(h.item,l),variant:"secondary",fill:"text",onClick:m},u):n.createElement("span",{ref:E,className:(0,t.cx)(h.item,l),...f},u)});g.displayName="TitleItem";const d=l=>{const u=(0,t.css)({color:`${l.colors.text.secondary}`,label:"panel-header-item",cursor:"auto",border:"none",borderRadius:`${l.shape.borderRadius()}`,padding:`${l.spacing(0,1)}`,height:`${l.spacing(l.components.panel.headerHeight)}`,display:"flex",alignItems:"center",justifyContent:"center","&:focus, &:focus-visible":{...(0,s.getFocusStyles)(l),zIndex:1},"&: focus:not(:focus-visible)":(0,s.getMouseFocusStyles)(l),"&:hover ":{boxShadow:`${l.shadows.z1}`,background:`${l.colors.background.secondary}`,color:`${l.colors.text.primary}`}});return{item:u,linkItem:(0,t.cx)(u,(0,t.css)({cursor:"pointer"}))}}},92056:(j,I,e)=>{"use strict";e.d(I,{fm:()=>r});var t=e(1573),n=e(44790),i=e(98627),s=e(70216);const r=i.f;r.LoadingIndicator=n.T,r.ErrorIndicator=t.g,r.TitleItem=s.a},76761:(j,I,e)=>{"use strict";e.d(I,{R:()=>t});var t=(n=>(n.ToggleSelection="select",n.AppendToSelection="append",n))(t||{})},25695:(j,I,e)=>{"use strict";e.d(I,{l:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({children:g,className:d,...l})=>{const u=(0,i.wW)(r);return n.createElement("div",{className:(0,t.cx)(u,d),...l},g)},r=g=>(0,t.css)({backgroundColor:g.components.panel.background,border:`1px solid ${g.components.panel.borderColor}`,borderRadius:g.shape.radius.default})},97918:(j,I,e)=>{"use strict";e.d(I,{o:()=>s});var t=e(27702),n=e(9232),i=e(25357);const s=({status:g,color:d,...l})=>{const u=r(g);return t.createElement(i.C,{text:u.text,color:u.color,icon:u.icon,tooltip:u.tooltip,...l})};s.displayName="PluginSignatureBadge";function r(g){switch(g||(g=n.Xy.invalid),g){case n.Xy.internal:return{text:"Core",color:"blue",tooltip:"Core plugin that is bundled with Grafana"};case n.Xy.valid:return{text:"Signed",icon:"lock",color:"green",tooltip:"Signed and verified plugin"};case n.Xy.invalid:return{text:"Invalid signature",icon:"exclamation-triangle",color:"red",tooltip:"Invalid plugin signature"};case n.Xy.modified:return{text:"Modified signature",icon:"exclamation-triangle",color:"red",tooltip:"Valid signature but content has been modified"};case n.Xy.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"}}}},52995:(j,I,e)=>{"use strict";e.d(I,{RN:()=>r,h_:()=>s,lO:()=>g});var t=e(27702),n=e(27473),i=e(66310);function s(l){const{children:u,className:o,root:m,forwardedRef:c}=l,p=(0,i.l4)(),f=(0,t.useRef)(null),E=m??r();return f.current||(f.current=document.createElement("div"),o&&(f.current.className=o),f.current.style.position="relative",f.current.style.zIndex=`${p.zIndex.portal}`),(0,t.useLayoutEffect)(()=>(f.current&&E.appendChild(f.current),()=>{f.current&&E.removeChild(f.current)}),[E]),n.createPortal(t.createElement("div",{ref:c},u),f.current)}function r(){return window.document.getElementById("grafana-portal-container")??document.body}function g(){return t.createElement("div",{id:"grafana-portal-container"})}const d=t.forwardRef((l,u)=>t.createElement(s,{...l,forwardedRef:u}));d.displayName="RefForwardingPortal"},9857:(j,I,e)=>{"use strict";e.d(I,{q:()=>C});var t=e(42844),n=e(89898),i=e.n(n),s=e(89949),r=e.n(s),g=e(27702),d=e(10418),l=e(73817),u=e(74639),o=e(80553),m=e(14524),c=e(93702),p=e(96662),f=e(3508),E=e(16646),h=e(44687),y=e(73146),v=e(66310),D=e(97289);class a extends g.PureComponent{constructor(M,T){super(M,T),this.lastExecutedValue=null,this.mounted=!1,this.editor=null,this.onChange=(A,V)=>{const W=A.document!==this.state.value.document,w=this.state.value;this.props.onRichValueChange&&this.props.onRichValueChange(A),this.setState({value:A},()=>{if(W){const N=d.Z.serialize(w)!==d.Z.serialize(A);N&&V&&this.runOnChangeAndRunQuery(),N&&!V&&this.runOnChangeDebounced()}})},this.runOnChange=()=>{const{onChange:A}=this.props,V=d.Z.serialize(this.state.value);A&&A(this.cleanText(V))},this.runOnRunQuery=()=>{const{onRunQuery:A}=this.props;A&&(A(),this.lastExecutedValue=this.state.value)},this.runOnChangeAndRunQuery=()=>{this.runOnChange(),this.runOnRunQuery()},this.handleBlur=(A,V,W)=>{const{onBlur:w}=this.props;if(w)w();else{const N=this.lastExecutedValue?d.Z.serialize(this.lastExecutedValue):"",F=d.Z.serialize(V.value);N!==F&&this.runOnChangeAndRunQuery()}return W()},this.runOnChangeDebounced=(0,s.debounce)(this.runOnChange,500);const{onTypeahead:S,cleanText:x,portalOrigin:O,onWillApplySuggestion:B}=M;this.plugins=[(0,m.b)({onTypeahead:S,cleanText:x,portalOrigin:O,onWillApplySuggestion:B}),(0,c.d)({handler:this.runOnChangeAndRunQuery}),(0,p.z)(),(0,f.G)(),(0,E.$)(),(0,h.R)(),(0,y.w)(),...M.additionalPlugins||[]].filter(A=>A),this.state={suggestions:[],typeaheadContext:null,typeaheadPrefix:"",typeaheadText:"",value:(0,o.l1)(M.query||"",M.syntax)}}componentDidMount(){this.mounted=!0}componentWillUnmount(){this.mounted=!1}componentDidUpdate(M,T){const{query:S,syntax:x,syntaxLoaded:O}=this.props;if(!M.syntaxLoaded&&O&&this.editor){const A=this.editor.insertText(" ").deleteBackward(1);this.onChange(A.value,!0)}const{value:B}=this.state;S!==M.query&&S!==d.Z.serialize(B)&&this.setState({value:(0,o.l1)(S||"",x)})}cleanText(M){return M.replace(/[\r]/g,"")}render(){const{disabled:M,theme:T}=this.props,S=i()("slate-query-field__wrapper",{"slate-query-field__wrapper--disabled":M}),x=P(T);return g.createElement("div",{className:(0,t.cx)(S,x.wrapper)},g.createElement("div",{className:"slate-query-field","aria-label":u.wl.components.QueryField.container},g.createElement(l.ML,{ref:O=>this.editor=O,schema:o.Yi,autoCorrect:!1,readOnly:this.props.disabled,onBlur:this.handleBlur,onClick:this.props.onClick,onChange:O=>{this.onChange(O.value,!1)},placeholder:this.props.placeholder,plugins:this.plugins,spellCheck:!1,value:this.state.value})))}}const C=(0,v.HE)(a);C.defaultProps={onBlur:()=>{}};const P=b=>{const M=(0,D.getFocusStyles)(b);return{wrapper:(0,t.css)({"&:focus-within":M})}}},26862:(j,I,e)=>{"use strict";e.d(I,{dP:()=>m,o5:()=>u});var t=e(81205),n=e(27702),i=e(32082),s=e(74639),r=e(70610),g=e(77720),d=e(70725),l=e(30973);const u=["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],o=class extends n.PureComponent{constructor(f){super(f),this.onChangeSelect=E=>{const{onIntervalChanged:h}=this.props;h&&E.value!=null&&h(E.value)}}getVariant(){return this.props.isLive?"primary":this.props.isLoading?"destructive":this.props.primary?"primary":this.props.isOnCanvas?"canvas":"default"}render(){const{onRefresh:f,intervals:E,tooltip:h,value:y,text:v,isLoading:D,noIntervalPicker:a,width:C,showAutoInterval:P}=this.props,b=y||"",M=this.getVariant(),T=p({intervals:E,showAutoInterval:P}),S=T.find(({value:w})=>w===b),x=c(o.offOption.value);let O=S||x;O.label===x.label&&(O={value:""});const B=O.ariaLabel,A=(0,r.t)("refresh-picker.aria-label.duration-selected","Choose refresh time interval with current interval {{durationAriaLabel}} selected",{durationAriaLabel:B}),V=(0,r.t)("refresh-picker.aria-label.choose-interval","Auto refresh turned off. Choose refresh time interval"),W=O.value===""?V:A;return n.createElement(g.h,{className:"refresh-picker"},n.createElement(l.h,{"aria-label":v,tooltip:h,onClick:f,variant:M,icon:D?"fa fa-spinner":"sync",style:C?{width:C}:void 0,"data-testid":s.wl.components.RefreshPicker.runButtonV2},v),!a&&n.createElement(d.d,{value:O,options:T,onChange:this.onChangeSelect,variant:M,title:(0,r.t)("refresh-picker.select-button.auto-refresh","Set auto refresh interval"),"data-testid":s.wl.components.RefreshPicker.intervalButtonV2,"aria-label":W}))}};let m=o;m.offOption={label:"Off",value:"",ariaLabel:"Turn off auto refresh"},m.liveOption={label:"Live",value:"LIVE",ariaLabel:"Turn on live streaming"},m.autoOption={label:"Auto",value:"auto",ariaLabel:"Select refresh from the query range"},m.isLive=f=>f===o.liveOption.value;function c(f){switch(f){case m.liveOption.value:return{label:(0,r.t)("refresh-picker.live-option.label","Live"),value:f,ariaLabel:(0,r.t)("refresh-picker.live-option.aria-label","Turn on live streaming")};case m.offOption.value:return{label:(0,r.t)("refresh-picker.off-option.label","Off"),value:f,ariaLabel:(0,r.t)("refresh-picker.off-option.aria-label","Turn off auto refresh")};case m.autoOption.value:return{label:(0,r.t)("refresh-picker.auto-option.label",m.autoOption.label),value:f,ariaLabel:(0,r.t)("refresh-picker.auto-option.aria-label",m.autoOption.ariaLabel)}}return{label:f,value:f}}function p({intervals:f=u,showAutoInterval:E=!1}={}){const h=f.map(y=>{const v=(0,i.RA)(y),D=(0,t.Z)(v);return{label:y,value:y,ariaLabel:D}});return E&&h.unshift(c(m.autoOption.value)),h.unshift(c(m.offOption.value)),h}},20540:(j,I,e)=>{"use strict";e.d(I,{D:()=>i});var t=e(27702),n=e(48154);function i({component:s,content:r,...g}){return t.createElement(s||"span",{dangerouslySetInnerHTML:{__html:n.QX.sanitize(r)},...g})}},88885:(j,I,e)=>{"use strict";e.d(I,{c:()=>l});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(66670),g=e(14496);const d=()=>({noRadiusInput:(0,t.css)({borderBottomRightRadius:"0 !important",borderTopRightRadius:"0 !important"}),noRadiusButton:(0,t.css)({borderBottomLeftRadius:"0 !important",borderTopLeftRadius:"0 !important"})}),l=({label:u="Password",labelWidth:o,inputWidth:m=12,onReset:c,isConfigured:p,tooltip:f,placeholder:E="Password",interactive:h,...y})=>{const v=d();return s.createElement(g.W,{label:u,tooltip:f,interactive:h,labelWidth:o,inputEl:p?s.createElement(s.Fragment,null,s.createElement("input",{type:"text",className:(0,t.cx)(`gf-form-input width-${m}`,v.noRadiusInput),disabled:!0,value:"configured",...(0,n.omit)(y,"value")}),s.createElement(r.zx,{onClick:c,variant:"secondary",type:"button"},"Reset")):s.createElement("input",{type:"password",className:`gf-form-input width-${m}`,placeholder:E,...y})})};l.displayName="SecretFormField"},43656:(j,I,e)=>{"use strict";e.d(I,{m4:()=>d});var t=e(27702),n=e(66670),i=e(1128),s=e(64022);const r="configured",g="Reset",d=({isConfigured:l,onReset:u,...o})=>t.createElement(s.Lh,null,!l&&t.createElement(i.I,{...o,type:"password"}),l&&t.createElement(i.I,{...o,type:"text",disabled:!0,value:r}),l&&t.createElement(n.zx,{onClick:u,variant:"secondary"},g))},68227:(j,I,e)=>{"use strict";e.d(I,{m:()=>t.m4});var t=e(43656)},65632:(j,I,e)=>{"use strict";e.d(I,{Zk:()=>o});var t=e(42844),n=e(27702),i=e(66310),s=e(66670),r=e(64022),g=e(60105);const d="configured",l="Reset",u=m=>({configuredStyle:(0,t.css)({minHeight:m.spacing(m.components.height.md),paddingTop:m.spacing(.5),resize:"none"})}),o=({isConfigured:m,onReset:c,...p})=>{const f=(0,i.wW)(u);return n.createElement(r.Lh,null,!m&&n.createElement(g.K,{...p}),m&&n.createElement(g.K,{...p,rows:1,disabled:!0,value:d,className:(0,t.cx)(f.configuredStyle)}),m&&n.createElement(s.zx,{onClick:c,variant:"secondary"},l))}},86370:(j,I,e)=>{"use strict";e.d(I,{Z:()=>t.Zk});var t=e(65632)},95578:(j,I,e)=>{"use strict";e.d(I,{X:()=>o});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(66310),g=e(53901),d=e(77798),l=e(50615),u=e(61896);function o({options:m,value:c,onChange:p,Component:f,className:E,allowCustomValue:h,allowEmptyValue:y,placeholder:v,disabled:D,inputMinWidth:a,inputPlaceholder:C,onExpandedChange:P,autofocus:b=!1,...M}){const[T,S,x,O]=(0,l._)(b,P),B=a?Math.max(a,S):S,A=(0,r.wW)(d.N);if(!x){const V=(0,n.isObject)(c)?c.label:c,W=V!=null?String(V):void 0;return s.createElement(T,{disabled:D,Component:f||s.createElement(g.W,{className:(0,t.cx)(A.segment,{[A.queryPlaceholder]:v!==void 0&&!c,[A.disabled]:D},E)},W||v)})}return s.createElement(u.V,{...M,value:c&&!(0,n.isObject)(c)?{value:c}:c,placeholder:C,options:m,width:B,onClickOutside:()=>O(!1),allowCustomValue:h,allowEmptyValue:y,onChange:V=>{O(!1),p(V)}})}},92472:(j,I,e)=>{"use strict";e.d(I,{V:()=>c});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(26811),g=e(66310),d=e(70610),l=e(53901),u=e(61896),o=e(77798),m=e(50615);function c({value:f,onChange:E,loadOptions:h,reloadOptionsOnChange:y=!1,Component:v,className:D,allowCustomValue:a,allowEmptyValue:C,disabled:P,placeholder:b,inputMinWidth:M,inputPlaceholder:T,autofocus:S=!1,onExpandedChange:x,noOptionMessageHandler:O=p,...B}){const[A,V]=(0,r.Z)(h,[h]),[W,w,N,F]=(0,m._)(S,x),k=M?Math.max(M,w):w,H=(0,g.wW)(o.N);if(!N){const R=(0,n.isObject)(f)?f.label:f,_=R!=null?String(R):void 0;return s.createElement(W,{onClick:y?void 0:V,disabled:P,Component:v||s.createElement(l.W,{className:(0,t.cx)(H.segment,{[H.queryPlaceholder]:b!==void 0&&!f,[H.disabled]:P},D)},_||b)})}return s.createElement(u.V,{...B,value:f&&!(0,n.isObject)(f)?{value:f}:f,placeholder:T,options:A.value??[],loadOptions:y?V:void 0,width:k,noOptionsMessage:O(A),allowCustomValue:a,allowEmptyValue:C,onClickOutside:()=>{F(!1)},onChange:R=>{F(!1),E(R)}})}function p(f){return f.loading?(0,d.t)("grafana-ui.segment-async.loading","Loading options..."):f.error?(0,d.t)("grafana-ui.segment-async.error","Failed to load options"):(0,d.t)("grafana-ui.segment-async.no-options","No options found")}},45066:(j,I,e)=>{"use strict";e.d(I,{X:()=>o});var t=e(42844),n=e(27702),i=e(79812),s=e(66310),r=e(11724),g=e(53901),d=e(77798),l=e(50615);const u=14;function o({value:m,onChange:c,Component:p,className:f,placeholder:E,inputPlaceholder:h,disabled:y,autofocus:v=!1,onExpandedChange:D,...a}){const C=(0,n.useRef)(null),[P,b]=(0,n.useState)(m),[M,T]=(0,n.useState)((0,r.X1)((m||"").toString(),u).width),[S,,x,O]=(0,l._)(v,D),B=(0,s.wW)(d.N);if((0,i.Z)(C,()=>{O(!1),c(P)}),!x)return n.createElement(S,{disabled:y,Component:p||n.createElement(g.W,{className:(0,t.cx)(B.segment,{[B.queryPlaceholder]:E!==void 0&&!P,[B.disabled]:y},f)},m||E)});const A=(0,t.css)({width:`${Math.max(M+20,32)}px`});return n.createElement("input",{...a,ref:C,autoFocus:!0,className:(0,t.cx)("gf-form gf-form-input",A),value:P,placeholder:h,onChange:V=>{const{width:W}=(0,r.X1)(V.target.value,u);T(W),b(V.target.value)},onBlur:()=>{O(!1),c(P)},onKeyDown:V=>{[13,27].includes(V.keyCode)&&(O(!1),c(P))}})}},44541:(j,I,e)=>{"use strict";e.d(I,{f:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(71107),r=e(53901);const g=({label:l,htmlFor:u,children:o,fill:m})=>{const c=(0,i.wW)(d);return n.createElement(n.Fragment,null,n.createElement(s.Z,null,n.createElement(r.W,{htmlFor:u,width:12,className:c.label},l),o,m&&n.createElement("div",{className:c.fill},n.createElement(r.W,null,""))))},d=l=>({label:(0,t.css)({color:l.colors.primary.text}),fill:(0,t.css)({flexGrow:1,marginBottom:l.spacing(.5)})})},61896:(j,I,e)=>{"use strict";e.d(I,{V:()=>s});var t=e(27702),n=e(66310),i=e(28580);function s({value:r,placeholder:g="",options:d=[],onChange:l,onClickOutside:u,loadOptions:o=void 0,width:m,noOptionsMessage:c="",allowCustomValue:p=!1,allowEmptyValue:f=!1,...E}){const h=(0,t.useRef)(null),y=(0,n.l4)();let v=m>0?m/y.spacing.gridSize:void 0,D,a={};return o?(D=i.qb,a={loadOptions:o,defaultOptions:!0}):D=i.Ph,t.createElement("div",{...E,ref:h},t.createElement(D,{width:v,noOptionsMessage:c,placeholder:g,autoFocus:!0,isOpen:!0,onChange:l,options:d,value:r,closeMenuOnSelect:!1,onCloseMenu:()=>{if(h&&h.current){const C=h.current.querySelector('input[id^="react-select-"]');C&&(C.value||f)?l({value:C.value,label:C.value}):u()}},allowCustomValue:p,...a}))}},77798:(j,I,e)=>{"use strict";e.d(I,{N:()=>n});var t=e(42844);const n=i=>{const s="v1"in i?i.v1.palette:i.palette;return{segment:(0,t.css)({cursor:"pointer",width:"auto"}),queryPlaceholder:(0,t.css)({color:s.gray2}),disabled:(0,t.css)({cursor:"not-allowed",opacity:.65,boxShadow:"none"})}}},50615:(j,I,e)=>{"use strict";e.d(I,{_:()=>s});var t=e(27702),n=e(66310),i=e(66670);const s=(r,g)=>{const d=(0,t.useRef)(null),l=(0,n.wW)(i.gN),[u,o]=(0,t.useState)(r),[m,c]=(0,t.useState)(0),p=E=>{o(E),g&&g(E)};return[({Component:E,onClick:h,disabled:y})=>t.createElement("button",{type:"button",className:l,ref:d,disabled:y,onClick:()=>{p(!0),d&&d.current&&c(d.current.clientWidth*1.25),h?.()}},E),m,u,p]}},65449:(j,I,e)=>{"use strict";e.d(I,{m:()=>i});var t=e(27702),n=e(73453);const i=({isOpen:s})=>{const r=s?"search":"angle-down",g=s?"sm":"md";return t.createElement(n.J,{name:r,size:g})}},28580:(j,I,e)=>{"use strict";e.d(I,{M8:()=>X,qb:()=>_,gY:()=>Y,NU:()=>R,Ph:()=>H,eI:()=>b.e,LT:()=>G});var t=e(27702),n=e(62937),i=e(98330),s=e(19590),r=e(55794),g=e(2004),d=e(81078),l=e(66310),u=e(73453),o=e(62108),m=e(65449),c=e(42844),p=e(1128);const f=t.forwardRef((Q,se)=>{const{children:Z}=Q,le=(0,l.l4)(),oe=(0,p.H)({theme:le,invalid:!1});return t.createElement("div",{className:(0,c.cx)(oe.suffix,(0,c.css)({position:"relative"})),ref:se},Z)});f.displayName="IndicatorsContainer";var E=e(80402),h=e(26468);const y=(0,E.B)((Q,se,Z)=>{const le=(0,p.H)({theme:Q,invalid:se});return{input:(0,c.cx)((0,h.nf)(Q),(0,c.css)({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",justifyContent:"space-between",paddingRight:0,position:"relative",boxSizing:"border-box"}),Z&&(0,c.css)({paddingLeft:0})),prefix:(0,c.cx)(le.prefix,(0,c.css)({position:"relative"}))}}),v=t.forwardRef(function({focused:se,invalid:Z,disabled:le,children:oe,innerProps:q,prefix:ne,...ge},ae){const re=(0,l.l4)(),De=y(re,Z,!!ne);return t.createElement("div",{className:De.input,...q,ref:ae},ne&&t.createElement("div",{className:(0,c.cx)(De.prefix)},ne),oe)});var D=e(67437),a=e(73578);const C=({innerProps:Q,children:se})=>{const Z=(0,l.l4)(),le=(0,a.D)(Z);return t.createElement("div",{...Q,className:le.multiValueContainer},se)},P=({children:Q,innerProps:se})=>{const Z=(0,l.l4)(),le=(0,a.D)(Z);return t.createElement(D.h,{...se,name:"times",size:"sm",className:le.multiValueRemove,tooltip:"Remove"})};var b=e(50285),M=e(22655),T=e(42197),S=e(91987);class x extends t.Component{render(){const{children:se}=this.props,{selectProps:Z}=this.props;if(Z&&Array.isArray(se)&&Array.isArray(se[0])&&Z.maxVisibleValues!==void 0&&!(Z.showAllSelectedWhenOpen&&Z.menuIsOpen)){const[le,...oe]=se,q=le.slice(0,Z.maxVisibleValues);return this.renderContainer([q,...oe])}return this.renderContainer(se)}renderContainer(se){const{isMulti:Z,theme:le}=this.props,oe=(0,a.D)(le),q=(0,c.cx)(oe.valueContainer,Z&&oe.valueContainerMulti);return t.createElement("div",{className:q},se)}}const O=(0,l.HE)(x);var B=e(69213);const A=(Q,se)=>{if(Array.isArray(Q)){const Z=Q.filter(Boolean);return Z?.length?Z:void 0}if(typeof Q=="object")return[Q];if(typeof Q=="string"||typeof Q=="number"){const Z=V(Q,se);if(Z)return[Z]}},V=(Q,se)=>{for(const Z of se)if("options"in Z){let le=V(Q,Z.options);if(le)return le}else if("value"in Z&&Z.value===Q)return Z;return null},W=Q=>Q.map(({description:se,...Z})=>Z),w=Q=>{const{maxVisibleValues:se,selectedValuesCount:Z,menuIsOpen:le,showAllSelectedWhenOpen:oe}=Q;return se!==void 0&&Z>se&&!(oe&&le)?t.createElement("span",{key:"excess-values",id:"excess-values"},"(+",Z-se,")"):null},N=Q=>{const{children:se,innerProps:Z,selectProps:{menuIsOpen:le,onMenuClose:oe,onMenuOpen:q},isFocused:ne,isMulti:ge,getValue:ae,innerRef:re}=Q,De=Q.selectProps;return De.renderControl?t.createElement(De.renderControl,{isOpen:le,value:ge?ae():ae()[0],ref:re,onClick:le?oe:q,onBlur:oe,disabled:!!De.disabled,invalid:!!De.invalid}):t.createElement(v,{ref:re,innerProps:Z,prefix:De.prefix,focused:ne,invalid:!!De.invalid,disabled:!!De.disabled},se)};function F({allowCustomValue:Q=!1,allowCreateWhileLoading:se=!1,"aria-label":Z,autoFocus:le=!1,backspaceRemovesValue:oe=!0,blurInputOnSelect:q,cacheOptions:ne,className:ge,closeMenuOnSelect:ae=!0,components:re,createOptionPosition:De="last",defaultOptions:he,defaultValue:ye,disabled:ce=!1,filterOption:We,formatCreateLabel:ke,getOptionLabel:et,getOptionValue:we,inputValue:_e,invalid:Ge,isClearable:qe=!1,id:st,isLoading:Me=!1,isMulti:be=!1,inputId:Ke,isOpen:Ye,isOptionDisabled:tt,isSearchable:nt=!0,loadOptions:Pt,loadingMessage:xt="Loading options...",maxMenuHeight:bt=300,minMenuHeight:Rt,maxVisibleValues:ct,menuPlacement:it="auto",menuPosition:me,menuShouldPortal:Ee=!0,noOptionsMessage:Ce=(0,n.t)("grafana-ui.select.no-options-label","No options found"),onBlur:Ae,onChange:ze,onCloseMenu:Ie,onCreateOption:xe,onInputChange:Te,onKeyDown:Oe,onMenuScrollToBottom:ie,onMenuScrollToTop:Le,onOpenMenu:Be,onFocus:Ue,openMenuOnFocus:ue=!1,options:pe=[],placeholder:$e=(0,n.t)("grafana-ui.select.placeholder","Choose"),prefix:Se,renderControl:Ve,showAllSelectedWhenOpen:He=!0,tabSelectsValue:Ze=!0,value:Qe,virtualized:rt=!1,width:pt,isValidNewOption:It,formatOptionLabel:_t,hideSelectedOptions:tn,...qt}){const cn=(0,l.l4)(),on=(0,a.D)(cn),ln=(0,t.useRef)(null),[Un,yt]=(0,t.useState)(!1),ft=(0,B.O)(cn,pt),[Tt,Bt]=(0,t.useState)(!!_e);(0,t.useEffect)(()=>{if(Pt&&Ye&&ln.current&&ln.current.controlRef&&it==="auto"){const Vt=window.innerHeight-ln.current.controlRef.getBoundingClientRect().bottom;yt(Vt<bt)}},[bt,it,Pt,Ye]);const Nt=(0,t.useCallback)((Vt,Ht)=>{if(be&&Vt==null)return ze([],Ht);ze(Vt,Ht)},[be,ze]);let Ft=i.ZP;const Gt={};let dn={},sn;if(be&&Pt)sn=Qe;else if(be&&Qe&&Array.isArray(Qe)&&!Pt)sn=Qe.map(Vt=>{const Ht=V(Vt.value??Vt,pe);return!Q||Ht?Ht:typeof Vt=="string"?(0,d.E)(Vt):Vt});else if(Pt){const Vt=ye||Qe;sn=Vt?[Vt]:[]}else sn=A(Qe,pe);const Bn={"aria-label":Z,autoFocus:le,backspaceRemovesValue:oe,blurInputOnSelect:q,captureMenuScroll:ie||Le,closeMenuOnSelect:ae,defaultValue:ye,disabled:ce,filterOption:Tt?We:null,getOptionLabel:et,getOptionValue:we,hideSelectedOptions:tn,inputValue:_e,invalid:Ge,isClearable:qe,id:st,isDisabled:ce,isLoading:Me,isMulti:be,inputId:Ke,isOptionDisabled:tt,isSearchable:nt,maxMenuHeight:bt,minMenuHeight:Rt,maxVisibleValues:ct,menuIsOpen:Ye,menuPlacement:it==="auto"&&Un?"top":it,menuPosition:me,menuShouldBlockScroll:!0,menuPortalTarget:Ee&&typeof document<"u"?document.body:void 0,menuShouldScrollIntoView:!1,onBlur:Ae,onChange:Nt,onInputChange:(Vt,Ht)=>{Bt(!!Vt),Te?.(Vt,Ht)},onKeyDown:Oe,onMenuClose:Ie,onMenuOpen:Be,onMenuScrollToBottom:ie,onMenuScrollToTop:Le,onFocus:Ue,formatOptionLabel:_t,openMenuOnFocus:ue,options:rt?W(pe):pe,placeholder:$e,prefix:Se,renderControl:Ve,showAllSelectedWhenOpen:He,tabSelectsValue:Ze,value:be?sn:sn?.[0]};Q&&(Ft=g.Z,Gt.allowCreateWhileLoading=se,Gt.formatCreateLabel=ke??k,Gt.onCreateOption=xe,Gt.createOptionPosition=De,Gt.isValidNewOption=It),Pt&&(Ft=Q?r.Z:s.Z,dn={loadOptions:Pt,cacheOptions:ne,defaultOptions:he});const wt=rt?M.r4:M.SA;return t.createElement(t.Fragment,null,t.createElement(Ft,{ref:ln,components:{MenuList:wt,Group:T.n,ValueContainer:O,IndicatorsContainer(Vt){const{selectProps:Ht}=Vt,{value:Xt,showAllSelectedWhenOpen:mn,maxVisibleValues:pn,menuIsOpen:Pn}=Ht;if(pn!==void 0){const zn=Xt.length,Hn=[...Vt.children];return Hn.splice(-1,0,w({maxVisibleValues:pn,selectedValuesCount:zn,showAllSelectedWhenOpen:mn,menuIsOpen:Pn})),t.createElement(f,{...Vt},Hn)}return t.createElement(f,{...Vt})},IndicatorSeparator(){return t.createElement(t.Fragment,null)},Control:N,Option:M.Qn,ClearIndicator(Vt){const{clearValue:Ht}=Vt;return t.createElement(u.J,{name:"times",role:"button","aria-label":"select-clear-value",className:on.singleValueRemove,onMouseDown:Xt=>{Xt.preventDefault(),Xt.stopPropagation(),Ht()}})},LoadingIndicator(){return t.createElement(o.$,{inline:!0})},LoadingMessage(){return t.createElement("div",{className:on.loadingMessage},xt)},NoOptionsMessage(){return t.createElement("div",{className:on.loadingMessage,"aria-label":"No options provided"},Ce)},DropdownIndicator(Vt){return t.createElement(m.m,{isOpen:Vt.selectProps.menuIsOpen})},SingleValue(Vt){return t.createElement(S.P,{...Vt,isDisabled:ce})},SelectContainer:b.e,MultiValueContainer:C,MultiValueRemove:ce?()=>null:P,...re},styles:ft,className:ge,...Bn,...Gt,...dn,...qt}))}function k(Q){return t.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},t.createElement("div",null,Q),t.createElement("div",{style:{flexGrow:1}}),t.createElement("div",{className:"muted small",style:{display:"flex",gap:"8px",alignItems:"center"}},"Hit enter to add"))}function H(Q){return t.createElement(F,{...Q})}function R(Q){return t.createElement(F,{...Q,isMulti:!0})}function _(Q){return t.createElement(F,{...Q})}function G(Q){return t.createElement(F,{virtualized:!0,...Q})}function Y(Q){return t.createElement(F,{virtualized:!0,...Q})}function X(Q){return t.createElement(F,{...Q,isMulti:!0})}},50285:(j,I,e)=>{"use strict";e.d(I,{e:()=>u});var t=e(42844),n=e(27702),i=e(38581),s=e(80402),r=e(66310),g=e(97289),d=e(26468),l=e(1128);const u=m=>{const{isDisabled:c,isFocused:p,children:f,selectProps:{invalid:E=!1}}=m,h=(0,r.l4)(),y=o(h,p,c,E);return n.createElement(i.c.SelectContainer,{...m,className:(0,t.cx)(y.wrapper,m.className)},f)},o=(0,s.B)((m,c,p,f)=>{const E=(0,l.H)({theme:m,invalid:f});return{wrapper:(0,t.cx)(E.wrapper,(0,d.RK)(m,f),c&&(0,t.css)((0,g.getFocusStyles)(m)),p&&E.inputDisabled,(0,t.css)({position:"relative",boxSizing:"border-box",flexDirection:"row",flexWrap:"wrap",alignItems:"stretch",justifyContent:"space-between",minHeight:"32px",height:"auto",maxWidth:"100%",padding:0,cursor:p?"not-allowed":"pointer"}))}})},22655:(j,I,e)=>{"use strict";e.d(I,{Qn:()=>E,SA:()=>m,r4:()=>f});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(25472),g=e(8553),d=e(66310),l=e(29372),u=e(73453),o=e(73578);const m=({children:h,maxHeight:y,innerRef:v,innerProps:D})=>{const a=(0,d.l4)(),C=(0,o.D)(a);return s.createElement("div",{...D,className:C.menu,style:{maxHeight:y},"aria-label":"Select options menu"},s.createElement(l.$,{scrollRefCallback:v,autoHide:!1,autoHeightMax:"inherit",hideHorizontalTrack:!0},h))};m.displayName="SelectMenu";const c=37,p=7,f=({children:h,maxHeight:y,options:v,getValue:D})=>{const a=(0,d.l4)(),C=(0,o.D)(a),[P]=D(),M=(P?v.findIndex(O=>O.value===P.value):0)*c;if(!Array.isArray(h))return null;const S=((0,n.max)(v.map(O=>O.label?.length))??0)*p,x=Math.min(v.length*c,y);return s.createElement(r.t7,{className:C.menu,height:x,width:S,"aria-label":"Select options menu",itemCount:h.length,itemSize:c,initialScrollOffset:M},({index:O,style:B})=>s.createElement("div",{style:{...B,overflow:"hidden"}},h[O]))};f.displayName="VirtualizedSelectMenu";const E=({children:h,data:y,innerProps:v,innerRef:D,isFocused:a,isSelected:C,renderOptionLabel:P})=>{const b=(0,d.l4)(),M=(0,o.D)(b),T=y.icon?(0,g.iJ)(y.icon):void 0,{onMouseMove:S,onMouseOver:x,...O}=v;return s.createElement("div",{ref:D,className:(0,t.cx)(M.option,a&&M.optionFocused,C&&M.optionSelected,y.isDisabled&&M.optionDisabled),...O,"aria-label":"Select option",title:y.title},T&&s.createElement(u.J,{name:T,className:M.optionIcon}),y.imgUrl&&s.createElement("img",{className:M.optionImage,src:y.imgUrl,alt:y.label||y.value}),s.createElement("div",{className:M.optionBody},s.createElement("span",null,P?P(y):h),y.description&&s.createElement("div",{className:M.optionDescription},y.description),y.component&&s.createElement(y.component,null)))};E.displayName="SelectMenuOptions"},42197:(j,I,e)=>{"use strict";e.d(I,{n:()=>l});var t=e(42844),n=e(27702),i=e(80402),s=e(66310),r=e(73453);const g=(0,i.B)(u=>({header:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"flex-start",justifyItems:"center",cursor:"pointer",padding:"7px 10px",width:"100%",borderBottom:`1px solid ${u.colors.background.secondary}`,"&:hover":{color:u.colors.text.maxContrast}}),label:(0,t.css)({flexGrow:1}),icon:(0,t.css)({paddingRight:"2px"})}));class d extends n.PureComponent{constructor(){super(...arguments),this.state={expanded:!1},this.onToggleChildren=()=>{this.setState(o=>({expanded:!o.expanded}))}}componentDidMount(){if(this.props.data.expanded)this.setState({expanded:!0});else if(this.props.selectProps&&this.props.selectProps.value){const{value:o}=this.props.selectProps.value;o&&this.props.options.some(m=>m.value===o)&&this.setState({expanded:!0})}}componentDidUpdate(o){o.selectProps.inputValue!==""&&this.setState({expanded:!0})}render(){const{children:o,label:m,theme:c}=this.props,{expanded:p}=this.state,f=g(c);return n.createElement("div",null,n.createElement("div",{className:f.header,onClick:this.onToggleChildren,role:"presentation"},n.createElement("span",{className:f.label},m),n.createElement(r.J,{className:f.icon,name:p?"angle-up":"angle-down"})),p&&o)}}const l=(0,s.HE)(d)},91987:(j,I,e)=>{"use strict";e.d(I,{P:()=>c});var t=e(42844),n=e(27702),i=e(38581),s=e(8553),r=e(66310);function g(f,E={}){const{duration:h=250,delay:y=250}=E,[v,D]=(0,n.useState)(f),a=(0,n.useRef)();return(0,n.useEffect)(()=>{let C;if(f)C=setTimeout(()=>{a.current=new Date,D(f)},y);else{const P=a.current?Date.now()-a.current.valueOf():0,b=()=>{a.current=void 0,D(f)};P>=h?b():C=setTimeout(b,h-P)}return()=>{C&&(clearTimeout(C),C=void 0)}},[f,h,y]),v}var d=e(73453),l=e(62108),u=e(54004),o=e(12806);const m=f=>({singleValue:(0,t.css)({label:"singleValue",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",boxSizing:"border-box",maxWidth:"100%",gridArea:"1 / 1 / 2 / 3"}),spinnerWrapper:(0,t.css)({width:"16px",height:"16px",display:"inline-block",marginRight:"10px",position:"relative",verticalAlign:"middle",overflow:"hidden"}),spinnerIcon:(0,t.css)({width:"100%",height:"100%",position:"absolute"}),optionIcon:(0,t.css)({marginRight:f.spacing(1),color:f.colors.text.secondary}),disabled:(0,t.css)({color:f.colors.text.disabled}),isOpen:(0,t.css)({color:f.colors.text.disabled})}),c=f=>{const{children:E,data:h,isDisabled:y}=f,v=(0,r.wW)(m),D=g(h.loading||!1,{delay:250,duration:750}),a=h.icon?(0,s.iJ)(h.icon):void 0;return n.createElement(i.c.SingleValue,{...f,className:(0,t.cx)(v.singleValue,y&&v.disabled,f.selectProps.menuIsOpen&&v.isOpen)},h.imgUrl?n.createElement(p,{loading:D,imgUrl:h.imgUrl,styles:v,alt:h.label??h.value}):n.createElement(n.Fragment,null,n.createElement(o.R,{horizontal:!0,size:16,visible:D,duration:150},n.createElement("div",{className:v.spinnerWrapper},n.createElement(l.$,{className:v.spinnerIcon,inline:!0}))),a&&n.createElement(d.J,{name:a,role:"img",className:v.optionIcon})),!h.hideText&&E)},p=f=>n.createElement("div",{className:f.styles.spinnerWrapper},n.createElement(u.n,{duration:150,visible:f.loading},n.createElement(l.$,{className:f.styles.spinnerIcon,inline:!0})),n.createElement(u.n,{duration:150,visible:!f.loading},n.createElement("img",{className:f.styles.spinnerIcon,src:f.imgUrl,alt:f.alt})))},73578:(j,I,e)=>{"use strict";e.d(I,{D:()=>i});var t=e(42844),n=e(80402);const i=(0,n.B)(s=>({menu:(0,t.css)({label:"grafana-select-menu",background:s.components.dropdown.background,boxShadow:s.shadows.z3,position:"relative",minWidth:"100%",zIndex:1}),option:(0,t.css)({label:"grafana-select-option",padding:"8px",display:"flex",alignItems:"center",flexDirection:"row",flexShrink:0,whiteSpace:"nowrap",cursor:"pointer",borderLeft:"2px solid transparent","&:hover":{background:s.colors.action.hover}}),optionIcon:(0,t.css)({marginRight:s.spacing(1)}),optionImage:(0,t.css)({label:"grafana-select-option-image",width:"16px",marginRight:"10px"}),optionDescription:(0,t.css)({label:"grafana-select-option-description",fontWeight:"normal",fontSize:s.typography.size.sm,color:s.colors.text.secondary,whiteSpace:"normal",lineHeight:s.typography.body.lineHeight}),optionBody:(0,t.css)({label:"grafana-select-option-body",display:"flex",fontWeight:s.typography.fontWeightMedium,flexDirection:"column",flexGrow:1}),optionFocused:(0,t.css)({label:"grafana-select-option-focused",background:s.colors.action.focus}),optionSelected:(0,t.css)({background:s.colors.action.selected}),optionDisabled:(0,t.css)({label:"grafana-select-option-disabled",backgroundColor:s.colors.action.disabledBackground,color:s.colors.action.disabledText,cursor:"not-allowed"}),singleValue:(0,t.css)({label:"grafana-select-single-value",color:s.components.input.text,gridArea:"1 / 1 / 2 / 3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",boxSizing:"border-box",maxWidth:"100%"}),valueContainer:(0,t.css)({label:"grafana-select-value-container",alignItems:"center",display:"grid",position:"relative",boxSizing:"border-box",flex:"1 1 0%",outline:"none",overflow:"hidden"}),valueContainerMulti:(0,t.css)({label:"grafana-select-value-container-multi",flexWrap:"wrap",display:"flex"}),loadingMessage:(0,t.css)({label:"grafana-select-loading-message",padding:s.spacing(1),textAlign:"center",width:"100%"}),multiValueContainer:(0,t.css)({label:"grafana-select-multi-value-container",display:"flex",alignItems:"center",lineHeight:1,background:s.colors.background.secondary,borderRadius:s.shape.borderRadius(),margin:s.spacing(.25,1,.25,0),padding:s.spacing(.25,0,.25,1),color:s.colors.text.primary,fontSize:s.typography.size.sm,"&:hover":{background:s.colors.emphasize(s.colors.background.secondary)}}),multiValueRemove:(0,t.css)({label:"grafana-select-multi-value-remove",margin:s.spacing(0,.5),cursor:"pointer",svg:{marginBottom:0}}),singleValueRemove:(0,t.css)({cursor:"pointer","&:hover":{color:s.colors.text.primary}})}))},69213:(j,I,e)=>{"use strict";e.d(I,{O:()=>i,Z:()=>n});var t=e(27702);function n(s){return{clearIndicator:()=>({}),container:()=>({}),control:()=>({}),dropdownIndicator:()=>({}),group:()=>({}),groupHeading:()=>({}),indicatorsContainer:()=>({}),indicatorSeparator:()=>({}),input:function(r){return{...r,color:"inherit",margin:0,padding:0,zIndex:1}},loadingIndicator:()=>({}),loadingMessage:()=>({}),menu:()=>({}),menuList:({maxHeight:r})=>({maxHeight:r}),multiValue:()=>({}),multiValueLabel:()=>({}),multiValueRemove:()=>({}),noOptionsMessage:()=>({}),option:()=>({}),placeholder:r=>({...r,color:s.colors.text.secondary}),singleValue:()=>({}),valueContainer:()=>({})}}function i(s,r){return(0,t.useMemo)(()=>({...n(s),menuPortal:g=>({...g,zIndex:s.zIndex.portal}),menu:({top:g,bottom:d,position:l})=>({top:g,bottom:d,position:l,minWidth:"100%",zIndex:s.zIndex.dropdown}),container:()=>({width:r?s.spacing(r):"100%",display:r==="auto"?"inline-flex":"flex"}),option:(g,d)=>({...g,opacity:d.isDisabled?.5:1})}),[s,r])}},49030:()=>{},7179:(j,I,e)=>{"use strict";e.d(I,{F:()=>p});var t=e(89949),n=e.n(t),i=e(27702),s=e(69966),r=e(45383),g=e(8496),d=e(93564),l=e(90996),u=e(76970),o=e(95676),m=e(26862);function c(f){return{label:f,value:stringToMs(f)}}class p extends i.PureComponent{constructor(E){super(E),this.propsSubject=new s.x,this.subscription=null}componentDidMount(){this.subscription=this.propsSubject.pipe((0,l.w)(E=>m.dP.isLive(E.interval)?(0,r.of)({}):E.loading?g.C:(0,d.F)((0,o.e0)(E.interval))),(0,u.b)(()=>this.props.func())).subscribe(),this.propsSubject.next(this.props)}componentDidUpdate(E){m.dP.isLive(E.interval)&&m.dP.isLive(this.props.interval)||(0,t.isEqual)(E,this.props)||this.propsSubject.next(this.props)}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe(),this.propsSubject.unsubscribe()}render(){return null}}},50250:(j,I,e)=>{"use strict";e.d(I,{PR:()=>y,ZH:()=>m,rD:()=>p});var t=e(89949),n=e.n(t),i=e(66656),s=e(90482),r=e(5168),g=e(6850),d=e(93666),l=e(21708),u=e(77104);const o=["reduceOptions","orientation"];function m(v,D,a){let C=v.options;if(v.fieldConfig=v.fieldConfig||{defaults:{},overrides:[]},D==="singlestat"&&a.angular)return c(v,a);for(const P of o)a.hasOwnProperty(P)&&(C[P]=(0,t.cloneDeep)(a[P]));return C}function c(v,D){const a=D.angular,C=i.TB.getIfExists(a.valueName),P={reduceOptions:{calcs:[C?C.id:i.gz.mean]},orientation:s.wm.Horizontal},b={};if(a.format&&(b.unit=a.format),a.tableColumn&&(P.reduceOptions.fields=`/^${a.tableColumn}$/`),a.nullPointMode&&(b.nullValueMode=a.nullPointMode),a.nullText&&(b.noValue=a.nullText),(a.decimals||a.decimals===0)&&(b.decimals=a.decimals),a.thresholds&&a.colors){const T=a.thresholds.split(",").map(x=>Number(x.trim())),S=[];for(const x of a.colors){const O=S.length-1;O>=0?S.push({value:T[O],color:x}):S.push({value:-1/0,color:x})}b.thresholds={mode:r.H.Absolute,steps:S}}const M=(0,g.Jb)(a,b.thresholds);return M&&M.length&&(b.mappings=M),a.gauge&&a.gauge.show&&(b.min=a.gauge.minValue,b.max=a.gauge.maxValue),v.fieldConfig.defaults=b,P}function p(v){if(!v.options)return{};const D=parseFloat(v.pluginVersion||"6.1");let a=v.options;D<6.2&&(a=E(a)),D<6.3&&(a=f(a));const{fieldOptions:C}=a;if(D<6.6&&C){if(C&&C.override){const{override:M,...T}=a.fieldOptions;a={...a,fieldOptions:{...T,overrides:[]}}}let P=C?.defaults?.thresholds;P?delete C.defaults.thresholds:(P=C?.thresholds,delete C.thresholds),P&&(C.defaults.thresholds={mode:r.H.Absolute,steps:P});const{defaults:b}=C;b.color&&typeof b.color=="string"&&(b.color={mode:d.S.Fixed,fixedColor:b.color}),(0,l.gb)(b)}if(D<7&&(v.fieldConfig=v.fieldConfig||{defaults:{},overrides:[]},v.fieldConfig={defaults:C&&C.defaults?{...v.fieldConfig.defaults,...C.defaults}:v.fieldConfig.defaults,overrides:C&&C.overrides?[...v.fieldConfig.overrides,...C.overrides]:v.fieldConfig.overrides},C&&(a.reduceOptions={values:C.values,limit:C.limit,calcs:C.calcs}),delete a.fieldOptions),D<7.1){const P=v.fieldConfig.defaults.title;P!=null&&(v.fieldConfig.defaults.displayName=P,delete v.fieldConfig.defaults.title)}if(D<8){const P=v.fieldConfig?.defaults;let b=P?.unit;b==="percent"?((0,t.isNumber)(P.min)||(P.min=0),(0,t.isNumber)(P.max)||(P.max=100)):b==="percentunit"&&((0,t.isNumber)(P.min)||(P.min=0),(0,t.isNumber)(P.max)||(P.max=1))}return a}function f(v){const{fieldOptions:D}=v;if(!D)return v;const{mappings:a,...C}=v.fieldOptions;let P;return v.thresholds&&(P={mode:r.H.Absolute,steps:h(v.thresholds)}),{...v,fieldOptions:{...C,defaults:{...D.defaults,mappings:a,thresholds:P}}}}function E(v){const{valueOptions:D}=v;if(!D)return v;const a={},C={};if(a.mappings=v.valueMappings,a.thresholds=v.thresholds,a.defaults=C,C.unit=D.unit,C.decimals=D.decimals,D.stat){const b=i.TB.get(D.stat);b&&(a.calcs=[b.id])}C.min=v.minValue,C.max=v.maxValue;const P={...v,fieldOptions:a};return(0,t.omit)(P,"valueMappings","thresholds","valueOptions","minValue","maxValue")}function h(v){if(!v||!v.length)return;const D=v.map(a=>({value:a.value===null?-1/0:a.value,color:a.color}));return(0,u.bP)(D),D[0].value=-1/0,D}function y(v){return(0,g.Jb)(v)}},97583:(j,I,e)=>{"use strict";e.d(I,{PR:()=>t.PR,ZH:()=>t.ZH,rD:()=>t.rD});var t=e(50250)},37983:(j,I,e)=>{"use strict";e.d(I,{U:()=>m});var t=e(42844),n=e(76808),i=e(30450),s=e(27702),r=e(66310),g=e(92742);const d=c=>{const{value:p,children:f,visible:E,placement:h,tipFormatter:y,...v}=c,D=(0,s.useRef)(null),a=(0,s.useRef)(null),C=(0,r.wW)(l);function P(){a.current!==null&&cancelAnimationFrame(a.current)}function b(){a.current=requestAnimationFrame(()=>{D.current?.forceAlign()})}return(0,s.useEffect)(()=>(E?b():P(),P),[p,E]),s.createElement(g.Z,{overlayClassName:C.tooltip,placement:h,overlay:y??p,overlayInnerStyle:{minHeight:"auto"},ref:D,visible:E,...v},f)},l=c=>({tooltip:(0,t.css)({position:"absolute",display:"block",visibility:"visible",fontSize:c.typography.bodySmall.fontSize,opacity:.9,padding:3,zIndex:c.zIndex.tooltip})}),u=d;var o=e(72719);const m=({min:c,max:p,onChange:f,onAfterChange:E,orientation:h="horizontal",reverse:y,step:v,formatTooltipResult:D,value:a,tooltipAlwaysVisible:C=!0})=>{const P=(0,s.useCallback)(O=>{f?.(typeof O=="number"?[O,O]:O)},[f]),b=(0,s.useCallback)(O=>{E?.(typeof O=="number"?[O,O]:O)},[E]),M=h==="horizontal",T=(0,r.l4)(),S=(0,o.W)(T,M),x=(O,B)=>s.createElement(u,{value:B.value,visible:C||B.dragging,tipFormatter:D?()=>D(B.value):void 0,placement:M?"top":"right"},O);return s.createElement("div",{className:(0,t.cx)(S.container,S.slider)},s.createElement(n.Global,{styles:S.tooltip}),s.createElement(i.Z,{min:c,max:p,step:v,defaultValue:a,range:!0,onChange:P,onAfterChange:b,vertical:!M,reverse:y,handleRender:x}))};m.displayName="RangeSlider"},39540:(j,I,e)=>{"use strict";e.d(I,{i:()=>l});var t=e(42844),n=e(76808),i=e(30450),s=e(27702),r=e(66310),g=e(1128),d=e(72719);const l=({min:u,max:o,onChange:m,onAfterChange:c,orientation:p="horizontal",reverse:f,step:E,value:h,ariaLabelForHandle:y,marks:v,included:D})=>{const a=p==="horizontal",C=(0,r.l4)(),P=(0,d.W)(C,a,!!v),b=i.Z,[M,T]=(0,s.useState)(h??u),S=(0,s.useCallback)(W=>{const w=typeof W=="number"?W:W[0];T(w),m?.(w)},[T,m]),x=(0,s.useCallback)(W=>{let w=+W.target.value;Number.isNaN(w)&&(w=0),T(w),m&&m(w),c&&c(w)},[m,c]),O=(0,s.useCallback)(W=>{const w=+W.target.value;w>o?T(o):w<u&&T(u)},[o,u]),B=(0,s.useCallback)(W=>{const w=typeof W=="number"?W:W[0];c?.(w)},[c]),A=a?[]:[P.sliderInputVertical],V=a?[]:[P.sliderInputFieldVertical];return s.createElement("div",{className:(0,t.cx)(P.container,P.slider)},s.createElement(n.Global,{styles:P.tooltip}),s.createElement("div",{className:(0,t.cx)(P.sliderInput,...A)},s.createElement(b,{min:u,max:o,step:E,defaultValue:h,value:M,onChange:S,onAfterChange:B,vertical:!a,reverse:f,ariaLabelForHandle:y,marks:v,included:D}),s.createElement(g.I,{type:"text",className:(0,t.cx)(P.sliderInputField,...V),value:M,onChange:x,onBlur:O,min:u,max:o})))};l.displayName="Slider"},72719:(j,I,e)=>{"use strict";e.d(I,{W:()=>s});var t=e(42844),n=e(76808),i=e(80402);const s=(0,i.B)((r,g,d=!1)=>{const{spacing:l}=r,u=r.colors.border.strong,o=r.colors.primary.main,m=r.colors.primary.main,p=`box-shadow: 0px 0px 0px 6px ${r.colors.primary.transparent}`;return{container:(0,t.css)({width:"100%",margin:g?"inherit":l(1,3,1,1),paddingBottom:g&&d?r.spacing(1):"inherit",height:g?"auto":"100%"}),slider:(0,t.css)` .rc-slider { display: flex; flex-grow: 1; margin-left: 7px; // half the size of the handle to align handle to the left on 0 value } .rc-slider-mark { top: ${r.spacing(1.75)}; } .rc-slider-mark-text { color: ${r.colors.text.disabled}; font-size: ${r.typography.bodySmall.fontSize}; } .rc-slider-mark-text-active { color: ${r.colors.text.primary}; } .rc-slider-handle { border: none; background-color: ${m}; box-shadow: ${r.shadows.z1}; cursor: pointer; opacity: 1; } .rc-slider-handle:hover, .rc-slider-handle:active, .rc-slider-handle-click-focused:focus { ${p}; } // The triple class names is needed because that's the specificity used in the source css :( .rc-slider-handle-dragging.rc-slider-handle-dragging.rc-slider-handle-dragging, .rc-slider-handle:focus-visible { box-shadow: 0 0 0 5px ${r.colors.text.primary}; } .rc-slider-dot, .rc-slider-dot-active { background-color: ${r.colors.text.primary}; border-color: ${r.colors.text.primary}; } .rc-slider-track { background-color: ${o}; } .rc-slider-rail { background-color: ${u}; cursor: pointer; } `,tooltip:(0,n.css)` body { .rc-slider-tooltip { cursor: grab; user-select: none; z-index: ${r.zIndex.tooltip}; } .rc-slider-tooltip-inner { color: ${r.colors.text.primary}; background-color: transparent !important; border-radius: 0; box-shadow: none; } .rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow { display: none; } .rc-slider-tooltip-placement-top { padding: 0; } } `,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:r.spacing(3),width:"60px",input:{textAlign:"center"}}),sliderInputFieldVertical:(0,t.css)({margin:`0 0 ${r.spacing(3)} 0`,order:1})}})},61398:(j,I,e)=>{"use strict";e.d(I,{b:()=>E});var t=e(89949),n=e(27702),i=e(64987),s=e(29241),r=e(58192),g=e(64167),d=e(81144),l=e(19345),u=e(48473),o=e(48962),m=e(32053),c=e(39596);function p(h,y){const v=h.y.values.length,D={...h.y.config,...y},a=h.x??{name:"",values:[...Array(v).keys()],type:s.fS.number,config:{}};let C={refId:"sparkline",fields:[a,{...h.y,config:D}],length:v};return(0,o.lP)(a.values)||(C=(0,m.aK)(C,0)),(0,c.w)({frame:C,refFieldPseudoMin:h.timeRange?.from.valueOf(),refFieldPseudoMax:h.timeRange?.to.valueOf()})}const f={drawStyle:g.l8.Line,showPoints:g.Jp.Auto,axisPlacement:g.LB.Hidden,pointSize:2};class E extends n.PureComponent{constructor(y){super(y);const v=p(y.sparkline,y.config);this.state={data:(0,u.Bj)(v,(0,u.i7)(v)),alignedDataFrame:v,configBuilder:this.prepareConfig(v)}}static getDerivedStateFromProps(y,v){const D=p(y.sparkline,y.config);return D?{...v,data:(0,u.Bj)(D,(0,u.i7)(D)),alignedDataFrame:D}:{...v}}componentDidUpdate(y,v){const{alignedDataFrame:D}=this.state;if(!D)return;let a=!1;y.sparkline!==this.props.sparkline?a=!(0,i.Ch)(this.state.alignedDataFrame,v.alignedDataFrame):a=!(0,t.isEqual)(y.config,this.props.config),a&&this.setState({configBuilder:this.prepareConfig(D)})}getYRange(y){let{min:v,max:D}=this.state.alignedDataFrame.fields[1].state?.range;return v===D?(v===0?D=100:(v=0,D*=2),[v,D]):[Math.max(v,y.config.min??-1/0),Math.min(D,y.config.max??1/0)]}prepareConfig(y){const{theme:v}=this.props,D=new l.U;D.setCursor({show:!1,x:!1,y:!1});const a=y.fields[0];D.addScale({scaleKey:"x",orientation:g.wN.Horizontal,direction:g.bQ.Right,isTime:!1,range:()=>{const{sparkline:C}=this.props;if(C.x){if(C.timeRange&&C.x.type===s.fS.time)return[C.timeRange.from.valueOf(),C.timeRange.to.valueOf()];const P=C.x.values;return[P[0],P[P.length-1]]}return[0,C.y.values.length-1]}}),D.addAxis({scaleKey:"x",theme:v,placement:g.LB.Hidden});for(let C=0;C<y.fields.length;C++){const P=y.fields[C],b=P.config,M={...f,...b.custom};if(P===a||P.type!==s.fS.number)continue;const T=b.unit||"__fixed";D.addScale({scaleKey:T,orientation:g.wN.Vertical,direction:g.bQ.Up,range:()=>this.getYRange(P)}),D.addAxis({scaleKey:T,theme:v,placement:g.LB.Hidden});const S=(0,r.fD)(P),x=S.getCalculator(P,v)(0,0),O=M.drawStyle===g.l8.Points?g.Jp.Always:M.showPoints;D.addSeries({pxAlign:!1,scaleKey:T,theme:v,colorMode:S,thresholds:b.thresholds,drawStyle:M.drawStyle,lineColor:M.lineColor??x,lineWidth:M.lineWidth,lineInterpolation:M.lineInterpolation,showPoints:O,pointSize:M.pointSize,fillOpacity:M.fillOpacity,fillColor:M.fillColor,lineStyle:M.lineStyle,gradientMode:M.gradientMode})}return D}render(){const{data:y,configBuilder:v}=this.state,{width:D,height:a}=this.props;return n.createElement(d.N,{data:y,config:v,width:D,height:a})}}},62108:(j,I,e)=>{"use strict";e.d(I,{$:()=>g});var t=e(42844),n=e(27702),i=e(80402),s=e(73453);const r=(0,i.B)((d,l)=>(0,t.css)([{fontSize:typeof d=="string"?d:`${d}px`},l&&{display:"inline-block"}])),g=({className:d,inline:l=!1,iconClassName:u,style:o,size:m=16})=>{const c=r(m,l);return n.createElement("div",{"data-testid":"Spinner",style:o,className:(0,t.cx)(c,d)},n.createElement(s.J,{className:(0,t.cx)("fa-spin",u),name:"fa fa-spinner","aria-label":"loading spinner"}))}},10133:(j,I,e)=>{"use strict";e.d(I,{m:()=>g});var t=e(89949),n=e.n(t),i=e(27702),s=e(66656),r=e(28580);class g extends i.PureComponent{constructor(){super(...arguments),this.checkInput=()=>{const{stats:l,allowMultiple:u,defaultStat:o,onChange:m}=this.props,c=s.TB.list(l);if(c.length!==l.length){const p=c.map(E=>E.id),f=(0,t.difference)(l,p);console.warn("Unknown stats",f,l),m(c.map(E=>E.id))}!u&&l.length>1&&(console.warn("Removing extra stat",l),m([l[0]])),o&&l.length<1&&m([o])},this.onSelectionChange=l=>{const{onChange:u}=this.props;Array.isArray(l)?u(l.map(o=>o.value)):u(l&&l.value?[l.value]:[])}}componentDidMount(){this.checkInput()}componentDidUpdate(l){this.checkInput()}render(){const{stats:l,allowMultiple:u,defaultStat:o,placeholder:m,className:c,menuPlacement:p,width:f,inputId:E}=this.props,h=s.TB.selectOptions(l);return i.createElement(r.Ph,{value:h.current,className:c,isClearable:!o,isMulti:u,width:f,isSearchable:!0,options:h.options,placeholder:m,onChange:this.onSelectionChange,menuPlacement:p,inputId:E})}}g.defaultProps={allowMultiple:!1}},42074:(j,I,e)=>{"use strict";e.d(I,{r:()=>u,x:()=>o});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(58939),g=e(66310),d=e(80402),l=e(97289);const u=s.forwardRef(({value:c,checked:p,onChange:f,id:E,label:h,disabled:y,invalid:v=!1,...D},a)=>{p&&(0,r.d)("Switch","checked prop","value");const C=(0,g.l4)(),P=m(C),b=(0,s.useRef)(E||(0,n.uniqueId)("switch-"));return s.createElement("div",{className:(0,t.cx)(P.switch,v&&P.invalid)},s.createElement("input",{type:"checkbox",disabled:y,checked:c,onChange:M=>{!y&&f?.(M)},id:b.current,...D,ref:a}),s.createElement("label",{htmlFor:b.current,"aria-label":h??"Toggle switch"}))});u.displayName="Switch";const o=s.forwardRef(({transparent:c,className:p,showLabel:f,label:E,value:h,id:y,invalid:v,...D},a)=>{const C=(0,g.l4)(),P=m(C,c);return s.createElement("div",{className:(0,t.cx)(P.inlineContainer,p,D.disabled&&P.disabled,v&&P.invalid)},f&&s.createElement("label",{htmlFor:y,className:(0,t.cx)(P.inlineLabel,h&&P.inlineLabelEnabled,"inline-switch-label")},E),s.createElement(u,{...D,id:y,label:E,ref:a,value:h}))});o.displayName="Switch";const m=(0,d.B)((c,p)=>({switch:(0,t.css)({width:"32px",height:"16px",position:"relative",input:{opacity:0,left:"-100vw",zIndex:-1e3,position:"absolute","&:disabled + label":{background:c.colors.action.disabledBackground,cursor:"not-allowed"},"&:checked + label":{background:c.colors.primary.main,borderColor:c.colors.primary.main,"&:hover":{background:c.colors.primary.shade},"&::after":{transform:"translate3d(18px, -50%, 0)",background:c.colors.primary.contrastText}},"&:focus + label, &:focus-visible + label":(0,l.getFocusStyles)(c),"&:focus:not(:focus-visible) + label":(0,l.getMouseFocusStyles)(c)},label:{width:"100%",height:"100%",cursor:"pointer",borderRadius:c.shape.radius.pill,background:c.components.input.background,border:`1px solid ${c.components.input.borderColor}`,transition:"all 0.3s ease","&:hover":{borderColor:c.components.input.borderHover},"&::after":{position:"absolute",display:"block",content:'""',width:"12px",height:"12px",borderRadius:c.shape.radius.circle,background:c.colors.text.secondary,boxShadow:c.shadows.z1,top:"50%",transform:"translate3d(2px, -50%, 0)",transition:"transform 0.2s cubic-bezier(0.19, 1, 0.22, 1)","@media (forced-colors: active)":{border:"1px solid transparent"}}}}),inlineContainer:(0,t.css)({padding:c.spacing(0,1),height:c.spacing(c.components.height.md),display:"inline-flex",alignItems:"center",background:p?"transparent":c.components.input.background,border:`1px solid ${p?"transparent":c.components.input.borderColor}`,borderRadius:c.shape.borderRadius(),"&:hover":{border:`1px solid ${p?"transparent":c.components.input.borderHover}`,".inline-switch-label":{color:c.colors.text.primary}}}),disabled:(0,t.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,t.css)({cursor:"pointer",paddingRight:c.spacing(1),color:c.colors.text.secondary,whiteSpace:"nowrap"}),inlineLabelEnabled:(0,t.css)({color:c.colors.text.primary}),invalid:(0,t.css)({"input + label, input:checked + label, input:hover + label":{border:`1px solid ${c.colors.error.border}`}})}))},84279:(j,I,e)=>{"use strict";e.d(I,{W:()=>m});var t=e(42844),n=e(27702),i=e(15372),s=e(54281),r=e(67437),g=e(29372),d=e(4432),l=e(80402),u=e(66310);const o=(0,l.B)(c=>({container:(0,t.css)({height:"100%"}),tabContent:(0,t.css)({padding:c.spacing(2),backgroundColor:c.colors.background.primary,height:`calc(100% - ${c.components.menuTabs.height}px)`}),close:(0,t.css)({position:"absolute",right:"16px",top:"5px",cursor:"pointer",fontSize:c.typography.size.lg}),tabs:(0,t.css)({paddingTop:c.spacing(1),borderColor:c.colors.border.weak,ul:{marginLeft:c.spacing(2)}})}));function m(c){const[p,f]=(0,n.useState)(c.tabs.some(C=>C.value===c.defaultTab)?c.defaultTab:c.tabs?.[0].value),E=C=>{f(C.value)},{tabs:h,onClose:y,closeIconTooltip:v}=c,D=(0,u.l4)(),a=o(D);return n.createElement("div",{className:a.container},n.createElement(i.J,{className:a.tabs},h.map(C=>n.createElement(s.O,{key:C.value,label:C.label,active:C.value===p,onChangeTab:()=>E(C),icon:C.icon})),n.createElement(r.h,{className:a.close,onClick:y,name:"times",tooltip:v??"Close"})),n.createElement(g.$,{autoHeightMin:"100%"},n.createElement(d.I,{className:a.tabContent},h.find(C=>C.value===p)?.content)))}},93915:(j,I,e)=>{"use strict";e.d(I,{i:()=>d,c:()=>u});var t=e(27702),n=e(66656),i=e(74639),s=e(42844);const r=o=>{const m=(0,s.css)({width:"100%",listStyle:"none"}),c=(0,s.css)({width:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between"});return o.value&&!Array.isArray(o.value)?t.createElement("span",null,o.value):o.value&&Array.isArray(o.value)&&o.value.length>0?t.createElement("ul",{className:m},o.value.map((p,f)=>{const E=Object.keys(p)[0];return t.createElement("li",{className:c,key:f},t.createElement("span",null,E),t.createElement("span",null,p[E]))})):g},g=()=>t.createElement("span",null,"\xA0");function d(o){const{totalColumnsWidth:m,footerGroups:c,isPaginationVisible:p,tableStyles:f}=o,E=i.wl.components.Panels.Visualization.Table;return t.createElement("div",{style:{position:p?"relative":"absolute",width:m?`${m}px`:"100%",bottom:"0px"}},c.map(h=>{const{key:y,...v}=h.getFooterGroupProps();return t.createElement("div",{className:f.tfoot,...v,key:y,"data-testid":E.footer},h.headers.map(D=>l(D,f)))}))}function l(o,m){const c=o.getHeaderProps();return c?(c.style=c.style??{},c.style.position="absolute",c.style.justifyContent=o.justifyContent,t.createElement("div",{className:m.headerCell,...c},o.render("Footer"))):null}function u(o,m,c){if(m===void 0)return g;if(c){if(m[o]===void 0)return g;const p=n.TB.get(n.gz.count).name;return r({value:[{[p]:String(m[o])}]})}return r({value:m[o]})}},42100:(j,I,e)=>{"use strict";e.d(I,{A:()=>u,U:()=>l});var t=e(27702),n=e(11024),i=e(29241),s=e(32053),r=e(64167),g=e(61398),d=e(37193);const l={drawStyle:r.l8.Line,lineInterpolation:r.KC.Smooth,lineWidth:1,fillOpacity:17,gradientMode:r.FI.Hue,pointSize:2,barAlignment:r.pu.Center,showPoints:r.Jp.Never},u=c=>{const{field:p,innerWidth:f,tableStyles:E,cell:h,cellProps:y,timeRange:v}=c,D=o(h.value);if(!D)return t.createElement("div",{...y,className:E.cellContainer},"no data");D.x&&!D.x.config.interval&&D.x.values.length>1&&(D.x.config.interval=D.x.values[1]-D.x.values[0]),D.y.values=D.y.values.map(b=>Number.isFinite(b)?b:null);const a=(0,n.dz)(D.y);D.y.config.min=a.min,D.y.config.max=a.max,D.y.state={range:a},D.timeRange=v;const C=m(p),P={color:p.config.color,custom:{...l,...C}};return t.createElement("div",{...y,className:E.cellContainer},t.createElement(g.b,{width:f,height:E.cellHeightInner,sparkline:D,config:P,theme:E.theme}))};function o(c){if(Array.isArray(c))return{y:{name:"test",type:i.fS.number,values:c,config:{}}};if((0,s.aY)(c)){const p=c.fields.find(E=>E.type===i.fS.time),f=c.fields.find(E=>E.type===i.fS.number);if(p&&f)return{x:p,y:f}}}function m(c){let p=(0,d.S_)(c);if(p.type===r.h2.Auto&&(p={...p,type:r.h2.Sparkline}),p.type===r.h2.Sparkline)return p;throw new Error(`Expected options type ${r.h2.Sparkline} but got ${p.type}`)}},95066:(j,I,e)=>{"use strict";e.d(I,{i:()=>se});var t=e(27702),n=e(10350),i=e(25472),s=e(66656),r=e(64167),g=e(66310),d=e(29372),l=e(50852),u=e(93915),o=e(74639),m=e(4680),c=e(73453),p=e(42844),f=e(71235),E=e(8430),h=e(64022),y=e(79978),v=e(67437),D=e(66670),a=e(33716),C=e(83967),P=e(80402);const b=28,M=b*5,T=({options:Z,values:le,caseSensitive:oe,onChange:q})=>{const ne=(0,g.l4)(),ge=S(ne),[ae,re]=(0,t.useState)(""),De=(0,t.useMemo)(()=>new RegExp(ae,oe?void 0:"i"),[ae,oe]),he=(0,t.useMemo)(()=>Z.filter(et=>et.label===void 0?!1:De.test(et.label)),[Z,De]),ye=ne.spacing.gridSize,ce=(0,t.useMemo)(()=>Math.min(he.length*b,M)+ye,[ye,he.length]),We=(0,t.useCallback)(et=>{re(et)},[re]),ke=(0,t.useCallback)(et=>we=>{const _e=we.currentTarget.checked?le.concat(et):le.filter(Ge=>Ge.value!==et.value);q(_e)},[q,le]);return t.createElement(h.wc,{spacing:"md"},t.createElement(a.H,{placeholder:"Filter values",onChange:We,value:ae}),!he.length&&t.createElement(y._,null,"No values"),he.length&&t.createElement(i.t7,{height:ce,itemCount:he.length,itemSize:b,width:"100%",className:ge.filterList},({index:et,style:we})=>{const _e=he[et],{value:Ge,label:qe}=_e,st=le.find(Me=>Me.value===Ge)!==void 0;return t.createElement("div",{className:ge.filterListRow,style:we,title:qe},t.createElement(C.X,{value:st,label:qe,onChange:ke(_e)}))}))},S=(0,P.B)(Z=>({filterList:(0,p.css)({label:"filterList"}),filterListRow:(0,p.css)({label:"filterListRow",cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:Z.spacing(.5),":hover":{backgroundColor:Z.colors.action.hover}})}));var x=e(37193);const O=({column:{preFilteredRows:Z,filterValue:le,setFilter:oe},onClose:q,field:ne})=>{const ge=(0,g.l4)(),ae=(0,t.useMemo)(()=>(0,x.AF)(Z,ne),[Z,ne]),re=(0,t.useMemo)(()=>(0,x.mP)(ae),[ae]),De=(0,t.useMemo)(()=>(0,x.n0)(re,le),[re,le]),[he,ye]=(0,t.useState)(De),[ce,We]=(0,t.useState)(!1),ke=(0,t.useCallback)(qe=>q(),[q]),et=(0,t.useCallback)(qe=>{const st=he.length?he:void 0;oe(st),q()},[oe,he,q]),we=(0,t.useCallback)(qe=>{oe(void 0),q()},[oe,q]),_e=(0,t.useMemo)(()=>le!==void 0,[le]),Ge=(0,g.wW)(B);return t.createElement(E.L,{onClick:ke,useCapture:!0},t.createElement("div",{className:(0,p.cx)(Ge.filterContainer),onClick:A},t.createElement(h.wc,{spacing:"lg"},t.createElement(h.wc,{spacing:"xs"},t.createElement(h.Lh,{justify:"space-between",align:"center"},t.createElement(y._,{className:Ge.label},"Filter by values:"),t.createElement(v.h,{name:"text-fields",tooltip:"Match case",style:{color:ce?ge.colors.text.link:ge.colors.text.disabled},onClick:()=>{We(qe=>!qe)}})),t.createElement("div",{className:(0,p.cx)(Ge.listDivider)}),t.createElement(T,{onChange:ye,values:he,options:re,caseSensitive:ce})),t.createElement(h.Lh,{spacing:"lg"},t.createElement(h.Lh,null,t.createElement(D.zx,{size:"sm",onClick:et},"Ok"),t.createElement(D.zx,{size:"sm",variant:"secondary",onClick:ke},"Cancel")),_e&&t.createElement(h.Lh,null,t.createElement(D.zx,{fill:"text",size:"sm",onClick:we},"Clear filter"))))))},B=Z=>({filterContainer:(0,p.css)({label:"filterContainer",width:"100%",minWidth:"250px",height:"100%",maxHeight:"400px",backgroundColor:Z.colors.background.primary,border:`1px solid ${Z.colors.border.weak}`,padding:Z.spacing(2),margin:Z.spacing(1,0),boxShadow:Z.shadows.z3,borderRadius:Z.shape.radius.default}),listDivider:(0,p.css)({label:"listDivider",width:"100%",borderTop:`1px solid ${Z.colors.border.medium}`,padding:Z.spacing(.5,2)}),label:(0,p.css)({marginBottom:0})}),A=Z=>{Z.stopPropagation()},V=({column:Z,field:le,tableStyles:oe})=>{const q=(0,t.useRef)(null),[ne,ge]=(0,t.useState)(!1),ae=(0,g.wW)(W),re=(0,t.useMemo)(()=>!!Z.filterValue,[Z.filterValue]),De=(0,t.useCallback)(()=>ge(!0),[ge]),he=(0,t.useCallback)(()=>ge(!1),[ge]);return!le||!le.config.custom?.filterable?null:t.createElement("button",{className:(0,p.cx)(oe.headerFilter,re?ae.filterIconEnabled:ae.filterIconDisabled),ref:q,type:"button",onClick:De},t.createElement(c.J,{name:"filter"}),ne&&q.current&&t.createElement(f.J,{content:t.createElement(O,{column:Z,tableStyles:oe,field:le,onClose:he}),placement:"bottom-start",referenceElement:q.current,show:!0}))},W=Z=>({filterIconEnabled:(0,p.css)({label:"filterIconEnabled",color:Z.colors.primary.text}),filterIconDisabled:(0,p.css)({label:"filterIconDisabled",color:Z.colors.text.disabled})}),w=Z=>{const{headerGroups:le,showTypeIcons:oe,tableStyles:q}=Z,ne=o.wl.components.Panels.Visualization.Table;return t.createElement("div",{role:"rowgroup",className:q.headerRow},le.map(ge=>{const{key:ae,...re}=ge.getHeaderGroupProps();return t.createElement("div",{className:q.thead,...re,key:ae,"aria-label":ne.header,role:"row"},ge.headers.map((De,he)=>N(De,q,oe)))}))};function N(Z,le,oe){const q=Z.getHeaderProps(),ne=Z.field??null;return Z.canResize&&(q.style.userSelect=Z.isResizing?"none":"auto"),q.style.position="absolute",q.style.justifyContent=Z.justifyContent,t.createElement("div",{className:le.headerCell,...q,role:"columnheader"},Z.canSort&&t.createElement(t.Fragment,null,t.createElement("button",{...Z.getSortByToggleProps(),className:le.headerCellLabel},oe&&t.createElement(c.J,{name:(0,m.e7)(ne),title:ne?.type,size:"sm",className:le.typeIcon}),t.createElement("div",null,Z.render("Header")),Z.isSorted&&(Z.isSortedDesc?t.createElement(c.J,{size:"lg",name:"arrow-down",className:le.sortIcon}):t.createElement(c.J,{name:"arrow-up",size:"lg",className:le.sortIcon}))),Z.canFilter&&t.createElement(V,{column:Z,tableStyles:le,field:ne})),!Z.canSort&&Z.render("Header"),!Z.canSort&&Z.canFilter&&t.createElement(V,{column:Z,tableStyles:le,field:ne}),Z.canResize&&t.createElement("div",{...Z.getResizerProps(),className:le.resizeHandle}))}var F=e(94878);function k(Z,le){(0,t.useEffect)(()=>{const oe=Z.current?.querySelector(".track-vertical"),q=le.current?.firstChild;q&&oe&&(oe?.remove(),q.querySelector(":scope > .track-vertical")?.remove(),q.append(oe))})}function H(Z,le,oe){(0,t.useEffect)(()=>{if(Z.lastExpandedIndex!==void 0){le.current?.resetAfterIndex(Math.max(Z.lastExpandedIndex-1,0));return}},[Z.lastExpandedIndex,Z.toggleRowExpandedCounter,le,oe])}var R=e(75578);function _({onColumnResize:Z,onSortByChange:le,data:oe}){return(0,t.useCallback)((q,ne)=>{switch(ne.type){case"columnDoneResizing":if(Z){const ae=q.columnResizing.headerIdWidths[0][0],re=parseInt(ae,10),De=Math.round(q.columnResizing.columnWidths[ae]),he=oe.fields[re];if(!he)return q;const ye=(0,R.CZ)(he,oe);Z(ye,De)}case"toggleSortBy":if(le){const ge=[];for(const ae of q.sortBy){const re=oe.fields[parseInt(ae.id,10)];re&&ge.push({displayName:(0,R.CZ)(re,oe),desc:ae.desc})}le(ge)}case"toggleRowExpanded":if(ne.id)return{...q,lastExpandedIndex:parseInt(ne.id,10),toggleRowExpandedCounter:q.toggleRowExpandedCounter+1}}return q},[oe,Z,le])}function G(Z,le){const oe={toggleRowExpandedCounter:0};if(Z){oe.sortBy=[];for(const q of Z)for(const ne of le)ne.Header===q.displayName&&oe.sortBy.push({id:ne.id,desc:q.desc})}return oe}var Y=e(63194);const X=150,Q=36,se=(0,t.memo)(Z=>{const{ariaLabel:le,data:oe,subData:q,height:ne,onCellFilterAdded:ge,width:ae,columnMinWidth:re=X,noHeader:De,resizable:he=!0,initialSortBy:ye,footerOptions:ce,showTypeIcons:We,footerValues:ke,enablePagination:et,cellHeight:we=r.Ss.Sm,timeRange:_e}=Z,Ge=(0,t.useRef)(null),qe=(0,t.useRef)(null),st=(0,t.useRef)(null),Me=(0,g.l4)(),be=(0,Y.p)(Me,we),Ke=De?0:be.rowHeight,[Ye,tt]=(0,t.useState)(ke),nt=(0,t.useMemo)(()=>{const Qe=Q;let rt=0;if(!Ye)return 0;for(const pt of Ye)Array.isArray(pt)&&pt.length>rt&&(rt=pt.length);return rt>1?Qe*rt:Qe},[Ye]),Pt=(0,t.useMemo)(()=>oe.fields.length?Array(oe.length).fill(0):[],[oe]),xt=!!(ce?.countRows&&ce.reducer&&ce.reducer.length&&ce.reducer[0]===s.gz.count),bt=(0,t.useMemo)(()=>(0,x.Pu)(oe,ae,re,!!q?.length,Ye,xt),[oe,ae,re,Ye,q,xt]),Rt=_(Z),ct=(0,t.useMemo)(()=>({columns:bt,data:Pt,disableResizing:!he,stateReducer:Rt,autoResetPage:!1,initialState:G(ye,bt),autoResetFilters:!1,sortTypes:{number:x.QT,"alphanumeric-insensitive":x.nl}}),[ye,bt,Pt,he,Rt]),{getTableProps:it,headerGroups:me,footerGroups:Ee,rows:Ce,prepareRow:Ae,totalColumnsWidth:ze,page:Ie,state:xe,gotoPage:Te,setPageSize:Oe,pageOptions:ie}=(0,n.useTable)(ct,n.useFilters,n.useSortBy,n.useAbsoluteLayout,n.useResizeColumns,n.useExpanded,n.usePagination),Le=xe;(0,t.useEffect)(()=>{ce||tt(ke)},[ke,ce]),(0,t.useEffect)(()=>{if(!ce)return;if(!ce.show){tt(void 0);return}if(xt){const rt=[];rt[0]=me[0]?.headers[0]?.filteredRows.length.toString()??oe.length.toString(),tt(rt);return}const Qe=(0,x.jB)(me[0].headers,(0,x.KF)(Ce),ce,Me);tt(Qe)},[ce,Me,xe.filters,oe]);let Be=ne-(Ke+nt);et&&(Be-=be.cellHeight);const Ue=Math.round(Be/be.rowHeight)-1;(0,t.useEffect)(()=>{Ue<=0||Oe(Ue)},[Ue,Oe]),H(Le,Ge,oe),k(st,qe);const ue=(0,t.useCallback)(Qe=>{if(xe.expanded[Qe]){const rt=q?.find(pt=>pt.meta?.custom?.parentRowIndex===Qe);if(rt){const pt=!!rt.meta?.custom?.noHeader,It={height:be.rowHeight*(rt.length+(pt?0:1)),background:Me.colors.emphasize(Me.colors.background.primary,.015),paddingLeft:x.bc,position:"absolute",bottom:0};return t.createElement("div",{style:It},t.createElement(se,{data:rt,width:ae-x.bc,height:be.rowHeight*(rt.length+1),noHeader:pt}))}}return null},[xe.expanded,q,be.rowHeight,Me.colors,ae]),pe=(0,t.useCallback)(({index:Qe,style:rt})=>{let pt=Ce[Qe];return et&&(pt=Ie[Qe]),Ae(pt),t.createElement("div",{...pt.getRowProps({style:rt}),className:be.row},ue(Qe),pt.cells.map((It,_t)=>t.createElement(F.p,{key:_t,tableStyles:be,cell:It,onCellFilterAdded:ge,columnIndex:_t,columnCount:pt.cells.length,timeRange:_e,frame:oe})))},[ge,Ie,et,Ae,Ce,be,ue,_e,oe]),$e=(0,t.useCallback)(Qe=>{Te(Qe-1)},[Te]),Se=et?Ie.length:Ce.length;let Ve=null;if(et){const Qe=xe.pageIndex*xe.pageSize+1;let rt=Qe+xe.pageSize-1;const pt=ae<550;rt>oe.length&&(rt=oe.length),Ve=t.createElement("div",{className:be.paginationWrapper},t.createElement(l.t,{currentPage:xe.pageIndex+1,numberOfPages:ie.length,showSmallVersion:pt,onNavigate:$e}),pt?null:t.createElement("div",{className:be.paginationSummary},Qe," - ",rt," of ",oe.length," rows"))}const He=Qe=>{if(xe.expanded[Qe]){const rt=q?.find(pt=>pt.meta?.custom?.parentRowIndex===Qe);if(rt){const pt=!!rt.meta?.custom?.noHeader;return be.rowHeight*(rt.length+1+(pt?0:1))}}return be.rowHeight},Ze=Qe=>{const{scrollTop:rt}=Qe.target;Ge.current!==null&&Ge.current.scrollTo(rt)};return t.createElement("div",{...it(),className:be.table,"aria-label":le,role:"table",ref:qe,style:{width:ae,height:ne}},t.createElement(d.$,{hideVerticalTrack:!0},t.createElement("div",{className:be.tableContentWrapper(ze)},!De&&t.createElement(w,{headerGroups:me,showTypeIcons:We,tableStyles:be}),Se>0?t.createElement("div",{ref:st},t.createElement(d.$,{onScroll:Ze,hideHorizontalTrack:!0},t.createElement(i.S_,{key:be.rowHeight,height:Be,itemCount:Se,itemSize:He,width:"100%",ref:Ge,style:{overflow:void 0}},pe))):t.createElement("div",{style:{height:ne-Ke},className:be.noData},"No data"),Ye&&t.createElement(u.i,{isPaginationVisible:!!et,footerValues:Ye,footerGroups:Ee,totalColumnsWidth:ze,tableStyles:be}))),Ve)});se.displayName="Table"},94878:(j,I,e)=>{"use strict";e.d(I,{p:()=>t});const t=({cell:n,tableStyles:i,onCellFilterAdded:s,timeRange:r,userProps:g,frame:d})=>{const l=n.getCellProps(),u=n.column.field;if(!u?.display)return null;l.style&&(l.style.minWidth=l.style.width,l.style.justifyContent=n.column.justifyContent);let o=(n.column.width??24)-i.cellPadding*2;return n.render("Cell",{field:u,tableStyles:i,onCellFilterAdded:s,cellProps:l,innerWidth:o,timeRange:r,userProps:g,frame:d})}},63194:(j,I,e)=>{"use strict";e.d(I,{p:()=>n});var t=e(42844);function n(s,r){const g=s.colors.border.weak,d=s.colors.primary.border,l=6,u=i(s,r,l),o=u+2,m=28,c=(p,f,E)=>(0,t.css)({label:E?"cellContainerOverflow":"cellContainerNoOverflow",padding:`${l}px`,width:"100%",height:`${o-1}px`,display:"flex",alignItems:"center",borderRight:`1px solid ${g}`,color:p??void 0,background:f??void 0,backgroundClip:"padding-box","&:last-child:not(:only-child)":{borderRight:"none"},"&:hover":{overflow:E?"visible":void 0,width:E?"auto !important":void 0,boxShadow:E?`0 0 2px ${s.colors.primary.main}`:void 0,background:E?f??s.components.table.rowHoverBackground:void 0,zIndex:E?1:void 0,".cellActions":{visibility:"visible",opacity:1,width:"auto"}},a:{color:"inherit"},".cellActions":{display:"flex",position:E?void 0:"absolute",top:E?void 0:0,right:E?void 0:0,margin:E?s.spacing(0,-.5,0,.5):"auto",visibility:"hidden",opacity:0,width:0,alignItems:"center",height:"100%",padding:s.spacing(1,.5,1,.5),background:f?"none":s.colors.emphasize(s.colors.background.primary,.03),svg:{color:p}},".cellActionsLeft":{right:"auto !important",left:0},".cellActionsTransparent":{background:"none"}});return{theme:s,cellHeight:u,buildCellContainerStyle:c,cellPadding:l,cellHeightInner:u-l*2,rowHeight:o,table:(0,t.css)({height:"100%",width:"100%",overflow:"auto",display:"flex",flexDirection:"column"}),thead:(0,t.css)({label:"thead",height:`${m}px`,overflowY:"auto",overflowX:"hidden",position:"relative"}),tfoot:(0,t.css)({label:"tfoot",height:`${m}px`,borderTop:`1px solid ${g}`,overflowY:"auto",overflowX:"hidden",position:"relative"}),headerRow:(0,t.css)({label:"row",borderBottom:`1px solid ${g}`}),headerCell:(0,t.css)({height:"100%",padding:`0 ${l}px`,overflow:"hidden",whiteSpace:"nowrap",display:"flex",alignItems:"center",fontWeight:s.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:s.typography.fontWeightMedium,display:"flex",alignItems:"center",marginRight:s.spacing(.5),"&:hover":{textDecoration:"underline",color:s.colors.text.link}}),cellContainer:c(void 0,void 0,!0),cellContainerNoOverflow:c(void 0,void 0,!1),cellText:(0,t.css)({overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap"}),sortIcon:(0,t.css)({marginLeft:s.spacing(.5)}),cellLink:(0,t.css)({cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap",color:s.colors.text.link,fontWeight:s.typography.fontWeightMedium,"&:hover":{textDecoration:"underline",color:s.colors.text.link}}),cellLinkForColoredCell:(0,t.css)({cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap",fontWeight:s.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:`${u}px`,justifyContent:"center",alignItems:"center",width:"100%",li:{marginBottom:0}}),paginationSummary:(0,t.css)({color:s.colors.text.secondary,fontSize:s.typography.bodySmall.fontSize,display:"flex",justifyContent:"flex-end",padding:s.spacing(0,1,0,2)}),tableContentWrapper:p=>{const f=p!==void 0?`${p}px`:"100%";return(0,t.css)({label:"tableContentWrapper",width:f,display:"flex",flexDirection:"column"})},row:(0,t.css)({label:"row",borderBottom:`1px solid ${g}`,"&:hover":{backgroundColor:s.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:d,opacity:0,transition:"opacity 0.2s ease-in-out",width:"8px",height:"100%",position:"absolute",right:"-4px",borderRadius:s.shape.radius.default,top:0,touchAction:"none","&:hover":{opacity:1}}),typeIcon:(0,t.css)({marginRight:s.spacing(1),color:s.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:`${o}px`,cursor:"pointer"})}}function i(s,r,g){const d=s.typography.fontSize,l=s.typography.body.lineHeight;switch(r){case"md":return 42;case"lg":return 48;case"sm":default:return g*2+d*l}}},36191:(j,I,e)=>{"use strict";e.d(I,{PT:()=>t,tE:()=>n});const t="=",n="!="},37193:(j,I,e)=>{"use strict";e.d(I,{bc:()=>le,AF:()=>ae,KF:()=>_e,S_:()=>qe,Pu:()=>q,n0:()=>ye,jB:()=>et,E4:()=>oe,q7:()=>st,nl:()=>ce,QT:()=>We,mP:()=>De});var t=e(89949),n=e(82152),i=e(29241),s=e(75578),r=e(32053),g=e(59425),d=e(21609),l=e(66656),u=e(61965),o=e(64167),m=e(27702),c=e(5168),p=e(11024),f=e(90482),E=e(24919),h=e(50741);const y={mode:c.H.Absolute,steps:[{color:"blue",value:-1/0},{color:"green",value:20}]},v=be=>{const{field:Ke,innerWidth:Ye,tableStyles:tt,cell:nt,cellProps:Pt,row:xt}=be,bt=Ke.display(nt.value),Rt=qe(Ke);let ct=(0,p.xD)(Ke,!1);ct.thresholds||(ct={...ct,thresholds:y});let it=o.QH.Gradient,me;Rt.type===o.h2.Gauge&&(it=Rt.mode??o.QH.Gradient,me=Rt.valueDisplayMode!==void 0?Rt.valueDisplayMode:o.M8.Text);const Ee=()=>(0,t.isFunction)(Ke.getLinks)?Ke.getLinks({valueRowIndex:xt.index}):[],Ce=!!Ee().length,Ae=D(Ke,bt,nt.row.index),ze=Ie=>{const{openMenu:xe,targetClassName:Te}=Ie;return m.createElement(E.xf,{width:Ye,height:tt.cellHeightInner,field:ct,display:Ke.display,text:{valueSize:14},value:bt,orientation:f.wm.Horizontal,theme:tt.theme,alignmentFactors:Ae,onClick:xe,className:Te,itemSpacing:1,lcdCellWidth:8,displayMode:it,valueDisplayMode:me})};return m.createElement("div",{...Pt,className:tt.cellContainer},Ce&&m.createElement(h.V,{links:Ee,style:{display:"flex",width:"100%"}},Ie=>ze(Ie)),!Ce&&ze({}))};function D(be,Ke,Ye){let tt=be.state?.alignmentFactors;if(tt)return tt.text.length<Ke.text.length&&(tt.text=Ke.text),tt;{tt={...Ke};const nt=Math.min(be.values.length,Ye+1e3);for(let Pt=Ye+1;Pt<nt;Pt++)be.display(be.values[Pt]).text.length>tt.text.length&&(tt.text=Ke.text);return be.state?be.state.alignmentFactors=tt:be.state={alignmentFactors:tt},tt}}var a=e(42844),C=e(71685),P=e(66310),b=e(9451),M=e(5354),T=e(66670),S=e(67437),x=e(64022),O=e(71585),B=e(13741),A=e(11649);function V({value:be,onDismiss:Ke,mode:Ye}){let tt=be;if((0,t.isString)(be))try{be=JSON.parse(be)}catch{}else tt=JSON.stringify(be,null," ");let nt=tt;return Ye==="code"&&(nt=JSON.stringify(be,null," ")),m.createElement(B.u,{onDismiss:Ke,isOpen:!0,title:"Inspect value"},Ye==="code"?m.createElement(A.p,{width:"100%",height:500,language:"json",showLineNumbers:!0,showMiniMap:(nt&&nt.length)>100,value:nt,readOnly:!0}):m.createElement("pre",null,nt),m.createElement(B.u.ButtonRow,null,m.createElement(O.m,{icon:"copy",getText:()=>nt},"Copy to Clipboard")))}var W=e(36191);function w({field:be,cell:Ke,previewMode:Ye,showFilters:tt,onCellFilterAdded:nt}){const[Pt,xt]=(0,m.useState)(!1),bt=oe(be)==="flex-end",Rt=!!be.config.custom?.inspect,ct={size:"sm",tooltipPlacement:"top"},it=(0,m.useCallback)(Ee=>{nt&&nt({key:be.name,operator:W.PT,value:Ke.value})},[Ke,be,nt]),me=(0,m.useCallback)(Ee=>{nt&&nt({key:be.name,operator:W.tE,value:Ke.value})},[Ke,be,nt]);return m.createElement(m.Fragment,null,m.createElement("div",{className:`cellActions ${bt?"cellActionsLeft":""}`},m.createElement(x.Lh,{spacing:"xs"},Rt&&m.createElement(S.h,{name:"eye",tooltip:"Inspect value",onClick:()=>{xt(!0)},...ct}),tt&&m.createElement(S.h,{name:"search-plus",onClick:it,tooltip:"Filter for value",...ct}),tt&&m.createElement(S.h,{name:"search-minus",onClick:me,tooltip:"Filter out value",...ct}))),Pt&&m.createElement(V,{mode:Ye,value:Ke.value,onDismiss:()=>{xt(!1)}}))}const N=be=>{const{field:Ke,cell:Ye,tableStyles:tt,row:nt,cellProps:Pt,frame:xt}=be,bt=!!Ke.config.custom?.inspect,Rt=Ke.display(Ye.value),ct=be.onCellFilterAdded&&Ke.config.filterable,it=ct&&Ye.value!==void 0||bt,me=qe(Ke),Ee=F(tt,me,Rt,bt),Ce=!!(0,b.i)(Ke,nt)?.length,Ae=(0,P.wW)(T._7);let ze;if(me.type===o.h2.Custom){const Ie=me.cellComponent;ze=m.createElement(Ie,{field:Ke,value:Ye.value,rowIndex:nt.index,frame:xt})}else m.isValidElement(Ye.value)?ze=Ye.value:ze=(0,d.zc)(Rt);return m.createElement("div",{...Pt,className:Ee},!Ce&&m.createElement("div",{className:tt.cellText},ze),Ce&&m.createElement(h.V,{links:()=>(0,b.i)(Ke,nt)||[]},Ie=>Ie.openMenu?m.createElement("button",{className:(0,a.cx)(Ae,k(tt,me,Ie.targetClassName)),onClick:Ie.openMenu},ze):m.createElement("div",{className:k(tt,me,Ie.targetClassName)},ze)),it&&m.createElement(w,{...be,previewMode:"text",showFilters:ct}))};function F(be,Ke,Ye,tt=!1){const nt=be.theme.isDark?1:-.7;let Pt,xt;if(Ke.type===o.h2.ColorText)Pt=Ye.color;else if(Ke.type===o.h2.ColorBackground){const bt=Ke.mode??o.v7.Gradient;if(bt===o.v7.Basic)Pt=(0,M.bM)(Ye.color,be.theme.isDark),xt=(0,C.Z)(Ye.color).toRgbString();else if(bt===o.v7.Gradient){const Rt=(0,C.Z)(Ye.color).darken(10*nt).spin(5);Pt=(0,M.bM)(Ye.color,be.theme.isDark),xt=`linear-gradient(120deg, ${Rt.toRgbString()}, ${Ye.color})`}}return Pt!==void 0||xt!==void 0?be.buildCellContainerStyle(Pt,xt,!tt):tt?be.cellContainerNoOverflow:be.cellContainer}function k(be,Ke,Ye){return Ke.type===o.h2.Auto?(0,a.cx)(be.cellLink,Ye):(0,a.cx)(be.cellLinkForColoredCell,Ye)}var H=e(93915),R=e(97981),_=e(13012);function G(be){const{cell:Ke,tableStyles:Ye,cellProps:tt}=be;let nt="";return Ke.value instanceof _.Z?nt=new R.Z().writeGeometry(Ke.value,{featureProjection:"EPSG:3857",dataProjection:"EPSG:4326"}):Ke.value!=null&&(nt=`${Ke.value}`),m.createElement("div",{...tt,className:Ye.cellContainer},m.createElement("div",{className:Ye.cellText,style:{fontFamily:"monospace"}},nt))}const Y=be=>{const{field:Ke,cell:Ye,tableStyles:tt,row:nt,cellProps:Pt}=be,xt=Ke.display(Ye.value),bt=!!(0,b.i)(Ke,nt)?.length,Rt=(0,P.wW)(T._7);return m.createElement("div",{...Pt,className:tt.cellContainer},!bt&&m.createElement("img",{src:xt.text,className:tt.imageCell,alt:""}),bt&&m.createElement(h.V,{style:{height:"100%"},links:()=>(0,b.i)(Ke,nt)||[]},ct=>{const it=m.createElement("img",{src:xt.text,className:tt.imageCell,alt:""});return ct.openMenu?m.createElement(T.zx,{className:(0,a.cx)(Rt),onClick:ct.openMenu},it):it}))};function X(be){const{cell:Ke,tableStyles:Ye,cellProps:tt,field:nt,row:Pt}=be,xt=!!nt.config.custom?.inspect,bt=(0,a.css)({cursor:"pointer",fontFamily:"monospace"});let Rt=Ke.value,ct=Rt;if((0,t.isString)(Rt))try{Rt=JSON.parse(Rt)}catch{}else ct=JSON.stringify(Rt,null," ");const it=!!(0,b.i)(nt,Pt)?.length,me=(0,P.wW)(T._7);return m.createElement("div",{...tt,className:xt?Ye.cellContainerNoOverflow:Ye.cellContainer},m.createElement("div",{className:(0,a.cx)(Ye.cellText,bt)},!it&&m.createElement("div",{className:Ye.cellText},ct),it&&m.createElement(h.V,{links:()=>(0,b.i)(nt,Pt)||[]},Ee=>Ee.openMenu?m.createElement(T.zx,{className:(0,a.cx)(me),onClick:Ee.openMenu},ct):m.createElement(m.Fragment,null,ct))),xt&&m.createElement(w,{...be,previewMode:"code"}))}var Q=e(73453);function se({row:be,tableStyles:Ke}){return m.createElement("div",{className:Ke.expanderCell,...be.getToggleRowExpandedProps()},m.createElement(Q.J,{"aria-label":be.isExpanded?"Collapse row":"Expand row",name:be.isExpanded?"angle-down":"angle-right",size:"xl"}))}var Z=e(42100);const le=50;function oe(be){if(!be)return"flex-start";if(be.config.custom)switch(be.config.custom.align){case"right":return"flex-end";case"left":return"flex-start";case"center":return"center"}return be.type===i.fS.number?"flex-end":"flex-start"}function q(be,Ke,Ye,tt,nt,Pt){const xt=[];let bt=0;tt&&(xt.push({Header:()=>null,id:"expander",Cell:se,width:le,minWidth:le,filter:(ct,it,me)=>[],justifyContent:"left",field:be.fields[0],sortType:"basic"}),Ke-=le);for(const[ct,it]of be.fields.entries()){const me=it.config.custom||{};if(me.hidden)continue;me.width?Ke-=me.width:bt++;const Ee=Ae=>{switch(Ae){case i.fS.number:return"number";case i.fS.time:return"basic";default:return"alphanumeric-insensitive"}},Ce=ne(me.cellOptions?.type,it);xt.push({Cell:Ce,id:ct.toString(),field:it,Header:me.hideHeader?"":(0,s.CZ)(it,be),accessor:(Ae,ze)=>it.values[ze],sortType:Ee(it.type),width:me.width,minWidth:me.minWidth??Ye,filter:(0,n.Z)(ge(it)),justifyContent:oe(it),Footer:(0,H.c)(ct,nt,Pt)})}let Rt=Ke/bt;for(let ct=bt;ct>0;ct--)for(const it of xt)!it.width&&it.minWidth>Rt&&(it.width=it.minWidth,Ke-=it.width,bt-=1,Rt=Ke/bt);for(const ct of xt)ct.width||(ct.width=Rt),ct.minWidth=50;return xt}function ne(be,Ke){switch(be){case o.h2.Custom:case o.h2.ColorText:case o.h2.ColorBackground:return N;case o.h2.Image:return Y;case o.h2.Gauge:return v;case o.h2.Sparkline:return Z.A;case o.h2.JSONView:return X}if(Ke.type===i.fS.geo)return G;if(Ke.type===i.fS.frame){const Ye=Ke.values[0];return(0,r.aY)(Ye)&&(0,g.pP)(Ye)?Z.A:X}return Ke.type===i.fS.other?X:N}function ge(be){return function(Ke,Ye,tt){return Ke.length===0||!tt||!be?Ke:Ke.filter(nt=>{if(!nt.values.hasOwnProperty(Ye))return!1;const Pt=re(nt,be);return tt.find(xt=>xt.value===Pt)!==void 0})}}function ae(be,Ke){if(!Ke||be.length===0)return{};const Ye={};for(let tt=0;tt<be.length;tt++){const nt=re(be[tt],Ke);Ye[nt||"(Blanks)"]=nt}return Ye}function re(be,Ke){if(!Ke||!be)return"";const Ye=Ke.values[be.index],tt=Ke.display?Ke.display(Ye):Ye;return Ke.display?(0,d.zc)(tt):tt}function De(be){return Object.keys(be).reduce((Ke,Ye)=>Ke.concat({value:be[Ye],label:Ye}),[]).sort(he)}function he(be,Ke){return be.label===void 0&&Ke.label===void 0?0:be.label===void 0&&Ke.label!==void 0?-1:be.label!==void 0&&Ke.label===void 0?1:be.label<Ke.label?-1:be.label>Ke.label?1:0}function ye(be,Ke){return Ke?be.filter(Ye=>Ke.some(tt=>tt.value===Ye.value)):[]}function ce(be,Ke,Ye){return String(be.values[Ye]).localeCompare(String(Ke.values[Ye]),void 0,{sensitivity:"base"})}function We(be,Ke,Ye){const tt=ke(be.values[Ye]),nt=ke(Ke.values[Ye]);return tt===nt?0:tt>nt?1:-1}function ke(be){return be==null||be===""||isNaN(be)?Number.NEGATIVE_INFINITY:typeof be=="number"?be:Number(be)}function et(be,Ke,Ye,tt){return Me(be),be.map((nt,Pt)=>{if(nt?.field?.type!==i.fS.number)return Pt===0&&Ye.reducer&&Ye.reducer.length>0?l.TB.get(Ye.reducer[0]).name:void 0;let xt=(0,t.clone)(nt.field);return xt.values=Ke[nt.id],xt.state=void 0,nt.field=xt,Ye.fields&&Ye.fields.length>0?Ye.fields.find(Rt=>Rt===nt?.field?.name)?we(nt.field,Ye.reducer,tt):void 0:we(nt.field,Ye.reducer||[],tt)})}function we(be,Ke,Ye){const tt=be.display??(0,u.U)({field:be,theme:Ye}),nt=Ke[0],Pt=(0,l.Kx)({field:be,reducers:Ke})[nt];return(0,d.zc)(tt(Pt))}function _e(be){const Ke=[];for(const Ye in be)for(const[tt,nt]of Object.entries(be[Ye].values))Ke[tt]===void 0&&(Ke[tt]=[]),Ke[tt].push(nt);return Ke}const Ge={type:o.h2.Auto};function qe(be){return be.config.custom?.displayMode?st(be.config.custom?.displayMode):be.config.custom?.cellOptions?be.config.custom.cellOptions:Ge}function st(be){switch(be){case"basic":case"gradient-gauge":case"lcd-gauge":let Ke=o.QH.Basic;return be==="gradient-gauge"?Ke=o.QH.Gradient:be==="lcd-gauge"&&(Ke=o.QH.Lcd),{type:o.h2.Gauge,mode:Ke};case"color-background":case"color-background-solid":let Ye=o.v7.Basic;return be==="color-background"&&(Ye=o.v7.Gradient),{type:o.h2.ColorBackground,mode:Ye};default:return{type:be}}}function Me(be){const Ke=be.findIndex((Ye,tt)=>Ye?.id!==String(tt));Ke!==-1&&(be.splice(Ke,0,{id:String(Ke)}),Me(be))}},7704:(j,I,e)=>{"use strict";e.d(I,{w:()=>m});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(92827),g=e(66310),d=e(80402),l=e(73453),u=e(60105);class o extends s.PureComponent{constructor(f){super(f),this.readCSV=(0,n.debounce)(()=>{const{config:y}=this.props,{text:v}=this.state;this.setState({data:(0,r.uP)(v,{config:y})})},150),this.onTextChange=y=>{this.setState({text:y.target.value})};const{text:E,config:h}=f;this.state={text:E,data:(0,r.uP)(E,{config:h})}}componentDidUpdate(f,E){const{text:h}=this.state;(h!==E.text||this.props.config!==f.config)&&this.readCSV(),this.props.text!==f.text&&this.props.text!==h&&this.setState({text:this.props.text}),this.state.data!==E.data&&this.props.onSeriesParsed(this.state.data,this.state.text)}render(){const{width:f,height:E,theme:h}=this.props,{data:y}=this.state,v=c(h);return s.createElement("div",{className:v.tableInputCsv},s.createElement(u.K,{style:{width:f,height:E},placeholder:"Enter CSV here...",value:this.state.text,onChange:this.onTextChange,className:v.textarea}),y&&s.createElement("footer",{className:v.footer},y.map((D,a)=>s.createElement("span",{key:a},"Rows:",D.length,", Columns:",D.fields.length," \xA0",s.createElement(l.J,{name:"check-circle"})))))}}const m=(0,g.HE)(o);m.displayName="TableInputCSV";const c=(0,d.B)(p=>({tableInputCsv:(0,t.css)({position:"relative"}),textarea:(0,t.css)({height:"100%",width:"100%"}),footer:(0,t.css)({position:"absolute",bottom:"15px",right:"15px",border:"1px solid #222",background:p.colors.success.main,padding:`1px ${p.spacing(.5)}`,fontSize:"80%"})}))},77122:(j,I,e)=>{"use strict";e.d(I,{A:()=>d});var t=e(42844),n=e(27702),i=e(21609),s=e(80402),r=e(66310);const g=(0,s.B)(l=>({counter:(0,t.css)({label:"counter",marginLeft:l.spacing(1),borderRadius:l.spacing(3),backgroundColor:l.colors.action.hover,padding:l.spacing(.25,1),color:l.colors.text.secondary,fontWeight:l.typography.fontWeightMedium,fontSize:l.typography.size.sm})})),d=({value:l})=>{const u=(0,r.wW)(g);return n.createElement("span",{className:u.counter},(0,i.SP)(l,0).text)}},54281:(j,I,e)=>{"use strict";e.d(I,{O:()=>l});var t=e(42844),n=e(27702),i=e(74639),s=e(66310),r=e(97289),g=e(73453),d=e(77122);const l=n.forwardRef(({label:o,active:m,icon:c,onChangeTab:p,counter:f,suffix:E,className:h,href:y,...v},D)=>{const a=(0,s.wW)(u),C=()=>n.createElement(n.Fragment,null,c&&n.createElement(g.J,{name:c}),o,typeof f=="number"&&n.createElement(d.A,{value:f}),E&&n.createElement(E,{className:a.suffix})),P=(0,t.cx)(a.link,m?a.activeStyle:a.notActive);return n.createElement("div",{className:a.item},n.createElement("a",{href:y||"#",className:P,...v,onClick:p,"aria-label":v["aria-label"]||i.wl.components.Tab.title(o),role:"tab","aria-selected":m,ref:D},C()))});l.displayName="Tab";const u=o=>({item:(0,t.css)({listStyle:"none",position:"relative",display:"flex",whiteSpace:"nowrap"}),link:(0,t.css)({color:o.colors.text.secondary,padding:o.spacing(1.5,2,1),display:"block",height:"100%",svg:{marginRight:o.spacing(1)},"&:focus-visible":(0,r.getFocusStyles)(o),"&::before":{display:"block",content:'" "',position:"absolute",left:0,right:0,height:"4px",borderRadius:o.shape.radius.default,bottom:0}}),notActive:(0,t.css)({"a:hover, &:hover, &:focus":{color:o.colors.text.primary,"&::before":{backgroundColor:o.colors.action.hover}}}),activeStyle:(0,t.css)({label:"activeTabStyle",color:o.colors.text.primary,overflow:"hidden",a:{color:o.colors.text.primary},"&::before":{backgroundImage:o.colors.gradients.brandHorizontal}}),suffix:(0,t.css)({marginLeft:o.spacing(1)})})},4432:(j,I,e)=>{"use strict";e.d(I,{I:()=>g});var t=e(42844),n=e(27702),i=e(80402),s=e(66310);const r=(0,i.B)(d=>({tabContent:(0,t.css)({background:d.colors.background.primary})})),g=({children:d,className:l,...u})=>{const o=(0,s.l4)(),m=r(o);return n.createElement("div",{...u,className:(0,t.cx)(m.tabContent,l)},d)}},15372:(j,I,e)=>{"use strict";e.d(I,{J:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=n.forwardRef(({children:g,className:d,hideBorder:l=!1},u)=>{const o=(0,i.wW)(r);return n.createElement("div",{className:(0,t.cx)(o.tabsWrapper,l&&o.noBorder,d),ref:u},n.createElement("div",{className:o.tabs,role:"tablist"},g))}),r=g=>({tabsWrapper:(0,t.css)({borderBottom:`1px solid ${g.colors.border.weak}`,overflowX:"auto"}),noBorder:(0,t.css)({borderBottom:0}),tabs:(0,t.css)({position:"relative",display:"flex",height:`${g.components.menuTabs.height}px`})});s.displayName="TabsBar"},49050:(j,I,e)=>{"use strict";e.d(I,{L:()=>d});var t=e(42844),n=e(27702),i=e(74639),s=e(66310),r=e(73453),g=e(77122);const d=n.forwardRef(({label:u,active:o,icon:m,counter:c,className:p,suffix:f,onChangeTab:E,href:h,...y},v)=>{const D=(0,s.wW)(l),a=()=>n.createElement(n.Fragment,null,m&&n.createElement(r.J,{name:m}),u,typeof c=="number"&&n.createElement(g.A,{value:c}),f&&n.createElement(f,{className:D.suffix})),C=(0,t.cx)(D.link,o&&D.activeStyle);return n.createElement("a",{href:h,className:C,...y,onClick:E,"aria-label":y["aria-label"]||i.wl.components.Tab.title(u),role:"tab","aria-selected":o,ref:v},a())});d.displayName="Tab";const l=u=>({link:(0,t.css)({padding:"6px 12px",display:"block",height:"100%",cursor:"pointer",position:"relative",color:u.colors.text.primary,svg:{marginRight:u.spacing(1)},"&:hover, &:focus":{textDecoration:"underline"}}),activeStyle:(0,t.css)({label:"activeTabStyle",color:u.colors.text.maxContrast,overflow:"hidden","&::before":{display:"block",content:'" "',position:"absolute",left:0,width:"4px",bottom:"2px",top:"2px",borderRadius:u.shape.radius.default,backgroundImage:"linear-gradient(0deg, #f05a28 30%, #fbca0a 99%)"}}),suffix:(0,t.css)({marginLeft:u.spacing(1)})})},65333:(j,I,e)=>{"use strict";e.d(I,{V:()=>u});var t=e(42844),n=e(27702),i=e(57704),s=e(66310),r=e(64714),g=e(73453);const d=(0,n.forwardRef)(({name:c,onClick:p,icon:f,className:E,colorIndex:h,...y},v)=>{const D=(0,s.l4)(),a=m(D,c,h),C=b=>{b.preventDefault(),b.stopPropagation(),p?.(c,b)},P=(0,t.cx)(a.wrapper,E,{[a.hover]:p!==void 0});return p?n.createElement("button",{...y,className:P,onClick:C,ref:v},f&&n.createElement(g.J,{name:f}),c):n.createElement("span",{...y,className:P,ref:v},f&&n.createElement(g.J,{name:f}),c)});d.displayName="Tag";const u=Object.assign(d,{Skeleton:()=>{const c=(0,s.wW)(o);return n.createElement(i.Z,{width:60,height:22,containerClassName:c.container})}}),o=()=>({container:(0,t.css)({lineHeight:1})}),m=(c,p,f)=>{let E;return f===void 0?E=(0,r.Bx)(p):E=(0,r.vm)(f),{wrapper:(0,t.css)({appearance:"none",borderStyle:"none",fontWeight:c.typography.fontWeightMedium,fontSize:c.typography.size.sm,lineHeight:c.typography.bodySmall.lineHeight,verticalAlign:"baseline",backgroundColor:E.color,color:c.v1.palette.gray98,whiteSpace:"nowrap",textShadow:"none",padding:"3px 6px",borderRadius:c.shape.radius.default}),hover:(0,t.css)({"&:hover":{opacity:.85,cursor:"pointer"}})}}},86004:(j,I,e)=>{"use strict";e.d(I,{P:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(65333);const r=(0,n.memo)((0,n.forwardRef)(({displayMax:o,tags:m,icon:c,onClick:p,className:f,getAriaLabel:E,getColorIndex:h},y)=>{const v=(0,i.l4)(),D=u(v,!!(o&&o>0)),a=m.length,C=o?m.slice(0,o):m;return n.createElement("ul",{className:(0,t.cx)(D.wrapper,f),"aria-label":"Tags",ref:y},C.map((P,b)=>n.createElement("li",{className:D.li,key:P},n.createElement(s.V,{name:P,icon:c,onClick:p,"aria-label":E?.(P,b),"data-tag-id":b,colorIndex:h?.(P,b)}))),o&&o>0&&a-o>0&&n.createElement("span",{className:D.moreTagsLabel},"+ ",a-o))}));r.displayName="TagList";const d=Object.assign(r,{Skeleton:()=>{const o=(0,i.wW)(l);return n.createElement("div",{className:o.container},n.createElement(s.V.Skeleton,null),n.createElement(s.V.Skeleton,null))}}),l=o=>({container:(0,t.css)({display:"flex",gap:o.spacing(1)})}),u=(o,m)=>({wrapper:(0,t.css)({position:"relative",alignItems:m?"center":"unset",display:"flex",flex:"1 1 auto",flexWrap:"wrap",flexShrink:m?0:1,justifyContent:"flex-end",gap:"6px"}),moreTagsLabel:(0,t.css)({color:o.colors.text.secondary,fontSize:o.typography.size.sm}),li:(0,t.css)({listStyle:"none"})})},72699:(j,I,e)=>{"use strict";e.d(I,{B:()=>o});var t=e(42844),n=e(27702),i=e(66310),s=e(66670),r=e(1128),g=e(64714),d=e(67437);const l=({name:c,disabled:p,onRemove:f})=>{const{color:E,borderColor:h}=(0,n.useMemo)(()=>(0,g.Bx)(c),[c]),y=(0,i.wW)(u);return n.createElement("li",{className:y.itemStyle,style:{backgroundColor:E,borderColor:h}},n.createElement("span",{className:y.nameStyle},c),n.createElement(d.h,{name:"times",size:"lg",disabled:p,tooltip:`Remove "${c}" tag`,onClick:()=>f(c),className:y.buttonStyles}))},u=c=>{const p=c.spacing.gridSize*3;return{itemStyle:(0,t.css)({display:"flex",gap:"3px",alignItems:"center",height:`${p}px`,lineHeight:`${p-2}px`,color:"#fff",borderWidth:"1px",borderStyle:"solid",borderRadius:c.shape.radius.default,padding:`0 ${c.spacing(.5)}`,whiteSpace:"nowrap",textShadow:"none",fontWeight:500,fontSize:c.typography.size.sm}),nameStyle:(0,t.css)({maxWidth:"25ch",textOverflow:"ellipsis",overflow:"hidden"}),buttonStyles:(0,t.css)({margin:0,"&:hover::before":{display:"none"}})}},o=({placeholder:c="New tag (enter key to add)",tags:p=[],onChange:f,width:E,className:h,disabled:y,addOnBlur:v,invalid:D,id:a})=>{const[C,P]=(0,n.useState)(""),b=(0,i.wW)(m),M=(0,i.l4)(),T=(0,n.useCallback)(A=>{P(A.target.value)},[]),S=A=>{f(p.filter(V=>V!==A))},x=A=>{A?.preventDefault(),p.includes(C)||f(p.concat(C)),P("")},O=()=>{v&&C&&x()},B=A=>{A.key==="Enter"&&C!==""&&x(A)};return n.createElement("div",{className:(0,t.cx)(b.wrapper,h,E?(0,t.css)({width:M.spacing(E)}):"")},n.createElement(r.I,{id:a,disabled:y,placeholder:c,onChange:T,value:C,onKeyDown:B,onBlur:O,invalid:D,suffix:n.createElement(s.zx,{fill:"text",className:b.addButtonStyle,onClick:x,size:"md",disabled:C.length<=0},"Add")}),p?.length>0&&n.createElement("ul",{className:b.tags},p.map(A=>n.createElement(l,{key:A,name:A,onRemove:S,disabled:y}))))},m=c=>({wrapper:(0,t.css)({minHeight:c.spacing(4),display:"flex",flexDirection:"column",gap:c.spacing(1),flexWrap:"wrap"}),tags:(0,t.css)({display:"flex",justifyContent:"flex-start",flexWrap:"wrap",gap:c.spacing(.5)}),addButtonStyle:(0,t.css)({margin:`0 -${c.spacing(1)}`})})},21323:(j,I,e)=>{"use strict";e.d(I,{x:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(67106);const r=n.forwardRef(({element:d="span",variant:l,weight:u,color:o,truncate:m,italic:c,textAlignment:p,children:f},E)=>{const h=(0,i.wW)((0,n.useCallback)(y=>g(y,d,l,o,u,m,c,p),[o,p,m,c,u,l,d]));return(0,n.createElement)(d,{className:h,ref:E},f)});r.displayName="Text";const g=(d,l,u,o,m,c,p,f)=>(0,t.css)([{margin:0,padding:0,...(0,s.jt)(d,l,u)},u&&{...d.typography[u]},o&&{color:(0,s.Jx)(o,d)},m&&{fontWeight:(0,s.RC)(m,d)},c&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},p&&{fontStyle:"italic"},f&&{textAlign:f}])},67106:(j,I,e)=>{"use strict";e.d(I,{Jx:()=>n,RC:()=>t,jt:()=>i});const t=(s,r)=>{switch(s){case"bold":return r.typography.fontWeightBold;case"medium":return r.typography.fontWeightMedium;case"light":return r.typography.fontWeightLight;case"regular":case void 0:return r.typography.fontWeightRegular}},n=(s,r)=>{switch(s){case"error":return r.colors.error.text;case"success":return r.colors.success.text;case"info":return r.colors.info.text;case"warning":return r.colors.warning.text;default:return s?r.colors.text[s]:void 0}},i=(s,r,g)=>{if(g)return s.typography[g];switch(r){case"span":return;case"h1":return s.typography.h1;case"h2":return s.typography.h2;case"h3":return s.typography.h3;case"h4":return s.typography.h4;case"h5":return s.typography.h5;case"h6":return s.typography.h6;default:return s.typography.body}}},60105:(j,I,e)=>{"use strict";e.d(I,{K:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(80402),r=e(26468);const g=n.forwardRef(({invalid:l,className:u,...o},m)=>{const c=(0,i.l4)(),p=d(c,l);return n.createElement("textarea",{...o,className:(0,t.cx)(p.textarea,u),ref:m})}),d=(0,s.B)((l,u=!1)=>({textarea:(0,t.cx)((0,r.RK)(l),(0,r.GL)(l),(0,t.css)({display:"block",borderRadius:l.shape.borderRadius(),padding:`${l.spacing.gridSize/4}px ${l.spacing.gridSize}px`,width:"100%",borderColor:u?l.colors.error.border:l.components.input.borderColor}))}));g.displayName="TextArea"},25181:(j,I,e)=>{"use strict";e.d(I,{p:()=>B});var t=e(27702),n=e(66310),i=e(18869),s=e(70823),r=e(30797),g=e(89949),d=e(26712),l=e(29241),u=e(21609),o=e(61965),m=e(58192),c=e(93666),p=e(75578),f=e(79248),E=e(84714),h=e(64167),y=e(90537),v=e(19345),D=e(12839),a=e(48473);const C=new Set(["bytes","bits","kbytes","mbytes","gbytes","tbytes","pbytes","binBps","binbps","KiBs","Kibits","MiBs","Mibits","GiBs","Gibits","TiBs","Tibits","PiBs","Pibits"]),P=Array(53);for(let A=0;A<P.length;A++)P[A]=2**A;const b=(A,V=1)=>A==null?"-":A.toFixed(V),M={drawStyle:h.l8.Line,showPoints:h.Jp.Auto,axisPlacement:h.LB.Auto},T=({frame:A,theme:V,timeZones:W,getTimeRange:w,eventBus:N,sync:F,allFrames:k,renderers:H,tweakScale:R=Y=>Y,tweakAxis:_=Y=>Y,eventsScope:G="__global_"})=>{const Y=new v.U(W[0]);let X;Y.setPrepData(he=>(X=he[0],(0,a.Bj)(he[0],Y.getStackingGroups())));const Q=A.fields[0];if(!Q)return Y;const se="x";let Z="_x",le="";const oe=Q.config.custom?.axisPlacement!==h.LB.Hidden?h.LB.Bottom:h.LB.Hidden,q=Q.config.custom?.axisPlacement!==h.LB.Hidden;if(Q.type===l.fS.time){Z="time",Y.addScale({scaleKey:se,orientation:h.wN.Horizontal,direction:h.bQ.Right,isTime:!0,range:()=>{const ye=w();return[ye.from.valueOf(),ye.to.valueOf()]}});const he=W.length>1?(ye,ce)=>ce.map((We,ke)=>ke<2?null:We):void 0;for(let ye=0;ye<W.length;ye++){const ce=W[ye];Y.addAxis({scaleKey:se,isTime:!0,placement:oe,show:q,label:Q.config.custom?.axisLabel,timeZone:ce,theme:V,grid:{show:ye===0&&Q.config.custom?.axisGridShow},filter:he})}W.length>1&&Y.addHook("drawAxes",ye=>{ye.ctx.save(),ye.ctx.fillStyle=V.colors.text.primary,ye.ctx.textAlign="left",ye.ctx.textBaseline="bottom";let ce=0;ye.axes.forEach(We=>{if(We.side===2){let ke=We._pos+We._size;ye.ctx.fillText(W[ce],ye.bbox.left,ke*d.Z.pxRatio),ce++}}),ye.ctx.restore()})}else Q.config.unit&&(Z=Q.config.unit),Y.addScale({scaleKey:se,orientation:h.wN.Horizontal,direction:h.bQ.Right,range:(he,ye,ce)=>[Q.config.min??ye,Q.config.max??ce]}),Y.addAxis({scaleKey:se,placement:oe,show:q,label:Q.config.custom?.axisLabel,theme:V,grid:{show:Q.config.custom?.axisGridShow},formatValue:(he,ye)=>(0,u.zc)(Q.display(he,ye))});let ne=H?.flatMap(he=>Object.values(he.fieldMap).filter(ye=>he.indicesOnly.indexOf(ye)===-1))??[],ge;for(let he=1;he<A.fields.length;he++){const ye=A.fields[he],ce={...ye.config,custom:{...M,...ye.config.custom}},We=ce.custom;if(ye===Q||ye.type!==l.fS.number&&ye.type!==l.fS.enum)continue;let ke=ye.display??b;ye.config.custom?.stacking?.mode===h.o0.Percent&&(ke=(0,o.U)({field:{...ye,config:{...ye.config,unit:"percentunit"}},theme:V}));const et=(0,y.z1)(ce,ye.type),we=(0,m.fD)(ye),Ge=(0,m.YO)(ye,V).color;if(Y.addScale(R({scaleKey:et,orientation:h.wN.Vertical,direction:h.bQ.Up,distribution:We.scaleDistribution?.type,log:We.scaleDistribution?.log,linearThreshold:We.scaleDistribution?.linearThreshold,min:ye.config.min,max:ye.config.max,softMin:We.axisSoftMin,softMax:We.axisSoftMax,centeredZero:We.axisCenteredZero,range:We.stacking?.mode===h.o0.Percent?(tt,nt,Pt)=>(nt=nt<0?-1:0,Pt=Pt>0?1:0,[nt,Pt]):ye.type===l.fS.enum?(tt,nt,Pt)=>[-1,ye.config.type.enum.text.length]:void 0,decimals:ye.config.decimals},ye)),le||(le=et),We.axisPlacement!==h.LB.Hidden){let tt;We.axisColorMode===h.yK.Series&&(we.isByValue&&ye.config.custom?.gradientMode===h.FI.Scheme&&we.id===c.S.Thresholds?tt=(0,D.P2)(1,V,we,ye.config.thresholds):tt=Ge);let nt={};tt&&(nt={border:{show:!0,width:1,stroke:tt},ticks:{stroke:tt},color:We.axisColorMode===h.yK.Series?tt:void 0});let Pt,xt,bt;if(C.has(ce.unit))Pt=P;else if(ye.type===l.fS.enum){let Rt=ye.config.type.enum.text;bt=Rt.map((ct,it)=>it),xt=Rt}Y.addAxis(_({scaleKey:et,label:We.axisLabel,size:We.axisWidth,placement:We.axisPlacement??h.LB.Auto,formatValue:(Rt,ct)=>(0,u.zc)(ke(Rt,ct)),theme:V,grid:{show:We.axisGridShow},decimals:ye.config.decimals,distr:We.scaleDistribution?.type,splits:bt,values:xt,incrs:Pt,...nt},ye))}const qe=We.drawStyle===h.l8.Points?h.Jp.Always:We.showPoints;let st=()=>null;We.spanNulls!==!0&&(st=(tt,nt,Pt,xt)=>{let bt=[],Rt=tt.series[nt];if(!Pt&&xt&&xt.length){const[ct,it]=Rt.idxs,me=tt.data[0],Ee=tt.data[nt],Ce=Math.round(tt.valToPos(me[ct],"x",!0)),Ae=Math.round(tt.valToPos(me[it],"x",!0));xt[0][0]===Ce&&bt.push(ct);for(let ze=0;ze<xt.length;ze++){let Ie=xt[ze],xe=xt[ze+1];if(xe&&Ie[1]===xe[0]){let Te=tt.posToIdx(Ie[1],!0);if(Ee[Te]==null)for(let Oe=1;Oe<100;Oe++){if(Ee[Te+Oe]!=null){Te+=Oe;break}if(Ee[Te-Oe]!=null){Te-=Oe;break}}bt.push(Te)}}xt[xt.length-1][1]===Ae&&bt.push(it)}return bt.length?bt:null});let{fillOpacity:Me}=We,be=null,Ke=null;if(ye.state?.origin){ge||(ge=S(A,k));const tt=k[ye.state.origin.frameIndex],nt=tt?.fields[ye.state.origin.fieldIndex],Pt=(0,p.CZ)(nt??ye,tt,k);if(ne.indexOf(Pt)>=0)be=()=>null,Ke=()=>{};else if(We.transform===h.pR.Constant){const xt=d.Z.paths.linear();be=(bt,Rt)=>{const ct=bt._data,it=w();let me=[it.from.valueOf(),it.to.valueOf()],Ee=ct[Rt].find(ze=>ze!=null),Ce=[Ee,Ee],Ae=ct.slice();return Ae[0]=me,Ae[Rt]=Ce,xt({...bt,_data:Ae},Rt,0,1)}}if(We.fillBelowTo){const xt=A.fields.find(it=>We.fillBelowTo===it.name||We.fillBelowTo===it.config?.displayNameFromDS||We.fillBelowTo===(0,p.CZ)(it,A,k)),bt=xt?(0,p.CZ)(xt,A,k):We.fillBelowTo,Rt=ge.get(Pt),ct=ge.get(bt);(0,g.isNumber)(ct)&&(0,g.isNumber)(Rt)?(Y.addBand({series:[Rt,ct],fill:void 0}),Me||(Me=35)):Me=0}}let Ye;we.id===c.S.Thresholds&&(Ye=tt=>(0,m.YO)(X.fields[tt],V).color),Y.addSeries({pathBuilder:be,pointsBuilder:Ke,scaleKey:et,showPoints:qe,pointsFilter:st,colorMode:we,fillOpacity:Me,theme:V,dynamicSeriesColor:Ye,drawStyle:We.drawStyle,lineColor:We.lineColor??Ge,lineWidth:We.lineWidth,lineInterpolation:We.lineInterpolation,lineStyle:We.lineStyle,barAlignment:We.barAlignment,barWidthFactor:We.barWidthFactor,barMaxWidth:We.barMaxWidth,pointSize:We.pointSize,spanNulls:We.spanNulls||!1,show:!We.hideFrom?.viz,gradientMode:We.gradientMode,thresholds:ce.thresholds,hardMin:ye.config.min,hardMax:ye.config.max,softMin:We.axisSoftMin,softMax:We.axisSoftMax,dataFrameFieldIndex:ye.state?.origin}),We.thresholdsStyle&&ce.thresholds&&(We.thresholdsStyle.mode??h.i3.Off)!==h.i3.Off&&Y.addThresholds({config:We.thresholdsStyle,thresholds:ce.thresholds,scaleKey:et,theme:V,hardMin:ye.config.min,hardMax:ye.config.max,softMin:We.axisSoftMin,softMax:We.axisSoftMax})}let ae=(0,a.i7)(A);Y.setStackingGroups(ae),H?.forEach(he=>{ge||(ge=S(A,k));let ye={};for(let ce in he.fieldMap){let We=he.fieldMap[ce];ye[ce]=ge.get(We)}he.init(Y,ye)}),Y.scaleKeys=[se,le];const re=15;let De={dataIdx:(he,ye,ce,We)=>{let ke=he.data[ye];if(ke[ce]==null){let et=null,we=null,_e;for(_e=ce;et==null&&_e-- >0;)ke[_e]!=null&&(et=_e);for(_e=ce;we==null&&_e++<ke.length;)ke[_e]!=null&&(we=_e);let Ge=he.data[0],qe=he.valToPos(We,"x"),st=we==null?1/0:he.valToPos(Ge[we],"x"),Me=et==null?-1/0:he.valToPos(Ge[et],"x"),be=qe-Me,Ke=st-qe;be<=Ke?be<=re&&(ce=et):Ke<=re&&(ce=we)}return ce}};if(F&&F()!==f.m.Off){const he={point:{[se]:null,[le]:null},data:A},ye=new E.es(he);De.sync={key:G,filters:{pub:(ce,We,ke,et,we,_e,Ge)=>F&&F()===f.m.Off?!1:(he.rowIndex=Ge,ke<0&&et<0?(he.point[Z]=null,he.point[le]=null,N.publish(new E.xH)):(he.point[Z]=We.posToVal(ke,se),he.point[le]=We.posToVal(et,le),he.point.panelRelY=et>0?et/_e:1,N.publish(ye),ye.payload.down=void 0),!0)},scales:[se,le]}}return Y.setSync(),Y.setCursor(De),Y};function S(A,V){const W=new Map;return A.fields.forEach((w,N)=>{const F=w.state?.origin;if(F){const k=V[F.frameIndex]?.fields[F.fieldIndex];k&&W.set((0,p.CZ)(k,V[F.frameIndex],V),N)}}),W}const x=["legend","options","theme"];class O extends t.Component{constructor(){super(...arguments),this.panelContext={},this.prepConfig=(V,W,w)=>{const{eventBus:N,eventsScope:F,sync:k}=this.context,{theme:H,timeZone:R,renderers:_,tweakAxis:G,tweakScale:Y}=this.props;return T({frame:V,theme:H,timeZones:Array.isArray(R)?R:[R],getTimeRange:w,eventBus:N,sync:k,allFrames:W,renderers:_,tweakScale:Y,tweakAxis:G,eventsScope:F})},this.renderLegend=V=>{const{legend:W,frames:w}=this.props;return!V||W&&!W.showLegend||!(0,r.o)(V,w)?null:t.createElement(r.l,{data:w,config:V,...W})}}render(){return t.createElement(i.d,{...this.props,prepConfig:this.prepConfig,propsToDiff:x,renderLegend:this.renderLegend})}}O.contextType=s.bb;const B=(0,n.HE)(O);B.displayName="TimeSeries"},16532:(j,I,e)=>{"use strict";e.d(I,{P:()=>l});var t=e(42844),n=e(27702),i=e(66609),s=e(66310),r=e(5723),g=e(67437),d=e(52995);const l=n.memo(({children:o,theme:m="info",placement:c="auto",content:p,title:f,closeButton:E=!0,onClose:h,footer:y,fitContent:v=!1})=>{const D=(0,s.wW)(u),a=D[m],C=(0,n.useRef)(null),[P,b]=n.useState(!1),M=(0,n.useCallback)(()=>{b(!1),h?.()},[h]);(0,n.useEffect)(()=>{if(P){const V=W=>{W.key==="Escape"&&M()};return document.addEventListener("keydown",V),()=>{document.removeEventListener("keydown",V)}}},[P,M]);const{getArrowProps:T,getTooltipProps:S,setTooltipRef:x,setTriggerRef:O,visible:B,update:A}=(0,i.O)({visible:P,placement:c,interactive:!0,offset:[0,8],trigger:"click",onVisibleChange:V=>{b(V),V||h?.()}});return n.createElement(n.Fragment,null,n.cloneElement(o,{ref:O,tabIndex:0}),B&&n.createElement(d.h_,null,n.createElement("div",{"data-testid":"toggletip-content",ref:x,...S({className:(0,t.cx)(a.container,v&&D.fitContent)})},!!f&&n.createElement("div",{className:a.header},f),E&&n.createElement("div",{className:a.headerClose},n.createElement(g.h,{tooltip:"Close",name:"times","data-testid":"toggletip-header-close",onClick:M})),n.createElement("div",{ref:C,...T({className:a.arrow})}),n.createElement("div",{className:a.body},(typeof p=="string"||n.isValidElement(p))&&p,typeof p=="function"&&A&&p({update:A})),!!y&&n.createElement("div",{className:a.footer},y))))});l.displayName="Toggletip";const u=o=>{const m=(0,r.k)(o,o.components.tooltip.background,o.components.tooltip.background,o.components.tooltip.text,{topBottom:3,rightLeft:3}),c=(0,r.k)(o,o.colors.error.main,o.colors.error.main,o.colors.error.contrastText,{topBottom:3,rightLeft:3});return{info:m,error:c,fitContent:(0,t.css)({maxWidth:"fit-content"})}}},30973:(j,I,e)=>{"use strict";e.d(I,{h:()=>o});var t=e(42844),n=e(27702),i=e(8553),s=e(74639),r=e(66310),g=e(97289),d=e(66670),l=e(73453),u=e(80011);const o=(0,n.forwardRef)(({tooltip:f,icon:E,iconSize:h,className:y,children:v,imgSrc:D,imgAlt:a,fullWidth:C,isOpen:P,narrow:b,variant:M="default",iconOnly:T,"aria-label":S,isHighlighted:x,...O},B)=>{const A=(0,r.wW)(p),V=(0,t.cx)({[A.button]:!0,[A.buttonFullWidth]:C,[A.narrow]:b},A[M],y),W=(0,t.cx)({[A.content]:!0,[A.contentWithIcon]:!!E,[A.contentWithRightIcon]:P!==void 0}),w=n.createElement("button",{ref:B,className:V,"aria-label":m(S,f),"aria-expanded":P,...O},c(E,h),D&&n.createElement("img",{className:A.img,src:D,alt:a??""}),v&&!T&&n.createElement("div",{className:W},v),P===!1&&n.createElement(l.J,{name:"angle-down"}),P===!0&&n.createElement(l.J,{name:"angle-up"}),x&&n.createElement("div",{className:A.highlight}));return f?n.createElement(u.u,{content:f,placement:"bottom"},w):w});o.displayName="ToolbarButton";function m(f,E){return f||(E?s.wl.components.PageToolbar.item(E):void 0)}function c(f,E){return f?(0,i.Mo)(f)?n.createElement(l.J,{name:f,size:`${E||"lg"}`}):f:null}const p=f=>{const E=(0,d.c9)(f,"primary","solid"),h=(0,d.c9)(f,"destructive","solid"),y=(0,t.css)({color:f.colors.text.primary,background:f.colors.secondary.main,"&:hover":{color:f.colors.text.primary,background:f.colors.secondary.shade,border:`1px solid ${f.colors.border.medium}`}});return{button:(0,t.css)({label:"toolbar-button",position:"relative",display:"flex",alignItems:"center",height:f.spacing(f.components.height.md),padding:f.spacing(0,1),borderRadius:f.shape.borderRadius(),lineHeight:`${f.components.height.md*f.spacing.gridSize-2}px`,fontWeight:f.typography.fontWeightMedium,border:`1px solid ${f.colors.secondary.border}`,whiteSpace:"nowrap",transition:f.transitions.create(["background","box-shadow","border-color","color"],{duration:f.transitions.duration.short}),"&:focus, &:focus-visible":{...(0,g.getFocusStyles)(f),zIndex:1},"&:focus:not(:focus-visible)":(0,g.getMouseFocusStyles)(f),"&:hover":{boxShadow:f.shadows.z1},"&[disabled], &:disabled":{cursor:"not-allowed",opacity:f.colors.action.disabledOpacity,background:f.colors.action.disabledBackground,boxShadow:"none","&:hover":{color:f.colors.text.disabled,background:f.colors.action.disabledBackground,boxShadow:"none"}}}),default:(0,t.css)({color:f.colors.text.secondary,background:"transparent",border:"1px solid transparent","&:hover":{color:f.colors.text.primary,background:f.colors.background.secondary}}),canvas:y,active:(0,t.cx)(y,(0,t.css)({"&::before":{display:"block",content:'" "',position:"absolute",left:0,right:0,height:"2px",bottom:0,borderRadius:f.shape.radius.default,backgroundImage:f.colors.gradients.brandHorizontal}})),primary:(0,t.css)(E),destructive:(0,t.css)(h),narrow:(0,t.css)({padding:f.spacing(0,.5)}),img:(0,t.css)({width:"16px",height:"16px",marginRight:f.spacing(1)}),buttonFullWidth:(0,t.css)({flexGrow:1}),content:(0,t.css)({flexGrow:1}),contentWithIcon:(0,t.css)({display:"none",paddingLeft:f.spacing(1),[`@media ${g.mediaUp(f.v1.breakpoints.md)}`]:{display:"block"}}),contentWithRightIcon:(0,t.css)({paddingRight:f.spacing(.5)}),highlight:(0,t.css)({backgroundColor:f.colors.success.main,borderRadius:f.shape.radius.circle,width:"6px",height:"6px",position:"absolute",top:"-3px",right:"-3px",zIndex:1})}}},84693:(j,I,e)=>{"use strict";e.d(I,{R:()=>u});var t=e(42844),n=e(45809),i=e(91546),s=e(6714),r=e(27702),g=e(66310),d=e(52995),l=e(30973);const u=(0,r.forwardRef)(({alignment:m="left",className:c,children:p,...f},E)=>{const h=r.Children.toArray(p).filter(B=>B!=null),[y,v]=(0,r.useState)(Array(h.length).fill(!1)),D=(0,r.useRef)(null),[a,C]=(0,r.useState)(!1),P=(0,r.useRef)(null),b=(0,r.createRef)(),{overlayProps:M}=(0,s.Ir)({onClose:()=>C(!1),isDismissable:!0,isOpen:a,shouldCloseOnInteractOutside:B=>{const A=(0,d.RN)();return!P.current?.contains(B)&&!A.contains(B)}},b),{dialogProps:T}=(0,n.R)({},b),S=(0,g.l4)(),x=m==="left"?y.indexOf(!1)-1:y.length,O=o(S,x,m);return(0,r.useLayoutEffect)(()=>{const B=new IntersectionObserver(A=>{A.forEach(V=>{if(V.target instanceof HTMLElement&&V.target.parentNode){const W=Array.prototype.indexOf.call(V.target.parentNode.children,V.target);v(w=>{const N=[...w];return N[W]=V.isIntersecting,N})}})},{threshold:1,root:D.current});return D.current&&Array.from(D.current.children).forEach(A=>{A instanceof HTMLElement&&A!==P.current&&B.observe(A)}),()=>B.disconnect()},[p]),r.createElement("div",{ref:D,className:(0,t.cx)(O.container,c),...f},h.map((B,A)=>r.createElement("div",{key:A,style:{order:A,visibility:y[A]?"visible":"hidden"},className:O.childWrapper},B)),y.includes(!1)&&r.createElement("div",{ref:P,className:O.overflowButton},r.createElement(l.h,{variant:a?"active":"default",tooltip:"Show more items",onClick:()=>C(!a),icon:"ellipsis-v",iconOnly:!0,narrow:!0}),a&&r.createElement(i.MT,{contain:!0,autoFocus:!0},r.createElement("div",{className:O.overflowItems,ref:b,...M,...T},h.map((B,A)=>!y[A]&&B)))))});u.displayName="ToolbarButtonRow";const o=(m,c,p)=>({overflowButton:(0,t.css)({order:c}),overflowItems:(0,t.css)({alignItems:"center",backgroundColor:m.colors.background.primary,borderRadius:m.shape.borderRadius(),boxShadow:m.shadows.z3,display:"flex",flexWrap:"wrap",gap:m.spacing(1),marginTop:m.spacing(1),maxWidth:"80vw",padding:m.spacing(.5,1),position:"absolute",right:0,top:"100%",width:"max-content",zIndex:m.zIndex.sidemenu}),container:(0,t.css)({alignItems:"center",display:"flex",gap:m.spacing(1),justifyContent:p==="left"?"flex-start":"flex-end",minWidth:0,position:"relative"}),childWrapper:(0,t.css)({alignItems:"center",display:"flex",gap:m.spacing(1)})})},71235:(j,I,e)=>{"use strict";e.d(I,{J:()=>l});var t=e(27702),n=e(7734),i=e(7965),s=e(39330),r=e(52995);const g={transitionProperty:"opacity",transitionDuration:"200ms",transitionTimingFunction:"linear",opacity:0},d={exited:{opacity:0},entering:{opacity:0},entered:{opacity:1,transitionDelay:"0s"},exiting:{opacity:0,transitionDelay:"500ms"}};class l extends t.PureComponent{render(){const{content:o,show:m,placement:c,className:p,wrapperClassName:f,renderArrow:E,referenceElement:h,...y}=this.props;return t.createElement(n.dK,null,t.createElement(s.ZP,{in:m,timeout:100,mountOnEnter:!0,unmountOnExit:!0},v=>t.createElement(r.h_,null,t.createElement(i.r,{placement:c,referenceElement:h,modifiers:[{name:"preventOverflow",enabled:!0,options:{rootBoundary:"viewport"}},{name:"eventListeners",options:{scroll:!0,resize:!0}}]},({ref:D,style:a,placement:C,arrowProps:P,update:b})=>t.createElement("div",{ref:D,style:{...a,...g,...d[v]},"data-placement":C,className:`${f}`,...y},t.createElement("div",{className:p},typeof o=="string"&&o,t.isValidElement(o)&&t.cloneElement(o),typeof o=="function"&&o({updatePopperPosition:b}),E&&E({arrowProps:P,placement:C})))))))}}},75965:(j,I,e)=>{"use strict";e.d(I,{D:()=>n});var t=e(27702);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:s,content:r,placement:g="auto"}=this.props,{show:d}=this.state;return s(this.showPopper,this.hidePopper,{show:d,placement:g,content:r})}}},80011:(j,I,e)=>{"use strict";e.d(I,{u:()=>g});var t=e(27702),n=e(66609),i=e(66310),s=e(5723),r=e(52995);const g=t.forwardRef(({children:l,theme:u,interactive:o,show:m,placement:c,content:p},f)=>{const[E,h]=t.useState(m);(0,t.useEffect)(()=>{if(E!==!1){const S=x=>{x.key==="Escape"&&h(!1)};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}}else return},[E]);const{getArrowProps:y,getTooltipProps:v,setTooltipRef:D,setTriggerRef:a,visible:C,update:P}=(0,n.O)({visible:m??E,placement:c,interactive:o,delayHide:o?100:0,delayShow:150,offset:[0,8],trigger:["hover","focus"],onVisibleChange:h}),M=(0,i.wW)(d)[u??"info"],T=(0,t.useCallback)(S=>{a(S),typeof f=="function"?f(S):f&&(f.current=S)},[f,a]);return t.createElement(t.Fragment,null,t.cloneElement(l,{ref:T,tabIndex:0}),C&&t.createElement(r.h_,null,t.createElement("div",{ref:D,...v({className:M.container})},t.createElement("div",{...y({className:M.arrow})}),typeof p=="string"&&p,t.isValidElement(p)&&t.cloneElement(p),typeof p=="function"&&P&&p({updatePopperPosition:P}))))});g.displayName="Tooltip";const d=l=>{const u=(0,s.k)(l,l.components.tooltip.background,l.components.tooltip.background,l.components.tooltip.text,{topBottom:.5,rightLeft:1}),o=(0,s.k)(l,l.colors.error.main,l.colors.error.main,l.colors.error.contrastText,{topBottom:.5,rightLeft:1});return{info:u,["info-alt"]:u,error:o}}},77709:(j,I,e)=>{"use strict";e.d(I,{H:()=>i});var t=e(27702);function n(s,r){const g=[];return s.forEach(d=>{g.push(d.start,d.end+1)}),g[0]!==0&&g.unshift(0),g[g.length-1]!==r&&g.push(r),g}const i=s=>{let{highlightParts:r,text:g,highlightClassName:d}=s;if(!r?.length)return null;let l=[],u=n(r,g.length),o=r[0].start===0;for(let m=1;m<u.length;m++){let c=u[m-1],p=u[m];l.push((0,t.createElement)(o?"mark":"span",{key:m-1,className:o?d:void 0},g.substring(c,p))),o=!o}return t.createElement("div",null,l)}},62916:(j,I,e)=>{"use strict";e.d(I,{n:()=>r});var t=e(27702),n=e(21609),i=e(97560);function s(g){return`Custom unit: ${g}`}class r extends t.PureComponent{constructor(){super(...arguments),this.onChange=d=>{this.props.onChange(d.value)}}render(){const{value:d,width:l}=this.props;let u;const m=(0,n.QW)().map(c=>{const p=c.submenu.map(f=>{const E={label:f.text,value:f.value};return f.value===d&&(u=E),E});return{label:c.text,value:c.text,items:p}});return d&&!u&&(u={value:d,label:d}),t.createElement(i.v,{width:l,initialValue:u&&u.label,allowCustomValue:!0,changeOnSelect:!1,formatCreateLabel:s,options:m,placeholder:"Choose",onSelect:this.props.onChange})}}},30678:(j,I,e)=>{"use strict";e.d(I,{t:()=>l});var t=e(42844),n=e(27702),i=e(99633),s=e(66310),r=e(80011);const g=m=>{const p=(0,i.CQ)(m).diff((0,i.CQ)(),"hours",!1);return`Active last ${(Math.floor(-p/24)+1)*24}h`},d=m=>{if(!m)return"";const[c,p]=m.split(" ");return`${c?.[0]??""}${p?.[0]??""}`.toUpperCase()},l=({userView:m,className:c,children:p,onClick:f,showTooltip:E=!0})=>{const{user:h,lastActiveAt:y}=m,v=(0,i.CQ)(y).diff((0,i.CQ)(),"minutes",!0)>=-15,D=(0,s.l4)(),a=(0,n.useMemo)(()=>o(D,v),[D,v]),C=n.createElement("button",{type:"button",onClick:f,className:(0,t.cx)(a.container,f&&a.pointer,c),"aria-label":`${h.name} icon`},p?n.createElement("div",{className:(0,t.cx)(a.content,a.textContent)},p):h.avatarUrl?n.createElement("img",{className:a.content,src:h.avatarUrl,alt:`${h.name} avatar`}):n.createElement("div",{className:(0,t.cx)(a.content,a.textContent)},d(h.name)));if(E){const P=n.createElement("div",{className:a.tooltipContainer},n.createElement("div",{className:a.tooltipName},h.name),n.createElement("div",{className:a.tooltipDate},v?n.createElement("div",{className:a.dotContainer},n.createElement("span",null,"Active last 15m"),n.createElement("span",{className:a.dot})):g(y)));return n.createElement(r.u,{content:P},C)}else return C},u=m=>`0 0 0 1px ${m}`,o=(m,c)=>{const p=c?m.colors.primary.main:m.colors.border.medium,f=c?m.colors.primary.text:m.colors.border.strong;return{container:(0,t.css)({padding:0,width:"30px",height:"30px",background:"none",border:"none",borderRadius:m.shape.radius.circle,"& > *":{borderRadius:m.shape.radius.circle}}),content:(0,t.css)({lineHeight:"24px",maxWidth:"100%",border:`3px ${m.colors.background.primary} solid`,boxShadow:u(p),backgroundClip:"padding-box","&:hover":{boxShadow:u(f)}}),textContent:(0,t.css)({background:m.colors.background.primary,padding:0,color:m.colors.text.secondary,textAlign:"center",fontSize:m.typography.size.sm,"&:focus":{boxShadow:u(p)}}),tooltipContainer:(0,t.css)({textAlign:"center",padding:m.spacing(0,1)}),tooltipName:(0,t.css)({fontWeight:m.typography.fontWeightBold}),tooltipDate:(0,t.css)({fontWeight:m.typography.fontWeightRegular}),dotContainer:(0,t.css)({display:"flex",alignItems:"center"}),dot:(0,t.css)({height:"6px",width:"6px",backgroundColor:m.colors.primary.main,borderRadius:m.shape.radius.circle,display:"inline-block",marginLeft:m.spacing(1)}),pointer:(0,t.css)({cursor:"pointer"})}}},73990:(j,I,e)=>{"use strict";e.d(I,{b:()=>g});var t=e(27702),n=e(74639),i=e(66310),s=e(66670),r=e(28580);function g({"aria-label":d,label:l,icon:u,options:o,onChange:m,variant:c,minWidth:p=16,size:f="sm",isFullWidth:E=!0,menuPlacement:h,fill:y,buttonCss:v}){const[D,a]=(0,t.useState)(!1),C=(0,i.l4)();return t.createElement(t.Fragment,null,!D&&t.createElement(s.zx,{size:f||"sm",className:v,icon:u||"plus",onClick:()=>a(!0),variant:c,fill:y,fullWidth:E,"aria-label":n.wl.components.ValuePicker.button(d??l)},l),D&&t.createElement("span",{style:{minWidth:C.spacing(p),flexGrow:E?1:void 0}},t.createElement(r.Ph,{placeholder:l,options:o,"aria-label":n.wl.components.ValuePicker.select(d??l),isOpen:!0,onCloseMenu:()=>a(!1),autoFocus:!0,onChange:P=>{a(!1),m(P)},menuPlacement:h})))}},34072:(j,I,e)=>{"use strict";e.d(I,{AY:()=>d});var t=e(42844),n=e(27702),i=e(96284),s=e(66310),r=e(97289),g=e(29372);const d=({width:o,height:m,legend:c,children:p})=>{const f=(0,s.l4)(),E=(0,s.wW)(l),h={display:"flex",width:`${o}px`,height:`${m}px`},[y,v]=(0,i.Z)();if(!c)return n.createElement(n.Fragment,null,n.createElement("div",{style:h,className:E.viz},p(o,m)));let{placement:D,maxHeight:a="35%",maxWidth:C="60%"}=c.props;document.body.clientWidth<f.breakpoints.values.lg&&(D="bottom");let P=null;const b={};switch(D){case"bottom":h.flexDirection="column",b.maxHeight=a,v.height&&(P={width:o,height:m-v.height});break;case"right":h.flexDirection="row",b.maxWidth=C,v.width&&(P={width:o-v.width,height:m}),c.props.width&&(b.width=c.props.width,P={width:o-c.props.width,height:m});break}return P?.width===0&&(P.width=o),P?.height===0&&(P.height=m),n.createElement("div",{style:h},n.createElement("div",{className:E.viz},P&&p(P.width,P.height)),n.createElement("div",{style:b,ref:y},n.createElement(g.$,{hideHorizontalTrack:!0},c)))},l=o=>({viz:(0,t.css)({flexGrow:2,borderRadius:o.shape.borderRadius(1),"&:focus-visible":(0,r.getFocusStyles)(o)})}),u=({children:o})=>n.createElement(n.Fragment,null,o);d.Legend=u},31297:(j,I,e)=>{"use strict";e.d(I,{F:()=>r});var t=e(42844),n=e(27702),i=e(58192),s=e(66310);const r=n.memo(n.forwardRef(({color:d,className:l,gradient:u,...o},m)=>{const c=(0,s.l4)(),p=(0,s.wW)(g);let f;if(u){const h=i.WO.get(u).getColors?.(c);h?.length?f=`linear-gradient(90deg, ${h.join(", ")})`:f=c.visualization.getColorByName("")}else f=d;const E={background:f,width:"14px",height:"4px",borderRadius:c.shape.radius.pill,display:"inline-block",marginRight:"8px"};return n.createElement("div",{"data-testid":"series-icon",ref:m,className:(0,t.cx)(l,p.forcedColors),style:E,...o})})),g=()=>({forcedColors:(0,t.css)({"@media (forced-colors: active)":{forcedColorAdjust:"none"}})});r.displayName="SeriesIcon"},71982:(j,I,e)=>{"use strict";e.d(I,{l:()=>M});var t=e(27702),n=e(84714),i=e(64167),s=e(70823),r=e(76761),g=e(42844),d=e(66310),l=e(71573),u=e(59390),o=e(11141);const m=({items:T,itemRenderer:S,onLabelMouseOver:x,onLabelMouseOut:O,onLabelClick:B,placement:A,className:V,readonly:W})=>{const w=(0,d.wW)(c);S||(S=F=>t.createElement(o.e,{item:F,onLabelClick:B,onLabelMouseOver:x,onLabelMouseOut:O,readonly:W}));const N=F=>`${F.getItemKey?F.getItemKey():F.label}`;switch(A){case"right":{const F=(k,H)=>t.createElement("span",{className:w.itemRight},S(k,H));return t.createElement("div",{className:(0,g.cx)(w.rightWrapper,V)},t.createElement(u.a,{items:T,renderItem:F,getItemKey:N}))}case"bottom":default:{const F=(k,H)=>t.createElement("span",{className:w.itemBottom},S(k,H));return t.createElement("div",{className:(0,g.cx)(w.bottomWrapper,V)},t.createElement("div",{className:w.section},t.createElement(l.Y,{items:T.filter(k=>k.yAxis===1),renderItem:F,getItemKey:N})),t.createElement("div",{className:(0,g.cx)(w.section,w.sectionRight)},t.createElement(l.Y,{items:T.filter(k=>k.yAxis!==1),renderItem:F,getItemKey:N})))}}};m.displayName="VizLegendList";const c=T=>{const S=(0,g.css)({paddingRight:"10px",display:"flex",fontSize:T.typography.bodySmall.fontSize,whiteSpace:"nowrap"});return{itemBottom:S,itemRight:(0,g.cx)(S,(0,g.css)({marginBottom:T.spacing(.5)})),rightWrapper:(0,g.css)({paddingLeft:T.spacing(.5)}),bottomWrapper:(0,g.css)({display:"flex",flexWrap:"wrap",justifyContent:"space-between",width:"100%",paddingLeft:T.spacing(.5)}),section:(0,g.css)({display:"flex"}),sectionRight:(0,g.css)({justifyContent:"flex-end",flexGrow:1})}};var p=e(89949),f=e(73453),E=e(21609),h=e(97289),y=e(60500);const v=({item:T,onLabelClick:S,onLabelMouseOver:x,onLabelMouseOut:O,className:B,readonly:A})=>{const V=(0,d.wW)(D),W=(0,t.useCallback)(F=>{x&&x(T,F)},[T,x]),w=(0,t.useCallback)(F=>{O&&O(T,F)},[T,O]),N=(0,t.useCallback)(F=>{S&&S(T,F)},[T,S]);return t.createElement("tr",{className:(0,g.cx)(V.row,B)},t.createElement("td",null,t.createElement("span",{className:V.itemWrapper},t.createElement(y.i,{color:T.color,seriesName:T.label,readonly:A}),t.createElement("button",{disabled:A,type:"button",title:T.label,onBlur:w,onFocus:W,onMouseOver:W,onMouseOut:w,onClick:A?void 0:N,className:(0,g.cx)(V.label,T.disabled&&V.labelDisabled)},T.label," ",T.yAxis===2&&t.createElement("span",{className:V.yAxisLabel},"(right y-axis)")))),T.getDisplayValues&&T.getDisplayValues().map((F,k)=>t.createElement("td",{className:V.value,key:`${F.title}-${k}`},(0,E.zc)(F))))};v.displayName="LegendTableItem";const D=T=>{const S=h.hoverColor(T.colors.background.primary,T);return{row:(0,g.css)({label:"LegendRow",fontSize:T.v1.typography.size.sm,borderBottom:`1px solid ${T.colors.border.weak}`,td:{padding:T.spacing(.25,1),whiteSpace:"nowrap"},"&:hover":{background:S}}),label:(0,g.css)({label:"LegendLabel",whiteSpace:"nowrap",background:"none",border:"none",fontSize:"inherit",padding:0,maxWidth:"600px",textOverflow:"ellipsis",overflow:"hidden"}),labelDisabled:(0,g.css)({label:"LegendLabelDisabled",color:T.colors.text.disabled}),itemWrapper:(0,g.css)({display:"flex",whiteSpace:"nowrap",alignItems:"center"}),value:(0,g.css)({textAlign:"right"}),yAxisLabel:(0,g.css)({color:T.colors.text.secondary})}},a=({items:T,sortBy:S,sortDesc:x,itemRenderer:O,className:B,onToggleSort:A,onLabelClick:V,onLabelMouseOver:W,onLabelMouseOut:w,readonly:N,isSortable:F})=>{const k=(0,d.wW)(C),H={},R="Name";F&&(H[R]={description:"name",numeric:0,text:""});for(const G of T)if(G.getDisplayValues)for(const Y of G.getDisplayValues())H[Y.title??"?"]=Y;const _=S?(0,p.orderBy)(T,G=>{if(S===R)return G.label;if(G.getDisplayValues){const Y=G.getDisplayValues().filter(X=>X.title===S)[0];return Y&&Y.numeric}},x?"desc":"asc"):T;return O||(O=(G,Y)=>t.createElement(v,{key:`${G.label}-${Y}`,item:G,onLabelClick:V,onLabelMouseOver:W,onLabelMouseOut:w,readonly:N})),t.createElement("table",{className:(0,g.cx)(k.table,B)},t.createElement("thead",null,t.createElement("tr",null,!F&&t.createElement("th",null),Object.keys(H).map(G=>{const Y=H[G];return t.createElement("th",{title:Y.description,key:G,className:(0,g.cx)(k.header,A&&k.headerSortable,F&&k.nameHeader,{[k.withIcon]:S===G}),onClick:()=>{A&&A(G)}},G,S===G&&t.createElement(f.J,{size:"xs",name:x?"angle-down":"angle-up"}))}))),t.createElement("tbody",null,_.map(O)))},C=T=>({table:(0,g.css)({width:"100%","th:first-child":{width:"100%",borderBottom:`1px solid ${T.colors.border.weak}`}}),header:(0,g.css)({color:T.colors.primary.text,fontWeight:T.typography.fontWeightMedium,borderBottom:`1px solid ${T.colors.border.weak}`,padding:T.spacing(.25,1,.25,1),fontSize:T.typography.bodySmall.fontSize,textAlign:"right",whiteSpace:"nowrap"}),nameHeader:(0,g.css)({textAlign:"left",paddingLeft:"30px"}),withIcon:(0,g.css)({paddingRight:"4px"}),headerSortable:(0,g.css)({cursor:"pointer"})});var P=e(43765);function b(T){return T.ctrlKey||T.metaKey||T.shiftKey?r.R.AppendToSelection:r.R.ToggleSelection}function M({items:T,displayMode:S,sortBy:x,seriesVisibilityChangeBehavior:O=P.Y.Isolate,sortDesc:B,onLabelClick:A,onToggleSort:V,placement:W,className:w,itemRenderer:N,readonly:F,isSortable:k}){const{eventBus:H,onToggleSeriesVisibility:R,onToggleLegendSort:_}=(0,s.R9)(),G=(0,t.useCallback)((Q,se)=>{H?.publish({type:n.es.type,payload:{raw:se,x:0,y:0,dataId:Q.label}})},[H]),Y=(0,t.useCallback)((Q,se)=>{H?.publish({type:n.xH.type,payload:{raw:se,x:0,y:0,dataId:Q.label}})},[H]),X=(0,t.useCallback)((Q,se)=>{A&&A(Q,se),R&&R(Q.label,O===P.Y.Hide?r.R.AppendToSelection:b(se))},[R,A,O]);switch(S){case i.jK.Table:return t.createElement(a,{className:w,items:T,placement:W,sortBy:x,sortDesc:B,onLabelClick:X,onToggleSort:V||_,onLabelMouseOver:G,onLabelMouseOut:Y,itemRenderer:N,readonly:F,isSortable:k});case i.jK.List:return t.createElement(m,{className:w,items:T,placement:W,onLabelMouseOver:G,onLabelMouseOut:Y,onLabelClick:X,itemRenderer:N,readonly:F});default:return null}}M.displayName="VizLegend"},11141:(j,I,e)=>{"use strict";e.d(I,{e:()=>m});var t=e(42844),n=e(27702),i=e(74639),s=e(66310),r=e(60500),g=e(89949),d=e(21609),l=e(71573);const u=({stats:p})=>{const f=(0,s.wW)(o);return p.length===0?null:n.createElement(l.Y,{className:f.list,items:p,renderItem:E=>n.createElement("div",{className:f.item,title:E.description},E.title&&`${(0,g.capitalize)(E.title)}:`," ",(0,d.zc)(E))})},o=()=>({list:(0,t.css)({flexGrow:1,textAlign:"right"}),item:(0,t.css)({marginLeft:"8px"})});u.displayName="VizLegendStatsList";const m=({item:p,onLabelClick:f,onLabelMouseOver:E,onLabelMouseOut:h,className:y,readonly:v})=>{const D=(0,s.wW)(c),a=(0,n.useCallback)(b=>{E&&E(p,b)},[p,E]),C=(0,n.useCallback)(b=>{h&&h(p,b)},[p,h]),P=(0,n.useCallback)(b=>{f&&f(p,b)},[p,f]);return n.createElement("div",{className:(0,t.cx)(D.itemWrapper,p.disabled&&D.itemDisabled,y),"aria-label":i.wl.components.VizLegend.seriesName(p.label)},n.createElement(r.i,{seriesName:p.label,color:p.color,gradient:p.gradient,readonly:v}),n.createElement("button",{disabled:v,type:"button",title:p.label,onBlur:C,onFocus:a,onMouseOver:a,onMouseOut:C,onClick:P,className:D.label},p.label),p.getDisplayValues&&n.createElement(u,{stats:p.getDisplayValues()}))};m.displayName="VizLegendListItem";const c=p=>({label:(0,t.css)({label:"LegendLabel",whiteSpace:"nowrap",background:"none",border:"none",fontSize:"inherit",padding:0,userSelect:"text",maxWidth:"600px",textOverflow:"ellipsis",overflow:"hidden"}),itemDisabled:(0,t.css)({label:"LegendLabelDisabled",color:p.colors.text.disabled}),itemWrapper:(0,t.css)({label:"LegendItemWrapper",display:"flex",whiteSpace:"nowrap",alignItems:"center",flexGrow:1}),value:(0,t.css)({textAlign:"right"}),yAxisLabel:(0,t.css)({color:p.v1.palette.gray2})})},60500:(j,I,e)=>{"use strict";e.d(I,{i:()=>r});var t=e(27702),n=e(56025),i=e(70823),s=e(31297);const r=t.memo(({seriesName:g,color:d,gradient:l,readonly:u})=>{const{onSeriesColorChange:o}=(0,i.R9)(),m=(0,t.useCallback)(c=>o(g,c),[g,o]);return g&&o&&d&&!u?t.createElement(n.sp,{color:d,onChange:m,enableNamedColors:!0},({ref:c,showColorPicker:p,hideColorPicker:f})=>t.createElement(s.F,{color:d,className:"pointer",ref:c,onClick:p,onMouseLeave:f})):t.createElement(s.F,{color:d,gradient:l})});r.displayName="VizLegendSeriesIcon"},43765:(j,I,e)=>{"use strict";e.d(I,{Y:()=>t});var t=(n=>(n[n.Isolate=0]="Isolate",n[n.Hide=1]="Hide",n))(t||{})},44201:(j,I,e)=>{"use strict";e.d(I,{Q:()=>r});var t=e(27702),n=e(90482);const i=(d,l,u,o)=>{const m=s(d,l,o),c=s(l,d,o),p=Math.max(m,c);let f=Math.floor(d/p),E=Math.ceil(o/f);f=Math.ceil(o/E);const h=f-(f*E-o),y=d/h-u+u/h;return{width:d/f-u+u/f,height:l/E-u+u/E,widthOnLastRow:y,xCount:f,yCount:E}};function s(d,l,u){const o=Math.ceil(Math.sqrt(u*d/l));return Math.floor(o*l/d)*o<u?l/Math.ceil(o*l/d):d/o}class r extends t.PureComponent{constructor(l){super(l),this.state={values:l.getValues()}}componentDidUpdate(l){const{renderCounter:u,source:o}=this.props;(u!==l.renderCounter||o!==l.source)&&this.setState({values:this.props.getValues()})}getOrientation(){const{orientation:l,width:u,height:o}=this.props;return l===n.wm.Auto?u>o?n.wm.Vertical:n.wm.Horizontal:l}renderGrid(){const{renderValue:l,height:u,width:o,itemSpacing:m,getAlignmentFactors:c,orientation:p}=this.props,{values:f}=this.state,E=i(o,u,m,f.length),h=c?c(f,E.width,E.height):{};let y=0,v=0,D=[];for(let a=0;a<f.length;a++){const C=f[a],b=v===E.yCount-1?E.widthOnLastRow:E.width,M=E.height,T=y*b+m*y,S=v*M+m*v,x={position:"absolute",left:T,top:S,width:`${b}px`,height:`${M}px`};D.push(t.createElement("div",{key:a,style:x},l({value:C,width:b,height:M,alignmentFactors:h,orientation:p,count:f.length}))),y++,y===E.xCount&&(y=0,v++)}return t.createElement("div",{style:{position:"relative"}},D)}render(){const{renderValue:l,height:u,width:o,itemSpacing:m,getAlignmentFactors:c,autoGrid:p,orientation:f,minVizWidth:E,minVizHeight:h}=this.props,{values:y}=this.state;if(p&&f===n.wm.Auto)return this.renderGrid();const v={display:"flex"},D={display:"flex",overflow:`${E?"auto":"hidden"} ${h?"auto":"hidden"}`};let a=u,C=o,P=this.getOrientation();switch(P){case n.wm.Horizontal:D.flexDirection="column",D.height=`${u}px`,v.marginBottom=`${m}px`,C=o,a=Math.max(u/y.length-m+m/y.length,h??0);break;case n.wm.Vertical:D.flexDirection="row",D.justifyContent="space-between",v.marginRight=`${m}px`,a=u,C=Math.max(o/y.length-m+m/y.length,E??0)}v.width=`${C}px`,v.height=`${a}px`;const b=c?c(y,C,a):{};return t.createElement("div",{style:D},y.map((M,T)=>t.createElement("div",{key:T,style:g(v,T,y.length)},l({value:M,width:C,height:a,alignmentFactors:b,orientation:P,count:y.length}))))}}r.defaultProps={itemSpacing:8};function g(d,l,u){return l===u-1?{...d,marginRight:0,marginBottom:0}:d}},73014:(j,I,e)=>{"use strict";e.d(I,{V:()=>g,c:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(31297);const r=l=>({icon:(0,t.css)({marginRight:l.spacing(1),verticalAlign:"middle"}),seriesTable:(0,t.css)({display:"table"}),seriesTableRow:(0,t.css)({display:"table-row",fontSize:l.typography.bodySmall.fontSize}),seriesTableCell:(0,t.css)({display:"table-cell"}),label:(0,t.css)({wordBreak:"break-all"}),value:(0,t.css)({paddingLeft:l.spacing(2),textAlign:"right"}),activeSeries:(0,t.css)({fontWeight:l.typography.fontWeightBold,color:l.colors.text.maxContrast}),timestamp:(0,t.css)({fontWeight:l.typography.fontWeightBold,fontSize:l.typography.bodySmall.fontSize})}),g=({color:l,label:u,value:o,isActive:m})=>{const c=(0,i.wW)(r);return n.createElement("div",{"data-testid":"SeriesTableRow",className:(0,t.cx)(c.seriesTableRow,m&&c.activeSeries)},l&&n.createElement("div",{className:c.seriesTableCell},n.createElement(s.F,{color:l,className:c.icon})),u&&n.createElement("div",{className:(0,t.cx)(c.seriesTableCell,c.label)},u),o&&n.createElement("div",{className:(0,t.cx)(c.seriesTableCell,c.value)},o))},d=({timestamp:l,series:u})=>{const o=(0,i.wW)(r);return n.createElement(n.Fragment,null,l&&n.createElement("div",{className:o.timestamp,"aria-label":"Timestamp"},l),u.map((m,c)=>n.createElement(g,{isActive:m.isActive,label:m.label,color:m.color,value:m.value,key:`${m.label}-${c}`})))}},727:(j,I,e)=>{"use strict";e.d(I,{I:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(52995),r=e(97695);const g=({content:l,position:u,offset:o})=>{const m=(0,i.wW)(d);return u?n.createElement(s.h_,{className:m.portal},n.createElement(r.S,{position:u,offset:o||{x:0,y:0}},l)):null};g.displayName="VizTooltip";const d=()=>({portal:(0,t.css)({position:"absolute",top:0,left:0,pointerEvents:"none",width:"100%",height:"100%"})})},97695:(j,I,e)=>{"use strict";e.d(I,{S:()=>d});var t=e(42844),n=e(27702),i=e(46917),s=e(66310),r=e(97289);const g=(u=0,o=0,m=0,c=0,p=0,f=0,E=0,h=0)=>{let y=u,v=o;const D=Math.max(u+p+m-(E-p),0),a=Math.abs(Math.min(u-p-m-p,0)),C=D>0,P=a>0,b=Math.max(o+f+c-(h-f),0),M=Math.abs(Math.min(o-f-c-f,0)),T=b>0,S=M>0;return C&&P?y=D>a?p:E-p-m:C?y=u-p-m:y=u+p,T&&S?v=b>M?f:h-f-c:T?v=o-f-c:v=o+f,{x:y,y:v}},d=({position:{x:u,y:o},offset:{x:m,y:c},children:p,allowPointerEvents:f=!1,className:E,...h})=>{const y=(0,n.useRef)(null),[v,D]=(0,n.useState)({width:0,height:0}),{width:a,height:C}=(0,i.Z)(),[P,b]=(0,n.useState)({x:u+m,y:o+c}),M=(0,n.useMemo)(()=>new ResizeObserver(S=>{for(let x of S){const O=Math.floor(x.contentRect.width+16),B=Math.floor(x.contentRect.height+2*8);(v.width!==O||v.height!==B)&&D({width:Math.min(O,a),height:Math.min(B,C)})}}),[v,a,C]);(0,n.useLayoutEffect)(()=>(y.current&&M.observe(y.current),()=>{M.disconnect()}),[M]),(0,n.useLayoutEffect)(()=>{if(y&&y.current){const{x:S,y:x}=g(u,o,v.width,v.height,m,c,a,C);b({x:S,y:x})}},[a,C,u,m,o,c,v]);const T=(0,s.wW)(l);return n.createElement("div",{ref:y,style:{position:"fixed",left:0,pointerEvents:f?"auto":"none",top:0,transform:`translate(${P.x}px, ${P.y}px)`,transition:"transform ease-out 0.1s"},"aria-live":"polite","aria-atomic":"true",...h,className:(0,t.cx)(T.wrapper,E)},p)};d.displayName="VizTooltipContainer";const l=u=>({wrapper:(0,t.css)((0,r.getTooltipContainerStyles)(u))})},82367:(j,I,e)=>{"use strict";e.r(I),e.d(I,{Alert:()=>Ue.b,AlertingSettings:()=>sn.O,AsyncMultiSelect:()=>Ta.M8,AsyncSelect:()=>Ta.qb,AsyncVirtualizedSelect:()=>Ta.gY,AutoSaveField:()=>Q.h,AutoSizeInput:()=>Sr.H,Badge:()=>Xa.C,BarGauge:()=>ct.xf,BarGaugeDisplayMode:()=>ks.QH,BigValue:()=>tt.w6,BigValueColorMode:()=>tt.pc,BigValueGraphMode:()=>tt.IG,BigValueJustifyMode:()=>tt.ap,BigValueTextMode:()=>tt.jG,BrowserLabel:()=>Et._,Button:()=>Ua.zx,ButtonCascader:()=>C.O,ButtonGroup:()=>$a.h,ButtonSelect:()=>Vs.d,CallToActionCard:()=>rt._,Card:()=>Za.Z,CardContainer:()=>jt._,Cascader:()=>a.v,CertificationKey:()=>Vt.W,Checkbox:()=>kn.X,ClickOutsideWrapper:()=>Ze.L,ClipboardButton:()=>D.m,CodeEditor:()=>ge.p,CodeEditorSuggestionItemKind:()=>re.k,CollapsableSection:()=>$e.s,Collapse:()=>pe.U,ColorPicker:()=>T.zH,ColorPickerInput:()=>S.T,ConfirmButton:()=>o.p,ConfirmModal:()=>q.s,Container:()=>ss.W2,ContextMenu:()=>pt.x,ControlledCollapse:()=>pe.y,Counter:()=>Ke.A,CustomHeadersSettings:()=>dn.H,CustomScrollbar:()=>y.$,DataLinkButton:()=>Se.k,DataLinkInput:()=>on.v,DataLinksContextMenu:()=>ln.V,DataLinksInlineEditor:()=>cn.d,DataSourceHttpSettings:()=>Gt.E,DatePicker:()=>H.M,DatePickerWithInput:()=>R.d,DateTimePicker:()=>_.x,DeleteButton:()=>m.m,Divider:()=>sr.i,Drawer:()=>aa.d,Dropdown:()=>Fr.L,DropdownIndicator:()=>Ja.m,EmptySearchResult:()=>O.K,ErrorBoundary:()=>Nt.SV,ErrorBoundaryAlert:()=>Nt.z4,ErrorWithStack:()=>Ft.X,EventsCanvas:()=>kt.TZ,FIXED_UNIT:()=>an.j,FadeTransition:()=>Xt.n,FeatureBadge:()=>ft.a,FeatureInfoBox:()=>ft.Z,Field:()=>Tn.g,FieldArray:()=>jn.F,FieldLinkList:()=>Ve.Z,FieldSet:()=>xn.C,FieldValidationMessage:()=>ia.S,FileDropzone:()=>Sa.Yo,FileDropzoneDefaultChildren:()=>Sa.A_,FileListItem:()=>Sa.K$,FileUpload:()=>ma.p,FilterInput:()=>Tr.H,FilterPill:()=>oe.B,Form:()=>Ca.l,FormattedValueDisplay:()=>va.W,FullWidthButtonContainer:()=>He.f,Gauge:()=>Pt.a,Graph:()=>xt.k,GraphContextMenu:()=>Rt.w,GraphContextMenuHeader:()=>Rt.b,GraphNG:()=>an.d,GraphSeriesToggler:()=>ue.U,GraphWithLegend:()=>bt.U,HorizontalGroup:()=>ss.Lh,Icon:()=>l.J,IconButton:()=>u.h,InfoBox:()=>yt.v,InlineField:()=>oa._,InlineFieldRow:()=>ca.Z,InlineFormLabel:()=>Ss.c,InlineLabel:()=>sa.W,InlineSegmentGroup:()=>_n.m,InlineSwitch:()=>Ds.x,InlineToast:()=>P.K,Input:()=>qs.I,InputControl:()=>ka.g,InteractiveTable:()=>Y.e,JSONFormatter:()=>Tt.g,JsonExplorer:()=>Bt.u,KeyboardPlugin:()=>Kt.Cm,Label:()=>En._,LegacyForms:()=>da,LegacyInputStatus:()=>n.G,Legend:()=>An.D,Link:()=>rn.r,LinkButton:()=>Ua.Qj,List:()=>G.a,LoadingBar:()=>M.F,LoadingPlaceholder:()=>b.u,Marker:()=>kt.Jx,Menu:()=>It.v,MenuGroup:()=>_t.k,MenuItem:()=>tn.s,Modal:()=>he.u,ModalHeader:()=>ye.x,ModalRoot:()=>ke.Y0,ModalTabContent:()=>We.Q,ModalTabsHeader:()=>ce.H,ModalsContext:()=>ke.kr,ModalsController:()=>ke.JY,ModalsProvider:()=>ke.$i,MultiSelect:()=>Ta.NU,PageToolbar:()=>et.X,Pagination:()=>se.t,PanelChrome:()=>ze.fm,PanelChromeErrorIndicator:()=>xe.g,PanelChromeLoadingIndicator:()=>Ie.T,PanelContainer:()=>Vn.l,PanelContextProvider:()=>Te._w,PanelContextRoot:()=>Te.bb,PlotLegend:()=>gt.l,PluginSignatureBadge:()=>dr.o,Popover:()=>f.J,PopoverController:()=>p.D,Portal:()=>h.h_,PortalContainer:()=>h.lO,QueryField:()=>ne.q,RadioButtonGroup:()=>Ps.S,RadioButtonList:()=>hs.x,RangeSlider:()=>xa.U,ReactMonacoEditor:()=>ae.o,RefreshPicker:()=>V.dP,RelativeTimeRangePicker:()=>ws.x,RenderUserContentAsHTML:()=>Ye.D,ScaleDistribution:()=>ks.wf,SecretInput:()=>lr.m,SecretTextArea:()=>cr.Z,SecureSocksProxySettings:()=>Bn.i,Segment:()=>pn.X,SegmentAsync:()=>Pn.V,SegmentInput:()=>zn.X,SegmentSection:()=>Ea.f,SegmentSelect:()=>Hn.V,Select:()=>Ta.Ph,SelectContainer:()=>Ta.eI,SeriesColorPicker:()=>T.sp,SeriesColorPickerPopover:()=>x.j,SeriesColorPickerPopoverWithTheme:()=>x.q,SeriesIcon:()=>Un.F,SeriesTable:()=>Ee.c,SeriesTableRow:()=>Ee.V,SeriesVisibilityChangeBehavior:()=>ie.Y,SeriesVisibilityChangeMode:()=>un.R,SetInterval:()=>we.F,SlideOutTransition:()=>mn.R,Slider:()=>na.i,Sparkline:()=>nt.b,Spinner:()=>Ht.$,StatsPicker:()=>A.m,Switch:()=>Ds.r,TLSAuthSettings:()=>wt.s,Tab:()=>st.O,TabContent:()=>be.I,TabbedContainer:()=>v.W,Table:()=>_e.i,TableInputCSV:()=>Ge.w,TabsBar:()=>qe.J,Tag:()=>Z.V,TagList:()=>le.P,TagsInput:()=>X.B,TextArea:()=>ya.K,TextLink:()=>zt.h,TimeOfDayPicker:()=>N.y,TimePickerTooltip:()=>W.IF,TimeRangeInput:()=>er.K,TimeRangeLabel:()=>w.q,TimeRangePicker:()=>W.Xc,TimeSeries:()=>yn.p,TimeZonePicker:()=>F.O,Toggletip:()=>E.P,ToolbarButton:()=>Mt.h,ToolbarButtonRow:()=>Dt.R,Tooltip:()=>c.u,TooltipPlugin:()=>Kt.ii,UPLOT_AXIS_FONT_SIZE:()=>Jr.gD,UPlotChart:()=>Ct.N,UPlotConfigBuilder:()=>Va.U,UnitPicker:()=>B.n,UserIcon:()=>Zr.t,ValuePicker:()=>ht.b,VerticalGroup:()=>ss.wc,VerticalTab:()=>Me.L,VirtualizedSelect:()=>Ta.LT,VizLayout:()=>Oe.AY,VizLegend:()=>Le.l,VizLegendListItem:()=>Be.e,VizRepeater:()=>Ce.Q,VizTooltip:()=>it.I,VizTooltipContainer:()=>me.S,WeekStartPicker:()=>k.z,WithContextMenu:()=>qt.z,XYCanvas:()=>kt.K2,ZoomPlugin:()=>Kt.Rb,buildScaleKey:()=>Ln.z1,clearButtonStyles:()=>Ua.gN,convertOldAngularValueMapping:()=>Qe.PR,defaultIntervals:()=>V.o5,fieldMatchersUI:()=>Lt.i,getCardStyles:()=>Za.L,getInputStyles:()=>qs.H,getPortalContainer:()=>h.RN,getSelectStyles:()=>ps.D,graphFieldOptions:()=>Ts.q,graphTickFormatter:()=>Ae.sV,graphTimeFormat:()=>Ae.mc,preparePlotFrame:()=>Ln.Rn,resetSelectStyles:()=>ns.Z,sharedInputStyle:()=>Ba.RK,sharedSingleStatMigrationHandler:()=>Qe.rD,sharedSingleStatPanelChangedHandler:()=>Qe.ZH,useGraphNGContext:()=>hn.z,usePanelContext:()=>Te.R9,variableSuggestionToCodeEditorSuggestion:()=>De.T,withErrorBoundary:()=>Nt.Pf});var t=e(14496),n=e(83670),i=e(39520),s=e(33261),r=e(49918),g=e(17752),d=e(88885),l=e(73453),u=e(67437),o=e(55205),m=e(15202),c=e(80011),p=e(75965),f=e(71235),E=e(16532),h=e(52995),y=e(29372),v=e(84279),D=e(71585),a=e(97560),C=e(58964),P=e(28676),b=e(52419),M=e(98557),T=e(56025),S=e(56887),x=e(74011),O=e(10701),B=e(62916),A=e(10133),V=e(26862),W=e(37424),w=e(49430),N=e(19820),F=e(15672),k=e(63014),H=e(76911),R=e(37691),_=e(48419),G=e(59390),Y=e(39695),X=e(72699),Q=e(32170),se=e(50852),Z=e(65333),le=e(86004),oe=e(81520),q=e(3613),ne=e(9857),ge=e(11649),ae=e(15939),re=e(94661),De=e(16640),he=e(13741),ye=e(22106),ce=e(64472),We=e(64067),ke=e(60729),et=e(58456),we=e(7179),_e=e(95066),Ge=e(7704),qe=e(15372),st=e(54281),Me=e(49050),be=e(4432),Ke=e(77122),Ye=e(20540),tt=e(50323),nt=e(61398),Pt=e(59870),xt=e(41115),bt=e(21783),Rt=e(36149),ct=e(24919),it=e(727),me=e(97695),Ee=e(73014),Ce=e(44201),Ae=e(84143),ze=e(92056),Ie=e(44790),xe=e(1573),Te=e(70823),Oe=e(34072),ie=e(43765),Le=e(71982),Be=e(11141),Ue=e(63439),ue=e(7241),pe=e(41640),$e=e(62499),Se=e(73e3),Ve=e(90282),He=e(77075),Ze=e(8430),Qe=e(97583),rt=e(60801),pt=e(14986),It=e(89746),_t=e(66711),tn=e(79655),qt=e(78383),cn=e(36537),on=e(22965),ln=e(50741),Un=e(31297),yt=e(86064),ft=e(96198),Tt=e(78838),Bt=e(17185),Nt=e(37647),Ft=e(13431),Gt=e(49257),dn=e(93741),sn=e(80143),Bn=e(79510),wt=e(86509),Vt=e(43516),Ht=e(62108),Xt=e(54004),mn=e(12806),pn=e(95578),Pn=e(92472),zn=e(45066),Hn=e(61896),Ea=e(44541),aa=e(14574),na=e(39540),xa=e(37983),Ca=e(23839),Ba=e(26468),ka=e(16310),Ua=e(66670),$a=e(77720),Mt=e(30973),Dt=e(84693),ht=e(73990),Lt=e(78425),rn=e(9848),zt=e(90038),En=e(79978),Tn=e(22209),An=e(12375),xn=e(5229),ia=e(59904),oa=e(48024),_n=e(88413),sa=e(53901),ca=e(71107),jn=e(56948),ns=e(69213),Ta=e(28580),Ja=e(65449),ps=e(73578),Jn=e(49030),Ya=e.n(Jn),xs={};for(const Ga in Jn)["default","Icon","IconButton","ConfirmButton","DeleteButton","Tooltip","PopoverController","Popover","Toggletip","Portal","getPortalContainer","PortalContainer","CustomScrollbar","TabbedContainer","ClipboardButton","Cascader","ButtonCascader","InlineToast","LoadingPlaceholder","LoadingBar","ColorPicker","SeriesColorPicker","ColorPickerInput","SeriesColorPickerPopover","SeriesColorPickerPopoverWithTheme","EmptySearchResult","UnitPicker","StatsPicker","RefreshPicker","defaultIntervals","TimeRangePicker","TimePickerTooltip","TimeRangeLabel","TimeOfDayPicker","TimeZonePicker","WeekStartPicker","DatePicker","DatePickerWithInput","DateTimePicker","List","InteractiveTable","TagsInput","AutoSaveField","Pagination","Tag","TagList","FilterPill","ConfirmModal","QueryField","CodeEditor","ReactMonacoEditor","CodeEditorSuggestionItemKind","variableSuggestionToCodeEditorSuggestion","Modal","ModalHeader","ModalTabsHeader","ModalTabContent","ModalsProvider","ModalRoot","ModalsController","ModalsContext","PageToolbar","SetInterval","Table","TableInputCSV","TabsBar","Tab","VerticalTab","TabContent","Counter","RenderUserContentAsHTML","BigValue","BigValueColorMode","BigValueGraphMode","BigValueJustifyMode","BigValueTextMode","Sparkline","Gauge","Graph","GraphWithLegend","GraphContextMenu","GraphContextMenuHeader","BarGauge","VizTooltip","VizTooltipContainer","SeriesTable","SeriesTableRow","VizRepeater","graphTimeFormat","graphTickFormatter","PanelChrome","PanelChromeLoadingIndicator","PanelChromeErrorIndicator","PanelContextProvider","PanelContextRoot","usePanelContext","VizLayout","SeriesVisibilityChangeBehavior","VizLegend","VizLegendListItem","Alert","GraphSeriesToggler","Collapse","ControlledCollapse","CollapsableSection","DataLinkButton","FieldLinkList","FullWidthButtonContainer","ClickOutsideWrapper","CallToActionCard","ContextMenu","Menu","MenuGroup","MenuItem","WithContextMenu","DataLinksInlineEditor","DataLinkInput","DataLinksContextMenu","SeriesIcon","InfoBox","FeatureBadge","FeatureInfoBox","JSONFormatter","JsonExplorer","ErrorBoundary","ErrorBoundaryAlert","withErrorBoundary","ErrorWithStack","DataSourceHttpSettings","CustomHeadersSettings","AlertingSettings","SecureSocksProxySettings","TLSAuthSettings","CertificationKey","Spinner","FadeTransition","SlideOutTransition","Segment","SegmentAsync","SegmentInput","SegmentSelect","SegmentSection","Drawer","Slider","RangeSlider","Form","sharedInputStyle","InputControl","Button","LinkButton","ButtonGroup","clearButtonStyles","ToolbarButton","ToolbarButtonRow","ValuePicker","fieldMatchersUI","Link","TextLink","Label","Field","Legend","FieldSet","FieldValidationMessage","InlineField","InlineSegmentGroup","InlineLabel","InlineFieldRow","FieldArray","resetSelectStyles","DropdownIndicator","getSelectStyles","HorizontalGroup","VerticalGroup","Container","Badge","RadioButtonGroup","RadioButtonList","Input","getInputStyles","AutoSizeInput","FilterInput","Switch","InlineSwitch","Checkbox","TextArea","FileUpload","TimeRangeInput","RelativeTimeRangePicker","Card","getCardStyles","CardContainer","FormattedValueDisplay","ButtonSelect","Dropdown","PluginSignatureBadge","UserIcon","InlineFormLabel","Divider","LegacyForms","LegacyInputStatus","ScaleDistribution","BarGaugeDisplayMode","UPlotConfigBuilder","UPLOT_AXIS_FONT_SIZE","UPlotChart","PlotLegend","GraphNG","FIXED_UNIT","TimeSeries","useGraphNGContext","preparePlotFrame","buildScaleKey","BrowserLabel","PanelContainer","convertOldAngularValueMapping","sharedSingleStatMigrationHandler","sharedSingleStatPanelChangedHandler","AsyncMultiSelect","AsyncSelect","AsyncVirtualizedSelect","MultiSelect","Select","SelectContainer","VirtualizedSelect"].indexOf(Ga)<0&&(xs[Ga]=()=>Jn[Ga]);e.d(I,xs);var ss=e(64022),Xa=e(25357),Ps=e(40705),hs=e(20839),qs=e(1128),Sr=e(31465),Tr=e(33716),lr=e(68227),cr=e(86370),Ds=e(42074),kn=e(83967),ya=e(60105),ma=e(2576),Sa=e(63844),er=e(95059),ws=e(2184),Za=e(50230),jt=e(90527),va=e(70944),Vs=e(70725),Fr=e(80434),dr=e(97918),Zr=e(30678),Ss=e(60644),sr=e(238),Ts=e(55219),ks=e(64167),Va=e(19345),Jr=e(59685),Ct=e(81144),gt=e(30797),kt=e(17270),Kt=e(42059),an=e(18869),yn=e(25181),hn=e(62514),Ln=e(90537),un=e(76761),Et=e(36162),Vn=e(25695);const da={SecretFormField:d.c,FormField:t.W,Select:r.Ph,AsyncSelect:r.qb,IndicatorsContainer:i.B,NoOptionsMessage:s.P,Input:n.I,Switch:g.r}},54004:(j,I,e)=>{"use strict";e.d(I,{n:()=>g});var t=e(42844),n=e(27702),i=e(42358),s=e(80402);const r=(0,s.B)(d=>({enter:(0,t.css)({label:"enter",opacity:0}),enterActive:(0,t.css)({label:"enterActive",opacity:1,transition:`opacity ${d}ms ease-out`}),exit:(0,t.css)({label:"exit",opacity:1}),exitActive:(0,t.css)({label:"exitActive",opacity:0,transition:`opacity ${d}ms ease-out`})}));function g(d){const{visible:l,children:u,duration:o=250}=d,m=r(o);return n.createElement(i.Z,{in:l,mountOnEnter:!0,unmountOnExit:!0,timeout:o,classNames:m},u)}},12806:(j,I,e)=>{"use strict";e.d(I,{R:()=>g});var t=e(42844),n=e(27702),i=e(42358),s=e(80402);const r=(0,s.B)((d,l,u)=>({enter:(0,t.css)({label:"enter",[`${l}`]:0,opacity:0}),enterActive:(0,t.css)({label:"enterActive",[`${l}`]:`${u}px`,opacity:1,transition:`opacity ${d}ms ease-out, ${l} ${d}ms ease-out`}),exit:(0,t.css)({label:"exit",[`${l}`]:`${u}px`,opacity:1}),exitActive:(0,t.css)({label:"exitActive",opacity:0,[`${l}`]:0,transition:`opacity ${d}ms ease-out, ${l} ${d}ms ease-out`})}));function g(d){const{visible:l,children:u,duration:o=250,horizontal:m,size:c}=d,p=r(o,m?"width":"height",c);return n.createElement(i.Z,{in:l,mountOnEnter:!0,unmountOnExit:!0,timeout:o,classNames:p},u)}},81144:(j,I,e)=>{"use strict";e.d(I,{N:()=>d});var t=e(27702),n=e(26712),i=e(48473);function s(l,u){return u.width===l.width&&u.height===l.height}function r(l,u){return u.data===l.data}function g(l,u){return u.config===l.config}class d extends t.Component{constructor(u){super(u),this.plotContainer=(0,t.createRef)(),this.plotCanvasBBox=(0,t.createRef)(),this.state={plot:null}}reinitPlot(){let{width:u,height:o,plotRef:m}=this.props;if(this.state.plot?.destroy(),u===0&&o===0)return;this.props.config.addHook("setSize",f=>{f.over});const c={width:Math.floor(this.props.width),height:Math.floor(this.props.height),...this.props.config.getConfig()};(0,i.Zp)("UPlot",!1,"Reinitializing plot",c);const p=new n.Z(c,this.props.data,this.plotContainer.current);m&&m(p),this.setState({plot:p})}componentDidMount(){this.reinitPlot()}componentWillUnmount(){this.state.plot?.destroy()}componentDidUpdate(u){let{plot:o}=this.state;s(u,this.props)?g(u,this.props)?r(u,this.props)||o?.setData(this.props.data):this.reinitPlot():o?.setSize({width:Math.floor(this.props.width),height:Math.floor(this.props.height)})}render(){return t.createElement("div",{style:{position:"relative"}},t.createElement("div",{ref:this.plotContainer,"data-testid":"uplot-main-div"}),this.props.children)}}},30797:(j,I,e)=>{"use strict";e.d(I,{l:()=>c,o:()=>m});var t=e(27702),n=e(75578),i=e(58192),s=e(66656),r=e(61965),g=e(64167),d=e(66310),l=e(34072),u=e(71982);const o=p=>p==null?"-":p.toFixed(1);function m(p,f){return p.getSeries().some(E=>{const h=E.props.dataFrameFieldIndex;if(!h)return!1;const y=f[h.frameIndex]?.fields[h.fieldIndex];return!(!y||y.config.custom?.hideFrom?.legend)})}const c=t.memo(({data:p,config:f,placement:E,calcs:h,displayMode:y,...v})=>{const D=(0,d.l4)(),a=f.getSeries().map(C=>{const P=C.props,b=P.dataFrameFieldIndex,M=f.getAxisPlacement(C.props.scaleKey);if(!b)return;const T=p[b.frameIndex]?.fields[b.fieldIndex];if(!T||T.config.custom?.hideFrom?.legend)return;const S=(0,n.CZ)(T,p[b.frameIndex],p),O=(0,i.YO)(T,D).color;return{disabled:!(P.show??!0),fieldIndex:b,color:O,label:S,yAxis:M===g.LB.Left||M===g.LB.Bottom?1:2,getDisplayValues:()=>{if(!h?.length)return[];const B=T.display??o;let A=null;const V=(0,s.Kx)({field:T,reducers:h});return h.map(W=>{const w=s.TB.get(W);let N=B;return w.id===s.gz.diffperc&&(N=(0,r.U)({field:{...T,config:{...T.config,unit:"percentunit"}},theme:D})),(w.id===s.gz.count||w.id===s.gz.changeCount||w.id===s.gz.distinctCount)&&(A||(A=(0,r.U)({field:{...T,config:{...T.config,unit:"none"}},theme:D})),N=A),{...N(V[W]),title:w.name,description:w.description}})},getItemKey:()=>`${S}-${b.frameIndex}-${b.fieldIndex}`}}).filter(C=>C!==void 0);return t.createElement(l.AY.Legend,{placement:E,...v},t.createElement(u.l,{placement:E,items:a,displayMode:y,sortBy:v.sortBy,sortDesc:v.sortDesc,isSortable:!0}))});c.displayName="PlotLegend"},55219:(j,I,e)=>{"use strict";e.d(I,{q:()=>n});var t=e(64167);const n={drawStyle:[{label:"Lines",value:t.l8.Line},{label:"Bars",value:t.l8.Bars},{label:"Points",value:t.l8.Points}],lineInterpolation:[{description:"Linear",value:t.KC.Linear,icon:"gf-interpolation-linear"},{description:"Smooth",value:t.KC.Smooth,icon:"gf-interpolation-smooth"},{description:"Step before",value:t.KC.StepBefore,icon:"gf-interpolation-step-before"},{description:"Step after",value:t.KC.StepAfter,icon:"gf-interpolation-step-after"}],barAlignment:[{description:"Before",value:t.pu.Before,icon:"gf-bar-alignment-before"},{description:"Center",value:t.pu.Center,icon:"gf-bar-alignment-center"},{description:"After",value:t.pu.After,icon:"gf-bar-alignment-after"}],showPoints:[{label:"Auto",value:t.Jp.Auto,description:"Show points when the density is low"},{label:"Always",value:t.Jp.Always},{label:"Never",value:t.Jp.Never}],axisPlacement:[{label:"Auto",value:t.LB.Auto,description:"First field on the left, everything else on the right"},{label:"Left",value:t.LB.Left},{label:"Right",value:t.LB.Right},{label:"Hidden",value:t.LB.Hidden}],fillGradient:[{label:"None",value:t.FI.None},{label:"Opacity",value:t.FI.Opacity,description:"Enable fill opacity gradient"},{label:"Hue",value:t.FI.Hue,description:"Small color hue gradient"},{label:"Scheme",value:t.FI.Scheme,description:"Use color scheme to define gradient"}],stacking:[{label:"Off",value:t.o0.None},{label:"Normal",value:t.o0.Normal},{label:"100%",value:t.o0.Percent}],thresholdsDisplayModes:[{label:"Off",value:t.i3.Off},{label:"As lines",value:t.i3.Line},{label:"As lines (dashed)",value:t.i3.Dashed},{label:"As filled regions",value:t.i3.Area},{label:"As filled regions and lines",value:t.i3.LineAndArea},{label:"As filled regions and lines (dashed)",value:t.i3.DashedAndArea}]}},59685:(j,I,e)=>{"use strict";e.d(I,{ff:()=>m,gD:()=>u,mr:()=>p});var t=e(21609),n=e(27107),i=e(65347),s=e(60956),r=e(64167),g=e(11724),d=e(67463),l=e(24276);const u=12,o=8;class m extends d.L{merge(h){this.props.size=(0,l.V)("max",this.props.size,h.size),this.props.label||(this.props.label=h.label),this.props.placement===r.LB.Auto&&(this.props.placement=h.placement)}calculateSpace(h,y,v,D,a){const C=h.axes[y],P=h.scales[C.scale];if(C.side!==2||!P)return 30;const b=40;if(P.time){const M=a/b,T=(D-v)/M,S=p(h,[v],y,b,T);return(0,g.X1)(S[0],u).width+18}return b}calculateAxisSize(h,y,v){const D=h.axes[v];let a=D.ticks.size;if(D.side===2)a+=D.gap+u;else if(y?.length){let C=y.reduce((b,M)=>Math.max(b,(0,g.X1)(M,u).width),0);const P=Math.min(h.width*.4,C);a+=D.gap+D.labelGap+P}return Math.ceil(a)}getConfig(){let{scaleKey:h,label:y,show:v=!0,placement:D=r.LB.Auto,grid:a={show:!0},ticks:C,space:P,filter:b,gap:M=5,formatValue:T,splits:S,values:x,incrs:O,isTime:B,timeZone:A,theme:V,tickLabelRotation:W,size:w,color:N,border:F,decimals:k,distr:H=r.wf.Linear}=this.props;const R=`${u}px ${V.typography.fontFamily}`,_=V.isDark?"rgba(240, 250, 255, 0.09)":"rgba(0, 10, 23, 0.09)";(0,t.br)(h)&&(S=[0,1]),k===0&&H===r.wf.Linear&&(b=(Y,X)=>X.map(Q=>Number.isInteger(Q)?Q:null));let G={scale:h,show:v,stroke:N??V.colors.text.primary,side:f(D),font:R,size:w??((Y,X,Q)=>this.calculateAxisSize(Y,X,Q)),rotate:W,gap:M,labelGap:0,grid:{show:a.show,stroke:_,width:1/devicePixelRatio},ticks:Object.assign({show:!0,stroke:_,width:1/devicePixelRatio,size:4},C),splits:S,values:x,space:P??((Y,X,Q,se,Z)=>this.calculateSpace(Y,X,Q,se,Z)),filter:b,incrs:O};return F!=null&&(G.border=F),y!=null&&y.length>0&&(G.label=y,G.labelSize=u+o,G.labelFont=R,G.labelGap=o),x?G.values=x:B?G.values=p:T&&(G.values=(Y,X,Q,se,Z)=>{let le=(0,n.d)((0,n.O)(Z,6));return X.map(oe=>T(oe,le>0?le:void 0))}),G.timeZone=A,G}}const c={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,h,y,v,D){const a=E.axes[y].timeZone,C=E.scales.x,P=(C?.max??0)-(C?.min??0),b=Math.round(c.year/c.day)*c.day,M=Math.round(D/c.day)*c.day;let T=i.U6.interval.year;return D<c.second?T=i.U6.interval.millisecond:D<=c.minute?T=i.U6.interval.second:P<=c.day?T=i.U6.interval.minute:D<=c.day?T=i.U6.interval.hour:P<c.year?T=i.U6.interval.day:M===b?T=i.U6.interval.year:D<=c.year&&(T=i.U6.interval.month),h.map(S=>S==null?"":(0,s.dq)(S,{format:T,timeZone:a}))}function f(E){switch(E){case r.LB.Top:return 0;case r.LB.Right:return 1;case r.LB.Bottom:return 2;case r.LB.Left:}return 3}},19345:(j,I,e)=>{"use strict";e.d(I,{U:()=>a});var t=e(89949),n=e(26712),i=e(8508),s=e(80369),r=e(64167),g=e(48473),d=e(59685),l=e(24276),u=e(93666),o=e(96750),m=e(67463),c=e(12839);class p extends m.L{getConfig(){const{facets:P,drawStyle:b,pathBuilder:M,pointsBuilder:T,pointsFilter:S,lineInterpolation:x,lineWidth:O,lineStyle:B,barAlignment:A,barWidthFactor:V,barMaxWidth:W,showPoints:w,pointSize:N,scaleKey:F,pxAlign:k,spanNulls:H,show:R=!0}=this.props;let _={},G=this.getLineColor();_.stroke=G,M!=null?(_.paths=M,_.width=O):b===r.l8.Points?_.paths=()=>null:b!=null&&(_.width=O,B&&B.fill!=="solid"&&(B.fill==="dot"&&(_.cap="round"),_.dash=B.dash??[10,10]),_.paths=(Q,se,Z,le)=>E(b,x,A,V,W)(Q,se,Z,le));const Y=typeof G=="string"?G:(Q,se)=>Q.series[se]._stroke,X={points:{stroke:Y,fill:Y,size:!N||N<O?void 0:N,filter:S}};return T!=null?X.points.show=T:b===r.l8.Points?X.points.show=!0:w===r.Jp.Auto?b===r.l8.Bars&&(X.points.show=!1):w===r.Jp.Never?X.points.show=!1:w===r.Jp.Always&&(X.points.show=!0),{scale:F,facets:P,spanGaps:typeof H=="number"?!1:H,value:()=>"",pxAlign:k,show:R,fill:this.getFill(),..._,...X}}getLineColor(){const{lineColor:P,gradientMode:b,colorMode:M,thresholds:T,theme:S,hardMin:x,hardMax:O,softMin:B,softMax:A,dynamicSeriesColor:V}=this.props;return b===r.FI.None&&V?(W,w)=>V(w)??P??u.R:b===r.FI.Scheme&&M?.id!==u.S.Fixed?(0,c.P2)(1,S,M,T,x,O,B,A):P??u.R}getFill(){const{lineColor:P,fillColor:b,gradientMode:M,fillOpacity:T,colorMode:S,thresholds:x,theme:O,hardMin:B,hardMax:A,softMin:V,softMax:W,dynamicSeriesColor:w}=this.props;if(b)return b;const N=M??r.FI.None,F=(T??0)/100;if(N===r.FI.None&&w&&F>0)return(k,H)=>{let R=k.series[H]._stroke;return o.alpha(R??"",F)};switch(N){case r.FI.Opacity:return(0,c.DT)(b??P,F);case r.FI.Hue:return(0,c.oN)(b??P,F,O);case r.FI.Scheme:if(S?.id!==u.S.Fixed)return(0,c.P2)(F,O,S,x,B,A,V,W);default:if(F>0)return o.alpha(P??"",F)}}}let f;function E(C,P,b=0,M=.6,T=200){const S=n.Z.paths;if(f||(f={linear:S.linear(),smooth:S.spline(),stepBefore:S.stepped({align:-1}),stepAfter:S.stepped({align:1})}),C===r.l8.Bars){let x=`bars|${b}|${M}|${T}`;return f[x]||(f[x]=S.bars({size:[M,T],align:b})),f[x]}else if(C===r.l8.Line){if(P===r.KC.StepBefore)return f.stepBefore;if(P===r.KC.StepAfter)return f.stepAfter;if(P===r.KC.Smooth)return f.smooth}return f.linear}var h=e(71685),y=e(5168);function v(C){const P=C.config.mode===r.i3.Dashed||C.config.mode===r.i3.DashedAndArea?[10,10]:null;function b(w,N,F,k){let H=w.ctx,R=0;for(let _=0;_<F.length;_++)if(F[_].color==="transparent"){R=_;break}H.lineWidth=2,P&&H.setLineDash(P);for(let _=1;_<F.length;_++){const G=F[_];let Y;R>=_&&_>0?Y=(0,h.Z)(k.visualization.getColorByName(F[_-1].color)):Y=(0,h.Z)(k.visualization.getColorByName(G.color)),Y.getAlpha()===1&&Y.setAlpha(.7);let X=Math.round(w.bbox.left),Q=Math.round(w.valToPos(G.value,N,!0)),se=Math.round(w.bbox.left+w.bbox.width),Z=Math.round(w.valToPos(G.value,N,!0));H.beginPath(),H.moveTo(X,Q),H.lineTo(se,Z),H.strokeStyle=Y.toString(),H.stroke()}}function M(w,N,F,k){let H=w.ctx,R=(0,c.KV)(w,N,F.map(_=>{let G=(0,h.Z)(k.visualization.getColorByName(_.color));return G.getAlpha()===1&&G.setAlpha(.15),[_.value,G.toString()]}),!0);H.fillStyle=R,H.fillRect(w.bbox.left,w.bbox.top,w.bbox.width,w.bbox.height)}const{scaleKey:T,thresholds:S,theme:x,config:O,hardMin:B,hardMax:A,softMin:V,softMax:W}=C;return w=>{const N=w.ctx,{min:F,max:k}=w.scales.x,{min:H,max:R}=w.scales[T];if(F==null||k==null||H==null||R==null)return;let{steps:_,mode:G}=S;if(G===y.H.Percentage){let[Y,X]=(0,c.A9)(w,T,B,A,V,W),Q=X-Y;_=_.map(se=>({...se,value:Y+Q*(se.value/100)}))}switch(N.save(),O.mode){case r.i3.Line:case r.i3.Dashed:b(w,T,_,x);break;case r.i3.Area:M(w,T,_,x);break;case r.i3.LineAndArea:case r.i3.DashedAndArea:M(w,T,_,x),b(w,T,_,x)}N.restore()}}const D={drag:{setScale:!1},points:{size:(C,P)=>C.series[P].points.size*2,width:(C,P,b)=>b/4},focus:{prox:30}};class a{constructor(P=i.Ys){this.series=[],this.axes={},this.scales=[],this.bands=[],this.stackingGroups=[],this.hasLeftAxis=!1,this.hooks={},this.tz=void 0,this.sync=!1,this.mode=1,this.frames=void 0,this.thresholds={},this.tooltipInterpolator=void 0,this.padding=void 0,this.prepData=void 0,this.scaleKeys=["",""],this.tzDate=b=>{let M=new Date(b);return this.tz?n.Z.tzDate(M,this.tz):M},this.tz=(0,s.Pr)(P,Date.now())?.ianaName}addHook(P,b){(0,g.Zp)("UPlotConfigBuilder",!1,"addHook",P),this.hooks[P]||(this.hooks[P]=[]),this.hooks[P].push(b)}addThresholds(P){this.thresholds[P.scaleKey]||(this.thresholds[P.scaleKey]=P,this.addHook("drawClear",v(P)))}addAxis(P){P.placement=P.placement??r.LB.Auto,P.grid=P.grid??{};let b=P.scaleKey;if(b==="x"&&(b+=P.timeZone??""),this.axes[b]){this.axes[b].merge(P);return}P.placement===r.LB.Auto&&(P.placement=this.hasLeftAxis?r.LB.Right:r.LB.Left),P.placement===r.LB.Left&&(this.hasLeftAxis=!0),P.placement===r.LB.Hidden&&(P.grid.show=!1,P.size=0),this.axes[b]=new d.ff(P)}getAxisPlacement(P){return this.axes[P]?.props.placement??r.LB.Left}setCursor(P){this.cursor=(0,t.merge)({},this.cursor,P)}setMode(P){this.mode=P}setSelect(P){this.select=P}addSeries(P){this.series.push(new p(P))}getSeries(){return this.series}addScale(P){const b=this.scales.find(M=>M.props.scaleKey===P.scaleKey);if(b){b.merge(P);return}this.scales.push(new l.I(P))}addBand(P){this.bands.push(P)}setStackingGroups(P){this.stackingGroups=P}getStackingGroups(){return this.stackingGroups}setTooltipInterpolator(P){this.tooltipInterpolator=P}getTooltipInterpolator(){return this.tooltipInterpolator}setPrepData(P){this.prepData=b=>(this.frames=b,P(b,this.getStackingGroups()))}setSync(){this.sync=!0}hasSync(){return this.sync}setPadding(P){this.padding=P}getConfig(){const P={...g.qt,mode:this.mode,series:[this.mode===2?null:{value:()=>""}]};P.axes=this.ensureNonOverlappingAxes(Object.values(this.axes)).map(M=>M.getConfig()),P.series=[...P.series,...this.series.map(M=>M.getConfig())],P.scales=this.scales.reduce((M,T)=>({...M,...T.getConfig()}),{}),P.hooks=this.hooks,P.select=this.select;const b=(M="")=>(T,S)=>{let x=T.series[S].points._stroke;if(typeof x!="string"){let O=this.frames[0].fields[S];x=O.display(O.values[T.cursor.idxs[S]]).color}return x+M};return P.cursor=(0,t.merge)({},D,{points:{stroke:b("80"),fill:b()}},this.cursor),P.tzDate=this.tzDate,Array.isArray(this.padding)&&(P.padding=this.padding),this.stackingGroups.length&&this.stackingGroups.forEach(M=>{(0,g.Kq)(M).forEach(T=>{this.addBand(T)})}),this.bands.length&&(P.bands=this.bands),P}ensureNonOverlappingAxes(P){const b=P.find(S=>S.props.scaleKey==="x"),M=P.filter(S=>S.props.grid?.show===void 0),T=M.findIndex(S=>S.props.placement===r.LB.Left||S.props.placement===r.LB.Right||S.props.placement===r.LB.Bottom&&S!==b);for(let S=0;S<M.length;S++)M[S]===b||S===T?M[S].props.grid.show=!0:M[S].props.grid.show=!1;return P}}},24276:(j,I,e)=>{"use strict";e.d(I,{I:()=>g,V:()=>d});var t=e(26712),n=e(35596),i=e(21609),s=e(64167),r=e(67463);class g extends r.L{merge(u){this.props.min=d("min",this.props.min,u.min),this.props.max=d("max",this.props.max,u.max)}getConfig(){let{isTime:u,scaleKey:o,min:m,max:c,softMin:p,softMax:f,range:E,direction:h,orientation:y,centeredZero:v,decimals:D}=this.props;const a=this.props.distribution,C=u?{}:{distr:a===s.wf.Symlog?4:a===s.wf.Log?3:a===s.wf.Ordinal?2:1,log:a===s.wf.Log||a===s.wf.Symlog?this.props.log??2:void 0,asinh:a===s.wf.Symlog?this.props.linearThreshold??1:void 0};if(a===s.wf.Log){let A=this.props.log,V=A===2?Math.log2:Math.log10;m!=null&&(m<=0?m=null:m=A**Math.floor(V(m))),c!=null&&(c<=0?c=null:c=A**Math.ceil(V(c))),p!=null&&(p<=0?p=null:p=A**Math.floor(V(p))),f!=null&&(f<=0?f=null:f=A**Math.ceil(V(f)))}let P=p==null?3:1,b=f==null?3:1;const M={min:{pad:.1,hard:m??-1/0,soft:p||0,mode:P},max:{pad:.1,hard:c??1/0,soft:f||0,mode:b}};let T=p==null&&m!=null,S=f==null&&c!=null,x=T&&S;const O=(A,V,W,w)=>{const N=A.scales[w];let F=[V,W];if(w==="x"&&!u&&a===s.wf.Linear||!x&&V==null&&W==null)return F;let k=N.log??10;if(N.distr===1||N.distr===2||N.distr===4){if(v){let H=Math.abs(V),R=Math.abs(W),_=Math.max(H,R);_===0&&(_=80),V=-_,W=_}N.distr===4?F=t.Z.rangeAsinh(V,W,k,!0):F=t.Z.rangeNum(T?m:V,S?c:W,M)}else N.distr===3&&(F=t.Z.rangeLog(m??V,c??W,k,!0));if(D===0)if(N.distr===1||N.distr===2)F[0]=(0,n.mB)(F[0],1),F[1]=(0,n.UO)(F[1],1);else if(N.distr===3){let H=N.log===2?Math.log2:Math.log10;if(F[0]<=1)F[0]=1;else{let _=Math.floor(H(F[0]));F[0]=k**_}let R=Math.ceil(H(F[1]));F[1]=k**R,F[0]===F[1]&&(F[1]*=k)}else N.distr===4&&(F[0]=(0,n.mB)(F[0],1),F[1]=(0,n.UO)(F[1],1));return(N.distr===1||N.distr===4)&&(T&&(F[0]=m),S&&(F[1]=c)),F[0]>=F[1]&&(F[0]=N.distr===3?1:0,F[1]=100),F};let B=!u&&!x;return(0,i.br)(o)&&(B=!1,E=[0,1]),{[o]:{time:u,auto:B,range:E??O,dir:h,ori:y,...C}}}}function d(l,u,o){const m=u!=null,c=o!=null;return m?c?l==="min"?u<o?u:o:u>o?u:o:u:o}},12839:(j,I,e)=>{"use strict";e.d(I,{A9:()=>p,DT:()=>l,KV:()=>m,P2:()=>f,oN:()=>u});var t=e(71685),n=e(96750),i=e(93666),s=e(5168),r=e(64167),g=e(11724);function d(E,h,y){let v=0,D=0,a=0,C=0;return E===3?(D=h.top,C=h.top+h.height):E===2?(v=h.left+h.width,a=h.left):E===1?(D=h.top+h.height,C=h.top):E===0&&(v=h.left,a=h.left+h.width),y.createLinearGradient(v,D,a,C)}function l(E,h){return(y,v)=>{const D=(0,g.AE)(),a=d(y.scales.x.ori===r.wN.Horizontal?3:2,y.bbox,D);return a.addColorStop(0,n.alpha(E,h)),a.addColorStop(1,n.alpha(E,0)),a}}function u(E,h,y){return(v,D)=>{const a=(0,g.AE)(),C=d(v.scales.x.ori===r.wN.Horizontal?3:2,v.bbox,a),P=(0,t.Z)(E).spin(-15),b=(0,t.Z)(E).spin(15);return y.isDark?(C.addColorStop(0,b.lighten(10).setAlpha(h).toString()),C.addColorStop(1,P.darken(10).setAlpha(h).toString())):(C.addColorStop(0,b.lighten(10).setAlpha(h).toString()),C.addColorStop(1,P.setAlpha(h).toString())),C}}var o=(E=>(E[E.Right=0]="Right",E[E.Up=1]="Up",E[E.Left=2]="Left",E[E.Down=3]="Down",E))(o||{});function m(E,h,y,v=!1){let D=E.scales[h],a=null,C=null;for(let N=0;N<y.length;N++){let F=y[N][0];if((F<=D.min||a==null)&&(a=N),C=N,F>=D.max)break}if(a===C)return y[a][1];let P=y[a][0],b=y[C][0];P===-1/0&&(P=D.min),b===1/0&&(b=D.max);let M=Math.round(E.valToPos(P,h,!0)),T=Math.round(E.valToPos(b,h,!0)),S=M-T;if(S===0)return y[C][1];let x,O,B,A;E.scales.x.ori===r.wN.Horizontal?(x=B=0,O=M,A=T):(O=A=0,x=M,B=T);let W=(0,g.AE)().createLinearGradient(x,O,B,A),w;for(let N=a;N<=C;N++){let F=y[N],k=N===a?M:N===C?T:Math.round(E.valToPos(F[0],h,!0)),H=(M-k)/S;v&&N>a&&W.addColorStop(H,w),W.addColorStop(H,w=F[1])}return W}function c(E,h){let y=E.scales[h],v=1/0,D=-1/0;return E.series.forEach((a,C)=>{if(a.show&&a.scale===h)if(a.min==null){let P=E.data[C];for(let b=0;b<P.length;b++)P[b]!=null&&(v=Math.min(v,P[b]),D=Math.max(D,P[b]))}else v=Math.min(v,a.min),D=Math.max(D,a.max)}),D===v&&(v=y.min,D=y.max),[v,D]}function p(E,h,y,v,D,a){let C=y??D??null,P=v??a??null;if(C==null||P==null){let[b,M]=c(E,h);C=C??b??0,P=P??M??100}return[C,P]}function f(E,h,y,v,D,a,C,P){if(!y)throw Error("Missing colorMode required for color scheme gradients");if(!v)throw Error("Missing thresholds required for color scheme gradients");return(b,M)=>{let T=b.series[M].scale,S="";if(y.id===i.S.Thresholds)if(v.mode===s.H.Absolute){const x=v.steps.map(O=>[O.value,n.alpha(h.visualization.getColorByName(O.color),E)]);S=m(b,T,x,!0)}else{const[x,O]=p(b,T,D,a,C,P),B=O-x,A=v.steps.map(V=>[x+B*(V.value/100),n.alpha(h.visualization.getColorByName(V.color),E)]);S=m(b,T,A,!0)}else if(y.getColors){const x=y.getColors(h),[O,B]=p(b,T,D,a,C,P),A=B-O,V=x.map((W,w)=>[O+A*(w/(x.length-1)),n.alpha(h.visualization.getColorByName(W),E)]);S=m(b,T,V,!1)}return S}}},42341:(j,I,e)=>{"use strict";e.d(I,{T:()=>r});var t=e(27702),n=e(93562),i=e(97835),s=e(27229);function r({id:g,events:d,renderEventMarker:l,mapEventToXYCoords:u,config:o}){const m=(0,t.useRef)(),[c,p]=(0,t.useState)(0),f=(0,n.Z)();(0,t.useLayoutEffect)(()=>{o.addHook("init",h=>{m.current=h}),o.addHook("draw",()=>{f()&&p(h=>h+1)})},[o,p]);const E=(0,t.useMemo)(()=>{const h=[];if(!m.current||d.length===0)return h;for(let y=0;y<d.length;y++){const v=d[y];for(let D=0;D<v.length;D++){const a=u(v,{fieldIndex:D,frameIndex:y});a&&h.push(t.createElement(i.J,{...a,key:`${g}-marker-${y}-${D}`},l(v,{fieldIndex:D,frameIndex:y})))}}return t.createElement(t.Fragment,null,h)},[d,l,c]);return m.current?t.createElement(s.K,{left:m.current.bbox.left/window.devicePixelRatio,top:m.current.bbox.top/window.devicePixelRatio},E):null}},97835:(j,I,e)=>{"use strict";e.d(I,{J:()=>n});var t=e(27702);const n=({x:i,y:s,children:r})=>t.createElement("div",{style:{position:"absolute",top:`${s}px`,left:`${i}px`}},r)},27229:(j,I,e)=>{"use strict";e.d(I,{K:()=>i});var t=e(42844),n=e(27702);const i=({children:s,left:r,top:g})=>{const d=(0,n.useMemo)(()=>(0,t.css)({position:"absolute",overflow:"visible",left:`${r}px`,top:`${g}px`}),[r,g]);return n.createElement("div",{className:d},s)}},17270:(j,I,e)=>{"use strict";e.d(I,{Jx:()=>n.J,K2:()=>i.K,TZ:()=>t.T});var t=e(42341),n=e(97835),i=e(27229)},28482:(j,I,e)=>{"use strict";e.d(I,{C:()=>l});var t=e(89949),n=e.n(t),i=e(27702);const s=.1,r=2,g=new Set(["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Shift"," "]),d=u=>{let o=u.root.closest("[tabindex]"),m=new Set,c=null,p=null;if(!o)return;const f=(C,P)=>{const{cursor:b}=u;if(b.left===void 0||b.top===void 0)return;const{width:M,height:T}=u.over.style,[S,x]=[Math.floor(parseFloat(M)),Math.floor(parseFloat(T))];u.setCursor({left:(0,t.clamp)(b.left+C,0,S),top:(0,t.clamp)(b.top+P,0,x)})},E=C=>{if(m.size===0||!u){p=null;return}const M=(C-(p??C))*s;let T=0,S=0;m.has("ArrowUp")&&(S-=M),m.has("ArrowDown")&&(S+=M),m.has("ArrowLeft")&&(T-=M),m.has("ArrowRight")&&(T+=M),m.has("Shift")&&(T*=r,S*=r),f(T,S);const{cursor:x}=u;if(m.has(" ")&&x){const O=Number(u.over.style.height.slice(0,-2));u.setSelect({left:x.left<c?x.left:c,top:0,width:Math.abs(x.left-(c??x.left)),height:O},!1)}p=C,window.requestAnimationFrame(E)},h=C=>{if(C.key==="Tab"){u.setCursor({left:-5,top:-5});return}if(!g.has(C.key))return;if(C.preventDefault(),C.stopPropagation(),!m.has(C.key)){const b=m.size===0;m.add(C.key),c=C.key===" "&&c===null?u.cursor.left:c,b&&window.requestAnimationFrame(E)}},y=C=>{g.has(C.key)&&(m.delete(C.key),C.key===" "&&(C.preventDefault(),C.stopPropagation(),u.setSelect(u.select),c=null))},v=()=>{if(!o?.matches(":focus-visible"))return;const C=parseFloat(u.over.style.width),P=parseFloat(u.over.style.height);u.setCursor({left:C/2,top:P/2})},D=()=>{p=null,c=null,m.clear(),u.setSelect({left:0,top:0,width:0,height:0},!1)};o.addEventListener("keydown",h),o.addEventListener("keyup",y),o.addEventListener("focus",v),o.addEventListener("blur",D);const a=()=>{o?.removeEventListener("keydown",h),o?.removeEventListener("keyup",y),o?.removeEventListener("focus",v),o?.removeEventListener("blur",D),o=null};(u.hooks.destroy??=[]).push(a)},l=({config:u})=>((0,i.useLayoutEffect)(()=>u.addHook("init",d),[u]),null)},11921:(j,I,e)=>{"use strict";e.d(I,{_:()=>a,i:()=>v});var t=e(42844),n=e(27702),i=e(93562),s=e(79248),r=e(61965),g=e(93666),d=e(75578),l=e(21609),u=e(29241),o=e(99025),m=e(64167),c=e(66310),p=e(52995),f=e(73014),E=e(97695),h=e(48473);const y=10,v=({mode:P=m.f3.Single,sortOrder:b=m.As.None,sync:M,timeZone:T,config:S,renderTooltip:x,...O})=>{const B=(0,n.useRef)(),A=(0,c.l4)(),[V,W]=(0,n.useState)(null),[w,N]=(0,n.useState)(null),[F,k]=(0,n.useState)([]),[H,R]=(0,n.useState)(null),[_,G]=(0,n.useState)(!1),Y=(0,i.Z)();let X=null;const Q="TooltipPlugin",se=(0,c.wW)(C);if((0,n.useEffect)(()=>{(0,h.Zp)(Q,!0,`Focused series: ${V}, focused point: ${w}`)},[w,V]),(0,n.useLayoutEffect)(()=>{let ne;const ge=()=>{Y()&&(G(!0),B.current?.root.classList.add("plot-active"))},ae=()=>{Y()&&(R(null),G(!1),B.current?.root.classList.remove("plot-active"))};S.addHook("syncRect",(De,he)=>ne=he),S.addHook("init",De=>{B.current=De,De.over.addEventListener("mouseenter",ge),De.over.addEventListener("mouseleave",ae),X=De.root.closest("[tabindex]"),X&&(X.addEventListener("focus",ge),X.addEventListener("blur",ae)),M&&M()===s.m.Crosshair&&De.root.classList.add("shared-crosshair")});const re=S.getTooltipInterpolator();return re?S.addHook("setCursor",De=>{re(W,N,he=>{if(he){R(null);return}if(!ne)return;const{x:ye,y:ce}=a(De,ne);ye!==void 0&&ce!==void 0&&R({x:ye,y:ce})},De)}):(S.addHook("setLegend",De=>{Y()&&(N(De.legend.idx),k(De.legend.idxs.slice()))}),S.addHook("setCursor",De=>{if(!ne||!Y())return;const{x:he,y:ye}=a(De,ne);R(he!==void 0&&ye!==void 0?{x:he,y:ye}:null)}),S.addHook("setSeries",(De,he)=>{Y()&&W(he)})),()=>{R(null),B.current&&(B.current.over.removeEventListener("mouseleave",ae),B.current.over.removeEventListener("mouseenter",ge),X&&(X.removeEventListener("focus",ge),X.removeEventListener("blur",ae)))}},[S,R,G,N,k]),w===null||!_&&M&&M()===s.m.Crosshair)return null;let Z=O.data.fields[0];if(!Z)return null;const le=Z.display||(0,r.U)({field:Z,timeZone:T,theme:A});let oe=null,q=le(Z.values[w]).text;if(x)oe=x(O.data,V,w);else{if(P===m.f3.Single&&V!==null){const ne=O.data.fields[V];if(!ne)return null;const ge=F?.[V]??w;q=le(Z.values[ge]).text;const re=(ne.display||(0,r.U)({field:ne,timeZone:T,theme:A}))(ne.values[ge]);oe=n.createElement(f.c,{series:[{color:re.color||g.R,label:(0,d.CZ)(ne,O.data,O.frames),value:re?(0,l.zc)(re):null}],timestamp:q})}if(P===m.f3.Multi){let ne=[];const ge=O.data,ae=ge.fields,re=[];for(let De=0;De<ae.length;De++){const he=ge.fields[De];if(!he||he===Z||he.type===u.fS.time||he.type!==u.fS.number||he.config.custom?.hideFrom?.tooltip||he.config.custom?.hideFrom?.viz)continue;const ye=O.data.fields[De].values[F[De]],ce=he.display(ye);re.push(ye),ne.push({color:ce.color||g.R,label:(0,d.CZ)(he,ge,O.frames),value:ce?(0,l.zc)(ce):null,isActive:V===De})}if(b!==m.As.None){const De=[...ne],he=o.sortValues(b);ne.sort((ye,ce)=>{const We=De.indexOf(ye),ke=De.indexOf(ce);return he(re[We],re[ke])})}oe=n.createElement(f.c,{series:ne,timestamp:q})}}return n.createElement(p.h_,{className:_?se.tooltipWrapper:void 0},oe&&H&&n.createElement(E.S,{position:{x:H.x,y:H.y},offset:{x:y,y}},oe))};function D({left:P,top:b},M){return P===void 0||b===void 0?!1:P<0||P>M.width||b<0||b>M.height}function a(P,b){let M,T;const S=P.cursor.left||0,x=P.cursor.top||0;if(D(P.cursor,b)){const O=P.posToIdx(S);if(x<0||x>b.height){let B=(0,h.ah)(P,O);B&&(T=b.top+B,S>=0&&S<=b.width&&(M=b.left+P.valToPos(P.data[0][P.posToIdx(S)],P.series[0].scale)))}}else M=b.left+S,T=b.top+x;return{x:M,y:T}}const C=P=>({tooltipWrapper:(0,t.css)({"z-index":P.zIndex.portal+1+" !important"})})},67151:(j,I,e)=>{"use strict";e.d(I,{R:()=>s});var t=e(27702),n=e(48473);const i=5,s=({onZoom:r,config:g})=>((0,t.useLayoutEffect)(()=>{g.addHook("setSelect",d=>{const l=d.posToVal(d.select.left,"x"),u=d.posToVal(d.select.left+d.select.width,"x");d.select.width>=i&&((0,n.Zp)("ZoomPlugin",!1,"selected",{min:l,max:u,bbox:{left:d.bbox.left/window.devicePixelRatio+d.select.left,top:d.bbox.top/window.devicePixelRatio,height:d.bbox.height/window.devicePixelRatio,width:d.select.width}}),r({from:l,to:u})),d.setSelect({left:0,width:0},!1)}),g.setCursor({bind:{dblclick:d=>()=>{let l=d.scales.x;const u=l.min,o=l.max,m=(o-u)/2;return r({from:u-m,to:o+m}),null}}})},[g]),null)},42059:(j,I,e)=>{"use strict";e.d(I,{Cm:()=>i.C,Rb:()=>t.R,ii:()=>n.i});var t=e(67151),n=e(11921),i=e(28482)},67463:(j,I,e)=>{"use strict";e.d(I,{L:()=>t});class t{constructor(i){this.props=i}}},48473:(j,I,e)=>{"use strict";e.d(I,{Bj:()=>f,Kq:()=>c,Zp:()=>D,ah:()=>E,i7:()=>p,qt:()=>o});var t=e(29241),n=e(95381),i=e(64167),s=e(46414),r=e(12343),g=e(90537);const d=/\b(YYYY|YY|MMMM|MMM|MM|M|DD|D|WWWW|WWW|HH|H|h|AA|aa|a|mm|m|ss|s|fff)\b/g;function l(a){return a.replace(d,C=>`{${C}}`)}const u=(a,C,P)=>{let b=C%2?P[0]||P[2]:P[1]||P[3];return P[C]||!b?0:8},o={ms:1,focus:{alpha:1},cursor:{focus:{prox:30}},legend:{show:!1},padding:[u,u,u,u],series:[],hooks:{}};var m=(a=>(a[a.Pos=1]="Pos",a[a.Neg=-1]="Neg",a))(m||{});function c(a){let C=[],{series:P,dir:b}=a,M=P.length-1,T=P.slice().reverse();return T.forEach((S,x)=>{if(x!==M){let O=T[x+1];C.push({series:[S,O],dir:-1*b})}}),C}function p(a){let C=new Map;return a.fields.forEach(({config:P,values:b,type:M},T)=>{if(T===0)return;let{custom:S}=P;if(S==null||S.hideFrom?.viz)return;let{stacking:x}=S;if(x==null)return;let{mode:O,group:B}=x;if(O===i.o0.None)return;let A=S.transform,V=h(A,b),W=S.drawStyle,w=W===i.l8.Bars?S.barAlignment:W===i.l8.Line?S.lineInterpolation:null,N=`${V}|${O}|${B}|${(0,g.z1)(P,M)}|${W}|${w}`,F=C.get(N);F==null&&(F={series:[],dir:V},C.set(N,F)),F.series.push(T)}),[...C.values()]}function f(a,C,P){let b=Array(a.fields.length),M=C.length,T=a.length,S=M>0?Array(T).fill(0):[],x=M>0?Array(T).fill(!1):[],O=Array.from({length:M},()=>S.slice()),B=Array.from({length:M},()=>x.slice());if(C.forEach((A,V)=>{let W=B[V];A.series.forEach(w=>{let N=a.fields[w];if(N.config.custom?.hideFrom?.viz)return;let F=N.values;for(let k=0;k<T;k++)F[k]!=null&&(W[k]=!0)})}),a.fields.forEach((A,V)=>{let W=A.values;if(V===0){A.type===t.fS.time?b[V]=(0,n.J_)(A).values:b[V]=W;return}let{custom:w}=A.config;if(!w||w.hideFrom?.viz){b[V]=W;return}if(w.transform===i.pR.Constant){let F=W.findIndex(H=>H!=null),k=W[F];W=Array(W.length).fill(void 0),W[F]=k}else if(W=W.slice(),w.transform===i.pR.NegativeY)for(let F=0;F<W.length;F++)W[F]!=null&&(W[F]*=-1);let N=w.stacking?.mode;if(!N||N===i.o0.None)b[V]=W;else{let F=C.findIndex(_=>_.series.indexOf(V)>-1),k=O[F],H=B[F],R=b[V]=Array(T);for(let _=0;_<T;_++){let G=W[_];G!=null?R[_]=k[_]+=G:R[_]=H[_]?k[_]:G}}}),P){let A=b.map((V,W)=>{let w=C.findIndex(N=>N.series.indexOf(W)>-1);return w!==-1?O[w]:V});P({totals:A})}return a.fields.forEach((A,V)=>{if(V===0||A.config.custom?.hideFrom?.viz)return;if(A.config.custom?.stacking?.mode===i.o0.Percent){let w=C.findIndex(H=>H.series.indexOf(V)>-1),N=O[w],F=C[w],k=b[V];for(let H=0;H<T;H++){let R=k[H];R!=null&&(k[H]=N[H]===0?0:F.dir*(R/N[H]))}}}),b}function E(a,C){let P,b=1,M=1,T=a.data[1][C],S=a.data[1][C];for(let x=1;x<a.data.length;x++){const B=a.data[x][C];B!=null&&(T==null?T=B:B>T&&(T=a.data[x][C],b=x),S==null?S=B:B<S&&(S=a.data[x][C],M=x))}return S==null&&T==null?P=void 0:S!=null&&T!=null?P=(a.valToPos(S,a.series[M].scale)+a.valToPos(T,a.series[b].scale))/2:P=a.valToPos(S||T,a.series[b||M].scale),P!==void 0&&P<0&&(P=a.bbox.height/devicePixelRatio),P}function h(a,C){const P=y(C);return a===i.pR.NegativeY?P?1:-1:P?-1:1}function y(a,C=100){const P=a.length;if(P===0)return!1;let b=0,M=P-1;for(;b<=M&&a[b]==null;)b++;for(;M>=b&&a[M]==null;)M--;let T=0,S=0;if(M>=b){const x=Math.max(1,Math.floor((M-b+1)/C));for(let O=b;O<=M;O+=x){const B=a[O];B!=null&&(B<0||Object.is(B,-0)?T++:B>0&&S++)}if(T>S)return!0}return!1}const v=(0,r.h)("uPlot"),D=v.logger;(0,s.x)("graphng",void 0,v)},65469:(j,I,e)=>{"use strict";e.r(I),e.d(I,{ALERTING_COLOR:()=>s.ns,AxisPlacement:()=>l.LB,BarAlignment:()=>l.pu,BarValueVisibility:()=>l.eU,BracesPlugin:()=>d.hP,ClearPlugin:()=>d.Gp,ClipboardPlugin:()=>d.wl,DEFAULT_ANNOTATION_COLOR:()=>s.Jx,DOMUtil:()=>s.Qi,DrawStyle:()=>l.$6,EventsWithValidation:()=>s.JU,GlobalStyles:()=>r.nz,GraphGradientMode:()=>l.FI,GraphTresholdsStyleMode:()=>l.i3,IndentationPlugin:()=>d.Rc,LegendDisplayMode:()=>l.jK,LineInterpolation:()=>l.KC,NO_DATA_COLOR:()=>s._V,NewlinePlugin:()=>d.z2,NodeGraphDataFrameFieldNames:()=>s.zG,OK_COLOR:()=>s.te,PENDING_COLOR:()=>s.f7,PointVisibility:()=>l.mv,REGION_FILL_ALPHA:()=>s.iV,ReactUtils:()=>s.Ot,RunnerPlugin:()=>d.dv,SCHEMA:()=>s.Yi,ScaleDirection:()=>l.bQ,ScaleOrientation:()=>l.wN,SearchFunctionType:()=>s.nu,SelectionShortcutsPlugin:()=>d.$L,SlatePrism:()=>d.Ze,StackingMode:()=>l.o0,SuggestionsPlugin:()=>d.bm,TableCellDisplayMode:()=>l.h2,ThemeContext:()=>r.Ni,TooltipDisplayMode:()=>l.f3,ansicolor:()=>s._J,attachDebugger:()=>s.xq,calculateFontSize:()=>s.MX,colors:()=>s.O9,commonOptionsBuilder:()=>g.q,createLogger:()=>s.hu,fuzzyMatch:()=>s.C6,getCanvasContext:()=>s.AE,getCellLinks:()=>s.iu,getScrollbarWidth:()=>s.np,getTagColor:()=>s.vm,getTagColorIndexFromName:()=>s.tu,getTagColorsFromName:()=>s.Bx,getTextColorForAlphaBackground:()=>s.bM,getTextColorForBackground:()=>s.Gc,getTheme:()=>r.gh,hasValidationEvent:()=>s.z3,isCompactUrl:()=>s.go,linkModelToContextMenuItems:()=>s.Rc,makeFragment:()=>s.xl,makeValue:()=>s.l1,measureText:()=>s.X1,mockTheme:()=>r.Zu,mockThemeContext:()=>r.sJ,regexValidation:()=>s.FE,sortedColors:()=>s.Wm,styleMixins:()=>r.GU,stylesFactory:()=>r.Bb,useForceUpdate:()=>s.NW,useStyles:()=>r.yK,useStyles2:()=>r.wW,useTheme:()=>r.Fg,useTheme2:()=>r.l4,validate:()=>s.Gu,withTheme:()=>r.Zz,withTheme2:()=>r.HE});var t=e(82367),i={};for(const u in t)u!=="default"&&(i[u]=()=>t[u]);e.d(I,i);var n=e(74032),i={};for(const u in n)["default","Alert","AlertingSettings","AsyncMultiSelect","AsyncSelect","AsyncVirtualizedSelect","AutoSaveField","AutoSizeInput","Badge","BarGauge","BarGaugeDisplayMode","BigValue","BigValueColorMode","BigValueGraphMode","BigValueJustifyMode","BigValueTextMode","BrowserLabel","Button","ButtonCascader","ButtonGroup","ButtonSelect","CallToActionCard","Card","CardContainer","Cascader","CertificationKey","Checkbox","ClickOutsideWrapper","ClipboardButton","CodeEditor","CodeEditorSuggestionItemKind","CollapsableSection","Collapse","ColorPicker","ColorPickerInput","ConfirmButton","ConfirmModal","Container","ContextMenu","ControlledCollapse","Counter","CustomHeadersSettings","CustomScrollbar","DataLinkButton","DataLinkInput","DataLinksContextMenu","DataLinksInlineEditor","DataSourceHttpSettings","DatePicker","DatePickerWithInput","DateTimePicker","DeleteButton","Divider","Drawer","Dropdown","DropdownIndicator","EmptySearchResult","ErrorBoundary","ErrorBoundaryAlert","ErrorWithStack","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","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","MultiSelect","PageToolbar","Pagination","PanelChrome","PanelChromeErrorIndicator","PanelChromeLoadingIndicator","PanelContainer","PanelContextProvider","PanelContextRoot","PlotLegend","PluginSignatureBadge","Popover","PopoverController","Portal","PortalContainer","QueryField","RadioButtonGroup","RadioButtonList","RangeSlider","ReactMonacoEditor","RefreshPicker","RelativeTimeRangePicker","RenderUserContentAsHTML","ScaleDistribution","SecretInput","SecretTextArea","SecureSocksProxySettings","Segment","SegmentAsync","SegmentInput","SegmentSection","SegmentSelect","Select","SelectContainer","SeriesColorPicker","SeriesColorPickerPopover","SeriesColorPickerPopoverWithTheme","SeriesIcon","SeriesTable","SeriesTableRow","SeriesVisibilityChangeBehavior","SeriesVisibilityChangeMode","SetInterval","SlideOutTransition","Slider","Sparkline","Spinner","StatsPicker","Switch","TLSAuthSettings","Tab","TabContent","TabbedContainer","Table","TableInputCSV","TabsBar","Tag","TagList","TagsInput","TextArea","TextLink","TimeOfDayPicker","TimePickerTooltip","TimeRangeInput","TimeRangeLabel","TimeRangePicker","TimeSeries","TimeZonePicker","Toggletip","ToolbarButton","ToolbarButtonRow","Tooltip","TooltipPlugin","UPLOT_AXIS_FONT_SIZE","UPlotChart","UPlotConfigBuilder","UnitPicker","UserIcon","ValuePicker","VerticalGroup","VerticalTab","VirtualizedSelect","VizLayout","VizLegend","VizLegendListItem","VizRepeater","VizTooltip","VizTooltipContainer","WeekStartPicker","WithContextMenu","XYCanvas","ZoomPlugin","buildScaleKey","clearButtonStyles","convertOldAngularValueMapping","defaultIntervals","fieldMatchersUI","getCardStyles","getInputStyles","getPortalContainer","getSelectStyles","graphFieldOptions","graphTickFormatter","graphTimeFormat","preparePlotFrame","resetSelectStyles","sharedInputStyle","sharedSingleStatMigrationHandler","sharedSingleStatPanelChangedHandler","useGraphNGContext","usePanelContext","variableSuggestionToCodeEditorSuggestion","withErrorBoundary"].indexOf(u)<0&&(i[u]=()=>n[u]);e.d(I,i);var s=e(42129),r=e(57907),g=e(74603),d=e(58387),l=e(19080)},53387:(j,I,e)=>{"use strict";e.d(I,{Y:()=>p,r:()=>o});var t=e(27702),n=e(29241),i=e(27001),s=e(64167),r=e(55219),g=e(40705),d=e(22209),l=e(28580),u=e(1128);function o(f,E,h){const y=["Axis"];f.addRadio({path:"axisPlacement",name:"Placement",category:y,defaultValue:r.q.axisPlacement[0].value,settings:{options:r.q.axisPlacement}}).addTextInput({path:"axisLabel",name:"Label",category:y,defaultValue:"",settings:{placeholder:"Optional text"},showIf:v=>v.axisPlacement!==s.LB.Hidden,shouldApply:v=>v.type!==n.fS.time&&v.type!==n.fS.string}).addNumberInput({path:"axisWidth",name:"Width",category:y,settings:{placeholder:"Auto"},showIf:v=>v.axisPlacement!==s.LB.Hidden}).addRadio({path:"axisGridShow",name:"Show grid lines",category:y,defaultValue:void 0,settings:{options:[{value:void 0,label:"Auto"},{value:!0,label:"On"},{value:!1,label:"Off"}]}}).addRadio({path:"axisColorMode",name:"Color",category:y,defaultValue:s.yK.Text,settings:{options:[{value:s.yK.Text,label:"Text"},{value:s.yK.Series,label:"Series"}]}}),f.addCustomEditor({id:"scaleDistribution",path:"scaleDistribution",name:"Scale",category:y,editor:p,override:p,defaultValue:{type:s.wf.Linear},shouldApply:v=>v.type===n.fS.number,process:i.kG}).addBooleanSwitch({path:"axisCenteredZero",name:"Centered zero",category:y,defaultValue:!1,showIf:v=>v.scaleDistribution?.type!==s.wf.Log}).addNumberInput({path:"axisSoftMin",name:"Soft min",defaultValue:E.axisSoftMin,category:y,settings:{placeholder:"See: Standard options > Min"}}).addNumberInput({path:"axisSoftMax",name:"Soft max",defaultValue:E.axisSoftMax,category:y,settings:{placeholder:"See: Standard options > Max"}})}const m=[{label:"Linear",value:s.wf.Linear},{label:"Logarithmic",value:s.wf.Log},{label:"Symlog",value:s.wf.Symlog}],c=[{label:"2",value:2},{label:"10",value:10}],p=({value:f,onChange:E})=>{const h=f?.type??s.wf.Linear,y=f?.log??2;return t.createElement(t.Fragment,null,t.createElement("div",{style:{marginBottom:16}},t.createElement(g.S,{value:h,options:m,onChange:v=>{E({...f,type:v,log:v===s.wf.Linear?void 0:y})}})),(h===s.wf.Log||h===s.wf.Symlog)&&t.createElement(d.g,{label:"Log base"},t.createElement(l.Ph,{options:c,value:y,onChange:v=>{E({...f,log:v.value})}})),h===s.wf.Symlog&&t.createElement(d.g,{label:"Linear threshold"},t.createElement(u.I,{placeholder:"1",value:f?.linearThreshold,onChange:v=>{E({...f,linearThreshold:Number(v.currentTarget.value)})}})))}},56617:(j,I,e)=>{"use strict";e.d(I,{B:()=>d});var t=e(89949),n=e.n(t),i=e(27702),s=e(64022),r=e(81520);const g=({value:l,onChange:u})=>{const o=(0,i.useCallback)(m=>{u({...l,[m]:!l[m]})},[l,u]);return i.createElement(s.Lh,{spacing:"xs"},Object.keys(l).map(m=>{const c=m;return i.createElement(r.B,{icon:l[c]?"eye-slash":"eye",onClick:()=>o(c),key:c,label:(0,t.startCase)(c),selected:l[c]})}))};function d(l){l.addCustomEditor({id:"hideFrom",name:"Hide in area",category:["Series"],path:"hideFrom",defaultValue:{tooltip:!1,viz:!1,legend:!1},editor:g,override:g,shouldApply:()=>!0,hideFromDefaults:!0,process:u=>u})}},1505:(j,I,e)=>{"use strict";e.d(I,{J:()=>i});var t=e(41199),n=e(64167);function i(s,r=!0){s.addBooleanSwitch({path:"legend.showLegend",name:"Visibility",category:["Legend"],description:"",defaultValue:!0}).addRadio({path:"legend.displayMode",name:"Mode",category:["Legend"],description:"",defaultValue:n.jK.List,settings:{options:[{value:n.jK.List,label:"List"},{value:n.jK.Table,label:"Table"}]},showIf:g=>g.legend.showLegend}).addRadio({path:"legend.placement",name:"Placement",category:["Legend"],description:"",defaultValue:"bottom",settings:{options:[{value:"bottom",label:"Bottom"},{value:"right",label:"Right"}]},showIf:g=>g.legend.showLegend}).addNumberInput({path:"legend.width",name:"Width",category:["Legend"],settings:{placeholder:"Auto"},showIf:g=>g.legend.showLegend&&g.legend.placement==="right"}),r&&s.addCustomEditor({id:"legend.calcs",path:"legend.calcs",name:"Values",category:["Legend"],description:"Select values or calculations to show in legend",editor:t.S.get("stats-picker").editor,defaultValue:[],settings:{allowMultiple:!0},showIf:g=>g.legend.showLegend!==!1})}},8658:(j,I,e)=>{"use strict";e.d(I,{V:()=>m,n:()=>o});var t=e(27702),n=e(27001),i=e(29241),s=e(64167),r=e(64022),g=e(40705),d=e(1128),l=e(67437),u=e(55219);const o=({value:c,context:p,onChange:f,item:E})=>t.createElement(r.Lh,null,t.createElement(g.S,{value:c?.mode||s.o0.None,options:E.settings.options,onChange:h=>{f({...c,mode:h})}}),p.isOverride&&c?.mode&&c?.mode!==s.o0.None&&t.createElement(d.I,{type:"text",placeholder:"Group",suffix:t.createElement(l.h,{name:"question-circle",tooltip:"Name of the stacking group",tooltipPlacement:"top"}),defaultValue:c?.group,onChange:h=>{f({...c,group:h.currentTarget.value.trim()})}}));function m(c,p,f=["Graph styles"]){c.addCustomEditor({id:"stacking",path:"stacking",name:"Stack series",category:f,defaultValue:p,editor:o,override:o,settings:{options:u.q.stacking},process:n.kG,shouldApply:E=>E.type===i.fS.number})}},77148:(j,I,e)=>{"use strict";e.d(I,{Z:()=>t});function t(n,i=!0){i&&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})}},74928:(j,I,e)=>{"use strict";e.d(I,{L:()=>n});var t=e(64167);function n(i,s=!1){const r=["Tooltip"],g=s?[{value:t.f3.Single,label:"Single"},{value:t.f3.None,label:"Hidden"}]:[{value:t.f3.Single,label:"Single"},{value:t.f3.Multi,label:"All"},{value:t.f3.None,label:"Hidden"}],d=[{value:t.As.None,label:"None"},{value:t.As.Ascending,label:"Ascending"},{value:t.As.Descending,label:"Descending"}];i.addRadio({path:"tooltip.mode",name:"Tooltip mode",category:r,defaultValue:"single",settings:{options:g}}).addRadio({path:"tooltip.sort",name:"Values sort order",category:r,defaultValue:t.As.None,showIf:l=>l.tooltip?.mode===t.f3.Multi,settings:{options:d}})}},74603:(j,I,e)=>{"use strict";e.d(I,{q:()=>t});var t={};e.r(t),e.d(t,{ScaleDistributionEditor:()=>n.Y,StackingEditor:()=>d.n,addAxisConfig:()=>n.r,addHideFrom:()=>i.B,addLegendOptions:()=>s.J,addStackingConfig:()=>d.V,addTextSizeOptions:()=>g.Z,addTooltipOptions:()=>r.L});var n=e(53387),i=e(56617),s=e(1505),r=e(74928),g=e(77148),d=e(8658)},19080:(j,I,e)=>{"use strict";e.d(I,{$6:()=>t.l8,FI:()=>t.FI,KC:()=>t.KC,LB:()=>t.LB,bQ:()=>t.bQ,eU:()=>t.Jp,f3:()=>t.f3,h2:()=>t.h2,i3:()=>t.i3,jK:()=>t.jK,mv:()=>t.Jp,o0:()=>t.o0,pu:()=>t.pu,wN:()=>t.wN});var t=e(64167)},45485:(j,I,e)=>{"use strict";e.d(I,{h:()=>s});var t=e(66117);const n={"[":"]","{":"}","(":")"},i="brace_match";function s(){return{onKeyDown(r,g,d){const{value:l}=g;switch(r.key){case"(":case"{":case"[":{const{start:{offset:u,key:o},end:{offset:m,key:c},focus:{offset:p}}=l.selection,f=l.focusText.text;if(l.selection.isExpanded)return r.preventDefault(),g.insertTextByKey(o,u,r.key).insertTextByKey(c,m+1,n[r.key]).moveEndBackward(1),!0;if(p===f.length||f[p]===" "||Object.values(n).includes(f[p])){r.preventDefault();const E=n[r.key],h={key:`${i}-${(0,t.Z)()}`,type:`${i}-${E}`,anchor:{key:o,offset:u,object:"point"},focus:{key:c,offset:m+1,object:"point"},object:"annotation"};return g.insertText(r.key).insertText(E).addAnnotation(h).moveBackward(1),!0}break}case")":case"}":case"]":{const u=l.anchorText.text,o=l.selection.anchor.offset,m=u[o],c=r.key,p=`${i}-${c}`,f=l.annotations.find(E=>E?.type===p&&E.anchor.key===l.anchorText.key);if(f&&m===c&&!l.selection.isExpanded)return r.preventDefault(),g.moveFocusForward(1).removeAnnotation(f).moveAnchorForward(1),!0;break}case"Backspace":{const u=l.anchorText.text,o=l.selection.anchor.offset,m=u[o-1],c=u[o];if(n[m]&&n[m]===c)return r.preventDefault(),g.deleteBackward(1).deleteForward(1).focus(),!0}default:break}return d()}}}},3508:(j,I,e)=>{"use strict";e.d(I,{G:()=>t});function t(){return{onKeyDown(n,i,s){const r=i.value;if(r.selection.isExpanded)return s();if(n.key==="k"&&n.ctrlKey){n.preventDefault();const g=r.anchorText.text,d=r.selection.anchor.offset,u=g.length-d;return i.deleteForward(u),!0}return s()}}}},73146:(j,I,e)=>{"use strict";e.d(I,{w:()=>i});const t=(s,r,g)=>{if(!s.length)return;const d=s.slice(0,-1).join("").length+s.length-1;return s.join(` `).slice(r,d+g)},n=s=>s?.replace(/[\uFEFF]/g,"");function i(){const s={onCopy(r,g,d){r.preventDefault();const{document:l,selection:u}=g.value,{start:{offset:o},end:{offset:m}}=u,c=l.getLeafBlocksAtRange(u).toArray().map(f=>f.text),p=n(t(c,o,m));return p&&r.clipboardData&&r.clipboardData.setData("Text",p),!0},onPaste(r,g,d){if(r.preventDefault(),r.clipboardData){const u=n(r.clipboardData.getData("Text"))?.split(` `);if(u&&u.length){g.insertText(u[0]);for(const o of u.slice(1))g.splitBlock().insertText(o)}}return!0}};return{...s,onCut(r,g,d){return s.onCopy(r,g,d),g.deleteAtRange(g.value.selection),!0}}}},44687:(j,I,e)=>{"use strict";e.d(I,{R:()=>o});var t=e(94038),n=e(45273),i=e(10418);const s=(0,t.TB)("mod+["),r=(0,t.TB)("shift+tab"),g=(0,t.TB)("mod+]"),d=" ",l=(m,c,p)=>{const{startBlock:f,endBlock:E,selection:{start:{offset:h,key:y},end:{offset:v,key:D}}}=c.value;if(i.Z.serialize(c.value)==="")return;m.preventDefault();const a=f.getFirstText();a&&h===0&&y===a.key&&v===a.text.length&&D===a.key||!f.equals(E)?u(c,"right"):c.insertText(d)},u=(m,c)=>{const p=m.value.selection,f=m.value.document.getLeafBlocksAtRange(p).toArray();if(c==="left")for(const E of f){const h=E.text.length-E.text.trimLeft().length,y=E.getFirstText().key,v={anchor:{key:y,offset:h,path:[]},focus:{key:y,offset:h,path:[]}};m.deleteBackwardAtRange(n.e6.create(v),Math.min(d.length,h))}else{const{startText:E}=m.value,h=E.text.slice(0,p.start.offset),y=/^\s*$/.test(h);for(const v of f)m.insertTextByKey(v.getFirstText().key,0,d);y&&m.moveStartBackward(d.length)}};function o(){return{onKeyDown(m,c,p){if(s(m)||r(m))m.preventDefault(),u(c,"left");else if(g(m))m.preventDefault(),u(c,"right");else if(m.key==="Tab")l(m,c,p);else return p();return!0}}}},58387:(j,I,e)=>{"use strict";e.d(I,{$L:()=>d.$,Gp:()=>n.G,Rc:()=>s.R,Ze:()=>l.Z,bm:()=>u.b,dv:()=>g.d,hP:()=>t.h,wl:()=>i.w,z2:()=>r.z});var t=e(45485),n=e(3508),i=e(73146),s=e(44687),r=e(96662),g=e(93702),d=e(16646),l=e(54916),u=e(14524)},96662:(j,I,e)=>{"use strict";e.d(I,{z:()=>n});function t(i){let s=i.length-i.trimLeft().length;if(s){let r=i[0];for(;--s;)r+=i[0];return r}return""}function n(){return{onKeyDown(i,s,r){const g=s.value;if(g.selection.isExpanded)return r();if(i.key==="Enter"){i.preventDefault();const{startBlock:d}=g,l=d.text,u=t(l);return s.splitBlock().insertText(u).focus()}return r()}}}},93702:(j,I,e)=>{"use strict";e.d(I,{d:()=>t});function t({handler:n}){return{onKeyDown(i,s,r){return n&&i.key==="Enter"&&(i.shiftKey||i.ctrlKey)?(i.preventDefault(),n(i),s):r()}}}},16646:(j,I,e)=>{"use strict";e.d(I,{$:()=>i});var t=e(94038);const n=(0,t.TB)("mod+l");function i(){return{onKeyDown(s,r,g){if(n(s)){s.preventDefault();const{focusBlock:d,document:l}=r.value;r.moveAnchorToStartOfBlock(),l.getNextBlock(d.key)?r.moveFocusToStartOfNextBlock():r.moveFocusToEndOfText()}else return g();return!0}}}},38399:(j,I,e)=>{"use strict";e.d(I,{Z:()=>n});const n="prism-token"},54916:(j,I,e)=>{"use strict";e.d(I,{Z:()=>c,a:()=>h});var t=e(6570),n=e.n(t),i=e(45273),s=e(38399),r=e(77592),g=e(27702);function d(y){return y.object==="block"&&y.type==="code_block"}function l(y){return"javascript"}function u(y,v,D){const{decoration:a}=y;if(a.type!==s.Z)return D();const C=a.data.get("className");return g.createElement("span",{className:C},y.children)}class o extends(0,r.Record)({onlyIn:d,getSyntax:l,renderDecoration:u}){constructor(v){super(v)}}const m=o;function c(y={},v=n().languages){const D=new m(y);return{decorateNode:(a,C,P)=>{if(!D.onlyIn(a))return P();const b=i.gO.create(a),M=D.getSyntax(b),T=v[M];if(!T)return[];const x=b.getTexts().map(V=>V&&V.getText()).join(` `),O=n().tokenize(x,T),B=h(O),A=C.value.data.set("tokens",B);return C.setData(A),p(D,O,b)},renderDecoration:(a,C,P)=>D.renderDecoration({children:a.children,decoration:a.decoration},C,P)}}function p(y,v,D){const a=D.getTexts(),C=[];let P=0,b=0;return a.forEach(M=>{b=P+M.getText().length;let T=0;function S(x,O){if(typeof x=="string"){if(O){const B=f({text:M,textStart:P,textEnd:b,start:T,end:T+x.length,className:`prism-token token ${O}`,block:D});B&&C.push(B)}T+=x.length}else if(O=`${O} ${x.type}`,x.alias&&(O+=" "+x.alias),typeof x.content=="string"){const B=f({text:M,textStart:P,textEnd:b,start:T,end:T+x.content.length,className:`prism-token token ${O}`,block:D});B&&C.push(B),T+=x.content.length}else for(let B=0;B<x.content.length;B+=1)S(x.content[B],O)}v.forEach(S),P=b+1}),C}function f({text:y,textStart:v,textEnd:D,start:a,end:C,className:P,block:b}){return a>=D||C<=v?null:(a=Math.max(a,v),C=Math.min(C,D),a-=v,C-=v,b.createDecoration({object:"decoration",anchor:{key:y.key,offset:a,object:"point"},focus:{key:y.key,offset:C,object:"point"},type:s.Z,data:{className:P}}))}function E(y){return typeof y=="string"?[{content:y,types:[],aliases:[]}]:Array.isArray(y)?y.flatMap(v=>E(v)):y instanceof n().Token?E(y.content).flatMap(v=>{let D=[];return typeof y.alias=="string"?D=[y.alias]:D=y.alias??[],{content:v.content,types:[y.type,...v.types],aliases:[...D,...v.aliases]}}):[]}function h(y){const v=E(y);if(!v.length)return[];const D=v[0];D.prev=null,D.next=v.length>=2?v[1]:null,D.offsets={start:0,end:D.content.length};for(let C=1;C<v.length-1;C++)v[C].prev=v[C-1],v[C].next=v[C+1],v[C].offsets={start:v[C-1].offsets.end,end:v[C-1].offsets.end+v[C].content.length};const a=v[v.length-1];return a.prev=v.length>=2?v[v.length-2]:null,a.next=null,a.offsets={start:v.length>=2?v[v.length-2].offsets.end:0,end:v.length>=2?v[v.length-2].offsets.end+a.content.length:a.content.length},v}},14524:(j,I,e)=>{"use strict";e.d(I,{b:()=>A});var t=e(89949),n=e(27702),i=e(27473),s=e(25472),r=e(66310),g=e(34568),d=e(60494);const l=W=>W.reduce((w,{items:N,label:F})=>(w.push({label:F,kind:g.c.GroupTitle}),N.reduce((k,H)=>(k.push(H),k),w)),[]),u=W=>W.reduce((w,N)=>w.length<N.label.length?N.label:w,""),o=(W,w,N)=>{const F=(0,d.Z)(N,{font:W.typography.fontFamilyMonospace,fontSize:W.typography.bodySmall.fontSize,fontWeight:"normal"}),k=c(F.width,W),H=m(F.height,W),R=p(H,w);return{listWidth:k,listHeight:R,itemHeight:H}},m=(W,w)=>{const N=w.spacing.gridSize*2;return W+N},c=(W,w)=>{const N=w.spacing.gridSize*3,F=800;return Math.min(Math.max(W+N,200),F)},p=(W,w)=>{const N=Math.min(w.length,10),F=100,k=N*W;return Math.max(k,F)};var f=e(42844),E=e(18112);const h=(W,w,N)=>({typeaheadItem:(0,f.css)({label:"type-ahead-item",zIndex:11,padding:W.spacing(1,1,1,2),border:W.colors.border.medium,overflowY:"scroll",overflowX:"hidden",outline:"none",background:W.colors.background.secondary,color:W.colors.text.secondary,boxShadow:`0 0 20px ${W.v1.colors.dropdownShadow}`,visibility:N===!0?"visible":"hidden",width:"250px",minHeight:`${w+parseInt(W.spacing(.25),10)}px`,position:"relative",wordBreak:"break-word"})}),y=({item:W,height:w})=>{const N=W&&!!W.documentation,F=W?W.label:"",k=(0,E.a)(W?.documentation),H=(0,r.l4)(),R=h(H,w,N);return n.createElement("div",{className:(0,f.cx)([R.typeaheadItem])},n.createElement("b",null,F),n.createElement("hr",null),n.createElement("div",{dangerouslySetInnerHTML:{__html:k}}))};var v=e(3819),D=e.n(v),a=e(77709);const C=W=>({typeaheadItem:(0,f.css)({border:"none",background:"none",textAlign:"left",label:"type-ahead-item",height:"auto",fontFamily:W.typography.fontFamilyMonospace,padding:W.spacing(1,1,1,2),fontSize:W.typography.bodySmall.fontSize,textOverflow:"ellipsis",overflow:"hidden",zIndex:11,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)"}),typeaheadItemSelected:(0,f.css)({label:"type-ahead-item-selected",backgroundColor:W.colors.background.secondary}),typeaheadItemMatch:(0,f.css)({label:"type-ahead-item-match",color:W.v1.palette.yellow,borderBottom:`1px solid ${W.v1.palette.yellow}`,padding:"inherit",background:"inherit"}),typeaheadItemGroupTitle:(0,f.css)({label:"type-ahead-item-group-title",color:W.colors.text.secondary,fontSize:W.typography.bodySmall.fontSize,lineHeight:W.typography.body.lineHeight,padding:W.spacing(1)})}),P=W=>{const w=(0,r.wW)(C),{isSelected:N,item:F,prefix:k,style:H,onMouseEnter:R,onMouseLeave:_,onClickItem:G}=W,Y=N?(0,f.cx)([w.typeaheadItem,w.typeaheadItemSelected]):(0,f.cx)([w.typeaheadItem]),X=(0,f.cx)([w.typeaheadItemMatch]),Q=(0,f.cx)([w.typeaheadItemGroupTitle]),se=F.label||"";return F.kind===g.c.GroupTitle?n.createElement("li",{className:Q,style:H},n.createElement("span",null,se)):n.createElement("li",{role:"none"},n.createElement("button",{role:"menuitem",className:Y,style:H,onMouseDown:G,onMouseEnter:R,onMouseLeave:_,type:"button"},F.highlightParts!==void 0?n.createElement(a.H,{text:se,highlightClassName:X,highlightParts:F.highlightParts}):n.createElement(D(),{textToHighlight:se,searchWords:[k??""],autoEscape:!0,highlightClassName:X})))},b=(W,w)=>W-w*Math.floor(W/w);class M extends n.PureComponent{constructor(){super(...arguments),this.listRef=(0,n.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 w=l(this.props.groupedItems),N=u(w),{listWidth:F,listHeight:k,itemHeight:H}=o(this.context,w,N);this.setState({listWidth:F,listHeight:k,itemHeight:H,allItems:w})},this.componentWillUnmount=()=>{document.removeEventListener("selectionchange",this.handleSelectionChange)},this.handleSelectionChange=()=>{this.forceUpdate()},this.componentDidUpdate=(w,N)=>{if(this.state.typeaheadIndex!==null&&N.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,t.isEqual)(w.groupedItems,this.props.groupedItems)===!1){const F=l(this.props.groupedItems),k=u(F),{listWidth:H,listHeight:R,itemHeight:_}=o(this.context,F,k);this.setState({listWidth:H,listHeight:R,itemHeight:_,allItems:F,typeaheadIndex:null})}},this.onMouseEnter=w=>{this.setState({hoveredItem:w})},this.onMouseLeave=()=>{this.setState({hoveredItem:null})},this.moveMenuIndex=w=>{const N=this.state.allItems.length;if(N){const F=this.state.typeaheadIndex||0;let k=b(F+w,N);this.state.allItems[k].kind===g.c.GroupTitle&&(k=b(k+w,N)),this.setState({typeaheadIndex:k});return}},this.insertSuggestion=()=>{this.props.onSelectSuggestion&&this.state.typeaheadIndex!==null&&this.props.onSelectSuggestion(this.state.allItems[this.state.typeaheadIndex])}}get menuPosition(){if(!window.getSelection)return"";const w=window.getSelection(),N=w&&w.anchorNode;if(N&&N.parentElement){const F=N.parentElement.getBoundingClientRect(),k=window.scrollX,H=window.scrollY;return`position: absolute; display: flex; top: ${F.top+H+F.height+6}px; left: ${F.left+k-2}px`}return""}render(){const{prefix:w,isOpen:N=!1,origin:F}=this.props,{allItems:k,listWidth:H,listHeight:R,itemHeight:_,hoveredItem:G,typeaheadIndex:Y}=this.state,X=G||Y,Q=k[G||Y||0];return n.createElement(T,{origin:F,isOpen:N,style:this.menuPosition},n.createElement("ul",{role:"menu",className:"typeahead","data-testid":"typeahead"},n.createElement(s.t7,{ref:this.listRef,itemCount:k.length,itemSize:_,itemKey:se=>{const Z=k&&k[se];return Z?`${se}-${Z.label}`:`${se}`},width:H,height:R},({index:se,style:Z})=>{const le=k&&k[se];return le?n.createElement(P,{onClickItem:()=>this.props.onSelectSuggestion?this.props.onSelectSuggestion(le):{},isSelected:Y===null?!1:k[Y]===le,item:le,prefix:w,style:Z,onMouseEnter:()=>this.onMouseEnter(se),onMouseLeave:this.onMouseLeave}):null})),X&&n.createElement(y,{height:R,item:Q}))}}M.contextType=r.Ni;class T extends n.PureComponent{constructor(w){super(w);const{index:N=0,origin:F="query",style:k}=w;this.node=document.createElement("div"),this.node.setAttribute("style",k),this.node.classList.add("slate-typeahead",`slate-typeahead-${F}-${N}`),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"),i.createPortal(this.props.children,this.node)):(this.node.classList.remove("slate-typeahead--open"),null)}}var S=e(80553),x=e(95704),O=e(38399);const B=250;function A({onTypeahead:W,cleanText:w,onWillApplySuggestion:N,portalOrigin:F}){let k,H={groupedItems:[],typeaheadPrefix:"",typeaheadContext:"",typeaheadText:""};const R=(0,t.debounce)(V,B),_=G=>{H={...H,...G}};return{onBlur:(G,Y,X)=>(H={...H,groupedItems:[]},X()),onClick:(G,Y,X)=>(H={...H,groupedItems:[]},X()),onKeyDown:(G,Y,X)=>{const se=H.groupedItems.length;switch(G.key){case"Escape":{if(se)return G.preventDefault(),H={...H,groupedItems:[]},Y.insertText("");break}case"ArrowDown":case"ArrowUp":if(se){G.preventDefault(),k.moveMenuIndex(G.key==="ArrowDown"?1:-1);return}break;case"Enter":{if(!(G.shiftKey||G.ctrlKey)&&se)return G.preventDefault(),k.insertSuggestion();break}case"Tab":{if(se)return G.preventDefault(),k.insertSuggestion();break}default:{G.key.length===1&&R(Y,_,W,w);break}}return X()},commands:{selectSuggestion:(G,Y)=>{const X=H.groupedItems;if(!X||!X.length)return G;const Q=G.applyTypeahead(Y);return R(G,_,W,w),Q},applyTypeahead:(G,Y)=>{let X=Y.insertText||Y.label;const Q=Y.kind==="function",se=Y.move||0,Z=se>0?se:0,le=se<0?-se:0,{typeaheadPrefix:oe,typeaheadText:q,typeaheadContext:ne}=H;N&&(X=N(X,{groupedItems:H.groupedItems,typeaheadContext:ne,typeaheadPrefix:oe,typeaheadText:q}));const ge=Y.deleteBackwards||oe.length,re=(w?w(q):q).length-oe.length,De=q.indexOf(oe),ye=oe&&(re>0&&De>-1||X===q)&&!Q?re+De:0;if(X.match(/\n/)){const ce=(0,S.xl)(X);return G.deleteBackward(ge).deleteForward(ye).insertFragment(ce).focus(),G}return H={...H,groupedItems:[]},G.snapshotSelection().deleteBackward(ge).deleteForward(ye).insertText(X).moveForward(Z).moveBackward(le).focus(),G}},renderEditor(G,Y,X){if(Y.value.selection.isExpanded)return X();const Q=X();return n.createElement(n.Fragment,null,Q,n.createElement(M,{menuRef:se=>k=se,origin:F,prefix:H.typeaheadPrefix,isOpen:!!H.groupedItems.length,groupedItems:H.groupedItems,onSelectSuggestion:Y.selectSuggestion}))}}}const V=async(W,w,N,F)=>{if(!N)return;const{value:k}=W,{selection:H}=k,R=k.document.getClosestBlock(k.focusBlock.key),_=k.selection.start.offset-1,G=R&&R.getDecorations(W),Y=G?G.filter(ae=>ae.start.offset<=_&&ae.end.offset>_&&ae.type===O.Z).toArray():[],X=G&&G.filter(ae=>ae.end.offset<=_&&ae.type===O.Z&&ae.data.get("className").includes("label-key")).last(),Q=X&&k.focusText.text.slice(X.start.offset,X.end.offset),se=Y.map(ae=>ae.data.get("className")).join(" ").split(" ").filter(ae=>ae.length);let Z=k.focusText.text,le=Z.slice(0,H.focus.offset);Y.length&&(Z=k.focusText.text.slice(Y[0].start.offset,Y[0].end.offset),le=k.focusText.text.slice(Y[0].start.offset,H.focus.offset));const oe=le.match(/(?:!?=~?"?|")(.*)/);oe?le=oe[1]:F&&(le=F(le));const{suggestions:q,context:ne}=await N({prefix:le,text:Z,value:k,wrapperClasses:se,labelKey:Q||void 0,editor:W}),ge=q.map(ae=>{if(!ae.items)return ae;const re=ae.searchFunctionType||(ae.prefixMatch?x.Z.Prefix:x.Z.Word),De=x.n[re];let he={...ae};return le&&(ae.skipFilter||(he.items=he.items.filter(ye=>(ye.filterText||ye.label).length>=le.length),he.items=De(he.items,le)),he.items=he.items.filter(ye=>!(ye.insertText===le||(ye.filterText??ye.label)===le))),ae.skipSort||(he.items=(0,t.sortBy)(he.items,ye=>ye.sortText===void 0?ye.sortValue!==void 0?ye.sortValue:ye.label:ye.sortText||ye.label)),he}).filter(ae=>ae.items&&ae.items.length);w({groupedItems:ge,typeaheadPrefix:le,typeaheadContext:ne,typeaheadText:Z}),W.blur().focus()}},29223:(j,I,e)=>{"use strict";e.d(I,{n:()=>p});var t=e(76808),n=e(27702),i=e(66310);function s(f){return(0,t.css)({".panel-options-group":{borderBottom:`1px solid ${f.colors.border.weak}`},".panel-options-group__header":{padding:f.spacing(1,2,1,1),position:"relative",display:"flex",alignItems:"center",cursor:"pointer",fontWeight:500,color:f.colors.text.primary,"&:hover":{background:f.colors.emphasize(f.colors.background.primary,.03)}},".panel-options-group__icon":{color:f.colors.text.secondary,marginRight:f.spacing(1),padding:f.spacing(0,.9,0,.6)},".panel-options-group__title":{position:"relative"},".panel-options-group__body":{padding:f.spacing(1,2,1,4)}})}function r(f){return(0,t.css)({".card-section":{marginBottom:f.spacing(4)},".card-list":{display:"flex",flexDirection:"row",flexWrap:"wrap",listStyleType:"none"},".card-item":{display:"block",height:"100%",background:f.colors.background.secondary,boxShadow:"none",padding:f.spacing(2),borderRadius:"4px","&:hover":{background:f.colors.emphasize(f.colors.background.secondary,.03)},".label-tag":{marginLeft:f.spacing(1),fontSize:"11px",padding:"2px 6px"}},".card-item-body":{display:"flex",overflow:"hidden"},".card-item-details":{overflow:"hidden"},".card-item-header":{marginBottom:f.spacing(2)},".card-item-type":{color:f.colors.text.secondary,textTransform:"uppercase",fontSize:f.typography.size.sm,fontWeight:f.typography.fontWeightMedium},".card-item-badge":{margin:"6px 0"},".card-item-notice":{fontSize:f.typography.size.sm},".card-item-name":{color:f.colors.text.primary,overflow:"hidden",textOverflow:"ellipsis",width:"100%"},".card-item-label":{marginLeft:f.spacing(1)},".card-item-sub-name":{color:f.colors.text.secondary,overflow:"hidden",textOverflow:"ellipsis",width:"100%"},".card-item-sub-name--header":{color:f.colors.text.secondary,textTransform:"uppercase",marginBottom:f.spacing(2),fontSize:f.typography.size.sm,fontWeight:"bold"},".card-list-layout-grid":{".card-item-type":{display:"inline-block"},".card-item-notice":{fontSize:f.typography.size.sm,display:"inline-block",marginLeft:f.spacing(2)},".card-item-header-action":{float:"right"},".card-item-wrapper":{width:"100%",padding:f.spacing(0,2,2,0)},".card-item-wrapper--clickable":{cursor:"pointer"},".card-item-figure":{margin:f.spacing(0,2,2,0),height:"80px",img:{width:"80px"}},".card-item-name":{fontSize:f.typography.h3.fontSize},[f.breakpoints.up("md")]:{".card-item-wrapper":{width:"50%"}},[f.breakpoints.up("lg")]:{".card-item-wrapper":{width:"33.333333%"}},"&.card-list-layout-grid--max-2-col":{[f.breakpoints.up("lg")]:{".card-item-wrapper":{width:"50%"}}}},".card-list-layout-list":{".card-item-wrapper":{padding:0,width:"100%",marginBottom:f.spacing(1)},".card-item-wrapper--clickable":{cursor:"pointer"},".card-item":{borderRadius:"2px"},".card-item-header":{float:"right",textAlign:"right"},".card-item-figure":{margin:f.spacing(0,2,0,0),img:{width:"48px"}},".card-item-name":{fontSize:f.typography.h4.fontSize},".card-item-sub-name":{fontSize:f.typography.size.sm},".layout-selector":{marginRight:0}}})}var g=e(97289);function d(f){return(0,t.css)({html:{MsOverflowStyle:"scrollbar",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",height:"100%",fontSize:`${f.typography.htmlFontSize}px`,fontFamily:f.typography.fontFamily,lineHeight:f.typography.body.lineHeight,fontKerning:"normal"},":root":{colorScheme:f.colors.mode},body:{height:"100%",width:"100%",position:"absolute",color:f.colors.text.primary,backgroundColor:f.colors.background.canvas,...l(f.typography.body)},"h1, .h1":l(f.typography.h1),"h2, .h2":l(f.typography.h2),"h3, .h3":l(f.typography.h3),"h4, .h4":l(f.typography.h4),"h5, .h5":l(f.typography.h5),"h6, .h6":l(f.typography.h6),p:{margin:f.spacing(0,0,2)},button:{letterSpacing:f.typography.body.letterSpacing,"&:focus-visible":(0,g.getFocusStyles)(f),"&:focus":{outline:"none"}},small:{fontSize:f.typography.bodySmall.fontSize},"b, strong":{fontWeight:f.typography.fontWeightMedium},em:{fontStyle:"italic",color:f.colors.text.primary},cite:{fontStyle:"normal"},".muted":{color:f.colors.text.secondary},"a.muted:hover, a.muted:focus":{color:f.colors.text.primary},".text-warning":{color:f.colors.warning.text,"&:hover, &:focus":{color:f.colors.emphasize(f.colors.warning.text,.15)}},".text-error":{color:f.colors.error.text,"&:hover, &:focus":{color:f.colors.emphasize(f.colors.error.text,.15)}},".text-success":{color:"$success-text-color","&:hover, &:focus":{color:f.colors.emphasize(f.colors.success.text,.15)}},a:{cursor:"pointer",color:f.colors.text.primary,textDecoration:"none","&:focus":{outline:"none"},"&:focus-visible":(0,g.getFocusStyles)(f),"&:[disabled]":{cursor:"default",pointerEvents:"none !important"}},".text-link":{textDecoration:"underline"},".text-left":{textAlign:"left"},".text-right":{textAlign:"right"},".text-center":{textAlign:"center"},".highlight-search-match":{background:f.components.textHighlight.background,color:f.components.textHighlight.text,padding:0}})}function l(f){return{margin:0,fontSize:f.fontSize,lineHeight:f.lineHeight,fontWeight:f.fontWeight,letterSpacing:f.letterSpacing,fontFamily:f.fontFamily,marginBottom:"0.45em"}}function u(f){return(0,t.css)({"iframe.intercom-borderless-frame":{colorScheme:f.colors.mode}})}function o(f){return(0,t.css)({"input, button, select, textarea":{fontFamily:f.typography.body.fontFamily,fontSize:f.typography.body.fontSize,fontWeight:f.typography.body.fontWeight,lineHeight:f.typography.body.lineHeight},"input, select":{backgroundColor:f.components.input.background,color:f.components.input.text,border:"none",boxShadow:"none"},textarea:{height:"auto"},"input[type='file'], input[type='image'], input[type='submit'], input[type='reset'], input[type='button'], input[type='radio'], input[type='checkbox']":{width:"auto"}})}function m(f){return(0,t.css)({})}function c(f){const E=f.breakpoints.values.xxl+f.spacing.gridSize*2+f.components.sidemenu.width;return(0,t.css)({".grafana-app":{display:"flex",alignItems:"stretch",position:"absolute",width:"100%",height:"100%",top:0,left:0},".main-view":{position:"relative",display:"flex",flexDirection:"column",flexGrow:1,height:"100%",flex:"1 1 0",minWidth:0},".page-scrollbar-content":{display:"flex",minHeight:"100%",flexDirection:"column",width:"100%",height:"100%"},".page-container":{flexGrow:1,flexBasis:"100%",paddingLeft:f.spacing(2),paddingRight:f.spacing(2),[f.breakpoints.up("sm")]:{margin:f.spacing(0,1)},[f.breakpoints.up("md")]:{margin:f.spacing(0,2)},[`@media (min-width: ${E}px)`]:{maxWidth:`${f.breakpoints.values.xxl}px`,marginLeft:"auto",marginRight:"auto",width:"100%"}},".page-full":{marginLeft:f.spacing(2),paddingLeft:f.spacing(2),paddingRight:f.spacing(2)},".page-body":{padding:f.spacing(1),background:f.components.panel.background,border:`1px solid ${f.components.panel.borderColor}`,marginBottom:"32px",[f.breakpoints.up("md")]:{padding:f.spacing(2)},[f.breakpoints.up("lg")]:{padding:f.spacing(3)}},".page-heading":{fontSize:f.typography.h4.fontSize,marginTop:0,marginBottom:f.spacing(2)},".page-action-bar":{marginBottom:f.spacing(2),display:"flex",alignItems:"flex-start",gap:f.spacing(2)},".page-action-bar--narrow":{marginBottom:0},".page-action-bar__spacer":{width:f.spacing(2),flexGrow:1},".page-sub-heading":{marginBottom:f.spacing(2)},".page-sub-heading-icon":{marginLeft:f.spacing(1),marginTop:f.spacing(.5)},".page-hidden":{display:"none"}})}function p(){const f=(0,i.l4)();return n.createElement(t.Global,{styles:[d(f),u(f),o(f),c(f),r(f),s(f),m(f)]})}},66310:(j,I,e)=>{"use strict";e.d(I,{Fg:()=>m,HE:()=>o,Ni:()=>l,Zz:()=>u,l4:()=>c,sJ:()=>E,wW:()=>f,yK:()=>p});var t=e(43313),n=e.n(t),i=e(27702),s=e(45540),r=e(80402);let g=null;const d=new WeakMap,l=i.createContext((0,s.j)());l.displayName="ThemeContext";const u=h=>{const y=v=>{const D=g||l;return i.createElement(D.Consumer,null,a=>i.createElement(h,{...v,theme:a.v1}))};return y.displayName=`WithTheme(${h.displayName})`,n()(y,h),y},o=h=>{const y=v=>{const D=g||l;return i.createElement(D.Consumer,null,a=>i.createElement(h,{...v,theme:a}))};return y.displayName=`WithTheme(${h.displayName})`,n()(y,h),y};function m(){return(0,i.useContext)(g||l).v1}function c(){return(0,i.useContext)(g||l)}function p(h){const y=m();let v=d.get(h);return v||(v=(0,r.B)(h),d.set(h,v)),v(y)}function f(h){const y=c();let v=d.get(h);return v||(v=(0,r.B)(h),d.set(h,v)),v(y)}const E=h=>(g=i.createContext(h),()=>{g=null})},57907:(j,I,e)=>{"use strict";e.d(I,{nz:()=>d.n,Ni:()=>t.Ni,gh:()=>s,Zu:()=>r,sJ:()=>t.sJ,GU:()=>l,Bb:()=>g.B,yK:()=>t.yK,wW:()=>t.wW,Fg:()=>t.Fg,l4:()=>t.l4,Zz:()=>t.Zz,HE:()=>t.HE});var t=e(66310),n=e(45540);let i;const s=(u="dark")=>i?i(u):(0,n.j)({colors:{mode:u}}).v1,r=u=>(i=u,()=>{i=null});var g=e(80402),d=e(29223),l=e(97289)},97289:(j,I,e)=>{"use strict";e.r(I),e.d(I,{cardChrome:()=>n,focusCss:()=>l,getFocusStyles:()=>o,getMouseFocusStyles:()=>u,getTooltipContainerStyles:()=>m,hoverColor:()=>i,listItem:()=>s,listItemSelected:()=>r,mediaUp:()=>g});var t=e(71685);function n(c){return` background: ${c.colors.background.secondary}; &:hover { background: ${i(c.colors.background.secondary,c)}; } box-shadow: ${c.components.panel.boxShadow}; border-radius: ${c.shape.radius.default}; `}function i(c,p){return p.isDark?(0,t.Z)(c).brighten(2).toString():(0,t.Z)(c).darken(2).toString()}function s(c){return` background: ${c.colors.background.secondary}; &:hover { background: ${i(c.colors.background.secondary,c)}; } box-shadow: ${c.components.panel.boxShadow}; border-radius: ${c.shape.radius.default}; `}function r(c){return` background: ${i(c.colors.background.secondary,c)}; color: ${c.colors.text.maxContrast}; `}function g(c){return`only screen and (min-width: ${c})`}const d=c=>c.hasOwnProperty("v1"),l=c=>{const p=d(c),f=p?c.colors.background.canvas:c.colors.bodyBg,E=p?c.colors.primary.main:c.colors.formFocusOutline;return` outline: 2px dotted transparent; outline-offset: 2px; box-shadow: 0 0 0 2px ${f}, 0 0 0px 4px ${E}; transition-property: outline, outline-offset, box-shadow; transition-duration: 0.2s; transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);`};function u(c){return{outline:"none",boxShadow:"none"}}function o(c){return{outline:"2px dotted transparent",outlineOffset:"2px",boxShadow:`0 0 0 2px ${c.colors.background.canvas}, 0 0 0px 4px ${c.colors.primary.main}`,transitionTimingFunction:"cubic-bezier(0.19, 1, 0.22, 1)",transitionDuration:"0.2s",transitionProperty:"outline, outline-offset, box-shadow"}}const m=c=>({overflow:"hidden",background:c.colors.background.secondary,boxShadow:c.shadows.z2,maxWidth:"800px",padding:c.spacing(1),borderRadius:c.shape.radius.default,zIndex:c.zIndex.tooltip})},80402:(j,I,e)=>{"use strict";e.d(I,{B:()=>n});var t=e(82152);function n(i){return(0,t.Z)(i)}},34568:(j,I,e)=>{"use strict";e.d(I,{c:()=>t});var t=(n=>(n.GroupTitle="GroupTitle",n))(t||{})},6276:()=>{},4680:(j,I,e)=>{"use strict";e.d(I,{BI:()=>i,WZ:()=>r,e7:()=>s,iJ:()=>t.iJ});var t=e(8553),n=e(29241);const i=()=>Object.keys(t._S);function s(g){return r(g?.type)}function r(g){if(g)switch(g){case n.fS.time:return"clock-nine";case n.fS.string:return"font";case n.fS.number:return"calculator-alt";case n.fS.boolean:return"toggle-on";case n.fS.trace:return"info-circle";case n.fS.enum:return"list-ol";case n.fS.geo:return"map-marker";case n.fS.other:return"brackets-curly"}return"question-circle"}},74032:(j,I,e)=>{"use strict";e.r(I),e.d(I,{CompletionItemKind:()=>r.c,getAvailableIcons:()=>l.BI,getFieldTypeIcon:()=>l.e7,getFieldTypeIconName:()=>l.WZ,toIconName:()=>l.iJ});var t=e(10298),n=e.n(t),E={};for(const h in t)h!=="default"&&(E[h]=()=>t[h]);e.d(I,E);var i=e(9675),s=e.n(i),E={};for(const h in i)h!=="default"&&(E[h]=()=>i[h]);e.d(I,E);var r=e(34568),g=e(6276),d=e.n(g),E={};for(const h in g)["default","CompletionItemKind"].indexOf(h)<0&&(E[h]=()=>g[h]);e.d(I,E);var l=e(4680),u=e(69226),o=e.n(u),E={};for(const h in u)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","toIconName"].indexOf(h)<0&&(E[h]=()=>u[h]);e.d(I,E);var m=e(21134),c=e.n(m),E={};for(const h in m)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","toIconName"].indexOf(h)<0&&(E[h]=()=>m[h]);e.d(I,E);var p=e(80012),f=e.n(p),E={};for(const h in p)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","toIconName"].indexOf(h)<0&&(E[h]=()=>p[h]);e.d(I,E)},9675:()=>{},80012:()=>{},69226:()=>{},21134:()=>{},10298:()=>{},54826:(j,I,e)=>{"use strict";e.d(I,{i:()=>t});const t=(n,i)=>{n.key==="Tab"||n.altKey||n.ctrlKey||n.metaKey||(n.stopPropagation(),n.key==="Escape"&&i())}},5354:(j,I,e)=>{"use strict";e.d(I,{Gc:()=>E,Jx:()=>r,O9:()=>m,Wm:()=>y,_V:()=>l,bM:()=>h,f7:()=>u,iV:()=>o,ns:()=>d,te:()=>g});var t=e(89949),n=e.n(t),i=e(71685);const s=4,r="rgba(0, 211, 255, 1)",g="rgba(11, 237, 50, 1)",d="rgba(237, 46, 24, 1)",l="rgba(150, 150, 150, 1)",u="rgba(247, 149, 32, 1)",o=.09,m=["#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"];function c(v){const D=(0,t.map)(v,p),a=(0,t.sortBy)(D,["h"]),C=(0,t.chunk)(a,s),P=(0,t.map)(C,M=>(0,t.sortBy)(M,"l")),b=(0,t.flattenDeep)((0,t.zip)(...P));return(0,t.map)(b,f)}function p(v){return(0,i.Z)(v).toHsl()}function f(v){return(0,i.Z)(v).toHexString()}function E(v){return(0,i.Z)(v).getBrightness()>180?"rgb(32, 34, 38)":"rgb(247, 248, 250)"}function h(v,D){const a=(0,i.Z)(v),C=a.getBrightness();return a.getAlpha()<.3?D?"rgb(247, 248, 250)":"rgb(32, 34, 38)":C>180?"rgb(32, 34, 38)":"rgb(247, 248, 250)"}let y=c(m)},97902:(j,I,e)=>{"use strict";e.d(I,{R:()=>t,g:()=>n});const t=i=>i().map(s=>({label:s.title,ariaLabel:s.title,url:s.href,target:s.target,icon:`${s.target==="_blank"?"external-link-alt":"link"}`,onClick:s.onClick})),n=i=>/\/explore\?.*&(left|right)=\[(.*\,){2,}(.*){1}\]/.test(i)},46414:(j,I,e)=>{"use strict";e.d(I,{x:()=>t});function t(n,i,s){}},56160:(j,I,e)=>{"use strict";e.d(I,{O:()=>t});function t(n){const s=n.lastIndexOf("."),r=n.substring(s),g=n.substring(0,s);return g.length<16?n:`${g.substring(0,16)}...${r}`}},37221:(j,I,e)=>{"use strict";e.d(I,{C:()=>i});var t=e(89949),n=e.n(t);function i(s,r){let g=0,d=s.indexOf(r);r=r.replace(/\s/g,"");const l=[];if(d!==-1)return{distance:0,found:!0,ranges:[{start:d,end:d+r.length-1}]};for(const u of r){const o=s.indexOf(u,d);if(o===-1)return{distance:1/0,ranges:[],found:!1};if(d!==-1&&(g+=o-d),d=o+1,l.length===0)l.push({start:o,end:o});else{const m=(0,t.last)(l);o===m.end+1?m.end++:l.push({start:o,end:o})}}return{distance:g,ranges:l,found:!0}}},70610:(j,I,e)=>{"use strict";e.d(I,{c:()=>g,t:()=>l});var t=e(62937),n=e(27702),i=e(83399),s=e(92046);function r(){typeof t.ZP.options.resources!="object"&&t.ZP.use(i.Db).init({resources:{},returnEmptyString:!1,lng:"en-US"})}const g=u=>(r(),n.createElement(s.c,{...u})),d=t.ZP.t,l=(u,o,m)=>(r(),d(u,o,m))},42129:(j,I,e)=>{"use strict";e.d(I,{ns:()=>r.ns,Jx:()=>r.Jx,Qi:()=>t,JU:()=>g.JU,_V:()=>r._V,zG:()=>v,te:()=>r.te,f7:()=>r.f7,iV:()=>r.iV,Ot:()=>s,Yi:()=>d.Yi,nu:()=>f.Z,_J:()=>E._J,xq:()=>y.x,MX:()=>c.MX,O9:()=>r.O9,hu:()=>h.h,C6:()=>D.C,AE:()=>c.AE,iu:()=>m.i,np:()=>o.n,vm:()=>u.vm,tu:()=>u.tu,Bx:()=>u.Bx,bM:()=>r.bM,Gc:()=>r.Gc,z3:()=>g.z3,go:()=>l.g,Rc:()=>l.R,xl:()=>d.xl,l1:()=>d.l1,X1:()=>c.X1,FE:()=>g.FE,Wm:()=>r.Wm,NW:()=>p.N,Gu:()=>g.Gu});var t={};e.r(t),e.d(t,{getNextCharacter:()=>i,getPreviousCousin:()=>n}),typeof window<"u"&&"Element"in window&&!Element.prototype.closest&&(Element.prototype.closest=function(a){const C=(this.document||this.ownerDocument).querySelectorAll(a);let P=this,b;do{for(b=C.length;--b>=0&&C.item(b)!==P;);P=P.parentElement}while(b<0&&P);return P});function n(a,C){let P=a.parentElement.previousSibling,b;for(;P;){if(b=P.querySelector(C),b)return b;P=P.previousSibling}}function i(a){const C=(a||window).getSelection();if(!C||!C.anchorNode)return null;const P=C.getRangeAt(0),b=C.anchorNode.textContent,M=P.startOffset;return b.slice(M,M+1)}var s=e(66258),r=e(5354),g=e(61203),d=e(80553),l=e(97902),u=e(64714),o=e(28388),m=e(9451),c=e(11724),p=e(75340),f=e(95704),E=e(79690),h=e(12343),y=e(46414),v=(a=>(a.id="id",a.title="title",a.subTitle="subTitle",a.mainStat="mainStat",a.secondaryStat="secondaryStat",a.source="source",a.target="target",a.detail="detail__",a.arc="arc__",a.color="color",a))(v||{}),D=e(37221)},12343:(j,I,e)=>{"use strict";e.d(I,{h:()=>s});var t=e(89949),n=e.n(t);const i=(0,t.throttle)((...r)=>{console.log(...r)},500),s=r=>{let g=!1;return{logger:(d,l=!1,...u)=>{},enable:()=>g=!0,disable:()=>g=!1,isEnabled:()=>g}}},11724:(j,I,e)=>{"use strict";e.d(I,{AE:()=>r,MX:()=>d,X1:()=>g});let t;const n=new Map,i=500;let s="";function r(){return t||(t=document.createElement("canvas").getContext("2d")),t}function g(l,u,o=400){const m=`${o} ${u}px 'Inter'`,c=l+m,p=n.get(c);if(p)return p;const f=r();s!==m&&(f.font=s=m);const E=f.measureText(l);return n.size===i&&n.clear(),n.set(c,E),E}function d(l,u,o,m,c,p){const f=g(l,14,p),E=u/(f.width+2)*14,h=o/m,y=Math.min(h,E);return Math.min(y,c??y)}},66258:(j,I,e)=>{"use strict";e.r(I),e.d(I,{getChildId:()=>n,renderOrCallToRender:()=>i});var t=e(27702);function n(s){let r;const g=t.Children.only(s);return"id"in g?.props?r=g.props.id:"inputId"in g.props&&(r=g?.props.inputId),typeof r=="string"?r:void 0}function i(s,r){if(t.isValidElement(s)||typeof s=="string"||typeof s=="number")return s;if(typeof s=="function"&&r)return s(r);throw new Error(`${s} is not a React element nor a function that returns React element`)}},28388:(j,I,e)=>{"use strict";e.d(I,{n:()=>n});let t=null;function n(){if(t!==null)return t;if(typeof document<"u"){const i=document.createElement("div"),s={width:"100px",height:"100px",position:"absolute",top:"-9999px",overflow:"scroll",MsOverflowStyle:"scrollbar"};Object.keys(s).map(r=>{i.style[r]=s[r]}),document.body.appendChild(i),t=i.offsetWidth-i.clientWidth,document.body.removeChild(i)}else t=0;return t||0}},95704:(j,I,e)=>{"use strict";e.d(I,{Z:()=>n,n:()=>g});var t=e(37221),n=(d=>(d.Word="Word",d.Prefix="Prefix",d.Fuzzy="Fuzzy",d))(n||{});const g={Word:(d,l)=>d.filter(u=>(u.filterText||u.label).includes(l)),Prefix:(d,l)=>d.filter(u=>(u.filterText||u.label).startsWith(l)),Fuzzy:(d,l)=>(l=l.toLowerCase(),d.filter(u=>{const{distance:o,ranges:m,found:c}=(0,t.C)(u.label.toLowerCase(),l);return c?(u.sortValue=o,u.highlightParts=m,!0):!1}))}},80553:(j,I,e)=>{"use strict";e.d(I,{Yi:()=>n,l1:()=>s,xl:()=>i});var t=e(45273);const n={document:{nodes:[{match:[{type:"paragraph"},{type:"code_block"},{type:"code_line"}]}]},inlines:{}},i=(r,g)=>{const d=r.split(` `).map(u=>t.gO.create({type:"code_line",nodes:[t.xv.create(u)]})),l=t.gO.create({data:{syntax:g},type:"code_block",nodes:d});return t.BB.create({nodes:[l]})},s=(r,g)=>{const d=i(r,g);return t.B4.create({document:d})}},9451:(j,I,e)=>{"use strict";e.d(I,{i:()=>t});const t=(n,i)=>{let s;if(n.getLinks&&(s=n.getLinks({valueRowIndex:i.index})),!!s){for(let r=0;r<s?.length;r++)if(s[r].onClick){const g=s[r].onClick;s[r].onClick=d=>{d.ctrlKey||d.metaKey||d.shiftKey||(d.preventDefault(),g(d,{field:n,rowIndex:i.index}))}}return s}}},64714:(j,I,e)=>{"use strict";e.d(I,{Bx:()=>s,tu:()=>i,vm:()=>r});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 i(l=""){const u=g(l.toLowerCase());return Math.abs(u%t.length)}function s(l=""){const u=i(l);return r(u)}function r(l){return{color:t[l],borderColor:n[l]}}function g(l){let u=5381;for(let o=0;o<l.length;o++)u=(u<<5)+u+l.charCodeAt(o);return u}var d={getTagColorsFromName:s}},5723:(j,I,e)=>{"use strict";e.d(I,{k:()=>i});var t=e(42844),n=e(96750);function i(s,r,g,d,l){return{arrow:(0,t.css)({height:"1rem",width:"1rem",position:"absolute",pointerEvents:"none","&::before":{borderStyle:"solid",content:'""',display:"block",height:0,margin:"auto",width:0},"&::after":{borderStyle:"solid",content:'""',display:"block",height:0,margin:"auto",position:"absolute",width:0}}),container:(0,t.css)({backgroundColor:r,borderRadius:s.shape.radius.default,border:`1px solid ${g}`,boxShadow:s.shadows.z2,color:d,fontSize:s.typography.bodySmall.fontSize,padding:s.spacing(l.topBottom,l.rightLeft),transition:"opacity 0.3s",zIndex:s.zIndex.tooltip,maxWidth:"400px",overflowWrap:"break-word","&[data-popper-interactive='false']":{pointerEvents:"none"},"&[data-popper-placement*='bottom'] > div[data-popper-arrow='true']":{left:0,marginTop:"-7px",top:0,"&::before":{borderColor:`transparent transparent ${g} transparent`,borderWidth:"0 8px 7px 8px",position:"absolute",top:"-1px"},"&::after":{borderColor:`transparent transparent ${r} transparent`,borderWidth:"0 8px 7px 8px"}},"&[data-popper-placement*='top'] > div[data-popper-arrow='true']":{bottom:0,left:0,marginBottom:"-14px","&::before":{borderColor:`${g} transparent transparent transparent`,borderWidth:"7px 8px 0 7px",position:"absolute",top:"1px"},"&::after":{borderColor:`${r} transparent transparent transparent`,borderWidth:"7px 8px 0 7px"}},"&[data-popper-placement*='right'] > div[data-popper-arrow='true']":{left:0,marginLeft:"-10px","&::before":{borderColor:`transparent ${g} transparent transparent`,borderWidth:"7px 6px 7px 0"},"&::after":{borderColor:`transparent ${r} transparent transparent`,borderWidth:"6px 7px 7px 0",left:"2px",top:"1px"}},"&[data-popper-placement*='left'] > div[data-popper-arrow='true']":{marginRight:"-11px",right:0,"&::before":{borderColor:`transparent transparent transparent ${g}`,borderWidth:"7px 0 6px 7px"},"&::after":{borderColor:`transparent transparent transparent ${r}`,borderWidth:"6px 0 5px 5px",left:"1px",top:"1px"}},code:{border:"none",display:"inline",background:n.darken(r,.1),color:d},pre:{background:n.darken(r,.1),color:d},a:{color:d,textDecoration:"underline"},"a:hover":{textDecoration:"none"}}),headerClose:(0,t.css)({color:s.colors.text.secondary,position:"absolute",right:s.spacing(1),top:s.spacing(1.5),backgroundColor:"transparent",border:0}),header:(0,t.css)({paddingTop:s.spacing(1),paddingBottom:s.spacing(2)}),body:(0,t.css)({paddingTop:s.spacing(1),paddingBottom:s.spacing(1)}),footer:(0,t.css)({paddingTop:s.spacing(2),paddingBottom:s.spacing(1)})}}},75340:(j,I,e)=>{"use strict";e.d(I,{N:()=>n});var t=e(27702);function n(){const[i,s]=(0,t.useState)(0);return()=>s(r=>r+1)}},61203:(j,I,e)=>{"use strict";e.d(I,{FE:()=>s,Gu:()=>n,JU:()=>t,z3:()=>i});var t=(r=>(r.onBlur="onBlur",r.onFocus="onFocus",r.onChange="onChange",r))(t||{});const n=(r,g)=>{const d=g.reduce((l,u)=>u.rule(r)?l:l.concat(u.errorMessage),[]);return d.length>0?d:null},i=(r,g)=>g&&g[r],s=(r,g)=>({rule:d=>!!d.match(r),errorMessage:g||"Value is not valid"})},53327:(j,I,e)=>{"use strict";e.d(I,{z:()=>t});const t={Breadcrumbs:{breadcrumb:n=>`data-testid ${n} breadcrumb`},TimePicker:{openButton:"data-testid TimePicker Open Button",fromField:"Time Range from field",toField:"Time Range to field",applyTimeRange:"data-testid TimePicker submit button",calendar:{label:"Time Range calendar",openButton:"Open time range calendar",closeButton:"Close time range Calendar"},absoluteTimeRangeTitle:"data-testid-absolute-time-range-narrow"},DataSourcePermissions:{form:()=>'form[name="addPermission"]',roleType:"Role to add new permission to",rolePicker:"Built-in role picker",permissionLevel:"Permission Level"},DataSource:{TestData:{QueryTab:{scenarioSelectContainer:"Test Data Query scenario select container",scenarioSelect:"Test Data Query scenario select",max:"TestData max",min:"TestData min",noise:"TestData noise",seriesCount:"TestData series count",spread:"TestData spread",startValue:"TestData start value",drop:"TestData drop values"}},DataSourceHttpSettings:{urlInput:"Datasource HTTP settings url"},Jaeger:{traceIDInput:"Trace ID"},Prometheus:{configPage:{exemplarsAddButton:"Add exemplar config button",internalLinkSwitch:"Internal link switch"},exemplarMarker:"Exemplar marker"}},Menu:{MenuComponent:n=>`${n} menu`,MenuGroup:n=>`${n} menu group`,MenuItem:n=>`${n} menu item`,SubMenu:{container:"SubMenu container",icon:"SubMenu icon"}},Panels:{Panel:{title:n=>`data-testid Panel header ${n}`,headerItems:n=>`Panel header item ${n}`,menuItems:n=>`data-testid Panel menu item ${n}`,menu:n=>`data-testid Panel menu ${n}`,containerByTitle:n=>`${n} panel`,headerCornerInfo:n=>`Panel header ${n}`,loadingBar:()=>"Panel loading bar",HoverWidget:{container:"data-testid hover-header-container",dragIcon:"data-testid drag-icon"}},Visualization:{Graph:{container:"Graph container",VisualizationTab:{legendSection:"Legend section"},Legend:{legendItemAlias:n=>`gpl alias ${n}`,showLegendSwitch:"gpl show legend"},xAxis:{labels:()=>"div.flot-x-axis > div.flot-tick-label"}},BarGauge:{value:"Bar gauge value",valueV2:"data-testid Bar gauge value"},PieChart:{svgSlice:"Pie Chart Slice"},Text:{container:()=>".markdown-html"},Table:{header:"table header",footer:"table-footer"}}},VizLegend:{seriesName:n=>`VizLegend series ${n}`},Drawer:{General:{title:n=>`Drawer title ${n}`,expand:"Drawer expand",contract:"Drawer contract",close:"Drawer close",rcContentWrapper:()=>".rc-drawer-content-wrapper"}},PanelEditor:{General:{content:"Panel editor content"},OptionsPane:{content:"Panel editor option pane content",select:"Panel editor option pane select",fieldLabel:n=>`${n} field property editor`},DataPane:{content:"Panel editor data pane content"},applyButton:"data-testid Apply changes and go back to dashboard",toggleVizPicker:"data-testid toggle-viz-picker",toggleVizOptions:"data-testid toggle-viz-options",toggleTableView:"toggle-table-view",measureButton:"show measure tools"},PanelInspector:{Data:{content:"Panel inspector Data content"},Stats:{content:"Panel inspector Stats content"},Json:{content:"Panel inspector Json content"},Query:{content:"Panel inspector Query content",refreshButton:"Panel inspector Query refresh button",jsonObjectKeys:()=>".json-formatter-key"}},Tab:{title:n=>`Tab ${n}`,active:()=>'[class*="-activeTabStyle"]'},RefreshPicker:{runButton:"RefreshPicker run button",intervalButton:"RefreshPicker interval button",runButtonV2:"data-testid RefreshPicker run button",intervalButtonV2:"data-testid RefreshPicker interval button"},QueryTab:{content:"Query editor tab content",queryInspectorButton:"Query inspector button",queryHistoryButton:"Rich history button",addQuery:"Query editor add query button"},QueryHistory:{queryText:"Query text"},QueryEditorRows:{rows:"Query editor row"},QueryEditorRow:{actionButton:n=>`${n}`,title:n=>`Query editor row title ${n}`,container:n=>`Query editor row ${n}`},AlertTab:{content:"Alert editor tab content"},Alert:{alert:n=>`Alert ${n}`,alertV2:n=>`data-testid Alert ${n}`},TransformTab:{content:"data-testid Transform editor tab content",newTransform:n=>`data-testid New transform ${n}`,transformationEditor:n=>`data-testid Transformation editor ${n}`,transformationEditorDebugger:n=>`data-testid Transformation editor debugger ${n}`},Transforms:{card:n=>`data-testid New transform ${n}`,Reduce:{modeLabel:"Transform mode label",calculationsLabel:"Transform calculations label"},SpatialOperations:{actionLabel:"root Action field property editor",locationLabel:"root Location field property editor",location:{autoOption:"Auto location option",coords:{option:"Coords location option",latitudeFieldLabel:"root Latitude field field property editor",longitudeFieldLabel:"root Longitude field field property editor"},geohash:{option:"Geohash location option",geohashFieldLabel:"root Geohash field field property editor"},lookup:{option:"Lookup location option",lookupFieldLabel:"root Lookup field field property editor",gazetteerFieldLabel:"root Gazetteer field property editor"}}},searchInput:"search transformations",addTransformationButton:"data-testid add transformation button"},NavBar:{Configuration:{button:"Configuration"},Toggle:{button:"Toggle menu"},Reporting:{button:"Reporting"}},NavMenu:{item:"data-testid Nav menu item"},NavToolbar:{container:"data-testid Nav toolbar"},PageToolbar:{container:()=>".page-toolbar",item:n=>`${n}`,itemButton:n=>`data-testid ${n}`},QueryEditorToolbarItem:{button:n=>`QueryEditor toolbar item button ${n}`},BackButton:{backArrow:"Go Back"},OptionsGroup:{group:n=>n?`Options group ${n}`:"Options group",toggle:n=>n?`Options group ${n} toggle`:"Options group toggle"},PluginVisualization:{item:n=>`Plugin visualization item ${n}`,current:()=>'[class*="-currentVisualizationItem"]'},Select:{option:"Select option",input:()=>'input[id*="time-options-input"]',singleValue:()=>'div[class*="-singleValue"]'},FieldConfigEditor:{content:"Field config editor content"},OverridesConfigEditor:{content:"Field overrides editor content"},FolderPicker:{container:"Folder picker select container",containerV2:"data-testid Folder picker select container",input:"Select a folder"},ReadonlyFolderPicker:{container:"data-testid Readonly folder picker select container"},DataSourcePicker:{container:"data-testid Data source picker select container",input:()=>'input[id="data-source-picker"]',inputV2:"data-testid Select a data source"},TimeZonePicker:{container:"Time zone picker select container",containerV2:"data-testid Time zone picker select container"},WeekStartPicker:{container:"Choose starting day of the week",containerV2:"data-testid Choose starting day of the week",placeholder:"Choose starting day of the week"},TraceViewer:{spanBar:"data-testid SpanBar--wrapper"},QueryField:{container:"Query field"},QueryBuilder:{queryPatterns:"Query patterns",labelSelect:"Select label",valueSelect:"Select value",matchOperatorSelect:"Select match operator"},ValuePicker:{button:n=>`Value picker button ${n}`,select:n=>`Value picker select ${n}`},Search:{section:"Search section",sectionV2:"data-testid Search section",items:"Search items",itemsV2:"data-testid Search items",cards:"data-testid Search cards",collapseFolder:n=>`data-testid Collapse folder ${n}`,expandFolder:n=>`data-testid Expand folder ${n}`,dashboardItem:n=>`${t.Search.dashboardItems} ${n}`,dashboardCard:n=>`data-testid Search card ${n}`,folderHeader:n=>`data-testid Folder header ${n}`,folderContent:n=>`data-testid Folder content ${n}`,dashboardItems:"data-testid Dashboard search item"},DashboardLinks:{container:"data-testid Dashboard link container",dropDown:"data-testid Dashboard link dropdown",link:"data-testid Dashboard link"},LoadingIndicator:{icon:"Loading indicator"},CallToActionCard:{button:n=>`Call to action button ${n}`,buttonV2:n=>`data-testid Call to action button ${n}`},DataLinksContextMenu:{singleLink:"Data link"},CodeEditor:{container:"Code editor container"},DashboardImportPage:{textarea:"data-testid-import-dashboard-textarea",submit:"data-testid-load-dashboard"},ImportDashboardForm:{name:"data-testid-import-dashboard-title",submit:"data-testid-import-dashboard-submit"},PanelAlertTabContent:{content:"Unified alert editor tab content"},VisualizationPreview:{card:n=>`data-testid suggestion-${n}`},ColorSwatch:{name:"data-testid-colorswatch"},DashboardRow:{title:n=>`data-testid dashboard-row-title-${n}`},UserProfile:{profileSaveButton:"data-testid-user-profile-save",preferencesSaveButton:"data-testid-shared-prefs-save",orgsTable:"data-testid-user-orgs-table",sessionsTable:"data-testid-user-sessions-table"},FileUpload:{inputField:"data-testid-file-upload-input-field",fileNameSpan:"data-testid-file-upload-file-name"},DebugOverlay:{wrapper:"debug-overlay"},OrgRolePicker:{input:"Role"},AnalyticsToolbarButton:{button:"Dashboard insights"},Variables:{variableOption:"data-testid variable-option"},Annotations:{annotationsTypeInput:"annotations-type-input",annotationsChoosePanelInput:"choose-panels-input"}}},74639:(j,I,e)=>{"use strict";e.d(I,{wl:()=>i});var t=e(53327);const i={pages:{Login:{url:"/login",username:"Username input field",password:"Password input field",submit:"Login button",skip:"Skip change password button"},Home:{url:"/"},DataSource:{name:"Data source settings page name input field",delete:"Data source settings page Delete button",readOnly:"Data source settings page read only message",saveAndTest:"data-testid Data source settings page Save and Test button",alert:"Data source settings page Alert"},DataSources:{url:"/datasources",dataSources:s=>`Data source list item ${s}`},EditDataSource:{url:s=>`/datasources/edit/${s}`,settings:"Datasource settings page basic settings"},AddDataSource:{url:"/datasources/new",dataSourcePlugins:s=>`Data source plugin item ${s}`,dataSourcePluginsV2:s=>`Add new data source ${s}`},ConfirmModal:{delete:"data-testid Confirm Modal Danger Button"},AddDashboard:{url:"/dashboard/new",itemButton:s=>`data-testid ${s}`,addNewPanel:"Add new panel",addNewRow:"Add new row",addNewPanelLibrary:"Add new panel from panel library"},Dashboard:{url:s=>`/d/${s}`,DashNav:{nav:"Dashboard navigation",navV2:"data-testid Dashboard navigation",publicDashboardTag:"data-testid public dashboard tag"},SubMenu:{submenu:"Dashboard submenu",submenuItem:"data-testid template variable",submenuItemLabels:s=>`data-testid Dashboard template variables submenu Label ${s}`,submenuItemValueDropDownValueLinkTexts:s=>`data-testid Dashboard template variables Variable Value DropDown value link text ${s}`,submenuItemValueDropDownDropDown:"Variable options",submenuItemValueDropDownOptionTexts:s=>`data-testid Dashboard template variables Variable Value DropDown option text ${s}`,Annotations:{annotationsWrapper:"data-testid annotation-wrapper",annotationLabel:s=>`data-testid Dashboard annotations submenu Label ${s}`,annotationToggle:s=>`data-testid Dashboard annotations submenu Toggle ${s}`}},Settings:{Actions:{close:"data-testid dashboard-settings-close"},General:{deleteDashBoard:"Dashboard settings page delete dashboard button",sectionItems:s=>`Dashboard settings section item ${s}`,saveDashBoard:"Dashboard settings aside actions Save button",saveAsDashBoard:"Dashboard settings aside actions Save As button",timezone:"Time zone picker select container",title:"Tab General"},Annotations:{List:{addAnnotationCTA:t.z.CallToActionCard.button("Add annotation query"),addAnnotationCTAV2:t.z.CallToActionCard.buttonV2("Add annotation query")},Settings:{name:"Annotations settings name input"},NewAnnotation:{panelFilterSelect:"data-testid annotations-panel-filter",showInLabel:"show-in-label",previewInDashboard:"data-testid annotations-preview"}},Variables:{List:{addVariableCTA:t.z.CallToActionCard.button("Add variable"),addVariableCTAV2:t.z.CallToActionCard.buttonV2("Add variable"),newButton:"Variable editor New variable button",table:"Variable editor Table",tableRowNameFields:s=>`Variable editor Table Name field ${s}`,tableRowDefinitionFields:s=>`Variable editor Table Definition field ${s}`,tableRowArrowUpButtons:s=>`Variable editor Table ArrowUp button ${s}`,tableRowArrowDownButtons:s=>`Variable editor Table ArrowDown button ${s}`,tableRowDuplicateButtons:s=>`Variable editor Table Duplicate button ${s}`,tableRowRemoveButtons:s=>`Variable editor Table Remove button ${s}`},Edit:{General:{headerLink:"Variable editor Header link",modeLabelNew:"Variable editor Header mode New",modeLabelEdit:"Variable editor Header mode Edit",generalNameInput:"Variable editor Form Name field",generalNameInputV2:"data-testid Variable editor Form Name field",generalTypeSelect:"Variable editor Form Type select",generalTypeSelectV2:"data-testid Variable editor Form Type select",generalLabelInput:"Variable editor Form Label field",generalLabelInputV2:"data-testid Variable editor Form Label field",generalHideSelect:"Variable editor Form Hide select",generalHideSelectV2:"data-testid Variable editor Form Hide select",selectionOptionsMultiSwitch:"Variable editor Form Multi switch",selectionOptionsIncludeAllSwitch:"Variable editor Form IncludeAll switch",selectionOptionsCustomAllInput:"Variable editor Form IncludeAll field",selectionOptionsCustomAllInputV2:"data-testid Variable editor Form IncludeAll field",previewOfValuesOption:"Variable editor Preview of Values option",submitButton:"Variable editor Submit button",applyButton:"data-testid Variable editor Apply button"},QueryVariable:{queryOptionsDataSourceSelect:t.z.DataSourcePicker.container,queryOptionsRefreshSelect:"Variable editor Form Query Refresh select",queryOptionsRefreshSelectV2:"data-testid Variable editor Form Query Refresh select",queryOptionsRegExInput:"Variable editor Form Query RegEx field",queryOptionsRegExInputV2:"data-testid Variable editor Form Query RegEx field",queryOptionsSortSelect:"Variable editor Form Query Sort select",queryOptionsSortSelectV2:"data-testid Variable editor Form Query Sort select",queryOptionsQueryInput:"Variable editor Form Default Variable Query Editor textarea",valueGroupsTagsEnabledSwitch:"Variable editor Form Query UseTags switch",valueGroupsTagsTagsQueryInput:"Variable editor Form Query TagsQuery field",valueGroupsTagsTagsValuesQueryInput:"Variable editor Form Query TagsValuesQuery field"},ConstantVariable:{constantOptionsQueryInput:"Variable editor Form Constant Query field",constantOptionsQueryInputV2:"data-testid Variable editor Form Constant Query field"},DatasourceVariable:{datasourceSelect:"data-testid datasource variable datasource type"},TextBoxVariable:{textBoxOptionsQueryInput:"Variable editor Form TextBox Query field",textBoxOptionsQueryInputV2:"data-testid Variable editor Form TextBox Query field"},CustomVariable:{customValueInput:"data-testid custom-variable-input"},IntervalVariable:{intervalsValueInput:"data-testid interval variable intervals input"}}}},Annotations:{marker:"data-testid annotation-marker"}},Dashboards:{url:"/dashboards",dashboards:s=>`Dashboard search item ${s}`},SaveDashboardAsModal:{newName:"Save dashboard title field",save:"Save dashboard button"},SaveDashboardModal:{save:"Dashboard settings Save Dashboard Modal Save button",saveVariables:"Dashboard settings Save Dashboard Modal Save variables checkbox",saveTimerange:"Dashboard settings Save Dashboard Modal Save timerange checkbox"},SharePanelModal:{linkToRenderedImage:"Link to rendered image"},ShareDashboardModal:{shareButton:"Share dashboard or panel",PublicDashboard:{Tab:"Tab Public dashboard",WillBePublicCheckbox:"data-testid public dashboard will be public checkbox",LimitedDSCheckbox:"data-testid public dashboard limited datasources checkbox",CostIncreaseCheckbox:"data-testid public dashboard cost may increase checkbox",PauseSwitch:"data-testid public dashboard pause switch",EnableAnnotationsSwitch:"data-testid public dashboard on off switch for annotations",CreateButton:"data-testid public dashboard create button",DeleteButton:"data-testid public dashboard delete button",CopyUrlInput:"data-testid public dashboard copy url input",CopyUrlButton:"data-testid public dashboard copy url button",SettingsDropdown:"data-testid public dashboard settings dropdown",TemplateVariablesWarningAlert:"data-testid public dashboard disabled template variables alert",UnsupportedDataSourcesWarningAlert:"data-testid public dashboard unsupported data sources alert",NoUpsertPermissionsWarningAlert:"data-testid public dashboard no upsert permissions alert",EnableTimeRangeSwitch:"data-testid public dashboard on off switch for time range",EmailSharingConfiguration:{Container:"data-testid email sharing config container",ShareType:"data-testid public dashboard share type",EmailSharingInput:"data-testid public dashboard email sharing input",EmailSharingInviteButton:"data-testid public dashboard email sharing invite button",EmailSharingList:"data-testid public dashboard email sharing list",DeleteEmail:"data-testid public dashboard delete email button",ReshareLink:"data-testid public dashboard reshare link button"}}},PublicDashboard:{page:"public-dashboard-page",NotAvailable:{container:"public-dashboard-not-available",title:"public-dashboard-title",pausedDescription:"public-dashboard-paused-description"}},RequestViewAccess:{form:"request-view-access-form",recipientInput:"request-view-access-recipient-input",submitButton:"request-view-access-submit-button"},Explore:{url:"/explore",General:{container:"data-testid Explore",graph:"Explore Graph",table:"Explore Table",scrollView:"data-testid explorer scroll view"}},SoloPanel:{url:s=>`/d-solo/${s}`},PluginsList:{page:"Plugins list page",list:"Plugins list",listItem:"Plugins list item",signatureErrorNotice:"Unsigned plugins notice"},PluginPage:{page:"Plugin page",signatureInfo:"Plugin signature info",disabledInfo:"Plugin disabled info"},PlaylistForm:{name:"Playlist name",interval:"Playlist interval",itemDelete:"Delete playlist item"},BrowseDashbards:{table:{row:s=>`data-testid ${s} row`,checkbox:s=>`data-testid ${s} checkbox`}},Search:{url:"/?search=openn",FolderView:{url:"/?search=open&layout=folders"}},PublicDashboards:{ListItem:{linkButton:"public-dashboard-link-button",configButton:"public-dashboard-configuration-button",trashcanButton:"public-dashboard-remove-button",pauseSwitch:"data-testid public dashboard pause switch"}},UserListPage:{tabs:{allUsers:"data-testid all-users-tab",orgUsers:"data-testid org-users-tab",publicDashboardsUsers:"data-testid public-dashboards-users-tab",users:"data-testid users-tab"},org:{url:"/org/users"},admin:{url:"/admin/users"},publicDashboards:{container:"data-testid public-dashboards-users-list"},UserListAdminPage:{container:"data-testid user-list-admin-page"},UsersListPage:{container:"data-testid users-list-page"},UsersListPublicDashboardsPage:{container:"data-testid users-list-public-dashboards-page",DashboardsListModal:{listItem:s=>`data-testid dashboards-list-item-${s}`}}}},components:t.z}},64167:(j,I,e)=>{"use strict";e.d(I,{As:()=>W,B5:()=>t,Bd:()=>X,FI:()=>h,IG:()=>O,Jp:()=>m,KC:()=>f,LB:()=>u,M8:()=>F,Q8:()=>s,QH:()=>N,Ss:()=>_,UV:()=>l,Y4:()=>Y,ap:()=>B,b8:()=>G,bQ:()=>a,eK:()=>n,f3:()=>V,h2:()=>k,i3:()=>P,iT:()=>se,jG:()=>A,jK:()=>b,kW:()=>g,kv:()=>d,l8:()=>c,o0:()=>y,pR:()=>p,pc:()=>x,pu:()=>v,q1:()=>r,v7:()=>H,wN:()=>D,wf:()=>E,wm:()=>T,xy:()=>i,yK:()=>o});var t=(Z=>(Z.Linear="linear",Z.Quad="quad",Z))(t||{}),n=(Z=>(Z.Clamped="clamped",Z.Mod="mod",Z))(n||{}),i=(Z=>(Z.Field="field",Z.Fixed="fixed",Z.Template="template",Z))(i||{}),s=(Z=>(Z.Field="field",Z.Fixed="fixed",Z.Mapping="mapping",Z))(s||{}),r=(Z=>(Z.Auto="auto",Z.Coords="coords",Z.Geohash="geohash",Z.Lookup="lookup",Z))(r||{}),g=(Z=>(Z.Count="count",Z.Size="size",Z))(g||{}),d=(Z=>(Z.auto="auto",Z.ge="ge",Z.le="le",Z.unknown="unknown",Z))(d||{}),l=(Z=>(Z.Ascending="Ascending",Z.Descending="Descending",Z))(l||{}),u=(Z=>(Z.Auto="auto",Z.Bottom="bottom",Z.Hidden="hidden",Z.Left="left",Z.Right="right",Z.Top="top",Z))(u||{}),o=(Z=>(Z.Series="series",Z.Text="text",Z))(o||{}),m=(Z=>(Z.Always="always",Z.Auto="auto",Z.Never="never",Z))(m||{}),c=(Z=>(Z.Bars="bars",Z.Line="line",Z.Points="points",Z))(c||{}),p=(Z=>(Z.Constant="constant",Z.NegativeY="negative-Y",Z))(p||{}),f=(Z=>(Z.Linear="linear",Z.Smooth="smooth",Z.StepAfter="stepAfter",Z.StepBefore="stepBefore",Z))(f||{}),E=(Z=>(Z.Linear="linear",Z.Log="log",Z.Ordinal="ordinal",Z.Symlog="symlog",Z))(E||{}),h=(Z=>(Z.Hue="hue",Z.None="none",Z.Opacity="opacity",Z.Scheme="scheme",Z))(h||{}),y=(Z=>(Z.None="none",Z.Normal="normal",Z.Percent="percent",Z))(y||{}),v=(Z=>(Z[Z.After=1]="After",Z[Z.Before=-1]="Before",Z[Z.Center=0]="Center",Z))(v||{}),D=(Z=>(Z[Z.Horizontal=0]="Horizontal",Z[Z.Vertical=1]="Vertical",Z))(D||{}),a=(Z=>(Z[Z.Down=-1]="Down",Z[Z.Left=-1]="Left",Z[Z.Right=1]="Right",Z[Z.Up=1]="Up",Z))(a||{});const C={dash:[]};var P=(Z=>(Z.Area="area",Z.Dashed="dashed",Z.DashedAndArea="dashed+area",Z.Line="line",Z.LineAndArea="line+area",Z.Off="off",Z.Series="series",Z))(P||{}),b=(Z=>(Z.Hidden="hidden",Z.List="list",Z.Table="table",Z))(b||{});const M={calcs:[]};var T=(Z=>(Z.Auto="auto",Z.Horizontal="horizontal",Z.Vertical="vertical",Z))(T||{});const S={timezone:[]};var x=(Z=>(Z.Background="background",Z.BackgroundSolid="background_solid",Z.None="none",Z.Value="value",Z))(x||{}),O=(Z=>(Z.Area="area",Z.Line="line",Z.None="none",Z))(O||{}),B=(Z=>(Z.Auto="auto",Z.Center="center",Z))(B||{}),A=(Z=>(Z.Auto="auto",Z.Name="name",Z.None="none",Z.Value="value",Z.ValueAndName="value_and_name",Z))(A||{}),V=(Z=>(Z.Multi="multi",Z.None="none",Z.Single="single",Z))(V||{}),W=(Z=>(Z.Ascending="asc",Z.Descending="desc",Z.None="none",Z))(W||{});const w={calcs:[]};var N=(Z=>(Z.Basic="basic",Z.Gradient="gradient",Z.Lcd="lcd",Z))(N||{}),F=(Z=>(Z.Color="color",Z.Hidden="hidden",Z.Text="text",Z))(F||{}),k=(Z=>(Z.Auto="auto",Z.BasicGauge="basic",Z.ColorBackground="color-background",Z.ColorBackgroundSolid="color-background-solid",Z.ColorText="color-text",Z.Custom="custom",Z.Gauge="gauge",Z.GradientGauge="gradient-gauge",Z.Image="image",Z.JSONView="json-view",Z.LcdGauge="lcd-gauge",Z.Sparkline="sparkline",Z))(k||{}),H=(Z=>(Z.Basic="basic",Z.Gradient="gradient",Z))(H||{});const R={fields:[],reducer:[]};var _=(Z=>(Z.Lg="lg",Z.Md="md",Z.Sm="sm",Z))(_||{}),G=(Z=>(Z.CSV="csv",Z.Date="date",Z.Distributed="distributed",Z.DoubleQuote="doublequote",Z.Glob="glob",Z.HTML="html",Z.JSON="json",Z.Lucene="lucene",Z.PercentEncode="percentencode",Z.Pipe="pipe",Z.QueryParam="queryparam",Z.Raw="raw",Z.Regex="regex",Z.SQLString="sqlstring",Z.SingleQuote="singlequote",Z.Text="text",Z.UriEncode="uriencode",Z))(G||{}),Y=(Z=>(Z.exact="exact",Z.none="none",Z.numbers="numbers",Z.signature="signature",Z))(Y||{}),X=(Z=>(Z.EQ="eq",Z.GT="gt",Z.GTE="gte",Z.LT="lt",Z.LTE="lte",Z.NEQ="neq",Z))(X||{});const Q={align:"auto",inspect:!1},se="browser"},8238:(j,I,e)=>{"use strict";e.d(I,{AU:()=>s,vC:()=>i});var t=e(64167);const n="10.1.10",i={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:t.wm.Auto,showValue:t.Jp.Auto,stacking:t.o0.None,xTickLabelRotation:0,xTickLabelSpacing:0},s={fillOpacity:80,gradientMode:t.FI.None,lineWidth:1}},84283:(j,I,e)=>{"use strict";e.d(I,{v:()=>i});var t=e(64167);const n="10.1.10",i={displayMode:t.QH.Gradient,minVizHeight:10,minVizWidth:0,showUnfilled:!0,valueMode:t.M8.Color}},97067:(j,I,e)=>{"use strict";e.d(I,{v:()=>n});const t="10.1.10",n={selectedSeries:0}},84317:(j,I,e)=>{"use strict";e.d(I,{v:()=>n});const t="10.1.10",n={showThresholdLabels:!1,showThresholdMarkers:!0}},1472:(j,I,e)=>{"use strict";e.d(I,{vC:()=>n});const t="10.1.10",n={layers:[]},i={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var s=(g=>(g.Details="details",g.None="none",g))(s||{}),r=(g=>(g.Coords="coords",g.Fit="fit",g.Zero="zero",g))(r||{})},2137:(j,I,e)=>{"use strict";e.d(I,{vC:()=>r});var t=e(64167);const n="10.1.10";var i=(g=>(g.Opacity="opacity",g.Scheme="scheme",g))(i||{}),s=(g=>(g.Exponential="exponential",g.Linear="linear",g))(s||{});const r={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},showValue:t.Jp.Auto,tooltip:{show:!0,yHistogram:!1}}},24839:(j,I,e)=>{"use strict";e.d(I,{AU:()=>s,vC:()=>i});var t=e(64167);const n="10.1.10",i={bucketOffset:0},s={fillOpacity:80,gradientMode:t.FI.None,lineWidth:1}},69701:(j,I,e)=>{"use strict";e.d(I,{v:()=>n});const t="10.1.10",n={showImage:!0}},93848:(j,I,e)=>{"use strict";e.d(I,{vC:()=>g});const t="10.1.10";var n=(d=>(d.Donut="donut",d.Pie="pie",d))(n||{}),i=(d=>(d.Name="name",d.Percent="percent",d.Value="value",d))(i||{}),s=(d=>(d.Percent="percent",d.Value="value",d))(s||{});const r={values:[]},g={displayLabels:[]}},73797:(j,I,e)=>{"use strict";e.d(I,{v:()=>i});var t=e(64167);const n="10.1.10",i={colorMode:t.pc.Value,graphMode:t.IG.Area,justifyMode:t.ap.Auto,textMode:t.jG.Auto}},39973:(j,I,e)=>{"use strict";e.d(I,{AU:()=>s,vC:()=>i});var t=e(64167);const n="10.1.10",i={alignValue:"left",mergeValues:!0,rowHeight:.9,showValue:t.Jp.Auto},s={fillOpacity:70,lineWidth:0}},10484:(j,I,e)=>{"use strict";e.d(I,{AU:()=>s,vC:()=>i});var t=e(64167);const n="10.1.10",i={colWidth:.9,rowHeight:.9,showValue:t.Jp.Auto},s={fillOpacity:70,lineWidth:1}},91813:(j,I,e)=>{"use strict";e.d(I,{v:()=>i});var t=e(64167);const n="10.1.10",i={cellHeight:t.Ss.Sm,footer:{show:!1,countRows:!1,reducer:[]},frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]}},37645:(j,I,e)=>{"use strict";e.d(I,{vC:()=>g});const t="10.1.10";var n=(d=>(d.Code="code",d.HTML="html",d.Markdown="markdown",d))(n||{}),i=(d=>(d.Go="go",d.Html="html",d.Json="json",d.Markdown="markdown",d.Plaintext="plaintext",d.Sql="sql",d.Typescript="typescript",d.Xml="xml",d.Yaml="yaml",d))(i||{});const s="plaintext",r={language:"plaintext",showLineNumbers:!1,showMiniMap:!1},g={content:`# Title For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)`,mode:"markdown"}},34094:(j,I,e)=>{"use strict";e.d(I,{vC:()=>d});var t=e(64167);const n="10.1.10";var i=(l=>(l.Auto="auto",l.Manual="manual",l))(i||{}),s=(l=>(l.Lines="lines",l.Points="points",l.PointsAndLines="points+lines",l))(s||{});const r={exclude:[]},g={label:t.Jp.Auto,show:"points"},d={series:[]}},66805:(j,I,e)=>{"use strict";e.d(I,{AU:()=>P,G_:()=>s,Gu:()=>u,H3:()=>p,Hi:()=>E,NU:()=>D,Ql:()=>M,SJ:()=>b,Vb:()=>a,ZM:()=>C,bn:()=>i,gW:()=>r});const t={tags:[]},n={exclude:!1,ids:[]},i={list:[]},s={enable:!0,hide:!1},r={id:"00000000-0000-0000-0000-000000000000",includeAll:!1,multi:!1,options:[],skipUrlSync:!1};var g=(T=>(T[T.never=0]="never",T[T.onDashboardLoad=1]="onDashboardLoad",T[T.onTimeRangeChanged=2]="onTimeRangeChanged",T))(g||{}),d=(T=>(T[T.dontHide=0]="dontHide",T[T.hideLabel=1]="hideLabel",T[T.hideVariable=2]="hideVariable",T))(d||{}),l=(T=>(T[T.alphabeticalAsc=1]="alphabeticalAsc",T[T.alphabeticalCaseInsensitiveAsc=5]="alphabeticalCaseInsensitiveAsc",T[T.alphabeticalCaseInsensitiveDesc=6]="alphabeticalCaseInsensitiveDesc",T[T.alphabeticalDesc=2]="alphabeticalDesc",T[T.disabled=0]="disabled",T[T.numericalAsc=3]="numericalAsc",T[T.numericalDesc=4]="numericalDesc",T))(l||{}),u=(T=>(T.Done="Done",T.Error="Error",T.Loading="Loading",T.NotStarted="NotStarted",T.Streaming="Streaming",T))(u||{});const o={asDropdown:!1,includeVars:!1,keepTime:!1,tags:[],targetBlank:!1};var m=(T=>(T.ContinuousBlPu="continuous-BlPu",T.ContinuousBlYlRd="continuous-BlYlRd",T.ContinuousBlues="continuous-blues",T.ContinuousGrYlRd="continuous-GrYlRd",T.ContinuousGreens="continuous-greens",T.ContinuousPurples="continuous-purples",T.ContinuousRdYlGr="continuous-RdYlGr",T.ContinuousReds="continuous-reds",T.ContinuousYlBl="continuous-YlBl",T.ContinuousYlRd="continuous-YlRd",T.Fixed="fixed",T.PaletteClassic="palette-classic",T.PaletteClassicByName="palette-classic-by-name",T.Shades="shades",T.Thresholds="thresholds",T))(m||{});const c={h:9,w:12,x:0,y:0};var p=(T=>(T.Absolute="absolute",T.Percentage="percentage",T))(p||{});const f={steps:[]};var E=(T=>(T.RangeToText="range",T.RegexToText="regex",T.SpecialValue="special",T.ValueToText="value",T))(E||{}),h=(T=>(T.Empty="empty",T.False="false",T.NaN="nan",T.Null="null",T.NullAndNan="null+nan",T.True="true",T))(h||{}),y=(T=>(T[T.Crosshair=1]="Crosshair",T[T.Off=0]="Off",T[T.Tooltip=2]="Tooltip",T))(y||{});const v=0,D={links:[],repeatDirection:"h",tags:[],targets:[],transformations:[],transparent:!1},a={overrides:[]},C={id:""},P={links:[],mappings:[]},b={collapsed:!1,panels:[]},M={editable:!0,fiscalYearStartMonth:0,graphTooltip:0,links:[],panels:[],schemaVersion:36,style:"dark",tags:[],timezone:"browser"}},48414:(j,I,e)=>{"use strict";e.d(I,{Ql:()=>i});var t=e(66805),n=(c=>(c[c.dontHide=0]="dontHide",c[c.hideLabel=1]="hideLabel",c[c.hideVariable=2]="hideVariable",c))(n||{});const i=t.Ql,s={...t.gW,description:null,hide:0,datasource:null},r=t.NU,g=t.SJ,d=t.AU,l=t.Vb,u=t.ZM,o=t.G_,m=t.bn},28291:(j,I,e)=>{"use strict";e.d(I,{M:()=>r,Z:()=>i});var t=e(89949),n=e.n(t);class i{constructor(d){if(this.columns=[],this.columnMap={},this.rows=[],this.type="table",d){if(d.columns)for(const l of d.columns)this.addColumn(l);if(d.rows)for(const l of d.rows)this.addRow(l)}}sort(d){d.col===null||d.col===void 0||this.columns.length<=d.col||(this.rows.sort((l,u)=>(l=l[d.col],u=u[d.col],+(l==null)-+(u==null)||+(l>u)||-(l<u))),d.desc&&this.rows.reverse(),this.columns[d.col].sort=!0,this.columns[d.col].desc=d.desc)}addColumn(d){this.columnMap[d.text]||(this.columns.push(d),this.columnMap[d.text]=d)}addRow(d){this.rows.push(d)}}function s(g,d,l){let u=!1;for(let o=0;o<g.length;o++)if(d[o]!==void 0&&l[o]!==void 0){if(d[o]!==l[o])return!1}else(d[o]===void 0||l[o]===void 0)&&(u=!0);return u}function r(g,...d){const l=g||new i;if(arguments.length===1)return l;if(arguments.length===2)return l.columns=d[0].hasOwnProperty("columns")?[...d[0].columns]:[],l.rows=d[0].hasOwnProperty("rows")?[...d[0].rows]:[],l;const u=d.filter(h=>!!h.columns),o={},m=u.slice().reduce((h,y)=>(y.columns.forEach(v=>{const{text:D}=v;o[D]===void 0&&(o[D]=h.length,h.push(v))}),h),[]),c=u.map(h=>h.columns.map(y=>o[y.text])),p=u.reduce((h,y,v)=>{const D=c[v];return y.rows.forEach(a=>{const C=[];D.forEach((P,b)=>{C[P]=a[b]}),h.push(C)}),h},[]),f={},E=p.reduce((h,y,v)=>{if(!f[v]){let D=v+1;for(;D<p.length;){const a=(0,t.findIndex)(p,C=>s(m,y,C),D);if(a>-1){const C=p[a];for(let P=0;P<m.length;P++)y[P]===void 0&&C[P]!==void 0&&(y[P]=C[P]);f[a]=C,D=a+1}else break}h.push(y)}return h},[]);return l.columns=m,l.rows=E,l}},92071:(j,I,e)=>{"use strict";e.d(I,{e:()=>n});var t=e(34099);const n=(0,t.PH)("core/cleanUpState")},33877:(j,I,e)=>{"use strict";e.d(I,{$l:()=>t.$l,H7:()=>n.H7,RL:()=>n.RL,ad:()=>t.ad});var t=e(4021),n=e(34139)},5933:(j,I,e)=>{"use strict";e.d(I,{Z:()=>i,h:()=>n});var t=e(62435);const n=new t.F,i=n},1541:(j,I,e)=>{"use strict";e.d(I,{P:()=>V});var t=e(42844),n=e(89949),i=e(27702),s=e(60426),r=e(34667),g=e(66310),d=e(66670),l=e(88203),u=e(65322),o=e(45937),m=e(50837),c=e(23852),p=e(23839),f=e(28580),E=e(35952),h=e(23159),y=e(79173),v=e(43533),D=(_=>(_.None="None",_.Team="Team",_.User="User",_.BuiltInRole="builtInRole",_))(D||{});const a=({title:_=(0,u.t)("access-control.add-permission.title","Add permission for"),permissions:G,assignments:Y,onAdd:X,onCancel:Q})=>{const[se,Z]=(0,i.useState)(D.None),[le,oe]=(0,i.useState)(0),[q,ne]=(0,i.useState)(0),[ge,ae]=(0,i.useState)(""),[re,De]=(0,i.useState)(""),he=(0,i.useMemo)(()=>{const ce=[];return Y.users&&ce.push({value:D.User,label:(0,u.t)("access-control.add-permission.user-label","User")}),Y.teams&&ce.push({value:D.Team,label:(0,u.t)("access-control.add-permission.team-label","Team")}),Y.builtInRoles&&ce.push({value:D.BuiltInRole,label:(0,u.t)("access-control.add-permission.role-label","Role")}),ce},[Y]);(0,i.useEffect)(()=>{G.length>0&&De(G[0])},[G]);const ye=()=>se===D.Team&&le>0||se===D.User&&q>0||D.BuiltInRole&&v.B5.hasOwnProperty(ge);return i.createElement("div",{className:"cta-form","aria-label":"Permissions slider"},i.createElement(E.P,{onClick:Q}),i.createElement("h5",null,_),i.createElement(p.l,{name:"addPermission",maxWidth:"none",onSubmit:()=>X({userId:q,teamId:le,builtInRole:ge,permission:re,target:se})},()=>i.createElement(c.K,{gap:1,direction:"row"},i.createElement(f.Ph,{"aria-label":"Role to add new permission to",value:se,options:he,onChange:ce=>Z(ce.value),disabled:he.length===0,width:"auto"}),se===D.User&&i.createElement(y.f,{onSelected:ce=>ne(ce?.value||0)}),se===D.Team&&i.createElement(h.c,{onSelected:ce=>oe(ce.value?.id||0)}),se===D.BuiltInRole&&i.createElement(f.Ph,{"aria-label":"Built-in role picker",options:Object.values(v.B5).filter(ce=>ce!==v.B5.None).map(ce=>({value:ce,label:ce})),onChange:ce=>ae(ce.value||""),width:"auto"}),i.createElement(f.Ph,{"aria-label":"Permission Level",width:"auto",value:G.find(ce=>ce===re),options:G.map(ce=>({label:ce,value:ce})),onChange:ce=>De(ce.value||"")}),i.createElement(d.zx,{type:"submit",disabled:!ye()},i.createElement(u.cC,{i18nKey:"access-control.add-permissions.save"},"Save")))))};var C=e(80011),P=e(73453);const b=({item:_,permissionLevels:G,canSet:Y,onRemove:X,onChange:Q})=>i.createElement("tr",null,i.createElement("td",null,M(_)),i.createElement("td",null,S(_)),i.createElement("td",null,_.isInherited&&i.createElement("em",{className:"muted no-wrap"},"Inherited from folder")),i.createElement("td",null,i.createElement(f.Ph,{disabled:!Y||!_.isManaged,onChange:se=>Q(_,se.value),value:G.find(se=>se===_.permission),options:G.map(se=>({value:se,label:se}))})),i.createElement("td",null,i.createElement(C.u,{content:x(_)},i.createElement(P.J,{name:"info-circle"}))),i.createElement("td",null,_.isManaged?i.createElement(d.zx,{size:"sm",icon:"times",variant:"destructive",disabled:!Y,onClick:()=>X(_),"aria-label":`Remove permission for ${T(_)}`}):i.createElement(C.u,{content:_.isInherited?"Inherited Permission":"Provisioned Permission"},i.createElement(d.zx,{size:"sm",icon:"lock"})))),M=_=>_.teamId?i.createElement("img",{className:"filter-table__avatar",src:_.teamAvatarUrl,alt:`Avatar for team ${_.teamId}`}):_.userId?i.createElement("img",{className:"filter-table__avatar",src:_.userAvatarUrl,alt:`Avatar for user ${_.userId}`}):i.createElement(P.J,{size:"xl",name:"shield"}),T=_=>_.userId?_.userLogin:_.teamId?_.team:_.builtInRole,S=_=>_.userId?i.createElement("span",{key:"name"},_.userLogin," "):_.teamId?i.createElement("span",{key:"name"},_.team," "):_.builtInRole?i.createElement("span",{key:"name"},_.builtInRole," "):i.createElement("span",{key:"name"}),x=_=>`Actions: ${[...new Set(_.actions)].sort().join(" ")}`,O=({title:_,items:G,compareKey:Y,permissionLevels:X,canSet:Q,onRemove:se,onChange:Z})=>{const le=(0,i.useMemo)(()=>{const oe={};for(let q of G){const ne=q[Y];if(!oe[ne]){oe[ne]=q;continue}q.actions.length>oe[ne].actions.length&&(oe[ne]=q)}return Object.keys(oe).map(q=>oe[q])},[G,Y]);return le.length===0?null:i.createElement("div",null,i.createElement("table",{className:"filter-table gf-form-group"},i.createElement("thead",null,i.createElement("tr",null,i.createElement("th",{style:{width:"1%"}}),i.createElement("th",null,_),i.createElement("th",{style:{width:"1%"}}),i.createElement("th",{style:{width:"40%"}},i.createElement(u.cC,{i18nKey:"access-control.permission-list.permission"},"Permission")),i.createElement("th",{style:{width:"1%"}}),i.createElement("th",{style:{width:"1%"}}))),i.createElement("tbody",null,le.map((oe,q)=>i.createElement(b,{item:oe,onRemove:se,onChange:Z,canSet:Q,key:`${q}-${oe.userId}`,permissionLevels:X})))))},B="",A={permissions:[],assignments:{teams:!1,users:!1,builtInRoles:!1}},V=({title:_=(0,u.t)("access-control.permissions.title","Permissions"),buttonLabel:G=(0,u.t)("access-control.permissions.add-label","Add a permission"),emptyLabel:Y=(0,u.t)("access-control.permissions.no-permissions","There are no permissions"),resource:X,resourceId:Q,canSetPermissions:se,addPermissionTitle:Z})=>{const le=(0,g.wW)(R),[oe,q]=(0,i.useState)(!1),[ne,ge]=(0,i.useState)([]),[ae,re]=(0,i.useState)(A),De=(0,i.useCallback)(()=>w(X,Q).then(qe=>ge(qe)),[X,Q]);(0,i.useEffect)(()=>{W(X).then(qe=>(re(qe),De()))},[X,Q,De]);const he=qe=>{let st=null;qe.target===D.User?st=N(X,Q,qe.userId,qe.permission):qe.target===D.Team?st=F(X,Q,qe.teamId,qe.permission):qe.target===D.BuiltInRole&&(st=k(X,Q,qe.builtInRole,qe.permission)),st!==null&&st.then(De)},ye=qe=>{let st=null;qe.userId?st=N(X,Q,qe.userId,B):qe.teamId?st=F(X,Q,qe.teamId,B):qe.builtInRole&&(st=k(X,Q,qe.builtInRole,B)),st!==null&&st.then(De)},ce=(qe,st)=>{qe.permission!==st&&(qe.userId?he({permission:st,userId:qe.userId,target:D.User}):qe.teamId?he({permission:st,teamId:qe.teamId,target:D.Team}):qe.builtInRole&&he({permission:st,builtInRole:qe.builtInRole,target:D.BuiltInRole}))},We=(0,i.useMemo)(()=>(0,n.sortBy)(ne.filter(qe=>qe.teamId),["team","isManaged"]),[ne]),ke=(0,i.useMemo)(()=>(0,n.sortBy)(ne.filter(qe=>qe.userId),["userLogin","isManaged"]),[ne]),et=(0,i.useMemo)(()=>(0,n.sortBy)(ne.filter(qe=>qe.builtInRole),["builtInRole","isManaged"]),[ne]),we=(0,u.t)("access-control.permissions.role","Role"),_e=(0,u.t)("access-control.permissions.user","User"),Ge=(0,u.t)("access-control.permissions.team","Team");return i.createElement("div",null,se&&i.createElement(i.Fragment,null,r.config.featureToggles.nestedFolders&&X==="folders"&&i.createElement(i.Fragment,null,i.createElement(u.cC,{i18nKey:"access-control.permissions.permissions-change-warning"},"This will change permissions for this folder and all its descendants. In total, this will affect:"),i.createElement(m.X,{selectedItems:{folder:{[Q]:!0},dashboard:{},panel:{},$all:!1}}),i.createElement(s.T,{v:2})),i.createElement(d.zx,{className:le.addPermissionButton,variant:"primary",key:"add-permission",onClick:()=>q(!0)},G),i.createElement(l.s,{in:oe},i.createElement(a,{title:Z,onAdd:he,permissions:ae.permissions,assignments:ae.assignments,onCancel:()=>q(!1)}))),ne.length===0&&i.createElement("table",{className:"filter-table gf-form-group"},i.createElement("tbody",null,i.createElement("tr",null,i.createElement("th",null,Y)))),i.createElement(O,{title:we,items:et,compareKey:"builtInRole",permissionLevels:ae.permissions,onChange:ce,onRemove:ye,canSet:se}),i.createElement(O,{title:_e,items:ke,compareKey:"userLogin",permissionLevels:ae.permissions,onChange:ce,onRemove:ye,canSet:se}),i.createElement(O,{title:Ge,items:We,compareKey:"team",permissionLevels:ae.permissions,onChange:ce,onRemove:ye,canSet:se}))},W=async _=>{try{return await(0,o.i)().get(`/api/access-control/${_}/description`)}catch(G){return console.error("failed to load resource description: ",G),A}},w=(_,G)=>(0,o.i)().get(`/api/access-control/${_}/${G}`),N=(_,G,Y,X)=>H(_,G,"users",Y,X),F=(_,G,Y,X)=>H(_,G,"teams",Y,X),k=(_,G,Y,X)=>H(_,G,"builtInRoles",Y,X),H=(_,G,Y,X,Q)=>(0,o.i)().post(`/api/access-control/${_}/${G}/${Y}/${X}`,{permission:Q}),R=_=>({breakdown:(0,t.css)({..._.typography.bodySmall,color:_.colors.text.secondary,marginBottom:_.spacing(2)}),addPermissionButton:(0,t.css)({marginBottom:_.spacing(2)})})},88203:(j,I,e)=>{"use strict";e.d(I,{s:()=>g});var t=e(27702),n=e(39330);const i="200px",s=200,r={transition:`max-height ${s}ms ease-in-out`,overflow:"hidden"},g=({children:d,in:l,maxHeight:u=i,style:o=r})=>{const m={exited:{maxHeight:0},entering:{maxHeight:u},entered:{maxHeight:"unset",overflow:"visible"},exiting:{maxHeight:0}};return t.createElement(n.ZP,{in:l,timeout:s},c=>t.createElement("div",{style:{...o,...m[c]}},d))}},75443:(j,I,e)=>{"use strict";e.d(I,{A:()=>i});var t=e(27702),n=e(26473);const i=t.memo(({actions:s})=>{const{chrome:r}=(0,n.p)();return(0,t.useLayoutEffect)(()=>{r.update({actions:s})}),null});i.displayName="TopNavUpdate"},51391:(j,I,e)=>{"use strict";e.d(I,{L:()=>i,Y:()=>n});var t=e(65322);function n(s){switch(s){case"home":return(0,t.t)("nav.home.title","Home");case"new":return(0,t.t)("nav.new.title","New");case"create":return(0,t.t)("nav.create.title","Create");case"create-dashboard":return(0,t.t)("nav.create-dashboard.title","Dashboard");case"folder":return(0,t.t)("nav.create-folder.title","Folder");case"import":return(0,t.t)("nav.create-import.title","Import dashboard");case"alert":return(0,t.t)("nav.create-alert.title","Create alert rule");case"starred":return(0,t.t)("nav.starred.title","Starred");case"starred-empty":return(0,t.t)("nav.starred-empty.title","Your starred dashboards will appear here");case"dashboards":return(0,t.t)("nav.dashboards.title","Dashboards");case"dashboards/browse":return(0,t.t)("nav.dashboards.title","Dashboards");case"dashboards/playlists":return(0,t.t)("nav.playlists.title","Playlists");case"dashboards/snapshots":return(0,t.t)("nav.snapshots.title","Snapshots");case"dashboards/library-panels":return(0,t.t)("nav.library-panels.title","Library panels");case"reports":return(0,t.t)("nav.reporting.title","Reporting");case"dashboards/public":return(0,t.t)("nav.public.title","Public dashboards");case"dashboards/new":return(0,t.t)("nav.new-dashboard.title","New dashboard");case"dashboards/folder/new":return(0,t.t)("nav.new-folder.title","New folder");case"dashboards/import":return(0,t.t)("nav.create-import.title","Import dashboard");case"scenes":return(0,t.t)("nav.scenes.title","Scenes");case"explore":return(0,t.t)("nav.explore.title","Explore");case"alerting":return(0,t.t)("nav.alerting.title","Alerting");case"plugin-page-grafana-oncall-app":return(0,t.t)("nav.oncall.title","OnCall");case"alerting-legacy":return(0,t.t)("nav.alerting-legacy.title","Alerting (legacy)");case"alert-home":return(0,t.t)("nav.alerting-home.title","Home");case"alert-list":return(0,t.t)("nav.alerting-list.title","Alert rules");case"receivers":return(0,t.t)("nav.alerting-receivers.title","Contact points");case"am-routes":return(0,t.t)("nav.alerting-am-routes.title","Notification policies");case"channels":return(0,t.t)("nav.alerting-channels.title","Notification channels");case"silences":return(0,t.t)("nav.alerting-silences.title","Silences");case"groups":return(0,t.t)("nav.alerting-groups.title","Groups");case"alerting-admin":return(0,t.t)("nav.alerting-admin.title","Admin");case"cfg":return(0,t.t)("nav.config.title","Administration");case"datasources":return(0,t.t)("nav.datasources.title","Data sources");case"authentication":return(0,t.t)("nav.authentication.title","Authentication");case"licensing":return(0,t.t)("nav.statistics-and-licensing.title","Statistics and licensing");case"recordedQueries":return(0,t.t)("nav.recorded-queries.title","Recorded queries");case"correlations":return(0,t.t)("nav.correlations.title","Correlations");case"users":return(0,t.t)("nav.users.title","Users");case"teams":return(0,t.t)("nav.teams.title","Teams");case"plugins":return(0,t.t)("nav.plugins.title","Plugins");case"org-settings":return(0,t.t)("nav.org-settings.title","Default preferences");case"apikeys":return(0,t.t)("nav.api-keys.title","API keys");case"serviceaccounts":return(0,t.t)("nav.service-accounts.title","Service accounts");case"admin":return(0,t.t)("nav.admin.title","Server admin");case"support-bundles":return(0,t.t)("nav.support-bundles.title","Support bundles");case"global-users":return(0,t.t)("nav.global-users.title","Users");case"global-orgs":return(0,t.t)("nav.global-orgs.title","Organizations");case"server-settings":return(0,t.t)("nav.server-settings.title","Settings");case"storage":return(0,t.t)("nav.storage.title","Storage");case"upgrading":return(0,t.t)("nav.upgrading.title","Stats and license");case"monitoring":return(0,t.t)("nav.monitoring.title","Observability");case"apps":return(0,t.t)("nav.apps.title","Apps");case"alerts-and-incidents":return(0,t.t)("nav.alerts-and-incidents.title","Alerts & IRM");case"plugin-page-grafana-incident-app":return(0,t.t)("nav.incidents.title","Incidents");case"plugin-page-grafana-ml-app":return(0,t.t)("nav.machine-learning.title","Machine learning");case"plugin-page-grafana-slo-app":return(0,t.t)("nav.slo.title","SLO");case"plugin-page-k6-app":return(0,t.t)("nav.performance-testing.title","Performance testing");case"monitoring":return(0,t.t)("nav.observability.title","Observability");case"plugin-page-grafana-k8s-app":return(0,t.t)("nav.kubernetes.title","Kubernetes");case"plugin-page-grafana-app-observability-app":return(0,t.t)("nav.application.title","Application (preview)");case"plugin-page-grafana-pyroscope-app":return(0,t.t)("nav.profiles.title","Profiles (preview)");case"plugin-page-grafana-kowalski-app":return(0,t.t)("nav.frontend.title","Frontend");case"plugin-page-grafana-synthetic-monitoring-app":return(0,t.t)("nav.synthetics.title","Synthetics");case"help":return(0,t.t)("nav.help.title","Help");case"profile/settings":return(0,t.t)("nav.profile/settings.title","Profile");case"profile/notifications":return(0,t.t)("nav.profile/notifications.title","Notification history");case"profile/password":return(0,t.t)("nav.profile/password.title","Change password");case"sign-out":return(0,t.t)("nav.sign-out.title","Sign out");case"search":return(0,t.t)("nav.search-dashboards.title","Search dashboards");case"connections":return(0,t.t)("nav.connections.title","Connections");case"connections-add-new-connection":return(0,t.t)("nav.add-new-connections.title","Add new connection");case"connections-datasources":return(0,t.t)("nav.data-sources.title","Data sources");case"standalone-plugin-page-/connections/infrastructure":return(0,t.t)("nav.infrastructure.title","Infrastructure");case"standalone-plugin-page-/connections/connect-data":return(0,t.t)("nav.connect-data.title","Connect data");case"plugin-page-grafana-detect-app":return(0,t.t)("nav.detect.title","Detect");case"plugin-page-grafana-quaderno-app":return(0,t.t)("nav.grafana-quaderno.title","Grafana Quaderno");default:return}}function i(s){switch(s){case"dashboards":return(0,t.t)("nav.dashboards.subtitle","Create and manage dashboards to visualize your data");case"dashboards/browse":return(0,t.t)("nav.dashboards.subtitle","Create and manage dashboards to visualize your data");case"manage-folder":return(0,t.t)("nav.manage-folder.subtitle","Manage folder dashboards and permissions");case"dashboards/playlists":return(0,t.t)("nav.playlists.subtitle","Groups of dashboards that are displayed in a sequence");case"dashboards/snapshots":return(0,t.t)("nav.snapshots.subtitle","Interactive, publically available, point-in-time representations of dashboards");case"dashboards/library-panels":return(0,t.t)("nav.library-panels.subtitle","Reusable panels that can be added to multiple dashboards");case"alerting":return(0,t.t)("nav.alerting.subtitle","Learn about problems in your systems moments after they occur");case"alert-list":return(0,t.t)("nav.alerting-list.subtitle","Rules that determine whether an alert will fire");case"receivers":return(0,t.t)("nav.alerting-receivers.subtitle","Choose how to notify your contact points when an alert instance fires");case"am-routes":return(0,t.t)("nav.alerting-am-routes.subtitle","Determine how alerts are routed to contact points");case"silences":return(0,t.t)("nav.alerting-silences.subtitle","Stop notifications from one or more alerting rules");case"groups":return(0,t.t)("nav.alerting-groups.subtitle","See grouped alerts from an Alertmanager instance");case"datasources":return(0,t.t)("nav.datasources.subtitle","Add and configure data sources");case"correlations":return(0,t.t)("nav.correlations.subtitle","Add and configure correlations");case"users":return(0,t.t)("nav.users.subtitle","Invite and assign roles to users");case"teams":return(0,t.t)("nav.teams.subtitle","Groups of users that have common dashboard and permission needs");case"plugins":return(0,t.t)("nav.plugins.subtitle","Extend the Grafana experience with plugins");case"org-settings":return(0,t.t)("nav.org-settings.subtitle","Manage preferences across an organization");case"apikeys":return(0,t.t)("nav.api-keys.subtitle","Manage and create API keys that are used to interact with Grafana HTTP APIs");case"serviceaccounts":return(0,t.t)("nav.service-accounts.subtitle","Use service accounts to run automated workloads in Grafana");case"global-users":return(0,t.t)("nav.global-users.subtitle","Manage users in Grafana");case"global-orgs":return(0,t.t)("nav.global-orgs.subtitle","Isolated instances of Grafana running on the same server");case"server-settings":return(0,t.t)("nav.server-settings.subtitle","View the settings defined in your Grafana config");case"storage":return(0,t.t)("nav.storage.subtitle","Manage file storage");case"support-bundles":return(0,t.t)("nav.support-bundles.subtitle","Download support bundles");case"admin":return(0,t.t)("nav.admin.subtitle","Manage server-wide settings and access to resources such as organizations, users, and licenses");case"apps":return(0,t.t)("nav.apps.subtitle","App plugins that extend the Grafana experience");case"monitoring":return(0,t.t)("nav.monitoring.subtitle","Monitoring and infrastructure apps");case"alerts-and-incidents":return(0,t.t)("nav.alerts-and-incidents.subtitle","Alerting and incident management apps");case"connections-add-new-connection":return(0,t.t)("nav.connections.subtitle","Browse and create new connections");case"connections-datasources":return(0,t.t)("nav.data-sources.subtitle","View and manage your connected data source connections");default:return}}},80557:(j,I,e)=>{"use strict";e.d(I,{M:()=>s});var t=e(42844),n=e(27702),i=e(66310);function s({className:g,leftActionsSeparator:d}){const l=(0,i.wW)(r);return d?n.createElement("div",{className:(0,t.cx)(g,l.leftActionsSeparator)}):n.createElement("div",{className:(0,t.cx)(g,l.line)})}const r=g=>({leftActionsSeparator:(0,t.css)({display:"flex",flexGrow:1}),line:(0,t.css)({width:1,backgroundColor:g.colors.border.medium,height:24})})},63362:(j,I,e)=>{"use strict";e.d(I,{$:()=>t});const t=40},76404:(j,I,e)=>{"use strict";e.d(I,{c:()=>o});var t=e(42844),n=e(27702),i=e(96750),s=e(66310),r=e(97289);const g=({className:m,logo:c})=>n.createElement("img",{className:m,src:`${c||"public/img/grafana_icon.svg"}`,alt:"Grafana"}),d=({className:m,children:c})=>{const p=(0,s.l4)(),f=(0,t.css)` &:before { content: ''; position: fixed; left: 0; right: 0; bottom: 0; top: 0; background: url(public/img/g8_login_${p.isDark?"dark":"light"}.svg); background-position: top center; background-size: auto; background-repeat: no-repeat; opacity: 0; transition: opacity 3s ease-in-out; @media ${r.mediaUp(p.v1.breakpoints.md)} { background-position: center; background-size: cover; } } `;return n.createElement("div",{className:(0,t.cx)(f,m)},c)},l=({className:m})=>n.createElement("img",{className:m,src:"public/img/grafana_icon.svg",alt:"Grafana"}),u=()=>{const m=(0,s.l4)();return(0,t.css)` background: ${i.alpha(m.colors.background.primary,.7)}; background-size: cover; `};class o{}o.LoginLogo=g,o.LoginBackground=d,o.MenuLogo=l,o.LoginBoxBackground=u,o.AppTitle="Grafana",o.LoginTitle="Welcome to Grafana",o.HideEdition=!1,o.GetLoginSubTitle=()=>null},57821:(j,I,e)=>{"use strict";e.d(I,{t:()=>t});function t(n,i,s){const r=[];let g=!1;function d(l){const u=new URLSearchParams(l.url?.split("?")[1]);let o=`${l.url?.split("?")[0]}`;u.has("editview")&&(o+=`?editview=${u.get("editview")}`),!g&&!l.hideFromBreadcrumbs&&(s&&o===s.url?(r.unshift({text:s.text,href:l.url??""}),g=!0):r.unshift({text:l.text,href:l.url??""})),l.parentItem&&d(l.parentItem)}return i&&d(i),d(n),r}},2480:(j,I,e)=>{"use strict";e.d(I,{x:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(73453);const r=n.forwardRef(({icon:d,children:l,onClick:u,...o},m)=>{const c=(0,i.wW)(g);return n.createElement("button",{...o,className:c.action,onClick:u},n.createElement(s.J,{name:d,size:"xl"}),l)});r.displayName="CardButton";const g=d=>({action:(0,t.css)` display: flex; flex-direction: column; height: 100%; justify-self: center; cursor: pointer; background: ${d.colors.background.secondary}; border-radius: ${d.shape.borderRadius(1)}; color: ${d.colors.text.primary}; border: unset; width: 100%; display: flex; justify-content: center; align-items: center; text-align: center; &:hover { background: ${d.colors.emphasize(d.colors.background.secondary)}; } `})},35952:(j,I,e)=>{"use strict";e.d(I,{P:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(67437);const r=({onClick:d,"aria-label":l,style:u})=>{const o=(0,i.wW)(g);return n.createElement(s.h,{"aria-label":l??"Close",className:o,name:"times",onClick:d,style:u,tooltip:"Close"})},g=d=>(0,t.css)` position: absolute; right: ${d.spacing(.5)}; top: ${d.spacing(1)}; `},47449:(j,I,e)=>{"use strict";e.d(I,{W:()=>s});var t=e(42844),n=e(27702),i=e(66310);function s(g){const{description:d,suffix:l,feature:u}=g,o=`Learn more about ${u}`,m=(0,i.wW)(r);return n.createElement("span",{className:m.container},d,n.createElement("a",{"aria-label":o,href:`https://grafana.com/docs/grafana/next/datasources/${l}`,rel:"noreferrer",target:"_blank"},o))}const r=g=>({container:(0,t.css)({color:g.colors.text.secondary,a:(0,t.css)({color:g.colors.text.link,textDecoration:"underline",marginLeft:"5px","&:hover":{textDecoration:"none"}})})})},9031:(j,I,e)=>{"use strict";e.d(I,{Q:()=>n});var t=e(27702);const n=i=>t.lazy(i)},66970:(j,I,e)=>{"use strict";e.d(I,{Z:()=>o});var t=e(42844),n=e(27702),i=e(74639),s=e(73453),r=e(66670),g=e(60801);const d=(0,t.css)` text-align: center; `,l=(0,t.css)` max-width: 700px; margin: 0 auto; `,o=({title:m,buttonIcon:c,buttonLink:p,buttonTitle:f,buttonDisabled:E,onClick:h,proTip:y,proTipLink:v,proTipLinkTitle:D,proTipTarget:a,infoBox:C,infoBoxTitle:P})=>{const b=()=>n.createElement(n.Fragment,null,y?n.createElement("span",{key:"proTipFooter"},n.createElement(s.J,{name:"rocket"}),n.createElement(n.Fragment,null," ProTip: ",y," "),v&&n.createElement("a",{href:v,target:a,className:"text-link"},D)):"",C?n.createElement("div",{key:"infoBoxHtml",className:`grafana-info-box ${l}`},P&&n.createElement("h5",null,P),n.createElement("div",{dangerouslySetInnerHTML:C})):""),M=b()?"":(0,t.css)` margin-bottom: 20px; `,T=p?r.Qj:r.zx,S=n.createElement(T,{size:"lg",onClick:h,href:p,icon:c,className:M,"data-testid":i.wl.components.CallToActionCard.buttonV2(f),disabled:E},f);return n.createElement(g._,{className:d,message:m,footer:b(),callToActionElement:S})}},40387:(j,I,e)=>{"use strict";e.d(I,{$_:()=>u,dP:()=>r});var t=e(27702),n=e(34667),i=e(73453),s=e(65322);let r=()=>[{target:"_blank",id:"documentation",text:(0,s.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,s.t)("nav.help/support","Support"),icon:"question-circle",url:"https://grafana.com/products/enterprise/?utm_source=grafana_footer"},{target:"_blank",id:"community",text:(0,s.t)("nav.help/community","Community"),icon:"comments-alt",url:"https://community.grafana.com/?utm_source=grafana_footer"}];function g(m){return{hasReleaseNotes:!0,isBeta:m.includes("-beta")}}function d(m){const{buildInfo:c,licenseInfo:p}=n.config,f=[],E=p.stateInfo?` (${p.stateInfo})`:"";if(m||f.push({target:"_blank",id:"license",text:`${c.edition}${E}`,url:p.licenseUrl}),c.hideVersion)return f;const{hasReleaseNotes:h}=g(c.version);return f.push({target:"_blank",id:"version",text:`v${c.version} (${c.commit})`,url:h?"https://github.com/grafana/grafana/blob/main/CHANGELOG.md":void 0}),c.hasUpdate&&f.push({target:"_blank",id:"updateVersion",text:"New version available!",icon:"download-alt",url:"https://grafana.com/grafana/download?utm_source=grafana_footer"}),f}function l(m){r=m}const u=t.memo(({customLinks:m,hideEdition:c})=>{const p=(m||r()).concat(d(c));return t.createElement("footer",{className:"footer"},t.createElement("div",{className:"text-center"},t.createElement("ul",null,p.map(f=>t.createElement("li",{key:f.text},t.createElement(o,{item:f}))))))});u.displayName="Footer";function o({item:m}){const c=m.url?t.createElement("a",{href:m.url,target:m.target,rel:"noopener noreferrer",id:m.id},m.text):m.text;return t.createElement(t.Fragment,null,m.icon&&t.createElement(i.J,{name:m.icon})," ",c)}},2578:(j,I,e)=>{"use strict";e.d(I,{G:()=>m});var t=e(27702),n=e(74639),i=e(23839),s=e(63439),r=e(22209),g=e(64022),d=e(66670),l=e(80011),u=e(79562),o=e(77597);const m=({onSubmit:c,onSkip:p,showDefaultPasswordWarning:f})=>{const E=h=>{c(h.newPassword)};return t.createElement(i.l,{onSubmit:E},({errors:h,register:y,getValues:v})=>t.createElement(t.Fragment,null,f&&t.createElement(s.b,{severity:"info",title:"Continuing to use the default password exposes you to security risks."}),t.createElement(r.g,{label:"New password",invalid:!!h.newPassword,error:h?.newPassword?.message},t.createElement(o.Z,{id:"new-password",autoFocus:!0,autoComplete:"new-password",...y("newPassword",{required:"New Password is required"})})),t.createElement(r.g,{label:"Confirm new password",invalid:!!h.confirmNew,error:h?.confirmNew?.message},t.createElement(o.Z,{id:"confirm-new-password",autoComplete:"new-password",...y("confirmNew",{required:"Confirmed Password is required",validate:D=>D===v().newPassword||"Passwords must match!"})})),t.createElement(g.wc,null,t.createElement(d.zx,{type:"submit",className:u.F},"Submit"),p&&t.createElement(l.u,{content:"If you skip you will be prompted to change password next time you log in.",placement:"bottom"},t.createElement(d.zx,{fill:"text",onClick:p,type:"button","aria-label":n.wl.pages.Login.skip},"Skip")))))}},71654:(j,I,e)=>{"use strict";e.d(I,{w:()=>d});var t=e(27702),n=e(29956),i=e(48024),s=e(1128);const r=/^(-?\d+(?:\.\d+)?)(ms|[Mwdhmsy])$/,g=(l,u)=>!(l.match(u)||!l),d=l=>{const u=l.validationRegex||r,[o,m]=(0,t.useState)(()=>l.value?g(l.value,u):!1);(0,n.Z)(()=>{m(g(l.value,u))},500,[l.value]);const c={labelWidth:26,disabled:l.disabled??!1,invalid:o,error:l.isInvalidError};return l.label&&(c.label=l.label,c.tooltip=l.tooltip||""),t.createElement(i._,{...c},t.createElement(s.I,{type:"text",placeholder:l.placeholder||"0",width:l.width||40,onChange:p=>{l.onChange(p.currentTarget.value)},value:l.value,"aria-label":l.ariaLabel||"interval input"}))}},84270:(j,I,e)=>{"use strict";e.d(I,{X:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(73453),r=e(1128),g=e(59904);const d=({name:u,onChange:o,verifyLayerNameUniqueness:m,overrideStyles:c})=>{const p=(0,i.wW)(l),[f,E]=(0,n.useState)(!1),[h,y]=(0,n.useState)(null),v=M=>{E(!0)},D=M=>{if(E(!1),h){y(null);return}u!==M&&o(M)},a=M=>{const T=M.currentTarget.value.trim();if(T.length===0){y("An empty layer name is not allowed");return}if(m&&!m(T)&&T!==u){y("Layer name already exists");return}h&&y(null)},C=M=>{D(M.currentTarget.value.trim())},P=M=>{M.key==="Enter"&&D(M.currentTarget.value)},b=M=>{M.target.select()};return n.createElement(n.Fragment,null,n.createElement("div",{className:p.wrapper},!f&&n.createElement("button",{className:p.layerNameWrapper,title:"Edit layer name",onClick:v,"data-testid":"layer-name-div"},n.createElement("span",{className:c?"":p.layerName},u),n.createElement(s.J,{name:"pen",className:p.layerEditIcon,size:"sm"})),f&&n.createElement(n.Fragment,null,n.createElement(r.I,{type:"text",defaultValue:u,onBlur:C,autoFocus:!0,onKeyDown:P,onFocus:b,invalid:h!==null,onChange:a,className:p.layerNameInput,"data-testid":"layer-name-input"}),h&&n.createElement(g.S,{horizontal:!0},h))))},l=u=>({wrapper:(0,t.css)` label: Wrapper; display: flex; align-items: center; margin-left: ${u.spacing(.5)}; `,layerNameWrapper:(0,t.css)` display: flex; cursor: pointer; border: 1px solid transparent; border-radius: ${u.shape.borderRadius(2)}; align-items: center; padding: 0 0 0 ${u.spacing(.5)}; margin: 0; background: transparent; &:hover { background: ${u.colors.action.hover}; border: 1px dashed ${u.colors.border.strong}; } &:focus { border: 2px solid ${u.colors.primary.border}; } &:hover, &:focus { .query-name-edit-icon { visibility: visible; } } `,layerName:(0,t.css)` font-weight: ${u.typography.fontWeightMedium}; color: ${u.colors.primary.text}; cursor: pointer; overflow: hidden; margin-left: ${u.spacing(.5)}; `,layerEditIcon:(0,t.cx)((0,t.css)` margin-left: ${u.spacing(2)}; visibility: hidden; `,"query-name-edit-icon"),layerNameInput:(0,t.css)` max-width: 300px; margin: -4px 0; `})},74273:(j,I,e)=>{"use strict";e.d(I,{G:()=>i});var t=e(27702),n=e(56812);const i=s=>{const{children:r,storageKey:g,defaultValue:d}=s,[l,u]=(0,t.useState)({value:n.Z.getObject(s.storageKey,s.defaultValue)});(0,t.useEffect)(()=>{const c=p=>{p.key===g&&u({value:n.Z.getObject(s.storageKey,s.defaultValue)})};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}});const o=c=>{try{n.Z.setObject(g,c)}catch(p){console.error(p)}u({value:c})},m=()=>{try{n.Z.delete(g)}catch(c){console.log(c)}u({value:d})};return t.createElement(t.Fragment,null,r(l.value,o,m))}},97706:(j,I,e)=>{"use strict";e.d(I,{Z:()=>d});var t=e(27702),n=e(73289),i=e(12308),s=e(65322);const r=()=>!!i.default.oauth&&Object.keys(i.default.oauth).length>0;class g extends t.PureComponent{constructor(o){super(o),this.changePassword=m=>{const c={newPassword:m,confirmNew:m,oldPassword:"admin"};if(this.props.resetCode){const p={code:this.props.resetCode,newPassword:m,confirmPassword:m};(0,n.i)().post("/api/user/password/reset",p).then(()=>{this.toGrafana()})}else(0,n.i)().put("/api/user/password",c).then(()=>{this.toGrafana()}).catch(p=>console.error(p))},this.login=m=>{this.setState({loginErrorMessage:void 0,isLoggingIn:!0}),(0,n.i)().post("/login",m,{showErrorAlert:!1}).then(c=>{if(this.result=c,m.password!=="admin"||i.default.ldapEnabled||i.default.authProxyEnabled){this.toGrafana();return}else this.changeView(m.password==="admin")}).catch(c=>{const p=(0,n.kW)(c)?l(c):void 0;this.setState({isLoggingIn:!1,loginErrorMessage:p||(0,s.t)("login.error.unknown","Unknown error occurred")})})},this.changeView=m=>{this.setState({isChangingPassword:!0,showDefaultPasswordWarning:m})},this.toGrafana=()=>{this.result?.redirectUrl?i.default.appSubUrl!==""&&!this.result.redirectUrl.startsWith(i.default.appSubUrl)?window.location.assign(i.default.appSubUrl+this.result.redirectUrl):window.location.assign(this.result.redirectUrl):window.location.assign(i.default.appSubUrl+"/")},this.state={isLoggingIn:!1,isChangingPassword:!1,showDefaultPasswordWarning:!1,loginErrorMessage:i.default.loginError}}render(){const{children:o}=this.props,{isLoggingIn:m,isChangingPassword:c,showDefaultPasswordWarning:p,loginErrorMessage:f}=this.state,{login:E,toGrafana:h,changePassword:y}=this,{loginHint:v,passwordHint:D,disableLoginForm:a,disableUserSignUp:C}=i.default;return t.createElement(t.Fragment,null,o({isOauthEnabled:r(),loginHint:v,passwordHint:D,disableLoginForm:a,disableUserSignUp:C,login:E,isLoggingIn:m,changePassword:y,skipPasswordChange:h,isChangingPassword:c,showDefaultPasswordWarning:p,loginErrorMessage:f}))}}const d=g;function l(u){switch(u.data?.messageId){case"password-auth.empty":case"password-auth.failed":case"password-auth.invalid":return(0,s.t)("login.error.invalid-user-or-password","Invalid username or password");case"login-attempt.blocked":return(0,s.t)("login.error.blocked","You have exceeded the number of login attempts for this user. Please try again later.");default:return u.data?.message}}},79562:(j,I,e)=>{"use strict";e.d(I,{F:()=>o,U:()=>m});var t=e(42844),n=e(27702),i=e(74639),s=e(23839),r=e(22209),g=e(1128),d=e(66670),l=e(77597);const u=(0,t.css)` width: 100%; padding-bottom: 16px; `,o=(0,t.css)` justify-content: center; width: 100%; `,m=({children:c,onSubmit:p,isLoggingIn:f,passwordHint:E,loginHint:h})=>n.createElement("div",{className:u},n.createElement(s.l,{onSubmit:p,validateOn:"onChange"},({register:y,errors:v})=>n.createElement(n.Fragment,null,n.createElement(r.g,{label:"Email or username",invalid:!!v.user,error:v.user?.message},n.createElement(g.I,{...y("user",{required:"Email or username is required"}),autoFocus:!0,autoCapitalize:"none",placeholder:h,"aria-label":i.wl.pages.Login.username})),n.createElement(r.g,{label:"Password",invalid:!!v.password,error:v.password?.message},n.createElement(l.Z,{id:"current-password",autoComplete:"current-password",passwordHint:E,...y("password",{required:"Password is required"})})),n.createElement(d.zx,{type:"submit","aria-label":i.wl.pages.Login.submit,className:o,disabled:f},f?"Logging in...":"Log in"),c)))},8874:(j,I,e)=>{"use strict";e.d(I,{$s:()=>d,dd:()=>l,pJ:()=>o});var t=e(42844),n=e(27702),i=e(66310),s=e(97289),r=e(76404),g=e(40387);const d=({children:m,enterAnimation:c=!0})=>{const p=(0,i.wW)(o);return n.createElement("div",{className:(0,t.cx)(p.loginInnerBox,c&&p.enterAnimation)},m)},l=({children:m,branding:c,isChangingPassword:p})=>{const f=(0,i.wW)(o),[E,h]=(0,n.useState)(!1),y=c?.loginSubtitle??r.c.GetLoginSubTitle(),v=c?.loginTitle??r.c.LoginTitle,D=c?.loginBoxBackground||r.c.LoginBoxBackground(),a=c?.loginLogo,C=c?.hideEdition??r.c.HideEdition;return(0,n.useEffect)(()=>h(!0),[]),n.createElement(r.c.LoginBackground,{className:(0,t.cx)(f.container,E&&f.loginAnim,c?.loginBackground)},n.createElement("div",{className:f.loginMain},n.createElement("div",{className:(0,t.cx)(f.loginContent,D,"login-content-box")},n.createElement("div",{className:f.loginLogoWrapper},n.createElement(r.c.LoginLogo,{className:f.loginLogo,logo:a}),n.createElement("div",{className:f.titleWrapper},p?n.createElement("h1",{className:f.mainTitle},"Update your password"):n.createElement(n.Fragment,null,n.createElement("h1",{className:f.mainTitle},v),y&&n.createElement("h3",{className:f.subTitle},y)))),n.createElement("div",{className:f.loginOuterBox},m))),c?.hideFooter?n.createElement(n.Fragment,null):n.createElement(g.$_,{hideEdition:C,customLinks:c?.footerLinks}))},u=(0,t.keyframes)` from{ opacity: 0; transform: translate(-60px, 0px); } to{ opacity: 1; transform: translate(0px, 0px); }`,o=m=>({loginMain:(0,t.css)({flexGrow:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minWidth:"100%"}),container:(0,t.css)({minHeight:"100%",backgroundPosition:"center",backgroundRepeat:"no-repeat",minWidth:"100%",marginLeft:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}),loginAnim:(0,t.css)` &:before { opacity: 1; } .login-content-box { opacity: 1; } `,submitButton:(0,t.css)` justify-content: center; width: 100%; `,loginLogo:(0,t.css)` width: 100%; max-width: 60px; margin-bottom: 15px; @media ${s.mediaUp(m.v1.breakpoints.sm)} { max-width: 100px; } `,loginLogoWrapper:(0,t.css)` display: flex; align-items: center; justify-content: center; flex-direction: column; padding: ${m.spacing(3)}; `,titleWrapper:(0,t.css)` text-align: center; `,mainTitle:(0,t.css)` font-size: 22px; @media ${s.mediaUp(m.v1.breakpoints.sm)} { font-size: 32px; } `,subTitle:(0,t.css)` font-size: ${m.typography.size.md}; color: ${m.colors.text.secondary}; `,loginContent:(0,t.css)` max-width: 478px; width: calc(100% - 2rem); display: flex; align-items: stretch; flex-direction: column; position: relative; justify-content: flex-start; z-index: 1; min-height: 320px; border-radius: ${m.shape.borderRadius(4)}; padding: ${m.spacing(2,0)}; opacity: 0; transition: opacity 0.5s ease-in-out; @media ${s.mediaUp(m.v1.breakpoints.sm)} { min-height: 320px; justify-content: center; } `,loginOuterBox:(0,t.css)` display: flex; overflow-y: hidden; align-items: center; justify-content: center; `,loginInnerBox:(0,t.css)` padding: ${m.spacing(0,2,2,2)}; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; max-width: 415px; width: 100%; transform: translate(0px, 0px); transition: 0.25s ease; `,enterAnimation:(0,t.css)` animation: ${u} ease-out 0.2s; `})},55093:(j,I,e)=>{"use strict";e.d(I,{Y:()=>g});var t=e(89949),n=e.n(t),i=e(27702),s=e(1128),r=e(22209);class g extends i.PureComponent{constructor(){super(...arguments),this.state={text:"",inputCorrected:!1},this.inputRef=i.createRef(),this.updateValue=()=>{const l=this.inputRef.current?.value;let u=!1,o="";const m=this.props.min,c=this.props.max;let p=l!==""?Number(l):void 0;p&&!Number.isNaN(p)&&(m!=null&&p<m?(o=m.toString(),u=!0):c!=null&&p>c?(o=c.toString(),u=!0):o=l??"",this.setState({text:o,inputCorrected:u})),u&&this.updateValueDebounced(),!Number.isNaN(p)&&p!==this.props.value&&this.props.onChange(p)},this.updateValueDebounced=(0,t.debounce)(this.updateValue,500),this.onChange=l=>{this.setState({text:l.currentTarget.value}),this.updateValueDebounced()},this.onKeyPress=l=>{l.key==="Enter"&&this.updateValue()}}componentDidMount(){this.setState({text:isNaN(this.props.value)?"":`${this.props.value}`})}componentDidUpdate(l){if(this.props.value!==l.value){const u=isNaN(this.props.value)?"":`${this.props.value}`;u!==this.state.text&&this.setState({text:u})}}renderInput(){return i.createElement(s.I,{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:l}=this.state;if(l){let u="",{min:o,max:m}=this.props;return m==null?o!=null&&(u=`< ${o}`):o!=null?u=`${o} < > ${m}`:u=`> ${m}`,i.createElement(r.g,{invalid:l,error:`Out of range ${u}`,validationMessageHorizontalOverflow:!0,style:{direction:"rtl"}},this.renderInput())}return this.renderInput()}}},74908:(j,I,e)=>{"use strict";e.d(I,{B:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(56025),r=e(67437),g=e(79262);const d=({value:u,settings:o,onChange:m,details:c})=>{const p=(0,i.l4)(),f=(0,i.wW)(l);return n.createElement(s.zH,{color:u??"",onChange:m,enableNamedColors:o?.enableNamedColors!==!1},({ref:E,showColorPicker:h,hideColorPicker:y})=>n.createElement("div",{className:f.spot},n.createElement("div",{className:f.colorPicker},n.createElement(g.b,{ref:E,onClick:h,onMouseLeave:y,color:u?p.visualization.getColorByName(u):p.components.input.borderColor})),c&&n.createElement(n.Fragment,null,u?n.createElement("span",{className:f.colorText,onClick:h},u):n.createElement("span",{className:f.placeholderText,onClick:h},o?.placeholder??"Select color"),o?.isClearable&&u&&n.createElement(r.h,{name:"times",onClick:()=>m(void 0),tooltip:"Clear settings"}))))},l=u=>({spot:(0,t.css)` cursor: pointer; color: ${u.colors.text}; background: ${u.components.input.background}; padding: 3px; height: ${u.v1.spacing.formInputHeight}px; border: 1px solid ${u.components.input.borderColor}; display: flex; flex-direction: row; align-items: center; align-content: flex-end; &:hover { border: 1px solid ${u.components.input.borderHover}; } `,colorPicker:(0,t.css)` padding: 0 ${u.spacing(1)}; `,colorText:(0,t.css)` flex-grow: 2; `,placeholderText:(0,t.css)` flex-grow: 2; color: ${u.colors.text.secondary}; `})},48570:(j,I,e)=>{"use strict";e.d(I,{w:()=>i});var t=e(27702),n=e(55093);const i=({value:s,onChange:r,item:g})=>{const{settings:d}=g,l=(0,t.useCallback)(u=>{r(d?.integer&&u!==void 0?Math.floor(u):u)},[r,d?.integer]);return t.createElement(n.Y,{value:s,min:d?.min,max:d?.max,step:d?.step,placeholder:d?.placeholder,onChange:l})}},53035:(j,I,e)=>{"use strict";e.d(I,{u:()=>bt,l:()=>Rt});var t=e(27702),n=e(41199),i=e(27001),s=e(29241),r=e(5168),g=e(42074),d=e(40705),l=e(15672),u=e(86912),o=e(42844),m=e(89949),c=e(77104),p=e(5354),f=e(1128),E=e(56025),h=e(67437),y=e(66310),v=e(66670),D=e(79978),a=e(80402);const C=[{value:r.H.Absolute,label:"Absolute",description:"Pick thresholds based on the absolute values"},{value:r.H.Percentage,label:"Percentage",description:"Pick threshold based on the percent between min/max"}];class P extends t.PureComponent{constructor(it){super(it),this.onAddThreshold=()=>{const{steps:Ee}=this.state;let Ce=0;Ee.length>1&&(Ce=Ee[Ee.length-1].value+10);let Ae=p.O9.filter(xe=>!Ee.some(Te=>Te.color===xe))[1];Ae||(Ae="#CCCCCC");const ze={value:Ce,color:Ae,key:b++},Ie=[...Ee,ze];(0,c.bP)(Ie),this.setState({steps:Ie},()=>{this.latestThresholdInputRef.current&&this.latestThresholdInputRef.current.focus(),this.onChange()})},this.onRemoveThreshold=Ee=>{const{steps:Ce}=this.state;Ce.length&&Ee.key!==Ce[0].key&&this.setState({steps:Ce.filter(Ae=>Ae.key!==Ee.key)},this.onChange)},this.onChangeThresholdValue=(Ee,Ce)=>{const Ae=Ee.target.value.replace(/,/g,"."),ze=parseFloat(Ae),Ie=isNaN(ze)?"":ze,xe=this.state.steps.map(Te=>(Te.key===Ce.key&&(Te={...Te,value:Ie}),Te));xe.length&&(xe[0].value=-1/0),(0,c.bP)(xe),this.setState({steps:xe})},this.onChangeThresholdColor=(Ee,Ce)=>{const{steps:Ae}=this.state,ze=Ae.map(Ie=>(Ie.key===Ee.key&&(Ie={...Ie,color:Ce}),Ie));this.setState({steps:ze},this.onChange)},this.onBlur=()=>{const Ee=[...this.state.steps];(0,c.bP)(Ee),this.setState({steps:Ee},this.onChange)},this.onChange=()=>{this.props.onChange(T(this.props.thresholds,this.state.steps))},this.onModeChanged=Ee=>{this.props.onChange({...this.props.thresholds,mode:Ee})};const me=M(it.thresholds.steps);me[0].value=-1/0,this.state={steps:me},this.latestThresholdInputRef=t.createRef()}renderInput(it,me,Ee){const Ce=this.props.thresholds.mode===r.H.Percentage,Ae=`Threshold ${Ee+1}`;return isFinite(it.value)?t.createElement(f.I,{type:"number",step:"0.0001",key:Ce.toString(),onChange:ze=>this.onChangeThresholdValue(ze,it),value:it.value,"aria-label":Ae,ref:Ee===0?this.latestThresholdInputRef:null,onBlur:this.onBlur,prefix:t.createElement("div",{className:me.inputPrefix},t.createElement("div",{className:me.colorPicker},t.createElement(E.zH,{color:it.color,onChange:ze=>this.onChangeThresholdColor(it,ze),enableNamedColors:!0})),Ce&&t.createElement("div",{className:me.percentIcon},"%")),suffix:t.createElement(h.h,{className:me.trashIcon,name:"trash-alt",onClick:()=>this.onRemoveThreshold(it),tooltip:`Remove ${Ae}`})}):t.createElement(f.I,{type:"text",value:"Base","aria-label":Ae,disabled:!0,prefix:t.createElement("div",{className:me.colorPicker},t.createElement(E.zH,{color:it.color,onChange:ze=>this.onChangeThresholdColor(it,ze),enableNamedColors:!0}))})}render(){const{thresholds:it}=this.props,{steps:me}=this.state;return t.createElement(y.Ni.Consumer,null,Ee=>{const Ce=S(Ee);return t.createElement("div",{className:Ce.wrapper},t.createElement(v.zx,{size:"sm",icon:"plus",onClick:()=>this.onAddThreshold(),variant:"secondary",className:Ce.addButton,fullWidth:!0},"Add threshold"),t.createElement("div",{className:Ce.thresholds},me.slice(0).reverse().map((Ae,ze)=>t.createElement("div",{className:Ce.item,key:`${Ae.key}`},this.renderInput(Ae,Ce,ze)))),t.createElement("div",null,t.createElement(D._,{description:"Percentage means thresholds relative to min & max"},"Thresholds mode"),t.createElement(d.S,{options:C,onChange:this.onModeChanged,value:it.mode})))})}}let b=100;function M(ct){return(!ct||ct.length===0)&&(ct=[{value:-1/0,color:"green"}]),ct.filter((it,me)=>(0,m.isNumber)(it.value)||me===0).map(it=>({color:it.color,value:it.value===null?-1/0:it.value,key:b++}))}function T(ct,it){return{mode:ct.mode??r.H.Absolute,steps:it.map(Ee=>{const{key:Ce,...Ae}=Ee;return Ae})}}const S=(0,a.B)(ct=>({wrapper:(0,o.css)` display: flex; flex-direction: column; `,thresholds:(0,o.css)` display: flex; flex-direction: column; margin-bottom: ${ct.spacing(2)}; `,item:(0,o.css)` margin-bottom: ${ct.spacing(1)}; &:last-child { margin-bottom: 0; } `,colorPicker:(0,o.css)` padding: 0 ${ct.spacing(1)}; `,addButton:(0,o.css)` margin-bottom: ${ct.spacing(1)}; `,percentIcon:(0,o.css)` font-size: ${ct.typography.bodySmall.fontSize}; color: ${ct.colors.text.secondary}; `,inputPrefix:(0,o.css)` display: flex; align-items: center; `,trashIcon:(0,o.css)` color: ${ct.colors.text.secondary}; cursor: pointer; margin-right: 0; &:hover { color: ${ct.colors.text}; } `}));class x extends t.PureComponent{constructor(it){super(it)}render(){const{onChange:it}=this.props;let me=this.props.value;return me||(me={mode:r.H.Percentage,steps:[]}),t.createElement(P,{thresholds:me,onChange:it})}}var O=e(51046),B=e(64022),A=e(73453),V=e(13741),W=e(1553),w=e(95535),N=e(85532),F=e(73990),k=e(28580);function H({mapping:ct,index:it,onChange:me,onRemove:Ee,onDuplicate:Ce,showIconPicker:Ae}){const{key:ze,result:Ie,id:xe}=ct,Te=(0,y.wW)(R),Oe=(0,t.useRef)(null),ie=(0,t.useCallback)(rt=>{const pt={...ct,result:{...ct.result}};rt(pt),me(it,pt)},[ct,it,me]);(0,t.useEffect)(()=>{Oe.current&&ct.isNew&&(Oe.current.focus(),ie(rt=>{rt.isNew=!1}))},[ct,Oe,ie]);const Le=rt=>{ie(pt=>{pt.result.color=rt})},Be=()=>{ie(rt=>{rt.result.color=void 0})},Ue=rt=>{ie(pt=>{pt.result.icon=rt})},ue=()=>{ie(rt=>{rt.result.icon=void 0})},pe=rt=>{ie(pt=>{pt.key=rt.currentTarget.value})},$e=rt=>{ie(pt=>{pt.result.text=rt.currentTarget.value})},Se=rt=>{ie(pt=>{pt.from=parseFloat(rt.currentTarget.value)})},Ve=rt=>{ie(pt=>{pt.to=parseFloat(rt.currentTarget.value)})},He=rt=>{ie(pt=>{pt.pattern=rt.currentTarget.value})},Ze=rt=>{ie(pt=>{pt.specialMatch=rt.value})},Qe=[{label:"Null",value:O.e.Null,description:"Matches null and undefined values"},{label:"NaN",value:O.e.NaN,description:"Matches against Number.NaN (not a number)"},{label:"Null + NaN",value:O.e.NullAndNaN,description:"Matches null, undefined and NaN"},{label:"True",value:O.e.True,description:"Boolean true values"},{label:"False",value:O.e.False,description:"Boolean false values"},{label:"Empty",value:O.e.Empty,description:"Empty string"}];return t.createElement(N._l,{key:xe,draggableId:xe,index:it},rt=>t.createElement("tr",{className:Te.dragRow,ref:rt.innerRef,...rt.draggableProps},t.createElement("td",null,t.createElement("div",{className:Te.dragHandle,...rt.dragHandleProps},t.createElement(A.J,{name:"draggabledots",size:"lg"}))),t.createElement("td",{className:Te.typeColumn},ct.type),t.createElement("td",null,ct.type===O.H.ValueToText&&t.createElement(f.I,{ref:Oe,type:"text",value:ze??"",onChange:pe,placeholder:"Exact value to match"}),ct.type===O.H.RangeToText&&t.createElement("div",{className:Te.rangeInputWrapper},t.createElement(f.I,{type:"number",value:ct.from??"",placeholder:"Range start",onChange:Se,prefix:"From"}),t.createElement(f.I,{type:"number",value:ct.to??"",placeholder:"Range end",onChange:Ve,prefix:"To"})),ct.type===O.H.RegexToText&&t.createElement(f.I,{type:"text",value:ct.pattern??"",placeholder:"Regular expression",onChange:He}),ct.type===O.H.SpecialValue&&t.createElement(k.Ph,{value:Qe.find(pt=>pt.value===ct.specialMatch),options:Qe,onChange:Ze})),t.createElement("td",null,t.createElement(f.I,{type:"text",value:Ie.text??"",onChange:$e,placeholder:"Optional display text"})),t.createElement("td",{className:Te.textAlignCenter},Ie.color&&t.createElement(B.Lh,{spacing:"sm",justify:"center"},t.createElement(E.zH,{color:Ie.color,onChange:Le,enableNamedColors:!0}),t.createElement(h.h,{name:"times",onClick:Be,tooltip:"Remove color",tooltipPlacement:"top"})),!Ie.color&&t.createElement(E.zH,{color:"gray",onChange:Le,enableNamedColors:!0},pt=>t.createElement(v.zx,{variant:"primary",fill:"text",onClick:pt.showColorPicker,ref:pt.ref,size:"sm"},"Set color"))),Ae&&t.createElement("td",{className:Te.textAlignCenter},t.createElement(B.Lh,{spacing:"sm",justify:"center"},t.createElement(w.E,{onChange:Ue,onClear:ue,value:Ie.icon,size:W.zc.SMALL,folderName:W.QS.Icon,mediaType:W.DD.Icon,color:Ie.color}),Ie.icon&&t.createElement(h.h,{name:"times",onClick:ue,tooltip:"Remove icon",tooltipPlacement:"top"}))),t.createElement("td",{className:Te.textAlignCenter},t.createElement(B.Lh,{spacing:"sm"},t.createElement(h.h,{name:"copy",onClick:()=>Ce(it),"data-testid":"duplicate-value-mapping","aria-label":"Duplicate value mapping",tooltip:"Duplicate"}),t.createElement(h.h,{name:"trash-alt",onClick:()=>Ee(it),"data-testid":"remove-value-mapping","aria-label":"Delete value mapping",tooltip:"Delete"})))))}const R=ct=>({dragRow:(0,o.css)({position:"relative"}),dragHandle:(0,o.css)({cursor:"grab","&:focus-visible&:after":{bottom:0,content:'""',left:0,position:"absolute",right:0,top:0,outline:`2px solid ${ct.colors.primary.main}`,outlineOffset:"-2px"}}),rangeInputWrapper:(0,o.css)({display:"flex","> div:first-child":{marginRight:ct.spacing(2)}}),regexInputWrapper:(0,o.css)({display:"flex","> div:first-child":{marginRight:ct.spacing(2)}}),typeColumn:(0,o.css)({textTransform:"capitalize",textAlign:"center",width:"1%"}),textAlignCenter:(0,o.css)({textAlign:"center"})});function _({value:ct,onChange:it,onClose:me,showIconPicker:Ee}){const Ce=(0,y.wW)(G),[Ae,ze]=(0,t.useState)([]);(0,t.useEffect)(()=>{ze(Z(ct))},[ct]);const Ie=Ue=>{if(!ct||!Ue.destination)return;const ue=[...Ae],pe=ue[Ue.source.index];ue.splice(Ue.source.index,1),ue.splice(Ue.destination.index,0,pe),ze(ue)},xe=(Ue,ue)=>{const pe=[...Ae];pe.splice(Ue,1,ue),ze(pe)},Te=Ue=>{const ue=[...Ae];ue.splice(Ue,1),ze(ue)},Oe=[{label:"Value",value:O.H.ValueToText,description:"Match a specific text value"},{label:"Range",value:O.H.RangeToText,description:"Match a numerical range of values"},{label:"Regex",value:O.H.RegexToText,description:"Match a regular expression with replacement"},{label:"Special",value:O.H.SpecialValue,description:"Match on null, NaN, boolean and empty values"}],ie=Ue=>{ze([...Ae,X({type:Ue.value,result:{},isNew:!0})])},Le=Ue=>{const ue=Q(Ae[Ue]),pe=[...Ae];pe.splice(Ue,0,{...ue});for(let $e=Ue;$e<Ae.length;$e++)pe[$e].result.index=$e;ze(pe)},Be=()=>{it(se(Ae)),me()};return(0,t.useEffect)(()=>{ct?.length||ie({value:O.H.ValueToText})},[]),t.createElement(t.Fragment,null,t.createElement("div",{className:Ce.tableWrap},t.createElement("table",{className:Ce.editTable},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",{style:{width:"1%"}}),t.createElement("th",{style:{width:"40%",textAlign:"left"},colSpan:2},"Condition"),t.createElement("th",{style:{textAlign:"left"}},"Display text"),t.createElement("th",{style:{width:"10%"}},"Color"),Ee&&t.createElement("th",{style:{width:"10%"}},"Icon"),t.createElement("th",{style:{width:"1%"}}))),t.createElement(N.Z5,{onDragEnd:Ie},t.createElement(N.bK,{droppableId:"sortable-field-mappings",direction:"vertical"},Ue=>t.createElement("tbody",{ref:Ue.innerRef,...Ue.droppableProps},Ae.map((ue,pe)=>t.createElement(H,{key:ue.id,mapping:ue,index:pe,onChange:xe,onRemove:Te,onDuplicate:Le,showIconPicker:Ee})),Ue.placeholder))))),t.createElement(V.u.ButtonRow,{leftItems:t.createElement(F.b,{label:"Add a new mapping",variant:"secondary",size:"md",icon:"plus",menuPlacement:"auto",minWidth:40,options:Oe,onChange:ie})},t.createElement(v.zx,{variant:"secondary",fill:"outline",onClick:me},"Cancel"),t.createElement(v.zx,{variant:"primary",onClick:Be},"Update")))}const G=ct=>({tableWrap:(0,o.css)` max-height: calc(80vh - 170px); min-height: 40px; overflow: auto; `,editTable:(0,o.css)({width:"100%",marginBottom:ct.spacing(2),"thead th":{textAlign:"center"},"tbody tr:hover":{background:ct.colors.action.hover}," th, td":{padding:ct.spacing(1)}})});function Y(){return(0,m.uniqueId)("mapping-")}function X(ct){return{type:O.H.ValueToText,result:{},id:Y(),...ct}}function Q(ct){return{...X(ct),id:Y()}}function se(ct){const it=[],me={type:O.H.ValueToText,options:{}};return ct.forEach((Ee,Ce)=>{const Ae={...Ee.result,index:Ce};switch((!Ae.text||Ae.text.trim().length===0)&&(Ae.text=void 0),Ee.type){case O.H.ValueToText:Ee.key!=null&&(me.options[Ee.key]=Ae);break;case O.H.RangeToText:Ee.from!=null&&Ee.to!=null&&it.push({type:Ee.type,options:{from:Ee.from,to:Ee.to,result:Ae}});break;case O.H.RegexToText:Ee.pattern!=null&&it.push({type:Ee.type,options:{pattern:Ee.pattern,result:Ae}});break;case O.H.SpecialValue:it.push({type:Ee.type,options:{match:Ee.specialMatch,result:Ae}})}}),Object.keys(me.options).length>0&&it.unshift(me),it}function Z(ct){const it=[];if(ct)for(const me of ct)switch(me.type){case O.H.ValueToText:for(const Ee of Object.keys(me.options))it.push(X({type:me.type,result:me.options[Ee],key:Ee}));break;case O.H.RangeToText:it.push(X({type:me.type,result:me.options.result,from:me.options.from??0,to:me.options.to??0}));break;case O.H.RegexToText:it.push(X({type:me.type,result:me.options.result,pattern:me.options.pattern}));break;case O.H.SpecialValue:it.push(X({type:me.type,result:me.options.result,specialMatch:me.options.match??O.e.Null}))}return it.sort((me,Ee)=>(me.result.index??0)>(Ee.result.index??0)?1:-1),it}const le=t.memo(ct=>{const{value:it,onChange:me,item:Ee}=ct,Ce=(0,y.wW)(oe),Ae=Ee.settings?.icon,[ze,Ie]=(0,t.useState)(!1),xe=(0,t.useCallback)(()=>{Ie(!1)},[Ie]),Te=(0,t.useMemo)(()=>Z(it),[it]),Oe=(0,t.useCallback)((Le,Be)=>{Te[Be].result.color=Le,me(se(Te))},[Te,me]),ie=(0,t.useCallback)((Le,Be)=>{Te[Be].result.icon=Le,me(se(Te))},[Te,me]);return t.createElement(B.wc,null,t.createElement("table",{className:Ce.compactTable},t.createElement("tbody",null,Te.map((Le,Be)=>t.createElement("tr",{key:Be.toString()},t.createElement("td",null,Le.type===O.H.ValueToText&&Le.key,Le.type===O.H.RangeToText&&t.createElement("span",null,"[",Le.from," - ",Le.to,"]"),Le.type===O.H.RegexToText&&Le.pattern,Le.type===O.H.SpecialValue&&Le.specialMatch),t.createElement("td",null,t.createElement(A.J,{name:"arrow-right"})),t.createElement("td",null,Le.result.text),Le.result.color&&t.createElement("td",null,t.createElement(E.zH,{color:Le.result.color,onChange:Ue=>Oe(Ue,Be),enableNamedColors:!0})),Ae&&Le.result.icon&&t.createElement("td",{"data-testid":"iconPicker"},t.createElement(w.E,{onChange:Ue=>ie(Ue,Be),value:Le.result.icon,size:W.zc.SMALL,folderName:W.QS.Icon,mediaType:W.DD.Icon,color:Le.result.color})))))),t.createElement(v.zx,{variant:"secondary",size:"sm",fullWidth:!0,onClick:()=>Ie(!0)},Te.length>0&&t.createElement("span",null,"Edit value mappings"),Te.length===0&&t.createElement("span",null,"Add value mappings")),t.createElement(V.u,{isOpen:ze,title:"Value mappings",onDismiss:xe,className:Ce.modal,closeOnBackdropClick:!1},t.createElement(_,{value:it,onChange:me,onClose:xe,showIconPicker:Ae})))});le.displayName="ValueMappingsEditor";const oe=ct=>({modal:(0,o.css)({width:"980px"}),compactTable:(0,o.css)({width:"100%","tbody td":{padding:ct.spacing(.5)}})});var q=e(81290);const ne=({value:ct,onChange:it,item:me})=>{const{placeholder:Ee,isClearable:Ce}=me?.settings??{},Ae=(0,t.useCallback)(ze=>{it(ze?.value?.uid)},[it]);return t.createElement(q.o,{isClearable:Ce,defaultOptions:!0,onChange:Ae,placeholder:Ee,value:ct})};var ge=e(74908),ae=e(58192),re=e(93666),De=e(22209);const he=({value:ct,onChange:it,item:me,id:Ee})=>{const Ce=(0,y.l4)(),Ae=(0,y.wW)(ce),ze=(0,ae.QY)(ct?.mode),xe=(me.settings?.byValueSupport?ae.WO.list():ae.WO.list().filter(Be=>!Be.isByValue)).map(Be=>{let Ue=Be.isByValue?" (by value)":"";return{value:Be.id,label:`${Be.name}${Ue}`,description:Be.description,isContinuous:Be.isContinuous,isByValue:Be.isByValue,component(){return t.createElement(ye,{mode:Be,theme:Ce})}}}),Te=Be=>{it({...ct,mode:Be.value})},Oe=Be=>{it({...ct,mode:Le,fixedColor:Be})},ie=Be=>{it({...ct,mode:Le,seriesBy:Be})},Le=ct?.mode??re.S.Thresholds;if(Le===re.S.Fixed||Le===re.S.Shades)return t.createElement("div",{className:Ae.group},t.createElement(k.Ph,{minMenuHeight:200,options:xe,value:Le,onChange:Te,className:Ae.select,inputId:Ee}),t.createElement(ge.B,{value:ct?.fixedColor,onChange:Oe}));if(me.settings?.bySeriesSupport&&ze.isByValue){const Be=[{label:"Last",value:"last"},{label:"Min",value:"min"},{label:"Max",value:"max"}];return t.createElement(t.Fragment,null,t.createElement("div",{style:{marginBottom:Ce.spacing(2)}},t.createElement(k.Ph,{minMenuHeight:200,options:xe,value:Le,onChange:Te,inputId:Ee})),t.createElement(De.g,{label:"Color series by"},t.createElement(d.S,{value:ct?.seriesBy??"last",options:Be,onChange:ie})))}return t.createElement(k.Ph,{minMenuHeight:200,options:xe,value:Le,onChange:Te,inputId:Ee})},ye=({mode:ct,theme:it})=>{if(!ct.getColors)return null;const me=ct.getColors(it).map(it.visualization.getColorByName),Ee={height:"8px",width:"100%",margin:"2px 0",borderRadius:"3px",opacity:1};if(ct.isContinuous)Ee.background=`linear-gradient(90deg, ${me.join(",")})`;else{let Ce="",Ae="";for(let ze=0;ze<me.length;ze++){const Ie=me[ze];if(Ce==="")Ce=`linear-gradient(90deg, ${Ie} 0%`;else{const Te=ze/(me.length-1)*100;Ce+=`, ${Ae} ${Te}%, ${Ie} ${Te}%`}Ae=Ie}Ee.background=Ce}return t.createElement("div",{style:Ee})},ce=ct=>({group:(0,o.css)` display: flex; `,select:(0,o.css)` margin-right: 8px; flex-grow: 1; `});var We=e(24094),ke=e(36537);const et=({value:ct,onChange:it,context:me})=>t.createElement(ke.d,{links:ct,onChange:it,data:me.data,getSuggestions:()=>me.getSuggestions?me.getSuggestions(We.o3.Values):[]});class we extends t.PureComponent{constructor(){super(...arguments),this.state={isLoading:!0,options:[]},this.updateOptions=async()=>{const{item:it}=this.props,{settings:me}=it;let Ee=it.settings?.options||[];me?.getOptions&&(Ee=await me.getOptions(this.props.context)),this.state.options!==Ee&&this.setState({isLoading:!1,options:Ee})}}componentDidMount(){this.updateOptions()}componentDidUpdate(it){const me=it.item?.settings,Ee=this.props.item?.settings;if(me!==Ee)this.updateOptions();else if(Ee?.getOptions){const Ce=it.context?.data,Ae=this.props.context?.data;Ce!==Ae&&this.updateOptions()}}render(){const{options:it,isLoading:me}=this.state,{value:Ee,onChange:Ce,item:Ae}=this.props,{settings:ze}=Ae;return t.createElement(k.NU,{isLoading:me,value:Ee,defaultValue:Ee,allowCustomValue:ze?.allowCustomValue,onChange:Ie=>{Ce(Ie.map(xe=>xe.value).flatMap(xe=>xe!==void 0?[xe]:[]))},options:it})}}var _e=e(48570);class Ge extends t.PureComponent{constructor(){super(...arguments),this.state={isLoading:!0,options:[]},this.updateOptions=async()=>{const{item:it}=this.props,{settings:me}=it;let Ee=it.settings?.options||[];me?.getOptions&&(Ee=await me.getOptions(this.props.context)),this.state.options!==Ee&&this.setState({isLoading:!1,options:Ee})}}componentDidMount(){this.updateOptions()}componentDidUpdate(it){const me=it.item?.settings,Ee=this.props.item?.settings;if(me!==Ee)this.updateOptions();else if(Ee?.getOptions){const Ce=it.context?.data,Ae=this.props.context?.data;Ce!==Ae&&this.updateOptions()}}render(){const{options:it,isLoading:me}=this.state,{value:Ee,onChange:Ce,item:Ae}=this.props,{settings:ze}=Ae;let Ie=it.find(xe=>xe.value===Ee);return!Ie&&Ee&&(Ie={label:`${Ee}`,value:Ee}),t.createElement(k.Ph,{isLoading:me,value:Ie,defaultValue:Ee,allowCustomValue:ze?.allowCustomValue,isClearable:ze?.isClearable,onChange:xe=>Ce(xe?.value),options:it})}}var qe=e(79451),st=e(10133);const Me=({value:ct,onChange:it,item:me,id:Ee})=>t.createElement(st.m,{stats:ct,onChange:it,allowMultiple:!!me.settings?.allowMultiple,defaultStat:me.settings?.defaultStat,inputId:Ee});var be=e(85819),Ke=e(34667);class Ye extends t.PureComponent{constructor(){super(...arguments),this.state={showAdd:!1},this.onRemoveString=it=>{const{value:me,onChange:Ee}=this.props,Ce=[...me];Ce.splice(it,1),Ee(Ce)},this.onValueChange=(it,me)=>{if("key"in it&&it.key!=="Enter")return;const{value:Ee,onChange:Ce}=this.props,Ae=it.currentTarget.value.trim();if(me<0){Ae&&(it.currentTarget.value="",Ce([...Ee,Ae])),this.setState({showAdd:!1});return}if(!Ae)return this.onRemoveString(me);const ze=[...Ee];ze[me]=Ae,Ce(ze)}}render(){const{value:it,item:me}=this.props,{showAdd:Ee}=this.state,Ce=tt(Ke.config.theme2),Ae=me.settings?.placeholder||"Add text";return t.createElement("div",null,it.map((ze,Ie)=>t.createElement(f.I,{className:Ce.textInput,key:`${Ie}/${ze}`,defaultValue:ze||"",onBlur:xe=>this.onValueChange(xe,Ie),onKeyDown:xe=>this.onValueChange(xe,Ie),suffix:t.createElement(A.J,{className:Ce.trashIcon,name:"trash-alt",onClick:()=>this.onRemoveString(Ie)})})),Ee?t.createElement(f.I,{autoFocus:!0,className:Ce.textInput,placeholder:Ae,defaultValue:"",onBlur:ze=>this.onValueChange(ze,-1),onKeyDown:ze=>this.onValueChange(ze,-1),suffix:t.createElement(A.J,{name:"plus-circle"})}):t.createElement(v.zx,{icon:"plus",size:"sm",variant:"secondary",onClick:()=>this.setState({showAdd:!0})},Ae))}}const tt=(0,a.B)(ct=>({textInput:(0,o.css)` margin-bottom: 5px; &:hover { border: 1px solid ${ct.components.input.borderHover}; } `,trashIcon:(0,o.css)` color: ${ct.colors.text.secondary}; cursor: pointer; &:hover { color: ${ct.colors.text}; } `}));var nt=e(62916);function Pt({value:ct,onChange:it,item:me}){const Ee=(0,y.wW)(xt);return me?.settings?.isClearable&&ct!=null?t.createElement("div",{className:Ee.wrapper},t.createElement("span",{className:Ee.first},t.createElement(nt.n,{value:ct,onChange:it})),t.createElement(h.h,{name:"times",onClick:()=>it(void 0),tooltip:"Clear unit selection"})):t.createElement(nt.n,{value:ct,onChange:it})}const xt=ct=>({wrapper:(0,o.css)` width: 100%; display: flex; flex-direction: rows; align-items: center; `,first:(0,o.css)` margin-right: 8px; flex-grow: 2; `}),bt=()=>{const ct={id:"number",name:"Number",description:"Allows numeric values input",editor:_e.w},it={id:"slider",name:"Slider",description:"Allows numeric values input",editor:qe.p},me={id:"text",name:"Text",description:"Allows string values input",editor:be.A},Ee={id:"strings",name:"String array",description:"An array of strings",editor:Ye},Ce={id:"boolean",name:"Boolean",description:"Allows boolean values input",editor(Se){const{id:Ve,...He}=Se;return t.createElement(g.r,{...He,onChange:Ze=>Se.onChange(Ze.currentTarget.checked)})}},Ae={id:"select",name:"Select",description:"Allows option selection",editor:Ge},ze={id:"multi-select",name:"Multi select",description:"Allows for multiple option selection",editor:we},Ie={id:"radio",name:"Radio",description:"Allows option selection",editor(Se){return t.createElement(d.S,{...Se,options:Se.item.settings?.options})}},xe={id:"unit",name:"Unit",description:"Allows unit input",editor:Pt},Te={id:"color",name:"Color",description:"Allows color selection",editor(Se){return t.createElement(ge.B,{value:Se.value,onChange:Se.onChange,settings:Se.item.settings,details:!0})}},Oe={id:"fieldColor",name:"Field Color",description:"Field color selection",editor:he},ie={id:"links",name:"Links",description:"Allows defining data links",editor:et},Le={id:"stats-picker",name:"Stats Picker",editor:Me,description:""},Be={id:"timezone",name:"Time zone",description:"Time zone selection",editor:l.O},Ue={id:"field-name",name:"Field name",description:"Allows selecting a field name from a data frame",editor:u.b};return[me,ct,it,Ce,Ie,Ae,xe,ie,Le,Ee,Be,Oe,Te,ze,Ue,{id:"dashboard-uid",name:"Dashboard",description:"Select dashboard",editor:ne},{id:"mappings",name:"Mappings",description:"Allows defining value mappings",editor:le},{id:"thresholds",name:"Thresholds",description:"Allows defining thresholds",editor:x}]},Rt=()=>{const ct=["Standard options"],it={id:"displayName",path:"displayName",name:"Display name",description:"Change the field or series name",editor:n.S.get("text").editor,override:n.S.get("text").editor,process:i.W0,settings:{placeholder:"none",expandTemplateVars:!0},shouldApply:()=>!0,category:ct},me={id:"unit",path:"unit",name:"Unit",description:"",editor:n.S.get("unit").editor,override:n.S.get("unit").editor,process:i.op,settings:{placeholder:"none"},shouldApply:()=>!0,category:ct},Ee={id:"min",path:"min",name:"Min",description:"Leave empty to calculate based on all values",editor:n.S.get("number").editor,override:n.S.get("number").editor,process:i.Oh,settings:{placeholder:"auto"},shouldApply:Le=>Le.type===s.fS.number,category:ct},Ce={id:"max",path:"max",name:"Max",description:"Leave empty to calculate based on all values",editor:n.S.get("number").editor,override:n.S.get("number").editor,process:i.Oh,settings:{placeholder:"auto"},shouldApply:Le=>Le.type===s.fS.number,category:ct},Ae={id:"decimals",path:"decimals",name:"Decimals",editor:n.S.get("number").editor,override:n.S.get("number").editor,process:i.Oh,settings:{placeholder:"auto",min:0,max:15,integer:!0},shouldApply:Le=>Le.type===s.fS.number,category:ct},ze={id:"noValue",path:"noValue",name:"No value",description:"What to show when there is no value",editor:n.S.get("text").editor,override:n.S.get("text").editor,process:i.op,settings:{placeholder:"-"},shouldApply:()=>!0,category:ct},Ie={id:"links",path:"links",name:"Data links",editor:n.S.get("links").editor,override:n.S.get("links").editor,process:i.NN,settings:{placeholder:"-"},shouldApply:()=>!0,category:["Data links"],getItemsCount:Le=>Le?Le.length:0},xe={id:"color",path:"color",name:"Color scheme",editor:n.S.get("fieldColor").editor,override:n.S.get("fieldColor").editor,process:i.kG,shouldApply:()=>!0,settings:{byValueSupport:!0,preferThresholdsMode:!0},category:ct},Te={id:"mappings",path:"mappings",name:"Value mappings",description:"Modify the display text based on input value",editor:n.S.get("mappings").editor,override:n.S.get("mappings").editor,process:i.uj,settings:{},defaultValue:[],shouldApply:Le=>Le.type!==s.fS.time,category:["Value mappings"],getItemsCount:Le=>Le?Le.length:0},Oe={id:"thresholds",path:"thresholds",name:"Thresholds",editor:n.S.get("thresholds").editor,override:n.S.get("thresholds").editor,process:i.ZN,settings:{},defaultValue:{mode:r.H.Absolute,steps:[{value:-1/0,color:"green"},{value:80,color:"red"}]},shouldApply:()=>!0,category:["Thresholds"],getItemsCount:Le=>Le?Le.steps.length:0},ie={id:"filterable",path:"filterable",name:"Ad-hoc filterable",hideFromDefaults:!0,editor:n.S.get("boolean").editor,override:n.S.get("boolean").editor,process:i.W4,shouldApply:()=>!0,settings:{},category:ct};return[me,Ee,Ce,Ae,it,xe,ze,Ie,Te,Oe,ie]}},79451:(j,I,e)=>{"use strict";e.d(I,{p:()=>l});var t=e(42844),n=e(76808),i=e(30450),s=e(27702),r=e(66310),g=e(72719),d=e(55093);const l=({value:m,onChange:c,item:p})=>{const f=(0,s.useRef)(null),{settings:E}=p,h=E?.min||0,y=E?.max||100,v=E?.step,D=E?.marks||{[h]:h,[y]:y},a=E?.included,C=E?.ariaLabelForHandle,P=75,b=!0,M=(0,r.l4)(),[T,S]=(0,s.useState)(m??h),[x,O]=(0,s.useState)(P);(0,s.useEffect)(()=>{m!=null&&m!==T&&S(m)},[m,T]),(0,s.useEffect)(()=>{const N=getComputedStyle(f.current),F=N.getPropertyValue("font-weight")||"normal",k=N.getPropertyValue("font-size")||"16px",H=N.getPropertyValue("font-family")||"Arial",R="0",_=4,G=8,Y=Math.max((y+(v||0)).toString().length,(y-(v||0)).toString().length)+_,X=R.repeat(Y),Q=u(X,`${F} ${k} ${H}`);Q&&O(Q+G*2)},[y,v]);const B=(0,s.useCallback)(N=>{const F=typeof N=="number"?N:N[0];S(F),c&&c(F)},[S,c]),A=(0,s.useCallback)(N=>{let F=N;(Number.isNaN(F)||!F)&&(F=0),S(F),c&&c(F)},[c]),V=(0,g.W)(M,b,!!D),W=o(M,x),w=b?[]:[V.sliderInputVertical];return s.createElement("div",{className:(0,t.cx)(V.container,V.slider)},s.createElement(n.Global,{styles:V.slider}),s.createElement("label",{className:(0,t.cx)(V.sliderInput,...w)},s.createElement(i.Z,{min:h,max:y,step:v,defaultValue:m,value:T,onChange:B,vertical:!b,reverse:!1,ariaLabelForHandle:C,marks:D,included:a}),s.createElement("span",{className:W.numberInputWrapper,ref:f},s.createElement(d.Y,{value:T,onChange:A,max:y,min:h,step:v}))))};function u(m,c){const f=document.createElement("canvas").getContext("2d");return f?(f.font=c,f.measureText(m).width):null}const o=(m,c)=>({numberInputWrapper:(0,t.css)` margin-left: ${m.spacing(3)}; max-height: 32px; max-width: ${c}px; min-width: ${c}px; overflow: visible; width: 100%; `})},85819:(j,I,e)=>{"use strict";e.d(I,{A:()=>s});var t=e(27702),n=e(60105),i=e(1128);const s=({value:r,onChange:g,item:d,suffix:l})=>{const u=d.settings?.useTextarea?n.K:i.I,o=(0,t.useCallback)(m=>{let c=r??"";"key"in m?m.key==="Enter"&&!d.settings?.useTextarea&&(c=m.currentTarget.value.trim()):c=m.currentTarget.value.trim(),c!==r&&g(c===""?void 0:c)},[r,d.settings?.useTextarea,g]);return t.createElement(u,{placeholder:d.settings?.placeholder,defaultValue:r||"",rows:d.settings?.useTextarea&&d.settings.rows||5,onBlur:o,onKeyDown:o,suffix:l})}},44644:(j,I,e)=>{"use strict";e.d(I,{T:()=>A});var t=e(42844),n=e(27702),i=e(38192),s=e(66310),r=e(29372),g=e(26473),d=e(95685);const l=({isLoading:W,children:w,className:N})=>{let F=N?n.createElement("div",{className:N},w):w;return n.createElement(n.Fragment,null,W?n.createElement(d.Z,null):F)};var u=e(87831),o=e(73289),m=e(67437),c=e(22209),p=e(1128),f=e(21323);const E=({value:W,onEdit:w})=>{const N=(0,s.wW)(h),[F,k]=(0,n.useState)(W),[H,R]=(0,n.useState)(!1),[_,G]=(0,n.useState)(!1),[Y,X]=(0,n.useState)();(0,n.useEffect)(()=>{k(W)},[W]);const Q=(0,n.useCallback)(async se=>{const Z=se.currentTarget.value;if(!Z)X("Please enter a title");else if(Z===W)X(void 0),R(!1);else{G(!0);try{await w(Z),X(void 0),R(!1)}catch(le){(0,o.kW)(le)?X(le.data.message):le instanceof Error&&X(le.message)}G(!1)}},[w,W]);return H?n.createElement("div",{className:N.inputContainer},n.createElement(c.g,{className:N.field,loading:_,invalid:!!Y,error:Y},n.createElement(p.I,{className:N.input,defaultValue:F,onKeyDown:se=>{se.key==="Enter"&&Q(se)},autoFocus:!0,onBlur:Q,onChange:se=>k(se.currentTarget.value),onFocus:()=>R(!0)}))):n.createElement("div",{className:N.textContainer},n.createElement("div",{className:N.textWrapper},n.createElement(f.x,{element:"h1",truncate:!0},F),n.createElement(m.h,{name:"pen",size:"lg",tooltip:"Edit title",onClick:()=>R(!0)})))};E.displayName="EditableTitle";const h=W=>({textContainer:(0,t.css)({minWidth:0}),field:(0,t.css)({flex:1,left:`calc(-${W.spacing(1)} - 1px)`,position:"relative",marginBottom:0}),input:(0,t.css)({input:{...W.typography.h1}}),inputContainer:(0,t.css)({display:"flex",flex:1}),textWrapper:(0,t.css)({alignItems:"center",display:"flex",gap:W.spacing(1)})});function y({navItem:W,renderTitle:w,actions:N,info:F,subTitle:k,onEditTitle:H}){const R=(0,s.wW)(v),_=k??W.subTitle,G=H?n.createElement(E,{value:W.text,onEdit:H}):n.createElement("div",{className:R.title},W.img&&n.createElement("img",{className:R.img,src:W.img,alt:`logo for ${W.text}`}),w?w(W.text):n.createElement("h1",null,W.text));return n.createElement("div",{className:R.pageHeader},n.createElement("div",{className:R.topRow},n.createElement("div",{className:R.titleInfoContainer},G,F&&n.createElement(u.S,{info:F})),n.createElement("div",{className:R.actions},N)),_&&n.createElement("div",{className:R.subTitle},_))}const v=W=>({topRow:(0,t.css)({alignItems:"flex-start",display:"flex",flexDirection:"row",flexWrap:"wrap",gap:W.spacing(1,3)}),title:(0,t.css)({display:"flex",flexDirection:"row",h1:{display:"flex",marginBottom:0}}),actions:(0,t.css)({display:"flex",flexDirection:"row",gap:W.spacing(1)}),titleInfoContainer:(0,t.css)({display:"flex",label:"title-info-container",flex:1,flexWrap:"wrap",gap:W.spacing(1,4),justifyContent:"space-between",maxWidth:"100%",minWidth:"200px"}),pageHeader:(0,t.css)({label:"page-header",display:"flex",flexDirection:"column",gap:W.spacing(1),marginBottom:W.spacing(2)}),subTitle:(0,t.css)({position:"relative",color:W.colors.text.secondary}),img:(0,t.css)({width:"32px",height:"32px",marginRight:W.spacing(2)})});var D=e(15372),a=e(65469),C=e(54281);function P({navItem:W}){const w=(0,s.wW)(b);return n.createElement("div",{className:w.tabsWrapper},n.createElement(D.J,null,W.children.map((N,F)=>{const k=N.icon?(0,a.toIconName)(N.icon):void 0;return!N.hideFromTabs&&n.createElement(C.O,{label:N.text,active:N.active,key:`${N.url}-${F}`,icon:k,href:N.url,suffix:N.tabSuffix})})))}const b=W=>({tabsWrapper:(0,t.css)({paddingBottom:W.spacing(3)})});var M=e(56868),T=e(34139),S=e(18771),x=e(76404),O=e(57821);function B(W,w){const N=(0,S.useSelector)(F=>F.navIndex)?.[T.Qz];(0,n.useEffect)(()=>{const F=(W?.node!==W?.main?W?.node:W?.main)??{text:"Grafana"},k=(0,O.t)(F,w,N).map(H=>H.text).reverse();k[k.length-1]=x.c.AppTitle,document.title=k.join(" - ")},[N,W,w])}const A=({navId:W,navModel:w,pageNav:N,renderTitle:F,onEditTitle:k,actions:H,subTitle:R,children:_,className:G,info:Y,layout:X=i.Q.Standard,scrollTop:Q,scrollRef:se,...Z})=>{const le=(0,s.wW)(V),oe=(0,M.P)(W,w),{chrome:q}=(0,g.p)();B(oe,N);const ne=N??oe?.node;return(0,n.useLayoutEffect)(()=>{oe&&q.update({sectionNav:oe,pageNav:N,layout:X})},[oe,N,q,X]),n.createElement("div",{className:(0,t.cx)(le.wrapper,G),...Z},X===i.Q.Standard&&n.createElement(r.$,{autoHeightMin:"100%",scrollTop:Q,scrollRefCallback:se},n.createElement("div",{className:le.pageInner},ne&&n.createElement(y,{actions:H,onEditTitle:k,navItem:ne,renderTitle:F,info:Y,subTitle:R}),N&&N.children&&n.createElement(P,{navItem:N}),n.createElement("div",{className:le.pageContent},_))),X===i.Q.Canvas&&n.createElement(r.$,{autoHeightMin:"100%",scrollTop:Q,scrollRefCallback:se},n.createElement("div",{className:le.canvasContent},_)),X===i.Q.Custom&&_)};A.Contents=l;const V=W=>({wrapper:(0,t.css)({label:"page-wrapper",height:"100%",display:"flex",flex:"1 1 0",flexDirection:"column",minHeight:0}),pageContent:(0,t.css)({label:"page-content",flexGrow:1}),pageInner:(0,t.css)({label:"page-inner",padding:W.spacing(2),borderRadius:W.shape.borderRadius(1),border:`1px solid ${W.colors.border.weak}`,borderBottom:"none",background:W.colors.background.primary,display:"flex",flexDirection:"column",flexGrow:1,margin:W.spacing(0,0,0,0),[W.breakpoints.up("md")]:{margin:W.spacing(2,2,0,1),padding:W.spacing(3)}}),canvasContent:(0,t.css)({label:"canvas-content",display:"flex",flexDirection:"column",padding:W.spacing(2),flexBasis:"100%",flexGrow:1})})},56868:(j,I,e)=>{"use strict";e.d(I,{P:()=>r});var t=e(75892),n=e(86809),i=e(84749),s=e(18771);function r(d,l){if(l)return l;if(d&&i.h)return(0,s.useSelector)((0,t.P1)(g,u=>(0,n.ht)(u,d??"home")))}function g(d){return d.navIndex}},87831:(j,I,e)=>{"use strict";e.d(I,{S:()=>s});var t=e(42844),n=e(27702),i=e(66310);function s({info:g}){const d=(0,i.wW)(r);return n.createElement("div",{className:d.container},g.map((l,u)=>n.createElement(n.Fragment,{key:u},n.createElement("div",{className:d.infoItem},n.createElement("div",{className:d.label},l.label),l.value),u+1<g.length&&n.createElement("div",{"data-testid":"page-info-separator",className:d.separator}))))}const r=g=>({container:(0,t.css)({display:"flex",flexDirection:"row",gap:g.spacing(1.5),overflow:"auto"}),infoItem:(0,t.css)({...g.typography.bodySmall,display:"flex",flexDirection:"column",gap:g.spacing(.5)}),label:(0,t.css)({color:g.colors.text.secondary}),separator:(0,t.css)({borderLeft:`1px solid ${g.colors.border.weak}`})})},95685:(j,I,e)=>{"use strict";e.d(I,{Z:()=>s});var t=e(27702),n=e(52419);const s=({pageName:r=""})=>{const g=`Loading ${r}...`;return t.createElement("div",{className:"page-loader-wrapper"},t.createElement(n.u,{text:g}))}},73149:(j,I,e)=>{"use strict";e.d(I,{j:()=>s});var t=e(42844),n=e(27702),i=e(66310);function s({entity:g="Page"}){const d=(0,i.wW)(r),l=(0,i.l4)();return n.createElement("div",{className:d.container},n.createElement("h1",null,g," not found"),n.createElement("div",{className:d.subtitle},"We're looking but can't seem to find this ",g.toLowerCase(),". Try returning"," ",n.createElement("a",{href:"/",className:"external-link"},"home")," ","or seeking help on the"," ",n.createElement("a",{href:"https://community.grafana.com",target:"_blank",rel:"noreferrer",className:"external-link"},"community site.")),n.createElement("div",{className:d.grot},n.createElement("img",{src:`public/img/grot-404-${l.isDark?"dark":"light"}.svg`,width:"100%",alt:"grot"})))}function r(g){return{container:(0,t.css)({display:"flex",flexDirection:"column",padding:g.spacing(8,2,2,2),h1:{textAlign:"center"}}),subtitle:(0,t.css)({color:g.colors.text.secondary,fontSize:g.typography.h5.fontSize,padding:g.spacing(2,0),textAlign:"center"}),grot:(0,t.css)({maxWidth:"450px",paddingTop:g.spacing(8),margin:"0 auto"})}}},77597:(j,I,e)=>{"use strict";e.d(I,{Z:()=>r});var t=e(27702),n=e(74639),i=e(1128),s=e(67437);const r=t.forwardRef(({autoComplete:g,autoFocus:d,id:l,passwordHint:u,...o},m)=>{const[c,p]=(0,t.useState)(!1);return t.createElement(i.I,{id:l,autoFocus:d,autoComplete:g,...o,type:c?"text":"password",placeholder:u,"aria-label":n.wl.pages.Login.password,ref:m,suffix:t.createElement(s.h,{name:c?"eye-slash":"eye","aria-controls":l,role:"switch","aria-checked":c,onClick:()=>{p(!c)},tooltip:c?"Hide password":"Show password"})})});r.displayName="PasswordField"},71313:(j,I,e)=>{"use strict";e.d(I,{Z:()=>E});var t=e(42844),n=e(27702),i=e(23839),s=e(64022),r=e(28580),g=e(66670),d=e(80402),l=e(23159),u=e(79173),o=e(12308),m=e(43533),c=e(35952);class p extends n.Component{constructor(y){super(y),this.onTypeChanged=v=>{const D=v.value;switch(D){case m.pC.User:case m.pC.Team:this.setState({type:D,userId:0,teamId:0,role:void 0});break;case m.pC.Editor:this.setState({type:D,userId:0,teamId:0,role:m.B5.Editor});break;case m.pC.Viewer:this.setState({type:D,userId:0,teamId:0,role:m.B5.Viewer});break}},this.onUserSelected=v=>{this.setState({userId:v&&!Array.isArray(v)?v.id:0})},this.onTeamSelected=v=>{this.setState({teamId:v.value?.id&&!Array.isArray(v.value)?v.value.id:0})},this.onPermissionChanged=v=>{this.setState({permission:v.value})},this.onSubmit=async()=>{await this.props.onAddPermission(this.state),this.setState(this.getCleanState())},this.state=this.getCleanState()}getCleanState(){return{userId:0,teamId:0,role:void 0,type:m.pC.Team,permission:m.V5.View}}isValid(){switch(this.state.type){case m.pC.Team:return this.state.teamId>0;case m.pC.User:return this.state.userId>0}return!0}render(){const{onCancel:y}=this.props,v=this.state,D="min-width-20",a=this.isValid(),C=f(o.default.theme2);return n.createElement("div",{className:"cta-form"},n.createElement(c.P,{onClick:y}),n.createElement("h5",null,"Add Permission For"),n.createElement(i.l,{maxWidth:"none",onSubmit:this.onSubmit},()=>n.createElement(s.Lh,null,n.createElement(r.Ph,{"aria-label":"Role to add new permission to",isSearchable:!1,value:this.state.type,options:m.BL,onChange:this.onTypeChanged}),v.type===m.pC.User?n.createElement(u.f,{onSelected:this.onUserSelected,className:D}):null,v.type===m.pC.Team?n.createElement(l.c,{onSelected:this.onTeamSelected,className:D}):null,n.createElement("span",{className:C.label},"Can"),n.createElement(r.Ph,{"aria-label":"Permission level",isSearchable:!1,value:this.state.permission,options:m.vT,onChange:this.onPermissionChanged,width:25}),n.createElement(g.zx,{"data-save-permission":!0,type:"submit",disabled:!a},"Save"))))}}p.defaultProps={showPermissionLevels:!0};const f=(0,d.B)(h=>({label:(0,t.css)` color: ${h.colors.primary.text}; font-weight: bold; `})),E=p},50683:(j,I,e)=>{"use strict";e.d(I,{Z:()=>c});var t=e(27702),n=e(73453),i=e(28580),s=e(66670),r=e(43533);class g extends t.Component{render(){const{item:f}=this.props,E=r.vT.find(h=>h.value===f.permission);return t.createElement("tr",{className:"gf-form-disabled"},t.createElement("td",{style:{width:"1%"}},t.createElement(n.J,{size:"lg",name:"shield"})),t.createElement("td",{style:{width:"90%"}},f.name,t.createElement("span",{className:"filter-table__weak-italic"}," (Role)")),t.createElement("td",null),t.createElement("td",{className:"query-keyword"},"Can"),t.createElement("td",null,t.createElement("div",{className:"gf-form"},t.createElement(i.Ph,{"aria-label":`Permission level for "${f.name}"`,options:r.vT,onChange:()=>{},disabled:!0,value:E}))),t.createElement("td",null,t.createElement(s.zx,{"aria-label":`Remove permission for "${f.name}"`,size:"sm",icon:"lock",disabled:!0})))}}const d=p=>p?"gf-form-disabled":"";function l({item:p}){return p.userAvatarUrl?t.createElement("img",{className:"filter-table__avatar",src:p.userAvatarUrl,alt:"User avatar"}):p.teamAvatarUrl?t.createElement("img",{className:"filter-table__avatar",src:p.teamAvatarUrl,alt:"Team avatar"}):p.role==="Editor"?t.createElement(n.J,{size:"lg",name:"edit"}):t.createElement(n.J,{size:"lg",name:"eye"})}function u({item:p}){return p.userId?t.createElement("span",{className:"filter-table__weak-italic"},"(User)"):p.teamId?t.createElement("span",{className:"filter-table__weak-italic"},"(Team)"):t.createElement("span",{className:"filter-table__weak-italic"},"(Role)")}class o extends t.PureComponent{constructor(){super(...arguments),this.onPermissionChanged=f=>{this.props.onPermissionChanged(this.props.item,f.value)},this.onRemoveItem=()=>{this.props.onRemoveItem(this.props.item)}}render(){const{item:f,folderInfo:E}=this.props,h=f.dashboardId===-1&&!f.inherited,y=r.vT.find(v=>v.value===f.permission);return t.createElement("tr",{className:d(!!f?.inherited)},t.createElement("td",{style:{width:"1%"}},t.createElement(l,{item:f})),t.createElement("td",{style:{width:"90%"}},f.name," ",t.createElement(u,{item:f})),t.createElement("td",null,f.inherited&&E&&t.createElement("em",{className:"muted no-wrap"},"Inherited from folder"," ",E.canViewFolderPermissions?t.createElement("a",{className:"text-link",href:`${E.url}/permissions`},E.title):E.title),h&&t.createElement("em",{className:"muted no-wrap"},"Default Permission")),t.createElement("td",{className:"query-keyword"},"Can"),t.createElement("td",null,t.createElement(i.Ph,{"aria-label":`Permission level for "${f.name}"`,isSearchable:!1,options:r.vT,onChange:this.onPermissionChanged,disabled:f.inherited,value:y,width:25})),t.createElement("td",null,f.inherited?t.createElement(s.zx,{"aria-label":`Remove permission for "${f.name}" (Disabled)`,size:"sm",disabled:!0,icon:"times"}):t.createElement(s.zx,{"aria-label":`Remove permission for "${f.name}"`,size:"sm",variant:"destructive",icon:"times",onClick:this.onRemoveItem})))}}class m extends t.PureComponent{render(){const{items:f,onRemoveItem:E,onPermissionChanged:h,isFetching:y,folderInfo:v}=this.props;return t.createElement("table",{className:"filter-table gf-form-group"},t.createElement("tbody",null,t.createElement(g,{key:0,item:{name:"Admin",permission:4}}),f.map((D,a)=>t.createElement(o,{key:a+1,item:D,onRemoveItem:E,onPermissionChanged:h,folderInfo:v})),y===!0&&f.length<1?t.createElement("tr",null,t.createElement("td",{colSpan:4},t.createElement("em",null,"Loading permissions..."))):null,y===!1&&f.length<1?t.createElement("tr",null,t.createElement("td",{colSpan:4},t.createElement("em",null,"No permissions are set. Will only be accessible by admins."))):null))}}const c=m},22698:(j,I,e)=>{"use strict";e.d(I,{Z:()=>i});var t=e(27702);const i=()=>t.createElement("div",null,t.createElement("h5",null,"What are Permissions?"),t.createElement("p",null,"An Access Control List (ACL) model is used to limit access to Dashboard Folders. A user or a Team can be assigned permissions for a folder or for a single dashboard."))},43567:(j,I,e)=>{"use strict";e.d(I,{h:()=>r});var t=e(42844),n=e(27702),i=e(18112),s=e(66310);const r=n.memo(n.forwardRef(({className:l,children:u,markdown:o,onRemove:m,...c},p)=>{const f=(0,s.wW)(d);return n.createElement("div",{className:(0,t.cx)(f.wrapper,l),...c,ref:p},o&&g(o),u)}));function g(l){const u=(0,i.a)(l);return n.createElement("div",{className:"markdown-html",dangerouslySetInnerHTML:{__html:u}})}r.displayName="OperationRowHelp";const d=l=>{const u=l.shape.borderRadius();return{wrapper:(0,t.css)` padding: ${l.spacing(2)}; border: 2px solid ${l.colors.background.secondary}; border-top: none; border-radius: 0 0 ${u} ${u}; position: relative; top: -4px; `}}},984:(j,I,e)=>{"use strict";e.d(I,{V:()=>l,y:()=>d});var t=e(42844),n=e(27702),i=e(74639),s=e(66310),r=e(67437);function g(o){const m=(0,s.wW)(u);return n.createElement("div",{className:(0,t.cx)(m.icon,"active"in o&&o.active&&m.active)},n.createElement(r.h,{name:o.icon,tooltip:o.title,className:m.icon,disabled:!!o.disabled,onClick:o.onClick,type:"button","aria-label":i.wl.components.QueryEditorRow.actionButton(o.title),..."active"in o&&{"aria-pressed":o.active}}))}function d(o){return n.createElement(g,{...o})}const l=o=>n.createElement(g,{...o}),u=o=>({icon:(0,t.css)` display: flex; position: relative; color: ${o.colors.text.secondary}; `,active:(0,t.css)` &::before { display: block; content: ' '; position: absolute; left: -1px; right: 2px; height: 3px; border-radius: ${o.shape.radius.default}; bottom: -8px; background-image: ${o.colors.gradients.brandHorizontal} !important; } `})},10186:(j,I,e)=>{"use strict";e.d(I,{t:()=>c});var t=e(42844),n=e(27702),i=e(85532),s=e(96073),r=e(86312),g=e(66310),d=e(66258),l=e(67437),u=e(73453);const o=({actionsElement:f,disabled:E,draggable:h,collapsable:y=!0,dragHandleProps:v,headerElement:D,isContentVisible:a,onRowToggle:C,reportDragMousePosition:P,title:b,id:M})=>{const T=(0,g.wW)(m);return n.createElement("div",{className:T.header},n.createElement("div",{className:T.column},y&&n.createElement(l.h,{name:a?"angle-down":"angle-right",tooltip:a?"Collapse query row":"Expand query row",className:T.collapseIcon,onClick:C,"aria-expanded":a,"aria-controls":M}),b&&n.createElement("div",{className:T.titleWrapper,onClick:C,"aria-label":"Query operation row title"},n.createElement("div",{className:(0,t.cx)(T.title,E&&T.disabled)},b)),D),n.createElement("div",{className:T.column},f,h&&n.createElement(u.J,{title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:T.dragIcon,onMouseMove:P,...v})))},m=f=>({header:(0,t.css)` label: Header; padding: ${f.spacing(.5,.5)}; border-radius: ${f.shape.borderRadius(1)}; background: ${f.colors.background.secondary}; min-height: ${f.spacing(4)}; display: grid; grid-template-columns: minmax(100px, max-content) min-content; align-items: center; justify-content: space-between; white-space: nowrap; &:focus { outline: none; } `,column:(0,t.css)` label: Column; display: flex; align-items: center; `,dragIcon:(0,t.css)` cursor: grab; color: ${f.colors.text.disabled}; margin: ${f.spacing(0,.5)}; &:hover { color: ${f.colors.text}; } `,collapseIcon:(0,t.css)` margin-left: ${f.spacing(.5)}; color: ${f.colors.text.disabled}; } `,titleWrapper:(0,t.css)` display: flex; align-items: center; flex-grow: 1; cursor: pointer; overflow: hidden; margin-right: ${f.spacing(.5)}; `,title:(0,t.css)` font-weight: ${f.typography.fontWeightBold}; color: ${f.colors.text.link}; margin-left: ${f.spacing(.5)}; overflow: hidden; text-overflow: ellipsis; `,disabled:(0,t.css)` color: ${f.colors.text.disabled}; `});o.displayName="QueryOperationRowHeader";function c({children:f,actions:E,title:h,headerElement:y,onClose:v,onOpen:D,isOpen:a,disabled:C,draggable:P,collapsable:b,index:M,id:T}){const[S,x]=(0,n.useState)(a!==void 0?a:!0),O=(0,g.wW)(p),B=(0,n.useCallback)(()=>{x(!S)},[S,x]),A=(0,n.useCallback)(N=>{if(N.defaultPrevented){const F=N.currentTarget.getBoundingClientRect(),k=N.clientX-F.left,H=N.clientY-F.top;(0,r.ff)("query_row_reorder_drag_position",{x:k/F.width,y:H/F.height,width:F.width,height:F.height})}},[]);(0,s.Z)(()=>{S?D&&D():v&&v()},[S]);const V={isOpen:S,onOpen:()=>{x(!0)},onClose:()=>{x(!1)}},W=E&&d.renderOrCallToRender(E,V),w=y&&d.renderOrCallToRender(y,V);return P?n.createElement(i._l,{draggableId:T,index:M},N=>n.createElement(n.Fragment,null,n.createElement("div",{ref:N.innerRef,className:O.wrapper,...N.draggableProps},n.createElement("div",null,n.createElement(o,{id:T,actionsElement:W,disabled:C,draggable:!0,collapsable:b,dragHandleProps:N.dragHandleProps,headerElement:w,isContentVisible:S,onRowToggle:B,reportDragMousePosition:A,title:h})),S&&n.createElement("div",{className:O.content},f)))):n.createElement("div",{className:O.wrapper},n.createElement(o,{id:T,actionsElement:W,disabled:C,draggable:!1,collapsable:b,headerElement:w,isContentVisible:S,onRowToggle:B,reportDragMousePosition:A,title:h}),S&&n.createElement("div",{className:O.content},f))}const p=f=>({wrapper:(0,t.css)` margin-bottom: ${f.spacing(2)}; `,content:(0,t.css)` margin-top: ${f.spacing(.5)}; margin-left: ${f.spacing(3)}; `});c.displayName="QueryOperationRow"},3718:(j,I,e)=>{"use strict";e.d(I,{I:()=>ge});var t=e(27702),n=e(64022),i=e(62108),s=e(8430),r=e(42844),g=e(66310),d=e(73453),l=e(80011),u=e(1128),o=e(26468),m=e(97289),c=e(73578);const p=(0,t.forwardRef)(({children:ae,iconName:re},De)=>{const he=(0,g.wW)(f);return t.createElement("div",{className:he.container,ref:De},re&&t.createElement(d.J,{name:re,size:"xs"}),ae)});p.displayName="ValueContainer";const f=ae=>{const{prefix:re}=(0,u.H)({theme:ae}),{multiValueContainer:De}=(0,c.D)(ae);return{container:(0,r.cx)(re,De,(0,r.css)` position: relative; padding: ${ae.spacing(.5,1,.5,1)}; svg { margin-right: ${ae.spacing(.5)}; } `)}},E=300,h=360,y=260,v=ae=>ae.stopPropagation(),D=({appliedRoles:ae,basicRole:re,disabled:De,isFocused:he,query:ye,showBasicRole:ce,onOpen:We,onClose:ke,onQueryChange:et,...we})=>{const _e=(0,g.wW)(Me=>C(Me,!1,!!he,!!De,!1)),Ge=(0,t.useRef)(null);(0,t.useEffect)(()=>{he&&Ge.current?.focus()});const qe=Me=>{const be=Me.target?.value;et(be)},st=ae.length;return he?t.createElement("div",{className:_e.wrapper},ce&&t.createElement(p,null,re),ae.map(Me=>t.createElement(p,{key:Me.uid},Me.displayName||Me.name)),!De&&t.createElement("input",{...we,className:_e.input,ref:Ge,onMouseDown:v,onChange:qe,"data-testid":"role-picker-input",placeholder:he?"Select role":"",value:ye}),t.createElement("div",{className:_e.suffix},t.createElement(d.J,{name:"angle-up",className:_e.dropdownIndicator,onMouseDown:ke}))):t.createElement("div",{className:(0,r.cx)(_e.wrapper,_e.selectedRoles),onMouseDown:We},ce&&t.createElement(p,null,re),t.createElement(a,{appliedRoles:ae,numberOfRoles:st,showBuiltInRole:ce}))};D.displayName="RolePickerInput";const a=({showBuiltInRole:ae,numberOfRoles:re,appliedRoles:De})=>{const he=(0,g.wW)(ye=>P(ye));return t.createElement(t.Fragment,null,re?t.createElement(l.u,{content:t.createElement("div",{className:he.tooltip},De?.map(ye=>t.createElement("p",{key:ye.uid},ye.displayName)))},t.createElement(p,null,`${ae?"+":""}${re} role${re>1?"s":""}`)):!ae&&t.createElement(p,null,"No roles assigned"))},C=(ae,re,De,he,ye)=>{const ce=(0,u.H)({theme:ae,invalid:re});return{wrapper:(0,r.cx)(ce.wrapper,(0,o.RK)(ae,re),De&&(0,r.css)` ${m.focusCss(ae.v1)} `,he&&ce.inputDisabled,(0,r.css)` min-width: ${h}px; min-height: 32px; height: auto; flex-direction: row; padding-right: 24px; max-width: 100%; align-items: center; display: flex; flex-wrap: wrap; justify-content: flex-start; position: relative; box-sizing: border-box; cursor: default; `,ye&&(0,r.css)` padding-left: 0; `),input:(0,r.cx)((0,o.RK)(ae,re),(0,r.css)` max-width: 120px; border: none; cursor: ${De?"default":"pointer"}; `),suffix:ce.suffix,dropdownIndicator:(0,r.css)` cursor: pointer; `,selectedRoles:(0,r.css)` display: flex; align-items: center; cursor: ${he?"not-allowed":"pointer"}; `,tooltip:(0,r.css)` p { margin-bottom: ${ae.spacing(.5)}; } `}},P=ae=>({tooltip:(0,r.css)` p { margin-bottom: ${ae.spacing(.5)}; } `});var b=e(29372),M=e(66670),T=e(40705),S=e(18771);const x=ae=>({menuWrapper:(0,r.css)` display: flex; max-height: 650px; position: absolute; z-index: ${ae.zIndex.dropdown}; overflow: hidden; min-width: auto; `,menu:(0,r.css)` min-width: ${y}px; & > div { padding-top: ${ae.spacing(1)}; } `,menuLeft:(0,r.css)` right: 0; flex-direction: row-reverse; `,subMenu:(0,r.css)` height: 100%; min-width: ${y}px; display: flex; flex-direction: column; border-left: 1px solid ${ae.components.input.borderColor}; & > div { padding-top: ${ae.spacing(1)}; } `,subMenuLeft:(0,r.css)` border-right: 1px solid ${ae.components.input.borderColor}; border-left: unset; `,groupHeader:(0,r.css)` padding: ${ae.spacing(0,4.5)}; display: flex; align-items: center; color: ${ae.colors.text.primary}; font-weight: ${ae.typography.fontWeightBold}; `,container:(0,r.css)` padding: ${ae.spacing(1)}; border: 1px ${ae.colors.border.weak} solid; border-radius: ${ae.shape.borderRadius(1)}; background-color: ${ae.colors.background.primary}; z-index: ${ae.zIndex.modal}; `,menuSection:(0,r.css)` margin-bottom: ${ae.spacing(2)}; `,menuOptionCheckbox:(0,r.css)` display: flex; margin: ${ae.spacing(0,1,0,.25)}; `,menuButtonRow:(0,r.css)` background-color: ${ae.colors.background.primary}; padding: ${ae.spacing(1)}; `,menuOptionBody:(0,r.css)` font-weight: ${ae.typography.fontWeightRegular}; padding: ${ae.spacing(0,1.5,0,0)}; `,menuOptionDisabled:(0,r.css)` color: ${ae.colors.text.disabled}; cursor: not-allowed; `,menuOptionExpand:(0,r.css)` position: absolute; right: ${ae.spacing(1.25)}; color: ${ae.colors.text.disabled}; &:after { content: '>'; } `,menuOptionInfoSign:(0,r.css)` color: ${ae.colors.text.disabled}; `,basicRoleSelector:(0,r.css)` margin: ${ae.spacing(1,1.25,1,1)}; `,subMenuPortal:(0,r.css)` height: 100%; > div { height: 100%; } `,subMenuButtonRow:(0,r.css)` background-color: ${ae.colors.background.primary}; padding: ${ae.spacing(1)}; `,checkboxPartiallyChecked:(0,r.css)` input { &:checked + span { &:after { border-width: 0 3px 0px 0; transform: rotate(90deg); } } } `}),B=Object.values(S.OrgRole).filter(ae=>ae!==S.OrgRole.None).map(ae=>({label:ae,value:ae})),A=({value:ae,onChange:re,disabled:De,disabledMesssage:he})=>{const ye=(0,g.wW)(x),ce=(0,g.l4)();return t.createElement(t.Fragment,null,t.createElement("div",{className:ye.groupHeader},t.createElement("span",{style:{marginRight:ce.spacing(1)}},"Basic roles"),De&&he&&t.createElement(l.u,{placement:"right-end",interactive:!0,content:t.createElement("div",null,he)},t.createElement(d.J,{name:"question-circle"}))),t.createElement(T.S,{className:ye.basicRoleSelector,options:B,value:ae,onChange:re,fullWidth:!0,disabled:De}))};var V=e(83967),W=e(52995);const w=(0,t.memo)(t.forwardRef(({name:ae,value:re,isFocused:De,isSelected:he,partiallySelected:ye,disabled:ce,onChange:We,onClick:ke,onOpenSubMenu:et,onCloseSubMenu:we,children:_e,root:Ge},qe)=>{const st=(0,g.l4)(),Me=(0,c.D)(st),be=(0,g.wW)(x),Ke=(0,r.cx)(Me.option,De&&Me.optionFocused,ce&&be.menuOptionDisabled),Ye=xt=>{ce||re&&We(re)},tt=xt=>{ke&&ke(re)},nt=()=>{et&&et(re)},Pt=()=>{we&&we()};return t.createElement("div",{onMouseEnter:nt,onMouseLeave:Pt},t.createElement("div",{ref:qe,className:Ke,"aria-label":"Role picker option",onClick:tt},t.createElement(V.X,{value:he,className:(0,r.cx)(be.menuOptionCheckbox,{[be.checkboxPartiallyChecked]:ye}),onChange:Ye,disabled:ce}),t.createElement("div",{className:(0,r.cx)(Me.optionBody,be.menuOptionBody)},t.createElement("span",null,ae),t.createElement("span",{className:be.menuOptionExpand})),Ge&&_e&&t.createElement(W.h_,{className:be.subMenuPortal,root:Ge},_e)))}));w.displayName="RoleMenuGroupOption";const N=t.forwardRef(({data:ae,isFocused:re,isSelected:De,disabled:he,onChange:ye,hideDescription:ce},We)=>{const ke=(0,g.l4)(),et=(0,c.D)(ke),we=(0,g.wW)(x),_e=(0,r.cx)(et.option,re&&et.optionFocused,he&&we.menuOptionDisabled),Ge=qe=>{he||(qe.preventDefault(),qe.stopPropagation(),ye(ae))};return t.createElement("div",{ref:We,className:_e,"aria-label":"Role picker option",onClick:Ge},t.createElement(V.X,{value:De,className:we.menuOptionCheckbox,onChange:Ge,disabled:he}),t.createElement("div",{className:(0,r.cx)(et.optionBody,we.menuOptionBody)},t.createElement("span",null,ae.displayName||ae.name),!ce&&ae.description&&t.createElement("div",{className:et.optionDescription},ae.description)),ae.description&&t.createElement(l.u,{content:ae.description},t.createElement(d.J,{name:"info-circle",className:we.menuOptionInfoSign})))});N.displayName="RoleMenuOption";var F=e(26115);const k=({options:ae,selectedOptions:re,disabledOptions:De,onSelect:he,onClear:ye,showOnLeft:ce})=>{const We=(0,g.l4)(),ke=(0,c.D)(We),et=(0,g.wW)(x),we=async()=>{ye&&ye()};return t.createElement("div",{className:(0,r.cx)(et.subMenu,{[et.subMenuLeft]:ce}),"aria-label":"Role picker submenu"},t.createElement(b.$,{autoHide:!1,autoHeightMax:`${E}px`,hideHorizontalTrack:!0},t.createElement("div",{className:ke.optionBody},ae.map((_e,Ge)=>t.createElement(N,{data:_e,key:Ge,isSelected:!!(_e.uid&&(re.find(qe=>qe.uid===_e.uid)||De?.find(qe=>qe.uid===_e.uid))),disabled:!!(_e.uid&&De?.find(qe=>qe.uid===_e.uid))||(0,F.r)(_e),onChange:he,hideDescription:!0})))),t.createElement("div",{className:et.subMenuButtonRow},t.createElement(n.Lh,{justify:"flex-end"},t.createElement(M.zx,{size:"sm",fill:"text",onClick:we},"Clear"))))},H=t.forwardRef(({roles:ae,renderedName:re,showGroups:De,optionGroups:he,onGroupChange:ye,groupSelected:ce,groupPartiallySelected:We,subMenuNode:ke,selectedOptions:et,onRoleChange:we,onClearSubMenu:_e,showOnLeftSubMenu:Ge},qe)=>{const[st,Me]=(0,t.useState)(!1),[be,Ke]=(0,t.useState)(""),Ye=(0,g.l4)(),tt=(0,c.D)(Ye),nt=(0,g.wW)(x),Pt=(0,t.useCallback)(bt=>{Ke(bt),Me(!0)},[]),xt=(0,t.useCallback)(()=>{Me(!1),Ke("")},[]);return t.createElement("div",null,ae.length>0&&t.createElement("div",{className:nt.menuSection},t.createElement("div",{className:nt.groupHeader},re),t.createElement("div",{className:tt.optionBody}),De&&he?.length?he.map(bt=>t.createElement(w,{key:bt.value,name:bt.name,value:bt.value,isSelected:ce(bt.value)||We(bt.value),partiallySelected:We(bt.value),disabled:bt.options?.every(F.r),onChange:ye,onOpenSubMenu:Pt,onCloseSubMenu:xt,root:ke,isFocused:st&&be===bt.value},st&&be===bt.value&&t.createElement(k,{options:bt.options,selectedOptions:et,onSelect:we,onClear:()=>_e(be),showOnLeft:Ge}))):ae.map(bt=>t.createElement(N,{data:bt,key:bt.uid,isSelected:!!(bt.uid&&et.find(Rt=>Rt.uid===bt.uid)),disabled:(0,F.r)(bt),onChange:we,hideDescription:!0}))))});H.displayName="RoleMenuGroupsSection";var R=(ae=>(ae.fixed="fixed",ae.custom="custom",ae.plugin="plugin",ae))(R||{});const _={ldap:"LDAP",current:"Current org"},G=({basicRole:ae,options:re,appliedRoles:De,showGroups:he,basicRoleDisabled:ye,disabledMessage:ce,showBasicRole:We,onSelect:ke,onBasicRoleSelect:et,onUpdate:we,updateDisabled:_e,offset:Ge,apply:qe})=>{const[st,Me]=(0,t.useState)(De),[be,Ke]=(0,t.useState)(ae),[Ye,tt]=(0,t.useState)({}),nt=(0,t.useRef)(null),Pt=(0,g.l4)(),xt=(0,c.D)(Pt),bt=(0,g.wW)(x);(0,t.useEffect)(()=>{ke(st)},[st,ke]),(0,t.useEffect)(()=>{et&&be&&et(be)},[be,et]),(0,t.useEffect)(()=>{const xe=re.filter(Y).sort(q),Te=re.filter(X).sort(q),Oe=re.filter(Q).sort(q),ie={fixed:se(Te).sort((Le,Be)=>Le.name.localeCompare(Be.name)),custom:se(xe).sort((Le,Be)=>Le.name.localeCompare(Be.name)),plugin:se(Oe).sort((Le,Be)=>Le.name.localeCompare(Be.name))};tt({fixed:{groupType:"fixed",optionGroup:ie.fixed,renderedName:"Fixed roles",roles:Te},custom:{groupType:"custom",optionGroup:ie.custom,renderedName:"Custom roles",roles:xe},plugin:{groupType:"plugin",optionGroup:ie.plugin,renderedName:"Plugin roles",roles:Oe}})},[re]);const Rt=xe=>{const Te=[];for(const Oe of st)Z(Oe)===xe&&Te.push(Oe);return Te},ct=(xe,Te)=>{const Oe=Rt(Te),ie=Ye[xe]?.optionGroup.find(Le=>Le.value===Te);return Oe.length>0&&Oe.length>=ie.options.length},it=(xe,Te)=>{const Oe=Rt(Te),ie=Ye[xe]?.optionGroup.find(Le=>Le.value===Te);return Oe.length>0&&Oe.length<ie.options.length},me=xe=>{st.find(Te=>Te.uid===xe.uid)?Me(st.filter(Te=>Te.uid!==xe.uid)):Me([...st,xe])},Ee=(xe,Te)=>{const Oe=Ye[xe]?.optionGroup.find(ie=>ie.value===Te);if(Oe)if(ct(xe,Te)||it(xe,Te))Me(st.filter(ie=>!Oe.options.find(Le=>ie.uid===Le.uid)));else{const ie=Oe.options.filter(Be=>Be.delegatable),Le=st.filter(Be=>!Oe.options.find(Ue=>Be.uid===Ue.uid));Me([...Le,...ie])}},Ce=xe=>{Ke(xe)},Ae=async()=>{Me([])},ze=xe=>{const Te=st.filter(Oe=>Z(Oe)!==xe);Me(Te)},Ie=()=>{we(st,be)};return t.createElement("div",{className:(0,r.cx)(xt.menu,bt.menuWrapper,{[bt.menuLeft]:Ge.horizontal>0},(0,r.css)` bottom: ${Ge.vertical>0?`${Ge.vertical}px`:"unset"}; top: ${Ge.vertical<0?`${Math.abs(Ge.vertical)}px`:"unset"}; `)},t.createElement("div",{className:bt.menu,"aria-label":"Role picker menu"},t.createElement(b.$,{autoHide:!1,autoHeightMax:`${E}px`,hideHorizontalTrack:!0,hideVerticalTrack:!0},We&&t.createElement("div",{className:bt.menuSection},t.createElement(A,{value:be,onChange:Ce,disabled:ye,disabledMesssage:ce})),Object.entries(Ye).map(([xe,Te])=>t.createElement(H,{key:xe,roles:Te.roles,renderedName:Te.renderedName,showGroups:he,optionGroups:Te.optionGroup,groupSelected:Oe=>ct(Te.groupType,Oe),groupPartiallySelected:Oe=>it(Te.groupType,Oe),onGroupChange:Oe=>Ee(Te.groupType,Oe),subMenuNode:nt?.current,selectedOptions:st,onRoleChange:me,onClearSubMenu:ze,showOnLeftSubMenu:Ge.horizontal>0}))),t.createElement("div",{className:bt.menuButtonRow},t.createElement(n.Lh,{justify:"flex-end"},t.createElement(M.zx,{size:"sm",fill:"text",onClick:Ae,disabled:_e},"Clear all"),t.createElement(M.zx,{size:"sm",onClick:Ie,disabled:_e},qe?"Apply":"Update")))),t.createElement("div",{ref:nt}))},Y=ae=>!ae.name?.startsWith("fixed:")&&!ae.name.startsWith("plugins:"),X=ae=>ae.name?.startsWith("fixed:"),Q=ae=>ae.name?.startsWith("plugins:"),se=ae=>{const re={};return ae.forEach(he=>{const ye=Z(he),ce=le(he);re[ye]||(re[ye]={name:ce,roles:[]}),re[ye].roles.push(he)}),Object.entries(re).map(([he,ye])=>({name:_[he]||ne(ye.name),value:he,options:ye.roles.sort(q)}))},Z=ae=>{const re=oe(ae),De=le(ae);return`${re}:${De}`},le=ae=>ae.group||"Other",oe=ae=>{const re=ae.name.indexOf(":");return re<0?"unknown":ae.name.substring(0,re)},q=(ae,re)=>ae.name.localeCompare(re.name),ne=ae=>ae.slice(0,1).toUpperCase()+ae.slice(1),ge=({basicRole:ae,appliedRoles:re,roleOptions:De,disabled:he,isLoading:ye,basicRoleDisabled:ce,basicRoleDisabledMessage:We,showBasicRole:ke,onRolesChange:et,onBasicRoleChange:we,canUpdateRoles:_e=!0,apply:Ge=!1,maxWidth:qe=h})=>{const[st,Me]=(0,t.useState)(!1),[be,Ke]=(0,t.useState)(re),[Ye,tt]=(0,t.useState)(ae),[nt,Pt]=(0,t.useState)(""),[xt,bt]=(0,t.useState)({vertical:0,horizontal:0}),Rt=(0,t.useRef)(null);(0,t.useEffect)(()=>{tt(ae),Ke(re)},[re,ae,we]),(0,t.useEffect)(()=>{const xe=Rt?.current?.getBoundingClientRect();if(!xe||!st)return;const{bottom:Te,top:Oe,left:ie,right:Le,width:Be}=xe,Ue=window.innerHeight-Te,ue=Te-Oe+10,pe=Le-ie;let $e=-pe,Se=-ue;Ue<E+20&&(Se=50+(E-Ue)-ue),window.innerWidth-Le<Be&&Be<2*y&&($e=pe),bt({horizontal:$e,vertical:Se})},[st,be]);const ct=(0,t.useCallback)(xe=>{he||(xe.preventDefault(),xe.stopPropagation(),Me(!0))},[Me,he]),it=(0,t.useCallback)(()=>{Me(!1),Pt(""),Ke(re),tt(ae)},[re,ae]),me=()=>st&&it(),Ee=xe=>{Pt(xe||"")},Ce=xe=>{Ke(xe)},Ae=xe=>{tt(xe)},ze=(xe,Te)=>{we&&Te&&Te!==ae&&we(Te),_e&&et(xe),Pt(""),Me(!1)},Ie=()=>{const xe=De.map(Te=>({...Te,delegatable:_e&&Te.delegatable}));return nt&&nt.trim()!==""?xe.filter(Te=>Te.name?.toLowerCase().includes(nt.toLowerCase())):xe};return ye?t.createElement(n.Lh,{justify:"center"},t.createElement("span",null,"Loading..."),t.createElement(i.$,{size:16})):t.createElement("div",{"data-testid":"role-picker",style:{position:"relative",maxWidth:qe},ref:Rt},t.createElement(s.L,{onClick:me},t.createElement(D,{basicRole:Ye,appliedRoles:be,query:nt,onQueryChange:Ee,onOpen:ct,onClose:it,isFocused:st,disabled:he,showBasicRole:ke}),st&&t.createElement(G,{options:Ie(),basicRole:Ye,appliedRoles:re,onBasicRoleSelect:Ae,onSelect:Ce,onUpdate:ze,showGroups:nt.length===0||nt.trim()==="",basicRoleDisabled:ce,disabledMessage:We,showBasicRole:ke,updateDisabled:ce&&!_e,apply:Ge,offset:xt})))}},75574:(j,I,e)=>{"use strict";e.d(I,{R:()=>d});var t=e(27702),n=e(26811),i=e(66574),s=e(18771),r=e(3718),g=e(11349);const d=({basicRole:l,userId:u,orgId:o,onBasicRoleChange:m,roleOptions:c,disabled:p,basicRoleDisabled:f,basicRoleDisabledMessage:E,apply:h=!1,onApplyRoles:y,pendingRoles:v,maxWidth:D})=>{const[{loading:a,value:C=[]},P]=(0,n.Z)(async()=>{try{if(h&&v?.length)return v;if(i.Vt.hasPermission(s.AccessControlAction.ActionUserRolesList))return await(0,g.kt)(u,o)}catch{console.error("Error loading options")}return[]},[o,u,v]);(0,t.useEffect)(()=>{o&&P()},[o,P,v]);const b=async T=>{h?y&&y(T,u,o):(await(0,g.hB)(T,u,o),await P())},M=i.Vt.hasPermission(s.AccessControlAction.ActionUserRolesAdd)&&i.Vt.hasPermission(s.AccessControlAction.ActionUserRolesRemove);return t.createElement(r.I,{appliedRoles:C,basicRole:l,onRolesChange:b,onBasicRoleChange:m,roleOptions:c,isLoading:a,disabled:p,basicRoleDisabled:f,basicRoleDisabledMessage:E,showBasicRole:!0,apply:h,canUpdateRoles:M,maxWidth:D})}},11349:(j,I,e)=>{"use strict";e.d(I,{_C:()=>g,hB:()=>r,kt:()=>s,u7:()=>d,ul:()=>i});var t=e(73289),n=e(26115);const i=async(l,u)=>{let o="/api/access-control/roles?delegatable=true";l&&(o+=`&targetOrgId=${l}`);const m=await(0,t.i)().get(o);return!m||!m.length?[]:m.map(n.w)},s=async(l,u)=>{let o=`/api/access-control/users/${l}/roles`;u&&(o+=`?targetOrgId=${u}`);try{const m=await(0,t.i)().get(o);return!m||!m.length?[]:m.map(n.w)}catch(m){return(0,t.kW)(m)&&(m.isHandled=!0),[]}},r=(l,u,o)=>{let m=`/api/access-control/users/${u}/roles`;o&&(m+=`?targetOrgId=${o}`);const c=l.flatMap(p=>p.uid);return(0,t.i)().put(m,{orgId:o,roleUids:c})},g=async(l,u)=>{let o=`/api/access-control/teams/${l}/roles`;u&&(o+=`?targetOrgId=${u}`);try{const m=await(0,t.i)().get(o);return!m||!m.length?[]:m.map(n.w)}catch(m){return(0,t.kW)(m)&&(m.isHandled=!0),[]}},d=(l,u,o)=>{let m=`/api/access-control/teams/${u}/roles`;o&&(m+=`?targetOrgId=${o}`);const c=l.flatMap(p=>p.uid);return(0,t.i)().put(m,{orgId:o,roleUids:c})}},26115:(j,I,e)=>{"use strict";e.d(I,{r:()=>t,w:()=>n});const t=i=>i.delegatable!==void 0&&!i.delegatable,n=i=>{const s="fixed:";if(!i.displayName&&i.name.startsWith(s)){let r="";r=i.name.replace(s,"").replace(/:/g," "),i.displayName=r}return i}},50292:(j,I,e)=>{"use strict";e.d(I,{V:()=>o});var t=e(27702),n=e(98432),i=e(48154),s=e(66117);const r=2,g=5,d=f=>{const E=f.match(new RegExp('<style type="text/css">([\\s\\S]*?)<\\/style>'));return E?E[0]:null},l=f=>f.match(new RegExp(`<svg.*id\\s*=\\s*(['"])(.*?)\\1`))?.[r],u=f=>{let E=l(f);if(!E){E=`x${(0,s.Z)()}`;const y=f.indexOf("<svg")+g;f=f.substring(0,y)+`id="${E}" `+f.substring(y)}let h=d(f);if(h){let y=h.replace(/(#(.*?))?\./g,`#${E} .`);f=f.replace(h,y)}return f},o=f=>{const{cleanStyle:E,...h}=f;return t.createElement(n.Z,{...h,cacheRequests:!0,preProcessor:E?p:c})};let m=new Map;function c(f){let E=m.get(f);return E||(E=i.QX.sanitizeSVGContent(f),m.set(f,E)),E}function p(f){let E=m.get(f);return E||(E=i.QX.sanitizeSVGContent(f),E.indexOf('<style type="text/css">')>-1&&(E=u(E)),m.set(f,E)),E}},81290:(j,I,e)=>{"use strict";e.d(I,{o:()=>u});var t=e(56027),n=e.n(t),i=e(27702),s=e(28580),r=e(45937);const g=(o="General",m)=>`${o}/${m}`;async function d(o=""){return r.ae.search({type:"dash-db",query:o,limit:100}).then(m=>m.map(c=>({value:{uid:c.uid,title:c.title,folderTitle:c.folderTitle,folderUid:c.folderUid},label:g(c?.folderTitle,c.title)})))}const l=n()(d,250,{leading:!0}),u=({value:o,onChange:m,placeholder:c="Select dashboard",noOptionsMessage:p="No dashboards found",...f})=>{const[E,h]=(0,i.useState)();(0,i.useEffect)(()=>{!o||o===E?.value?.uid||(async()=>{const v=await r.ae.getDashboardByUid(o);v.dashboard&&h({value:{uid:v.dashboard.uid,title:v.dashboard.title,folderTitle:v.meta.folderTitle,folderUid:v.meta.folderUid},label:g(v.meta?.folderTitle,v.dashboard.title)})})()},[o]);const y=(0,i.useCallback)(v=>{h(v),m?.(v?.value)},[m,h]);return i.createElement(s.qb,{loadOptions:l,onChange:y,placeholder:c,noOptionsMessage:p,value:E,defaultOptions:!0,...f})}},74729:(j,I,e)=>{"use strict";e.d(I,{E:()=>Q});var t=e(27702),n=e(34667),i=e(42844),s=e(66609),r=e(25111),g=e(66310),d=e(1128),l=e(73453),u=e(63439),o=e(98557),m=e(65322),c=e(67572),p=e(49079),f=e(1631),E=e(59648),h=e(63064),y=e(6092),v=e(29891),D=e(57704),a=e(25472),C=e(56365),P=e(67437),b=e(94851),M=e(21323),T=e(4571),S=e(18771);const x=40,O="md",B=(Z,le)=>`${Z}-${le||"root"}`;function A({items:Z,focusedItemIndex:le,foldersAreOpenable:oe,idPrefix:q,selectedFolder:ne,onFolderExpand:ge,onFolderSelect:ae,isItemLoaded:re,requestLoadMore:De}){const he=(0,t.useRef)(null),ye=(0,g.wW)(w),ce=(0,t.useMemo)(()=>({items:Z,focusedItemIndex:le,foldersAreOpenable:oe,selectedFolder:ne,onFolderExpand:ge,onFolderSelect:ae,idPrefix:q}),[Z,le,oe,ne,ge,ae,q]),We=(0,t.useCallback)(et=>re(et),[re]),ke=(0,t.useCallback)((et,we)=>{const{parentUID:_e}=Z[et];De(_e)},[De,Z]);return t.createElement("div",{className:ye.table,role:"tree"},Z.length>0?t.createElement(C.Z,{ref:he,itemCount:Z.length,isItemLoaded:We,loadMoreItems:ke},({onItemsRendered:et,ref:we})=>t.createElement(a.t7,{ref:we,height:x*Math.min(6.5,Z.length),width:"100%",itemData:ce,itemSize:x,itemCount:Z.length,onItemsRendered:et},W)):t.createElement("div",{className:ye.emptyMessage},t.createElement(m.cC,{i18nKey:"browse-dashboards.folder-picker.empty-message"},"No folders found")))}const V=[100,200,130,160,150];function W({index:Z,style:le,data:oe}){const{items:q,focusedItemIndex:ne,foldersAreOpenable:ge,selectedFolder:ae,onFolderExpand:re,onFolderSelect:De,idPrefix:he}=oe,{item:ye,isOpen:ce,level:We,parentUID:ke}=q[Z],et=(0,t.useRef)(null),we=(0,t.useId)(),_e=(0,S.useSelector)(f.hO),Ge=(0,S.useSelector)(f.MH),qe=(ye.uid?Ge[ye.uid]:_e)?.items??[];let st=[];ye.uid&&(st=(ke?Ge[ke]:_e)?.items??[]);const Me=(0,g.wW)(w),be=(0,t.useCallback)(Ye=>{Ye.preventDefault(),Ye.stopPropagation(),ye.uid&&re(ye.uid,!ce)},[ye.uid,ce,re]),Ke=(0,t.useCallback)(()=>{ye.kind==="folder"&&De(ye)},[ye,De]);return ye.kind==="ui"&&ye.uiKind==="pagination-placeholder"?t.createElement("span",{style:le,className:Me.row},t.createElement(T.A,{level:We}),t.createElement(D.Z,{width:V[Z%V.length]})):ye.kind!=="folder"?null:t.createElement("div",{ref:et,style:le,className:(0,i.cx)(Me.row,{[Me.rowFocused]:Z===ne,[Me.rowSelected]:ye.uid===ae}),tabIndex:-1,onClick:Ke,"aria-expanded":ce,"aria-selected":ye.uid===ae,"aria-labelledby":we,"aria-level":We+1,role:"treeitem","aria-owns":qe.length>0?qe.map(Ye=>B(he,Ye.uid)).join(" "):void 0,"aria-setsize":qe.length,"aria-posinset":st.findIndex(Ye=>Ye.uid===ye.uid)+1,id:B(he,ye.uid)},t.createElement("div",{className:Me.rowBody},t.createElement(T.A,{level:We}),ge?t.createElement(P.h,{size:O,onMouseDown:be,tabIndex:-1,"aria-label":ce?`Collapse folder ${ye.title}`:`Expand folder ${ye.title}`,name:ce?"angle-down":"angle-right"}):t.createElement("span",{className:Me.folderButtonSpacer}),t.createElement("label",{className:Me.label,id:we},t.createElement(M.x,{truncate:!0},ye.title))))}const w=Z=>{const le=(0,i.css)({height:x,display:"flex",position:"relative",alignItems:"center",flexGrow:1,gap:Z.spacing(.5),overflow:"hidden",padding:Z.spacing(0,1)});return{table:(0,i.css)({background:Z.components.input.background}),emptyMessage:(0,i.css)({padding:Z.spacing(1),textAlign:"center",width:"100%"}),folderButtonSpacer:(0,i.css)({paddingLeft:`calc(${(0,b.B)(O)}px + ${Z.spacing(.5)})`}),row:(0,i.css)({display:"flex",position:"relative",alignItems:"center",[":not(:first-child)"]:{borderTop:`solid 1px ${Z.colors.border.weak}`}}),rowFocused:(0,i.css)({backgroundColor:Z.colors.background.secondary}),rowSelected:(0,i.css)({"&::before":{display:"block",content:'""',position:"absolute",left:0,bottom:0,top:0,width:4,borderRadius:Z.shape.radius.default,backgroundImage:Z.colors.gradients.brandVertical}}),rowBody:le,label:(0,i.css)({lineHeight:x+"px",flexGrow:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","&:hover":{textDecoration:"underline",cursor:"pointer"}})}};var N=e(97289);function F({isLoading:Z,invalid:le,label:oe,...q},ne){const ge=(0,g.l4)(),ae=H(ge,le);return t.createElement("div",{className:ae.wrapper},t.createElement("div",{className:ae.inputWrapper},oe?t.createElement("div",{className:ae.prefix},t.createElement(l.J,{name:"folder"})):void 0,t.createElement("button",{type:"button",className:(0,i.cx)(ae.fakeInput,oe?ae.hasPrefix:void 0),...q,ref:ne},Z?t.createElement(D.Z,{width:100}):oe?t.createElement(M.x,{truncate:!0},oe):t.createElement(M.x,{truncate:!0,color:"secondary"},t.createElement(m.cC,{i18nKey:"browse-dashboards.folder-picker.button-label"},"Select folder"))),t.createElement("div",{className:ae.suffix},t.createElement(l.J,{name:"angle-down"}))))}const k=(0,t.forwardRef)(F),H=(Z,le=!1)=>{const oe=(0,d.H)({theme:Z,invalid:le});return{wrapper:oe.wrapper,inputWrapper:oe.inputWrapper,prefix:(0,i.css)([oe.prefix,{pointerEvents:"none",color:Z.colors.text.primary}]),suffix:(0,i.css)([oe.suffix,{pointerEvents:"none"}]),fakeInput:(0,i.css)([oe.input,{textAlign:"left",letterSpacing:"normal","&:focus":{outline:"unset",boxShadow:"unset"},"&:focus-visible":(0,i.css)` ${(0,N.focusCss)(Z)} `}]),hasPrefix:(0,i.css)({paddingLeft:28})}};function R({tree:Z,handleCloseOverlay:le,handleFolderSelect:oe,handleFolderExpand:q,idPrefix:ne,search:ge,visible:ae}){const[re,De]=(0,t.useState)(-1);(0,t.useEffect)(()=>{ae&&De(-1)},[ae]),(0,t.useEffect)(()=>{De(0)},[ge]),(0,t.useEffect)(()=>{document.getElementById(B(ne,Z[re]?.item.uid))?.scrollIntoView({block:"nearest",inline:"nearest"})},[re,ne,Z]);const he=(0,t.useCallback)(ye=>{const ce=!ge;switch(ye.key){case"ArrowRight":case"ArrowLeft":ce&&(ye.preventDefault(),q(Z[re].item.uid,ye.key==="ArrowRight"));break;case"ArrowUp":re>0&&(ye.preventDefault(),De(re-1));break;case"ArrowDown":re<Z.length-1&&(ye.preventDefault(),De(re+1));break;case"Enter":ye.preventDefault();const We=Z[re].item;We.kind==="folder"&&oe(We);break;case"Tab":ye.stopPropagation(),le();break;case"Escape":ye.stopPropagation(),ye.preventDefault(),le();break}},[re,le,q,oe,ge,Z]);return{focusedItemIndex:re,handleKeyDown:he}}const _=["empty-folder","dashboard"];function G({value:Z,invalid:le,showRootFolder:oe=!0,excludeUIDs:q,onChange:ne}){const ge=(0,g.wW)(Y),ae=(0,v.I0)(),re=(0,c.t4)(Z||c.CN),De=(0,f.zw)(void 0),[he,ye]=(0,t.useState)(""),[ce,We]=(0,t.useState)(!1),[ke,et]=(0,t.useState)(!1),[we,_e]=(0,t.useState)({}),Ge=(0,t.useId)(),[qe]=(0,t.useState)(void 0),st=(0,r.Z)(async()=>{if(!he)return;const Te=await(0,h.getGrafanaSearcher)().search({query:he,kind:["folder"],limit:100}),Oe=Te.view.map(ie=>(0,y.f9)(ie,Te.view));return{...Te,items:Oe}},[he]),Me=(0,v.v9)(f.hO),be=(0,v.v9)(f.MH),{getTooltipProps:Ke,setTooltipRef:Ye,setTriggerRef:tt,visible:nt,triggerRef:Pt}=(0,s.O)({visible:ke,placement:"bottom",interactive:!0,offset:[0,0],trigger:"click",onVisibleChange:xe=>{xe&&(ye(""),We(!0)),et(xe)}}),xt=(0,t.useCallback)(async(xe,Te)=>{_e(Oe=>({...Oe,[xe]:Te})),Te&&!we[xe]&&ae((0,f.si)({parentUID:xe,pageSize:p.IV,excludeKinds:_}))},[ae,we]),bt=(0,t.useCallback)(xe=>{ne&&ne(xe.uid,xe.title),et(!1)},[ne]),Rt=(0,t.useCallback)(()=>et(!1),[et]),ct=(0,f.D$)(_),it=(0,t.useCallback)(xe=>{he||ct(xe)},[he,ct]),me=(0,t.useMemo)(()=>{const xe=he&&st.value;if(xe){const Oe={isFullyLoaded:!0,lastKindHasMoreItems:!1,lastFetchedKind:"folder",lastFetchedPage:1,items:xe.items??[]};return(0,f.qO)(void 0,Oe,be,{},0,_,q)}let Te=(0,f.qO)(void 0,Me,be,we,0,_,q);if(oe){for(const Oe of Te)Oe.level+=1;Te.unshift({isOpen:!0,level:0,item:{kind:"folder",title:"Dashboards",uid:""}})}return Me||(Te=Te.concat((0,E.k)(p.IV,void 0,0))),Te},[he,st.value,Me,be,we,q,oe]),Ee=(0,t.useCallback)(xe=>{const Te=me[xe];if(!Te)return!1;const Oe=Te.item;return!(Oe.kind==="ui"&&Oe.uiKind==="pagination-placeholder")},[me]),Ce=De==="pending"||st.loading,{focusedItemIndex:Ae,handleKeyDown:ze}=R({tree:me,handleCloseOverlay:Rt,handleFolderSelect:bt,handleFolderExpand:xt,idPrefix:Ge,search:he,visible:nt});let Ie=re.data?.title;return Z===""&&(Ie="Dashboards"),nt?t.createElement(t.Fragment,null,t.createElement(d.I,{ref:tt,autoFocus:!0,prefix:Ie?t.createElement(l.J,{name:"folder"}):null,placeholder:Ie??(0,m.t)("browse-dashboards.folder-picker.search-placeholder","Search folders"),value:he,invalid:le,className:ge.search,onKeyDown:ze,onChange:xe=>ye(xe.currentTarget.value),"aria-autocomplete":"list","aria-expanded":!0,"aria-haspopup":!0,"aria-controls":Ge,"aria-owns":Ge,"aria-activedescendant":B(Ge,me[Ae]?.item.uid),role:"combobox",suffix:t.createElement(l.J,{name:"search"})}),t.createElement("fieldset",{ref:Ye,id:Ge,...Ke({className:ge.tableWrapper,style:{width:Pt?.clientWidth}})},qe?t.createElement(u.b,{className:ge.error,severity:"warning",title:(0,m.t)("browse-dashboards.folder-picker.error-title","Error loading folders")},qe.message||qe.toString?.()||(0,m.t)("browse-dashboards.folder-picker.unknown-error","Unknown error")):t.createElement("div",null,Ce&&t.createElement("div",{className:ge.loader},t.createElement(o.F,{width:600})),t.createElement(A,{items:me,selectedFolder:Z,focusedItemIndex:Ae,onFolderExpand:xt,onFolderSelect:bt,idPrefix:Ge,foldersAreOpenable:!(he&&st.value),isItemLoaded:Ee,requestLoadMore:it})))):t.createElement(k,{label:Ie,invalid:le,isLoading:re.isLoading,autoFocus:ce,ref:tt,"aria-label":Ie?(0,m.t)("browse-dashboards.folder-picker.accessible-label","Select folder: {{ label }} currently selected",{label:Ie}):void 0})}const Y=Z=>({button:(0,i.css)({maxWidth:"100%"}),error:(0,i.css)({marginBottom:0}),tableWrapper:(0,i.css)({boxShadow:Z.shadows.z3,position:"relative",zIndex:Z.zIndex.portal}),loader:(0,i.css)({position:"absolute",top:0,left:0,right:0,zIndex:Z.zIndex.portal+1,overflow:"hidden"}),search:(0,i.css)({input:{cursor:"default"}})});var X=e(41482);function Q(Z){const le=n.config.featureToggles.nestedFolders&&n.config.featureToggles.nestedFolderPicker,{initialTitle:oe,dashboardId:q,enableCreateNew:ne,...ge}=Z;return le?t.createElement(G,{...ge}):t.createElement(se,{...Z})}function se({value:Z,showRootFolder:le,onChange:oe,initialTitle:q,dashboardId:ne,enableCreateNew:ge,inputId:ae,skipInitialLoad:re}){const De=(0,t.useCallback)(he=>{oe&&oe(he.uid,he.title)},[oe]);return t.createElement(X.Fz,{onChange:De,showRoot:le,initialFolderUid:Z,initialTitle:q,inputId:ae,skipInitialLoad:re,dashboardId:ne,enableCreateNew:ge})}},41482:(j,I,e)=>{"use strict";e.d(I,{Fz:()=>a});var t=e(42844),n=e(56027),i=e.n(n),s=e(27702),r=e(25111),g=e(3935),d=e(74639),l=e(34667),u=e(86312),o=e(66310),m=e(1128),c=e(28580),p=e(5933),f=e(65322),E=e(91368),h=e(77799),y=e(18771);const v="+ Add new",D="-10";function a(M){const{dashboardId:T,allowEmpty:S,onChange:x,filter:O,enableCreateNew:B,inputId:A,onClear:V,enableReset:W,initialFolderUid:w,initialTitle:N="",permissionLevel:F=y.PermissionLevelString.Edit,rootName:k,showRoot:H=!0,skipInitialLoad:R,searchQueryType:_,customAdd:G,folderWarning:Y}=M,X=k??l.config.featureToggles.nestedFolders?"Dashboards":"General",[Q,se]=(0,s.useState)(null),[Z,le]=(0,s.useState)(!1),[oe,q]=(0,s.useState)(""),[ne,ge]=(0,s.useState)(Q?.title??""),ae=(0,o.wW)(b),re=typeof V=="function",De=(0,s.useCallback)(async st=>{const Me=await(0,h.ZL)(st,F,_),Ke=C(Me,O);return(0,u.ff)("grafana_folder_picker_results_loaded",{results:Ke.length,searchTermLength:st.length,enableCreateNew:!!B}),(E.contextSrv.hasAccess(y.AccessControlAction.DashboardsWrite,E.contextSrv.isEditor)||E.contextSrv.hasAccess(y.AccessControlAction.DashboardsCreate,E.contextSrv.isEditor))&&X?.toLowerCase().startsWith(st.toLowerCase())&&H&&Ke.unshift({label:X,value:""}),W&&st===""&&N!==""&&!Ke.find(tt=>tt.label===N)&&Ke.unshift({label:N,value:w}),B&&G?[...Ke,{value:D,label:v,title:st}]:Ke},[W,w,N,F,X,H,_,O,B,G]),he=(0,s.useMemo)(()=>i()(De,300,{leading:!0}),[De]),ye=async()=>{const st={label:N,value:void 0},Me={label:X,value:""},be=await De("");let Ke=null;w!=null?Ke=be.find(Ye=>Ye.value===w)||null:W&&N?Ke=st:w&&(Ke=be.find(Ye=>Ye.id===w)||null),!Ke&&!S&&(E.contextSrv.isEditor?Ke=Me:!!T?Ke=st:Ke=be.length>0?be[0]:st),!Z&&se(Ke)};(0,s.useEffect)(()=>{Q&&Q.value!==w&&!Z&&Q.value&&Q.label&&x({uid:Q.value,title:Q.label})},[Q,w]),(0,r.Z)(async()=>{if(R){const st=await P({getFolder:h.Pb,folderUid:w,folderName:N});se(st)}await ye()},[R,w,N]),(0,s.useEffect)(()=>{Q&&Q.id===D&&le(!0)},[Q]);const ce=(0,s.useCallback)((st,Me)=>{if(st?.value===D)se({id:D,title:oe}),ge(oe);else{if(st||(st={value:"",label:X}),Me.action==="clear"&&V){V();return}se(st),x({uid:st.value,title:st.label})}},[x,V,X,oe]),We=(0,s.useCallback)(async st=>{if(Y?.warningCondition(st))return(0,u.ff)("grafana_folder_picker_folder_created",{status:"failed_condition"}),!1;const Me=await(0,h.L6)({title:st});let be={value:"",label:"Not created"};return Me.uid?((0,u.ff)("grafana_folder_picker_folder_created",{status:"success"}),p.Z.emit(g.SI.alertSuccess,["Folder Created","OK"]),be={value:Me.uid,label:Me.title},se(Me),ce(be,{action:"create-option",option:be})):((0,u.ff)("grafana_folder_picker_folder_created",{status:"failed"}),p.Z.emit(g.SI.alertError,["Folder could not be created"])),be},[Y,ce]),ke=(0,s.useCallback)(st=>{const Me=!!G?.disallowValues;if(st.key==="Enter"&&Me&&!G?.isAllowedValue(ne)){st.preventDefault();return}switch(st.key){case"Enter":{We(Q?.title),le(!1);break}case"Escape":se({value:"",label:X}),le(!1)}},[G?.disallowValues,G?.isAllowedValue,ne,We,Q?.title,X]),et=st=>{const Me=st.currentTarget.value;ge(Me),se({id:void 0,title:Me})},we=()=>{se({value:"",label:X}),le(!1)},_e=(st,{action:Me})=>{Me==="input-change"&&q(be=>st),Me==="menu-close"&&q(be=>st)},Ge=()=>Y?.warningCondition(ne)?s.createElement(Y.warningComponent,null):null,qe=()=>Y?.warningCondition(oe)?s.createElement(Y.warningComponent,null):null;return Z?s.createElement(s.Fragment,null,s.createElement(Ge,null),s.createElement("div",{className:ae.newFolder},"Press enter to create the new folder."),s.createElement(m.I,{width:30,autoFocus:!0,value:ne,onChange:et,onKeyDown:ke,placeholder:"Press enter to confirm new folder.",onBlur:we})):s.createElement("div",{"data-testid":d.wl.components.FolderPicker.containerV2},s.createElement(qe,null),s.createElement(c.gY,{inputId:A,"aria-label":d.wl.components.FolderPicker.input,loadingMessage:(0,f.t)("folder-picker.loading","Loading folders..."),defaultOptions:!0,defaultValue:Q,inputValue:oe,onInputChange:_e,value:Q,allowCustomValue:B&&!G,loadOptions:he,onChange:ce,onCreateOption:We,isClearable:re}))}function C(M,T){return(T?T(M):M).map(x=>({label:x.title,value:x.uid}))}async function P({folderName:M,folderUid:T,getFolder:S}){if(T==null)throw new Error("folderUid is not found.");return M?{label:M,value:T}:{label:(await S(T)).title,value:T}}const b=M=>({newFolder:(0,t.css)` color: ${M.colors.warning.main}; font-size: ${M.typography.bodySmall.fontSize}; padding-bottom: ${M.spacing(1)}; `})},23159:(j,I,e)=>{"use strict";e.d(I,{c:()=>g});var t=e(89949),n=e.n(t),i=e(27702),s=e(73289),r=e(28580);class g extends i.Component{constructor(l){super(l),this.state={isLoading:!1},this.search=this.search.bind(this),this.debouncedSearch=(0,t.debounce)(this.search,300,{leading:!0,trailing:!0})}search(l){return this.setState({isLoading:!0}),(0,t.isNil)(l)&&(l=""),(0,s.i)().get(`/api/teams/search?perpage=100&page=1&query=${l}`).then(u=>{const o=u.teams.map(m=>({value:m,label:m.name,imgUrl:m.avatarUrl}));return this.setState({isLoading:!1}),o})}render(){const{onSelected:l,className:u}=this.props,{isLoading:o}=this.state;return i.createElement("div",{className:"user-picker","data-testid":"teamPicker"},i.createElement(r.qb,{isLoading:o,defaultOptions:!0,loadOptions:this.debouncedSearch,onChange:l,className:u,placeholder:"Select a team",noOptionsMessage:"No teams found","aria-label":"Team picker"}))}}},79173:(j,I,e)=>{"use strict";e.d(I,{f:()=>g});var t=e(89949),n=e.n(t),i=e(27702),s=e(73289),r=e(28580);class g extends i.Component{constructor(l){super(l),this.state={isLoading:!1},this.search=this.search.bind(this),this.debouncedSearch=(0,t.debounce)(this.search,300,{leading:!0,trailing:!0})}search(l){return this.setState({isLoading:!0}),(0,t.isNil)(l)&&(l=""),(0,s.i)().get(`/api/org/users/lookup?query=${l}&limit=100`).then(u=>u.map(o=>({id:o.userId,value:o.userId,label:o.login,imgUrl:o.avatarUrl,login:o.login}))).finally(()=>{this.setState({isLoading:!1})})}render(){const{className:l,onSelected:u,inputId:o}=this.props,{isLoading:m}=this.state;return i.createElement("div",{className:"user-picker","data-testid":"userPicker"},i.createElement(r.qb,{isClearable:!0,className:l,inputId:o,isLoading:m,defaultOptions:!0,loadOptions:this.debouncedSearch,onChange:u,placeholder:"Start typing to search for user",noOptionsMessage:"No users found","aria-label":"User picker"}))}}},8311:(j,I,e)=>{"use strict";e.d(I,{e:()=>s});var t=e(27702),n=e(64714),i=e(73453);class s extends t.Component{constructor(g){super(g)}render(){const{label:g,removeIcon:d,count:l,onClick:u}=this.props,{color:o}=(0,n.Bx)(g),m={backgroundColor:o},c=l!==0&&t.createElement("span",{className:"tag-count-label"},`(${l})`);return t.createElement("span",{className:"label label-tag",style:m},d&&t.createElement(i.J,{onClick:u,name:"times"}),g," ",c)}}},1041:(j,I,e)=>{"use strict";e.d(I,{D:()=>p});var t=e(42844),n=e(27702),i=e(38581),s=e(95676),r=e(66310),g=e(28580),d=e(73453),l=e(65322),u=e(8311);const o=({data:E,className:h,label:y,isFocused:v,innerProps:D})=>{const a=(0,r.wW)(m);return n.createElement("div",{className:(0,t.cx)(a.option,v&&a.optionFocused),"aria-label":"Tag option",...D},n.createElement("div",{className:`tag-filter-option ${h||""}`},typeof y=="string"?n.createElement(u.e,{label:y,removeIcon:!1,count:E.count??0}):y))},m=E=>({option:(0,t.css)` padding: 8px; white-space: nowrap; cursor: pointer; border-left: 2px solid transparent; &:hover { background: ${E.colors.background.secondary}; } `,optionFocused:(0,t.css)` background: ${E.colors.background.secondary}; border-style: solid; border-top: 0; border-right: 0; border-bottom: 0; border-left-width: 2px; `}),c=(E,h)=>RegExp((0,s.GE)(h),"i").test(E.value),p=({allowCustomValue:E=!1,formatCreateLabel:h,hideValues:y,inputId:v,isClearable:D,onChange:a,placeholder:C,tagOptions:P,tags:b,width:M})=>{const T=(0,r.wW)(f),S=b.map(G=>({value:G,label:G,count:0})),[x,O]=(0,n.useState)(S),[B,A]=(0,n.useState)(!1),[V,W]=(0,n.useState)(b),[w,N]=(0,n.useState)(S),F=(0,n.useMemo)(()=>b.join(),[b]),k=(0,n.useCallback)(async()=>(await P()).map(Y=>b.includes(Y.term)?{value:Y.term,label:Y.term,count:0}:{value:Y.term,label:Y.term,count:Y.count}),[P,b]),H=(0,n.useCallback)(async()=>{A(!0);const G=await k();E&&w.forEach(Y=>G.push(Y)),O(G),A(!1)},[E,w,k]);(0,n.useEffect)(()=>{b.length>0&&x.length===0&&H()},[H,x.length,b.length]),(0,n.useEffect)(()=>{b!==V&&(W(b),H())},[H,V,b]);const R=G=>{G.forEach(Y=>Y.count=0),a((G||[]).map(Y=>Y.value)),E&&N(G.filter(Y=>!b.includes(Y)))},_={key:F,onFocus:H,isLoading:B,options:x,allowCreateWhileLoading:!0,allowCustomValue:E,formatCreateLabel:h,defaultOptions:!0,filterOption:c,getOptionLabel:G=>G.label,getOptionValue:G=>G.value,inputId:v,isMulti:!0,onChange:R,loadingMessage:(0,l.t)("tag-filter.loading","Loading..."),noOptionsMessage:(0,l.t)("tag-filter.no-tags","No tags found"),placeholder:C||(0,l.t)("tag-filter.placeholder","Filter by tag"),value:S,width:M,components:{Option:o,MultiValueLabel:()=>null,MultiValueRemove(G){const{data:Y}=G;return n.createElement(i.c.MultiValueRemove,{...G},n.createElement(u.e,{key:Y.label,label:Y.label,removeIcon:!0,count:Y.count}))},MultiValueContainer:y?()=>null:i.c.MultiValueContainer}};return n.createElement("div",{className:T.tagFilter},D&&b.length>0&&n.createElement("button",{className:T.clear,onClick:()=>R([])},"Clear tags"),n.createElement(g.NU,{..._,prefix:n.createElement(d.J,{name:"tag-alt"}),"aria-label":"Tag filter"}))};p.displayName="TagFilter";const f=E=>({tagFilter:(0,t.css)` position: relative; min-width: 180px; flex-grow: 1; .label-tag { margin-left: 6px; cursor: pointer; } `,clear:(0,t.css)` background: none; border: none; text-decoration: underline; font-size: 12px; padding: none; position: absolute; top: -17px; right: 0; cursor: pointer; color: ${E.colors.text.secondary}; &:hover { color: ${E.colors.text.primary}; } `})},37827:(j,I,e)=>{"use strict";e.d(I,{a:()=>u});var t=e(89949),n=e.n(t),i=e(27702),s=e(76305),r=e(99633),g=e(37424),d=e(74273);const l="grafana.dashboard.timepicker.history",u=E=>i.createElement(d.G,{storageKey:l,defaultValue:[]},(h,y)=>{const v=m(h),D=o(v);return i.createElement(g.Xc,{...E,history:D,onChange:a=>{c(a,v,y),E.onChange(a)}})});function o(E){return E.map(h=>s.convertRawToRange(h,"utc",void 0,"YYYY-MM-DD HH:mm:ss"))}function m(E){return E.map(h=>{const y=typeof h.from=="string"?h.from:h.from.toISOString(),v=typeof h.to=="string"?h.to:h.to.toISOString();return{from:y,to:v}})}function c(E,h,y){if(!p(E))return;const v={from:typeof E.raw.from=="string"?E.raw.from:E.raw.from.toISOString(),to:typeof E.raw.to=="string"?E.raw.to:E.raw.to.toISOString()},D=f([v,...h]);y(D)}function p(E){return(0,r.v9)(E.raw.from)||(0,r.v9)(E.raw.to)}function f(E){return(0,t.uniqBy)(E,h=>h.from+h.to).slice(0,4)}},43801:(j,I,e)=>{"use strict";e.d(I,{K:()=>o});var t=e(27702),n=e(93666),i=e(29241),s=e(34072),r=e(71982),g=e(18869),d=e(70823),l=e(55879);const u=["rowHeight","colWidth","showValue","mergeValues","alignValue"];class o extends t.Component{constructor(){super(...arguments),this.getValueColor=(c,p,f)=>{const E=this.props.frames[c].fields[p];if(E.display){const h=E.display(f);if(h.color)return h.color}return n.R},this.prepConfig=(c,p,f)=>{this.panelContext=this.context;const{eventBus:E,sync:h}=this.panelContext;return(0,l.Nj)({frame:c,getTimeRange:f,eventBus:E,sync:h,allFrames:this.props.frames,...this.props,timeZones:Array.isArray(this.props.timeZone)?this.props.timeZone:[this.props.timeZone],rowHeight:c.fields.length>2?this.props.rowHeight:1,getValueColor:this.getValueColor})},this.renderLegend=c=>{const{legend:p,legendItems:f}=this.props;return!c||!f||!p||p.showLegend===!1?null:t.createElement(s.AY.Legend,{placement:p.placement},t.createElement(r.l,{placement:p.placement,items:f,displayMode:p.displayMode,readonly:!0}))}}render(){return t.createElement(g.d,{...this.props,fields:{x:c=>c.type===i.fS.time,y:c=>c.type===i.fS.number||c.type===i.fS.boolean||c.type===i.fS.string||c.type===i.fS.enum},prepConfig:this.prepConfig,propsToDiff:u,renderLegend:this.renderLegend})}}o.contextType=d.bb},55879:(j,I,e)=>{"use strict";e.d(I,{KN:()=>V,iK:()=>se,Y:()=>Z,$m:()=>X,Ur:()=>G,Nj:()=>N,AR:()=>_,SA:()=>Y});var t=e(93666),n=e(75578),i=e(21609),s=e(79248),r=e(84714),g=e(29241),d=e(5168),l=e(11024),u=e(77104),o=e(48962),m=e(66805),c=e(64167),p=e(19345),f=e(18869),E=e(39596),h=e(26453),y=e(48473),v=e(26712),D=e(96750),a=e(59479),C=e(94876);const{round:P,min:b,ceil:M}=Math,T=2;let S=6;const x=a.Gj;function O(le,oe,q,ne,ge){(0,a.Qm)(q,le,x,oe,(ae,re,De)=>{let he=ne*re,ye=ne*De;ge(ae,he,ye)})}function B(le){const{mode:oe,numSeries:q,isDiscrete:ne,hasMappedNull:ge,rowHeight:ae=0,colWidth:re=0,showValue:De,mergeValues:he=!1,theme:ye,label:ce,formatValue:We,alignValue:ke="left",getTimeRange:et,getValueColor:we,getFieldConfig:_e,onHover:Ge,onLeave:qe}=le;let st;const Me=Array(q).fill(null).map(()=>{let pe=document.createElement("div");return pe.classList.add("bar-mark"),pe.style.position="absolute",pe.style.background="rgba(255,255,255,0.2)",pe});let be;const Ke=pe=>{be=Array(q).fill(null).map($e=>Array(pe).fill(null))},Ye=`500 ${Math.round(12*devicePixelRatio)}px ${ye.typography.fontFamily}`,tt=Array(q).fill(null),nt=[re,1/0],Pt=1-nt[0],xt=(nt[1]??1/0)*v.Z.pxRatio,bt=new Map,Rt=new Map;function ct(pe){bt.forEach(($e,Se)=>{pe.fillStyle=Se,pe.fill($e)}),Rt.forEach(($e,Se)=>{pe.strokeStyle=Se,pe.stroke($e)}),bt.clear(),Rt.clear()}function it(pe,$e,Se,Ve,He,Ze,Qe,rt,pt,It,_t,tn,qt){if(Qe<1)return;const cn=we(It+1,tn),on=_e(It),ln=A(on,cn);if(be[It][_t]={x:P(He-Se),y:P(Ze-Ve),w:Qe,h:rt,sidx:It+1,didx:_t,fillColor:ln},qt){let Un=ln,yt=bt.get(Un);if(yt==null&&bt.set(Un,yt=new Path2D),$e(yt,He,Ze,Qe,rt),pt){let ft=cn,Tt=Rt.get(ft);Tt==null&&Rt.set(ft,Tt=new Path2D),$e(Tt,He+pt/2,Ze+pt/2,Qe-pt,rt-pt)}}else pe.beginPath(),$e(pe,He,Ze,Qe,rt),pe.fillStyle=ln,pe.fill(),pt&&(pe.beginPath(),$e(pe,He+pt/2,Ze+pt/2,Qe-pt,rt-pt),pe.strokeStyle=cn,pe.lineWidth=pt,pe.stroke())}const me=(pe,$e,Se,Ve)=>(v.Z.orient(pe,$e,(He,Ze,Qe,rt,pt,It,_t,tn,qt,cn,on,ln,Un,yt)=>{let ft=P((He.width||0)*v.Z.pxRatio),Tt=ne($e),Bt=Tt&&ge($e);pe.ctx.save(),yt(pe.ctx,pe.bbox.left,pe.bbox.top,pe.bbox.width,pe.bbox.height),pe.ctx.clip(),O(ae,$e-1,q,on,(Nt,Ft,Gt)=>{if(oe===V.Changes)for(let dn=0;dn<Qe.length;dn++){let sn=Qe[dn];if(sn!=null||Bt){let Bn=Math.round(It(Ze[dn],rt,cn,tn)),wt=dn;for(;++wt<Qe.length&&(Qe[wt]===void 0||he&&Qe[wt]===sn););let Vt=wt===Qe.length?tn+cn+ft:Math.round(It(Ze[wt],rt,cn,tn));it(pe.ctx,yt,tn,qt,Bn,P(qt+Ft),Vt-Bn,P(Gt),ft,Nt,dn,sn,Tt),dn=wt-1}}else if(oe===V.Samples){let dn=It(Ze[1],rt,cn,tn)-It(Ze[0],rt,cn,tn),sn=dn*Pt,Bn=P(b(xt,dn-sn)-ft),wt=Bn/2;for(let Vt=Se;Vt<=Ve;Vt++){let Ht=Qe[Vt];if(Ht!=null||Bt){let Xt=It(Ze[Vt],rt,cn,tn);it(pe.ctx,yt,tn,qt,P(Xt-wt),P(qt+Ft),Bn,P(Gt),ft,Nt,Vt,Ht,Tt)}}}}),Tt&&(pe.ctx.lineWidth=ft,ct(pe.ctx)),pe.ctx.restore()}),null),Ee=We==null||De===c.Jp.Never?!1:(pe,$e,Se,Ve)=>(pe.ctx.save(),pe.ctx.rect(pe.bbox.left,pe.bbox.top,pe.bbox.width,pe.bbox.height),pe.ctx.clip(),pe.ctx.font=Ye,pe.ctx.textAlign=oe===V.Changes?ke:"center",pe.ctx.textBaseline="middle",v.Z.orient(pe,$e,(He,Ze,Qe,rt,pt,It,_t,tn,qt,cn,on)=>{let ln=P((He.width||0)*v.Z.pxRatio),yt=ne($e)&&ge($e),ft=P(qt+Be[$e-1]);for(let Tt=0;Tt<Qe.length;Tt++)if(Qe[Tt]!=null||yt){const Bt=be[$e-1][Tt];if(!Bt||Bt.x>=cn)continue;let Nt=Math.floor(Bt?.w/S);if(De===c.Jp.Auto&&Nt<2)continue;let Ft=We($e,Qe[Tt]),Gt=P(Bt.x+tn+Bt.w/2);oe===V.Changes&&(ke==="left"?Gt=P(Bt.x+tn+ln+T):ke==="right"&&(Gt=P(Bt.x+tn+Bt.w-ln-T))),pe.ctx.fillStyle=ye.colors.getContrastText(Bt.fillColor,3),pe.ctx.fillText(Ft.slice(0,Nt),Gt,ft)}}),pe.ctx.restore(),!1),Ce=pe=>{let $e=pe.over,Se="";for(let Ve=32;Ve<=126;Ve++)Se+=String.fromCharCode(Ve);S=Math.ceil(pe.ctx.measureText(Se).width/Se.length*v.Z.pxRatio),S+=2.5,$e.style.overflow="hidden",Me.forEach(Ve=>{$e.appendChild(Ve)})},Ae=pe=>{st=st||new C.lW(0,0,pe.bbox.width,pe.bbox.height),st.clear(),Ke(pe.data[0].length),pe.series.forEach($e=>{$e._paths=null})};function ze(pe,$e){let Se=Me[pe],Ve=v.Z.pxRatio;$e?(Se.style.display="",Se.style.left=P($e.x/Ve)+"px",Se.style.top=P($e.y/Ve)+"px",Se.style.width=P($e.w/Ve)+"px",Se.style.height=P($e.h/Ve)+"px"):Se.style.display="none",tt[pe]=$e}let Ie;function xe(pe,$e){let Se;for(let Ve=0;Ve<q;Ve++){let He;if(pe>=0){let Ze=Be[Ve];st.get(pe,Ze,1,1,Qe=>{(0,C.Pn)(pe,Ze,Qe.x,Qe.y,Qe.x+Qe.w,Qe.y+Qe.h)&&(He=Qe,Math.abs($e-Ze)<=Qe.h/2&&(Se=Qe))})}He?He!==tt[Ve]&&ze(Ve,He):tt[Ve]!=null&&ze(Ve,null)}Se?Se!==Ie&&(Ie=Se,Ge(Se.sidx,Se.didx,Se)):Ie&&(Ie=void 0,qe())}function Te(pe,$e){let Se;st.get(pe,$e,1,1,Ve=>{(0,C.Pn)(pe,$e,Ve.x,Ve.y,Ve.x+Ve.w,Ve.y+Ve.h)&&(Se=Ve)}),Se?(ze(0,Se),Se!==Ie&&(Ie=Se,Ge(Se.sidx,Se.didx,Se))):Ie&&(ze(0,null),Ie=void 0,qe())}const Oe=oe===V.Changes?xe:Te,ie=pe=>{let $e=P(pe.cursor.left*v.Z.pxRatio),Se=P(pe.cursor.top*v.Z.pxRatio);if(!st.o.length&&st.q==null)for(const Ve of be)for(const He of Ve)He&&st.add(He);Oe($e,Se)},Le={y:!1,x:oe===V.Changes,points:{show:!1}},Be=Array(q).fill(0),Ue=Array(q).fill(0),ue=[0,1];return{cursor:Le,xSplits:oe===V.Samples?(pe,$e,Se,Ve,He,Ze)=>{let Qe=[],rt=pe.data[0][1]-pe.data[0][0],pt=M(He/rt);for(let It=0;It<pe.data[0].length;It+=pt){let _t=pe.data[0][It];_t>=Se&&_t<=Ve&&Qe.push(_t)}return Qe}:null,xRange:pe=>{const $e=et();let Se=$e.from.valueOf(),Ve=$e.to.valueOf();if(oe===V.Samples){let Qe=(pe.data[0][1]-pe.data[0][0])/2;Se<=pe.data[0][0]&&(Se=pe.data[0][0]-Qe);let rt=pe.data[0].length-1;Ve>=pe.data[0][rt]&&(Ve=pe.data[0][rt]+Qe)}return[Se,Ve]},ySplits:pe=>(O(ae,null,q,pe.bbox.height,($e,Se,Ve)=>{Be[$e]=P(Se+Ve/2),Ue[$e]=pe.posToVal(Be[$e]/v.Z.pxRatio,f.j)}),Ue),yValues:(pe,$e)=>$e.map((Se,Ve)=>ce(Ve+1)),yRange:ue,drawPaths:me,drawPoints:Ee,init:Ce,drawClear:Ae,setCursor:ie}}function A(le,oe){if(oe[0]==="#"&&oe.length===9)return oe;const q=(le.fillOpacity??100)/100;return(0,D.alpha)(oe,q)}var V=(le=>(le.Changes="changes",le.Samples="samples",le))(V||{});const W={lineWidth:0,fillOpacity:80};function w(le){return le.ctrlKey||le.metaKey||le.shiftKey?SeriesVisibilityChangeMode.AppendToSelection:SeriesVisibilityChangeMode.ToggleSelection}const N=({frame:le,theme:oe,timeZones:q,getTimeRange:ne,mode:ge,eventBus:ae,sync:re,rowHeight:De,colWidth:he,showValue:ye,alignValue:ce,mergeValues:We,getValueColor:ke,eventsScope:et="__global_"})=>{const we=new p.U(q[0]),_e="time",Ge="x",qe=Rt=>{const ct=Rt.config?.color?.mode;return!(ct&&Rt.display&&ct.startsWith("continuous-"))},st=Rt=>Rt.config.mappings?.some(ct=>ct.type===m.Hi.SpecialValue&&ct.options.match==="null")||!1,Me=(Rt,ct)=>{const it=le.fields[Rt];return it.state?.origin?.fieldIndex!==void 0&&it.state?.origin?.frameIndex!==void 0&&ke?ke(it.state?.origin?.frameIndex,it.state?.origin?.fieldIndex,ct):t.R},be={mode:ge,numSeries:le.fields.length-1,isDiscrete:Rt=>qe(le.fields[Rt]),hasMappedNull:Rt=>st(le.fields[Rt]),mergeValues:We,rowHeight:De,colWidth:he,showValue:ye,alignValue:ce,theme:oe,label:Rt=>(0,n.CZ)(le.fields[Rt],le),getFieldConfig:Rt=>le.fields[Rt].config.custom,getValueColor:Me,getTimeRange:ne,formatValue:(Rt,ct)=>(0,i.zc)(le.fields[Rt].display(ct)),onHover:(Rt,ct)=>{Ye=Rt,tt=ct,Ke=!0},onLeave:()=>{Ye=null,tt=null,Ke=!0}};let Ke=!1,Ye=null,tt=null;const nt=B(be),Pt={point:{[_e]:null,[f.j]:null},data:le};we.addHook("init",nt.init),we.addHook("drawClear",nt.drawClear),we.addHook("setCursor",nt.setCursor);const xt=(Rt,ct,it)=>{Ke&&(Ye!=null&&(Rt(Ye),ct(tt)),Ke=!1),it(Ye==null)};we.setTooltipInterpolator(xt),we.setPrepData(Rt=>(0,y.Bj)(Rt[0],(0,y.i7)(Rt[0]))),we.setCursor(nt.cursor),we.addScale({scaleKey:Ge,isTime:!0,orientation:c.wN.Horizontal,direction:c.bQ.Right,range:nt.xRange}),we.addScale({scaleKey:f.j,isTime:!1,orientation:c.wN.Vertical,direction:c.bQ.Up,range:nt.yRange}),we.addAxis({scaleKey:Ge,isTime:!0,splits:nt.xSplits,placement:c.LB.Bottom,timeZone:q[0],theme:oe,grid:{show:!0}}),we.addAxis({scaleKey:f.j,isTime:!1,placement:c.LB.Left,splits:nt.ySplits,values:nt.yValues,grid:{show:!1},ticks:{show:!1},gap:16,theme:oe});let bt=0;for(let Rt=0;Rt<le.fields.length;Rt++){if(Rt===0)continue;const ct=le.fields[Rt],it=ct.config,me={...W,...it.custom};ct.state.seriesIndex=bt++,we.addSeries({scaleKey:f.j,pathBuilder:nt.drawPaths,pointsBuilder:nt.drawPoints,lineWidth:me.lineWidth,fillOpacity:me.fillOpacity,theme:oe,show:!me.hideFrom?.viz,thresholds:it.thresholds,dataFrameFieldIndex:ct.state?.origin})}if(re&&re()!==s.m.Off){let Rt={};Rt.sync={key:et,filters:{pub:(ct,it,me,Ee,Ce,Ae,ze)=>re&&re()===s.m.Off?!1:(Pt.rowIndex=ze,me<0&&Ee<0?(Pt.point[_e]=null,Pt.point[f.j]=null,ae.publish(new r.xH)):(Pt.point[_e]=it.posToVal(me,Ge),Pt.point.panelRelY=Ee>0?Ee/Ae:1,Pt.down=void 0,ae.publish(new r.es(Pt))),!0)},scales:[Ge,null]},we.setSync(),we.setCursor(Rt)}return we};function F(le){const oe=new Map;for(let q=0;q<le.fields.length;q++)oe.set(getFieldDisplayName(le.fields[q],le),q);return oe}function k(le){let oe=le[0],q;for(let ne=1;ne<le.length;ne++){let ge=le[ne];ge===null?oe=null:ge===oe?(q||(q=[...le]),q[ne]=void 0):ge!=null&&(oe=ge)}return q}function H(le){let oe=le.config.custom?.spanNulls;return oe?oe===!0?1/0:oe:-1}function R(le,oe){const q=le.config.thresholds;if(le.type!==g.fS.number||!q||!q.steps.length)return;const ne=G(le.config,oe);if(ne.length!==q.steps.length)return;const ge=new Map,ae=new Map;for(let he=0;he<ne.length;he++)ge.set(q.steps[he],ne[he].label),ae.set(ne[he].label,ne[he].color);let re=le.values;const De=new Array(le.values.length);if(q.mode===d.H.Percentage){const{min:he,max:ye}=(0,l.xD)(le),ce=ye-he;re=re.map(We=>We==null?We:(We-he)/ce*100)}for(let he=0;he<De.length;he++){const ye=re[he];ye==null?De[he]=ye:De[he]=ge.get((0,u.m1)(ye,q.steps))}return{...le,config:{...le.config,custom:{...le.config.custom,spanNulls:H(le)}},type:g.fS.string,values:De,display:he=>({text:String(he),color:ae.get(String(he)),numeric:NaN})}}function _(le,oe,q,ne){if(!le?.length)return{warn:"No data in response"};let ge=!1;const ae=[];for(let re of le){let De=!1,he=!1,ye=(0,o.Y3)(re,re.fields.findIndex(ke=>ke.type===g.fS.time)),ce=(0,E.w)({frame:ye,refFieldPseudoMin:q.from.valueOf(),refFieldPseudoMax:q.to.valueOf()});ce!==re&&(he=!0);const We=[];for(let ke of(0,h.I)(ce).fields)if(!ke.config.custom?.hideFrom?.viz)switch(ke.type){case g.fS.time:De=!0,ge=!0,We.push(ke);break;case g.fS.enum:case g.fS.number:if(oe&&ke.config.color?.mode===t.S.Thresholds){const et=R(ke,ne);if(et){We.push(et),he=!0;continue}}case g.fS.boolean:case g.fS.string:ke={...ke,config:{...ke.config,custom:{...ke.config.custom,spanNulls:H(ke)}}},We.push(ke);break;default:he=!0}De&&We.length>1&&(ge=!0,he?ae.push({...ye,fields:We}):ae.push(ye))}return ge?ae.length?{frames:ae}:{warn:"No graphable fields"}:{warn:"Data does not have a time field"}}function G(le,oe){const q=[],ne=le.thresholds;if(!ne||!ne.steps.length)return q;const ge=ne.steps,ae=(0,i.Cf)(ne.mode===d.H.Percentage?"percent":le.unit??""),re=De=>(0,i.zc)(ae(De));for(let De=0;De<ge.length;De++){let he=ge[De],ye=he.value,ce="",We="";ye===-1/0&&De<ge.length-1?(ye=ge[De+1].value,ce="< "):We="+",q.push({label:`${ce}${re(ye)}${We}`,color:oe.visualization.getColorByName(he.color),yAxis:1})}return q}function Y(le,oe,q){if(!(!le||oe.showLegend===!1))return X(Q(le),q)}function X(le,oe){if(!le.length)return;const q=[],ne=le[0].config,ge=ne.color?.mode??t.S.Fixed,ae=ne.thresholds;if(ge===t.S.Thresholds&&ae?.steps&&ae.steps.length>1)return G(ne,oe);if(ge.startsWith("continuous"))return;const re=new Map;return le.forEach(De=>{De.config.custom?.hideFrom?.legend||De.values.forEach(he=>{let ye=De.display(he);ye.color&&re.set(ye.text,ye.color)})}),re.forEach((De,he)=>{he.length>0&&q.push({label:he,color:oe.visualization.getColorByName(De??t.R),yAxis:1})}),q}function Q(le){const oe=[];for(const q of le)for(const ne of q.fields)ne.type!==g.fS.time&&oe.push(ne);return oe}function se(le,oe){let q,ne=oe+1;if(ne>=le.values.length)return null;const ge=le.values[oe];for(;q===void 0;){if(ne>=le.values.length)return null;const ae=le.values[ne];ae===void 0||ae===ge?ne++:q=ne}return q}function Z(le){if(le<0||Number.isNaN(le))return"";let oe,q,ne,ge,ae,re,De,he;return De=Math.floor(le/1e3),re=Math.floor(De/60),De=De%60,ae=Math.floor(re/60),re=re%60,ge=Math.floor(ae/24),ae=ae%24,oe=Math.floor(ge/365),oe>0&&(ge=ge%365),q=Math.floor(ge/30),q>0&&(ge=ge%30),ne=Math.floor(ge/7),ne>0&&(ge=ge%7),he=Math.round(le%1e3*1e3)/1e3,(oe>0?oe+"y "+(q>0?q+"mo ":"")+(ne>0?ne+"w ":"")+(ge>0?ge+"d ":""):q>0?q+"mo "+(ne>0?ne+"w ":"")+(ge>0?ge+"d ":""):ne>0?ne+"w "+(ge>0?ge+"d ":""):ge>0?ge+"d "+(ae>0?ae+"h ":""):ae>0?ae+"h "+(re>0?re+"m ":""):re>0?re+"m "+(De>0?De+"s ":""):De>0?De+"s "+(he>0?he+"ms ":""):he>0?he+"ms ":"0").trim()}},19059:(j,I,e)=>{"use strict";e.d(I,{a:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(45066),r=e(53901),g=e(73453);const d=({values:u,onChange:o,id:m})=>{const c=(0,i.wW)(l);return n.createElement("div",{className:c.wrapper},u.length?u.map((p,f)=>n.createElement("div",{className:c.pair,key:f},n.createElement(s.X,{id:`${m}-key-${f}`,placeholder:"Tag name",value:p.key,onChange:E=>{o(u.map((h,y)=>(y===f&&(h.key=String(E)),h)))}}),n.createElement(r.W,{"aria-label":"equals",className:c.operator},"as"),n.createElement(s.X,{id:`${m}-value-${f}`,placeholder:"New name (optional)",value:p.value||"",onChange:E=>{o(u.map((h,y)=>(y===f&&(h.value=String(E)),h)))}}),n.createElement("button",{onClick:()=>o([...u.slice(0,f),...u.slice(f+1)]),className:"gf-form-label query-part","aria-label":"Remove tag",type:"button"},n.createElement(g.J,{name:"times"})),f===u.length-1?n.createElement("button",{onClick:()=>o([...u,{key:"",value:""}]),className:"gf-form-label query-part","aria-label":"Add tag",type:"button"},n.createElement(g.J,{name:"plus"})):null)):n.createElement("button",{onClick:()=>o([...u,{key:"",value:""}]),className:"gf-form-label query-part","aria-label":"Add tag",type:"button"},n.createElement(g.J,{name:"plus"})))},l=u=>({wrapper:(0,t.css)` display: flex; flex-direction: column; gap: ${u.spacing(.5)} 0; `,pair:(0,t.css)` display: flex; justify-content: start; align-items: center; `,operator:(0,t.css)` color: ${u.v1.palette.orange}; width: auto; `})},51778:(j,I,e)=>{"use strict";e.d(I,{Ny:()=>y,dw:()=>v,mH:()=>E,p1:()=>c,rr:()=>h});var t=e(42844),n=e(27702),i=e(19010),s=e(71107),r=e(48024),g=e(42074),d=e(1128),l=e(47449),u=e(53229),o=e(71654),m=e(19059);function c(D){if(D?.tracesToLogsV2)return D.tracesToLogsV2;if(!D?.tracesToLogs)return;const a={customQuery:!1};return a.datasourceUid=D.tracesToLogs.datasourceUid,a.tags=D.tracesToLogs.mapTagNamesEnabled?D.tracesToLogs.mappedTags:D.tracesToLogs.tags?.map(C=>({key:C})),a.filterByTraceID=D.tracesToLogs.filterByTraceID,a.filterBySpanID=D.tracesToLogs.filterBySpanID,a.spanStartTimeShift=D.tracesToLogs.spanStartTimeShift,a.spanEndTimeShift=D.tracesToLogs.spanEndTimeShift,a}function p({options:D,onOptionsChange:a}){const C=["loki","elasticsearch","grafana-splunk-datasource","grafana-opensearch-datasource","grafana-falconlogscale-datasource","googlecloud-logging-datasource"],P=(0,n.useMemo)(()=>c(D.jsonData)||{customQuery:!1},[D.jsonData]),{query:b="",tags:M,customQuery:T}=P,S=(0,n.useCallback)(x=>{a({...D,jsonData:{...D.jsonData,tracesToLogsV2:{...P,...x},tracesToLogs:void 0}})},[a,D,P]);return n.createElement("div",{className:(0,t.css)({width:"100%"})},n.createElement(s.Z,null,n.createElement(r._,{tooltip:"The logs data source the trace is going to navigate to",label:"Data source",labelWidth:26},n.createElement(u.q,{inputId:"trace-to-logs-data-source-picker",filter:x=>C.includes(x.type),current:P.datasourceUid,noDefault:!0,width:40,onChange:x=>S({datasourceUid:x.uid})}))),n.createElement(s.Z,null,n.createElement(o.w,{label:E("start"),tooltip:h("start"),value:P.spanStartTimeShift||"",onChange:x=>{S({spanStartTimeShift:x})},isInvalidError:y})),n.createElement(s.Z,null,n.createElement(o.w,{label:E("end"),tooltip:h("end"),value:P.spanEndTimeShift||"",onChange:x=>{S({spanEndTimeShift:x})},isInvalidError:y})),n.createElement(s.Z,null,n.createElement(r._,{tooltip:"Tags that will be used in the query. Default tags: 'cluster', 'hostname', 'namespace', 'pod'",label:"Tags",labelWidth:26},n.createElement(m.a,{values:M??[],onChange:x=>S({tags:x})}))),n.createElement(f,{disabled:T,type:"trace",id:"filterByTraceID",value:!!P.filterByTraceID,onChange:x=>S({filterByTraceID:x})}),n.createElement(f,{disabled:T,type:"span",id:"filterBySpanID",value:!!P.filterBySpanID,onChange:x=>S({filterBySpanID:x})}),n.createElement(s.Z,null,n.createElement(r._,{tooltip:"Use a custom query with the possibility to interpolate variables from the trace or span",label:"Use custom query",labelWidth:26},n.createElement(g.x,{id:"customQuerySwitch",value:T,onChange:x=>S({customQuery:x.currentTarget.checked})}))),T&&n.createElement(r._,{label:"Query",labelWidth:26,tooltip:"The query that will run when navigating from a trace to logs data source. Interpolate tags using the `$__tags` keyword",grow:!0},n.createElement(d.I,{label:"Query",type:"text",allowFullScreen:!0,value:b,onChange:x=>S({query:x.currentTarget.value})})))}function f(D){return n.createElement(s.Z,null,n.createElement(r._,{disabled:D.disabled,label:`Filter by ${D.type} ID`,labelWidth:26,grow:!0,tooltip:`Filters logs by ${D.type} ID`},n.createElement(g.x,{id:D.id,value:D.value,onChange:a=>D.onChange(a.currentTarget.checked)})))}const E=D=>`Span ${D} time shift`,h=D=>`Shifts the ${D} time of the span. Default: 0 (Time units can be used here, for example: 5s, -1m, 3h)`,y="Invalid time shift. See tooltip for examples.",v=({options:D,onOptionsChange:a})=>n.createElement(i.K,{title:"Trace to logs",description:n.createElement(l.W,{description:"Navigate from a trace span to the selected data source's logs.",suffix:`${D.type}/#trace-to-logs`,feature:"trace to logs"}),isCollapsible:!0,isInitiallyOpen:!0},n.createElement(p,{options:D,onOptionsChange:a}))},99829:(j,I,e)=>{"use strict";e.d(I,{Z:()=>r});var t=e(42844),n=e(27702),i=e(86312),s=e(66310);const r=({text:d="PRO",className:l,experimentId:u,eventVariant:o="",...m})=>{const c=(0,s.wW)(g);return(0,n.useEffect)(()=>{u&&(0,i.SZ)(u,"test",o)},[u,o]),n.createElement("span",{className:(0,t.cx)(c.badge,l),...m},d)},g=d=>({badge:(0,t.css)` margin-left: ${d.spacing(1.25)}; border-radius: ${d.shape.borderRadius(5)}; background-color: ${d.colors.success.main}; padding: ${d.spacing(.25,.75)}; color: white; // use the same color for both themes font-weight: ${d.typography.fontWeightMedium}; font-size: ${d.typography.pxToRem(10)}; `})},12969:(j,I,e)=>{"use strict";e.d(I,{B:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(13741),r=e(72625);const g=u=>({Global:[{keys:["g","h"],description:"Go to Home Dashboard"},{keys:["g","d"],description:"Go to Dashboards"},{keys:["g","e"],description:"Go to Explore"},{keys:["g","p"],description:"Go to Profile"},{keys:[`${u} + k`],description:"Open search"},{keys:["esc"],description:"Exit edit/setting views"},{keys:["h"],description:"Show all keyboard shortcuts"},{keys:["c","t"],description:"Change theme"}],Dashboard:[{keys:[`${u}+s`],description:"Save dashboard"},{keys:["d","r"],description:"Refresh all panels"},{keys:["d","s"],description:"Dashboard settings"},{keys:["d","v"],description:"Toggle in-active / view mode"},{keys:["d","k"],description:"Toggle kiosk mode (hides top nav)"},{keys:["d","E"],description:"Expand all rows"},{keys:["d","C"],description:"Collapse all rows"},{keys:["d","a"],description:"Toggle auto fit panels (experimental feature)"},{keys:[`${u} + o`],description:"Toggle shared graph crosshair"},{keys:["d","l"],description:"Toggle all panel legends"},{keys:["d","x"],description:"Toggle exemplars in all panel"}],"Focused Panel":[{keys:["e"],description:"Toggle panel edit view"},{keys:["v"],description:"Toggle panel fullscreen view"},{keys:["p","s"],description:"Open Panel Share Modal"},{keys:["p","d"],description:"Duplicate Panel"},{keys:["p","r"],description:"Remove Panel"},{keys:["p","l"],description:"Toggle panel legend"}],"Time Range":[{keys:["t","z"],description:"Zoom out time range"},{keys:["t","\u2190"],description:"Move time range back"},{keys:["t","\u2192"],description:"Move time range forward"},{keys:["t","a"],description:"Make time range absolute/permanent"}]}),d=({onDismiss:u})=>{const o=(0,i.wW)(l),m=(0,n.useMemo)(()=>(0,r.vl)(),[]),c=(0,n.useMemo)(()=>g(m),[m]);return n.createElement(s.u,{title:"Shortcuts",isOpen:!0,onDismiss:u,onClickBackdrop:u},n.createElement("div",{className:o.categories},Object.entries(c).map(([p,f],E)=>n.createElement("div",{className:o.shortcutCategory,key:E},n.createElement("table",{className:o.shortcutTable},n.createElement("tbody",null,n.createElement("tr",null,n.createElement("th",{className:o.shortcutTableCategoryHeader,colSpan:2},p)),f.map((h,y)=>n.createElement("tr",{key:`${E}-${y}`},n.createElement("td",{className:o.shortcutTableKeys},h.keys.map((v,D)=>n.createElement("span",{className:o.shortcutTableKey,key:`${E}-${y}-${D}`},v))),n.createElement("td",{className:o.shortcutTableDescription},h.description)))))))))};function l(u){return{titleDescription:(0,t.css)` font-size: ${u.typography.bodySmall.fontSize}; font-weight: ${u.typography.bodySmall.fontWeight}; color: ${u.colors.text.disabled}; padding-bottom: ${u.spacing(2)}; `,categories:(0,t.css)` font-size: ${u.typography.bodySmall.fontSize}; display: flex; flex-flow: row wrap; justify-content: space-between; align-items: flex-start; `,shortcutCategory:(0,t.css)` width: 50%; font-size: ${u.typography.bodySmall.fontSize}; `,shortcutTable:(0,t.css)` margin-bottom: ${u.spacing(2)}; `,shortcutTableCategoryHeader:(0,t.css)` font-weight: normal; font-size: ${u.typography.h6.fontSize}; text-align: left; `,shortcutTableDescription:(0,t.css)` text-align: left; color: ${u.colors.text.disabled}; width: 99%; padding: ${u.spacing(1,2)}; `,shortcutTableKeys:(0,t.css)` white-space: nowrap; width: 1%; text-align: right; color: ${u.colors.text.primary}; `,shortcutTableKey:(0,t.css)` display: inline-block; text-align: center; margin-right: ${u.spacing(.5)}; padding: 3px 5px; font: 11px Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: 10px; vertical-align: middle; border: solid 1px ${u.colors.border.medium}; border-radius: ${u.shape.borderRadius(3)}; color: ${u.colors.text.primary}; background-color: ${u.colors.background.secondary}; `}}},12308:(j,I,e)=>{"use strict";e.d(I,{Oh:()=>d,config:()=>n.config,default:()=>s,iE:()=>r});var t=e(9232),n=e(34667);let i=n.config;const s=i,r=()=>i,g=l=>{i={...i,...l}},d=n.config.panels?.debug?.state===t.BV.alpha},97957:(j,I,e)=>{"use strict";e.d(I,{AV:()=>l,FL:()=>p,Hk:()=>f,K3:()=>t,OA:()=>s,QO:()=>o,b0:()=>d,cz:()=>i,gN:()=>c,hD:()=>n,kh:()=>g,yM:()=>r,zF:()=>u});const t=30,n=8,i=24,s="v",r="h",g=4,d=250,l=t*3,u="panel-copy",o=2,m=23763571993,c=40,p="VisualizationSelectPane.ListMode",f="WidgetSelectPane.ListMode"},26473:(j,I,e)=>{"use strict";e.d(I,{h:()=>n,p:()=>i});var t=e(27702);const n=t.createContext(void 0);function i(){const s=(0,t.useContext)(n);if(!s)throw new Error("No GrafanaContext found");return s}},73807:(j,I,e)=>{"use strict";e.d(I,{AT:()=>u,ZR:()=>m,iG:()=>c,t_:()=>o});var t=e(27702),n=e(66117),i=e(87241),s=e(18771),r=e(33877);const g={title:"",text:"",severity:s.AppNotificationSeverity.Success,icon:"check"},d={title:"",text:"",severity:s.AppNotificationSeverity.Warning,icon:"exclamation-triangle"},l={title:"",text:"",severity:s.AppNotificationSeverity.Error,icon:"exclamation-triangle"},u=(p,f="",E)=>({...g,title:p,text:f,id:(0,n.Z)(),timestamp:Date.now(),showing:!0}),o=(p,f="",E,h)=>({...l,text:(0,i.i)(f),title:p,id:(0,n.Z)(),traceId:E,component:h,timestamp:Date.now(),showing:!0}),m=(p,f="",E)=>({...d,title:p,text:f,traceId:E,id:(0,n.Z)(),timestamp:Date.now(),showing:!0});function c(){const p=(0,s.useDispatch)();return(0,t.useMemo)(()=>({success:(f,E="")=>{p((0,r.$l)(u(f,E)))},warning:(f,E="",h)=>{p((0,r.$l)(m(f,E,h)))},error:(f,E="",h)=>{p((0,r.$l)(o(f,E,h)))}}),[p])}},66574:(j,I,e)=>{"use strict";e.d(I,{Vt:()=>i.contextSrv,Wz:()=>s.W,h$:()=>t.Z,rv:()=>n.r});var t=e(5933),n=e(54788),i=e(91368),s=e(7999)},95116:(j,I,e)=>{"use strict";e.d(I,{H6:()=>h,ZP:()=>y});var t=e(89949),n=e(56812),i=e(19484),s=e(10864);const r=S=>{const x=(0,s.F)().getInstanceSettings(S.datasourceName);return{id:S.ts.toString(),createdAt:S.ts,datasourceName:S.datasourceName,datasourceUid:x?.uid||"",starred:S.starred,comment:S.comment,queries:S.queries}},g=S=>{if(!(0,s.F)().getInstanceSettings({uid:S.datasourceUid}))throw new Error("Datasource not found.");return{ts:S.createdAt,datasourceName:S.datasourceName,starred:S.starred,comment:S.comment,queries:S.queries}};var d=e(7990);function l(S,x,O,B,A){const V=m(S,O),W=c(V,B),w=A?o(W,A):W;return p(w,x)}const u=(S,x)=>{const O=new Date,B=new Date(O.setDate(O.getDate()-S));return x?B.setHours(24,0,0,0):B.setHours(0,0,0,0)};function o(S,x){const O=u(x[0],!0),B=u(x[1],!1);return S.filter(A=>A.createdAt<O&&A.createdAt>B)}function m(S,x){return x.length>0?S.filter(O=>x.includes(O.datasourceName)):S}function c(S,x){return S.filter(O=>O.comment.includes(x)?!0:O.queries.filter(A=>Object.values((0,t.omit)(A,["datasource","key","refId","hide","queryType"])).some(V=>V?.toString().includes(x))).length>0)}const p=(S,x)=>{let O;return x===d.A.Ascending&&(O=(B,A)=>B.createdAt<A.createdAt?-1:B.createdAt>A.createdAt?1:0),x===d.A.Descending&&(O=(B,A)=>B.createdAt<A.createdAt?1:B.createdAt>A.createdAt?-1:0),x===d.A.DatasourceZA&&(O=(B,A)=>B.datasourceName<A.datasourceName?-1:B.datasourceName>A.datasourceName?1:0),x===d.A.DatasourceAZ&&(O=(B,A)=>B.datasourceName<A.datasourceName?1:B.datasourceName>A.datasourceName?-1:0),S.sort(O)},f={retentionPeriod:"grafana.explore.richHistory.retentionPeriod",starredTabAsFirstTab:"grafana.explore.richHistory.starredTabAsFirstTab",activeDatasourceOnly:"grafana.explore.richHistory.activeDatasourceOnly",datasourceFilters:"grafana.explore.richHistory.datasourceFilters"},E="grafana.explore.richHistory",h=1e4;class y{async getRichHistory(x){const O=C().map(r),B=x.starred?O.filter(V=>V.starred===!0):O,A=l(B,x.sortOrder,x.datasourceFilters,x.search,[x.from,x.to]);return{richHistory:A,total:A.length}}async addToRichHistory(x){const O=Date.now(),B={id:O.toString(),createdAt:O,...x},A=g(B),V=D(C()),W=A.queries.map(H=>(0,t.omit)(H,["key","refId"])),w=V.length>0&&V[0].queries.map(H=>(0,t.omit)(H,["key","refId"]));if((0,t.isEqual)(W,w)){const H=new Error("Entry already exists");throw H.name=i.j.DuplicatedEntry,H}const{queriesToKeep:N,limitExceeded:F}=a(V),k=[A,...N];try{n.Z.setObject(E,k)}catch(H){if(H instanceof Error&&H.name==="QuotaExceededError")T(i.j.StorageFull,`Saving rich history failed: ${H.message}`);else throw H}return F?{warning:{type:i.V.LimitExceeded,message:`Query history reached the limit of ${h}. Old, not-starred items have been removed.`},richHistoryQuery:B}:{richHistoryQuery:B}}async deleteAll(){n.Z.delete(E)}async deleteRichHistory(x){const O=parseInt(x,10),A=n.Z.getObject(E,[]).filter(V=>V.ts!==O);n.Z.setObject(E,A)}async updateStarred(x,O){return v(x,B=>B.starred=O)}async updateComment(x,O){return v(x,B=>B.comment=O)}async getSettings(){return{activeDatasourceOnly:n.Z.getObject(f.activeDatasourceOnly,!1),retentionPeriod:n.Z.getObject(f.retentionPeriod,7),starredTabAsFirstTab:n.Z.getBool(f.starredTabAsFirstTab,!1),lastUsedDatasourceFilters:n.Z.getObject(f.datasourceFilters,[]).map(x=>x.value)}}async updateSettings(x){n.Z.set(f.activeDatasourceOnly,x.activeDatasourceOnly),n.Z.set(f.retentionPeriod,x.retentionPeriod),n.Z.set(f.starredTabAsFirstTab,x.starredTabAsFirstTab),n.Z.setObject(f.datasourceFilters,(x.lastUsedDatasourceFilters||[]).map(O=>({value:O})))}}function v(S,x){const O=parseInt(S,10),B=n.Z.getObject(E,[]),A=(0,t.find)(B,{ts:O});if(!A)throw new Error("Rich history item not found.");return x(A),n.Z.setObject(E,B),r(A)}function D(S){const x=n.Z.getObject(f.retentionPeriod,7),O=u(x,!1);return S.filter(B=>B.ts>O||B.starred===!0)||[]}function a(S){let x=!1,O=S.length-1;for(;O>=0&&S.length>=h;)S[O].starred||(S.splice(O,1),x=!0),O--;return{queriesToKeep:S,limitExceeded:x}}function C(){const S=n.Z.getObject(E,[]);return P(S)}function P(S){return S.map(O=>{const B=O.queries.map((A,V)=>b(O,A,V));return{...O,queries:B}})}function b(S,x,O){const B="ABCDEFGHIJKLMNOPQRSTUVXYZ";return typeof x=="object"?x:M(x)?JSON.parse(x):{expr:x,refId:B[O]}}function M(S){try{JSON.parse(S)}catch{return!1}return!0}function T(S,x){const O=new Error(x);throw O.name=S,O}},19484:(j,I,e)=>{"use strict";e.d(I,{V:()=>n,j:()=>t});var t=(i=>(i.StorageFull="StorageFull",i.DuplicatedEntry="DuplicatedEntry",i))(t||{}),n=(i=>(i.LimitExceeded="LimitExceeded",i))(n||{})},19889:(j,I,e)=>{"use strict";e.d(I,{b:()=>E,X:()=>h});var t=e(34667),n=e(66574),i=e(7990),s=e(95116),r=e(78209),g=e(73289),d=e(10864),l=e(97662);const u=y=>{const v=(0,d.F)().getInstanceSettings({uid:y.datasourceUid});return{id:y.uid,createdAt:y.createdAt*1e3,datasourceName:v?.name||"",datasourceUid:y.datasourceUid,starred:y.starred,comment:y.comment,queries:y.queries}},o=y=>({uid:y.id,createdAt:Math.floor(y.createdAt/1e3),datasourceUid:y.datasourceUid,starred:y.starred,comment:y.comment,queries:y.queries});class m{constructor(){this.preferenceService=new l.y("user")}async addToRichHistory(v){const{result:D}=await(0,g.i)().post("/api/query-history",{dataSourceUid:v.datasourceUid,queries:v.queries});return{richHistoryQuery:u(D)}}async deleteAll(){throw new Error("not supported")}async deleteRichHistory(v){(0,g.i)().delete(`/api/query-history/${v}`)}async getRichHistory(v){const D=c(v);let a="query-history-get-all";v.starred&&(a="query-history-get-starred");const P=(await(0,r.n)((0,g.i)().fetch({method:"GET",url:`/api/query-history?${D}`,requestId:a}))).data,b=(P.result.queryHistory||[]).map(u),M=P.result.totalCount||0;return{richHistory:b,total:M}}async getSettings(){return{activeDatasourceOnly:!1,lastUsedDatasourceFilters:void 0,retentionPeriod:14,starredTabAsFirstTab:(await this.preferenceService.load()).queryHistory?.homeTab==="starred"}}async updateComment(v,D){const a=await(0,g.i)().patch(`/api/query-history/${v}`,{comment:D});return u(a.result)}updateSettings(v){return this.preferenceService.patch({queryHistory:{homeTab:v.starredTabAsFirstTab?"starred":"query"}})}async updateStarred(v,D){let a;return D?a=await(0,g.i)().post(`/api/query-history/star/${v}`):a=await(0,g.i)().delete(`/api/query-history/star/${v}`),u(a.result)}}function c(y){let v=`${y.datasourceFilters.map(D=>{const a=(0,d.F)().getInstanceSettings(D).uid;return`datasourceUid=${encodeURIComponent(a)}`}).join("&")}`;if(y.search&&(v=v+`&searchString=${y.search}`),y.sortOrder&&(v=v+`&sort=${y.sortOrder===i.A.Ascending?"time-asc":"time-desc"}`),!y.starred){const D=y.from===0?"now":`now-${y.from}d`,a=y.to===0?"now":`now-${y.to}d`;v=v+`&to=${D}`,v=v+`&from=${a}`}return v=v+"&limit=100",v=v+`&page=${y.page||1}`,y.starred&&(v=v+`&onlyStarred=${y.starred}`),v}const p=new s.ZP,f=new m,E=()=>t.config.queryHistoryEnabled?f:p,h=()=>t.config.queryHistoryEnabled?{availableFilters:[i.A.Descending,i.A.Ascending],lastUsedDataSourcesAvailable:!1,clearHistory:!1,onlyActiveDataSource:!1,changeRetention:!1,queryHistoryAvailable:n.Vt.isSignedIn}:{availableFilters:[i.A.Descending,i.A.Ascending,i.A.DatasourceAZ,i.A.DatasourceZA],lastUsedDataSourcesAvailable:!0,clearHistory:!0,onlyActiveDataSource:!0,changeRetention:!0,queryHistoryAvailable:!0}},48105:(j,I,e)=>{"use strict";e.d(I,{q:()=>i});var t=e(18771),n=e(86809);const i=s=>{const r=(0,t.useSelector)(g=>g.navIndex);return(0,n.ht)(r,s)}},89033:(j,I,e)=>{"use strict";e.d(I,{K:()=>s});var t=e(27702),n=e(7662),i=e(26129);function s(){const{search:r}=(0,n.TH)(),g=(0,t.useMemo)(()=>(0,i.Ox)(r||""),[r]),d=(0,t.useCallback)((l,u)=>i.E1.partial(l,u),[]);return[g,d]}},16832:(j,I,e)=>{"use strict";e.d(I,{D_:()=>u,a2:()=>l});const t="en-US",n="fr-FR",i="es-ES",s="de-DE",r="zh-Hans",g="pseudo-LOCALE",d=null,l=[{code:t,name:"English",loader:()=>e.e(7424).then(e.t.bind(e,67424,19))},{code:n,name:"Fran\xE7ais",loader:()=>e.e(6419).then(e.t.bind(e,66419,19))},{code:i,name:"Espa\xF1ol",loader:()=>e.e(4253).then(e.t.bind(e,4253,19))},{code:s,name:"Deutsch",loader:()=>e.e(810).then(e.t.bind(e,90810,19))},{code:r,name:"\u4E2D\u6587\uFF08\u7B80\u4F53\uFF09",loader:()=>e.e(5001).then(e.t.bind(e,35001,19))}],u=l.map(o=>o.code)},65322:(j,I,e)=>{"use strict";e.d(I,{$q:()=>f,cC:()=>m,t:()=>p,uC:()=>u});var t=e(62937),n=e(13795),i=e(27702),s=e(83399),r=e(92046),g=e(16832);const d=E=>E.split("-")[0].toLowerCase(),l={type:"backend",init(){},async read(E,h,y){let v=g.a2.find(a=>a.code===E);if(v||(v=g.a2.find(a=>d(a.code)===d(E))),!v)return y(new Error("No message loader available for "+E),null);const D=await v.loader();y(null,D)}};function u(E){const h={partialBundledLanguages:!0,resources:{},returnEmptyString:!1,pluralSeparator:"__"};let y=t.ZP;if(E==="detect"){y=y.use(n.Z);const v={order:["navigator"],caches:[]};h.detection=v}else h.lng=g.D_.includes(E)?E:void 0;return y.use(l).use(s.Db).init(h)}function o(E){const h=VALID_LANGUAGES.includes(E)?E:void 0;return i18n.changeLanguage(h)}const m=E=>i.createElement(r.c,{...E}),c=t.ZP.t,p=(E,h,y)=>c(E,h,y),f=(E,h={})=>typeof E=="string"?f(new Date(E),h):new Intl.DateTimeFormat(t.ZP.language,h).format(E)},54788:(j,I,e)=>{"use strict";e.d(I,{r:()=>n});class t{constructor(){this.panelsRendered=0,this.enabled=void 0}renderingCompleted(){this.panelsRendered+=1,window.panelsRendered=this.panelsRendered}}const n=new t},4021:(j,I,e)=>{"use strict";e.d(I,{$l:()=>l,Av:()=>f,F6:()=>m,Jk:()=>c,VW:()=>p,ad:()=>u,hS:()=>o,mE:()=>h,vo:()=>y});var t=e(34099),n=e(18771);const i=25,s="notifications",r=`${s}/lastRead`,g={byId:C(),lastRead:Number.parseInt(window.localStorage.getItem(r)??`${Date.now()}`,10)},d=(0,t.oM)({name:"appNotifications",initialState:g,reducers:{notifyApp:(b,{payload:M})=>{Object.values(b.byId).some(T=>v(M,T)&&T.showing)||(b.byId[M.id]=M,P(b.byId))},hideAppNotification:(b,{payload:M})=>{M in b.byId&&(b.byId[M].showing=!1,P(b.byId))},clearNotification:(b,{payload:M})=>{delete b.byId[M],P(b.byId)},clearAllNotifications:b=>{b.byId={},P(b.byId)},readAllNotifications:(b,{payload:M})=>{b.lastRead=M}}}),{notifyApp:l,hideAppNotification:u,clearNotification:o,clearAllNotifications:m,readAllNotifications:c}=d.actions,p=d.reducer,f=b=>b.lastRead,E=b=>Object.values(b.byId).sort((M,T)=>T.timestamp-M.timestamp),h=b=>E(b).filter(D),y=b=>Object.values(b.byId).filter(M=>M.showing);function v(b,M){return b.icon===M.icon&&b.severity===M.severity&&b.text===M.text&&b.title===M.title}function D(b){return b.severity===n.AppNotificationSeverity.Warning||b.severity===n.AppNotificationSeverity.Error}function a(b){return typeof b=="object"&&b!==null&&"id"in b&&"icon"in b&&"title"in b&&"text"in b}function C(){const b=window.localStorage.getItem(s);if(!b)return{};const M=JSON.parse(b);return Object.values(M).every(T=>a(T))?M:{}}function P(b){const M=Object.values(b).filter(D).sort((T,S)=>S.timestamp-T.timestamp).slice(0,i).reduce((T,S)=>(T[S.id]={id:S.id,severity:S.severity,icon:S.icon,title:S.title,text:S.text,traceId:S.traceId,timestamp:S.timestamp,showing:S.showing},T),{});try{window.localStorage.setItem(s,JSON.stringify(M))}catch(T){console.error("Unable to persist notifications to local storage"),console.error(T)}}},78467:(j,I,e)=>{"use strict";e.d(I,{Lk:()=>u,OQ:()=>l,V4:()=>m,gd:()=>o});var t=e(34099),n=e(34667),i=e(51391);const s=n.config.bootData?.navTree??[];function r(c){return c.map(p=>{const f=p.children&&r(p.children);return{...p,children:f,text:(0,i.Y)(p.id)??p.text,subTitle:(0,i.L)(p.id)??p.subTitle,emptyMessage:(0,i.Y)(p.emptyMessageId)}})}const g="starred/",d=(0,t.oM)({name:"navBarTree",initialState:()=>r(n.config.bootData?.navTree??[]),reducers:{setStarred:(c,p)=>{const f=c.find(D=>D.id==="starred"),{id:E,title:h,url:y,isStarred:v}=p.payload;if(f)if(v){f.children||(f.children=[]);const D={id:g+E,text:h,url:y};f.children.push(D),f.children.sort((a,C)=>a.text.localeCompare(C.text))}else{const D=f.children?.findIndex(a=>a.id===g+E)??-1;D>-1&&f?.children?.splice(D,1)}},updateDashboardName:(c,p)=>{const{id:f,title:E,url:h}=p.payload,y=c.find(v=>v.id==="starred");if(y){const v=y.children?.find(D=>D.id===f);v&&(v.text=E,v.url=h,y.children?.sort((D,a)=>D.text.localeCompare(a.text)))}},removePluginFromNavTree:(c,p)=>{const f="plugin-page-"+p.payload.pluginID,E=c.findIndex(h=>h.id===f);E>-1&&c.splice(E,1)}}}),{setStarred:l,removePluginFromNavTree:u,updateDashboardName:o}=d.actions,m=d.reducer},34139:(j,I,e)=>{"use strict";e.d(I,{Cu:()=>d,G4:()=>f,H7:()=>c,Qz:()=>g,RL:()=>m});var t=e(34099),n=e(89949),i=e.n(n),s=e(12308),r=e(51391);const g="home";function d(){const E={},h=(0,n.cloneDeep)(s.default.bootData.navTree),y=h.find(D=>D.id===g),v=h.filter(D=>D.id!==g);return y&&l(E,[y]),l(E,v,E[g]),E}function l(E,h,y){const v=[];for(const D of h){const a={...D,text:(0,r.Y)(D.id)??D.text,subTitle:(0,r.L)(D.id)??D.subTitle,emptyMessage:(0,r.Y)(D.emptyMessageId),parentItem:y};a.id&&(E[a.id]=a),a.children&&l(E,a.children,a),v.push(a)}y&&(y.children=v),E["not-found"]={...u("Page not found","404 Error").node},E.error={...u("Page error","An unexpected error").node}}function u(E,h){const y={text:E,subTitle:h,icon:"exclamation-triangle"};return{node:y,main:y}}const o={},m=(0,t.PH)("navIndex/updateNavIndex"),c=(0,t.PH)("navIndex/updateConfigurationSubtitle"),p=(E,h)=>({...E,parentItem:{...E.parentItem,text:E.parentItem?.text??"",subTitle:h}}),f=(E=o,h)=>{if(m.match(h)){let v=function(C){if(C.children)for(const P of C.children)D[P.id]={...P,parentItem:C};C.parentItem&&v(C.parentItem)};var y=v;const D={},a=h.payload;return v(a),{...E,...D}}else if(c.match(h)){const v=`Organization: ${h.payload}`;return{...E,cfg:{...E.cfg,subTitle:v},datasources:p(E.datasources,v),correlations:p(E.correlations,v),users:p(E.users,v),teams:p(E.teams,v),plugins:p(E.plugins,v),"org-settings":p(E["org-settings"],v),apikeys:p(E.apikeys,v)}}return E}},86809:(j,I,e)=>{"use strict";e.d(I,{ht:()=>r,vw:()=>g});var t=e(34667),n=e(40127),i=e(34139);const s=()=>{const u={id:"not-found",text:"Page not found",icon:"exclamation-triangle",subTitle:"404 Error",url:"not-found"};return{node:u,main:u}},r=(u,o,m,c=!1)=>{if(u[o]){const p=u[o],f=c?p:g(p),E=d(f,o);return{node:p,main:E}}return m||s()};function g(u){return t.config.featureToggles.nestedFolders&&u.id===n.y3?u:u.parentItem&&u.parentItem.id!==i.Qz?g(u.parentItem):u}function d(u,o){return u.id===o?{...u,active:!0}:u.children&&u.children.length>0?{...u,children:u.children.map(m=>d(m,o))}:u}const l=u=>`${u.main.text}${u.node.text?": "+u.node.text:""}`},97662:(j,I,e)=>{"use strict";e.d(I,{y:()=>n});var t=e(45937);class n{constructor(s){this.resourceUri=s}update(s){return t.ae.put(`/api/${this.resourceUri}/preferences`,s)}patch(s){return t.ae.patch(`/api/${this.resourceUri}/preferences`,s)}load(){return t.ae.get(`/api/${this.resourceUri}/preferences`)}}},45937:(j,I,e)=>{"use strict";e.d(I,{y$:()=>le,ae:()=>oe,i:()=>q});var t=e(69966),n=e(78209),i=e(48592),s=e(19973),r=e(91826),g=e(91053),d=e(32364),l=e(39343),u=e(22479),o=e(76970),m=e(19985),c=e(56469),p=e(24321),f=e(56361),E=e(23403),h=e(90581),y=e(32900),v=e(66117),D=e(3935),a=e(68246),C=e(34667),P=e(5933),b=e(12308),M=e(59281),T=e(42844),S=e(27702),x=e(66310),O=e(52995),B=e(86064),A=e(66670),V=e(80402),W=e(32173);const w=ge=>{const ae=(0,x.l4)(),re=N(ae),De=(0,W.J)(ae),he=!!ge.maxConcurrentSessions,ye=()=>{window.location.reload()};return S.createElement(O.h_,null,S.createElement("div",{className:De.modal},S.createElement(B.v,{title:"You have been automatically signed out",severity:"warning",className:re.infobox},S.createElement("div",{className:re.text},S.createElement("p",null,"Your session token was automatically revoked because you have reached",S.createElement("strong",null,` the maximum number of ${he?ge.maxConcurrentSessions:""} concurrent sessions `),"for your account."),S.createElement("p",null,S.createElement("strong",null,"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.")),S.createElement(A.zx,{size:"md",variant:"primary",onClick:ye},"Sign in"))),S.createElement("div",{className:(0,T.cx)(De.modalBackdrop,re.backdrop)}))},N=(0,V.B)(ge=>({infobox:(0,T.css)` margin-bottom: 0; `,text:(0,T.css)` margin: ${ge.spacing(1,0,2)}; `,backdrop:(0,T.css)` background-color: ${ge.colors.background.canvas}; opacity: 0.8; `}));var F=e(43620),k=e(26631),H=e(76897),R=(ge=>(ge[ge.Pending=0]="Pending",ge[ge.InProgress=1]="InProgress",ge[ge.Done=2]="Done",ge))(R||{});class _{constructor(ae=!1){this.state={},this.queue=new t.x,this.updates=new t.x,this.add=(re,De)=>this.queue.next({id:re,options:De,state:0}),this.setInProgress=re=>this.queue.next({id:re,state:1}),this.setDone=re=>this.queue.next({id:re,state:2}),this.getUpdates=()=>this.updates.asObservable(),this.getUpdate=re=>{const De=Object.keys(re).filter(ye=>re[ye].state===1).length;return{noOfPending:Object.keys(re).filter(ye=>re[ye].state===0).length,noOfInProgress:De,state:re}},this.publishUpdate=(re,De)=>{this.printState(re,De),this.updates.next(re)},this.printState=(re,De)=>{if(!De)return;const he=Object.keys(re.state).reduce((ye,ce)=>{const We={id:ce,state:re.state[ce].state};return ye.push(We),ye},[]);console.log("FetchQueue noOfStarted",re.noOfInProgress),console.log("FetchQueue noOfNotStarted",re.noOfPending),console.log("FetchQueue state",he)},this.queue.subscribe(re=>{const{id:De,state:he,options:ye}=re;if(this.state[De]||(this.state[De]={state:0,options:{url:""}}),he===2){delete this.state[De];const We=this.getUpdate(this.state);this.publishUpdate(We,ae);return}this.state[De].state=he,ye&&(this.state[De].options=ye);const ce=this.getUpdate(this.state);this.publishUpdate(ce,ae)})}}var G=e(9045);class Y{constructor(ae,re,De){const he=De?.http2Enabled?1e3:5;ae.getUpdates().pipe((0,f.h)(({noOfPending:ye})=>ye>0),(0,G.b)(({state:ye,noOfInProgress:ce})=>{const We=Object.keys(ye).filter(_e=>ye[_e].state===R.Pending&&!(0,H.mu)(ye[_e].options.url)).reduce((_e,Ge)=>{const qe={id:Ge,options:ye[Ge].options};return _e.push(qe),_e},[]),ke=Object.keys(ye).filter(_e=>ye[_e].state===R.Pending&&(0,H.mu)(ye[_e].options.url)).reduce((_e,Ge)=>{const qe={id:Ge,options:ye[Ge].options};return _e.push(qe),_e},[]),et=Math.max(he-ce-We.length,0),we=ke.slice(0,et);return We.concat(we)})).subscribe(({id:ye,options:ce})=>{re.add(ye,ce)})}}class X{constructor(ae,re){this.queue=new t.x,this.responses=new t.x,this.add=(De,he)=>{this.queue.next({id:De,options:he})},this.getResponses=De=>this.responses.asObservable().pipe((0,f.h)(he=>he.id===De)),this.queue.subscribe(De=>{const{id:he,options:ye}=De;ae.setInProgress(he),this.responses.next({id:he,observable:re(ye)})})}}var Q=e(91368);const se="cancel_all_requests_request_id",Z="grafana-trace-id";class le{constructor(ae){this.inFlightRequests=new t.x,this.HTTP_REQUEST_CANCELED=-1,this.inspectorStream=new t.x,this._tokenRotationInProgress=null,this.dependencies={fromFetch:d.U,appEvents:P.Z,contextSrv:Q.contextSrv,logout:()=>{Q.contextSrv.setLoggedOut()}},ae&&(this.dependencies={...this.dependencies,...ae}),this.noBackendCache=!1,this.internalFetch=this.internalFetch.bind(this),this.fetchQueue=new _,this.responseQueue=new X(this.fetchQueue,this.internalFetch),new Y(this.fetchQueue,this.responseQueue,(0,b.iE)())}async request(ae){return await(0,n.n)(this.fetch(ae).pipe((0,l.U)(re=>re.data)))}fetch(ae){const re=(0,v.Z)(),De=this.fetchQueue;return new i.y(he=>{const ye=new s.w0;return ye.add(this.responseQueue.getResponses(re).subscribe(ce=>{ye.add(ce.observable.subscribe(he))})),this.fetchQueue.add(re,ae),function(){De.setDone(re),ye.unsubscribe()}})}internalFetch(ae){ae.requestId&&this.inFlightRequests.next(ae.requestId),ae=this.parseRequestOptions(ae);const re=(0,M.v)();return re!==null&&re!==""&&(ae.headers||(ae.headers={}),C.config.jwtUrlLogin&&C.config.jwtHeaderName&&(ae.headers[C.config.jwtHeaderName]=`${re}`)),this.getFromFetchStream(ae).pipe(this.handleStreamResponse(ae),this.handleStreamError(ae),this.handleStreamCancellation(ae))}resolveCancelerIfExists(ae){this.inFlightRequests.next(ae)}cancelAllInFlightRequests(){this.inFlightRequests.next(se)}async datasourceRequest(ae){return(0,n.n)(this.fetch(ae))}parseRequestOptions(ae){const re=this.dependencies.contextSrv.user?.orgId;return ae.retry=ae.retry??0,(0,H.R8)(ae.url)&&(re&&(ae.headers=ae.headers??{},ae.headers["X-Grafana-Org-Id"]=re),ae.url.startsWith("/")&&(ae.url=ae.url.substring(1)),ae.headers?.Authorization&&(ae.headers["X-DS-Authorization"]=ae.headers.Authorization,delete ae.headers.Authorization),this.noBackendCache&&(ae.headers=ae.headers??{},ae.headers["X-Grafana-NoCache"]="true")),ae.hideFromInspector===void 0&&(ae.hideFromInspector=(0,H.R8)(ae.url)&&!(0,H.mu)(ae.url)),ae}getFromFetchStream(ae){const re=(0,k.Xv)(ae),De=(0,k.nS)(ae);return this.dependencies.fromFetch(re,De).pipe((0,u.z)(async he=>{const{status:ye,statusText:ce,ok:We,headers:ke,url:et,type:we,redirected:_e}=he,Ge=ae.responseType??((0,k.rZ)(ke)?"json":void 0),qe=await(0,k.aO)(he,Ge);return{status:ye,statusText:ce,ok:We,data:qe,headers:ke,url:et,type:we,redirected:_e,config:ae,traceId:he.headers.get(Z)??void 0}}))}showApplicationErrorAlert(ae){}showSuccessAlert(ae){const{config:re}=ae;if(re.showSuccessAlert===!1||re.showSuccessAlert===void 0&&(re.method==="GET"||(0,H.mu)(re.url)||!(0,H.R8)(re.url)))return;const De=ae.data;De?.message&&this.dependencies.appEvents.emit(D.SI.alertSuccess,[De.message])}showErrorAlert(ae,re){if(ae.showErrorAlert===!1||ae.showErrorAlert===void 0&&((0,H.mu)(ae.url)||!(0,H.R8)(ae.url)))return;let De="",he=re.data.message;he==="Unexpected error"&&re.message&&(he=re.message),he.length>80&&(De=he,he="Error"),re.status===422&&(De=re.data.message,he="Validation failed"),this.dependencies.appEvents.emit(re.status<500?D.SI.alertWarning:D.SI.alertError,[he,De,re.data.traceID])}processRequestError(ae,re){return re.data=re.data??{message:"Unexpected error"},typeof re.data=="string"&&(re.data={message:re.data,error:re.statusText,response:re.data}),re.data&&!re.data.message&&typeof re.data.error=="string"&&(re.data.message=re.data.error),re.data.message&&setTimeout(()=>{re.isHandled||this.showErrorAlert(ae,re)},50),this.inspectorStream.next(re),re}handleStreamResponse(ae){return re=>re.pipe((0,l.U)(De=>{if(!De.ok){const{status:he,statusText:ye,data:ce}=De;throw{status:he,statusText:ye,data:ce,config:ae,traceId:De.headers.get(Z)??void 0}}return De}),(0,o.b)(De=>{this.showSuccessAlert(De),this.inspectorStream.next(De)}))}handleStreamError(ae){const{isSignedIn:re}=this.dependencies.contextSrv.user;return De=>De.pipe((0,m.a)(he=>he.pipe((0,u.z)((ye,ce)=>{const We=ce===0&&ae.retry===0;if(ye.status===401&&(0,H.R8)(ae.url)&&We&&re){if(ye.data?.error?.id==="ERR_TOKEN_REVOKED")return this.dependencies.appEvents.publish(new F.Dn({component:w,props:{maxConcurrentSessions:ye.data?.error?.maxConcurrentSessions}})),(0,r._)(()=>ye);let ke=C.config.featureToggles.clientTokenRotation?this.rotateToken():this.loginPing();return(0,g.D)(ke).pipe((0,c.K)(et=>(et.status===401&&this.dependencies.logout(),(0,r._)(et))))}return(0,r._)(ye)}))),(0,c.K)(he=>(0,r._)(()=>this.processRequestError(ae,he))))}handleStreamCancellation(ae){return re=>re.pipe((0,p.R)(this.inFlightRequests.pipe((0,f.h)(De=>{let he=!1;return ae&&ae.requestId&&ae.requestId===De&&(he=!0),De===se&&(he=!0),he}))),(0,E.T)(()=>({type:a.eA.Cancelled,cancelled:!0,data:null,status:this.HTTP_REQUEST_CANCELED,statusText:"Request was aborted",config:ae})))}getInspectorStream(){return this.inspectorStream}async get(ae,re,De,he){return this.request({...he,method:"GET",url:ae,params:re,requestId:De})}async delete(ae,re,De){return this.request({...De,method:"DELETE",url:ae,data:re})}async post(ae,re,De){return this.request({...De,method:"POST",url:ae,data:re})}async patch(ae,re,De){return this.request({...De,method:"PATCH",url:ae,data:re})}async put(ae,re,De){return this.request({...De,method:"PUT",url:ae,data:re})}withNoBackendCache(ae){return this.noBackendCache=!0,ae().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,h.x)(()=>{this._tokenRotationInProgress=null}),(0,y.B)()),this._tokenRotationInProgress)}loginPing(){return this.fetch({url:"/api/login/ping",method:"GET",retry:1})}search(ae){return this.get("/api/search",ae)}getDashboardByUid(ae){return this.get(`/api/dashboards/uid/${ae}`)}validateDashboard(ae){const re=JSON.stringify(ae,ne,2);return this.request({method:"POST",url:"/api/dashboards/validate",data:{dashboard:re},showSuccessAlert:!1,showErrorAlert:!1})}getPublicDashboardByUid(ae){return this.get(`/api/public/dashboards/${ae}`)}getFolderByUid(ae,re={}){const De=new URLSearchParams;return re.withAccessControl&&De.set("accesscontrol","true"),this.get(`/api/folders/${ae}?${De.toString()}`)}}const oe=new le,q=()=>oe;function ne(ge,ae){if(!(typeof ae=="number"&&!Number.isFinite(ae)))return ae}},91368:(j,I,e)=>{"use strict";e.d(I,{Wg:()=>l,contextSrv:()=>m});var t=e(89949),n=e.n(t),i=e(76305),s=e(73289),r=e(80978),g=e(18771),d=e(12308);const l="auto";class u{constructor(){this.id=0,this.isGrafanaAdmin=!1,this.isSignedIn=!1,this.orgRole="",this.orgId=0,this.orgName="",this.login="",this.externalUserId="",this.orgCount=0,this.timezone="",this.fiscalYearStartMonth=0,this.helpFlags1=0,this.theme="dark",this.hasEditPermissionInFolders=!1,this.email="",this.name="",this.locale="",this.language="",this.weekStart="",this.gravatarUrl="",this.analytics={identifier:""},this.authenticatedBy="",d.default.bootData.user&&(0,t.extend)(this,d.default.bootData.user)}}class o{constructor(){this.sidemenuSmallBreakpoint=!1,this.tokenRotationJobId=0,d.default.bootData||(d.default.bootData={user:{},settings:{},navTree:[]}),this.user=new u,this.isSignedIn=this.user.isSignedIn,this.isGrafanaAdmin=this.user.isGrafanaAdmin,this.isEditor=this.hasRole("Editor")||this.hasRole("Admin"),this.hasEditPermissionInFolders=this.user.hasEditPermissionInFolders,this.minRefreshInterval=d.default.minRefreshInterval,this.canScheduleRotation()&&this.scheduleTokenRotationJob()}async fetchUserPermissions(){try{this.accessControlEnabled()&&(this.user.permissions=await(0,s.i)().get("/api/access-control/user/actions",{reloadcache:!0}))}catch(f){console.error(f)}}setLoggedOut(){this.cancelTokenRotationJob(),this.user.isSignedIn=!1,this.isSignedIn=!1,window.location.reload()}hasRole(f){return f==="ServerAdmin"?this.isGrafanaAdmin:this.user.orgRole===f}accessControlEnabled(){return d.default.rbacEnabled}licensedAccessControlEnabled(){return(0,r.v)("accesscontrol")&&d.default.rbacEnabled}hasPermissionInMetadata(f,E){return this.accessControlEnabled()?!!E.accessControl?.[f]:!0}hasPermission(f){return this.accessControlEnabled()?!!this.user.permissions?.[f]:!0}isGrafanaVisible(){return document.visibilityState===void 0||document.visibilityState==="visible"}isAllowedInterval(f){return!d.default.minRefreshInterval||f===l?!0:i.intervalToMs(f)>=i.intervalToMs(d.default.minRefreshInterval)}getValidInterval(f){return this.isAllowedInterval(f)?f:d.default.minRefreshInterval}hasAccessToExplore(){return this.accessControlEnabled()?this.hasPermission(g.AccessControlAction.DataSourcesExplore)&&d.default.exploreEnabled:(this.isEditor||d.default.viewersCanEdit)&&d.default.exploreEnabled}hasAccess(f,E){return this.accessControlEnabled()?this.hasPermission(f):E}hasAccessInMetadata(f,E,h){return this.accessControlEnabled()?this.hasPermissionInMetadata(f,E):h}evaluatePermission(f,E){return this.accessControlEnabled()?E.some(h=>this.hasPermission(h))?[]:["Reject"]:f()}scheduleTokenRotationJob(){if(this.canScheduleRotation()){let f=this.getSessionExpiry();if(f===0){this.rotateToken().then();return}let h=(f-Math.floor(Math.random()*(20-1)+1))*1e3-Date.now();this.tokenRotationJobId=setTimeout(()=>{if(this.getSessionExpiry()>f){this.scheduleTokenRotationJob();return}this.rotateToken().then()},h)}}canScheduleRotation(){if(!this.isSignedIn||!d.default.featureToggles.clientTokenRotation)return!1;const f=new URLSearchParams(window.location.search);return!(f.get("render")||f.get("auth_token")||this.user.authenticatedBy==="authproxy"&&!d.default.auth.AuthProxyEnableLoginToken)}cancelTokenRotationJob(){d.default.featureToggles.clientTokenRotation&&this.tokenRotationJobId>0&&clearTimeout(this.tokenRotationJobId)}rotateToken(){return fetch(d.default.appSubUrl+"/api/user/auth-tokens/rotate",{method:"POST"}).then(f=>{if(f.status===200){this.scheduleTokenRotationJob();return}if(f.status===401){this.setLoggedOut();return}}).catch(f=>{console.error(f)})}getSessionExpiry(){const f=document.cookie.split("; ").find(h=>h.startsWith("grafana_session_expiry="));if(!f)return 0;let E=f.split("=").at(1);return E?parseInt(E,10):0}}let m=new o;const c=p=>{throw new Error("contextSrv can be only overridden in test environment")}},6872:(j,I,e)=>{"use strict";e.d(I,{Z:()=>l});var t=e(89949),n=e.n(t),i=e(73289),s=e(12308),r=e(56812);class g{constructor(){}addDashboardImpression(o){const m=this.impressionKey();let c=[];r.Z.exists(m)&&(c=JSON.parse(r.Z.get(m)),(0,t.isArray)(c)||(c=[])),c=c.filter(p=>o!==p),c.unshift(o),c.length>50&&c.pop(),r.Z.set(m,JSON.stringify(c))}async convertToUIDs(){let o=this.getImpressions();const m=(0,t.filter)(o,p=>(0,t.isNumber)(p));if(!m.length)return;const c=await(0,i.i)().get(`/api/dashboards/ids/${m.join(",")}`);r.Z.set(this.impressionKey(),JSON.stringify([...(0,t.filter)(o,p=>(0,t.isString)(p)),...c]))}getImpressions(){const o=r.Z.get(this.impressionKey())||"[]";return JSON.parse(o)}async getDashboardOpened(){try{await this.convertToUIDs()}catch{}return(0,t.filter)(this.getImpressions(),m=>(0,t.isString)(m))}impressionKey(){return"dashboard_impressions-"+s.default.bootData.user.orgId}}const l=new g},70828:(j,I,e)=>{"use strict";e.d(I,{L:()=>d,X:()=>l});var t=e(11391),n=e(32713),i=e(5933),s=e(12308),r=e(66574),g=e(97662);async function d(u,o){const m=s.config.theme2,c=(0,t.j)(u);if(i.Z.publish(new n.hD(c)),m.colors.mode!==c.colors.mode){const E=document.createElement("link");E.rel="stylesheet",E.href=s.config.bootData.themePaths[c.colors.mode],E.onload=()=>{const h=document.getElementsByTagName("link");for(let y=0;y<h.length;y++){const v=h[y];v.href&&v.href.includes(`build/grafana.${m.colors.mode}`)&&v.remove()}},document.head.insertBefore(E,document.head.firstChild)}if(o||!r.Vt.isSignedIn)return;const p=new g.y("user"),f=await p.load();await p.update({...f,theme:c.colors.mode})}async function l(u){const o=s.config.theme2;d(o.isDark?"light":"dark",u)}},56812:(j,I,e)=>{"use strict";e.d(I,{Z:()=>i});class t{get(r){return window.localStorage[r]}set(r,g){window.localStorage[r]=g}getBool(r,g){return g!==void 0&&!this.exists(r)?g:window.localStorage[r]==="true"}getObject(r,g){let d=g;if(this.exists(r)){const l=window.localStorage[r];try{d=JSON.parse(l)}catch(u){console.error(`Error parsing store object: ${r}. Returning default: ${g}. [${u}]`)}}return d}setObject(r,g){let d;try{d=JSON.stringify(g)}catch(l){throw new Error(`Could not stringify object: ${r}. [${l}]`)}try{this.set(r,d)}catch(l){const u=new Error(`Could not save item in localStorage: ${r}. [${l}]`);throw l instanceof Error&&(u.name=l.name),u}return!0}exists(r){return window.localStorage[r]!==void 0}delete(r){window.localStorage.removeItem(r)}}const i=new t},7999:(j,I,e)=>{"use strict";e.d(I,{W:()=>l,Z:()=>u});var t=e(89949),n=e.n(t),i=e(95676),s=e(21609);function r(o,m){if(!o)return!1;if(o[0]==="/"){const c=(0,i.jO)(o);return m.match(c)!=null}return o===m}function g(o){return o===0?.001:o/10}function d(o){return o?{colors:[{opacity:0},{opacity:o/10}]}:null}function l(o,m,c){for(let p=0;p<o.length;p++){const f=o[p],E=m.yaxes,h=f.yaxis||1,y=E[h-1],v=(0,s.Cf)(y.format);(0,t.isNumber)(m.decimals)?f.updateLegendValues(v,m.decimals):(0,t.isNumber)(y.decimals)?f.updateLegendValues(v,y.decimals+1):f.updateLegendValues(v,null)}}class u{constructor(m){this.datapoints=m.datapoints,this.label=m.alias,this.id=m.alias,this.alias=m.alias,this.aliasEscaped=(0,t.escape)(m.alias),this.color=m.color,this.bars={fillColor:m.color},this.valueFormater=(0,s.Cf)("none"),this.stats={},this.legend=!0,this.unit=m.unit,this.dataFrameIndex=m.dataFrameIndex,this.fieldIndex=m.fieldIndex,this.hasMsResolution=this.isMsResolutionNeeded()}applySeriesOverrides(m){this.lines={},this.dashes={dashLength:[]},this.points={},this.yaxis=1,this.zindex=0,this.nullPointMode=null,delete this.stack,delete this.bars.show;for(let c=0;c<m.length;c++){const p=m[c];r(p.alias,this.alias)&&(p.lines!==void 0&&(this.lines.show=p.lines),p.dashes!==void 0&&(this.dashes.show=p.dashes,this.lines.lineWidth=0),p.points!==void 0&&(this.points.show=p.points),p.bars!==void 0&&(this.bars.show=p.bars),p.fill!==void 0&&(this.lines.fill=g(p.fill)),p.fillGradient!==void 0&&(this.lines.fillColor=d(p.fillGradient)),p.stack!==void 0&&(this.stack=p.stack),p.linewidth!==void 0&&(this.lines.lineWidth=this.dashes.show?0:p.linewidth,this.dashes.lineWidth=p.linewidth),p.dashLength!==void 0&&(this.dashes.dashLength[0]=p.dashLength),p.spaceLength!==void 0&&(this.dashes.dashLength[1]=p.spaceLength),p.nullPointMode!==void 0&&(this.nullPointMode=p.nullPointMode),p.pointradius!==void 0&&(this.points.radius=p.pointradius),p.steppedLine!==void 0&&(this.lines.steps=p.steppedLine),p.zindex!==void 0&&(this.zindex=p.zindex),p.fillBelowTo!==void 0&&(this.fillBelowTo=p.fillBelowTo),p.color!==void 0&&this.setColor(p.color),p.transform!==void 0&&(this.transform=p.transform),p.legend!==void 0&&(this.legend=p.legend),p.hideTooltip!==void 0&&(this.hideTooltip=p.hideTooltip),p.yaxis!==void 0&&(this.yaxis=p.yaxis),p.hiddenSeries!==void 0&&(this.hiddenSeries=p.hiddenSeries))}}getFlotPairs(m){const c=[];this.stats.total=0,this.stats.max=-Number.MAX_VALUE,this.stats.min=Number.MAX_VALUE,this.stats.logmin=Number.MAX_VALUE,this.stats.avg=null,this.stats.current=null,this.stats.first=null,this.stats.delta=0,this.stats.diff=null,this.stats.diffperc=0,this.stats.range=null,this.stats.timeStep=Number.MAX_VALUE,this.allIsNull=!0,this.allIsZero=!0;const p=m==="connected",f=m==="null as zero";let E,h,y=0,v,D=0,a=!0;for(let C=0;C<this.datapoints.length;C++){if(h=this.datapoints[C][0],E=this.datapoints[C][1],v!==void 0){const P=E-v;P<this.stats.timeStep&&(this.stats.timeStep=P)}if(v=E,h===null){if(p)continue;f&&(h=0)}h!==null&&((0,t.isNumber)(h)&&(this.stats.total+=h,this.allIsNull=!1,y++),h>this.stats.max&&(this.stats.max=h),h<this.stats.min&&(this.stats.min=h),this.stats.first===null?this.stats.first=h:D>h?(a=!1,C===this.datapoints.length-1&&(this.stats.delta+=h)):(a?this.stats.delta+=h-D:this.stats.delta+=h,a=!0),D=h,h<this.stats.logmin&&h>0&&(this.stats.logmin=h),h!==0&&(this.allIsZero=!1)),c.push([E,h])}return this.stats.max===-Number.MAX_VALUE&&(this.stats.max=null),this.stats.min===Number.MAX_VALUE&&(this.stats.min=null),c.length&&!this.allIsNull&&(this.stats.avg=this.stats.total/y,this.stats.current=c[c.length-1][1],this.stats.current===null&&c.length>1&&(this.stats.current=c[c.length-2][1])),this.stats.max!==null&&this.stats.min!==null&&(this.stats.range=this.stats.max-this.stats.min),this.stats.current!==null&&this.stats.first!==null&&(this.stats.diff=this.stats.current-this.stats.first,this.stats.diffperc=this.stats.diff/this.stats.first),this.stats.count=c.length,c}updateLegendValues(m,c){this.valueFormater=m,this.decimals=c}formatValue(m){return(0,t.isFinite)(m)||(m=null),(0,s.zc)(this.valueFormater(m,this.decimals))}isMsResolutionNeeded(){for(let m=0;m<this.datapoints.length;m++)if(this.datapoints[m][1]!==null&&this.datapoints[m][1]!==void 0){const c=this.datapoints[m][1].toString();if(c.length===13&&c%1e3!==0)return!0}return!1}hideFromLegend(m){return!!(m.hideEmpty&&this.allIsNull||!this.legend||m.hideZero&&this.allIsZero)}setColor(m){this.color=m,this.bars.fillColor=m}}},94547:(j,I,e)=>{"use strict";e.d(I,{E:()=>u,f:()=>l});var t=e(27702),n=e(57704),i=e(32713),s=e(34667),r=e(66310),g=e(66574),d=e(42869);const l=({children:o,value:m})=>{const[c,p]=(0,t.useState)(m);return(0,t.useEffect)(()=>{const f=g.h$.subscribe(i.hD,E=>{s.config.theme2=E.payload,p(E.payload)});return()=>f.unsubscribe()},[]),t.createElement(r.Ni.Provider,{value:c},t.createElement(n.y,{baseColor:c.colors.background.secondary,highlightColor:c.colors.emphasize(c.colors.background.secondary),borderRadius:c.shape.borderRadius()},o))},u=(o,m)=>function(p){return t.createElement(l,{value:m},t.createElement(o,{...p}))}},42575:(j,I,e)=>{"use strict";e.d(I,{q:()=>t});class t extends window.Worker{constructor(i,s){const r=i.toString(),g=r.split("/");g.pop();const d=`${g.join("/")}/`,l=`importScripts('${r}');`,u=URL.createObjectURL(new Blob([`__webpack_worker_public_path__ = '${d}'; ${l}`],{type:"application/javascript"}));super(u,s),URL.revokeObjectURL(u)}}},92317:(j,I,e)=>{"use strict";e.d(I,{y:()=>n});var t=e(12308);function n(i={}){return t.default.rbacEnabled?{...i,accesscontrol:!0}:i}},58198:(j,I,e)=>{"use strict";e.d(I,{A:()=>t});function t(i){return i.map(n).sort((s,r)=>r.sortRank-s.sortRank||s.name.localeCompare(r.name))}function n(i){const s=i;return s.sortRank=0,s.userId>0?(s.name=s.userLogin,s.sortRank=10):s.teamId>0?(s.name=s.team,s.sortRank=20):s.role&&(s.icon="fa fa-fw fa-street-view",s.name=s.role,s.sortRank=30,s.role==="Editor"&&(s.sortRank+=1)),s.inherited&&(s.sortRank+=100),s}},69513:(j,I,e)=>{"use strict";e.d(I,{R:()=>t});const t=(n,i,s)=>(n.splice(s,0,n.splice(i,1)[0]),n)},72625:(j,I,e)=>{"use strict";e.d(I,{vl:()=>i});function t(){const s=navigator.userAgent.indexOf("MSIE")>-1,r=navigator.userAgent.indexOf("Edge/")>-1||navigator.userAgent.indexOf("Edg/")>-1,g=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,d=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),l=/Edge\/([0-9.]+)/.exec(navigator.userAgent);return s&&parseFloat(/Trident\/([0-9.]+)/.exec(navigator.userAgent)[1])<=7||r&&(l&&parseFloat(l[1])<=16||parseFloat(/Edg\/([0-9.]+)/.exec(navigator.userAgent)[1])<=16)||g&&parseFloat(/Firefox\/([0-9.]+)/.exec(navigator.userAgent)[1])<=64?!1:!(d&&parseFloat(/Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1])<=54)}function n(){return/(iPhone|iPad|Mac)/.test(navigator.platform)}function i(){return n()?"cmd":"ctrl"}},2567:(j,I,e)=>{"use strict";e.d(I,{kJ:()=>i});class t{_linkTo(d,l){l<=0&&d.inputEdges.push(this),l>=0&&d.outputEdges.push(this),d.edges.push(this)}link(d,l){if(!d)throw Error("inputNode is required");if(!l)throw Error("outputNode is required");return this.unlink(),this.inputNode=d,this.outputNode=l,this._linkTo(d,1),this._linkTo(l,-1),this}unlink(){let d;const l=this.inputNode,u=this.outputNode;l&&u&&(d=l.edges.indexOf(this),d>-1&&l.edges.splice(d,1),d=u.edges.indexOf(this),d>-1&&u.edges.splice(d,1),d=l.outputEdges.indexOf(this),d>-1&&l.outputEdges.splice(d,1),d=u.inputEdges.indexOf(this),d>-1&&u.inputEdges.splice(d,1))}}class n{constructor(d){this.name=d,this.edges=[],this.inputEdges=[],this.outputEdges=[]}getEdgeFrom(d){return d?typeof d=="object"?this.inputEdges.find(l=>l.inputNode?.name===d.name):this.inputEdges.find(l=>l.inputNode?.name===d):null}getEdgeTo(d){return d?typeof d=="object"?this.outputEdges.find(l=>l.outputNode?.name===d.name):this.outputEdges.find(l=>l.outputNode?.name===d):null}getOptimizedInputEdges(){const d=[];return this.inputEdges.forEach(l=>{l.inputNode?.inputEdges.map(o=>o.inputNode)?.forEach(o=>{const m=o?.getEdgeTo(this.name);m&&d.push(m)})}),this.inputEdges.filter(l=>d.indexOf(l)===-1)}}class i{constructor(){this.nodes={}}createNode(d){const l=new n(d);return this.nodes[d]=l,l}createNodes(d){const l=[];return d.forEach(u=>{l.push(this.createNode(u))}),l}link(d,l){let u=[],o=[];const m=[],c=[];d instanceof Array?u=d:u=[d],l instanceof Array?o=l:o=[l];for(let f=0;f<u.length;f++){const E=u[f];if(typeof E=="string"){const h=this.getNode(E);if(!h)throw Error(`cannot link input node named ${E} since it doesn't exist in graph`);m.push(h)}else m.push(E)}for(let f=0;f<o.length;f++){const E=o[f];if(typeof E=="string"){const h=this.getNode(E);if(!h)throw Error(`cannot link output node named ${E} since it doesn't exist in graph`);c.push(h)}else c.push(E)}const p=[];return m.forEach(f=>{c.forEach(E=>{p.push(this.createEdge().link(f,E))})}),p}descendants(d){if(!d.length)return new Set;const l=new Set(r(d)?d.map(u=>this.nodes[u]).filter(u=>u!==void 0):d);return this.descendantsRecursive(l)}descendantsRecursive(d,l=new Set){for(const u of d){const o=new Set;for(const{inputNode:m}of u.inputEdges)m&&!l.has(m)&&(l.add(m),o.add(m));this.descendantsRecursive(o,l)}return l}createEdge(){return new t}getNode(d){return this.nodes[d]}}const s=g=>{Object.keys(g.nodes).forEach(d=>{const l=g.nodes[d];let u=l.outputEdges.map(m=>m.outputNode?.name).join(", ");u||(u="<none>");let o=l.inputEdges.map(m=>m.inputNode?.name).join(", ");o||(o="<none>"),console.log(`${l.name}: - links to: ${u} - links from: ${o}`)})};function r(g){return g.length>0&&typeof g[0]=="string"}},87241:(j,I,e)=>{"use strict";e.d(I,{i:()=>n});var t=e(73289);function n(i){if(typeof i=="string")return i;if(i){if(i instanceof Error)return i.message;if((0,t.kW)(i)){if(i.data&&i.data.message)return i.data.message;if(i.statusText)return i.statusText}}return JSON.stringify(i)}},89024:(j,I,e)=>{"use strict";e.d(I,{$$:()=>F,ET:()=>C,F3:()=>R,H6:()=>b,OQ:()=>k,Oy:()=>H,RZ:()=>_,Xh:()=>x,Xk:()=>B,Z8:()=>V,Zf:()=>M,_Q:()=>N,as:()=>S,fR:()=>A,n9:()=>Y,uC:()=>T,y_:()=>a,z0:()=>P,z_:()=>w});var t=e(34099),n=e(89949),i=e.n(n),s=e(66117),r=e(64167),g=e(78968),d=e(62247),l=e(8508),u=e(76305),o=e(10864),m=e(26862),c=e(56812),p=e(65946),f=e(12308),E=e(76897);const h={dedupStrategy:r.Y4.none},y=100,v="grafana.explore.datasource",D=X=>`${v}.${X}`,a=X=>c.Z.getObject(D(X)),C=(X,Q)=>c.Z.setObject(D(X),Q);function P(){return(0,t.x0)(3)}async function b(X){const{panel:Q,datasourceSrv:se,timeSrv:Z}=X;let le=await se.get(Q.datasource),oe=Q.targets.map(ne=>(0,n.omit)(ne,"legendFormat")).filter(ne=>ne.datasource?.uid!==p.Yq),q;if(le){let ge={range:Z.timeRangeForUrl()};if(le.interpolateVariablesInQueries){const re=Q.scopedVars||{};ge={...ge,datasource:le.uid,queries:le.interpolateVariablesInQueries(oe,re)}}else ge={...ge,datasource:le.uid,queries:oe};const ae=JSON.stringify({[P()]:ge});q=g.Cj.renderUrl("/explore",{panes:ae,schemaVersion:1})}return q}function M(X,Q,se,Z,le,oe){const q=Q.reduce((De,he)=>(De+=he.key,De),""),{interval:ne,intervalMs:ge}=G(Z,se.minInterval,se.maxDataPoints),ae=`${q}`,re={app:d.zj.Explore,timezone:oe||l.Ys,startTime:Date.now(),interval:ne,intervalMs:ge,panelId:ae,targets:Q,range:Z,requestId:"explore_"+X,rangeRaw:Z.raw,scopedVars:{__interval:{text:ne,value:ne},__interval_ms:{text:ge,value:ge}},maxDataPoints:se.maxDataPoints,liveStreaming:se.liveStreaming};return{queries:Q,request:re,scanning:le,id:O(),done:!1}}const T=({key:X,...Q})=>Q,S=X=>{if(X)try{return JSON.parse(X)}catch(Q){console.error(Q)}},x=(X,Q)=>{if(X==null)return"";try{return JSON.stringify(X,null,Q)}catch(se){console.error(se)}return""};function O(X=0){return`Q-${(0,s.Z)()}-${X}`}async function B(X,Q=0,se){let Z,le,oe;return se?le=se:X.length>0&&X[X.length-1].datasource?le=X[X.length-1].datasource:(Z=await(0,o.F)().get(),oe=Z.getDefaultQuery?.(d.zj.Explore),le=Z.getRef()),Z||(Z=await(0,o.F)().get(le),oe=Z.getDefaultQuery?.(d.zj.Explore)),{...oe,refId:(0,E.Hs)(X),key:O(Q),datasource:le}}const A=(X,Q,se=0)=>{const Z=O(se),le=X.refId||(0,E.Hs)(Q);return{...X,refId:le,key:Z}};async function V(X,Q){if(X&&typeof X=="object"&&X.length>0){const se=[];for(let Z=0;Z<X.length;Z++){const le=X[Z],oe=O(Z);let q=le.refId;q||(q=(0,E.Hs)(se));let ne=!0;if(le.datasource)try{await(0,o.F)().get(le.datasource.uid)}catch{console.error("One of the queries has a datasource that is no longer available and was removed."),ne=!1}ne&&se.push({...le,refId:q,key:oe})}return se}try{const se=Q??(await(0,o.F)().get()).getRef();return[await B(X??[],void 0,se)]}catch{return[]}}const W=["refId","key","context","datasource"];function w(X){return X&&X.some(Q=>Object.keys(Q).filter(Z=>W.indexOf(Z)===-1).map(Z=>Q[Z]).filter(Z=>Z).length>0)}function N(X,Q,se){const Z=Date.now();let le=X;se.forEach(q=>{le=[{query:q,ts:Z},...le]}),le.length>y&&(le=le.slice(0,y));const oe=`grafana.explore.history.${Q}`;try{return c.Z.setObject(oe,le),le}catch(q){return console.error(q),X}}const F=X=>X.reduce((se,Z,le)=>{const oe=Z.datasource?.uid||Z.key;return se.concat(`${oe}-${le}`)},[]),k=(X,Q,se)=>{let Z=u.convertRawToRange(Q,X,se);return Z.to.isBefore(Z.from)&&(Z=u.convertRawToRange({from:Z.raw.to,to:Z.raw.from},X,se)),Z},H=X=>m.dP.isLive(X)?r.UV.Ascending:r.UV.Descending,R=X=>{let se=`${window.location.protocol==="https:"?"wss://":"ws://"}${window.location.host}${f.config.appSubUrl}`;return se.endsWith("/")&&(se=se.slice(0,-1)),`${se}${X}`},_=X=>{X&&X.unsubscribe()};function G(X,Q,se){return se?u.calculateInterval(X,se,Q):{interval:"1s",intervalMs:1e3}}const Y=X=>{const Q=document.createElement("textarea");Q.value=X,document.body.appendChild(Q),Q.select(),document.execCommand("copy"),document.body.removeChild(Q)}},26631:(j,I,e)=>{"use strict";e.d(I,{Xv:()=>h,aO:()=>f,nS:()=>s,rZ:()=>c,tW:()=>E});var t=e(89949),n=e.n(t),i=e(58939);const s=v=>{const D=v.method,a=m(v),C=c(a),P=p(v,C),b=y(v);return{method:D,headers:a,body:P,credentials:b}},r={canParse:()=>!0,parse:v=>(v.get("accept")||v.set("accept","application/json, text/plain, */*"),v)},g=v=>({canParse:D=>(D?.method?D?.method.toLowerCase():"")===v,parse:D=>(D.get("content-type")||D.set("content-type","application/json"),D)}),d=g("post"),l=g("put"),u=g("patch"),o=[d,l,u,r],m=v=>{const D=v?.headers?new Headers(v.headers):new Headers;return o.filter(P=>P.canParse(v)).reduce((P,b)=>b.parse(P),D)},c=v=>{if(!v)return!1;const D=v.get("content-type");return!!(D&&D.toLowerCase()==="application/json")},p=(v,D)=>v&&(!v.data||typeof v.data=="string"||v.data instanceof Blob?v.data:D?JSON.stringify(v.data):new URLSearchParams(v.data));async function f(v,D){if(D)switch(D){case"arraybuffer":return v.arrayBuffer();case"blob":return v.blob();case"json":return v.headers.get("Content-Length")==="0"?(console.warn(`${v.url} returned an invalid JSON`),{}):await v.json();case"text":return v.text()}const a=await v.text();try{return JSON.parse(a)}catch{}return a}function E(v){return Object.keys(v).map(D=>{const a=v[D];return Array.isArray(a)?a.map(C=>`${encodeURIComponent(D)}=${encodeURIComponent(C)}`).join("&"):`${encodeURIComponent(D)}=${encodeURIComponent(a)}`}).join("&")}const h=v=>{const D=(0,t.omitBy)(v.params,C=>C===void 0||C&&C.length===0),a=E(D);return v.params&&a.length?`${v.url}?${a}`:v.url},y=v=>v&&(v.credentials?v.credentials:v.withCredentials?((0,i.d)("BackendSrvRequest","withCredentials","credentials"),"include"):"same-origin")},44380:(j,I,e)=>{"use strict";e.r(I),e.d(I,{default:()=>t});function t(n,i){i=i||{};const s=i.delimiter||".";let r=i.maxDepth||3,g=1;const d={};function l(u,o){Object.keys(u).forEach(m=>{const c=u[m],p=i?.safe&&Array.isArray(c),E=Object.prototype.toString.call(c)==="[object Object]",h=o?o+s+m:m;if(i?.maxDepth||(r=g+1),!p&&E&&Object.keys(c).length&&g<r)return++g,l(c,h);d[h]=c})}return l(n,null),d}},13216:(j,I,e)=>{"use strict";e.d(I,{Z:()=>d});var t=e(58939),n=e(95676),i=e(76305),s=e(21609);const g={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.d)("kbn.ts","kbn.regexEscape()","escapeRegex from @grafana/data"),(0,n.yI)(l)),roundInterval:l=>((0,t.d)("kbn.ts","kbn.roundInterval()","@grafana/data"),i.roundInterval(l)),secondsToHms:l=>((0,t.d)("kbn.ts","kbn.secondsToHms()","@grafana/data"),i.secondsToHms(l)),secondsToHhmmss:l=>{const u=[],o=Math.floor(l/3600),m=Math.floor(l%3600/60),c=Math.floor(l%3600%60);return o>9?u.push(""+o):u.push("0"+o),m>9?u.push(""+m):u.push("0"+m),c>9?u.push(""+c):u.push("0"+c),u.join(":")},toPercent:(l,u)=>Math.floor(l/u*1e4)/100+"%",addSlashes:l=>l.replace(/[\'\"\\0]/g,"\\$&"),describeInterval:l=>((0,t.d)("kbn.ts","kbn.describeInterval()","@grafana/data"),i.describeInterval(l)),intervalToSeconds:l=>((0,t.d)("kbn.ts","rangeUtil.intervalToSeconds()","@grafana/data"),i.intervalToSeconds(l)),intervalToMs:l=>((0,t.d)("kbn.ts","rangeUtil.intervalToMs()","@grafana/data"),i.intervalToMs(l)),calculateInterval:(l,u,o)=>((0,t.d)("kbn.ts","kbn.calculateInterval()","@grafana/data"),i.calculateInterval(l,u,o)),queryColorDot:(l,u)=>'<div class="icon-circle" style="'+["display:inline-block","color:"+l,"font-size:"+u+"px"].join(";")+'"></div>',slugifyForUrl:l=>l.toLowerCase().replace(/[^\w ]+/g,"").replace(/ +/g,"-"),stringToJsRegex:l=>((0,t.d)("kbn.ts","kbn.stringToJsRegex()","@grafana/data"),(0,n.jO)(l)),toFixed:(l,u)=>{if(l===null)return"";const o=u?Math.pow(10,Math.max(0,u)):1,m=String(Math.round(l*o)/o);if(m.indexOf("e")!==-1||l===0)return m;if(u!=null){const c=m.indexOf("."),p=c===-1?0:m.length-c-1;if(p<u)return(p?m:m+".")+String(o).slice(1,u-p+1)}return m},toFixedScaled:(l,u,o,m,c)=>o===null?g.toFixed(l,u)+c:g.toFixed(l,o+m)+c,roundValue:(l,u)=>{if(l===null)return null;const o=Math.pow(10,u),m=(o*l).toFixed(u);return Math.round(parseFloat(m))/o},getUnitFormats:s.QW};typeof Proxy<"u"?g.valueFormats=new Proxy(g.valueFormats,{get(l,u,o){if(typeof u!="string")throw{message:`Value format ${String(u)} is not a string`};const m=(0,s.Cf)(u);return m?(c,p,f,E)=>(0,s.zc)(m(c,p,f,E?"utc":"browser")):Reflect.get(l,u,o)}}):g.valueFormats=(0,s.Td)();const d=g},76897:(j,I,e)=>{"use strict";e.d(I,{DI:()=>i,Hs:()=>t,R8:()=>r,mu:()=>s,sB:()=>d,vH:()=>n});const t=l=>{for(let u=0;;u++){const o=g(u);if(!l.some(m=>m.refId===o))return o}};function n(l){const u=["refId","hide","key","queryType","datasource"];for(const o in l)if(o!=="label"&&!u.includes(o))return!1;return!0}function i(l,u,o){const m=u||{};return m.refId=t(l),m.hide=!1,!m.datasource&&o&&(m.datasource=o),[...l,m]}function s(l){return l.indexOf("api/datasources/proxy")!==-1||l.indexOf("api/ds/query")!==-1}function r(l){return!l.match(/^http/)}function g(l){const u="ABCDEFGHIJKLMNOPQRSTUVWXYZ";return l<u.length?u[l]:g(Math.floor(l/u.length)-1)+u[l%u.length]}function d(l){return l||void 0}},87715:(j,I,e)=>{"use strict";e.d(I,{As:()=>m.A,DR:()=>x,HK:()=>h,OH:()=>T,VI:()=>y,au:()=>c,bQ:()=>C,di:()=>E,gt:()=>v,k4:()=>S,kg:()=>f,t2:()=>a,ub:()=>p,y9:()=>D});var t=e(89949),n=e.n(t),i=e(78968),s=e(60956),r=e(10864),g=e(33877),d=e(73807),l=e(84749),u=e(19484),o=e(19889),m=e(7990);async function c(B,A,V,W,w,N,F){const k=V&&V.filter(H=>O(H));if(k.length>0){let H=!1,R=!1,_;try{_=(await(0,o.b)().addToRichHistory({datasourceUid:B,datasourceName:A??"",queries:k,starred:W,comment:w??""})).warning}catch(G){return G instanceof Error&&(G.name===u.j.StorageFull?(H=!0,N&&(0,l.WI)((0,g.$l)((0,d.t_)(G.message)))):G.name!==u.j.DuplicatedEntry&&(0,l.WI)((0,g.$l)((0,d.t_)("Rich History update failed",G.message)))),{richHistoryStorageFull:H,limitExceeded:R}}return _&&_.type===u.V.LimitExceeded&&(R=!0,F&&(0,l.WI)((0,g.$l)((0,d.ZR)(_.message)))),{richHistoryStorageFull:H,limitExceeded:R}}return{}}async function p(B){return await(0,o.b)().getRichHistory(B)}async function f(B){await(0,o.b)().updateSettings(B)}async function E(){return await(0,o.b)().getSettings()}async function h(){return(0,o.b)().deleteAll()}async function y(B,A){try{return await(0,o.b)().updateStarred(B,A)}catch(V){V instanceof Error&&(0,l.WI)((0,g.$l)((0,d.t_)("Saving rich history failed",V.message)));return}}async function v(B,A){try{return await(0,o.b)().updateComment(B,A)}catch(V){V instanceof Error&&(0,l.WI)((0,g.$l)((0,d.t_)("Saving rich history failed",V.message)));return}}async function D(B){try{return await(0,o.b)().deleteRichHistory(B),B}catch(A){A instanceof Error&&(0,l.WI)((0,g.$l)((0,d.t_)("Saving rich history failed",A.message)));return}}const a=B=>{const A={range:{from:"now-1h",to:"now"},datasource:B.datasourceName,queries:B.queries},V=(0,i.S)(A),W=/.*(?=\/explore)/.exec(`${window.location.href}`)[0];return i.Cj.renderUrl(`${W}/explore`,{left:V})},C=B=>{let A;switch(B){case 0:A="today";break;case 1:A="yesterday";break;case 7:A="a week ago";break;case 14:A="two weeks ago";break;default:A=`${B} days ago`}return A};function P(B){return(0,s.dq)(B,{format:"MMMM D"})}function b(B){const A=(0,t.omit)(B,["key","refId","datasource"]);return JSON.stringify(A)}function M(B,A){let V="";return A===m.A.DatasourceAZ||A===m.A.DatasourceZA?V=B.datasourceName:V=P(B.createdAt),V}function T(B,A){return A?.getQueryDisplayText?A.getQueryDisplayText(B):b(B)}function S(B,A){let V={};return B.forEach(W=>{let w=M(W,A);w in V?V[w]=[...V[w],W]:V[w]=[W]}),V}function x(){return(0,r.F)().getList({mixed:!0}).map(B=>({name:B.name,uid:B.uid}))}function O(B){const A=(0,t.omit)(B,["key","refId","datasource"]);return Object.keys(A).length>0}},7990:(j,I,e)=>{"use strict";e.d(I,{A:()=>t});var t=(n=>(n.Descending="Descending",n.Ascending="Ascending",n.DatasourceAZ="Datasource A-Z",n.DatasourceZA="Datasource Z-A",n))(t||{})},82146:(j,I,e)=>{"use strict";e.d(I,{D:()=>o,L:()=>m});var t=e(82152),n=e(34667),i=e(73289),s=e(33877),r=e(73807),g=e(84749),d=e(89024);function l(){return`${window.location.protocol}//${window.location.host}${n.config.appSubUrl}`}function u(c){let p=c.replace(l(),"");return p.startsWith("/")?p.substring(1,p.length):p}const o=(0,t.Z)(async function(c){try{return(await(0,i.i)().post("/api/short-urls",{path:u(c)})).url}catch(p){console.error("Error when creating shortened link: ",p),(0,g.WI)((0,s.$l)((0,r.t_)("Error generating shortened link")))}}),m=async c=>{const p=await o(c);p?((0,d.n9)(p),(0,g.WI)((0,s.$l)((0,r.AT)("Shortened link copied to clipboard")))):(0,g.WI)((0,s.$l)((0,r.t_)("Error generating shortened link")))}},86628:(j,I,e)=>{"use strict";e.r(I),e.d(I,{getFlotRange:()=>s,getFlotTickDecimals:()=>r,getFlotTickSize:()=>i,getPrecision:()=>l,getScaledDecimals:()=>n,getStringPrecision:()=>u,grafanaTimeFormat:()=>g,logp:()=>d,tickStep:()=>t});function t(o,m,c){const p=Math.sqrt(50),f=Math.sqrt(10),E=Math.sqrt(2),h=Math.abs(m-o)/Math.max(0,c);let y=Math.pow(10,Math.floor(Math.log(h)/Math.LN10));const v=h/y;return v>=p?y*=10:v>=f?y*=5:v>=E&&(y*=2),m<o?-y:y}function n(o,m){return o-Math.floor(Math.log(m)/Math.LN10)}function i(o,m,c,p){const f=(m-o)/c;let E=-Math.floor(Math.log(f)/Math.LN10);const h=p,y=Math.pow(10,-E),v=f/y;let D;return v<1.5?D=1:v<3?(D=2,v>2.25&&(h==null||E+1<=h)&&(D=2.5,++E)):v<7.5?D=5:D=10,D*=y,D}function s(o,m,c,p){let E=+(o??c),h=+(m??p);const y=h-E;if(y===0){const D=Math.abs(h===0?1:h*.25);o===null&&(E-=D),(m==null||o!=null)&&(h+=D)}else o==null&&(E-=y*.02,E<0&&c!=null&&c>=0&&(E=0)),m==null&&(h+=y*.02,h>0&&p!=null&&p<=0&&(h=0));return{min:E,max:h}}function r(o,m,c,p){const{min:f,max:E}=s(c.min,c.max,o,m),h=.3*Math.sqrt(p),y=(E-f)/h,v=-Math.floor(Math.log(y)/Math.LN10),D=Math.pow(10,-v),a=y/D;let C;a<1.5?C=1:a<3?(C=2,a>2.25&&(C=2.5)):a<7.5?C=5:C=10,C*=D;const P=Math.max(0,-Math.floor(Math.log(y)/Math.LN10)+1),b=P-Math.floor(Math.log(C)/Math.LN10);return{tickDecimals:P,scaledDecimals:b}}function g(o,m,c){if(m&&c&&o){const p=c-m,f=p/o/1e3,E=864e5,h=31536e6;return f<=45?"HH:mm:ss":f<=7200||p<=E?"HH:mm":f<=8e4?"MM/DD HH:mm":f<=2419200||p<=h?"MM/DD":"YYYY-MM"}return"HH:mm"}function d(o,m){return Math.log(o)/Math.log(m)}function l(o){const m=o.toString();return u(m)}function u(o){if(isNaN(o))return 0;const m=o.indexOf(".");return m===-1?0:o.length-m-1}},15476:(j,I,e)=>{"use strict";e.d(I,{e:()=>n,h:()=>i});var t=e(99633);const n=(s,r)=>{const g={from:(0,t.zh)(r.from),to:(0,t.zh)(r.to)},d=(g.to.valueOf()-g.from.valueOf())/2;let l,u;return s===-1?(l=g.to.valueOf()-d,u=g.from.valueOf()-d):s===1?(l=g.to.valueOf()+d,u=g.from.valueOf()+d,l>Date.now()&&g.to.valueOf()<Date.now()&&(l=Date.now(),u=g.from.valueOf())):(l=g.to.valueOf(),u=g.from.valueOf()),{from:u,to:l}},i=(s,r)=>{const g=s.to.valueOf()-s.from.valueOf(),d=s.to.valueOf()-g/2,l=g===0?3e4:g*r,u=d+l/2;return{from:d-l/2,to:u}}},78526:(j,I,e)=>{"use strict";e.d(I,{q7:()=>n});var t=e(99633);function n(r,g){if(!(r.fromDayOfWeek||r.from)&&!(r.toDayOfWeek||r.to))return[];const d={...r};d.from&&!d.to&&(d.to=d.from),!d.from&&d.to&&(d.from=d.to);const l={from:i(d.from),to:i(d.to)};if(!d.fromDayOfWeek&&d.toDayOfWeek&&(d.fromDayOfWeek=d.toDayOfWeek),!d.toDayOfWeek&&d.fromDayOfWeek&&(d.toDayOfWeek=d.fromDayOfWeek),d.fromDayOfWeek&&(l.from.dayOfWeek=Number(d.fromDayOfWeek)),d.toDayOfWeek&&(l.to.dayOfWeek=Number(d.toDayOfWeek)),l.from.dayOfWeek&&l.from.h==null&&l.from.m==null&&(l.from.h=0,l.from.m=0,l.from.s=0),l.to.dayOfWeek&&l.to.h==null&&l.to.m==null&&(l.to.h=23,l.to.m=59,l.to.s=59),!l.from||!l.to)return[];l.from.h==null&&(l.from.h=0),l.to.h==null&&(l.to.h=23);const u=[],o=(0,t.CQ)(g.from).utc();for(o.set("hour",0),o.set("minute",0),o.set("second",0),o.set("millisecond",0),o.add(l.from.h,"hours"),o.add(l.from.m,"minutes"),o.add(l.from.s,"seconds");o.unix()<=g.to.unix();){for(;l.from.dayOfWeek&&l.from.dayOfWeek!==o.isoWeekday();)o.add(24,"hours");if(o.unix()>g.to.unix())break;const m=(0,t.CQ)(o).utc();if(m.hour)if(l.from.h<=l.to.h)m.add(l.to.h-l.from.h,"hours");else if(l.from.h>l.to.h)for(;m.hour()!==l.to.h;)m.add(1,"hours");else for(m.add(24-l.from.h,"hours");m.hour()!==l.to.h;)m.add(1,"hours");for(m.set("minute",l.to.m??0),m.set("second",l.to.s??0);l.to.dayOfWeek&&l.to.dayOfWeek!==m.isoWeekday();)m.add(24,"hours");o.unix()<g.from.unix()&&m.unix()<g.from.unix()||o.unix()>g.to.unix()&&m.unix()>g.to.unix()||u.push({from:o.valueOf(),to:m.valueOf()}),o.add(24,"hours")}return u}function i(r){const g={};if(!r?.length)return g;const d=r.split(":");return d?.length&&(g.h=Math.min(23,Math.max(0,Number(d[0]))),d.length>1&&(g.m=Math.min(60,Math.max(0,Number(d[1]))),d.length>2&&(g.s=Math.min(60,Math.max(0,Number(d[2])))))),g}function s(r){if(!r||r.h==null&&r.m==null&&r.s==null)return"";let g=String(r.h??0).padStart(2,"0")+":"+String(r.m??0).padStart(2,"0");return r.s!=null&&(g+=String(r.s??0).padStart(2,"0")),g}},43500:(j,I,e)=>{"use strict";e.d(I,{et:()=>s,fy:()=>g,nO:()=>r,np:()=>l});var t=e(72164),n=e(12503),i=e(29241);function s(u){return u.sort((m,c)=>m[0]-c[0]),u.reduce((m,c)=>{if(!m.length)return[c];const p=m.slice(-1)[0],[f,E]=p,[h,y]=c;return y<E?m:h>E?[...m,c]:[...m.slice(0,-1),[f,y]]},[]).reduce((m,c)=>m+(c[1]-c[0]),0)}function r(u){const o={};let m;for(let c=0;m=u(c),!!m;c++){o[m.id]?o[m.id].span=m.span:o[m.id]={span:m.span,children:[]};for(const p of m.parentIds)p&&(o[p]?o[p].children.push(m.id):o[p]={span:void 0,children:[m.id]})}return o}function g(u,o,m){return{main:`${d(u)}ms (${d(u/o*100)}%)`,secondary:`${d(m)}ms (${d(m/u*100)}%)`}}function d(u){return parseFloat(u.toFixed(2))}function l(){const u=new t.v({fields:[{name:n.z.id,type:i.fS.string},{name:n.z.title,type:i.fS.string},{name:n.z.subTitle,type:i.fS.string},{name:n.z.mainStat,type:i.fS.string,config:{displayName:"Total time (% of trace)"}},{name:n.z.secondaryStat,type:i.fS.string,config:{displayName:"Self time (% of total)"}},{name:n.z.color,type:i.fS.number,config:{color:{mode:"continuous-GrYlRd"},displayName:"Self time / Trace duration"}}],meta:{preferredVisualisationType:"nodeGraph"}}),o=new t.v({fields:[{name:n.z.id,type:i.fS.string},{name:n.z.target,type:i.fS.string},{name:n.z.source,type:i.fS.string}],meta:{preferredVisualisationType:"nodeGraph"}});return[u,o]}},59281:(j,I,e)=>{"use strict";e.d(I,{v:()=>n});let t="";const n=()=>{const s=new URLSearchParams(window.location.search).get("auth_token");return s!==null&&s!==""?(t=s,s):t}},8237:(j,I,e)=>{"use strict";e.d(I,{A:()=>g});var t=e(27702),n=e(50686),i=e(28580);const r=Object.values(n.B).filter(d=>d!==n.B.None).map(d=>({label:d,value:d}));function g({value:d,onChange:l,"aria-label":u,inputId:o,autoFocus:m,...c}){return t.createElement(i.Ph,{inputId:o,value:d,options:r,onChange:p=>l(p.value),placeholder:"Choose role...","aria-label":u,autoFocus:m,...c})}},64544:(j,I,e)=>{"use strict";e.d(I,{B9:()=>h,CP:()=>O,Dx:()=>y,Fm:()=>S,IS:()=>W,Jk:()=>P,M6:()=>H,Nq:()=>f,PK:()=>c,R5:()=>k,V0:()=>V,Xx:()=>D,Y3:()=>B,_1:()=>T,bN:()=>C,b_:()=>A,h8:()=>v,j4:()=>x,oO:()=>R,tQ:()=>E,uV:()=>b,uh:()=>N});var t=e(89949),n=e.n(t),i=e(60956),s=e(80978),r=e(73289),g=e(26129),d=e(12308),l=e(66574),u=e(92317),o=e(18771),m=e(90805);function c(_){return async G=>{try{G((0,m.UA)(!1)),await G(p(_)),await G(a(_)),await G(M(_)),d.default.ldapEnabled&&(0,s.v)("ldapsync")&&await G(x()),G((0,m.UA)(!0))}catch(Y){if(console.error(Y),(0,r.kW)(Y)){const X={title:Y.data.message,body:Y.data.error};G((0,m.sL)(X))}}}}function p(_){return async G=>{const Y=await(0,r.i)().get(`/api/users/${_}`,(0,u.y)());G((0,m.pm)(Y))}}function f(_){return async G=>{await(0,r.i)().put(`/api/users/${_.id}`,_),G(c(_.id))}}function E(_,G){return async Y=>{const X={password:G};await(0,r.i)().put(`/api/admin/users/${_}/password`,X),Y(c(_))}}function h(_){return async G=>{await(0,r.i)().post(`/api/admin/users/${_}/disable`),g.E1.push("/admin/users")}}function y(_){return async G=>{await(0,r.i)().post(`/api/admin/users/${_}/enable`),G(c(_))}}function v(_){return async G=>{await(0,r.i)().delete(`/api/admin/users/${_}`),g.E1.push("/admin/users")}}function D(_,G){return async Y=>{const X={isGrafanaAdmin:G};await(0,r.i)().put(`/api/admin/users/${_}/permissions`,X),Y(c(_))}}function a(_){return async G=>{const Y=await(0,r.i)().get(`/api/users/${_}/orgs`);G((0,m.fm)(Y))}}function C(_,G,Y){return async X=>{const Q={loginOrEmail:_.login,role:Y};await(0,r.i)().post(`/api/orgs/${G}/users/`,Q),X(c(_.id))}}function P(_,G,Y){return async X=>{const Q={role:Y};await(0,r.i)().patch(`/api/orgs/${G}/users/${_}`,Q),X(c(_))}}function b(_,G){return async Y=>{await(0,r.i)().delete(`/api/orgs/${G}/users/${_}`),Y(c(_))}}function M(_){return async G=>{if(!l.Vt.hasPermission(o.AccessControlAction.UsersAuthTokenList))return;const Y=await(0,r.i)().get(`/api/admin/users/${_}/auth-tokens`);Y.reverse();const X=Y.map(Q=>({id:Q.id,isActive:Q.isActive,seenAt:(0,i.E8)(Q.seenAt),createdAt:Q.createdAt,clientIp:Q.clientIp,browser:Q.browser,browserVersion:Q.browserVersion,os:Q.os,osVersion:Q.osVersion,device:Q.device}));G((0,m.RC)(X))}}function T(_,G){return async Y=>{const X={authTokenId:_};await(0,r.i)().post(`/api/admin/users/${G}/revoke-auth-token`,X),Y(M(G))}}function S(_){return async G=>{await(0,r.i)().post(`/api/admin/users/${_}/logout`),G(M(_))}}function x(){return async _=>{const G=l.Vt.hasPermission(o.AccessControlAction.LDAPStatusRead);if((0,s.v)("ldapsync")&&G){const Y=await(0,r.i)().get("/api/admin/ldap-sync-status");_((0,m.CY)(Y))}}}function O(_){return async G=>{await(0,r.i)().post(`/api/admin/ldap/sync/${_}`),G(c(_))}}function B(){return async _=>{if(l.Vt.hasPermission(o.AccessControlAction.LDAPStatusRead))try{const G=await(0,r.i)().get("/api/admin/ldap/status");_((0,m.Ls)(G))}catch(G){if((0,r.kW)(G)){G.isHandled=!0;const Y={title:G.data.message,body:G.data.error};_((0,m.y3)(Y))}}}}function A(_){return async G=>{try{const Y=await(0,r.i)().get(`/api/admin/ldap/${encodeURIComponent(_)}`),{name:X,surname:Q,email:se,login:Z,isGrafanaAdmin:le,isDisabled:oe,roles:q,teams:ne}=Y,ge={info:{name:X,surname:Q,email:se,login:Z},permissions:{isGrafanaAdmin:le,isDisabled:oe},roles:q,teams:ne};G((0,m.sJ)(ge))}catch(Y){if((0,r.kW)(Y)){Y.isHandled=!0;const X={title:Y.data.message,body:Y.data.error};G((0,m.eq)()),G((0,m.VB)(X))}}}}function V(){return _=>{_((0,m.WO)())}}function W(){return _=>{_((0,m.WO)()),_((0,m.eq)())}}const w=_=>_.map(G=>Array.isArray(G.value)?G.value.map(Y=>`${G.name}=${Y.value}`).join("&"):`${G.name}=${G.value}`).join("&");function N(){return async(_,G)=>{try{const{perPage:Y,page:X,query:Q,filters:se}=G().userListAdmin,Z=await(0,r.i)().get(`/api/users/search?perpage=${Y}&page=${X}&query=${Q}&${w(se)}`);_((0,m.xh)(Z))}catch(Y){(0,m.k7)(),console.error(Y)}}}const F=(0,t.debounce)(_=>_(N()),500);function k(_){return async G=>{G((0,m.tZ)()),G((0,m.aj)(_)),F(G)}}function H(_){return async G=>{G((0,m.tZ)()),G((0,m.qz)(_)),F(G)}}function R(_){return async G=>{G((0,m.tZ)()),G((0,m.PJ)(_)),G(N())}}},90805:(j,I,e)=>{"use strict";e.d(I,{CY:()=>l,Ls:()=>g,PJ:()=>S,RC:()=>h,UA:()=>y,VB:()=>u,WO:()=>s,ZP:()=>B,aj:()=>T,eq:()=>r,fm:()=>E,k7:()=>M,pm:()=>f,qz:()=>x,sJ:()=>o,sL:()=>v,tZ:()=>b,xh:()=>P,y3:()=>d});var t=e(34099);const n={connectionInfo:[],syncInfo:void 0,user:void 0,connectionError:void 0,userError:void 0},i=(0,t.oM)({name:"ldap",initialState:n,reducers:{ldapConnectionInfoLoadedAction:(A,V)=>({...A,ldapError:void 0,connectionInfo:V.payload}),ldapFailedAction:(A,V)=>({...A,ldapError:V.payload}),ldapSyncStatusLoadedAction:(A,V)=>({...A,syncInfo:V.payload}),userMappingInfoLoadedAction:(A,V)=>({...A,user:V.payload,userError:void 0}),userMappingInfoFailedAction:(A,V)=>({...A,user:void 0,userError:V.payload}),clearUserMappingInfoAction:(A,V)=>({...A,user:void 0}),clearUserErrorAction:(A,V)=>({...A,userError:void 0})}}),{clearUserErrorAction:s,clearUserMappingInfoAction:r,ldapConnectionInfoLoadedAction:g,ldapFailedAction:d,ldapSyncStatusLoadedAction:l,userMappingInfoFailedAction:u,userMappingInfoLoadedAction:o}=i.actions,m=i.reducer,c={user:void 0,sessions:[],orgs:[],isLoading:!0,error:void 0},p=(0,t.oM)({name:"userAdmin",initialState:c,reducers:{userProfileLoadedAction:(A,V)=>({...A,user:V.payload}),userOrgsLoadedAction:(A,V)=>({...A,orgs:V.payload}),userSessionsLoadedAction:(A,V)=>({...A,sessions:V.payload}),userAdminPageLoadedAction:(A,V)=>({...A,isLoading:!V.payload}),userAdminPageFailedAction:(A,V)=>({...A,error:V.payload,isLoading:!1})}}),{userProfileLoadedAction:f,userOrgsLoadedAction:E,userSessionsLoadedAction:h,userAdminPageLoadedAction:y,userAdminPageFailedAction:v}=p.actions,D=p.reducer,a={users:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,filters:[{name:"activeLast30Days",value:!1}],isLoading:!1},C=(0,t.oM)({name:"userListAdmin",initialState:a,reducers:{usersFetched:(A,V)=>{const{totalCount:W,perPage:w,...N}=V.payload,F=Math.ceil(W/w);return{...A,...N,totalPages:F,perPage:w,showPaging:F>1,isLoading:!1}},usersFetchBegin:A=>({...A,isLoading:!0}),usersFetchEnd:A=>({...A,isLoading:!1}),queryChanged:(A,V)=>({...A,query:V.payload,page:0}),pageChanged:(A,V)=>({...A,page:V.payload}),filterChanged:(A,V)=>{const{name:W,value:w}=V.payload;return A.filters.some(N=>N.name===W)?{...A,page:0,filters:A.filters.map(N=>N.name===W?{...N,value:w}:N)}:{...A,page:0,filters:[...A.filters,V.payload]}}}}),{usersFetched:P,usersFetchBegin:b,usersFetchEnd:M,queryChanged:T,pageChanged:S,filterChanged:x}=C.actions,O=C.reducer,B={ldap:m,userAdmin:D,userListAdmin:O}},41715:(j,I,e)=>{"use strict";e.d(I,{Yb:()=>n,d5:()=>s});var t=e(34667);const n=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function i(){const r=t.config.licenseInfo?.trialExpiry;return!!(r&&r>0)}const s=()=>i()&&t.config.featureToggles.featureHighlights},43609:(j,I,e)=>{"use strict";e.d(I,{$:()=>d,Z:()=>v});var t=e(89949),n=e.n(t),i=e(90135);const s=new i.zU({type:"query",params:[{name:"queryRefId",type:"string",dynamicLookup:!0},{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"]}),r=[{text:"Query",value:"query"}],g={alerting:1,firing:1,no_data:2,pending:3,ok:4,paused:5,inactive:5};var d=(D=>(D.IsAbove="gt",D.IsBelow="lt",D.IsOutsideRange="outside_range",D.IsWithinRange="within_range",D.HasNoValue="no_value",D))(d||{});const l=[{value:"gt",text:"IS ABOVE"},{value:"lt",text:"IS BELOW"},{value:"outside_range",text:"IS OUTSIDE RANGE"},{value:"within_range",text:"IS WITHIN RANGE"},{value:"no_value",text:"HAS NO VALUE"}],u=[{text:"OR",value:"or"},{text:"AND",value:"and"}],o=[{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"}],m=[{text:"Alerting",value:"alerting"},{text:"No Data",value:"no_data"},{text:"Keep Last State",value:"keep_state"},{text:"Ok",value:"ok"}],c=[{text:"Alerting",value:"alerting"},{text:"Keep Last State",value:"keep_state"}];function p(D){const a=new i.zU({type:D.type,defaultParams:[]});return new i.XN(D,a)}function f(D){return D.toLowerCase().replace(/_/g,"").split(" ")[0]}function E(D){switch(f(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"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 h(D,a){return(0,t.reduce)(D,(C,P)=>(P.metric!==void 0&&P.value!==void 0&&C.push(P.metric+"="+P.value),P.Metric!==void 0&&P.Value!==void 0&&C.push(P.Metric+"="+P.Value),C),[]).join(a)}function y(D){return(0,t.isArray)(D.data)?h(D.data,", "):(0,t.isArray)(D.data.evalMatches)?h(D.data.evalMatches,", "):D.data.error?"Error: "+D.data.error:""}const v={alertQueryDef:s,getStateDisplayModel:E,conditionTypes:r,evalFunctions:l,evalOperators:u,noDataModes:m,executionErrorModes:c,reducerTypes:o,createReducerPart:p,getAlertAnnotationInfo:y,alertStateSortScore:g}},90135:(j,I,e)=>{"use strict";e.d(I,{C7:()=>g,D:()=>r,XN:()=>s,zU:()=>i});var t=e(89949),n=e.n(t);class i{constructor(o){this.type=o.type,this.params=o.params,this.defaultParams=o.defaultParams,this.renderer=o.renderer,this.category=o.category,this.addStrategy=o.addStrategy}}class s{constructor(o,m){if(this.part=o,this.def=m,!this.def)throw{message:"Could not find query part "+o.type};o.params=o.params||(0,t.clone)(this.def.defaultParams),this.params=o.params,this.text="",this.updateText()}render(o){return this.def.renderer(this,o)}hasMultipleParamsInString(o,m){return o.indexOf(",")===-1?!1:this.def.params[m+1]&&this.def.params[m+1].optional}updateParam(o,m){if(this.hasMultipleParamsInString(o,m)){(0,t.each)(o.split(","),(c,p)=>{this.updateParam(c.trim(),p)});return}o===""&&this.def.params[m].optional?this.params.splice(m,1):this.params[m]=o,this.part.params=this.params,this.updateText()}updateText(){if(this.params.length===0){this.text=this.def.type+"()";return}let o=this.def.type+"(";o+=this.params.join(", "),o+=")",this.text=o}}function r(u,o){const m=u.def.type+"(",c=(0,t.map)(u.params,(p,f)=>{const E=u.def.params[f];return E.type==="time"&&p==="auto"&&(p="$__interval"),E.quote==="single"?"'"+p+"'":E.quote==="double"?'"'+p+'"':p});return o&&c.unshift(o),m+c.join(", ")+")"}function g(u,o){return o+" "+u.params[0]}function d(u,o){return u.params[0]}function l(u,o){return'"'+u.params[0]+'"'}},64216:(j,I,e)=>{"use strict";e.d(I,{ZP:()=>P,Gr:()=>o,gz:()=>f,Oc:()=>E,K:()=>v,J0:()=>D,T2:()=>y,ql:()=>h});var t=e(34099),n=e(99633),i=e(33199),s=e(84369),r=e(47702);const d=(0,i.combineReducers)({dataSources:(0,s.jK)("dataSources",r.nw,({rulesSourceName:T})=>T).reducer,promRules:(0,s.jK)("promRules",r.y6,({rulesSourceName:T})=>T).reducer,rulerRules:(0,s.jK)("rulerRules",r.UR,({rulesSourceName:T})=>T).reducer,silences:(0,s.jK)("silences",r.je,T=>T).reducer,ruleForm:(0,i.combineReducers)({saveRule:(0,s.i6)("saveRule",r.wy).reducer,existingRule:(0,s.i6)("existingRule",r.on).reducer}),grafanaNotifiers:(0,s.i6)("grafanaNotifiers",r.Vj).reducer,saveAMConfig:(0,s.i6)("saveAMConfig",r.mM).reducer,deleteAMConfig:(0,s.i6)("deleteAMConfig",r.Nc).reducer,updateSilence:(0,s.i6)("updateSilence",r.QY).reducer,amAlerts:(0,s.jK)("amAlerts",r.dB,T=>T).reducer,folders:(0,s.jK)("folders",r.vL,T=>T).reducer,amAlertGroups:(0,s.jK)("amAlertGroups",r.mS,T=>T).reducer,testReceivers:(0,s.i6)("testReceivers",r.D8).reducer,updateLotexNamespaceAndGroup:(0,s.i6)("updateLotexNamespaceAndGroup",r.hv).reducer,externalAlertmanagers:(0,i.combineReducers)({alertmanagerConfig:(0,s.i6)("alertmanagerConfig",r.wE).reducer,discoveredAlertmanagers:(0,s.i6)("discoveredAlertmanagers",r.zy).reducer}),managedAlertStateHistory:(0,s.i6)("managedAlertStateHistory",r.Ms).reducer});var l=e(43609);const u={items:[],searchQuery:"",isLoading:!1},o={notificationChannelTypes:[],notificationChannel:{},notifiers:[]};function m(T,S){const x=l.Z.getStateDisplayModel(S),O={...T,stateText:x.text,stateIcon:x.iconClass,stateClass:x.stateClass,stateAge:(0,n.CQ)(T.newStateDate).fromNow(!0)};return O.state!=="paused"&&(O.executionError&&(O.info="Execution Error: "+O.executionError),O.evalData&&O.evalData.noData&&(O.info="Query returned no data")),O}const c=(0,t.oM)({name:"alertRules",initialState:u,reducers:{loadAlertRules:T=>({...T,isLoading:!0}),loadedAlertRules:(T,S)=>{const O=S.payload.map(B=>m(B,B.state));return{...T,items:O,isLoading:!1}},setSearchQuery:(T,S)=>({...T,searchQuery:S.payload})}}),p=(0,t.oM)({name:"notificationChannel",initialState:o,reducers:{setNotificationChannels:(T,S)=>({...T,notificationChannelTypes:M(S.payload),notifiers:S.payload}),notificationChannelLoaded:(T,S)=>{const x=S.payload,B=T.notifiers.find(A=>A.type===x.type).options.filter(A=>A.secure);return B.length>0&&B.some(A=>x.settings[A.propertyName]!=="")?b(T,S.payload,B):{...T,notificationChannel:x}},resetSecureField:(T,S)=>({...T,notificationChannel:{...T.notificationChannel,secureFields:{...T.notificationChannel.secureFields,[S.payload]:!1}}})}}),{loadAlertRules:f,loadedAlertRules:E,setSearchQuery:h}=c.actions,{setNotificationChannels:y,notificationChannelLoaded:v,resetSecureField:D}=p.actions,a=c.reducer,C=p.reducer,P={alertRules:a,notificationChannel:C,unifiedAlerting:d};function b(T,S,x){const O={},B={};return x.forEach(A=>{B[A.propertyName]=S.settings[A.propertyName],O[A.propertyName]=""}),{...T,notificationChannel:{...S,settings:{...S.settings,...O},secureSettings:{...B}}}}function M(T){return T.map(S=>({value:S.type,label:S.name,...S,typeName:S.type})).sort((S,x)=>S.name>x.name?1:-1)}},28722:(j,I,e)=>{"use strict";e.d(I,{$I:()=>p,PN:()=>o,Z0:()=>h,pM:()=>m,z7:()=>u});var t=e(99633),n=e(75308),i=e(91712),s=e(73289),r=e(34667),g=e(86312),d=e(66574);const l=7,u={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"};function o(y,v={}){r.config.grafanaJavascriptAgent.enabled&&n.s.api.pushLog([y],{level:i.in.INFO,context:{...v,module:"Alerting"}})}function m(y,v,D){return async function(...a){const C=performance.now(),P=await y(...a);return o(v,{loadTimeMs:(performance.now()-C).toFixed(0),...D}),P}}async function c(){try{const{createdAt:y}=await(0,s.i)().get("/api/user"),v=(0,t.CQ)().subtract(l,"days"),D=(0,t.CQ)(y);return v.isBefore(D)}catch{return!0}}const p=async(y={grafana_version:r.config.buildInfo.version,org_id:d.Vt.user.orgId,user_id:d.Vt.user.id})=>{await c()||(0,g.ff)("grafana_alerting_navigation",y)},f=async y=>{await c()||reportInteraction("grafana_alerting_rule_creation",y)},E=async y=>{await c()||reportInteraction("grafana_alerting_rule_aborted",y)},h=async y=>{await c()||(0,g.ff)("grafana_alerting_rule_form_error",y)}},85096:(j,I,e)=>{"use strict";e.d(I,{alertRuleApi:()=>o});var t=e(22513),n=e(77328),i=e(22446),s=e(16881),r=e(21961),g=e(92089);const d="/api/v1/rule/test/grafana",l="api/prometheus/grafana/api/v1/rules";function u(m,c="yaml"){return`/api/v1/provisioning/alert-rules/${m}/export?format=${c}`}const o=s.C.injectEndpoints({endpoints:m=>({preview:m.mutation({query:({alertQueries:c,condition:p,customLabels:f,folder:E,alertName:h,alertUid:y})=>({url:d,data:{rule:{grafana_alert:{data:c,condition:p,no_data_state:"Alerting",title:h,uid:y??"N/A"},for:"0s",labels:(0,n.bR)(f),annotations:{}},folderUid:E.uid,folderTitle:E.title},method:"POST"})}),prometheusRulesByNamespace:m.query({query:({limitAlerts:c,identifier:p,filter:f,state:E,matcher:h})=>{const y=new URLSearchParams;c&&y.set("limit_alerts",String(c)),p&&((0,i.qE)(p)||(0,i.E4)(p))&&(y.set("file",p.namespace),y.set("rule_group",p.groupName));const v=(0,r.hd)(y,f);return{url:l,params:(0,r.Tb)(v,E,h)}},transformResponse:c=>(0,r.lL)(c.data.groups,t.GC)}),prometheusRuleNamespaces:m.query({query:({ruleSourceName:c,namespace:p,groupName:f,ruleName:E})=>{const h={};return h.file=p,h.rule_group=f,h.rule_name=E,{url:`api/prometheus/${(0,t.gt)(c)}/api/v1/rules`,params:h}},transformResponse:(c,p,f)=>(0,r.lL)(c.data.groups,f.ruleSourceName)}),rulerRules:m.query({query:({rulerConfig:c,filter:p})=>{const{path:f,params:E}=(0,g.IN)(c).rules(p);return{url:f,params:E}}}),rulerRuleGroup:m.query({query:({rulerConfig:c,namespace:p,group:f})=>{const{path:E,params:h}=(0,g.IN)(c).namespaceGroup(p,f);return{url:E,params:h}}}),exportRule:m.query({query:({uid:c,format:p})=>({url:u(c,p)})})})})},16881:(j,I,e)=>{"use strict";e.d(I,{C:()=>g});var t=e(4371),n=e(78209),i=e(73289),s=e(28722);const r=()=>async d=>{try{const l=performance.now(),{data:u,...o}=await(0,n.n)((0,i.i)().fetch(d));return(0,s.PN)("Request finished",{loadTimeMs:(performance.now()-l).toFixed(0),url:d.url,method:d.method??"",responseStatus:o.statusText}),{data:u,meta:o}}catch(l){return{error:l}}},g=(0,t.LC)({reducerPath:"alertingApi",baseQuery:r(),tagTypes:["AlertmanagerChoice","AlertmanagerConfiguration"],endpoints:()=>({})})},58803:(j,I,e)=>{"use strict";e.d(I,{$l:()=>D,Bp:()=>f,CN:()=>d,Ch:()=>r,QK:()=>m,U7:()=>l,UK:()=>p,XK:()=>c,Zo:()=>a,dx:()=>u,iT:()=>o,oy:()=>g,tK:()=>v});var t=e(78209),n=e(78968),i=e(73289),s=e(22513);async function r(P){try{const b=await(0,t.n)((0,i.i)().fetch({url:`/api/alertmanager/${(0,s.gt)(P)}/config/api/v1/alerts`,showErrorAlert:!1,showSuccessAlert:!1}));return{template_files:b.data.template_files??{},template_file_provenances:b.data.template_file_provenances??{},alertmanager_config:b.data.alertmanager_config??{},last_applied:b.data.last_applied,id:b.data.id}}catch(b){if(P===s.GC&&(0,i.kW)(b)&&b.data?.message?.includes("could not find an Alertmanager configuration"))return{template_files:{},alertmanager_config:{}};throw b}}async function g(P,b){await(0,t.n)((0,i.i)().fetch({method:"POST",url:`/api/alertmanager/${(0,s.gt)(P)}/config/api/v1/alerts`,data:b,showErrorAlert:!1,showSuccessAlert:!1}))}async function d(P){await(0,t.n)((0,i.i)().fetch({method:"DELETE",url:`/api/alertmanager/${(0,s.gt)(P)}/config/api/v1/alerts`,showErrorAlert:!1,showSuccessAlert:!1}))}async function l(P){return(await(0,t.n)((0,i.i)().fetch({url:`/api/alertmanager/${(0,s.gt)(P)}/api/v2/silences`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function u(P,b){return(await(0,t.n)((0,i.i)().fetch({url:`/api/alertmanager/${(0,s.gt)(P)}/api/v2/silences`,data:b,showErrorAlert:!1,showSuccessAlert:!1,method:"POST"}))).data}async function o(P,b){await(0,i.i)().delete(`/api/alertmanager/${(0,s.gt)(P)}/api/v2/silence/${encodeURIComponent(b)}`)}async function m(P,b,M=!0,T=!0,S=!0){const x=n.Cj.toUrlParams({silenced:M,active:T,inhibited:S})+b?.map(B=>`filter=${encodeURIComponent(`${C(B.name)}=${B.isRegex?"~":""}"${C(B.value)}"`)}`).join("&")||"";return(await(0,t.n)((0,i.i)().fetch({url:`/api/alertmanager/${(0,s.gt)(P)}/api/v2/alerts`+(x?"?"+x:""),showErrorAlert:!1,showSuccessAlert:!1}))).data}async function c(P){return(await(0,t.n)((0,i.i)().fetch({url:`/api/alertmanager/${(0,s.gt)(P)}/api/v2/alerts/groups`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function p(P){return(await(0,t.n)((0,i.i)().fetch({url:`/api/alertmanager/${(0,s.gt)(P)}/api/v2/status`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function f(P,b,M){const T={receivers:b,alert:M};try{const S=await(0,t.n)((0,i.i)().fetch({method:"POST",data:T,url:`/api/alertmanager/${(0,s.gt)(P)}/config/api/v1/receivers/test`,showErrorAlert:!1,showSuccessAlert:!1}));if(E(S.data))throw new Error(y(S.data))}catch(S){throw(0,i.kW)(S)&&h(S.data)&&E(S.data)?new Error(y(S.data)):S}}function E(P){return P.receivers.some(b=>b.grafana_managed_receiver_configs.some(M=>M.status==="failed"))}function h(P){const b=P?.receivers;return Array.isArray(b)?b.every(M=>typeof M.name=="string"&&Array.isArray(M.grafana_managed_receiver_configs)):!1}function y(P){return P.receivers.flatMap(b=>b.grafana_managed_receiver_configs.filter(M=>M.status==="failed").map(M=>M.error??"Unknown error.")).join("; ")}async function v(P){await(0,t.n)((0,i.i)().fetch({method:"POST",data:P,url:"/api/v1/ngalert/admin_config",showErrorAlert:!1,showSuccessAlert:!1})).then(()=>{a()})}async function D(){return(await(0,t.n)((0,i.i)().fetch({method:"GET",url:"/api/v1/ngalert/alertmanagers"}))).data}async function a(){return(await(0,t.n)((0,i.i)().fetch({method:"GET",url:"/api/v1/ngalert/admin_config",showErrorAlert:!1}))).data}function C(P){return P.replace(/"/g,'\\"')}},52646:(j,I,e)=>{"use strict";e.d(I,{alertmanagerApi:()=>f});var t=e(89949),n=e.n(t),i=e(84749),s=e(28722),r=e(76658),g=e(22513),d=e(39036),l=e(84369),u=e(16881),o=e(58803),m=e(37194);const c=10,p=30*1e3,f=u.C.injectEndpoints({endpoints:E=>({getAlertmanagerAlerts:E.query({query:({amSourceName:h,filter:y})=>{const v=y?.matchers?.filter(T=>T.name&&T.value).map(T=>`${T.name}${(0,r.zy)(T)}${(0,d.sM)(T.value)}`),{silenced:D,inhibited:a,unprocessed:C,active:P}=y||{},b=Object.fromEntries(Object.entries({silenced:D,active:P,inhibited:a,unprocessed:C}).filter(([T,S])=>S!==void 0)),M={filter:v};return b&&Object.keys(b).forEach(T=>{M[T]=b[T]}),{url:`/api/alertmanager/${(0,g.gt)(h)}/api/v2/alerts`,params:M}}}),getAlertmanagerAlertGroups:E.query({query:({amSourceName:h})=>({url:`/api/alertmanager/${(0,g.gt)(h)}/api/v2/alerts/groups`})}),getAlertmanagerChoiceStatus:E.query({query:()=>({url:"/api/v1/ngalert"}),providesTags:["AlertmanagerChoice"]}),getExternalAlertmanagerConfig:E.query({query:()=>({url:"/api/v1/ngalert/admin_config"}),providesTags:["AlertmanagerChoice"]}),getExternalAlertmanagers:E.query({query:()=>({url:"/api/v1/ngalert/alertmanagers"}),transformResponse:h=>h.data}),saveExternalAlertmanagersConfig:E.mutation({query:h=>({url:"/api/v1/ngalert/admin_config",method:"POST",data:h}),invalidatesTags:["AlertmanagerChoice"]}),getValidAlertManagersConfig:E.query({query:()=>({url:`/api/alertmanager/${(0,g.gt)(g.GC)}/config/history?limit=${c}`})}),resetAlertManagerConfigToOldVersion:E.mutation({query:h=>({url:`/api/alertmanager/${(0,g.gt)(g.GC)}/config/history/${h.id}/_activate`,method:"POST"})}),getAlertmanagerConfiguration:E.query({queryFn:async h=>{const y=h===g.GC;if((0,g.RY)(h))return(0,l.$b)((0,o.UK)(h).then(M=>({data:{alertmanager_config:M.config,template_files:{}}})));const{data:D}=await(0,i.WI)(m.T.endpoints.discoverAmFeatures.initiate({amSourceName:h})),a={alertmanager_config:{},template_files:{},template_file_provenances:{}},C=D?.lazyConfigInit??!1,P=(0,s.pM)(o.Ch,`[${h}] Alertmanager config loaded`,{dataSourceName:h,thunk:"unifiedalerting/fetchAmConfig"}),b=(0,d.fm)(()=>P(h),M=>!!(0,l.kk)(M)?.includes("alertmanager storage object not found")&&!C,p).then(M=>y?M:(0,t.isEmpty)(M.alertmanager_config)&&(0,t.isEmpty)(M.template_files)?(0,o.UK)(h).then(S=>({alertmanager_config:S.config,template_files:{},template_file_provenances:M.template_file_provenances,last_applied:M.last_applied,id:M.id})):M).then(M=>M??a).then(M=>({data:M})).catch(M=>{if(C&&(0,l.kk)(M)?.includes("alertmanager storage object not found"))return{data:a};throw M});return(0,l.$b)(b).catch(M=>({error:M,data:void 0}))},providesTags:["AlertmanagerConfiguration"]}),updateAlertmanagerConfiguration:E.mutation({query:({selectedAlertmanager:h,config:y,...v})=>({url:`/api/alertmanager/${(0,g.gt)(h)}/config/api/v1/alerts`,method:"POST",data:y,...v}),invalidatesTags:["AlertmanagerConfiguration"]})})})},55394:(j,I,e)=>{"use strict";e.d(I,{C$:()=>l,SJ:()=>m,WG:()=>u,Zy:()=>o});var t=e(78209),n=e(73289),i=e(18447),s=e(33555),r=e(22513),g=e(21961),d=e(92089);async function l(y){if(y===r.GC)return{features:{rulerApiEnabled:!0}};const v=(0,r.c$)(y);if(!v)throw new Error(`Cannot find data source configuration for ${y}`);const{url:D,name:a,type:C}=v;if(!D)throw new Error("The data source url cannot be empty.");if(C!=="prometheus"&&C!=="loki")throw new Error(`The build info request is not available for ${C}. Only 'prometheus' and 'loki' are supported`);return u({name:a,url:D,type:C})}async function u(y){const{url:v,name:D,type:a}=y,C=a==="loki"?void 0:await p(v);if(!(C!==void 0)){if(!await f(D))throw new Error(`Unable to fetch alert rules. Is the ${D} data source properly configured?`);const T=await E(D);return{application:i.T8.Cortex,features:{rulerApiEnabled:T}}}const{features:b}=C.data;return b?{application:i.T8.Mimir,features:{rulerApiEnabled:b?.ruler_config_api==="true"}}:{application:i.T8.Prometheus,features:{rulerApiEnabled:!1}}}async function o(y){if(y===r.GC)return{lazyConfigInit:!1};const v=c(y),{url:D,type:a}=v;if(!D)throw new Error("The data source url cannot be empty.");if(a!=="alertmanager")throw new Error(`Alertmanager feature discovery is not available for ${a}. Only 'alertmanager' type is supported`);return await m(D)}async function m(y){try{return{lazyConfigInit:(await p(y))?.data?.application==="Grafana Mimir"}}catch{return{lazyConfigInit:!1}}}function c(y){const v=(0,r.c$)(y);if(!v)throw new Error(`Cannot find data source configuration for ${y}`);return v}async function p(y){return(await(0,t.n)((0,n.i)().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 f(y){try{return await(0,g.j)(y),!0}catch{return!1}}async function E(y){try{return await(0,d.jw)(y),!0}catch(v){if(h(v))return!1;throw v}}function h(y){return(0,n.kW)(y)?y.data.message?.includes("GetRuleGroup unsupported in rule local store")||y.data.message?.includes("page not found")||y.data.message?.includes(s.jZ):y instanceof Error&&y.message?.includes("404 from rules config endpoint")}},37194:(j,I,e)=>{"use strict";e.d(I,{T:()=>g});var t=e(18447),n=e(28722),i=e(22513),s=e(16881),r=e(55394);const g=s.C.injectEndpoints({endpoints:d=>({discoverAmFeatures:d.query({queryFn:async({amSourceName:l})=>{try{return{data:await(0,r.Zy)(l)}}catch(u){return{error:u}}}}),discoverDsFeatures:d.query({queryFn:async({rulesSourceName:l})=>{const u=(0,i.VX)(l);if(!u)return{error:new Error(`Missing data source configuration for ${l}`)};const m=await(0,n.pM)(r.C$,`[${l}] Rules source features discovered`,{dataSourceName:l,endpoint:"unifiedalerting/featureDiscoveryApi/discoverDsFeatures"})(u.name);return{data:{rulerConfig:m.features.rulerApiEnabled?{dataSourceName:u.name,apiVersion:m.application===t.T8.Cortex?"legacy":"config"}:void 0}}}})})})},8014:(j,I,e)=>{"use strict";e.d(I,{QE:()=>l,i9:()=>s});var t=e(78209),n=e(73289),i=e(22513);function s(){return(0,n.i)().get("/api/alert-notifiers")}const r=u=>{const o=u.match(/^(\w+)(\[\d+\])?$/);return o?{type:o[1],index:o[2]}:{type:u,index:void 0}},g=u=>{const o={receivers:{},errorCount:0};u.forEach(c=>{o.receivers[c.name]={active:c.active,notifiers:{},errorCount:0};const p=o.receivers[c.name];c.integrations.forEach(f=>{!!f?.lastNotifyAttemptError&&(p.errorCount+=1);const h=d(f.name);h&&(p.notifiers[h]||(p.notifiers[h]=[]),p.notifiers[h].push(f))})});const m=Object.values(o.receivers).reduce((c,p)=>c+p.errorCount,0);return{...o,errorCount:m}},d=u=>r(u)?.type;async function l(u){try{const o=await(0,t.n)((0,n.i)().fetch({url:`/api/alertmanager/${(0,i.gt)(u)}/config/api/v1/receivers`,showErrorAlert:!1,showSuccessAlert:!1}));return g(o.data)}catch{return g([])}}},21961:(j,I,e)=>{"use strict";e.d(I,{Tb:()=>d,hd:()=>g,j:()=>u,lL:()=>l});var t=e(78209),n=e(73289),i=e(22513),s=e(22446);function r(o){const{dataSourceName:m,limitAlerts:c,identifier:p}=o;return{rules:(f,E,h)=>{const y=new URLSearchParams;m===i.GC&&c&&y.set("limit_alerts",String(c)),p&&((0,s.qE)(p)||(0,s.E4)(p))&&(y.set("file",p.namespace),y.set("rule_group",p.groupName));const v=g(y,f);return{url:`/api/prometheus/${(0,i.gt)(m)}/api/v1/rules`,params:d(v,E,h)}}}}function g(o,m){return m?.dashboardUID&&(o.set("dashboard_uid",m.dashboardUID),m?.panelId&&o.set("panel_id",String(m.panelId))),Object.fromEntries(o)}function d(o,m,c){let p={...o};if(m?.length&&(p={...p,state:m}),c?.length){const f=c.map(E=>JSON.stringify(E));p={...p,matcher:f}}return p}const l=(o,m)=>{const c={};return o.forEach(p=>{p.rules.forEach(f=>{f.query=f.query||""}),c[p.file]?c[p.file].groups.push(p):c[p.file]={dataSourceName:m,name:p.file,groups:[p]}}),Object.values(c)};async function u(o,m,c,p,f,E){if(m?.dashboardUID&&o!==i.GC)throw new Error("Filtering by dashboard UID is only supported for Grafana Managed rules.");const{url:h,params:y}=r({dataSourceName:o,limitAlerts:c,identifier:E}).rules(m,f,p),v=await(0,t.n)((0,n.i)().fetch({url:h,params:y,showErrorAlert:!1,showSuccessAlert:!1})).catch(D=>{throw"status"in D&&D.status===404?new Error("404 from rule state endpoint. Perhaps ruler API is not enabled?"):D});return l(v.data.data.groups,o)}},92089:(j,I,e)=>{"use strict";e.d(I,{BC:()=>c,IN:()=>g,P4:()=>d,jJ:()=>m,jw:()=>o,m6:()=>l,sz:()=>y});var t=e(78209),n=e(73289),i=e(33555),s=e(22513),r=e(21961);function g(v){const a=`${`/api/ruler/${(0,s.gt)(v.dataSourceName)}`}/api/v1/rules`,C=new URLSearchParams;return C.set("subtype",v.apiVersion==="legacy"?"cortex":"mimir"),{rules:P=>{const b=(0,r.hd)(C,P);return{path:`${a}`,params:b}},namespace:P=>({path:`${a}/${encodeURIComponent(P)}`,params:Object.fromEntries(C)}),namespaceGroup:(P,b)=>({path:`${a}/${encodeURIComponent(P)}/${encodeURIComponent(b)}`,params:Object.fromEntries(C)})}}async function d(v,D,a){const{path:C,params:P}=g(v).namespace(D);await(0,t.n)((0,n.i)().fetch({method:"POST",url:C,data:a,showErrorAlert:!1,showSuccessAlert:!1,params:P}))}async function l(v,D){if(D?.dashboardUID&&v.dataSourceName!==s.GC)throw new Error("Filtering by dashboard UID is only supported by Grafana.");const{path:a,params:C}=g(v).rules(D);return p(a,{},C)}async function u(v,D){const{path:a,params:C}=g(v).namespace(D);return(await p(a,{},C))[D]||[]}async function o(v){return p(`/api/ruler/${(0,s.gt)(v)}/api/v1/rules/test/test`,null)}async function m(v,D,a){const{path:C,params:P}=g(v).namespaceGroup(D,a);return p(C,null,P)}async function c(v,D,a){const{path:C,params:P}=g(v).namespaceGroup(D,a);await(0,t.n)((0,n.i)().fetch({url:C,method:"DELETE",showSuccessAlert:!1,showErrorAlert:!1,params:P}))}async function p(v,D,a){try{return(await(0,t.n)((0,n.i)().fetch({url:v,showErrorAlert:!1,showSuccessAlert:!1,params:a}))).data}catch(C){if(!f(C))throw C;if(h(C))return D;throw E(C)?{...C,data:{...C.data,message:i.jZ}}:C}}function f(v){const D=v.data!=null;return Number.isFinite(v.status)&&D}function E(v){return v.status===404||v.status===500&&v.data.message?.includes("unexpected content type from upstream. expected YAML, got text/html")}function h(v){return v.status===404&&(v.data.message?.includes("group does not exist")||v.data.message?.includes("no rule groups found"))}async function y(v,D){const{path:a,params:C}=g(v).namespace(D);await(0,t.n)((0,n.i)().fetch({method:"DELETE",url:a,showErrorAlert:!1,showSuccessAlert:!1,params:C}))}},21915:(j,I,e)=>{"use strict";e.d(I,{i:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(67437);const r=({labelKey:d,value:l,operator:u="=",onRemoveLabel:o})=>{const m=(0,i.wW)(g);return n.createElement("div",{className:m.wrapper},d,u,l,!!o&&n.createElement(s.h,{name:"times",size:"xs",onClick:o,tooltip:"Remove label"}))},g=d=>({wrapper:(0,t.css)` padding: ${d.spacing(.5,1)}; border-radius: ${d.shape.borderRadius(1)}; border: solid 1px ${d.colors.border.medium}; font-size: ${d.typography.bodySmall.fontSize}; background-color: ${d.colors.background.secondary}; font-weight: ${d.typography.fontWeightBold}; color: ${d.colors.text.primary}; display: inline-block; line-height: 1.2; `})},8254:(j,I,e)=>{"use strict";e.d(I,{s:()=>m});var t=e(42844),n=e(89949),i=e.n(n),s=e(6772),r=e.n(s),g=e(27702),d=e(66310),l=e(66670),u=e(64714),o=e(79374);const m=({labels:E,commonLabels:h={},size:y})=>{const v=(0,d.wW)(M=>f(M,y)),[D,a]=(0,g.useState)(!1),C=(0,n.chain)(E).toPairs().reject(p).reject(([M])=>D?!1:M in h).value(),P=Object.keys(h).length,b=P>0;return g.createElement("div",{className:v.wrapper,role:"list","aria-label":"Labels"},C.map(([M,T])=>g.createElement(o._,{key:M+T,size:y,label:M,value:T,color:c(M)})),!D&&b&&g.createElement(l.zx,{variant:"secondary",fill:"text",onClick:()=>a(!0),tooltip:"Show common labels",tooltipPlacement:"top",size:"sm"},"+",P," common ",r()("label",P)),D&&b&&g.createElement(l.zx,{variant:"secondary",fill:"text",onClick:()=>a(!1),tooltipPlacement:"top",size:"sm"},"Hide common labels"))};function c(E){return(0,u.Bx)(E).color}const p=([E,h])=>E.startsWith("__")&&E.endsWith("__"),f=(E,h)=>({wrapper:(0,t.css)` display: flex; flex-wrap: wrap; align-items: center; gap: ${h==="md"?E.spacing():E.spacing(.5)}; `})},73104:(j,I,e)=>{"use strict";e.d(I,{a:()=>m});var t=e(42844),n=e(27702),i=e(48154),s=e(80011),r=e(66310),g=e(33555),d=e(1333),l=e(3671),u=e(49325);const o=["message","description"],m=({annotationKey:f,value:E,valueLink:h})=>{const y=g.vY[f]?n.createElement(s.u,{content:f,placement:"top",theme:"info"},n.createElement("span",null,g.vY[f])):f;return n.createElement(d.C,{label:y,horizontal:!0},n.createElement(c,{annotationKey:f,value:E,valueLink:h}))},c=({annotationKey:f,value:E,valueLink:h})=>{const y=(0,r.wW)(p),v=o.includes(f),D=E&&E.startsWith("http"),a=n.createElement(l.Z,{input:E,delimiter:["{{","}}"]});return h?n.createElement("a",{href:i.QX.sanitizeUrl(h),className:y.link},E):v?n.createElement(u.t,{className:y.well},a):D?n.createElement("a",{href:i.QX.sanitizeUrl(E),target:"__blank",className:y.link},E):n.createElement(n.Fragment,null,a)},p=f=>({well:(0,t.css)` word-break: break-word; `,link:(0,t.css)` word-break: break-all; color: ${f.colors.primary.text}; `})},10759:(j,I,e)=>{"use strict";e.d(I,{U:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(66670);const r=({isCollapsed:d,onToggle:l,idControlled:u,className:o,text:m,size:c="xl",...p})=>{const f=(0,i.wW)(g);return n.createElement(s.zx,{type:"button",fill:"text",variant:"secondary","aria-expanded":!d,"aria-controls":u,className:(0,t.cx)(f.expandButton,o),icon:d?"angle-right":"angle-down",onClick:()=>l(!d),...p},m)},g=d=>({expandButton:(0,t.css)` margin-right: ${d.spacing(1)}; `})},1333:(j,I,e)=>{"use strict";e.d(I,{C:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({className:g,label:d,horizontal:l,children:u,childrenWrapperClassName:o})=>{const m=(0,i.wW)(r);return n.createElement("div",{className:(0,t.cx)(m.field,l?m.fieldHorizontal:m.fieldVertical,g)},n.createElement("div",null,d),n.createElement("div",{className:o},u))},r=g=>({fieldHorizontal:(0,t.css)` flex-direction: row; ${g.breakpoints.down("md")} { flex-direction: column; } `,fieldVertical:(0,t.css)` flex-direction: column; `,field:(0,t.css)` display: flex; margin: ${g.spacing(2)} 0; & > div:first-child { width: 110px; padding-right: ${g.spacing(1)}; font-size: ${g.typography.size.sm}; font-weight: ${g.typography.fontWeightBold}; line-height: 1.8; } & > div:nth-child(2) { flex: 1; color: ${g.colors.text.secondary}; } `})},45986:(j,I,e)=>{"use strict";e.d(I,{t:()=>l});var t=e(42844),n=e(27702),i=e(66310),s=e(67437),r=e(50852),g=e(92367),d=e(36148);const l=({cols:o,items:m,isExpandable:c=!1,onCollapse:p,onExpand:f,isExpanded:E,renderExpandedContent:h,testIdGenerator:y,pagination:v,paginationStyles:D,renderPrefixCell:a,renderPrefixHeader:C,footerRow:P,dataTestId:b})=>{const M=(0,i.wW)(d.Z);if((p||f||E)&&!(p&&f&&E))throw new Error("either all of onCollapse, onExpand, isExpanded must be provided, or none");if((c||h)&&!(c&&h))throw new Error("either both isExpanded and renderExpandedContent must be provided, or neither");const T=(0,i.wW)(u(o,c,!!C)),[S,x]=(0,n.useState)([]),O=N=>{E&&p&&f?E(N)?p(N):f(N):x(S.includes(N.id)?S.filter(F=>F!==N.id):[...S,N.id])},B=v?.itemsPerPage??m.length,{page:A,numberOfPages:V,onPageChange:W,pageItems:w}=(0,g.h)(m,1,B);return n.createElement(n.Fragment,null,n.createElement("div",{className:T.container,"data-testid":b??"dynamic-table"},n.createElement("div",{className:T.row,"data-testid":"header"},C&&C(),c&&n.createElement("div",{className:T.cell}),o.map(N=>n.createElement("div",{className:T.cell,key:N.id},N.label))),w.map((N,F)=>{const k=E?E(N):S.includes(N.id);return n.createElement("div",{className:T.row,key:`${N.id}-${F}`,"data-testid":y?.(N,F)??"row"},a&&a(N,F,m),c&&n.createElement("div",{className:(0,t.cx)(T.cell,T.expandCell)},n.createElement(s.h,{tooltip:`${k?"Collapse":"Expand"} row`,"data-testid":"collapse-toggle",name:k?"angle-down":"angle-right",onClick:()=>O(N)})),o.map(H=>n.createElement("div",{className:(0,t.cx)(T.cell,T.bodyCell,H.className),"data-column":H.label,key:`${N.id}-${H.id}`},H.renderCell(N,F))),k&&h&&n.createElement("div",{className:T.expandedContentRow,"data-testid":"expanded-content"},h(N,F,m)))}),P&&n.createElement("div",{className:(0,t.cx)(T.row,T.footerRow)},P)),v&&n.createElement(r.t,{className:(0,t.cx)(M,D),currentPage:A,numberOfPages:V,onNavigate:W,hideWhenSinglePage:!0}))},u=(o,m,c)=>{const p=o.map(f=>f.size?typeof f.size=="number"?`${f.size}fr`:f.size:"auto");return m&&p.unshift("calc(1em + 16px)"),c&&p.unshift("0"),f=>({container:(0,t.css)` border: 1px solid ${f.colors.border.weak}; border-radius: ${f.shape.borderRadius()}; color: ${f.colors.text.secondary}; `,row:(0,t.css)` display: grid; grid-template-columns: ${p.join(" ")}; grid-template-rows: 1fr auto; &:nth-child(2n + 1) { background-color: ${f.colors.background.secondary}; } &:nth-child(2n) { background-color: ${f.colors.background.primary}; } ${f.breakpoints.down("sm")} { grid-template-columns: auto 1fr; grid-template-areas: 'left right'; padding: 0 ${f.spacing(.5)}; &:first-child { display: none; } ${c?` & > *:first-child { display: none; } `:""} } `,footerRow:(0,t.css)` display: flex; padding: ${f.spacing(1)}; `,cell:(0,t.css)` display: flex; align-items: center; padding: ${f.spacing(1)}; ${f.breakpoints.down("sm")} { padding: ${f.spacing(1)} 0; grid-template-columns: 1fr; } `,bodyCell:(0,t.css)` overflow: hidden; ${f.breakpoints.down("sm")} { grid-column-end: right; grid-column-start: right; &::before { content: attr(data-column); display: block; color: ${f.colors.text.primary}; } } `,expandCell:(0,t.css)` justify-content: center; ${f.breakpoints.down("sm")} { align-items: start; grid-area: left; } `,expandedContentRow:(0,t.css)` grid-column-end: ${p.length+1}; grid-column-start: ${c?3:2}; grid-row: 2; padding: 0 ${f.spacing(3)} 0 ${f.spacing(1)}; position: relative; ${f.breakpoints.down("sm")} { grid-column-start: 2; border-top: 1px solid ${f.colors.border.strong}; grid-row: auto; padding: ${f.spacing(1)} 0 0 0; } `})}},51453:(j,I,e)=>{"use strict";e.d(I,{z:()=>u});var t=e(42844),n=e(89898),i=e.n(n),s=e(27702),r=e(23852),g=e(66310),d=e(75965),l=e(71235);const u=({children:m,header:c,content:p,footer:f,arrow:E,showAfter:h=300,wrapperClassName:y,disabled:v=!1,...D})=>{const a=(0,s.useRef)(null),C=(0,g.wW)(o);if(v)return m;const P=s.createElement(r.K,{direction:"column",gap:0},c&&s.createElement("div",{className:C.card.header},c),s.createElement("div",{className:C.card.body},p),f&&s.createElement("div",{className:C.card.footer},f));return s.createElement(d.D,{content:P,hideAfter:100},(b,M,T)=>s.createElement(s.Fragment,null,a.current&&s.createElement(l.J,{...T,...D,wrapperClassName:i()(C.popover(E?1.25:0),y),onMouseLeave:M,onMouseEnter:b,onFocus:b,onBlur:M,referenceElement:a.current,renderArrow:E?({arrowProps:S,placement:x})=>s.createElement("div",{className:C.arrow(x),...S}):()=>s.createElement(s.Fragment,null)}),s.cloneElement(m,{ref:a,onMouseEnter:b,onMouseLeave:M,onFocus:b,onBlur:M})))},o=m=>({popover:c=>(0,t.css)` border-radius: ${m.shape.borderRadius()}; box-shadow: ${m.shadows.z3}; background: ${m.colors.background.primary}; border: 1px solid ${m.colors.border.medium}; margin-bottom: ${m.spacing(c)}; `,card:{body:(0,t.css)` padding: ${m.spacing(1)}; `,header:(0,t.css)` padding: ${m.spacing(1)}; background: ${m.colors.background.secondary}; border-bottom: solid 1px ${m.colors.border.medium}; `,footer:(0,t.css)` padding: ${m.spacing(.5)} ${m.spacing(1)}; background: ${m.colors.background.secondary}; border-top: solid 1px ${m.colors.border.medium}; `},arrow:c=>{const p="9px";return(0,t.css)` width: 0; height: 0; border-left: ${p} solid transparent; border-right: ${p} solid transparent; /* using hex colors here because the border colors use alpha transparency */ border-top: ${p} solid ${m.isLight?"#d2d3d4":"#2d3037"}; &:after { content: ''; position: absolute; border: ${p} solid ${m.colors.background.primary}; border-bottom: 0; border-left-color: transparent; border-right-color: transparent; margin-top: 1px; bottom: 1px; left: -${p}; } `}})},79374:(j,I,e)=>{"use strict";e.d(I,{_:()=>d});var t=e(42844),n=e(27702),i=e(71685),s=e(23852),r=e(66310),g=e(73453);const d=({label:u,value:o,icon:m,color:c,size:p="md"})=>{const f=(0,r.wW)(E=>l(E,c,p));return n.createElement("div",{className:f.wrapper,role:"listitem"},n.createElement(s.K,{direction:"row",gap:0,alignItems:"stretch",wrap:!1},n.createElement("div",{className:f.label},n.createElement(s.K,{direction:"row",gap:.5,alignItems:"center"},m&&n.createElement(g.J,{name:m})," ",u??"")),n.createElement("div",{className:f.value},o)))},l=(u,o,m)=>{const c=o??u.colors.secondary.main,p=u.isDark?(0,i.Z)(c).lighten(5).toString():(0,i.Z)(c).darken(5).toString(),f=u.isDark?(0,i.Z)(c).darken(5).toString():(0,i.Z)(c).lighten(5).toString(),E=o?i.Z.mostReadable(c,["#000","#fff"]).toString():u.colors.text.primary,h=m==="md"?`${u.spacing(.33)} ${u.spacing(1)}`:`${u.spacing(.2)} ${u.spacing(.6)}`;return{wrapper:(0,t.css)` color: ${E}; font-size: ${u.typography.bodySmall.fontSize}; border-radius: ${u.shape.borderRadius(2)}; `,label:(0,t.css)` display: flex; align-items: center; color: inherit; padding: ${h}; background: ${c}; border: solid 1px ${p}; border-top-left-radius: ${u.shape.borderRadius(2)}; border-bottom-left-radius: ${u.shape.borderRadius(2)}; `,value:(0,t.css)` color: inherit; padding: ${h}; background: ${f}; border: solid 1px ${p}; border-left: none; border-top-right-radius: ${u.shape.borderRadius(2)}; border-bottom-right-radius: ${u.shape.borderRadius(2)}; `}}},67045:(j,I,e)=>{"use strict";e.d(I,{L:()=>i});var t=e(42844),n=e(27702);const i=()=>n.createElement("span",{className:(0,t.css)` flex: 1; `})},6949:(j,I,e)=>{"use strict";e.d(I,{i:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({children:g,state:d,size:l="md",muted:u=!1})=>{const o=(0,i.wW)(r);return n.createElement("span",{className:(0,t.cx)(o.common,o[d],o[l],{[o.muted]:u})},g||d)},r=g=>({common:(0,t.css)` display: inline-block; color: white; border-radius: ${g.shape.borderRadius()}; font-size: ${g.typography.size.sm}; text-transform: capitalize; line-height: 1.2; text-align: center; font-weight: ${g.typography.fontWeightBold}; `,good:(0,t.css)` background-color: ${g.colors.success.main}; border: solid 1px ${g.colors.success.main}; color: ${g.colors.success.contrastText}; `,warning:(0,t.css)` background-color: ${g.colors.warning.main}; border: solid 1px ${g.colors.warning.main}; color: ${g.colors.warning.contrastText}; `,bad:(0,t.css)` background-color: ${g.colors.error.main}; border: solid 1px ${g.colors.error.main}; color: ${g.colors.error.contrastText}; `,neutral:(0,t.css)` background-color: ${g.colors.secondary.main}; border: solid 1px ${g.colors.secondary.main}; color: ${g.colors.secondary.contrastText}; `,info:(0,t.css)` background-color: ${g.colors.primary.main}; border: solid 1px ${g.colors.primary.main}; color: ${g.colors.primary.contrastText}; `,md:(0,t.css)` padding: ${g.spacing(.5,1)}; min-width: ${g.spacing(8)}; `,sm:(0,t.css)` padding: ${g.spacing(.3,.5)}; min-width: 52px; `,muted:(0,t.css)` opacity: 0.5; `})},3671:(j,I,e)=>{"use strict";e.d(I,{Z:()=>l});var t=e(42844),n=e(27702),i=e(66310),s=e(25357),r=e(51453),g=e(21475);const d=["$",".",'"'];function l({input:h,delimiter:y=["{{","}}"]}){const v=(0,i.wW)(E),[D,a]=y,C=new RegExp(`(?<before>.*?)(${D}(?<token>.*?)${a}|$)`,"gm"),P=h.split(` `),b=[];return P.forEach((M,T)=>{Array.from(M.matchAll(C)).forEach((x,O)=>{const B=x.groups?.before,A=x.groups?.token?.trim();if(B&&b.push(n.createElement("span",{key:`${T}-${O}-before`},B)),A){const V=f(A),W=V==="variable"?A:"",w=`${D} ${A} ${a}`;b.push(n.createElement(o,{key:`${T}-${O}-token`,content:w,type:V,description:W}))}}),b.push(n.createElement("br",{key:`${T}-newline`}))}),n.createElement("span",{className:v.wrapper},b)}var u=(h=>(h.Variable="variable",h.Function="function",h.Keyword="keyword",h.Unknown="unknown",h))(u||{});function o({content:h,description:y,type:v}){const D=(0,i.wW)(E),a=!v;return n.createElement(r.z,{placement:"top-start",disabled:a,content:n.createElement("div",{className:D.hoverTokenItem},n.createElement(s.C,{tabIndex:0,text:n.createElement(n.Fragment,null,v),color:"blue"})," ",y&&n.createElement("code",null,y))},n.createElement("span",null,n.createElement(s.C,{tabIndex:0,className:D.token,text:h,color:"blue"})))}function m(h){return d.some(y=>h.startsWith(y))}function c(h){return g.keywords.some(y=>h.startsWith(y))}function p(h){return g.builtinFunctions.some(y=>h.startsWith(y))}function f(h){let y;return m(h)?y="variable":c(h)?y="keyword":p(h)?y="function":y="unknown",y}const E=h=>({wrapper:(0,t.css)` white-space: pre-wrap; `,token:(0,t.css)` cursor: default; font-family: ${h.typography.fontFamilyMonospace}; `,popover:(0,t.css)` border-radius: ${h.shape.borderRadius()}; box-shadow: ${h.shadows.z3}; background: ${h.colors.background.primary}; border: 1px solid ${h.colors.border.medium}; padding: ${h.spacing(1)}; `,hoverTokenItem:(0,t.css)` display: flex; flex-direction: row; align-items: center; gap: ${h.spacing(1)}; `})},49325:(j,I,e)=>{"use strict";e.d(I,{t:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({children:g,className:d})=>{const l=(0,i.wW)(r);return n.createElement("div",{className:(0,t.cx)(l.wrapper,d)},g)},r=g=>({wrapper:(0,t.css)` background-color: ${g.components.panel.background}; border: solid 1px ${g.components.input.borderColor}; border-radius: ${g.shape.borderRadius(1)}; padding: ${g.spacing(.5,1)}; font-family: ${g.typography.fontFamilyMonospace}; `})},33273:(j,I,e)=>{"use strict";e.d(I,{Z:()=>g});var t=e(6772),n=e.n(t),i=e(27702),s=e(66310),r=e(14117);const g=({group:d})=>{const l=(0,s.wW)(r.r),u=d.alerts.length,o=d.alerts.reduce((m,c)=>(m[c.status.state]?m[c.status.state]+=1:m[c.status.state]=1,m),{});return i.createElement("div",null,`${u} ${n()("alert",u)}: `,Object.entries(o).map(([m,c],p)=>i.createElement("span",{key:`${JSON.stringify(d.labels)}-notifications-${p}`,className:l[m]},p>0&&", ",`${c} ${m}`)))}},71444:(j,I,e)=>{"use strict";e.d(I,{F:()=>p});var t=e(42844),n=e(89949),i=e.n(n),s=e(27702),r=e(23852),g=e(91106),d=e(66310),l=e(73453),u=e(79978),o=e(80011),m=e(1128),c=e(28722);const p=({className:E,onFilterChange:h,defaultQueryString:y})=>{const v=(0,d.wW)(f),D=(0,s.useMemo)(()=>(0,n.debounce)(C=>{(0,g.PN)(c.z7.filterByLabel);const P=C.target;h(P.value)},600),[h]);(0,s.useEffect)(()=>D.cancel(),[D]);const a=s.createElement(l.J,{name:"search"});return s.createElement("div",{className:E},s.createElement(u._,null,s.createElement(r.K,{gap:.5},s.createElement("span",null,"Search by label"),s.createElement(o.u,{content:s.createElement("div",null,"Filter alerts using label querying, ex:",s.createElement("pre",null,'{severity="critical", instance=~"cluster-us-.+"}'))},s.createElement(l.J,{className:v.icon,name:"info-circle",size:"sm"})))),s.createElement(m.I,{placeholder:"Search",defaultValue:y,onChange:D,"data-testid":"search-query-input",prefix:a,className:v.inputWidth}))},f=E=>({icon:(0,t.css)` margin-right: ${E.spacing(.5)}; `,inputWidth:(0,t.css)` width: 340px; flex-grow: 0; `})},21475:(j,I,e)=>{"use strict";e.r(I),e.d(I,{AlertmanagerTemplateFunction:()=>n,availableAlertManagerFunctions:()=>i,builtinFunctions:()=>r,conf:()=>l,keywords:()=>g,language:()=>d});var t=(u=>(u.Delimiter="delimiter",u.Keyword="keyword",u.Function="type.identifier",u.String="string",u.Variable="variable.name",u.Number="number",u.Comment="comment",u.Operator="operator",u.Identifier="idenfifier",u))(t||{}),n=(u=>(u.toUpper="toUpper",u.toLower="toLower",u.title="title",u.join="join",u.match="match",u.safeHtml="safeHtml",u.reReplaceAll="reReplaceAll",u.stringSlice="stringSlice",u))(n||{});const i=Object.values(n),r=["and","call","html","index","slice","js","len","not","or","print","printf","println","urlquery",...["eq","ne","lt","le","gt","ge"]],g=["define","if","else","end","range","break","continue","template","block","with"],d={defaultToken:"",keywords:g,functions:[...r,...i],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"]]}},l={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:"'"}]}},61404:(j,I,e)=>{"use strict";e.d(I,{o:()=>c});var t=e(27702),n=e(14951),i=e(99633),s=e(22446),r=e(8254),g=e(45986),d=e(95438),l=e(73104),u=e(1333);const o=({instance:f})=>{const E=(0,d.$9)(f.annotations),h=(0,d.XW)(E);return t.createElement("div",null,f.value&&t.createElement(u.C,{label:"Value",horizontal:!0},f.value),E.map(([y,v])=>t.createElement(l.a,{key:y,annotationKey:y,value:v,valueLink:h.get(y)})))};var m=e(68614);const c=({instances:f,pagination:E,footerRow:h})=>{const y=(0,t.useMemo)(()=>f.length>1?(0,n.FT)(f.map(D=>D.labels)):{},[f]),v=(0,t.useMemo)(()=>f.map(D=>({data:{...D,commonLabels:y},id:(0,s.pB)(D)})),[y,f]);return t.createElement(g.t,{cols:p,isExpandable:!0,items:v,renderExpandedContent:({data:D})=>t.createElement(o,{instance:D}),pagination:E,footerRow:h})},p=[{id:"state",label:"State",renderCell:({data:{state:f}})=>t.createElement(m.l,{state:f}),size:"80px"},{id:"labels",label:"Labels",renderCell:({data:{labels:f,commonLabels:E}})=>t.createElement(r.s,{labels:f,commonLabels:E,size:"sm"})},{id:"created",label:"Created",renderCell:({data:{activeAt:f}})=>t.createElement(t.Fragment,null,f.startsWith("0001")?"-":(0,i.CQ)(f).format("YYYY-MM-DD HH:mm:ss")),size:"150px"}]},68614:(j,I,e)=>{"use strict";e.d(I,{l:()=>s});var t=e(27702),n=e(22446),i=e(6949);const s=t.memo(({state:r,isPaused:g=!1,size:d="md",muted:l=!1})=>t.createElement(i.i,{state:(0,n.Aq)(r),size:d,muted:l},(0,n.SS)(r)," ",g?" (Paused)":""));s.displayName="AlertStateTag"},3764:(j,I,e)=>{"use strict";e.d(I,{E:()=>l});var t=e(42844),n=e(27702),i=e(26129),s=e(66310),r=e(66670),g=e(3613),d=e(96437);const l=n.forwardRef(({text:o,ruleIdentifier:m,isProvisioned:c,className:p},f)=>{const[E,h]=(0,n.useState)(!1),y=(0,s.wW)(u),v="/alerting/new?copyFrom="+d.$V(m);return n.createElement(n.Fragment,null,n.createElement(r.Qj,{title:"Copy",className:p,size:"sm",key:"clone",variant:"secondary",icon:"copy",href:c?void 0:v,onClick:c?()=>h(!0):void 0,ref:f},o),n.createElement(g.s,{isOpen:E,title:"Copy provisioned alert rule",body:n.createElement("div",null,n.createElement("p",null,"The new rule will ",n.createElement("span",{className:y.bold},"NOT")," be marked as a provisioned rule."),n.createElement("p",null,"You will need to set a new alert 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:()=>{i.E1.push(v)},onDismiss:()=>h(!1)}))});l.displayName="CloneRuleButton";const u=o=>({bold:(0,t.css)` font-weight: ${o.typography.fontWeightBold}; `})},93764:(j,I,e)=>{"use strict";e.d(I,{Ii:()=>D,gr:()=>v});var t=e(42844),n=e(27702),i=e(60956),s=e(99633),r=e(66310),g=e(80011),d=e(58692),l=e(95438),u=e(22446),o=e(447),m=e(8254),c=e(1333),p=e(8044),f=e(28542),E=e(673),h=e(13932),y=e(33468);const v=15,D=({rule:P})=>{const b=(0,r.wW)(C),{namespace:{rulesSource:M}}=P,T=(0,l.$9)(P.annotations);return n.createElement("div",null,n.createElement(p.f,{rule:P,rulesSource:M,isViewMode:!1}),n.createElement("div",{className:b.wrapper},n.createElement("div",{className:b.leftSide},n.createElement(a,{rule:P}),!!P.labels&&!!Object.keys(P.labels).length&&n.createElement(c.C,{label:"Labels",horizontal:!0},n.createElement(m.s,{labels:P.labels})),n.createElement(h.C,{rulesSource:M,rule:P,annotations:T}),n.createElement(f.J,{annotations:T})),n.createElement("div",{className:b.rightSide},n.createElement(E.C,{rulesSource:M,rule:P}))),n.createElement(y.M,{rule:P,itemsDisplayLimit:v}))},a=({rule:P})=>{let b,M=P.group.interval,T=P.promRule?.lastEvaluation,S=P.promRule?.evaluationTime;return(0,u.yF)(P.rulerRule)||(b=P.rulerRule?.for),n.createElement(n.Fragment,null,M&&n.createElement(c.C,{label:"Evaluate",horizontal:!0},"Every ",M),b&&n.createElement(c.C,{label:"For",horizontal:!0},b),T&&!(0,o.gV)(T)&&n.createElement(c.C,{label:"Last evaluation",horizontal:!0},n.createElement(g.u,{placement:"top",content:`${(0,i.dq)(T,{format:"YYYY-MM-DD HH:mm:ss"})}`,theme:"info"},n.createElement("span",null,`${(0,s.CQ)(T).locale("en").fromNow(!0)} ago`))),T&&!(0,o.gV)(T)&&S!==void 0&&n.createElement(c.C,{label:"Evaluation time",horizontal:!0},n.createElement(g.u,{placement:"top",content:`${S}s`,theme:"info"},n.createElement("span",null,(0,d.q)({timeInMs:S*1e3,humanize:!0})))))},C=P=>({wrapper:(0,t.css)` display: flex; flex-direction: row; ${P.breakpoints.down("md")} { flex-direction: column; } `,leftSide:(0,t.css)` flex: 1; `,rightSide:(0,t.css)` ${P.breakpoints.up("md")} { padding-left: 90px; width: 300px; } `})},8044:(j,I,e)=>{"use strict";e.d(I,{f:()=>Y});var t=e(42844),n=e(27702),i=e(7662),s=e(48154),r=e(78968),g=e(47494),d=e(34667),l=e(66310),u=e(66670),o=e(71585),m=e(64022),c=e(3613),p=e(73807),f=e(91368),E=e(62862),h=e(18771),y=e(18447),v=e(52646),D=e(99322),a=e(13741);const C=(0,n.lazy)(()=>e.e(9841).then(e.bind(e,79841))),P=(0,n.lazy)(()=>e.e(5179).then(e.bind(e,75179)));var b=(Z=>(Z.Loki="loki",Z.Annotations="annotations",Z))(b||{});function M(){const[Z,le]=(0,n.useState)(!1),[oe,q]=(0,n.useState)(),ne=(0,l.wW)(T),ge=d.config.unifiedAlerting.alertStateHistoryBackend,ae=d.config.unifiedAlerting.alertStateHistoryPrimary,De=[ge,ae].some(We=>We==="loki")?"loki":"annotations",he=(0,n.useCallback)(()=>{q(void 0),le(!1)},[]),ye=(0,n.useCallback)(We=>{q(We),le(!0)},[]);return{StateHistoryModal:(0,n.useMemo)(()=>oe?n.createElement(a.u,{isOpen:Z,onDismiss:he,closeOnBackdropClick:!0,closeOnEscape:!0,title:"State history",className:ne.modal,contentClassName:ne.modalContent},n.createElement(n.Suspense,{fallback:"Loading..."},De==="loki"&&n.createElement(P,{ruleUID:oe.grafana_alert.uid}),De==="annotations"&&n.createElement(C,{alertId:oe.grafana_alert.id??""}))):null,[oe,Z,he,De,ne]),showStateHistoryModal:ye,hideStateHistoryModal:he}}const T=Z=>({modal:(0,t.css)` width: 80%; height: 80%; min-width: 800px; `,modalContent:(0,t.css)` height: 100%; width: 100%; padding: ${Z.spacing(2)}; `});var S=e(47702),x=e(2082),O=e(76658),B=e(33555),A=e(22513),V=e(39036),W=e(96437),w=e(22446),N=e(80011),F=e(76393),k=e(62401);const H=({children:Z,plugin:le,loadingComponent:oe,notInstalledFallback:q})=>{const{loading:ne,installed:ge}=usePluginBridge(le);return ne?oe??null:ge?React.createElement(React.Fragment,null,Z):q??null};function R(Z,le,oe){const q=new URLSearchParams(oe).toString();return`/a/${Z}${le}`+(q?"?"+q:"")}const _=({title:Z="",severity:le="",url:oe=""})=>{const q=R(k.W.Incident,"/incidents/declare",{title:Z,severity:le,url:oe}),{loading:ne,installed:ge,settings:ae}=(0,F.n)(k.W.Incident);return n.createElement(n.Fragment,null,ne===!0&&n.createElement(u.zx,{icon:"fire",size:"sm",type:"button",disabled:!0},"Declare Incident"),ge===!1&&n.createElement(N.u,{content:"Grafana Incident is not installed or is not configured correctly"},n.createElement(u.zx,{icon:"fire",size:"sm",type:"button",disabled:!0},"Declare Incident")),ae&&n.createElement(u.Qj,{icon:"fire",size:"sm",type:"button",href:q},"Declare Incident"))};var G=e(3764);const Y=({rule:Z,rulesSource:le,isViewMode:oe})=>{const q=(0,l.wW)(se),{namespace:ne,group:ge,rulerRule:ae}=Z,{StateHistoryModal:re,showStateHistoryModal:De}=M(),he=(0,h.useDispatch)(),ye=(0,i.TH)(),ce=(0,p.iG)(),[We,ke]=(0,n.useState)(),et=(0,A.HY)(le)?le:(0,O.Xy)(le.jsonData.alertmanagerUid)?.name,we=f.contextSrv.hasPermission(h.AccessControlAction.DataSourcesExplore),_e=[],Ge=[],qe=()=>{if(We&&We.rulerRule){const ct=W.Zk((0,A.EG)(We.namespace.rulesSource),We.namespace.name,We.group.name,We.rulerRule);he((0,S.hS)(ct,{navigateTo:oe?"/alerting/list":void 0})),ke(void 0)}},st=(0,w.Jq)(ge),Me=(0,A.EG)(le),be=(0,w.Pc)(Z.rulerRule)&&!!Z.rulerRule.grafana_alert.provenance,Ke=(0,w.x_)(Z.promRule)&&Z.promRule.state===y.x_.Firing,Ye=(0,x.Bz)(Me),tt=f.contextSrv.hasPermission(Ye.create),{isEditable:nt,isRemovable:Pt}=(0,D.M)(Me,ae),xt=Q(Z),bt=()=>(0,V.t6)(le,Z),Rt=ye.pathname+ye.search;if((0,A.jq)(le)&&we&&!st&&_e.push(n.createElement(u.Qj,{size:"sm",key:"explore",variant:"primary",icon:"chart-line",target:"__blank",href:(0,V.mH)(le,Z.query)},"See graph")),Z.annotations[B.q6.runbookURL]&&_e.push(n.createElement(u.Qj,{size:"sm",key:"runbook",variant:"primary",icon:"book",target:"__blank",href:s.QX.sanitizeUrl(Z.annotations[B.q6.runbookURL])},"View runbook")),Z.annotations[B.q6.dashboardUID]){const ct=Z.annotations[B.q6.dashboardUID];if(ct){_e.push(n.createElement(u.Qj,{size:"sm",key:"dashboard",variant:"primary",icon:"apps",target:"__blank",href:`d/${encodeURIComponent(ct)}`},"Go to dashboard"));const it=Z.annotations[B.q6.panelID];it&&_e.push(n.createElement(u.Qj,{size:"sm",key:"panel",variant:"primary",icon:"apps",target:"__blank",href:`d/${encodeURIComponent(ct)}?viewPanel=${encodeURIComponent(it)}`},"Go to panel"))}}if(xt&&et&&_e.push(n.createElement(u.Qj,{size:"sm",key:"silence",icon:"bell-slash",target:"__blank",href:(0,V.Vv)(et,Z)},"Silence")),(0,w.Pc)(Z.rulerRule)&&_e.push(n.createElement(n.Fragment,{key:"history"},n.createElement(u.zx,{size:"sm",icon:"history",onClick:()=>(0,w.Pc)(Z.rulerRule)&&De(Z.rulerRule)},"Show state history"),re)),Ke&&X()&&_e.push(n.createElement(n.Fragment,{key:"declare-incident"},n.createElement(_,{title:Z.name,url:bt()}))),oe&&ae){const ct=(0,A.EG)(le),it=W.Zk(ct,ne.name,ge.name,ae);if(nt&&!st&&(Ge.push(n.createElement(o.m,{key:"copy",icon:"copy",onClipboardError:me=>{ce.error("Error while copying URL",me)},size:"sm",getText:bt},"Copy link to rule")),!be)){const me=r.Cj.renderUrl(`${d.config.appSubUrl}/alerting/${encodeURIComponent(W.$V(it))}/edit`,{returnTo:Rt});Ge.push(n.createElement(u.Qj,{size:"sm",key:"edit",variant:"secondary",icon:"pen",href:me},"Edit"))}tt&&!st&&Ge.push(n.createElement(G.E,{key:"clone",text:"Copy",ruleIdentifier:it,isProvisioned:be})),Pt&&!st&&!be&&Ge.push(n.createElement(u.zx,{size:"sm",type:"button",key:"delete",variant:"secondary",icon:"trash-alt",onClick:()=>ke(Z)},"Delete"))}return _e.length||Ge.length?n.createElement(n.Fragment,null,n.createElement("div",{className:q.wrapper},n.createElement(m.Lh,{width:"auto"},_e.length?_e:n.createElement("div",null)),n.createElement(m.Lh,{width:"auto"},Ge.length?Ge:n.createElement("div",null))),!!We&&n.createElement(c.s,{isOpen:!0,title:"Delete rule",body:"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:qe,onDismiss:()=>ke(void 0)})):null};function X(){const Z=d.config.buildInfo,le=Z.edition===g.e.OpenSource,oe=Z.env==="development";return!le||oe}function Q(Z){const le=(0,w.Pc)(Z.rulerRule),{useGetAlertmanagerChoiceStatusQuery:oe}=v.alertmanagerApi,{currentData:q,isLoading:ne}=oe(void 0,{skip:!le});if(!le||ne)return!1;const ge=f.contextSrv.hasAccess(h.AccessControlAction.AlertingInstanceCreate,f.contextSrv.isEditor),ae=q?.alertmanagersChoice===E.TE.External,re=q?.alertmanagersChoice===E.TE.All;return ge&&(!ae||re)}const se=Z=>({wrapper:(0,t.css)` padding: ${Z.spacing(2)} 0; display: flex; flex-direction: row; justify-content: space-between; flex-wrap: wrap; border-bottom: solid 1px ${Z.colors.border.medium}; `})},28542:(j,I,e)=>{"use strict";e.d(I,{J:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(95438),r=e(73104);function g(l){const u=(0,i.wW)(d),{annotations:o}=l,m=(0,s.XW)(o);return o.length===0?null:n.createElement("div",{className:u.annotations},o.map(([c,p])=>n.createElement(r.a,{key:c,annotationKey:c,value:p,valueLink:m.get(c)})))}const d=()=>({annotations:(0,t.css)` margin-top: 46px; `})},673:(j,I,e)=>{"use strict";e.d(I,{C:()=>u});var t=e(42844),n=e(27702),i=e(10864),s=e(66310),r=e(65946),g=e(22513),d=e(22446),l=e(1333);function u(m){const{rulesSource:c,rule:p}=m,f=(0,s.wW)(o),E=(0,n.useMemo)(()=>{if((0,g.jq)(c))return[{name:c.name,icon:c.meta.info.logos.small}];if((0,d.Pc)(p.rulerRule)){const{data:h}=p.rulerRule.grafana_alert,y=h.reduce((v,D)=>{const a=(0,i.F)().getInstanceSettings(D.datasourceUid);return!a||a.uid===r.Yq||(v[a.name]={name:a.name,icon:a.meta.info.logos.small}),v},{});return Object.values(y)}return[]},[p,c]);return E.length===0?null:n.createElement(l.C,{label:"Data source"},E.map(({name:h,icon:y},v)=>n.createElement("div",{key:h},y&&n.createElement(n.Fragment,null,n.createElement("img",{alt:`${h} datasource logo`,className:f.dataSourceIcon,src:y})," "),h)))}function o(m){const c=m.spacing(2);return{dataSourceIcon:(0,t.css)` width: ${c}; height: ${c}; `}}},13932:(j,I,e)=>{"use strict";e.d(I,{C:()=>h});var t=e(42844),n=e(27702),i=e(22513),s=e(1333),r=e(6570),g=e(73817),d=e(54916),l=e(80553),u=e(66310),o=e(62434),m=e(60692),c=e(49325);const p=({language:v,expr:D})=>{const a=(0,n.useMemo)(()=>[(0,d.Z)({onlyIn:P=>P.type==="code_block",getSyntax:()=>v},{...r.languages,[v]:v==="logql"?o.ZP:m.ZP})],[v]),C=(0,n.useMemo)(()=>(0,l.l1)(D),[D]);return n.createElement(g.ML,{"data-testid":"expression-editor",plugins:a,value:C})},f=({expression:v,rulesSource:D})=>{const a=(0,u.wW)(E);return n.createElement(c.t,{className:(0,t.cx)(a.well,"slate-query-field")},(0,i.jq)(D)?n.createElement(p,{expr:v,language:D.type===i.ye.Loki?"logql":"promql"}):v)},E=v=>({well:(0,t.css)` font-family: ${v.typography.fontFamilyMonospace}; `});function h(v){const{annotations:D,rulesSource:a,rule:C}=v,P=y();return(0,i.jq)(a)?n.createElement(s.C,{label:"Expression",horizontal:!0,className:(0,t.cx)({[P.exprRow]:!!D.length})},n.createElement(f,{expression:C.query,rulesSource:a})):null}const y=()=>({exprRow:(0,t.css)` margin-bottom: 46px; `})},33468:(j,I,e)=>{"use strict";e.d(I,{M:()=>b});var t=e(42844),n=e(89949),i=e(27702),s=e(7662),r=e(66310),g=e(66670),d=e(71444),l=e(65333),u=e(79978),o=e(40705),m=e(18447);const c=({className:S,onStateFilterChange:x,stateFilter:O,filterType:B,itemPerStateStats:A})=>{const V=(0,r.wW)(p),W=H=>function(){return A&&A[H]?i.createElement(l.V,{name:A[H].toFixed(0),colorIndex:9,className:V.tag}):null},w=Object.values(m.bj).map(H=>({label:H,value:H,component:W(H)})),F=[m.x_.Firing,m.x_.Pending].map(H=>({label:(0,n.capitalize)(H),value:H,component:W(H)})),k=B==="grafana"?w:F;return i.createElement("div",{className:S,"data-testid":"alert-instance-state-filter"},i.createElement(u._,null,"State"),i.createElement(o.S,{options:k,value:O,onChange:x,onClick:H=>{H===O&&x(void 0)}}))};function p(S){return{tag:(0,t.css)` font-size: 11px; font-weight: normal; padding: ${S.spacing(.25,.5)}; vertical-align: middle; margin-left: ${S.spacing(.5)}; `}}var f=e(76658),E=e(39036),h=e(57183),y=e(22513),v=e(22446),D=e(1333),a=e(61404),C=e(94696);function P(S){const x=(0,r.wW)(T),{onClick:O,stats:B}=S;return i.createElement("div",{className:x.footerRow},i.createElement("div",null,"Showing ",B.visibleItemsCount," out of ",B.totalItemsCount," instances"),i.createElement(g.zx,{size:"sm",variant:"secondary","data-testid":"show-all",onClick:O},"Show all ",B.totalItemsCount," alert instances"))}function b(S){const x=(0,s.k6)(),{rule:{promRule:O,namespace:B,instanceTotals:A},itemsDisplayLimit:V=Number.POSITIVE_INFINITY,pagination:W,enableFiltering:w=!1}=S,[N,F]=(0,i.useState)(),[k,H]=(0,i.useState)(),[R]=(0,i.useState)(Math.floor(Math.random()*100)),_=`queryString-${R}`,G=(0,r.wW)(T),Y=(0,y.HY)(B.rulesSource)?y.GC:"prometheus",X=(0,i.useMemo)(()=>(0,v.x_)(O)&&O.alerts?.length?M(N,k,(0,E.Zl)(h.As.Importance,O.alerts)):[],[O,k,N]);if(!(0,v.x_)(O))return null;const Q=X.slice(0,V),se=(0,n.countBy)(O.alerts,he=>(0,m.ED)(he.state)),Z=(0,n.sum)(Object.values(A)),le=Z-Q.length,oe={totalItemsCount:Z,visibleItemsCount:Q.length},q=(0,E.V2)(B.rulesSource,S.rule,location.pathname+location.search),ne=(0,C.r0)(A),re=w?()=>H(void 0):()=>x.push(q),De=le?i.createElement(P,{stats:oe,onClick:re}):void 0;return i.createElement(D.C,{label:"Matching instances",horizontal:!0},w&&i.createElement("div",{className:(0,t.cx)(G.flexRow,G.spaceBetween)},i.createElement("div",{className:G.flexRow},i.createElement(d.F,{className:G.rowChild,key:_,defaultQueryString:N,onFilterChange:he=>F(he)}),i.createElement(c,{className:G.rowChild,filterType:Y,stateFilter:k,onStateFilterChange:H,itemPerStateStats:se}))),!w&&i.createElement("div",{className:G.stats},ne),i.createElement(a.o,{instances:Q,pagination:W,footerRow:De}))}function M(S,x,O){let B=[...O];if(S){const A=(0,f.Zh)(S||"");B=B.filter(({labels:V})=>(0,f.eD)(V,A))}return x&&(B=B.filter(A=>(0,m.ED)(A.state)===x)),B}const T=S=>({flexRow:(0,t.css)` display: flex; flex-direction: row; align-items: flex-end; width: 100%; flex-wrap: wrap; margin-bottom: ${S.spacing(1)}; `,spaceBetween:(0,t.css)` justify-content: space-between; `,rowChild:(0,t.css)` margin-right: ${S.spacing(1)}; `,footerRow:(0,t.css)` display: flex; flex-direction: column; gap: ${S.spacing(1)}; justify-content: space-between; align-items: center; width: 100%; `,instancesContainer:(0,t.css)` margin-bottom: ${S.spacing(2)}; `,stats:(0,t.css)` display: flex; gap: ${S.spacing(1)}; padding: ${S.spacing(1,0)}; `})},94696:(j,I,e)=>{"use strict";e.d(I,{Pb:()=>c,WN:()=>m,r0:()=>p});var t=e(89949),n=e.n(t),i=e(6772),s=e.n(i),r=e(27702),g=e(23852),d=e(25357),l=e(68093),u=e(18447);const o={recording:0,alerting:0,[u.x_.Pending]:0,[u.x_.Inactive]:0,paused:0,error:0,nodata:0},m=({namespaces:f})=>{const E={...o};f.forEach(({groups:D})=>{D.forEach(a=>{const C=(0,t.omitBy)(a.totals,t.isUndefined);for(let P in C)E[P]+=C[P]})});const h=p(E),y=!!h.length,v=(0,t.sum)(Object.values(E));return h.unshift(r.createElement(r.Fragment,{key:"total"},v," ",s()("rule",v))),r.createElement(g.K,{direction:"row"},y&&r.createElement("div",null,r.createElement(g.K,{gap:.5},h)))},c=({group:f})=>{const E=f.totals,h=f?.interval,y=p(E),v=!!y.length;return r.createElement(g.K,{direction:"row"},v&&r.createElement("div",null,r.createElement(g.K,{gap:.5},y)),h&&r.createElement(r.Fragment,null,r.createElement("div",null,"|"),r.createElement(d.C,{text:h,icon:"clock-nine",color:"blue"})))};function p(f){const E=[];return f[l.P.Alerting]&&E.push(r.createElement(d.C,{color:"red",key:"firing",text:`${f[l.P.Alerting]} firing`})),f.error&&E.push(r.createElement(d.C,{color:"red",key:"errors",text:`${f.error} errors`})),f.nodata&&E.push(r.createElement(d.C,{color:"blue",key:"nodata",text:`${f.nodata} no data`})),f[l.P.Pending]&&E.push(r.createElement(d.C,{color:"orange",key:"pending",text:`${f[l.P.Pending]} pending`})),f[l.P.Normal]&&f.paused&&E.push(r.createElement(d.C,{color:"green",key:"paused",text:`${f[l.P.Normal]} normal (${f.paused} paused)`})),f[l.P.Normal]&&!f.paused&&E.push(r.createElement(d.C,{color:"green",key:"inactive",text:`${f[l.P.Normal]} normal`})),f.recording&&E.push(r.createElement(d.C,{color:"purple",key:"recording",text:`${f.recording} recording`})),E}},52467:(j,I,e)=>{"use strict";e.d(I,{DD:()=>D,Fm:()=>y,K$:()=>m,Kd:()=>p,ZP:()=>v,Zo:()=>u,bU:()=>o});var t=e(89949),n=e.n(t),i=e(27702),s=e(68093),r=e(18447),g=e(22513),d=e(22446),l=e(10027);function u(S,x){const O=(0,l._)(W=>W.promRules),B=(0,l._)(W=>W.rulerRules),A=(0,i.useRef)({}),V=(0,i.useMemo)(()=>{if(S){const W=(0,g.o_)(S);if(!W)throw new Error(`Unknown rules source: ${S}`);return[W]}return(0,g.h_)()},[S]);return(0,i.useMemo)(()=>V.map(W=>{const w=(0,g.jq)(W)?W.name:W,N=B[w]?.result;let F=O[w]?.result;w===g.GC&&x&&(F=x);const k=A.current[w];if(k&&k.promRules===F&&k.rulerRules===N)return k.result;const H={};Object.entries(N||{}).forEach(([_,G])=>{const Y={rulesSource:W,name:_,groups:[]};H[_]=Y,E(Y,G)}),F?.forEach(({name:_,groups:G})=>{const Y=H[_]=H[_]||{rulesSource:W,name:_,groups:[]};h(Y,G)});const R=Object.values(H);return A.current[w]={promRules:F,rulerRules:N,result:R},R}).flat(),[O,B,V,x])}function o(S,x,O){const B={};return Object.entries(O||{}).forEach(([A,V])=>{const W={rulesSource:S,name:A,groups:[]};B[A]=W,E(W,V)}),x?.forEach(({name:A,groups:V})=>{const W=B[A]=B[A]||{rulesSource:S,name:A,groups:[]};h(W,V)}),Object.values(B)}function m(S,x,O){const B={rulesSource:S,name:x.name,groups:[]};return E(B,O),h(B,x.groups),B.groups.forEach(A=>{A.rules=A.rules.filter(V=>V.promRule)}),B}function c(S,x,O){return E(S,O),h(S,x),S}function p(S){return S.map(x=>{const O={...x,groups:[]};return O.groups.push({name:"default",rules:f(x.groups.flatMap(B=>B.rules)),totals:a(x.groups)}),O})}function f(S){return S.sort((x,O)=>x.name.localeCompare(O.name))}function E(S,x=[]){S.groups=x.map(O=>{const B=O.rules.filter(W=>(0,d.yF)(W)).length,A=O.rules.filter(W=>(0,d.Pc)(W)&&W.grafana_alert.is_paused).length,V={name:O.name,interval:O.interval,source_tenants:O.source_tenants,rules:[],totals:{paused:A,recording:B}};return V.rules=O.rules.map(W=>P(W,S,V)),V})}function h(S,x){const O=new Map;S.groups.forEach(B=>O.set(B.name,B)),x.forEach(B=>{let A=O.get(B.name);A||(A={name:B.name,rules:[],totals:D(B)},S.groups.push(A),O.set(B.name,A)),A.totals={...A.totals,...D(B)};const V=new Map;A.rules.forEach(W=>{const w=V.get(W.name);w?w.push(W):V.set(W.name,[W])}),(B.rules??[]).forEach(W=>{const w=b(W,V,S.rulesSource);w?(w.promRule=W,w.instanceTotals=(0,d.x_)(W)?y(W):{},w.filteredInstanceTotals=(0,d.x_)(W)?v(W):{}):A.rules.push(C(W,S,A))})})}function y(S){const x=(0,t.countBy)(S.alerts,"state");if(S.totals){const{normal:O,...B}=S.totals;return{...B,inactive:O}}return{alerting:x[s.P.Alerting],pending:x[s.P.Pending],inactive:x[s.P.Normal],nodata:x[s.P.NoData],error:x[s.P.Error]+x.err}}function v(S){if(S.totalsFiltered){const{normal:x,...O}=S.totalsFiltered;return{...O,inactive:x}}return{}}function D(S){if(S.totals){const{firing:A,...V}=S.totals;return{...V,alerting:A}}const x=(0,t.countBy)(S.rules,A=>(0,d.x_)(A)&&A.state),O=(0,t.countBy)(S.rules,A=>A.health),B=S.rules.filter(A=>(0,d.OP)(A)).length;return{alerting:x[r.x_.Firing],error:O.error,nodata:O.nodata,inactive:x[r.x_.Inactive],pending:x[r.x_.Pending],recording:B}}function a(S){const x={};return S.forEach(O=>{const B=O.totals;Object.entries(B).forEach(([A,V])=>{x[A]||(x[A]=0),x[A]+=V})}),x}function C(S,x,O){return{name:S.name,query:S.query,labels:S.labels||{},annotations:(0,d.x_)(S)?S.annotations||{}:{},promRule:S,namespace:x,group:O,instanceTotals:(0,d.x_)(S)?y(S):{},filteredInstanceTotals:(0,d.x_)(S)?v(S):{}}}function P(S,x,O){return(0,d.cG)(S)?{name:S.alert,query:S.expr,labels:S.labels||{},annotations:S.annotations||{},rulerRule:S,namespace:x,group:O,instanceTotals:{},filteredInstanceTotals:{}}:(0,d.yF)(S)?{name:S.record,query:S.expr,labels:S.labels||{},annotations:{},rulerRule:S,namespace:x,group:O,instanceTotals:{},filteredInstanceTotals:{}}:{name:S.grafana_alert.title,query:"",labels:S.labels||{},annotations:S.annotations||{},rulerRule:S,namespace:x,group:O,instanceTotals:{},filteredInstanceTotals:{}}}function b(S,x,O){const B=x.get(S.name);if(!B)return;if((0,g.HY)(O))return B[0];const A=B.find(W=>!W.promRule&&M(W,S,!0));if(A)return A;const V=B.find(W=>!W.promRule&&M(W,S,!1));if(V)return V}function M(S,x,O=!0){return S.name===x.name?(0,t.isEqual)([O?T(S.query):"",S.labels,S.annotations],[O?T(x.query):"",x.labels||{},(0,d.x_)(x)?x.annotations||{}:{}]):!1}function T(S){return S.length>1&&S[0]==="("&&S[S.length-1]===")"&&(S=S.slice(1,-1)),S=S.replace(/\s|\n/g,""),S.split("").sort().join("")}},80171:(j,I,e)=>{"use strict";e.d(I,{W:()=>g});var t=e(27702),n=e(18771),i=e(47702),s=e(84369),r=e(10027);function g(d){const l=(0,n.useDispatch)(),u=(0,r._)(o=>o.folders);if((0,t.useEffect)(()=>{d&&l((0,i.sw)(d))},[l,d]),d){const o=u[d]||s.oq;return{folder:o.result,loading:o.loading}}return{loading:!1}}},99322:(j,I,e)=>{"use strict";e.d(I,{M:()=>d});var t=e(91368),n=e(37194),i=e(2082),s=e(22446),r=e(80171),g=e(10027);function d(l,u){const o=(0,g._)(a=>a.dataSources),{currentData:m,isLoading:c}=n.T.endpoints.discoverDsFeatures.useQuery({rulesSourceName:l}),p=u&&(0,s.Pc)(u)?u.grafana_alert.namespace_uid:void 0,f=(0,i.Bz)(l),{folder:E,loading:h}=(0,r.W)(p);if(!u)return{isEditable:!1,isRemovable:!1,loading:!1};if((0,s.Pc)(u)){if(!p)throw new Error(`Rule ${u.grafana_alert.title} does not have a folder uid, cannot determine if it is editable.`);if(!E)return{isEditable:!1,isRemovable:!1,loading:h};const a=E.canSave,C=t.contextSrv.hasAccessInMetadata(f.update,E,a),P=t.contextSrv.hasAccessInMetadata(f.delete,E,a);return{isEditable:C,isRemovable:P,loading:h||c}}const y=!!o[l]?.result?.rulerConfig||!!m?.rulerConfig,v=t.contextSrv.hasAccess(f.update,t.contextSrv.isEditor),D=t.contextSrv.hasAccess(f.delete,t.contextSrv.isEditor);return{isEditable:v&&y,isRemovable:D&&y,loading:c||o[l]?.loading}}},92367:(j,I,e)=>{"use strict";e.d(I,{h:()=>s});var t=e(89949),n=e.n(t),i=e(27702);function s(r,g=1,d){const[l,u]=(0,i.useState)(g),o=(0,i.useMemo)(()=>(0,t.chunk)(r,d),[r,d]),m=o.length,c=o[l-1]??[],p=(l-1)*d+1,f=(0,t.clamp)(l*d,r.length),E=(0,i.useCallback)(v=>{u((0,t.clamp)(v,1,o.length))},[u,o]),h=(0,i.useCallback)(()=>E(l+1),[l,E]),y=(0,i.useCallback)(()=>E(l-1),[l,E]);return(0,i.useEffect)(()=>u(1),[m]),{page:l,onPageChange:E,numberOfPages:m,pageItems:c,pageStart:p,pageEnd:f,nextPage:h,previousPage:y}}},76393:(j,I,e)=>{"use strict";e.d(I,{n:()=>i});var t=e(25111),n=e(67821);function i(s){const{loading:r,error:g,value:d}=(0,t.Z)(()=>(0,n.a)(s,{showErrorAlert:!1})),l=d&&!g&&!r,u=d?.enabled;return r&&!d?{loading:!0}:!l||!u?{loading:!1,installed:!1}:{loading:r,installed:!0,settings:d}}},10027:(j,I,e)=>{"use strict";e.d(I,{_:()=>n});var t=e(18771);function n(i,s){return(0,t.useSelector)(r=>i(r.unifiedAlerting),s)}},41028:(j,I,e)=>{"use strict";e.d(I,{VG:()=>F,HY:()=>H,ug:()=>k});var t=e(18447),n=e(22446);const i=1,s=2,r=3,g=4,d=5,l=6,u=7,o=8,m=9,c=10,p=11,f=12,E=0,h=1,y=2,v=3,D=4,a=5,C=6,P=7;var b=e(89949),M=e(55859);const T=M.WQ.deserialize({version:14,states:"!vOQOPOOOrOPO'#ChOOOO'#Ch'#ChOQOPO'#ClOOOO'#Ci'#CiQQOPOOO!gOQO'#C^O!lOPO'#CjO!qOPO,59SOOOO,59W,59WOOOO-E6g-E6gOOOO,58x,58xOOOO,59U,59UOOOO-E6h-E6h",stateData:"$O~ORUOTUOUUOVUOWUOXUOYUOZUOaPOcQO~ObVOR[XT[XU[XV[XW[XX[XY[XZ[Xa[Xc[X~OSZO~Oa[O~ObVOR[aT[aU[aV[aW[aX[aY[aZ[aa[ac[a~OR~T~U~V~W~Y~Z~RZYXWVUTa~",goto:"zaPPbPPPPPPPPPbgmPsVRORTQTORYTQWPR]WSSOTRXR",nodeNames:"\u26A0 AlertRuleSearch FilterExpression DataSourceToken FilterValue NameSpaceToken LabelToken GroupToken RuleToken StateToken TypeToken HealthToken FreeFormExpression",maxTerm:19,skippedNodes:[0],repeatNodeCount:2,tokenData:"#$QRRqqr#Yrs&fst#Ytu#Yuv#Yvw#Ywx#Yxy#Yyz#Yz{#Y{|#Y|!P#Y!P!Q#Y!Q![#Y![!]+h!]#W#Y#W#X,z#X#Z#Y#Z#[=b#[#]F[#]#`#Y#`#a!!n#a#b#Y#b#c!+h#c#f#Y#f#g!:f#g#h!Av#h#i!Jp#i$Ch#Y$JU;'S#Y;'S;(d&Y;(d;(e&`<%lO#YR#acSQaPqr#Yst#Ytu#Yuv#Yvw#Ywx#Yxy#Yyz#Yz{#Y{|#Y|!P#Y!P!Q#Y!Q![#Y![!]$l!]$Ch#Y$JU;'S#Y;'S;(d&Y;(d;(e&`<%lO#YQ$qcSQqr$lst$ltu$luv$lvw$lwx$lxy$lyz$lz{$l{|$l|!P$l!P!Q$l!Q![$l![!]$l!]$Ch$l$JU;'S$l;'S;(d%|;(d;(e&S<%lO$lQ&PP;=`<%l$lQ&VP;=`;NQ$lR&]P;=`<%l#YR&cP;=`;NQ#YR&irX^(spq(sqr(sst(stu(suv(svw(swx(sxy(syz(sz{(s{|(s|!P(s!P!Q(s!Q,S={[r]:"datasource",[d]:"namespace",[l]:"label",[o]:"rule",[u]:"group",[m]:"state",[c]:"type",[p]:"health"};var x=(_=>(_.dataSource="dataSourceFilter",_.nameSpace="nameSpaceFilter",_.label="labelFilter",_.group="groupFilter",_.rule="ruleFilter",_.state="stateFilter",_.type="typeFilter",_.health="healthFilter",_))(x||{});function O(_,G,Y){W(_,G,X=>{if(X.type.id===s){const Q=B(_,X);if(Q.type&&Q.value){const se=Y[Q.type];se&&se(Q.value)}}else if(X.type.id===f){const Q=Y[f];Q&&Q(A(_,X))}})}function B(_,G){if(G.type.id!==s)throw new Error("Invalid node provided. Only FilterExpression nodes are supported");const Y=G.firstChild;if(!Y)return{type:void 0,value:void 0};const X=G.getChild(g),Q=X?(0,b.trim)(A(_,X),'"'):void 0;return{type:Y.type.id,value:Q}}function A(_,G){return _.slice(G.from,G.to).trim().replace(/\"/g,"")}function V(_,G,Y){const X=[];W(_,G,se=>{se.type.id===s&&se.firstChild&&X.push(se.firstChild),se.type.id===f&&X.push(se)});let Q=[];return X.forEach(se=>{const Z=Y.findIndex(le=>le.type===se.type.id);if(Z!==-1){if(se.parent?.type.is(s)){const le=S[se.type.id],oe=Y.splice(Z,1)[0];Q.push(`${le}:${w(oe.value)}`)}if(se.type.is(f)){const le=Y.splice(Z,1)[0];Q.push(le.value)}}}),Y.forEach(se=>{se.type===f?Q.push(se.value):Q.push(`${S[se.type]}:${w(se.value)}`)}),Q.join(" ")}function W(_,G,Y){const X=G.join(" ");let se=T.configure({dialect:X}).parse(_).cursor();do Y(se.node);while(se.next())}function w(_){return/\s/.test(_)?`"${_}"`:_}const N=[x.dataSource,x.nameSpace,x.label,x.group,x.rule,x.state,x.type,x.health];var F=(_=>(_.Ok="ok",_.Error="error",_.NoData="nodata",_.Unknown="unknown",_))(F||{});function k(_){const G={labels:[],freeFormWords:[],dataSourceNames:[]},Y={[r]:X=>G.dataSourceNames.push(X),[d]:X=>G.namespace=X,[u]:X=>G.groupName=X,[o]:X=>G.ruleName=X,[l]:X=>G.labels.push(X),[m]:X=>G.ruleState=R(X),[c]:X=>(0,n.Wd)(X)?G.ruleType=X:void 0,[p]:X=>G.ruleHealth=(0,n.vU)(X),[f]:X=>G.freeFormWords.push(X)};return O(_,N,Y),G}function H(_,G){const Y=[];return G.dataSourceNames&&Y.push(...G.dataSourceNames.map(X=>({type:r,value:X}))),G.namespace&&Y.push({type:d,value:G.namespace}),G.groupName&&Y.push({type:u,value:G.groupName}),G.ruleName&&Y.push({type:o,value:G.ruleName}),G.ruleState&&Y.push({type:m,value:G.ruleState}),G.ruleType&&Y.push({type:c,value:G.ruleType}),G.ruleHealth&&Y.push({type:p,value:G.ruleHealth}),G.labels&&Y.push(...G.labels.map(X=>({type:l,value:X}))),G.freeFormWords&&Y.push(...G.freeFormWords.map(X=>({type:f,value:X}))),V(_,N,Y)}function R(_){if(_==="normal")return t.x_.Inactive;if((0,t.I9)(_))return _}},47702:(j,I,e)=>{"use strict";e.d(I,{QY:()=>ne,Nc:()=>ye,r0:()=>ce,X4:()=>ge,hS:()=>X,oE:()=>Y,S6:()=>ae,yO:()=>q,mS:()=>he,ei:()=>R,dV:()=>k,lB:()=>_,dB:()=>oe,on:()=>G,zy:()=>A,wE:()=>V,vL:()=>re,sw:()=>De,Ms:()=>Z,Vj:()=>se,dn:()=>w,y6:()=>B,UR:()=>W,IA:()=>F,nw:()=>H,je:()=>N,iH:()=>ke,wy:()=>Q,D8:()=>We,mM:()=>le,hv:()=>et,tg:()=>we});var t=e(34099),n=e(89949),i=e(26129),s=e(18447),r=e(45937),g=e(28722),d=e(58803),l=e(52646),u=e(73289);function o(Ge){return(0,u.i)().get("/api/annotations",{alertId:Ge}).then(qe=>qe?.sort(m))}function m(Ge,qe){const st=(Ke,Ye)=>Ke>Ye?-1:Ye>Ke?1:0,Me=st(Ge.timeEnd,qe.timeEnd);if(Me)return Me;const be=st(Ge.time,qe.time);return be||st(Ge.id,qe.id)}var c=e(55394),p=e(8014),f=e(21961),E=e(92089),h=e(72821),y=e(76658),v=e(22513),D=e(39036),a=e(84369),C=e(96437),P=e(85184),b=e(22446);function M(Ge){const qe=async nt=>{if((0,b.Kl)(nt)){const Pt=await(0,E.m6)(Ge);for(const[xt,bt]of Object.entries(Pt))for(const Rt of bt){const ct=Rt.rules.find(it=>(0,b.Pc)(it)&&it.grafana_alert?.uid===nt.uid);if(ct)return{group:Rt,ruleSourceName:v.GC,namespace:xt,rule:ct}}}if((0,b.E4)(nt)){const{ruleSourceName:Pt,namespace:xt,groupName:bt}=nt,Rt=await(0,E.jJ)(Ge,xt,bt);if(!Rt)return null;const ct=Rt.rules.find(it=>{const me=C.Zk(Pt,xt,Rt.name,it);return C.Dg(me,nt)});return ct?{group:Rt,ruleSourceName:Pt,namespace:xt,rule:ct}:null}if((0,b.qE)(nt))throw new Error("Native prometheus rules can not be edited in grafana.");return null},st=async nt=>{const{namespace:Pt,group:xt,rule:bt}=nt;if(xt.rules.length===1){await(0,E.BC)(Ge,Pt,xt.name);return}await(0,E.P4)(Ge,Pt,{...xt,rules:xt.rules.filter(Rt=>Rt!==bt)})},Me=async(nt,Pt,xt)=>{const{dataSourceName:bt,group:Rt,namespace:ct}=nt,it=(0,P.yh)(nt);if(bt&&Rt&&ct){if(xt){const Ce=await qe(C.CK(xt));if(!Ce)throw new Error("Rule not found.");if(Ce.namespace!==ct||Ce.group.name!==Rt)await st(Ce);else{const Ae={...Ce.group,rules:Ce.group.rules.map(ze=>ze===Ce.rule?it:ze),evaluateEvery:Pt};return await(0,E.P4)(Ge,ct,Ae),C.Zk(bt,ct,Rt,it)}}const me=await(0,E.jJ)(Ge,ct,Rt),Ee=me?{...me,rules:[...me.rules,it]}:{name:Rt,rules:[it]};return await(0,E.P4)(Ge,ct,Ee),C.Zk(bt,ct,Rt,it)}else throw new Error("Data source and location must be specified")},be=async(nt,Pt,xt)=>{const{folder:bt,group:Rt}=nt;if(!bt)throw new Error("Folder must be specified");const ct=(0,P.mI)(nt),it=bt.title,me={name:Rt,interval:Pt};if(!xt)return Ke(it,me,ct);const Ee=await qe(C.CK(xt));if(!Ee)throw new Error("Rule not found.");const Ce=Ee.namespace===it,Ae=Ee.group.name===nt.group;return Ce&&Ae?tt(Ee,ct,Pt):Ye(it,me,Ee,ct)},Ke=async(nt,Pt,xt)=>{const bt=await(0,E.jJ)(Ge,nt,Pt.name);if(!bt)throw new Error(`No group found with name "${Pt.name}"`);const Rt={name:Pt.name,interval:Pt.interval,rules:(bt.rules??[]).concat(xt)};return await(0,E.P4)(Ge,nt,Rt),{uid:xt.grafana_alert.uid??"",ruleSourceName:v.GC}},Ye=async(nt,Pt,xt,bt)=>(T(xt,bt),await Ke(nt,Pt,bt)),tt=async(nt,Pt,xt)=>{T(nt,Pt);const bt=nt.group.rules.map(Rt=>(0,b.Pc)(Rt)&&Rt.grafana_alert.uid===nt.rule.grafana_alert.uid?Pt:Rt);return await(0,E.P4)(Ge,nt.namespace,{name:nt.group.name,interval:xt,rules:bt}),{uid:nt.rule.grafana_alert.uid,ruleSourceName:v.GC}};return{findEditableRule:qe,deleteRule:st,saveLotexRule:Me,saveGrafanaRule:be}}function T(Ge,qe){if(!(0,b.Pc)(Ge.rule))throw new Error("The rule is not a Grafana managed rule");const st=Ge.rule.grafana_alert.uid;qe.grafana_alert.uid=st}var S=e(447);function x(Ge,qe){const Me=Ge().unifiedAlerting.dataSources[qe]?.result;if(!Me)throw new Error(`Data source configuration is not available for "${qe}" data source`);return Me}function O(Ge,qe){const st=x(Ge,qe);if(!st.rulerConfig)throw new Error(`Ruler API is not available for ${qe}`);return st.rulerConfig}const B=(0,t.hg)("unifiedalerting/fetchPromRules",async({rulesSourceName:Ge,filter:qe,limitAlerts:st,matcher:Me,state:be,identifier:Ke},Ye)=>{await Ye.dispatch(H({rulesSourceName:Ge}));const tt=(0,g.pM)(f.j,`[${Ge}] Prometheus rules loaded`,{dataSourceName:Ge,thunk:"unifiedalerting/fetchPromRules"});return await(0,a.$b)(tt(Ge,qe,st,Me,be,Ke))}),A=(0,t.hg)("unifiedAlerting/fetchExternalAlertmanagers",()=>(0,a.$b)((0,d.$l)())),V=(0,t.hg)("unifiedAlerting/fetchExternAlertmanagersConfig",()=>(0,a.$b)((0,d.Zo)())),W=(0,t.hg)("unifiedalerting/fetchRulerRules",async({rulesSourceName:Ge,filter:qe},{dispatch:st,getState:Me})=>{await st(H({rulesSourceName:Ge}));const be=O(Me,Ge),Ke=(0,g.pM)(E.m6,`[${Ge}] Ruler rules loaded`,{dataSourceName:Ge,thunk:"unifiedalerting/fetchRulerRules"});return await(0,a.$b)(Ke(be,qe))});function w({rulesSourceName:Ge,identifier:qe,filter:st,limitAlerts:Me,matcher:be,state:Ke}){return async(Ye,tt)=>{await Ye(H({rulesSourceName:Ge}));const nt=x(tt,Ge);await Ye(B({rulesSourceName:Ge,identifier:qe,filter:st,limitAlerts:Me,matcher:be,state:Ke})),nt.rulerConfig&&await Ye(W({rulesSourceName:Ge}))}}const N=(0,t.hg)("unifiedalerting/fetchSilences",Ge=>{const qe=(0,g.pM)(d.U7,`[${Ge}] Silences loaded`,{dataSourceName:Ge,thunk:"unifiedalerting/fetchSilences"});return(0,a.$b)(qe(Ge))});function F(Ge){return(qe,st)=>{const{rulerRules:Me}=st().unifiedAlerting,be=Me[Ge];(0,n.isEmpty)(be?.result)&&!(be&&(0,b.m$)(be))&&!be?.loading&&qe(W({rulesSourceName:Ge}))}}function k(){return async Ge=>{const qe=(0,v.mA)().map(st=>Ge(H({rulesSourceName:st})));await Promise.allSettled(qe)}}const H=(0,t.hg)("unifiedalerting/fetchPromBuildinfo",async({rulesSourceName:Ge})=>(0,a.$b)((async()=>{if(Ge===v.GC)return{name:v.GC,id:v.GC,rulerConfig:{dataSourceName:v.GC,apiVersion:"legacy"}};const qe=(0,v.VX)(Ge);if(!qe)throw new Error(`Missing data source configuration for ${Ge}`);const{id:st,name:Me}=qe,Ke=await(0,g.pM)(c.C$,`[${Ge}] Rules source features discovered`,{dataSourceName:Ge,thunk:"unifiedalerting/fetchPromBuildinfo"})(Me),Ye=Ke.features.rulerApiEnabled?{dataSourceName:Me,apiVersion:Ke.application===s.T8.Cortex?"legacy":"config"}:void 0;return{name:Me,id:st,rulerConfig:Ye}})()),{condition:({rulesSourceName:Ge},{getState:qe})=>{const st=qe().unifiedAlerting.dataSources,Me=!!st[Ge]?.result,be=!!st[Ge]?.error;return!(Me||be)}});function R(Ge=!1,qe={}){return async(st,Me)=>{const be=performance.now();await Promise.allSettled((0,v.mA)().map(async Ke=>{await st(H({rulesSourceName:Ke}));const{promRules:Ye,rulerRules:tt,dataSources:nt}=Me().unifiedAlerting,Pt=nt[Ke].result;if(!Pt)return;const xt=Ge||!Ye[Ke]?.loading,bt=(Ge||!tt[Ke]?.loading)&&!!Pt.rulerConfig;await Promise.allSettled([xt&&st(B({rulesSourceName:Ke,...qe})),bt&&st(W({rulesSourceName:Ke}))])})),(0,g.PN)("All Prom and Ruler rules loaded",{loadTimeMs:(performance.now()-be).toFixed(0)})}}function _(Ge=!1){return async(qe,st)=>{const{promRules:Me}=st().unifiedAlerting;(0,v.mA)().map(be=>{(Ge||!Me[be]?.loading)&&qe(B({rulesSourceName:be}))})}}const G=(0,t.hg)("unifiedalerting/fetchEditableRule",(Ge,qe)=>{const st=O(qe.getState,Ge.ruleSourceName);return(0,a.$b)(M(st).findEditableRule(Ge))});function Y(Ge,qe){return async(st,Me)=>{(0,a.Ez)((async()=>{const be=(0,v.EG)(Ge.rulesSource),Ke=O(Me,be);await(0,E.BC)(Ke,Ge.name,qe.name),await st(w({rulesSourceName:be}))})(),{successMessage:"Group deleted"})}}function X(Ge,qe={}){return async(st,Me)=>{(0,a.Ez)((async()=>{const be=O(Me,Ge.ruleSourceName),Ke=M(be),Ye=await Ke.findEditableRule(Ge);if(!Ye)throw new Error("Rule not found.");await Ke.deleteRule(Ye),await st(w({rulesSourceName:Ye.ruleSourceName})),qe.navigateTo&&i.E1.replace(qe.navigateTo)})(),{successMessage:"Rule deleted."})}}const Q=(0,t.hg)("unifiedalerting/saveRuleForm",({values:Ge,existing:qe,redirectOnSave:st,evaluateEvery:Me},be)=>(0,a.Ez)((0,a.$b)((async()=>{const{type:Ke}=Ge;let Ye;if(Ke===h.$.cloudAlerting||Ke===h.$.cloudRecording){if(!Ge.dataSourceName)throw new Error("The Data source has not been defined.");const tt=O(be.getState,Ge.dataSourceName);Ye=await M(tt).saveLotexRule(Ge,Me,qe),await be.dispatch(W({rulesSourceName:Ge.dataSourceName}))}else if(Ke===h.$.grafana){const tt=O(be.getState,v.GC);Ye=await M(tt).saveGrafanaRule(Ge,Me,qe),await be.dispatch(W({rulesSourceName:v.GC}))}else throw new Error("Unexpected rule form type");if((0,g.PN)(g.z7.successSavingAlertRule,{type:Ke,isNew:(!qe).toString()}),st)i.E1.push(st);else{const tt=C.$V(Ye);if(!tt){i.E1.push("/alerting/list");return}const nt=`/alerting/${encodeURIComponent(tt)}/edit`;i.E1.getLocation().pathname!==nt?i.E1.replace(nt):be.dispatch(G(Ye))}})()),{successMessage:qe?`Rule "${Ge.name}" updated.`:`Rule "${Ge.name}" saved.`,errorMessage:"Failed to save rule"})),se=(0,t.hg)("unifiedalerting/fetchGrafanaNotifiers",()=>(0,a.$b)((0,p.i9)())),Z=(0,t.hg)("unifiedalerting/fetchGrafanaAnnotations",Ge=>(0,a.$b)(o(Ge))),le=(0,t.hg)("unifiedalerting/updateAMConfig",({alertManagerSourceName:Ge,oldConfig:qe,newConfig:st,successMessage:Me,redirectPath:be,redirectSearch:Ke},Ye)=>(0,a.Ez)((0,a.$b)((async()=>{const tt=await Ye.dispatch(l.alertmanagerApi.endpoints.getAlertmanagerConfiguration.initiate(Ge)).unwrap(),nt=(0,n.isEmpty)(tt.alertmanager_config)&&(0,n.isEmpty)(tt.template_files),Pt=JSON.stringify(tt)!==JSON.stringify(qe);if(!nt&&Pt)throw new Error("A newer Alertmanager configuration is available. Please reload the page and try again to not overwrite recent changes.");if(await(0,d.oy)(Ge,(0,y.X4)(st)),Ye.dispatch(l.alertmanagerApi.util.invalidateTags(["AlertmanagerConfiguration"])),be){const xt=new URLSearchParams(Ke??"");i.E1.push((0,D.eQ)(be,Ge,xt))}})()),{successMessage:Me})),oe=(0,t.hg)("unifiedalerting/fetchAmAlerts",Ge=>(0,a.$b)((0,d.QK)(Ge,[],!0,!0,!0))),q=(Ge,qe)=>async st=>{await(0,a.Ez)((0,d.iT)(Ge,qe),{successMessage:"Silence expired."}),st(N(Ge)),st(oe(Ge))},ne=(0,t.hg)("unifiedalerting/updateSilence",({alertManagerSourceName:Ge,payload:qe,exitOnSave:st,successMessage:Me})=>(0,a.Ez)((0,a.$b)((async()=>{await(0,d.dx)(Ge,qe),st&&i.E1.push("/alerting/silences")})()),{successMessage:Me})),ge=(Ge,qe)=>async st=>{const Me=await st(l.alertmanagerApi.endpoints.getAlertmanagerConfiguration.initiate(qe)).unwrap();if(!Me)throw new Error(`Config for ${qe} not found`);if(!Me.alertmanager_config.receivers?.find(Ke=>Ke.name===Ge))throw new Error(`Cannot delete receiver ${Ge}: not found in config.`);const be={...Me,alertmanager_config:{...Me.alertmanager_config,receivers:Me.alertmanager_config.receivers.filter(Ke=>Ke.name!==Ge)}};return st(le({newConfig:be,oldConfig:Me,alertManagerSourceName:qe,successMessage:"Contact point deleted."}))},ae=(Ge,qe)=>async st=>{const Me=await st(l.alertmanagerApi.endpoints.getAlertmanagerConfiguration.initiate(qe)).unwrap();if(!Me)throw new Error(`Config for ${qe} not found`);if(typeof Me.template_files?.[Ge]!="string")throw new Error(`Cannot delete template ${Ge}: not found in config.`);const be={...Me.template_files};delete be[Ge];const Ke={...Me,alertmanager_config:{...Me.alertmanager_config,templates:Me.alertmanager_config.templates?.filter(Ye=>Ye!==Ge)},template_files:be};return st(le({newConfig:Ke,oldConfig:Me,alertManagerSourceName:qe,successMessage:"Template deleted."}))},re=(0,t.hg)("unifiedalerting/fetchFolder",Ge=>(0,a.$b)(r.ae.getFolderByUid(Ge,{withAccessControl:!0}))),De=Ge=>(qe,st)=>{st().unifiedAlerting.folders[Ge]?.dispatched||qe(re(Ge))},he=(0,t.hg)("unifiedalerting/fetchAlertGroups",Ge=>(0,a.$b)((0,d.XK)(Ge))),ye=(0,t.hg)("unifiedalerting/deleteAlertManagerConfig",async(Ge,qe)=>(0,a.Ez)((0,a.$b)((async()=>{await(0,d.CN)(Ge),await qe.dispatch(l.alertmanagerApi.util.invalidateTags(["AlertmanagerConfiguration"]))})()),{errorMessage:"Failed to reset Alertmanager configuration",successMessage:"Alertmanager configuration reset."})),ce=(Ge,qe)=>async st=>{const Me=await st(l.alertmanagerApi.endpoints.getAlertmanagerConfiguration.initiate(Ge)).unwrap(),be=Me?.alertmanager_config?.mute_time_intervals?.filter(({name:Ke})=>Ke!==qe)??[];Me&&(0,a.Ez)(st(le({alertManagerSourceName:Ge,oldConfig:Me,newConfig:{...Me,alertmanager_config:{...Me.alertmanager_config,route:Me.alertmanager_config.route?(0,y.rU)(qe,Me.alertmanager_config?.route):void 0,mute_time_intervals:be}}})),{successMessage:`Deleted "${qe}" from Alertmanager configuration`,errorMessage:"Failed to delete mute timing"})},We=(0,t.hg)("unifiedalerting/testReceivers",({alertManagerSourceName:Ge,receivers:qe,alert:st})=>(0,a.Ez)((0,a.$b)((0,d.Bp)(Ge,qe,st)),{errorMessage:"Failed to send test alert.",successMessage:"Test alert sent."})),ke=(Ge,qe)=>Ge.filter(st=>{const{forDuration:Me}=(0,b.qd)(st,qe),be=(0,S.Bg)(Me),Ke=(0,S.Bg)(qe);return be!==0&&be<Ke}),et=(0,t.hg)("unifiedalerting/updateLotexNamespaceAndGroup",async(Ge,qe)=>(0,a.Ez)((0,a.$b)((async()=>{const{rulesSourceName:st,namespaceName:Me,groupName:be,newNamespaceName:Ke,newGroupName:Ye,groupInterval:tt}=Ge,nt=O(qe.getState,st),Pt=await(0,E.m6)(nt);if(!!!Pt[Me])throw new Error(`Namespace "${Me}" not found.`);const bt=Pt[Me].find(it=>it.name===be);if(!bt)throw new Error(`Group "${be}" not found.`);const Rt=!!Pt[Me].find(it=>it.name===Ye);if(Ye!==be&&Rt)throw new Error(`Group "${Ye}" already exists in namespace "${Me}".`);const ct=!!Pt[Ke];if(Ke!==Me&&ct)throw new Error(`Namespace "${Ke}" already exists.`);if(Ke===Me&&be===Ye&&tt===bt.interval)throw new Error("Nothing changed.");if(tt!==bt.interval){const it=ke(bt.rules,tt??"1m");if(it.length>0)throw new Error(`These alerts belonging to this group will have an invalid 'For' value: ${it.map(me=>{const{alertName:Ee}=(0,b.qd)(me,tt??"");return Ee}).join(",")}`)}if(Ke!==Me){for(const it of Pt[Me])await(0,E.P4)(nt,Ke,it.name===be?{...it,name:Ye,interval:tt}:it);await(0,E.sz)(nt,Me)}else await(0,E.P4)(nt,Me,{...bt,name:Ye,interval:tt}),Ye!==be&&await(0,E.BC)(nt,Me,be);await qe.dispatch(W({rulesSourceName:st}))})()),{errorMessage:"Failed to update namespace / group",successMessage:"Update successful"})),we=(0,t.hg)("unifiedalerting/updateRulesOrderForGroup",async(Ge,qe)=>(0,a.Ez)((0,a.$b)((async()=>{const{rulesSourceName:st,namespaceName:Me,groupName:be,newRules:Ke}=Ge,Ye=O(qe.getState,st),nt=(await(0,E.m6)(Ye))[Me].find(xt=>xt.name===be);if(!nt)throw new Error(`Group "${be}" not found.`);const Pt={name:nt.name,interval:nt.interval,rules:Ke};await(0,E.P4)(Ye,Me,Pt),await qe.dispatch(W({rulesSourceName:st}))})()),{errorMessage:"Failed to update namespace / group",successMessage:"Update successful"})),_e=(0,t.hg)("unifiedAlerting/addExternalAlertmanagers",async(Ge,qe)=>(0,a.Ez)((0,a.$b)((async()=>{await(0,d.tK)(Ge),qe.dispatch(V())})()),{errorMessage:"Failed adding alertmanagers",successMessage:"Alertmanagers updated"}))},14117:(j,I,e)=>{"use strict";e.d(I,{r:()=>i});var t=e(42844),n=e(62862);const i=s=>({[n.Z9.Active]:(0,t.css)` color: ${s.colors.error.text}; `,[n.Z9.Suppressed]:(0,t.css)` color: ${s.colors.primary.text}; `,[n.Z9.Unprocessed]:(0,t.css)` color: ${s.colors.secondary.text}; `})},36148:(j,I,e)=>{"use strict";e.d(I,{Z:()=>n});var t=e(42844);const n=i=>(0,t.css)` float: none; display: flex; justify-content: flex-start; margin: ${i.spacing(2,0)}; `},62401:(j,I,e)=>{"use strict";e.d(I,{W:()=>t});var t=(n=>(n.Incident="grafana-incident-app",n.OnCall="grafana-oncall-app",n.MachineLearning="grafana-ml-app",n))(t||{})},72821:(j,I,e)=>{"use strict";e.d(I,{$:()=>t});var t=(n=>(n.grafana="grafana",n.cloudAlerting="cloud-alerting",n.cloudRecording="cloud-recording",n))(t||{})},42439:(j,I,e)=>{"use strict";e.d(I,{t:()=>t});var t=(n=>(n.seconds="s",n.minutes="m",n.hours="h",n.days="d",n.weeks="w",n))(t||{})},2082:(j,I,e)=>{"use strict";e.d(I,{Bz:()=>c,Fo:()=>d,Ko:()=>m,Ob:()=>g,QX:()=>o,Rv:()=>f,ql:()=>p});var t=e(91368),n=e(309),i=e(18771),s=e(22513);function r(E){return(0,s.HY)(E)?"grafana":"external"}const g={read:{grafana:i.AccessControlAction.AlertingInstanceRead,external:i.AccessControlAction.AlertingInstancesExternalRead},create:{grafana:i.AccessControlAction.AlertingInstanceCreate,external:i.AccessControlAction.AlertingInstancesExternalWrite},update:{grafana:i.AccessControlAction.AlertingInstanceUpdate,external:i.AccessControlAction.AlertingInstancesExternalWrite},delete:{grafana:i.AccessControlAction.AlertingInstanceUpdate,external:i.AccessControlAction.AlertingInstancesExternalWrite}},d={read:{grafana:i.AccessControlAction.AlertingNotificationsRead,external:i.AccessControlAction.AlertingNotificationsExternalRead},create:{grafana:i.AccessControlAction.AlertingNotificationsWrite,external:i.AccessControlAction.AlertingNotificationsExternalWrite},update:{grafana:i.AccessControlAction.AlertingNotificationsWrite,external:i.AccessControlAction.AlertingNotificationsExternalWrite},delete:{grafana:i.AccessControlAction.AlertingNotificationsWrite,external:i.AccessControlAction.AlertingNotificationsExternalWrite}},l={read:i.AccessControlAction.AlertingProvisioningRead,write:i.AccessControlAction.AlertingProvisioningWrite},u={read:{grafana:i.AccessControlAction.AlertingRuleRead,external:i.AccessControlAction.AlertingRuleExternalRead},create:{grafana:i.AccessControlAction.AlertingRuleCreate,external:i.AccessControlAction.AlertingRuleExternalWrite},update:{grafana:i.AccessControlAction.AlertingRuleUpdate,external:i.AccessControlAction.AlertingRuleExternalWrite},delete:{grafana:i.AccessControlAction.AlertingRuleDelete,external:i.AccessControlAction.AlertingRuleExternalWrite}};function o(E){const h=r(E);return{read:g.read[h],create:g.create[h],update:g.update[h],delete:g.delete[h]}}function m(E){const h=r(E);return{read:d.read[h],create:d.create[h],update:d.update[h],delete:d.delete[h],provisioning:l}}function c(E){const h=r(E);return{read:u.read[h],create:u.create[h],update:u.update[h],delete:u.delete[h]}}function p(E,h){return()=>t.contextSrv.evaluatePermission(()=>h,E)}function f(){return{canCreateGrafanaRules:t.contextSrv.hasAccess(i.AccessControlAction.FoldersRead,t.contextSrv.hasEditPermissionInFolders)&&t.contextSrv.hasAccess(u.create.grafana,t.contextSrv.hasEditPermissionInFolders),canCreateCloudRules:t.contextSrv.hasAccess(i.AccessControlAction.DataSourcesRead,t.contextSrv.isEditor)&&t.contextSrv.hasAccess(u.create.external,t.contextSrv.isEditor),canEditRules:E=>{const h=E===s.GC?t.contextSrv.hasEditPermissionInFolders:t.contextSrv.isEditor;return t.contextSrv.hasAccess(c(E).update,h)},canReadProvisioning:t.contextSrv.hasAccess(l.read,(0,n.RN)())}}},76658:(j,I,e)=>{"use strict";e.d(I,{FM:()=>l,J8:()=>x,X4:()=>g,Xy:()=>b,Zh:()=>v,_J:()=>f,cm:()=>p,eD:()=>a,m8:()=>O,nv:()=>o,qw:()=>B,rU:()=>d,tA:()=>h,u6:()=>T,uK:()=>M,v7:()=>S,vB:()=>C,xz:()=>y,zy:()=>m});var t=e(89949),n=e.n(t),i=e(62862),s=e(76384),r=e(22513);function g(A){return A.alertmanager_config.receivers||(A.alertmanager_config.receivers=[{name:"default "}]),A.alertmanager_config.route||(A.alertmanager_config.route={receiver:A.alertmanager_config.receivers[0].name}),A.template_files||(A.template_files={}),A}function d(A,V){return{...V,mute_time_intervals:V.mute_time_intervals?.filter(w=>w!==A)??[],routes:V.routes?.map(w=>d(A,w))}}function l(A,V,W){return{...W,mute_time_intervals:W.mute_time_intervals?.map(w=>w===V?A:w),routes:W.routes?.map(w=>l(A,V,w))}}function u(A,V){return(V.receiver===A||V.routes?.some(W=>u(A,W)))??!1}function o(A,V){return(V.alertmanager_config.route&&u(A,V.alertmanager_config.route))??!1}function m(A){return A.isEqual?A.isRegex?i._M.regex:i._M.equal:A.isRegex?i._M.notRegex:i._M.notEqual}function c(A){switch(A){case i._M.equal:return{isEqual:!0,isRegex:!1};case i._M.notEqual:return{isEqual:!1,isRegex:!1};case i._M.regex:return{isEqual:!0,isRegex:!0};case i._M.notRegex:return{isEqual:!1,isRegex:!0}}}function p(A){return{name:A.name,value:A.value,operator:m(A)}}function f(A){return{name:A.name,value:A.value,...c(A.operator)}}function E(A){return`{${A.map(p).reduce((w,N)=>{const F=`${N.name}${N.operator}"${N.value}"`;return w?`${w},${F}`:F},"")}}`}const h=[{label:i._M.equal,description:"Equals",value:i._M.equal},{label:i._M.notEqual,description:"Does not equal",value:i._M.notEqual},{label:i._M.regex,description:"Matches regex",value:i._M.regex},{label:i._M.notRegex,description:"Does not match regex",value:i._M.notRegex}];function y(A){const V=m(A);return[A.name,V,A.value]}function v(A){const V=/\b([\w.-]+)(=~|!=|!~|=(?="?\w))"?([^"\n,}]*)"?/g,W=[];return A.replace(V,(w,N,F,k)=>{const H=F===i._M.equal||F===i._M.regex,R=F===i._M.regex||F===i._M.notRegex;return W.push({name:N,value:R?D(k.trim()):k.trim(),isEqual:H,isRegex:R}),""}),W}function D(A){try{return new RegExp(A),A}catch{return""}}function a(A,V){return V.every(({name:W,value:w,isRegex:N,isEqual:F})=>Object.entries(A).some(([k,H])=>{const R=W===k;let _;return F&&!N&&(_=w===H),!F&&!N&&(_=w!==H),F&&N&&(_=new RegExp(w).test(H)),!F&&N&&(_=!new RegExp(w).test(H)),R&&_}))}function C(...A){const V=A.map(v).flat(),W=(0,t.uniqWith)(V,t.isEqual);return E(W)}function P(){return(0,s.x)().filter(A=>A.type===r.ye.Alertmanager)}function b(A){return P().find(V=>A===V.uid)}function M(A){const{times:V,weekdays:W,days_of_month:w,months:N,years:F,location:k}=A,H=T(V,k),R=S(W),_=x(w),G=O(N),Y=B(F);return[H,R,_,G,Y].join(", ")}function T(A,V){return"Times: "+(A?A?.map(({start_time:W,end_time:w})=>`${W} - ${w} [${V??"UTC"}]`).join(" and "):"All")}function S(A){return"Weekdays: "+(A?.map(V=>{if(V.includes(":"))return V.split(":").map(W=>{const w=W.slice(0,3);return w[0].toLocaleUpperCase()+w.slice(1)}).join("-");{const W=V.slice(0,3);return W[0].toLocaleUpperCase()+W.slice(1)}}).join(", ")??"All")}function x(A){return"Days of the month: "+(A?.join(", ")??"All")}function O(A){return"Months: "+(A?.join(", ")??"All")}function B(A){return"Years: "+(A?.join(", ")??"All")}},95438:(j,I,e)=>{"use strict";e.d(I,{$9:()=>r,XW:()=>g});var t=e(27702),n=e(33555),i=e(39036);function s(d){return{dashboardUID:d.find(([l])=>l===n.q6.dashboardUID)?.[1],panelId:d.find(([l])=>l===n.q6.panelID)?.[1]}}function r(d){return(0,t.useMemo)(()=>Object.entries(d||{}).filter(([l,u])=>!!u.trim()),[d])}function g(d){const l=new Map,{panelId:u,dashboardUID:o}=s(d);return o&&l.set(n.q6.dashboardUID,(0,i.RQ)(o)),o&&u&&l.set(n.q6.panelID,(0,i.yM)(o,u)),l}},76384:(j,I,e)=>{"use strict";e.d(I,{f:()=>s,x:()=>i});var t=e(34667),n=e(447);function i(){return Object.values(t.config.datasources)}function s(r){if(!(0,n.wd)(t.config.unifiedAlerting.minInterval))return{globalLimit:0,exceedsLimit:!1};const g=(0,n.nd)(t.config.unifiedAlerting.minInterval);if(!r||!(0,n.wd)(r))return{globalLimit:g,exceedsLimit:!1};const d=(0,n.nd)(r),l=g>d&&d>0;return{globalLimit:g,exceedsLimit:l}}},33555:(j,I,e)=>{"use strict";e.d(I,{_y:()=>p,c4:()=>i,cm:()=>r,de:()=>s,eY:()=>f,iF:()=>g,jZ:()=>t,m4:()=>d,p4:()=>n,q6:()=>m,vY:()=>c});const t="ruler not supported",n=2e4,i="alertmanager",s="alerting-alertmanager",r=2e4,g=2e4,d=2e4,l="timeseries",u="table",o="stat";var m=(E=>(E.description="description",E.summary="summary",E.runbookURL="runbook_url",E.alertId="__alertId__",E.dashboardUID="__dashboardUid__",E.panelID="__panelId__",E))(m||{});const c={description:"Description",summary:"Summary",runbook_url:"Runbook URL",__dashboardUid__:"Dashboard UID",__panelId__:"Panel ID",__alertId__:"Alert ID"},p={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__:""},f=[{key:"summary",value:""},{key:"description",value:""},{key:"runbook_url",value:""}]},22513:(j,I,e)=>{"use strict";e.d(I,{EG:()=>C,Eu:()=>m,GC:()=>d,G_:()=>W,HY:()=>T,JY:()=>l,LE:()=>y,P:()=>V,RY:()=>M,Rz:()=>f,VX:()=>c,aM:()=>p,c$:()=>S,gt:()=>B,h_:()=>a,jq:()=>b,mA:()=>D,o_:()=>x,v_:()=>P,ye:()=>u,z3:()=>h});var t=e(10864),n=e(91368),i=e(62862),s=e(18771),r=e(2082),g=e(76384);const d="grafana",l="-- Grafana --";var u=(w=>(w.Alertmanager="alertmanager",w.Loki="loki",w.Prometheus="prometheus",w))(u||{});const o=["loki","prometheus"];function m(){return n.contextSrv.hasPermission(s.AccessControlAction.AlertingRuleExternalRead)?(0,g.x)().filter(w=>o.includes(w.type)&&w.jsonData.manageAlerts!==!1).sort((w,N)=>w.name.localeCompare(N.name)):[]}function c(w){return m().find(N=>N.name===w)}function p(){return(0,g.x)().filter(w=>w.type==="alertmanager").sort((w,N)=>w.name.localeCompare(N.name))}function f(){return p().filter(w=>w.jsonData.handleGrafanaManagedAlerts)}const E={name:d,imgUrl:"public/img/grafana_icon.svg"};function h(){return[E,...p().map(w=>({name:w.name,displayName:w.name,imgUrl:w.meta.info.logos.small,meta:w.meta}))]}function y(w){const N=[],F={instance:r.Ob.read,notification:r.Fo.read};if(n.contextSrv.hasPermission(F[w].grafana)&&N.push(E),n.contextSrv.hasPermission(F[w].external)){const k=p().map(H=>({name:H.name,displayName:H.name,imgUrl:H.meta.info.logos.small,meta:H.meta}));N.push(...k)}return N}function v(w){const N=S(w);if(!N)throw new Error(`Data source ${w} not found`);if(N.type!=="loki"&&N.type!=="prometheus")throw new Error(`Unexpected data source type ${N.type}`);return N}function D(){const w=m().map(N=>N.name);return n.contextSrv.hasPermission(s.AccessControlAction.AlertingRuleRead)&&w.push(d),w}function a(){const w=m();return n.contextSrv.hasPermission(s.AccessControlAction.AlertingRuleRead)&&w.push(d),w}function C(w){return b(w)?w.name:w}function P(w){return b(w)?w.uid:d}function b(w){return w!==d}function M(w){return w!==d&&S(w)?.jsonData?.implementation===i.sK.prometheus}function T(w){return w===d}function S(w){return(0,g.x)().find(N=>N.name===w)}function x(w){return w===d?d:S(w)}function O(w){if(w===d)return d;const N=S(w);if(!N)throw new Error(`Datasource "${w}" not found`);return String(N.id)}function B(w){if(w===d)return d;const N=S(w);if(!N)throw new Error(`Datasource "${w}" not found`);return N.uid}function A(){return(0,t.F)().getList({alerting:!0})[0]}function V(){const w=(0,t.F)().getInstanceSettings("default");return w?.meta.alerting??!1?w:A()}function W(w){return w.jsonData.manageAlerts!==!1}},77328:(j,I,e)=>{"use strict";e.d(I,{P3:()=>t,bR:()=>s,cH:()=>n,nW:()=>i});function t(r){return Object.entries(r).map(([g,d])=>`${g}=${d}`).sort()}function n(r){return Object.entries(r).map(([g,d])=>[g,d])}function i(r){const g={};return r.forEach(d=>{g[d[0]]=d[1]}),g}function s(r){const g={};return r.forEach(d=>{d.key&&(g[d.key]=d.value)}),g}},32925:(j,I,e)=>{"use strict";e.d(I,{QO:()=>l,RT:()=>g,rz:()=>d,tC:()=>r});var t=e(89949),n=e.n(t),i=e(62862);const s=[i._M.regex,i._M.notRegex,i._M.notEqual,i._M.equal];function r(c){if(c.startsWith("{")&&c.endsWith("}"))throw new Error(`PromQL matchers not supported yet, sorry! PromQL matcher found: ${c}`);const p=s.map(v=>[v,c.indexOf(v)]).filter(([v,D])=>D>-1).sort((v,D)=>v[1]-D[1]);if(!p.length)throw new Error(`Invalid matcher: ${c}`);const[f,E]=p[0],h=c.slice(0,E).trim(),y=c.slice(E+f.length);if(!h)throw new Error(`Invalid matcher: ${c}`);return{name:h,value:y,isRegex:f===i._M.regex||f===i._M.notRegex,isEqual:f===i._M.equal||f===i._M.regex}}function g(c){const p=c.filter(f=>!!f.trim()).map(f=>r(f));return(0,t.uniqBy)(p,f=>f.name)}const d=c=>{const p=Object.entries(c).filter(([E])=>!(E.startsWith("__")&&E.endsWith("__"))),f=new URLSearchParams;return p.forEach(([E,h])=>f.append("matcher",`${E}=${h}`)),f},l=c=>{const p=[];return c.matchers&&c.matchers.forEach(f=>{const{name:E,value:h,isEqual:y,isRegex:v}=r(f);let D=i._M.equal;y&&v&&(D=i._M.regex),!y&&v&&(D=i._M.notRegex),y&&!v&&(D=i._M.equal),!y&&!v&&(D=i._M.notEqual),p.push([E,D,h])}),c.object_matchers&&p.push(...c.object_matchers),c.match_re&&Object.entries(c.match_re).forEach(([f,E])=>{p.push([f,i._M.regex,E])}),c.match&&Object.entries(c.match).forEach(([f,E])=>{p.push([f,i._M.equal,E])}),p},u={[i._M.equal]:(c,p)=>c===p,[i._M.notEqual]:(c,p)=>c!==p,[i._M.regex]:(c,p)=>new RegExp(p).test(c),[i._M.notRegex]:(c,p)=>!new RegExp(p).test(c)};function o(c,p){const[f,E]=p,[h,y,v]=c;if(f!==h)return!1;const D=u[y];if(!D)throw new Error(`no such operator: ${y}`);return D(E,v)}function m(c,p){return c.every(f=>p.some(E=>o(f,E)))}},39036:(j,I,e)=>{"use strict";e.d(I,{ET:()=>f,GV:()=>p,HV:()=>x,J8:()=>a,RQ:()=>B,S0:()=>h,V2:()=>m,VN:()=>T,Vv:()=>M,Zl:()=>w,__:()=>S,aH:()=>O,eQ:()=>C,fm:()=>V,lC:()=>y,mH:()=>c,pF:()=>D,sM:()=>b,t6:()=>E,yM:()=>A});var t=e(89949),n=e.n(t),i=e(96437),s=e(22446),r=e(57183),g=e(18447),d=e(33555),l=e(22513),u=e(32925),o=e(59597);function m(N,F,k){const H=(0,l.EG)(N),R=i.Yd(H,F),_=encodeURIComponent(i.$V(R)),G=encodeURIComponent(H);return(0,o.u)(`/alerting/${G}/${_}/view`,{returnTo:k})}function c(N,F){const{uid:k,type:H}=N;return(0,o.u)("/explore",{left:JSON.stringify({datasource:N.uid,queries:[{refId:"A",datasource:{uid:k,type:H},expr:F}],range:{from:"now-1h",to:"now"}})})}function p(N,F=""){return(0,o.u)(`/alerting/notifications/receivers/${encodeURIComponent(N)}/edit`,{alertmanager:F})}function f(N,F=""){return(0,o.u)("/alerting/routes/mute-timing/edit",{muteName:N,alertmanager:F})}function E(N,F){return(0,l.jq)(N)?(0,o._)(`/alerting/${encodeURIComponent(N.name)}/${encodeURIComponent((0,i.GV)(F.name))}/find`):window.location.href.split("?")[0]}function h(N){return N.reduce((F,{key:k,value:H})=>(F[k]=H,F),{})}const y=N=>{const F=N.queryString===void 0?void 0:String(N.queryString),k=N.alertState===void 0?void 0:String(N.alertState),H=N.dataSource===void 0?void 0:String(N.dataSource),R=N.ruleType===void 0?void 0:String(N.ruleType),_=N.groupBy===void 0?void 0:String(N.groupBy).split(",");return{queryString:F,alertState:k,dataSource:H,groupBy:_,ruleType:R}},v=N=>({queryString:N.get("queryString")??void 0,contactPoint:N.get("contactPoint")??void 0}),D=N=>{const F=N.queryString===void 0?void 0:String(N.queryString),k=N.silenceState===void 0?void 0:String(N.silenceState);return{queryString:F,silenceState:k}};function a(N){return Object.entries(N).map(([F,k])=>({key:F,value:k}))}function C(N,F,k){const H=new URLSearchParams(k);return F&&H.append(d.c4,F),`${N}?${H.toString()}`}const P=N=>N.replace(/\"/g,'\\"');function b(N){return N.startsWith('"')&&N.endsWith('"')?P(N):`"${P(N)}"`}function M(N,F){const k={alertname:F.name,...F.labels};return T(N,k)}function T(N,F){const k=new URLSearchParams;return k.append("alertmanager",N),(0,u.rz)(F).forEach((R,_)=>k.append(_,R)),(0,o.u)("/alerting/silence/new",k)}function S(N){return(0,o.u)(`/datasources/edit/${N.uid}`)}function x(N){return(0,o.u)(`/dashboards/f/${N}`)}function O(N){return(0,o.u)(`/dashboards/f/${N.uid}/${N.title}/settings`)}function B(N){return(0,o.u)(`/d/${encodeURIComponent(N)}`)}function A(N,F){return(0,o.u)(`/d/${encodeURIComponent(N)}`,{viewPanel:F})}function V(N,F,k,H=1e3){const R=new Date().getTime(),_=()=>N().catch(G=>{if(F(G)&&new Date().getTime()-R<k)return new Promise(Y=>setTimeout(Y,H)).then(_);throw G});return _()}const W={[g.bj.Alerting]:1,[g.x_.Firing]:1,[g.bj.Error]:1,[g.bj.Pending]:2,[g.x_.Pending]:2,[g.x_.Inactive]:2,[g.bj.NoData]:3,[g.bj.Normal]:4};function w(N,F){if(N===r.As.Importance)return(0,t.sortBy)(F,H=>[W[(0,g.ED)(H.state)],(0,s.pB)(H).toLocaleLowerCase()]);if(N===r.As.TimeAsc)return(0,t.sortBy)(F,H=>[new Date(H.activeAt)||new Date,(0,s.pB)(H).toLocaleLowerCase()]);if(N===r.As.TimeDesc)return(0,t.sortBy)(F,H=>[new Date(H.activeAt)||new Date,(0,s.pB)(H).toLocaleLowerCase()]).reverse();const k=(0,t.sortBy)(F,H=>(0,s.pB)(H).toLocaleLowerCase());return N===r.As.AlphaDesc&&k.reverse(),k}},84369:(j,I,e)=>{"use strict";e.d(I,{$b:()=>o,Ez:()=>m,I7:()=>a,PE:()=>f,i6:()=>l,jK:()=>u,kk:()=>p,op:()=>C,oq:()=>g,wt:()=>D,yR:()=>v});var t=e(34099),n=e(3935),i=e(73289),s=e(66574),r=e(28722);const g=Object.freeze({loading:!1,result:void 0,error:void 0,dispatched:!1});function d(P,b=g,M){if(P.pending.match(M))return{result:b.result,loading:!0,error:b.error,dispatched:!0,requestId:M.meta.requestId};if(P.fulfilled.match(M)){if(b.requestId===void 0||b.requestId===M.meta.requestId)return{...b,result:M.payload,loading:!1,error:void 0}}else if(P.rejected.match(M)&&b.requestId===M.meta.requestId)return{...b,loading:!1,error:M.error};return b}function l(P,b){return(0,t.oM)({name:P,initialState:g,reducers:{},extraReducers:M=>M.addDefaultCase((T,S)=>d(b,T,S))})}function u(P,b,M){return(0,t.oM)({name:P,initialState:{},reducers:{},extraReducers:T=>T.addDefaultCase((S,x)=>{if((0,t.Gx)(b)(x)){const O=x,B=M(O.meta.arg);return{...S,[B]:d(b,S[B],O)}}return S})})}function o(P){return P.catch(b=>{throw{message:p(b),code:b.statusCode}})}function m(P,b){return P.then(M=>(b.successMessage&&s.h$.emit(n.SI.alertSuccess,[b.successMessage]),M)).catch(M=>{const T=p(M);throw s.h$.emit(n.SI.alertError,[`${b.errorMessage??"Error"}: ${T}`]),M})}const c="Unknown Error";function p(P){if((0,i.kW)(P))if(P.data?.message){let M=P.data?.message;return typeof P.data?.error=="string"&&(M+=`; ${P.data.error}`),M}else{if(Array.isArray(P.data)&&P.data.length&&P.data[0]?.message)return P.data.map(M=>M?.message).filter(M=>!!M).join(" ");if(P.statusText)return P.statusText}const b=P?.message;return b||((0,r.PN)(r.z7.unknownMessageFromError,{error:JSON.stringify(P)}),c)}function f(P){return Object.values(P).every(E)}function E(P){return P.dispatched&&!P.loading}function h(P){return Object.values(P).every(y)}function y(P){return P.dispatched&&!P.loading&&!P.error}function v(P){return Object.values(P).some(C)}function D(P){return Object.values(P).some(b=>b.dispatched)}function a(P){return Object.values(P).some(y)}function C(P){return P?P.dispatched&&P.loading:!1}},85184:(j,I,e)=>{"use strict";e.d(I,{DQ:()=>P,EB:()=>h,TN:()=>a,WL:()=>b,aR:()=>B,lN:()=>M,mI:()=>C,s0:()=>T,tO:()=>w,uZ:()=>y,yh:()=>v});var t=e(8508),n=e(76305),i=e(10864),s=e(42751),r=e(76897),g=e(65946),d=e(18447),l=e(43609),u=e(72821),o=e(2082),m=e(33555),c=e(22513),p=e(39036),f=e(22446),E=e(447);const h="1m",y=()=>{const{canCreateGrafanaRules:N,canCreateCloudRules:F}=(0,o.Rv)();return Object.freeze({name:"",uid:"",labels:[{key:"",value:""}],annotations:m.eY,dataSourceName:null,type:N?u.$.grafana:F?u.$.cloudAlerting:void 0,group:"",folder:null,queries:[],recordingRulesQueries:[],condition:"",noDataState:d.g0.NoData,execErrState:d.g0.Error,evaluateFor:"5m",evaluateEvery:h,namespace:"",expression:"",forTime:1,forTimeUnit:"m"})};function v(N){const{name:F,expression:k,forTime:H,forTimeUnit:R,keepFiringForTime:_,keepFiringForTimeUnit:G,type:Y}=N;if(Y===u.$.cloudAlerting){let X;return _&&G&&(X=`${_}${G}`),{alert:F,for:`${H}${R}`,keep_firing_for:X,annotations:(0,p.S0)(N.annotations||[]),labels:(0,p.S0)(N.labels||[]),expr:k}}else if(Y===u.$.cloudRecording)return{record:F,labels:(0,p.S0)(N.labels||[]),expr:k};throw new Error(`unexpected rule type: ${Y}`)}function D(N,F){const k=[...(0,p.J8)(N||{})];return F&&k.push({key:"",value:""}),k}function a(N){const F=[...N];return m.eY.map(H=>H.key).forEach((H,R)=>{const _=F.findIndex(G=>G.key===H);if(_===-1){const G={key:H,value:""};F.splice(R,0,G)}else _!==R&&F.splice(R,0,F.splice(_,1)[0])}),F}function C(N){const{name:F,condition:k,noDataState:H,execErrState:R,evaluateFor:_,queries:G,isPaused:Y}=N;if(k)return{grafana_alert:{title:F,condition:k,no_data_state:H,exec_err_state:R,data:G.map(V),is_paused:!!Y},for:_,annotations:(0,p.S0)(N.annotations||[]),labels:(0,p.S0)(N.labels||[])};throw new Error("Cannot create rule without specifying alert condition")}function P(N){const{ruleSourceName:F,namespace:k,group:H,rule:R}=N,_=y();if((0,c.HY)(F))if((0,f.Pc)(R)){const G=R.grafana_alert;return{..._,name:G.title,type:u.$.grafana,group:H.name,evaluateEvery:H.interval||_.evaluateEvery,evaluateFor:R.for||"0",noDataState:G.no_data_state,execErrState:G.exec_err_state,queries:G.data,condition:G.condition,annotations:a(D(R.annotations,!1)),labels:D(R.labels,!0),folder:{title:k,uid:G.namespace_uid},isPaused:G.is_paused}}else throw new Error("Unexpected type of rule for grafana rules source");else if((0,f.cG)(R)){const Y={refId:"A",datasourceUid:(0,i.F)().getInstanceSettings(F)?.uid??"",queryType:"",relativeTimeRange:(0,t.Rr)(),expr:R.expr,model:{refId:"A",hide:!1,expr:R.expr}},X=b(R);return{..._,...X,queries:[Y],annotations:a(D(R.annotations,!1)),type:u.$.cloudAlerting,dataSourceName:F,namespace:k,group:H.name}}else if((0,f.yF)(R)){const G=M(R);return{..._,...G,type:u.$.cloudRecording,dataSourceName:F,namespace:k,group:H.name}}else throw new Error("Unexpected type of rule for cloud rules source")}function b(N){const F=y(),[k,H]=N.for?(0,E.bG)(N.for):[F.forTime,F.forTimeUnit],[R,_]=N.keep_firing_for?(0,E.bG)(N.keep_firing_for):[F.keepFiringForTime,F.keepFiringForTimeUnit];return{name:N.alert,expression:N.expr,forTime:k,forTimeUnit:H,keepFiringForTime:R,keepFiringForTimeUnit:_,annotations:D(N.annotations,!1),labels:D(N.labels,!0)}}function M(N){return{name:N.record,expression:N.expr,labels:D(N.labels,!0)}}const T=()=>{const N=(0,c.P)();if(!N)return[...x("A","B")];const F=(0,t.Rr)();return[{refId:"A",datasourceUid:N.uid,queryType:"",relativeTimeRange:F,model:{refId:"A"}},...x("B","C")]},S=N=>{const F=getDefaultRelativeTimeRange();return[{refId:"A",datasourceUid:N[0]?.uid||"",queryType:"",relativeTimeRange:F,model:{refId:"A"}}]},x=(...N)=>{const F=N[0],k=N[1],H={refId:N[0],type:g.Us.reduce,datasource:{uid:g.Yq,type:s.hr.type},conditions:[{type:"query",evaluator:{params:[],type:l.$.IsAbove},operator:{type:"and"},query:{params:[F]},reducer:{params:[],type:"last"}}],reducer:"last",expression:"A"},R={refId:k,type:g.Us.threshold,datasource:{uid:g.Yq,type:s.hr.type},conditions:[{type:"query",evaluator:{params:[0],type:l.$.IsAbove},operator:{type:"and"},query:{params:[k]},reducer:{params:[],type:"last"}}],expression:F};return[{refId:F,datasourceUid:g.Yq,queryType:"",model:H},{refId:k,datasourceUid:g.Yq,queryType:"",model:R}]},O=async(N,F,k,H,R,_)=>{const G=[];for(const Y of N){const X=await(0,i.F)().get(Y.datasource?.uid?Y.datasource:H),Q={uid:X.uid,type:X.type},se=n.relativeToTimeRange(F),{interval:Z,intervalMs:le}=A(se,_??X.interval,R),oe={__interval:{text:Z,value:Z},__interval_ms:{text:le,value:le},...k},q=X.interpolateVariablesInQueries?await X.interpolateVariablesInQueries([Y],oe)[0]:Y;if(Q.uid===g.Yq){const ne={refId:q.refId,queryType:"",relativeTimeRange:F,datasourceUid:g.Yq,model:q};G.push(ne)}else{const ne=(0,i.F)().getInstanceSettings(Q);if(ne&&ne.meta.alerting){const ge={refId:q.refId,queryType:q.queryType??"",relativeTimeRange:F,datasourceUid:ne.uid,model:{...q,maxDataPoints:R,intervalMs:le}};G.push(ge)}}}return G},B=async(N,F)=>{const{targets:k}=N;if(!N.id||!F.uid)return;const H=n.timeRangeToRelative(n.convertRawToRange(F.time)),R=await O(k,H,N.scopedVars||{},N.datasource??void 0,N.maxDataPoints??void 0,N.interval??void 0);if(!R.length||!R.find(X=>X.datasourceUid!==g.Yq))return;if(!R.find(X=>X.datasourceUid===g.Yq)){const[X,Q]=x((0,r.Hs)(R),"-");R.push(X);const[se,Z]=x(X.refId,(0,r.Hs)(R));R.push(Z)}const{folderTitle:_,folderUid:G}=F.meta;return{type:u.$.grafana,folder:G&&_?{uid:G,title:_}:void 0,queries:R,name:N.title,condition:R[R.length-1].refId,annotations:[{key:m.q6.dashboardUID,value:F.uid},{key:m.q6.panelID,value:String(N.id)}]}};function A(N,F,k){return k?n.calculateInterval(N,k,F):F&&n.intervalToMs(F)>1e3?{interval:F,intervalMs:n.intervalToMs(F)}:{interval:"1s",intervalMs:1e3}}function V(N){const F=N.model;return W(F)&&F.instant&&F.range?{...N,model:{...F,range:!0,instant:!1}}:N}function W(N){return"expr"in N&&"instant"in N&&"range"in N}function w(N){return"expr"in N}},96437:(j,I,e)=>{"use strict";e.d(I,{$V:()=>h,CK:()=>g,Dg:()=>d,GV:()=>c,OA:()=>E,Om:()=>v,Qc:()=>f,Yd:()=>r,Zk:()=>i,d3:()=>p,s0:()=>C});var t=e(22513),n=e(22446);function i(P,b,M,T){return(0,n.Pc)(T)?{uid:T.grafana_alert.uid,ruleSourceName:"grafana"}:{ruleSourceName:P,namespace:b,groupName:M,ruleName:(0,n.cG)(T)?T.alert:T.record,rulerRuleHash:v(T)}}function s(P,b,M,T){return{ruleSourceName:P,namespace:b,groupName:M,ruleName:T.name,ruleHash:D(T)}}function r(P,b){const M=b.namespace.name,T=b.group.name;if(b.rulerRule)return i(P,M,T,b.rulerRule);if(b.promRule)return s(P,M,T,b.promRule);throw new Error("Could not create an id for a rule that is missing both `rulerRule` and `promRule`.")}function g(P){return i(P.ruleSourceName,P.namespace,P.group.name,P.rule)}function d(P,b){return(0,n.Kl)(P)&&(0,n.Kl)(b)?P.uid===b.uid:(0,n.E4)(P)&&(0,n.E4)(b)?P.groupName===b.groupName&&P.namespace===b.namespace&&P.ruleName===b.ruleName&&P.rulerRuleHash===b.rulerRuleHash&&P.ruleSourceName===b.ruleSourceName:(0,n.qE)(P)&&(0,n.qE)(b)?P.groupName===b.groupName&&P.namespace===b.namespace&&P.ruleName===b.ruleName&&P.ruleHash===b.ruleHash&&P.ruleSourceName===b.ruleSourceName:!1}const l="cri",u="pri";function o(P){return P.replace(/\$/g,"_DOLLAR_")}function m(P){return P.replace(/\_DOLLAR\_/g,"$")}function c(P){return P.replace(/\//g,"").replace(/\\/g,"")}function p(P){return P.replace(/\x1f/g,"/").replace(/\x1e/g,"\\")}function f(P,b=!1){const T=(b?decodeURIComponent(P):P).split("$");if(T.length===1)return{uid:P,ruleSourceName:"grafana"};if(T.length===6){const[S,x,O,B,A,V]=T.map(m).map(p);if(S===l)return{ruleSourceName:x,namespace:O,groupName:B,ruleName:A,rulerRuleHash:V};if(S===u)return{ruleSourceName:x,namespace:O,groupName:B,ruleName:A,ruleHash:V}}throw new Error(`Failed to parse rule location: ${P}`)}function E(P,b=!1){if(P)try{return f(P,b)}catch{return}}function h(P){return(0,n.Kl)(P)?P.uid:(0,n.E4)(P)?[l,P.ruleSourceName,P.namespace,P.groupName,P.ruleName,P.rulerRuleHash].map(String).map(o).map(c).join("$"):[u,P.ruleSourceName,P.namespace,P.groupName,P.ruleName,P.ruleHash].map(String).map(o).map(c).join("$")}function y(P){let b=0;if(P.length===0)return b;for(let M=0;M<P.length;M++){const T=P.charCodeAt(M);b=(b<<5)-b+T,b=b&b}return b}function v(P){if((0,n.yF)(P))return y(JSON.stringify([P.record,P.expr,a(P.labels)])).toString();if((0,n.cG)(P))return y(JSON.stringify([P.alert,P.expr,a(P.annotations),a(P.labels)])).toString();if((0,n.Pc)(P))return P.grafana_alert.uid;throw new Error("only recording and alerting ruler rules can be hashed")}function D(P){if((0,n.OP)(P))return y(JSON.stringify([P.type,P.query,a(P.labels)])).toString();if((0,n.x_)(P))return y(JSON.stringify([P.type,P.query,a(P.annotations),a(P.labels)])).toString();throw new Error("only recording and alerting rules can be hashed")}function a(P){return JSON.stringify(Object.entries(P||{}).sort((b,M)=>b[0].localeCompare(M[0])))}function C(P){return(0,n.Kl)(P)?t.GC:P.ruleSourceName}},22446:(j,I,e)=>{"use strict";e.d(I,{Aq:()=>S,C7:()=>T,E:()=>f,E4:()=>v,Jq:()=>B,Kl:()=>y,OP:()=>o,PW:()=>A,Pc:()=>p,Re:()=>M,SS:()=>P,Wd:()=>D,cG:()=>m,m$:()=>h,pB:()=>E,qE:()=>a,qd:()=>V,ub:()=>O,vU:()=>C,x_:()=>u,yF:()=>c});var t=e(89949),n=e.n(t),i=e(41999),s=e(18447),r=e(41028),g=e(33555),d=e(22513),l=e(447);function u(w){return typeof w=="object"&&w.type===s.pz.Alerting}function o(w){return typeof w=="object"&&w.type===s.pz.Recording}function m(w){return typeof w=="object"&&"alert"in w}function c(w){return typeof w=="object"&&"record"in w}function p(w){return typeof w=="object"&&"grafana_alert"in w}function f(w){return w.rulerRule&&p(w.rulerRule)&&!!w.rulerRule.grafana_alert.is_paused}function E(w){return JSON.stringify(w.labels)}function h(w){return w.error&&w.error?.message?.includes(g.jZ)}function y(w){return"uid"in w}function v(w){return"rulerRuleHash"in w}function D(w){return Object.values(s.pz).includes(w)}function a(w){return"ruleHash"in w}function C(w){switch(w){case"ok":return r.VG.Ok;case"nodata":return r.VG.NoData;case"error":case"err":return r.VG.Error;case"unknown":return r.VG.Unknown;default:return}}function P(w){return w===s.x_.Inactive?"Normal":(0,t.capitalize)(w)}const b=w=>w.reduce((N,{dataSourceName:F,name:k,groups:H})=>(H.forEach(({name:R,rules:_})=>{_.forEach(G=>{u(G)&&N.push({dataSourceName:F,namespaceName:k,groupName:R,rule:G})})}),N),[]),M=w=>u(w.promRule)?w.promRule:null,T=w=>w.reduce((N,{rulesSource:F,name:k,groups:H})=>(H.forEach(({name:R,rules:_})=>{_.forEach(G=>{G.promRule&&u(G.promRule)&&N.push({dataSourceName:(0,d.EG)(F),namespaceName:k,groupName:R,...G})})}),N),[]);function S(w){let N;return Object.values(i.Z).includes(w)?N=w:N=(0,s.ED)(w),x[N]}const x={[s.x_.Inactive]:"good",[s.x_.Firing]:"bad",[s.x_.Pending]:"warning",[s.bj.Alerting]:"bad",[s.bj.Error]:"bad",[s.bj.NoData]:"info",[s.bj.Normal]:"good",[s.bj.Pending]:"warning",[i.Z.NoData]:"info",[i.Z.Paused]:"warning",[i.Z.Alerting]:"bad",[i.Z.OK]:"good",[i.Z.Pending]:"warning",[i.Z.Unknown]:"info"};function O(w){return w?.alerts?w.alerts.reduce((N,F)=>{const k=(0,s.ED)(F.state)!==s.bj.Normal;if(F.activeAt&&k){const H=new Date(F.activeAt);if(N===null||N.getTime()>H.getTime())return H}return N},null):null}function B(w){return Array.isArray(w.source_tenants)}function A(w){return p(w)?w.grafana_alert.title:m(w)?w.alert:c(w)?w.record:""}const V=(w,N)=>{const F={alertName:"",forDuration:"0s",evaluationsToFire:0};return p(w)?{alertName:w.grafana_alert.title,forDuration:w.for,evaluationsToFire:W(w.for,N)}:m(w)?{alertName:w.alert,forDuration:w.for??"1m",evaluationsToFire:W(w.for??"1m",N)}:F},W=(w,N)=>{const F=(0,l.Bg)(N),k=(0,l.Bg)(w);return k===0&&F!==0?1:F===0||k/F<1?0:Math.ceil(k/F)+1}},447:(j,I,e)=>{"use strict";e.d(I,{Bg:()=>o,bG:()=>n,gS:()=>c,gV:()=>m,nd:()=>u,qr:()=>s,wd:()=>r});var t=e(42439);function n(p){const f=p.match(/(\d+)(\w+)/);if(f)return[Number(f[1]),f[2]];throw new Error(`Invalid interval description: ${p}`)}function i(p){const{sec:f,count:E}=describeInterval(p);return f*E}const s=Object.entries(t.t).map(([p,f])=>({label:p[0].toUpperCase()+p.slice(1),value:f}));function r(p){try{return u(p),!0}catch{return!1}}const g={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},d=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: ${Object.values(t.t).join(", ")}`);function u(p){let f=p,E=[];function h(v){const D=d.exec(v),a=D?.groups?.value&&D?.groups?.type;if(!D||!a)throw l;D&&D.groups?.value&&D.groups?.type&&(f=f.replace(D[0],""),E.push([Number(D.groups.value),D.groups.type])),f&&h(f)}if(h(p),!E.length)throw l;return E.reduce((v,[D,a])=>{const C=D*g[a];return v+C},0)}const o=p=>{try{return u(p)}catch{return 0}},m=p=>p.includes("0001-01-01T00");function c(p){return p%(1e3*60*60)===0?p/(1e3*60*60)+"h":p%(1e3*60)===0?p/(1e3*60)+"m":p%1e3===0?p/1e3+"s":p.toFixed()+"ms"}},59597:(j,I,e)=>{"use strict";e.d(I,{_:()=>i,u:()=>n});var t=e(34667);function n(s,r){const d=new URLSearchParams(r).toString();return`${t.config.appSubUrl}${s}${d?`?${d}`:""}`}function i(s,r){const d=new URLSearchParams(r).toString();try{const l=new URL(t.config.appSubUrl,t.config.appUrl);return l.pathname=s,`${l.href}${d?`?${d}`:""}`}catch{return n(s,r)}}},11285:(j,I,e)=>{"use strict";e.d(I,{Dl:()=>s,_E:()=>i,lK:()=>r,xD:()=>n});var t=e(73289);function n(g){return(0,t.i)().post("/api/annotations",g)}function i(g){return(0,t.i)().put(`/api/annotations/${g.id}`,g)}function s(g){return(0,t.i)().delete(`/api/annotations/${g.id}`)}async function r(){return(await(0,t.i)().get("/api/annotations/tags")).result.tags.map(({tag:d,count:l})=>({term:d,count:l}))}},92877:(j,I,e)=>{"use strict";e.d(I,{r:()=>o});var t=e(45383),n=e(22479),i=e(39343),s=e(76305),r=e(62247),g=e(46809),d=e(97463);let l=100;function u(){return"AQ"+l++}function o(m,c,p){const f={...d.yA,...c.annotations},E={...f.getDefaultQuery?.(),...p},h=f.prepareAnnotation(E);if(!h)return(0,t.of)({});const y=f.prepareQuery(h);if(!y)return(0,t.of)({});const v=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,D=s.calculateInterval(m.range,v,c.interval),a={__interval:{text:D.interval,value:D.interval},__interval_ms:{text:D.intervalMs.toString(),value:D.intervalMs},__annotation:{text:h.name,value:h}},C={startTime:Date.now(),requestId:u(),range:m.range,maxDataPoints:v,scopedVars:a,...D,app:r.zj.Dashboard,publicDashboardAccessToken:m.dashboard.meta.publicDashboardAccessToken,timezone:m.dashboard.timezone,targets:[{...y,refId:"Anno"}]};return(0,g.v7)(c,C).pipe((0,n.z)(P=>{const b=P?.series.length?P.series:P.annotations;return b?.length?f.processEvents(h,b).pipe((0,i.U)(M=>({panelData:P,events:M}))):(0,t.of)({panelData:P,events:[]})}))}},97463:(j,I,e)=>{"use strict";e.d(I,{$w:()=>v,r0:()=>p,yA:()=>m,yr:()=>D});var t=e(89949),n=e.n(t),i=e(45383),s=e(22479),r=e(39343),g=e(44885),d=e(29241),l=e(75578),u=e(22001),o=e(12308);const m={prepareAnnotation:a=>{if((0,t.isString)(a?.query)){const{query:C,...P}=a;return{...P,target:{refId:"annotation_query",query:C},mappings:{}}}return a},prepareQuery:a=>a.target,processEvents:(a,C)=>h(C,a.mappings)};function c(){return a=>a.pipe((0,s.z)(C=>{if(!C?.length)return(0,i.of)(void 0);if(C.length===1)return(0,i.of)(C[0]);const P={interpolate:b=>b};return(0,i.of)(C).pipe(g.Y.mergeTransformer.operator({},P),(0,r.U)(b=>b[0]))}))}const p=[{key:"time",field:a=>a.fields.find(C=>C.type===d.fS.time),placeholder:"time, or the first time field"},{key:"timeEnd",help:"When this field is defined, the annotation will be treated as a range"},{key:"title"},{key:"text",field:a=>a.fields.find(C=>C.type===d.fS.string),placeholder:"text, or the first text field"},{key:"tags",split:",",help:"The results will be split on comma (,)"},{key:"id"}],f=[{key:"color"},{key:"isRegion"},{key:"source"}],E=[...o.config.isPublicDashboardView?f:[],...p,{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];function h(a,C){return(0,i.of)(a).pipe(c(),(0,r.U)(P=>{if(!P?.length)return[];let b=!1,M=!1;const T={};for(const O of P.fields){const B=(0,l.CZ)(O,P);T[B.toLowerCase()]=O}C||(C={});const S=[];for(const O of E){const B=C[O.key]||{};if(B.source===u.L.Skip)continue;const A={key:O.key,split:O.split};if(B.source===u.L.Text)A.text=B.value;else{const V=(B.value||O.key).toLowerCase();A.field=T[V],!A.field&&O.field&&(A.field=O.field(P))}(A.field||A.text)&&(S.push(A),A.key==="time"?b=!0:A.key==="text"&&(M=!0))}if(!b||!M)return console.error("Cannot process annotation fields. No time or text present."),[];const x=[];for(let O=0;O<P.length;O++){const B={type:"default",color:"red"};for(const A of S){let V;if(A.text)V=A.text;else if(A.field&&(V=A.field.values[O],V!==void 0&&A.regex)){const W=A.regex.exec(V);W&&(V=W[1]?W[1]:W[0])}V!=null&&(A.split&&typeof V=="string"&&(V=V.split(",")),B[A.key]=V)}x.push(B)}return x}))}const y=["prometheus","loki","elasticsearch","grafana-opensearch-datasource"];function v(a){const{type:C}=a;return!(C==="datasource"||y.includes(C))}function D(a){const{type:C}=a;return y.includes(C)}},59273:(j,I,e)=>{"use strict";e.d(I,{ZP:()=>o,dF:()=>g,iK:()=>s,j4:()=>r,nQ:()=>l,ql:()=>d});var t=e(34099);const n={hasFetched:!1,includeExpired:!1,keys:[],keysIncludingExpired:[],searchQuery:"",migrationResult:{total:0,migrated:0,failed:0,failedApikeyIDs:[0],failedDetails:[]}},i=(0,t.oM)({name:"apiKeys",initialState:n,reducers:{apiKeysLoaded:(m,c)=>{const{keys:p,keysIncludingExpired:f}=c.payload,E=c.payload.keys.length===0&&c.payload.keysIncludingExpired.length>0?!0:m.includeExpired;return{...m,hasFetched:!0,keys:p,keysIncludingExpired:f,includeExpired:E}},setSearchQuery:(m,c)=>({...m,searchQuery:c.payload}),includeExpiredToggled:m=>({...m,includeExpired:!m.includeExpired}),isFetching:m=>({...m,hasFetched:!1}),setMigrationResult:(m,c)=>({...m,migrationResult:c.payload})}}),{apiKeysLoaded:s,includeExpiredToggled:r,isFetching:g,setSearchQuery:d,setMigrationResult:l}=i.actions,o={apiKeys:i.reducer}},12352:(j,I,e)=>{"use strict";e.d(I,{getAuthProviderStatus:()=>o,getRegisteredAuthProviders:()=>d,initAuthConfig:()=>m});var t=e(66574),n=e(45937),i=e(18771);const s=[],r={};function g(p,f){s.find(E=>E.id===p.id)||(s.push(p),f&&(r[p.id]=f))}function d(){return s}function l(p){return s.find(f=>f.id===p)}function u(p){const f=[];for(const[E,h]of Object.entries(p)){const y=s.find(v=>`auth.${v.id}`===E);if(y){const v={...h,providerId:y.id,displayName:h.name||y.displayName};f.push(v)}}return f}async function o(p){if(r[p]){const f=r[p];return f()}return{configured:!1,enabled:!1}}function m(){g({id:"ldap",type:"LDAP",protocol:"LDAP",displayName:"LDAP",configPath:"ldap"},c)}async function c(){if(t.Vt.hasPermission(i.AccessControlAction.SettingsRead)){const f=(await(0,n.i)().get("/api/admin/settings"))["auth.ldap"]||{};return{configured:f.enabled==="true",enabled:f.enabled==="true",hide:f.enabled!=="true"}}return{configured:!1,enabled:!1}}},4242:(j,I,e)=>{"use strict";e.d(I,{AB:()=>r,AW:()=>s,ZP:()=>p,_E:()=>d,uX:()=>g});var t=e(34099);const n={settings:{},providerStatuses:{},isLoading:!1},i=(0,t.oM)({name:"authConfig",initialState:n,reducers:{settingsUpdated:(f,E)=>({...f,settings:E.payload}),providerStatusesLoaded:(f,E)=>({...f,providerStatuses:E.payload}),loadingBegin:f=>({...f,isLoading:!0}),loadingEnd:f=>({...f,isLoading:!1}),setError:(f,E)=>({...f,updateError:E.payload}),resetError:f=>({...f,updateError:void 0}),setWarning:(f,E)=>({...f,warning:E.payload}),resetWarning:f=>({...f,warning:void 0})}}),{settingsUpdated:s,providerStatusesLoaded:r,loadingBegin:g,loadingEnd:d,setError:l,resetError:u,setWarning:o,resetWarning:m}=i.actions,p={authConfig:i.reducer}},67572:(j,I,e)=>{"use strict";e.d(I,{CN:()=>p.CN,Hv:()=>h,OH:()=>C,Zi:()=>E,jL:()=>P,t4:()=>a,vN:()=>T,wo:()=>b,yC:()=>y,yF:()=>M,zs:()=>D,zu:()=>v});var t=e(4371),n=e(78209),i=e(94469),s=e(53933),r=e(73289),g=e(26129),d=e(33877),l=e(73807),u=e(66574),o=e(284),m=e(1631),c=e(49079),p=e(41938);function f({baseURL:S}){async function x(O){try{const{data:B,...A}=await(0,n.n)((0,r.i)().fetch({...O,url:S+O.url,showErrorAlert:O.showErrorAlert}));return{data:B,meta:A}}catch(B){return O.manageError?O.manageError(B):{error:B}}}return x}const E=(0,t.LC)({tagTypes:["getFolder"],reducerPath:"browseDashboardsAPI",baseQuery:f({baseURL:"/api"}),endpoints:S=>({getFolder:S.query({providesTags:(x,O,B)=>[{type:"getFolder",id:B}],query:x=>({url:`/folders/${x}`,params:{accesscontrol:!0}})}),newFolder:S.mutation({query:({title:x,parentUid:O})=>({method:"POST",url:"/folders",data:{title:x,parentUid:O}}),onQueryStarted:({parentUid:x},{queryFulfilled:O,dispatch:B})=>{O.then(async({data:A})=>{await u.Vt.fetchUserPermissions(),B((0,d.$l)((0,l.AT)("Folder created"))),B((0,m.it)({parentUID:x,pageSize:c.IV})),g.E1.push(i.u.stripBaseFromUrl(A.url))})}}),saveFolder:S.mutation({invalidatesTags:["getFolder"],query:({uid:x,title:O,version:B})=>({method:"PUT",url:`/folders/${x}`,data:{title:O,version:B}}),onQueryStarted:({parentUid:x},{queryFulfilled:O,dispatch:B})=>{O.then(()=>{B((0,m.it)({parentUID:x,pageSize:c.IV}))})}}),moveFolder:S.mutation({invalidatesTags:["getFolder"],query:({folder:x,destinationUID:O})=>({url:`/folders/${x.uid}/move`,method:"POST",data:{parentUID:O}}),onQueryStarted:({folder:x,destinationUID:O},{queryFulfilled:B,dispatch:A})=>{const{parentUid:V}=x;B.then(()=>{A((0,m.it)({parentUID:V,pageSize:c.IV})),A((0,m.it)({parentUID:O,pageSize:c.IV}))})}}),deleteFolder:S.mutation({query:({uid:x})=>({url:`/folders/${x}`,method:"DELETE",params:{forceDeleteRules:!1}}),onQueryStarted:({parentUid:x},{queryFulfilled:O,dispatch:B})=>{O.then(()=>{B((0,m.it)({parentUID:x,pageSize:c.IV}))})}}),getAffectedItems:S.query({queryFn:async x=>{const B=Object.keys(x.folder).filter(W=>x.folder[W]).map(W=>(0,r.i)().get(`/api/folders/${W}/counts`)),A=await Promise.all(B),V={folder:Object.values(x.folder).filter(s.fQ).length,dashboard:Object.values(x.dashboard).filter(s.fQ).length,libraryPanel:0,alertRule:0};for(const W of A)V.folder+=W.folder,V.dashboard+=W.dashboard,V.alertRule+=W.alertrule??0;return{data:V}}}),moveItems:S.mutation({invalidatesTags:["getFolder"],queryFn:async({selectedItems:x,destinationUID:O},B,A,V)=>{const W=Object.keys(x.dashboard).filter(N=>x.dashboard[N]),w=Object.keys(x.folder).filter(N=>x.folder[N]);for(const N of w)await V({url:`/folders/${N}/move`,method:"POST",data:{parentUID:O}});for(const N of W){const k={dashboard:(await(0,r.i)().get(`/api/dashboards/uid/${N}`)).dashboard,folderUid:O,overwrite:!1,message:""};await V({url:"/dashboards/db",method:"POST",data:k})}return{data:void 0}},onQueryStarted:({destinationUID:x,selectedItems:O},{queryFulfilled:B,dispatch:A})=>{const V=Object.keys(O.dashboard).filter(w=>O.dashboard[w]),W=Object.keys(O.folder).filter(w=>O.folder[w]);B.then(()=>{A((0,m.it)({parentUID:x,pageSize:c.IV})),A((0,m.Nc)([...W,...V]))})}}),deleteItems:S.mutation({queryFn:async({selectedItems:x},O,B,A)=>{const V=Object.keys(x.dashboard).filter(w=>x.dashboard[w]),W=Object.keys(x.folder).filter(w=>x.folder[w]);for(const w of W)await A({url:`/folders/${w}`,method:"DELETE",params:{forceDeleteRules:!1}});for(const w of V)await A({url:`/dashboards/uid/${w}`,method:"DELETE"});return{data:void 0}},onQueryStarted:({selectedItems:x},{queryFulfilled:O,dispatch:B})=>{const A=Object.keys(x.dashboard).filter(W=>x.dashboard[W]),V=Object.keys(x.folder).filter(W=>x.folder[W]);O.then(()=>{B((0,m.Nc)([...V,...A]))})}}),saveDashboard:S.mutation({query:({dashboard:x,folderUid:O,message:B,overwrite:A})=>({url:"/dashboards/db",method:"POST",data:{dashboard:x,folderUid:O,message:B??"",overwrite:!!A}}),onQueryStarted:({folderUid:x},{queryFulfilled:O,dispatch:B})=>{o.H.ignoreNextSave(),O.then(async()=>{await u.Vt.fetchUserPermissions(),B((0,m.it)({parentUID:x,pageSize:c.IV}))})}})})}),{endpoints:h,useDeleteFolderMutation:y,useDeleteItemsMutation:v,useGetAffectedItemsQuery:D,useGetFolderQuery:a,useMoveFolderMutation:C,useMoveItemsMutation:P,useNewFolderMutation:b,useSaveDashboardMutation:M,useSaveFolderMutation:T}=E},49079:(j,I,e)=>{"use strict";e.d(I,{IV:()=>r,ry:()=>g,xH:()=>d});var t=e(73289),n=e(15758),i=e(63064),s=e(6092);const r=50;async function g(l,u,o=1,m=r){return(await(0,t.i)().get("/api/folders",{parentUid:l,page:o,limit:m})).map(f=>({kind:"folder",uid:f.uid,title:f.title,parentTitle:u,parentUID:l,url:`/dashboards/f/${f.uid}/`}))}async function d(l,u=1,o=r){const c=await(0,i.getGrafanaSearcher)().search({kind:["dashboard"],query:"*",location:l||"general",from:(u-1)*o,limit:o});return c.view.map(p=>{const f=(0,s.f9)(p,c.view);return f.parentUID===n.YQ&&(f.parentUID=void 0),f})}},50837:(j,I,e)=>{"use strict";e.d(I,{X:()=>l});var t=e(27702),n=e(57704),i=e(63439),s=e(21323),r=e(67572),g=e(65322);function d(u,o,m,c){const p=u+o+m+c,f=[];u&&f.push((0,g.t)("browse-dashboards.counts.folder","{{count}} folder",{count:u})),o&&f.push((0,g.t)("browse-dashboards.counts.dashboard","{{count}} dashboard",{count:o})),m&&f.push((0,g.t)("browse-dashboards.counts.libraryPanel","{{count}} library panel",{count:m})),c&&f.push((0,g.t)("browse-dashboards.counts.alertRule","{{count}} alert rule",{count:c}));let E=(0,g.t)("browse-dashboards.counts.total","{{count}} item",{count:p});return f.length>0&&(E+=`: ${f.join(", ")}`),E}const l=({selectedItems:u})=>{const{data:o,isFetching:m,isLoading:c,error:p}=(0,r.zs)(u);return t.createElement(t.Fragment,null,t.createElement(s.x,{element:"p",color:"secondary"},o&&d(o.folder,o.dashboard,o.libraryPanel,o.alertRule),(m||c)&&t.createElement(n.Z,{width:200})),p&&t.createElement(i.b,{severity:"error",title:"Unable to retrieve descendant information"}))}},4571:(j,I,e)=>{"use strict";e.d(I,{A:()=>s});var t=e(27702),n=e(66310),i=e(6309);function s({children:r,level:g}){const d=(0,n.l4)(),l=`var(${i.w}, ${d.spacing(2)})`;return t.createElement("span",{style:{paddingLeft:`calc(${l} * ${g})`}},r)}},25237:(j,I,e)=>{"use strict";e.d(I,{Nc:()=>r,it:()=>g,si:()=>d});var t=e(15758),n=e(18771),i=e(49079),s=e(59648);const r=(0,n.createAsyncThunk)("browseDashboards/refreshParents",async(l,{getState:u,dispatch:o})=>{const{browseDashboards:m}=u(),{rootItems:c,childrenByParentUID:p}=m,f=new Set;for(const E of l){const h=(0,s.i)(c?.items??[],p,E);f.add(h?.parentUID)}for(const E of f)o(g({parentUID:E,pageSize:i.IV}))}),g=(0,n.createAsyncThunk)("browseDashboards/refetchChildren",async({parentUID:l,pageSize:u})=>{const o=l===t.YQ?void 0:l;let m=1,c="folder",p=await(0,i.ry)(o,void 0,m,u),f=p.length<u;if(c==="folder"&&f){c="dashboard",m=1;const E=await(0,i.xH)(o,m,u);f=E.length<u,p=p.concat(E)}return{children:p,lastPageOfKind:f,page:m,kind:c}}),d=(0,n.createAsyncThunk)("browseDashboards/fetchNextChildrenPage",async({parentUID:l,excludeKinds:u=[],pageSize:o},m)=>{const c=!u.includes("dashboard"),p=l===t.YQ?void 0:l,f=m.getState().browseDashboards,E=p?f.childrenByParentUID[p]:f.rootItems;let h=1,y;if(E?E.lastFetchedKind==="dashboard"&&!E.lastKindHasMoreItems?console.warn(`fetchNextChildrenPage called for ${p} but that collection is fully loaded`):E.lastFetchedKind==="folder"&&E.lastKindHasMoreItems?(h=E.lastFetchedPage+1,y="folder"):c&&(h=E.lastFetchedKind==="folder"?1:E.lastFetchedPage+1,y="dashboard"):(h=1,y="folder"),!y)return;let v=y==="folder"?await(0,i.ry)(p,void 0,h,o):await(0,i.xH)(p,h,o),D=v.length<o;if(y==="folder"&&D&&c){y="dashboard",h=1;const a=await(0,i.xH)(p,h,o);D=a.length<o,v=v.concat(a)}return{children:v,lastPageOfKind:D,page:h,kind:y}})},1631:(j,I,e)=>{"use strict";e.d(I,{MH:()=>u,qO:()=>P,si:()=>n.si,it:()=>n.it,Nc:()=>n.Nc,hO:()=>l,u6:()=>t.u6,xm:()=>t.xm,wk:()=>t.wk,m2:()=>a,zw:()=>E,aw:()=>v,$H:()=>D,Sk:()=>h,QD:()=>y,D$:()=>C});var t=e(82880),n=e(25237),i=e(27702),s=e(75892),r=e(18771),g=e(49079),d=e(59648);const l=b=>b.browseDashboards.rootItems,u=b=>b.browseDashboards.childrenByParentUID,o=b=>b.browseDashboards.openFolders,m=b=>b.browseDashboards.selectedItems,c=(0,s.P1)(l,u,o,(b,M)=>M,(b,M,T,S)=>P(S,b,M,T)),p=(0,s.P1)(m,b=>Object.values(b).some(M=>Object.values(M).some(T=>T))),f=(0,s.P1)(m,u,(b,M)=>{const T={dashboard:{...b.dashboard},folder:{...b.folder}};for(const S of Object.keys(b.folder))if(b.folder[S]){const O=M[S];if(O)for(const B of O.items)B.kind==="dashboard"&&(T.dashboard[B.uid]=!1),B.kind==="folder"&&(T.folder[B.uid]=!1)}return T});function E(b){return(0,r.useSelector)(M=>(b?M.browseDashboards.childrenByParentUID[b]:M.browseDashboards.rootItems)?"fulfilled":"pending")}function h(b){return(0,r.useSelector)(M=>c(M,b))}function y(){return(0,r.useSelector)(b=>p(b))}function v(){return(0,r.useSelector)(m)}function D(){return(0,r.useSelector)(b=>b.browseDashboards.childrenByParentUID)}function a(){return(0,r.useSelector)(b=>f(b))}function C(b=[]){const M=(0,r.useDispatch)(),T=(0,i.useRef)(!1);return(0,i.useCallback)(x=>{if(T.current)return Promise.resolve();T.current=!0;const O=M((0,n.si)({parentUID:x,excludeKinds:b,pageSize:g.IV}));return O.finally(()=>T.current=!1),O},[M,b])}function P(b,M,T,S,x=0,O=[],B=[]){function A(H,R,_){if(O.includes(H.kind)||B.includes(H.uid))return[];const G=P(H.uid,M,T,S,_+1,O,B),Y=!!S[H.uid],X=T[H.uid]?.items.length===0;return Y&&X&&!O.includes("empty-folder")&&G.push({isOpen:!1,level:_+1,item:{kind:"ui",uiKind:"empty-folder",uid:H.uid+"empty-folder"},parentUID:R}),[{item:H,parentUID:R,level:_,isOpen:Y},...G]}const V=b&&S[b]||x===0,W=b?T[b]:M;let N=((b?V&&W?.items:W?.items)||[]).flatMap(H=>A(H,b,x));const F=O.includes("dashboard")&&W?.lastFetchedKind==="dashboard";return(x===0&&!W||V&&W&&!(W.isFullyLoaded||F))&&(N=N.concat((0,d.k)(g.IV,b,x))),N}},82880:(j,I,e)=>{"use strict";e.d(I,{ZP:()=>D,u6:()=>v,xm:()=>h,wk:()=>y});var t={};e.r(t),e.d(t,{fetchNextChildrenPageFulfilled:()=>g,refetchChildrenFulfilled:()=>r,setAllSelection:()=>u,setFolderOpenState:()=>d,setItemSelectionState:()=>l});var n=e(34099),i=e(25237),s=e(59648);function r(a,C){const{children:P,page:b,kind:M,lastPageOfKind:T}=C.payload,{parentUID:S}=C.meta.arg,x={items:P,lastFetchedKind:M,lastFetchedPage:b,lastKindHasMoreItems:!T,isFullyLoaded:M==="dashboard"&&T};S?a.childrenByParentUID[S]=x:a.rootItems=x}function g(a,C){const P=C.payload;if(!P)return;const{children:b,page:M,kind:T,lastPageOfKind:S}=P,{parentUID:x,excludeKinds:O=[]}=C.meta.arg,V={items:((x?a.childrenByParentUID[x]:a.rootItems)?.items??[]).concat(b),lastFetchedKind:T,lastFetchedPage:M,lastKindHasMoreItems:!S,isFullyLoaded:(O.includes("dashboard")||T==="dashboard")&&S};if(!x){a.rootItems=V;return}if(a.childrenByParentUID[x]=V,a.selectedItems.folder[x])for(const w of b)a.selectedItems[w.kind][w.uid]=!0}function d(a,C){const{folderUID:P,isOpen:b}=C.payload;a.openFolders[P]=b}function l(a,C){const{item:P,isSelected:b}=C.payload;function M(S,x){if(a.selectedItems[S][x]=b,S!=="folder")return;let O=a.childrenByParentUID[x];for(const B of O?.items??[])M(B.kind,B.uid)}M(P.kind,P.uid);let T=P.parentUID;for(;T;){const S=(0,s.i)(a.rootItems?.items??[],a.childrenByParentUID,T);if(!S)break;b||(a.selectedItems[S.kind][S.uid]=!1),T=S.parentUID}a.selectedItems.$all=a.rootItems?.items?.every(S=>a.selectedItems[S.kind][S.uid])??!1}function u(a,C){const{isSelected:P,folderUID:b}=C.payload;if(a.selectedItems.$all=P,P){let T=function(S){const x=S?a.childrenByParentUID[S]:a.rootItems;if(x)for(const O of x.items)a.selectedItems[O.kind][O.uid]=P,O.kind==="folder"&&T(O.uid)};var M=T;T(b)}else for(const T in a.selectedItems){if(!(T==="dashboard"||T==="panel"||T==="folder"))continue;const S=a.selectedItems[T];for(const x in S)S[x]=P}}const{fetchNextChildrenPageFulfilled:o,refetchChildrenFulfilled:m,...c}=t,p={rootItems:void 0,childrenByParentUID:{},openFolders:{},selectedItems:{dashboard:{},folder:{},panel:{},$all:!1}},f=(0,n.oM)({name:"browseDashboards",initialState:p,reducers:c,extraReducers:a=>{a.addCase(i.si.fulfilled,o),a.addCase(i.it.fulfilled,m)}}),E=f.reducer,{setFolderOpenState:h,setItemSelectionState:y,setAllSelection:v}=f.actions,D={browseDashboards:E}},59648:(j,I,e)=>{"use strict";e.d(I,{i:()=>t,k:()=>n});function t(i,s,r){for(const g of i)if(g.uid===r)return g;for(const g in s){const d=s[g];if(d){for(const l of d.items)if(l.uid===r)return l}}}function n(i,s,r){return new Array(i).fill(null).map((g,d)=>({parentUID:s,level:r,isOpen:!1,item:{kind:"ui",uiKind:"pagination-placeholder",uid:`${s}-pagination-${d}`}}))}},6309:(j,I,e)=>{"use strict";e.d(I,{f:()=>n,w:()=>t});const t="--dashboards-tree-indentation";var n=(i=>(i[i.Unselected=0]="Unselected",i[i.Selected=1]="Selected",i[i.Mixed=2]="Mixed",i))(n||{})},90131:(j,I,e)=>{"use strict";e.d(I,{D:()=>t,Z:()=>n});const t="connections",n={Base:`/${t}`,DataSources:`/${t}/datasources`,DataSourcesNew:`/${t}/datasources/new`,DataSourcesEdit:`/${t}/datasources/edit/:uid`,DataSourcesDashboards:`/${t}/datasources/edit/:uid/dashboards`,AddNewConnection:`/${t}/add-new-connection`,DataSourcesDetails:`/${t}/datasources/:id`,ConnectDataOutdated:`/${t}/connect-data`,YourConnectionsOutdated:`/${t}/your-connections`}},12142:(j,I,e)=>{"use strict";e.d(I,{I0:()=>d,K:()=>u,Yu:()=>l});var t=e(26811),n=e(78209),i=e(10864),s=e(26473);const r=({sourceUID:o,targetUID:m,...c})=>{const p=(0,i.F)().getInstanceSettings(o),f=(0,i.F)().getInstanceSettings(m);if(p&&p?.uid!==void 0&&f&&f.uid!==void 0)return{...c,source:p,target:f}},g=o=>!!o,d=o=>({...o,correlations:o.correlations.map(r).filter(g)});function l(o){return o.data}const u=()=>{const{backend:o}=(0,s.p)(),[m,c]=(0,t.Z)(D=>(0,n.n)(o.fetch({url:"/api/datasources/correlations",params:{page:D.page},method:"GET",showErrorAlert:!1})).then(l).then(d),[o]),[p,f]=(0,t.Z)(({sourceUID:D,...a})=>o.post(`/api/datasources/uid/${D}/correlations`,a).then(C=>{const P=r(C.result);if(P!==void 0)return P;throw new Error("invalid sourceUID")}),[o]),[E,h]=(0,t.Z)(({sourceUID:D,uid:a})=>o.delete(`/api/datasources/uid/${D}/correlations/${a}`),[o]),[y,v]=(0,t.Z)(({sourceUID:D,uid:a,...C})=>o.patch(`/api/datasources/uid/${D}/correlations/${a}`,C).then(P=>{const b=r(P.result);if(b!==void 0)return b;throw new Error("invalid sourceUID")}),[o]);return{create:{execute:f,...p},update:{execute:v,...y},get:{execute:c,...m},remove:{execute:h,...E}}}},64077:(j,I,e)=>{"use strict";e.d(I,{n:()=>g,r:()=>l});var t=e(78209),n=e(24094),i=e(73289),s=e(18262),r=e(12142);const g=(u,o,m)=>(u.forEach(c=>{const p=c.refId;if(!p)return;let f=m[p];if(f===void 0&&c.meta?.preferredVisualisationType==="rawPrometheus"){const h=(0,s.a)(p);f=m[h]}const E=o.filter(h=>h.source.uid===f);d(c,E)}),u),d=(u,o)=>{u.fields.forEach(m=>{m.config.links=m.config.links?.filter(c=>c.origin!==n.n1.Correlations)||[],o.map(c=>{c.config?.field===m.name&&m.config.links.push({internal:{query:c.config?.target,datasourceUid:c.target.uid,datasourceName:c.target.name,transformations:c.config?.transformations},url:"",title:c.label||c.target.name,origin:n.n1.Correlations})})})},l=async u=>(0,t.n)((0,i.i)().fetch({url:"/api/datasources/correlations",method:"GET",showErrorAlert:!1,params:{sourceUID:u}})).then(r.Yu).then(r.I0)},39705:(j,I,e)=>{"use strict";e.d(I,{Bl:()=>D,FJ:()=>E,Mi:()=>c,RS:()=>y,Rh:()=>u,WJ:()=>f,Ym:()=>o,bS:()=>p,jI:()=>v,r5:()=>h,zZ:()=>m});var t=e(4371),n=e(78209),i=e(73289),s=e(33877),r=e(73807);function g(a){return typeof a=="object"&&a!=null&&"error"in a}const d=({baseUrl:a})=>async C=>{try{const{data:P,...b}=await(0,n.n)((0,i.i)().fetch({...C,url:a+C.url,showErrorAlert:C.showErrorAlert}));return{data:P,meta:b}}catch(P){return C.manageError?C.manageError(P):{error:P}}},l=a=>({error:(0,i.kW)(a)&&a.status!==404?a:null}),u=(0,t.LC)({reducerPath:"publicDashboardApi",baseQuery:d({baseUrl:"/api"}),tagTypes:["PublicDashboard","AuditTablePublicDashboard","UsersWithActiveSessions","ActiveUserDashboards"],refetchOnMountOrArgChange:!0,endpoints:a=>({getPublicDashboard:a.query({query:C=>({url:`/dashboards/uid/${C}/public-dashboards`,manageError:l,showErrorAlert:!1}),async onQueryStarted(C,{dispatch:P,queryFulfilled:b}){try{await b}catch(M){g(M)&&(0,i.kW)(M.error)&&P((0,s.$l)((0,r.t_)(M.error.data.message)))}},providesTags:(C,P,b)=>[{type:"PublicDashboard",id:b}]}),createPublicDashboard:a.mutation({query:C=>({url:`/dashboards/uid/${C.dashboard.uid}/public-dashboards`,method:"POST",data:C.payload}),async onQueryStarted({dashboard:C,payload:P},{dispatch:b,queryFulfilled:M}){const{data:T}=await M;b((0,s.$l)((0,r.AT)("Dashboard is public!"))),C.updateMeta({publicDashboardUid:T.uid,publicDashboardEnabled:T.isEnabled})},invalidatesTags:(C,P,{dashboard:b})=>[{type:"PublicDashboard",id:b.uid}]}),updatePublicDashboard:a.mutation({query:C=>({url:`/dashboards/uid/${C.dashboard.uid}/public-dashboards/${C.payload.uid}`,method:"PATCH",data:C.payload}),async onQueryStarted({dashboard:C,payload:P},{dispatch:b,queryFulfilled:M}){const{data:T}=await M;b((0,s.$l)((0,r.AT)("Public dashboard updated!"))),C.updateMeta&&C.updateMeta({publicDashboardUid:T.uid,publicDashboardEnabled:T.isEnabled})},invalidatesTags:(C,P,{payload:b})=>[{type:"PublicDashboard",id:b.dashboardUid},"AuditTablePublicDashboard"]}),addRecipient:a.mutation({query:()=>({url:""})}),deleteRecipient:a.mutation({query:()=>({url:""})}),reshareAccessToRecipient:a.mutation({query:()=>({url:""})}),getActiveUsers:a.query({query:()=>({url:"/"}),providesTags:["UsersWithActiveSessions"]}),getActiveUserDashboards:a.query({query:()=>({url:""}),providesTags:(C,P,b)=>[{type:"ActiveUserDashboards",id:b}]}),listPublicDashboards:a.query({query:(C=1)=>({url:`/dashboards/public-dashboards?page=${C}&perpage=8`}),transformResponse:C=>({...C,totalPages:Math.ceil(C.totalCount/C.perPage)}),providesTags:["AuditTablePublicDashboard"]}),deletePublicDashboard:a.mutation({query:C=>({url:`/dashboards/uid/${C.dashboardUid}/public-dashboards/${C.uid}`,method:"DELETE"}),async onQueryStarted({dashboard:C,uid:P},{dispatch:b,queryFulfilled:M}){await M,b((0,s.$l)((0,r.AT)("Public dashboard deleted!"))),C?.updateMeta({publicDashboardUid:P,publicDashboardEnabled:!1})},invalidatesTags:(C,P,{dashboardUid:b})=>[{type:"PublicDashboard",id:b},"AuditTablePublicDashboard","UsersWithActiveSessions","ActiveUserDashboards"]})})}),{useGetPublicDashboardQuery:o,useCreatePublicDashboardMutation:m,useUpdatePublicDashboardMutation:c,useDeletePublicDashboardMutation:p,useListPublicDashboardsQuery:f,useAddRecipientMutation:E,useDeleteRecipientMutation:h,useReshareAccessToRecipientMutation:y,useGetActiveUsersQuery:v,useGetActiveUserDashboardsQuery:D}=u},50389:(j,I,e)=>{"use strict";e.d(I,{E:()=>o});var t=e(89949),n=e(10864),i=e(12308),s=e(75766),r=e(73668),g=e(41139),d=e(5399),l=e(6230);function u(m){return m.libraryPanel&&typeof m.libraryPanel.name=="string"&&typeof m.libraryPanel.uid=="string"}class o{async makeExportable(c){c.cleanUpRepeats();const p=c.getSaveModelClone();p.id=null,c.processRepeats();const f=[],E={},h={},y={},v=new Map;for(const P of p.getVariables())y[P.name]=P;const D=(P,b)=>{if(P.datasource===void 0){P.datasource=b;return}let M=P.datasource,T=null;const S=M?.uid;return S&&S.indexOf("$")===0&&(T=y[S.substring(1)],T&&T.current&&(M=T.current.value)),(0,n.F)().get(M).then(x=>{if(x.meta?.builtIn||(E["datasource"+x.meta?.id]={type:"datasource",id:x.meta.id,name:x.meta.name,version:x.meta.info.version||"1.0.0"},T))return;const O="DS_"+x.name.replace(" ","_").toUpperCase();h[O]={name:O,label:x.name,description:"",type:"datasource",pluginId:x.meta?.id,pluginName:x.meta?.name},P.datasource={type:x.meta.id,uid:"${"+O+"}"}})},a=async P=>{if(P.type!=="row"){if(await D(P),P.targets)for(const M of P.targets)await D(M,P.datasource);const b=i.default.panels[P.type];b&&(E["panel"+b.id]={type:"panel",id:b.id,name:b.name,version:b.info.version})}},C=async P=>{if((0,r.V)(P)){const{name:b,uid:M}=P.libraryPanel;let T=P.libraryPanel.model;T||(T=(await(0,s.Mh)(M,!0)).model),await D(T);const{gridPos:S,id:x,...O}=T;v.has(M)||v.set(M,{name:b,uid:M,kind:g.V.Panel,model:O})}};try{for(const M of p.panels)if(await a(M),M.collapsed!==void 0&&M.collapsed===!0&&M.panels)for(const T of M.panels)await a(T);for(const M of p.getVariables())(0,d.Xh)(M)&&(await D(M),M.options=[],M.current={},M.refresh=M.refresh!==l.Bd.never?M.refresh:l.Bd.onDashboardLoad);for(const M of p.annotations.list)await D(M);E.grafana={type:"grafana",id:"grafana",name:"Grafana",version:i.default.buildInfo.version};for(const M of p.panels)if(await C(M),M.collapsed!==void 0&&M.collapsed===!0&&M.panels)for(const T of M.panels)await C(T);(0,t.each)(h,M=>{f.push(M)});for(const M of p.getVariables())if((0,d.VC)(M)){const T="VAR_"+M.name.replace(" ","_").toUpperCase();f.push({name:T,type:"constant",label:M.label||M.name,value:M.query,description:""}),M.query="${"+T+"}",M.current={value:M.query,text:M.query,selected:!1},M.options=[M.current]}const P=[...v.entries()].reduce((M,[T,S])=>(M[T]=S,M),{}),b=(0,t.defaults)({__inputs:f,__elements:P,__requires:(0,t.sortBy)(E,["id"])},p);for(let M=0;M<b.panels.length;M++){const T=b.panels[M];u(T)&&(b.panels[M]={gridPos:T.gridPos,id:T.id,libraryPanel:{uid:T.libraryPanel.uid,name:T.libraryPanel.name}})}return b}catch(P){return console.error("Export failed:",P),{error:P}}}}},78474:(j,I,e)=>{"use strict";e.d(I,{u:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(67437);const r=({icon:d,iconType:l,iconSize:u,tooltip:o,onClick:m,children:c})=>{const p=(0,i.wW)(g);return n.createElement("div",{className:p.noBorderContainer},d&&n.createElement(s.h,{name:d,size:u,iconType:l,tooltip:o,tooltipPlacement:"bottom",onClick:m}),c)},g=d=>({noBorderContainer:(0,t.css)` padding: 0 ${d.spacing(.5)}; display: flex; `})},57082:(j,I,e)=>{"use strict";e.d(I,{C:()=>m});var t=e(27702),n=e(1726),i=e(32713),s=e(26862),r=e(37827),g=e(66574),d=e(65322),l=e(91368),u=e(26858),o=e(43620);class m extends t.Component{constructor(){super(...arguments),this.onChangeRefreshInterval=p=>{(0,u.$t)().setAutoRefresh(p),this.forceUpdate()},this.onRefresh=()=>((0,u.$t)().refreshTimeModel(),Promise.resolve()),this.onMoveBack=()=>{g.h$.publish(new o.Qt({direction:o.Im.Left}))},this.onMoveForward=()=>{g.h$.publish(new o.Qt({direction:o.Im.Right}))},this.onChangeTimePicker=p=>{const{dashboard:f}=this.props,E=f.timepicker,h=E.nowDelay&&p.raw.to==="now",y=n.isMathString(p.raw.from)?p.raw.from:p.from,v=n.isMathString(p.raw.to)?p.raw.to:p.to,D={from:y,to:h?"now-"+E.nowDelay:v};(0,u.$t)().setTime(D)},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=()=>{g.h$.publish(new o.p8({scale:2}))}}componentDidMount(){this.sub=this.props.dashboard.events.subscribe(i.md,()=>this.forceUpdate())}componentWillUnmount(){this.sub?.unsubscribe()}render(){const{dashboard:p,isOnCanvas:f}=this.props,{refresh_intervals:E}=p.timepicker,h=(0,u.$t)().getValidIntervals(E||s.o5),y=(0,u.$t)().timeRange(),v=p.getTimezone(),D=p.fiscalYearStartMonth,a=p.panelInEdit?.isEditing;let C;return p.refresh===l.Wg&&(C=(0,u.$t)().getAutoRefreshInteval().interval),t.createElement(t.Fragment,null,t.createElement(r.a,{value:y,onChange:this.onChangeTimePicker,timeZone:v,fiscalYearStartMonth:D,onMoveBackward:this.onMoveBack,onMoveForward:this.onMoveForward,onZoom:this.onZoom,onChangeTimeZone:this.onChangeTimeZone,onChangeFiscalYearStartMonth:this.onChangeFiscalYearStartMonth,isOnCanvas:f}),t.createElement(s.dP,{onIntervalChanged:this.onChangeRefreshInterval,onRefresh:this.onRefresh,value:p.refresh,intervals:h,isOnCanvas:f,tooltip:(0,d.t)("dashboard.toolbar.refresh","Refresh dashboard"),noIntervalPicker:a,showAutoInterval:!0,text:C}))}}},97188:(j,I,e)=>{"use strict";e.d(I,{t:()=>ce});var t=e(42844),n=e(27702),i=e(27173),s=e(7662),r=e(48154),g=e(74639),d=e(26129),l=e(75340),u=e(3613),o=e(65333),m=e(77720),c=e(30973),p=e(60729),f=e(84693),E=e(75443),h=e(80557),y=e(12308),v=e(73807),D=e(66574);function a(ke,et){const[we,_e]=(0,n.useState)();return(0,n.useEffect)(()=>{const Ge=ke.subscribe(et,_e);return()=>Ge.unsubscribe()},[ke,et]),we}var C=e(65322),P=e(78467),b=e(66310),M=e(80434),T=e(66670),S=e(73453),x=e(86312),O=e(34667),B=e(89746),A=e(8594),V=e(18771),W=e(10974);const N=({dashboard:ke})=>{const et=(0,n.useMemo)(()=>(0,A.uZ)(),[]),we=(0,V.useDispatch)(),_e=(0,V.useSelector)(Ge=>Ge.dashboard.initialDatasource);return n.createElement(B.v,null,n.createElement(B.v.Item,{key:"add-visualisation",testId:g.wl.pages.AddDashboard.itemButton("Add new visualization menu item"),label:(0,C.t)("dashboard.add-menu.visualization","Visualization"),onClick:()=>{const Ge=(0,A.LU)(ke,_e);(0,x.ff)("dashboards_toolbar_add_clicked",{item:"add_visualization"}),d.E1.partial({editPanel:Ge}),we((0,W.Rd)(void 0))}}),O.config.featureToggles.vizAndWidgetSplit&&n.createElement(B.v.Item,{key:"add-widget",testId:g.wl.pages.AddDashboard.itemButton("Add new widget menu item"),label:(0,C.t)("dashboard.add-menu.widget","Widget"),onClick:()=>{(0,x.ff)("dashboards_toolbar_add_clicked",{item:"add_widget"}),d.E1.partial({addWidget:!0})}}),n.createElement(B.v.Item,{key:"add-row",testId:g.wl.pages.AddDashboard.itemButton("Add new row menu item"),label:(0,C.t)("dashboard.add-menu.row","Row"),onClick:()=>{(0,x.ff)("dashboards_toolbar_add_clicked",{item:"add_row"}),(0,A.L_)(ke)}}),n.createElement(B.v.Item,{key:"add-panel-lib",testId:g.wl.pages.AddDashboard.itemButton("Add new panel from panel library menu item"),label:(0,C.t)("dashboard.add-menu.import","Import from library"),onClick:()=>{(0,x.ff)("dashboards_toolbar_add_clicked",{item:"import_from_library"}),(0,A.RB)(ke)}}),n.createElement(B.v.Item,{key:"add-panel-clipboard",testId:g.wl.pages.AddDashboard.itemButton("Add new panel from clipboard menu item"),label:(0,C.t)("dashboard.add-menu.paste-panel","Paste panel"),onClick:()=>{(0,x.ff)("dashboards_toolbar_add_clicked",{item:"paste_panel"}),(0,A.Dh)(ke,et)},disabled:!et}))},k=({dashboard:ke})=>{const et=H((0,b.l4)()),[we,_e]=(0,n.useState)(!1);return n.createElement(M.L,{overlay:()=>n.createElement(N,{dashboard:ke}),placement:"bottom",offset:[0,6],onVisibleChange:_e},n.createElement(T.zx,{icon:"panel-add",size:"lg",fill:"text",className:(0,t.cx)(et.button,et.buttonIcon,et.buttonText),"data-testid":g.wl.components.PageToolbar.itemButton("Add button")},n.createElement(C.cC,{i18nKey:"dashboard.toolbar.add"},"Add"),n.createElement(S.J,{name:we?"angle-up":"angle-down",size:"lg"})))};function H(ke){return{button:(0,t.css)({label:"add-panel-button",padding:ke.spacing(.5,.5,.5,.75),height:ke.spacing((ke.components.height.sm+ke.components.height.md)/2),borderRadius:ke.shape.radius.default}),buttonIcon:(0,t.css)({svg:{margin:0}}),buttonText:(0,t.css)({label:"add-panel-button-text",fontSize:ke.typography.body.fontSize,span:{marginLeft:ke.spacing(.67)}})}}var R=e(37778),_=e(75261),G=e(79517),Y=e(83341),X=e(43620),Q=e(78474),se=e(57082),Z=e(89033),le=e(19067);const oe=({dashboard:ke})=>{const[et]=(0,Z.K)(),{showModal:we,hideModal:_e}=(0,n.useContext)(p.kr);return(0,n.useEffect)(()=>(et.shareView&&we(le.ShareModal,{dashboard:ke,onDismiss:_e,activeTab:String(et.shareView)}),()=>{_e()}),[we,_e,ke,et.shareView]),n.createElement(Q.u,{tooltip:(0,C.t)("dashboard.toolbar.share","Share dashboard or panel"),icon:"share-alt",iconSize:"lg",onClick:()=>{we(le.ShareModal,{dashboard:ke,onDismiss:_e})}})},q={setStarred:P.OQ,updateTimeZoneForSession:Y.YT},ne=(0,i.connect)(null,q),ge=g.wl.pages.Dashboard.DashNav,ae=[],re=[];function De(ke){ae.push(ke)}function he(ke){re.push(ke)}const ye=n.memo(ke=>{(0,s.TH)();const et=(0,l.N)();a(ke.dashboard.events,X.hS);const we=ke.dashboard.snapshot?.originalUrl??"",_e=()=>{window.location.href=r.QX.sanitizeUrl(ke.dashboard.snapshot.originalUrl)},Ge=(0,v.iG)(),qe=()=>{try{const ct=new URL(r.QX.sanitizeUrl(we),y.default.appUrl),it=new URL(y.default.appUrl);ct.host!==it.host?D.h$.publish(new X.Dn({component:u.s,props:{title:"Proceed to external site?",modalClass:We,body:n.createElement(n.Fragment,null,n.createElement("p",null,"This link connects to an external website at"," ",n.createElement("code",null,we)),n.createElement("p",null,"Are you sure you'd like to proceed?")),confirmVariant:"primary",confirmText:"Proceed",onConfirm:_e}})):_e()}catch(ct){Ge.error("Invalid URL",ct instanceof Error?ct.message:void 0)}},st=()=>{const ct=(0,_.h4)(),{dashboard:it,setStarred:me}=ke;ct.starDashboard(it.uid,!!it.meta.isStarred).then(Ee=>{me({id:it.uid,title:it.title,url:it.meta.url??"",isStarred:Ee}),it.meta.isStarred=Ee,et()})},Me=()=>{d.E1.partial({editview:"settings"})},be=()=>{G.r0.prev()},Ke=()=>{G.r0.next()},Ye=()=>{G.r0.stop(),et()},tt=(ct,it)=>{ct.map((me,Ee)=>{const Ce=me.component,Ae=n.createElement(Ce,{...ke,key:`button-custom-${Ee}`});typeof me.index=="number"?it.splice(me.index,0,Ae):it.push(Ae)})},nt=()=>G.r0.isPlaying,Pt=()=>{const{dashboard:ct,kioskMode:it}=ke,{canStar:me,canShare:Ee,isStarred:Ce}=ct.meta,Ae=[];if(it||nt())return[];if(me){let ze=Ce?(0,C.t)("dashboard.toolbar.unmark-favorite","Unmark as favorite"):(0,C.t)("dashboard.toolbar.mark-favorite","Mark as favorite");Ae.push(n.createElement(Q.u,{tooltip:ze,icon:Ce?"favorite":"star",iconType:Ce?"mono":"default",iconSize:"lg",onClick:st,key:"button-star"}))}return Ee&&Ae.push(n.createElement(oe,{key:"button-share",dashboard:ct})),ct.meta.publicDashboardEnabled&&Ae.push(n.createElement(o.V,{key:"public-dashboard",name:"Public",colorIndex:5,"data-testid":ge.publicDashboardTag})),y.default.featureToggles.scenes&&Ae.push(n.createElement(Q.u,{key:"button-scenes",tooltip:"View as Scene",icon:"apps",onClick:()=>d.E1.push(`/scenes/dashboard/${ct.uid}`)})),tt(ae,Ae),Ae},xt=()=>n.createElement(m.h,{key:"playlist-buttons"},n.createElement(c.h,{tooltip:(0,C.t)("dashboard.toolbar.playlist-previous","Go to previous dashboard"),icon:"backward",onClick:be,narrow:!0}),n.createElement(c.h,{onClick:Ye},n.createElement(C.cC,{i18nKey:"dashboard.toolbar.playlist-stop"},"Stop playlist")),n.createElement(c.h,{tooltip:(0,C.t)("dashboard.toolbar.playlist-next","Go to next dashboard"),icon:"forward",onClick:Ke,narrow:!0})),bt=()=>{const{dashboard:ct,updateTimeZoneForSession:it,hideTimePicker:me}=ke;return me?null:n.createElement(se.C,{dashboard:ct,onChangeTimeZone:it,key:"time-controls"})},Rt=()=>{const{dashboard:ct,onAddPanel:it,isFullscreen:me,kioskMode:Ee}=ke,{canSave:Ce,canEdit:Ae,showSettings:ze}=ct.meta,{snapshot:Ie}=ct,xe=Ie&&Ie.originalUrl,Te=[];return nt()?[xt(),bt()]:Ee===V.KioskMode.TV?[bt()]:(Ae&&!me&&(y.default.featureToggles.emptyDashboardPage?Te.push(n.createElement(k,{dashboard:ct,key:"panel-add-dropdown"})):Te.push(n.createElement(c.h,{tooltip:(0,C.t)("dashboard.toolbar.add-panel","Add panel"),icon:"panel-add",iconSize:"xl",onClick:it,key:"button-panel-add"}))),Ce&&!me&&Te.push(n.createElement(p.JY,{key:"button-save"},({showModal:Oe,hideModal:ie})=>n.createElement(c.h,{tooltip:(0,C.t)("dashboard.toolbar.save","Save dashboard"),icon:"save",onClick:()=>{Oe(R.d,{dashboard:ct,onDismiss:ie})}}))),xe&&Te.push(n.createElement(c.h,{tooltip:(0,C.t)("dashboard.toolbar.open-original","Open original dashboard"),onClick:qe,icon:"link",key:"button-snapshot"})),ze&&Te.push(n.createElement(c.h,{tooltip:(0,C.t)("dashboard.toolbar.settings","Dashboard settings"),icon:"cog",onClick:Me,key:"button-settings"})),tt(re,Te),Te.push(bt()),Te)};return n.createElement(E.A,{actions:n.createElement(n.Fragment,null,Pt(),n.createElement(h.M,{leftActionsSeparator:!0}),n.createElement(f.R,{alignment:"right"},Rt()))})});ye.displayName="DashNav";const ce=ne(ye),We=(0,t.css)({width:"max-content",maxWidth:"80vw"})},37232:(j,I,e)=>{"use strict";e.d(I,{P:()=>h});var t=e(89949),n=e(27702),i=e(76305),s=e(74639),r=e(62499),g=e(22209),d=e(15672),l=e(63014),u=e(1128),o=e(42074),m=e(26862),c=e(26858);const p=({refreshIntervals:y,onRefreshIntervalChange:v,getIntervalsFunc:D=E,validateIntervalsFunc:a=f})=>{const[C,P]=(0,n.useState)(D(y??m.o5)),[b,M]=(0,n.useState)(null);(0,n.useEffect)(()=>{const O=D(y??m.o5);P(O)},[D,y]);const T=(0,n.useMemo)(()=>Array.isArray(C)?C.join(","):"",[C]),S=(0,n.useCallback)(O=>{const B=O.currentTarget.value?O.currentTarget.value.split(","):[];P(B)},[P]),x=(0,n.useCallback)(O=>{const B=a(C);B===null&&v(D(C)),M(B)},[D,C,v,a]);return n.createElement(g.g,{label:"Auto refresh",description:"Define the auto refresh intervals that should be available in the auto refresh list.",error:b,invalid:!!b},n.createElement(u.I,{id:"auto-refresh-input",invalid:!!b,value:T,onChange:S,onBlur:x}))},f=(y,v={getTimeSrv:c.$t})=>{try{return E(y,v),null}catch(D){return D instanceof Error?D.message:"Invalid intervals"}},E=(y,v={getTimeSrv:c.$t})=>{const D=y.filter(a=>a.trim()!=="").map(a=>a.replace(/\s+/g,""));return[...new Set(v.getTimeSrv().getValidIntervals(D))]};class h extends n.PureComponent{constructor(){super(...arguments),this.state={isNowDelayValid:!0},this.onNowDelayChange=v=>{const D=v.currentTarget.value;if((0,t.isEmpty)(D))return this.setState({isNowDelayValid:!0}),this.props.onNowDelayChange(D);if(i.isValidTimeSpan(D))return this.setState({isNowDelayValid:!0}),this.props.onNowDelayChange(D);this.setState({isNowDelayValid:!1})},this.onHideTimePickerChange=()=>{this.props.onHideTimePickerChange(!this.props.timePickerHidden)},this.onLiveNowChange=()=>{this.props.onLiveNowChange(!this.props.liveNow)},this.onTimeZoneChange=v=>{typeof v=="string"&&this.props.onTimeZoneChange(v)},this.onWeekStartChange=v=>{this.props.onWeekStartChange(v)}}render(){return n.createElement(r.s,{label:"Time options",isOpen:!0},n.createElement(g.g,{label:"Time zone","data-testid":s.wl.components.TimeZonePicker.containerV2},n.createElement(d.O,{inputId:"time-options-input",includeInternal:!0,value:this.props.timezone,onChange:this.onTimeZoneChange,width:40})),n.createElement(g.g,{label:"Week start","data-testid":s.wl.components.WeekStartPicker.containerV2},n.createElement(l.z,{inputId:"week-start-input",width:40,value:this.props.weekStart,onChange:this.onWeekStartChange})),n.createElement(p,{refreshIntervals:this.props.refreshIntervals,onRefreshIntervalChange:this.props.onRefreshIntervalChange}),n.createElement(g.g,{label:"Now delay",description:"Exclude recent data that may be incomplete."},n.createElement(u.I,{id:"now-delay-input",invalid:!this.state.isNowDelayValid,placeholder:"0m",onChange:this.onNowDelayChange,defaultValue:this.props.nowDelay})),n.createElement(g.g,{label:"Hide time picker"},n.createElement(o.r,{id:"hide-time-picker-toggle",value:!!this.props.timePickerHidden,onChange:this.onHideTimePickerChange})),n.createElement(g.g,{label:"Refresh live dashboards",description:"Continuously re-draw panels where the time range references 'now'"},n.createElement(o.r,{id:"refresh-live-dashboards-toggle",value:!!this.props.liveNow,onChange:this.onLiveNowChange})))}}},83961:(j,I,e)=>{"use strict";e.d(I,{D:()=>Ss});var t=e(27702),n=e(7662),i=e(94469),s=e(74639),r=e(26129),g=e(66670),d=e(84693),l=e(75443),u=e(44644),o=e(12308),m=e(91368),c=e(18771),p=e(43620),f=e(27173),E=e(33199),h=e(42844),y=e(25111),v=e(86312),D=e(66310),a=e(62499),C=e(64022),P=e(62108),b=e(80011),M=e(73453),T=e(67437),S=e(13741);const x=({nodes:Ct,edges:gt,direction:kt,width:Kt,height:an,onDoubleClick:yn})=>{const hn=(0,t.useRef)(null),Ln=(0,t.useRef)(null),un=(0,t.useCallback)(Et=>{yn&&yn(Et.nodes[0])},[yn]);return(0,t.useEffect)(()=>((async()=>{const Vn=await e.e(8271).then(e.t.bind(e,23874,23)),da={nodes:O(Vn,Ct),edges:B(Vn,gt)},Ga={width:"100%",height:"100%",autoResize:!0,layout:{improvedLayout:!0,hierarchical:{enabled:!0,direction:kt??"DU",sortMethod:"directed"}},interaction:{navigationButtons:!0,dragNodes:!1}};hn.current=new Vn.Network(Ln.current,da,Ga),hn.current?.on("doubleClick",un)})(),()=>{hn.current&&hn.current.off("doubleClick")}),[kt,gt,Ct,un]),t.createElement("div",null,t.createElement("div",{ref:Ln,style:{width:Kt??"100%",height:an??"60vh"}}))};function O(Ct,gt){const kt=gt.map(Kt=>({...Kt,shape:"box"}));return new Ct.DataSet(kt)}function B(Ct,gt){const kt=gt.map(Kt=>({...Kt,arrows:"to",dashes:!0}));return new Ct.DataSet(kt)}function A({edges:Ct,nodes:gt,show:kt,title:Kt,children:an}){const[yn,hn]=(0,t.useState)(kt),Ln=(0,t.useCallback)(()=>hn(!0),[hn]),un=(0,t.useCallback)(()=>hn(!1),[hn]);return t.createElement(t.Fragment,null,t.createElement(S.u,{isOpen:yn,title:Kt,icon:"info-circle",iconTooltip:"The graph can be moved, zoomed in, and zoomed out.",onClickBackdrop:un,onDismiss:un},t.createElement(x,{nodes:gt,edges:Ct})),an({showModal:Ln}))}const V=({id:Ct,usages:gt})=>{const kt=(0,t.useMemo)(()=>gt.find(an=>an.variable.id===Ct),[Ct,gt]);if(!kt)return null;const Kt=kt.nodes.map(an=>an.label.includes(`$${Ct}`)?{...an,color:"#FB7E81"}:an);return t.createElement(A,{show:!1,title:`Showing usages for: $${Ct}`,nodes:Kt,edges:kt.edges},({showModal:an})=>t.createElement(T.h,{onClick:()=>an(),name:"code-branch",tooltip:"Show usages","data-testid":"VariablesUnknownButton"}))};var W=e(44068);const w=1e3;function N({variables:Ct,dashboard:gt}){const[kt,Kt]=(0,t.useState)(!1),[an,yn]=(0,t.useState)(0),[hn,Ln]=(0,t.useState)([]),un=(0,D.wW)(R);(0,t.useEffect)(()=>yn(da=>da+1),[Ct,gt]);const{loading:Et}=(0,y.Z)(async()=>{if(kt&&an>0){const da=Date.now(),Ga=await(0,W.Yg)(Ct,gt),rs=Date.now()-da;return rs>=w&&(0,v.ff)("Slow unknown variables expansion",{elapsed:rs}),yn(0),Ln(Ga),Ga}return[]},[Ct,gt,kt,an]),Vn=da=>{da&&(0,v.ff)("Unknown variables section expanded"),Kt(da)};return t.createElement("div",{className:un.container},t.createElement(a.s,{label:t.createElement(F,null),isOpen:kt,onToggle:Vn},Et&&t.createElement(C.wc,{justify:"center"},t.createElement(C.Lh,{justify:"center"},t.createElement("span",null,"Loading..."),t.createElement(P.$,{size:16}))),!Et&&hn&&t.createElement(t.Fragment,null,hn.length===0&&t.createElement(k,null),hn.length>0&&t.createElement(H,{usages:hn}))))}function F(){const Ct=(0,D.wW)(R);return t.createElement("h5",null,"Renamed or missing variables",t.createElement(b.u,{content:"Click to expand a list with all variable references that have been renamed or are missing from the dashboard."},t.createElement(M.J,{name:"info-circle",className:Ct.infoIcon})))}function k(){return t.createElement("span",null,"No renamed or missing variables found.")}function H({usages:Ct}){const gt=(0,D.wW)(R);return t.createElement("table",{className:"filter-table filter-table--hover"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,"Variable"),t.createElement("th",{colSpan:5}))),t.createElement("tbody",null,Ct.map(kt=>{const{variable:Kt}=kt,{id:an,name:yn}=Kt;return t.createElement("tr",{key:an},t.createElement("td",{className:gt.firstColumn},t.createElement("span",null,yn)),t.createElement("td",{className:gt.defaultColumn}),t.createElement("td",{className:gt.defaultColumn}),t.createElement("td",{className:gt.defaultColumn}),t.createElement("td",{className:gt.lastColumn},t.createElement(V,{id:Kt.id,usages:Ct})))})))}const R=Ct=>({container:(0,h.css)` margin-top: ${Ct.spacing(4)}; padding-top: ${Ct.spacing(4)}; `,infoIcon:(0,h.css)` margin-left: ${Ct.spacing(1)}; `,defaultColumn:(0,h.css)` width: 1%; `,firstColumn:(0,h.css)` width: 1%; vertical-align: top; color: ${Ct.colors.text.maxContrast}; `,lastColumn:(0,h.css)` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; text-align: right; `});var _=e(1941),G=e(51824),Y=e(60344),X=e(81587),Q=e(3613);function se({varName:Ct,isOpen:gt=!1,onConfirm:kt,onDismiss:Kt}){return t.createElement(Q.s,{title:"Delete variable",isOpen:gt,onConfirm:kt,onDismiss:Kt,body:` Are you sure you want to delete variable "${Ct}"? `,modalClass:Z.modal,confirmText:"Delete"})}const Z={modal:(0,h.css)({width:"max-content",maxWidth:"80vw"})};var le=e(53933),oe=e(41355),q=e(5399),ne=e(4684),ge=e(82986),ae=e(22209),re=e(40705);const De=[{label:"Label and value",value:ge.bU.dontHide},{label:"Value",value:ge.bU.hideLabel},{label:"Nothing",value:ge.bU.hideVariable}];function he({onChange:Ct,hide:gt,type:kt}){const Kt=(0,t.useMemo)(()=>De.find(an=>an.value===gt)?.value??De[0].value,[gt]);return kt==="constant"?null:t.createElement(ae.g,{label:"Show on dashboard"},t.createElement(re.S,{options:De,onChange:Ct,value:Kt}))}var ye=e(95774),ce=e(62981),We=e(24446),ke=e(1781);function et({onChange:Ct,type:gt}){const kt=(0,t.useMemo)(()=>(0,X.bi)(),[]),Kt=(0,t.useMemo)(()=>kt.find(an=>an.value===gt)??kt[0],[kt,gt]);return t.createElement(ke.u,{name:"Select variable type",value:Kt,options:kt,onChange:Ct,testId:s.wl.pages.Dashboard.Settings.Variables.Edit.General.generalTypeSelectV2})}var we=e(71107),_e=e(53901);const Ge=({variable:{options:Ct}})=>{const[gt,kt]=(0,t.useState)(20),[Kt,an]=(0,t.useState)([]),yn=(0,t.useCallback)(Ln=>{Ln.preventDefault(),kt(gt+20)},[gt,kt]),hn=(0,D.wW)(qe);return(0,t.useEffect)(()=>an(Ct.slice(0,gt)),[gt,Ct]),Kt.length?t.createElement("div",{style:{display:"flex",flexDirection:"column",marginTop:"16px"}},t.createElement("h5",null,"Preview of values"),t.createElement(we.Z,null,Kt.map((Ln,un)=>t.createElement(we.Z,{key:`${Ln.value}-${un}`,className:hn.optionContainer},t.createElement(_e.W,{"aria-label":s.wl.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption},t.createElement("div",{className:hn.label},Ln.text))))),Ct.length>gt&&t.createElement(we.Z,{className:hn.optionContainer},t.createElement(g.zx,{onClick:yn,variant:"secondary",size:"sm","aria-label":"Variable editor Preview of Values Show More link"},"Show more"))):null};Ge.displayName="VariableValuesPreview";function qe(Ct){return{wrapper:(0,h.css)({display:"flex",flexDirection:"column",marginTop:Ct.spacing(2)}),optionContainer:(0,h.css)({marginLeft:Ct.spacing(.5),marginBottom:Ct.spacing(.5)}),label:(0,h.css)({whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"50vw"})}}var st=e(89949),Me=e(24877),be=e(39655);const Ke=Ct=>async gt=>{const{rootStateKey:kt}=Ct;gt((0,_.mb)(kt,(0,be.wJ)({name:(0,G.E0)(Ct).name,id:Ct.id})))},Ye=Ct=>async(gt,kt)=>{const{rootStateKey:Kt}=Ct;gt((0,_.mb)(Kt,(0,be.qe)((0,X.Y6)(Ct))))},tt=(Ct,gt)=>(kt,Kt)=>{const{id:an,rootStateKey:yn}=Ct;let hn=null;if(gt.match(/^(?!__).*$/)||(hn="Template names cannot begin with '__', that's reserved for Grafana's global variables"),gt.match(/^\w+$/)||(hn="Only word and digit characters are allowed in variable names"),(0,G.gt)(yn,Kt()).filter(Et=>Et.name===gt&&Et.id!==an).length&&(hn="Variable with the same name already exists"),hn){kt((0,_.mb)(yn,(0,be.y8)({newName:gt,errorText:hn})));return}kt(nt(Ct,gt))},nt=(Ct,gt)=>(kt,Kt)=>{const{rootStateKey:an}=Ct,yn=(0,G.E0)(Ct,Kt());if(yn.name===gt){kt((0,_.mb)(an,(0,be.Yo)((0,X.Y6)(Ct,{newName:gt}))));return}const hn={...(0,st.cloneDeep)(yn),name:gt,id:gt},Ln=yn.global,un=yn.index,Et=(0,X.yQ)(hn);kt((0,_.mb)(an,(0,Y.VN)((0,X.Y6)(Et,{global:Ln,index:un,model:hn})))),kt((0,_.mb)(an,(0,be.Yo)((0,X.Y6)(Et,{newName:gt})))),kt((0,_.mb)(an,(0,Y.mZ)((0,X.Y6)(Ct,{reIndex:!1}))))},Pt=(Ct,gt="query")=>(kt,Kt)=>{const an=(0,X.mn)(Ct),yn=(0,G.gt)(an,Kt()),hn=bt(gt,yn),Ln={type:gt,id:hn},un=!1,Et=(0,G.Eo)(an,Kt()),Vn=(0,st.cloneDeep)(oe.z.get(gt).initialState);Vn.id=hn,Vn.name=hn,Vn.rootStateKey=an,kt((0,_.mb)(an,(0,Y.VN)((0,X.Y6)(Ln,{global:un,model:Vn,index:Et})))),r.E1.partial({editIndex:yn.length})},xt=Ct=>(gt,kt)=>{const Kt=(0,X.mn)(Ct),an=kt(),yn=(0,G.xD)(Kt,an),hn=an.dashboard.getModel(),{usages:Ln}=(0,W.V)(yn,hn),un=(0,W.vI)(Ln);gt((0,_.mb)(Kt,(0,Me.j4)({usages:Ln,usagesNetwork:un})))};function bt(Ct,gt){let kt=0,Kt=`${Ct}${kt}`;for(;gt.find(an=>an.id===Kt);)Kt=`${Ct}${++kt}`;return Kt}var Rt=(Ct=>(Ct[Ct.MaxSize=50]="MaxSize",Ct))(Rt||{});const ct=(Ct,gt)=>({editor:(0,G.AE)(gt.identifier.rootStateKey,Ct).editor,variable:(0,G.E0)(gt.identifier,Ct)}),it=Ct=>({...(0,E.bindActionCreators)({variableEditorMount:Ke,variableEditorUnMount:Ye,changeVariableName:tt,updateOptions:ne.Rk},Ct),changeVariableProp:(gt,kt,Kt)=>Ct((0,_.mb)(gt.rootStateKey,(0,Y.Pl)((0,X.Y6)(gt,{propName:kt,propValue:Kt})))),changeVariableType:(gt,kt)=>Ct((0,_.mb)(gt.rootStateKey,(0,Y.Be)((0,X.Y6)(gt,{newType:kt})))),removeVariable:gt=>{Ct((0,_.mb)(gt.rootStateKey,(0,Y.mZ)((0,X.Y6)(gt,{reIndex:!0}))))}}),me=(0,f.connect)(ct,it);class Ee extends t.PureComponent{constructor(){super(...arguments),this.state={showDeleteModal:!1},this.onNameChange=gt=>{gt.preventDefault(),this.props.changeVariableName(this.props.identifier,gt.currentTarget.value)},this.onTypeChange=gt=>{gt.value&&this.props.changeVariableType(this.props.identifier,gt.value)},this.onLabelChange=gt=>{gt.preventDefault(),this.props.changeVariableProp(this.props.identifier,"label",gt.currentTarget.value)},this.onDescriptionChange=gt=>{this.props.changeVariableProp(this.props.identifier,"description",gt.currentTarget.value)},this.onHideChange=gt=>{this.props.changeVariableProp(this.props.identifier,"hide",gt)},this.onPropChanged=({propName:gt,propValue:kt,updateOptions:Kt=!1})=>{this.props.changeVariableProp(this.props.identifier,gt,kt),Kt&&this.props.updateOptions((0,X.yQ)(this.props.variable))},this.onHandleSubmit=async gt=>{gt.preventDefault(),this.props.editor.isValid&&this.props.updateOptions((0,X.yQ)(this.props.variable))},this.onModalOpen=()=>{this.setState({showDeleteModal:!0})},this.onModalClose=()=>{this.setState({showDeleteModal:!1})},this.onDelete=()=>{this.props.removeVariable(this.props.identifier),this.onModalClose(),r.E1.partial({editIndex:null})},this.onApply=()=>{r.E1.partial({editIndex:null})}}componentDidMount(){this.props.variableEditorMount(this.props.identifier)}componentWillUnmount(){this.props.variableEditorUnMount(this.props.identifier)}render(){const{variable:gt}=this.props,kt=oe.z.get(this.props.variable.type).editor;if(!kt)return null;const Kt=gt.state===le.Gu.Loading;return t.createElement(t.Fragment,null,t.createElement("form",{"aria-label":"Variable editor Form",onSubmit:this.onHandleSubmit},t.createElement(et,{onChange:this.onTypeChange,type:this.props.variable.type}),t.createElement(ye.e,null,"General"),t.createElement(We.V,{value:this.props.editor.name,onChange:this.onNameChange,name:"Name",placeholder:"Variable name",description:"The name of the template variable. (Max. 50 characters)",invalid:!!this.props.editor.errors.name,error:this.props.editor.errors.name,testId:s.wl.pages.Dashboard.Settings.Variables.Edit.General.generalNameInputV2,maxLength:Rt.MaxSize,required:!0}),t.createElement(We.V,{name:"Label",description:"Optional display name",value:this.props.variable.label??"",placeholder:"Label name",onChange:this.onLabelChange,testId:s.wl.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInputV2}),t.createElement(ce.W,{name:"Description",value:gt.description??"",placeholder:"Descriptive text",onChange:this.onDescriptionChange,width:52}),t.createElement(he,{onChange:this.onHideChange,hide:this.props.variable.hide,type:this.props.variable.type}),kt&&t.createElement(kt,{variable:this.props.variable,onPropChange:this.onPropChanged}),(0,q.eL)(this.props.variable)?t.createElement(Ge,{variable:this.props.variable}):null,t.createElement("div",{style:{marginTop:"16px"}},t.createElement(C.Lh,{spacing:"md",height:"inherit"},t.createElement(g.zx,{variant:"destructive",fill:"outline",onClick:this.onModalOpen},"Delete"),t.createElement(g.zx,{type:"submit","aria-label":s.wl.pages.Dashboard.Settings.Variables.Edit.General.submitButton,disabled:Kt,variant:"secondary"},"Run query",Kt&&t.createElement(M.J,{className:"spin-clockwise",name:"sync",size:"sm",style:{marginLeft:"2px"}})),t.createElement(g.zx,{variant:"primary",onClick:this.onApply,"data-testid":s.wl.pages.Dashboard.Settings.Variables.Edit.General.applyButton},"Apply")))),t.createElement(se,{isOpen:this.state.showDeleteModal,varName:this.props.editor.name,onConfirm:this.onDelete,onDismiss:this.onModalClose}))}}const Ce=me(Ee);var Ae=e(85532),ze=e(23852),Ie=e(66970),xe=e(84749);const Te=({variables:Ct})=>{const gt=(0,t.useMemo)(()=>(0,W.GQ)(Ct),[Ct]),kt=(0,t.useMemo)(()=>(0,W.MJ)(Ct),[Ct]);return kt.length?t.createElement(A,{show:!1,title:"Dependencies",nodes:(0,W.Of)(gt,kt),edges:kt},({showModal:Kt})=>t.createElement(g.zx,{onClick:()=>{(0,v.ff)("Show variable dependencies"),Kt()},icon:"channel-add",variant:"secondary"},"Show dependencies")):null},Oe=Ct=>t.createElement(f.Provider,{store:xe.h},t.createElement(Te,{...Ct})),ie=({id:Ct,usages:gt,isAdhoc:kt})=>{const Kt=(0,t.useMemo)(()=>gt.find(yn=>yn.variable.id===Ct),[gt,Ct]);if(gt.length===0||kt||!Kt)return null;const an=Kt.nodes.map(yn=>yn.label.includes(`$${Ct}`)?{...yn,color:"#FB7E81"}:yn);return t.createElement(A,{show:!1,title:`Showing usages for: $${Ct}`,nodes:an,edges:Kt.edges},({showModal:yn})=>t.createElement(T.h,{onClick:()=>{(0,v.ff)("Show variable usages"),yn()},name:"code-branch",tooltip:"Show usages"}))};function Le({index:Ct,variable:gt,usageTree:kt,usagesNetwork:Kt,onEdit:an,onDuplicate:yn,onDelete:hn}){const Ln=(0,D.l4)(),un=(0,D.wW)(ue),Et=Be(gt),da=(0,W.Rv)(gt.id,kt)>0||(0,q.Kn)(gt),Ga=(0,X.yQ)(gt);return t.createElement(Ae._l,{draggableId:JSON.stringify(Ga),index:Ct},(Cs,rs)=>t.createElement("tr",{ref:Cs.innerRef,...Cs.draggableProps,style:{userSelect:rs.isDragging?"none":"auto",background:rs.isDragging?Ln.colors.background.secondary:void 0,...Cs.draggableProps.style}},t.createElement("td",{role:"gridcell",className:un.column},t.createElement(g.zx,{size:"xs",fill:"text",onClick:Bs=>{Bs.preventDefault(),an(Ga)},className:un.nameLink,"aria-label":s.wl.pages.Dashboard.Settings.Variables.List.tableRowNameFields(gt.name)},gt.name)),t.createElement("td",{role:"gridcell",className:un.definitionColumn,onClick:Bs=>{Bs.preventDefault(),an(Ga)},"aria-label":s.wl.pages.Dashboard.Settings.Variables.List.tableRowDefinitionFields(gt.name)},Et),t.createElement("td",{role:"gridcell",className:un.column},t.createElement("div",{className:un.icons},t.createElement(Ue,{passed:da}),t.createElement(ie,{id:gt.id,isAdhoc:(0,q.Kn)(gt),usages:Kt}),t.createElement(T.h,{onClick:Bs=>{Bs.preventDefault(),(0,v.ff)("Duplicate variable"),yn(Ga)},name:"copy",tooltip:"Duplicate variable","aria-label":s.wl.pages.Dashboard.Settings.Variables.List.tableRowDuplicateButtons(gt.name)}),t.createElement(T.h,{onClick:Bs=>{Bs.preventDefault(),(0,v.ff)("Delete variable"),hn(Ga)},name:"trash-alt",tooltip:"Remove variable","aria-label":s.wl.pages.Dashboard.Settings.Variables.List.tableRowRemoveButtons(gt.name)}),t.createElement("div",{...Cs.dragHandleProps,className:un.dragHandle},t.createElement(M.J,{name:"draggabledots",size:"lg"}))))))}function Be(Ct){let gt="";return(0,q.Xh)(Ct)?Ct.definition?gt=Ct.definition:typeof Ct.query=="string"&&(gt=Ct.query):(0,q.eL)(Ct)&&(gt=Ct.query),gt}function Ue({passed:Ct}){const gt=(0,D.wW)(ue);return Ct?t.createElement(M.J,{name:"check",className:gt.iconPassed,title:"This variable is referenced by other variables or dashboard."}):t.createElement(M.J,{name:"exclamation-triangle",className:gt.iconFailed,title:"This variable is not referenced by any variable or dashboard."})}function ue(Ct){return{dragHandle:(0,h.css)` cursor: grab; margin-left: ${Ct.spacing(1)}; `,column:(0,h.css)` width: 1%; `,nameLink:(0,h.css)` cursor: pointer; color: ${Ct.colors.primary.text}; `,definitionColumn:(0,h.css)` width: 100%; max-width: 200px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; white-space: nowrap; `,iconPassed:(0,h.css)` color: ${Ct.v1.palette.greenBase}; margin-right: ${Ct.spacing(2)}; `,iconFailed:(0,h.css)` color: ${Ct.v1.palette.orange}; margin-right: ${Ct.spacing(2)}; `,icons:(0,h.css)` display: flex; gap: ${Ct.spacing(2)}; align-items: center; `}}function pe({variables:Ct,usages:gt,usagesNetwork:kt,onChangeOrder:Kt,onAdd:an,onEdit:yn,onDelete:hn,onDuplicate:Ln}){const un=Et=>{if(!Et.destination||!Et.source)return;(0,v.ff)("Variable drag and drop");const Vn=JSON.parse(Et.draggableId);Kt(Vn,Ct[Et.source.index].index,Ct[Et.destination.index].index)};return t.createElement("div",null,t.createElement("div",null,Ct.length===0&&t.createElement($e,{onAdd:an}),Ct.length>0&&t.createElement(ze.K,{direction:"column",gap:4},t.createElement("table",{className:"filter-table filter-table--hover","aria-label":s.wl.pages.Dashboard.Settings.Variables.List.table,role:"grid"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,"Variable"),t.createElement("th",null,"Definition"),t.createElement("th",{colSpan:5}))),t.createElement(Ae.Z5,{onDragEnd:un},t.createElement(Ae.bK,{droppableId:"variables-list",direction:"vertical"},Et=>t.createElement("tbody",{ref:Et.innerRef,...Et.droppableProps},Ct.map((Vn,da)=>t.createElement(Le,{index:da,key:`${Vn.name}-${da}`,variable:Vn,usageTree:gt,usagesNetwork:kt,onDelete:hn,onDuplicate:Ln,onEdit:yn})),Et.placeholder)))),t.createElement(ze.K,null,t.createElement(Oe,{variables:Ct}),t.createElement(g.zx,{"aria-label":s.wl.pages.Dashboard.Settings.Variables.List.newButton,onClick:an,icon:"plus"},"New variable")))))}function $e({onAdd:Ct}){return t.createElement("div",null,t.createElement(Ie.Z,{title:"There are no variables yet",buttonIcon:"calculator-alt",buttonTitle:"Add variable",infoBox:{__html:` <p> 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. Check out the <a class="external-link" href="https://grafana.com/docs/grafana/latest/variables/" target="_blank"> Templates and variables documentation </a> for more information. </p>`},infoBoxTitle:"What do variables do?",onClick:gt=>{gt.preventDefault(),Ct()}}))}const Se=(Ct,gt)=>{const{uid:kt}=gt.dashboard,Kt=(0,G.AE)(kt,Ct);return{variables:(0,G.xD)(kt,Ct),idInEditor:Kt.editor.id,usagesNetwork:Kt.inspect.usagesNetwork,usages:Kt.inspect.usages}},Ve=Ct=>({...(0,E.bindActionCreators)({createNewVariable:Pt,initListMode:xt},Ct),changeVariableOrder:(gt,kt,Kt)=>Ct((0,_.mb)(gt.rootStateKey,(0,Y.gE)((0,X.Y6)(gt,{fromIndex:kt,toIndex:Kt})))),duplicateVariable:gt=>Ct((0,_.mb)(gt.rootStateKey,(0,Y.Y9)((0,X.Y6)(gt,{newId:void 0})))),removeVariable:gt=>{Ct((0,_.mb)(gt.rootStateKey,(0,Y.mZ)((0,X.Y6)(gt,{reIndex:!0}))))}}),He=(0,f.connect)(Se,Ve);class Ze extends t.PureComponent{constructor(){super(...arguments),this.state={variableId:void 0},this.onEditVariable=gt=>{const kt=this.props.variables.findIndex(Kt=>Kt.id===gt.id);r.E1.partial({editIndex:kt})},this.onNewVariable=()=>{this.props.createNewVariable(this.props.dashboard.uid)},this.onChangeVariableOrder=(gt,kt,Kt)=>{this.props.changeVariableOrder(gt,kt,Kt)},this.onDuplicateVariable=gt=>{this.props.duplicateVariable(gt)},this.onModalOpen=gt=>{this.setState({variableId:gt})},this.onModalClose=()=>{this.setState({variableId:void 0})},this.onRemoveVariable=()=>{this.props.removeVariable(this.state.variableId),this.onModalClose()}}componentDidMount(){this.props.initListMode(this.props.dashboard.uid)}render(){const{editIndex:gt,variables:kt}=this.props,Kt=gt!=null?kt[gt]:void 0,an=Kt?{text:Kt.name}:void 0;return t.createElement(u.T,{navModel:this.props.sectionNav,pageNav:an},!Kt&&t.createElement(pe,{variables:this.props.variables,onAdd:this.onNewVariable,onEdit:this.onEditVariable,onChangeOrder:this.onChangeVariableOrder,onDuplicate:this.onDuplicateVariable,onDelete:this.onModalOpen,usages:this.props.usages,usagesNetwork:this.props.usagesNetwork}),!Kt&&this.props.variables.length>0&&t.createElement(N,{variables:this.props.variables,dashboard:this.props.dashboard}),Kt&&t.createElement(Ce,{identifier:(0,X.yQ)(Kt)}),t.createElement(se,{isOpen:this.state.variableId!==void 0,varName:this.state.variableId?.id??"",onConfirm:this.onRemoveVariable,onDismiss:this.onModalClose}))}}const Qe=He(Ze);var rt=e(1541),pt=e(66574);const It=({dashboard:Ct,sectionNav:gt})=>{const kt=pt.Vt.hasPermission(c.AccessControlAction.DashboardsPermissionsWrite);return t.createElement(u.T,{navModel:gt},t.createElement(rt.P,{resource:"dashboards",resourceId:Ct.uid,canSetPermissions:kt}))};var _t=e(88203),tn=e(71313),qt=e(50683),cn=e(22698),on=e(35381),ln=e(42997);const Un=Ct=>({permissions:Ct.dashboard.permissions,canViewFolderPermissions:Ct.folder.canViewFolderPermissions}),yt={getDashboardPermissions:ln.qm,addDashboardPermission:ln.Yq,removeDashboardPermission:ln.Qk,updateDashboardPermission:ln.RF,checkFolderPermissions:on.J6},ft=(0,f.connect)(Un,yt);class Tt extends t.PureComponent{constructor(gt){super(gt),this.onOpenAddPermissions=()=>{this.setState({isAdding:!0})},this.onRemoveItem=kt=>{this.props.removeDashboardPermission(this.props.dashboard.id,kt)},this.onPermissionChanged=(kt,Kt)=>{this.props.updateDashboardPermission(this.props.dashboard.id,kt,Kt)},this.onAddPermission=kt=>this.props.addDashboardPermission(this.props.dashboard.id,kt),this.onCancelAddPermission=()=>{this.setState({isAdding:!1})},this.state={isAdding:!1}}componentDidMount(){this.props.getDashboardPermissions(this.props.dashboard.id),this.props.dashboard.meta.folderUid&&this.props.checkFolderPermissions(this.props.dashboard.meta.folderUid)}getFolder(){const{dashboard:gt,canViewFolderPermissions:kt}=this.props;return{id:gt.meta.folderId,title:gt.meta.folderTitle,url:gt.meta.folderUrl,canViewFolderPermissions:kt}}render(){const{permissions:gt,dashboard:kt,sectionNav:Kt}=this.props,{isAdding:an}=this.state;return kt.meta.hasUnsavedFolderChange?t.createElement(u.T,{navModel:Kt},t.createElement("h5",null,"You have changed a folder, please save to view permissions.")):t.createElement(u.T,{navModel:Kt},t.createElement("div",{className:"page-action-bar"},t.createElement(b.u,{placement:"auto",content:t.createElement(cn.Z,null)},t.createElement(M.J,{className:"icon--has-hover page-sub-heading-icon",name:"question-circle"})),t.createElement("div",{className:"page-action-bar__spacer"}),t.createElement(g.zx,{className:"pull-right",onClick:this.onOpenAddPermissions,disabled:an},"Add permission")),t.createElement(_t.s,{in:an},t.createElement(tn.Z,{onAddPermission:this.onAddPermission,onCancel:this.onCancelAddPermission})),t.createElement(qt.Z,{items:gt,onRemoveItem:this.onRemoveItem,onPermissionChanged:this.onPermissionChanged,isFetching:!1,folderInfo:this.getFolder()}))}}const Bt=ft(Tt);var Nt=e(63534),Ft=e(17312),Gt=e(10864),dn=e(5229),sn=e(1128),Bn=e(83967),wt=e(28580),Vt=e(74908),Ht=e(78209),Xt=e(61576),mn=e(75261),pn=e(26858),Pn=e(73170),zn=e(92877),Hn=e(97463),Ea=e(75578),aa=e(22001),na=e(21609);class xa extends t.PureComponent{constructor(gt){super(gt),this.updateFields=()=>{const kt=this.props.response?.panelData,Kt=kt?.series?.[0]??kt?.annotations?.[0];if(Kt&&Kt.fields){const an=Kt.fields.map(yn=>{const hn=(0,Ea.CZ)(yn,Kt);let Ln="";for(let un=0;un<Kt.length;un++){if(un>0&&(Ln+=", "),un>2){Ln+="...";break}Ln+=yn.values[un]}return Ln.length>50&&(Ln=Ln.substring(0,50)+"..."),{label:`${hn} (${yn.type})`,value:hn,description:Ln}});this.setState({fieldNames:an})}},this.onFieldSourceChange=(kt,Kt)=>{const an=this.props.mappings||{},yn=an[kt]||{};this.props.change({...an,[kt]:{...yn,source:Kt.value||aa.L.Field}})},this.onFieldNameChange=(kt,Kt)=>{const an=this.props.mappings||{},yn=an[kt]||{};this.props.change({...an,[kt]:{...yn,value:Kt.value,source:aa.L.Field}})},this.state={fieldNames:[]}}componentDidMount(){this.updateFields()}componentDidUpdate(gt){gt.response!==this.props.response&&this.updateFields()}renderRow(gt,kt,Kt){const{fieldNames:an}=this.state;let yn=an;const hn=kt.value;let Ln=an.find(Et=>hn===Et.value);hn&&(yn=[...an],Ln||yn.push({label:hn,value:hn}));let un=Kt?Kt[gt.key]:"";if(un&>.key.startsWith("time")){const Et=(0,na.Cf)("dateTimeAsIso");un=(0,na.zc)(Et(un))}return un==null&&(un=""),t.createElement("tr",{key:gt.key},t.createElement("td",null,gt.key," ",gt.help&&t.createElement(b.u,{content:gt.help},t.createElement(M.J,{name:"info-circle"}))),t.createElement("td",null,t.createElement(wt.Ph,{value:Ln,options:yn,placeholder:gt.placeholder||gt.key,onChange:Et=>{this.onFieldNameChange(gt.key,Et)},noOptionsMessage:"Unknown field names",allowCustomValue:!0})),t.createElement("td",null,`${un}`))}render(){const gt=this.props.response?.events?.[0],kt=this.props.mappings||{};return t.createElement("table",{className:"filter-table"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,"Annotation"),t.createElement("th",null,"From"),t.createElement("th",null,"First Value"))),t.createElement("tbody",null,Hn.r0.map(Kt=>this.renderRow(Kt,kt[Kt.key]||{},gt))))}}class Ca extends t.PureComponent{constructor(){super(...arguments),this.state={},this.onRunQuery=async()=>{const{datasource:gt,annotation:kt}=this.props;if((0,Hn.yr)(gt))return;const Kt=(0,mn.h4)().getCurrent();if(!Kt)return;this.setState({running:!0});const an=await(0,Ht.n)((0,zn.r)({range:(0,pn.$t)().timeRange(),panel:new Pn.r({}),dashboard:Kt},gt,kt));this.setState({running:!1,response:an})},this.onQueryChange=gt=>{this.props.onChange({...this.props.annotation,target:gt})},this.onMappingChange=gt=>{this.props.onChange({...this.props.annotation,mappings:gt})},this.onAnnotationChange=gt=>{this.props.onChange(gt)}}componentDidMount(){this.verifyDataSource()}componentDidUpdate(gt){this.props.annotation!==gt.annotation&&!(0,Hn.yr)(this.props.datasource)&&this.verifyDataSource()}verifyDataSource(){const{datasource:gt,annotation:kt}=this.props,an={...Hn.yA,...gt.annotations}.prepareAnnotation(kt);an!==kt?this.props.onChange(an):this.onRunQuery()}renderStatus(){const{response:gt,running:kt}=this.state;let Kt="alert-info",an="...",yn;if(kt||gt?.panelData?.state===le.Gu.Loading||!gt)an="loading...";else{const{events:hn,panelData:Ln}=gt;if(Ln?.error)Kt="alert-error",yn="exclamation-triangle",an=Ln.error.message??"error";else if(!hn?.length)Kt="alert-warning",yn="exclamation-triangle",an="No events found";else{const un=Ln?.series?.[0]??Ln?.annotations?.[0];an=`${hn.length} events (from ${un?.fields.length} fields)`}}return t.createElement("div",{className:(0,h.cx)(Kt,(0,h.css)` margin: 4px 0px; padding: 4px; display: flex; justify-content: space-between; align-items: center; `)},t.createElement("div",null,yn&&t.createElement(t.Fragment,null,t.createElement(M.J,{name:yn}),"\xA0"),an),t.createElement("div",null,kt?t.createElement(P.$,null):t.createElement(g.zx,{variant:"secondary",size:"xs",onClick:this.onRunQuery},"TEST")))}render(){const{datasource:gt,annotation:kt,datasourceInstanceSettings:Kt}=this.props,{response:an}=this.state;let yn=gt.annotations?.QueryEditor||gt.components?.QueryEditor;if(!yn)return t.createElement("div",null,"Annotations are not supported. This datasource needs to export a QueryEditor");const hn={...gt.annotations?.getDefaultQuery?.(),...kt.target??{refId:"Anno"}};return t.createElement(t.Fragment,null,t.createElement(Xt.n,{instanceSettings:Kt},t.createElement(yn,{key:gt?.name,query:hn,datasource:gt,onChange:this.onQueryChange,onRunQuery:this.onRunQuery,data:an?.panelData,range:(0,pn.$t)().timeRange(),annotation:kt,onAnnotationChange:this.onAnnotationChange})),(0,Hn.$w)(gt)&&t.createElement(t.Fragment,null,this.renderStatus(),t.createElement(xa,{response:an,mappings:kt.mappings,change:this.onMappingChange})))}}var Ba=e(53229),ka=e(9772);class Ua extends t.PureComponent{constructor(){super(...arguments),this.ref=null}componentWillUnmount(){this.angularComponent&&this.angularComponent.destroy()}componentDidMount(){this.ref&&this.loadAngular()}componentDidUpdate(gt){gt.datasource!==this.props.datasource&&this.loadAngular(),this.scopeProps&&this.scopeProps.ctrl.currentAnnotation!==this.props.annotation&&(this.scopeProps.ctrl.ignoreNextWatcherFiring=!0,this.scopeProps.ctrl.currentAnnotation=this.props.annotation,this.angularComponent?.digest())}loadAngular(){this.angularComponent&&(this.angularComponent.destroy(),this.scopeProps=void 0);const gt=(0,ka.w)(),kt='<plugin-component type="annotations-query-ctrl"> </plugin-component>',Kt={ctrl:{currentDatasource:this.props.datasource,currentAnnotation:this.props.annotation,ignoreNextWatcherFiring:!1}};this.angularComponent=gt.load(this.ref,Kt,kt),this.angularComponent.digest(),this.angularComponent.getScope().$watch(()=>{if(Kt.ctrl.ignoreNextWatcherFiring){Kt.ctrl.ignoreNextWatcherFiring=!1;return}this.props.onChange(Kt.ctrl.currentAnnotation)}),this.scopeProps=Kt}render(){return t.createElement("div",{ref:gt=>this.ref=gt})}}const $a="New annotation",Mt=({editIdx:Ct,dashboard:gt})=>{const kt=(0,D.wW)(Dt),[Kt,an]=(0,t.useState)(gt.annotations.list[Ct]),yn=(0,t.useMemo)(()=>Kt.filter?Kt.filter.exclude?2:1:0,[Kt.filter]),{value:hn}=(0,y.Z)(()=>(0,Gt.F)().get(Kt.datasource),[Kt.datasource]),Ln=(0,Gt.F)().getInstanceSettings(Kt.datasource),un=Da=>{const is=[...gt.annotations.list];is.splice(Ct,1,Da),an(Da),gt.annotations.list=is},Et=Da=>{un({...Kt,name:Da.currentTarget.value})},Vn=Da=>{un({...Kt,datasource:(0,Ft.iU)(Da)})},da=Da=>{const is=Da.currentTarget;un({...Kt,[is.name]:is.type==="checkbox"?is.checked:is.value})},Ga=Da=>{un({...Kt,iconColor:Da})},Cs=Da=>{let is=Da.value===0?void 0:{exclude:Da.value===2,ids:Kt.filter?.ids??[]};un({...Kt,filter:is})},rs=Da=>{if(!Array.isArray(Da))return;const is={exclude:yn===2,ids:[]};Da.forEach($s=>$s.value&&is.ids.push($s.value)),un({...Kt,filter:is})},Bs=ht,pr=()=>{r.E1.partial({editview:null,editIndex:null})},Kr=()=>{const Da=gt.annotations.list;gt.annotations.list=[...Da.slice(0,Ct),...Da.slice(Ct+1)],ht()},Pa=Kt.name===$a,vs=(Da,is)=>Da.label&&is.label?Da.label.toLowerCase().localeCompare(is.label.toLowerCase()):-1,hr=(0,t.useMemo)(()=>gt?.panels.filter(Da=>o.default.panels[Da.type]).map(Da=>({value:Da.id,label:Da.title??`Panel ${Da.id}`,description:Da.description,imgUrl:o.default.panels[Da.type].info.logos.small})).sort(vs)??[],[gt]);return t.createElement("div",null,t.createElement(dn.C,{className:kt.settingsForm},t.createElement(ae.g,{label:"Name"},t.createElement(sn.I,{"aria-label":s.wl.pages.Dashboard.Settings.Annotations.Settings.name,name:"name",id:"name",autoFocus:Pa,value:Kt.name,onChange:Et})),t.createElement(ae.g,{label:"Data source",htmlFor:"data-source-picker"},t.createElement(Ba.q,{annotations:!0,variables:!0,current:Kt.datasource,onChange:Vn})),t.createElement(ae.g,{label:"Enabled",description:"When enabled the annotation query is issued every dashboard refresh"},t.createElement(Bn.X,{name:"enable",id:"enable",value:Kt.enable,onChange:da})),t.createElement(ae.g,{label:"Hidden",description:"Annotation queries can be toggled on or off at the top of the dashboard. With this option checked this toggle will be hidden."},t.createElement(Bn.X,{name:"hide",id:"hide",value:Kt.hide,onChange:da})),t.createElement(ae.g,{label:"Color",description:"Color to use for the annotation event markers"},t.createElement(C.Lh,null,t.createElement(Vt.B,{value:Kt?.iconColor,onChange:Ga}))),t.createElement(ae.g,{label:"Show in","aria-label":s.wl.pages.Dashboard.Settings.Annotations.NewAnnotation.showInLabel},t.createElement(t.Fragment,null,t.createElement(wt.Ph,{options:rn,value:yn,onChange:Cs,"aria-label":s.wl.components.Annotations.annotationsTypeInput}),yn!==0&&t.createElement(wt.NU,{options:hr,value:hr.filter(Da=>Kt.filter?.ids.includes(Da.value)),onChange:rs,isClearable:!0,placeholder:"Choose panels",width:100,closeMenuOnSelect:!1,className:kt.select,"aria-label":s.wl.components.Annotations.annotationsChoosePanelInput})))),t.createElement(dn.C,null,t.createElement("h3",{className:"page-heading"},"Query"),hn?.annotations&&Ln&&t.createElement(Ca,{datasource:hn,datasourceInstanceSettings:Ln,annotation:Kt,onChange:un}),hn&&!hn.annotations&&t.createElement(Ua,{datasource:hn,annotation:Kt,onChange:un})),t.createElement(ze.K,null,!Kt.builtIn&&t.createElement(g.zx,{variant:"destructive",onClick:Kr},"Delete"),t.createElement(g.zx,{variant:"secondary",onClick:pr,"data-testid":s.wl.pages.Dashboard.Settings.Annotations.NewAnnotation.previewInDashboard},"Preview in dashboard"),t.createElement(g.zx,{variant:"primary",onClick:Bs},"Apply")))},Dt=Ct=>({settingsForm:(0,h.css)({maxWidth:Ct.spacing(60),marginBottom:Ct.spacing(2)}),select:(0,h.css)` margin-top: 8px; `});function ht(){r.E1.partial({editIndex:null})}var Lt=(Ct=>(Ct[Ct.AllPanels=0]="AllPanels",Ct[Ct.IncludePanels=1]="IncludePanels",Ct[Ct.ExcludePanels=2]="ExcludePanels",Ct))(Lt||{});const rn=[{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 zt=e(99025),En=e(15202);const Tn=({children:Ct,...gt})=>{const kt=(0,D.wW)(An);return t.createElement("div",{className:kt.buttonWrapper},t.createElement(g.zx,{icon:"plus",variant:"secondary",...gt},Ct))},An=Ct=>({buttonWrapper:(0,h.css)` padding: ${Ct.spacing(3)} 0; `}),xn=({dashboard:Ct,onNew:gt,onEdit:kt})=>{const[Kt,an]=(0,t.useState)(Ct.annotations.list),yn=(Vn,da)=>{Ct.annotations.list=zt.moveItemImmutably(Kt,Vn,Vn+da),an(Ct.annotations.list)},hn=Vn=>{Ct.annotations.list=[...Kt.slice(0,Vn),...Kt.slice(Vn+1)],an(Ct.annotations.list)},Ln=Kt.length===0||Kt.length===1&&Kt[0].builtIn,un=Vn=>Vn.enable===!1?t.createElement(t.Fragment,null,t.createElement("em",{className:"muted"},"(Disabled) \xA0 ",Vn.name)):Vn.builtIn?t.createElement(t.Fragment,null,t.createElement("em",{className:"muted"},Vn.name," \xA0 (Built-in)")):t.createElement(t.Fragment,null,Vn.name),Et=(0,Gt.F)();return t.createElement(C.wc,null,Kt.length>0&&t.createElement("table",{role:"grid",className:"filter-table filter-table--hover"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,"Query name"),t.createElement("th",null,"Data source"),t.createElement("th",{colSpan:3}))),t.createElement("tbody",null,Ct.annotations.list.map((Vn,da)=>t.createElement("tr",{key:`${Vn.name}-${da}`},Vn.builtIn?t.createElement("td",{role:"gridcell",style:{width:"90%"},className:"pointer",onClick:()=>kt(da)},t.createElement(g.zx,{size:"sm",fill:"text",variant:"secondary"},un(Vn))):t.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>kt(da)},t.createElement(g.zx,{size:"sm",fill:"text",variant:"secondary"},un(Vn))),t.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>kt(da)},Et.getInstanceSettings(Vn.datasource)?.name||Vn.datasource?.uid),t.createElement("td",{role:"gridcell",style:{width:"1%"}},da!==0&&t.createElement(T.h,{name:"arrow-up",onClick:()=>yn(da,-1),tooltip:"Move up"})),t.createElement("td",{role:"gridcell",style:{width:"1%"}},Ct.annotations.list.length>1&&da!==Ct.annotations.list.length-1?t.createElement(T.h,{name:"arrow-down",onClick:()=>yn(da,1),tooltip:"Move down"}):null),t.createElement("td",{role:"gridcell",style:{width:"1%"}},!Vn.builtIn&&t.createElement(En.m,{size:"sm",onConfirm:()=>hn(da),"aria-label":`Delete query with title "${Vn.name}"`})))))),Ln&&t.createElement(Ie.Z,{onClick:gt,title:"There are no custom annotation queries added yet",buttonIcon:"comment-alt",buttonTitle:"Add annotation query",infoBoxTitle:"What are annotation queries?",infoBox:{__html:`<p>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 you 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. </p> Checkout the <a class='external-link' target='_blank' href='http://docs.grafana.org/reference/annotations/' >Annotations documentation</a > for more information.`}}),!Ln&&t.createElement(Tn,{onClick:gt},"New query"))};function ia({dashboard:Ct,editIndex:gt,sectionNav:kt}){const Kt=()=>{const hn={name:$a,enable:!0,datasource:(0,Ft.iU)((0,Gt.F)().getInstanceSettings(null)),iconColor:"red"};Ct.annotations.list=[...Ct.annotations.list,{...hn}],r.E1.partial({editIndex:Ct.annotations.list.length-1})},an=hn=>{r.E1.partial({editIndex:hn})},yn=gt!=null&><Ct.annotations.list.length;return t.createElement(u.T,{navModel:kt,pageNav:oa(Ct,gt)},!yn&&t.createElement(xn,{dashboard:Ct,onNew:Kt,onEdit:an}),yn&&t.createElement(Mt,{dashboard:Ct,editIdx:gt}))}function oa(Ct,gt){if(gt==null)return;const kt=Ct.annotations.list[gt];if(kt)return{text:kt.name}}var _n=e(72699),sa=e(74729),ca=e(60729),jn=e(58281),ns=e(26811),Ta=e(73807),Ja=e(77799);const ps=(Ct,gt)=>{const[kt,Kt]=(0,ns.Z)(()=>(0,Ja.iM)(Ct,!1),[]),an=(0,Ta.iG)();return(0,t.useEffect)(()=>{kt.value&&(gt(),r.E1.replace("/"),an.success("Dashboard Deleted",`${kt.value.title} has been deleted`))},[kt,an,gt]),{state:kt,onDeleteDashboard:Kt}},Jn={cleanUpDashboardAndVariables:ln.lw},Ya=(0,f.connect)(null,Jn),xs=({hideModal:Ct,cleanUpDashboardAndVariables:gt,dashboard:kt})=>{const Kt=kt.meta.provisioned,{onDeleteDashboard:an}=ps(kt.uid,gt),[,yn]=(0,jn.default)(async()=>{await an(),Ct()},[Ct]),hn=ss(kt.panels,kt.title);return Kt?t.createElement(Xa,{hideModal:Ct,provisionedId:kt.meta.provisionedExternalId}):t.createElement(Q.s,{isOpen:!0,body:hn,onConfirm:yn,onDismiss:Ct,title:"Delete",icon:"trash-alt",confirmText:"Delete"})},ss=(Ct,gt)=>{const kt=(0,st.sumBy)(Ct,Kt=>Kt.alert?1:0);return kt>0&&!o.config.unifiedAlertingEnabled?t.createElement(t.Fragment,null,t.createElement("p",null,"Do you want to delete this dashboard?"),t.createElement("p",null,"This dashboard contains ",kt," alert",kt>1?"s":"",". Deleting this dashboard also deletes those alerts.")):t.createElement(t.Fragment,null,t.createElement("p",null,"Do you want to delete this dashboard?"),t.createElement("p",null,gt))},Xa=({hideModal:Ct,provisionedId:gt})=>t.createElement(S.u,{isOpen:!0,title:"Cannot delete provisioned dashboard",icon:"trash-alt",onDismiss:Ct,className:(0,h.css)` width: 500px; `},t.createElement("p",null,"This dashboard is managed by Grafana provisioning and cannot be deleted. Remove the dashboard from the config file to delete it."),t.createElement("p",null,t.createElement("i",null,"See"," ",t.createElement("a",{className:"external-link",href:"https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards",target:"_blank",rel:"noreferrer"},"documentation")," ","for more information about provisioning."),t.createElement("br",null),"File path: ",gt),t.createElement(S.u.ButtonRow,null,t.createElement(g.zx,{variant:"primary",onClick:Ct},"OK"))),Ps=Ya(xs),hs=({dashboard:Ct})=>t.createElement(ca.JY,null,({showModal:gt,hideModal:kt})=>t.createElement(g.zx,{variant:"destructive",onClick:()=>{gt(Ps,{dashboard:Ct,hideModal:kt})},"aria-label":"Dashboard settings page delete dashboard button"},"Delete Dashboard"));var qs=e(37232);const Sr=[{value:0,label:"Default"},{value:1,label:"Shared crosshair"},{value:2,label:"Shared Tooltip"}];function Tr({dashboard:Ct,updateTimeZone:gt,updateWeekStart:kt,sectionNav:Kt}){const[an,yn]=(0,t.useState)(0),hn=(Pa,vs)=>{Ct.meta.folderUid=Pa,Ct.meta.folderTitle=vs,Ct.meta.hasUnsavedFolderChange=!0,yn(an+1)},Ln=Pa=>{(Pa.currentTarget.name==="title"||Pa.currentTarget.name==="description")&&(Ct[Pa.currentTarget.name]=Pa.currentTarget.value)},un=Pa=>{Ct.graphTooltip=Pa,yn(an+1)},Et=Pa=>{Ct.timepicker.refresh_intervals=Pa.filter(vs=>vs.trim()!=="")},Vn=Pa=>{Ct.timepicker.nowDelay=Pa},da=Pa=>{Ct.timepicker.hidden=Pa,yn(an+1)},Ga=Pa=>{Ct.liveNow=Pa,yn(an+1)},Cs=Pa=>{Ct.timezone=Pa,yn(an+1),gt(Pa)},rs=Pa=>{Ct.weekStart=Pa,yn(an+1),kt(Pa)},Bs=Pa=>{Ct.tags=Pa,yn(an+1)},pr=Pa=>{Ct.editable=Pa,yn(an+1)},Kr=[{label:"Editable",value:!0},{label:"Read-only",value:!1}];return t.createElement(u.T,{navModel:Kt},t.createElement("div",{style:{maxWidth:"600px"}},t.createElement("div",{className:"gf-form-group"},t.createElement(ae.g,{label:"Name"},t.createElement(sn.I,{id:"title-input",name:"title",onBlur:Ln,defaultValue:Ct.title})),t.createElement(ae.g,{label:"Description"},t.createElement(sn.I,{id:"description-input",name:"description",onBlur:Ln,defaultValue:Ct.description})),t.createElement(ae.g,{label:"Tags"},t.createElement(_n.B,{id:"tags-input",tags:Ct.tags,onChange:Bs,width:40})),t.createElement(ae.g,{label:"Folder"},t.createElement(sa.E,{value:Ct.meta.folderUid,onChange:hn,initialTitle:Ct.meta.folderTitle,inputId:"dashboard-folder-input",enableCreateNew:!0,dashboardId:Ct.id,skipInitialLoad:!0})),t.createElement(ae.g,{label:"Editable",description:"Set to read-only to disable all editing. Reload the dashboard for changes to take effect"},t.createElement(re.S,{value:Ct.editable,options:Kr,onChange:pr}))),t.createElement(qs.P,{onTimeZoneChange:Cs,onWeekStartChange:rs,onRefreshIntervalChange:Et,onNowDelayChange:Vn,onHideTimePickerChange:da,onLiveNowChange:Ga,refreshIntervals:Ct.timepicker.refresh_intervals,timePickerHidden:Ct.timepicker.hidden,nowDelay:Ct.timepicker.nowDelay,timezone:Ct.timezone,weekStart:Ct.weekStart,liveNow:Ct.liveNow}),t.createElement(a.s,{label:"Panel options",isOpen:!0},t.createElement(ae.g,{label:"Graph tooltip",description:"Controls tooltip and hover highlight behavior across different panels. Reload the dashboard for changes to take effect"},t.createElement(re.S,{onChange:un,options:Sr,value:Ct.graphTooltip}))),t.createElement("div",{className:"gf-form-button-row"},Ct.meta.canDelete&&t.createElement(hs,{dashboard:Ct}))))}const lr={updateTimeZone:ln.tM,updateWeekStart:ln.f4},Ds=(0,f.connect)(null,lr)(Tr);var kn=e(11649),ya=e(284);function ma({dashboard:Ct,sectionNav:gt}){const[kt,Kt]=(0,t.useState)(JSON.stringify(Ct.getSaveModelClone(),null,2)),an=async()=>{await(0,mn.h4)().saveJSONDashboard(kt),ya.H.reloadPage()},yn=(0,D.wW)(Sa),hn="The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel settings, layout, queries, and so on";return t.createElement(u.T,{navModel:gt,subTitle:hn},t.createElement("div",{className:yn.wrapper},t.createElement(kn.p,{value:kt,language:"json",showMiniMap:!0,showLineNumbers:!0,onBlur:Kt,containerStyles:yn.codeEditor}),Ct.meta.canSave&&t.createElement("div",null,t.createElement(g.zx,{type:"submit",onClick:an},"Save changes"))))}const Sa=Ct=>({wrapper:(0,h.css)({display:"flex",height:"100%",flexDirection:"column",gap:Ct.spacing(2)}),codeEditor:(0,h.css)({flexGrow:1})});var er=e(1674),ws=e(86004);const Za=({dashboard:Ct,onNew:gt,onEdit:kt})=>{const[Kt,an]=(0,t.useState)(Ct.links),yn=(Et,Vn)=>{Ct.links=zt.moveItemImmutably(Kt,Et,Et+Vn),an(Ct.links)},hn=(Et,Vn)=>{Ct.links=[...Kt,{...Et}],an(Ct.links)},Ln=Et=>{Ct.links=[...Kt.slice(0,Et),...Kt.slice(Et+1)],an(Ct.links)};return Ct.links.length===0?t.createElement("div",null,t.createElement(Ie.Z,{onClick:gt,title:"There are no dashboard links added yet",buttonIcon:"link",buttonTitle:"Add dashboard link",infoBoxTitle:"What are dashboard links?",infoBox:{__html:"<p>Dashboard Links allow you to place links to other dashboards and web sites directly below the dashboard header.</p>"}})):t.createElement(t.Fragment,null,t.createElement("table",{role:"grid",className:"filter-table filter-table--hover"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,"Type"),t.createElement("th",null,"Info"),t.createElement("th",{colSpan:3}))),t.createElement("tbody",null,Kt.map((Et,Vn)=>t.createElement("tr",{key:`${Et.title}-${Vn}`},t.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>kt(Vn)},t.createElement(M.J,{name:"external-link-alt"})," \xA0 ",Et.type),t.createElement("td",{role:"gridcell"},t.createElement(C.Lh,null,Et.title&&t.createElement("span",null,Et.title),Et.type==="link"&&t.createElement("span",null,Et.url),Et.type==="dashboards"&&t.createElement(ws.P,{tags:Et.tags??[]}))),t.createElement("td",{style:{width:"1%"},role:"gridcell"},Vn!==0&&t.createElement(T.h,{name:"arrow-up",onClick:()=>yn(Vn,-1),tooltip:"Move link up"})),t.createElement("td",{style:{width:"1%"},role:"gridcell"},Kt.length>1&&Vn!==Kt.length-1?t.createElement(T.h,{name:"arrow-down",onClick:()=>yn(Vn,1),tooltip:"Move link down"}):null),t.createElement("td",{style:{width:"1%"},role:"gridcell"},t.createElement(T.h,{name:"copy",onClick:()=>hn(Et,Vn),tooltip:"Copy link"})),t.createElement("td",{style:{width:"1%"},role:"gridcell"},t.createElement(En.m,{"aria-label":`Delete link with title "${Et.title}"`,size:"sm",onConfirm:()=>Ln(Vn)})))))),t.createElement(Tn,{onClick:gt},"New link"))};function jt({dashboard:Ct,sectionNav:gt,editIndex:kt}){const[Kt,an]=(0,t.useState)(!1),yn=()=>{an(!1),r.E1.partial({editIndex:void 0})},hn=()=>{Ct.links=[...Ct.links,{...er.zA}],an(!0),r.E1.partial({editIndex:Ct.links.length-1})},Ln=Vn=>{an(!1),r.E1.partial({editIndex:Vn})},un=kt!==void 0;let Et;return un&&(Et={text:Kt?"New link":"Edit link",subTitle:Kt?"Create a new link on your dashboard":"Edit a specific link of your dashboard"}),t.createElement(u.T,{navModel:gt,pageNav:Et},!un&&t.createElement(Za,{dashboard:Ct,onNew:hn,onEdit:Ln}),un&&t.createElement(er.fD,{dashboard:Ct,editLinkIdx:kt,onGoBack:yn}))}var va=e(7942);const Vs=10;class Fr extends t.PureComponent{constructor(gt){super(gt),this.getVersions=(kt=!1)=>{this.setState({isAppending:kt}),va.K8.getHistoryList(this.props.dashboard,{limit:this.limit,start:this.start}).then(Kt=>{this.setState({isLoading:!1,versions:[...this.state.versions,...this.decorateVersions(Kt)]}),this.start+=this.limit}).catch(Kt=>console.log(Kt)).finally(()=>this.setState({isAppending:!1}))},this.getDiff=async()=>{const kt=this.state.versions.filter(un=>un.checked),[Kt,an]=kt,yn=Kt.version===this.props.dashboard.version;this.setState({isLoading:!0});const hn=await va.K8.getDashboardVersion(this.props.dashboard.uid,an.version),Ln=await va.K8.getDashboardVersion(this.props.dashboard.uid,Kt.version);this.setState({baseInfo:an,isLoading:!1,isNewLatest:yn,newInfo:Kt,viewMode:"compare",diffData:{lhs:hn.data,rhs:Ln.data}})},this.decorateVersions=kt=>kt.map(Kt=>({...Kt,createdDateString:this.props.dashboard.formatDate(Kt.created),ageString:this.props.dashboard.getRelativeTime(Kt.created),checked:!1})),this.onCheck=(kt,Kt)=>{this.setState({versions:this.state.versions.map(an=>an.id===Kt?{...an,checked:kt.currentTarget.checked}:an)})},this.reset=()=>{this.setState({baseInfo:void 0,diffData:{lhs:{},rhs:{}},isNewLatest:!1,newInfo:void 0,versions:this.state.versions.map(kt=>({...kt,checked:!1})),viewMode:"list"})},this.limit=Vs,this.start=0,this.state={isAppending:!0,isLoading:!0,versions:[],viewMode:"list",isNewLatest:!1,diffData:{lhs:{},rhs:{}}}}componentDidMount(){this.getVersions()}isLastPage(){return this.state.versions.find(gt=>gt.version===1)}render(){const{versions:gt,viewMode:kt,baseInfo:Kt,newInfo:an,isNewLatest:yn,isLoading:hn,diffData:Ln}=this.state,un=gt.filter(da=>da.checked).length===2,Et=gt.length>1,Vn=gt.length>=this.limit;return kt==="compare"?t.createElement(u.T,{navModel:this.props.sectionNav},t.createElement(va.Cs,{onClick:this.reset,baseVersion:Kt?.version,newVersion:an?.version,isNewLatest:yn}),hn?t.createElement(dr,{msg:"Fetching changes\u2026"}):t.createElement(va.U$,{newInfo:an,baseInfo:Kt,isNewLatest:yn,diffData:Ln})):t.createElement(u.T,{navModel:this.props.sectionNav},hn?t.createElement(dr,{msg:"Fetching history list\u2026"}):t.createElement(va.Sd,{versions:gt,onCheck:this.onCheck,canCompare:un}),this.state.isAppending&&t.createElement(dr,{msg:"Fetching more entries\u2026"}),Et&&t.createElement(va.R1,{hasMore:Vn,canCompare:un,getVersions:this.getVersions,getDiff:this.getDiff,isLastPage:!!this.isLastPage()}))}}const dr=({msg:Ct})=>t.createElement(C.Lh,null,t.createElement(P.$,null),t.createElement("em",null,Ct)),Zr=()=>r.E1.partial({editview:null,editIndex:null});function Ss({dashboard:Ct,editview:gt,pageNav:kt,sectionNav:Kt}){const[an,yn]=(0,t.useState)(0);(0,t.useEffect)(()=>{Ct.events.subscribe(p.hS,()=>yn(pr=>pr+1))},[Ct]);const hn=(0,t.useMemo)(()=>sr(Ct),[Ct,an]),Ln=()=>{Ct.meta.hasUnsavedFolderChange=!1},un=hn.find(pr=>pr.id===gt)??hn[0],Et=m.contextSrv.hasEditPermissionInFolders,Vn=Ct.meta.canSave,da=(0,n.TH)(),Ga=Jr(da),Cs=ks(kt,Kt,hn,un,da),rs="sm",Bs=[t.createElement(g.zx,{"data-testid":s.wl.pages.Dashboard.Settings.Actions.close,variant:"secondary",key:"close",fill:"outline",size:rs,onClick:Zr},"Close"),Et&&t.createElement(Nt.t,{dashboard:Ct,onSaveSuccess:Ln,variant:"secondary",key:"save as",size:rs}),Vn&&t.createElement(Nt.i,{dashboard:Ct,onSaveSuccess:Ln,key:"Save",size:rs})];return t.createElement(t.Fragment,null,t.createElement(l.A,{actions:t.createElement(d.R,{alignment:"right"},Bs)}),t.createElement(un.component,{sectionNav:Cs,dashboard:Ct,editIndex:Ga}))}function sr(Ct){const gt=[];return Ct.meta.canEdit&&(gt.push({title:"General",id:"settings",icon:"sliders-v-alt",component:Ds}),gt.push({title:"Annotations",id:"annotations",icon:"comment-alt",component:ia,subTitle:"Annotation queries return events that can be visualized as event markers in graphs across the dashboard."}),gt.push({title:"Variables",id:"templating",icon:"calculator-alt",component:Qe,subTitle:"Variables can make your dashboard more dynamic and act as global filters."}),gt.push({title:"Links",id:"links",icon:"link",component:jt})),Ct.meta.canMakeEditable&>.push({title:"General",icon:"sliders-v-alt",id:"settings",component:Va}),Ct.id&&Ct.meta.canSave&>.push({title:"Versions",id:"versions",icon:"history",component:Fr}),Ct.id&&Ct.meta.canAdmin&&(o.default.rbacEnabled?m.contextSrv.hasPermission(c.AccessControlAction.DashboardsPermissionsRead)&>.push({title:"Permissions",id:"permissions",icon:"lock",component:It}):gt.push({title:"Permissions",id:"permissions",icon:"lock",component:Bt})),gt.push({title:"JSON Model",id:"dashboard_json",icon:"arrow",component:ma}),gt}function Ts(Ct,gt){return{...Ct,parentItem:Ct.parentItem?Ts(Ct.parentItem,gt):gt}}function ks(Ct,gt,kt,Kt,an){const yn={text:"Settings",children:[],icon:"apps",hideFromBreadcrumbs:!0};yn.children=kt.map(Ln=>({text:Ln.title,icon:Ln.icon,id:Ln.id,url:i.u.getUrlForPartial(an,{editview:Ln.id,editIndex:null}),active:Ln===Kt,parentItem:yn,subTitle:Ln.subTitle}));const hn=Ts(Ct,gt.node);return yn.parentItem=hn,{main:yn,node:yn.children.find(Ln=>Ln.active)}}function Va({dashboard:Ct,sectionNav:gt}){return t.createElement(u.T,{navModel:gt},t.createElement("div",{className:"dashboard-settings__header"},"Dashboard not editable"),t.createElement(g.zx,{type:"submit",onClick:()=>Ct.makeEditable()},"Make editable"))}function Jr(Ct){const gt=new URLSearchParams(Ct.search).get("editIndex");if(gt!=null)return parseInt(gt,10)}},1674:(j,I,e)=>{"use strict";e.d(I,{fD:()=>p,xy:()=>m,zA:()=>u});var t=e(27702),n=e(22209),i=e(1128),s=e(28580),r=e(72699),g=e(62499),d=e(83967),l=e(66670);const u={icon:"external link",title:"New link",tooltip:"",type:"dashboards",url:"",asDropdown:!1,tags:[],targetBlank:!1,keepTime:!1,includeVars:!1},o=[{value:"dashboards",label:"Dashboards"},{value:"link",label:"Link"}],m={"external link":"external-link-alt",dashboard:"apps",question:"question-circle",info:"info-circle",bolt:"bolt",doc:"file-alt",cloud:"cloud"},c=Object.keys(m).map(f=>({label:f,value:f})),p=({editLinkIdx:f,dashboard:E,onGoBack:h})=>{const[y,v]=(0,t.useState)(f!==null?E.links[f]:u),D=T=>{const S=[...E.links];S.splice(f,1,T),E.links=S,v(T)},a=T=>{D({...y,tags:T})},C=T=>{const S={...y,type:T.value};S.type==="dashboards"?(S.url="",S.tooltip=""):S.tags=[],D(S)},P=T=>{D({...y,icon:T.value})},b=T=>{const S=T.currentTarget;D({...y,[S.name]:S.type==="checkbox"?S.checked:S.value})},M=y.title===u.title;return t.createElement("div",{style:{maxWidth:"600px"}},t.createElement(n.g,{label:"Title"},t.createElement(i.I,{name:"title",id:"title",value:y.title,onChange:b,autoFocus:M})),t.createElement(n.g,{label:"Type"},t.createElement(s.Ph,{inputId:"link-type-input",value:y.type,options:o,onChange:C})),y.type==="dashboards"&&t.createElement(t.Fragment,null,t.createElement(n.g,{label:"With tags"},t.createElement(r.B,{tags:y.tags,onChange:a}))),y.type==="link"&&t.createElement(t.Fragment,null,t.createElement(n.g,{label:"URL"},t.createElement(i.I,{name:"url",value:y.url,onChange:b})),t.createElement(n.g,{label:"Tooltip"},t.createElement(i.I,{name:"tooltip",value:y.tooltip,onChange:b,placeholder:"Open dashboard"})),t.createElement(n.g,{label:"Icon"},t.createElement(s.Ph,{value:y.icon,options:c,onChange:P}))),t.createElement(g.s,{label:"Options",isOpen:!0},y.type==="dashboards"&&t.createElement(n.g,null,t.createElement(d.X,{label:"Show as dropdown",name:"asDropdown",value:y.asDropdown,onChange:b})),t.createElement(n.g,null,t.createElement(d.X,{label:"Include current time range",name:"keepTime",value:y.keepTime,onChange:b})),t.createElement(n.g,null,t.createElement(d.X,{label:"Include current template variable values",name:"includeVars",value:y.includeVars,onChange:b})),t.createElement(n.g,null,t.createElement(d.X,{label:"Open link in new tab",name:"targetBlank",value:y.targetBlank,onChange:b}))),t.createElement(l.zx,{onClick:h},"Apply"))}},18282:(j,I,e)=>{"use strict";e.d(I,{u:()=>m});var t=e(42844),n=e(27702),i=e(84789),s=e(74639),r=e(66310),g=e(77122),d=e(66670),l=e(89033),u=e(45743);const o="showCategory",m=n.memo(({id:f,title:E,children:h,forceOpen:y,isOpenDefault:v,renderTitle:D,className:a,itemsCount:C,isNested:P=!1})=>{const b=v!==!1,[M,T]=(0,i.Z)(p(f),{isExpanded:b}),S=(0,r.wW)(c),[x,O]=(0,l.K)(),[B,A]=(0,n.useState)(M?.isExpanded??b),V=(0,n.useRef)(0),W=(0,n.useRef)(null),w=x[o]===f;(0,n.useEffect)(()=>{V.current&&Date.now()-V.current<200||(w||y)&&(B||A(!0),w&&W.current?.scrollIntoView())},[y,B,w]);const N=(0,n.useCallback)(()=>{V.current=Date.now(),O({[o]:B?void 0:f},!0),T({isExpanded:!B}),A(!B)},[T,A,O,B,f]);D||(D=function(_){return _||C===void 0||C===0?E:n.createElement("span",null,E," ",n.createElement(g.A,{value:C}))});const F=(0,t.cx)({[S.box]:!0,[S.boxNestedExpanded]:P&&B},a,"options-group"),k=(0,t.cx)(S.header,{[S.headerExpanded]:B,[S.headerNested]:P}),H=(0,t.cx)(S.body,{[S.bodyNested]:P});return n.createElement("div",{className:F,"data-testid":"options-category","aria-label":s.wl.components.OptionsGroup.group(f),ref:W},n.createElement("div",{className:k,onClick:N},n.createElement(d.zx,{"aria-label":s.wl.components.OptionsGroup.toggle(f),type:"button",fill:"text",size:"sm",variant:"secondary","aria-expanded":B,className:S.toggleButton,icon:B?"angle-down":"angle-right",onClick:N}),n.createElement("h6",{id:`button-${f}`,className:S.title},D(B))),B&&n.createElement("div",{className:H,id:f,"aria-labelledby":`button-${f}`},h))});m.displayName="OptionsPaneCategory";const c=f=>({box:(0,t.css)` border-top: 1px solid ${f.colors.border.weak}; `,boxNestedExpanded:(0,t.css)` margin-bottom: ${f.spacing(2)}; `,title:(0,t.css)` flex-grow: 1; overflow: hidden; line-height: 1.5; font-size: 1rem; padding-left: 6px; font-weight: ${f.typography.fontWeightMedium}; margin: 0; `,header:(0,t.css)` display: flex; cursor: pointer; align-items: center; padding: ${f.spacing(.5)}; color: ${f.colors.text.primary}; font-weight: ${f.typography.fontWeightMedium}; &:hover { background: ${f.colors.emphasize(f.colors.background.primary,.03)}; } `,toggleButton:(0,t.css)` align-self: baseline; `,headerExpanded:(0,t.css)` color: ${f.colors.text.primary}; `,headerNested:(0,t.css)` padding: ${f.spacing(.5,0,.5,0)}; `,body:(0,t.css)` padding: ${f.spacing(1,2,1,4)}; `,bodyNested:(0,t.css)` position: relative; padding-right: 0; &:before { content: ''; position: absolute; top: 0; left: 8px; width: 1px; height: 100%; background: ${f.colors.border.weak}; } `}),p=f=>`${u.jy}.optionGroup[${f}]`},32299:(j,I,e)=>{"use strict";e.d(I,{j:()=>i});var t=e(27702),n=e(18282);class i{constructor(r){this.props=r,this.items=[],this.categories=[]}addItem(r){return r.parent=this,this.items.push(r),this}addCategory(r){return r.props.isNested=!0,r.parent=this,this.categories.push(r),this}getCategory(r){let g=this.categories.find(d=>d.props.id===r);return g||(g=new i({title:r,id:r}),this.addCategory(g),g)}render(r){return this.props.customRender?this.props.customRender():t.createElement(n.u,{key:this.props.title,...this.props},this.items.map(g=>g.render(r)),this.categories.map(g=>g.render(r)))}}},23140:(j,I,e)=>{"use strict";e.d(I,{a:()=>c});var t=e(27702),n=e(3819),i=e.n(n),s=e(74639),r=e(79978),g=e(22209),d=e(42844),l=e(66310),u=e(80011);function o({overrides:p}){const f=(0,l.wW)(m);return t.createElement("div",{className:f.wrapper},p.map((E,h)=>t.createElement(u.u,{content:E.tooltip,key:h.toString(),placement:"top"},t.createElement("div",{"aria-label":E.description,className:f[E.type]}))))}const m=p=>{const f={width:8,height:8,borderRadius:p.shape.radius.circle,marginLeft:p.spacing(1),position:"relative",top:"-1px"};return{wrapper:(0,d.css)({display:"flex"}),rule:(0,d.css)({...f,backgroundColor:p.colors.primary.main}),data:(0,d.css)({...f,backgroundColor:p.colors.warning.main})}};class c{constructor(f){this.props=f}getLabel(f){const{title:E,description:h,overrides:y}=this.props;if(!f)return this.parent.props.title===E&&!y?.length?null:t.createElement(r._,{description:h},E,y&&y.length>0&&t.createElement(o,{overrides:y}));const v=[];return this.parent.parent&&v.push(this.highlightWord(this.parent.parent.props.title,f)),this.parent.props.title!==E&&v.push(this.highlightWord(this.parent.props.title,f)),t.createElement(r._,{description:h&&this.highlightWord(h,f),category:v},this.highlightWord(E,f),y&&y.length>0&&t.createElement(o,{overrides:y}))}highlightWord(f,E){return t.createElement(i(),{textToHighlight:f,searchWords:[E],highlightClassName:"search-fragment-highlight"})}renderOverrides(){const{overrides:f}=this.props;!f||f.length}render(f){const{title:E,description:h,render:y,showIf:v,skipField:D}=this.props,a=`${this.parent.props.id} ${E}`;return v&&!v()?null:D?y():t.createElement(g.g,{label:this.getLabel(f),description:h,key:a,"aria-label":s.wl.components.PanelEditor.OptionsPane.fieldLabel(a)},y())}}},26908:(j,I,e)=>{"use strict";e.d(I,{HZ:()=>p,AL:()=>c});var t=e(89949),n=e(27702),i=e(2471),s=e(89897),r=e(32299),g=e(23140);const d="Some data fields have this option pre-configured. Add a field override rule to override the pre-configured value.",l="An override rule exists for this property";function u(f,E,h){const y=[];if(h){for(const D of h)for(const a of D.fields)if((0,t.get)(a.config,f.path)!=null){y.push({type:"data",description:d,tooltip:d});break}}return E.overrides.some(D=>D.properties.some(a=>a.id===f.id))&&y.push({type:"rule",description:l,tooltip:l}),y}var o=e(11778);function m({data:f,replaceVariables:E,options:h,eventBus:y,instanceState:v}){const D=f?.series??[];return{data:D,replaceVariables:E,options:h,eventBus:y,getSuggestions:C=>(0,s.PW)(D,C),instanceState:v}}function c(f){const{plugin:E,panel:h,onPanelOptionsChanged:y,onFieldConfigsChange:v,data:D,dashboard:a,instanceState:C}=f,P=h.getOptions(),b=h.fieldConfig,M={},T=m({data:D,replaceVariables:h.replaceVariables,options:P,eventBus:a.events,instanceState:C}),S=O=>{const B=(O&&O[0])??`${E.meta.name}`,A=M[B];return A||(M[B]=new r.j({title:B,id:B}))},x={getValue:O=>(0,t.get)(P,O),onChange:(O,B)=>{const A=(0,o.hs)(P,O,B);y(A)}};p(E.getPanelOptionsSupplier(),x,S,T);for(const O of E.fieldConfigRegistry.list()){if(O.isCustom&&O.showIf&&!O.showIf(b.defaults.custom,D?.series)||O.hideFromDefaults)continue;const B=S(O.category),A=O.editor,V=b.defaults,W=O.isCustom?V.custom?(0,t.get)(V.custom,O.path):void 0:(0,t.get)(V,O.path);O.getItemsCount&&(B.props.itemsCount=O.getItemsCount(W)),B.addItem(new g.a({title:O.name,description:O.description,overrides:u(O,b,D?.series),render:function(){const N=F=>{v((0,o.uJ)(b,O.path,F,O.isCustom))};return n.createElement(A,{value:W,onChange:N,item:O,context:T,id:O.id})}}))}return Object.values(M)}function p(f,E,h,y,v){const D=new i.rt;f(D,y);for(const a of D.getItems()){if(a.showIf&&!a.showIf(y.options,y.data))continue;let C=v;if(C?a.category?.[0]?.length&&(C=C.getCategory(a.category[0])):C=h(a.category),(0,i.j)(a)){const b=a.getNestedValueAccess(E),M=b.getContext?b.getContext(y):{...y,options:E.getValue(a.path)};p(a.getBuilder(),b,h,M,C);continue}const P=a.editor;C.addItem(new g.a({title:a.name,description:a.description,render:function(){return n.createElement(P,{value:E.getValue(a.path),onChange:M=>{E.onChange(a.path,M)},item:a,context:y,id:a.id})}}))}}},45743:(j,I,e)=>{"use strict";e.d(I,{Hl:()=>m,K9:()=>E,OT:()=>y,ZP:()=>D,g_:()=>h,jy:()=>d,my:()=>f,yi:()=>p});var t=e(34099),n=e(53933),i=e(8508),s=e(56812),r=e(89167),g=e(25374);const d="grafana.dashboard.editor.ui",l={isPanelOptionsVisible:!0,rightPaneSize:400,topPaneSize:.45,mode:g.d1.Fill},u=()=>{const a=s.Z.getObject(d,l);let C={...a};return typeof a.topPaneSize=="string"&&(C={...a,topPaneSize:parseFloat(a.topPaneSize)/100}),{getPanel:()=>new r.rY({}),getSourcePanel:()=>new r.rY({}),getData:()=>({state:n.Gu.NotStarted,series:[],timeRange:(0,i.JK)()}),initDone:!1,shouldDiscardChanges:!1,isOpen:!1,isVizPickerOpen:!1,tableViewEnabled:!1,ui:{...l,...C}}},o=(0,t.oM)({name:"panelEditor",initialState:u(),reducers:{updateEditorInitState:(a,C)=>{a.getPanel=()=>C.payload.panel,a.getSourcePanel=()=>C.payload.sourcePanel,a.initDone=!0,a.isOpen=!0,a.shouldDiscardChanges=!1},setEditorPanelData:(a,C)=>{a.getData=()=>C.payload},setDiscardChanges:(a,C)=>{a.shouldDiscardChanges=C.payload},setPanelEditorUIState:(a,C)=>{a.ui={...a.ui,...C.payload},!a.ui.isPanelOptionsVisible&&a.isVizPickerOpen&&(a.isVizPickerOpen=!1)},toggleVizPicker:(a,C)=>{a.isVizPickerOpen=C.payload,a.isVizPickerOpen&&(a.ui.isPanelOptionsVisible=!0)},toggleTableView(a){a.tableViewEnabled=!a.tableViewEnabled},closeEditor:a=>{a.getPanel=()=>new r.rY({}),a.getSourcePanel=()=>new r.rY({}),a.isOpen=!1,a.initDone=!1,a.isVizPickerOpen=!1,a.tableViewEnabled=!1}}}),{updateEditorInitState:m,setEditorPanelData:c,setDiscardChanges:p,closeEditor:f,setPanelEditorUIState:E,toggleVizPicker:h,toggleTableView:y}=o.actions,D={panelEditor:o.reducer}},25374:(j,I,e)=>{"use strict";e.d(I,{Ip:()=>t,Ok:()=>g,d1:()=>n,d7:()=>s});var t=(d=>(d.Query="query",d.Transform="transform",d.Visualize="visualize",d.Alert="alert",d))(t||{}),n=(d=>(d[d.Fill=0]="Fill",d[d.Fit=1]="Fit",d[d.Exact=2]="Exact",d))(n||{}),i=(d=>(d[d.Off=0]="Off",d[d.Table=1]="Table",d))(i||{});const s=[{value:0,label:"Fill",description:"Use all available space"},{value:2,label:"Actual",description:"Make same size as on the dashboard"}],r=[{value:0,label:"Visualization",description:"Show using selected visualization"},{value:1,label:"Table",description:"Show raw data in table form"}];var g=(d=>(d[d.Visualizations=0]="Visualizations",d[d.LibraryPanels=1]="LibraryPanels",d[d.Suggestions=2]="Suggestions",d[d.Widgets=3]="Widgets",d))(g||{})},11778:(j,I,e)=>{"use strict";e.d(I,{hs:()=>l,jF:()=>r,sY:()=>g,uJ:()=>d});var t=e(89949),n=e.n(t),i=e(97957),s=e(25374);function r(u,o,m,c){if(u===s.d1.Fill)return{width:o,height:m};const p=8*6,f=60,h=(window.innerWidth-f-i.hD*4)/i.cz*c.gridPos.w,y=i.K3*c.gridPos.h+p,v=Math.min(o/h,m/y);return h<=o&&y<=m?{width:h,height:y}:{width:h*v,height:y*v}}function g(u){return u?.meta.skipDataQuery===!1}const d=(u,o,m,c)=>{let p={...u.defaults};const f=m==null||m==="";return c?p.custom?f?p.custom=(0,t.omit)(p.custom,o):p.custom=l(p.custom,o,m):f||(p.custom=l(p.custom,o,m)):f?p=(0,t.omit)(p,o):p=l(p,o,m),{...u,defaults:p}};function l(u,o,m){const c=Array.isArray(o)?o:o.split("."),p=c.shift();if(p.endsWith("]")){const E=p.lastIndexOf("["),h=+p.substring(E+1,p.length-1),y=p.substring(0,E);let v=u[y];const D=Array.isArray(v)?[...v]:[];return c.length&&(v=D[h],(v==null||typeof v!="object")&&(v={}),m=l(v,c,m)),D[h]=m,{...u,[y]:D}}if(!c.length)return{...u,[p]:m};let f=u[p];return(f==null||typeof f!="object")&&(f={}),{...u,[p]:l(f,c,m)}}},60042:(j,I,e)=>{"use strict";e.d(I,{Z:()=>u});var t=e(42844),n=e(27702),i=e(25111),s=e(66310),r=e(63439),g=e(45937);function d({dashboard:o}){const m=(0,s.wW)(l),{loading:c,value:p,error:f}=(0,i.Z)(async()=>{const h=o.getSaveModelClone();return g.ae.validateDashboard(h).catch(v=>{if(v.status>=500)throw v;return v.data})},[o]);let E;if(c)E=n.createElement(r.b,{severity:"info",title:"Checking dashboard validity"});else if(p)p.isValid||(E=n.createElement(r.b,{severity:"warning",title:"Dashboard failed schema validation"},n.createElement("p",null,"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"),n.createElement("div",{className:m.error},p.message)));else{const h=f?.message??"Unknown error";E=n.createElement(r.b,{severity:"info",title:"Error checking dashboard validity"},n.createElement("p",{className:m.error},h))}return E?n.createElement("div",{className:m.root},E):null}const l=o=>({root:(0,t.css)({marginTop:o.spacing(1)}),error:(0,t.css)({fontFamily:o.typography.fontFamilyMonospace,whiteSpace:"pre-wrap",overflowX:"auto",maxWidth:"100%"})}),u=d},63534:(j,I,e)=>{"use strict";e.d(I,{i:()=>d,t:()=>l});var t=e(27702),n=e(74639),i=e(86312),s=e(60729),r=e(66670),g=e(37778);const d=({dashboard:u,onSaveSuccess:o,size:m})=>t.createElement(s.JY,null,({showModal:c,hideModal:p})=>t.createElement(r.zx,{size:m,onClick:()=>{c(g.d,{dashboard:u,onSaveSuccess:o,onDismiss:p})},"aria-label":n.wl.pages.Dashboard.Settings.General.saveDashBoard},"Save dashboard")),l=({dashboard:u,onSaveSuccess:o,variant:m,size:c})=>t.createElement(s.JY,null,({showModal:p,hideModal:f})=>t.createElement(r.zx,{size:c,onClick:()=>{(0,i.ff)("grafana_dashboard_save_as_clicked"),p(g.d,{dashboard:u,onSaveSuccess:o,onDismiss:f,isCopy:!0})},variant:m,"aria-label":n.wl.pages.Dashboard.Settings.General.saveAsDashBoard},"Save as"))},43590:(j,I,e)=>{"use strict";e.d(I,{_:()=>l});var t=e(42844),n=e(27702),i=e(25111),s=e(66310),r=e(62108),g=e(60195),d=e(18475);const l=({diff:o,oldValue:m,newValue:c})=>{const p=(0,s.wW)(u),f=(0,i.Z)(async()=>{const h=JSON.stringify(m??{},null,2),y=JSON.stringify(c??{},null,2);let v;const D=[];let a=0;if(o)for(const[C,P]of Object.entries(o)){const b=n.createElement(g.B,{diffs:P,key:C,title:C});C==="schemaVersion"?v=b:D.push(b),a+=P.length}return{schemaChange:v,diffs:D,count:a,showDiffs:a<15,jsonView:n.createElement(d.Z,{oldValue:h,newValue:y})}},[o,m,c]),{value:E}=f;return!E||!m?n.createElement(r.$,null):E.count<1?n.createElement("div",null,"No changes in this dashboard"):n.createElement("div",null,E.schemaChange&&n.createElement("div",{className:p.spacer},E.schemaChange),E.showDiffs&&n.createElement("div",{className:p.spacer},E.diffs),n.createElement("h4",null,"JSON Model"),E.jsonView)},u=o=>({spacer:(0,t.css)` margin-bottom: ${o.v1.spacing.xl}; `})},37778:(j,I,e)=>{"use strict";e.d(I,{d:()=>ye});var t=e(27702),n=e(25111),i=e(73289),s=e(34667),r=e(14574),g=e(15372),d=e(54281),l=e(45937),u=e(3323),o=e(60042),m=e(43590),c=e(42844),p=e(3613),f=e(66310),E=e(13741),h=e(66670),y=e(63534),v=e(26811),D=e(94469),a=e(86312),C=e(26129),P=e(5933),b=e(73807),M=e(66574),T=e(78467),S=e(67572),x=e(77799),O=e(18771),B=e(43620);const A=async(ce,We,ke,et)=>{if(s.config.featureToggles.nestedFolders){const Ge=await et({dashboard:ce,folderUid:We.folderUid??ke.meta.folderUid??ce.meta.folderUid,message:We.message,overwrite:We.overwrite});if("error"in Ge)throw Ge.error;return Ge.data}let we=We.folderUid;we===void 0&&(we=ke.meta.folderUid??ce.folderUid);const _e=await(0,x.uC)({...We,folderUid:we,dashboard:ce});return await M.Vt.fetchUserPermissions(),_e},V=(ce,We=!1)=>{const ke=(0,O.useDispatch)(),et=(0,b.iG)(),[we]=(0,S.yF)(),[_e,Ge]=(0,v.Z)(async(qe,st,Me)=>{try{const be=await A(qe,st,Me,we);Me.version=be.version,Me.clearUnsavedChanges(),P.Z.publish(new B.Jd),et.success("Dashboard saved"),We?(0,a.ff)("grafana_dashboard_copied",{name:Me.title,url:be.url}):(0,a.ff)(`grafana_dashboard_${Me.id?"saved":"created"}`,{name:Me.title,url:be.url});const Ke=C.E1.getLocation().pathname,Ye=D.u.stripBaseFromUrl(be.url);return Ye!==Ke&&setTimeout(()=>C.E1.replace(Ye)),Me.meta.isStarred&&ke((0,T.gd)({id:Me.uid,title:Me.title,url:Ye})),be}catch(be){throw be instanceof Error&&et.error(be.message??"Error saving dashboard"),be}},[ke,et]);return{state:_e,onDashboardSave:Ge}},W=({dashboard:ce,dashboardSaveModel:We,error:ke,onDismiss:et})=>{const{onDashboardSave:we}=V(ce);return(0,t.useEffect)(()=>{ke.data&&N(ke.data.status)&&(ke.isHandled=!0)},[ke]),t.createElement(t.Fragment,null,ke.data&&ke.data.status==="version-mismatch"&&t.createElement(p.s,{isOpen:!0,title:"Conflict",body:t.createElement("div",null,"Someone else has updated this dashboard ",t.createElement("br",null)," ",t.createElement("small",null,"Would you still like to save this dashboard?")),confirmText:"Save and overwrite",onConfirm:async()=>{await we(We,{overwrite:!0},ce),et()},onDismiss:et}),ke.data&&ke.data.status==="name-exists"&&t.createElement(p.s,{isOpen:!0,title:"Conflict",body:t.createElement("div",null,"A dashboard with the same name in selected folder already exists. ",t.createElement("br",null),t.createElement("small",null,"Would you still like to save this dashboard?")),confirmText:"Save and overwrite",onConfirm:async()=>{await we(We,{overwrite:!0},ce),et()},onDismiss:et}),ke.data&&ke.data.status==="plugin-dashboard"&&t.createElement(w,{dashboard:ce,onDismiss:et}))},w=({onDismiss:ce,dashboard:We})=>{const{onDashboardSave:ke}=V(We),et=(0,f.wW)(F);return t.createElement(E.u,{className:et.modal,title:"Plugin dashboard",icon:"copy",isOpen:!0,onDismiss:ce},t.createElement("div",{className:et.modalText},"Your changes will be lost when you update the plugin.",t.createElement("br",null),t.createElement("small",null,"Use ",t.createElement("strong",null,"Save As")," to create custom version.")),t.createElement(E.u.ButtonRow,null,t.createElement(h.zx,{variant:"secondary",onClick:ce,fill:"outline"},"Cancel"),t.createElement(y.t,{dashboard:We,onSaveSuccess:ce}),t.createElement(h.zx,{variant:"destructive",onClick:async()=>{await ke(We.getSaveModelClone(),{overwrite:!0},We),ce()}},"Overwrite")))},N=ce=>{switch(ce){case"version-mismatch":case"name-exists":case"plugin-dashboard":return!0;default:return!1}},F=ce=>({modal:(0,c.css)` width: 500px; `,modalText:(0,c.css)` font-size: ${ce.typography.h4.fontSize}; color: ${ce.colors.text.primary}; margin-bottom: ${ce.spacing(4)} padding-top: ${ce.spacing(2)}; `,modalButtonRow:(0,c.css)` margin-bottom: 14px; a, button { margin-right: ${ce.spacing(2)}; } `});var k=e(23839),H=e(22209),R=e(1128),_=e(16310),G=e(42074),Y=e(64022),X=e(74729),Q=e(39345);const se=ce=>{const We=ce.getSaveModelClone();return We.id=null,We.uid="",We.title+=" Copy",We.editable=!0,ce.id>0&&We.panels.forEach(ke=>{ke.type==="graph"&&ke.alert&&delete ke.thresholds,delete ke.alert}),We},Z=({dashboard:ce,isLoading:We,isNew:ke,onSubmit:et,onCancel:we,onSuccess:_e})=>{const Ge={title:ke?ce.title:`${ce.title} Copy`,$folder:{uid:ce.meta.folderUid,title:ce.meta.folderTitle},copyTags:!1},qe=st=>async Me=>{if(Me&&Me===st().$folder.title?.trim())return"Dashboard name cannot be the same as folder name";try{return await Q.t.validateNewDashboardName(st().$folder.uid??"general",Me),!0}catch(be){return be instanceof Error?be.message:"Dashboard name is invalid"}};return t.createElement(k.l,{defaultValues:Ge,onSubmit:async st=>{if(!et)return;const Me=se(ce);Me.title=st.title,!ke&&!st.copyTags&&(Me.tags=[]),(await et(Me,{folderUid:st.$folder.uid},ce)).status==="success"&&_e()}},({register:st,control:Me,errors:be,getValues:Ke})=>t.createElement(t.Fragment,null,t.createElement(H.g,{label:"Dashboard name",invalid:!!be.title,error:be.title?.message},t.createElement(R.I,{...st("title",{validate:qe(Ke)}),"aria-label":"Save dashboard title field",autoFocus:!0})),t.createElement(H.g,{label:"Folder"},t.createElement(_.g,{render:({field:{ref:Ye,...tt}})=>t.createElement(X.E,{...tt,onChange:(nt,Pt)=>tt.onChange({uid:nt,title:Pt}),value:tt.value?.uid,initialTitle:ce.meta.folderTitle,dashboardId:ce.id,enableCreateNew:!0}),control:Me,name:"$folder"})),!ke&&t.createElement(H.g,{label:"Copy tags"},t.createElement(G.r,{...st("copyTags")})),t.createElement(Y.Lh,null,t.createElement(h.zx,{type:"button",variant:"secondary",onClick:we,fill:"outline"},"Cancel"),t.createElement(h.zx,{disabled:We,type:"submit","aria-label":"Save dashboard button"},We?"Saving...":"Save"))))};var le=e(74639),oe=e(23852),q=e(83967),ne=e(60105);const ge=({dashboard:ce,isLoading:We,saveModel:ke,options:et,onSubmit:we,onCancel:_e,onSuccess:Ge,onOptionsChange:qe})=>{const st=(0,t.useMemo)(()=>ce.hasTimeChanged(),[ce]),Me=(0,t.useMemo)(()=>ce.hasVariableValuesChanged(),[ce]),[be,Ke]=(0,t.useState)(!1);return t.createElement(k.l,{onSubmit:async Ye=>{if(!we)return;Ke(!0),et={...et,message:Ye.message},(await we(ke.clone,et,ce)).status==="success"?(et.saveVariables&&ce.resetOriginalVariables(),et.saveTimerange&&ce.resetOriginalTime(),Ge()):Ke(!1)}},({register:Ye,errors:tt})=>{const nt=Ye("message");return t.createElement(oe.K,{gap:2,direction:"column",alignItems:"flex-start"},st&&t.createElement(q.X,{checked:!!et.saveTimerange,onChange:()=>qe({...et,saveTimerange:!et.saveTimerange}),label:"Save current time range as dashboard default","aria-label":le.wl.pages.SaveDashboardModal.saveTimerange}),Me&&t.createElement(q.X,{checked:!!et.saveVariables,onChange:()=>qe({...et,saveVariables:!et.saveVariables}),label:"Save current variable values as dashboard default","aria-label":le.wl.pages.SaveDashboardModal.saveVariables}),t.createElement(ne.K,{...nt,"aria-label":"message",value:et.message,onChange:Pt=>{qe({...et,message:Pt.currentTarget.value}),nt.onChange(Pt)},placeholder:"Add a note to describe your changes.",autoFocus:!0,rows:5}),t.createElement(oe.K,{alignItems:"center"},t.createElement(h.zx,{variant:"secondary",onClick:_e,fill:"outline"},"Cancel"),t.createElement(h.zx,{type:"submit",disabled:!ke.hasChanges||We,icon:be?"fa fa-spinner":void 0,"aria-label":le.wl.pages.SaveDashboardModal.save},We?"Saving...":"Save"),!ke.hasChanges&&t.createElement("div",null,"No changes to save")))})};var ae=e(49086),re=e(71585);const De=({dashboard:ce,onCancel:We})=>{const[ke,et]=(0,t.useState)(()=>{const _e=ce.getSaveModelClone();return delete _e.id,JSON.stringify(_e,null,2)}),we=(0,t.useCallback)(()=>{const _e=new Blob([ke],{type:"application/json;charset=utf-8"});(0,ae.saveAs)(_e,ce.title+"-"+new Date().getTime()+".json")},[ce.title,ke]);return t.createElement(t.Fragment,null,t.createElement(oe.K,{direction:"column",gap:2},t.createElement("div",null,"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.",t.createElement("br",null),t.createElement("i",null,"See"," ",t.createElement("a",{className:"external-link",href:"https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards",target:"_blank",rel:"noreferrer"},"documentation")," ","for more information about provisioning."),t.createElement("br",null)," ",t.createElement("br",null),t.createElement("strong",null,"File path: ")," ",ce.meta.provisionedExternalId),t.createElement(ne.K,{spellCheck:!1,value:ke,onChange:_e=>{et(_e.currentTarget.value)},className:he.json}),t.createElement(Y.Lh,null,t.createElement(h.zx,{variant:"secondary",onClick:We,fill:"outline"},"Cancel"),t.createElement(re.m,{icon:"copy",getText:()=>ke},"Copy JSON to clipboard"),t.createElement(h.zx,{type:"submit",onClick:we},"Save JSON to file"))))},he={json:(0,c.css)` height: 400px; width: 100%; overflow: auto; resize: none; font-family: monospace; `},ye=({dashboard:ce,onDismiss:We,onSaveSuccess:ke,isCopy:et})=>{const[we,_e]=(0,t.useState)({}),Ge=ce.meta.provisioned,qe=ce.version===0,st=(0,n.Z)(async()=>qe?void 0:(await l.ae.getDashboardByUid(ce.uid)).dashboard,[ce,qe]),Me=(0,t.useMemo)(()=>{const bt=ce.getSaveModelClone({saveTimerange:!!we.saveTimerange,saveVariables:!!we.saveVariables});if(!st.value)return{clone:bt,diff:{},diffCount:0,hasChanges:!1};const Rt=JSON.stringify(bt,null,2),ct=JSON.parse(Rt),it=(0,u.Q$)(st.value,ct);let me=0;for(const Ee of Object.values(it))me+=Ee.length;return{clone:bt,diff:it,diffCount:me,hasChanges:me>0&&!qe}},[ce,st.value,we,qe]),[be,Ke]=(0,t.useState)(!1),{state:Ye,onDashboardSave:tt}=V(ce,et),nt=ke?()=>{We(),ke()}:We,Pt=()=>be?t.createElement(m._,{diff:Me.diff,oldValue:st.value,newValue:Me.clone}):qe||et?t.createElement(Z,{dashboard:ce,isLoading:Ye.loading,onCancel:We,onSuccess:nt,onSubmit:tt,isNew:qe}):Ge?t.createElement(De,{dashboard:ce,onCancel:We,onSuccess:nt}):t.createElement(ge,{dashboard:ce,isLoading:Ye.loading,saveModel:Me,onCancel:We,onSuccess:nt,onSubmit:tt,options:we,onOptionsChange:_e});if(Ye.error&&(0,i.kW)(Ye.error)&&!Ye.error.isHandled&&N(Ye.error.data.status))return t.createElement(W,{error:Ye.error,dashboard:ce,dashboardSaveModel:Me.clone,onDismiss:We});let xt="Save dashboard";return et?xt="Save dashboard copy":Ge&&(xt="Provisioned dashboard"),t.createElement(r.d,{title:xt,onClose:We,subtitle:ce.title,tabs:t.createElement(g.J,null,t.createElement(d.O,{label:"Details",active:!be,onChangeTab:()=>Ke(!1)}),Me.hasChanges&&t.createElement(d.O,{label:"Changes",active:be,onChangeTab:()=>Ke(!0),counter:Me.diffCount})),scrollableContent:!0},Pt(),s.config.featureToggles.showDashboardValidationWarnings&&t.createElement(o.Z,{dashboard:ce}))}},51727:(j,I,e)=>{"use strict";e.d(I,{Jd:()=>i,_H:()=>s,Ez:()=>l,_M:()=>d,ek:()=>g,Gt:()=>r,C2:()=>u});var t=e(12308);const n=new Set(["__expr__","aquaqanalytics-kdbbackend-datasource","cloudwatch","datasource","dlopes7-appdynamics-datasource","doitintl-bigquery-datasource","elasticsearch","frser-sqlite-datasource","grafadruid-druid-datasource","grafana-athena-datasource","grafana-azure-data-explorer-datasource","grafana-azure-monitor-datasource","grafana-bigquery-datasource","grafana-clickhouse-datasource","grafana-databricks-datasource","grafana-datadog-datasource","grafana-db2-datasource","grafana-dynatrace-datasource","grafana-es-open-distro-datasource","grafana-github-datasource","grafana-gitlab-datasource","grafana-honeycomb-datasource","grafana-iot-sitewise-datasource","grafana-jira-datasource","grafana-mock-datasource","grafana-mongodb-datasource","grafana-newrelic-datasource","grafana-odbc-datasource","grafana-opcua-datasource","grafana-opensearch-datasource","grafana-oracle-datasource","grafana-orbit-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-timestream-datasource","grafana-wavefront-datasource","grafana-x-ray-datasource","graphite","hadesarchitect-cassandra-datasource","influxdb","innius-grpc-datasource","kniepdennis-neo4j-datasource","loki","marcusolsson-csv-datasource","marcusolsson-ynab-datasource","mssql","mysql","nagasudhirpulla-api-datasource","opentsdb","postgres","prometheus","redis-datasource","sentinelone-dataset-datasource","tdengine-datasource","vertamedia-clickhouse-datasource","vertica-grafana-datasource","yesoreyeram-infinity-datasource"]);var i=(o=>(o.PUBLIC="public",o.EMAIL="email",o))(i||{});const s=o=>o.length>0,r=o=>o?.uid!==""&&o?.uid!==void 0,g=o=>{let m=new Set;for(const c of o)for(const p of c.targets){let f=p?.datasource?.type;f&&!n.has(f)&&m.add(f)}return Array.from(m).sort()},d=o=>`${(0,t.iE)().appUrl}public-dashboards/${o}`,l=o=>`/d/${o}?shareView=public-dashboard`,u=/^[A-Z\d._%+-]+@[A-Z\d.-]+\.[A-Z]{2,}$/i},19067:(j,I,e)=>{"use strict";e.d(I,{ShareModal:()=>sn});var t=e(42844),n=e(27702),i=e(86312),s=e(64472),r=e(13741),g=e(4432),d=e(66310),l=e(12308),u=e(66574),o=e(65322),m=e(62108),c=e(39705),p=e(51727),f=e(58083),E=e(46089),h=e(74639),y=e(34667),v=e(80978),D=e(60729),a=e(22209),C=e(1128),P=e(71585),b=e(42074),M=e(79978),T=e(64022),S=e(56074),x=e(91368),O=e(18771),B=e(92983),A=e(309),V=e(46917);const W=()=>{const{width:wt}=(0,V.Z)();return wt>1024};var w=e(63439);const N=h.wl.pages.ShareDashboardModal.PublicDashboard,F=({mode:wt})=>n.createElement(w.b,{severity:"info",title:`You don\u2019t have permission to ${wt} a public dashboard`,"data-testid":N.NoUpsertPermissionsWarningAlert,bottomSpacing:0},"Contact your admin to get permission to ",wt," create public dashboards"),k=()=>n.createElement(w.b,{title:"Please save your dashboard changes before updating the public configuration",severity:"warning",bottomSpacing:0});var H=e(89898),R=e.n(H);const _=h.wl.pages.ShareDashboardModal.PublicDashboard,G=({unsupportedDataSources:wt})=>{const Vt=(0,d.wW)(Y);return n.createElement(w.b,{severity:"warning",title:"Unsupported data sources","data-testid":_.UnsupportedDataSourcesWarningAlert,bottomSpacing:0},n.createElement("p",{className:Vt.unsupportedDataSourceDescription},"There are data sources in this dashboard that are unsupported for public dashboards. Panels that use these data sources may not function properly: ",wt,"."),n.createElement("a",{href:"https://grafana.com/docs/grafana/latest/dashboards/dashboard-public/",className:R()("text-link",Vt.unsupportedDataSourceDescription)},"Read more about supported data sources"))},Y=wt=>({unsupportedDataSourceDescription:(0,t.css)` color: ${wt.colors.text.secondary}; margin-bottom: ${wt.spacing(1)}; `}),X=h.wl.pages.ShareDashboardModal.PublicDashboard,Q=()=>n.createElement(w.b,{severity:"warning",title:"Template variables are not supported","data-testid":X.TemplateVariablesWarningAlert,bottomSpacing:0},"This public dashboard may not work since it uses template variables");var se=e(5229),Z=e(95059);const le=h.wl.pages.ShareDashboardModal.PublicDashboard,oe=({disabled:wt,onChange:Vt,register:Ht,timeRange:Xt})=>n.createElement(n.Fragment,null,n.createElement(se.C,{disabled:wt},n.createElement(T.wc,{spacing:"md"},n.createElement(T.Ar,{orientation:1,spacing:"xs",justify:"space-between"},n.createElement(M._,{description:"The public dashboard uses the default time range settings of the dashboard"},"Default time range"),n.createElement(Z.K,{value:Xt,disabled:!0,onChange:()=>{}})),n.createElement(T.Ar,{orientation:0,spacing:"sm"},n.createElement(b.r,{...Ht("isTimeSelectionEnabled"),"data-testid":le.EnableTimeRangeSwitch,onChange:mn=>{(0,i.ff)("grafana_dashboards_public_time_selection_clicked",{action:mn.currentTarget.checked?"enable":"disable"}),Vt("isTimeSelectionEnabled",mn.currentTarget.checked)}}),n.createElement(M._,{description:"Allow viewers to change time range"},"Time range picker enabled")),n.createElement(T.Ar,{orientation:0,spacing:"sm"},n.createElement(b.r,{...Ht("isAnnotationsEnabled"),onChange:mn=>{(0,i.ff)("grafana_dashboards_public_annotations_clicked",{action:mn.currentTarget.checked?"enable":"disable"}),Vt("isAnnotationsEnabled",mn.currentTarget.checked)},"data-testid":le.EnableAnnotationsSwitch}),n.createElement(M._,{description:"Show annotations on public dashboard"},"Show annotations")))));var q=e(77720),ne=e(66670),ge=e(16310),ae=e(40705);const re=[{label:"Anyone with a link",value:p.Jd.PUBLIC},{label:"Only specified people",value:p.Jd.EMAIL}],De=h.wl.pages.ShareDashboardModal.PublicDashboard.EmailSharingConfiguration,he=({recipients:wt,dashboardUid:Vt,publicDashboardUid:Ht})=>{const Xt=(0,d.wW)(ce),[mn,{isLoading:pn}]=(0,c.r5)(),[Pn,{isLoading:zn}]=(0,c.RS)(),Hn=pn||zn,Ea=na=>{(0,i.ff)("grafana_dashboards_public_delete_sharing_email_clicked"),mn({recipientUid:na,dashboardUid:Vt,uid:Ht})},aa=na=>{(0,i.ff)("grafana_dashboards_public_reshare_email_clicked"),Pn({recipientUid:na,uid:Ht})};return n.createElement("table",{className:Xt.table,"data-testid":De.EmailSharingList},n.createElement("tbody",null,wt.map((na,xa)=>n.createElement("tr",{key:na.uid},n.createElement("td",null,na.recipient),n.createElement("td",null,n.createElement(q.h,{className:Xt.tableButtonsContainer},n.createElement(ne.zx,{type:"button",variant:"destructive",fill:"text","aria-label":"Revoke",title:"Revoke",size:"sm",disabled:Hn,onClick:()=>Ea(na.uid),"data-testid":`${De.DeleteEmail}-${xa}`},"Revoke"),n.createElement(ne.zx,{type:"button",variant:"primary",fill:"text","aria-label":"Resend",title:"Resend",size:"sm",disabled:Hn,onClick:()=>aa(na.uid),"data-testid":`${De.ReshareLink}-${xa}`},"Resend")))))))},ye=()=>{const{width:wt}=(0,V.Z)(),Vt=(0,d.wW)(ce),Xt=(0,O.useSelector)($a=>$a.dashboard).getModel(),{data:mn}=(0,c.Ym)(Xt.uid),[pn]=(0,c.Mi)(),[Pn,{isLoading:zn}]=(0,c.FJ)(),{register:Hn,setValue:Ea,control:aa,watch:na,handleSubmit:xa,formState:{errors:Ca},reset:Ba}=(0,E.cI)({defaultValues:{shareType:mn?.share||p.Jd.PUBLIC,email:""},mode:"onSubmit"}),ka=$a=>{const Mt={dashboard:Xt,payload:{...mn,share:$a}};pn(Mt)},Ua=async $a=>{(0,i.ff)("grafana_dashboards_public_add_share_email_clicked"),await Pn({recipient:$a.email,uid:mn.uid,dashboardUid:Xt.uid}).unwrap(),Ba({email:"",shareType:p.Jd.EMAIL})};return n.createElement("form",{"data-testid":De.Container,className:Vt.container,onSubmit:xa(Ua)},n.createElement(a.g,{label:"Can view dashboard",className:Vt.field},n.createElement(ge.g,{name:"shareType",control:aa,render:({field:$a})=>{const{ref:Mt,...Dt}=$a;return n.createElement(ae.S,{...Dt,size:wt<480?"sm":"md",options:re,onChange:ht=>{(0,i.ff)("grafana_dashboards_public_share_type_clicked",{type:ht}),Ea("shareType",ht),ka(ht)}})}})),na("shareType")===p.Jd.EMAIL&&n.createElement(n.Fragment,null,n.createElement(a.g,{label:"Invite",description:"Invite people by email",error:Ca.email?.message,invalid:!!Ca.email?.message||void 0,className:Vt.field},n.createElement("div",{className:Vt.emailContainer},n.createElement(C.I,{className:Vt.emailInput,placeholder:"email",autoCapitalize:"none",...Hn("email",{required:"Email is required",pattern:{value:p.C2,message:"Invalid email"}}),"data-testid":De.EmailSharingInput}),n.createElement(ne.zx,{type:"submit",variant:"primary",disabled:zn,"data-testid":De.EmailSharingInviteButton},"Invite ",zn&&n.createElement(m.$,null)))),!!mn?.recipients?.length&&n.createElement(he,{recipients:mn.recipients,dashboardUid:Xt.uid,publicDashboardUid:mn.uid})))},ce=wt=>({container:(0,t.css)` label: emailConfigContainer; display: flex; flex-direction: column; flex-wrap: wrap; gap: ${wt.spacing(3)}; `,field:(0,t.css)` label: field-noMargin; margin-bottom: 0; `,emailContainer:(0,t.css)` label: emailContainer; display: flex; gap: ${wt.spacing(1)}; `,emailInput:(0,t.css)` label: emailInput; flex-grow: 1; `,table:(0,t.css)` label: table; display: flex; max-height: 220px; overflow-y: scroll; & tbody { display: flex; flex-direction: column; flex-grow: 1; } & tr { min-height: 40px; display: flex; align-items: center; justify-content: space-between; padding: ${wt.spacing(.5,1)}; :nth-child(odd) { background: ${wt.colors.background.secondary}; } } `,tableButtonsContainer:(0,t.css)` display: flex; justify-content: end; `});var We=e(66258),ke=e(67437);function et({headerElement:wt,isContentVisible:Vt=!1,onRowToggle:Ht,title:Xt,...mn}){const pn=(0,d.wW)(we),Pn=wt&&We.renderOrCallToRender(wt,{className:pn.summaryWrapper});return n.createElement("div",{className:pn.wrapper},n.createElement("div",{className:pn.header},n.createElement(ke.h,{name:Vt?"angle-down":"angle-right",tooltip:Vt?"Collapse settings":"Expand settings",className:pn.collapseIcon,onClick:Ht,"aria-expanded":Vt,...mn}),Xt&&n.createElement("div",{className:pn.titleWrapper,onClick:Ht},n.createElement("span",{className:pn.title},Xt)),Pn))}et.displayName="SettingsBarHeader";function we(wt){return{wrapper:(0,t.css)({label:"header",padding:wt.spacing(.5,.5),borderRadius:wt.shape.borderRadius(1),background:wt.colors.background.secondary,minHeight:wt.spacing(4),"&:focus":{outline:"none"}}),header:(0,t.css)({label:"column",display:"flex",alignItems:"center",whiteSpace:"nowrap"}),collapseIcon:(0,t.css)({marginLeft:wt.spacing(.5),color:wt.colors.text.disabled}),titleWrapper:(0,t.css)({display:"flex",alignItems:"center",cursor:"pointer",overflow:"hidden",marginRight:`${wt.spacing(.5)}`,[wt.breakpoints.down("sm")]:{flex:"1 1"}}),title:(0,t.css)({fontWeight:wt.typography.fontWeightBold,marginLeft:wt.spacing(.5),overflow:"hidden",textOverflow:"ellipsis"}),summaryWrapper:(0,t.css)({display:"flex",flexWrap:"wrap",[wt.breakpoints.down("sm")]:{flex:"2 2"}})}}function _e({children:wt,title:Vt,headerElement:Ht,...Xt}){const mn=(0,d.wW)(Ge),[pn,Pn]=(0,n.useState)(!1);function zn(){Pn(Hn=>!Hn)}return n.createElement(n.Fragment,null,n.createElement(et,{onRowToggle:zn,isContentVisible:pn,title:Vt,headerElement:Ht,...Xt}),pn&&n.createElement("div",{className:mn.content},wt))}_e.displayName="SettingsBar";const Ge=wt=>({content:(0,t.css)({marginTop:wt.spacing(1),marginLeft:wt.spacing(4)})});var qe=e(49430);function st({className:wt,isDataLoading:Vt=!1,timeRange:Ht,timeSelectionEnabled:Xt,annotationsEnabled:mn}){const pn=(0,d.wW)(Me);return Vt?n.createElement("div",{className:(0,t.cx)(pn.summaryWrapper,wt)},n.createElement(m.$,{className:pn.summary,inline:!0,size:14})):n.createElement("div",{className:(0,t.cx)(pn.summaryWrapper,wt)},n.createElement("span",{className:pn.summary},"Time range = ",n.createElement(qe.q,{className:pn.timeRange,value:Ht})),n.createElement("span",{className:pn.summary},`Time range picker = ${Xt?"enabled":"disabled"}`),n.createElement("span",{className:pn.summary},`Annotations = ${mn?"show":"hide"}`))}st.displayName="SettingsSummary";const Me=wt=>({summaryWrapper:(0,t.css)({display:"flex"}),summary:(0,t.css)` label: collapsedText; margin-left: ${wt.spacing.gridSize*2}px; font-size: ${wt.typography.bodySmall.fontSize}; color: ${wt.colors.text.secondary}; `,timeRange:(0,t.css)({display:"inline-block"})}),be=h.wl.pages.ShareDashboardModal.PublicDashboard,Ke=()=>{const wt=(0,d.wW)(Ye),Vt=W(),{showModal:Ht,hideModal:Xt}=(0,n.useContext)(D.kr),mn=x.contextSrv.hasAccess(O.AccessControlAction.DashboardsPublicWrite,(0,A.RN)()),pn=!!y.config.featureToggles.publicDashboardsEmailSharing&&(0,v.v)("publicDashboardsEmailSharing"),zn=(0,O.useSelector)(zt=>zt.dashboard).getModel(),Hn=zn.getVariables(),Ea=(0,p.ek)(zn.panels),{data:aa,isFetching:na}=(0,c.Ym)(zn.uid),[xa,{isLoading:Ca}]=(0,c.Mi)(),Ba=Ca||na,ka=!mn||Ba,Ua=(0,S.O)(zn.getDefaultTime(),zn),{handleSubmit:$a,setValue:Mt,register:Dt}=(0,E.cI)({defaultValues:{isAnnotationsEnabled:aa?.annotationsEnabled,isTimeSelectionEnabled:aa?.timeSelectionEnabled,isPaused:!aa?.isEnabled}}),ht=async zt=>{const{isAnnotationsEnabled:En,isTimeSelectionEnabled:Tn,isPaused:An}=zt,xn={dashboard:zn,payload:{...aa,annotationsEnabled:En,timeSelectionEnabled:Tn,isEnabled:!An}};xa(xn)},Lt=async(zt,En)=>{Mt(zt,En),await $a(Tn=>ht(Tn))()},rn=()=>{Ht(sn,{dashboard:zn,onDismiss:Xt,activeTab:"public-dashboard"})};return n.createElement("div",{className:wt.configContainer},mn&&zn.hasUnsavedChanges()&&n.createElement(k,null),!mn&&n.createElement(F,{mode:"edit"}),(0,p._H)(Hn)&&n.createElement(Q,null),!!Ea.length&&n.createElement(G,{unsupportedDataSources:Ea.join(", ")}),pn&&n.createElement(ye,null),n.createElement(a.g,{label:"Dashboard URL",className:wt.fieldSpace},n.createElement(C.I,{value:(0,p._M)(aa.accessToken),readOnly:!0,disabled:!aa?.isEnabled,"data-testid":be.CopyUrlInput,addonAfter:n.createElement(P.m,{"data-testid":be.CopyUrlButton,variant:"primary",disabled:!aa?.isEnabled,getText:()=>(0,p._M)(aa.accessToken)},"Copy")})),n.createElement(a.g,{className:wt.fieldSpace},n.createElement(T.Ar,null,n.createElement(b.r,{...Dt("isPaused"),disabled:ka,onChange:zt=>{(0,i.ff)("grafana_dashboards_public_enable_clicked",{action:zt.currentTarget.checked?"disable":"enable"}),Lt("isPaused",zt.currentTarget.checked)},"data-testid":be.PauseSwitch}),n.createElement(M._,{className:(0,t.css)` margin-bottom: 0; `},"Pause sharing dashboard"))),n.createElement(a.g,{className:wt.fieldSpace},n.createElement(_e,{title:"Settings",headerElement:({className:zt})=>n.createElement(st,{className:zt,isDataLoading:Ba,timeRange:Ua,timeSelectionEnabled:aa?.timeSelectionEnabled,annotationsEnabled:aa?.annotationsEnabled}),"data-testid":be.SettingsDropdown},n.createElement(oe,{disabled:ka,onChange:Lt,register:Dt,timeRange:Ua}))),n.createElement(T.Ar,{orientation:Vt?0:1,justify:Vt?"flex-end":"flex-start",align:Vt?"center":"normal"},n.createElement(T.Lh,{justify:"flex-end"},n.createElement(B.H,{type:"button",disabled:ka,"data-testid":be.DeleteButton,onDismiss:rn,variant:"destructive",fill:"outline",dashboard:zn,publicDashboard:{uid:aa.uid,dashboardUid:zn.uid,title:zn.title}},"Revoke public URL"))))},Ye=wt=>({configContainer:(0,t.css)` label: config container; display: flex; flex-direction: column; flex-wrap: wrap; gap: ${wt.spacing(3)}; `,fieldSpace:(0,t.css)` label: field space; width: 100%; margin-bottom: 0; `,timeRange:(0,t.css)({display:"inline-block"})}),tt=Ke;var nt=e(23839),Pt=e(83967);const xt=h.wl.pages.ShareDashboardModal.PublicDashboard,bt=[{type:"publicAcknowledgment",description:"Your entire dashboard will be public*",testId:xt.WillBePublicCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/dashboards/dashboard-public/",tooltip:"Learn more about public dashboards"}},{type:"dataSourcesAcknowledgment",description:"Publishing currently only works with a subset of data sources*",testId:xt.LimitedDSCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/datasources/",tooltip:"Learn more about public datasources"}},{type:"usageAcknowledgment",description:"Making a dashboard public will cause queries to run each time is viewed, which may increase costs*",testId:xt.CostIncreaseCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/enterprise/query-caching/",tooltip:"Learn more about query caching"}}],Rt=({disabled:wt,register:Vt})=>{const Ht=(0,d.wW)(ct);return n.createElement(n.Fragment,null,n.createElement("p",{className:Ht.title},"Before you make the dashboard public, acknowledge the following:"),n.createElement(se.C,{disabled:wt},n.createElement(T.wc,{spacing:"md"},bt.map(Xt=>n.createElement(T.Lh,{key:Xt.type,spacing:"none",align:"center"},n.createElement(Pt.X,{...Vt(Xt.type,{required:!0}),label:Xt.description,"data-testid":Xt.testId}),n.createElement(ne.Qj,{variant:"primary",href:Xt.info.href,target:"_blank",fill:"text",icon:"info-circle",rel:"noopener noreferrer",tooltip:Xt.info.tooltip}))))))},ct=wt=>({title:(0,t.css)` font-weight: ${wt.typography.fontWeightBold}; `}),it=()=>{const wt=(0,d.wW)(me);return n.createElement("div",{className:wt.container},n.createElement("p",{className:wt.description},"Currently, we don\u2019t support template variables or frontend data sources"),n.createElement("p",{className:wt.description},"We'd love your feedback. To share, please comment on this"," ",n.createElement("a",{href:"https://github.com/grafana/grafana/discussions/49253",target:"_blank",rel:"noreferrer",className:R()("text-link",wt.description)},"GitHub discussion"),"."))},me=wt=>({container:(0,t.css)` margin-bottom: ${wt.spacing(3)}; `,description:(0,t.css)` color: ${wt.colors.text.secondary}; margin-bottom: ${wt.spacing(1)}; `}),Ee=h.wl.pages.ShareDashboardModal.PublicDashboard,Ce=({isError:wt})=>{const Vt=(0,d.wW)(Ae),Ht=x.contextSrv.hasAccess(O.AccessControlAction.DashboardsPublicWrite,(0,A.RN)()),mn=(0,O.useSelector)(aa=>aa.dashboard).getModel(),pn=(0,p.ek)(mn.panels),[Pn,{isLoading:zn}]=(0,c.zZ)(),Hn=!Ht||zn||wt,Ea=async()=>{(0,i.ff)("grafana_dashboards_public_create_clicked"),Pn({dashboard:mn,payload:{isEnabled:!0}})};return n.createElement("div",null,n.createElement("p",{className:Vt.title},"Welcome to public dashboards public preview!"),n.createElement(it,null),!Ht&&n.createElement(F,{mode:"create"}),(0,p._H)(mn.getVariables())&&n.createElement(Q,null),!!pn.length&&n.createElement(G,{unsupportedDataSources:pn.join(", ")}),n.createElement(nt.l,{onSubmit:Ea,validateOn:"onChange",maxWidth:"none"},({register:aa,formState:{isValid:na}})=>n.createElement(n.Fragment,null,n.createElement("div",{className:Vt.checkboxes},n.createElement(Rt,{disabled:Hn,register:aa})),n.createElement("div",{className:Vt.buttonContainer},n.createElement(ne.zx,{type:"submit",disabled:Hn||!na,"data-testid":Ee.CreateButton},"Generate public URL ",zn&&n.createElement(m.$,{className:Vt.loadingSpinner}))))))},Ae=wt=>({title:(0,t.css)` font-size: ${wt.typography.h4.fontSize}; margin: ${wt.spacing(0,0,2)}; `,checkboxes:(0,t.css)` margin: ${wt.spacing(0,0,4)}; `,buttonContainer:(0,t.css)` display: flex; justify-content: end; `,loadingSpinner:(0,t.css)` margin-left: ${wt.spacing(1)}; `}),ze=Ce,Ie=()=>{const wt=(0,d.wW)(Te);return n.createElement(f.L,{className:wt.loadingContainer},n.createElement(n.Fragment,null,"Loading configuration",n.createElement(m.$,{size:20,className:wt.spinner})))},xe=wt=>{const{data:Vt,isLoading:Ht,isError:Xt}=(0,c.Ym)(wt.dashboard.uid);return(0,n.useEffect)(()=>{(0,i.ff)("grafana_dashboards_public_share_viewed")},[]),n.createElement(n.Fragment,null,Ht?n.createElement(Ie,null):(0,p.Gt)(Vt)?n.createElement(tt,null):n.createElement(ze,{isError:Xt}))},Te=wt=>({loadingContainer:(0,t.css)` height: 280px; align-items: center; justify-content: center; gap: ${wt.spacing(1)}; `,spinner:(0,t.css)` margin-bottom: ${wt.spacing(0)}; `});var Oe=e(73668),ie=e(60105);const Le=({selectedTheme:wt="current",onChange:Vt})=>{const Ht=[{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 n.createElement(a.g,{label:(0,o.t)("share-modal.theme-picker.field-name","Theme")},n.createElement(ae.S,{options:Ht,value:wt,onChange:Vt}))};var Be=e(42857);class Ue extends n.PureComponent{constructor(Vt){super(Vt),this.buildIframeHtml=()=>{const{panel:Ht,dashboard:Xt}=this.props,{useCurrentTimeRange:mn,selectedTheme:pn}=this.state,Pn=(0,Be.S_)(mn,Xt.uid,pn,Ht);this.setState({iframeHtml:Pn})},this.onIframeHtmlChange=Ht=>{this.setState({iframeHtml:Ht.currentTarget.value})},this.onUseCurrentTimeRangeChange=()=>{this.setState({useCurrentTimeRange:!this.state.useCurrentTimeRange},this.buildIframeHtml)},this.onThemeChange=Ht=>{this.setState({selectedTheme:Ht},this.buildIframeHtml)},this.getIframeHtml=()=>this.state.iframeHtml,this.state={useCurrentTimeRange:!0,selectedTheme:"current",iframeHtml:""}}componentDidMount(){(0,i.ff)("grafana_dashboards_embed_share_viewed"),this.buildIframeHtml()}render(){const{useCurrentTimeRange:Vt,selectedTheme:Ht,iframeHtml:Xt}=this.state,pn=(this.props.dashboard?this.props.dashboard.time.to==="now":!1)?(0,o.t)("share-modal.embed.time-range-description","Transforms the current relative time range to an absolute time range"):"";return n.createElement(n.Fragment,null,n.createElement("p",{className:"share-modal-info-text"},n.createElement(o.cC,{i18nKey:"share-modal.embed.info"},"Generate HTML for embedding an iframe with this panel.")),n.createElement(a.g,{label:(0,o.t)("share-modal.embed.time-range","Current time range"),description:pn},n.createElement(b.r,{id:"share-current-time-range",value:Vt,onChange:this.onUseCurrentTimeRangeChange})),n.createElement(Le,{selectedTheme:Ht,onChange:this.onThemeChange}),n.createElement(a.g,{label:(0,o.t)("share-modal.embed.html","Embed HTML"),description:(0,o.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 user viewing that page need to be signed into Grafana for the graph to load.")},n.createElement(ie.K,{"data-testid":"share-embed-html",id:"share-panel-embed-embed-html-textarea",rows:5,value:Xt,onChange:this.onIframeHtmlChange})),n.createElement(r.u.ButtonRow,null,n.createElement(P.m,{icon:"copy",variant:"primary",getText:this.getIframeHtml},n.createElement(o.cC,{i18nKey:"share-modal.embed.copy"},"Copy to clipboard"))))}}var ue=e(49086),pe=e(45937),$e=e(50389),Se=e(43620),Ve=e(55925),He=e(11649);function Ze({json:wt,onDismiss:Vt}){const Ht=(0,n.useCallback)(()=>wt,[wt]);return n.createElement(r.u,{title:"JSON",onDismiss:Vt,onClickBackdrop:Vt,isOpen:!0},n.createElement(Ve.Z,{disableHeight:!0},({width:Xt})=>n.createElement(He.p,{value:wt,language:"json",showMiniMap:!1,height:"500px",width:Xt})),n.createElement(r.u.ButtonRow,null,n.createElement(P.m,{icon:"copy",getText:Ht},n.createElement(o.cC,{i18nKey:"share-modal.view-json.copy-button"},"Copy to Clipboard"))))}class Qe extends n.PureComponent{constructor(Vt){super(Vt),this.onShareExternallyChange=()=>{this.setState({shareExternally:!this.state.shareExternally})},this.onTrimDefaultsChange=()=>{this.setState({trimDefaults:!this.state.trimDefaults})},this.onSaveAsFile=()=>{const{dashboard:Ht}=this.props,{shareExternally:Xt}=this.state,{trimDefaults:mn}=this.state;Xt?this.exporter.makeExportable(Ht).then(pn=>{mn?(0,pe.i)().post("/api/dashboards/trim",{dashboard:pn}).then(Pn=>{this.openSaveAsDialog(Pn.dashboard)}):this.openSaveAsDialog(pn)}):mn?(0,pe.i)().post("/api/dashboards/trim",{dashboard:Ht.getSaveModelClone()}).then(pn=>{this.openSaveAsDialog(pn.dashboard)}):this.openSaveAsDialog(Ht.getSaveModelClone())},this.onViewJson=()=>{const{dashboard:Ht}=this.props,{shareExternally:Xt}=this.state,{trimDefaults:mn}=this.state;Xt?this.exporter.makeExportable(Ht).then(pn=>{mn?(0,pe.i)().post("/api/dashboards/trim",{dashboard:pn}).then(Pn=>{this.openJsonModal(Pn.dashboard)}):this.openJsonModal(pn)}):mn?(0,pe.i)().post("/api/dashboards/trim",{dashboard:Ht.getSaveModelClone()}).then(pn=>{this.openJsonModal(pn.dashboard)}):this.openJsonModal(Ht.getSaveModelClone())},this.openSaveAsDialog=Ht=>{const Xt=JSON.stringify(Ht,null,2),mn=new Blob([Xt],{type:"application/json;charset=utf-8"}),pn=new Date().getTime();(0,ue.saveAs)(mn,`${Ht.title}-${pn}.json`)},this.openJsonModal=Ht=>{u.h$.publish(new Se.Dn({props:{json:JSON.stringify(Ht,null,2)},component:Ze})),this.props.onDismiss?.()},this.state={shareExternally:!1,trimDefaults:!1},this.exporter=new $e.E}componentDidMount(){(0,i.ff)("grafana_dashboards_export_share_viewed")}render(){const{onDismiss:Vt}=this.props,{shareExternally:Ht}=this.state,{trimDefaults:Xt}=this.state,mn=(0,o.t)("share-modal.export.share-externally-label","Export for sharing externally"),pn=(0,o.t)("share-modal.export.share-default-label","Export with default values removed");return n.createElement(n.Fragment,null,n.createElement("p",{className:"share-modal-info-text"},n.createElement(o.cC,{i18nKey:"share-modal.export.info-text"},"Export this dashboard.")),n.createElement(a.g,{label:mn},n.createElement(b.r,{id:"share-externally-toggle",value:Ht,onChange:this.onShareExternallyChange})),y.config.featureToggles.trimDefaults&&n.createElement(a.g,{label:pn},n.createElement(b.r,{id:"trim-defaults-toggle",value:Xt,onChange:this.onTrimDefaultsChange})),n.createElement(r.u.ButtonRow,null,n.createElement(ne.zx,{variant:"secondary",onClick:Vt,fill:"outline"},n.createElement(o.cC,{i18nKey:"share-modal.export.cancel-button"},"Cancel")),n.createElement(ne.zx,{variant:"secondary",onClick:this.onViewJson},n.createElement(o.cC,{i18nKey:"share-modal.export.view-button"},"View JSON")),n.createElement(ne.zx,{variant:"primary",onClick:this.onSaveAsFile},n.createElement(o.cC,{i18nKey:"share-modal.export.save-button"},"Save to file"))))}}var rt=e(14673);const pt=({panel:wt,initialFolderUid:Vt,onDismiss:Ht})=>((0,n.useEffect)(()=>{(0,i.ff)("grafana_dashboards_library_panel_share_viewed")},[]),wt?n.createElement(n.Fragment,null,n.createElement("p",{className:"share-modal-info-text"},n.createElement(o.cC,{i18nKey:"share-modal.library.info"},"Create library panel.")),n.createElement(rt.T,{panel:wt,initialFolderUid:Vt,onDismiss:Ht})):null);var It=e(73453);class _t extends n.PureComponent{constructor(Vt){super(Vt),this.buildUrl=async()=>{const{panel:Ht,dashboard:Xt}=this.props,{useCurrentTimeRange:mn,useShortUrl:pn,selectedTheme:Pn}=this.state,zn=await(0,Be.bl)(mn,Pn,Ht,pn),Hn=(0,Be.Sc)(mn,Xt.uid,Pn,Ht);this.setState({shareUrl:zn,imageUrl:Hn})},this.onUseCurrentTimeRangeChange=()=>{this.setState({useCurrentTimeRange:!this.state.useCurrentTimeRange})},this.onUrlShorten=()=>{this.setState({useShortUrl:!this.state.useShortUrl})},this.onThemeChange=Ht=>{this.setState({selectedTheme:Ht})},this.getShareUrl=()=>this.state.shareUrl,this.state={useCurrentTimeRange:!0,useShortUrl:!1,selectedTheme:"current",shareUrl:"",imageUrl:""}}componentDidMount(){(0,i.ff)("grafana_dashboards_link_share_viewed"),this.buildUrl()}componentDidUpdate(Vt,Ht){const{useCurrentTimeRange:Xt,useShortUrl:mn,selectedTheme:pn}=this.state;(Ht.useCurrentTimeRange!==Xt||Ht.selectedTheme!==pn||Ht.useShortUrl!==mn)&&this.buildUrl()}render(){const{panel:Vt,dashboard:Ht}=this.props,Xt=Ht?Ht.time.to==="now":!1,{useCurrentTimeRange:mn,useShortUrl:pn,selectedTheme:Pn,shareUrl:zn,imageUrl:Hn}=this.state,Ea=h.wl.pages.SharePanelModal,aa=!!Ht.id,na=(0,o.t)("share-modal.link.time-range-label","Lock time range"),xa=(0,o.t)("share-modal.link.time-range-description","Transforms the current relative time range to an absolute time range"),Ca=(0,o.t)("share-modal.link.shorten-url","Shorten URL"),Ba=(0,o.t)("share-modal.link.link-url","Link URL");return n.createElement(n.Fragment,null,n.createElement("p",{className:"share-modal-info-text"},n.createElement(o.cC,{i18nKey:"share-modal.link.info-text"},"Create a direct link to this dashboard or panel, customized with the options below.")),n.createElement(se.C,null,n.createElement(a.g,{label:na,description:Xt?xa:""},n.createElement(b.r,{id:"share-current-time-range",value:mn,onChange:this.onUseCurrentTimeRangeChange})),n.createElement(Le,{selectedTheme:Pn,onChange:this.onThemeChange}),n.createElement(a.g,{label:Ca},n.createElement(b.r,{id:"share-shorten-url",value:pn,onChange:this.onUrlShorten})),n.createElement(a.g,{label:Ba},n.createElement(C.I,{id:"link-url-input",value:zn,readOnly:!0,addonAfter:n.createElement(P.m,{icon:"copy",variant:"primary",getText:this.getShareUrl},n.createElement(o.cC,{i18nKey:"share-modal.link.copy-link-button"},"Copy"))}))),Vt&&l.default.rendererAvailable&&n.createElement(n.Fragment,null,aa&&n.createElement("div",{className:"gf-form"},n.createElement("a",{href:Hn,target:"_blank",rel:"noreferrer","aria-label":Ea.linkToRenderedImage},n.createElement(It.J,{name:"camera"}),"\xA0",n.createElement(o.cC,{i18nKey:"share-modal.link.rendered-image"},"Direct link rendered image"))),!aa&&n.createElement(w.b,{severity:"info",title:(0,o.t)("share-modal.link.save-alert","Dashboard is not saved"),bottomSpacing:0},n.createElement(o.cC,{i18nKey:"share-modal.link.save-dashboard"},"To render a panel image, you must save the dashboard first."))),Vt&&!l.default.rendererAvailable&&n.createElement(w.b,{severity:"info",title:(0,o.t)("share-modal.link.render-alert","Image renderer plugin not installed"),bottomSpacing:0},n.createElement(o.cC,{i18nKey:"share-modal.link.render-instructions"},"To render a panel image, you must install the\xA0",n.createElement("a",{href:"https://grafana.com/grafana/plugins/grafana-image-renderer",target:"_blank",rel:"noopener noreferrer",className:"external-link"},"Grafana image renderer plugin"),". Please contact your Grafana administrator to install the plugin.")))}}var tn=e(59421),qt=e(73289),cn=e(28580),on=e(26858),ln=e(6230);const Un="/api/snapshots";class yt extends n.PureComponent{constructor(Vt){super(Vt),this.createSnapshot=Ht=>()=>{const{timeoutSeconds:Xt}=this.state;this.dashboard.snapshot={timestamp:new Date},this.setState({isLoading:!0}),this.dashboard.startRefresh(),setTimeout(()=>{this.saveSnapshot(this.dashboard,Ht)},Xt*1e3)},this.saveSnapshot=async(Ht,Xt)=>{const{snapshotExpires:mn}=this.state,pn=this.dashboard.getSaveModelClone();this.scrubDashboard(pn);const Pn={dashboard:pn,name:pn.title,expires:mn,external:Xt};try{const zn=await(0,qt.i)().post(Un,Pn);this.setState({deleteUrl:zn.deleteUrl,snapshotUrl:zn.url,step:2})}finally{(0,i.ff)("grafana_dashboards_snapshot_created",{location:Xt?"raintank":"local"}),this.setState({isLoading:!1})}},this.scrubDashboard=Ht=>{const{panel:Xt}=this.props,{snapshotName:mn}=this.state;Ht.title=mn,Ht.time=(0,on.$t)().timeRange(),Ht.links=[],Ht.panels.forEach(Pn=>{Pn.targets=[],Pn.links=[],Pn.datasource=null});const pn=Ht.annotations.list.filter(Pn=>Pn.enable);if(Ht.annotations.list=pn.map(Pn=>({name:Pn.name,enable:Pn.enable,iconColor:Pn.iconColor,snapshotData:Pn.snapshotData,type:Pn.type,builtIn:Pn.builtIn,hide:Pn.hide})),Ht.getVariables().forEach(Pn=>{"query"in Pn&&(Pn.query=""),"options"in Pn&&(Pn.options=Pn.current&&!(0,tn.Q)(Pn.current)?[Pn.current]:[]),"refresh"in Pn&&(Pn.refresh=ln.Bd.never)}),Xt){const Pn=Xt.getSaveModel();Pn.gridPos.w=24,Pn.gridPos.x=0,Pn.gridPos.y=0,Pn.gridPos.h=20,Ht.panels=[Pn]}delete this.dashboard.snapshot,this.dashboard.forEachPanel(Pn=>{delete Pn.snapshotData}),this.dashboard.annotations.list.forEach(Pn=>{delete Pn.snapshotData})},this.deleteSnapshot=async()=>{const{deleteUrl:Ht}=this.state;await(0,qt.i)().get(Ht),this.setState({step:3})},this.getSnapshotUrl=()=>this.state.snapshotUrl,this.onSnapshotNameChange=Ht=>{this.setState({snapshotName:Ht.target.value})},this.onTimeoutChange=Ht=>{this.setState({timeoutSeconds:Number(Ht.target.value)})},this.onExpireChange=Ht=>{this.setState({selectedExpireOption:Ht,snapshotExpires:Ht.value})},this.dashboard=Vt.dashboard,this.expireOptions=[{label:(0,o.t)("share-modal.snapshot.expire-never","Never"),value:0},{label:(0,o.t)("share-modal.snapshot.expire-hour","1 Hour"),value:60*60},{label:(0,o.t)("share-modal.snapshot.expire-day","1 Day"),value:60*60*24},{label:(0,o.t)("share-modal.snapshot.expire-week","7 Days"),value:60*60*24*7}],this.state={isLoading:!1,step:1,selectedExpireOption:this.expireOptions[0],snapshotExpires:this.expireOptions[0].value,snapshotName:Vt.dashboard.title,timeoutSeconds:4,snapshotUrl:"",deleteUrl:"",externalEnabled:!1,sharingButtonText:""}}componentDidMount(){(0,i.ff)("grafana_dashboards_snapshot_share_viewed"),this.getSnaphotShareOptions()}async getSnaphotShareOptions(){const Vt=await(0,qt.i)().get("/api/snapshot/shared-options");this.setState({sharingButtonText:Vt.externalSnapshotName,externalEnabled:Vt.externalEnabled})}renderStep1(){const{onDismiss:Vt}=this.props,{snapshotName:Ht,selectedExpireOption:Xt,timeoutSeconds:mn,isLoading:pn,sharingButtonText:Pn,externalEnabled:zn}=this.state,Hn=(0,o.t)("share-modal.snapshot.name","Snapshot name"),Ea=(0,o.t)("share-modal.snapshot.expire","Expire"),aa=(0,o.t)("share-modal.snapshot.timeout","Timeout (seconds)"),na=(0,o.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 n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement("p",{className:"share-modal-info-text"},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.info-text-1"},"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.")),n.createElement("p",{className:"share-modal-info-text"},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.info-text-2"},"Keep in mind, your snapshot ",n.createElement("em",null,"can be viewed by anyone")," that has the link and can access the URL. Share wisely."))),n.createElement(a.g,{label:Hn},n.createElement(C.I,{id:"snapshot-name-input",width:30,value:Ht,onChange:this.onSnapshotNameChange})),n.createElement(a.g,{label:Ea},n.createElement(cn.Ph,{inputId:"expire-select-input",width:30,options:this.expireOptions,value:Xt,onChange:this.onExpireChange})),n.createElement(a.g,{label:aa,description:na},n.createElement(C.I,{id:"timeout-input",type:"number",width:21,value:mn,onChange:this.onTimeoutChange})),n.createElement(r.u.ButtonRow,null,n.createElement(ne.zx,{variant:"secondary",onClick:Vt,fill:"outline"},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.cancel-button"},"Cancel")),zn&&n.createElement(ne.zx,{variant:"secondary",disabled:pn,onClick:this.createSnapshot(!0)},Pn),n.createElement(ne.zx,{variant:"primary",disabled:pn,onClick:this.createSnapshot()},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.local-button"},"Local Snapshot"))))}renderStep2(){const{snapshotUrl:Vt}=this.state;return n.createElement(n.Fragment,null,n.createElement(a.g,{label:(0,o.t)("share-modal.snapshot.url-label","Snapshot URL")},n.createElement(C.I,{id:"snapshot-url-input",value:Vt,readOnly:!0,addonAfter:n.createElement(P.m,{icon:"copy",variant:"primary",getText:this.getSnapshotUrl},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.copy-link-button"},"Copy"))})),n.createElement("div",{className:"pull-right",style:{padding:"5px"}},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.mistake-message"},"Did you make a mistake? "),"\xA0",n.createElement(ne.Qj,{fill:"text",target:"_blank",onClick:this.deleteSnapshot},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.delete-button"},"Delete snapshot."))))}renderStep3(){return n.createElement("div",{className:"share-modal-header"},n.createElement("p",{className:"share-modal-info-text"},n.createElement(o.cC,{i18nKey:"share-modal.snapshot.deleted-message"},"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:Vt,step:Ht}=this.state;return n.createElement(n.Fragment,null,Ht===1&&this.renderStep1(),Ht===2&&this.renderStep2(),Ht===3&&this.renderStep3(),Vt&&n.createElement(m.$,{inline:!0}))}}const ft=[],Tt=[];function Bt(wt){ft.push(wt)}function Nt(wt){Tt.push(wt)}function Ft(wt,Vt){const Xt=[{label:(0,o.t)("share-modal.tab-title.link","Link"),value:"link",component:_t}];if(u.Vt.isSignedIn&&l.config.snapshotEnabled){const pn=(0,o.t)("share-modal.tab-title.snapshot","Snapshot");Xt.push({label:pn,value:"snapshot",component:yt})}if(wt){const pn=(0,o.t)("share-modal.tab-title.embed","Embed");if(Xt.push({label:pn,value:"embed",component:Ue}),!(0,Oe.V)(wt)){const Pn=(0,o.t)("share-modal.tab-title.library-panel","Library panel");Xt.push({label:Pn,value:"library_panel",component:pt})}Xt.push(...Tt)}else{const pn=(0,o.t)("share-modal.tab-title.export","Export");Xt.push({label:pn,value:"export",component:Qe}),Xt.push(...ft)}l.config.featureToggles.publicDashboards&&Xt.push({label:"Public dashboard",value:"public-dashboard",component:xe});const mn=Xt.find(pn=>pn.value===Vt);return{tabs:Xt,activeTab:mn?.value??Xt[0].value}}function Gt(wt){const{tabs:Vt,activeTab:Ht}=Ft(wt.panel,wt.activeTab);return{tabs:Vt,activeTab:Ht}}class dn extends n.Component{constructor(Vt){super(Vt),this.onSelectTab=Ht=>{this.setState(Xt=>({...Xt,activeTab:Ht.value}))},this.state=Gt(Vt)}componentDidMount(){(0,i.ff)("grafana_dashboards_share_modal_viewed")}getActiveTab(){const{tabs:Vt,activeTab:Ht}=this.state;return Vt.find(Xt=>Xt.value===Ht)}renderTitle(){const{panel:Vt}=this.props,{activeTab:Ht}=this.state,Xt=Vt?(0,o.t)("share-modal.panel.title","Share Panel"):(0,o.t)("share-modal.dashboard.title","Share"),mn=Ft(this.props.panel,this.state.activeTab).tabs;return n.createElement(s.H,{title:Xt,icon:"share-alt",tabs:mn,activeTab:Ht,onChangeTab:this.onSelectTab})}render(){const{dashboard:Vt,panel:Ht,theme:Xt}=this.props,mn=Bn(Xt),Pn=this.getActiveTab().component;return n.createElement(r.u,{isOpen:!0,title:this.renderTitle(),onDismiss:this.props.onDismiss,className:mn.container,contentClassName:mn.content},n.createElement(g.I,null,n.createElement(Pn,{dashboard:Vt,panel:Ht,onDismiss:this.props.onDismiss})))}}const sn=(0,d.HE)(dn),Bn=wt=>({container:(0,t.css)({label:"shareModalContainer",paddingTop:wt.spacing(1)}),content:(0,t.css)({label:"shareModalContent",padding:wt.spacing(3,2,2,2)})})},42857:(j,I,e)=>{"use strict";e.d(I,{OS:()=>u,S_:()=>p,Sc:()=>c,bl:()=>o});var t=e(76305),n=e(78968),i=e(94469),s=e(99633),r=e(34667),g=e(82146),d=e(26858);function l({useCurrentTimeRange:E,selectedTheme:h,panel:y,search:v=window.location.search,range:D=(0,d.$t)().timeRange(),orgId:a=r.config.bootData.user.orgId}){const C=new URLSearchParams(v),P=y?.timeFrom;if(P){const{from:b,to:M}=t.describeTextRange(P);C.set("from",b),C.set("to",M)}else C.set("from",String(D.from.valueOf())),C.set("to",String(D.to.valueOf()));return C.set("orgId",String(a)),E||(C.delete("from"),C.delete("to")),h!=="current"&&C.set("theme",h),y&&!C.has("editPanel")&&C.set("viewPanel",String(y.id)),C}function u(){let E=window.location.href;const h=E.indexOf("?");return h!==-1&&(E=E.substring(0,h)),E}async function o(E,h,y,v){const D=u(),a=l({useCurrentTimeRange:E,selectedTheme:h,panel:y}),C=n.Cj.appendQueryToUrl(D,a.toString());return v?await(0,g.D)(C):C}function m(E,h,y,v){const D=u(),a=l({useCurrentTimeRange:E,selectedTheme:y,panel:v});let C=D.replace(r.config.appSubUrl+"/dashboard/",r.config.appSubUrl+"/dashboard-solo/");C=C.replace(r.config.appSubUrl+"/d/",r.config.appSubUrl+"/d-solo/"),i.u.stripBaseFromUrl(D)==="/"&&(C=`${r.config.appUrl}d-solo/${h}`);const b=a.get("editPanel")??a.get("viewPanel")??"";return a.set("panelId",b),a.delete("editPanel"),a.delete("viewPanel"),n.Cj.appendQueryToUrl(C,a.toString())}function c(E,h,y,v){let a=m(E,h,y,v).replace(r.config.appSubUrl+"/dashboard-solo/",r.config.appSubUrl+"/render/dashboard-solo/");return a=a.replace(r.config.appSubUrl+"/d-solo/",r.config.appSubUrl+"/render/d-solo/"),a+="&width=1000&height=500"+f(),a}function p(E,h,y,v){return'<iframe src="'+m(E,h,y,v)+'" width="450" height="200" frameborder="0"></iframe>'}function f(){const E="&tz=UTC"+encodeURIComponent((0,s.CQ)().format("Z"));if(!window.Intl)return E;const h=window.Intl.DateTimeFormat();if(!h.resolvedOptions)return E;const y=h.resolvedOptions();return y.timeZone?"&tz="+encodeURIComponent(y.timeZone):E}},60195:(j,I,e)=>{"use strict";e.d(I,{B:()=>c});var t=e(42844),n=e(89949),i=e(27702),s=e(66310),r=e(73453);const g=({diff:f})=>{const E=(0,s.wW)(d),h=!(0,n.isUndefined)(f.originalValue)&&!(0,n.isArray)(f.originalValue)&&!(0,n.isObject)(f.originalValue),y=!(0,n.isUndefined)(f.value)&&!(0,n.isArray)(f.value)&&!(0,n.isObject)(f.value);return i.createElement(i.Fragment,null,h&&i.createElement("span",{className:E},String(f.originalValue)),h&&y?i.createElement(r.J,{name:"arrow-right"}):null,y&&i.createElement("span",{className:E},String(f.value)))},d=f=>(0,t.css)` background-color: ${f.colors.action.hover}; border-radius: ${f.shape.borderRadius()}; color: ${f.colors.text.primary}; font-size: ${f.typography.body.fontSize}; margin: 0 ${f.spacing(.5)}; padding: ${f.spacing(.5,1)}; `;var l=e(3323);const u={op:"replace",originalValue:void 0,path:[""],value:void 0,startLineNumber:0},o=({diff:f,title:E})=>{const h=(0,s.wW)(m);return f?i.createElement(i.Fragment,null,i.createElement(r.J,{type:"mono",name:"circle",className:h[f.op]})," ",i.createElement("span",{className:h.embolden},E)," ",i.createElement("span",null,(0,l.dW)(f,f.path.length>1))," ",i.createElement(g,{diff:f})):i.createElement("div",{className:h.withoutDiff},i.createElement(r.J,{type:"mono",name:"circle",className:h.replace})," ",i.createElement("span",{className:h.embolden},E)," ",i.createElement("span",null,(0,l.dW)(u,!1)))},m=f=>({embolden:(0,t.css)` font-weight: ${f.typography.fontWeightBold}; `,add:(0,t.css)` color: ${f.colors.success.main}; `,replace:(0,t.css)` color: ${f.colors.success.main}; `,move:(0,t.css)` color: ${f.colors.success.main}; `,copy:(0,t.css)` color: ${f.colors.success.main}; `,_get:(0,t.css)` color: ${f.colors.success.main}; `,test:(0,t.css)` color: ${f.colors.success.main}; `,remove:(0,t.css)` color: ${f.colors.success.main}; `,withoutDiff:(0,t.css)` margin-bottom: ${f.spacing(2)}; `}),c=({diffs:f,title:E})=>{const h=(0,s.wW)(p);return f.length===1?i.createElement("div",{className:h.container,"data-testid":"diffGroup"},i.createElement(o,{title:E,diff:f[0]})):i.createElement("div",{className:h.container,"data-testid":"diffGroup"},i.createElement(o,{title:E}),i.createElement("ul",{className:h.list},f.map((y,v)=>i.createElement("li",{className:h.listItem,key:`${(0,n.last)(y.path)}__${v}`},i.createElement("span",null,(0,l.dW)(y))," ",i.createElement(g,{diff:y})))))},p=f=>({container:(0,t.css)` background-color: ${f.colors.background.secondary}; font-size: ${f.typography.h6.fontSize}; margin-bottom: ${f.spacing(2)}; padding: ${f.spacing(2)}; `,list:(0,t.css)` margin-left: ${f.spacing(4)}; `,listItem:(0,t.css)` margin-bottom: ${f.spacing(1)}; `})},18475:(j,I,e)=>{"use strict";e.d(I,{Z:()=>d});var t=e(42844),n=e(27702),i=e(7698),s=e.n(i),r=e(71685),g=e(66310);const d=({oldValue:l,newValue:u})=>{const o=(0,g.l4)(),m={variables:{dark:{diffViewerBackground:o.colors.background.canvas,diffViewerColor:o.colors.text.primary,addedBackground:(0,r.Z)(o.v1.palette.greenShade).setAlpha(.3).toString(),addedColor:"white",removedBackground:(0,r.Z)(o.v1.palette.redShade).setAlpha(.3).toString(),removedColor:"white",wordAddedBackground:(0,r.Z)(o.v1.palette.greenBase).setAlpha(.4).toString(),wordRemovedBackground:(0,r.Z)(o.v1.palette.redBase).setAlpha(.4).toString(),addedGutterBackground:(0,r.Z)(o.v1.palette.greenShade).setAlpha(.2).toString(),removedGutterBackground:(0,r.Z)(o.v1.palette.redShade).setAlpha(.2).toString(),gutterBackground:o.colors.background.primary,gutterBackgroundDark:o.colors.background.primary,highlightBackground:(0,r.Z)(o.colors.primary.main).setAlpha(.4).toString(),highlightGutterBackground:(0,r.Z)(o.colors.primary.shade).setAlpha(.2).toString(),codeFoldGutterBackground:o.colors.background.secondary,codeFoldBackground:o.colors.background.secondary,emptyLineBackground:o.colors.background.secondary,gutterColor:o.colors.text.disabled,addedGutterColor:o.colors.text.primary,removedGutterColor:o.colors.text.primary,codeFoldContentColor:o.colors.text.disabled,diffViewerTitleBackground:o.colors.background.secondary,diffViewerTitleColor:o.colors.text.disabled,diffViewerTitleBorderColor:o.colors.border.strong}},codeFold:{fontSize:o.typography.bodySmall.fontSize},gutter:` pre { color: ${(0,r.Z)(o.colors.text.disabled).setAlpha(1).toString()}; opacity: 0.61; } `};return n.createElement("div",{className:(0,t.css)` font-size: ${o.typography.bodySmall.fontSize}; // prevent global styles interfering with diff viewer pre { all: revert; } `},n.createElement(s(),{styles:m,oldValue:l,newValue:u,splitView:!1,compareMethod:i.DiffMethod.CSS,useDarkTheme:o.isDark}))}},7942:(j,I,e)=>{"use strict";e.d(I,{U$:()=>F,Cs:()=>T,Sd:()=>C,R1:()=>B,K8:()=>s});var t=e(89949),n=e(73289);class i{getHistoryList(R,_){const G=R&&R.uid?R.uid:void 0;return G?(0,n.i)().get(`api/dashboards/uid/${G}/versions`,_):Promise.resolve([])}getDashboardVersion(R,_){return(0,n.i)().get(`api/dashboards/uid/${R}/versions/${_}`)}restoreDashboard(R,_){const G=R&&R.uid?R.uid:void 0,Y=`api/dashboards/uid/${G}/restore`;return G&&(0,t.isNumber)(_)?(0,n.i)().post(Y,{version:_}):Promise.resolve({})}}const s=new i;var r=e(42844),g=e(27702),d=e(83967),l=e(65333),u=e(60729),o=e(66670),m=e(3613),c=e(26811),p=e(94469),f=e(26129),E=e(73807),h=e(18771),y=e(284);const v=async(H,R)=>(y.H.ignoreNextSave(),await s.restoreDashboard(R,H)),D=H=>{const R=(0,h.useSelector)(X=>X.dashboard.getModel()),[_,G]=(0,c.Z)(async()=>await v(H,R),[]),Y=(0,E.iG)();return(0,g.useEffect)(()=>{if(_.value){const X=f.E1.getLocation(),Q=p.u.stripBaseFromUrl(_.value.url),se=X.state?.routeReloadCounter;f.E1.replace({...X,pathname:Q,state:{routeReloadCounter:se?se+1:1}}),Y.success("Dashboard restored",`Restored from version ${H}`)}},[_,H,Y]),{state:_,onRestoreDashboard:G}},a=({hideModal:H,version:R})=>{const{state:_,onRestoreDashboard:G}=D(R);return(0,g.useEffect)(()=>{!_.loading&&_.value&&H()},[_,H]),g.createElement(m.s,{isOpen:!0,title:"Restore Version",icon:"history",onDismiss:H,onConfirm:G,body:g.createElement("p",null,"Are you sure you want to restore the dashboard to version ",R,"? All unsaved changes will be lost."),confirmText:`Yes, restore to version ${R}`})},C=({versions:H,canCompare:R,onCheck:_})=>g.createElement("table",{className:"filter-table gf-form-group"},g.createElement("thead",null,g.createElement("tr",null,g.createElement("th",{className:"width-4"}),g.createElement("th",{className:"width-4"},"Version"),g.createElement("th",{className:"width-14"},"Date"),g.createElement("th",{className:"width-10"},"Updated by"),g.createElement("th",null,"Notes"),g.createElement("th",null))),g.createElement("tbody",null,H.map((G,Y)=>g.createElement("tr",{key:G.id},g.createElement("td",null,g.createElement(d.X,{"aria-label":`Toggle selection of version ${G.version}`,className:(0,r.css)` display: inline; `,checked:G.checked,onChange:X=>_(X,G.id),disabled:!G.checked&&R})),g.createElement("td",null,G.version),g.createElement("td",null,G.createdDateString),g.createElement("td",null,G.createdBy),g.createElement("td",null,G.message),g.createElement("td",{className:"text-right"},Y===0?g.createElement(l.V,{name:"Latest",colorIndex:17}):g.createElement(u.JY,null,({showModal:X,hideModal:Q})=>g.createElement(o.zx,{variant:"secondary",size:"sm",icon:"history",onClick:()=>{X(a,{version:G.version,hideModal:Q})}},"Restore")))))));var P=e(66310),b=e(67437),M=e(73453);const T=({onClick:H=t.noop,baseVersion:R=0,newVersion:_=0,isNewLatest:G=!1})=>{const Y=(0,P.wW)(S);return g.createElement("h3",{className:Y.header},g.createElement(b.h,{name:"arrow-left",size:"xl",onClick:H,tooltip:"Reset version"}),g.createElement("span",null,"Comparing ",R," ",g.createElement(M.J,{name:"arrows-h"})," ",_," ",G&&g.createElement("cite",{className:"muted"},"(Latest)")))},S=H=>({header:(0,r.css)` font-size: ${H.typography.h3.fontSize}; display: flex; gap: ${H.spacing(2)}; margin-bottom: ${H.spacing(3)}; `});var x=e(23852),O=e(80011);const B=({hasMore:H,canCompare:R,getVersions:_,getDiff:G,isLastPage:Y})=>g.createElement(x.K,null,H&&g.createElement(o.zx,{type:"button",onClick:()=>_(!0),variant:"secondary",disabled:Y},"Show more versions"),g.createElement(O.u,{content:"Select two versions to start comparing",placement:"bottom"},g.createElement(o.zx,{type:"button",disabled:!R,onClick:G,icon:"code-branch"},"Compare versions")));var A=e(64022),V=e(62499),W=e(60195),w=e(18475),N=e(3323);const F=({baseInfo:H,newInfo:R,diffData:_,isNewLatest:G})=>{const Y=(0,N.Q$)(_.lhs,_.rhs),X=(0,P.wW)(k);return g.createElement("div",null,g.createElement("div",{className:X.spacer},g.createElement(A.Lh,{justify:"space-between",align:"center"},g.createElement("div",null,g.createElement("p",{className:X.versionInfo},g.createElement("strong",null,"Version ",R.version)," updated by ",R.createdBy," ",R.ageString," -"," ",R.message),g.createElement("p",{className:(0,r.cx)(X.versionInfo,X.noMarginBottom)},g.createElement("strong",null,"Version ",H.version)," updated by ",H.createdBy," ",H.ageString," -"," ",H.message)),G&&g.createElement(u.JY,null,({showModal:Q,hideModal:se})=>g.createElement(o.zx,{variant:"destructive",icon:"history",onClick:()=>{Q(a,{version:H.version,hideModal:se})}},"Restore to version ",H.version)))),g.createElement("div",{className:X.spacer},Object.entries(Y).map(([Q,se])=>g.createElement(W.B,{diffs:se,key:Q,title:Q}))),g.createElement(V.s,{isOpen:!1,label:"View JSON Diff"},g.createElement(w.Z,{oldValue:JSON.stringify(_.lhs,null,2),newValue:JSON.stringify(_.rhs,null,2)})))},k=H=>({spacer:(0,r.css)` margin-bottom: ${H.spacing(4)}; `,versionInfo:(0,r.css)` color: ${H.colors.text.secondary}; font-size: ${H.typography.bodySmall.fontSize}; `,noMarginBottom:(0,r.css)` margin-bottom: 0; `})},3323:(j,I,e)=>{"use strict";e.d(I,{Q$:()=>r,dW:()=>g});var t=e(38063),n=e(85885),i=e(89949),s=e.n(i);const r=(u,o)=>{const m=(0,t.qu)(u,o),c=n.stringify(u,null,2),p=n.stringify(o,null,2),f=y=>y.map(v=>{let D,a,C=0;const P=(0,i.tail)(v.path.split("/"));return v.op==="replace"&&(D=(0,i.get)(u,P),a=v.value,C=p.pointers[v.path].value.line),v.op==="add"&&(a=v.value,C=p.pointers[v.path].value.line),v.op==="remove"&&(D=(0,i.get)(u,P),C=c.pointers[v.path].value.line),{op:v.op,value:a,path:P,originalValue:D,startLineNumber:C}}),E=y=>(0,i.sortBy)(y,"startLineNumber"),h=y=>y.reduce((v,D)=>{const a=D.path[0];return v[a]||(v[a]=[]),v[a].push(D),v},{});return(0,i.flow)([f,E,h])(m)},g=(u,o=!0)=>{const m=(0,i.last)(u.path),c=d(m),p=u.op==="remove"?u.originalValue:u.value;let f=l(u.op);return o&&(c?f+=` item ${m}`:(0,i.isArray)(p)&&!(0,i.isEmpty)(p)?f+=` ${p.length} ${m}`:f+=` ${m}`),f},d=u=>!(0,i.isNaN)((0,i.toNumber)(u)),l=u=>u==="add"?"added":u==="remove"?"deleted":"changed"},87909:(j,I,e)=>{"use strict";e.d(I,{A:()=>l});var t=e(88646),n=e(99633),i=e(1726);const s=100;class r{constructor(){this.listeners=[],this.budget=1,this.threshold=1.5,this.ok=new t.X(!0),this.lastUpdate=Date.now(),this.isLive=!1,this.liveTimeOffset=0,this.measure=()=>{const o=Date.now();this.budget=(o-this.lastUpdate)/s;const m=this.ok.getValue(),c=this.budget<=this.threshold;if(m!==c&&this.ok.next(c),this.lastUpdate=o,this.isLive&&this.ok.getValue()&&this.timeRange){let p;for(const f of this.listeners){if(!f.panel.props.isInView)continue;if(o-f.last>=f.intervalMs){if(!p){const{raw:h}=this.timeRange;p={raw:h,from:(0,n.CQ)(o-this.liveTimeOffset),to:(0,n.CQ)(o)}}f.panel.liveTimeChanged(p),f.last=o}}}}}setLiveTimeRange(o){if(this.timeRange=o,this.isLive=o?.raw?.to==="now",this.isLive){const m=i.parse(o.raw.from,!1)?.valueOf(),c=i.parse(o.raw.to,!0)?.valueOf();this.liveTimeOffset=c-m;for(const p of this.listeners)p.intervalMs=d(this.liveTimeOffset,p.panel.props.width)}}listen(o){this.listeners.push({last:this.lastUpdate,panel:o,intervalMs:d(6e4,o.props.width)})}remove(o){this.listeners=this.listeners.filter(m=>m.panel!==o)}updateInterval(o){if(!(!this.timeRange||!this.isLive)){for(const m of this.listeners)if(m.panel===o){m.intervalMs=d(this.liveTimeOffset,m.panel.props.width);return}}}}const g=5*60*1e3;function d(u,o){const m=Math.ceil(u/o/100)*100;return m>g?g:m}const l=new r;setInterval(l.measure,s)},46823:(j,I,e)=>{"use strict";e.d(I,{Bg:()=>y,pD:()=>v});var t=e(7610),n=e.n(t),i=e(89949),s=e.n(i),r=e(79913),g=e.n(r),d=e(3935),l=e(1726),u=e(73289),o=e(26129),m=e(45937),c=e(6872),p=e(13216),f=e(5926),E=e(66574),h=e(75261);class y{constructor(){}_dashboardLoadFailed(C,P){return P=P||!1,{meta:{canStar:!1,isSnapshot:P,canDelete:!1,canSave:!1,canEdit:!1,dashboardNotFound:!0},dashboard:{title:C}}}loadDashboard(C,P,b){let M;if(C==="script"&&P)M=this._loadScriptedDashboard(P);else if(C==="snapshot"&&P)M=m.ae.get("/api/snapshots/"+P).catch(()=>this._dashboardLoadFailed("Snapshot not found",!0));else if(C==="ds"&&P)M=this._loadFromDatasource(P);else if(C==="public"&&b)M=m.ae.getPublicDashboardByUid(b).then(T=>T).catch(T=>{const S=T.data.statusCode===403&&T.data.messageId==="publicdashboards.notEnabled",x=T.data.statusCode===404&&T.data.messageId==="publicdashboards.notFound",O=this._dashboardLoadFailed(S?"Public Dashboard paused":"Public Dashboard Not found",!0);return{...O,meta:{...O.meta,publicDashboardEnabled:x?void 0:!S,dashboardNotFound:x}}});else if(b)M=m.ae.getDashboardByUid(b).then(T=>{if(T.meta.isFolder)throw E.h$.emit(d.SI.alertError,["Dashboard not found"]),new Error("Dashboard not found");return T}).catch(()=>this._dashboardLoadFailed("Not found",!0));else throw new Error("Dashboard uid or slug required");return M.then(T=>(T.meta.dashboardNotFound!==!0&&c.Z.addDashboardImpression(T.dashboard.uid),T)),M}_loadScriptedDashboard(C){const P="public/dashboards/"+C.replace(/\.(?!js)/,"/")+"?"+new Date().getTime();return(0,u.i)().get(P).then(this._executeScript.bind(this)).then(b=>({meta:{fromScript:!0,canDelete:!1,canSave:!1,canStar:!1},dashboard:b.data}),b=>(console.error("Script dashboard error "+b),E.h$.emit(d.SI.alertError,["Script Error","Please make sure it exists and returns a valid dashboard"]),this._dashboardLoadFailed("Scripted dashboard")))}async _loadFromDatasource(C){const P=await(0,f.ak)().get(C);if(!P)return Promise.reject("can not find datasource: "+C);const b=new URLSearchParams(window.location.search),M=b.get("path");if(!M)return Promise.reject("expecting path parameter");const T={};return b.forEach((S,x)=>{T[x]=S}),(0,u.i)().get(`/api/datasources/uid/${P.uid}/resources/${M}`,T).then(S=>({meta:{fromScript:!0,canDelete:!1,canSave:!1,canStar:!1},dashboard:S}))}_executeScript(C){const P={dashboardSrv:(0,h.h4)(),datasourceSrv:(0,f.ak)()},M=new Function("ARGS","kbn","dateMath","_","moment","window","document","$","jQuery","services",C)(o.E1.getSearchObject(),p.Z,l,s(),g(),window,document,n(),n(),P);return(0,i.isFunction)(M)?new Promise(T=>{M(S=>{T({data:S})})}):{data:M}}}let v=new y;const D=a=>{throw new Error("dashboardLoaderSrv can be only overriden in test environment")}},75261:(j,I,e)=>{"use strict";e.d(I,{h4:()=>p});var t=e(78209),n=e(3935),i=e(5933),s=e(65322),r=e(45937),g=e(77799),d=e(43620),l=e(85991),u=e(22377);class o{constructor(){this.onRemovePanel=E=>{const h=this.getCurrent();h&&(0,u.WJ)(h,h.getPanelById(E),!0)},i.h.subscribe(d.Eb,E=>this.onRemovePanel(E.payload))}create(E,h){return new l.f(E,h)}setCurrent(E){this.dashboard=E}getCurrent(){return this.dashboard}saveJSONDashboard(E){const h=JSON.parse(E);return(0,g.uC)({dashboard:h,folderUid:this.dashboard?.meta.folderUid||h.folderUid})}saveDashboard(E,h){return(0,t.n)((0,r.i)().fetch({url:"/api/dashboards/db/",method:"POST",data:{...E,dashboard:E.dashboard.getSaveModelClone()},...h}))}starDashboard(E,h){const y=(0,r.i)(),v={showSuccessAlert:!1,url:"/api/user/stars/dashboard/uid/"+E,method:h?"DELETE":"POST"};return y.request(v).then(()=>{const D=!h;this.dashboard?.uid===E&&(this.dashboard.meta.isStarred=D);const a=D?(0,s.t)("notifications.starred-dashboard","Dashboard starred"):(0,s.t)("notifications.unstarred-dashboard","Dashboard unstarred");return i.h.emit(n.SI.alertSuccess,[a]),D})}}let m;function c(f){m=f}function p(){return m||(m=new o),m}},71183:(j,I,e)=>{"use strict";e.d(I,{Qi:()=>c,lh:()=>f});var t=e(45383),n=e(91053),i=e(90996),s=e(56469),r=e(68246),g=e(32053),d=e(73289),l=e(35306),u=e(89050),o=e(32159),m=e(22513);const c="-- Public --",p="1min";class f extends r.MF{constructor(h){let y={};f.isMixedDatasource(h)&&(y.mixed=!0),super({name:"public-ds",id:0,type:"public-ds",meta:y,uid:f.resolveUid(h),jsonData:{},access:"proxy",readOnly:!0}),this.interval=f.resolveInterval(h),this.annotations={prepareQuery(v){return{...v,queryType:u.hR.Annotations,refId:"anno"}}}}static resolveUid(h){return typeof h=="string"?h:h?.uid??c}static isMixedDatasource(h){return typeof h=="string"||h==null?!1:h?.uid===o.D}static resolveInterval(h){return typeof h=="string"||h==null?p:("interval"in h?h.interval:void 0)??p}query(h){const{intervalMs:y,maxDataPoints:v,requestId:D,publicDashboardAccessToken:a,panelId:C,queryCachingTTL:P,range:{from:b,to:M}}=h;let T;if(!h.targets.length)return(0,t.of)({data:[]});const S=h.targets[0];if(S.queryType===u.hR.Annotations)return S?.datasource?.uid===m.JY?(0,n.D)(this.getAnnotations(h)):(0,t.of)({data:[]});{const x={intervalMs:y,maxDataPoints:v,queryCachingTTL:P,timeRange:{from:b.valueOf().toString(),to:M.valueOf().toString(),timezone:this.getBrowserTimezone()}};return(0,d.i)().fetch({url:`/api/public/dashboards/${a}/panels/${C}/query`,method:"POST",data:x,requestId:D}).pipe((0,i.w)(O=>(0,t.of)((0,l.z1)(O,T))),(0,s.K)(O=>(0,t.of)((0,l.z1)(O))))}}async getAnnotations(h){const{publicDashboardAccessToken:y,range:{to:v,from:D}}=h,a={from:D.valueOf(),to:v.valueOf()},C=y?await(0,d.i)().get(`/api/public/dashboards/${y}/annotations`,a):[];return{data:[(0,g.g0)(C)]}}testDatasource(){return Promise.resolve({message:"",status:""})}getBrowserTimezone(){return window.Intl?.DateTimeFormat().resolvedOptions()?.timeZone||""}}},26858:(j,I,e)=>{"use strict";e.d(I,{$t:()=>v});var t=e(89949),n=e(99633),i=e(8508),s=e(76305),r=e(1726),g=e(26129),d=e(5933),l=e(12308),u=e(91368),o=e(15476),m=e(56074),c=e(43620),p=e(26862);function f({urlRefresh:D,currentRefresh:a,isAllowedIntervalFn:C,minRefreshInterval:P,refreshIntervals:b=p.o5}){if(!D)return a;const M=C(D),T=b.find(S=>S===D);if(!M||!T){const S=P?b.find(O=>O===P):void 0,x=b?.length?b[0]:void 0;return S??x??a}return D||a}class E{constructor(a){this.contextSrv=a,this.timeRangeForUrl=()=>{const C=this.timeRange().raw;return(0,n.v9)(C.from)&&(C.from=C.from.valueOf().toString()),(0,n.v9)(C.to)&&(C.to=C.to.valueOf().toString()),C},this.time=(0,i.JK)().raw,this.timeAtLoad=(0,i.JK)().raw,this.refreshTimeModel=this.refreshTimeModel.bind(this),d.Z.subscribe(c.p8,C=>{this.zoomOut(C.payload.scale,C.payload.updateUrl)}),d.Z.subscribe(c.Qt,C=>{this.shiftTime(C.payload.direction,C.payload.updateUrl)}),d.Z.subscribe(c.QI,C=>{this.makeAbsoluteTime(C.payload.updateUrl)}),document.addEventListener("visibilitychange",()=>{this.autoRefreshBlocked&&document.visibilityState==="visible"&&(this.autoRefreshBlocked=!1,this.refreshTimeModel())})}init(a){this.timeModel=a,this.time=a.time,this.refresh=a.refresh,this.initTimeFromUrl(),this.parseTime(),this.timeAtLoad=(0,t.cloneDeep)(this.time);const C=s.convertRawToRange(this.time,this.timeModel?.getTimezone(),this.timeModel?.fiscalYearStartMonth);C.to.isBefore(C.from)&&this.setTime({from:C.raw.to,to:C.raw.from},!1),this.refresh&&this.setAutoRefresh(this.refresh)}getValidIntervals(a){return this.contextSrv.minRefreshInterval?a.filter(C=>C!=="").filter(this.contextSrv.isAllowedInterval):a}parseTime(){(0,t.isString)(this.time.from)&&this.time.from.indexOf("Z")>=0&&(this.time.from=(0,n.CQ)(this.time.from).utc()),(0,t.isString)(this.time.to)&&this.time.to.indexOf("Z")>=0&&(this.time.to=(0,n.CQ)(this.time.to).utc())}parseUrlParam(a){if(a.indexOf("now")!==-1)return a;if(a.length===8){const C=(0,n.zh)(a,"YYYYMMDD");if(C.isValid())return C}else if(a.length===15){const C=(0,n.zh)(a,"YYYYMMDDTHHmmss");if(C.isValid())return C}if(!isNaN(Number(a))){const C=parseInt(a,10);return(0,n.zh)(C)}return null}getTimeWindow(a,C){const P=parseInt(a,10);let b;return C.match(/^\d+$/)&&parseInt(C,10)?b=parseInt(C,10):b=s.intervalToMs(C),{from:(0,n.zh)(P-b/2),to:(0,n.zh)(P+b/2)}}initTimeFromUrl(){if(l.config.isPublicDashboardView&&this.timeModel?.timepicker?.hidden)return;const a=g.E1.getSearch();a.get("time")&&a.get("time.window")&&(this.time=this.getTimeWindow(a.get("time"),a.get("time.window"))),a.get("from")&&(this.time.from=this.parseUrlParam(a.get("from"))||this.time.from),a.get("to")&&(this.time.to=this.parseUrlParam(a.get("to"))||this.time.to),a.get("to")&&a.get("to").indexOf("now")===-1&&(this.refresh=!1,this.timeModel&&(this.timeModel.refresh=!1)),this.refresh=f({urlRefresh:a.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:l.config.minRefreshInterval})}updateTimeRangeFromUrl(){const a=g.E1.getSearch();if(a.get("left"))return;const C=this.timeRangeForUrl(),P=a.get("from"),b=a.get("to");P&&b?(P!==C.from||b!==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(a){this.timeModel&&(this.timeModel.refresh=a),this.stopAutoRefresh();const C=g.E1.getSearchObject();if(!a){C.refresh&&g.E1.partial({refresh:null},!0);return}let P=a,b=60*1e3;a===u.Wg?b=this.getAutoRefreshInteval().intervalMs:(P=this.contextSrv.getValidInterval(a),b=s.intervalToMs(P)),this.refreshMS=b,this.refreshTimer=window.setTimeout(()=>{this.startNextRefreshTimer(b),this.refreshTimeModel()},b),C.refresh!==P&&g.E1.partial({refresh:P},!0)}getAutoRefreshInteval(){const a=window?.innerWidth??2e3;return s.calculateInterval(this.timeRange(),a,l.config.minRefreshInterval)}refreshTimeModel(){this.timeModel?.timeRangeUpdated(this.timeRange())}startNextRefreshTimer(a){this.refreshTimer=window.setTimeout(()=>{this.startNextRefreshTimer(a),this.contextSrv.isGrafanaVisible()?this.refreshTimeModel():this.autoRefreshBlocked=!0},a)}stopAutoRefresh(){clearTimeout(this.refreshTimer),this.refreshTimer=void 0,this.refreshMS=void 0}resumeAutoRefresh(){this.timeModel?.refresh&&this.setAutoRefresh(this.timeModel.refresh)}setTime(a,C=!0){if((0,t.extend)(this.time,a),(0,n.v9)(a.to)?(this.oldRefresh=this.timeModel?.refresh||this.oldRefresh,this.setAutoRefresh(!1)):this.oldRefresh&&this.oldRefresh!==this.timeModel?.refresh&&(this.setAutoRefresh(this.oldRefresh),this.oldRefresh=void 0),C===!0){const P=this.timeRangeForUrl(),b=g.E1.getSearchObject();if(b.from===P.from.toString()&&b.to===P.to.toString())return;b.from=P.from.toString(),b.to=P.to.toString(),g.E1.partial(b)}this.timeModel?.refresh===u.Wg&&this.getAutoRefreshInteval().intervalMs!==this.refreshMS&&this.setAutoRefresh(u.Wg),this.refreshTimeModel()}timeRange(){return(0,m.O)(this.time,this.timeModel)}zoomOut(a,C=!0){const P=this.timeRange(),{from:b,to:M}=(0,o.h)(P,a);this.setTime({from:(0,n.zh)(b),to:(0,n.zh)(M)},C)}shiftTime(a,C=!0){const P=this.timeRange(),{from:b,to:M}=(0,o.e)(a,P);this.setTime({from:(0,n.zh)(b),to:(0,n.zh)(M)},C)}makeAbsoluteTime(a){const{from:C,to:P}=this.timeRange();this.setTime({from:C,to:P},a)}isRefreshOutsideThreshold(a,C=.05){const P=this.timeRange();if(r.isMathString(P.raw.from)){const b=P.to.diff(P.from),M=Date.now()-a,T=b*C;return M>=T}return!1}}let h;function y(D){h=D}function v(){return h||(h=new E(u.contextSrv)),h}},85180:(j,I,e)=>{"use strict";e.d(I,{o:()=>N,p:()=>G});var t=e(89949),n=e(41199),i=e(59421),s=e(17312),r=e(78968),g=e(3569),d=e(51046),l=e(77104),u=e(19221),o=e(29241),m=e(23830),c=e(99581),p=e(10864),f=e(64167),E=e(37193),h=e(53035),y=e(12308),v=e(97957);function D(q){return Array.from(new Array(q+1),(ne,ge)=>ge).filter(ne=>q%ne===0)}var a=e(13216),C=e(5926),P=e(5399),b=e(21791),M=e(32159),T=e(3133),S=e(24830),x=e(76897),O=e(14180);function B(q,ne){const ge=[];if(q?.statistics&&q?.statistics.length){q.statistic=q.statistics[0];for(const ae of q.statistics.splice(1))ge.push({...q,statistic:ae})}for(const ae of ge)ae.refId=(0,x.Hs)(ne),delete ae.statistics,ne.push(ae);return delete q.statistics,ge}function A(q){const ne=[];if(q&&"statistics"in q&&q?.statistics?.length){for(const ge of q.statistics.splice(1)){const{statistics:ae,name:re,...De}=q;ne.push({...De,statistic:ge,name:`${re} - ${ge}`})}q.statistic=q.statistics[0],ne.length!==0&&(q.name=`${q.name} - ${q.statistic}`),delete q.statistics}return ne}function V(q){q.hasOwnProperty("metricQueryType")||(q.metricQueryType=O.$5.Search),q.hasOwnProperty("metricEditorMode")||(q.metricQueryType===O.$5.Query?q.metricEditorMode=O.MQ.Code:q.metricEditorMode=q.expression?O.MQ.Code:O.MQ.Builder)}var W=e(6230),w=e(89167);n.S.setInit(h.u),n.N.setInit(h.l);class N{constructor(ne){this.dashboard=ne,(0,p.F)()||(0,p.w)(new C.ND)}updateSchema(ne){let ge,ae,re,De;const he=this.dashboard.schemaVersion,ye=[];if(this.dashboard.schemaVersion=38,he!==this.dashboard.schemaVersion){if(he<2&&(ne.services&&ne.services.filter&&(this.dashboard.time=ne.services.filter.time,this.dashboard.templating.list=ne.services.filter.list||[]),ye.push(ce=>(ce.type==="graphite"&&(ce.type="graph"),ce.type!=="graph"||((0,t.isBoolean)(ce.legend)&&(ce.legend={show:ce.legend}),ce.grid&&(ce.grid.min&&(ce.grid.leftMin=ce.grid.min,delete ce.grid.min),ce.grid.max&&(ce.grid.leftMax=ce.grid.max,delete ce.grid.max)),ce.y_format&&(ce.y_formats||(ce.y_formats=[]),ce.y_formats[0]=ce.y_format,delete ce.y_format),ce.y2_format&&(ce.y_formats||(ce.y_formats=[]),ce.y_formats[1]=ce.y2_format,delete ce.y2_format)),ce))),he<3){let ce=this.dashboard.getNextPanelId();ye.push(We=>(We.id||(We.id=ce,ce+=1),We))}if(he<4&&ye.push(ce=>(ce.type!=="graph"||((0,t.each)(ce.aliasYAxis,(We,ke)=>{ce.seriesOverrides=[{alias:ke,yaxis:We}]}),delete ce.aliasYAxis),ce)),he<6){const ce=(0,t.find)(ne.pulldowns,{type:"annotations"});for(ce&&(this.dashboard.annotations={list:ce.annotations||[]}),ge=0;ge<this.dashboard.templating.list.length;ge++){const We=this.dashboard.templating.list[ge];We.datasource===void 0&&(We.datasource=null),We.type==="filter"&&(We.type="query"),We.type===void 0&&(We.type="query"),We.allFormat===void 0&&(We.allFormat="glob")}}if(he<7&&(ne.nav&&ne.nav.length&&(this.dashboard.timepicker=ne.nav[0]),ye.push(ce=>((0,t.each)(ce.targets,We=>{We.refId||(We.refId=ce.getNextQueryLetter&&ce.getNextQueryLetter())}),ce))),he<8&&ye.push(ce=>((0,t.each)(ce.targets,We=>{We.fields&&We.tags&&We.groupBy&&(We.rawQuery?(delete We.fields,delete We.fill):(We.select=(0,t.map)(We.fields,ke=>{const et=[];return et.push({type:"field",params:[ke.name]}),et.push({type:ke.func,params:[]}),ke.mathExpr&&et.push({type:"math",params:[ke.mathExpr]}),ke.asExpr&&et.push({type:"alias",params:[ke.asExpr]}),et}),delete We.fields,(0,t.each)(We.groupBy,ke=>{ke.type==="time"&&ke.interval&&(ke.params=[ke.interval],delete ke.interval),ke.type==="tag"&&ke.key&&(ke.params=[ke.key],delete ke.key)}),We.fill&&(We.groupBy.push({type:"fill",params:[We.fill]}),delete We.fill)))}),ce)),he<9&&ye.push(ce=>{if(ce.type!=="singlestat"&&ce.thresholds!=="")return ce;if(ce.thresholds){const We=ce.thresholds.split(",");We.length>=3&&(We.shift(),ce.thresholds=We.join(","))}return ce}),he<10&&ye.push(ce=>(ce.type!=="table"||(0,t.each)(ce.styles,We=>{if(We.thresholds&&We.thresholds.length>=3){const ke=We.thresholds;ke.shift(),We.thresholds=ke}}),ce)),he<12&&(0,t.each)(this.dashboard.getVariables(),ce=>{ce.refresh&&(ce.refresh=1),ce.refresh||(ce.refresh=0),ce.hideVariable?ce.hide=2:ce.hideLabel&&(ce.hide=1)}),he<12&&ye.push(ce=>(ce.type!=="graph"||!ce.grid||ce.yaxes||(ce.yaxes=[{show:ce["y-axis"],min:ce.grid.leftMin,max:ce.grid.leftMax,logBase:ce.grid.leftLogBase,format:ce.y_formats[0],label:ce.leftYAxisLabel},{show:ce["y-axis"],min:ce.grid.rightMin,max:ce.grid.rightMax,logBase:ce.grid.rightLogBase,format:ce.y_formats[1],label:ce.rightYAxisLabel}],ce.xaxis={show:ce["x-axis"]},delete ce.grid.leftMin,delete ce.grid.leftMax,delete ce.grid.leftLogBase,delete ce.grid.rightMin,delete ce.grid.rightMax,delete ce.grid.rightLogBase,delete ce.y_formats,delete ce.leftYAxisLabel,delete ce.rightYAxisLabel,delete ce["y-axis"],delete ce["x-axis"]),ce)),he<13&&ye.push(ce=>{if(ce.type!=="graph"||!ce.grid)return ce;ce.thresholds||(ce.thresholds=[]);const We={},ke={};return ce.grid.threshold1!==null&&(We.value=ce.grid.threshold1,ce.grid.thresholdLine?(We.line=!0,We.lineColor=ce.grid.threshold1Color,We.colorMode="custom"):(We.fill=!0,We.fillColor=ce.grid.threshold1Color,We.colorMode="custom")),ce.grid.threshold2!==null&&(ke.value=ce.grid.threshold2,ce.grid.thresholdLine?(ke.line=!0,ke.lineColor=ce.grid.threshold2Color,ke.colorMode="custom"):(ke.fill=!0,ke.fillColor=ce.grid.threshold2Color,ke.colorMode="custom")),(0,t.isNumber)(We.value)&&((0,t.isNumber)(ke.value)?We.value>ke.value?(We.op=ke.op="lt",ce.thresholds.push(We),ce.thresholds.push(ke)):(We.op=ke.op="gt",ce.thresholds.push(We),ce.thresholds.push(ke)):(We.op="gt",ce.thresholds.push(We))),delete ce.grid.threshold1,delete ce.grid.threshold1Color,delete ce.grid.threshold2,delete ce.grid.threshold2Color,delete ce.grid.thresholdLine,ce}),he<14&&(this.dashboard.graphTooltip=ne.sharedCrosshair?1:0),he<16&&this.upgradeToGridLayout(ne),he<17&&ye.push(ce=>{if(ce.minSpan){const We=v.cz/ce.minSpan,ke=D(v.cz);ce.maxPerRow=ke[(0,t.findIndex)(ke,et=>et>We)-1]}return delete ce.minSpan,ce}),he<18&&ye.push(ce=>(ce["options-gauge"]&&(ce.options=ce["options-gauge"],ce.options.valueOptions={unit:ce.options.unit,stat:ce.options.stat,decimals:ce.options.decimals,prefix:ce.options.prefix,suffix:ce.options.suffix},ce.options.thresholds&&ce.options.thresholds.reverse(),delete ce.options.options,delete ce.options.unit,delete ce.options.stat,delete ce.options.decimals,delete ce.options.prefix,delete ce.options.suffix,delete ce["options-gauge"]),ce)),he<19&&ye.push(ce=>(ce.links&&(0,t.isArray)(ce.links)&&(ce.links=ce.links.map(H)),ce)),he<20){const ce=We=>({...We,url:R(We.url)});ye.push(We=>(We.options&&We.options.dataLinks&&(0,t.isArray)(We.options.dataLinks)&&(We.options.dataLinks=We.options.dataLinks.map(ce)),We.options&&We.options.fieldOptions&&We.options.fieldOptions.defaults&&(We.options.fieldOptions.defaults.links&&(0,t.isArray)(We.options.fieldOptions.defaults.links)&&(We.options.fieldOptions.defaults.links=We.options.fieldOptions.defaults.links.map(ce)),We.options.fieldOptions.defaults.title&&(We.options.fieldOptions.defaults.title=R(We.options.fieldOptions.defaults.title))),We))}if(he<21){const ce=We=>({...We,url:We.url.replace(/__series.labels/g,"__field.labels")});ye.push(We=>(We.options&&We.options.dataLinks&&(0,t.isArray)(We.options.dataLinks)&&(We.options.dataLinks=We.options.dataLinks.map(ce)),We.options&&We.options.fieldOptions&&We.options.fieldOptions.defaults&&We.options.fieldOptions.defaults.links&&(0,t.isArray)(We.options.fieldOptions.defaults.links)&&(We.options.fieldOptions.defaults.links=We.options.fieldOptions.defaults.links.map(ce)),We))}if(he<22&&ye.push(ce=>(ce.type!=="table"||(0,t.each)(ce.styles,We=>{We.align="auto"}),ce)),he<23)for(const ce of this.dashboard.templating.list){if(!(0,P.U4)(ce))continue;const{multi:We,current:ke}=ce;(0,i.Q)(ke)||(ce.current=(0,b.x)(ke,We))}if(he<24&&ye.push(ce=>{const We=ce.type==="table";if(We&&!ce.styles)return ce;const ke=ce.table==="table2";return!We||ke||(ce.type=We?"table-old":"table"),ce}),he<25,he<26&&ye.push(ce=>(ce.type==="text2"&&(ce.type="text",delete ce.options.angular),ce)),he<27&&(this.dashboard.templating.list=this.dashboard.templating.list.map(ce=>{if(!(0,P.VC)(ce))return ce;const We={...ce};return We.current={selected:!0,text:We.query??"",value:We.query??""},We.options=[We.current],We.hide===W.bU.dontHide||We.hide===W.bU.hideLabel?{...We,type:"textbox"}:We})),he<28){ye.push(ce=>ce.type==="singlestat"?_(ce):ce);for(const ce of this.dashboard.templating.list)ce.tags&&delete ce.tags,ce.tagsQuery&&delete ce.tagsQuery,ce.tagValuesQuery&&delete ce.tagValuesQuery,ce.useTags&&delete ce.useTags}if(he<29)for(const ce of this.dashboard.templating.list)ce.type==="query"&&(ce.refresh!==1&&ce.refresh!==2&&(ce.refresh=1),ce.options?.length&&(ce.options=[]));if(he<30&&(ye.push(X),ye.push(le)),he<31&&ye.push(ce=>{if(ce.transformations){for(const We of ce.transformations)if(We.id===m.r.id)return Y(ce,m.r.id,{id:c.R.id,options:{}})}return ce}),he<32,he<33&&ye.push(ce=>{if(ce.datasource=G(ce.datasource,{returnDefaultAsNull:!0}),!ce.targets)return ce;for(const We of ce.targets){const ke=G(We.datasource,{returnDefaultAsNull:!0});ke!=null&&(We.datasource=ke)}return ce}),he<34&&(ye.push(ce=>(this.migrateCloudWatchQueries(ce),ce)),this.migrateCloudWatchAnnotationQuery()),he<35&&ye.push(oe),he<36){for(const We of this.dashboard.annotations.list)We.datasource=G(We.datasource,{returnDefaultAsNull:!1});const ce=(0,p.F)().getInstanceSettings(null);if(ce){for(const We of this.dashboard.templating.list)We.type==="query"&&We.datasource===null&&(We.datasource=(0,s.iU)(ce));ye.push(We=>{if(We.targets){let ke=!1;We.datasource==null&&We.targets.length>0&&(We.datasource=(0,s.iU)(ce),ke=!0);for(const et of We.targets)(et.datasource==null||et.datasource.uid==null)&&(We.datasource?.uid!==M.D?et.datasource={...We.datasource}:et.datasource=G(et.datasource,{returnDefaultAsNull:!1})),ke&&et.datasource?.uid!=="__expr__"&&(We.datasource=et.datasource)}return We})}}if(he<37&&ye.push(ce=>(ce.options?.legend&&(ce.options.legend.displayMode==="hidden"||ce.options.legend.showLegend===!1)?(ce.options.legend.displayMode="list",ce.options.legend.showLegend=!1):ce.options?.legend&&(ce.options.legend={...ce.options?.legend,showLegend:!0}),ce)),he<38&&ye.push(ce=>{if(ce.type==="table"&&ce.fieldConfig!==void 0){const We=ce.fieldConfig.defaults?.custom?.displayMode;if(We!==void 0&&(ce.fieldConfig.defaults.custom.cellOptions=(0,E.q7)(We),delete ce.fieldConfig.defaults.custom.displayMode),ce.fieldConfig?.overrides)for(const ke of ce.fieldConfig.overrides)for(let et=0;et<ke.properties?.length;et++){let we=ke.properties[et].value;ke.properties[et].id==="custom.displayMode"&&(ke.properties[et].id="custom.cellOptions",ke.properties[et].value=(0,E.q7)(we))}}return ce}),ye.length!==0)for(ae=0;ae<this.dashboard.panels.length;ae++)for(re=0;re<ye.length;re++){this.dashboard.panels[ae]=ye[re].call(this,this.dashboard.panels[ae]);const ce=this.dashboard.panels[ae].panels;if(ce)for(De=0;De<ce.length;De++)ce[De]=ye[re].call(this,ce[De])}}}migrateCloudWatchQueries(ne){for(const ge of ne.targets||[])if(Q(ge)&&(V(ge),ge.hasOwnProperty("statistics"))){const ae=B(ge,[...ne.targets]);for(const re of ae)ne.targets.push(re)}}migrateCloudWatchAnnotationQuery(){for(const ne of this.dashboard.annotations.list)if(se(ne)){const ge=A(ne);for(const ae of ge)this.dashboard.annotations.list.push(ae)}}upgradeToGridLayout(ne){let ge=0;const ae=v.cz/12;let De=(0,t.max)((0,t.flattenDeep)((0,t.map)(ne.rows,ye=>(0,t.map)(ye.panels,"id"))))+1;if(!ne.rows)return;const he=(0,t.some)(ne.rows,ye=>ye.collapse||ye.showTitle||ye.repeat);for(const ye of ne.rows){if(ye.repeatIteration)continue;const ce=ye.height||v.b0,We=F(ce),ke={};let et;he&&(ke.id=De,ke.type="row",ke.title=ye.title,ke.collapsed=ye.collapse,ke.repeat=ye.repeat,ke.panels=[],ke.gridPos={x:0,y:ge,w:v.cz,h:We},et=new w.rY(ke),De++,ge++);const we=new k(We,v.cz,ge);for(const _e of ye.panels){_e.span=_e.span||v.kh,_e.minSpan&&(_e.minSpan=Math.min(v.cz,v.cz/12*_e.minSpan));const Ge=Math.floor(_e.span)*ae,qe=_e.height?F(_e.height):We,st=we.getPanelPosition(qe,Ge);ge=we.yPos,_e.gridPos={x:st.x,y:ge+st.y,w:Ge,h:qe},we.addPanel(_e.gridPos),delete _e.span,et&&ke.collapsed?et.panels?.push(_e):this.dashboard.panels.push(new w.rY(_e))}et&&this.dashboard.panels.push(et),et&&ke.collapsed||(ge+=We)}}}function F(q){return(0,t.isString)(q)&&(q=parseInt(q.replace("px",""),10)),q<v.AV&&(q=v.AV),Math.ceil(q/(v.K3+v.hD))}class k{constructor(ne,ge=v.cz,ae=0){this.area=new Array(ge).fill(0),this.yPos=ae,this.height=ne}reset(){this.area.fill(0)}addPanel(ne){for(let ge=ne.x;ge<ne.x+ne.w;ge++)(!this.area[ge]||ne.y+ne.h-this.yPos>this.area[ge])&&(this.area[ge]=ne.y+ne.h-this.yPos);return this.area}getPanelPosition(ne,ge,ae=!1){let re,De,he;for(let ye=this.area.length-1;ye>=0&&this.height-this.area[ye]>0;ye--)if(De===void 0)De=ye;else if(ye<this.area.length-1&&this.area[ye]<=this.area[ye+1])re=ye;else break;if(re!==void 0&&De!==void 0&&De-re>=ge-1){const ye=(0,t.max)(this.area.slice(re));he={x:re,y:ye}}else return ae?null:(this.yPos+=this.height,this.reset(),this.getPanelPosition(ne,ge,!0));return he}}function H(q){let ne=q.url;return!ne&&q.dashboard&&(ne=`dashboard/db/${a.Z.slugifyForUrl(q.dashboard)}`),!ne&&q.dashUri&&(ne=`dashboard/${q.dashUri}`),ne||(ne="/"),q.keepTime&&(ne=r.Cj.appendQueryToUrl(ne,`$${g.W.keepTime}`)),q.includeVars&&(ne=r.Cj.appendQueryToUrl(ne,`$${g.W.includeVars}`)),q.params&&(ne=r.Cj.appendQueryToUrl(ne,q.params)),{url:ne,title:q.title,targetBlank:q.targetBlank}}function R(q){const ne=/(__series_name)|(\$__series_name)|(__value_time)|(__field_name)|(\$__field_name)/g;return q.replace(ne,(ge,ae,re,De,he,ye)=>ae?"__series.name":re?"${__series.name}":De?"__value.time":he?"__field.name":ye?"${__field.name}":ge)}function _(q){if(y.config.panels["grafana-singlestat-panel"])return q.type="grafana-singlestat-panel",q;let ne=!1;return q.changePlugin||(ne=!0,q=new w.rY(q)),q.plugin={angularPanelCtrl:{}},q.gauge?.show?(T.plugin.meta=y.config.panels.gauge,q.changePlugin(T.plugin)):(S.plugin.meta=y.config.panels.stat,q.changePlugin(S.plugin)),ne?q.getSaveModel():q}function G(q,ne){if(ne.returnDefaultAsNull&&(q==null||q==="default"))return null;if((0,s.cv)(q))return q;const ge=(0,p.F)().getInstanceSettings(q);return ge?(0,s.iU)(ge):{uid:q}}function Y(q,ne,ge){if(q.transformations){const ae=[];for(const re of q.transformations)ae.push(re),re.id===ne&&ae.push({...ge});q.transformations=ae}return q}function X(q){const ne=q.fieldConfig;if(!ne)return q;if(ne.defaults&&ne.defaults.mappings&&(ne.defaults.mappings=Z(ne.defaults.mappings,ne.defaults.thresholds)),Array.isArray(ne.overrides))for(const ge of ne.overrides)for(const ae of ge.properties)ae.id==="mappings"&&(ae.value=Z(ae.value));return q}function Q(q){return q.hasOwnProperty("dimensions")&&q.hasOwnProperty("namespace")&&q.hasOwnProperty("region")&&q.hasOwnProperty("metricName")}function se(q){return q.hasOwnProperty("dimensions")&&q.hasOwnProperty("namespace")&&q.hasOwnProperty("region")&&q.hasOwnProperty("prefixMatching")&&q.hasOwnProperty("statistics")}function Z(q,ne){if(!q)return;const ge={type:d.H.ValueToText,options:{}},ae=[];for(const re of q){if(re.type&&re.options){re.type===d.H.ValueToText?ge.options={...ge.options,...re.options}:ae.push(re);continue}let De;const he=parseFloat(re.text);if(ne&&!isNaN(he)){const ye=(0,l.m1)(he,ne.steps);ye&&ye.color&&(De=ye.color)}switch(re.type){case 1:re.value!=null&&(re.value==="null"?ae.push({type:d.H.SpecialValue,options:{match:d.e.Null,result:{text:re.text,color:De}}}):ge.options[String(re.value)]={text:re.text,color:De});break;case 2:ae.push({type:d.H.RangeToText,options:{from:+re.from,to:+re.to,result:{text:re.text,color:De}}});break}}return Object.keys(ge.options).length>0&&ae.unshift(ge),ae}function le(q){return(q.type==="timeseries"||q.type==="xychart")&&q.options.tooltipOptions&&(q.options={...q.options,tooltip:q.options.tooltipOptions},delete q.options.tooltipOptions),q}function oe(q){return q.type==="timeseries"&&q.fieldConfig?.defaults.custom?.axisPlacement===f.LB.Hidden&&(q.fieldConfig={...q.fieldConfig,overrides:[...q.fieldConfig.overrides,{matcher:{id:u.mi.byType,options:o.fS.time},properties:[{id:"custom.axisPlacement",value:f.LB.Auto}]}]}),q}},85991:(j,I,e)=>{"use strict";e.d(I,{f:()=>W});var t=e(89949),n=e(19973),i=e(62435),s=e(60956),r=e(99633),g=e(34667),d=e(32713),l=e(5354),u=e(97957),o=e(91368);function m(F){return(0,t.isArray)(F)?F.map(m):(0,t.isPlainObject)(F)?Object.keys(F).sort().reduce((k,H)=>{const R=F[H];return R!=null&&(k[H]=m(R)),k},{}):F}var c=e(41355),p=e(4684),f=e(51824),E=e(18771),h=e(43620),y=e(66574),v=e(84749),D=e(6230),a=e(81587),C=e(26858),P=e(73170);const b=new Set(["gridPos","title","description","transparent"]);function M(F,k){const H=[],R={changed:!1,actions:{add:[],remove:[],replace:[],update:[],noop:[]},panels:H};let _=0;const G=new Map;for(let Y of k){let{id:X}=Y;X||(_||(_=S([F,k])),X=_++,Y={...Y,id:X}),G.set(X,Y)}for(const Y of F){const X=G.get(Y.id);if(!X){R.changed=!0,R.actions.remove.push(Y.id),Y.destroy();continue}if(G.delete(Y.id),X===Y){H.push(Y),R.actions.noop.push(Y.id);continue}if(Y.type===X.type){const se=Y.getSaveModel();let Z=!0,le=!1;for(const[oe,q]of Object.entries(X))if(!(0,t.isEqualWith)(q,se[oe],T))if(R.changed=!0,Z=!1,b.has(oe))Y[oe]=q,le=!0;else{le=!1;break}if(Z){H.push(Y),R.actions.noop.push(Y.id);continue}if(le){H.push(Y),R.actions.update.push(Y.id);continue}}Y.destroy();const Q=new P.r(X);Q.key=`${Q.id}-update-${Date.now()}`,H.push(Q),R.changed=!0,R.actions.replace.push(Y.id)}for(const Y of G.values())H.push(new P.r(Y)),R.changed=!0,R.actions.add.push(Y.id);return R}function T(F,k){if(F==null&&(k===1/0||k===-1/0||k==null)||k==null&&(F===1/0||F===-1/0||F==null))return!0}function S(F){let k=0;for(const H of F)for(const R of H)R.id>k&&(k=R.id);return k+1}var x=e(85180),O=e(89167);function B(F,k){return F.repeatDirection===u.yM?!1:k.gridPos.x>=F.gridPos.x+F.gridPos.w&&k.gridPos.y===F.gridPos.y}function A(F){for(const k of F)if(delete k.scopedVars,k.panels?.length)for(const H of k.panels)delete H.scopedVars}const V=class{constructor(F,k,H){if(this.timeRangeUpdatedDuringEdit=!1,this.getVariablesFromState=H?.getVariablesFromState??f.gt,this.events=new i.F,this.id=F.id||null,this.uid=F.uid||null,this.revision=F.revision??void 0,this.title=F.title??"No Title",this.description=F.description,this.tags=F.tags??[],this.style=F.style??"dark",this.timezone=F.timezone??"",this.weekStart=F.weekStart??"",this.editable=F.editable!==!1,this.graphTooltip=F.graphTooltip||0,this.time=F.time??{from:"now-6h",to:"now"},this.timepicker=F.timepicker??{},this.liveNow=!!F.liveNow,this.templating=this.ensureListExist(F.templating),this.annotations=this.ensureListExist(F.annotations),this.refresh=F.refresh||"",this.snapshot=F.snapshot,this.schemaVersion=F.schemaVersion??0,this.fiscalYearStartMonth=F.fiscalYearStartMonth??0,this.version=F.version??0,this.links=F.links??[],this.gnetId=F.gnetId||null,this.panels=(0,t.map)(F.panels??[],R=>new O.rY(R)),this.ensurePanelsHaveUniqueIds(),this.formatDate=this.formatDate.bind(this),this.resetOriginalVariables(!0),this.resetOriginalTime(),this.initMeta(k),this.updateSchema(F),H?.autoMigrateOldPanels||!g.config.angularSupportEnabled||g.config.featureToggles.autoMigrateOldPanels)for(const R of this.panelIterator()){const _=O.G7[R.type];!R.autoMigrateFrom&&_&&(R.autoMigrateFrom=R.type,R.type=_)}this.addBuiltInAnnotationQuery(),this.sortPanelsByGridPos(),this.panelsAffectedByVariableChange=null,this.appEventsSubscription=new n.w0,this.lastRefresh=Date.now(),this.appEventsSubscription.add(y.h$.subscribe(D.x9,this.variablesChangedHandler.bind(this))),this.appEventsSubscription.add(y.h$.subscribe(D.eq,this.variablesTimeRangeProcessDoneHandler.bind(this))),this.appEventsSubscription.add(y.h$.subscribe(D.Wy,this.variablesChangedInUrlHandler.bind(this)))}addBuiltInAnnotationQuery(){this.annotations.list.some(k=>k.builtIn===1)||this.annotations.list.unshift({datasource:{uid:"-- Grafana --",type:"grafana"},name:"Annotations & Alerts",type:"dashboard",iconColor:l.Jx,enable:!0,hide:!0,builtIn:1})}initMeta(F){F=F||{},F.canShare=F.canShare!==!1,F.canSave=F.canSave!==!1,F.canStar=F.canStar!==!1,F.canEdit=F.canEdit!==!1,F.canDelete=F.canDelete!==!1,F.showSettings=F.canEdit,F.canMakeEditable=F.canSave&&!this.editable,F.hasUnsavedFolderChange=!1,this.editable||(F.canEdit=!1,F.canDelete=!1,F.canSave=!1),this.meta=F}getSaveModelClone(F){const k=(0,t.defaults)(F||{},{saveVariables:!0,saveTimerange:!0});let H={};for(const R in this)V.nonPersistedProperties[R]||!this.hasOwnProperty(R)||(H[R]=(0,t.cloneDeep)(this[R]));return this.updateTemplatingSaveModelClone(H,k),k.saveTimerange||(H.time=this.originalTime),H.panels=this.getPanelSaveModels(),H=m(H),H.getVariables=()=>H.templating.list,H}updatePanels(F){const k=M(this.panels,F??[]);return k.changed&&(this.panels=k.panels??[],this.sortPanelsByGridPos(),this.events.publish(new h._B)),k}getPanelSaveModels(){return this.panels.filter(F=>this.isSnapshotTruthy()||!(F.type==="add-panel"||F.repeatPanelId||F.repeatedByRow)).map(F=>{if(F.libraryPanel){const{id:k,title:H,libraryPanel:R,gridPos:_}=F;return{id:k,title:H,gridPos:_,libraryPanel:{uid:R.uid,name:R.name}}}return this.panelInEdit&&this.panelInEdit.id===F.id?this.panelInEdit.getSaveModel():F.getSaveModel()}).map(F=>(this.isSnapshotTruthy()||(delete F.scopedVars,F.type==="row"&&F.panels&&F.panels.length>0&&(F.panels=F.panels.filter(k=>!k.repeatPanelId).map(k=>(delete k.scopedVars,k)))),F))}updateTemplatingSaveModelClone(F,k){const H=this.originalTemplating,R=this.getVariablesFromState(this.uid);if(F.templating={list:R.map(_=>c.z.get(_.type).getSaveModel(_,k.saveVariables))},!k.saveVariables)for(const _ of F.templating.list){const G=H.find(({name:Y,type:X})=>Y===_.name&&X===_.type);G&&(_.type==="adhoc"?_.filters=G.filters:_.current=G.current)}}timeRangeUpdated(F){this.events.publish(new d.md(F)),(0,v.WI)((0,p.DU)(this.uid,F)),this.panelInEdit&&(this.timeRangeUpdatedDuringEdit=!0)}startRefresh(F={refreshAll:!0,panelIds:[]}){if(this.events.publish(new d.U5),this.lastRefresh=Date.now(),this.panelInEdit&&(F.refreshAll||F.panelIds.includes(this.panelInEdit.id))){this.panelInEdit.refresh();return}for(const k of this.panels)!this.otherPanelInFullscreen(k)&&(F.refreshAll||F.panelIds.includes(k.id))&&k.refresh()}render(){this.events.publish(new h._z);for(const F of this.panels)F.render()}panelInitialized(F){const k=F.getQueryRunner().getLastResult();!this.otherPanelInFullscreen(F)&&!k&&F.refresh()}otherPanelInFullscreen(F){return(this.panelInEdit||this.panelInView)&&!(F.isViewing||F.isEditing)}initEditPanel(F){return(0,C.$t)().stopAutoRefresh(),this.panelInEdit=F.getEditClone(),this.timeRangeUpdatedDuringEdit=!1,this.panelInEdit}exitPanelEditor(){this.panelInEdit.destroy(),this.panelInEdit=void 0,(0,C.$t)().resumeAutoRefresh(),(this.panelsAffectedByVariableChange||this.timeRangeUpdatedDuringEdit)&&(this.startRefresh({panelIds:this.panelsAffectedByVariableChange??[],refreshAll:this.timeRangeUpdatedDuringEdit}),this.panelsAffectedByVariableChange=null,this.timeRangeUpdatedDuringEdit=!1)}initViewPanel(F){this.panelInView=F,F.setIsViewing(!0)}exitViewPanel(F){this.panelInView=void 0,F.setIsViewing(!1),this.refreshIfPanelsAffectedByVariableChange()}refreshIfPanelsAffectedByVariableChange(){this.panelsAffectedByVariableChange&&(this.startRefresh({panelIds:this.panelsAffectedByVariableChange,refreshAll:!1}),this.panelsAffectedByVariableChange=null)}ensurePanelsHaveUniqueIds(){const F=new Set;let k=this.getNextPanelId();for(const H of this.panelIterator())(!H.id||F.has(H.id))&&(H.id=k++),F.add(H.id)}ensureListExist(F={}){return F.list??=[],F}getNextPanelId(){let F=0;for(const k of this.panelIterator())k.id>F&&(F=k.id);return F+1}*panelIterator(){for(const F of this.panels){yield F;const k=F.panels??[];for(const H of k)yield H}}forEachPanel(F){for(let k=0;k<this.panels.length;k++)F(this.panels[k],k)}getPanelById(F){return this.panelInEdit&&this.panelInEdit.id===F?this.panelInEdit:this.panels.find(k=>k.id===F)??null}canEditPanel(F){return!!(this.meta.canEdit&&F&&!F.repeatPanelId&&F.type!=="row")}canEditPanelById(F){return this.canEditPanel(this.getPanelById(F))}addPanel(F){F.id=this.getNextPanelId(),this.panels.unshift(new O.rY(F)),this.sortPanelsByGridPos(),this.events.publish(new h._B)}updateMeta(F){this.meta={...this.meta,...F},this.events.publish(new h.hS)}makeEditable(){this.editable=!0,this.updateMeta({canMakeEditable:!1,canEdit:!0,canSave:!0})}sortPanelsByGridPos(){this.panels.sort((F,k)=>F.gridPos.y===k.gridPos.y?F.gridPos.x-k.gridPos.x:F.gridPos.y-k.gridPos.y)}clearUnsavedChanges(){for(const F of this.panels)F.configRev=0;this.panelInEdit&&(this.panelInEdit.hasSavedPanelEditChange=this.panelInEdit.configRev>0,this.panelInEdit.configRev=0)}hasUnsavedChanges(){return!!this.panels.find(k=>k.hasChanged)}cleanUpRepeats(){if(this.isSnapshotTruthy()||!this.hasVariables())return;A(this.panels);const F=this.panels.filter(k=>(!k.repeat||k.repeatedByRow)&&k.repeatPanelId);(0,t.pull)(this.panels,...F),F.map(k=>k.destroy()),this.sortPanelsByGridPos()}processRepeats(){if(!(this.isSnapshotTruthy()||!this.hasVariables()||this.panelInView)){this.cleanUpRepeats();for(let F=0;F<this.panels.length;F++){const k=this.panels[F];k.repeat&&this.repeatPanel(k,F)}this.sortPanelsByGridPos(),this.events.publish(new h._B)}}cleanUpRowRepeats(F){const k=F.map(R=>R.id),H=F.filter(R=>!R.repeat&&R.repeatPanelId&&k.includes(R.repeatPanelId));(0,t.pull)(F,...H),(0,t.pull)(this.panels,...H)}processRowRepeats(F){if(this.isSnapshotTruthy()||!this.hasVariables())return;let k=F.panels??[];if(!F.collapsed){const H=this.panels.findIndex(R=>R.id===F.id);k=this.getRowPanels(H)}this.cleanUpRowRepeats(k);for(const H of k)if(H.repeat){const R=this.panels.findIndex(_=>_.id===H.id);this.repeatPanel(H,R)}}getPanelRepeatClone(F,k,H){if(k===0)return F;const R=F.getSaveModel();R.id=this.getNextPanelId();const _=new O.rY(R);return this.panels.splice(H+k,0,_),_.repeatPanelId=F.id,_.repeat=void 0,this.panelInView?.id===_.id&&(_.setIsViewing(!0),this.panelInView=_),_}getRowRepeatClone(F,k,H){if(k===0){if(!F.collapsed){const Y=this.getRowPanels(H);F.panels=Y}return F}const R=new O.rY(F.getSaveModel());let _,G;return F.collapsed?(_=(0,t.cloneDeep)(F.panels)??[],R.panels=_,G=H+k):(_=this.getRowPanels(H),R.panels=_.map(Y=>Y.getSaveModel()),G=H+(_.length+1)*k),this.panels.splice(G,0,R),this.updateRepeatedPanelIds(R),R}repeatPanel(F,k){const H=this.getPanelRepeatVariable(F);if(!H)return;if(F.type==="row"){this.repeatRow(F,k,H);return}const R=this.getSelectedVariableOptions(H),_=F.maxPerRow||4;let G=0,Y=F.gridPos.y;for(let Q=0;Q<R.length;Q++){const se=R[Q];let Z;Z=this.getPanelRepeatClone(F,Q,k),Z.scopedVars??={},Z.scopedVars[H.name]=se,F.repeatDirection===u.OA?(Q>0&&(Y+=Z.gridPos.h),Z.gridPos.y=Y):(Z.gridPos.w=Math.max(u.cz/R.length,u.cz/_),Z.gridPos.x=G,Z.gridPos.y=Y,G+=Z.gridPos.w,G+Z.gridPos.w>u.cz&&(G=0,Y+=Z.gridPos.h))}const X=Y-F.gridPos.y;if(X>0){const Q=k+R.length;for(const se of this.panels.slice(Q))B(F,se)||(se.gridPos.y+=X)}}repeatRow(F,k,H){const R=this.getSelectedVariableOptions(H);for(let _=0;_<R.length;_++){const G=R[_],Y=this.getRowRepeatClone(F,_,k);N(Y,H,G);const X=this.getRowHeight(Y),Q=Y.panels||[];let se;if(F.collapsed){for(const Z of Q)N(Z,H,G),_>0&&this.updateRepeatedPanelIds(Z,!0);Y.gridPos.y+=_,se=k+_+1}else{const Z=k+(Q.length+1)*_+1;Q.forEach((le,oe)=>{if(N(le,H,G),_>0){const q=new O.rY(le);this.updateRepeatedPanelIds(q,!0),q.gridPos.y+=X*_,this.panels.splice(Z+oe,0,q)}}),Y.panels=[],Y.gridPos.y+=X*_,se=Z+Q.length}if(R.length>1)for(const Z of this.panels.slice(se))Z.gridPos.y+=X}}updateRepeatedPanelIds(F,k){return F.repeatPanelId=F.id,F.id=this.getNextPanelId(),k?F.repeatedByRow=!0:F.repeat=void 0,F}getSelectedVariableOptions(F){let k;return(0,a.HY)(F)?k=F.options.slice(1,F.options.length):k=(0,t.filter)(F.options,{selected:!0}),k}getRowHeight(F){if(!F.panels||F.panels.length===0)return 0;if(F.collapsed)return 1;const k=(0,t.maxBy)(F.panels,({gridPos:H})=>H.y+H.h).gridPos;return k.y+k.h-F.gridPos.y}removePanel(F){this.panels=this.panels.filter(k=>k!==F),this.events.publish(new h._B)}removeRow(F,k){(!k&&F.collapsed||k&&!F.collapsed)&&this.toggleRow(F),this.removePanel(F)}expandRows(){const F=this.panels.filter(k=>k.type==="row"&&k.collapsed);for(const k of F)this.toggleRow(k)}collapseRows(){const F=this.panels.filter(k=>k.type==="row"&&!k.collapsed);for(const k of F)this.toggleRow(k)}isSubMenuVisible(){return this.links.length>0||this.getVariables().some(F=>F.hide!==2)||this.annotations.list.some(F=>!F.hide)}getPanelInfoById(F){const k=this.panels.findIndex(H=>H.id===F);return k>=0?{panel:this.panels[k],index:k}:null}duplicatePanel(F){const k=F.getSaveModel();return k.id=this.getNextPanelId(),delete k.repeat,delete k.repeatIteration,delete k.repeatPanelId,delete k.scopedVars,k.alert&&delete k.thresholds,delete k.alert,F.gridPos.x+F.gridPos.w*2<=u.cz?k.gridPos.x+=F.gridPos.w:k.gridPos.y+=F.gridPos.h,this.addPanel(k),k}formatDate(F,k){return(0,s.dq)(F,{format:k,timeZone:this.getTimezone()})}destroy(){this.appEventsSubscription.unsubscribe(),this.events.removeAllListeners();for(const F of this.panels)F.destroy()}toggleRow(F){const k=(0,t.indexOf)(this.panels,F);if(!F.collapsed){const G=this.getRowPanels(k);(0,t.pull)(this.panels,...G),F.panels=G.map(Y=>Y.getSaveModel()),F.collapsed=!0,G.some(Y=>Y.hasChanged)&&F.configRev++,this.events.publish(new h._B);return}F.collapsed=!1;const H=F.panels??[],R=H.some(G=>G.repeat),_=F.repeat;if(H.length>0){const Y=(H[0].gridPos.y??F.gridPos.y)-(F.gridPos.y+F.gridPos.h);let X=k+1,Q=F.gridPos.y;for(const Z of H){if(_){const le=this.getPanelRepeatVariable(F);if(Z.scopedVars??={},le){const oe=this.getSelectedVariableOptions(le);Z.scopedVars={...Z.scopedVars,[le.name]:oe[0]}}}Z.gridPos.y??(Z.gridPos.y=F.gridPos.y),Z.gridPos.y-=Y,this.panels.splice(X,0,new O.rY(Z)),X+=1,Q=Math.max(Q,Z.gridPos.y+Z.gridPos.h)}const se=Q-F.gridPos.y-1;for(const Z of this.panels.slice(X))Z.gridPos.y+=se;F.panels=[],R&&this.processRowRepeats(F)}this.sortPanelsByGridPos(),this.events.publish(new h._B)}getRowPanels(F){const k=this.panels.slice(F+1),H=k.findIndex(_=>_.type==="row");return k.slice(0,H>=0?H:this.panels.length)}on(F,k){console.log("DashboardModel.on is deprecated use events.subscribe"),this.events.on(F,k)}off(F,k){console.log("DashboardModel.off is deprecated"),this.events.off(F,k)}cycleGraphTooltip(){this.graphTooltip=(this.graphTooltip+1)%3}sharedTooltipModeEnabled(){return this.graphTooltip>0}sharedCrosshairModeOnly(){return this.graphTooltip===1}getRelativeTime(F){return(0,s.E8)(F,{timeZone:this.getTimezone()})}isSnapshot(){return this.snapshot!==void 0}getTimezone(){return this.timezone?this.timezone:o.contextSrv?.user?.timezone}updateSchema(F){new x.o(this).updateSchema(F)}resetOriginalTime(){this.originalTime=(0,t.cloneDeep)(this.time)}hasTimeChanged(){const{time:F,originalTime:k}=this;return!((0,t.isEqual)(F,k)||(0,t.isEqual)((0,r.CQ)(F?.from),(0,r.CQ)(k?.from))&&(0,t.isEqual)((0,r.CQ)(F?.to),(0,r.CQ)(k?.to)))}resetOriginalVariables(F=!1){if(F){this.originalTemplating=this.cloneVariablesFrom(this.templating.list);return}this.originalTemplating=this.cloneVariablesFrom(this.getVariablesFromState(this.uid))}hasVariableValuesChanged(){return this.hasVariablesChanged(this.originalTemplating,this.getVariablesFromState(this.uid))}autoFitPanels(F,k){const H=Math.max(...this.panels.map(Q=>Q.gridPos.h+Q.gridPos.y)),R=55,_=20;let G=F-R-_;k&&k!==E.KioskMode.TV&&(G+=R);const Y=Math.floor(G/(u.K3+u.hD)),X=H/Y;for(const Q of this.panels)Q.gridPos.y=Math.round(Q.gridPos.y/X)||1,Q.gridPos.h=Math.round(Q.gridPos.h/X)||1}templateVariableValueUpdated(){this.processRepeats(),this.events.emit(E.CoreEvents.nq)}getPanelByUrlId(F){const k=parseInt(F??"0",10),H=this.panels.filter(R=>R.collapsed);for(const R of H)R.panels?.some(G=>G.id===k)&&this.toggleRow(R);return this.getPanelById(k)}toggleLegendsForAll(){const F=this.panels.filter(w),k=F.filter(_=>_.legend.show).length,H=F.length-k,R=k>=H;for(const _ of F)_.legend.show=!R,_.render()}toggleExemplarsForAll(){for(const F of this.panels)for(const k of F.targets){if(!(k.datasource&&k.datasource.type==="prometheus"))continue;const H=k;H.exemplar=!H.exemplar}this.startRefresh()}getVariables(){return this.getVariablesFromState(this.uid)}canEditAnnotations(F){let k=!0;return o.contextSrv.accessControlEnabled()&&(F?k=!!this.meta.annotationsPermissions?.dashboard.canEdit:k=!!this.meta.annotationsPermissions?.organization.canEdit),this.canEditDashboard()&&k}canDeleteAnnotations(F){let k=!0;return o.contextSrv.accessControlEnabled()&&(F?k=!!this.meta.annotationsPermissions?.dashboard.canDelete:k=!!this.meta.annotationsPermissions?.organization.canDelete),k&&this.canEditDashboard()}canAddAnnotations(){return this.annotations.list.find(k=>k.builtIn===1)?.enable===!1||!this.canEditDashboard()?!1:!o.contextSrv.accessControlEnabled()||!!this.meta.annotationsPermissions?.dashboard.canAdd}canEditDashboard(){return!!(this.meta.canEdit||this.meta.canMakeEditable)}shouldUpdateDashboardPanelFromJSON(F,k){!(0,t.isEqual)(F?.gridPos,k?.gridPos)&&this.events.publish(new h._B)}getDefaultTime(){return this.originalTime}getPanelRepeatVariable(F){return this.getVariablesFromState(this.uid).find(k=>k.name===F.repeat)}isSnapshotTruthy(){return this.snapshot}hasVariables(){return this.getVariablesFromState(this.uid).length>0}hasVariablesChanged(F,k){if(F.length!==k.length)return!1;const H=k.map(R=>({name:R.name,type:R.type,current:(0,t.cloneDeep)(R.current),filters:(0,t.cloneDeep)(R.filters)}));return!(0,t.isEqual)(H,F)}cloneVariablesFrom(F){return F.map(k=>({name:k.name,type:k.type,current:(0,t.cloneDeep)(k.current),filters:(0,t.cloneDeep)(k.filters)}))}variablesTimeRangeProcessDoneHandler(F){const k=F.payload.variableIds.length>0;this.variablesChangedHandler(new D.x9({panelIds:[],refreshAll:!0}),k)}variablesChangedHandler(F,k=!0){if(k&&this.processRepeats(),F.payload.refreshAll||(0,C.$t)().isRefreshOutsideThreshold(this.lastRefresh)){this.startRefresh({refreshAll:!0,panelIds:[]});return}(this.panelInEdit||this.panelInView)&&(this.panelsAffectedByVariableChange=F.payload.panelIds.filter(H=>H!==(this.panelInEdit?.id??this.panelInView?.id))),this.startRefresh(F.payload)}variablesChangedInUrlHandler(F){this.templateVariableValueUpdated(),this.startRefresh(F.payload)}};let W=V;W.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,timeRangeUpdatedDuringEdit:!0};function w(F){return!!F.legend}function N(F,k,H){F.scopedVars??={},F.scopedVars[k.name]=H}},89167:(j,I,e)=>{"use strict";e.d(I,{G7:()=>y,Jg:()=>C,rY:()=>D});var t=e(89949),n=e.n(t),i=e(66117),s=e(62435),r=e(62247),g=e(83335),d=e(32713),l=e(39317),u=e(12308),o=e(89024),m=e(76897),c=e(43620),p=e(76543);const f={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},E={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,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},h={gridPos:{x:0,y:0,h:3,w:6},targets:[{refId:"A"}],cachedPluginOptions:{},transparent:!1,options:{},fieldConfig:{defaults:{},overrides:[]},title:""},y={graph:"timeseries","table-old":"table",singlestat:"stat","grafana-singlestat-panel":"stat","grafana-piechart-panel":"piechart","grafana-worldmap-panel":"geomap"},v={"heatmap-new":"heatmap"};class D{constructor(b){this.datasource=null,this.isViewing=!1,this.isEditing=!1,this.isInView=!1,this.configRev=0,this.cachedPluginOptions={},this.events=new s.F,this.restoreModel(b),this.replaceVariables=this.replaceVariables.bind(this),this.key=(0,i.Z)()}restoreModel(b){for(const T in this)f[T]||!this.hasOwnProperty(T)||b[T]||typeof this[T]!="function"&&typeof this[T]!="symbol"&&delete this[T];for(const T in b)this[T]=b[T];const M=v[this.type];M&&(this.autoMigrateFrom=this.type,this.type=M),(0,t.defaultsDeep)(this,(0,t.cloneDeep)(h)),this.ensureQueryIds()}generateNewKey(){this.key=(0,i.Z)()}ensureQueryIds(){if(this.targets&&(0,t.isArray)(this.targets))for(const b of this.targets)b.refId||(b.refId=(0,m.Hs)(this.targets))}getOptions(){return this.options}get hasChanged(){return this.configRev>0}updateOptions(b){this.options=b,this.configRev++,this.events.publish(new c.Wj),this.render()}updateFieldConfig(b){this.fieldConfig=b,this.configRev++,this.events.publish(new c.Wj),this.resendLastResult(),this.render()}getSaveModel(){const b={};for(const M in this)f[M]||!this.hasOwnProperty(M)||(0,t.isEqual)(this[M],h[M])||(b[M]=(0,t.cloneDeep)(this[M]));return this.type==="row"&&this.panels&&this.panels.length>0&&(b.panels=this.panels.map(M=>{if(M.libraryPanel){const{id:T,title:S,libraryPanel:x,gridPos:O}=M;return{id:T,title:S,gridPos:O,libraryPanel:{uid:x.uid,name:x.name}}}return M})),b}setIsViewing(b){this.isViewing=b}updateGridPos(b,M=!0){b.x===this.gridPos.x&&b.y===this.gridPos.y&&b.h===this.gridPos.h&&b.w===this.gridPos.w||(this.gridPos.x=b.x,this.gridPos.y=b.y,this.gridPos.w=b.w,this.gridPos.h=b.h,M&&this.configRev++,this.render())}runAllPanelQueries({dashboardUID:b,dashboardTimezone:M,timeData:T,width:S,publicDashboardAccessToken:x}){this.getQueryRunner().run({datasource:this.datasource,queries:this.targets,panelId:this.id,dashboardUID:b,publicDashboardAccessToken:x,timezone:M,timeRange:T.timeRange,timeInfo:T.timeInfo,maxDataPoints:this.maxDataPoints||Math.floor(S),minInterval:this.interval,scopedVars:this.scopedVars,cacheTimeout:this.cacheTimeout,queryCachingTTL:this.queryCachingTTL,transformations:this.transformations,app:this.isEditing?r.zj.PanelEditor:this.isViewing?r.zj.PanelViewer:r.zj.Dashboard})}refresh(){this.hasRefreshed=!0,this.events.publish(new d.U5)}render(){this.hasRefreshed?this.events.publish(new c._z):this.refresh()}getOptionsToRemember(){return Object.keys(this).reduce((b,M)=>f[M]||E[M]?b:{...b,[M]:this[M]},{})}restorePanelOptions(b){const M=this.cachedPluginOptions[b];M&&(Object.keys(M.properties).map(T=>{this[T]=M.properties[T]}),this.fieldConfig=(0,g.__)(this.fieldConfig,M.fieldConfig))}applyPluginOptionDefaults(b,M){const T=(0,g.d4)({plugin:b,currentOptions:this.options,currentFieldConfig:this.fieldConfig,isAfterPluginChange:M});this.fieldConfig=T.fieldConfig,this.options=T.options}pluginLoaded(b){this.plugin=b;const M=a(b);if(this.autoMigrateFrom){const T=y[this.autoMigrateFrom]!=null,S=this.getOptionsToRemember(),x=this.autoMigrateFrom,O=this.type;this.clearPropertiesBeforePluginChange(),this.type=O,this.plugin=b,this.callPanelTypeChangeHandler(b,x,S,T)}b.onPanelMigration&&M!==this.pluginVersion&&(this.options=b.onPanelMigration(this),this.pluginVersion=M),this.applyPluginOptionDefaults(b,!1),this.resendLastResult()}clearPropertiesBeforePluginChange(){for(const b of(0,t.keys)(this))E[b]||delete this[b];this.options={},this.fieldConfig={defaults:{...this.fieldConfig.defaults,custom:{}},overrides:(0,g.aS)(this.fieldConfig.overrides,g._k)}}callPanelTypeChangeHandler(b,M,T,S){if(b.onPanelTypeChanged){const x=S?{angular:T}:T.options;Object.assign(this.options,b.onPanelTypeChanged(this,M,x,this.fieldConfig))}}changePlugin(b){const M=b.meta.id,T=this.getOptionsToRemember(),S=this.fieldConfig,x=this.type,O=this.isAngularPlugin()||!!y[x];this.cachedPluginOptions[x]={properties:T,fieldConfig:S},this.clearPropertiesBeforePluginChange(),this.restorePanelOptions(M),this.callPanelTypeChangeHandler(b,x,T,O),this.type=M,this.plugin=b,this.configRev++,this.applyPluginOptionDefaults(b,!0),b.onPanelMigration&&(this.pluginVersion=a(b))}updateQueries(b){const{dataSource:M}=b;this.datasource={uid:M.uid,type:M.type},this.cacheTimeout=b.cacheTimeout,this.queryCachingTTL=b.queryCachingTTL,this.timeFrom=b.timeRange?.from,this.timeShift=b.timeRange?.shift,this.hideTimeOverride=b.timeRange?.hide,this.interval=b.minInterval,this.maxDataPoints=b.maxDataPoints,this.targets=b.queries,this.configRev++,this.events.publish(new c.pO)}addQuery(b){b=b||{refId:"A"},b.refId=(0,m.Hs)(this.targets),this.targets.push(b),this.configRev++}changeQuery(b,M){b.refId=this.targets[M].refId,this.configRev++,this.targets=this.targets.map((T,S)=>S===M?b:T)}getEditClone(){const b=this.getSaveModel(),M=new D(b);M.isEditing=!0,M.plugin=this.plugin;const T=this.getQueryRunner();return M.getQueryRunner().useLastResultFrom(T),M}getTransformations(){return this.transformations}getFieldOverrideOptions(){if(this.plugin)return{fieldConfig:this.fieldConfig,replaceVariables:this.replaceVariables,fieldConfigRegistry:this.plugin.fieldConfigRegistry,theme:u.default.theme2}}getDataSupport(){return this.plugin?.dataSupport??{annotations:!1,alertStates:!1}}getQueryRunner(){return this.queryRunner||(this.queryRunner=new p.o(this)),this.queryRunner}hasTitle(){return this.title&&this.title.length>0}isAngularPlugin(){return(this.plugin&&this.plugin.angularPanelCtrl)!==void 0}destroy(){this.events.removeAllListeners(),this.queryRunner&&this.queryRunner.destroy()}setTransformations(b){this.transformations=b,this.resendLastResult(),this.configRev++,this.events.publish(new c.Xw)}setProperty(b,M){this[b]=M,this.configRev++,b==="repeat"&&(this.repeat&&!this.repeatDirection?this.repeatDirection="h":this.repeat||(delete this.repeatDirection,delete this.maxPerRow))}replaceVariables(b,M,T){const S=this.getQueryRunner().getLastRequest(),x=Object.assign({},this.scopedVars,S?.scopedVars,M);return(0,l.J)().replace(b,x,T)}resendLastResult(){this.plugin&&this.getQueryRunner().resendLastResult()}getDisplayTitle(){return this.replaceVariables(this.title,void 0,"text")}initLibraryPanel(b){for(const[M,T]of Object.entries(b.model)){switch(M){case"id":case"gridPos":case"libraryPanel":continue}this[M]=T}this.libraryPanel=b}unlinkLibraryPanel(){delete this.libraryPanel,this.configRev++,this.render()}}function a(P){return P&&P.meta.info.version?P.meta.info.version:u.default.buildInfo.version}function C(P){const b={};return Object.entries(P).filter(([M,T])=>!f[M]&&P.hasOwnProperty(M)&&!(0,t.isEqual)(T,h[M])).forEach(([M,T])=>{b[M]=T}),(0,o.Xh)(b)}},42997:(j,I,e)=>{"use strict";e.d(I,{$j:()=>y,Qk:()=>E,RF:()=>f,Yq:()=>h,f4:()=>C,fG:()=>v,lw:()=>D,qm:()=>c,tM:()=>a});var t=e(73289),n=e(33877),i=e(73807),s=e(284),r=e(47875),g=e(83341),d=e(30235),l=e(4684),u=e(75261),o=e(26858),m=e(10974);function c(P){return async b=>{const M=await(0,t.i)().get(`/api/dashboards/id/${P}/permissions`);b((0,m.O0)(M))}}function p(P){return{userId:P.userId,teamId:P.teamId,role:P.role,permission:P.permission}}function f(P,b,M){return async(T,S)=>{const{dashboard:x}=S(),O=[];for(const B of x.permissions){if(B.inherited)continue;const A=p(B);b===B&&(A.permission=M),O.push(A)}await(0,t.i)().post(`/api/dashboards/id/${P}/permissions`,{items:O}),await T(c(P))}}function E(P,b){return async(M,T)=>{const S=T().dashboard,x=[];for(const O of S.permissions)O.inherited||O===b||x.push(p(O));await(0,t.i)().post(`/api/dashboards/id/${P}/permissions`,{items:x}),await M(c(P))}}function h(P,b){return async(M,T)=>{const{dashboard:S}=T(),x=[];for(const O of S.permissions)O.inherited||x.push(p(O));x.push({userId:b.userId,teamId:b.teamId,role:b.role,permission:b.permission}),await(0,t.i)().post(`/api/dashboards/id/${P}/permissions`,{items:x}),await M(c(P))}}function y(P,b){return async M=>{await(0,t.i)().post("/api/dashboards/import",P),M((0,n.$l)((0,i.AT)("Dashboard Imported",b))),M((0,d.m3)())}}function v(P){return async b=>{await(0,t.i)().delete(`/api/dashboards/uid/${P}`),b((0,d.m3)())}}const D=()=>(P,b)=>{const T=b().dashboard.getModel();T&&(T.destroy(),P((0,l.wX)(T.uid))),(0,o.$t)().stopAutoRefresh(),P((0,m.sG)()),P((0,r.Vl)()),s.H.leave(),(0,u.h4)().setCurrent(void 0)},a=P=>b=>{b((0,g.YT)(P)),(0,o.$t)().refreshTimeModel()},C=P=>b=>{b((0,g.zW)(P)),(0,o.$t)().refreshTimeModel()}},73170:(j,I,e)=>{"use strict";e.d(I,{f:()=>t.f,r:()=>n.rY});var t=e(85991),n=e(89167)},54195:(j,I,e)=>{"use strict";e.d(I,{ZQ:()=>w,mV:()=>W,f1:()=>k,$M:()=>F});var t=e(94469),n=e(99633),i=e(84714),s=e(26129),r=e(34667),g=e(73289),d=e(33877),l=e(5933),u=e(73807),o=e(45937),m=e(56812),c=e(46823),p=e(75261),f=e(26858),E=e(35381),h=e(284),y=e(79517),v=e(81587),D=e(18771),a=e(77972),C=e(4684),P=e(51824),b=e(86312);function M(H,R){const _=H.templating.list.map(G=>G.type).reduce((G,Y)=>(G[T(Y)]=1+G[T(Y)]||1,G),{});(0,b.ff)("dashboards_init_dashboard_completed",{uid:H.uid,title:H.title,theme:H.style,schemaVersion:H.schemaVersion,version_before_migration:R,panels_count:H.panels.length,..._})}const T=H=>`variable_type_${H}_count`;var S=e(85991),x=e(9175);function O(H){const R={dashboardId:H.id,dashboardName:H.title,dashboardUid:H.uid,folderName:H.meta.folderTitle,eventName:x.ct.DashboardView};(0,b.r_)(R)}var B=e(10974);async function A(H,R,_){const G=m.Z.getObject(N);if(G)return k(),G;try{switch(H.routeName){case D.DashboardRoutes.Home:{const Y=await o.ae.get("/api/dashboards/home");if(Y.redirectUri){const X=t.u.stripBaseFromUrl(Y.redirectUri);return s.E1.replace(X),null}return Y.meta.canSave=!1,Y.meta.canShare=!1,Y.meta.canStar=!1,Y}case D.DashboardRoutes.Public:return await c.pD.loadDashboard("public",H.urlSlug,H.accessToken);case D.DashboardRoutes.Embedded:if(H.dashboardDto)return H.dashboardDto;case D.DashboardRoutes.Normal:{const Y=await c.pD.loadDashboard(H.urlType,H.urlSlug,H.urlUid);if(r.config.featureToggles.nestedFolders&&Y.meta.folderUid&&await R((0,E.Pb)(Y.meta.folderUid)),H.fixUrl&&Y.meta.url&&!y.r0.isPlaying){const X=t.u.stripBaseFromUrl(Y.meta.url),Q=s.E1.getLocation().pathname;X!==Q&&(s.E1.replace({...s.E1.getLocation(),pathname:X}),console.log("not correct url correcting",X,Q))}return Y}case D.DashboardRoutes.New:return r.config.featureToggles.nestedFolders&&H.urlFolderUid&&await R((0,E.Pb)(H.urlFolderUid)),w(H.urlFolderUid,H.panelType);case D.DashboardRoutes.Path:{const Y=H.urlSlug??"";return await c.pD.loadDashboard(D.DashboardRoutes.Path,Y,Y)}default:throw{message:"Unknown route "+H.routeName}}}catch(Y){return(0,g.kW)(Y)&&Y.cancelled||(R((0,B.jA)({message:"Failed to fetch dashboard",error:Y})),console.error(Y)),null}}const V=(H,R={})=>(H.forEach(_=>{_.panels?V(_.panels,R):_.targets&&_.targets.forEach(G=>{G.datasource?.type&&(R[G.datasource.type]?R[G.datasource.type].push(G):R[G.datasource.type]=[G])})}),R);function W(H){return async(R,_)=>{R((0,B.sf)());const G=await A(H,R,_),Y=G?.dashboard?.version;if(!G)return;R((0,B.Nv)());let X;try{X=new S.f(G.dashboard,G.meta)}catch(ne){R((0,B.jA)({message:"Failed create dashboard model",error:ne})),console.error(ne);return}const Q=_(),se=s.E1.getSearchObject();se.orgId||s.E1.partial({orgId:Q.user.orgId},!0);const Z=(0,f.$t)();(0,p.h4)().setCurrent(X),Z.init(X);const oe=(0,v.mn)(H.urlUid??X.uid);if(await R((0,C.LX)(oe,X)),(0,a.Tl)({dashboard:X,timeSrv:Z}).run({dashboard:X,range:Z.timeRange()}),(0,P.cp)(_())===oe&&_().dashboard.initPhase===D.DashboardInitPhase.Services){try{X.processRepeats(),se.autofitpanels&&X.autoFitPanels(window.innerHeight,se.kiosk),H.keybindingSrv.setupDashboardBindings(X)}catch(ne){ne instanceof Error&&R((0,d.$l)((0,u.t_)("Dashboard init failed",ne))),console.error(ne)}H.routeName!==D.DashboardRoutes.New?(O(X),h.H.watch(X.uid)):h.H.leave(),X.weekStart!==""?(0,n.Ls)(X.weekStart):(0,n.Ls)(r.config.bootData.user.weekStart),l.Z.publish(new i.Pl({dashboardId:X.uid,orgId:Q.user.orgId,userId:Q.user.user?.id,grafanaVersion:r.config.buildInfo.version,queries:V(X.panels)})),M(X,Y),R((0,B.dS)(X))}}}function w(H,R){const _=r.config.featureToggles.emptyDashboardPage?[]:[{type:R??"add-panel",gridPos:{x:0,y:0,w:12,h:9},title:"Panel Title"}],G={meta:{canStar:!1,canShare:!1,canDelete:!1,isNew:!0,folderUid:""},dashboard:{title:"New dashboard",panels:_}};return H&&(G.meta.folderUid=H),G}const N="DASHBOARD_FROM_LS_KEY";function F(H){m.Z.setObject(N,H)}function k(){m.Z.delete(N)}},10974:(j,I,e)=>{"use strict";e.d(I,{Nv:()=>c,O0:()=>l,Rd:()=>E,ZP:()=>y,dS:()=>m,jA:()=>o,sG:()=>p,sf:()=>u,tq:()=>f});var t=e(34099),n=e(48414),i=e(58198),s=e(18771),r=e(85991);const g={initPhase:s.DashboardInitPhase.NotStarted,getModel:()=>null,permissions:[],initError:null,initialDatasource:void 0},d=(0,t.oM)({name:"dashboard",initialState:g,reducers:{loadDashboardPermissions:(v,D)=>{v.permissions=(0,i.A)(D.payload)},dashboardInitFetching:v=>{v.initPhase=s.DashboardInitPhase.Fetching},dashboardInitServices:v=>{v.initPhase=s.DashboardInitPhase.Services},dashboardInitCompleted:(v,D)=>{v.getModel=()=>D.payload,v.initPhase=s.DashboardInitPhase.Completed},dashboardInitFailed:(v,D)=>{v.initPhase=s.DashboardInitPhase.Failed,v.initError=D.payload,v.getModel=()=>new r.f({...n.Ql,title:"Dashboard init failed"},{canSave:!1,canEdit:!1})},cleanUpDashboard:v=>{v.initPhase=s.DashboardInitPhase.NotStarted,v.initError=null,v.getModel=()=>null},addPanel:(v,D)=>{},setInitialDatasource:(v,D)=>{v.initialDatasource=D.payload}}}),{loadDashboardPermissions:l,dashboardInitFetching:u,dashboardInitFailed:o,dashboardInitCompleted:m,dashboardInitServices:c,cleanUpDashboard:p,addPanel:f,setInitialDatasource:E}=d.actions,y={dashboard:d.reducer}},8594:(j,I,e)=>{"use strict";e.d(I,{AI:()=>l,Dh:()=>m,LU:()=>d,L_:()=>u,RB:()=>o,uZ:()=>c});var t=e(89949),n=e.n(t),i=e(12308),s=e(97957),r=e(56812),g=e(22377);function d(p,f){const E={type:"timeseries",title:"Panel Title",gridPos:(0,g.lg)(p),datasource:f?{uid:f}:null,isNew:!0};return p.addPanel(E),E.id}function l(p,f){const E={type:f,title:"Widget title",gridPos:(0,g.lg)(p),datasource:null,isNew:!0};return p.addPanel(E),E.id}function u(p){const f={type:"row",title:"Row title",gridPos:{x:0,y:0}};p.addPanel(f)}function o(p){const f={type:"add-library-panel",gridPos:(0,g.lg)(p)};p.addPanel(f)}function m(p,f){if(!f)return;const E=(0,g.lg)(p),h={type:f.id,title:"Panel Title",gridPos:{x:E.x,y:E.y,w:f.defaults.gridPos.w,h:f.defaults.gridPos.h}};f.defaults&&((0,t.defaults)(h,f.defaults),h.title=f.defaults.title,r.Z.delete(s.zF)),p.addPanel(h)}function c(){const p=(0,t.chain)(i.default.panels).filter({hideFromList:!1}).map(E=>E).value(),f=r.Z.get(s.zF);if(f){const E=JSON.parse(f),h=(0,t.find)(p,{id:E.type});if(h){const y=(0,t.cloneDeep)(h);return y.name=E.title,y.sort=-1,{...y,defaults:{...E}}}}}},22377:(j,I,e)=>{"use strict";e.d(I,{Kq:()=>P,Po:()=>C,W1:()=>S,WJ:()=>v,bY:()=>a,jN:()=>D,lg:()=>B,oe:()=>b,qw:()=>T});var t=e(89949),n=e.n(t),i=e(3935),s=e(76305),r=e(1726),g=e(39317),d=e(5933),l=e(12308),u=e(97957),o=e(56812),m=e(19067),c=e(89167),p=e(14673),f=e(97816),E=e(32195),h=e(84749),y=e(43620);const v=(A,V,W)=>{if(W!==!1){const w=V.alert&&!l.default.unifiedAlertingEnabled?"Panel includes an alert rule. removing the panel will also remove the alert rule":void 0,N=V.alert?"YES":void 0;d.Z.publish(new y.VJ({title:"Remove panel",text:"Are you sure you want to remove this panel?",text2:w,icon:"trash-alt",confirmText:N,yesText:"Remove",onConfirm:()=>v(A,V,!1)}));return}A.removePanel(V),(0,h.WI)((0,E.qj)(V.key))},D=(A,V)=>{A.duplicatePanel(V)},a=A=>{let V=A;A instanceof c.rY&&(V=A.getSaveModel()),o.Z.set(u.zF,JSON.stringify(V)),d.Z.emit(i.SI.alertSuccess,["Panel copied. Click **Add panel** icon to paste."])},C=(A,V)=>{d.Z.publish(new y.Dn({component:m.ShareModal,props:{dashboard:A,panel:V}}))},P=(A,V)=>{d.Z.publish(new y.Dn({component:p.c,props:{panel:V,initialFolderUid:A.meta.folderUid,isOpen:!0}}))},b=A=>{d.Z.publish(new y.Dn({component:f.i,props:{onConfirm:()=>A.unlinkLibraryPanel(),isOpen:!0}}))},M=A=>{A.refresh()},T=A=>{const V={...A.options};V.legend.showLegend===!0?V.legend.showLegend=!1:V.legend.showLegend=!0,A.updateOptions(V)};function S(A,V){const W={timeInfo:"",timeRange:V};if(A.timeFrom){const w=(0,g.J)().replace(A.timeFrom,A.scopedVars),N=s.describeTextRange(w);if(N.invalid)return W.timeInfo="invalid time override",W;if((0,t.isString)(V.raw.from)){const F=r.parse(N.from);W.timeInfo=N.display,W.timeRange={from:F,to:r.parse(N.to),raw:{from:N.from,to:N.to}}}}if(A.timeShift){const w=(0,g.J)().replace(A.timeShift,A.scopedVars);if(s.describeTextRange(w).invalid)return W.timeInfo="invalid timeshift",W;const F="-"+w;W.timeInfo+=" timeshift "+F;const k=r.parseDateMath(F,W.timeRange.from,!1),H=r.parseDateMath(F,W.timeRange.to,!0);W.timeRange={from:k,to:H,raw:{from:k,to:H}}}return A.hideTimeOverride&&(W.timeInfo=""),W}function x(A){const W=document.getElementsByTagName("html")[0].getBoundingClientRect().width;return A.maxDataPoints?A.maxDataPoints:Math.ceil(W*(A.gridPos.w/24))}function O(A,V){const W=A.plugin&&A.plugin.noPadding?0:config.theme.panelPadding*2,w=A.hasTitle()?config.theme.panelHeaderHeight:0;return V-w-W-PANEL_BORDER}function B(A){for(const W of A.panelIterator())W.gridPos.y+=8;return{x:0,y:0,w:12,h:8}}},56074:(j,I,e)=>{"use strict";e.d(I,{O:()=>i});var t=e(99633),n=e(1726);const i=(s,r)=>{const g={from:(0,t.v9)(s.from)?(0,t.CQ)(s.from):s.from,to:(0,t.v9)(s.to)?(0,t.CQ)(s.to):s.to},d=r?r.getTimezone():void 0;return{from:n.parse(g.from,!1,d,r?.fiscalYearStartMonth),to:n.parse(g.to,!0,d,r?.fiscalYearStartMonth),raw:g}}},40397:(j,I,e)=>{"use strict";e.d(I,{DK:()=>g,eM:()=>r,dg:()=>d});var t=e(48592),n=e(32053);function i(l){const u=new Set;return Object.keys(l).forEach(o=>{l[o].forEach(m=>{u.add(m)})}),u}function s(l){const u=Array.from(i(l));return u.length===1?u[0]:`${u.slice(0,-1).join(", ")} or ${u.slice(-1)}`}function r(l){return new t.y(u=>{let o=0;Promise.all([e.e(5961),e.e(1378)]).then(e.bind(e,45961)).then(m=>{l.forEach(c=>{const p=new FileReader;p.readAsArrayBuffer(c),p.onload=()=>{const f=p.result;if(f&&f instanceof ArrayBuffer){if(c.type==="application/json"){const E=new TextDecoder("utf-8"),h=JSON.parse(E.decode(f));u.next({dataFrames:[(0,n.g0)(h)],file:c})}else u.next({dataFrames:m.readSpreadsheet(f),file:c});++o>=l.length&&u.complete()}}})}).catch(()=>{throw"Failed to load sheets module"})})}const g={"text/plain":[".csv",".txt"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.ms-excel":[".xls"],"application/vnd.apple.numbers":[".numbers"],"application/vnd.oasis.opendocument.spreadsheet":[".ods"],"application/json":[".json"]},d=5e5},34518:(j,I,e)=>{"use strict";e.d(I,{P:()=>g});var t=e(27702),n=e(66670),i=e(66574),s=e(90131),r=e(18771);function g({variant:d,onClick:l}){const u=i.Vt.hasPermission(r.AccessControlAction.DataSourcesCreate),o=s.Z.DataSourcesNew;return t.createElement(n.Qj,{variant:d||"primary",href:o,disabled:!u,tooltip:u?void 0:"You do not have permission to configure new data sources",onClick:l,target:"_blank"},"Configure a new data source")}},42784:(j,I,e)=>{"use strict";e.d(I,{F:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(50230),r=e(86004);function g({ds:l,onClick:u,selected:o,description:m,...c}){const p=(0,i.wW)(d);return n.createElement(s.Z,{key:l.uid,onClick:u,className:(0,t.cx)(p.card,o?p.selected:void 0),...c},n.createElement(s.Z.Heading,{className:p.heading},n.createElement("div",{className:p.headingContent},n.createElement("span",{className:p.name},l.name," ",l.isDefault?n.createElement(r.P,{tags:["default"]}):null),n.createElement("small",{className:p.type},m||l.meta.name))),n.createElement(s.Z.Figure,{className:p.logo},n.createElement("img",{src:l.meta.info.logos.small,alt:`${l.meta.name} Logo`})))}function d(l){return{card:(0,t.css)` cursor: pointer; background-color: ${l.colors.background.primary}; border-bottom: 1px solid ${l.colors.border.weak}; // Move to list component margin-bottom: 0; border-radius: 0; padding: ${l.spacing(1)}; `,heading:(0,t.css)` width: 100%; overflow: hidden; // This is needed to enable ellipsis when text overlfows > button { width: 100%; } `,headingContent:(0,t.css)` color: ${l.colors.text.secondary}; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; justify-content: space-between; `,logo:(0,t.css)` width: 32px; height: 32px; padding: ${l.spacing(0,1)}; display: flex; align-items: center; > img { max-height: 100%; min-width: 24px; } `,name:(0,t.css)` color: ${l.colors.text.primary}; display: flex; gap: ${l.spacing(2)}; `,type:(0,t.css)` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; `,separator:(0,t.css)` margin: 0 ${l.spacing(1)}; color: ${l.colors.border.weak}; `,selected:(0,t.css)` background-color: ${l.colors.background.secondary}; `,meta:(0,t.css)` display: block; overflow-wrap: unset; white-space: nowrap; width: 100%; overflow: hidden; text-overflow: ellipsis; `}}},31190:(j,I,e)=>{"use strict";e.d(I,{K:()=>u});var t=e(42844),n=e(27702),i=e(39317),s=e(66310),r=e(66691),g=e(34518),d=e(42784),l=e(10520);function u(f){const E=(0,n.useRef)(null),[h,y]=(0,r.wv)({keyboardEvents:f.keyboardEvents,containerRef:E}),v=(0,s.l4)(),D=p(v,y),{className:a,current:C,onChange:P,enableKeyboardNavigation:b,onClickEmptyStateCTA:M}=f,T=(0,r.Hq)({alerting:f.alerting,annotations:f.annotations,dashboard:f.dashboard,logs:f.logs,metrics:f.metrics,mixed:f.mixed,pluginId:f.pluginId,tracing:f.tracing,type:f.type,variables:f.variables}),[S,x]=(0,r.BM)(),O=f.filter?T.filter(f.filter):T;return n.createElement("div",{ref:E,className:(0,t.cx)(a,D.container),"data-testid":"data-sources-list"},O.length===0&&n.createElement(o,{className:D.emptyState,onClickCTA:M}),O.sort((0,l.Tw)(C,S,c())).map(B=>n.createElement(d.F,{"data-testid":"data-source-card",key:B.uid,ds:B,onClick:()=>{x(B),P(B)},selected:(0,l.TX)(B,C),...b?h:{}})))}function o({className:f,onClickCTA:E}){const h=(0,s.wW)(m);return n.createElement("div",{className:(0,t.cx)(f,h.container)},n.createElement("p",{className:h.message},"No data sources found"),n.createElement(g.P,{onClick:E}))}function m(f){return{container:(0,t.css)` display: flex; flex-direction: column; justify-content: center; align-items: center; `,message:(0,t.css)` margin-bottom: ${f.spacing(3)}; `}}function c(){return(0,i.J)().getVariables().filter(E=>E.type==="datasource").map(E=>`\${${E.id}}`)}function p(f,E){return{container:(0,t.css)` display: flex; flex-direction: column; ${E} { background-color: ${f.colors.background.secondary}; } `,emptyState:(0,t.css)` height: 100%; flex: 1; `}}},56250:(j,I,e)=>{"use strict";e.d(I,{a:()=>b});var t=e(42844),n=e(89949),i=e(27702),s=e(86312),r=e(34667),g=e(66310),d=e(13741),l=e(1128),u=e(73453),o=e(29372),m=e(79399),c=e(40397),p=e(75506),f=e(66691),E=e(34518),h=e(42784),y=e(10520);const v={grafana:"Discover visualizations using mock data","-- Mixed --":"Use multiple data sources","-- Dashboard --":"Reuse query results from other visualizations"};function D({className:T,current:S,onChange:x,tracing:O,dashboard:B,mixed:A,metrics:V,type:W,annotations:w,variables:N,alerting:F,pluginId:k,logs:H,filter:R}){const G=(0,f.Hq)({tracing:O,dashboard:B,mixed:A,metrics:V,type:W,annotations:w,variables:N,alerting:F,pluginId:k,logs:H}).filter(Y=>(R?R?.(Y):!0)&&!!Y.meta.builtIn);return i.createElement("div",{className:T,"data-testid":"built-in-data-sources-list"},G.map(Y=>i.createElement(h.F,{key:Y.uid,ds:Y,description:v[Y.uid],selected:(0,y.TX)(Y,S),onClick:()=>x(Y)})))}var a=e(31190);const C="dashboards_dspickermodal_clicked",P={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 b({tracing:T,dashboard:S,mixed:x,metrics:O,type:B,annotations:A,variables:V,alerting:W,pluginId:w,logs:N,uploadFile:F,filter:k,onChange:H,current:R,onDismiss:_,reportedInteractionFrom:G}){const Y=(0,g.wW)(M),[X,Q]=(0,i.useState)(""),se=G||"modal",Z=()=>{_(),(0,s.ff)(C,{item:P.DISMISS,src:se})},le=ae=>{H(ae),(0,s.ff)(C,{item:P.SELECT_DS,ds_type:ae.type,src:se})},oe=i.useMemo(()=>(0,n.once)(()=>{(0,s.ff)(C,{item:"search",src:se})}),[se]),q=(0,f.wP)("-- Grafana --"),ne=(0,p.k)((ae,re)=>{q&&(H(q,[ae]),(0,s.ff)(C,{item:P.UPLOAD_FILE,src:se}),re.length<1&&_())}),ge=({className:ae})=>i.createElement(D,{className:ae,onChange:le,current:R,filter:k,variables:V,tracing:T,metrics:O,type:B,annotations:A,alerting:W,pluginId:w,logs:N,dashboard:S,mixed:x});return i.createElement(d.u,{title:"Select data source",closeOnEscape:!0,closeOnBackdropClick:!0,isOpen:!0,className:Y.modal,contentClassName:Y.modalContent,onClickBackdrop:Z,onDismiss:Z},i.createElement("div",{className:Y.leftColumn},i.createElement(l.I,{type:"search",autoFocus:!0,className:Y.searchInput,value:X,prefix:i.createElement(u.J,{name:"search"}),placeholder:"Search data source",onChange:ae=>{Q(ae.currentTarget.value),oe()}}),i.createElement(o.$,null,i.createElement(a.K,{onChange:le,current:R,onClickEmptyStateCTA:()=>(0,s.ff)(C,{item:P.CONFIG_NEW_DS_EMPTY_STATE,src:se}),filter:ae=>(k?k?.(ae):!0)&&(0,y.qW)(ae,X)&&!ae.meta.builtIn,variables:V,tracing:T,metrics:O,type:B,annotations:A,alerting:W,pluginId:w,logs:N,dashboard:S,mixed:x}),i.createElement(ge,{className:Y.appendBuiltInDataSourcesList}))),i.createElement("div",{className:Y.rightColumn},i.createElement("div",{className:Y.builtInDataSources},i.createElement(o.$,{className:Y.builtInDataSourcesList},i.createElement(ge,null)),F&&r.config.featureToggles.editPanelCSVDragAndDrop&&i.createElement(m.Yo,{readAs:"readAsArrayBuffer",fileListRenderer:()=>{},options:{maxSize:c.dg,multiple:!1,accept:c.DK,onDrop:ne}},i.createElement(m.A_,null))),i.createElement("div",{className:Y.newDSSection},i.createElement("span",{className:Y.newDSDescription},"Open a new tab and configure a data source"),i.createElement(E.P,{variant:"secondary",onClick:()=>{(0,s.ff)(C,{item:P.CONFIG_NEW_DS,src:se}),_()}}))))}function M(T){return{modal:(0,t.css)` width: 80%; height: 80%; max-width: 1200px; max-height: 900px; ${T.breakpoints.down("md")} { width: 100%; } `,modalContent:(0,t.css)` display: flex; flex-direction: row; height: 100%; ${T.breakpoints.down("md")} { flex-direction: column; } `,leftColumn:(0,t.css)` display: flex; flex-direction: column; width: 50%; height: 100%; padding-right: ${T.spacing(4)}; border-right: 1px solid ${T.colors.border.weak}; ${T.breakpoints.down("md")} { width: 100%; border-right: 0; padding-right: 0; flex: 1; overflow-y: auto; } `,rightColumn:(0,t.css)` display: flex; flex-direction: column; width: 50%; height: 100%; justify-items: space-evenly; align-items: stretch; padding-left: ${T.spacing(4)}; ${T.breakpoints.down("md")} { width: 100%; padding-left: 0; flex: 0; } `,builtInDataSources:(0,t.css)` flex: 1 1; margin-bottom: ${T.spacing(4)}; ${T.breakpoints.down("md")} { flex: 0; } `,builtInDataSourcesList:(0,t.css)` ${T.breakpoints.down("md")} { display: none; margin-bottom: 0; } margin-bottom: ${T.spacing(4)}; `,appendBuiltInDataSourcesList:(0,t.css)` ${T.breakpoints.up("md")} { display: none; } `,newDSSection:(0,t.css)` display: flex; flex-direction: row; width: 100%; justify-content: space-between; align-items: center; `,newDSDescription:(0,t.css)` flex: 1 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color: ${T.colors.text.secondary}; `,searchInput:(0,t.css)` width: 100%; min-height: 32px; margin-bottom: ${T.spacing(1)}; `}}},53229:(j,I,e)=>{"use strict";e.d(I,{q:()=>G});var t=e(27702),n=e(94372),i=e(12308),s=e(42844),r=e(45809),g=e(91546),d=e(6714),l=e(76566),u=e(74639),o=e(86312),m=e(66310),c=e(1128),p=e(73453),f=e(52995),E=e(29372),h=e(60729),y=e(66670),v=e(63419),D=e(89050),a=e(66691),C=e(31190);function P(Y){const{dataSource:X}=Y,Q=(0,m.wW)(M);return X?t.createElement("img",{className:Q.pickerDSLogo,alt:`${X.meta.name} logo`,src:X.meta.info.logos.small}):b()}function b(){const Y=(0,m.wW)(M);return t.createElement("div",{className:Y.pickerDSLogo})}function M(Y){return{pickerDSLogo:(0,s.css)` height: 20px; width: 20px; `}}var T=e(56250),S=e(77696);const x=20,O=200,B={name:"maxSize",enabled:!0,phase:"main",requires:["offset","preventOverflow","flip"],fn({state:Y,name:X,options:Q}){const se=(0,S.Z)(Y,Q),{x:Z,y:le}=Y.modifiersData.preventOverflow||{x:0,y:0},{width:oe,height:q}=Y.rects.popper,{width:ne}=Y.rects.reference,[ge]=Y.placement.split("-"),ae=ge==="left"?"left":"right",re=ge==="top"?"top":"bottom";Y.modifiersData[X]={maxWidth:oe-se[ae]-Z,maxHeight:q-se[re]-le,minWidth:ne}}},A={name:"applyMaxSize",enabled:!0,phase:"beforeWrite",requires:["maxSize"],fn({state:Y}){const{maxHeight:X,maxWidth:Q,minWidth:se}=Y.modifiersData.maxSize;Y.styles.popper.maxHeight??=`${X-x}px`,Y.styles.popper.minHeight??=`${O}px`,Y.styles.popper.maxWidth??=Q,Y.styles.popper.minWidth??=se}};var V=e(10520);const W="dashboards_dspicker_clicked",w={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 N(Y){const{current:X,onChange:Q,hideTextValue:se=!1,width:Z,inputId:le,noDefault:oe=!1,disabled:q=!1,placeholder:ne="Select data source",...ge}=Y,ae=(0,m.wW)(Ae=>F(Ae,Y)),[re,De]=(0,t.useState)(!1),[he,ye]=(0,t.useState)(!1),[ce,We]=(0,t.useState)(""),{onKeyDown:ke,keyboardEvents:et}=(0,v.A)(),we=(0,t.useRef)(null),[_e,Ge]=(0,t.useState)(),[qe,st]=(0,t.useState)(),[Me,be]=(0,t.useState)(),Ke=(0,a.wP)(X),Ye=(0,a.wP)("-- Grafana --"),tt=!X&&oe?void 0:Ke,nt=ce&&re?t.createElement(b,null):t.createElement(P,{dataSource:tt}),Pt=(0,l.D)(_e,qe,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,4]}},B,A]}),xt=(0,t.useCallback)(()=>{We(""),De(!1),_e?.focus()},[De,_e]),{overlayProps:bt,underlayProps:Rt}=(0,d.Ir)({onClose:xt,isDismissable:!0,isOpen:re,shouldCloseOnInteractOutside:Ae=>_e?!_e.isSameNode(Ae):!1},we),{dialogProps:ct}=(0,r.R)({"aria-label":"Opened data source picker list"},we);function it(){(0,o.ff)(W,{item:w.OPEN_DROPDOWN}),De(!0),_e?.focus()}function me(){Ye&&Q(Ye,[D.ip])}function Ee(Ae){Ae.key==="Tab"&&!Ae.shiftKey&&re&&(Ae.preventDefault(),Me?.focus()),Ae.key==="Tab"&&Ae.shiftKey&&re&&xt(),ke(Ae)}function Ce(Ae){Ae.shiftKey?(Ae.preventDefault(),_e?.focus()):xt()}return(0,t.useEffect)(()=>{const Ae=et.subscribe({next:ze=>{switch(ze?.code){case"ArrowDown":it(),ze.preventDefault();break;case"ArrowUp":it(),ze.preventDefault();break;case"Escape":xt(),ze.preventDefault();break}}});return()=>Ae.unsubscribe()}),t.createElement("div",{className:ae.container,"data-testid":u.wl.components.DataSourcePicker.container},t.createElement("div",{className:ae.trigger,onClick:it},t.createElement(c.I,{id:le||"data-source-picker",className:he?void 0:ae.input,"data-testid":u.wl.components.DataSourcePicker.inputV2,"aria-label":"Select a data source",autoComplete:"off",prefix:tt?nt:void 0,suffix:t.createElement(p.J,{name:re?"search":"angle-down"}),placeholder:se?"":(0,V.Ve)(tt)||ne,onFocus:()=>{ye(!0)},onBlur:()=>{ye(!1)},onKeyDown:Ee,value:ce,onChange:Ae=>{it(),We(Ae.currentTarget.value)},ref:Ge,disabled:q})),re?t.createElement(f.h_,null,t.createElement("div",{...Rt}),t.createElement("div",{ref:we,...bt,...ct},t.createElement(k,{...ge,...Pt.attributes.popper,style:Pt.styles.popper,ref:st,footerRef:be,current:tt,filterTerm:ce,keyboardEvents:et,onChange:(Ae,ze)=>{xt(),Ae.uid!==tt?.uid&&(Q(Ae,ze),(0,o.ff)(W,{item:w.SELECT_DS,ds_type:Ae.type}))},onClose:xt,onClickAddCSV:me,onDismiss:xt,onNavigateOutsiteFooter:Ce}))):null)}function F(Y,X){return{container:(0,s.css)` position: relative; cursor: ${X.disabled?"not-allowed":"pointer"}; width: ${Y.spacing(X.width||"auto")}; `,trigger:(0,s.css)` cursor: pointer; ${X.disabled&&"pointer-events: none;"} `,input:(0,s.css)` input::placeholder { color: ${X.disabled?Y.colors.action.disabledText:Y.colors.text.primary}; } `}}const k=t.forwardRef((Y,X)=>{const{filterTerm:Q,onChange:se,onClose:Z,onClickAddCSV:le,current:oe,filter:q}=Y,ne=(0,t.useCallback)(re=>{se(re)},[se]),ge=(0,t.useCallback)(()=>{le?.(),Z(),(0,o.ff)(W,{item:w.ADD_FILE})},[le,Z]),ae=(0,m.wW)(H);return t.createElement("div",{style:Y.style,ref:X,className:ae.container},t.createElement(E.$,null,t.createElement(C.K,{...Y,enableKeyboardNavigation:!0,className:ae.dataSourceList,current:oe,onChange:ne,filter:re=>(q?q?.(re):!0)&&(0,V.qW)(re,Q),onClickEmptyStateCTA:()=>(0,o.ff)(W,{item:w.CONFIG_NEW_DS_EMPTY_STATE})})),t.createElement(g.MT,null,t.createElement(R,{...Y,onClickAddCSV:ge,onChange:ne,onNavigateOutsiteFooter:Y.onNavigateOutsiteFooter})))});k.displayName="PickerContent";function H(Y){return{container:(0,s.css)` display: flex; flex-direction: column; background: ${Y.colors.background.primary}; box-shadow: ${Y.shadows.z3}; `,picker:(0,s.css)` background: ${Y.colors.background.secondary}; `,dataSourceList:(0,s.css)` flex: 1; `,footer:(0,s.css)` flex: 0; display: flex; flex-direction: row-reverse; justify-content: space-between; padding: ${Y.spacing(1.5)}; border-top: 1px solid ${Y.colors.border.weak}; background-color: ${Y.colors.background.secondary}; `}}function R({onClose:Y,onChange:X,onClickAddCSV:Q,...se}){const Z=(0,m.wW)(_),le=se.uploadFile&&i.default.featureToggles.editPanelCSVDragAndDrop,oe=ne=>{ne.key==="Tab"&&se.onNavigateOutsiteFooter(ne)},q=ne=>{ne.key==="Tab"&&ne.shiftKey&&se.onNavigateOutsiteFooter(ne)};return t.createElement("div",{className:Z.footer},t.createElement(h.JY,null,({showModal:ne,hideModal:ge})=>t.createElement(y.zx,{size:"sm",variant:"secondary",fill:"text",onClick:()=>{Y(),ne(T.a,{reportedInteractionFrom:"ds_picker",tracing:se.tracing,dashboard:se.dashboard,mixed:se.mixed,metrics:se.metrics,type:se.type,annotations:se.annotations,variables:se.variables,alerting:se.alerting,pluginId:se.pluginId,logs:se.logs,filter:se.filter,uploadFile:se.uploadFile,current:se.current,onDismiss:ge,onChange:(ae,re)=>{X(ae,re),ge()}}),(0,o.ff)(W,{item:w.OPEN_ADVANCED_DS_PICKER})},ref:se.footerRef,onKeyDown:le?q:oe},"Open advanced data source picker",t.createElement(p.J,{name:"arrow-right"}))),le&&t.createElement(y.zx,{variant:"secondary",size:"sm",onClick:Q,onKeyDown:oe},"Add csv or spreadsheet"))}function _(Y){return{footer:(0,s.css)` flex: 0; display: flex; flex-direction: row-reverse; justify-content: space-between; padding: ${Y.spacing(1.5)}; border-top: 1px solid ${Y.colors.border.weak}; background-color: ${Y.colors.background.secondary}; `}}function G(Y){return i.config.featureToggles.advancedDataSourcePicker?t.createElement(N,{...Y}):t.createElement(n.q,{...Y})}},10520:(j,I,e)=>{"use strict";e.d(I,{TX:()=>t,Tw:()=>i,Ve:()=>n,qW:()=>s});function t(r,g){return!r||!g?!1:typeof g=="string"?r.uid===g:r.uid===g.uid}function n(r){if(r){if(typeof r=="string")return`${r} - not found`;if("name"in r)return r.name;if(r.uid)return`${r.uid} - not found`}}function i(r,g,d){return(u,o)=>{const m=u.name.toUpperCase(),c=o.name.toUpperCase();if(r&&t(u,r))return-1;if(r&&t(o,r))return 1;const p=g.indexOf(u.uid),f=g.indexOf(o.uid);if(p>-1&&p>f)return-1;if(f>-1&&f>p)return 1;const E=d.includes(u.uid),h=d.includes(o.uid);return E&&!h?-1:h&&!E||u.meta.builtIn&&!o.meta.builtIn?1:o.meta.builtIn&&!u.meta.builtIn||m<c?-1:1}}function s(r,g=""){return r.name.toLowerCase().includes(g.toLowerCase())}},39410:(j,I,e)=>{"use strict";e.d(I,{n:()=>t});const t={List:"/datasources",Edit:"/datasources/edit/:uid",Dashboards:"/datasources/edit/:uid/dashboards",New:"/datasources/new"}},66691:(j,I,e)=>{"use strict";e.d(I,{BM:()=>r,Hq:()=>g,wP:()=>d,wv:()=>l});var t=e(27702),n=e(84789),i=e(10864);const s="grafana.features.datasources.components.picker.DataSourceDropDown.history";function r(){const[u=[],o]=(0,n.Z)(s,[]),m=(0,t.useCallback)(c=>{c.meta.builtIn||(u.includes(c.uid)?(u.splice(u.findIndex(p=>c.uid===p),1),o([...u,c.uid])):o([...u,c.uid].slice(1,6)))},[u,o]);return[u,m]}function g(u){return(0,i.F)().getList(u)}function d(u){const o=(0,i.F)();return o.getInstanceSettings(u)}function l(u){const{keyboardEvents:o,containerRef:m}=u,c=(0,t.useRef)(0),p="data-role",f="keyboardSelectableItem",E={[p]:f},h=`[${p}="${f}"`,y="data-selectedItem",v=`[${y}="true"]`,D=(0,t.useCallback)(C=>{const P=m?.current?.querySelectorAll(h),b=P?.item(C%P?.length);P?.forEach(M=>M.setAttribute(y,"false")),b&&(b.scrollIntoView({block:"center"}),b.setAttribute(y,"true"))},[m,h]),a=(0,t.useCallback)(()=>{m?.current?.querySelector(v)?.querySelector("button")?.click()},[m,v]);return(0,t.useEffect)(()=>{if(!o)return;const C=o.subscribe({next:P=>{switch(P?.code){case"ArrowDown":{D(++c.current),P.preventDefault();break}case"ArrowUp":c.current=c.current>0?c.current-1:c.current,D(c.current),P.preventDefault();break;case"Enter":a();break}}});return()=>C.unsubscribe()},[o,D,a]),(0,t.useEffect)(()=>{const C=new MutationObserver(P=>{P.some(M=>M.addedNodes&&M.addedNodes.length>0||M.removedNodes&&M.removedNodes.length>0)&&D(0)});return m.current&&C.observe(m.current,{childList:!0}),()=>{C.disconnect()}},[m,h,D]),[E,v]}},58473:(j,I,e)=>{"use strict";e.d(I,{J_:()=>Q,F5:()=>le,M9:()=>R,Kj:()=>se,bZ:()=>G,kY:()=>_,oe:()=>Z});var t=e(94469),n=e(42751),i=e(73289),s=e(34667),r=e(26129),g=e(33877),d=e(66574),l=e(45937),u=e(90131),o=e(5926),m=e(67821),c=e(8929),p=e(78209),f=e(92317);const E=async()=>await(0,l.i)().get("/api/datasources"),h=async oe=>{const q=await(0,p.n)((0,l.i)().fetch({method:"GET",url:`/api/datasources/${oe}`,params:(0,f.y)(),showErrorAlert:!1}));if(q.ok)return q.data;throw Error(`Could not find data source by ID: "${oe}"`)},y=async oe=>{const q=await(0,p.n)((0,l.i)().fetch({method:"GET",url:`/api/datasources/uid/${oe}`,params:(0,f.y)(),showErrorAlert:!1}));if(q.ok)return q.data;throw Error(`Could not find data source by UID: "${oe}"`)},v=async oe=>{try{return await y(oe)}catch{console.log(`Failed to lookup data source using UID "${oe}"`)}try{return await h(oe)}catch{console.log(`Failed to lookup data source using ID "${oe}"`)}throw Error("Could not find data source")},D=oe=>(0,l.i)().post("/api/datasources",oe),a=()=>(0,l.i)().get("/api/plugins",{enabled:1,type:"datasource"}),C=oe=>(0,l.i)().put(`/api/datasources/uid/${oe.uid}`,oe,{showErrorAlert:!1,showSuccessAlert:!1}),P=oe=>(0,l.i)().delete(`/api/datasources/uid/${oe}`);var b=e(39410),M=e(99464),T=e(2148),S=e(9232),x=e(80978);function O(oe){const q=[{id:"tsdb",title:"Time series databases",plugins:[]},{id:"logging",title:"Logging & document databases",plugins:[]},{id:"tracing",title:"Distributed tracing",plugins:[]},{id:"profiling",title:"Profiling",plugins:[]},{id:"sql",title:"SQL",plugins:[]},{id:"cloud",title:"Cloud",plugins:[]},{id:"enterprise",title:"Enterprise plugins",plugins:[]},{id:"iot",title:"Industrial & IoT",plugins:[]},{id:"other",title:"Others",plugins:[]}].filter(re=>re),ne={},ge={},ae=A();for(const re of q)ne[re.id]=re;for(const re of oe){const De=ae.find(ye=>ye.id===re.id);if((re.enterprise||De)&&(re.category="enterprise",re.unlicensed=!(0,x.v)("enterprise.plugins"),re.info.links=De?.info?.links||re.info.links),re.info.links)for(const ye of re.info.links)ye.name="Learn more";(q.find(ye=>ye.id===re.category)||ne.other).plugins.push(re),ge[re.id]=re}for(const re of q){if(re.id==="cloud"&&re.plugins.push(V()),re.id==="enterprise")for(const De of ae)ge[De.id]||re.plugins.push(De);B(re.plugins)}return q.filter(re=>re.plugins.length>0)}function B(oe){const q={prometheus:100,graphite:95,loki:90,mysql:80,jaeger:100,postgres:79,gcloud:-1};oe.sort((ne,ge)=>{const ae=q[ne.id]||0,re=q[ge.id]||0;return ae>re?-1:ae<re||ne.name>ge.name?1:-1})}function A(){return[W({id:"grafana-splunk-datasource",name:"Splunk",description:"Visualize and explore Splunk logs",imgUrl:"public/img/plugins/splunk_logo_128.png"}),W({id:"grafana-oracle-datasource",name:"Oracle",description:"Visualize and explore Oracle SQL",imgUrl:"public/img/plugins/oracle.png"}),W({id:"grafana-dynatrace-datasource",name:"Dynatrace",description:"Visualize and explore Dynatrace data",imgUrl:"public/img/plugins/dynatrace.png"}),W({id:"grafana-servicenow-datasource",description:"ServiceNow integration and data source",name:"ServiceNow",imgUrl:"public/img/plugins/servicenow.svg"}),W({id:"grafana-datadog-datasource",description:"DataDog integration and data source",name:"DataDog",imgUrl:"public/img/plugins/datadog.png"}),W({id:"grafana-newrelic-datasource",description:"New Relic integration and data source",name:"New Relic",imgUrl:"public/img/plugins/newrelic.svg"}),W({id:"grafana-mongodb-datasource",description:"MongoDB integration and data source",name:"MongoDB",imgUrl:"public/img/plugins/mongodb.svg"}),W({id:"grafana-snowflake-datasource",description:"Snowflake integration and data source",name:"Snowflake",imgUrl:"public/img/plugins/snowflake.svg"}),W({id:"grafana-wavefront-datasource",description:"Wavefront integration and data source",name:"Wavefront",imgUrl:"public/img/plugins/wavefront.svg"}),W({id:"dlopes7-appdynamics-datasource",description:"AppDynamics integration and data source",name:"AppDynamics",imgUrl:"public/img/plugins/appdynamics.svg"}),W({id:"grafana-saphana-datasource",description:"SAP HANA\xAE integration and data source",name:"SAP HANA\xAE",imgUrl:"public/img/plugins/sap_hana.png"}),W({id:"grafana-honeycomb-datasource",description:"Honeycomb integration and datasource",name:"Honeycomb",imgUrl:"public/img/plugins/honeycomb.png"}),W({id:"grafana-salesforce-datasource",description:"Salesforce integration and datasource",name:"Salesforce",imgUrl:"public/img/plugins/salesforce.svg"}),W({id:"grafana-jira-datasource",description:"Jira integration and datasource",name:"Jira",imgUrl:"public/img/plugins/jira_logo.png"}),W({id:"grafana-gitlab-datasource",description:"GitLab integration and datasource",name:"GitLab",imgUrl:"public/img/plugins/gitlab.svg"}),W({id:"grafana-splunk-monitoring-datasource",description:"SignalFx integration and datasource",name:"Splunk Infrastructure Monitoring",imgUrl:"public/img/plugins/signalfx-logo.svg"}),W({id:"grafana-azuredevops-datasource",description:"Azure Devops datasource",name:"Azure Devops",imgUrl:"public/img/plugins/azure-devops.png"})]}function V(){return{id:"gcloud",name:"Grafana Cloud",type:S.zV.datasource,module:"phantom",baseUrl:"",info:{description:"Hosted Graphite, Prometheus, and Loki",logos:{small:"public/img/grafana_icon.svg",large:"asd"},author:{name:"Grafana Labs"},links:[{url:"https://grafana.com/products/cloud/",name:"Learn more"}],screenshots:[],updated:"2019-05-10",version:"1.0.0"}}}function W(oe){return{id:oe.id,name:oe.name,type:S.zV.datasource,module:"phantom",baseUrl:"",info:{description:oe.description,logos:{small:oe.imgUrl,large:oe.imgUrl},author:{name:"Grafana Labs"},links:[{url:"/plugins/"+oe.id,name:"Install now",target:"_self"}],screenshots:[],updated:"2019-05-10",version:"1.0.0"}}}var w=e(28706),N=e(11676),F=e(35342);const k=oe=>{let q,ne;return oe.error&&oe.error instanceof n.ZA?(q=oe.error.message,ne=oe.error.details):(0,i.kW)(oe)?q=oe.data.message??`HTTP error ${oe.statusText}`:oe instanceof Error&&(q=oe.message),{message:q,details:ne}},H=oe=>{const{details:q,message:ne,status:ge}=oe;return{status:ge,message:ne,details:q}},R=(oe,q={loadDataSource:Y,loadDataSourceMeta:X,getDataSource:F.f6,getDataSourceMeta:F.G4,importDataSourcePlugin:c.nL})=>async(ne,ge)=>{if(!oe){ne((0,N.CT)(new Error("Invalid UID")));return}try{const ae=await ne(q.loadDataSource(oe));await ne(q.loadDataSourceMeta(ae));const re=q.getDataSource(ge().dataSources,oe),De=q.getDataSourceMeta(ge().dataSources,re.type),he=await q.importDataSourcePlugin(De);ne((0,N.iZ)(he))}catch(ae){ae instanceof Error&&ne((0,N.CT)(ae))}},_=(oe,q=b.n.Edit,ne={getDatasourceSrv:o.ak,getBackendSrv:l.i})=>async(ge,ae)=>{const re=await ne.getDatasourceSrv().get(oe),De=q.replace(/:uid/gi,oe);re.testDatasource&&(ge((0,N.j_)()),ne.getBackendSrv().withNoBackendCache(async()=>{try{const he=await re.testDatasource(),ye=H({...he,details:{...he.details}});ge((0,N.ng)(ye)),(0,M.Rw)({grafana_version:s.config.buildInfo.version,plugin_id:re.type,datasource_uid:re.uid,success:!0,path:De})}catch(he){const ye=k(he);ge((0,N.Aq)({...ye})),(0,M.Rw)({grafana_version:s.config.buildInfo.version,plugin_id:re.type,datasource_uid:re.uid,success:!1,path:De})}}))};function G(){return async oe=>{oe((0,N.MP)());const q=await E();oe((0,N.be)(q))}}function Y(oe){return async q=>{let ne=await v(oe);return oe!==ne.uid&&(window.location.href=t.u.assureBaseUrl(`/datasources/edit/${ne.uid}`),ne={}),q((0,N.rl)(ne)),ne}}function X(oe){return async q=>{const ne=await(0,m.a)(oe.type),ge=await(0,c.nL)(ne),ae=ge.DataSourceClass.prototype instanceof n.CK,re={...ne,isBackend:ne.backend||ae};q((0,N.jS)(re)),ge.meta=re,q((0,g.RL)((0,w.B1)(oe,ge)))}}function Q(oe,q=b.n.Edit){return async(ne,ge)=>{const ae=await E();ne((0,N.be)(ae));const re=ge().dataSources.dataSources,De=re.length===0,he={name:oe.name,type:oe.id,access:"proxy",isDefault:De};(0,T.NV)(re,he.name)&&(he.name=(0,T.eM)(re,he.name));const ye=await D(he),ce=q.replace(/:uid/gi,ye.datasource.uid);await(0,o.ak)().reload(),await d.Vt.fetchUserPermissions(),(0,M.Er)({grafana_version:s.config.buildInfo.version,plugin_id:oe.id,datasource_uid:ye.datasource.uid,plugin_version:ye.meta?.info?.version,path:ce}),r.E1.push(ce)}}function se(){return async oe=>{oe((0,N.Ww)());const q=await a(),ne=O(q);oe((0,N.wZ)({plugins:q,categories:ne}))}}function Z(oe){return async q=>{try{await C(oe)}catch(ne){const ge=k(ne);return q((0,N.Aq)(ge)),Promise.reject(oe)}return await(0,o.ak)().reload(),q(Y(oe.uid))}}function le(){return async(oe,q)=>{const{uid:ne}=q().dataSources.dataSource;try{await P(ne),await(0,o.ak)().reload();const ge=u.Z.DataSources;r.E1.push(ge)}catch(ge){const ae=k(ge);oe((0,N.Aq)(ae))}}}},82220:(j,I,e)=>{"use strict";e.d(I,{V:()=>i});var t=e(27702),n=e(39410);const i=(0,t.createContext)(n.n)},21691:(j,I,e)=>{"use strict";e.d(I,{E:()=>h,IA:()=>T,MF:()=>O,OU:()=>a,Qs:()=>S,YY:()=>B,_l:()=>x,d7:()=>A,hw:()=>y,nH:()=>C,q6:()=>b,qj:()=>P,wl:()=>M,zJ:()=>v});var t=e(27702),n=e(10864),i=e(92071),s=e(5933),r=e(66574),g=e(86809),d=e(64248),l=e(18771),u=e(43620),o=e(2148),m=e(58473),c=e(82220),p=e(28706),f=e(11676),E=e(35342);const h=V=>{const W=(0,l.useDispatch)();(0,t.useEffect)(()=>(W((0,m.M9)(V)),function(){W((0,i.e)({cleanupAction:N=>N.dataSourceSettings=f.fk}))}),[V,W])},y=V=>{const W=(0,l.useDispatch)(),w=A();return()=>W((0,m.kY)(V,w.Edit))},v=()=>{const V=(0,l.useDispatch)(),W=(0,l.useSelector)(N=>N.dataSources.isLoadingDataSources),w=(0,l.useSelector)(N=>N.dataSources.dataSources);return(0,t.useEffect)(()=>{V((0,m.bZ)())},[V]),{isLoading:W,dataSources:w}},D=V=>{const W=useDispatch();useEffect(()=>{W(loadDataSource(V))},[W,V])},a=()=>{const V=(0,l.useDispatch)();(0,t.useEffect)(()=>{V((0,m.Kj)())},[V])},C=()=>{const V=(0,l.useDispatch)(),W=A();return w=>{V((0,m.J_)(w,W.Edit))}},P=()=>{const V=(0,l.useDispatch)();return async W=>V((0,m.oe)(W))},b=()=>{const V=(0,l.useDispatch)(),{name:W}=(0,l.useSelector)(w=>w.dataSources.dataSource);return()=>{s.Z.publish(new u.VJ({title:"Delete",text:`Are you sure you want to delete the "${W}" data source?`,yesText:"Delete",icon:"trash-alt",onConfirm:()=>V((0,m.F5)())}))}},M=V=>(0,l.useSelector)(W=>(0,E.f6)(W.dataSources,V)),T=V=>{const W=M(V);return(0,o.iU)(W)},S=V=>(0,l.useSelector)(W=>(0,E.G4)(W.dataSources,V)),x=()=>(0,l.useSelector)(V=>V.dataSourceSettings),O=(V,W)=>{const{plugin:w,loadError:N,loading:F}=x(),k=M(V),H=(0,n.F)()?.getInstanceSettings(V),R=!!(H?.meta?.alerting??!1),_=H?.type==="alertmanager",G=R||_,Y=(0,d.bJ)(k.type),X=(0,l.useSelector)(Z=>Z.navIndex),Q=W?`datasource-${W}-${V}`:`datasource-settings-${V}`;let se={node:{text:"Data Source Nav Node"},main:{text:"Data Source Nav Node"}};if(N){const Z={text:N,subTitle:"Data Source Error",icon:"exclamation-triangle"};se={node:Z,main:Z}}return(F||!w)&&(se=(0,g.ht)(X,Q,(0,p.xG)("settings"))),w&&(se=(0,g.ht)(X,Q,(0,p.nI)((0,p.B1)(k,w),W||"settings"))),{node:se.node,main:{...se.main,text:k.name,dataSourcePluginName:Y?.name||w?.meta.name||"",active:!0},dataSourceHeader:{alertingSupported:G}}},B=V=>{const W=M(V),w=W.readOnly===!0,N=r.Vt.hasPermissionInMetadata(l.AccessControlAction.DataSourcesWrite,W),F=r.Vt.hasPermissionInMetadata(l.AccessControlAction.DataSourcesDelete,W);return{readOnly:w,hasWriteRights:N,hasDeleteRights:F}},A=()=>(0,t.useContext)(c.V)},9906:(j,I,e)=>{"use strict";e.d(I,{BX:()=>r.BX,E:()=>i.E,Ht:()=>r.Ht,I5:()=>g.I5,IA:()=>g.IA,IO:()=>g.IO,J_:()=>t.J_,Nu:()=>r.Nu,OU:()=>i.OU,Qs:()=>i.Qs,Rz:()=>i.IA,Vj:()=>n.V,YY:()=>i.YY,_l:()=>i._l,d7:()=>i.d7,hw:()=>i.hw,mt:()=>g.mt,nH:()=>i.nH,q6:()=>i.q6,qj:()=>i.qj,r7:()=>g.r7,rl:()=>r.rl,wl:()=>i.wl,yr:()=>r.yr,zJ:()=>i.zJ,zT:()=>r.zT});var t=e(58473),n=e(82220),i=e(21691),s=e(28706),r=e(11676),g=e(35342)},28706:(j,I,e)=>{"use strict";e.d(I,{B1:()=>u,nI:()=>o,xG:()=>m});var t=e(9232),n=e(80978),i=e(99829),s=e(12308),r=e(66574),g=e(41715),d=e(18771);const l="Loading";function u(p,f){const E=f.meta,h=s.default.featureToggles.featureHighlights,y=s.default.featureToggles.dataSourcePageHeader,v={img:E.info.logos.large,id:"datasource-"+p.uid,url:"",text:p.name,children:[{active:!1,icon:"sliders-v-alt",id:`datasource-settings-${p.uid}`,text:"Settings",url:`datasources/edit/${p.uid}/`}]};if(y||(v.subTitle=`Type: ${E.name}`),f.configPages)for(const S of f.configPages)v.children.push({active:!1,text:S.title,icon:S.icon,url:`datasources/edit/${p.uid}/?page=${S.id}`,id:`datasource-page-${S.id}`});E.includes&&c(E.includes)&&r.Vt.hasRole("Admin")&&v.children.push({active:!1,icon:"apps",id:`datasource-dashboards-${p.uid}`,text:"Dashboards",url:`datasources/edit/${p.uid}/dashboards`});const D=p.type===l,a="feature-highlights-data-source-permissions-badge",C={active:!1,icon:"lock",id:`datasource-permissions-${p.uid}`,text:"Permissions",url:`datasources/edit/${p.uid}/permissions`};(0,g.d5)()&&!D&&(C.tabSuffix=()=>(0,i.Z)({experimentId:a,eventVariant:"trial"})),(0,n.v)("dspermissions.enforcement")?r.Vt.hasPermission(d.AccessControlAction.DataSourcesPermissionsRead)&&v.children.push(C):h&&!D&&v.children.push({...C,url:C.url+"/upgrade",tabSuffix:()=>(0,i.Z)({experimentId:a})});const P="feature-highlights-data-source-insights-badge",b={active:!1,icon:"info-circle",id:`datasource-insights-${p.uid}`,text:"Insights",url:`datasources/edit/${p.uid}/insights`};(0,g.d5)()&&!D&&(b.tabSuffix=()=>(0,i.Z)({experimentId:P,eventVariant:"trial"})),(0,n.v)("analytics")?r.Vt.hasPermission(d.AccessControlAction.DataSourcesInsightsRead)&&v.children.push(b):h&&!D&&v.children.push({...b,url:b.url+"/upgrade",tabSuffix:()=>(0,i.Z)({experimentId:P})});const M="feature-highlights-query-caching-badge",T={active:!1,icon:"database",id:`datasource-cache-${p.uid}`,text:"Cache",url:`datasources/edit/${p.uid}/cache`,hideFromTabs:!E.isBackend||!s.default.caching.enabled};return(0,g.d5)()&&!D&&(T.tabSuffix=()=>(0,i.Z)({experimentId:M,eventVariant:"trial"})),(0,n.v)("caching")?r.Vt.hasPermissionInMetadata(d.AccessControlAction.DataSourcesCachingRead,p)&&v.children.push(T):h&&!D&&v.children.push({...T,url:T.url+"/upgrade",tabSuffix:()=>(0,i.Z)({experimentId:M})}),v}function o(p,f){let E={text:""};for(const h of p.children)if(h.id.indexOf(f)>0){h.active=!0,E=h;break}return{main:p,node:E}}function m(p){const f=u({access:"",basicAuth:!1,basicAuthUser:"",withCredentials:!1,database:"",id:1,uid:"x",isDefault:!1,jsonData:{authType:"credentials",defaultRegion:"eu-west-2"},name:"Loading",orgId:1,readOnly:!1,type:l,typeName:l,typeLogoUrl:"public/img/icn-datasource.svg",url:"",user:"",secureJsonFields:{}},{meta:{id:"1",type:t.zV.datasource,name:"",info:{author:{name:"",url:""},description:"",links:[{name:"",url:""}],logos:{large:"",small:""},screenshots:[],updated:"",version:""},includes:[],module:"",baseUrl:""}});return o(f,p)}function c(p){return p.find(f=>f.type==="dashboard")!==void 0}},11676:(j,I,e)=>{"use strict";e.d(I,{Aq:()=>P,BX:()=>p,CT:()=>D,Ht:()=>c,MP:()=>r,Nu:()=>E,Ww:()=>l,ZP:()=>M,be:()=>g,fk:()=>y,iZ:()=>v,jS:()=>d,j_:()=>a,ng:()=>C,rl:()=>s,wZ:()=>u,yr:()=>f,zT:()=>o});var t=e(34099),n=e(47435);const i={dataSources:[],plugins:[],categories:[],dataSource:{},layoutMode:n.l.List,searchQuery:"",dataSourcesCount:0,dataSourceTypeSearchQuery:"",isLoadingDataSources:!1,isLoadingDataSourcePlugins:!1,dataSourceMeta:{},isSortAscending:!0},s=(0,t.PH)("dataSources/dataSourceLoaded"),r=(0,t.PH)("dataSources/dataSourcesLoad"),g=(0,t.PH)("dataSources/dataSourcesLoaded"),d=(0,t.PH)("dataSources/dataSourceMetaLoaded"),l=(0,t.PH)("dataSources/dataSourcePluginsLoad"),u=(0,t.PH)("dataSources/dataSourcePluginsLoaded"),o=(0,t.PH)("dataSources/setDataSourcesSearchQuery"),m=(0,t.PH)("dataSources/setDataSourcesLayoutMode"),c=(0,t.PH)("dataSources/setDataSourceTypeSearchQuery"),p=(0,t.PH)("dataSources/setDataSourceName"),f=(0,t.PH)("dataSources/setIsDefault"),E=(0,t.PH)("dataSources/setIsSortAscending"),h=(T=i,S)=>r.match(S)?{...T,isLoadingDataSources:!0}:g.match(S)?{...T,isLoadingDataSources:!1,dataSources:S.payload,dataSourcesCount:S.payload.length}:s.match(S)?{...T,dataSource:S.payload}:o.match(S)?{...T,searchQuery:S.payload}:m.match(S)?{...T,layoutMode:S.payload}:l.match(S)?{...T,plugins:[],isLoadingDataSourcePlugins:!0}:u.match(S)?{...T,plugins:S.payload.plugins,categories:S.payload.categories,isLoadingDataSourcePlugins:!1}:c.match(S)?{...T,dataSourceTypeSearchQuery:S.payload}:d.match(S)?{...T,dataSourceMeta:S.payload}:p.match(S)?{...T,dataSource:{...T.dataSource,name:S.payload}}:f.match(S)?{...T,dataSource:{...T.dataSource,isDefault:S.payload}}:E.match(S)?{...T,isSortAscending:S.payload}:T,y={testingStatus:{},loadError:null,loading:!0,plugin:null},v=(0,t.PH)("dataSourceSettings/initDataSourceSettingsSucceeded"),D=(0,t.PH)("dataSourceSettings/initDataSourceSettingsFailed"),a=(0,t.PH)("dataSourceSettings/testDataSourceStarting"),C=(0,t.PH)("dataSourceSettings/testDataSourceSucceeded"),P=(0,t.PH)("dataSourceSettings/testDataSourceFailed"),M={dataSources:h,dataSourceSettings:(T=y,S)=>v.match(S)?{...T,plugin:S.payload,loadError:null,loading:!1}:D.match(S)?{...T,plugin:null,loadError:S.payload.message,loading:!1}:a.match(S)?{...T,testingStatus:{message:"Testing... this could take up to a couple of minutes",status:"info"}}:C.match(S)?{...T,testingStatus:{status:S.payload?.status,message:S.payload?.message,details:S.payload?.details}}:P.match(S)?{...T,testingStatus:{status:"error",message:S.payload?.message,details:S.payload?.details}}:T}},35342:(j,I,e)=>{"use strict";e.d(I,{G4:()=>s,I5:()=>n,IA:()=>l,IO:()=>r,f6:()=>i,mt:()=>t,r7:()=>d});const t=u=>{const o=new RegExp(u.searchQuery,"i");return u.dataSources.filter(c=>o.test(c.name)||o.test(c.database)||o.test(c.type)).sort((c,p)=>u.isSortAscending?c.name.localeCompare(p.name):p.name.localeCompare(c.name))},n=u=>{const o=new RegExp(u.dataSourceTypeSearchQuery,"i");return u.plugins.filter(m=>o.test(m.name))},i=(u,o)=>u.dataSource.uid===o?u.dataSource:{},s=(u,o)=>u.dataSourceMeta.id===o?u.dataSourceMeta:{},r=u=>u.searchQuery,g=u=>u.layoutMode,d=u=>u.dataSourcesCount,l=u=>u.isSortAscending},99464:(j,I,e)=>{"use strict";e.d(I,{Er:()=>n,Rw:()=>i,U4:()=>s,aL:()=>l,dF:()=>g,hJ:()=>r,ij:()=>d});var t=e(86312);const n=u=>{(0,t.ff)("grafana_ds_add_datasource_clicked",u)},i=u=>{(0,t.ff)("grafana_ds_test_datasource_clicked",u)},s=u=>{(0,t.ff)("grafana_ds_explore_datasource_clicked",u)},r=u=>{(0,t.ff)("grafana_ds_create_dashboard_clicked",u)},g=u=>{(0,t.ff)("grafana_ds_datasources_list_viewed",u)},d=u=>{(0,t.ff)("connections_datasources_settings_clicked",{item:u})},l=u=>{(0,t.ff)("connections_datasources_ds_configured",u)}},2148:(j,I,e)=>{"use strict";e.d(I,{NV:()=>i,eM:()=>s,iU:()=>u});var t=e(78968),n=e(94469);function i(o,m){return o.filter(c=>c.name.toLowerCase()===m.toLowerCase()).length>0}function s(o,m){for(;i(o,m);)r(m)?m=`${l(m)}${d(g(m))}`:m=`${m}-1`;return m}function r(o){return o.endsWith("-",o.length-1)}function g(o){return parseInt(o.slice(-1),10)}function d(o){return isNaN(o)?1:o+1}function l(o){return o.slice(0,o.length-1)}const u=o=>{const m=JSON.stringify({datasource:o.name,context:"explore"});return t.Cj.renderUrl(n.u.assureBaseUrl("/explore"),{left:m})}},85614:()=>{"use strict"},18473:(j,I,e)=>{"use strict";e.d(I,{L:()=>l});var t=e(42844),n=e(27702),i=e(66310),s=e(28580),r=e(56025),g=e(38588);const d={label:"Fixed color",value:"_____fixed_____"},l=o=>{const{value:m,context:c,onChange:p}=o,f="dark-green",E=(0,i.wW)(u),h=m?.field,y=!h,v=(0,g.IX)(c.data),D=(0,g.nw)(v,h,d),a=(0,n.useCallback)(b=>{const M=b.value;if(M&&M!==d.value)p({...m,field:M});else{const T=m?.fixed??f;p({...m,field:void 0,fixed:T})}},[p,m]),C=(0,n.useCallback)(b=>{p({field:void 0,fixed:b??f})},[p]),P=y?d:D.find(b=>b.value===h);return n.createElement(n.Fragment,null,n.createElement("div",{className:E.container},n.createElement(s.Ph,{value:P,options:D,onChange:a,noOptionsMessage:"No fields found"}),y&&n.createElement("div",{className:E.picker},n.createElement(r.zH,{color:m?.fixed??f,onChange:C,enableNamedColors:!0}))))},u=o=>({container:(0,t.css)` display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; `,picker:(0,t.css)` padding-left: 8px; `})},95535:(j,I,e)=>{"use strict";e.d(I,{E:()=>E});var t=e(42844),n=e(27702),i=e(66310),s=e(66670),r=e(71107),g=e(48024),d=e(1128),l=e(75965),u=e(71235),o=e(54826),m=e(50292),c=e(34050),p=e(1553),f=e(92549);const E=v=>{const{value:D,src:a,name:C,placeholder:P,onChange:b,onClear:M,mediaType:T,folderName:S,size:x,color:O}=v,B=(0,i.wW)(y),A=(0,i.l4)(),V=(0,n.createRef)(),W=n.createElement(f.Y,{onChange:b,value:D,mediaType:T,folderName:S});let w=a;!w&&D&&(w=(0,c.t)(D));const N=O&&{fill:A.visualization.getColorByName(O)},F=()=>D&&w?n.createElement(m.V,{src:w,className:B.icon,style:{...N}}):n.createElement(s.Qj,{variant:"primary",fill:"text",size:"sm"},"Set icon"),k=()=>n.createElement(r.Z,null,n.createElement(g._,{label:null,grow:!0},n.createElement(d.I,{value:h(a,C),placeholder:P,readOnly:!0,prefix:w&&n.createElement(m.V,{src:w,className:B.icon,style:{...N}}),suffix:n.createElement(s.zx,{icon:"times",variant:"secondary",fill:"text",size:"sm",onClick:M})})));return n.createElement(l.D,{content:W},(H,R,_)=>n.createElement(n.Fragment,null,V.current&&n.createElement(u.J,{..._,referenceElement:V.current,onMouseEnter:H,onKeyDown:G=>{(0,o.i)(G,R)}}),n.createElement("div",{ref:V,onClick:H,className:B.pointer},x===p.zc.SMALL&&F(),x===p.zc.NORMAL&&k())))};function h(v,D){if(v?.startsWith("public/img/icons")){const a=D?.lastIndexOf(".svg")??0;if(a>0)return D.substring(0,a)}return D}const y=v=>({pointer:(0,t.css)` cursor: pointer; input[readonly] { cursor: pointer; } `,icon:(0,t.css)` vertical-align: middle; display: inline-block; fill: currentColor; width: 25px; `})},92549:(j,I,e)=>{"use strict";e.d(I,{Y:()=>F});var t=e(42844),n=e(45809),i=e(91546),s=e(6714),r=e(27702),g=e(73289),d=e(66310),l=e(66670),u=e(12308),o=e(1553),m=e(22209),c=e(79399),p=e(50292);function f({secondaryText:H="Drag and drop here or browse"}){const R=(0,d.wW)(h);return r.createElement("div",{className:R.iconWrapper},r.createElement("small",{className:R.small},H),r.createElement(l.zx,{type:"button",icon:"upload"},"Upload"))}const E=({mediaType:H,setFormData:R,setUpload:_,error:G})=>{const Y=(0,d.wW)(h),[X,Q]=(0,r.useState)(!1),[se,Z]=(0,r.useState)(""),le=()=>r.createElement(m.g,{label:"Preview"},r.createElement("div",{className:Y.iconPreview},H===o.DD.Icon&&r.createElement(p.V,{src:se,className:Y.img}),H===o.DD.Image&&r.createElement("img",{src:se,alt:"Preview of the uploaded file",className:Y.img}))),oe=ne=>{fetch(`/api/storage/delete/upload/${ne.file.name}`,{method:"DELETE"}).catch(ge=>console.error("cannot delete file",ge))},q=H==="icon"?{"image/*":[".svg",".xml"]}:{"image/*":[".jpeg",".png",".gif",".webp"]};return r.createElement(c.Yo,{readAs:"readAsBinaryString",onFileRemove:oe,options:{accept:q,multiple:!1,onDrop:ne=>{let ge=new FormData;ge.append("file",ne[0]),Z(URL.createObjectURL(ne[0])),Q(!0),R(ge),_(!0)}}},G.message!==""&&X?r.createElement("p",null,G.message):X?r.createElement(le,null):r.createElement(f,null))};function h(H,R){return{container:(0,t.css)` display: flex; flex-direction: column; width: 100%; `,dropzone:(0,t.css)` display: flex; flex: 1; flex-direction: column; align-items: center; padding: ${H.spacing(6)}; border-radius: 2px; border: 2px dashed ${H.colors.border.medium}; background-color: ${R?H.colors.background.secondary:H.colors.background.primary}; cursor: pointer; `,iconWrapper:(0,t.css)` display: flex; flex-direction: column; align-items: center; `,acceptMargin:(0,t.css)` margin: ${H.spacing(2,0,1)}; `,small:(0,t.css)` color: ${H.colors.text.secondary}; margin-bottom: ${H.spacing(2)}; `,iconContainer:(0,t.css)` display: flex; flex-direction: column; width: 80%; align-items: center; align-self: center; `,iconPreview:(0,t.css)` width: 238px; height: 198px; border: 1px solid ${H.colors.border.medium}; display: flex; align-items: center; justify-content: center; `,img:(0,t.css)` width: 147px; height: 147px; fill: ${H.colors.text.primary}; `}}var y=e(28580),v=e(33716),D=e(5926),a=e(55925),C=e(25472),P=e(80402);const b=(0,r.memo)(function(R){const{columnIndex:_,rowIndex:G,style:Y,data:X}=R,{cards:Q,columnCount:se,onChange:Z,selected:le}=X,oe=_+G*se,q=Q[oe],ne=(0,d.l4)(),ge=M(ne);return r.createElement("div",{style:Y},q&&r.createElement("div",{key:q.value,className:le===q.value?(0,t.cx)(ge.card,ge.selected):ge.card,onClick:()=>Z(q.value)},q.imgUrl.endsWith(".svg")?r.createElement(p.V,{src:q.imgUrl,className:ge.img}):r.createElement("img",{src:q.imgUrl,alt:"",className:ge.img}),r.createElement("h6",{className:ge.text},q.label.slice(0,-4))))},C.wy),M=(0,P.B)(H=>({card:(0,t.css)` display: inline-block; width: 90px; height: 90px; margin: 0.75rem; margin-left: 15px; text-align: center; cursor: pointer; position: relative; background-color: transparent; border: 1px solid transparent; border-radius: 8px; padding-top: 6px; :hover { border-color: ${H.colors.action.hover}; box-shadow: ${H.shadows.z2}; } `,selected:(0,t.css)` border: 2px solid ${H.colors.primary.main}; :hover { border-color: ${H.colors.primary.main}; } `,img:(0,t.css)` width: 40px; height: 40px; object-fit: cover; vertical-align: middle; fill: ${H.colors.text.primary}; `,text:(0,t.css)` color: ${H.colors.text.primary}; white-space: nowrap; font-size: 12px; text-overflow: ellipsis; display: block; overflow: hidden; `,grid:(0,t.css)` border: 1px solid ${H.colors.border.medium}; `})),T=H=>{const{onChange:R,cards:_,value:G}=H,Y=(0,d.l4)(),X=M(Y);return r.createElement(a.Z,{defaultWidth:680},({width:Q,height:se})=>{const oe=Math.floor(Q/90),q=Math.ceil(_.length/oe);return r.createElement(C.Ym,{width:Q,height:se,columnCount:oe,columnWidth:90,rowCount:q,rowHeight:90,itemData:{cards:_,columnCount:oe,onChange:R,selected:G},className:X.grid},b)})},S=H=>H===o.DD.Icon?[o.QS.Icon,o.QS.IOT,o.QS.Marker]:[o.QS.BG],x=(H,R)=>H.find(_=>R.startsWith(_.value))??H[0],O=H=>{const{value:R,mediaType:_,folderName:G,newValue:Y,setNewValue:X}=H,Q=(0,d.wW)(B),se=S(_).map(he=>({label:he,value:he})),[Z,le]=(0,r.useState)(),[oe,q]=(0,r.useState)(x(se,R?.length?R:G)),[ne,ge]=(0,r.useState)([]),[ae,re]=(0,r.useState)([]),De=he=>{he?(he=he.toLowerCase(),re(ne.filter(ye=>ye.search.includes(he)))):re(ne)};return(0,r.useEffect)(()=>{const he=oe?.value;if(he){const ye=_===o.DD.Icon?ce=>ce.name.endsWith(".svg"):ce=>ce.name.endsWith(".png")||ce.name.endsWith(".gif");(0,D.ak)().get("-- Grafana --").then(ce=>{ce.listFiles(he).subscribe({next:We=>{const ke=[];We.forEach(et=>{if(ye(et)){const we=et.name.lastIndexOf(".");ke.push({value:`${he}/${et.name}`,label:et.name,search:(we?et.name.substring(0,we):et.name).toLowerCase(),imgUrl:`public/${he}/${et.name}`})}}),ge(ke),re(ke)}})})}},[_,oe]),r.createElement(r.Fragment,null,r.createElement(m.g,null,r.createElement(y.Ph,{options:se,onChange:q,value:oe,menuShouldPortal:!1})),r.createElement(m.g,null,r.createElement(v.H,{value:Z??"",placeholder:"Search",onChange:he=>{De(he),le(he)}})),ae&&r.createElement("div",{className:Q.cardsWrapper},r.createElement(T,{cards:ae,onChange:he=>X(he),value:Y})))},B=H=>({cardsWrapper:(0,t.css)` height: 30vh; min-height: 50px; margin-top: 5px; max-width: 680px; `});var A=e(1128),V=e(79978),W=e(34050);const w=H=>{const{newValue:R,setNewValue:_,mediaType:G}=H,Y=(0,d.wW)(N),X=(0,W.t)(R);let Q=R?.substring(R.lastIndexOf("/")+1,R.lastIndexOf("."));return Q.length>20&&(Q=Q.substring(0,20)+"..."),r.createElement(r.Fragment,null,r.createElement(m.g,null,r.createElement(A.I,{onChange:se=>_(se.currentTarget.value),value:R})),r.createElement("div",{className:Y.iconContainer},r.createElement(m.g,{label:"Preview"},r.createElement("div",{className:Y.iconPreview},G===o.DD.Icon&&r.createElement(p.V,{src:X,className:Y.img}),G===o.DD.Image&&R&&r.createElement("img",{src:X,alt:"Preview of the selected URL",className:Y.img}))),r.createElement(V._,null,Q)))},N=H=>({iconContainer:(0,t.css)` display: flex; flex-direction: column; width: 80%; align-items: center; align-self: center; `,iconPreview:(0,t.css)` width: 238px; height: 198px; border: 1px solid ${H.colors.border.medium}; display: flex; align-items: center; justify-content: center; `,img:(0,t.css)` width: 147px; height: 147px; fill: ${H.colors.text.primary}; `}),F=H=>{const{value:R,onChange:_,mediaType:G,folderName:Y}=H,X=(0,d.wW)(k),Q=()=>{_(R)},se=(0,r.createRef)(),{dialogProps:Z}=(0,n.R)({},se),{overlayProps:le}=(0,s.Ir)({onClose:Q,isDismissable:!0,isOpen:!0},se),oe=R&&R.includes("://"),[q,ne]=(0,r.useState)(R??""),[ge,ae]=(0,r.useState)(oe?o.hQ.URL:o.hQ.Folder),[re,De]=(0,r.useState)(new FormData),[he,ye]=(0,r.useState)(!1),[ce,We]=(0,r.useState)({message:""}),ke=qe=>`${X.resourcePickerPopoverTab} ${ge===qe&&X.resourcePickerPopoverActiveTab}`,et=()=>r.createElement(O,{value:R,mediaType:G,folderName:Y,newValue:q,setNewValue:ne}),we=()=>r.createElement(w,{newValue:q,setNewValue:ne,mediaType:G}),_e=()=>r.createElement(E,{mediaType:G,setFormData:De,setUpload:ye,newValue:q,error:ce}),Ge=()=>{switch(ge){case o.hQ.Folder:return et();case o.hQ.URL:return we();case o.hQ.Upload:return _e();default:return et()}};return r.createElement(i.MT,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("section",{ref:se,...le,...Z},r.createElement("div",{className:X.resourcePickerPopover},r.createElement("div",{className:X.resourcePickerPopoverTabs},r.createElement("button",{className:ke(o.hQ.Folder),onClick:()=>ae(o.hQ.Folder)},"Folder"),r.createElement("button",{className:ke(o.hQ.URL),onClick:()=>ae(o.hQ.URL)},"URL")),r.createElement("div",{className:X.resourcePickerPopoverContent},Ge(),r.createElement("div",{className:X.buttonRow},r.createElement(l.zx,{variant:"secondary",onClick:()=>Q(),fill:"outline"},"Cancel"),r.createElement(l.zx,{variant:q&&q!==R?"primary":"secondary",onClick:()=>{he?fetch("/api/storage/upload",{method:"POST",body:re}).then(qe=>{if(qe.status>=400){qe.json().then(st=>We(st));return}else return qe.json()}).then(qe=>{(0,g.i)().get(`api/storage/read/${qe.path}`).then(()=>ne(`${u.config.appUrl}api/storage/read/${qe.path}`)).then(()=>_(`${u.config.appUrl}api/storage/read/${qe.path}`))}).catch(qe=>console.error(qe)):_(q)}},"Select"))))))},k=H=>({resourcePickerPopover:(0,t.css)` border-radius: ${H.shape.borderRadius()}; box-shadow: ${H.shadows.z3}; background: ${H.colors.background.primary}; border: 1px solid ${H.colors.border.weak}; `,resourcePickerPopoverTab:(0,t.css)` width: 50%; text-align: center; padding: ${H.spacing(1,0)}; background: ${H.colors.background.secondary}; color: ${H.colors.text.secondary}; font-size: ${H.typography.bodySmall.fontSize}; cursor: pointer; border: none; &:focus:not(:focus-visible) { outline: none; box-shadow: none; } :focus-visible { position: relative; } `,resourcePickerPopoverActiveTab:(0,t.css)` color: ${H.colors.text.primary}; font-weight: ${H.typography.fontWeightMedium}; background: ${H.colors.background.primary}; `,resourcePickerPopoverContent:(0,t.css)` width: 315px; font-size: ${H.typography.bodySmall.fontSize}; min-height: 184px; padding: ${H.spacing(1)}; display: flex; flex-direction: column; `,resourcePickerPopoverTabs:(0,t.css)` display: flex; width: 100%; border-radius: ${H.shape.borderRadius()} ${H.shape.borderRadius()} 0 0; `,buttonRow:(0,t.css)({display:"flex",justifyContent:"center",gap:H.spacing(2),padding:H.spacing(1)})})},9953:(j,I,e)=>{"use strict";e.d(I,{$:()=>c});var t=e(27702),n=e(64167),i=e(71107),s=e(48024),r=e(40705),g=e(66670),d=e(86912),l=e(85819);const u=[{label:"Fixed",value:n.xy.Fixed,description:"Fixed value"},{label:"Field",value:n.xy.Field,description:"Display field value"}],o={settings:{}},m={settings:{}},c=({value:p,context:f,onChange:E})=>{const y=(0,t.useCallback)(P=>{E({...p,mode:P})},[E,p]),v=(0,t.useCallback)(P=>{E({...p,field:P})},[E,p]),D=(0,t.useCallback)((P="")=>{E({...p,fixed:P})},[E,p]),a=()=>{D("")},C=p?.mode??n.xy.Fixed;return t.createElement(t.Fragment,null,t.createElement(i.Z,null,t.createElement(s._,{label:"Source",labelWidth:9,grow:!0},t.createElement(r.S,{value:C,options:u,onChange:y,fullWidth:!0}))),C!==n.xy.Fixed&&t.createElement(i.Z,null,t.createElement(s._,{label:"Field",labelWidth:9,grow:!0},t.createElement(d.b,{context:f,value:p.field??"",onChange:v,item:o}))),C===n.xy.Fixed&&t.createElement(i.Z,{key:p?.fixed},t.createElement(s._,{label:"Value",labelWidth:9,grow:!0},t.createElement(l.A,{context:f,value:p?.fixed,onChange:D,item:m,suffix:p?.fixed&&t.createElement(g.zx,{icon:"times",variant:"secondary",fill:"text",size:"sm",onClick:a})}))),C===n.xy.Template&&t.createElement(i.Z,null,t.createElement(s._,{label:"Template",labelWidth:9,grow:!0},t.createElement(l.A,{context:f,value:p?.fixed,onChange:D,item:m}))))}},78276:(j,I,e)=>{"use strict";e.d(I,{Lm:()=>t.L,Lv:()=>E,k9:()=>B,cL:()=>M,$2:()=>V.$});var t=e(18473),n=e(27702);const i=({value:W,onChange:w})=>{const[N,F]=useState(W?[{value:W,label:W}]:[]),[k,H]=useState(),R=window.__grafana_public_path__+"img/icons/unicons/",_=G=>{w(G),H(G)};return useEffect(()=>{getBackendSrv().get(`${R}/index.json`).then(G=>{F(G.files.map(Y=>({value:Y,label:Y})))})},[R]),React.createElement(Select,{options:N,value:k,onChange:G=>{_(G.value)}})},s=null;var r=e(64167),g=e(71107),d=e(48024),l=e(40705),u=e(86912),o=e(82382),m=e(1553),c=e(95535);const p=[{label:"Fixed",value:r.Q8.Fixed,description:"Fixed value"},{label:"Field",value:r.Q8.Field,description:"Use a string field result"}],f={settings:{}},E=W=>{const{value:w,context:N,onChange:F,item:k}=W,H=9,R=(0,n.useCallback)(oe=>{F({...w,mode:oe})},[F,w]),_=(0,n.useCallback)((oe="")=>{F({...w,field:oe})},[F,w]),G=(0,n.useCallback)(oe=>{F({...w,fixed:oe??""})},[F,w]),Y=oe=>{oe.stopPropagation(),F({mode:r.Q8.Fixed,fixed:"",field:""})},X=w?.mode??r.Q8.Fixed,Q=k.settings?.showSourceRadio??!0,se=k.settings?.resourceType??m.DD.Icon,Z=k.settings?.folderName??o.ResourceFolderName.Icon;let le="";return se===m.DD.Icon&&(w?.fixed?le=(0,o.getPublicOrAbsoluteUrl)(w.fixed):k.settings?.placeholderValue&&(le=(0,o.getPublicOrAbsoluteUrl)(k.settings.placeholderValue))),n.createElement(n.Fragment,null,Q&&n.createElement(g.Z,null,n.createElement(d._,{label:"Source",labelWidth:H,grow:!0},n.createElement(l.S,{value:X,options:p,onChange:R,fullWidth:!0}))),X!==r.Q8.Fixed&&n.createElement(g.Z,null,n.createElement(d._,{label:"Field",labelWidth:H,grow:!0},n.createElement(u.b,{context:N,value:w.field??"",onChange:_,item:f}))),X===r.Q8.Fixed&&n.createElement(c.E,{onChange:G,onClear:Y,value:w?.fixed,src:le,placeholder:k.settings?.placeholderText??"Select a value",name:h(w?.fixed)??"",mediaType:se,folderName:Z,size:m.zc.NORMAL}),X===r.Q8.Mapping&&n.createElement(g.Z,null,n.createElement(d._,{label:"Mappings",labelWidth:H,grow:!0},n.createElement("div",null,"TODO mappings editor!"))))};function h(W){if(!W)return;const w=W.lastIndexOf("/");return w>0?W.substring(w+1):W}var y=e(42844),v=e(66310),D=e(28580),a=e(38588),C=e(55093),P=e(91389);const b={label:"Fixed value",value:"_____fixed_____"},M=W=>{const{value:w,context:N,onChange:F,item:k}=W,{settings:H}=k,R=(0,v.wW)(T),_=w?.field,G=!_,Y=(0,a.IX)(N.data),X=(0,a.nw)(Y,_,b),Q=(0,n.useMemo)(()=>(0,P.x5)(H),[H]),se=(0,n.useCallback)(ae=>{F((0,P.C)(ae,Q))},[F,Q]),Z=(0,n.useCallback)(ae=>{const re=ae.value;re&&re!==b.value?se({...w,field:re}):se({...w,field:void 0})},[se,w]),le=(0,n.useCallback)(ae=>{ae!==void 0&&se({...w,min:ae})},[se,w]),oe=(0,n.useCallback)(ae=>{ae!==void 0&&se({...w,max:ae})},[se,w]),q=(0,n.useCallback)(ae=>{ae!==void 0&&se({...w,fixed:ae})},[se,w]),ne=w??{},ge=G?b:X.find(ae=>ae.value===_);return n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(D.Ph,{value:ge,options:X,onChange:Z,noOptionsMessage:"No fields found"})),n.createElement("div",{className:R.range},G&&n.createElement(g.Z,null,n.createElement(d._,{label:"Value",labelWidth:8,grow:!0},n.createElement(C.Y,{value:ne.fixed,...Q,onChange:q}))),!G&&!Q.hideRange&&n.createElement(n.Fragment,null,n.createElement(g.Z,null,n.createElement(d._,{label:"Min",labelWidth:8,grow:!0},n.createElement(C.Y,{value:ne.min,...Q,onChange:le}))),n.createElement(g.Z,null,n.createElement(d._,{label:"Max",labelWidth:8,grow:!0},n.createElement(C.Y,{value:ne.max,...Q,onChange:oe}))))))},T=W=>({range:(0,y.css)` padding-top: 8px; `});var S=e(29241);const x={label:"Fixed value",value:"_____fixed_____"},O=[{label:"Mod",value:r.eK.Mod,description:"Use field values, mod from max"},{label:"Clamped",value:r.eK.Clamped,description:"Use field values, clamped to max and min"}],B=({value:W,context:w,onChange:N,item:F})=>{const{settings:k}=F,H=0,R=W?.field,_=!R,G=(0,a.IX)(w.data),Y=(0,a.nw)(G,R,x,S.fS.number),X=(0,v.wW)(A),Q=(0,n.useCallback)(ne=>{const ge=ne.value;if(ge&&ge!==x.value)N({...W,field:ge});else{const ae=W.fixed??H;N({...W,field:void 0,fixed:ae})}},[N,W]),se=(0,n.useCallback)(ne=>{N({...W,mode:ne})},[N,W]),Z=(0,n.useCallback)(ne=>{N({...W,field:void 0,fixed:ne??H})},[N,W]),le=W??{},oe=W?.mode??r.eK.Mod,q=_?x:Y.find(ne=>ne.value===R);return n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(g.Z,null,n.createElement(d._,{label:"Limit",labelWidth:8,grow:!0},n.createElement(l.S,{value:oe,options:O,onChange:se,fullWidth:!0}))),n.createElement(D.Ph,{value:q,options:Y,onChange:Q,noOptionsMessage:"No fields found"})),n.createElement("div",{className:X.range},_&&n.createElement(g.Z,null,n.createElement(d._,{label:"Value",labelWidth:8,grow:!0},n.createElement(C.Y,{value:le?.fixed??H,onChange:Z,max:k?.max,min:k?.min})))))},A=W=>({range:(0,y.css)` padding-top: 8px; `});var V=e(9953)},82382:(j,I,e)=>{"use strict";e.d(I,{MediaType:()=>t.DD,ResourceFolderName:()=>t.QS,findField:()=>r.PI,findFieldIndex:()=>r.rj,getColorDimension:()=>g,getPublicOrAbsoluteUrl:()=>f.t,getResourceDimension:()=>f.I,getScalarDimension:()=>h.y,getScaledDimension:()=>l.W8,getScaledDimensionForField:()=>l.A,getTextDimension:()=>c});var t=e(1553),n=e(58192),i=e(11024),s=e(61965),r=e(69730);function g(y,v,D){return d((0,r.PI)(y,v.field),v,D)}function d(y,v,D){if(!y){const P=D.visualization.getColorByName(v.fixed??"grey");return{isAssumed:!!v.field?.length||!v.fixed,fixed:P,value:()=>P,get:b=>P}}const a=(0,n.fD)(y);if(a.isByValue||y.config.mappings?.length){const P=(0,i.xD)(y,!0);P!==y.config&&(y={...y,config:P},y.state=void 0);const b=(0,s.U)({field:y,theme:D}),M=T=>b(T).color??"#ccc";return{field:y,get:T=>M(y.values[T]),value:()=>M((0,r.cR)(y))}}const C=a.getCalculator(y,D)(0,0);return{fixed:C,value:()=>C,get:P=>C,field:y}}var l=e(91389),u=e(29241),o=e(21609),m=e(64167);function c(y,v){const D=v.field?(0,r.PI)(y,v.field):y?.fields.find(a=>a.type===u.fS.string);return p(D,v)}function p(y,v){let D=v.fixed;const a=v.mode??m.xy.Fixed;if(a===m.xy.Fixed)return{isAssumed:!D,fixed:D,value:()=>D,get:P=>D};if(a===m.xy.Template){const P=b=>`TEMPLATE[${v.fixed} // ${b}]`;return y?{field:y,get:b=>P(y.values[b]),value:()=>P((0,r.cR)(y))}:(D=P(""),{isAssumed:!0,fixed:D,value:()=>D,get:b=>D})}if(!y)return{isAssumed:!0,fixed:D,value:()=>D,get:P=>D};let C=P=>(0,o.zc)(y.display(P));return{field:y,get:P=>C(y.values[P]),value:()=>C((0,r.cR)(y))}}var f=e(34050),E=e(85614),h=e(74243)},34050:(j,I,e)=>{"use strict";e.d(I,{I:()=>s,t:()=>i});var t=e(64167),n=e(69730);function i(r){return r?r.indexOf(":/")>0?r:window.__grafana_public_path__+r:""}function s(r,g){const d=g.mode??t.Q8.Fixed;if(d===t.Q8.Fixed){const o=i(g.fixed);return{isAssumed:!o,fixed:o,value:()=>o,get:m=>o}}const l=(0,n.PI)(r,g.field);if(!l){const o="";return{isAssumed:!0,fixed:o,value:()=>o,get:m=>o}}if(d===t.Q8.Mapping){const o=m=>i(`${m}`);return{field:l,get:m=>o(l.values[m]),value:()=>o((0,n.cR)(l))}}const u=o=>{if(l&&l.display){const m=l.display(o).icon;return i(m??"")}return""};return{field:l,get:o=>u(l.values[o]),value:()=>u((0,n.cR)(l))}}},74243:(j,I,e)=>{"use strict";e.d(I,{y:()=>i});var t=e(64167),n=e(69730);function i(r,g){return s((0,n.PI)(r,g?.field),g)}function s(r,g){if(!r){const u=g.fixed??0;return{isAssumed:!!g.field?.length||!g.fixed,fixed:u,value:()=>u,get:()=>u}}let d=u=>u%g.max;return g.mode===t.eK.Clamped&&(d=u=>u<g.min?g.min:u>g.max?g.max:u),{field:r,get:u=>{const o=r.values[u];return o===null||typeof o!="number"?0:d(o)},value:()=>(0,n.cR)(r)}}},91389:(j,I,e)=>{"use strict";e.d(I,{A:()=>r,C:()=>d,W8:()=>s,x5:()=>g});var t=e(11024),n=e(64167),i=e(69730);function s(l,u){return r((0,i.PI)(l,u?.field),u)}function r(l,u,o){if(!l){const h=u.fixed??0;return{isAssumed:!!u.field?.length||!u.fixed,fixed:h,value:()=>h,get:()=>h}}const m=(0,t.dz)(l),c=u.max-u.min;if(l.values.length<1||c<=0||m.delta<=0)return{fixed:u.min,value:()=>u.min,get:()=>u.min};let f=h=>u.min+h*c;if(o===n.B5.Quad){const h=Math.PI*(u.max/2)**2,y=Math.PI*(u.min/2)**2,v=h-y;f=D=>{let a=y+v*D;return Math.sqrt(a/Math.PI)*2}}const E=h=>{const y=l.values[h];let v=0;return y!==-1/0&&(v=(y-m.min)/m.delta),v>1?v=1:v<0&&(v=0),f(v)};return{get:E,value:()=>E((0,i.cR)(l)),field:l}}function g(l){return l||(l={min:0,max:1}),l.min==null&&(l.min=0),l.max==null&&(l.max=1),l}function d(l,u){let{min:o,max:m}=g(u);if(l||(l={}),l.max==null&&(l.max=m),l.min==null&&(l.min=o),l.min>l.max){const c=l.max;l.max=l.min,l.min=c}return l.min<o&&(l.min=o),l.max>m&&(l.max=m),l.fixed==null&&(l.fixed=l.min+(l.max-l.min)/2),l.field||(l.fixed>m?l.fixed=m:l.fixed<o&&(l.fixed=o)),l}},1553:(j,I,e)=>{"use strict";e.d(I,{DD:()=>s,QS:()=>i,hQ:()=>r,qj:()=>n,zc:()=>g});var t=e(64167);const n=Object.freeze({fixed:"",mode:t.xy.Field,field:""});var i=(d=>(d.Icon="img/icons/unicons",d.IOT="img/icons/iot",d.Marker="img/icons/marker",d.BG="img/bg",d))(i||{}),s=(d=>(d.Icon="icon",d.Image="image",d))(s||{}),r=(d=>(d.Folder="folder",d.URL="url",d.Upload="upload",d))(r||{}),g=(d=>(d.SMALL="small",d.NORMAL="normal",d))(g||{})},69730:(j,I,e)=>{"use strict";e.d(I,{FP:()=>g,PI:()=>m,Qz:()=>u,WO:()=>o,cR:()=>p,pb:()=>d,rj:()=>c,z2:()=>l});var t=e(75578),n=e(66656),i=e(34667),s=e(82382),r=e(74243);function g(f,E){if(f?.series&&E.field)for(const h of f.series){const y=(0,s.getColorDimension)(h,E,i.config.theme2);if(!y.isAssumed||f.series.length===1)return y}return(0,s.getColorDimension)(void 0,E,i.config.theme2)}function d(f,E){if(f?.series&&E.field)for(const h of f.series){const y=(0,s.getScaledDimension)(h,E);if(!y.isAssumed||f.series.length===1)return y}return(0,s.getScaledDimension)(void 0,E)}function l(f,E){if(f?.series&&E.field)for(const h of f.series){const y=(0,r.y)(h,E);if(!y.isAssumed||f.series.length===1)return y}return(0,r.y)(void 0,E)}function u(f,E){if(f?.series&&E.field)for(const h of f.series){const y=(0,s.getResourceDimension)(h,E);if(!y.isAssumed||f.series.length===1)return y}return(0,s.getResourceDimension)(void 0,E)}function o(f,E){if(f?.series&&E.field)for(const h of f.series){const y=(0,s.getTextDimension)(h,E);if(!y.isAssumed||f.series.length===1)return y}return(0,s.getTextDimension)(void 0,E)}function m(f,E){const h=c(f,E);return h==null?void 0:f.fields[h]}function c(f,E){if(!(!f||!E?.length))for(let h=0;h<f.fields.length;h++){const y=f.fields[h];if(E===y.name)return h;const v=(0,t.CZ)(y,f);if(E===v)return h}}function p(f){const E=f.state?.calcs;if(E){const v=E[n.gz.lastNotNull];if(v!=null)return v}const h=f.values;let y=h.length-1;for(;y>=0;){const v=h[y--];if(v!=null)return v}}},18262:(j,I,e)=>{"use strict";e.d(I,{I:()=>l,a:()=>d});var t=e(42844),n=e(27702),i=e(66310),s=e(26807),r=e(98558);const g=(u,o)=>({valueNavigation:(0,t.css)` width: ${r.vl}; font-weight: bold; `,valueNavigationWrapper:(0,t.css)` display: flex; justify-content: flex-end; `,itemLabelsWrap:(0,t.css)` ${o?"":`border-bottom: 1px solid ${u.colors.border.medium}`}; `}),d=u=>u.includes(s.QG)?u.replace(s.QG,""):u,l=({valueLabels:u,expanded:o})=>{const m=(0,i.wW)(c=>g(c,o));return n.createElement("div",{className:m.itemLabelsWrap},n.createElement("div",{className:m.valueNavigationWrapper},u.map((c,p)=>n.createElement("span",{className:m.valueNavigation,key:c.name},d(c.name)))))}},98558:(j,I,e)=>{"use strict";e.d(I,{ZP:()=>a,vl:()=>E,Cw:()=>h});var t=e(42844),n=e(27702),i=e(1277),s=e(86312),r=e(66310),g=e(67437),d=e(18262),l=e(747);const u=(C,P)=>({rowWrapper:(0,t.css)` position: relative; min-width: ${E}; padding-right: 5px; `,rowValue:(0,t.css)` white-space: nowrap; overflow-x: auto; -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ display: block; padding-right: 10px; &::-webkit-scrollbar { display: none; /* Chrome, Safari and Opera */ } &:before { pointer-events: none; content: ''; width: 100%; height: 100%; position: absolute; left: 0; top: 0; background: linear-gradient(to right, transparent calc(100% - 25px), ${C.colors.background.primary}); } `,rowValuesWrap:(0,t.css)` padding-left: ${h}; width: calc(${P} * ${E}); display: flex; `}),o=({totalNumberOfValues:C,values:P,hideFieldsWithoutValues:b})=>{const M=(0,r.wW)(T=>u(T,C));return n.createElement("div",{role:"cell",className:M.rowValuesWrap},P?.map(T=>b&&(T.value===void 0||T.value===l.T)?null:n.createElement("span",{key:T.key,className:M.rowWrapper},n.createElement("span",{className:M.rowValue},T.value))))},m=C=>{const P=C.isDark?"#ce9178":"#a31515",b=C.isDark?"#73bf69":"#56a64b";return{metricName:(0,t.css)` color: ${b}; `,metricValue:(0,t.css)` color: ${P}; `,expanded:(0,t.css)` display: block; text-indent: 1em; `}},p=({value:C,index:P,length:b,isExpandedView:M})=>{const T=(0,r.wW)(m),S=C.key,x=C.value;return n.createElement("span",{className:M?T.expanded:"",key:P},n.createElement("span",{className:T.metricName},S),n.createElement("span",null,"="),n.createElement("span",null,'"'),n.createElement("span",{className:T.metricValue},x),n.createElement("span",null,'"'),P<b-1&&n.createElement("span",null,", "))},f="20px",E="80px",h="25px",y=(C,P,b)=>({rowWrapper:(0,t.css)` border-bottom: 1px solid ${C.colors.border.medium}; display: flex; position: relative; padding-left: 22px; ${b?"":"align-items: center;"} ${b?"":"height: 100%;"} `,copyToClipboardWrapper:(0,t.css)` position: absolute; left: 0; ${b?"":"bottom: 0;"} ${b?"top: 4px;":"top: 0;"} margin: auto; z-index: 1; height: 16px; width: 16px; `,rowLabelWrapWrap:(0,t.css)` position: relative; width: calc(100% - (${P} * ${E}) - ${h}); `,rowLabelWrap:(0,t.css)` white-space: nowrap; overflow-x: auto; -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ padding-right: ${f}; &::-webkit-scrollbar { display: none; /* Chrome, Safari and Opera */ } &:after { pointer-events: none; content: ''; width: 100%; height: 100%; position: absolute; left: 0; top: 0; background: linear-gradient( to right, transparent calc(100% - ${f}), ${C.colors.background.primary} ); } `});function v(C){let P=[],b=[];for(const M in C)M in C&&C[M]&&!M.includes("Value")?P.push({key:M,value:C[M]}):M in C&&C[M]&&M.includes("Value")&&b.push({key:M,value:C[M]});return{values:b,attributeValues:P}}const a=({listItemData:C,listKey:P,totalNumberOfValues:b,valueLabels:M,isExpandedView:T})=>{const{__name__:S,...x}=C,[O,B]=(0,i.Z)(),A=M?.length??b,V=(0,r.wW)(H=>y(H,A,T)),{values:W,attributeValues:w}=v(x),N=H=>H==="\u221E"||H==="Infinity"?"+Inf":H,F=`${S}{${w.map(H=>`${H.key}="${N(H.value)}"`)}}`,k=!!(M&&M?.length);return n.createElement(n.Fragment,null,M!==void 0&&T&&n.createElement(d.I,{valueLabels:M,expanded:T}),n.createElement("div",{key:P,className:V.rowWrapper},n.createElement("span",{className:V.copyToClipboardWrapper},n.createElement(g.h,{tooltip:"Copy to clipboard",onClick:()=>{(0,s.ff)("grafana_explore_prometheus_instant_query_ui_raw_toggle_expand"),B(F)},name:"copy"})),n.createElement("span",{role:"cell",className:V.rowLabelWrapWrap},n.createElement("div",{className:V.rowLabelWrap},n.createElement("span",null,S),n.createElement("span",null,"{"),n.createElement("span",null,w.map((H,R)=>n.createElement(p,{isExpandedView:T,value:H,key:R,index:R,length:w.length}))),n.createElement("span",null,"}"))),n.createElement(o,{hideFieldsWithoutValues:k,totalNumberOfValues:A,values:W})))}},58692:(j,I,e)=>{"use strict";e.d(I,{q:()=>i});var t=e(27702),n=e(99633);const i=({timeInMs:r,className:g,humanize:d})=>t.createElement("span",{className:g},s(r,d)),s=(r,g=!1)=>{const d=r/1e3;if(!g)return`${d.toFixed(1)}s`;const l=(0,n.Ks)(d,"seconds"),u=l.hours(),o=l.minutes(),m=l.seconds();return u?`${u}h ${o}m ${m}s`:o?`${o}m ${m}s`:`${m}s`}},67066:(j,I,e)=>{"use strict";e.d(I,{m:()=>Ee});var t=e(42844),n=e(27702),i=e(73195),s=e(62247),r=e(3569),g=e(39317),d=e(66310),l=e(51778),u=e(5926),o=e(6327),m=e(18771),c=e(92662),p=e(28382),f=e(89898),E=e.n(f),h=e(82152),y=e(90170),v=e(80402),D=e(20609),a=e(84720);const C=.8,P=2,b=200,M=10,T=60,S=6;function x(Ae,ze,Ie,xe,Te){const Oe=new Map,ie=ze.length<T?T:Math.min(ze.length,b),Le=window.innerWidth*2;Ae.width=Le,Ae.height=ie;const Be=Math.min(S,Math.max(P,ie/ze.length)),Ue=ie/ze.length,ue=Ae.getContext("2d",{alpha:!1});if(ue){ue.fillStyle=Te,ue.fillRect(0,0,Le,ie);for(let pe=0;pe<ze.length;pe++){const{valueWidth:$e,valueOffset:Se,serviceName:Ve}=ze[pe],He=Se/Ie*Le;let Ze=$e/Ie*Le;Ze<M&&(Ze=M);let Qe=Oe.get(Ve);Qe||(Qe=`rgba(${xe(Ve).concat(C).join()})`,Oe.set(Ve,Qe)),ue.fillStyle=Qe,ue.fillRect(He,pe*Ue,Ze,Be)}}}const O=(0,v.B)(Ae=>({CanvasSpanGraph:(0,t.css)` label: CanvasSpanGraph; background: ${(0,D.h)(Ae,"#fafafa")}; height: 60px; position: absolute; width: 100%; `}));class B extends n.PureComponent{constructor(ze){super(ze),this.getColor=Ie=>(0,a.e6)(Ie,this.props.theme),this._setCanvasRef=Ie=>{this._canvasElm=Ie},this._canvasElm=void 0}componentDidMount(){this._draw()}componentDidUpdate(){this._draw()}_draw(){if(this._canvasElm){const{valueWidth:ze,items:Ie}=this.props;x(this._canvasElm,Ie,ze,this.getColor,(0,D.h)(this.props.theme,"#fff"))}}render(){return n.createElement("canvas",{className:O(this.props.theme).CanvasSpanGraph,ref:this._setCanvasRef,"data-testid":"CanvasSpanGraph"})}}const A=(0,d.HE)(B);var V=e(25985);const W=()=>({TickLabels:(0,t.css)` label: TickLabels; height: 1rem; position: relative; `,TickLabelsLabel:(0,t.css)` label: TickLabelsLabel; color: #717171; font-size: 0.7rem; position: absolute; user-select: none; `});function w(Ae){const{numTicks:ze,duration:Ie}=Ae,xe=(0,d.wW)(W),Te=[];for(let Oe=0;Oe<ze+1;Oe++){const ie=Oe/ze,Le=ie===1?{right:"0%"}:{left:`${ie*100}%`};Te.push(n.createElement("div",{key:ie,className:xe.TickLabelsLabel,style:Le,"data-testid":"tick"},(0,V.LU)(Ie*ie)))}return n.createElement("div",{className:xe.TickLabels,"data-testid":"TickLabels"},Te)}var N=e(66670),F=e(8033);const k=()=>({GraphTick:(0,t.css)` label: GraphTick; stroke: #aaa; stroke-width: 1px; `});function H(Ae){const{numTicks:ze}=Ae,Ie=(0,d.wW)(k),xe=[];for(let Te=1;Te<ze;Te++){const Oe=`${Te/ze*100}%`;xe.push(n.createElement("line",{className:Ie.GraphTick,x1:Oe,y1:"0%",x2:Oe,y2:"100%",key:Te/ze}))}return n.createElement("g",{"data-testid":"ticks","aria-hidden":"true"},xe)}const R=()=>({ScrubberHandleExpansion:E()((0,t.css)` label: ScrubberHandleExpansion; cursor: col-resize; fill-opacity: 0; fill: #44f; `,"scrubber-handle-expansion"),ScrubberHandle:E()((0,t.css)` label: ScrubberHandle; cursor: col-resize; fill: #555; `,"scrubber-handle"),ScrubberLine:E()((0,t.css)` label: ScrubberLine; pointer-events: none; stroke: #555; `,"scrubber-line"),ScrubberDragging:(0,t.css)` label: ScrubberDragging; & .scrubber-handle-expansion { fill-opacity: 1; } & .scrubber-handle { fill: #44f; } & > .scrubber-line { stroke: #44f; } `,ScrubberHandles:(0,t.css)` label: ScrubberHandles; &:hover > .scrubber-handle-expansion { fill-opacity: 1; } &:hover > .scrubber-handle { fill: #44f; } &:hover + .scrubber.line { stroke: #44f; } `});function _({isDragging:Ae,onMouseDown:ze,onMouseEnter:Ie,onMouseLeave:xe,position:Te}){const Oe=`${Te*100}%`,ie=(0,d.wW)(R),Le=E()({[ie.ScrubberDragging]:Ae});return n.createElement("g",{className:Le,"data-testid":"scrubber-component"},n.createElement("g",{"data-testid":"scrubber-component-g",className:ie.ScrubberHandles,onMouseDown:ze,onMouseEnter:Ie,onMouseLeave:xe},n.createElement("rect",{"data-testid":"scrubber-component-rect-1",x:Oe,className:ie.ScrubberHandleExpansion,style:{transform:"translate(-4.5px)"},width:"9",height:"20"}),n.createElement("rect",{"data-testid":"scrubber-component-rect-2",x:Oe,className:ie.ScrubberHandle,style:{transform:"translate(-1.5px)"},width:"3",height:"20"})),n.createElement("line",{className:ie.ScrubberLine,y2:"100%",x1:Oe,x2:Oe,"data-testid":"scrubber-component-line"}))}const G=(0,v.B)(Ae=>{const ze="JaegerUiComponents__ViewingLayerResetZoomHoverClassName",Ie=(0,t.css)` label: ViewingLayerResetZoom; display: none; position: absolute; right: 1%; top: 10%; z-index: 1; `;return{ViewingLayer:(0,t.css)` label: ViewingLayer; cursor: vertical-text; position: relative; z-index: 1; &:hover > .${ze} { display: unset; } `,ViewingLayerGraph:(0,t.css)` label: ViewingLayerGraph; border: 1px solid ${(0,D.h)(Ae,"#999")}; /* need !important here to overcome something from semantic UI */ overflow: visible !important; position: relative; transform-origin: 0 0; width: 100%; `,ViewingLayerInactive:(0,t.css)` label: ViewingLayerInactive; fill: ${(0,D.h)(Ae,"rgba(214, 214, 214, 0.5)")}; `,ViewingLayerCursorGuide:(0,t.css)` label: ViewingLayerCursorGuide; stroke: ${(0,D.h)(Ae,"#f44")}; stroke-width: 1; `,ViewingLayerDraggedShift:(0,t.css)` label: ViewingLayerDraggedShift; fill-opacity: 0.2; `,ViewingLayerDrag:(0,t.css)` label: ViewingLayerDrag; fill: ${(0,D.h)(Ae,"#44f")}; `,ViewingLayerFullOverlay:(0,t.css)` label: ViewingLayerFullOverlay; bottom: 0; cursor: col-resize; left: 0; position: fixed; right: 0; top: 0; user-select: none; `,ViewingLayerResetZoom:Ie,ViewingLayerResetZoomHoverClassName:ze}}),Y={SHIFT_END:"SHIFT_END",SHIFT_START:"SHIFT_START",REFRAME:"REFRAME"};function X(Ae,ze){const[Ie,xe]=Ae<ze?[Ae,ze]:[ze,Ae];return{x:`${Ie*100}%`,width:`${(xe-Ie)*100}%`,leadingX:`${ze*100}%`}}class Q extends n.PureComponent{constructor(ze){super(ze),this._setRoot=Ie=>{this._root=Ie},this._getDraggingBounds=Ie=>{if(!this._root)throw new Error("invalid state");const{left:xe,width:Te}=this._root.getBoundingClientRect(),[Oe,ie]=this.props.viewRange.time.current;let Le=1,Be=0;return Ie===Y.SHIFT_START?Le=ie:Ie===Y.SHIFT_END&&(Be=Oe),{clientXLeft:xe,maxValue:Le,minValue:Be,width:Te}},this._handleReframeMouseMove=({value:Ie})=>{this.props.updateNextViewRangeTime({cursor:Ie})},this._handleReframeMouseLeave=()=>{this.props.updateNextViewRangeTime({cursor:null})},this._handleReframeDragUpdate=({value:Ie})=>{const xe=Ie,{time:Te}=this.props.viewRange,ie={reframe:{anchor:Te.reframe?Te.reframe.anchor:xe,shift:xe}};this.props.updateNextViewRangeTime(ie)},this._handleReframeDragEnd=({manager:Ie,value:xe})=>{const{time:Te}=this.props.viewRange,Oe=Te.reframe?Te.reframe.anchor:xe,[ie,Le]=xe<Oe?[xe,Oe]:[Oe,xe];Ie.resetBounds(),this.props.updateViewRangeTime(ie,Le,"minimap")},this._handleScrubberEnterLeave=({type:Ie})=>{const xe=Ie===F.EUpdateTypes.MouseEnter;this.setState({preventCursorLine:xe})},this._handleScrubberDragUpdate=({event:Ie,tag:xe,type:Te,value:Oe})=>{Te===F.EUpdateTypes.DragStart&&Ie.stopPropagation(),xe===Y.SHIFT_START?this.props.updateNextViewRangeTime({shiftStart:Oe}):xe===Y.SHIFT_END&&this.props.updateNextViewRangeTime({shiftEnd:Oe})},this._handleScrubberDragEnd=({manager:Ie,tag:xe,value:Te})=>{const[Oe,ie]=this.props.viewRange.time.current;let Le;if(xe===Y.SHIFT_START)Le=[Te,ie];else if(xe===Y.SHIFT_END)Le=[Oe,Te];else throw new Error("bad state");Ie.resetBounds(),this.setState({preventCursorLine:!1}),this.props.updateViewRangeTime(Le[0],Le[1],"minimap")},this._resetTimeZoomClickHandler=()=>{this.props.updateViewRangeTime(0,1)},this._draggerReframe=new F.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleReframeDragEnd,onDragMove:this._handleReframeDragUpdate,onDragStart:this._handleReframeDragUpdate,onMouseMove:this._handleReframeMouseMove,onMouseLeave:this._handleReframeMouseLeave,tag:Y.REFRAME}),this._draggerStart=new F.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleScrubberDragEnd,onDragMove:this._handleScrubberDragUpdate,onDragStart:this._handleScrubberDragUpdate,onMouseEnter:this._handleScrubberEnterLeave,onMouseLeave:this._handleScrubberEnterLeave,tag:Y.SHIFT_START}),this._draggerEnd=new F.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleScrubberDragEnd,onDragMove:this._handleScrubberDragUpdate,onDragStart:this._handleScrubberDragUpdate,onMouseEnter:this._handleScrubberEnterLeave,onMouseLeave:this._handleScrubberEnterLeave,tag:Y.SHIFT_END}),this._root=void 0,this.state={preventCursorLine:!1}}componentWillUnmount(){this._draggerReframe.dispose(),this._draggerEnd.dispose(),this._draggerStart.dispose()}_getMarkers(ze,Ie){const xe=G(this.props.theme),Te=X(ze,Ie);return[n.createElement("rect",{key:"fill",className:E()(xe.ViewingLayerDraggedShift,xe.ViewingLayerDrag),x:Te.x,y:"0",width:Te.width,height:this.props.height-2}),n.createElement("rect",{key:"edge",className:E()(xe.ViewingLayerDrag),x:Te.leadingX,y:"0",width:"1",height:this.props.height-2})]}render(){const{height:ze,viewRange:Ie,numTicks:xe,theme:Te}=this.props,{preventCursorLine:Oe}=this.state,{current:ie,cursor:Le,shiftStart:Be,shiftEnd:Ue,reframe:ue}=Ie.time,pe=Be!=null||Ue!=null||ue!=null,[$e,Se]=ie;let Ve=0;$e&&(Ve=$e*100);let He=100;Se&&(He=100-Se*100);let Ze;!pe&&Le!=null&&!Oe&&(Ze=`${Le*100}%`);const Qe=G(Te);return n.createElement("div",{"aria-hidden":!0,className:Qe.ViewingLayer,style:{height:ze}},($e!==0||Se!==1)&&n.createElement(N.zx,{onClick:this._resetTimeZoomClickHandler,className:E()(Qe.ViewingLayerResetZoom,Qe.ViewingLayerResetZoomHoverClassName),type:"button",variant:"secondary"},"Reset Selection"),n.createElement("svg",{height:ze,className:Qe.ViewingLayerGraph,ref:this._setRoot,onMouseDown:this._draggerReframe.handleMouseDown,onMouseLeave:this._draggerReframe.handleMouseLeave,onMouseMove:this._draggerReframe.handleMouseMove},Ve>0&&n.createElement("rect",{x:0,y:0,height:"100%",width:`${Ve}%`,className:Qe.ViewingLayerInactive,"data-testid":"left-ViewingLayerInactive"}),He>0&&n.createElement("rect",{x:`${100-He}%`,y:0,height:"100%",width:`${He}%`,className:Qe.ViewingLayerInactive,"data-testid":"right-ViewingLayerInactive"}),n.createElement(H,{numTicks:xe}),Ze&&n.createElement("line",{className:Qe.ViewingLayerCursorGuide,x1:Ze,y1:"0",x2:Ze,y2:ze-2,strokeWidth:"1","data-testid":"ViewingLayerCursorGuide"}),Be!=null&&this._getMarkers($e,Be),Ue!=null&&this._getMarkers(Se,Ue),n.createElement(_,{isDragging:Be!=null,onMouseDown:this._draggerStart.handleMouseDown,onMouseEnter:this._draggerStart.handleMouseEnter,onMouseLeave:this._draggerStart.handleMouseLeave,position:$e||0}),n.createElement(_,{isDragging:Ue!=null,position:Se||1,onMouseDown:this._draggerEnd.handleMouseDown,onMouseEnter:this._draggerEnd.handleMouseEnter,onMouseLeave:this._draggerEnd.handleMouseLeave}),ue!=null&&this._getMarkers(ue.anchor,ue.shift)),pe&&n.createElement("div",{className:Qe.ViewingLayerFullOverlay}))}}const se=(0,d.HE)(Q),Z=60,le=4;function oe(Ae){return{valueOffset:Ae.relativeStartTime,valueWidth:Ae.duration,serviceName:Ae.process.serviceName}}function q(Ae){return Ae.spans.map(oe)}const ne=(0,h.Z)(q);class ge extends n.PureComponent{render(){const{height:ze,trace:Ie,viewRange:xe,updateNextViewRangeTime:Te,updateViewRangeTime:Oe}=this.props;if(!Ie)return n.createElement("div",null);const ie=ne(Ie);return n.createElement("div",{className:E()(y.GL,y.H3)},n.createElement(w,{numTicks:le,duration:Ie.duration}),n.createElement("div",{className:y.WW},n.createElement(A,{valueWidth:Ie.duration,items:ie}),n.createElement(se,{viewRange:xe,numTicks:le,height:ze||Z,updateViewRangeTime:Oe,updateNextViewRangeTime:Te})))}}ge.defaultProps={height:Z};var ae=e(76305),re=e(99633),De=e(73453),he=e(20205),ye=e(66798);function ce({splitOpenFn:Ae,traceToLogsOptions:ze,traceToMetricsOptions:Ie,dataFrame:xe,createFocusSpanLink:Te,trace:Oe}){if(!xe)return;let ie=Ke(Oe);const Le=xe.fields.some(Ue=>!!Ue.config.links?.length),Be=ke(Ae,xe.fields[0],ze,Ie,Te,ie);return function(ue){let pe=Be(ue);if(Le){ie={...ie,...Ye(ue)};const $e=xe.fields.filter(Se=>!!Se.config.links?.length);try{let Se=[];$e.forEach(He=>{const Ze=(0,he.a_)({field:He,rowIndex:ue.dataFrameRowIndex,splitOpenFn:Ae,range:Me(ue),dataFrame:xe,vars:ie});Se=Se.concat(Ze)});const Ve=Se.map(He=>({title:He.title,href:He.href,onClick:He.onClick,content:n.createElement(De.J,{name:"link",title:He.title||"Link"}),field:He.origin,type:ye.u.Unknown}));pe.push.apply(pe,Ve)}catch(Se){return console.error(Se),pe}}return pe}}const We=["cluster","hostname","namespace","pod"].map(Ae=>({key:Ae}));function ke(Ae,ze,Ie,xe,Te,Oe){let ie;Ie?.datasourceUid&&(ie=(0,u.ak)().getInstanceSettings(Ie.datasourceUid));const Le=ie?.type==="grafana-splunk-datasource";let Be;return xe?.datasourceUid&&(Be=(0,u.ak)().getInstanceSettings(xe.datasourceUid)),function(ue){Oe={...Oe,...Ye(ue)};const pe=[];let $e,Se="";if(ie&&Ie){const Ve=Ie.customQuery?Ie.query:void 0,He=Ie.tags||We;switch(ie?.type){case"loki":Se=st(ue,He),$e=et(ue,Ie,Se,Ve);break;case"grafana-splunk-datasource":Se=st(ue,He,{joinBy:" "}),$e=_e(ue,Ie,Se,Ve);break;case"elasticsearch":case"grafana-opensearch-datasource":Se=st(ue,He,{labelValueSign:":",joinBy:" AND "}),$e=we(ue,Ie,Se,Ve);break;case"grafana-falconlogscale-datasource":Se=st(ue,He,{joinBy:" OR "}),$e=qe(ue,Ie,Se,Ve);break;case"googlecloud-logging-datasource":Se=st(ue,He,{joinBy:" AND "}),$e=Ge(ue,Ie,Se,Ve)}if($e){const Ze={title:ie.name,url:"",internal:{datasourceUid:ie.uid,datasourceName:ie.name,query:$e}};if(Oe={...Oe,__tags:{text:"Tags",value:Se}},(0,he.lt)(Ze.internal.query,Oe).allVariablesDefined){const Qe=(0,r._)({link:Ze,internalLink:Ze.internal,scopedVars:Oe,range:Me(ue,{startMs:Ie.spanStartTimeShift?ae.intervalToMs(Ie.spanStartTimeShift):0,endMs:Ie.spanEndTimeShift?ae.intervalToMs(Ie.spanEndTimeShift):0},Le),field:{},onClickFn:Ae,replaceVariables:(0,g.J)().replace.bind((0,g.J)())});pe.push({href:Qe.href,title:"Related logs",onClick:Qe.onClick,content:n.createElement(De.J,{name:"gf-logs",title:"Explore the logs for this in split view"}),field:ze,type:ye.u.Logs})}}}if(Be&&xe?.queries)for(const Ve of xe.queries){const He=be(Ve,xe?.tags||[],ue),Ze={title:Be.name,url:"",internal:{datasourceUid:Be.uid,datasourceName:Be.name,query:{expr:He,refId:"A"}}},Qe=(0,r._)({link:Ze,internalLink:Ze.internal,scopedVars:{},range:Me(ue,{startMs:xe.spanStartTimeShift?ae.intervalToMs(xe.spanStartTimeShift):0,endMs:xe.spanEndTimeShift?ae.intervalToMs(xe.spanEndTimeShift):0}),field:{},onClickFn:Ae,replaceVariables:(0,g.J)().replace.bind((0,g.J)())});pe.push({title:Ve?.name,href:Qe.href,onClick:Qe.onClick,content:n.createElement(De.J,{name:"chart-line",title:"Explore metrics for this span"}),field:ze,type:ye.u.Metrics})}if(ue.references&&Te)for(const Ve of ue.references){if(Ve.refType==="CHILD_OF")continue;const He=Te(Ve.traceID,Ve.spanID);pe.push({href:He.href,title:Ve.span?Ve.span.operationName:"View linked span",content:n.createElement(De.J,{name:"link",title:"View linked span"}),onClick:He.onClick,field:He.origin,type:ye.u.Traces})}if(ue.subsidiarilyReferencedBy&&Te)for(const Ve of ue.subsidiarilyReferencedBy){const He=Te(Ve.traceID,Ve.spanID);pe.push({href:He.href,title:Ve.span?Ve.span.operationName:"View linked span",content:n.createElement(De.J,{name:"link",title:"View linked span"}),onClick:He.onClick,field:He.origin,type:ye.u.Traces})}return pe}}function et(Ae,ze,Ie,xe){const{filterByTraceID:Te,filterBySpanID:Oe}=ze;if(xe)return{expr:xe,refId:""};if(!Ie)return;let ie="{${__tags}}";return Te&&Ae.traceID&&(ie+=' |="${__span.traceId}"'),Oe&&Ae.spanID&&(ie+=' |="${__span.spanId}"'),{expr:ie,refId:""}}function we(Ae,ze,Ie,xe){const{filterByTraceID:Te,filterBySpanID:Oe}=ze;if(xe)return{query:xe,refId:"",metrics:[{id:"1",type:"logs"}]};let ie=[];return Oe&&Ae.spanID&&ie.push('"${__span.spanId}"'),Te&&Ae.traceID&&ie.push('"${__span.traceId}"'),Ie&&ie.push("${__tags}"),{query:ie.join(" AND "),refId:"",metrics:[{id:"1",type:"logs"}]}}function _e(Ae,ze,Ie,xe){const{filterByTraceID:Te,filterBySpanID:Oe}=ze;if(xe)return{query:xe,refId:""};let ie="";return Ie&&(ie+="${__tags}"),Te&&Ae.traceID&&(ie+=' "${__span.traceId}"'),Oe&&Ae.spanID&&(ie+=' "${__span.spanId}"'),{query:ie,refId:""}}function Ge(Ae,ze,Ie,xe){const{filterByTraceID:Te,filterBySpanID:Oe}=ze;if(xe)return{query:xe,refId:""};let ie=[];return Oe&&Ae.spanID&&ie.push('"${__span.spanId}"'),Te&&Ae.traceID&&ie.push('"${__span.traceId}"'),Ie&&ie.push("${__tags}"),{query:ie.join(" AND "),refId:""}}function qe(Ae,ze,Ie,xe){const{filterByTraceID:Te,filterBySpanID:Oe}=ze;if(xe)return{lsql:xe,refId:""};if(!Ie)return;let ie="${__tags}";return Te&&Ae.traceID&&(ie+=' or "${__span.traceId}"'),Oe&&Ae.spanID&&(ie+=' or "${__span.spanId}"'),{lsql:ie,refId:""}}function st(Ae,ze,{labelValueSign:Ie="=",joinBy:xe=", "}={}){return[...Ae.process.tags,...Ae.tags,{key:"spanId",value:Ae.spanID},{key:"traceId",value:Ae.traceID},{key:"name",value:Ae.operationName},{key:"duration",value:Ae.duration}].map(Te=>{const Oe=ze.find(ie=>ie.key===Te.key);if(Oe)return`${Oe.value?Oe.value:Oe.key}${Ie}"${Te.value}"`}).filter(Te=>!!Te).join(xe)}function Me(Ae,ze={startMs:0,endMs:0},Ie=!1){const xe=Math.floor(Ae.startTime/1e3+ze.startMs),Te=(0,re.CQ)(xe),Oe=(Ae.startTime+Ae.duration)/1e3;let ie=Math.floor(Oe+ze.endMs);Ie&&ie-xe<1e3?ie=xe+1e3:xe===ie&&ie++;const Le=(0,re.CQ)(ie);return{from:Te,to:Le,raw:{from:Te,to:Le}}}function be(Ae,ze=[],Ie){if(!Ae.query)return`histogram_quantile(0.5, sum(rate(traces_spanmetrics_latency_bucket{service="${Ie.process.serviceName}"}[5m])) by (le))`;let xe=Ae.query;if(ze.length&&xe.indexOf("$__tags")!==-1){const Te=[...Ie.process.tags,...Ie.tags],ie=ze.reduce((Le,Be)=>{const Ue=Te.find(ue=>ue.key===Be.key)?.value;return Ue&&Le.push(`${Be.value?Be.value:Be.key}="${Ue}"`),Le},[])?.join(", ");xe=xe.replace(/\$__tags/g,ie)}return xe}function Ke(Ae){return{__trace:{text:"Trace",value:{duration:Ae.duration,name:Ae.traceName,traceId:Ae.traceID}}}}function Ye(Ae){const ze={};for(const Ie of Ae.process.tags)ze[Ie.key]=Ie.value;for(const Ie of Ae.tags)ze[Ie.key]=Ie.value;return{__span:{text:"Span",value:{spanId:Ae.spanID,traceId:Ae.traceID,duration:Ae.duration,name:Ae.operationName,tags:ze}}}}function tt(){const[Ae,ze]=(0,n.useState)(new Set),Ie=(0,n.useCallback)(function(Be){if(Ae.size===0)return;let Ue=-1,ue=!0;const pe=Be.reduce(($e,Se)=>(Se.depth<=Ue&&(ue=!0),ue&&$e.has(Se.spanID)&&($e.delete(Se.spanID),ue=!1,Ue=Se.depth),$e),new Set(Ae));ze(pe)},[Ae]),xe=(0,n.useCallback)(function(Be){if(nt(Be,Ae))return;let Ue;const ue=Be.reduce((pe,$e)=>(Ue&&$e.depth<=Ue.depth?(pe.add(Ue.spanID),$e.hasChildren&&(Ue=$e)):$e.hasChildren&&!pe.has($e.spanID)&&(Ue=$e),pe),new Set(Ae));Ue&&ue.add(Ue.spanID),ze(ue)},[Ae]),Te=(0,n.useCallback)(function(){ze(new Set)},[]),Oe=(0,n.useCallback)(function(Be){if(nt(Be,Ae))return;const Ue=Be.reduce((ue,pe)=>(pe.hasChildren&&ue.add(pe.spanID),ue),new Set);ze(Ue)},[Ae]),ie=(0,n.useCallback)(function(Be){const Ue=new Set(Ae);Ae.has(Be)?Ue.delete(Be):Ue.add(Be),ze(Ue)},[Ae]);return{childrenHiddenIDs:Ae,expandOne:Ie,collapseOne:xe,expandAll:Te,collapseAll:Oe,childrenToggle:ie}}function nt(Ae,ze){return Ae.filter(xe=>xe.hasChildren).length===ze.size}function Pt(Ae){const[ze,Ie]=(0,n.useState)(new Map);(0,n.useEffect)(()=>{Ie(new Map)},[Ae,Ie]);const xe=(0,n.useCallback)(function(Le){const Be=new Map(ze);Be.has(Le)?Be.delete(Le):Be.set(Le,new p.DetailState),Ie(Be)},[ze]),Te=(0,n.useCallback)(function(Le,Be){const Ue=ze.get(Le);if(!Ue)return;const ue=Ue.toggleLogItem(Be),pe=new Map(ze);return pe.set(Le,ue),Ie(pe)},[ze]),Oe=(0,n.useCallback)(function(Le,Be){const Ue=ze.get(Le);if(!Ue)return;const ue=Ue.toggleReferenceItem(Be),pe=new Map(ze);return pe.set(Le,ue),Ie(pe)},[ze]);return{detailStates:ze,toggleDetail:xe,detailLogItemToggle:Te,detailLogsToggle:(0,n.useCallback)(ie=>xt("logs",ze,Ie)(ie),[ze]),detailWarningsToggle:(0,n.useCallback)(ie=>xt("warnings",ze,Ie)(ie),[ze]),detailStackTracesToggle:(0,n.useCallback)(ie=>xt("stackTraces",ze,Ie)(ie),[ze]),detailReferenceItemToggle:Oe,detailReferencesToggle:(0,n.useCallback)(ie=>xt("references",ze,Ie)(ie),[ze]),detailProcessToggle:(0,n.useCallback)(ie=>xt("process",ze,Ie)(ie),[ze]),detailTagsToggle:(0,n.useCallback)(ie=>xt("tags",ze,Ie)(ie),[ze])}}function xt(Ae,ze,Ie){return xe=>{const Te=ze.get(xe);if(!Te)return;let Oe;Ae==="tags"?Oe=Te.toggleTags():Ae==="process"?Oe=Te.toggleProcess():Ae==="warnings"?Oe=Te.toggleWarnings():Ae==="references"?Oe=Te.toggleReferences():Ae==="stackTraces"?Oe=Te.toggleStackTraces():Oe=Te.toggleLogs();const ie=new Map(ze);ie.set(xe,Oe),Ie(ie)}}function bt(){const[Ae,ze]=(0,n.useState)(new Set),Ie=(0,n.useCallback)(function(Oe){ze(ie=>{const Le=new Set(ie);return Le.add(Oe),Le})},[]),xe=(0,n.useCallback)(function(Oe){ze(ie=>{const Le=new Set(ie);return Le.delete(Oe),Le})},[]);return{hoverIndentGuideIds:Ae,addHoverIndentGuideId:Ie,removeHoverIndentGuideId:xe}}var Rt=e(24540);function ct(){const[Ae,ze]=(0,n.useState)({time:{current:[0,1]}}),Ie=(0,n.useCallback)(function(Oe){ze(ie=>{const Le={...ie.time,...Oe};return{...ie,time:Le}})},[]),xe=(0,n.useCallback)(function(Oe,ie){const Be={current:[Oe,ie]};ze(Ue=>({...Ue,time:Be}))},[]);return{viewRange:Ae,updateViewRangeTime:xe,updateNextViewRangeTime:Ie}}const it=Ae=>({noDataMsg:(0,t.css)` height: 100%; width: 100%; display: grid; place-items: center; font-size: ${Ae.typography.h4.fontSize}; color: ${Ae.colors.text.secondary}; `});function me(){return{}}function Ee(Ae){const{traceProp:ze,datasource:Ie,topOfViewRef:xe,topOfViewRefType:Te,exploreId:Oe}=Ae,{detailStates:ie,toggleDetail:Le,detailLogItemToggle:Be,detailLogsToggle:Ue,detailProcessToggle:ue,detailReferencesToggle:pe,detailReferenceItemToggle:$e,detailTagsToggle:Se,detailWarningsToggle:Ve,detailStackTracesToggle:He}=Pt(Ae.dataFrames[0]),{removeHoverIndentGuideId:Ze,addHoverIndentGuideId:Qe,hoverIndentGuideIds:rt}=bt(),{viewRange:pt,updateViewRangeTime:It,updateNextViewRangeTime:_t}=ct(),{expandOne:tn,collapseOne:qt,childrenToggle:cn,collapseAll:on,childrenHiddenIDs:ln,expandAll:Un}=tt(),{search:yt,setSearch:ft,spanFilterMatches:Tt}=(0,Rt.Rx)(ze?.spans),[Bt,Nt]=(0,n.useState)(""),[Ft,Gt]=(0,i.Z)(!1),[dn,sn]=(0,n.useState)(!1),[Bn,wt]=(0,n.useState)(100),Vt=(0,d.wW)(it),[Ht,Xt]=(0,n.useState)(.25),[mn,pn]=Ce({refId:Ae.dataFrames[0]?.refId,exploreId:Ae.exploreId,datasource:Ie,splitOpenFn:Ae.splitOpenFn}),Pn=(0,n.useMemo)(()=>({childrenHiddenIDs:ln,detailStates:ie,hoverIndentGuideIds:rt,spanNameColumnWidth:Ht,traceID:Ae.traceProp?.traceID}),[ln,ie,rt,Ht,Ae.traceProp?.traceID]),zn=(0,u.ak)().getInstanceSettings(Ie?.name),Hn=(0,l.p1)(zn?.jsonData),Ea=zn?.jsonData?.tracesToMetrics,aa=zn?.jsonData,na=(0,n.useMemo)(()=>ce({splitOpenFn:Ae.splitOpenFn,traceToLogsOptions:Hn,traceToMetricsOptions:Ea,dataFrame:Ae.dataFrames[0],createFocusSpanLink:pn,trace:ze}),[Ae.splitOpenFn,Hn,Ea,Ae.dataFrames,pn,ze]),xa=(0,m.useSelector)(ka=>(0,o.Z)(ka.user)),Ca=Ie?Ie?.type:"unknown",Ba=Ae.scrollElement?Ae.scrollElement:document.getElementsByClassName(Ae.scrollElementClass??"")[0];return n.createElement(n.Fragment,null,Ae.dataFrames?.length&&ze?n.createElement(n.Fragment,null,n.createElement(p.TracePageHeader,{trace:ze,data:Ae.dataFrames[0],timeZone:xa,search:yt,setSearch:ft,showSpanFilters:Ft,setShowSpanFilters:Gt,showSpanFilterMatchesOnly:dn,setShowSpanFilterMatchesOnly:sn,setFocusedSpanIdForSearch:Nt,spanFilterMatches:Tt,datasourceType:Ca,setHeaderHeight:wt,app:Oe?s.zj.Explore:s.zj.Unknown}),n.createElement(ge,{trace:ze,viewRange:pt,updateNextViewRangeTime:_t,updateViewRangeTime:It}),n.createElement(p.TraceTimelineViewer,{registerAccessors:me,findMatchesIDs:Tt,trace:ze,datasourceType:Ca,spanBarOptions:aa?.spanBar,traceTimeline:Pn,updateNextViewRangeTime:_t,updateViewRangeTime:It,viewRange:pt,timeZone:xa,setSpanNameColumnWidth:Xt,collapseAll:on,collapseOne:qt,expandAll:Un,expandOne:tn,childrenToggle:cn,detailLogItemToggle:Be,detailLogsToggle:Ue,detailWarningsToggle:Ve,detailStackTracesToggle:He,detailReferencesToggle:pe,detailReferenceItemToggle:$e,detailProcessToggle:ue,detailTagsToggle:Se,detailToggle:Le,addHoverIndentGuideId:Qe,removeHoverIndentGuideId:Ze,linksGetter:()=>[],createSpanLink:na,scrollElement:Ba,focusedSpanId:mn,focusedSpanIdForSearch:Bt,showSpanFilterMatchesOnly:dn,createFocusSpanLink:pn,topOfViewRef:xe,topOfViewRefType:Te,headerHeight:Bn})):n.createElement("div",{className:Vt.noDataMsg},"No data"))}function Ce(Ae){const ze=(0,m.useSelector)(Le=>Le.explore.panes[Ae.exploreId]?.panelsState.trace),Ie=ze?.spanId,xe=(0,m.useDispatch)(),Te=Le=>xe((0,c.km)(Ae.exploreId,"trace",{...ze,spanId:Le})),Oe=(0,m.useSelector)(Le=>Le.explore.panes[Ae.exploreId]?.queries.find(Be=>Be.refId===Ae.refId));return[Ie,(Le,Be)=>{const Ue={title:"Deep link to this span",url:"",internal:{datasourceUid:Ae.datasource?.uid,datasourceName:Ae.datasource?.name,query:{...Oe,query:Le},panelsState:{trace:{spanId:Be}}}},ue=Oe?.queryType==="traceql"&&Oe.query===Le;return(0,r._)({link:Ue,internalLink:Ue.internal,scopedVars:{},range:{},field:{},onClickFn:ue?()=>Te(Ie===Be?void 0:Be):Ae.splitOpenFn?()=>Ae.splitOpenFn({datasourceUid:Ae.datasource?.uid,queries:[{...Oe,query:Le}],panelsState:{trace:{spanId:Be}}}):void 0,replaceVariables:(0,g.J)().replace.bind((0,g.J)())})}]}},20609:(j,I,e)=>{"use strict";e.d(I,{h:()=>n});var t=e(71685);function n(i,s,r){if(i.isLight)return s;{if(r){const l=(0,t.Z)(s);return t.Z.mostReadable(r,[l.clone().lighten(25),l.clone().lighten(10),l,l.clone().darken(10),l.clone().darken(25)],{includeFallbackColors:!1}).toHex8String()}const g=(0,t.Z)(s).toHsl();g.l=1-g.l;const d=(0,t.Z)(g);return d.isLight()?d.darken(5).toHex8String():d.lighten(5).toHex8String()}}},59391:(j,I,e)=>{"use strict";e.d(I,{Z:()=>u});var t=e(42844),n=e(89898),i=e.n(n),s=e(27702),r=e(66310),g=e(20609),d=e(58549);const l=o=>({Ticks:(0,t.css)` label: Ticks; pointer-events: none; `,TicksTick:(0,t.css)` label: TicksTick; position: absolute; height: 100%; width: 1px; background: ${(0,g.h)(o,"#d8d8d8")}; &:last-child { width: 0; } `,TicksTickLabel:(0,t.css)` label: TicksTickLabel; left: 0.25rem; position: absolute; `,TicksTickLabelEndAnchor:(0,t.css)` label: TicksTickLabelEndAnchor; left: initial; right: 0.25rem; `});function u(o){const{endTime:m,numTicks:c,showLabels:p,startTime:f}=o;let E;if(p){E=[];const v=(m||0)-(f||0);for(let D=0;D<c;D++){const a=(f||0)+D/(c-1)*v;E.push((0,d.LU)(a))}}const h=(0,r.wW)(l),y=[];for(let v=0;v<c;v++){const D=v/(c-1);y.push(s.createElement("div",{"data-testid":"TicksID",key:D,className:h.TicksTick,style:{left:`${D*100}%`}},E&&s.createElement("span",{className:i()(h.TicksTickLabel,{[h.TicksTickLabelEndAnchor]:D>=1})},E[v])))}return s.createElement("div",{className:h.Ticks},y)}u.defaultProps={endTime:null,showLabels:null,startTime:null}},25356:(j,I,e)=>{"use strict";e.d(I,{Z:()=>l});var t=e(42844),n=e(89898),i=e.n(n),s=e(27702),r=e(66310),g=e(90170);const d=()=>({flexRow:(0,t.css)` display: flex; flex: 0 1 auto; flex-direction: row; `});function l(o){const{children:m,className:c="",...p}=o,f=(0,r.wW)(d);return s.createElement("div",{className:i()(f.flexRow,c),...p},m)}l.defaultProps={className:""};function u(o){const{children:m,className:c="",width:p,style:f,...E}=o,h=`${p*100}%`,y={...f,flexBasis:h,maxWidth:h};return s.createElement("div",{className:i()(g.WW,c),style:y,"data-testid":"TimelineRowCell",...E},m)}u.defaultProps={className:"",style:{}},l.Cell=u},62227:(j,I,e)=>{"use strict";e.d(I,{l4:()=>Qe,ZP:()=>Un});var t=e(42844),n=e(89949),i=e(82152),s=e(27702),r=e(86312),g=e(34667),d=e(80402),l=e(30973),u=e(66310);const o="peer.service";var m=e(84720);class c{constructor(ft){this.ys=[],this.heights=[],this.bufferLen=ft,this.dataLen=-1,this.lastI=-1}profileData(ft){ft!==this.dataLen&&(this.dataLen=ft,this.ys.length=ft,this.heights.length=ft,this.lastI>=ft&&(this.lastI=ft-1))}calcHeights(ft,Tt,Bt){Bt!=null&&(this.lastI=Bt);let Nt=ft+this.bufferLen;if(Nt<=this.lastI)return;Nt>=this.heights.length&&(Nt=this.heights.length-1);let Ft=this.lastI;for(this.lastI===-1&&(Ft=0,this.ys[0]=0);Ft<=Nt;){const Gt=this.heights[Ft]=Tt(Ft);this.ys[Ft+1]=this.ys[Ft]+Gt,Ft++}this.lastI=Nt}calcYs(ft,Tt){for(;(this.ys[this.lastI]==null||ft>this.ys[this.lastI])&&this.lastI<this.dataLen-1;)this.calcHeights(this.lastI,Tt)}confirmHeight(ft,Tt){let Bt=ft;if(Bt>this.lastI){this.calcHeights(Bt,Tt);return}const Nt=Tt(Bt);if(Nt===this.heights[Bt])return;const Ft=Nt-this.heights[Bt];for(this.heights[Bt]=Nt;++Bt<=this.lastI;)this.ys[Bt]+=Ft;this.ys[this.lastI+1]!=null&&(this.ys[this.lastI+1]+=Ft)}findFloorIndex(ft,Tt){this.calcYs(ft,Tt);let Bt=0,Nt=this.lastI;if(this.ys.length<2||ft<this.ys[1])return 0;if(ft>this.ys[Nt])return Nt;let Ft;for(;Bt<Nt;)if(Ft=Bt+.5*(Nt-Bt)|0,ft>this.ys[Ft]){if(ft<=this.ys[Ft+1])return Ft;Bt=Ft}else if(ft<this.ys[Ft]){if(ft>=this.ys[Ft-1])return Ft-1;Nt=Ft}else return Ft;throw new Error(`unable to find floor index for y=${ft}`)}getRowPosition(ft,Tt){return this.confirmHeight(ft,Tt),{height:this.heights[ft],y:this.ys[ft]}}getEstimatedHeight(){const ft=this.ys[this.lastI]+this.heights[this.lastI];return this.lastI>=this.dataLen-1?ft|0:ft/(this.lastI+1)*this.heights.length|0}}const p=100;class f extends s.Component{constructor(ft){super(ft),this.getViewHeight=()=>this._viewHeight,this.getBottomVisibleIndex=()=>{const Tt=this._scrollTop+this._viewHeight;return this._yPositions.findFloorIndex(Tt,this._getHeight)},this.getTopVisibleIndex=()=>this._yPositions.findFloorIndex(this._scrollTop,this._getHeight),this.getRowPosition=Tt=>this._yPositions.getRowPosition(Tt,this._getHeight),this.scrollToIndex=(Tt,Bt)=>{const{scrollElement:Nt}=this.props,Ft=Nt?.getBoundingClientRect().top||0,dn=(Nt?.scrollTop||0)+(this._itemHolderElm?.getBoundingClientRect().top||0)-Ft,sn=this.getRowPosition(Tt).y;this.props.scrollElement?.scrollTo({top:sn+dn-Bt-80})},this._onScroll=()=>{this._isScrolledOrResized||(this._isScrolledOrResized=!0,window.requestAnimationFrame(this._positionList))},this._positionList=()=>{if(this._isScrolledOrResized=!1,!this._wrapperElm)return;this._calcViewIndexes();const Tt=this.props.viewBufferMin>this._startIndex?0:this._startIndex-this.props.viewBufferMin,Bt=this.props.viewBufferMin<this.props.dataLength-this._endIndex?this._endIndex+this.props.viewBufferMin:this.props.dataLength-1;(Tt<this._startIndexDrawn||Bt>this._endIndexDrawn)&&this.forceUpdate()},this._initWrapper=Tt=>{this.props.windowScroller&&(this._wrapperElm=Tt,Tt&&(this._viewHeight=Tt.clientHeight))},this._initItemHolder=Tt=>{this._itemHolderElm=Tt,this._scanItemHeights()},this._scanItemHeights=()=>{const Tt=this.props.getIndexFromKey;if(!this._itemHolderElm)return;let Bt=null,Nt=null,Ft=!1;const Gt=this._itemHolderElm.childNodes,dn=Gt.length;for(let sn=0;sn<dn;sn++){const Bn=Gt[sn],wt=Bn.getAttribute("data-item-key");if(!wt){console.warn("itemKey not found");continue}const Ht=(Bn.firstElementChild||Bn).clientHeight,Xt=this._knownHeights.get(wt);Ht!==Xt&&(this._knownHeights.set(wt,Ht),Ft?Nt=wt:(Ft=!0,Bt=Nt=wt))}if(Bt!=null&&Nt!=null){const sn=Tt(Bt),Bn=Nt===Bt?sn:Tt(Nt);this._yPositions.calcHeights(Bn,this._getHeight,sn),this.forceUpdate()}},this._getHeight=Tt=>{const Bt=this.props.getKeyFromIndex(Tt),Nt=this._knownHeights.get(Bt);return Nt!=null&&Nt===Nt?Nt:this.props.itemHeightGetter(Tt,Bt)},this._yPositions=new c(200),this._knownHeights=new Map,this._startIndexDrawn=2**20,this._endIndexDrawn=-(2**20),this._startIndex=0,this._endIndex=0,this._viewHeight=-1,this._scrollTop=-1,this._isScrolledOrResized=!1,this._htmlTopOffset=-1,this._windowScrollListenerAdded=!1,this._htmlElm=document.documentElement,this._wrapperElm=void 0,this._itemHolderElm=void 0}componentDidMount(){if(this.props.windowScroller){if(this._wrapperElm){const{top:ft}=this._wrapperElm.getBoundingClientRect();this._htmlTopOffset=ft+this._htmlElm.scrollTop}window.addEventListener("scroll",this._onScroll),this._windowScrollListenerAdded=!0}else this._wrapperElm=this.props.scrollElement,this._wrapperElm?.addEventListener("scroll",this._onScroll)}componentDidUpdate(ft){this._itemHolderElm&&this._scanItemHeights(),!this.props.windowScroller&&ft.scrollElement!==this.props.scrollElement&&(ft.scrollElement?.removeEventListener("scroll",this._onScroll),this._wrapperElm=this.props.scrollElement,this._wrapperElm?.addEventListener("scroll",this._onScroll))}componentWillUnmount(){this._windowScrollListenerAdded?window.removeEventListener("scroll",this._onScroll):this._wrapperElm?.removeEventListener("scroll",this._onScroll)}_isViewChanged(){if(!this._wrapperElm)return!1;const ft=this.props.windowScroller,Tt=ft?this._htmlElm.clientHeight:this._wrapperElm.clientHeight,Bt=ft?this._htmlElm.scrollTop:this._wrapperElm.scrollTop;return Tt!==this._viewHeight||Bt!==this._scrollTop}_calcViewIndexes(){if(this.props.windowScroller)this._viewHeight=window.innerHeight-this._htmlTopOffset,this._scrollTop=window.scrollY;else{if(!this._wrapperElm){this._viewHeight=-1,this._startIndex=0,this._endIndex=0;return}this._viewHeight=this._wrapperElm.clientHeight,this._scrollTop=this._wrapperElm.scrollTop}const Tt=this._scrollTop,Bt=this._scrollTop+this._viewHeight;this._startIndex=this._yPositions.findFloorIndex(Tt,this._getHeight),this._endIndex=this._yPositions.findFloorIndex(Bt,this._getHeight)}render(){const{dataLength:ft,getKeyFromIndex:Tt,initialDraw:Bt=p,itemRenderer:Nt,viewBuffer:Ft,viewBufferMin:Gt}=this.props,dn=this._getHeight,sn=[];let Bn,wt;if(this._yPositions.profileData(ft),!this._wrapperElm)Bn=0,wt=(Bt<ft?Bt:ft)-1;else{this._isViewChanged()&&this._calcViewIndexes();const Xt=Gt>this._startIndex?0:this._startIndex-Gt,mn=Gt<ft-this._endIndex?this._endIndex+Gt:ft-1;Xt<this._startIndexDrawn||mn>this._endIndexDrawn?(Bn=Ft>this._startIndex?0:this._startIndex-Ft,wt=this._endIndex+Ft,wt>=ft&&(wt=ft-1)):(Bn=this._startIndexDrawn>ft-1?0:this._startIndexDrawn,wt=this._endIndexDrawn>ft-1?ft-1:this._endIndexDrawn)}this._yPositions.calcHeights(wt,dn,Bn||-1),this._startIndexDrawn=Bn,this._endIndexDrawn=wt,sn.length=wt-Bn+1;for(let Xt=Bn;Xt<=wt;Xt++){const{y:mn,height:pn}=this._yPositions.getRowPosition(Xt,dn),Pn={height:pn,top:mn,position:"absolute"},zn=Tt(Xt),Hn={"data-item-key":zn};sn.push(Nt(zn,Pn,Xt,Hn))}const Vt={style:{position:"relative"},ref:this._initWrapper};this.props.windowScroller||(Vt.onScroll=this._onScroll,Vt.style.height="100%",Vt.style.overflowY="auto");const Ht={position:"relative",height:this._yPositions.getEstimatedHeight()};return s.createElement("div",{...Vt,"data-testid":"ListView"},s.createElement("div",{style:Ht},s.createElement("div",{style:{position:"absolute",top:0,margin:0,padding:0},className:this.props.itemsWrapperClassName,ref:this._initItemHolder},sn)))}}f.defaultProps={initialDraw:p,itemsWrapperClassName:"",windowScroller:!1};var E=e(89898),h=e.n(E),y=e(73453),v=e(20609),D=e(32042),a=e(74639),C=e(75965),P=e(71235);function b({children:yt,content:ft,overlayClassName:Tt}){const Bt=(0,s.useRef)(null);return s.createElement(C.D,{content:ft,hideAfter:300},(Nt,Ft,Gt)=>s.createElement(s.Fragment,null,Bt.current&&s.createElement(P.J,{...Gt,referenceElement:Bt.current,wrapperClassName:Tt,onMouseLeave:Ft,onMouseEnter:Nt}),s.cloneElement(yt,{ref:Bt,onMouseEnter:Nt,onMouseLeave:Ft})))}var M=e(90170),T=e(58549);const S="label";var x=e(80011),O=e(66670);const B=()=>({CopyIcon:(0,t.css)` background-color: transparent; border: none; color: inherit; height: 100%; overflow: hidden; &:focus { background-color: rgba(255, 255, 255, 0.25); color: inherit; } `});function A(yt){const ft=(0,u.wW)(B),[Tt,Bt]=(0,s.useState)(!1),Nt=()=>{navigator.clipboard.writeText(yt.copyText),Bt(!0)};return s.createElement(x.u,{content:Tt?"Copied":yt.tooltipTitle},s.createElement(O.zx,{className:h()(ft.CopyIcon),type:"button",icon:yt.icon,onClick:Nt}))}A.defaultProps={icon:"copy",className:void 0};var V=e(23932),W=e.n(V);const w="copyIcon",N=yt=>({KeyValueTable:(0,t.css)` label: KeyValueTable; background: ${(0,v.h)(yt,"#fff")}; border: 1px solid ${(0,v.h)(yt,"#ddd")}; margin-bottom: 0.5rem; max-height: 450px; overflow: auto; `,body:(0,t.css)` label: body; vertical-align: baseline; `,row:(0,t.css)` label: row; & > td { padding: 0rem 0.5rem; height: 30px; } &:nth-child(2n) > td { background: ${(0,v.h)(yt,"#f5f5f5")}; } &:not(:hover) .${w} { visibility: hidden; } `,keyColumn:(0,t.css)` label: keyColumn; color: ${(0,v.h)(yt,"#888")}; white-space: pre; width: 125px; `,copyColumn:(0,t.css)` label: copyColumn; text-align: right; `,linkIcon:(0,t.css)` label: linkIcon; vertical-align: middle; font-weight: bold; `}),F=/^(\[|\{)/;function k(yt){if(typeof yt=="string"&&F.test(yt))try{return JSON.parse(yt)}catch{}return yt}const H=yt=>s.createElement("a",{href:yt.href,title:yt.title,target:"_blank",rel:"noopener noreferrer"},yt.children," ",s.createElement(y.J,{name:"external-link-alt"}));H.defaultProps={title:""};function R(yt){const{data:ft,linksGetter:Tt}=yt,Bt=(0,u.wW)(N);return s.createElement("div",{className:h()(Bt.KeyValueTable),"data-testid":"KeyValueTable"},s.createElement("table",{className:M.K9},s.createElement("tbody",{className:Bt.body},ft.map((Nt,Ft)=>{const Gt={__html:W()(k(Nt.value))},dn=s.createElement("div",{className:M.b$,dangerouslySetInnerHTML:Gt}),sn=Tt?Tt(ft,Ft):null;let Bn;return sn&&sn.length?Bn=s.createElement("div",null,s.createElement(H,{href:sn[0].url,title:sn[0].text},dn)):Bn=dn,s.createElement("tr",{className:Bt.row,key:`${Nt.key}-${Ft}`},s.createElement("td",{className:Bt.keyColumn,"data-testid":"KeyValueTable--keyColumn"},Nt.key),s.createElement("td",null,Bn),s.createElement("td",{className:Bt.copyColumn},s.createElement(A,{className:w,copyText:JSON.stringify(Nt,null,2),tooltipTitle:"Copy JSON"})))}))))}const _=yt=>({header:(0,t.css)` label: header; cursor: pointer; overflow: hidden; padding: 0.25em 0.1em; text-overflow: ellipsis; white-space: nowrap; &:hover { background: ${(0,v.h)(yt,"#e8e8e8")}; } `,headerEmpty:(0,t.css)` label: headerEmpty; background: none; cursor: initial; `,headerHighContrast:(0,t.css)` label: headerHighContrast; &:hover { background: ${(0,v.h)(yt,"#ddd")}; } `,emptyIcon:(0,t.css)` label: emptyIcon; color: ${(0,v.h)(yt,"#aaa")}; `,summary:(0,t.css)` label: summary; display: inline; list-style: none; padding: 0; `,summaryItem:(0,t.css)` label: summaryItem; display: inline; margin-left: 0.7em; padding-right: 0.5rem; border-right: 1px solid ${(0,v.h)(yt,"#ddd")}; &:last-child { padding-right: 0; border-right: none; } `,summaryLabel:(0,t.css)` label: summaryLabel; color: ${(0,v.h)(yt,"#777")}; `,summaryDelim:(0,t.css)` label: summaryDelim; color: ${(0,v.h)(yt,"#bbb")}; padding: 0 0.2em; `});function G(yt){const{data:ft}=yt,Tt=(0,u.wW)(_);return!Array.isArray(ft)||!ft.length?null:s.createElement("ul",{className:Tt.summary},ft.map((Bt,Nt)=>s.createElement("li",{className:Tt.summaryItem,key:`${Bt.key}-${Nt}`},s.createElement("span",{className:Tt.summaryLabel},Bt.key),s.createElement("span",{className:Tt.summaryDelim},"="),String(Bt.value))))}G.defaultProps={data:null};function Y(yt){const{className:ft,data:Tt,highContrast:Bt,interactive:Nt,isOpen:Ft,label:Gt,linksGetter:dn,onToggle:sn}=yt,Bn=!Array.isArray(Tt)||!Tt.length,wt=(0,u.wW)(_),Vt=h()(M.Im,{[wt.emptyIcon]:Bn});let Ht=null,Xt=null;return Nt&&(Ht=Ft?s.createElement(y.J,{name:"angle-down",className:Vt}):s.createElement(y.J,{name:"angle-right",className:Vt}),Xt={"aria-checked":Ft,onClick:Bn?null:sn,role:"switch"}),s.createElement("div",{className:h()(ft,M.ty)},s.createElement("div",{className:h()(wt.header,{[wt.headerEmpty]:Bn,[wt.headerHighContrast]:Bt&&!Bn}),...Xt,"data-testid":"AccordianKeyValues--header"},Ht,s.createElement("strong",{"data-test":S},Gt,Ft||":"),!Ft&&s.createElement(G,{data:Tt})),Ft&&s.createElement(R,{data:Tt,linksGetter:dn}))}Y.defaultProps={className:null,highContrast:!1,interactive:!0,onToggle:null};const X=yt=>({AccordianLogs:(0,t.css)` label: AccordianLogs; border: 1px solid ${(0,v.h)(yt,"#d8d8d8")}; position: relative; margin-bottom: 0.25rem; `,AccordianLogsHeader:(0,t.css)` label: AccordianLogsHeader; background: ${(0,v.h)(yt,"#e4e4e4")}; color: inherit; display: block; padding: 0.25rem 0.5rem; &:hover { background: ${(0,v.h)(yt,"#dadada")}; } `,AccordianLogsContent:(0,t.css)` label: AccordianLogsContent; background: ${(0,v.h)(yt,"#f0f0f0")}; border-top: 1px solid ${(0,v.h)(yt,"#d8d8d8")}; padding: 0.5rem 0.5rem 0.25rem 0.5rem; `,AccordianLogsFooter:(0,t.css)` label: AccordianLogsFooter; color: ${(0,v.h)(yt,"#999")}; `});function Q(yt){const{interactive:ft,isOpen:Tt,linksGetter:Bt,logs:Nt,openedItems:Ft,onItemToggle:Gt,onToggle:dn,timestamp:sn}=yt;let Bn=null,wt="span",Vt=null;ft&&(Bn=Tt?s.createElement(y.J,{name:"angle-down",className:M.Im}):s.createElement(y.J,{name:"angle-right",className:"u-align-icon"}),wt="a",Vt={"aria-checked":Tt,onClick:dn,role:"switch"});const Ht=(0,u.wW)(X);return s.createElement("div",{className:Ht.AccordianLogs},s.createElement(wt,{className:Ht.AccordianLogsHeader,...Vt},Bn," ",s.createElement("strong",null,"Events")," (",Nt.length,")"),Tt&&s.createElement("div",{className:Ht.AccordianLogsContent},(0,n.sortBy)(Nt,"timestamp").map((Xt,mn)=>s.createElement(Y,{key:`${Xt.timestamp}-${mn}`,className:mn<Nt.length-1?M.bi:null,data:Xt.fields||[],highContrast:!0,interactive:ft,isOpen:Ft?Ft.has(Xt):!1,label:`${(0,T.LU)(Xt.timestamp-sn)}`,linksGetter:Bt,onToggle:ft&&Gt?()=>Gt(Xt):null})),s.createElement("small",{className:Ht.AccordianLogsFooter},"Log timestamps are relative to the start time of the full trace.")))}Q.defaultProps={interactive:!0,linksGetter:void 0,onItemToggle:void 0,onToggle:void 0,openedItems:void 0};const se=yt=>({wrapper:(0,t.css)` label: wrapper; bottom: 0; left: 0; position: absolute; right: 0; top: 0; overflow: hidden; z-index: 0; `,bar:(0,t.css)` label: bar; border-radius: 3px; min-width: 2px; position: absolute; height: 36%; top: 32%; `,rpc:(0,t.css)` label: rpc; position: absolute; top: 35%; bottom: 35%; z-index: 1; `,label:(0,t.css)` label: label; color: #aaa; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1em; white-space: nowrap; padding: 0 0.5em; position: absolute; `,logMarker:(0,t.css)` label: logMarker; background-color: ${(0,v.h)(yt,"#2c3235")}; cursor: pointer; height: 60%; min-width: 1px; position: absolute; top: 20%; &:hover { background-color: ${(0,v.h)(yt,"#464c54")}; } &::before, &::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; border: 1px solid transparent; } &::after { left: 0; } `});function Z(yt){return`${(yt*100).toFixed(1)}%`}function le({viewEnd:yt,viewStart:ft,getViewedBounds:Tt,color:Bt,shortLabel:Nt,longLabel:Ft,onClick:Gt,rpc:dn,traceStartTime:sn,span:Bn,className:wt,labelClassName:Vt}){const[Ht,Xt]=(0,s.useState)(Nt),mn=()=>Xt(Nt),pn=()=>Xt(Ft),Pn=(0,n.groupBy)(Bn.logs,Hn=>{const Ea=Tt(Hn.timestamp,Hn.timestamp).start;return Z(Math.round(Ea*500)/500)}),zn=(0,u.wW)(se);return s.createElement("div",{className:h()(zn.wrapper,wt),onBlur:mn,onClick:Gt,onFocus:pn,onMouseOut:mn,onMouseOver:pn,"aria-hidden":!0,"data-testid":a.wl.components.TraceViewer.spanBar},s.createElement("div",{"aria-label":Ht,className:zn.bar,style:{background:Bt,left:Z(ft),width:Z(yt-ft)}},s.createElement("div",{className:h()(zn.label,Vt),"data-testid":"SpanBar--label"},Ht)),s.createElement("div",null,Object.keys(Pn).map(Hn=>s.createElement(b,{key:Hn,content:s.createElement(Q,{interactive:!1,isOpen:!0,logs:Pn[Hn],timestamp:sn})},s.createElement("div",{"data-testid":"SpanBar--logMarker",className:zn.logMarker,style:{left:Hn}})))),dn&&s.createElement("div",{className:zn.rpc,style:{background:dn.color,left:Z(dn.viewStart),width:Z(dn.viewEnd-dn.viewStart)}}))}const oe=s.memo(le);var q=e(79655),ne=e(14986);const ge=(yt,ft,Tt,Bt)=>(yt.sort(function(Nt,Ft){return(Nt.title||"link").toLowerCase().localeCompare((Ft.title||"link").toLowerCase())}),yt.map((Nt,Ft)=>s.createElement(q.s,{key:Ft,label:Nt.title||"Link",onClick:Nt.onClick?Gt=>{(0,r.ff)("grafana_traces_trace_view_span_link_clicked",{datasourceType:Bt,grafana_version:g.config.buildInfo.version,type:Nt.type,location:"menu"}),Gt?.preventDefault(),Nt.onClick(Gt),Tt()}:void 0,url:Nt.href,className:ft.menuItem}))),ae=({links:yt,datasourceType:ft})=>{const Tt=(0,u.wW)(re),[Bt,Nt]=(0,s.useState)(!1),[Ft,Gt]=(0,s.useState)({x:0,y:0}),dn=()=>Nt(!1);return s.createElement("div",{"data-testid":"SpanLinksMenu"},s.createElement("button",{onClick:sn=>{Nt(!0),Gt({x:sn.pageX,y:sn.pageY})},className:Tt.button},s.createElement(y.J,{name:"link",className:Tt.button})),Bt?s.createElement(ne.x,{onClose:()=>Nt(!1),renderMenuItems:()=>ge(yt,Tt,dn,ft),focusOnOpen:!1,x:Ft.x,y:Ft.y}):null)},re=()=>({button:(0,t.css)` background: transparent; border: none; padding: 0; margin: 0 3px 0 0; `,menuItem:(0,t.css)` max-width: 60ch; overflow: hidden; `});function De(yt){return(0,n.get)((0,n.find)(yt.references,({span:ft,refType:Tt})=>ft&&ft.spanID&&(Tt==="CHILD_OF"||Tt==="FOLLOWS_FROM")),"span")}function he(yt){const ft=[];if(!yt)return ft;let Tt=De(yt);for(;Tt;)ft.push(Tt.spanID),Tt=De(Tt);return ft}const ye=(0,d.B)(yt=>({SpanTreeOffset:(0,t.css)` label: SpanTreeOffset; color: ${(0,v.h)(yt,"#000")}; position: relative; `,SpanTreeOffsetParent:(0,t.css)` label: SpanTreeOffsetParent; &:hover { cursor: pointer; } `,indentGuide:(0,t.css)` label: indentGuide; /* The size of the indentGuide is based off of the iconWrapper */ padding-right: calc(0.5rem + 12px); height: 100%; border-left: 3px solid transparent; display: inline-flex; &::before { content: ''; padding-left: 1px; background-color: ${(0,v.h)(yt,"lightgrey")}; } `,indentGuideActive:(0,t.css)` label: indentGuideActive; border-color: ${(0,v.h)(yt,"darkgrey")}; &::before { background-color: transparent; } `,iconWrapper:(0,t.css)` label: iconWrapper; position: absolute; right: 0.25rem; `}));class ce extends s.PureComponent{constructor(ft){super(ft),this.handleMouseLeave=(Tt,Bt)=>{(!(Tt.relatedTarget instanceof HTMLSpanElement)||(0,n.get)(Tt,"relatedTarget.dataset.ancestorId")!==Bt)&&this.props.removeHoverIndentGuideId(Bt)},this.handleMouseEnter=(Tt,Bt)=>{(!(Tt.relatedTarget instanceof HTMLSpanElement)||(0,n.get)(Tt,"relatedTarget.dataset.ancestorId")!==Bt)&&this.props.addHoverIndentGuideId(Bt)},this.ancestorIds=he(ft.span),this.ancestorIds.push("root"),this.ancestorIds.reverse()}render(){const{childrenVisible:ft,onClick:Tt,showChildrenIcon:Bt,span:Nt,theme:Ft}=this.props,{hasChildren:Gt,spanID:dn}=Nt,sn=Gt?{onClick:Tt,role:"switch","aria-checked":ft}:null,Bn=Bt&&Gt&&(ft?s.createElement(y.J,{name:"angle-down","data-testid":"icon-arrow-down"}):s.createElement(y.J,{name:"angle-right","data-testid":"icon-arrow-right"})),wt=ye(Ft);return s.createElement("span",{className:h()(wt.SpanTreeOffset,{[wt.SpanTreeOffsetParent]:Gt}),...sn},this.ancestorIds.map(Vt=>s.createElement("span",{key:Vt,className:h()(wt.indentGuide,{[wt.indentGuideActive]:this.props.hoverIndentGuideIds.has(Vt)}),"data-ancestor-id":Vt,"data-testid":"SpanTreeOffset--indentGuide",onMouseEnter:Ht=>this.handleMouseEnter(Ht,Vt),onMouseLeave:Ht=>this.handleMouseLeave(Ht,Vt)})),Bn&&s.createElement("span",{className:wt.iconWrapper,onMouseEnter:Vt=>this.handleMouseEnter(Vt,dn),onMouseLeave:Vt=>this.handleMouseLeave(Vt,dn),"data-testid":"icon-wrapper"},Bn))}}ce.displayName="UnthemedSpanTreeOffset",ce.defaultProps={childrenVisible:!1,showChildrenIcon:!0};const We=(0,u.HE)(ce);var ke=e(59391),et=e(25356);const we="spanBar",_e="spanBarLabel",Ge="nameWrapper",qe="nameWrapperMatchingFilter",st="jaegerView",Me="nameColumn",be=(0,d.B)((yt,ft)=>{const Tt={label:"flash",flash:(0,t.keyframes)` from { background-color: ${(0,v.h)(yt,"#68b9ff")}; } to { background-color: 'default'; } `},Bt=ft?"":(0,v.h)(yt,"#fffce4");return{nameWrapper:(0,t.css)` label: nameWrapper; line-height: 27px; overflow: hidden; display: flex; `,nameWrapperMatchingFilter:(0,t.css)` label: nameWrapperMatchingFilter; background-color: ${Bt}; `,nameColumn:(0,t.css)` label: nameColumn; position: relative; white-space: nowrap; z-index: 1; &:hover { z-index: 1; } `,endpointName:(0,t.css)` label: endpointName; color: ${(0,v.h)(yt,"#808080")}; `,view:(0,t.css)` label: view; position: relative; `,viewExpanded:(0,t.css)` label: viewExpanded; background: ${(0,v.h)(yt,"#f8f8f8")}; outline: 1px solid ${(0,v.h)(yt,"#ddd")}; `,viewExpandedAndMatchingFilter:(0,t.css)` label: viewExpandedAndMatchingFilter; background: ${(0,v.h)(yt,"#fff3d7")}; outline: 1px solid ${(0,v.h)(yt,"#ddd")}; `,row:(0,t.css)` label: row; &:hover .${we} { opacity: 1; } &:hover .${_e} { color: ${(0,v.h)(yt,"#000")}; } &:hover .${Ge} { background: #f8f8f8; background: linear-gradient( 90deg, ${(0,v.h)(yt,"#fafafa")}, ${(0,v.h)(yt,"#f8f8f8")} 75%, ${(0,v.h)(yt,"#eee")} ); } &:hover .${st} { background-color: ${(0,v.h)(yt,"#f5f5f5")}; outline: 1px solid ${(0,v.h)(yt,"#ddd")}; } `,rowClippingLeft:(0,t.css)` label: rowClippingLeft; & .${Me}::before { content: ' '; height: 100%; position: absolute; width: 6px; background-image: linear-gradient( to right, ${(0,v.h)(yt,"rgba(25, 25, 25, 0.25)")}, ${(0,v.h)(yt,"rgba(32, 32, 32, 0)")} ); left: 100%; z-index: -1; } `,rowClippingRight:(0,t.css)` label: rowClippingRight; & .${st}::before { content: ' '; height: 100%; position: absolute; width: 6px; background-image: linear-gradient( to left, ${(0,v.h)(yt,"rgba(25, 25, 25, 0.25)")}, ${(0,v.h)(yt,"rgba(25, 25, 25, 0.25)")} ); right: 0%; z-index: 1; } `,rowExpanded:(0,t.css)` label: rowExpanded; & .${we} { opacity: 1; } & .${_e} { color: ${(0,v.h)(yt,"#000")}; } & .${Ge}, &:hover .${Ge} { background: ${(0,v.h)(yt,"#f0f0f0")}; box-shadow: 0 1px 0 ${(0,v.h)(yt,"#ddd")}; } & .${qe} { background: ${(0,v.h)(yt,"#fff3d7")}; } &:hover .${st} { background: ${(0,v.h)(yt,"#eee")}; } `,rowMatchingFilter:(0,t.css)` label: rowMatchingFilter; // background-color: ${(0,v.h)(yt,"#fffbde")}; &:hover .${Ge} { background: linear-gradient( 90deg, ${(0,v.h)(yt,"#fffbde")}, ${(0,v.h)(yt,"#fffbde")} 75%, ${(0,v.h)(yt,"#f7f1c6")} ); } &:hover .${st} { background-color: ${(0,v.h)(yt,"#f7f1c6")}; outline: 1px solid ${(0,v.h)(yt,"#ddd")}; } `,rowFocused:(0,t.css)` label: rowFocused; background-color: ${(0,v.h)(yt,"#cbe7ff")}; animation: ${Tt.flash} 1s cubic-bezier(0.12, 0, 0.39, 0); & .${Ge}, .${st}, .${qe} { background-color: ${(0,v.h)(yt,"#cbe7ff")}; animation: ${Tt.flash} 1s cubic-bezier(0.12, 0, 0.39, 0); } & .${we} { opacity: 1; } & .${_e} { color: ${(0,v.h)(yt,"#000")}; } &:hover .${Ge}, :hover .${st} { background: ${(0,v.h)(yt,"#d5ebff")}; box-shadow: 0 1px 0 ${(0,v.h)(yt,"#ddd")}; } `,rowExpandedAndMatchingFilter:(0,t.css)` label: rowExpandedAndMatchingFilter; &:hover .${st} { background: ${(0,v.h)(yt,"#ffeccf")}; } `,name:(0,t.css)` label: name; color: ${(0,v.h)(yt,"#000")}; cursor: pointer; flex: 1 1 auto; outline: none; overflow-y: hidden; overflow-x: auto; margin-right: 8px; padding-left: 4px; padding-right: 0.25em; position: relative; -ms-overflow-style: none; scrollbar-width: none; &::-webkit-scrollbar { display: none; } &::before { content: ' '; position: absolute; top: 4px; bottom: 4px; left: 0; border-left: 4px solid; border-left-color: inherit; } &:focus { text-decoration: none; } &:hover > small { color: ${(0,v.h)(yt,"#000")}; } text-align: left; background: transparent; border: none; `,nameDetailExpanded:(0,t.css)` label: nameDetailExpanded; &::before { bottom: 0; } `,svcName:(0,t.css)` label: svcName; padding: 0 0.25rem 0 0.5rem; font-size: 1.05em; `,svcNameChildrenCollapsed:(0,t.css)` label: svcNameChildrenCollapsed; font-weight: bold; font-style: italic; `,errorIcon:(0,t.css)` label: errorIcon; border-radius: 6.5px; color: ${(0,v.h)(yt,"#fff")}; font-size: 0.85em; margin-right: 0.25rem; padding: 1px; `,rpcColorMarker:(0,t.css)` label: rpcColorMarker; border-radius: 6.5px; display: inline-block; font-size: 0.85em; height: 1em; margin-right: 0.25rem; padding: 1px; width: 1em; vertical-align: middle; `,labelRight:(0,t.css)` label: labelRight; left: 100%; `,labelLeft:(0,t.css)` label: labelLeft; right: 100%; `}});class Ke extends s.PureComponent{constructor(){super(...arguments),this._detailToggle=()=>{this.props.onDetailToggled(this.props.span.spanID)},this._childrenToggle=()=>{this.props.onChildrenToggled(this.props.span.spanID)},this.getSpanBarLabel=(ft,Tt,Bt)=>{const Nt=Tt?.type??"";if(Nt===D.Hn)return"";if(Nt===""||Nt===D.th)return`(${Bt})`;if(Nt===D.Kg){const Ft=Tt?.tag?.trim()??"";if(Ft!==""&&ft.tags){const Gt=ft.tags?.find(sn=>sn.key===Ft);if(Gt)return`(${Gt.value})`;const dn=ft.process?.tags?.find(sn=>sn.key===Ft);if(dn)return`(${dn.value})`}}return""}}render(){const{className:ft,color:Tt,spanBarOptions:Bt,columnDivision:Nt,isChildrenExpanded:Ft,isDetailExpanded:Gt,isMatchingFilter:dn,showSpanFilterMatchesOnly:sn,isFocused:Bn,numTicks:wt,rpc:Vt,noInstrumentedServer:Ht,showErrorIcon:Xt,getViewedBounds:mn,traceStartTime:pn,span:Pn,hoverIndentGuideIds:zn,addHoverIndentGuideId:Hn,removeHoverIndentGuideId:Ea,clippingLeft:aa,clippingRight:na,theme:xa,createSpanLink:Ca,datasourceType:Ba}=this.props,{duration:ka,hasChildren:Ua,operationName:$a,process:{serviceName:Mt}}=Pn,Dt=(0,T.LU)(ka),ht=mn(Pn.startTime,Pn.startTime+Pn.duration),Lt=ht.start,rn=ht.end,zt=be(xa,sn),En=`${Mt}::${$a}`;let Tn,An;return Lt>1-rn?(Tn=`${En} | ${Dt}`,An=zt.labelLeft):(Tn=`${Dt} | ${En}`,An=zt.labelRight),s.createElement(et.Z,{className:h()(zt.row,{[zt.rowExpanded]:Gt,[zt.rowMatchingFilter]:dn,[zt.rowExpandedAndMatchingFilter]:dn&&Gt,[zt.rowFocused]:Bn,[zt.rowClippingLeft]:aa,[zt.rowClippingRight]:na},ft)},s.createElement(et.Z.Cell,{className:h()(zt.nameColumn,Me),width:Nt},s.createElement("div",{className:h()(zt.nameWrapper,Ge,{[zt.nameWrapperMatchingFilter]:dn,nameWrapperMatchingFilter:dn})},s.createElement(We,{onClick:Ua?this._childrenToggle:void 0,childrenVisible:Ft,span:Pn,hoverIndentGuideIds:zn,addHoverIndentGuideId:Hn,removeHoverIndentGuideId:Ea}),s.createElement("button",{type:"button",className:h()(zt.name,{[zt.nameDetailExpanded]:Gt}),"aria-checked":Gt,title:En,onClick:this._detailToggle,role:"switch",style:{borderColor:Tt},tabIndex:0},s.createElement("span",{className:h()(zt.svcName,{[zt.svcNameChildrenCollapsed]:Ua&&!Ft})},Xt&&s.createElement(y.J,{name:"exclamation-circle",style:{backgroundColor:Pn.errorIconColor?(0,v.h)(xa,Pn.errorIconColor):(0,v.h)(xa,"#db2828")},className:zt.errorIcon}),Mt," ",Vt&&s.createElement("span",null,s.createElement(y.J,{name:"arrow-right"})," ",s.createElement("i",{className:zt.rpcColorMarker,style:{background:Vt.color}}),Vt.serviceName),Ht&&s.createElement("span",null,s.createElement(y.J,{name:"arrow-right"})," ",s.createElement("i",{className:zt.rpcColorMarker,style:{background:Ht.color}}),Ht.serviceName)),s.createElement("small",{className:zt.endpointName},Vt?Vt.operationName:$a),s.createElement("small",{className:zt.endpointName}," ",this.getSpanBarLabel(Pn,Bt,Dt))),Ca&&(()=>{const xn=Ca(Pn),ia=xn?.length||0;return xn&&ia===1?xn[0]?s.createElement("a",{href:xn[0].href,target:"_blank",style:{marginRight:"5px"},rel:"noopener noreferrer",onClick:xn[0].onClick?oa=>{!(oa.ctrlKey||oa.metaKey||oa.shiftKey)&&xn[0].onClick&&(oa.preventDefault(),xn[0].onClick(oa))}:void 0},xn[0].content):null:xn&&ia>1?s.createElement(ae,{links:xn,datasourceType:Ba}):null})())),s.createElement(et.Z.Cell,{className:h()(zt.view,st,{[zt.viewExpanded]:Gt,[zt.viewExpandedAndMatchingFilter]:dn&&Gt}),"data-testid":"span-view",style:{cursor:"pointer"},width:1-Nt,onClick:this._detailToggle},s.createElement(ke.Z,{numTicks:wt}),s.createElement(oe,{rpc:Vt,viewStart:Lt,viewEnd:rn,getViewedBounds:mn,color:Tt,shortLabel:Dt,longLabel:Tn,traceStartTime:pn,span:Pn,labelClassName:`${_e} ${An}`,className:we})))}}Ke.displayName="UnthemedSpanBarRow",Ke.defaultProps={className:"",rpc:null};const Ye=(0,u.HE)(Ke);var tt=e(37391),nt=e(60956),Pt=e(26129),xt=e(73e3),bt=e(60105);const Rt=yt=>({Divider:(0,t.css)` background: ${(0,v.h)(yt,"#ddd")}; `,DividerVertical:(0,t.css)` label: DividerVertical; display: inline-block; width: 1px; height: 0.9em; margin: 0 8px; vertical-align: middle; `,DividerHorizontal:(0,t.css)` label: DividerHorizontal; display: block; height: 1px; width: 100%; margin: 24px 0; clear: both; vertical-align: middle; position: relative; top: -0.06em; `});function ct({className:yt,style:ft,type:Tt}){const Bt=(0,u.wW)(Rt);return s.createElement("div",{style:ft,className:(0,t.cx)(Bt.Divider,Tt==="horizontal"?Bt.DividerHorizontal:Bt.DividerVertical,yt)})}const it=yt=>ft=>({LabeledList:(0,t.css)` label: LabeledList; list-style: none; margin: 0; padding: 0; ${yt&&` margin-right: -8px; display: flex; flex-wrap: wrap; justify-content: flex-end; `} `,LabeledListItem:(0,t.css)` label: LabeledListItem; display: inline-block; ${yt&&` border-right: 1px solid ${(0,v.h)(ft,"#ddd")}; padding: 0 8px; `} `,LabeledListLabel:(0,t.css)` label: LabeledListLabel; color: ${ft.isLight?"#999":"#666"}; margin-right: 0.25rem; `,LabeledListValue:(0,t.css)` label: LabeledListValue; ${!yt&&"margin-right: 0.55rem;"} `});function me(yt){const{className:ft,divider:Tt=!1,items:Bt}=yt,Nt=(0,u.wW)(it(Tt));return s.createElement("ul",{className:h()(Nt.LabeledList,ft)},Bt.map(({key:Ft,label:Gt,value:dn})=>s.createElement("li",{className:Nt.LabeledListItem,key:`${Ft}`},s.createElement("span",{className:Nt.LabeledListLabel},Gt),s.createElement("strong",{className:Nt.LabeledListValue},dn))))}var Ee=e(63568),Ce=e(66798);function Ae(yt){const{reference:ft,children:Tt,createFocusSpanLink:Bt}=yt,Nt=Bt(ft.traceID,ft.spanID);return s.createElement("a",{href:Nt.href,target:Nt.target,rel:"noopener noreferrer",onClick:Nt.onClick?Ft=>{Ft.preventDefault(),Nt.onClick(Ft)}:void 0},Tt)}const ze=yt=>({AccordianReferenceItem:(0,t.css)` border-bottom: 1px solid ${(0,v.h)(yt,"#d8d8d8")}; `,AccordianKeyValues:(0,t.css)` margin-left: 10px; `,AccordianReferences:(0,t.css)` label: AccordianReferences; border: 1px solid ${(0,v.h)(yt,"#d8d8d8")}; position: relative; margin-bottom: 0.25rem; `,AccordianReferencesHeader:(0,t.css)` label: AccordianReferencesHeader; background: ${(0,v.h)(yt,"#e4e4e4")}; color: inherit; display: block; padding: 0.25rem 0.5rem; &:hover { background: ${(0,v.h)(yt,"#dadada")}; } `,AccordianReferencesContent:(0,t.css)` label: AccordianReferencesContent; background: ${(0,v.h)(yt,"#f0f0f0")}; border-top: 1px solid ${(0,v.h)(yt,"#d8d8d8")}; padding: 0.5rem 0.5rem 0.25rem 0.5rem; `,AccordianReferencesFooter:(0,t.css)` label: AccordianReferencesFooter; color: ${(0,v.h)(yt,"#999")}; `,ReferencesList:(0,t.css)` background: #fff; border: 1px solid #ddd; margin-bottom: 0.7em; max-height: 450px; overflow: auto; `,list:(0,t.css)` width: 100%; list-style: none; padding: 0; margin: 0; background: #fff; `,itemContent:(0,t.css)` padding: 0.25rem 0.5rem; display: flex; width: 100%; justify-content: space-between; `,item:(0,t.css)` &:nth-child(2n) { background: #f5f5f5; } `,debugInfo:(0,t.css)` letter-spacing: 0.25px; margin: 0.5em 0 0; flex-wrap: wrap; display: flex; justify-content: flex-end; `,debugLabel:(0,t.css)` margin: 0 5px 0 5px; &::before { color: #bbb; content: attr(data-label); } `,serviceName:(0,t.css)` margin-right: 8px; `,title:(0,t.css)` display: flex; align-items: center; gap: 4px; `});function Ie(yt){const{data:ft,createFocusSpanLink:Tt,openedItems:Bt,onItemToggle:Nt,interactive:Ft}=yt,Gt=(0,u.wW)(ze);return s.createElement("div",{className:Gt.AccordianReferencesContent},ft.map((dn,sn)=>s.createElement("div",{className:sn<ft.length-1?Gt.AccordianReferenceItem:void 0,key:sn},s.createElement("div",{className:Gt.item,key:`${dn.spanID}`},s.createElement(Ae,{reference:dn,createFocusSpanLink:Tt},s.createElement("span",{className:Gt.itemContent},dn.span?s.createElement("span",null,s.createElement("span",{className:(0,t.cx)("span-svc-name",Gt.serviceName)},dn.span.process.serviceName),s.createElement("small",{className:"endpoint-name"},dn.span.operationName)):s.createElement("span",{className:(0,t.cx)("span-svc-name",Gt.title)},"View Linked Span ",s.createElement(y.J,{name:"external-link-alt"})),s.createElement("small",{className:Gt.debugInfo},s.createElement("span",{className:Gt.debugLabel,"data-label":"TraceID:"},dn.traceID),s.createElement("span",{className:Gt.debugLabel,"data-label":"SpanID:"},dn.spanID))))),!!dn.tags?.length&&s.createElement("div",{className:Gt.AccordianKeyValues},s.createElement(Y,{className:sn<ft.length-1?M.bi:null,data:dn.tags||[],highContrast:!0,interactive:Ft,isOpen:Bt?Bt.has(dn):!1,label:"attributes",linksGetter:null,onToggle:Ft&&Nt?()=>Nt(dn):null})))))}const xe=({data:yt,interactive:ft=!0,isOpen:Tt,onToggle:Bt,onItemToggle:Nt,openedItems:Ft,createFocusSpanLink:Gt})=>{const dn=!Array.isArray(yt)||!yt.length;let sn=null,Bn="span",wt=null;ft&&(sn=Tt?s.createElement(y.J,{name:"angle-down",className:M.Im}):s.createElement(y.J,{name:"angle-right",className:M.Im}),Bn="a",wt={"aria-checked":Tt,onClick:dn?null:Bt,role:"switch"});const Vt=(0,u.wW)(ze);return s.createElement("div",{className:Vt.AccordianReferences},s.createElement(Bn,{className:Vt.AccordianReferencesHeader,...wt},sn,s.createElement("strong",null,s.createElement("span",null,"References"))," ","(",yt.length,")"),Tt&&s.createElement(Ie,{data:yt,openedItems:Ft,createFocusSpanLink:Gt,onItemToggle:Nt,interactive:ft}))},Te=s.memo(xe),Oe=()=>({TextList:(0,t.css)` max-height: 450px; overflow: auto; `,List:(0,t.css)` width: 100%; list-style: none; padding: 0; margin: 0; `,item:(0,t.css)` padding: 0.25rem 0.5rem; vertical-align: top; &:nth-child(2n) { background: #f5f5f5; } `});function ie(yt){const{data:ft}=yt,Tt=(0,u.wW)(Oe);return s.createElement("div",{className:h()(Tt.TextList),"data-testid":"TextList"},s.createElement("ul",{className:Tt.List},ft.map((Bt,Nt)=>s.createElement("li",{className:Tt.item,key:`${Nt}`},Bt))))}const Le=yt=>({header:(0,t.css)` cursor: pointer; overflow: hidden; padding: 0.25em 0.1em; text-overflow: ellipsis; white-space: nowrap; &:hover { background: ${(0,v.h)(yt,"#e8e8e8")}; } `});function Be({data:yt}){return s.createElement(ie,{data:yt})}function Ue(yt){const{className:ft,data:Tt,headerClassName:Bt,interactive:Nt,isOpen:Ft,label:Gt,onToggle:dn,TextComponent:sn=Be}=yt,Bn=!Array.isArray(Tt)||!Tt.length,wt=(0,u.wW)(_),Vt=h()(M.Im,{[wt.emptyIcon]:Bn});let Ht=null,Xt=null;Nt&&(Ht=Ft?s.createElement(y.J,{name:"angle-down",className:Vt}):s.createElement(y.J,{name:"angle-right",className:Vt}),Xt={"aria-checked":Ft,onClick:Bn?null:dn,role:"switch"});const mn=(0,u.wW)(Le);return s.createElement("div",{className:ft||""},s.createElement("div",{className:h()(mn.header,Bt),...Xt,"data-testid":"AccordianText--header"},Ht,s.createElement("strong",null,Gt)," (",Tt.length,")"),Ft&&s.createElement(sn,{data:Tt}))}Ue.defaultProps={className:null,highContrast:!1,interactive:!0,onToggle:null};const ue=yt=>({header:(0,t.css)` display: flex; align-items: flex-start; justify-content: space-between; gap: 0 1rem; margin-bottom: 0.25rem; `,listWrapper:(0,t.css)` overflow: hidden; `,debugInfo:(0,t.css)` label: debugInfo; display: block; letter-spacing: 0.25px; margin: 0.5em 0 -0.75em; text-align: right; `,debugLabel:(0,t.css)` label: debugLabel; &::before { color: ${(0,v.h)(yt,"#bbb")}; content: attr(data-label); } `,debugValue:(0,t.css)` label: debugValue; background-color: inherit; border: none; color: ${(0,v.h)(yt,"#888")}; cursor: pointer; &:hover { color: ${(0,v.h)(yt,"#333")}; } `,AccordianWarnings:(0,t.css)` label: AccordianWarnings; background: ${(0,v.h)(yt,"#fafafa")}; border: 1px solid ${(0,v.h)(yt,"#e4e4e4")}; margin-bottom: 0.25rem; `,AccordianWarningsHeader:(0,t.css)` label: AccordianWarningsHeader; background: ${(0,v.h)(yt,"#fff7e6")}; padding: 0.25rem 0.5rem; &:hover { background: ${(0,v.h)(yt,"#ffe7ba")}; } `,AccordianWarningsHeaderOpen:(0,t.css)` label: AccordianWarningsHeaderOpen; border-bottom: 1px solid ${(0,v.h)(yt,"#e8e8e8")}; `,AccordianWarningsLabel:(0,t.css)` label: AccordianWarningsLabel; color: ${(0,v.h)(yt,"#d36c08")}; `,Textarea:(0,t.css)` word-break: break-all; white-space: pre; `,LinkIcon:(0,t.css)` font-size: 1.5em; `});function pe(yt){const{detailState:ft,linksGetter:Tt,logItemToggle:Bt,logsToggle:Nt,processToggle:Ft,span:Gt,tagsToggle:dn,traceStartTime:sn,warningsToggle:Bn,stackTracesToggle:wt,referencesToggle:Vt,referenceItemToggle:Ht,createSpanLink:Xt,createFocusSpanLink:mn,topOfViewRefType:pn,datasourceType:Pn}=yt,{isTagsOpen:zn,isProcessOpen:Hn,logs:Ea,isWarningsOpen:aa,references:na,isStackTracesOpen:xa}=ft,{operationName:Ca,process:Ba,duration:ka,relativeStartTime:Ua,startTime:$a,traceID:Mt,spanID:Dt,logs:ht,tags:Lt,warnings:rn,references:zt,stackTraces:En}=Gt,{timeZone:Tn}=yt;let An=[{key:"svc",label:"Service:",value:Ba.serviceName},{key:"duration",label:"Duration:",value:(0,T.LU)(ka)},{key:"start",label:"Start Time:",value:(0,T.LU)(Ua)+$e($a,Tn)},...Gt.childSpanCount>0?[{key:"child_count",label:"Child Count:",value:Gt.childSpanCount}]:[]];Gt.kind&&An.push({key:Ee.TO,label:"Kind:",value:Gt.kind}),Gt.statusCode!==void 0&&An.push({key:Ee.Q_,label:"Status:",value:tt.Q[Gt.statusCode].toLowerCase()}),Gt.statusMessage&&An.push({key:Ee.S2,label:"Status Message:",value:Gt.statusMessage}),Gt.instrumentationLibraryName&&An.push({key:Ee.cG,label:"Library Name:",value:Gt.instrumentationLibraryName}),Gt.instrumentationLibraryVersion&&An.push({key:Ee.gc,label:"Library Version:",value:Gt.instrumentationLibraryVersion}),Gt.traceState&&An.push({key:Ee.vB,label:"Trace State:",value:Gt.traceState});const xn=(0,u.wW)(ue);let ia;if(Xt){const _n=Xt(Gt),sa=_n?.filter(ca=>ca.type===Ce.u.Logs);_n&&sa&&sa.length>0&&(ia=s.createElement(xt.k,{link:{...sa[0],title:"Logs for this span",target:"_blank",origin:sa[0].field,onClick:ca=>{(0,r.ff)("grafana_traces_trace_view_span_link_clicked",{datasourceType:Pn,grafana_version:g.config.buildInfo.version,type:"log",location:"spanDetails"}),sa?.[0].onClick?sa?.[0].onClick?.(ca):Pt.E1.push(sa?.[0].href)}},buttonProps:{icon:"gf-logs"}}))}const oa=mn(Mt,Dt);return s.createElement("div",{"data-testid":"span-detail-component"},s.createElement("div",{className:xn.header},s.createElement("h2",{className:h()(M.h2)},Ca),s.createElement("div",{className:xn.listWrapper},s.createElement(me,{className:M.xb,divider:!0,items:An}))),ia,s.createElement(ct,{className:M.im,type:"horizontal"}),s.createElement("div",null,s.createElement("div",null,s.createElement(Y,{data:Lt,label:"Span Attributes",linksGetter:Tt,isOpen:zn,onToggle:()=>dn(Dt)}),Ba.tags&&s.createElement(Y,{className:M.bi,data:Ba.tags,label:"Resource Attributes",linksGetter:Tt,isOpen:Hn,onToggle:()=>Ft(Dt)})),ht&&ht.length>0&&s.createElement(Q,{linksGetter:Tt,logs:ht,isOpen:Ea.isOpen,openedItems:Ea.openedItems,onToggle:()=>Nt(Dt),onItemToggle:_n=>Bt(Dt,_n),timestamp:sn}),rn&&rn.length>0&&s.createElement(Ue,{className:xn.AccordianWarnings,headerClassName:xn.AccordianWarningsHeader,label:s.createElement("span",{className:xn.AccordianWarningsLabel},"Warnings"),data:rn,isOpen:aa,onToggle:()=>Bn(Dt)}),En?.length?s.createElement(Ue,{label:"Stack trace",data:En,isOpen:xa,TextComponent:_n=>{let sa;return _n.data?.length>1?sa=_n.data.map((ca,jn)=>`StackTrace ${jn+1}: ${ca}`).join(` `):sa=_n.data?.[0],s.createElement(bt.K,{className:xn.Textarea,style:{cursor:"unset"},readOnly:!0,cols:10,rows:10,value:sa})},onToggle:()=>wt(Dt)}):null,zt&&zt.length>0&&(zt.length>1||zt[0].refType!=="CHILD_OF")&&s.createElement(Te,{data:zt,isOpen:na.isOpen,openedItems:na.openedItems,onToggle:()=>Vt(Dt),onItemToggle:_n=>Ht(Dt,_n),createFocusSpanLink:mn}),pn===Qe.Explore&&s.createElement("small",{className:xn.debugInfo},s.createElement("a",{...oa,onClick:_n=>{oa.onClick&&_n.button===0&&(!_n.currentTarget.target||_n.currentTarget.target==="_self")&&!(_n.metaKey||_n.altKey||_n.ctrlKey||_n.shiftKey)&&(_n.preventDefault(),oa.onClick(_n))}},s.createElement(y.J,{name:"link",className:h()(M.Im,xn.LinkIcon)})),s.createElement("span",{className:xn.debugLabel,"data-label":"SpanID:"})," ",Dt)))}const $e=(yt,ft)=>{const Tt=(0,nt.dq)(yt/1e3,{timeZone:ft,defaultWithMS:!0}),Bt=Tt.split(" ");return` (${Bt[1]?Bt[1]:Tt})`},Se=(0,d.B)(yt=>({expandedAccent:(0,t.css)` cursor: pointer; height: 100%; overflow: hidden; position: absolute; width: 100%; &::before { border-left: 4px solid; pointer-events: none; width: 1000px; } &::after { border-right: 1000px solid; border-color: inherit; cursor: pointer; opacity: 0.2; } /* border-color inherit must come AFTER other border declarations for accent */ &::before, &::after { border-color: inherit; content: ' '; position: absolute; height: 100%; } &:hover::after { opacity: 0.35; } `,infoWrapper:(0,t.css)` label: infoWrapper; border: 1px solid ${(0,v.h)(yt,"#d3d3d3")}; border-top: 3px solid; padding: 0.75rem; `}));class Ve extends s.PureComponent{constructor(){super(...arguments),this._detailToggle=()=>{this.props.onDetailToggled(this.props.span.spanID)},this._linksGetter=(ft,Tt)=>{const{linksGetter:Bt,span:Nt}=this.props;return Bt(Nt,ft,Tt)}}render(){const{color:ft,columnDivision:Tt,detailState:Bt,logItemToggle:Nt,logsToggle:Ft,processToggle:Gt,referenceItemToggle:dn,referencesToggle:sn,warningsToggle:Bn,stackTracesToggle:wt,span:Vt,timeZone:Ht,tagsToggle:Xt,traceStartTime:mn,hoverIndentGuideIds:pn,addHoverIndentGuideId:Pn,removeHoverIndentGuideId:zn,theme:Hn,createSpanLink:Ea,focusedSpanId:aa,createFocusSpanLink:na,topOfViewRefType:xa,datasourceType:Ca}=this.props,Ba=Se(Hn);return s.createElement(et.Z,null,s.createElement(et.Z.Cell,{width:Tt,style:{overflow:"hidden"}},s.createElement(We,{span:Vt,showChildrenIcon:!1,hoverIndentGuideIds:pn,addHoverIndentGuideId:Pn,removeHoverIndentGuideId:zn}),s.createElement(O.zx,{fill:"text",onClick:this._detailToggle,className:h()(Ba.expandedAccent,(0,O.gN)(Hn)),style:{borderColor:ft},"data-testid":"detail-row-expanded-accent"})),s.createElement(et.Z.Cell,{width:1-Tt},s.createElement("div",{className:Ba.infoWrapper,style:{borderTopColor:ft}},s.createElement(pe,{detailState:Bt,linksGetter:this._linksGetter,logItemToggle:Nt,logsToggle:Ft,processToggle:Gt,referenceItemToggle:dn,referencesToggle:sn,warningsToggle:Bn,stackTracesToggle:wt,span:Vt,timeZone:Ht,tagsToggle:Xt,traceStartTime:mn,createSpanLink:Ea,focusedSpanId:aa,createFocusSpanLink:na,topOfViewRefType:xa,datasourceType:Ca}))))}}const He=(0,u.HE)(Ve),Ze=(0,d.B)(yt=>{const{topOfViewRefType:ft}=yt,Tt=ft==="Explore"?"fixed":"absolute";return{rowsWrapper:(0,t.css)` width: 100%; `,row:(0,t.css)` width: 100%; `,scrollToTopButton:(0,t.css)` display: flex; flex-direction: column; justify-content: center; align-items: center; width: 40px; height: 40px; position: ${Tt}; bottom: 30px; right: 30px; z-index: 1; `}});var Qe=(yt=>(yt.Explore="Explore",yt.Panel="Panel",yt))(Qe||{});const rt={bar:28,detail:161,detailWithLogs:197},pt=5;function It(yt,ft,Tt,Bt,Nt){if(!yt)return[];Nt&&Bt&&(yt=yt.filter(dn=>Bt.has(dn.spanID)));let Ft=null;const Gt=[];for(let dn=0;dn<yt.length;dn++){const sn=yt[dn],{spanID:Bn,depth:wt}=sn;let Vt=!1;Ft!=null&&(wt>=Ft?Vt=!0:Ft=null),!Vt&&(ft.has(Bn)&&(Ft=wt+1),Gt.push({span:sn,isDetail:!1,spanIndex:dn}),Tt.has(Bn)&&Gt.push({span:sn,isDetail:!0,spanIndex:dn}))}return Gt}function _t(yt){const[ft,Tt]=yt;return{left:ft>0,right:Tt<1}}function tn(yt,ft,Tt,Bt,Nt){return yt?It(yt.spans,ft,Tt,Bt,Nt):[]}const qt=(0,i.Z)(tn),cn=(0,i.Z)(T._h,n.isEqual),on=(0,i.Z)(_t,n.isEqual);class ln extends s.Component{constructor(){super(...arguments),this.hasScrolledToSpan=!1,this.getViewRange=()=>this.props.currentViewRangeTime,this.getSearchedSpanIDs=()=>this.props.findMatchesIDs,this.getCollapsedChildren=()=>this.props.childrenHiddenIDs,this.mapRowIndexToSpanIndex=ft=>this.getRowStates()[ft].spanIndex,this.mapSpanIndexToRowIndex=ft=>{const Tt=this.getRowStates().length;for(let Bt=0;Bt<Tt;Bt++){const{spanIndex:Nt}=this.getRowStates()[Bt];if(Nt===ft)return Bt}throw new Error(`unable to find row for span index: ${ft}`)},this.setListView=ft=>{const Tt=this.listView!==ft;this.listView=ft,ft&&Tt&&this.props.registerAccessors(this.getAccessors())},this.getKeyFromIndex=ft=>{const{isDetail:Tt,span:Bt}=this.getRowStates()[ft];return`${Bt.traceID}--${Bt.spanID}--${Tt?"detail":"bar"}`},this.getIndexFromKey=ft=>{const Tt=ft.split("--"),Bt=Tt[0],Nt=Tt[1],Ft=Tt[2]==="detail",Gt=this.getRowStates().length;for(let dn=0;dn<Gt;dn++){const{span:sn,isDetail:Bn}=this.getRowStates()[dn];if(sn.spanID===Nt&&sn.traceID===Bt&&Bn===Ft)return dn}return-1},this.getRowHeight=ft=>{const{span:Tt,isDetail:Bt}=this.getRowStates()[ft];return Bt?Array.isArray(Tt.logs)&&Tt.logs.length?rt.detailWithLogs:rt.detail:rt.bar},this.renderRow=(ft,Tt,Bt,Nt)=>{const{isDetail:Ft,span:Gt,spanIndex:dn}=this.getRowStates()[Bt];return Ft?this.renderSpanDetailRow(Gt,ft,Tt,Nt):this.renderSpanBarRow(Gt,dn,ft,Tt,Nt)},this.scrollToSpan=(ft,Tt)=>{if(Tt==null)return;const Bt=this.getRowStates().findIndex(Nt=>Nt.span.spanID===Tt);Bt>=0&&this.listView?.scrollToIndex(Bt,ft)},this.scrollToTop=()=>{const{topOfViewRef:ft,datasourceType:Tt,trace:Bt}=this.props;ft?.current?.scrollIntoView({behavior:"smooth"}),(0,r.ff)("grafana_traces_trace_view_scroll_to_top_clicked",{datasourceType:Tt,grafana_version:g.config.buildInfo.version,numServices:Bt.services.length,numSpans:Bt.spans.length})}}componentDidMount(){this.scrollToSpan(this.props.headerHeight,this.props.focusedSpanId)}shouldComponentUpdate(ft){let Tt;for(Tt in ft)if(ft[Tt]!==this.props[Tt])return!0;return!1}componentDidUpdate(ft){const{registerAccessors:Tt}=ft,{registerAccessors:Bt,headerHeight:Nt,focusedSpanId:Ft,focusedSpanIdForSearch:Gt}=this.props;this.listView&&Tt!==Bt&&Bt(this.getAccessors()),this.hasScrolledToSpan||(this.scrollToSpan(Nt,Ft),this.hasScrolledToSpan=!0),Ft!==ft.focusedSpanId&&this.scrollToSpan(Nt,Ft),Gt!==ft.focusedSpanIdForSearch&&this.scrollToSpan(Nt,Gt)}getRowStates(){const{childrenHiddenIDs:ft,detailStates:Tt,trace:Bt,findMatchesIDs:Nt,showSpanFilterMatchesOnly:Ft}=this.props;return qt(Bt,ft,Tt,Nt,Ft)}getClipping(){const{currentViewRangeTime:ft}=this.props;return on(ft)}getViewedBounds(){const{currentViewRangeTime:ft,trace:Tt}=this.props,[Bt,Nt]=ft;return cn({min:Tt.startTime,max:Tt.endTime,viewStart:Bt,viewEnd:Nt})}getAccessors(){const ft=this.listView;if(!ft)throw new Error("ListView unavailable");return{getViewRange:this.getViewRange,getSearchedSpanIDs:this.getSearchedSpanIDs,getCollapsedChildren:this.getCollapsedChildren,getViewHeight:ft.getViewHeight,getBottomRowIndexVisible:ft.getBottomVisibleIndex,getTopRowIndexVisible:ft.getTopVisibleIndex,getRowPosition:ft.getRowPosition,mapRowIndexToSpanIndex:this.mapRowIndexToSpanIndex,mapSpanIndexToRowIndex:this.mapSpanIndexToRowIndex}}renderSpanBarRow(ft,Tt,Bt,Nt,Ft){const{spanID:Gt}=ft,{serviceName:dn}=ft.process,{childrenHiddenIDs:sn,childrenToggle:Bn,detailStates:wt,detailToggle:Vt,findMatchesIDs:Ht,spanNameColumnWidth:Xt,trace:mn,spanBarOptions:pn,hoverIndentGuideIds:Pn,addHoverIndentGuideId:zn,removeHoverIndentGuideId:Hn,createSpanLink:Ea,focusedSpanId:aa,focusedSpanIdForSearch:na,showSpanFilterMatchesOnly:xa,theme:Ca,datasourceType:Ba}=this.props;if(!mn)return null;const ka=(0,m._K)(dn,Ca),Ua=sn.has(Gt),$a=wt.has(Gt),Mt=Ht?Ht.has(Gt):!1,Dt=Gt===aa||Gt===na,ht=(0,T.yM)(ft)||Ua&&(0,T.Qx)(mn.spans,Tt);let Lt=null;if(Ua){const Tn=(0,T.s2)(mn.spans.slice(Tt));if(Tn){const An=this.getViewedBounds()(Tn.startTime,Tn.startTime+Tn.duration);Lt={color:(0,m._K)(Tn.process.serviceName,Ca),operationName:Tn.operationName,serviceName:Tn.process.serviceName,viewEnd:An.end,viewStart:An.start}}}const rn=ft.tags.find(Tn=>Tn.key===o);let zt=null;!ft.hasChildren&&rn&&(0,T.JE)(ft)&&(zt={serviceName:rn.value,color:(0,m._K)(rn.value,Ca)});const En=Ze(this.props);return s.createElement("div",{className:En.row,key:Bt,style:Nt,...Ft},s.createElement(Ye,{clippingLeft:this.getClipping().left,clippingRight:this.getClipping().right,color:ka,spanBarOptions:pn,columnDivision:Xt,isChildrenExpanded:!Ua,isDetailExpanded:$a,isMatchingFilter:Mt,isFocused:Dt,showSpanFilterMatchesOnly:xa,numTicks:pt,onDetailToggled:Vt,onChildrenToggled:Bn,rpc:Lt,noInstrumentedServer:zt,showErrorIcon:ht,getViewedBounds:this.getViewedBounds(),traceStartTime:mn.startTime,span:ft,hoverIndentGuideIds:Pn,addHoverIndentGuideId:zn,removeHoverIndentGuideId:Hn,createSpanLink:Ea,datasourceType:Ba}))}renderSpanDetailRow(ft,Tt,Bt,Nt){const{spanID:Ft}=ft,{serviceName:Gt}=ft.process,{detailLogItemToggle:dn,detailLogsToggle:sn,detailProcessToggle:Bn,detailReferencesToggle:wt,detailReferenceItemToggle:Vt,detailWarningsToggle:Ht,detailStackTracesToggle:Xt,detailStates:mn,detailTagsToggle:pn,detailToggle:Pn,spanNameColumnWidth:zn,trace:Hn,timeZone:Ea,hoverIndentGuideIds:aa,addHoverIndentGuideId:na,removeHoverIndentGuideId:xa,linksGetter:Ca,createSpanLink:Ba,focusedSpanId:ka,createFocusSpanLink:Ua,topOfViewRefType:$a,theme:Mt,datasourceType:Dt}=this.props,ht=mn.get(Ft);if(!Hn||!ht)return null;const Lt=(0,m._K)(Gt,Mt),rn=Ze(this.props);return s.createElement("div",{className:rn.row,key:Tt,style:{...Bt,zIndex:1},...Nt},s.createElement(He,{color:Lt,columnDivision:zn,onDetailToggled:Pn,detailState:ht,linksGetter:Ca,logItemToggle:dn,logsToggle:sn,processToggle:Bn,referenceItemToggle:Vt,referencesToggle:wt,warningsToggle:Ht,stackTracesToggle:Xt,span:ft,timeZone:Ea,tagsToggle:pn,traceStartTime:Hn.startTime,hoverIndentGuideIds:aa,addHoverIndentGuideId:na,removeHoverIndentGuideId:xa,createSpanLink:Ba,focusedSpanId:ka,createFocusSpanLink:Ua,topOfViewRefType:$a,datasourceType:Dt}))}render(){const ft=Ze(this.props),{scrollElement:Tt}=this.props;return s.createElement(s.Fragment,null,s.createElement(f,{ref:this.setListView,dataLength:this.getRowStates().length,itemHeightGetter:this.getRowHeight,itemRenderer:this.renderRow,viewBuffer:50,viewBufferMin:50,itemsWrapperClassName:ft.rowsWrapper,getKeyFromIndex:this.getKeyFromIndex,getIndexFromKey:this.getIndexFromKey,windowScroller:!1,scrollElement:Tt}),s.createElement(l.h,{className:ft.scrollToTopButton,onClick:this.scrollToTop,title:"Scroll to top",icon:"arrow-up"}))}}const Un=(0,u.HE)(ln)},58549:(j,I,e)=>{"use strict";e.d(I,{JE:()=>h,LU:()=>t.LU,Qx:()=>f,_h:()=>n,s2:()=>E,yM:()=>p});var t=e(25985);function n(y){const{min:v,max:D,viewStart:a,viewEnd:C}=y,P=D-v,b=v+a*P,T=D-(1-C)*P-b;return(S,x)=>({start:(S-b)/T,end:(x-b)/T})}function i(y,v,D){return!Array.isArray(D.tags)||!D.tags.length?!1:D.tags.some(a=>a.key===y&&a.value===v)}const s=y=>y.kind==="client",r=i.bind(null,"span.kind","client"),g=y=>s(y)||r(y),d=y=>y.kind==="server",l=i.bind(null,"span.kind","server"),u=y=>d(y)||l(y),o=y=>y.statusCode===2,m=i.bind(null,"error",!0),c=i.bind(null,"error","true"),p=y=>o(y)||m(y)||c(y);function f(y,v){const{depth:D}=y[v];let a=v+1;for(;a<y.length&&y[a].depth>D;a++)if(p(y[a]))return!0;return!1}function E(y){if(y.length<=1||!g(y[0]))return!1;const D=y[0].depth+1;let a=1;for(;a<y.length&&y[a].depth===D;){if(u(y[a]))return y[a];a++}return null}const h=y=>y.kind?y.kind==="client":y.tags.some(({key:v,value:D})=>v==="span.kind"&&D==="client")},63568:(j,I,e)=>{"use strict";e.d(I,{ID:()=>d,Q_:()=>n,S2:()=>i,TO:()=>t,cG:()=>s,gc:()=>r,vB:()=>g});const t="kind",n="status",i="status.message",s="library.name",r="library.version",g="trace.state",d="id"},28382:(j,I,e)=>{"use strict";e.d(I,{DetailState:()=>Xt,TracePageHeader:()=>Bn,TraceTimelineViewer:()=>G,filterSpans:()=>cn,transformTraceData:()=>$a});var t=e(42844),n=e(27702),i=e(86312),s=e(34667),r=e(80402),g=e(66310),d=e(20609),l=e(42185),u=e.n(l);const m={scrollPageDown:{binding:"s",label:"Scroll down"},scrollPageUp:{binding:"w",label:"Scroll up"},scrollToNextVisibleSpan:{binding:"f",label:"Scroll to the next visible span"},scrollToPrevVisibleSpan:{binding:"b",label:"Scroll to the previous visible span"},panLeft:{binding:["a","left"],label:"Pan left"},panLeftFast:{binding:["shift+a","shift+left"],label:"Pan left \u2014 Large"},panRight:{binding:["d","right"],label:"Pan right"},panRightFast:{binding:["shift+d","shift+right"],label:"Pan right \u2014 Large"},zoomIn:{binding:"up",label:"Zoom in"},zoomInFast:{binding:"shift+up",label:"Zoom in \u2014 Large"},zoomOut:{binding:"down",label:"Zoom out"},zoomOutFast:{binding:"shift+down",label:"Zoom out \u2014 Large"},collapseAll:{binding:"]",label:"Collapse All"},expandAll:{binding:"[",label:"Expand All"},collapseOne:{binding:"p",label:"Collapse One Level"},expandOne:{binding:"o",label:"Expand One Level"},searchSpans:{binding:"ctrl+b",label:"Search Spans"},clearSearch:{binding:"escape",label:"Clear Search"}};let c;function p(){if(c)return c;const Mt=new(u())(document.body);return c=Mt,Mt}function f(Mt){const Dt=p();Object.keys(Mt).forEach(ht=>{const Lt=Mt[ht];Lt&&Dt.bind(m[ht].binding,Lt)})}function E(){p().reset()}var h=e(89898),y=e.n(h),v=e(90170),D=e(59391),a=e(25356),C=e(67437);const P=()=>({TimelineCollapser:(0,t.css)` align-items: center; display: flex; flex: none; justify-content: center; margin-right: 0.5rem; `});function b(Mt){const{onExpandAll:Dt,onExpandOne:ht,onCollapseAll:Lt,onCollapseOne:rn}=Mt,zt=(0,g.wW)(P);return n.createElement("div",{className:zt.TimelineCollapser,"data-testid":"TimelineCollapser"},n.createElement(C.h,{tooltip:"Expand +1",size:"xl",tooltipPlacement:"top",name:"angle-down",onClick:ht}),n.createElement(C.h,{tooltip:"Collapse +1",size:"xl",tooltipPlacement:"top",name:"angle-right",onClick:rn}),n.createElement(C.h,{tooltip:"Expand All",size:"xl",tooltipPlacement:"top",name:"angle-double-down",onClick:Dt}),n.createElement(C.h,{tooltip:"Collapse All",size:"xl",tooltipPlacement:"top",name:"angle-double-right",onClick:Lt}))}var M=e(8033);const T=(0,r.B)(()=>({TimelineColumnResizer:(0,t.css)` left: 0; position: absolute; right: 0; top: 0; `,wrapper:(0,t.css)` bottom: 0; position: absolute; top: 0; `,dragger:(0,t.css)` border-left: 2px solid transparent; cursor: col-resize; height: 5000px; margin-left: -1px; position: absolute; top: 0; width: 1px; z-index: 10; &:hover { border-left: 2px solid rgba(0, 0, 0, 0.3); } &::before { position: absolute; top: 0; bottom: 0; left: -8px; right: 0; content: ' '; } `,draggerDragging:(0,t.css)` background: rgba(136, 0, 136, 0.05); width: unset; &::before { left: -2000px; right: -2000px; } `,draggerDraggingLeft:(0,t.css)` border-left: 2px solid #808; border-right: 1px solid #999; `,draggerDraggingRight:(0,t.css)` border-left: 1px solid #999; border-right: 2px solid #808; `,gripIcon:(0,t.css)` position: absolute; top: 0; bottom: 0; &::before, &::after { border-right: 1px solid #ccc; content: ' '; height: 9px; position: absolute; right: 9px; top: 25px; } &::after { right: 5px; } `,gripIconDragging:(0,t.css)` &::before, &::after { border-right: 1px solid rgba(136, 0, 136, 0.5); } `}));class S extends n.PureComponent{constructor(Dt){super(Dt),this._setRootElm=ht=>{this._rootElm=ht},this._getDraggingBounds=()=>{if(!this._rootElm)throw new Error("invalid state");const{left:ht,width:Lt}=this._rootElm.getBoundingClientRect(),{min:rn,max:zt}=this.props;return{clientXLeft:ht,width:Lt,maxValue:zt,minValue:rn}},this._handleDragUpdate=({value:ht})=>{this.setState({dragPosition:ht})},this._handleDragEnd=({manager:ht,value:Lt})=>{ht.resetBounds(),this.setState({dragPosition:null}),this.props.onChange(Lt)},this._dragManager=new M.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleDragEnd,onDragMove:this._handleDragUpdate,onDragStart:this._handleDragUpdate}),this._rootElm=void 0,this.state={dragPosition:null}}componentWillUnmount(){this._dragManager.dispose()}render(){let Dt,ht;const{position:Lt,columnResizeHandleHeight:rn}=this.props,{dragPosition:zt}=this.state;Dt=`${Lt*100}%`;const En={left:Dt};let Tn=!1,An=!1;const xn=T();if(this._dragManager.isDragging()&&this._rootElm&&zt!=null){Tn=zt<Lt,An=zt>Lt;const oa=`${Math.min(Lt,zt)*100}%`,_n=`calc(${(1-Math.max(Lt,zt))*100}% - 1px)`;ht={left:oa,right:_n}}else ht=En;ht.height=rn;const ia=Tn||An;return n.createElement("div",{className:xn.TimelineColumnResizer,ref:this._setRootElm,"data-testid":"TimelineColumnResizer"},n.createElement("div",{className:y()(xn.gripIcon,ia&&xn.gripIconDragging),style:En,"data-testid":"TimelineColumnResizer--gripIcon"}),n.createElement("div",{"aria-hidden":!0,className:y()(xn.dragger,ia&&xn.draggerDragging,An&&xn.draggerDraggingRight,Tn&&xn.draggerDraggingLeft),onMouseDown:this._dragManager.handleMouseDown,style:ht,"data-testid":"TimelineColumnResizer--dragger"}))}}const x=(0,r.B)(()=>({TimelineViewingLayer:(0,t.css)` label: TimelineViewingLayer; bottom: 0; cursor: vertical-text; left: 0; position: absolute; right: 0; top: 0; `,TimelineViewingLayerCursorGuide:(0,t.css)` label: TimelineViewingLayerCursorGuide; position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background-color: red; `,TimelineViewingLayerDragged:(0,t.css)` label: TimelineViewingLayerDragged; position: absolute; top: 0; bottom: 0; `,TimelineViewingLayerDraggedDraggingLeft:(0,t.css)` label: TimelineViewingLayerDraggedDraggingLeft; border-left: 1px solid; `,TimelineViewingLayerDraggedDraggingRight:(0,t.css)` label: TimelineViewingLayerDraggedDraggingRight; border-right: 1px solid; `,TimelineViewingLayerDraggedShiftDrag:(0,t.css)` label: TimelineViewingLayerDraggedShiftDrag; background-color: rgba(68, 68, 255, 0.2); border-color: #44f; `,TimelineViewingLayerDraggedReframeDrag:(0,t.css)` label: TimelineViewingLayerDraggedReframeDrag; background-color: rgba(255, 68, 68, 0.2); border-color: #f44; `,TimelineViewingLayerFullOverlay:(0,t.css)` label: TimelineViewingLayerFullOverlay; bottom: 0; cursor: col-resize; left: 0; position: fixed; right: 0; top: 0; user-select: none; `}));function O(Mt){return Reflect.has(Mt,"isOutOfView")}function B(Mt,Dt,ht){return Mt+ht*(Dt-Mt)}function A(Mt,Dt,ht){return(ht-Mt)/(Dt-Mt)}function V(Mt,Dt){let[ht,Lt]=Mt<Dt?[Mt,Dt]:[Dt,Mt];return ht>=1||Lt<=0?{isOutOfView:!0}:(ht<0&&(ht=0),Lt>1&&(Lt=1),{isDraggingLeft:Mt>Dt,left:`${ht*100}%`,width:`${(Lt-ht)*100}%`})}function W(Mt,Dt,ht,Lt,rn){const zt=A(Mt,Dt,ht),En=A(Mt,Dt,Lt),Tn=V(zt,En);if(O(Tn))return null;const{isDraggingLeft:An,left:xn,width:ia}=Tn,oa=x(),_n=(0,t.cx)({[oa.TimelineViewingLayerDraggedDraggingRight]:!An,[oa.TimelineViewingLayerDraggedReframeDrag]:!rn,[oa.TimelineViewingLayerDraggedShiftDrag]:rn});return n.createElement("div",{className:(0,t.cx)(oa.TimelineViewingLayerDragged,oa.TimelineViewingLayerDraggedDraggingLeft,_n),style:{left:xn,width:ia},"data-testid":"Dragged"})}class w extends n.PureComponent{constructor(Dt){super(Dt),this._setRoot=ht=>{this._root=ht},this._getDraggingBounds=()=>{if(!this._root)throw new Error("invalid state");const{left:ht,width:Lt}=this._root.getBoundingClientRect();return{clientXLeft:ht,width:Lt}},this._handleReframeMouseMove=({value:ht})=>{const[Lt,rn]=this.props.viewRangeTime.current,zt=B(Lt,rn,ht);this.props.updateNextViewRangeTime({cursor:zt})},this._handleReframeMouseLeave=()=>{this.props.updateNextViewRangeTime({cursor:void 0})},this._handleReframeDragUpdate=({value:ht})=>{const{current:Lt,reframe:rn}=this.props.viewRangeTime,[zt,En]=Lt,Tn=B(zt,En,ht),xn={reframe:{anchor:rn?rn.anchor:Tn,shift:Tn}};this.props.updateNextViewRangeTime(xn)},this._handleReframeDragEnd=({manager:ht,value:Lt})=>{const{current:rn,reframe:zt}=this.props.viewRangeTime,[En,Tn]=rn,An=B(En,Tn,Lt),xn=zt?zt.anchor:An,[ia,oa]=An<xn?[An,xn]:[xn,An];ht.resetBounds(),this.props.updateViewRangeTime(ia,oa,"timeline-header")},this._draggerReframe=new M.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleReframeDragEnd,onDragMove:this._handleReframeDragUpdate,onDragStart:this._handleReframeDragUpdate,onMouseLeave:this._handleReframeMouseLeave,onMouseMove:this._handleReframeMouseMove}),this._root=void 0}UNSAFE_componentWillReceiveProps(Dt){const{boundsInvalidator:ht}=this.props;ht!==Dt.boundsInvalidator&&this._draggerReframe.resetBounds()}componentWillUnmount(){this._draggerReframe.dispose()}render(){const{viewRangeTime:Dt}=this.props,{current:ht,cursor:Lt,reframe:rn,shiftEnd:zt,shiftStart:En}=Dt,[Tn,An]=ht,xn=rn!=null||zt!=null||En!=null;let ia;!xn&&Lt!=null&&Lt>=Tn&&Lt<=An&&(ia=`${A(Tn,An,Lt)*100}%`);const oa=x();return n.createElement("div",{"aria-hidden":!0,className:oa.TimelineViewingLayer,ref:this._setRoot,onMouseDown:this._draggerReframe.handleMouseDown,onMouseLeave:this._draggerReframe.handleMouseLeave,onMouseMove:this._draggerReframe.handleMouseMove,"data-testid":"TimelineViewingLayer"},ia!=null&&n.createElement("div",{className:oa.TimelineViewingLayerCursorGuide,style:{left:ia},"data-testid":"TimelineViewingLayer--cursorGuide"}),rn!=null&&W(Tn,An,rn.anchor,rn.shift,!1),zt!=null&&W(Tn,An,An,zt,!0),En!=null&&W(Tn,An,Tn,En,!0))}}const N=Mt=>({TimelineHeaderRow:(0,t.css)` label: TimelineHeaderRow; background: ${(0,d.h)(Mt,"#ececec")}; border-bottom: 1px solid ${(0,d.h)(Mt,"#ccc")}; height: 38px; line-height: 38px; width: 100%; z-index: 4; position: relative; `,TimelineHeaderRowTitle:(0,t.css)` label: TimelineHeaderRowTitle; flex: 1; overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; `,TimelineHeaderWrapper:(0,t.css)` label: TimelineHeaderWrapper; align-items: center; `});function F(Mt){const{duration:Dt,nameColumnWidth:ht,numTicks:Lt,onCollapseAll:rn,onCollapseOne:zt,onColummWidthChange:En,onExpandAll:Tn,onExpandOne:An,updateViewRangeTime:xn,updateNextViewRangeTime:ia,viewRangeTime:oa,columnResizeHandleHeight:_n}=Mt,[sa,ca]=oa.current,jn=(0,g.wW)(N);return n.createElement(a.Z,{className:jn.TimelineHeaderRow,"data-testid":"TimelineHeaderRow"},n.createElement(a.Z.Cell,{className:y()(v.oD,v.H3,jn.TimelineHeaderWrapper),width:ht},n.createElement("h4",{className:jn.TimelineHeaderRowTitle},"Service & Operation"),n.createElement(b,{onCollapseAll:rn,onExpandAll:Tn,onCollapseOne:zt,onExpandOne:An})),n.createElement(a.Z.Cell,{width:1-ht},n.createElement(w,{boundsInvalidator:ht,updateNextViewRangeTime:ia,updateViewRangeTime:xn,viewRangeTime:oa}),n.createElement(D.Z,{numTicks:Lt,startTime:sa*Dt,endTime:ca*Dt,showLabels:!0})),n.createElement(S,{columnResizeHandleHeight:_n,position:ht,onChange:En,min:.2,max:.85}))}var k=e(62227);const H=(0,r.B)(Mt=>({TraceTimelineViewer:(0,t.css)` label: TraceTimelineViewer; border-bottom: 1px solid ${(0,d.h)(Mt,"#bbb")}; & .json-markup { line-height: 17px; font-size: 13px; font-family: monospace; white-space: pre-wrap; } & .json-markup-key { font-weight: bold; } & .json-markup-bool { color: ${(0,d.h)(Mt,"firebrick")}; } & .json-markup-string { color: ${(0,d.h)(Mt,"teal")}; } & .json-markup-null { color: ${(0,d.h)(Mt,"teal")}; } & .json-markup-number { color: ${(0,d.h)(Mt,"blue","black")}; } `})),R=5;class _ extends n.PureComponent{constructor(Dt){super(Dt),this.collapseAll=()=>{this.props.collapseAll(this.props.trace.spans),(0,i.ff)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.config.buildInfo.version,type:"collapseAll"})},this.collapseOne=()=>{this.props.collapseOne(this.props.trace.spans),(0,i.ff)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.config.buildInfo.version,type:"collapseOne"})},this.expandAll=()=>{this.props.expandAll(),(0,i.ff)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.config.buildInfo.version,type:"expandAll"})},this.expandOne=()=>{this.props.expandOne(this.props.trace.spans),(0,i.ff)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.config.buildInfo.version,type:"expandOne"})},this.state={height:0}}componentDidMount(){f({collapseAll:this.collapseAll,expandAll:this.expandAll,collapseOne:this.collapseOne,expandOne:this.expandOne})}render(){const{setSpanNameColumnWidth:Dt,updateNextViewRangeTime:ht,updateViewRangeTime:Lt,viewRange:rn,traceTimeline:zt,theme:En,topOfViewRef:Tn,focusedSpanIdForSearch:An,...xn}=this.props,{trace:ia}=xn,oa=H(En);return n.createElement("div",{className:oa.TraceTimelineViewer,ref:_n=>_n&&this.setState({height:_n.getBoundingClientRect().height})},n.createElement(F,{duration:ia.duration,nameColumnWidth:zt.spanNameColumnWidth,numTicks:R,onCollapseAll:this.collapseAll,onCollapseOne:this.collapseOne,onColummWidthChange:Dt,onExpandAll:this.expandAll,onExpandOne:this.expandOne,viewRangeTime:rn.time,updateNextViewRangeTime:ht,updateViewRangeTime:Lt,columnResizeHandleHeight:this.state.height}),n.createElement(k.ZP,{...xn,...zt,setSpanNameColumnWidth:Dt,currentViewRangeTime:rn.time.current,topOfViewRef:Tn,focusedSpanIdForSearch:An,datasourceType:this.props.datasourceType}))}}const G=(0,g.HE)(_);var Y=e(60956),X=e(80011),Q=e(25357),se=e(73453);const Z=()=>({NewWindowIconLarge:(0,t.css)` label: NewWindowIconLarge; font-size: 1.5em; `});function le(Mt){const{isLarge:Dt,className:ht,...Lt}=Mt,rn=(0,g.wW)(Z),zt=y()({[rn.NewWindowIconLarge]:Dt},ht);return n.createElement(se.J,{className:zt,name:"anchor",...Lt})}le.defaultProps={isLarge:!1};const oe=Mt=>n.createElement("a",{href:Mt.href,title:Mt.title,target:"_blank",rel:"noopener noreferrer",className:Mt.className},Mt.children," ",n.createElement(le,null));function q(Mt){const{links:Dt}=Mt;return n.createElement(oe,{href:Dt[0].url,title:Dt[0].text,className:Mt.className})}const ne=100,ge="<trace-without-root-span>",ae=()=>({BreakableText:(0,t.css)` label: BreakableText; display: inline-block; white-space: pre; `}),re=/\W*\w+\W*/g;function De(Mt){const{className:Dt,text:ht,wordRegexp:Lt=re}=Mt,rn=(0,g.wW)(ae);if(!ht)return null;const zt=[];Lt.exec("");let En=Lt.exec(ht)||[ht];for(;En;)zt.push(n.createElement("span",{key:`${ht}-${zt.length}`,className:Dt||rn.BreakableText},En[0])),En=Lt.exec(ht);return zt}De.defaultProps={wordRegexp:re};const he=Mt=>({TraceName:(0,t.css)` label: TraceName; font-size: ${Mt.typography.size.lg}; `});function ye(Mt){const{className:Dt,traceName:ht}=Mt,Lt=(0,g.wW)(he),rn=String(ht||ge),zt=n.createElement(De,{text:rn});return n.createElement("span",{className:y()(Lt.TraceName,Dt)},zt)}var ce=e(89949),We=e(79662);const ke=Object.defineProperty({archiveEnabled:!1,dependencies:{dagMaxNumServices:ne,menuEnabled:!0},linkPatterns:[],search:{maxLookback:{label:"2 Days",value:"2d"},maxLimit:1500},tracking:{gaID:null,trackErrors:!0}},"__mergeFields",{value:["dependencies","search","tracking"]});function et(){return ke}function we(Mt){return(0,ce.get)(et(),Mt)}function _e(Mt){const Dt=Mt.references?Mt.references.find(ht=>ht.refType==="CHILD_OF"):null;return Dt?Dt.span:null}const Ge=/#\{([^{}]*)\}/g;function qe(Mt){const Dt=new Set;return Mt.replace(Ge,(ht,Lt)=>(Dt.add(Lt),ht)),Array.from(Dt)}function st(Mt,Dt,ht){return Mt.replace(Ge,(Lt,rn)=>{const zt=ht[rn];return zt==null?"":Dt(zt)})}function Me(Mt,Dt){if(typeof Mt!="string")throw new Error("Invalid template");return{parameters:qe(Mt),template:st.bind(null,Mt,Dt)}}function be(Mt){if(typeof Mt=="string")return Dt=>Dt===Mt;if(Array.isArray(Mt))return Dt=>Mt.indexOf(Dt)>-1;if(Mt==null)return()=>!0;throw new Error(`Invalid value: ${Mt}`)}const Ke=Mt=>Mt;function Ye(Mt){try{const Dt=Me(Mt.url,encodeURIComponent),ht=Me(Mt.text,Ke);return{object:Mt,type:be(Mt.type),key:be(Mt.key),value:be(Mt.value),url:Dt,text:ht,parameters:(0,ce.uniq)(Dt.parameters.concat(ht.parameters))}}catch(Dt){return console.error(`Ignoring invalid link pattern: ${Dt}`,Mt),null}}function tt(Mt,Dt){if(Dt)return Dt.find(ht=>ht.key===Mt)}function nt(Mt,Dt){let ht=Dt;for(;ht;){const Lt=tt(Mt,ht.tags)||tt(Mt,ht.process.tags);if(Lt)return Lt;ht=_e(ht)}}function Pt(Mt,Dt){return Mt.template(Dt)}function xt(Mt,Dt){const ht=[],Lt=Object.keys(Dt).filter(rn=>typeof Dt[rn]=="string"||Dt[rn]==="number");return Mt?.filter(rn=>rn?.type("traces")).forEach(rn=>{const zt={};rn?.parameters.every(Tn=>{const An=Tn;return Lt.includes(An)?(zt[Tn]=Dt[An],!0):!1})&&ht.push({url:Pt(rn.url,zt),text:Pt(rn.text,zt)})}),ht}function bt(Mt,Dt,ht,Lt){const rn=ht[Lt];let zt="logs";const En=Dt.process.tags===ht;En&&(zt="process"),Dt.tags===ht&&(zt="tags");const An=[];return Mt.forEach(xn=>{if(xn.type(zt)&&xn.key(rn.key)&&xn.value(rn.value)){const ia={};xn.parameters.every(_n=>{let sa=tt(_n,ht);return!sa&&!En&&(sa=nt(_n,Dt)),sa?(ia[_n]=sa.value,!0):(console.warn(`Skipping link pattern, missing parameter ${_n} for key ${rn.key} in ${zt}.`,xn.object),!1)})&&An.push({url:Pt(xn.url,ia),text:Pt(xn.text,ia)})}}),An}function Rt(Mt,Dt){return(ht,Lt,rn)=>{if(Mt.length===0)return[];const zt=Lt[rn];let En=Dt.get(zt);return En||(En=bt(Mt,ht,Lt,rn),Dt.set(zt,En)),En}}const ct=(we("linkPatterns")||[]).map(Ye).filter(Mt=>!!Mt),it=(0,We.Z)(10)(Mt=>{const Dt=[];return Mt?xt(ct,Mt):Dt}),me=Rt(ct,new WeakMap);function Ee(Mt){let Dt;const ht=new Set(Mt.map(({spanID:Lt})=>Lt));for(let Lt=0;Lt<Mt.length;Lt++){if(Mt[Lt].references&&Mt[Lt].references.some(({traceID:Tn,spanID:An})=>Tn===Mt[Lt].traceID&&ht.has(An)))continue;if(!Dt){Dt=Mt[Lt];continue}const zt=Mt[Lt].references&&Mt[Lt].references.length||0,En=Dt.references&&Dt.references.length||0;(zt<En||zt===En&&Mt[Lt].startTime<Dt.startTime)&&(Dt=Mt[Lt])}return Dt?`${Dt.process.serviceName}: ${Dt.operationName}`:""}const Ce=(0,ce.memoize)(Ee,Mt=>Mt.length?Mt[0].traceID:0);function Ae(Mt){for(let Dt=0;Dt<Mt.length;Dt++){const ht=Mt[Dt].tags.filter(zt=>zt.key==="http.method"),Lt=Mt[Dt].tags.filter(zt=>zt.key==="http.status_code"),rn=Mt[Dt].tags.filter(zt=>zt.key==="http.url"||zt.key==="http.target"||zt.key==="http.path");if(ht.length>0||Lt.length>0||rn.length>0)return{method:ht,status:Lt,url:rn}}return{}}const ze=(0,ce.memoize)(Ae,Mt=>Mt.length?Mt[0].traceID:0);var Ie=e(25985),xe=e(12308),Te=e(31783),Oe=e(66670);const ie=Mt=>({ActionButton:(0,t.css)` label: ActionButton; overflow: hidden; position: relative; &:after { content: ''; background: ${Mt.colors.primary.main}; display: block; position: absolute; right: 0; width: 100%; height: 100%; opacity: 0; transition: all 0.8s; } &:active:after { margin: 0; opacity: 0.3; transition: 0s; } `});function Le(Mt){const{onClick:Dt,ariaLabel:ht,label:Lt,icon:rn}=Mt,zt=(0,g.wW)(ie);return n.createElement(Oe.zx,{className:zt.ActionButton,size:"sm",variant:"secondary",fill:"outline",type:"button",icon:rn,"aria-label":ht,onClick:Dt},Lt)}const Be=Mt=>({TracePageActions:(0,t.css)` label: TracePageActions; display: flex; align-items: center; justify-content: center; gap: 4px; `,feedback:(0,t.css)` margin: 6px; color: ${Mt.colors.text.secondary}; font-size: ${Mt.typography.bodySmall.fontSize}; &:hover { color: ${Mt.colors.text.link}; } `});function Ue(Mt){const{traceId:Dt,data:ht,app:Lt}=Mt,rn=(0,g.l4)(),zt=Be(rn),[En,Tn]=(0,n.useState)(!1),An=()=>{navigator.clipboard.writeText(Dt),Tn(!0),setTimeout(()=>{Tn(!1)},5e3)},xn=()=>{const ia=(0,Te.gb)(ht,"Trace-"+Dt.substring(Dt.length-6));(0,i.ff)("grafana_traces_download_traces_clicked",{app:Lt,grafana_version:xe.config.buildInfo.version,trace_format:ia,location:"trace-view"})};return n.createElement("div",{className:zt.TracePageActions},n.createElement("a",{href:"https://forms.gle/RZDEx8ScyZNguDoC8",className:zt.feedback,title:"Share your thoughts about tracing in Grafana.",target:"_blank",rel:"noreferrer noopener"},n.createElement(se.J,{name:"comment-alt-message"})," Give feedback"),n.createElement(Le,{onClick:An,ariaLabel:"Copy Trace ID",label:En?"Copied!":"Trace ID",icon:"copy"}),n.createElement(Le,{onClick:xn,ariaLabel:"Export Trace",label:"Export",icon:"save"}))}var ue=e(37391),pe=e(81078),$e=e(76715),Se=e(41640),Ve=e(71107),He=e(48024),Ze=e(64022),Qe=e(28580),rt=e(71654),pt=e(24540),It=e(63568);const _t=(0,n.memo)(function(Dt){const{trace:ht,spanFilterMatches:Lt,setFocusedSpanIdForSearch:rn,focusedSpanIndexForSearch:zt,setFocusedSpanIndexForSearch:En,datasourceType:Tn,showSpanFilters:An}=Dt,xn=tn((0,g.l4)(),An);(0,n.useEffect)(()=>{if(Lt&&zt!==-1){const Jn=Array.from(Lt);rn(Jn[zt])}},[zt,rn,Lt]);const ia=(Jn,Ya)=>{if(Jn.preventDefault(),Jn.stopPropagation(),Ya){if((0,i.ff)("grafana_traces_trace_view_find_next_prev_clicked",{datasourceType:Tn,grafana_version:s.config.buildInfo.version,direction:"next"}),zt===-1||Lt&&zt===Lt.size-1){En(0);return}En(zt+1)}},oa=(Jn,Ya)=>{if(Jn.preventDefault(),Jn.stopPropagation(),Ya){if((0,i.ff)("grafana_traces_trace_view_find_next_prev_clicked",{datasourceType:Tn,grafana_version:s.config.buildInfo.version,direction:"prev"}),Lt&&(zt===-1||zt===0)){En(Lt.size-1);return}En(zt-1)}},_n=(Jn,Ya)=>{Jn.key==="Enter"&&ia(Jn,Ya)},sa=(Jn,Ya)=>{Jn.key==="Enter"&&oa(Jn,Ya)},ca=(Lt&&Lt?.size>0)??!1,jn=ca?xn.button:(0,t.cx)(xn.button,xn.buttonDisabled),ns=(0,n.useCallback)(Jn=>n.createElement(X.u,{content:Jn,placement:"top"},n.createElement("span",{className:xn.tooltip},n.createElement(se.J,{name:"info-circle",size:"md"}))),[xn.tooltip]),Ta=(0,n.useCallback)((Jn,Ya)=>{const xs=[],ss=[];let Xa=n.createElement(n.Fragment,null,n.createElement("span",null,`${ht.spans.length} spans`),ns(n.createElement(n.Fragment,null,n.createElement("div",null,"Services: ",Ya),n.createElement("div",null,"Depth: ",Jn))));if(Lt)if(Lt.forEach(Ps=>{ht.processes[Ps]&&(xs.push(ht.processes[Ps].serviceName),ss.push(ht.spans.find(hs=>hs.spanID===Ps)?.depth||0))}),Lt.size===0)Xa=n.createElement(n.Fragment,null,n.createElement("span",null,"0 matches"),ns("There are 0 span matches for the filters selected. Please try removing some of the selected filters."));else{const Ps=Lt.size===1?"match":"matches",hs=zt!==-1?`${zt+1}/${Lt.size} ${Ps}`:`${Lt.size} ${Ps}`;Xa=n.createElement(n.Fragment,null,n.createElement("span",null,hs),ns(n.createElement(n.Fragment,null,n.createElement("div",null,"Services: ",new Set(xs).size,"/",Ya),n.createElement("div",null,"Depth: ",new Set(ss).size,"/",Jn))))}return Xa},[zt,ns,Lt,ht.processes,ht.spans]),Ja=new Set((0,ce.values)(ht.processes).map(Jn=>Jn.serviceName)).size,ps=(0,ce.get)((0,ce.maxBy)(ht.spans,"depth"),"depth",0)+1;return n.createElement(n.Fragment,null,n.createElement("span",{className:xn.matches},Ta(ps,Ja)),n.createElement("div",{className:ca?xn.buttons:(0,t.cx)(xn.buttons,xn.buttonsDisabled)},n.createElement("div",{"aria-label":"Prev result button",className:jn,onClick:Jn=>oa(Jn,ca),onKeyDown:Jn=>sa(Jn,ca),role:"button",tabIndex:ca?0:-1},"Prev"),n.createElement("div",{"aria-label":"Next result button",className:jn,onClick:Jn=>ia(Jn,ca),onKeyDown:Jn=>_n(Jn,ca),role:"button",tabIndex:ca?0:-1},"Next")))}),tn=(Mt,Dt)=>{const ht=(0,Oe.fW)({theme:Mt,variant:"secondary",size:Dt?"md":"sm",iconOnly:!1,fill:"outline"});return{buttons:(0,t.css)` display: inline-flex; gap: 4px; `,buttonsDisabled:(0,t.css)` cursor: not-allowed; `,button:(0,t.css)` ${ht.button}; `,buttonDisabled:(0,t.css)` ${ht.disabled}; pointer-events: none; `,matches:(0,t.css)` margin-right: ${Mt.spacing(2)}; `,tooltip:(0,t.css)` color: #aaa; margin: 0 0 0 5px; `}};var qt=e(42074);function cn(Mt,Dt){if(!Dt)return;let ht=!1;Mt.serviceName&&(Dt=ft(Dt,Mt),ht=!0),Mt.spanName&&(Dt=Tt(Dt,Mt),ht=!0),(Mt.from||Mt.to)&&(Dt=Bt(Dt,Mt),ht=!0);const Lt=on(Dt,Mt.tags);return Lt&&(Dt=Lt,ht=!0),ht?new Set(Dt.map(rn=>rn.spanID)):void 0}const on=(Mt,Dt)=>{if(Dt=Dt.filter(ht=>ht.key&&ht.key!==""||ht.value),Dt.length>0)return Mt.filter(ht=>Dt.every(Lt=>{if(Lt.key&&Lt.value){if(ht.tags.some(rn=>Un(Lt,rn))||ht.process.tags.some(rn=>Un(Lt,rn))||ht.logs&&ht.logs.some(rn=>rn.fields.some(zt=>Un(Lt,zt)))||ht.kind&&Lt.key===It.TO&&Lt.value===ht.kind||ht.statusCode!==void 0&&Lt.key===It.Q_&&Lt.value===ue.Q[ht.statusCode].toLowerCase()||ht.statusMessage&&Lt.key===It.S2&&Lt.value===ht.statusMessage||ht.instrumentationLibraryName&&Lt.key===It.cG&&Lt.value===ht.instrumentationLibraryName||ht.instrumentationLibraryVersion&&Lt.key===It.gc&&Lt.value===ht.instrumentationLibraryVersion||ht.traceState&&Lt.key===It.vB&&Lt.value===ht.traceState||Lt.key===It.ID&&Lt.value===ht.spanID)return yt(Lt.operator,!0)}else if(Lt.key&&(ht.tags.some(rn=>ln(Lt.key,rn.key))||ht.process.tags.some(rn=>ln(Lt.key,rn.key))||ht.logs&&ht.logs.some(rn=>rn.fields.some(zt=>ln(Lt.key,zt.key)))||ht.kind&&Lt.key===It.TO||ht.statusCode!==void 0&&Lt.key===It.Q_||ht.statusMessage&&Lt.key===It.S2||ht.instrumentationLibraryName&&Lt.key===It.cG||ht.instrumentationLibraryVersion&&Lt.key===It.gc||ht.traceState&&Lt.key===It.vB||Lt.key===It.ID))return yt(Lt.operator,!0);return yt(Lt.operator,!1)}))},ln=(Mt,Dt)=>Mt===Dt.toString(),Un=(Mt,Dt)=>Mt.key===Dt.key.toString()&&Mt.value===Dt.value.toString(),yt=(Mt,Dt)=>Mt==="="?Dt:!Dt,ft=(Mt,Dt)=>Mt.filter(ht=>Dt.serviceNameOperator==="="?ht.process.serviceName===Dt.serviceName:ht.process.serviceName!==Dt.serviceName),Tt=(Mt,Dt)=>Mt.filter(ht=>Dt.spanNameOperator==="="?ht.operationName===Dt.spanName:ht.operationName!==Dt.spanName),Bt=(Mt,Dt)=>{const ht=Nt(Dt?.from||""),Lt=Nt(Dt?.to||"");let rn=[];if(ht&&(rn=Mt.filter(zt=>Dt.fromOperator===">"?zt.duration>ht:zt.duration>=ht)),Lt){const zt=En=>Dt.toOperator==="<"?En.duration<Lt:En.duration<=Lt;rn=rn.length>0?rn.filter(En=>zt(En)):Mt.filter(En=>zt(En))}return rn},Nt=Mt=>{if(Mt.includes("ns"))return parseFloat(Mt.split("ns")[0])/1e3;if(Mt.includes("us"))return parseFloat(Mt.split("us")[0]);if(Mt.includes("\xB5s"))return parseFloat(Mt.split("\xB5s")[0]);if(Mt.includes("ms"))return parseFloat(Mt.split("ms")[0])*1e3;if(Mt.includes("s"))return parseFloat(Mt.split("s")[0])*1e3*1e3;if(Mt.includes("m"))return parseFloat(Mt.split("m")[0])*1e3*1e3*60;if(Mt.includes("h"))return parseFloat(Mt.split("h")[0])*1e3*1e3*60*60},Ft=(0,n.memo)(function(Dt){const{trace:ht,search:Lt,spanFilterMatches:rn,showSpanFilterMatchesOnly:zt,setShowSpanFilterMatchesOnly:En,focusedSpanIndexForSearch:Tn,setFocusedSpanIndexForSearch:An,setFocusedSpanIdForSearch:xn,datasourceType:ia,clear:oa,showSpanFilters:_n}=Dt,sa=(0,g.wW)(Gt),ca=(0,n.useMemo)(()=>Lt.serviceName&&Lt.serviceName!==""||Lt.spanName&&Lt.spanName!==""||Nt(Lt.from||"")||Nt(Lt.to||"")||Lt.tags.length>1||Lt.tags.some(jn=>jn.key),[Lt.serviceName,Lt.spanName,Lt.from,Lt.to,Lt.tags]);return n.createElement("div",{className:sa.container},n.createElement("div",{className:sa.controls},n.createElement(n.Fragment,null,n.createElement("div",{className:sa.clearButton},n.createElement(Oe.zx,{variant:"destructive",disabled:!ca,type:"button",fill:"outline","aria-label":"Clear filters button",onClick:oa},"Clear"),n.createElement("div",{className:sa.matchesOnly},n.createElement(qt.r,{value:zt,onChange:jn=>En(jn.currentTarget.checked??!1),label:"Show matches only switch"}),n.createElement(Oe.zx,{onClick:()=>En(!zt),className:sa.clearMatchesButton,variant:"secondary",fill:"text"},"Show matches only"))),n.createElement("div",{className:sa.nextPrevResult},n.createElement(_t,{trace:ht,spanFilterMatches:rn,setFocusedSpanIdForSearch:xn,focusedSpanIndexForSearch:Tn,setFocusedSpanIndexForSearch:An,datasourceType:ia,showSpanFilters:_n})))))}),Gt=Mt=>{const Dt=(0,Oe.fW)({theme:Mt,variant:"secondary",size:"md",iconOnly:!1,fill:"outline"});return{button:(0,t.css)(Dt.button),buttonDisabled:(0,t.css)(Dt.disabled,{pointerEvents:"none",cursor:"not-allowed"}),container:(0,t.css)` display: inline; `,controls:(0,t.css)` display: flex; justify-content: flex-end; margin: 5px 0 0 0; `,clearButton:(0,t.css)` order: 1; `,matchesOnly:(0,t.css)` display: inline-flex; margin: 0 0 0 25px; vertical-align: middle; align-items: center; span { cursor: pointer; } `,clearMatchesButton:(0,t.css)` color: ${Mt.colors.text.primary}; &:hover { background: inherit; color: inherit; } `,nextPrevResult:(0,t.css)` margin-left: auto; order: 2; `}},dn=(0,n.memo)(Mt=>{const{trace:Dt,search:ht,setSearch:Lt,showSpanFilters:rn,setShowSpanFilters:zt,showSpanFilterMatchesOnly:En,setShowSpanFilterMatchesOnly:Tn,setFocusedSpanIdForSearch:An,spanFilterMatches:xn,datasourceType:ia}=Mt,oa={...(0,g.wW)(sn)},[_n,sa]=(0,n.useState)(),[ca,jn]=(0,n.useState)(),[ns,Ta]=(0,n.useState)(),[Ja,ps]=(0,n.useState)({}),[Jn,Ya]=(0,n.useState)(-1),xs=/^\d+(?:\.\d)?\d*(?:ns|us|µs|ms|s|m|h)$/,ss=(0,n.useCallback)(()=>{sa(void 0),jn(void 0),Ta(void 0),ps({}),Lt(pt.js)},[Lt]);if((0,n.useEffect)(()=>{ss()},[ss,Dt]),!Dt)return null;const Xa=kn=>{Ya(-1),An(""),Lt(kn)},Ps=()=>{if(!_n){const kn=Dt.spans.map(ya=>ya.process.serviceName);sa((0,ce.uniq)(kn).sort().map(pe.E))}},hs=()=>{if(!ca){const kn=Dt.spans.map(ya=>ya.operationName);jn((0,ce.uniq)(kn).sort().map(pe.E))}},qs=()=>{if(!ns){let kn=[],ya=[];Dt.spans.forEach(ma=>{ma.tags.forEach(Sa=>{kn.push(Sa.key)}),ma.process.tags.forEach(Sa=>{kn.push(Sa.key)}),ma.logs!==null&&ma.logs.forEach(Sa=>{Sa.fields.forEach(er=>{ya.push(er.key)})}),ma.kind&&kn.push(It.TO),ma.statusCode!==void 0&&kn.push(It.Q_),ma.statusMessage&&kn.push(It.S2),ma.instrumentationLibraryName&&kn.push(It.cG),ma.instrumentationLibraryVersion&&kn.push(It.gc),ma.traceState&&kn.push(It.vB),kn.push(It.ID)}),kn=(0,ce.uniq)(kn).sort(),ya=(0,ce.uniq)(ya).sort(),Ta([...kn,...ya].map(pe.E))}},Sr=async kn=>{const ya=[];return Dt.spans.forEach(ma=>{const Sa=ma.tags.find(ws=>ws.key===kn)?.value;Sa&&ya.push(Sa.toString());const er=ma.process.tags.find(ws=>ws.key===kn)?.value;switch(er&&ya.push(er.toString()),ma.logs!==null&&ma.logs.forEach(ws=>{const Za=ws.fields.find(jt=>jt.key===kn)?.value;Za&&ya.push(Za.toString())}),kn){case It.TO:ma.kind&&ya.push(ma.kind);break;case It.Q_:ma.statusCode!==void 0&&ya.push(ue.Q[ma.statusCode].toLowerCase());break;case It.S2:ma.statusMessage&&ya.push(ma.statusMessage);break;case It.cG:ma.instrumentationLibraryName&&ya.push(ma.instrumentationLibraryName);break;case It.gc:ma.instrumentationLibraryVersion&&ya.push(ma.instrumentationLibraryVersion);break;case It.vB:ma.traceState&&ya.push(ma.traceState);break;case It.ID:ya.push(ma.spanID);break;default:break}}),(0,ce.uniq)(ya).sort().map(pe.E)},Tr=(kn,ya)=>{Lt({...ht,tags:ht.tags?.map(Sa=>Sa.id===kn.id?{...Sa,key:ya?.value||"",value:void 0}:Sa)}),(async()=>{if(ya?.value)ps({...Ja,[kn.id]:await Sr(ya.value)});else{const Sa={...Ja};Sa[kn.id]&&delete Sa[kn.id],ps(Sa)}})()},lr=()=>{const kn={id:(0,pt.kb)(),operator:"="};Lt({...ht,tags:[...ht.tags,kn]})},cr=kn=>{let ya=ht.tags.filter(ma=>ma.id!==kn);ya.length===0&&(ya=[{id:(0,pt.kb)(),operator:"="}]),Lt({...ht,tags:ya})},Ds=n.createElement(n.Fragment,null,n.createElement(X.u,{content:"Filter your spans below. You can continue to apply filters until you have narrowed down your resulting spans to the select few you are most interested in.",placement:"right"},n.createElement("span",{className:oa.collapseLabel},"Span Filters",n.createElement(se.J,{size:"md",name:"info-circle"}))),!rn&&n.createElement("div",{className:oa.nextPrevResult},n.createElement(_t,{trace:Dt,spanFilterMatches:xn,setFocusedSpanIdForSearch:An,focusedSpanIndexForSearch:Jn,setFocusedSpanIndexForSearch:Ya,datasourceType:ia,showSpanFilters:rn})));return n.createElement("div",{className:oa.container},n.createElement(Se.U,{label:Ds,collapsible:!0,isOpen:rn,onToggle:zt},n.createElement(Ve.Z,null,n.createElement(He._,{label:"Service Name",labelWidth:16},n.createElement(Ze.Lh,{spacing:"xs"},n.createElement(Qe.Ph,{"aria-label":"Select service name operator",onChange:kn=>Xa({...ht,serviceNameOperator:kn.value}),options:[(0,pe.E)("="),(0,pe.E)("!=")],value:ht.serviceNameOperator}),n.createElement(Qe.Ph,{"aria-label":"Select service name",isClearable:!0,onChange:kn=>Xa({...ht,serviceName:kn?.value||""}),onOpenMenu:Ps,options:_n,placeholder:"All service names",value:ht.serviceName||null})))),n.createElement(Ve.Z,null,n.createElement(He._,{label:"Span Name",labelWidth:16},n.createElement(Ze.Lh,{spacing:"xs"},n.createElement(Qe.Ph,{"aria-label":"Select span name operator",onChange:kn=>Xa({...ht,spanNameOperator:kn.value}),options:[(0,pe.E)("="),(0,pe.E)("!=")],value:ht.spanNameOperator}),n.createElement(Qe.Ph,{"aria-label":"Select span name",isClearable:!0,onChange:kn=>Xa({...ht,spanName:kn?.value||""}),onOpenMenu:hs,options:ca,placeholder:"All span names",value:ht.spanName||null})))),n.createElement(Ve.Z,null,n.createElement(He._,{label:"Duration",labelWidth:16,tooltip:"Filter by duration. Accepted units are ns, us, ms, s, m, h"},n.createElement(Ze.Lh,{spacing:"xs",align:"flex-start"},n.createElement(Qe.Ph,{"aria-label":"Select min span operator",onChange:kn=>Xa({...ht,fromOperator:kn.value}),options:[(0,pe.E)(">"),(0,pe.E)(">=")],value:ht.fromOperator}),n.createElement("div",{className:oa.intervalInput},n.createElement(rt.w,{ariaLabel:"Select min span duration",onChange:kn=>Xa({...ht,from:kn}),isInvalidError:"Invalid duration",placeholder:"e.g. 100ms, 1.2s",width:18,value:ht.from||"",validationRegex:xs})),n.createElement(Qe.Ph,{"aria-label":"Select max span operator",onChange:kn=>Xa({...ht,toOperator:kn.value}),options:[(0,pe.E)("<"),(0,pe.E)("<=")],value:ht.toOperator}),n.createElement(rt.w,{ariaLabel:"Select max span duration",onChange:kn=>Xa({...ht,to:kn}),isInvalidError:"Invalid duration",placeholder:"e.g. 100ms, 1.2s",width:18,value:ht.to||"",validationRegex:xs})))),n.createElement(Ve.Z,{className:oa.tagsRow},n.createElement(He._,{label:"Tags",labelWidth:16,tooltip:"Filter by tags, process tags or log fields in your spans."},n.createElement("div",null,ht.tags.map((kn,ya)=>n.createElement("div",{key:ya},n.createElement(Ze.Lh,{spacing:"xs",width:"auto"},n.createElement(Qe.Ph,{"aria-label":"Select tag key",isClearable:!0,key:kn.key,onChange:ma=>Tr(kn,ma),onOpenMenu:qs,options:ns,placeholder:"Select tag",value:kn.key||null}),n.createElement(Qe.Ph,{"aria-label":"Select tag operator",onChange:ma=>{Xa({...ht,tags:ht.tags?.map(Sa=>Sa.id===kn.id?{...Sa,operator:ma.value}:Sa)})},options:[(0,pe.E)("="),(0,pe.E)("!=")],value:kn.operator}),n.createElement("span",{className:oa.tagValues},n.createElement(Qe.Ph,{"aria-label":"Select tag value",isClearable:!0,key:kn.value,onChange:ma=>{Xa({...ht,tags:ht.tags?.map(Sa=>Sa.id===kn.id?{...Sa,value:ma?.value||""}:Sa)})},options:Ja[kn.id]?Ja[kn.id]:[],placeholder:"Select value",value:kn.value})),n.createElement($e._,{"aria-label":"Remove tag",variant:"secondary",icon:"times",onClick:()=>cr(kn.id),title:"Remove tag"}),n.createElement("span",{className:oa.addTag},ht?.tags?.length&&ya===ht.tags.length-1&&n.createElement($e._,{"aria-label":"Add tag",variant:"secondary",icon:"plus",onClick:lr,title:"Add tag"})))))))),n.createElement(Ft,{trace:Dt,search:ht,spanFilterMatches:xn,showSpanFilterMatchesOnly:En,setShowSpanFilterMatchesOnly:Tn,setFocusedSpanIdForSearch:An,focusedSpanIndexForSearch:Jn,setFocusedSpanIndexForSearch:Ya,datasourceType:ia,clear:ss,showSpanFilters:rn})))});dn.displayName="SpanFilters";const sn=Mt=>({container:(0,t.css)` margin: 0.5em 0 -${Mt.spacing(1)} 0; z-index: 5; & > div { border-left: none; border-right: none; } `,collapseLabel:(0,t.css)` svg { color: #aaa; margin: -2px 0 0 10px; } `,addTag:(0,t.css)` margin: 0 0 0 10px; `,intervalInput:(0,t.css)` margin: 0 -4px 0 0; `,tagsRow:(0,t.css)` margin: -4px 0 0 0; `,tagValues:(0,t.css)` max-width: 200px; `,nextPrevResult:(0,t.css)` flex: 1; align-items: center; display: flex; justify-content: flex-end; margin-right: ${Mt.spacing(1)}; `}),Bn=(0,n.memo)(Mt=>{const{trace:Dt,data:ht,app:Lt,timeZone:rn,search:zt,setSearch:En,showSpanFilters:Tn,setShowSpanFilters:An,showSpanFilterMatchesOnly:xn,setShowSpanFilterMatchesOnly:ia,setFocusedSpanIdForSearch:oa,spanFilterMatches:_n,datasourceType:sa,setHeaderHeight:ca}=Mt,jn=(0,g.wW)(wt);(0,n.useEffect)(()=>{ca(document.querySelector("."+jn.header)?.scrollHeight??0)},[ca,Tn,jn.header]);const ns=(0,n.useMemo)(()=>Dt?it(Dt):[],[Dt]);if(!Dt)return null;const Ta=(ss,Xa)=>{const Ps=(0,Y.dq)(ss.startTime/1e3,{timeZone:Xa,defaultWithMS:!0}),hs=Ps.match(/^(.+)(:\d\d\.\d+)$/);return hs?n.createElement("span",{className:jn.TracePageHeaderOverviewItemValue},hs[1],n.createElement("span",{className:jn.TracePageHeaderOverviewItemValueDetail},hs[2])):Ps},Ja=n.createElement("h1",{className:y()(jn.title)},n.createElement(ye,{traceName:Ce(Dt.spans)}),n.createElement("small",{className:jn.duration},(0,Ie.LU)(Dt.duration))),{method:ps,status:Jn,url:Ya}=ze(Dt.spans);let xs="green";return Jn&&Jn.length>0&&(Jn[0].value.toString().charAt(0)==="4"?xs="orange":Jn[0].value.toString().charAt(0)==="5"&&(xs="red")),n.createElement("header",{className:jn.header},n.createElement("div",{className:jn.titleRow},ns&&ns.length>0&&n.createElement(q,{links:ns,className:jn.TracePageHeaderBack}),Ja,n.createElement(Ue,{traceId:Dt.traceID,data:ht,app:Lt})),n.createElement("div",{className:jn.subtitle},n.createElement("span",{className:jn.timestamp},Ta(Dt,rn)),n.createElement("span",{className:jn.tagMeta},ps&&ps.length>0&&n.createElement(X.u,{content:"http.method",interactive:!0},n.createElement("span",{className:jn.tag},n.createElement(Q.C,{text:ps[0].value,color:"blue"}))),Jn&&Jn.length>0&&n.createElement(X.u,{content:"http.status_code",interactive:!0},n.createElement("span",{className:jn.tag},n.createElement(Q.C,{text:Jn[0].value,color:xs}))),Ya&&Ya.length>0&&n.createElement(X.u,{content:"http.url or http.target or http.path",interactive:!0},n.createElement("span",{className:jn.url},Ya[0].value)))),n.createElement(dn,{trace:Dt,showSpanFilters:Tn,setShowSpanFilters:An,showSpanFilterMatchesOnly:xn,setShowSpanFilterMatchesOnly:ia,search:zt,setSearch:En,spanFilterMatches:_n,setFocusedSpanIdForSearch:oa,datasourceType:sa}))});Bn.displayName="TracePageHeader";const wt=Mt=>({TracePageHeaderBack:(0,t.css)` label: TracePageHeaderBack; align-items: center; align-self: stretch; background-color: #fafafa; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; color: inherit; display: flex; font-size: 1.4rem; padding: 0 1rem; margin-bottom: -1px; &:hover { background-color: #f0f0f0; border-color: #ccc; } `,TracePageHeaderOverviewItemValueDetail:y()((0,t.css)` label: TracePageHeaderOverviewItemValueDetail; color: #aaa; `,"trace-item-value-detail"),TracePageHeaderOverviewItemValue:(0,t.css)` label: TracePageHeaderOverviewItemValue; &:hover > .trace-item-value-detail { color: unset; } `,header:(0,t.css)` label: TracePageHeader; background-color: ${Mt.colors.background.primary}; padding: 0.5em 0 0 0; position: sticky; top: 0; z-index: 5; `,titleRow:(0,t.css)` align-items: flex-start; display: flex; padding: 0 8px; `,title:(0,t.css)` color: inherit; flex: 1; font-size: 1.7em; line-height: 1em; `,subtitle:(0,t.css)` flex: 1; line-height: 1em; margin: -0.5em 0.5em 0.75em 0.5em; `,tag:(0,t.css)` margin: 0 0.5em 0 0; `,duration:(0,t.css)` color: #aaa; margin: 0 0.75em; `,timestamp:(0,t.css)` vertical-align: middle; `,tagMeta:(0,t.css)` margin: 0 0.75em; vertical-align: text-top; `,url:(0,t.css)` margin: -2.5px 0.3em; height: 15px; overflow: hidden; word-break: break-all; line-height: 20px; `,TracePageHeaderTraceId:(0,t.css)` label: TracePageHeaderTraceId; white-space: nowrap; text-overflow: ellipsis; max-width: 30%; display: inline-block; `});var Vt=e(32042),Ht=e(66798);class Xt{constructor(Dt){const{isTagsOpen:ht,isProcessOpen:Lt,isReferencesOpen:rn,isWarningsOpen:zt,isStackTracesOpen:En,logs:Tn,references:An}=Dt||{};this.isTagsOpen=!!ht,this.isProcessOpen=!!Lt,this.isReferencesOpen=!!rn,this.isWarningsOpen=!!zt,this.isStackTracesOpen=!!En,this.logs={isOpen:!!(Tn&&Tn.isOpen),openedItems:Tn&&Tn.openedItems?new Set(Tn.openedItems):new Set},this.references={isOpen:!!(An&&An.isOpen),openedItems:An&&An.openedItems?new Set(An.openedItems):new Set}}toggleTags(){const Dt=new Xt(this);return Dt.isTagsOpen=!this.isTagsOpen,Dt}toggleProcess(){const Dt=new Xt(this);return Dt.isProcessOpen=!this.isProcessOpen,Dt}toggleReferences(){const Dt=new Xt(this);return Dt.references.isOpen=!this.references.isOpen,Dt}toggleReferenceItem(Dt){const ht=new Xt(this);return ht.references.openedItems.has(Dt)?ht.references.openedItems.delete(Dt):ht.references.openedItems.add(Dt),ht}toggleWarnings(){const Dt=new Xt(this);return Dt.isWarningsOpen=!this.isWarningsOpen,Dt}toggleStackTraces(){const Dt=new Xt(this);return Dt.isStackTracesOpen=!this.isStackTracesOpen,Dt}toggleLogs(){const Dt=new Xt(this);return Dt.logs.isOpen=!this.logs.isOpen,Dt}toggleLogItem(Dt){const ht=new Xt(this);return ht.logs.openedItems.has(Dt)?ht.logs.openedItems.delete(Dt):ht.logs.openedItems.add(Dt),ht}}var mn=e(75892);class pn{static iterFunction(Dt,ht=0){return Lt=>Dt(Lt.value,Lt,ht)}static searchFunction(Dt){return typeof Dt=="function"?Dt:(ht,Lt)=>Dt instanceof pn?Lt===Dt:ht===Dt}constructor(Dt,ht=[]){this.value=Dt,this.children=ht}get depth(){return this.children?.reduce((Dt,ht)=>Math.max(ht.depth+1,Dt),1)}get size(){let Dt=0;return this.walk(()=>Dt++),Dt}addChild(Dt){return this.children?.push(Dt instanceof pn?Dt:new pn(Dt)),this}find(Dt){if(pn.iterFunction(pn.searchFunction(Dt))(this))return this;for(let Lt=0;Lt<this.children.length;Lt++){const rn=this.children[Lt].find(Dt);if(rn)return rn}return null}getPath(Dt){const ht=pn.iterFunction(pn.searchFunction(Dt)),Lt=(rn,zt)=>{const En=zt.concat([rn]);if(ht(rn))return En;for(let Tn=0;Tn<rn.children.length;Tn++){const An=rn.children[Tn],xn=Lt(An,En);if(xn)return xn}return null};return Lt(this,[])}walk(Dt,ht=0){const Lt=[];let rn=ht;for(Lt.push({node:this,depth:rn});Lt.length;){const zt=Lt.pop();if(zt){const{node:En,depth:Tn}=zt;Dt(En.value,En,Tn),rn=(Tn||0)+1;let An=En.children.length-1;for(;An>=0;)Lt.push({node:En.children[An],depth:rn}),An--}}}}const Pn=Mt=>Mt.spanID,zn=Mt=>Mt.references||[],Hn=(0,mn.P1)((0,mn.P1)(({span:Mt})=>Mt,zn),({type:Mt})=>Mt,(Mt,Dt)=>Mt.find(ht=>ht.refType===Dt)),Ea=(0,mn.P1)(Mt=>Hn({span:Mt,type:"CHILD_OF"}),Mt=>Mt?Mt.spanID:null),aa=Mt=>Mt.spans,na=(0,mn.P1)(aa,Mt=>Mt.reduce((Dt,ht)=>Dt.set(Pn(ht),ht),new Map)),xa="__root__";function Ca(Mt){const Dt=new Map(Mt.spans.map(zt=>[zt.spanID,new pn(zt.spanID)])),ht=new Map(Mt.spans.map(zt=>[zt.spanID,zt])),Lt=new pn(xa);Mt.spans.forEach(zt=>{const En=Dt.get(zt.spanID);if(Array.isArray(zt.references)&&zt.references.length){const{refType:Tn,spanID:An}=zt.references[0];if(Tn==="CHILD_OF"||Tn==="FOLLOWS_FROM")(Dt.get(An)||Lt).children?.push(En);else throw new Error(`Unrecognized ref type: ${Tn}`)}else Lt.children.push(En)});const rn=(zt,En)=>{const Tn=zt?.value?ht.get(zt.value.toString()):void 0,An=En?.value?ht.get(En.value.toString()):void 0;return+(Tn?.startTime>An?.startTime)||+(Tn?.startTime===An?.startTime)-1};return Mt.spans.forEach(zt=>{const En=Dt.get(zt.spanID);En.children.length>1&&En?.children.sort(rn)}),Lt.children.sort(rn),Lt}const Ba=(0,mn.P1)(({spans:Mt})=>Mt,(0,mn.P1)(({trace:Mt})=>Mt,Ca),({collapsed:Mt})=>Mt,(Mt,Dt,ht)=>{const Lt=ht.reduce((rn,zt)=>(Dt.find(zt).walk(En=>En!==zt&&rn.add(En)),rn),new Set);return Lt.size>0?Mt.filter(rn=>!Lt.has(Pn(rn))):Mt});function ka(Mt){const Dt=new Map,ht=Mt.reduce((rn,zt)=>(rn.some(En=>En.key===zt.key&&En.value===zt.value)?Dt.set(`${zt.key}:${zt.value}`,`Duplicate tag "${zt.key}:${zt.value}"`):rn.push(zt),rn),[]),Lt=Array.from(Dt.values());return{dedupedTags:ht,warnings:Lt}}function Ua(Mt,Dt){const ht=Mt?.slice()??[],Lt=(Dt||[]).map(rn=>rn.toLowerCase());return ht.sort((rn,zt)=>{const En=rn.key.toLowerCase(),Tn=zt.key.toLowerCase();for(let An=0;An<Lt.length;An++){const xn=Lt[An];if(En.startsWith(xn)&&!Tn.startsWith(xn))return-1;if(!En.startsWith(xn)&&Tn.startsWith(xn))return 1}return En>Tn?1:En<Tn?-1:0}),ht}function $a(Mt){if(!Mt?.traceID)return null;const Dt=Mt.traceID.toLowerCase();let ht=0,Lt=Number.MAX_SAFE_INTEGER;const rn=new Map,zt=new Map;Mt.spans=Mt.spans.filter(_n=>!!_n.startTime),Mt.processes=Object.entries(Mt.processes).reduce((_n,[sa,ca])=>(_n[sa]={...ca,tags:Ua(ca.tags)},_n),{});const En=Mt.spans.length;for(let _n=0;_n<En;_n++){const sa=Mt.spans[_n],{startTime:ca,duration:jn,processID:ns}=sa;let Ta=sa.spanID;ca<Lt&&(Lt=ca),ca+jn>ht&&(ht=ca+jn);const Ja=rn.get(Ta);Ja!=null?(console.warn(`Dupe spanID, ${Ja+1} x ${Ta}`,sa,zt.get(Ta)),(0,ce.isEqual)(sa,zt.get(Ta))&&console.warn(" two spans with same ID have `isEqual(...) === true`"),rn.set(Ta,Ja+1),Ta=`${Ta}_${Ja}`,sa.spanID=Ta):rn.set(Ta,1),sa.process=Mt.processes[ns],zt.set(Ta,sa)}const Tn=Ca(Mt),An=[],xn={};Tn.walk((_n,sa,ca=0)=>{if(_n==="__root__"||typeof _n!="string")return;const jn=zt.get(_n);if(!jn)return;const{serviceName:ns}=jn.process;xn[ns]=(xn[ns]||0)+1,jn.relativeStartTime=jn.startTime-Lt,jn.depth=ca-1,jn.hasChildren=sa.children.length>0,jn.childSpanCount=sa.children.length,jn.warnings=jn.warnings||[],jn.tags=jn.tags||[],jn.references=jn.references||[];const Ta=ka(jn.tags);jn.tags=Ua(Ta.dedupedTags,we("topTagPrefixes")),jn.warnings=jn.warnings.concat(Ta.warnings),jn.references.forEach((Ja,ps)=>{const Jn=zt.get(Ja.spanID);Jn&&(Ja.span=Jn,ps>0&&(Jn.subsidiarilyReferencedBy=Jn.subsidiarilyReferencedBy||[],Jn.subsidiarilyReferencedBy.push({spanID:_n,traceID:Dt,span:jn,refType:Ja.refType})))}),An.push(jn)});const ia=Ce(An);return{services:Object.keys(xn).map(_n=>({name:_n,numberOfSpans:xn[_n]})),spans:An,traceID:Dt,traceName:ia,processes:Mt.processes,duration:ht-Lt,startTime:Lt,endTime:ht}}},32042:(j,I,e)=>{"use strict";e.d(I,{Hn:()=>c,Kg:()=>f,th:()=>p,vc:()=>h});var t=e(42844),n=e(27702),i=e(81078),s=e(17312),r=e(78102),g=e(66310),d=e(71107),l=e(48024),u=e(28580),o=e(1128),m=e(47449);const c="None",p="Duration",f="Tag";function E({options:v,onOptionsChange:D}){const a=(0,g.wW)(y),C=[c,p,f].map(i.E);return n.createElement("div",{className:(0,t.css)({width:"100%"})},n.createElement(d.Z,{className:a.row},n.createElement(l._,{label:"Label",labelWidth:26,tooltip:"Default: duration",grow:!0},n.createElement(u.Ph,{inputId:"label",options:C,value:v.jsonData.spanBar?.type||"",onChange:P=>{(0,s.tp)({onOptionsChange:D,options:v},"spanBar",{...v.jsonData.spanBar,type:P?.value??""})},placeholder:"Duration",isClearable:!0,"aria-label":"select-label-name",width:40}))),v.jsonData.spanBar?.type===f&&n.createElement(d.Z,{className:a.row},n.createElement(l._,{label:"Tag key",labelWidth:26,tooltip:"Tag key which will be used to get the tag value. A span's attributes and resources will be searched for the tag key"},n.createElement(o.I,{type:"text",placeholder:"Enter tag key",onChange:P=>(0,s.tp)({onOptionsChange:D,options:v},"spanBar",{...v.jsonData.spanBar,tag:P.currentTarget.value}),value:v.jsonData.spanBar?.tag||"",width:40}))))}const h=({options:v,onOptionsChange:D})=>n.createElement(r._,{title:"Span bar",description:n.createElement(m.W,{description:"Add additional info next to the service and operation on a span bar row in the trace view.",suffix:`${v.type}/#span-bar`,feature:"the span bar"})},n.createElement(E,{options:v,onOptionsChange:D})),y=v=>({infoText:(0,t.css)` label: infoText; padding-bottom: ${v.spacing(2)}; color: ${v.colors.text.secondary}; `,row:(0,t.css)` label: row; align-items: baseline; `})},66798:(j,I,e)=>{"use strict";e.d(I,{u:()=>t});var t=(n=>(n.Logs="log",n.Traces="trace",n.Metrics="metric",n.Unknown="unknown",n))(t||{})},90170:(j,I,e)=>{"use strict";e.d(I,{GL:()=>d,H3:()=>g,Im:()=>f,K9:()=>h,WW:()=>n,b$:()=>p,bi:()=>i,h2:()=>r,im:()=>s,oD:()=>l,ty:()=>E,xb:()=>c});var t=e(42844);const n=(0,t.css)` position: relative; `,i=(0,t.css)` margin-bottom: 0.25rem; `,s=(0,t.css)` margin-top: 0.25rem; margin-bottom: 0.25rem; `,r=(0,t.css)` margin: 0; `,g=(0,t.css)` padding-left: 0.5rem; padding-right: 0.5rem; `,d=(0,t.css)` padding-bottom: 0.5rem; `,l=(0,t.css)` display: flex; `,u=(0,t.css)` align-items: center; `,o=(0,t.css)` align-items: start; `,m=(0,t.css)` flex: 1 1 auto; min-width: 0; /* 1 */ min-height: 0; /* 1 */ `,c=(0,t.css)` text-align: right; `,p=(0,t.css)` display: inline-block; `,f=(0,t.css)` margin: -0.2rem 0.25rem 0 0; `,E=(0,t.css)` text-overflow: ellipsis; `,h=(0,t.css)` width: 100%; `,y=(0,t.css)` color: #aaa; `,v=(0,t.css)` justify-content: flex-end; `},8033:(j,I,e)=>{"use strict";e.d(I,{EUpdateTypes:()=>n,default:()=>r});var t=(g=>(g.DragEnd="DragEnd",g.DragMove="DragMove",g.DragStart="DragStart",g.MouseEnter="MouseEnter",g.MouseLeave="MouseLeave",g.MouseMove="MouseMove",g))(t||{});const n=t;var i=e(89949);const s=0;class r{constructor({getBounds:d,tag:l,resetBoundsOnResize:u=!0,...o}){this.resetBounds=()=>{this._bounds=void 0},this._handleMinorMouseEvent=m=>{const{button:c,clientX:p,type:f}=m;if(this._isDragging||c!==s)return;let E=null,h;if(f==="mouseenter")E=n.MouseEnter,h=this._onMouseEnter;else if(f==="mouseleave")E=n.MouseLeave,h=this._onMouseLeave;else if(f==="mousemove")E=n.MouseMove,h=this._onMouseMove;else throw new Error(`invalid event type: ${f}`);if(!h)return;const{value:y,x:v}=this._getPosition(p);h({event:m,type:E,value:y,x:v,manager:this,tag:this.tag})},this._handleDragEvent=m=>{const{button:c,clientX:p,type:f}=m;let E=null,h;if(f==="mousedown"){if(this._isDragging||c!==s)return;window.addEventListener("mousemove",this._handleDragEvent),window.addEventListener("mouseup",this._handleDragEvent);const D=(0,i.get)(document,"body.style");D&&(D.userSelect="none"),this._isDragging=!0,E=n.DragStart,h=this._onDragStart}else if(f==="mousemove"){if(!this._isDragging)return;E=n.DragMove,h=this._onDragMove}else if(f==="mouseup"){if(!this._isDragging)return;this._stopDragging(),E=n.DragEnd,h=this._onDragEnd}else throw new Error(`invalid event type: ${f}`);if(!h)return;const{value:y,x:v}=this._getPosition(p);h({event:m,type:E,value:y,x:v,manager:this,tag:this.tag})},this.handleMouseDown=this._handleDragEvent,this.handleMouseEnter=this._handleMinorMouseEvent,this.handleMouseMove=this._handleMinorMouseEvent,this.handleMouseLeave=this._handleMinorMouseEvent,this.getBounds=d,this.tag=l,this._isDragging=!1,this._bounds=void 0,this._resetBoundsOnResize=!!u,this._resetBoundsOnResize&&window.addEventListener("resize",this.resetBounds),this._onMouseEnter=o.onMouseEnter,this._onMouseLeave=o.onMouseLeave,this._onMouseMove=o.onMouseMove,this._onDragStart=o.onDragStart,this._onDragMove=o.onDragMove,this._onDragEnd=o.onDragEnd}_getBounds(){return this._bounds||(this._bounds=this.getBounds(this.tag)),this._bounds}_getPosition(d){const{clientXLeft:l,maxValue:u,minValue:o,width:m}=this._getBounds();let c=d-l,p=c/m;return o!=null&&p<o?(p=o,c=o*m):u!=null&&p>u&&(p=u,c=u*m),{value:p,x:c}}_stopDragging(){window.removeEventListener("mousemove",this._handleDragEvent),window.removeEventListener("mouseup",this._handleDragEvent);const d=(0,i.get)(document,"body.style");d&&(d.userSelect="auto"),this._isDragging=!1}isDragging(){return this._isDragging}dispose(){this._isDragging&&this._stopDragging(),this._resetBoundsOnResize&&window.removeEventListener("resize",this.resetBounds),this._bounds=void 0,this._onMouseEnter=void 0,this._onMouseLeave=void 0,this._onMouseMove=void 0,this._onDragStart=void 0,this._onDragMove=void 0,this._onDragEnd=void 0}}},84720:(j,I,e)=>{"use strict";e.d(I,{_K:()=>l,e6:()=>u});var t=e(82152),n=e(71685),i=e(5354);function s(m){if(m.length!==7)return[0,0,0];const c=m.slice(1,3),p=m.slice(3,5),f=m.slice(5);return[parseInt(c,16),parseInt(p,16),parseInt(f,16)]}class r{constructor(c,p){const f=o(c,p);this.colorsHex=f,this.colorsRgb=f.map(s),this.cache=new Map}_getColorIndex(c){let p=this.cache.get(c);if(p==null){const f=this.hashCode(c.toLowerCase());p=Math.abs(f%this.colorsHex.length);const E=Array.from(this.cache).pop();if(E&&E[1]){E[1]===p&&(p=this.getNextIndex(p));const h=this.colorsHex[E[1]];if(n.Z.readability(h,this.colorsHex[p])<1.5){let y=p;for(let v=0;v<this.colorsHex.length;v++)if(y=this.getNextIndex(y),n.Z.readability(h,this.colorsHex[y])>1.5){p=y;break}}}this.cache.set(c,p)}return p}getNextIndex(c){return c+1<this.colorsHex.length?c+1:0}hashCode(c){let p=0,f,E;for(f=0;f<c.length;f++)E=c.charCodeAt(f),p=(p<<5)-p+E;return p}getColorByKey(c){const p=this._getColorIndex(c);return this.colorsHex[p]}getRgbColorByKey(c){const p=this._getColorIndex(c);return this.colorsRgb[p]}clear(){this.cache.clear()}}const g=(0,t.Z)((m,c)=>new r(m,c));function d(m){g([],m)}function l(m,c){return g(i.O9,c).getColorByKey(m)}function u(m,c){return g(i.O9,c).getRgbColorByKey(m)}function o(m,c){const p=[...m],f=p.indexOf("#E24D42");f>-1&&p.splice(f,1);const E=m.indexOf("#BF1B00");E>-1&&p.splice(E,1);let h=[];for(const y of p)n.Z.readability(c.colors.background.primary,y)>=3&&h.push(y);return h}},25985:(j,I,e)=>{"use strict";e.d(I,{LU:()=>D});var t=e(89949),n=e.n(t),i=e(24588),s=e.n(i);const r="YYYY-MM-DD",g="HH:mm",d=1e3,l=1e3*d,u=60*l,o=60*u,m=24*o,c=Math.log10(d),p=[{unit:"d",microseconds:m,ofPrevious:24},{unit:"h",microseconds:o,ofPrevious:60},{unit:"m",microseconds:u,ofPrevious:60},{unit:"s",microseconds:l,ofPrevious:1e3},{unit:"ms",microseconds:d,ofPrevious:1e3},{unit:"\u03BCs",microseconds:1,ofPrevious:1e3}],f=(a,C,P)=>toFloatPrecision(a/P,C)*P;function E(a){return moment(a/d).format(r)}function h(a){return moment(a/d).format(g)}function y(a){const C=f(a,c,d);return`${moment.duration(C/d).asMilliseconds()}ms`}function v(a){const C=f(a,c,l);return`${moment.duration(C/d).asSeconds()}s`}function D(a){const[C,P]=(0,t.dropWhile)(p,({microseconds:x},O)=>O<p.length-1&&x>a);if(C.ofPrevious===1e3)return`${(0,t.round)(a/C.microseconds,2)}${C.unit}`;const M=`${Math.floor(a/C.microseconds)}${C.unit}`,T=Math.round(a/P.microseconds%C.ofPrevious),S=`${T}${P.unit}`;return T===0?M:`${M} ${S}`}},24540:(j,I,e)=>{"use strict";e.d(I,{Rx:()=>d,js:()=>g,kb:()=>s});var t=e(27702),n=e(66117),i=e(28382);const s=()=>(0,n.Z)().slice(0,12),g={spanNameOperator:"=",serviceNameOperator:"=",fromOperator:">",toOperator:"<",tags:[{id:s(),operator:"="}]};function d(l){const[u,o]=(0,t.useState)(g),m=(0,t.useMemo)(()=>l&&(0,i.filterSpans)(u,l),[u,l]);return{search:u,setSearch:o,spanFilterMatches:m}}},12361:(j,I,e)=>{"use strict";e.d(I,{N:()=>i});var t=e(27938),n=e(28382);function i(r){if(!r)return null;let g=r.fields.length===1?r.fields[0].values[0]:s(r);return(0,n.transformTraceData)(g)}function s(r){const g=new t.U(r),d={};for(let l=0;l<g.length;l++){const u=g.get(l);d[u.spanID]||(d[u.spanID]={serviceName:u.serviceName,tags:u.serviceTags})}return{traceID:g.get(0).traceID,processes:d,spans:g.toArray().map((l,u)=>{const o=[];return l.parentSpanID&&o.push({refType:"CHILD_OF",spanID:l.parentSpanID,traceID:l.traceID}),l.references&&o.push(...l.references.map(m=>({refType:"FOLLOWS_FROM",...m}))),{...l,duration:l.duration*1e3,startTime:l.startTime*1e3,processID:l.spanID,flags:0,references:o,logs:l.logs?.map(m=>({...m,timestamp:m.timestamp*1e3}))||[],dataFrameRowIndex:u}})}}},46181:(j,I,e)=>{"use strict";e.d(I,{U:()=>A});var t=e(89949),n=e(27702),i=e(46089),s=e(94469),r=e(86312),g=e(26129),d=e(34667),l=e(16310),u=e(22209),o=e(40705),m=e(63439),c=e(13741),p=e(66670),f=e(81290),E=e(91368),h=e(54195),y=e(18771),v=e(85378),D=e(45937),a=(V=>(V.FETCH_DASHBOARD="fetch-dashboard",V.SET_DASHBOARD_LS="set-dashboard-ls-error",V))(a||{});function C(){const V=(0,h.ZQ)();return V.dashboard.panels=[],V}async function P(V){const W=T(V.queries,V.queryResponse),w={targets:V.queries,type:W,title:"New Panel",gridPos:{x:0,y:0,w:12,h:8},datasource:V.datasource};let N;if(V.dashboardUid)try{N=await D.ae.getDashboardByUid(V.dashboardUid)}catch{throw"fetch-dashboard"}else N=C();N.dashboard.panels=[w,...N.dashboard.panels??[]];try{(0,h.$M)(N)}catch{throw"set-dashboard-ls-error"}}const b=V=>!V.hide,M=V=>W=>W.refId===V;function T(V,W){for(const{refId:w}of V.filter(b)){const N=M(w);if(W.flameGraphFrames.some(N))return"flamegraph";if(W.graphFrames.some(N))return"timeseries";if(W.logsFrames.some(N))return"logs";if(W.nodeGraphFrames.some(N))return"nodeGraph";if(W.traceFrames.some(N))return"traces";if(W.customFrames.some(N))return W.customFrames.find(N)?.meta?.preferredVisualisationPluginId??"table"}return"table"}var S=(V=>(V.NewDashboard="new-dashboard",V.ExistingDashboard="existing-dashboard",V))(S||{});function x(V){}function O(V){return V?`d/${V}`:"dashboard/new"}var B=(V=>(V.UNKNOWN="unknown-error",V.NAVIGATION="navigation-error",V))(B||{});function A(V){const{exploreId:W,onClose:w}=V,N=(0,y.useSelector)((0,v.F9)(W)),[F,k]=(0,n.useState)(),{handleSubmit:H,control:R,formState:{errors:_},watch:G}=(0,i.cI)({defaultValues:{saveTarget:"new-dashboard"}}),Y=E.contextSrv.hasAccess(y.AccessControlAction.DashboardsCreate,E.contextSrv.isEditor),X=E.contextSrv.hasAccess(y.AccessControlAction.DashboardsWrite,E.contextSrv.isEditor),Q=[];Y&&Q.push({label:"New dashboard",value:"new-dashboard"}),X&&Q.push({label:"Existing dashboard",value:"existing-dashboard"});const se=Q.length>1?G("saveTarget"):Q[0].value,Z=async(le,oe)=>{k(void 0);const q=oe.saveTarget==="existing-dashboard"?oe.dashboardUid:void 0;(0,r.ff)("e_2_d_submit",{newTab:le,saveTarget:oe.saveTarget,queries:N.queries.length});try{await P({dashboardUid:q,datasource:N.datasourceInstance?.getRef(),queries:N.queries,queryResponse:N.queryResponse})}catch(ae){switch(ae){case a.FETCH_DASHBOARD:k({error:ae,message:"Could not fetch dashboard information. Please try again."});break;case a.SET_DASHBOARD_LS:k({error:ae,message:"Could not add panel to dashboard. Please try again."});break;default:k({error:"unknown-error",message:"Something went wrong. Please try again."})}return}const ne=O(q);if(!le){w(),g.E1.push(s.u.stripBaseFromUrl(ne));return}if(!!!e.g.open(d.config.appUrl+ne,"_blank")){k({error:"navigation-error",message:"Could not navigate to the selected dashboard. Please try again."}),(0,h.f1)();return}w()};return(0,n.useEffect)(()=>{(0,r.ff)("e_2_d_open")},[]),n.createElement("form",null,Q.length>1&&n.createElement(l.g,{control:R,render:({field:{ref:le,...oe}})=>n.createElement(u.g,{label:"Target dashboard",description:"Choose where to add the panel."},n.createElement(o.S,{options:Q,...oe,id:"e2d-save-target"})),name:"saveTarget"}),se==="existing-dashboard"&&(()=>n.createElement(l.g,{render:({field:{ref:le,value:oe,onChange:q,...ne}})=>n.createElement(u.g,{label:"Dashboard",description:"Select in which dashboard the panel will be created.",error:_.dashboardUid?.message,invalid:!!_.dashboardUid},n.createElement(f.o,{...ne,inputId:"e2d-dashboard-picker",defaultOptions:!0,onChange:ge=>q(ge?.uid)})),control:R,name:"dashboardUid",shouldUnregister:!0,rules:{required:{value:!0,message:"This field is required."}}}))(),F&&n.createElement(m.b,{severity:"error",title:"Error adding the panel"},F.message),n.createElement(c.u.ButtonRow,null,n.createElement(p.zx,{type:"reset",onClick:w,fill:"outline",variant:"secondary"},"Cancel"),n.createElement(p.zx,{type:"submit",variant:"secondary",onClick:H((0,t.partial)(Z,!0)),icon:"external-link-alt"},"Open in new tab"),n.createElement(p.zx,{type:"submit",variant:"primary",onClick:H((0,t.partial)(Z,!1)),icon:"apps"},"Open dashboard")))}},80219:(j,I,e)=>{"use strict";e.d(I,{k:()=>i});var t=e(91368),n=e(18771);function i(){const s=t.contextSrv.hasAccess(n.AccessControlAction.DashboardsCreate,t.contextSrv.isEditor),r=t.contextSrv.hasAccess(n.AccessControlAction.DashboardsWrite,t.contextSrv.isEditor);return s&&!r?"Add panel to new dashboard":r&&!s?"Add panel to existing dashboard":"Add panel to dashboard"}},1185:(j,I,e)=>{"use strict";e.d(I,{eX:()=>p,zU:()=>c});var t=e(34099),n=e(86312),i=e(26862),s=e(89024),r=e(64077),g=e(22061),d=e(92662),l=e(9110),u=e(90274),o=e(96866);const m=(0,t.PH)("explore/updateDatasourceInstance");function c(f,E,h){return async(y,v)=>{const D=v().user.orgId,{history:a,instance:C}=await(0,o.r_)(D,E),P=v().explore.panes[f].datasourceInstance;(0,n.ff)("explore_change_ds",{from:(P?.meta?.mixed?"mixed":P?.type)||"unknown",to:C.meta.mixed?"mixed":C.type,exploreId:f}),y(m({exploreId:f,datasourceInstance:C,history:a}));const b=v().explore.panes[f].queries,M=(0,o.e1)(C.uid,b),T=await(0,r.r)(M);y((0,d.CL)({exploreId:f,correlations:T.correlations||[]})),h?.importQueries&&await y((0,l.GJ)(f,b,P,C)),v().explore.panes[f].isLive&&y((0,u.oz)({exploreId:f,refreshInterval:i.dP.offOption.value})),h?.importQueries&&y((0,l.aA)({exploreId:f}))}}const p=(f,E)=>{if(m.match(E)){const{datasourceInstance:h,history:y}=E.payload;return(0,s.RZ)(f.querySubscription),{...f,datasourceInstance:h,graphResult:null,tableResult:null,logsResult:null,supplementaryQueries:(0,g.DK)(),queryResponse:(0,o.lp)(),queryKeys:[],history:y}}return f}},92662:(j,I,e)=>{"use strict";e.d(I,{CK:()=>D,CL:()=>y,iz:()=>a,km:()=>f,qN:()=>v});var t=e(34099),n=e(89024),i=e(64077),s=e(6327),r=e(18771),g=e(1185),d=e(86744),l=e(29739),u=e(9110),o=e(90274),m=e(96866);const c=(0,t.PH)("explore/changeSize"),p=(0,t.PH)("explore/changePanels");function f(C,P,b){return async(M,T)=>{const S=T().explore.panes[C];if(S===void 0)return;const{panelsState:x}=S;M(p({exploreId:C,panelsState:{...x,[P]:b}}))}}const E=(0,t.PH)("explore/initializeExploreAction"),h=(0,t.PH)("explore/setUrlReplaced"),y=(0,t.PH)("explore/saveCorrelationsAction");function v(C,{width:P}){return c({exploreId:C,width:P})}const D=(0,r.createAsyncThunk)("explore/initializeExplore",async({exploreId:C,datasource:P,queries:b,range:M,panelsState:T},{dispatch:S,getState:x,fulfillWithValue:O})=>{let B,A=[];if(P){const V=x().user.orgId,W=await(0,m.r_)(V,P);B=W.instance,A=W.history}if(S(E({exploreId:C,queries:b,range:(0,m.rx)(M,(0,s.Z)(x().user)),datasourceInstance:B,history:A})),T!==void 0&&S(p({exploreId:C,panelsState:T})),S((0,o.b3)({exploreId:C})),B){const V=(0,m.e1)(B.uid,b),W=await(0,i.r)(V);S(y({exploreId:C,correlations:W.correlations||[]})),S((0,u.aA)({exploreId:C}))}return O({exploreId:C,state:x().explore.panes[C]})}),a=(C=(0,m.t5)(),P)=>{if(C=(0,u.Y)(C,P),C=(0,g.eX)(C,P),C=(0,o.ok)(C,P),C=(0,d.Oo)(C,P),l.ZU.match(P)){const{richHistory:b,total:M}=P.payload.richHistoryResults;return{...C,richHistory:b,richHistoryTotal:M}}if(l.Zy.match(P)){const b=P.payload.filters;return{...C,richHistorySearchFilters:b}}if(c.match(P)){const b=P.payload.width;return{...C,containerWidth:b}}if(p.match(P)){const{panelsState:b}=P.payload;return{...C,panelsState:b}}if(y.match(P))return{...C,correlations:P.payload.correlations};if(E.match(P)){const{queries:b,range:M,datasourceInstance:T,history:S}=P.payload;return{...C,range:M,queries:b,initialized:!0,queryKeys:(0,n.$$)(b),datasourceInstance:T,history:S,queryResponse:(0,m.lp)(),cache:[],correlations:[]}}return C}},86744:(j,I,e)=>{"use strict";e.d(I,{Cs:()=>h,Ff:()=>m,KZ:()=>D,NV:()=>c,Oo:()=>a,TV:()=>f,WY:()=>u,ch:()=>v,ev:()=>o,fM:()=>g,ik:()=>p,io:()=>E,sO:()=>y});var t=e(34099),n=e(87715),i=e(19889),s=e(29739),r=e(85378);const g=(0,t.PH)("explore/historyUpdated"),d=({updatedQuery:C,deletedId:P})=>async(b,M)=>{l(M().explore,(T,S)=>{const x=T.richHistory.map(B=>B.id===C?.id?C:B).filter(B=>B.id!==P),O=T.richHistory.length-x.length;b((0,s.ZU)({richHistoryResults:{richHistory:x,total:T.richHistoryTotal-O},exploreId:S}))})},l=(C,P)=>{Object.entries(C.panes).forEach(([b,M])=>{M&&P(M,b)})},u=(C,P,b)=>async(M,T)=>{const{richHistoryStorageFull:S,limitExceeded:x}=await(0,n.au)(C,P,b,!1,"",!T().explore.richHistoryStorageFull,!T().explore.richHistoryLimitExceededWarningShown);S&&M((0,s.fm)()),x&&M((0,s.QN)())},o=(C,P)=>async(b,M)=>{const T=await(0,n.VI)(C,P);b(d({updatedQuery:T}))},m=(C,P)=>async b=>{const M=await(0,n.gt)(C,P);b(d({updatedQuery:M}))},c=C=>async P=>{const b=await(0,n.y9)(C);P(d({deletedId:b}))},p=()=>async(C,P)=>{await(0,n.HK)(),(0,r.M)(P()).forEach(([b])=>{C((0,s.ZU)({richHistoryResults:{richHistory:[],total:0},exploreId:b})),C((0,s.ZU)({richHistoryResults:{richHistory:[],total:0},exploreId:b}))})},f=C=>async(P,b)=>{const M=b().explore.panes[C].richHistorySearchFilters;if(M){const T=await(0,n.ub)(M);P((0,s.ZU)({richHistoryResults:T,exploreId:C}))}},E=C=>async(P,b)=>{const M=b().explore.panes[C]?.richHistorySearchFilters,T=b().explore.panes[C]?.richHistory;if(M&&T){const S={...M,page:(M?.page||1)+1},x=await(0,n.ub)(S),O=[...T,...x.richHistory];P((0,s.Zy)({filters:S,exploreId:C})),P((0,s.ZU)({richHistoryResults:{richHistory:O,total:x.total},exploreId:C}))}},h=C=>async P=>{P((0,s.Zy)({filters:void 0,exploreId:C})),P((0,s.ZU)({richHistoryResults:{richHistory:[],total:0},exploreId:C}))},y=()=>async(C,P)=>{let b=P().explore.richHistorySettings;b||(b=await(0,n.di)(),C((0,s.e8)(b)))},v=C=>async P=>{P((0,s.e8)(C)),await(0,n.kg)(C)},D=(C,P)=>async(b,M)=>{await b((0,s.Zy)({exploreId:C,filters:{...P}}));const T=M().explore.richHistorySettings;(0,i.X)().lastUsedDataSourcesAvailable&&await b(v({...T,lastUsedDatasourceFilters:P.datasourceFilters}))},a=(C,P)=>g.match(P)?{...C,history:P.payload.history}:C},29739:(j,I,e)=>{"use strict";e.d(I,{AP:()=>h,QN:()=>m,Sx:()=>f,VY:()=>D,YV:()=>y,ZP:()=>S,ZU:()=>u,Zy:()=>p,bW:()=>a,e8:()=>c,fm:()=>o,m$:()=>P,nL:()=>E,tl:()=>l});var t=e(34099),n=e(26129),i=e(89024),s=e(18771),r=e(18886),g=e(92662),d=e(96866);const l=(0,t.PH)("explore/syncTimes"),u=(0,t.PH)("explore/richHistoryUpdated"),o=(0,t.PH)("explore/richHistoryStorageFullAction"),m=(0,t.PH)("explore/richHistoryLimitExceededAction"),c=(0,t.PH)("explore/richHistorySettingsUpdated"),p=(0,t.PH)("explore/richHistorySearchFiltersUpdatedAction"),f=(0,t.PH)("explore/splitSizeUpdateAction"),E=(0,t.PH)("explore/maximizePaneAction"),h=(0,t.PH)("explore/evenPaneResizeAction"),y=(0,t.PH)("explore/splitClose"),v=(0,t.PH)("explore/setPaneState"),D=(0,t.PH)("explore/clearPanes"),a=(0,s.createAsyncThunk)("explore/splitOpen",async(x,{getState:O,dispatch:B,requestId:A})=>{const V=Object.values(O().explore.panes)[0],W=x?.queries??(x?.query?[x?.query]:V?.queries||[]);Object.keys(O().explore.panes).forEach((w,N)=>{N>=1&&B(y(w))}),await B(C({exploreId:A,datasource:x?.datasourceUid||V?.datasourceInstance?.getRef(),queries:(0,r.Z)(W),range:x?.range||V?.range.raw||d.UI,panelsState:x?.panelsState||V?.panelsState}))},{idGenerator:i.z0}),C=(0,s.createAsyncThunk)("explore/createNewSplitOpen",async(x,{dispatch:O})=>{await O((0,g.CK)(x))}),P=(x,O)=>async B=>{const{getDataSourceSrv:A,getTimeSrv:V,getExploreUrl:W,openInNewWindow:w}=O,N=A(),F=await W({panel:x,datasourceSrv:N,timeSrv:V()});if(w&&F){w(F);return}n.E1.push(F)},b=(0,d.t5)(),M={syncedTimes:!1,panes:{},richHistoryStorageFull:!1,richHistoryLimitExceededWarningShown:!1,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0},S={explore:(x=M,O)=>{if(y.match(O)){const{[O.payload]:A,...V}={...x.panes};return{...x,panes:V,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0,syncedTimes:!1}}if(f.match(O)){const{largerExploreId:A}=O.payload;return{...x,largerExploreId:A,maxedExploreId:void 0,evenSplitPanes:A===void 0}}if(E.match(O)){const{exploreId:A}=O.payload;return{...x,largerExploreId:A,maxedExploreId:A,evenSplitPanes:!1}}if(h.match(O))return{...x,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0};if(l.match(O))return{...x,syncedTimes:O.payload.syncedTimes};if(o.match(O))return{...x,richHistoryStorageFull:!0};if(m.match(O))return{...x,richHistoryLimitExceededWarningShown:!0};if(c.match(O)){const A=O.payload;return{...x,richHistorySettings:A}}if(C.pending.match(O))return{...x,panes:{...x.panes,[O.meta.arg.exploreId]:b}};if(g.CK.pending.match(O)){const A=Object.entries(x.panes),V=A.slice(0,O.meta.arg.position),W=A.slice(V.length),w=[...V,[O.meta.arg.exploreId,b],...W].reduce((N,[F,k])=>({...N,[F]:k}),{});return{...x,panes:w}}if(D.match(O))return{...x,panes:{}};const B=O.payload?.exploreId;return typeof B=="string"?{...x,panes:Object.entries(x.panes).reduce((A,[V,W])=>({...A,[V]:V===B?(0,g.iz)(W,O):W}),{})}:x}}},9110:(j,I,e)=>{"use strict";e.d(I,{CS:()=>xt,K8:()=>ie,ci:()=>bt,qV:()=>it,LK:()=>Le,Sv:()=>Ke,GJ:()=>me,W1:()=>Be,sK:()=>Ee,Y:()=>ue,aA:()=>Ae,EA:()=>Oe,P4:()=>tt,$9:()=>ae,sQ:()=>be,KO:()=>Te,SE:()=>st,z0:()=>Ue});var t=e(34099),n=e(52131),i=e.n(n),s=e(89949),r=e(10409),g=e(45383),d=e(42250),l=e(48592),u=e(22479),o=e(44727),m=e(53933),c=e(69376),p=e(51451),f=e(68246),E=e(3935),h=e(32053),y=e(10864),v=e(86312),D=e(34667),a=e(89024),C=e(15476),P=e(64077),b=e(6327),M=e(32159),T=e(84749),S=e(18771),x=e(33877),O=e(73807),B=e(46809),A=e(39343),V=e(44885),W=e(61965),w=e(29241),N=e(30209),F=e(22833),k=e(59882);const H=Se=>{const Ve=[],He=[],Ze=[],Qe=[],rt=[],pt=[],It=[],_t=[];for(const tn of Se.series){if(Z(tn)){_t.push(tn);continue}switch(tn.meta?.preferredVisualisationType){case"logs":Qe.push(tn);break;case"graph":Ve.push(tn);break;case"trace":rt.push(tn);break;case"table":He.push(tn);break;case"rawPrometheus":Ze.push(tn);break;case"nodeGraph":pt.push(tn);break;case"flamegraph":It.push(tn);break;default:se(tn)&&Ve.push(tn),He.push(tn)}}return{...Se,graphFrames:Ve,tableFrames:He,logsFrames:Qe,traceFrames:rt,nodeGraphFrames:pt,customFrames:_t,flameGraphFrames:It,rawPrometheusFrames:Ze,graphResult:null,tableResult:null,logsResult:null,rawPrometheusResult:null}},R=({queries:Se,correlations:Ve})=>He=>{if(Se?.length&&Ve?.length){const Ze=(0,s.mapValues)((0,s.groupBy)(Se,"refId"),"0.datasource.uid");(0,P.n)(He.series,Ve,Ze)}return He},_=Se=>Se.graphFrames.length?{...Se,graphResult:Se.graphFrames}:{...Se,graphResult:null},G=Se=>{if(Se.tableFrames.length===0)return(0,g.of)({...Se,tableResult:null});Se.tableFrames.sort((Qe,rt)=>{const pt=Qe.refId,It=rt.refId;return pt>It?1:pt<It?-1:0});const Ve=Se.tableFrames.every(Qe=>se(Qe)),He={interpolate:Qe=>Qe};return(Ve?(0,g.of)(Se.tableFrames).pipe(V.Y.joinByFieldTransformer.operator({},He)):(0,g.of)(Se.tableFrames).pipe(V.Y.mergeTransformer.operator({},He))).pipe((0,A.U)(Qe=>{for(const rt of Qe)for(const pt of rt.fields)pt.display=pt.display??(0,W.U)({field:pt,theme:D.config.theme2,timeZone:Se.request?.timezone??"browser"});return{...Se,tableResult:Qe}}))},Y=Se=>{const Ve=Se.rawPrometheusFrames;if(!Ve||Ve.length===0)return(0,g.of)({...Se,tableResult:null});Ve.sort((rt,pt)=>{const It=rt.refId,_t=pt.refId;return It>_t?1:It<_t?-1:0});const He=Ve.every(rt=>se(rt)),Ze={interpolate:rt=>rt};return(He?(0,g.of)(Ve).pipe(V.Y.joinByFieldTransformer.operator({},Ze)):(0,g.of)(Ve).pipe(V.Y.mergeTransformer.operator({},Ze))).pipe((0,A.U)(rt=>{const pt=rt[0];for(const It of pt.fields)It.display=It.display??(0,W.U)({field:It,theme:D.config.theme2,timeZone:Se.request?.timezone??"browser"});return{...Se,rawPrometheusResult:pt}}))},X=(Se={})=>Ve=>{if(Ve.logsFrames.length===0)return{...Ve,logsResult:null};const He=Ve.request?.intervalMs,Ze=(0,N.aB)(Ve.logsFrames,He,Se.absoluteRange,Se.queries),Qe=(0,a.Oy)(Se.refreshInterval),rt=(0,F.j0)(Ze,Qe),pt=rt.rows,It=rt.series,_t={...rt,rows:pt,series:It};return{...Ve,logsResult:_t}};function Q(Se,Ve,He,Ze,Qe,rt){return(0,g.of)(Se).pipe((0,A.U)(pt=>(0,h.zR)(pt,Ve)),(0,A.U)(R({queries:Qe,correlations:rt})),(0,A.U)(H),(0,A.U)(_),(0,A.U)(X({absoluteRange:He,refreshInterval:Ze,queries:Qe})),(0,u.z)(Y),(0,u.z)(G))}function se(Se){const Ve=(0,s.groupBy)(Se.fields,He=>He.type);return!!(Object.keys(Ve).length===2&&Ve[w.fS.time]?.length===1&&Ve[w.fS.number])}function Z(Se){return Se.meta?.preferredVisualisationPluginId?(0,k.eD)(Se.meta?.preferredVisualisationPluginId):!1}var le=e(22061),oe=e(92662),q=e(86744),ne=e(90274),ge=e(96866);const ae=Se=>Ve=>{const He=Ve.explore.panes[Se];return He&&He.queryResponse?He.queryResponse.state===m.Gu.Loading||He.queryResponse.state===m.Gu.Streaming:!1},re=(0,t.PH)("explore/addQueryRow"),De=(0,t.PH)("explore/changeQueries"),he=(0,t.PH)("explore/cancelQueries"),ye=(0,t.PH)("explore/queriesImported"),ce=(0,t.PH)("explore/queryStoreSubscription"),We=(0,t.PH)("explore/setSupplementaryQueryEnabledAction"),ke=(0,t.PH)("explore/storeSupplementaryQueryDataProviderAction"),et=(0,t.PH)("explore/cleanSupplementaryQueryDataProviderAction"),we=(0,t.PH)("explore/cleanSupplementaryQueryAction"),_e=(0,t.PH)("explore/storeSupplementaryQueryDataSubscriptionAction"),Ge=(0,t.PH)("explore/updateSupplementaryQueryDataAction"),qe=(0,t.PH)("explore/queryStreamUpdated"),st=(0,t.PH)("explore/setQueries"),Me=(0,t.PH)("changeLoadingState"),be=(0,t.PH)("explore/setPausedState"),Ke=(0,t.PH)("explore/clearLogs"),Ye=(0,t.PH)("explore/scanStart"),tt=(0,t.PH)("explore/scanStop"),nt=(0,t.PH)("explore/addResultsToCache"),Pt=(0,t.PH)("explore/clearCache");function xt(Se,Ve){return async(He,Ze)=>{const Qe=Ze().explore.panes[Se];let rt;Qe.datasourceInstance?.meta.mixed?rt=(0,s.findLast)(Qe.queries,It=>!!It.datasource)?.datasource||void 0:rt=Qe.datasourceInstance?.getRef();const pt=await(0,a.Xk)(Qe.queries,Ve,rt);He(re({exploreId:Se,index:Ve,query:pt}))}}function bt(Se){return(Ve,He)=>{Ve(tt({exploreId:Se})),Ve(he({exploreId:Se}));const Ze=He().explore.panes[Se].supplementaryQueries;for(const Qe of le.SY)Ve(et({exploreId:Se,type:Qe})),Ze[Qe]?.data?.state!==m.Gu.Done&&Ve(we({exploreId:Se,type:Qe}))}}const Rt=(Se,Ve)=>{const He=Se.getRef();return Ve.map(Ze=>({...Ze,datasource:He}))},ct=async(Se,Ve,He)=>{let Ze=[];if(Ve.meta?.id===Se.meta?.id)Ze=He;else if((0,c.p)(Ve)&&(0,c.CZ)(Se)){const Qe=await Ve.exportToAbstractQueries(He);Ze=await Se.importFromAbstractQueries(Qe)}else Se.importQueries&&(Ze=await Se.importQueries(He,Ve));return Rt(Se,Ze)},it=(0,S.createAsyncThunk)("explore/changeQueries",async({queries:Se,exploreId:Ve},{getState:He,dispatch:Ze})=>{let Qe=!1;const rt=He().explore.panes[Ve].queries,pt=He().explore.panes[Ve].datasourceInstance?.uid;for(const It of Se)for(const _t of rt){if(It.refId===_t.refId&&It.datasource?.type!==_t.datasource?.type){const tn=await(0,y.F)().get(_t.datasource),qt=await(0,y.F)().get({uid:It.datasource?.uid});await Ze(me(Ve,rt,tn,qt,It.refId)),Qe=!0}if(pt===M.D&&It.refId===_t.refId&&It.datasource?.uid!==_t.datasource?.uid){const tn=(0,ge.e1)(M.D,Se),qt=await(0,P.r)(tn);Ze((0,oe.CL)({exploreId:Ve,correlations:qt.correlations||[]}))}}Qe||Ze(De({queries:Se,exploreId:Ve})),Se.length<rt.length&&Ze(Ae({exploreId:Ve}))}),me=(Se,Ve,He,Ze,Qe)=>async rt=>{if(!He){rt(ye({exploreId:Se,queries:Ve}));return}let pt=Ve;if(Ze.uid===M.D)pt=Ve.map(_t=>({..._t,datasource:He.getRef()}));else if(He.uid===M.D){const _t=(0,s.groupBy)(Ve,qt=>qt.datasource?.uid),tn=await Promise.all(Object.keys(_t).map(async qt=>{const cn=await(0,y.F)().get({uid:qt});return await ct(Ze,cn,_t[qt])}));pt=(0,s.flatten)(tn.filter(qt=>qt.length>0))}else{let _t=Ve;if(Qe!==void 0){const tn=Ve.find(qt=>qt.refId===Qe);tn&&(_t=[tn])}pt=await ct(Ze,He,_t)}let It=await(0,a.Z8)(pt,Ze.getRef());if(Qe!==void 0){pt.length===0&&(pt=[await(0,a.Xk)([],void 0,Ze.getRef())]);const _t=Ve.findIndex(qt=>qt.refId===Qe),tn={...It[0],refId:Ve[_t].refId};It=[...Ve],It[_t]=tn}return rt(ye({exploreId:Se,queries:It})),It};function Ee(Se,Ve,He){return async(Ze,Qe)=>{const rt=Qe().explore.panes[Se],{queries:pt}=rt,_t=(await Promise.all(pt.map(tn=>He({...tn},Ve)))).map((tn,qt)=>(0,a.fR)(tn,pt,qt));Ze(st({exploreId:Se,queries:_t})),Ve.preventSubmit||Ze(Ae({exploreId:Se}))}}async function Ce(Se,Ve,He,Ze,Qe,rt){const pt=Ze.meta.id,It=(0,a._Q)(He,pt,Qe);Se((0,q.fM)({exploreId:rt,history:It})),Se((0,q.WY)(Ze.uid,Ze.name,Qe));for(const _t in Ve.panes)await Se((0,q.TV)(_t))}const Ae=(0,S.createAsyncThunk)("explore/runQueries",async({exploreId:Se,preserveCache:Ve},{dispatch:He,getState:Ze})=>{He((0,ne.b3)({exploreId:Se}));const Qe=pe(Se);Ve!==!0&&He(Le(Se));const rt=Ze().explore.panes[Se],{datasourceInstance:pt,containerWidth:It,isLive:_t,range:tn,scanning:qt,queryResponse:cn,querySubscription:on,refreshInterval:ln,absoluteRange:Un,cache:yt,supplementaryQueries:ft}=rt;let Tt,Bt;const Nt=rt.queries.map(Gt=>({...Gt,datasource:Gt.datasource||pt?.getRef()}));pt!=null&&Ce(He,Ze().explore,rt.history,pt,Nt,Se);const Ft=(0,ge.M0)(yt,Un);if(Ft)Tt=(0,r.a)([(0,g.of)(Ft),Qe]).pipe((0,u.z)(([Gt,dn])=>Q(Gt,cn,Un,ln,Nt,dn))),Bt=Tt.subscribe(Gt=>{He(qe({exploreId:Se,response:Gt}))});else{if(!(0,a.z_)(Nt)||!pt)return;const Gt=pt?.interval;(0,a.RZ)(on);const dn={minInterval:Gt,maxDataPoints:It,liveStreaming:_t},sn=(0,b.Z)(Ze().user),Bn=(0,a.Zf)(Se,Nt,dn,tn,qt,sn);if(He(Me({exploreId:Se,loadingState:m.Gu.Loading})),Tt=(0,r.a)([(0,B.v7)(pt,Bn.request).pipe(_t?(0,o.p)(500):d.y),Qe]).pipe((0,u.z)(([wt,Vt])=>Q(wt,cn,Un,ln,Nt,Vt))),Bt=Tt.subscribe({next(wt){if(wt.logsResult!==null&&(0,v.ff)("grafana_explore_logs_result_displayed",{datasourceType:pt.type}),He(qe({exploreId:Se,response:wt})),Ze().explore.panes[Se].scanning)if(wt.state===m.Gu.Done&&wt.series.length===0){const Vt=(0,C.e)(-1,Ze().explore.panes[Se].range);He((0,ne.b3)({exploreId:Se,absoluteRange:Vt})),He(Ae({exploreId:Se}))}else He(tt({exploreId:Se}))},error(wt){He((0,x.$l)((0,O.t_)("Query processing error",wt))),He(Me({exploreId:Se,loadingState:m.Gu.Error})),console.error(wt)},complete(){Ze().explore.panes[Se].queryResponse.state===m.Gu.Loading&&He(Me({exploreId:Se,loadingState:m.Gu.Done}))}}),_t)for(const wt of le.SY)He(et({exploreId:Se,type:wt})),He(we({exploreId:Se,type:wt}));else He(Ie({exploreId:Se,datasourceInstance:pt,transaction:Bn,newQuerySource:Tt,supplementaryQueries:ft,queries:Nt,absoluteRange:Un}))}He(ce({exploreId:Se,querySubscription:Bt}))}),ze=async(Se,Ve)=>{const He=Se.filter(Qe=>Qe.datasource?.uid!==M.D),Ze=(0,s.groupBy)(He,"datasource.uid");return await Promise.all(Object.values(Ze).map(async Qe=>({datasource:await(0,y.F)().get(Qe[0].datasource,Ve),targets:Qe})))},Ie=(0,S.createAsyncThunk)("explore/handleSupplementaryQueries",async({datasourceInstance:Se,exploreId:Ve,transaction:He,newQuerySource:Ze,supplementaryQueries:Qe,queries:rt,absoluteRange:pt},{dispatch:It})=>{let _t;Se.meta.mixed?_t=await ze(He.request.targets,He.request.scopedVars):_t=[{datasource:Se,targets:He.request.targets}];for(const tn of le.SY){const qt=(0,le.Z9)(_t,tn,{...He.request,requestId:`${He.request.requestId}_${(0,s.snakeCase)(tn)}`},Ze);qt?(It(ke({exploreId:Ve,type:tn,dataProvider:qt})),xe(Qe[tn].data,rt,pt)||(It(we({exploreId:Ve,type:tn})),Qe[tn].enabled&&It(Be(Ve,tn)))):It(et({exploreId:Ve,type:tn}))}});function xe(Se,Ve,He){if(!Se)return!1;const Ze=(0,s.zipObject)((0,s.map)(Ve,"refId"),Ve),Qe=(0,s.mapValues)((0,s.groupBy)(Se.data.map(_t=>_t.meta?.custom?.sourceQuery),"refId"),s.head),rt=Se.data.every(_t=>_t.meta?.custom?.logsVolumeType===p.o8.FullRange),pt=i()(Ze,Qe),It=Se.data.every(_t=>{const tn=_t.meta?.custom?.absoluteRange;return tn?tn&&tn.from<=He.from&&He.to<=tn.to:!0});return rt&&pt&&It}function Te(Se,Ve){return(He,Ze)=>{const Qe=Ze().explore.panes[Se].queries,rt=Ve.map((pt,It)=>(0,a.fR)(pt,Qe,It));He(st({exploreId:Se,queries:rt})),He(Ae({exploreId:Se}))}}function Oe(Se){return(Ve,He)=>{Ve(Ye({exploreId:Se}));const Ze=(0,C.e)(-1,He().explore.panes[Se].range);Ve((0,ne.b3)({exploreId:Se,absoluteRange:Ze})),Ve(Ae({exploreId:Se}))}}function ie(Se){return(Ve,He)=>{const Ze=He().explore.panes[Se].queryResponse,Qe=He().explore.panes[Se].absoluteRange,rt=(0,ge.M7)(Qe);Ze.state===m.Gu.Done&&Ve(nt({exploreId:Se,cacheKey:rt,queryResponse:Ze}))}}function Le(Se){return(Ve,He)=>{Ve(Pt({exploreId:Se}))}}function Be(Se,Ve){return(He,Ze)=>{const{supplementaryQueries:Qe}=Ze().explore.panes[Se],rt=Qe[Ve].dataProvider;if(rt){const pt=rt.subscribe({next:It=>{He(Ge({exploreId:Se,type:Ve,data:It}))}});He(_e({exploreId:Se,type:Ve,dataSubscription:pt}))}}}function Ue(Se,Ve,He){return(Ze,Qe)=>{Ze(We({exploreId:Se,enabled:Ve,type:He})),(0,le.B9)(Ve,He),Ve&&Ze(Be(Se,He))}}const ue=(Se,Ve)=>{if(re.match(Ve)){const{queries:He}=Se,{index:Ze,query:Qe}=Ve.payload,rt=[...He.slice(0,Ze+1),{...Qe},...He.slice(Ze+1)];return{...Se,queries:rt,queryKeys:(0,a.$$)(rt)}}if(De.match(Ve)){const{queries:He}=Ve.payload;return{...Se,queries:He}}if(he.match(Ve))return(0,a.RZ)(Se.querySubscription),{...Se,queryResponse:{...Se.queryResponse,state:m.Gu.Done}};if(st.match(Ve)){const{queries:He}=Ve.payload;return{...Se,queries:He.slice(),queryKeys:(0,a.$$)(He)}}if(ce.match(Ve)){const{querySubscription:He}=Ve.payload;return{...Se,querySubscription:He}}if(We.match(Ve)){const{enabled:He,type:Ze}=Ve.payload,{supplementaryQueries:Qe}=Se,rt=Qe[Ze].dataSubscription;!He&&rt&&rt.unsubscribe();const pt={...Qe,[Ze]:{...Qe[Ze],enabled:He,data:void 0}};return{...Se,supplementaryQueries:pt}}if(ke.match(Ve)){const{dataProvider:He,type:Ze}=Ve.payload,{supplementaryQueries:Qe}=Se,rt=Qe[Ze];rt?.dataSubscription&&rt.dataSubscription.unsubscribe();const pt={...Qe,[Ze]:{...rt,dataProvider:He,dataSubscription:void 0}};return{...Se,supplementaryQueries:pt}}if(et.match(Ve)){const{type:He}=Ve.payload,{supplementaryQueries:Ze}=Se,Qe=Ze[He];Qe?.dataSubscription&&Qe.dataSubscription.unsubscribe();const rt={...Ze,[He]:{...Qe,dataProvider:void 0,dataSubscription:void 0}};return{...Se,supplementaryQueries:rt}}if(we.match(Ve)){const{type:He}=Ve.payload,{supplementaryQueries:Ze}=Se,Qe={...Ze,[He]:{...Ze[He],data:void 0}};return{...Se,supplementaryQueries:Qe}}if(_e.match(Ve)){const{dataSubscription:He,type:Ze}=Ve.payload,{supplementaryQueries:Qe}=Se,rt={...Qe,[Ze]:{...Qe[Ze],dataSubscription:He}};return{...Se,supplementaryQueries:rt}}if(Ge.match(Ve)){let{data:He,type:Ze}=Ve.payload;const{supplementaryQueries:Qe}=Se,rt={...Qe,[Ze]:{...Qe[Ze],data:He}};return{...Se,supplementaryQueries:rt}}if(qe.match(Ve))return $e(Se,Ve);if(ye.match(Ve)){const{queries:He}=Ve.payload;return{...Se,queries:He,queryKeys:(0,a.$$)(He)}}if(Me.match(Ve)){const{loadingState:He}=Ve.payload;return{...Se,queryResponse:{...Se.queryResponse,state:He}}}if(be.match(Ve)){const{isPaused:He}=Ve.payload;return{...Se,isPaused:He}}if(Ye.match(Ve))return{...Se,scanning:!0};if(tt.match(Ve))return{...Se,scanning:!1,scanRange:void 0};if(nt.match(Ve)){const{cache:Ze}=Se,{queryResponse:Qe,cacheKey:rt}=Ve.payload;let pt=[...Ze];return pt.some(_t=>_t.key===rt)||(pt=[{key:rt,value:Qe},...pt].slice(0,5)),{...Se,cache:pt}}if(Pt.match(Ve))return{...Se,cache:[]};if(Ke.match(Ve)){if(!Se.logsResult)return{...Se,clearedAtIndex:null};if(Se.queryResponse.state===m.Gu.Loading)return{...Se,clearedAtIndex:null,logsResult:{...Se.logsResult,rows:[]}};const He=Se.clearedAtIndex?Se.clearedAtIndex+Se.logsResult.rows.length:Se.logsResult.rows.length-1;return{...Se,clearedAtIndex:He,logsResult:{...Se.logsResult,rows:[]}}}return Se},pe=Se=>new l.y(Ve=>{const He=T.h.getState().explore.panes[Se]?.correlations;if(He)Ve.next(He),Ve.complete();else{const Ze=T.h.subscribe(()=>{const Qe=T.h.getState().explore.panes[Se]?.correlations;Qe&&(Ze(),Ve.next(Qe),Ve.complete())})}}),$e=(Se,Ve)=>{const{response:He}=Ve.payload,{request:Ze,series:Qe,error:rt,graphResult:pt,logsResult:It,tableResult:_t,rawPrometheusResult:tn,traceFrames:qt,nodeGraphFrames:cn,flameGraphFrames:on,rawPrometheusFrames:ln,customFrames:Un}=He;if(rt){if(rt.type===f.eA.Timeout||rt.type===f.eA.Cancelled)return{...Se};D.config.angularSupportEnabled&&Se.datasourceInstance?.components?.QueryCtrl&&Se.eventBridge.emit(E.Kh.dataError,rt)}if(!Ze)return{...Se};if(D.config.angularSupportEnabled&&Se.datasourceInstance?.components?.QueryCtrl){const yt=Qe.map(ft=>(0,h.Zr)(ft));Se.eventBridge.emit(E.Kh.dataReceived,yt)}return{...Se,queryResponse:He,graphResult:pt,tableResult:_t,rawPrometheusResult:tn,logsResult:Se.isLive&&It?{...It,rows:(0,ge.bG)(Se.clearedAtIndex,It.rows)}:It,showLogs:!!It,showMetrics:!!pt,showTable:!!_t?.length,showTrace:!!qt.length,showNodeGraph:!!cn.length,showRawPrometheus:!!ln.length,showFlameGraph:!!on.length,showCustom:!!Un?.length,clearedAtIndex:Se.isLive?Se.clearedAtIndex:null}}},85378:(j,I,e)=>{"use strict";e.d(I,{F9:()=>r,Ky:()=>n,M:()=>i,pd:()=>s});var t=e(75892);const n=g=>g.explore.panes,i=(0,t.P1)(n,Object.entries),s=(0,t.P1)(i,g=>g.length>1),r=g=>(0,t.P1)(n,d=>d[g])},90274:(j,I,e)=>{"use strict";e.d(I,{F9:()=>y,b3:()=>E,cD:()=>f,mG:()=>h,oW:()=>c,ok:()=>v,oz:()=>p});var t=e(34099),n=e(99633),i=e(53933),s=e(39317),r=e(26862),g=e(89024),d=e(22833),l=e(6327),u=e(26858),o=e(29739),m=e(9110);const c=(0,t.PH)("explore/changeRange"),p=(0,t.PH)("explore/changeRefreshInterval"),f=D=>(a,C)=>{const{syncedTimes:P}=C().explore;P?Object.keys(C().explore.panes).forEach(b=>{a(E({...D,exploreId:b})),a((0,m.aA)({exploreId:b,preserveCache:!0}))}):(a(E({...D})),a((0,m.aA)({exploreId:D.exploreId,preserveCache:!0})))},E=D=>(a,C)=>{const{exploreId:P,absoluteRange:b,rawRange:M}=D,T=C().explore.panes[P],S=(0,l.Z)(C().user),x=(0,l.i)(C().user),{range:O}=T;let B=O.raw;b&&(B={from:(0,n.GY)(S,b.from),to:(0,n.GY)(S,b.to)}),M&&(B=M);const A=(0,g.OQ)(S,B,x),V={from:A.from.valueOf(),to:A.to.valueOf()},W={time:A.raw,refresh:!1,timepicker:{},getTimezone:()=>S,timeRangeUpdated:w=>{a(f({exploreId:P,rawRange:w}))}};(0,u.$t)().init(W),(0,s.J)().updateTimeRange((0,u.$t)().timeRange()),a(c({exploreId:P,range:A,absoluteRange:V}))};function h(D){return(a,C)=>{const P=C().explore.panes[D].range.raw;Object.keys(C().explore.panes).filter(M=>M!==D).forEach(M=>{a(f({exploreId:M,rawRange:P}))});const b=C().explore.syncedTimes;a((0,o.tl)({syncedTimes:!b}))}}function y(){return(D,a)=>{const C=(0,l.Z)(a().user),P=(0,l.i)(a().user);Object.entries(a().explore.panes).forEach(([b,M])=>{const T=(0,g.OQ)(C,M.range.raw,P),S={from:T.from.valueOf(),to:T.to.valueOf()};D(E({exploreId:b,absoluteRange:S}))})}}const v=(D,a)=>{if(p.match(a)){const{refreshInterval:C}=a.payload,P=r.dP.isLive(C),b=(0,g.Oy)(C),M=(0,d.j0)(D.logsResult,b);return r.dP.isLive(D.refreshInterval)&&!P&&(0,g.RZ)(D.querySubscription),{...D,refreshInterval:C,queryResponse:{...D.queryResponse,state:P?i.Gu.Streaming:i.Gu.Done},isLive:P,isPaused:P?!1:D.isPaused,logsResult:M}}if(c.match(a)){const{range:C,absoluteRange:P}=a.payload;return{...D,range:C,absoluteRange:P}}return D}},96866:(j,I,e)=>{"use strict";e.d(I,{FG:()=>f,Jt:()=>P,M0:()=>D,M7:()=>v,UI:()=>c,bG:()=>M,dc:()=>C,e1:()=>T,lp:()=>h,r_:()=>y,rx:()=>a,t5:()=>E});var t=e(89949),n=e.n(t),i=e(53933),s=e(8508),r=e(1726),g=e(99633),d=e(32159),l=e(56812),u=e(89024),o=e(5926),m=e(22061);const c={from:"now-6h",to:"now"},p="grafana.explore.style.graph",f=S=>{l.Z.set(p,S)},E=()=>({containerWidth:0,datasourceInstance:null,history:[],queries:[],initialized:!1,range:{from:null,to:null,raw:c},absoluteRange:{from:null,to:null},scanning:!1,queryKeys:[],isLive:!1,isPaused:!1,queryResponse:h(),tableResult:null,graphResult:null,logsResult:null,clearedAtIndex:null,rawPrometheusResult:null,eventBridge:null,cache:[],richHistory:[],supplementaryQueries:(0,m.DK)(),panelsState:{},correlations:void 0}),h=()=>({state:i.Gu.NotStarted,series:[],timeRange:(0,s.JK)(),graphFrames:[],logsFrames:[],traceFrames:[],nodeGraphFrames:[],flameGraphFrames:[],customFrames:[],tableFrames:[],rawPrometheusFrames:[],rawPrometheusResult:null,graphResult:null,logsResult:null,tableResult:null});async function y(S,x){let O;try{O=await(0,o.ak)().get(x)}catch{O=await(0,o.ak)().get()}if(O.init)try{O.init()}catch(V){console.error(V)}const B=`grafana.explore.history.${O.meta?.id}`,A=l.Z.getObject(B,[]);return(0,u.ET)(S,O.uid),{history:A,instance:O}}function v(S){const x={from:S.from,to:S.to};return Object.entries(x).map(([B,A])=>`${encodeURIComponent(B)}=${encodeURIComponent(A.toString())}`).join("&")}function D(S,x){const O=v(x),B=S.findIndex(V=>V.key===O);return B>=0?S[B].value:void 0}function a(S,x){const O={from:b(S.from),to:b(S.to)};return{from:r.parse(O.from,!1,x),to:r.parse(O.to,!0,x),raw:O}}function C(S){let x=c,O={from:b(S.from),to:b(S.to)};return O.from!==null&&O.to!==null&&(x={from:O.from,to:O.to}),x}const P=S=>{let x=S.from;(0,g.v9)(x)&&(x=x.valueOf().toString());let O=S.to;return(0,g.v9)(O)&&(O=O.valueOf().toString()),{from:x,to:O}};function b(S){if(S===null)return null;if((0,g.v9)(S)||S.indexOf("now")!==-1)return S;if(S.length===8)return(0,g.zh)(S,"YYYYMMDD");if(S.length===15)return(0,g.zh)(S,"YYYYMMDDTHHmmss");if(S.length===19)return(0,g.zh)(S,"YYYY-MM-DD HH:mm:ss");if(S.match(/^\d+$/)){const O=parseInt(S,10);return(0,g.zh)(O)}const x=(0,g.zh)(S);return x.isValid()?x:null}const M=(S,x)=>x?S?x.slice(S+1):x:[],T=(S,x)=>S===d.D?(0,t.uniq)(x.map(O=>O.datasource?.uid).filter(O=>!!O)):[S]},747:(j,I,e)=>{"use strict";e.d(I,{T:()=>n,u:()=>i});var t=e(21609);const n=" ",i=s=>{const r={},g=[],d=s.fields.filter(o=>!["Time"].includes(o.name));let l=d.find(o=>o.name==="__name__")?.values??[];!l.length&&d.length&&d[0].values.length&&(l=Array(d[0].values.length).fill(""));const u=s.fields.filter(o=>!["__name__"].includes(o.name));return l.forEach(function(o,m){r[o]={};const c=r[o][m]??{};for(const p of u){const f=p.name;if(f!=="Time")if(typeof p?.display=="function"){const E=p?.display(p.values[m]);if(!isNaN(E.numeric))c[f]=E.numeric.toString(10);else{const h=(0,t.zc)(E);h?c[f]=h:f.includes("Value #")&&(c[f]=n)}}else console.warn("Field display method is missing!")}g.push({...c,__name__:o})}),g}},20205:(j,I,e)=>{"use strict";e.d(I,{a_:()=>v,Rb:()=>D,lt:()=>P,u8:()=>a});var t=e(89949),n=e(27702),i=e(70732),s=e(24094),r=e(62247),g=e(3569),d=e(39317),l=e(86312),u=e(91368),o=e(69442),m=e.n(o),c=e(89024);const p=(M,T,S)=>{let x={},O={};if(M.type===s.sN.Regex&&M.expression){const B=new RegExp(M.expression,"gi"),V=(typeof T=="string"?T:(0,c.Xh)(T)).matchAll(B);for(const W of V)W.groups?O=W.groups:O[M.mapValue||S]=W[1]||W[0]}else M.type===s.sN.Logfmt&&(O=m().parse(T));return Object.keys(O).forEach(B=>{const A=typeof O[B]=="string"?O[B]:(0,c.Xh)(O[B]);x[B]={value:A}}),x};var f=e(89897);const h=[M=>!M.internal||u.contextSrv.hasAccessToExplore()],y="grafana_data_link_clicked",v=M=>{const{field:T,vars:S,splitOpenFn:x,range:O,rowIndex:B,dataFrame:A}=M,V={...S||{}};V.__value={value:{raw:T.values[B]},text:"Raw value"};let W;return A&&(W=(0,i.z)({frame:A,rowIndex:B}),V.__data={value:{name:A.name,refId:A.refId,fields:W},text:"Data"},A.fields.forEach(w=>{W&&W[w.name]&&(V[w.name]={value:W[w.name]})}),V.__targetField={value:W[T.name]}),T.config.links?T.config.links.filter(F=>h.every(k=>k(F,V))).map(F=>{if(F.internal){let k={};F.internal?.transformations&&F.internal?.transformations.forEach(Y=>{let X;Y.field?X=A?.fields.find(se=>se.name===Y.field)?.values[B]:X=T.values[B],k={...k,...p(Y,X,T.name)}});const H={...V,...k},R=P(F,H);let _=[];if(R.variables.length===0){const Y=T.name.toString();_.push({variableName:Y,value:"",match:""})}else _=R.variables;const G=Y=>{(0,l.ff)(y,{origin:F.origin||s.n1.Datasource,app:r.zj.Explore,internal:!0}),x?.(Y)};return R.allVariablesDefined?{...(0,g._)({link:F,internalLink:F.internal,scopedVars:H,range:O,field:T,onClickFn:M.splitOpenFn?X=>G(X):void 0,replaceVariables:(0,d.J)().replace.bind((0,d.J)())}),variables:_}:void 0}else{const k=(R,_)=>(0,d.J)().replace(R,{..._,...V}),H=(0,f.Bq)().getDataLinkUIModel(F,k,T);return H.title||(H.title=D(H.href)),H}}).filter(F=>!!F):[]};function D(M){M.indexOf("://")<0&&(M=`http://${M}`);let T;try{T=new URL(M).hostname}catch{T=M}return T}function a(M,T){return(0,n.useCallback)((S,x)=>S.fields.flatMap(O=>O.config?.links&&O.config?.links.length?v({field:O,rowIndex:x,range:M,dataFrame:S,splitOpenFn:T}):[]),[M,T])}const C=["__from","__to","__interval","__interval_ms","__org","__user","__range","__rate_interval","__timeFilter","timeFilter"];function P(M,T){let S=[];return(0,d.J)().replace.bind((0,d.J)())(b(M),T,void 0,S),S=(0,t.uniqBy)(S,"variableName"),{variables:S,allVariablesDefined:S.filter(O=>!C.includes(O.variableName)).every(O=>O.found)}}function b(M){let T="",S;for(S in M)typeof M[S]=="string"?T+=" "+M[S]:typeof M[S]=="object"&&(T+=" "+b(M[S]));return T}},18886:(j,I,e)=>{"use strict";e.d(I,{Z:()=>n});var t=e(76897);function n(i){const s=new Set(i.map(r=>r.refId).filter(Boolean));return s.size===i.length?i:(s.clear(),i.map(r=>{if(r.refId&&!s.has(r.refId))return s.add(r.refId),r;const g=(0,t.Hs)(i);return s.add(g),{...r,refId:g}}))}},22061:(j,I,e)=>{"use strict";e.d(I,{B9:()=>p,DK:()=>f,SY:()=>m,Z9:()=>y});var t=e(89949),n=e.n(t),i=e(48592),s=e(6857),r=e(95502),g=e(91729),d=e(51451),l=e(53933),u=e(56812),o=e(30209);const m=[d.v8.LogsVolume,d.v8.LogsSample],c=v=>`grafana.explore.logs.enable${v}`,p=(v,D)=>{u.Z.set(c(D),v?"true":"false")},f=()=>{let v={[d.v8.LogsVolume]:{enabled:!0},[d.v8.LogsSample]:{enabled:!1}};for(const D of m){if(D===d.v8.LogsSample)continue;u.Z.get(c(D))==="false"&&(v[D]={enabled:!1})}return v},E=(v,D,a)=>new i.y(C=>v.subscribe(P=>{if(P.logsResult&&P.logsResult.rows&&P.logsResult.visibleRange&&P.logsResult.bucketSize!==void 0&&P.state===l.Gu.Done){const b=P.logsResult.bucketSize,M=D.map(x=>x.refId),T=(0,t.groupBy)(P.logsResult.rows,"dataFrame.refId");let S=[];M.forEach(x=>{if(T[x]?.length){const O=(0,o.Nw)(T[x],b);S=[...S,...O];const B={logsVolumeType:d.o8.Limited,absoluteRange:P.logsResult?.visibleRange,datasourceName:a,sourceQuery:D.find(A=>A.refId===x)};C.next({data:S.map(A=>{const V=A.meta?.custom||{};return{...A,meta:{custom:{...V,...B}}}}),state:P.state})}}),C.complete()}})),h=(v,D,a,C)=>{if(v===d.v8.LogsVolume)return E(D,a,C)},y=(v,D,a,C)=>{const b=v.map(({datasource:M,targets:T},S)=>{const x=(0,t.cloneDeep)(a);return x.requestId=`${x.requestId||""}_${S}`,x.targets=T,(0,d.mN)(M,D)?M.getDataProvider(D,x):h(D,C,T,M.name)}).filter(l.fQ);if(b.length!==0)return b.length===1?b[0]:(0,s.T)(...b).pipe((0,g.R)((M,T)=>M.errors&&M.errors.length||T.state===l.Gu.NotStarted?M:T.state===l.Gu.Loading&&M.state===l.Gu.NotStarted?{...M,state:l.Gu.Loading}:T.state&&T.state!==l.Gu.Done?M:{...M,data:[...M.data,...T.data],state:l.Gu.Done},{data:[],state:l.Gu.NotStarted}),(0,r.E)())}},11122:(j,I,e)=>{"use strict";e.d(I,{mV:()=>P,bE:()=>C});var t=e(91053),n=e(22479),i=e(9232),s=e(42751),r=e(39317),g=e(10864),d=e(27702),l=e(48024),u=e(28580),o=e(19239),m=e(10124),c=e(74667),p=e(32291),f=e(33305),E=e(65946),h=e(22283);const y=15;function v(){const b=(0,d.useRef)({}),M=(0,d.useCallback)(S=>{switch(S){case E.Us.math:case E.Us.reduce:case E.Us.resample:case E.Us.threshold:return b.current[S];case E.Us.classic:return}},[]),T=(0,d.useCallback)((S,x)=>{switch(S){case E.Us.math:b.current.math=x;break;case E.Us.reduce:case E.Us.resample:case E.Us.resample:b.current.reduce=x,b.current.resample=x,b.current.threshold=x;break}},[]);return{getCachedExpression:M,setCachedExpression:T}}function D(b){const{query:M,queries:T,onRunQuery:S,onChange:x}=b,{getCachedExpression:O,setCachedExpression:B}=v();(0,d.useEffect)(()=>{B(M.type,M.expression)},[M.expression,M.type,B]);const A=(0,d.useCallback)(w=>{const N=O(w.value),F=(0,h.J)({...M,type:w.value});x({...F,expression:N??F.expression})},[M,x,O]),V=()=>{const w=T.filter(N=>M.refId!==N.refId).map(N=>({value:N.refId,label:N.refId}));switch(M.type){case E.Us.math:return d.createElement(m.Z,{onChange:x,query:M,labelWidth:y,onRunQuery:S});case E.Us.reduce:return d.createElement(c.v,{refIds:w,onChange:x,labelWidth:y,query:M});case E.Us.resample:return d.createElement(p.p,{query:M,labelWidth:y,onChange:x,refIds:w});case E.Us.classic:return d.createElement(o.I,{onChange:x,query:M,refIds:w});case E.Us.threshold:return d.createElement(f.M,{onChange:x,query:M,labelWidth:y,refIds:w})}},W=E.EJ.find(w=>w.value===M.type);return d.createElement("div",null,d.createElement(l._,{label:"Operation",labelWidth:y},d.createElement(u.Ph,{options:E.EJ,value:W,onChange:A,width:25})),V())}class a extends s.CK{constructor(M){super(M),this.instanceSettings=M}applyTemplateVariables(M,T){const S=(0,r.J)();return{...M,expression:S.replace(M.expression,T),window:S.replace(M.window,T)}}getCollapsedText(M){return`Expression: ${M.type}`}query(M){let T=M.targets.map(async x=>{const O=await(0,g.F)().get(x.datasource);return O.interpolateVariablesInQueries?O?.interpolateVariablesInQueries([x],M.scopedVars)[0]:x});return(0,t.D)(Promise.all(T)).pipe((0,n.z)(x=>super.query({...M,targets:x})))}newQuery(M){return{refId:"--",datasource:s.hr,type:M?.type??E.Us.math,...M}}}const C={id:-100,uid:E.Yq,name:s.hr.name,type:s.hr.type,access:"proxy",meta:{baseUrl:"",module:"",type:i.zV.datasource,name:s.hr.type,id:s.hr.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},P=new a(C);P.meta={id:s.hr.type,info:{logos:{small:"public/img/icn-datasource.svg",large:"public/img/icn-datasource.svg"}}},P.components={QueryEditor:D}},19239:(j,I,e)=>{"use strict";e.d(I,{I:()=>D});var t=e(27702),n=e(71107),i=e(48024),s=e(66670),r=e(73453),g=e(22283),d=e(42844),l=e(23852),u=e(66310),o=e(70725),m=e(28580),c=e(1128),p=e(43609);const f=p.Z.reducerTypes.map(a=>({label:a.text,value:a.value})),E=p.Z.evalOperators.map(a=>({label:a.text,value:a.value})),h=p.Z.evalFunctions.map(a=>({label:a.text,value:a.value})),y=({condition:a,index:C,onChange:P,onRemoveCondition:b,refIds:M})=>{const T=(0,u.wW)(v),S=w=>{P({...a,operator:{type:w.value}})},x=w=>{P({...a,reducer:{type:w.value,params:[]}})},O=w=>{P({...a,query:{params:[w.value]}})},B=w=>{P({...a,evaluator:{params:a.evaluator.params,type:w.value}})},A=(w,N)=>{const F=parseFloat(w.currentTarget.value),k=[...a.evaluator.params];k[N]=F,P({...a,evaluator:{...a.evaluator,params:k}})},V=(0,d.css)` width: 60px; `,W=a.evaluator.type===p.$.IsWithinRange||a.evaluator.type===p.$.IsOutsideRange;return t.createElement(l.K,{direction:"row"},t.createElement("div",{style:{flex:1}},t.createElement(n.Z,null,C===0?t.createElement("div",{className:(0,d.cx)(T.button,V)},"WHEN"):t.createElement(o.d,{className:(0,d.cx)(T.buttonSelectText,V),options:E,onChange:S,value:E.find(w=>w.value===a.operator.type)}),t.createElement(m.Ph,{options:f,onChange:x,width:20,value:f.find(w=>w.value===a.reducer.type)}),t.createElement("div",{className:T.button},"OF"),t.createElement(m.Ph,{onChange:O,options:M,width:"auto",value:M.find(w=>w.value===a.query.params[0])})),t.createElement(n.Z,null,t.createElement(o.d,{className:T.buttonSelectText,options:h,onChange:B,value:h.find(w=>w.value===a.evaluator.type)}),W?t.createElement(t.Fragment,null,t.createElement(c.I,{type:"number",width:10,onChange:w=>A(w,0),value:a.evaluator.params[0]}),t.createElement("div",{className:T.button},"TO"),t.createElement(c.I,{type:"number",width:10,onChange:w=>A(w,1),value:a.evaluator.params[1]})):a.evaluator.type!==p.$.HasNoValue?t.createElement(c.I,{type:"number",width:10,onChange:w=>A(w,0),value:a.evaluator.params[0]}):null)),t.createElement(s.zx,{variant:"secondary",type:"button",onClick:()=>b(C)},t.createElement(r.J,{name:"trash-alt"})))},v=a=>{const C=(0,d.css)` color: ${a.colors.primary.text}; font-size: ${a.typography.bodySmall.fontSize}; `;return{buttonSelectText:C,button:(0,d.cx)((0,d.css)` display: flex; align-items: center; border-radius: ${a.shape.borderRadius(1)}; font-weight: ${a.typography.fontWeightMedium}; border: 1px solid ${a.colors.border.weak}; white-space: nowrap; padding: 0 ${a.spacing(1)}; background-color: ${a.colors.background.canvas}; `,C)}},D=({onChange:a,query:C,refIds:P})=>{const b=(S,x)=>{C.conditions&&a({...C,conditions:[...C.conditions.slice(0,x),S,...C.conditions.slice(x+1)]})},M=()=>{if(C.conditions){const S=C.conditions.at(-1)?.query?.params??[],x={...g.R,query:{params:S}};a({...C,conditions:C.conditions.length>0?[...C.conditions,x]:[x]})}},T=S=>{if(C.conditions){const x=C.conditions[S],O=C.conditions.filter(B=>B!==x).map((B,A)=>A===0?{...B,operator:{type:"when"}}:B);a({...C,conditions:O})}};return t.createElement("div",null,t.createElement(n.Z,null,t.createElement(i._,{label:"Conditions",labelWidth:14},t.createElement("div",null,C.conditions?.map((S,x)=>{if(S)return t.createElement(y,{key:x,index:x,condition:S,onChange:O=>b(O,x),onRemoveCondition:T,refIds:P})})))),t.createElement(s.zx,{variant:"secondary",type:"button",onClick:M},t.createElement(r.J,{name:"plus-circle"})))}},10124:(j,I,e)=>{"use strict";e.d(I,{Z:()=>m});var t=e(42844),n=e(27702),i=e(23852),s=e(66310),r=e(48024),g=e(53901),d=e(16532),l=e(73453),u=e(60105);const o="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",m=({labelWidth:E,onChange:h,query:y,onRunQuery:v})=>{const D=P=>{h({...y,expression:P.target.value})},a=(0,s.wW)(p),C=()=>{y.expression&&v()};return n.createElement(i.K,{direction:"row"},n.createElement(r._,{label:n.createElement(g.W,{width:"auto"},n.createElement(d.P,{fitContent:!0,content:n.createElement("div",{className:a.documentationContainer},n.createElement("div",null,"Run math operations on one or more queries. You reference the query by ","${refId}"," ie. $A, $B, $C etc.",n.createElement("br",null),"Example: ",n.createElement("code",null,"$A + $B")),n.createElement("header",{className:a.documentationHeader},"Available Math functions"),n.createElement("div",{className:a.documentationFunctions},n.createElement(c,{name:"abs",description:"returns the absolute value of its argument which can be a number or a series"}),n.createElement(c,{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."}),n.createElement(c,{name:"is_nan",description:"returns 1 for NaN values and 0 for other values. It's able to operate on series or scalar values."}),n.createElement(c,{name:"is_null",description:"returns 1 for null values and 0 for other values. It's able to operate on series or scalar values."}),n.createElement(c,{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."}),n.createElement(c,{name:"log",description:"returns the natural logarithm of its argument, which can be a number or a series"}),n.createElement(c,{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."}),n.createElement(c,{name:"round",description:"returns a rounded integer value. It's able to operate on series or escalar values."}),n.createElement(c,{name:"ceil",description:"rounds the number up to the nearest integer value. It's able to operate on series or escalar values."}),n.createElement(c,{name:"floor",description:"rounds the number down to the nearest integer value. It's able to operate on series or escalar values."}))),title:n.createElement(i.K,{gap:1,direction:"row"},n.createElement(l.J,{name:"book-open"})," Math operator"),footer:n.createElement("div",null,"See our additional documentation on"," ",n.createElement("a",{className:a.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"},n.createElement(l.J,{size:"xs",name:"external-link-alt"})," Math expressions"),"."),closeButton:!0,placement:"bottom-start"},n.createElement("div",{className:a.info},"Expression ",n.createElement(l.J,{name:"info-circle"})))),labelWidth:E,grow:!0,shrink:!0},n.createElement(u.K,{value:y.expression,onChange:D,rows:1,placeholder:o,onBlur:C,style:{minWidth:250,lineHeight:"26px",minHeight:32}})))},c=({name:E,description:h})=>{const y=(0,s.wW)(f);return n.createElement(n.Fragment,null,n.createElement("span",{className:y.name},E),n.createElement("span",{className:y.description},h))},p=E=>({documentationHeader:(0,t.css)` font-size: ${E.typography.h5.fontSize}; font-weight: ${E.typography.h5.fontWeight}; `,documentationLink:(0,t.css)` color: ${E.colors.text.link}; `,documentationContainer:(0,t.css)` display: flex; flex: 1; flex-direction: column; gap: ${E.spacing(2)}; padding: ${E.spacing(1)} ${E.spacing(2)}; `,documentationFunctions:(0,t.css)` display: grid; grid-template-columns: max-content auto; column-gap: ${E.spacing(2)}; `,info:(0,t.css)` display: flex; flex-direction: row; align-items: center; cursor: pointer; gap: ${E.spacing(1)}; `}),f=E=>({name:(0,t.css)` font-weight: ${E.typography.fontWeightBold}; `,description:(0,t.css)` font-size: ${E.typography.bodySmall.fontSize}; color: ${E.colors.text.disabled}; `})},74667:(j,I,e)=>{"use strict";e.d(I,{v:()=>d});var t=e(27702),n=e(48024),i=e(1128),s=e(71107),r=e(28580),g=e(65946);const d=({labelWidth:l="auto",onChange:u,refIds:o,query:m})=>{const c=g.SQ.find(a=>a.value===m.reducer),p=a=>{u({...m,expression:a.value})},f=a=>{u({...m,reducer:a.value})},E=a=>{u({...m,settings:a})},h=a=>{let C;switch(a.value){case g.kN.ReplaceNonNumbers:let P=0;m.settings?.mode===g.kN.ReplaceNonNumbers&&(P=m.settings?.replaceWithValue??0),C={mode:g.kN.ReplaceNonNumbers,replaceWithValue:P};break;default:C={mode:a.value}}E(C)},y=a=>{const C=a.currentTarget.valueAsNumber;E({mode:g.kN.ReplaceNonNumbers,replaceWithValue:C??0})},v=m.settings?.mode??g.kN.Strict,D=()=>{if(v===g.kN.ReplaceNonNumbers)return t.createElement(n._,{label:"Replace With",labelWidth:l},t.createElement(i.I,{type:"number",width:10,onChange:y,value:m.settings?.replaceWithValue??0}))};return t.createElement(t.Fragment,null,t.createElement(s.Z,null,t.createElement(n._,{label:"Input",labelWidth:l},t.createElement(r.Ph,{onChange:p,options:o,value:m.expression,width:"auto"}))),t.createElement(s.Z,null,t.createElement(n._,{label:"Function",labelWidth:l},t.createElement(r.Ph,{options:g.SQ,value:c,onChange:f,width:20})),t.createElement(n._,{label:"Mode",labelWidth:l},t.createElement(r.Ph,{onChange:h,options:g.YM,value:v,width:25})),D()))}},32291:(j,I,e)=>{"use strict";e.d(I,{p:()=>d});var t=e(27702),n=e(71107),i=e(48024),s=e(28580),r=e(1128),g=e(65946);const d=({labelWidth:l="auto",onChange:u,refIds:o,query:m})=>{const c=g.Fr.find(v=>v.value===m.downsampler),p=g.r8.find(v=>v.value===m.upsampler),f=v=>{u({...m,window:v.target.value})},E=v=>{u({...m,expression:v.value})},h=v=>{u({...m,downsampler:v.value})},y=v=>{u({...m,upsampler:v.value})};return t.createElement(t.Fragment,null,t.createElement(n.Z,null,t.createElement(i._,{label:"Input",labelWidth:l},t.createElement(s.Ph,{onChange:E,options:o,value:m.expression,width:20}))),t.createElement(n.Z,null,t.createElement(i._,{label:"Resample to",labelWidth:l,tooltip:"10s, 1m, 30m, 1h"},t.createElement(r.I,{onChange:f,value:m.window,width:15})),t.createElement(i._,{label:"Downsample"},t.createElement(s.Ph,{options:g.Fr,value:c,onChange:h,width:25})),t.createElement(i._,{label:"Upsample"},t.createElement(s.Ph,{options:g.r8,value:p,onChange:y,width:25}))))}},33305:(j,I,e)=>{"use strict";e.d(I,{M:()=>c});var t=e(42844),n=e(27702),i=e(66310),s=e(71107),r=e(48024),g=e(28580),d=e(70725),l=e(1128),u=e(43609),o=e(65946);const m=u.$.IsAbove,c=({labelWidth:E,onChange:h,refIds:y,query:v})=>{const D=(0,i.wW)(f),a={type:"query",evaluator:{type:m,params:[0,0]},query:{params:[]},reducer:{params:[],type:"last"}},C=v.conditions?.length?v.conditions:[a],P=C[0],b=o.Mi.find(O=>O.value===C[0].evaluator?.type),M=O=>{h({...v,expression:O.value})},T=O=>{const B=O.value??m;h({...v,conditions:p(C,{type:B})})},S=(O,B)=>{const A=parseFloat(O.currentTarget.value),V=[...P.evaluator.params];V[B]=A,h({...v,conditions:p(C,{params:V})})},x=P.evaluator.type===u.$.IsWithinRange||P.evaluator.type===u.$.IsOutsideRange;return n.createElement(n.Fragment,null,n.createElement(s.Z,null,n.createElement(r._,{label:"Input",labelWidth:E},n.createElement(g.Ph,{onChange:M,options:y,value:v.expression,width:20}))),n.createElement(s.Z,null,n.createElement(d.d,{className:D.buttonSelectText,options:o.Mi,onChange:T,value:b}),x?n.createElement(n.Fragment,null,n.createElement(l.I,{type:"number",width:10,onChange:O=>S(O,0),defaultValue:P.evaluator.params[0]}),n.createElement("div",{className:D.button},"TO"),n.createElement(l.I,{type:"number",width:10,onChange:O=>S(O,1),defaultValue:P.evaluator.params[1]})):n.createElement(l.I,{type:"number",width:10,onChange:O=>S(O,0),defaultValue:C[0].evaluator.params[0]||0})))};function p(E,h){return[{...E[0],evaluator:{...E[0].evaluator,...h}}]}const f=E=>({buttonSelectText:(0,t.css)` color: ${E.colors.primary.text}; font-size: ${E.typography.bodySmall.fontSize}; text-transform: uppercase; `,button:(0,t.css)` height: 32px; color: ${E.colors.primary.text}; font-size: ${E.typography.bodySmall.fontSize}; text-transform: uppercase; display: flex; align-items: center; border-radius: ${E.shape.borderRadius(1)}; font-weight: ${E.typography.fontWeightBold}; border: 1px solid ${E.colors.border.medium}; white-space: nowrap; padding: 0 ${E.spacing(1)}; background-color: ${E.colors.background.primary}; `})},65946:(j,I,e)=>{"use strict";e.d(I,{EJ:()=>g,Fr:()=>o,Mi:()=>c,SQ:()=>d,Us:()=>s,YM:()=>u,Yq:()=>i,hF:()=>r,kN:()=>l,r8:()=>m});var t=e(66656),n=e(43609);const i="__expr__";var s=(p=>(p.math="math",p.reduce="reduce",p.resample="resample",p.classic="classic_conditions",p.threshold="threshold",p))(s||{});const r=p=>{switch(p){case"math":return"Math";case"reduce":return"Reduce";case"resample":return"Resample";case"classic_conditions":return"Classic condition";case"threshold":return"Threshold"}},g=[{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",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."}],d=[{value:t.gz.min,label:"Min",description:"Get the minimum value"},{value:t.gz.max,label:"Max",description:"Get the maximum value"},{value:t.gz.mean,label:"Mean",description:"Get the average value"},{value:t.gz.sum,label:"Sum",description:"Get the sum of all values"},{value:t.gz.count,label:"Count",description:"Get the number of values"},{value:t.gz.last,label:"Last",description:"Get the last value"}];var l=(p=>(p.Strict="",p.ReplaceNonNumbers="replaceNN",p.DropNonNumbers="dropNN",p))(l||{});const u=[{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"}],o=[{value:t.gz.last,label:"Last",description:"Fill with the last value"},{value:t.gz.min,label:"Min",description:"Fill with the minimum value"},{value:t.gz.max,label:"Max",description:"Fill with the maximum value"},{value:t.gz.mean,label:"Mean",description:"Fill with the average value"},{value:t.gz.sum,label:"Sum",description:"Fill with the sum of all values"}],m=[{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"}],c=[{value:n.$.IsAbove,label:"Is above"},{value:n.$.IsBelow,label:"Is below"},{value:n.$.IsWithinRange,label:"Is within range"},{value:n.$.IsOutsideRange,label:"Is outside range"}]},22283:(j,I,e)=>{"use strict";e.d(I,{J:()=>s,R:()=>r});var t=e(66656),n=e(43609),i=e(65946);const s=g=>{switch(g.type){case i.Us.reduce:g.reducer||(g.reducer=t.gz.mean);break;case i.Us.resample:g.downsampler||(g.downsampler=t.gz.mean),g.upsampler||(g.upsampler="fillna"),g.reducer=void 0;break;case i.Us.math:g.expression=void 0;break;case i.Us.classic:g.conditions||(g.conditions=[r]);break;default:g.reducer=void 0}return g},r={type:"query",reducer:{params:[],type:"avg"},operator:{type:"and"},query:{params:[]},evaluator:{params:[0,0],type:n.$.IsAbove}}},35381:(j,I,e)=>{"use strict";e.d(I,{Go:()=>p,J6:()=>E,OD:()=>c,Pb:()=>m,Uk:()=>v,W7:()=>a,a:()=>f,pz:()=>D,v7:()=>y});var t=e(78209),n=e(94469),i=e(26129),s=e(73289),r=e(33877),g=e(73807),d=e(66574),l=e(45937),u=e(40127),o=e(62225);function m(C){return async P=>{const b=await l.ae.getFolderByUid(C);return P((0,o.G3)(b)),P((0,r.RL)((0,u.B1)(b))),b}}function c(C){return async P=>{const b=await l.ae.put(`/api/folders/${C.uid}`,{title:C.title,version:C.version});P((0,r.$l)((0,g.AT)("Folder saved"))),P((0,o.G3)(b)),i.E1.push(n.u.stripBaseFromUrl(`${b.url}/settings`))}}function p(C){return async()=>{await l.ae.delete(`/api/folders/${C}?forceDeleteRules=false`),i.E1.push("/dashboards")}}function f(C){return async P=>{const b=await l.ae.get(`/api/folders/${C}/permissions`);P((0,o.R7)(b))}}function E(C){return async P=>{try{await(0,t.n)(l.ae.fetch({method:"GET",showErrorAlert:!1,showSuccessAlert:!1,url:`/api/folders/${C}/permissions`})),P((0,o.$$)(!0))}catch(b){(0,s.kW)(b)&&b.status!==403&&P((0,r.$l)((0,g.ZR)("Error checking folder permissions",b.data?.message))),P((0,o.$$)(!1))}}}function h(C){return{userId:C.userId,teamId:C.teamId,role:C.role,permission:C.permission}}function y(C,P){return async(b,M)=>{const T=M().folder,S=[];for(const x of T.permissions){if(x.inherited)continue;const O=h(x);C===x&&(O.permission=P),S.push(O)}await l.ae.post(`/api/folders/${T.uid}/permissions`,{items:S}),await b(f(T.uid))}}function v(C){return async(P,b)=>{const M=b().folder,T=[];for(const S of M.permissions)S.inherited||S===C||T.push(h(S));await l.ae.post(`/api/folders/${M.uid}/permissions`,{items:T}),await P(f(M.uid))}}function D(C){return async(P,b)=>{const M=b().folder,T=[];for(const S of M.permissions)S.inherited||T.push(h(S));T.push({userId:C.userId,teamId:C.teamId,role:C.role,permission:C.permission}),await l.ae.post(`/api/folders/${M.uid}/permissions`,{items:T}),await P(f(M.uid))}}function a(C,P){return async b=>{const M=await(0,s.i)().post("/api/folders",{title:C,parentUid:P});await d.Vt.fetchUserPermissions(),b((0,r.$l)((0,g.AT)("Folder Created","OK"))),i.E1.push(n.u.stripBaseFromUrl(M.url))}}},40127:(j,I,e)=>{"use strict";e.d(I,{AZ:()=>l,B1:()=>c,Pr:()=>d,W3:()=>u,_l:()=>p,y3:()=>g});var t=e(34667),n=e(51391),i=e(65322),s=e(91368),r=e(18771);const g="manage-folder",d=f=>`folder-dashboards-${f}`,l=f=>`folder-library-panels-${f}`,u=f=>`folder-alerting-${f}`,o=f=>`folder-permissions-${f}`,m=f=>`folder-settings-${f}`;function c(f,E=f.parents){const h={icon:"folder",id:g,subTitle:(0,n.L)("manage-folder"),url:f.url,text:f.title,children:[{active:!1,icon:"apps",id:d(f.uid),text:(0,i.t)("browse-dashboards.manage-folder-nav.dashboards","Dashboards"),url:f.url}]};if(E&&E.length>0){const y=E[E.length-1],v=E.slice(0,E.length-1);h.parentItem=c(y,v)}return h.children.push({active:!1,icon:"library-panel",id:l(f.uid),text:(0,i.t)("browse-dashboards.manage-folder-nav.panels","Panels"),url:`${f.url}/library-panels`}),s.contextSrv.hasPermission(r.AccessControlAction.AlertingRuleRead)&&t.config.unifiedAlertingEnabled&&h.children.push({active:!1,icon:"bell",id:u(f.uid),text:(0,i.t)("browse-dashboards.manage-folder-nav.alert-rules","Alert rules"),url:`${f.url}/alerting`}),t.config.featureToggles.nestedFolders||(f.canAdmin&&h.children.push({active:!1,icon:"lock",id:o(f.uid),text:(0,i.t)("browse-dashboards.manage-folder-nav.permissions","Permissions"),url:`${f.url}/permissions`}),f.canSave&&h.children.push({active:!1,icon:"cog",id:m(f.uid),text:(0,i.t)("browse-dashboards.manage-folder-nav.settings","Settings"),url:`${f.url}/settings`})),h}function p(f){const E=c({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 E.children[f].active=!0,{main:E,node:E.children[f]}}},62225:(j,I,e)=>{"use strict";e.d(I,{$$:()=>o,G3:()=>l,R7:()=>d,Ss:()=>u,ZP:()=>c});var t=e(34099),n=e(58198),i=e(67572);const s={id:0,uid:"loading",title:"loading",url:"",canSave:!1,canDelete:!1,hasChanged:!1,version:1,permissions:[],canViewFolderPermissions:!1},r=(p,f)=>({...p,...f.payload,hasChanged:!1}),g=(0,t.oM)({name:"folder",initialState:s,reducers:{loadFolder:r,setFolderTitle:(p,f)=>({...p,title:f.payload,hasChanged:f.payload.trim().length>0}),loadFolderPermissions:(p,f)=>({...p,permissions:(0,n.A)(f.payload)}),setCanViewFolderPermissions:(p,f)=>(p.canViewFolderPermissions=f.payload,p)},extraReducers:p=>{p.addMatcher(i.Hv.getFolder.matchFulfilled,r)}}),{loadFolderPermissions:d,loadFolder:l,setFolderTitle:u,setCanViewFolderPermissions:o}=g.actions,c={folder:g.reducer}},58514:(j,I,e)=>{"use strict";e.d(I,{Q:()=>u});var t=e(42844),n=e(27702),i=e(66310),s=e(28580),r=e(63439),g=e(80402),d=e(92886);const l=[{label:"Countries",description:"Lookup countries by name, two letter code, or three letter code",value:d.LI},{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"}],u=({value:m,onChange:c,context:p,item:f})=>{const E=o((0,i.l4)()),[h,y]=(0,n.useState)(),v=f.settings;(0,n.useEffect)(()=>{async function C(){const P=await(0,d.so)(m);y(P)}C()},[m,y]);const{current:D,options:a}=(0,n.useMemo)(()=>{let C=v?.options?[...v.options]:[...l],P=C?.find(b=>b.value===h?.path);return!P&&h&&(P={label:h.path,value:h.path},C.push(P)),{options:C,current:P}},[h,v?.options]);return n.createElement(n.Fragment,null,n.createElement(s.Ph,{value:D,options:a,onChange:C=>c(C.value),allowCustomValue:!0,formatCreateLabel:C=>`Load from URL: ${C}`}),h&&n.createElement(n.Fragment,null,h.error&&n.createElement(r.b,{title:h.error,severity:"warning"}),h.count&&n.createElement("div",{className:E.keys},n.createElement("b",null,"(",h.count,")"),h.examples(10).map(C=>n.createElement("span",{key:C},C,",")),h.count>10&&" ...")))},o=(0,g.B)(m=>({keys:(0,t.css)` margin-top: 4px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; > span { margin-left: 4px; } `}))},79357:(j,I,e)=>{"use strict";e.d(I,{C:()=>y});var t=e(29241),n=e(64167),i=e(58514),s=e(42844),r=e(27702),g=e(74639),d=e(66310),l=e(63439),u=e(73453),o=e(28580),m=e(64022),c=e(83612);const p=[{value:n.q1.Auto,label:"Auto",ariaLabel:g.wl.components.Transforms.SpatialOperations.location.autoOption,description:"Automatically identify location data based on default field names"},{value:n.q1.Coords,label:"Coords",ariaLabel:g.wl.components.Transforms.SpatialOperations.location.coords.option,description:"Specify latitude and longitude fields"},{value:n.q1.Geohash,label:"Geohash",ariaLabel:g.wl.components.Transforms.SpatialOperations.location.geohash.option,description:"Specify geohash field"},{value:n.q1.Lookup,label:"Lookup",ariaLabel:g.wl.components.Transforms.SpatialOperations.location.lookup.option,description:"Specify Gazetteer and lookup field"}],f="https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/geomap/#location",E=({value:v,onChange:D,context:a,item:C})=>{const[P,b]=(0,r.useState)();(0,r.useEffect)(()=>{C.settings?.source&&C.settings?.data?.length&&C.settings.data[0]&&(0,c.cJ)(C.settings.source).then(S=>{C.settings&&C.settings.data&&b((0,c.g6)(C.settings.data[0],S))})},[C.settings]);const M=(0,d.wW)(h),T=()=>{if(P){if(P.warning)return r.createElement(l.b,{title:P.warning,severity:"warning",buttonContent:r.createElement(u.J,{name:"question-circle",size:"xl"}),className:M.alert,onRemove:()=>{const S=window.open(f,"_blank","noopener,noreferrer");S&&(S.opener=null)}});if(v===n.q1.Auto&&P.description)return r.createElement("span",null,P.description)}return null};return r.createElement(r.Fragment,null,r.createElement(o.Ph,{options:p,value:v,onChange:S=>{D(S.value)}}),r.createElement(m.Lh,{className:M.hGroup},T()))},h=v=>({alert:(0,s.css)` & div { padding: 4px; } margin-bottom: 0px; margin-top: 5px; padding: 2px; `,hGroup:(0,s.css)` & div { width: 100%; } `});function y(v,D,a,C,P){switch(a.addCustomEditor({id:"modeEditor",path:`${D}mode`,name:"Location Mode",editor:E,settings:{data:P,source:C}}),C?.mode){case n.q1.Coords:a.addFieldNamePicker({path:`${D}latitude`,name:"Latitude field",settings:{filter:b=>b.type===t.fS.number,noFieldsMessage:"No numeric fields found"}}).addFieldNamePicker({path:`${D}longitude`,name:"Longitude field",settings:{filter:b=>b.type===t.fS.number,noFieldsMessage:"No numeric fields found"}});break;case n.q1.Geohash:a.addFieldNamePicker({path:`${D}geohash`,name:"Geohash field",settings:{filter:b=>b.type===t.fS.string,noFieldsMessage:"No strings fields found"}});break;case n.q1.Lookup:a.addFieldNamePicker({path:`${D}lookup`,name:"Lookup field",settings:{filter:b=>b.type===t.fS.string,noFieldsMessage:"No strings fields found"}}).addCustomEditor({id:"gazetteer",path:`${D}gazetteer`,name:"Gazetteer",editor:i.Q})}}},62236:(j,I,e)=>{"use strict";e.d(I,{EK:()=>c,Fh:()=>p,ie:()=>m,uZ:()=>u,zS:()=>o});var t=e(10680),n=e(87419),i=e(84570),s=e(29209),r=e(29241),g=e(62129);function d(E){if(!E?.length)return;const h=[16,8,4,2,1],y="0123456789bcdefghjkmnpqrstuvwxyz";let v=!0;const D=[],a=[];D[0]=-90,D[1]=90,a[0]=-180,a[1]=180;let C;E.split("").forEach(M=>{C=y.indexOf(M),h.forEach(T=>{l(v?a:D,C,T),v=!v})});const P=(D[0]+D[1])/2;return[(a[0]+a[1])/2,P]}function l(E,h,y){h&y?E[0]=(E[0]+E[1])/2:E[1]=(E[0]+E[1])/2}function u(E){return{name:E.name??"Point",type:r.fS.geo,values:E.values.map(h=>{const y=d(h);if(y)return new t.Z((0,s.mi)(y))}),config:f}}function o(E,h){const y=new Array(E.values.length);for(let v=0;v<E.values.length;v++){const D=E.values[v],a=h.values[v];D===null||a===null||(y[v]=new t.Z((0,s.mi)([D,a])))}return{name:"Point",type:r.fS.geo,values:y,config:f}}function m(E,h){const y=h.values.length,v=new Array(y);for(let D=0;D<y;D++)v[D]=E.find(h.values[D])?.geometry();return{name:"Geometry",type:r.fS.geo,values:v,config:f}}function c(E,h){const y=E.values,v=h.values;if(!y||!v)throw"missing src/dest";if(y.length!==v.length)throw"Source and destination field lengths do not match";const D=E.values.length,a=new Array(D);for(let C=0;C<D;C++){const P=y[C],b=v[C];P&&b?a[C]=new n.Z([P,b]):P?a[C]=P:b&&(a[C]=b)}return{name:"Geometry",type:r.fS.geo,values:a,config:f}}function p(E,h){const y=E.values,v=h.values;if(!y||!v)throw"missing src/dest";if(y.length!==v.length)throw"Source and destination field lengths do not match";const D=E.values.length,a=new Array(D);for(let C=0;C<D;C++){const P=y[C],b=v[C];P&&b&&(a[C]=new i.Z([(0,g.Lb)(P),(0,g.Lb)(b)]))}return{name:"Geometry",type:r.fS.geo,values:a,config:f}}const f=Object.freeze({custom:{hideFrom:{tooltip:!0}}})},92886:(j,I,e)=>{"use strict";e.d(I,{LI:()=>E,so:()=>h});var t=e(70328),n=e(10680),i=e(32053),s=e(29241),r=e(73289),g=e(7954);function d(y){const v=new g.Z().readFeatures(y,{featureProjection:"EPSG:3857"}),D=v.length,a=new Array(D).fill(null),C=[],P=new Map,b=x=>{let O=P.get(x);return O||(O={types:new Set,values:new Array(D).fill(null),count:0},C.push(x),P.set(x,O)),O},M=(...x)=>{for(const O of x)if(!P.has(O))return O;return"___"+x[0]},T={types:new Set,values:new Array(D).fill(null),count:0};for(let x=0;x<D;x++){const O=v[x];a[x]=O.getGeometry();const B=O.getId();B!=null&&(T.values[x]=B,T.types.add((0,i.DP)(B)),T.count++);for(const A of O.getKeys()){const V=O.get(A);if(V===a[x]||V==null)continue;const W=b(A);W.values[x]=V,W.types.add((0,i.DP)(V)),W.count++}}const S=[];if(T.count>0){const x=l(T);S.push({name:M("id","_id","__id"),type:x,values:T.values,config:{}})}S.push({name:M("geo","geometry"),type:s.fS.geo,values:a,config:{}});for(const x of C){const O=P.get(x);if(!O)continue;const B=l(O);S.push({name:x,type:B,values:O.values,config:{}})}return{fields:S,length:D}}function l(y){return y.count<1?s.fS.other:y.types.size>1?(y.values=y.values.map(v=>v!=null?`${v}`:v),s.fS.string):y.types.values().next().value}var u=e(62236),o=e(29209);function m(y,v){let D=0;const a=new Map;for(const C of v){const P=new n.Z((0,o.mi)([C.longitude,C.latitude])),b={point:()=>P,geometry:()=>P};if(C.name&&(a.set(C.name,b),a.set(C.name.toUpperCase(),b)),C.key&&(a.set(C.key,b),a.set(C.key.toUpperCase(),b)),C.keys)for(const M of C.keys)a.set(M,b),a.set(M.toUpperCase(),b);D++}return{path:y,find:C=>{let P=a.get(C);return!P&&typeof C=="string"&&(P=a.get(C.toUpperCase())),P},count:D,examples:C=>{const P=[];if(a.size<1)P.push("no values found");else for(const b of a.keys())if(P.push(b),P.length>=C)break;return P}}}function c(y,v){let D;if(Array.isArray(v)){const a=v[0];if(a.latitude&&a.longitude&&(a.key||a.keys))return m(y,v)}else Array.isArray(v?.features)&&v?.type==="FeatureCollection"&&(D=d(v));if(!D)try{D=(0,i.g0)(v)}catch(a){return{path:y,error:`${a}`,find:C=>{},examples:C=>[]}}return p(D,{path:y})}function p(y,v){const D=[];let a,C,P,b,M;for(const x of y.fields)if(x.type===s.fS.geo&&(a=x),!M&&x.type===s.fS.string&&(M=x),x.name){v.keys&&v.keys.includes(x.name)&&D.push(x);const O=x.name.toUpperCase();switch(O){case"LAT":case"LATITUTE":C=x;break;case"LON":case"LNG":case"LONG":case"LONGITUE":P=x;break;case"GEOHASH":b=x;break;case"ID":case"UID":case"KEY":case"CODE":v.keys||D.push(x);break;default:v.keys||(O.endsWith("_ID")||O.endsWith("_CODE"))&&D.push(x)}}!D.length&&M&&D.push(M);let T=!1;a?T=a.values[0]?.getType()==="Point":b?(a=(0,u.uZ)(b),T=!0):C&&P&&(a=(0,u.zS)(P,C),T=!0);const S=new Map;return D.forEach(x=>{x.values.forEach((O,B)=>{const A=`${O}`;S.set(A.toUpperCase(),B),S.set(A,B)})}),{path:v.path,find:x=>{const O=S.get(x);if(O!=null){const B=a?.values[O];return{frame:y,index:O,point:()=>!B||T?B:new n.Z((0,t.qg)(B.getExtent())),geometry:()=>B}}},examples:x=>{const O=[];for(let B of S.keys())if(O.push(B),O.length>x)break;return O},frame:()=>y,count:y.length}}const f={},E="public/gazetteer/countries.json";async function h(y){y||(y=E);let v=f[y];if(!v){try{const D=await(0,r.i)().get(y);v=c(y,D)}catch(D){console.warn("Error loading placename lookup",y,D),v={path:y,error:"Error loading URL",find:a=>{},examples:a=>[]}}f[y]=v}return v}},83612:(j,I,e)=>{"use strict";e.d(I,{cJ:()=>m,g6:()=>p});var t=e(75578),n=e(29241),i=e(76178),s=e(19221),r=e(64167),g=e(62236),d=e(92886);function l(f){return E=>{for(const h of E.fields)if(f(h,E,[]))return h}}function u(f){return E=>{for(const h of E.fields){if(f.has(h.name.toLowerCase()))return h;const y=(0,t.CZ)(h,E);if(f.has(y))return h}}}const o={mode:r.q1.Auto,geohash:u(new Set(["geohash"])),latitude:u(new Set(["latitude","lat"])),longitude:u(new Set(["longitude","lon","lng"])),h3:u(new Set(["h3"])),wkt:u(new Set(["wkt"])),lookup:u(new Set(["lookup"])),geo:f=>f.fields.find(E=>E.type===n.fS.geo)};async function m(f){const E={...o,mode:f?.mode??r.q1.Auto};switch(E.gazetteer=await(0,d.so)(f?.gazetteer),E.mode){case r.q1.Geohash:f?.geohash?E.geohash=l((0,i.sq)({id:s.mi.byName,options:f.geohash})):E.geohash=()=>{};break;case r.q1.Lookup:const h=f?.lookup?.length?(0,i.sq)({id:s.mi.byName,options:f.lookup}):(0,i.sq)({id:s.mi.byType,options:n.fS.string});E.lookup=l(h);break;case r.q1.Coords:f?.latitude?E.latitude=l((0,i.sq)({id:s.mi.byName,options:f.latitude})):E.latitude=()=>{},f?.longitude?E.longitude=l((0,i.sq)({id:s.mi.byName,options:f.longitude})):E.longitude=()=>{};break}return E}function c(f,E){const h={mode:E.mode??r.q1.Auto};if(h.mode===r.q1.Auto){if(h.geo=E.geo(f),h.geo)return h;if(h.latitude=E.latitude(f),h.longitude=E.longitude(f),h.latitude&&h.longitude)return h.mode=r.q1.Coords,h;if(h.geohash=E.geohash(f),h.geohash)return h.mode=r.q1.Geohash,h;if(h.lookup=E.lookup(f),h.lookup)return h.mode=r.q1.Lookup,h}switch(h.mode){case r.q1.Coords:h.latitude=E.latitude(f),h.longitude=E.longitude(f);break;case r.q1.Geohash:h.geohash=E.geohash(f);break;case r.q1.Lookup:h.lookup=E.lookup(f);break}return h}function p(f,E){const h=c(f,E);switch(h.mode){case r.q1.Auto:return h.geo?{field:h.geo}:{warning:"Unable to find location fields"};case r.q1.Coords:return h.latitude&&h.longitude?{field:(0,g.zS)(h.longitude,h.latitude),derived:!0,description:`${h.mode}: ${h.latitude.name}, ${h.longitude.name}`}:{warning:"Select latitude/longitude fields"};case r.q1.Geohash:return h.geohash?{field:(0,g.uZ)(h.geohash),derived:!0,description:`${h.mode}`}:{warning:"Select geohash field"};case r.q1.Lookup:return h.lookup?E.gazetteer?{field:(0,g.ie)(E.gazetteer,h.lookup),derived:!0,description:`${h.mode}: ${E.gazetteer.path}`}:{warning:"Gazetteer not found"}:{warning:"Select lookup field"}}return{warning:"unable to find geometry"}}},31783:(j,I,e)=>{"use strict";e.d(I,{Fc:()=>o,KO:()=>c,gb:()=>p,gv:()=>m});var t=e(49086),n=e.n(t),i=e(60956),s=e(14544),r=e(92827),g=e(72164),d=e(10315),l=e(71523),u=e(66288);function o(f,E){let h="";f.meta?.forEach(D=>{const a=`${D.label}: ${JSON.stringify(D.value)} `;h=h+a}),h=h+` `,f.rows.forEach(D=>{const a=(0,i.lf)(D.timeEpochMs)+" "+D.entry+` `;h=h+a});const y=new Blob([h],{type:"text/plain;charset=utf-8"}),v=`${E}-logs-${(0,i.dq)(new Date)}.txt`;n()(y,v)}function m(f,E,h,y=s.W.noop){const v=(0,r.MJ)([f],h),D=new Blob([String.fromCharCode(65279),v],{type:"text/csv;charset=utf-8"}),a=y!==s.W.noop?"-as-"+y.toLocaleLowerCase():"",C=`${E}-data${a}-${(0,i.dq)(new Date)}.csv`;n()(D,C)}function c(f,E){const h=new Blob([JSON.stringify(f)],{type:"application/json"}),y=`${E}-${(0,i.dq)(new Date)}.json`;n()(h,y)}function p(f,E){let h="otlp";switch(f.meta?.custom?.traceFormat){case"jaeger":{let y=(0,d.c6)(new g.v(f));c(y,E),h="jaeger";break}case"zipkin":{let y=(0,u.H)(new g.v(f));c(y,E),h="zipkin";break}case"otlp":default:{let y=(0,l.g9)(new g.v(f));c(y,E);break}}return h}},54422:(j,I,e)=>{"use strict";e.d(I,{GY:()=>g,MA:()=>r,nW:()=>s});var t=e(73289),n=e(66574),i=e(18771);const s=(0,i.createAsyncThunk)("users/fetchInvitees",async()=>n.Vt.hasPermission(i.AccessControlAction.OrgUsersAdd)?await(0,t.i)().get("/api/org/invites"):[]),r=(0,i.createAsyncThunk)("users/addInvitee",async(d,{dispatch:l})=>{await(0,t.i)().post("/api/org/invites",d),await l(s())}),g=(0,i.createAsyncThunk)("users/revokeInvite",async d=>(await(0,t.i)().patch(`/api/org/invites/${d}/revoke`,{}),d))},67198:(j,I,e)=>{"use strict";e.d(I,{ZP:()=>l,selectors:()=>s});var t=e(34099),n=e(54422);const i=(0,t.HF)({selectId:u=>u.code}),s=i.getSelectors(),r=i.getInitialState({status:"idle"}),l={invites:(0,t.oM)({name:"invites",initialState:r,reducers:{},extraReducers:u=>{u.addCase(n.nW.pending,o=>{o.status="loading"}).addCase(n.nW.fulfilled,(o,{payload:m})=>{i.setAll(o,m),o.status="succeeded"}).addCase(n.nW.rejected,o=>{o.status="failed"}).addCase(n.GY.fulfilled,(o,{payload:m})=>{i.removeOne(o,m),o.status="succeeded"})}}).reducer}},14673:(j,I,e)=>{"use strict";e.d(I,{T:()=>p,c:()=>f});var t=e(27702),n=e(29956),i=e(25111),s=e(73289),r=e(22209),g=e(1128),d=e(13741),l=e(66670),u=e(41482),o=e(65322),m=e(75766),c=e(37024);const p=({panel:E,initialFolderUid:h,onDismiss:y})=>{const[v,D]=(0,t.useState)(h),[a,C]=(0,t.useState)(E.title),[P,b]=(0,t.useState)(E.title),[M,T]=(0,t.useState)(!1);(0,t.useEffect)(()=>T(!0),[a]),(0,n.Z)(()=>b(a),350,[a]);const{saveLibraryPanel:S}=(0,c.E)(),x=(0,t.useCallback)(()=>{E.libraryPanel={uid:"",name:a},S(E,v).then(A=>{A instanceof Error||y()})},[E,a,v,y,S]),O=(0,i.Z)(async()=>{try{return!(await(0,m.jh)(a)).some(A=>A.folderUid===v)}catch(A){return(0,s.kW)(A)&&(A.isHandled=!0),!0}finally{T(!1)}},[P,v]),B=!O?.value&&O.value!==void 0&&a===P&&!M;return t.createElement(t.Fragment,null,t.createElement(r.g,{label:(0,o.t)("library-panel.add-modal.name","Library panel name"),invalid:B,error:B?(0,o.t)("library-panel.add-modal.error","Library panel with this name already exists"):""},t.createElement(g.I,{id:"share-panel-library-panel-name-input",name:"name",value:a,onChange:A=>C(A.currentTarget.value)})),t.createElement(r.g,{label:(0,o.t)("library-panel.add-modal.folder","Save in folder"),description:(0,o.t)("library-panel.add-modal.folder-description","Library panel permissions are derived from the folder permissions")},t.createElement(u.Fz,{onChange:({uid:A})=>D(A),initialFolderUid:h,inputId:"share-panel-library-panel-folder-picker"})),t.createElement(d.u.ButtonRow,null,t.createElement(l.zx,{variant:"secondary",onClick:y,fill:"outline"},t.createElement(o.cC,{i18nKey:"library-panel.add-modal.cancel"},"Cancel")),t.createElement(l.zx,{onClick:x,disabled:B},t.createElement(o.cC,{i18nKey:"library-panel.add-modal.create"},"Create library panel"))))},f=({isOpen:E=!1,panel:h,initialFolderUid:y,...v})=>t.createElement(d.u,{title:"Create library panel",isOpen:E,onDismiss:v.onDismiss},t.createElement(p,{panel:h,initialFolderUid:y,onDismiss:v.onDismiss}))},97816:(j,I,e)=>{"use strict";e.d(I,{i:()=>i});var t=e(27702),n=e(3613);const i=({isOpen:s,onConfirm:r,onDismiss:g})=>t.createElement(n.s,{title:"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. However, once you make a change you will not be able to revert to its original reusable panel.`,confirmText:"Yes, unlink",onConfirm:()=>{r(),g()},onDismiss:g,isOpen:s})},73668:(j,I,e)=>{"use strict";e.d(I,{V:()=>t});function t(n){return!!n.libraryPanel?.uid}},75766:(j,I,e)=>{"use strict";e.d(I,{E8:()=>p,Ef:()=>c,Kq:()=>u,Mh:()=>d,Ob:()=>o,Pq:()=>g,UO:()=>m,jh:()=>l});var t=e(78209),n=e(48414),i=e(73170),s=e(45937),r=e(41139);async function g({searchString:f="",perPage:E=100,page:h=1,excludeUid:y="",sortDirection:v="",typeFilter:D=[],folderFilterUIDs:a=[]}={}){const C=new URLSearchParams;C.append("searchString",f),C.append("sortDirection",v),C.append("typeFilter",D.join(",")),C.append("folderFilterUIDs",a.join(",")),C.append("excludeUid",y),C.append("perPage",E.toString(10)),C.append("page",h.toString(10)),C.append("kind",r.V.Panel.toString(10));const{result:P}=await(0,s.i)().get(`/api/library-elements?${C.toString()}`);return P}async function d(f,E=!1){const h=await(0,t.n)((0,s.i)().fetch({method:"GET",url:`/api/library-elements/${f}`,showSuccessAlert:!E,showErrorAlert:!E})),{result:y}=h.data,v=new i.f({...n.Ql,schemaVersion:35,panels:[y.model]}),{scopedVars:D,...a}=v.panels[0].getSaveModel();return v.destroy(),{...y,model:a}}async function l(f){const{result:E}=await(0,s.i)().get(`/api/library-elements/name/${f}`);return E}async function u(f,E){const{result:h}=await(0,s.i)().post("/api/library-elements",{folderUid:E,name:f.libraryPanel.name,model:f,kind:r.V.Panel});return h}async function o(f){const{libraryPanel:E,...h}=f,{uid:y,name:v,version:D,folderUid:a}=E,C=r.V.Panel,{result:P}=await(0,s.i)().patch(`/api/library-elements/${y}`,{folderUid:a,name:v,model:h,version:D,kind:C});return P}function m(f){return(0,s.i)().delete(`/api/library-elements/${f}`)}async function c(f){const{result:E}=await(0,s.i)().get(`/api/library-elements/${f}/connections`);return E}async function p(f){const E=await c(f);return E.length===0?[]:await(0,s.i)().search({dashboardUIDs:E.map(y=>y.connectionUid)})}},41139:(j,I,e)=>{"use strict";e.d(I,{V:()=>t});var t=(i=>(i[i.Panel=1]="Panel",i))(t||{}),n=(i=>(i[i.Dashboard=1]="Dashboard",i))(n||{})},37024:(j,I,e)=>{"use strict";e.d(I,{E:()=>o});var t=e(58281),n=e(73289),i=e(73807),s=e(65322),r=e(75766);async function g(m,c){const p=d(m),f=await u(p,c);return l(m,f),f}function d(m){let{scopedVars:c,...p}=m.getSaveModel();return p={libraryPanel:{name:m.title,uid:void 0},...p},p}function l(m,c){m.restoreModel({...c.model,configRev:0,libraryPanel:c,title:m.title}),m.hasSavedPanelEditChange=!0,m.refresh()}function u(m,c){return m.libraryPanel?m.libraryPanel&&m.libraryPanel.uid===""?(0,r.Kq)(m,c):(0,r.Ob)(m):Promise.reject()}const o=()=>{const m=(0,i.iG)(),[c,p]=(0,t.default)(async(f,E)=>{try{const h=await g(f,E);return m.success((0,s.t)("library-panels.save.success","Library panel saved")),h}catch(h){throw(0,n.kW)(h)&&(h.isHandled=!0,m.error((0,s.t)("library-panels.save.error",'Error saving library panel: "{{errorMsg}}"',{errorMsg:h.message??h.data.message}))),h}},[]);return{state:c,saveLibraryPanel:p}}},284:(j,I,e)=>{"use strict";e.d(I,{H:()=>a});var t=e(66117),n=e(81087),i=e(3935),s=e(43685),r=e(26129),g=e(66574),d=e(43620),l=e(75261),u=e(42844),o=e(27702),m=e(66310),c=e(13741),p=e(66670),f=e(80402),E=(C=>(C.Saved="saved",C.EditingStarted="editing-started",C.EditingCanceled="editing-cancelled",C.Deleted="deleted",C))(E||{});function h({onDismiss:C,event:P}){const b=(0,m.wW)(y),M=()=>{if(P?.action===E.Deleted){r.E1.push("/");return}a.reloadPage(),C()};return o.createElement(c.u,{isOpen:!0,title:"Dashboard changed",icon:"copy",onDismiss:C,onClickBackdrop:()=>{},className:b.modal},o.createElement("div",{className:b.description},"The dashboad has been updated by another session. Do you want to continue editing or discard your local changes?"),o.createElement(c.u.ButtonRow,null,o.createElement(p.zx,{onClick:C,variant:"secondary",fill:"outline"},"Continue editing"),o.createElement(p.zx,{onClick:M,variant:"destructive"},"Discard local changes")))}const y=(0,f.B)(C=>({modal:(0,u.css)({width:"600px"}),description:(0,u.css)({color:C.colors.text.secondary,paddingBottom:C.spacing(1)})})),v=(0,t.Z)();class D{constructor(){this.editing=!1,this.observer={next:P=>{if((0,n.se)(P)&&this.editing&&P.state===n.yS.Connected&&this.sendEditingState(),(0,n.RL)(P)){if(P.message.sessionId===v)return;const{action:b}=P.message;switch(b){case E.EditingStarted:case E.Saved:{if(this.ignoreSave){this.ignoreSave=!1;return}const M=(0,l.h4)().getCurrent();if(M?.uid!==P.message.uid){console.log("dashboard event for different dashboard?",P,M);return}const T=this.editing||M.hasUnsavedChanges();if(b===E.Saved)T?g.h$.publish(new d.Dn({component:h,props:{event:P}})):(g.h$.emit(i.SI.alertSuccess,["Dashboard updated"]),this.reloadPage());else if(T&&b===E.EditingStarted&&!this.hasSeenNotice){const S=P.message,x=this.getRecentEditingEvent();(!x||x.message!==S.message)&&(this.hasSeenNotice=!0,g.h$.emit(i.SI.alertWarning,["Another session is editing this dashboard",S.message])),this.lastEditing=S}return}}}}}}setEditingState(P){const b=this.editing=P;this.editing=P,this.hasSeenNotice=!1,b&&g.Vt.isEditor&&this.sendEditingState()}sendEditingState(){const{channel:P,uid:b}=this;P&&b&&(0,s.gj)().publish(P,{sessionId:v,uid:b,action:this.editing?E.EditingStarted:E.EditingCanceled,timestamp:Date.now()})}watch(P){const b=(0,s.gj)();b&&P!==this.uid&&(this.channel={scope:n.z.Grafana,namespace:"dashboard",path:`uid/${P}`},this.leave(),P&&(this.subscription=b.getStream(this.channel).subscribe(this.observer)),this.uid=P)}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(){r.E1.reload()}}const a=new D},87755:(j,I,e)=>{"use strict";e.d(I,{A1:()=>i,g0:()=>n,iL:()=>g});var t=e(32053),n=(d=>(d.NewValuesSameSchema="NewValuesSameSchema",d.FullFrame="FullFrame",d))(n||{});const i=(d,l)=>"type"in d&&d.type===l,s=Object.values(n),r=d=>"type"in d&&s.includes(d.type),g=d=>(0,t.aY)(d)&&"packetInfo"in d},21932:(j,I,e)=>{"use strict";e.d(I,{j:()=>r});var t=e(42844),n=e(27702),i=e(66310);const s=["level","lvl","filename"],r=({labels:d})=>{const l=(0,i.wW)(g),u=Object.keys(d).filter(o=>!o.startsWith("_")&&!s.includes(o));return u.length===0?n.createElement("span",{className:(0,t.cx)([l.logsLabels])},n.createElement("span",{className:(0,t.cx)([l.logsLabel])},"(no unique labels)")):n.createElement("span",{className:(0,t.cx)([l.logsLabels])},u.sort().map(o=>{const m=d[o];if(!m)return;const c=`${o}: ${m}`;return n.createElement("span",{key:o,className:(0,t.cx)([l.logsLabel])},n.createElement("span",{className:(0,t.cx)([l.logsLabelValue]),title:c},m))}))},g=d=>({logsLabels:(0,t.css)` display: flex; flex-wrap: wrap; font-size: ${d.typography.size.xs}; `,logsLabel:(0,t.css)` label: logs-label; display: flex; padding: ${d.spacing(0,.25)}; background-color: ${d.colors.background.secondary}; border-radius: ${d.shape.borderRadius(1)}; margin: ${d.spacing(.125,.5,0,0)}; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; `,logsLabelValue:(0,t.css)` label: logs-label__value; display: inline-block; max-width: ${d.spacing(25)}; text-overflow: ellipsis; overflow: hidden; `})},62346:(j,I,e)=>{"use strict";e.d(I,{Q:()=>u});var t=e(79690),n=e(27702),i=e(3819),s=e.n(i),r=e(61329),g=e(66310);function d(o,m){return m.split(/;\s*/).reduce((c,p)=>{if(p==="color:rgba(0,0,0,0.5)")return{color:o.colors.text.secondary};const f=p.match(/([^:\s]+)\s*:\s*(.+)/);if(f&&f[1]&&f[2]){const E=f[1].replace(/-([a-z])/g,(h,y)=>y.toUpperCase());c[E]=f[2]}return c},{})}class l extends n.PureComponent{constructor(){super(...arguments),this.state={chunks:[],prevValue:""}}static getDerivedStateFromProps(m,c){return m.value===c.prevValue?null:{chunks:t.ZP.parse(m.value).spans.map(f=>f.css?{style:d(m.theme,f.css),text:f.text}:{text:f.text}),prevValue:m.value}}render(){const{chunks:m}=this.state;return m.map((c,p)=>{const f=this.props.highlight?.searchWords?n.createElement(s(),{key:p,textToHighlight:c.text,searchWords:this.props.highlight.searchWords,findChunks:r.Xt,highlightClassName:this.props.highlight.highlightClassName}):c.text;return c.style?n.createElement("span",{key:p,style:c.style,"data-testid":"ansiLogLine"},f):f})}}const u=(0,g.HE)(l);u.displayName="LogMessageAnsi"},25666:(j,I,e)=>{"use strict";e.d(I,{t:()=>s});var t=e(27702),n=e(67437),i=e(71585);const s=t.memo(({logText:r,onOpenContext:g,onPermalinkClick:d,onPinLine:l,onUnpinLine:u,pinned:o,row:m,showContextToggle:c,styles:p,mouseIsOver:f})=>{const E=c?c(m):!1,h=(0,t.useCallback)(D=>{D.stopPropagation()},[]),y=(0,t.useCallback)(D=>{D.stopPropagation(),g(m)},[g,m]),v=(0,t.useCallback)(()=>r,[r]);return t.createElement("span",{className:`log-row-menu ${p.rowMenu}`,onClick:h},o&&!f&&t.createElement(n.h,{className:p.unPinButton,size:"md",name:"gf-pin",onClick:()=>u&&u(m),tooltip:"Unpin line",tooltipPlacement:"top","aria-label":"Unpin line"}),f&&t.createElement(t.Fragment,null,E&&t.createElement(n.h,{size:"md",name:"gf-show-context",onClick:y,tooltip:"Show context",tooltipPlacement:"top","aria-label":"Show context"}),t.createElement(i.m,{className:p.copyLogButton,icon:"copy",variant:"secondary",fill:"text",size:"md",getText:v,tooltip:"Copy to clipboard",tooltipPlacement:"top"}),o&&u&&t.createElement(n.h,{className:p.unPinButton,size:"md",name:"gf-pin",onClick:()=>u&&u(m),tooltip:"Unpin line",tooltipPlacement:"top","aria-label":"Unpin line"}),!o&&l&&t.createElement(n.h,{className:p.unPinButton,size:"md",name:"gf-pin",onClick:()=>l&&l(m),tooltip:"Pin line",tooltipPlacement:"top","aria-label":"Pin line"}),d&&m.rowId!==void 0&&m.uid&&t.createElement(n.h,{tooltip:"Copy shortlink","aria-label":"Copy shortlink",tooltipPlacement:"top",size:"md",name:"share-alt",onClick:()=>d(m)})))});s.displayName="LogRowMenuCell"},5686:(j,I,e)=>{"use strict";e.d(I,{n:()=>d,r:()=>o});var t=e(27702),n=e(3819),i=e.n(n),s=e(61329),r=e(62346),g=e(25666);const d=1e5,l=({hasAnsi:m,entry:c,highlights:p,styles:f})=>{const E=p&&p.length>0&&p[0]&&p[0].length>0&&c.length<d,h=p??[];if(m){const y=E?{searchWords:h,highlightClassName:f.logsRowMatchHighLight}:void 0;return t.createElement(r.Q,{value:c,highlight:y})}else if(E)return t.createElement(i(),{textToHighlight:c,searchWords:h,findChunks:s.Xt,highlightClassName:f.logsRowMatchHighLight});return t.createElement(t.Fragment,null,c)},u=(m,c)=>{if(c)try{return JSON.stringify(JSON.parse(m),void 0,2)}catch{return m}return m},o=t.memo(m=>{const{row:c,wrapLogMessage:p,prettifyLogMessage:f,showContextToggle:E,styles:h,onOpenContext:y,onPermalinkClick:v,onUnpinLine:D,onPinLine:a,pinned:C,mouseIsOver:P}=m,{hasAnsi:b,raw:M}=c,T=(0,t.useMemo)(()=>u(M,f),[M,f]),S=(0,t.useMemo)(()=>P||C,[P,C]);return t.createElement(t.Fragment,null,t.createElement("td",{className:h.logsRowMessage},t.createElement("div",{className:p?h.positionRelative:h.horizontalScroll},t.createElement("button",{className:`${h.logLine} ${h.positionRelative}`},t.createElement(l,{hasAnsi:b,entry:T,highlights:c.searchWords,styles:h})))),t.createElement("td",{className:`log-row-menu-cell ${h.logRowMenuCell}`},S&&t.createElement(g.t,{logText:T,row:c,showContextToggle:E,onOpenContext:y,onPermalinkClick:v,onPinLine:a,onUnpinLine:D,pinned:C,styles:h,mouseIsOver:P})))});o.displayName="LogRowMessage"},66236:(j,I,e)=>{"use strict";e.d(I,{w:()=>Y});var t=e(42844),n=e(82152),i=e(27702),s=e(64167),r=e(66310);class g{constructor(){this.seen=new Set,this.count=0}getKey(Q){this.count+=1;const se=`k_${Q}`;return this.seen.has(se)?`i_${this.count}`:(this.seen.add(se),se)}}var d=e(22833),l=e(89949),u=e(60956),o=e(86312),m=e(80011),c=e(73453),p=e(34667),f=e(71585),E=e(67437),h=e(73e3),y=e(80402);const v=X=>({logsStatsRow:(0,t.css)` label: logs-stats-row; margin: ${parseInt(X.spacing(2),10)/1.75}px 0; `,logsStatsRowActive:(0,t.css)` label: logs-stats-row--active; color: ${X.colors.primary.text}; position: relative; `,logsStatsRowLabel:(0,t.css)` label: logs-stats-row__label; display: flex; margin-bottom: 1px; `,logsStatsRowValue:(0,t.css)` label: logs-stats-row__value; flex: 1; text-overflow: ellipsis; overflow: hidden; `,logsStatsRowCount:(0,t.css)` label: logs-stats-row__count; text-align: right; margin-left: ${X.spacing(.75)}; `,logsStatsRowPercent:(0,t.css)` label: logs-stats-row__percent; text-align: right; margin-left: ${X.spacing(.75)}; width: ${X.spacing(4.5)}; `,logsStatsRowBar:(0,t.css)` label: logs-stats-row__bar; height: ${X.spacing(.5)}; overflow: hidden; background: ${X.colors.text.disabled}; `,logsStatsRowInnerBar:(0,t.css)` label: logs-stats-row__innerbar; height: ${X.spacing(.5)}; overflow: hidden; background: ${X.colors.primary.main}; `}),D=({active:X,count:Q,proportion:se,value:Z})=>{const le=(0,r.wW)(v),oe=`${Math.round(se*100)}%`,q={width:oe},ne=X?(0,t.cx)([le.logsStatsRow,le.logsStatsRowActive]):(0,t.cx)([le.logsStatsRow]);return i.createElement("div",{className:ne},i.createElement("div",{className:(0,t.cx)([le.logsStatsRowLabel])},i.createElement("div",{className:(0,t.cx)([le.logsStatsRowValue]),title:Z},Z),i.createElement("div",{className:(0,t.cx)([le.logsStatsRowCount])},Q),i.createElement("div",{className:(0,t.cx)([le.logsStatsRowPercent])},oe)),i.createElement("div",{className:(0,t.cx)([le.logsStatsRowBar])},i.createElement("div",{className:(0,t.cx)([le.logsStatsRowInnerBar]),style:q})))};D.displayName="LogLabelStatsRow";const a=5,C=(0,y.B)(X=>({logsStats:(0,t.css)` label: logs-stats; background: inherit; color: ${X.colors.text.primary}; word-break: break-all; width: fit-content; max-width: 100%; `,logsStatsHeader:(0,t.css)` label: logs-stats__header; border-bottom: 1px solid ${X.colors.border.medium}; display: flex; `,logsStatsTitle:(0,t.css)` label: logs-stats__title; font-weight: ${X.typography.fontWeightMedium}; padding-right: ${X.spacing(2)}; display: inline-block; white-space: nowrap; text-overflow: ellipsis; flex-grow: 1; `,logsStatsClose:(0,t.css)` label: logs-stats__close; cursor: pointer; `,logsStatsBody:(0,t.css)` label: logs-stats__body; padding: 5px 0px; `}));class P extends i.PureComponent{render(){const{label:Q,rowCount:se,stats:Z,value:le,theme:oe,isLabel:q}=this.props,ne=C(oe),ge=Z.slice(0,a);let ae=ge.find(ke=>ke.value===le),re=Z.slice(a);const De=!ae;De&&(ae=re.find(ke=>ke.value===le),re=re.filter(ke=>ke.value!==le));const he=re.reduce((ke,et)=>ke+et.count,0),ce=ge.reduce((ke,et)=>ke+et.count,0)+he,We=he/ce;return i.createElement("div",{className:ne.logsStats,"data-testid":"logLabelStats"},i.createElement("div",{className:ne.logsStatsHeader},i.createElement("div",{className:ne.logsStatsTitle},Q,": ",ce," of ",se," rows have that ",q?"label":"field")),i.createElement("div",{className:ne.logsStatsBody},ge.map(ke=>i.createElement(D,{key:ke.value,...ke,active:ke.value===le})),De&&ae&&i.createElement(D,{key:ae.value,...ae,active:!0}),he>0&&i.createElement(D,{key:"__OTHERS__",count:he,value:"Other",proportion:We})))}}const b=(0,r.HE)(P);b.displayName="LogLabelStats";var M=e(79645);const T=(0,n.Z)(X=>({wordBreakAll:(0,t.css)` label: wordBreakAll; word-break: break-all; `,copyButton:(0,t.css)` & > button { color: ${X.colors.text.secondary}; padding: 0; justify-content: center; border-radius: ${X.shape.radius.circle}; height: ${X.spacing(X.components.height.sm)}; width: ${X.spacing(X.components.height.sm)}; svg { margin: 0; } span > div { top: -5px; & button { color: ${X.colors.success.main}; } } } `,adjoiningLinkButton:(0,t.css)` margin-left: ${X.spacing(1)}; `,wrapLine:(0,t.css)` label: wrapLine; white-space: pre-wrap; `,logDetailsStats:(0,t.css)` padding: 0 ${X.spacing(1)}; `,logDetailsValue:(0,t.css)` display: flex; align-items: center; line-height: 22px; .show-on-hover { display: inline; visibility: hidden; } &:hover { .show-on-hover { visibility: visible; } } `,buttonRow:(0,t.css)` display: flex; flex-direction: row; gap: ${X.spacing(.5)}; margin-left: ${X.spacing(.5)}; `}));class S extends i.PureComponent{constructor(){super(...arguments),this.state={showFieldsStats:!1,fieldCount:0,fieldStats:null},this.showField=()=>{const{onClickShowField:Q,parsedKeys:se,row:Z}=this.props;Q&&Q(se[0]),(0,o.ff)("grafana_explore_logs_log_details_replace_line_clicked",{datasourceType:Z.datasourceType,logRowUid:Z.uid,type:"enable"})},this.hideField=()=>{const{onClickHideField:Q,parsedKeys:se,row:Z}=this.props;Q&&Q(se[0]),(0,o.ff)("grafana_explore_logs_log_details_replace_line_clicked",{datasourceType:Z.datasourceType,logRowUid:Z.uid,type:"disable"})},this.isFilterLabelActive=async()=>{const{isFilterLabelActive:Q,parsedKeys:se,parsedValues:Z}=this.props;return Q?await Q(se[0],Z[0]):!1},this.filterLabel=()=>{const{onClickFilterLabel:Q,parsedKeys:se,parsedValues:Z,row:le}=this.props;Q&&Q(se[0],Z[0]),(0,o.ff)("grafana_explore_logs_log_details_filter_clicked",{datasourceType:le.datasourceType,filterType:"include",logRowUid:le.uid})},this.filterOutLabel=()=>{const{onClickFilterOutLabel:Q,parsedKeys:se,parsedValues:Z,row:le}=this.props;Q&&Q(se[0],Z[0]),(0,o.ff)("grafana_explore_logs_log_details_filter_clicked",{datasourceType:le.datasourceType,filterType:"exclude",logRowUid:le.uid})},this.updateStats=()=>{const{getStats:Q}=this.props,se=Q(),Z=se?se.reduce((le,oe)=>le+oe.count,0):0;(!(0,l.isEqual)(this.state.fieldStats,se)||Z!==this.state.fieldCount)&&this.setState({fieldStats:se,fieldCount:Z})},this.showStats=()=>{const{isLabel:Q,row:se,app:Z}=this.props,{showFieldsStats:le}=this.state;le||this.updateStats(),this.toggleFieldsStats(),(0,o.ff)("grafana_explore_logs_log_details_stats_clicked",{dataSourceType:se.datasourceType,fieldType:Q?"label":"detectedField",type:le?"close":"open",logRowUid:se.uid,app:Z})}}componentDidUpdate(){this.state.showFieldsStats&&this.updateStats()}toggleFieldsStats(){this.setState(Q=>({showFieldsStats:!Q.showFieldsStats}))}generateClipboardButton(Q){const{theme:se}=this.props,Z=T(se);return i.createElement("div",{className:(0,t.cx)("show-on-hover",Z.copyButton)},i.createElement(f.m,{getText:()=>Q,title:"Copy value to clipboard",fill:"text",variant:"secondary",icon:"copy",size:"md"}))}generateMultiVal(Q,se){return i.createElement("table",null,i.createElement("tbody",null,Q?.map((Z,le)=>i.createElement("tr",{key:`${Z}-${le}`},i.createElement("td",null,Z,se&&Z!==""&&this.generateClipboardButton(Z))))))}render(){const{theme:Q,parsedKeys:se,parsedValues:Z,isLabel:le,links:oe,displayedFields:q,wrapLogMessage:ne,onClickFilterLabel:ge,onClickFilterOutLabel:ae,disableActions:re}=this.props,{showFieldsStats:De,fieldStats:he,fieldCount:ye}=this.state,ce=T(Q),We=(0,M.h)(Q),ke=se==null?!1:se.length===1,et=Z==null?!1:Z.length===1,we=!re&&ge&&ae,_e=!et&&Z!=null&&!Z.every(qe=>qe===""),Ge=q&&se!=null&&q.includes(se[0])?i.createElement(E.h,{variant:"primary",tooltip:"Hide this field",name:"eye",onClick:this.hideField}):i.createElement(E.h,{tooltip:"Show this field instead of the message",name:"eye",onClick:this.showField});return i.createElement(i.Fragment,null,i.createElement("tr",{className:(0,t.cx)(We.logDetailsValue)},i.createElement("td",{className:We.logsDetailsIcon},i.createElement("div",{className:ce.buttonRow},we&&i.createElement(i.Fragment,null,p.config.featureToggles.toggleLabelsInLogsUI&&i.createElement(x,{name:"search-plus",onClick:this.filterLabel,isActive:this.isFilterLabelActive}),!p.config.featureToggles.toggleLabelsInLogsUI&&i.createElement(E.h,{name:"search-plus",onClick:this.filterLabel,tooltip:"Filter for value"}),i.createElement(E.h,{name:"search-minus",tooltip:"Filter out value",onClick:this.filterOutLabel})),!re&&q&&Ge,!re&&i.createElement(E.h,{variant:De?"primary":"secondary",name:"signal",tooltip:"Ad-hoc statistics",className:"stats-button",disabled:!ke,onClick:this.showStats}))),i.createElement("td",{className:We.logDetailsLabel},ke?se[0]:this.generateMultiVal(se)),i.createElement("td",{className:(0,t.cx)(ce.wordBreakAll,ne&&ce.wrapLine)},i.createElement("div",{className:ce.logDetailsValue},et?Z[0]:this.generateMultiVal(Z,!0),et&&this.generateClipboardButton(Z[0]),i.createElement("div",{className:(0,t.cx)((et||_e)&&ce.adjoiningLinkButton)},oe?.map((qe,st)=>i.createElement("span",{key:`${qe.title}-${st}`},i.createElement(h.k,{link:qe}))))))),De&&ke&&et&&i.createElement("tr",null,i.createElement("td",null,i.createElement(E.h,{variant:De?"primary":"secondary",name:"signal",tooltip:"Hide ad-hoc statistics",onClick:this.showStats})),i.createElement("td",{colSpan:2},i.createElement("div",{className:ce.logDetailsStats},i.createElement(b,{stats:he,label:se[0],value:Z[0],rowCount:ye,isLabel:le})))))}}const x=({isActive:X,...Q})=>{const[se,Z]=(0,i.useState)(!1);return X().then(Z),i.createElement(E.h,{...Q,variant:se?"primary":void 0,tooltip:se?"Remove filter":"Filter for value"})},O=(0,r.HE)(S);O.displayName="LogDetailsRow";var B=e(32871);class A extends i.PureComponent{render(){const{app:Q,row:se,theme:Z,hasError:le,onClickFilterOutLabel:oe,onClickFilterLabel:q,getRows:ne,showDuplicates:ge,className:ae,onClickShowField:re,onClickHideField:De,displayedFields:he,getFieldLinks:ye,wrapLogMessage:ce,styles:We}=this.props,ke=(0,M.p)(Z,se.logLevel),et=se.labels?se.labels:{},we=Object.keys(et).length>0,_e=(0,B.YD)(se,ye);let Ge=_e.filter(nt=>nt.links?.length);const qe=Ge.filter(nt=>nt.fieldIndex!==se.entryFieldIndex).sort(),st=Ge.filter(nt=>nt.fieldIndex===se.entryFieldIndex).sort(),Me=(0,B.DC)(st),be=_e.filter(nt=>nt.links?.length===0&&nt.fieldIndex!==se.entryFieldIndex).sort(),Ke=be&&be.length>0,Ye=qe&&qe.length>0||Me&&Me.length>0,tt=le?"":`${ke.logsRowLevelColor} ${We.logsRowLevel} ${We.logsRowLevelDetails}`;return i.createElement("tr",{className:(0,t.cx)(ae,We.logDetails)},ge&&i.createElement("td",null),i.createElement("td",{className:tt,"aria-label":"Log level"}),i.createElement("td",{colSpan:4},i.createElement("div",{className:We.logDetailsContainer},i.createElement("table",{className:We.logDetailsTable},i.createElement("tbody",null,(we||Ke)&&i.createElement("tr",null,i.createElement("td",{colSpan:100,className:We.logDetailsHeading,"aria-label":"Fields"},"Fields")),Object.keys(et).sort().map((nt,Pt)=>{const xt=et[nt];return i.createElement(O,{key:`${nt}=${xt}-${Pt}`,parsedKeys:[nt],parsedValues:[xt],isLabel:!0,getStats:()=>(0,d.lL)(ne(),nt),onClickFilterOutLabel:oe,onClickFilterLabel:q,onClickShowField:re,onClickHideField:De,row:se,app:Q,wrapLogMessage:ce,displayedFields:he,disableActions:!1,isFilterLabelActive:this.props.isFilterLabelActive})}),be.map((nt,Pt)=>{const{keys:xt,values:bt,fieldIndex:Rt}=nt;return i.createElement(O,{key:`${xt[0]}=${bt[0]}-${Pt}`,parsedKeys:xt,parsedValues:bt,onClickShowField:re,onClickHideField:De,onClickFilterOutLabel:oe,onClickFilterLabel:q,getStats:()=>(0,d.i6)(se.dataFrame.fields[Rt].values),displayedFields:he,wrapLogMessage:ce,row:se,app:Q,disableActions:!1,isFilterLabelActive:this.props.isFilterLabelActive})}),Ye&&i.createElement("tr",null,i.createElement("td",{colSpan:100,className:We.logDetailsHeading,"aria-label":"Data Links"},"Links")),qe.map((nt,Pt)=>{const{keys:xt,values:bt,links:Rt,fieldIndex:ct}=nt;return i.createElement(O,{key:`${xt[0]}=${bt[0]}-${Pt}`,parsedKeys:xt,parsedValues:bt,links:Rt,onClickShowField:re,onClickHideField:De,getStats:()=>(0,d.i6)(se.dataFrame.fields[ct].values),displayedFields:he,wrapLogMessage:ce,row:se,app:Q,disableActions:!1})}),Me?.map((nt,Pt)=>{const{keys:xt,values:bt,links:Rt,fieldIndex:ct}=nt;return i.createElement(O,{key:`${xt[0]}=${bt[0]}-${Pt}`,parsedKeys:xt,parsedValues:bt,links:Rt,onClickShowField:re,onClickHideField:De,getStats:()=>(0,d.i6)(se.dataFrame.fields[ct].values),displayedFields:he,wrapLogMessage:ce,row:se,app:Q,disableActions:!0})}),!Ke&&!we&&!Ye&&i.createElement("tr",null,i.createElement("td",{colSpan:100,"aria-label":"No details"},"No details available")))))))}}const V=(0,r.HE)(A);V.displayName="LogDetails";var W=e(21932),w=e(5686),N=e(25666);const F=i.memo(X=>{const{row:Q,detectedFields:se,getFieldLinks:Z,wrapLogMessage:le,styles:oe,mouseIsOver:q,pinned:ne,...ge}=X,ae=(0,B.YD)(Q,Z),re=le?"":k.noWrap,De=(0,i.useMemo)(()=>se.map(ye=>{const ce=ae.find(We=>{const{keys:ke}=We;return ke[0]===ye});return ce!=null?`${ye}=${ce.values}`:Q.labels[ye]!==void 0&&Q.labels[ye]!==null?`${ye}=${Q.labels[ye]}`:null}).filter(ye=>ye!==null).join(" "),[se,ae,Q.labels]),he=(0,i.useMemo)(()=>q||ne,[q,ne]);return i.createElement(i.Fragment,null,i.createElement("td",{className:oe.logsRowMessage},i.createElement("div",{className:re},De)),i.createElement("td",{className:`log-row-menu-cell ${oe.logRowMenuCell}`},he&&i.createElement(N.t,{logText:De,row:Q,styles:oe,pinned:ne,...ge,mouseIsOver:q})))}),k={noWrap:(0,t.css)` white-space: nowrap; `};F.displayName="LogRowMessageDisplayedFields";class H extends i.PureComponent{constructor(Q){super(Q),this.state={permalinked:!1,showingContext:!1,showDetails:!1,mouseIsOver:!1},this.debouncedContextClose=(0,l.debounce)(()=>{this.setState({showingContext:!1})},3e3),this.onOpenContext=se=>{this.setState({showingContext:!0}),this.props.onOpenContext(se,this.debouncedContextClose)},this.toggleDetails=()=>{this.props.enableLogDetails&&((0,o.ff)("grafana_explore_logs_log_details_clicked",{datasourceType:this.props.row.datasourceType,type:this.state.showDetails?"close":"open",logRowUid:this.props.row.uid,app:this.props.app}),this.setState(se=>({showDetails:!se.showDetails})))},this.onMouseEnter=()=>{this.setState({mouseIsOver:!0}),this.props.onLogRowHover&&this.props.onLogRowHover(this.props.row)},this.onMouseLeave=()=>{this.setState({mouseIsOver:!1}),this.props.onLogRowHover&&this.props.onLogRowHover(void 0)},this.scrollToLogRow=(se,Z=!1)=>{const{row:le,permalinkedRowId:oe,scrollIntoView:q,containerRendered:ne}=this.props;if(oe!==le.uid){(se.permalinked||Z)&&this.setState({permalinked:!1});return}!this.state.permalinked&&ne&&this.logLineRef.current&&q&&(q(this.logLineRef.current),(0,o.ff)("grafana_explore_logs_permalink_opened",{datasourceType:le.datasourceType??"unknown",logRowUid:le.uid}),this.setState({permalinked:!0}))},this.logLineRef=i.createRef()}renderTimeStamp(Q){return(0,u.dq)(Q,{timeZone:this.props.timeZone,defaultWithMS:!0})}componentDidMount(){this.scrollToLogRow(this.state,!0)}componentDidUpdate(Q,se){this.scrollToLogRow(se)}render(){const{getRows:Q,onClickFilterLabel:se,onClickFilterOutLabel:Z,onClickShowField:le,onClickHideField:oe,enableLogDetails:q,row:ne,showDuplicates:ge,showContextToggle:ae,showLabels:re,showTime:De,displayedFields:he,wrapLogMessage:ye,prettifyLogMessage:ce,theme:We,getFieldLinks:ke,forceEscape:et,app:we,styles:_e}=this.props,{showDetails:Ge,showingContext:qe,permalinked:st}=this.state,Me=(0,M.p)(We,ne.logLevel),{errorMessage:be,hasError:Ke}=(0,d.Mi)(ne),Ye=(0,t.cx)(_e.logsRow,{[_e.errorLogRow]:Ke,[_e.highlightBackground]:qe||st}),tt=(0,t.cx)(_e.logsRow,{[_e.errorLogRow]:Ke,[_e.highlightBackground]:st&&!this.state.showDetails}),nt=ne.hasUnescapedContent&&et?{...ne,entry:(0,d.l3)(ne.entry),raw:(0,d.l3)(ne.raw)}:ne;return i.createElement(i.Fragment,null,i.createElement("tr",{ref:this.logLineRef,className:Ye,onClick:this.toggleDetails,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave},ge&&i.createElement("td",{className:_e.logsRowDuplicates},nt.duplicates&&nt.duplicates>0?`${nt.duplicates+1}x`:null),i.createElement("td",{className:Ke?"":`${Me.logsRowLevelColor} ${_e.logsRowLevel}`},Ke&&i.createElement(m.u,{content:`Error: ${be}`,placement:"right",theme:"error"},i.createElement(c.J,{className:_e.logIconError,name:"exclamation-triangle",size:"xs"}))),q&&i.createElement("td",{title:Ge?"Hide log details":"See log details",className:_e.logsRowToggleDetails},i.createElement(c.J,{className:_e.topVerticalAlign,name:Ge?"angle-down":"angle-right"})),De&&i.createElement("td",{className:_e.logsRowLocalTime},this.renderTimeStamp(ne.timeEpochMs)),re&&nt.uniqueLabels&&i.createElement("td",{className:_e.logsRowLabels},i.createElement(W.j,{labels:nt.uniqueLabels})),he&&he.length>0?i.createElement(F,{row:nt,showContextToggle:ae,detectedFields:he,getFieldLinks:ke,wrapLogMessage:ye,onOpenContext:this.onOpenContext,onPermalinkClick:this.props.onPermalinkClick,styles:_e,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinned,mouseIsOver:this.state.mouseIsOver}):i.createElement(w.r,{row:nt,showContextToggle:ae,wrapLogMessage:ye,prettifyLogMessage:ce,onOpenContext:this.onOpenContext,onPermalinkClick:this.props.onPermalinkClick,app:we,styles:_e,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinned,mouseIsOver:this.state.mouseIsOver})),this.state.showDetails&&i.createElement(V,{className:tt,showDuplicates:ge,getFieldLinks:ke,onClickFilterLabel:se,onClickFilterOutLabel:Z,onClickShowField:le,onClickHideField:oe,getRows:Q,row:nt,wrapLogMessage:ye,hasError:Ke,displayedFields:he,app:we,styles:_e,isFilterLabelActive:this.props.isFilterLabelActive}))}}const R=(0,r.HE)(H);R.displayName="LogRow";const _=100;class G extends i.PureComponent{constructor(){super(...arguments),this.renderAllTimer=null,this.state={renderAll:!1},this.openContext=(Q,se)=>{this.props.onOpenContext&&this.props.onOpenContext(Q,se)},this.makeGetRows=(0,n.Z)(Q=>()=>Q),this.sortLogs=(0,n.Z)((Q,se)=>(0,d.$u)(Q,se))}componentDidMount(){const{logRows:Q,previewLimit:se}=this.props,le=(Q?Q.length:0)<=se*2;le?this.setState({renderAll:le}):this.renderAllTimer=window.setTimeout(()=>this.setState({renderAll:!0}),2e3)}componentWillUnmount(){this.renderAllTimer&&clearTimeout(this.renderAllTimer)}render(){const{deduplicatedRows:Q,logRows:se,dedupStrategy:Z,theme:le,logsSortOrder:oe,previewLimit:q,...ne}=this.props,{renderAll:ge}=this.state,ae=(0,M.h)(le),re=Q||se,De=se&&se.length>0,he=re?re.reduce((Ge,qe)=>qe.duplicates?Ge+qe.duplicates:Ge,0):0,ye=Z!==s.Y4.none&&he>0,ce=re||[],We=oe?this.sortLogs(ce,oe):ce,ke=We.slice(0,q),et=We.slice(q,We.length),we=this.makeGetRows(We),_e=new g;return i.createElement("table",{className:(0,t.cx)(ae.logsRowsTable,this.props.overflowingContent?"":ae.logsRowsTableContain)},i.createElement("tbody",null,De&&ke.map(Ge=>i.createElement(R,{key:_e.getKey(Ge.uid),getRows:we,row:Ge,showDuplicates:ye,logsSortOrder:oe,onOpenContext:this.openContext,styles:ae,onPermalinkClick:this.props.onPermalinkClick,scrollIntoView:this.props.scrollIntoView,permalinkedRowId:this.props.permalinkedRowId,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinnedRowId===Ge.uid,isFilterLabelActive:this.props.isFilterLabelActive,...ne})),De&&ge&&et.map(Ge=>i.createElement(R,{key:_e.getKey(Ge.uid),getRows:we,row:Ge,showDuplicates:ye,logsSortOrder:oe,onOpenContext:this.openContext,styles:ae,onPermalinkClick:this.props.onPermalinkClick,scrollIntoView:this.props.scrollIntoView,permalinkedRowId:this.props.permalinkedRowId,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinnedRowId===Ge.uid,isFilterLabelActive:this.props.isFilterLabelActive,...ne})),De&&!ge&&i.createElement("tr",null,i.createElement("td",{colSpan:5},"Rendering ",We.length-q," rows..."))))}}G.defaultProps={previewLimit:_};const Y=(0,r.HE)(G);Y.displayName="LogsRows"},79645:(j,I,e)=>{"use strict";e.d(I,{h:()=>u,p:()=>l});var t=e(42844),n=e(82152),i=e(71685),s=e(51451),r=e(96750),g=e(34667),d=e(97289);const l=(o,m)=>{let c=o.isLight?o.v1.palette.gray5:o.v1.palette.gray2;switch(m){case s.in.crit:case s.in.critical:c="#705da0";break;case s.in.error:case s.in.err:c="#e24d42";break;case s.in.warning:case s.in.warn:c=o.colors.warning.main;break;case s.in.info:c="#7eb26d";break;case s.in.debug:c="#1f78c1";break;case s.in.trace:c="#6ed0e0";break}return{logsRowLevelColor:(0,t.css)` &::after { background-color: ${c}; } `}},u=(0,n.Z)(o=>{const m=d.hoverColor(o.colors.background.secondary,o),c=(0,i.Z)(o.components.dashboard.background).setAlpha(.7).toRgbString(),p=g.config.featureToggles.exploreScrollableLogsContainer;return{logsRowLevel:(0,t.css)` label: logs-row__level; max-width: ${o.spacing(1.25)}; cursor: default; &::after { content: ''; display: block; position: absolute; top: 1px; bottom: 1px; width: 3px; left: ${o.spacing(.5)}; } `,logsRowMatchHighLight:(0,t.css)` label: logs-row__match-highlight; background: inherit; padding: inherit; color: ${o.components.textHighlight.text} background-color: ${o.components.textHighlight}; `,logsRowsTable:(0,t.css)` label: logs-rows; font-family: ${o.typography.fontFamilyMonospace}; font-size: ${o.typography.bodySmall.fontSize}; width: 100%; ${!p&&`margin-bottom: ${o.spacing(2.25)};`} `,logsRowsTableContain:(0,t.css)` contain: strict; `,highlightBackground:(0,t.css)` background-color: ${(0,i.Z)(o.colors.info.transparent).setAlpha(.25).toString()}; `,logsRow:(0,t.css)` label: logs-row; width: 100%; cursor: pointer; vertical-align: top; &:hover { .log-row-menu { z-index: 1; } background: ${m}; } td:not(.log-row-menu-cell):last-child { width: 100%; } > td:not(.log-row-menu-cell) { position: relative; padding-right: ${o.spacing(1)}; border-top: 1px solid transparent; border-bottom: 1px solid transparent; height: 100%; } `,logsRowDuplicates:(0,t.css)` label: logs-row__duplicates; text-align: right; width: 4em; cursor: default; `,logIconError:(0,t.css)` color: ${o.colors.warning.main}; `,logsRowToggleDetails:(0,t.css)` label: logs-row-toggle-details__level; font-size: 9px; padding-top: 5px; max-width: 15px; `,logsRowLocalTime:(0,t.css)` label: logs-row__localtime; white-space: nowrap; `,logsRowLabels:(0,t.css)` label: logs-row__labels; white-space: nowrap; max-width: 22em; /* This is to make the labels vertical align */ > span { margin-top: 0.75px; } `,logsRowMessage:(0,t.css)` label: logs-row__message; white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; width: 100%; text-align: left; `,copyLogButton:(0,t.css)` padding: 0 0 0 ${o.spacing(.5)}; height: ${o.spacing(3)}; width: ${o.spacing(3.25)}; line-height: ${o.spacing(2.5)}; overflow: hidden; &:hover { background-color: ${r.alpha(o.colors.text.primary,.12)}; } } `,logDetailsContainer:(0,t.css)` label: logs-row-details-table; border: 1px solid ${o.colors.border.medium}; padding: 0 ${o.spacing(1)} ${o.spacing(1)}; border-radius: ${o.shape.radius.default}; margin: ${o.spacing(2.5)} ${o.spacing(1)} ${o.spacing(2.5)} ${o.spacing(2)}; cursor: default; `,logDetailsTable:(0,t.css)` label: logs-row-details-table; line-height: 18px; width: 100%; td:last-child { width: 100%; } `,logsDetailsIcon:(0,t.css)` label: logs-row-details__icon; position: relative; color: ${o.v1.palette.gray3}; padding-top: 1px; padding-bottom: 1px; padding-right: ${o.spacing(.75)}; `,logDetailsLabel:(0,t.css)` label: logs-row-details__label; max-width: 30em; min-width: 20em; padding: 0 ${o.spacing(1)}; overflow-wrap: break-word; `,logDetailsHeading:(0,t.css)` label: logs-row-details__heading; font-weight: ${o.typography.fontWeightBold}; padding: ${o.spacing(1)} 0 ${o.spacing(.5)}; `,logDetailsValue:(0,t.css)` label: logs-row-details__row; position: relative; vertical-align: middle; cursor: default; &:hover { background-color: ${m}; } `,topVerticalAlign:(0,t.css)` label: topVerticalAlign; margin-top: -${o.spacing(.9)}; margin-left: -${o.spacing(.25)}; `,detailsOpen:(0,t.css)` &:hover { background-color: ${d.hoverColor(o.colors.background.primary,o)}; } `,errorLogRow:(0,t.css)` label: erroredLogRow; color: ${o.colors.text.secondary}; `,positionRelative:(0,t.css)` label: positionRelative; position: relative; `,rowWithContext:(0,t.css)` label: rowWithContext; z-index: 1; outline: 9999px solid ${c}; display: inherit; `,horizontalScroll:(0,t.css)` label: horizontalScroll; white-space: pre; `,contextNewline:(0,t.css)` display: block; margin-left: 0px; `,rowMenu:(0,t.css)` label: rowMenu; display: flex; flex-wrap: nowrap; flex-direction: row; align-content: flex-end; justify-content: space-evenly; align-items: center; position: absolute; top: 0; bottom: auto; background: ${o.colors.background.primary}; box-shadow: ${o.shadows.z3}; padding: ${o.spacing(.5,1,.5,1)}; z-index: 100; gap: ${o.spacing(.5)}; & > button { margin: 0; } `,logRowMenuCell:(0,t.css)` position: sticky; z-index: ${o.zIndex.dropdown}; margin-top: -${o.spacing(.125)}; right: 0px; & > span { transform: translateX(-100%); } `,logLine:(0,t.css)` background-color: transparent; border: none; diplay: inline; font-family: ${o.typography.fontFamilyMonospace}; font-size: ${o.typography.bodySmall.fontSize}; letter-spacing: ${o.typography.bodySmall.letterSpacing}; text-align: left; padding: 0; user-select: text; `,logsRowLevelDetails:(0,t.css)` label: logs-row__level_details; &::after { top: -3px; } `,logDetails:(0,t.css)` label: logDetailsDefaultCursor; cursor: default; &:hover { background-color: ${o.colors.background.primary}; } `,visibleRowMenu:(0,t.css)` label: visibleRowMenu; aspect-ratio: 1/1; z-index: 90; `,linkButton:(0,t.css)` label: linkButton; > button { padding-top: ${o.spacing(.5)}; } `,hidden:(0,t.css)` label: hidden; visibility: hidden; `,unPinButton:(0,t.css)` height: ${o.spacing(3)}; line-height: ${o.spacing(2.5)}; `}})},32871:(j,I,e)=>{"use strict";e.d(I,{B2:()=>l,DC:()=>d,YD:()=>g,i2:()=>o});var t=e(89949),n=e.n(t),i=e(82152),s=e(89024),r=e(14237);const g=(0,i.Z)((m,c)=>{const p=l(m,c);return Object.values(p)}),d=(0,i.Z)(m=>{let c=[];return m.forEach(p=>{p.links?.forEach(f=>{if(f.variables){const E=f.variables.map(y=>{const v=y.variableName,D=y.fieldPath?`.${y.fieldPath}`:"";return`${v}${D}`}),h=f.variables.map(y=>y.found?y.value:"");c.push({keys:E,values:h,links:[f],fieldIndex:p.fieldIndex})}})}),c}),l=(0,i.Z)((m,c)=>o(m.dataFrame).visible.filter(E=>E.values[m.rowIndex]!=null).map(E=>{const h=c?c(E,m.rowIndex,m.dataFrame):[],y=E.values[m.rowIndex],v=typeof y=="string"||typeof y=="number"?y.toString():(0,s.Xh)(y);return{keys:[E.name],values:[v],links:h,fieldIndex:E.index}}));function u(m,c){const p=(0,r.L)(m);if(p===null)return new Set;const f=new Set(p.extraFields.map(E=>E.index));return p.severityField!==null&&f.add(p.severityField.index),c.keepBody&&f.add(p.bodyField.index),c.keepTimestamp&&f.add(p.timeField.index),f}function o(m,c){const p=m.fields.map((y,v)=>({...y,index:v})),f=u(m,c??{}),[E,h]=(0,t.partition)(p,y=>y.config.custom?.hidden?!1:(y.config.links??[]).length>0?!0:f.has(y.index));return{visible:E,hidden:h}}},14237:(j,I,e)=>{"use strict";e.d(I,{L:()=>E});var t=e(31832),n=e(29241),i=e(43987);function s(h,y){const v=h.labels;if(v!==void 0){const D=new Array(y);return D.fill(v),D}else return null}function r(h,y,v){if(v.meta?.custom?.frameType==="LabeledTimeValues"){const D=h.getFieldByName("labels");return D===void 0?[null,()=>null]:[D,()=>D.values]}else return[null,()=>s(y,v.length)]}function g(h){const y=new t.N(h),v=y.getFirstFieldOfType(n.fS.time),D=y.getFirstFieldOfType(n.fS.string);if(v===void 0||D===void 0)return null;const a=y.getFieldByName("tsNs")??null,C=y.getFieldByName("level")??null,P=y.getFieldByName("id")??null,[b,M]=r(y,D,h),T=y.fields.filter((S,x)=>x!==v.index&&x!==D.index&&x!==a?.index&&x!==C?.index&&x!==P?.index&&x!==b?.index);return{timeField:v,bodyField:D,timeNanosecondField:a,severityField:C,idField:P,getAttributes:M,getAttributesAsLabels:M,extraFields:T}}function d(h,y,v){const D=h.getFieldByName(y);if(D!==void 0)return D.type===v?D:void 0}const l="timestamp",u="body",o="severity",m="id",c="attributes";function p(h){const y={};return Object.entries(h).forEach(([v,D])=>{y[v]=typeof D=="string"?D:JSON.stringify(D)}),y}function f(h){const y=new t.N(h),v=d(y,l,n.fS.time),D=d(y,u,n.fS.string);if(v===void 0||D===void 0)return null;const a=d(y,o,n.fS.string)??null,C=d(y,m,n.fS.string)??null,P=d(y,c,n.fS.other)??null,b=P===null?null:P.values,M=y.fields.filter((T,S)=>S!==v.index&&S!==D.index&&S!==a?.index&&S!==C?.index&&S!==P?.index);return{timeField:v,bodyField:D,severityField:a,idField:C,getAttributes:()=>b,timeNanosecondField:null,getAttributesAsLabels:()=>b!==null?b.map(p):null,extraFields:M}}function E(h){return h.meta?.type===i.P.LogLines?f(h):g(h)}},30209:(j,I,e)=>{"use strict";e.d(I,{Qp:()=>T,aB:()=>R,UW:()=>N,nu:()=>F,Nw:()=>k,Ce:()=>oe,Bz:()=>le});var t=e(89949),n=e(48592),i=e(7536),s=e(91053),r=e(51451),g=e(64167),d=e(32053),l=e(31832),u=e(29241),o=e(93666),m=e(99633),c=e(14951),p=e(48154),f=e(60956),E=e(76305),h=e(53933),y=e(51455),v=e(5354),D=e(79690),a=e(12308);function C(ne,ge){return a.default.bootData.user.lightTheme?ge:ne}var P=e(14237),b=e(22833);const M="Line limit",T="Common labels",S={[r.in.critical]:v.O9[7],[r.in.warning]:v.O9[1],[r.in.error]:v.O9[4],[r.in.info]:v.O9[0],[r.in.debug]:v.O9[5],[r.in.trace]:v.O9[2],[r.in.unknown]:C("#8e8e8e","#bdc4cd")},x=1,O=1e3*x,B=60*O,A=60*B,V=24*A,W=/\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(ne,ge,ae){switch(ae){case g.Y4.exact:return ne.entry.replace(W,"")===ge.entry.replace(W,"");case g.Y4.numbers:return ne.entry.replace(/\d/g,"")===ge.entry.replace(/\d/g,"");case g.Y4.signature:return ne.entry.replace(/\w/g,"")===ge.entry.replace(/\w/g,"");default:return!1}}function N(ne,ge){return ge===g.Y4.none?ne:ne.reduce((ae,re,De)=>{const he={...re},ye=ae[ae.length-1];return De>0&&w(re,ye,ge)?ye.duplicates++:(he.duplicates=0,ae.push(he)),ae},[])}function F(ne,ge){return ge.size===0?ne:ne.filter(ae=>!ge.has(ae.logLevel))}function k(ne,ge){const ae={},re=[];for(const De of ne){let he=ae[De.logLevel];he||(ae[De.logLevel]=he={lastTs:null,datapoints:[],target:De.logLevel,color:S[De.logLevel]},re.push(he));const ye=Math.floor(De.timeEpochMs/ge)*ge;ye===he.lastTs?he.datapoints[he.datapoints.length-1][0]++:(he.datapoints.push([1,ye]),he.lastTs=ye);for(const ce of re)ce!==he&&ce.lastTs!==ye&&(ce.datapoints.push([0,ye]),ce.lastTs=ye)}return re.map((De,he)=>{De.datapoints.sort((ke,et)=>ke[1]-et[1]);const ye=(0,d.g0)(De),We=new l.N(ye).getFirstFieldOfType(u.fS.number);return ye.fields[We.index].config.min=0,ye.fields[We.index].config.decimals=0,ye.fields[We.index].config.color={mode:o.S.Fixed,fixedColor:De.color},ye.fields[We.index].config.custom={drawStyle:g.l8.Bars,barAlignment:g.pu.Center,barWidthFactor:.9,barMaxWidth:5,lineColor:De.color,pointColor:De.color,fillColor:De.color,lineWidth:0,fillOpacity:100,stacking:{mode:g.o0.Normal,group:"A"}},ye})}function H(ne){return ne.fields.some(ge=>ge.type===u.fS.time)&&ne.fields.some(ge=>ge.type===u.fS.string)}function R(ne,ge,ae,re){const{logSeries:De}=G(ne),he=X(De,re);if(he){if(ge&&he.rows.length>0){const ye=he.rows.sort(b.DA),{visibleRange:ce,bucketSize:We,visibleRangeMs:ke,requestedRangeMs:et}=_(ye,ge,ae);he.visibleRange=ce,he.bucketSize=We,he.series=k(ye,We),he.meta&&(he.meta=Q(he,ke,et))}else he.series=[];return he.queries=re,he}return{hasUniqueLabels:!1,rows:[],meta:[],series:[],queries:re}}function _(ne,ge,ae,re=20,De=1e3){let he=ae,ye=ge,ce=Math.max(ye*re,De),We,ke;if(ae){const et=ne[0].timeEpochMs;if(ke=ae.to-ae.from,We=ae.to-et,We>0){const we=We/ke;ye*=we,ce=Math.max(Math.ceil(ye*re),De),he={from:Math.floor(et/ce)*ce,to:ae.to}}else We=1}return{bucketSize:ce,visibleRange:he,visibleRangeMs:We,requestedRangeMs:ke}}function G(ne){const ge=[],ae=[];for(const re of ne){if(H(re)||!re.fields.length){ae.push(re);continue}re.length>0&&ge.push(re)}return{logSeries:ae,metricSeries:ge}}function Y(ne,ge,ae){const re=ne.values[ae],he=(0,m.zh)(re).valueOf();if(ge)return{ts:re,timeEpochMs:he,timeEpochNs:ge.values[ae]};if(ne.nanos!==void 0){const ye=ne.nanos[ae].toString().padStart(6,"0"),ce=`${he}${ye}`;return{ts:re,timeEpochMs:he,timeEpochNs:ce}}return{ts:re,timeEpochMs:he,timeEpochNs:he+"000000"}}function X(ne,ge=[]){if(ne.length===0)return;const ae=[];let re=[];const De=ne.filter(Me=>Me.fields.length);De.length&&De.forEach(Me=>{const be=(0,P.L)(Me);if(be!=null){const Ke=be.getAttributesAsLabels()??void 0,Ye={rawFrame:Me,logsFrame:be,frameLabels:Ke};re.push(Ye),Ke&&Ke.length>0&&ae.push(Ke)}});const he=ae.flat(),ye=he.length>0?(0,c.FT)(he):{},ce=[];let We=!1;for(const Me of re){const{logsFrame:be,rawFrame:Ke,frameLabels:Ye}=Me,{timeField:tt,timeNanosecondField:nt,bodyField:Pt,severityField:xt,idField:bt}=be;for(let Rt=0;Rt<Ke.length;Rt++){const{ts:ct,timeEpochMs:it,timeEpochNs:me}=Y(tt,nt??void 0,Rt),Ee=Pt.values[Rt]??"",Ce=typeof Ee=="string"?Ee:JSON.stringify(Ee),Ae=p.QX.hasAnsiCodes(Ce),ze=!!Ce.match(/\\n|\\t|\\r/),Ie=Ke.meta?.custom?.searchWords??Ke.meta?.searchWords??[],xe=Ae?D._J.strip(Ce):Ce,Te=Ye?.[Rt],Oe=(0,c.IU)(Te,ye);Object.keys(Oe).length>0&&(We=!0);let ie=r.in.unknown;const Le=xt&&xt.values[Rt]||Te&&Te.level;Le?ie=(0,b.jx)(Le):ie=(0,b.ZO)(xe);const Be=ge.find(ue=>ue.refId===Ke.refId)?.datasource?.type,Ue={entryFieldIndex:Pt.index,rowIndex:Rt,dataFrame:Ke,logLevel:ie,timeFromNow:(0,f.E8)(ct),timeEpochMs:it,timeEpochNs:me,timeLocal:(0,f.dq)(ct,{timeZone:"browser"}),timeUtc:(0,f.dq)(ct,{timeZone:"utc"}),uniqueLabels:Oe,hasAnsi:Ae,hasUnescapedContent:ze,searchWords:Ie,entry:xe,raw:Ce,labels:Te||{},uid:`${Ke.refId}_${bt?bt.values[Rt]:Rt.toString()}`,datasourceType:Be};bt!==null&&(Ue.rowId=bt.values[Rt]),ce.push(Ue)}}const ke=[];(0,t.size)(ye)>0&&ke.push({label:T,value:ye,kind:r.Ku.LabelsMap});const we=ne.filter(Me=>Me?.meta?.custom?.limit??Me?.meta?.limit).reduce((Me,be)=>(Me[be.refId??""]=be.meta?.custom?.limit??be.meta?.limit??0,Me),{}),_e=Object.values(we).reduce((Me,be)=>Me+=be,0);_e>0&&ke.push({label:M,value:_e,kind:r.Ku.Number});let Ge=0;const qe={};let st=!1;for(const Me of ne){const be=Me.meta?.custom?.lokiQueryStatKey,{refId:Ke}=Me;if(!st&&Me.meta?.custom?.error&&(ke.push({label:"",value:Me.meta?.custom.error,kind:r.Ku.Error}),st=!0),Ke&&!qe[Ke]){if(be&&Me.meta?.stats){const Ye=Me.meta.stats.find(tt=>tt.displayName===be);Ye&&(Ge+=Ye.value)}qe[Ke]=!0}}if(Ge>0){const{text:Me,suffix:be}=(0,y.i7)("B")(Ge);ke.push({label:"Total bytes processed",value:`${Me} ${be}`,kind:r.Ku.String})}return{hasUniqueLabels:We,meta:ke,rows:ce}}function Q(ne,ge,ae){let re=[...ne.meta];const De=re.findIndex(ye=>ye.label===M),he=De>=0&&re[De]?.value;if(he&&he>0){let ye;if(he===ne.rows.length&&ge&&ae){const ce=(ge/ae*100).toFixed(2);ye=`${he} reached, received logs cover ${ce}% (${E.msRangeToTimeString(ge)}) of your selected time range (${E.msRangeToTimeString(ae)})`}else ye=`${he} (${ne.rows.length} returned)`;re[De]={label:M,value:ye,kind:r.Ku.String}}return re}function se(ne,ge){const ae=ge&&ne===r.in.unknown?"logs":ne,re=S[ne];return{displayNameFromDS:ae,color:{mode:o.S.Fixed,fixedColor:re},custom:{drawStyle:g.l8.Bars,barAlignment:g.pu.Center,lineColor:re,pointColor:re,fillColor:re,lineWidth:1,fillOpacity:100,stacking:{mode:g.o0.Normal,group:"A"}}}}const Z=(ne,ge,ae)=>(ne.fields=ne.fields.map(re=>(re.type===u.fS.number&&(re.config={...re.config,...se(ge(ne),ae)}),re)),ne);function le(ne,ge,ae){const re=ae.range.to.valueOf()-ae.range.from.valueOf(),De=q(ge.scopedVars,re);return ge.interval=De.interval,ge.scopedVars.__interval={value:De.interval,text:De.interval},De.intervalMs!==void 0&&(ge.intervalMs=De.intervalMs,ge.scopedVars.__interval_ms={value:De.intervalMs,text:De.intervalMs}),ge.hideFromInspector=!0,new n.y(he=>{let ye=[];he.next({state:h.Gu.Loading,error:void 0,data:[]});const ce=ne.query(ge),ke=((0,i.b)(ce)?ce:(0,s.D)(ce)).subscribe({complete:()=>{he.complete()},next:et=>{const{error:we}=et;if(we!==void 0)he.next({state:h.Gu.Error,error:we,data:[]}),he.error(we);else{const _e=(0,t.groupBy)(et.data,"refId");ye=et.data.map(Ge=>{let qe=Ge.refId||"";qe.startsWith("log-volume-")&&(qe=qe.substr(11));const st={logsVolumeType:r.o8.FullRange,absoluteRange:{from:ae.range.from.valueOf(),to:ae.range.to.valueOf()},datasourceName:ne.name,sourceQuery:ae.targets.find(Me=>Me.refId===qe)};return Ge.meta={...Ge.meta,custom:{...Ge.meta?.custom,...st}},Z(Ge,ae.extractLevel,_e[Ge.refId].length===1)}),he.next({state:et.state,error:void 0,data:ye})}},error:et=>{he.next({state:h.Gu.Error,error:et,data:[]}),he.error(et)}});return()=>{ke?.unsubscribe()}})}function oe(ne,ge){return ge.hideFromInspector=!0,new n.y(ae=>{let re=[];ae.next({state:h.Gu.Loading,error:void 0,data:[]});const De=ne.query(ge),ye=((0,i.b)(De)?De:(0,s.D)(De)).subscribe({complete:()=>{ae.next({state:h.Gu.Done,error:void 0,data:re}),ae.complete()},next:ce=>{const{error:We}=ce;We!==void 0?(ae.next({state:h.Gu.Error,error:We,data:[]}),ae.error(We)):re=ce.data.map(ke=>{const et=(0,d.g0)(ke),{timeIndex:we}=(0,d.sV)(et);return(0,d.aK)(et,we)})},error:ce=>{ae.next({state:h.Gu.Error,error:ce,data:[]}),ae.error(ce)}});return()=>{ye?.unsubscribe()}})}function q(ne,ge){if(ne.__interval_ms){let ae=ne.__interval_ms.value,re="";return ge<O*5?(ae=x,re="1ms"):ae>A?(ae=V,re="1d"):ae>B?(ae=A,re="1h"):ae>O?(ae=B,re="1m"):(ae=O,re="1s"),{interval:re,intervalMs:ae}}else return{interval:"$__interval"}}},22833:(j,I,e)=>{"use strict";e.d(I,{$u:()=>y,DA:()=>f,Di:()=>a,FP:()=>M,Js:()=>b,Mi:()=>v,ZO:()=>u,_c:()=>P,hY:()=>C,i6:()=>c,j0:()=>h,jx:()=>o,l3:()=>D,lL:()=>m});var t=e(89949),n=e.n(t),i=e(51451),s=e(64167),r=e(31832),g=e(29241),d=e(72164),l=e(32871);function u(T){if(!T)return i.in.unknown;let S=i.in.unknown,x;for(const O of Object.keys(i.in)){const A=new RegExp(`\\b${O}\\b`,"i").exec(T);A&&(x===void 0||A.index<x)&&(S=i.in[O],x=A.index)}return S}function o(T){const S=i.in[T.toString().toLowerCase()];return S||i.in.unknown}function m(T,S){const x=T.filter(A=>A.labels[S]!==void 0),O=x.length,B=(0,t.countBy)(x,A=>A.labels[S]);return p(B,O)}function c(T){const S=T.filter(O=>O!=null),x=(0,t.countBy)(S);return p(x,S.length)}const p=(T,S)=>(0,t.chain)(T).map((x,O)=>({count:x,value:O,proportion:x/S})).sortBy("count").reverse().value(),f=(T,S)=>T.timeEpochMs<S.timeEpochMs?-1:T.timeEpochMs>S.timeEpochMs?1:T.timeEpochNs<S.timeEpochNs?-1:T.timeEpochNs>S.timeEpochNs?1:0,E=(T,S)=>T.timeEpochMs>S.timeEpochMs?-1:T.timeEpochMs<S.timeEpochMs?1:T.timeEpochNs>S.timeEpochNs?-1:T.timeEpochNs<S.timeEpochNs?1:0,h=(T,S)=>{const x=T?y(T.rows,S):[];return T?{...T,rows:x}:{hasUniqueLabels:!1,rows:x}},y=(T,S)=>S===s.UV.Ascending?T.sort(f):T.sort(E),v=T=>T.labels.__error__?{hasError:!0,errorMessage:T.labels.__error__}:{hasError:!1},D=T=>T.replace(/\\r\\n|\\n|\\t|\\r/g,S=>S.slice(1)==="t"?" ":` `);function a(T){return T.map(S=>{const x=(0,l.B2)(S).reduce((O,B)=>{const A=B.keys[0];return O[A]=B.values[0],O},{});return{line:S.entry,timestamp:S.timeEpochNs,fields:{...x,...S.labels}}})}const C=T=>{let S={from:1/0,to:-1/0};return T.forEach(x=>{const O=x.meta?.custom||{};O.absoluteRange?.from&&O.absoluteRange?.to&&(S={from:Math.min(S.from,O.absoluteRange.from),to:Math.max(S.to,O.absoluteRange.to)})}),S},P=T=>{if(T.length===0)throw new Error("Cannot aggregate data frames: there must be at least one data frame to aggregate");const S={},x={};let O=-1/0;const B={};let A=[];return T.forEach(V=>{const W=new r.N(V),w=W.getFirstFieldOfType(g.fS.time),N=W.getFirstFieldOfType(g.fS.number);if(!w)throw new Error("Missing time field");if(!N)throw new Error("Missing value field");const F=N.config.displayNameFromDS||V.name||"logs",k=N.values.length;B[F]={meta:V.meta,valueFieldConfig:N.config,timeFieldConfig:w.config};for(let H=0;H<k;H++){const R=w.values[H],_=N.values[H];S[F]??={},S[F][R]=(S[F][R]||0)+_,x[R]=(x[R]||0)+_,O=Math.max(x[R],O)}}),Object.keys(S).forEach(V=>{const W=new d.v,{meta:w,timeFieldConfig:N,valueFieldConfig:F}=B[V];W.name=V,W.meta=w,W.addField({name:"Time",type:g.fS.time,config:N}),W.addField({name:"Value",type:g.fS.number,config:F});for(const k in S[V]){const H=S[V][k];W.add({Time:Number(k),Value:H})}A.push(W)}),{dataFrames:A,maximum:O}},b=T=>{const S=T[0]?.meta?.custom;return S&&S.datasourceName?{name:S.datasourceName}:null},M=T=>T[0]?.meta?.custom?.logsVolumeType===i.o8.Limited},92983:(j,I,e)=>{"use strict";e.d(I,{H:()=>m});var t=e(27702),n=e(60729),i=e(66670),s=e(39705),r=e(42844),g=e(66310),d=e(3613);const l=({title:c})=>{const p=(0,g.wW)(o);return t.createElement("p",{className:p.description},c?"Are you sure you want to revoke this URL? The dashboard will no longer be public.":"Orphaned public dashboard will no longer be public.")},u=({dashboardTitle:c,onConfirm:p,onDismiss:f})=>t.createElement(d.s,{isOpen:!0,body:t.createElement(l,{title:c}),onConfirm:p,onDismiss:f,title:"Revoke public URL",icon:"trash-alt",confirmText:"Revoke public URL"}),o=c=>({title:(0,r.css)` margin-bottom: ${c.spacing(1)}; `,description:(0,r.css)` font-size: ${c.typography.body.fontSize}; `}),m=({dashboard:c,publicDashboard:p,loader:f,children:E,onDismiss:h,...y})=>{const[v,{isLoading:D}]=(0,s.bS)(),a=(C,P)=>{v({dashboard:c,uid:C.uid,dashboardUid:C.dashboardUid}),P()};return t.createElement(n.JY,null,({showModal:C,hideModal:P})=>t.createElement(i.zx,{"aria-label":"Revoke public URL",title:"Revoke public URL",onClick:()=>C(u,{dashboardTitle:p.title,onConfirm:()=>a(p,P),onDismiss:()=>{h?h():P()}}),...y},D&&f?f:E))}},39345:(j,I,e)=>{"use strict";e.d(I,{t:()=>s});var t=e(63064);class n extends Error{constructor(g,d){super(d),this.type=g}}class i{constructor(){this.rootName="general"}validateNewDashboardName(g,d){return this.validate(g,d,"A dashboard or a folder with the same name already exists")}validateNewFolderName(g){return this.validate(this.rootName,g,"A folder or dashboard in the general folder with the same name already exists")}async validate(g,d,l){d=(d||"").trim();const u=d.toLowerCase();if(d.length===0)throw new n("REQUIRED","Name is required");if(u===this.rootName)throw new n("EXISTING","This is a reserved name and cannot be used for a folder.");const m=await(0,t.getGrafanaSearcher)().search({kind:["dashboard"],query:d,location:g||"general"});for(const c of m.view)if(u===c.name.toLowerCase())throw new n("EXISTING",l)}}const s=new i},77799:(j,I,e)=>{"use strict";e.d(I,{$j:()=>y,EW:()=>V,Fd:()=>b,Jx:()=>D,L6:()=>S,Pb:()=>A,ZL:()=>B,ct:()=>a,iM:()=>W,nQ:()=>p,q_:()=>c,uC:()=>M,ys:()=>h});var t=e(94469),n=e(73289),i=e(26129),s=e(10864),r=e(33877),g=e(73807),d=e(284),l=e(18771),u=e(75766),o=e(41139),m=e(91399);function c(N){return async F=>{try{F((0,m.AK)());const k=await(0,n.i)().get(`/api/gnet/dashboards/${N}`);F((0,m.S9)(k)),F(f(k.json)),F(E(k.json))}catch(k){F((0,m.eh)()),(0,n.kW)(k)&&F((0,r.$l)((0,g.t_)(k.data.message||k)))}}}function p(N){return async F=>{F((0,m.Nw)(N)),F(f(N)),F(E(N))}}function f(N){return F=>{if(N&&N.__inputs){const k=[];N.__inputs.forEach(H=>{const R={name:H.name,label:H.label,info:H.description,value:H.value,type:H.type,pluginId:H.pluginId,options:[]};H.type===m.n$.DataSource?v(H,R):R.info||(R.info="Specify a string constant"),k.push(R)}),F((0,m.Zc)(k))}}}function E(N){return async function(F){if(!N||!N.__elements)return;const k=[];for(const H of Object.values(N.__elements)){if(H.kind!==o.V.Panel)continue;const R=H.model,{type:_,description:G}=R,{uid:Y,name:X}=H,Q={model:{model:R,uid:Y,name:X,version:0,type:_,kind:o.V.Panel,description:G},state:m.KQ.New};try{const se=await(0,u.Mh)(Y,!0);Q.state=m.KQ.Exists,Q.model=se}catch(se){if(se.status!==404)throw se}k.push(Q)}F((0,m.C2)(k))}}function h(){return N=>{N((0,m.MO)())}}function y(N){return async(F,k)=>{const H=k().importDashboard.dashboard,R=k().importDashboard.inputs;let _=[];N.dataSources?.forEach((X,Q)=>{const se=R.dataSources[Q];_.push({name:se.name,type:se.type,pluginId:se.pluginId,value:X.uid})}),N.constants?.forEach((X,Q)=>{const se=R.constants[Q];_.push({value:X,name:se.name,type:se.type})});const G=await(0,n.i)().post("api/dashboards/import",{dashboard:{...H,title:N.title,uid:N.uid||H.uid},overwrite:!0,inputs:_,folderUid:N.folder.uid}),Y=t.u.stripBaseFromUrl(G.importedUrl);i.E1.push(Y)}}const v=(N,F)=>{(0,s.F)().getList({pluginId:N.pluginId}).length===0?F.info="No data sources of type "+N.pluginName+" found":F.info||(F.info="Select a "+N.pluginName+" data source")};async function D(N,F){const k={totalCount:N.length,successCount:0};for(const H of N)try{await x(H,F)!==null&&(k.successCount+=1)}catch(R){console.error("Failed to move a folder",R)}return k}function a(N,F){const k=[];for(const H of N)k.push(P(C,!0,H,F));return w(k).then(H=>({totalCount:H.length,successCount:H.filter(R=>R.succeeded).length,alreadyInFolderCount:H.filter(R=>R.alreadyInFolder).length}))}async function C(N,F){const k=await(0,n.i)().get(`/api/dashboards/uid/${N}`);if((k.meta.folderUid===void 0||k.meta.folderUid===null)&&F.uid===""||k.meta.folderUid===F.uid)return{alreadyInFolder:!0};const H={dashboard:k.dashboard,folderUid:F.uid,overwrite:!1};try{return await M(H),{succeeded:!0}}catch(R){if((0,n.kW)(R)){if(R.data?.status!=="plugin-dashboard")return{succeeded:!1};R.isHandled=!0}H.overwrite=!0;try{return await M(H),{succeeded:!0}}catch{return{succeeded:!1}}}}function P(N,F,...k){return async H=>{try{const R=await N(...k);return Array.prototype.concat(H,[R])}catch(R){if(F)return H;throw R}}}function b(N,F){const k=[];for(const H of N)k.push(P(T,!0,H,!0));for(const H of F)k.push(P(W,!0,H,!0));return w(k)}function M(N){return d.H.ignoreNextSave(),(0,n.i)().post("/api/dashboards/db/",{dashboard:N.dashboard,message:N.message??"",overwrite:N.overwrite??!1,folderUid:N.folderUid})}function T(N,F){return(0,n.i)().delete(`/api/folders/${N}?forceDeleteRules=false`,void 0,{showSuccessAlert:F})}function S(N){return(0,n.i)().post("/api/folders",N)}function x(N,F){const k={parentUid:F.uid};return(0,n.i)().post(`/api/folders/${N}/move`,k,{showErrorAlert:!1})}const O=1e3;function B(N,F,k=l.SearchQueryType.Folder){return(0,n.i)().get("/api/search",{query:N,type:k,permission:F,limit:O})}function A(N){return(0,n.i)().get(`/api/folders/${N}`)}function V(N){return(0,n.i)().get(`/api/folders/id/${N}`)}function W(N,F){return(0,n.i)().delete(`/api/dashboards/uid/${N}`,{showSuccessAlert:F})}function w(N){return N.reduce((F,k)=>Promise.resolve(F).then(k),[])}},91399:(j,I,e)=>{"use strict";e.d(I,{AK:()=>f,C2:()=>c,G7:()=>i,KQ:()=>r,MO:()=>l,Nw:()=>m,S9:()=>o,ZP:()=>h,Zc:()=>u,eh:()=>p,n$:()=>s,wg:()=>g});var t=e(34099),n=e(53933),i=(y=>(y[y.Gcom=0]="Gcom",y[y.Json=1]="Json",y))(i||{}),s=(y=>(y.DataSource="datasource",y.Constant="constant",y.LibraryPanel="libraryPanel",y))(s||{}),r=(y=>(y.New="new",y.Exists="exists",y.Different="different",y))(r||{});const g={meta:{updatedAt:"",orgName:""},dashboard:{},source:1,inputs:{},state:n.Gu.NotStarted},d=(0,t.oM)({name:"manageDashboards",initialState:g,reducers:{setGcomDashboard:(y,v)=>{y.dashboard={...v.payload.json,id:null},y.meta={updatedAt:v.payload.updatedAt,orgName:v.payload.orgName},y.source=0,y.state=n.Gu.Done},setJsonDashboard:(y,v)=>{y.dashboard={...v.payload,id:null},y.meta=g.meta,y.source=1,y.state=n.Gu.Done},clearDashboard:y=>{y.dashboard={},y.state=n.Gu.NotStarted},setInputs:(y,v)=>{y.inputs={dataSources:v.payload.filter(D=>D.type==="datasource"),constants:v.payload.filter(D=>D.type==="constant"),libraryPanels:[]}},setLibraryPanelInputs:(y,v)=>{y.inputs.libraryPanels=v.payload},fetchFailed:y=>{y.dashboard={},y.state=n.Gu.Error},fetchDashboard:y=>{y.state=n.Gu.Loading}}}),{clearDashboard:l,setInputs:u,setGcomDashboard:o,setJsonDashboard:m,setLibraryPanelInputs:c,fetchFailed:p,fetchDashboard:f}=d.actions,h={importDashboard:d.reducer}},30284:(j,I,e)=>{"use strict";e.d(I,{FV:()=>r,JE:()=>l,Q$:()=>g,RF:()=>s,Yi:()=>d});var t=e(73289),n=e(33877),i=e(73796);function s(u={getBackendSrv:t.i}){return async o=>{const m=await u.getBackendSrv().get("/api/org");return o((0,i.jR)(m)),m}}function r(u={getBackendSrv:t.i}){return async(o,m)=>{const c=m().organization.organization;await u.getBackendSrv().put("/api/org",{name:c.name}),o((0,n.H7)(c.name)),o(s(u))}}function g(u,o={getBackendSrv:t.i}){return async m=>{const c=await o.getBackendSrv().post("/api/user/using/"+u);m((0,n.H7)(c.name))}}function d(u,o={getBackendSrv:t.i}){return async m=>{const c=await o.getBackendSrv().post("/api/orgs/",u);m(g(c.orgId))}}function l(u={getBackendSrv:t.i}){return async o=>{const m=await u.getBackendSrv().get("/api/user/orgs");return o((0,i.IM)(m)),m}}},73796:(j,I,e)=>{"use strict";e.d(I,{IM:()=>g,ZP:()=>l,jR:()=>r,xR:()=>s});var t=e(34099);const n={organization:{},userOrgs:[]},i=(0,t.oM)({name:"organization",initialState:n,reducers:{organizationLoaded:(u,o)=>({...u,organization:o.payload}),setOrganizationName:(u,o)=>({...u,organization:{...u.organization,name:o.payload}}),userOrganizationsLoaded:(u,o)=>({...u,userOrgs:o.payload})}}),{setOrganizationName:s,organizationLoaded:r,userOrganizationsLoaded:g}=i.actions,l={organization:i.reducer}},55905:(j,I,e)=>{"use strict";e.d(I,{Z:()=>h});var t=e(42844),n=e(27702),i=e(90482),s=e(62247),r=e(26129),g=e(66310),d=e(70823),l=e(2480),u=e(97957),o=e(56812),m=e(45743),c=e(25374),p=e(75261),f=e(18771),E=e(32195);function h(D){const a=(0,g.wW)(v),C=(0,d.R9)(),P=new i.mi(D.data),{dataSummary:b}=P,M=y(D,b),T=(0,f.useDispatch)(),S=(0,p.h4)().getCurrent()?.getPanelById(D.panelId),x=()=>{o.Z.setObject(u.FL,c.Ok.Suggestions),T((0,m.g_)(!0))},O=()=>{S&&T((0,E.Kc)({panel:S,pluginId:"table"}))},B=A=>{S&&(T((0,E.Kc)({...A,panel:S})),A.transformations&&setTimeout(()=>{r.E1.partial({tab:"transform"})},100))};return n.createElement("div",{className:a.wrapper},n.createElement("div",{className:a.message},M),C.app===s.zj.PanelEditor&&b.hasData&&S&&n.createElement("div",{className:a.actions},D.suggestions&&n.createElement(n.Fragment,null,D.suggestions.map(A=>n.createElement(l.x,{key:A.name,icon:"process",onClick:()=>B(A)},A.name))),n.createElement(l.x,{icon:"table",onClick:O},"Switch to table"),n.createElement(l.x,{icon:"chart-line",onClick:x},"Open visualization suggestions")))}function y({data:D,fieldConfig:a,message:C,needsNumberField:P,needsTimeField:b,needsStringField:M},T){return C||(!D.series||D.series.length===0||D.series.every(S=>S.length===0)?a?.defaults.noValue??"No data":M&&!T.hasStringField?"Data is missing a string field":P&&!T.hasNumberField?"Data is missing a number field":b&&!T.hasTimeField?"Data is missing a time field":"Cannot visualize data")}const v=D=>({wrapper:(0,t.css)({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",width:"100%"}),message:(0,t.css)({textAlign:"center",color:D.colors.text.secondary,fontSize:D.typography.size.lg,width:"100%"}),actions:(0,t.css)({marginTop:D.spacing(2),display:"flex",height:"50%",maxHeight:"150px",columnGap:D.spacing(1),rowGap:D.spacing(1),width:"100%",maxWidth:"600px"})})},59307:(j,I,e)=>{"use strict";e.d(I,{F:()=>d,X:()=>l});var t=e(27702),n=e(97585),i=e(9232),s=e(63439),r=e(18771);class g extends t.PureComponent{constructor(o){super(o)}render(){const o={display:"flex",alignItems:"center",justifyContent:"center",height:"100%"};return t.createElement("div",{style:o},t.createElement(s.b,{severity:r.AppNotificationSeverity.Error,...this.props}))}}function d(u,o){const m=class extends t.PureComponent{render(){const f=t.createElement(t.Fragment,null,"Check the server startup logs for more information. ",t.createElement("br",null),"If this plugin was loaded from Git, then make sure it was compiled.");return t.createElement(g,{title:`Error loading: ${u.id}`,text:f})}},c=new n.c(m);return c.meta=u,c.loadError=!0,c}function l(u,o){const m=class extends t.PureComponent{render(){return t.createElement(g,{title:`Panel plugin not found: ${u}`})}},c=new n.c(o?()=>null:m);return c.meta={id:u,name:u,sort:100,type:i.zV.panel,module:"",baseUrl:"",info:{author:{name:""},description:"",links:[],logos:{large:"",small:"public/img/grafana_icon.svg"},screenshots:[],updated:"",version:""}},c}},24084:(j,I,e)=>{"use strict";e.d(I,{$:()=>c});var t=e(27702),n=e(31317),i=e(21708),s=e(90665),r=e(83335),g=e(39317),d=e(66310),l=e(37647),u=e(66574),o=e(59882);const m={defaults:{},overrides:[]};function c(f){const{pluginId:E,data:h,timeZone:y=(0,n.Z)(),options:v={},width:D,height:a,title:C,onOptionsChange:P=()=>{},onChangeTimeRange:b=()=>{},onFieldConfigChange:M=()=>{},fieldConfig:T=m}=f,S=(0,d.l4)(),x=(0,g.J)(),O=(0,t.useMemo)(()=>x.replace.bind(x),[x]),[B,A]=(0,t.useState)((0,o.q1)(E)),[V,W]=(0,t.useState)(),w=p(B,v,T),N=(0,i.Cc)(B,w?.fieldConfig,h,y,S,O);if((0,t.useEffect)(()=>{B&&B.hasPluginId(E)||(0,o.Ub)(E).then(k=>A(k)).catch(k=>{W(k.message)})},[E,B]),V)return t.createElement("div",null,"Failed to load plugin: ",V);if(!B||!B.hasPluginId(E))return t.createElement("div",null,"Loading plugin panel...");if(!B.panel)return t.createElement("div",null,"Seems like the plugin you are trying to load does not have a panel component.");if(!N)return t.createElement("div",null,"No panel data");const F=B.panel;return t.createElement(l.z4,{dependencies:[B,h]},t.createElement(s.b,{meta:B.meta},t.createElement(F,{id:1,data:N,title:C,timeRange:N.timeRange,timeZone:y,options:w.options,fieldConfig:T,transparent:!1,width:D,height:a,renderCounter:0,replaceVariables:k=>k,onOptionsChange:P,onFieldConfigChange:M,onChangeTimeRange:b,eventBus:u.h$})))}function p(f,E,h){return(0,t.useMemo)(()=>{if(f)return(0,r.d4)({plugin:f,currentOptions:E,currentFieldConfig:h,isAfterPluginChange:!1})},[f,h,E])}},89897:(j,I,e)=>{"use strict";e.d(I,{Bq:()=>O,PR:()=>a,PW:()=>b});var t=e(89949),n=e.n(t),i=e(3569),s=e(24094),r=e(75578),g=e(29241),d=e(94469),l=e(48154),u=e(78968),o=e(58939),m=e(39317),c=e(64167),p=e(12308),f=e(26858),E=e(75627);const h=[{value:`${i.W.keepTime}`,label:"Time range",documentation:"Adds current time range",origin:s.L8.BuiltIn},{value:`${i.W.timeRangeFrom}`,label:"Time range: from",documentation:"Adds current time range's from value",origin:s.L8.BuiltIn},{value:`${i.W.timeRangeTo}`,label:"Time range: to",documentation:"Adds current time range's to value",origin:s.L8.BuiltIn}],y=[{value:`${i.W.seriesName}`,label:"Name",documentation:"Name of the series",origin:s.L8.Series}],v=[{value:`${i.W.valueNumeric}`,label:"Numeric",documentation:"Numeric representation of selected value",origin:s.L8.Value},{value:`${i.W.valueText}`,label:"Text",documentation:"Text representation of selected value",origin:s.L8.Value},{value:`${i.W.valueRaw}`,label:"Raw",documentation:"Raw value",origin:s.L8.Value}],D=B=>B.includes(".")||B.trim().includes(" ")?`["${B}"]`:`.${B}`,a=()=>[...(0,m.J)().getVariables().map(B=>({value:B.name,label:B.name,origin:s.L8.Template})),{value:`${i.W.includeVars}`,label:"All variables",documentation:"Adds current variables",origin:s.L8.Template},...h],C=B=>{const A=[];for(const W of B)for(const w of W.fields)if(w.labels)for(const N of Object.keys(w.labels))A.push(N);const V=(0,t.chain)(A).flatten().uniq().value();return[{value:`${i.W.fieldName}`,label:"Name",documentation:"Field name of the clicked datapoint (in ms epoch)",origin:s.L8.Field},...V.map(W=>({value:`__field.labels${D(W)}`,label:`labels.${W}`,documentation:`${W} label value`,origin:s.L8.Field}))]},P=B=>{let A,V;const W=[],w={};if(B.length!==1)return[];const N=B[0];for(const F of N.fields){const k=(0,r.CZ)(F,N,B);w[k]||(W.push({value:`__data.fields${D(k)}`,label:`${k}`,documentation:`Formatted value for ${k} on the same row`,origin:s.L8.Fields}),w[k]=!0,!A&&F.type===g.fS.number&&(A={...F,name:k}),!V&&F.config.displayName&&F.config.displayName!==F.name&&(V={...F,name:k}))}return W.length&&W.push({value:"__data.fields[0]",label:"Select by index",documentation:"Enter the field order",origin:s.L8.Fields}),A&&(W.push({value:`__data.fields${D(A.name)}.numeric`,label:"Show numeric value",documentation:"the numeric field value",origin:s.L8.Fields}),W.push({value:`__data.fields${D(A.name)}.text`,label:"Show text value",documentation:"the text value",origin:s.L8.Fields})),V&&W.push({value:`__data.fields${D(V.name)}`,label:"Select by title",documentation:"Use the title to pick the field",origin:s.L8.Fields}),W},b=(B,A)=>{const V={value:`${i.W.valueTime}`,label:"Time",documentation:"Time value of the clicked datapoint (in ms epoch)",origin:s.L8.Value};return A===s.o3.Values?[...y,...C(B),...v,V,...P(B),...a()]:[...y,...C(B),...P(B),...a()]},M=B=>{const A=C(B),V={value:`${DataLinkBuiltInVars.valueCalc}`,label:"Calculation name",documentation:"Name of the calculation the value is a result of",origin:VariableOrigin.Value};return[...y,...A,...v,V,...a()]};class T{constructor(){this.getDataLinkUIModel=(A,V,W)=>{let w=A.url;A.onBuildUrl&&(w=A.onBuildUrl({origin:W,replaceVariables:V}));const N={href:d.u.assureBaseUrl(w.replace(/\n/g,"")),title:A.title??"",target:A.targetBlank?"_blank":void 0,origin:W};return V&&(N.href=V(N.href,void 0,c.b8.UriEncode),N.title=V(A.title)),A.onClick&&(N.onClick=F=>{A.onClick({origin:W,replaceVariables:V,e:F})}),N.href=(0,p.iE)().disableSanitizeHtml?N.href:l.QX.sanitizeUrl(N.href),N}}getLinkUrl(A){let V=d.u.assureBaseUrl((0,m.J)().replace(A.url||"")),W={};if(A.keepTime){const w=(0,f.$t)().timeRangeForUrl();W.from=w.from,W.to=w.to}return A.includeVars&&(W={...W,...(0,E.c)()}),V=u.Cj.appendQueryToUrl(V,u.Cj.toUrlParams(W)),(0,p.iE)().disableSanitizeHtml?V:l.QX.sanitizeUrl(V)}getAnchorInfo(A){const V=(0,m.J)(),W={};return W.href=this.getLinkUrl(A),W.title=V.replace(A.title||""),W.tooltip=V.replace(A.tooltip||""),W}getPanelLinkAnchorInfo(A,V){(0,o.d)("link_srv.ts","getPanelLinkAnchorInfo","getDataLinkUIModel");const W=(w,N,F)=>(0,m.J)().replace(w,{...V,...N},F);return this.getDataLinkUIModel(A,W,{})}}let S;function x(B){S=B}function O(){return S||(S=new T),S}},32195:(j,I,e)=>{"use strict";e.d(I,{JI:()=>d,Kc:()=>u,ih:()=>o,qj:()=>l});var t=e(83335),n=e(75766),i=e(59307),s=e(30235),r=e(43620),g=e(47875);function d(c){return async(p,f)=>{if(c.libraryPanel?.uid&&!("model"in c.libraryPanel)){p(m(c));return}let E=c.type,h=f().plugins.panels[E];if(!h)try{h=await p((0,s.Ro)(E))}catch{h=(0,i.X)(E,E==="row")}c.plugin||c.pluginLoaded(h),p((0,g.bc)({key:c.key,plugin:h}))}}function l(c){return p=>{p((0,g.WJ)({key:c}))}}function u({panel:c,pluginId:p,options:f,fieldConfig:E,transformations:h}){return async(y,v)=>{if(c.type===p&&!f&&!E&&!h)return;let a=v().plugins.panels[p];if(a||(a=await y((0,s.Ro)(p))),c.type!==p&&c.changePlugin(a),f||E||h){const C=(0,t.d4)({plugin:a,currentOptions:f||c.options,currentFieldConfig:E||c.fieldConfig,isAfterPluginChange:!1});c.options=C.options,c.fieldConfig=C.fieldConfig,c.transformations=h||c.transformations,c.configRev++}c.generateNewKey(),y((0,g.bc)({key:c.key,plugin:a}))}}function o(c,p){return async(f,E)=>{const h=p.model.type,y=c.type;if(c.restoreModel({...p.model,gridPos:c.gridPos,id:c.id,libraryPanel:p}),c.getQueryRunner().clearLastResult(),y!==h){let D=E().plugins.panels[h];D||(D=await f((0,s.Ro)(h))),c.pluginLoaded(D),c.generateNewKey(),await f((0,g.bc)({key:c.key,plugin:D}))}else{const v=c.key;c.generateNewKey(),f((0,g.mr)({oldKey:v,newKey:c.key}))}c.configRev=0,c.hasSavedPanelEditChange=!0,c.refresh(),c.events.publish(r.pO),c.events.publish(r.Wj)}}function m(c){return async(p,f)=>{const E=c.libraryPanel.uid;try{const h=await(0,n.Mh)(E,!0);c.initLibraryPanel(h),await p(d(c));const y=f().dashboard.getModel();if(c.repeat&&y){const v=y.panels.findIndex(D=>D.id===c.id);y.repeatPanel(c,v),y.sortPanelsByGridPos(),y.events.publish(new r._B)}}catch(h){console.log("ERROR: ",h),p((0,g.bc)({key:c.key,plugin:(0,i.X)("Unable to load library panel: "+E,!1)}))}}}},47875:(j,I,e)=>{"use strict";e.d(I,{Vl:()=>u,WJ:()=>l,ZP:()=>m,bc:()=>s,mr:()=>d,o8:()=>r,pC:()=>g});var t=e(34099);const n={},i=(0,t.oM)({name:"panels",initialState:n,reducers:{panelModelAndPluginReady:(c,p)=>{c[p.payload.key]={plugin:p.payload.plugin}},changePanelKey:(c,p)=>{c[p.payload.newKey]=c[p.payload.oldKey],delete c[p.payload.oldKey]},removePanel:(c,p)=>{delete c[p.payload.key]},removeAllPanels:c=>{Object.keys(c).forEach(p=>delete c[p])},setPanelInstanceState:(c,p)=>{c[p.payload.key].instanceState=p.payload.value},setPanelAngularComponent:(c,p)=>{const f=c[p.payload.key];f.angularComponent=p.payload.angularComponent}}}),{panelModelAndPluginReady:s,setPanelAngularComponent:r,setPanelInstanceState:g,changePanelKey:d,removePanel:l,removeAllPanels:u}=i.actions,m={panels:i.reducer}},79517:(j,I,e)=>{"use strict";e.d(I,{r0:()=>o});var t=e(89949),n=e.n(t),i=e(94469),s=e(78968),r=e(76305),g=e(26129),d=e(60086);const l={kiosk:!0,autofitpanels:!0,orgId:!0};class u{constructor(){this.urls=[],this.index=0,this.numberOfLoops=0,this.isPlaying=!1,this.locationUpdated=this.locationUpdated.bind(this)}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}const p=this.urls[this.index],f=g.E1.getSearchObject(),E=(0,t.pickBy)(f,(y,v)=>l[v]),h=i.u.stripBaseFromUrl(p);this.index++,this.validPlaylistUrl=h,this.nextTimeoutId=setTimeout(()=>this.next(),this.interval),g.E1.push(h+"?"+s.Cj.toUrlParams(E))}prev(){this.index=Math.max(this.index-2,0),this.next()}locationUpdated(c){c.pathname!==this.validPlaylistUrl&&this.stop()}async start(c){this.stop(),this.startUrl=window.location.href,this.index=0,this.isPlaying=!0,this.locationListenerUnsub=g.E1.getHistory().listen(this.locationUpdated);const p=[];let f=await(0,d.A5)(c);if(!f.items?.length)return;this.interval=r.intervalToMs(f.interval);const E=await(0,d.jc)(f.items);for(const h of E)if(h.dashboards)for(const y of h.dashboards)p.push(y.url);p.length&&(this.urls=p,this.isPlaying=!0,this.next())}stop(){this.isPlaying&&(this.index=0,this.isPlaying=!1,this.locationListenerUnsub&&this.locationListenerUnsub(),this.nextTimeoutId&&clearTimeout(this.nextTimeoutId),g.E1.getSearchObject().kiosk&&g.E1.partial({kiosk:null}))}}const o=new u},60086:(j,I,e)=>{"use strict";e.d(I,{A5:()=>f,CE:()=>c,Ds:()=>D,Dv:()=>E,cg:()=>m,d5:()=>v,jc:()=>y,l8:()=>p});var t=e(78209),n=e(27938),i=e(73289),s=e(34667),r=e(33877),g=e(73807),d=e(28062),l=e(89050),u=e(84749),o=e(63064);async function m(a){await h(()=>(0,i.i)().post("/api/playlists",a))}async function c(a,C){await h(()=>(0,i.i)().put(`/api/playlists/${a}`,C))}async function p(a){await h(()=>(0,i.i)().delete(`/api/playlists/${a}`),"Playlist deleted")}async function f(a){const C=await(0,i.i)().get(`/api/playlists/${a}`);if(C.items){for(const P of C.items)if(P.type==="dashboard_by_id"){P.type="dashboard_by_uid";const b=await(0,i.i)().get(`/api/dashboards/ids/${P.value}`);b.length&&(P.value=b[0])}}return C}async function E(){return(0,i.i)().get("/api/playlists/")}async function h(a,C="Playlist saved"){try{await a(),(0,u.WI)((0,r.$l)((0,g.AT)(C)))}catch(P){P instanceof Error&&(0,u.WI)((0,r.$l)((0,g.t_)("Unable to save playlist",P)))}}async function y(a){let C=0;if(!a?.length)return[];const P=[];for(const T of a){const S={query:"*",kind:["dashboard"],limit:1e3};switch(T.type){case"dashboard_by_id":throw new Error("invalid item (with id)");case"dashboard_by_uid":S.uid=[T.value];break;case"dashboard_by_tag":S.tags=[T.value];break}P.push({refId:`${C++}`,queryType:l.hR.Search,search:S})}if(!s.config.featureToggles.panelTitleSearch){const T=(0,o.getGrafanaSearcher)(),S=[];for(let x=0;x<P.length;x++){const O=(await T.search(P[x].search)).view;S.push({...a[x],dashboards:O.map(B=>({...B}))})}return S}const b=await(0,d.e)(),M=await(0,t.n)(b.query({targets:P}));if(M.data.length!==a.length)throw new Error("unexpected result size");return a.map((T,S)=>{const x=new n.U(M.data[S]);return{...T,dashboards:x.map(O=>({...O}))}})}function v(){return{items:[],interval:"5m",name:"",uid:""}}function D(a,C){return C?.length?(C=C.toLowerCase(),a.filter(P=>P.name.toLowerCase().includes(C))):a}},68723:(j,I,e)=>{"use strict";e.d(I,{$F:()=>d,E1:()=>c,GP:()=>f,GV:()=>g,P6:()=>E,Tk:()=>p,jL:()=>l});var t=e(18112),n=e(73289),i=e(92317),s=e(5194),r=e(67972);async function g(y){const v=await u(y),D=!!v,[a,C,P]=await Promise.all([c(),o(y,D),m(y)]),b=a.find(T=>T.id===y),M=b?.dependencies||v?.json?.dependencies;return{grafanaDependency:M?.grafanaDependency??M?.grafanaVersion??"",pluginDependencies:M?.plugins||[],links:b?.info.links||v?.json?.info.links||[],readme:P||v?.readme,versions:C}}async function d(){const{items:y}=await(0,n.i)().get(`${s.tB}/plugins`);return y.filter(r.wB)}async function l(){try{return await(0,n.i)().get(`${s.O2}/errors`)}catch{return[]}}async function u(y){try{return await(0,n.i)().get(`${s.tB}/plugins/${y}`,{})}catch(v){(0,n.kW)(v)&&(v.isHandled=!0);return}}async function o(y,v){try{return v?((await(0,n.i)().get(`${s.tB}/plugins/${y}/versions`)).items||[]).map(a=>({version:a.version,createdAt:a.createdAt,isCompatible:a.isCompatible,grafanaDependency:a.grafanaDependency})):[]}catch(D){return(0,n.kW)(D)&&(D.isHandled=!0),[]}}async function m(y){try{const v=await(0,n.i)().get(`${s.O2}/${y}/markdown/README`);return v?(0,t.a)(v):""}catch(v){return(0,n.kW)(v)&&(v.isHandled=!0),""}}async function c(){return(await(0,n.i)().get(`${s.O2}`,(0,i.y)({embedded:0}))).filter(r.EP)}async function p(y){return await(0,n.i)().post(`${s.O2}/${y}/install`,void 0,{showErrorAlert:!1})}async function f(y){return await(0,n.i)().post(`${s.O2}/${y}/uninstall`)}async function E(y,v){return(await(0,n.i)().datasourceRequest({url:`/api/plugins/${y}/settings`,method:"POST",data:v}))?.data}const h={getRemotePlugins:d,getInstalledPlugins:c,installPlugin:p,uninstallPlugin:f}},58083:(j,I,e)=>{"use strict";e.d(I,{L:()=>s});var t=e(42844),n=e(27702),i=e(66310);const s=({children:g,wrap:d,className:l})=>{const u=(0,i.l4)(),o=r(u,d);return n.createElement("div",{className:(0,t.cx)(o.container,l)},g)},r=(g,d)=>({container:(0,t.css)` display: flex; flex-direction: row; flex-wrap: ${d?"wrap":"no-wrap"}; & > * { margin-bottom: ${g.spacing()}; margin-right: ${g.spacing()}; } & > *:last-child { margin-right: 0; } `})},5194:(j,I,e)=>{"use strict";e.d(I,{O2:()=>t,tB:()=>n,uJ:()=>i});const t="/api/plugins",n="/api/gnet",i="plugins"},67972:(j,I,e)=>{"use strict";e.d(I,{AA:()=>h,EP:()=>b,HT:()=>P,Nh:()=>E,RU:()=>a,Uj:()=>f,XB:()=>D,ZG:()=>c,fG:()=>C,uR:()=>u,wB:()=>M});var t=e(9232),n=e(58018),i=e(34667),s=e(80978),r=e(66574),g=e(45937),d=e(18771),l=e(309);function u(O=[],B=[],A){const V=[],W=y(A);return O.forEach(w=>{const N=B.find(k=>k.slug===w.id),F=W[w.id];N||V.push(o(w,void 0,F))}),B.forEach(w=>{const N=O.find(k=>k.id===w.slug),F=W[w.slug];V.push(o(N,w,F))}),V}function o(O,B,A){return!O&&B?m(B,A):O&&!B?c(O,A):p(O,B,A)}function m(O,B){const{name:A,slug:V,description:W,version:w,orgName:N,popularity:F,downloads:k,typeCode:H,updatedAt:R,createdAt:_,status:G,angularDetected:Y}=O,X=!!B||S(H);return{description:W,downloads:k,id:V,info:{logos:{small:`https://grafana.com/api/plugins/${V}/versions/${w}/logos/small`,large:`https://grafana.com/api/plugins/${V}/versions/${w}/logos/large`}},name:A,orgName:N,popularity:F,publishedAt:_,signature:v({remote:O,error:B}),updatedAt:R,hasUpdate:!1,isPublished:!0,isInstalled:X,isDisabled:X,isCore:O.internal,isDev:!1,isEnterprise:G==="enterprise",type:H,error:B?.errorCode,angularDetected:Y}}function c(O,B){const{name:A,info:{description:V,version:W,logos:w,updated:N,author:F},id:k,dev:H,type:R,signature:_,signatureOrg:G,signatureType:Y,hasUpdate:X,accessControl:Q,angularDetected:se}=O,Z=!!B||S(R);return{description:V,downloads:0,id:k,info:{logos:w},name:A,orgName:F.name,popularity:0,publishedAt:"",signature:v({local:O,error:B}),signatureOrg:G,signatureType:Y,updatedAt:N,installedVersion:W,hasUpdate:X,isInstalled:!0,isDisabled:Z,isCore:_==="internal",isPublished:!1,isDev:!!H,isEnterprise:!1,type:R,error:B?.errorCode,accessControl:Q,angularDetected:se}}function p(O,B,A){const V=O?.info.version,W=B?.slug||O?.id||"",w=O?.type||B?.typeCode,N=!!A||S(w);let F={small:`/public/img/icn-${w}.svg`,large:`/public/img/icn-${w}.svg`};return B?F={small:`https://grafana.com/api/plugins/${W}/versions/${B.version}/logos/small`,large:`https://grafana.com/api/plugins/${W}/versions/${B.version}/logos/large`}:O&&O.info.logos&&(F=O.info.logos),{description:O?.info.description||B?.description||"",downloads:B?.downloads||0,hasUpdate:O?.hasUpdate||!1,id:W,info:{logos:F},isCore:!!(B?.internal||O?.signature===t.Xy.internal),isDev:!!O?.dev,isEnterprise:B?.status==="enterprise",isInstalled:!!O||N,isDisabled:N,isPublished:!0,name:B?.name||O?.name||"",orgName:B?.orgName||O?.info.author.name||"",popularity:B?.popularity||0,publishedAt:B?.createdAt||"",type:w,signature:v({local:O,remote:B,error:A}),signatureOrg:O?.signatureOrg||B?.versionSignedByOrgName,signatureType:O?.signatureType||B?.versionSignatureType||B?.signatureType||void 0,updatedAt:B?.updatedAt||O?.info.updated||"",installedVersion:V,error:A?.errorCode,accessControl:O?.accessControl,angularDetected:O?.angularDetected||B?.angularDetected}}const f=O=>`${i.config.pluginCatalogURL}${O}`;var E=(O=>(O.nameAsc="nameAsc",O.nameDesc="nameDesc",O.updated="updated",O.published="published",O.downloads="downloads",O))(E||{});const h=(O,B)=>{const A={nameAsc:(V,W)=>V.name.localeCompare(W.name),nameDesc:(V,W)=>W.name.localeCompare(V.name),updated:(V,W)=>(0,n.J)(W.updatedAt).valueOf()-(0,n.J)(V.updatedAt).valueOf(),published:(V,W)=>(0,n.J)(W.publishedAt).valueOf()-(0,n.J)(V.publishedAt).valueOf(),downloads:(V,W)=>W.downloads-V.downloads};return A[B]?O.sort(A[B]):O};function y(O=[]){return O.reduce((B,A)=>(B[A.pluginId]=A,B),{})}function v(O){const{error:B,local:A,remote:V}=O;if(B)switch(B.errorCode){case t.w2.invalidSignature:return t.Xy.invalid;case t.w2.missingSignature:return t.Xy.missing;case t.w2.modifiedSignature:return t.Xy.modified}return A?.signature?A.signature:V?.signatureType||V?.versionSignatureType?t.Xy.valid:t.Xy.missing}const D=()=>(0,g.i)().get("/api/frontend/settings").then(O=>{i.config.panels=O.panels});function a(O){if(!O)return;const[B]=O.filter(A=>!!A.isCompatible);return B}const C=()=>i.config.pluginAdminEnabled,P=(O,B,A)=>{const V=i.config.pluginAdminExternalManageEnabled,W=r.Vt.hasAccess(d.AccessControlAction.PluginsInstall,(0,l.bO)()),w=!!A;return O.type===t.zV.renderer||O.type===t.zV.secretsmanager||O.isEnterprise&&!(0,s.v)("enterprise.plugins")||O.isDev||!W&&!V||!O.isPublished||!w||!B},b=O=>T(O.id),M=O=>T(O.slug);function T(O){const{pluginCatalogHiddenPlugins:B}=i.config;return!B.includes(O)}function S(O){return O===t.zV.secretsmanager&&!i.config.secretsManagerPluginEnabled}function x(O){return O?.signature==="internal"}},309:(j,I,e)=>{"use strict";e.d(I,{Gg:()=>g,RN:()=>r,bO:()=>s});var t=e(12308),n=e(91368),i=e(18771);function s(){return t.config.bootData.user.isGrafanaAdmin}function r(){return n.contextSrv.hasRole("Admin")}function g(){return n.contextSrv.hasPermission(i.AccessControlAction.DataSourcesCreate)&&n.contextSrv.hasPermission(i.AccessControlAction.DataSourcesWrite)}},30235:(j,I,e)=>{"use strict";e.d(I,{DD:()=>m,LP:()=>h,N9:()=>c,Qd:()=>l,Ro:()=>y,Tz:()=>f,bQ:()=>p,bp:()=>u,m3:()=>E,tQ:()=>o});var t=e(34099),n=e(73289),i=e(59882),s=e(43799),r=e(68723),g=e(5194),d=e(67972);const l=(0,t.hg)(`${g.uJ}/fetchAll`,async(v,D)=>{try{const{dispatch:a}=D,[C,P,{payload:b}]=await Promise.all([(0,r.E1)(),(0,r.jL)(),a(o())]);return(0,d.uR)(C,b,P)}catch{return D.rejectWithValue("Unknown error.")}}),u=(0,t.hg)(`${g.uJ}/fetchAllLocal`,async(v,D)=>{try{return(await(0,r.E1)()).map(C=>(0,d.ZG)(C))}catch{return D.rejectWithValue("Unknown error.")}}),o=(0,t.hg)(`${g.uJ}/fetchRemotePlugins`,async(v,D)=>{try{return await(0,r.$F)()}catch(a){return(0,n.kW)(a)&&(a.isHandled=!0),D.rejectWithValue([])}}),m=(0,t.hg)(`${g.uJ}/fetchDetails`,async(v,D)=>{try{const a=await(0,r.GV)(v);return{id:v,changes:{details:a}}}catch{return D.rejectWithValue("Unknown error.")}}),c=(0,t.hg)(`${g.uJ}/install`,async({id:v,version:D,isUpdating:a=!1},C)=>{const P=a?{isInstalled:!0,installedVersion:D,hasUpdate:!1}:{isInstalled:!0,installedVersion:D};try{return await(0,r.Tk)(v),await(0,d.XB)(),a&&(0,s.Hl)(v),{id:v,changes:P}}catch(b){return console.error(b),(0,n.kW)(b)?C.rejectWithValue(b.data):C.rejectWithValue("Unknown error.")}}),p=(0,t.hg)(`${g.uJ}/install`,async()=>({})),f=(0,t.hg)(`${g.uJ}/uninstall`,async(v,D)=>{try{return await(0,r.GP)(v),await(0,d.XB)(),(0,s.Hl)(v),{id:v,changes:{isInstalled:!1,installedVersion:void 0}}}catch(a){return console.error(a),D.rejectWithValue("Unknown error.")}}),E=(0,t.hg)(`${g.uJ}/loadPluginDashboards`,async(v,D)=>{const P=`api/plugins/${D.getState().dataSources.dataSource.type}/dashboards`;return(0,n.i)().get(P)}),h=(0,t.PH)(`${g.uJ}/panelPluginLoaded`),y=v=>async(D,a)=>{let C=a().plugins.panels[v];return C||(C=await(0,i.Ub)(v),a().plugins.panels[v]||D(h(C))),C}},64248:(j,I,e)=>{"use strict";e.d(I,{iY:()=>k,or:()=>F,bt:()=>B,ZV:()=>O,Pj:()=>a,UQ:()=>b,bJ:()=>C,x3:()=>M,IS:()=>A,y9:()=>x,S1:()=>S,wq:()=>V,kH:()=>T});var t=e(27702),n=e(18771),i=e(67972),s=e(30235),r=e(6752),g=e(75892),d=e(95676),l=e(95948);const u=H=>H.plugins,o=(0,g.P1)(u,({items:H})=>H),m=(0,g.P1)(u,({settings:H})=>H.displayMode),{selectAll:c,selectById:p}=r.CD.getSelectors(o),f=H=>(0,g.P1)(c,R=>{const _=H.keyword?(0,d.x6)(H.keyword.toLowerCase()):"";return R.filter(G=>{const Y=[G.name,G.orgName].filter(Boolean).map(X=>X.toLowerCase());return!(_&&!Y.some(X=>X.includes(_))||H.type&&G.type!==H.type||H.isInstalled!==void 0&&G.isInstalled!==H.isInstalled||H.isCore!==void 0&&G.isCore!==H.isCore||H.isEnterprise!==void 0&&G.isEnterprise!==H.isEnterprise)})}),E=(0,g.P1)(c,H=>H?H.filter(R=>!!R.error).map(R=>({pluginId:R.id,errorCode:R.error})):[]),h=H=>(0,g.P1)(u,({requests:R={}})=>R[H]),y=H=>(0,g.P1)(h(H),R=>R?.status===l.eE.Pending),v=H=>(0,g.P1)(h(H),R=>R?.status===l.eE.Rejected?R?.error:null),D=H=>(0,g.P1)(h(H),R=>R===void 0),a=(H,R=i.Nh.nameAsc)=>{W();const _=(0,t.useMemo)(()=>f(H),[H]),G=(0,n.useSelector)(_),{isLoading:Y,error:X}=O(),Q=(0,i.AA)(G,R);return{isLoading:Y,error:X,plugins:Q}},C=H=>(W(),N(H),(0,n.useSelector)(R=>p(R,H))),P=H=>(w(),useSelector(R=>selectById(R,H))),b=()=>(W(),(0,n.useSelector)(E)),M=()=>{const H=(0,n.useDispatch)();return(R,_,G)=>H((0,s.N9)({id:R,version:_,isUpdating:G}))},T=()=>{const H=(0,n.useDispatch)();return()=>H((0,s.bQ)())},S=()=>{const H=(0,n.useDispatch)();return R=>H((0,s.Tz)(R))},x=()=>(0,n.useSelector)(v(s.tQ.typePrefix))===null,O=()=>{const H=(0,n.useSelector)(y(s.Qd.typePrefix)),R=(0,n.useSelector)(v(s.Qd.typePrefix));return{isLoading:H,error:R}},B=()=>{const H=(0,n.useSelector)(y(s.DD.typePrefix)),R=(0,n.useSelector)(v(s.DD.typePrefix));return{isLoading:H,error:R}},A=()=>{const H=(0,n.useSelector)(y(s.N9.typePrefix)),R=(0,n.useSelector)(v(s.N9.typePrefix));return{isInstalling:H,error:R}},V=()=>{const H=(0,n.useSelector)(y(s.Tz.typePrefix)),R=(0,n.useSelector)(v(s.Tz.typePrefix));return{isUninstalling:H,error:R}},W=()=>{const H=(0,n.useDispatch)(),R=(0,n.useSelector)(D(s.Qd.typePrefix));(0,t.useEffect)(()=>{R&&H((0,s.Qd)())},[])},w=()=>{const H=useDispatch(),R=useSelector(selectIsRequestNotFetched(fetchAllLocal.typePrefix));useEffect(()=>{R&&H(fetchAllLocal())},[])},N=H=>{const R=(0,n.useDispatch)(),_=(0,n.useSelector)(X=>p(X,H)),Y=!(0,n.useSelector)(y(s.DD.typePrefix))&&_&&!_.details;(0,t.useEffect)(()=>{Y&&R((0,s.DD)(H))},[_])},F=()=>{const H=(0,n.useDispatch)();return R=>H((0,s.DD)(R))},k=()=>{const H=(0,n.useDispatch)();return{displayMode:(0,n.useSelector)(m),setDisplayMode:_=>H((0,r.UC)(_))}}},6752:(j,I,e)=>{"use strict";e.d(I,{CD:()=>r,I6:()=>p,UC:()=>c});var t=e(34099),n=e(5194),i=e(95948),s=e(30235);const r=(0,t.HF)(),g=f=>new RegExp(`${n.uJ}/(.*)/pending`).test(f.type),d=f=>new RegExp(`${n.uJ}/(.*)/fulfilled`).test(f.type),l=f=>new RegExp(`${n.uJ}/(.*)/rejected`).test(f.type),u=f=>{const E=f.lastIndexOf("/");return f.substring(0,E)},o={items:r.getInitialState(),requests:{},settings:{displayMode:i.lL.Grid},plugins:[],errors:[],searchQuery:"",hasFetched:!1,dashboards:[],isLoadingPluginDashboards:!1,panels:{}},m=(0,t.oM)({name:"plugins",initialState:o,reducers:{setDisplayMode(f,E){f.settings.displayMode=E.payload}},extraReducers:f=>f.addCase(s.Qd.fulfilled,(E,h)=>{r.upsertMany(E.items,h.payload)}).addCase(s.bp.fulfilled,(E,h)=>{r.upsertMany(E.items,h.payload)}).addCase(s.DD.fulfilled,(E,h)=>{r.updateOne(E.items,h.payload)}).addCase(s.N9.fulfilled,(E,h)=>{r.updateOne(E.items,h.payload)}).addCase(s.Tz.fulfilled,(E,h)=>{r.updateOne(E.items,h.payload)}).addCase(s.LP,(E,h)=>{E.panels[h.payload.meta.id]=h.payload}).addCase(s.m3.pending,(E,h)=>{E.isLoadingPluginDashboards=!0,E.dashboards=[]}).addCase(s.m3.fulfilled,(E,h)=>{E.isLoadingPluginDashboards=!1,E.dashboards=h.payload}).addMatcher(g,(E,h)=>{E.requests[u(h.type)]={status:i.eE.Pending}}).addMatcher(d,(E,h)=>{E.requests[u(h.type)]={status:i.eE.Fulfilled}}).addMatcher(l,(E,h)=>{E.requests[u(h.type)]={status:i.eE.Rejected,error:h.payload}})}),{setDisplayMode:c}=m.actions,p=m.reducer},95948:(j,I,e)=>{"use strict";e.d(I,{Co:()=>i,cd:()=>n,eE:()=>d,lL:()=>t,tu:()=>g,vF:()=>s,xc:()=>r});var t=(l=>(l.Grid="grid",l.List="list",l))(t||{}),n=(l=>(l.Home="plugins-home",l.Browse="plugins-browse",l.Details="plugins-details",l))(n||{}),i=(l=>(l.app="apps",l.datasource="database",l.panel="credit-card",l.renderer="capture",l.secretsmanager="key-skeleton-alt",l))(i||{}),s=(l=>(l.INSTALL="INSTALL",l.UNINSTALL="UNINSTALL",l.UPDATE="UPDATE",l.REINSTALL="REINSTALL",l))(s||{}),r=(l=>(l.OVERVIEW="Overview",l.VERSIONS="Version history",l.CONFIG="Config",l.DASHBOARDS="Dashboards",l.USAGE="Usage",l))(r||{}),g=(l=>(l.OVERVIEW="overview",l.VERSIONS="version-history",l.CONFIG="config",l.DASHBOARDS="dashboards",l.USAGE="usage",l))(g||{}),d=(l=>(l.Pending="Pending",l.Fulfilled="Fulfilled",l.Rejected="Rejected",l))(d||{})},74161:(j,I,e)=>{"use strict";e.d(I,{a:()=>s,v:()=>n});var t=e(27702);const n=t.createContext(i());n.displayName="PluginPageContext";function i(){return{sectionNav:{main:{text:"Plugin page"},node:{text:"Plugin page"}}}}function s(r){return{sectionNav:r??i().sectionNav}}},5926:(j,I,e)=>{"use strict";e.d(I,{ND:()=>p,ak:()=>h});var t=e(68246),n=e(3935),i=e(39317),s=e(32416),r=e(73289),g=e(10864),d=e(42751),l=e(5933),u=e(12308),o=e(11122),m=e(65946),c=e(8929);class p{constructor(v=(0,i.J)()){this.templateSrv=v,this.datasources={},this.settingsMapByName={},this.settingsMapByUid={},this.settingsMapById={},this.defaultName=""}init(v,D){this.datasources={},this.settingsMapByUid={},this.settingsMapByName=v,this.defaultName=D;for(const a of Object.values(v))a.uid||(a.uid=a.name),this.settingsMapByUid[a.uid]=a,this.settingsMapById[a.id]=a;this.datasources[d.hr.type]=o.mV,this.datasources[m.Yq]=o.mV,this.settingsMapByUid[d.hr.uid]=o.bE,this.settingsMapByUid[m.Yq]=o.bE}getDataSourceSettingsByUid(v){return this.settingsMapByUid[v]}getInstanceSettings(v,D){let a=f(v);if((0,d.Pr)(a))return o.bE;if(a==="default"||a==null)return this.settingsMapByUid[this.defaultName]??this.settingsMapByName[this.defaultName];if(a[0]==="$"){const C=this.templateSrv.replace(a,D,E);let P;return C==="default"?P=this.settingsMapByName[this.defaultName]:P=this.settingsMapByUid[C]??this.settingsMapByName[C],P?{...P,isDefault:!1,name:a,uid:a,rawRef:{type:P.type,uid:P.uid}}:void 0}return this.settingsMapByUid[a]??this.settingsMapByName[a]??this.settingsMapById[a]}get(v,D){let a=f(v);if(!a)return this.get(this.defaultName);if((0,d.Pr)(v))return Promise.resolve(this.datasources[m.Yq]);const C=this.settingsMapByName[a];return C&&(a=C.uid),this.datasources[a]?Promise.resolve(this.datasources[a]):(a=this.templateSrv.replace(a,D,E),a==="default"&&this.defaultName!=="default"?this.get(this.defaultName):this.datasources[a]?Promise.resolve(this.datasources[a]):this.loadDatasource(a))}async loadDatasource(v){if(this.datasources[v])return Promise.resolve(this.datasources[v]);const D=this.getInstanceSettings(v);if(!D)return Promise.reject({message:`Datasource ${v} was not found`});try{const a=await(0,c.nL)(D.meta);if(this.datasources[v])return this.datasources[v];const C=a.DataSourceClass.length!==1;let P;if(C?P=(0,s.V)().instantiate(a.DataSourceClass,{instanceSettings:D}):P=new a.DataSourceClass(D),P.components=a.components,!(P instanceof t.MF)){const b=P;b.name=D.name,b.id=D.id,b.type=D.type,b.meta=D.meta,b.uid=D.uid,P.getRef=t.MF.prototype.getRef}return this.datasources[v]=P,this.datasources[P.uid]=P,P}catch(a){return a instanceof Error&&l.Z.emit(n.SI.alertError,[D.name+" plugin failed",a.toString()]),Promise.reject({message:`Datasource: ${v} was not found`})}}getAll(){return Object.values(this.settingsMapByName)}getList(v={}){const D=Object.values(this.settingsMapByName).filter(C=>!(C.meta.id==="grafana"||C.meta.id==="mixed"||C.meta.id==="dashboard"||v.metrics&&!C.meta.metrics||v.tracing&&!C.meta.tracing||v.logs&&C.meta.category!=="logging"&&!C.meta.logs||v.annotations&&!C.meta.annotations||v.alerting&&!C.meta.alerting||v.pluginId&&C.meta.id!==v.pluginId||v.filter&&!v.filter(C)||v.type&&(Array.isArray(v.type)?!v.type.includes(C.type):v.type!==C.type)||!v.all&&C.meta.metrics!==!0&&C.meta.annotations!==!0&&C.meta.tracing!==!0&&C.meta.logs!==!0&&C.meta.alerting!==!0));if(v.variables)for(const C of this.templateSrv.getVariables()){if(C.type!=="datasource")continue;let P=C.current.value==="default"?this.defaultName:C.current.value;Array.isArray(P)&&P.length===1&&(P=P[0]);const b=!Array.isArray(P)&&(this.settingsMapByName[P]||this.settingsMapByUid[P]);if(b){const M=`\${${C.name}}`;D.push({...b,name:M,uid:M})}}const a=D.sort((C,P)=>C.name.toLowerCase()>P.name.toLowerCase()?1:C.name.toLowerCase()<P.name.toLowerCase()?-1:0);if(!v.pluginId&&!v.alerting){if(v.mixed){const C=this.getInstanceSettings("-- Mixed --");C&&D.push(C)}if(v.dashboard){const C=this.getInstanceSettings("-- Dashboard --");C&&D.push(C)}if(!v.tracing){const C=this.getInstanceSettings("-- Grafana --");C&&D.push(C)}}return a}getExternal(){return this.getList()}getAnnotationSources(){return this.getList({annotations:!0,variables:!0}).map(v=>({name:v.name,value:v.name,meta:v.meta}))}getMetricSources(v){return this.getList({metrics:!0,variables:!v?.skipVariables}).map(D=>({name:D.name,value:D.name,meta:D.meta}))}async reload(){const v=await(0,r.i)().get("/api/frontend/settings");u.default.datasources=v.datasources,u.default.defaultDatasource=v.defaultDatasource,this.init(v.datasources,v.defaultDatasource)}}function f(y){return(0,d.Pr)(y)?d.hr.uid:typeof y=="string"?y:y?.uid}function E(y){return Array.isArray(y)?y[0]:y}const h=()=>(0,g.F)()},63245:(j,I,e)=>{"use strict";e.d(I,{CR:()=>a,Ch:()=>c,IX:()=>u,KE:()=>l,_A:()=>f,eP:()=>o,ew:()=>P,fD:()=>y,lu:()=>E});var t=e(89949),n=e.n(t),i=e(27702),s=e(15766),r=e(13741),g=e(5933),d=e(43620);function l(b){console.warn(`[Plugin Extensions] ${b}`)}function u(b){return typeof b=="object"&&"type"in b&&b.type===s.D.link}function o(b){return typeof b=="object"&&"type"in b&&b.type===s.D.component}function m(b,M=""){return(...T)=>{try{return b(...T)}catch(S){S instanceof Error&&console.warn(`${M}${S.message}`)}}}function c(b){return{openModal:({title:T,body:S})=>{g.Z.publish(new d.Dn({component:p({title:T,body:S})}))},context:b}}const p=({title:b,body:M})=>({onDismiss:S})=>i.createElement(r.u,{title:b,isOpen:!0,onDismiss:S,onClickBackdrop:S},i.createElement(M,{onDismiss:S}));function f(b,M=new Map){if(!b||typeof b!="object"||Object.isFrozen(b))return b;const T=Array.isArray(b)?[...b]:{...b};if(M.has(b))return M.get(b);M.set(b,T);const S=Reflect.ownKeys(T);for(const x of S){const O=Array.isArray(T)?T[Number(x)]:T[x];O&&(typeof O=="object"||typeof O=="function")&&(Array.isArray(T)?T[Number(x)]=f(O,M):T[x]=f(O,M))}return Object.freeze(T)}function E(b,M){const T=`${b}${M.extensionPointId}${M.title}`;return Array.from(T).reduce((S,x)=>Math.imul(31,S)+x.charCodeAt(0)|0,0).toString()}const h=Symbol("isReadOnlyProxy");function y(b){if(!b||typeof b!="object"||D(b))return b;const M=new WeakMap;return new Proxy(b,{defineProperty:()=>!1,deleteProperty:()=>!1,isExtensible:()=>!1,set:()=>!1,get(T,S,x){if(S===h)return!0;const O=Reflect.get(T,S,x);return(0,t.isObject)(O)||(0,t.isArray)(O)?(M.has(O)||M.set(O,y(O)),M.get(O)):O}})}function v(b){return typeof b=="object"&&b!==null}function D(b){return v(b)&&b[h]===!0}function a(b){const M={type:s.D.link,...b};return C(M),M}function C(b){if(b.type!==s.D.link)throw Error("config is not a extension link")}function P(b,M){return b.length<M?b:`${b.slice(0,M-3).trimEnd()}...`}},59882:(j,I,e)=>{"use strict";e.d(I,{Ub:()=>d,_2:()=>o,eD:()=>l,pv:()=>u,q1:()=>m});var t=e(97585),n=e(12308),i=e(59307),s=e(8929);const r={},g={};function d(p){const f=r[p];if(f)return f;const E=u(p);if(!E)throw new Error(`Plugin ${p} not found`);return r[p]=c(E),p!==E.type&&(r[E.type]=r[p]),r[p]}function l(p){return!!u(p)}function u(p){return n.default.panels[p]||Object.values(n.default.panels).find(f=>f.alias===p)}function o(p){return c(p)}function m(p){return g[p]}function c(p){return(0,s.N$)({path:p.module,version:p.info?.version,isAngular:p.angularDetected,pluginId:p.id}).then(f=>{if(f.plugin)return f.plugin;if(f.PanelCtrl){const E=new t.c(null);return E.angularPanelCtrl=f.PanelCtrl,E}throw new Error("missing export: plugin or PanelCtrl")}).then(f=>(f.meta=p,g[p.id]=f,f)).catch(f=>(console.warn("Error loading panel plugin: "+p.id,f),(0,i.F)(p,f)))}},67821:(j,I,e)=>{"use strict";e.d(I,{Z:()=>s,a:()=>i});var t=e(73289);const n={};function i(r,g){const d=n[r];return d?Promise.resolve(d):(0,t.i)().get(`/api/plugins/${r}/settings`,void 0,void 0,g).then(l=>(n[r]=l,l)).catch(l=>Promise.reject(new Error("Unknown Plugin")))}const s=r=>r?delete n[r]:Object.keys(n).forEach(g=>delete n[g])},8929:(j,I,e)=>{"use strict";e.d(I,{kY:()=>Ma,Av:()=>ip,nL:()=>op,N$:()=>Yl});var t={};e.r(t),e.d(t,{plugin:()=>pe});var n={};e.r(n),e.d(n,{plugin:()=>ma});var i={};e.r(i),e.d(i,{plugin:()=>kt});var s={};e.r(s),e.d(s,{plugin:()=>Os});var r={};e.r(r),e.d(r,{plugin:()=>Du});var g={};e.r(g),e.d(g,{plugin:()=>ku});var d={};e.r(d),e.d(d,{plugin:()=>qu});var l={};e.r(l),e.d(l,{plugin:()=>mm});var u={};e.r(u),e.d(u,{plugin:()=>ym});var o={};e.r(o),e.d(o,{plugin:()=>Wc});var m={};e.r(m),e.d(m,{plugin:()=>Ys});var c={};e.r(c),e.d(c,{plugin:()=>Yc});var p={};e.r(p),e.d(p,{plugin:()=>Fm});var f={};e.r(f),e.d(f,{plugin:()=>rd});var E={};e.r(E),e.d(E,{plugin:()=>co});var h={};e.r(h),e.d(h,{plugin:()=>Ym});var y={};e.r(y),e.d(y,{plugin:()=>vf});var v={};e.r(v),e.d(v,{plugin:()=>Df});var D={};e.r(D),e.d(D,{plugin:()=>Mf});var a={};e.r(a),e.d(a,{plugin:()=>Kf});var C={};e.r(C),e.d(C,{plugin:()=>jf});var P={};e.r(P),e.d(P,{plugin:()=>ig});var b={};e.r(b),e.d(b,{plugin:()=>Kl});var M={};e.r(M),e.d(M,{plugin:()=>pg});var T={};e.r(T),e.d(T,{plugin:()=>vg});var S={};e.r(S),e.d(S,{plugin:()=>Og});var x=e(42844),O=e(46219),B=e(45306),A=e(7610),V=e.n(A),W=e(89949),w=e.n(W),N=e(79913),F=e.n(N),k=e(6570),H=e.n(k),R=e(27702),_=e(27473),G=e(27173),Y=e(85014),X=e(66920),Q=e(33199),se=e(19826),Z=e(37102),le=e(45273),oe=e(10418),q=e(73817),ne=e(97585),ge=e(68246),ae=e(62247),re=e(13597),De=e(1726),he=e(97073),ye=e(80549),ce=e(65469),We=e(28291),ke=e(12308),et=e(66574),we=e(45937),_e=e(6872),Ge=e(7999),qe=e(44380),st=e(13216),Me=e(86628),be=e(22513),Ke=e(34667),Ye=e(29372),tt=e(10027),nt=e(47702),Pt=e(76658),xt=e(33555),bt=e(84369),Rt=e(18771),ct=e(32082),it=e(66310),me=e(66670),Ee=e(8254),Ce=e(10759),Ae=e(33273),ze=e(14117),Ie=e(39036),xe=e(62862);const Te=({alertManagerSourceName:L,group:J,expandAll:ee})=>{const[de,ve]=(0,R.useState)(ee),Re=(0,it.wW)(Oe),Fe=(0,it.wW)(ze.r);return(0,R.useEffect)(()=>ve(ee),[ee]),R.createElement("div",{className:Re.group,"data-testid":"alert-group"},Object.keys(J.labels).length>0?R.createElement(Ee.s,{labels:J.labels,size:"sm"}):R.createElement("div",{className:Re.noGroupingText},"No grouping"),R.createElement("div",{className:Re.row},R.createElement(Ce.U,{isCollapsed:!de,onToggle:()=>ve(!de)})," ",R.createElement(Ae.Z,{group:J})),de&&R.createElement("div",{className:Re.alerts},J.alerts.map((je,Xe)=>{const at=je.status.state.toUpperCase(),dt=(0,ct.vT)({start:new Date(je.startsAt),end:Date.now()});return R.createElement("div",{"data-testid":"alert-group-alert",className:Re.alert,key:`${je.fingerprint}-${Xe}`},R.createElement("div",null,R.createElement("span",{className:Fe[je.status.state]},at," "),"for ",dt),R.createElement("div",null,R.createElement(Ee.s,{labels:je.labels,size:"sm"})),R.createElement("div",{className:Re.actionsRow},je.status.state===xe.Z9.Suppressed&&R.createElement(me.Qj,{href:`${(0,Ie.eQ)("/alerting/silences",L)}&silenceIds=${je.status.silencedBy.join(",")}`,className:Re.button,icon:"bell",size:"sm"},"Manage silences"),je.status.state===xe.Z9.Active&&R.createElement(me.Qj,{href:(0,Ie.VN)(L,je.labels),className:Re.button,icon:"bell-slash",size:"sm"},"Silence"),je.generatorURL&&R.createElement(me.Qj,{className:Re.button,href:je.generatorURL,icon:"chart-line",size:"sm"},"See source")))})))},Oe=L=>({noGroupingText:(0,x.css)` height: ${L.spacing(4)}; `,group:(0,x.css)` background-color: ${L.colors.background.secondary}; margin: ${L.spacing(.5,1,.5,1)}; padding: ${L.spacing(1)}; `,row:(0,x.css)` display: flex; flex-direction: row; align-items: center; gap: ${L.spacing(1)}; `,alerts:(0,x.css)` margin: ${L.spacing(0,2,0,4)}; `,alert:(0,x.css)` padding: ${L.spacing(1,0)}; & + & { border-top: 1px solid ${L.colors.border.medium}; } `,button:(0,x.css)` & + & { margin-left: ${L.spacing(1)}; } `,actionsRow:(0,x.css)` padding: ${L.spacing(1,0)}; `}),ie=(L,J)=>(0,R.useMemo)(()=>L.filter(ee=>(0,Pt.eD)(ee.labels,J)||ee.alerts.some(de=>(0,Pt.eD)(de.labels,J))),[L,J]),Le=L=>{const J=(0,Rt.useDispatch)(),ee=Ke.config.unifiedAlertingEnabled,de=L.options.expandAll,ve=L.options.alertmanager,Fe=((0,tt._)(dt=>dt.amAlertGroups)||bt.oq)[ve||""]?.result||[],je=L.options.labels?(0,Pt.Zh)(L.options.labels):[],Xe=ie(Fe,je);(0,R.useEffect)(()=>{function dt(){ve&&J((0,nt.mS)(ve))}dt();const ut=setInterval(dt,xt.iF);return()=>{clearInterval(ut)}},[J,ve]);const at=Xe.length>0;return R.createElement(Ye.$,{autoHeightMax:"100%",autoHeightMin:"100%"},ee&&R.createElement("div",null,at&&Xe.map(dt=>R.createElement(Te,{alertManagerSourceName:ve,key:JSON.stringify(dt.labels),group:dt,expandAll:de})),!at&&"No alerts"))};var Be=e(28580);function Ue(L){return L.name===be.GC?"Grafana":L.name.slice(0,37)}const ue=({onChange:L,current:J,dataSources:ee})=>{const de=(0,R.useMemo)(()=>ee.map(ve=>({label:Ue(ve),value:ve.name,imgUrl:ve.imgUrl,meta:ve.meta})),[ee]);return R.createElement(Be.Ph,{"aria-label":"Choose Alertmanager",width:29,backspaceRemovesValue:!1,onChange:ve=>ve.value&&L(ve.value),options:de,maxMenuHeight:500,noOptionsMessage:"No datasources found",value:J,getOptionLabel:ve=>ve.label})},pe=new ne.c(Le).setPanelOptions(L=>L.addCustomEditor({name:"Alertmanager",path:"alertmanager",id:"alertmanager",defaultValue:be.GC,category:["Options"],editor:function(ee){const de=(0,R.useMemo)(be.z3,[]);return R.createElement(ue,{current:ee.value,onChange:ve=>ee.onChange(ve),dataSources:de})}}).addBooleanSwitch({name:"Expand all by default",path:"expandAll",defaultValue:!1,category:["Options"]}).addTextInput({description:"Filter results by matching labels, ex: env=production,severity=~critical|warning",name:"Labels",path:"labels",category:["Filter"]}));var $e=e(72699),Se=e(41482),Ve=e(56027),He=e.n(Ve),Ze=e(74639),Qe=e(15758),rt=e(77799);async function pt({query:L,permissionLevel:J}){return(await(0,rt.ZL)(L,J)).map(ve=>({id:ve.id,title:ve.title,url:ve.url}))}async function It({query:L,permissionLevel:J,extraFolders:ee}){const de=await pt({query:L,permissionLevel:J}),ve=ee??[],Re=L?ve.filter(Fe=>Fe.title?.toLowerCase().includes(L.toLowerCase())):ve;return de?Re.concat(de):Re}async function _t({query:L,permissionLevel:J=Rt.PermissionLevelString.View,extraFolders:ee=[]}){return(await It({query:L,permissionLevel:J,extraFolders:ee})).map(ve=>({value:ve,label:ve.title}))}function tn(L,J){return L?.find(ee=>ee.value?.id===J)}async function qt(L){if(L!=null)try{const{id:J,title:ee}=await(0,rt.EW)(L);return{value:{id:J,title:ee},label:ee}}catch{console.error(`Could not find folder with id:${L}`)}}const cn={id:void 0,title:"All"},on={id:Qe.pW,title:Qe.fy};function ln({onChange:L,extraFolders:J=[],initialFolderId:ee,permissionLevel:de=Rt.PermissionLevelString.View}){const[ve,Re]=(0,R.useState)(!1),[Fe,je]=(0,R.useState)(void 0),[Xe,at]=(0,R.useState)(void 0),dt=(0,R.useCallback)(async Ot=>{let $t=tn(Ot,ee);$t||($t=await qt(ee)??Ot[0],L($t.value)),Re(!0),at(Ot),je($t)},[ee,L]),ut=(0,R.useCallback)(async Ot=>{const $t=await _t({query:Ot,permissionLevel:de,extraFolders:J});return ve||await dt($t),$t},[de,J,ve,dt]),St=He()(ut,300,{leading:!0}),mt=(0,R.useCallback)(({value:Ot})=>{const $t=tn(Xe,Ot?.id);je($t),L(Ot)},[Xe,L]);return R.createElement("div",{"data-testid":Ze.wl.components.ReadonlyFolderPicker.container},R.createElement(Be.qb,{loadingMessage:"Loading folders...",defaultOptions:!0,defaultValue:Fe,value:Fe,loadOptions:St,onChange:mt}))}var Un=e(53229),yt=e(25111),ft=e(99633),Tt=e(39317),Bt=e(73289),Nt=e(50230),Ft=e(73453),Gt=e(43609),dn=e(75261),sn=e(57183);function Bn(L){const[J,ee]=(0,R.useState)(""),de=(0,yt.Z)(async()=>{if(L.options.showOptions!==sn.kx.Current)return;const Fe={state:Vt(L.options.stateFilter)},je=(0,dn.h4)().getCurrent()?.getPanelById(L.id);L.options.alertName&&(Fe.query=(0,Tt.J)().replace(L.options.alertName,je.scopedVars)),L.options.folderId>=0&&(Fe.folderId=L.options.folderId),L.options.dashboardTitle&&(Fe.dashboardQuery=L.options.dashboardTitle),L.options.dashboardAlerts&&(Fe.dashboardId=(0,dn.h4)().getCurrent()?.id),L.options.tags&&(Fe.dashboardTag=L.options.tags);const Xe=await(0,Bt.i)().get("/api/alerts",Fe,`alert-list-get-current-alert-state-${L.id}`);let at=wt(L.options.sortOrder,Xe.map(dt=>({...dt,stateModel:Gt.Z.getStateDisplayModel(dt.state),newStateDateAgo:(0,ft.CQ)(dt.newStateDate).locale("en").fromNow(!0)})));return at.length>L.options.maxItems&&(at=at.slice(0,L.options.maxItems)),ee(at.length===0?"No alerts":""),at},[L.options.showOptions,L.options.stateFilter.alerting,L.options.stateFilter.execution_error,L.options.stateFilter.no_data,L.options.stateFilter.ok,L.options.stateFilter.paused,L.options.stateFilter.pending,L.options.maxItems,L.options.tags,L.options.dashboardAlerts,L.options.dashboardTitle,L.options.folderId,L.options.alertName,L.options.sortOrder,L.timeRange]),ve=(0,yt.Z)(async()=>{if(L.options.showOptions!==sn.kx.RecentChanges)return;const Fe={limit:L.options.maxItems,type:"alert",newState:Vt(L.options.stateFilter)},je=(0,dn.h4)().getCurrent();L.options.dashboardAlerts&&(Fe.dashboardId=je?.id),Fe.from=De.parse(je?.time.from).unix()*1e3,Fe.to=De.parse(je?.time.to).unix()*1e3;const Xe=await(0,Bt.i)().get("/api/annotations",Fe,`alert-list-get-state-changes-${L.id}`),at=wt(L.options.sortOrder,Xe.map(dt=>({...dt,time:je?.formatDate(dt.time,"MMM D, YYYY HH:mm:ss"),stateModel:Gt.Z.getStateDisplayModel(dt.newState),info:Gt.Z.getAlertAnnotationInfo(dt)})));return ee(at.length===0?"No alerts in current time range":""),at},[L.options.showOptions,L.options.maxItems,L.options.stateFilter.alerting,L.options.stateFilter.execution_error,L.options.stateFilter.no_data,L.options.stateFilter.ok,L.options.stateFilter.paused,L.options.stateFilter.pending,L.options.dashboardAlerts,L.options.sortOrder]),Re=(0,it.wW)(Ht);return R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},R.createElement("div",{className:Re.container},J&&R.createElement("div",{className:Re.noAlertsMessage},J),R.createElement("section",null,R.createElement("ol",{className:Re.alertRuleList},L.options.showOptions===sn.kx.Current?!de.loading&&de.value&&de.value.map(Fe=>R.createElement("li",{className:Re.alertRuleItem,key:`alert-${Fe.id}`},R.createElement(Nt.Z,{href:`${Fe.url}?viewPanel=${Fe.panelId}`,className:Re.cardContainer},R.createElement(Nt.Z.Heading,null,Fe.name),R.createElement(Nt.Z.Figure,{className:(0,x.cx)(Re.alertRuleItemIcon,Fe.stateModel.stateClass)},R.createElement(Ft.J,{name:Fe.stateModel.iconClass,size:"xl",className:Re.alertIcon})),R.createElement(Nt.Z.Meta,null,R.createElement("div",{className:Re.alertRuleItemText},R.createElement("span",{className:Fe.stateModel.stateClass},Fe.stateModel.text),R.createElement("span",{className:Re.alertRuleItemTime}," for ",Fe.newStateDateAgo)))))):!ve.loading&&ve.value&&ve.value.map(Fe=>R.createElement("li",{className:Re.alertRuleItem,key:`alert-${Fe.id}`},R.createElement(Nt.Z,{className:Re.cardContainer},R.createElement(Nt.Z.Heading,null,Fe.alertName),R.createElement(Nt.Z.Figure,{className:(0,x.cx)(Re.alertRuleItemIcon,Fe.stateModel.stateClass)},R.createElement(Ft.J,{name:Fe.stateModel.iconClass,size:"xl"})),R.createElement(Nt.Z.Meta,null,R.createElement("span",{className:(0,x.cx)(Re.alertRuleItemText,Fe.stateModel.stateClass)},Fe.stateModel.text),R.createElement("span",null,Fe.time),Fe.info&&R.createElement("span",{className:Re.alertRuleItemInfo},Fe.info)))))))))}function wt(L,J){if(L===sn.As.Importance)return(0,W.sortBy)(J,de=>Gt.Z.alertStateSortScore[de.state||de.newState]);if(L===sn.As.TimeAsc)return(0,W.sortBy)(J,de=>new Date(de.newStateDate||de.time));if(L===sn.As.TimeDesc)return(0,W.sortBy)(J,de=>new Date(de.newStateDate||de.time)).reverse();const ee=(0,W.sortBy)(J,de=>(de.name||de.alertName).toLowerCase());return L===sn.As.AlphaDesc&&ee.reverse(),ee}function Vt(L){return Object.entries(L).filter(([J,ee])=>ee).map(([J,ee])=>J)}const Ht=L=>({cardContainer:(0,x.css)` padding: ${L.spacing(.5)} 0 ${L.spacing(.25)} 0; line-height: ${L.typography.body.lineHeight}; margin-bottom: 0px; `,container:(0,x.css)` overflow-y: auto; height: 100%; `,alertRuleList:(0,x.css)` display: flex; flex-wrap: wrap; justify-content: space-between; list-style-type: none; `,alertRuleItem:(0,x.css)` display: flex; align-items: center; width: 100%; height: 100%; background: ${L.colors.background.secondary}; padding: ${L.spacing(.5)} ${L.spacing(1)}; border-radius: ${L.shape.borderRadius()}; margin-bottom: ${L.spacing(.5)}; `,alertRuleItemIcon:(0,x.css)` display: flex; justify-content: center; align-items: center; width: ${L.spacing(4)}; padding: 0 ${L.spacing(.5)} 0 ${L.spacing(.25)}; margin-right: 0px; `,alertRuleItemText:(0,x.css)` font-weight: ${L.typography.fontWeightBold}; font-size: ${L.typography.size.sm}; margin: 0; `,alertRuleItemTime:(0,x.css)` color: ${L.colors.text.secondary}; font-weight: normal; white-space: nowrap; `,alertRuleItemInfo:(0,x.css)` font-weight: normal; flex-grow: 2; display: flex; align-items: flex-end; `,noAlertsMessage:(0,x.css)` display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; `,alertIcon:(0,x.css)` margin-right: ${L.spacing(.5)}; `}),Xt=L=>{const J={showOptions:L.options.showOptions??L.show??sn.kx.Current,maxItems:L.options.maxItems??L.limit??10,sortOrder:L.options.sortOrder??L.sortOrder??sn.As.AlphaAsc,dashboardAlerts:L.options.dashboardAlerts??L.onlyAlertsOnDashboard??!1,alertName:L.options.alertName??L.nameFilter??"",dashboardTitle:L.options.dashboardTitle??L.dashboardFilter??"",folderId:L.options.folderId??L.folderId,tags:L.options.tags??L.dashboardTags??[],stateFilter:L.options.stateFilter??L.stateFilter?.reduce((de,ve)=>({...de,[ve]:!0}),{})??{}};return parseFloat(L.pluginVersion||"7.4")<7.5&&["show","limit","sortOrder","onlyAlertsOnDashboard","nameFilter","dashboardFilter","folderId","dashboardTags","stateFilter"].forEach(ve=>delete L[ve]),J};var mn=e(18447),pn=e(68093);function Pn(L,J){const ee=(0,Pt.Zh)(L);return(0,Pt.eD)(J,ee)}function zn(L,J){const{stateFilter:ee,alertInstanceLabelFilter:de}=L;return(0,W.isEmpty)(ee)?J:J.filter(ve=>(ee.firing&&((0,pn.j)(ve,mn.bj.Alerting)||(0,pn.j)(ve,mn.x_.Firing))||ee.pending&&((0,pn.j)(ve,mn.bj.Pending)||(0,pn.j)(ve,mn.x_.Pending))||ee.noData&&(0,pn.j)(ve,mn.bj.NoData)||ee.normal&&(0,pn.j)(ve,mn.bj.Normal)||ee.error&&(0,pn.j)(ve,mn.bj.Error)||ee.inactive&&(0,pn.j)(ve,mn.x_.Inactive))&&(de?Pn(L.alertInstanceLabelFilter,ve.labels):!0))}function Hn(L){return!(L.startsWith("__")&&L.endsWith("__"))}const Ea=L=>{const{onChange:J,id:ee,defaultValue:de,dataSource:ve}=L,Re=(0,Rt.useDispatch)();(0,R.useEffect)(()=>{ve?ve&&Re((0,nt.y6)({rulesSourceName:ve})):Re((0,nt.lB)())},[Re,ve]);const Fe=(0,tt._)(dt=>dt.promRules),je=(0,bt.PE)(Fe),Xe=(0,bt.yR)(Fe),at=(0,R.useMemo)(()=>{if((0,W.isEmpty)(Fe))return[];if(!je)return[];const dt=Object.keys(Fe).flatMap(ut=>Fe[ut].result??[]).flatMap(ut=>ut.groups).flatMap(ut=>ut.rules.filter(St=>St.type===mn.pz.Alerting)).flatMap(ut=>ut.alerts??[]).map(ut=>Object.keys(ut.labels??{})).flatMap(ut=>ut.filter(Hn));return(0,W.uniq)(dt)},[je,Fe]);return R.createElement(Be.NU,{id:ee,isLoading:Xe,defaultValue:de,"aria-label":"group by label keys",placeholder:"Group by",prefix:R.createElement(Ft.J,{name:"tag-alt"}),onChange:dt=>{J(dt.map(ut=>ut.value??""))},options:at.map(dt=>({label:dt,value:dt}))})};var aa=e(73195),na=e(19559),xa=e(32713),Ca=e(63439),Ba=e(52419),ka=e(50323),Ua=e(91368),$a=e(85096),Mt=e(93764),Dt=e(52467),ht=e(22446),Lt=e(21915),rn=e(6772),zt=e.n(rn),En=e(61404),Tn=e(97957);const An=({alerts:L,options:J,grafanaTotalInstances:ee,handleInstancesLimit:de,limitInstances:ve,grafanaFilteredInstancesTotal:Re})=>{const Fe=J.groupMode===sn.LM.Custom?!0:J.showInstances,[je,Xe]=(0,R.useState)(Fe),at=(0,it.wW)(xn),dt=(0,it.wW)(me.gN),ut=(0,R.useCallback)(()=>{Xe(ra=>!ra)},[]),St=(0,R.useMemo)(()=>zn(J,(0,Ie.Zl)(J.sortOrder,L))??[],[L,J]),mt=ee!==void 0,Ot=ee&&Re?ee-Re:0,$t=L.length-St.length,At=mt?Ot:$t,Wt=St.length>0,Jt=Wt?ut:W.noop;(0,R.useEffect)(()=>{St.length===0&&Xe(!1)},[St]);const en=async()=>{de&&(de(!1),Xe(!0))},Qt=async()=>{de&&(de(!0),Xe(!0))},fn=ve?Re:St.length,Yt=St.length,vn=mt?fn:Yt,In=ve?`Showing ${Mt.gr} of ${ee} instances`:`Showing all ${ee} instances`,Mn=ve?"View all instances":`Limit the result to ${Mt.gr} instances`,Rn=ee&&Mt.gr===St.length&&ee>St.length,$n=ee&&Mt.gr<St.length&&!ve,wn=Rn||$n?R.createElement("div",{className:at.footerRow},R.createElement("div",null,In),R.createElement(me.zx,{size:"sm",variant:"secondary",onClick:ve?en:Qt},Mn)):void 0;return R.createElement("div",null,J.groupMode===sn.LM.Default&&R.createElement("button",{className:(0,x.cx)(dt,Wt?at.clickable:""),onClick:()=>Jt()},Wt&&R.createElement(Ft.J,{name:je?"angle-down":"angle-right",size:"md"}),R.createElement("span",null,`${vn} ${zt()("instance",vn)}`),At>0&&R.createElement("span",null,", ",`${At} hidden by filters`)),je&&R.createElement(En.o,{instances:St,pagination:{itemsPerPage:2*Tn.gN},footerRow:wn}))},xn=L=>({clickable:(0,x.css)` cursor: pointer; `,footerRow:(0,x.css)` display: flex; flex-direction: column; gap: ${L.spacing(1)}; justify-content: space-between; align-items: center; width: 100%; `}),ia="__ungrouped__",oa=({rules:L,options:J})=>{const ee=(0,it.wW)(lr),de=J.groupBy,ve=(0,R.useMemo)(()=>{const Re=new Map,Fe=at=>de?ca(at,de):!0;L.forEach(at=>{const dt=(0,ht.Re)(at),ut=Fe(at);(dt?.alerts??[]).forEach(St=>{const mt=ut?_n(de,St.labels):ia,Ot=Re.get(mt)??[];Re.set(mt,[...Ot,St])})});const je=Re.get(ia)??[];return Re.delete(ia),Re.set(ia,je),Array.from(Re.entries()).reduce((at,[dt,ut])=>{const St=zn(J,ut);return St.length>0&&at.set(dt,St),at},new Map)},[de,L,J]);return R.createElement(R.Fragment,null,Array.from(ve).map(([Re,Fe])=>R.createElement("li",{className:ee.alertRuleItem,key:Re,"data-testid":Re},R.createElement("div",null,R.createElement("div",{className:ee.customGroupDetails},R.createElement("div",{className:ee.alertLabels},Re!==ia&&sa(Re).map(([je,Xe])=>R.createElement(Lt.i,{key:je,labelKey:je,value:Xe})),Re===ia&&"No grouping")),R.createElement(An,{alerts:Fe,options:J})))))};function _n(L,J){return new URLSearchParams(L.map(ee=>[ee,J[ee]])).toString()}function sa(L){return[...new URLSearchParams(L)]}function ca(L,J){const ee=(0,ht.Re)(L);return J.every(de=>(ee?.alerts??[]).some(ve=>ve.labels[de]))}const jn=oa;var ns=e(75136),Ta=e(23852),Ja=e(67045),ps=e(96437),Jn=e(59597);function Ya(L){return Object.values(L).filter(J=>J!==void 0).reduce((J,ee)=>J+ee,0)}const xs=({rules:L,options:J,handleInstancesLimit:ee,limitInstances:de,hideViewRuleLinkText:ve})=>{const Re=(0,it.wW)(lr),Fe=(0,it.wW)(ss),{href:je}=(0,ns.Z)(),Xe=L.length<=J.maxItems?L:L.slice(0,J.maxItems);return R.createElement(R.Fragment,null,R.createElement("ol",{className:Re.alertRuleList},Xe.map((at,dt)=>{const{namespaceName:ut,groupName:St,dataSourceName:mt}=at,Ot=(0,ht.x_)(at.promRule)?at.promRule:void 0,$t=(0,ht.ub)(Ot),At=(0,ps.Yd)(at.dataSourceName,at),Wt=(0,ps.$V)(At),Jt=at.dataSourceName===be.GC?Ya(at.instanceTotals):void 0,en=at.dataSourceName===be.GC?Ya(at.filteredInstanceTotals):void 0,Qt=(0,Jn.u)(`/alerting/${encodeURIComponent(mt)}/${encodeURIComponent(Wt)}/view`,{returnTo:je??""});return Ot?R.createElement("li",{className:Re.alertRuleItem,key:`alert-${ut}-${St}-${at.name}-${dt}`},R.createElement("div",{className:Fe.icon},R.createElement(Ft.J,{name:Gt.Z.getStateDisplayModel(Ot.state).iconClass,className:Fe[(0,ht.Aq)(Ot.state)],size:"lg"})),R.createElement("div",{className:Re.alertNameWrapper},R.createElement("div",{className:Re.instanceDetails},R.createElement(Ta.K,{direction:"row",gap:1,wrap:!1},R.createElement("div",{className:Re.alertName,title:at.name},at.name),R.createElement(Ja.L,null),Qt&&R.createElement("a",{href:Qt,target:"__blank",className:Re.link,rel:"noopener","aria-label":"View alert rule"},R.createElement("span",{className:(0,x.cx)({[Re.hidden]:ve})},"View alert rule"),R.createElement(Ft.J,{name:"external-link-alt",size:"sm"}))),R.createElement("div",{className:Re.alertDuration},R.createElement("span",{className:Fe[(0,ht.Aq)(Ot.state)]},(0,ht.SS)(Ot.state))," ",$t&&Ot.state!==mn.x_.Inactive&&R.createElement(R.Fragment,null,"for"," ",R.createElement("span",null,(0,ct.vT)({start:$t,end:Date.now()}))))),R.createElement(An,{alerts:Ot.alerts??[],options:J,grafanaTotalInstances:Jt,grafanaFilteredInstancesTotal:en,handleInstancesLimit:ee,limitInstances:de}))):null})))},ss=L=>({common:(0,x.css)` width: 70px; text-align: center; align-self: stretch; display: inline-block; color: white; border-radius: ${L.shape.borderRadius()}; font-size: ${L.typography.bodySmall.fontSize}; text-transform: capitalize; line-height: 1.2; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; `,icon:(0,x.css)` margin-top: ${L.spacing(2.5)}; align-self: flex-start; `,good:(0,x.css)` color: ${L.colors.success.main}; `,bad:(0,x.css)` color: ${L.colors.error.main}; `,warning:(0,x.css)` color: ${L.colors.warning.main}; `,neutral:(0,x.css)` color: ${L.colors.secondary.main}; `,info:(0,x.css)` color: ${L.colors.primary.main}; `}),Xa=xs;function Ps(L){const J=(ee,[de,ve])=>ve?[...ee,de]:ee;return Object.entries(L).reduce(J,[])}const hs=({dispatch:L,limitInstances:J,matcherList:ee,dataSourceName:de,stateList:ve})=>{L(de?(0,nt.dn)({rulesSourceName:de,limitAlerts:J?Mt.gr:void 0,matcher:ee,state:ve}):(0,nt.ei)(!1,{limitAlerts:J?Mt.gr:void 0,matcher:ee,state:ve}))};function qs(L){const J=(0,Rt.useDispatch)(),[ee,de]=(0,aa.Z)(!0),{usePrometheusRulesByNamespaceQuery:ve}=$a.alertRuleApi,Re=(0,tt._)(Sn=>Sn.promRules),Fe=(0,tt._)(Sn=>Sn.rulerRules),je=(0,bt.wt)(Re),Xe=L.width<320;(0,R.useEffect)(()=>{L.options.stateFilter.inactive===!0&&(L.options.stateFilter.normal=!0),L.options.stateFilter.inactive=void 0},[L.options.stateFilter]);let at;(0,na.Z)(()=>{at=(0,dn.h4)().getCurrent()});const dt=(0,R.useMemo)(()=>Ps(L.options.stateFilter),[L.options.stateFilter]),{options:ut,replaceVariables:St}=L,mt=ut.datasource===be.JY?be.GC:ut.datasource,Ot={...L.options,alertName:St(ut.alertName),alertInstanceLabelFilter:St(ut.alertInstanceLabelFilter)},$t=(0,R.useMemo)(()=>(0,Pt.Zh)(Ot.alertInstanceLabelFilter),[Ot.alertInstanceLabelFilter]),At=!mt||mt===be.GC,{currentData:Wt=[],isLoading:Jt,refetch:en}=ve({limitAlerts:ee?Mt.gr:void 0,matcher:$t,state:dt},{skip:!At});(0,R.useEffect)(()=>{Re.loading||hs({dispatch:J,limitInstances:ee,matcherList:$t,dataSourceName:mt,stateList:dt});const Sn=at?.events.subscribe(xa.md,()=>{At&&en(),(!mt||mt!==be.GC)&&hs({dispatch:J,limitInstances:ee,matcherList:$t,dataSourceName:mt,stateList:dt})});return()=>{Sn?.unsubscribe()}},[J,at,$t,dt,ee,mt,en,At,Re.loading]);const Qt=Sn=>{Sn?(hs({dispatch:J,limitInstances:ee,matcherList:$t,dataSourceName:mt,stateList:dt}),de(!0)):(hs({dispatch:J,limitInstances:!1,matcherList:$t,dataSourceName:mt,stateList:dt}),de(!1))},fn=(0,Dt.Zo)(void 0,Wt),Yt=(0,bt.wt)(Fe),vn=(0,bt.I7)(Re),In=je||Yt,Mn=(0,bt.yR)(Re),Rn=(0,it.wW)(lr),$n=(0,ht.C7)(fn),wn=L.options.sortOrder,ra=(0,R.useMemo)(()=>Tr(L,Sr(wn,$n)),[$n,wn,L]),Gn=ra.length===0?"No alerts matching filters":void 0;return!Ua.contextSrv.hasPermission(Rt.AccessControlAction.AlertingRuleRead)&&!Ua.contextSrv.hasPermission(Rt.AccessControlAction.AlertingRuleExternalRead)?R.createElement(Ca.b,{title:"Permission required"},"Sorry, you do not have the required permissions to read alert rules"):R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},R.createElement("div",{className:Rn.container},(Jt||In&&Mn&&!vn)&&R.createElement(Ba.u,{text:"Loading..."}),Gn&&R.createElement("div",{className:Rn.noAlertsMessage},Gn),R.createElement("section",null,L.options.viewMode===sn.wO.Stat&&vn&&R.createElement(ka.w6,{width:L.width,height:L.height,graphMode:ka.IG.None,textMode:ka.jG.Auto,justifyMode:ka.ap.Auto,theme:ke.config.theme2,value:{text:`${ra.length}`,numeric:ra.length}}),L.options.viewMode===sn.wO.List&&L.options.groupMode===sn.LM.Custom&&vn&&R.createElement(jn,{rules:ra,options:Ot}),L.options.viewMode===sn.wO.List&&L.options.groupMode===sn.LM.Default&&vn&&R.createElement(Xa,{rules:ra,options:Ot,handleInstancesLimit:Qt,limitInstances:ee,hideViewRuleLinkText:Xe}))))}function Sr(L,J){if(L===sn.As.Importance)return(0,W.sortBy)(J,de=>Gt.Z.alertStateSortScore[de.state]);if(L===sn.As.TimeAsc)return(0,W.sortBy)(J,de=>{const ve=(0,ht.Re)(de)??void 0;return(0,ht.ub)(ve)||new Date});if(L===sn.As.TimeDesc)return(0,W.sortBy)(J,de=>{const ve=(0,ht.Re)(de)??void 0;return(0,ht.ub)(ve)||new Date}).reverse();const ee=(0,W.sortBy)(J,de=>de.name.toLowerCase());return L===sn.As.AlphaDesc&&ee.reverse(),ee}function Tr(L,J){const{options:ee,replaceVariables:de}=L;let ve=[...J];if(ee.dashboardAlerts){const Re=(0,dn.h4)().getCurrent()?.uid;ve=ve.filter(({annotations:Fe={}})=>Object.entries(Fe).some(([je,Xe])=>je===xt.q6.dashboardUID&&Xe===Re))}if(ee.alertName){const Re=de(ee.alertName);ve=ve.filter(({name:Fe})=>Fe.toLocaleLowerCase().includes(Re.toLocaleLowerCase()))}if(ve=ve.filter(Re=>{const Fe=(0,ht.Re)(Re);return Fe?ee.stateFilter.firing&&Fe.state===mn.x_.Firing||ee.stateFilter.pending&&Fe.state===mn.x_.Pending||ee.stateFilter.normal&&Fe.state===mn.x_.Inactive:!1}),ee.folder&&(ve=ve.filter(Re=>Re.namespaceName===ee.folder.title)),ee.datasource){const Re=ee.datasource===be.JY;ve=ve.filter(Re?({dataSourceName:Fe})=>Fe===be.GC:({dataSourceName:Fe})=>Fe===ee.datasource)}return ve=ve.reduce((Re,Fe)=>{const je=(0,ht.Re)(Fe);return(je?zn({stateFilter:ee.stateFilter,alertInstanceLabelFilter:de(ee.alertInstanceLabelFilter)},je.alerts??[]):[]).length&&Re.push(Fe),Re},[]),ve}const lr=L=>({cardContainer:(0,x.css)` padding: ${L.spacing(.5)} 0 ${L.spacing(.25)} 0; line-height: ${L.typography.body.lineHeight}; margin-bottom: 0px; `,container:(0,x.css)` overflow-y: auto; height: 100%; `,alertRuleList:(0,x.css)` display: flex; flex-wrap: wrap; justify-content: space-between; list-style-type: none; `,alertRuleItem:(0,x.css)` display: flex; align-items: center; width: 100%; height: 100%; background: ${L.colors.background.secondary}; padding: ${L.spacing(.5)} ${L.spacing(1)}; border-radius: ${L.shape.borderRadius()}; margin-bottom: ${L.spacing(.5)}; gap: ${L.spacing(2)}; `,alertName:(0,x.css)` font-size: ${L.typography.h6.fontSize}; font-weight: ${L.typography.fontWeightBold}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; `,alertNameWrapper:(0,x.css)` display: flex; flex: 1; flex-wrap: nowrap; flex-direction: column; min-width: 100px; `,alertLabels:(0,x.css)` > * { margin-right: ${L.spacing(.5)}; } `,alertDuration:(0,x.css)` font-size: ${L.typography.bodySmall.fontSize}; `,alertRuleItemText:(0,x.css)` font-weight: ${L.typography.fontWeightBold}; font-size: ${L.typography.bodySmall.fontSize}; margin: 0; `,alertRuleItemTime:(0,x.css)` color: ${L.colors.text.secondary}; font-weight: normal; white-space: nowrap; `,alertRuleItemInfo:(0,x.css)` font-weight: normal; flex-grow: 2; display: flex; align-items: flex-end; `,noAlertsMessage:(0,x.css)` display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; `,alertIcon:(0,x.css)` margin-right: ${L.spacing(.5)}; `,instanceDetails:(0,x.css)` min-width: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; `,customGroupDetails:(0,x.css)` margin-bottom: ${L.spacing(.5)}; `,link:(0,x.css)` word-break: break-all; color: ${L.colors.primary.text}; display: flex; align-items: center; gap: ${L.spacing(1)}; `,hidden:(0,x.css)` display: none; `});class cr{getSuggestionsForData(J){const{dataSummary:ee}=J;if(ee.hasData)return;J.getListAppender({name:"Dashboard list",pluginId:"dashlist",options:{}}).append({})}}function Ds(L){return L.showOptions===sn.kx.Current}const kn=new ne.c(Bn).setPanelOptions(L=>{L.addSelect({name:"Show",path:"showOptions",settings:{options:[{label:"Current state",value:sn.kx.Current},{label:"Recent state changes",value:sn.kx.RecentChanges}]},defaultValue:sn.kx.Current,category:["Options"]}).addNumberInput({name:"Max items",path:"maxItems",defaultValue:10,category:["Options"]}).addSelect({name:"Sort order",path:"sortOrder",settings:{options:[{label:"Alphabetical (asc)",value:sn.As.AlphaAsc},{label:"Alphabetical (desc)",value:sn.As.AlphaDesc},{label:"Importance",value:sn.As.Importance},{label:"Time (asc)",value:sn.As.TimeAsc},{label:"Time (desc)",value:sn.As.TimeDesc}]},defaultValue:sn.As.AlphaAsc,category:["Options"]}).addBooleanSwitch({path:"dashboardAlerts",name:"Alerts from this dashboard",defaultValue:!1,category:["Options"]}).addTextInput({path:"alertName",name:"Alert name",defaultValue:"",category:["Filter"],showIf:Ds}).addTextInput({path:"dashboardTitle",name:"Dashboard title",defaultValue:"",category:["Filter"],showIf:Ds}).addCustomEditor({path:"folderId",name:"Folder",id:"folderId",defaultValue:null,editor:function({value:ee,onChange:de}){return R.createElement(ln,{initialFolderId:ee,onChange:ve=>de(ve?.id),extraFolders:[cn,on]})},category:["Filter"],showIf:Ds}).addCustomEditor({id:"tags",path:"tags",name:"Tags",description:"",defaultValue:[],editor(J){return R.createElement($e.B,{tags:J.value,onChange:J.onChange})},category:["Filter"],showIf:Ds}).addBooleanSwitch({path:"stateFilter.ok",name:"Ok",defaultValue:!1,category:["State filter"],showIf:Ds}).addBooleanSwitch({path:"stateFilter.paused",name:"Paused",defaultValue:!1,category:["State filter"],showIf:Ds}).addBooleanSwitch({path:"stateFilter.no_data",name:"No data",defaultValue:!1,category:["State filter"],showIf:Ds}).addBooleanSwitch({path:"stateFilter.execution_error",name:"Execution error",defaultValue:!1,category:["State filter"],showIf:Ds}).addBooleanSwitch({path:"stateFilter.alerting",name:"Alerting",defaultValue:!1,category:["State filter"],showIf:Ds}).addBooleanSwitch({path:"stateFilter.pending",name:"Pending",defaultValue:!1,category:["State filter"],showIf:Ds})}).setMigrationHandler(Xt).setSuggestionsSupplier(new cr),ya=new ne.c(qs).setPanelOptions(L=>{L.addRadio({path:"viewMode",name:"View mode",description:"Toggle between list view and stat view",defaultValue:sn.wO.List,settings:{options:[{label:"List",value:sn.wO.List},{label:"Stat",value:sn.wO.Stat}]},category:["Options"]}).addRadio({path:"groupMode",name:"Group mode",description:"How alert instances should be grouped",defaultValue:sn.LM.Default,settings:{options:[{value:sn.LM.Default,label:"Default grouping"},{value:sn.LM.Custom,label:"Custom grouping"}]},category:["Options"]}).addCustomEditor({path:"groupBy",name:"Group by",description:"Filter alerts using label querying",id:"groupBy",defaultValue:[],showIf:J=>J.groupMode===sn.LM.Custom,category:["Options"],editor:J=>R.createElement(Ea,{id:J.id??"groupBy",defaultValue:J.value.map(ee=>({label:ee,value:ee})),onChange:J.onChange,dataSource:J.context.options.datasource})}).addNumberInput({name:"Max items",path:"maxItems",description:"Maximum alerts to display",defaultValue:20,category:["Options"]}).addSelect({name:"Sort order",path:"sortOrder",description:"Sort order of alerts and alert instances",settings:{options:[{label:"Alphabetical (asc)",value:sn.As.AlphaAsc},{label:"Alphabetical (desc)",value:sn.As.AlphaDesc},{label:"Importance",value:sn.As.Importance},{label:"Time (asc)",value:sn.As.TimeAsc},{label:"Time (desc)",value:sn.As.TimeDesc}]},defaultValue:sn.As.AlphaAsc,category:["Options"]}).addBooleanSwitch({path:"dashboardAlerts",name:"Alerts from this dashboard",description:"Show alerts from this dashboard",defaultValue:!1,category:["Options"]}).addTextInput({path:"alertName",name:"Alert name",description:"Filter for alerts containing this text",defaultValue:"",category:["Filter"]}).addTextInput({path:"alertInstanceLabelFilter",name:"Alert instance label",description:'Filter alert instances using label querying, ex: {severity="critical", instance=~"cluster-us-.+"}',defaultValue:"",category:["Filter"]}).addCustomEditor({path:"datasource",name:"Datasource",description:"Filter alerts from selected datasource",id:"datasource",defaultValue:null,editor:function(ee){return R.createElement(Un.q,{...ee,type:["prometheus","loki","grafana"],noDefault:!0,current:ee.value,onChange:de=>ee.onChange(de.name),onClear:()=>ee.onChange(null)})},category:["Filter"]}).addCustomEditor({showIf:J=>J.datasource===be.JY||!J.datasource,path:"folder",name:"Folder",description:"Filter for alerts in the selected folder (only for Grafana alerts)",id:"folder",defaultValue:null,editor:function(ee){return R.createElement(Se.Fz,{enableReset:!0,showRoot:!1,allowEmpty:!0,initialTitle:ee.value?.title,initialFolderUid:ee.value?.uid,permissionLevel:Rt.PermissionLevelString.View,onClear:()=>ee.onChange(""),...ee})},category:["Filter"]}).addBooleanSwitch({path:"stateFilter.firing",name:"Alerting / Firing",defaultValue:!0,category:["Alert state filter"]}).addBooleanSwitch({path:"stateFilter.pending",name:"Pending",defaultValue:!0,category:["Alert state filter"]}).addBooleanSwitch({path:"stateFilter.noData",name:"No Data",defaultValue:!1,category:["Alert state filter"]}).addBooleanSwitch({path:"stateFilter.normal",name:"Normal",defaultValue:!1,category:["Alert state filter"]}).addBooleanSwitch({path:"stateFilter.error",name:"Error",defaultValue:!0,category:["Alert state filter"]})}),ma=Ke.config.unifiedAlertingEnabled?ya:kn;var Sa=e(19973),er=e(94469),ws=e(3935),Za=e(84714),jt=e(26129),va=e(86004),Vs=e(80402),Fr=e(20868),dr=e(5933),Zr=e(20540),Ss=e(80011);const sr=({options:L,annotation:J,formatDate:ee,onClick:de,onAvatarClick:ve,onTagClick:Re})=>{const Fe=(0,it.wW)(Va),{showUser:je,showTags:Xe,showTime:at}=L,{text:dt="",login:ut,email:St,avatarUrl:mt,tags:Ot,time:$t,timeEnd:At}=J,Wt=()=>{de(J)},Jt=()=>{ve(J)},en=ut&&je,Qt=$t&&at,fn=At&&At!==$t&&at;return R.createElement(Nt.Z,{className:Fe.card,onClick:Wt},R.createElement(Nt.Z.Heading,null,R.createElement(Zr.D,{className:Fe.heading,onClick:Yt=>{Yt.stopPropagation()},content:dt})),Qt&&R.createElement(Nt.Z.Description,{className:Fe.timestamp},R.createElement(ks,{formatDate:ee,time:$t}),fn&&R.createElement(R.Fragment,null,R.createElement("span",{className:Fe.time},"-"),R.createElement(ks,{formatDate:ee,time:At})," ")),en&&R.createElement(Nt.Z.Meta,{className:Fe.meta},R.createElement(Ts,{email:St,login:ut,avatarUrl:mt,onClick:Jt})),Xe&&Ot&&R.createElement(Nt.Z.Tags,null,R.createElement(va.P,{tags:Ot,onClick:Yt=>Re(Yt,!1)})))},Ts=({onClick:L,avatarUrl:J,login:ee,email:de})=>{const ve=(0,it.wW)(Va),Re=je=>{je.stopPropagation(),L()},Fe=R.createElement("span",null,"Created by:",R.createElement("br",null)," ",de);return R.createElement(Ss.u,{content:Fe,theme:"info",placement:"top"},R.createElement("button",{onClick:Re,className:ve.avatar,"aria-label":`Created by ${de}`},R.createElement("img",{src:J,alt:"avatar icon"})))},ks=({time:L,formatDate:J})=>{const ee=(0,it.wW)(Va);return R.createElement("span",{className:ee.time},R.createElement("span",null,J(L)))};function Va(L){return{card:(0,x.css)({gridTemplateAreas:'"Heading Description Meta Tags"',gridTemplateColumns:"auto 1fr auto auto",padding:L.spacing(1),margin:L.spacing(.5),width:"inherit"}),heading:(0,x.css)({a:{zIndex:1,position:"relative",color:L.colors.text.link,"&:hover":{textDecoration:"underline"}}}),meta:(0,x.css)({margin:0,position:"relative",justifyContent:"end"}),timestamp:(0,x.css)({margin:0,alignSelf:"center"}),time:(0,x.css)({marginLeft:L.spacing(1),marginRight:L.spacing(1),fontSize:L.typography.bodySmall.fontSize,color:L.colors.text.secondary}),avatar:(0,x.css)({border:"none",background:"inherit",margin:0,padding:L.spacing(.5),img:{borderRadius:L.shape.radius.circle,width:L.spacing(2),height:L.spacing(2)}})}}class Jr extends R.PureComponent{constructor(J){super(J),this.style=Ct(Ke.config.theme2),this.subs=new Sa.w0,this.tagListRef=R.createRef(),this.onAnnoClick=async ee=>{if(!ee.time)return;const{options:de}=this.props,Re=(0,dn.h4)().getCurrent(),Fe={from:this._timeOffset(ee.time,de.navigateBefore,!0),to:this._timeOffset(ee.timeEnd??ee.time,de.navigateAfter,!1)};if(de.navigateToPanel&&(Fe.viewPanel=ee.panelId),Re?.uid===ee.dashboardUID){jt.E1.partial(Fe);return}const je=await(0,Bt.i)().get("/api/search",{dashboardUIDs:ee.dashboardUID});if(je&&je.length&&je[0].uid===ee.dashboardUID){const Xe=je[0],at=new URL(Xe.url,window.location.origin);at.searchParams.set("from",Fe.from),at.searchParams.set("to",Fe.to),jt.E1.push(er.u.stripBaseFromUrl(at.toString()));return}dr.Z.emit(ws.SI.alertWarning,["Unknown Dashboard: "+ee.dashboardUID])},this.onTagClick=(ee,de)=>{if(!de&&this.state.queryTags.includes(ee))return;const ve=de?this.state.queryTags.filter(Fe=>Fe!==ee):[...this.state.queryTags,ee];let Re;if(de){const Fe=document.activeElement,je=Fe?.getAttribute("data-tag-id");if(this.tagListRef.current?.contains(Fe)&&je){const Xe=Number.parseInt(je,10),at=this.tagListRef.current.querySelector(`[data-tag-id="${Xe+1}"]`)??this.tagListRef.current.querySelector(`[data-tag-id="${Xe-1}"]`);at instanceof HTMLElement&&(Re=at)}}this.setState({queryTags:ve},()=>Re?.focus())},this.onUserClick=ee=>{this.setState({queryUser:{id:ee.userId,login:ee.login,email:ee.email}})},this.onClearUser=()=>{this.setState({queryUser:void 0})},this.renderItem=(ee,de)=>{const{options:ve}=this.props,Re=(0,dn.h4)().getCurrent();return Re?R.createElement(sr,{annotation:ee,formatDate:Re.formatDate,onClick:this.onAnnoClick,onAvatarClick:this.onUserClick,onTagClick:this.onTagClick,options:ve}):R.createElement(R.Fragment,null)},this.state={annotations:[],timeInfo:"",loaded:!1,queryTags:[]}}componentDidMount(){this.doSearch(),this.subs.add(this.props.eventBus.getStream(Za.n1).subscribe({next:()=>{this.doSearch()}}))}componentWillUnmount(){this.subs.unsubscribe()}componentDidUpdate(J,ee){const{options:de,timeRange:ve}=this.props;(de!==J.options||this.state.queryTags!==ee.queryTags||this.state.queryUser!==ee.queryUser||J.renderCounter!==this.props.renderCounter||de.onlyInTimeRange&&ve!==J.timeRange)&&this.doSearch()}async doSearch(){const{options:J}=this.props,{queryUser:ee,queryTags:de}=this.state,ve={tags:J.tags,limit:J.limit,type:"annotation"};J.onlyFromThisDashboard&&(ve.dashboardUID=(0,dn.h4)().getCurrent()?.uid);let Re="";if(J.onlyInTimeRange){const{timeRange:je}=this.props;ve.from=je.from.valueOf(),ve.to=je.to.valueOf()}else Re="All Time";ee&&(ve.userId=ee.id),J.tags&&J.tags.length&&(ve.tags=J.tags.map(je=>this.props.replaceVariables(je))),de.length&&(ve.tags=ve.tags?[...ve.tags,...de]:de);const Fe=await(0,Bt.i)().get("/api/annotations",ve,`anno-list-panel-${this.props.id}`);this.setState({annotations:Fe,timeInfo:Re,loaded:!0})}_timeOffset(J,ee,de=!1){let ve=5,Re="m";const Fe=/^(\d+)(\w)/.exec(ee);Fe&&Fe.length===3&&(ve=parseInt(Fe[1],10),Re=Fe[2]);const je=(0,ft.CQ)(J);return de&&(ve*=-1),je.add(ve,Re).valueOf()}render(){const{loaded:J,annotations:ee,queryUser:de,queryTags:ve}=this.state;if(!J)return R.createElement("div",null,"loading...");const Re=de||ve.length>0;return R.createElement(Ye.$,{autoHeightMin:"100%"},Re&&R.createElement("div",{className:this.style.filter},R.createElement("b",null,"Filter:"),de&&R.createElement(me.zx,{size:"sm",variant:"secondary",fill:"text",onClick:this.onClearUser,"aria-label":`Remove filter: ${de.email}`},de.email),ve.length>0&&R.createElement(va.P,{icon:"times",tags:ve,onClick:Fe=>this.onTagClick(Fe,!0),getAriaLabel:Fe=>`Remove ${Fe} tag`,className:this.style.tagList,ref:this.tagListRef})),ee.length<1&&R.createElement("div",{className:this.style.noneFound},"No Annotations Found"),R.createElement(Fr.L,{items:ee,renderItem:this.renderItem,getItemKey:Fe=>`${Fe.id}`}))}}const Ct=(0,Vs.B)(L=>({noneFound:(0,x.css)` display: flex; align-items: center; justify-content: center; width: 100%; height: calc(100% - 30px); `,filter:(0,x.css)({alignItems:"center",display:"flex",flexWrap:"wrap",gap:L.spacing(.5),padding:L.spacing(.5)}),tagList:(0,x.css)({justifyContent:"flex-start","li > button":{paddingLeft:"3px"}})})),gt={limit:10,navigateAfter:"10m",navigateBefore:"10m",navigateToPanel:!0,onlyFromThisDashboard:!1,onlyInTimeRange:!1,showTags:!0,showTime:!0,showUser:!0,tags:[]},kt=new ne.c(Jr).setPanelOptions(L=>{L.addRadio({category:["Annotation query"],path:"onlyFromThisDashboard",name:"Query filter",defaultValue:gt.onlyFromThisDashboard,settings:{options:[{value:!1,label:"All dashboards"},{value:!0,label:"This dashboard"}]}}).addRadio({category:["Annotation query"],path:"onlyInTimeRange",name:"Time range",defaultValue:gt.onlyInTimeRange,settings:{options:[{value:!1,label:"None"},{value:!0,label:"This dashboard"}]}}).addCustomEditor({category:["Annotation query"],id:"tags",path:"tags",name:"Tags",description:"Match annotation tags",editor(J){return R.createElement($e.B,{tags:J.value,onChange:J.onChange})}}).addNumberInput({category:["Annotation query"],path:"limit",name:"Limit",defaultValue:gt.limit}).addBooleanSwitch({category:["Display"],path:"showUser",name:"Show user",defaultValue:gt.showUser}).addBooleanSwitch({category:["Display"],path:"showTime",name:"Show time",defaultValue:gt.showTime}).addBooleanSwitch({category:["Display"],path:"showTags",name:"Show tags",defaultValue:gt.showTags}).addRadio({category:["Link behavior"],path:"navigateToPanel",name:"Link target",defaultValue:gt.navigateToPanel,settings:{options:[{value:!0,label:"Panel"},{value:!1,label:"Dashboard"}]}}).addTextInput({category:["Link behavior"],path:"navigateBefore",name:"Time before",defaultValue:gt.navigateBefore,description:""}).addTextInput({category:["Link behavior"],path:"navigateAfter",name:"Time after",defaultValue:gt.navigateAfter,description:""})}).setPanelChangeHandler((L,J,ee)=>J==="ryantxu-annolist-panel"?ee:L.options);var Kt=e(25587),an=e(93666),yn=e(27001),hn=e(75578),Ln=e(90482),un=e(29241),Et=e(64167),Vn=e(55219),da=e(53387),Ga=e(56617),Cs=e(74928),rs=e(1505),Bs=e(77148),pr=e(62575),Kr=e(64987),Pa=e(72566),vs=e(70823),hr=e(11724),Da=e(59685),is=e(34072),$s=e(71982),ai=e(30797),Xr=e(18869),vr=e(52995),qr=e(97695),Fi=e(79248),si=e(11921);const Ki=({config:L,onUPlotClick:J,setFocusedSeriesIdx:ee,setFocusedPointIdx:de,setCoords:ve,setHover:Re,isToolTipOpen:Fe,isActive:je,setIsActive:Xe,sync:at})=>{Fe.current=!1;const dt=()=>{Xe&&Xe(!0)},ut=()=>{Fe.current||(ve(null),Xe&&Xe(!1))};let St=null,mt=null;L.addHook("init",Wt=>{St=Wt.root.parentElement,mt=Wt.over,St?.addEventListener("click",J),mt.addEventListener("mouseleave",ut),mt.addEventListener("mouseenter",dt),at&&at()===Fi.m.Crosshair&&Wt.root.classList.add("shared-crosshair")});const Ot=()=>{Fe.current&&(ve(null),J())};L.addHook("drawClear",Ot),L.addHook("destroy",()=>{St?.removeEventListener("click",J),mt?.removeEventListener("mouseleave",ut),mt?.removeEventListener("mouseenter",dt),Ot()});let $t;L.addHook("syncRect",(Wt,Jt)=>{$t=Jt});const At=L.getTooltipInterpolator();return At&&L.addHook("setCursor",Wt=>{Fe.current||At(ee,de,Jt=>{if(Jt){ve(null);return}if(!$t)return;const{x:en,y:Qt}=(0,si._)(Wt,$t);en!==void 0&&Qt!==void 0&&ve({canvas:{x:Wt.cursor.left,y:Wt.cursor.top},viewport:{x:en,y:Qt}})},Wt)}),L.addHook("setLegend",Wt=>{if(!Fe.current&&!At&&de(Wt.legend.idx),Wt.cursor.idxs!=null)for(let Jt=0;Jt<Wt.cursor.idxs.length;Jt++){const en=Wt.cursor.idxs[Jt];if(en!=null){const Qt={xIndex:en,yIndex:0,pageX:$t.left+Wt.cursor.left,pageY:$t.top+Wt.cursor.top};(!Fe.current||!Qt)&&Re(Qt);return}}}),L.addHook("setSeries",(Wt,Jt)=>{Fe.current||ee(Jt)}),L};var Vr=e(35952),_s=e(55879),Vi=e(16546),Gs=e(26712),Ws=e(21609),eo=e(58192),Oo=e(48962),js=e(61965),$i=e(19345),fo=e(48473),tr=e(82382),go=e(96750),to=e(59479),no=e(94876);const _i=to.Gj,Xl=to.Gj,uu=8,zi=30,Io=.65,ql=.1,mu=.15,fu=5,po=10,ec=.1;function gu(L,J,ee,de,ve){const Re=(0,hr.X1)(L,14),Fe=J/(Re.width+2)*14,je=ee/de,Xe=Math.min(je,Fe);return{fontSize:Math.min(Xe,ve??Xe),textMetrics:Re}}function ho(L,J){const{xOri:ee,xDir:de,rawValue:ve,getColor:Re,formatValue:Fe,formatShortValue:je,fillOpacity:Xe=1,showValue:at,xSpacing:dt=0}=L,ut=ee===Et.wN.Horizontal,St=!L.text?.valueSize,mt=L.stacking!==Et.o0.None,Ot=L.stacking===Et.o0.Percent;let{groupWidth:$t,barWidth:At,barRadius:Wt=0}=L;mt&&([$t,At]=[At,$t]);let Jt,en;const Qt=On=>Array.from(On.data[0].map((Nn,Fn)=>Fn)),fn=dt===0?void 0:(On,Nn)=>{const Fn=On.bbox.width,qn=de*(ut?1:-1);let ea=Nn.length,ha=ea-1,ua=0,cs=Fn/Gs.Z.pxRatio,ds=Math.abs(Math.floor(cs/dt));ua=ea<ds?0:Math.ceil(ea/ds);let ar=Nn.map((Ls,Nr)=>ua!==0&&(dt>0?Nr:ha-Nr)%ua>0?null:Ls);return qn===1?ar:ar.reverse()},Yt=(On,Nn,Fn,qn,ea)=>{if(L.xTimeAuto){let ha=On.scales.x,ua=ha.min,cs=ha.max;ha.min=On.data[0][0],ha.max=On.data[0][On.data[0].length-1];let ds=(0,Da.mr)(On,Nn,Fn,qn,ea);return ha.min=ua,ha.max=cs,ds}return Nn.map(ha=>ut?je(0,ha):Fe(0,ha))},vn=(On,Nn,Fn)=>{Nn=0,Fn=Math.max(1,On.data[0].length-1);let qn=0;(0,to.Qm)(On.data[0].length,$t,_i,0,(ha,ua,cs)=>{qn=ua+cs/2});let ea=Fn-Nn;if(qn===.5)Nn-=ea;else{let ua=(1/(1-qn*2)*ea-ea)/2;Nn-=ua,Fn+=ua}return[Nn,Fn]};let In=(On,Nn)=>{let Fn=Array.from({length:Nn},()=>({offs:Array(On).fill(0),size:Array(On).fill(0)}));return(0,to.Qm)(On,$t,_i,null,(qn,ea,ha)=>{(0,to.Qm)(Nn,At,Xl,null,(ua,cs,ds)=>{Fn[ua].offs[qn]=ea+ha*cs,Fn[ua].size[qn]=ha*ds})}),Fn},Mn=(On,Nn)=>{let Fn=Array.from({length:Nn},()=>({offs:Array(On).fill(0),size:Array(On).fill(0)}));return(0,to.Qm)(On,$t,_i,null,(qn,ea,ha)=>{(0,to.Qm)(Nn,At,Xl,null,(ua,cs,ds)=>{Fn[ua].offs[qn]=ea,Fn[ua].size[qn]=ha})}),Fn};const Rn=ut?ql:mu,$n=ut?fu:po;let wn=[],ra=[],Gn=1,Sn,Xn=L.text?.valueSize??zi,la=$n,Fa=1/0,za=1/0,Ka=Re!=null,Ha=Ka?{fill:{unit:3,values:(On,Nn)=>ra[Nn].fill},stroke:{unit:3,values:(On,Nn)=>ra[Nn].stroke}}:{},Zn=Gs.Z.paths.bars({radius:Ot?0:mt?(On,Nn)=>Nn===On.data.length-1?[Wt,0]:[0,0]:Wt,disp:{x0:{unit:2,values:(On,Nn)=>wn[Nn].offs},size:{unit:2,values:(On,Nn)=>wn[Nn].size},...Ha},each:(On,Nn,Fn,qn,ea,ha,ua)=>{qn-=On.bbox.left,ea-=On.bbox.top;let cs=On.data[Nn][Fn];ut?(Fa=Math.min(Fa,cs<0?On.bbox.height-(ea+ua):ea),za=ha):(Fa=ua,za=Math.min(za,cs<0?qn:On.bbox.width-(qn+ha)));let ds={x:qn,y:ea,w:ha,h:ua,sidx:Nn,didx:Fn};if(L.fullHighlight&&(L.xOri===Et.wN.Horizontal?(ds.y=0,ds.h=On.bbox.height):(ds.x=0,ds.w=On.bbox.width)),Jt.add(ds),at!==Et.Jp.Never){const ar=ve(Nn,Fn);let Ls=1;Ot&&Na[Nn][Fn]&&(Ls=Na[Nn][Fn]);const Nr=Ls===0?0:ar/Ls,Yr=Fe(Nn,Nr);if(la=Math.min(la,Math.round(Rn*(ut?ha:ua))),Sn[Fn]===void 0&&(Sn[Fn]={}),Sn[Fn][Nn]={text:Yr,value:ve(Nn,Fn),hidden:!1},St){const{fontSize:ir,textMetrics:Ns}=gu(Sn[Fn][Nn].text,za*(ut?Io:1)-(ut?0:la),Fa*(ut?1:Io)-(ut?la:0),1);Sn[Fn][Nn].textMetrics=Ns;let ts=Math.round(Math.min(Xn,zi,ir));Gn=ts/Xn*(ts/14),Xn=ts}else Sn[Fn][Nn].textMetrics=(0,hr.X1)(Sn[Fn][Nn].text,Xn);let mo=ut?0:-Math.round(ec*Xn),Js=ve(Nn,Fn);if(L.negY?.[Nn]&&Js!=null&&(Js*=-1),Js!=null){const ir=On.bbox.left+(ut?qn+ha/2:Js<0?qn-la:qn+ha+la),Ns=On.bbox.top+(ut?Js<0?ea+ua+la:ea-la:ea+ua/2-mo),{textMetrics:ts={width:1,actualBoundingBoxAscent:1,actualBoundingBoxDescent:1}}=Sn[Fn][Nn];let wr=0,gr=0;ut?(wr=ts.width*Gn/2,gr=Js>0?(ts.actualBoundingBoxAscent+ts.actualBoundingBoxDescent)*Gn:0):(gr=(ts.actualBoundingBoxAscent+ts.actualBoundingBoxDescent)*Gn/2,wr=Js<0?ts.width*Gn:0),Sn[Fn][Nn].x=ir,Sn[Fn][Nn].y=Ns,Sn[Fn][Nn].bbox={x:ir-wr,y:Ns-gr,w:ts.width*Gn,h:(ts.actualBoundingBoxAscent+ts.actualBoundingBoxDescent)*Gn}}}}});const Wn=On=>{let Nn=On.over;Nn.style.overflow="hidden",On.root.querySelectorAll(".u-cursor-pt").forEach(Fn=>{Fn instanceof HTMLElement&&(Fn.style.borderRadius="0",L.fullHighlight&&(Fn.style.zIndex="-1"))})},Yn={x:!1,y:!1,drag:{x:!1,y:!1},dataIdx:(On,Nn)=>{if(Nn===1){en=null;let Fn=On.cursor.left*Gs.Z.pxRatio,qn=On.cursor.top*Gs.Z.pxRatio;Jt.get(Fn,qn,1,1,ea=>{(0,no.Pn)(Fn,qn,ea.x,ea.y,ea.x+ea.w,ea.y+ea.h)&&(mt?(en==null||ea.h*ea.w<en.h*en.w)&&(en=ea):en=ea)})}return en&&Nn===en.sidx?en.didx:null},points:{fill:"rgba(255,255,255,0.4)",bbox:(On,Nn)=>{let Fn=en&&Nn===en.sidx,qn=0,ea=0;if(mt&&Fn){const ha=en&&en.sidx>1&&(0,no.zZ)(Jt,en.sidx-1,en.didx);ha&&(ut?qn=ha.h:ea=ha.w)}return{left:Fn?(en.x+ea)/Gs.Z.pxRatio:-10,top:Fn?en.y/Gs.Z.pxRatio:-10,width:Fn?(en.w-ea)/Gs.Z.pxRatio:0,height:Fn?(en.h-qn)/Gs.Z.pxRatio:0}}}},ta=On=>{if(Jt=Jt||new no.lW(0,0,On.bbox.width,On.bbox.height),Jt.clear(),On.series.forEach(Nn=>{Nn._paths=null}),mt?wn=[null].concat(Mn(On.data[0].length,On.data.length-1)):wn=[null].concat(In(On.data[0].length,On.data.length-1)),Ka){ra=[null];for(let Nn=1;Nn<On.data.length;Nn++){let Fn=On.data[Nn].map((qn,ea)=>qn!=null?Re(Nn,ea,qn):null);ra.push({fill:Xe<1?Fn.map(qn=>qn!=null?(0,go.alpha)(qn,Xe):null):Fn,stroke:Fn})}}Sn={},Xn=L.text?.valueSize??zi,la=$n,Fa=za=1/0},ga=On=>{if(at===Et.Jp.Never||Xn<uu)return;On.ctx.save(),On.ctx.fillStyle=J.colors.text.primary,On.ctx.font=`${Xn}px ${J.typography.fontFamily}`;let Nn,Fn;for(const qn in Sn){let ea=!0;for(const ha in Sn[qn]){const ua=Sn[qn][ha],{text:cs,x:ds=0,y:ar=0}=ua;let{value:Ls}=ua;L.negY?.[ha]&&Ls!=null&&(Ls*=-1);let Nr=ut?"center":Ls!==null&&Ls<0?"right":"left",Yr=ut?Ls!==null&&Ls<0?"top":"alphabetic":"middle";if(Nr!==Nn&&(On.ctx.textAlign=Nn=Nr),Yr!==Fn&&(On.ctx.textBaseline=Fn=Yr),at===Et.Jp.Always)On.ctx.fillText(cs,ds,ar);else if(at===Et.Jp.Auto){let{bbox:mo}=ua,Js=!1;if(mo==null)Js=!0,ua.hidden=!0;else if(!ea)for(const ir in Sn[qn]){if(ir===ha)continue;const Ns=Sn[qn][ir],{bbox:ts,hidden:wr}=Ns;if(!wr&&ts&&(0,no.kK)(mo,ts)){Js=!0,ua.hidden=!0;break}}ea=!1,!Js&&On.ctx.fillText(cs,ds,ar)}}}On.ctx.restore()},fa=(On,Nn,Fn,qn)=>{en?(On(en.sidx),Nn(en.didx),Fn()):Fn(!0)};let Na=null;function pa(On,Nn){return Na=null,(0,fo.Bj)(On[0],Nn,({totals:Fn})=>{Na=Fn})}return{cursor:Yn,xRange:vn,xValues:Yt,xSplits:Qt,hFilter:fn,barsBuilder:Zn,init:Wn,drawClear:ta,draw:ga,interpolateTooltip:fa,prepData:pa}}const Or={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:Et.wm.Auto,showValue:Et.Jp.Auto,stacking:Et.o0.None,xTickLabelRotation:0,xTickLabelSpacing:0},Hi={fillOpacity:80,gradientMode:Et.FI.None,lineWidth:1};function pu(L){return L===Ln.wm.Vertical?{xOri:Et.wN.Horizontal,xDir:Et.bQ.Right,yOri:Et.wN.Vertical,yDir:Et.bQ.Up}:{xOri:Et.wN.Vertical,xDir:Et.bQ.Down,yOri:Et.wN.Horizontal,yDir:Et.bQ.Right}}const Ro=({frame:L,theme:J,orientation:ee,showValue:de,groupWidth:ve,barWidth:Re,barRadius:Fe=0,stacking:je,text:Xe,rawValue:at,getColor:dt,fillOpacity:ut,allFrames:St,xTickLabelRotation:mt,xTickLabelMaxLength:Ot,xTickLabelSpacing:$t=0,legend:At,timeZone:Wt,fullHighlight:Jt})=>{const en=new $i.U,Qt=(Gn,Sn)=>(0,Ws.zc)(L.fields[Gn].display(Sn)),fn=(Gn,Sn)=>ri(Qt(Gn,Sn),Ot),Yt=pu(ee);L.fields.length===2&&(ve=Re,Re=1);const vn={xOri:Yt.xOri,xDir:Yt.xDir,groupWidth:ve,barWidth:Re,barRadius:Fe,stacking:je,rawValue:at,getColor:dt,fillOpacity:ut,formatValue:Qt,formatShortValue:fn,timeZone:Wt,text:Xe,showValue:de,legend:At,xSpacing:$t,xTimeAuto:L.fields[0]?.type===un.fS.time&&!L.fields[0].config.unit?.startsWith("time:"),negY:L.fields.map(Gn=>Gn.config.custom?.transform===Et.pR.NegativeY),fullHighlight:Jt},In=ho(vn,J);if(en.setCursor(In.cursor),en.addHook("init",In.init),en.addHook("drawClear",In.drawClear),en.addHook("draw",In.draw),en.setTooltipInterpolator(In.interpolateTooltip),mt!==0){let Gn=50,Sn=Yt.xOri===Et.wN.Horizontal?14:5;en.setPadding(hu(L,mt,Ot,Gn,Sn))}en.setPrepData(In.prepData),en.addScale({scaleKey:"x",isTime:!1,range:In.xRange,distribution:Et.wf.Ordinal,orientation:Yt.xOri,direction:Yt.xDir});const Mn=L.fields[0].config.custom?.axisPlacement!==Et.LB.Hidden?Yt.xOri===Et.wN.Horizontal?Et.LB.Bottom:Et.LB.Left:Et.LB.Hidden,Rn=L.fields[0].config.custom?.axisPlacement!==Et.LB.Hidden;en.addAxis({scaleKey:"x",isTime:!1,placement:Mn,label:L.fields[0].config.custom?.axisLabel,splits:In.xSplits,filter:Yt.xOri===0?In.hFilter:void 0,values:In.xValues,timeZone:Wt,grid:{show:!1},ticks:{show:!1},gap:15,tickLabelRotation:Yt.xOri===0?mt*-1:0,theme:J,show:Rn});let $n=0;const wn=Ao(At);for(let Gn=1;Gn<L.fields.length;Gn++){const Sn=L.fields[Gn];$n++;const Xn={...Hi,...Sn.config.custom},la=Sn.config.unit||Xr.j,Fa=(0,eo.fD)(Sn),Ka=(0,eo.YO)(Sn,J).color;let Ha=Xn.axisSoftMin,Zn=Xn.axisSoftMax;if(Ha==null&&Sn.config.min==null&&(Ha=0),Zn==null&&Sn.config.max==null&&(Zn=0),Xn.thresholdsStyle&&Sn.config.thresholds&&(Xn.thresholdsStyle.mode??Et.i3.Off)!==Et.i3.Off&&en.addThresholds({config:Xn.thresholdsStyle,thresholds:Sn.config.thresholds,scaleKey:la,theme:J,hardMin:Sn.config.min,hardMax:Sn.config.max,softMin:Xn.axisSoftMin,softMax:Xn.axisSoftMax}),en.addSeries({scaleKey:la,pxAlign:!0,lineWidth:Xn.lineWidth,lineColor:Ka,fillOpacity:Xn.fillOpacity,theme:J,colorMode:Fa,pathBuilder:In.barsBuilder,show:!Xn.hideFrom?.viz,gradientMode:Xn.gradientMode,thresholds:Sn.config.thresholds,hardMin:Sn.config.min,hardMax:Sn.config.max,softMin:Ha,softMax:Zn,dataFrameFieldIndex:{fieldIndex:wn?Gn:St[0].fields.findIndex(Wn=>Wn.type===un.fS.number&&Wn.state?.seriesIndex===$n-1),frameIndex:0}}),en.addScale({scaleKey:la,min:Sn.config.min,max:Sn.config.max,softMin:Ha,softMax:Zn,orientation:Yt.yOri,direction:Yt.yDir,distribution:Xn.scaleDistribution?.type,log:Xn.scaleDistribution?.log}),Xn.axisPlacement!==Et.LB.Hidden){let Wn=Xn.axisPlacement;(!Wn||Wn===Et.LB.Auto)&&(Wn=Et.LB.Left),Yt.xOri===1&&(Wn===Et.LB.Left&&(Wn=Et.LB.Bottom),Wn===Et.LB.Right&&(Wn=Et.LB.Top)),en.addAxis({scaleKey:la,label:Xn.axisLabel,size:Xn.axisWidth,placement:Wn,formatValue:(Yn,ta)=>(0,Ws.zc)(Sn.display(Yn,ta)),filter:Yt.yOri===0?In.hFilter:void 0,tickLabelRotation:Yt.xOri===1?mt*-1:0,theme:J,grid:{show:Xn.axisGridShow}})}}let ra=(0,fo.i7)(L);return en.setStackingGroups(ra),en};function ri(L,J){return L.length>J?L.substring(0,J).concat("..."):L}function hu(L,J,ee,de=0,ve=0){const Re=L.fields[0].values,Fe=Da.gD,je=L.fields[0].display,Xe=mt=>je?je(Re[mt]):Re[mt];let at=0;for(let mt=0;mt<Re.length;mt++){let Ot=(0,hr.X1)(ri((0,Ws.zc)(Xe(mt)),ee),Fe);at=Ot.width>at?Ot.width:at}const dt=J>0?Math.cos(J*Math.PI/180)*(0,hr.X1)(ri((0,Ws.zc)(Xe(Re.length-1)),ee),Fe).width:0,ut=J<0?Math.cos(J*-1*Math.PI/180)*(0,hr.X1)(ri((0,Ws.zc)(Xe(0)),ee),Fe).width:0,St=Math.sin((J>=0?J:J*-1)*Math.PI/180)*at-ve;return[Math.round(Da.gD*Gs.Z.pxRatio),dt,St,Math.max(0,ut-de)]}function tc(L,J,ee){if(!L?.length)return{warn:"No data in response"};(0,hn.UY)(L);const de=L.length===1?(0,Oo.Y3)(L[0],L[0].fields.findIndex(ut=>ut.type===un.fS.time)):(0,Oo._9)({frames:L});if(!de)return{warn:"Unable to join data"};let ve;if(ee.colorByField&&(ve=(0,tr.findField)(de,ee.colorByField),!ve))return{warn:"Color field not found"};let Re;if(ee.xField&&(Re=(0,tr.findField)(de,ee.xField),!Re))return{warn:"Configured x field not found"};let Fe,je,Xe=[];for(const ut of de.fields)if(ut!==Re)switch(ut.type){case un.fS.string:Fe||(Fe=ut);break;case un.fS.time:je||(je=ut);break;case un.fS.number:{const St={...ut,state:{...ut.state,seriesIndex:Xe.length},config:{...ut.config,custom:{...ut.config.custom,stacking:{group:"_",mode:ee.stacking}}},values:ut.values.map(mt=>Number.isFinite(mt)||mt==null?mt:null)};ee.stacking===Et.o0.Percent&&(St.config.unit="percentunit",St.display=(0,js.U)({field:St,theme:J})),Xe.push(St)}}let at=Re;if(at||(at=Fe||je),!at)return{warn:"Bar charts requires a string or time field"};if(!Xe.length)return{warn:"No numeric fields found"};if(ve&&Xe.length>1){const ut=Xe.find(St=>St!==ve);ut&&(Xe=[ut])}let dt=Xe;return ee.stacking===Et.o0.Percent&&(dt=Xe.map(ut=>{const St=de.fields.find(Ot=>Ot.state?.displayName===ut.state?.displayName),mt={...ut,config:{...St.config},values:ut.values};return mt.display=(0,js.U)({field:mt,theme:J}),mt}),dt.unshift(at)),Xe.unshift(at),{aligned:de,colorByField:ve,viz:[{length:at.values.length,fields:Xe}],legend:{fields:dt,length:at.values.length}}}const Ao=L=>!!(L?.sortBy&&L.sortDesc!==null),nc=10,vu=["orientation","barWidth","barRadius","xTickLabelRotation","xTickLabelMaxLength","xTickLabelSpacing","groupWidth","stacking","showValue","xField","colorField","legend",(L,J)=>J.text?.valueSize===L.text?.valueSize],Eu=({data:L,options:J,fieldConfig:ee,width:de,height:ve,timeZone:Re,id:Fe})=>{const je=(0,it.l4)(),{eventBus:Xe}=(0,vs.R9)(),at=(0,R.useRef)(void 0),dt=(0,R.useRef)(!1),[ut,St]=(0,R.useState)(void 0),[mt,Ot]=(0,R.useState)(null),[$t,At]=(0,R.useState)(null),[Wt,Jt]=(0,R.useState)(null),[en,Qt]=(0,R.useState)(!1),[fn,Yt]=(0,R.useState)(!1),vn=()=>{dt.current=!1,Ot(null),Yt(!1)},In=()=>{dt.current=!dt.current,Yt(dt.current)},Mn=(0,R.useRef)(),Rn=(0,R.useRef)(),$n=(0,R.useMemo)(()=>tc(L.series,je,J),[L.series,je,J]),wn="viz"in $n?$n:null;Rn.current=wn?.colorByField;const ra=(0,R.useRef)(1e4);(0,R.useMemo)(()=>{ra.current++},[J]);const Gn=(0,R.useMemo)(()=>{const Wn=wn?.viz[0],Yn=Mn.current;return Wn&&Yn&&(0,Kr.Ch)(Wn,Yn,!0)||ra.current++,Mn.current=Wn,(L.structureRev??0)+ra.current},[wn,L.structureRev]),Sn=(0,R.useMemo)(()=>!J.orientation||J.orientation===Ln.wm.Auto?de<ve?Ln.wm.Horizontal:Ln.wm.Vertical:J.orientation,[de,ve,J.orientation]),Xn=(0,R.useMemo)(()=>{if(J.xTickLabelMaxLength)return J.xTickLabelMaxLength;{const Wn=J.xTickLabelRotation,Yn=(0,hr.X1)("M",Da.gD).width;return ve/2/(Math.sin((Wn>=0?Wn:Wn*-1)*Math.PI/180)*Yn)-3}},[ve,J.xTickLabelRotation,J.xTickLabelMaxLength]);if("warn"in $n)return R.createElement(Pa.Z,{panelId:Fe,fieldConfig:ee,data:L,message:$n.warn,needsNumberField:!0});const la=(Wn,Yn,ta)=>{const ga=Yn==null?null:Wn.fields[Yn];if(ga){const pa=(0,hn.CZ)(ga,Wn);Yn=$n.aligned.fields.findIndex(On=>pa===(0,hn.CZ)(On,$n.aligned))}const fa=J.fullHighlight&&J.stacking!==Et.o0.None?Et.f3.Multi:J.tooltip.mode,Na=J.tooltip.mode===Et.f3.Multi?J.tooltip.sort:Et.As.None;return R.createElement(R.Fragment,null,fn&&R.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},R.createElement(Vr.P,{onClick:vn,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),R.createElement(Vi.H,{data:$n.aligned,rowIndex:ta,columnIndex:Yn,sortOrder:Na,mode:fa}))},Fa=Wn=>{const{legend:Yn}=J;if(!Wn||Yn.showLegend===!1)return null;if($n.colorByField){const ta=(0,_s.$m)([$n.colorByField],je);if(ta?.length)return R.createElement(is.AY.Legend,{placement:Yn.placement},R.createElement($s.l,{placement:Yn.placement,items:ta,displayMode:Yn.displayMode}))}return R.createElement(ai.l,{data:[$n.legend],config:Wn,maxHeight:"35%",maxWidth:"60%",...J.legend})},za=(Wn,Yn)=>Mn.current.fields[Wn].values[Yn];let Ka,Ha=1;if($n.colorByField){const Wn=$n.colorByField,Yn=Wn.display;Ha=(Wn.config.custom.fillOpacity??100)/100,Ka=(ta,ga)=>Yn(Rn.current?.values[ga]).color}else Mn.current.fields.some(Yn=>Yn.config.custom?.gradientMode===Et.FI.Scheme&&Yn.config.color?.mode===an.S.Thresholds||Yn.config.mappings?.some(ga=>ga.type==="value"?Object.values(ga.options).some(fa=>fa.color!=null):ga.options.result.color!=null))&&(Ha=(Mn.current.fields.find(ta=>ta.type===un.fS.number).config.custom.fillOpacity??100)/100,Ka=(ta,ga)=>{let fa=Mn.current.fields[ta];return fa.display(fa.values[ga]).color});const Zn=(Wn,Yn,ta)=>{const{barWidth:ga,barRadius:fa=0,showValue:Na,groupWidth:pa,stacking:On,legend:Nn,tooltip:Fn,text:qn,xTickLabelRotation:ea,xTickLabelSpacing:ha,fullHighlight:ua}=J;return Ro({frame:Wn,getTimeRange:ta,timeZone:Re,theme:je,timeZones:[Re],eventBus:Xe,orientation:Sn,barWidth:ga,barRadius:fa,showValue:Na,groupWidth:pa,xTickLabelRotation:ea,xTickLabelMaxLength:Xn,xTickLabelSpacing:ha,stacking:On,legend:Nn,tooltip:Fn,text:qn,rawValue:za,getColor:Ka,fillOpacity:Ha,allFrames:$n.viz,fullHighlight:ua})};return R.createElement(Xr.d,{theme:je,frames:$n.viz,prepConfig:Zn,propsToDiff:vu,preparePlotFrame:Wn=>Wn[0],renderLegend:Fa,legend:J.legend,timeZone:Re,timeRange:{from:1,to:1},structureRev:Gn,width:de,height:ve},Wn=>(at.current!==Wn&&(at.current=Ki({config:Wn,onUPlotClick:In,setFocusedSeriesIdx:At,setFocusedPointIdx:Jt,setCoords:Ot,setHover:St,isToolTipOpen:dt,isActive:en,setIsActive:Qt})),J.tooltip.mode===Et.f3.None?null:R.createElement(vr.h_,null,ut&&mt&&$t&&R.createElement(qr.S,{position:{x:mt.viewport.x,y:mt.viewport.y},offset:{x:nc,y:nc},allowPointerEvents:dt.current},la($n.viz[0],$t,Wt)))))};var Er=e(64022),oi=e(40705),yu=e(83967);const ki=[{label:"None",value:0,description:"Show all tick marks"},{label:"Small",value:100,description:"Require 100px spacing"},{label:"Medium",value:200,description:"Require 200px spacing"},{label:"Large",value:300,description:"Require 300px spacing"}],Pu=L=>{let J=L.value??0;const ee=J<0;ee&&(J*=-1);let de=ki[0];for(const Fe of ki)if(de=Fe,J<=de.value)break;const ve=Fe=>{L.onChange(Fe*(ee?-1:1))},Re=()=>{L.onChange(L.value*-1)};return R.createElement(Er.Lh,null,R.createElement(oi.S,{value:de.value,options:ki,onChange:ve}),J!==0&&R.createElement(Ss.u,{content:"Require space from the right side",placement:"top"},R.createElement("div",null,R.createElement(yu.X,{value:ee,onChange:Re,label:"RTL"}))))};var ba=e(7641);class Gi{getListWithDefaults(J){return J.getListAppender({name:ba.y.BarChart,pluginId:"barchart",options:{showValue:Et.Jp.Never,legend:{calcs:[],displayMode:Et.jK.List,showLegend:!0,placement:"right"}},fieldConfig:{defaults:{unit:"short",custom:{}},overrides:[]},cardOptions:{previewModifier:ee=>{ee.options.barWidth=.8}}})}getSuggestionsForData(J){const ee=this.getListWithDefaults(J),{dataSummary:de}=J;de.frameCount===1&&(!de.hasNumberField||!de.hasStringField||de.rowCountTotal>50||(ee.append({name:ba.y.BarChart}),de.numberFieldCount>1&&(ee.append({name:ba.y.BarChartStacked,options:{stacking:Et.o0.Normal}}),ee.append({name:ba.y.BarChartStackedPercent,options:{stacking:Et.o0.Percent}})),ee.append({name:ba.y.BarChartHorizontal,options:{orientation:Ln.wm.Horizontal}}),de.numberFieldCount>1&&(ee.append({name:ba.y.BarChartHorizontalStacked,options:{stacking:Et.o0.Normal,orientation:Ln.wm.Horizontal}}),ee.append({name:ba.y.BarChartHorizontalStackedPercent,options:{orientation:Ln.wm.Horizontal,stacking:Et.o0.Percent}}))))}}const Os=new ne.c(Eu).useFieldConfig({standardOptions:{[Kt.qb.Color]:{settings:{byValueSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:an.S.PaletteClassic}}},useCustomConfig:L=>{const J=Hi;L.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:J.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:J.fillOpacity,settings:{min:0,max:100,step:1}}).addRadio({path:"gradientMode",name:"Gradient mode",defaultValue:Vn.q.fillGradient[0].value,settings:{options:Vn.q.fillGradient}}),L.addSelect({category:["Graph styles"],name:"Transform",path:"transform",settings:{options:[{label:"Constant",value:Et.pR.Constant,description:"The first value will be shown as a constant line"},{label:"Negative Y",value:Et.pR.NegativeY,description:"Flip the results to negative values on the y axis"}],isClearable:!0},hideFromDefaults:!0}),L.addCustomEditor({id:"thresholdsStyle",path:"thresholdsStyle",name:"Show thresholds",category:["Thresholds"],defaultValue:{mode:Et.i3.Off},settings:{options:Vn.q.thresholdsDisplayModes},editor:pr.F,override:pr.F,process:yn.kG,shouldApply:()=>!0}),da.r(L,J,!1),Ga.B(L)}}).setPanelOptions((L,J)=>{const ee=tc(J.data,Ke.config.theme2,J.options??{});let de="First string or time field";const ve="viz"in ee?ee.viz[0]:void 0;if(ve?.fields?.length){const Re=ve.fields[0];de+=` (${(0,hn.CZ)(Re,ve)})`}L.addFieldNamePicker({path:"xField",name:"X Axis",settings:{placeholderText:de}}).addRadio({path:"orientation",name:"Orientation",settings:{options:[{value:Ln.wm.Auto,label:"Auto"},{value:Ln.wm.Horizontal,label:"Horizontal"},{value:Ln.wm.Vertical,label:"Vertical"}]},defaultValue:Or.orientation}).addSliderInput({path:"xTickLabelRotation",name:"Rotate x-axis tick labels",defaultValue:Or.xTickLabelRotation,settings:{min:-90,max:90,step:15,marks:{"-90":"-90\xB0","-45":"-45\xB0",0:"0\xB0",45:"45\xB0",90:"90\xB0"},included:!1}}).addNumberInput({path:"xTickLabelMaxLength",name:"X-axis tick label max length",description:"X-axis labels will be truncated to the length provided",settings:{placeholder:"None",min:0},showIf:Re=>Re.xTickLabelRotation!==0}).addCustomEditor({id:"xTickLabelSpacing",path:"xTickLabelSpacing",name:"X-axis labels minimum spacing",defaultValue:Or.xTickLabelSpacing,editor:Pu}).addRadio({path:"showValue",name:"Show values",settings:{options:[{value:Et.Jp.Auto,label:"Auto"},{value:Et.Jp.Always,label:"Always"},{value:Et.Jp.Never,label:"Never"}]},defaultValue:Or.showValue}).addRadio({path:"stacking",name:"Stacking",settings:{options:Vn.q.stacking},defaultValue:Or.stacking}).addSliderInput({path:"groupWidth",name:"Group width",defaultValue:Or.groupWidth,settings:{min:0,max:1,step:.01},showIf:(Re,Fe)=>Re.stacking&&Re.stacking!==Et.o0.None?!1:ac(Fe)!==1}).addSliderInput({path:"barWidth",name:"Bar width",defaultValue:Or.barWidth,settings:{min:0,max:1,step:.01}}).addSliderInput({path:"barRadius",name:"Bar radius",defaultValue:Or.barRadius,settings:{min:0,max:.5,step:.05}}).addBooleanSwitch({path:"fullHighlight",name:"Highlight full area on hover",defaultValue:Or.fullHighlight}),L.addFieldNamePicker({path:"colorByField",name:"Color by field",description:"Use the color value for a sibling field to color each bar value."}),(!J.options?.fullHighlight||J.options?.stacking===Et.o0.None)&&Cs.L(L),rs.J(L),Bs.Z(L,!1)}).setSuggestionsSupplier(new Gi);function ac(L){let J=0;if(L)for(const ee of L)for(const de of ee.fields)de.type===un.fS.number&&J++;return J}var vo=e(50250),ii=e(14035);const ji=L=>(0,vo.rD)(L);var sc=e(72082);const Lo={displayMode:Et.QH.Gradient,minVizHeight:10,minVizWidth:0,showUnfilled:!0,valueMode:Et.M8.Color};class rc{getSuggestionsForData(J){const{dataSummary:ee}=J;if(!ee.hasData||!ee.hasNumberField)return;const de=J.getListAppender({name:"",pluginId:"bargauge",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}});ee.numberFieldCount>50||(ee.hasStringField&&ee.frameCount===1&&ee.rowCountTotal<30?(de.append({name:ba.y.BarGaugeBasic,options:{reduceOptions:{values:!0,calcs:[]},displayMode:Et.QH.Basic,orientation:Ln.wm.Horizontal},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}}),de.append({name:ba.y.BarGaugeLCD,options:{reduceOptions:{values:!0,calcs:[]},displayMode:Et.QH.Lcd,orientation:Ln.wm.Horizontal},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}})):(de.append({name:ba.y.BarGaugeBasic,options:{displayMode:Et.QH.Basic,orientation:Ln.wm.Horizontal,reduceOptions:{values:!1,calcs:["lastNotNull"]}},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}}),de.append({name:ba.y.BarGaugeLCD,options:{displayMode:Et.QH.Lcd,orientation:Ln.wm.Horizontal,reduceOptions:{values:!1,calcs:["lastNotNull"]}},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}})))}}const Du=new ne.c(sc.M).useFieldConfig().setPanelOptions(L=>{(0,ii.j)(L),(0,ii.h)(L),Bs.Z(L),L.addRadio({path:"displayMode",name:"Display mode",settings:{options:[{value:Et.QH.Gradient,label:"Gradient"},{value:Et.QH.Lcd,label:"Retro LCD"},{value:Et.QH.Basic,label:"Basic"}]},defaultValue:Lo.displayMode}).addRadio({path:"valueMode",name:"Value display",settings:{options:[{value:Et.M8.Color,label:"Value color"},{value:Et.M8.Text,label:"Text color"},{value:Et.M8.Hidden,label:"Hidden"}]},defaultValue:Lo.valueMode}).addBooleanSwitch({path:"showUnfilled",name:"Show unfilled area",description:"When enabled renders the unfilled region as gray",defaultValue:Lo.showUnfilled,showIf:J=>J.displayMode!=="lcd"}).addNumberInput({path:"minVizWidth",name:"Min width",description:"Minimum column width",defaultValue:Lo.minVizWidth,showIf:J=>J.orientation===Ln.wm.Vertical}).addNumberInput({path:"minVizHeight",name:"Min height",description:"Minimum row height",defaultValue:Lo.minVizHeight,showIf:J=>J.orientation===Ln.wm.Horizontal})}).setPanelChangeHandler(vo.ZH).setMigrationHandler(ji).setSuggestionsSupplier(new rc);var Ir=e(2643),Qi=e(21708),li=e(25181),ao=e(67151),Bo=e(20205),Cu=e(93562),ci=e(76566),Yi=e(5354);const oc=L=>J=>{const ee=L.visualization.getColorByName(J?.color||Yi.Jx);return{markerTriangle:(0,x.css)` width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 4px solid ${ee}; `,markerBar:(0,x.css)` display: block; width: calc(100%); height: 5px; background: ${ee}; `}};var ic=e(58281),bu=e(79812),bs=e(23839),qa=e(22209),Us=e(60105),lc=e(16310),$r=e(1041),cc=e(11285);const Eo=R.forwardRef(({annotation:L,onSave:J,onDismiss:ee,timeFormatter:de,className:ve,...Re},Fe)=>{const je=(0,it.wW)(Mu),Xe=(0,vs.R9)(),at=(0,R.useRef)(null);(0,bu.Z)(at,()=>{ee()});const[dt,ut]=(0,ic.default)(async fn=>{const Yt=await Xe.onAnnotationCreate(fn);return J&&J(),Yt}),[St,mt]=(0,ic.default)(async fn=>{const Yt=await Xe.onAnnotationUpdate(fn);return J&&J(),Yt}),Ot=L.id!==void 0,$t=L.time!==L.timeEnd,At=Ot?mt:ut,Wt=Ot?St:dt,Jt=$t?`${de(L.time)} - ${de(L.timeEnd)}`:de(L.time),en=({tags:fn,description:Yt})=>{At({id:L.id,tags:fn,description:Yt,from:Math.round(L.time),to:Math.round(L.timeEnd)})},Qt=R.createElement("div",{ref:Fe,className:(0,x.cx)(je.editor,ve),...Re},R.createElement("div",{className:je.header},R.createElement(Er.Lh,{justify:"space-between",align:"center"},R.createElement("div",{className:je.title},"Add annotation"),R.createElement("div",{className:je.ts},Jt))),R.createElement("div",{className:je.editorForm},R.createElement(bs.l,{onSubmit:en,defaultValues:{description:L?.text,tags:L?.tags||[]}},({register:fn,errors:Yt,control:vn})=>R.createElement(R.Fragment,null,R.createElement(qa.g,{label:"Description",invalid:!!Yt.description,error:Yt?.description?.message},R.createElement(Us.K,{...fn("description",{required:"Annotation description is required"})})),R.createElement(qa.g,{label:"Tags"},R.createElement(lc.g,{control:vn,name:"tags",render:({field:{ref:In,onChange:Mn,...Rn}})=>R.createElement($r.D,{allowCustomValue:!0,placeholder:"Add tags",onChange:Mn,tagOptions:cc.lK,tags:Rn.value})})),R.createElement(Er.Lh,{justify:"flex-end"},R.createElement(me.zx,{size:"sm",variant:"secondary",onClick:ee,fill:"outline"},"Cancel"),R.createElement(me.zx,{size:"sm",type:"submit",disabled:Wt?.loading},Wt?.loading?"Saving":"Save"))))));return R.createElement(R.Fragment,null,R.createElement("div",{className:je.backdrop}),R.createElement("div",{ref:at},Qt))});Eo.displayName="AnnotationEditorForm";const Mu=L=>({backdrop:(0,x.css)` label: backdrop; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; overflow: hidden; z-index: ${L.zIndex.navbarFixed}; `,editorContainer:(0,x.css)` position: absolute; top: calc(100% + 10px); transform: translate3d(-50%, 0, 0); `,editor:(0,x.css)` background: ${L.colors.background.primary}; box-shadow: ${L.shadows.z3}; z-index: ${L.zIndex.dropdown}; border: 1px solid ${L.colors.border.weak}; border-radius: ${L.shape.borderRadius()}; width: 460px; `,editorForm:(0,x.css)` padding: ${L.spacing(1)}; `,header:(0,x.css)` border-bottom: 1px solid ${L.colors.border.weak}; padding: ${L.spacing(1.5,1)}; `,title:(0,x.css)` font-weight: ${L.typography.fontWeightMedium}; `,ts:(0,x.css)` font-size: ${L.typography.bodySmall.fontSize}; color: ${L.colors.text.secondary}; `}),xu=({onDismiss:L,onSave:J,timeZone:ee,data:de,selection:ve,annotation:Re,style:Fe})=>{const je=(0,it.l4)(),Xe=(0,it.wW)(Is),at=(0,it.wW)(oc),[dt,ut]=(0,R.useState)(null),[St,mt]=(0,R.useState)(null),Ot=(0,ci.D)(dt,St,{modifiers:[{name:"arrow",enabled:!1},{name:"preventOverflow",enabled:!0,options:{rootBoundary:"viewport"}}]});let $t=de.fields[0];if(!$t)return null;const At=$t.display||(0,js.U)({field:$t,timeZone:ee,theme:je}),Wt=ve.min!==ve.max;return R.createElement(vr.h_,null,R.createElement(R.Fragment,null,R.createElement("div",{style:Fe},R.createElement("div",{className:(0,x.cx)((0,x.css)` position: absolute; top: ${ve.bbox.top}px; left: ${ve.bbox.left}px; width: ${ve.bbox.width}px; height: ${ve.bbox.height}px; `,Wt?Xe.overlayRange(Re):Xe.overlay(Re))},R.createElement("div",{ref:ut,className:Wt?(0,x.cx)(at(Re).markerBar,Xe.markerBar):(0,x.cx)(at(Re).markerTriangle,Xe.markerTriangle)}))),R.createElement(Eo,{annotation:Re||{time:ve.min,timeEnd:ve.max},timeFormatter:Jt=>At(Jt).text,onSave:J,onDismiss:L,ref:mt,style:Ot.styles.popper,...Ot.attributes.popper})))},Is=L=>({overlay:J=>{const ee=L.visualization.getColorByName(J?.color||Yi.Jx);return(0,x.css)` border-left: 1px dashed ${ee}; `},overlayRange:J=>{const ee=L.visualization.getColorByName(J?.color||Yi.Jx);return(0,x.css)` background: ${go.alpha(ee,.1)}; border-left: 1px dashed ${ee}; border-right: 1px dashed ${ee}; `},markerTriangle:(0,x.css)` top: calc(100% + 2px); left: -4px; position: absolute; `,markerBar:(0,x.css)` top: 100%; left: 0; position: absolute; `}),Uo=({data:L,timeZone:J,config:ee,children:de})=>{const ve=(0,R.useRef)(),[Re,Fe]=(0,R.useState)(),[je,Xe]=(0,R.useState)(!1),[at,dt]=(0,R.useState)(null),ut=(0,Cu.Z)(),St=(0,R.useCallback)(()=>{dt(null),ve.current&&ve.current.setSelect({top:0,left:0,width:0,height:0}),Xe(!1)},[Xe,dt]);(0,R.useLayoutEffect)(()=>{let Ot=!1;ee.addHook("init",At=>{ve.current=At;const Wt=At.hooks.setSelect;if(Wt)for(let Jt=0;Jt<Wt.length;Jt++){const en=Wt[Jt];en!==$t&&(Wt[Jt]=(...Qt)=>{!Ot&&en(...Qt)})}}),ee.addHook("syncRect",(At,Wt)=>{ut()&&Fe(Wt)});const $t=At=>{Ot&&(Xe(!0),dt({min:At.posToVal(At.select.left,"x"),max:At.posToVal(At.select.left+At.select.width,"x"),bbox:{left:At.select.left,top:0,height:At.select.height,width:At.select.width}}),Ot=!1)};ee.addHook("setSelect",$t),ee.setCursor({bind:{mousedown:(At,Wt,Jt)=>en=>(Ot=en.button===0&&(en.metaKey||en.ctrlKey),Jt(en),null),mouseup:(At,Wt,Jt)=>en=>(Ot&&At.select.width===0&&(At.select.left=At.cursor.left,At.select.height=At.bbox.height/window.devicePixelRatio),Jt(en),null)}})},[ee,Fe,ut]);const mt=(0,R.useCallback)(({coords:Ot})=>{if(!ve.current||!Re||!Ot)return;const $t=ve.current.posToVal(Ot.plotCanvas.x,"x");$t&&(dt({min:$t,max:$t,bbox:{left:Ot.plotCanvas.x,top:0,height:Re.height,width:0}}),Xe(!0))},[Re]);return R.createElement(R.Fragment,null,je&&at&&Re&&R.createElement(xu,{selection:at,onDismiss:St,onSave:St,data:L,timeZone:J,style:{position:"absolute",top:`${Re.top}px`,left:`${Re.left}px`,width:`${Re.width}px`,height:`${Re.height}px`}}),de?de({startAnnotating:mt}):null)};var Aa=e(27938),dc=e(42341),uc=e(60956),mc=e(65347),No=e(97289),Zi=e(48154),so=e(67437),fc=e(65333);const gc=({annotation:L,timeFormatter:J,canEdit:ee,canDelete:de,onEdit:ve,onDelete:Re})=>{const Fe=(0,it.wW)(Su),je=J(L.time),Xe=J(L.timeEnd);let at=L.text;const dt=L.tags;let ut="",St,mt,Ot=null;const $t=R.createElement("span",{className:Fe.time},L.isRegion?`${je} - ${Xe}`:je);if(L.login&&L.avatarUrl&&(St=R.createElement("img",{className:Fe.avatar,alt:"Annotation avatar",src:L.avatarUrl})),L.alertId!==void 0&&L.newState){const At=Gt.Z.getStateDisplayModel(L.newState);Ot=R.createElement("div",{className:Fe.alertState},R.createElement("i",{className:At.stateClass},At.text)),ut=Gt.Z.getAlertAnnotationInfo(L)}else L.title&&(at=L.title+"<br />"+(typeof at=="string"?at:""));return(ee||de)&&(mt=R.createElement("div",{className:Fe.editControls},ee&&R.createElement(so.h,{name:"pen",size:"sm",onClick:ve,tooltip:"Edit"}),de&&R.createElement(so.h,{name:"trash-alt",size:"sm",onClick:Re,tooltip:"Delete"}))),R.createElement("div",{className:Fe.wrapper},R.createElement("div",{className:Fe.header},R.createElement(Er.Lh,{justify:"space-between",align:"center",spacing:"md"},R.createElement("div",{className:Fe.meta},R.createElement("span",null,St,Ot),$t),mt)),R.createElement("div",{className:Fe.body},at&&R.createElement("div",{dangerouslySetInnerHTML:{__html:Zi.QX.sanitize(at)}}),ut,R.createElement(R.Fragment,null,R.createElement(Er.Lh,{spacing:"xs",wrap:!0},dt?.map((At,Wt)=>R.createElement(fc.V,{name:At,key:`${At}-${Wt}`}))))))};gc.displayName="AnnotationTooltip";const Su=L=>({wrapper:(0,x.css)` max-width: 400px; `,commentWrapper:(0,x.css)` margin-top: 10px; border-top: 2px solid #2d2b34; height: 30vh; overflow-y: scroll; padding: 0 3px; `,header:(0,x.css)` padding: ${L.spacing(.5,1)}; border-bottom: 1px solid ${L.colors.border.weak}; font-size: ${L.typography.bodySmall.fontSize}; display: flex; `,meta:(0,x.css)` display: flex; justify-content: space-between; `,editControls:(0,x.css)` display: flex; align-items: center; > :last-child { margin-right: 0; } `,avatar:(0,x.css)` border-radius: ${L.shape.radius.circle}; width: 16px; height: 16px; margin-right: ${L.spacing(1)}; `,alertState:(0,x.css)` padding-right: ${L.spacing(1)}; font-weight: ${L.typography.fontWeightMedium}; `,time:(0,x.css)` color: ${L.colors.text.secondary}; font-weight: normal; display: inline-block; position: relative; top: 1px; `,body:(0,x.css)` padding: ${L.spacing(1)}; a { color: ${L.colors.text.link}; &:hover { text-decoration: underline; } } `}),Tu=6,pc={modifiers:[{name:"arrow",enabled:!1},{name:"preventOverflow",enabled:!0,options:{rootBoundary:"viewport"}}]};function Ou({annotation:L,timeZone:J,width:ee}){const{canAddAnnotations:de,canEditAnnotations:ve,canDeleteAnnotations:Re,...Fe}=(0,vs.R9)(),je=(0,it.wW)(oc),Xe=(0,it.wW)(Iu),[at,dt]=(0,R.useState)(!1),[ut,St]=(0,R.useState)(!1),[mt,Ot]=(0,R.useState)(null),[$t,At]=(0,R.useState)(null),[Wt,Jt]=(0,R.useState)(null),en=(0,R.useRef)(),Qt=(0,ci.D)(mt,$t,pc),fn=(0,ci.D)(mt,Wt,pc),Yt=(0,R.useCallback)(()=>{St(!0),dt(!1)},[St,dt]),vn=(0,R.useCallback)(()=>{Fe.onAnnotationDelete&&Fe.onAnnotationDelete(L.id)},[L,Fe]),In=(0,R.useCallback)(()=>{en.current&&clearTimeout(en.current),dt(!0)},[dt]),Mn=(0,R.useCallback)(()=>{en.current&&clearTimeout(en.current)},[]),Rn=(0,R.useCallback)(()=>{en.current=setTimeout(()=>{dt(!1)},100)},[dt]),$n=(0,R.useCallback)(Xn=>(0,uc.dq)(Xn,{format:mc.U6.fullDate,timeZone:J}),[J]),wn=(0,R.useCallback)(()=>R.createElement(gc,{annotation:L,timeFormatter:$n,onEdit:Yt,onDelete:vn,canEdit:ve(L.dashboardUID),canDelete:Re(L.dashboardUID)}),[ve,Re,vn,Yt,$n,L]),ra=!!L.isRegion&&ee>Tu;let Gn=`${ee/2}px`,Sn=R.createElement("div",{className:je(L).markerTriangle,style:{left:Gn,position:"relative",transform:"translate3d(-100%,-50%, 0)"}});return ra&&(Sn=R.createElement("div",{className:je(L).markerBar,style:{width:`${ee}px`,transform:"translate3d(0,-50%, 0)"}})),R.createElement(R.Fragment,null,R.createElement("div",{ref:Ot,onMouseEnter:In,onMouseLeave:Rn,className:ra?void 0:Xe.markerWrapper,"data-testid":Ze.wl.pages.Dashboard.Annotations.marker},Sn),at&&R.createElement(vr.h_,null,R.createElement("div",{ref:At,style:Qt.styles.popper,...Qt.attributes.popper,className:Xe.tooltip,onMouseEnter:Mn,onMouseLeave:Rn},wn())),ut&&R.createElement(vr.h_,null,R.createElement(Eo,{onDismiss:()=>St(!1),onSave:()=>St(!1),timeFormatter:$n,annotation:L,ref:Jt,style:fn.styles.popper,...fn.attributes.popper})))}const Iu=L=>({markerWrapper:(0,x.css)` label: markerWrapper; padding: 0 4px 4px 4px; `,wrapper:(0,x.css)` max-width: 400px; `,tooltip:(0,x.css)` ${(0,No.getTooltipContainerStyles)(L)}; padding: 0; `}),Ji=({annotations:L,timeZone:J,config:ee})=>{const de=(0,it.l4)(),ve=(0,R.useRef)(),Re=(0,R.useRef)();(0,R.useEffect)(()=>{const Xe=[];for(const at of L)Xe.push(new Aa.U(at));return Re.current=Xe,()=>{Re.current=[]}},[L]),(0,R.useLayoutEffect)(()=>{ee.addHook("init",Xe=>{ve.current=Xe}),ee.addHook("draw",Xe=>{if(!Re.current)return null;const at=Xe.ctx;if(!at)return;at.save(),at.beginPath(),at.rect(Xe.bbox.left,Xe.bbox.top,Xe.bbox.width,Xe.bbox.height),at.clip();const dt=(ut,St)=>{at.beginPath(),at.lineWidth=2,at.strokeStyle=St,at.setLineDash([5,5]),at.moveTo(ut,Xe.bbox.top),at.lineTo(ut,Xe.bbox.top+Xe.bbox.height),at.stroke(),at.closePath()};for(let ut=0;ut<Re.current.length;ut++){const St=Re.current[ut];for(let mt=0;mt<St.length;mt++){const Ot=St.get(mt);if(!Ot.time)continue;let $t=Xe.valToPos(Ot.time,"x",!0);const At=de.visualization.getColorByName(Ot.color);if(dt($t,At),Ot.isRegion&&Ot.timeEnd){let Wt=Xe.valToPos(Ot.timeEnd,"x",!0);dt(Wt,At),at.fillStyle=go.alpha(At,.1),at.rect($t,Xe.bbox.top,Wt-$t,Xe.bbox.height),at.fill()}}}at.restore()})},[ee,de]);const Fe=(0,R.useCallback)((Xe,at)=>{const ut=new Aa.U(Xe).get(at.fieldIndex);if(!ut.time||!ve.current)return;let St=ve.current.valToPos(ut.time,"x");return St<0&&(St=0),{x:St,y:ve.current.bbox.height/window.devicePixelRatio+4}},[]),je=(0,R.useCallback)((Xe,at)=>{let dt=0;const St=new Aa.U(Xe).get(at.fieldIndex);if(!!St.isRegion&&ve.current){let Ot=ve.current.valToPos(St.time,"x"),$t=ve.current.valToPos(St.timeEnd,"x");Ot<0&&(Ot=0),$t>ve.current.bbox.width/window.devicePixelRatio&&($t=ve.current.bbox.width/window.devicePixelRatio),dt=$t-Ot}return R.createElement(Ou,{annotation:St,timeZone:J,width:dt})},[J]);return R.createElement(dc.T,{id:"annotations",config:ee,events:L,renderEventMarker:je,mapEventToXYCoords:Fe})};var Fs=e(76808),Ru=e(78089),Xi=e(36149),hc=e(66711),zs=e(79655),ur=e(14986);const wo=({data:L,config:J,onClose:ee,timeZone:de,replaceVariables:ve,...Re})=>{const Fe=(0,R.useRef)(),[je,Xe]=(0,R.useState)(null),[at,dt]=(0,R.useState)(null),[ut,St]=(0,R.useState)(!1),mt=(0,R.useCallback)(()=>{St(!0)},[St]),Ot=(0,R.useCallback)(()=>{St(!1)},[St]),$t=(0,R.useCallback)(()=>{(0,fo.Zp)("ContextMenuPlugin",!1,"clearing click selection"),dt(null)},[dt]);(0,R.useLayoutEffect)(()=>{let Wt;const Jt=en=>{let Qt={viewport:{x:en.clientX,y:en.clientY},plotCanvas:{x:0,y:0}};Wt&&(Qt={...Qt,plotCanvas:{x:en.clientX-Wt.left,y:en.clientY-Wt.top}}),Xe(Qt)};J.addHook("syncRect",(en,Qt)=>{Wt=Qt}),J.addHook("init",en=>{const Qt=en.over;Fe.current=Qt||void 0,Fe.current?.addEventListener("mousedown",Jt),(0,fo.Zp)("ContextMenuPlugin",!1,"init");let fn=!1,Yt=Array.from(en.root.querySelectorAll(".u-cursor-pt"));Fe.current?.addEventListener("mousedown",()=>{fn=!0}),Fe.current?.addEventListener("mousemove",()=>{fn=!1}),Fe.current?.addEventListener("mouseup",vn=>{if(!fn||vn.metaKey||vn.ctrlKey){dt(null);return}fn=!0,vn.target instanceof HTMLElement&&(vn.target.classList.contains("u-cursor-pt")||((0,fo.Zp)("ContextMenuPlugin",!1,"canvas click"),dt({seriesIdx:null,dataIdx:null}))),mt()}),Yt.length>0&&Yt.forEach((vn,In)=>{vn.addEventListener("click",()=>{const Mn=In+1,Rn=en.cursor.idx;(0,fo.Zp)("ContextMenuPlugin",!1,Mn,Rn),dt({seriesIdx:Mn,dataIdx:Rn??null})})})})},[J,mt,Xe,dt]);const At=(0,R.useMemo)(()=>Re.defaultItems?Re.defaultItems.map(Wt=>({...Wt,items:Wt.items.map(Jt=>({...Jt,onClick:en=>{je&&Jt.onClick?.(en,{coords:je})}}))})):[],[je,Re.defaultItems]);return R.createElement(R.Fragment,null,R.createElement(Fs.Global,{styles:(0,Fs.css)` .uplot .u-cursor-pt { pointer-events: auto !important; } `}),ut&&je&&R.createElement(Wo,{data:L,frames:Re.frames,defaultItems:At,timeZone:de,selection:{point:at,coords:je},replaceVariables:ve,onClose:()=>{$t(),Ot(),ee&&ee()}}))},Wo=({selection:L,timeZone:J,defaultItems:ee,replaceVariables:de,data:ve,...Re})=>{const Fe=(0,R.useRef)(null),je=()=>{Re.onClose&&Re.onClose()};(0,Ru.Z)(Fe,()=>{je()});const Xe=ve.fields[0];if(!Xe)return null;const at=ee?[...ee]:[];let dt=()=>null;if(L.point){const{seriesIdx:St,dataIdx:mt}=L.point,Ot=Xe.display;if(St&&mt!==null){const $t=ve.fields[St],At=$t.display($t.values[mt]);$t.config.links&&$t.config.links.length>0&&$t.getLinks&&at.push({items:$t.getLinks({valueRowIndex:mt}).map(Jt=>({label:Jt.title,ariaLabel:Jt.title,url:Jt.href,target:Jt.target,icon:Jt.target==="_self"?"link":"external-link-alt",onClick:Jt.onClick}))}),dt=()=>R.createElement(Xi.b,{timestamp:Ot(Xe.values[mt]).text,displayValue:At,seriesColor:At.color,displayName:(0,hn.CZ)($t,ve,Re.frames)})}}const ut=()=>at?.map((St,mt)=>R.createElement(hc.k,{key:`${St.label}${mt}`,label:St.label},(St.items||[]).map(Ot=>R.createElement(zs.s,{key:Ot.label,url:Ot.url,label:Ot.label,target:Ot.target,icon:Ot.icon,active:Ot.active,onClick:Ot.onClick}))));return R.createElement(ur.x,{renderMenuItems:ut,renderHeader:dt,x:L.coords.viewport.x,y:L.coords.viewport.y,onClose:je})};var Au=e(90282),Lu=e(8379);const es=({timeZone:L,dataFrame:J,dataFrameFieldIndex:ee,config:de,getFieldLinks:ve,exemplarColor:Re,clickedExemplarFieldIndex:Fe,setClickedExemplarFieldIndex:je})=>{const Xe=(0,it.wW)(vc),[at,dt]=(0,R.useState)(!1),[ut,St]=(0,R.useState)(!1),[mt,Ot]=R.useState(null),[$t,At]=R.useState(null),{styles:Wt,attributes:Jt}=(0,ci.D)(mt,$t,{modifiers:[{name:"preventOverflow",options:{altAxis:!0}},{name:"flip",options:{fallbackPlacements:["top","left-start"]}}]}),en=(0,R.useRef)();(0,R.useEffect)(()=>{Fe?.fieldIndex===ee.fieldIndex&&Fe?.frameIndex===ee.frameIndex||St(!1)},[Fe,ee]);const Qt=()=>{const Rn=[R.createElement("rect",{fill:Re,key:"diamond",x:"3.38672",width:"4.78985",height:"4.78985",transform:"rotate(45 3.38672 0)"}),R.createElement("path",{fill:Re,key:"x",d:"M1.94444 3.49988L0 5.44432L1.55552 6.99984L3.49996 5.05539L5.4444 6.99983L6.99992 5.44431L5.05548 3.49988L6.99983 1.55552L5.44431 0L3.49996 1.94436L1.5556 0L8.42584e-05 1.55552L1.94444 3.49988Z"}),R.createElement("path",{fill:Re,key:"triangle",d:"M4 0L7.4641 6H0.535898L4 0Z"}),R.createElement("rect",{fill:Re,key:"rectangle",width:"5",height:"5"}),R.createElement("path",{fill:Re,key:"pentagon",d:"M3 0.5L5.85317 2.57295L4.76336 5.92705H1.23664L0.146831 2.57295L3 0.5Z"}),R.createElement("path",{fill:Re,key:"plus",d:"m2.35672,4.2425l0,2.357l1.88558,0l0,-2.357l2.3572,0l0,-1.88558l-2.3572,0l0,-2.35692l-1.88558,0l0,2.35692l-2.35672,0l0,1.88558l2.35672,0z"})];return Rn[ee.frameIndex%Rn.length]},fn=(0,R.useCallback)(()=>{Fe===void 0&&(en.current&&clearTimeout(en.current),dt(!0))},[dt,Fe]),Yt=()=>{St(!0)},vn=(0,R.useCallback)(()=>{en.current=setTimeout(()=>{dt(!1)},150)},[dt]),In=(0,R.useCallback)(()=>{const Rn=J.fields.find(Gn=>Gn.name==="traceID")||J.fields[0],$n=[Rn,...J.fields.filter(Gn=>Rn!==Gn)],wn=Gn=>(0,uc.dq)(Gn,{format:mc.U6.fullDate,timeZone:L}),ra=()=>{St(!1),dt(!1),je(void 0)};return R.createElement("div",{onMouseEnter:fn,onMouseLeave:vn,className:Xe.tooltip,ref:At,style:Wt.popper,...Jt.popper},R.createElement("div",{className:Xe.wrapper},ut&&R.createElement(Lu.o,{onClick:ra}),R.createElement("div",{className:Xe.body},R.createElement("div",{className:Xe.header},R.createElement("span",{className:Xe.title},"Exemplars")),R.createElement("div",null,R.createElement("table",{className:Xe.exemplarsTable},R.createElement("tbody",null,$n.map((Gn,Sn)=>{const Xn=Gn.values[ee.fieldIndex],la=Gn.config.links?.length?ve(Gn,ee.fieldIndex):void 0;return R.createElement("tr",{key:Sn},R.createElement("td",{valign:"top"},Gn.name),R.createElement("td",null,R.createElement("div",{className:Xe.valueWrapper},R.createElement("span",null,Gn.type===un.fS.time?wn(Xn):Xn),la&&R.createElement(Au.Z,{links:la}))))})))))))},[Jt.popper,J.fields,ve,ee,fn,vn,Wt.popper,Xe,L,ut,je]),Mn=de.getSeries().find(Rn=>Rn.props.dataFrameFieldIndex?.frameIndex===ee.frameIndex)?.props.lineColor;return R.createElement(R.Fragment,null,R.createElement("div",{ref:Ot,onClick:()=>{je(ee),Yt()},onMouseEnter:fn,onMouseLeave:vn,className:Xe.markerWrapper,"aria-label":Ze.wl.components.DataSource.Prometheus.exemplarMarker},R.createElement("svg",{viewBox:"0 0 7 7",width:"7",height:"7",style:{fill:Mn},className:(0,x.cx)(Xe.marble,(at||ut)&&Xe.activeMarble)},Qt())),(at||ut)&&R.createElement(vr.h_,null,In()))},vc=L=>{const J=L.isDark?L.v1.palette.dark2:L.v1.palette.white,ee=L.isDark?L.v1.palette.dark9:L.v1.palette.gray5,de=L.isDark?L.v1.palette.black:L.v1.palette.white,ve=L.isDark?L.v1.palette.dark3:L.v1.palette.gray6;return{markerWrapper:(0,x.css)` padding: 0 4px 4px 4px; width: 8px; height: 8px; box-sizing: content-box; transform: translate3d(-50%, 0, 0); &:hover { > svg { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5)); } } `,marker:(0,x.css)` width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 4px solid ${L.v1.palette.red}; pointer-events: none; `,wrapper:(0,x.css)` background: ${J}; border: 1px solid ${ee}; border-radius: ${L.shape.borderRadius(2)}; box-shadow: 0 0 20px ${de}; padding: ${L.spacing(1)}; `,exemplarsTable:(0,x.css)` width: 100%; tr td { padding: 5px 10px; white-space: nowrap; border-bottom: 4px solid ${L.components.panel.background}; } tr { background-color: ${L.colors.background.primary}; &:nth-child(even) { background-color: ${ve}; } } `,valueWrapper:(0,x.css)` display: flex; flex-direction: row; flex-wrap: wrap; column-gap: ${L.spacing(1)}; > span { flex-grow: 0; } > * { flex: 1 1; align-self: center; } `,tooltip:(0,x.css)` background: none; padding: 0; overflow-y: auto; max-height: 95vh; `,header:(0,x.css)` background: ${ee}; padding: 6px 10px; display: flex; `,title:(0,x.css)` font-weight: ${L.typography.fontWeightMedium}; padding-right: ${L.spacing(2)}; overflow: hidden; display: inline-block; white-space: nowrap; text-overflow: ellipsis; flex-grow: 1; `,body:(0,x.css)` font-weight: ${L.typography.fontWeightMedium}; border-radius: ${L.shape.borderRadius(2)}; overflow: hidden; `,marble:(0,x.css)` display: block; opacity: 0.5; transition: transform 0.15s ease-out; `,activeMarble:(0,x.css)` transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5)); `}},La=({exemplars:L,timeZone:J,getFieldLinks:ee,config:de,visibleSeries:ve})=>{const Re=(0,R.useRef)(),[Fe,je]=(0,R.useState)();(0,R.useLayoutEffect)(()=>{de.addHook("init",dt=>{Re.current=dt})},[de]);const Xe=(0,R.useCallback)((dt,ut)=>{const St=dt.fields.find(Jt=>Jt.name===un.Ls),mt=dt.fields.find(Jt=>Jt.name===un.M5);if(!St||!mt||!Re.current)return;const Ot=Object.keys(Re.current.scales).find(Jt=>!["x","y"].some(en=>en===Jt))??Xr.j,$t=Re.current.scales[Ot].min,At=Re.current.scales[Ot].max;let Wt=mt.values[ut.fieldIndex];return $t!=null&&Wt<$t&&(Wt=$t),At!=null&&Wt>At&&(Wt=At),{x:Re.current.valToPos(St.values[ut.fieldIndex],"x"),y:Re.current.valToPos(Wt,Ot)}},[]),at=(0,R.useCallback)((dt,ut)=>{const St=ve!==void 0?Bu(ve,dt,ut):!0,mt=ve!==void 0?Ec(dt,ut,ve):void 0;return St?R.createElement(es,{setClickedExemplarFieldIndex:je,clickedExemplarFieldIndex:Fe,timeZone:J,getFieldLinks:ee,dataFrame:dt,dataFrameFieldIndex:ut,config:de,exemplarColor:mt}):R.createElement(R.Fragment,null)},[de,J,ee,ve,je,Fe]);return R.createElement(dc.T,{config:de,id:"exemplars",events:L,renderEventMarker:at,mapEventToXYCoords:Xe})},Cn=(L,J)=>{const ee=L.series.filter(ve=>ve.props.show),de=[];return J?.length&&ee.forEach(ve=>{const Re=ve.props?.dataFrameFieldIndex?.frameIndex,Fe=ve.props?.dataFrameFieldIndex?.fieldIndex;if(Re!==void 0&&Fe!==void 0){const je=J[Re]?.fields[Fe];je?.labels&&de.push({labels:je.labels,color:ve.props?.lineColor??""})}}),{labels:de,totalSeriesCount:L.series.length}},Ec=(L,J,ee)=>{let de;return ee.labels.some(ve=>{const Re=Object.keys(ve.labels),Fe=L.fields.filter(je=>Re.find(Xe=>Xe===je.name));return Fe.length&&Fe.every((Xe,at,dt)=>{const ut=Xe.values[J.fieldIndex];return ve.labels[Xe.name]===ut})?(de=ve.color,!0):!1}),de},Bu=(L,J,ee)=>{let de=!1;return L.labels.length===L.totalSeriesCount?de=!0:L.labels.some(ve=>{const Re=Object.keys(ve.labels);if(Object.keys(ve.labels).length===0)de=!0;else{const Fe=J.fields.filter(je=>Re.find(Xe=>Xe===je.name));Fe.length&&(de=L.labels.some(je=>Object.keys(je.labels).every(Xe=>{const at=je.labels[Xe];return Fe.find(dt=>dt.values[ee.fieldIndex]===at)})))}return de}),de},Fo=({config:L,onChangeTimeRange:J})=>{const ee=(0,R.useRef)(),[de,ve]=(0,R.useState)([]),[Re,Fe]=(0,R.useState)();if((0,R.useLayoutEffect)(()=>{L.addHook("init",mt=>{ee.current=mt}),L.addHook("setScale",mt=>{ve(mt.data?.[0]??[]),Fe(mt.scales.x??void 0)})},[L]),de.length<2||!J||!Re||!Re.time||!Re.min||!Re.max)return null;let je=0,Xe=de.length-1;for(;je<=Xe&&de[je]==null;)je++;for(;Xe>=0&&de[Xe]==null;)Xe--;const at=de[je],dt=de[Xe],ut=Re.min,St=Re.max;return at==null||dt==null||at<=St&&dt>=ut?null:R.createElement("div",{style:{position:"absolute",top:"50%",transform:"translateY(-50%)",width:"100%",textAlign:"center"}},R.createElement("div",null,R.createElement("div",null,"Data outside time range"),R.createElement(me.zx,{onClick:mt=>J({from:at,to:dt}),variant:"secondary","data-testid":"time-series-zoom-to-data"},"Zoom to data")))};Fo.displayName="OutsideRangePlugin";var qi=e(90537),Ko=e(13334),yc=e.n(Ko);const _r=({step:L,y:J,dragBounds:ee,mapPositionToValue:de,formatValue:ve,onChange:Re})=>{const Fe=(0,it.l4)();let je=J,Xe="none";J<(ee.top??0)&&(Xe="top"),J>(ee.bottom??0)+22&&(Xe="bottom"),Xe==="bottom"&&(je=ee.bottom??J),Xe==="top"&&(je=ee.top??J);const at=typeof Re!="function",dt=(0,it.wW)(Ot=>Pc(Ot,L,Xe,at)),[ut,St]=(0,R.useState)(L.value),mt=(0,R.useMemo)(()=>Fe.colors.getContrastText(Fe.visualization.getColorByName(L.color)),[L.color,Fe]);return R.createElement(yc(),{axis:"y",grid:[1,1],disabled:at,onStop:at?W.noop:(Ot,$t)=>(Re(de($t.lastY)),!1),onDrag:(Ot,$t)=>St(de($t.lastY)),position:{x:0,y:je},bounds:ee},R.createElement("div",{className:dt.handle,style:{color:mt}},R.createElement("span",{className:dt.handleText},ve(ut))))};_r.displayName="ThresholdDragHandle";const Pc=(L,J,ee,de)=>{const ve=L.visualization.getColorByName(J.color),Re=el(ee),Fe=ee!=="none";return{handle:(0,x.css)` display: flex; align-items: center; position: absolute; left: 0; width: calc(100% - 9px); height: 18px; margin-top: -9px; border-color: ${ve}; cursor: ${de?"initial":"grab"}; border-top-right-radius: ${L.shape.borderRadius(1)}; border-bottom-right-radius: ${L.shape.borderRadius(1)}; ${Fe&&(0,x.css)` margin-top: 0; border-radius: ${L.shape.borderRadius(1)}; `} background: ${ve}; font-size: ${L.typography.bodySmall.fontSize}; &:before { ${Re}; } `,handleText:(0,x.css)` text-align: center; width: 100%; display: block; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; `}};function el(L){const J=L==="none",ee=de=>(0,x.css)` content: ''; position: absolute; bottom: 0; top: 0; width: 0; height: 0; left: 0; border-right-style: solid; border-right-width: ${de}px; border-right-color: inherit; border-top: ${de}px solid transparent; border-bottom: ${de}px solid transparent; `;return J?(0,x.css)` ${ee(9)}; left: -9px; `:L==="top"?(0,x.css)` ${ee(5)}; left: calc(50% - 2.5px); top: -7px; transform: rotate(90deg); `:L==="bottom"?(0,x.css)` ${ee(5)}; left: calc(50% - 2.5px); top: calc(100% - 2.5px); transform: rotate(-90deg); `:""}const Dc=60,tl=({config:L,fieldConfig:J,onThresholdsChange:ee})=>{const de=(0,R.useRef)(),[ve,Re]=(0,R.useState)(0);(0,R.useLayoutEffect)(()=>{L.setPadding([0,Dc,0,0]),L.addHook("init",je=>{de.current=je}),L.addHook("draw",()=>{Re(je=>je+1)})},[L]);const Fe=(0,R.useMemo)(()=>{const je=de.current;if(!je)return null;const Xe=J.defaults.thresholds;if(!Xe)return null;const at=(0,qi.z1)(J.defaults,un.fS.number),dt=J.defaults.decimals,ut=[];for(let St=0;St<Xe.steps.length;St++){const mt=Xe.steps[St],Ot=je.valToPos(mt.value,at);if(Number.isNaN(Ot)||!Number.isFinite(Ot))continue;const $t=je.bbox.height/window.devicePixelRatio,Wt=typeof ee=="function"?en=>{const Qt=[...Xe.steps.slice(0,St),...Xe.steps.slice(St+1),{...Xe.steps[St],value:en}].sort((fn,Yt)=>fn.value-Yt.value);ee({...Xe,steps:Qt})}:void 0,Jt=R.createElement(_r,{key:`${mt.value}-${St}`,step:mt,y:Ot,dragBounds:{top:0,bottom:$t},mapPositionToValue:en=>je.posToVal(en,at),formatValue:en=>(0,Ws.Cf)(at)(en,dt).text,onChange:Wt});ut.push(Jt)}return ut},[ve,J,ee]);return de.current?R.createElement("div",{style:{position:"absolute",overflow:"visible",left:`${(de.current.bbox.left+de.current.bbox.width)/window.devicePixelRatio}px`,top:`${de.current.bbox.top/window.devicePixelRatio}px`,width:`${Dc}px`,height:`${de.current.bbox.height/window.devicePixelRatio}px`}},Fe):null};tl.displayName="ThresholdControlsPlugin";var Cc=e(21066),bc=e(93882),Mc=e(95381),Uu=e(39596),Nu=e(26453);function wu(L){let J=new Map;return L.map(de=>({...de,fields:de.fields.map(ve=>{if(ve.type===un.fS.enum){let Re=(0,qi.z1)(ve.config,ve.type),Fe=J.get(Re);Fe||(Fe=[],J.set(Re,Fe));let je=ve.values.toArray().slice(),Xe=ve.config.type.enum.text;if(Fe.length>0)for(let at=0;at<je.length;at++)je[at]+=Fe.length;return Fe.push(...Xe),ve.config.type.enum.text=Fe,{...ve,values:new Cc.G(je)}}return ve})}))}function nl(L,J,ee,de){if(!L?.length)return null;let ve=de!=null;de!=null&&de>0&&(L=[{...L[0],fields:[L[0].fields[de],...L[0].fields.filter((Xe,at)=>at!==de)]}]);for(let Xe of L)for(let at of Xe.fields)at.type===un.fS.time&&typeof at.values[0]!="number"&&(at.values=(0,Mc.p8)(at,{destinationType:un.fS.time}).values);let Re=0;e:for(let Xe of L)for(let at of Xe.fields)if(at.type===un.fS.enum&&++Re>1){L=wu(L);break e}let Fe;const je=[];for(let Xe of L){const at=[];let dt=!1,ut=!1,St=ve?Xe:(0,Uu.w)({frame:Xe,refFieldPseudoMin:ee?.from.valueOf(),refFieldPseudoMax:ee?.to.valueOf()});const mt=(0,Nu.I)(St).fields;for(let Ot=0;Ot<mt?.length;Ot++){const $t=mt[Ot];switch($t.type){case un.fS.time:dt=!0,at.push($t);break;case un.fS.number:ut=ve?Ot>0:!0,Fe={...$t,values:$t.values.map(Jt=>Number.isFinite(Jt)||Jt==null?Jt:null)},at.push(Fe);break;case un.fS.enum:ut=!0;case un.fS.string:Fe={...$t,values:$t.values},at.push(Fe);break;case un.fS.boolean:ut=!0;const At=$t.config?.custom??{},Wt={...$t.config,max:1,min:0,custom:At};At.lineInterpolation!==Et.KC.StepBefore&&(At.lineInterpolation=Et.KC.StepAfter),Fe={...$t,config:Wt,type:un.fS.number,values:$t.values.map(Jt=>Jt==null?Jt:Jt?1:0)},(0,Ws.br)(Wt.unit)||(Wt.unit="bool",Fe.display=(0,js.U)({field:Fe,theme:J})),at.push(Fe);break}}(ve||dt)&&ut&&je.push({...Xe,length:St.length,fields:at})}return je.length?(Fu(je,J,0),Wu(je,J),je):null}const Wu=(L,J)=>{const{palette:ee}=J.visualization;for(const de of L)for(const ve of de.fields)if(ve.type===un.fS.enum){const Re=ee[ve.state?.seriesIndex%ee.length],Fe=J.visualization.getColorByName(Re),je=ve.config.type.enum;je.color=Array(je.text.length).fill(Fe),ve.display=(0,js.U)({field:ve,theme:J})}},Fu=(L,J,ee)=>{let de=0;L.forEach(ve=>{ve.fields.forEach((Re,Fe)=>{Fe!==ee&&(Re.type===un.fS.number||Re.type===un.fS.boolean||Re.type===un.fS.enum)&&(Re.state={...Re.state,seriesIndex:de++},Re.display=(0,js.U)({field:Re,theme:J}))})})};function di(L,J){return!L||!L.length?[J]:L.map(ee=>ee?.length?ee:J)}function xc(L,J,ee,de){return L.fields.forEach(ve=>{if(ve.state?.origin?.frameIndex===void 0||J[ve.state?.origin?.frameIndex]===void 0)return;const Re=[];for(const je of J[ve.state?.origin?.frameIndex].fields)if(je.type===un.fS.string)if(ve.values instanceof bc.o){const Xe={...je};Xe.values=new bc.o(je.values,ve.values.getOrderArray()),Re.push(Xe)}else Re.push(je);const Fe={fields:[...L.fields,...Re],length:L.fields.length+Re.length};ve.getLinks=(0,Qi.oB)(Fe,ve,ve.state.scopedVars,ee,de)}),L}var Qs=(L=>(L.Candles="candles",L.CandlesVolume="candles+volume",L.Volume="volume",L))(Qs||{}),ui=(L=>(L.Candles="candles",L.OHLCBars="ohlcbars",L))(ui||{}),zr=(L=>(L.CloseClose="close-close",L.OpenClose="open-close",L))(zr||{});const yo={down:"red",flat:"gray",up:"green"},ro={...{candleStyle:"candles",colorStrategy:"open-close",colors:{down:"red",up:"green",flat:"gray"},fields:{},includeAllFields:!1,mode:"candles+volume"},legend:{displayMode:Et.jK.List,showLegend:!0,placement:"bottom",calcs:[]}},oo={open:{key:"open",name:"Open",defaults:["open","o"],description:"Value at the start of the period"},high:{key:"high",name:"High",defaults:["high","h","max"],description:"Maximum value within the period"},low:{key:"low",name:"Low",defaults:["low","l","min"],description:"Minimum value within the period"},close:{key:"close",name:"Close",defaults:["close","c"],description:"Value at the end of the period"},volume:{key:"volume",name:"Volume",defaults:["volume","v"],description:"Sample count within the period"}};function Vo(L,J,ee){const de=(0,tr.findField)(L,ee[J.key]);if(!de)for(const ve of L.fields){const Re=(0,hn.CZ)(ve,L).toLowerCase();if(J.defaults.includes(Re)||J.defaults.includes(ve.name))return ve}return de}function al(L,J,ee,de){if(!L?.length)return null;const ve=J.fields??{},Re=L.length===1?(0,Oo.Y3)(L[0],L[0].fields.findIndex(mt=>mt.type===un.fS.time)):(0,Oo._9)({frames:L});if(!Re?.length)return null;const Fe={aligned:Re,frame:Re,names:{}},je=nl([Re],ee,de);if(!je)return null;const Xe=Fe.frame=je[0],at=Xe.fields.findIndex(mt=>mt.type===un.fS.time);if(at<0)return null;const dt=new Set;for(const mt of Object.values(oo)){const Ot=Vo(Xe,mt,ve);Ot&&(Fe[mt.key]=Ot,dt.add(Ot))}if(!Fe.open&&!Fe.close&&(Fe.open=Xe.fields.find(mt=>mt.type===un.fS.number),Fe.open&&dt.add(Fe.open)),Fe.open&&!Fe.close&&!ve.close){const mt=Fe.open.values.slice(1);mt.push(mt[mt.length-1]),Fe.close={...Fe.open,values:mt,name:"Next open",state:void 0},dt.add(Fe.close),Xe.fields.push(Fe.close),Fe.autoOpenClose=!0}if(Fe.close&&!Fe.open&&!ve.open){const mt=Fe.close.values.slice();mt.unshift(mt[0]),mt.length=Xe.length,Fe.open={...Fe.close,values:mt,name:"Previous close",state:void 0},dt.add(Fe.open),Xe.fields.push(Fe.open),Fe.autoOpenClose=!0}!Fe.high&&!ve.high&&(Fe.high=Fe.open),!Fe.low&&!ve.low&&(Fe.low=Fe.open),J.mode===Qs.Volume?(Fe.high&&(Fe.high!==Fe.open&&dt.delete(Fe.high),Fe.high=void 0),Fe.low&&(Fe.low!==Fe.open&&dt.delete(Fe.low),Fe.low=void 0)):J.mode===Qs.Candles&&Fe.volume&&(dt.delete(Fe.volume),Fe.volume=void 0);for(const mt of Object.values(oo)){const Ot=Fe[mt.key];Ot&&(Fe.names[mt.key]=(0,hn.CZ)(Ot,Fe.frame))}const ut=Xe.fields[at],St=[ut];J.includeAllFields?St.push(...Xe.fields.filter(mt=>mt!==ut)):St.push(...dt),Fe.frame={...Fe.frame,fields:St};for(let mt=0;mt<Fe.frame.fields.length;mt++){const Ot=Fe.frame.fields[mt];Ot.state={...Ot.state,seriesIndex:mt-1,origin:{fieldIndex:mt,frameIndex:0}}}return Fe}const{alpha:sl}=go;function Vu(L){let{mode:J,candleStyle:ee,fields:de,colorStrategy:ve,upColor:Re,downColor:Fe,flatColor:je,volumeAlpha:Xe,flatAsUp:at=!0}=L;const dt=J!==Qs.Volume&&de.high!=null&&de.low!=null,ut=dt&&ee===ui.Candles,St=J!==Qs.Candles&&de.volume!=null;function mt(Qt,fn,Yt,vn,In){return Qt>0?Yt:Qt<0?vn:In?Yt:fn}let Ot=0,$t=de.open,At=de.high,Wt=de.low,Jt=de.close,en=de.volume;return Qt=>{let fn,Yt,vn,In,Mn,Rn;dt&&(vn=new Path2D,Yt=new Path2D,fn=new Path2D),St&&(In=new Path2D,Mn=new Path2D,Rn=new Path2D);let $n=new Path2D,wn=Qt.ctx,ra=Qt.data[Ot],Gn=Qt.data[$t],Sn=Qt.data[Jt],Xn=dt?Qt.data[At]:null,la=dt?Qt.data[Wt]:null,Fa=St?Qt.data[en]:null,za=en!=null?Math.round(Qt.valToPos(0,Qt.series[en].scale,!0)):null,[Ka,Ha]=Qt.series[0].idxs,Zn=Qt.data[0],Wn=Gn,Yn=Qt.bbox.width;if(Zn.length>1){let pa=null;for(let On=0,Nn=1/0;On<Zn.length;On++)if(Wn[On]!==void 0){if(pa!=null){let Fn=Math.abs(Zn[On]-Zn[pa]);Fn<Nn&&(Nn=Fn,Yn=Math.abs(Qt.valToPos(Zn[On],"x",!0)-Qt.valToPos(Zn[pa],"x",!0)))}pa=On}}let ta=Math.round(.6*Yn),ga=2,fa=2;ta<=12&&(ga=fa=1);let Na=Math.floor(ta/2);for(let pa=Ka;pa<=Ha;pa++){let On=Math.round(Qt.valToPos(ra[pa],"x",!0)),Nn=pa===Ka?0:Math.sign(Sn[pa]-Sn[pa-1]),Fn=Math.sign(Sn[pa]-Gn[pa]);if(St){let qn=mt(ve===zr.CloseClose?Nn:Fn,Rn,Mn,In,pa===Ka&&zr.CloseClose?!1:at),ea=Math.round(Qt.valToPos(Fa[pa],Qt.series[en].scale,!0));qn.rect(On-Na,ea,ta,za-ea)}if(dt){let qn=mt(ve===zr.CloseClose?Nn:Fn,vn,Yt,fn,pa===Ka&&zr.CloseClose?!1:at),ea=Math.round(Qt.valToPos(Xn[pa],Qt.series[At].scale,!0)),ha=Math.round(Qt.valToPos(la[pa],Qt.series[Wt].scale,!0));qn.rect(On-Math.floor(ga/2),ea,ga,ha-ea);let ua=Math.round(Qt.valToPos(Gn[pa],Qt.series[$t].scale,!0)),cs=Math.round(Qt.valToPos(Sn[pa],Qt.series[Jt].scale,!0));if(ut){let ds=Math.min(ua,cs),ar=Math.max(ua,cs),Ls=Math.max(1,ar-ds);qn.rect(On-Na,ds,ta,Ls),ve===zr.CloseClose&&Fn>=0&&Ls>fa*2&&$n.rect(On-Na+fa,ds+fa,ta-fa*2,Ls-fa*2)}else qn.rect(On-Na,ua,Na,ga),qn.rect(On,cs,Na,ga)}}wn.save(),wn.rect(Qt.bbox.left,Qt.bbox.top,Qt.bbox.width,Qt.bbox.height),wn.clip(),St&&(wn.fillStyle=sl(Re,Xe),wn.fill(Mn),wn.fillStyle=sl(Fe,Xe),wn.fill(In),wn.fillStyle=sl(je,Xe),wn.fill(Rn)),dt&&(wn.fillStyle=Re,wn.fill(Yt),wn.fillStyle=Fe,wn.fill(fn),wn.fillStyle=je,wn.fill(vn),wn.globalCompositeOperation="destination-out",wn.fill($n)),wn.restore()}}const Rs=({data:L,id:J,timeRange:ee,timeZone:de,width:ve,height:Re,options:Fe,fieldConfig:je,onChangeTimeRange:Xe,replaceVariables:at})=>{const{sync:dt,canAddAnnotations:ut,onThresholdsChange:St,canEditThresholds:mt,showThresholds:Ot,onSplitOpen:$t}=(0,vs.R9)(),At=(In,Mn)=>(0,Bo.a_)({field:In,rowIndex:Mn,splitOpenFn:$t,range:ee}),Wt=(0,it.l4)(),Jt=(0,R.useMemo)(()=>al(L.series,Fe,Wt,ee),[L.series,Fe,Wt,ee]),{renderers:en,tweakScale:Qt,tweakAxis:fn,shouldRenderPrice:Yt}=(0,R.useMemo)(()=>{let In=(fa,Na)=>fa,Mn=(fa,Na)=>fa,Rn={renderers:[],tweakScale:In,tweakAxis:Mn,shouldRenderPrice:!1};if(!Jt)return Rn;const $n=Jt.names;if(!Object.keys($n).length)return Rn;const{mode:wn,candleStyle:ra,colorStrategy:Gn}=Fe,Sn={...yo,...Fe.colors};let{open:Xn,high:la,low:Fa,close:za,volume:Ka}=$n;if(Xn==null||za==null)return Rn;let Ha=.5,Zn=-1,Wn=!1;if(Ka!=null&&wn!==Qs.Candles){let fa=Jt.volume;if(fa!=null){Wn=!0;let{fillOpacity:Na}=fa.config.custom;Na&&(Ha=Na/100),wn!==Qs.Volume&&(fa.config={...fa.config},fa.config.unit="short",fa.display=(0,js.U)({field:fa,theme:ke.config.theme2}),Mn=(pa,On)=>{if(On.name===Jt.volume?.name){let Nn=(Fn,qn)=>{let ea=[],ha=Fn.series[Zn].max;for(let ua=0;ua<qn.length&&(ea.push(qn[ua]),!(qn[ua]>ha));ua++);return ea};pa.space=20,pa.filter=Nn,pa.ticks={...pa.ticks,filter:Nn}}return pa},In=(pa,On)=>(On.name===Jt.volume?.name&&(pa.range=(Nn,Fn,qn)=>[0,qn*7]),pa))}}let Yn=wn!==Qs.Volume&&la!=null&&Fa!=null;if(!Yn&&!Wn)return Rn;let ta={},ga=[];return Yn?ta={open:Xn,high:la,low:Fa,close:za}:ga.push(Xn,za),Wn&&(ta.volume=Ka,ta.open=Xn,ta.close=za),{shouldRenderPrice:Yn,renderers:[{fieldMap:ta,indicesOnly:ga,init:(fa,Na)=>{Zn=Na.volume,fa.addHook("drawAxes",Vu({mode:wn,fields:Na,upColor:ke.config.theme2.visualization.getColorByName(Sn.up),downColor:ke.config.theme2.visualization.getColorByName(Sn.down),flatColor:ke.config.theme2.visualization.getColorByName(Sn.flat),volumeAlpha:Ha,colorStrategy:Gn,candleStyle:ra,flatAsUp:!0}))}}],tweakScale:In,tweakAxis:Mn}},[Fe,L.structureRev,L.series.length]);if(!Jt)return R.createElement(Pa.Z,{panelId:J,fieldConfig:je,data:L,needsTimeField:!0,needsNumberField:!0});if(Yt)for(let In in en[0].fieldMap){let Mn=Jt[In];Mn.config={...Mn.config,custom:{...Mn.config.custom,hideFrom:{legend:!0,tooltip:!1,viz:!1}}}}const vn=!!(ut&&ut());return R.createElement(li.p,{frames:[Jt.frame],structureRev:L.structureRev,timeRange:ee,timeZone:de,width:ve,height:Re,legend:Fe.legend,renderers:en,tweakAxis:fn,tweakScale:Qt,options:Fe},(In,Mn)=>(Mn.fields.forEach(Rn=>{Rn.getLinks=(0,Qi.oB)(Mn,Rn,Rn.state.scopedVars,at,de)}),R.createElement(R.Fragment,null,R.createElement(ao.R,{config:In,onZoom:Xe}),R.createElement(si.i,{data:Mn,config:In,mode:Et.f3.Multi,sync:dt,timeZone:de}),L.annotations&&R.createElement(Ji,{annotations:L.annotations,config:In,timeZone:de}),vn?R.createElement(Uo,{data:Mn,timeZone:de,config:In},({startAnnotating:Rn})=>R.createElement(wo,{data:Mn,config:In,timeZone:de,replaceVariables:at,defaultItems:vn?[{items:[{label:"Add annotation",ariaLabel:"Add annotation",icon:"comment-alt",onClick:($n,wn)=>{wn&&Rn({coords:wn.coords})}}]}]:[]})):R.createElement(wo,{data:Mn,config:In,timeZone:de,replaceVariables:at,defaultItems:[]}),L.annotations&&R.createElement(La,{config:In,exemplars:L.annotations,timeZone:de,getFieldLinks:At}),(mt&&St||Ot)&&R.createElement(tl,{config:In,fieldConfig:je,onThresholdsChange:mt?St:void 0}),R.createElement(Fo,{config:In,onChangeTimeRange:Xe}))))};class $u{getSuggestionsForData(J){const{dataSummary:ee}=J;if(!J.data?.series||!ee.hasData||ee.timeFieldCount<1||ee.numberFieldCount<2||ee.numberFieldCount>10)return;const de=al(J.data.series,ro,Ke.config.theme2);if(!de||de.open===de.high&&de.open===de.low)return;J.getListAppender({name:"",pluginId:"candlestick",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}}).append({name:ba.y.Candlestick,options:ro,fieldConfig:{defaults:{},overrides:[]},score:de.autoOpenClose?Ln._.Good:Ln._.Best})}}const _u=[{label:"Candles",value:Qs.Candles},{label:"Volume",value:Qs.Volume},{label:"Both",value:Qs.CandlesVolume}],zu=[{label:"Candles",value:ui.Candles},{label:"OHLC Bars",value:ui.OHLCBars}],up=[{label:"Since Open",value:zr.OpenClose},{label:"Since Prior Close",value:zr.CloseClose}],Hu=L=>L.type===un.fS.number;function $o(L,J,ee){let de="Auto ";if(ee){const ve=ee[J.key];ve?.config?(de+="= "+(0,hn.CZ)(ve),ve===ee?.open&&J.key!=="open"&&(de+=` (${J.defaults.join(",")})`)):de+=`(${J.defaults.join(",")})`}L.addFieldNamePicker({path:`fields.${J.key}`,name:J.name,description:J.description,settings:{filter:Hu,placeholderText:de}})}const ku=new ne.c(Rs).useFieldConfig((0,Ir.F)(Ir.r)).setPanelOptions((L,J)=>{const ee=J.options??ro,de=al(J.data,ee,Ke.config.theme2);L.addRadio({path:"mode",name:"Mode",description:"",defaultValue:ro.mode,settings:{options:_u}}).addRadio({path:"candleStyle",name:"Candle style",description:"",defaultValue:ro.candleStyle,settings:{options:zu},showIf:ve=>ve.mode!==Qs.Volume}).addRadio({path:"colorStrategy",name:"Color strategy",description:"",defaultValue:ro.colorStrategy,settings:{options:up}}).addColorPicker({path:"colors.up",name:"Up color",defaultValue:yo.up}).addColorPicker({path:"colors.down",name:"Down color",defaultValue:yo.down}),$o(L,oo.open,de),ee.mode!==Qs.Volume&&($o(L,oo.high,de),$o(L,oo.low,de)),$o(L,oo.close,de),ee.mode!==Qs.Candles&&$o(L,oo.volume,de),L.addRadio({path:"includeAllFields",name:"Additional fields",description:"Use standard timeseries options to configure any fields not mapped above",defaultValue:ro.includeAllFields,settings:{options:[{label:"Ignore",value:!1},{label:"Include",value:!0}]}}),rs.J(L)}).setDataSupport({annotations:!0,alertStates:!0}).setSuggestionsSupplier(new $u);var rl=e(78968),Gu=e(78467),Sc=e(26858),ju=e(75627);const Qu=L=>({dashlistSectionHeader:(0,x.css)` padding: ${L.spacing(.25,1)}; margin-right: ${L.spacing(1)}; `,dashlistSection:(0,x.css)` margin-bottom: ${L.spacing(2)}; padding-top: 3px; `,dashlistLink:(0,x.css)` display: flex; cursor: pointer; border-bottom: 1px solid ${L.colors.border.weak}; margin-right: ${L.spacing(1)}; padding: ${L.spacing(1)}; &:hover { a { color: ${L.colors.text.link}; text-decoration: underline; } } `,dashlistStar:(0,x.css)` align-self: center; margin-right: 0px; color: ${L.colors.secondary.text}; z-index: 1; `,dashlistFolder:(0,x.css)` color: ${L.colors.text.secondary}; font-size: ${L.typography.bodySmall.fontSize}; line-height: ${L.typography.body.lineHeight}; `,dashlistTitle:(0,x.css)` &::after { position: absolute; content: ''; left: 0; top: 0; bottom: 0; right: 0; } `,dashlistLinkBody:(0,x.css)` flex-grow: 1; overflow: hidden; text-overflow: ellipsis; `,dashlistItem:(0,x.css)` position: relative; list-style: none; `,gridContainer:(0,x.css)` display: grid; gap: ${L.spacing(1)}; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); list-style: none; margin-bottom: ${L.spacing(1)}; `});async function Yu(L,J){let ee=Promise.resolve([]);if(L.showStarred){const dt={limit:L.maxItems,starred:"true"};ee=(0,we.i)().search(dt)}let de=Promise.resolve([]),ve=[];if(L.showRecentlyViewed){let dt=await _e.Z.getDashboardOpened();ve=(0,W.take)(dt,L.maxItems),de=(0,we.i)().search({dashboardUIDs:ve,limit:L.maxItems})}let Re=Promise.resolve([]);if(L.showSearch){const dt={limit:L.maxItems,query:J(L.query,{},"text"),folderIds:L.folderId,tag:L.tags.map(ut=>J(ut,{},"text")),type:"dash-db"};Re=(0,we.i)().search(dt)}const[Fe,je,Xe]=await Promise.all([ee,Re,de]);let at=new Map;for(const dt of ve){const ut=Xe.find(St=>St.uid===dt);ut&&at.set(dt,{...ut,isRecent:!0})}return je.forEach(dt=>{dt.uid&&(at.has(dt.uid)?at.get(dt.uid).isSearchResult=!0:at.set(dt.uid,{...dt,isSearchResult:!0}))}),Fe.forEach(dt=>{dt.uid&&(at.has(dt.uid)?at.get(dt.uid).isStarred=!0:at.set(dt.uid,{...dt,isStarred:!0}))}),at}function Zu(L){const[J,ee]=(0,R.useState)(new Map),de=(0,Rt.useDispatch)();(0,R.useEffect)(()=>{Yu(L.options,L.replaceVariables).then($t=>{ee($t)})},[L.options,L.replaceVariables,L.renderCounter]);const ve=async($t,At)=>{const{uid:Wt,title:Jt,url:en}=At;$t.preventDefault(),$t.stopPropagation();const Qt=await(0,dn.h4)().starDashboard(At.uid,At.isStarred),fn=new Map(J);fn.set(At?.uid??"",{...At,isStarred:Qt}),ee(fn),de((0,Gu.OQ)({id:Wt??"",title:Jt,url:en,isStarred:Qt}))},[Re,Fe,je]=(0,R.useMemo)(()=>{const $t=[...J.values()];return[$t.filter(At=>At.isStarred).sort((At,Wt)=>At.title.localeCompare(Wt.title)),$t.filter(At=>At.isRecent),$t.filter(At=>At.isSearchResult).sort((At,Wt)=>At.title.localeCompare(Wt.title))]},[J]),{showStarred:Xe,showRecentlyViewed:at,showHeadings:dt,showSearch:ut}=L.options,St=[{header:"Starred dashboards",dashboards:Re,show:Xe},{header:"Recently viewed dashboards",dashboards:Fe,show:at},{header:"Search",dashboards:je,show:ut}],mt=(0,it.wW)(Qu),Ot=$t=>R.createElement("ul",null,$t.map(At=>{let Wt=At.url,Jt={};if(L.options.keepTime){const en=(0,Sc.$t)().timeRangeForUrl();Jt.from=en.from,Jt.to=en.to}return L.options.includeVars&&(Jt={...Jt,...(0,ju.c)()}),Wt=rl.Cj.appendQueryToUrl(Wt,rl.Cj.toUrlParams(Jt)),Wt=(0,ke.iE)().disableSanitizeHtml?Wt:Zi.QX.sanitizeUrl(Wt),R.createElement("li",{className:mt.dashlistItem,key:`dash-${At.uid}`},R.createElement("div",{className:mt.dashlistLink},R.createElement("div",{className:mt.dashlistLinkBody},R.createElement("a",{className:mt.dashlistTitle,href:Wt},At.title),At.folderTitle&&R.createElement("div",{className:mt.dashlistFolder},At.folderTitle)),R.createElement(Ju,{"aria-label":`Star dashboard "${At.title}".`,className:mt.dashlistStar,enabled:{name:"favorite",type:"mono"},disabled:{name:"star",type:"default"},checked:At.isStarred,onClick:en=>ve(en,At)})))}));return R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},St.map(({show:$t,header:At,dashboards:Wt},Jt)=>$t&&R.createElement("div",{className:mt.dashlistSection,key:`dash-group-${Jt}`},dt&&R.createElement("h6",{className:mt.dashlistSectionHeader},At),Ot(Wt))))}function Ju({enabled:L,disabled:J,checked:ee,onClick:de,className:ve,"aria-label":Re,...Fe}){const je=(0,R.useCallback)(ut=>{ut.preventDefault(),ut.stopPropagation(),de?.(ut)},[de]),at={...Fe,...ee?L:J},dt=(0,it.wW)(Xu);return R.createElement("label",{className:dt.wrapper},R.createElement("input",{type:"checkbox",defaultChecked:ee,onClick:je,className:dt.checkBox,"aria-label":Re}),R.createElement(Ft.J,{className:(0,x.cx)(dt.icon,ve),...at}))}const Xu=(0,Vs.B)(L=>({wrapper:(0,x.css)({display:"flex",alignSelf:"center",cursor:"pointer",zIndex:1}),checkBox:(0,x.css)({appearance:"none","&:focus-visible + *":{...(0,No.getFocusStyles)(L),borderRadius:L.shape.borderRadius(1)}}),icon:(0,x.css)({marginBottom:0,verticalAlign:"baseline",display:"flex"})})),Rr={includeVars:!1,keepTime:!1,maxItems:10,query:"",showHeadings:!0,showRecentlyViewed:!1,showSearch:!1,showStarred:!0,tags:[]},qu=new ne.c(Zu).setPanelOptions(L=>{L.addBooleanSwitch({path:"keepTime",name:"Include current time range",defaultValue:Rr.keepTime}).addBooleanSwitch({path:"includeVars",name:"Include current template variable values",defaultValue:Rr.includeVars}).addBooleanSwitch({path:"showStarred",name:"Starred",defaultValue:Rr.showStarred}).addBooleanSwitch({path:"showRecentlyViewed",name:"Recently viewed",defaultValue:Rr.showRecentlyViewed}).addBooleanSwitch({path:"showSearch",name:"Search",defaultValue:Rr.showSearch}).addBooleanSwitch({path:"showHeadings",name:"Show headings",defaultValue:Rr.showHeadings}).addNumberInput({path:"maxItems",name:"Max items",defaultValue:Rr.maxItems}).addTextInput({path:"query",name:"Query",defaultValue:Rr.query}).addCustomEditor({path:"folderId",name:"Folder",id:"folderId",defaultValue:void 0,editor:function({value:ee,onChange:de}){return R.createElement(ln,{initialFolderId:ee,onChange:ve=>de(ve?.id),extraFolders:[cn,on]})}}).addCustomEditor({id:"tags",path:"tags",name:"Tags",description:"",defaultValue:Rr.tags,editor(J){return R.createElement($e.B,{tags:J.value,onChange:J.onChange})}})}).setMigrationHandler(L=>{const J={showStarred:L.options.showStarred??L.starred,showRecentlyViewed:L.options.showRecentlyViewed??L.recent,showSearch:L.options.showSearch??L.search,showHeadings:L.options.showHeadings??L.headings,maxItems:L.options.maxItems??L.limit,query:L.options.query??L.query,folderId:L.options.folderId??L.folderId,tags:L.options.tags??L.tags};return parseFloat(L.pluginVersion||"6.1")<6.3&&["starred","recent","search","headings","limit","query","folderId"].forEach(ve=>delete L[ve]),J});var nr=e(18240),us=e(86312),Gp=e(45908);const em=({onBlur:L,placeholder:J})=>{const ee=(0,R.useRef)(null);(0,R.useEffect)(()=>{ee.current&&ee.current.focus()});const de=ve=>{ve.key==="Enter"&&ve.currentTarget.blur()};return R.createElement("input",{type:"text",placeholder:J,onBlur:L,ref:ee,onKeyDown:de,"data-testid":"column-input"})},Es=({divStyle:L,onColumnInputBlur:J})=>{const[ee,de]=(0,R.useState)(!1),ve=()=>{de(!0)},Re=Fe=>{const je=Fe.target.value;je&&J(je),de(!1)};return R.createElement("div",{className:L},ee?R.createElement(em,{placeholder:"Column Name",onBlur:Re}):R.createElement("button",{onClick:ve},"+"))};var Dn=e(53709);const Oa=()=>Ke.config.featureToggles.enableDatagridEditing,Tc="600 13px Inter",Oc="400 13px Inter",Ic=document.createElement("canvas"),tm=20,Po=300,nm=65,am="both",sm="number",mi={isContextMenuOpen:!1},ol={isInputOpen:!1},ms="datagrid_panel",fs={EDIT_CELL:"edit_cell",GRID_SELECTED:"grid_selected",APPEND_ROW:"append_row",APPEND_COLUMN:"append_column",DELETE_BTN_PRESSED:"delete_btn_pressed",COLUMN_RESIZE:"column_resize",COLUMN_REORDER:"column_reorder",ROW_REORDER:"row_reorder",CONTEXT_MENU_ACTION:"context_menu_action",HEADER_MENU_ACTION:"header_menu_action"},rm={name:"A",fields:[],length:0},Ar={kind:nr.p6.Text,data:"",allowOverlay:!0,readonly:!1,displayData:""},io={columns:nr.EV.empty(),rows:nr.EV.empty()},om={sticky:!1,tint:!0},_o={fill:!0,sticky:!1};async function Lr(L,J){if(J&&Oa()){for(let ee=0;ee<L.fields.length;ee++)delete L.fields[ee].config.displayName,delete L.fields[ee].config.displayNameFromDS;return await J([L])}return!1}const Rc=(L,J=!1)=>{const ee=Ic.getContext("2d");return ee.font=J?Tc:Oc,ee.measureText(L).width},fi=L=>Math.max(Rc(L.name,!0)+nm,Math.min(Po,L.values.toArray().reduce((J,ee)=>{const de=Rc(ee?.toString()??"");return de>J?de:J},0)+tm)),gi=(L,J,ee=!1)=>{const de={...L,fields:L.fields.map(ve=>({...ve,values:ve.values.slice()}))};for(const ve of de.fields){const Re=ve.values.toArray();for(let Fe=J.length-1;Fe>=0;Fe--)ee?Re.splice(J[Fe],1):Re.splice(J[Fe],1,null);ve.values=[...Re]}return{...de,length:de.fields[0]?.values.length??0}},il=(L,J)=>{const ee=J.x,de=J.y,ve=J.x+J.width-1,Re={...L,fields:L.fields.map(Fe=>({...Fe,values:Fe.values.slice()}))};for(let Fe=ee;Fe<=ve;Fe++){const je=Re.fields[Fe],Xe=je.values.toArray();Xe.splice(de,J.height,...new Array(J.height).fill(null)),je.values=[...Xe]}return{...Re,length:Re.fields[0]?.values.length??0}},im=L=>{const J=L.values.toArray();L.values=J.map(ee=>ee==="undefined"||ee==="null"?null:ee)};function ll(L){return{accentColor:L.colors.primary.main,accentFg:L.colors.secondary.main,textDark:L.colors.text.primary,textMedium:L.colors.text.secondary,textLight:L.colors.text.secondary,textBubble:L.colors.text.primary,textHeader:L.colors.text.primary,bgCell:L.colors.background.primary,bgCellMedium:L.colors.background.primary,bgHeader:L.colors.background.primary,bgHeaderHasFocus:L.colors.background.secondary,bgHeaderHovered:L.colors.background.secondary,linkColor:L.colors.text.link,fontFamily:L.typography.fontFamily,headerFontStyle:`${L.typography.fontWeightMedium} ${L.typography.fontSize}px`,fgIconHeader:L.colors.secondary.contrastText,bgIconHeader:L.colors.secondary.main}}const Ac=(L,J,ee=!1)=>{const de=L.values.get(J);switch(L.type){case un.fS.boolean:return{kind:nr.p6.Boolean,data:de||!1,allowOverlay:!1,readonly:!1};case un.fS.number:return{kind:nr.p6.Number,data:de||0,allowOverlay:Oa()&&!ee,readonly:!1,displayData:de!=null?de.toString():""};case un.fS.string:return{kind:nr.p6.Text,data:de||"",allowOverlay:Oa()&&!ee,readonly:!1,displayData:de!=null?de.toString():""};default:return{kind:nr.p6.Text,data:de||"",allowOverlay:Oa()&&!ee,readonly:!1,displayData:de!=null?de.toString():""}}},lm=(L,J)=>({dataEditor:(0,x.css)` .dvn-scroll-inner > div:nth-child(2) { pointer-events: none !important; } scrollbar-color: ${L.colors.background.secondary} ${L.colors.background.primary}; ::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: ${L.colors.background.primary}; } ::-webkit-scrollbar-thumb { border-radius: 10px; } ::-webkit-scrollbar-corner { display: none; } `,addColumnDiv:(0,x.css)` width: 120px; display: flex; flex-direction: column; background-color: ${L.colors.background.primary}; button { pointer-events: ${J?"none":"auto"}; border: none; outline: none; height: 37px; font-size: 20px; background-color: ${L.colors.background.primary}; color: ${L.colors.text.primary}; border-right: 1px solid ${L.components.panel.borderColor}; border-bottom: 1px solid ${L.components.panel.borderColor}; transition: background-color 200ms; cursor: pointer; :hover { background-color: ${L.colors.background.secondary}; } } input { height: 37px; border: 1px solid ${L.colors.primary.main}; :focus { outline: none; } } `,renameColumnInput:(0,x.css)` height: 37px; border: 1px solid ${L.colors.primary.main}; :focus { outline: none; } `}),Do=L=>L.rows.length||L.columns.length?!0:L.current===void 0?!1:L.current.range&&!(L.current.range.height===1&&L.current.range.width===1);var Ms=(L=>(L.columnResizeStart="columnResizeStart",L.columnResizeEnd="columnResizeEnd",L.columnMove="columnMove",L.updateColumns="updateColumns",L.showColumnRenameInput="showColumnRenameInput",L.hideColumnRenameInput="hideColumnRenameInput",L.openCellContextMenu="openCellContextMenu",L.openHeaderContextMenu="openHeaderContextMenu",L.openHeaderDropdownMenu="openHeaderDropdownMenu",L.closeContextMenu="closeContextMenu",L.multipleCellsSelected="multipleCellsSelected",L.gridSelectionCleared="gridSelectionCleared",L.columnFreezeReset="columnFreezeReset",L.columnFreezeChanged="columnFreezeChanged",L.openSearch="openSearch",L.closeSearch="closeSearch",L))(Ms||{});const cm={columns:[],contextMenuData:mi,renameColumnInputData:ol,gridSelection:io,columnFreezeIndex:0,toggleSearch:!1,isResizeInProgress:!1},Lc=new Map([[un.fS.number,nr.PE.HeaderNumber],[un.fS.string,nr.PE.HeaderTextTemplate],[un.fS.boolean,nr.PE.HeaderBoolean],[un.fS.time,nr.PE.HeaderDate],[un.fS.other,nr.PE.HeaderReference]]),_a=(L,J)=>{let ee=[];switch(J.type){case"columnResizeStart":ee=[...L.columns];const de=J.payload;return ee[de.columnIndex]={...L.columns[de.columnIndex],width:de.width},{...L,columns:ee,isResizeInProgress:!0};case"columnMove":ee=[...L.columns];const ve=J.payload,Re=L.columns[ve.from].width;let Fe=ee.splice(ve.from,1)[0];return Fe={...Fe,width:Re},ee.splice(ve.to,0,Fe),{...L,columns:ee};case"columnResizeEnd":return{...L,isResizeInProgress:!1};case"updateColumns":const je=J.payload;return ee=[...je.frame.fields.map((Wt,Jt)=>{const en=L.columns.find(fn=>fn.title===Wt.name)?.width;return{title:(0,hn.CZ)(Wt,je.frame),width:en??fi(Wt),icon:Lc.get(Wt.type),hasMenu:Oa(),trailingRowOptions:{targetColumn:--Jt}}})],{...L,columns:ee};case"showColumnRenameInput":return{...L,renameColumnInputData:{...L.renameColumnInputData,isInputOpen:!0}};case"hideColumnRenameInput":return{...L,renameColumnInputData:{...L.renameColumnInputData,isInputOpen:!1}};case"openCellContextMenu":const Xe=J.payload,at=Xe.event,dt=Xe.cell;return{...L,contextMenuData:{x:at.bounds.x+at.localEventX,y:at.bounds.y+at.localEventY,column:dt[0]===-1?void 0:dt[0],row:dt[1],isContextMenuOpen:!0,isHeaderMenu:!1}};case"openHeaderContextMenu":const ut=J.payload,St=ut.event;return{...L,contextMenuData:{x:St.bounds.x+St.localEventX,y:St.bounds.y+St.localEventY,column:ut.columnIndex,row:void 0,isContextMenuOpen:!0,isHeaderMenu:!1}};case"openHeaderDropdownMenu":const mt=J.payload,Ot=mt.screenPosition;return{...L,contextMenuData:{x:Ot.x+Ot.width,y:Ot.y+Ot.height,column:mt.columnIndex,row:void 0,isContextMenuOpen:!0,isHeaderMenu:!0},renameColumnInputData:{x:Ot.x,y:Ot.y,width:Ot.width,height:Ot.height,columnIdx:mt.columnIndex,isInputOpen:!1,inputValue:mt.value}};case"closeContextMenu":return{...L,contextMenuData:{isContextMenuOpen:!1}};case"closeSearch":return{...L,toggleSearch:!1};case"openSearch":return{...L,toggleSearch:!0};case"multipleCellsSelected":const $t=J.payload;return{...L,gridSelection:$t.selection};case"gridSelectionCleared":return{...L,gridSelection:io};case"columnFreezeReset":return{...L,columnFreezeIndex:0};case"columnFreezeChanged":const At=J.payload;return{...L,columnFreezeIndex:At.columnIndex};default:return L}},dm=({menuData:L,data:J,saveData:ee,closeContextMenu:de,dispatch:ve,gridSelection:Re,columnFreezeIndex:Fe,renameColumnClicked:je})=>{let Xe=[],at=[];const{row:dt,column:ut,x:St,y:mt,isHeaderMenu:Ot}=L;Re.rows&&(Xe=Re.rows.toArray()),Re.columns&&(at=Re.columns.toArray());let $t="Delete row";Xe.length&&Xe.length>1&&($t=`Delete ${Xe.length} rows`);let At="Delete column";at.length&&at.length>1&&(At=`Delete ${at.length} columns`);const Wt=dt!==void 0&&dt>=0||Xe.length,Jt=ut!==void 0&&ut>=0&&dt!==void 0||at.length,en=dt!==void 0&&dt>=0&&!Xe.length,Qt=ut!==void 0&&ut>=0&&dt!==void 0&&!at.length,fn=()=>R.createElement(R.Fragment,null,Wt?R.createElement(zs.s,{label:$t,onClick:()=>{if(Xe.length){ee(gi(J,Xe,!0)),ve({type:Ms.gridSelectionCleared});return}dt!==void 0&&dt>=0&&((0,us.ff)(ms,{item:fs.CONTEXT_MENU_ACTION,menu_action:"row_delete"}),ee(gi(J,[dt],!0)))}}):null,Jt?R.createElement(zs.s,{label:At,onClick:()=>{if(at.length){ee({...J,fields:J.fields.filter((vn,In)=>!at.includes(In))}),ve({type:Ms.gridSelectionCleared});return}ut!==void 0&&ut>=0&&((0,us.ff)(ms,{item:fs.CONTEXT_MENU_ACTION,menu_action:"column_delete"}),ee({...J,fields:J.fields.filter((vn,In)=>In!==ut)}))}}):null,Jt||Wt?R.createElement(Dn.R,null):null,en?R.createElement(zs.s,{label:"Clear row",onClick:()=>{(0,us.ff)(ms,{item:fs.CONTEXT_MENU_ACTION,menu_action:"row_clear"}),ee(gi(J,[dt]))}}):null,Qt?R.createElement(zs.s,{label:"Clear column",onClick:()=>{const vn=J.fields[ut];vn.values=vn.values.map(()=>null),(0,us.ff)(ms,{item:fs.CONTEXT_MENU_ACTION,menu_action:"column_clear"}),ee({...J})}}):null,en||Qt?R.createElement(Dn.R,null):null,R.createElement(zs.s,{label:"Remove all data",onClick:()=>{(0,us.ff)(ms,{item:fs.CONTEXT_MENU_ACTION,menu_action:"remove_all"}),ee(rm)}}),R.createElement(zs.s,{label:"Search...",onClick:()=>{(0,us.ff)(ms,{item:fs.CONTEXT_MENU_ACTION,menu_action:"open_search"}),ve({type:Ms.openSearch})}})),Yt=()=>{if(ut==null)return null;const vn=J.fields[ut].type,In=[],Mn=wn=>{In.push({label:(0,W.capitalize)(wn),options:{targetField:J.fields[ut].name,destinationType:wn}})};vn===un.fS.string?(Mn(un.fS.number),Mn(un.fS.boolean)):vn===un.fS.number?(Mn(un.fS.string),Mn(un.fS.boolean)):vn===un.fS.boolean?(Mn(un.fS.number),Mn(un.fS.string)):(Mn(un.fS.string),Mn(un.fS.number),Mn(un.fS.boolean));let Rn="Set column freeze position";const $n=ut+1;return Fe===$n&&(Rn="Unset column freeze"),R.createElement(R.Fragment,null,In.length?R.createElement(hc.k,{label:"Set field type"},In.map((wn,ra)=>R.createElement(zs.s,{key:ra,label:wn.label,onClick:()=>{const Gn=(0,Mc.p8)(J.fields[ut],wn.options);wn.options.destinationType===un.fS.string&&im(Gn);const Sn={name:J.name,fields:[...J.fields],length:J.length};Sn.fields[ut]=Gn,(0,us.ff)(ms,{item:fs.HEADER_MENU_ACTION,menu_action:"convert_field"}),ee(Sn)}}))):null,R.createElement(Dn.R,null),R.createElement(zs.s,{label:Rn,onClick:()=>{(0,us.ff)(ms,{item:fs.HEADER_MENU_ACTION,menu_action:"column_freeze"}),ve(Fe===$n?{type:Ms.columnFreezeReset}:{type:Ms.columnFreezeChanged,payload:{columnIndex:$n}})}}),R.createElement(zs.s,{label:"Rename column",onClick:je}),R.createElement(Dn.R,null),R.createElement(zs.s,{label:"Delete column",onClick:()=>{(0,us.ff)(ms,{item:fs.HEADER_MENU_ACTION,menu_action:"delete_column"}),ee({...J,fields:J.fields.filter((wn,ra)=>ra!==ut)}),ve({type:Ms.gridSelectionCleared})}}),R.createElement(zs.s,{label:"Clear column",onClick:()=>{const wn=J.fields[ut];wn.values=wn.values.map(()=>null),(0,us.ff)(ms,{item:fs.HEADER_MENU_ACTION,menu_action:"clear_column"}),ee({...J})}}))};return R.createElement(ur.x,{renderMenuItems:Ot?Yt:fn,x:St,y:mt,onClose:de})},Bc=({renameColumnData:L,onColumnInputBlur:J,classStyle:ee})=>{const{x:de,y:ve,width:Re,height:Fe,inputValue:je,columnIdx:Xe}=L,[at,dt]=(0,R.useState)({}),[ut,St]=(0,R.useState)(je),mt=(0,R.useRef)(null);(0,R.useLayoutEffect)(()=>{mt.current?.focus();const Wt=mt.current?.getBoundingClientRect();if(Wt){const Jt={right:window.innerWidth<de+Wt.width,bottom:window.innerHeight<ve+Wt.height};dt({position:"fixed",left:Jt.right?de-Wt.width:de,top:Jt.bottom?ve-Wt.height:ve,width:Re,height:Fe})}},[Fe,Re,de,ve]);const Ot=Wt=>{const Jt=Wt.target.value;Jt&&J(Jt,Xe)},$t=Wt=>{St(Wt.target.value)},At=Wt=>{Wt.key==="Enter"&&Wt.currentTarget.blur()};return R.createElement(vr.h_,null,R.createElement("input",{type:"text",className:ee,value:ut,onBlur:Ot,ref:mt,style:at,onChange:$t,onKeyDown:At}))};function um({options:L,data:J,id:ee,fieldConfig:de,width:ve,height:Re}){const[Fe,je]=(0,R.useReducer)(_a,cm),{onUpdateData:Xe}=(0,vs.R9)(),{columns:at,contextMenuData:dt,renameColumnInputData:ut,gridSelection:St,columnFreezeIndex:mt,toggleSearch:Ot,isResizeInProgress:$t}=Fe,At=J.series[L.selectedSeries??0],Wt=(0,it.l4)(),Jt=ll(Wt);(0,R.useEffect)(()=>{At&&je({type:Ms.updateColumns,payload:{frame:At}})},[At]);const en=([Zn,Wn])=>{const Yn=At.fields[Zn];return!Yn||Wn>At.length?Ar:Ac(Yn,Wn,Do(St))},Qt=(Zn,Wn)=>{if(Do(St))return;const[Yn,ta]=Zn,ga={...At,fields:At.fields.map(pa=>({...pa,values:[...pa.values]}))},fa=ga.fields[Yn];if(!fa)return;const Na=fa.values.toArray();Na[ta]=Wn.data,fa.values=[...Na],(0,us.ff)(ms,{item:fs.EDIT_CELL}),Lr(ga,Xe)},fn=Zn=>{const Wn=At.length??0;(0,us.ff)(ms,{item:fs.APPEND_COLUMN}),Lr({...At,fields:[...At.fields,{name:Zn,type:un.fS.string,config:{},values:new Array(Wn).fill("")}]},Xe)},Yt=()=>{const Zn=At.fields.map(Wn=>{const Yn=Wn.values.slice();return Yn.push(null),{...Wn,values:Yn}});(0,us.ff)(ms,{item:fs.APPEND_ROW}),Lr({...At,fields:Zn,length:At.length+1},Xe)},vn=(Zn,Wn,Yn,ta)=>{(0,us.ff)(ms,{item:fs.COLUMN_RESIZE}),je({type:Ms.columnResizeStart,payload:{columnIndex:Yn,width:Wn}})},In=(Zn,Wn,Yn,ta)=>{je({type:Ms.columnResizeEnd})},Mn=()=>{je({type:Ms.closeContextMenu})},Rn=Zn=>{if(Zn.current&&Zn.current.range)return(0,us.ff)(ms,{item:fs.DELETE_BTN_PRESSED,selection:"grid-cell"}),Lr(il(At,Zn.current.range),Xe),!0;const Wn=Zn.rows.toArray(),Yn=Zn.columns.toArray();if(Wn.length)return(0,us.ff)(ms,{item:fs.DELETE_BTN_PRESSED,selection:"rows"}),Lr(gi(At,Wn),Xe),!0;if(Yn.length){const ta={...At,fields:At.fields.map((ga,fa)=>Yn.includes(fa)?{...ga,values:new Array(At.length).fill(null)}:ga)};return(0,us.ff)(ms,{item:fs.DELETE_BTN_PRESSED,selection:"columns"}),Lr(ta,Xe),!0}return!1},$n=(Zn,Wn)=>{Wn.preventDefault(),je({type:Ms.openCellContextMenu,payload:{event:Wn,cell:Zn}})},wn=(Zn,Wn)=>{Wn.preventDefault(),je({type:Ms.openHeaderContextMenu,payload:{event:Wn,columnIndex:Zn}})},ra=(Zn,Wn)=>{je({type:Ms.openHeaderDropdownMenu,payload:{screenPosition:Wn,columnIndex:Zn,value:Fe.columns[Zn].title}})},Gn=async(Zn,Wn)=>{const Yn=At.fields.map(fa=>fa),ta=Yn[Zn];Yn.splice(Zn,1),Yn.splice(Wn,0,ta),await Lr({...At,fields:Yn},Xe)&&((0,us.ff)(ms,{item:fs.COLUMN_REORDER}),je({type:Ms.columnMove,payload:{from:Zn,to:Wn}}))},Sn=(Zn,Wn)=>{const Yn=At.fields.map(ta=>({...ta,values:ta.values.slice()}));for(const ta of Yn){const ga=ta.values[Zn];ta.values.splice(Zn,1),ta.values.splice(Wn,0,ga)}(0,us.ff)(ms,{item:fs.ROW_REORDER}),Lr({...At,fields:Yn},Xe)},Xn=()=>{(0,us.ff)(ms,{item:fs.HEADER_MENU_ACTION,menu_action:"rename_column"}),je({type:Ms.showColumnRenameInput})},la=(Zn,Wn)=>{const Yn=At.fields.map(ta=>ta);Yn[Wn].name=Zn,je({type:Ms.hideColumnRenameInput}),Lr({...At,fields:Yn},Xe)},Fa=()=>{je({type:Ms.closeSearch})},za=Zn=>{(0,us.ff)(ms,{item:fs.GRID_SELECTED}),je({type:Ms.multipleCellsSelected,payload:{selection:Zn}})},Ka=Zn=>{Lr(Zn,Xe)};if(!At)return R.createElement(Pa.Z,{panelId:ee,fieldConfig:de,data:J});if(!Oa())return R.createElement(Pa.Z,{panelId:ee,message:"Datagrid is not enabled",fieldConfig:de,data:J});if(!document.getElementById("portal")){const Zn=document.createElement("div");Zn.id="portal",document.body.appendChild(Zn)}const Ha=lm(Wt,$t);return R.createElement(R.Fragment,null,R.createElement(nr.ZP,{className:Ha.dataEditor,getCellContent:en,columns:at,rows:At.length,width:ve,height:Re,initialSize:[ve,Re],theme:Jt,smoothScrollX:!0,smoothScrollY:!0,overscrollY:50,onCellEdited:Oa()?Qt:void 0,getCellsForSelection:Oa()?!0:void 0,showSearch:Oa()?Ot:!1,onSearchClose:Fa,gridSelection:St,onGridSelectionChange:Oa()?za:void 0,onRowAppended:Oa()?Yt:void 0,onDelete:Oa()?Rn:void 0,rowMarkers:Oa()?am:sm,onColumnResize:vn,onColumnResizeEnd:In,onCellContextMenu:Oa()?$n:void 0,onHeaderContextMenu:Oa()?wn:void 0,onHeaderMenuClick:Oa()?ra:void 0,trailingRowOptions:om,rightElement:Oa()?R.createElement(Es,{onColumnInputBlur:fn,divStyle:Ha.addColumnDiv}):null,rightElementProps:_o,freezeColumns:mt,onRowMoved:Oa()?Sn:void 0,onColumnMoved:Oa()?Gn:void 0}),dt.isContextMenuOpen&&R.createElement(dm,{menuData:dt,data:At,saveData:Ka,closeContextMenu:Mn,dispatch:je,gridSelection:St,columnFreezeIndex:mt,renameColumnClicked:Xn}),ut.isInputOpen?R.createElement(Bc,{onColumnInputBlur:la,renameColumnData:ut,classStyle:Ha.renameColumnInput}):null)}const Uc={selectedSeries:0},mm=new ne.c(um).setPanelOptions((L,J)=>{const ee=J.data.map((de,ve)=>({value:ve,label:de.refId}));return J.options&&!ee.map(de=>de.value).includes(J.options.selectedSeries??0)&&(J.options.selectedSeries=Uc.selectedSeries),L.addSelect({path:"selectedSeries",name:"Select series",defaultValue:Uc.selectedSeries,settings:{options:ee}})});class fm extends R.Component{constructor(){super(...arguments),this.subscription=new Sa.w0,this.state={}}componentDidMount(){const{eventBus:J}=this.props;this.subscription.add(J.subscribe(Za.es,ee=>{this.setState({event:ee})})),this.subscription.add(J.subscribe(Za.xH,ee=>{this.setState({event:ee})})),this.subscription.add(J.subscribe(ws.IA,ee=>{this.setState({event:ee})})),this.subscription.add(J.subscribe(ws.oi,ee=>{this.setState({event:ee})}))}componentWillUnmount(){this.subscription.unsubscribe()}render(){const{event:J}=this.state;if(!J)return R.createElement("div",null,"no events yet");const{type:ee,payload:de,origin:ve}=J;return R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},R.createElement("h3",null,"Origin: ",ve?.path),R.createElement("span",null,"Type: ",ee),!!de&&R.createElement(R.Fragment,null,R.createElement("pre",null,JSON.stringify(de.point,null," ")),de.data&&R.createElement(Vi.H,{data:de.data,rowIndex:de.rowIndex,columnIndex:de.columnIndex})))}}var gm=e(64282);let cl=100;class pm extends R.PureComponent{constructor(J){super(J),this.history=new gm.d({capacity:40,append:"head"}),this.eventObserver={next:de=>{const ve=de.origin;this.history.add({key:cl++,type:de.type,path:ve?.path,payload:de.payload}),this.setState({counter:cl})}},this.state={counter:cl};const ee=[];ee.push(J.eventBus.getStream(Za.es).subscribe(this.eventObserver)),ee.push(J.eventBus.getStream(Za.xH).subscribe(this.eventObserver)),ee.push(J.eventBus.getStream(Za.v9).subscribe(this.eventObserver)),this.subs=ee}componentWillUnmount(){for(const J of this.subs)J.unsubscribe()}render(){return R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},this.history.map((J,ee)=>R.createElement("div",{key:J.key},JSON.stringify(J.path)," ",J.type," / X:",JSON.stringify(J.payload.x)," / Y:",JSON.stringify(J.payload.y))))}}var Hs=e(66656);class Hr extends R.Component{constructor(){super(...arguments),this.lastRender=Date.now(),this.counters={render:0,dataChanged:0,schemaChanged:0},this.resetCounters=()=>{this.counters={render:0,dataChanged:0,schemaChanged:0},this.forceUpdate()}}shouldComponentUpdate(J){const{data:ee,options:de}=this.props;if(J.data!==ee&&(this.counters.dataChanged++,de.counters?.schemaChanged)){const ve=J.data?.series,Re=ee.series;Re&&ve&&((0,Kr.nl)(Re,ve,Kr.Ch)||this.counters.schemaChanged++)}return!0}render(){const{data:J,options:ee}=this.props,de=ee.counters??{render:!1,dataChanged:!1,schemaChanged:!1};this.counters.render++;const ve=Date.now(),Re=ve-this.lastRender;this.lastRender=ve;const Fe=Hs.TB.get(Hs.gz.lastNotNull);return R.createElement("div",null,R.createElement("div",null,R.createElement(so.h,{name:"step-backward",title:"reset counters",onClick:this.resetCounters,tooltip:"Step back"}),R.createElement("span",null,de.render&&R.createElement("span",null,"Render: ",this.counters.render,"\xA0"),de.dataChanged&&R.createElement("span",null,"Data: ",this.counters.dataChanged,"\xA0"),de.schemaChanged&&R.createElement("span",null,"Schema: ",this.counters.schemaChanged,"\xA0"),R.createElement("span",null,"TIME: ",Re,"ms"))),J.series&&J.series.map((je,Xe)=>R.createElement("div",{key:`${Xe}/${je.refId}`},R.createElement("h4",null,(0,hn.nf)(je,Xe)," (",je.length,")"),R.createElement("table",{className:"filter-table"},R.createElement("thead",null,R.createElement("tr",null,R.createElement("td",null,"Field"),R.createElement("td",null,"Type"),R.createElement("td",null,"Last"))),R.createElement("tbody",null,je.fields.map((at,dt)=>{const ut=Fe.reduce(at,!1,!1)[Fe.id];return R.createElement("tr",{key:`${dt}/${at.name}`},R.createElement("td",null,(0,hn.CZ)(at,je,J.series)),R.createElement("td",null,at.type),R.createElement("td",null,`${ut}`))}))))))}}var hm=e(1128);function vm(L){const J=(0,vs.R9)(),ee=de=>{J.onInstanceStateChange({name:de.currentTarget.value})};return R.createElement(R.Fragment,null,R.createElement(qa.g,{label:"State name"},R.createElement(hm.I,{value:J.instanceState?.name??"",onChange:ee})))}function zo({value:L,context:J,onChange:ee,item:de}){return R.createElement("div",null,"Current value: ",J.instanceState?.name," ")}var ls=(L=>(L.Cursor="cursor",L.Events="events",L.Render="render",L.State="State",L.ThrowError="ThrowError",L))(ls||{});class Em extends R.Component{render(){const{options:J}=this.props;switch(J.mode){case ls.Events:return R.createElement(pm,{eventBus:this.props.eventBus});case ls.Cursor:return R.createElement(fm,{eventBus:this.props.eventBus});case ls.State:return R.createElement(vm,{...this.props});case ls.ThrowError:throw new Error("I failed you and for that i am deeply sorry");default:return R.createElement(Hr,{...this.props})}}}const ym=new ne.c(Em).useFieldConfig().setPanelOptions(L=>{L.addSelect({path:"mode",name:"Mode",defaultValue:ls.Render,settings:{options:[{label:"Render",value:ls.Render},{label:"Events",value:ls.Events},{label:"Cursor",value:ls.Cursor},{label:"Cursor",value:ls.Cursor},{label:"Share state",value:ls.State},{label:"Throw error",value:ls.ThrowError}]}}).addCustomEditor({id:"stateView",path:"stateView",name:"State view",defaultValue:"",showIf:({mode:J})=>J===ls.State,editor:zo}).addBooleanSwitch({path:"counters.render",name:"Render Count",defaultValue:!0,showIf:({mode:J})=>J===ls.Render}).addBooleanSwitch({path:"counters.dataChanged",name:"Data Changed Count",defaultValue:!0,showIf:({mode:J})=>J===ls.Render}).addBooleanSwitch({path:"counters.schemaChanged",name:"Schema Changed Count",defaultValue:!0,showIf:({mode:J})=>J===ls.Render}).addDashboardPicker({path:"dashboardUID",name:"Dashboard",settings:{placeholder:"Select dashboard",isClearable:!0}})});var Pm=e(78088);const Dm=L=>R.createElement(Pm.Z,{data:L.data.series[0],app:ae.zj.Unknown});var Nc=e(15301);class wc{getListWithDefaults(J){return J.getListAppender({name:ba.y.FlameGraph,pluginId:"flamegraph"})}getSuggestionsForData(J){if(!J.data)return;const ee=J.data.series[0];try{new Nc.S(ee)}catch{return}this.getListWithDefaults(J).append({name:ba.y.FlameGraph})}}const Wc=new ne.c(Dm).setSuggestionsSupplier(new wc);var dl=e(3133),Fc=e(62108);const Kc=(L,J)=>{const ee="linear-gradient(to right, #5182CC 0%, #245BAF 100%)",de=J?ee:"linear-gradient(to right, #f05a28 0%, #fbca0a 100%)",ve=J?ee:"linear-gradient(to right, #FBCA0A 0%, #F05A28 100%)",Re=L.isDark?de:ve;return` background-color: ${L.colors.background.secondary}; margin-right: ${L.spacing(4)}; border: 1px solid ${L.colors.border.weak}; border-bottom-left-radius: ${L.shape.borderRadius(2)}; border-bottom-right-radius: ${L.shape.borderRadius(2)}; position: relative; max-height: 230px; ${L.breakpoints.down("xxl")} { margin-right: ${L.spacing(2)}; } &::before { display: block; content: ' '; position: absolute; left: 0; right: 0; height: 2px; top: 0; background-image: ${Re}; } `},Ho=(L,J)=>(0,x.css)` color: ${J?L.v1.palette.blue95:L.colors.text.secondary}; ${L.breakpoints.down("sm")} { display: none; } `,Vc=(0,x.css)` padding: 16px; `,$c=({card:L})=>{const J=(0,it.wW)((0,R.useCallback)(de=>Cm(de,L.done),[L.done])),ee=(0,it.wW)((0,R.useCallback)(de=>Ho(de,L.done),[L.done]));return R.createElement("div",{className:J.card},R.createElement("div",{className:Vc},R.createElement("a",{href:`${L.href}?utm_source=grafana_gettingstarted`,className:J.url},R.createElement("div",{className:J.heading},L.done?"complete":L.heading),R.createElement("h4",{className:J.title},L.title),R.createElement("div",null,R.createElement(Ft.J,{className:ee,name:L.icon,size:"xxl"})))),R.createElement("a",{href:`${L.learnHref}?utm_source=grafana_gettingstarted`,className:J.learnUrl,target:"_blank",rel:"noreferrer"},"Learn how in the docs ",R.createElement(Ft.J,{name:"external-link-alt"})))},Cm=(L,J)=>({card:(0,x.css)` ${Kc(L,J)} min-width: 230px; ${L.breakpoints.down("md")} { min-width: 192px; } `,heading:(0,x.css)` text-transform: uppercase; color: ${J?L.v1.palette.blue95:"#FFB357"}; margin-bottom: ${L.spacing(2)}; `,title:(0,x.css)` margin-bottom: ${L.spacing(2)}; `,url:(0,x.css)` display: inline-block; `,learnUrl:(0,x.css)` border-top: 1px solid ${L.colors.border.weak}; position: absolute; bottom: 0; padding: 8px 16px; width: 100%; `});var pi=e(56812);const bm=({card:L})=>{const J=(0,it.wW)((0,R.useCallback)(de=>_c(de,L.done),[L.done])),ee=(0,it.wW)((0,R.useCallback)(de=>Ho(de,L.done),[L.done]));return R.createElement("a",{className:J.card,target:"_blank",rel:"noreferrer",href:`${L.href}?utm_source=grafana_gettingstarted`,onClick:de=>Mm(de,L)},R.createElement("div",{className:Vc},R.createElement("div",{className:J.type},L.type),R.createElement("div",{className:J.heading},L.done?"complete":L.heading),R.createElement("h4",{className:J.cardTitle},L.title),R.createElement("div",{className:J.info},L.info),R.createElement(Ft.J,{className:ee,name:L.icon,size:"xxl"})))},Mm=(L,J)=>{L.preventDefault(),pi.Z.get(J.key)||pi.Z.set(J.key,!0)},_c=(L,J)=>({card:(0,x.css)` ${Kc(L,J)} width: 460px; min-width: 460px; ${L.breakpoints.down("xl")} { min-width: 368px; } ${L.breakpoints.down("lg")} { min-width: 272px; } `,type:(0,x.css)` color: ${L.colors.primary.text}; text-transform: uppercase; `,heading:(0,x.css)` text-transform: uppercase; color: ${L.colors.primary.text}; margin-bottom: ${L.spacing(1)}; `,cardTitle:(0,x.css)` margin-bottom: ${L.spacing(2)}; `,info:(0,x.css)` margin-bottom: ${L.spacing(2)}; `,status:(0,x.css)` display: flex; justify-content: flex-end; `}),xm=({step:L})=>{const J=(0,it.wW)(Sm);return R.createElement("div",{className:J.setup},R.createElement("div",{className:J.info},R.createElement("h2",{className:J.title},L.title),R.createElement("p",null,L.info)),R.createElement("div",{className:J.cards},L.cards.map((ee,de)=>{const ve=`${ee.title}-${de}`;return ee.type==="tutorial"?R.createElement(bm,{key:ve,card:ee}):R.createElement($c,{key:ve,card:ee})})))},Sm=L=>({setup:(0,x.css)` display: flex; width: 95%; `,info:(0,x.css)` width: 172px; margin-right: 5%; ${L.breakpoints.down("xxl")} { margin-right: ${L.spacing(4)}; } ${L.breakpoints.down("sm")} { display: none; } `,title:(0,x.css)` color: ${L.v1.palette.blue95}; `,cards:(0,x.css)` overflow-x: scroll; overflow-y: hidden; width: 100%; display: flex; justify-content: center; ${L.breakpoints.down("xxl")} { justify-content: flex-start; } `});var Tm=e(5926);const hi="Grafana fundamentals",Om="Create users and teams",zc="getting.started.",ul=`${zc}${hi.replace(" ","-").trim().toLowerCase()}`,Hc=`${zc}${Om.replace(" ","-").trim().toLowerCase()}`,Im=()=>[{heading:"Welcome to Grafana",subheading:"The steps below will guide you to quickly finish setting up your Grafana installation.",title:"Basic",info:"The steps below will guide you to quickly finish setting up your Grafana installation.",done:!1,cards:[{type:"tutorial",heading:"Data source and dashboards",title:hi,info:"Set up and understand Grafana if you have no prior experience. This tutorial guides you through the entire process and covers the \u201CData source\u201D and \u201CDashboards\u201D steps to the right.",href:"https://grafana.com/tutorials/grafana-fundamentals",icon:"grafana",check:()=>Promise.resolve(pi.Z.get(ul)),key:ul,done:!1},{type:"docs",title:"Add your first data source",heading:"data sources",icon:"database",learnHref:"https://grafana.com/docs/grafana/latest/features/datasources/add-a-data-source",href:"datasources/new",check:()=>new Promise(L=>{L((0,Tm.ak)().getMetricSources().filter(J=>J.meta.builtIn!==!0).length>0)}),done:!1},{type:"docs",heading:"dashboards",title:"Create your first dashboard",icon:"apps",href:"dashboard/new",learnHref:"https://grafana.com/docs/grafana/latest/guides/getting_started/#create-a-dashboard",check:async()=>(await(0,we.i)().search({limit:1})).length>0,done:!1}]},{heading:"Setup complete!",subheading:"All necessary steps to use Grafana are done. Now tackle advanced steps or make the best use of this home dashboard \u2013 it is, after all, a fully customizable dashboard \u2013 and remove this panel.",title:"Advanced",info:" Manage your users and teams and add plugins. These steps are optional",done:!1,cards:[{type:"tutorial",heading:"Users",title:"Create users and teams",info:"Learn to organize your users in teams and manage resource access and roles.",href:"https://grafana.com/tutorials/create-users-and-teams",icon:"users-alt",key:Hc,check:()=>Promise.resolve(pi.Z.get(Hc)),done:!1},{type:"docs",heading:"plugins",title:"Find and install plugins",learnHref:"https://grafana.com/docs/grafana/latest/plugins/installation",href:"plugins",icon:"plug",check:async()=>{const L=await(0,we.i)().get("/api/plugins",{embedded:0,core:0});return Promise.resolve(L.length>0)},done:!1}]}];class Rm extends R.PureComponent{constructor(){super(...arguments),this.state={checksDone:!1,currentStep:0,steps:Im()},this.onForwardClick=()=>{this.setState(J=>({currentStep:J.currentStep+1}))},this.onPreviousClick=()=>{this.setState(J=>({currentStep:J.currentStep-1}))},this.dismiss=()=>{const{id:J}=this.props,ee=(0,dn.h4)().getCurrent(),de=ee?.getPanelById(J);ee?.removePanel(de),we.ae.put("/api/user/helpflags/1",void 0,{showSuccessAlert:!1}).then(ve=>{et.Vt.user.helpFlags1=ve.helpFlags1})}}async componentDidMount(){const{steps:J}=this.state,ee=J.map(async ve=>{const Re=ve.cards.map(async je=>je.check().then(Xe=>({...je,done:Xe}))),Fe=await Promise.all(Re);return{...ve,done:Fe.every(je=>je.done),cards:Fe}}),de=await Promise.all(ee);this.setState({currentStep:de[0].done?1:0,steps:de,checksDone:!0})}render(){const{checksDone:J,currentStep:ee,steps:de}=this.state,ve=Am(),Re=de[ee];return R.createElement("div",{className:ve.container},J?R.createElement(R.Fragment,null,R.createElement(me.zx,{variant:"secondary",fill:"text",className:ve.dismiss,onClick:this.dismiss},"Remove this panel"),ee===de.length-1&&R.createElement(me.zx,{className:(0,x.cx)(ve.backForwardButtons,ve.previous),onClick:this.onPreviousClick,"aria-label":"To advanced tutorials",icon:"angle-left",variant:"secondary"}),R.createElement("div",{className:ve.content},R.createElement(xm,{step:Re})),ee<de.length-1&&R.createElement(me.zx,{className:(0,x.cx)(ve.backForwardButtons,ve.forward),onClick:this.onForwardClick,"aria-label":"To basic tutorials",icon:"angle-right",variant:"secondary"})):R.createElement("div",{className:ve.loading},R.createElement("div",{className:ve.loadingText},"Checking completed setup steps"),R.createElement(Fc.$,{size:24,inline:!0})))}}const Am=(0,Vs.B)(()=>{const L=Ke.config.theme2;return{container:(0,x.css)` display: flex; flex-direction: column; height: 100%; // background: url(public/img/getting_started_bg_${L.colors.mode}.svg) no-repeat; background-size: cover; padding: ${L.spacing(4)} ${L.spacing(2)} 0; `,content:(0,x.css)` label: content; display: flex; justify-content: center; ${L.breakpoints.down("xxl")} { margin-left: ${L.spacing(3)}; justify-content: flex-start; } `,header:(0,x.css)` label: header; margin-bottom: ${L.spacing(3)}; display: flex; flex-direction: column; ${L.breakpoints.down("lg")} { flex-direction: row; } `,headerLogo:(0,x.css)` height: 58px; padding-right: ${L.spacing(2)}; display: none; ${L.breakpoints.up("md")} { display: block; } `,heading:(0,x.css)` label: heading; margin-right: ${L.spacing(3)}; margin-bottom: ${L.spacing(3)}; flex-grow: 1; display: flex; ${L.breakpoints.up("md")} { margin-bottom: 0; } `,backForwardButtons:(0,x.css)` position: absolute; top: 50%; transform: translateY(-50%); `,previous:(0,x.css)` left: 10px; ${L.breakpoints.down("md")} { left: 0; } `,forward:(0,x.css)` right: 10px; ${L.breakpoints.down("md")} { right: 0; } `,dismiss:(0,x.css)` align-self: flex-end; text-decoration: underline; margin-bottom: ${L.spacing(1)}; `,loading:(0,x.css)` display: flex; justify-content: center; align-items: center; height: 100%; `,loadingText:(0,x.css)` margin-right: ${L.spacing(1)}; `}}),Ys=new ne.c(Rm).setNoPadding();var wa=e(35596),kc=e(81144);const vi={bucketOffset:0},ml={fillOpacity:80,gradientMode:Et.FI.None,lineWidth:1};function Ei(L,J){return Math.floor(L/J)*J}function Gc(L,J){return Math.ceil(L/J)*J}function yi(L){return L.fields[1].values[0]-L.fields[0].values[0]}const ko=(L,J)=>{let{min:ee,max:de}=L.fields[2].config,ve=new $i.U,Re=yi(L),Fe=(mt,Ot,$t,At,Wt,Jt)=>{let en=mt.axes[Ot]._space,Qt=mt.valToPos(mt.data[0][0]+Re,"x")-mt.valToPos(mt.data[0][0],"x"),fn=Ei(ee??mt.data[0][0],Re),Yt=Gc(de??mt.data[0][mt.data[0].length-1]+Re,Re),vn=[],In=Math.ceil(en/Qt);for(let Mn=0,Rn=fn;Rn<=Yt;Mn++,Rn+=Re)!(Mn%In)&&vn.push(Rn);return vn};ve.addScale({scaleKey:"x",isTime:!1,distribution:Et.wf.Linear,orientation:Et.wN.Horizontal,direction:Et.bQ.Right,range:(mt,Ot,$t)=>{ee!=null&&(Ot=ee),de!=null&&($t=de);let At=mt.data[0][0],Wt=mt.data[0][mt.data[0].length-1];return $t===Wt?$t+=Re:$t=Gc($t,Re),Ot>At&&(Ot=Ei(Ot,Re)),[Ot,$t]}}),ve.addScale({scaleKey:"y",isTime:!1,distribution:Et.wf.Linear,orientation:Et.wN.Vertical,direction:Et.bQ.Up});const je=L.fields[0].display,Xe=mt=>(0,Ws.zc)(je(mt));ve.addAxis({scaleKey:"x",isTime:!1,placement:Et.LB.Bottom,incrs:wa.Zi,splits:Fe,values:(mt,Ot)=>{const $t=Ot.map(Xe),At=$t.reduce((Qt,fn)=>Math.max((0,hr.X1)(fn,Da.gD).width,Qt),0),Wt=10,Jt=mt.bbox.width/((At+Wt)*devicePixelRatio),en=Math.ceil($t.length/Jt);return $t.map((Qt,fn)=>fn%en===0?Qt:null)},theme:J});let dt=L.fields[2].display;ve.addAxis({scaleKey:"y",isTime:!1,placement:Et.LB.Left,formatValue:(mt,Ot)=>(0,Ws.zc)(dt(mt,Ot)),theme:J}),ve.setCursor({points:{show:!1},drag:{x:!0,y:!1,setScale:!0}});let ut=Gs.Z.paths.bars({align:1,size:[1,1/0]}),St=0;for(let mt=2;mt<L.fields.length;mt++){const Ot=L.fields[mt];Ot.state=Ot.state??{},Ot.state.seriesIndex=St++;const $t={...ml,...Ot.config.custom},At="y",Wt=(0,eo.fD)(Ot),en=(0,eo.YO)(Ot,J).color;ve.addSeries({scaleKey:At,lineWidth:$t.lineWidth,lineColor:en,fillOpacity:$t.fillOpacity,theme:J,colorMode:Wt,pathBuilder:ut,show:!$t.hideFrom?.viz,gradientMode:$t.gradientMode,thresholds:Ot.config.thresholds,hardMin:Ot.config.min,hardMax:Ot.config.max,softMin:$t.axisSoftMin,softMax:$t.axisSoftMax,dataFrameFieldIndex:Ot.state.origin})}return ve},jc=L=>{let J=[];for(const ee of L.fields)ee.name!==wa.cO&&J.push(ee.values);for(let ee=1;ee<J.length;ee++){let de=J[ee];for(let ve=0;ve<de.length;ve++)de[ve]===0&&(de[ve]=null)}return J};class Qc extends R.Component{constructor(J){super(J),this.state=this.prepState(J)}prepState(J,ee=!0){let de=null;const{alignedFrame:ve}=J;return ve&&(de={alignedData:jc(ve)},ee&&(de.config=ko(ve,this.props.theme))),de}renderLegend(J){const{legend:ee}=this.props;return!J||ee.showLegend===!1?null:R.createElement(ai.l,{data:this.props.rawSeries,config:J,maxHeight:"35%",maxWidth:"60%",...ee})}componentDidUpdate(J){const{structureRev:ee,alignedFrame:de,bucketSize:ve}=this.props;if(de!==J.alignedFrame){let Re=this.prepState(this.props,!1);Re&&(ve!==J.bucketSize||this.props.options!==J.options||this.state.config===void 0||ee!==J.structureRev||!ee)&&(Re.config=ko(de,this.props.theme)),Re&&this.setState(Re)}}render(){const{width:J,height:ee,children:de,alignedFrame:ve}=this.props,{config:Re}=this.state;return Re?R.createElement(is.AY,{width:J,height:ee,legend:this.renderLegend(Re)},(Fe,je)=>R.createElement(kc.N,{config:this.state.config,data:this.state.alignedData,width:Fe,height:je},de?de(Re,ve):null)):null}}const Lm=({data:L,options:J,width:ee,height:de})=>{const ve=(0,it.l4)(),Re=(0,R.useMemo)(()=>{if(!L.series.length)return;if(L.series.forEach((Xe,at)=>{Xe.fields.forEach((dt,ut)=>{dt.state={...dt.state,origin:{frameIndex:at,fieldIndex:ut}}})}),L.series.length===1){const Xe=(0,wa.qr)(L.series[0]);if(Xe)return(0,wa.zM)(Xe)}const je=(0,wa.gY)(L.series,J);if(je)return(0,wa.zM)(je,ve)},[L.series,J,ve]);if(!Re||!Re.fields.length)return R.createElement("div",{className:"panel-empty"},R.createElement("p",null,"No histogram found in response"));const Fe=yi(Re);return R.createElement(Qc,{options:J,theme:ve,legend:J.legend,rawSeries:L.series,structureRev:L.structureRev,width:ee,height:de,alignedFrame:Re,bucketSize:Fe},(je,Xe)=>null)};function lo(L){if(L?.length!==1)return!1;const J=L[0];if(J.fields.length<3||!(0,wa.Ok)(J.fields[0].name)||!(0,wa.kl)(J.fields[1].name))return!1;for(const ee of J.fields)if(ee.type!==un.fS.number)return!1;return!0}const Yc=new ne.c(Lm).setPanelOptions(L=>{L.addCustomEditor({id:"__calc__",path:"__calc__",name:"Values",description:"Showing frequencies that are calculated in the query",editor:()=>null,showIf:(J,ee)=>lo(ee)}).addNumberInput({path:"bucketSize",name:wa.py.bucketSize.name,description:wa.py.bucketSize.description,settings:{placeholder:"Auto",min:0},defaultValue:vi.bucketSize,showIf:(J,ee)=>!lo(ee)}).addNumberInput({path:"bucketOffset",name:wa.py.bucketOffset.name,description:wa.py.bucketOffset.description,settings:{placeholder:"0",min:0},defaultValue:vi.bucketOffset,showIf:(J,ee)=>!lo(ee)}).addBooleanSwitch({path:"combine",name:wa.py.combine.name,description:wa.py.combine.description,defaultValue:vi.combine,showIf:(J,ee)=>!lo(ee)}),rs.J(L)}).useFieldConfig({standardOptions:{[Kt.qb.Color]:{settings:{byValueSupport:!0},defaultValue:{mode:an.S.PaletteClassic}}},useCustomConfig:L=>{const J=ml;L.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:J.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:J.fillOpacity,settings:{min:0,max:100,step:1}}).addRadio({path:"gradientMode",name:"Gradient mode",defaultValue:Vn.q.fillGradient[0].value,settings:{options:Vn.q.fillGradient}}),Ga.B(L)}});var Zs=e(81087),fl=e(79978);const Zc=[{label:"Grafana",value:Zs.z.Grafana,description:"Core grafana live features"},{label:"Data Sources",value:Zs.z.DataSource,description:"Data sources with live support"},{label:"Plugins",value:Zs.z.Plugin,description:"Plugins with live support"}];class Bm extends R.PureComponent{constructor(){super(...arguments),this.state={namespaces:[],paths:[]},this.onScopeChanged=J=>{J.value&&this.props.onChange({scope:J.value,namespace:void 0,path:void 0})},this.onNamespaceChanged=J=>{const ee={scope:this.props.value?.scope,path:void 0};J.value&&(ee.namespace=J.value),this.props.onChange(ee)},this.onPathChanged=J=>{const{value:ee,onChange:de}=this.props,ve={scope:ee.scope,namespace:ee.namespace};J.value&&(ve.path=J.value),de(ve)}}async componentDidMount(){this.updateSelectOptions()}async componentDidUpdate(J){this.props.value!==J.value&&this.updateSelectOptions()}async updateSelectOptions(){this.setState({namespaces:[],paths:[]})}render(){const{namespaces:J,paths:ee}=this.state,{scope:de,namespace:ve,path:Re}=this.props.value,Fe=gl(ke.config.theme2);return R.createElement(R.Fragment,null,R.createElement(Ca.b,{title:"Grafana Live",severity:"info"},"This supports real-time event streams in grafana core. This feature is under heavy development. Expect the intefaces and structures to change as this becomes more production ready."),R.createElement("div",null,R.createElement("div",{className:Fe.dropWrap},R.createElement(fl._,null,"Scope"),R.createElement(Be.Ph,{options:Zc,value:Zc.find(je=>je.value===de),onChange:this.onScopeChanged})),de&&R.createElement("div",{className:Fe.dropWrap},R.createElement(fl._,null,"Namespace"),R.createElement(Be.Ph,{options:J,value:J.find(je=>je.value===ve)??(ve?{label:ve,value:ve}:void 0),onChange:this.onNamespaceChanged,allowCustomValue:!0,backspaceRemovesValue:!0})),de&&ve&&R.createElement("div",{className:Fe.dropWrap},R.createElement(fl._,null,"Path"),R.createElement(Be.Ph,{options:ee,value:Jc(ee,Re),onChange:this.onPathChanged,allowCustomValue:!0,backspaceRemovesValue:!0}))))}}function Jc(L,J){const ee=L.find(de=>de.value===J);if(ee)return ee;if(J)return{label:J,value:J}}const gl=(0,Vs.B)(L=>({dropWrap:(0,x.css)` margin-bottom: ${L.spacing(1)}; `}));var Xc=e(47838),qc=e(53933),pl=e(43685),Um=e(78838),hl=e(11649),yr=e(19221),ed=e(95066);function vl(L){const{data:J,height:ee,width:de,options:ve,fieldConfig:Re,id:Fe,timeRange:je}=L,Xe=(0,it.l4)(),at=(0,vs.R9)(),dt=J.series,ut=dt.filter(fn=>fn.meta?.custom?.parentRowIndex===void 0),St=dt.filter(fn=>fn.meta?.custom?.parentRowIndex!==void 0),mt=ut?.length,Ot=ut[0]?.fields.length,$t=td(ut,ve),At=ut[$t];let Wt=ee,Jt=St;if(!mt||!Ot)return R.createElement(Pa.Z,{panelId:Fe,fieldConfig:Re,data:J});if(mt>1){const fn=Xe.spacing.gridSize*Xe.components.height.md,Yt=Xe.spacing.gridSize;Wt=ee-fn-Yt,Jt=St.filter(vn=>vn.refId===At.refId)}const en=R.createElement(ed.i,{height:Wt,width:de,data:At,noHeader:!ve.showHeader,showTypeIcons:ve.showTypeIcons,resizable:!0,initialSortBy:ve.sortBy,onSortByChange:fn=>Nm(fn,L),onColumnResize:(fn,Yt)=>kr(fn,Yt,L),onCellFilterAdded:at.onAddAdHocFilter,footerOptions:ve.footer,enablePagination:ve.footer?.enablePagination,subData:Jt,cellHeight:ve.cellHeight,timeRange:je});if(mt===1)return en;const Qt=ut.map((fn,Yt)=>({label:(0,hn.nf)(fn),value:Yt}));return R.createElement("div",{className:nd.wrapper},en,R.createElement("div",{className:nd.selectWrapper},R.createElement(Be.Ph,{options:Qt,value:Qt[$t],onChange:fn=>El(fn,L)})))}function td(L,J){return J.frameIndex>0&&J.frameIndex<L.length?J.frameIndex:0}function kr(L,J,ee){const{fieldConfig:de}=ee,{overrides:ve}=de,Re=yr.mi.byName,Fe="custom.width",je=ve.find(Xe=>Xe.matcher.id===Re&&Xe.matcher.options===L);if(je){const Xe=je.properties.find(at=>at.id===Fe);Xe?Xe.value=J:je.properties.push({id:Fe,value:J})}else ve.push({matcher:{id:Re,options:L},properties:[{id:Fe,value:J}]});ee.onFieldConfigChange({...de,overrides:ve})}function Nm(L,J){J.onOptionsChange({...J.options,sortBy:L})}function El(L,J){J.onOptionsChange({...J.options,frameIndex:L.value||0})}const nd={wrapper:(0,x.css)` display: flex; flex-direction: column; justify-content: space-between; height: 100%; `,selectWrapper:(0,x.css)` padding: 8px 8px 0px 8px; `};var mr=(L=>(L.Raw="raw",L.JSON="json",L.Auto="auto",L.None="none",L))(mr||{});class wm extends R.PureComponent{constructor(J){super(J),this.styles=Wm(Ke.config.theme2),this.streamObserver={next:ee=>{(0,Zs.se)(ee)?this.setState({status:ee,changed:Date.now()}):(0,Zs.RL)(ee)?this.setState({message:ee.message,changed:Date.now()}):console.log("ignore",ee)}},this.unsubscribe=()=>{this.subscription&&(this.subscription.unsubscribe(),this.subscription=void 0)},this.onSaveJSON=ee=>{const{options:de,onOptionsChange:ve}=this.props;try{const Re=JSON.parse(ee);ve({...de,json:Re})}catch(Re){console.log("Error reading JSON",Re)}},this.onPublishClicked=async()=>{const{addr:ee}=this.state;if(!ee){console.log("invalid address");return}const de=this.props.options?.json;if(!de){console.log("nothing to publish");return}const ve=await(0,pl.gj)().publish(ee,de);console.log("onPublishClicked (response from publish)",ve)},this.isValid=!!(0,pl.gj)(),this.state={changed:0}}async componentDidMount(){this.loadChannel()}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}componentDidUpdate(J){this.props.options?.channel!==J.options?.channel&&this.loadChannel()}async loadChannel(){const J=this.props.options?.channel;if(!(0,Zs.nU)(J)){console.log("INVALID",J),this.unsubscribe(),this.setState({addr:void 0});return}if((0,W.isEqual)(J,this.state.addr)){console.log("Same channel",this.state.addr);return}const ee=(0,pl.gj)();if(!ee){console.log("INVALID",J),this.unsubscribe(),this.setState({addr:void 0});return}this.unsubscribe(),console.log("LOAD",J);try{this.subscription=ee.getStream(J).subscribe(this.streamObserver),this.setState({addr:J,error:void 0})}catch(de){this.setState({addr:void 0,error:de})}}renderNotEnabled(){const J=`[feature_toggles] enable = live`;return R.createElement(Ca.b,{title:"Grafana Live",severity:"info"},R.createElement("p",null,"Grafana live requires a feature flag to run"),R.createElement("b",null,"custom.ini:"),R.createElement("pre",null,J))}renderMessage(J){const{options:ee}=this.props,{message:de}=this.state;if(!de)return R.createElement("div",null,R.createElement("h4",null,"Waiting for data:"),ee.channel?.scope,"/",ee.channel?.namespace,"/",ee.channel?.path);if(ee.message===mr.JSON)return R.createElement(Um.g,{json:de,open:5});if(ee.message===mr.Auto&&de instanceof Xc.Av){const ve={series:(0,Qi.SM)({data:[de],theme:Ke.config.theme2,replaceVariables:Fe=>Fe,fieldConfig:{defaults:{},overrides:[]}}),state:qc.Gu.Streaming},Re={...this.props,options:{frameIndex:0,showHeader:!0}};return R.createElement(vl,{...Re,data:ve,height:J})}return R.createElement("pre",null,JSON.stringify(de))}renderPublish(J){const{options:ee}=this.props;return R.createElement(R.Fragment,null,R.createElement(hl.p,{height:J-32,language:"json",value:ee.json?JSON.stringify(ee.json,null,2):"{ }",onBlur:this.onSaveJSON,onSave:this.onSaveJSON,showMiniMap:!1,showLineNumbers:!0}),R.createElement("div",{style:{height:32}},R.createElement(me.zx,{onClick:this.onPublishClicked},"Publish")))}renderStatus(){const{status:J}=this.state;if(J?.state===Zs.yS.Connected)return;let ee="";return J&&(ee=this.styles.status[J.state]),R.createElement("div",{className:(0,x.cx)(ee,this.styles.statusWrap)},J?.state)}renderBody(){const{status:J}=this.state,{options:ee,height:de}=this.props;if(ee.publish){if(ee.message===mr.None)return R.createElement("div",null,this.renderPublish(de));const ve=de/2;return R.createElement("div",null,R.createElement("div",{style:{height:ve,overflow:"hidden"}},R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},this.renderMessage(ve))),R.createElement("div",null,this.renderPublish(ve)))}return ee.message===mr.None?R.createElement("pre",null,JSON.stringify(J)):R.createElement("div",{style:{overflow:"hidden",height:de}},R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},this.renderMessage(de)))}render(){if(!this.isValid)return this.renderNotEnabled();const{addr:J,error:ee}=this.state;return J?ee?R.createElement("div",null,R.createElement("h2",null,"ERROR"),R.createElement("div",null,JSON.stringify(ee))):R.createElement(R.Fragment,null,this.renderStatus(),this.renderBody()):R.createElement(Ca.b,{title:"Grafana Live",severity:"info"},"Use the panel editor to pick a channel")}}const Wm=(0,Vs.B)(L=>({statusWrap:(0,x.css)` margin: auto; position: absolute; top: 0; right: 0; background: ${L.components.panel.background}; padding: 10px; z-index: ${L.zIndex.modal}; `,status:{[Zs.yS.Pending]:(0,x.css)` border: 1px solid ${L.v1.palette.orange}; `,[Zs.yS.Connected]:(0,x.css)` border: 1px solid ${L.colors.success.main}; `,[Zs.yS.Connecting]:(0,x.css)` border: 1px solid ${L.v1.palette.brandWarning}; `,[Zs.yS.Disconnected]:(0,x.css)` border: 1px solid ${L.colors.warning.main}; `,[Zs.yS.Shutdown]:(0,x.css)` border: 1px solid ${L.colors.error.main}; `,[Zs.yS.Invalid]:(0,x.css)` border: 1px solid red; `}})),Fm=new ne.c(wm).setPanelOptions(L=>{L.addCustomEditor({category:["Channel"],id:"channel",path:"channel",name:"Channel",editor:Bm,defaultValue:{}}),L.addRadio({path:"message",name:"Show Message",description:"Display the last message received on this channel",settings:{options:[{value:mr.Raw,label:"Raw Text"},{value:mr.JSON,label:"JSON"},{value:mr.Auto,label:"Auto"},{value:mr.None,label:"None"}]},defaultValue:mr.JSON}).addBooleanSwitch({path:"publish",name:"Show Publish",description:"Display a form to publish values",defaultValue:!1})});var Pi=e(51451),Km=e(55905),ad=e(21932),Vm=e(66236),yl=e(30209);const $m=({data:L,timeZone:J,fieldConfig:ee,options:{showLabels:de,showTime:ve,wrapLogMessage:Re,showCommonLabels:Fe,prettifyLogMessage:je,sortOrder:Xe,dedupStrategy:at,enableLogDetails:dt},title:ut,id:St})=>{const mt=Xe===Et.UV.Ascending,Ot=(0,it.wW)(sd),[$t,At]=(0,R.useState)(0),Wt=(0,R.useRef)(null),{eventBus:Jt}=(0,vs.R9)(),en=(0,R.useCallback)(Mn=>{Mn?Jt.publish(new Za.es({point:{time:Mn.timeEpochMs}})):Jt.publish(new Za.xH)},[Jt]),[Qt,fn,Yt]=(0,R.useMemo)(()=>{const Mn=L?(0,yl.aB)(L.series,L.request?.intervalMs,void 0,L.request?.targets):null,Rn=Mn?.rows||[],$n=Mn?.meta?.find(ra=>ra.label===yl.Qp),wn=(0,yl.UW)(Rn,at);return[Rn,wn,$n]},[L,at]);(0,R.useLayoutEffect)(()=>{mt&&Wt.current?At(Wt.current.offsetHeight):At(0)},[mt,Qt]);const vn=(0,R.useCallback)((Mn,Rn)=>(0,Bo.a_)({field:Mn,rowIndex:Rn,range:L.timeRange}),[L]);if(!L||Qt.length===0)return R.createElement(Km.Z,{fieldConfig:ee,panelId:St,data:L,needsStringField:!0});const In=()=>R.createElement("div",{className:(0,x.cx)(Ot.labelContainer,mt&&Ot.labelContainerAscending)},R.createElement("span",{className:Ot.label},"Common labels:"),R.createElement(ad.j,{labels:Yt?Yt.value:{labels:"(no common labels)"}}));return R.createElement(Ye.$,{autoHide:!0,scrollTop:$t},R.createElement("div",{className:Ot.container,ref:Wt},Fe&&!mt&&In(),R.createElement(Vm.w,{logRows:Qt,deduplicatedRows:fn,dedupStrategy:at,showLabels:de,showTime:ve,wrapLogMessage:Re,prettifyLogMessage:je,timeZone:J,getFieldLinks:vn,logsSortOrder:Xe,enableLogDetails:dt,previewLimit:mt?Qt.length:void 0,onLogRowHover:en,app:ae.zj.Dashboard}),Fe&&mt&&In()))},sd=L=>({container:(0,x.css)({marginBottom:L.spacing(1.5)}),labelContainer:(0,x.css)({margin:L.spacing(0,0,.5,.5),display:"flex",alignItems:"center"}),labelContainerAscending:(0,x.css)({margin:L.spacing(.5,0,.5,0)}),label:(0,x.css)({marginRight:L.spacing(.5),fontSize:L.typography.bodySmall.fontSize,fontWeight:L.typography.fontWeightMedium})});class Pl{getSuggestionsForData(J){const ee=J.getListAppender({name:"",pluginId:"logs",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}}),{dataSummary:de}=J;!de.hasData||!de.hasTimeField||!de.hasStringField||(de.preferredVisualisationType==="logs"?ee.append({name:ba.y.Logs,score:Ln._.Best}):ee.append({name:ba.y.Logs}))}}const rd=new ne.c($m).setPanelOptions(L=>{L.addBooleanSwitch({path:"showTime",name:"Time",description:"",defaultValue:!1}).addBooleanSwitch({path:"showLabels",name:"Unique labels",description:"",defaultValue:!1}).addBooleanSwitch({path:"showCommonLabels",name:"Common labels",description:"",defaultValue:!1}).addBooleanSwitch({path:"wrapLogMessage",name:"Wrap lines",description:"",defaultValue:!1}).addBooleanSwitch({path:"prettifyLogMessage",name:"Prettify JSON",description:"",defaultValue:!1}).addBooleanSwitch({path:"enableLogDetails",name:"Enable log details",description:"",defaultValue:!0}).addRadio({path:"dedupStrategy",name:"Deduplication",description:"",settings:{options:[{value:Et.Y4.none,label:"None",description:Pi.Uv[Et.Y4.none]},{value:Et.Y4.exact,label:"Exact",description:Pi.Uv[Et.Y4.exact]},{value:Et.Y4.numbers,label:"Numbers",description:Pi.Uv[Et.Y4.numbers]},{value:Et.Y4.signature,label:"Signature",description:Pi.Uv[Et.Y4.signature]}]},defaultValue:Et.Y4.none}).addRadio({path:"sortOrder",name:"Order",description:"",settings:{options:[{value:Et.UV.Descending,label:"Newest first"},{value:Et.UV.Ascending,label:"Oldest first"}]},defaultValue:Et.UV.Descending})}).setSuggestionsSupplier(new Pl);var _m=e(54945),od=e(42349),id=e(5008);function zm(L){const{width:J,options:{feedUrl:ee=od.k,showImage:de}}=L,{state:ve,getNews:Re}=(0,id.j)(ee);return(0,R.useEffect)(()=>{const Fe=L.eventBus.subscribe(xa.U5,Re);return()=>{Fe.unsubscribe()}},[Re,L.eventBus]),(0,R.useEffect)(()=>{Re()},[Re]),ve.error?R.createElement(Ca.b,{title:"Error loading RSS feed"},"Make sure that the feed URL is correct and that CORS is configured correctly on the server. See"," ",R.createElement("a",{style:{textDecoration:"underline"},href:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/news/"},"News panel documentation. ",R.createElement(Ft.J,{name:"external-link-alt"}))):ve.loading?R.createElement("div",null,"Loading..."):ve.value?R.createElement(Ye.$,{autoHeightMin:"100%",autoHeightMax:"100%"},ve.value.map((Fe,je)=>R.createElement(_m.S,{key:je,index:je,width:J,showImage:de,data:ve.value}))):null}const Di={showImage:!0},co=new ne.c(zm).setPanelOptions(L=>{L.addTextInput({path:"feedUrl",name:"URL",description:"Supports RSS and Atom feeds",settings:{placeholder:od.k},defaultValue:Di.feedUrl}).addBooleanSwitch({path:"showImage",name:"Show image",description:"Controls if the news item social (og:image) image is shown above text content",defaultValue:Di.showImage})});var Dl=e(82152),Hm=e(47760),km=e(11995);const Gm=({width:L,height:J,data:ee,options:de})=>{const ve=(0,Bo.u8)(ee.timeRange);if(!ee||!ee.series.length)return R.createElement("div",{className:"panel-empty"},R.createElement("p",null,"No data found in response"));const Re=(0,Dl.Z)(km.Ee);return R.createElement("div",{style:{width:L,height:J}},R.createElement(Hm.E,{dataFrames:Re(ee.series,de),getLinks:ve}))};var jm=e(56025),Cl=e(86912);const Qm=({value:L,onChange:J,context:ee})=>{const de=(0,it.wW)(ld),ve=()=>{const je={field:"",color:""};J(L?[...L,je]:[je])},Re=je=>{const Xe=L?.slice();Xe.splice(je,1),J(Xe)},Fe=(je,Xe,at)=>{let dt=L?.slice()??[];dt[je][Xe]=at,J(dt)};return R.createElement(R.Fragment,null,L?.map((je,Xe)=>R.createElement("div",{className:de.section,key:Xe},R.createElement(Cl.b,{context:ee,value:je.field??"",onChange:at=>{Fe(Xe,"field",at)},item:{settings:{filter:at=>at.name.includes("arc__")},id:`arc-field-${Xe}`,name:`arc-field-${Xe}`,editor:()=>null}}),R.createElement(jm.zH,{color:je.color||"#808080",onChange:at=>{Fe(Xe,"color",at)}}),R.createElement(me.zx,{size:"sm",icon:"minus",variant:"secondary",onClick:()=>Re(Xe),title:"Remove arc"}))),R.createElement(me.zx,{size:"sm",icon:"plus",onClick:ve,variant:"secondary"},"Add arc"))},ld=()=>({section:(0,x.css)` display: flex; align-items: center; justify-content: space-between; gap: 0 8px; margin-bottom: 8px; `}),Ym=new ne.c(Gm).setPanelOptions((L,J)=>{L.addNestedOptions({category:["Nodes"],path:"nodes",build:ee=>{ee.addUnitPicker({name:"Main stat unit",path:"mainStatUnit"}),ee.addUnitPicker({name:"Secondary stat unit",path:"secondaryStatUnit"}),ee.addCustomEditor({name:"Arc sections",path:"arcs",id:"arcs",editor:Qm})}}),L.addNestedOptions({category:["Edges"],path:"edges",build:ee=>{ee.addUnitPicker({name:"Main stat unit",path:"mainStatUnit"}),ee.addUnitPicker({name:"Secondary stat unit",path:"secondaryStatUnit"})}})});var Zm=e(91466),cd=e(43765),Jm=e(58061),dd=e(68748),Xm=e(10994),qm=e(66763),ef=e(3344),tf=e(67692),Go=e(71685),nf=e(50741),bl=e(73014);let af=0;const sf=()=>af++;function rf(L){const J=(0,R.useRef)(null);return J.current===null&&(J.current=L+sf()),J.current.toString()}var Pr=(L=>(L.Donut="donut",L.Pie="pie",L))(Pr||{}),rr=(L=>(L.Name="name",L.Percent="percent",L.Value="value",L))(rr||{}),Gr=(L=>(L.Percent="percent",L.Value="value",L))(Gr||{});const mp={values:[]},fp={displayLabels:[]};function ud(L){return!L.field.custom?.hideFrom?.viz&&!isNaN(L.display.numeric)}function md(L,J){return J.display.numeric+L}const Ci=({fieldDisplayValues:L,pieType:J,width:ee,height:de,highlightedTitle:ve,displayLabels:Re=[],tooltipOptions:Fe})=>{const je=(0,it.l4)(),Xe=rf("PieChart"),at=(0,it.wW)(Sl),dt=(0,ef.Z)(),{containerRef:ut,TooltipInPortal:St}=(0,tf.Z)({detectBounds:!0,scroll:!0}),mt=L.filter(ud),Ot=Yt=>Yt.display.numeric,$t=Yt=>`${Xe}-${(0,Go.Z)(Yt).toHex()}`,At=Yt=>`url(#${$t(Yt)})`,Wt=Re.length>0,Jt=Fe.mode!=="none"&&dt.tooltipOpen,en=mt.reduce(md,0),Qt=xl(ee,de,J),fn=[...new Set(mt.map(Yt=>Yt.display.color??an.R))];return R.createElement("div",{className:at.container},R.createElement("svg",{width:Qt.size,height:Qt.size,ref:ut,style:{overflow:"visible"}},R.createElement(Xm.Z,{top:Qt.position,left:Qt.position},fn.map(Yt=>R.createElement(dd.Z,{key:Yt,id:$t(Yt),from:df(Yt,je),to:uf(Yt,je),fromOffset:Qt.gradientFromOffset,toOffset:"1",gradientUnits:"userSpaceOnUse",cx:0,cy:0,radius:Qt.outerRadius})),R.createElement(qm.Z,{data:mt,pieValue:Ot,outerRadius:Qt.outerRadius,innerRadius:Qt.innerRadius,cornerRadius:3,padAngle:.005},Yt=>R.createElement(R.Fragment,null,Yt.arcs.map(vn=>{const In=vn.data.display.color??an.R,Mn=gd(ve,vn);return vn.data.hasLinks&&vn.data.getLinks?R.createElement(nf.V,{key:vn.index,links:vn.data.getLinks},Rn=>R.createElement(Ml,{tooltip:dt,highlightState:Mn,arc:vn,pie:Yt,fill:At(In),openMenu:Rn.openMenu,tooltipOptions:Fe})):R.createElement(Ml,{key:vn.index,highlightState:Mn,tooltip:dt,arc:vn,pie:Yt,fill:At(In),tooltipOptions:Fe})}),Wt&&Yt.arcs.map(vn=>{const In=gd(ve,vn);return R.createElement(of,{arc:vn,key:vn.index,highlightState:In,outerRadius:Qt.outerRadius,innerRadius:Qt.innerRadius,displayLabels:Re,total:en,color:je.colors.text.primary})}))))),Jt?R.createElement(St,{key:Math.random(),top:dt.tooltipTop,className:at.tooltipPortal,left:dt.tooltipLeft,unstyled:!0,applyPositionStyle:!0},R.createElement(bl.c,{series:dt.tooltipData})):null)};function Ml({arc:L,pie:J,highlightState:ee,openMenu:de,fill:ve,tooltip:Re,tooltipOptions:Fe}){const je=(0,it.l4)(),Xe=(0,it.wW)(Sl),{eventBus:at}=(0,vs.R9)(),dt=(0,R.useCallback)(mt=>{at?.publish({type:Za.xH.type,payload:{raw:mt,x:0,y:0,dataId:L.data.display.title}}),Re.hideTooltip()},[at,L,Re]),ut=(0,R.useCallback)(mt=>{at?.publish({type:Za.es.type,payload:{raw:mt,x:0,y:0,dataId:L.data.display.title}});const Ot=mt.currentTarget.ownerSVGElement;if(Ot){const $t=(0,Jm.Z)(Ot,mt);Re.showTooltip({tooltipLeft:$t.x,tooltipTop:$t.y,tooltipData:lf(J,L,Fe)})}},[at,L,Re,J,Fe]),St=pd(ee,Xe);return R.createElement("g",{key:L.data.display.title,className:St,onMouseMove:Fe.mode!=="none"?ut:void 0,onMouseOut:dt,onClick:de,"aria-label":Ze.wl.components.Panels.Visualization.PieChart.svgSlice},R.createElement("path",{d:J.path({...L}),fill:ve,stroke:je.colors.background.primary,strokeWidth:1}))}function of({arc:L,outerRadius:J,innerRadius:ee,displayLabels:de,total:ve,color:Re,highlightState:Fe}){const je=(0,it.wW)(Sl),Xe=ee===0?J/6:ee,[at,dt]=cf(L,J,Xe);if(!(L.endAngle-L.startAngle>=.3))return null;let St=de.includes(rr.Name)?Math.min(Math.max(J/150*14,12),30):Math.min(Math.max(J/100*14,12),36);return R.createElement("g",{className:pd(Fe,je)},R.createElement("text",{fill:Re,x:at,y:dt,dy:".33em",fontSize:St,fontWeight:500,textAnchor:"middle",pointerEvents:"none"},de.includes(rr.Name)&&R.createElement("tspan",{x:at,dy:"1.2em"},L.data.display.title),de.includes(rr.Value)&&R.createElement("tspan",{x:at,dy:"1.2em"},(0,Ws.zc)(L.data.display)),de.includes(rr.Percent)&&R.createElement("tspan",{x:at,dy:"1.2em"},(L.data.display.numeric/ve*100).toFixed(L.data.field.decimals??0)+"%")))}function lf(L,J,ee){return ee.mode==="multi"?L.arcs.filter(de=>{const ve=de.data.field;return ve&&!ve.custom?.hideFrom?.tooltip&&!ve.custom?.hideFrom?.viz}).map(de=>({color:de.data.display.color??an.R,label:de.data.display.title,value:(0,Ws.zc)(de.data.display),isActive:de.index===J.index})):[{color:J.data.display.color??an.R,label:J.data.display.title,value:(0,Ws.zc)(J.data.display)}]}function cf(L,J,ee){const de=(J+ee)/2,ve=(+L.startAngle+ +L.endAngle)/2-Math.PI/2;return[Math.cos(ve)*de,Math.sin(ve)*de]}function df(L,J){return(0,Go.Z)(L).darken(20*(J.isDark?1:-.7)).spin(4).toRgbString()}function uf(L,J){return(0,Go.Z)(L).darken(10*(J.isDark?1:-.7)).spin(-4).toRgbString()}function xl(L,J,ee,de=16){const ve=Math.min(J,L),Re=(ve-de*2)/2,Fe=ee===Pr.Pie?Re:Math.max(Re/3,20),je=Re-Fe,Xe=(ve-de*2)/2,at=1-(Re-je)/Re;return{position:Xe+de,size:ve,outerRadius:Re,innerRadius:je,gradientFromOffset:at}}var fd=(L=>(L[L.Highlighted=0]="Highlighted",L[L.Deemphasized=1]="Deemphasized",L[L.Normal=2]="Normal",L))(fd||{});function gd(L,J){return L?L===J.data.display.title?0:1:2}function pd(L,J){switch(L){case 0:return J.svgArg.highlighted;case 1:return J.svgArg.deemphasized;case 2:default:return J.svgArg.normal}}const Sl=L=>({container:(0,x.css)` width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; `,svgArg:{normal:(0,x.css)` transition: all 200ms ease-in-out; `,highlighted:(0,x.css)` transition: all 200ms ease-in-out; transform: scale3d(1.03, 1.03, 1); `,deemphasized:(0,x.css)` transition: all 200ms ease-in-out; fill-opacity: 0.5; `},tooltipPortal:(0,x.css)` ${(0,No.getTooltipContainerStyles)(L)} `}),mf={displayMode:Et.jK.List,showLegend:!0,placement:"right",calcs:[],values:[Gr.Percent]};function hd(L){const{data:J,timeZone:ee,fieldConfig:de,replaceVariables:ve,width:Re,height:Fe,options:je,id:Xe}=L,at=(0,it.l4)(),dt=gf(),ut=(0,Zm.nG)({fieldConfig:de,reduceOptions:je.reduceOptions,data:J.series,theme:at,replaceVariables:ve,timeZone:ee});return ff(ut)?R.createElement(is.AY,{width:Re,height:Fe,legend:vd(L,ut)},(St,mt)=>R.createElement(Ci,{width:St,height:mt,highlightedTitle:dt,fieldDisplayValues:ut,tooltipOptions:je.tooltip,pieType:je.pieType,displayLabels:je.displayLabels})):R.createElement(Pa.Z,{panelId:Xe,fieldConfig:de,data:J})}function vd(L,J){const ee=L.options.legend??mf;if(ee.showLegend===!1)return;const de=J.filter(ud).reduce(md,0),ve=J.sort((Re,Fe)=>isNaN(Re.display.numeric)?1:isNaN(Fe.display.numeric)?-1:Fe.display.numeric-Re.display.numeric).map((Re,Fe)=>{const je=Re.field.custom?.hideFrom??{};if(je.legend)return;const Xe=!!je.viz,at=Re.display;return{label:at.title??"",color:at.color??an.R,yAxis:1,disabled:Xe,getItemKey:()=>(at.title??"")+Fe,getDisplayValues:()=>{const dt=ee.values??[];let ut=[];if(dt.includes(Gr.Value)&&ut.push({numeric:at.numeric,text:(0,Ws.zc)(at),title:"Value"}),dt.includes(Gr.Percent)){const St=Xe?0:at.numeric/de,mt=St*100;ut.push({numeric:St,percent:mt,text:Xe||isNaN(St)?L.fieldConfig.defaults.noValue??"-":mt.toFixed(Re.field.decimals??0)+"%",title:dt.length>1?"Percent":""})}return ut}}}).filter(Re=>!!Re);return R.createElement(is.AY.Legend,{placement:ee.placement,width:ee.width},R.createElement($s.l,{items:ve,seriesVisibilityChangeBehavior:cd.Y.Hide,placement:ee.placement,displayMode:ee.displayMode}))}function ff(L){return L.some(J=>J.view?.dataFrame.length)}function gf(){const[L,J]=(0,R.useState)(),{eventBus:ee}=(0,vs.R9)();return(0,R.useEffect)(()=>{const de=Fe=>{J(Fe.payload.dataId)},ve=Fe=>{J(void 0)},Re=new Sa.w0;return Re.add(ee.getStream(Za.es).subscribe({next:de})),Re.add(ee.getStream(Za.xH).subscribe({next:ve})),()=>{Re.unsubscribe()}},[J,ee]),L}const pf=(L,J,ee)=>{if(J==="grafana-piechart-panel"&&ee.angular){const de=ee.angular,ve=[];let Re=L.options;if(de.aliasColors)for(const Fe of Object.keys(de.aliasColors)){const je=de.aliasColors[Fe];je&&ve.push({matcher:{id:yr.mi.byName,options:Fe},properties:[{id:Kt.qb.Color,value:{mode:an.S.Fixed,fixedColor:je}}]})}if(L.fieldConfig={overrides:ve,defaults:{unit:de.format,decimals:de.decimals?de.decimals:0}},Re.legend={placement:"right",values:[],displayMode:Et.jK.Table,showLegend:!0,calcs:[]},de.valueName)switch(Re.reduceOptions={calcs:[]},de.valueName){case"current":Re.reduceOptions.calcs=["lastNotNull"];break;case"min":Re.reduceOptions.calcs=["min"];break;case"max":Re.reduceOptions.calcs=["max"];break;case"avg":Re.reduceOptions.calcs=["mean"];break;case"total":Re.reduceOptions.calcs=["sum"];break}switch(de.legendType){case"Under graph":Re.legend.placement="bottom";break;case"Right side":Re.legend.placement="right";break}switch(de.pieType){case"pie":Re.pieType=Pr.Pie;break;case"donut":Re.pieType=Pr.Donut;break}return de.legend&&(de.legend.show||(Re.legend.showLegend=!1),de.legend.values&&Re.legend.values.push(Gr.Value),de.legend.percentage&&Re.legend.values.push(Gr.Percent)),de.legendType==="On graph"&&(Re.legend.showLegend=!1,Re.displayLabels=[rr.Name],de.legend.values&&Re.displayLabels.push(rr.Value),de.legend.percentage&&Re.displayLabels.push(rr.Percent)),Re}return{}};class hf{getSuggestionsForData(J){const ee=J.getListAppender({name:ba.y.PieChart,pluginId:"piechart",options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},displayLabels:[rr.Percent],legend:{placement:"right",values:[]}},cardOptions:{previewModifier:ve=>{ve.options.legend.showLegend=!1}}}),{dataSummary:de}=J;if(de.hasNumberField){if(de.hasStringField&&de.frameCount===1){if(de.rowCountTotal>30||de.rowCountTotal<2)return;ee.append({name:ba.y.PieChart,options:{reduceOptions:{values:!0,calcs:[]}}}),ee.append({name:ba.y.PieChartDonut,options:{reduceOptions:{values:!0,calcs:[]},pieType:Pr.Donut}});return}de.numberFieldCount>30||de.numberFieldCount<2||(ee.append({name:ba.y.PieChart}),ee.append({name:ba.y.PieChartDonut,options:{pieType:Pr.Donut}}))}}}const vf=new ne.c(hd).setPanelChangeHandler(pf).useFieldConfig({disableStandardOptions:[Kt.qb.Thresholds],standardOptions:{[Kt.qb.Color]:{settings:{byValueSupport:!1,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:an.S.PaletteClassic}}},useCustomConfig:L=>{Ga.B(L)}}).setPanelOptions(L=>{(0,ii.j)(L),L.addRadio({name:"Piechart type",description:"How the piechart should be rendered",path:"pieType",settings:{options:[{value:Pr.Pie,label:"Pie"},{value:Pr.Donut,label:"Donut"}]},defaultValue:Pr.Pie}).addMultiSelect({name:"Labels",path:"displayLabels",description:"Select the labels to be displayed in the pie chart",settings:{options:[{value:rr.Percent,label:"Percent"},{value:rr.Name,label:"Name"},{value:rr.Value,label:"Value"}]}}),Cs.L(L),rs.J(L,!1),L.addMultiSelect({name:"Legend values",path:"legend.values",category:["Legend"],settings:{options:[{value:Gr.Percent,label:"Percent"},{value:Gr.Value,label:"Value"}]},showIf:J=>J.legend.showLegend!==!1})}).setSuggestionsSupplier(new hf);var Ef=e(24830),bi=e(49183),Ed=e(95668),yd=e(43801);const Pd=({data:L,alignedData:J,seriesIdx:ee,datapointIdx:de,timeZone:ve,onAnnotationAdd:Re})=>{const Fe=(0,it.l4)();if(!L||de==null)return null;const je=J.fields[ee],Xe=[],at=new Set;if(je.getLinks){const Yt=je.values[de],vn=je.display?je.display(Yt):{text:`${Yt}`,numeric:+Yt};je.getLinks({calculatedValue:vn,valueRowIndex:de}).forEach(In=>{const Mn=`${In.title}/${In.href}`;at.has(Mn)||(Xe.push(In),at.add(Mn))})}const dt=J.fields[0],ut=dt.display||(0,js.U)({field:dt,timeZone:ve,theme:Fe}),St=je.state?.origin,mt=je.display||(0,js.U)({field:je,timeZone:ve,theme:Fe}),Ot=je.values[de],$t=mt(Ot),At=St?(0,hn.CZ)(L[St.frameIndex].fields[St.fieldIndex],L[St.frameIndex],L):null,Wt=(0,_s.iK)(je,de);let Jt;Wt&&(Jt=dt.values[Wt]);const en=dt.values[de];let Qt=null,fn=null;if(Jt){const Yt=Jt&&(0,_s.Y)(Jt-en);fn=R.createElement(R.Fragment,null,R.createElement("br",null),R.createElement("strong",null,"Duration:")," ",Yt),Qt=R.createElement(R.Fragment,null," to"," ",R.createElement("strong",null,ut(dt.values[Wt]).text))}return R.createElement("div",null,R.createElement("div",{style:{fontSize:Fe.typography.bodySmall.fontSize}},At,R.createElement("br",null),R.createElement(bl.V,{label:$t.text,color:$t.color||an.R,isActive:!0}),"From ",R.createElement("strong",null,ut(dt.values[de]).text),Qt,fn),R.createElement("div",{style:{margin:Fe.spacing(1,-1,-1,-1),borderTop:`1px solid ${Fe.colors.border.weak}`}},Re&&R.createElement(zs.s,{label:"Add annotation",icon:"comment-alt",onClick:Re}),Xe.length>0&&Xe.map((Yt,vn)=>R.createElement(zs.s,{key:vn,icon:"external-link-alt",target:Yt.target,label:Yt.title,url:Yt.href,onClick:Yt.onClick}))))};Pd.displayName="StateTimelineTooltip";const Mi=10,yf=({data:L,timeRange:J,timeZone:ee,options:de,width:ve,height:Re,replaceVariables:Fe,onChangeTimeRange:je})=>{const Xe=(0,it.l4)(),at=(0,R.useRef)(void 0),dt=(0,R.useRef)(!1),[ut,St]=(0,R.useState)(void 0),[mt,Ot]=(0,R.useState)(null),[$t,At]=(0,R.useState)(null),[Wt,Jt]=(0,R.useState)(null),[en,Qt]=(0,R.useState)(!1),[fn,Yt]=(0,R.useState)(!1),{sync:vn,canAddAnnotations:In}=(0,vs.R9)(),Mn=()=>{dt.current=!1,Ot(null),Yt(!1)},Rn=()=>{dt.current=!dt.current,Yt(dt.current)},{frames:$n,warn:wn}=(0,R.useMemo)(()=>(0,_s.AR)(L.series,de.mergeValues??!0,J,Xe),[L.series,de.mergeValues,J,Xe]),ra=(0,R.useMemo)(()=>(0,_s.SA)($n,de.legend,Xe),[$n,de.legend,Xe]),Gn=(0,R.useMemo)(()=>di(de.timezone,ee),[de.timezone,ee]),Sn=(0,R.useCallback)((la,Fa,za,Ka)=>{const Ha=$n??[],Zn=Ha.reduce((Wn,Yn)=>Wn+Yn.fields.filter(ta=>ta.type!==un.fS.time).length,0);return Fa===null||za===null||!la.meta?.transformations?.length&&la.fields.length-1!==Zn||!la.fields[Fa]?null:R.createElement(R.Fragment,null,fn&&R.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},R.createElement(Vr.P,{onClick:Mn,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),R.createElement(Pd,{data:Ha,alignedData:la,seriesIdx:Fa,datapointIdx:za,timeZone:ee,onAnnotationAdd:Ka}))},[ee,$n,fn]);if(!$n||wn)return R.createElement("div",{className:"panel-empty"},R.createElement("p",null,wn??"No data found in response"));if($n.length===1){const la=(0,Xc.MB)($n[0])}const Xn=!!(In&&In());return R.createElement(yd.K,{theme:Xe,frames:$n,structureRev:L.structureRev,timeRange:J,timeZone:Gn,width:ve,height:Re,legendItems:ra,...de,mode:_s.KN.Changes},(la,Fa)=>(at.current!==la&&(at.current=Ki({config:la,onUPlotClick:Rn,setFocusedSeriesIdx:At,setFocusedPointIdx:Jt,setCoords:Ot,setHover:St,isToolTipOpen:dt,isActive:en,setIsActive:Qt,sync:vn})),R.createElement(R.Fragment,null,R.createElement(ao.R,{config:la,onZoom:je}),R.createElement(Fo,{config:la,onChangeTimeRange:je}),L.annotations&&R.createElement(Ji,{annotations:L.annotations,config:la,timeZone:ee}),Xn?R.createElement(Uo,{data:Fa,timeZone:ee,config:la},({startAnnotating:za})=>de.tooltip.mode===Et.f3.None||Wt===null||!en&&vn&&vn()===Fi.m.Crosshair?null:R.createElement(vr.h_,null,ut&&mt&&$t&&R.createElement(qr.S,{position:{x:mt.viewport.x,y:mt.viewport.y},offset:{x:Mi,y:Mi},allowPointerEvents:dt.current},Sn(Fa,$t,Wt,()=>{za({coords:{plotCanvas:mt.canvas,viewport:mt.viewport}}),Mn()})))):R.createElement(vr.h_,null,de.tooltip.mode!==Et.f3.None&&ut&&mt&&R.createElement(qr.S,{position:{x:mt.viewport.x,y:mt.viewport.y},offset:{x:Mi,y:Mi},allowPointerEvents:dt.current},Sn(Fa,$t,Wt))))))};var jo=e(51046);const Dd=(L,J,ee)=>{let de=L.options??{};if(J==="natel-discrete-panel"&&ee.angular){const ve=ee.angular,Re=L.fieldConfig??{defaults:{},overrides:[]};ve.units&&(Re.defaults.unit=ve.units);const Fe={fillOpacity:100,lineWidth:0};Re.defaults.custom=Fe,de.mergeValues=!0;const je={type:jo.H.ValueToText,options:{}};if(Re.defaults.mappings=[je],(0,W.isArray)(ve.colorMaps))for(const Xe of ve.colorMaps){const at=Xe.color;at&&(je.options[Xe.text]={color:at})}if((0,W.isArray)(ve.valueMaps))for(const Xe of ve.valueMaps){const at=Xe.text,dt=Xe.value;if(at&&dt){let ut=je.options[dt];ut?ut.text=at:je.options[dt]={text:at}}}if((0,W.isArray)(ve.rangeMaps))for(const Xe of ve.rangeMaps){let at=+Xe.from,dt=+Xe.to;const ut=Xe.text;ut&&Re.defaults.mappings.push({type:jo.H.RangeToText,options:{from:at,to:dt,result:{text:ut}}})}L.fieldConfig=Re}return de},Co={alignValue:"left",mergeValues:!0,rowHeight:.9,showValue:Et.Jp.Auto},Cd={fillOpacity:70,lineWidth:0};class Pf{getSuggestionsForData(J){const{dataSummary:ee}=J;if(!ee.hasData||!ee.hasTimeField||!ee.hasStringField&&!ee.hasNumberField||ee.numberFieldCount>=30||ee.preferredVisualisationType==="logs")return;J.getListAppender({name:"",pluginId:"state-timeline",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}}).append({name:ba.y.StateTimeline})}}const Df=new ne.c(yf).setPanelChangeHandler(Dd).useFieldConfig({standardOptions:{[Kt.qb.Color]:{settings:{byValueSupport:!0},defaultValue:{mode:an.S.ContinuousGrYlRd}}},useCustomConfig:L=>{L.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:Cd.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:Cd.fillOpacity,settings:{min:0,max:100,step:1}}).addCustomEditor({id:"spanNulls",path:"spanNulls",name:"Connect null values",defaultValue:!1,editor:Ed.c,override:Ed.c,shouldApply:J=>J.type!==un.fS.time,process:yn.kG,settings:{isTime:!0}}).addCustomEditor({id:"insertNulls",path:"insertNulls",name:"Disconnect values",defaultValue:!1,editor:bi.M,override:bi.M,shouldApply:J=>J.type!==un.fS.time,process:yn.kG,settings:{isTime:!0}}),Ga.B(L)}}).setPanelOptions(L=>{L.addBooleanSwitch({path:"mergeValues",name:"Merge equal consecutive values",defaultValue:Co.mergeValues}).addRadio({path:"showValue",name:"Show values",settings:{options:[{value:Et.Jp.Auto,label:"Auto"},{value:Et.Jp.Always,label:"Always"},{value:Et.Jp.Never,label:"Never"}]},defaultValue:Co.showValue}).addRadio({path:"alignValue",name:"Align values",settings:{options:[{value:"left",label:"Left"},{value:"center",label:"Center"},{value:"right",label:"Right"}]},defaultValue:Co.alignValue}).addSliderInput({path:"rowHeight",name:"Row height",settings:{min:0,max:1,step:.01},defaultValue:Co.rowHeight}),rs.J(L,!1),Cs.L(L,!0)}).setSuggestionsSupplier(new Pf).setDataSupport({annotations:!0}),bd=({data:L,alignedData:J,seriesIdx:ee,datapointIdx:de,timeZone:ve})=>{const Re=(0,it.l4)();if(!L||de==null)return null;const Fe=J.fields[ee],je=[],Xe=new Set;if(Fe.getLinks){const At=Fe.values[de],Wt=Fe.display?Fe.display(At):{text:`${At}`,numeric:+At};Fe.getLinks({calculatedValue:Wt,valueRowIndex:de}).forEach(Jt=>{const en=`${Jt.title}/${Jt.href}`;Xe.has(en)||(je.push(Jt),Xe.add(en))})}const at=J.fields[0],dt=at.display||(0,js.U)({field:at,timeZone:ve,theme:Re}),ut=Fe.state?.origin,St=Fe.display||(0,js.U)({field:Fe,timeZone:ve,theme:Re}),mt=Fe.values[de],Ot=St(mt),$t=ut?(0,hn.CZ)(L[ut.frameIndex].fields[ut.fieldIndex],L[ut.frameIndex],L):null;return R.createElement("div",null,R.createElement("div",{style:{fontSize:Re.typography.bodySmall.fontSize}},R.createElement("strong",null,dt(at.values[de]).text),R.createElement("br",null),R.createElement(bl.V,{label:Ot.text,color:Ot.color||an.R,isActive:!0}),$t),je.length>0&&R.createElement("div",{style:{margin:Re.spacing(1,-1,-1,-1),borderTop:`1px solid ${Re.colors.border.weak}`}},je.map((At,Wt)=>R.createElement(zs.s,{key:Wt,icon:"external-link-alt",target:At.target,label:At.title,url:At.href,onClick:At.onClick}))))};bd.displayName="StatusHistoryTooltip";const Md=10,Cf=({data:L,timeRange:J,timeZone:ee,options:de,width:ve,height:Re,onChangeTimeRange:Fe})=>{const je=(0,it.l4)(),Xe=(0,R.useRef)(void 0),at=(0,R.useRef)(!1),[dt,ut]=(0,R.useState)(void 0),[St,mt]=(0,R.useState)(null),[Ot,$t]=(0,R.useState)(null),[At,Wt]=(0,R.useState)(null),[Jt,en]=(0,R.useState)(!1),[Qt,fn]=(0,R.useState)(!1),{sync:Yt}=(0,vs.R9)(),vn=()=>{at.current=!1,mt(null),fn(!1)},In=()=>{at.current=!at.current,fn(at.current)},{frames:Mn,warn:Rn}=(0,R.useMemo)(()=>(0,_s.AR)(L.series,!1,J,je),[L.series,J,je]),$n=(0,R.useMemo)(()=>(0,_s.SA)(Mn,de.legend,je),[Mn,de.legend,je]),wn=(0,R.useCallback)((Sn,Xn,la)=>{const Fa=Mn??[],za=Fa.reduce((Ka,Ha)=>Ka+Ha.fields.filter(Zn=>Zn.type!==un.fS.time).length,0);return Xn===null||la===null||!Sn.meta?.transformations?.length&&Sn.fields.length-1!==za||!Sn.fields[Xn]?null:R.createElement(R.Fragment,null,Qt&&R.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},R.createElement(Vr.P,{onClick:vn,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),R.createElement(bd,{data:Fa,alignedData:Sn,seriesIdx:Xn,datapointIdx:la,timeZone:ee}))},[ee,Mn,Qt]),ra=Sn=>de.tooltip.mode===Et.f3.None||At===null||!Jt&&Yt&&Yt()===Fi.m.Crosshair?null:R.createElement(vr.h_,null,dt&&St&&Ot&&R.createElement(qr.S,{position:{x:St.viewport.x,y:St.viewport.y},offset:{x:Md,y:Md},allowPointerEvents:at.current},wn(Sn,Ot,At))),Gn=(0,R.useMemo)(()=>di(de.timezone,ee),[de.timezone,ee]);return!Mn||Rn?R.createElement("div",{className:"panel-empty"},R.createElement("p",null,Rn??"No data found in response")):Mn[0].length>ve/2?R.createElement("div",{className:"panel-empty"},R.createElement("p",null,"Too many points to visualize properly. ",R.createElement("br",null),"Update the query to return fewer points. ",R.createElement("br",null),"(",Mn[0].length," points received)")):R.createElement(yd.K,{theme:je,frames:Mn,structureRev:L.structureRev,timeRange:J,timeZone:Gn,width:ve,height:Re,legendItems:$n,...de,mode:_s.KN.Samples},(Sn,Xn)=>(Xe.current!==Sn&&(Xe.current=Ki({config:Sn,onUPlotClick:In,setFocusedSeriesIdx:$t,setFocusedPointIdx:Wt,setCoords:mt,setHover:ut,isToolTipOpen:at,isActive:Jt,setIsActive:en})),R.createElement(R.Fragment,null,R.createElement(ao.R,{config:Sn,onZoom:Fe}),ra(Xn),R.createElement(Fo,{config:Sn,onChangeTimeRange:Fe}))))},gp={colWidth:.9,rowHeight:.9,showValue:Et.Jp.Auto},Tl={fillOpacity:70,lineWidth:1};class bf{getSuggestionsForData(J){const{dataSummary:ee}=J;if(!ee.hasData||!ee.hasTimeField||!ee.hasStringField&&!ee.hasNumberField||ee.numberFieldCount>=30||ee.rowCountMax>100||ee.preferredVisualisationType==="logs")return;J.getListAppender({name:"",pluginId:"status-history",options:{},fieldConfig:{defaults:{color:{mode:an.S.ContinuousGrYlRd},custom:{}},overrides:[]},cardOptions:{previewModifier:ve=>{ve.options.colWidth=.7}}}).append({name:ba.y.StatusHistory})}}const Mf=new ne.c(Cf).useFieldConfig({standardOptions:{[Kt.qb.Color]:{settings:{byValueSupport:!0},defaultValue:{mode:an.S.Thresholds}}},useCustomConfig:L=>{L.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:Tl.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:Tl.fillOpacity,settings:{min:0,max:100,step:1}}),Ga.B(L)}}).setPanelOptions(L=>{L.addRadio({path:"showValue",name:"Show values",settings:{options:[{value:Et.Jp.Auto,label:"Auto"},{value:Et.Jp.Always,label:"Always"},{value:Et.Jp.Never,label:"Never"}]},defaultValue:Et.Jp.Auto}).addSliderInput({path:"rowHeight",name:"Row height",defaultValue:.9,settings:{min:0,max:1,step:.01}}).addSliderInput({path:"colWidth",name:"Column width",defaultValue:.9,settings:{min:0,max:1,step:.01}}),rs.J(L,!1),Cs.L(L,!0)}).setSuggestionsSupplier(new bf);var xf=e(41199);const Qo={align:"auto",inspect:!1,cellOptions:{type:Et.h2.Auto}};var Sf=e(42074);function Tf({onChange:L,value:J,context:ee}){const de=ve=>{ve?.currentTarget.checked&&(ee.options.footer.show=!1),L(ve?.currentTarget.checked)};return R.createElement(Sf.r,{value:!!J,onChange:de})}function xd({cellOptions:L,onChange:J}){const ee=ve=>{L.mode=ve,J(L)},de=ve=>{L.valueDisplayMode=ve,J(L)};return R.createElement(Ta.K,{direction:"column",gap:0},R.createElement(qa.g,{label:"Gauge display mode"},R.createElement(oi.S,{value:L?.mode??Et.QH.Gradient,onChange:ee,options:Sd})),R.createElement(qa.g,{label:"Value display"},R.createElement(oi.S,{value:L?.valueDisplayMode??Et.M8.Text,onChange:de,options:Ol})))}const Sd=[{value:Et.QH.Basic,label:"Basic"},{value:Et.QH.Gradient,label:"Gradient"},{value:Et.QH.Lcd,label:"Retro LCD"}],Ol=[{value:Et.M8.Color,label:"Value color"},{value:Et.M8.Text,label:"Text color"},{value:Et.M8.Hidden,label:"Hidden"}],Td=[{value:Et.v7.Basic,label:"Basic"},{value:Et.v7.Gradient,label:"Gradient"}],Of=({cellOptions:L,onChange:J})=>{const ee=de=>{L.mode=de,J(L)};return R.createElement(qa.g,{label:"Background display mode"},R.createElement(oi.S,{value:L?.mode??Et.v7.Gradient,onChange:ee,options:Td}))};var If=e(26946),Il=e(42100);const Od=["drawStyle","lineInterpolation","barAlignment","lineWidth","fillOpacity","gradientMode","lineStyle","spanNulls","showPoints","pointSize"],pp=L=>{const{cellOptions:J,onChange:ee}=L,de=(0,R.useMemo)(()=>{const Fe=(0,Ir.F)(Il.U);return(0,If.j)(Fe,"ChartCell")},[]),ve=(0,it.wW)(Rf),Re={...Il.U,...J};return R.createElement(Er.wc,null,de.list(Od.map(Fe=>`custom.${Fe}`)).map(Fe=>{if(Fe.showIf&&!Fe.showIf(Re))return null;const je=Fe.editor,Xe=Fe.path;return R.createElement(qa.g,{label:Fe.name,key:Fe.id,className:ve.field},R.createElement(je,{onChange:at=>ee({...J,[Xe]:at}),value:(hp(Xe,Re)?Re[Xe]:void 0)??Fe.defaultValue,item:Fe,context:{data:[]}}))}))};function hp(L,J){return L in J}const Rf=()=>({field:(0,x.css)` width: 100%; // @TODO don't show "scheme" option for custom gradient mode. // it needs thresholds to work, which are not supported // for area chart cell right now [title='Use color scheme to define gradient'] { display: none; } `}),Id=({value:L,onChange:J})=>{const ee=L.type,de=(0,it.wW)(Lf),ve=Rl.find(at=>at.value.type===ee);let[Re,Fe]=(0,R.useState)({});const je=at=>{at.value!==void 0&&(L=at.value,Re[L.type]!==void 0&&Object.keys(Re[L.type]).length>1&&(L=(0,W.merge)(L,Re[L.type])),J(L))},Xe=at=>{Re[L.type]=(0,W.merge)(L,at),Fe(Re),J(Re[L.type])};return R.createElement("div",{className:de.fixBottomMargin},R.createElement(qa.g,null,R.createElement(Be.Ph,{options:Rl,value:ve,onChange:je})),ee===Et.h2.Gauge&&R.createElement(xd,{cellOptions:L,onChange:Xe}),ee===Et.h2.ColorBackground&&R.createElement(Of,{cellOptions:L,onChange:Xe}),ee===Et.h2.Sparkline&&R.createElement(pp,{cellOptions:L,onChange:Xe}))},Af={value:{type:Et.h2.Sparkline},label:"Sparkline"},Rl=[{value:{type:Et.h2.Auto},label:"Auto"},...Ke.config.featureToggles.timeSeriesTable?[Af]:[],{value:{type:Et.h2.ColorText},label:"Colored text"},{value:{type:Et.h2.ColorBackground},label:"Colored background"},{value:{type:Et.h2.Gauge},label:"Gauge"},{value:{type:Et.h2.JSONView},label:"JSON View"},{value:{type:Et.h2.Image},label:"Image"}],Lf=L=>({fixBottomMargin:(0,x.css)({marginBottom:L.spacing(-2)})});var Al=e(5168);const Ll=L=>(!L.pluginVersion&&L.columns&&console.log("Was angular table",L),L.options),Bl={timeseries_to_rows:"seriesToRows",timeseries_to_columns:"seriesToColumns",timeseries_aggregations:"reduce",table:"merge"},Bf={avg:"mean",min:"min",max:"max",total:"sum",current:"lastNotNull",count:"count"},Rd={cell:"color-background",row:"color-background",value:"color-text"},Ad=(L,J)=>[-1/0,...L].map((ee,de)=>({color:J[de],value:(0,W.isNumber)(ee)?ee:parseInt(ee,10)})),Uf=(L,J)=>{const ee=L.transformations??[];if(Object.keys(Bl).includes(J.transform)){const de={reducers:[]};J.transform==="timeseries_aggregations"&&(de.includeTimeField=!1,de.reducers=J.columns.map(ve=>Bf[ve.value])),ee.push({id:Bl[J.transform],options:de})}return ee},Nf=L=>{const ee={matcher:{id:/^\/.*\/$/.test(L.pattern)?yr.mi.byRegexp:yr.mi.byName,options:L.pattern},properties:[]};return L.alias&&ee.properties.push({id:"displayName",value:L.alias}),L.unit&&ee.properties.push({id:"unit",value:L.unit}),L.decimals&&ee.properties.push({id:"decimals",value:L.decimals}),L.type==="date"&&ee.properties.push({id:"unit",value:`time: ${L.dateFormat}`}),L.link&&ee.properties.push({id:"links",value:[{title:(0,W.defaultTo)(L.linkTooltip,""),url:(0,W.defaultTo)(L.linkUrl,""),targetBlank:(0,W.defaultTo)(L.linkTargetBlank,!1)}]}),L.colorMode&&ee.properties.push({id:"custom.cellOptions",value:{type:Rd[L.colorMode]}}),L.align&&ee.properties.push({id:"custom.align",value:L.align==="auto"?null:L.align}),L.thresholds?.length&&ee.properties.push({id:"thresholds",value:{mode:Al.H.Absolute,steps:Ad(L.thresholds,L.colors)}}),ee},wf=L=>{let J={custom:{}};if(L){if(J=(0,W.omitBy)({unit:L.unit,decimals:L.decimals,displayName:L.alias,custom:{align:L.align==="auto"?null:L.align}},W.isNil),L.thresholds.length){const ee={mode:Al.H.Absolute,steps:Ad(L.thresholds,L.colors)};J.thresholds=ee}L.colorMode&&(J.custom.cellOptions={type:Rd[L.colorMode]})}return J},Wf=(L,J,ee)=>{if(J==="table-old"&&ee.angular){const de=ee.angular,ve=Uf(L,de),Re=de.styles.find(Xe=>Xe.pattern==="/.*/"),Fe=wf(Re),je=de.styles.filter(Xe=>Xe.pattern!=="/.*/").map(Nf);L.transformations=ve,L.fieldConfig={defaults:Fe,overrides:je}}return{}},Yo={cellHeight:Et.Ss.Sm,footer:{show:!1,countRows:!1,reducer:[]},frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]};class Ff{getSuggestionsForData(J){const ee=J.getListAppender({name:ba.y.Table,pluginId:"table",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]},cardOptions:{previewModifier:de=>{de.fieldConfig.defaults.custom.minWidth=50}}});J.dataSummary.fieldCount===0?ee.append({cardOptions:{imgSrc:"public/app/plugins/panel/table/img/icn-table-panel.svg"}}):ee.append({})}}const bo="Table footer",Ld=["Cell options"],Kf=new ne.c(vl).setPanelChangeHandler(Wf).setMigrationHandler(Ll).useFieldConfig({useCustomConfig:L=>{L.addNumberInput({path:"minWidth",name:"Minimum column width",description:"The minimum width for column auto resizing",settings:{placeholder:"150",min:50,max:500},shouldApply:()=>!0,defaultValue:Qo.minWidth}).addNumberInput({path:"width",name:"Column width",settings:{placeholder:"auto",min:20,max:300},shouldApply:()=>!0,defaultValue:Qo.width}).addRadio({path:"align",name:"Column alignment",settings:{options:[{label:"auto",value:"auto"},{label:"left",value:"left"},{label:"center",value:"center"},{label:"right",value:"right"}]},defaultValue:Qo.align}).addCustomEditor({id:"cellOptions",path:"cellOptions",name:"Cell type",editor:Id,override:Id,defaultValue:Qo.cellOptions,process:yn.kG,category:Ld,shouldApply:()=>!0}).addBooleanSwitch({path:"inspect",name:"Cell value inspect",description:"Enable cell value inspection in a modal window",defaultValue:!1,category:Ld,showIf:J=>J.cellOptions.type===Et.h2.Auto||J.cellOptions.type===Et.h2.JSONView||J.cellOptions.type===Et.h2.ColorText||J.cellOptions.type===Et.h2.ColorBackground}).addBooleanSwitch({path:"filterable",name:"Column filter",description:"Enables/disables field filters in table",defaultValue:Qo.filterable}).addBooleanSwitch({path:"hidden",name:"Hide in table",defaultValue:void 0,hideFromDefaults:!0})}}).setPanelOptions(L=>{L.addBooleanSwitch({path:"showHeader",name:"Show table header",defaultValue:Yo.showHeader}).addRadio({path:"cellHeight",name:"Cell height",defaultValue:Yo.cellHeight,settings:{options:[{value:Et.Ss.Sm,label:"Small"},{value:Et.Ss.Md,label:"Medium"},{value:Et.Ss.Lg,label:"Large"}]}}).addBooleanSwitch({path:"footer.show",category:[bo],name:"Show table footer",defaultValue:Yo.footer?.show}).addCustomEditor({id:"footer.reducer",category:[bo],path:"footer.reducer",name:"Calculation",description:"Choose a reducer function / calculation",editor:xf.S.get("stats-picker").editor,defaultValue:[Hs.gz.sum],showIf:J=>J.footer?.show}).addBooleanSwitch({path:"footer.countRows",category:[bo],name:"Count rows",description:"Display a single count for all data rows",defaultValue:Yo.footer?.countRows,showIf:J=>J.footer?.reducer?.length===1&&J.footer?.reducer[0]===Hs.gz.count}).addMultiSelect({path:"footer.fields",category:[bo],name:"Fields",description:"Select the fields that should be calculated",settings:{allowCustomValue:!1,options:[],placeholder:"All Numeric Fields",getOptions:async J=>{const ee=[];if(J&&J.data&&J.data.length>0){const de=J.data[0];for(const ve of de.fields)if(ve.type===un.fS.number){const Re=(0,hn.CZ)(ve,de,J.data),Fe=ve.name;ee.push({value:Fe,label:Re})}}return ee}},defaultValue:"",showIf:J=>J.footer?.show&&!J.footer?.countRows||J.footer?.reducer?.length===1&&J.footer?.reducer[0]!==Hs.gz.count}).addCustomEditor({id:"footer.enablePagination",path:"footer.enablePagination",name:"Enable pagination",editor:Tf})}).setSuggestionsSupplier(new Ff);var xi=e(63812),Bd=e(29956),Ud=e(18112),Ks=(L=>(L.Code="code",L.HTML="html",L.Markdown="markdown",L))(Ks||{}),Ul=(L=>(L.Go="go",L.Html="html",L.Json="json",L.Markdown="markdown",L.Plaintext="plaintext",L.Sql="sql",L.Typescript="typescript",L.Xml="xml",L.Yaml="yaml",L))(Ul||{});const jp="plaintext",Zo={language:"plaintext",showLineNumbers:!1,showMiniMap:!1},Mo={content:`# Title For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)`,mode:"markdown"};function Vf(L){const J=(0,it.wW)($f),[ee,de]=(0,R.useState)({mode:L.options.mode,content:Nd(L.options,L.replaceVariables,ke.default.disableSanitizeHtml)});if((0,Bd.Z)(()=>{const{options:ve,replaceVariables:Re}=L,Fe=Nd(ve,Re,ke.default.disableSanitizeHtml);(Fe!==ee.content||ve.mode!==ee.mode)&&de({mode:ve.mode,content:Fe})},100,[L]),ee.mode===Ks.Code){const ve=L.options.code??Zo;return R.createElement(hl.p,{key:`${ve.showLineNumbers}/${ve.showMiniMap}`,value:ee.content,language:ve.language??Zo.language,width:L.width,height:L.height,containerStyles:J.codeEditorContainer,showMiniMap:ve.showMiniMap,showLineNumbers:ve.showLineNumbers,readOnly:!0})}return R.createElement(Ye.$,{autoHeightMin:"100%"},R.createElement(xi.Z,{html:ee.content,className:J.markdown,"data-testid":"TextPanel-converted-content"}))}function Nd(L,J,ee){let{mode:de,content:ve}=L;if(!ve)return"";switch(ve=J(ve,{},L.code?.language==="json"?"json":"html"),de){case Ks.Code:break;case Ks.HTML:ee||(ve=Zi.QX.sanitizeTextPanelContent(ve));break;case Ks.Markdown:default:ve=(0,Ud.x)(ve,{noSanitize:ee})}return ve}const $f=L=>({codeEditorContainer:(0,x.css)` .monaco-editor .margin, .monaco-editor-background { background-color: ${L.colors.background.primary}; } `,markdown:(0,x.cx)("markdown-html",(0,x.css)` height: 100%; `)});var _f=e(55925),zf=e(16640);const Hf=({value:L,onChange:J,context:ee})=>{const de=(0,R.useMemo)(()=>ee.options?.mode??Ks.Markdown,[ee]),ve=(0,it.wW)(kf),Re=()=>ee.getSuggestions?ee.getSuggestions().map(Fe=>(0,zf.T)(Fe)):[];return R.createElement("div",{className:(0,x.cx)(ve.editorBox)},R.createElement(_f.Z,{disableHeight:!0},({width:Fe})=>Fe===0?null:R.createElement(hl.p,{value:L,onBlur:J,onSave:J,language:de,width:Fe,showMiniMap:!1,showLineNumbers:!1,height:"500px",getSuggestions:Re})))},kf=L=>({editorBox:(0,x.css)` label: editorBox; border: 1px solid ${L.colors.border.medium}; border-radius: ${L.shape.borderRadius(1)}; margin: ${L.spacing(.5)} 0; width: 100%; `}),Gf=L=>{const J=parseFloat(L.pluginVersion||"6.1");let ee=L.options;if(L.hasOwnProperty("content")&&L.hasOwnProperty("mode")){const ve=L,Re=ve.content,Fe=ve.mode;delete ve.content,delete ve.mode,J<7.1&&(ee={content:Re,mode:Fe})}return[Ks.Code,Ks.HTML,Ks.Markdown].find(ve=>ve===ee.mode)||(ee={...ee,mode:Ks.Markdown}),ee},jf=new ne.c(Vf).setPanelOptions(L=>{L.addRadio({path:"mode",name:"Mode",settings:{options:[{value:Ks.Markdown,label:"Markdown"},{value:Ks.HTML,label:"HTML"},{value:Ks.Code,label:"Code"}]},defaultValue:Mo.mode}).addSelect({path:"code.language",name:"Language",settings:{options:Object.values(Ul).map(J=>({value:J,label:J}))},defaultValue:Zo.language,showIf:J=>J.mode===Ks.Code}).addBooleanSwitch({path:"code.showLineNumbers",name:"Show line numbers",defaultValue:Zo.showLineNumbers,showIf:J=>J.mode===Ks.Code}).addBooleanSwitch({path:"code.showMiniMap",name:"Show mini map",defaultValue:Zo.showMiniMap,showIf:J=>J.mode===Ks.Code}).addCustomEditor({id:"content",path:"content",name:"Content",editor:Hf,defaultValue:Mo.content})}).setMigrationHandler(Gf);var Qf=e(43987),wd=e(28482),Yf=e(14544);class Zf{getSuggestionsForData(J){const{dataSummary:ee}=J;if(!ee.hasTimeField||!ee.hasNumberField||ee.rowCountTotal<2)return;const de=J.getListAppender({name:ba.y.LineChart,pluginId:"timeseries",options:{legend:{}},fieldConfig:{defaults:{custom:{}},overrides:[]},cardOptions:{previewModifier:Re=>{Re.options.legend.showLegend=!1,Re.fieldConfig?.defaults.custom?.drawStyle!==Et.l8.Bars&&(Re.fieldConfig.defaults.custom.lineWidth=Math.max(Re.fieldConfig.defaults.custom.lineWidth??1,2))}}}),ve=100;if(de.append({name:ba.y.LineChart}),ee.rowCountMax<200&&de.append({name:ba.y.LineChartSmooth,fieldConfig:{defaults:{custom:{lineInterpolation:Et.KC.Smooth}},overrides:[]}}),ee.numberFieldCount===1){de.append({name:ba.y.AreaChart,fieldConfig:{defaults:{custom:{fillOpacity:25}},overrides:[]}}),de.append({name:ba.y.LineChartGradientColorScheme,fieldConfig:{defaults:{color:{mode:an.S.ContinuousGrYlRd},custom:{gradientMode:Et.FI.Scheme,lineInterpolation:Et.KC.Smooth,lineWidth:3,fillOpacity:20}},overrides:[]}}),ee.rowCountMax<ve&&(de.append({name:ba.y.BarChart,fieldConfig:{defaults:{custom:{drawStyle:Et.l8.Bars,fillOpacity:100,lineWidth:1,gradientMode:Et.FI.Hue}},overrides:[]}}),de.append({name:ba.y.BarChartGradientColorScheme,fieldConfig:{defaults:{color:{mode:an.S.ContinuousGrYlRd},custom:{drawStyle:Et.l8.Bars,fillOpacity:90,lineWidth:1,gradientMode:Et.FI.Scheme}},overrides:[]}}));return}de.append({name:ba.y.AreaChartStacked,fieldConfig:{defaults:{custom:{fillOpacity:25,stacking:{mode:Et.o0.Normal,group:"A"}}},overrides:[]}}),de.append({name:ba.y.AreaChartStackedPercent,fieldConfig:{defaults:{custom:{fillOpacity:25,stacking:{mode:Et.o0.Percent,group:"A"}}},overrides:[]}}),ee.rowCountTotal/ee.numberFieldCount<ve&&(de.append({name:ba.y.BarChartStacked,fieldConfig:{defaults:{custom:{drawStyle:Et.l8.Bars,fillOpacity:100,lineWidth:1,gradientMode:Et.FI.Hue,stacking:{mode:Et.o0.Normal,group:"A"}}},overrides:[]}}),de.append({name:ba.y.BarChartStackedPercent,fieldConfig:{defaults:{custom:{drawStyle:Et.l8.Bars,fillOpacity:100,lineWidth:1,gradientMode:Et.FI.Hue,stacking:{mode:Et.o0.Percent,group:"A"}}},overrides:[]}}))}}function Jf(L){const J=(0,dn.h4)().getCurrent()?.getPanelById(L);if(J){const ee=J.transformations?[...J.transformations]:[];return ee.push({id:Yf.W.prepareTimeSeries,options:{format:"wide"}}),{name:"Transform to wide time series format",pluginId:"timeseries",transformations:ee}}}const Si=({data:L,timeRange:J,timeZone:ee,width:de,height:ve,options:Re,fieldConfig:Fe,onChangeTimeRange:je,replaceVariables:Xe,id:at})=>{const{sync:dt,canAddAnnotations:ut,onThresholdsChange:St,canEditThresholds:mt,showThresholds:Ot,onSplitOpen:$t}=(0,vs.R9)(),At=(fn,Yt)=>(0,Bo.a_)({field:fn,rowIndex:Yt,splitOpenFn:$t,range:J}),Wt=(0,R.useMemo)(()=>nl(L.series,ke.config.theme2,J),[L.series,J]),Jt=(0,R.useMemo)(()=>di(Re.timezone,ee),[Re.timezone,ee]),en=(0,R.useMemo)(()=>{if(Wt?.length&&Wt.every(fn=>fn.meta?.type===Qf.P.TimeSeriesLong)){const fn=Jf(at);return{message:"Long data must be converted to wide",suggestions:fn?[fn]:void 0}}},[Wt,at]);if(!Wt||en)return R.createElement(Pa.Z,{panelId:at,message:en?.message,fieldConfig:Fe,data:L,needsTimeField:!0,needsNumberField:!0,suggestions:en?.suggestions});const Qt=!!(ut&&ut());return R.createElement(li.p,{frames:Wt,structureRev:L.structureRev,timeRange:J,timeZone:Jt,width:de,height:ve,legend:Re.legend,options:Re},(fn,Yt)=>(Yt.fields.some(vn=>!!vn.config.links?.length)&&(Yt=xc(Yt,Wt,Xe,ee)),R.createElement(R.Fragment,null,R.createElement(wd.C,{config:fn}),R.createElement(ao.R,{config:fn,onZoom:je}),Re.tooltip.mode===Et.f3.None||R.createElement(si.i,{frames:Wt,data:Yt,config:fn,mode:Re.tooltip.mode,sortOrder:Re.tooltip.sort,sync:dt,timeZone:ee}),L.annotations&&R.createElement(Ji,{annotations:L.annotations,config:fn,timeZone:ee}),Qt?R.createElement(Uo,{data:Yt,timeZone:ee,config:fn},({startAnnotating:vn})=>R.createElement(wo,{data:Yt,config:fn,timeZone:ee,replaceVariables:Xe,defaultItems:[{items:[{label:"Add annotation",ariaLabel:"Add annotation",icon:"comment-alt",onClick:(In,Mn)=>{Mn&&vn({coords:Mn.coords})}}]}]})):R.createElement(wo,{data:Yt,frames:Wt,config:fn,timeZone:ee,replaceVariables:Xe,defaultItems:[]}),L.annotations&&R.createElement(La,{visibleSeries:Cn(fn,Wt),config:fn,exemplars:L.annotations,timeZone:ee,getFieldLinks:At}),(mt&&St||Ot)&&R.createElement(tl,{config:fn,fieldConfig:Fe,onThresholdsChange:mt?St:void 0}),R.createElement(Fo,{config:fn,onChangeTimeRange:je}))))};var Wd=e(80369),vp=e(15672);const Xf=({value:L,onChange:J})=>{const ee=(0,it.wW)(qf);(!L||L.length<1)&&(L=[""]);const de=()=>{J([...L,Wd.RQ.default])},ve=Fe=>{const je=L.slice();je.splice(Fe,1),J(je)},Re=(Fe,je)=>{const Xe=L.slice();Xe[Fe]=je??Wd.RQ.default,Xe.length===0||Xe.length===1&&Xe[0]===""?J(void 0):J(Xe)};return R.createElement("div",null,L.map((Fe,je)=>R.createElement("div",{className:ee.wrapper,key:`${je}.${Fe}`},R.createElement("span",{className:ee.first},R.createElement(vp.O,{onChange:Xe=>Re(je,Xe),includeInternal:!0,value:Fe??Wd.RQ.default})),je===L.length-1?R.createElement(so.h,{name:"plus",onClick:de,tooltip:"Add timezone"}):R.createElement(so.h,{name:"times",onClick:()=>ve(je),tooltip:"Remove timezone"}))))},qf=L=>({wrapper:(0,x.css)` width: 100%; display: flex; flex-direction: rows; align-items: center; `,first:(0,x.css)` margin-right: 8px; flex-grow: 2; `});var eg=e(89050);let Nl=null;const tg=(L,J,ee,de)=>{if(J==="graph"&&ee.angular){const{fieldConfig:ve,options:Re,annotations:Fe}=wl({...ee.angular,fieldConfig:de,panel:L}),je=(0,dn.h4)().getCurrent();return je&&Fe?.length>0&&(je.annotations.list=[...je.annotations.list,...Fe],Nl==null&&(Nl=setTimeout(()=>{Nl=null,(0,Sc.$t)().refreshTimeModel()}))),L.fieldConfig=ve,L.alert=ee.angular.alert,Re}return rg(L),{}};function wl(L){let J=[];const ee=L.fieldConfig?.overrides??[],de=L.yaxes??[];let ve=ng(de[0]);L.fieldConfig?.defaults&&(ve={...L.fieldConfig?.defaults,...ve});const Re={fill:L.dashes?"dash":"solid",dash:[L.dashLength??10,L.spaceLength??10]};if(L.aliasColors)for(const ut of Object.keys(L.aliasColors)){const St=L.aliasColors[ut];St&&ee.push({matcher:{id:yr.mi.byName,options:ut},properties:[{id:Kt.qb.Color,value:{mode:an.S.Fixed,fixedColor:St}}]})}let Fe=!1;if(L.seriesOverrides?.length)for(const ut of L.seriesOverrides){if(!ut.alias)continue;const mt={matcher:{id:/^([/~@;%#'])(.*?)\1([gimsuy]*)$/.test(ut.alias)?yr.mi.byRegexp:yr.mi.byName,options:ut.alias},properties:[]};let Ot;for(const $t of Object.keys(ut)){const At=ut[$t];switch($t){case"alias":case"$$hashKey":break;case"yaxis":if(At===2){const Wt=ng(de[1]);ag(ve,Wt,mt.properties)}break;case"fill":mt.properties.push({id:"custom.fillOpacity",value:At*10});break;case"fillBelowTo":Fe=!0,mt.properties.push({id:"custom.fillBelowTo",value:At});break;case"fillGradient":At&&(mt.properties.push({id:"custom.fillGradient",value:"opacity"}),mt.properties.push({id:"custom.fillOpacity",value:At*10}));break;case"points":mt.properties.push({id:"custom.showPoints",value:At?Et.Jp.Always:Et.Jp.Never});break;case"bars":At?(mt.properties.push({id:"custom.drawStyle",value:Et.l8.Bars}),mt.properties.push({id:"custom.fillOpacity",value:100})):mt.properties.push({id:"custom.drawStyle",value:Et.l8.Line});break;case"lines":mt.properties.push({id:"custom.lineWidth",value:0});break;case"linewidth":mt.properties.push({id:"custom.lineWidth",value:At});break;case"pointradius":mt.properties.push({id:"custom.pointSize",value:2+At*2});break;case"dashLength":case"spaceLength":case"dashes":switch(Ot||(Ot={fill:Re.fill,dash:[...Re.dash]}),$t){case"dashLength":Ot.dash[0]=At;break;case"spaceLength":Ot.dash[1]=At;break;case"dashes":Ot.fill=At?"dash":"solid";break}break;case"stack":mt.properties.push({id:"custom.stacking",value:Xo(At)});break;case"color":mt.properties.push({id:"color",value:{fixedColor:At,mode:an.S.Fixed}});break;case"transform":mt.properties.push({id:"custom.transform",value:At==="negative-Y"?Et.pR.NegativeY:Et.pR.Constant});break;default:console.log("Ignore override migration:",ut.alias,$t,At)}}Ot&&mt.properties.push({id:"custom.lineStyle",value:Ot}),mt.properties.length&&ee.push(mt)}const je=ve.custom??{};je.drawStyle=L.bars?Et.l8.Bars:L.lines?Et.l8.Line:Et.l8.Points,L.points?(je.showPoints=Et.Jp.Always,(0,W.isNumber)(L.pointradius)&&(je.pointSize=2+L.pointradius*2)):je.drawStyle!==Et.l8.Points&&(je.showPoints=Et.Jp.Never),je.lineWidth=L.linewidth,Re.fill!=="solid"&&(je.lineStyle=Re),Fe?je.fillOpacity=35:(0,W.isNumber)(L.fill)&&(je.fillOpacity=L.fill*10),(0,W.isNumber)(L.fillGradient)&&L.fillGradient>0&&(je.gradientMode=Et.FI.Opacity,je.fillOpacity=L.fillGradient*10),je.spanNulls=L.nullPointMode===qc.Gl.Ignore,L.steppedLine&&(je.lineInterpolation=Et.KC.StepAfter),je.drawStyle===Et.l8.Bars&&(je.fillOpacity=100),L.stack&&(je.stacking={mode:Et.o0.Normal,group:Ir.r.stacking.group}),ve.custom=(0,W.omitBy)(je,W.isNil),ve.nullValueMode=L.nullPointMode;const Xe={legend:{displayMode:Et.jK.List,showLegend:!0,placement:"bottom",calcs:[]},tooltip:{mode:Et.f3.Single,sort:Et.As.None}},at=L.legend;if(at){if(at.show?Xe.legend.displayMode=at.alignAsTable?Et.jK.Table:Et.jK.List:Xe.legend.showLegend=!1,at.rightSide&&(Xe.legend.placement="right"),L.legend.values){const ut=(0,W.pickBy)(L.legend);Xe.legend.calcs=sg(ut)}L.legend.sideWidth&&(Xe.legend.width=L.legend.sideWidth),at.hideZero&&ee.push(og(Hs.gz.allIsZero)),at.hideEmpty&&ee.push(og(Hs.gz.allIsNull))}L.timeRegions?.length&&L.timeRegions.map((St,mt)=>({name:`T${mt+1}`,color:St.colorMode!=="custom"?St.colorMode:St.fillColor,line:St.line,fill:St.fill,fromDayOfWeek:St.fromDayOfWeek,toDayOfWeek:St.toDayOfWeek,from:St.from,to:St.to})).forEach((St,mt)=>{const Ot={datasource:{type:"datasource",uid:"grafana"},enable:!0,hide:!0,filter:{exclude:!1,ids:[L.panel.id]},iconColor:St.fillColor??St.color,name:`T${mt+1}`,target:{queryType:eg.hR.TimeRegions,refId:"Anno",timeRegion:{fromDayOfWeek:St.fromDayOfWeek,toDayOfWeek:St.toDayOfWeek,from:St.from,to:St.to,timezone:"utc"}}};St.fill?J.push(Ot):St.line&&(Ot.iconColor=St.lineColor??"white",J.push(Ot))});const dt=L.tooltip;if(dt&&(dt.shared!==void 0&&(Xe.tooltip.mode=dt.shared?Et.f3.Multi:Et.f3.Single),dt.sort!==void 0&&dt.shared))switch(dt.sort){case 1:Xe.tooltip.sort=Et.As.Ascending;break;case 2:Xe.tooltip.sort=Et.As.Descending;break;default:Xe.tooltip.sort=Et.As.None}if(L.thresholds&&L.thresholds.length>0){let ut=[],St=!1,mt=!1;const Ot=L.thresholds.sort((At,Wt)=>At.value>Wt.value?1:-1);for(let At=0;At<Ot.length;At++){const Wt=Ot[At],Jt=Ot.length>At+1?Ot[At+1]:null;Wt.fill&&(St=!0),Wt.line&&(mt=!0),Wt.op==="gt"&&ut.push({value:Wt.value,color:Jo(Wt)}),Wt.op==="lt"&&(ut.length===0&&ut.push({value:-1/0,color:Jo(Wt)}),Jt&&Jt.op==="gt"&&Jt.value>Wt.value?ut.push({value:Wt.value,color:"transparent"}):Jt&&Jt.op==="lt"?ut.push({value:Wt.value,color:Jo(Jt)}):ut.push({value:Wt.value,color:"transparent"}))}ut.length>0&&ut[0].value!==-1/0&&ut.unshift({color:"transparent",value:-1/0});let $t=St?Et.i3.Area:Et.i3.Line;mt&&St&&($t=Et.i3.LineAndArea),ve.custom.thresholdsStyle={mode:$t},ve.thresholds={mode:Al.H.Absolute,steps:ut}}return L.xaxis&&L.xaxis.show===!1&&L.xaxis.mode==="time"&&ee.push({matcher:{id:yr.mi.byType,options:un.fS.time},properties:[{id:"custom.axisPlacement",value:Et.LB.Hidden}]}),{fieldConfig:{defaults:(0,W.omitBy)(ve,W.isNil),overrides:ee},options:Xe,annotations:J}}function Jo(L){return L.colorMode==="critical"?"red":L.colorMode==="warning"?"orange":L.colorMode==="custom"?L.fillColor||L.lineColor:"red"}function ng(L){if(!L)return{};const J={axisPlacement:L.show?Et.LB.Auto:Et.LB.Hidden};if(L.label&&(J.axisLabel=L.label),L.logBase){const ee=L.logBase;(ee===2||ee===10)&&(J.scaleDistribution={type:Et.wf.Log,log:ee})}return(0,W.omitBy)({unit:L.format,decimals:Wl(L.decimals),min:Wl(L.min),max:Wl(L.max),custom:J},W.isNil)}function ag(L,J,ee){for(const Re of Object.keys(J)){const Fe=J[Re];Re!=="custom"&&Fe!==L[Re]&&ee.push({id:Re,value:Fe})}const de=L.custom??{},ve=J.custom??{};for(const Re of Object.keys(ve)){const Fe=ve[Re];Fe!==de[Re]&&ee.push({id:`custom.${Re}`,value:Fe})}}function Wl(L){if((0,W.isNumber)(L))return L;if((0,W.isString)(L)){const J=Number(L);if(!isNaN(J))return J}}function sg(L){const J=[];for(const ee of Object.keys(L)){const de=Hs.TB.getIfExists(ee);de&&J.push(de.id)}return J}function rg(L){L.fieldConfig?.defaults?.custom?.hideFrom?.graph!==void 0&&(L.fieldConfig.defaults.custom.hideFrom.viz=L.fieldConfig.defaults.custom.hideFrom.graph,delete L.fieldConfig.defaults.custom.hideFrom.graph),L.fieldConfig?.overrides&&(L.fieldConfig.overrides=L.fieldConfig.overrides.map(J=>(J.properties=J.properties.map(ee=>(ee.id==="custom.hideFrom"&&ee.value.graph&&(ee.value.viz=ee.value.graph,delete ee.value.graph),ee)),J)))}function og(L){return{matcher:{id:yr.mi.byValue,options:{reducer:L,op:Et.Bd.GTE,value:0}},properties:[{id:"custom.hideFrom",value:{tooltip:!0,viz:!1,legend:!0}}]}}function Xo(L){const J=Ir.r.stacking?.group;return{mode:L?Et.o0.Normal:Et.o0.None,group:(0,W.isString)(L)?L:J}}const ig=new ne.c(Si).setPanelChangeHandler(tg).useFieldConfig((0,Ir.F)(Ir.r)).setPanelOptions(L=>{Cs.L(L),rs.J(L),L.addCustomEditor({id:"timezone",name:"Time zone",path:"timezone",category:["Axis"],editor:Xf,defaultValue:void 0})}).setSuggestionsSupplier(new Zf).setDataSupport({annotations:!0,alertStates:!0});var lg=e(10864),cg=e(67066),dg=e(62227),ug=e(12361);const Fl={wrapper:(0,x.css)` height: 100%; overflow: scroll; `},mg=({data:L})=>{const J=(0,R.createRef)(),ee=(0,R.useMemo)(()=>(0,ug.N)(L.series[0]),[L.series]),de=(0,yt.Z)(async()=>await(0,lg.F)().get(L.request?.targets[0].datasource?.uid));return!L||!L.series.length||!ee?R.createElement("div",{className:"panel-empty"},R.createElement("p",null,"No data found in response")):R.createElement("div",{className:Fl.wrapper},R.createElement("div",{ref:J}),R.createElement(cg.m,{dataFrames:L.series,scrollElementClass:Fl.wrapper,traceProp:ee,queryResponse:L,datasource:de.value,topOfViewRef:J,topOfViewRefType:dg.l4.Panel}))},Kl=new ne.c(mg);var fg=e(76178);const Fd=({data:L,timeRange:J,timeZone:ee,width:de,height:ve,options:Re,fieldConfig:Fe,replaceVariables:je,id:Xe})=>{const{sync:at}=(0,vs.R9)(),dt=Re.xField??L.series[0].fields.find(mt=>mt.type===un.fS.number)?.name,ut=(mt,Ot,$t)=>(Ot={...Ot,x:fg.Ls.get(yr.mi.byName).get(dt)},(0,qi.Rn)(mt,Ot)),St=(0,R.useMemo)(()=>{if(L.series.length>1)return{warning:"Only one frame is supported, consider adding a join transformation",frames:L.series};let mt=L.series,Ot;if(Re.xField){if(Ot=(0,tr.findFieldIndex)(mt[0],Re.xField),Ot==null)return{warning:"Unable to find field: "+Re.xField,frames:L.series}}else if(Ot=mt[0].fields.findIndex($t=>$t.type===un.fS.number),Ot===-1)return{warning:"No numeric fields found for X axis",frames:mt};if(Ot!=null){const $t=mt[0].fields[Ot];if($t.type===un.fS.number&&!(0,Oo.lP)($t.values))return{warning:"Values must be in ascending order",frames:mt}}return{frames:nl(mt,Ke.config.theme2,void 0,Ot)}},[L.series,Re.xField]);return St.warning||!St.frames?R.createElement(Pa.Z,{panelId:Xe,fieldConfig:Fe,data:L,message:St.warning,needsNumberField:!0}):R.createElement(li.p,{frames:St.frames,structureRev:L.structureRev,timeRange:J,timeZone:ee,width:de,height:ve,legend:Re.legend,options:Re,preparePlotFrame:ut},(mt,Ot)=>(Ot.fields.some($t=>!!$t.config.links?.length)&&(Ot=xc(Ot,St.frames,je,ee)),R.createElement(R.Fragment,null,R.createElement(wd.C,{config:mt}),Re.tooltip.mode===Et.f3.None||R.createElement(si.i,{frames:St.frames,data:Ot,config:mt,mode:Re.tooltip.mode,sortOrder:Re.tooltip.sort,sync:at,timeZone:ee}),R.createElement(wo,{data:Ot,frames:St.frames,config:mt,timeZone:ee,replaceVariables:je,defaultItems:[]}))))};class gg{getSuggestionsForData(J){const{dataSummary:ee}=J;return ee.numberFieldCount<2||ee.rowCountTotal<2||ee.rowCountTotal<2?void 0:J.getListAppender({name:ba.y.LineChart,pluginId:"trend",options:{legend:{}},fieldConfig:{defaults:{custom:{}},overrides:[]},cardOptions:{previewModifier:ve=>{ve.options.legend.showLegend=!1,ve.fieldConfig?.defaults.custom?.drawStyle!==Et.l8.Bars&&(ve.fieldConfig.defaults.custom.lineWidth=Math.max(ve.fieldConfig.defaults.custom.lineWidth??1,2))}}})}}const pg=new ne.c(Fd).useFieldConfig((0,Ir.F)(Ir.r,!1)).setPanelOptions(L=>{const J=["X Axis"];L.addFieldNamePicker({path:"xField",name:"X Field",description:"An increasing numeric value",category:J,defaultValue:void 0,settings:{isClearable:!0,placeholderText:"First numeric value",filter:ee=>ee.type===un.fS.number}}),Cs.L(L),rs.J(L)}).setSuggestionsSupplier(new gg),Kd=[{value:0,label:"Documentation",href:"https://grafana.com/docs/grafana/latest"},{value:1,label:"Tutorials",href:"https://grafana.com/tutorials"},{value:2,label:"Community",href:"https://community.grafana.com"},{value:3,label:"Public Slack",href:"http://slack.grafana.com"}],Ti=()=>{const L=(0,it.wW)(hg);return R.createElement("div",{className:L.container},R.createElement("h1",{className:L.title},"Welcome to Grafana"),R.createElement("div",{className:L.help},R.createElement("h3",{className:L.helpText},"Need help?"),R.createElement("div",{className:L.helpLinks},Kd.map((J,ee)=>R.createElement("a",{key:`${J.label}-${ee}`,className:L.helpLink,href:`${J.href}?utm_source=grafana_gettingstarted`},J.label)))))},hg=L=>({container:(0,x.css)` display: flex; /// background: url(public/img/g8_home_v2.svg) no-repeat; background-size: cover; height: 100%; align-items: center; padding: 0 16px; justify-content: space-between; padding: 0 ${L.spacing(3)}; ${L.breakpoints.down("lg")} { background-position: 0px; flex-direction: column; align-items: flex-start; justify-content: center; } ${L.breakpoints.down("sm")} { padding: 0 ${L.spacing(1)}; } `,title:(0,x.css)` margin-bottom: 0; ${L.breakpoints.down("lg")} { margin-bottom: ${L.spacing(1)}; } ${L.breakpoints.down("md")} { font-size: ${L.typography.h2.fontSize}; } ${L.breakpoints.down("sm")} { font-size: ${L.typography.h3.fontSize}; } `,help:(0,x.css)` display: flex; align-items: baseline; `,helpText:(0,x.css)` margin-right: ${L.spacing(2)}; margin-bottom: 0; ${L.breakpoints.down("md")} { font-size: ${L.typography.h4.fontSize}; } ${L.breakpoints.down("sm")} { display: none; } `,helpLinks:(0,x.css)` display: flex; flex-wrap: wrap; `,helpLink:(0,x.css)` margin-right: ${L.spacing(2)}; text-decoration: underline; text-wrap: no-wrap; ${L.breakpoints.down("sm")} { margin-right: 8px; } `}),vg=new ne.c(Ti).setNoPadding();var Ep=(L=>(L[L.NoData=0]="NoData",L[L.BadFrameSelection=1]="BadFrameSelection",L[L.XNotFound=2]="XNotFound",L))(Ep||{});function Oi(L){return L.type===un.fS.number}function Eg(L,J){if(!J||!J.length)return{error:0};L||(L={frame:0});let ee=J[L.frame??0];if(!ee)return{error:1};let de=-1;for(let je=0;je<ee.fields.length;je++){const Xe=ee.fields[je];if(L.x&&L.x===(0,hn.CZ)(Xe,ee,J)){de=je;break}if(Oi(Xe)&&!L.x){de=je;break}}let ve=!1;const Re=ee.fields[de],Fe=[Re];for(const je of ee.fields)if(je.type===un.fS.time&&(ve=!0),!(je===Re||!Oi(je))){if(L.exclude){const Xe=(0,hn.CZ)(je,ee,J);if(L.exclude.includes(Xe))continue}Fe.push(je)}return{x:Re,fields:{x:ys(Re),y:yp(Re)},frame:{...ee,fields:Fe},hasData:ee.fields.length>0,hasTime:ve}}function ys(L){return L?J=>L===J||!!(L.state&&L.state===J.state):()=>!1}function yp(L){if(!L)return()=>!1;const J=ys(L);return ee=>!J(ee,void 0,void 0)}const Pp=({value:L,onChange:J,context:ee})=>{const de=(0,R.useMemo)(()=>ee?.data?.length?ee.data.map((je,Xe)=>({value:Xe,label:(0,hn.nf)(je,Xe)})):[{value:0,label:"First result"}],[ee.data]),ve=(0,R.useMemo)(()=>Eg(L,ee.data),[ee.data,L]),Re=(0,R.useMemo)(()=>{const je={label:"?",value:void 0},Xe={numberFields:[je],yFields:[],xAxis:L?.x?{label:`${L.x} (Not found)`,value:L.x}:je},at=ee.data?ee.data[L?.frame??0]:void 0;if(at){const dt=ve.x?(0,hn.CZ)(ve.x,ve.frame,ee.data):void 0;for(let ut of at.fields)if(Oi(ut)){const St=(0,hn.CZ)(ut,at,ee.data),mt={label:St,value:St};Xe.numberFields.push(mt),je.label==="?"&&(je.label=`${St} (First)`),L?.x&&St===L.x&&(Xe.xAxis=mt),dt!==St&&Xe.yFields.push({label:St,value:L?.exclude?.includes(St)})}}return Xe},[ve,ee.data,L]),Fe=(0,it.wW)(Vd);return ee.data?R.createElement("div",null,R.createElement(qa.g,{label:"Data"},R.createElement(Be.Ph,{options:de,value:de.find(je=>je.value===L?.frame)??de[0],onChange:je=>{J({...L,frame:je.value})}})),R.createElement(qa.g,{label:"X Field"},R.createElement(Be.Ph,{options:Re.numberFields,value:Re.xAxis,onChange:je=>{J({...L,x:je.value})}})),R.createElement(qa.g,{label:"Y Fields"},R.createElement("div",null,Re.yFields.map(je=>R.createElement("div",{key:je.label,className:Fe.row},R.createElement(so.h,{name:je.value?"eye-slash":"eye",onClick:()=>{const Xe=L?.exclude?[...L.exclude]:[];let at=Xe.indexOf(je.label);at<0?Xe.push(je.label):Xe.splice(at,1),J({...L,exclude:Xe})},tooltip:je.value?"Disable":"Enable"}),je.label))))):R.createElement("div",null,"No data...")},Vd=L=>({sorter:(0,x.css)` margin-top: 10px; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; cursor: pointer; `,row:(0,x.css)` padding: ${L.spacing(.5,1)}; border-radius: ${L.shape.borderRadius(1)}; background: ${L.colors.background.secondary}; min-height: ${L.spacing(4)}; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; margin-bottom: 3px; border: 1px solid ${L.components.input.borderColor}; `});var $d=e(84270),_d=e(78276),Vl=(L=>(L.Auto="auto",L.Manual="manual",L))(Vl||{}),Dr=(L=>(L.Lines="lines",L.Points="points",L.PointsAndLines="points+lines",L))(Dr||{});const Dp={exclude:[]},$l={label:Et.Jp.Auto,show:"points"},Cp={series:[]},yg=({value:L,onChange:J,context:ee})=>{const[de,ve]=(0,R.useState)(0),Re=(0,it.wW)(Pg),Fe=(dt,ut,St)=>{J(L.map((mt,Ot)=>Ot===ut?{...mt,[St]:dt}:mt))},je=()=>{J([...L,{pointColor:{},pointSize:$l.pointSize}]),ve(L.length)};(0,R.useEffect)(()=>{L?.length||je()},[]);const Xe=dt=>{J(L.filter((ut,St)=>St!==dt))},at=dt=>dt===de?`${Re.row} ${Re.sel}`:Re.row;return R.createElement(R.Fragment,null,R.createElement(me.zx,{icon:"plus",size:"sm",variant:"secondary",onClick:je,className:Re.marginBot},"Add series"),R.createElement("div",{className:Re.marginBot},L.map((dt,ut)=>R.createElement("div",{key:`series/${ut}`,className:at(ut),onMouseDown:()=>ve(ut)},R.createElement($d.X,{name:dt.name??`Series ${ut+1}`,onChange:St=>Fe(St,ut,"name")}),R.createElement(so.h,{name:"trash-alt",title:"remove",className:(0,x.cx)(Re.actionIcon),onClick:()=>Xe(ut),tooltip:"Delete series"})))),de>=0&&L[de]&&R.createElement(R.Fragment,null,R.createElement("div",{key:`series/${de}`},R.createElement(qa.g,{label:"X Field"},R.createElement(Cl.b,{value:L[de].x??"",context:ee,onChange:dt=>Fe(dt,de,"x"),item:{}})),R.createElement(qa.g,{label:"Y Field"},R.createElement(Cl.b,{value:L[de].y??"",context:ee,onChange:dt=>Fe(dt,de,"y"),item:{}})),R.createElement(qa.g,{label:"Point color"},R.createElement(_d.Lm,{value:L[de].pointColor,context:ee,onChange:dt=>Fe(dt,de,"pointColor"),item:{}})),R.createElement(qa.g,{label:"Point size"},R.createElement(_d.cL,{value:L[de].pointSize,context:ee,onChange:dt=>Fe(dt,de,"pointSize"),item:{settings:{min:1,max:100}}})))))},Pg=L=>({marginBot:(0,x.css)` margin-bottom: 20px; `,row:(0,x.css)` padding: ${L.spacing(.5,1)}; border-radius: ${L.shape.borderRadius(1)}; background: ${L.colors.background.secondary}; min-height: ${L.spacing(4)}; display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; cursor: pointer; border: 1px solid ${L.components.input.borderColor}; &:hover { border: 1px solid ${L.components.input.borderHover}; } `,sel:(0,x.css)` border: 1px solid ${L.colors.primary.border}; &:hover { border: 1px solid ${L.colors.primary.border}; } `,actionIcon:(0,x.css)` color: ${L.colors.text.secondary}; &:hover { color: ${L.colors.text}; } `});var zd=e(24077);const Hd=({allSeries:L,data:J,manualSeriesConfigs:ee,seriesMapping:de,rowIndex:ve,hoveredPointIndex:Re,options:Fe})=>{const je=(0,it.wW)(Dg);if(!L||ve==null)return null;const Xe=L[Re],at=Xe.frame(J),dt=Xe.x(at),ut=Xe.y(at);let St;if(ut.getLinks){const At=ut.values[ve],Wt=ut.display?ut.display(At):{text:`${At}`,numeric:+At};St=ut.getLinks({calculatedValue:Wt,valueRowIndex:ve}).map(Jt=>(Jt.title||(Jt.title=(0,Bo.Rb)(Jt.href)),Jt))}let mt=at.fields.filter(At=>At!==dt&&At!==ut),Ot=null,$t=null;if(de===Vl.Manual&&ee){const At=ee[Re]?.pointColor?.field??"",Wt=ee[Re]?.pointSize?.field??"",Jt=At?(0,tr.findField)(at,At):void 0,en=Wt?(0,tr.findField)(at,Wt):void 0;$t={colorFacetFieldName:At,sizeFacetFieldName:Wt,colorFacetValue:Jt?.values[ve],sizeFacetValue:en?.values[ve]},mt=mt.filter(Qt=>Qt!==Jt&&Qt!==en)}return Ot={name:(0,hn.CZ)(ut,at),val:ut.values[ve],field:ut,color:Xe.pointColor(at)},R.createElement(R.Fragment,null,R.createElement("table",{className:je.infoWrap},R.createElement("tr",null,R.createElement("th",{colSpan:2,style:{backgroundColor:Ot.color}})),R.createElement("tbody",null,R.createElement("tr",null,R.createElement("th",null,(0,hn.CZ)(dt,at)),R.createElement("td",null,_l(dt,dt.values[ve]))),R.createElement("tr",null,R.createElement("th",null,Ot.name,":"),R.createElement("td",null,_l(Ot.field,Ot.val))),$t!==null&&$t.colorFacetFieldName&&R.createElement("tr",null,R.createElement("th",null,$t.colorFacetFieldName,":"),R.createElement("td",null,$t.colorFacetValue)),$t!==null&&$t.sizeFacetFieldName&&R.createElement("tr",null,R.createElement("th",null,$t.sizeFacetFieldName,":"),R.createElement("td",null,$t.sizeFacetValue)),mt.map((At,Wt)=>R.createElement("tr",{key:Wt},R.createElement("th",null,(0,hn.CZ)(At,at),":"),R.createElement("td",null,_l(At,At.values[ve])))),St&&St.length>0&&R.createElement("tr",null,R.createElement("td",{colSpan:2},R.createElement(Er.wc,null,St.map((At,Wt)=>R.createElement(me.Qj,{key:Wt,icon:"external-link-alt",target:At.target,href:At.href,onClick:At.onClick,fill:"text",style:{width:"100%"}},At.title))))))))};function _l(L,J){return L.display?(0,Ws.zc)(L.display(J)):`${J}`}const Dg=L=>({infoWrap:(0,x.css)` padding: 8px; width: 100%; th { font-weight: ${L.typography.fontWeightMedium}; padding: ${L.spacing(.25,2)}; } `,highlight:(0,x.css)` background: ${L.colors.action.hover}; `,xVal:(0,x.css)` font-weight: ${L.typography.fontWeightBold}; `,icon:(0,x.css)` margin-right: ${L.spacing(1)}; vertical-align: middle; `});var Ii=e(25236);const kd=5;function Cg(L){return{standardOptions:{[Kt.qb.Min]:{hideFromDefaults:!0},[Kt.qb.Max]:{hideFromDefaults:!0},[Kt.qb.Unit]:{hideFromDefaults:!0},[Kt.qb.Decimals]:{hideFromDefaults:!0},[Kt.qb.NoValue]:{hideFromDefaults:!0},[Kt.qb.DisplayName]:{hideFromDefaults:!0},[Kt.qb.Thresholds]:{hideFromDefaults:!0},[Kt.qb.Mappings]:{hideFromDefaults:!0},[Kt.qb.Color]:{settings:{byValueSupport:!0,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:an.S.PaletteClassic}}},useCustomConfig:J=>{J.addRadio({path:"show",name:"Show",defaultValue:L.show,settings:{options:[{label:"Points",value:Dr.Points},{label:"Lines",value:Dr.Lines},{label:"Both",value:Dr.PointsAndLines}]}}).addSliderInput({path:"pointSize.fixed",name:"Point size",defaultValue:L.pointSize?.fixed??kd,settings:{min:1,max:100,step:1},showIf:ee=>ee.show!==Dr.Lines}).addCustomEditor({id:"lineStyle",path:"lineStyle",name:"Line style",showIf:ee=>ee.show!==Dr.Points,editor:Ii.j,override:Ii.j,process:yn.kG,shouldApply:ee=>ee.type===un.fS.number}).addSliderInput({path:"lineWidth",name:"Line width",defaultValue:L.lineWidth,settings:{min:0,max:10,step:1},showIf:ee=>ee.show!==Dr.Points}),da.r(J,L),Ga.B(J)}}}function bg(L,J,ee,de,ve,Re){let Fe,je;try{Fe=Mg(L,J()),je=xg(J,Fe,ee,de,ve,Re)}catch(Xe){let at="Unknown error in prepScatter";return typeof Xe=="string"?at=Xe:Xe instanceof Error&&(at=Xe.message),{error:at,series:[]}}return{series:Fe,builder:je}}function Gd(L,J,ee,de,ve,Re){const Fe=J[ee],je=Fe.fields[ve];let Xe=je.state??{};Xe.seriesIndex=L,je.state=Xe;let at=Re.pointColorFixed?Ke.config.theme2.visualization.getColorByName(Re.pointColorFixed):(0,eo.YO)(je,Ke.config.theme2).color,dt=()=>at;const ut={...$l,...je.config.custom};let St=eo.WO.get(an.S.PaletteClassic);if(Re.pointColorIndex){const Wt=J[ee].fields[Re.pointColorIndex];if(Wt)if(St=(0,eo.fD)(je),St.isByValue){const Jt=Re.pointColorIndex;dt=en=>{const Qt=en.fields[Jt];return Qt.state?.range&&(Qt.state.range=void 0),Qt.display=(0,js.U)({field:Qt,theme:Ke.config.theme2}),Qt.values.map(fn=>Qt.display(fn).color)}}else at=St.getCalculator(Wt,Ke.config.theme2)(Wt.values[0],1),dt=()=>at}let mt=Re.pointSizeConfig,Ot=Re.pointSizeConfig?.fixed??je.config.custom?.pointSize?.fixed??kd,$t=()=>Ot;Re.pointSizeIndex?$t=Wt=>{const Jt=(0,tr.getScaledDimensionForField)(Wt.fields[Re.pointSizeIndex],Re.pointSizeConfig,Et.B5.Quad),en=Array(Wt.length);for(let Qt=0;Qt<Wt.length;Qt++)en[Qt]=Jt.get(Qt);return en}:mt={fixed:Ot,min:Ot,max:Ot};const At=(0,hn.CZ)(je,Fe,J);return{name:At,frame:Wt=>Wt[ee],x:Wt=>Wt.fields[de],y:Wt=>Wt.fields[ve],legend:()=>[{label:At,color:at,getItemKey:()=>At,yAxis:ve}],showLine:ut.show!==Dr.Points,lineWidth:ut.lineWidth??2,lineStyle:ut.lineStyle,lineColor:()=>at,showPoints:ut.show!==Dr.Lines?Et.Jp.Always:Et.Jp.Never,pointSize:$t,pointColor:dt,pointSymbol:(Wt,Jt)=>"circle",label:Et.Jp.Never,labelValue:()=>"",show:!Fe.fields[ve].config.custom.hideFrom?.viz,hints:{pointSize:mt,pointColor:{mode:St}}}}function Mg(L,J){let ee=0;if(!J.length)throw"Missing data";if(L.seriesMapping==="manual"){if(!L.series?.length)throw"Missing series config";const Xe=[];for(const at of L.series){if(!at?.x)throw"Select X dimension";if(!at?.y)throw"Select Y dimension";for(let dt=0;dt<J.length;dt++){const ut=J[dt],St=(0,tr.findFieldIndex)(ut,at.x);if(St!=null){const mt=(0,tr.findFieldIndex)(ut,at.y);if(mt==null)throw"Y must be in the same frame as X";const Ot={pointColorFixed:at.pointColor?.fixed,pointColorIndex:(0,tr.findFieldIndex)(ut,at.pointColor?.field),pointSizeConfig:at.pointSize,pointSizeIndex:(0,tr.findFieldIndex)(ut,at.pointSize?.field)};Xe.push(Gd(ee++,J,dt,St,mt,Ot))}}}return Xe}const de=L.dims??{},ve=de.frame??0,Re=J[ve],Fe=[];let je=(0,tr.findFieldIndex)(Re,de.x);for(let Xe=0;Xe<Re.fields.length;Xe++)if(Oi(Re.fields[Xe])){if(je==null||Xe===je){je=Xe;continue}if(de.exclude&&de.exclude.includes((0,hn.CZ)(Re.fields[Xe],Re,J)))continue;Fe.push(Xe)}if(je==null)throw"Missing X dimension";if(!Fe.length)throw"No Y values";return Fe.map(Xe=>Gd(ee++,J,ve,je,Xe,{}))}const xg=(L,J,ee,de,ve,Re)=>{let Fe,je;function Xe(Qt){return(Yt,vn,In,Mn)=>(Gs.Z.orient(Yt,vn,(Rn,$n,wn,ra,Gn,Sn,Xn,la,Fa,za,Ka,Ha,Zn,Wn,Yn)=>{const ta=Gs.Z.pxRatio,ga=J[vn-1];let fa=Yt.data[vn],Na=ga.showLine,pa=ga.showPoints===Et.Jp.Always;!pa&&ga.showPoints===Et.Jp.Auto&&(pa=fa[0].length<1e3),!pa&&!Na&&(Na=!0);let On=1;Yt.ctx.save(),Yt.ctx.rect(Yt.bbox.left,Yt.bbox.top,Yt.bbox.width,Yt.bbox.height),Yt.ctx.clip(),Yt.ctx.fillStyle=Rn.fill(),Yt.ctx.strokeStyle=Rn.stroke(),Yt.ctx.lineWidth=On;let Nn=2*Math.PI,Fn=ra.key,qn=Gn.key,ea=ga.hints.pointSize;const ha=ga.hints.pointColor.mode.isByValue;let ua=(ea.max??ea.fixed)*ta,cs=Yt.posToVal(-ua/2,Fn),ds=Yt.posToVal(Yt.bbox.width/ta+ua/2,Fn),ar=Yt.posToVal(Yt.bbox.height/ta+ua/2,qn),Ls=Yt.posToVal(-ua/2,qn),Nr=Qt.disp.size.values(Yt,vn),Yr=Qt.disp.color.values(Yt,vn),mo=Qt.disp.color.alpha,Js=Na?new Path2D:null,ir=null;for(let Ns=0;Ns<fa[0].length;Ns++){let ts=fa[0][Ns],wr=fa[1][Ns],gr=Nr[Ns]*ta;if(ts>=cs&&ts<=ds&&wr>=ar&&wr<=Ls){let Ni=Sn(ts,ra,za,la),wi=Xn(wr,Gn,Ka,Fa);Na&&Js.lineTo(Ni,wi),pa&&(Yt.ctx.moveTo(Ni+gr/2,wi),Yt.ctx.beginPath(),Yt.ctx.arc(Ni,wi,gr/2,0,Nn),ha&&Yr[Ns]!==ir&&(ir=Yr[Ns],Yt.ctx.fillStyle=(0,go.alpha)(ir,mo),Yt.ctx.strokeStyle=ir),Yt.ctx.fill(),Yt.ctx.stroke(),Qt.each(Yt,vn,Ns,Ni-gr/2-On/2,wi-gr/2-On/2,gr+On,gr+On))}}if(Na){let Ns=ga.frame(L());Yt.ctx.strokeStyle=ga.lineColor(Ns),Yt.ctx.lineWidth=ga.lineWidth*ta;const{lineStyle:ts}=ga;ts&&ts.fill!=="solid"&&(ts.fill==="dot"&&(Yt.ctx.lineCap="round"),Yt.ctx.setLineDash(ts.dash??[10,10])),Yt.ctx.stroke(Js)}Yt.ctx.restore()}),null)}let at=Xe({disp:{size:{values:(Qt,fn)=>Qt.data[fn][2]},color:{values:(Qt,fn)=>Qt.data[fn][3],alpha:.5}},each:(Qt,fn,Yt,vn,In,Mn,Rn)=>{vn-=Qt.bbox.left,In-=Qt.bbox.top,Fe.add({x:vn,y:In,w:Mn,h:Rn,sidx:fn,didx:Yt})}});const dt=new $i.U;dt.setCursor({drag:{setScale:!0},dataIdx:(Qt,fn)=>{if(fn===1){const Yt=Gs.Z.pxRatio;je=null;let vn=1/0,In=Qt.cursor.left*Yt,Mn=Qt.cursor.top*Yt;Fe.get(In,Mn,1,1,Rn=>{if((0,no.Pn)(In,Mn,Rn.x,Rn.y,Rn.x+Rn.w,Rn.y+Rn.h)){let $n=Rn.x+Rn.w/2,wn=Rn.y+Rn.h/2,ra=$n-In,Gn=wn-Mn,Sn=Math.sqrt(ra**2+Gn**2);Sn<=Rn.w/2&&Sn<=vn&&(vn=Sn,je=Rn)}})}return je&&fn===je.sidx?je.didx:null},points:{size:(Qt,fn)=>je&&fn===je.sidx?je.w/Gs.Z.pxRatio:0,fill:(Qt,fn)=>"rgba(255,255,255,0.4)"}});const ut=()=>{Re.current&&(de(void 0),ve&&ve())};let St=null;dt.addHook("init",(Qt,fn)=>{Qt.over.style.overflow="hidden",St=Qt.root.parentElement,ve&&St?.addEventListener("click",ve)}),dt.addHook("destroy",Qt=>{ve&&(St?.removeEventListener("click",ve),ut())});let mt;dt.addHook("syncRect",(Qt,fn)=>{mt=fn}),dt.addHook("setLegend",Qt=>{if(Qt.cursor.idxs!=null)for(let fn=0;fn<Qt.cursor.idxs.length;fn++){const Yt=Qt.cursor.idxs[fn];if(Yt!=null&&!Re.current){de({scatterIndex:fn-1,xIndex:Yt,pageX:mt.left+Qt.cursor.left,pageY:mt.top+Qt.cursor.top});return}}Re.current||de(void 0)}),dt.addHook("drawClear",Qt=>{ut(),Fe=Fe||new no.lW(0,0,Qt.bbox.width,Qt.bbox.height),Fe.clear(),Qt.series.forEach((fn,Yt)=>{Yt>0&&(fn._paths=null)})}),dt.setMode(2);const Ot=L();let $t=J[0].x(J[0].frame(Ot)),At=$t.config,Wt=At.custom,Jt=Wt?.scaleDistribution;dt.addScale({scaleKey:"x",isTime:!1,orientation:Et.wN.Horizontal,direction:Et.bQ.Right,distribution:Jt?.type,log:Jt?.log,linearThreshold:Jt?.linearThreshold,min:At.min,max:At.max,softMin:Wt?.axisSoftMin,softMax:Wt?.axisSoftMax,centeredZero:Wt?.axisCenteredZero,decimals:At.decimals});let en=Wt.axisLabel;return dt.addAxis({scaleKey:"x",placement:Wt?.axisPlacement!==Et.LB.Hidden?Et.LB.Bottom:Et.LB.Hidden,show:Wt?.axisPlacement!==Et.LB.Hidden,theme:ee,label:en==null||en===""?(0,hn.CZ)($t,J[0].frame(Ot),Ot):en,formatValue:(Qt,fn)=>(0,Ws.zc)($t.display(Qt,fn))}),J.forEach((Qt,fn)=>{let Yt=Qt.frame(Ot),vn=Qt.y(Yt);const In=Qt.lineColor(Yt),Mn=Sg(Yt,Qt.pointColor);let Rn=vn.config.unit??"y",$n=vn.config,wn=$n.custom,ra=wn?.scaleDistribution;if(dt.addScale({scaleKey:Rn,orientation:Et.wN.Vertical,direction:Et.bQ.Up,distribution:ra?.type,log:ra?.log,linearThreshold:ra?.linearThreshold,min:$n.min,max:$n.max,softMin:wn?.axisSoftMin,softMax:wn?.axisSoftMax,centeredZero:wn?.axisCenteredZero,decimals:$n.decimals}),wn?.axisPlacement!==Et.LB.Hidden){let Gn=wn?.axisLabel;dt.addAxis({scaleKey:Rn,theme:ee,placement:wn?.axisPlacement,label:Gn==null||Gn===""?(0,hn.CZ)(vn,J[fn].frame(Ot),Ot):Gn,formatValue:(Sn,Xn)=>(0,Ws.zc)(vn.display(Sn,Xn))})}dt.addSeries({facets:[{scale:"x",auto:!0},{scale:Rn,auto:!0}],pathBuilder:at,theme:ee,scaleKey:"",lineColor:In,fillColor:(0,go.alpha)(Mn,.5),show:!wn.hideFrom?.viz})}),dt};function jd(L,J,ee){return L.error||!J.length?[null]:[null,...L.series.map((de,ve)=>{const Re=de.frame(J);let Fe;const je=de.pointColor(Re);return Array.isArray(je)?Fe=je:Fe=Array(Re.length).fill(je),[de.x(Re).values,de.y(Re).values,Qd(Re,de.pointSize),Fe]})]}function Qd(L,J){const ee=J(L);return Array.isArray(ee)?ee:Array(L.length).fill(ee)}function Sg(L,J){const ee=J(L);return Array.isArray(ee)?ee[0]:ee}const Yd=10,Tg=L=>{const[J,ee]=(0,R.useState)(),[de,ve]=(0,R.useState)([]),[Re,Fe]=(0,R.useState)(),[je,Xe]=(0,R.useState)(),[at,dt]=(0,R.useState)(),[ut,St]=(0,R.useState)(!1),mt=(0,R.useRef)(!1),Ot=(0,zd.Z)(L.options),$t=(0,zd.Z)(L.data),At=()=>{mt.current=!1,St(!1),Jt(void 0)},Wt=()=>{mt.current=!mt.current,St(mt.current)},Jt=Yt=>{dt(Yt)},en=(0,R.useCallback)(()=>{const Yt=()=>L.data.series,vn=bg(L.options,Yt,Ke.config.theme2,Jt,Wt,mt);vn.error?ee(vn.error):vn.series.length&&L.data.series&&(Fe(vn.builder),ve(vn.series),Xe(()=>jd(vn,L.data.series)),ee(void 0))},[L.data.series,L.options]),Qt=(0,R.useCallback)(()=>{Xe(()=>jd({error:J,series:de},L.data.series))},[L.data.series,J,de]);(0,R.useEffect)(()=>{Ot!==L.options||$t?.structureRev!==L.data.structureRev?en():$t?.series!==L.data.series&&Qt()},[L]);const fn=()=>{const Yt=[],vn=Rn=>Rn==null?"-":Rn.toFixed(1),In=Ke.config.theme2;for(let Rn=0;Rn<de.length;Rn++){const $n=de[Rn],wn=$n.frame(L.data.series);if(wn)for(const ra of $n.legend())ra.getDisplayValues=()=>{const Gn=L.options.legend.calcs;if(!Gn?.length)return[];const Sn=$n.y(wn),Xn=Sn.display??vn;let la=null;const Fa=(0,Hs.Kx)({field:Sn,reducers:Gn});return Gn.map(za=>{const Ka=Hs.TB.get(za);let Ha=Xn;return Ka.id===Hs.gz.diffperc&&(Ha=(0,js.U)({field:{...Sn,config:{...Sn.config,unit:"percent"}},theme:In})),(Ka.id===Hs.gz.count||Ka.id===Hs.gz.changeCount||Ka.id===Hs.gz.distinctCount)&&(la||(la=(0,js.U)({field:{...Sn,config:{...Sn.config,unit:"none"}},theme:In})),Ha=la),{...Ha(Fa[za]),title:Ka.name,description:Ka.description}})},ra.disabled=!($n.show??!0),L.options.seriesMapping===Vl.Manual&&(ra.label=L.options.series?.[Rn]?.name??`Series ${Rn+1}`),Yt.push(ra)}if(!L.options.legend.showLegend)return null;const Mn={flexStart:(0,x.css)` div { justify-content: flex-start !important; } `};return R.createElement(is.AY.Legend,{placement:L.options.legend.placement,width:L.options.legend.width},R.createElement($s.l,{className:Mn.flexStart,placement:L.options.legend.placement,items:Yt,displayMode:L.options.legend.displayMode}))};return J||!Re||!je?R.createElement("div",{className:"panel-empty"},R.createElement("p",null,J)):R.createElement(R.Fragment,null,R.createElement(is.AY,{width:L.width,height:L.height,legend:fn()},(Yt,vn)=>R.createElement(kc.N,{config:Re,data:je,width:Yt,height:vn})),R.createElement(vr.h_,null,at&&L.options.tooltip.mode!==Et.f3.None&&R.createElement(qr.S,{position:{x:at.pageX,y:at.pageY},offset:{x:Yd,y:Yd},allowPointerEvents:mt.current},ut&&R.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},R.createElement(Vr.P,{onClick:At,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),R.createElement(Hd,{options:L.options.tooltip,allSeries:de,manualSeriesConfigs:L.options.series,seriesMapping:L.options.seriesMapping,rowIndex:at.xIndex,hoveredPointIndex:at.scatterIndex,data:L.data.series}))))},Og=new ne.c(Tg).useFieldConfig(Cg($l)).setPanelOptions(L=>{L.addRadio({path:"seriesMapping",name:"Series mapping",defaultValue:"auto",settings:{options:[{value:"auto",label:"Auto",description:"No changes to saved model since 8.0"},{value:"manual",label:"Manual"}]}}).addCustomEditor({id:"xyPlotConfig",path:"dims",name:"",editor:Pp,showIf:J=>J.seriesMapping==="auto"}).addCustomEditor({id:"series",path:"series",name:"",defaultValue:[],editor:yg,showIf:J=>J.seriesMapping==="manual"}),Cs.L(L),rs.J(L)}),Ng={"app/plugins/datasource/graphite/module":async()=>await e.e(7494).then(e.bind(e,23621)),"app/plugins/datasource/cloudwatch/module":async()=>await Promise.all([e.e(7357),e.e(8831)]).then(e.bind(e,17357)),"app/plugins/datasource/dashboard/module":async()=>await e.e(7348).then(e.bind(e,97348)),"app/plugins/datasource/elasticsearch/module":async()=>await Promise.all([e.e(2787),e.e(9897)]).then(e.bind(e,2787)),"app/plugins/datasource/opentsdb/module":async()=>await e.e(3168).then(e.bind(e,37684)),"app/plugins/datasource/grafana/module":async()=>await e.e(7537).then(e.bind(e,24794)),"app/plugins/datasource/influxdb/module":async()=>await e.e(5783).then(e.bind(e,15622)),"app/plugins/datasource/loki/module":async()=>await Promise.all([e.e(3565),e.e(5305),e.e(760),e.e(1598)]).then(e.bind(e,50760)),"app/plugins/datasource/jaeger/module":async()=>await e.e(890).then(e.bind(e,9203)),"app/plugins/datasource/zipkin/module":async()=>await e.e(4023).then(e.bind(e,48561)),"app/plugins/datasource/mixed/module":async()=>await e.e(2001).then(e.bind(e,11138)),"app/plugins/datasource/mysql/module":async()=>await Promise.all([e.e(5216),e.e(4251)]).then(e.bind(e,98534)),"app/plugins/datasource/postgres/module":async()=>await Promise.all([e.e(5216),e.e(534)]).then(e.bind(e,79634)),"app/plugins/datasource/mssql/module":async()=>await Promise.all([e.e(5216),e.e(5032)]).then(e.bind(e,52709)),"app/plugins/datasource/prometheus/module":async()=>await Promise.all([e.e(5305),e.e(7004)]).then(e.bind(e,8842)),"app/plugins/datasource/testdata/module":async()=>await e.e(319).then(e.bind(e,34750)),"app/plugins/datasource/cloud-monitoring/module":async()=>await Promise.all([e.e(8695),e.e(3549)]).then(e.bind(e,26943)),"app/plugins/datasource/azuremonitor/module":async()=>await Promise.all([e.e(1109),e.e(2340),e.e(2364)]).then(e.bind(e,62340)),"app/plugins/datasource/tempo/module":async()=>await Promise.all([e.e(7963),e.e(295)]).then(e.bind(e,7963)),"app/plugins/datasource/alertmanager/module":async()=>await Promise.all([e.e(1109),e.e(6795)]).then(e.bind(e,8654)),"app/plugins/datasource/grafana-pyroscope-datasource/module":async()=>await e.e(8693).then(e.bind(e,86105)),"app/plugins/datasource/parca/module":async()=>await e.e(2015).then(e.bind(e,48170)),"app/plugins/panel/text/module":C,"app/plugins/panel/timeseries/module":P,"app/plugins/panel/trend/module":M,"app/plugins/panel/state-timeline/module":v,"app/plugins/panel/status-history/module":D,"app/plugins/panel/candlestick/module":g,"app/plugins/panel/graph/module":async()=>await Promise.all([e.e(1189),e.e(1260)]).then(e.bind(e,1648)),"app/plugins/panel/xychart/module":S,"app/plugins/panel/geomap/module":async()=>await Promise.all([e.e(2421),e.e(8096)]).then(e.bind(e,41670)),"app/plugins/panel/canvas/module":async()=>await Promise.all([e.e(7307),e.e(3330)]).then(e.bind(e,22294)),"app/plugins/panel/dashlist/module":d,"app/plugins/panel/alertlist/module":n,"app/plugins/panel/annolist/module":i,"app/plugins/panel/heatmap/module":async()=>await e.e(6987).then(e.bind(e,50738)),"app/plugins/panel/table/module":a,"app/plugins/panel/table-old/module":async()=>await e.e(6784).then(e.bind(e,84332)),"app/plugins/panel/news/module":E,"app/plugins/panel/live/module":p,"app/plugins/panel/stat/module":Ef,"app/plugins/panel/datagrid/module":l,"app/plugins/panel/debug/module":u,"app/plugins/panel/flamegraph/module":o,"app/plugins/panel/gettingstarted/module":m,"app/plugins/panel/gauge/module":dl,"app/plugins/panel/piechart/module":y,"app/plugins/panel/bargauge/module":r,"app/plugins/panel/barchart/module":s,"app/plugins/panel/logs/module":f,"app/plugins/panel/traces/module":b,"app/plugins/panel/welcome/module":T,"app/plugins/panel/nodeGraph/module":h,"app/plugins/panel/histogram/module":c,"app/plugins/panel/alertGroups/module":t},qo="plugin-cdn",zl=new Map([]);var wg=e(55403),Wg=e(67821);function Hl(L){const ee=new URL(L).pathname.split("/");return{id:ee[3],version:ee[4]}}function kl({pluginId:L,version:J,source:ee}){const de=`${Ke.config.pluginsCDNBaseURL}/${L}/${J}`;let ve=ee;return ve=ee.replace(/(\/?)(public\/plugins)/g,`${de}/$2`),ve=ve.replace(/(["|'])(plugins\/.+?.css)(["|'])/g,`$1${de}/public/$2$3`),ve=ve.replace(/(\/\/#\ssourceMappingURL=)(.+)\.map/g,`$1${de}/public/plugins/${L}/$2.map`),ve}function Gl(L){const J=L.split(`/public/${qo}/`);return`${Ke.config.pluginsCDNBaseURL}/${J[1]}`}function Xd(L){const J=new URL(window.location.href),ee=new URL(L);return J.host===ee.host}async function Fg(L,J,ee){let de="";if(Xd(L))de=await(await fetch(L)).text(),de=eu(J,de);else if(L.includes(qo)){de=await(await fetch(L)).text();const Re=Gl(`/public/${J.module}`)+".js",{version:Fe}=Hl(Re);de=kl({pluginId:J.id,version:Fe,source:de})}if(de.length===0)throw new Error("Only same domain scripts are allowed in sandboxed plugins");ee.evaluate(de)}async function qd(L){if(L.module.includes(`${qo}/`)){const J=Gl(`/public/${L.module}`)+".js";let de=await(await fetch(J)).text();const{version:ve}=Hl(J);return de=kl({pluginId:L.id,version:ve,source:de}),de}else{let ee=await(await fetch("public/"+L.module+".js")).text();return ee=eu(L,ee),ee}}function eu(L,J){if(J.includes("//# sourceMappingURL=module.js.map")){let ee="";(!J.includes("//# sourceURL")||!J.includes("//@ sourceUrl"))&&(ee+=`//# sourceURL=module.js `);const de=`/public/${L.module}.js.map`;return ee+=`//# sourceMappingURL=${de}`,J.replace("//# sourceMappingURL=module.js.map",ee)}return J}const Ur=["iframe"];var tu=e(91106);const As=!!Ke.config.featureToggles.frontendSandboxMonitorOnly;function as(L){return!!L&&typeof L=="object"&&L?.hasOwnProperty("plugin")}function nu(L){throw new Error(`Unexpected object: ${L}. This should never happen.`)}function au(L){return L instanceof R.Component}function Cr(L,J){J={...J,source:"sandbox",monitorOnly:String(As)},(0,tu.KE)(L,J)}function xo(L,J){J={...J,source:"sandbox",monitorOnly:String(As)},(0,tu.H)(L,J)}const fr=new Map,br=!!Ke.config.featureToggles.frontendSandboxMonitorOnly;function Kg(){return fr.size===0&&(Vg(fr),su(fr),os(fr),$g(fr),So(fr),gs(fr),Wa(fr),_g(fr),zg(fr)),fr}function Li(L,J){return Cr(`Plugin ${J.id} tried to set a sandboxed property`,{pluginId:J.id,attrOrMethod:String(L),entity:"window"}),br?L:()=>{throw new Error("Plugins are not allowed to set sandboxed properties")}}function Vg(L){const J=["contentDocument","contentWindow","src","srcdoc","srcObject","srcset"];for(const de of J){const ve=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,de);if(ve){let Re=function(Fe,je){const Xe=je.id;return Cr(`Plugin ${Xe} tried to access iframe.${de}`,{pluginId:Xe,attrOrMethod:de,entity:"iframe"}),br?Fe:()=>{throw new Error("iframe."+de+" is not allowed in sandboxed plugins")}};var ee=Re;ve.value&&L.set(ve.value,Re),ve.set&&L.set(ve.set,Re),ve.get&&L.set(ve.get,Re)}}}function su(L){const J=Object.getOwnPropertyDescriptor(window,"console");if(J?.value){let de=function(ve,Re){const Fe=Re.id;if(br)return ve;function je(...Xe){console.log(`[plugin ${Fe}]`,...Xe)}return{log:je,warn:je,error:je,info:je,debug:je,table:je}};var ee=de;L.set(J.value,de)}J?.set&&L.set(J.set,Li)}function os(L){function J(de,ve){const Re=ve.id;return Cr(`Plugin ${Re} accessed window.alert`,{pluginId:Re,attrOrMethod:"alert",entity:"window"}),br?de:function(...Fe){console.log(`[plugin ${Re}]`,...Fe)}}const ee=Object.getOwnPropertyDescriptor(window,"alert");ee?.value&&L.set(ee.value,J),ee?.set&&L.set(ee.set,Li)}function gs(L){function J(de,ve){const Re=ve.id;return function(...je){for(const Xe of je){const at=Xe?.toLowerCase()||"";for(const dt of Ur)if(at.includes("<"+dt)){if(Cr(`Plugin ${Re} tried to set ${dt} in innerHTML`,{pluginId:Re,attrOrMethod:"innerHTML",param:dt,entity:"HTMLElement"}),br)continue;throw new Error("<"+dt+"> is not allowed in sandboxed plugins")}}(0,W.isFunction)(de)&&de.apply(this,je)}}const ee=[Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML"),Object.getOwnPropertyDescriptor(Element.prototype,"outerHTML"),Object.getOwnPropertyDescriptor(Element.prototype,"insertAdjacentHTML"),Object.getOwnPropertyDescriptor(DOMParser.prototype,"parseFromString")];for(const de of ee)de?.set&&L.set(de.set,J),de?.value&&L.set(de.value,J)}function Wa(L){function J(de,ve){const Re=ve.id;return function(je,Xe){if(je&&Ur.includes(je)&&(Cr(`Plugin ${Re} tried to create ${je}`,{pluginId:Re,attrOrMethod:"createElement",param:je,entity:"document"}),!br))return document.createDocumentFragment();if((0,W.isFunction)(de))return de.apply(this,[je,Xe])}}const ee=Object.getOwnPropertyDescriptor(Document.prototype,"createElement");ee?.value&&L.set(ee.value,J)}function So(L){function J(Re,Fe){const je=Fe.id;return function(at,dt){const ut=at?.nodeName?.toLowerCase()||"";if(at&&Ur.includes(ut)&&(Cr(`Plugin ${je} tried to insert ${ut}`,{pluginId:je,attrOrMethod:"insertChild",param:ut,entity:"HTMLElement"}),!br))return document.createDocumentFragment();if((0,W.isFunction)(Re))return Re.call(this,at,dt)}}function ee(Re,Fe){const je=Fe.id;return function(at,dt){const ut=dt?.nodeName?.toLowerCase()||"";if(dt&&Ur.includes(ut)&&(Cr(`Plugin ${je} tried to insert ${ut}`,{pluginId:je,attrOrMethod:"insertAdjacentElement",param:ut,entity:"HTMLElement"}),!br))return document.createDocumentFragment();if((0,W.isFunction)(Re))return Re.call(this,at,dt)}}const de=[Object.getOwnPropertyDescriptor(Node.prototype,"insertBefore"),Object.getOwnPropertyDescriptor(Node.prototype,"replaceChild")];for(const Re of de)Re?.value&&L.set(Re.set,J);const ve=Object.getOwnPropertyDescriptor(Element.prototype,"insertAdjacentElement");ve?.value&&L.set(ve.set,ee)}function $g(L){function J(Re,Fe){const je=Fe.id;return function(...at){let dt=at;const ut=at?.filter(St=>!Ur.includes(St.nodeName.toLowerCase()));br||(dt=ut),dt.length!==ut.length&&Cr(`Plugin ${je} tried to append fobiddenElements`,{pluginId:je,attrOrMethod:"append",param:at?.filter(St=>Ur.includes(St.nodeName.toLowerCase()))?.join(",")||"",entity:"HTMLElement"}),(0,W.isFunction)(Re)&&Re.apply(this,dt)}}function ee(Re,Fe,je){const Xe=Fe.id;return function(dt){const ut=dt?.nodeName?.toLowerCase()||"";if(dt&&Ur.includes(ut)&&(Cr(`Plugin ${Xe} tried to append ${ut}`,{pluginId:Xe,attrOrMethod:"appendChild",param:ut,entity:"HTMLElement"}),!br))return document.createDocumentFragment();if(je&&dt&&ut==="script"&&dt instanceof HTMLScriptElement){Fg(dt.src,Fe,je).then(()=>{dt.onload?.call(dt,new Event("load"))}).catch(St=>{dt.onerror?.call(dt,new ErrorEvent("error",{error:St}))});return}if((0,W.isFunction)(Re))return Re.call(this,dt)}}const de=[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 Re of de)Re?.value&&L.set(Re.value,J);const ve=Object.getOwnPropertyDescriptor(Node.prototype,"appendChild");ve?.value&&L.set(ve.value,ee)}function _g(L){const J=Object.getOwnPropertyDescriptor(Worker.prototype,"postMessage");function ee(de){return function(...Re){try{const Fe=(0,W.cloneDeep)(Re);(0,W.isFunction)(de)&&de.apply(this,Fe)}catch{throw new Error("postMessage arguments are invalid objects")}}}J?.value&&L.set(J.value,ee)}function zg(L){const J=Object.getOwnPropertyDescriptor(Document.prototype,"defaultView");J?.get&&L.set(J.get,()=>()=>window);const ee=["write"];for(const de of ee){const ve=Object.getOwnPropertyDescriptor(Document.prototype,de);ve?.set&&L.set(ve.set,Li),ve?.value&&L.set(ve.value,Li)}}var Hg=e(99723);const To=Symbol.for("@@SANDBOX_LIVE_VALUE"),ru=!!Ke.config.featureToggles.frontendSandboxMonitorOnly;function kg(L,J){const ee=Reflect.get(L,"nodeName");if(ee==="body"||L===document.body)return document.body;if(ee==="head"||L===document.head||L===document.documentElement)return L;if(Ur.includes(ee)&&(Cr("<"+ee+"> is not allowed in sandboxed plugins",{pluginId:J,param:ee}),!ru))throw new Error("<"+ee+"> is not allowed in sandboxed plugins");if(Bi(L,J)||L.parentNode===document.body||L.closest("#reactRoot")===null||ru)return L;{const de=document.createElement(ee);return de.dataset.grafanaPluginSandboxElement="true",de}}function Gg(L){if(typeof L=="object"&&L instanceof Element)try{return L.nodeName!==void 0}catch{return!1}return!1}function jg(L){const J=Reflect.get(L,"style");Object.hasOwn(J,To)||Reflect.defineProperty(J,To,{})}function Qg(L){L&&!Object.hasOwn(L,To)&&(0,Hg.qD)(L)&&!(L instanceof Function)&&(au(L)||L instanceof ge.MF)&&Reflect.defineProperty(L,To,{})}function Yg(L){return Object.hasOwn(L,To)}function Bi(L,J){return!document.contains(L)||L.closest(`[data-plugin-sandbox=${J}]`)!==null}let or;function Wp(){return or||(or=document.createElement("div"),or.setAttribute("id","grafana-plugin-sandbox-body"),or.setAttribute("data-plugin-sandbox","true"),or.dataset.pluginSandbox="sandboxed-plugin",or.style.width="100%",or.style.height="0%",or.style.overflow="hidden",or.style.top="0",or.style.left="0",document.body.appendChild(or)),or}var Zg=e(9232);async function Jg(L,J){if(!as(L))return L;const ee=await Promise.resolve(L.plugin);if(Reflect.has(ee,"panel")&&Reflect.set(ee,"panel",ei(Reflect.get(ee,"panel"),J)),Reflect.has(ee,"components")){const de=Reflect.get(ee,"components");Object.entries(de).forEach(([ve,Re])=>{Reflect.set(de,ve,ei(Re,J))}),Reflect.set(ee,"components",de)}if(Reflect.has(ee,"root")&&Reflect.set(ee,"root",ei(Reflect.get(ee,"root"),J)),Reflect.has(ee,"extensionConfigs")){const de=Reflect.get(ee,"extensionConfigs");for(const ve of de)Reflect.has(ve,"component")&&Reflect.set(ve,"component",ei(Reflect.get(ve,"component"),J));Reflect.set(ee,"extensionConfigs",de)}if(Reflect.has(ee,"configPages")){const de=Reflect.get(ee,"configPages");for(const[ve,Re]of Object.entries(de))!Re.body||!(0,W.isFunction)(Re.body)||Reflect.set(de,ve,{...Re,body:ei(Re.body,J)});Reflect.set(ee,"configPages",de)}return L}const ei=(L,J)=>{const ee=R.memo(de=>R.createElement("div",{"data-plugin-sandbox":J.id,style:{height:J.type===Zg.zV.app?"100%":"auto"}},R.createElement(L,{...de})));return ee.displayName=`GrafanaSandbox(${L.displayName||L.name||"Component"})`,ee},jl=new Map;async function ti({pluginId:L}){try{const J=await(0,Wg.a)(L);return jl.has(L)||jl.set(L,Xg(J)),jl.get(L)}catch(J){const ee=new Error(`Could not import plugin ${L} inside sandbox: `+J);throw xo(ee,{pluginId:L,error:String(J)}),ee}}async function Xg(L){return new Promise(async(J,ee)=>{const de=Kg();let ve;function Re(je){if(Gg(je)){const at=kg(je,L.id);return jg(at),at}else Qg(je);const Xe=de.get(je);return Xe?Xe(je,L,ve):je}ve=(0,wg.Z)(window,{distortionCallback:Re,liveTargetCallback:Yg,endowments:Object.getOwnPropertyDescriptors({async define(je,Xe,at){let dt,ut;Array.isArray(je)?(dt=je,ut=Xe):(dt=Xe,ut=at);try{const St=qg(dt),mt=ut.apply(null,St),Ot=await Jg(mt,L);J(Ot)}catch(St){const mt=new Error(`Could not execute plugin's define ${L.id}: `+St);xo(mt,{pluginId:L.id,error:String(St)}),ee(mt)}}}),instrumentation:{startActivity(){return{stop:()=>{},error:ou(L.id)}},log:()=>{},error:()=>{}}});let Fe="";try{Fe=await qd(L)}catch(je){throw new Error(`Could not load plugin ${L.id}: `+je)}try{ve.evaluate(Fe)}catch(je){const Xe=new Error(`Could not run plugin ${L.id} inside sandbox: `+je);xo(Xe,{pluginId:L.id,error:String(je)}),ee(Xe)}})}function ou(L){return async function(ee){if(!ee)return;ee.sandboxError=!0;const de=new Error(ee.message.toString());de.name=ee.name.toString(),de.stack=ee.stack||"",console.log(`[sandbox] Error from plugin ${L}`),console.error(de)}}function qg(L){const J=[];for(const ee of L){const de=zl.get(ee);if(!de)throw new Error(`[sandbox] Could not resolve dependency ${ee}`);J.push(de)}return J}function Ql(L){const{address:J}=L;return Gl(J)}function ep(L){const{id:J,version:ee}=Hl(L.name);return kl({pluginId:J,version:ee,source:L.source})}function tp(L){return L.metadata.loader==="cdn-loader"&&L.address.startsWith(`${location.origin}/public/plugin-cdn`)&&(L.address=L.address.replace(`${location.origin}/public/plugin-cdn`,Ke.config.pluginsCDNBaseURL)),L.address}function Qr(L){const J=document.getElementsByTagName("link");return Array.from(J).map(de=>de.href).includes(L.address)?"":iu(L.address)}const np="?_cache="+Date.now(),ap=100;function iu(L){return new Promise(function(J,ee){const de=setTimeout(function(){ee("Unable to load CSS")},ap*1e3),ve=function(Fe){clearTimeout(de),Re.onload=Re.onerror=W.noop,setTimeout(function(){Fe?ee(Fe):J("")},7)},Re=document.createElement("link");Re.type="text/css",Re.rel="stylesheet",Re.href=L,Re.href.startsWith(Ke.config.pluginsCDNBaseURL)||(Re.href=Re.href+np),Re.onload=function(){ve()},Re.onerror=function(Fe){ve(Fe instanceof ErrorEvent?Fe.message:new Error("Error loading CSS file."))},document.head.appendChild(Re)})}var lu=e(43799),sp=e(89377),Fp=e(4027),cu=e(59554),Kp=e(65103),Vp=e(85095),rp=e(28844),uo=e(26189),Mr=e(47825),$p=e(7540);const ni=ce;ni.PanelPlugin=ne.c,ni.DataSourcePlugin=ge.hf,ni.AppPlugin=ae.k8,ni.DataSourceApi=ge.MF,he.i3.registry.set("css",he.i3.newModule({locate:tp,fetch:Qr})),he.i3.registry.set("plugin-loader",he.i3.newModule({locate:lu.hf})),he.i3.registry.set("cdn-loader",he.i3.newModule({locate:Ql,translate:ep})),he.i3.config({baseURL:"public",defaultExtension:"js",packages:{plugins:{defaultExtension:"js"},"plugin-cdn":{defaultExtension:"js"}},map:{text:"vendor/plugin-text/text.js"},meta:{"/*":{esModule:!0,authorization:!0,loader:"plugin-loader"},"*.css":{loader:"css"},[`${qo}/*`]:{esModule:!0,authorization:!1,loader:"cdn-loader"}}});function Ma(L,J){he.i3.registerDynamic(L,[],!0,(ee,de,ve)=>{ve.exports=J}),zl.set(L,J)}Ma("@grafana/data",re),Ma("@grafana/ui",ni),Ma("@grafana/runtime",ye),Ma("lodash",w()),Ma("moment",F()),Ma("jquery",V()),Ma("d3",B),Ma("rxjs",se),Ma("rxjs/operators",Z),Ma("react-router",X),Ma("react-router-dom",Y),Ma("prismjs",H()),Ma("slate",le.ZP),Ma("slate-react",q.ZP),Ma("@grafana/slate-react",q.ZP),Ma("slate-plain-serializer",oe.Z),Ma("react",R),Ma("react-dom",_),Ma("react-redux",G),Ma("redux",Q),Ma("emotion",x),Ma("@emotion/css",x),Ma("@emotion/react",O),Ma("app/features/dashboard/impression_store",{impressions:_e.Z,__esModule:!0}),Ma("app/core/services/backend_srv",{BackendSrv:we.y$,getBackendSrv:we.i}),Ma("app/core/utils/datemath",De),Ma("app/core/utils/flatten",qe),Ma("app/core/utils/kbn",st.Z),Ma("app/core/utils/ticks",Me),Ma("app/core/config",ke.default),Ma("app/core/time_series",Ge.Z),Ma("app/core/time_series2",Ge.Z),Ma("app/core/table_model",We.Z),Ma("app/core/app_events",et.h$),Ma("app/core/core",{appEvents:et.h$,contextSrv:et.Vt,__esModule:!0});const Ui=["jquery.flot","jquery.flot.pie","jquery.flot.time","jquery.flot.fillbelow","jquery.flot.crosshair","jquery.flot.stack","jquery.flot.selection","jquery.flot.stackpercent","jquery.flot.events","jquery.flot.gauge"];for(const L of Ui)Ma(L,{fakeDep:1});async function Yl({path:L,version:J,isAngular:ee,pluginId:de}){J&&(0,lu.Vf)({path:L,version:J});const ve=Ng[L];return ve?typeof ve=="function"?await ve():ve:Zl({isAngular:ee,pluginId:de})?ti({pluginId:de}):he.i3.import(L)}function Zl({isAngular:L,pluginId:J}){const ee=location.search.includes("nosandbox")&&ke.default.buildInfo.env==="development",de=ke.default.disableFrontendSandboxForPlugins.includes(J);return!L&&!!ke.default.featureToggles.pluginsFrontendSandbox&&!0&&!de&&!ee}function op(L){return Yl({path:L.module,version:L.info?.version,isAngular:L.angularDetected,pluginId:L.id}).then(J=>{if(J.plugin){const ee=J.plugin;return ee.meta=L,ee}if(J.Datasource){const ee=new ge.hf(J.Datasource);return ee.setComponentsFromLegacyExports(J),ee.meta=L,ee}throw new Error("Plugin module is missing DataSourcePlugin or Datasource constructor export")})}function ip(L){return Yl({path:L.module,version:L.info?.version,isAngular:L.angularDetected,pluginId:L.id}).then(J=>{const ee=J.plugin?J.plugin:new ae.k8;return ee.init(L),ee.meta=L,ee.setComponentsFromLegacyExports(J),ee})}},43799:(j,I,e)=>{"use strict";e.d(I,{Hl:()=>r,Vf:()=>s,hf:()=>g});var t=e(67821);const n={},i=Date.now();function s({path:l,version:u}){n[l]||(n[l]=encodeURI(u))}function r(l){const u=`plugins/${l}/module`;n[u]&&delete n[u],(0,t.Z)(l)}function g(l,u=i){const{address:o}=l,m=d(o);if(!m)return`${o}?_cache=${u}`;const p=n[m]||u;return`${o}?_cache=${p}`}function d(l){const u=/\/public\/(plugins\/.+\/module)\.js/i.exec(l);if(!u)return;const[o,m]=u;if(m)return m}},37843:(j,I,e)=>{"use strict";e.d(I,{O:()=>r,d:()=>g});var t=e(9232),n=e(59882),i=e(67821),s=e(8929);async function r(d){const l=await(0,i.a)(d);let u;if(l.type===t.zV.app&&(u=await(0,s.Av)(l)),l.type===t.zV.datasource&&(u=await(0,s.nL)(l)),l.type===t.zV.panel&&(u=await(0,n._2)(l)),l.type===t.zV.renderer&&(u={meta:l}),!u)throw new Error("Unknown Plugin type: "+l.type);return u}function g(d,l,u){let o={...d},m;function c(p,f){return!f.startsWith(p.url??"")||m&&(m.url?.length??0)>(p.url?.length??0)?p:(m&&(m.active=!1),m={...p,active:!0},m)}return o.children=(o?.children??[]).map(p=>{if(p.children){const f=p.children.map(E=>c(E,u));return{...c(p,u),children:f}}return c(p,u)}),{main:o,node:m??o}}},83341:(j,I,e)=>{"use strict";e.d(I,{$S:()=>f,Ns:()=>E,PL:()=>y,Uk:()=>a,YT:()=>m,ZP:()=>S,aw:()=>v,p$:()=>D,qD:()=>h,rf:()=>o,z0:()=>C,zW:()=>c,zc:()=>p});var t=e(34099),n=e(89949),i=e.n(n),s=e(60956),r=e(99633),g=e(12308),d=e(66574);const l={orgId:g.default.bootData.user.orgId,timeZone:g.default.bootData.user.timezone,weekStart:g.default.bootData.user.weekStart,fiscalYearStartMonth:0,orgsAreLoading:!1,sessionsAreLoading:!1,teamsAreLoading:!1,isUpdating:!1,orgs:[],sessions:[],teams:[],user:null},u=(0,t.oM)({name:"user/profile",initialState:l,reducers:{updateTimeZone:(x,O)=>{x.timeZone=O.payload.timeZone},updateWeekStart:(x,O)=>{x.weekStart=O.payload.weekStart},updateFiscalYearStartMonth:(x,O)=>{x.fiscalYearStartMonth=O.payload.fiscalYearStartMonth},setUpdating:(x,O)=>{x.isUpdating=O.payload.updating},userLoaded:(x,O)=>{x.user=O.payload.user},initLoadTeams:(x,O)=>{x.teamsAreLoading=!0},teamsLoaded:(x,O)=>{x.teams=O.payload.teams,x.teamsAreLoading=!1},initLoadOrgs:(x,O)=>{x.orgsAreLoading=!0},orgsLoaded:(x,O)=>{x.orgs=O.payload.orgs,x.orgsAreLoading=!1},initLoadSessions:(x,O)=>{x.sessionsAreLoading=!0},sessionsLoaded:(x,O)=>{const B=O.payload.sessions.sort((A,V)=>Number(V.isActive)-Number(A.isActive));x.sessions=B.map(A=>({id:A.id,isActive:A.isActive,seenAt:(0,s.E8)(A.seenAt),createdAt:A.createdAt,clientIp:A.clientIp,browser:A.browser,browserVersion:A.browserVersion,os:A.os,osVersion:A.osVersion,device:A.device})),x.sessionsAreLoading=!1},userSessionRevoked:(x,O)=>{x.sessions=x.sessions.filter(B=>B.id!==O.payload.tokenId),x.isUpdating=!1}}}),o=x=>async O=>{(0,n.set)(d.Vt,"user.fiscalYearStartMonth",x),O(M({fiscalYearStartMonth:x}))},m=x=>async O=>{(!(0,n.isString)(x)||(0,n.isEmpty)(x))&&(x=g.default?.bootData?.user?.timezone),(0,n.set)(d.Vt,"user.timezone",x),O(P({timeZone:x}))},c=x=>async O=>{(!(0,n.isString)(x)||(0,n.isEmpty)(x))&&(x=g.default?.bootData?.user?.weekStart),(0,n.set)(d.Vt,"user.weekStart",x),O(b({weekStart:x})),(0,r.Ls)(x)},{setUpdating:p,initLoadOrgs:f,orgsLoaded:E,initLoadTeams:h,teamsLoaded:y,userLoaded:v,userSessionRevoked:D,initLoadSessions:a,sessionsLoaded:C,updateTimeZone:P,updateWeekStart:b,updateFiscalYearStartMonth:M}=u.actions,T=u.reducer,S={user:u.reducer}},6327:(j,I,e)=>{"use strict";e.d(I,{Z:()=>t,i:()=>n});const t=i=>i.timeZone,n=i=>i.fiscalYearStartMonth},31058:(j,I,e)=>{"use strict";e.d(I,{S:()=>n,f:()=>i});class t{constructor(){this.extraRenderActions=[]}addExtraRenderAction(r){this.extraRenderActions=this.extraRenderActions.concat(r)}getAllExtraRenderAction(){return this.extraRenderActions}}const n=new t,i=new t},47802:(j,I,e)=>{"use strict";e.d(I,{x:()=>k,t:()=>R});var t=e(89898),n=e.n(t),i=e(89949),s=e(6772),r=e.n(s),g=e(27702),d=e(62247),l=e(61576),u=e(62435),o=e(53933),m=e(32053),c=e(3935),p=e(74639),f=e(10864),E=e(9772),h=e(25357),y=e(64022),v=e(37647),D=e(43567),a=e(984),C=e(10186),P=e(26858),b=e(89167),M=e(31058),T=e(42844),S=e(66310),x=e(73453),O=e(1128),B=e(59904),A=e(53229);const V=_=>{const{query:G,queries:Y,onChange:X,collapsedText:Q,renderExtras:se,disabled:Z}=_,le=(0,S.wW)(w),[oe,q]=(0,g.useState)(!1),[ne,ge]=(0,g.useState)(null),ae=We=>{q(!0)},re=We=>{if(q(!1),ne){ge(null);return}G.refId!==We&&X({...G,refId:We})},De=We=>{const ke=We.currentTarget.value.trim();if(ke.length===0){ge("An empty query name is not allowed");return}for(const et of Y)if(et!==G&&ke===et.refId){ge("Query name already exists");return}ne&&ge(null)},he=We=>{re(We.currentTarget.value.trim())},ye=We=>{We.key==="Enter"&&re(We.target.value)},ce=We=>{We.target.select()};return g.createElement(g.Fragment,null,g.createElement("div",{className:le.wrapper},!oe&&g.createElement("button",{className:le.queryNameWrapper,"aria-label":p.wl.components.QueryEditorRow.title(G.refId),title:"Edit query name",onClick:ae,"data-testid":"query-name-div",type:"button"},g.createElement("span",{className:le.queryName},G.refId),g.createElement(x.J,{name:"pen",className:le.queryEditIcon,size:"sm"})),oe&&g.createElement(g.Fragment,null,g.createElement(O.I,{type:"text",defaultValue:G.refId,onBlur:he,autoFocus:!0,onKeyDown:ye,onFocus:ce,invalid:ne!==null,onChange:De,className:le.queryNameInput,"data-testid":"query-name-input"}),ne&&g.createElement(B.S,{horizontal:!0},ne)),W(_,le),se&&g.createElement("div",{className:le.itemWrapper},se()),Z&&g.createElement("em",{className:le.contextInfo},"Disabled")),Q&&g.createElement("div",{className:le.collapsedText},Q))},W=(_,G)=>{const{alerting:Y,dataSource:X,onChangeDataSource:Q}=_;return Q?g.createElement("div",{className:G.itemWrapper},g.createElement(A.q,{variables:!0,alerting:Y,current:X.name,onChange:Q})):g.createElement("em",{className:G.contextInfo},"(",X.name,")")},w=_=>({wrapper:(0,T.css)` label: Wrapper; display: flex; align-items: center; margin-left: ${_.spacing(.5)}; overflow: hidden; `,queryNameWrapper:(0,T.css)` display: flex; cursor: pointer; border: 1px solid transparent; border-radius: ${_.shape.borderRadius(2)}; align-items: center; padding: 0 0 0 ${_.spacing(.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,T.css)` font-weight: ${_.typography.fontWeightMedium}; color: ${_.colors.primary.text}; cursor: pointer; overflow: hidden; margin-left: ${_.spacing(.5)}; `,queryEditIcon:(0,T.cx)((0,T.css)` margin-left: ${_.spacing(2)}; visibility: hidden; `,"query-name-edit-icon"),queryNameInput:(0,T.css)` max-width: 300px; margin: -4px 0; `,collapsedText:(0,T.css)` font-weight: ${_.typography.fontWeightRegular}; font-size: ${_.typography.bodySmall.fontSize}; color: ${_.colors.text.secondary}; padding-left: ${_.spacing(1)}; align-items: center; overflow: hidden; font-style: italic; white-space: nowrap; text-overflow: ellipsis; `,contextInfo:(0,T.css)` font-size: ${_.typography.bodySmall.fontSize}; font-style: italic; color: ${_.colors.text.secondary}; padding-left: 10px; padding-right: 10px; `,itemWrapper:(0,T.css)` display: flex; margin-left: 4px; `});function N({error:_}){const G=(0,S.wW)(F),Y=_?.message??_?.data?.message??"Query error";return g.createElement("div",{className:G.wrapper},g.createElement("div",{className:G.icon},g.createElement(x.J,{name:"exclamation-triangle"})),g.createElement("div",{className:G.message},Y,_.traceId!=null&&g.createElement(g.Fragment,null,g.createElement("br",null)," ",g.createElement("span",null,"(Trace ID: ",_.traceId,")"))))}const F=_=>({wrapper:(0,T.css)({marginTop:_.spacing(.5),background:_.colors.background.secondary,display:"flex"}),icon:(0,T.css)({background:_.colors.error.main,color:_.colors.error.contrastText,padding:_.spacing(1)}),message:(0,T.css)({fontSize:_.typography.bodySmall.fontSize,fontFamily:_.typography.fontFamilyMonospace,padding:_.spacing(1)})});class k extends g.PureComponent{constructor(){super(...arguments),this.element=null,this.angularScope=null,this.angularQueryEditor=null,this.dataSourceSrv=(0,f.F)(),this.id="",this.state={datasource:null,hasTextEditMode:!1,data:void 0,isOpen:!0,showingHelp:!1},this.renderAngularQueryEditor=()=>{if(!this.element)return;this.angularQueryEditor&&(this.angularQueryEditor.destroy(),this.angularQueryEditor=null);const G=(0,E.w)(),Y='<plugin-component type="query-ctrl" />',X={ctrl:this.getAngularQueryComponentScope()};this.angularQueryEditor=G.load(this.element,X,Y),this.angularScope=X.ctrl},this.onOpen=()=>{this.renderAngularQueryEditor()},this.renderPluginEditor=()=>{const{query:G,onChange:Y,queries:X,onRunQuery:Q,onAddQuery:se,app:Z=d.zj.PanelEditor,history:le}=this.props,{datasource:oe,data:q}=this.state;if(this.isWaitingForDatasourceToLoad())return null;if(oe?.components?.QueryCtrl)return g.createElement("div",{ref:ne=>this.element=ne});if(oe){let ne=this.getReactQueryEditor(oe);if(ne)return g.createElement(l.n,{instanceSettings:this.props.dataSource},g.createElement(ne,{key:oe?.name,query:G,datasource:oe,onChange:Y,onRunQuery:Q,onAddQuery:se,data:q,range:(0,P.$t)().timeRange(),queries:X,app:Z,history:le}))}return g.createElement("div",null,"Data source plugin does not export any Query Editor component")},this.onToggleEditMode=(G,Y)=>{G.stopPropagation(),this.angularScope&&this.angularScope.toggleEditorMode&&(this.angularScope.toggleEditorMode(),this.angularQueryEditor?.digest(),Y.isOpen||Y.onOpen())},this.onRemoveQuery=()=>{const{onRemoveQuery:G,query:Y,onQueryRemoved:X}=this.props;G(Y),X&&X()},this.onCopyQuery=()=>{const{query:G,onAddQuery:Y,onQueryCopied:X}=this.props,Q=(0,i.cloneDeep)(G);Y(Q),X&&X()},this.onDisableQuery=()=>{const{query:G,onChange:Y,onRunQuery:X,onQueryToggled:Q}=this.props;Y({...G,hide:!G.hide}),X(),Q&&Q(G.hide)},this.onToggleHelp=()=>{this.setState(G=>({showingHelp:!G.showingHelp}))},this.onClickExample=G=>{G.datasource===void 0&&(G.datasource={type:this.props.dataSource.type,uid:this.props.dataSource.uid}),this.props.onChange({...G,refId:this.props.query.refId}),this.onToggleHelp()},this.renderWarnings=()=>{const{data:G,query:Y}=this.props,Q=(R(G,Y.refId)?.series??[]).reduce((oe,q)=>{if(!q.meta?.notices)return oe;const ne=(0,i.filter)(q.meta.notices,{severity:"warning"})??[];return oe.concat(ne)},[]),se=(0,i.uniqBy)(Q,"text");if(!(se.length>0))return null;const le=se.map(oe=>oe.text).join(` `);return g.createElement(h.C,{color:"orange",icon:"exclamation-triangle",text:g.createElement(g.Fragment,null,se.length," ",r()("warning",se.length)),tooltip:le})},this.renderExtraActions=()=>{const{query:G,queries:Y,data:X,onAddQuery:Q,dataSource:se}=this.props,Z=M.f.getAllExtraRenderAction().map((le,oe)=>le({query:G,queries:Y,timeRange:X.timeRange,onAddQuery:Q,dataSource:se,key:oe})).filter(Boolean);return Z.push(this.renderWarnings()),Z},this.renderActions=G=>{const{query:Y,hideDisableQuery:X=!1}=this.props,{hasTextEditMode:Q,datasource:se,showingHelp:Z}=this.state,le=!!Y.hide,oe=se?.components?.QueryEditorHelp;return g.createElement(y.Lh,{width:"auto"},oe&&g.createElement(a.V,{title:"Show data source help",icon:"question-circle",onClick:this.onToggleHelp,active:Z}),Q&&g.createElement(a.y,{title:"Toggle text edit mode",icon:"pen",onClick:q=>{this.onToggleEditMode(q,G)}}),this.renderExtraActions(),g.createElement(a.y,{title:"Duplicate query",icon:"copy",onClick:this.onCopyQuery}),X?null:g.createElement(a.V,{title:"Disable query",icon:le?"eye-slash":"eye",active:le,onClick:this.onDisableQuery}),g.createElement(a.y,{title:"Remove query",icon:"trash-alt",onClick:this.onRemoveQuery}))},this.renderHeader=G=>{const{alerting:Y,query:X,dataSource:Q,onChangeDataSource:se,onChange:Z,queries:le,renderHeaderExtras:oe}=this.props;return g.createElement(V,{query:X,queries:le,onChangeDataSource:se,dataSource:Q,disabled:X.hide,onClick:q=>this.onToggleEditMode(q,G),onChange:Z,collapsedText:G.isOpen?null:this.renderCollapsedText(),renderExtras:oe,alerting:Y})}}componentDidMount(){const{data:G,query:Y,id:X}=this.props,Q=R(G,Y.refId);this.id=(0,i.uniqueId)(X+"_"),this.setState({data:Q}),this.loadDatasource()}componentWillUnmount(){this.angularQueryEditor&&this.angularQueryEditor.destroy()}getAngularQueryComponentScope(){const{query:G,queries:Y}=this.props,{datasource:X}=this.state,Q=new b.rY({targets:Y}),se={},Z=this;return{datasource:X,target:G,panel:Q,dashboard:se,refresh:()=>{G.hide!==Z.props.query.hide&&(G.hide=Z.props.query.hide),this.props.onChange(G),this.props.onRunQuery()},render:()=>()=>console.log("legacy render function called, it does nothing"),events:this.props.eventBus||new u.F,range:(0,P.$t)().timeRange()}}getInterpolatedDataSourceUID(){if(this.props.query.datasource){const G=this.dataSourceSrv.getInstanceSettings(this.props.query.datasource);return G?.rawRef?.uid??G?.uid}return this.props.dataSource.rawRef?.uid??this.props.dataSource.uid}async loadDatasource(){let G;const Y=this.getInterpolatedDataSourceUID();try{G=await this.dataSourceSrv.get(Y)}catch{G=await this.dataSourceSrv.get()}typeof this.props.onDataSourceLoaded=="function"&&this.props.onDataSourceLoaded(G),this.setState({datasource:G,queriedDataSourceIdentifier:Y,hasTextEditMode:(0,i.has)(G,"components.QueryCtrl.prototype.toggleEditorMode")})}componentDidUpdate(G){const{datasource:Y,queriedDataSourceIdentifier:X}=this.state,{data:Q,query:se}=this.props;if(G.id!==this.props.id&&(this.id=(0,i.uniqueId)(this.props.id+"_")),Q!==G.data){const Z=R(Q,se.refId);this.setState({data:Z}),this.angularScope&&(this.angularScope.range=(0,P.$t)().timeRange()),this.angularQueryEditor&&Z&&H(this.angularScope,Z,this.angularQueryEditor)}if(Y&&X!==this.getInterpolatedDataSourceUID()){this.angularQueryEditor&&(this.angularQueryEditor.destroy(),this.angularQueryEditor=null),this.loadDatasource();return}!this.element||this.angularQueryEditor||this.renderAngularQueryEditor()}getReactQueryEditor(G){if(G)switch(this.props.app){case d.zj.Explore:return G.components?.ExploreMetricsQueryField||G.components?.ExploreLogsQueryField||G.components?.ExploreQueryField||G.components?.QueryEditor;case d.zj.PanelEditor:case d.zj.Dashboard:default:return G.components?.QueryEditor}}isWaitingForDatasourceToLoad(){return this.getInterpolatedDataSourceUID()!==this.state.queriedDataSourceIdentifier}renderCollapsedText(){const{datasource:G}=this.state;return G?.getQueryDisplayText?G.getQueryDisplayText(this.props.query):this.angularScope&&this.angularScope.getCollapsedText?this.angularScope.getCollapsedText():null}render(){const{query:G,index:Y,visualization:X,collapsable:Q}=this.props,{datasource:se,showingHelp:Z,data:le}=this.state,oe=G.hide,q=n()("query-editor-row",{"query-editor-row--disabled":oe,"gf-form-disabled":oe});if(!se)return null;const ne=this.renderPluginEditor(),ge=se.components?.QueryEditorHelp;return g.createElement("div",{"data-testid":"query-editor-row","aria-label":p.wl.components.QueryEditorRows.rows},g.createElement(C.t,{id:this.id,draggable:!0,collapsable:Q,index:Y,headerElement:this.renderHeader,actions:this.renderActions,onOpen:this.onOpen},g.createElement("div",{className:q,id:this.id},g.createElement(v.z4,null,Z&&ge&&g.createElement(D.h,null,g.createElement(ge,{onClickExample:ae=>this.onClickExample(ae),query:this.props.query,datasource:se})),ne),le?.error&&le.error.refId===G.refId&&g.createElement(N,{error:le.error}),X)))}}function H(_,G,Y){if(G.state===o.Gu.Done){const X=G.series.map(Q=>(0,m.Zr)(Q));_.events.emit(c.Kh.dataReceived,X)}else G.state===o.Gu.Error&&_.events.emit(c.Kh.dataError,G.error);setTimeout(Y.digest)}function R(_,G){const Y=_.series.filter(Z=>Z.refId===G);if(_.state!==o.Gu.Loading&&(_.error||_.errors?.length)&&!_.series.length)return{..._,state:o.Gu.Error};let X=_.state,Q=_.errors?.find(Z=>Z.refId===G);!Q&&_.error&&(Q=_.error.refId===G?_.error:void 0),X!==o.Gu.Loading&&(Q?X=o.Gu.Error:_.state===o.Gu.Error&&(X=o.Gu.Done));const se=_.timeRange;return{..._,state:X,series:Y,error:Q,errors:Q?[Q]:void 0,timeRange:se}}},77972:(j,I,e)=>{"use strict";e.d(I,{Tl:()=>ge,kt:()=>oe});var t=e(37497),n=e(69966),i=e(19973),s=e(6857),r=e(80852),g=e(39343),d=e(24321),l=e(29655),u=e(60115),o=e(90581),m=e(32900),c=e(58885),p=e(32713),f=e(12308),E=e(89949);function h(ae){let re=[];const De=(0,E.partition)(ae,"id"),he=(0,E.groupBy)(De[0],"id");return re=(0,E.map)(he,ye=>ye.length>1&&!(0,E.every)(ye,y)?(0,E.find)(ye,ce=>ce.eventType!=="panel-alert"):(0,E.head)(ye)),re=(0,E.concat)(re,De[1]),re}function y(ae){return ae.eventType==="panel-alert"}var v=e(26858),D=e(91053),a=e(56469),C=e(73289),P=e(59177);class b{canWork({dashboard:re,range:De}){return!(!re.id||De.raw.to!=="now"||!re.panels.find(he=>!!he.alert))}work(re){if(!this.canWork(re))return(0,P.H_)();const{dashboard:De}=re;return(0,D.D)((0,C.i)().get("/api/alerts/states-for-dashboard",{dashboardId:De.id},`dashboard-query-runner-alert-states-${De.id}`)).pipe((0,g.U)(he=>({alertStates:he,annotations:[]})),(0,a.K)(P.Rc))}}var M=e(45383),T=e(22479),S=e(56361),x=e(10864),O=e(43620),B=e(71183),A=e(92877);class V{canRun(re){return re?!!(!re.annotationQuery||re.annotations):!1}run({annotation:re,datasource:De,dashboard:he,range:ye}){if(!this.canRun(De))return(0,M.of)([]);const ce={};return(0,A.r)({dashboard:he,range:ye,panel:ce},De,re).pipe((0,g.U)(We=>We.events??[]),(0,a.K)(P.h1))}}var W=e(97463);class w{canRun(re){return re?(0,W.yr)(re)?!0:!!(re.annotationQuery&&!re.annotations):!1}run({annotation:re,datasource:De,dashboard:he,range:ye}){return this.canRun(De)?(0,D.D)(De.annotationQuery({range:ye,rangeRaw:ye.raw,annotation:re,dashboard:he})).pipe((0,a.K)(P.h1)):(0,M.of)([])}}class N{constructor(re=[new w,new V]){this.runners=re}canWork({dashboard:re}){return!!re.annotations.list.find(N.getAnnotationsToProcessFilter)}work(re){if(!this.canWork(re))return(0,P.H_)();const{dashboard:De,range:he}=re;let ye=De.annotations.list.filter(N.getAnnotationsToProcessFilter);De.meta.publicDashboardAccessToken&&ye.length>0&&(ye=[ye[0]]);const ce=ye.map(We=>{let ke;if((0,f.iE)().isPublicDashboardView){const et=new B.lh(B.Qi);ke=(0,M.of)(et).pipe((0,a.K)(P.hs))}else ke=(0,D.D)((0,x.F)().get(We.datasource)).pipe((0,a.K)(P.hs));return ke.pipe((0,T.z)(et=>{const we=this.runners.find(_e=>_e.canRun(et));return we?(De.events.publish(new O.z(We)),we.run({annotation:We,datasource:et,dashboard:De,range:he}).pipe((0,d.R)(oe().cancellations().pipe((0,S.h)(_e=>_e===We))),(0,g.U)(_e=>(De.snapshot&&(We.snapshotData=(0,E.cloneDeep)(_e)),De.meta.publicDashboardAccessToken?_e:(0,P.pG)(We,_e))),(0,o.x)(()=>{De.events.publish(new O.RB(We))}))):(0,M.of)([])}))});return(0,s.T)(ce).pipe((0,l.J)(),(0,u.u)((We,ke)=>We.concat(ke)),(0,g.U)(We=>({annotations:We,alertStates:[]})))}static getAnnotationsToProcessFilter(re){return re.enable&&!re.snapshotData}}var F=e(75049),k=e(41999),H=e(91368),R=e(33555),_=e(22446),G=e(18771),Y=e(18447);class X{constructor(){this.hasAlertRules={}}canWork({dashboard:re,range:De}){return!(!re.uid||re.meta.publicDashboardAccessToken||De.raw.to!=="now"||this.hasAlertRules[re.uid]===!1||!(H.contextSrv.hasPermission(G.AccessControlAction.AlertingRuleRead)&&H.contextSrv.hasPermission(G.AccessControlAction.AlertingRuleExternalRead)))}work(re){if(!this.canWork(re))return(0,P.H_)();const{dashboard:De}=re;return(0,D.D)((0,C.i)().get("/api/prometheus/grafana/api/v1/rules",{dashboard_uid:De.uid},`dashboard-query-runner-unified-alert-states-${De.id}`)).pipe((0,g.U)(he=>{if(he.status==="success"){this.hasAlertRules[De.uid]=!1;const ye={};return he.data.groups.forEach(ce=>ce.rules.forEach(We=>{if((0,_.x_)(We)&&We.annotations&&We.annotations[R.q6.panelID]){this.hasAlertRules[De.uid]=!0;const ke=Number(We.annotations[R.q6.panelID]),et=Q(We.state);ye[ke]?et===k.Z.Alerting&&ye[ke].state!==k.Z.Alerting?ye[ke].state=k.Z.Alerting:et===k.Z.Pending&&ye[ke].state!==k.Z.Alerting&&ye[ke].state!==k.Z.Pending&&(ye[ke].state=k.Z.Pending):ye[ke]={state:et,id:Object.keys(ye).length,panelId:ke,dashboardId:De.id}}})),{alertStates:Object.values(ye),annotations:[]}}throw new Error("Unexpected alert rules response.")}),(0,a.K)(P.Rc))}}function Q(ae){return ae===Y.x_.Firing?k.Z.Alerting:ae===Y.x_.Pending?k.Z.Pending:k.Z.OK}class se{constructor(re,De=(0,v.$t)(),he=[f.config.unifiedAlertingEnabled?new X:new b,new F.g,new N]){this.dashboard=re,this.timeSrv=De,this.workers=he,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.t(1),this.runs=new n.x,this.cancellationStream=new n.x,this.runsSubscription=this.runs.subscribe(ye=>this.executeRun(ye)),this.eventsSubscription=re.events.subscribe(p.U5,ye=>{this.run({dashboard:this.dashboard,range:this.timeSrv.timeRange()})})}run(re){this.runs.next(re)}getResult(re){return this.results.asObservable().pipe((0,g.U)(De=>{const he=(0,P.tD)(De.annotations,re),ye=De.alertStates.find(ce=>!!re&&ce.panelId===re);return{annotations:h(he),alertState:ye}}))}executeRun(re){const he=this.workers.filter(et=>et.canWork(re)).map(et=>et.work(re)),ye=new i.w0,ce=(0,s.T)(he).pipe((0,d.R)(this.runs.asObservable()),(0,l.J)(),(0,u.u)((et,we)=>(et.annotations=et.annotations.concat(we.annotations),et.alertStates=et.alertStates.concat(we.alertStates),et)),(0,o.x)(()=>{ye.unsubscribe()}),(0,m.B)()),We=new i.w0,ke=(0,r.H)(200).pipe((0,c.h)({annotations:[],alertStates:[]}),(0,d.R)(ce),(0,o.x)(()=>{We.unsubscribe()}));We.add(ke.subscribe(et=>{this.results.next(et)})),ye.add(ce.subscribe(et=>{this.results.next(et)}))}cancel(re){this.cancellationStream.next(re)}cancellations(){return this.cancellationStream.asObservable().pipe((0,m.B)())}destroy(){this.results.complete(),this.runs.complete(),this.cancellationStream.complete(),this.runsSubscription.unsubscribe(),this.eventsSubscription.unsubscribe()}}let Z;function le(ae){Z&&Z.destroy(),Z=ae}function oe(){if(!Z)throw new Error("getDashboardQueryRunner can only be used after Grafana instance has started.");return Z}let q;function ne(ae){q=ae}function ge(ae){q||(q=({dashboard:De,timeSrv:he,workers:ye})=>new se(De,he,ye));const re=q(ae);return le(re),re}},75049:(j,I,e)=>{"use strict";e.d(I,{g:()=>i});var t=e(45383),n=e(59177);class i{canWork({dashboard:r}){return r?.annotations?.list?.some(g=>g.enable&&!!g.snapshotData)}work(r){if(!this.canWork(r))return(0,n.H_)();const g=this.getAnnotationsFromSnapshot(r.dashboard);return(0,t.of)({annotations:g,alertStates:[]})}getAnnotationsFromSnapshot(r){return(r?.annotations?.list?.filter(u=>u.enable)).filter(u=>!!u.snapshotData).reduce((u,o)=>u.concat((0,n.pG)(o,o.snapshotData)),[])}getAnnotationsInSnapshot(r,g){const d=this.getAnnotationsFromSnapshot(r);return(0,n.tD)(d,g)}}},59177:(j,I,e)=>{"use strict";e.d(I,{H_:()=>c,Rc:()=>p,em:()=>y,h1:()=>o,hs:()=>m,pG:()=>h,tD:()=>E});var t=e(89949),n=e.n(t),i=e(45383),s=e(27938),r=e(40545),g=e(34667),d=e(84749),l=e(73807),u=e(4021);function o(v){return v.cancelled?(0,i.of)([]):(f("AnnotationQueryRunner failed",v),(0,i.of)([]))}function m(v){return f("Failed to retrieve datasource",v),(0,i.of)(void 0)}const c=()=>(0,i.of)({annotations:[],alertStates:[]});function p(v){return v.cancelled||f("DashboardQueryRunner failed",v),c()}function f(v,D){const a=(0,r.P)(D);console.error("handleAnnotationQueryRunnerError",a);const C=(0,l.t_)(v,a.message);(0,d.WI)((0,u.$l)(C))}function E(v,D){return D==null?v:v.filter(a=>{let C;if(C=a.source,!C)return!0;if(C.filter){const P=(C.filter.ids??[]).includes(D);if(C.filter.exclude){if(P)return!1}else if(!P)return!1}return a.panelId&&a.source.type==="dashboard"?a.panelId===D:!0})}function h(v,D){v.snapshotData&&(v=(0,t.cloneDeep)(v),delete v.snapshotData);for(const a of D)switch(a.source=v,a.color=g.config.theme2.visualization.getColorByName(v.iconColor),a.type=v.name,a.isRegion=!!(a.timeEnd&&a.time!==a.timeEnd),a.newState?.toLowerCase()){case"pending":a.color="yellow";break;case"alerting":a.color="red";break;case"ok":a.color="green";break;case"normal":a.color="green";break;case"no_data":a.color="gray";break;case"nodata":a.color="gray";break}return D}function y(v){if(!v||!v.length)return[];const D=[];for(const a of v){const C=new s.U(a);for(let P=0;P<a.length;P++){const b=(0,t.cloneDeep)(C.get(P));D.push(b)}}return D}},76543:(j,I,e)=>{"use strict";e.d(I,{o:()=>B,t:()=>O});var t=e(89949),n=e(37497),i=e(45383),s=e(22479),r=e(39343),g=e(56469),d=e(53933),l=e(32053),u=e(8508),o=e(21708),m=e(64987),c=e(83667),p=e(62247),f=e(76305),E=e(39317),h=e(40545),y=e(42751),v=e(87755),D=e(5926),a=e(36617),C=e(71183),P=e(77972),b=e(10409),M=e(46580);function T(V,W){return(0,b.a)([V,W]).pipe((0,s.z)(w=>{const[N,F]=w;if(F.annotations?.length||F.alertState){N.annotations||(N.annotations=[]);const k=N.annotations.concat(new M.i(F.annotations)),H=F.alertState;return(0,i.of)({...N,annotations:k,alertState:H})}return(0,i.of)(N)}))}var S=e(46809);let x=100;function O(){return"Q"+x++}class B{constructor(W){this.resendLastResult=()=>{this.lastResult&&this.subject.next(this.lastResult)},this.subject=new n.t(1),this.dataConfigSource=W}getData(W){const{withFieldConfig:w,withTransforms:N}=W;let F=1,k,H=[],R=[],_,G=!0,Y=-1;if(this.dataConfigSource.snapshotData){const X={state:d.Gu.Done,series:this.dataConfigSource.snapshotData.map(Q=>(0,l.g0)(Q)),timeRange:(0,u.JK)()};return(0,i.of)(X)}return this.subject.pipe((0,s.z)(X=>{let Q=this.dataConfigSource.getFieldOverrideOptions(),se=this.dataConfigSource.getTransformations();if(X.series===R&&k?.fieldConfig===Q?.fieldConfig&&_===se)return(0,i.of)({...X,structureRev:F,series:H});k=Q,_=se,R=X.series;let Z=(0,i.of)(X);return N&&(Z=this.applyTransformations(X)),Z.pipe((0,r.U)(le=>{let oe=le,q=!1;if(w&&le.series?.length){if(Y===this.dataConfigSource.configRev){const ne=le.series.find(ge=>(0,v.iL)(ge));ne&&!ne.packetInfo.schemaChanged&&H[0].fields.length===ne.fields.length&&(oe={...oe,series:H.map((ge,ae)=>({...ge,length:le.series[ae].length,fields:ge.fields.map((re,De)=>({...re,values:le.series[ae].fields[De].values,state:{...re.state,calcs:void 0,range:void 0}}))}))},q=!0)}Q!=null&&(G||!q)&&(Y=this.dataConfigSource.configRev,oe={...oe,series:(0,o.SM)({timeZone:le.request?.timezone??"browser",data:oe.series,...Q})},G=!1)}return!q&&!(0,m.nl)(H,oe.series,m.Ch)&&F++,H=oe.series,{...oe,structureRev:F}}))}))}applyTransformations(W){const w=this.dataConfigSource.getTransformations();if(!w||w.length===0)return(0,i.of)(W);const N={interpolate:F=>(0,E.J)().replace(F,W?.request?.scopedVars)};return(0,c.H)(w,W.series,N).pipe((0,r.U)(F=>({...W,series:F})),(0,g.K)(F=>(console.warn("Error running transformation:",F),(0,i.of)({...W,state:d.Gu.Error,error:(0,h.P)(F)}))))}async run(W){const{queries:w,timezone:N,datasource:F,panelId:k,dashboardUID:H,publicDashboardAccessToken:R,timeRange:_,timeInfo:G,cacheTimeout:Y,queryCachingTTL:X,maxDataPoints:Q,scopedVars:se,minInterval:Z,app:le}=W;if((0,a.yl)(F)){this.pipeToSubject((0,a.AK)(W,w[0]),k,!0);return}const oe={app:le??p.zj.Dashboard,requestId:O(),timezone:N,panelId:k,dashboardUID:H,publicDashboardAccessToken:R,range:_,timeInfo:G,interval:"",intervalMs:0,targets:(0,t.cloneDeep)(w),maxDataPoints:Q,scopedVars:se||{},cacheTimeout:Y,queryCachingTTL:X,startTime:Date.now(),rangeRaw:_.raw};try{const q=await A(F,oe.scopedVars,R),ne=q.meta?.mixed;oe.targets=oe.targets.map(re=>{const De=re.datasource?.type===y.hr.type;return(!re.datasource||re.datasource.uid!==q.uid&&!ne&&!De)&&(re.datasource=q.getRef()),re});const ge=Z?(0,E.J)().replace(Z,oe.scopedVars):q.interval,ae=f.calculateInterval(_,Q,ge);oe.scopedVars=Object.assign({},oe.scopedVars,{__interval:{text:ae.interval,value:ae.interval},__interval_ms:{text:ae.intervalMs.toString(),value:ae.intervalMs}}),oe.interval=ae.interval,oe.intervalMs=ae.intervalMs,this.lastRequest=oe,this.pipeToSubject((0,S.v7)(q,oe),k)}catch(q){this.pipeToSubject((0,i.of)({state:d.Gu.Error,error:(0,h.P)(q),series:[],timeRange:oe.range}),k)}}pipeToSubject(W,w,N=!1){this.subscription&&this.subscription.unsubscribe();let F=W;const k=this.dataConfigSource.getDataSupport();if(k.alertStates||k.annotations){const H=this.dataConfigSource;F=T(W,(0,P.kt)().getResult(H.id))}this.subscription=F.subscribe({next:H=>{this.lastResult=N?H:(0,l.zR)(H,this.lastResult),this.subject.next(this.lastResult)}})}cancelQuery(){this.subscription&&(this.subscription.unsubscribe(),this.lastResult&&(this.lastResult.state===d.Gu.Loading||this.lastResult.state===d.Gu.Streaming)&&this.subject.next({...this.lastResult,state:d.Gu.Done}))}clearLastResult(){this.lastResult=void 0,this.subject=new n.t(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}}async function A(V,W,w){if(!w&&V&&typeof V=="object"&&"query"in V)return V;const N=await(0,D.ak)().get(V,W);return w?new C.lh(N):N}},45329:(j,I,e)=>{"use strict";e.d(I,{V:()=>n});var t=e(90581);function n(i,s){return(0,t.x)(()=>{s&&i.resolveCancelerIfExists(s)})}},3359:(j,I,e)=>{"use strict";e.d(I,{C:()=>n});var t=e(64987);const n=(i,s)=>{let r=1;return s?.structureRev&&s.series&&(r=s.structureRev,(0,t.nl)(i.series,s.series,t.Ch)||r++),i.structureRev=r,i}},46809:(j,I,e)=>{"use strict";e.d(I,{v7:()=>B});var t=e(89949),n=e(45383),i=e(6857),s=e(80852),r=e(91053),g=e(39343),d=e(56469),l=e(76970),u=e(32900),o=e(58885),m=e(24321),c=e(53933),p=e(69376),f=e(1726),E=e(62247),h=e(40545),y=e(42751),v=e(45937),D=e(76897),a=e(11122),C=e(45329),P=e(78968),b=e(9175),M=e(86312),T=e(75261);function S(V){let W=!1;return F=>{if(!F.request||W||P.Cj.getUrlSearchParams().editPanel!=null||F.state!==c.Gu.Done&&F.state!==c.Gu.Error)return;const H={eventName:b.ct.DataRequest,source:F.request.app,datasourceName:V.name,datasourceId:V.id,datasourceUid:V.uid,datasourceType:V.type,dataSize:0,duration:F.request.endTime-F.request.startTime};F.request.app===E.zj.Explore||F.request.app===E.zj.Correlations?w(H,F):N(H,F),F.series&&F.series.length>0&&(H.dataSize=F.series.length),(0,M.r_)(H),W=!0};function w(F,k){const H=Object.keys(k.series).length;F.totalQueries=H}function N(F,k){const H={};for(let Y=0;Y<k.series.length;Y++){const X=k.series[Y].refId;X&&!H[X]&&(H[X]=k.series[Y].meta?.isCachedResponse??!1)}const R=Object.keys(H).length,_=Object.values(H).filter(Y=>Y===!0).length;F.panelId=k.request.panelId,F.totalQueries=R,F.cachedQueries=_;const G=(0,T.h4)().getCurrent();G&&(F.dashboardId=G.id,F.dashboardName=G.title,F.dashboardUid=G.uid,F.folderName=G.meta.folderTitle),k.error&&(F.error=k.error.message)}}function x(V,W){const w=W.panelData.request,N={...W.packets},F=V.key??V.data?.[0]?.refId??"A";N[F]=V;let k=V.state||c.Gu.Done,H,R;const _=[],G=[];for(const se in N){const Z=N[se];if((Z.error||Z.errors?.length)&&(k=c.Gu.Error,H=Z.error,R=Z.errors),Z.data&&Z.data.length)for(const le of Z.data){if(le.meta?.dataTopic===p.w5.Annotations){G.push(le);continue}_.push(le)}}const Y=O(w,k),X={state:k,series:_,annotations:G,error:H,errors:R,request:w,timeRange:Y},Q=new Set([...W.panelData.traceIds??[],...V.traceIds??[]]);return Q.size>0&&(X.traceIds=Array.from(Q)),{packets:N,panelData:X}}function O(V,W){const w=V.range;return!(0,t.isString)(w.raw.from)||W!==c.Gu.Streaming?w:{...w,from:f.parse(w.raw.from,!1),to:f.parse(w.raw.to,!0)}}function B(V,W,w){let N={panelData:{state:c.Gu.Loading,series:[],request:W,timeRange:W.range},packets:{}};if(!W.targets.length)return W.endTime=Date.now(),N.panelData.state=c.Gu.Done,(0,n.of)(N.panelData);const F=A(V,W,w).pipe((0,g.U)(k=>{if(!(0,t.map)(k.data))throw new Error(`Expected response data to be array, got ${typeof k.data}.`);return W.endTime=Date.now(),N=x(k,N),N.panelData}),(0,d.K)(k=>{const H=typeof k=="string"?k:JSON.stringify(k);return console.error("runRequest.catchError",H),(0,n.of)({...N.panelData,state:c.Gu.Error,error:(0,h.P)(k)})}),(0,l.b)(S(V)),(0,C.V)(v.ae,W.requestId),(0,u.B)());return(0,i.T)((0,s.H)(200).pipe((0,o.h)(N.panelData),(0,m.R)(F)),F)}function A(V,W,w){if(W.targets=W.targets.map(F=>(0,D.vH)(F)?{...V?.getDefaultQuery?.(E.zj.PanelEditor),...F}:F),V.type==="public-ds")return(0,r.D)(V.query(W));for(const F of W.targets)if((0,y.Pr)(F.datasource))return a.mV.query(W);const N=w?w(W):V.query(W);return(0,r.D)(N)}},15758:(j,I,e)=>{"use strict";e.d(I,{CN:()=>i,E_:()=>E,YQ:()=>u,__:()=>d,fy:()=>o,pW:()=>l,qb:()=>p,qi:()=>g,rh:()=>c,to:()=>m,xb:()=>f,yw:()=>r});var t=e(14172);const n=null,i=58,s=8,r={label:"A\u2013Z",value:"alpha-asc"},g="search.sections",d="grafana.search.expanded-folder",l=0,u="general",o="General",m="grafana.search.include.panels",c="grafana.search.layout",p="grafana.search.sort",f={dashboard:t.o.DashDB,folder:t.o.DashFolder,home:t.o.DashHome},E=1e3},63419:(j,I,e)=>{"use strict";e.d(I,{A:()=>r,v:()=>g});var t=e(27702),n=e(69966),i=e(94469),s=e(26129);function r(){const d=(0,t.useRef)(new n.x);return{keyboardEvents:d.current,onKeyDown:l=>{switch(l.code){case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":case"Enter":d.current.next(l);default:}}}}function g(d,l,u){const o=(0,t.useRef)({x:0,y:-1}),[m,c]=(0,t.useState)({x:0,y:-1}),p=(0,t.useRef)();return(0,t.useEffect)(()=>{p.current=u.view.fields.url,o.current.x=0,o.current.y=-1,c({...o.current})},[u]),(0,t.useEffect)(()=>{const f=d.subscribe({next:E=>{switch(E?.code){case"ArrowDown":{o.current.y++,c({...o.current});break}case"ArrowUp":o.current.y=Math.max(0,o.current.y-1),c({...o.current});break;case"ArrowRight":{l>0&&(o.current.x=Math.min(l,o.current.x+1),c({...o.current}));break}case"ArrowLeft":{l>0&&(o.current.x=Math.max(0,o.current.x-1),c({...o.current}));break}case"Enter":if(!p.current)break;const h=o.current.x*l+o.current.y;if(h<0){o.current.x=0,o.current.y=0,c({...o.current});break}const y=p.current.values?.[h];y&&s.E1.push(i.u.stripBaseFromUrl(y))}}});return()=>f.unsubscribe()},[d,l]),m}},63064:(j,I,e)=>{"use strict";e.d(I,{getGrafanaSearcher:()=>t.O});var t=e(91342)},91342:(j,I,e)=>{"use strict";e.d(I,{O:()=>S});var t=e(34667),n=e(27938),i=e(32053),s=e(61965),r=e(73289),g=e(6092);const d="Loading",l="api/search-v2",u="name_sort";class o{constructor(O){this.fallbackSearcher=O}async search(O){if(O.facet?.length)throw new Error("facets not supported!");return this.doSearchQuery(O)}async starred(O){if(O.facet?.length)throw new Error("facets not supported!");const B=await(0,r.i)().get("api/user/stars");return B?.length?this.doSearchQuery({uid:B,query:O.query??"*"}):{view:new n.U({length:0,fields:[]}),totalRows:0,loadMoreItems:async(A,V)=>{},isItemLoaded:A=>!0}}async tags(O){const B={...O,query:O.query??"*",sort:void 0,facet:[{field:"tag"}],limit:1},V=(await(0,r.i)().post(l,B)).frames.map(W=>(0,i.g0)(W));if(V[0]?.name===d)return this.fallbackSearcher.tags(O);for(const W of V)if(W.fields[0].name==="tag")return p(W);return[]}getSortOptions(){const O=[{value:u,label:"Alphabetically (A-Z)"},{value:"-name_sort",label:"Alphabetically (Z-A)"}];if(t.config.licenseInfo.enabledFeatures.analytics){for(const B of f)O.push({value:`-${B.name}`,label:`${B.display} (most)`}),O.push({value:`${B.name}`,label:`${B.display} (least)`});for(const B of E)O.push({value:`-${B.name}`,label:`${B.display} (recent)`}),O.push({value:`${B.name}`,label:`${B.display} (oldest)`})}return Promise.resolve(O)}async doSearchQuery(O){O=await(0,g.Sd)(O);const B={...O,query:O.query??"*",limit:O.limit??m},V=(await(0,r.i)().post(l,B)).frames.map(R=>(0,i.g0)(R)),W=V.length?(0,i.g0)(V[0]):{fields:[],length:0};if(W.name===d)return this.fallbackSearcher.search(O);for(const R of W.fields)R.display=(0,s.U)({field:R,theme:t.config.theme2});W.meta?.custom||(W.meta={...W.meta,custom:{count:W.length,max_score:1}});const w=W.meta.custom;if(w.locationInfo||(w.locationInfo={}),w.sortBy?.length){const R=W.fields.find(_=>_.name===w.sortBy);if(R){const _=h(R.name);w.sortBy=_,R.name=_}}let N=0,F;const k=async()=>{for(;N>H.dataFrame.length;){const R=H.dataFrame.length;if(R>=w.count)return;const _=await(0,r.i)().post(l,{...B??{},from:R,limit:c}),G=(0,i.g0)(_.frames[0]);if(!G){console.log("no results",G);return}if(G.fields.length!==H.dataFrame.fields.length){console.log("invalid shape",G,H.dataFrame);return}const Y=G.length+H.dataFrame.length;for(let Q=0;Q<G.fields.length;Q++)H.dataFrame.fields[Q].values.push(...G.fields[Q].values);H.dataFrame.length=Y;const X=G.meta?.custom;if(X?.locationInfo&&w)for(const[Q,se]of Object.entries(X.locationInfo))w.locationInfo[Q]=se}F=void 0},H=new n.U(W);return{totalRows:w.count??W.length,view:H,loadMoreItems:async(R,_)=>(N=Math.max(N,_),F||(F=k()),F),isItemLoaded:R=>R<H.dataFrame.length}}getFolderViewSort(){return"name_sort"}}const m=50,c=100;function p(x){const O=x.fields[0].values,B=x.fields[1].values,A=[];for(let V=0;V<x.length;V++)A.push({term:O[V],count:B[V]});return A}const f=[{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"}],E=[{name:"created_at",display:"Created time"},{name:"updated_at",display:"Updated time"}];function h(x){for(const O of f)if(O.name===x)return O.display;for(const O of E)if(O.name===x)return O.display;return x}var y=e(12354);class v{constructor(O){this.parent=O,this.cache=new Map,this.sortPlaceholder="Default (Relevance)"}async search(O){if(O.facet?.length)throw new Error("facets not supported!");if(O.sort!=null)throw new Error("custom sorting is not supported yet");if(O.tags?.length||O.ds_uid?.length)return this.parent.search(O);const A=(await this.getCache(O.kind)).search(O.query);return{isItemLoaded:()=>!0,loadMoreItems:async(V,W)=>{},totalRows:A.length,view:A}}async getCache(O){const B=O?O.sort().join(","):"*",A=this.cache.get(B);if(A)try{return await A}catch{return this.cache.delete(B),new D(new n.U({name:"error",fields:[],length:0}))}const V=this.parent.search({kind:O,limit:5e3}).then(W=>new D(W.view));return this.cache.set(B,V),V}async starred(O){return this.parent.starred(O)}async getSortOptions(){return this.parent.getSortOptions()}async tags(O){return this.parent.tags(O)}getFolderViewSort(){return this.parent.getFolderViewSort()}}class D{constructor(O){this.full=O,this.ufuzzy=new y.Z({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1}),this.names=this.full.fields.name.values,this.empty=new n.U({...this.full.dataFrame,fields:this.full.dataFrame.fields.map(B=>({...B,values:[]})),length:0})}search(O){if(!O?.length||O==="*")return this.full;const B=this.full.dataFrame.fields,A=this.names,V=B.map(F=>[]);let[W,w,N]=this.ufuzzy.search(A,O,!0);for(let F=0;F<B.length;F++){let k=B[F].values,H=V[F];if(w&&N)for(let R=0;R<N.length;R++){let _=w.idx[N[R]];H.push(k[_])}else if(W)for(let R=0;R<W.length;R++){let _=W[R];H.push(k[_])}}return this.empty.dataFrame.fields.forEach((F,k)=>{F.values=V[k]}),this.empty.dataFrame.length=this.empty.dataFrame.fields[0].values.length,this.empty}}var a=e(29241),C=e(45937),P=e(15758),b=e(14172);class M{constructor(){this.locationInfo={general:{kind:"folder",name:"General",url:"/dashboards",folderId:0}},this.getFolderViewSort=()=>""}async composeQuery(O,B){const A=await(0,g.Sd)(B);if(A.query?.length&&A.query!=="*"&&(O.query=A.query),A.kind?.length===1&&P.xb[A.kind[0]]&&(O.type=P.xb[A.kind[0]]),A.uid)O.dashboardUID=A.uid;else if(A.location?.length){let V=this.locationInfo[A.location];V||(await this.doAPIQuery({type:b.o.DashFolder,limit:999}),V=this.locationInfo[A.location]),O.folderIds=[V?.folderId??0]}return O}async search(O){if(O.facet?.length)throw new Error("facets not supported!");if(O.from!==void 0){if(!O.limit)throw new Error("Must specify non-zero limit parameter when using from");if(O.from/O.limit%1!==0)throw new Error("From parameter must be a multiple of limit")}const B=O.limit??(O.from!==void 0?1:P.E_),A=O.from!==void 0?O.from/B+1:void 0,V=await this.composeQuery({limit:B,tag:O.tags,sort:O.sort,page:A},O);return this.doAPIQuery(V)}async starred(O){if(O.facet?.length)throw new Error("facets not supported!");const B=await this.composeQuery({limit:O.limit??P.E_,tag:O.tags,sort:O.sort,starred:O.starred},O);return this.doAPIQuery(B)}async getSortOptions(){return(await C.ae.get("/api/search/sorting")).sortOptions.map(B=>({value:B.name,label:B.displayName}))}async tags(O){return(await C.ae.get("/api/dashboards/tags")).sort((A,V)=>V.count-A.count)}async doAPIQuery(O){const B=await C.ae.get("/api/search",O),A=[],V=[],W=[],w=[],N=[],F=[],k=[];let H;for(let G of B){const Y=G.type==="dash-folder"?"folder":"dashboard";A.push(Y),V.push(G.title),W.push(G.uid),w.push(G.url),N.push(G.tags),k.push(G.sortMeta);let X=G.folderUid;!X&&Y==="dashboard"&&(X="general"),F.push(X),G.sortMetaName?.length&&(H=G.sortMetaName),G.folderUid&&G.folderTitle?this.locationInfo[G.folderUid]={kind:"folder",name:G.folderTitle,url:G.folderUrl,folderId:G.folderId}:Y==="folder"&&(this.locationInfo[G.uid]={kind:Y,name:G.title,url:G.url,folderId:G.id})}const R={fields:[{name:"kind",type:a.fS.string,config:{},values:A},{name:"name",type:a.fS.string,config:{},values:V},{name:"uid",type:a.fS.string,config:{},values:W},{name:"url",type:a.fS.string,config:{},values:w},{name:"tags",type:a.fS.other,config:{},values:N},{name:"location",type:a.fS.string,config:{},values:F}],length:V.length,meta:{custom:{count:V.length,max_score:1,locationInfo:this.locationInfo}}};H?.length&&k.length&&(R.meta.custom.sortBy=H,R.fields.push({name:H,type:a.fS.number,config:{},values:k}));for(const G of R.fields)G.display=(0,s.U)({field:G,theme:t.config.theme2});const _=new n.U(R);return{totalRows:R.length,view:_,loadMoreItems:async(G,Y)=>{},isItemLoaded:G=>!0}}}let T;function S(){if(!T){const x=new M,O=t.config.featureToggles.panelTitleSearch;T=O?new o(x):x,O&&location.search.includes("do-frontend-query")&&(T=new v(T))}return T}},6092:(j,I,e)=>{"use strict";e.d(I,{J6:()=>r,Sd:()=>n,f9:()=>d});var t=e(75261);async function n(l){return l.query&&l.query.indexOf("folder:current")>=0&&(l={...l,location:await i(),query:l.query.replace("folder:current","").trim()},l.query?.length||(l.query="*")),Promise.resolve(l)}async function i(){try{let l=(0,t.h4)().getCurrent();return l||(await s(500),l=(0,t.h4)().getCurrent()),Promise.resolve(l?.meta?.folderUid)}catch(l){console.error(l)}}function s(l){return new Promise(u=>setTimeout(u,l))}function r(l,u){return l==="dashboard"?"apps":l==="folder"?u?"folder-open":"folder":"question-circle"}function g(l){switch(l){case"dashboard":case"folder":case"panel":return l;default:return"dashboard"}}function d(l,u){const o=u?.dataFrame.meta?.custom,m={kind:g(l.kind),uid:l.uid,title:l.name,url:l.url,tags:l.tags??[]},c=o?.sortBy;if(c){const p=l[c];(typeof p=="string"||typeof p=="number")&&(m.sortMetaName=c,m.sortMeta=p)}if(l.location){const p=l.location.split("/"),f=p[p.length-1],E=o?.locationInfo[f];E&&(m.parentTitle=E.name,m.parentKind=E.kind,m.parentUID=f)}return m}},14172:(j,I,e)=>{"use strict";e.d(I,{A:()=>n,o:()=>t});var t=(i=>(i.DashDB="dash-db",i.DashHome="dash-home",i.DashFolder="dash-folder",i))(t||{}),n=(i=>(i.List="list",i.Folders="folders",i))(n||{})},55670:(j,I,e)=>{"use strict";e.d(I,{rb:()=>i,vj:()=>r});var t=e(15758);const n=g=>g?!!(g.query||g.tag?.length>0||g.starred||g.sort):!1,i=()=>{const g=t.qi+".";for(let d=0;d<window.localStorage.length;d++){const l=window.localStorage.key(d);l?.startsWith(g)&&window.localStorage.removeItem(l)}},s=(g="General")=>`${SECTION_STORAGE_KEY}.${g.toLowerCase()}`,r=g=>{const d=Object.entries(g).reduce((l,[u,o])=>{if(o){if(u==="tag"&&!Array.isArray(o))return{...l,tag:[o]}}else return l;return{...l,[u]:o}},{});if(g.folder){const l=`folder:${g.folder}`;return{...d,query:`${l} ${(d.query??"").replace(l,"")}`}}return{...d}}},21502:(j,I,e)=>{"use strict";e.d(I,{Dn:()=>h,LA:()=>u,M4:()=>v,P4:()=>g,Ub:()=>E,ZP:()=>a,aj:()=>D,dt:()=>f,e7:()=>d,pN:()=>p,s3:()=>l});var t=e(34099),n=e(18771);const i={serviceAccount:{},isLoading:!0,tokens:[]},s=(0,t.oM)({name:"serviceaccount",initialState:i,reducers:{serviceAccountFetchBegin:C=>({...C,isLoading:!0}),serviceAccountFetchEnd:C=>({...C,isLoading:!1}),serviceAccountLoaded:(C,P)=>({...C,serviceAccount:P.payload,isLoading:!1}),serviceAccountTokensLoaded:(C,P)=>({...C,tokens:P.payload,isLoading:!1})}}),r=s.reducer,{serviceAccountLoaded:g,serviceAccountTokensLoaded:d,serviceAccountFetchBegin:l,serviceAccountFetchEnd:u}=s.actions,o={serviceAccounts:[],isLoading:!0,roleOptions:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,serviceAccountStateFilter:n.ServiceAccountStateFilter.All},m=(0,t.oM)({name:"serviceaccounts",initialState:o,reducers:{serviceAccountsFetched:(C,P)=>{const{totalCount:b,perPage:M,...T}=P.payload,S=Math.ceil(b/M);return{...C,...T,totalPages:S,perPage:M,showPaging:S>1,isLoading:!1}},serviceAccountsFetchBegin:C=>({...C,isLoading:!0}),serviceAccountsFetchEnd:C=>({...C,isLoading:!1}),acOptionsLoaded:(C,P)=>({...C,roleOptions:P.payload}),queryChanged:(C,P)=>({...C,query:P.payload,page:0}),pageChanged:(C,P)=>({...C,page:P.payload}),stateFilterChanged:(C,P)=>({...C,serviceAccountStateFilter:P.payload})}}),c=m.reducer,{serviceAccountsFetchBegin:p,serviceAccountsFetchEnd:f,serviceAccountsFetched:E,acOptionsLoaded:h,pageChanged:y,stateFilterChanged:v,queryChanged:D}=m.actions,a={serviceAccountProfile:r,serviceAccounts:c}},26271:(j,I,e)=>{"use strict";e.d(I,{Ii:()=>r,UW:()=>u,ZP:()=>p,cD:()=>d,fT:()=>m,ik:()=>l,ki:()=>g,rI:()=>o,rW:()=>s});var t=e(34099);const n={supportBundles:[],isLoading:!1,supportBundleCollectors:[],createBundlePageLoading:!1,loadBundlesError:"",createBundleError:""},i=(0,t.oM)({name:"supportBundles",initialState:n,reducers:{supportBundlesLoaded:(f,E)=>({...f,supportBundles:E.payload,isLoading:!1}),fetchBegin:f=>({...f,isLoading:!0}),fetchEnd:f=>({...f,isLoading:!1}),collectorsFetchBegin:f=>({...f,createBundlePageLoading:!0}),collectorsFetchEnd:f=>({...f,createBundlePageLoading:!1}),supportBundleCollectorsLoaded:(f,E)=>({...f,supportBundleCollectors:E.payload,createBundlePageLoading:!1}),setLoadBundleError:(f,E)=>({...f,loadBundlesError:E.payload,supportBundleCollectors:[]}),setCreateBundleError:(f,E)=>({...f,createBundleError:E.payload})}}),{supportBundlesLoaded:s,fetchBegin:r,fetchEnd:g,supportBundleCollectorsLoaded:d,collectorsFetchBegin:l,collectorsFetchEnd:u,setLoadBundleError:o,setCreateBundleError:m}=i.actions,p={supportBundles:i.reducer}},96444:(j,I,e)=>{"use strict";e.d(I,{PJ:()=>g,PL:()=>s,UD:()=>p,ZP:()=>E,aj:()=>r,iI:()=>m,n2:()=>c,p3:()=>n,y$:()=>o});var t=e(34099);const n={teams:[],page:1,query:"",perPage:30,totalPages:0,noTeams:!1,hasFetched:!1},i=(0,t.oM)({name:"teams",initialState:n,reducers:{teamsLoaded:(h,y)=>{const{totalCount:v,perPage:D,...a}=y.payload,C=Math.ceil(v/D);return{...h,...a,totalPages:C,perPage:D,hasFetched:!0}},queryChanged:(h,y)=>({...h,page:1,query:y.payload}),pageChanged:(h,y)=>({...h,page:y.payload})}}),{teamsLoaded:s,queryChanged:r,pageChanged:g}=i.actions,d=i.reducer,l={team:{},members:[],groups:[],searchMemberQuery:""},u=(0,t.oM)({name:"team",initialState:l,reducers:{teamLoaded:(h,y)=>({...h,team:y.payload}),teamMembersLoaded:(h,y)=>({...h,members:y.payload}),setSearchMemberQuery:(h,y)=>({...h,searchMemberQuery:y.payload}),teamGroupsLoaded:(h,y)=>({...h,groups:y.payload})}}),{teamLoaded:o,teamGroupsLoaded:m,teamMembersLoaded:c,setSearchMemberQuery:p}=u.actions,f=u.reducer,E={teams:d,team:f}},99386:(j,I,e)=>{"use strict";e.d(I,{J:()=>le});var t=e(89949),n=e(58939),i=e(10864),s=e(39317),r=e(80734),g=e(64167),d=e(41355),l=e(80169),u=e(5399),o=e(51824),m=e(81587);let c={};function p(oe){const q=c[oe];return q||(c[oe]=(0,t.property)(oe))}class f{constructor(q,ne,ge){this.state={name:q.name,value:ne,text:ge,type:q.type}}getValue(q){let{value:ne}=this.state;return ne==="string"||ne==="number"||ne==="boolean"?ne:String(ne)}getValueText(){const{value:q,text:ne}=this.state;return typeof ne=="string"?q===l.r2?l.xk:ne:Array.isArray(ne)?ne.join(" + "):(console.log("value",ne),String(ne))}}let E;function h(oe,q,ne){return E?(E.state.name=oe.name,E.state.type=oe.type,E.state.value=q,E.state.text=ne):E=new f(oe,q,ne),E}function y(oe,q,ne,ge){if(ne=ne||{},oe==null||(0,u.Kn)(ne)&&q!==g.b8.QueryParam)return"";if(!Array.isArray(oe)&&typeof oe=="object"&&(oe=`${oe}`),typeof q=="function")return q(oe,ne,y);q||(q=g.b8.Glob);let ae=q.split(":");ae.length>1?(q=ae[0],ae=ae.slice(1)):ae=[];let re=r.Vl.getIfExists(q);re||(console.error(`Variable format ${q} not found. Using glob format as fallback.`),re=r.Vl.get(g.b8.Glob));const De=h(ne,oe,ge??oe);return re.formatter(oe,ae,De)}var v=e(24588),D=e.n(v),a=e(3569),C=e(78968),P=e(31317),b=e(26858),M=e(75627),T=e(21609),S=e(29241),x=e(70732),O=e(61965),B=e(75578),A=e(14951);function V(oe,q,ne){return new Proxy({},{get:(ge,ae)=>{if(ae==="name")return oe.name;if(ae==="displayName")return(0,B.CZ)(oe,q,ne);if(ae==="labels"||ae==="formattedLabels")return oe.labels?{...oe.labels,__values:Object.values(oe.labels).sort().join(", "),toString:()=>(0,A.aA)(oe.labels,"",!0)}:""}})}function W(oe,q,ne,ge){const ae=w(oe,q,ne);return y(ae,ge)}function w(oe,q,ne){const ge=ne?.__dataContext;if(!ge)return oe;const{frame:ae,rowIndex:re,field:De,calculatedValue:he}=ge.value;if(he)switch(q){case"numeric":return he.numeric.toString();case"raw":return he.numeric;case"time":return"";case"text":default:return(0,T.zc)(he)}if(re===void 0)return oe;if(q==="time"){const ke=ae.fields.find(et=>et.type===S.fS.time);return ke?ke.values[re]:void 0}const ye=De.values[re];if(q==="raw")return ye;const We=(De.display??k())(ye);switch(q){case"numeric":return We.numeric;case"text":return We.text;default:return(0,T.zc)(We)}}function N(oe,q,ne,ge){const ae=ne?.__dataContext;if(!ae||!q)return oe;const{frame:re,rowIndex:De}=ae.value;if(De===void 0||q===void 0)return oe;const he={name:re.name,refId:re.refId,fields:(0,x.z)({frame:re,rowIndex:De})},ye=p(q)(he)??"";return y(ye,ge)}let F;function k(){return F||(F=(0,O.U)()),F}function H(oe,q,ne,ge){const ae=ne?.__dataContext;if(!ae||q!=="name")return oe;const{frame:re,frameIndex:De}=ae.value,he=(0,B.nf)(re,De);return y(he,ge)}function R(oe,q,ne,ge){const ae=ne?.__dataContext;if(!ae||q===void 0||q==="")return oe;const{frame:re,field:De,data:he}=ae.value,ye=V(De,re,he),ce=p(q)(ye)??"";return y(ce,ge)}const _={__value:W,__data:N,__series:H,__field:R,[a.W.includeVars]:G,[a.W.keepTime]:Y,__timezone:X};function G(oe,q,ne){const ge=(0,M.c)(ne);return C.Cj.toUrlParams(ge)}function Y(){return C.Cj.toUrlParams((0,b.$t)().timeRangeForUrl())}function X(){const oe=(0,P.Z)({timeZone:(0,b.$t)().timeModel?.getTimezone()});return oe==="browser"?D().tz.guess():oe}const Q={getFilteredVariables:o.Q4,getVariables:o.ng,getVariableWithName:o._K};class se{constructor(q=Q){this.dependencies=q,this.regex=m.J7,this.index={},this.grafanaVariables=new Map,this.timeRange=null,this._variables=[]}init(q,ne){this._variables=q,this.timeRange=ne,this.updateIndex()}get variables(){return(0,n.d)("template_srv.ts","variables","getVariables"),this.getVariables()}getVariables(){return this.dependencies.getVariables()}updateIndex(){const q=ne=>ne||ne==="";if(this.index=this._variables.reduce((ne,ge)=>(ge.current&&(ge.current.isNone||q(ge.current.value))&&(ne[ge.name]=ge),ne),{}),this.timeRange){const ne=this.timeRange.from.valueOf().toString(),ge=this.timeRange.to.valueOf().toString();this.index={...this.index,__from:{current:{value:ne,text:ne}},__to:{current:{value:ge,text:ge}}}}}updateTimeRange(q){this.timeRange=q,this.updateIndex()}variableInitialized(q){this.index[q.name]=q}getAdhocFilters(q){let ne=[],ge=(0,i.F)().getInstanceSettings(q);if(!ge)return[];for(const ae of this.getAdHocVariables()){const re=ae.datasource?.uid;(re===ge.uid||re?.indexOf("$")===0&&this.replace(re)===ge.uid)&&(ne=ne.concat(ae.filters))}return ne}setGrafanaVariable(q,ne){this.grafanaVariables.set(q,ne)}setGlobalVariable(q,ne){(0,n.d)("template_srv.ts","setGlobalVariable",""),this.index={...this.index,[q]:{current:ne}}}getVariableName(q){this.regex.lastIndex=0;const ne=this.regex.exec(q);return ne?ne.slice(1).find(ae=>ae!==void 0):null}containsTemplate(q){if(!q)return!1;const ne=this.getVariableName(q),ge=ne&&this.getVariableAtIndex(ne);return ge!=null}variableExists(q){return(0,n.d)("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,(ne,ge)=>this.getVariableAtIndex(ge)?'<span class="template-variable">'+ne+"</span>":ne))}getAllValue(q){if(q.allValue)return q.allValue;const ne=[];for(let ge=1;ge<q.options.length;ge++)ne.push(q.options[ge].value);return ne}getVariableValue(q,ne){return ne?p(ne)(q.value):q.value}getVariableText(q,ne){return q.value===ne||typeof ne!="string"?q.text:ne}replace(q,ne,ge,ae){return ne&&ne.__sceneObject?r.ep.interpolate(ne.__sceneObject.value,q,ne,ge):q?(this.regex.lastIndex=0,this._replaceWithVariableRegex(q,ge,(re,De,he,ye)=>{const ce=this._evaluateVariableExpression(re,De,he,ye,ne);return ae&&ae.push({match:re,variableName:De,fieldPath:he,format:ye,value:ce,found:ce!==re}),ce})):q??""}_evaluateVariableExpression(q,ne,ge,ae,re){const De=this.getVariableAtIndex(ne),he=re?.[ne];if(he){const ke=this.getVariableValue(he,ge),et=this.getVariableText(he,ke);if(ke!=null)return y(ke,ae,De,et)}if(!De){const ke=_[ne];return ke?ke(q,ge,re,ae):q}if(ae===g.b8.QueryParam||(0,u.Kn)(De)){const ke=d.z.get(De.type).getValueForUrl(De),et=(0,u.Kn)(De)?De.id:De.current.text;return y(ke,ae,De,et)}const ye=this.grafanaVariables.get(De.current.value);if(ye)return y(ye,ae,De);let ce=De.current.value,We=De.current.text;if(this.isAllValue(ce)&&(ce=this.getAllValue(De),We=l.xk,De.allValue&&ae!==g.b8.Text&&ae!==g.b8.PercentEncode))return this.replace(ce);if(ge){const ke=this.getVariableValue({value:ce,text:We},ge);if(ke!=null)return y(ke,ae,De,We)}return y(ce,ae,De,We)}_replaceWithVariableRegex(q,ne,ge){return this.regex.lastIndex=0,q.replace(this.regex,(ae,re,De,he,ye,ce,We)=>ge(ae,re||De||ye,ce,he||We||ne))}isAllValue(q){return q===l.r2||Array.isArray(q)&&q[0]===l.r2}replaceWithText(q,ne){return(0,n.d)("template_srv.ts","replaceWithText()","replace(), and specify the :text format"),this.replace(q,ne,"text")}getVariableAtIndex(q){if(q)return this.index[q]?this.index[q]:this.dependencies.getVariableWithName(q)}getAdHocVariables(){return this.dependencies.getFilteredVariables(u.Kn)}}const Z=new se;(0,s.l)(Z);const le=()=>Z},73941:(j,I,e)=>{"use strict";e.d(I,{J:()=>o});var t=e(64167),n=e(53387),i=e(27702),s=e(64022),r=e(40705),g=e(1128);const d=[{label:"Size",value:t.kW.Size,description:"Split the buckets based on size"},{label:"Count",value:t.kW.Count,description:"Split the buckets based on count"}],l=[{label:"Split",value:t.kW.Size,description:"Split the buckets based on size"}],u=({value:m,onChange:c,item:p})=>i.createElement(s.Lh,null,i.createElement(r.S,{value:m?.mode||t.kW.Size,options:m?.scale?.type===t.wf.Log?l:d,onChange:f=>{c({...m,mode:f})}}),i.createElement(g.I,{value:m?.value??"",placeholder:"Auto",onChange:f=>{c({...m,value:f.currentTarget.value})}}));function o(m,c,p,f){c.addCustomEditor({id:"xBuckets",path:`${m}xBuckets`,name:"X Bucket",editor:u,category:f,defaultValue:{mode:t.kW.Size}}),c.addCustomEditor({id:"yBuckets",path:`${m}yBuckets`,name:"Y Bucket",editor:u,category:f,defaultValue:{mode:t.kW.Size}}),c.addCustomEditor({id:"yBuckets-scale",path:`${m}yBuckets.scale`,name:"Y Bucket scale",category:f,editor:n.Y,defaultValue:{type:t.wf.Linear}})}},28635:(j,I,e)=>{"use strict";e.d(I,{xf:()=>k,Oy:()=>B,qJ:()=>w,d8:()=>W,Cj:()=>N});var t=e(39343),n=e(14544),i=e(29241),s=e(75578),r=e(21609),g=e(43987),d=e(32082),l=e(35596),u=e(48962),o=e(64167),m=e(27107);const{abs:c,pow:p}=Math,f=new Map;function E(_,G,Y,X){let Q=[],se=X.map(m.d);for(let Z=G;Z<Y;Z++){let le=c(Z),oe=(0,m.O)(p(_,Z),le);for(let q=0;q<X.length;q++){let ne=X[q]*oe,ge=(ne>=0&&Z>=0?0:le)+(Z>=se[q]?0:se[q]),ae=(0,m.O)(ne,ge);Q.push(ae),f.set(ae,ge)}}return Q}const h=_=>_%1===0,y=[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],v=E(10,-16,0,y),D=E(10,0,16,y),a=D.filter(h),C=v.concat(D),P=v.concat(a),b=1*1e3,M=60*b,T=60*M,S=24*T,x=365*S,O=[1,2,4,5,10,20,25,40,50,100,200,250,400,500,b,2*b,4*b,5*b,10*b,15*b,20*b,30*b,M,2*M,4*M,5*M,10*M,15*M,20*M,30*M,T,2*T,4*T,6*T,8*T,12*T,18*T,S,2*S,3*S,4*S,5*S,6*S,7*S,10*S,15*S,30*S,45*S,60*S,90*S,180*S,x,2*x,3*x,4*x,5*x,6*x,7*x,8*x,9*x,10*x],B={id:n.W.heatmap,name:"Create heatmap",description:"Calculate heatmap from source data.",defaultOptions:{},operator:(_,G)=>Y=>Y.pipe((0,t.U)(X=>B.transformer(_,G)(X))),transformer:_=>G=>{const Y=k(G,_);return _.keepOriginalData?[Y,...G]:[Y]}};function A(_){return _==="+Inf"?1/0:_==="-Inf"?-1/0:+(_??0)}function V(_,G){return A(_)-A(G)}function W(_){return _?.meta?.custom??{}}function w(_){let G=!1;for(let Y of _.fields)switch(Y.name){case"y":case"yMin":case"yMax":if(G)return!1;G=!0}return G}function N(_){const G=_.frame.fields[0],Y=G.values,X=_.frame.fields.filter((re,De)=>re.type===i.fS.number&&De>0),Q=Y.length*X.length,se=new Array(Q),Z=new Array(Q),le=new Array(Q),oe=X.map(re=>re.values.slice());oe.forEach((re,De)=>{for(let he=0;he<re.length;he++)le[oe.length*he+De]=re[he]});const q=Array.from({length:X.length},(re,De)=>De);for(let re=0,De=0,he=0;re<Q;De=++re%q.length)Z[re]=q[De],De===0&&re>=q.length&&he++,se[re]=Y[he];let ne=X[0].labels?.le!=null?"yMax":"y";switch(_.layout){case o.kv.le:ne="yMax";break;case o.kv.ge:ne="yMin";break;case o.kv.unknown:ne="y";break}const ge={yOrdinalDisplay:X.map(re=>(0,s.CZ)(re,_.frame)),yMatchWithLabel:Object.keys(X[0].labels??{})[0]};if(ge.yMatchWithLabel&&(ge.yOrdinalLabel=X.map(re=>re.labels?.[ge.yMatchWithLabel]??""),ge.yMatchWithLabel==="le"&&(ge.yMinDisplay="0.0")),_.unit?.length||_.decimals!=null){const re=(0,r.Cf)(_.unit??"short");ge.yMinDisplay&&(ge.yMinDisplay=(0,r.zc)(re(0,_.decimals))),ge.yOrdinalDisplay=ge.yOrdinalDisplay.map(De=>{let he=+De;return Number.isNaN(he)?De:(0,r.zc)(re(he,_.decimals))})}const ae={...X[0].config};return ae.displayNameFromDS&&delete ae.displayNameFromDS,{length:se.length,refId:_.frame.refId,meta:{type:g.P.HeatmapCells,custom:ge},fields:[{name:G.type===i.fS.time?"xMax":"x",type:G.type,values:se,config:G.config},{name:ne,type:i.fS.number,values:Z,config:{unit:"short"}},{name:_.value?.length?_.value:"Value",type:i.fS.number,values:le,config:ae,display:X[0].display}]}}function F(_){_=_.slice(),_.sort((Y,X)=>V(Y.name,X.name));const G=_.map(Y=>Y.fields[1].values.slice());return G.reverse(),G.forEach((Y,X)=>{if(X<G.length-1)for(let Q=0;Q<Y.length;Q++)Y[Q]-=G[X+1][Q]}),G.reverse(),_.map((Y,X)=>({...Y,fields:[Y.fields[0],{...Y.fields[1],values:G[X]}]}))}function k(_,G){let Y,X,Q=0;for(let re of _)re.fields.find(he=>he.type===i.fS.time)&&(Q+=re.length);let se=Array(Q),Z=Array(Q),le=0;for(let re of _){const De=re.fields.find(ye=>ye.type===i.fS.time);if(!De)continue;Y||(Y=De);const he=De.values;for(let ye of re.fields)if(ye!==De&&ye.type===i.fS.number){const ce=ye.values;for(let We=0;We<he.length;We++,le++)se[le]=he[We],Z[le]=ce[We];X||(X=ye)}}if(!Y||!X)throw"no heatmap fields found";if(!se.length||!Z.length)throw"no values found";const oe=G.xBuckets??{},q=G.yBuckets??{};if(oe.scale?.type===o.wf.Log)throw"X axis only supports linear buckets";const ne=G.yBuckets?.scale??{type:o.wf.Linear},ge=H(se,Z,{xSorted:(0,u.lP)(se),xTime:Y.type===i.fS.time,xMode:oe.mode,xSize:oe.mode===o.kW.Size?(0,d.iX)((0,d.RA)(oe.value??"")):oe.value?+oe.value:void 0,yMode:q.mode,ySize:q.value?+q.value:void 0,yLog:ne?.type===o.wf.Log?ne?.log:void 0});return{length:ge.x.length,name:(0,s.CZ)(X),meta:{type:g.P.HeatmapCells},fields:[{name:"xMin",type:Y.type,values:ge.x,config:Y.config},{name:"yMin",type:i.fS.number,values:ge.y,config:{...X.config,custom:{scaleDistribution:ne}}},{name:"Count",type:i.fS.number,values:ge.count,config:{unit:"short"}}]}}function H(_,G,Y){let X=_.length,Q=Y?.xSorted??!1,se=Y?.ySorted??!1,Z=Q?_[0]:1/0,le=se?G[0]:1/0,oe=Q?_[X-1]:-1/0,q=se?G[X-1]:-1/0,ne=Y?.yLog;for(let Me=0;Me<X;Me++)Q||(Z=Math.min(Z,_[Me]),oe=Math.max(oe,_[Me])),se||(!ne||G[Me]>0)&&(le=Math.min(le,G[Me]),q=Math.max(q,G[Me]));let ge=Y?.xSize??0,ae=Y?.ySize??0,re=Y?.xMode,De=Y?.yMode;if((!Number.isFinite(ge)||ge<=0)&&(re=o.kW.Count,ge=20),(!Number.isFinite(ae)||ae<=0)&&(De=o.kW.Count,ae=10),re===o.kW.Count){let Me=(oe-Z)/Math.max(ge-1,1),be=Y?.xTime?O:P,Ke=be.findIndex(Ye=>Ye>Me)-1;ge=be[Math.max(Ke,0)]}if(De===o.kW.Count){let Me=(q-le)/Math.max(ae-1,1),be=Y?.yTime?O:P,Ke=be.findIndex(Ye=>Ye>Me)-1;ae=be[Math.max(Ke,0)]}let he=Y?.xCeil?Me=>(0,l.UO)(Me,ge):Me=>(0,l.mB)(Me,ge),ye=Y?.yCeil?Me=>(0,l.UO)(Me,ae):Me=>(0,l.mB)(Me,ae);if(ne){ae=1/(Y?.ySize??1);let Me=ne===2?Math.log2:Math.log10;ye=Y?.yCeil?be=>(0,l.UO)(Me(be),ae):be=>(0,l.mB)(Me(be),ae)}let ce=he(Z),We=he(oe),ke=ye(le),et=ye(q),we=Math.round((We-ce)/ge)+1,_e=Math.round((et-ke)/ae)+1,[Ge,qe,st]=R(we,_e,ce,ge,ke,ae,ne);for(let Me=0;Me<X;Me++){if(ne&&G[Me]<=0)continue;const be=(he(_[Me])-ce)/ge,Ke=(ye(G[Me])-ke)/ae,Ye=be*_e+Ke;st[Ye]++}return{x:Ge,y:qe,count:st}}function R(_,G,Y,X,Q,se,Z){const le=_*G,oe=new Array(le),q=new Array(le),ne=new Array(le);for(let ge=0,ae=0,re=Y;ge<le;ae=++ge%G)ne[ge]=0,Z?q[ge]=Z**(Q+ae*se):q[ge]=Q+ae*se,ae===0&&ge>=G&&(re+=X),oe[ge]=re;return[oe,q,ne]}},87746:(j,I,e)=>{"use strict";e.d(I,{Ii:()=>i,JJ:()=>n,ac:()=>s});var t=e(64167),n=(g=>(g.Prepare="prepare",g.Calculate="calculate",g.Modify="modify",g))(n||{}),i=(g=>(g.Heading="heading",g.Distance="distance",g.Area="area",g))(i||{}),s=(g=>(g.AsLine="asLine",g.LineBuilder="lineBuilder",g))(s||{});const r={action:"prepare",source:{mode:t.q1.Auto}}},62129:(j,I,e)=>{"use strict";e.d(I,{Lb:()=>o,Lp:()=>l,N7:()=>c});var t=e(70328),n=e(84570),i=e(10680),s=e(29209),r=e(36334),g=e(29241),d=e(87746);function l(p){const f=[];for(const E of p.values)E&&f.push(o(E));return new n.Z(f)}function u(p){const f=new Array(p.length);if(p.length>1){let E=m(p[0]);for(let h=1;h<p.length;h++){let y=m(p[h]);if(E&&y){let v=Math.atan2(y[0]-E[0],y[1]-E[1])*180/Math.PI;v<0&&(v+=360),f[h-1]=f[h]=v}}}else f.fill(0);return f}function o(p){return p instanceof i.Z?p.getCoordinates():(0,t.qg)(p.getExtent())}function m(p){if(p)return(0,s.bU)(o(p))}function c(p,f){const E=p.values,h=new Array(p.values.length),y=f.calc??d.Ii.Heading,v=f.field??y;switch(y){case d.Ii.Area:{for(let D=0;D<E.length;D++){const a=E[D];a&&(h[D]=(0,r.bg)(a))}return{name:v,type:g.fS.number,config:{unit:"areaM2"},values:h}}case d.Ii.Distance:{for(let D=0;D<E.length;D++){const a=E[D];a&&(h[D]=(0,r.xA)(a))}return{name:v,type:g.fS.number,config:{unit:"lengthm"},values:h}}case d.Ii.Heading:default:return{name:v,type:g.fS.number,config:{unit:"degree"},values:u(E)}}}},30306:(j,I,e)=>{"use strict";e.d(I,{Hg:()=>i,Vx:()=>r,jY:()=>s});var t=e(27702),n=e(75578);function i(g){return(0,t.useMemo)(()=>Array.isArray(g)?Object.keys(g.reduce((d,l)=>!l||!Array.isArray(l.fields)?d:l.fields.reduce((u,o)=>{const m=(0,n.CZ)(o,l,g);return u[m]=!0,u},d),{})):[],[g])}function s(g){const d=new Set;for(const l of g)for(const u of l.fields)if(u.labels)for(const o of Object.keys(u.labels))d.add(o);return d}const r={combine:"Combine",calculateNewFields:"Calculate new fields",createNewVisualization:"Create new visualization",filter:"Filter",performSpatialOperations:"Perform spatial operations",reformat:"Reformat",reorderAndRename:"Reorder and rename"}},17632:(j,I,e)=>{"use strict";e.d(I,{PJ:()=>o,ZP:()=>c,eT:()=>d,k7:()=>u,tZ:()=>l,w4:()=>r});var t=e(34099),n=e(12308);const i={users:[],searchQuery:"",page:0,perPage:30,totalPages:1,canInvite:!n.default.externalUserMngLinkName,externalUserMngInfo:n.default.externalUserMngInfo,externalUserMngLinkName:n.default.externalUserMngLinkName,externalUserMngLinkUrl:n.default.externalUserMngLinkUrl,isLoading:!1},s=(0,t.oM)({name:"users",initialState:i,reducers:{usersLoaded:(p,f)=>{const{totalCount:E,perPage:h,page:y,orgUsers:v}=f.payload,D=Math.ceil(E/h);return{...p,isLoading:!0,users:v,perPage:h,page:y,totalPages:D}},searchQueryChanged:(p,f)=>({...p,searchQuery:f.payload,page:i.page}),setUsersSearchPage:(p,f)=>({...p,page:f.payload}),pageChanged:(p,f)=>({...p,page:f.payload}),usersFetchBegin:p=>({...p,isLoading:!0}),usersFetchEnd:p=>({...p,isLoading:!1})}}),{searchQueryChanged:r,setUsersSearchPage:g,usersLoaded:d,usersFetchBegin:l,usersFetchEnd:u,pageChanged:o}=s.actions,c={users:s.reducer}},41355:(j,I,e)=>{"use strict";e.d(I,{z:()=>n});var t=e(25359);const n=new t.B},74030:(j,I,e)=>{"use strict";e.d(I,{KJ:()=>h,M6:()=>f,Ue:()=>y,Z$:()=>v,ku:()=>E,m2:()=>p});var t=e(89949),n=e.n(t),i=e(5926),s=e(39655),r=e(5399),g=e(4684),d=e(1941),l=e(51824),u=e(60344),o=e(81587),m=e(26333);const c="Filters",p=C=>async(P,b)=>{let M=a(C,b());if(!M&&(P(D(C)),M=a(C,b()),!M))return;const T=M.filters.findIndex(x=>x.key===C.key&&x.value===C.value);if(T===-1){const{value:x,key:O,operator:B}=C,A={value:x,key:O,operator:B,condition:""};return await P(h((0,o.yQ)(M),A))}const S={...M.filters[T],operator:C.operator};return await P(f((0,o.yQ)(M),{index:T,filter:S}))},f=(C,P)=>async(b,M)=>{const T=(0,l.E0)(C,M());b((0,d.mb)(C.rootStateKey,(0,m.e_)((0,o.Y6)(T,P)))),await b((0,g.MB)((0,o.yQ)(T),!0))},E=(C,P)=>async(b,M)=>{const T=(0,l.E0)(C,M());b((0,d.mb)(C.rootStateKey,(0,m.DO)((0,o.Y6)(T,P)))),await b((0,g.MB)((0,o.yQ)(T),!0))},h=(C,P)=>async(b,M)=>{const T=(0,l.E0)(C,M());b((0,d.mb)(C.rootStateKey,(0,m.QL)((0,o.Y6)(T,P)))),await b((0,g.MB)((0,o.yQ)(T),!0))},y=(C,P)=>async(b,M)=>{const T=(0,l.E0)(C,M());b((0,d.mb)(C.rootStateKey,(0,m.aM)((0,o.Y6)(T,P)))),await b((0,g.MB)((0,o.yQ)(T),!0))},v=(C,P)=>async(b,M)=>{const T=(0,l.E0)(C,M());b((0,d.mb)(C.rootStateKey,(0,u.Pl)((0,o.Y6)(T,{propName:"datasource",propValue:P}))));const x=(await(0,i.ak)().get(P))?.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.";b((0,d.mb)(C.rootStateKey,(0,s.z7)({infoText:x})))},D=C=>(P,b)=>{const M=(0,l.S_)(b()),T={...(0,t.cloneDeep)(m.Js),datasource:C.datasource,name:c,id:c,rootStateKey:M},S=!1,x=(0,l.Eo)(M,b()),O={type:"adhoc",id:T.id,rootStateKey:M};P((0,d.mb)(M,(0,u.VN)((0,o.Y6)(O,{global:S,model:T,index:x}))))},a=(C,P)=>{const b=(0,l.S_)(P),M=(0,l.AE)(b,P);return Object.values(M.variables).find(T=>(0,r.Kn)(T)&&T.datasource?.uid===C.datasource.uid)}},80280:(j,I,e)=>{"use strict";e.d(I,{F:()=>C});var t=e(27702),n=e(95578),i=e(65322),s=e(92472),r=e(73453),g=e(5926);const d=90,l=({datasource:P,onChange:b,disabled:M,filterKey:T,getTagKeysOptions:S})=>{const x=()=>c(P,S),O=()=>p(P,S);return T===null?t.createElement("div",{className:"gf-form","data-testid":"AdHocFilterKey-add-key-wrapper"},t.createElement(s.V,{disabled:M,className:"query-segment-key",Component:m,value:T,onChange:b,loadOptions:x,inputMinWidth:d})):t.createElement("div",{className:"gf-form","data-testid":"AdHocFilterKey-key-wrapper"},t.createElement(s.V,{disabled:M,className:"query-segment-key",value:T,onChange:b,loadOptions:O,inputMinWidth:d}))},u="-- remove filter --",o={label:u,value:u},m=t.createElement("span",{className:"gf-form-label query-part","aria-label":"Add Filter"},t.createElement(r.J,{name:"plus"})),c=async(P,b)=>{const M=await(0,g.ak)().get(P);return!M||!M.getTagKeys?[]:(await M.getTagKeys(b)).map(S=>({label:S.text,value:S.text}))},p=async(P,b)=>{const M=await c(P,b);return[o,...M]},f=({datasource:P,disabled:b,onChange:M,filterKey:T,filterValue:S,placeHolder:x})=>{const O=()=>E(P,T);return t.createElement("div",{className:"gf-form","data-testid":"AdHocFilterValue-value-wrapper"},t.createElement(s.V,{className:"query-segment-value",disabled:b,placeholder:x,value:S,onChange:M,loadOptions:O}))},E=async(P,b)=>{const M=await(0,g.ak)().get(P);return!M||!M.getTagValues?[]:(await M.getTagValues({key:b})).map(S=>({label:S.text,value:S.text}))},h=["=","!=","<",">","=~","!~"].map(P=>({label:P,value:P})),y=({value:P,disabled:b,onChange:M})=>t.createElement(n.X,{className:"query-segment-operator",value:P,disabled:b,options:h,onChange:M}),v=({datasource:P,filter:{key:b,operator:M,value:T},onKeyChange:S,onOperatorChange:x,onValueChange:O,placeHolder:B,getTagKeysOptions:A,disabled:V})=>t.createElement(t.Fragment,null,t.createElement(l,{disabled:V,datasource:P,filterKey:b,onChange:S,getTagKeysOptions:A}),t.createElement("div",{className:"gf-form"},t.createElement(y,{disabled:V,value:M,onChange:x})),t.createElement(f,{disabled:V,datasource:P,filterKey:b,filterValue:T,onChange:O,placeHolder:B})),D=({datasource:P,appendBefore:b,onCompleted:M,getTagKeysOptions:T})=>{const[S,x]=(0,t.useState)(null),[O,B]=(0,t.useState)("="),A=(0,t.useCallback)(w=>{if(w.value!==u){x(w.value??"");return}x(null)},[x]),V=(0,t.useCallback)(w=>B(w.value??""),[B]),W=(0,t.useCallback)(w=>{M({value:w.value??"",operator:O,condition:"",key:S}),x(null),B("=")},[M,O,S]);return S===null?t.createElement(l,{datasource:P,filterKey:S,onChange:A,getTagKeysOptions:T}):t.createElement(t.Fragment,{key:"filter-builder"},b,t.createElement(v,{datasource:P,filter:{key:S,value:"",operator:O,condition:""},placeHolder:(0,i.t)("variable.adhoc.placeholder","Select value"),onKeyChange:A,onOperatorChange:V,onValueChange:W,getTagKeysOptions:T}))},a=({label:P})=>t.createElement("div",{className:"gf-form"},t.createElement("span",{className:"gf-form-label query-keyword"},P));class C extends t.PureComponent{constructor(){super(...arguments),this.onChange=(b,M)=>T=>{const{filters:S}=this.props,{value:x}=T;return T.value===u?this.props.removeFilter(b):this.props.changeFilter(b,{...S[b],[M]:x})},this.appendFilterToVariable=b=>{this.props.addFilter(b)}}render(){const{filters:b,disabled:M}=this.props;return t.createElement("div",{className:"gf-form-inline"},this.renderFilters(b,M),!M&&t.createElement(D,{datasource:this.props.datasource,appendBefore:b.length>0?t.createElement(a,{label:"AND"}):null,onCompleted:this.appendFilterToVariable,getTagKeysOptions:this.props.getTagKeysOptions}))}renderFilters(b,M){return b.length===0&&M?t.createElement(n.X,{disabled:M,value:"No filters",options:[],onChange:()=>{}}):b.reduce((T,S,x)=>(T.length>0&&T.push(t.createElement(a,{label:"AND",key:`condition-${x}`})),T.push(this.renderFilterSegments(S,x,M)),T),[])}renderFilterSegments(b,M,T){return t.createElement(t.Fragment,{key:`filter-${M}`},t.createElement(v,{disabled:T,datasource:this.props.datasource,filter:b,onKeyChange:this.onChange(M,"key"),onOperatorChange:this.onChange(M,"operator"),onValueChange:this.onChange(M,"value"),getTagKeysOptions:this.props.getTagKeysOptions}))}}},26333:(j,I,e)=>{"use strict";e.d(I,{DO:()=>l,Js:()=>r,QL:()=>d,aM:()=>o,e_:()=>u,jo:()=>m});var t=e(34099),n=e(6230),i=e(51824),s=e(18918);const r={...n.Eg,type:"adhoc",datasource:null,filters:[]},g=(0,t.oM)({name:"templating/adhoc",initialState:s.s,reducers:{filterAdded:(c,p)=>{const f=(0,i.ir)(c,p.payload.id);f.type==="adhoc"&&f.filters.push(p.payload.data)},filterRemoved:(c,p)=>{const f=(0,i.ir)(c,p.payload.id);if(f.type!=="adhoc")return;const E=p.payload.data;f.filters.splice(E,1)},filterUpdated:(c,p)=>{const f=(0,i.ir)(c,p.payload.id);if(f.type!=="adhoc")return;const{filter:E,index:h}=p.payload.data;f.filters[h]=E},filtersRestored:(c,p)=>{const f=(0,i.ir)(c,p.payload.id);f.type==="adhoc"&&(f.filters=p.payload.data)}}}),{filterAdded:d,filterRemoved:l,filterUpdated:u,filtersRestored:o}=g.actions,m=g.reducer},80169:(j,I,e)=>{"use strict";e.d(I,{BH:()=>s,IG:()=>g,QX:()=>r,UY:()=>t,r2:()=>i,xk:()=>n});const t="00000000-0000-0000-0000-000000000000",n="All",i="$__all",s="None",r="",g="var-"},46241:(j,I,e)=>{"use strict";e.d(I,{R:()=>l,z:()=>d});var t=e(87911),n=e(27702),i=e(74639),s=e(66310),r=e(60105),g=e(62981);const d="Grafana-LegacyVariableQueryEditor",l=({onChange:u,query:o})=>{const m=(0,s.wW)(g.w),[c,p]=(0,n.useState)(o),f=y=>{p(y.currentTarget.value)},E=(0,n.useCallback)(y=>{u(y.currentTarget.value,y.currentTarget.value)},[u]),h=(0,t.Me)();return n.createElement(r.K,{id:h,rows:2,value:c,onChange:f,onBlur:E,placeholder:"Metric name or tags query",required:!0,"aria-label":i.wl.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsQueryInput,cols:52,className:m.textarea})};l.displayName=d},95774:(j,I,e)=>{"use strict";e.d(I,{e:()=>r});var t=e(42844),n=e(27702),i=e(66310),s=e(12375);function r({className:d,...l}){const u=(0,i.wW)(g);return n.createElement(s.D,{...l,className:(0,t.cx)(u.legend,d)})}function g(d){return{legend:(0,t.css)({marginTop:d.spacing(3),marginBottom:d.spacing(1)})}}},1781:(j,I,e)=>{"use strict";e.d(I,{u:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(22209),r=e(28580);function g({name:l,description:u,value:o,options:m,onChange:c,testId:p,width:f}){const E=(0,i.wW)(d),h=(0,n.useId)(),y=`variable-select-input-${l}-${h}`;return n.createElement(s.g,{label:l,description:u,htmlFor:y},n.createElement("div",{"data-testid":p},n.createElement(r.Ph,{inputId:y,onChange:c,value:o,width:f??30,options:m,className:E.selectContainer})))}function d(l){return{selectContainer:(0,t.css)` margin-right: ${l.spacing(.5)}; `}}},62981:(j,I,e)=>{"use strict";e.d(I,{W:()=>d,w:()=>l});var t=e(42844),n=e(87911),i=e(27702),s=e(66310),r=e(22209),g=e(60105);function d({value:u,name:o,description:m,placeholder:c,onChange:p,onBlur:f,ariaLabel:E,required:h,width:y,testId:v}){const D=(0,s.wW)(l),a=(0,n.Me)();return i.createElement(r.g,{label:o,description:m,htmlFor:a},i.createElement(g.K,{id:a,rows:2,value:u,onChange:p,onBlur:f,placeholder:c,required:h,"aria-label":E,cols:y,className:D.textarea,"data-testid":v}))}function l(u){return{textarea:(0,t.css)` white-space: pre-wrap; min-height: ${u.spacing(4)}; height: auto; overflow: auto; padding: ${u.spacing(.75,1)}; width: inherit; `}}},24446:(j,I,e)=>{"use strict";e.d(I,{V:()=>r});var t=e(87911),n=e(27702),i=e(22209),s=e(1128);function r({value:g,name:d,placeholder:l="",onChange:u,testId:o,width:m,required:c,onBlur:p,grow:f,description:E,invalid:h,error:y,maxLength:v}){const D=(0,t.Me)(d);return n.createElement(i.g,{label:d,description:E,invalid:h,error:y,htmlFor:D},n.createElement(s.I,{type:"text",id:D,placeholder:l,value:g,onChange:u,onBlur:p,width:f?void 0:m??30,"data-testid":o,maxLength:v,required:c}))}},39655:(j,I,e)=>{"use strict";e.d(I,{PF:()=>n,PV:()=>m,QR:()=>c,Sg:()=>o,Yo:()=>r,gl:()=>s,qe:()=>l,wJ:()=>d,y8:()=>g,z7:()=>u});var t=e(34099);const n={id:"",isValid:!0,errors:{},name:"",extended:null},i=(0,t.oM)({name:"templating/editor",initialState:n,reducers:{variableEditorMounted:(p,f)=>{p.name=f.payload.name,p.id=f.payload.id},variableEditorUnMounted:(p,f)=>n,changeVariableNameSucceeded:(p,f)=>{p.name=f.payload.data.newName,delete p.errors.name,p.isValid=Object.keys(p.errors).length===0},changeVariableNameFailed:(p,f)=>{p.name=f.payload.newName,p.errors.name=f.payload.errorText,p.isValid=Object.keys(p.errors).length===0},addVariableEditorError:(p,f)=>{p.errors[f.payload.errorProp]=f.payload.errorText,p.isValid=Object.keys(p.errors).length===0},removeVariableEditorError:(p,f)=>{delete p.errors[f.payload.errorProp],p.isValid=Object.keys(p.errors).length===0},changeVariableEditorExtended:(p,f)=>{p.extended={...p.extended,...f.payload}},cleanEditorState:()=>n}}),s=i.reducer,{changeVariableNameSucceeded:r,changeVariableNameFailed:g,variableEditorMounted:d,variableEditorUnMounted:l,changeVariableEditorExtended:u,addVariableEditorError:o,removeVariableEditorError:m,cleanEditorState:c}=i.actions},75627:(j,I,e)=>{"use strict";e.d(I,{c:()=>s});var t=e(39317),n=e(41355),i=e(80169);function s(r){const g={},d=(0,t.J)().getVariables();for(let l=0;l<d.length;l++){const u=d[l],o=r&&r[u.name];u.skipUrlSync||(o?g[i.IG+u.name]=o.value:g[i.IG+u.name]=n.z.get(u.type).getValueForUrl(u))}return g}},5399:(j,I,e)=>{"use strict";e.d(I,{$7:()=>E,Ju:()=>m,Kn:()=>s,Kr:()=>l,NX:()=>f,R:()=>o,U4:()=>g,VC:()=>r,X7:()=>p,Xh:()=>i,d7:()=>c,eL:()=>d});var t=e(79726),n=e(46241);const i=h=>h.type==="query",s=h=>h.type==="adhoc",r=h=>h.type==="constant",g=h=>"multi"in h,d=h=>"options"in h,l=h=>"current"in h;function u(h){return h===null?!1:typeof h=="string"}const o=h=>!!h.metricFindQuery&&!h.variables,m=h=>{if(!h.variables||h.variables.getType()!==t.j2.Standard)return!1;const y=h.variables;return"toDataQuery"in y&&!!y.toDataQuery},c=h=>{if(!h.variables||h.variables.getType()!==t.j2.Custom)return!1;const y=h.variables;return"query"in y&&"editor"in y&&!!y.query&&!!y.editor},p=h=>h.variables?h.variables.getType()===t.j2.Datasource:!1;function f(h,y){return h?h.displayName===n.z||o(y):!1}function E(h,y){return h?h.displayName!==n.z&&(p(y)||m(y)||c(y)):!1}},24877:(j,I,e)=>{"use strict";e.d(I,{Kf:()=>n,iV:()=>s,j4:()=>r});var t=e(34099);const n={usages:[],usagesNetwork:[]},i=(0,t.oM)({name:"templating/inspect",initialState:n,reducers:{initInspect:(g,d)=>{const{usages:l,usagesNetwork:u}=d.payload;g.usages=l,g.usagesNetwork=u}}}),s=i.reducer,{initInspect:r}=i.actions},44068:(j,I,e)=>{"use strict";e.d(I,{MJ:()=>m,GQ:()=>u,V:()=>h,Of:()=>o,PQ:()=>D,dH:()=>S,Yg:()=>y,Rv:()=>M,vI:()=>P});var t=e(3569);function n(x,O){const B=new Set;for(const A of x)B.add(O(A));return B}var i=e(89167),s=e(89024),r=e(73170),g=e(41355),d=e(5399),l=e(81587);const u=x=>{const O=[];for(const B of x)O.push({id:B.id,label:`${B.id}`});return O},o=(x,O)=>x.filter(B=>O.some(A=>A.from===B.id||A.to===B.id)),m=x=>{const O=[];for(const B of x)for(const A of x){if(B===A)continue;g.z.get(B.type).dependsOn(B,A)&&O.push({from:B.id,to:A.id})}return O};function c(x){const O=(0,l.a9)(x);return O?O.slice(1).find(A=>A!==void 0):void 0}const p=(x,O)=>{l.J7.lastIndex=0;const B=[],V=(0,s.Xh)(O,2).match(l.J7);if(!V)return B;for(const W of V){if(!W||W.indexOf("$__")!==-1||W.indexOf("${__")!==-1||W.indexOf("$hashKey")!==-1)continue;const w=c(W);x.some(N=>N.id===w)||B.find(N=>N===w)||w&&B.push(w)}return B},f={alias:[/^m$/,/^measurement$/,/^col$/,/^tag_(\w+|\d+)$/],query:[/^timeFilter$/]},E=(x,O,B)=>{const A=Object.keys(O.value).reduce((W,w)=>{const N=O.value[w];if(!N||typeof N!="string")return W;const F=f[w]?f[w].find(H=>H.test(x)):void 0;let k=(0,l.QI)(N,x);return w==="repeat"&&N===x&&(k=!0),!F&&k&&(W={...W,[w]:N}),W},{}),V=Object.keys(O.value).reduce((W,w)=>{const N=O.value[w];if(N&&typeof N=="object"&&Object.keys(N).length){let F=N.title||N.name||N.id||w;Array.isArray(O.value)&&O.key==="panels"&&(F=`${F}[${N.id}]`);const k=E(x,{key:w,value:N},{});Object.keys(k).length&&(W={...W,[F]:k})}return W},{});return(Object.keys(A).length||Object.keys(V).length)&&(B={...B,...A,...V}),B},h=(x,O)=>{if(!O)return{unUsed:[],usages:[]};const B=[];let A=[];const V=O.getSaveModelClone();for(const W of x){const w=W.id,N=E(w,{key:"model",value:V},{});!Object.keys(N).length&&!(0,d.Kn)(W)&&B.push(W),Object.keys(N).length&&A.push({variable:W,tree:N})}return{unUsed:B,usages:A}};async function y(x,O){return new Promise((B,A)=>{setTimeout(()=>{try{const V=v(x,O);B(P(V))}catch(V){A(V)}},200)})}function v(x,O){if(!O)return[];let B=[];const A=O.getSaveModelClone(),V=p(x,A);for(const W of V){const w=E(W,{key:"model",value:A},{});if(Object.keys(w).length){const N={id:W,name:W};B.push({variable:N,tree:w})}}return B}function D(x,O,B){const A=n(O.descendants(x),W=>W.name);A.add(t.W.includeVars);for(const W of x)A.add(W);return a([...A],B)}function a(x,O){const B=[];for(const A of x)O[A]&&B.push(...O[A]);return new Set(B)}const C=(x,O)=>{const{id:B,value:A}=O,{nodes:V,edges:W}=x;if(A&&typeof A=="string"){const w=`${O.id}-${A}`;return V.push({id:w,label:A}),W.push({from:w,to:B}),x}if(A&&typeof A=="object"){const w=Object.keys(A);for(const N of w){const F=`${O.id}-${N}`;V.push({id:F,label:N}),W.push({from:F,to:B}),x=C(x,{id:F,value:A[N]})}return x}return x},P=x=>{const O=[];for(const B of x){const{variable:A,tree:V}=B,W={variable:A,nodes:[{id:"dashboard",label:"dashboard"}],edges:[],showGraph:!1};O.push(C(W,{id:"dashboard",value:V}))}return O},b=x=>Object.values(x).reduce((B,A)=>typeof A=="object"?B+b(A):B+1,0),M=(x,O)=>{const B=O.find(A=>A.variable.id===x);return B?b(B.tree):0};function T(x){const O=[];for(const B of x)O.push(B),B.panels?.length&&O.push(...T(B.panels.map(A=>new PanelModel(A))));return O}function S(x){const O={};for(const B of x){const A=(0,i.Jg)(B),V=[...A.matchAll(/"repeat":"([^"]+)"/g)].map(N=>N[1]),W=A.match(l.J7)?.map(N=>c(N))??[],w=[...V,...W];for(const N of w)N in O?O[N].add(B.id):O[N]=new Set([B.id])}return O}},44042:(j,I,e)=>{"use strict";e.d(I,{XJ:()=>M,nn:()=>v,yy:()=>d,Ew:()=>D,cv:()=>T,aN:()=>y,iQ:()=>a,_M:()=>h,ss:()=>P,wF:()=>b,Ug:()=>C});var t=e(34099),n=e(89949),i=e(83505);const s=(S,...x)=>x.reduce((O,B)=>B(O),S);var r=e(80169),g=e(5399);const d={id:"",highlightIndex:-1,queryValue:"",selectedValues:[],options:[],multi:!1},l=1e3,u=S=>Array.isArray(S)?S.reduce((x,O)=>((0,n.isString)(O.value)&&(x[O.value]=O),x),{}):{},o=S=>{if(!Array.isArray(S.options))return S.options=[],S;const x=u(S.selectedValues);return S.selectedValues=Object.values(x),S.options=S.options.map(O=>{if(!(0,n.isString)(O.value))return O;const B=!!x[O.value];return O.selected===B?O:{...O,selected:B}}),S.options=m(S.options),S},m=S=>Array.isArray(S)?S.length<=l?S:S.slice(0,l):[],c=S=>{const{options:x,selectedValues:O}=S;return x.length===0||O.length>0||!x[0]||x[0].value!==r.r2||(S.selectedValues=[{...x[0],selected:!0}]),S},p=S=>{const{selectedValues:x}=S;return x.length>1&&(S.selectedValues=x.filter(O=>O.value!==r.r2)),S},f=S=>S.filter(x=>x.value!==r.r2).map(x=>({...x,selected:!0})),E=(0,t.oM)({name:"templating/optionsPicker",initialState:d,reducers:{showOptions:(S,x)=>{const{query:O,options:B}=x.payload;if(S.highlightIndex=-1,S.options=(0,n.cloneDeep)(B),S.id=x.payload.id,S.queryValue="",S.multi=!1,(0,g.U4)(x.payload)&&(S.multi=x.payload.multi??!1),(0,g.Xh)(x.payload)){const{queryValue:A}=x.payload,V=(0,i.b)(O);S.queryValue=V&&A?A:""}return S.selectedValues=S.options.filter(A=>A.selected),s(S,c,o)},hideOptions:(S,x)=>({...d}),toggleOption:(S,x)=>{const{option:O,clearOthers:B,forceSelect:A}=x.payload,{multi:V,selectedValues:W}=S;if(O){const w=!W.find(N=>N.value===O.value&&N.text===O.text);if(O.value===r.r2||!V||B)return w||A?S.selectedValues=[{...O,selected:!0}]:S.selectedValues=[],s(S,c,p,o);if(A||w)return S.selectedValues.push({...O,selected:!0}),s(S,c,p,o);S.selectedValues=W.filter(N=>N.value!==O.value&&N.text!==O.text)}else S.selectedValues=[];return s(S,c,p,o)},moveOptionsHighlight:(S,x)=>{let O=S.highlightIndex+x.payload;return O<0?O=-1:O>=S.options.length&&(O=S.options.length-1),{...S,highlightIndex:O}},toggleAllOptions:(S,x)=>{const O=S.selectedValues.find(A=>A.value===r.r2),B=S.options.find(A=>A.value===r.r2);return S.selectedValues.length>0&&B&&!O?(S.selectedValues=[],S.selectedValues.push({text:B.text??"All",value:B.value,selected:!0}),s(S,o)):O&&S.selectedValues.length===1?(S.selectedValues=f(S.options),s(S,o)):S.selectedValues.length>0&&!B?(S.selectedValues=[],s(S,o)):(S.selectedValues=f(S.options),s(S,o))},updateSearchQuery:(S,x)=>(S.queryValue=x.payload,S),updateOptionsAndFilter:(S,x)=>{const O=(0,n.trimStart)((S.queryValue??"").toLowerCase());return S.options=x.payload.filter(B=>{const A=B.text??"";return(Array.isArray(A)?A.toString():A).toLowerCase().indexOf(O)!==-1}),S.highlightIndex=0,s(S,c,o)},updateOptionsFromSearch:(S,x)=>(S.options=x.payload,S.highlightIndex=0,s(S,c,o)),cleanPickerState:()=>d}}),{toggleOption:h,showOptions:y,hideOptions:v,moveOptionsHighlight:D,toggleAllOptions:a,updateSearchQuery:C,updateOptionsAndFilter:P,updateOptionsFromSearch:b,cleanPickerState:M}=E.actions,T=E.reducer},21791:(j,I,e)=>{"use strict";e.d(I,{x:()=>t});const t=(s,r)=>s&&(r&&!Array.isArray(s.value)?{...s,value:i(s.value),text:i(s.text)}:!r&&Array.isArray(s.value)?{...s,value:n(s.value),text:n(s.text)}:s),n=s=>Array.isArray(s)?s.length>0?s[0]:"":s,i=s=>Array.isArray(s)?s:[s]},4684:(j,I,e)=>{"use strict";e.d(I,{Ci:()=>X,DU:()=>ae,Fz:()=>Z,LX:()=>ce,MB:()=>oe,Rk:()=>we,Z7:()=>F,wX:()=>et,xQ:()=>se,xs:()=>De});var t=e(89949),n=e.n(t),i=e(59421),s=e(53933),r=e(17312),g=e(26129),d=e(34667),l=e(33877),u=e(91368),o=e(26858),m=e(84749),c=e(73807),p=e(66574),f=e(45937),E=e(2567),h=e(5926),y=e(99386),v=e(41355),D=e(80169),a=e(39655),C=e(5399),P=e(44068),b=e(44042),M=e(21791),T=e(6230),S=e(81587),x=e(1941),O=e(51824),B=e(60344),A=e(67273),V=e(96637);const W=(Me,be)=>(Ke,Ye)=>{let tt=0;const nt=be.templating.list;for(let xt=0;xt<nt.length;xt++){const bt=w(nt[xt]);bt.rootStateKey=Me,v.z.getIfExists(bt.type)&&Ke((0,x.mb)(Me,(0,B.VN)((0,S.Y6)(bt,{global:!1,index:tt++,model:bt}))))}(0,y.J)().updateTimeRange((0,o.$t)().timeRange());const Pt=(0,O.gt)(Me,Ye());for(const xt of Pt)Ke((0,x.mb)(Me,(0,B.Mn)((0,S.Y6)(xt))))};function w(Me){if(!(0,C.eL)(Me))return Me;let be=!1;for(const Ke of Me.options)if(Ke.selected=!1,Array.isArray(Me.current.value))for(const Ye of Me.current.value)Ke.value===Ye&&(Ke.selected=be=!0);else Ke.value===Me.current.value&&(Ke.selected=be=!0);return!be&&Me.options.length&&(Me.options[0].selected=!0),Me}const N=(Me,be)=>Ke=>{const Ye={...T.Eg,id:"__dashboard",name:"__dashboard",type:"system",index:-3,skipUrlSync:!0,hide:T.bU.hideVariable,current:{value:{name:be.title,uid:be.uid,toString:()=>be.title}}};Ke((0,x.mb)(Me,(0,B.VN)((0,S.Y6)(Ye,{global:Ye.global,index:Ye.index,model:Ye}))));const tt={...T.Eg,id:"__org",name:"__org",type:"system",index:-2,skipUrlSync:!0,hide:T.bU.hideVariable,current:{value:{name:u.contextSrv.user.orgName,id:u.contextSrv.user.orgId,toString:()=>u.contextSrv.user.orgId.toString()}}};Ke((0,x.mb)(Me,(0,B.VN)((0,S.Y6)(tt,{global:tt.global,index:tt.index,model:tt}))));const nt={...T.Eg,id:"__user",name:"__user",type:"system",index:-1,skipUrlSync:!0,hide:T.bU.hideVariable,current:{value:{login:u.contextSrv.user.login,id:u.contextSrv.user.id,email:u.contextSrv.user.email,toString:()=>u.contextSrv.user.id.toString()}}};Ke((0,x.mb)(Me,(0,B.VN)((0,S.Y6)(nt,{global:nt.global,index:nt.index,model:nt}))))},F=(Me,be)=>(Ke,Ye)=>{const{rootStateKey:tt}=Me,nt=(0,O.E0)(Me,Ye());if(!(0,C.U4)(nt)||(0,i.Q)(nt.current))return;const Pt=(0,M.x)(nt.current,be);Ke((0,x.mb)(tt,(0,B.Pl)((0,S.Y6)(Me,{propName:"multi",propValue:be})))),Ke((0,x.mb)(tt,(0,B.Pl)((0,S.Y6)(Me,{propName:"current",propValue:Pt}))))},k=async(Me,be)=>{if(!Me.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${Me.id}`);if(H(Me,be))throw new Error("Circular dependency in dashboard variables detected. Dashboard may not work as expected.");const Ke=R(Me,be);_(Me.rootStateKey,Ke,be)&&await new Promise(Ye=>{const tt=m.h.subscribe(()=>{if(!Me.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${Me.id}`);_(Me.rootStateKey,Ke,m.h.getState())||(tt(),Ye())})})},H=(Me,be,Ke=new Set)=>Ke.has(Me.id)?!0:(Ke=new Set([...Ke,Me.id]),R(Me,be).some(Ye=>H(Ye,be,Ke))),R=(Me,be)=>{if(!Me.rootStateKey)return[];const Ke=[];for(const Ye of(0,O.gt)(Me.rootStateKey,be))Me!==Ye&&v.z.getIfExists(Me.type)&&v.z.get(Me.type).dependsOn(Me,Ye)&&Ke.push(Ye);return Ke},_=(Me,be,Ke)=>{if(be.length===0)return!1;const Ye=(0,O.gt)(Me,Ke);return be.filter(nt=>Ye.some(Pt=>Pt.id===nt.id&&(Pt.state===s.Gu.NotStarted||Pt.state===s.Gu.Loading))).length>0},G=(Me,be)=>async(Ke,Ye)=>{const tt=(0,O.E0)(Me,Ye());await k(tt,Ye());const nt=be[D.IG+tt.name];if(nt!==void 0){const Pt=(0,S.Hi)(nt);await v.z.get(tt.type).setValueFromUrl(tt,Pt);return}if(tt.hasOwnProperty("refresh")){const Pt=tt;if(Pt.refresh===T.Bd.onDashboardLoad||Pt.refresh===T.Bd.onTimeRangeChanged){await Ke(we((0,S.yQ)(Pt)));return}}Ke(Ge(Me))},Y=Me=>async(be,Ke)=>{const Ye=g.E1.getSearchObject(),tt=(0,O.gt)(Me,Ke()).map(async nt=>await be(G((0,S.yQ)(nt),Ye)));await Promise.all(tt)},X=(Me,be)=>async(Ke,Ye)=>{const tt=(0,S.Hi)(be),nt=(0,O.E0)(Me,Ye());(0,S.iD)(nt)!==T.Bd.never&&await Ke(we((0,S.yQ)(nt)));const Pt=(0,O.E0)((0,S.yQ)(nt),Ye());if(!(0,C.eL)(Pt))return;if(!Pt)throw new Error(`Couldn't find variable with name: ${nt.name}`);let xt=Pt.options.find(bt=>bt.text===tt||bt.value===tt);if(!xt&&(0,C.U4)(Pt)&&Pt.allValue&&tt===Pt.allValue&&(xt={text:D.xk,value:D.r2,selected:!1}),!xt){let bt=tt;const Rt=tt;Array.isArray(tt)&&(bt=tt.reduce((ct,it)=>{const me=Pt.options.find(Ee=>Ee.value===it);return me?[].concat(ct,[me.text]):[].concat(ct,[it])},[])),xt={text:bt,value:Rt,selected:!1}}(0,C.U4)(Pt)&&(xt=(0,M.x)({text:(0,t.castArray)(xt.text),value:(0,t.castArray)(xt.value),selected:!1},Pt.multi)),await v.z.get(nt.type).setValue(Pt,xt)},Q=Me=>{let be,Ke,Ye,tt;const nt=[];for(be=0;be<Me.options.length;be++)if(tt={...Me.options[be]},tt.selected=!1,Array.isArray(Me.current.value))for(Ke=0;Ke<Me.current.value.length;Ke++)Ye=Me.current.value[Ke],tt.value===Ye&&(tt.selected=!0,nt.push(tt));else tt.value===Me.current.value&&(tt.selected=!0,nt.push(tt));return nt},se=(Me,be)=>(Ke,Ye)=>{const tt=(0,O.E0)(Me,Ye());if(!(0,C.eL)(tt))return Promise.resolve();const nt=tt.current||{},Pt=v.z.get(tt.type).setValue;if(Array.isArray(nt.value)){const ct=Q(tt);if(ct.length===0){const me=tt.options[0];return Pt(tt,me)}const it={value:ct.map(me=>me.value),text:ct.map(me=>me.text),selected:!0};return Pt(tt,it)}let xt=null;const bt=(0,S.Tt)(tt),Rt=(0,S.N9)(tt);if(xt=tt.options?.find(ct=>ct.text===bt||ct.value===Rt),xt||be&&(xt=tt.options?.find(ct=>ct.text===be||ct.value===be),xt))return Pt(tt,xt);if(tt.options){const ct=tt.options[0];if(ct)return Pt(tt,ct)}return Promise.resolve()},Z=(Me,be,Ke)=>async Ye=>{const{rootStateKey:tt}=Me;return Ye((0,x.mb)(tt,(0,B.Q8)((0,S.Y6)(Me,{option:be})))),await Ye(oe(Me,Ke))},le=Me=>{const be=new E.kJ;return Me.forEach(Ke=>{be.createNode(Ke.name)}),Me.forEach(Ke=>{Me.forEach(Ye=>{Ke!==Ye&&v.z.get(Ke.type).dependsOn(Ke,Ye)&&be.link(Ke.name,Ye.name)})}),be},oe=(Me,be,Ke=p.h$)=>async(Ye,tt)=>{const nt=tt(),{rootStateKey:Pt}=Me,xt=(0,O.E0)(Me,nt);if((0,O.AE)(Pt,nt).transaction.status===T.LN.Fetching)return(0,S.iD)(xt)===T.Bd.never&&(await Ye(qe((0,S.yQ)(xt))),Ye(Ge(Me))),Promise.resolve();const bt=(0,O.gt)(Pt,nt),Rt=le(bt),ct=nt.dashboard?.getModel()?.panels??[],it=(0,P.dH)(ct),me=(0,C.Kn)(xt)?{refreshAll:!0,panelIds:[]}:{refreshAll:!1,panelIds:Array.from((0,P.PQ)([xt.id],Rt,it))},Ee=Rt.getNode(xt.name);let Ce=[];return Ee&&(Ce=Ee.getOptimizedInputEdges().map(Ae=>{const ze=bt.find(Ie=>Ie.name===Ae.inputNode?.name);return ze?Ye(we((0,S.yQ)(ze))):Promise.resolve()})),Promise.all(Ce).then(()=>{be&&(Ke.publish(new T.x9(me)),g.E1.partial(ye(Pt,tt)))})},q=(Me,be,Ke,Ye)=>(be.includes(Me.name)||be.push(Me.name),Me.outputEdges.forEach(tt=>{const nt=tt.outputNode;if(nt&&!be.includes(nt.name)){const Pt=Ke.find(xt=>xt.name===nt.name);Pt&&Pt.refresh===T.Bd.onTimeRangeChanged&&Ye.indexOf(Pt)===-1?(Ye.push(Pt),be.push(nt.name)):q(nt,be,Ke,Ye)}}),Ye),ne=(Me,be)=>{const Ke=(0,O.gt)(Me,be),Ye=le(Ke),tt=[],nt=[];return Ke.forEach(Pt=>{const xt=Ye.getNode(Pt.name);if(!tt.includes(Pt.name)&&xt){const bt=Ke.find(ct=>ct.name===xt.name),Rt=bt&&bt.refresh===T.Bd.onTimeRangeChanged;Rt&&xt.outputEdges.length===0&&nt.push(bt),Rt&&nt.includes(bt)&&xt.outputEdges.length>0&&(nt.push(bt),q(xt,tt,Ke,nt)),bt&&bt.refresh&&bt.refresh!==T.Bd.onTimeRangeChanged&&q(xt,tt,Ke,nt)}}),nt},ge=(Me,be)=>(0,O.gt)(Me,be).filter(tt=>tt.hasOwnProperty("refresh")&&tt.hasOwnProperty("options")?tt.refresh===T.Bd.onTimeRangeChanged:!1),ae=(Me,be,Ke={templateSrv:(0,y.J)(),events:p.h$})=>async(Ye,tt)=>{Ke.templateSrv.updateTimeRange(be);let nt=[];d.config.featureToggles.refactorVariablesTimeRange?nt=ne(Me,tt()):nt=ge(Me,tt());const Pt=nt.map(bt=>bt.id),xt=nt.map(bt=>Ye(re((0,S.yQ)(bt))));try{await Promise.all(xt),Ke.events.publish(new T.eq({variableIds:Pt}))}catch(bt){console.error(bt),Ye((0,l.$l)(_e("Template variable service failed",bt)))}},re=Me=>async(be,Ke)=>{const Ye=(0,O.E0)(Me,Ke());if(!(0,C.eL)(Ye))return;const tt=Ye.options.slice();await be(we((0,S.yQ)(Ye),!0));const nt=(0,O.E0)(Me,Ke());if(!(0,C.eL)(nt))return;const Pt=nt.options;JSON.stringify(tt)!==JSON.stringify(Pt)&&Ke().dashboard.getModel()?.templateVariableValueUpdated()},De=(Me,be,Ke=p.h$)=>async(Ye,tt)=>{const nt=[],Pt=tt().dashboard.getModel(),xt=(0,O.gt)(Me,tt());for(const me of xt){const Ee=D.IG+me.name;if(!be.hasOwnProperty(Ee)||!he(me,be[Ee].value))continue;let Ce=be[Ee].value;if(be[Ee].removed){const ze=Pt?.templating.list.find(Ie=>Ie.name===me.name);ze&&(0,C.Kr)(ze)&&(Ce=ze.current.value),ze&&(0,C.VC)(ze)&&(Ce=ze.query)}const Ae=v.z.get(me.type).setValueFromUrl(me,Ce);nt.push(Ae)}const bt=xt.filter(me=>{const Ee=D.IG+me.name;return be.hasOwnProperty(Ee)&&he(me,be[Ee].value)&&!(0,C.Kn)(me)}),Rt=le(xt),ct=(0,P.dH)(Pt?.panels??[]),it=(0,P.PQ)(bt.map(me=>me.id),Rt,ct);nt.length&&(await Promise.all(nt),Ke.publish(new T.Wy({refreshAll:it.size===0,panelIds:Array.from(it)})))};function he(Me,be){const Ke=v.z.get(Me.type).getValueForUrl(Me);let Ye=(0,S.Hi)(be);return Array.isArray(Ke)&&!Array.isArray(Ye)&&(Ye=[Ye]),!(0,t.isEqual)(Ke,Ye)}const ye=(Me,be)=>{const Ke=g.E1.getSearchObject(),Ye=Object.keys(Ke).filter(tt=>tt.indexOf(D.IG)===-1).reduce((tt,nt)=>(tt[nt]=Ke[nt],tt),{});for(const tt of(0,O.gt)(Me,be())){if(tt.skipUrlSync)continue;const nt=v.z.get(tt.type);Ye[D.IG+tt.name]=nt.getValueForUrl(tt)}return Ye},ce=(Me,be)=>async(Ke,Ye)=>{try{const tt=(0,S.mn)(Me),nt=Ye(),Pt=(0,O.cp)(nt);Pt&&(0,O.AE)(Pt,nt).transaction.status===T.LN.Fetching&&Ke(et(Pt)),Ke((0,x.mb)(tt,(0,A.Z9)({uid:tt}))),Ke(N(tt,be)),Ke(W(tt,be)),Ke(We(tt)),await Ke(Y(tt)),Ke((0,x.mb)(tt,(0,A.iv)({uid:tt})))}catch(tt){Ke((0,l.$l)(_e("Templating init failed",tt))),console.error(tt)}};function We(Me,be=h.ak){return(Ke,Ye)=>{const tt=(0,O.gt)(Me,Ye());for(const nt of tt){if(!(0,C.Kn)(nt)&&!(0,C.Xh)(nt))continue;const{datasource:Pt}=nt;if((0,r.cv)(Pt))continue;const xt=be().getInstanceSettings(Pt),bt=xt?(0,r.iU)(xt):{uid:Pt};Ke((0,x.mb)(Me,(0,B.Pl)((0,S.Y6)(nt,{propName:"datasource",propValue:bt}))))}}}const ke=Me=>be=>{be((0,x.mb)(Me,(0,V.S)())),be((0,x.mb)(Me,(0,a.QR)())),be((0,x.mb)(Me,(0,b.XJ)())),be((0,x.mb)(Me,(0,A.p3)()))},et=(Me,be={getBackendSrv:f.i})=>Ke=>{be.getBackendSrv().cancelAllInFlightRequests(),Ke(ke(Me))},we=(Me,be=!1)=>async(Ke,Ye)=>{const{rootStateKey:tt}=Me;try{if(!(0,S.A3)(tt,Ye()))return;const nt=(0,O.E0)(Me,Ye());Ke((0,x.mb)(tt,(0,B.$M)((0,S.Y6)(nt)))),await Ke(qe((0,S.yQ)(nt))),await v.z.get(nt.type).updateOptions(nt),Ke(Ge(Me))}catch(nt){if(Ke((0,x.mb)(tt,(0,B.Le)((0,S.Y6)(Me,{error:nt})))),be||(console.error(nt),Ke((0,l.$l)(_e("Error updating options:",nt,Me)))),be)throw nt}},_e=(Me,be,Ke)=>(0,c.t_)(`${Ke?`Templating [${Ke.id}]`:"Templating"}`,`${Me} ${be.message}`),Ge=Me=>(be,Ke)=>{const{rootStateKey:Ye}=Me;if(!(0,S.A3)(Ye,Ke()))return;const tt=(0,O.E0)(Me,Ke());tt.state!==s.Gu.Done&&be((0,x.mb)(Me.rootStateKey,(0,B.qQ)((0,S.Y6)(tt))))};function qe(Me,be=h.ak){return async function(Ke,Ye){const{id:tt,rootStateKey:nt}=Me;if(!(0,S.A3)(nt,Ye()))return;const Pt=(0,O.E0)(Me,Ye());if(Pt.type==="query")try{const xt=await be().get(Pt.datasource??"");if((0,C.R)(xt)||!(0,C.Ju)(xt)||st(Pt.query))return;const bt={refId:`${xt.name}-${tt}-Variable-Query`,query:Pt.query};Ke((0,x.mb)(nt,(0,B.Pl)((0,S.Y6)(Me,{propName:"query",propValue:bt}))))}catch(xt){Ke((0,l.$l)(_e("Failed to upgrade legacy queries",xt))),console.error(xt)}}}function st(Me){return Me?Me.hasOwnProperty("refId")&&typeof Me.refId=="string":!1}},1941:(j,I,e)=>{"use strict";e.d(I,{ZP:()=>u,mb:()=>g,qM:()=>s});var t=e(81587),n=e(14836),i=e(67273);const s={keys:{}},r=o=>({type:`templating/keyed/${o.action.type.replace(/^templating\//,"")}`,payload:o});function g(o,m){const c=(0,t.mn)(o);return r({key:c,action:m})}const d=o=>typeof o.type=="string"&&o.type.startsWith("templating/keyed")&&"payload"in o&&typeof o.payload.key=="string";function l(o=s,m){if(d(m)){const{key:c,action:p}=m.payload,f=(0,t.mn)(c),E=i.Z9.match(p)?f:o.lastKey,h=(0,n.Q)(),y=o.keys[f],v=h(y,p);return{...o,lastKey:E,keys:{...o.keys,[f]:v}}}return o}const u={templating:l}},14836:(j,I,e)=>{"use strict";e.d(I,{L:()=>o,Q:()=>u});var t=e(33199),n=e(39655),i=e(24877),s=e(44042),r=e(67273),g=e(18918),d=e(96637);let l;function u(){return l||(l=(0,t.combineReducers)({editor:n.gl,variables:d.L,optionsPicker:s.cv,transaction:r.vw,inspect:i.iV})),l}function o(){return{editor:n.PF,variables:g.s,optionsPicker:s.yy,transaction:r.xO,inspect:i.Kf}}},51824:(j,I,e)=>{"use strict";e.d(I,{AE:()=>d,E0:()=>r,Eo:()=>c,IV:()=>o,Q4:()=>y,QT:()=>p,S_:()=>h,_K:()=>D,cp:()=>E,gt:()=>l,ir:()=>a,ng:()=>v,xD:()=>m});var t=e(82152),n=e(84749),i=e(81587),s=e(14836);function r(C,P=(0,n.y0)(),b=!0){const{id:M,rootStateKey:T}=C,x=d(T,P).variables[M];if(!x){if(b)throw new Error(`Couldn't find variable with id:${M}`);return}return x}function g(C,P,b=(0,n.y0)()){return Object.values(d(P,b).variables).filter(C).sort((M,T)=>M.index-T.index)}function d(C,P=(0,n.y0)()){return P.templating.keys[(0,i.mn)(C)]??(0,s.L)()}function l(C,P=(0,n.y0)()){return g(u,C,P)}function u(C){return C.type!=="system"}const o=(0,t.Z)((C,P)=>l(C,(0,n.y0)())),m=(C,P)=>l(C,P);function c(C,P=(0,n.y0)()){return p(Object.values(d(C,P).variables))}function p(C){const P=C.filter(u).sort((b,M)=>b.index-M.index);return P.length>0?P[P.length-1].index+1:0}function f(C,P=getState()){return d(C,P).transaction.isDirty}function E(C=(0,n.y0)()){return C.templating?.lastKey}function h(C=(0,n.y0)()){if(!C.templating?.lastKey)throw new Error("Accessing lastKey without initializing it variables");return C.templating.lastKey}function y(C,P=(0,n.y0)()){const b=E(P);return b?g(C,b,P):[]}function v(C=(0,n.y0)()){const P=E(C);return P?l(P,C):[]}function D(C,P=(0,n.y0)()){const b=E(P);if(b)return r({id:C,rootStateKey:b,type:"query"},P,!1)}function a(C,P){return C[P]}},60344:(j,I,e)=>{"use strict";e.d(I,{$M:()=>C,Be:()=>D,Le:()=>b,Mn:()=>a,Pl:()=>E,Q8:()=>v,VN:()=>f,Y9:()=>y,b5:()=>c,gE:()=>h,mZ:()=>p,qQ:()=>P});var t=e(34099),n=e(89949),i=e.n(n),s=e(53933),r=e(41355),g=e(39655),d=e(5399),l=e(81587),u=e(51824),o=e(18918);const m=(0,t.oM)({name:"templating/shared",initialState:o.s,reducers:{addVariable:(M,T)=>{const S=T.payload.id??T.payload.data.model.name,x=r.z.get(T.payload.type),O=(0,n.cloneDeep)(x.initialState),B=x.beforeAdding?x.beforeAdding(T.payload.data.model):(0,n.cloneDeep)(T.payload.data.model),A={...(0,n.defaults)({},B,O),id:S,index:T.payload.data.index,global:T.payload.data.global};M[S]=A},variableStateNotStarted:(M,T)=>{const S=(0,u.ir)(M,T.payload.id);S.state=s.Gu.NotStarted,S.error=null},variableStateFetching:(M,T)=>{const S=(0,u.ir)(M,T.payload.id);S.state=s.Gu.Loading,S.error=null},variableStateCompleted:(M,T)=>{const S=(0,u.ir)(M,T.payload.id);S&&(S.state=s.Gu.Done,S.error=null)},variableStateFailed:(M,T)=>{const S=(0,u.ir)(M,T.payload.id);S&&(S.state=s.Gu.Error,S.error=T.payload.data.error)},removeVariable:(M,T)=>{if(delete M[T.payload.id],!T.payload.data.reIndex)return;const S=Object.values(M).sort((x,O)=>x.index-O.index);for(let x=0;x<S.length;x++)S[x].index=x},duplicateVariable:(M,T)=>{function S(F){return F.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const x=(0,n.cloneDeep)(M[T.payload.id]),O=new RegExp(`^copy_of_${S(x.name)}(_(\\d+))?$`),B=Object.values(M).map(({name:F})=>F.match(O)).filter(F=>F!=null),A=B.map(F=>F[2]).filter(F=>F!=null),V=(()=>B.length===0?null:A.length===0?1:A.map(F=>+F).sort((F,k)=>k-F)[0]+1)(),W=`copy_of_${x.name}${V?`_${V}`:""}`,w=T.payload.data?.newId??W,N=(0,u.QT)(Object.values(M));M[w]={...(0,n.cloneDeep)(r.z.get(T.payload.type).initialState),...x,id:w,name:W,index:N}},changeVariableOrder:(M,T)=>{const{toIndex:S,fromIndex:x}=T.payload.data,O=Object.values(M);for(let B=0;B<O.length;B++){const A=O[B];A.index===x?A.index=S:A.index>x&&A.index<=S?A.index--:A.index<x&&A.index>=S&&A.index++}},changeVariableType:(M,T)=>{const{id:S}=T.payload,{label:x,name:O,index:B,description:A,rootStateKey:V}=M[S];M[S]={...(0,n.cloneDeep)(r.z.get(T.payload.data.newType).initialState),id:S,rootStateKey:V,label:x,name:O,index:B,description:A}},setCurrentVariableValue:(M,T)=>{if(!T.payload.data.option)return;const S=(0,u.ir)(M,T.payload.id);if(!(0,d.eL)(S))return;const{option:x}=T.payload.data,O={...x,text:(0,l.Hi)(x?.text),value:(0,l.Hi)(x?.value)};S.current=O,S.options=S.options.map(B=>{B.value=(0,l.Hi)(B.value),B.text=(0,l.Hi)(B.text);let A=!1;if(Array.isArray(O.value))for(let V=0;V<O.value.length;V++){const W=O.value[V];if(B.value===W){A=!0;break}}else B.value===O.value&&(A=!0);return B.selected=A,B})},changeVariableProp:(M,T)=>{const S=(0,u.ir)(M,T.payload.id);S[T.payload.data.propName]=T.payload.data.propValue}},extraReducers:M=>M.addCase(g.Yo,(T,S)=>{const x=(0,u.ir)(T,S.payload.id);x.name=S.payload.data.newName})}),c=m.reducer,{removeVariable:p,addVariable:f,changeVariableProp:E,changeVariableOrder:h,duplicateVariable:y,setCurrentVariableValue:v,changeVariableType:D,variableStateNotStarted:a,variableStateFetching:C,variableStateCompleted:P,variableStateFailed:b}=m.actions},67273:(j,I,e)=>{"use strict";e.d(I,{Z9:()=>d,iv:()=>u,p3:()=>l,vw:()=>o,xO:()=>s});var t=e(34099),n=e(6230),i=e(60344);const s={uid:null,status:n.LN.NotStarted,isDirty:!1},r=(0,t.oM)({name:"templating/transaction",initialState:s,reducers:{variablesInitTransaction:(m,c)=>{m.uid=c.payload.uid,m.status=n.LN.Fetching},variablesCompleteTransaction:(m,c)=>{m.uid===c.payload.uid&&(m.status=n.LN.Completed)},variablesClearTransaction:(m,c)=>{m.uid=null,m.status=n.LN.NotStarted,m.isDirty=!1}},extraReducers:m=>m.addMatcher(g,(c,p)=>{c.status===n.LN.Completed&&(c.isDirty=!0)})});function g(m){return i.mZ.match(m)||i.VN.match(m)||i.Pl.match(m)||i.gE.match(m)||i.Y9.match(m)||i.Be.match(m)}const{variablesInitTransaction:d,variablesClearTransaction:l,variablesCompleteTransaction:u}=r.actions,o=r.reducer},18918:(j,I,e)=>{"use strict";e.d(I,{s:()=>t});const t={}},96637:(j,I,e)=>{"use strict";e.d(I,{L:()=>g,S:()=>r});var t=e(34099),n=e(41355),i=e(60344),s=e(18918);const r=(0,t.PH)("templating/cleanVariables"),g=(d=s.s,l)=>{if(r.match(l)){const u=Object.values(d).filter(m=>m.global);return u?u.reduce((m,c)=>(m[c.id]=c,m),{}):s.s}return l?.payload?.type&&n.z.getIfExists(l?.payload?.type)?n.z.get(l.payload.type).reducer((0,i.b5)(d,l),l):d}},6230:(j,I,e)=>{"use strict";e.d(I,{$U:()=>t.$U,Bd:()=>t.Bd,Eg:()=>g,LN:()=>r,Wy:()=>u,bU:()=>t.bU,eq:()=>l,x9:()=>d});var t=e(82986),n=e(53933),i=e(96509),s=e(80169),r=(o=>(o.NotStarted="Not started",o.Fetching="Fetching",o.Completed="Completed",o))(r||{});const g={id:s.UY,rootStateKey:null,name:"",type:"query",global:!1,index:-1,hide:t.bU.dontHide,skipUrlSync:!1,state:n.Gu.NotStarted,error:null,description:null};class d extends i.R{}d.type="variables-changed";class l extends i.R{}l.type="variables-time-range-process-done";class u extends i.R{}u.type="variables-changed-in-url"},81587:(j,I,e)=>{"use strict";e.d(I,{A3:()=>M,AQ:()=>v,HY:()=>f,Hi:()=>b,J7:()=>m,N9:()=>h,QI:()=>p,Tt:()=>E,Y6:()=>x,a9:()=>c,bi:()=>a,gR:()=>y,iD:()=>D,mn:()=>T,xT:()=>P,yQ:()=>S});var t=e(89949),n=e.n(t),i=e(39317),s=e(89024),r=e(84749),g=e(26858),d=e(41355),l=e(80169),u=e(51824),o=e(6230);const m=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g,c=O=>(m.lastIndex=0,m.exec(O));function p(...O){const B=O[O.length-1];O[0]=typeof O[0]=="string"?O[0]:(0,s.Xh)(O[0]);const V=O.slice(0,-1).join(" ").match(m);return!!(V!==null?V.find(w=>{const N=c(w);return N!==null&&N.indexOf(B)>-1}):!1)}const f=O=>{if(!O||!O.current)return!1;if(O.current.value){const B=Array.isArray(O.current.value);if(B&&O.current.value.length&&O.current.value[0]===l.r2||!B&&O.current.value===l.r2)return!0}if(O.current.text){const B=Array.isArray(O.current.text);if(B&&O.current.text.length&&O.current.text[0]===l.xk||!B&&O.current.text===l.xk)return!0}return!1},E=O=>!O||!O.current||!O.current.text?"":Array.isArray(O.current.text)?O.current.text.toString():typeof O.current.text!="string"?"":O.current.text,h=O=>!O||!O.current||O.current.value===void 0||O.current.value===null?null:Array.isArray(O.current.value)?O.current.value.toString():typeof O.current.value!="string"?null:O.current.value;function y(O,B=(0,i.J)()){return!O||!O.regex?"":B.replace(O.regex,{},"regex")}function v(O,B,A=(0,g.$t)()){const V={range:void 0,variable:O,searchFilter:B};return(O.refresh===o.Bd.onTimeRangeChanged||O.refresh===o.Bd.onDashboardLoad)&&(V.range=A.timeRange()),V}function D(O){if(!O||!O.hasOwnProperty("refresh"))return o.Bd.never;const B=O;return B.refresh!==o.Bd.onTimeRangeChanged&&B.refresh!==o.Bd.onDashboardLoad&&B.refresh!==o.Bd.never?o.Bd.never:B.refresh}function a(){return d.z.list().filter(O=>O.id!=="system").map(({id:O,name:B,description:A})=>({label:B,value:O,description:A}))}function C(O){return(0,t.isArray)(O)&&(O.length===0?O=void 0:O.length===1&&(O=O[0])),O}function P(O,B){let A=0;const V={};for(const W in O){if(!W.startsWith(l.IG))continue;let w=C(B[W]),N=C(O[W]);(0,t.isEqual)(N,w)||(V[W]={value:O[W]},A++)}for(const W in B){if(!W.startsWith(l.IG))continue;const w=B[W];(0,t.isArray)(w)&&w.length===0||O.hasOwnProperty(W)||(V[W]={value:"",removed:!0},A++)}return A?V:void 0}function b(O){return Array.isArray(O)?O.map(String):O==null?"":typeof O=="number"?O.toString(10):typeof O=="string"?O:typeof O=="boolean"?O.toString():""}function M(O,B=(0,r.y0)()){return(0,u.AE)(O,B).transaction.status!==o.LN.NotStarted}function T(O){return String(O)}const S=O=>{if(!O.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${O.id}`);return{type:O.type,id:O.id,rootStateKey:O.rootStateKey}};function x(O,B){return{type:O.type,id:O.id,data:B}}},16546:(j,I,e)=>{"use strict";e.d(I,{H:()=>m});var t=e(42844),n=e(27702),i=e(75578),s=e(21609),r=e(99025),g=e(64167),d=e(66310),l=e(64022),u=e(66670),o=e(89628);const m=({data:p,rowIndex:f,columnIndex:E,sortOrder:h,mode:y,header:v=void 0})=>{const D=(0,d.wW)(c);if(!p||f==null)return null;const a=p.fields.map((O,B)=>({...O,hovered:B===E})),C=a.filter(O=>!O.config.custom?.hideFrom?.tooltip),P=C.find(O=>O.name==="traceID")||a[0],b=[];if(C.filter(O=>P===O).length>0&&b.push(P),b.push(...C.filter(O=>P!==O)),b.length===0)return null;const M=[],T=[],S=new Set;for(const O of b){if(y===g.f3.Single&&E!=null&&!O.hovered)continue;const B=O.values[f],A=O.display?O.display(B):{text:`${B}`,numeric:+B};O.getLinks&&O.getLinks({calculatedValue:A,valueRowIndex:f}).forEach(w=>{const N=`${w.title}/${w.href}`;S.has(N)||(T.push(w),S.add(N))});const{hovered:V,...W}=O;M.push({name:(0,i.CZ)(W,p),value:B,valueString:(0,s.zc)(A),highlight:O.hovered})}h&&h!==g.As.None&&M.sort((O,B)=>r.sortValues(h)(O.value,B.value));const x=()=>T.length>0&&n.createElement("tr",null,n.createElement("td",{colSpan:2},n.createElement(l.wc,null,T.map((O,B)=>n.createElement(u.Qj,{key:B,icon:"external-link-alt",target:O.target,href:O.href,onClick:O.onClick,fill:"text",style:{width:"100%"}},O.title)))));return n.createElement("div",{className:D.wrapper},v&&n.createElement("div",{className:D.header},n.createElement("span",{className:D.title},v)),n.createElement("table",{className:D.infoWrap},n.createElement("tbody",null,M.map((O,B)=>n.createElement("tr",{key:`${B}/${f}`,className:O.highlight?D.highlight:""},n.createElement("th",null,O.name,":"),n.createElement("td",null,(0,o.Q)(O.valueString)))),x())))},c=p=>{const f=p.isDark?p.v1.palette.dark2:p.v1.palette.white,E=p.isDark?p.v1.palette.dark9:p.v1.palette.gray5,h=p.isDark?p.v1.palette.dark3:p.v1.palette.gray6;return{wrapper:(0,t.css)` background: ${f}; border: 1px solid ${E}; border-radius: ${p.shape.borderRadius(2)}; `,header:(0,t.css)` background: ${E}; padding: 6px 10px; display: flex; `,title:(0,t.css)` font-weight: ${p.typography.fontWeightMedium}; padding-right: ${p.spacing(2)}; overflow: hidden; display: inline-block; white-space: nowrap; text-overflow: ellipsis; flex-grow: 1; `,infoWrap:(0,t.css)` padding: 8px; th { font-weight: ${p.typography.fontWeightMedium}; padding: ${p.spacing(.25,2)}; } tr { background-color: ${p.colors.background.primary}; &:nth-child(even) { background-color: ${h}; } } `,highlight:(0,t.css)` /* !important is required to overwrite default table styles */ background: ${p.colors.action.hover} !important; `,link:(0,t.css)` color: #6e9fff; `}}},48774:(j,I,e)=>{"use strict";var t=e(48154),n=e(34667);const i=n.config.bootData.settings.cspReportOnlyEnabled;n.config.bootData.settings.trustedTypesDefaultPolicyEnabled&&window.trustedTypes&&window.trustedTypes.createPolicy&&window.trustedTypes.createPolicy("default",{createHTML:(U,K,z)=>i?(console.error("[HTML not sanitized with Trusted Types]",U,K,z),U):U.replace(/<script/gi,"<script"),createScript:U=>U,createScriptURL:(U,K,z)=>i?(console.error("[ScriptURL not sanitized with Trusted Types]",U,K,z),U):t.QX.sanitizeUrl(U)});var s=e(65599),r=e(3728),g=e(97908),d=e(23993),l=e(44548),u=e(49086),o=e(7610),m=e(5926),c=e(46823),p=e(75261),f=e(50389),E=e(97188),h=e(7942),y=e(83961),v=e(89949),D=e.n(v),a=e(27702),C=e(68249),P=e(99633),b=e(31317),M=e(41199),T=e(52273),S=e(60519),x=e(94469),O=e(73289),B=e(27380),A=e(26129),V=e(32713),W=e(89633),w=e(97073),N=e(10864),F=e(82123),k=e(77948),H=e(72566),R=e(22323),_=e(1695),G=e(28388),Y=e(12308),X=e(69513),Q=e(42844),se=e(29241),Z=e(76178),le=e(19221),oe=e(75578),q=e(14544),ne=e(44885),ge=e(20371),ae=e(40705),re=e(66670),De=e(80402),he=e(28580),ye=e(25359),ce=e(1128);function We(U,K){switch(K.type){case se.fS.boolean:return(0,v.isUndefined)(U)?!1:ke(U);case se.fS.number:return isNaN(U)?0:parseFloat(U);case se.fS.string:return U?String(U):"";default:return U}}const ke=U=>(0,v.isString)(U)?!(U[0]==="F"||U[0]==="f"||U[0]==="0"):!!U;function et(U){return function({options:z,onChange:te,field:fe}){const{validator:Pe,converter:Ne=We}=U,{value:Je}=z,[ot,lt]=(0,a.useState)(!Pe(Je)),vt=(0,a.useCallback)(Zt=>{lt(!Pe(Zt.currentTarget.value))},[lt,Pe]),Ut=(0,a.useCallback)(Zt=>{if(ot)return;const{value:nn}=Zt.currentTarget;te({...z,value:Ne(nn,fe)})},[z,te,ot,fe,Ne]);return a.createElement(ce.I,{className:"flex-grow-1",invalid:ot,defaultValue:String(z.value),placeholder:"Value",onChange:vt,onBlur:Ut})}}const we=()=>[{name:"Is greater",id:le.mE.greater,component:et({validator:U=>!isNaN(U)})},{name:"Is greater or equal",id:le.mE.greaterOrEqual,component:et({validator:U=>!isNaN(U)})},{name:"Is lower",id:le.mE.lower,component:et({validator:U=>!isNaN(U)})},{name:"Is lower or equal",id:le.mE.lowerOrEqual,component:et({validator:U=>!isNaN(U)})},{name:"Is equal",id:le.mE.equal,component:et({validator:()=>!0})},{name:"Is not equal",id:le.mE.notEqual,component:et({validator:()=>!0})},{name:"Regex",id:le.mE.regex,component:et({validator:()=>!0,converter:U=>String(U)})}],_e=()=>null,Ge=()=>[{name:"Is null",id:le.mE.isNull,component:_e},{name:"Is not null",id:le.mE.isNotNull,component:_e}];function qe(U){return function({options:z,onChange:te,field:fe}){const{validator:Pe}=U,[Ne,Je]=(0,a.useState)({from:!Pe(z.from),to:!Pe(z.to)}),ot=(0,a.useCallback)((vt,Ut)=>{Je({...Ne,[Ut]:!Pe(vt.currentTarget.value)})},[Je,Pe,Ne]),lt=(0,a.useCallback)((vt,Ut)=>{if(Ne[Ut])return;const{value:Zt}=vt.currentTarget;te({...z,[Ut]:We(Zt,fe)})},[z,te,Ne,fe]);return a.createElement(a.Fragment,null,a.createElement(ce.I,{className:"flex-grow-1 gf-form-spacing",invalid:Ne.from,defaultValue:String(z.from),placeholder:"From",onChange:vt=>ot(vt,"from"),onBlur:vt=>lt(vt,"from")}),a.createElement("div",{className:"gf-form-label"},"and"),a.createElement(ce.I,{className:"flex-grow-1",invalid:Ne.to,defaultValue:String(z.to),placeholder:"To",onChange:vt=>ot(vt,"to"),onBlur:vt=>lt(vt,"to")}))}}const st=()=>[{name:"Is between",id:le.mE.between,component:qe({validator:U=>!isNaN(U)})}],Me=new ye.B(()=>[...we(),...Ge(),...st()]),be=U=>{const{onDelete:K,onChange:z,filter:te,fieldsInfo:fe}=U,{fieldsAsOptions:Pe,fieldByDisplayName:Ne}=fe,Je=tt(te,Pe)??"",ot=Ne[Je],lt=ot?Ke(ot):[],vt=Ye(te,lt),Ut=Me.getIfExists(vt),Zt=(0,a.useCallback)(bn=>{bn?.value&&z({...te,fieldName:bn.value})},[z,te]),nn=(0,a.useCallback)(bn=>{if(!bn?.value)return;const Kn=bn.value,ja=Z.U8.get(Kn).getDefaultOptions(ot);z({...te,config:{id:Kn,options:ja}})},[z,te,ot]),gn=(0,a.useCallback)(bn=>{z({...te,config:{...te.config,options:bn}})},[z,te]);return!ot||!Ut||!Ut.component?null:a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form gf-form-spacing"},a.createElement("div",{className:"gf-form-label width-7"},"Field"),a.createElement(he.Ph,{className:"min-width-15 max-width-24",placeholder:"Field Name",options:Pe,value:te.fieldName,onChange:Zt})),a.createElement("div",{className:"gf-form gf-form-spacing"},a.createElement("div",{className:"gf-form-label"},"Match"),a.createElement(he.Ph,{className:"width-12",placeholder:"Select test",options:lt,value:vt,onChange:nn})),a.createElement("div",{className:"gf-form gf-form--grow gf-form-spacing"},a.createElement("div",{className:"gf-form-label"},"Value"),a.createElement(Ut.component,{field:ot,options:te.config.options??{},onChange:gn})),a.createElement("div",{className:"gf-form"},a.createElement(re.zx,{icon:"times",onClick:K,variant:"secondary"})))},Ke=U=>{const K=[];for(const z of Z.U8.list())!z.isApplicable(U)||!Me.getIfExists(z.id)||K.push({value:z.id,label:z.name,description:z.description});return K},Ye=(U,K)=>{const z=K.find(te=>te.value===U.config.id);if(z&&z.value)return z.value;if(K[0]?.value)return K[0]?.value},tt=(U,K)=>{const z=K.find(te=>te.value===U.fieldName);if(z&&z.value)return z.value;if(K[0]?.value)return K[0]?.value},nt=[{label:"Include",value:ge.PQ.include},{label:"Exclude",value:ge.PQ.exclude}],Pt=[{label:"Match all",value:ge.ER.all},{label:"Match any",value:ge.ER.any}],xt=U=>{const{input:K,options:z,onChange:te}=U,fe=Rt(),Pe=ct(K),Ne=(0,a.useCallback)(()=>{const Ut=K[0],Zt=Ut.fields.find(bn=>bn.type!==se.fS.time);if(!Zt)return;const nn=(0,v.cloneDeep)(z.filters),gn=Z.U8.get(le.mE.greater);nn.push({fieldName:(0,oe.CZ)(Zt,Ut,K),config:{id:gn.id,options:gn.getDefaultOptions(Zt)}}),te({...z,filters:nn})},[te,z,K]),Je=(0,a.useCallback)(Ut=>{let Zt=(0,v.cloneDeep)(z.filters);Zt.splice(Ut,1),te({...z,filters:Zt})},[z,te]),ot=(0,a.useCallback)((Ut,Zt)=>{let nn=(0,v.cloneDeep)(z.filters);nn[Zt]=Ut,te({...z,filters:nn})},[z,te]),lt=(0,a.useCallback)(Ut=>{te({...z,type:Ut??ge.PQ.include})},[z,te]),vt=(0,a.useCallback)(Ut=>{te({...z,match:Ut??ge.ER.all})},[z,te]);return a.createElement("div",null,a.createElement("div",{className:"gf-form gf-form-inline"},a.createElement("div",{className:"gf-form-label width-8"},"Filter type"),a.createElement("div",{className:"width-15"},a.createElement(ae.S,{options:nt,value:z.type,onChange:lt,fullWidth:!0}))),a.createElement("div",{className:"gf-form gf-form-inline"},a.createElement("div",{className:"gf-form-label width-8"},"Conditions"),a.createElement("div",{className:"width-15"},a.createElement(ae.S,{options:Pt,value:z.match,onChange:vt,fullWidth:!0}))),a.createElement("div",{className:fe.conditions},z.filters.map((Ut,Zt)=>a.createElement(be,{key:Zt,filter:Ut,fieldsInfo:Pe,onChange:nn=>ot(nn,Zt),onDelete:()=>Je(Zt)})),a.createElement("div",{className:"gf-form"},a.createElement(re.zx,{icon:"plus",size:"sm",onClick:Ne,variant:"secondary"},"Add condition"))))},bt={id:q.W.filterByValue,editor:xt,transformation:ne.Y.filterByValueTransformer,name:ne.Y.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([T.w.Filter])},Rt=(0,De.B)(()=>({conditions:(0,Q.css)` padding-left: 16px; `})),ct=U=>(0,a.useMemo)(()=>{const K={fieldsAsOptions:[],fieldByDisplayName:{}};return Array.isArray(U)?U.reduce((z,te)=>te.fields.reduce((fe,Pe)=>{const Ne=(0,oe.CZ)(Pe,te,U);return fe.fieldByDisplayName[Ne]||(fe.fieldsAsOptions.push({label:Ne,value:Ne,type:Pe.type}),fe.fieldByDisplayName[Ne]=Pe),fe},z),K):K},[U]);var it=e(9232),me=e(2471),Ee=e(32299),Ce=e(26908),Ae=e(11778);function ze(U,K){const z={data:U.input,options:U.options},te=new Ee.j({id:"root",title:"root"}),fe=Ne=>{if(Ne?.length){const Je=Ne[0];let ot=te.categories.find(lt=>lt.props.id===Je);return ot||(ot=new Ee.j({id:Je,title:Je}),te.categories.push(ot)),ot}return te},Pe={getValue:Ne=>(0,v.get)(U.options,Ne),onChange:(Ne,Je)=>{U.onChange((0,Ae.hs)(U.options,Ne,Je))}};return(0,Ce.HZ)(K,Pe,fe,z),te}function Ie(U){const K={data:[],options:{}},z={},te=new me.rt;U(te,K);for(const fe of te.getItems())fe.defaultValue!=null&&(0,v.set)(z,fe.path,fe.defaultValue);return z}var xe=e(73941),Te=e(28635);const Oe=(U,K)=>{const z=K.options??{};(0,xe.J)("",U,z)},ie=U=>{(0,a.useEffect)(()=>{if(!U.options.xBuckets?.mode){const z=Ie(Oe);U.onChange({...z,...U.options}),console.log("geometry useEffect",z)}});const K=ze(U,Oe);return a.createElement("div",null,a.createElement("div",null,K.items.map(z=>z.render())))},Le={id:Te.Oy.id,editor:ie,transformation:Te.Oy,name:Te.Oy.name,description:Te.Oy.description,state:it.BV.alpha,categories:new Set([T.w.CreateNewVisualization])};var Be=e(66310),Ue=e(78425),ue=e(71107),pe=e(48024),$e=e(66656),Se=e(10133),Ve=e(93666),He=e(17373),Ze=e(5168),Qe=e(51046);function rt(U,K,z){const te={},fe={};for(const Pe of U.fields){const Ne=(0,oe.CZ)(Pe,U),ot=z.index[Ne].handler;if(!ot)continue;const lt=Pe.values[K];if(lt==null)continue;const vt=ot.processor(lt,te,fe);vt!=null&&(te[ot.targetProperty??ot.key]=vt)}return fe.mappingValues&&(te.mappings=_t(fe)),te}var pt=(U=>(U.Name="field.name",U.Value="field.value",U.Label="field.label",U.Ignore="__ignore",U))(pt||{});const It=[{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:cn},{key:"min",processor:cn},{key:"unit",processor:U=>U.toString()},{key:"decimals",processor:cn},{key:"displayName",name:"Display name",processor:U=>U.toString()},{key:"color",processor:U=>({fixedColor:U,mode:Ve.S.Fixed})},{key:"threshold1",targetProperty:"thresholds",processor:(U,K)=>{const z=(0,He.I)(U);if(!isNaN(z))return K.thresholds||(K.thresholds={mode:Ze.H.Absolute,steps:[{value:-1/0,color:"green"}]}),K.thresholds.steps.push({value:z,color:"red"}),K.thresholds}},{key:"mappings.value",name:"Value mappings / Value",targetProperty:"mappings",defaultReducer:$e.gz.allValues,processor:(U,K,z)=>{if((0,v.isArray)(U))return z.mappingValues=U,K.mappings}},{key:"mappings.color",name:"Value mappings / Color",targetProperty:"mappings",defaultReducer:$e.gz.allValues,processor:(U,K,z)=>{if((0,v.isArray)(U))return z.mappingColors=U,K.mappings}},{key:"mappings.text",name:"Value mappings / Display text",targetProperty:"mappings",defaultReducer:$e.gz.allValues,processor:(U,K,z)=>{if((0,v.isArray)(U))return z.mappingTexts=U,K.mappings}}];function _t(U){const K={type:Qe.H.ValueToText,options:{}};if(!U.mappingValues)return[];for(let z=0;z<U.mappingValues.length;z++){const te=U.mappingValues[z];te!=null&&(K.options[te.toString()]={color:U.mappingColors&&U.mappingColors[z],text:U.mappingTexts&&U.mappingTexts[z],index:z})}return[K]}let tn=null;function qt(){if(tn===null){tn={};for(const U of It)tn[U.key]=U}return tn}function cn(U){const K=(0,He.I)(U);if(!isNaN(K))return K}function on(U,K){for(const z of K)if(U===z.fieldName)return z.handlerKey;return U.toLowerCase()}function ln(U){return U?qt()[U]:null}function Un(U,K,z){const te={index:{}};let fe=K.find(Ne=>Ne.handlerKey==="field.name"),Pe=K.find(Ne=>Ne.handlerKey==="field.value");for(const Ne of U.fields){const Je=(0,oe.CZ)(Ne,U),ot=K.find(Ut=>Ut.fieldName===Je),lt=ot?ot.handlerKey:Je.toLowerCase();let vt=ln(lt);z&&(vt?(vt.key==="field.name"&&(te.nameField=Ne),vt.key==="field.value"&&(te.valueField=Ne)):ot||(!te.nameField&&!fe&&Ne.type===se.fS.string&&(te.nameField=Ne,vt=ln("field.name")),!te.valueField&&!Pe&&Ne.type===se.fS.number&&(te.valueField=Ne,vt=ln("field.value")))),!vt&&z&&(vt=ln("field.label")),te.index[Je]={automatic:!ot,handler:vt,reducerId:ot?.reducerId??vt?.defaultReducer??$e.gz.lastNotNull}}return te}function yt({frame:U,mappings:K,onChange:z,withReducers:te,withNameAndValue:fe}){const Pe=(0,Be.wW)(Bt),Ne=ft(U,K,fe),Je=It.map(vt=>Tt(vt,!1)),ot=(vt,Ut)=>{const Zt=K.findIndex(nn=>nn.fieldName===vt.fieldName);if(Ut)if(Zt!==-1){const nn=[...K];nn.splice(Zt,1,{...K[Zt],handlerKey:Ut.value}),z(nn)}else z([...K,{fieldName:vt.fieldName,handlerKey:Ut.value}]);else z(Zt!==-1?K.filter((nn,gn)=>gn!==Zt):[...K,{fieldName:vt.fieldName,handlerKey:"__ignore"}])},lt=(vt,Ut)=>{const Zt=K.findIndex(nn=>nn.fieldName===vt.fieldName);if(Zt!==-1){const nn=[...K];nn.splice(Zt,1,{...K[Zt],reducerId:Ut}),z(nn)}else z([...K,{fieldName:vt.fieldName,handlerKey:vt.handlerKey,reducerId:Ut}])};return a.createElement("table",{className:Pe.table},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Field"),a.createElement("th",null,"Use as"),te&&a.createElement("th",null,"Select"))),a.createElement("tbody",null,Ne.map(vt=>a.createElement("tr",{key:vt.fieldName},a.createElement("td",{className:Pe.labelCell},vt.fieldName),a.createElement("td",{className:Pe.selectCell,"data-testid":`${vt.fieldName}-config-key`},a.createElement(he.Ph,{options:Je,value:vt.configOption,placeholder:vt.placeholder,isClearable:!0,onChange:Ut=>ot(vt,Ut)})),te&&a.createElement("td",{"data-testid":`${vt.fieldName}-reducer`,className:Pe.selectCell},a.createElement(Se.m,{stats:[vt.reducerId],defaultStat:vt.reducerId,onChange:Ut=>lt(vt,Ut[0])}))))))}function ft(U,K,z){const te=[],fe=Un(U,K??[],z);for(const Pe of U.fields){const Ne=(0,oe.CZ)(Pe,U),Je=fe.index[Ne],ot=Tt(Je.handler,Je.automatic);te.push({fieldName:Ne,configOption:Je.automatic?null:ot,placeholder:Je.automatic?ot?.label:"Choose",handlerKey:Je.handler?.key??null,reducerId:Je.reducerId})}for(const Pe of K)if(!te.find(Ne=>Ne.fieldName===Pe.fieldName)){const Ne=ln(Pe.handlerKey);te.push({fieldName:Pe.fieldName,handlerKey:Pe.handlerKey,configOption:Tt(Ne,!1),missingInFrame:!0,reducerId:Pe.reducerId??$e.gz.lastNotNull})}return Object.values(te)}function Tt(U,K){if(!U)return null;let z=U.name??(0,v.capitalize)(U.key);return K&&(z=`${z} (auto)`),{label:z,value:U.key}}const Bt=U=>({table:(0,Q.css)` margin-top: ${U.spacing(1)}; td, th { border-right: 4px solid ${U.colors.background.primary}; border-bottom: 4px solid ${U.colors.background.primary}; white-space: nowrap; } th { font-size: ${U.typography.bodySmall.fontSize}; line-height: ${U.spacing(4)}; padding: ${U.spacing(0,1)}; } `,labelCell:(0,Q.css)` font-size: ${U.typography.bodySmall.fontSize}; background: ${U.colors.background.secondary}; padding: ${U.spacing(0,1)}; max-width: 400px; overflow: hidden; text-overflow: ellipsis; min-width: 140px; `,selectCell:(0,Q.css)` padding: 0; min-width: 161px; `});var Nt=e(39343);function Ft(U,K){let z=null;for(const Je of K)if(Je.refId===U.configRefId){z=Je;break}if(!z)return K;const te={fields:[],length:1},fe=Un(z,U.mappings??[],!1);for(const Je of z.fields){const ot={...Je},lt=(0,oe.CZ)(Je,z),vt=fe.index[lt],Ut=(0,$e.Kx)({field:Je,reducers:[vt.reducerId]});ot.values=[Ut[vt.reducerId]],te.fields.push(ot)}const Pe=[],Ne=(0,Z.sq)(U.applyTo||{id:le.mi.numeric});for(const Je of K){if(Je===z&&K.length>1)continue;const ot={fields:[],length:Je.length,refId:Je.refId};for(const lt of Je.fields)if(Ne(lt,Je,K)){const vt=rt(te,0,fe);ot.fields.push({...lt,config:{...lt.config,...vt}})}else ot.fields.push(lt);Pe.push(ot)}return Pe}const Gt={id:q.W.configFromData,name:"Config from query results",description:"Set unit, min, max and more from data.",defaultOptions:{configRefId:"config",mappings:[]},operator:U=>K=>K.pipe((0,Nt.U)(z=>Ft(U,z)))};function dn({input:U,onChange:K,options:z}){const te=(0,Be.wW)(Bn),fe=U.map(nn=>nn.refId).filter(nn=>nn!=null).map(nn=>({label:nn,value:nn})),Pe=z.configRefId||"config",Ne=z.applyTo??{id:le.mi.byType,options:"number"},Je=Ue.i.get(Ne.id),ot=U.find(nn=>nn.refId===Pe),lt=nn=>{K({...z,configRefId:nn.value||"config"})},vt=nn=>{K({...z,applyTo:{id:nn.value}})},Ut=nn=>{K({...z,applyTo:{id:Ne.id,options:nn}})},Zt=Ue.i.list().filter(nn=>!nn.excludeFromPicker).map(nn=>({label:nn.name,value:nn.id,description:nn.description}));return a.createElement(a.Fragment,null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Config query",labelWidth:20},a.createElement(he.Ph,{onChange:lt,options:fe,value:Pe,width:30}))),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Apply to",labelWidth:20},a.createElement(he.Ph,{onChange:vt,options:Zt,value:Ne.id,width:30}))),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Apply to options",labelWidth:20,className:te.matcherOptions},a.createElement(Je.component,{matcher:Je.matcher,data:U,options:Ne.options,onChange:Ut}))),a.createElement(ue.Z,null,ot&&a.createElement(yt,{frame:ot,mappings:z.mappings,onChange:nn=>K({...z,mappings:nn}),withReducers:!0})))}const sn={id:Gt.id,editor:dn,transformation:Gt,name:Gt.name,description:Gt.description,state:it.BV.beta,categories:new Set([T.w.CalculateNewFields]),help:` ### Use cases This transformation allows you select one query and from it extract standard options such as **Min**, **Max**, **Unit**, and **Thresholds** and apply them to other query results. This enables dynamic query driven visualization configuration. ### Options - **Config query**: Selet the query that returns the data you want to use as configuration. - **Apply to**: Select what fields or series to apply the configuration to. - **Apply to options**: Usually a field type or field name regex depending on what option you selected in **Apply to**. ### Field mapping table Below the configuration listed above you will find the field table. Here all fields found in the data returned by the config query will be listed along with a **Use as** and **Select** option. This table gives you control over what field should be mapped to which config property and if there are multiple rows which value to select. ## Example Input[0] (From query: A, name: ServerA) | Time | Value | | ------------- | ----- | | 1626178119127 | 10 | | 1626178119129 | 30 | Input[1] (From query: B) | Time | Value | | ------------- | ----- | | 1626178119127 | 100 | | 1626178119129 | 100 | Output (Same as Input[0] but now with config on the Value field) | Time | Value (config: Max=100) | | ------------- | ----------------------- | | 1626178119127 | 10 | | 1626178119129 | 30 | Each row in the source data becomes a separate field. Each field now also has a maximum configuration option set. Options such as **min**, **max**, **unit**, and **thresholds** are all part of field configuration, and if they are set like this, they will be used by the visualization instead of any options that are manually configured. in the panel editor options pane. ## Value mappings You can also transform a query result into value mappings. This is is a bit different because every row in the configuration query result is used to define a single value mapping row. See the following example. Config query result: | Value | Text | Color | | ----- | ------ | ----- | | L | Low | blue | | M | Medium | green | | H | High | red | In the field mapping specify: | Field | Use as | Select | | ----- | ----------------------- | ---------- | | Value | Value mappings / Value | All values | | Text | Value mappings / Text | All values | | Color | Value mappings / Ciolor | All values | Grafana will build the value mappings from you query result and apply it the the real data query results. You should see values being mapped and colored according to the config query results. `},Bn=U=>({matcherOptions:(0,Q.css)` min-width: 404px; `});var wt=e(45383),Vt=e(32338),Ht=e(18441),Xt=e(64022),mn=e(81520),pn=e(82367);const Pn=[{value:Ht.ie.BinaryOperation,label:"Binary operation"},{value:Ht.ie.ReduceRow,label:"Reduce row"},{value:Ht.ie.Index,label:"Row index"}],zn=new Set([se.fS.time,se.fS.number,se.fS.string]);class Hn extends a.PureComponent{constructor(K){super(K),this.onToggleReplaceFields=()=>{const{options:z}=this.props;this.props.onChange({...z,replaceFields:!z.replaceFields})},this.onModeChanged=z=>{const{options:te,onChange:fe}=this.props,Pe=z.value??Ht.ie.BinaryOperation;fe({...te,mode:Pe})},this.onAliasChanged=z=>{const{options:te}=this.props;this.props.onChange({...te,alias:z.target.value})},this.updateReduceOptions=z=>{const{options:te,onChange:fe}=this.props;fe({...te,mode:Ht.ie.ReduceRow,reduce:z})},this.onFieldToggle=z=>{const{selected:te}=this.state;te.indexOf(z)>-1?this.onChange(te.filter(fe=>fe!==z)):this.onChange([...te,z])},this.onChange=z=>{this.setState({selected:z});const{reduce:te}=this.props.options;this.updateReduceOptions({...te,include:z})},this.onStatsChange=z=>{const te=z.length?z[0]:$e.gz.sum,{reduce:fe}=this.props.options;this.updateReduceOptions({...fe,reducer:te})},this.updateBinaryOptions=z=>{const{options:te,onChange:fe}=this.props;fe({...te,mode:Ht.ie.BinaryOperation,binary:z})},this.onBinaryLeftChanged=z=>{const{binary:te}=this.props.options;this.updateBinaryOptions({...te,left:z.value})},this.onBinaryRightChanged=z=>{const{binary:te}=this.props.options;this.updateBinaryOptions({...te,right:z.value})},this.onBinaryOperationChanged=z=>{const{binary:te}=this.props.options;this.updateBinaryOptions({...te,operator:z.value})},this.state={include:K.options?.reduce?.include||[],names:[],selected:[]}}componentDidMount(){this.initOptions()}componentDidUpdate(K){this.props.input!==K.input&&this.initOptions()}initOptions(){const{options:K}=this.props,z=K?.reduce?.include||[],te={interpolate:Pe=>Pe},fe=(0,wt.of)(this.props.input).pipe(ne.Y.ensureColumnsTransformer.operator(null,te),this.extractAllNames(),this.extractNamesAndSelected(z)).subscribe(({selected:Pe,names:Ne})=>{this.setState({names:Ne,selected:Pe},()=>fe.unsubscribe())})}extractAllNames(){return K=>K.pipe((0,Nt.U)(z=>{const te=[],fe={};for(const Pe of z)for(const Ne of Pe.fields){if(!zn.has(Ne.type))continue;const Je=(0,oe.CZ)(Ne,Pe,z);fe[Je]||(fe[Je]=!0,te.push(Je))}return te}))}extractNamesAndSelected(K){return z=>z.pipe((0,Nt.U)(te=>{if(!K.length)return{names:te,selected:[]};const fe=[],Pe=[];for(const Ne of te)K.includes(Ne)&&Pe.push(Ne),fe.push(Ne);return{names:fe,selected:Pe}}))}renderReduceRow(K){const{names:z,selected:te}=this.state;return K=(0,v.defaults)(K,{reducer:$e.gz.sum}),a.createElement(a.Fragment,null,a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form gf-form--grow"},a.createElement("div",{className:"gf-form-label width-8"},"Field name"),a.createElement(Xt.Lh,{spacing:"xs",align:"flex-start",wrap:!0},z.map((fe,Pe)=>a.createElement(mn.B,{key:`${fe}/${Pe}`,onClick:()=>{this.onFieldToggle(fe)},label:fe,selected:te.indexOf(fe)>-1}))))),a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement("div",{className:"gf-form-label width-8"},"Calculation"),a.createElement(Se.m,{allowMultiple:!1,className:"width-18",stats:[K.reducer],onChange:this.onStatsChange,defaultStat:$e.gz.sum}))))}renderBinaryOperation(K){K=(0,v.defaults)(K,{reducer:$e.gz.sum});let z=!K?.left,te=!K?.right;const fe=this.state.names.map(ot=>(ot===K?.left&&(z=!0),ot===K?.right&&(te=!0),{label:ot,value:ot})),Pe=z?fe:[...fe,{label:K?.left,value:K?.left}],Ne=te?fe:[...fe,{label:K?.right,value:K?.right}],Je=Vt.n.list().map(ot=>({label:ot.id,value:ot.id}));return a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement("div",{className:"gf-form-label width-8"},"Operation")),a.createElement("div",{className:"gf-form"},a.createElement(he.Ph,{allowCustomValue:!0,placeholder:"Field or number",options:Pe,className:"min-width-18 gf-form-spacing",value:K?.left,onChange:this.onBinaryLeftChanged}),a.createElement(he.Ph,{className:"width-8 gf-form-spacing",options:Je,value:K.operator??Je[0].value,onChange:this.onBinaryOperationChanged}),a.createElement(he.Ph,{allowCustomValue:!0,placeholder:"Field or number",className:"min-width-10",options:Ne,value:K?.right,onChange:this.onBinaryRightChanged})))}render(){const{options:K}=this.props,z=K.mode??Ht.ie.BinaryOperation;return a.createElement("div",null,a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement("div",{className:"gf-form-label width-8"},"Mode"),a.createElement(he.Ph,{className:"width-18",options:Pn,value:Pn.find(te=>te.value===z),onChange:this.onModeChanged}))),z===Ht.ie.BinaryOperation&&this.renderBinaryOperation(K.binary),z===Ht.ie.ReduceRow&&this.renderReduceRow(K.reduce),a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement("div",{className:"gf-form-label width-8"},"Alias"),a.createElement(ce.I,{className:"width-18",value:K.alias??"",placeholder:(0,Ht.h)(K),onChange:this.onAliasChanged}))),a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement(pn.LegacyForms.Switch,{label:"Replace all fields",labelClass:"width-8",checked:!!K.replaceFields,onChange:this.onToggleReplaceFields}))))}}const Ea={id:q.W.calculateField,editor:Hn,transformation:ne.Y.calculateFieldTransformer,name:"Add field from calculation",description:"Use the row values to calculate a new field.",categories:new Set([T.w.CalculateNewFields])};var aa=e(2791);const na=[{value:aa.HO.FieldName,label:"Copy frame name to field name"},{value:aa.HO.Label,label:"Add a label with the frame name"},{value:aa.HO.Drop,label:"Ignore the frame name"}];class xa extends a.PureComponent{constructor(K){super(K),this.onModeChanged=z=>{const{options:te,onChange:fe}=this.props,Pe=z.value??aa.HO.FieldName;fe({...te,frameNameMode:Pe})},this.onLabelChanged=z=>{const{options:te}=this.props;this.props.onChange({...te,frameNameLabel:z.target.value})}}render(){const{options:K}=this.props,z=K.frameNameMode??aa.HO.FieldName;return a.createElement("div",null,a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement("div",{className:"gf-form-label width-8"},"Name"),a.createElement(he.Ph,{className:"width-18",options:na,value:na.find(te=>te.value===z),onChange:this.onModeChanged}))),z===aa.HO.Label&&a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement("div",{className:"gf-form-label width-8"},"Label"),a.createElement(ce.I,{className:"width-18",value:K.frameNameLabel??"",placeholder:"frame",onChange:this.onLabelChanged}))))}}const Ca={id:q.W.concatenate,editor:xa,transformation:ne.Y.concatenateTransformer,name:"Concatenate fields",description:"Combine all fields into a single frame. Values will be appended with undefined values if not the same length.",categories:new Set([T.w.Combine])};var Ba=e(86912),ka=e(27857),Ua=e(82382);const $a={settings:{width:24,isClearable:!1}},Mt=({input:U,options:K,onChange:z})=>{const te=ka.OL.filter(lt=>lt.value!==se.fS.trace),fe=(0,a.useCallback)(lt=>vt=>{const Ut=K.conversions;Ut[lt]={...Ut[lt],targetField:vt??"",dateFormat:void 0},z({...K,conversions:Ut})},[z,K]),Pe=(0,a.useCallback)(lt=>vt=>{const Ut=K.conversions;Ut[lt]={...Ut[lt],destinationType:vt.value},z({...K,conversions:Ut})},[z,K]),Ne=(0,a.useCallback)(lt=>vt=>{const Ut=K.conversions;Ut[lt]={...Ut[lt],dateFormat:vt.currentTarget.value},z({...K,conversions:Ut})},[z,K]),Je=(0,a.useCallback)(()=>{z({...K,conversions:[...K.conversions,{targetField:void 0,destinationType:void 0,dateFormat:void 0}]})},[z,K]),ot=(0,a.useCallback)(lt=>{const vt=K.conversions;vt.splice(lt,1),z({...K,conversions:vt})},[z,K]);return a.createElement(a.Fragment,null,K.conversions.map((lt,vt)=>a.createElement("div",{key:`${lt.targetField}-${vt}`},a.createElement(ue.Z,null,a.createElement(pe._,{label:"Field"},a.createElement(Ba.b,{context:{data:U},value:lt.targetField??"",onChange:fe(vt),item:$a})),a.createElement(pe._,{label:"as"},a.createElement(he.Ph,{options:te,value:lt.destinationType,placeholder:"Type",onChange:Pe(vt),width:18})),lt.destinationType===se.fS.time&&a.createElement(pe._,{label:"Input format",tooltip:"Specify the format of the input field so Grafana can parse the date string correctly."},a.createElement(ce.I,{value:lt.dateFormat,placeholder:"e.g. YYYY-MM-DD",onChange:Ne(vt),width:24})),lt.destinationType===se.fS.string&&(lt.dateFormat||(0,Ua.findField)(U?.[0],lt.targetField)?.type===se.fS.time)&&a.createElement(pe._,{label:"Date format",tooltip:"Specify the output format."},a.createElement(ce.I,{value:lt.dateFormat,placeholder:"e.g. YYYY-MM-DD",onChange:Ne(vt),width:24})),a.createElement(re.zx,{size:"md",icon:"trash-alt",variant:"secondary",onClick:()=>ot(vt),"aria-label":"Remove convert field type transformer"})),lt.destinationType===se.fS.enum&&Y.Oh&&a.createElement(ue.Z,null,a.createElement(pe._,{label:"",labelWidth:6},a.createElement("div",null,"TODO... show options here (alpha panels enabled)"))))),a.createElement(re.zx,{size:"sm",icon:"plus",onClick:Je,variant:"secondary","aria-label":"Add a convert field type transformer"},"Convert field type"))},Dt={id:q.W.convertFieldType,editor:Mt,transformation:ne.Y.convertFieldTypeTransformer,name:ne.Y.convertFieldTypeTransformer.name,description:ne.Y.convertFieldTypeTransformer.description,categories:new Set([T.w.Reformat])};var ht=e(95676),Lt=e(22209);class rn extends a.PureComponent{constructor(K){super(K),this.onFieldToggle=z=>{const{selected:te}=this.state;te.indexOf(z)>-1?this.onChange(te.filter(fe=>fe!==z)):this.onChange([...te,z])},this.onChange=z=>{const{regex:te,isRegexValid:fe}=this.state,Pe={...this.props.options,include:{names:z}};te&&fe&&(Pe.include=Pe.include??{},Pe.include.pattern=te),this.setState({selected:z},()=>{this.props.onChange(Pe)})},this.onInputBlur=z=>{const{selected:te,regex:fe}=this.state;let Pe=!0;try{fe&&(0,ht.jO)(fe)}catch{Pe=!1}Pe?this.props.onChange({...this.props.options,include:{pattern:fe}}):this.props.onChange({...this.props.options,include:{names:te}}),this.setState({isRegexValid:Pe})},this.state={include:K.options.include?.names||[],regex:K.options.include?.pattern,options:[],selected:[],isRegexValid:!0}}componentDidMount(){this.initOptions()}componentDidUpdate(K){this.props.input!==K.input&&this.initOptions()}initOptions(){const{input:K,options:z}=this.props,te=Array.from(z.include?.names??[]),fe=[],Pe={};for(const Ne of K)for(const Je of Ne.fields){const ot=(0,oe.CZ)(Je,Ne,K);let lt=Pe[ot];lt||(lt=Pe[ot]={name:ot,count:0},fe.push(lt)),lt.count++}if(z.include?.pattern)try{const Ne=(0,ht.jO)(z.include.pattern);for(const Je of fe)Ne.test(Je.name)&&te.push(Je.name)}catch(Ne){console.error(Ne)}if(te.length){const Ne=fe.filter(Je=>te.includes(Je.name));this.setState({options:fe,selected:Ne.map(Je=>Je.name),regex:z.include?.pattern})}else this.setState({options:fe,selected:fe.map(Ne=>Ne.name),regex:z.include?.pattern})}render(){const{options:K,selected:z,isRegexValid:te}=this.state;return a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form gf-form--grow"},a.createElement("div",{className:"gf-form-label width-8"},"Identifier"),a.createElement(Xt.Lh,{spacing:"xs",align:"flex-start",wrap:!0},a.createElement(Lt.g,{invalid:!te,error:te?void 0:"Invalid pattern",className:(0,Q.css)` margin-bottom: 0; `},a.createElement(ce.I,{placeholder:"Regular expression pattern",value:this.state.regex||"",onChange:fe=>this.setState({regex:fe.currentTarget.value}),onBlur:this.onInputBlur,width:25})),K.map((fe,Pe)=>{const Ne=`${fe.name}${fe.count>1?" ("+fe.count+")":""}`,Je=z.indexOf(fe.name)>-1;return a.createElement(mn.B,{key:`${fe.name}/${Pe}`,onClick:()=>{this.onFieldToggle(fe.name)},label:Ne,selected:Je})}))))}}const zt={id:q.W.filterFieldsByName,editor:rn,transformation:ne.Y.filterFieldsByNameTransformer,name:"Filter by name",description:"Removes part of the query results using a regex pattern. The pattern can be inclusive or exclusive.",categories:new Set([T.w.Filter])};var En=e(59904);class Tn extends a.PureComponent{constructor(K){super(K),this.onFieldToggle=z=>{const{selected:te}=this.state;te.indexOf(z)>-1?this.onChange(te.filter(fe=>fe!==z)):this.onChange([...te,z])},this.onChange=z=>{this.setState({selected:z}),this.props.onChange({...this.props.options,include:z.join("|")})},this.state={include:K.options.include||"",options:[],selected:[]}}componentDidMount(){this.initOptions()}componentDidUpdate(K){this.props.input!==K.input&&this.initOptions()}initOptions(){const{input:K,options:z}=this.props,te=z.include?z.include.split("|"):[],fe=[],Pe={};for(const Ne of K)if(Ne.refId){let Je=Pe[Ne.refId];Je||(Je=Pe[Ne.refId]={refId:Ne.refId,count:0},fe.push(Je)),Je.count++}if(te.length){const Ne=[],Je=[];for(const ot of fe)te.includes(ot.refId)&&Je.push(ot),Ne.push(ot);this.setState({options:Ne,selected:Je.map(ot=>ot.refId)})}else this.setState({options:fe,selected:[]})}render(){const{options:K,selected:z}=this.state,{input:te}=this.props;return a.createElement(a.Fragment,null,te.length<=1&&a.createElement("div",null,a.createElement(En.S,null,"Filter data by query expects multiple queries in the input.")),a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form gf-form--grow"},a.createElement("div",{className:"gf-form-label width-8"},"Series refId"),a.createElement(Xt.Lh,{spacing:"xs",align:"flex-start",wrap:!0},K.map((fe,Pe)=>{const Ne=`${fe.refId}${fe.count>1?" ("+fe.count+")":""}`,Je=z.indexOf(fe.refId)>-1;return a.createElement(mn.B,{key:`${fe.refId}/${Pe}`,onClick:()=>{this.onFieldToggle(fe.refId)},label:Ne,selected:Je})})))))}}const An={id:q.W.filterByRefId,editor:Tn,transformation:ne.Y.filterFramesByRefIdTransformer,name:"Filter data by query",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([T.w.Filter])};var xn=e(42074);function ia({input:U,options:K,onChange:z}){const te=[];for(const Je of U)for(const ot of Je.fields)if(ot.type==="time"){const lt=(0,oe.CZ)(ot,Je,U);te.push({label:lt,value:lt})}const fe=(0,a.useCallback)(Je=>{const ot=Je?.value!==void 0?Je.value:"";z({...K,timeField:ot})},[z,K]),Pe=(0,a.useCallback)(Je=>{const ot=Je.target.value;z({...K,outputFormat:ot})},[z,K]),Ne=(0,a.useCallback)(()=>{z({...K,useTimezone:!K.useTimezone})},[z,K]);return a.createElement(a.Fragment,null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Time Field",labelWidth:15,grow:!0},a.createElement(he.Ph,{options:te,value:K.timeField,onChange:fe,placeholder:"time",isClearable:!0})),a.createElement(pe._,{label:"Format",labelWidth:10,tooltip:"The output format for the field specified as a moment.js format string."},a.createElement(ce.I,{onChange:Pe,value:K.outputFormat})),a.createElement(pe._,{label:"Use Timezone",tooltip:"Use the user's configured timezone when formatting time.",labelWidth:20},a.createElement(xn.x,{value:K.useTimezone,transparent:!0,onChange:Ne}))))}const oa={id:q.W.formatTime,editor:ia,transformation:ne.Y.formatTimeTransformer,name:ne.Y.formatTimeTransformer.name,state:it.BV.alpha,description:ne.Y.formatTimeTransformer.description};var _n=e(11770),sa=e(23852),ca=e(30306);const jn=({input:U,options:K,onChange:z})=>{const te=(0,ca.Hg)(U),fe=(0,a.useCallback)(Pe=>Ne=>{z({...K,fields:{...K.fields,[Pe]:Ne}})},[z]);return a.createElement("div",null,te.map(Pe=>a.createElement(Ta,{onConfigChange:fe(Pe),fieldName:Pe,config:K.fields[Pe],key:Pe})))},ns=[{label:"Group by",value:_n.x.groupBy},{label:"Calculate",value:_n.x.aggregate}],Ta=({fieldName:U,config:K,onConfigChange:z})=>{const te=(0,Be.l4)(),fe=Ja(te),Pe=(0,a.useCallback)(Ne=>{z({aggregations:K?.aggregations??[],operation:Ne?.value??null})},[K,z]);return a.createElement(pe._,{label:U,labelWidth:32,grow:!0,shrink:!0},a.createElement(sa.K,{gap:.5,direction:"row",wrap:!1},a.createElement("div",{className:fe.operation},a.createElement(he.Ph,{options:ns,value:K?.operation,placeholder:"Ignored",onChange:Pe,isClearable:!0})),K?.operation===_n.x.aggregate&&a.createElement(Se.m,{className:fe.aggregations,placeholder:"Select Stats",allowMultiple:!0,stats:K.aggregations,onChange:Ne=>{z({...K,aggregations:Ne})}})))},Ja=U=>({operation:(0,Q.css)` flex-shrink: 0; height: 100%; width: ${U.spacing(24)}; `,aggregations:(0,Q.css)` flex-grow: 1; `}),ps={id:q.W.groupBy,editor:jn,transformation:ne.Y.groupByTransformer,name:ne.Y.groupByTransformer.name,description:ne.Y.groupByTransformer.description,categories:new Set([T.w.Combine,T.w.CalculateNewFields,T.w.Reformat])};var Jn=e(49721);const Ya=({input:U,options:K,onChange:z})=>{const te=(0,ca.Hg)(U).map(lt=>({label:lt,value:lt})),fe=(0,a.useCallback)(lt=>{z({...K,columnField:lt?.value})},[z,K]),Pe=(0,a.useCallback)(lt=>{z({...K,rowField:lt?.value})},[z,K]),Ne=(0,a.useCallback)(lt=>{z({...K,valueField:lt?.value})},[z,K]),Je=[{label:"Null",value:Jn.U.Null,description:"Null value"},{label:"True",value:Jn.U.True,description:"Boolean true value"},{label:"False",value:Jn.U.False,description:"Boolean false value"},{label:"Empty",value:Jn.U.Empty,description:"Empty string"}],ot=(0,a.useCallback)(lt=>{z({...K,emptyValue:lt?.value})},[z,K]);return a.createElement(a.Fragment,null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Column",labelWidth:8},a.createElement(he.Ph,{options:te,value:K.columnField,onChange:fe,isClearable:!0})),a.createElement(pe._,{label:"Row",labelWidth:8},a.createElement(he.Ph,{options:te,value:K.rowField,onChange:Pe,isClearable:!0})),a.createElement(pe._,{label:"Cell Value",labelWidth:10},a.createElement(he.Ph,{options:te,value:K.valueField,onChange:Ne,isClearable:!0})),a.createElement(pe._,{label:"Empty Value"},a.createElement(he.Ph,{options:Je,value:K.emptyValue,onChange:ot,isClearable:!0}))))},xs={id:q.W.groupingToMatrix,editor:Ya,transformation:ne.Y.groupingToMatrixTransformer,name:"Grouping to matrix",description:"Takes a three fields combination and produces a Matrix.",categories:new Set([T.w.Combine,T.w.Reformat])};var ss=e(35596),Xa=e(55093);const Ps=({input:U,options:K,onChange:z})=>{const fe=(0,a.useCallback)(Je=>{z({...K,bucketSize:Je})},[z,K]),Pe=(0,a.useCallback)(Je=>{z({...K,bucketOffset:Je})},[z,K]),Ne=(0,a.useCallback)(()=>{z({...K,combine:!K.combine})},[z,K]);return a.createElement("div",null,a.createElement(ue.Z,null,a.createElement(pe._,{labelWidth:18,label:ss.py.bucketSize.name,tooltip:ss.py.bucketSize.description},a.createElement(Xa.Y,{value:K.bucketSize,placeholder:"auto",onChange:fe,min:0}))),a.createElement(ue.Z,null,a.createElement(pe._,{labelWidth:18,label:ss.py.bucketOffset.name,tooltip:ss.py.bucketOffset.description},a.createElement(Xa.Y,{value:K.bucketOffset,placeholder:"none",onChange:Pe,min:0}))),a.createElement(ue.Z,null,a.createElement(pe._,{labelWidth:18,label:ss.py.combine.name,tooltip:ss.py.combine.description},a.createElement(xn.x,{value:K.combine??!1,onChange:Ne}))))},hs={id:q.W.histogram,editor:Ps,transformation:ne.Y.histogramTransformer,name:ne.Y.histogramTransformer.name,description:ne.Y.histogramTransformer.description,categories:new Set([T.w.CreateNewVisualization])};var qs=e(69811);const Sr=[{value:qs.c.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:qs.c.outerTabular,label:"OUTER (TABULAR)",description:"Join on a field value with dupicated values. Non performant outer join best used for tabular(SQL like) data."},{value:qs.c.inner,label:"INNER",description:"Drop rows that do not match a value in all tables."}];function Tr({input:U,options:K,onChange:z}){const te=(0,ca.Hg)(U).map(Ne=>({label:Ne,value:Ne})),fe=(0,a.useCallback)(Ne=>{z({...K,byField:Ne?.value})},[z,K]),Pe=(0,a.useCallback)(Ne=>{z({...K,mode:Ne?.value})},[z,K]);return a.createElement(a.Fragment,null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Mode",labelWidth:8,grow:!0},a.createElement(he.Ph,{options:Sr,value:K.mode??qs.c.outer,onChange:Pe}))),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Field",labelWidth:8,grow:!0},a.createElement(he.Ph,{options:te,value:K.byField,onChange:fe,placeholder:"time",isClearable:!0}))))}const lr={id:q.W.joinByField,aliasIds:[q.W.seriesToColumns],editor:Tr,transformation:ne.Y.joinByFieldTransformer,name:ne.Y.joinByFieldTransformer.name,description:ne.Y.joinByFieldTransformer.description,categories:new Set([T.w.Combine])};var cr=e(23830);const Ds=[{value:cr.k.Columns,label:"Columns"},{value:cr.k.Rows,label:"Rows"}],kn=({input:U,options:K,onChange:z})=>{const{labelNames:fe,selected:Pe}=(0,a.useMemo)(()=>{let ot=[],lt={};for(const Ut of U)for(const Zt of Ut.fields)if(Zt.labels)for(const nn of Object.keys(Zt.labels))lt[nn]||(ot.push({value:nn,label:nn}),lt[nn]=!0);const vt=new Set(K.keepLabels?.length?K.keepLabels:Object.keys(lt));return{labelNames:ot,selected:vt}},[K.keepLabels,U]),Ne=ot=>{z({...K,valueLabel:ot?.value})},Je=ot=>{if(Pe.has(ot)?Pe.delete(ot):Pe.add(ot),Pe.size===fe.length||!Pe.size){const{keepLabels:lt,...vt}=K;z(vt)}else z({...K,keepLabels:[...Pe]})};return a.createElement("div",null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Mode",labelWidth:20},a.createElement(ae.S,{options:Ds,value:K.mode??cr.k.Columns,onChange:ot=>z({...K,mode:ot})}))),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Labels",labelWidth:20},a.createElement(sa.K,{gap:1,wrap:!0},fe.map((ot,lt)=>{const vt=ot.label;return a.createElement(mn.B,{key:`${vt}/${lt}`,onClick:()=>Je(vt),label:vt,selected:Pe.has(vt)})})))),K.mode!==cr.k.Rows&&a.createElement(ue.Z,null,a.createElement(pe._,{label:"Value field name",labelWidth:20,tooltip:"Replace the value field name with a label",htmlFor:"labels-to-fields-as-name"},a.createElement(he.Ph,{inputId:"labels-to-fields-as-name",isClearable:!0,allowCustomValue:!1,placeholder:"(Optional) Select label",options:fe,value:K?.valueLabel,onChange:Ne,className:"min-width-16"}))))},ya={id:q.W.labelsToFields,editor:kn,transformation:ne.Y.labelsToFieldsTransformer,name:"Labels to fields",description:`Groups series by time and return labels or tags as fields. Useful for showing time series with labels in a table where each label key becomes a separate column.`,categories:new Set([T.w.Reformat])},ma=({options:U,onChange:K})=>{const z=(0,a.useCallback)(te=>{K({...U,limitField:Number(te.currentTarget.value)})},[K,U]);return a.createElement(a.Fragment,null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Limit",labelWidth:8},a.createElement(ce.I,{placeholder:"Limit count",pattern:"[0-9]*",value:U.limitField,onChange:z,width:25}))))},Sa={id:q.W.limit,editor:ma,transformation:ne.Y.limitTransformer,name:"Limit",description:"Limit the number of items displayed.",categories:new Set([T.w.Filter])},er=({input:U,options:K,onChange:z})=>U.length<=1?a.createElement(En.S,null,"Merge has no effect when applied on a single frame."):null,ws={id:q.W.merge,editor:er,transformation:ne.Y.mergeTransformer,name:"Merge",description:`Merge many series/tables and return a single table where mergeable values will be combined into the same row. Useful for showing multiple series, tables or a combination of both visualized in a table.`,categories:new Set([T.w.Combine])};var Za=e(85532),jt=e(6788),va=e(73453),Vs=e(67437);const Fr=({options:U,input:K,onChange:z})=>{const{indexByName:te,excludeByName:fe,renameByName:Pe}=U,Ne=(0,ca.Hg)(K),Je=(0,a.useMemo)(()=>sr(Ne,te),[Ne,te]),ot=(0,a.useCallback)((Ut,Zt)=>{z({...U,excludeByName:{...fe,[Ut]:Zt}})},[z,U,fe]),lt=(0,a.useCallback)(Ut=>{if(!Ut||!Ut.destination)return;const Zt=Ut.source.index,nn=Ut.destination.index;Zt!==nn&&z({...U,indexByName:Ss(Ne,Zt,nn)})},[z,U,Ne]),vt=(0,a.useCallback)((Ut,Zt)=>{z({...U,renameByName:{...U.renameByName,[Ut]:Zt}})},[z,U]);return K.length>1?a.createElement(En.S,null,"Organize fields only works with a single frame. Consider applying a join transformation or filtering the input first."):a.createElement(Za.Z5,{onDragEnd:lt},a.createElement(Za.bK,{droppableId:"sortable-fields-transformer",direction:"vertical"},Ut=>a.createElement("div",{ref:Ut.innerRef,...Ut.droppableProps},Je.map((Zt,nn)=>a.createElement(dr,{fieldName:Zt,renamedFieldName:Pe[Zt],index:nn,onToggleVisibility:ot,onRenameField:vt,visible:!fe[Zt],key:Zt})),Ut.placeholder)))};Fr.displayName="OrganizeFieldsTransformerEditor";const dr=({fieldName:U,renamedFieldName:K,index:z,visible:te,onToggleVisibility:fe,onRenameField:Pe})=>{const Ne=(0,Be.wW)(Zr);return a.createElement(Za._l,{draggableId:U,index:z},Je=>a.createElement("div",{className:"gf-form-inline",ref:Je.innerRef,...Je.draggableProps},a.createElement("div",{className:"gf-form gf-form--grow"},a.createElement("div",{className:"gf-form-label gf-form-label--justify-left width-30"},a.createElement(va.J,{name:"draggabledots",title:"Drag and drop to reorder",size:"lg",className:Ne.draggable,...Je.dragHandleProps}),a.createElement(Vs.h,{className:Ne.toggle,size:"md",name:te?"eye":"eye-slash",onClick:()=>fe(U,te),tooltip:te?"Disable":"Enable"}),a.createElement("span",{className:Ne.name,title:U},U)),a.createElement(ce.I,{className:"flex-grow-1",defaultValue:K||"",placeholder:`Rename ${U}`,onBlur:ot=>Pe(U,ot.currentTarget.value)}))))};dr.displayName="DraggableFieldName";const Zr=U=>({toggle:(0,Q.css)` margin: 0 8px; color: ${U.colors.text.secondary}; `,draggable:(0,Q.css)` opacity: 0.4; &:hover { color: ${U.colors.text.maxContrast}; } `,name:(0,Q.css)` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: ${U.typography.bodySmall.fontSize}; font-weight: ${U.typography.fontWeightMedium}; `}),Ss=(U,K,z)=>{const te=Array.from(U),[fe]=te.splice(K,1);return te.splice(z,0,fe),te.reduce((Pe,Ne,Je)=>(Pe[Ne]=Je,Pe),{})},sr=(U,K={})=>{if(!K||Object.keys(K).length===0)return U;const z=(0,jt.$)(K);return U.sort(z)},Ts={id:q.W.organize,editor:Fr,transformation:ne.Y.organizeFieldsTransformer,name:"Organize fields",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([T.w.ReorderAndRename])};var ks=e(85722),Va=e(74639);const Jr=({options:U,onChange:K})=>{const z=[{label:"Series to rows",value:ks.AL.SeriesToRows,description:"Create a table with one row for each series value"},{label:"Reduce fields",value:ks.AL.ReduceFields,description:"Collapse each field into a single value"}],te=(0,a.useCallback)(Ne=>{const Je=Ne.value;K({...U,mode:Je,includeTimeField:Je===ks.AL.ReduceFields?!!U.includeTimeField:!1})},[K,U]),fe=(0,a.useCallback)(()=>{K({...U,includeTimeField:!U.includeTimeField})},[K,U]),Pe=(0,a.useCallback)(()=>{K({...U,labelsToFields:!U.labelsToFields})},[K,U]);return a.createElement(a.Fragment,null,a.createElement(pe._,{label:"Mode","aria-label":Va.wl.components.Transforms.Reduce.modeLabel,grow:!0,labelWidth:16},a.createElement(he.Ph,{options:z,value:z.find(Ne=>Ne.value===U.mode)||z[0],onChange:te})),a.createElement(pe._,{label:"Calculations","aria-label":Va.wl.components.Transforms.Reduce.calculationsLabel,grow:!0,labelWidth:16},a.createElement(Se.m,{placeholder:"Choose Stat",allowMultiple:!0,stats:U.reducers||[],onChange:Ne=>{K({...U,reducers:Ne})}})),U.mode===ks.AL.ReduceFields&&a.createElement(pe._,{htmlFor:"include-time-field",labelWidth:16,label:"Include time"},a.createElement(xn.x,{id:"include-time-field",value:!!U.includeTimeField,onChange:fe})),U.mode!==ks.AL.ReduceFields&&a.createElement(pe._,{htmlFor:"labels-to-fields",labelWidth:16,label:"Labels to fields"},a.createElement(xn.x,{id:"labels-to-fields",value:!!U.labelsToFields,onChange:Pe})))},Ct={id:q.W.reduce,editor:Jr,transformation:ne.Y.reduceTransformer,name:ne.Y.reduceTransformer.name,description:ne.Y.reduceTransformer.description,categories:new Set([T.w.CalculateNewFields])};class gt extends a.PureComponent{constructor(K){super(K),this.handleRegexChange=z=>{const te=z.currentTarget.value;let fe=!0;if(te)try{te&&(0,ht.jO)(te)}catch{fe=!1}this.setState(Pe=>({...Pe,regex:te,isRegexValid:fe}))},this.handleRenameChange=z=>{const te=z.currentTarget.value;this.setState(fe=>({...fe,renamePattern:te}))},this.handleRegexBlur=z=>{const te=z.currentTarget.value;let fe=!0;try{te&&(0,ht.jO)(te)}catch{fe=!1}this.setState({isRegexValid:fe},()=>{fe&&this.props.onChange({...this.props.options,regex:te})})},this.handleRenameBlur=z=>{const te=z.currentTarget.value;this.setState({renamePattern:te},()=>this.props.onChange({...this.props.options,renamePattern:te}))},this.state={regex:K.options.regex,renamePattern:K.options.renamePattern,isRegexValid:!0}}render(){const{regex:K,renamePattern:z,isRegexValid:te}=this.state;return a.createElement(a.Fragment,null,a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form gf-form--grow"},a.createElement("div",{className:"gf-form-label width-8"},"Match"),a.createElement(Lt.g,{invalid:!te,error:te?void 0:"Invalid pattern",className:(0,Q.css)` margin-bottom: 0; `},a.createElement(ce.I,{placeholder:"Regular expression pattern",value:K||"",onChange:this.handleRegexChange,onBlur:this.handleRegexBlur,width:25})))),a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form gf-form--grow"},a.createElement("div",{className:"gf-form-label width-8"},"Replace"),a.createElement(Lt.g,{className:(0,Q.css)` margin-bottom: 0; `},a.createElement(ce.I,{placeholder:"Replacement pattern",value:z||"",onChange:this.handleRenameChange,onBlur:this.handleRenameBlur,width:25})))))}}const kt={id:q.W.renameByRegex,editor:gt,transformation:ne.Y.renameByRegexTransformer,name:"Rename by regex",description:"Renames part of the query result by using regular expression with placeholders.",categories:new Set([T.w.ReorderAndRename])},Kt=({input:U,options:K,onChange:z})=>null,an={id:q.W.seriesToRows,editor:Kt,transformation:ne.Y.seriesToRowsTransformer,name:"Series to rows",description:`Merge many series and return a single series with time, metric and value as columns. Useful for showing multiple time series visualized in a table.`,categories:new Set([T.w.Combine,T.w.Reformat])},yn=({input:U,options:K,onChange:z})=>{const te=(0,ca.Hg)(U).map(Ne=>({label:Ne,value:Ne})),fe=(0,a.useCallback)((Ne,Je)=>{z({...K,sort:[Je]})},[z,K]),Pe=K.sort?.length?K.sort:[{}];return a.createElement("div",null,Pe.map((Ne,Je)=>a.createElement(ue.Z,{key:`${Ne.field}/${Je}`},a.createElement(pe._,{label:"Field",labelWidth:10,grow:!0},a.createElement(he.Ph,{options:te,value:Ne.field,placeholder:"Select field",onChange:ot=>{fe(Je,{...Ne,field:ot.value})}})),a.createElement(pe._,{label:"Reverse"},a.createElement(xn.x,{value:!!Ne.desc,onChange:()=>{fe(Je,{...Ne,desc:!Ne.desc})}})))))},hn={id:q.W.sortBy,editor:yn,transformation:ne.Y.sortByTransformer,name:ne.Y.sortByTransformer.name,description:ne.Y.sortByTransformer.description,categories:new Set([T.w.ReorderAndRename])};function Ln({options:U,onChange:K}){const[z,te]=(0,a.useState)(U),fe=un(),Pe=Et(),Ne=()=>{z.push({path:""}),te([...z]),lt()},Je=vt=>{z&&(z.splice(vt,1),te([...z]),lt())},ot=(vt,Ut,Zt)=>{z&&(Zt==="alias"?z[Ut].alias=vt.currentTarget.value??"":z[Ut].path=vt.currentTarget.value??"",te([...z]))},lt=()=>{K(z)};return a.createElement("ol",{className:(0,Q.cx)(Pe.list)},z&&z.map((vt,Ut)=>a.createElement("li",{key:Ut},a.createElement(ue.Z,null,a.createElement(pe._,{label:"Field",tooltip:fe.field,grow:!0},a.createElement(ce.I,{onBlur:lt,onChange:Zt=>ot(Zt,Ut,"path"),value:vt.path,placeholder:'A valid json path, e.g. "object.value1" or "object.value2[0]"'})),a.createElement(pe._,{label:"Alias",tooltip:fe.alias},a.createElement(ce.I,{width:12,value:vt.alias,onBlur:lt,onChange:Zt=>ot(Zt,Ut,"alias")})),a.createElement(pe._,{className:(0,Q.cx)(Pe.removeIcon)},a.createElement(Vs.h,{onClick:()=>Je(Ut),name:"trash-alt",tooltip:"Remove path"}))))),a.createElement(pe._,null,a.createElement(re.zx,{icon:"plus",onClick:()=>Ne(),variant:"secondary"},"Add path")))}const un=()=>{const U=[{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:a.createElement("div",null,"A valid path of an json object.",a.createElement("div",null,a.createElement("strong",null,"JSON Value:")),a.createElement("pre",null,a.createElement("code",null,["{",' "object": {',' "value1": "hello world"',' "value2": [1, 2, 3, 4]'," }","}"].join(` `))),a.createElement("strong",null,"Valid Paths:"),U.map((K,z)=>a.createElement("p",{key:z},a.createElement("code",null,K.path),a.createElement("i",null,K.description)))),alias:"An alias name for the variable in the dashboard. If left blank the given path will be used."}};function Et(){return{list:(0,Q.css)` margin-left: 20px; `,removeIcon:(0,Q.css)` margin: 0 0 0 4px; align-items: center; `}}var Vn=e(32053),da=(U=>(U.JSON="json",U.KeyValues="kvp",U.Auto="auto",U))(da||{});const Ga={id:da.JSON,name:"JSON",description:"Parse JSON string",parse:U=>JSON.parse(U)};function Cs(U){const K=[];let z="",te="";const fe={};for(let Pe=0;Pe<U.length;Pe++){let Ne=U[Pe];Ne===z&&(z="",Ne=U[++Pe]);const Je=Ne==="\\";if(Je&&(Ne=U[++Pe]),Je||z.length){K.push(Ne);continue}switch((Ne==='"'||Ne==="'")&&(z=Ne),Ne){case":":case"=":K.length&&(te&&(fe[te]=""),te=K.join(""),K.length=0);break;case'"':case"'":case" ":case` `:case" ":case"\r":case` `:K.length&&te===""&&(fe[K.join("")]="",K.length=0);case",":case";":case"&":case"{":case"}":if(K.length){const ot=K.join("");te.length?(fe[te]=ot,te=""):te=ot,K.length=0}break;default:K.push(Ne),Pe===U.length-1&&te===""&&K.length&&(fe[K.join("")]="",K.length=0)}}return te.length&&(fe[te]=K.join("")),fe}const rs={id:da.KeyValues,name:"Key+value pairs",description:"Look for a=b, c: d values in the line",parse:Cs},Bs=[Ga,rs],pr={id:da.Auto,name:"Auto",description:"parse new fields automatically",parse:U=>{for(const K of Bs)try{const z=K.parse(U);if(z!=null)return z}catch{}}},Kr=new ye.B(()=>[...Bs,pr]),Pa={id:q.W.extractFields,name:"Extract fields",description:"Parse fields from the contends of another",defaultOptions:{},operator:(U,K)=>z=>z.pipe((0,Nt.U)(te=>Pa.transformer(U,K)(te))),transformer:U=>K=>K.map(z=>vs(z,U))};function vs(U,K){if(!K.source)return U;const z=(0,Ua.findField)(U,K.source);if(!z)return U;const te=Kr.getIfExists(K.format??da.Auto);if(!te)throw new Error("unkonwn extractor");const fe=U.length,Pe=[],Ne=new Map;for(let ot=0;ot<fe;ot++){let lt=z.values[ot];if((0,v.isString)(lt))try{lt=te.parse(lt)}catch{lt={}}if(lt!=null){if(K.format===da.JSON&&K.jsonPaths&&K.jsonPaths?.length>0){const vt={},Ut=K.jsonPaths.filter(Zt=>Zt.path);Ut.length>0&&(Ut.forEach(Zt=>{const nn=Zt.alias&&Zt.alias.length>0?Zt.alias:Zt.path;vt[nn]=(0,v.get)(lt,Zt.path)??"Not Found"}),lt=vt)}for(const[vt,Ut]of Object.entries(lt)){let Zt=Ne.get(vt);Zt==null&&(Zt=new Array(fe),Ne.set(vt,Zt),Pe.push(vt)),Zt[ot]=Ut}}}const Je=Pe.map(ot=>{const lt=Ne.get(ot);return{name:ot,values:lt,type:lt?(0,Vn.DP)(lt.find(vt=>vt!=null)):se.fS.other,config:{}}});if(K.keepTime){const ot=(0,Ua.findField)(U,"Time")||(0,Ua.findField)(U,"time");ot&&Je.unshift(ot)}return K.replace||Je.unshift(...U.fields),{...U,fields:Je}}const hr={settings:{width:30,placeholderText:"Select field"},name:"",id:"",editor:()=>null},Da=({input:U,options:K,onChange:z})=>{const te=lt=>{z({...K,source:lt})},fe=lt=>{z({...K,format:lt?.value})},Pe=lt=>{z({...K,jsonPaths:lt})},Ne=()=>{K.replace&&(K.keepTime=!1),z({...K,replace:!K.replace})},Je=()=>{z({...K,keepTime:!K.keepTime})},ot=Kr.selectOptions(K.format?[K.format]:void 0);return a.createElement("div",null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Source",labelWidth:16},a.createElement(Ba.b,{context:{data:U},value:K.source??"",onChange:te,item:hr}))),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Format",labelWidth:16},a.createElement(he.Ph,{value:ot.current[0],options:ot.options,onChange:fe,width:24,placeholder:"Auto"}))),K.format==="json"&&a.createElement(Ln,{options:K.jsonPaths??[],onChange:Pe}),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Replace all fields",labelWidth:16},a.createElement(xn.x,{value:K.replace??!1,onChange:Ne}))),K.replace&&a.createElement(ue.Z,null,a.createElement(pe._,{label:"Keep time",labelWidth:16},a.createElement(xn.x,{value:K.keepTime??!1,onChange:Je}))))},is={id:q.W.extractFields,editor:Da,transformation:Pa,name:"Extract fields",description:"Parse fields from content (JSON, labels, etc).",categories:new Set([T.w.Reformat])};var $s=e(63439),ai=e(73990);const Xr={id:q.W.joinByLabels,name:"Join by labels",description:"Flatten labeled results into a table joined by labels.",defaultOptions:{},operator:(U,K)=>z=>z.pipe((0,Nt.U)(te=>Xr.transformer(U,K)(te))),transformer:U=>K=>!K||!K.length?K:[vr(U,K)]};function vr(U,K){if(!U.value?.length)return qr("No value labele configured");const z=(0,ca.jY)(K);if(z.size<1)return qr("No labels in result");if(!z.has(U.value))return qr("Value label not found");let te=U.join?.length?U.join:Array.from(z);te=te.filter(Ut=>Ut!==U.value);const fe=new Set,Pe=new Map,Ne={};for(const Ut of K)for(const Zt of Ut.fields)if(Zt.labels&&Zt.type!==se.fS.time){const nn=te.map(Qa=>Zt.labels[Qa]),gn=nn.join(",");let bn=Pe.get(gn);bn||(bn={keys:nn,values:{}},Pe.set(gn,bn));const Kn=Zt.labels[U.value],ja=Zt.values,Ra=bn.values[Kn];Ra?bn.values[Kn]=Ra.concat(ja):bn.values[Kn]=ja,Ne[Kn]||(Ne[Kn]=Zt),fe.add(Kn)}const Je=Array.from(fe),ot=te.map(()=>[]),lt=Je.map(()=>[]);for(const Ut of Pe.values()){let Zt=-1,nn=!1;for(;!nn;){Zt++,nn=!0;for(let gn=0;gn<te.length;gn++)ot[gn].push(Ut.keys[gn]);for(let gn=0;gn<Je.length;gn++){const bn=Je[gn],Kn=Ut.values[bn]??[];lt[gn].push(Kn[Zt]),Kn.length>Zt+1&&(nn=!1)}}}const vt={fields:[],length:lt[0].length};for(let Ut=0;Ut<te.length;Ut++)vt.fields.push({name:te[Ut],config:{},type:se.fS.string,values:ot[Ut]});for(let Ut=0;Ut<Je.length;Ut++){const Zt=Ne[Je[Ut]];vt.fields.push({name:Je[Ut],config:{},type:Zt.type??se.fS.number,values:lt[Ut]})}return vt}function qr(U){return{meta:{notices:[{severity:"error",text:U}]},fields:[{name:"Error",type:se.fS.string,config:{},values:[U]}],length:0}}function Fi({input:U,options:K,onChange:z}){const te=(0,a.useMemo)(()=>{let ot;const lt=(0,ca.jY)(U),vt=Array.from(lt).map(Kn=>({label:Kn,value:Kn}));let Ut=vt.find(Kn=>Kn.value===K.value);!Ut&&K.value&&(Ut={label:`${K.value} (not found)`,value:K.value},vt.push(Ut)),U.length?lt.size===0&&(ot=a.createElement($s.b,{title:"No labels found"},"The input does not contain any labels")):ot=a.createElement($s.b,{title:"No input found"},"No input (or labels) found"),lt.delete(K.value);const Zt=Array.from(lt).map(Kn=>({label:Kn,value:Kn}));let nn=Zt;const gn=!!K.join?.length;let bn="Join";return gn?nn=Zt.filter(Kn=>!K.join.includes(Kn.value)):bn=Zt.map(Kn=>Kn.value).join(", "),{warn:ot,valueOptions:vt,valueOption:Ut,joinOptions:Zt,addOptions:nn,addText:bn,hasJoin:gn,key:Date.now()}},[K,U]),fe=(ot,lt)=>{if(!K.join)return;const vt=K.join.slice();if(lt)vt[ot]=lt;else if(vt.splice(ot,1),!vt.length){z({...K,join:void 0});return}const Ut=new Set(vt);K.value&&Ut.delete(K.value),z({...K,join:Array.from(Ut)})},Pe=ot=>{const lt=ot?.value;if(!lt)return;const vt=K.join?K.join.slice():[];vt.push(lt),z({...K,join:vt})},Ne=10,Je="No labels found";return a.createElement("div",null,te.warn,a.createElement(ue.Z,null,a.createElement(pe._,{error:"required",invalid:!K.value?.length,label:"Value",labelWidth:Ne,tooltip:"Select the label indicating the values name"},a.createElement(he.Ph,{options:te.valueOptions,value:te.valueOption,onChange:ot=>z({...K,value:ot.value}),noOptionsMessage:Je}))),te.hasJoin?K.join.map((ot,lt)=>a.createElement(ue.Z,{key:ot+lt},a.createElement(pe._,{label:"Join",labelWidth:Ne,error:"Unable to join by the value label",invalid:ot===K.value},a.createElement(Xt.Lh,null,a.createElement(he.Ph,{options:te.joinOptions,value:te.joinOptions.find(vt=>vt.value===ot),isClearable:!0,onChange:vt=>fe(lt,vt?.value),noOptionsMessage:Je}),!!(te.addOptions.length&<===K.join.length-1)&&a.createElement(ai.b,{icon:"plus",label:"",options:te.addOptions,onChange:Pe,variant:"secondary"}))))):a.createElement(a.Fragment,null,!!te.addOptions.length&&a.createElement(ue.Z,null,a.createElement(pe._,{label:"Join",labelWidth:Ne},a.createElement(he.Ph,{options:te.addOptions,placeholder:te.addText,onChange:Pe,noOptionsMessage:Je})))))}const si={id:Xr.id,editor:Fi,transformation:Xr,name:Xr.name,description:Xr.description,state:it.BV.beta,categories:new Set([T.w.Combine])};var Ki=e(58514),Vr=e(22479),_s=e(91053),Vi=e(92886);const Gs={id:q.W.fieldLookup,name:"Lookup fields from resource",description:"Retrieve matching data based on specified field",defaultOptions:{},operator:U=>K=>K.pipe((0,Vr.z)(z=>(0,_s.D)(Ws(z,U))))};async function Ws(U,K){const z=Z.Ls.get(le.mi.byName).get(K?.lookupField),te=await(0,Vi.so)(K?.gazetteer??Vi.LI);return te.frame?eo(U,te,z):Promise.reject("missing frame in gazetteer")}function eo(U,K,z){const te=K.frame()?.fields;return te?U.map(fe=>{const Pe=fe.length,Ne=[];for(const Je of fe.fields)if(Ne.push(Je),z(Je,fe,U)){const ot=Je.values,lt=[];for(const vt of te){const Ut=new Array(Pe);lt.push(Ut),Ne.push({...vt,values:Ut})}for(let vt=0;vt<K.count;vt++){const Ut=K.find(ot[vt]);if(Ut?.index!=null)for(let Zt=0;Zt<te.length;Zt++)lt[Zt][vt]=te[Zt].values[Ut.index]}}return{...fe,fields:Ne}}):U}const Oo={settings:{width:30,filter:U=>U.type===se.fS.string,placeholderText:"Select text field",noFieldsMessage:"No text fields found"},name:"",id:"",editor:()=>null},js={settings:{}},$i=({input:U,options:K,onChange:z})=>{const te=(0,a.useCallback)(Pe=>{z({...K,lookupField:Pe})},[z,K]),fe=(0,a.useCallback)(Pe=>{z({...K,gazetteer:Pe})},[z,K]);return a.createElement("div",null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Field",labelWidth:12},a.createElement(Ba.b,{context:{data:U},value:K?.lookupField??"",onChange:te,item:Oo}))),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Lookup",labelWidth:12},a.createElement(Ki.Q,{value:K?.gazetteer??"",context:{data:U},item:js,onChange:fe}))))},fo={id:q.W.fieldLookup,editor:$i,transformation:Gs,name:"Field lookup",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:it.BV.alpha,categories:new Set([T.w.PerformSpatialOperations])};var tr=e(38588),go=e(95312),to=e(31323);const no=(U,K,z=[])=>(K===0?z.push(U):U.forEach(te=>{no(te,K-1,z)}),z);function _i(U){const K=U[0].length,z=U.length,te=new Map;for(let fe=0;fe<K;fe++){let Pe=te;for(let Ne=0;Ne<z;Ne++){let Je=U[Ne][fe],ot=Pe.get(Je);ot==null&&(ot=Ne===z-1?[]:new Map,Pe.set(Je,ot)),Pe=ot}Pe.push(fe)}return no(te,z)}const Xl={asLabels:!0,append:!1,withNames:!1,separator1:"=",separator2:" "};function uu(U,K,z){return K.map((te,fe)=>U.withNames?`${te}${U.separator1}${z[fe]}`:z[fe]).join(U.separator2)}function zi(U,K){const z={};return U.forEach((te,fe)=>{z[te]=String(K[fe])}),z}const Io={id:q.W.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:{},operator:(U,K)=>z=>z.pipe((0,Nt.U)(te=>Io.transformer(U,K)(te))),transformer:(U,K)=>{const z=(0,go.f)({names:U.fields});if(!z)return to.d.transformer({},K);const te=(0,Z.sq)(z);return fe=>fe.length?ql(fe[0],te,U):fe}};function ql(U,K,z){const te=U.fields.filter(Je=>K(Je,U,[U])),fe=te.map(Je=>Je.values),Pe=te.map(Je=>Je.name),Ne={...Xl,...z?.naming};return _i(fe).map(Je=>{let ot=U.name,lt={};if(Ne.asLabels)lt=zi(Pe,te.map((Ut,Zt)=>fe[Zt][Je[0]]));else{let Ut=uu(Ne,Pe,te.map((Zt,nn)=>fe[nn][Je[0]]));Ne?.append&&U.name&&(Ut=`${U.name} ${Ut}`),ot=Ut}let vt=U.fields;if(!z?.keepFields){const Ut=new Set(Pe);vt=U.fields.filter(Zt=>!Ut.has(Zt.name))}return{name:ot,meta:U.meta,length:Je.length,fields:vt.map(Ut=>{const Zt=Ut.values,nn=Array(Je.length);for(let gn=0;gn<Je.length;gn++)nn[gn]=Zt[Je[gn]];return{name:Ut.name,type:Ut.type,config:Ut.config,labels:{...Ut.labels,...lt},values:nn}})}})}function mu({input:U,options:K,onChange:z}){const te=(0,tr.IX)(U),fe=(0,tr.nw)(te),Pe=(0,a.useMemo)(()=>{const lt=new Set(K.fields);return lt.size<1?fe:fe.filter(vt=>!lt.has(vt.value))},[fe,K]),Ne=(0,a.useCallback)(lt=>{if(!lt.value)return;const vt=new Set(K.fields);vt.add(lt.value),z({...K,fields:[...vt]})},[z,K]),Je=(0,a.useCallback)(lt=>{if(!lt)return;const vt=new Set(K.fields);vt.delete(lt),z({...K,fields:[...vt]})},[z,K]);if(U.length>1)return a.createElement(En.S,null,"Partition by values only works with a single frame.");const ot=[...new Set(K.fields)];return a.createElement("div",null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Field",labelWidth:10,grow:!0},a.createElement(Xt.Lh,null,ot.map(lt=>a.createElement(re.zx,{key:lt,icon:"times",variant:"secondary",size:"md",onClick:()=>Je(lt)},lt)),Pe.length&&a.createElement(ai.b,{variant:"secondary",size:"md",options:Pe,onChange:Ne,label:"Select field",icon:"plus"})))))}const fu={id:q.W.partitionByValues,editor:mu,transformation:Io,name:Io.name,description:Io.description,state:it.BV.alpha,categories:new Set([T.w.Reformat])};var po=e(43987),ec=e(72164),gu=e(48962),ho=(U=>(U.TimeSeriesWide="wide",U.TimeSeriesLong="long",U.TimeSeriesMulti="multi",U.TimeSeriesMany="many",U))(ho||{});function Or(U){if(!Array.isArray(U)||U.length===0)return U;const K=[];for(const z of Hi(U)){const te=z.fields[0];if(!te||te.type!==se.fS.time)continue;const fe=[],Pe=[];for(const Ne of z.fields)switch(Ne.type){case se.fS.number:case se.fS.boolean:fe.push(Ne);break;case se.fS.string:Pe.push(Ne);break}for(const Ne of fe)if(Pe.length){const Je=new Map;for(let ot=0;ot<z.length;ot++){const lt=te.values[ot],vt=Ne.values[ot];if(vt===void 0||lt==null)continue;const Ut=Pe.map(nn=>nn.values[ot]).join("/");let Zt=Je.get(Ut);if(!Zt){Zt={key:Ut,time:[],value:[],labels:{}};for(const nn of Pe)Zt.labels[nn.name]=nn.values[ot];Je.set(Ut,Zt)}Zt.time.push(lt),Zt.value.push(vt)}for(const ot of Je.values())K.push({name:z.name,refId:z.refId,meta:{...z.meta,type:po.P.TimeSeriesMulti},fields:[{...te,values:ot.time},{...Ne,values:ot.value,labels:ot.labels}],length:ot.time.length})}else K.push({name:z.name,refId:z.refId,meta:{...z.meta,type:po.P.TimeSeriesMulti},fields:[te,Ne],length:z.length})}return K}function Hi(U){if(!Array.isArray(U)||U.length===0)return U;const K=[];for(const z of U){let te;const fe=[],Pe={},Ne={},Je={},ot={};for(let gn=0;gn<z.fields.length;gn++){const bn=z.fields[gn];switch(bn.type){case se.fS.string:case se.fS.boolean:bn.name in ot||(ot[bn.name]=gn,Ne[bn.name]=!0);break;case se.fS.time:if(!te){te=bn;break}default:if(bn.name in Pe){const Ra=Pe[bn.name];if(bn.type!==Ra)continue}else Pe[bn.name]=bn.type,fe.push(bn.name);const Kn=JSON.stringify(bn.labels),ja=Je[Kn];if(ja!==void 0?ja.push(gn):Je[Kn]=[gn],bn.labels!=null)for(const Ra in bn.labels)Ne[Ra]=!0}}if(!te)continue;const lt=[],vt=[],Ut=[],Zt=[];for(let gn=0;gn<z.length;gn++)lt.push({time:te.values[gn],wideRowIndex:gn});for(const gn in Je)vt.push(gn);for(const gn in Ne)Ut.push(gn);for(const gn in ot)Zt.push(gn);lt.sort((gn,bn)=>gn.time-bn.time),vt.sort(),Ut.sort(),fe.sort();const nn=new ec.v({...z,meta:{...z.meta,type:po.P.TimeSeriesLong},fields:[{name:te.name,type:te.type}]});for(const gn of fe)nn.addField({name:gn,type:Pe[gn]});for(const gn of Ut)nn.addField({name:gn,type:se.fS.string});for(const gn of lt){const{time:bn,wideRowIndex:Kn}=gn;for(const ja of vt){const Ra={};for(const Xs of Zt)Ra[Xs]=z.fields[ot[Xs]].values[Kn];let Qa=0;for(const Xs of Je[ja]){const xr=z.fields[Xs];if(Qa++===0&&xr.labels!=null)for(const Wi in xr.labels)Ra[Wi]=xr.labels[Wi];Ra[xr.name]=xr.values[Kn]}Ra[te.name]=bn,nn.add(Ra)}}K.push(nn)}return K}function pu(U){return ql(U,z=>z.type===se.fS.string).map(z=>(z.meta||(z.meta={}),z.meta.type=po.P.TimeSeriesMulti,z))}const Ro={id:q.W.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:(U,K)=>z=>z.pipe((0,Nt.U)(te=>Ro.transformer(U,K)(te))),transformer:U=>{const K=U?.format??"wide";if(K==="many"||K==="multi")return Or;if(K==="long")return Hi;const z=Z.Ls.get(le.mi.firstTimeField).get({});return te=>{if(!te.length)return[];const fe=[];for(const Ne of te)Ne.meta?.type===po.P.TimeSeriesLong?pu(Ne).forEach(Je=>fe.push(Je)):fe.push(Ne);const Pe=(0,gu._9)({frames:fe,joinBy:z,keepOriginIndices:!0});return Pe?(Pe.meta||(Pe.meta={}),Pe.meta.type=po.P.TimeSeriesWide,[Pe]):[]}}},ri={label:"Wide time series",value:ho.TimeSeriesWide,description:"Creates a single frame joined by time",info:a.createElement("ul",null,a.createElement("li",null,"Single frame"),a.createElement("li",null,"1st field is shared time field"),a.createElement("li",null,"Time in ascending order"),a.createElement("li",null,"Multiple value fields of any type"))},hu={label:"Multi-frame time series",value:ho.TimeSeriesMulti,description:"Creates a new frame for each time/number pair",info:a.createElement("ul",null,a.createElement("li",null,"Multiple frames"),a.createElement("li",null,"Each frame has two fields: time, value"),a.createElement("li",null,"Time in ascending order"),a.createElement("li",null,"String values are represented as labels"),a.createElement("li",null,"All values are numeric"))},tc={label:"Long time series",value:ho.TimeSeriesLong,description:"Convert each frame to long format",info:a.createElement("ul",null,a.createElement("li",null,"Single frame"),a.createElement("li",null,"1st field is time field"),a.createElement("li",null,"Time in ascending order, but may have duplictes"),a.createElement("li",null,"String values are represented as separate fields rather than as labels"),a.createElement("li",null,"Multiple value fields may exist"))},Ao=[ri,hu,tc];function nc(U){const{options:K,onChange:z}=U,te=(0,Be.wW)(vu),fe=(0,a.useCallback)(Pe=>{z({...K,format:Pe.value})},[z,K]);return a.createElement(a.Fragment,null,a.createElement(ue.Z,null,a.createElement(pe._,{label:"Format",labelWidth:12},a.createElement(he.Ph,{width:35,options:Ao,value:Ao.find(Pe=>Pe.value===ho.TimeSeriesMulti&&K.format===ho.TimeSeriesMany?!0:Pe.value===K.format)||Ao[0],onChange:fe,className:"flex-grow-1"}))),a.createElement(ue.Z,null,a.createElement(pe._,{label:"Info",labelWidth:12},a.createElement("div",{className:te.info},(Ao.find(Pe=>Pe.value===K.format)||Ao[0]).info))))}const vu=U=>({info:(0,Q.css)` margin-left: 20px; `}),Eu={id:Ro.id,editor:nc,transformation:Ro,name:Ro.name,description:Ro.description,help:` ### Use cases This takes query results and transforms them into a predictable timeseries format. This transformer may be especially useful when using old panels that only expect the many-frame timeseries format. `,categories:new Set([T.w.Reformat])},Er={id:q.W.rowsToFields,name:"Rows to fields",description:"Convert each row into a field with dynamic config.",defaultOptions:{},operator:U=>K=>K.pipe((0,Nt.U)(z=>z.map(te=>oi(U,te))))};function oi(U,K){const z=Un(K,U.mappings??[],!0),{nameField:te,valueField:fe}=z;if(!te||!fe)return K;const Pe=[];for(let Ne=0;Ne<te.values.length;Ne++){const Je=te.values[Ne],ot=fe.values[Ne],lt=rt(K,Ne,z),vt=yu(K,Ne,z),Ut={name:`${Je}`,type:fe.type,values:[ot],config:lt,labels:vt};Pe.push(Ut)}return{fields:Pe,length:1}}function yu(U,K,z){const te={...z.nameField.labels};for(let fe=0;fe<U.fields.length;fe++){const Pe=U.fields[fe],Ne=(0,oe.CZ)(Pe,U),Je=z.index[Ne];if(Je.handler&&Je.handler.key!==pt.Label)continue;const ot=Pe.values[K];ot!=null&&(te[Ne]=ot)}return te}function ki({input:U,options:K,onChange:z}){return U.length===0?null:a.createElement("div",null,a.createElement(yt,{frame:U[0],mappings:K.mappings??[],onChange:te=>z({...K,mappings:te}),withNameAndValue:!0}))}const Pu={id:Er.id,editor:ki,transformation:Er,name:Er.name,description:Er.description,state:it.BV.beta,categories:new Set([T.w.Reformat]),help:` ### Use cases This transforms rows into separate fields. This can be useful as fields can be styled and configured individually, something rows cannot. 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. Useful when visualization data in: - Gauge - Stat - Pie chart ## Example Input: | Name | Value | Max | | ------- | ----- | --- | | ServerA | 10 | 100 | | ServerB | 20 | 200 | | ServerC | 30 | 300 | Output: | ServerA (config: max=100) | ServerB (config: max=200) | ServerC (config: max=300) | | ------------------------- | ------------------------- | ------------------------- | | 10 | 20 | 30 | As 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. `};var ba=e(64167),Gi=e(79357),Os=e(87746),ac=e(62236),vo=e(83612),ii=e(62129);const ji={id:q.W.spatial,name:"Spatial operations",description:"Apply spatial operations to query results.",defaultOptions:{},operator:U=>K=>K.pipe((0,Vr.z)(z=>(0,_s.D)(Lo(z,U))))};function sc(U){return U.action===Os.JJ.Modify&&U.modify?.op===Os.ac.LineBuilder}async function Lo(U,K){const z=await(0,vo.cJ)(K.source);if(sc(K)){const te=await(0,vo.cJ)(K.modify?.target);return U.map(fe=>{const Pe=(0,vo.g6)(fe,z),Ne=(0,vo.g6)(fe,te);if(Pe.field&&Ne.field){const Je=[...fe.fields],ot=(0,ac.Fh)(Pe.field,Ne.field),lt=Je[0];return lt.type===se.fS.geo&<!==Pe.field&<!==Ne.field?Je[0]=(0,ac.EK)(lt,ot):Je.unshift(ot),{...fe,fields:Je}}return fe})}return U.map(te=>{let fe=(0,vo.g6)(te,z);if(fe.field){if(K.action===Os.JJ.Modify){switch(K.modify?.op){case Os.ac.AsLine:let Ne=fe.field.name;return(!Ne||Ne==="Point")&&(Ne="Line"),{...te,length:1,fields:[{...fe.field,name:Ne,type:se.fS.geo,values:[(0,ii.Lp)(fe.field)]}]}}return te}const Pe=fe.derived?[fe.field,...te.fields]:te.fields.slice(0);if(K.action===Os.JJ.Calculate&&(Pe.push((0,ii.N7)(fe.field,K.calculate??{})),fe.derived=!0),fe.derived)return{...te,fields:Pe}}return te})}const rc=(U,K)=>{const z=K.options??{};U.addSelect({path:"action",name:"Action",description:"",defaultValue:Os.JJ.Prepare,settings:{options:[{value:Os.JJ.Prepare,label:"Prepare spatial field",description:"Set a geometry field based on the results of other fields"},{value:Os.JJ.Calculate,label:"Calculate value",description:"Use the geometry to define a new field (heading/distance/area)"},{value:Os.JJ.Modify,label:"Transform",description:"Apply spatial operations to the geometry"}]}}),z.action===Os.JJ.Calculate?U.addSelect({path:"calculate.calc",name:"Function",description:"",defaultValue:Os.Ii.Heading,settings:{options:[{value:Os.Ii.Heading,label:"Heading"},{value:Os.Ii.Area,label:"Area"},{value:Os.Ii.Distance,label:"Distance"}]}}):z.action===Os.JJ.Modify&&U.addSelect({path:"modify.op",name:"Operation",description:"",defaultValue:Os.ac.AsLine,settings:{options:[{value:Os.ac.AsLine,label:"As line",description:"Create a single line feature with a vertex at each row"},{value:Os.ac.LineBuilder,label:"Line builder",description:"Create a line between two points"}]}}),sc(z)?(U.addNestedOptions({category:["Source"],path:"source",build:(te,fe)=>{const Pe=z.source??{};Pe.mode||(Pe.mode=ba.q1.Auto),(0,Gi.C)("Point","",te,Pe)}}),U.addNestedOptions({category:["Target"],path:"modify",build:(te,fe)=>{const Pe=z.modify?.target??{};Pe.mode||(Pe.mode=ba.q1.Auto),(0,Gi.C)("Point","target.",te,Pe)}})):(0,Gi.C)("Location","source.",U,z.source)},Du=U=>{(0,a.useEffect)(()=>{if(!U.options.source?.mode){const te=Ie(rc);U.onChange({...te,...U.options}),console.log("geometry useEffect",te)}},[]);const K=Ir((0,Be.l4)()),z=ze(U,rc);return a.createElement("div",null,a.createElement("div",null,z.items.map(te=>te.render())),a.createElement("div",null,z.categories.map(te=>a.createElement("div",{key:te.props.id,className:K.wrap},a.createElement("h5",null,te.props.title),a.createElement("div",{className:K.item},te.items.map(fe=>fe.render()))))))},Ir=U=>({wrap:(0,Q.css)` margin-bottom: 20px; `,item:(0,Q.css)` border-left: 4px solid ${U.colors.border.strong}; padding-left: 10px; `}),Qi={id:q.W.spatial,editor:Du,transformation:ji,name:ji.name,description:ji.description,state:it.BV.alpha,categories:new Set([T.w.PerformSpatialOperations])};var li=e(59425);const ao={id:q.W.timeSeriesTable,name:"Time series to table transform",description:"Time series to table rows.",defaultOptions:{},operator:U=>K=>K.pipe((0,Nt.U)(z=>Bo(U,z)))};function Bo(U,K){const z=Cu(K),te={},fe=[];for(const Pe of K){if(!(0,li.pP)(Pe)){fe.push(Pe);continue}const Ne=Pe.refId??"",Je=z[Ne]??{};let ot=te[Ne];if(!ot){ot={name:"Trend"+(Ne&&Object.keys(z).length>1?` #${Ne}`:""),type:se.fS.frame,config:{},values:[]},te[Ne]=ot;const vt=new ec.v;for(const Ut of Object.values(Je))vt.addField(Ut);vt.addField(ot),vt.refId=Ne,fe.push(vt)}const lt=Pe.fields[1].labels;for(const vt of Object.keys(Je)){const Ut=lt?.[vt]??null;Je[vt].values.push(Ut)}ot.values.push(Pe)}return fe}function Cu(U){const K={};for(const z of U){if(!(0,li.pP)(z))continue;const te=z.refId??"";K[te]||(K[te]={});for(const fe of z.fields)if(fe.labels)for(const Pe of Object.keys(fe.labels))K[te][Pe]||(K[te][Pe]={name:Pe,type:se.fS.string,config:{},values:[]})}return K}function ci({input:U,options:K,onChange:z}){return U.length===0?null:a.createElement("div",null)}const Yi={id:ao.id,editor:ci,transformation:ao,name:ao.name,description:ao.description,state:it.BV.beta,help:""},oc=()=>[Ct,zt,kt,An,bt,Ts,lr,an,Ca,Ea,ya,ps,hn,ws,hs,Pu,sn,Eu,Dt,Qi,fo,is,Le,xs,Sa,si,fu,oa,...n.config.featureToggles.timeSeriesTable?[Yi]:[]];function ic(){return new Promise(U=>require(["vs/language/kusto/monaco.contribution"],()=>U()))}function bu(){return[{id:"kusto",name:"kusto",init:ic}]}var bs=e(55801),qa=e(27173),Us=e(7662),lc=e(66920),$r=e(86312),cc=e(37647),Eo=e(60729),Mu=e(29223),xu=e(52995),Is=e(53933),Uo=e(76404),Aa=e(65322),dc=e(2578),uc=e(97706),mc=e(79562),No=e(8874),Zi=e(34239);const so=()=>{const U=!!Y.default.oauth;return{saml:{bgColor:"#464646",enabled:Y.default.samlEnabled,name:Y.default.samlName||Zi.bm,icon:"key-skeleton-alt"},google:{bgColor:"#e84d3c",enabled:U&&!!Y.default.oauth.google,name:Y.default.oauth?.google?.name||"Google",icon:Y.default.oauth?.google?.icon||"google"},azuread:{bgColor:"#2f2f2f",enabled:U&&!!Y.default.oauth.azuread,name:Y.default.oauth?.azuread?.name||"Microsoft",icon:Y.default.oauth?.azuread?.icon||"microsoft"},github:{bgColor:"#464646",enabled:U&&!!Y.default.oauth.github,name:Y.default.oauth?.github?.name||"GitHub",icon:Y.default.oauth?.github?.icon||"github"},gitlab:{bgColor:"#fc6d26",enabled:U&&!!Y.default.oauth.gitlab,name:Y.default.oauth?.gitlab?.name||"GitLab",icon:Y.default.oauth?.gitlab?.icon||"gitlab"},grafanacom:{bgColor:"#262628",enabled:U&&!!Y.default.oauth.grafana_com,name:Y.default.oauth?.grafana_com?.name||"Grafana.com",icon:Y.default.oauth?.grafana_com?.icon||"grafana",hrefName:"grafana_com"},okta:{bgColor:"#2f2f2f",enabled:U&&!!Y.default.oauth.okta,name:Y.default.oauth?.okta?.name||"Okta",icon:Y.default.oauth?.okta?.icon||"okta"},oauth:{bgColor:"#262628",enabled:U&&!!Y.default.oauth.generic_oauth,name:Y.default.oauth?.generic_oauth?.name||"OAuth",icon:Y.default.oauth?.generic_oauth?.icon||"signin",hrefName:"generic_oauth"}}},fc=U=>({button:(0,Q.css)` color: #d8d9da; position: relative; `,buttonIcon:(0,Q.css)` position: absolute; left: ${U.spacing(1)}; top: 50%; transform: translateY(-50%); `,divider:{base:(0,Q.css)` color: ${U.colors.text}; display: flex; margin-bottom: ${U.spacing(1)}; justify-content: space-between; text-align: center; width: 100%; `,line:(0,Q.css)` width: 100px; height: 10px; border-bottom: 1px solid ${U.colors.text}; `}}),gc=()=>{const U=(0,Be.wW)(fc);return a.createElement(a.Fragment,null,a.createElement("div",{className:U.divider.base},a.createElement("div",null,a.createElement("div",{className:U.divider.line})),a.createElement("div",null,a.createElement("span",null,!Y.default.disableLoginForm&&a.createElement("span",null,"or"))),a.createElement("div",null,a.createElement("div",{className:U.divider.line}))),a.createElement("div",{className:"clearfix"}))};function Su(U,K,z){return(0,Q.cx)(K.button,(0,Q.css)` background-color: ${U.bgColor}; color: ${z.colors.getContrastText(U.bgColor)}; &:hover { background-color: ${z.colors.emphasize(U.bgColor,.15)}; box-shadow: ${z.shadows.z1}; } `)}const Tu=()=>{const U=(0,v.pickBy)(so(),fe=>fe.enabled),K=Object.keys(U).length>0,z=(0,Be.l4)(),te=(0,Be.wW)(fc);return K?a.createElement(Xt.wc,null,a.createElement(gc,null),Object.entries(U).map(([fe,Pe])=>a.createElement(re.Qj,{key:fe,className:Su(Pe,te,z),href:`login/${Pe.hrefName?Pe.hrefName:fe}`,target:"_self",fullWidth:!0},a.createElement(va.J,{className:te.buttonIcon,name:Pe.icon}),"Sign in with ",Pe.name))):null},pc=()=>{const U=(0,Y.iE)().verifyEmailEnabled?`${(0,Y.iE)().appSubUrl}/verify`:`${(0,Y.iE)().appSubUrl}/signup`,K=(0,Q.css)({paddingTop:"16px"});return a.createElement(Xt.wc,null,a.createElement("div",{className:K},"New to Grafana?"),a.createElement(re.Qj,{className:(0,Q.css)` width: 100%; justify-content: center; `,href:U,variant:"secondary",fill:"outline"},"Sign up"))},Ou=(0,Q.css)` padding: 0; margin-top: 4px; `,Iu=(0,Q.css)({width:"100%"}),Ji=()=>(document.title=Uo.c.AppTitle,a.createElement(uc.Z,null,({loginHint:U,passwordHint:K,disableLoginForm:z,disableUserSignUp:te,login:fe,isLoggingIn:Pe,changePassword:Ne,skipPasswordChange:Je,isChangingPassword:ot,showDefaultPasswordWarning:lt,loginErrorMessage:vt})=>a.createElement(No.dd,{isChangingPassword:ot},!ot&&a.createElement(No.$s,null,vt&&a.createElement($s.b,{className:Iu,severity:"error",title:(0,Aa.t)("login.error.title","Login failed")},vt),!z&&a.createElement(mc.U,{onSubmit:fe,loginHint:U,passwordHint:K,isLoggingIn:Pe},a.createElement(Xt.Lh,{justify:"flex-end"},a.createElement(re.Qj,{className:Ou,fill:"text",href:`${Y.default.appSubUrl}/user/password/send-reset-email`},"Forgot your password?"))),a.createElement(Tu,null),!te&&a.createElement(pc,null)),ot&&a.createElement(No.$s,null,a.createElement(dc.G,{showDefaultPasswordWarning:lt,onSubmit:Ne,onSkip:()=>Je()})))));var Fs=e(44644),Ru=e(48105),Xi=e(50230);function hc({description:U,text:K,url:z}){const te=(0,Be.wW)(zs);return a.createElement(Xi.Z,{className:te.card,href:z},a.createElement(Xi.Z.Heading,null,K),a.createElement(Xi.Z.Description,{className:te.description},U))}const zs=U=>({card:(0,Q.css)({marginBottom:0,gridTemplateRows:"1fr 0 2fr"}),description:(0,Q.css)({WebkitLineClamp:3,WebkitBoxOrient:"vertical",display:"-webkit-box",overflow:"hidden"})});function ur({navId:U,header:K}){const{node:z}=(0,Ru.q)(U),te=(0,Be.wW)(wo),fe=z.children?.filter(Pe=>!Pe.hideFromTabs);return a.createElement(Fs.T,{navId:z.id},a.createElement(Fs.T.Contents,null,a.createElement("div",{className:te.content},K,fe&&fe.length>0&&a.createElement("section",{className:te.grid},fe?.map(Pe=>a.createElement(hc,{key:Pe.id,description:Pe.subTitle,text:Pe.text,url:Pe.url??""}))))))}const wo=U=>({content:(0,Q.css)({display:"flex",flexDirection:"column",gap:U.spacing(2)}),grid:(0,Q.css)({display:"grid",gap:U.spacing(3),gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gridAutoRows:"138px",padding:U.spacing(2,0)})});var Wo=e(38192),Au=e(73149);function Lu(){return a.createElement(Fs.T,{navId:"home",layout:Wo.Q.Canvas,pageNav:{text:"Page not found"}},a.createElement(Au.j,{entity:"Page"}))}var es=e(91368),vc=e(80978),La=e(66574),Cn=e(18771),Ec=e(60956);const Bu="dddd YYYY-MM-DD HH:mm zz",Fo="/admin/authentication/ldap";class qi extends a.PureComponent{constructor(){super(...arguments),this.onUserSync=()=>{this.props.onUserSync()}}render(){const{ldapSyncInfo:K,user:z}=this.props,fe=K&&K.nextSync?(0,Ec.dq)(K.nextSync,{format:Bu}):"",Pe=`${Fo}?user=${z&&z.login}`,Ne=La.Vt.hasPermission(Cn.AccessControlAction.LDAPUsersRead),Je=La.Vt.hasPermission(Cn.AccessControlAction.LDAPUsersSync);return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"LDAP Synchronisation"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",null,"External sync"),a.createElement("td",null,"User synced via LDAP. Some changes must be done in LDAP or mappings."),a.createElement("td",null,a.createElement("span",{className:"label label-tag"},"LDAP"))),a.createElement("tr",null,K.enabled?a.createElement(a.Fragment,null,a.createElement("td",null,"Next scheduled synchronization"),a.createElement("td",{colSpan:2},fe)):a.createElement(a.Fragment,null,a.createElement("td",null,"Next scheduled synchronization"),a.createElement("td",{colSpan:2},"Not enabled")))))),a.createElement("div",{className:"gf-form-button-row"},Je&&a.createElement(re.zx,{variant:"secondary",onClick:this.onUserSync},"Sync user"),Ne&&a.createElement(re.Qj,{variant:"secondary",href:Pe},"Debug LDAP Mapping"))))}}var Ko=e(55205),yc=e(13741),_r=e(80011),Pc=e(75574),el=e(11349),Dc=e(26811);function tl({onSelected:U,className:K,inputId:z,autoFocus:te,excludeOrgs:fe}){(0,a.useEffect)(()=>{te&&z&&document.getElementById(z)?.focus()},[te,z]);const[Pe,Ne]=(0,Dc.Z)(async()=>{const ot=(await(0,O.i)().get("/api/orgs")).map(lt=>({value:{id:lt.id,name:lt.name},label:lt.name}));if(fe){let lt=fe.map(Ut=>Ut.orgId);return ot.filter(Ut=>!lt.includes(Ut.value.id))}else return ot});return a.createElement(he.qb,{inputId:z,className:K,isLoading:Pe.loading,defaultOptions:!0,isSearchable:!1,loadOptions:Ne,onChange:U,placeholder:"Select organization",noOptionsMessage:"No organizations found"})}var Cc=e(8237);class bc extends a.PureComponent{constructor(){super(...arguments),this.addToOrgButtonRef=a.createRef(),this.state={showAddOrgModal:!1},this.showOrgAddModal=()=>{this.setState({showAddOrgModal:!0})},this.dismissOrgAddModal=()=>{this.setState({showAddOrgModal:!1},()=>{this.addToOrgButtonRef.current?.focus()})}}render(){const{user:K,orgs:z,isExternalUser:te,onOrgRoleChange:fe,onOrgRemove:Pe,onOrgAdd:Ne}=this.props,{showAddOrgModal:Je}=this.state,ot=(0,Q.css)` margin-top: 0.8rem; `,lt=La.Vt.hasPermission(Cn.AccessControlAction.OrgUsersAdd)&&!te;return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"Organizations"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,z.map((vt,Ut)=>a.createElement(Nu,{key:`${vt.orgId}-${Ut}`,isExternalUser:te,user:K,org:vt,onOrgRoleChange:fe,onOrgRemove:Pe}))))),a.createElement("div",{className:ot},lt&&a.createElement(re.zx,{variant:"secondary",onClick:this.showOrgAddModal,ref:this.addToOrgButtonRef},"Add user to organization")),a.createElement(nl,{user:K,userOrgs:z,isOpen:Je,onOrgAdd:Ne,onDismiss:this.dismissOrgAddModal})))}}const Mc=(0,De.B)(U=>({removeButton:(0,Q.css)` margin-right: 0.6rem; text-decoration: underline; color: ${U.v1.palette.blue95}; `,label:(0,Q.css)` font-weight: 500; `,disabledTooltip:(0,Q.css)` display: flex; `,tooltipItem:(0,Q.css)` margin-left: 5px; `,tooltipItemLink:(0,Q.css)` color: ${U.v1.palette.blue95}; `,rolePickerWrapper:(0,Q.css)` display: flex; `,rolePicker:(0,Q.css)` flex: auto; margin-right: ${U.spacing(1)}; `}));class Uu extends a.PureComponent{constructor(){super(...arguments),this.state={currentRole:this.props.org.role,isChangingRole:!1,roleOptions:[]},this.onOrgRemove=async()=>{const{org:K}=this.props;this.props.onOrgRemove(K.orgId)},this.onChangeRoleClick=()=>{const{org:K}=this.props;this.setState({isChangingRole:!0,currentRole:K.role})},this.onOrgRoleChange=K=>{this.setState({currentRole:K})},this.onOrgRoleSave=()=>{this.props.onOrgRoleChange(this.props.org.orgId,this.state.currentRole)},this.onCancelClick=()=>{this.setState({isChangingRole:!1})},this.onBasicRoleChange=K=>{this.props.onOrgRoleChange(this.props.org.orgId,K)}}componentDidMount(){La.Vt.licensedAccessControlEnabled()&&La.Vt.hasPermission(Cn.AccessControlAction.ActionRolesList)&&(0,el.ul)(this.props.org.orgId).then(K=>this.setState({roleOptions:K})).catch(K=>console.error(K))}render(){const{user:K,org:z,isExternalUser:te,theme:fe}=this.props,Pe=K?.authLabels?.length&&K?.authLabels[0],Ne=Pe?`Synced via ${Pe}`:"",{currentRole:Je,isChangingRole:ot}=this.state,lt=Mc(fe),vt=(0,Q.cx)("width-16",lt.label),Ut=La.Vt.hasPermission(Cn.AccessControlAction.OrgUsersWrite),Zt=La.Vt.hasPermission(Cn.AccessControlAction.OrgUsersRemove)&&!te,nn=te||!Ut,gn=`${z.name}-input`;return a.createElement("tr",null,a.createElement("td",{className:vt},a.createElement("label",{htmlFor:gn},z.name)),La.Vt.licensedAccessControlEnabled()?a.createElement("td",null,a.createElement("div",{className:lt.rolePickerWrapper},a.createElement("div",{className:lt.rolePicker},a.createElement(Pc.R,{userId:K?.id||0,orgId:z.orgId,basicRole:z.role,roleOptions:this.state.roleOptions,onBasicRoleChange:this.onBasicRoleChange,basicRoleDisabled:nn,basicRoleDisabledMessage:`This user's role is not editable because it is synchronized from your auth provider. Refer to the Grafana authentication docs for details.`})),te&&a.createElement(di,{lockMessage:Ne}))):a.createElement(a.Fragment,null,ot?a.createElement("td",null,a.createElement(Cc.A,{inputId:gn,value:Je,onChange:this.onOrgRoleChange,autoFocus:!0})):a.createElement("td",{className:"width-25"},z.role),a.createElement("td",{colSpan:1},a.createElement("div",{className:"pull-right"},Ut&&a.createElement(Fu,{lockMessage:Ne,isExternalUser:te,onChangeRoleClick:this.onChangeRoleClick,onCancelClick:this.onCancelClick,onOrgRoleSave:this.onOrgRoleSave})))),a.createElement("td",{colSpan:1},a.createElement("div",{className:"pull-right"},Zt&&a.createElement(Ko.p,{confirmText:"Confirm removal",confirmVariant:"destructive",onCancel:this.onCancelClick,onConfirm:this.onOrgRemove,autoFocus:!0},"Remove from organization"))))}}const Nu=(0,Be.HE)(Uu),wu=(0,De.B)(()=>({modal:(0,Q.css)` width: 500px; `,buttonRow:(0,Q.css)` text-align: center; `,modalContent:(0,Q.css)` overflow: visible; `}));class nl extends a.PureComponent{constructor(){super(...arguments),this.state={selectedOrg:null,role:Cn.OrgRole.Viewer,roleOptions:[],pendingOrgId:null,pendingUserId:null,pendingRoles:[]},this.onOrgSelect=K=>{const z=this.props.userOrgs.find(te=>te.orgId===K.value?.id);this.setState({selectedOrg:K.value,role:z?.role||Cn.OrgRole.Viewer}),La.Vt.licensedAccessControlEnabled()&&La.Vt.hasPermission(Cn.AccessControlAction.ActionRolesList)&&(0,el.ul)(K.value?.id).then(te=>this.setState({roleOptions:te})).catch(te=>console.error(te))},this.onOrgRoleChange=K=>{this.setState({role:K})},this.onAddUserToOrg=async()=>{const{selectedOrg:K,role:z}=this.state;this.props.onOrgAdd(K.id,z),La.Vt.licensedAccessControlEnabled()&&La.Vt.hasPermission(Cn.AccessControlAction.ActionUserRolesAdd)&&this.state.pendingUserId&&(await(0,el.hB)(this.state.pendingRoles,this.state.pendingUserId,this.state.pendingOrgId),this.setState({pendingOrgId:null,pendingRoles:[],pendingUserId:null}))},this.onCancel=()=>{this.setState({selectedOrg:null,pendingRoles:[],pendingOrgId:null,pendingUserId:null}),this.props.onDismiss&&this.props.onDismiss()},this.onRoleUpdate=async(K,z,te)=>{this.setState({pendingRoles:K,pendingOrgId:te,pendingUserId:z})}}render(){const{isOpen:K,user:z,userOrgs:te}=this.props,{role:fe,roleOptions:Pe,selectedOrg:Ne}=this.state,Je=wu();return a.createElement(yc.u,{className:Je.modal,contentClassName:Je.modalContent,title:"Add to an organization",isOpen:K,onDismiss:this.onCancel},a.createElement(Lt.g,{label:"Organization"},a.createElement(tl,{inputId:"new-org-input",onSelected:this.onOrgSelect,excludeOrgs:te,autoFocus:!0})),a.createElement(Lt.g,{label:"Role",disabled:Ne===null},La.Vt.accessControlEnabled()?a.createElement(Pc.R,{userId:z?.id||0,orgId:Ne?.id,basicRole:fe,onBasicRoleChange:this.onOrgRoleChange,basicRoleDisabled:!1,roleOptions:Pe,apply:!0,onApplyRoles:this.onRoleUpdate,pendingRoles:this.state.pendingRoles}):a.createElement(Cc.A,{inputId:"new-org-role-input",value:fe,onChange:this.onOrgRoleChange})),a.createElement(yc.u.ButtonRow,null,a.createElement(Xt.Lh,{spacing:"md",justify:"center"},a.createElement(re.zx,{variant:"secondary",fill:"outline",onClick:this.onCancel},"Cancel"),a.createElement(re.zx,{variant:"primary",disabled:Ne===null,onClick:this.onAddUserToOrg},"Add to organization"))))}}const Wu=U=>({disabledTooltip:(0,Q.css)` display: flex; `,tooltipItemLink:(0,Q.css)` color: ${U.v1.palette.blue95}; `,lockMessageClass:(0,Q.css)` font-style: italic; margin-left: 1.8rem; margin-right: 0.6rem; `,icon:(0,Q.css)` line-height: 2; `});function Fu({lockMessage:U,onChangeRoleClick:K,isExternalUser:z,onOrgRoleSave:te,onCancelClick:fe}){const Pe=(0,Be.wW)(Wu);return a.createElement("div",{className:Pe.disabledTooltip},z?a.createElement(a.Fragment,null,a.createElement("span",{className:Pe.lockMessageClass},U),a.createElement(_r.u,{placement:"right-end",interactive:!0,content:a.createElement("div",null,"This user's role is not editable because it is synchronized from your auth provider. Refer to the\xA0",a.createElement("a",{className:Pe.tooltipItemLink,href:"https://grafana.com/docs/grafana/latest/auth",rel:"noreferrer",target:"_blank"},"Grafana authentication docs"),"\xA0for details.")},a.createElement("div",{className:Pe.icon},a.createElement(va.J,{name:"question-circle"})))):a.createElement(Ko.p,{confirmText:"Save",onClick:K,onCancel:fe,onConfirm:te,disabled:z},"Change role"))}const di=({lockMessage:U})=>{const K=(0,Be.wW)(xc);return a.createElement("div",{className:K.disabledTooltip},a.createElement("span",{className:K.lockMessageClass},U),a.createElement(_r.u,{placement:"right-end",interactive:!0,content:a.createElement("div",null,"This user's built-in role is not editable because it is synchronized from your auth provider. Refer to the\xA0",a.createElement("a",{className:K.tooltipItemLink,href:"https://grafana.com/docs/grafana/latest/auth",rel:"noreferrer noopener",target:"_blank"},"Grafana authentication docs"),"\xA0for details.")},a.createElement(va.J,{name:"question-circle"})))},xc=U=>({disabledTooltip:(0,Q.css)` display: flex; `,tooltipItemLink:(0,Q.css)` color: ${U.v1.palette.blue95}; `,lockMessageClass:(0,Q.css)` font-style: italic; margin-left: 1.8rem; margin-right: 0.6rem; `}),Qs=[{label:"Yes",value:!0},{label:"No",value:!1}];function ui({isGrafanaAdmin:U,isExternalUser:K,lockMessage:z,onGrafanaAdminChange:te}){const[fe,Pe]=(0,a.useState)(!1),[Ne,Je]=(0,a.useState)(U),ot=()=>Pe(!0),lt=()=>{Pe(!1),Je(U)},vt=()=>te(Ne),Ut=La.Vt.hasPermission(Cn.AccessControlAction.UsersPermissionsUpdate)&&!K,Zt=(0,Be.wW)(zr);return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"Permissions"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{className:"width-16"},"Grafana Admin"),fe?a.createElement("td",{colSpan:2},a.createElement(ae.S,{options:Qs,value:Ne,onChange:Je,autoFocus:!0})):a.createElement("td",{colSpan:2},U?a.createElement(a.Fragment,null,a.createElement(va.J,{name:"shield"})," Yes"):a.createElement(a.Fragment,null,"No")),a.createElement("td",null,Ut&&a.createElement(Ko.p,{onClick:ot,onConfirm:vt,onCancel:lt,confirmText:"Change"},"Change"),K&&a.createElement("div",{className:Zt.lockMessageClass},a.createElement(di,{lockMessage:z})))))))))}const zr=U=>({lockMessageClass:(0,Q.css)` display: flex; justify-content: flex-end; font-style: italic; margin-right: ${U.spacing(.6)}; `});var yo=e(3613),Ku=e(83670);function ro({user:U,onUserUpdate:K,onUserDelete:z,onUserDisable:te,onUserEnable:fe,onPasswordChange:Pe}){const[Ne,Je]=(0,a.useState)(!1),[ot,lt]=(0,a.useState)(!1),vt=(0,a.useRef)(null),Ut=Wr=>()=>{Je(Wr),!Wr&&vt.current&&vt.current.focus()},Zt=(0,a.useRef)(null),nn=Wr=>()=>{lt(Wr),!Wr&&Zt.current&&Zt.current.focus()},gn=()=>z(U.id),bn=()=>te(U.id),Kn=()=>fe(U.id),ja=Wr=>{K({...U,name:Wr})},Ra=Wr=>{K({...U,email:Wr})},Qa=Wr=>{K({...U,login:Wr})},Xs=U.authLabels?.length&&U.authLabels[0],xr=Xs?`Synced via ${Xs}`:"",Wi=U.isExternal||!La.Vt.hasPermissionInMetadata(Cn.AccessControlAction.UsersWrite,U),zh=U.isExternal||!La.Vt.hasPermissionInMetadata(Cn.AccessControlAction.UsersPasswordUpdate,U),Hh=La.Vt.hasPermissionInMetadata(Cn.AccessControlAction.UsersDelete,U),kh=La.Vt.hasPermissionInMetadata(Cn.AccessControlAction.UsersDisable,U),Gh=La.Vt.hasPermissionInMetadata(Cn.AccessControlAction.UsersEnable,U);return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"User information"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,a.createElement(Vo,{label:"Name",value:U.name,locked:Wi,lockMessage:xr,onChange:ja}),a.createElement(Vo,{label:"Email",value:U.email,locked:Wi,lockMessage:xr,onChange:Ra}),a.createElement(Vo,{label:"Username",value:U.login,locked:Wi,lockMessage:xr,onChange:Qa}),a.createElement(Vo,{label:"Password",value:"********",inputType:"password",locked:zh,lockMessage:xr,onChange:Pe})))),a.createElement("div",{className:oo.buttonRow},Hh&&a.createElement(a.Fragment,null,a.createElement(re.zx,{variant:"destructive",onClick:Ut(!0),ref:vt},"Delete user"),a.createElement(yo.s,{isOpen:Ne,title:"Delete user",body:"Are you sure you want to delete this user?",confirmText:"Delete user",onConfirm:gn,onDismiss:Ut(!1)})),U.isDisabled&&Gh&&a.createElement(re.zx,{variant:"secondary",onClick:Kn},"Enable user"),!U.isDisabled&&kh&&a.createElement(a.Fragment,null,a.createElement(re.zx,{variant:"secondary",onClick:nn(!0),ref:Zt},"Disable user"),a.createElement(yo.s,{isOpen:ot,title:"Disable user",body:"Are you sure you want to disable this user?",confirmText:"Disable user",onConfirm:bn,onDismiss:nn(!1)})))))}const oo={buttonRow:(0,Q.css)` margin-top: 0.8rem; > * { margin-right: 16px; } `};class Vo extends a.PureComponent{constructor(){super(...arguments),this.state={editing:!1,value:this.props.value||""},this.setInputElem=K=>{this.inputElem=K},this.onEditClick=()=>{this.props.inputType==="password"?this.setState({editing:!0,value:""},this.focusInput):this.setState({editing:!0},this.focusInput)},this.onCancelClick=()=>{this.setState({editing:!1,value:this.props.value||""})},this.onInputChange=(K,z)=>{z!==Ku.G.Invalid&&this.setState({value:K.target.value})},this.onInputBlur=(K,z)=>{z!==Ku.G.Invalid&&this.setState({value:K.target.value})},this.focusInput=()=>{this.inputElem&&this.inputElem.focus&&this.inputElem.focus()},this.onSave=()=>{this.props.onChange&&this.props.onChange(this.state.value)}}render(){const{label:K,locked:z,lockMessage:te,inputType:fe}=this.props,{value:Pe}=this.state,Ne=(0,Q.cx)("width-16",(0,Q.css)` font-weight: 500; `);if(z)return a.createElement(al,{label:K,value:Pe,lockMessage:te});const Je=`${K}-input`;return a.createElement("tr",null,a.createElement("td",{className:Ne},a.createElement("label",{htmlFor:Je},K)),a.createElement("td",{className:"width-25",colSpan:2},this.state.editing?a.createElement(ce.I,{id:Je,type:fe,defaultValue:Pe,onBlur:this.onInputBlur,onChange:this.onInputChange,ref:this.setInputElem,width:30}):a.createElement("span",null,this.props.value)),a.createElement("td",null,a.createElement(Ko.p,{confirmText:"Save",onClick:this.onEditClick,onConfirm:this.onSave,onCancel:this.onCancelClick},"Edit")))}}Vo.defaultProps={value:"",locked:!1,lockMessage:"",inputType:"text"};const al=({label:U,value:K,lockMessage:z})=>{const te=(0,Q.css)` font-style: italic; margin-right: 0.6rem; `,fe=(0,Q.cx)("width-16",(0,Q.css)` font-weight: 500; `);return a.createElement("tr",null,a.createElement("td",{className:fe},U),a.createElement("td",{className:"width-25",colSpan:2},K),a.createElement("td",null,a.createElement("span",{className:te},z)))};class sl extends a.PureComponent{constructor(){super(...arguments),this.forceAllLogoutButton=a.createRef(),this.state={showLogoutModal:!1},this.showLogoutConfirmationModal=()=>{this.setState({showLogoutModal:!0})},this.dismissLogoutConfirmationModal=()=>{this.setState({showLogoutModal:!1},()=>{this.forceAllLogoutButton.current?.focus()})},this.onSessionRevoke=K=>()=>{this.props.onSessionRevoke(K)},this.onAllSessionsRevoke=()=>{this.setState({showLogoutModal:!1}),this.props.onAllSessionsRevoke()}}render(){const{sessions:K}=this.props,{showLogoutModal:z}=this.state,te=(0,Q.css)` margin-top: 0.8rem; `,fe=La.Vt.hasPermission(Cn.AccessControlAction.UsersLogout);return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"Sessions"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Last seen"),a.createElement("th",null,"Logged on"),a.createElement("th",null,"IP address"),a.createElement("th",{colSpan:2},"Browser and OS"))),a.createElement("tbody",null,K&&K.map((Pe,Ne)=>a.createElement("tr",{key:`${Pe.id}-${Ne}`},a.createElement("td",null,Pe.isActive?"Now":Pe.seenAt),a.createElement("td",null,(0,Aa.$q)(Pe.createdAt,{dateStyle:"long"})),a.createElement("td",null,Pe.clientIp),a.createElement("td",null,`${Pe.browser} on ${Pe.os} ${Pe.osVersion}`),a.createElement("td",null,a.createElement("div",{className:"pull-right"},fe&&a.createElement(Ko.p,{confirmText:"Confirm logout",confirmVariant:"destructive",onConfirm:this.onSessionRevoke(Pe.id),autoFocus:!0},"Force logout")))))))),a.createElement("div",{className:te},fe&&K.length>0&&a.createElement(re.zx,{variant:"secondary",onClick:this.showLogoutConfirmationModal,ref:this.forceAllLogoutButton},"Force logout from all devices"),a.createElement(yo.s,{isOpen:z,title:"Force logout from all devices",body:"Are you sure you want to force logout from all devices?",confirmText:"Force logout",onConfirm:this.onAllSessionsRevoke,onDismiss:this.dismissLogoutConfirmationModal}))))}}const Vu=sl;var Rs=e(64544);class $u extends a.PureComponent{constructor(){super(...arguments),this.onUserUpdate=K=>{this.props.updateUser(K)},this.onPasswordChange=K=>{const{user:z,setUserPassword:te}=this.props;z&&te(z.id,K)},this.onUserDelete=K=>{this.props.deleteUser(K)},this.onUserDisable=K=>{this.props.disableUser(K)},this.onUserEnable=K=>{this.props.enableUser(K)},this.onGrafanaAdminChange=K=>{const{user:z,updateUserPermissions:te}=this.props;z&&te(z.id,K)},this.onOrgRemove=K=>{const{user:z,deleteOrgUser:te}=this.props;z&&te(z.id,K)},this.onOrgRoleChange=(K,z)=>{const{user:te,updateOrgUserRole:fe}=this.props;te&&fe(te.id,K,z)},this.onOrgAdd=(K,z)=>{const{user:te,addOrgUser:fe}=this.props;te&&fe(te,K,z)},this.onSessionRevoke=K=>{const{user:z,revokeSession:te}=this.props;z&&te(K,z.id)},this.onAllSessionsRevoke=()=>{const{user:K,revokeAllSessions:z}=this.props;K&&z(K.id)},this.onUserSync=()=>{const{user:K,syncLdapUser:z}=this.props;K&&z(K.id)}}async componentDidMount(){const{match:K,loadAdminUserPage:z}=this.props;z(parseInt(K.params.id,10))}render(){const{user:K,orgs:z,sessions:te,ldapSyncInfo:fe,isLoading:Pe}=this.props,Ne=K?.isExternal&&K?.authLabels?.includes("LDAP"),Je=La.Vt.hasPermission(Cn.AccessControlAction.UsersAuthTokenList),ot=La.Vt.hasPermission(Cn.AccessControlAction.LDAPStatusRead),lt=!Y.default.auth.DisableSyncLock&&K?.isExternallySynced,vt=K?.authLabels?.[0],Ut=vt?`Synced via ${vt}`:"",Zt={text:K?.login??"",icon:"shield",subTitle:"Manage settings for an individual user."};return a.createElement(Fs.T,{navId:"global-users",pageNav:Zt},a.createElement(Fs.T.Contents,{isLoading:Pe},K&&a.createElement(a.Fragment,null,a.createElement(ro,{user:K,onUserUpdate:this.onUserUpdate,onUserDelete:this.onUserDelete,onUserDisable:this.onUserDisable,onUserEnable:this.onUserEnable,onPasswordChange:this.onPasswordChange}),Ne&<&&(0,vc.v)("ldapsync")&&fe&&ot&&a.createElement(qi,{ldapSyncInfo:fe,user:K,onUserSync:this.onUserSync}),a.createElement(ui,{isGrafanaAdmin:K.isGrafanaAdmin,isExternalUser:K?.isGrafanaAdminExternallySynced,lockMessage:Ut,onGrafanaAdminChange:this.onGrafanaAdminChange})),z&&a.createElement(bc,{user:K,orgs:z,isExternalUser:lt,onOrgRemove:this.onOrgRemove,onOrgRoleChange:this.onOrgRoleChange,onOrgAdd:this.onOrgAdd}),te&&Je&&a.createElement(Vu,{sessions:te,onSessionRevoke:this.onSessionRevoke,onAllSessionsRevoke:this.onAllSessionsRevoke})))}}const _u=U=>({user:U.userAdmin.user,sessions:U.userAdmin.sessions,orgs:U.userAdmin.orgs,ldapSyncInfo:U.ldap.syncInfo,isLoading:U.userAdmin.isLoading,error:U.userAdmin.error}),zu={loadAdminUserPage:Rs.PK,updateUser:Rs.Nq,setUserPassword:Rs.tQ,disableUser:Rs.B9,enableUser:Rs.Dx,deleteUser:Rs.h8,updateUserPermissions:Rs.Xx,addOrgUser:Rs.bN,updateOrgUserRole:Rs.Jk,deleteOrgUser:Rs.uV,revokeSession:Rs._1,revokeAllSessions:Rs.Fm,syncLdapUser:Rs.CP},Hu=(0,qa.connect)(_u,zu)($u),$o=({ldapConnectionInfo:U})=>a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"LDAP Connection"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Host"),a.createElement("th",{colSpan:2},"Port"))),a.createElement("tbody",null,U&&U.map((K,z)=>a.createElement("tr",{key:z},a.createElement("td",null,K.host),a.createElement("td",null,K.port),a.createElement("td",null,K.available?a.createElement(va.J,{name:"check",className:"pull-right"}):a.createElement(va.J,{name:"exclamation-triangle",className:"pull-right"}))))))),a.createElement("div",{className:"gf-form-group"},a.createElement(ku,{ldapConnectionInfo:U})))),ku=({ldapConnectionInfo:U})=>{if(!U.some(fe=>fe.error))return null;const z=[];U.forEach(fe=>{fe.error&&z.push(fe)});const te=z.map((fe,Pe)=>a.createElement("div",{key:Pe},a.createElement("span",{style:{fontWeight:500}},fe.host,":",fe.port,a.createElement("br",null)),a.createElement("span",null,fe.error),Pe!==z.length-1&&a.createElement(a.Fragment,null,a.createElement("br",null),a.createElement("br",null))));return a.createElement($s.b,{title:"Connection error",severity:Cn.AppNotificationSeverity.Error},te)};var rl=e(62108);const Gu="dddd YYYY-MM-DD HH:mm zz";class Sc extends a.PureComponent{constructor(){super(...arguments),this.state={isSyncing:!1},this.handleSyncClick=()=>{this.setState({isSyncing:!this.state.isSyncing})}}render(){const{ldapSyncInfo:K}=this.props,{isSyncing:z}=this.state,te=(0,Ec.dq)(K.nextSync,{format:Gu});return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"LDAP Synchronisation",a.createElement(re.zx,{className:"pull-right",onClick:this.handleSyncClick,hidden:!0},a.createElement("span",{className:"btn-title"},"Bulk-sync now"),z&&a.createElement(rl.$,{inline:!0}))),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",null,"Active synchronisation"),a.createElement("td",{colSpan:2},K.enabled?"Enabled":"Disabled")),a.createElement("tr",null,a.createElement("td",null,"Scheduled"),a.createElement("td",null,K.schedule)),a.createElement("tr",null,a.createElement("td",null,"Next scheduled synchronisation"),a.createElement("td",null,te)))))))}}const ju=({groups:U,showAttributeMapping:K})=>{const z=K?U:U.filter(te=>te.orgRole);return a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("thead",null,a.createElement("tr",null,K&&a.createElement("th",null,"LDAP Group"),a.createElement("th",null,"Organization",a.createElement(_r.u,{placement:"top",content:"Only the first match for an Organization will be used",theme:"info"},a.createElement(va.J,{name:"info-circle"}))),a.createElement("th",null,"Role"))),a.createElement("tbody",null,z.map((te,fe)=>a.createElement("tr",{key:`${te.orgId}-${fe}`},K&&a.createElement("td",null,te.groupDN),te.orgName&&te.orgRole?a.createElement("td",null,te.orgName):a.createElement("td",null),te.orgRole?a.createElement("td",null,te.orgRole):a.createElement("td",null,a.createElement("span",{className:"text-warning"},"No match"),a.createElement(_r.u,{placement:"top",content:"No matching groups found",theme:"info"},a.createElement(va.J,{name:"info-circle"})))))))))},Qu=({info:U,showAttributeMapping:K})=>a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{colSpan:2},"User information"),K&&a.createElement("th",null,"LDAP attribute"))),a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{className:"width-16"},"First name"),a.createElement("td",null,U.name.ldapValue),K&&a.createElement("td",null,U.name.cfgAttrValue)),a.createElement("tr",null,a.createElement("td",{className:"width-16"},"Surname"),a.createElement("td",null,U.surname.ldapValue),K&&a.createElement("td",null,U.surname.cfgAttrValue)),a.createElement("tr",null,a.createElement("td",{className:"width-16"},"Username"),a.createElement("td",null,U.login.ldapValue),K&&a.createElement("td",null,U.login.cfgAttrValue)),a.createElement("tr",null,a.createElement("td",{className:"width-16"},"Email"),a.createElement("td",null,U.email.ldapValue),K&&a.createElement("td",null,U.email.cfgAttrValue)))))),Yu=({permissions:U})=>a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{colSpan:1},"Permissions"))),a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{className:"width-16"}," Grafana admin"),a.createElement("td",null,U.isGrafanaAdmin?a.createElement(a.Fragment,null,a.createElement(va.J,{name:"shield"})," Yes"):"No")),a.createElement("tr",null,a.createElement("td",{className:"width-16"},"Status"),a.createElement("td",null,U.isDisabled?a.createElement(a.Fragment,null,a.createElement(va.J,{name:"times"})," Inactive"):a.createElement(a.Fragment,null,a.createElement(va.J,{name:"check"})," Active"))))))),Zu=({teams:U,showAttributeMapping:K})=>{const z=K?U:U.filter(te=>te.teamName);return a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("thead",null,a.createElement("tr",null,K&&a.createElement("th",null,"LDAP Group"),a.createElement("th",null,"Organisation"),a.createElement("th",null,"Team"))),a.createElement("tbody",null,z.map((te,fe)=>a.createElement("tr",{key:`${te.teamName}-${fe}`},K&&a.createElement(a.Fragment,null,a.createElement("td",null,te.groupDN),!te.orgName&&a.createElement(a.Fragment,null,a.createElement("td",null),a.createElement("td",null,a.createElement("span",{className:"text-warning"},"No match"),a.createElement(_r.u,{placement:"top",content:"No matching teams found",theme:"info"},a.createElement(va.J,{name:"info-circle"}))))),te.orgName&&a.createElement(a.Fragment,null,a.createElement("td",null,te.orgName),a.createElement("td",null,te.teamName))))))))},Ju=({ldapUser:U,showAttributeMapping:K})=>a.createElement(a.Fragment,null,a.createElement(Qu,{info:U.info,showAttributeMapping:K}),a.createElement(Yu,{permissions:U.permissions}),U.roles&&U.roles.length>0&&a.createElement(ju,{groups:U.roles,showAttributeMapping:K}),U.teams&&U.teams.length>0?a.createElement(Zu,{teams:U.teams,showAttributeMapping:K}):a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",null,"No teams found via LDAP"))))))),{FormField:Xu}=pn.LegacyForms,Rr={text:"LDAP",subTitle:"Verify your LDAP and user mapping configuration.",icon:"book",id:"LDAP"};class qu extends a.PureComponent{constructor(){super(...arguments),this.state={isLoading:!0},this.search=K=>{K.preventDefault();const z=K.target.elements.username.value;z&&this.fetchUserMapping(z)},this.onClearUserError=()=>{this.props.clearUserError()}}async componentDidMount(){const{clearUserMappingInfo:K,queryParams:z}=this.props;await K(),await this.fetchLDAPStatus(),z.username&&await this.fetchUserMapping(z.username),this.setState({isLoading:!1})}async fetchLDAPStatus(){const{loadLdapState:K,loadLdapSyncStatus:z}=this.props;return Promise.all([K(),z()])}async fetchUserMapping(K){const{loadUserMapping:z}=this.props;return await z(K)}render(){const{ldapUser:K,userError:z,ldapError:te,ldapSyncInfo:fe,ldapConnectionInfo:Pe,queryParams:Ne}=this.props,{isLoading:Je}=this.state,ot=La.Vt.hasPermission(Cn.AccessControlAction.LDAPUsersRead);return a.createElement(Fs.T,{navId:"authentication",pageNav:Rr},a.createElement(Fs.T.Contents,{isLoading:Je},a.createElement(a.Fragment,null,te&&te.title&&a.createElement("div",{className:"gf-form-group"},a.createElement($s.b,{title:te.title,severity:Cn.AppNotificationSeverity.Error},te.body)),a.createElement($o,{ldapConnectionInfo:Pe}),(0,vc.v)("ldapsync")&&fe&&a.createElement(Sc,{ldapSyncInfo:fe}),ot&&a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"Test user mapping"),a.createElement("div",{className:"gf-form-group"},a.createElement("form",{onSubmit:this.search,className:"gf-form-inline"},a.createElement(Xu,{label:"Username",labelWidth:8,inputWidth:30,type:"text",id:"username",name:"username",defaultValue:Ne.username}),a.createElement(re.zx,{type:"submit"},"Run"))),z&&z.title&&a.createElement("div",{className:"gf-form-group"},a.createElement($s.b,{title:z.title,severity:Cn.AppNotificationSeverity.Error,onRemove:this.onClearUserError},z.body)),K&&a.createElement(Ju,{ldapUser:K,showAttributeMapping:!0})))))}}const nr=U=>({ldapConnectionInfo:U.ldap.connectionInfo,ldapUser:U.ldap.user,ldapSyncInfo:U.ldap.syncInfo,userError:U.ldap.userError,ldapError:U.ldap.ldapError}),us={loadLdapState:Rs.Y3,loadLdapSyncStatus:Rs.j4,loadUserMapping:Rs.b_,clearUserError:Rs.V0,clearUserMappingInfo:Rs.IS},em=(0,qa.connect)(nr,us)(qu);var Es=e(50686),Dn=e(9031),Oa=e(2082);const Tc=[],Oc=[...Tc,{path:"/alerting",component:()=>a.createElement(ur,{navId:"alerting-legacy"})},{path:"/alerting/list",component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(1109),e.e(1608),e.e(3312),e.e(2461)]).then(e.bind(e,75330)))},{path:"/alerting/ng/list",component:(0,Dn.Q)(()=>e.e(4286).then(e.bind(e,75330)))},{path:"/alerting/notifications",roles:Y.config.unifiedAlertingEnabled?()=>["Editor","Admin"]:void 0,component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,25270)))},{path:"/alerting/notifications/templates/new",roles:()=>["Editor","Admin"],component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,25270)))},{path:"/alerting/notifications/templates/:id/edit",roles:()=>["Editor","Admin"],component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,25270)))},{path:"/alerting/notifications/receivers/new",roles:()=>["Editor","Admin"],component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,25270)))},{path:"/alerting/notifications/receivers/:id/edit",roles:()=>["Editor","Admin"],component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,25270)))},{path:"/alerting/notifications/global-config",roles:()=>["Admin","Editor"],component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,25270)))},{path:"/alerting/notification/new",component:(0,Dn.Q)(()=>e.e(476).then(e.bind(e,29478)))},{path:"/alerting/notification/:id/edit",component:(0,Dn.Q)(()=>e.e(7384).then(e.bind(e,25668)))}],Ic=[...Tc,{path:"/alerting",component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6034)]).then(e.bind(e,9075)))},{path:"/alerting/list",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingRuleRead,Cn.AccessControlAction.AlertingRuleExternalRead],[Es.B.Viewer,Es.B.Editor,Es.B.Admin]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(1109),e.e(1608),e.e(3312),e.e(2461)]).then(e.bind(e,11555)))},{path:"/alerting/routes",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsRead,Cn.AccessControlAction.AlertingNotificationsExternalRead],[Es.B.Editor,Es.B.Admin]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(3504),e.e(8648)]).then(e.bind(e,90402)))},{path:"/alerting/routes/mute-timing/new",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsWrite,Cn.AccessControlAction.AlertingNotificationsExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(9355)]).then(e.bind(e,27011)))},{path:"/alerting/routes/mute-timing/edit",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsWrite,Cn.AccessControlAction.AlertingNotificationsExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(9355)]).then(e.bind(e,27011)))},{path:"/alerting/silences",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingInstanceRead,Cn.AccessControlAction.AlertingInstancesExternalRead],["Viewer","Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(1783)]).then(e.bind(e,68836)))},{path:"/alerting/silence/new",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingInstanceCreate,Cn.AccessControlAction.AlertingInstancesExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(1783)]).then(e.bind(e,68836)))},{path:"/alerting/silence/:id/edit",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingInstanceUpdate,Cn.AccessControlAction.AlertingInstancesExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(1783)]).then(e.bind(e,68836)))},{path:"/alerting/notifications",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsRead,Cn.AccessControlAction.AlertingNotificationsExternalRead],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,34913)))},{path:"/alerting/notifications/:type/new",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsWrite,Cn.AccessControlAction.AlertingNotificationsExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,34913)))},{path:"/alerting/notifications/:type/:id/edit",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsWrite,Cn.AccessControlAction.AlertingNotificationsExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,34913)))},{path:"/alerting/notifications/:type/:id/duplicate",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsWrite,Cn.AccessControlAction.AlertingNotificationsExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,34913)))},{path:"/alerting/notifications/:type",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingNotificationsWrite,Cn.AccessControlAction.AlertingNotificationsExternalWrite],["Editor","Admin"]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(6618)]).then(e.bind(e,34913)))},{path:"/alerting/groups/",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingInstanceRead,Cn.AccessControlAction.AlertingInstancesExternalRead],[Es.B.Viewer,Es.B.Editor,Es.B.Admin]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(2415)]).then(e.bind(e,97138)))},{path:"/alerting/new/:type?",pageClass:"page-alerting",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingRuleCreate,Cn.AccessControlAction.AlertingRuleExternalWrite],[Es.B.Viewer,Es.B.Editor,Es.B.Admin]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(1109),e.e(4393),e.e(5917),e.e(1608),e.e(7965),e.e(5372)]).then(e.bind(e,27419)))},{path:"/alerting/:id/edit",pageClass:"page-alerting",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingRuleUpdate,Cn.AccessControlAction.AlertingRuleExternalWrite],[Es.B.Viewer,Es.B.Editor,Es.B.Admin]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(1109),e.e(4393),e.e(5917),e.e(1608),e.e(7965),e.e(5372)]).then(e.bind(e,27419)))},{path:"/alerting/:sourceName/:id/view",pageClass:"page-alerting",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingRuleRead,Cn.AccessControlAction.AlertingRuleExternalRead],[Es.B.Viewer,Es.B.Editor,Es.B.Admin]),component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(4393),e.e(4679)]).then(e.bind(e,41570)))},{path:"/alerting/:sourceName/:name/find",pageClass:"page-alerting",roles:(0,Oa.ql)([Cn.AccessControlAction.AlertingRuleRead,Cn.AccessControlAction.AlertingRuleExternalRead],[Es.B.Viewer,Es.B.Editor,Es.B.Admin]),component:(0,Dn.Q)(()=>e.e(7918).then(e.bind(e,39513)))},{path:"/alerting/admin",roles:()=>["Admin"],component:(0,Dn.Q)(()=>Promise.all([e.e(1406),e.e(7680)]).then(e.bind(e,95553)))}];function tm(U=Y.config){return U.unifiedAlertingEnabled?Ic:U.alertingEnabled?Oc:(0,v.uniq)([...Oc,...Ic].map(z=>z.path)).map(z=>({path:z,component:(0,Dn.Q)(()=>e.e(1333).then(e.bind(e,33157)))}))}var Po=e(90131);const nm=U=>({alertContent:(0,Q.css)` display: flex; flex-direction: row; padding: 0; justify-content: space-between; align-items: center; `,alertParagraph:(0,Q.css)` margin: 0 ${U.spacing(1)} 0 0; line-height: ${U.spacing(U.components.height.sm)}; `});function am(){const U=(0,Be.wW)(nm),[K,z]=(0,a.useState)(!0);return K?a.createElement($s.b,{severity:"info",title:"",onRemove:()=>z(!1)},a.createElement("div",{className:U.alertContent},a.createElement("p",{className:U.alertParagraph},"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."),a.createElement(re.Qj,{"aria-label":"Link to Connections",icon:"arrow-right",href:Po.Z.DataSources,fill:"text"},"Go to connections"))):a.createElement(a.Fragment,null)}function sm(){return[{path:`/${Po.D}`,exact:!1,component:(0,Dn.Q)(()=>Promise.all([e.e(3153),e.e(7795),e.e(5981)]).then(e.bind(e,46236)))}]}var mi=e(39410),ol=e(95948);const ms=[{path:"/plugins",navId:"plugins",roles:()=>["Admin","ServerAdmin"],routeName:ol.cd.Home,component:(0,Dn.Q)(()=>e.e(94).then(e.bind(e,48179)))},{path:"/plugins/browse",navId:"plugins",roles:()=>["Admin","ServerAdmin"],routeName:ol.cd.Browse,component:(0,Dn.Q)(()=>e.e(94).then(e.bind(e,48179)))},{path:"/plugins/:pluginId/",navId:"plugins",roles:()=>["Admin","ServerAdmin"],routeName:ol.cd.Details,component:(0,Dn.Q)(()=>Promise.all([e.e(3153),e.e(7795),e.e(2417)]).then(e.bind(e,14692)))},{path:"/admin/plugins/*",navId:"admin-plugins",component:()=>a.createElement(Us.l_,{to:"/plugins"})}];function fs(){return ms}var rm=e(86809),Ar=e(34099),io=e(3935),om=e(95685),_o=e(26473);function Lr(U){return console.error(U),fi("Exception thrown","See console for details")}function Rc(){return fi("Page not found","404 Error")}function fi(U,K){const z={text:U,subTitle:K,icon:"exclamation-triangle"};return{node:z,main:z}}var gi=e(67821),il=e(8929),im=e(37843),ll=e(74161);const Ac={loading:!0,pluginNav:null,plugin:null};function lm({pluginId:U,pluginNavSection:K}){const z=(0,Us.$B)(),te=(0,Us.TH)(),[fe,Pe]=(0,a.useReducer)(Do.reducer,Ac),Ne=n.config.appSubUrl+te.pathname+te.search,{plugin:Je,loading:ot,pluginNav:lt}=fe,vt=(0,im.d)(K,lt,Ne),Ut=(0,a.useMemo)(()=>(0,A.Ox)(te.search),[te.search]),Zt=(0,a.useMemo)(()=>(0,ll.a)(vt),[vt]),nn=(0,_o.p)();(0,a.useEffect)(()=>{Ms(U,Pe)},[U]);const gn=(0,a.useCallback)(Kn=>Pe(Do.actions.changeNav(Kn)),[]);if(!Je||U!==Je.meta.id){const Kn=nn.chrome.state.getValue().layout;return a.createElement(Fs.T,{navModel:vt,pageNav:{text:""},layout:Kn},ot&&a.createElement(om.Z,null))}if(!Je.root)return a.createElement(Fs.T,{navModel:vt??fi("Plugin load error")},a.createElement("div",null,"No root app page component found"));const bn=Je.root&&a.createElement(Je.root,{meta:Je.meta,basename:z.url,onNavChanged:gn,query:Ut,path:te.pathname});return lt?a.createElement(a.Fragment,null,vt?a.createElement(Fs.T,{navModel:vt,pageNav:lt?.node},a.createElement(Fs.T.Contents,{isLoading:ot},bn)):a.createElement(Fs.T,null,bn)):a.createElement(ll.v.Provider,{value:Zt},bn)}const Do=(0,Ar.oM)({name:"prom-builder-container",initialState:Ac,reducers:{setState:(U,K)=>{Object.assign(U,K.payload)},changeNav:(U,K)=>{let z=K.payload;z&&z.node.children&&(z={...z,node:{...z.main,hideFromBreadcrumbs:!0}}),U.pluginNav=z}}});async function Ms(U,K){try{const z=await(0,gi.a)(U).then(te=>{const fe=cm(te);return fe?(La.h$.emit(io.SI.alertError,[fe]),K(Do.actions.setState({pluginNav:fi(fe)})),null):(0,il.Av)(te)});K(Do.actions.setState({plugin:z,loading:!1,pluginNav:null}))}catch{K(Do.actions.setState({plugin:null,loading:!1,pluginNav:Rc()}))}}function cm(U){return U?U.type!==it.zV.app?"Plugin must be an app":U.enabled?null:"Application Not Enabled":"Unknown Plugin"}const Lc=lm;var _a=e(84749);function dm(){const U=(0,_a.y0)(),{navIndex:K}=U,z=Pe=>Pe.startsWith("standalone-plugin-page-/"),te=Pe=>"pluginId"in Pe&&"id"in Pe;return[...Object.values(K).filter(te).map(Pe=>{const Ne=(0,rm.vw)(Pe),Je=`/a/${Pe.pluginId}`,ot=z(Pe.id)&&Pe.url||Je,lt=z(Pe.id)&&!Pe.url?.startsWith("/a/");return{path:ot,exact:!1,sensitive:lt,component:()=>a.createElement(Lc,{pluginId:Pe.pluginId,pluginNavSection:Ne})}}),{path:"/a/:pluginId",exact:!1,component:({match:Pe})=>a.createElement(Lc,{pluginId:Pe.params.pluginId,pluginNavSection:K.home})}]}const Bc=[{path:"/profile",component:(0,Dn.Q)(()=>e.e(7323).then(e.bind(e,28001)))},{path:"/profile/password",component:(0,Dn.Q)(()=>e.e(465).then(e.bind(e,465)))},{path:"/profile/select-org",component:(0,Dn.Q)(()=>e.e(1456).then(e.bind(e,87918)))},{path:"/profile/notifications",component:(0,Dn.Q)(()=>e.e(743).then(e.bind(e,64270)))}];function um(U=Y.config){return U.profileEnabled?Bc:(0,v.uniq)(Bc.map(z=>z.path)).map(z=>({path:z,component:(0,Dn.Q)(()=>e.e(3395).then(e.bind(e,79527)))}))}const Uc=()=>Y.config.featureToggles.publicDashboards?[{path:"/dashboard/public",pageClass:"page-dashboard",routeName:Cn.DashboardRoutes.Public,component:(0,Dn.Q)(()=>e.e(1344).then(e.bind(e,84185)))},{path:"/public-dashboards/:accessToken",pageClass:"page-dashboard",routeName:Cn.DashboardRoutes.Public,chromeless:!0,component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7307),e.e(53),e.e(3258),e.e(2613)]).then(e.bind(e,12602)))}]:[],mm=()=>Y.config.featureToggles.dashboardEmbed?[{path:"/d-embed",pageClass:"dashboard-embed",routeName:Cn.DashboardRoutes.Embedded,component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7307),e.e(53),e.e(3258),e.e(7454)]).then(e.bind(e,5460)))}]:[],fm=[];function gm(){return[...dm(),{path:"/",pageClass:"page-dashboard",routeName:Cn.DashboardRoutes.Home,component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7307),e.e(53),e.e(3258),e.e(9734),e.e(1863),e.e(3312),e.e(3069),e.e(5296)]).then(e.bind(e,12743)))},{path:"/d/:uid/:slug?",pageClass:"page-dashboard",routeName:Cn.DashboardRoutes.Normal,component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7307),e.e(53),e.e(3258),e.e(9734),e.e(1863),e.e(3312),e.e(3069),e.e(5296)]).then(e.bind(e,12743)))},{path:"/dashboard/new",roles:()=>es.contextSrv.evaluatePermission(()=>[],[Cn.AccessControlAction.DashboardsCreate]),pageClass:"page-dashboard",routeName:Cn.DashboardRoutes.New,component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7307),e.e(53),e.e(3258),e.e(9734),e.e(1863),e.e(3312),e.e(3069),e.e(5296)]).then(e.bind(e,12743)))},{path:"/dashboard/new-with-ds/:datasourceUid",roles:()=>es.contextSrv.evaluatePermission(()=>["Editor","Admin"],[Cn.AccessControlAction.DashboardsCreate]),component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7307),e.e(53),e.e(3258),e.e(9734),e.e(1863),e.e(3312),e.e(3069),e.e(5296)]).then(e.bind(e,57461)))},{path:"/dashboard/:type/:slug",pageClass:"page-dashboard",routeName:Cn.DashboardRoutes.Normal,component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7307),e.e(53),e.e(3258),e.e(9734),e.e(1863),e.e(3312),e.e(3069),e.e(5296)]).then(e.bind(e,12743)))},{path:"/d-solo/:uid/:slug",pageClass:"dashboard-solo",routeName:Cn.DashboardRoutes.Normal,chromeless:!0,component:(0,Dn.Q)(()=>Promise.all([e.e(53),e.e(1034)]).then(e.bind(e,30084)))},{path:"/dashboard-solo/:type/:slug",pageClass:"dashboard-solo",routeName:Cn.DashboardRoutes.Normal,chromeless:!0,component:(0,Dn.Q)(()=>Promise.all([e.e(53),e.e(1034)]).then(e.bind(e,30084)))},{path:"/d-solo/:uid",pageClass:"dashboard-solo",routeName:Cn.DashboardRoutes.Normal,chromeless:!0,component:(0,Dn.Q)(()=>Promise.all([e.e(53),e.e(1034)]).then(e.bind(e,30084)))},{path:"/dashboard/import",roles:()=>es.contextSrv.evaluatePermission(()=>["Editor","Admin"],[Cn.AccessControlAction.DashboardsCreate]),component:(0,Dn.Q)(()=>e.e(8808).then(e.bind(e,40599)))},{path:mi.n.List,component:()=>a.createElement(Us.l_,{to:Po.Z.DataSources})},{path:mi.n.Edit,component:U=>a.createElement(Us.l_,{to:Po.Z.DataSourcesEdit.replace(":uid",U.match.params.uid)})},{path:mi.n.Dashboards,component:U=>a.createElement(Us.l_,{to:Po.Z.DataSourcesDashboards.replace(":uid",U.match.params.uid)})},{path:mi.n.New,component:()=>a.createElement(Us.l_,{to:Po.Z.DataSourcesNew})},{path:"/datasources/correlations",component:(0,Dn.Q)(()=>Y.default.featureToggles.correlations?e.e(413).then(e.bind(e,74110)):e.e(2093).then(e.bind(e,92703)))},{path:"/dashboards",component:(0,Dn.Q)(()=>Promise.all([e.e(3153),e.e(4074)]).then(e.bind(e,88347)))},{path:"/dashboards/folder/new",roles:()=>es.contextSrv.evaluatePermission(()=>["Editor","Admin"],[Cn.AccessControlAction.FoldersCreate]),component:(0,Dn.Q)(()=>e.e(8932).then(e.bind(e,65955)))},!Y.default.featureToggles.nestedFolders&&{path:"/dashboards/f/:uid/:slug/permissions",component:Y.default.rbacEnabled?(0,Dn.Q)(()=>e.e(8431).then(e.bind(e,47895))):(0,Dn.Q)(()=>e.e(8431).then(e.bind(e,30902)))},{path:"/dashboards/f/:uid/:slug/settings",component:(0,Dn.Q)(()=>e.e(4827).then(e.bind(e,78106)))},{path:"/dashboards/f/:uid/:slug",component:(0,Dn.Q)(()=>Promise.all([e.e(3153),e.e(4074)]).then(e.bind(e,88347)))},{path:"/dashboards/f/:uid",component:(0,Dn.Q)(()=>Promise.all([e.e(3153),e.e(4074)]).then(e.bind(e,88347)))},{path:"/explore",pageClass:"page-explore",roles:()=>es.contextSrv.evaluatePermission(()=>Y.default.viewersCanEdit?[]:["Editor","Admin"],[Cn.AccessControlAction.DataSourcesExplore]),component:(0,Dn.Q)(()=>Y.default.exploreEnabled?Promise.all([e.e(1109),e.e(9734),e.e(7800),e.e(9782)]).then(e.bind(e,66119)):e.e(172).then(e.bind(e,65700)))},{path:"/apps",component:()=>a.createElement(ur,{navId:"apps"})},{path:"/alerts-and-incidents",component:()=>a.createElement(ur,{navId:"alerts-and-incidents"})},{path:"/monitoring",component:()=>a.createElement(ur,{navId:"monitoring"})},{path:"/admin/general",component:()=>a.createElement(ur,{navId:"admin/general"})},{path:"/admin/plugins",component:()=>a.createElement(ur,{navId:"admin/plugins"})},{path:"/admin/access",component:()=>a.createElement(ur,{navId:"admin/access"})},{path:"/org",component:(0,Dn.Q)(()=>e.e(529).then(e.bind(e,832)))},{path:"/org/new",component:(0,Dn.Q)(()=>e.e(950).then(e.bind(e,93246)))},{path:"/org/users",component:(0,Dn.Q)(()=>e.e(8039).then(e.bind(e,27932)))},{path:"/org/users/invite",component:(0,Dn.Q)(()=>e.e(7707).then(e.bind(e,87436)))},{path:"/org/apikeys",roles:()=>es.contextSrv.evaluatePermission(()=>["Admin"],[Cn.AccessControlAction.ActionAPIKeysRead]),component:(0,Dn.Q)(()=>e.e(3082).then(e.bind(e,13464)))},{path:"/org/serviceaccounts",roles:()=>es.contextSrv.evaluatePermission(()=>["Admin"],[Cn.AccessControlAction.ServiceAccountsRead,Cn.AccessControlAction.ServiceAccountsCreate]),component:(0,Dn.Q)(()=>e.e(1337).then(e.bind(e,71911)))},{path:"/org/serviceaccounts/create",component:(0,Dn.Q)(()=>e.e(9738).then(e.bind(e,43456)))},{path:"/org/serviceaccounts/:id",component:(0,Dn.Q)(()=>e.e(687).then(e.bind(e,2552)))},{path:"/org/teams",roles:()=>es.contextSrv.evaluatePermission(()=>Y.default.editorsCanAdmin?["Editor","Admin"]:["Admin"],[Cn.AccessControlAction.ActionTeamsRead,Cn.AccessControlAction.ActionTeamsCreate]),component:(0,Dn.Q)(()=>e.e(9671).then(e.bind(e,42063)))},{path:"/org/teams/new",roles:()=>es.contextSrv.evaluatePermission(()=>Y.default.editorsCanAdmin?["Editor","Admin"]:["Admin"],[Cn.AccessControlAction.ActionTeamsCreate]),component:(0,Dn.Q)(()=>e.e(8715).then(e.bind(e,35451)))},{path:"/org/teams/edit/:id/:page?",roles:()=>es.contextSrv.evaluatePermission(()=>Y.default.editorsCanAdmin?["Editor","Admin"]:["Admin"],[Cn.AccessControlAction.ActionTeamsRead,Cn.AccessControlAction.ActionTeamsCreate]),component:(0,Dn.Q)(()=>e.e(8612).then(e.bind(e,26543)))},{path:"/admin",component:()=>a.createElement(ur,{navId:"cfg",header:a.createElement(am,null)})},{path:"/admin/authentication",roles:()=>es.contextSrv.evaluatePermission(()=>["Admin","ServerAdmin"],[Cn.AccessControlAction.SettingsWrite]),component:Y.default.licenseInfo.enabledFeatures?.saml||Y.default.ldapEnabled?(0,Dn.Q)(()=>e.e(8741).then(e.bind(e,53201))):()=>a.createElement(Us.l_,{to:"/admin"})},{path:"/admin/access",component:()=>a.createElement(ur,{navId:"admin/access"})},{path:"/admin/config",component:()=>a.createElement(ur,{navId:"admin/config"})},{path:"/admin/settings",component:(0,Dn.Q)(()=>e.e(9603).then(e.bind(e,903)))},{path:"/admin/upgrading",component:(0,Dn.Q)(()=>e.e(1501).then(e.bind(e,27951)))},{path:"/admin/users",component:(0,Dn.Q)(()=>e.e(7497).then(e.bind(e,12048)))},{path:"/admin/users/create",component:(0,Dn.Q)(()=>e.e(2508).then(e.bind(e,13658)))},{path:"/admin/users/edit/:id",component:Hu},{path:"/admin/orgs",component:(0,Dn.Q)(()=>e.e(3798).then(e.bind(e,40174)))},{path:"/admin/orgs/edit/:id",component:(0,Dn.Q)(()=>e.e(2721).then(e.bind(e,28911)))},{path:"/admin/storage/:path*",roles:()=>["Admin"],component:(0,Dn.Q)(()=>e.e(7675).then(e.bind(e,60754)))},{path:"/admin/stats",component:(0,Dn.Q)(()=>e.e(7641).then(e.bind(e,68555)))},{path:"/admin/authentication/ldap",component:em},{path:"/login",component:Ji,pageClass:"login-page",chromeless:!0},{path:"/invite/:code",component:(0,Dn.Q)(()=>e.e(7429).then(e.bind(e,47637))),chromeless:!0},{path:"/verify",component:Y.default.verifyEmailEnabled?(0,Dn.Q)(()=>e.e(6875).then(e.bind(e,16875))):()=>a.createElement(Us.l_,{to:"/signup"}),pageClass:"login-page",chromeless:!0},{path:"/signup",component:Y.default.disableUserSignUp?()=>a.createElement(Us.l_,{to:"/login"}):(0,Dn.Q)(()=>e.e(7909).then(e.bind(e,97909))),pageClass:"login-page",chromeless:!0},{path:"/user/password/send-reset-email",chromeless:!0,component:(0,Dn.Q)(()=>e.e(133).then(e.bind(e,66837)))},{path:"/user/password/reset",component:(0,Dn.Q)(()=>e.e(6848).then(e.bind(e,94407))),pageClass:"login-page",chromeless:!0},{path:"/dashboard/snapshots",component:(0,Dn.Q)(()=>e.e(5295).then(e.bind(e,55177)))},{path:"/playlists",component:(0,Dn.Q)(()=>e.e(9218).then(e.bind(e,34032)))},{path:"/playlists/play/:uid",component:(0,Dn.Q)(()=>e.e(3090).then(e.bind(e,13117)))},{path:"/playlists/new",component:(0,Dn.Q)(()=>e.e(9975).then(e.bind(e,23126)))},{path:"/playlists/edit/:uid",component:(0,Dn.Q)(()=>e.e(2341).then(e.bind(e,79485)))},{path:"/sandbox/benchmarks",component:(0,Dn.Q)(()=>e.e(4908).then(e.bind(e,6625)))},{path:"/sandbox/test",component:(0,Dn.Q)(()=>Promise.all([e.e(1863),e.e(8595)]).then(e.bind(e,66617)))},{path:"/dashboards/f/:uid/:slug/library-panels",component:(0,Dn.Q)(Y.default.featureToggles.nestedFolders?()=>Promise.all([e.e(9427),e.e(3778)]).then(e.bind(e,36780)):()=>Promise.all([e.e(9427),e.e(3778)]).then(e.bind(e,28450)))},{path:"/dashboards/f/:uid/:slug/alerting",roles:()=>es.contextSrv.evaluatePermission(()=>["Viewer","Editor","Admin"],[Cn.AccessControlAction.AlertingRuleRead]),component:(0,Dn.Q)(Y.default.featureToggles.nestedFolders?()=>e.e(1324).then(e.bind(e,48493)):()=>e.e(1324).then(e.bind(e,81124)))},{path:"/library-panels",component:(0,Dn.Q)(()=>Promise.all([e.e(9427),e.e(7878)]).then(e.bind(e,97589)))},{path:"/notifications",component:(0,Dn.Q)(()=>e.e(743).then(e.bind(e,64270)))},...pm(),...fs(),...cl(),...tm(),...um(),...fm,...Uc(),...sm(),...mm(),{path:"/*",component:Lu}].filter(Is.fQ)}function cl(U=Y.default){return U.supportBundlesEnabled?[{path:"/support-bundles",component:(0,Dn.Q)(()=>e.e(9939).then(e.bind(e,76202)))},{path:"/support-bundles/create",component:(0,Dn.Q)(()=>e.e(539).then(e.bind(e,98824)))}]:[]}function pm(U=Y.default){return U.featureToggles.scenes?[{path:"/scenes",component:(0,Dn.Q)(()=>Promise.all([e.e(3069),e.e(207)]).then(e.bind(e,41287)))},{path:"/scenes/dashboard/:uid",component:(0,Dn.Q)(()=>Promise.all([e.e(3069),e.e(207)]).then(e.bind(e,89813)))},{path:"/scenes/grafana-monitoring",exact:!1,component:(0,Dn.Q)(()=>Promise.all([e.e(3069),e.e(207)]).then(e.bind(e,12808)))},{path:"/scenes/:name",component:(0,Dn.Q)(()=>Promise.all([e.e(3069),e.e(207)]).then(e.bind(e,55509)))}]:[]}const Hs=a.forwardRef((U,K)=>a.createElement("div",{id:"ngRoot",ref:K,dangerouslySetInnerHTML:{__html:"<grafana-app ng-cloak></grafana-app>"}}));Hs.displayName="AngularRoot";var Hr=e(58939),hm=e(9772),vm=e(32416),zo=e(39317),ls=e(26858),Em=e(39345),ym=e(89897);async function Pm(){if(n.config.angularSupportEnabled){const{AngularApp:U}=await Promise.all([e.e(1189),e.e(8695),e.e(3633),e.e(4704)]).then(e.bind(e,83633)),K=new U;K.init(),K.bootstrap()}else(0,hm.W)({load:(U,K,z)=>({destroy:()=>{},digest:()=>{},getScope:()=>({})})}),(0,vm.t)({get:U=>{switch(U){case"backendSrv":return(0,Hr.d)("getLegacyAngularInjector","backendSrv","use getBackendSrv() in @grafana/runtime"),(0,O.i)();case"contextSrv":return(0,Hr.d)("getLegacyAngularInjector","contextSrv"),La.Vt;case"dashboardSrv":return(0,Hr.d)("getLegacyAngularInjector","getDashboardSrv"),(0,p.h4)();case"datasourceSrv":return(0,Hr.d)("getLegacyAngularInjector","datasourceSrv","use getDataSourceSrv() in @grafana/runtime"),(0,N.F)();case"linkSrv":return(0,Hr.d)("getLegacyAngularInjector","linkSrv"),(0,ym.Bq)();case"validationSrv":return(0,Hr.d)("getLegacyAngularInjector","validationSrv"),Em.t;case"timeSrv":return(0,Hr.d)("getLegacyAngularInjector","timeSrv"),(0,ls.$t)();case"templateSrv":return(0,Hr.d)("getLegacyAngularInjector","templateSrv","use getTemplateSrv() in @grafana/runtime"),(0,zo.J)()}throw"Angular is disabled. Unable to expose: "+U}})}var Dm=e(89898),Nc=e.n(Dm),wc=e(45809),Wc=e(91546),dl=e(6714),Fc=e(53735),Kc=e(14705);const Ho=0,Vc=U=>{const K=a.useRef(null),z=a.useRef(null),te=a.useRef(U.items);te.current=U.items;const fe=(0,Kc.useVirtual)({size:te.current.length,parentRef:z}),{query:Pe,search:Ne,currentRootActionId:Je,activeIndex:ot,options:lt}=(0,bs.useKBar)(nn=>({search:nn.searchQuery,currentRootActionId:nn.currentRootActionId,activeIndex:nn.activeIndex}));a.useEffect(()=>{const nn=gn=>{gn.key==="ArrowUp"||gn.ctrlKey&&gn.key==="p"?(gn.preventDefault(),Pe.setActiveIndex(bn=>{let Kn=bn>Ho?bn-1:bn;if(typeof te.current[Kn]=="string"){if(Kn===0)return bn;Kn-=1}return Kn})):gn.key==="ArrowDown"||gn.ctrlKey&&gn.key==="n"?(gn.preventDefault(),Pe.setActiveIndex(bn=>{let Kn=bn<te.current.length-1?bn+1:bn;if(typeof te.current[Kn]=="string"){if(Kn===te.current.length-1)return bn;Kn+=1}return Kn})):gn.key==="Enter"&&(gn.preventDefault(),K.current?.click())};return window.addEventListener("keydown",nn),()=>window.removeEventListener("keydown",nn)},[Pe]);const{scrollToIndex:vt}=fe;a.useEffect(()=>{vt(ot,{align:ot<=1?"end":"auto"})},[ot,vt]),a.useEffect(()=>{Pe.setActiveIndex(typeof U.items[Ho]=="string"?Ho+1:Ho)},[Ne,Je,U.items,Pe]);const Ut=a.useCallback((nn,gn)=>{if(typeof gn=="string")return;const bn=gn.url;gn.command?(gn.command.perform(gn),Pe.toggle()):bn?nn.ctrlKey||nn.metaKey||nn.shiftKey||Pe.toggle():(Pe.setSearch(""),Pe.setCurrentRootAction(gn.id)),lt.callbacks?.onSelectAction?.(gn)},[Pe,lt]),Zt=(0,Fc.usePointerMovedSinceMount)();return a.createElement("div",{ref:z,style:{maxHeight:U.maxHeight||400,position:"relative",overflow:"auto"}},a.createElement("div",{role:"listbox",id:bs.KBAR_LISTBOX,style:{height:`${fe.totalSize}px`,width:"100%"}},fe.virtualItems.map(nn=>{const gn=te.current[nn.index],{target:bn,url:Kn}=gn,ja=typeof gn!="string"&&{onPointerMove:()=>Zt&&ot!==nn.index&&Pe.setActiveIndex(nn.index),onPointerDown:()=>Pe.setActiveIndex(nn.index),onClick:xr=>Ut(xr,gn)},Ra=nn.index===ot,Qa={id:(0,bs.getListboxItemId)(nn.index),role:"option","aria-selected":Ra,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${nn.start}px)`},...ja},Xs=a.cloneElement(U.onRender({item:gn,active:Ra}),{ref:nn.measureRef});return Kn?a.createElement("a",{key:nn.index,href:Kn,target:bn,ref:Ra?K:null,...Qa},Xs):a.createElement("div",{key:nn.index,ref:Ra?K:null,...Qa},Xs)})))},$c=a.forwardRef(({action:U,active:K,currentRootActionId:z},te)=>{const fe=a.useMemo(()=>{if(!z)return U.ancestors;const ot=U.ancestors.findIndex(lt=>lt.id===z);return U.ancestors.slice(ot+1)},[U.ancestors,z]),Pe=(0,Be.wW)(Cm);let Ne=U.name;const Je=ot=>!!(ot.command?.perform||ot.url);return U.children.length&&!Je(U)&&!Ne.endsWith("...")&&(Ne+="..."),a.createElement("div",{ref:te,className:(0,Q.cx)(Pe.row,K&&Pe.activeRow)},a.createElement("div",{className:Pe.actionContainer},U.icon,a.createElement("div",{className:Pe.textContainer},fe.map(ot=>a.createElement(a.Fragment,{key:ot.id},!Je(ot)&&a.createElement(a.Fragment,null,a.createElement("span",{className:Pe.breadcrumbAncestor},ot.name),a.createElement("span",{className:Pe.breadcrumbSeparator},"\u203A")))),a.createElement("span",null,Ne)),U.subtitle&&a.createElement("span",{className:Pe.subtitleText},U.subtitle)))});$c.displayName="ResultItem";const Cm=U=>({row:(0,Q.css)({padding:U.spacing(1,2),display:"flex",alightItems:"center",justifyContent:"space-between",cursor:"pointer",position:"relative",borderRadius:U.shape.radius.default,margin:U.spacing(0,1)}),activeRow:(0,Q.css)({color:U.colors.text.maxContrast,background:U.colors.emphasize(U.colors.background.primary,.03),"&:before":{display:"block",content:'" "',position:"absolute",left:0,top:0,bottom:0,width:U.spacing(.5),borderRadius:U.shape.radius.default,backgroundImage:U.colors.gradients.brandVertical}}),actionContainer:(0,Q.css)({display:"flex",gap:U.spacing(1),alignItems:"baseline",fontSize:U.typography.fontSize,width:"100%"}),textContainer:(0,Q.css)({display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),breadcrumbAncestor:(0,Q.css)({color:U.colors.text.secondary}),breadcrumbSeparator:(0,Q.css)({color:U.colors.text.secondary,marginLeft:U.spacing(1),marginRight:U.spacing(1)}),subtitleText:(0,Q.css)({...U.typography.bodySmall,color:U.colors.text.secondary,display:"block",flexBasis:"20%",flexGrow:1,flexShrink:0,maxWidth:"fit-content",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})});var pi=e(56027),bm=e.n(pi),Mm=e(6872),_c=e(63064);const xm=5,Sm=4,Tm=3,hi=2,Om=1,zc=100,ul=5,Hc=bm()(Rm,200);async function Im(){if(!es.contextSrv.user.isSignedIn)return[];const U=(await Mm.Z.getDashboardOpened()).slice(0,ul),z=(await(0,_c.getGrafanaSearcher)().search({kind:["dashboard"],limit:ul,uid:U})).view.toArray();return z.sort((fe,Pe)=>{const Ne=U.indexOf(fe.uid),Je=U.indexOf(Pe.uid);return Ne-Je}),z.map(fe=>{const{url:Pe,name:Ne}=fe;return{id:`recent-dashboards${Pe}`,name:`${Ne}`,section:(0,Aa.t)("command-palette.section.recent-dashboards","Recent dashboards"),priority:xm,url:Pe}})}async function Rm(U){if(U.length===0||!es.contextSrv.user.isSignedIn&&!n.config.bootData.settings.anonymousEnabled)return[];const K=await(0,_c.getGrafanaSearcher)().search({kind:["dashboard","folder"],query:U,limit:zc});return K.view.map(te=>{const{url:fe,name:Pe,kind:Ne,location:Je}=te;return{id:`go/${Ne}${fe}`,name:`${Pe}`,section:Ne==="dashboard"?(0,Aa.t)("command-palette.section.dashboard-search-results","Dashboards"):(0,Aa.t)("command-palette.section.folder-search-results","Folders"),priority:Om,url:fe,subtitle:K.view.dataFrame.meta?.custom?.locationInfo[Je]?.name}})}function Am(U,K){const[z,te]=(0,a.useState)([]),[fe,Pe]=(0,a.useState)(!1),Ne=(0,a.useRef)(0);return(0,a.useEffect)(()=>{const Je=Date.now();K&&U.length>0?(Pe(!0),Hc(U).then(ot=>{Je>Ne.current&&(te(ot),Pe(!1),Ne.current=Je)})):(te([]),Pe(!1),Ne.current=Je)},[K,U]),{searchResults:z,isFetchingSearchResults:fe}}var Ys=e(43620),wa=e(5933),kc=e(40387),vi=e(12969);const ml=U=>{let K=U.children||[];if(U.id==="help"){const z=()=>{wa.Z.publish(new Ys.Dn({component:vi.B}))};U.children=[...K,...(0,kc.dP)(),...Lm(),{id:"keyboard-shortcuts",text:(0,Aa.t)("nav.help/keyboard-shortcuts","Keyboard shortcuts"),icon:"keyboard",onClick:z}]}return U},Ei=(U,K)=>{const z=U.onClick;return U.onClick=()=>{(0,$r.ff)("grafana_navigation_item_clicked",{path:U.url??U.id,state:K?"expanded":"collapsed"}),z?.()},U.children&&(U.children=U.children.map(te=>Ei(te,K))),U},Gc=(U,K)=>!!(U===K||yi(U,K)),yi=(U,K)=>!!U.children?.some(z=>z===K?!0:yi(z,K)),ko=U=>U?.split("?")[0]??"",jc=(U,K)=>{const z=ko(K?.url),te=ko(U.url);return te&&te.length>z?.length},Qc=(U,K,z)=>{const te="/dashboards";for(const fe of U){const Pe=ko(fe.url),Ne=x.u.stripBaseFromUrl(Pe);if(Ne&&fe.id!=="starred")if(Ne===K){z=fe;break}else if(Ne!=="/"&&K.startsWith(Ne))jc(fe,z)&&(z=fe);else if(Ne==="/alerting/list"&&K.startsWith("/alerting/notification/")){z=fe;break}else Ne===te&&K.startsWith("/d/")&&jc(fe,z)&&(z=fe);if(fe.children&&(z=Qc(fe.children,K,z)),ko(z?.url)===K)return z}return z};function Lm(){const{buildInfo:U,licenseInfo:K}=n.config,z=K.stateInfo?` (${K.stateInfo})`:"",te=[];return te.push({target:"_blank",id:"version",text:`${U.edition}${z}`,url:K.licenseUrl,icon:"external-link-alt"}),U.hasUpdate&&te.push({target:"_blank",id:"updateVersion",text:"New version available!",icon:"download-alt",url:"https://grafana.com/grafana/download?utm_source=grafana_footer"}),te}var lo=e(70828);function Yc(U){return"navModel."+U.id}function Zs(U,K=[]){const z=[];for(let te of U){te.id==="help"&&(te=ml({...te}),delete te.url);const{url:fe,target:Pe,text:Ne,isCreateAction:Je,children:ot,onClick:lt}=te,vt=!!ot?.length;if(!(fe||lt||vt))continue;const Ut=Je?(0,Aa.t)("command-palette.section.actions","Actions"):(0,Aa.t)("command-palette.section.pages","Pages"),Zt=Je?Sm:Tm,nn=K.map(bn=>bn.text).join(" > "),gn={id:Yc(te),name:Ne,section:Ut,url:fe,target:Pe,parent:K.length>0&&!Je?Yc(K[K.length-1]):void 0,perform:lt,priority:Zt,subtitle:Je?void 0:nn};if(z.push(gn),ot?.length){const bn=Zs(ot,[...K,te]);z.push(...bn)}}return z}const fl=U=>{const K=[{id:"preferences/theme",name:(0,Aa.t)("command-palette.action.change-theme","Change theme..."),keywords:"interface color dark light",section:(0,Aa.t)("command-palette.section.preferences","Preferences"),priority:hi},{id:"preferences/dark-theme",name:(0,Aa.t)("command-palette.action.dark-theme","Dark"),keywords:"dark theme",perform:()=>(0,lo.L)("dark"),parent:"preferences/theme",priority:hi},{id:"preferences/light-theme",name:(0,Aa.t)("command-palette.action.light-theme","Light"),keywords:"light theme",perform:()=>(0,lo.L)("light"),parent:"preferences/theme",priority:hi}],z=Zs(U);return[...K,...z]};function Zc(U){const[K,z]=(0,a.useState)([]),[te,fe]=(0,a.useState)([]),{navBarTree:Pe}=(0,Cn.useSelector)(Ne=>({navBarTree:Ne.navBarTree}));return(0,a.useEffect)(()=>{const Ne=fl(Pe);z(Ne)},[Pe]),(0,a.useEffect)(()=>{U||Im().then(Ne=>fe(Ne)).catch(Ne=>{console.error("Error loading recent dashboard actions",Ne)})},[U]),U?K:[...te,...K]}var Bm=e(12354);const Jc={name:"none",priority:bs.Priority.NORMAL};function gl(U,K){return K.priority-U.priority}function Xc(){const{search:U,actions:K,rootActionId:z}=(0,bs.useKBar)(vt=>({search:vt.searchQuery,actions:vt.actions,rootActionId:vt.currentRootActionId})),te=a.useMemo(()=>Object.keys(K).reduce((vt,Ut)=>{const Zt=K[Ut];if(!Zt.parent&&!z&&vt.push(Zt),Zt.id===z)for(let nn=0;nn<Zt.children.length;nn++)vt.push(Zt.children[nn]);return vt},[]).sort(gl),[K,z]),fe=a.useCallback(vt=>{let Ut=[];for(let Zt=0;Zt<vt.length;Zt++)Ut.push(vt[Zt]);return function Zt(nn,gn=Ut){for(let bn=0;bn<nn.length;bn++)if(nn[bn].children.length>0){let Kn=nn[bn].children;for(let ja=0;ja<Kn.length;ja++)gn.push(Kn[ja]);Zt(nn[bn].children,gn)}return gn}(vt)},[]),Pe=!U,Ne=a.useMemo(()=>Pe?te:fe(te),[fe,te,Pe]),Je=qc(Ne,U),ot=a.useMemo(()=>{let vt={},Ut=[],Zt=[];for(let gn=0;gn<Je.length;gn++){const bn=Je[gn],Kn=bn.action,ja=bn.score||bs.Priority.NORMAL,Ra={name:typeof Kn.section=="string"?Kn.section:Kn.section?.name||Jc.name,priority:typeof Kn.section=="string"?ja:Kn.section?.priority||0+ja};vt[Ra.name]||(vt[Ra.name]=[],Ut.push(Ra)),vt[Ra.name].push({priority:Kn.priority+ja,action:Kn})}Zt=Ut.sort(gl).map(gn=>({name:gn.name,actions:vt[gn.name].sort(gl).map(bn=>bn.action)}));let nn=[];for(let gn=0;gn<Zt.length;gn++){let bn=Zt[gn];bn.name!==Jc.name&&nn.push(bn.name);for(let Kn=0;Kn<bn.actions.length;Kn++)nn.push(bn.actions[Kn])}return nn},[Je]),lt=a.useMemo(()=>z,[ot]);return a.useMemo(()=>({results:ot,rootActionId:lt}),[lt,ot])}function qc(U,K){const z=Um(),te=a.useMemo(()=>({filtered:U,search:K}),[U,K]),{filtered:fe,search:Pe}=(0,Fc.useThrottledValue)(te);return a.useMemo(()=>{if(Pe.trim()==="")return fe.map(ot=>({score:0,action:ot}));const Ne=fe.map(({name:ot,keywords:lt})=>`${ot} ${lt??""}`.toLowerCase()),Je=[];if(Pe.length>pl){const ot=Pe.toLowerCase();for(let lt=0;lt<Ne.length;lt++){const Ut=Ne[lt].indexOf(ot);if(Ut>-1){const Zt=Ut*-1,nn=fe[lt];Je.push({score:Zt,action:nn})}}}else{const ot=z.split(Pe).length,lt=1/0,vt=ot<5,[,Ut,Zt]=z.search(Ne,Pe,vt,lt);if(Ut&&Zt)for(let nn=0;nn<Zt.length;nn++){const gn=Zt[nn],bn=Zt.length-nn,Kn=fe[Ut.idx[gn]];Je.push({score:bn,action:Kn})}}return Je},[fe,Pe,z])}const pl=25;function Um(){const U=a.useRef();return U.current||(U.current=new Bm.Z({intraMode:0,intraIns:0})),U.current}function hl(){const U=(0,Be.wW)(ed),{query:K,showing:z,searchQuery:te}=(0,bs.useKBar)(vt=>({showing:vt.visualState===bs.VisualState.showing,searchQuery:vt.searchQuery})),fe=Zc(te);(0,bs.useRegisterActions)(fe,[fe]);const{searchResults:Pe,isFetchingSearchResults:Ne}=Am(te,z),Je=(0,a.useRef)(null),{overlayProps:ot}=(0,dl.Ir)({isOpen:z,onClose:()=>K.setVisualState(bs.VisualState.animatingOut)},Je),{dialogProps:lt}=(0,wc.R)({},Je);return(0,a.useEffect)(()=>{z&&(0,$r.ff)("command_palette_opened")},[z]),fe.length>0?a.createElement(bs.KBarPortal,null,a.createElement(bs.KBarPositioner,{className:U.positioner},a.createElement(bs.KBarAnimator,{className:U.animator},a.createElement(Wc.MT,{contain:!0,autoFocus:!0,restoreFocus:!0},a.createElement("div",{...ot,...lt},a.createElement("div",{className:U.searchContainer},Ne?a.createElement(rl.$,{className:U.spinner}):a.createElement(va.J,{name:"search",size:"md"}),a.createElement(bs.KBarSearch,{defaultPlaceholder:(0,Aa.t)("command-palette.search-box.placeholder","Search or jump to..."),className:U.search})),a.createElement("div",{className:U.resultsContainer},a.createElement(yr,{searchResults:Pe}))))))):null}const yr=({searchResults:U})=>{const{results:K,rootActionId:z}=Xc(),te=(0,Be.wW)(ed),fe=(0,Aa.t)("command-palette.section.dashboard-search-results","Dashboards"),Pe=(0,Aa.t)("command-palette.section.folder-search-results","Folders"),Ne=(0,a.useMemo)(()=>U.filter(lt=>lt.id.startsWith("go/dashboard")).map(lt=>new bs.ActionImpl(lt,{store:{}})),[U]),Je=(0,a.useMemo)(()=>U.filter(lt=>lt.id.startsWith("go/folder")).map(lt=>new bs.ActionImpl(lt,{store:{}})),[U]),ot=(0,a.useMemo)(()=>{const lt=[...K];return Je.length>0&&(lt.push(Pe),lt.push(...Je)),Ne.length>0&&(lt.push(fe),lt.push(...Ne)),lt},[K,fe,Ne,Pe,Je]);return a.createElement(Vc,{items:ot,maxHeight:650,onRender:({item:lt,active:vt})=>{const Ut=ot[0]===lt;return typeof lt=="string"?a.createElement("div",{className:(0,Q.cx)(te.sectionHeader,Ut&&te.sectionHeaderFirst)},lt):a.createElement($c,{action:lt,active:vt,currentRootActionId:z})}})},ed=U=>({positioner:(0,Q.css)({zIndex:U.zIndex.portal,marginTop:"0px",paddingTop:"4px !important","&::before":{content:'""',position:"fixed",top:0,right:0,bottom:0,left:0,background:U.components.overlay.background,backdropFilter:"blur(1px)"}}),animator:(0,Q.css)({maxWidth:U.breakpoints.values.md,width:"100%",background:U.colors.background.primary,color:U.colors.text.primary,borderRadius:U.shape.radius.default,border:`1px solid ${U.colors.border.weak}`,overflow:"hidden",boxShadow:U.shadows.z3}),searchContainer:(0,Q.css)({alignItems:"center",background:U.components.input.background,borderBottom:`1px solid ${U.colors.border.weak}`,display:"flex",gap:U.spacing(1),padding:U.spacing(1,2)}),search:(0,Q.css)({fontSize:U.typography.fontSize,width:"100%",boxSizing:"border-box",outline:"none",border:"none",color:U.components.input.text}),spinner:(0,Q.css)({height:"22px"}),resultsContainer:(0,Q.css)({paddingBottom:U.spacing(1)}),sectionHeader:(0,Q.css)({padding:U.spacing(1.5,2,2,2),fontSize:U.typography.bodySmall.fontSize,fontWeight:U.typography.fontWeightMedium,color:U.colors.text.secondary,borderTop:`1px solid ${U.colors.border.weak}`,marginTop:U.spacing(1)}),sectionHeaderFirst:(0,Q.css)({paddingBottom:U.spacing(1),borderTop:"none",marginTop:0})});var vl=e(42358),td=e(29372),kr=e(63362),Nm=e(9848);function El({children:U,icon:K,isActive:z,isChild:te,onClick:fe,target:Pe,url:Ne}){const Je=(0,Be.l4)(),ot=nd(Je,z,te),lt=a.createElement("div",{className:ot.linkContent},K&&a.createElement(va.J,{"data-testid":"dropdown-child-icon",name:K}),a.createElement("div",{className:ot.linkText},U),Pe==="_blank"&&a.createElement(va.J,{"data-testid":"external-link-icon",name:"external-link-alt",className:ot.externalLinkIcon}));let vt=a.createElement("button",{"data-testid":Va.wl.components.NavMenu.item,className:(0,Q.cx)(ot.button,ot.element),onClick:fe},lt);return Ne&&(vt=!Pe&&Ne.startsWith("/")?a.createElement(Nm.r,{"data-testid":Va.wl.components.NavMenu.item,className:ot.element,href:Ne,target:Pe,onClick:fe},lt):a.createElement("a",{"data-testid":Va.wl.components.NavMenu.item,href:Ne,target:Pe,className:ot.element,onClick:fe},lt)),a.createElement("li",{className:ot.listItem},vt)}El.displayName="NavBarMenuItem";const nd=(U,K,z)=>({button:(0,Q.css)({backgroundColor:"unset",borderStyle:"unset"}),linkContent:(0,Q.css)({alignItems:"center",display:"flex",gap:"0.5rem",height:"100%",width:"100%"}),linkText:(0,Q.css)({textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),externalLinkIcon:(0,Q.css)({color:U.colors.text.secondary}),element:(0,Q.css)({alignItems:"center",boxSizing:"border-box",position:"relative",color:K?U.colors.text.primary:U.colors.text.secondary,padding:U.spacing(1,1,1,z?5:0),...z&&{borderRadius:U.shape.borderRadius()},width:"100%","&:hover, &:focus-visible":{...z&&{background:U.colors.emphasize(U.colors.background.primary,.03)},textDecoration:"underline",color:U.colors.text.primary},"&:focus-visible":{boxShadow:"none",outline:`2px solid ${U.colors.primary.main}`,outlineOffset:"-2px",transition:"none"},"&::before":{display:K?"block":"none",content:'" "',height:U.spacing(3),position:"absolute",left:U.spacing(1),top:"50%",transform:"translateY(-50%)",width:U.spacing(.5),borderRadius:U.shape.borderRadius(1),backgroundImage:U.colors.gradients.brandVertical}}),listItem:(0,Q.css)({boxSizing:"border-box",position:"relative",display:"flex",width:"100%",...z&&{padding:U.spacing(0,2)}})});var mr=e(84789),wm=e(65469);function Wm({link:U}){const K=(0,Be.l4)(),z=Fm(K);if(U.icon==="grafana")return a.createElement(Uo.c.MenuLogo,{className:z.img});if(U.icon){const te=(0,wm.toIconName)(U.icon);return a.createElement(va.J,{name:te??"link",size:"xl"})}else return a.createElement("img",{className:(0,Q.cx)(z.img,U.roundIcon&&z.round),src:U.img,alt:""})}function Fm(U){return{img:(0,Q.css)({height:U.spacing(3),width:U.spacing(3)}),round:(0,Q.css)({borderRadius:U.shape.radius.circle})}}const Pi=({children:U})=>{const K=(0,Be.wW)(Km);return a.createElement("div",null,U,a.createElement("span",{className:K.highlight}))},Km=U=>({highlight:(0,Q.css)` background-color: ${U.colors.success.main}; border-radius: ${U.shape.radius.circle}; width: 6px; height: 6px; display: inline-block; position: absolute; top: 50%; transform: translateY(-50%); `});function ad({link:U,activeItem:K,children:z,className:te,onClose:fe}){const Pe=(0,Be.wW)(Vm),Ne=U.highlightText?Pi:a.Fragment,Je=U===K,ot=yi(U,K),[lt,vt]=(0,mr.Z)(`grafana.navigation.expanded[${U.text}]`,!1)??!!ot;return a.createElement(a.Fragment,null,a.createElement("div",{className:(0,Q.cx)(Pe.collapsibleSectionWrapper,te)},a.createElement(El,{isActive:U===K,onClick:()=>{U.onClick?.(),fe?.()},target:U.target,url:U.url},a.createElement("div",{className:(0,Q.cx)(Pe.labelWrapper,{[Pe.isActive]:Je,[Pe.hasActiveChild]:ot})},a.createElement(Ne,null,a.createElement(Wm,{link:U})),U.text)),z&&a.createElement(re.zx,{"aria-label":`${lt?"Collapse":"Expand"} section ${U.text}`,variant:"secondary",fill:"text",className:Pe.collapseButton,onClick:()=>vt(!lt)},a.createElement(va.J,{name:lt?"angle-up":"angle-down",size:"xl"}))),lt&&z)}const Vm=U=>({collapsibleSectionWrapper:(0,Q.css)({alignItems:"center",display:"flex"}),collapseButton:(0,Q.css)({color:U.colors.text.disabled,padding:U.spacing(0,.5),marginRight:U.spacing(1)}),collapseWrapperActive:(0,Q.css)({backgroundColor:U.colors.action.disabledBackground}),collapseContent:(0,Q.css)({padding:0}),labelWrapper:(0,Q.css)({display:"grid",fontSize:U.typography.pxToRem(14),gridAutoFlow:"column",gridTemplateColumns:`${U.spacing(7)} auto`,placeItems:"center",fontWeight:U.typography.fontWeightMedium}),isActive:(0,Q.css)({color:U.colors.text.primary,"&::before":{display:"block",content:'" "',height:U.spacing(3),position:"absolute",left:U.spacing(1),top:"50%",transform:"translateY(-50%)",width:U.spacing(.5),borderRadius:U.shape.borderRadius(1),backgroundImage:U.colors.gradients.brandVertical}}),hasActiveChild:(0,Q.css)({color:U.colors.text.primary})});function yl({link:U,activeItem:K,onClose:z}){const te=(0,Be.wW)($m);return U.emptyMessage&&!sd(U)?a.createElement(ad,{onClose:z,link:U,activeItem:K},a.createElement("ul",{className:te.children},a.createElement("div",{className:te.emptyMessage},U.emptyMessage))):a.createElement(ad,{onClose:z,link:U,activeItem:K},sd(U)&&a.createElement("ul",{className:te.children},U.children.map(fe=>!fe.isCreateAction&&a.createElement(El,{key:`${U.text}-${fe.text}`,isActive:Gc(fe,K),isChild:!0,onClick:()=>{fe.onClick?.(),z()},target:fe.target,url:fe.url},fe.text))))}const $m=U=>({children:(0,Q.css)({display:"flex",flexDirection:"column"}),flex:(0,Q.css)({display:"flex"}),itemWithoutMenu:(0,Q.css)({position:"relative",placeItems:"inherit",justifyContent:"start",display:"flex",flexGrow:1,alignItems:"center"}),fullWidth:(0,Q.css)({height:"100%",width:"100%"}),iconContainer:(0,Q.css)({display:"flex",placeContent:"center"}),itemWithoutMenuContent:(0,Q.css)({display:"grid",gridAutoFlow:"column",gridTemplateColumns:`${U.spacing(7)} auto`,alignItems:"center",height:"100%"}),linkText:(0,Q.css)({fontSize:U.typography.pxToRem(14),justifySelf:"start"}),emptyMessage:(0,Q.css)({color:U.colors.text.secondary,fontStyle:"italic",padding:U.spacing(1,1.5,1,7)})});function sd(U){return!!(U.children&&U.children.length>0)}const Pl="350px";function rd({activeItem:U,navItems:K,searchBarHidden:z,onClose:te}){const fe=(0,Be.l4)(),Pe=_m(fe,z),Ne=fe.transitions.duration.shortest,Je=od(fe,Ne),{chrome:ot}=(0,_o.p)(),lt=ot.useState(),vt=(0,a.useRef)(null),Ut=(0,a.useRef)(null),{dialogProps:Zt}=(0,wc.R)({},vt),[nn,gn]=(0,a.useState)(!1),bn=()=>gn(!1),{overlayProps:Kn,underlayProps:ja}=(0,dl.Ir)({isDismissable:!0,isOpen:!0,onClose:bn},vt);return(0,a.useEffect)(()=>{lt.megaMenuOpen&&gn(!0)},[lt.megaMenuOpen]),a.createElement(dl.Xj,null,a.createElement(vl.Z,{nodeRef:vt,in:nn,unmountOnExit:!0,classNames:Je.overlay,timeout:{enter:Ne,exit:0},onExited:te},a.createElement(Wc.MT,{contain:!0,autoFocus:!0},a.createElement("div",{"data-testid":"navbarmenu",ref:vt,...Kn,...Zt,className:Pe.container},a.createElement("div",{className:Pe.mobileHeader},a.createElement(va.J,{name:"bars",size:"xl"}),a.createElement(Vs.h,{"aria-label":"Close navigation menu",tooltip:"Close menu",name:"times",onClick:bn,size:"xl",variant:"secondary"})),a.createElement("nav",{className:Pe.content},a.createElement(td.$,{showScrollIndicators:!0,hideHorizontalTrack:!0},a.createElement("ul",{className:Pe.itemList},K.map(Ra=>a.createElement(yl,{link:Ra,onClose:bn,activeItem:U,key:Ra.text})))))))),a.createElement(vl.Z,{nodeRef:Ut,in:nn,unmountOnExit:!0,classNames:Je.backdrop,timeout:{enter:Ne,exit:0}},a.createElement("div",{ref:Ut,className:Pe.backdrop,...ja})))}rd.displayName="NavBarMenu";const _m=(U,K)=>{const z=(K?kr.$:kr.$*2)+1;return{backdrop:(0,Q.css)({backdropFilter:"blur(1px)",backgroundColor:U.components.overlay.background,bottom:0,left:0,position:"fixed",right:0,top:K?0:kr.$,zIndex:U.zIndex.modalBackdrop,[U.breakpoints.up("md")]:{top:z}}),container:(0,Q.css)({display:"flex",bottom:0,flexDirection:"column",left:0,marginRight:U.spacing(1.5),right:0,zIndex:U.zIndex.modal,position:"fixed",top:K?0:kr.$,backgroundColor:U.colors.background.primary,boxSizing:"content-box",flex:"1 1 0",[U.breakpoints.up("md")]:{borderRight:`1px solid ${U.colors.border.weak}`,right:"unset",top:z}}),content:(0,Q.css)({display:"flex",flexDirection:"column",flexGrow:1,minHeight:0}),mobileHeader:(0,Q.css)({display:"flex",justifyContent:"space-between",padding:U.spacing(1,1,1,2),borderBottom:`1px solid ${U.colors.border.weak}`,[U.breakpoints.up("md")]:{display:"none"}}),itemList:(0,Q.css)({display:"grid",gridAutoRows:`minmax(${U.spacing(6)}, auto)`,gridTemplateColumns:`minmax(${Pl}, auto)`,minWidth:Pl})}},od=(U,K)=>{const z={transitionDuration:`${K}ms`,transitionTimingFunction:U.transitions.easing.easeInOut,[U.breakpoints.down("md")]:{overflow:"hidden"}},te={...z,transitionProperty:"box-shadow, width",".scrollbar-view":{overflow:"hidden !important"}},fe={...z,transitionProperty:"opacity"},Pe={width:"100%",[U.breakpoints.up("md")]:{boxShadow:U.shadows.z3,width:Pl}},Ne={boxShadow:"none",width:0},Je={opacity:1},ot={opacity:0};return{backdrop:{enter:(0,Q.css)(ot),enterActive:(0,Q.css)(fe,Je),enterDone:(0,Q.css)(Je)},overlay:{enter:(0,Q.css)(Ne),enterActive:(0,Q.css)(te,Pe),enterDone:(0,Q.css)(Pe)}}},id=a.memo(({onClose:U,searchBarHidden:K})=>{const z=(0,Cn.useSelector)(lt=>lt.navBarTree),te=(0,Be.l4)(),fe=zm(te),Pe=(0,Us.TH)(),Je=(0,v.cloneDeep)(z).filter(lt=>lt.id!=="profile"&<.id!=="help").map(lt=>Ei(lt,!0)),ot=Qc(Je,Pe.pathname);return a.createElement("div",{className:fe.menuWrapper},a.createElement(rd,{activeItem:ot,navItems:Je,onClose:U,searchBarHidden:K}))});id.displayName="MegaMenu";const zm=U=>({menuWrapper:(0,Q.css)({position:"fixed",display:"grid",gridAutoFlow:"column",height:"100%",zIndex:U.zIndex.sidemenu})});var Di=e(53327),co=e(30973),Dl=e(34139);function Hm({href:U,isCurrent:K,text:z,index:te,flexGrow:fe}){const Pe=(0,Be.wW)(km),Ne=()=>{(0,$r.ff)("grafana_breadcrumb_clicked",{url:U})};return a.createElement("li",{className:Pe.breadcrumbWrapper,style:{flexGrow:fe}},K?a.createElement("span",{"data-testid":Di.z.Breadcrumbs.breadcrumb(z),className:Pe.breadcrumb,"aria-current":"page",title:z},z):a.createElement(a.Fragment,null,a.createElement("a",{onClick:Ne,"data-testid":Di.z.Breadcrumbs.breadcrumb(z),className:(0,Q.cx)(Pe.breadcrumb,Pe.breadcrumbLink),title:z,href:U},z),a.createElement("div",{className:Pe.separator,"aria-hidden":!0},a.createElement(va.J,{name:"angle-right"}))))}const km=U=>({breadcrumb:(0,Q.css)({display:"block",textOverflow:"ellipsis",overflow:"hidden",padding:U.spacing(0,.5),whiteSpace:"nowrap",color:U.colors.text.secondary}),breadcrumbLink:(0,Q.css)({color:U.colors.text.primary,"&:hover":{textDecoration:"underline"}}),breadcrumbWrapper:(0,Q.css)({alignItems:"center",color:U.colors.text.primary,display:"flex",flex:1,minWidth:0,maxWidth:"max-content",[U.breakpoints.down("sm")]:{display:"none","&:nth-last-child(2)":{display:"flex",minWidth:"40px"},"&:last-child":{display:"flex"}}}),separator:(0,Q.css)({color:U.colors.text.secondary})});function Gm({breadcrumbs:U,className:K}){const z=(0,Be.wW)(Cl);return a.createElement("nav",{"aria-label":"Breadcrumbs",className:K},a.createElement("ol",{className:z.breadcrumbs},U.map((te,fe)=>a.createElement(Hm,{...te,isCurrent:fe===U.length-1,key:fe,index:fe,flexGrow:jm(fe,U.length)}))))}function jm(U,K){return K<5&&U>0&&U<K-2||K>6&&U>1&&U<K-3?4:10}const Cl=U=>({breadcrumbs:(0,Q.css)({display:"flex",alignItems:"center",flexWrap:"nowrap",overflow:"hidden"})});var Qm=e(57821),ld=e(80557);function Ym({actions:U,searchBarHidden:K,sectionNav:z,pageNav:te,onToggleMegaMenu:fe,onToggleSearchBar:Pe,onToggleKioskMode:Ne}){const Je=(0,Cn.useSelector)(vt=>vt.navIndex)[Dl.Qz],ot=(0,Be.wW)(Zm),lt=(0,Qm.t)(z,te,Je);return a.createElement("div",{"data-testid":Di.z.NavToolbar.container,className:ot.pageToolbar},a.createElement("div",{className:ot.menuButton},a.createElement(Vs.h,{name:"bars",tooltip:(0,Aa.t)("navigation.toolbar.toggle-menu","Toggle menu"),tooltipPlacement:"bottom",size:"xl",onClick:fe})),a.createElement(Gm,{breadcrumbs:lt,className:ot.breadcrumbsWrapper}),a.createElement("div",{className:ot.actions},U,U&&a.createElement(ld.M,null),K&&a.createElement(co.h,{onClick:Ne,narrow:!0,title:(0,Aa.t)("navigation.toolbar.enable-kiosk","Enable kiosk mode"),icon:"monitor"}),a.createElement(co.h,{onClick:Pe,narrow:!0,title:(0,Aa.t)("navigation.toolbar.toggle-search-bar","Toggle top search bar")},a.createElement(va.J,{name:K?"angle-down":"angle-up",size:"xl"}))))}const Zm=U=>({breadcrumbsWrapper:(0,Q.css)({display:"flex",overflow:"hidden",[U.breakpoints.down("sm")]:{minWidth:"50%"}}),pageToolbar:(0,Q.css)({height:kr.$,display:"flex",padding:U.spacing(0,1,0,2),alignItems:"center"}),menuButton:(0,Q.css)({display:"flex",alignItems:"center",marginRight:U.spacing(1)}),actions:(0,Q.css)({label:"NavToolbar-actions",display:"flex",alignItems:"center",flexWrap:"nowrap",justifyContent:"flex-end",paddingLeft:U.spacing(1),flexGrow:1,gap:U.spacing(.5),minWidth:0,".body-drawer-open &":{display:"none"}})});function cd({item:U,isSectionRoot:K=!1}){const z=(0,Be.wW)(Jm),te=U.children?.filter(ot=>!ot.hideFromTabs),fe=K&&!!U.children[0].children?.length,Pe=(0,Q.cx)({[z.link]:!0,[z.activeStyle]:U.active,[z.isSection]:!!te?.length||U.isSection,[z.isSectionRoot]:K,[z.noRootMargin]:fe});let Ne=null;U.img?Ne=a.createElement("img",{"data-testid":"section-image",className:z.sectionImg,src:U.img,alt:""}):U.icon&&(Ne=a.createElement(va.J,{"data-testid":"section-icon",className:z.sectionImg,name:U.icon}));const Je=()=>{(0,$r.ff)("grafana_navigation_item_clicked",{path:U.url??U.id,sectionNav:!0})};return a.createElement(a.Fragment,null,a.createElement("a",{onClick:Je,href:U.url,className:Pe,"aria-label":Va.wl.components.Tab.title(U.text),role:"tab","aria-selected":U.active},K&&Ne,U.text,U.tabSuffix&&a.createElement(U.tabSuffix,{className:z.suffix})),te?.map((ot,lt)=>a.createElement(cd,{item:ot,key:lt})))}const Jm=U=>({link:(0,Q.css)` padding: ${U.spacing(1,0,1,1.5)}; display: flex; align-items: flex-start; border-radius: ${U.shape.radius.default}; gap: ${U.spacing(1)}; height: 100%; position: relative; color: ${U.colors.text.secondary}; &:hover, &:focus { text-decoration: underline; z-index: 1; } `,activeStyle:(0,Q.css)` label: activeTabStyle; color: ${U.colors.text.primary}; font-weight: ${U.typography.fontWeightMedium}; background: ${U.colors.emphasize(U.colors.background.canvas,.03)}; &::before { display: block; content: ' '; position: absolute; left: 0; width: 4px; bottom: 2px; top: 2px; border-radius: ${U.shape.radius.default}; background-image: ${U.colors.gradients.brandVertical}; } `,suffix:(0,Q.css)` margin-left: ${U.spacing(1)}; `,sectionImg:(0,Q.css)({margin:"6px 0",width:U.spacing(2)}),isSectionRoot:(0,Q.css)({fontSize:U.typography.h4.fontSize,marginTop:0,marginBottom:U.spacing(2),fontWeight:U.typography.fontWeightMedium}),isSection:(0,Q.css)({color:U.colors.text.primary,fontSize:U.typography.h5.fontSize,marginTop:U.spacing(2),fontWeight:U.typography.fontWeightMedium}),noRootMargin:(0,Q.css)({marginBottom:0})}),dd=({isExpanded:U,onClick:K})=>{const z=(0,Be.l4)(),te=Xm(z);return a.createElement(re.zx,{title:"Toggle section navigation","aria-label":U?"Close section navigation":"Open section navigation",icon:"arrow-to-right",className:Nc()(te.icon,{[te.iconExpanded]:U}),variant:"secondary",fill:"text",size:"md",onClick:K})};dd.displayName="SectionNavToggle";const Xm=U=>({icon:(0,Q.css)({alignSelf:"center",margin:U.spacing(1,0),transform:"rotate(90deg)",transition:U.transitions.create("opacity"),color:U.colors.text.secondary,zIndex:1,[U.breakpoints.up("md")]:{alignSelf:"flex-start",position:"relative",left:0,margin:U.spacing(0,0,0,1),top:U.spacing(2),transform:"none"},"div:hover > &, &:focus":{opacity:1}}),iconExpanded:(0,Q.css)({rotate:"180deg",[U.breakpoints.up("md")]:{opacity:0,margin:0,position:"absolute",right:0,left:"initial"}})});function qm({model:U}){const K=(0,Be.wW)(tf),{isExpanded:z,onToggleSectionNav:te}=ef();return U.main?.children?.length?a.createElement("div",{className:K.navContainer},a.createElement("nav",{className:(0,Q.cx)(K.nav,{[K.navExpanded]:z})},a.createElement(td.$,{showScrollIndicators:!0},a.createElement("div",{className:K.items,role:"tablist"},a.createElement(cd,{item:U.main,isSectionRoot:!0})))),a.createElement(dd,{isExpanded:z,onClick:te})):null}function ef(){const U=(0,Be.l4)(),K=window.matchMedia(`(max-width: ${U.breakpoints.values.lg}px)`).matches,[z,te]=(0,mr.Z)("grafana.sectionNav.expanded",!K),[fe,Pe]=(0,a.useState)(!K&&z);return(0,a.useEffect)(()=>{const Je=window.matchMedia(`(max-width: ${U.breakpoints.values.lg}px)`),ot=lt=>Pe(lt.matches?!1:z);return Je.addEventListener("change",ot),()=>Je.removeEventListener("change",ot)},[z,U.breakpoints.values.lg]),{isExpanded:fe,onToggleSectionNav:()=>{te(!fe),Pe(!fe)}}}const tf=U=>({navContainer:(0,Q.css)({display:"flex",flexDirection:"column",position:"relative",[U.breakpoints.up("md")]:{flexDirection:"row"}}),nav:(0,Q.css)({display:"flex",flexDirection:"column",background:U.colors.background.canvas,flexShrink:0,transition:U.transitions.create(["width","max-height"]),maxHeight:0,visibility:"hidden",[U.breakpoints.up("md")]:{width:0,maxHeight:"unset"}}),navExpanded:(0,Q.css)({maxHeight:"50vh",visibility:"visible",[U.breakpoints.up("md")]:{width:"250px",maxHeight:"unset"}}),items:(0,Q.css)({display:"flex",flexDirection:"column",padding:U.spacing(2,1,2,2),minWidth:"250px",[U.breakpoints.up("md")]:{padding:U.spacing(4.5,1,2,2)}})});var Go=e(80434),nf=e(73195),bl=e(14574),af=e(21323),sf=e(42349),rf=e(96284),Pr=e(52419),rr=e(54945),Gr=e(5008);function mp({feedUrl:U}){const K=(0,Be.wW)(fp),{state:z,getNews:te}=(0,Gr.j)(U),[fe,Pe]=(0,rf.Z)();return(0,a.useEffect)(()=>{te()},[te]),z.loading||z.error?a.createElement("div",{className:K.innerWrapper},z.loading&&a.createElement(Pr.u,{text:"Loading..."}),z.error&&z.error.message):z.value?a.createElement("div",{ref:fe},Pe.width>0&&z.value.map((Ne,Je)=>a.createElement(rr.S,{key:Je,index:Je,showImage:!0,width:Pe.width,data:z.value})),a.createElement("div",{className:K.grot},a.createElement("a",{href:"https://grafana.com/blog/",target:"_blank",rel:"noreferrer",title:"Go to Grafana labs blog"},a.createElement("img",{src:"public/img/grot-news.svg",alt:"Grot reading news"})))):null}const fp=U=>({innerWrapper:(0,Q.css)` width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; `,grot:(0,Q.css)({display:"flex",alignItems:"center",justifyContent:"center",padding:U.spacing(5,0),img:{width:"186px",height:"186px"}})});function ud({className:U}){const[K,z]=(0,nf.Z)(!1),te=(0,Be.wW)(md);return a.createElement(a.Fragment,null,a.createElement(co.h,{className:U,onClick:z,iconOnly:!0,icon:"rss","aria-label":"News"}),K&&a.createElement(bl.d,{title:a.createElement("div",{className:te.title},a.createElement(af.x,{element:"h3"},(0,Aa.t)("news.title","Latest from the blog")),a.createElement("a",{href:"https://grafana.com/blog/",target:"_blank",rel:"noreferrer",title:"Go to Grafana labs blog",className:te.grot},a.createElement("img",{src:"public/img/grot-news.svg",alt:"Grot reading news"})),a.createElement("div",{className:te.actions},a.createElement(re.zx,{icon:"times",variant:"secondary",fill:"text",onClick:z,"aria-label":Va.wl.components.Drawer.General.close}))),scrollableContent:!0,onClose:z,size:"md"},a.createElement(mp,{feedUrl:sf.k})))}const md=U=>({title:(0,Q.css)({display:"flex",alignItems:"center",justifyContent:"center",gap:U.spacing(2),borderBottom:`1px solid ${U.colors.border.weak}`}),grot:(0,Q.css)({display:"flex",alignItems:"center",justifyContent:"center",padding:U.spacing(2,0),img:{width:"75px",height:"75px"}}),actions:(0,Q.css)({position:"absolute",right:U.spacing(1),top:U.spacing(2)})});function Ci({breakpoint:U,onChange:K}){(0,a.useEffect)(()=>{const z=window.matchMedia(`(min-width: ${U}px)`),te=fe=>K(fe);return z.addEventListener("change",te),()=>z.removeEventListener("change",te)},[U,K])}var Ml=e(30284);function of({orgs:U,onSelectChange:K}){const z=(0,Be.wW)(lf);return a.createElement(ai.b,{"aria-label":"Change organization",variant:"secondary",buttonCss:z.buttonCss,size:"md",label:"",fill:"text",isFullWidth:!1,options:U.map(te=>({label:te.name,description:te.role,value:te})),onChange:K,icon:"building"})}const lf=U=>({buttonCss:(0,Q.css)({color:U.colors.text.secondary,"&:hover":{color:U.colors.text.primary}})});function cf({orgs:U,onSelectChange:K}){const z=(0,Be.wW)(df),{orgName:te,orgId:fe,orgRole:Pe}=es.contextSrv.user,[Ne,Je]=(0,a.useState)(()=>({label:te,value:{role:Pe,orgId:fe,name:te},description:Pe})),ot=lt=>{Je(lt),K(lt)};return a.createElement(he.Ph,{"aria-label":"Change organization",width:"auto",value:Ne,prefix:a.createElement(va.J,{className:"prefix-icon",name:"building"}),className:z.select,options:U.map(lt=>({label:lt.name,description:lt.role,value:lt})),onChange:ot})}const df=U=>({select:(0,Q.css)({border:"none",background:"none",color:U.colors.text.secondary,"&:hover":{color:U.colors.text.primary,"& .prefix-icon":(0,Q.css)({color:U.colors.text.primary})}})});function uf(){const U=(0,Be.l4)(),K=(0,Cn.useDispatch)(),z=(0,Cn.useSelector)(ot=>ot.organization.userOrgs),te=ot=>{ot.value&&((0,Ml.Q$)(ot.value.orgId),A.E1.push(`/?orgId=${ot.value.orgId}`),window.location.reload())};(0,a.useEffect)(()=>{es.contextSrv.isSignedIn&&K((0,Ml.JE)())},[K]);const fe=U.breakpoints.values.sm,[Pe,Ne]=(0,a.useState)(!window.matchMedia(`(min-width: ${fe}px)`).matches);if(Ci({breakpoint:fe,onChange:ot=>{Ne(!ot.matches)}}),z?.length<=1)return null;const Je=Pe?of:cf;return a.createElement(Je,{orgs:z,onSelectChange:te})}var xl=e(89746);function fd(U){const K=[];for(const z of U)z.isCreateAction&&K.push(z),z.children&&K.push(...fd(z.children));return K}const gd=({})=>{const U=(0,Be.wW)(pd),K=(0,Be.l4)(),z=(0,Cn.useSelector)(vt=>vt.navBarTree),te=K.breakpoints.values.sm,[fe,Pe]=(0,a.useState)(!1),[Ne,Je]=(0,a.useState)(!window.matchMedia(`(min-width: ${te}px)`).matches),ot=(0,a.useMemo)(()=>fd(z),[z]);Ci({breakpoint:te,onChange:vt=>{Je(!vt.matches)}});const lt=()=>a.createElement(xl.v,null,ot.map((vt,Ut)=>a.createElement(xl.v.Item,{key:Ut,url:vt.url,label:vt.text,onClick:()=>(0,$r.ff)("grafana_menu_item_clicked",{url:vt.url,from:"quickadd"})})));return ot.length>0?a.createElement(a.Fragment,null,a.createElement(Go.L,{overlay:lt,placement:"bottom-end",onVisibleChange:Pe},a.createElement(co.h,{iconOnly:!0,icon:Ne?"plus-circle":"plus",isOpen:Ne?void 0:fe,"aria-label":"New"})),a.createElement(ld.M,{className:U.separator})):null},pd=U=>({buttonContent:(0,Q.css)({alignItems:"center",display:"flex"}),buttonText:(0,Q.css)({[U.breakpoints.down("md")]:{display:"none"}}),separator:(0,Q.css)({[U.breakpoints.down("sm")]:{display:"none"}})});function Sl(){const U=(0,Us.TH)(),K=(0,Be.wW)(mf),z=t.QX.sanitizeUrl(x.u.getUrlForPartial(U,{forceLogin:"true"}));return a.createElement("a",{className:K.link,href:z,target:"_self"},"Sign in")}const mf=U=>({link:(0,Q.css)({paddingRight:U.spacing(1),whiteSpace:"nowrap","&:hover":{textDecoration:"underline"}})});var hd=e(79655);function vd({node:U}){const K=(0,Be.wW)(ff),z=Ei((0,v.cloneDeep)(U),!1);return z?a.createElement(xl.v,{header:a.createElement("div",{onClick:te=>te.stopPropagation(),className:K.header},a.createElement("div",null,z.text),z.subTitle&&a.createElement("div",{className:K.subTitle},z.subTitle))},z.children?.map(te=>te.url?a.createElement(hd.s,{url:te.url,label:te.text,icon:te.icon,target:te.target,key:te.id}):a.createElement(hd.s,{icon:te.icon,onClick:te.onClick,label:te.text,key:te.id}))):null}const ff=U=>({header:(0,Q.css)({fontSize:U.typography.h5.fontSize,fontWeight:U.typography.h5.fontWeight,padding:U.spacing(.5,1),whiteSpace:"nowrap"}),subTitle:(0,Q.css)({color:U.colors.text.secondary,fontSize:U.typography.bodySmall.fontSize})});var gf=e(97289),pf=e(72625);function hf(){const U=(0,Be.l4)(),{query:K}=(0,bs.useKBar)(Ne=>({kbarSearchQuery:Ne.searchQuery,kbarIsOpen:Ne.visualState===bs.VisualState.showing})),z=U.breakpoints.values.sm,[te,fe]=(0,a.useState)(!window.matchMedia(`(min-width: ${z}px)`).matches);Ci({breakpoint:z,onChange:Ne=>{fe(!Ne.matches)}});const Pe=()=>{K.toggle()};return te?a.createElement(co.h,{iconOnly:!0,icon:"search","aria-label":(0,Aa.t)("nav.search.placeholderCommandPalette","Search or jump to..."),onClick:Pe}):a.createElement(vf,{onClick:Pe})}function vf({onClick:U}){const K=(0,Be.wW)(Ef),z=(0,a.useMemo)(()=>(0,pf.vl)(),[]);return a.createElement("div",{className:K.wrapper},a.createElement("div",{className:K.inputWrapper},a.createElement("div",{className:K.prefix},a.createElement(va.J,{name:"search"})),a.createElement("button",{className:K.fakeInput,onClick:U},(0,Aa.t)("nav.search.placeholderCommandPalette","Search or jump to...")),a.createElement("div",{className:K.suffix},a.createElement(va.J,{name:"keyboard"}),a.createElement("span",{className:K.shortcut},z,"+k"))))}const Ef=U=>{const K=(0,ce.H)({theme:U});return{wrapper:K.wrapper,inputWrapper:K.inputWrapper,prefix:K.prefix,suffix:(0,Q.css)([K.suffix,{display:"flex",gap:U.spacing(.5)}]),shortcut:(0,Q.css)({fontSize:U.typography.bodySmall.fontSize}),fakeInput:(0,Q.css)([K.input,{textAlign:"left",paddingLeft:28,color:U.colors.text.disabled,"&:focus":{outline:"unset",boxShadow:"unset"},"&:focus-visible":(0,Q.css)` ${(0,gf.focusCss)(U)} `}]),button:(0,Q.css)({width:"100%",textAlign:"center","> *":{width:"100%",textAlign:"center",justifyContent:"center",gap:"1ch"}})}};function bi({children:U,align:K="left"}){const z=(0,Be.wW)(Ed),fe=(0,Be.l4)().breakpoints.values.sm,[Pe,Ne]=(0,a.useState)(!window.matchMedia(`(min-width: ${fe}px)`).matches);return Ci({breakpoint:fe,onChange:Je=>{Ne(!Je.matches)}}),Pe?a.createElement(a.Fragment,null,U):a.createElement("div",{"data-testid":"wrapper",className:(0,Q.cx)(z.wrapper,{[z[K]]:K==="right"})},U)}const Ed=U=>({wrapper:(0,Q.css)({display:"flex",gap:U.spacing(.5),alignItems:"center"}),right:(0,Q.css)({justifyContent:"flex-end"}),left:(0,Q.css)({}),center:(0,Q.css)({})}),yd=a.memo(function(){const K=(0,Be.wW)(Pd),z=(0,Cn.useSelector)(ot=>ot.navIndex),te=(0,Us.TH)(),fe=(0,v.cloneDeep)(z.help),Pe=fe?ml(fe):void 0,Ne=z.profile;let Je=Y.config.appSubUrl||"/";return!Y.config.bootData.user.isSignedIn&&!Y.config.anonymousEnabled&&(Je=t.QX.sanitizeUrl(x.u.getUrlForPartial(te,{forceLogin:"true"}))),a.createElement("div",{className:K.layout},a.createElement(bi,null,a.createElement("a",{className:K.logo,href:Je,title:"Go to home"},a.createElement(Uo.c.MenuLogo,{className:K.img})),a.createElement(uf,null)),a.createElement(bi,null,a.createElement(hf,null)),a.createElement(bi,{align:"right"},a.createElement(gd,null),Pe&&a.createElement(Go.L,{overlay:()=>a.createElement(vd,{node:Pe}),placement:"bottom-end"},a.createElement(co.h,{iconOnly:!0,icon:"question-circle","aria-label":"Help"})),Y.config.newsFeedEnabled&&a.createElement(ud,null),!La.Vt.user.isSignedIn&&a.createElement(Sl,null),Ne&&a.createElement(Go.L,{overlay:()=>a.createElement(vd,{node:Ne}),placement:"bottom-end"},a.createElement(co.h,{className:K.profileButton,imgSrc:La.Vt.user.gravatarUrl,imgAlt:"User avatar","aria-label":"Profile"}))))}),Pd=U=>({layout:(0,Q.css)({height:kr.$,display:"flex",gap:U.spacing(1),alignItems:"center",padding:U.spacing(0,1,0,2),borderBottom:`1px solid ${U.colors.border.weak}`,justifyContent:"space-between",[U.breakpoints.up("sm")]:{gridTemplateColumns:"1.5fr minmax(240px, 1fr) 1.5fr",display:"grid",justifyContent:"flex-start"}}),img:(0,Q.css)({height:U.spacing(3),width:U.spacing(3)}),logo:(0,Q.css)({display:"flex"}),profileButton:(0,Q.css)({padding:U.spacing(0,.25),img:{borderRadius:U.shape.radius.circle,height:"24px",marginRight:0,width:"24px"}})});function Mi({children:U}){const K=(0,Be.wW)(yf),{chrome:z}=(0,_o.p)(),te=z.useState(),fe=te.searchBarHidden||te.kioskMode===Cn.KioskMode.TV,Pe=(0,Q.cx)({[K.content]:!0,[K.contentNoSearchBar]:fe,[K.contentChromeless]:te.chromeless});return a.createElement("div",{className:Nc()("main-view",{"main-view--search-bar-hidden":fe&&!te.chromeless,"main-view--chrome-hidden":te.chromeless})},!te.chromeless&&a.createElement(a.Fragment,null,a.createElement(re.Qj,{className:K.skipLink,href:"#pageContent"},"Skip to main content"),a.createElement("div",{className:(0,Q.cx)(K.topNav)},!fe&&a.createElement(yd,null),a.createElement(Ym,{searchBarHidden:fe,sectionNav:te.sectionNav.node,pageNav:te.pageNav,actions:te.actions,onToggleSearchBar:z.onToggleSearchBar,onToggleMegaMenu:z.onToggleMegaMenu,onToggleKioskMode:z.onToggleKioskMode}))),a.createElement("main",{className:Pe,id:"pageContent"},a.createElement("div",{className:K.panes},te.layout===Wo.Q.Standard&&te.sectionNav&&a.createElement(qm,{model:te.sectionNav}),a.createElement("div",{className:K.pageContainer},U))),!te.chromeless&&a.createElement(a.Fragment,null,a.createElement(id,{searchBarHidden:fe,onClose:()=>z.setMegaMenu(!1)}),a.createElement(hl,null)))}const yf=U=>{const K=U.isDark?"0 0.6px 1.5px rgb(0 0 0), 0 2px 4px rgb(0 0 0 / 40%), 0 5px 10px rgb(0 0 0 / 23%)":"0 4px 8px rgb(0 0 0 / 4%)";return{content:(0,Q.css)({display:"flex",flexDirection:"column",paddingTop:kr.$*2,flexGrow:1,height:"100%"}),contentNoSearchBar:(0,Q.css)({paddingTop:kr.$}),contentChromeless:(0,Q.css)({paddingTop:0}),topNav:(0,Q.css)({display:"flex",position:"fixed",zIndex:U.zIndex.navbarFixed,left:0,right:0,boxShadow:K,background:U.colors.background.primary,flexDirection:"column",borderBottom:`1px solid ${U.colors.border.weak}`}),panes:(0,Q.css)({label:"page-panes",display:"flex",height:"100%",width:"100%",flexGrow:1,minHeight:0,flexDirection:"column",[U.breakpoints.up("md")]:{flexDirection:"row"}}),pageContainer:(0,Q.css)({label:"page-container",flexGrow:1,minHeight:0,minWidth:0}),skipLink:(0,Q.css)({position:"absolute",top:-1e3,":focus":{left:U.spacing(1),top:U.spacing(1),zIndex:U.zIndex.portal}})}};var jo=e(33877),Dd=e(4021),Co=e(73807),Cd=e(19559);function Pf({appNotification:U,onClearNotification:K}){const z=(0,Be.wW)(Df);(0,Cd.Z)(()=>{setTimeout(()=>{K(U.id)},Cn.timeoutMap[U.severity])});const te=U.component||U.text||U.traceId;return a.createElement($s.b,{severity:U.severity,title:U.title,onRemove:()=>K(U.id),elevated:!0},te&&a.createElement("div",{className:z.wrapper},a.createElement("span",null,U.component||U.text),U.traceId&&a.createElement("span",{className:z.trace},"Trace ID: ",U.traceId)))}function Df(U){return{wrapper:(0,Q.css)({display:"flex",flexDirection:"column"}),trace:(0,Q.css)({fontSize:U.typography.pxToRem(10)})}}function bd(){const U=(0,Cn.useSelector)(fe=>(0,Dd.vo)(fe.appNotifications)),K=(0,Cn.useDispatch)(),z=(0,Be.wW)(Md);(0,a.useEffect)(()=>{wa.Z.on(io.SI.alertWarning,fe=>K((0,jo.$l)((0,Co.ZR)(...fe)))),wa.Z.on(io.SI.alertSuccess,fe=>K((0,jo.$l)((0,Co.AT)(...fe)))),wa.Z.on(io.SI.alertError,fe=>K((0,jo.$l)((0,Co.t_)(...fe))))},[K]);const te=fe=>{K((0,jo.ad)(fe))};return a.createElement("div",{className:z.wrapper},a.createElement(Xt.wc,null,U.map((fe,Pe)=>a.createElement(Pf,{key:`${fe.id}-${Pe}`,appNotification:fe,onClearNotification:te}))))}function Md(U){return{wrapper:(0,Q.css)({label:"app-notifications-list",zIndex:U.zIndex.portal,minWidth:400,maxWidth:600,position:"fixed",right:6,top:88})}}var Cf=e(75475),gp=e.n(Cf),Tl=e(13431);function bf({error:U,errorInfo:K}){const z=(0,Us.TH)(),te=U?.name==="ChunkLoadError";return(0,a.useEffect)(()=>{te&&z.search.indexOf("chunkNotFound")===-1&&(window.location.href=x.u.getUrlForPartial(z,{chunkNotFound:!0}))},[z,te]),a.createElement(Fs.T,{navId:"error",layout:Wo.Q.Canvas},a.createElement("div",{className:Mf()},te&&a.createElement("div",null,a.createElement("h2",null,"Unable to find application file"),a.createElement("br",null),a.createElement("h2",{className:"page-heading"},"Grafana has likely been updated. Please try reloading the page."),a.createElement("br",null),a.createElement("div",{className:"gf-form-group"},a.createElement(re.zx,{size:"md",variant:"secondary",icon:"repeat",onClick:()=>window.location.reload()},"Reload")),a.createElement(Tl.X,{title:"Error details",error:U,errorInfo:K})),!te&&a.createElement(Tl.X,{title:"An unexpected error happened",error:U,errorInfo:K})))}const Mf=(0,De.B)(()=>(0,Q.css)` width: 500px; margin: 64px auto; `);function xf(){const U=(0,Be.wW)(Qo);return a.createElement("div",{className:U.loadingPage},a.createElement(Pr.u,{text:"Loading..."}))}const Qo=()=>({loadingPage:(0,Q.css)({height:"100%",flexDrection:"column",display:"flex",justifyContent:"center",alignItems:"center"})});function Sf(U){const{chrome:K,keybindings:z}=(0,_o.p)();return K.setMatchedRoute(U.route),(0,a.useLayoutEffect)(()=>{z.clearAndInitGlobalBindings(U.route)},[z,U.route]),(0,a.useEffect)(()=>(xd(U.route),Sd(),(0,A.GQ)("GrafanaRoute",!1,"Mounted",U.match),()=>{(0,A.GQ)("GrafanaRoute",!1,"Unmounted",U.route),xd(U.route,!0)}),[]),(0,a.useEffect)(()=>{Sd(),(0,$r.sm)(),(0,A.GQ)("GrafanaRoute",!1,"Updated",U)}),(0,A.GQ)("GrafanaRoute",!1,"Rendered",U.route),a.createElement(cc.SV,null,({error:te,errorInfo:fe})=>te?a.createElement(bf,{error:te,errorInfo:fe}):a.createElement(a.Suspense,{fallback:a.createElement(xf,null)},a.createElement(U.route.component,{...U,queryParams:(0,A.Ox)(U.location.search)})))}function Tf(U){return U.pageClass?U.pageClass.split(" "):[]}function xd(U,K=!1){for(const z of Tf(U))K?document.body.classList.remove(z):document.body.classList.add(z)}function Sd(){document.body.classList.remove("sidemenu-open--xs");const U=document.getElementById("tooltip");U?.parentElement?.removeChild(U);const K=document.querySelectorAll(".tooltip");for(let z=0;z<K.length;z++){const te=K[z];te.parentElement?.removeChild(te)}for(const z of gp().drops)z.destroy()}var Ol=e(94547),Td=e(43685);class Of extends a.PureComponent{constructor(){super(...arguments),this.styles=If(n.config.theme2),this.state={},this.initListener=()=>{const K=(0,Td.gj)();K&&(this.subscription=K.getConnectionState().subscribe({next:z=>{this.setState({show:!z})}}))}}componentDidMount(){}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}render(){const{show:K}=this.state;return K?!es.contextSrv.isSignedIn||!n.config.liveEnabled||es.contextSrv.user.orgRole===""?null:a.createElement("div",{className:this.styles.foot},a.createElement($s.b,{severity:"warning",className:this.styles.warn,title:"connection to server is lost..."})):null}}const If=(0,De.B)(U=>({foot:(0,Q.css)` position: absolute; bottom: 0px; left: 0px; right: 0px; z-index: 10000; cursor: wait; margin: 16px; `,warn:(0,Q.css)` max-width: 400px; margin: auto; `}));let Il=[],Od=[];function pp(U){Il.push(U)}function hp(U){Od.push(U)}class Rf extends a.Component{constructor(K){super(K),this.renderRoute=z=>{const te=z.roles?z.roles():[];return a.createElement(lc.CompatRoute,{exact:z.exact===void 0?!0:z.exact,sensitive:z.sensitive===void 0?!1:z.sensitive,path:z.path,key:z.path,render:fe=>te?.length&&!te.some(Pe=>es.contextSrv.hasRole(Pe))?a.createElement(Us.l_,{to:"/"}):a.createElement(Sf,{...fe,route:z})})},this.state={}}async componentDidMount(){await Pm(),this.setState({ready:!0}),$(".preloader").remove()}renderRoutes(){return a.createElement(Us.rs,null,gm().map(K=>this.renderRoute(K)))}render(){const{app:K}=this.props,{ready:z}=this.state;(0,A.GQ)("AppWrapper",!1,"rendering");const te=fe=>{(0,$r.ff)("command_palette_action_selected",{actionId:fe.id,actionName:fe.name})};return a.createElement(qa.Provider,{store:_a.h},a.createElement(cc.z4,{style:"page"},a.createElement(_o.h.Provider,{value:K.context},a.createElement(Ol.f,{value:n.config.theme2},a.createElement(bs.KBarProvider,{actions:[],options:{enableHistory:!0,callbacks:{onSelectAction:te}}},a.createElement(Eo.$i,null,a.createElement(Mu.n,null),a.createElement("div",{className:"grafana-app"},a.createElement(Us.F0,{history:A.E1.getHistory()},a.createElement(lc.CompatRouter,null,a.createElement(Mi,null,Od.map((fe,Pe)=>a.createElement(fe,{key:Pe.toString()})),a.createElement(Hs,null),a.createElement(bd,null),z&&this.renderRoutes(),Il.map((fe,Pe)=>a.createElement(fe,{key:Pe.toString()})))))),a.createElement(Of,null),a.createElement(Eo.Y0,null),a.createElement(xu.lO,null)))))))}}var Id=e(65217),Af=e(88646),Rl=e(56812);function Lf(U,K){if(U===K)return!0;if(!(U instanceof Object)||!(K instanceof Object))return!1;const z=Object.keys(U),te=z.length;for(let fe=0;fe<te;fe++)if(!(z[fe]in K))return!1;for(let fe=0;fe<te;fe++)if(U[z[fe]]!==K[z[fe]])return!1;return te===Object.keys(K).length}class Al{constructor(){this.searchBarStorageKey="SearchBar_Hidden",this.routeChangeHandled=!0,this.state=new Af.X({chromeless:!0,sectionNav:{node:{text:(0,Aa.t)("nav.home.title","Home")},main:{text:""}},searchBarHidden:Rl.Z.getBool(this.searchBarStorageKey,!1),kioskMode:null,layout:Wo.Q.Canvas}),this.onToggleMegaMenu=()=>{const K=!this.state.getValue().megaMenuOpen;(0,$r.ff)("grafana_toggle_menu_clicked",{action:K?"open":"close"}),this.update({megaMenuOpen:K})},this.setMegaMenu=K=>{this.update({megaMenuOpen:K})},this.onToggleSearchBar=()=>{const{searchBarHidden:K,kioskMode:z}=this.state.getValue(),te=!K;Rl.Z.set(this.searchBarStorageKey,te),z&&A.E1.partial({kiosk:null}),this.update({searchBarHidden:te,kioskMode:null})},this.onToggleKioskMode=()=>{const K=this.getNextKioskMode();this.update({kioskMode:K}),A.E1.partial({kiosk:this.getKioskUrlValue(K)})}}setMatchedRoute(K){this.currentRoute!==K&&(this.currentRoute=K,this.routeChangeHandled=!1)}update(K){const z=this.state.getValue(),te={...z};this.routeChangeHandled||(te.actions=void 0,te.pageNav=void 0,te.sectionNav={node:{text:(0,Aa.t)("nav.home.title","Home")},main:{text:""}},te.chromeless=this.currentRoute?.chromeless,te.layout=Wo.Q.Standard,this.routeChangeHandled=!0),Object.assign(te,K),te.chromeless=te.kioskMode===Cn.KioskMode.Full||this.currentRoute?.chromeless,this.ignoreStateUpdate(te,z)||this.state.next(te)}ignoreStateUpdate(K,z){return!!(Lf(K,z)||(K.sectionNav!==z.sectionNav||K.pageNav!==z.pageNav)&&K.actions===z.actions&&K.layout===z.layout&&Ll(K.sectionNav.node,z.sectionNav.node)&&Ll(K.pageNav,z.pageNav))}useState(){return(0,Id.Z)(this.state,this.state.getValue())}exitKioskMode(){this.update({kioskMode:void 0}),A.E1.partial({kiosk:null})}setKioskModeFromUrl(K){switch(K){case"tv":this.update({kioskMode:Cn.KioskMode.TV});break;case"1":case!0:this.update({kioskMode:Cn.KioskMode.Full})}}getKioskUrlValue(K){switch(K){case Cn.KioskMode.TV:return"tv";case Cn.KioskMode.Full:return!0;default:return null}}getNextKioskMode(){const{kioskMode:K,searchBarHidden:z}=this.state.getValue();return z||K===Cn.KioskMode.TV?(wa.Z.emit(io.SI.alertSuccess,[(0,Aa.t)("navigation.kiosk.tv-alert","Press ESC to exit kiosk mode")]),Cn.KioskMode.Full):K?null:Cn.KioskMode.TV}}function Ll(U,K){if(U===K)return!0;const z=U?.children?.find(fe=>fe.active),te=K?.children?.find(fe=>fe.active);return U?.text===K?.text&&U?.url===K?.url&&z?.url===te?.url&&Ll(U?.parentItem,K?.parentItem)}var Bl=e(53035);function Bf({actions:U,children:K,info:z,pageNav:te,layout:fe,renderTitle:Pe,subTitle:Ne}){const Je=(0,a.useContext)(ll.v);return a.createElement(Fs.T,{navModel:Je.sectionNav,pageNav:te,layout:fe,actions:U,renderTitle:Pe,info:z,subTitle:Ne},a.createElement(Fs.T.Contents,null,K))}var Rd=e(78968);function Ad(U){const K=U.target instanceof Element&&Uf(U.target);if(!(U.ctrlKey||U.metaKey||U.defaultPrevented)&&K){let z=K.getAttribute("href");const te=K.getAttribute("target");if(z&&!te){const fe=Rd.Cj.parseKeyValue(z.split("?")[1]),Pe=fe.orgId&&Number(fe.orgId)!==Y.config.bootData.user.orgId;if((0,A.GQ)("utils",!1,"intercepting link click",U),U.preventDefault(),z=x.u.stripBaseFromUrl(z),z[0]!=="/"||Pe)if(z.indexOf("://")>0||z.indexOf("mailto:")===0||Pe){window.location.href=z;return}else if(z.indexOf("#")===0){window.location.hash=z;return}else z=`/${z}`;A.E1.push(z)}}}function Uf(U){for(;U!==null&&U.tagName;){if(U.tagName.toUpperCase()==="A")return U;U=U.parentElement}return null}var Nf=e(22377);function wf(U,...K){const z=(0,qa.connect)(...K)(U);return te=>a.createElement(z,{...te,store:_a.h})}function Wf(U,...K){const z=(0,qa.connect)(...K)(U);return te=>a.createElement(qa.Provider,{store:_a.h},a.createElement(z,{...te,store:_a.h}))}const Yo=Wf(U=>a.createElement(a.Fragment,null,a.createElement(Eo.$i,{...U},a.createElement(Eo.Y0,null))));class Ff{constructor(){this.reactModalRoot=document.body,this.reactModalNode=document.createElement("div"),this.root=(0,C.s)(this.reactModalNode),this.onReactModalDismiss=()=>{this.root.render(null),this.reactModalRoot.removeChild(this.reactModalNode)}}init(){wa.Z.subscribe(Ys.VJ,K=>this.showConfirmModal(K.payload)),wa.Z.subscribe(Ys.Dn,K=>this.showModalReact(K.payload)),wa.Z.subscribe(V.EK,K=>(0,Nf.bY)(K.payload))}showModalReact(K){const{component:z,props:te}=K,fe={component:z,props:{...te,isOpen:!0,onDismiss:this.onReactModalDismiss}},Pe=a.createElement((0,Ol.E)(Yo,n.config.theme2),fe);this.reactModalRoot.appendChild(this.reactModalNode),this.root.render(Pe)}showConfirmModal(K){const{confirmText:z,onConfirm:te=()=>{},onDismiss:fe,text2:Pe,altActionText:Ne,onAltAction:Je,noText:ot,text:lt,text2htmlBind:vt,yesText:Ut="Yes",icon:Zt,title:nn="Confirm",yesButtonVariant:gn}=K,bn={confirmText:Ut,confirmButtonVariant:gn,confirmationText:z,icon:Zt,title:nn,body:lt,description:Pe&&vt?t.QX.sanitize(Pe):Pe,isOpen:!0,dismissText:ot,onConfirm:()=>{te(),this.onReactModalDismiss()},onDismiss:()=>{fe?.(),this.onReactModalDismiss()},onAlternative:Je?()=>{Je(),this.onReactModalDismiss()}:void 0,alternativeText:Ne},Kn={component:yo.s,props:bn},ja=a.createElement((0,Ol.E)(Yo,n.config.theme2),Kn);this.reactModalRoot.appendChild(this.reactModalNode),this.root.render(ja)}}var bo=e(45937),Ld=e(12343),Kf=e(46414);function xi(U,K=!1){return new Promise(z=>{const te=document.createElement("script");te.onload=z,te.src=U,te.async=K,document.head.appendChild(te)})}const Bd=(0,Ld.h)("EchoSrv"),Ud=Bd.logger;(0,Kf.x)("echo",void 0,Bd);class Ks{constructor(K){this.config={flushInterval:1e4,debug:!1},this.backends=[],this.flush=()=>{for(const z of this.backends)z.flush()},this.addBackend=z=>{Ud("Adding backend",!1,z),this.backends.push(z)},this.addEvent=(z,te)=>{const fe=this.getMeta(),Pe={...z,meta:{...fe,...te}};for(const Ne of this.backends)(Ne.supportedEvents.length===0||Ne.supportedEvents.indexOf(Pe.type)>-1)&&Ne.addEvent(Pe);Ud("Reporting event",!1,Pe)},this.getMeta=()=>({sessionId:"",userId:es.contextSrv.user.id,userLogin:es.contextSrv.user.login,userSignedIn:es.contextSrv.user.isSignedIn,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,...K},setInterval(this.flush,this.config.flushInterval)}}const Ul=(U,K)=>{(0,k.RP)().addEvent({type:k.ee.Performance,payload:{name:U,value:K}})},jp=U=>faro?.api?.pushError(U);class Zo{constructor(K){this.options=K,this.buffer=[],this.supportedEvents=[k.ee.Performance],this.addEvent=z=>{this.buffer.push(z.payload)},this.flush=()=>{this.buffer.length!==0&&(bo.ae.post("/api/frontend-metrics",{events:this.buffer}),this.buffer=[])}}}var Mo=e(9175);class Vf{constructor(K){this.options=K,this.supportedEvents=[k.ee.Pageview,k.ee.Interaction],this.addEvent=fe=>{window.applicationInsights&&((0,Mo.Si)(fe)&&window.applicationInsights.trackPageView?.(),(0,Mo.fV)(fe)&&window.applicationInsights.trackEvent?.({name:fe.payload.interactionName,properties:fe.payload.properties}))},this.flush=()=>{};const z={config:{connectionString:K.connectionString,endpointUrl:K.endpointUrl}};xi("https://js.monitor.azure.com/scripts/b/ai.2.min.js").then(()=>{const fe=new window.Microsoft.ApplicationInsights.ApplicationInsights(z);window.applicationInsights=fe.loadAppInsights()})}}class Nd{constructor(K){this.options=K,this.supportedEvents=[k.ee.Pageview],this.googleAnalytics4SendManualPageViews=!1,this.addEvent=fe=>{window.gtag&&this.googleAnalytics4SendManualPageViews&&window.gtag("event","page_view",{page_path:fe.payload.page})},this.flush=()=>{};const z=`https://www.googletagmanager.com/gtag/js?id=${K.googleAnalyticsId}`;xi(z,!0),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date);const te={page_path:window.location.pathname};K.user&&(te.user_id=K.user.analytics.identifier),this.googleAnalytics4SendManualPageViews=K.googleAnalytics4SendManualPageViews,window.gtag("config",K.googleAnalyticsId,te)}}class $f{constructor(K){this.options=K,this.supportedEvents=[k.ee.Pageview],this.trackedUserId=null,this.addEvent=fe=>{if(!window.ga)return;window.ga("set",{page:fe.payload.page}),window.ga("send","pageview");const{userSignedIn:Pe,userId:Ne}=fe.meta;Pe&&Ne!==this.trackedUserId&&(this.trackedUserId=Ne,window.ga("set","userId",Ne))},this.flush=()=>{};const z=`https://www.google-analytics.com/analytics${K.debug?"_debug":""}.js`;xi(z);const te=window.ga=window.ga||function(){(te.q=te.q||[]).push(arguments)};te.l=+new Date,te("create",K.googleAnalyticsId,"auto"),te("set","anonymizeIp",!0)}}class _f{constructor(K){this.options=K,this.supportedEvents=[k.ee.Pageview,k.ee.Interaction,k.ee.ExperimentView],this.addEvent=Pe=>{window.rudderanalytics&&((0,Mo.Si)(Pe)&&window.rudderanalytics.page?.(),(0,Mo.fV)(Pe)&&window.rudderanalytics.track?.(Pe.payload.interactionName,Pe.payload.properties),(0,Mo.mR)(Pe)&&window.rudderanalytics.track?.("experiment_viewed",{experiment_id:Pe.payload.experimentId,experiment_group:Pe.payload.experimentGroup,experiment_variant:Pe.payload.experimentVariant}))},this.flush=()=>{};const z=K.sdkUrl||"https://cdn.rudderlabs.com/v1/rudder-analytics.min.js";xi(z);const te=window.rudderanalytics=[],fe=["load","page","track","identify","alias","group","ready","reset","getAnonymousId","setAnonymousId"];for(let Pe=0;Pe<fe.length;Pe++){const Ne=fe[Pe];te[Ne]=function(Je){return function(){te.push([Je].concat(Array.prototype.slice.call(arguments)))}}(Ne)}if(window.rudderanalytics?.load?.(K.writeKey,K.dataPlaneUrl,{configUrl:K.configUrl}),K.user){const{identifier:Pe,intercomIdentifier:Ne}=K.user.analytics,Je={};Ne&&(Je.Intercom={user_hash:Ne}),window.rudderanalytics?.identify?.(Pe,{email:K.user.email,orgId:K.user.orgId,language:K.user.language,version:K.buildInfo.version,edition:K.buildInfo.edition},Je)}}}var zf=e(96991),Hf=e(2513),kf=e(31581),Gf=e(53826),jf=e(24680),Qf=e(52201),wd=e(95392);class Yf extends wd.d{constructor(){super(...arguments),this.name="EchoSrvTransport",this.version=n.config.buildInfo.version}send(K){(0,k.RP)().addEvent({type:k.ee.GrafanaJavascriptAgent,payload:K})}isBatched(){return!0}getIgnoreUrls(){return[]}}class Zf{constructor(K){this.options=K,this.supportedEvents=[k.ee.GrafanaJavascriptAgent],this.addEvent=fe=>{this.transports.forEach(Pe=>Pe.send(fe.payload))},this.flush=()=>{};const z=[];this.transports=[],K.customEndpoint&&this.transports.push(new zf.V({url:K.customEndpoint,apiKey:K.apiKey})),K.errorInstrumentalizationEnabled&&z.push(new Hf.w),K.consoleInstrumentalizationEnabled&&z.push(new kf.J),K.webVitalsInstrumentalizationEnabled&&z.push(new Gf.P);const te={globalObjectKey:K.globalObjectKey||"faro",preventGlobalExposure:K.preventGlobalExposure||!1,app:{version:K.buildInfo.version,environment:K.buildInfo.env},instrumentations:z,transports:[new Yf],ignoreErrors:["ResizeObserver loop limit exceeded","ResizeObserver loop completed","Non-Error exception captured with keys"],metas:[...jf.i,{session:{id:(Math.random()+1).toString(36).substring(2)}}]};this.faroInstance=(0,Qf.p)(te),K.user&&this.faroInstance.api.setUser({id:K.user.id,attributes:{orgId:String(K.user.orgId)||""}})}}var Jf=e(64044),Si=e.n(Jf),Wd=e(42580),vp=e(49681),Xf=e(89024),qf=e(37778),eg=e(19067);function Nl(U){return()=>{const K=document.querySelectorAll(":hover");for(let z=K.length-1;z>0;z--){const te=K[z];te instanceof HTMLElement&&te.dataset?.panelid&&U(parseInt(te.dataset?.panelid,10))}}}class tg{constructor(K,z){this.locationService=K,this.chromeService=z}clearAndInitGlobalBindings(K){Si().reset(),K.chromeless||(this.bind(["?","h"],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,lo.X)(!1)),this.bind("c r",()=>(0,lo.X)(!0))}bindGlobalEsc(){this.bindGlobal("esc",this.globalEsc)}globalEsc(){const z=document.activeElement;if(!(document.querySelectorAll(".slate-typeahead--open").length>0)){if(z&&z instanceof HTMLElement&&(z.nodeName==="INPUT"||z.nodeName==="TEXTAREA"||z.hasAttribute("data-slate-editor"))){z.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.Z.publish(new Ys.Dn({component:vi.B}))}exit(){const K=this.locationService.getSearchObject();if(K.editview){this.locationService.partial({editview:null,editIndex:null});return}if(K.inspect){this.locationService.partial({inspect:null,inspectTab:null});return}if(K.editPanel){this.locationService.partial({editPanel:null,tab:null});return}if(K.viewPanel){this.locationService.partial({viewPanel:null,tab:null});return}const{kioskMode:z}=this.chromeService.state.getValue();z&&this.chromeService.exitKioskMode(),K.search&&this.closeSearch()}showDashEditView(){this.locationService.partial({editview:"settings"})}bind(K,z){Si().bind(K,te=>{te.preventDefault(),te.stopPropagation(),te.returnValue=!1,z.call(this)},"keydown")}bindGlobal(K,z){Si().bindGlobal(K,te=>{te.preventDefault(),te.stopPropagation(),te.returnValue=!1,z.call(this)},"keydown")}unbind(K,z){Si().unbind(K,z)}bindWithPanelId(K,z){this.bind(K,Nl(z))}setupTimeRangeBindings(K=!0){this.bind("t a",()=>{wa.Z.publish(new Ys.QI({updateUrl:K}))}),this.bind("t z",()=>{wa.Z.publish(new Ys.p8({scale:2,updateUrl:K}))}),this.bind("ctrl+z",()=>{wa.Z.publish(new Ys.p8({scale:2,updateUrl:K}))}),this.bind("t left",()=>{wa.Z.publish(new Ys.Qt({direction:Ys.Im.Left,updateUrl:K}))}),this.bind("t right",()=>{wa.Z.publish(new Ys.Qt({direction:Ys.Im.Right,updateUrl:K}))})}setupDashboardBindings(K){this.bind("mod+o",()=>{K.graphTooltip=(K.graphTooltip+1)%3,K.events.publish(new io.oi),K.startRefresh()}),this.bind("mod+s",()=>{K.meta.canSave&&wa.Z.publish(new Ys.Dn({component:qf.d,props:{dashboard:K}}))}),this.setupTimeRangeBindings(),this.bindWithPanelId("e",z=>{if(K.canEditPanelById(z)){const te=this.locationService.getSearchObject().editPanel!==void 0;this.locationService.partial({editPanel:te?null:z})}}),this.bindWithPanelId("v",z=>{const te=this.locationService.getSearchObject().viewPanel!==void 0;this.locationService.partial({viewPanel:te?null:z})}),this.bindWithPanelId("p l",z=>{const te=K.getPanelById(z),fe={...te.options};fe.legend.showLegend?fe.legend.showLegend=!1:fe.legend.showLegend=!0,te.updateOptions(fe)}),this.bindWithPanelId("i",z=>{this.locationService.partial({inspect:z})}),La.Vt.hasAccessToExplore()&&this.bindWithPanelId("p x",async z=>{const te=K.getPanelById(z),fe=await(0,Xf.H6)({panel:te,datasourceSrv:(0,m.ak)(),timeSrv:(0,ls.$t)()});if(fe){const Pe=x.u.stripBaseFromUrl(fe);Pe&&this.locationService.push(Pe)}}),this.bindWithPanelId("p r",z=>{K.canEditPanelById(z)&&!(K.panelInView||K.panelInEdit)&&wa.Z.publish(new Ys.Eb(z))}),this.bindWithPanelId("p d",z=>{if(K.canEditPanelById(z)){const te=K.getPanelInfoById(z).index;K.duplicatePanel(K.panels[te])}}),this.bindWithPanelId("p s",z=>{const te=K.getPanelInfoById(z);wa.Z.publish(new Ys.Dn({component:eg.ShareModal,props:{dashboard:K,panel:te?.panel}}))}),this.bind("d l",()=>{K.toggleLegendsForAll()}),this.bind("d x",()=>{K.toggleExemplarsForAll()}),this.bind("d shift+c",()=>{K.collapseRows()}),this.bind("d shift+e",()=>{K.expandRows()}),this.bind("d n",()=>{this.locationService.push("/dashboard/new")}),this.bind("d r",()=>{K.startRefresh()}),this.bind("d s",()=>{this.showDashEditView()}),this.bind("d k",()=>{this.chromeService.onToggleKioskMode()}),this.bind("d a",()=>{const te=this.locationService.getSearchObject().autofitpanels?"":"&autofitpanels";window.location.href=window.location.href+te})}}function wl(U){if(performance)try{performance.mark(`${U}_started`)}catch(K){console.error(`[Metrics] Failed to startMeasure ${U}`,K)}}function Jo(U){if(performance)try{const K=`${U}_started`,z=`${U}_completed`,te=`${U}_measured`;performance.mark(z);const fe=performance.measure(te,K,z);Ul(`${U}_ms`,fe.duration),performance.clearMarks(K),performance.clearMarks(z),performance.clearMeasures(te)}catch(K){console.error(`[Metrics] Failed to stopMeasure ${U}`,K)}}async function ng(){if(window.location.search.indexOf("why-render")!==-1){const{default:U}=await e.e(1107).then(e.t.bind(e,34990,23));U(React,{trackAllPureComponents:!0})}}var ag=e(12352),Wl=e(87909),sg=e(59281),rg=e(22575),og=e(29364),Xo=e(85907),ig=e(54459),lg=e(85202),cg=e(42575);const dg=()=>new cg.q(new URL(e.p+e.u(4282),e.b));var ug=e(48592),Fl=e(90996);const mg=U=>new ug.y(K=>{const z=U.subscribe(Xo.sj(te=>{K.next(te)}),Xo.sj(te=>{K.error(te)}),Xo.sj(()=>{K.complete()}));return{unsubscribe:()=>{z.then(te=>te.unsubscribe())}}}),Kl=U=>(0,_s.D)(U).pipe((0,Fl.w)(K=>mg(K)));class fg{constructor(K){this.getConnectionState=()=>Kl(this.centrifugeWorker.getConnectionState()),this.getDataStream=z=>Kl(this.centrifugeWorker.getDataStream(z)).pipe((0,ig.Q)(lg.z)),this.getQueryData=async z=>{const te=JSON.parse(JSON.stringify(z));return this.centrifugeWorker.getQueryData(te)},this.getPresence=z=>this.centrifugeWorker.getPresence(z),this.getStream=z=>Kl(this.centrifugeWorker.getStream(z)),this.centrifugeWorker=Xo.Ud(dg()),this.centrifugeWorker.initialize(K,Xo.sj(K.dataStreamSubscriberReadiness))}}var Fd=e(47838),gg=e(81087),pg=e(35306),Kd=e(42751),Ti=e(87755);class hg{constructor(K){this.deps=K,this.getConnectionState=()=>this.deps.centrifugeSrv.getConnectionState(),this.getDataStream=z=>{let te;const fe=Pe=>{const Ne=Pe.data[0];if(!te&&!(0,Ti.A1)(Ne,Ti.g0.FullFrame)){console.warn(`expected first packet to contain a full frame, received ${Ne?.type}`);return}switch(Ne.type){case Ti.g0.FullFrame:{te=Fd.Av.deserialize(Ne.frame);return}case Ti.g0.NewValuesSameSchema:{te.pushNewValues(Ne.values);return}}};return this.deps.centrifugeSrv.getDataStream(z).pipe((0,Nt.U)(Pe=>(fe(Pe),{...Pe,data:[te??Fd.Av.empty()]})))},this.getStream=z=>this.deps.centrifugeSrv.getStream(z),this.getQueryData=z=>(0,_s.D)(this.deps.centrifugeSrv.getQueryData(z)).pipe((0,Fl.w)(te=>{const fe=(0,pg.z1)(te,z.request.targets);return fe.data?.length&&fe.data.find(Ne=>Ne.meta?.channel)?(0,Kd.B9)(fe,z.request,Kd.PI):(0,wt.of)(fe)})),this.publish=async(z,te)=>this.deps.backendSrv.post("api/live/publish",{channel:(0,gg.Aj)(z),data:te}),this.getPresence=z=>this.deps.centrifugeSrv.getPresence(z)}}function vg(){const U={appUrl:`${window.location.origin}${n.config.appSubUrl}`,orgId:es.contextSrv.user.orgId,orgRole:es.contextSrv.user.orgRole,liveEnabled:n.config.liveEnabled,dataStreamSubscriberReadiness:Wl.A.ok.asObservable(),grafanaAuthToken:(0,sg.v)()},K=n.config.featureToggles["live-service-web-worker"]?new fg(U):new rg.R(U);(0,Td.cA)(new hg({centrifugeSrv:K,backendSrv:(0,O.i)()}))}function Ep(){return getGrafanaLiveSrv()}var Oi=e(55905),Eg=e(24084),ys=e(63245);function yp(U,K="extension is not a link extension"){if(!isPluginExtensionLink(U))throw new Error(K)}function Pp(U,K="extension is not a command extension config"){if(!isPluginExtensionLinkConfig(U))throw new Error(K)}function Vd(U,K){if(!$l(U,K))throw new Error(`Invalid link extension. The "path" is required and should start with "/a/${U}/" (currently: "${K}"). Skipping the extension.`)}function $d(U){if(!_l(U))throw new Error('Invalid component extension, the "component" property needs to be a valid React component.')}function _d(U){if(!Cp(U))throw new Error(`Invalid extension "${U.title}". The extensionPointId should start with either "grafana/" or "plugins/" (currently: "${U.extensionPointId}"). Skipping the extension.`)}function Vl(U){if(!yg(U))throw new Error(`Invalid extension "${U.title}". The "configure" property must be a function. Skipping the extension.`)}function Dr(U,K){for(const z of K)if(!Pg(U[z]))throw new Error(`Invalid extension "${U.title}". Property "${z}" must be a string and cannot be empty. Skipping the extension.`)}function Dp(U,K="The provided value is a Promise."){if(Hd(U))throw new Error(K)}function $l(U,K){return!!(typeof K=="string"&&K.length>0&&K.startsWith(`/a/${U}/`))}function Cp(U){return!!(U.extensionPointId?.startsWith("grafana/")||U.extensionPointId?.startsWith("plugins/"))}function yg(U){return U.configure?typeof U.configure=="function":!0}function Pg(U){return typeof U=="string"&&U.length>0}function zd(U,K){try{if(Dr(K,["title","description","extensionPointId"]),_d(K),(0,ys.IX)(K)){if(Vl(K),!K.path&&!K.onClick)return(0,ys.KE)(`Invalid extension "${K.title}". Either "path" or "onClick" is required.`),!1;K.path&&Vd(U,K.path)}return(0,ys.eP)(K)&&$d(K.component),!0}catch(z){return z instanceof Error&&(0,ys.KE)(z.message),!1}}function Hd(U){return U instanceof Promise||typeof U=="object"&&U!==null&&"then"in U&&"catch"in U}function _l(U){return typeof U=="function"}function Dg(U){const K={};for(const{pluginId:z,extensionConfigs:te,error:fe}of U){if(fe){(0,ys.KE)(`"${z}" plugin failed to load, skip registering its extensions.`);continue}for(const Pe of te){const{extensionPointId:Ne}=Pe;if(!Pe||!zd(z,Pe))continue;let Je={config:Pe,pluginId:z};Array.isArray(K[Ne])?K[Ne].push(Je):K[Ne]=[Je]}}return(0,ys._A)(K)}var Ii=e(15766),kd=e(46181),Cg=e(80219);function bg(){try{return[(0,ys.CR)({title:"Add to dashboard",description:"Use the query and panel from explore and create/add it to a dashboard",extensionPointId:Ii.y.ExploreToolbarAction,icon:"apps",category:"Dashboards",configure:()=>{if(La.Vt.hasAccess(Cn.AccessControlAction.DashboardsCreate,La.Vt.isEditor)||La.Vt.hasAccess(Cn.AccessControlAction.DashboardsWrite,La.Vt.isEditor))return{}},onClick:(U,{context:K,openModal:z})=>{z({title:(0,Cg.k)(),body:({onDismiss:te})=>a.createElement(kd.U,{onClose:te,exploreId:K?.exploreId})})}})]}catch(U){return(0,ys.KE)(`Could not configure extensions for Explore due to: "${U}"`),[]}}function Gd(){return[...bg()]}const Mg=({context:U,extensionPointId:K,limitPerPlugin:z,registry:te})=>{const fe=U?(0,ys.fD)(U):{},Pe=te[K]??[],Ne=[],Je={};for(const ot of Pe)try{const lt=ot.config,{pluginId:vt}=ot;if(z&&Je[vt]>=z)continue;if(Je[vt]===void 0&&(Je[vt]=0),(0,ys.IX)(lt)){const Ut=xg(ot.pluginId,lt,fe);if(lt.configure&&Ut===void 0)continue;const Zt={id:(0,ys.lu)(ot.pluginId,lt),type:Ii.D.link,pluginId:ot.pluginId,onClick:jd(lt,fe),icon:Ut?.icon||lt.icon,title:Ut?.title||lt.title,description:Ut?.description||lt.description,path:Ut?.path||lt.path,category:Ut?.category||lt.category};Ne.push(Zt),Je[vt]+=1}if((0,ys.eP)(lt)){$d(lt.component);const Ut={id:(0,ys.lu)(ot.pluginId,lt),type:Ii.D.component,pluginId:ot.pluginId,title:lt.title,description:lt.description,component:lt.component};Ne.push(Ut),Je[vt]+=1}}catch(lt){lt instanceof Error&&(0,ys.KE)(lt.message)}return{extensions:Ne}};function xg(U,K,z){try{const te=K.configure?.(z);if(te===void 0)return;let{title:fe=K.title,description:Pe=K.description,path:Ne=K.path,icon:Je=K.icon,category:ot=K.category,...lt}=te;return Dp(te,`The configure() function for "${K.title}" returned a promise, skipping updates.`),Ne&&Vd(U,Ne),Dr({title:fe,description:Pe},["title","description"]),Object.keys(lt).length>0&&(0,ys.KE)(`Extension "${K.title}", is trying to override restricted properties: ${Object.keys(lt).join(", ")} which will be ignored.`),{title:fe,description:Pe,path:Ne,icon:Je,category:ot}}catch(te){te instanceof Error&&(0,ys.KE)(te.message);return}}function jd(U,K){const{onClick:z}=U;if(z)return function(fe){try{const Pe=z(fe,(0,ys.Ch)(K));Hd(Pe)&&Pe.catch(Ne=>{Ne instanceof Error&&(0,ys.KE)(Ne.message)})}catch(Pe){Pe instanceof Error&&(0,ys.KE)(Pe.message)}}}var Qd=e(59882);async function Sg(U={}){wl("frontend_plugins_preload");const K=Object.values(U).filter(te=>te.preload),z=await Promise.all(K.map(Yd));return Jo("frontend_plugins_preload"),z}async function Yd(U){const{path:K,version:z,id:te}=U;try{wl(`frontend_plugin_preload_${te}`);const{plugin:fe}=await il.N$({path:K,version:z,isAngular:U.angularDetected,pluginId:te}),{extensionConfigs:Pe=[]}=fe;return{pluginId:te,extensionConfigs:Pe}}catch(fe){return console.error(`[Plugins] Failed to preload plugin: ${K} (version: ${z})`,fe),{pluginId:te,extensionConfigs:[],error:fe}}finally{Jo(`frontend_plugin_preload_${te}`)}}var Tg=e(37497),Og=e(775),Ig=e(62247),Rg=e(76305),bp=e(76543),Mp=e(3359),Zd=e(46809);class xp{constructor(){this.subject=new Tg.t(1)}get(){return this.subject.asObservable()}run(K){const{queries:z,timezone:te,datasource:fe,panelId:Pe,app:Ne,dashboardUID:Je,timeRange:ot,timeInfo:lt,cacheTimeout:vt,queryCachingTTL:Ut,maxDataPoints:Zt,scopedVars:nn,minInterval:gn}=K;this.subscription&&this.subscription.unsubscribe();const bn={app:Ne??Ig.zj.Unknown,requestId:(0,bp.t)(),timezone:te,panelId:Pe,dashboardUID:Je,range:ot,timeInfo:lt,interval:"",intervalMs:0,targets:(0,v.cloneDeep)(z),maxDataPoints:Zt,scopedVars:nn||{},cacheTimeout:vt,queryCachingTTL:Ut,startTime:Date.now()};bn.rangeRaw=ot.raw,(0,_s.D)(Sp(fe,bn.scopedVars)).pipe((0,Og.P)()).subscribe({next:Kn=>{bn.targets=bn.targets.map(Qa=>(Qa.datasource||(Qa.datasource=Kn.getRef()),Qa));const ja=gn?(0,zo.J)().replace(gn,bn.scopedVars):Kn.interval,Ra=Rg.calculateInterval(ot,Zt,ja);bn.scopedVars=Object.assign({},bn.scopedVars,{__interval:{text:Ra.interval,value:Ra.interval},__interval_ms:{text:Ra.intervalMs.toString(),value:Ra.intervalMs}}),bn.interval=Ra.interval,bn.intervalMs=Ra.intervalMs,this.subscription=(0,Zd.v7)(Kn,bn).subscribe({next:Qa=>{const Xs=(0,Vn.zR)(Qa,this.lastResult);this.lastResult=(0,Mp.C)(Xs,this.lastResult),this.subject.next(this.lastResult)}})},error:Kn=>console.error("PanelQueryRunner Error",Kn)})}cancel(){this.subscription&&(this.subscription.unsubscribe(),this.lastResult&&this.lastResult.state===Is.Gu.Loading&&this.subject.next({...this.lastResult,state:Is.Gu.Done}))}destroy(){this.subject&&this.subject.complete(),this.subscription&&this.subscription.unsubscribe()}}async function Sp(U,K){return U&&"query"in U?U:(0,m.ak)().get(U,K)}function Tp(){window.grafanaRuntime={getDashboardSaveModel:()=>{const U=(0,p.h4)().getCurrent();if(U)return U.getSaveModelClone()},getDashboardTimeRange:()=>{const U=(0,ls.$t)().timeRange();return{from:U.from.valueOf(),to:U.to.valueOf(),raw:U.raw}},getPanelData:()=>{const U=(0,p.h4)().getCurrent();if(U)return U.panels.reduce((K,z)=>(K[z.id]=z.getQueryRunner().getLastResult(),K),{})}}}var Op=e(55670),Ri=e(41355),Qn=e(81587),Ag=e(17312),Lg=e(53229),Br=e(95774),jr=e(39655);function Bg(U){return U.extended&&"infoText"in U.extended?U.extended:null}function Ug(U){return U.extended&&"dataSourceTypes"in U.extended?U.extended:null}function Jd(U){return U.extended&&"dataSource"in U.extended?U.extended:null}var Ia=e(51824),Ai=e(74030);const Ip=(U,K)=>{const{rootStateKey:z}=K.variable;if(!z)return console.error("AdHocVariableEditor: variable has no rootStateKey"),{extended:Bg(jr.PF)};const{editor:te}=(0,Ia.AE)(z,U);return{extended:Bg(te)}},Rp={changeVariableDatasource:Ai.Z$},Ap=(0,qa.connect)(Ip,Rp);class Lp extends a.PureComponent{constructor(){super(...arguments),this.onDatasourceChanged=K=>{this.props.changeVariableDatasource((0,Qn.yQ)(this.props.variable),(0,Ag.iU)(K))}}componentDidMount(){const{rootStateKey:K}=this.props.variable;if(!K){console.error("AdHocVariableEditor: variable has no rootStateKey");return}}render(){const{variable:K,extended:z}=this.props,te=z?.infoText??null;return a.createElement(a.Fragment,null,a.createElement(Br.e,null,"Ad-hoc options"),a.createElement(Lt.g,{label:"Data source",htmlFor:"data-source-picker"},a.createElement(Lg.q,{current:K.datasource,onChange:this.onDatasourceChanged,width:30,variables:!0,noDefault:!0})),te?a.createElement($s.b,{title:te,severity:"info"}):null)}}const Bp=Ap(Lp);var Up=e(80280);const Np={addFilter:Ai.KJ,removeFilter:Ai.ku,changeFilter:Ai.M6},wp=(0,qa.connect)(null,Np);class Ng extends a.PureComponent{constructor(){super(...arguments),this.addFilter=K=>{this.props.addFilter((0,Qn.yQ)(this.props.variable),K)},this.removeFilter=K=>{this.props.removeFilter((0,Qn.yQ)(this.props.variable),K)},this.changeFilter=(K,z)=>{this.props.changeFilter((0,Qn.yQ)(this.props.variable),{index:K,filter:z})}}render(){const{filters:K,datasource:z}=this.props.variable;return a.createElement(Up.F,{datasource:z,filters:K,disabled:this.props.readOnly,addFilter:this.addFilter,removeFilter:this.removeFilter,changeFilter:this.changeFilter})}}const qo=wp(Ng);qo.displayName="AdHocPicker";var zl=e(26333);const wg=U=>U.map(K=>Gl(K).map(Hl).join("|")),Wg=U=>{if((0,v.isArray)(U))return U.map(Xd).filter(Fg);const K=Xd(U);return K===null?[]:[K]};function Hl(U){return U==null?"":/\|/g[Symbol.replace](U,"__gfp__")}function kl(U){return U==null?"":/__gfp__/g[Symbol.replace](U,"|")}function Gl(U){return[U.key,U.operator,U.value]}function Xd(U){if(!(0,v.isString)(U)||U.length===0)return null;const K=U.split("|").map(kl);return{key:K[0],operator:K[1],value:K[2],condition:""}}function Fg(U){return U!==null&&(0,v.isString)(U.value)}const qd=async()=>{},eu=()=>({id:"adhoc",description:"Add key/value filters on the fly.",name:"Ad hoc filters",initialState:zl.Js,reducer:zl.jo,picker:qo,editor:Bp,dependsOn:()=>!1,setValue:qd,setValueFromUrl:async(U,K)=>{const z=Wg(K);await(0,_a.WI)((0,Ai.Ue)((0,Qn.yQ)(U),z))},updateOptions:qd,getSaveModel:U=>{const{index:K,id:z,state:te,global:fe,rootStateKey:Pe,...Ne}=(0,v.cloneDeep)(U);return Ne},getValueForUrl:U=>{const K=U?.filters??[];return wg(K)}});var Ur=e(33199),tu=e(8430),As=e(80169),as=e(5399),nu=e(69966),au=e(91826),Cr=e(6857),xo=e(56361),fr=e(84677),br=e(24321),Kg=e(56469),Li=e(90581),Vg=e(66117),su=e(8508),os=e(6230),gs=e(4684),Wa=e(1941),So=e(18918);const $g={...os.Eg,type:"query",datasource:null,query:"",regex:"",sort:os.$U.disabled,refresh:os.Bd.onDashboardLoad,multi:!1,includeAll:!1,allValue:null,options:[],current:{},definition:""},_g=(U,K)=>{if(K===os.$U.disabled)return U;const z=Math.ceil(K/2),te=K%2===0;return z===1?U=(0,v.sortBy)(U,"text"):z===2?U=(0,v.sortBy)(U,fe=>{if(!fe.text)return-1;const Pe=fe.text.match(/.*?(\d+).*/);return!Pe||Pe.length<2?-1:parseInt(Pe[1],10)}):z===3&&(U=(0,v.sortBy)(U,fe=>(0,v.toLower)(fe.text))),te&&(U=U.reverse()),U},zg=(U,K)=>{const z=[];let te=null;K.lastIndex=0;do te=K.exec(U),te&&z.push(te);while(K.global&&te&&te[0]!==""&&te[0]!==void 0);return z},Hg=(U,K,z)=>{let te,fe=[];U&&(te=(0,ht.jO)(U));for(let Pe=0;Pe<z.length;Pe++){const Ne=z[Pe];let Je=Ne.text===void 0||Ne.text===null?Ne.value:Ne.text,ot=Ne.value===void 0||Ne.value===null?Ne.text:Ne.value;if((0,v.isNumber)(ot)&&(ot=ot.toString()),(0,v.isNumber)(Je)&&(Je=Je.toString()),te){const lt=zg(ot,te);if(!lt.length)continue;const vt=lt.find(gn=>gn.groups&&gn.groups.value),Ut=lt.find(gn=>gn.groups&&gn.groups.text),Zt=lt.find(gn=>gn.length>1),nn=lt.length>1&&Zt;if(vt||Ut)ot=vt?.groups?.value??Ut?.groups?.text,Je=Ut?.groups?.text??vt?.groups?.value;else if(nn){for(let gn=0;gn<lt.length;gn++){const bn=lt[gn];fe.push({text:bn[1],value:bn[1],selected:!1})}continue}else Zt&&(Je=Zt[1],ot=Zt[1])}fe.push({text:Je,value:ot,selected:!1})}return fe=(0,v.uniqBy)(fe,"value"),_g(fe,K)},To=(0,Ar.oM)({name:"templating/query",initialState:So.s,reducers:{updateVariableOptions:(U,K)=>{const{results:z,templatedRegex:te}=K.payload.data,fe=(0,Ia.ir)(U,K.payload.id);if(fe.type!=="query")return;const{includeAll:Pe,sort:Ne}=fe,Je=Hg(te,Ne,z);Pe&&Je.unshift({text:As.xk,value:As.r2,selected:!1}),Je.length||Je.push({text:As.BH,value:As.QX,isNone:!0,selected:!1}),fe.options=Je}}}),ru=To.reducer,{updateVariableOptions:kg}=To.actions;function Gg(){return U=>U.pipe((0,Nt.U)(K=>{const z=K.series;if(!z||!z.length)return[];if(Yg(z))return z;const te=(0,Vn.F9)(z),fe=[];let Pe=-1,Ne=-1,Je=-1,ot=-1;for(const lt of te)for(let vt=0;vt<lt.fields.length;vt++){const Ut=lt.fields[vt],Zt=(0,oe.CZ)(Ut,lt,z).toLowerCase();Ut.type===se.fS.string&&Je===-1&&(Je=vt),Zt==="text"&&Ut.type===se.fS.string&&Ne===-1&&(Ne=vt),Zt==="value"&&Ut.type===se.fS.string&&Pe===-1&&(Pe=vt),Zt==="expandable"&&(Ut.type===se.fS.boolean||Ut.type===se.fS.number)&&ot===-1&&(ot=vt)}if(Je===-1)throw new Error("Couldn't find any field of type string in the results.");for(const lt of z)for(let vt=0;vt<lt.length;vt++){const Ut=ot!==-1?lt.fields[ot].values[vt]:void 0,Zt=lt.fields[Je].values[vt],nn=Ne!==-1?lt.fields[Ne].values[vt]:null,gn=Pe!==-1?lt.fields[Pe].values[vt]:null;if(Pe===-1&&Ne===-1){fe.push({text:Zt,value:Zt,expandable:Ut});continue}if(Pe===-1&&Ne!==-1){fe.push({text:nn,value:nn,expandable:Ut});continue}if(Pe!==-1&&Ne===-1){fe.push({text:gn,value:gn,expandable:Ut});continue}fe.push({text:nn,value:gn,expandable:Ut})}return fe}))}function jg(U){return K=>K.pipe((0,Nt.U)(z=>{const{variable:te,dispatch:fe,getTemplatedRegexFunc:Pe}=U;if(!te.rootStateKey){console.error("updateOptionsState: variable.rootStateKey is not defined");return}const Ne=Pe(te),Je=(0,Qn.Y6)(te,{results:z,templatedRegex:Ne});fe((0,Wa.mb)(te.rootStateKey,kg(Je)))}))}function Qg(U){return K=>K.pipe((0,Vr.z)(()=>{const{dispatch:z,variable:te,searchFilter:fe}=U;return fe?(0,wt.of)():(0,_s.D)(z((0,gs.xQ)((0,Qn.yQ)(te))))}))}function Yg(U){if(!U)return!1;if(!U.length)return!0;const K=U[0];if((0,Vn.aY)(K))return!1;for(const z in K){if(!K.hasOwnProperty(z)||K[z]!==null&&typeof K[z]!="string"&&typeof K[z]!="number")continue;const te=z.toLowerCase();if(te==="text"||te==="value")return!0}return!1}var Bi=e(79726);class or{constructor(){this.runners=[new Wp,new Zg,new Jg,new jl]}getRunnerForDatasource(K){const z=this.runners.find(te=>te.canRun(K));if(z)return z;throw new Error("Couldn't find a query runner that matches supplied arguments.")}}class Wp{constructor(){this.type=Bi.j2.Legacy}canRun(K){return(0,as.R)(K)}getTarget({datasource:K,variable:z}){if((0,as.R)(K))return z.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:K,variable:z,searchFilter:te,timeSrv:fe},Pe){if(!(0,as.R)(K))return ti();const Ne=(0,Qn.AQ)(z,te,fe);return(0,_s.D)(K.metricFindQuery(z.query,Ne)).pipe((0,Vr.z)(Je=>{if(!Je||!Je.length)return ti();const ot=Je;return(0,wt.of)({series:ot,state:Is.Gu.Done,timeRange:Ne.range})}))}}class Zg{constructor(){this.type=Bi.j2.Standard}canRun(K){return(0,as.Ju)(K)}getTarget({datasource:K,variable:z}){if((0,as.Ju)(K))return K.variables.toDataQuery(z.query);throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:K,runRequest:z},te){return(0,as.Ju)(K)?K.variables.query?z(K,te,K.variables.query):z(K,te):ti()}}class Jg{constructor(){this.type=Bi.j2.Custom}canRun(K){return(0,as.d7)(K)}getTarget({datasource:K,variable:z}){if((0,as.d7)(K))return z.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:K,runRequest:z},te){return(0,as.d7)(K)?z(K,te,K.variables.query):ti()}}const ei="variable-query";class jl{constructor(){this.type=Bi.j2.Datasource}canRun(K){return(0,as.X7)(K)}getTarget({datasource:K,variable:z}){if((0,as.X7)(K))return{...z.query,refId:z.query.refId??ei};throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:K,runRequest:z},te){return(0,as.X7)(K)?z(K,te):ti()}}function ti(){return(0,wt.of)({state:Is.Gu.Done,series:[],timeRange:(0,su.JK)()})}class Xg{constructor(K={dispatch:_a.WI,getState:_a.y0,getVariable:Ia.E0,getTemplatedRegex:Qn.gR,getTimeSrv:ls.$t,queryRunners:new or,runRequest:Zd.v7}){this.dependencies=K,this.updateOptionsRequests=new nu.x,this.updateOptionsResults=new nu.x,this.cancelRequests=new nu.x,this.onNewRequest=this.onNewRequest.bind(this),this.subscription=this.updateOptionsRequests.subscribe(this.onNewRequest)}queueRequest(K){this.updateOptionsRequests.next(K)}getResponse(K){return this.updateOptionsResults.asObservable().pipe((0,xo.h)(z=>z.identifier===K))}cancelRequest(K){this.cancelRequests.next({identifier:K})}destroy(){this.subscription.unsubscribe()}onNewRequest(K){const{datasource:z,identifier:te,searchFilter:fe}=K;try{const{dispatch:Pe,runRequest:Ne,getTemplatedRegex:Je,getVariable:ot,queryRunners:lt,getTimeSrv:vt,getState:Ut}=this.dependencies,Zt=(0,Ia.S_)(Ut());this.updateOptionsResults.next({identifier:te,state:Is.Gu.Loading});const nn=ot(te,Ut());if(nn.type!=="query")return;const gn=vt(),bn={variable:nn,datasource:z,searchFilter:fe,timeSrv:gn,runRequest:Ne},Kn=lt.getRunnerForDatasource(z),ja=Kn.getTarget({datasource:z,variable:nn}),Ra=this.getRequest(nn,K,ja);Kn.runRequest(bn,Ra).pipe((0,xo.h)(()=>{const Qa=(0,Ia.S_)(Ut());return Zt===Qa}),(0,xo.h)(Qa=>Qa.state===Is.Gu.Done||Qa.state===Is.Gu.Error),(0,fr.q)(1),(0,Vr.z)(Qa=>Qa.state===Is.Gu.Error?(0,au._)(()=>Qa.error):(0,wt.of)(Qa)),Gg(),jg({variable:nn,dispatch:Pe,getTemplatedRegexFunc:Je}),Qg({variable:nn,dispatch:Pe,searchFilter:fe}),(0,br.R)((0,Cr.T)(this.updateOptionsRequests,this.cancelRequests).pipe((0,xo.h)(Qa=>{let Xs=!1;return Qa.identifier.id===te.id&&(Xs=!0,this.updateOptionsResults.next({identifier:te,state:Is.Gu.Loading,cancelled:Xs})),Xs}))),(0,Kg.K)(Qa=>Qa.cancelled?(0,wt.of)({}):(this.updateOptionsResults.next({identifier:te,state:Is.Gu.Error,error:Qa}),(0,au._)(()=>Qa))),(0,Li.x)(()=>{this.updateOptionsResults.next({identifier:te,state:Is.Gu.Done})})).subscribe()}catch(Pe){this.updateOptionsResults.next({identifier:te,state:Is.Gu.Error,error:Pe})}}getRequest(K,z,te){const{searchFilter:fe}=z,Pe={variable:{text:K.current.text,value:K.current.value}},ot={...fe?{searchFilter:{text:fe,value:fe}}:{},...Pe},lt=K.refresh===os.Bd.onTimeRangeChanged?this.dependencies.getTimeSrv().timeRange():(0,su.JK)();return{app:Ig.zj.Dashboard,requestId:(0,Vg.Z)(),timezone:"",range:lt,interval:"",intervalMs:0,targets:[te],scopedVars:ot,startTime:Date.now()}}}let ou;function qg(U){ou=U}function Ql(){return ou}const ep=U=>{if(!tp(U))return U.name;const{current:K}=U;return Array.isArray(K.text)?K.text.join(" + "):K.text},tp=U=>Array.isArray(U?.options)||typeof U?.current=="object";var Qr=(U=>(U[U.moveUp=38]="moveUp",U[U.moveDown=40]="moveDown",U[U.select=32]="select",U[U.cancel=27]="cancel",U[U.selectAndClose=13]="selectAndClose",U))(Qr||{});class np extends a.PureComponent{constructor(){super(...arguments),this.onKeyDown=K=>{if(Qr[K.keyCode]&&K.keyCode!==Qr.select){const z=K.ctrlKey||K.metaKey||K.shiftKey;this.props.onNavigate(K.keyCode,z),K.preventDefault()}},this.onChange=K=>{this.props.onChange(K.target.value)}}render(){const{value:K,id:z,onNavigate:te,...fe}=this.props;return a.createElement("input",{...fe,ref:Pe=>{Pe&&(Pe.focus(),Pe.setAttribute("style",`width:${Math.max(Pe.width,150)}px`))},type:"text",className:"gf-form-input",value:K??"",onChange:this.onChange,onKeyDown:this.onKeyDown,placeholder:(0,Aa.t)("variable.dropdown.placeholder","Enter variable value")})}}const ap=({loading:U,disabled:K,onClick:z,text:te,onCancel:fe,id:Pe})=>{const Ne=(0,Be.wW)(sp),Je=(0,a.useCallback)(ot=>{ot.stopPropagation(),ot.preventDefault(),z()},[z]);return U?a.createElement("div",{className:Ne.container,"data-testid":Va.wl.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${te}`),title:te,id:Pe},a.createElement(iu,{text:te}),a.createElement(lu,{onCancel:fe})):a.createElement("button",{onClick:Je,className:Ne.container,"data-testid":Va.wl.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${te}`),"aria-expanded":!1,"aria-controls":`options-${Pe}`,id:Pe,title:te,disabled:K},a.createElement(iu,{text:te}),a.createElement(va.J,{"aria-hidden":!0,name:"angle-down",size:"sm"}))},iu=({text:U})=>{const K=(0,Be.wW)(sp);return a.createElement("span",{className:K.textAndTags},U===As.xk?(0,Aa.t)("variable.picker.link-all","All"):U)},lu=({onCancel:U})=>{const K=(0,a.useCallback)(z=>{z.preventDefault(),U()},[U]);return a.createElement(_r.u,{content:"Cancel query"},a.createElement(va.J,{className:"spin-clockwise",name:"sync",size:"xs",onClick:K,"aria-label":Va.wl.components.LoadingIndicator.icon}))},sp=U=>({container:(0,Q.css)` max-width: 500px; padding-right: 10px; padding: 0 ${U.spacing(1)}; background-color: ${U.components.input.background}; border: 1px solid ${U.components.input.borderColor}; border-radius: ${U.shape.borderRadius(1)}; display: flex; align-items: center; color: ${U.colors.text}; height: ${U.spacing(U.components.height.md)}; .label-tag { margin: 0 5px; } &:disabled { background-color: ${U.colors.action.disabledBackground}; color: ${U.colors.action.disabledText}; border: 1px solid ${U.colors.action.disabledBackground}; } `,textAndTags:(0,Q.css)` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: ${U.spacing(.25)}; user-select: none; `});class Fp extends a.PureComponent{constructor(){super(...arguments),this.onToggle=K=>z=>{const te=z.shiftKey||z.ctrlKey||z.metaKey;this.handleEvent(z),this.props.onToggle(K,te)},this.onToggleAll=K=>{this.handleEvent(K),this.props.onToggleAll()}}handleEvent(K){K.preventDefault(),K.stopPropagation()}render(){const{multi:K,values:z,highlightIndex:te,selectedValues:fe,onToggle:Pe,onToggleAll:Ne,theme:Je,...ot}=this.props,lt=cu(Je);return a.createElement("div",{className:lt.variableValueDropdown},a.createElement("div",{className:lt.variableOptionsWrapper},a.createElement("ul",{className:lt.variableOptionsColumn,"aria-label":Va.wl.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown,...ot},this.renderMultiToggle(),z.map((vt,Ut)=>this.renderOption(vt,Ut)))))}renderOption(K,z){const{highlightIndex:te,multi:fe,theme:Pe}=this.props,Ne=cu(Pe),Je=K.value===As.r2;return a.createElement("li",{key:`${K.value}`},a.createElement("button",{"data-testid":Va.wl.components.Variables.variableOption,role:"checkbox",type:"button","aria-checked":K.selected,className:(0,Q.cx)((0,re.gN)(Pe),Ne.variableOption,{[Ne.highlighted]:z===te,[Ne.variableAllOption]:Je},Ne.noStyledButton),onClick:this.onToggle(K)},a.createElement("span",{className:(0,Q.cx)(Ne.variableOptionIcon,{[Ne.variableOptionIconSelected]:K.selected,[Ne.hideVariableOptionIcon]:!fe})}),a.createElement("span",{"data-testid":Va.wl.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(`${K.text}`)},Je?(0,Aa.t)("variable.picker.option-all","All"):K.text)))}renderMultiToggle(){const{multi:K,selectedValues:z,theme:te,values:fe}=this.props,Pe=cu(te),Ne=fe.some(ot=>ot.value===As.r2);if(!K)return null;const Je=()=>a.createElement(Aa.cC,{i18nKey:"variable.picker.option-tooltip"},"Clear selections");return a.createElement(_r.u,{content:Je,placement:"top"},a.createElement("button",{className:(0,Q.cx)((0,re.gN)(te),Pe.variableOption,Pe.variableOptionColumnHeader,Pe.noStyledButton,{[Pe.noPaddingBotton]:Ne}),role:"checkbox","aria-checked":z.length>1?"mixed":"false",onClick:this.onToggleAll,"aria-label":"Toggle all values","data-placement":"top"},a.createElement("span",{className:(0,Q.cx)(Pe.variableOptionIcon,{[Pe.variableOptionIconManySelected]:z.length>1})}),a.createElement(Aa.cC,{i18nKey:"variable.picker.option-selected-values"},"Selected")," (",z.length,")"))}}const cu=(0,De.B)(U=>{const K=U.isDark?"public/img/checkbox.png":"public/img/checkbox_white.png";return{hideVariableOptionIcon:(0,Q.css)({display:"none"}),highlighted:(0,Q.css)({backgroundColor:U.colors.action.hover}),noStyledButton:(0,Q.css)({width:"100%",textAlign:"left"}),variableOption:(0,Q.css)({display:"block",padding:"2px 27px 0 8px",position:"relative",whiteSpace:"nowrap",minWidth:"115px",["&:hover"]:{backgroundColor:U.colors.action.hover}}),variableOptionColumnHeader:(0,Q.css)({paddingTop:"5px",paddingBottom:"5px",marginBottom:"5px"}),variableOptionIcon:(0,Q.css)({display:"inline-block",width:"24px",height:"18px",position:"relative",top:"4px",background:`url(${K}) left top no-repeat`}),variableOptionIconManySelected:(0,Q.css)({background:`url(${K}) 0px -36px no-repeat`}),variableOptionIconSelected:(0,Q.css)({background:`url(${K}) 0px -18px no-repeat`}),variableValueDropdown:(0,Q.css)({backgroundColor:U.colors.background.primary,border:`1px solid ${U.colors.border.weak}`,borderRadius:U.shape.borderRadius(2),boxShadow:U.shadows.z2,position:"absolute",top:U.spacing(U.components.height.md),maxHeight:"400px",minHeight:"150px",minWidth:"150px",overflowY:"auto",overflowX:"hidden",zIndex:U.zIndex.typeahead}),variableOptionsColumn:(0,Q.css)({maxHeight:"350px",display:"table-cell",lineHeight:"26px",listStyleType:"none"}),variableOptionsWrapper:(0,Q.css)({display:"table",width:"100%"}),variableAllOption:(0,Q.css)({borderBottom:`1px solid ${U.colors.border.weak}`,paddingBottom:U.spacing(1)}),noPaddingBotton:(0,Q.css)({paddingBottom:0})}}),Kp=(0,Be.HE)(Fp);var Vp=e(83505),rp=e(59421),uo=e(60344),Mr=e(44042);const $p=(U,K,z)=>async(te,fe)=>{if(K===Qr.cancel)return await te(Ui(U));if(K===Qr.select)return te(Zl(U,z));if(K===Qr.selectAndClose)return(0,Ia.AE)(U,fe()).optionsPicker.multi?te(Zl(U,z)):(te(Zl(U,z,!0)),te(Ui(U)));if(K===Qr.moveDown)return te((0,Wa.mb)(U,(0,Mr.Ew)(1)));if(K===Qr.moveUp)return te((0,Wa.mb)(U,(0,Mr.Ew)(-1)))},ni=(U,K="")=>async(z,te)=>{const{rootStateKey:fe}=U,{id:Pe,queryValue:Ne}=(0,Ia.AE)(fe,te()).optionsPicker,Je={id:Pe,rootStateKey:fe,type:"query"},ot=(0,Ia.E0)(Je,te());if(!("options"in ot)||(z((0,Wa.mb)(fe,(0,Mr.Ug)(K))),(0,v.trim)(Ne)===(0,v.trim)(K)))return;const{query:lt,options:vt}=ot,Ut=typeof lt=="string"?lt:lt.target;return(0,Vp.b)(Ut)?ip(z,te,K,fe):z((0,Wa.mb)(fe,(0,Mr.ss)(vt)))},Ma=async U=>{if((0,rp.Q)(U.current))return;await Ri.z.get(U.type).setValue(U,U.current,!0)},Ui=(U,K)=>async(z,te)=>{const fe=(0,Ia.AE)(U,te()).optionsPicker,Pe={id:fe.id,rootStateKey:U,type:"query"},Ne=(0,Ia.E0)(Pe,te());if(!(0,as.eL)(Ne))return;const Je={option:L(fe)},ot={propName:"queryValue",propValue:fe.queryValue};z((0,Wa.mb)(U,(0,uo.Q8)((0,Qn.Y6)(Ne,Je)))),z((0,Wa.mb)(U,(0,uo.Pl)((0,Qn.Y6)(Ne,ot))));const lt=(0,Ia.E0)(Pe,te());if((0,as.eL)(lt)&&(z((0,Wa.mb)(U,(0,Mr.nn)())),(0,Qn.N9)(Ne)!==(0,Qn.N9)(lt)))return K?K(lt):await Ma(lt)},Yl=(U,K)=>async(z,te)=>{const{id:fe,rootStateKey:Pe}=U,Ne=(0,Ia.AE)(Pe,te()).optionsPicker;Ne.id&&Ne.id!==fe&&await z(Ui(Pe,K));const Je=(0,Ia.E0)(U,te());(0,as.eL)(Je)&&z((0,Wa.mb)(Pe,(0,Mr.aN)(Je)))},Zl=(U,K,z=!1)=>(te,fe)=>{const{highlightIndex:Pe,options:Ne}=(0,Ia.AE)(U,fe()).optionsPicker,Je=Ne[Pe];te((0,Wa.mb)(U,(0,Mr._M)({option:Je,forceSelect:z,clearOthers:K})))},op=async(U,K,z,te)=>{try{const{id:fe}=(0,Ia.AE)(te,K()).optionsPicker,Pe={id:fe,rootStateKey:te,type:"query"},Ne=(0,Ia.E0)(Pe,K());if(!(0,as.eL)(Ne))return;await Ri.z.get(Ne.type).updateOptions(Ne,z);const ot=(0,Ia.E0)(Pe,K());if(!(0,as.eL)(ot))return;U((0,Wa.mb)(te,(0,Mr.wF)(ot.options)))}catch(fe){console.error(fe)}},ip=(0,v.debounce)(op,500);function L(U){const{options:K,selectedValues:z,queryValue:te,multi:fe}=U;if(K.length===0&&te&&te.length>0)return{text:te,value:te,selected:!1};if(!fe)return z.find(Je=>Je.selected);const Pe=[],Ne=[];for(const Je of z)Je.selected&&(Pe.push(Je.text.toString()),Ne.push(Je.value.toString()));return{value:Ne,text:Pe,selected:!0}}const J=()=>{const U=Pe=>({...(0,Ur.bindActionCreators)({openOptions:Yl,commitChangesToVariable:Ui,navigateOptions:$p},Pe),filterOrSearchOptions:(Ne,Je="")=>{Pe(ni(Ne,Je))},toggleAllOptions:Ne=>Pe((0,Wa.mb)(Ne.rootStateKey,(0,Mr.iQ)())),toggleOption:(Ne,Je,ot,lt)=>Pe((0,Wa.mb)(Ne.rootStateKey,(0,Mr._M)({option:Je,clearOthers:ot,forceSelect:lt})))}),K=(Pe,Ne)=>{const{rootStateKey:Je}=Ne.variable;return Je?{picker:(0,Ia.AE)(Je,Pe).optionsPicker}:(console.error("OptionPickerFactory: variable has no rootStateKey"),{picker:Mr.yy})},z=(0,qa.connect)(K,U);class te extends a.PureComponent{constructor(){super(...arguments),this.onShowOptions=()=>this.props.openOptions((0,Qn.yQ)(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=(Ne,Je)=>{((0,as.U4)(this.props.variable)&&this.props.variable.multi?this.onToggleMultiValueVariable:this.onToggleSingleValueVariable)(Ne,Je)},this.onToggleSingleValueVariable=(Ne,Je)=>{this.props.toggleOption((0,Qn.yQ)(this.props.variable),Ne,Je,!1),this.onHideOptions()},this.onToggleMultiValueVariable=(Ne,Je)=>{this.props.toggleOption((0,Qn.yQ)(this.props.variable),Ne,Je,!1)},this.onToggleAllOptions=()=>{this.props.toggleAllOptions((0,Qn.yQ)(this.props.variable))},this.onFilterOrSearchOptions=Ne=>{this.props.filterOrSearchOptions((0,Qn.yQ)(this.props.variable),Ne)},this.onNavigate=(Ne,Je)=>{if(!this.props.variable.rootStateKey){console.error("Variable has no rootStateKey");return}this.props.navigateOptions(this.props.variable.rootStateKey,Ne,Je)},this.onCancel=()=>{Ql().cancelRequest((0,Qn.yQ)(this.props.variable))}}render(){const{variable:Ne,picker:Je}=this.props,ot=Je.id===Ne.id;return a.createElement("div",{className:"variable-link-wrapper"},ot?this.renderOptions(Je):this.renderLink(Ne))}renderLink(Ne){const Je=ep(Ne),ot=Ne.state===Is.Gu.Loading;return a.createElement(ap,{id:As.IG+Ne.id,text:Je,onClick:this.onShowOptions,loading:ot,onCancel:this.onCancel,disabled:this.props.readOnly})}renderOptions(Ne){const{id:Je}=this.props.variable;return a.createElement(tu.L,{onClick:this.onHideOptions},a.createElement(np,{id:As.IG+Je,value:Ne.queryValue,onChange:this.onFilterOrSearchOptions,onNavigate:this.onNavigate,"aria-expanded":!0,"aria-controls":`options-${Je}`}),a.createElement(Kp,{values:Ne.options,onToggle:this.onToggleOption,onToggleAll:this.onToggleAllOptions,highlightIndex:Ne.highlightIndex,multi:Ne.multi,selectedValues:Ne.selectedValues,id:`options-${Je}`}))}}const fe=z(te);return fe.displayName="OptionsPicker",fe};var ee=e(24446);class de extends a.PureComponent{constructor(){super(...arguments),this.onChange=K=>{this.props.onPropChange({propName:"query",propValue:K.currentTarget.value})},this.onBlur=K=>{this.props.onPropChange({propName:"query",propValue:K.currentTarget.value,updateOptions:!0})}}render(){return a.createElement(a.Fragment,null,a.createElement(Br.e,null,"Constant options"),a.createElement(ee.V,{value:this.props.variable.query,name:"Value",placeholder:"your metric prefix",onChange:this.onChange,onBlur:this.onBlur,testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.ConstantVariable.constantOptionsQueryInputV2,width:30}))}}const ve={...os.Eg,type:"constant",hide:os.bU.hideVariable,query:"",current:{},options:[]},Re=(0,Ar.oM)({name:"templating/constant",initialState:So.s,reducers:{createConstantOptionsFromQuery:(U,K)=>{const z=(0,Ia.ir)(U,K.payload.id);z.type==="constant"&&(z.options=[{text:z.query.trim(),value:z.query.trim(),selected:!1}])}}}),Fe=Re.reducer,{createConstantOptionsFromQuery:je}=Re.actions,Xe=U=>async K=>{const{rootStateKey:z}=U;await K((0,Wa.mb)(z,je((0,Qn.Y6)(U)))),await K((0,gs.xQ)(U))},at=()=>({id:"constant",description:"Define a hidden constant variable, useful for metric prefixes in dashboards you want to share.",name:"Constant",initialState:ve,reducer:Fe,picker:J(),editor:de,dependsOn:()=>!1,setValue:async(U,K,z=!1)=>{await(0,_a.WI)((0,gs.Fz)((0,Qn.yQ)(U),K,z))},setValueFromUrl:async(U,K)=>{await(0,_a.WI)((0,gs.Ci)((0,Qn.yQ)(U),K))},updateOptions:async U=>{await(0,_a.WI)(Xe((0,Qn.yQ)(U)))},getSaveModel:U=>{const{index:K,id:z,state:te,global:fe,current:Pe,options:Ne,rootStateKey:Je,...ot}=(0,v.cloneDeep)(U);return ot},getValueForUrl:U=>U.current.value,beforeAdding:U=>{const{current:K,options:z,query:te,...fe}=(0,v.cloneDeep)(U),Pe={selected:!0,text:te,value:te};return{...fe,current:Pe,options:[Pe],query:te}}});var dt=e(87911),ut=e(83967);function St({value:U,name:K,description:z,onChange:te,ariaLabel:fe}){const Pe=(0,dt.Me)();return a.createElement(ut.X,{id:Pe,label:K,description:z,value:U,onChange:te,"aria-label":fe})}const mt=({onMultiChanged:U,onPropChange:K,variable:z})=>{const te=(0,a.useCallback)(Ne=>{U((0,Qn.yQ)(z),Ne.target.checked)},[U,z]),fe=(0,a.useCallback)(Ne=>{K({propName:"includeAll",propValue:Ne.target.checked})},[K]),Pe=(0,a.useCallback)(Ne=>{K({propName:"allValue",propValue:Ne.currentTarget.value})},[K]);return a.createElement(Xt.wc,{spacing:"md",height:"inherit"},a.createElement(St,{value:z.multi,name:"Multi-value",description:"Enables multiple values to be selected at the same time",onChange:te}),a.createElement(St,{value:z.includeAll,name:"Include All option",description:"Enables an option to include all variables",onChange:fe}),z.includeAll&&a.createElement(ee.V,{value:z.allValue??"",onChange:Pe,name:"Custom all value",placeholder:"blank = auto",testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsCustomAllInputV2}))};mt.displayName="SelectionOptionsEditor";var Ot=e(62981);class $t extends a.PureComponent{constructor(){super(...arguments),this.onChange=K=>{this.props.onPropChange({propName:"query",propValue:K.currentTarget.value})},this.onSelectionOptionsChange=async({propName:K,propValue:z})=>{this.props.onPropChange({propName:K,propValue:z,updateOptions:!0})},this.onBlur=K=>{this.props.onPropChange({propName:"query",propValue:K.currentTarget.value,updateOptions:!0})}}render(){return a.createElement(a.Fragment,null,a.createElement(Br.e,null,"Custom options"),a.createElement(Ot.W,{name:"Values separated by comma",value:this.props.variable.query,placeholder:"1, 10, mykey : myvalue, myvalue, escaped\\,value",onChange:this.onChange,onBlur:this.onBlur,required:!0,width:52,testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.CustomVariable.customValueInput}),a.createElement(Br.e,null,"Selection options"),a.createElement(mt,{variable:this.props.variable,onPropChange:this.onSelectionOptionsChange,onMultiChanged:this.props.changeVariableMultiValue}))}}const At=(U,K)=>({}),Wt={changeVariableMultiValue:gs.Z7},Jt=wf($t,At,Wt),en={...os.Eg,type:"custom",multi:!1,includeAll:!1,allValue:null,query:"",options:[],current:{}},Qt=(0,Ar.oM)({name:"templating/custom",initialState:So.s,reducers:{createCustomOptionsFromQuery:(U,K)=>{const z=(0,Ia.ir)(U,K.payload.id);if(z.type!=="custom")return;const{includeAll:te,query:fe}=z,Ne=(fe.match(/(?:\\,|[^,])+/g)??[]).map(Je=>{Je=Je.replace(/\\,/g,",");const ot=/^(.+)\s:\s(.+)$/g.exec(Je)??[];if(ot.length===3){const[,lt,vt]=ot;return{text:lt.trim(),value:vt.trim(),selected:!1}}else return{text:Je.trim(),value:Je.trim(),selected:!1}});te&&Ne.unshift({text:As.xk,value:As.r2,selected:!1}),z.options=Ne}}}),fn=Qt.reducer,{createCustomOptionsFromQuery:Yt}=Qt.actions,vn=U=>async K=>{const{rootStateKey:z}=U;await K((0,Wa.mb)(z,Yt((0,Qn.Y6)(U)))),await K((0,gs.xQ)(U))},In=()=>({id:"custom",description:"Define variable values manually",name:"Custom",initialState:en,reducer:fn,picker:J(),editor:Jt,dependsOn:()=>!1,setValue:async(U,K,z=!1)=>{await(0,_a.WI)((0,gs.Fz)((0,Qn.yQ)(U),K,z))},setValueFromUrl:async(U,K)=>{await(0,_a.WI)((0,gs.Ci)((0,Qn.yQ)(U),K))},updateOptions:async U=>{await(0,_a.WI)(vn((0,Qn.yQ)(U)))},getSaveModel:U=>{const{index:K,id:z,state:te,global:fe,rootStateKey:Pe,...Ne}=(0,v.cloneDeep)(U);return Ne},getValueForUrl:U=>(0,Qn.HY)(U)?As.xk:U.current.value});var Mn=e(1781);const Rn={...os.Eg,type:"datasource",current:{},regex:"",options:[],query:"",multi:!1,includeAll:!1,refresh:os.Bd.onDashboardLoad},$n=(0,Ar.oM)({name:"templating/datasource",initialState:So.s,reducers:{createDataSourceOptions:(U,K)=>{const{sources:z,regex:te}=K.payload.data,fe=[],Pe=(0,Ia.ir)(U,K.payload.id);if(Pe.type==="datasource"){for(let Ne=0;Ne<z.length;Ne++){const Je=z[Ne];Je.meta.id===Pe.query&&(wn(Je,te)&&fe.push({text:Je.name,value:Je.uid,selected:!1}),ra(Je,te)&&fe.push({text:"default",value:"default",selected:!1}))}fe.length===0&&fe.push({text:"No data sources found",value:"",selected:!1}),Pe.includeAll&&fe.unshift({text:As.xk,value:As.r2,selected:!1}),Pe.options=fe}}}});function wn(U,K){return K?K.exec(U.name):!0}function ra(U,K){return U.isDefault?K?K.exec("default"):!0:!1}const Gn=$n.reducer,{createDataSourceOptions:Sn}=$n.actions,Xn=(U,K={getDatasourceSrv:m.ak})=>async(z,te)=>{const{rootStateKey:fe}=U,Pe=K.getDatasourceSrv().getList({metrics:!0,variables:!1}),Ne=(0,Ia.E0)(U,te());if(Ne.type!=="datasource")return;let Je;Ne.regex&&(Je=(0,zo.J)().replace(Ne.regex,void 0,"regex"),Je=(0,ht.jO)(Je)),z((0,Wa.mb)(fe,Sn((0,Qn.Y6)(U,{sources:Pe,regex:Je})))),await z((0,gs.xQ)(U))},la=(U,K={getDatasourceSrv:m.ak})=>z=>{const te=K.getDatasourceSrv().getList({metrics:!0,variables:!0}),fe=(0,v.chain)(te).uniqBy("meta.id").map(Pe=>({text:Pe.meta.name,value:Pe.meta.id})).value();fe.unshift({text:"",value:""}),z((0,Wa.mb)(U,(0,jr.z7)({dataSourceTypes:fe})))},Fa=(U,K)=>{const{variable:{rootStateKey:z}}=K;if(!z)return console.error("DataSourceVariableEditor: variable has no rootStateKey"),{extended:Ug(jr.PF)};const{editor:te}=(0,Ia.AE)(z,U);return{extended:Ug(te)}},za={initDataSourceVariableEditor:la,changeVariableMultiValue:gs.Z7},Ka=(0,qa.connect)(Fa,za);class Ha extends a.PureComponent{constructor(){super(...arguments),this.onRegExChange=K=>{this.props.onPropChange({propName:"regex",propValue:K.currentTarget.value})},this.onRegExBlur=K=>{this.props.onPropChange({propName:"regex",propValue:K.currentTarget.value,updateOptions:!0})},this.onSelectionOptionsChange=async({propValue:K,propName:z})=>{this.props.onPropChange({propName:z,propValue:K,updateOptions:!0})},this.getSelectedDataSourceTypeValue=()=>{const{extended:K}=this.props;if(!K?.dataSourceTypes.length)return"";const z=K.dataSourceTypes.find(fe=>fe.value===this.props.variable.query);return(z?z.value:K.dataSourceTypes[0].value)??""},this.onDataSourceTypeChanged=K=>{this.props.onPropChange({propName:"query",propValue:K.value,updateOptions:!0})}}componentDidMount(){const{rootStateKey:K}=this.props.variable;if(!K){console.error("DataSourceVariableEditor: variable has no rootStateKey");return}this.props.initDataSourceVariableEditor(K)}render(){const{variable:K,extended:z,changeVariableMultiValue:te}=this.props,fe=z?.dataSourceTypes?.length?z.dataSourceTypes?.map(Ne=>({value:Ne.value??"",label:Ne.text})):[],Pe=fe.find(Ne=>Ne.value===K.query)??fe[0];return a.createElement(a.Fragment,null,a.createElement(Br.e,null,"Data source options"),a.createElement(Mn.u,{name:"Type",value:Pe,options:fe,onChange:this.onDataSourceTypeChanged,testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.DatasourceVariable.datasourceSelect}),a.createElement(ee.V,{value:this.props.variable.regex,name:"Instance name filter",placeholder:"/.*-(.*)-.*/",onChange:this.onRegExChange,onBlur:this.onRegExBlur,description:a.createElement("div",null,"Regex filter for which data source instances to choose from in the variable value list. Leave empty for all.",a.createElement("br",null),a.createElement("br",null),"Example: ",a.createElement("code",null,"/^prod/"))}),a.createElement(Br.e,null,"Selection options"),a.createElement(mt,{variable:K,onPropChange:this.onSelectionOptionsChange,onMultiChanged:te}))}}const Zn=Ka(Ha),Wn=()=>({id:"datasource",description:"Enables you to dynamically switch the data source for multiple panels.",name:"Data source",initialState:Rn,reducer:Gn,picker:J(),editor:Zn,dependsOn:(U,K)=>U.regex?(0,Qn.QI)(U.regex,K.name):!1,setValue:async(U,K,z=!1)=>{await(0,_a.WI)((0,gs.Fz)((0,Qn.yQ)(U),K,z))},setValueFromUrl:async(U,K)=>{await(0,_a.WI)((0,gs.Ci)((0,Qn.yQ)(U),K))},updateOptions:async U=>{await(0,_a.WI)(Xn((0,Qn.yQ)(U)))},getSaveModel:U=>{const{index:K,id:z,state:te,global:fe,rootStateKey:Pe,...Ne}=(0,v.cloneDeep)(U);return{...Ne,options:[]}},getValueForUrl:U=>(0,Qn.HY)(U)?As.xk:U.current.value});var Yn=e(75627);const ta=[1,2,3,4,5,10,20,30,40,50,100,200,300,400,500].map(U=>({label:`${U}`,value:U})),ga=a.memo(({onPropChange:U,variable:K})=>{const z=lt=>{U({propName:"auto",propValue:lt.target.checked,updateOptions:!0})},te=lt=>{U({propName:"query",propValue:lt.currentTarget.value})},fe=lt=>{U({propName:"query",propValue:lt.currentTarget.value,updateOptions:!0})},Pe=lt=>{U({propName:"auto_count",propValue:lt.value,updateOptions:!0})},Ne=lt=>{U({propName:"auto_min",propValue:lt.currentTarget.value,updateOptions:!0})},Je=ta.find(lt=>lt.value===K.auto_count)??ta[0],ot=(0,Be.wW)(fa);return a.createElement(a.Fragment,null,a.createElement(Br.e,null,"Interval options"),a.createElement(ee.V,{value:K.query,name:"Values",placeholder:"1m,10m,1h,6h,1d,7d",onChange:te,onBlur:fe,testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.intervalsValueInput,width:32,required:!0}),a.createElement(St,{value:K.auto,name:"Auto option",description:"Dynamically calculates interval by dividing time range by the count specified",onChange:z}),K.auto&&a.createElement("div",{className:ot.autoFields},a.createElement(Mn.u,{name:"Step count",description:"How many times the current time range should be divided to calculate the value",value:Je,options:ta,onChange:Pe,width:9}),a.createElement(ee.V,{value:K.auto_min,name:"Min interval",description:"The calculated value will not go below this threshold",placeholder:"10s",onChange:Ne,width:11})))});ga.displayName="IntervalVariableEditor";function fa(U){return{autoFields:(0,Q.css)({marginTop:U.spacing(2),display:"flex",flexDirection:"column"})}}var Na=e(99386);const pa={...os.Eg,type:"interval",auto_count:30,auto_min:"10s",options:[],auto:!1,query:"1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",refresh:os.Bd.onTimeRangeChanged,current:{}},On=(0,Ar.oM)({name:"templating/interval",initialState:So.s,reducers:{createIntervalOptions:(U,K)=>{const z=(0,Ia.ir)(U,K.payload.id);if(z.type!=="interval")return;const te=(0,v.map)(z.query.match(/(["'])(.*?)\1|\w+/g),fe=>(fe=fe.replace(/["']+/g,""),{text:fe.trim(),value:fe.trim(),selected:!1}));z.auto&&te.length&&te[0].text!=="auto"&&te.unshift({text:"auto",value:"$__auto_interval_"+z.name,selected:!1}),z.options=te}}}),Nn=On.reducer,{createIntervalOptions:Fn}=On.actions,qn=U=>async K=>{const{rootStateKey:z}=U;await K((0,Wa.mb)(z,Fn((0,Qn.Y6)(U)))),await K(ea(U)),await K((0,gs.xQ)(U))},ea=(U,K={calculateInterval:Rg.calculateInterval,getTimeSrv:ls.$t,templateSrv:(0,Na.J)()})=>(z,te)=>{const fe=(0,Ia.E0)(U,te());if(fe.type==="interval"&&fe.auto){const Pe=K.calculateInterval(K.getTimeSrv().timeRange(),fe.auto_count,fe.auto_min);K.templateSrv.setGrafanaVariable("$__auto_interval_"+fe.name,Pe.interval),K.templateSrv.setGrafanaVariable("$__auto_interval",Pe.interval)}},ha=()=>({id:"interval",description:"Define a timespan interval (ex 1m, 1h, 1d)",name:"Interval",initialState:pa,reducer:Nn,picker:J(),editor:ga,dependsOn:()=>!1,setValue:async(U,K,z=!1)=>{await(0,_a.WI)(ea((0,Qn.yQ)(U))),await(0,_a.WI)((0,gs.Fz)((0,Qn.yQ)(U),K,z))},setValueFromUrl:async(U,K)=>{await(0,_a.WI)(ea((0,Qn.yQ)(U))),await(0,_a.WI)((0,gs.Ci)((0,Qn.yQ)(U),K))},updateOptions:async U=>{await(0,_a.WI)(qn((0,Qn.yQ)(U)))},getSaveModel:U=>{const{index:K,id:z,state:te,global:fe,rootStateKey:Pe,...Ne}=(0,v.cloneDeep)(U);return Ne},getValueForUrl:U=>U.current.value});var ua=e(82986);const cs=[{label:"On dashboard load",value:ua.Bd.onDashboardLoad},{label:"On time range change",value:ua.Bd.onTimeRangeChanged}];function ds({onChange:U,refresh:K}){const z=(0,a.useMemo)(()=>cs.find(te=>te.value===K)?.value??cs[0].value,[K]);return a.createElement(Lt.g,{label:"Refresh",description:"When to update the values of this variable"},a.createElement(ae.S,{options:cs,onChange:U,value:z}))}const ar=[{label:"Disabled",value:os.$U.disabled},{label:"Alphabetical (asc)",value:os.$U.alphabeticalAsc},{label:"Alphabetical (desc)",value:os.$U.alphabeticalDesc},{label:"Numerical (asc)",value:os.$U.numericalAsc},{label:"Numerical (desc)",value:os.$U.numericalDesc},{label:"Alphabetical (case-insensitive, asc)",value:os.$U.alphabeticalCaseInsensitiveAsc},{label:"Alphabetical (case-insensitive, desc)",value:os.$U.alphabeticalCaseInsensitiveDesc}];function Ls({onChange:U,sort:K}){const z=(0,a.useMemo)(()=>ar.find(te=>te.value===K)??ar[0],[K]);return a.createElement(Mn.u,{name:"Sort",description:"How to sort the values of this variable",value:z,options:ar,onChange:U,testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsSortSelectV2,width:25})}var Nr=e(19973),Yr=e(40545),mo=e(46241);async function Js(U,K=il.nL){if((0,as.d7)(U))return U.variables.editor;if((0,as.X7)(U)){const z=await K(U.meta);if(!z.components.QueryEditor)throw new Error("Missing QueryEditor in plugin definition.");return z.components.QueryEditor??null}return(0,as.Ju)(U)?ir:(0,as.R)(U)?(await K(U.meta)).components.VariableQueryEditor??mo.R:null}function ir({datasource:U,query:K,onChange:z}){const te=(0,a.useCallback)(fe=>{z({refId:"StandardVariableQuery",query:fe})},[z]);return a.createElement(mo.R,{query:K.query,onChange:te,datasource:U,templateSrv:(0,zo.J)()})}function Ns(U,K,z){return{next:fe=>{if(fe.state===Is.Gu.Error){z.unsubscribe(),K(fe.error);return}if(fe.state===Is.Gu.Done){z.unsubscribe(),U();return}},error:fe=>{z.unsubscribe(),K(fe)},complete:()=>{z.unsubscribe(),U()}}}const ts=(U,K)=>async(z,te)=>{try{const{rootStateKey:fe}=U;if(!(0,Qn.A3)(fe,te()))return;const Pe=(0,Ia.E0)(U,te());if(Pe.type!=="query")return;(0,Ia.AE)(fe,te()).editor.id===Pe.id&&z((0,Wa.mb)(fe,(0,jr.PV)({errorProp:"update"})));const Ne=await(0,N.F)().get(Pe.datasource??"");await new Promise((Je,ot)=>{const lt=new Nr.w0,vt=Ns(Je,ot,lt),Ut=Ql().getResponse(U).subscribe(vt);lt.add(Ut),Ql().queueRequest({identifier:U,datasource:Ne,searchFilter:K})})}catch(fe){if(fe instanceof Error){const Pe=(0,Yr.P)(fe),{rootStateKey:Ne}=U;throw(0,Ia.AE)(Ne,te()).editor.id===U.id&&z((0,Wa.mb)(Ne,(0,jr.Sg)({errorProp:"update",errorText:Pe.message}))),Pe}}},wr=U=>async(K,z)=>{const te=(0,Ia.E0)(U,z());te.type==="query"&&await K(gr((0,Qn.yQ)(te),te.datasource))},gr=(U,K)=>async(z,te)=>{try{const{rootStateKey:fe}=U,{editor:Pe}=(0,Ia.AE)(fe,te()),Je=Jd(Pe)?.dataSource,ot=await(0,N.F)().get(K??"");Je&&Je.type!==ot?.type&&z((0,Wa.mb)(fe,(0,uo.Pl)((0,Qn.Y6)(U,{propName:"query",propValue:""}))));const lt=await Js(ot);z((0,Wa.mb)(fe,(0,jr.z7)({dataSource:ot,VariableQueryEditor:lt})))}catch(fe){console.error(fe)}},Ni=(U,K,z)=>async(te,fe)=>{const{rootStateKey:Pe}=U,Ne=(0,Ia.E0)(U,fe());if(Ne.type==="query"){if(wi(Ne.name,K)){const Je="Query cannot contain a reference to itself. Variable: $"+Ne.name;te((0,Wa.mb)(Pe,(0,jr.Sg)({errorProp:"query",errorText:Je})));return}te((0,Wa.mb)(Pe,(0,jr.PV)({errorProp:"query"}))),te((0,Wa.mb)(Pe,(0,uo.Pl)((0,Qn.Y6)(U,{propName:"query",propValue:K})))),z!==void 0?te((0,Wa.mb)(Pe,(0,uo.Pl)((0,Qn.Y6)(U,{propName:"definition",propValue:z})))):typeof K=="string"&&te((0,Wa.mb)(Pe,(0,uo.Pl)((0,Qn.Y6)(U,{propName:"definition",propValue:K})))),await te((0,gs.Rk)(U))}};function wi(U,K){if(typeof K=="string"&&K.match(new RegExp("\\$"+U+"(/| |$)")))return!0;const z=_p(K);for(let te in z)if(z.hasOwnProperty(te)){const fe=z[te];if(typeof fe=="string"&&fe.match(new RegExp("\\$"+U+"(/| |$)")))return!0}return!1}function _p(U){return typeof U!="object"||U===null?{query:U}:Object.keys(U).reduce((te,fe)=>{const Pe=U[fe];if(typeof Pe!="object"||Pe===null)return te[fe]=Pe,te;const Ne=_p(Pe);for(let Je in Ne)Ne.hasOwnProperty(Je)&&(te[`${fe}_${Je}`]=Ne[Je]);return te},{})}const Qp=(U,K)=>{const{rootStateKey:z}=K.variable;if(!z)return console.error("QueryVariableEditor: variable has no rootStateKey"),{extended:Jd(jr.PF)};const{editor:te}=(0,Ia.AE)(z,U);return{extended:Jd(te)}},Yp={initQueryVariableEditor:wr,changeQueryVariableDataSource:gr,changeQueryVariableQuery:Ni,changeVariableMultiValue:gs.Z7},Zp=(0,qa.connect)(Qp,Yp);class Jp extends a.PureComponent{constructor(){super(...arguments),this.state={regex:null,tagsQuery:null,tagValuesQuery:null},this.onDataSourceChange=K=>{this.props.onPropChange({propName:"datasource",propValue:K.isDefault?null:(0,Ag.iU)(K)})},this.onLegacyQueryChange=async(K,z)=>{this.props.variable.query!==K&&this.props.changeQueryVariableQuery((0,Qn.yQ)(this.props.variable),K,z)},this.onQueryChange=async K=>{if(this.props.variable.query!==K){let z="";K&&K.hasOwnProperty("query")&&typeof K.query=="string"&&(z=K.query),this.props.changeQueryVariableQuery((0,Qn.yQ)(this.props.variable),K,z)}},this.onRegExChange=K=>{this.setState({regex:K.currentTarget.value})},this.onRegExBlur=async K=>{const z=K.currentTarget.value;this.props.variable.regex!==z&&this.props.onPropChange({propName:"regex",propValue:z,updateOptions:!0})},this.onRefreshChange=K=>{this.props.onPropChange({propName:"refresh",propValue:K})},this.onSortChange=async K=>{this.props.onPropChange({propName:"sort",propValue:K.value,updateOptions:!0})},this.onSelectionOptionsChange=async({propValue:K,propName:z})=>{this.props.onPropChange({propName:z,propValue:K,updateOptions:!0})},this.renderQueryEditor=()=>{const{extended:K,variable:z}=this.props;if(!K||!K.dataSource||!K.VariableQueryEditor)return null;const te=K.dataSource,fe=K.VariableQueryEditor;let Pe=z.query;if(typeof Pe=="string"?Pe=Pe||(te.variables?.getDefaultQuery?.()??""):Pe={...te.variables?.getDefaultQuery?.(),...z.query},(0,as.NX)(fe,te))return a.createElement(Lt.g,{label:"Query"},a.createElement(fe,{key:te.uid,datasource:te,query:Pe,templateSrv:(0,zo.J)(),onChange:this.onLegacyQueryChange}));const Ne=(0,ls.$t)().timeRange();return(0,as.$7)(fe,te)?a.createElement(Lt.g,{label:"Query"},a.createElement(fe,{key:te.uid,datasource:te,query:Pe,onChange:this.onQueryChange,onRunQuery:()=>{},data:{series:[],state:Is.Gu.Done,timeRange:Ne},range:Ne,onBlur:()=>{},history:[]})):null}}async componentDidMount(){await this.props.initQueryVariableEditor((0,Qn.yQ)(this.props.variable))}componentDidUpdate(K){K.variable.datasource!==this.props.variable.datasource&&this.props.changeQueryVariableDataSource((0,Qn.yQ)(this.props.variable),this.props.variable.datasource)}render(){return a.createElement(a.Fragment,null,a.createElement(Br.e,null,"Query options"),a.createElement(Lt.g,{label:"Data source",htmlFor:"data-source-picker"},a.createElement(Lg.q,{current:this.props.variable.datasource,onChange:this.onDataSourceChange,variables:!0,width:30})),this.renderQueryEditor(),a.createElement(Ot.W,{value:this.state.regex??this.props.variable.regex,name:"Regex",description:a.createElement("div",null,"Optional, if you want to extract part of a series name or metric node segment.",a.createElement("br",null),"Named capture groups can be used to separate the display text and value (",a.createElement("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"},"see examples"),")."),placeholder:"/.*-(?<text>.*)-(?<value>.*)-.*/",onChange:this.onRegExChange,onBlur:this.onRegExBlur,testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2,width:52}),a.createElement(Ls,{onChange:this.onSortChange,sort:this.props.variable.sort}),a.createElement(ds,{onChange:this.onRefreshChange,refresh:this.props.variable.refresh}),a.createElement(Br.e,null,"Selection options"),a.createElement(mt,{variable:this.props.variable,onPropChange:this.onSelectionOptionsChange,onMultiChanged:this.props.changeVariableMultiValue}))}}const Xp=Zp(Jp),qp=()=>({id:"query",description:"Variable values are fetched from a datasource query",name:"Query",initialState:$g,reducer:ru,picker:J(),editor:Xp,dependsOn:(U,K)=>(0,Qn.QI)(U.query,U.datasource?.uid,U.regex,K.name),setValue:async(U,K,z=!1)=>{await(0,_a.WI)((0,gs.Fz)((0,Qn.yQ)(U),K,z))},setValueFromUrl:async(U,K)=>{await(0,_a.WI)((0,gs.Ci)((0,Qn.yQ)(U),K))},updateOptions:async(U,K)=>{await(0,_a.WI)(ts((0,Qn.yQ)(U),K))},getSaveModel:U=>{const{index:K,id:z,state:te,global:fe,queryValue:Pe,rootStateKey:Ne,...Je}=(0,v.cloneDeep)(U);return U.refresh!==os.Bd.never?{...Je,options:[]}:Je},getValueForUrl:U=>(0,Qn.HY)(U)?As.xk:U.current.value}),eh=()=>({id:"system",description:"",name:"system",initialState:{...os.Eg,type:"system",hide:os.bU.hideVariable,skipUrlSync:!0,current:{value:{toString:()=>""}},state:Is.Gu.Done},reducer:(U,K)=>U,picker:null,editor:null,dependsOn:()=>!1,setValue:async(U,K,z=!1)=>{},setValueFromUrl:async(U,K)=>{},updateOptions:async U=>{},getSaveModel:U=>({}),getValueForUrl:U=>""});function th({onPropChange:U,variable:{query:K}}){const z=(0,a.useCallback)((Pe,Ne)=>{Pe.preventDefault(),U({propName:"originalQuery",propValue:Pe.currentTarget.value,updateOptions:!1}),U({propName:"query",propValue:Pe.currentTarget.value,updateOptions:Ne})},[U]),te=(0,a.useCallback)(Pe=>z(Pe,!1),[z]),fe=(0,a.useCallback)(Pe=>z(Pe,!0),[z]);return a.createElement(a.Fragment,null,a.createElement(Br.e,null,"Text options"),a.createElement(ee.V,{value:K,name:"Default value",placeholder:"default value, if any",onChange:te,onBlur:fe,width:30,testId:Va.wl.pages.Dashboard.Settings.Variables.Edit.TextBoxVariable.textBoxOptionsQueryInputV2}))}function nh({variable:U,onVariableChange:K,readOnly:z}){const te=(0,Cn.useDispatch)(),[fe,Pe]=(0,a.useState)(U.current.value);(0,a.useEffect)(()=>{Pe(U.current.value)},[U]);const Ne=(0,a.useCallback)(()=>{if(!U.rootStateKey){console.error("Cannot update variable without rootStateKey");return}if(U.current.value!==fe){if(te((0,Wa.mb)(U.rootStateKey,(0,uo.Pl)((0,Qn.Y6)({id:U.id,type:U.type},{propName:"query",propValue:fe})))),K){K({...U,current:(0,rp.Q)(U.current)?{}:{...U.current,value:fe}});return}Ri.z.get(U.type).updateOptions(U)}},[U,fe,te,K]),Je=(0,a.useCallback)(vt=>Pe(vt.target.value),[Pe]),ot=vt=>Ne(),lt=vt=>{vt.keyCode===13&&(vt.preventDefault(),Ne())};return a.createElement(ce.I,{type:"text",value:fe,onChange:Je,onBlur:ot,disabled:z,onKeyDown:lt,placeholder:(0,Aa.t)("variable.textbox.placeholder","Enter variable value"),id:As.IG+U.id})}const ah={...os.Eg,type:"textbox",query:"",current:{},options:[],originalQuery:null},zp=(0,Ar.oM)({name:"templating/textbox",initialState:So.s,reducers:{createTextBoxOptions:(U,K)=>{const z=(0,Ia.ir)(U,K.payload.id);if(z.type!=="textbox")return;const te={text:z.query.trim(),value:z.query.trim(),selected:!1};z.options=[te],z.current=te}}}),sh=zp.reducer,{createTextBoxOptions:rh}=zp.actions,oh=U=>async(K,z)=>{const{rootStateKey:te,type:fe}=U;K((0,Wa.mb)(te,rh((0,Qn.Y6)(U))));const Pe=(0,Ia.E0)(U,z());Pe.type==="textbox"&&await Ri.z.get(fe).setValue(Pe,Pe.options[0],!0)},ih=(U,K)=>async(z,te)=>{const{rootStateKey:fe}=U,Pe=(0,Ia.E0)(U,te());if(Pe.type!=="textbox")return;const Ne=(0,Qn.Hi)(K);z((0,Wa.mb)(fe,(0,uo.Pl)((0,Qn.Y6)(Pe,{propName:"query",propValue:Ne})))),await z((0,gs.Ci)((0,Qn.yQ)(Pe),Ne))},lh=()=>({id:"textbox",description:"Define a textbox variable, where users can enter any arbitrary string",name:"Text box",initialState:ah,reducer:sh,picker:nh,editor:th,dependsOn:(U,K)=>!1,setValue:async(U,K,z=!1)=>{await(0,_a.WI)((0,gs.Fz)((0,Qn.yQ)(U),K,z))},setValueFromUrl:async(U,K)=>{await(0,_a.WI)(ih((0,Qn.yQ)(U),K))},updateOptions:async U=>{await(0,_a.WI)(oh((0,Qn.yQ)(U)))},getSaveModel:(U,K)=>{const{index:z,id:te,state:fe,global:Pe,originalQuery:Ne,rootStateKey:Je,...ot}=(0,v.cloneDeep)(U);if(U.query!==Ne&&!K){const lt=Ne??"",vt={selected:!1,text:lt,value:lt};return{...ot,query:lt,current:vt,options:[vt]}}return ot},getValueForUrl:U=>U.current.value,beforeAdding:U=>({...(0,v.cloneDeep)(U),originalQuery:U.query})});var ch=e(41938),lp=e(67572),cp=e(39705),dh=e(78467);const uh={navBarTree:dh.V4,navIndex:Dl.G4,appNotifications:Dd.VW};var mh=e(90805),fh=e(64216),gh=e(59273),ph=e(4242),hh=e(82880),vh=e(45743),Eh=e(10974),yh=e(11676),Ph=e(29739),Dh=e(62225),Ch=e(67198),bh=e(91399),Mh=e(73796),xh=e(47875),Sh=e(6752),Th=e(83341),Oh=e(21502),Ih=e(26271),Rh=e(96444),Ah=e(17632),dp=e(16881),Lh=e(92071);const Bh={...uh,...fh.ZP,...Rh.ZP,...gh.ZP,...Dh.ZP,...Eh.ZP,...Ph.ZP,...yh.ZP,...Ah.ZP,...Oh.ZP,...Th.ZP,...Ch.ZP,...Mh.ZP,...hh.ZP,...mh.ZP,...bh.ZP,...vh.ZP,...xh.ZP,...Wa.ZP,...Ih.ZP,...ph.ZP,plugins:Sh.I6,[dp.C.reducerPath]:dp.C.reducer,[cp.Rh.reducerPath]:cp.Rh.reducer,[lp.Zi.reducerPath]:lp.Zi.reducer},Hp={},jh=U=>{Object.assign(Hp,U)},Uh=()=>{const U=(0,Ur.combineReducers)({...Bh,...Hp});return(K,z)=>{if(z.type!==Lh.e.type)return U(K,z);const{cleanupAction:te}=z.payload;return te(K),U(K,z)}};function Qh(U){addReducer(U)}const Nh=(0,Ar.e)();function wh(U){const K=(0,Ar.xC)({reducer:Uh(),middleware:z=>z({thunk:!0,serializableCheck:!1,immutableCheck:!1}).concat(Nh.middleware,dp.C.middleware,cp.Rh.middleware,lp.Zi.middleware),devTools:!1,preloadedState:{navIndex:(0,Dl.Cu)(),...U}});return(0,ch.sj)(K.dispatch),(0,_a.PQ)(K),K}D().move=X.R;const kp=e(72866),du=kp.keys().map(U=>kp(U));class Wh{async init(){try{parent.postMessage("GrafanaAppInit","*");const K=(0,Aa.uC)(Y.default.bootData.user.language);(0,O.jW)(bo.ae),Vh(),wl("frontend_app_init"),$h(),(0,P.i_)(Y.default.bootData.user.locale),(0,P.Ls)(Y.default.bootData.user.weekStart),(0,R.L)(Eg.$),(0,_.t)(Bf),(0,H.$)(Oi.Z),(0,B.x)(A.E1),(0,b.K)(()=>Y.default.bootData.user.timezone),vg(),(0,ag.initAuthConfig)(),(0,V.Xw)(wa.Z),await K,Fh(),wh(),Kh(),M.S.setInit(Bl.u),M.N.setInit(Bl.l),T.Z.setInit(oc),Ri.z.setInit(()=>[qp(),In(),lh(),at(),Wn(),ha(),eu(),eh()]),S.F.setInit(bu),(0,W.pD)(()=>new xp),qg(new Xg),(0,W.Iw)(Zd.v7),(0,w.Qf)({importPanelPlugin:Qd.Ub,getPanelPluginFromCache:Qd.q1}),x.u.initialize({config:Y.default,getTimeRangeForUrl:(0,ls.$t)().timeRangeForUrl,getVariablesUrlParams:Yn.c}),document.addEventListener("click",Ad);const z=new m.ND;z.init(Y.default.datasources,Y.default.defaultDatasource),(0,N.w)(z),Tp(),new Ff().init();const fe=await Sg(Y.default.apps),Pe=Dg([{pluginId:"grafana",extensionConfigs:Gd()},...fe]),Ne=Ut=>Mg({...Ut,registry:Pe});(0,F.oI)(Ne);const Je=A.E1.getSearchObject(),ot=new Al,lt=new tg(A.E1,ot);ot.setKioskModeFromUrl(Je.kiosk);try{(0,Op.rb)()}catch(Ut){console.warn("Failed to clean up old expanded folders",Ut)}this.context={backend:bo.ae,location:A.E1,chrome:ot,keybindings:lt,config:Y.default},(0,C.s)(document.getElementById("reactRoot")).render(a.createElement(Rf,{app:this}))}catch(K){console.error("Failed to start Grafana",K),window.__grafana_load_failed()}finally{Jo("frontend_app_init")}}}function Fh(){du.length>0&&du[0].addExtensionReducers()}function Kh(){du.length>0&&du[0].init()}function Vh(){(0,k.tz)(new Ks({debug:!1})),window.addEventListener("load",U=>{const K="frontend_boot_load_time_seconds",z="frontend_boot_js_done_time_seconds",te="frontend_boot_css_time_seconds";performance&&(performance.mark(K),Jl("first-paint","frontend_boot_","_time_seconds"),Jl("first-contentful-paint","frontend_boot_","_time_seconds"),Jl(K),Jl(z),Jl(te))}),es.contextSrv.user.orgRole!==""&&(0,k.e6)(new Zo({})),Y.default.grafanaJavascriptAgent.enabled&&(0,k.e6)(new Zf({...Y.default.grafanaJavascriptAgent,app:{version:Y.default.buildInfo.version,environment:Y.default.buildInfo.env},buildInfo:Y.default.buildInfo,user:{id:String(Y.default.bootData.user?.id),email:Y.default.bootData.user?.email}})),Y.default.googleAnalyticsId&&(0,k.e6)(new $f({googleAnalyticsId:Y.default.googleAnalyticsId})),Y.default.googleAnalytics4Id&&(0,k.e6)(new Nd({googleAnalyticsId:Y.default.googleAnalytics4Id,googleAnalytics4SendManualPageViews:Y.default.googleAnalytics4SendManualPageViews})),Y.default.rudderstackWriteKey&&Y.default.rudderstackDataPlaneUrl&&(0,k.e6)(new _f({writeKey:Y.default.rudderstackWriteKey,dataPlaneUrl:Y.default.rudderstackDataPlaneUrl,user:Y.default.bootData.user,sdkUrl:Y.default.rudderstackSdkUrl,configUrl:Y.default.rudderstackConfigUrl,buildInfo:Y.default.buildInfo})),Y.default.applicationInsightsConnectionString&&(0,k.e6)(new Vf({connectionString:Y.default.applicationInsightsConnectionString,endpointUrl:Y.default.applicationInsightsEndpointUrl}))}function $h(){(0,G.n)()>0&&document.body.classList.add("no-overlay-scrollbar")}function Jl(U,K="",z=""){const te=D().first(performance.getEntriesByName(U));if(te){const fe=te.name.replace(/-/g,"_");Ul(`${K}${fe}${z}`,Math.round(te.startTime)/1e3)}}const _h=new Wh;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,_h.init()},62862:(j,I,e)=>{"use strict";e.d(I,{As:()=>t,TE:()=>s,Z9:()=>n,_M:()=>i,sK:()=>r});var t=(g=>(g.Active="active",g.Expired="expired",g.Pending="pending",g))(t||{}),n=(g=>(g.Unprocessed="unprocessed",g.Active="active",g.Suppressed="suppressed",g))(n||{}),i=(g=>(g.equal="=",g.notEqual="!=",g.regex="=~",g.notRegex="!~",g))(i||{}),s=(g=>(g.Internal="internal",g.External="external",g.All="all",g))(s||{}),r=(g=>(g.cortex="cortex",g.mimir="mimir",g.prometheus="prometheus",g))(r||{})},89967:(j,I,e)=>{"use strict";e.d(I,{$5:()=>n,MQ:()=>i,Rv:()=>g,az:()=>r});const t={statistics:[]};var n=(l=>(l[l.Query=1]="Query",l[l.Search=0]="Search",l))(n||{}),i=(l=>(l[l.Builder=0]="Builder",l[l.Code=1]="Code",l))(i||{});const s={parameters:[]};var r=(l=>(l.And="and",l.Function="function",l.FunctionParameter="functionParameter",l.GroupBy="groupBy",l.Operator="operator",l.Or="or",l.Property="property",l))(r||{}),g=(l=>(l.String="string",l))(g||{});const d={logGroupNames:[],logGroups:[],statsGroups:[]}},14180:(j,I,e)=>{"use strict";e.d(I,{$5:()=>t.$5,KB:()=>n,MQ:()=>t.MQ,wf:()=>i});var t=e(89967),n=(s=>(s.Scheduled="Scheduled",s.Running="Running",s.Complete="Complete",s.Failed="Failed",s.Cancelled="Cancelled",s.Timeout="Timeout",s))(n||{}),i=(s=>(s.Regions="regions",s.Namespaces="namespaces",s.Metrics="metrics",s.DimensionKeys="dimensionKeys",s.DimensionValues="dimensionValues",s.EBSVolumeIDs="ebsVolumeIDs",s.EC2InstanceAttributes="ec2InstanceAttributes",s.ResourceArns="resourceARNs",s.Statistics="statistics",s.LogGroups="logGroups",s.Accounts="accounts",s))(i||{})},36617:(j,I,e)=>{"use strict";e.d(I,{hD:()=>A,oe:()=>g.o,yl:()=>d,AK:()=>l});var t=e(48592),n=e(69376),i=e(53933),s=e(8508),r=e(75261),g=e(5264);function d(W){return W?typeof W=="string"?W===g.o:"meta"in W&&W.meta.name===g.o||W.uid===g.o:!1}function l(W,w){return new t.y(N=>{const F=(0,r.h4)().getCurrent(),k=u(W.queries);if(!k){N.next(o("Missing panel reference ID"));return}const H=F?.getPanelById(k);if(!H){N.next(o("Unknown Panel: "+k));return}const R=H.getQueryRunner(),_=R.getData({withTransforms:!!w?.withTransforms,withFieldConfig:!1}).subscribe({next:G=>{w?.topic===n.w5.Annotations&&(G={...G,series:G.annotations??[],annotations:void 0}),N.next(G)}});if(!H.isInView){const{datasource:G,targets:Y}=H,X={...W,datasource:G,panelId:k,queries:Y};R.run(X)}return()=>{_.unsubscribe()}})}function u(W){if(!(!W||!W.length))return W[0].panelId}function o(W){return{state:i.Gu.Error,series:[],request:{},error:{message:W},timeRange:(0,s.JK)()}}var m=e(42844),c=e(87911),p=e(6772),f=e.n(p),E=e(27702),h=e(25111),y=e(66310),v=e(22209),D=e(28580),a=e(64022),C=e(40705),P=e(42074),b=e(62108),M=e(50230),T=e(12308),S=e(5926),x=e(47802);function O(W){return JSON.stringify(W)}const B=[{label:"All data",value:!1},{label:"Annotations",value:!0,description:"Include annotations as regular data"}];function A({panelData:W,queries:w,onChange:N,onRunQueries:F}){const{value:k}=(0,h.Z)(()=>(0,S.ak)().get()),H=w[0],R=(0,E.useMemo)(()=>(0,r.h4)().getCurrent()?.getPanelById(H.panelId??-124134),[H.panelId]),{value:_,loading:G}=(0,h.Z)(async()=>{if(!R)return[];const re=await(0,S.ak)().get(R.datasource);return Promise.all(R.targets.map(async De=>{const he=De.datasource?await(0,S.ak)().get(De.datasource):re,ye=he.getQueryDisplayText||O,ce=(0,x.t)(W,De.refId)??W;return{refId:De.refId,query:ye(De),name:he.name,img:he.meta.info.logos.small,data:ce.series,error:ce.error}}))},[W,R]),Y=(0,E.useCallback)(re=>{N([re]),F()},[N,F]),X=(0,E.useCallback)(re=>{Y({...H,panelId:re})},[H,Y]),Q=(0,E.useCallback)(()=>{Y({...H,withTransforms:!H.withTransforms})},[H,Y]),se=(0,E.useCallback)(re=>{Y({...H,topic:re?n.w5.Annotations:void 0})},[H,Y]),Z=(0,E.useCallback)(re=>{const De=re.datasource??k,he=(0,S.ak)().getInstanceSettings(De)?.name,ye=re.targets.length;return`${ye} ${f()("query",ye)} to ${he}`},[k]),le=(0,r.h4)().getCurrent(),oe=!!(H.withTransforms||R?.transformations?.length),q=(0,E.useMemo)(()=>le?.panels.filter(re=>T.default.panels[re.type]&&re.targets&&re.id!==le.panelInEdit?.id&&re.datasource?.uid!==g.o).map(re=>({value:re.id,label:re.title??"Panel "+re.id,description:Z(re),imgUrl:T.default.panels[re.type].info.logos.small}))??[],[le,Z]),ne=(0,y.wW)(V),ge=(0,c.Me)();if(!le)return null;if(q.length<1)return E.createElement("p",{className:ne.noQueriesText},"This dashboard does not have any other panels. Add queries to other panels and try again.");const ae=q.find(re=>re.value===H.panelId);return E.createElement(E.Fragment,null,E.createElement(v.g,{label:"Source",description:"Use the same results as panel"},E.createElement(D.Ph,{inputId:ge,placeholder:"Choose panel",isSearchable:!0,options:q,value:ae,onChange:re=>X(re.value)})),E.createElement(a.Lh,{height:"auto",wrap:!0,align:"flex-start"},E.createElement(v.g,{label:"Data Source",description:"Use data or annotations from the panel",className:ne.horizontalField},E.createElement(C.S,{options:B,value:H.topic===n.w5.Annotations,onChange:se})),oe&&E.createElement(v.g,{label:"Transform",description:"Apply panel transformations from the source panel"},E.createElement(P.r,{value:!!H.withTransforms,onChange:Q}))),G?E.createElement(b.$,null):E.createElement(E.Fragment,null,_&&!!_.length&&E.createElement(v.g,{label:"Queries from panel"},E.createElement(a.wc,{spacing:"sm"},_.map((re,De)=>E.createElement(M.Z,{key:`DashboardQueryRow-${De}`},E.createElement(M.Z.Heading,null,re.refId),E.createElement(M.Z.Figure,null,E.createElement("img",{src:re.img,alt:re.name,title:re.name,width:40})),E.createElement(M.Z.Meta,null,re.query)))))))}function V(W){return{horizontalField:(0,m.css)({marginRight:W.spacing(2)}),noQueriesText:(0,m.css)({padding:W.spacing(1.25)})}}},5264:(j,I,e)=>{"use strict";e.d(I,{o:()=>t});const t="-- Dashboard --",n="dashboard"},28062:(j,I,e)=>{"use strict";e.d(I,{k:()=>et,e:()=>we});var t=e(89949),n=e(91053),i=e(45383),s=e(6857),r=e(39343),g=e(66784),d=e(53933),l=e(81087),u=e(72164),o=e(27938),m=e(32053),c=e(42751),p=e(39317),f=e(43685),E=e(73289),h=e(10864),y=e(85180),v=e(75261),D=e(42844),a=e(27702),C=e(66310),P=e(5229),b=e(22209),M=e(28580),T=e(42074),S=e(1041),x=e(11285),O=e(89050),B=e(79913),A=e.n(B),V=e(80369),W=e(15672),w=e(66670),N=e(64022),F=e(28981),k=e(45701),H=e(76133),R=e(73453),_=e(26468),G=e(97289);const Y="time-of-day-picker-panel",X=({minuteStep:_e=1,showHour:Ge=!0,showSeconds:qe=!1,onChange:st,value:Me,size:be="auto",disabled:Ke,disabledHours:Ye,disabledMinutes:tt,disabledSeconds:nt,placeholder:Pt,format:xt="HH:mm",defaultValue:bt=void 0,allowEmpty:Rt=!1,width:ct})=>{const it=(0,C.wW)(se),me=()=>ct?(0,D.css)` width: ${ct}px; `:(0,_.ht)()[be];return a.createElement(H.Z,{value:Me,defaultValue:bt,onChange:Ee=>st(Ee),showHour:Ge,showSecond:qe,format:xt,allowEmpty:Rt,className:(0,D.cx)(me(),it.input),popupClassName:(0,D.cx)(it.picker,Y),minuteStep:_e,inputIcon:a.createElement(Q,{wrapperStyle:it.caretWrapper}),disabled:Ke,disabledHours:Ye,disabledMinutes:tt,disabledSeconds:nt,placeholder:Pt})},Q=({wrapperStyle:_e=""})=>a.createElement("div",{className:_e},a.createElement(R.J,{name:"angle-down"})),se=_e=>{const Ge=_e.components.input.background,qe=_e.v1.palette.black,st=_e.colors.background.secondary,Me=_e.shape.borderRadius(1),be=_e.components.input.borderColor;return{caretWrapper:(0,D.css)` position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: inline-block; text-align: right; color: ${_e.colors.text.secondary}; `,picker:(0,D.css)` .rc-time-picker-panel-select { font-size: 14px; background-color: ${Ge}; border-color: ${be}; li { outline-width: 2px; &.rc-time-picker-panel-select-option-selected { background-color: inherit; border: 1px solid ${_e.v1.palette.orange}; border-radius: ${Me}; } &:hover { background: ${st}; } &.rc-time-picker-panel-select-option-disabled { color: ${_e.colors.action.disabledText}; } } } .rc-time-picker-panel-inner { box-shadow: 0px 4px 4px ${qe}; background-color: ${Ge}; border-color: ${be}; border-radius: ${Me}; margin-top: 3px; .rc-time-picker-panel-input-wrap { margin-right: 2px; &, .rc-time-picker-panel-input { background-color: ${Ge}; padding-top: 2px; } } .rc-time-picker-panel-combobox { display: flex; } } `,input:(0,D.css)` .rc-time-picker-input { background-color: ${Ge}; border-radius: ${Me}; border-color: ${be}; height: ${_e.spacing(4)}; &:focus { ${(0,G.focusCss)(_e)} } &:disabled { background-color: ${_e.colors.action.disabledBackground}; color: ${_e.colors.action.disabledText}; border: 1px solid ${_e.colors.action.disabledBackground}; &:focus { box-shadow: none; } } } .rc-time-picker-clear { position: absolute; right: 20px; top: 50%; cursor: pointer; overflow: hidden; transform: translateY(-50%); color: ${_e.colors.text.secondary}; } `}},Z=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"].map((_e,Ge)=>({label:_e,value:Ge+1})),le=({value:_e,onChange:Ge})=>{const qe=(0,C.wW)(oe),st=Date.now(),Me=(0,V.Pr)(_e.timezone??"utc",st),be=(0,v.h4)().getCurrent()?.getTimezone()===_e.timezone,[Ke,Ye]=(0,a.useState)(!1),tt=()=>{Ye(!Ke)},nt=Ee=>{if(!Ee)return;const Ce=A()();if(Ee){const Ae=Ee.split(":");Ce.set("hour",parseInt(Ae[0],10)),Ce.set("minute",parseInt(Ae[1],10))}return Ce},Pt=()=>{let Ee="Everyday";return _e.fromDayOfWeek&&!_e.toDayOfWeek&&(Ee=Z[_e.fromDayOfWeek-1].label),Ee},xt=()=>{const Ee=a.createElement(a.Fragment,null,a.createElement(k.d,{title:Me?.name}),a.createElement(F.v,{timeZone:_e.timezone,timestamp:st}));return be?a.createElement(a.Fragment,null,"Dashboard timezone (",Ee,")"):Ee},bt=(Ee,Ce)=>{const Ae=Ee?Ee.format("HH:mm"):void 0;Ge(Ce==="from"?{..._e,from:Ae}:{..._e,to:Ae})},Rt=Ee=>{Ge({..._e,timezone:Ee})},ct=Ee=>{const Ce=Ee?Ee.value:void 0,Ae=Ee?_e.toDayOfWeek:void 0;Ge({..._e,fromDayOfWeek:Ce,toDayOfWeek:Ae})},it=Ee=>{Ge({..._e,toDayOfWeek:Ee?Ee.value:void 0})},me=()=>Ke?a.createElement(W.O,{value:_e.timezone,includeInternal:!0,onChange:Ee=>Rt(Ee),onBlur:()=>Ye(!1),openMenuOnFocus:!1,width:100,autoFocus:!0}):a.createElement("div",{className:qe.timezoneContainer},a.createElement("div",{className:qe.timezone},xt()),a.createElement(w.zx,{variant:"secondary",onClick:tt,size:"sm"},"Change timezone"));return a.createElement(P.C,{className:qe.wrapper},a.createElement(b.g,{label:"From"},a.createElement(N.Lh,{spacing:"xs"},a.createElement(M.Ph,{options:Z,isClearable:!0,placeholder:"Everyday",value:_e.fromDayOfWeek??null,onChange:Ee=>ct(Ee),width:20}),a.createElement(X,{value:nt(_e.from),onChange:Ee=>bt(Ee,"from"),allowEmpty:!0,placeholder:"HH:mm",width:100}))),a.createElement(b.g,{label:"To"},a.createElement(N.Lh,{spacing:"xs"},(_e.fromDayOfWeek||_e.toDayOfWeek)&&a.createElement(M.Ph,{options:Z,isClearable:!0,placeholder:Pt(),value:_e.toDayOfWeek??null,onChange:Ee=>it(Ee),width:20}),a.createElement(X,{value:nt(_e.to),onChange:Ee=>bt(Ee,"to"),allowEmpty:!0,placeholder:"HH:mm",width:100}))),a.createElement(b.g,{label:"Timezone"},me()))},oe=_e=>({wrapper:(0,D.css)({maxWidth:_e.spacing(60),marginBottom:_e.spacing(2)}),timezoneContainer:(0,D.css)` padding: 5px; display: flex; flex-direction: row; justify-content: space-between; align-items: center; font-size: 12px; `,timezone:(0,D.css)` margin-right: 5px; `}),q="Enabling this returns annotations that match any of the tags specified below",ne=a.createElement("div",null,"Specify a list of tags to match. To specify a key and value tag use `key:value` syntax."),ge=[{label:"Dashboard",value:O._$.Dashboard,description:"Query for events created on this dashboard and show them in the panels where they where created"},{label:"Tags",value:O._$.Tags,description:"This will fetch any annotation events that match the tags filter"}],ae=[{label:"Annotations & Alerts",value:O.hR.Annotations,description:"Show annotations or alerts managed by grafana"},{label:"Time regions",value:O.hR.TimeRegions,description:"Configure a repeating time region"}],re=[10,50,100,200,300,500,1e3,2e3].map(_e=>({label:String(_e),value:_e}));function De({query:_e,onChange:Ge}){const qe=_e,{limit:st,matchAny:Me,tags:be,type:Ke,queryType:Ye}=qe;let tt=Ye??O.hR.Annotations;const nt=(0,a.useMemo)(()=>(0,v.h4)().dashboard?.getTimezone(),[]),Pt=(0,C.wW)(he),xt=Ee=>Ge({...qe,type:Ee.value}),bt=Ee=>Ge({...qe,limit:Ee.value}),Rt=Ee=>Ge({...qe,matchAny:Ee.target.checked}),ct=Ee=>Ge({...qe,tags:Ee}),it=Ee=>{const Ce={...qe,queryType:Ee.value};Ce.queryType===O.hR.TimeRegions?Ce.timeRegion||(Ce.timeRegion={timezone:nt}):delete Ce.timeRegion,Ge(Ce)},me=Ee=>{Ge({...qe,timeRegion:Ee})};return a.createElement(P.C,{className:Pt.container},a.createElement(b.g,{label:"Query type"},a.createElement(M.Ph,{inputId:"grafana-annotations__query-type",options:ae,value:tt,onChange:it})),tt===O.hR.Annotations&&a.createElement(a.Fragment,null,a.createElement(b.g,{label:"Filter by"},a.createElement(M.Ph,{inputId:"grafana-annotations__filter-by",options:ge,value:Ke,onChange:xt})),a.createElement(b.g,{label:"Max limit"},a.createElement(M.Ph,{inputId:"grafana-annotations__limit",width:16,options:re,value:st,onChange:bt})),Ke===O._$.Tags&&a.createElement(a.Fragment,null,a.createElement(b.g,{label:"Match any",description:q},a.createElement(T.r,{id:"grafana-annotations__match-any",value:Me,onChange:Rt})),a.createElement(b.g,{label:"Tags",description:ne},a.createElement(S.D,{allowCustomValue:!0,inputId:"grafana-annotations__tags",onChange:ct,tagOptions:x.lK,tags:be??[]})))),tt===O.hR.TimeRegions&&qe.timeRegion&&a.createElement(le,{value:qe.timeRegion,onChange:me}))}const he=_e=>({container:(0,D.css)({maxWidth:_e.spacing(60),marginBottom:_e.spacing(2)})});var ye=e(29241),ce=e(78526);function We(_e,Ge,qe,st){if(!Ge)return;const Me=(0,ce.q7)(Ge,qe);if(!Me.length)return;const be=[],Ke=[],Ye=[],tt=Ge.timezone??st;for(const nt of Me){let Pt=nt.from,xt=nt.to;const bt=(0,V.Pr)(tt,Pt);if(bt){const Rt=bt.offsetInMins*60*1e3;Pt+=Rt,xt+=Rt}be.push(Pt),Ke.push(xt),Ye.push(_e)}return{fields:[{name:"time",type:ye.fS.time,values:be,config:{}},{name:"timeEnd",type:ye.fS.time,values:Ke,config:{}},{name:"text",type:ye.fS.string,values:Ye,config:{}}],length:be.length}}let ke=100;class et extends c.CK{constructor(Ge){super(Ge),this.annotations={QueryEditor:De,prepareAnnotation(qe){return qe.target=qe.target??{type:qe.type??O._$.Dashboard,limit:qe.limit??100,tags:qe.tags??[],matchAny:qe.matchAny??!1},qe},prepareQuery(qe){let st;if((0,t.isString)(qe.datasource)){const Ke=(0,y.p)(qe.datasource,{returnDefaultAsNull:!1});Ke&&(st=Ke)}else st=qe.datasource;const{filter:Me,...be}=qe;return{...be,refId:qe.name,queryType:O.hR.Annotations,datasource:st}}}}getDefaultQuery(){return{queryType:O.hR.RandomWalk}}query(Ge){const qe=[],st=[],Me=(0,p.J)();for(const be of Ge.targets){if(be.queryType===O.hR.Annotations)return(0,n.D)(this.getAnnotations({range:Ge.range,rangeRaw:Ge.range.raw,annotation:be,dashboard:(0,v.h4)().getCurrent()}));if(!be.hide){if(be.queryType===O.hR.Snapshot){qe.push((0,i.of)({data:(be.snapshot??[]).map(Ke=>(0,g.vP)(Ke)),state:d.Gu.Done}));continue}if(be.queryType===O.hR.TimeRegions){const Ke=We("",be.timeRegion,Ge.range,Ge.timezone);qe.push((0,i.of)({data:Ke?[Ke]:[],state:d.Gu.Done}));continue}if(be.queryType===O.hR.LiveMeasurements){let Ke=Me.replace(be.channel,Ge.scopedVars);const{filter:Ye}=be,tt=(0,l.H7)(Ke);if(!(0,l.nU)(tt))continue;const nt={maxLength:Ge.maxDataPoints??500};be.buffer?(nt.maxDelta=be.buffer,nt.maxLength=nt.maxLength*2):Ge.rangeRaw?.to==="now"&&(nt.maxDelta=Ge.range.to.valueOf()-Ge.range.from.valueOf()),qe.push((0,f.gj)().getDataStream({key:`${Ge.requestId}.${ke++}`,addr:tt,filter:Ye,buffer:nt}))}else be.queryType||(be.queryType=O.hR.RandomWalk),st.push(be)}}return st.length&&qe.push(super.query({...Ge,targets:st})),qe.length?qe.length===1?qe[0]:(0,s.T)(...qe):(0,i.of)()}listFiles(Ge){return this.query({targets:[{refId:"A",queryType:O.hR.List,path:Ge}]}).pipe((0,r.U)(qe=>{const st=qe.data[0]??new u.v;return new o.U(st)}))}metricFindQuery(Ge){return Promise.resolve([])}async getAnnotations(Ge){const qe=Ge.annotation.target;if(qe?.queryType===O.hR.TimeRegions){const Ye=We(Ge.annotation.name,qe.timeRegion,Ge.range,(0,v.h4)().getCurrent()?.timezone);return Promise.resolve({data:Ye?[Ye]:[]})}const st=Ge.annotation,Me=st.target,be={from:Ge.range.from.valueOf(),to:Ge.range.to.valueOf(),limit:Me.limit,tags:Me.tags,matchAny:Me.matchAny};if(Me.type===O._$.Dashboard){if(!Ge.dashboard.uid)return Promise.resolve({data:[]});be.dashboardUID=Ge.dashboard.uid,delete be.tags}else{if(!Array.isArray(Me.tags)||Me.tags.length===0)return Promise.resolve({data:[]});const Ye=(0,p.J)(),tt="__delimiter__",nt=[];for(const Pt of be.tags){const xt=Ye.replace(Pt,{},bt=>typeof bt=="string"?bt:bt.join(tt));for(const bt of xt.split(tt))nt.push(bt)}be.tags=nt}const Ke=await(0,E.i)().get("/api/annotations",be,`grafana-data-source-annotations-${st.name}-${Ge.dashboard?.uid}`);return{data:[(0,m.g0)(Ke)]}}testDatasource(){return Promise.resolve({message:"",status:""})}}async function we(){return await(0,h.F)().get("-- Grafana --")}},89050:(j,I,e)=>{"use strict";e.d(I,{_$:()=>s,hR:()=>t,ip:()=>i,wi:()=>n});var t=(r=>(r.LiveMeasurements="measurements",r.Annotations="annotations",r.Snapshot="snapshot",r.TimeRegions="timeRegions",r.RandomWalk="randomWalk",r.List="list",r.Read="read",r.Search="search",r))(t||{});const n={refId:"A",queryType:"randomWalk"},i={refId:"A",datasource:{type:"grafana",uid:"grafana"},queryType:"snapshot",snapshot:[]};var s=(r=>(r.Dashboard="dashboard",r.Tags="tags",r))(s||{})},75506:(j,I,e)=>{"use strict";e.d(I,{F:()=>d,k:()=>u});var t=e(66784),n=e(5933),i=e(22513),s=e(40397),r=e(43620),g=e(89050);function d(o,m){return new Promise(c=>{if(o.datasource?.uid===i.JY){l(m,o),c(!0);return}n.Z.publish(new r.VJ({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(m,o),c(!0)},onDismiss:()=>{c(!1)}}))})}function l(o,m){const c=o.map(f=>(0,t.Y)(f)),p={refId:"A",queryType:g.hR.Snapshot,snapshot:c,datasource:{uid:i.JY}};m.updateQueries({dataSource:{uid:i.JY},queries:[p]}),m.refresh()}function u(o){return(m,c,p)=>{s.eM(m).subscribe(async f=>{const E=[];f.dataFrames.forEach(h=>{const y=(0,t.Y)(h);E.push(y)}),o({...g.ip,snapshot:E,file:f.file},c)})}}},10315:(j,I,e)=>{"use strict";e.d(I,{Wp:()=>g,c6:()=>l,xM:()=>s});var t=e(72164),n=e(29241),i=e(28382);function s(u){const o=u.spans.map(c=>r(c,u.processes)),m=new t.v({fields:[{name:"traceID",type:n.fS.string},{name:"spanID",type:n.fS.string},{name:"parentSpanID",type:n.fS.string},{name:"operationName",type:n.fS.string},{name:"serviceName",type:n.fS.string},{name:"serviceTags",type:n.fS.other},{name:"startTime",type:n.fS.number},{name:"duration",type:n.fS.number},{name:"logs",type:n.fS.other},{name:"tags",type:n.fS.other},{name:"warnings",type:n.fS.other},{name:"stackTraces",type:n.fS.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"jaeger"}}});for(const c of o)m.add(c);return m}function r(u,o){return{spanID:u.spanID,traceID:u.traceID,parentSpanID:u.references?.find(m=>m.refType==="CHILD_OF")?.spanID,operationName:u.operationName,startTime:u.startTime/1e3,duration:u.duration/1e3,logs:u.logs.map(m=>({...m,timestamp:m.timestamp/1e3})),tags:u.tags,warnings:u.warnings??void 0,stackTraces:u.stackTraces,serviceName:o[u.processID].serviceName,serviceTags:o[u.processID].tags}}function g(u,o){const m=new t.v({fields:[{name:"traceID",type:n.fS.string,config:{unit:"string",displayNameFromDS:"Trace ID",links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:o.uid,datasourceName:o.name,query:{query:"${__value.raw}"}}}]}},{name:"traceName",type:n.fS.string,config:{displayNameFromDS:"Trace name"}},{name:"startTime",type:n.fS.time,config:{displayNameFromDS:"Start time"}},{name:"duration",type:n.fS.number,config:{displayNameFromDS:"Duration",unit:"\xB5s"}}],meta:{preferredVisualisationType:"table"}}),c=u.map(d).sort((p,f)=>f?.startTime-p?.startTime);for(const p of c)m.add(p);return m}function d(u){const o=(0,i.transformTraceData)(u);if(o)return{traceID:o.traceID,startTime:o.startTime/1e3,duration:o.duration,traceName:o.traceName}}function l(u){let o={traceID:"",spans:[],processes:{},warnings:null},m=[];for(let c=0;c<u.length;c++){const p=u.get(c);o.traceID||(o.traceID=p.traceID),m.find(f=>f===p.serviceName)||(m.push(p.serviceName),o.processes[`p${m.length}`]={serviceName:p.serviceName,tags:p.serviceTags}),o.spans.push({traceID:p.traceID,spanID:p.spanID,duration:p.duration*1e3,references:p.parentSpanID?[{refType:"CHILD_OF",spanID:p.parentSpanID,traceID:p.traceID}]:[],flags:0,logs:p.logs.map(f=>({...f,timestamp:f.timestamp*1e3})),operationName:p.operationName,processID:Object.keys(o.processes).find(f=>o.processes[f].serviceName===p.serviceName)||"",startTime:p.startTime*1e3,tags:p.tags,warnings:p.warnings?p.warnings:null})}return{data:[o],total:0,limit:0,offset:0,errors:null}}},62434:(j,I,e)=>{"use strict";e.d(I,{$5:()=>t,EH:()=>s,Rd:()=>i,ZP:()=>u,md:()=>r,r8:()=>g,uR:()=>n,xY:()=>l});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+.'}],i=[{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}}" .'}],s=[{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."}],r=[{insertText:"vector",label:"vector",detail:"vector(scalar)",documentation:"Returns the scalar as a vector with no labels."}],g=[...t,...s,...r],d=[...g,...i,...n].map(o=>o.label),l={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,...i].map(o=>o.label).join("|")}`,"i"),alias:"keyword"}}},function:new RegExp(`\\b(?:${g.map(o=>o.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:/[{}(),.]/},u=l},32159:(j,I,e)=>{"use strict";e.d(I,{D:()=>h,w:()=>y});var t=e(89949),n=e.n(t),i=e(45383),s=e(91053),r=e(89707),g=e(22479),d=e(39343),l=e(28037),u=e(56469),o=e(29655),m=e(60115),c=e(68246),p=e(53933),f=e(10864),E=e(40545);const h="-- Mixed --";class y extends c.MF{constructor(a){super(a)}query(a){const C=a.targets.filter(M=>M.datasource?.uid!==h);if(!C.length)return(0,i.of)({data:[]});const P=(0,t.groupBy)(C,"datasource.uid"),b=[];for(const M in P){const T=P[M];b.push({datasource:(0,f.F)().get(T[0].datasource,a.scopedVars),targets:T})}return b.length?this.batchQueries(b,a):(0,i.of)({data:[]})}batchQueries(a,C){const P=a.filter(this.isQueryable).map((b,M)=>(0,s.D)(b.datasource).pipe((0,g.z)(T=>{const S=(0,t.cloneDeep)(C);return S.requestId=`mixed-${M}-${S.requestId||""}`,S.targets=b.targets,(0,s.D)(T.query(S)).pipe((0,d.U)(x=>({...x,data:x.data||[],state:p.Gu.Loading,key:`mixed-${M}-${x.key||""}`})),(0,l.q)(),(0,u.K)(x=>(x=(0,E.P)(x),x.message=`${T.name}: ${x.message}`,(0,i.of)([{data:[],state:p.Gu.Error,error:x,key:`mixed-${M}-${S.requestId||""}`}]))))})));return(0,r.D)(P).pipe(v(),(0,d.U)(this.finalizeResponses),(0,o.J)())}testDatasource(){return Promise.resolve({message:"",status:""})}isQueryable(a){return a&&Array.isArray(a.targets)&&a.targets.length>0}finalizeResponses(a){const{length:C}=a;if(C===0)return a;const P=a.find(b=>b.state===p.Gu.Error);return P?a.push(P):a[C-1].state=p.Gu.Done,a}}function v(){return(0,m.u)((D,a)=>a.reduce((C,P)=>(C.push.apply(C,P),C),D),[])}},85085:(j,I,e)=>{"use strict";e.d(I,{F:()=>s});var t=e(23419),n=e(85400),i=e(84848);function s(u,o,m,c="="){if(!o||!m)throw new Error("Need label to add to query.");const p=r(u);if(!p.length)return u;const f=g(o,m,c);return d(u,p,f)}function r(u){const o=t.E2.parse(u),m=[];return o.iterate({enter:({to:c,from:p,type:f})=>{if(f.id===t.m6){const E=(0,i._)(u.substring(p,c));return m.push({query:E.query,from:p,to:c}),!1}}}),m}function g(u,o,m){const c=o===1/0?"+Inf":o.toString();return{label:u,op:m,value:c}}function d(u,o,m){const c=new n.K;let p="",f=0;for(let E=0;E<o.length;E++){const h=o[E],y=E===o.length-1,v=u.substring(f,h.from),D=y?u.substring(h.to):"";l(h.query.labels,m)||h.query.labels.push(m);const a=c.renderQuery(h.query);p+=v+a+D,f=h.to}return p}function l(u,o){return u.find(m=>m.label===o.label&&m.value===o.value)}},95054:(j,I,e)=>{"use strict";e.d(I,{ZP:()=>R});var t=e(42844),n=e(6570),i=e(27702),s=e(32053),r=e(86312),g=e(45485),d=e(54916),l=e(73453),u=e(66670),o=e(66310),m=e(74273);function c(_){return typeof _=="object"&&_!==null&&"isCanceled"in _}const p=_=>{let G=!1;return{promise:new Promise((X,Q)=>{const se={isCanceled:!0};_.then(Z=>G?Q(se):X(Z)),_.catch(Z=>Q(G?se:Z))}),cancel(){G=!0}}};var f=e(73308),E=e(25472),h=e(80402),y=e(52419),v=e(64022),D=e(79978),a=e(1128),C=e(36162);const P="{}",b="__name__",M=25;function T(_){let G="";const Y=[];for(const X of _)if((X.name===b||X.selected)&&X.values&&X.values.length>0){const Q=X.values.filter(se=>se.selected).map(se=>se.name);Q.length>1?Y.push(`${X.name}=~"${Q.map(f.tU).join("|")}"`):Q.length===1&&(X.name===b?G=Q[0]:Y.push(`${X.name}="${(0,f.U9)(Q[0])}"`))}return[G,"{",Y.join(","),"}"].join("")}function S(_,G,Y){return _.map(X=>{const Q=G[X.name];if(Q){let se;if(X.name===Y&&X.values)se=X.values;else{const Z=new Set(X.values?.filter(le=>le.selected).map(le=>le.name)||[]);se=Q.map(le=>({name:le,selected:Z.has(le)}))}return{...X,loading:!1,values:se,hidden:!Q,facets:se.length}}return{...X,loading:!1,hidden:!Q,values:void 0,facets:0}})}const x=(0,h.B)(_=>({wrapper:(0,t.css)` background-color: ${_.colors.background.secondary}; padding: ${_.spacing(1)}; width: 100%; `,list:(0,t.css)` margin-top: ${_.spacing(1)}; display: flex; flex-wrap: wrap; max-height: 200px; overflow: auto; align-content: flex-start; `,section:(0,t.css)` & + & { margin: ${_.spacing(2)} 0; } position: relative; `,selector:(0,t.css)` font-family: ${_.typography.fontFamilyMonospace}; margin-bottom: ${_.spacing(1)}; `,status:(0,t.css)` padding: ${_.spacing(.5)}; color: ${_.colors.text.secondary}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* using absolute positioning because flex interferes with ellipsis */ position: absolute; width: 50%; right: 0; text-align: right; transition: opacity 100ms linear; opacity: 0; `,statusShowing:(0,t.css)` opacity: 1; `,error:(0,t.css)` color: ${_.colors.error.main}; `,valueList:(0,t.css)` margin-right: ${_.spacing(1)}; resize: horizontal; `,valueListWrapper:(0,t.css)` border-left: 1px solid ${_.colors.border.medium}; margin: ${_.spacing(1)} 0; padding: ${_.spacing(1)} 0 ${_.spacing(1)} ${_.spacing(1)}; `,valueListArea:(0,t.css)` display: flex; flex-wrap: wrap; margin-top: ${_.spacing(1)}; `,valueTitle:(0,t.css)` margin-left: -${_.spacing(.5)}; margin-bottom: ${_.spacing(1)}; `,validationStatus:(0,t.css)` padding: ${_.spacing(.5)}; margin-bottom: ${_.spacing(1)}; color: ${_.colors.text.maxContrast}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; `}));class O extends i.Component{constructor(){super(...arguments),this.valueListsRef=i.createRef(),this.state={labels:[],labelSearchTerm:"",metricSearchTerm:"",status:"Ready",error:"",validationStatus:"",valueSearchTerm:""},this.onChangeLabelSearch=G=>{this.setState({labelSearchTerm:G.target.value})},this.onChangeMetricSearch=G=>{this.setState({metricSearchTerm:G.target.value})},this.onChangeValueSearch=G=>{this.setState({valueSearchTerm:G.target.value})},this.onClickRunQuery=()=>{const G=T(this.state.labels);this.props.onChange(G)},this.onClickRunRateQuery=()=>{const Y=`rate(${T(this.state.labels)}[$__rate_interval])`;this.props.onChange(Y)},this.onClickClear=()=>{this.setState(G=>({labels:G.labels.map(X=>({...X,values:void 0,selected:!1,loading:!1,hidden:!1,facets:void 0})),labelSearchTerm:"",metricSearchTerm:"",status:"",error:"",validationStatus:"",valueSearchTerm:""})),this.props.deleteLastUsedLabels(),this.fetchValues(b,P)},this.onClickLabel=(G,Y,X)=>{const Q=this.state.labels.find(le=>le.name===G);if(!Q)return;const se=!Q.selected;let Z={selected:se};if(Q.values&&!se){const le=Q.values.map(oe=>({...oe,selected:!1}));Z={...Z,facets:0,values:le}}this.setState({labelSearchTerm:""}),this.updateLabelState(G,Z,"",()=>this.doFacettingForLabel(G))},this.onClickValue=(G,Y,X)=>{const Q=this.state.labels.find(Z=>Z.name===G);if(!Q||!Q.values)return;this.setState({labelSearchTerm:""});const se=Q.values.map(Z=>({...Z,selected:Z.name===Y?!Z.selected:Z.selected}));this.updateLabelState(G,{values:se},"",()=>this.doFacetting(G))},this.onClickMetric=(G,Y,X)=>{const Q=this.state.labels.find(le=>le.name===G);if(!Q||!Q.values)return;this.setState({metricSearchTerm:""});const se=Q.values.map(le=>({...le,selected:le.name===Y||le.selected?!le.selected:le.selected})),Z=se.some(le=>le.selected);this.updateLabelState(G,{selected:Z,values:se},"",()=>this.doFacetting(G))},this.onClickValidate=()=>{const G=T(this.state.labels);this.validateSelector(G)},this.doFacetting=G=>{const Y=T(this.state.labels);if(Y===P){const X=this.state.labels.map(Q=>({...Q,facets:0,values:void 0,hidden:!1}));this.setState({labels:X},()=>{this.state.labels.forEach(Q=>(Q.selected||Q.name===b)&&this.fetchValues(Q.name,Y))})}else this.fetchSeries(Y,G)}}updateLabelState(G,Y,X="",Q){this.setState(se=>{const Z=se.labels.map(oe=>oe.name===G?{...oe,...Y}:oe),le=X?"":se.error;return{labels:Z,status:X,error:le,validationStatus:""}},Q)}componentDidMount(){const{languageProvider:G,lastUsedLabels:Y}=this.props;if(G){const X=Y;G.start().then(()=>{let Q=G.getLabelKeys();this.fetchValues(b,P);const se=Q.map((Z,le,oe)=>({name:Z,selected:X.includes(Z),loading:!1}));this.setState({labels:se},()=>{this.state.labels.forEach(Z=>{Z.selected&&this.fetchValues(Z.name,P)})})})}}doFacettingForLabel(G){const Y=this.state.labels.find(Q=>Q.name===G);if(!Y)return;const X=this.state.labels.filter(Q=>Q.selected).map(Q=>Q.name);this.props.storeLastUsedLabels(X),Y.selected?Y.values||this.fetchValues(G,T(this.state.labels)):this.doFacetting()}async fetchValues(G,Y){const{languageProvider:X}=this.props;this.updateLabelState(G,{loading:!0},`Fetching values for ${G}`);try{let Q=await X.getLabelValues(G);if(Y!==T(this.state.labels)){this.updateLabelState(G,{loading:!1});return}const se=[],{metricsMetadata:Z}=X;for(const le of Q){const oe={name:le};if(G===b&&Z){const q=Z[le];q&&(oe.details=`(${q.type}) ${q.help}`)}se.push(oe)}this.updateLabelState(G,{values:se,loading:!1})}catch(Q){console.error(Q)}}async fetchSeries(G,Y){const{languageProvider:X}=this.props;Y&&this.updateLabelState(Y,{loading:!0},`Facetting labels for ${G}`);try{const Q=await X.fetchSeriesLabels(G,!0);if(G!==T(this.state.labels)){Y&&this.updateLabelState(Y,{loading:!1});return}if(Object.keys(Q).length===0){this.setState({error:`Empty results, no matching label for ${G}`});return}const se=S(this.state.labels,Q,Y);this.setState({labels:se,error:""}),Y&&this.updateLabelState(Y,{loading:!1})}catch(Q){console.error(Q)}}async validateSelector(G){const{languageProvider:Y}=this.props;this.setState({validationStatus:`Validating selector ${G}`,error:""});const X=await Y.fetchSeries(G);this.setState({validationStatus:`Selector is valid (${X.length} series found)`})}render(){const{theme:G}=this.props,{labels:Y,labelSearchTerm:X,metricSearchTerm:Q,status:se,error:Z,validationStatus:le,valueSearchTerm:oe}=this.state,q=x(G);if(Y.length===0)return i.createElement("div",{className:q.wrapper},i.createElement(y.u,{text:"Loading labels..."}));let ne=Y.find(ye=>ye.name===b);ne&&Q&&(ne={...ne,values:ne.values?.filter(ye=>ye.selected||ye.name.includes(Q))});let ge=Y.filter(ye=>!ye.hidden&&ye.name!==b);X&&(ge=ge.filter(ye=>ye.selected||ye.name.includes(X)));let ae=ge.filter(ye=>ye.selected&&ye.values);oe&&(ae=ae.map(ye=>({...ye,values:ye.values?.filter(ce=>ce.selected||ce.name.includes(oe))})));const re=T(this.state.labels),De=re===P,he=ne?.values?.length||0;return i.createElement("div",{className:q.wrapper},i.createElement(v.Lh,{align:"flex-start",spacing:"lg"},i.createElement("div",null,i.createElement("div",{className:q.section},i.createElement(D._,{description:"Once a metric is selected only possible labels are shown."},"1. Select a metric"),i.createElement("div",null,i.createElement(a.I,{onChange:this.onChangeMetricSearch,"aria-label":"Filter expression for metric",value:Q})),i.createElement("div",{role:"list",className:q.valueListWrapper},i.createElement(E.t7,{height:Math.min(450,he*M),itemCount:he,itemSize:M,itemKey:ye=>ne.values[ye].name,width:300,className:q.valueList},({index:ye,style:ce})=>{const We=ne?.values?.[ye];return We?i.createElement("div",{style:ce},i.createElement(C._,{name:ne.name,value:We?.name,title:We.details,active:We?.selected,onClick:this.onClickMetric,searchTerm:Q})):null})))),i.createElement("div",null,i.createElement("div",{className:q.section},i.createElement(D._,{description:"Once label values are selected, only possible label combinations are shown."},"2. Select labels to search in"),i.createElement("div",null,i.createElement(a.I,{onChange:this.onChangeLabelSearch,"aria-label":"Filter expression for label",value:X})),i.createElement("div",{className:q.list,style:{height:120}},ge.map(ye=>i.createElement(C._,{key:ye.name,name:ye.name,loading:ye.loading,active:ye.selected,hidden:ye.hidden,facets:ye.facets,onClick:this.onClickLabel,searchTerm:X})))),i.createElement("div",{className:q.section},i.createElement(D._,{description:"Use the search field to find values across selected labels."},"3. Select (multiple) values for your labels"),i.createElement("div",null,i.createElement(a.I,{onChange:this.onChangeValueSearch,"aria-label":"Filter expression for label values",value:oe})),i.createElement("div",{className:q.valueListArea,ref:this.valueListsRef},ae.map(ye=>i.createElement("div",{role:"list",key:ye.name,"aria-label":`Values for ${ye.name}`,className:q.valueListWrapper},i.createElement("div",{className:q.valueTitle},i.createElement(C._,{name:ye.name,loading:ye.loading,active:ye.selected,hidden:ye.hidden,facets:ye.facets||ye.values?.length,onClick:this.onClickLabel})),i.createElement(E.t7,{height:Math.min(200,M*(ye.values?.length||0)),itemCount:ye.values?.length||0,itemSize:28,itemKey:ce=>ye.values[ce].name,width:200,className:q.valueList},({index:ce,style:We})=>{const ke=ye.values?.[ce];return ke?i.createElement("div",{style:We},i.createElement(C._,{name:ye.name,value:ke?.name,active:ke?.selected,onClick:this.onClickValue,searchTerm:oe})):null}))))))),i.createElement("div",{className:q.section},i.createElement(D._,null,"4. Resulting selector"),i.createElement("div",{"aria-label":"selector",className:q.selector},re),le&&i.createElement("div",{className:q.validationStatus},le),i.createElement(v.Lh,null,i.createElement(u.zx,{"aria-label":"Use selector for query button",disabled:De,onClick:this.onClickRunQuery},"Use query"),i.createElement(u.zx,{"aria-label":"Use selector as metrics button",variant:"secondary",disabled:De,onClick:this.onClickRunRateQuery},"Use as rate query"),i.createElement(u.zx,{"aria-label":"Validate submit button",variant:"secondary",disabled:De,onClick:this.onClickValidate},"Validate selector"),i.createElement(u.zx,{"aria-label":"Selector clear button",variant:"secondary",onClick:this.onClickClear},"Clear"),i.createElement("div",{className:(0,t.cx)(q.status,(se||Z)&&q.statusShowing)},i.createElement("span",{className:Z?q.error:""},Z||se)))))}}const B=(0,o.HE)(O),A=i.lazy(()=>e.e(6031).then(e.bind(e,6911))),V=_=>i.createElement(i.Suspense,{fallback:null},i.createElement(A,{..._})),W=_=>{const G=(0,i.useRef)(null),{onRunQuery:Y,onChange:X,...Q}=_,se=oe=>{G.current=oe,X(oe),Y()},Z=oe=>{X(oe)},le=oe=>{X(oe)};return i.createElement(V,{onChange:le,onRunQuery:se,onBlur:Z,...Q})},w="__recording_rules__",N="grafana.datasources.prometheus.browser.labels";function F(_,G,Y){return _?"(Disabled)":G?Y?"Metrics browser":"(No metrics found)":"Loading metrics..."}function k(_,{typeaheadContext:G,typeaheadText:Y}){switch(G){case"context-labels":{const X=DOMUtil.getNextCharacter();(!X||X==="}"||X===",")&&(_+="=");break}case"context-label-values":{Y.match(/^(!?=~?"|")/)||(_=`"${_}`),DOMUtil.getNextCharacter()!=='"'&&(_=`${_}"`);break}default:}return _}class H extends i.PureComponent{constructor(G,Y){super(G,Y),this.refreshHint=()=>{const{datasource:X,query:Q,data:se}=this.props,Z=X.getInitHints(),le=Z.length>0?Z[0]:null;if(!se||se.series.length===0){this.setState({hint:le});return}const oe=(0,s.aY)(se.series[0])?se.series.map(s.Zr):se.series,q=X.getQueryHints(Q,oe);let ne=q.length>0?q[0]:null;this.setState({hint:ne??le})},this.refreshMetrics=async()=>{const{datasource:{languageProvider:X}}=this.props;this.languageProviderInitializationPromise=p(X.start());try{const Q=await this.languageProviderInitializationPromise.promise;await Promise.all(Q),this.onUpdateLanguage()}catch(Q){if(!(c(Q)&&Q.isCanceled))throw Q}},this.onChangeLabelBrowser=X=>{this.onChangeQuery(X,!0),this.setState({labelBrowserVisible:!1})},this.onChangeQuery=(X,Q)=>{const{query:se,onChange:Z,onRunQuery:le}=this.props;if(Z){const oe={...se,expr:X};Z(oe),Q&&le&&le()}},this.onClickChooserButton=()=>{this.setState(X=>({labelBrowserVisible:!X.labelBrowserVisible})),(0,r.ff)("user_grafana_prometheus_metrics_browser_clicked",{editorMode:this.state.labelBrowserVisible?"metricViewClosed":"metricViewOpen",app:this.props?.app??""})},this.onClickHintFix=()=>{const{datasource:X,query:Q,onChange:se,onRunQuery:Z}=this.props,{hint:le}=this.state;le?.fix?.action&&se(X.modifyQuery(Q,le.fix.action)),Z()},this.onUpdateLanguage=()=>{const{datasource:{languageProvider:X}}=this.props,{metrics:Q}=X;Q&&this.setState({syntaxLoaded:!0})},this.onTypeahead=async X=>{const{datasource:{languageProvider:Q}}=this.props;if(!Q)return{suggestions:[]};const{history:se}=this.props,{prefix:Z,text:le,value:oe,wrapperClasses:q,labelKey:ne}=X;return await Q.provideCompletionItems({text:le,value:oe,prefix:Z,wrapperClasses:q,labelKey:ne},{history:se})},this.plugins=[(0,g.h)(),(0,d.Z)({onlyIn:X=>X.type==="code_block",getSyntax:X=>"promql"},{...n.languages,promql:this.props.datasource.languageProvider.syntax})],this.state={labelBrowserVisible:!1,syntaxLoaded:!1,hint:null}}componentDidMount(){this.props.datasource.languageProvider&&this.refreshMetrics(),this.refreshHint()}componentWillUnmount(){this.languageProviderInitializationPromise&&this.languageProviderInitializationPromise.cancel()}componentDidUpdate(G){const{data:Y,datasource:{languageProvider:X},range:Q}=this.props;X!==G.datasource.languageProvider&&this.setState({syntaxLoaded:!1});const se=this.rangeChangedToRefresh(Q,G.range);(X!==G.datasource.languageProvider||se)&&this.refreshMetrics(),Y&&G.data&&G.data.series!==Y.series&&this.refreshHint()}rangeChangedToRefresh(G,Y){if(G&&Y){const X=(0,f.o8)(G.from.valueOf())===(0,f.o8)(Y.from.valueOf()),Q=(0,f.o8)(G.to.valueOf())===(0,f.o8)(Y.to.valueOf());return!(X&&Q)}return!1}render(){const{datasource:G,datasource:{languageProvider:Y},query:X,ExtraFieldElement:Q,history:se=[],theme:Z}=this.props,{labelBrowserVisible:le,syntaxLoaded:oe,hint:q}=this.state,ne=Y.metrics.length>0,ge=F(G.lookupsDisabled,oe,ne),ae=!(oe&&ne);return i.createElement(m.G,{storageKey:N,defaultValue:[]},(re,De,he)=>i.createElement(i.Fragment,null,i.createElement("div",{className:"gf-form-inline gf-form-inline--xs-view-flex-column flex-grow-1","data-testid":this.props["data-testid"]},i.createElement("button",{className:"gf-form-label query-keyword pointer",onClick:this.onClickChooserButton,disabled:ae,type:"button"},ge,i.createElement(l.J,{name:le?"angle-down":"angle-right"})),i.createElement("div",{className:"gf-form gf-form--grow flex-shrink-1 min-width-15"},i.createElement(W,{languageProvider:Y,history:se,onChange:this.onChangeQuery,onRunQuery:this.props.onRunQuery,initialValue:X.expr??"",placeholder:"Enter a PromQL query\u2026"}))),le&&i.createElement("div",{className:"gf-form"},i.createElement(B,{languageProvider:Y,onChange:this.onChangeLabelBrowser,lastUsedLabels:re||[],storeLastUsedLabels:De,deleteLastUsedLabels:he})),Q,q?i.createElement("div",{className:"query-row-break"},i.createElement("div",{className:"prom-query-field-info text-warning"},q.label," ",q.fix?i.createElement("button",{type:"button",className:(0,t.cx)((0,u.gN)(Z),"text-link","muted"),onClick:this.onClickHintFix},q.fix.label):null)):null))}}const R=(0,o.HE)(H)},83923:(j,I,e)=>{"use strict";e.d(I,{Z5:()=>Rt,Fu:()=>bt,Zg:()=>ct,lj:()=>me,b0:()=>it});var t=e(42844),n=e(27702),i=e(84923),s=e(77195),r=e(19010),g=e(66310),d=e(63439),l=e(49257),u=e(59904),o=e(12308),m=e(78102),c=e(34667),p=e(48024),f=e(42074);function E({options:Ee,onOptionsChange:Ce}){const Ae=(0,g.l4)(),ze=me(Ae),Ie=c.config.featureToggles.prometheusConfigOverhaulAuth;return n.createElement(m._,{title:"Alerting",className:(0,t.cx)(ze.container,{[ze.alertingTop]:Ie})},n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p._,{labelWidth:30,label:"Manage alerts via Alerting UI",disabled:Ee.readOnly,tooltip:n.createElement(n.Fragment,null,"Manage alert rules for this data source. To manage other alerting resources, add an Alertmanager data source. ",ct()),interactive:!0,className:ze.switchField},n.createElement(f.r,{value:Ee.jsonData.manageAlerts!==!1,onChange:xe=>Ce({...Ee,jsonData:{...Ee.jsonData,manageAlerts:xe.currentTarget.checked}})}))))))}var h=e(71107),y=e(1128),v=(Ee=>(Ee.Public="AzureCloud",Ee.China="AzureChinaCloud",Ee.USGovernment="AzureUSGovernment",Ee.None="",Ee))(v||{});const D=[{value:"AzureCloud",label:"Azure"},{value:"AzureChinaCloud",label:"Azure China"},{value:"AzureUSGovernment",label:"Azure US Government"}];function a(Ee){switch(Ee.authType){case"msi":case"workloadidentity":return!0;case"clientsecret":return!!(Ee.azureCloud&&Ee.tenantId&&Ee.clientId&&Ee.clientSecret)}}const C=Symbol("Concealed client secret");function P(){return c.config.azure.cloud||v.Public}function b(Ee){if(Ee.secureJsonFields.azureClientSecret)return C;{const Ce=Ee.secureJsonData?.azureClientSecret;return typeof Ce=="string"&&Ce.length>0?Ce:void 0}}function M(Ee){return!!Ee.jsonData.azureCredentials}function T(){return c.config.azure.managedIdentityEnabled?{authType:"msi"}:{authType:"clientsecret",azureCloud:P()}}function S(Ee){const Ce=Ee.jsonData.azureCredentials;if(!Ce)return T();switch(Ce.authType){case"msi":case"workloadidentity":return Ce.authType==="msi"&&c.config.azure.managedIdentityEnabled||Ce.authType==="workloadidentity"&&c.config.azure.workloadIdentityEnabled?{authType:Ce.authType}:{authType:"clientsecret",azureCloud:P()};case"clientsecret":return{authType:"clientsecret",azureCloud:Ce.azureCloud||P(),tenantId:Ce.tenantId,clientId:Ce.clientId,clientSecret:b(Ee)}}}function x(Ee,Ce){switch(Ce.authType){case"msi":case"workloadidentity":if(Ce.authType==="msi"&&!c.config.azure.managedIdentityEnabled)throw new Error("Managed Identity authentication is not enabled in Grafana config.");if(Ce.authType==="workloadidentity"&&!c.config.azure.workloadIdentityEnabled)throw new Error("Workload Identity authentication is not enabled in Grafana config.");return Ee={...Ee,jsonData:{...Ee.jsonData,azureAuthType:Ce.authType,azureCredentials:{authType:Ce.authType}}},Ee;case"clientsecret":return Ee={...Ee,jsonData:{...Ee.jsonData,azureCredentials:{authType:"clientsecret",azureCloud:Ce.azureCloud||P(),tenantId:Ce.tenantId,clientId:Ce.clientId}},secureJsonData:{...Ee.secureJsonData,azureClientSecret:typeof Ce.clientSecret=="string"&&Ce.clientSecret.length>0?Ce.clientSecret:void 0},secureJsonFields:{...Ee.secureJsonFields,azureClientSecret:typeof Ce.clientSecret=="symbol"}},Ee}}function O(Ee){return{jsonData:{...Ee.jsonData,azureCredentials:T()}}}function B(Ee){return{jsonData:{...Ee.jsonData,azureAuth:void 0,azureCredentials:void 0,azureEndpointResourceId:void 0}}}var A=e(60644),V=e(66670),W=e(83670),w=e(49918);const N=Ee=>{const{credentials:Ce,azureCloudOptions:Ae,onCredentialsChange:ze,getSubscriptions:Ie,disabled:xe,managedIdentityEnabled:Te,workloadIdentityEnabled:Oe}=Ee,ie=a(Ce),[Le,Be]=(0,n.useState)([]),[Ue,ue]=(0,n.useReducer)(_t=>_t+1,0),pe=(0,n.useMemo)(()=>{let _t=[{value:"clientsecret",label:"App Registration"}];return Te&&_t.push({value:"msi",label:"Managed Identity"}),Oe&&_t.push({value:"workloadidentity",label:"Workload Identity"}),_t},[Te,Oe]);(0,n.useEffect)(()=>{if(!Ie||!ie){$e([]);return}let _t=!1;return Ie().then(tn=>{_t||$e(tn,Ue)}),()=>{_t=!0}},[Ue]);const $e=(_t,tn=!1)=>{Be(_t),Ie&&(tn&&!Ce.defaultSubscriptionId&&_t.length>0?pt(_t[0]):Ce.defaultSubscriptionId&&(_t.find(cn=>cn.value===Ce.defaultSubscriptionId)||pt(void 0)))},Se=_t=>{Be([]);const tn=Te?"msi":Oe?"workloadidentity":"clientsecret",qt={...Ce,authType:_t.value||tn,defaultSubscriptionId:void 0};ze(qt)},Ve=_t=>{if(Ce.authType==="clientsecret"){Be([]);const tn={...Ce,azureCloud:_t.value,defaultSubscriptionId:void 0};ze(tn)}},He=_t=>{if(Ce.authType==="clientsecret"){Be([]);const tn={...Ce,tenantId:_t.target.value,defaultSubscriptionId:void 0};ze(tn)}},Ze=_t=>{if(Ce.authType==="clientsecret"){Be([]);const tn={...Ce,clientId:_t.target.value,defaultSubscriptionId:void 0};ze(tn)}},Qe=_t=>{if(Ce.authType==="clientsecret"){Be([]);const tn={...Ce,clientSecret:_t.target.value,defaultSubscriptionId:void 0};ze(tn)}},rt=()=>{if(Ce.authType==="clientsecret"){Be([]);const _t={...Ce,clientSecret:"",defaultSubscriptionId:void 0};ze(_t)}},pt=_t=>{const tn={...Ce,defaultSubscriptionId:_t?.value};ze(tn)},It=c.config.featureToggles.prometheusConfigOverhaulAuth;return n.createElement("div",{className:"gf-form-group"},pe.length>1&&n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(A.c,{className:"width-12",tooltip:"Choose the type of authentication to Azure services"},"Authentication"),n.createElement(w.Ph,{className:"width-15",value:pe.find(_t=>_t.value===Ce.authType),options:pe,onChange:Se,isDisabled:xe}))),Ce.authType==="clientsecret"&&n.createElement(n.Fragment,null,Ae&&n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(A.c,{className:"width-12",tooltip:"Choose an Azure Cloud"},"Azure Cloud"),n.createElement(w.Ph,{className:"width-15",value:Ae.find(_t=>_t.value===Ce.azureCloud),options:Ae,onChange:Ve,isDisabled:xe}))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(A.c,{className:"width-12"},"Directory (tenant) ID"),n.createElement("div",{className:"width-15"},n.createElement(W.I,{className:(0,t.cx)(It?"width-20":"width-30"),placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:Ce.tenantId||"",onChange:He,disabled:xe})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(A.c,{className:"width-12"},"Application (client) ID"),n.createElement("div",{className:"width-15"},n.createElement(W.I,{className:(0,t.cx)(It?"width-20":"width-30"),placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:Ce.clientId||"",onChange:Ze,disabled:xe})))),typeof Ce.clientSecret=="symbol"?n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(A.c,{htmlFor:"azure-client-secret",className:"width-12"},"Client Secret"),n.createElement(W.I,{id:"azure-client-secret",className:(0,t.cx)(It?"width-20":"width-25"),placeholder:"configured",disabled:!0})),!xe&&n.createElement("div",{className:"gf-form"},n.createElement("div",{className:(0,t.cx)(It?"max-width-20 gf-form-inline":"max-width-30 gf-form-inline")},n.createElement(V.zx,{variant:"secondary",type:"button",onClick:rt},"reset")))):n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(A.c,{className:"width-12"},"Client Secret"),n.createElement("div",{className:"width-15"},n.createElement(W.I,{className:(0,t.cx)(It?"width-20":"width-30"),placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:Ce.clientSecret||"",onChange:Qe,disabled:xe}))))),Ie&&n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(A.c,{className:"width-12"},"Default Subscription"),n.createElement("div",{className:(0,t.cx)(It?"width-20":"width-25")},n.createElement(w.Ph,{value:Ce.defaultSubscriptionId?Le.find(_t=>_t.value===Ce.defaultSubscriptionId):void 0,options:Le,onChange:pt,isDisabled:xe})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement("div",{className:"max-width-30 gf-form-inline"},n.createElement(V.zx,{variant:"secondary",size:"sm",type:"button",onClick:ue,disabled:!ie},"Load Subscriptions"))))))},F=null,k=Ee=>{const{dataSourceConfig:Ce,onChange:Ae}=Ee,[ze,Ie]=(0,n.useState)(!!Ce.jsonData.azureEndpointResourceId),xe=(0,n.useMemo)(()=>S(Ce),[Ce]),Te=Ue=>{Ae(x(Ce,Ue))},Oe=Ue=>{Ie(Ue.currentTarget.checked),Ue.currentTarget.checked||Ae({...Ce,jsonData:{...Ce.jsonData,azureEndpointResourceId:void 0}})},ie=Ue=>{ze&&Ae({...Ce,jsonData:{...Ce.jsonData,azureEndpointResourceId:Ue.currentTarget.value}})},Le=c.config.featureToggles.prometheusConfigOverhaulAuth,Be=Le?24:26;return n.createElement(n.Fragment,null,n.createElement("h6",null,"Azure authentication"),n.createElement(N,{managedIdentityEnabled:c.config.azure.managedIdentityEnabled,workloadIdentityEnabled:c.config.azure.workloadIdentityEnabled,credentials:xe,azureCloudOptions:D,onCredentialsChange:Te,disabled:Ce.readOnly}),n.createElement("h6",null,"Azure configuration"),n.createElement("div",{className:"gf-form-group"},n.createElement(h.Z,null,n.createElement(p._,{labelWidth:Be,label:"Override AAD audience",disabled:Ce.readOnly},n.createElement(f.x,{value:ze,onChange:Oe}))),ze&&n.createElement(h.Z,null,n.createElement(p._,{labelWidth:Be,label:"Resource ID",disabled:Ce.readOnly},n.createElement(y.I,{className:(0,t.cx)(Le?"width-20":"width-30"),value:Ce.jsonData.azureEndpointResourceId||"",onChange:ie})))))},H=null;var R=e(83320),_=e(9058),G=e(36859),Y=e(79510);const X=Ee=>{const{options:Ce,onOptionsChange:Ae,azureAuthSettings:ze,sigV4AuthToggleEnabled:Ie,renderSigV4Editor:xe,secureSocksDSProxyEnabled:Te}=Ee,Oe=(0,R.T2)({config:Ce,onChange:Ae}),ie=(0,g.l4)(),Le=me(ie);let Be=[];const[Ue,ue]=(0,n.useState)(Ce.jsonData.sigV4Auth||!1),pe="custom-sigV4Id",$e={id:pe,label:"SigV4 auth",description:"This is SigV4 auth description",component:n.createElement(n.Fragment,null,xe)};Ie&&Be.push($e);const Se=(0,n.useCallback)(_t=>{Ae({...Ce,..._t})},[Ce,Ae]),Ve=ze?.azureAuthSupported&&ze.getAzureAuthEnabled(Ce)||!1,[He,Ze]=(0,n.useState)(Ve),Qe="custom-azureAuthId",rt={id:Qe,label:"Azure auth",description:"This is Azure auth description",component:n.createElement(n.Fragment,null,ze.azureSettingsUI&&n.createElement(ze.azureSettingsUI,{dataSourceConfig:Ce,onChange:Ae}))};ze?.azureAuthSupported&&Be.push(rt);function pt(){return Ue?pe:He?Qe:Oe.selectedMethod}let It;switch(Ce.access){case"direct":It=n.createElement(n.Fragment,null,"Your access method is ",n.createElement("em",null,"Browser"),", this means the URL needs to be accessible from the browser.",ct());break;case"proxy":It=n.createElement(n.Fragment,null,"Your access method is ",n.createElement("em",null,"Server"),", this means the URL needs to be accessible from the grafana backend/server.",ct());break;default:It=n.createElement(n.Fragment,null,"Specify a complete HTTP URL (for example http://your_server:8080) ",ct())}return n.createElement(n.Fragment,null,n.createElement(_.f,{urlPlaceholder:"http://localhost:9090",config:Ce,onChange:Ae,urlLabel:"Prometheus server URL",urlTooltip:It}),n.createElement("hr",{className:`${Le.hrTopSpace} ${Le.hrBottomSpace}`}),n.createElement(G.g,{...Oe,customMethods:Be,onAuthMethodSelect:_t=>{Ie&&(ue(_t===pe),Se({jsonData:{...Ce.jsonData,sigV4Auth:_t===pe}})),ze?.azureAuthSupported&&(Ze(_t===Qe),ze.setAzureAuthEnabled(Ce,_t===Qe)),Oe.onAuthMethodSelect(_t)},selectedMethod:pt()}),n.createElement("div",{className:Le.sectionBottomPadding}),Te&&n.createElement(n.Fragment,null,n.createElement(Y.i,{options:Ce,onOptionsChange:Ae}),n.createElement("div",{className:Le.sectionBottomPadding})))};var Q=e(37865),se=e.n(Q),Z=e(17312),le=e(73289),oe=e(28580),q=e(9906),ne=e(18447),ge=e(39568),ae=e(94962),re=e(72054),De=e(74639),he=e(53229);function ye({value:Ee,onChange:Ce,onDelete:Ae,disabled:ze}){const[Ie,xe]=(0,n.useState)(!!Ee.datasourceUid),Te=(0,g.l4)(),Oe=me(Te);return n.createElement("div",{className:"gf-form-group"},n.createElement(p._,{label:"Internal link",labelWidth:bt,disabled:ze,tooltip:n.createElement(n.Fragment,null,"Enable this option if you have an internal link. When enabled, this reveals the data source selector. Select the backend tracing data store for your exemplar data. ",ct()),interactive:!0,className:Oe.switchField},n.createElement(n.Fragment,null,n.createElement(f.r,{value:Ie,"aria-label":De.wl.components.DataSource.Prometheus.configPage.internalLinkSwitch,onChange:ie=>xe(ie.currentTarget.checked)}))),Ie?n.createElement(p._,{label:"Data source",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"The data source the exemplar is going to navigate to. ",ct()),disabled:ze,interactive:!0},n.createElement(he.q,{tracing:!0,current:Ee.datasourceUid,noDefault:!0,width:40,onChange:ie=>Ce({...Ee,datasourceUid:ie.uid,url:void 0})})):n.createElement(p._,{label:"URL",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"The URL of the trace backend the user would go to see its trace. ",ct()),disabled:ze,interactive:!0},n.createElement(y.I,{placeholder:"https://example.com/${__value.raw}",spellCheck:!1,width:40,value:Ee.url,onChange:ie=>Ce({...Ee,datasourceUid:void 0,url:ie.currentTarget.value})})),n.createElement(p._,{label:"URL Label",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Use to override the button label on the exemplar traceID field. ",ct()),disabled:ze,interactive:!0},n.createElement(y.I,{placeholder:"Go to example.com",spellCheck:!1,width:40,value:Ee.urlDisplayLabel,onChange:ie=>Ce({...Ee,urlDisplayLabel:ie.currentTarget.value})})),n.createElement(p._,{label:"Label name",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"The name of the field in the labels object that should be used to get the traceID. ",ct()),disabled:ze,interactive:!0},n.createElement(y.I,{placeholder:"traceID",spellCheck:!1,width:40,value:Ee.name,onChange:ie=>Ce({...Ee,name:ie.currentTarget.value})})),!ze&&n.createElement(p._,{label:"Remove exemplar link",labelWidth:bt,disabled:ze},n.createElement(V.zx,{variant:"destructive",title:"Remove exemplar link",icon:"times",onClick:ie=>{ie.preventDefault(),Ae()}})))}function ce({options:Ee,onChange:Ce,disabled:Ae}){const ze=(0,g.l4)(),Ie=me(ze);return n.createElement("div",{className:Ie.sectionBottomPadding},n.createElement(m._,{title:"Exemplars",className:Ie.container},Ee&&Ee.map((xe,Te)=>n.createElement(ye,{key:Te,value:xe,onChange:Oe=>{const ie=[...Ee];ie.splice(Te,1,Oe),Ce(ie)},onDelete:()=>{const Oe=[...Ee];Oe.splice(Te,1),Ce(Oe)},disabled:Ae})),!Ae&&n.createElement(V.zx,{variant:"secondary","aria-label":De.wl.components.DataSource.Prometheus.configPage.exemplarsAddButton,className:(0,t.css)` margin-bottom: 10px; `,icon:"plus",onClick:xe=>{xe.preventDefault();const Te=[...Ee||[],{name:"traceID"}];Ce(Te)}},"Add"),Ae&&!Ee&&n.createElement("i",null,"No exemplars configurations")))}const We={Prometheus:[{value:void 0,label:"Please select"},{value:"2.0.0",label:"< 2.14.x"},{value:"2.14.0",label:"2.14.x"},{value:"2.15.0",label:"2.15.x"},{value:"2.16.0",label:"2.16.x"},{value:"2.17.0",label:"2.17.x"},{value:"2.18.0",label:"2.18.x"},{value:"2.19.0",label:"2.19.x"},{value:"2.20.0",label:"2.20.x"},{value:"2.21.0",label:"2.21.x"},{value:"2.22.0",label:"2.22.x"},{value:"2.23.0",label:"2.23.x"},{value:"2.24.0",label:"2.24.x"},{value:"2.25.0",label:"2.25.x"},{value:"2.26.0",label:"2.26.x"},{value:"2.27.0",label:"2.27.x"},{value:"2.28.0",label:"2.28.x"},{value:"2.29.0",label:"2.29.x"},{value:"2.30.0",label:"2.30.x"},{value:"2.31.0",label:"2.31.x"},{value:"2.32.0",label:"2.32.x"},{value:"2.33.0",label:"2.33.x"},{value:"2.34.0",label:"2.34.x"},{value:"2.35.0",label:"2.35.x"},{value:"2.36.0",label:"2.36.x"},{value:"2.37.0",label:"2.37.x"},{value:"2.38.0",label:"2.38.x"},{value:"2.39.0",label:"2.39.x"},{value:"2.40.0",label:"2.40.x"},{value:"2.41.0",label:"2.41.x"},{value:"2.42.0",label:"2.42.x"},{value:"2.43.0",label:"2.43.x"},{value:"2.44.0",label:"2.44.x"},{value:"2.45.0",label:"2.45.x"},{value:"2.46.0",label:"2.46.x"},{value:"2.47.0",label:"2.47.x"},{value:"2.48.0",label:"2.48.x"},{value:"2.49.0",label:"2.49.x"},{value:"2.50.0",label:"2.50.x"},{value:"2.50.1",label:"> 2.50.x"}],Mimir:[{value:void 0,label:"Please select"},{value:"2.0.0",label:"2.0.x"},{value:"2.1.0",label:"2.1.x"},{value:"2.2.0",label:"2.2.x"},{value:"2.3.0",label:"2.3.x"},{value:"2.4.0",label:"2.4.x"},{value:"2.5.0",label:"2.5.x"},{value:"2.6.0",label:"2.6.x"},{value:"2.7.0",label:"2.7.x"},{value:"2.8.0",label:"2.8.x"},{value:"2.9.0",label:"2.9.x"},{value:"2.9.1",label:"> 2.9.x"}],Thanos:[{value:void 0,label:"Please select"},{value:"0.0.0",label:"< 0.16.x"},{value:"0.16.0",label:"0.16.x"},{value:"0.17.0",label:"0.17.x"},{value:"0.18.0",label:"0.18.x"},{value:"0.19.0",label:"0.19.x"},{value:"0.20.0",label:"0.20.x"},{value:"0.21.0",label:"0.21.x"},{value:"0.22.0",label:"0.22.x"},{value:"0.23.0",label:"0.23.x"},{value:"0.24.0",label:"0.24.x"},{value:"0.25.0",label:"0.25.x"},{value:"0.26.0",label:"0.26.x"},{value:"0.27.0",label:"0.27.x"},{value:"0.28.0",label:"0.28.x"},{value:"0.29.0",label:"0.29.x"},{value:"0.30.0",label:"0.30.x"},{value:"0.31.0",label:"0.31.x"},{value:"0.31.1",label:"> 0.31.x"}],Cortex:[{value:void 0,label:"Please select"},{value:"0.0.0",label:"< 1.0.0"},{value:"1.0.0",label:"1.0.0"},{value:"1.1.0",label:"1.1.x"},{value:"1.2.0",label:"1.2.x"},{value:"1.3.0",label:"1.3.x"},{value:"1.4.0",label:"1.4.x"},{value:"1.5.0",label:"1.5.x"},{value:"1.6.0",label:"1.6.x"},{value:"1.7.0",label:"1.7.x"},{value:"1.8.0",label:"1.8.x"},{value:"1.9.0",label:"1.9.x"},{value:"1.10.0",label:"1.10.x"},{value:"1.11.0",label:"1.11.x"},{value:"1.13.0",label:"1.13.x"},{value:"1.14.0",label:"> 1.13.x"}]},ke=[{value:"POST",label:"POST"},{value:"GET",label:"GET"}],et=[{value:ge.c.Builder,label:"Builder"},{value:ge.c.Code,label:"Code"}],we=[{value:re.x3.Low,label:"Low"},{value:re.x3.Medium,label:"Medium"},{value:re.x3.High,label:"High"},{value:re.x3.None,label:"None"}],_e=[{value:ne.T8.Prometheus,label:ne.T8.Prometheus},{value:ne.T8.Cortex,label:ne.T8.Cortex},{value:ne.T8.Mimir,label:ne.T8.Mimir},{value:ne.T8.Thanos,label:ne.T8.Thanos}],Ge=/^$|^\d+(ms|[Mwdhmsy])$/,qe=/(\d+)(.+)/,st="Value is not valid, you can use number with time unit specifier: y, M, w, d, h, m, s",Me=(Ee,Ce)=>{if(!Ce||!We[Ce])return;const ze=We[Ce]?.filter(xe=>!!xe.value&&se().lte(xe.value,Ee)).map(xe=>xe.value),Ie=ze[ze.length-1];if(Ie){const xe=se().diff(Ie,Ee);if(["patch","prepatch","prerelease",null].includes(xe))return Ie}},be=Ee=>{console.warn("Error fetching version from buildinfo API, must manually select version!",Ee)},Ke=(Ee,Ce,Ae)=>{Ae(Ee).then(ze=>{(0,le.i)().get(`/api/datasources/uid/${ze.uid}/resources/version-detect`).then(Ie=>{const xe=Ie.data?.version??"";if(xe&&se().valid(xe)){const Te=Me(xe,ze.jsonData.prometheusType);Te&&Ae({...ze,jsonData:{...ze.jsonData,prometheusVersion:Te}}).then(Oe=>{Ce(Oe)})}else be()})}).catch(ze=>{be(ze)})},Ye=Ee=>{const{options:Ce,onOptionsChange:Ae}=Ee,ze=(0,q.qj)();Ce.jsonData.httpMethod||(Ce.jsonData.httpMethod="POST");const Ie=(0,g.l4)(),xe=me(Ie),[Te,Oe]=(0,n.useState)({timeInterval:"",queryTimeout:"",incrementalQueryOverlapWindow:""});return n.createElement(n.Fragment,null,n.createElement(m._,{title:"Interval behaviour",className:xe.container},n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p._,{label:"Scrape interval",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"This interval is how frequently Prometheus scrapes targets. Set this to the typical scrape and evaluation interval configured in your Prometheus config file. If you set this to a greater value than your Prometheus config file interval, Grafana will evaluate the data according to this interval and you will see less data points. Defaults to 15s. ",ct()),interactive:!0,disabled:Ce.readOnly},n.createElement(n.Fragment,null,n.createElement(y.I,{className:"width-20",value:Ce.jsonData.timeInterval,spellCheck:!1,placeholder:"15s",onChange:nt("timeInterval",Ce,Ae),onBlur:ie=>Oe({...Te,timeInterval:ie.currentTarget.value})}),it(Te.timeInterval,Ge,st))))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p._,{label:"Query timeout",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Set the Prometheus query timeout. ",ct()),interactive:!0,disabled:Ce.readOnly},n.createElement(n.Fragment,null,n.createElement(y.I,{className:"width-20",value:Ce.jsonData.queryTimeout,onChange:nt("queryTimeout",Ce,Ae),spellCheck:!1,placeholder:"60s",onBlur:ie=>Oe({...Te,queryTimeout:ie.currentTarget.value})}),it(Te.queryTimeout,Ge,st))))))),n.createElement(m._,{title:"Query editor",className:xe.container},n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form"},n.createElement(p._,{label:"Default editor",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Set default editor option for all users of this data source. ",ct()),interactive:!0,disabled:Ce.readOnly},n.createElement(oe.Ph,{"aria-label":"Default Editor (Code or Builder)",options:et,value:et.find(ie=>ie.value===Ce.jsonData.defaultEditor)??et.find(ie=>ie.value===ge.c.Builder),onChange:nt("defaultEditor",Ce,Ae),width:40}))),n.createElement("div",{className:"gf-form"},n.createElement(p._,{labelWidth:bt,label:"Disable metrics lookup",tooltip:n.createElement(n.Fragment,null,"Checking this option will disable the metrics chooser and metric/label support in the query field's autocomplete. This helps if you have performance issues with bigger Prometheus instances."," ",ct()),interactive:!0,disabled:Ce.readOnly,className:xe.switchField},n.createElement(f.r,{value:Ce.jsonData.disableMetricsLookup??!1,onChange:(0,Z.hz)(Ee,"disableMetricsLookup")}))))),n.createElement(m._,{title:"Performance",className:xe.container},!Ce.jsonData.prometheusType&&!Ce.jsonData.prometheusVersion&&Ce.readOnly&&n.createElement("div",{className:xe.versionMargin},"For more information on configuring prometheus type and version in data sources, see the"," ",n.createElement("a",{className:xe.textUnderline,href:"https://grafana.com/docs/grafana/latest/administration/provisioning/"},"provisioning documentation"),"."),n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p._,{label:"Prometheus type",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Set this to the type of your prometheus database, e.g. Prometheus, Cortex, Mimir or Thanos. Changing this field will save your current settings, and attempt to detect the version. Certain types of Prometheus support or do not support various APIs. For example, some types support regex matching for label queries to improve performance. Some types have an API for metadata. If you set this incorrectly you may experience odd behavior when querying metrics and labels. Please check your Prometheus documentation to ensure you enter the correct type. ",ct()),interactive:!0,disabled:Ce.readOnly},n.createElement(oe.Ph,{"aria-label":"Prometheus type",options:_e,value:_e.find(ie=>ie.value===Ce.jsonData.prometheusType),onChange:nt("prometheusType",{...Ce,jsonData:{...Ce.jsonData,prometheusVersion:void 0}},ie=>(Ke(ie,Ae,ze),Ae({...ie,jsonData:{...ie.jsonData,prometheusVersion:void 0}}))),width:40})))),n.createElement("div",{className:"gf-form-inline"},Ce.jsonData.prometheusType&&n.createElement("div",{className:"gf-form"},n.createElement(p._,{label:`${Ce.jsonData.prometheusType} version`,labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Use this to set the version of your ",Ce.jsonData.prometheusType," instance if it is not automatically configured. ",ct()),interactive:!0,disabled:Ce.readOnly},n.createElement(oe.Ph,{"aria-label":`${Ce.jsonData.prometheusType} type`,options:We[Ce.jsonData.prometheusType],value:We[Ce.jsonData.prometheusType]?.find(ie=>ie.value===Ce.jsonData.prometheusVersion),onChange:nt("prometheusVersion",Ce,Ae),width:40})))),o.default.featureToggles.prometheusResourceBrowserCache&&n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form max-width-30"},n.createElement(p._,{label:"Cache level",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Sets the browser caching level for editor queries. Higher cache settings are recommended for high cardinality data sources."),interactive:!0,disabled:Ce.readOnly},n.createElement(oe.Ph,{width:40,onChange:nt("cacheLevel",Ce,Ae),options:we,value:we.find(ie=>ie.value===Ce.jsonData.cacheLevel)??re.x3.Low})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form max-width-30"},n.createElement(p._,{label:"Incremental querying (beta)",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"This feature will change the default behavior of relative queries to always request fresh data from the prometheus instance, instead query results will be cached, and only new records are requested. Turn this on to decrease database and network load."),interactive:!0,className:xe.switchField,disabled:Ce.readOnly},n.createElement(f.r,{value:Ce.jsonData.incrementalQuerying??!1,onChange:(0,Z.hz)(Ee,"incrementalQuerying")})))),n.createElement("div",{className:"gf-form-inline"},Ce.jsonData.incrementalQuerying&&n.createElement(p._,{label:"Query overlap window",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Set a duration like 10m or 120s or 0s. Default of 10 minutes. This duration will be added to the duration of each incremental request."),interactive:!0,disabled:Ce.readOnly},n.createElement(n.Fragment,null,n.createElement(y.I,{onBlur:ie=>Oe({...Te,incrementalQueryOverlapWindow:ie.currentTarget.value}),className:"width-20",value:Ce.jsonData.incrementalQueryOverlapWindow??ae.Ji,onChange:nt("incrementalQueryOverlapWindow",Ce,Ae),spellCheck:!1}),it(Te.incrementalQueryOverlapWindow,qe,st)))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form max-width-30"},n.createElement(p._,{label:"Disable recording rules (beta)",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"This feature will disable recording rules Turn this on to improve dashboard performance"),interactive:!0,className:xe.switchField,disabled:Ce.readOnly},n.createElement(f.r,{value:Ce.jsonData.disableRecordingRules??!1,onChange:(0,Z.hz)(Ee,"disableRecordingRules")})))))),n.createElement(m._,{title:"Other",className:xe.container},n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form max-width-30"},n.createElement(p._,{label:"Custom query parameters",labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"Add custom parameters to the Prometheus query URL. For example timeout, partial_response, dedup, or max_source_resolution. Multiple parameters should be concatenated together with an \u2018&\u2019. ",ct()),interactive:!0,disabled:Ce.readOnly},n.createElement(y.I,{className:"width-20",value:Ce.jsonData.customQueryParameters,onChange:nt("customQueryParameters",Ce,Ae),spellCheck:!1,placeholder:"Example: max_source_resolution=5m&timeout=10"})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p._,{labelWidth:bt,tooltip:n.createElement(n.Fragment,null,"You can use either POST or GET HTTP method to query your Prometheus data source. POST is the recommended method as it allows bigger queries. Change this to GET if you have a Prometheus version older than 2.1 or if POST requests are restricted in your network. ",ct()),interactive:!0,label:"HTTP method",disabled:Ce.readOnly},n.createElement(oe.Ph,{width:40,"aria-label":"Select HTTP method",options:ke,value:ke.find(ie=>ie.value===Ce.jsonData.httpMethod),onChange:nt("httpMethod",Ce,Ae)})))))),n.createElement(ce,{options:Ce.jsonData.exemplarTraceIdDestinations,onChange:ie=>(0,Z.tp)({onOptionsChange:Ae,options:Ce},"exemplarTraceIdDestinations",ie),disabled:Ce.readOnly}))},tt=Ee=>Ee?Ee.hasOwnProperty("currentTarget")?Ee.currentTarget.value:Ee.value:"",nt=(Ee,Ce,Ae)=>ze=>{Ae({...Ce,jsonData:{...Ce.jsonData,[Ee]:tt(ze)}})};var Pt=e(72699);const xt=({config:Ee,onChange:Ce,className:Ae})=>{const ze=Te=>{Ce({...Ee,jsonData:{...Ee.jsonData,keepCookies:Te}})},Ie=Te=>{Ce({...Ee,jsonData:{...Ee.jsonData,timeout:parseInt(Te.currentTarget.value,10)}})},xe={container:(0,t.css)({maxWidth:578})};return n.createElement(n.Fragment,null,n.createElement(m._,{title:"Advanced HTTP settings",className:(0,t.cx)(xe.container,Ae)},n.createElement(p._,{htmlFor:"advanced-http-cookies",label:"Allowed cookies",labelWidth:bt,tooltip:"Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",disabled:Ee.readOnly,grow:!0},n.createElement(Pt.B,{className:"width-20",id:"advanced-http-cookies",placeholder:"New cookie (hit enter to add)",tags:Ee.jsonData.keepCookies,onChange:ze})),n.createElement(p._,{htmlFor:"advanced-http-timeout",label:"Timeout",labelWidth:bt,tooltip:"HTTP request timeout in seconds",disabled:Ee.readOnly,grow:!0},n.createElement(y.I,{className:"width-20",id:"advanced-http-timeout",type:"number",min:0,placeholder:"Timeout in seconds","aria-label":"Timeout in seconds",value:Ee.jsonData.timeout,onChange:Ie}))))},bt=30,Rt=Ee=>{const{options:Ce,onOptionsChange:Ae}=Ee,ze=o.config.featureToggles.prometheusConfigOverhaulAuth,Ie=(0,n.useRef)(Ee.options.access==="direct"),xe={azureAuthSupported:o.config.azureAuthEnabled,getAzureAuthEnabled:ie=>M(ie),setAzureAuthEnabled:(ie,Le)=>Le?O(ie):B(ie),azureSettingsUI:k},Te=(0,g.l4)(),Oe=me(Te);return n.createElement(n.Fragment,null,Ce.access==="direct"&&n.createElement(d.b,{title:"Error",severity:"error"},"Browser access mode in the Prometheus data source is no longer available. Switch to server access mode."),ze?n.createElement(n.Fragment,null,n.createElement(s.j,{dataSourceName:"Prometheus",docsLink:"https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/"}),n.createElement("hr",{className:`${Oe.hrTopSpace} ${Oe.hrBottomSpace}`}),n.createElement(X,{options:Ce,onOptionsChange:Ae,azureAuthSettings:xe,sigV4AuthToggleEnabled:o.config.sigV4AuthEnabled,renderSigV4Editor:n.createElement(i.IW,{...Ee}),secureSocksDSProxyEnabled:o.config.secureSocksDSProxyEnabled})):n.createElement(l.E,{defaultUrl:"http://localhost:9090",dataSourceConfig:Ce,showAccessOptions:Ie.current,onChange:Ae,sigV4AuthToggleEnabled:o.config.sigV4AuthEnabled,azureAuthSettings:xe,renderSigV4Editor:n.createElement(i.IW,{...Ee}),secureSocksDSProxyEnabled:o.config.secureSocksDSProxyEnabled,urlLabel:"Prometheus server URL",urlDocs:ct()}),ze?n.createElement(n.Fragment,null,n.createElement("hr",null),n.createElement(r.K,{className:Oe.advancedSettings,title:"Advanced settings",description:"Additional settings are optional settings that can be configured for more control over your data source."},n.createElement(xt,{className:Oe.advancedHTTPSettingsMargin,config:Ce,onChange:Ae}),n.createElement(E,{options:Ce,onOptionsChange:Ae}),n.createElement(Ye,{options:Ce,onOptionsChange:Ae}))):n.createElement(n.Fragment,null,n.createElement("hr",{className:Oe.hrTopSpace}),n.createElement("h3",{className:Oe.sectionHeaderPadding},"Additional settings"),n.createElement("p",{className:`${Oe.secondaryGrey} ${Oe.subsectionText}`},"Additional settings are optional settings that can be configured for more control over your data source."),n.createElement(E,{options:Ce,onOptionsChange:Ae}),n.createElement(Ye,{options:Ce,onOptionsChange:Ae})))};function ct(Ee){const Ce="https://grafana.com/docs/grafana/latest/datasources/prometheus/#configure-the-data-source";return n.createElement("a",{href:Ee||Ce,target:"_blank",rel:"noopener noreferrer"},"Visit docs for more details here.")}const it=(Ee,Ce,Ae)=>{const ze="Value is not valid";return Ee&&!Ee.match(Ce)?n.createElement(u.S,null,Ae||ze):!0};function me(Ee){return{additionalSettings:(0,t.css)` margin-bottom: 25px; `,secondaryGrey:(0,t.css)` color: ${Ee.colors.secondary.text}; opacity: 65%; `,inlineError:(0,t.css)` margin: 0px 0px 4px 245px; `,switchField:(0,t.css)` align-items: center; `,sectionHeaderPadding:(0,t.css)` padding-top: 32px; `,sectionBottomPadding:(0,t.css)` padding-bottom: 28px; `,subsectionText:(0,t.css)` font-size: 12px; `,hrBottomSpace:(0,t.css)` margin-bottom: 56px; `,hrTopSpace:(0,t.css)` margin-top: 50px; `,textUnderline:(0,t.css)` text-decoration: underline; `,versionMargin:(0,t.css)` margin-bottom: 12px; `,advancedHTTPSettingsMargin:(0,t.css)` margin: 24px 0 8px 0; `,advancedSettings:(0,t.css)` padding-top: 32px; `,alertingTop:(0,t.css)` margin-top: 40px !important; `,overhaulPageHeading:(0,t.css)` font-weight: 400; `,container:(0,t.css)` maxwidth: 578; `}}},26807:(j,I,e)=>{"use strict";e.d(I,{QG:()=>Ce,vQ:()=>Ae});var t=e(89949),n=e(84084),i=e(27702),s=e(91826),r=e(78209),g=e(45383),d=e(15084),l=e(6857),u=e(89707),o=e(39343),m=e(76970),c=e(56361),p=e(56469),f=e(37865),E=e.n(f),h=e(62247),y=e(76305),v=e(76772),D=e(53933),a=e(99633),C=e(42751),P=e(35306),b=e(73289),M=e(25357),T=e(80011),S=e(89024),x=e(55394),O=e(26858),B=e(99386),A=e(18447),V=e(12308),W=e(85085),w=e(83788),N=e(57942),F=e(81924),k=e(60426),H=e(63201),R=e(31465),_=e(1128),G=e(86096);function Y(Oe){const ie=Oe.annotation,Le=Oe.onAnnotationChange,Be={expr:ie.expr,refId:ie.name,interval:ie.step};return i.createElement(i.Fragment,null,i.createElement(w._,null,i.createElement(G.j,{...Oe,query:Be,showExplain:!1,onChange:Ue=>{Le({...ie,expr:Ue.expr})}}),i.createElement(N.p,null,i.createElement(F.S,{label:"Min step",tooltip:i.createElement(i.Fragment,null,"An additional lower limit for the step parameter of the Prometheus query and for the"," ",i.createElement("code",null,"$__interval")," and ",i.createElement("code",null,"$__rate_interval")," variables.")},i.createElement(R.H,{type:"text","aria-label":"Set lower limit for the step parameter",placeholder:"auto",minWidth:10,onCommitChange:Ue=>{Le({...ie,step:Ue.currentTarget.value})},defaultValue:Be.interval})))),i.createElement(k.T,{v:.5}),i.createElement(N.p,null,i.createElement(F.S,{label:"Title",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance."},i.createElement(_.I,{type:"text",placeholder:"{{alertname}}",value:ie.titleFormat,onChange:Ue=>{Le({...ie,titleFormat:Ue.currentTarget.value})}})),i.createElement(F.S,{label:"Tags"},i.createElement(_.I,{type:"text",placeholder:"label1,label2",value:ie.tagKeys,onChange:Ue=>{Le({...ie,tagKeys:Ue.currentTarget.value})}})),i.createElement(F.S,{label:"Text",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance."},i.createElement(_.I,{type:"text",placeholder:"{{instance}}",value:ie.textFormat,onChange:Ue=>{Le({...ie,textFormat:Ue.currentTarget.value})}})),i.createElement(F.S,{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."},i.createElement(H.r,{value:ie.useValueForTime,onChange:Ue=>{Le({...ie,useValueForTime:Ue.currentTarget.value})}}))))}var X=e(41587),Q=e(73308),se=e(85400),Z=e(84848),le=e(72054);const oe=/^label_names\(\)\s*$/,q=/^label_values\((?:(.+),\s*)?([a-zA-Z_$][a-zA-Z0-9_]*)\)\s*$/,ne=/^metrics\((.+)\)\s*$/,ge=/^query_result\((.+)\)\s*$/,ae=/^label_names\((.+)\)\s*$/;function re(Oe){if(typeof Oe!="string")return Oe;const ie={refId:"PrometheusDatasource-VariableQuery",qryType:le.jo.LabelNames},Le=Oe.match(ae);if(Le)return{...ie,qryType:le.jo.LabelNames,match:Le[1]};const Be=Oe.match(oe);if(Be)return{...ie,qryType:le.jo.LabelNames};const Ue=Oe.match(q);if(Ue){const $e=Ue[2],Se=Ue[1];if(Se){const Ve=(0,Z._)(Se);return{...ie,qryType:le.jo.LabelValues,label:$e,metric:Ve.query.metric,labelFilters:Ve.query.labels}}else return{...ie,qryType:le.jo.LabelValues,label:$e}}const ue=Oe.match(ne);if(ue)return{...ie,qryType:le.jo.MetricNames,metric:ue[1]};const pe=Oe.match(ge);return pe?{...ie,qryType:le.jo.VarQueryResult,varQuery:pe[1]}:!Be&&!Ue&&!ue&&!pe?{...ie,qryType:le.jo.SeriesQuery,seriesQuery:Oe}:ie}function De(Oe){switch(Oe.qryType){case le.jo.LabelNames:return Oe.match?`label_names(${Oe.match})`:"label_names()";case le.jo.LabelValues:if(Oe.metric){const Le={metric:Oe.metric,labels:Oe.labelFilters??[],operations:[]};return`label_values(${se.Z.renderQuery(Le)},${Oe.label})`}else return`label_values(${Oe.label})`;case le.jo.MetricNames:return`metrics(${Oe.metric})`;case le.jo.VarQueryResult:return`query_result(${he(Oe.varQuery)})`;case le.jo.SeriesQuery:return""+Oe.seriesQuery}return""}function he(Oe){return Oe?Oe.replace(/[\r\n]+/gm,""):""}class ye{constructor(ie,Le){this.datasource=ie,this.query=Le,this.datasource=ie,this.query=Le,this.range=(0,O.$t)().timeRange()}process(){const ie=oe,Le=ae,Be=/^label_values\((?:(.+),\s*)?([a-zA-Z_][a-zA-Z0-9_]*)\)\s*$/,Ue=ne,ue=ge,pe=this.query.match(ie),$e=this.query.match(Le);if($e){const Qe=`{__name__=~".*${$e[1]}.*"}`;return this.datasource.languageProvider.getSeriesLabels(Qe,[]).then(rt=>rt.map(pt=>({text:pt})))}if(pe)return this.datasource.getTagKeys();const Se=this.query.match(Be);if(Se)return Se[1]?this.labelValuesQuery(Se[2],Se[1]):this.labelValuesQuery(Se[2]);const Ve=this.query.match(Ue);if(Ve)return this.metricNameQuery(Ve[1]);const He=this.query.match(ue);return He?(0,r.n)(this.queryResultQuery(He[1])):["label_values()","metrics()","query_result()"].includes(this.query)?Promise.resolve([]):this.metricNameAndLabelsQuery(this.query)}labelValuesQuery(ie,Le){const Be=(0,Q.jj)(this.range.from,!1),Ue=(0,Q.jj)(this.range.to,!0),ue={...Le&&{"match[]":Le},start:Be.toString(),end:Ue.toString()};if(!Le||this.datasource.hasLabelsMatchAPISupport()){const pe=`/api/v1/label/${ie}/values`;return this.datasource.metadataRequest(pe,ue).then($e=>(0,t.map)($e.data.data,Se=>({text:Se})))}else{const pe="/api/v1/series";return this.datasource.metadataRequest(pe,ue).then($e=>{const Se=(0,t.map)($e.data.data,Ve=>Ve[ie]||"").filter(Ve=>Ve!=="");return(0,t.uniq)(Se).map(Ve=>({text:Ve,expandable:!0}))})}}metricNameQuery(ie){const Le=(0,Q.jj)(this.range.from,!1),Be=(0,Q.jj)(this.range.to,!0),Ue={start:Le.toString(),end:Be.toString()},ue="/api/v1/label/__name__/values";return this.datasource.metadataRequest(ue,Ue).then(pe=>(0,t.chain)(pe.data.data).filter($e=>new RegExp(ie).test($e)).map($e=>({text:$e,expandable:!0})).value())}queryResultQuery(ie){const Le=(0,Q.jj)(this.range.to,!0),Be={expr:ie};return this.datasource.performInstantQuery(Be,Le).pipe((0,o.U)(Ue=>{switch(Ue.data.data.resultType){case"scalar":case"string":return[{text:Ue.data.data.result[1]||"",expandable:!1}];case"vector":return(0,t.map)(Ue.data.data.result,ue=>{let pe=ue.metric.__name__||"";return delete ue.metric.__name__,pe+="{"+(0,t.map)(ue.metric,($e,Se)=>Se+'="'+$e+'"').join(",")+"}",pe+=" "+ue.value[1]+" "+ue.value[0]*1e3,{text:pe,expandable:!0}});default:throw Error(`Unknown/Unhandled result type: [${Ue.data.data.resultType}]`)}}))}metricNameAndLabelsQuery(ie){const Le=(0,Q.jj)(this.range.from,!1),Be=(0,Q.jj)(this.range.to,!0),Ue={"match[]":ie,start:Le.toString(),end:Be.toString()},ue="/api/v1/series",pe=this;return this.datasource.metadataRequest(ue,Ue).then($e=>(0,t.map)($e.data.data,Se=>({text:pe.datasource.getOriginalMetricName(Se),expandable:!0})))}}const ce=20;function We(Oe,ie,Le){const Be=[];if(Oe.trim().match(/^\w+_bucket$|^\w+_bucket{.*}$/)){const ue="Selected metric has buckets.";Be.push({type:"HISTOGRAM_QUANTILE",label:ue,fix:{label:"Consider calculating aggregated quantile by adding histogram_quantile().",action:{type:"ADD_HISTOGRAM_QUANTILE",query:Oe}}})}if(Oe.indexOf("rate(")===-1&&Oe.indexOf("increase(")===-1){const ue=Oe.match(/\b(\w+_(total|sum|count))\b/);let pe=ue?ue[1]:"";const $e=Le?.languageProvider?.metricsMetadata;let Se=!1;if($e&&(pe=Array.from(Oe.matchAll(/\$?[a-zA-Z_:][a-zA-Z0-9_:]*/g)).map(([He])=>He).filter(He=>!He.startsWith("$")).flatMap(He=>He.split(":")).find(He=>{const Ze=$e[He];return Ze&&Ze.type.toLowerCase()==="counter"?(Se=!0,!0):!1})??""),pe){const Ve=Oe.trim().match(/^\w+$|^\w+{.*}$/);let Ze=`Selected metric ${Se?"is":"looks like"} a counter.`,Qe;Ve?Qe={label:"Consider calculating rate of counter by adding rate().",action:{type:"ADD_RATE",query:Oe}}:Ze=`${Ze} Consider calculating rate of counter by adding rate().`,Be.push({type:"APPLY_RATE",label:Ze,fix:Qe})}}if(Le&&Le.ruleMappings){const ue=Le.ruleMappings,pe=Object.keys(ue).reduce(($e,Se)=>Oe.search(Se)>-1?{...$e,[Se]:ue[Se]}:$e,{});if((0,t.size)(pe)>0){const $e="Query contains recording rules.";Be.push({type:"EXPAND_RULES",label:$e,fix:{label:"Expand rules",action:{type:"EXPAND_RULES",query:Oe,options:pe}}})}}return ie&&ie.length>=ce&&Oe.trim().match(/^\w+$/)&&Be.push({type:"ADD_SUM",label:"Many time series results returned.",fix:{label:"Consider aggregating with sum().",action:{type:"ADD_SUM",query:Oe,preventSubmit:!0}}}),Be}function ke(Oe){const ie=[];return Oe.directUrl.includes("/loki")&&!Oe.languageProvider.metrics.length&&ie.push({label:"Using Loki as a Prometheus data source is no longer supported. You must use the Loki data source for your Loki instance.",type:"INFO"}),Oe.lookupsDisabled&&ie.push({label:"Labels and metrics lookup was disabled in data source settings.",type:"INFO"}),ie}var et=e(94962),we=e(48789),_e=e(86312),Ge=e(34667);function qe(Oe,ie,Le){const{app:Be,targets:Ue}=ie;if(!(Be===h.zj.Dashboard||Be===h.zj.PanelViewer))for(const ue of Ue)(0,_e.ff)("grafana_prometheus_query_executed",{app:Be,grafana_version:Ge.config.buildInfo.version,has_data:Oe.data.some(pe=>pe.length>0),has_error:Oe.error!==void 0,expr:ue.expr,format:ue.format,instant:ue.instant,range:ue.range,exemplar:ue.exemplar,hinting:ue.hinting,interval:ue.interval,intervalFactor:ue.intervalFactor,utcOffsetSec:ue.utcOffsetSec,legend:ue.legendFormat,valueWithRefId:ue.valueWithRefId,requestId:ie.requestId,showingGraph:ue.showingGraph,showingTable:ue.showingTable,editor_mode:ue.editorMode,simultaneously_sent_query_count:Ue.length,time_range_from:ie?.range?.from?.toISOString(),time_range_to:ie?.range?.to?.toISOString(),time_taken:Date.now()-Le.getTime()})}var st=e(91053),Me=e(79726),be=e(39317),Ke=e(71107),Ye=e(48024),tt=e(28580),nt=e(60105),Pt=e(52390);const xt=[{label:"Label names",value:le.jo.LabelNames},{label:"Label values",value:le.jo.LabelValues},{label:"Metrics",value:le.jo.MetricNames},{label:"Query result",value:le.jo.VarQueryResult},{label:"Series query",value:le.jo.SeriesQuery}],bt="PrometheusVariableQueryEditor-VariableQuery",Rt=({onChange:Oe,query:ie,datasource:Le})=>{const[Be,Ue]=(0,i.useState)(void 0),[ue,pe]=(0,i.useState)(""),[$e,Se]=(0,i.useState)(""),[Ve,He]=(0,i.useState)(""),[Ze,Qe]=(0,i.useState)(""),[rt,pt]=(0,i.useState)(""),[It,_t]=(0,i.useState)([]),[tn,qt]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(!ie)return;const Ft=ct(ie);Se(Ft.match??""),Ue(Ft.qryType),pe(Ft.label??""),He(Ft.metric??""),qt(Ft.labelFilters??[]),Qe(Ft.varQuery??""),pt(Ft.seriesQuery??"")},[ie]),(0,i.useEffect)(()=>{if(Be!==le.jo.LabelValues)return;const Ft=Le.getVariables().map(Gt=>({label:Gt,value:Gt}));if(!Ve)Le.getTagKeys().then(Gt=>{const dn=Gt.map(({text:sn})=>({label:sn,value:sn}));_t([...Ft,...dn])});else{const Gt=[{label:"__name__",op:"=",value:Ve}],dn=se.Z.renderLabels(Gt);Le.hasLabelsMatchAPISupport()?Le.languageProvider.fetchSeriesLabelsMatch(dn).then(sn=>{const wt=Object.keys(sn).map(Vt=>({label:Vt,value:Vt}));_t([...Ft,...wt])}):Le.languageProvider.fetchSeriesLabels(dn).then(sn=>{const wt=Object.keys(sn).map(Vt=>({label:Vt,value:Vt}));_t([...Ft,...wt])})}},[Le,Be,Ve]);const cn=(Ft,Gt)=>{const Bn={...{qryType:Be,label:ue,metric:Ve,match:$e,varQuery:Ze,seriesQuery:rt,refId:"PrometheusVariableQueryEditor-VariableQuery"},...Ft,...Gt?{labelFilters:Gt}:{labelFilters:tn}},wt=De(Bn);Oe({query:wt,refId:bt})},on=Ft=>{Ue(Ft.value),Ft.value===le.jo.LabelNames&&cn({qryType:Ft.value})},ln=Ft=>{const Gt=Ft&&Ft.value?Ft.value:"";pe(Gt),Be===le.jo.LabelValues&&Gt&&cn({label:Gt})},Un=Ft=>{He(Ft.metric),qt(Ft.labels);const Gt=Ft.metric,dn=Ft.labels??[];Be===le.jo.LabelValues&&ue&&(Gt||dn)&&cn({qryType:Be,metric:Gt},dn)},yt=Ft=>{Be===le.jo.LabelNames&&cn({qryType:Be,match:Ft})},ft=Ft=>{Be===le.jo.MetricNames&&Ft&&cn({metric:Ft})},Tt=Ft=>{Qe(Ft.currentTarget.value)},Bt=Ft=>{pt(Ft.currentTarget.value)},Nt=(0,i.useCallback)(()=>({metric:Ve,labels:tn,operations:[]}),[Ve,tn]);return i.createElement(i.Fragment,null,i.createElement(Ke.Z,null,i.createElement(Ye._,{label:"Query type",labelWidth:20,tooltip:i.createElement("div",null,"The Prometheus data source plugin provides the following query types for template variables.")},i.createElement(tt.Ph,{placeholder:"Select query type","aria-label":"Query type",onChange:on,value:Be,options:xt,width:25}))),Be===le.jo.LabelValues&&i.createElement(i.Fragment,null,i.createElement(Ke.Z,null,i.createElement(Ye._,{label:"Label",labelWidth:20,required:!0,"aria-labelledby":"label-select",tooltip:i.createElement("div",null,"Returns a list of label values for the label name in all metrics unless the metric is specified.")},i.createElement(tt.Ph,{"aria-label":"label-select",onChange:ln,value:ue,options:It,width:25,allowCustomValue:!0,isClearable:!0}))),i.createElement(Pt.U,{query:Nt(),datasource:Le,onChange:Un,variableEditor:!0})),Be===le.jo.LabelNames&&i.createElement(Ke.Z,null,i.createElement(Ye._,{label:"Metric regex",labelWidth:20,"aria-labelledby":"Metric regex",tooltip:i.createElement("div",null,"Returns a list of label names, optionally filtering by specified metric regex.")},i.createElement(_.I,{type:"text","aria-label":"Metric regex",placeholder:"Metric regex",value:$e,onBlur:Ft=>{Se(Ft.currentTarget.value),yt(Ft.currentTarget.value)},onChange:Ft=>{Se(Ft.currentTarget.value)},width:25}))),Be===le.jo.MetricNames&&i.createElement(Ke.Z,null,i.createElement(Ye._,{label:"Metric regex",labelWidth:20,"aria-labelledby":"Metric selector",tooltip:i.createElement("div",null,"Returns a list of metrics matching the specified metric regex.")},i.createElement(_.I,{type:"text","aria-label":"Metric selector",placeholder:"Metric regex",value:Ve,onChange:Ft=>{He(Ft.currentTarget.value)},onBlur:Ft=>{He(Ft.currentTarget.value),ft(Ft.currentTarget.value)},width:25}))),Be===le.jo.VarQueryResult&&i.createElement(Ke.Z,null,i.createElement(Ye._,{label:"Query",labelWidth:20,tooltip:i.createElement("div",null,"Returns a list of Prometheus query results for the query. This can include Prometheus functions, i.e. sum(go_goroutines).")},i.createElement(nt.K,{type:"text","aria-label":"Prometheus Query",placeholder:"Prometheus Query",value:Ze,onChange:Tt,onBlur:()=>{Be===le.jo.VarQueryResult&&Ze&&cn({qryType:Be})},cols:100}))),Be===le.jo.SeriesQuery&&i.createElement(Ke.Z,null,i.createElement(Ye._,{label:"Series Query",labelWidth:20,tooltip:i.createElement("div",null,'Enter 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.')},i.createElement(_.I,{type:"text","aria-label":"Series Query",placeholder:"Series Query",value:rt,onChange:Bt,onBlur:()=>{Be===le.jo.SeriesQuery&&rt&&cn({qryType:Be})},width:100}))))};function ct(Oe){return typeof Oe=="string"?re(Oe):Oe.query?re(Oe.query):Oe}class it extends Me.Mg{constructor(ie,Le=(0,be.J)(),Be=(0,O.$t)()){super(),this.datasource=ie,this.templateSrv=Le,this.timeSrv=Be,this.editor=Rt,this.query=this.query.bind(this)}query(ie){let Le;if(typeof ie.targets[0]=="string"?Le=ie.targets[0]:Le=ie.targets[0].query,!Le)return(0,g.of)({data:[]});const Be={...ie.scopedVars,__interval:{text:this.datasource.interval,value:this.datasource.interval},__interval_ms:{text:y.intervalToMs(this.datasource.interval),value:y.intervalToMs(this.datasource.interval)},...this.datasource.getRangeScopedVars(this.timeSrv.timeRange())},Ue=this.templateSrv.replace(Le,Be,this.datasource.interpolateQueryExpr),ue=new ye(this.datasource,Ue);return(0,st.D)(ue.process()).pipe((0,o.U)($e=>({data:$e})))}}const me="60s",Ee=["api/v1/query","api/v1/query_range","api/v1/series","api/v1/labels"],Ce="-Instant";class Ae extends C.CK{constructor(ie,Le=(0,B.J)(),Be=(0,O.$t)(),Ue){super(ie),this.templateSrv=Le,this.timeSrv=Be,this.metricsNameCache=new n.z({max:10}),this.init=async()=>{this.disableRecordingRules||this.loadRules(),this.exemplarsAvailable=await this.areExemplarsAvailable()},this.prepareTargets=(ue,pe,$e)=>{const Se=[],Ve=[],He=(0,t.cloneDeep)(ue.targets);for(const Ze of He){if(!Ze.expr||Ze.hide)continue;const Qe=this.languageProvider.histogramMetrics.find(rt=>Ze.expr.includes(rt));if(ue.app===h.zj.Explore&&Ze.range===Ze.instant){const rt=(0,t.cloneDeep)(Ze);rt.format="table",rt.instant=!0,rt.range=!1,rt.valueWithRefId=!0,delete rt.maxDataPoints;const pt=(0,t.cloneDeep)(Ze);if(pt.format="time_series",pt.instant=!1,rt.range=!0,Ze.exemplar){if(!Qe||Qe&&!Ve.some(It=>It.expr.includes(Qe))){const It=(0,t.cloneDeep)(Ze);It.instant=!1,Se.push(this.createQuery(It,ue,pe,$e)),Ve.push(It)}rt.exemplar=!1,pt.exemplar=!1}Ve.push(rt,pt),Se.push(this.createQuery(rt,ue,pe,$e),this.createQuery(pt,ue,pe,$e))}else if(Ze.instant&&ue.app===h.zj.Explore){const rt=(0,t.cloneDeep)(Ze);rt.format="table",Se.push(this.createQuery(rt,ue,pe,$e)),Ve.push(rt)}else{if(Ze.exemplar&&!Ze.instant){if(!Qe||Qe&&!Ve.some(rt=>rt.expr.includes(Qe))){const rt=(0,t.cloneDeep)(Ze);Se.push(this.createQuery(rt,ue,pe,$e)),Ve.push(rt)}Ze.exemplar=!1}Se.push(this.createQuery(Ze,ue,pe,$e)),Ve.push(Ze)}}return{queries:Se,activeTargets:Ve}},this.intepolateStringHelper=ue=>this.interpolateString(ue.expr),this.handleErrors=(ue,pe)=>{const $e={message:ue&&ue.statusText||"Unknown error during query transaction. Please check JS console logs.",refId:pe.refId};return ue.data?typeof ue.data=="string"?$e.message=ue.data:ue.data.error&&($e.message=(0,S.Xh)(ue.data.error)):ue.message?$e.message=ue.message:typeof ue=="string"&&($e.message=ue),$e.status=ue.status,$e.statusText=ue.statusText,$e},this.processAnnotationResponse=(ue,pe)=>{const $e=(0,P.z1)({data:pe}).data;if(!$e||!$e.length)return[];const Se=ue.annotation,{tagKeys:Ve="",titleFormat:He="",textFormat:Ze=""}=Se,Qe=y.intervalToSeconds(Se.step||me)*1e3,rt=Ve.split(","),pt=[];for(const It of $e){if(It.fields.length===0)continue;const _t=It.fields[0],tn=It.fields[1],qt=tn?.labels||{},cn=Object.keys(qt).filter(Tt=>rt.includes(Tt)).map(Tt=>qt[Tt]),on=[];let ln=0;tn.values.forEach(Tt=>{let Bt,Nt;const Ft=_t.values[ln];ue.annotation.useValueForTime?(Bt=Math.floor(parseFloat(Tt)),Nt=1):(Bt=Math.floor(parseFloat(Ft)),Nt=parseFloat(Tt)),ln++,on.push([Bt,Nt])});const yt=on.filter(Tt=>Tt[1]>0).map(Tt=>Tt[0]);let ft=null;for(const Tt of yt){if(ft&&(ft.timeEnd??0)+Qe>=Tt){ft.timeEnd=Tt;continue}ft&&pt.push(ft),ft={time:Tt,timeEnd:Tt,annotation:Se,title:(0,v.W)(He,qt),tags:cn,text:(0,v.W)(Ze,qt)}}ft&&(ft.timeEnd=yt[yt.length-1],pt.push(ft))}return pt},this.type="prometheus",this.subType=A.T8.Prometheus,this.rulerEnabled=!1,this.id=ie.id,this.url=ie.url,this.access=ie.access,this.basicAuth=ie.basicAuth,this.withCredentials=ie.withCredentials,this.interval=ie.jsonData.timeInterval||"15s",this.queryTimeout=ie.jsonData.queryTimeout,this.httpMethod=ie.jsonData.httpMethod||"GET",this.directUrl=ie.jsonData.directUrl??this.url,this.exemplarTraceIdDestinations=ie.jsonData.exemplarTraceIdDestinations,this.hasIncrementalQuery=ie.jsonData.incrementalQuerying??!1,this.ruleMappings={},this.languageProvider=Ue??new X.ZP(this),this.lookupsDisabled=ie.jsonData.disableMetricsLookup??!1,this.customQueryParameters=new URLSearchParams(ie.jsonData.customQueryParameters),this.datasourceConfigurationPrometheusFlavor=ie.jsonData.prometheusType,this.datasourceConfigurationPrometheusVersion=ie.jsonData.prometheusVersion,this.defaultEditor=ie.jsonData.defaultEditor,this.disableRecordingRules=ie.jsonData.disableRecordingRules??!1,this.variables=new it(this,this.templateSrv,this.timeSrv),this.exemplarsAvailable=!0,this.cacheLevel=ie.jsonData.cacheLevel??le.x3.Low,this.cache=new et.tQ({getTargetSignature:this.getPrometheusTargetSignature.bind(this),overlapString:ie.jsonData.incrementalQueryOverlapWindow??et.Ji,profileFunction:this.getPrometheusProfileData.bind(this)}),this.annotations={QueryEditor:Y}}getQueryDisplayText(ie){return ie.expr}getPrometheusProfileData(ie,Le){return{interval:Le.interval??ie.interval,expr:this.interpolateString(Le.expr),datasource:"Prometheus"}}getPrometheusTargetSignature(ie,Le){return`${this.interpolateString(Le.expr)}|${Le.interval??ie.interval}|${JSON.stringify(ie.rangeRaw??"")}|${Le.exemplar}`}hasLabelsMatchAPISupport(){return this._isDatasourceVersionGreaterOrEqualTo("2.24.0",A.T8.Prometheus)||this._isDatasourceVersionGreaterOrEqualTo("2.0.0",A.T8.Mimir)||this._isDatasourceVersionGreaterOrEqualTo("1.11.0",A.T8.Cortex)||this._isDatasourceVersionGreaterOrEqualTo("0.18.0",A.T8.Thanos)}_isDatasourceVersionGreaterOrEqualTo(ie,Le){return!this.datasourceConfigurationPrometheusVersion||!this.datasourceConfigurationPrometheusFlavor||Le!==this.datasourceConfigurationPrometheusFlavor?!1:E().gte(this.datasourceConfigurationPrometheusVersion,ie)}_addTracingHeaders(ie,Le){ie.headers={},this.access==="proxy"&&(ie.headers["X-Dashboard-UID"]=Le.dashboardUID,ie.headers["X-Panel-Id"]=Le.panelId)}_request(ie,Le,Be={}){if(this.access==="direct"){const pe=new Error("Browser access mode in the Prometheus datasource is no longer available. Switch to server access mode.");return(0,s._)(()=>pe)}Le=Le||{};for(const[pe,$e]of this.customQueryParameters)Le[pe]==null&&(Le[pe]=$e);let Ue=this.url+ie;ie.startsWith(`/api/datasources/uid/${this.uid}`)&&(Ue=ie);const ue=(0,t.defaults)(Be,{url:Ue,method:this.httpMethod,headers:{}});return ue.method==="GET"?Le&&Object.keys(Le).length&&(ue.url=ue.url+(ue.url.search(/\?/)>=0?"&":"?")+Object.entries(Le).map(([pe,$e])=>`${encodeURIComponent(pe)}=${encodeURIComponent($e)}`).join("&")):(ue.headers["Content-Type"]="application/x-www-form-urlencoded",ue.data=Le),(this.basicAuth||this.withCredentials)&&(ue.withCredentials=!0),this.basicAuth&&(ue.headers.Authorization=this.basicAuth),(0,b.i)().fetch(ue)}async importFromAbstractQueries(ie){return ie.map(Le=>this.languageProvider.importFromAbstractQuery(Le))}async exportToAbstractQueries(ie){return ie.map(Le=>this.languageProvider.exportToAbstractQuery(Le))}async metadataRequest(ie,Le={},Be){if(Ee.some(Ue=>ie.includes(Ue)))try{return await(0,r.n)(this._request(`/api/datasources/uid/${this.uid}/resources${ie}`,Le,{method:this.httpMethod,hideFromInspector:!0,showErrorAlert:!1,...Be}))}catch(Ue){if(this.httpMethod==="POST"&&(0,b.kW)(Ue)&&(Ue.status===405||Ue.status===400))console.warn("Couldn't use configured POST HTTP method for this request. Trying to use GET method instead.");else throw Ue}return await(0,r.n)(this._request(`/api/datasources/uid/${this.uid}/resources${ie}`,Le,{method:"GET",hideFromInspector:!0,...Be}))}interpolateQueryExpr(ie=[],Le){if(!Le.multi&&!Le.includeAll)return xe(ie);if(typeof ie=="string")return Te(ie);const Be=ie.map(Ue=>Te(Ue));return Be.length===1?Be[0]:"("+Be.join("|")+")"}targetContainsTemplate(ie){return this.templateSrv.containsTemplate(ie.expr)}shouldRunExemplarQuery(ie,Le){if(ie.exemplar){const Be=this.languageProvider.histogramMetrics.find(pe=>ie.expr.includes(pe)),Ue=Le.targets.findIndex(pe=>pe.refId===ie.refId),ue=Le.targets.slice(0,Ue).filter(pe=>!pe.hide);return!!(!Be||Be&&!ue.some(pe=>pe.expr.includes(Be)))}return!1}processTargetV2(ie,Le){const Be=[],Ue={...ie,exemplar:this.shouldRunExemplarQuery(ie,Le),requestId:Le.panelId+ie.refId,utcOffsetSec:this.timeSrv.timeRange().to.utcOffset()*60};return ie.instant&&ie.range?Be.push({...Ue,refId:Ue.refId,instant:!1},{...Ue,refId:Ue.refId+Ce,range:!1}):Be.push(Ue),Be}query(ie){if(this.access==="proxy"){let Le,Be;const Ue=ie.targets.some($e=>$e.instant);this.hasIncrementalQuery&&!Ue?(Be=this.cache.requestInfo(ie),Le=Be.requests[0]):Le=ie;const ue=Le.targets.map($e=>this.processTargetV2($e,Le)),pe=new Date;return super.query({...Le,targets:ue.flat()}).pipe((0,o.U)($e=>{const Se={...$e,data:this.cache.procFrames(ie,Be,$e.data)};return(0,we.n)(Se,ie,{exemplarTraceIdDestinations:this.exemplarTraceIdDestinations})}),(0,m.b)($e=>{qe($e,ie,pe)}))}else{const Le=(0,Q.jj)(ie.range.from,!1),Be=(0,Q.jj)(ie.range.to,!0),{queries:Ue,activeTargets:ue}=this.prepareTargets(ie,Le,Be);return!Ue||!Ue.length?(0,g.of)({data:[],state:D.Gu.Done}):ie.app===h.zj.Explore?this.exploreQuery(Ue,ue,Be):this.panelsQuery(Ue,ue,Be,ie.requestId,ie.scopedVars)}}exploreQuery(ie,Le,Be){let Ue=ie.length;const ue=ie.map((pe,$e)=>{const Se=Le[$e],Ve=(0,d.z)((0,m.b)(()=>Ue--),(0,c.h)(He=>!He.cancelled),(0,o.U)(He=>({data:(0,we.vs)(He,{query:pe,target:Se,responseListLength:ie.length,exemplarTraceIdDestinations:this.exemplarTraceIdDestinations}),key:pe.requestId,state:Ue===0?D.Gu.Done:D.Gu.Loading})));return this.runQuery(pe,Be,Ve)});return(0,l.T)(...ue)}panelsQuery(ie,Le,Be,Ue,ue){const pe=ie.map(($e,Se)=>{const Ve=Le[Se],He=(0,d.z)((0,c.h)(Ze=>!Ze.cancelled),(0,o.U)(Ze=>(0,we.vs)(Ze,{query:$e,target:Ve,responseListLength:ie.length,scopedVars:ue,exemplarTraceIdDestinations:this.exemplarTraceIdDestinations})));return this.runQuery($e,Be,He)});return(0,u.D)(pe).pipe((0,o.U)($e=>({data:$e.reduce((Ve,He)=>[...Ve,...He],[]),key:Ue,state:D.Gu.Done})))}runQuery(ie,Le,Be){return ie.instant?this.performInstantQuery(ie,Le).pipe(Be):ie.exemplar?this.getExemplars(ie).pipe((0,p.K)(()=>(0,g.of)({data:[],state:D.Gu.Done})),Be):this.performTimeSeriesQuery(ie,ie.start,ie.end).pipe(Be)}createQuery(ie,Le,Be,Ue){const ue={hinting:ie.hinting,instant:ie.instant,exemplar:ie.exemplar,step:0,expr:"",refId:ie.refId,start:0,end:0},pe=Math.ceil(Ue-Be);let $e=y.intervalToSeconds(Le.interval);const Se=y.intervalToSeconds(this.templateSrv.replace(ie.interval||Le.interval,Le.scopedVars)),Ve=ie.interval?y.intervalToSeconds(this.templateSrv.replace(ie.interval,Le.scopedVars)):y.intervalToSeconds(this.interval),He=ie.intervalFactor||1,Ze=this.adjustInterval($e,Se,pe,He);let Qe={...Le.scopedVars,...this.getRangeScopedVars(Le.range),...this.getRateIntervalScopedVariable(Ze,Ve)};$e!==Ze&&($e=Ze,Qe=Object.assign({},Le.scopedVars,{__interval:{text:$e+"s",value:$e+"s"},__interval_ms:{text:$e*1e3,value:$e*1e3},...this.getRateIntervalScopedVariable($e,Ve),...this.getRangeScopedVars(Le.range)})),ue.step=$e;let rt=ie.expr;rt=this.enhanceExprWithAdHocFilters(rt),ue.expr=this.templateSrv.replace(rt,Qe,this.interpolateQueryExpr);const pt=ze(Be,Ue,ue.step,this.timeSrv.timeRange().to.utcOffset()*60);return ue.start=pt.start,ue.end=pt.end,this._addTracingHeaders(ue,Le),ue}getRateIntervalScopedVariable(ie,Le){Le===0&&(Le=15);const Be=Math.max(ie+Le,4*Le);return{__rate_interval:{text:Be+"s",value:Be+"s"}}}adjustInterval(ie,Le,Be,Ue){let ue=Be/11e3;return ue>1&&(ue=Math.ceil(ue)),Math.max(ie*Ue,Le,ue)}performTimeSeriesQuery(ie,Le,Be){if(Le>Be)throw{message:"Invalid time range"};const Ue="/api/v1/query_range",ue={query:ie.expr,start:Le,end:Be,step:ie.step};return this.queryTimeout&&(ue.timeout=this.queryTimeout),this._request(Ue,ue,{requestId:ie.requestId,headers:ie.headers}).pipe((0,p.K)(pe=>pe.cancelled?(0,g.of)(pe):(0,s._)(this.handleErrors(pe,ie))))}performInstantQuery(ie,Le){const Be="/api/v1/query",Ue={query:ie.expr,time:Le};return this.queryTimeout&&(Ue.timeout=this.queryTimeout),this._request(`/api/datasources/uid/${this.uid}/resources${Be}`,Ue,{requestId:ie.requestId,headers:ie.headers}).pipe((0,p.K)(ue=>ue.cancelled?(0,g.of)(ue):(0,s._)(this.handleErrors(ue,ie))))}metricFindQuery(ie){if(!ie)return Promise.resolve([]);const Le={__interval:{text:this.interval,value:this.interval},__interval_ms:{text:y.intervalToMs(this.interval),value:y.intervalToMs(this.interval)},...this.getRangeScopedVars(this.timeSrv.timeRange())},Be=this.templateSrv.replace(ie,Le,this.interpolateQueryExpr);return new ye(this,Be).process()}getRangeScopedVars(ie=this.timeSrv.timeRange()){const Le=ie.to.diff(ie.from),Be=Math.round(Le/1e3);return{__range_ms:{text:Le,value:Le},__range_s:{text:Be,value:Be},__range:{text:Be+"s",value:Be+"s"}}}async annotationQuery(ie){if(this.access==="direct"){const pe=new Error("Browser access mode in the Prometheus datasource is no longer available. Switch to server access mode.");return Promise.reject(pe)}const Le=ie.annotation,{expr:Be=""}=Le;if(!Be)return Promise.resolve([]);const Ue=ie.annotation.step||me,ue={expr:Be,range:!0,instant:!1,exemplar:!1,interval:Ue,refId:"X",datasource:this.getRef()};return await(0,r.n)((0,b.i)().fetch({url:"/api/ds/query",method:"POST",headers:this.getRequestHeaders(),data:{from:((0,Q.jj)(ie.range.from,!1)*1e3).toString(),to:((0,Q.jj)(ie.range.to,!0)*1e3).toString(),queries:[this.applyTemplateVariables(ue,{})]},requestId:`prom-query-${Le.name}`}).pipe((0,o.U)(pe=>this.processAnnotationResponse(ie,pe.data))))}getExemplars(ie){const Le="/api/v1/query_exemplars";return this._request(Le,{query:ie.expr,start:ie.start.toString(),end:ie.end.toString()},{requestId:ie.requestId,headers:ie.headers})}async getTagKeys(ie){if(ie?.series){const Le=await Promise.all(ie.series.map(ue=>this.languageProvider.fetchSeriesLabels(ue)));let Be=[];return Le.map(ue=>Be=Be.concat(Object.keys(ue))),[...new Set(Be)].map(ue=>({text:ue}))}else{const Le=this.getTimeRangeParams();return(await this.metadataRequest("/api/v1/labels",Le))?.data?.data?.map(Ue=>({text:Ue}))??[]}}async getTagValues(ie={}){const Le=this.getTimeRangeParams();return(await this.metadataRequest(`/api/v1/label/${ie.key}/values`,Le))?.data?.data?.map(Ue=>({text:Ue}))??[]}async getBuildInfo(){try{return await(0,x.WG)({url:this.url,name:this.name,type:"prometheus"})}catch{return}}getBuildInfoMessage(ie){const Le=i.createElement(M.C,{color:"green",icon:"check",text:"Ruler API enabled"}),Be=i.createElement(M.C,{color:"orange",icon:"exclamation-triangle",text:"Ruler API not enabled"}),Ue=i.createElement(T.u,{placement:"top",content:"Prometheus does not allow editing rules, connect to either a Mimir or Cortex datasource to manage alerts via Grafana."},i.createElement("div",null,i.createElement(M.C,{color:"red",icon:"exclamation-triangle",text:"Ruler API not supported"}))),ue={[A.T8.Cortex]:"/public/app/plugins/datasource/prometheus/img/cortex_logo.svg",[A.T8.Mimir]:"/public/app/plugins/datasource/prometheus/img/mimir_logo.svg",[A.T8.Prometheus]:"/public/app/plugins/datasource/prometheus/img/prometheus_logo.svg",[A.T8.Thanos]:"/public/app/plugins/datasource/prometheus/img/thanos_logo.svg"},pe={[A.T8.Cortex]:"blue",[A.T8.Mimir]:"orange",[A.T8.Prometheus]:"red",[A.T8.Thanos]:"purple"},$e={[A.T8.Cortex]:"Cortex",[A.T8.Mimir]:"Mimir",[A.T8.Prometheus]:"Prometheus",[A.T8.Thanos]:"Thanos"},Se=this.datasourceConfigurationPrometheusFlavor??ie.application,Ve=i.createElement(M.C,{text:i.createElement("span",null,i.createElement("img",{style:{width:14,height:14,verticalAlign:"text-bottom"},src:ue[Se??A.T8.Prometheus],alt:""})," ",Se?$e[Se]:"Unknown"),color:pe[Se??A.T8.Prometheus]});return i.createElement("div",{style:{display:"grid",gridTemplateColumns:"max-content max-content",rowGap:"0.5rem",columnGap:"2rem",marginTop:"1rem"}},i.createElement("div",null,"Type"),i.createElement("div",null,Ve),i.createElement(i.Fragment,null,i.createElement("div",null,"Ruler API"),ie.application===A.T8.Prometheus&&i.createElement("div",null,Ue),ie.application!==A.T8.Prometheus&&i.createElement("div",null,ie.features.rulerApiEnabled?Le:Be)))}interpolateVariablesInQueries(ie,Le){let Be=ie;return ie&&ie.length&&(Be=ie.map(Ue=>({...Ue,datasource:this.getRef(),expr:this.enhanceExprWithAdHocFilters(this.templateSrv.replace(Ue.expr,Le,this.interpolateQueryExpr)),interval:this.templateSrv.replace(Ue.interval,Le)}))),Be}getQueryHints(ie,Le){return We(ie.expr??"",Le,this)}getInitHints(){return ke(this)}async loadRules(){try{const Le=(await this.metadataRequest("/api/v1/rules",{},{showErrorAlert:!1})).data?.data?.groups;Le&&(this.ruleMappings=Ie(Le))}catch(ie){console.log("Rules API is experimental. Ignore next error."),console.error(ie)}}async areExemplarsAvailable(){try{return(await this.metadataRequest("/api/v1/query_exemplars",{query:"test",start:(0,a.CQ)().subtract(30,"minutes").valueOf().toString(),end:(0,a.CQ)().valueOf().toString()},{showErrorAlert:!1})).data.status==="success"}catch{return!1}}modifyQuery(ie,Le){let Be=ie.expr??"";switch(Le.type){case"ADD_FILTER":{const{key:Ue,value:ue}=Le.options??{};Ue&&ue&&(Be=(0,W.F)(Be,Ue,ue));break}case"ADD_FILTER_OUT":{const{key:Ue,value:ue}=Le.options??{};Ue&&ue&&(Be=(0,W.F)(Be,Ue,ue,"!="));break}case"ADD_HISTOGRAM_QUANTILE":{Be=`histogram_quantile(0.95, sum(rate(${Be}[$__rate_interval])) by (le))`;break}case"ADD_RATE":{Be=`rate(${Be}[$__rate_interval])`;break}case"ADD_SUM":{Be=`sum(${Be.trim()}) by ($1)`;break}case"EXPAND_RULES":{Le.options&&(Be=(0,Q.ll)(Be,Le.options));break}default:break}return{...ie,expr:Be}}getAdjustedInterval(){if(!V.default.featureToggles.prometheusResourceBrowserCache)return this.getTimeRangeParams();const ie=this.timeSrv.timeRange();return(0,Q.wY)(this.cacheLevel,ie)}getTimeRangeParams(){const ie=this.timeSrv.timeRange();return{start:(0,Q.jj)(ie.from,!1).toString(),end:(0,Q.jj)(ie.to,!0).toString()}}getOriginalMetricName(ie){return(0,we.nM)(ie)}enhanceExprWithAdHocFilters(ie){return this.templateSrv.getAdhocFilters(this.name).reduce((Ue,ue)=>{const{key:pe,operator:$e}=ue;let{value:Se}=ue;return($e==="=~"||$e==="!~")&&(Se=xe(Se)),(0,W.F)(Ue,pe,Se,$e)},ie)}filterQuery(ie){return!(ie.hide||!ie.expr)}applyTemplateVariables(ie,Le){const Be=(0,t.cloneDeep)(Le);delete Be.__interval,delete Be.__interval_ms;const Ue=this.templateSrv.replace(ie.expr,Be,this.interpolateQueryExpr),ue=this.enhanceExprWithAdHocFilters(Ue);return{...ie,expr:ue,interval:this.templateSrv.replace(ie.interval,Be),legendFormat:this.templateSrv.replace(ie.legendFormat,Be)}}getVariables(){return this.templateSrv.getVariables().map(ie=>`$${ie.name}`)}interpolateString(ie){return this.templateSrv.replace(ie,void 0,this.interpolateQueryExpr)}getDebounceTimeInMilliseconds(){switch(this.cacheLevel){case le.x3.Medium:return 600;case le.x3.High:return 1200;default:return 350}}getDaysToCacheMetadata(){switch(this.cacheLevel){case le.x3.Medium:return 7;case le.x3.High:return 30;default:return 1}}getCacheDurationInMinutes(){return(0,Q.l3)(this.cacheLevel)}getDefaultQuery(ie){const Le={refId:"A",expr:"",range:!0,instant:!1};return ie===h.zj.UnifiedAlerting?{...Le,instant:!0,range:!1}:ie===h.zj.Explore?{...Le,instant:!0,range:!0}:Le}}function ze(Oe,ie,Le,Be){const Ue=Math.floor((ie+Be)/Le)*Le-Be,ue=Math.floor((Oe+Be)/Le)*Le-Be;return{end:Ue,start:ue}}function Ie(Oe){return Oe.reduce((ie,Le)=>Le.rules.filter(Be=>Be.type==="recording").reduce((Be,Ue)=>({...Be,[Ue.name]:Ue.query}),ie),{})}function xe(Oe){return typeof Oe=="string"?Oe.replace(/\\/g,"\\\\").replace(/'/g,"\\\\'"):Oe}function Te(Oe){return typeof Oe=="string"?Oe.replace(/\\/g,"\\\\\\\\").replace(/[$^*{}\[\]\'+?.()|]/g,"\\\\$&"):Oe}},41587:(j,I,e)=>{"use strict";e.d(I,{UQ:()=>M,ZK:()=>v,ZP:()=>B,nW:()=>S,ws:()=>T});var t=e(89949),n=e.n(t),i=e(84084),s=e(6570),r=e.n(s),g=e(99633),d=e(68246),l=e(69376),u=e(34667),o=e(95704),m=e(73308),c=e(60692),p=e(72054);const f=["job","instance"],E="{}",h=5,y=1e3*60*60*24,v=1e4,D=V=>({label:V}),a=V=>(V.kind="function",V),C=V=>({headers:{"X-Grafana-Cache":`private, max-age=${V}`}});function P(V,W){const w=Date.now()-y,N=W.filter(R=>R.ts>w&&R.query===V.label),F=N.length,k=N[0];let H=`Queried ${F} times in the last 24h.`;if(k){const R=(0,g.CQ)(k.ts).fromNow();H=`${H} Last queried ${R}.`}return{...V,documentation:H}}function b(V,W){const w={label:V};return W&&W[V]&&(w.documentation=M(V,W)),w}function M(V,W){if(!W[V])return;const{type:w,help:N}=W[V];return`${w.toUpperCase()}: ${N}`}function T(V,W){if(W[V])return W[V].help}function S(V,W){if(W[V])return W[V].type}const x=/(="|!="|=~"|!~"|\{|\[|\(|\+|-|\/|\*|%|\^|\band\b|\bor\b|\bunless\b|==|>=|!=|<=|>|<|=|~|,)/,O=86400;class B extends d.iL{constructor(W,w){super(),this.labelKeys=[],this.labelsCache=new i.z({max:10}),this.labelValuesCache=new i.z({max:10}),this.request=async(N,F,k={},H)=>{try{return(await this.datasource.metadataRequest(N,k,H)).data.data}catch(R){console.error(R)}return F},this.start=async()=>this.datasource.lookupsDisabled?[]:(this.metrics=await this.fetchLabelValues("__name__")||[],this.histogramMetrics=(0,m.NO)(this.metrics).sort(),Promise.all([this.loadMetricsMetadata(),this.fetchLabels()])),this.provideCompletionItems=async({prefix:N,text:F,value:k,labelKey:H,wrapperClasses:R},_={})=>{const G={suggestions:[]};if(!k)return G;const Y=k.document.text.length===0,X=k.document.getTextsAtRange(k.selection),Q=X.size===1?X.first().getText():null,se=Q?Q[k.selection.anchor.offset]:null,Z=R.length>3,le=N&&!Z,oe=!se||se===")",q=N&&!F.match(/^[\]})\s]+$/)&&oe,ne=/[+\-*/^%]/,ge=F.match(ne);return R.includes("context-range")?this.getRangeCompletionItems():R.includes("context-labels")?this.getLabelCompletionItems({prefix:N,text:F,value:k,labelKey:H,wrapperClasses:R}):R.includes("context-aggregation")?this.getAggregationCompletionItems(k):Y?this.getEmptyCompletionItems(_):le&&oe&&!ge?this.getBeginningCompletionItems(_):le&&q?this.getTermCompletionItems():G},this.getBeginningCompletionItems=N=>({suggestions:[...this.getEmptyCompletionItems(N).suggestions,...this.getTermCompletionItems().suggestions]}),this.getEmptyCompletionItems=N=>{const{history:F}=N,k=[];if(F&&F.length){const H=(0,t.chain)(F).map(R=>R.query.expr).filter().uniq().take(h).map(D).map(R=>P(R,F)).value();k.push({searchFunctionType:o.Z.Prefix,skipSort:!0,label:"History",items:H})}return{suggestions:k}},this.getTermCompletionItems=()=>{const{metrics:N,metricsMetadata:F}=this,k=[];return k.push({searchFunctionType:o.Z.Prefix,label:"Functions",items:c.r8.map(a)}),N&&N.length&&k.push({label:"Metrics",items:N.map(H=>b(H,F)),searchFunctionType:o.Z.Fuzzy}),{suggestions:k}},this.getAggregationCompletionItems=async N=>{const F=[];let k;const H=N.document.getBlocks().reduce((le,oe)=>{if(le===void 0)return"";if(!oe)return le;const q=oe?.getText();return N.anchorBlock.key===oe.key&&(k=N.selection.anchor.offset+le.length),le+q},""),R=H.lastIndexOf("(",k);let _=H.lastIndexOf("(",R-1),G=H.indexOf(")",_);if(_===-1){const le=H.indexOf(")",k);G=H.indexOf(")",le+1),_=H.lastIndexOf("(",G)}const Y={suggestions:F,context:"context-aggregation"};if(_===-1)return Y;const X=H.slice(_+1,G).replace(/\[[^\]]+\]$/,""),Q=(0,m.rV)(X,X.length-2).selector,se=await this.getSeries(Q),Z=Object.keys(se);if(Z.length>0){const le=(0,m.ZO)(Z);F.push({label:`Labels${le}`,items:Z.map(D),searchFunctionType:o.Z.Fuzzy})}return Y},this.getLabelCompletionItems=async({text:N,wrapperClasses:F,labelKey:k,value:H})=>{if(!H)return{suggestions:[]};const R=[],_=H.anchorBlock.getText(),G=H.selection.anchor.offset,Y=_.substr(G),X=_.substr(0,G),Q=N.match(/^(=|=~|!=|!~)/),se=Y.match(/^"?[,}]|$/),Z=X.match(/(=|=~|!=|!~)$/)&&Y.match(/^"/);if(!(Q&&se)&&!(se&&!Q)||Z)return{suggestions:R};let q,ne;try{ne=(0,m.rV)(_,G),q=ne.selector}catch{q=E}const ge=q.includes("__name__="),ae=ne?ne.labelKeys:[];let re={};if(q&&(re=await this.getSeries(q,!ge)),Object.keys(re).length===0)return console.warn(`Server did not return any values for selector = ${q}`),{suggestions:R};let De;if(N&&Q||F.includes("attr-value")){if(k&&re[k]){De="context-label-values";const he=(0,m.ZO)(re[k]);R.push({label:`Label values for "${k}"${he}`,items:re[k].map(D),searchFunctionType:o.Z.Fuzzy})}}else{const he=re?Object.keys(re):ge?null:f;if(he){const ye=(0,t.difference)(he,ae);if(ye.length){De="context-labels";const ce=ye.map(et=>({label:et})),ke={label:`Labels${(0,m.ZO)(ce)}`,items:ce,searchFunctionType:o.Z.Fuzzy};R.push(ke)}}}return{context:De,suggestions:R}},this.fetchLabelValues=async N=>{const F=this.datasource.getAdjustedInterval(),H=`/api/v1/label/${this.datasource.interpolateString(N)}/values`;return await this.request(H,[],F,this.getDefaultCacheHeaders())??[]},this.getSeriesValues=async(N,F)=>this.datasource.hasLabelsMatchAPISupport()?await this.fetchSeriesValuesWithMatch(N,F):(await this.getSeries(F))[N]??[],this.fetchSeriesValuesWithMatch=async(N,F)=>{const k=N?this.datasource.interpolateString(N):null,H=F?this.datasource.interpolateString(F):null,R=this.datasource.getAdjustedInterval(),_={...R,...H&&{"match[]":H}};return u.config.featureToggles.prometheusResourceBrowserCache?await this.request(`/api/v1/label/${k}/values`,[],_,this.getDefaultCacheHeaders())??[]:await this.fetchSeriesValuesLRUCache(k,R,N,_)},this.getSeriesLabels=async(N,F)=>{let k,H;this.datasource.hasLabelsMatchAPISupport()?(F.push({name:"__name__",value:"",op:"!="}),H=await this.fetchSeriesLabelsMatch(N),k=Object.keys(H)):(H=await this.getSeries(N),k=Object.keys(H));const R=new Set(F.map(_=>_.name));return k.filter(_=>!R.has(_))},this.fetchSeriesLabels=async(N,F)=>{const k=this.datasource.interpolateString(N),H=this.datasource.getAdjustedInterval(),R={...H,"match[]":k},_="/api/v1/series";if(!u.config.featureToggles.prometheusResourceBrowserCache)return await this.fetchSeriesLabelsLRUCache(k,H,F,_,R);const G=await this.request(_,[],R,this.getDefaultCacheHeaders()),{values:Y}=(0,m.DY)(G,F);return Y},this.fetchSeriesLabelsMatch=async(N,F)=>{const k=this.datasource.interpolateString(N),H=this.datasource.getAdjustedInterval(),R={...H,"match[]":k},_="/api/v1/labels";return u.config.featureToggles.prometheusResourceBrowserCache?(await this.request(_,[],R,this.getDefaultCacheHeaders())).reduce((Y,X)=>({...Y,[X]:""}),{}):await this.fetchSeriesLabelMatchLRUCache(k,H,F,_,R)},this.fetchSeries=async N=>{const F="/api/v1/series",H={...this.datasource.getTimeRangeParams(),"match[]":N};return await this.request(F,{},H,this.getDefaultCacheHeaders())},this.fetchDefaultSeries=(0,t.once)(async()=>{const N=await Promise.all(f.map(F=>this.fetchLabelValues(F)));return f.reduce((F,k,H)=>({...F,[k]:N[H]}),{})}),this.datasource=W,this.histogramMetrics=[],this.timeRange={start:0,end:0},this.metrics=[],Object.assign(this,w)}getDefaultCacheHeaders(){if(u.config.featureToggles.prometheusResourceBrowserCache&&this.datasource.cacheLevel!==p.x3.None)return C(this.datasource.getCacheDurationInMinutes()*60)}cleanText(W){return W.split(x).pop().trimLeft().replace(/"$/,"").replace(/^"/,"")}get syntax(){return c.ZP}async loadMetricsMetadata(){const W=u.config.featureToggles.prometheusResourceBrowserCache?C(this.datasource.getDaysToCacheMetadata()*O):{};this.metricsMetadata=(0,m.I4)(await this.request("/api/v1/metadata",{},{},{showErrorAlert:!1,...W}))}getLabelKeys(){return this.labelKeys}getRangeCompletionItems(){return{context:"context-range",suggestions:[{label:"Range vector",items:[...c.Ty]}]}}importFromAbstractQuery(W){return(0,m.e5)(W)}exportToAbstractQuery(W){const w=W.expr;if(!w||w.length===0)return{refId:W.refId,labelMatchers:[]};const N=r().tokenize(w,c.ZP),F=(0,m.UO)(N),k=A(w,N);return k&&k.length>0&&F.push({name:"__name__",operator:l.K2.Equal,value:k}),{refId:W.refId,labelMatchers:F}}async getSeries(W,w){if(this.datasource.lookupsDisabled)return{};try{return W===E?await this.fetchDefaultSeries():await this.fetchSeriesLabels(W,w)}catch(N){return console.error(N),{}}}async getLabelValues(W){return await this.fetchLabelValues(W)}async fetchLabels(){const W="/api/v1/labels",w=this.datasource.getAdjustedInterval();this.labelFetchTs=Date.now().valueOf();const N=await this.request(W,[],w,this.getDefaultCacheHeaders());return Array.isArray(N)&&(this.labelKeys=N.slice().sort()),[]}async fetchSeriesValuesLRUCache(W,w,N,F){const H=`/api/v1/label/?${new URLSearchParams({"match[]":W??"",start:(0,m.s4)(parseInt(w.start,10)).toString(),end:(0,m.s4)(parseInt(w.end,10)).toString(),name:N}).toString()}/values`;let R=this.labelValuesCache.get(H);return R||(R=await this.request(`/api/v1/label/${W}/values`,[],F),R&&this.labelValuesCache.set(H,R)),R??[]}async fetchSeriesLabelsLRUCache(W,w,N,F,k){const R=`/api/v1/series?${new URLSearchParams({"match[]":W,start:(0,m.s4)(parseInt(w.start,10)).toString(),end:(0,m.s4)(parseInt(w.end,10)).toString(),withName:N?"true":"false"}).toString()}`;let _=this.labelsCache.get(R);if(!_){const G=await this.request(F,[],k),{values:Y}=(0,m.DY)(G,N);_=Y,this.labelsCache.set(R,_)}return _}async fetchSeriesLabelMatchLRUCache(W,w,N,F,k){const H=new URLSearchParams({"match[]":W,start:(0,m.s4)(parseInt(w.start,10)).toString(),end:(0,m.s4)(parseInt(w.end,10)).toString(),withName:N?"true":"false"}),R=`${F}?${H.toString()}`;let _=this.labelsCache.get(R);return _||(_=(await this.request(F,[],k)).reduce((Y,X)=>({...Y,[X]:""}),{}),this.labelsCache.set(R,_)),_}}function A(V,W){let w="";for(let N in W)if(typeof W[N]=="string"){w=W[N];break}return w}},73308:(j,I,e)=>{"use strict";e.d(I,{DY:()=>c,I4:()=>v,NO:()=>m,PL:()=>A,U9:()=>S,UO:()=>W,ZO:()=>b,e5:()=>V,jj:()=>F,l3:()=>N,ll:()=>h,o8:()=>D,rV:()=>E,s4:()=>a,tU:()=>x,wY:()=>w});var t=e(89949),n=e.n(t),i=e(6570),s=e.n(i),r=e(69376),g=e(35596),d=e(1726),l=e(85085),u=e(41587),o=e(72054);const m=k=>{const H=new Set,R=new RegExp("_bucket($|:)");for(let _=0;_<k.length;_++){const G=k[_];R.test(G)&&H.add(G)}return[...H]};function c(k,H=!1){const R={};k.forEach(G=>{const{__name__:Y,...X}=G;H&&(R.__name__=R.__name__||new Set,R.__name__.has(Y)||R.__name__.add(Y)),Object.keys(X).forEach(Q=>{R[Q]||(R[Q]=new Set),R[Q].has(X[Q])||R[Q].add(X[Q])})});const _={};return P(Object.keys(R)).forEach(G=>{_[G]=P(Array.from(R[G]))}),{values:_,keys:Object.keys(_)}}const p=/\{[^}]*?(\}|$)/,f=/\b(\w+)(!?=~?)("[^"\n]*?")/g;function E(k,H=1){if(!k.match(p)){if(k.match(/^[A-Za-z:][\w:]*$/))return{selector:`{__name__="${k}"}`,labelKeys:["__name__"]};throw new Error("Query must contain a selector: "+k)}const R=k.slice(0,H),_=R.lastIndexOf("{"),G=R.lastIndexOf("}");if(_===-1)throw new Error("Not inside selector, missing open brace: "+R);if(G>-1&&G>_)throw new Error("Not inside selector, previous selector already closed: "+R);const Y=k.slice(H),Q=Y.indexOf("}")+H,se=Y.indexOf("{"),Z=se+H;if(Q===-1)throw new Error("Not inside selector, missing closing brace in suffix: "+Y);if(se>-1&&Z<Q)throw new Error("Not inside selector, next selector opens before this one closed: "+Y);const le=k.slice(_,Q),oe={};le.replace(f,(De,he,ye,ce)=>{const We=k.indexOf(De),ke=We+he.length+ye.length+1,et=We+he.length+ye.length+ce.length-1;return(H<ke||H>et)&&(oe[he]={value:ce,operator:ye}),""});const ne=k.slice(0,_).match(/[A-Za-z:][\w:]*$/);ne&&(oe.__name__={value:`"${ne[0]}"`,operator:"="});const ge=Object.keys(oe).sort(),re=["{",ge.map(De=>`${De}${oe[De].operator}${oe[De].value}`).join(","),"}"].join("");return{labelKeys:ge,selector:re}}function h(k,H){const R=Object.keys(H),_=new RegExp(`(\\s|^)(${R.join("|")})(\\s|$|\\(|\\[|\\{)`,"ig"),Y=k.replace(_,(se,Z,le,oe)=>`${Z}${H[le]}${oe}`).split(/(\+|\-|\*|\/|\%|\^)/),X=/(\)\{|\}\{|\]\{)/;return Y.map(se=>y(se,X)).join("")}function y(k,H){const R=k.match(H);if(!R)return k;const _=R.index??0,G=k.slice(0,_+1),Y=k.slice(_+1),X=[];Y.replace(f,(se,Z,le,oe)=>(X.push({key:Z,operator:le,value:oe}),""));let Q=G;return X.filter(Boolean).forEach(se=>{const Z=se.value.slice(1,-1);Q=(0,l.F)(Q,se.key,Z,se.operator)}),Q}function v(k){if(!k)return k;const H={},R={};for(const G in k){const Y=k[G][0];H[G]=Y,Y.type==="histogram"&&(R[`${G}_bucket`]={type:"counter",help:`Cumulative counters for the observation buckets (${Y.help})`},R[`${G}_count`]={type:"counter",help:`Count of events that have been observed for the histogram metric (${Y.help})`},R[`${G}_sum`]={type:"counter",help:`Total sum of all observed values for the histogram metric (${Y.help})`}),Y.type==="summary"&&(R[`${G}_count`]={type:"counter",help:`Count of events that have been observed for the base metric (${Y.help})`},R[`${G}_sum`]={type:"counter",help:`Total sum of all observed values for the base metric (${Y.help})`})}const _={};return _.ALERTS={type:"counter",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."},{...H,...R,..._}}function D(k){return a(k/1e3)}function a(k){return Math.floor(k/60)}function C(k,H=1){return Math.ceil(k/60)-Math.ceil(k/60)%H}function P(k){return k.slice(0,u.ZK)}function b(k){return k&&k.length>=u.ZK?`, limited to the first ${u.ZK} received items`:""}const M=/[*+?()|\\.\[\]{}^$]/g;function T(k){return k.replace(M,"\\$&")}function S(k){return k.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function x(k){return S(T(k))}const O={"=":r.K2.Equal,"!=":r.K2.NotEqual,"=~":r.K2.EqualRegEx,"!~":r.K2.NotEqualRegEx},B=(0,t.invert)(O);function A(k){const H=k.labelMatchers.map(R=>{const _=B[R.operator];return _?`${R.name}${_}"${R.value}"`:""}).filter(R=>R!=="").join(", ");return H?`{${H}}`:""}function V(k){return{refId:k.refId,expr:A(k),range:!0}}function W(k){const H=[];for(let R in k)if(k[R]instanceof i.Token){let _=k[R];if(_.type==="context-labels"){let G="",Y="",X="",Q=_.content;for(let se in Q)if(typeof Q[se]=="string"){let Z;Z=Q[se],(Z==="="||Z==="!="||Z==="=~"||Z==="!~")&&(X=Z)}else if(Q[se]instanceof i.Token)switch(Q[se].type){case"label-key":G=Q[se].content;break;case"label-value":Y=Q[se].content,Y=Y.substring(1,Y.length-1);const Z=O[X];Z&&H.push({name:G,operator:Z,value:Y});break}}}return H}function w(k,H){if(k===o.x3.None)return{start:F(H.from,!1).toString(),end:F(H.to,!0).toString()};const R=F(H.from,!1),_=(0,g.mB)(R,N(k)*60),G=F(H.to,!0),Y=C(G,N(k))*60;if(_===Y){const se=Y+N(k)*60;return{start:_.toString(),end:se.toString()}}const X=_.toString(),Q=Y.toString();return{start:X,end:Q}}function N(k){switch(k){case o.x3.Medium:return 10;case o.x3.High:return 60;default:return 1}}function F(k,H){return typeof k=="string"&&(k=d.parse(k,H)),Math.ceil(k.valueOf()/1e3)}},60692:(j,I,e)=>{"use strict";e.d(I,{Ty:()=>t,ZP:()=>u,r8:()=>g});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"],i=null,s=[{label:"acos",insertText:"acos",detail:"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"}],g=[...[{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"}],...s,{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`."},{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."},{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:"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:"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:"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."},{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 string, 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."},{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."}],d=g.map(o=>o.label),u={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(?:${g.map(o=>o.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:/[{};()`,.]/}},85400:(j,I,e)=>{"use strict";e.d(I,{K:()=>D,Z:()=>a});var t=e(60692),n=e(86146),i=e(4002),s=e(42994),r=e(29326);function g(){return[{id:r.G3.HistogramQuantile,name:"Histogram quantile",params:[{name:"Quantile",type:"number",options:[.99,.95,.9,.75,.5,.25]}],defaultParams:[.9],category:r.CM.Functions,renderer:s.pS,addOperationHandler:s.PP},{id:r.G3.LabelReplace,name:"Label replace",params:[{name:"Destination label",type:"string"},{name:"Replacement",type:"string"},{name:"Source label",type:"string"},{name:"Regex",type:"string"}],category:r.CM.Functions,defaultParams:["","$1","","(.*)"],renderer:s.zJ,addOperationHandler:s.PP},{id:r.G3.Ln,name:"Ln",params:[],defaultParams:[],category:r.CM.Functions,renderer:s.pS,addOperationHandler:s.PP},l(r.G3.Changes),l(r.G3.Rate,!0),l(r.G3.Irate),l(r.G3.Increase,!0),l(r.G3.Idelta),l(r.G3.Delta),d({id:r.G3.HoltWinters,params:[(0,s.kq)(),{name:"Smoothing Factor",type:"number"},{name:"Trend Factor",type:"number"}],defaultParams:["$__interval",.5,.5],alternativesKey:"range function",category:r.CM.RangeFunctions,renderer:s.e8,addOperationHandler:m,changeTypeHandler:u}),d({id:r.G3.PredictLinear,params:[(0,s.kq)(),{name:"Seconds from now",type:"number"}],defaultParams:["$__interval",60],alternativesKey:"range function",category:r.CM.RangeFunctions,renderer:s.e8,addOperationHandler:m,changeTypeHandler:u}),d({id:r.G3.QuantileOverTime,params:[(0,s.kq)(),{name:"Quantile",type:"number"}],defaultParams:["$__interval",.5],alternativesKey:"overtime function",category:r.CM.RangeFunctions,renderer:s.NZ,addOperationHandler:m,changeTypeHandler:u}),...n.EX,{id:r.G3.NestedQuery,name:"Binary operation with query",params:[],defaultParams:[],category:r.CM.BinaryOps,renderer:(P,b,M)=>M,addOperationHandler:c},d({id:r.G3.Abs}),d({id:r.G3.Absent}),d({id:r.G3.Acos,category:r.CM.Trigonometric}),d({id:r.G3.Acosh,category:r.CM.Trigonometric}),d({id:r.G3.Asin,category:r.CM.Trigonometric}),d({id:r.G3.Asinh,category:r.CM.Trigonometric}),d({id:r.G3.Atan,category:r.CM.Trigonometric}),d({id:r.G3.Atanh,category:r.CM.Trigonometric}),d({id:r.G3.Ceil}),d({id:r.G3.Clamp,name:"Clamp",params:[{name:"Minimum Scalar",type:"number"},{name:"Maximum Scalar",type:"number"}],defaultParams:[1,1]}),d({id:r.G3.ClampMax,params:[{name:"Maximum Scalar",type:"number"}],defaultParams:[1]}),d({id:r.G3.ClampMin,params:[{name:"Minimum Scalar",type:"number"}],defaultParams:[1]}),d({id:r.G3.Cos,category:r.CM.Trigonometric}),d({id:r.G3.Cosh,category:r.CM.Trigonometric}),d({id:r.G3.DayOfMonth,category:r.CM.Time}),d({id:r.G3.DayOfWeek,category:r.CM.Time}),d({id:r.G3.DayOfYear,category:r.CM.Time}),d({id:r.G3.DaysInMonth,category:r.CM.Time}),d({id:r.G3.Deg}),l(r.G3.Deriv),d({id:r.G3.Exp}),d({id:r.G3.Floor}),d({id:r.G3.Group}),d({id:r.G3.Hour}),d({id:r.G3.LabelJoin,params:[{name:"Destination Label",type:"string",editor:i.g},{name:"Separator",type:"string"},{name:"Source Label",type:"string",restParam:!0,optional:!0,editor:i.g}],defaultParams:["",",",""],renderer:p,addOperationHandler:f}),d({id:r.G3.Log10}),d({id:r.G3.Log2}),d({id:r.G3.Minute}),d({id:r.G3.Month}),d({id:r.G3.Pi,renderer:P=>`${P.id}()`}),d({id:r.G3.Quantile,params:[{name:"Value",type:"number"}],defaultParams:[1],renderer:s.pS}),d({id:r.G3.Rad}),l(r.G3.Resets),d({id:r.G3.Round,category:r.CM.Functions,params:[{name:"To Nearest",type:"number"}],defaultParams:[1]}),d({id:r.G3.Scalar}),d({id:r.G3.Sgn}),d({id:r.G3.Sin,category:r.CM.Trigonometric}),d({id:r.G3.Sinh,category:r.CM.Trigonometric}),d({id:r.G3.Sort}),d({id:r.G3.SortDesc}),d({id:r.G3.Sqrt}),d({id:r.G3.Stddev}),d({id:r.G3.Tan,category:r.CM.Trigonometric}),d({id:r.G3.Tanh,category:r.CM.Trigonometric}),d({id:r.G3.Time,renderer:P=>`${P.id}()`}),d({id:r.G3.Timestamp}),d({id:r.G3.Vector,params:[{name:"Value",type:"number"}],defaultParams:[1],renderer:P=>`${P.id}(${P.params[0]})`}),d({id:r.G3.Year})]}function d(C){return{...C,id:C.id,name:C.name??(0,s.t7)(C.id),params:C.params??[],defaultParams:C.defaultParams??[],category:C.category??r.CM.Functions,renderer:C.renderer??(C.params?s.zJ:s.pS),addOperationHandler:C.addOperationHandler??s.PP}}function l(C,P=!1){return{id:C,name:(0,s.t7)(C),params:[(0,s.kq)(P)],defaultParams:[P?"$__rate_interval":"$__interval"],alternativesKey:"range function",category:r.CM.RangeFunctions,renderer:o,addOperationHandler:m,changeTypeHandler:u}}function u(C,P){return(C.params[0]==="$__rate_interval"&&P.defaultParams[0]!=="$__rate_interval"||C.params[0]==="$__interval"&&P.defaultParams[0]!=="$__interval")&&(C.params=P.defaultParams),C}function o(C,P,b){let M=(C.params??[])[0]??"5m";return`${P.id}(${b}[${M}])`}function m(C,P,b){const M={id:C.id,params:C.defaultParams};return P.operations.length>0&&b.getOperationDef(P.operations[0].id).addOperationHandler===m?{...P,operations:[M,...P.operations.slice(1)]}:{...P,operations:[M,...P.operations]}}function c(C,P){return{...P,binaryQueries:[...P.binaryQueries??[],{operator:"/",query:P}]}}function p(C,P,b){if(typeof C.params[1]!="string")throw"The separator must be a string";const M=`"${C.params[1]}"`;return`${C.id}(${b}, "${C.params[0]}", ${M}, "${C.params.slice(2).join(M)}")`}function f(C,P){const b={id:C.id,params:C.defaultParams};return{...P,operations:[...P.operations,b]}}function E(){return[...(0,s.IT)(r.G3.Sum),...(0,s.IT)(r.G3.Avg),...(0,s.IT)(r.G3.Min),...(0,s.IT)(r.G3.Max),...(0,s.IT)(r.G3.Count),...(0,s.Z3)(r.G3.TopK,{params:[{name:"K-value",type:"number"}],defaultParams:[5]}),...(0,s.Z3)(r.G3.BottomK,{params:[{name:"K-value",type:"number"}],defaultParams:[5]}),...(0,s.Z3)(r.G3.CountValues,{params:[{name:"Identifier",type:"string"}],defaultParams:["count"]}),h(r.G3.SumOverTime),h(r.G3.AvgOverTime),h(r.G3.MinOverTime),h(r.G3.MaxOverTime),h(r.G3.CountOverTime),h(r.G3.LastOverTime),h(r.G3.PresentOverTime),h(r.G3.AbsentOverTime),h(r.G3.StddevOverTime)]}function h(C){return{id:C,name:(0,s.t7)(C),params:[(0,s.kq)()],defaultParams:["$__interval"],alternativesKey:"overtime function",category:r.CM.RangeFunctions,renderer:y,addOperationHandler:m}}function y(C,P,b){let M=(C.params??[])[0]??"$__interval";return`${P.id}(${b}[${M}])`}var v=e(54433);class D extends v.x{constructor(){super(()=>{const P=[...g(),...E()];for(const b of P){const M=t.r8.find(T=>T.insertText===b.id);M&&(b.documentation=M.documentation)}return P}),this.setOperationCategories([r.CM.Aggregations,r.CM.RangeFunctions,r.CM.Functions,r.CM.BinaryOps,r.CM.Trigonometric,r.CM.Time])}getQueryPatterns(){return[{name:"Rate then sum",type:r.Fz.Rate,operations:[{id:"rate",params:["$__rate_interval"]},{id:"sum",params:[]}]},{name:"Rate then sum by(label) then avg",type:r.Fz.Rate,operations:[{id:"rate",params:["$__rate_interval"]},{id:"__sum_by",params:[""]},{id:"avg",params:[]}]},{name:"Histogram quantile on rate",type:r.Fz.Histogram,operations:[{id:"rate",params:["$__rate_interval"]},{id:"__sum_by",params:["le"]},{id:"histogram_quantile",params:[.95]}]},{name:"Histogram quantile on increase",type:r.Fz.Histogram,operations:[{id:"increase",params:["$__rate_interval"]},{id:"__max_by",params:["le"]},{id:"histogram_quantile",params:[.95]}]},{name:"Binary Query",type:r.Fz.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 a=new D},86146:(j,I,e)=>{"use strict";e.d(I,{EX:()=>r,PX:()=>s,iQ:()=>i});var t=e(42994),n=e(29326);const i=[{id:n.G3.Addition,name:"Add scalar",sign:"+"},{id:n.G3.Subtraction,name:"Subtract scalar",sign:"-"},{id:n.G3.MultiplyBy,name:"Multiply by scalar",sign:"*"},{id:n.G3.DivideBy,name:"Divide by scalar",sign:"/"},{id:n.G3.Modulo,name:"Modulo by scalar",sign:"%"},{id:n.G3.Exponent,name:"Exponent",sign:"^"},{id:n.G3.EqualTo,name:"Equal to",sign:"==",comparison:!0},{id:n.G3.NotEqualTo,name:"Not equal to",sign:"!=",comparison:!0},{id:n.G3.GreaterThan,name:"Greater than",sign:">",comparison:!0},{id:n.G3.LessThan,name:"Less than",sign:"<",comparison:!0},{id:n.G3.GreaterOrEqual,name:"Greater or equal to",sign:">=",comparison:!0},{id:n.G3.LessOrEqual,name:"Less or equal to",sign:"<=",comparison:!0}],s=i.reduce((d,l)=>(d[l.sign]={id:l.id,comparison:l.comparison},d),{}),r=i.map(d=>{const l=[{name:"Value",type:"number"}],u=[2];return d.comparison&&(l.push({name:"Bool",type:"boolean",description:"If checked comparison will return 0 or 1 for the value rather than filtering."}),u.push(!1)),{id:d.id,name:d.name,params:l,defaultParams:u,alternativesKey:"binary scalar operations",category:n.CM.BinaryOps,renderer:g(d.sign),addOperationHandler:t.PP}});function g(d){return function(u,o,m){let c=u.params[0],p="";return u.params.length===2&&(p=u.params[1]?" bool":""),`${m} ${d}${p} ${c}`}}},4002:(j,I,e)=>{"use strict";e.d(I,{g:()=>g});var t=e(27702),n=e(81078),i=e(28580),s=e(85400),r=e(42994);function g({onChange:l,index:u,operationIndex:o,value:m,query:c,datasource:p}){const[f,E]=(0,t.useState)({});return t.createElement(i.Ph,{inputId:(0,r.i1)(o,u),autoFocus:m===""?!0:void 0,openMenuOnFocus:!0,onOpenMenu:async()=>{E({isLoading:!0});const h=await d(c,p);E({options:h,isLoading:void 0})},isLoading:f.isLoading,allowCustomValue:!0,noOptionsMessage:"No labels found",loadingMessage:"Loading labels",options:f.options,value:(0,n.E)(m),onChange:h=>l(u,h.value)})}async function d(l,u){let o=l.labels;u.type==="prometheus"&&(o=[{label:"__name__",op:"=",value:l.metric},...l.labels]);const m=s.Z.renderLabels(o),c=await u.languageProvider.fetchSeriesLabels(m);return Object.keys(c).map(p=>({label:p,value:p}))}},52390:(j,I,e)=>{"use strict";e.d(I,{U:()=>Be});var t=e(27702),n=e(41587),i=e(85400),s=e(55889),r=e(42844),g=e(89949),d=e(38162),l=e(2906),u=e(81924),o=e(71107),m=e(53901),c=e(56027),p=e.n(c),f=e(81078),E=e(74639),h=e(70774),y=e(76715),v=e(28580),D=e(3819),a=e.n(D),C=e(34667),P=e(66310),b=e(66670),M=e(73453),T=e(48024),S=e(22655),x=e(13741),O=e(1128),B=e(62108),A=e(16532),V=e(77720),W=e(50852),w=e(42074),N=e(80011),F=e(86312),k=e(63824);const{setFilteredMetricCount:H}=k.stateSlice.actions;async function R(ue,pe,$e){let Se=!0;const Ve=ue.languageProvider.metricsMetadata;Ve&&Object.keys(Ve).length===0&&(Se=!1);let He={},Ze={},Qe;return Qe=$e?.map(rt=>{const pt=_(rt,ue),It=`${rt}\xA6${pt.description}`;return He[rt]=pt,Ze[It]=pt,pt}),{isLoading:!1,hasMetadata:Se,metrics:Qe??[],metaHaystackDictionary:Ze,nameHaystackDictionary:He,totalMetricCount:Qe?.length??0,filteredMetricCount:Qe?.length??0}}function _(ue,pe){let $e=(0,n.nW)(ue,pe.languageProvider.metricsMetadata);const Se=(0,n.ws)(ue,pe.languageProvider.metricsMetadata);return["histogram","summary"].forEach(He=>{Se?.toLowerCase().includes(He)&&$e!==He&&($e+=` (${He})`)}),{value:ue,type:$e,description:Se}}function G(ue,pe){const $e=Y(ue);return!ue.isLoading&&ue.filteredMetricCount!==$e.length&&pe(H($e.length)),Q($e,ue.pageNum,ue.resultsPerPage)}function Y(ue){let pe=ue.metrics;return ue.fuzzySearchQuery&&!ue.useBackend&&(ue.fullMetaSearch?pe=ue.metaHaystackOrder.map($e=>ue.metaHaystackDictionary[$e]):pe=ue.nameHaystackOrder.map($e=>ue.nameHaystackDictionary[$e])),ue.selectedTypes.length>0&&(pe=pe.filter(($e,Se)=>ue.selectedTypes.some(He=>$e.type&&He.value?$e.type.includes(He.value):!$e.type&&He.value==="no type"))),ue.includeNullMetadata||(pe=pe.filter($e=>$e.type!==void 0&&$e.description!==void 0)),pe}function X(ue){if(!ue.metrics.length)return[];const pe=ue.resultsPerPage===0?1:ue.resultsPerPage,$e=Math.floor(Y(ue).length/pe)+1;return[...Array($e).keys()].map(Se=>Se+1)}function Q(ue,pe,$e){const Se=$e===0?1:$e,Ve=pe===1?0:(pe-1)*Se,He=Ve+Se;return ue.slice(Ve,He)}const se=(ue,pe,$e)=>ue<1?1:ue>$e?$e:ue??pe;async function Z(ue,pe,$e){const Se=(0,s.Vl)(ue),Ve=pe.map(Qe=>`,${Qe.label}="${Qe.value}"`),He=`label_values({__name__=~".*${Se}"${pe?Ve.join():""}},__name__)`;return await $e.metricFindQuery(He).then(Qe=>Qe.map(rt=>_(rt.text,$e)))}function le(ue,pe,$e,Se){switch(ue){case"grafana_prom_metric_encycopedia_tracking":(0,F.ff)(ue,{metric:$e,hasMetadata:pe?.hasMetadata,totalMetricCount:pe?.totalMetricCount,fuzzySearchQuery:pe?.fuzzySearchQuery,fullMetaSearch:pe?.fullMetaSearch,selectedTypes:pe?.selectedTypes});case"grafana_prom_metric_encycopedia_disable_text_wrap_interaction":(0,F.ff)(ue,{disableTextWrap:pe?.disableTextWrap});case"grafana_prometheus_metric_encyclopedia_open":(0,F.ff)(ue,{query:Se})}}const oe=[{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:"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."}],q={browse:"Search metrics by name",metadataSearchSwitch:"Include description in search",type:"Filter by type",includeNullMetadata:"Include results with no metadata",setUseBackend:"Enable regex search"};function ne(ue){const{state:pe,onChangeFullMetaSearch:$e,onChangeIncludeNullMetadata:Se,onChangeDisableTextWrap:Ve,onChangeUseBackend:He}=ue,Ze=(0,P.l4)(),Qe=ge(Ze);return t.createElement(t.Fragment,null,t.createElement("div",{className:Qe.selectItem},t.createElement(w.r,{"data-testid":me.searchWithMetadata,value:pe.fullMetaSearch,disabled:pe.useBackend||!pe.hasMetadata,onChange:()=>$e()}),t.createElement("div",{className:Qe.selectItemLabel},q.metadataSearchSwitch)),t.createElement("div",{className:Qe.selectItem},t.createElement(w.r,{value:pe.includeNullMetadata,disabled:!pe.hasMetadata,onChange:()=>Se()}),t.createElement("div",{className:Qe.selectItemLabel},q.includeNullMetadata)),t.createElement("div",{className:Qe.selectItem},t.createElement(w.r,{value:pe.disableTextWrap,onChange:()=>Ve()}),t.createElement("div",{className:Qe.selectItemLabel},"Disable text wrap")),t.createElement("div",{className:Qe.selectItem},t.createElement(w.r,{"data-testid":me.setUseBackend,value:pe.useBackend,onChange:()=>He()}),t.createElement("div",{className:Qe.selectItemLabel},q.setUseBackend,"\xA0"),t.createElement(N.u,{content:"Filter metric names by regex search, using an additional call on the Prometheus API.",placement:"bottom-end"},t.createElement(M.J,{name:"info-circle",size:"xs",className:Qe.settingsIcon}))))}function ge(ue){return{settingsIcon:(0,r.css)` color: ${ue.colors.text.secondary}; `,selectItem:(0,r.css)` display: flex; flex-direction: row; align-items: center; padding: 4px 0; `,selectItemLabel:(0,r.css)` margin: 0 0 0 ${ue.spacing(1)}; align-self: center; color: ${ue.colors.text.secondary}; font-size: 12px; `}}var ae=e(23852);function re({feedbackUrl:ue}){const pe=(0,P.wW)(De);return t.createElement(ae.K,null,t.createElement("a",{href:ue,className:pe.link,title:"The metrics explorer is new, please let us know how we can improve it",target:"_blank",rel:"noreferrer noopener"},t.createElement(M.J,{name:"comment-alt-message"})," Give feedback"))}function De(ue){return{link:(0,r.css)({color:ue.colors.text.secondary,fontSize:ue.typography.bodySmall.fontSize,":hover":{color:ue.colors.text.link},margin:"-25px 0 30px 0"})}}var he=e(83923);function ye(ue){const{metrics:pe,onChange:$e,onClose:Se,query:Ve,state:He,disableTextWrap:Ze}=ue,Qe=(0,P.l4)(),rt=ce(Qe,Ze);function pt(on){on.value&&($e({...Ve,metric:on.value}),le("grafana_prom_metric_encycopedia_tracking",He,on.value),Se())}function It(on){return He.fullMetaSearch&&on?t.createElement(t.Fragment,null,t.createElement("td",null,tn(on.type??"")),t.createElement("td",null,t.createElement(a(),{textToHighlight:on.description??"",searchWords:He.metaHaystackMatches,autoEscape:!0,highlightClassName:rt.matchHighLight}))):t.createElement(t.Fragment,null,t.createElement("td",null,tn(on.type??"")),t.createElement("td",null,on.description??""))}function _t(on,ln,Un){return t.createElement(t.Fragment,null,on,t.createElement("span",{className:rt.tooltipSpace},t.createElement(N.u,{content:t.createElement(t.Fragment,null,"When creating a ",ln,", Prometheus exposes multiple series with the type counter."," ",(0,he.Zg)(Un)),placement:"bottom-start",interactive:!0},t.createElement(M.J,{name:"info-circle",size:"xs"}))))}function tn(on){return on?on.includes("(summary)")?_t(on,"summary","https://prometheus.io/docs/concepts/metric_types/#summary"):on.includes("(histogram)")?_t(on,"histogram","https://prometheus.io/docs/concepts/metric_types/#histogram"):on:""}function qt(){let on;return He.fuzzySearchQuery||(on="There are no metrics found in the data source."),Ve.labels.length>0&&(on="There are no metrics found. Try to expand your label filters."),(He.fuzzySearchQuery||He.selectedTypes.length>0)&&(on="There are no metrics found. Try to expand your search and filters."),t.createElement("tr",{className:rt.noResults},t.createElement("td",{colSpan:3},on))}function cn(on){return on.useBackend?[on.fuzzySearchQuery]:on.fullMetaSearch?on.metaHaystackMatches:on.nameHaystackMatches}return t.createElement("table",{className:rt.table},t.createElement("thead",{className:rt.stickyHeader},t.createElement("tr",null,t.createElement("th",{className:`${rt.nameWidth} ${rt.tableHeaderPadding}`},"Name"),He.hasMetadata&&t.createElement(t.Fragment,null,t.createElement("th",{className:`${rt.typeWidth} ${rt.tableHeaderPadding}`},"Type"),t.createElement("th",{className:`${rt.descriptionWidth} ${rt.tableHeaderPadding}`},"Description")),t.createElement("th",{className:rt.selectButtonWidth}," "))),t.createElement("tbody",null,t.createElement(t.Fragment,null,pe.length>0&&pe.map((on,ln)=>t.createElement("tr",{key:on?.value??ln,className:rt.row},t.createElement("td",{className:rt.nameOverflow},t.createElement(a(),{textToHighlight:on?.value??"",searchWords:cn(He),autoEscape:!0,highlightClassName:rt.matchHighLight})),He.hasMetadata&&It(on),t.createElement("td",null,t.createElement(b.zx,{size:"md",variant:"secondary",onClick:()=>pt(on),className:rt.centerButton},"Select")))),pe.length===0&&!He.isLoading&&qt())))}const ce=(ue,pe)=>({table:(0,r.css)` ${pe?"":"table-layout: fixed;"} border-radius: ${ue.shape.borderRadius()}; width: 100%; white-space: ${pe?"nowrap":"normal"}; td { padding: ${ue.spacing(1)}; } td, th { min-width: ${ue.spacing(3)}; border-bottom: 1px solid ${ue.colors.border.weak}; } `,row:(0,r.css)` label: row; border-bottom: 1px solid ${ue.colors.border.weak} &:last-child { border-bottom: 0; } `,tableHeaderPadding:(0,r.css)` padding: 8px; `,matchHighLight:(0,r.css)` background: inherit; color: ${ue.components.textHighlight.text}; background-color: ${ue.components.textHighlight.background}; `,nameWidth:(0,r.css)` ${pe?"":"width: 37.5%;"} `,nameOverflow:(0,r.css)` ${pe?"":"overflow-wrap: anywhere;"} `,typeWidth:(0,r.css)` ${pe?"":"width: 15%;"} `,descriptionWidth:(0,r.css)` ${pe?"":"width: 35%;"} `,selectButtonWidth:(0,r.css)` ${pe?"":"width: 12.5%;"} `,stickyHeader:(0,r.css)` position: sticky; top: 0; background-color: ${ue.colors.background.primary}; `,noResults:(0,r.css)` text-align: center; color: ${ue.colors.text.secondary}; `,tooltipSpace:(0,r.css)` margin-left: 4px; `,centerButton:(0,r.css)` display: block; margin: auto; border: none; `}),We=(ue,pe)=>({modal:(0,r.css)` width: 85vw; ${ue.breakpoints.down("md")} { width: 100%; } ${ue.breakpoints.up("xl")} { width: 60%; } `,inputWrapper:(0,r.css)` display: flex; flex-direction: row; flex-wrap: wrap; `,inputItemFirst:(0,r.css)` flex-basis: 40%; padding-right: 16px; ${ue.breakpoints.down("md")} { padding-right: 0px; padding-bottom: 16px; } `,inputItem:(0,r.css)` flex-grow: 1; flex-basis: 20%; ${ue.breakpoints.down("md")} { min-width: 100%; } `,selectWrapper:(0,r.css)` margin-bottom: ${ue.spacing(1)}; `,resultsAmount:(0,r.css)` color: ${ue.colors.text.secondary}; font-size: 0.85rem; padding: 0 0 4px 0; `,resultsData:(0,r.css)` margin: 4px 0 ${ue.spacing(2)} 0; `,resultsDataCount:(0,r.css)` margin: 0; `,resultsDataFiltered:(0,r.css)` color: ${ue.colors.text.secondary}; text-align: center; border: solid 1px rgba(204, 204, 220, 0.25); padding: 7px; `,resultsDataFilteredText:(0,r.css)` display: inline; vertical-align: text-top; `,results:(0,r.css)` height: calc(80vh - 310px); overflow-y: scroll; `,resultsFooter:(0,r.css)` margin-top: 24px; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; position: sticky; `,currentlySelected:(0,r.css)` color: grey; opacity: 75%; font-size: 0.75rem; `,loadingSpinner:(0,r.css)` visibility: hidden; `,visible:(0,r.css)` visibility: visible; `,settingsBtn:(0,r.css)` float: right; `,noBorder:(0,r.css)` border: none; `,resultsPerPageLabel:(0,r.css)` color: ${ue.colors.text.secondary}; opacity: 75%; padding-top: 5px; font-size: 0.85rem; margin-right: 8px; `,resultsPerPageWrapper:(0,r.css)` display: flex; `});var ke=e(12354);const et=new ke.Z({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1});function we(ue,pe,$e){const[Se,Ve,He]=et.search(ue,pe,!1,1e5);let Ze=[],Qe=new Set;if(Se&&He){const rt=(pt,It)=>{It&&Qe.add(pt)};for(let pt=0;pt<He.length;pt++){let It=He[pt];ke.Z.highlight(ue[Ve.idx[It]],Ve.ranges[It],rt),Ze.push(ue[Ve.idx[It]])}$e([Ze,[...Qe]])}else pe||$e([[],[]])}const _e=(0,g.debounce)(we,300),{setIsLoading:Ge,buildMetrics:qe,filterMetricsBackend:st,setResultsPerPage:Me,setPageNum:be,setFuzzySearchQuery:Ke,setNameHaystack:Ye,setMetaHaystack:tt,setFullMetaSearch:nt,setIncludeNullMetadata:Pt,setSelectedTypes:xt,setUseBackend:bt,setDisableTextWrap:Rt,showAdditionalSettings:ct}=k.stateSlice.actions,it=ue=>{const{datasource:pe,isOpen:$e,onClose:Se,onChange:Ve,query:He,initialMetrics:Ze}=ue,[Qe,rt]=(0,t.useReducer)(k.stateSlice.reducer,(0,k.E3)(He)),pt=(0,P.l4)(),It=We(pt,Qe.disableTextWrap),_t=(0,t.useCallback)(async()=>{rt(Ge(!0));const yt=await R(pe,He,Ze);rt(qe({isLoading:!1,hasMetadata:yt.hasMetadata,metrics:yt.metrics,metaHaystackDictionary:yt.metaHaystackDictionary,nameHaystackDictionary:yt.nameHaystackDictionary,totalMetricCount:yt.metrics.length,filteredMetricCount:yt.metrics.length}))},[He,pe,Ze]);(0,t.useEffect)(()=>{_t()},[_t]);const tn=oe.map(yt=>({value:yt.value,label:yt.value,description:yt.description})),qt=(0,t.useMemo)(()=>p()(async yt=>{rt(Ge(!0));const ft=await Z(yt,He.labels,pe);rt(st({metrics:ft,filteredMetricCount:ft.length,isLoading:!1}))},pe.getDebounceTimeInMilliseconds()),[pe,He]);function cn(yt){rt(Ye(yt))}function on(yt){rt(tt(yt))}function ln(yt,ft){Qe.useBackend&&yt===""?_t():Qe.useBackend?qt(yt):ft?_e(Object.keys(Qe.metaHaystackDictionary),yt,on):_e(Object.keys(Qe.nameHaystackDictionary),yt,cn)}const Un=t.createElement(ne,{state:Qe,onChangeFullMetaSearch:()=>{const yt=!Qe.fullMetaSearch;rt(nt(yt)),Ve({...He,fullMetaSearch:yt}),ln(Qe.fuzzySearchQuery,yt)},onChangeIncludeNullMetadata:()=>{rt(Pt(!Qe.includeNullMetadata)),Ve({...He,includeNullMetadata:!Qe.includeNullMetadata})},onChangeDisableTextWrap:()=>{rt(Rt()),Ve({...He,disableTextWrap:!Qe.disableTextWrap}),le("grafana_prom_metric_encycopedia_disable_text_wrap_interaction",Qe,"")},onChangeUseBackend:()=>{const yt=!Qe.useBackend;rt(bt(yt)),Ve({...He,useBackend:yt}),yt===!1?_t():Qe.fuzzySearchQuery!==""&&qt(Qe.fuzzySearchQuery)}});return t.createElement(x.u,{"data-testid":me.metricModal,isOpen:$e,title:"Metrics explorer",onDismiss:Se,"aria-label":"Browse metrics",className:It.modal},t.createElement(re,{feedbackUrl:"https://forms.gle/DEMAJHoAMpe3e54CA"}),t.createElement("div",{className:It.inputWrapper},t.createElement("div",{className:(0,r.cx)(It.inputItem,It.inputItemFirst)},t.createElement(O.I,{autoFocus:!0,"data-testid":me.searchMetric,placeholder:q.browse,value:Qe.fuzzySearchQuery,onInput:yt=>{const ft=yt.currentTarget.value??"";rt(Ke(ft)),ln(ft,Qe.fullMetaSearch)}})),Qe.hasMetadata&&t.createElement("div",{className:It.inputItem},t.createElement(v.NU,{"data-testid":me.selectType,inputId:"my-select",options:tn,value:Qe.selectedTypes,placeholder:q.type,onChange:yt=>rt(xt(yt))})),t.createElement("div",null,t.createElement(B.$,{className:`${It.loadingSpinner} ${Qe.isLoading?It.visible:""}`})),t.createElement("div",{className:It.inputItem},t.createElement(A.P,{"aria-label":"Additional settings",content:Un,placement:"bottom-end",closeButton:!1},t.createElement(V.h,{className:It.settingsBtn},t.createElement(b.zx,{variant:"secondary",size:"md",onClick:()=>rt(ct()),"data-testid":me.showAdditionalSettings,className:It.noBorder},"Additional Settings"),t.createElement(b.zx,{className:It.noBorder,variant:"secondary",icon:Qe.showAdditionalSettings?"angle-up":"angle-down"}))))),t.createElement("div",{className:It.resultsData},He.metric&&t.createElement("i",{className:It.currentlySelected},"Currently selected: ",He.metric),He.labels.length>0&&t.createElement("div",{className:It.resultsDataFiltered},t.createElement(M.J,{name:"info-circle",size:"sm"}),t.createElement("div",{className:It.resultsDataFilteredText},"\xA0These metrics have been pre-filtered by labels chosen in the label filters."))),t.createElement("div",{className:It.results},Qe.metrics&&t.createElement(ye,{metrics:G(Qe,rt),onChange:Ve,onClose:Se,query:He,state:Qe,disableTextWrap:Qe.disableTextWrap})),t.createElement("div",{className:It.resultsFooter},t.createElement("div",{className:It.resultsAmount},"Showing ",Qe.filteredMetricCount," of ",Qe.totalMetricCount," results"),t.createElement(W.t,{currentPage:Qe.pageNum??1,numberOfPages:X(Qe).length,onNavigate:yt=>{rt(be(yt??1))}}),t.createElement("div",{className:It.resultsPerPageWrapper},t.createElement("p",{className:It.resultsPerPageLabel},"# Results per page\xA0"),t.createElement(O.I,{"data-testid":me.resultsPerPage,value:se(Qe.resultsPerPage,k.Xc,k.s6),placeholder:"results per page",width:10,title:"The maximum results per page is "+k.s6,type:"number",onInput:yt=>{const ft=+yt.currentTarget.value;isNaN(ft)||ft>=k.s6||rt(Me(ft))}}))))},me={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"},Ee=" ",Ce=1e3;function Ae({datasource:ue,query:pe,onChange:$e,onGetMetrics:Se,labelsFilters:Ve,metricLookupDisabled:He,onBlur:Ze,variableEditor:Qe}){const rt=(0,P.wW)(ze),[pt,It]=(0,t.useState)({}),_t=C.config.featureToggles.prometheusMetricEncyclopedia,tn=[{value:"BrowseMetrics",label:"Metrics explorer",description:"Browse and filter metrics and metadata with a fuzzy search"}],qt=(0,t.useCallback)((Bt,Nt)=>{const Ft=Bt.label??Bt.value;return Ft?Ft.toLowerCase?Nt.split(Ee).reduce((dn,sn)=>{const Bn=Ft.toLowerCase().includes(sn.toLowerCase());let wt=!1;return _t&&(wt=Ft==="Metrics explorer"),dn&&(Bn||wt)},!0):!0:!1},[_t]),cn=(0,t.useCallback)((Bt,Nt)=>Bt.__isNew__?Bt.label:t.createElement(a(),{searchWords:Nt.inputValue.split(Ee),textToHighlight:Bt.label??"",highlightClassName:rt.highlight}),[rt.highlight]),on=(Bt,Nt)=>{const Ft=(0,s.Vl)(Bt);return Ie(Ft,Nt)},ln=Bt=>ue.metricFindQuery(on(Bt,Ve)).then(Ft=>{Ft.length>Ce&&Ft.splice(0,Ft.length-Ce);const Gt=Ft.map(dn=>({label:dn.text,value:dn.text}));return _t?[...tn,...Gt]:Gt}),Un=()=>Promise.resolve([]),yt=p()(Bt=>ln(Bt),ue.getDebounceTimeInMilliseconds()),ft=Bt=>{const Nt=Bt.data;if(Nt.value==="BrowseMetrics"){const Ft=Bt.isFocused?rt.focus:"";return t.createElement("div",{...Bt.innerProps,ref:Bt.innerRef,className:`${rt.customOptionWidth} metric-encyclopedia-open`,onKeyDown:Gt=>{Gt.code==="Enter"&&It({...pt,metricsModalOpen:!0})}},t.createElement("div",{className:`${rt.customOption} ${Ft} metric-encyclopedia-open`},t.createElement("div",null,t.createElement("div",{className:"metric-encyclopedia-open"},Nt.label),t.createElement("div",{className:`${rt.customOptionDesc} metric-encyclopedia-open`},Nt.description)),t.createElement(b.zx,{fill:"text",size:"sm",variant:"secondary",onClick:()=>It({...pt,metricsModalOpen:!0}),className:"metric-encyclopedia-open"},"Open",t.createElement(M.J,{name:"arrow-right"}))))}return(0,S.Qn)(Bt)},Tt=()=>t.createElement(v.qb,{isClearable:!!Qe,inputId:"prometheus-metric-select",className:rt.select,value:pe.metric?(0,f.E)(pe.metric):void 0,placeholder:"Select metric",allowCustomValue:!0,formatOptionLabel:cn,filterOption:qt,onOpenMenu:async()=>{if(He)return;It({isLoading:!0});const Bt=await Se(),Nt=Bt.map(Ft=>Ft.value);Bt.length>Ce&&Bt.splice(0,Bt.length-Ce),It(_t?{metrics:[...tn,...Bt],isLoading:void 0,initialMetrics:Nt}:{metrics:Bt,isLoading:void 0})},loadOptions:He?Un:yt,isLoading:pt.isLoading,defaultOptions:pt.metrics,onChange:Bt=>{const Nt=Bt?.value;Nt?_t&&Nt==="BrowseMetrics"?(le("grafana_prometheus_metric_encyclopedia_open",null,"",pe),It({...pt,metricsModalOpen:!0})):$e({...pe,metric:Nt}):$e({...pe,metric:""})},components:_t?{Option:ft}:{},onBlur:Ze||(()=>{})});return t.createElement(t.Fragment,null,_t&&!ue.lookupsDisabled&&pt.metricsModalOpen&&t.createElement(it,{datasource:ue,isOpen:pt.metricsModalOpen,onClose:()=>It({...pt,metricsModalOpen:!1}),query:pe,onChange:$e,initialMetrics:pt.initialMetrics??[]}),Qe?t.createElement(o.Z,null,t.createElement(T._,{label:"Metric",labelWidth:20,tooltip:t.createElement("div",null,"Optional: returns a list of label values for the label name in the specified metric.")},Tt())):t.createElement(l.s,null,t.createElement(u.S,{label:"Metric"},Tt())))}const ze=ue=>({select:(0,r.css)` min-width: 125px; `,highlight:(0,r.css)` label: select__match-highlight; background: inherit; padding: inherit; color: ${ue.colors.warning.contrastText}; background-color: ${ue.colors.warning.main}; `,customOption:(0,r.css)` padding: 8px; display: flex; justify-content: space-between; cursor: pointer; :hover { background-color: ${ue.colors.emphasize(ue.colors.background.primary,.1)}; } `,customOptionlabel:(0,r.css)` color: ${ue.colors.text.primary}; `,customOptionDesc:(0,r.css)` color: ${ue.colors.text.secondary}; font-size: ${ue.typography.size.xs}; opacity: 50%; `,focus:(0,r.css)` background-color: ${ue.colors.emphasize(ue.colors.background.primary,.1)}; `,customOptionWidth:(0,r.css)` min-width: 400px; `}),Ie=(ue,pe)=>{const $e=pe?xe(pe):[];return`label_values({__name__=~".*${ue}"${$e?$e.join(""):""}},__name__)`},xe=ue=>ue.map(pe=>`,${pe.label}="${pe.value}"`);function Te({item:ue,defaultOp:pe,onChange:$e,onDelete:Se,onGetLabelNames:Ve,onGetLabelValues:He,invalidLabel:Ze,invalidValue:Qe,getLabelValuesAutofillSuggestions:rt,debounceDuration:pt}){const[It,_t]=(0,t.useState)({}),[tn,qt]=(0,t.useState)(!1),[cn,on]=(0,t.useState)(!1),ln=(ft=ue.op)=>Oe.find(Tt=>Tt.label===ft)?.isMultiValue,Un=ft=>ft?ft.indexOf("|")>0?ft.split("|"):[ft]:[],yt=p()(ft=>rt(ft,ue.label),pt);return t.createElement("div",{"data-testid":"prometheus-dimensions-filter-item"},t.createElement(h.B,null,t.createElement(v.Ph,{placeholder:"Select label","aria-label":E.wl.components.QueryBuilder.labelSelect,inputId:"prometheus-dimensions-filter-item-key",width:"auto",value:ue.label?(0,f.E)(ue.label):null,allowCustomValue:!0,onOpenMenu:async()=>{_t({isLoadingLabelNames:!0});const ft=await Ve(ue);qt(!0),_t({labelNames:ft,isLoadingLabelNames:void 0})},onCloseMenu:()=>{qt(!1)},isOpen:tn,isLoading:It.isLoadingLabelNames??!1,options:It.labelNames,onChange:ft=>{ft.label&&$e({...ue,op:ue.op??pe,label:ft.label})},invalid:Ze}),t.createElement(v.Ph,{"aria-label":E.wl.components.QueryBuilder.matchOperatorSelect,className:"query-segment-operator",value:(0,f.E)(ue.op??pe),options:Oe,width:"auto",onChange:ft=>{ft.value!=null&&$e({...ue,op:ft.value,value:ln(ft.value)?ue.value:Un(ue?.value)[0]})}}),t.createElement(v.qb,{placeholder:"Select value","aria-label":E.wl.components.QueryBuilder.valueSelect,inputId:"prometheus-dimensions-filter-item-value",width:"auto",value:ln()?Un(ue?.value).map(f.E):Un(ue?.value).map(f.E)[0],allowCustomValue:!0,onOpenMenu:async()=>{_t({isLoadingLabelValues:!0});const ft=await He(ue);ft.length>Ce&&ft.splice(0,ft.length-Ce),on(!0),_t({...It,labelValues:ft,isLoadingLabelValues:void 0})},onCloseMenu:()=>{on(!1)},isOpen:cn,defaultOptions:It.labelValues,isMulti:ln(),isLoading:It.isLoadingLabelValues,loadOptions:yt,onChange:ft=>{if(ft.value)$e({...ue,value:ft.value,op:ue.op??pe});else{const Tt=ft.map(Bt=>Bt.label).join("|");$e({...ue,value:Tt,op:ue.op??pe})}},invalid:Qe}),t.createElement(y._,{"aria-label":"remove",icon:"times",variant:"secondary",onClick:Se})))}const Oe=[{label:"=",value:"=",isMultiValue:!1},{label:"!=",value:"!=",isMultiValue:!1},{label:"<",value:"<",isMultiValue:!1},{label:">",value:">",isMultiValue:!1},{label:"=~",value:"=~",isMultiValue:!0},{label:"!~",value:"!~",isMultiValue:!0}],ie="Select at least 1 label filter (label and value)";function Le({labelsFilters:ue,onChange:pe,onGetLabelNames:$e,onGetLabelValues:Se,labelFilterRequired:Ve,getLabelValuesAutofillSuggestions:He,debounceDuration:Ze,variableEditor:Qe}){const rt="=",[pt,It]=(0,t.useState)([{op:rt}]);(0,t.useEffect)(()=>{ue.length>0?It(ue):It([{op:rt}])},[ue]);const _t=cn=>{It(cn);const on=cn.filter(ln=>ln.label!=null&&ln.value!=null);(0,g.isEqual)(on,ue)||pe(on)},tn=pt.some(cn=>cn.label&&cn.value),qt=()=>t.createElement(d.k,{items:pt,onChange:_t,renderItem:(cn,on,ln)=>t.createElement(Te,{debounceDuration:Ze,item:cn,defaultOp:rt,onChange:on,onDelete:ln,onGetLabelNames:$e,onGetLabelValues:Se,invalidLabel:Ve&&!cn.label,invalidValue:Ve&&!cn.value,getLabelValuesAutofillSuggestions:He})});return t.createElement(t.Fragment,null,Qe?t.createElement(o.Z,null,t.createElement("div",{className:(0,r.cx)((0,r.css)` display: flex; `)},t.createElement(m.W,{width:20,tooltip:t.createElement("div",null,"Optional: used to filter the metric select for this query type.")},"Label filters"),qt())):t.createElement(l.s,null,t.createElement(u.S,{label:"Label filters",error:ie,invalid:Ve&&!tn},qt())))}function Be({datasource:ue,query:pe,onChange:$e,onBlur:Se,variableEditor:Ve}){const He=qt=>{$e({...pe,labels:qt})},Ze=(0,t.useCallback)(async qt=>{const cn=ue.getVariables(),on=await qt;return[...cn.map(ln=>({label:ln,value:ln})),...on.map(ln=>({label:ln.value,value:ln.value,title:ln.description}))]},[ue]),Qe=async qt=>{if(!pe.metric)return await ue.languageProvider.fetchLabels(),ue.languageProvider.getLabelKeys().map(Un=>({value:Un}));const cn=pe.labels.filter(Un=>Un!==qt);cn.push({label:"__name__",op:"=",value:pe.metric});const on=i.Z.renderLabels(cn);let ln;return ue.hasLabelsMatchAPISupport()?ln=await ue.languageProvider.fetchSeriesLabelsMatch(on):ln=await ue.languageProvider.fetchSeriesLabels(on),Object.keys(ln).filter(Un=>!cn.find(yt=>yt.label===Un)).map(Un=>({value:Un}))},rt=(qt,cn)=>{const on={label:cn??"__name__",op:"=~",value:(0,s.Vl)(`.*${qt}`)},ln=pe.labels.filter(Tt=>Tt.label!==on.label);ln.push(on),pe.metric&&ln.push({label:"__name__",op:"=",value:pe.metric});const Un=ln.map(Tt=>({...Tt,label:ue.interpolateString(Tt.label),value:ue.interpolateString(Tt.value)})),yt=i.Z.renderLabels(Un);let ft;return ue.hasLabelsMatchAPISupport()?ft=It(on,yt):ft=pt(on,yt),ft.then(Tt=>(Tt.length>Ce&&Tt.splice(0,Tt.length-Ce),Tt))},pt=(qt,cn)=>{if(!qt.label)return Promise.resolve([]);const on=ue.languageProvider.fetchSeries(cn),ln=ue.interpolateString(qt.label);return on.then(Un=>{const yt=new Set;return Un.forEach(ft=>{const Tt=ft[ln];yt.add(Tt)}),Array.from(yt).map(ft=>({label:ft,value:ft}))})},It=(qt,cn)=>qt.label?ue.languageProvider.fetchSeriesValuesWithMatch(qt.label,cn).then(on=>on.map(ln=>({value:ln,label:ln}))):Promise.resolve([]),_t=async qt=>{if(!qt.label)return[];if(!pe.metric)return(await ue.languageProvider.getLabelValues(qt.label)).map(Un=>({value:Un}));const cn=pe.labels.filter(Un=>Un!==qt);cn.push({label:"__name__",op:"=",value:pe.metric});const on=cn.map(Un=>({...Un,label:ue.interpolateString(Un.label),value:ue.interpolateString(Un.value)})),ln=i.Z.renderLabels(on);return ue.hasLabelsMatchAPISupport()?It(qt,ln):pt(qt,ln)},tn=(0,t.useCallback)(()=>Ze(Ue(ue,pe)),[ue,pe,Ze]);return t.createElement(t.Fragment,null,t.createElement(Ae,{query:pe,onChange:$e,onGetMetrics:tn,datasource:ue,labelsFilters:pe.labels,metricLookupDisabled:ue.lookupsDisabled,onBlur:Se||(()=>{}),variableEditor:Ve}),t.createElement(Le,{debounceDuration:ue.getDebounceTimeInMilliseconds(),getLabelValuesAutofillSuggestions:rt,labelsFilters:pe.labels,onChange:He,onGetLabelNames:qt=>Ze(Qe(qt)),onGetLabelValues:qt=>Ze(_t(qt)),variableEditor:Ve}))}async function Ue(ue,pe){ue.languageProvider.metricsMetadata||await ue.languageProvider.loadMetricsMetadata(),ue.languageProvider.metricsMetadata||(ue.languageProvider.metricsMetadata={});let $e;if(pe.labels.length>0){const Se=i.Z.renderLabels(pe.labels);$e=(await ue.languageProvider.getSeries(Se,!0)).__name__??[]}else $e=await ue.languageProvider.getLabelValues("__name__")??[];return $e.map(Se=>({value:Se,description:(0,n.UQ)(Se,ue.languageProvider.metricsMetadata)}))}},56746:(j,I,e)=>{"use strict";e.d(I,{A:()=>u,n:()=>o});var t=e(27702),n=e(23852),i=e(60692),s=e(85400),r=e(84848),g=e(1234),d=e(61589),l=e(86383);const u="Fetch all series matching metric name and label filters.",o=t.memo(({query:m})=>{const c=(0,r._)(m||"").query,p={grammar:i.ZP,name:"promql"};return t.createElement(n.K,{gap:.5,direction:"column"},t.createElement(g.B,{stepNumber:1,title:t.createElement(l.U,{query:`${c.metric} ${s.Z.renderLabels(c.labels)}`,lang:p})},u),t.createElement(d.V,{stepNumber:2,queryModeller:s.Z,query:c,lang:p}))});o.displayName="PromQueryBuilderExplained"},86096:(j,I,e)=>{"use strict";e.d(I,{j:()=>g});var t=e(42844),n=e(27702),i=e(66310),s=e(95054),r=e(56746);function g(l){const{query:u,datasource:o,range:m,onRunQuery:c,onChange:p,data:f,app:E,showExplain:h}=l,y=(0,i.wW)(d);return n.createElement("div",{className:y.wrapper},n.createElement(s.ZP,{datasource:o,query:u,range:m,onRunQuery:c,onChange:p,history:[],data:f,app:E}),h&&n.createElement(r.n,{query:u.expr}))}const d=l=>({wrapper:(0,t.css)` .gf-form { margin-bottom: 0; } `})},63824:(j,I,e)=>{"use strict";e.d(I,{E3:()=>r,Gw:()=>g,Xc:()=>n,s6:()=>i,stateSlice:()=>s});var t=e(34099);const n=100,i=1e3,s=(0,t.oM)({name:"metrics-modal-state",initialState:r(),reducers:{filterMetricsBackend:(d,l)=>{d.metrics=l.payload.metrics,d.filteredMetricCount=l.payload.filteredMetricCount,d.isLoading=l.payload.isLoading},buildMetrics:(d,l)=>{d.isLoading=l.payload.isLoading,d.metrics=l.payload.metrics,d.hasMetadata=l.payload.hasMetadata,d.metaHaystackDictionary=l.payload.metaHaystackDictionary,d.nameHaystackDictionary=l.payload.nameHaystackDictionary,d.totalMetricCount=l.payload.totalMetricCount,d.filteredMetricCount=l.payload.filteredMetricCount},setIsLoading:(d,l)=>{d.isLoading=l.payload},setFilteredMetricCount:(d,l)=>{d.filteredMetricCount=l.payload},setResultsPerPage:(d,l)=>{d.resultsPerPage=l.payload},setPageNum:(d,l)=>{d.pageNum=l.payload},setFuzzySearchQuery:(d,l)=>{d.fuzzySearchQuery=l.payload,d.pageNum=1},setNameHaystack:(d,l)=>{d.nameHaystackOrder=l.payload[0],d.nameHaystackMatches=l.payload[1]},setMetaHaystack:(d,l)=>{d.metaHaystackOrder=l.payload[0],d.metaHaystackMatches=l.payload[1]},setFullMetaSearch:(d,l)=>{d.fullMetaSearch=l.payload,d.pageNum=1},setIncludeNullMetadata:(d,l)=>{d.includeNullMetadata=l.payload,d.pageNum=1},setSelectedTypes:(d,l)=>{d.selectedTypes=l.payload,d.pageNum=1},setUseBackend:(d,l)=>{d.useBackend=l.payload,d.fullMetaSearch=!1,d.pageNum=1},setDisableTextWrap:d=>{d.disableTextWrap=!d.disableTextWrap},showAdditionalSettings:d=>{d.showAdditionalSettings=!d.showAdditionalSettings}}});function r(d){return{isLoading:!0,metrics:[],hasMetadata:!0,metaHaystackDictionary:{},metaHaystackMatches:[],metaHaystackOrder:[],nameHaystackDictionary:{},nameHaystackOrder:[],nameHaystackMatches:[],totalMetricCount:0,filteredMetricCount:null,resultsPerPage:n,pageNum:1,fuzzySearchQuery:"",fullMetaSearch:d?.fullMetaSearch??!1,includeNullMetadata:d?.includeNullMetadata??!0,selectedTypes:[],useBackend:d?.useBackend??!1,disableTextWrap:d?.disableTextWrap??!1,showAdditionalSettings:!1}}function g(d){return{useBackend:d?.useBackend??!1,disableTextWrap:d?.disableTextWrap??!1,fullMetaSearch:d?.fullMetaSearch??!1,includeNullMetadata:d.includeNullMetadata??!1}}},84848:(j,I,e)=>{"use strict";e.d(I,{_:()=>s});var t=e(23419),n=e(86146),i=e(55889);function s(h){const y=(0,i.bU)(h),D=t.E2.parse(y).topNode,C={query:{metric:"",labels:[],operations:[]},errors:[]};try{g(y,D,C)}catch(P){console.error(P),P instanceof Error&&C.errors.push({text:P.message})}return E(C.query)&&(C.errors=[]),r(h)&&(C.errors=[]),C}function r(h){const y={query:{metric:"",labels:[],operations:[]},errors:[]};h=h.replace(/\$__interval/g,"1s"),h=h.replace(/\$__interval_ms/g,"1000"),h=h.replace(/\$__rate_interval/g,"1s"),h=h.replace(/\$__range_ms/g,"1000"),h=h.replace(/\$__range_s/g,"1"),h=h.replace(/\$__range/g,"1s");const D=t.E2.parse(h).topNode;try{g(h,D,y)}catch{return!1}return y.errors.length===0}function g(h,y,v){const D=v.query;switch(y.type.id){case t.tz:{D.metric=(0,i.KF)(h,y);break}case t.Zm:{D.labels.push(l(h,y));const a=y.getChild(i._A);a&&v.errors.push((0,i.wf)(h,a));break}case t.lX:{o(h,y,v);break}case t.aZ:{m(h,y,v);break}case t.vU:{p(h,y,v);break}case i._A:{if(d(y))break;v.errors.push((0,i.wf)(h,y));break}default:{y.type.id===t.Om&&v.errors.push((0,i.wf)(h,y));let a=y.firstChild;for(;a;)g(h,a,v),a=a.nextSibling}}}function d(h){return h.prevSibling?.type.id===t.wi&&h.prevSibling?.firstChild?.type.id===t.m6}function l(h,y){const v=(0,i.KF)(h,y.getChild(t.m0)),D=(0,i.KF)(h,y.getChild(t.e8)),a=(0,i.KF)(h,y.getChild(t.nv)).replace(/"/g,"");return{label:v,op:D,value:a}}const u=["changes","rate","irate","increase","delta"];function o(h,y,v){const D=v.query,a=y.getChild(t.hT),C=(0,i.KF)(h,a),b=y.getChild(t.yY).getChild(t.mW),M=[];let T="";if(u.includes(C)||C.endsWith("_over_time")){let x=(0,i.KF)(h,y).match(/\[(.+)\]/);x?.[1]&&(T=x[1],M.push(x[1]))}const S={id:C,params:M};if(D.operations.unshift(S),b){if((0,i.KF)(h,b)===T+"]")return;c(h,b,v,S)}}function m(h,y,v){const D=v.query,a=y.getChild(t.Ki);let C=(0,i.KF)(h,a);const P=y.getChild(t.Ip),b=[];P&&(P.getChild("By")&&C&&(C=`__${C}_by`),P.getChild(t.yN)&&(C=`__${C}_without`),b.push(...(0,i.ff)(h,P,t.Tm)));const T=y.getChild(t.yY).getChild(t.mW),S={id:C,params:[]};D.operations.unshift(S),c(h,T,v,S),S.params.push(...b)}function c(h,y,v,D){if(y)switch(y.type.id){case t.wi:case t.mW:{let a=y.firstChild;for(;a;)c(h,a,v,D),a=a.nextSibling;break}case t.iy:{D.params.push(parseFloat((0,i.KF)(h,y)));break}case t.nv:{D.params.push((0,i.KF)(h,y).replace(/"/g,""));break}default:g(h,y,v)}}function p(h,y,v){const D=v.query,a=y.firstChild,C=(0,i.KF)(h,a.nextSibling),P=f(h,y.getChild(t.v3)),b=y.lastChild,M=n.PX[C],T=a.getChild(t.iy),S=b.getChild(t.iy),x=b.getChild(t.vU);if(T||g(h,a,v),S)D.operations.push((0,i.Es)(M,h,b,!!P?.isBool));else if(x){const O=(0,i.ge)(b);O?.type.id===t.iy&&D.operations.push((0,i.Es)(M,h,O,!!P?.isBool)),g(h,b,v)}else{D.binaryQueries=D.binaryQueries||[];const O={operator:C,query:{metric:"",labels:[],operations:[]}};P?.isMatcher&&(O.vectorMatchesType=P.matchType,O.vectorMatches=P.matches),D.binaryQueries.push(O),g(h,b,{query:O.query,errors:v.errors})}}function f(h,y){if(y){if(y.getChild("Bool"))return{isBool:!0,isMatcher:!1};{const v=y.getChild(t.Wc);return v?{isMatcher:!0,isBool:!1,matches:(0,i.KF)(h,v.getChild(t.XT)?.getChild(t.pQ)),matchType:v.getChild(t.On)?"on":"ignoring"}:void 0}}}function E(h){return h.labels.length===0&&h.operations.length===0&&!h.metric}},54433:(j,I,e)=>{"use strict";e.d(I,{x:()=>i});var t=e(25359),n=e(29326);class i{constructor(r){this.categories=[],this.operationsRegistry=new t.B(r)}setOperationCategories(r){this.categories=r}getOperationsForCategory(r){return this.operationsRegistry.list().filter(g=>g.category===r&&!g.hideFromList)}getAlternativeOperations(r){return this.operationsRegistry.list().filter(g=>g.alternativesKey&&g.alternativesKey===r)}getCategories(){return this.categories}getOperationDef(r){return this.operationsRegistry.getIfExists(r)}renderOperations(r,g){for(const d of g){const l=this.operationsRegistry.getIfExists(d.id);if(!l)throw new Error(`Could not find operation ${d.id} in the registry`);r=l.renderer(d,l,r)}return r}renderBinaryQueries(r,g){if(g)for(const d of g)r=`${this.renderBinaryQuery(r,d)}`;return r}renderBinaryQuery(r,g){let d=r+` ${g.operator} `;return g.vectorMatches&&(d+=`${g.vectorMatchesType}(${g.vectorMatches}) `),d+this.renderQuery(g.query,!0)}renderLabels(r){if(r.length===0)return"";let g="{";for(const d of r)g!=="{"&&(g+=", "),g+=`${d.label}${d.op}"${d.value}"`;return g+"}"}renderQuery(r,g){let d=`${r.metric??""}${this.renderLabels(r.labels)}`;return d=this.renderOperations(d,r.operations),!g&&this.hasBinaryOp(r)&&r.binaryQueries?.length&&(d=`(${d})`),d=this.renderBinaryQueries(d,r.binaryQueries),g&&(this.hasBinaryOp(r)||r.binaryQueries?.length)&&(d=`(${d})`),d}hasBinaryOp(r){return r.operations.find(g=>this.getOperationDef(g.id)?.category===n.CM.BinaryOps)!==void 0}}},1234:(j,I,e)=>{"use strict";e.d(I,{B:()=>r});var t=e(42844),n=e(27702),i=e(18112),s=e(66310);function r({title:d,stepNumber:l,markdown:u,children:o}){const m=(0,s.wW)(g);return n.createElement("div",{className:m.box},l!==void 0&&n.createElement("div",{className:m.stepNumber},l),n.createElement("div",{className:m.boxInner},d&&n.createElement("div",{className:m.header},n.createElement("span",null,d)),n.createElement("div",{className:m.body},u&&n.createElement("div",{dangerouslySetInnerHTML:{__html:(0,i.a)(u)}}),o)))}const g=d=>({box:(0,t.css)({background:d.colors.background.secondary,padding:d.spacing(1),borderRadius:d.shape.borderRadius(),position:"relative"}),boxInner:(0,t.css)({marginLeft:d.spacing(4)}),stepNumber:(0,t.css)({fontWeight:d.typography.fontWeightMedium,background:d.colors.secondary.main,width:"20px",height:"20px",borderRadius:d.shape.radius.circle,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"10px",left:"11px",fontSize:d.typography.bodySmall.fontSize}),header:(0,t.css)({paddingBottom:d.spacing(.5),display:"flex",alignItems:"center",fontFamily:d.typography.fontFamilyMonospace}),body:(0,t.css)({color:d.colors.text.secondary,"p:last-child":{margin:0},a:{color:d.colors.text.link,textDecoration:"underline"}})})},61589:(j,I,e)=>{"use strict";e.d(I,{V:()=>s});var t=e(27702),n=e(1234),i=e(86383);function s({query:r,queryModeller:g,stepNumber:d,lang:l,onMouseEnter:u,onMouseLeave:o}){return t.createElement(t.Fragment,null,r.operations.map((m,c)=>{const p=g.getOperationDef(m.id);if(!p)return`Operation ${m.id} not found`;const f=p.renderer(m,p,"<expr>"),E=p.explainHandler?p.explainHandler(m,p):p.documentation??"no docs";return t.createElement("div",{key:c,onMouseEnter:()=>u?.(m,c),onMouseLeave:()=>o?.(m,c)},t.createElement(n.B,{stepNumber:c+d,title:t.createElement(i.U,{query:f,lang:l}),markdown:E}))}))}},86383:(j,I,e)=>{"use strict";e.d(I,{U:()=>g});var t=e(42844),n=e(6570),i=e.n(n),s=e(27702),r=e(66310);function g({query:l,lang:u,className:o}){const m=(0,r.l4)(),c=d(m),p=i().highlight(l,u.grammar,u.name);return s.createElement("div",{className:(0,t.cx)(c.editorField,"prism-syntax-highlight",o),"aria-label":"selector",dangerouslySetInnerHTML:{__html:p}})}const d=l=>({editorField:(0,t.css)({fontFamily:l.typography.fontFamilyMonospace,fontSize:l.typography.bodySmall.fontSize})})},42994:(j,I,e)=>{"use strict";e.d(I,{IT:()=>y,NZ:()=>m,PP:()=>p,Sp:()=>C,Z3:()=>v,ZI:()=>M,Zc:()=>T,e8:()=>o,i1:()=>E,j8:()=>b,kq:()=>h,pS:()=>d,t7:()=>f,zJ:()=>l});var t=e(89949),n=e.n(t),i=e(6772),s=e.n(i),r=e(4002),g=e(29326);function d(S,x,O){const B=c(S,x,O),A=S.id+"(";return O&&B.push(O),A+B.join(", ")+")"}function l(S,x,O){const B=c(S,x,O),A=S.id+"(";return O&&B.unshift(O),A+B.join(", ")+")"}function u(S,x,O,B){if(x.params.length<2)throw`Cannot render a function with params of length [${x.params.length}]`;let A=(S.params??[])[0]??"5m";const V=c({...S,params:S.params.slice(1)},{...x,params:x.params.slice(1),defaultParams:x.defaultParams.slice(1)},O),W=S.id+"(";return O&&(B?V.push(`${O}[${A}]`):V.unshift(`${O}[${A}]`)),W+V.join(", ")+")"}function o(S,x,O){return u(S,x,O,!1)}function m(S,x,O){return u(S,x,O,!0)}function c(S,x,O){return(S.params??[]).map((B,A)=>x.params[A].type==="string"?'"'+B+'"':B)}function p(S,x){const O={id:S.id,params:S.defaultParams};return{...x,operations:[...x.operations,O]}}function f(S){return(0,t.capitalize)(S.replace(/_/g," "))}function E(S,x){return`operations.${S}.param.${x}`}function h(S=!1){const x={name:"Range",type:"string",options:[{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 S&&x.options.unshift({label:"$__rate_interval",value:"$__rate_interval"}),x}function y(S,x={}){return[{id:S,name:f(S),params:[{name:"By label",type:"string",restParam:!0,optional:!0}],defaultParams:[],alternativesKey:"plain aggregations",category:g.CM.Aggregations,renderer:d,paramChangedHandler:M(`__${S}_by`),explainHandler:C(S,""),addOperationHandler:p,...x},{id:`__${S}_by`,name:`${f(S)} by`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:r.g}],defaultParams:[""],alternativesKey:"aggregations by",category:g.CM.Aggregations,renderer:D(S),paramChangedHandler:b(S),explainHandler:C(S,"by"),addOperationHandler:p,hideFromList:!0,...x},{id:`__${S}_without`,name:`${f(S)} without`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:r.g}],defaultParams:[""],alternativesKey:"aggregations by",category:g.CM.Aggregations,renderer:a(S),paramChangedHandler:b(S),explainHandler:C(S,"without"),addOperationHandler:p,hideFromList:!0,...x}]}function v(S,x,O={}){const B=y(S,O);return B[0].params.unshift(...x.params),B[1].params.unshift(...x.params),B[2].params.unshift(...x.params),B[0].defaultParams=x.defaultParams,B[1].defaultParams=[...x.defaultParams,""],B[2].defaultParams=[...x.defaultParams,""],B[1].renderer=P(S),B[2].renderer=P(S),B}function D(S){return function(O,B,A){return`${S} by(${O.params.join(", ")}) (${A})`}}function a(S){return function(O,B,A){return`${S} without(${O.params.join(", ")}) (${A})`}}function C(S,x){return function(B){const A=B.params.map(W=>`\`${W}\``).join(" and "),V=s()("label",B.params.length);switch(x){case"by":return`Calculates ${S} over dimensions while preserving ${V} ${A}.`;case"without":return`Calculates ${S} over the dimensions ${A}. All other labels are preserved.`;default:return`Calculates ${S} over the dimensions.`}}}function P(S){return function(O,B,A){const V=B.params.findIndex(N=>N.restParam),W=O.params.slice(0,V),w=O.params.slice(V);return`${S} by(${w.join(", ")}) (${W.map((N,F)=>B.params[F].type==="string"?`"${N}"`:N).join(", ")}, ${A})`}}function b(S){return function(O,B,A){return B.params.length<A.params.length?{...B,id:S}:B}}function M(S){return function(O,B,A){return B.params.length===A.params.length?{...B,id:S}:B}}function T(S,x){if(!S.label||!S.op||!S.value||x.length<2)return!1;const O=S.op.toString().startsWith("!");return x.filter(V=>V.label===S.label&&V.value===S.value&&V.op!==S.op).some(V=>!!(O&&V?.op?.toString().startsWith("!")===!1||O===!1&&V?.op?.toString().startsWith("!")))}},55889:(j,I,e)=>{"use strict";e.d(I,{Es:()=>u,KF:()=>l,Tt:()=>d,Vl:()=>E,_A:()=>t,bU:()=>r,ff:()=>o,ge:()=>n,wf:()=>i});const t=0;function n(h){return h.firstChild?n(h.firstChild):h}function i(h,y){return{text:l(h,y),from:y.from,to:y.to,parentType:y.parent?.name}}const s=/\$(\w+)|\[\[([\s\S]+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g;function r(h){return h.replace(s,(y,v,D,a,C,P,b)=>{const M=a||b;let T=v,S="0";return D&&(T=D,S="1"),C&&(T=C,S="2"),`__V_${S}__`+T+"__V__"+(M?"__F__"+M+"__F__":"")})}const g=[(h,y)=>`$${h}`,(h,y)=>`[[${h}${y?`:${y}`:""}]]`,(h,y)=>`\${${h}${y?`:${y}`:""}}`];function d(h){return h.replace(/__V_(\d)__(.+?)__V__(?:__F__(\w+)__F__)?/g,(y,v,D,a)=>g[parseInt(v,10)](D,a))}function l(h,y){return y?d(h.substring(y.from,y.to)):""}function u(h,y,v,D){const a=[parseFloat(l(y,v))];return h.comparison&&a.push(D),{id:h.id,params:a}}function o(h,y,v){if(y.type.id===v||y.name===v)return[l(h,y)];const D=[];let a=0,C=y.childAfter(a);for(;C;)D.push(...o(h,C,v)),a=C.to,C=y.childAfter(a);return D}function m(h,y){if(!y){console.log("<empty>");return}const v=c(h,y),D=p(v);if(!D){console.log("<empty>");return}console.log(D)}function c(h,y){const v={},D=f(h,y),a=[];let C=0,P=y.childAfter(C);for(;P;)a.push(c(h,P)),C=P.to,P=y.childAfter(C);return v.name=D,v.children=a,v}function p(h,y={lastChild:!0,indent:""}){const v=h.name,{lastChild:D,indent:a}=y;let P=(a!==""?a+(D?"\u2514\u2500":"\u251C\u2500"):"")+v;const b=h.children;return b.forEach((M,T)=>{const S=T===b.length-1;P+=` `+p(M,{lastChild:S,indent:a+(D?" ":"\u2502 ")})}),P}function f(h,y){return y.name+": "+l(h,y)}const E=h=>h.split(" ").map(v=>`${v}.*`).join("")},39568:(j,I,e)=>{"use strict";e.d(I,{c:()=>t});var t=(n=>(n.Code="code",n.Builder="builder",n))(t||{})},29326:(j,I,e)=>{"use strict";e.d(I,{CM:()=>t,Fz:()=>i,G3:()=>n});var t=(s=>(s.Aggregations="Aggregations",s.RangeFunctions="Range functions",s.Functions="Functions",s.BinaryOps="Binary operations",s.Trigonometric="Trigonometric",s.Time="Time Functions",s))(t||{}),n=(s=>(s.Abs="abs",s.Absent="absent",s.AbsentOverTime="absent_over_time",s.Acos="acos",s.Acosh="acosh",s.Asin="asin",s.Asinh="asinh",s.Atan="atan",s.Atanh="atanh",s.Avg="avg",s.AvgOverTime="avg_over_time",s.BottomK="bottomk",s.Ceil="ceil",s.Changes="changes",s.Clamp="clamp",s.ClampMax="clamp_max",s.ClampMin="clamp_min",s.Cos="cos",s.Cosh="cosh",s.Count="count",s.CountOverTime="count_over_time",s.CountScalar="count_scalar",s.CountValues="count_values",s.DayOfMonth="day_of_month",s.DayOfWeek="day_of_week",s.DayOfYear="day_of_year",s.DaysInMonth="days_in_month",s.Deg="deg",s.Delta="delta",s.Deriv="deriv",s.DropCommonLabels="drop_common_labels",s.Exp="exp",s.Floor="floor",s.Group="group",s.HistogramQuantile="histogram_quantile",s.HoltWinters="holt_winters",s.Hour="hour",s.Idelta="idelta",s.Increase="increase",s.Irate="irate",s.LabelJoin="label_join",s.LabelReplace="label_replace",s.Last="last",s.LastOverTime="last_over_time",s.Ln="ln",s.Log10="log10",s.Log2="log2",s.Max="max",s.MaxOverTime="max_over_time",s.Min="min",s.MinOverTime="min_over_time",s.Minute="minute",s.Month="month",s.Pi="pi",s.PredictLinear="predict_linear",s.Present="present",s.PresentOverTime="present_over_time",s.Quantile="quantile",s.QuantileOverTime="quantile_over_time",s.Rad="rad",s.Rate="rate",s.Resets="resets",s.Round="round",s.Scalar="scalar",s.Sgn="sgn",s.Sin="sin",s.Sinh="sinh",s.Sort="sort",s.SortDesc="sort_desc",s.Sqrt="sqrt",s.Stddev="stddev",s.StddevOverTime="stddev_over_time",s.Sum="sum",s.SumOverTime="sum_over_time",s.Tan="tan",s.Tanh="tanh",s.Time="time",s.Timestamp="timestamp",s.TopK="topk",s.Vector="vector",s.Year="year",s.Addition="__addition",s.Subtraction="__subtraction",s.MultiplyBy="__multiply_by",s.DivideBy="__divide_by",s.Modulo="__modulo",s.Exponent="__exponent",s.NestedQuery="__nested_query",s.EqualTo="__equal_to",s.NotEqualTo="__not_equal_to",s.GreaterThan="__greater_than",s.LessThan="__less_than",s.GreaterOrEqual="__greater_or_equal",s.LessOrEqual="__less_or_equal",s))(n||{}),i=(s=>(s.Rate="rate",s.Histogram="histogram",s.Binary="binary",s))(i||{})},94962:(j,I,e)=>{"use strict";e.d(I,{tQ:()=>p,Ji:()=>m});var t=e(32082),n=e(99633),i=e(35596),s=e(75308),r=e(34667),g=e(86312),d=e(47838);function l(f,E){let[h]=f,[y]=E,v=h.length,D=h[0],a=h[v-1],C=y.length,P=y[0],b=y[C-1],M;if(v)if(C){if(P>a)M=f.map((T,S)=>f[S].concat(E[S]));else if(b<D)M=E.map((T,S)=>E[S].concat(f[S]));else if(P<=D&&b>=a)M=E;else if(!(P>D&&b<a)){if(P>=D){let T=(0,d.Ko)(P,h);T=h[T]<P?T-1:T,M=f.map((S,x)=>f[x].slice(0,T).concat(E[x]))}else if(b>=D){let T=(0,d.Ko)(b,h);T=h[T]<b?T:T+1,M=E.map((S,x)=>E[x].concat(f[x].slice(T)))}}}else M=f;else C?M=E:M=[[]];return M}function u(f,E,h){let[y,...v]=f,D,a;return y[0]<E&&(D=(0,d.Ko)(E,y),y[D]<E&&D++),y[y.length-1]>h&&(a=(0,d.Ko)(h,y),y[a]>h&&a--),(D!=null||a!=null)&&(y=y.slice(D??0,a),v=v.map(C=>C.slice(D??0,a))),[y,...v]}var o=e(26858);const m="10m",c=f=>`${f.type}|${f.name}|${JSON.stringify(f.labels??"")}`;class p{constructor(E){this.sendEventsInterval=6e4*10,this.pendingRequestIdsToTargSigs=new Map,this.pendingAccumulatedEvents=new Map,this.cache=new Map,this.sendPendingTrackingEvents=()=>{const y=this.pendingAccumulatedEvents.entries();for(let[v,D]of y)if(!D.sent){const a={datasource:D.datasource.toString(),requestCount:D.requestCount.toString(),savedBytesTotal:D.savedBytesTotal.toString(),initialRequestSize:D.initialRequestSize.toString(),lastRequestSize:D.lastRequestSize.toString(),panelId:D.panelId.toString(),dashId:D.dashId.toString(),expr:D.expr.toString(),refreshIntervalMs:D.refreshIntervalMs.toString(),from:D.from.toString(),queryRangeSeconds:D.queryRangeSeconds.toString()};r.config.featureToggles.prometheusIncrementalQueryInstrumentation?(0,g.ff)("grafana_incremental_queries_profile",a):s.s.api.pushEvent&&s.s.api.pushEvent("incremental query response size",a,"no-interaction",{skipDedupe:!0}),this.pendingAccumulatedEvents.set(v,{...D,sent:!0,requestCount:0,savedBytesTotal:0,initialRequestSize:0,lastRequestSize:0})}};const h=E.overlapString;if((0,t.jO)(h)){const y=(0,t.RA)(h);this.overlapWindowMs=(0,t.iX)(y)}else{const y=(0,t.RA)(m);this.overlapWindowMs=(0,t.iX)(y)}(r.config.grafanaJavascriptAgent.enabled||r.config.featureToggles?.prometheusIncrementalQueryInstrumentation)&&E.profileFunction!==void 0?(this.profile(),this.shouldProfile=!0):this.shouldProfile=!1,this.getProfileData=E.profileFunction,this.getTargetSignature=E.getTargetSignature}profile(){typeof PerformanceObserver=="function"&&(this.perfObeserver=new PerformanceObserver(E=>{E.getEntries().forEach(h=>{const y=h,v=typeof y?.transferSize=="number";if(y?.initiatorType==="fetch"&&v){let D=y.name;if(D.includes("/api/ds/query")){let a=D.match(/requestId=([a-z\d]+)/i);if(a){let C=a[1];const P=Math.round(y.transferSize),b=this.pendingRequestIdsToTargSigs.get(C);if(b){const M=this.pendingRequestIdsToTargSigs.entries();for(let[,T]of M)if(T.identity===b.identity&&T.bytes!==null){const S=this.pendingAccumulatedEvents.get(T.identity),x=T.bytes-P;this.pendingAccumulatedEvents.set(T.identity,{datasource:T.datasource??"N/A",requestCount:(S?.requestCount??0)+1,savedBytesTotal:(S?.savedBytesTotal??0)+x,initialRequestSize:T.bytes,lastRequestSize:P,panelId:b.panelId?.toString()??"",dashId:b.dashboardUID??"",expr:b.expr??"",refreshIntervalMs:b.refreshIntervalMs??0,sent:!1,from:b.from??"",queryRangeSeconds:b.queryRangeSeconds??0}),this.pendingRequestIdsToTargSigs.delete(C);return}this.pendingRequestIdsToTargSigs.set(C,{...b,bytes:P})}}}}})}),this.perfObeserver.observe({type:"resource",buffered:!1}),setInterval(this.sendPendingTrackingEvents,this.sendEventsInterval),window.addEventListener("beforeunload",this.sendPendingTrackingEvents))}requestInfo(E){const h=E.range.from.valueOf(),y=E.range.to.valueOf(),v=E.rangeRaw?.to?.toString()==="now";let D=v,a;const C=(0,o.$t)().refreshMS,P=new Map;E.targets.forEach(b=>{let M=`${E.dashboardUID}|${E.panelId}|${b.refId}`,T=this.getTargetSignature(E,b);this.shouldProfile&&this.getProfileData&&this.pendingRequestIdsToTargSigs.set(E.requestId,{...this.getProfileData(E,b),identity:M+"|"+T,bytes:null,panelId:E.panelId,dashboardUID:E.dashboardUID??"",from:E.rangeRaw?.from.toString()??"",queryRangeSeconds:E.range.to.diff(E.range.from,"seconds")??"",refreshIntervalMs:C??0}),P.set(M,T)});for(const[b,M]of P){let T=this.cache.get(b);if(T?.sig!==M?D=!1:(a=T?.prevTo??1/0,D=y>a&&h<=a),!D)break}if(D&&a){let b=Math.max(a-this.overlapWindowMs,h);const M=(0,n.CQ)(y),T=(0,n.CQ)((0,i.mB)(b,E.intervalMs));E={...E,range:{...E.range,from:T,to:M}}}else P.forEach((b,M)=>{this.cache.delete(M)});return{requests:[E],targSigs:P,shouldCache:v}}procFrames(E,h,y){if(h?.shouldCache){const v=E.range.from.valueOf(),D=E.range.to.valueOf(),a=new Map;y.forEach(P=>{let b=`${E.dashboardUID}|${E.panelId}|${P.refId}`,M=a.get(b);M||(M=[],a.set(b,M)),M.push(P)});let C=[];a.forEach((P,b)=>{let M=(b?this.cache.get(b)?.frames:null)??[];P.forEach(S=>{if(S.length===0||S.fields.length===0)return;let x=c(S.fields[1]),O=M.find(B=>c(B.fields[1])===x);if(!O)M.push(S);else{let B=O.fields.map(W=>W.values),A=S.fields.map(W=>W.values),V=l(B,A);if(V){for(let W=0;W<V.length;W++)O.fields[W].values=V[W];O.length=O.fields[0].values.length}}});let T=[];M.forEach(S=>{let x=S.fields.map(B=>B.values),O=u(x,v,D);if(O[0].length>0){for(let B=0;B<O.length;B++)S.fields[B].values=O[B];T.push(S)}}),this.cache.set(b,{sig:h.targSigs.get(b),frames:T,prevTo:D}),C.push(...T)}),y=C.map(P=>({...P,fields:P.fields.map(b=>({...b,config:{...b.config},values:b.values.slice()}))}))}return y}}},48789:(j,I,e)=>{"use strict";e.d(I,{Ky:()=>H,n:()=>a,nM:()=>w,nf:()=>k,vs:()=>M});var t=e(45306),n=e(89949),i=e.n(n),s=e(62247),r=e(29241),g=e(69376),d=e(46580),l=e(61965),u=e(76772),o=e(14951),m=e(43987),c=e(75578),p=e(34667),f=e(10864),E=e(39317),h=e(72054);const y=/^[+-]?inf(?:inity)?$/i,v=(R,_)=>_.app===s.zj.Explore&&(R.meta?.custom?.resultType==="vector"||R.meta?.custom?.resultType==="scalar")?!0:_.targets.find(Y=>Y.refId===R.refId)?.format==="table",D=(R,_)=>_.targets.find(Y=>Y.refId===R.refId)?.format==="heatmap";function a(R,_,G){p.config.featureToggles.prometheusDataplane&&R.data.forEach(he=>{const ye=_.targets.find(ce=>ce.refId===he.refId);ye&&ye.legendFormat==="__auto"&&he.fields.forEach(ce=>{if(ce.labels?.__name__&&ce.labels?.__name__===ce.name){const We={...ce,name:r.M5};ce.config.displayNameFromDS=(0,c.$w)(We,he,R.data)}})});const[Y,X]=(0,n.partition)(R.data,he=>v(he,_)),Q=P(Y),[se,Z]=(0,n.partition)(X,he=>he.meta?.custom?.resultType==="exemplar"),{exemplarTraceIdDestinations:le}=G,oe=se.map(he=>{if(le?.length)for(const ye of le){const ce=he.fields.find(We=>We.name===ye.name);if(ce){const We=T(ye);ce.config.links=ce.config.links?.length?[...ce.config.links,...We]:We}}return{...he,meta:{...he.meta,dataTopic:g.w5.Annotations}}}),[q,ne]=(0,n.partition)(Z,he=>D(he,_));q.forEach(he=>{if(he.name==null){let ye=he.fields.find(ce=>ce.type===r.fS.number);if(ye){let ce=ye.labels?.le;ce&&(he.name=ce,ye.config.displayNameFromDS=ce)}}});const ge=(0,n.groupBy)(q,he=>he.refId);let ae=[];for(const he in ge){const ye=ge[he],ce=(0,n.groupBy)(ye,We=>{const ke=We.fields.find(et=>et.type===r.fS.number);if(ke?.labels&&C in ke.labels){const{le:et,...we}=ke?.labels;return Object.values(we).join()}return Object.values(ke?.labels??[]).join()});(0,n.forOwn)(ce,(We,ke)=>{const et=We.sort(k);ae.push(N(F(et)))})}const re=ne.map(he=>({...he,meta:{...he.meta,preferredVisualisationType:"graph"}})),De=(0,n.flatten)(ae);return{...R,data:[...re,...Q,...De,...oe]}}const C="le";function P(R){if(R.length===0||R.length===1&&R[0].length===0)return R;const _=(0,n.groupBy)(R,"refId"),G=Object.keys(_);return G.map(X=>{const Q=b(G.length,X),se=V({data:[],valueName:Q}),Z=A([]),le=[];_[X].forEach(q=>{const ge=q.fields[1]?.labels??{};Object.keys(ge).sort().forEach(ae=>{if(!le.some(re=>re.name===ae)){const re=ae===C;le.push({name:ae,config:{filterable:!0},type:re?r.fS.number:r.fS.string,values:[]})}})}),_[X].forEach(q=>{const ne=q.fields[0]?.values??[],ge=q.fields[1]?.values??[];ne.forEach(ae=>Z.values.push(ae)),ge.forEach(ae=>{se.values.push(H(ae));const re=q.fields[1].labels??{};le.forEach(De=>De.values.push(B(re,De.name)))})});const oe=[Z,...le,se];return{refId:X,fields:oe,meta:{..._[X][0].meta,preferredVisualisationType:"rawPrometheus"},length:Z.values.length}})}function b(R,_=""){return R>1?`Value #${_}`:"Value"}function M(R,_){const G={format:_.target.format,step:_.query.step,legendFormat:_.target.legendFormat,start:_.query.start,end:_.query.end,query:_.query.expr,responseListLength:_.responseListLength,scopedVars:_.scopedVars,refId:_.target.refId,valueWithRefId:_.target.valueWithRefId,meta:{preferredVisualisationType:_.query.instant?"rawPrometheus":"graph"}},Y=R.data.data;if((0,h.WS)(Y)){const Q=[];Y.forEach(le=>{const oe=le.exemplars.map(q=>({[r.Ls]:q.timestamp*1e3,[r.M5]:q.value,...q.labels,...le.seriesLabels}));Q.push(...oe)});const se=S(Q,G),Z=new d.i(se);if(Z.meta={dataTopic:g.w5.Annotations},_.exemplarTraceIdDestinations?.length)for(const le of _.exemplarTraceIdDestinations){const oe=Z.fields.find(q=>q.name===le.name);if(oe){const q=T(le);oe.config.links=oe.config.links?.length?[...oe.config.links,...q]:q}}return[Z]}if(!Y?.result)return[];if(Y.resultType==="scalar")return[{meta:G.meta,refId:G.refId,length:1,fields:[A([Y.result]),V({data:[Y.result]})]}];if(G.format==="table")return[O(Y.result,G)];const X=[];return Y.result.forEach(Q=>X.push(x(Q,G))),G.format==="heatmap"?N(F(X.sort(k))):X}function T(R){const _=[];if(R.datasourceUid){const Y=(0,f.F)().getInstanceSettings(R.datasourceUid);Y&&_.push({title:R.urlDisplayLabel||`Query with ${Y?.name}`,url:"",internal:{query:{query:"${__value.raw}",queryType:"traceql"},datasourceUid:R.datasourceUid,datasourceName:Y?.name??"Data source not found"}})}return R.url&&_.push({title:R.urlDisplayLabel||`Go to ${R.url}`,url:R.url,targetBlank:!0}),_}function S(R,_){const G=_.step||15,Y={},X=[];for(const le of R){const oe=String(Math.floor(le[r.Ls]/1e3/G)*G*1e3);Y[oe]||(Y[oe]=[]),Y[oe].push(le),X.push(le[r.M5])}const Q=(0,t.deviation)(X),se=Object.keys(Y).sort(),Z=[];for(const le of se){const oe=Y[le];if(oe.length===1)Z.push(oe[0]);else{const ne=oe.map(ge=>ge[r.M5]).sort(t.descending).reduce((ge,ae)=>{if(ge.length===0)ge.push(ae);else{const re=ge[ge.length-1];Q&&re-ae>=2*Q&&ge.push(ae)}return ge},[]);Z.push(...ne.map(ge=>oe.find(ae=>ae[r.M5]===ge)))}}return Z}function x(R,_){const{name:G,labels:Y}=W(R.metric,_),X=[];if((0,h.el)(R)){const Q=_.step?_.step*1e3:NaN;let se=_.start*1e3;const Z=[];for(const oe of R.values){let q=H(oe[1]);isNaN(q)&&(q=null);const ne=oe[0]*1e3;for(let ge=se;ge<ne;ge+=Q)Z.push([ge,null]);se=ne+Q,Z.push([ne,q])}const le=_.end*1e3;for(let oe=se;oe<=le;oe+=Q)Z.push([oe,null]);X.push(A(Z,!0)),X.push(V({data:Z,parseValue:!1,labels:Y,displayNameFromDS:G}))}else X.push(A([R.value])),X.push(V({data:[R.value],labels:Y,displayNameFromDS:G}));return{meta:_.meta,refId:_.refId,length:X[0].values.length,fields:X,name:G}}function O(R,_){if(!R||R.length===0)return{meta:_.meta,refId:_.refId,length:0,fields:[]};const G=_.responseListLength>1||_.valueWithRefId?`Value #${_.refId}`:"Value",Y=A([]),X=Object.keys(R.reduce((se,Z)=>({...se,...Z.metric}),{})).sort().map(se=>({name:se,config:{filterable:!0},type:se===C?r.fS.number:r.fS.string,values:[]})),Q=V({data:[],valueName:G});return R.forEach(se=>{(0,h.el)(se)?se.values.forEach(Z=>{Y.values.push(Z[0]*1e3),X.forEach(le=>le.values.push(B(se.metric,le.name))),Q.values.push(H(Z[1]))}):(Y.values.push(se.value[0]*1e3),X.forEach(Z=>Z.values.push(B(se.metric,Z.name))),Q.values.push(H(se.value[1])))}),{meta:_.meta,refId:_.refId,length:Y.values.length,fields:[Y,...X,Q]}}function B(R,_){return R.hasOwnProperty(_)?_===C?H(R[_]):R[_]:""}function A(R,_=!1){return{name:r.Ls,type:r.fS.time,config:{},values:R.map(G=>_?G[0]:G[0]*1e3)}}function V({data:R,valueName:_=r.M5,parseValue:G=!0,labels:Y,displayNameFromDS:X}){return{name:_,type:r.fS.number,display:(0,l.U)(),config:{displayNameFromDS:X},labels:Y,values:R.map(Q=>G?H(Q[1]):Q[1])}}function W(R,_){if(_?.legendFormat)return{name:(0,u.W)((0,E.J)().replace(_.legendFormat,_?.scopedVars),R),labels:R};const{__name__:G,...Y}=R,X=(0,o.aA)(Y);let Q=`${G??""}${X}`;return Q||(Q=_.query),{name:Q,labels:Y}}function w(R){const _=R.__name__||"";delete R.__name__;const G=Object.entries(R).map(Y=>`${Y[0]}="${Y[1]}"`).join(",");return`${_}{${G}}`}function N(R){if(R.length===0||R.length===1&&R[0].length===0)return[];const _=R[0].fields.find(Y=>Y.type===r.fS.time),G=R.map(Y=>{let X=Y.fields.find(Q=>Q.type===r.fS.number);return{...X,name:X.config.displayNameFromDS}});return[{...R[0],meta:{...R[0].meta,type:m.P.HeatmapRows},fields:[_,...G]}]}function F(R){for(let _=R.length-1;_>0;_--){const G=R[_].fields.find(X=>X.type===r.fS.number),Y=R[_-1].fields.find(X=>X.type===r.fS.number);if(!G||!Y)throw new Error("Prometheus heatmap transform error: data should be a time series");for(let X=0;X<G.values.length;X++){const Q=Y.values[X]||[0];G.values[X]-=Q}}return R}function k(R,_){let G,Y;try{G=H(R.fields[1].state?.displayName??R.name??R.fields[1].name),Y=H(_.fields[1].state?.displayName??_.name??_.fields[1].name)}catch(X){return console.error(X),0}return G>Y?1:G<Y?-1:0}function H(R){return y.test(R)?R[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:parseFloat(R)}},72054:(j,I,e)=>{"use strict";e.d(I,{WS:()=>i,el:()=>n,jo:()=>r,pD:()=>s,x3:()=>t});var t=(g=>(g.Low="Low",g.Medium="Medium",g.High="High",g.None="None",g))(t||{});function n(g){return"values"in g}function i(g){return g==null||!Array.isArray(g)?!1:g.length?"exemplars"in g[0]:!1}var s=(g=>(g.Auto="__auto",g.Verbose="__verbose",g.Custom="__custom",g))(s||{}),r=(g=>(g[g.LabelNames=0]="LabelNames",g[g.LabelValues=1]="LabelValues",g[g.MetricNames=2]="MetricNames",g[g.VarQueryResult=3]="VarQueryResult",g[g.SeriesQuery=4]="SeriesQuery",g))(r||{})},84160:(j,I,e)=>{"use strict";e.d(I,{$C:()=>E,BC:()=>D,M7:()=>d,NZ:()=>p,T1:()=>y,Yt:()=>m,rB:()=>f,t3:()=>v,vO:()=>h,yf:()=>c});var t=e(27938),n=e(12503),i=e(72164),s=e(29241),r=e(93666),g=e(43500);function d(T){const{nodes:S,edges:x}=l(T),[O,B]=(0,g.np)();for(const A of S)O.add(A);for(const A of x)B.add(A);return[O,B]}function l(T){const S=[],x=[],O=new t.U(T),B=u(O),A=(0,g.nO)(V=>{if(V>=T.length)return;const W=O.get(V);return{span:{...W},id:W.spanID,parentIds:W.parentSpanID?[W.parentSpanID]:[]}});for(let V=0;V<O.length;V++){const W=O.get(V),w=A[W.spanID].children.map(H=>{const R=A[H].span;return[R.startTime,R.startTime+R.duration]}),N=(0,g.et)(w),F=W.duration-N,k=(0,g.fy)(W.duration,B,F);S.push({[n.z.id]:W.spanID,[n.z.title]:W.serviceName??"",[n.z.subTitle]:W.operationName,[n.z.mainStat]:k.main,[n.z.secondaryStat]:k.secondary,[n.z.color]:F/B}),W.parentSpanID&&A[W.parentSpanID].span&&x.push({[n.z.id]:W.parentSpanID+"--"+W.spanID,[n.z.target]:W.spanID,[n.z.source]:W.parentSpanID})}return{nodes:S,edges:x}}function u(T){let S=0,x=1/0;for(let O=0;O<T.length;O++){const B=T.get(O);B.startTime<x&&(x=B.startTime),B.startTime+B.duration>S&&(S=B.startTime+B.duration)}return S-x}const o="traces_service_graph_request_server_seconds_sum",m="traces_service_graph_request_total",c="traces_service_graph_request_failed_total",p="traces_service_graph_request_server_seconds_bucket",f={expr:"topk(5, sum(rate(traces_spanmetrics_calls_total{}[$__range])) by (span_name))",params:[]},E={expr:"topk(5, sum(rate(traces_spanmetrics_calls_total{}[$__range])) by (span_name))",params:['status_code="STATUS_CODE_ERROR"']},h={expr:"histogram_quantile(.9, sum(rate(traces_spanmetrics_latency_bucket{}[$__range])) by (le))",params:[]},y='span_kind="SPAN_KIND_SERVER"',v=[o,m,c,p];function D(T,S){const x=C(T),O={},B={};return b(x[m],"total",m,O,B),b(x[o],"seconds",o,O,B),b(x[c],"failed",c,O,B),M(O,B,S)}function a(){function T(O,B){return new i.v({name:O,fields:B,meta:{preferredVisualisationType:"nodeGraph"}})}const S=T("Nodes",[{name:n.z.id,type:s.fS.string},{name:n.z.title,type:s.fS.string,config:{displayName:"Service name"}},{name:n.z.subTitle,type:s.fS.string,config:{displayName:"Service namespace"}},{name:n.z.mainStat,type:s.fS.number,config:{unit:"ms/r",displayName:"Average response time"}},{name:n.z.secondaryStat,type:s.fS.number,config:{unit:"r/sec",displayName:"Requests per second"}},{name:n.z.arc+"success",type:s.fS.number,config:{displayName:"Success",color:{fixedColor:"green",mode:r.S.Fixed}}},{name:n.z.arc+"failed",type:s.fS.number,config:{displayName:"Failed",color:{fixedColor:"red",mode:r.S.Fixed}}}]),x=T("Edges",[{name:n.z.id,type:s.fS.string},{name:n.z.source,type:s.fS.string},{name:"sourceName",type:s.fS.string},{name:"sourceNamespace",type:s.fS.string},{name:n.z.target,type:s.fS.string},{name:"targetName",type:s.fS.string},{name:"targetNamespace",type:s.fS.string},{name:n.z.mainStat,type:s.fS.number,config:{unit:"ms/r",displayName:"Average response time"}},{name:n.z.secondaryStat,type:s.fS.number,config:{unit:"r/sec",displayName:"Requests per second"}}]);return[S,x]}function C(T){return T[0].data.reduce((S,x)=>(S[x.refId]=new t.U(x),S),{})}var P=(T=>(T.sourceName="sourceName",T.sourceNamespace="sourceNamespace",T.targetName="targetName",T.targetNamespace="targetNamespace",T))(P||{});function b(T,S,x,O,B){if(!T)return;const A=`Value #${x}`;for(let V=0;V<T.length;V++){const W=T.get(V),w=W.server_service_namespace?`${W.server_service_namespace}/${W.server}`:W.server,N=W.client_service_namespace?`${W.client_service_namespace}/${W.client}`:W.client,F=`${N}_${w}`;B[F]?B[F][S]=(B[F][S]||0)+W[A]:B[F]={target:w,targetName:W.server,targetNamespace:W.server_service_namespace,source:N,sourceName:W.client,sourceNamespace:W.client_service_namespace,[S]:W[A]},O[w]?O[w][S]=(O[w][S]||0)+W[A]:O[w]={name:W.server,namespace:W.server_service_namespace,[S]:W[A]},O[N]||(O[N]={name:W.client,namespace:W.client_service_namespace,[S]:0})}}function M(T,S,x){const[O,B]=a();for(const A of Object.keys(T)){const V=T[A];O.add({[n.z.id]:A,[n.z.title]:V.name,[n.z.subTitle]:V.namespace,[n.z.mainStat]:V.total?V.seconds/V.total*1e3:Number.NaN,[n.z.secondaryStat]:V.total?Math.round(V.total*100)/100:Number.NaN,[n.z.arc+"success"]:V.total?(V.total-Math.min(V.failed||0,V.total))/V.total:1,[n.z.arc+"failed"]:V.total?Math.min(V.failed||0,V.total)/V.total:0})}for(const A of Object.keys(S)){const V=S[A];B.add({[n.z.id]:A,[n.z.source]:V.source,sourceName:V.sourceName,sourceNamespace:V.sourceNamespace,[n.z.target]:V.target,targetName:V.targetName,targetNamespace:V.targetNamespace,[n.z.mainStat]:V.total?V.seconds/V.total*1e3:Number.NaN,[n.z.secondaryStat]:V.total?Math.round(V.total*100)/100:Number.NaN})}return{nodes:O,edges:B}}},71523:(j,I,e)=>{"use strict";e.d(I,{IM:()=>f,Jk:()=>P,RY:()=>d,g9:()=>E,n4:()=>b,xA:()=>T});var t=e(65518),n=e(72164),i=e(29241),s=e(60956),r=e(84160);function g(B,A,V,W){const w=new n.v({fields:[{name:"Time",type:i.fS.time,config:{custom:{width:200}}},{name:"traceID",type:i.fS.string,config:{displayNameFromDS:"Trace ID",custom:{width:180},links:[{title:"Click to open trace ${__value.raw}",url:"",internal:{datasourceUid:A,datasourceName:V,query:{query:"${__value.raw}"}}}]}},{name:"Message",type:i.fS.string}],meta:{preferredVisualisationType:"table"}});if(!B||W.length===0)return w;const N=B.fields.find(F=>F.type===i.fS.time);for(let F of B.fields){let k=!1;if(F.type===i.fS.string){const H=F.values;for(let R=0;R<H.length;R++){const _=H[R];if(_)for(let G of W){const Y=_.match(G);if(Y){const X=Y[1],Q=N?N.values[R]:null;w.fields[0].values.push(Q),w.fields[1].values.push(X),w.fields[2].values.push(_),k=!0}}}}if(k)break}return w}function d(B,A,V,W){return B.data.forEach((w,N)=>{const F=g(w,A,V,W);B.data[N]=F}),B}function l(B){if(B.stringValue)return B.stringValue;if(B.boolValue!==void 0)return!!B.boolValue;if(B.intValue!==void 0)return Number.parseInt(B.intValue,10);if(B.doubleValue)return Number.parseFloat(B.doubleValue);if(B.arrayValue){const A=[];for(const V of B.arrayValue.values)A.push(l(V));return A}return""}function u(B){const A=[];let V="OTLPResourceNoServiceName";if(!B)return{serviceName:V,serviceTags:A};for(const W of B.attributes)W.key===t.R9.SERVICE_NAME&&(V=W.value.stringValue||V),A.push({key:W.key,value:l(W.value)});return{serviceName:V,serviceTags:A}}function o(B){const A=[];if(B.attributes)for(const V of B.attributes)A.push({key:V.key,value:l(V.value)});return A}function m(B){let A;if(B.kind){const V=B.kind.toString().toLowerCase().split("_");A=V.length?V[V.length-1]:B.kind.toString()}return A}function c(B){const A=[];if(B.links)for(const V of B.links){const{traceId:W,spanId:w}=V,N=[];if(V.attributes)for(const F of V.attributes)N.push({key:F.key,value:l(F.value)});A.push({traceID:W,spanID:w,tags:N})}return A}function p(B){const A=[];if(B.events)for(const V of B.events){const W=[];if(V.attributes)for(const w of V.attributes)W.push({key:w.key,value:l(w.value)});A.push({fields:W,timestamp:V.timeUnixNano/1e6})}return A}function f(B,A=!1){const V=new n.v({fields:[{name:"traceID",type:i.fS.string},{name:"spanID",type:i.fS.string},{name:"parentSpanID",type:i.fS.string},{name:"operationName",type:i.fS.string},{name:"serviceName",type:i.fS.string},{name:"kind",type:i.fS.string},{name:"statusCode",type:i.fS.number},{name:"statusMessage",type:i.fS.string},{name:"instrumentationLibraryName",type:i.fS.string},{name:"instrumentationLibraryVersion",type:i.fS.string},{name:"traceState",type:i.fS.string},{name:"serviceTags",type:i.fS.other},{name:"startTime",type:i.fS.number},{name:"duration",type:i.fS.number},{name:"logs",type:i.fS.other},{name:"references",type:i.fS.other},{name:"tags",type:i.fS.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"otlp"}}});try{for(const w of B){const{serviceName:N,serviceTags:F}=u(w.resource);for(const k of w.instrumentationLibrarySpans)for(const H of k.spans)V.add({traceID:H.traceId.length>16?H.traceId.slice(16):H.traceId,spanID:H.spanId,parentSpanID:H.parentSpanId||"",operationName:H.name||"",serviceName:N,kind:m(H),statusCode:H.status?.code,statusMessage:H.status?.message,instrumentationLibraryName:k.instrumentationLibrary?.name,instrumentationLibraryVersion:k.instrumentationLibrary?.version,traceState:H.traceState,serviceTags:F,startTime:H.startTimeUnixNano/1e6,duration:(H.endTimeUnixNano-H.startTimeUnixNano)/1e6,tags:o(H),logs:p(H),references:c(H)})}}catch(w){return console.error(w),{error:{message:"JSON is not valid OpenTelemetry format: "+w},data:[]}}let W=[V];return A&&W.push(...(0,r.M7)(V)),{data:W}}function E(B){let A={batches:[]},V={};for(let W=0;W<B.length;W++){const w=B.get(W);V[w.serviceName]||(V[w.serviceName]=A.batches.length,A.batches.push({resource:{attributes:[],droppedAttributesCount:0},instrumentationLibrarySpans:[{spans:[]}]}));let N=V[w.serviceName];A.batches[N].resource.attributes.length===0&&(A.batches[N].resource.attributes=y(w.serviceTags)),A.batches[N].instrumentationLibrarySpans[0].instrumentationLibrary||w.instrumentationLibraryName&&(A.batches[N].instrumentationLibrarySpans[0].instrumentationLibrary={name:w.instrumentationLibraryName,version:w.instrumentationLibraryVersion?w.instrumentationLibraryVersion:""}),A.batches[N].instrumentationLibrarySpans[0].spans.push({traceId:w.traceID.padStart(32,"0"),spanId:w.spanID,parentSpanId:w.parentSpanID||"",traceState:w.traceState||"",name:w.operationName,kind:h(w.kind),startTimeUnixNano:w.startTime*1e6,endTimeUnixNano:(w.startTime+w.duration)*1e6,attributes:w.tags?y(w.tags):[],droppedAttributesCount:0,droppedEventsCount:0,droppedLinksCount:0,status:D(w),events:a(w.logs),links:C(w.references)})}return A}function h(B){let A;if(B)switch(B){case"server":A="SPAN_KIND_SERVER";break;case"client":A="SPAN_KIND_CLIENT";break;case"producer":A="SPAN_KIND_PRODUCER";break;case"consumer":A="SPAN_KIND_CONSUMER";break;case"internal":A="SPAN_KIND_INTERNAL";break}return A}function y(B){return B.reduce((A,V)=>[...A,{key:V.key,value:v(V)}],[])}function v(B){if(typeof B.value=="string")return{stringValue:B.value};if(typeof B.value=="boolean")return{boolValue:B.value};if(typeof B.value=="number")return B.value%1===0?{intValue:B.value}:{doubleValue:B.value};if(typeof B.value=="object"&&Array.isArray(B.value)){const A=[];for(const V of B.value)A.push(v(V));return{arrayValue:{values:A}}}return{stringValue:B.value}}function D(B){let A;return B.statusCode!==void 0&&(A={code:B.statusCode,message:B.statusMessage?B.statusMessage:""}),A}function a(B){if(!B||!B.length)return;let A=[];for(const V of B){let W={timeUnixNano:V.timestamp*1e6,attributes:[],droppedAttributesCount:0,name:""};for(const w of V.fields)W.attributes.push({key:w.key,value:v(w)});A.push(W)}return A}function C(B){if(!B||!B.length)return;let A=[];for(const V of B){let W={traceId:V.traceID,spanId:V.spanID,attributes:[],droppedAttributesCount:0};if(V.tags?.length)for(const w of V.tags)W.attributes?.push({key:w.key,value:v(w)});A.push(W)}return A}function P(B,A=!1){const V=B.data[0];if(!V)return O;let W=[...B.data];return A&&W.push(...(0,r.M7)(V)),{...B,data:W}}function b(B,A){const V=new n.v({fields:[{name:"traceID",type:i.fS.string,config:{unit:"string",displayNameFromDS:"Trace ID",links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:A.uid,datasourceName:A.name,query:{query:"${__value.raw}",queryType:"traceql"}}}]}},{name:"traceName",type:i.fS.string,config:{displayNameFromDS:"Trace name"}},{name:"startTime",type:i.fS.string,config:{displayNameFromDS:"Start time"}},{name:"traceDuration",type:i.fS.number,config:{displayNameFromDS:"Duration",unit:"ms"}}],meta:{preferredVisualisationType:"table"}});if(!B?.length)return V;const W=B.sort((w,N)=>parseInt(N?.startTimeUnixNano,10)/1e6-parseInt(w?.startTimeUnixNano,10)/1e6).map(M);for(const w of W)V.add(w);return V}function M(B){let A="";B.rootServiceName&&(A+=B.rootServiceName+" "),B.rootTraceName&&(A+=B.rootTraceName);const V=parseInt(B.startTimeUnixNano,10)/1e6;let W=isNaN(V)?"":(0,s.dq)(V);return{traceID:B.traceID,startTime:W,traceDuration:B.durationMs?.toString(),traceName:A}}function T(B,A){const V=new n.v({name:"Traces",fields:[{name:"traceID",type:i.fS.string,config:{unit:"string",displayNameFromDS:"Trace ID",custom:{width:200},links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:A.uid,datasourceName:A.name,query:{query:"${__value.raw}",queryType:"traceql"}}}]}},{name:"startTime",type:i.fS.string,config:{displayNameFromDS:"Start time",custom:{width:200}}},{name:"traceName",type:i.fS.string,config:{displayNameFromDS:"Name"}},{name:"traceDuration",type:i.fS.number,config:{displayNameFromDS:"Duration",unit:"ms",custom:{width:120}}}],meta:{preferredVisualisationType:"table"}});if(!B?.length)return[V];const W=[],w=B.sort((N,F)=>parseInt(F?.startTimeUnixNano,10)/1e6-parseInt(N?.startTimeUnixNano,10)/1e6).reduce((N,F,k)=>{const H=M(F);return N.push(H),W.push(S(F,A,k)),N},[]);for(const N of w)V.add(N);return[V,...W]}const S=(B,A,V)=>{const W={};let w=!1;B.spanSet?.spans.forEach(F=>{F.name&&(w=!0),F.attributes?.forEach(k=>{W[k.key]={name:k.key,type:i.fS.string,config:{displayNameFromDS:k.key}}})});const N=new n.v({fields:[{name:"traceIdHidden",config:{custom:{hidden:!0}}},{name:"spanID",type:i.fS.string,config:{unit:"string",displayNameFromDS:"Span ID",custom:{width:200},links:[{title:"Span: ${__value.raw}",url:"",internal:{datasourceUid:A.uid,datasourceName:A.name,query:{query:"${__data.fields.traceIdHidden}",queryType:"traceql"},panelsState:{trace:{spanId:"${__value.raw}"}}}}]}},{name:"spanStartTime",type:i.fS.string,config:{displayNameFromDS:"Start time",custom:{width:200}}},{name:"name",type:i.fS.string,config:{displayNameFromDS:"Name",custom:{hidden:!w}}},...Object.values(W),{name:"duration",type:i.fS.number,config:{displayNameFromDS:"Duration",unit:"ns",custom:{width:120}}}],meta:{preferredVisualisationType:"table",custom:{parentRowIndex:V}}});return B.spanSet?.spans.forEach(F=>{N.add(x(F,B.traceID))}),N};function x(B,A){const V=parseInt(B.startTimeUnixNano,10)/1e6;let W=(0,s.dq)(V);const w={traceIdHidden:A,spanID:B.spanID,spanStartTime:W,duration:parseInt(B.durationNanos,10),name:B.name};return B.attributes?.forEach(N=>{(N.value.boolValue||N.value.Value?.bool_value)&&(w[N.key]=N.value.boolValue||N.value.Value?.bool_value),(N.value.doubleValue||N.value.Value?.double_value)&&(w[N.key]=N.value.doubleValue||N.value.Value?.double_value),(N.value.intValue||N.value.Value?.int_value)&&(w[N.key]=N.value.intValue||N.value.Value?.int_value),(N.value.stringValue||N.value.Value?.string_value)&&(w[N.key]=N.value.stringValue||N.value.Value?.string_value)}),w}const O={data:[new n.v({fields:[{name:"trace",type:i.fS.trace,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"otlp"}}})]}},66288:(j,I,e)=>{"use strict";e.d(I,{H:()=>o,m:()=>r});var t=e(89949),n=e.n(t),i=e(72164),s=e(29241);function r(c){const p=c.map(g),f=new i.v({fields:[{name:"traceID",type:s.fS.string},{name:"spanID",type:s.fS.string},{name:"parentSpanID",type:s.fS.string},{name:"operationName",type:s.fS.string},{name:"serviceName",type:s.fS.string},{name:"serviceTags",type:s.fS.other},{name:"startTime",type:s.fS.number},{name:"duration",type:s.fS.number},{name:"logs",type:s.fS.other},{name:"tags",type:s.fS.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"zipkin"}}});for(const E of p)f.add(E);return f}function g(c){const p={traceID:c.traceId,spanID:c.id,parentSpanID:c.parentId,operationName:c.name,serviceName:c.localEndpoint?.serviceName||c.remoteEndpoint?.serviceName||"unknown",serviceTags:l(c),startTime:c.timestamp/1e3,duration:c.duration/1e3,logs:c.annotations?.map(d)??[],tags:Object.keys(c.tags||{}).reduce((f,E)=>E==="error"?(f.push({key:"error",value:!0}),f.push({key:"errorValue",value:c.tags.error}),f):(f.push({key:E,value:c.tags[E]}),f),[])};return c.kind&&(p.tags=[{key:"kind",value:c.kind},...p.tags??[]]),c.shared&&(p.tags=[{key:"shared",value:c.shared},...p.tags??[]]),p}function d(c){return{timestamp:c.timestamp,fields:[{key:"annotation",value:c.value}]}}function l(c){const p=c.localEndpoint||c.remoteEndpoint;return p?[u("ipv4",p.ipv4),u("ipv6",p.ipv6),u("port",p.port),u("endpointType",c.localEndpoint?"local":"remote")].filter(t.identity):[]}function u(c,p){if(p)return{key:c,value:p}}const o=c=>{let p=[];for(let f=0;f<c.length;f++){const E=c.get(f);p.push({traceId:E.traceID,parentId:E.parentSpanID,name:E.operationName,id:E.spanID,timestamp:E.startTime*1e3,duration:E.duration*1e3,...m(E),annotations:E.logs.length?E.logs.map(h=>({timestamp:h.timestamp,value:h.fields[0].value})):void 0,tags:E.tags.length?E.tags.filter(h=>h.key!=="kind"&&h.key!=="endpointType"&&h.key!=="shared").reduce((h,y)=>y.key==="error"?{...h,[y.key]:E.tags.find(v=>v.key==="errorValue").value||""}:{...h,[y.key]:y.value},{}):void 0,kind:E.tags.find(h=>h.key==="kind")?.value,shared:E.tags.find(h=>h.key==="shared")?.value})}return p},m=c=>{const p=c.serviceTags.find(f=>f.key==="endpointType")?.value==="local"?"localEndpoint":"remoteEndpoint";return c.serviceName!=="unknown"?{[p]:{serviceName:c.serviceName,ipv4:c.serviceTags.find(f=>f.key==="ipv4")?.value,ipv6:c.serviceTags.find(f=>f.key==="ipv6")?.value,port:c.serviceTags.find(f=>f.key==="port")?.value}}:void 0}},57183:(j,I,e)=>{"use strict";e.d(I,{As:()=>t,LM:()=>i,kx:()=>n,wO:()=>s});var t=(r=>(r[r.AlphaAsc=1]="AlphaAsc",r[r.AlphaDesc=2]="AlphaDesc",r[r.Importance=3]="Importance",r[r.TimeAsc=4]="TimeAsc",r[r.TimeDesc=5]="TimeDesc",r))(t||{}),n=(r=>(r.Current="current",r.RecentChanges="changes",r))(n||{}),i=(r=>(r.Default="default",r.Custom="custom",r))(i||{}),s=(r=>(r.List="list",r.Stat="stat",r))(s||{})},59479:(j,I,e)=>{"use strict";e.d(I,{Gj:()=>n,Qm:()=>g});var t=e(27107);const n=1,i=2,s=3,r=(d,l,u,o)=>(0,t.O)(l+d*(u+o),6);function g(d,l,u,o,m){let c=1-l,p=u===n?c/(d-1):u===i?c/d:u===s?c/(d+1):0;(isNaN(p)||p===1/0)&&(p=0);let f=u===n?0:u===i?p/2:u===s?p:0,E=l/d,h=(0,t.O)(E,6);if(o==null)for(let y=0;y<d;y++)m(y,r(y,f,E,p),h);else m(o,r(o,f,E,p),h)}},94876:(j,I,e)=>{"use strict";e.d(I,{Pn:()=>i,kK:()=>r,lW:()=>g,zZ:()=>s});const t=10,n=4;function i(d,l,u,o,m,c){return d>=u&&d<=m&&l>=o&&l<=c}function s(d,l,u){let o;if(d.o.length&&(o=d.o.find(m=>m.sidx===l&&m.didx===u)),o==null&&d.q)for(let m=0;m<d.q.length&&(o=s(d.q[m],l,u),!o);m++);return o}function r(d,l){return d.x<=l.x+l.w&&d.x+d.w>=l.x&&d.y+d.h>=l.y&&d.y<=l.y+l.h}class g{constructor(l,u,o,m,c=0){this.x=l,this.y=u,this.w=o,this.h=m,this.l=c,this.o=[],this.q=null}split(){let l=this,u=l.x,o=l.y,m=l.w/2,c=l.h/2,p=l.l+1;l.q=[new g(u+m,o,m,c,p),new g(u,o,m,c,p),new g(u,o+c,m,c,p),new g(u+m,o+c,m,c,p)]}quads(l,u,o,m,c){let p=this,f=p.q,E=p.x+p.w/2,h=p.y+p.h/2,y=u<h,v=l<E,D=l+o>E,a=u+m>h;y&&D&&c(f[0]),v&&y&&c(f[1]),v&&a&&c(f[2]),D&&a&&c(f[3])}add(l){let u=this;if(u.q!=null)u.quads(l.x,l.y,l.w,l.h,o=>{o.add(l)});else{let o=u.o;if(o.push(l),o.length>t&&u.l<n){u.split();for(let m=0;m<o.length;m++){let c=o[m];u.quads(c.x,c.y,c.w,c.h,p=>{p.add(c)})}u.o.length=0}}}get(l,u,o,m,c){let p=this,f=p.o;for(let E=0;E<f.length;E++)c(f[E]);p.q!=null&&p.quads(l,u,o,m,E=>{E.get(l,u,o,m,c)})}clear(){this.o.length=0,this.q=null}}},72082:(j,I,e)=>{"use strict";e.d(I,{M:()=>o,l:()=>m});var t=e(89949),n=e.n(t),i=e(27702),s=e(90482),r=e(91466),g=e(24919),d=e(50741),l=e(44201),u=e(12308);class o extends i.PureComponent{constructor(){super(...arguments),this.renderComponent=(p,f)=>{const{options:E,fieldConfig:h}=this.props,{value:y,alignmentFactors:v,orientation:D,width:a,height:C,count:P}=p,{field:b,display:M,view:T,colIndex:S}=y,{openMenu:x,targetClassName:O}=f;let B;return T&&(0,t.isNumber)(S)&&(B=T.getFieldDisplayProcessor(S)),i.createElement(g.xf,{value:m(P,h.defaults,M),width:a,height:C,orientation:D,field:b,text:E.text,display:B,theme:u.config.theme2,itemSpacing:this.getItemSpacing(),displayMode:E.displayMode,onClick:x,className:O,alignmentFactors:P>1?v:void 0,showUnfilled:E.showUnfilled,valueDisplayMode:E.valueMode})},this.renderValue=p=>{const{value:f,orientation:E}=p,{hasLinks:h,getLinks:y}=f;return h&&y?i.createElement("div",{style:{width:"100%",display:E===s.wm.Vertical?"flex":"initial"}},i.createElement(d.V,{style:{height:"100%"},links:y},v=>this.renderComponent(p,v))):this.renderComponent(p,{})},this.getValues=()=>{const{data:p,options:f,replaceVariables:E,fieldConfig:h,timeZone:y}=this.props;return(0,r.nG)({fieldConfig:h,reduceOptions:f.reduceOptions,replaceVariables:E,theme:u.config.theme2,data:p.series,timeZone:y})}}getItemSpacing(){return this.props.options.displayMode==="lcd"?2:10}render(){const{height:p,width:f,options:E,data:h,renderCounter:y}=this.props;return i.createElement(l.Q,{source:h,getAlignmentFactors:r.sg,getValues:this.getValues,renderValue:this.renderValue,renderCounter:y,width:f,height:p,minVizWidth:E.minVizWidth,minVizHeight:E.minVizHeight,itemSpacing:this.getItemSpacing(),orientation:E.orientation})}}function m(c,p,f){return c===1&&!p.displayName?{...f,title:void 0}:f}},15301:(j,I,e)=>{"use strict";e.d(I,{S:()=>u});var t=e(45540),n=e(61965),i=e(16998),s=e(89949);function r(o,m){const c=g(o);return d(c,m,"parents")}function g(o){return o.map(m=>{if(!m.parents?.length)return m;const c={...m,children:[]},p=[{child:c,parent:m.parents[0]}];for(;p.length;){const f=p.shift(),E={...f.parent,children:f.child?[f.child]:[],parents:[]};f.child&&(E.value=f.child.value,f.child.parents=[E]),f.parent.parents?.length&&p.push({child:E,parent:f.parent.parents[0]})}return c})}function d(o,m,c="children"){const p=c==="parents"?"children":"parents",f=[],E=[{previous:void 0,items:o,level:0}];for(;E.length;){const h=E.shift(),y=h.items.flatMap(C=>C.itemIndexes),v={value:h.items.reduce((C,P)=>C+P.value,0),itemIndexes:y,children:[],parents:[],start:0};if(f[h.level]=f[h.level]||[],f[h.level].push(v),h.previous){v[p]=[h.previous];const C=h.previous[c]?.reduce((P,b)=>P+b.value,0)||0;v.start=h.previous.start+C,h.previous[c].push(v)}const D=h.items.flatMap(C=>C[c]||[]),a=(0,s.groupBy)(D,C=>m.getLabel(C.itemIndexes[0]));for(const C of Object.values(a))E.push({previous:v,items:C,level:h.level+1})}return c==="parents"&&f.reverse(),f}function l(o){const m=[];let c=0,p;const f={};for(let E=0;E<o.data.length;E++){const h=o.getLevel(E),y=E>0?o.getLevel(E-1):void 0;if(m[h]=m[h]||[],y&&y>=h){const D=m[h][m[h].length-1];c=D.start+o.getValue(D.itemIndexes[0]),p=D.parents[0]}const v={itemIndexes:[E],value:o.getValue(E),start:c,parents:p&&[p],children:[]};f[o.getLabel(E)]?f[o.getLabel(E)].push(v):f[o.getLabel(E)]=[v],p&&p.children.push(v),p=v,m[h].push(v)}return[m,f]}class u{constructor(m,c=(0,t.j)()){if(this.data=m,this.labelField=m.fields.find(f=>f.name==="label"),this.levelField=m.fields.find(f=>f.name==="level"),this.valueField=m.fields.find(f=>f.name==="value"),this.selfField=m.fields.find(f=>f.name==="self"),!(this.labelField&&this.levelField&&this.valueField&&this.selfField))throw new Error("Malformed dataFrame: value, level and label and self fields are required.");const p=this.labelField?.config?.type?.enum;p?(this.labelDisplayProcessor=(0,n.U)({field:this.labelField,theme:c}),this.uniqueLabels=p.text||[]):(this.labelDisplayProcessor=f=>({text:f+"",numeric:0}),this.uniqueLabels=[...new Set(this.labelField.values)]),this.valueDisplayProcessor=(0,n.U)({field:this.valueField,theme:c})}getLabel(m){return this.labelDisplayProcessor(this.labelField.values[m]).text}getLevel(m){return this.levelField.values[m]}getValue(m){return(typeof m=="number"?[m]:m).reduce((p,f)=>p+this.valueField.values[f],0)}getValueDisplay(m){return this.valueDisplayProcessor(this.getValue(m))}getSelf(m){return(typeof m=="number"?[m]:m).reduce((p,f)=>p+this.selfField.values[f],0)}getSelfDisplay(m){return this.valueDisplayProcessor(this.getSelf(m))}getUniqueLabels(){return this.uniqueLabels}getUnitTitle(){switch(this.valueField.config.unit){case i._r.Bytes:return"RAM";case i._r.Nanoseconds:return"Time"}return"Count"}getLevels(){return this.initLevels(),this.levels}getSandwichLevels(m){const c=this.getNodesWithLabel(m);if(!c?.length)return[];const p=r(c,this),f=d(c,this);return[p,f]}getNodesWithLabel(m){return this.initLevels(),this.uniqueLabelsMap[m]}initLevels(){if(!this.levels){const[m,c]=l(this);this.levels=m,this.uniqueLabelsMap=c}}}},78088:(j,I,e)=>{"use strict";e.d(I,{Z:()=>Be});var t=e(42844),n=e(27702),i=e(96284),s=e(86312),r=e(34667),g=e(66310);const d=22*window.devicePixelRatio,l=10*window.devicePixelRatio,u=.5*window.devicePixelRatio,o=20*window.devicePixelRatio,m=.5*window.devicePixelRatio,c=4*window.devicePixelRatio,p=800,f=120;var E=e(73453),h=e(79655),y=e(14986);const D=({itemData:Ue,onMenuItemClick:ue,onItemFocus:pe,onSandwich:$e})=>{function Se(){return n.createElement(n.Fragment,null,n.createElement(h.s,{label:"Focus block",icon:"eye",onClick:()=>{pe(),ue()}}),n.createElement(h.s,{label:"Copy function name",icon:"copy",onClick:()=>{navigator.clipboard.writeText(Ue.label).then(()=>{ue()})}}),n.createElement(h.s,{label:"Sandwich view",icon:"gf-show-context",onClick:()=>{$e(),ue()}}))}return n.createElement("div",{"data-testid":"contextMenu"},n.createElement(y.x,{renderMenuItems:Se,x:Ue.posX+10,y:Ue.posY,focusOnOpen:!1}))};var a=e(21609),C=e(67437);const P=n.memo(({data:Ue,focusedItem:ue,totalTicks:pe,sandwichedLabel:$e,onFocusPillClick:Se,onSandwichPillClick:Ve})=>{const He=(0,g.wW)(b),Ze=[],Qe=(0,a.Cf)("short")(pe),rt=Ue.valueDisplayProcessor(pe);let pt=rt.text+rt.suffix;const It=Ue.getUnitTitle();if(It==="Count"&&(rt.suffix||(pt=rt.text)),Ze.push(n.createElement("div",{className:He.metadataPill,key:"default"},pt," | ",Qe.text,Qe.suffix," samples (",It,")")),$e&&Ze.push(n.createElement("span",{key:"sandwich"},n.createElement(E.J,{size:"sm",name:"angle-right"}),n.createElement("div",{className:He.metadataPill},n.createElement(E.J,{size:"sm",name:"gf-show-context"})," ",$e.substring($e.lastIndexOf("/")+1),n.createElement(C.h,{className:He.pillCloseButton,name:"times",size:"sm",onClick:Ve,tooltip:"Remove sandwich view","aria-label":"Remove sandwich view"})))),ue){const _t=Math.round(1e4*(ue.item.value/pe))/100;Ze.push(n.createElement("span",{key:"focus"},n.createElement(E.J,{size:"sm",name:"angle-right"}),n.createElement("div",{className:He.metadataPill},n.createElement(E.J,{size:"sm",name:"eye"})," ",_t,"% of total",n.createElement(C.h,{className:He.pillCloseButton,name:"times",size:"sm",onClick:Se,tooltip:"Remove focus","aria-label":"Remove focus"}))))}return n.createElement(n.Fragment,null,n.createElement("div",{className:He.metadata},Ze))});P.displayName="FlameGraphMetadata";const b=Ue=>({metadataPill:(0,t.css)` label: metadataPill; display: inline-block; background: ${Ue.colors.background.secondary}; border-radius: ${Ue.shape.borderRadius(8)}; padding: ${Ue.spacing(.5,1)}; font-size: ${Ue.typography.bodySmall.fontSize}; font-weight: ${Ue.typography.fontWeightMedium}; line-height: ${Ue.typography.bodySmall.lineHeight}; color: ${Ue.colors.text.secondary}; `,pillCloseButton:(0,t.css)` label: pillCloseButton; vertical-align: text-bottom; margin: ${Ue.spacing(0,.5)}; `,metadata:(0,t.css)` margin: 8px 0; text-align: center; `}),M=P;var T=e(52995),S=e(97695);const x=({data:Ue,item:ue,totalTicks:pe,position:$e})=>{const Se=(0,g.wW)(B);if(!(ue&&$e))return null;const Ve=O(Ue,ue,pe),He=n.createElement("div",{className:Se.tooltipContent},n.createElement("p",null,Ue.getLabel(ue.itemIndexes[0])),n.createElement("p",{className:Se.lastParagraph},Ve.unitTitle,n.createElement("br",null),"Total: ",n.createElement("b",null,Ve.unitValue)," (",Ve.percentValue,"%)",n.createElement("br",null),"Self: ",n.createElement("b",null,Ve.unitSelf)," (",Ve.percentSelf,"%)",n.createElement("br",null),"Samples: ",n.createElement("b",null,Ve.samples)));return n.createElement(T.h_,null,n.createElement(S.S,{position:$e,offset:{x:15,y:0}},He))},O=(Ue,ue,pe)=>{const $e=Ue.valueDisplayProcessor(ue.value),Se=Ue.getSelfDisplay(ue.itemIndexes),Ve=Math.round(1e4*($e.numeric/pe))/100,He=Math.round(1e4*(Se.numeric/pe))/100;let Ze=$e.text+$e.suffix,Qe=Se.text+Se.suffix;const rt=Ue.getUnitTitle();return rt==="Count"&&($e.suffix||(Ze=$e.text),Se.suffix||(Qe=Se.text)),{name:Ue.getLabel(ue.itemIndexes[0]),percentValue:Ve,percentSelf:He,unitTitle:rt,unitValue:Ze,unitSelf:Qe,samples:$e.numeric.toLocaleString()}},B=Ue=>({tooltipContent:(0,t.css)` title: tooltipContent; font-size: ${Ue.typography.bodySmall.fontSize}; `,lastParagraph:(0,t.css)` title: lastParagraph; margin-bottom: 0; `,name:(0,t.css)` title: name; margin-bottom: 10px; `}),A=x;var V=e(12354),W=e(5354),w=e(16998),N=e(71685);function F(Ue,ue=0){let pe,$e,Se,Ve,He,Ze,Qe,rt;for(pe=Ue.length&3,$e=Ue.length-pe,Se=ue,He=3432918353,Ze=461845907,rt=0;rt<$e;)Qe=Ue.charCodeAt(rt)&255|(Ue.charCodeAt(++rt)&255)<<8|(Ue.charCodeAt(++rt)&255)<<16|(Ue.charCodeAt(++rt)&255)<<24,++rt,Qe=(Qe&65535)*He+(((Qe>>>16)*He&65535)<<16)&4294967295,Qe=Qe<<15|Qe>>>17,Qe=(Qe&65535)*Ze+(((Qe>>>16)*Ze&65535)<<16)&4294967295,Se^=Qe,Se=Se<<13|Se>>>19,Ve=(Se&65535)*5+(((Se>>>16)*5&65535)<<16)&4294967295,Se=(Ve&65535)+27492+(((Ve>>>16)+58964&65535)<<16);switch(Qe=0,pe){case 3:Qe^=(Ue.charCodeAt(rt+2)&255)<<16;case 2:Qe^=(Ue.charCodeAt(rt+1)&255)<<8;case 1:Qe^=Ue.charCodeAt(rt)&255;default:Qe=(Qe&65535)*He+(((Qe>>>16)*He&65535)<<16)&4294967295,Qe=Qe<<15|Qe>>>17,Qe=(Qe&65535)*Ze+(((Qe>>>16)*Ze&65535)<<16)&4294967295,Se^=Qe}return Se^=Ue.length,Se^=Se>>>16,Se=(Se&65535)*2246822507+(((Se>>>16)*2246822507&65535)<<16)&4294967295,Se^=Se>>>13,Se=(Se&65535)*3266489909+(((Se>>>16)*3266489909&65535)<<16)&4294967295,Se^=Se>>>16,Se>>>0}const k=[(0,N.Z)({h:24,s:69,l:60}),(0,N.Z)({h:34,s:65,l:65}),(0,N.Z)({h:194,s:52,l:61}),(0,N.Z)({h:163,s:45,l:55}),(0,N.Z)({h:211,s:48,l:60}),(0,N.Z)({h:246,s:40,l:65}),(0,N.Z)({h:305,s:63,l:79}),(0,N.Z)({h:47,s:100,l:73}),(0,N.Z)({r:183,g:219,b:171}),(0,N.Z)({r:244,g:213,b:152}),(0,N.Z)({r:78,g:146,b:249}),(0,N.Z)({r:249,g:186,b:143}),(0,N.Z)({r:242,g:145,b:145}),(0,N.Z)({r:130,g:181,b:216}),(0,N.Z)({r:229,g:168,b:226}),(0,N.Z)({r:174,g:162,b:224}),(0,N.Z)({r:154,g:196,b:138}),(0,N.Z)({r:242,g:201,b:109}),(0,N.Z)({r:101,g:197,b:219}),(0,N.Z)({r:249,g:147,b:78}),(0,N.Z)({r:234,g:100,b:96}),(0,N.Z)({r:81,g:149,b:206}),(0,N.Z)({r:214,g:131,b:206}),(0,N.Z)({r:128,g:110,b:183})],H=Y(1,100,0,1),R=Y(100,100,0,1),_=`linear-gradient(90deg, ${H} 0%, ${R} 100%)`,G=`linear-gradient(90deg, ${k[0]} 0%, ${k[2]} 30%, ${k[6]} 50%, ${k[7]} 70%, ${k[8]} 100%)`;function Y(Ue,ue,pe,$e){const Se=Math.min(1,Ue/ue/($e-pe)),Ve=50-50*Se,He=65+7*Se;return(0,N.Z)({h:Ve,s:100,l:He})}function X(Ue,ue){const pe=se(Ue),Se=F(pe||"",0)%k.length;let Ve=k[Se];return ue.isLight&&(Ve=Ve.clone().brighten(15)),Ve}const Q=[["phpspy",/^(?<packageName>(.*\/)*)(?<filename>.*\.php+)(?<line_info>.*)$/],["pyspy",/^(?<packageName>(.*\/)*)(?<filename>.*\.py+)(?<line_info>.*)$/],["rbspy",/^(?<packageName>(.*\/)*)(?<filename>.*\.rb+)(?<line_info>.*)$/],["nodespy",/^(\.\/node_modules\/)?(?<packageName>[^/]*)(?<filename>.*\.?(jsx?|tsx?)?):(?<functionName>.*):(?<line_info>.*)$/],["gospy",/^(?<packageName>.*?\/.*?\.|.*?\.|.+)(?<functionName>.*)$/],["javaspy",/^(?<packageName>.+\/)(?<filename>.+\.)(?<functionName>.+)$/],["dotnetspy",/^(?<packageName>.+)\.(.+)\.(.+)\(.*\)$/],["tracing",/^(?<packageName>.+?):.*$/],["pyroscope-rs",/^(?<packageName>[^::]+)/],["ebpfspy",/^(?<packageName>.+)$/],["unknown",/^(?<packageName>.+)$/]];function se(Ue){for(const[ue,pe]of Q){const $e=Ue.match(pe);if($e)return $e.groups?.packageName||""}}const Z=new V.Z;function le(Ue,ue,pe,$e,Se,Ve,He,Ze,Qe,rt,pt){const It=(0,n.useMemo)(()=>{if(He){const qt=new Set;let cn=Z.filter(ue.getUniqueLabels(),He);if(cn)for(let on of cn)qt.add(ue.getUniqueLabels()[on]);return qt}},[He,ue]),_t=oe(Ue,$e,pe.length),tn=(0,g.l4)();(0,n.useEffect)(()=>{if(!_t)return;_t.clearRect(0,0,_t.canvas.width,_t.canvas.height);const qt=$e*window.devicePixelRatio/Qe/(Ve-Se);for(let cn=0;cn<pe.length;cn++){const on=pe[cn],ln=q(ue,on,cn,Qe,Se,qt);for(const Un of ln){const yt=pt?pt.level:0;ne(_t,Un,Qe,Se,Ve,cn,yt,It,Ze,rt,tn)}}},[_t,ue,pe,$e,Se,Ve,He,pt,It,Ze,Qe,rt,tn])}function oe(Ue,ue,pe){const[$e,Se]=(0,n.useState)();return(0,n.useEffect)(()=>{if(!(pe&&Ue.current))return;const Ve=Ue.current.getContext("2d"),He=d*pe;Ue.current.width=Math.round(ue*window.devicePixelRatio),Ue.current.height=Math.round(He),Ue.current.style.width=`${ue}px`,Ue.current.style.height=`${He/window.devicePixelRatio}px`,Ve.textBaseline="middle",Ve.font=12*window.devicePixelRatio+"px monospace",Ve.strokeStyle="white",Se(Ve)},[Ue,Se,ue,pe]),$e}function q(Ue,ue,pe,$e,Se,Ve){const He=[];for(let Ze=0;Ze<ue.length;Ze+=1){const Qe=ue[Ze],rt=ae(Qe.start,$e,Se,Ve);let pt=Qe.value;const It=pt*Ve<=l;if(It)for(;Ze<ue.length-1&&Qe.start+pt===ue[Ze+1].start&&ue[Ze+1].value*Ve<=l;)Ze+=1,pt+=ue[Ze].value;const _t=Ue.valueDisplayProcessor(Qe.value);let tn=_t.suffix?_t.text+_t.suffix:_t.text;const qt=pt*Ve-(It?0:m*2);He.push({width:qt,height:d,x:rt,y:pe*d,collapsed:It,ticks:pt,label:Ue.getLabel(Qe.itemIndexes[0]),unitLabel:tn,itemIndex:Qe.itemIndexes[0]})}return He}function ne(Ue,ue,pe,$e,Se,Ve,He,Ze,Qe,rt,pt){if(ue.width<u)return;Ue.beginPath(),Ue.rect(ue.x+(ue.collapsed?0:m),ue.y,ue.width,ue.height);const It=rt===w.eL.ValueBased?Y(ue.ticks,pe,$e,Se):X(ue.label,pt);if(Ze?Ue.fillStyle=Ze.has(ue.label)?It.toHslString():W.O9[55]:ue.collapsed?Ue.fillStyle=W.O9[55]:Ue.fillStyle=Ve>He-1?It.toHslString():It.lighten(15).toHslString(),ue.collapsed){Ue.fill();return}Ue.stroke(),Ue.fill(),ue.width>=o&&ge(Ue,ue.label,ue,Qe)}function ge(Ue,ue,pe,$e){Ue.save(),Ue.clip(),Ue.fillStyle="#222";const Se=Ue.measureText(ue),Ve=pe.width-c;let He=`${ue} (${pe.unitLabel})`,Ze=Math.max(pe.x,0)+c;Se.width>Ve&&(Ue.textAlign=$e,$e==="right"&&(He=ue,Ze=pe.x+pe.width-c)),Ue.fillText(He,Ze,pe.y+d/2),Ue.restore()}function ae(Ue,ue,pe,$e){return(Ue-ue*pe)*$e}const re=({data:Ue,rangeMin:ue,rangeMax:pe,search:$e,setRangeMin:Se,setRangeMax:Ve,onItemFocused:He,focusedItemData:Ze,textAlign:Qe,onSandwich:rt,sandwichItem:pt,onFocusPillClick:It,onSandwichPillClick:_t,colorScheme:tn})=>{const qt=(0,g.wW)(De),[cn,on,ln]=(0,n.useMemo)(()=>{let Vt=Ue.getLevels(),Ht=Vt.length?Vt[0][0].value:0,Xt=0;if(pt){const[mn,pn]=Ue.getSandwichLevels(pt);Vt=[...mn,[],...pn],Ht=pn.length?pn[0][0].value:0,Xt=mn.length}return[Vt,Ht,Xt]},[Ue,pt]),[Un,{width:yt}]=(0,i.Z)(),ft=(0,n.useRef)(null),[Tt,Bt]=(0,n.useState)(),[Nt,Ft]=(0,n.useState)();le(ft,Ue,cn,yt,ue,pe,$e,Qe,on,tn,Ze);const Gt=(0,n.useCallback)(Vt=>{Bt(void 0);const Ht=ft.current.clientWidth/on/(pe-ue),{levelIndex:Xt,barIndex:mn}=he({x:Vt.nativeEvent.offsetX,y:Vt.nativeEvent.offsetY},cn,Ht,on,ue);if(mn!==-1&&!isNaN(Xt)&&!isNaN(mn)){const pn=cn[Xt][mn];Ft({posY:Vt.clientY,posX:Vt.clientX,item:pn,level:Xt,label:Ue.getLabel(pn.itemIndexes[0])})}else Ft(void 0)},[Ue,ue,pe,on,cn]),[dn,sn]=(0,n.useState)(),Bn=(0,n.useCallback)(Vt=>{if(Nt===void 0){Bt(void 0),sn(void 0);const Ht=ft.current.clientWidth/on/(pe-ue),{levelIndex:Xt,barIndex:mn}=he({x:Vt.nativeEvent.offsetX,y:Vt.nativeEvent.offsetY},cn,Ht,on,ue);mn!==-1&&!isNaN(Xt)&&!isNaN(mn)&&(sn({x:Vt.clientX,y:Vt.clientY}),Bt(cn[Xt][mn]))}},[ue,pe,on,Nt,cn,sn]),wt=(0,n.useCallback)(()=>{Bt(void 0)},[]);return(0,n.useEffect)(()=>{const Vt=Ht=>{Ht.target.parentElement?.id!=="flameGraphCanvasContainer_clickOutsideCheck"&&Ft(void 0)};return window.addEventListener("click",Vt),()=>window.removeEventListener("click",Vt)},[Ft]),n.createElement("div",{className:qt.graph},n.createElement(M,{data:Ue,focusedItem:Ze,sandwichedLabel:pt,totalTicks:on,onFocusPillClick:It,onSandwichPillClick:_t}),n.createElement("div",{className:qt.canvasContainer},pt&&n.createElement("div",null,n.createElement("div",{className:qt.sandwichMarker,style:{height:ln*d/window.devicePixelRatio}},"Callers",n.createElement(E.J,{className:qt.sandwichMarkerIcon,name:"arrow-down"})),n.createElement("div",{className:qt.sandwichMarker,style:{marginTop:d/window.devicePixelRatio}},n.createElement(E.J,{className:qt.sandwichMarkerIcon,name:"arrow-up"}),"Callees")),n.createElement("div",{className:qt.canvasWrapper,id:"flameGraphCanvasContainer_clickOutsideCheck",ref:Un},n.createElement("canvas",{ref:ft,"data-testid":"flameGraph",onClick:Gt,onMouseMove:Bn,onMouseLeave:wt}))),n.createElement(A,{position:dn,item:Tt,data:Ue,totalTicks:on}),Nt&&n.createElement(D,{itemData:Nt,onMenuItemClick:()=>{Ft(void 0)},onItemFocus:()=>{Se(Nt.item.start/on),Ve((Nt.item.start+Nt.item.value)/on),He(Nt)},onSandwich:()=>{rt(Ue.getLabel(Nt.item.itemIndexes[0]))}}))},De=()=>({graph:(0,t.css)` overflow: scroll; height: 100%; flex-grow: 1; flex-basis: 50%; `,canvasContainer:(0,t.css)` label: canvasContainer; display: flex; `,canvasWrapper:(0,t.css)` label: canvasWrapper; cursor: pointer; flex: 1; overflow: hidden; `,sandwichMarker:(0,t.css)` writing-mode: vertical-lr; transform: rotate(180deg); overflow: hidden; white-space: nowrap; `,sandwichMarkerIcon:(0,t.css)` vertical-align: baseline; `}),he=(Ue,ue,pe,$e,Se)=>{const Ve=Math.floor(Ue.y/(d/window.devicePixelRatio)),He=ye(Ue.x,ue[Ve],pe,$e,Se);return{levelIndex:Ve,barIndex:He}},ye=(Ue,ue,pe,$e,Se)=>{if(ue){let Ve=0,He=ue.length-1;for(;Ve<=He;){const Ze=Ve+He>>1,Qe=ae(ue[Ze].start,$e,Se,pe),rt=ae(ue[Ze].start+ue[Ze].value,$e,Se,pe);if(Qe<=Ue&&rt>=Ue)return Ze;Qe>Ue?He=Ze-1:Ve=Ze+1}}return-1},ce=re;var We=e(15301),ke=e(46961),et=e(35719),we=e(62247),_e=e(66670),Ge=e(1128),qe=e(40705),st=e(89746),Me=e(80434);const be=({app:Ue,search:ue,setSearch:pe,selectedView:$e,setSelectedView:Se,containerWidth:Ve,onReset:He,textAlign:Ze,onTextAlignChange:Qe,showResetButton:rt,colorScheme:pt,onColorSchemeChange:It})=>{const _t=(0,g.wW)(ln=>Pt(ln,Ue));function tn(ln,Un){(0,s.ff)(`grafana_flamegraph_${ln}`,{app:Ue,grafana_version:r.config.buildInfo.version,...Un})}const[qt,cn]=nt(ue,pe),on=qt!==""?n.createElement(_e.zx,{icon:"times",fill:"text",size:"sm",onClick:()=>{pe(""),cn("")}},"Clear"):null;return n.createElement("div",{className:_t.header},n.createElement("div",{className:_t.inputContainer},n.createElement(Ge.I,{value:qt||"",onChange:ln=>{cn(ln.currentTarget.value)},placeholder:"Search..",width:44,suffix:on})),n.createElement("div",{className:_t.rightContainer},rt&&n.createElement(_e.zx,{variant:"secondary",fill:"outline",size:"sm",icon:"history-alt",tooltip:"Reset focus and sandwich state",onClick:()=>{He()},className:_t.buttonSpacing,"aria-label":"Reset focus and sandwich state"}),n.createElement(Ke,{app:Ue,value:pt,onChange:It}),n.createElement(qe.S,{size:"sm",disabled:$e===w.So.TopTable,options:Ye,value:Ze,onChange:ln=>{tn("text_align_selected",{align:ln}),Qe(ln)},className:_t.buttonSpacing}),n.createElement(qe.S,{size:"sm",options:tt(Ve),value:$e,onChange:ln=>{tn("view_selected",{view:ln}),Se(ln)}})))};function Ke(Ue){const ue=(0,g.wW)($e=>Pt($e,Ue.app)),pe=n.createElement(st.v,null,n.createElement(st.v.Item,{label:"By value",onClick:()=>Ue.onChange(w.eL.ValueBased)}),n.createElement(st.v.Item,{label:"By package name",onClick:()=>Ue.onChange(w.eL.PackageBased)}));return n.createElement(Me.L,{overlay:pe},n.createElement(_e.zx,{variant:"secondary",fill:"outline",size:"sm",tooltip:"Change color scheme",onClick:()=>{},className:ue.buttonSpacing,"aria-label":"Change color scheme"},n.createElement("span",{className:(0,t.cx)(ue.colorDot,Ue.value===w.eL.ValueBased?ue.colorDotByValue:ue.colorDotByPackage)})))}const Ye=[{value:"left",description:"Align text left",icon:"align-left"},{value:"right",description:"Align text right",icon:"align-right"}];function tt(Ue){let ue=[{value:w.So.TopTable,label:"Top Table",description:"Only show top table"},{value:w.So.FlameGraph,label:"Flame Graph",description:"Only show flame graph"}];return Ue>=p&&ue.push({value:w.So.Both,label:"Both",description:"Show both the top table and flame graph"}),ue}function nt(Ue,ue){const[pe,$e]=(0,n.useState)(Ue),Se=(0,et.Z)(Ue);return(0,ke.Z)(()=>{ue(pe)},250,[pe]),(0,n.useEffect)(()=>{Se!==Ue&&Ue!==pe&&$e(Ue)},[Ue,Se,pe]),[pe,$e]}const Pt=(Ue,ue)=>({header:(0,t.css)` label: header; display: flex; justify-content: space-between; width: 100%; background: ${Ue.colors.background.primary}; top: 0; z-index: ${Ue.zIndex.navbarFixed}; ${ue===we.zj.Explore?(0,t.css)` position: sticky; padding-bottom: ${Ue.spacing(1)}; padding-top: ${Ue.spacing(1)}; `:""}; `,inputContainer:(0,t.css)` label: inputContainer; margin-right: 20px; `,rightContainer:(0,t.css)` label: rightContainer; display: flex; align-items: flex-start; `,buttonSpacing:(0,t.css)` label: buttonSpacing; margin-right: ${Ue.spacing(1)}; `,resetButton:(0,t.css)` label: resetButton; display: flex; margin-right: ${Ue.spacing(2)}; `,resetButtonIconWrapper:(0,t.css)` label: resetButtonIcon; padding: 0 5px; color: ${Ue.colors.text.disabled}; `,colorDot:(0,t.css)` label: colorDot; display: inline-block; width: 10px; height: 10px; border-radius: 50%; `,colorDotByValue:(0,t.css)` label: colorDotByValue; background: ${_}; `,colorDotByPackage:(0,t.css)` label: colorDotByPackage; background: ${G}; `}),xt=be;var bt=e(55925),Rt=e(29241),ct=e(21708),it=e(95066),me=e(64167);const Ee=n.memo(({data:Ue,app:ue,onSymbolClick:pe,height:$e,search:Se,onSearch:Ve,sandwichItem:He,onSandwich:Ze})=>{const Qe=(0,g.wW)(Te),[rt,pt]=(0,n.useState)([{displayName:"Self",desc:!0}]);return n.createElement("div",{className:Qe.topTableContainer,"data-testid":"topTable"},n.createElement(bt.Z,{style:{width:"100%",height:$e}},({width:It,height:_t})=>{if(It<3||_t<3)return null;const tn=Ce(Ue,It,pe,Ve,Ze,Se,He);return n.createElement(it.i,{initialSortBy:rt,onSortByChange:qt=>{qt&&qt.length&&(0,s.ff)("grafana_flamegraph_table_sort_selected",{app:ue,grafana_version:r.config.buildInfo.version,sort:qt[0].displayName+"_"+(qt[0].desc?"desc":"asc")}),pt(qt)},data:tn,width:It,height:_t})}))});Ee.displayName="FlameGraphTopTableContainer";function Ce(Ue,ue,pe,$e,Se,Ve,He){let Ze={};for(let qt=0;qt<Ue.data.length;qt++){const cn=Ue.getValue(qt),on=Ue.getSelf(qt),ln=Ue.getLabel(qt);Ze[ln]=Ze[ln]||{},Ze[ln].self=Ze[ln].self?Ze[ln].self+on:on,Ze[ln].total=Ze[ln].total?Ze[ln].total+cn:cn}const Qe=Ie(Se,$e,Ve,He),rt={type:Rt.fS.string,name:"Symbol",values:[],config:{custom:{width:ue-ze-f*2},links:[{title:"Highlight symbol",url:"",onClick:qt=>{const on=qt.origin.field.values[qt.origin.rowIndex];pe(on)}}]}},pt=Ae("Self",Ue.selfField.config.unit),It=Ae("Total",Ue.valueField.config.unit);for(let qt in Ze)Qe.values.push(null),rt.values.push(qt),pt.values.push(Ze[qt].self),It.values.push(Ze[qt].total);const _t={fields:[Qe,rt,pt,It],length:rt.values.length};return(0,ct.SM)({data:[_t],fieldConfig:{defaults:{},overrides:[]},replaceVariables:qt=>qt,theme:r.config.theme2})[0]}function Ae(Ue,ue){return{type:Rt.fS.number,name:Ue,values:[],config:{unit:ue,custom:{width:f}}}}const ze=61;function Ie(Ue,ue,pe,$e){const Se={type:me.h2.Custom,cellComponent:He=>n.createElement(xe,{frame:He.frame,onSandwich:Ue,onSearch:ue,search:pe,sandwichItem:$e,rowIndex:He.rowIndex})},Ve={filterable:!1,width:ze,hideHeader:!0,inspect:!1,align:"auto",cellOptions:Se};return{type:Rt.fS.number,name:"actions",values:[],config:{custom:Ve}}}function xe(Ue){const ue=(0,g.wW)(Te),pe=Ue.frame.fields.find(Ve=>Ve.name==="Symbol")?.values.get(Ue.rowIndex),$e=Ue.search===pe,Se=Ue.sandwichItem===pe;return n.createElement("div",{className:ue.actionCellWrapper},n.createElement(C.h,{className:ue.actionCellButton,name:"search",variant:$e?"primary":"secondary",tooltip:$e?"Clear from search":"Search for symbol","aria-label":$e?"Clear from search":"Search for symbol",onClick:()=>{Ue.onSearch($e?"":pe)}}),n.createElement(C.h,{className:ue.actionCellButton,name:"gf-show-context",tooltip:Se?"Remove from sandwich view":"Show in sandwich view",variant:Se?"primary":"secondary","aria-label":Se?"Remove from sandwich view":"Show in sandwich view",onClick:()=>{Ue.onSandwich(Se?void 0:pe)}}))}const Te=()=>({topTableContainer:(0,t.css)` label: topTableContainer; flex-grow: 1; flex-basis: 50%; overflow: hidden; `,actionCellWrapper:(0,t.css)` label: actionCellWrapper; display: flex; height: 24px; `,actionCellButton:(0,t.css)` label: actionCellButton; margin-right: 0; width: 24px; `}),Oe=Ee,ie=Ue=>{const[ue,pe]=(0,n.useState)(),[$e,Se]=(0,n.useState)(0),[Ve,He]=(0,n.useState)(1),[Ze,Qe]=(0,n.useState)(""),[rt,pt]=(0,n.useState)(w.So.Both),[It,{width:_t}]=(0,i.Z)(),[tn,qt]=(0,n.useState)("left"),[cn,on]=(0,n.useState)(),[ln,Un]=(0,n.useState)(w.eL.ValueBased),yt=(0,g.l4)(),ft=(0,n.useMemo)(()=>{if(Ue.data)return new We.S(Ue.data,yt)},[Ue.data,yt]),Tt=(0,g.wW)(Le);(0,n.useEffect)(()=>{_t>0&&_t<p&&rt===w.So.Both&&pt(w.So.FlameGraph)},[rt,pt,_t]);const Bt=(0,n.useCallback)(()=>{pe(void 0),Se(0),He(1)},[pe,He,Se]);function Nt(){on(void 0)}(0,n.useEffect)(()=>{Bt(),Nt()},[Ue.data,Bt]);const Ft=(0,n.useCallback)(Gt=>{Ze===Gt?Qe(""):((0,s.ff)("grafana_flamegraph_table_item_selected",{app:Ue.app,grafana_version:r.config.buildInfo.version}),Qe(Gt),Bt())},[Qe,Bt,Ue.app,Ze]);return n.createElement(n.Fragment,null,ft&&n.createElement("div",{ref:It,className:Tt.container},n.createElement(xt,{app:Ue.app,search:Ze,setSearch:Qe,selectedView:rt,setSelectedView:pt,containerWidth:_t,onReset:()=>{Bt(),Nt()},textAlign:tn,onTextAlignChange:qt,showResetButton:!!(ue||cn),colorScheme:ln,onColorSchemeChange:Un}),n.createElement("div",{className:Tt.body},rt!==w.So.FlameGraph&&n.createElement(Oe,{data:ft,app:Ue.app,onSymbolClick:Ft,height:rt===w.So.TopTable?600:void 0,search:Ze,sandwichItem:cn,onSandwich:on,onSearch:Qe}),rt!==w.So.TopTable&&n.createElement(ce,{data:ft,rangeMin:$e,rangeMax:Ve,search:Ze,setRangeMin:Se,setRangeMax:He,onItemFocused:Gt=>pe(Gt),focusedItemData:ue,textAlign:tn,sandwichItem:cn,onSandwich:Gt=>{Bt(),on(Gt)},onFocusPillClick:Bt,onSandwichPillClick:Nt,colorScheme:ln}))))};function Le(Ue){return{container:(0,t.css)({height:"100%",display:"flex",flex:"1 1 0",flexDirection:"column",minHeight:0,gap:Ue.spacing(1)}),body:(0,t.css)({display:"flex",flexGrow:1,minHeight:0})}}const Be=ie},16998:(j,I,e)=>{"use strict";e.d(I,{So:()=>i,_r:()=>t,eL:()=>s});var t=(r=>(r.Bytes="bytes",r.Short="short",r.Nanoseconds="ns",r))(t||{}),n=(r=>(r.Symbol="Symbol",r.Self="Self",r.Total="Total",r))(n||{}),i=(r=>(r.TopTable="topTable",r.FlameGraph="flameGraph",r.Both="both",r))(i||{}),s=(r=>(r.ValueBased="valueBased",r.PackageBased="packageBased",r))(s||{})},3133:(j,I,e)=>{"use strict";e.r(I),e.d(I,{plugin:()=>a});var t=e(97585),n=e(77148),i=e(14035),s=e(50250);const r=C=>(0,s.rD)(C),g=(C,P,b)=>{const M=(0,s.ZH)(C,P,b);if(P==="singlestat"&&b.angular){const T=b.angular.gauge;T&&(M.showThresholdMarkers=T.thresholdMarkers,M.showThresholdLabels=T.thresholdLabels)}return M};var d=e(27702),l=e(61965),u=e(91466),o=e(59870),m=e(50741),c=e(44201),p=e(12308),f=e(72082);class E extends d.PureComponent{constructor(){super(...arguments),this.renderComponent=(P,b)=>{const{options:M,fieldConfig:T}=this.props,{width:S,height:x,count:O,value:B}=P,{field:A,display:V}=B,{openMenu:W,targetClassName:w}=b;return d.createElement(o.a,{value:(0,f.l)(O,T.defaults,V),width:S,height:x,field:A,text:M.text,showThresholdLabels:M.showThresholdLabels,showThresholdMarkers:M.showThresholdMarkers,theme:p.config.theme2,onClick:W,className:w})},this.renderValue=P=>{const{value:b}=P,{getLinks:M,hasLinks:T}=b;return T&&M?d.createElement(m.V,{links:M,style:{flexGrow:1}},S=>this.renderComponent(P,S)):this.renderComponent(P,{})},this.getValues=()=>{const{data:P,options:b,replaceVariables:M,fieldConfig:T,timeZone:S}=this.props;for(let x of P.series)for(let O of x.fields)if(O.config.unit==="percent"||O.config.unit==="percentunit"){const B=O.config.min??0,A=O.config.max??(O.config.unit==="percent"?100:1);O.state=O.state??{},O.state.range={min:B,max:A,delta:A-B},O.display=(0,l.U)({field:O,theme:p.config.theme2})}return(0,u.nG)({fieldConfig:T,reduceOptions:b.reduceOptions,replaceVariables:M,theme:p.config.theme2,data:P.series,timeZone:S})}}render(){const{height:P,width:b,data:M,renderCounter:T,options:S}=this.props;return d.createElement(c.Q,{getValues:this.getValues,renderValue:this.renderValue,width:b,height:P,source:M,autoGrid:!0,renderCounter:T,orientation:S.orientation})}}const h={showThresholdLabels:!1,showThresholdMarkers:!0};var y=e(5168),v=e(7641);class D{getSuggestionsForData(P){const{dataSummary:b}=P;if(!b.hasData||!b.hasNumberField||b.numberFieldCount>=50)return;const M=P.getListAppender({name:v.y.Gauge,pluginId:"gauge",options:{},fieldConfig:{defaults:{thresholds:{steps:[{value:-1/0,color:"green"},{value:70,color:"orange"},{value:85,color:"red"}],mode:y.H.Percentage},custom:{}},overrides:[]},cardOptions:{previewModifier:T=>{T.options.reduceOptions.values&&(T.options.reduceOptions.limit=2)}}});b.hasStringField&&b.frameCount===1&&b.rowCountTotal<10?(M.append({name:v.y.Gauge,options:{reduceOptions:{values:!0,calcs:[]}}}),M.append({name:v.y.GaugeNoThresholds,options:{reduceOptions:{values:!0,calcs:[]},showThresholdMarkers:!1}})):(M.append({name:v.y.Gauge,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]}}}),M.append({name:v.y.GaugeNoThresholds,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},showThresholdMarkers:!1}}))}}const a=new t.c(E).useFieldConfig({useCustomConfig:C=>{C.addNumberInput({path:"neutral",name:"Neutral",description:"Leave empty to use Min as neutral point",category:["Gauge"],settings:{placeholder:"auto"}})}}).setPanelOptions(C=>{(0,i.j)(C),(0,i.h)(C),C.addBooleanSwitch({path:"showThresholdLabels",name:"Show threshold labels",description:"Render the threshold values around the gauge bar",defaultValue:h.showThresholdLabels}).addBooleanSwitch({path:"showThresholdMarkers",name:"Show threshold markers",description:"Renders the thresholds as an outer bar",defaultValue:h.showThresholdMarkers}),n.Z(C)}).setPanelChangeHandler(g).setSuggestionsSupplier(new D).setMigrationHandler(r)},11378:(j,I,e)=>{"use strict";e.d(I,{Cg:()=>i,EQ:()=>r,Er:()=>g,H:()=>s,bD:()=>n});var t=e(64167),n=(d=>(d.Point="point",d.Line="line",d.Polygon="polygon",d.Any="*any*",d))(n||{});const i=5;var s=(d=>(d.Left="left",d.Center="center",d.Right="right",d))(s||{}),r=(d=>(d.Top="top",d.Middle="middle",d.Bottom="bottom",d))(r||{});const g=Object.freeze({size:{fixed:i,min:2,max:15},color:{fixed:"dark-green"},opacity:.4,symbol:{mode:t.Q8.Fixed,fixed:"img/icons/marker/circle.svg"},textConfig:{fontSize:12,textAlign:"center",textBaseline:"middle",offsetX:0,offsetY:0},rotation:{fixed:0,mode:t.eK.Mod,min:-360,max:360}})},89628:(j,I,e)=>{"use strict";e.d(I,{Q:()=>s});var t=e(42844),n=e(27702),i=e(42223);const s=r=>(0,i.CB)(r)?n.createElement("a",{href:r,target:"_blank",className:(0,t.cx)("external-link"),rel:"noreferrer"},r):r},42223:(j,I,e)=>{"use strict";e.d(I,{B1:()=>l,CB:()=>E,FB:()=>p,gE:()=>c,n_:()=>o,sA:()=>m,uH:()=>f,vV:()=>g});var t=e(587),n=e(33810),i=e(82382),s=e(28062),r=e(11378);function g(h,y,v,D){const a={};return D&&Object.keys(D).length?(a.color=(0,i.getColorDimension)(h,D.color??r.Er.color,v),a.size=(0,i.getScaledDimension)(h,D.size??r.Er.size),a.rotation=(0,i.getScalarDimension)(h,D.rotation??r.Er.rotation),D.text&&(D.text.field||D.text.fixed)&&(a.text=(0,i.getTextDimension)(h,D.text))):y.fields&&(y.fields.color&&(a.color=(0,i.getColorDimension)(h,y.config.color??r.Er.color,v)),y.fields.size&&(a.size=(0,i.getScaledDimension)(h,y.config.size??r.Er.size)),y.fields.text&&(a.text=(0,i.getTextDimension)(h,y.config.text)),y.fields.rotation&&(a.rotation=(0,i.getScalarDimension)(h,y.config.rotation??r.Er.rotation))),a}let d;function l(){return d||(d=[],u()),d}async function u(){const h=await(0,s.e)();for(let y of["maps","gazetteer"])h.listFiles(y).subscribe({next:v=>{v.forEach(D=>{if(D.name.endsWith(".geojson")){const a=`public/${y}/${D.name}`;d.push({value:a,label:a})}})}})}const o=(h,y,v)=>{const[D]=h.initMapView(y.view,void 0);return h.map=new t.Z({view:D,pixelRatio:1,layers:[],controls:[],target:v,interactions:(0,n.c)({mouseWheelZoom:!1})})},m=(h,y)=>{h.initControls(y.controls),h.forceUpdate()},c=(h,y,v)=>{h.panelContext&&h.panelContext.onInstanceStateChange&&h.panelContext.onInstanceStateChange({map:h.map,layers:y,selected:v,actions:h.actions})},p=h=>{let y=h.layers.length;for(;y<100;){const v=`Layer ${y++}`;if(!h.byName.has(v))return v}return`Layer ${Date.now()}`};function f(h,y,v,D){const a=h.getPixelFromCoordinate(v),C=h.getPixelFromCoordinate(D),P=Math.abs(a[0]-C[0]),b=Math.abs(a[1]-C[1]);return P>y||b>y}const E=h=>{try{return new URL(h).protocol.includes("http")}catch{return!1}}},8379:(j,I,e)=>{"use strict";e.d(I,{o:()=>i});var t=e(27702),n=e(35952);function i(s){return t.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end",paddingBottom:"6px"}},t.createElement(n.P,{onClick:s.onClick,style:{position:"relative",top:"auto",right:"auto",marginRight:0}}))}},54945:(j,I,e)=>{"use strict";e.d(I,{S:()=>g});var t=e(42844),n=e(27702),i=e(48154),s=e(60956),r=e(66310);function g({width:l,showImage:u,data:o,index:m}){const c=(0,r.wW)(d),p=l>600,f=o.get(m);return n.createElement("article",{className:(0,t.cx)(c.item,p&&c.itemWide)},u&&f.ogImage&&n.createElement("a",{tabIndex:-1,href:i.QX.sanitizeUrl(f.link),target:"_blank",rel:"noopener noreferrer",className:(0,t.cx)(c.socialImage,p&&c.socialImageWide),"aria-hidden":!0},n.createElement("img",{src:f.ogImage,alt:f.title})),n.createElement("div",{className:c.body},n.createElement("time",{className:c.date,dateTime:(0,s.dq)(f.date,{format:"MMM DD"})},(0,s.dq)(f.date,{format:"MMM DD"})," "),n.createElement("a",{className:c.link,href:i.QX.sanitizeUrl(f.link),target:"_blank",rel:"noopener noreferrer"},n.createElement("h3",{className:c.title},f.title)),n.createElement("div",{className:c.content,dangerouslySetInnerHTML:{__html:i.QX.sanitize(f.content)}})))}const d=l=>({container:(0,t.css)` height: 100%; `,item:(0,t.css)` display: flex; padding: ${l.spacing(1)}; position: relative; margin-bottom: 4px; margin-right: ${l.spacing(1)}; border-bottom: 2px solid ${l.colors.border.weak}; background: ${l.colors.background.primary}; flex-direction: column; flex-shrink: 0; `,itemWide:(0,t.css)` flex-direction: row; `,body:(0,t.css)` display: flex; flex-direction: column; `,socialImage:(0,t.css)` display: flex; align-items: center; margin-bottom: ${l.spacing(1)}; > img { width: 100%; border-radius: ${l.shape.radius.default} ${l.shape.radius.default} 0 0; } `,socialImageWide:(0,t.css)` margin-right: ${l.spacing(2)}; margin-bottom: 0; > img { width: 250px; border-radius: ${l.shape.radius.default}; } `,link:(0,t.css)` color: ${l.colors.text.link}; display: inline-block; &:hover { color: ${l.colors.text.link}; text-decoration: underline; } `,title:(0,t.css)` font-size: 16px; margin-bottom: ${l.spacing(.5)}; `,content:(0,t.css)` p { margin-bottom: 4px; color: ${l.colors.text}; } `,date:(0,t.css)` margin-bottom: ${l.spacing(.5)}; font-weight: 500; border-radius: 0 0 0 ${l.shape.radius.default}; color: ${l.colors.text.secondary}; `})},42349:(j,I,e)=>{"use strict";e.d(I,{k:()=>t});const t="https://grafana.com/blog/news.xml"},5008:(j,I,e)=>{"use strict";e.d(I,{j:()=>c});var t=e(26811),n=e(27938);function i(p){const E=new DOMParser().parseFromString(p,"text/xml");return{items:Array.from(E.querySelectorAll("entry")).map(y=>({title:d(y,"title"),link:y.querySelector("link")?.getAttribute("href")??"",content:d(y,"content"),pubDate:d(y,"published"),ogImage:y.querySelector("meta[property='og:image']")?.getAttribute("content")}))}}function s(p){const E=new DOMParser().parseFromString(p,"text/xml");return{items:Array.from(E.querySelectorAll("item")).map(y=>({title:d(y,"title"),link:d(y,"link"),content:d(y,"description"),pubDate:d(y,"pubDate"),ogImage:y.querySelector("meta[property='og:image']")?.getAttribute("content")}))}}async function r(p){return await(await fetch(p)).text()}function g(p){return new DOMParser().parseFromString(p,"text/xml").querySelector("feed")!==null}function d(p,f){return p.querySelector(f)?.textContent??""}async function l(p){const f=await r(p);return g(f)?i(f):s(f)}var u=e(99633),o=e(29241);function m(p){const f=[],E=[],h=[],y=[],v=[];for(const D of p.items){const a=(0,u.CQ)(D.pubDate);try{if(f.push(a.valueOf()),E.push(D.title),h.push(D.link),v.push(D.ogImage),D.content){const C=D.content.replace(/<\/?[^>]+(>|$)/g,"");y.push(C)}}catch(C){console.warn("Error reading news item:",C,D)}}return{fields:[{name:"date",type:o.fS.time,config:{displayName:"Date"},values:f},{name:"title",type:o.fS.string,config:{},values:E},{name:"link",type:o.fS.string,config:{},values:h},{name:"content",type:o.fS.string,config:{},values:y},{name:"ogImage",type:o.fS.string,config:{},values:v}],length:f.length}}function c(p){const[f,E]=(0,t.Z)(async()=>{const h=await l(p),y=m(h);return new n.U(y)},[p],{loading:!0});return{state:f,getNews:E}}},47760:(j,I,e)=>{"use strict";e.d(I,{E:()=>ct});var t=e(42844),n=e(89898),i=e.n(n),s=e(27702),r=e(17236),g=e(66310),d=e(62108),l=e(73453),u=e(11995);const o=(0,s.memo)(function(xe){const{edge:Te,onClick:Oe,onMouseEnter:ie,onMouseLeave:Le,hovering:Be}=xe,{source:Ue,target:ue}=Te,pe=(0,u.dM)({x1:Ue.x,y1:Ue.y,x2:ue.x,y2:ue.y},90);return s.createElement("g",{onClick:$e=>Oe($e,Te),style:{cursor:"pointer"},"aria-label":`Edge from: ${Ue.id} to: ${ue.id}`},s.createElement("line",{strokeWidth:Be?2:1,stroke:"#999",x1:pe.x1,y1:pe.y1,x2:pe.x2,y2:pe.y2,markerEnd:"url(#triangle)"}),s.createElement("line",{stroke:"transparent",x1:pe.x1,y1:pe.y1,x2:pe.x2,y2:pe.y2,strokeWidth:20,onMouseEnter:()=>{ie(Te.id)},onMouseLeave:()=>{Le(Te.id)}}))});function m(){return s.createElement("defs",null,s.createElement("marker",{id:"triangle",viewBox:"0 0 10 10",refX:"8",refY:"5",markerUnits:"userSpaceOnUse",markerWidth:"10",markerHeight:"10",orient:"auto"},s.createElement("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#999"})))}const c=Ie=>({mainGroup:(0,t.css)` pointer-events: none; font-size: 8px; `,background:(0,t.css)` fill: ${Ie.components.tooltip.background}; `,text:(0,t.css)` fill: ${Ie.components.tooltip.text}; `}),p=(0,s.memo)(function(xe){const{edge:Te}=xe,{source:Oe,target:ie}=Te,Le=(0,u.dM)({x1:Oe.x,y1:Oe.y,x2:ie.x,y2:ie.y},90),Be={x:Le.x1+(Le.x2-Le.x1)/2,y:Le.y1+(Le.y2-Le.y1)/2},Ue=(0,g.wW)(c),ue=[Te.mainStat,Te.secondaryStat].filter(He=>He),pe=ue.length>1?"30":"15",$e=ue.length>1?15:7.5;let Se=ue.length>1?-5:2.5;const Ve=[];return ue.forEach((He,Ze)=>{Ve.push(s.createElement("text",{key:Ze,className:Ue.text,x:Be.x,y:Be.y+Se,textAnchor:"middle"},He)),Se+=15}),s.createElement("g",{className:Ue.mainGroup},s.createElement("rect",{className:Ue.background,x:Be.x-40,y:Be.y-$e,width:"80",height:pe,rx:"5"}),Ve)});var f=e(89949),E=e(93666),h=e(64167),y=e(71982),v=e(11141);function D(){return{item:(0,t.css)` label: LegendItem; flex-grow: 0; `,legend:(0,t.css)` label: Legend; pointer-events: all; `}}const a=function(xe){const{nodes:Te,onSort:Oe,sort:ie,sortable:Le}=xe,Be=(0,g.l4)(),Ue=(0,g.wW)(D),ue=C(Te,Be),pe=(0,s.useCallback)($e=>{Oe({field:$e.data.field,ascending:$e.data.field===ie?.field?!ie?.ascending:!1})},[ie,Oe]);return s.createElement(y.l,{className:Ue.legend,displayMode:h.jK.List,placement:"bottom",items:ue,itemRenderer:$e=>s.createElement(s.Fragment,null,s.createElement(v.e,{item:$e,className:Ue.item,onLabelClick:Le?pe:void 0}),Le&&(ie?.field===$e.data.field?s.createElement(l.J,{name:ie.ascending?"arrow-up":"arrow-down"}):""))})};function C(Ie,xe){if(!Ie.length)return[];const Te=[Ie[0].mainStat,Ie[0].secondaryStat].filter(f.identity),Oe=Ie.find(ie=>ie.arcSections.length>0);return Oe&&Oe.arcSections[0].config?.color?.mode===E.S.Fixed&&Te.push(...new Set(Ie.map(ie=>ie.arcSections).flat())),Ie[0].color&&Te.push(Ie[0].color),Te.map(ie=>{const Le={label:ie.config.displayName||ie.name,yAxis:0,data:{field:ie}};return ie.config.color?.mode===E.S.Fixed&&ie.config.color?.fixedColor?Le.color=xe.visualization.getColorByName(ie.config.color?.fixedColor||""):ie.config.color?.mode&&(Le.gradient=ie.config.color?.mode),Le.color||Le.gradient||(Le.color=xe.visualization.getColorByName("")),Le})}const P=40,b=Ie=>({mainGroup:(0,t.css)` cursor: pointer; font-size: 10px; `,mainCircle:(0,t.css)` fill: ${Ie.components.panel.background}; stroke: ${Ie.colors.border.strong}; `,text:(0,t.css)` width: 50px; height: 50px; text-align: center; display: flex; align-items: center; justify-content: center; `}),M=(0,s.memo)(function(xe){const{marker:Te,onClick:Oe}=xe,{node:ie}=Te,Le=(0,g.wW)(b);return ie.x!==void 0&&ie.y!==void 0?s.createElement("g",{"data-node-id":ie.id,className:Le.mainGroup,onClick:Be=>{Oe?.(Be,Te)},"aria-label":`Hidden nodes marker: ${ie.id}`},s.createElement("circle",{className:Le.mainCircle,r:P,cx:ie.x,cy:ie.y}),s.createElement("g",null,s.createElement("foreignObject",{x:ie.x-25,y:ie.y-25,width:"50",height:"50"},s.createElement("div",{className:Le.text},s.createElement("span",null,Te.count>100?">100":Te.count," nodes"))))):null});var T=e(71685),S=e(58192);const x=40,O=(Ie,xe)=>({mainGroup:(0,t.css)` cursor: pointer; font-size: 10px; transition: opacity 300ms; opacity: ${xe==="inactive"?.5:1}; `,mainCircle:(0,t.css)` fill: ${Ie.components.panel.background}; `,hoverCircle:(0,t.css)` opacity: 0.5; fill: transparent; stroke: ${Ie.colors.primary.text}; `,text:(0,t.css)` fill: ${Ie.colors.text.primary}; pointer-events: none; `,titleText:(0,t.css)` text-align: center; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; background-color: ${(0,T.Z)(Ie.colors.background.primary).setAlpha(.6).toHex8String()}; width: 140px; `,statsText:(0,t.css)` text-align: center; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; width: 70px; `,textHovering:(0,t.css)` width: 200px; & span { background-color: ${(0,T.Z)(Ie.colors.background.primary).setAlpha(.8).toHex8String()}; } `,clickTarget:(0,t.css)` fill: none; stroke: none; pointer-events: fill; `}),B=(0,s.memo)(function(xe){const{node:Te,onMouseEnter:Oe,onMouseLeave:ie,onClick:Le,hovering:Be}=xe,Ue=(0,g.l4)(),ue=O(Ue,Be),pe=Be==="active";return Te.x!==void 0&&Te.y!==void 0?s.createElement("g",{"data-node-id":Te.id,className:ue.mainGroup,"aria-label":`Node: ${Te.title}`},s.createElement("circle",{className:ue.mainCircle,r:x,cx:Te.x,cy:Te.y}),pe&&s.createElement("circle",{className:ue.hoverCircle,r:x-3,cx:Te.x,cy:Te.y,strokeWidth:2}),s.createElement(V,{node:Te}),s.createElement("g",{className:ue.text,style:{pointerEvents:"none"}},s.createElement(A,{node:Te,hovering:Be}),s.createElement("foreignObject",{x:Te.x-(pe?100:70),y:Te.y+x+5,width:pe?"200":"140",height:"40"},s.createElement("div",{className:i()(ue.titleText,pe&&ue.textHovering)},s.createElement("span",null,Te.title),s.createElement("br",null),s.createElement("span",null,Te.subTitle)))),s.createElement("rect",{"data-testid":`node-click-rect-${Te.id}`,onMouseEnter:()=>{Oe(Te.id)},onMouseLeave:()=>{ie(Te.id)},onClick:$e=>{Le($e,Te)},className:ue.clickTarget,x:Te.x-x-5,y:Te.y-x-5,width:x*2+10,height:x*2+50})):null});function A({node:Ie,hovering:xe}){const Te=(0,g.l4)(),Oe=O(Te,xe),ie=xe==="active";return Ie.x!==void 0&&Ie.y!==void 0?Ie.icon?s.createElement("foreignObject",{x:Ie.x-35,y:Ie.y-20,width:"70",height:"40"},s.createElement("div",{style:{width:70,overflow:"hidden",display:"flex",justifyContent:"center",marginTop:-4}},s.createElement(l.J,{"data-testid":`node-icon-${Ie.icon}`,name:Ie.icon,size:"xxxl"}))):s.createElement("foreignObject",{x:Ie.x-(ie?100:35),y:Ie.y-15,width:ie?"200":"70",height:"40"},s.createElement("div",{className:i()(Oe.statsText,ie&&Oe.textHovering)},s.createElement("span",null,Ie.mainStat&&(0,u.Ew)(Ie.mainStat.config,Ie.mainStat.values[Ie.dataFrameRowIndex])),s.createElement("br",null),s.createElement("span",null,Ie.secondaryStat&&(0,u.Ew)(Ie.secondaryStat.config,Ie.secondaryStat.values[Ie.dataFrameRowIndex])))):null}function V(Ie){const{node:xe}=Ie,Te=xe.arcSections.find(Be=>Be.values[xe.dataFrameRowIndex]>=1),Oe=(0,g.l4)();if(Te)return s.createElement("circle",{fill:"none",stroke:Oe.visualization.getColorByName(Te.config.color?.fixedColor||""),strokeWidth:2,r:x,cx:xe.x,cy:xe.y});const ie=xe.arcSections.filter(Be=>Be.values[xe.dataFrameRowIndex]!==0);if(ie.length===0)return s.createElement("circle",{fill:"none",stroke:xe.color?w(xe.color,xe.dataFrameRowIndex,Oe):"gray",strokeWidth:2,r:x,cx:xe.x,cy:xe.y});const{elements:Le}=ie.reduce((Be,Ue,ue)=>{const pe=Ue.config.color?.fixedColor||"",$e=Ue.values[xe.dataFrameRowIndex],Se=s.createElement(W,{key:ue,r:x,x:xe.x,y:xe.y,startPercent:Be.percent,percent:$e+Be.percent>1?1-Be.percent:$e,color:Oe.visualization.getColorByName(pe),strokeWidth:2});return Be.elements.push(Se),Be.percent=Be.percent+$e,Be},{elements:[],percent:0});return s.createElement(s.Fragment,null,Le)}function W({r:Ie,x:xe,y:Te,startPercent:Oe,percent:ie,color:Le,strokeWidth:Be=2}){const Ue=Oe+ie,ue=xe+Math.sin(2*Math.PI*Oe)*Ie,pe=Te-Math.cos(2*Math.PI*Oe)*Ie,$e=xe+Math.sin(2*Math.PI*Ue)*Ie,Se=Te-Math.cos(2*Math.PI*Ue)*Ie,Ve=ie>.5?"1":"0";return s.createElement("path",{fill:"none",d:`M ${ue} ${pe} A ${Ie} ${Ie} 0 ${Ve} 1 ${$e} ${Se}`,stroke:Le,strokeWidth:Be})}function w(Ie,xe,Te){return Ie.config.color?(0,S.fD)(Ie).getCalculator(Ie,Te)(0,Ie.values[xe]):Ie.values[xe]}var N=e(64022),F=e(66670);function k(){return{wrapper:(0,t.css)` label: wrapper; pointer-events: all; `}}function H(Ie){const{config:xe,onConfigChange:Te,onPlus:Oe,onMinus:ie,disableZoomOut:Le,disableZoomIn:Be}=Ie,[Ue,ue]=(0,s.useState)(!1),pe=!1,$e=(0,g.wW)(k);return s.createElement("div",{className:$e.wrapper},s.createElement(N.wc,{spacing:"sm"},s.createElement(N.Lh,{spacing:"xs"},s.createElement(F.zx,{icon:"plus-circle",onClick:Oe,size:"md",title:"Zoom in",variant:"secondary",disabled:Be}),s.createElement(F.zx,{icon:"minus-circle",onClick:ie,size:"md",title:"Zoom out",variant:"secondary",disabled:Le})),s.createElement(N.Lh,{spacing:"xs"},s.createElement(F.zx,{icon:"code-branch",onClick:()=>Te({...xe,gridLayout:!1}),size:"md",title:"Default layout",variant:"secondary",disabled:!xe.gridLayout}),s.createElement(F.zx,{icon:"apps",onClick:()=>Te({...xe,gridLayout:!0}),size:"md",title:"Grid layout",variant:"secondary",disabled:xe.gridLayout}))),pe&&s.createElement(F.zx,{size:"xs",fill:"text",onClick:()=>ue(Se=>!Se)},Ue?"Hide config":"Show config"),pe&&Ue&&Object.keys(xe).filter(Se=>Se!=="show").map(Se=>s.createElement("div",{key:Se},Se,s.createElement("input",{style:{width:50},type:"number",value:xe[Se],onChange:Ve=>{Te({...xe,[Se]:parseFloat(Ve.target.value)})}}))))}var R=e(97780),_=e(8227),G=e(42575);const Y=()=>new G.q(new URL(e.p+e.u(7032),e.b));function X(Ie,xe,Te,Oe,ie){const[Le,Be]=(0,s.useMemo)(()=>{if(!(Ie.length&&xe.length))return[{},{}];const Ue=xe.reduce((pe,$e)=>(pe[$e.source.id]=[...pe[$e.source.id]??[],$e],pe[$e.target.id]=[...pe[$e.target.id]??[],$e],pe),{}),ue=Ie.reduce((pe,$e)=>(pe[$e.id]=$e,pe),{});return[Ue,ue]},[xe,Ie]);return(0,s.useMemo)(()=>Ie.length<=Te?{nodes:Ie,edges:xe}:Oe.gridLayout?se(Ie,Te,ie):Q(Ie,xe,Be,Le,Te,ie),[xe,Le,Te,Ie,Be,ie,Oe.gridLayout])}function Q(Ie,xe,Te,Oe,ie,Le){let Be;Le?Be=[Te[Le]]:(Be=Ie.filter(Ve=>Ve.incoming===0),Be.length||(Be=[Ie[0]]));const{visibleNodes:Ue,markers:ue}=Z(ie,Be,Te,Oe),pe=le(ue,Ue,Te,Oe),$e=(0,f.fromPairs)(pe.map(Ve=>[Ve.node.id,Ve]));for(const Ve of pe)Ve.count===1&&(delete $e[Ve.node.id],Ue[Ve.node.id]=Ve.node);const Se=xe.filter(Ve=>(Ue[Ve.source.id]||$e[Ve.source.id])&&(Ue[Ve.target.id]||$e[Ve.target.id]));return{nodes:Object.values(Ue),edges:Se,markers:Object.values($e)}}function se(Ie,xe,Te){let Oe=0,ie=xe,Le=[];if(Te){const Be=Ie.findIndex(pe=>pe.id===Te),Ue=Math.floor(xe/2);let ue=Ue;Oe=Be-Ue,Oe<0&&(ue+=Math.abs(Oe),Oe=0),ie=Be+ue+1,ie>Ie.length&&(Oe>0&&(Oe=Math.max(0,Oe-(ie-Ie.length))),ie=Ie.length),Oe>1&&Le.push({node:Ie[Oe-1],count:Oe}),Ie.length-ie>1&&Le.push({node:Ie[ie],count:Ie.length-ie})}else Ie.length-xe>1&&(Le=[{node:Ie[xe],count:Ie.length-xe}]);return{nodes:Ie.slice(Oe,ie),edges:[],markers:Le}}function Z(Ie,xe,Te,Oe){const ie={};let Le=[...xe];for(;Object.keys(ie).length<Ie&&Le.length>0;){let Ue=Le.shift();if(ie[Ue.id])continue;ie[Ue.id]=Ue;const pe=(Oe[Ue.id]||[]).map($e=>{const Se=$e.source.id===Ue.id?$e.target.id:$e.source.id;return Te[Se]});Le=Le.concat(pe)}const Be=(0,f.uniq)(Le.filter(Ue=>!ie[Ue.id]));return{visibleNodes:ie,markers:Be}}function le(Ie,xe,Te,Oe){return Ie.map(ie=>{const Le={};let Be=0,Ue=[ie];for(;Ue.length>0&&Be<=101;){let ue=Ue.shift();if(xe[ue.id]||Le[ue.id])continue;Le[ue.id]||Be++,Le[ue.id]=ue;const $e=(Oe[ue.id]||[]).map(Se=>{const Ve=Se.source.id===ue.id?Se.target.id:Se.source.id;return Te[Ve]});Ue=Ue.concat($e)}return{node:ie,count:Be}})}const oe={linkDistance:150,linkStrength:.5,forceX:2e3,forceXStrength:.02,forceCollide:100,tick:300,gridLayout:!1};function q(Ie,xe,Te=oe,Oe,ie,Le){const[Be,Ue]=(0,s.useState)([]),[ue,pe]=(0,s.useState)([]),[$e,Se]=(0,s.useState)(!1),Ve=(0,_.default)(),He=(0,s.useRef)();(0,R.Z)(()=>{He.current&&He.current()}),(0,s.useEffect)(()=>{if(Ie.length===0){Ue([]),pe([]),Se(!1);return}Se(!0);const tn=ne(Ie,xe,({nodes:qt,edges:cn})=>{Ve()&&(Ue(qt),pe(cn),Se(!1))});return He.current=tn,tn},[Ie,xe,Ve]);const[Ze,Qe]=(0,s.useMemo)(()=>{if(Ie.length===0)return[[],[]];const tn=Ie.map(cn=>({...cn})),qt=xe.map(cn=>({...cn}));return ge(tn,ie,Te.sort),[tn,qt]},[Te.sort,Ie,xe,ie]),{nodes:rt,edges:pt,markers:It}=X(Te.gridLayout?Ze:Be,Te.gridLayout?Qe:ue,Oe,Te,Le),_t=(0,s.useMemo)(()=>(0,u.Tz)([...rt,...(It||[]).map(tn=>tn.node)]),[rt,It]);return{nodes:rt,edges:pt,markers:It,bounds:_t,hiddenNodesCount:Ie.length-rt.length,loading:$e}}function ne(Ie,xe,Te){const Oe=Y();return Oe.onmessage=ie=>{for(let Le=0;Le<Ie.length;Le++)ie.data.nodes[Le]={...Ie[Le],...ie.data.nodes[Le]};Te(ie.data)},Oe.postMessage({nodes:Ie.map(ie=>({id:ie.id,incoming:ie.incoming})),edges:xe,config:oe}),()=>{Oe.terminate()}}function ge(Ie,xe,Te){const Be=Math.min(Math.floor((xe-120)/140),Ie.length),Ue=Math.floor((Be-1)*120/2);Te&&Ie.sort((ue,pe)=>{const $e=Te.field.values[ue.dataFrameRowIndex],Se=Te.field.values[pe.dataFrameRowIndex];return Te.ascending?$e-Se:Se-$e});for(const[ue,pe]of Ie.entries()){const $e=Math.floor(ue/Be),Se=ue%Be;pe.x=Se*120-Ue,pe.y=-60+$e*140}}var ae=e(30097),re=e(14986),De=e(66711),he=e(79655);function ye(Ie,xe,Te,Oe,ie,Le){const[Be,Ue]=(0,s.useState)(void 0),ue=(0,s.useCallback)(($e,Se)=>{const[Ve,He]=Oe.gridLayout?["Show in Graph layout",!1]:["Show in Grid layout",!0],Ze=[{label:Ve,onClick:pt=>{Le(pt.id),ie({...Oe,gridLayout:He}),Ue(void 0)}}],Qe=xe?Ie(xe,Se.dataFrameRowIndex):[],rt=We(Qe,Se,Ze);Ue(ce(s.createElement(Ge,{node:Se,nodes:xe}),$e,Ue,rt))},[Oe,xe,Ie,Ue,ie,Le]);return{onEdgeOpen:(0,s.useCallback)(($e,Se)=>{if(!Te)return;const Ve=Ie(Te,Se.dataFrameRowIndex),He=We(Ve,Se);Ue(ce(s.createElement(qe,{edge:Se,edges:Te}),$e,Ue,He))},[Te,Ie,Ue]),onNodeOpen:ue,MenuComponent:Be}}function ce(Ie,xe,Te,Oe){return s.createElement(re.x,{renderHeader:()=>Ie,renderMenuItems:Oe,onClose:()=>Te(void 0),x:xe.pageX,y:xe.pageY})}function We(Ie,xe,Te){if(!(Ie.length||Te?.length))return;const Oe=et(Ie);return()=>{let ie=Oe?.map((Le,Be)=>s.createElement(De.k,{key:`${Le.label}${Be}`,label:Le.label},(Le.items||[]).map(ke(xe))));return Te&&(ie=[...Te.map(ke(xe)),...ie]),ie}}function ke(Ie){return function(Te){return s.createElement(he.s,{key:Te.label,url:Te.url,label:Te.label,ariaLabel:Te.ariaLabel,onClick:Te.onClick?Oe=>{Oe?.ctrlKey||Oe?.metaKey||Oe?.shiftKey||(Oe?.preventDefault(),Oe?.stopPropagation(),Te.onClick?.(Ie))}:void 0,target:"_self"})}}function et(Ie){const xe="Open in Explore",Te=Ie.reduce((Oe,ie)=>{let Le,Be;return ie.title.indexOf("/")!==-1?(Le=ie.title.split("/")[0],Be=ie.title.split("/")[1],Oe[Le]=Oe[Le]||[],Oe[Le].push({l:ie,newTitle:Be})):(Oe[xe]=Oe[xe]||[],Oe[xe].push({l:ie})),Oe},{});return Object.keys(Te).map(Oe=>({label:Oe,ariaLabel:Oe,items:Te[Oe].map(ie=>({label:ie.newTitle||ie.l.title,ariaLabel:ie.newTitle||ie.l.title,url:ie.l.href,onClick:ie.l.onClick}))}))}function we({field:Ie,index:xe}){return s.createElement(_e,{label:Ie.config?.displayName||Ie.name,value:(0,u.Ew)(Ie.config,Ie.values[xe]||"")})}function _e({label:Ie,value:xe}){const Te=(0,g.wW)(st);return s.createElement("tr",null,s.createElement("td",{className:Te.label},Ie,": "),s.createElement("td",{className:Te.value},xe))}function Ge({node:Ie,nodes:xe}){const Te=[];if(xe){const Oe=(0,u.F)(xe);for(const ie of[Oe.title,Oe.subTitle,Oe.mainStat,Oe.secondaryStat,...Oe.details])ie&&ie.values[Ie.dataFrameRowIndex]&&Te.push(s.createElement(we,{key:ie.name,field:ie,index:Ie.dataFrameRowIndex}))}else Ie.title&&Te.push(s.createElement(_e,{key:"title",label:"Title",value:Ie.title})),Ie.subTitle&&Te.push(s.createElement(_e,{key:"subtitle",label:"Subtitle",value:Ie.subTitle}));return s.createElement("table",{style:{width:"100%"}},s.createElement("tbody",null,Te))}function qe(Ie){const xe=Ie.edge.dataFrameRowIndex,Te=(0,u.lr)(Ie.edges),Oe=Te.source?.values[xe]||"",ie=Te.target?.values[xe]||"",Le=[];Oe&&ie&&Le.push(s.createElement(_e,{key:"header-row",label:"Source \u2192 Target",value:`${Oe} \u2192 ${ie}`}));for(const Be of[Te.mainStat,Te.secondaryStat,...Te.details])Be&&Be.values[xe]&&Le.push(s.createElement(we,{key:`field-row-${xe}`,field:Be,index:xe}));return s.createElement("table",{style:{width:"100%"}},s.createElement("tbody",null,Le))}const st=Ie=>({label:(0,t.css)` label: Label; line-height: 1.25; color: ${Ie.colors.text.disabled}; font-size: ${Ie.typography.size.sm}; font-weight: ${Ie.typography.fontWeightMedium}; padding-right: ${Ie.spacing(1)}; `,value:(0,t.css)` label: Value; font-size: ${Ie.typography.size.sm}; font-weight: ${Ie.typography.fontWeightMedium}; color: ${Ie.colors.text.primary}; `});var Me=e(35719);function be(Ie,xe,Te){const Oe=(0,Me.Z)(Ie.gridLayout);let ie;if(Oe===!0&&!Ie.gridLayout&&Te){const Le=xe.find(Be=>Be.id===Te);Le&&(ie={x:-Le.x,y:-Le.y})}return ie}function Ke(Ie){const[xe,Te]=(0,s.useState)(),Oe=(0,_.default)();return(0,s.useEffect)(()=>{Ie&&(Te(Ie),setTimeout(()=>{Oe()&&Te(void 0)},500))},[Ie,Oe]),xe}function Ye({scale:Ie=1,bounds:xe,focus:Te}={}){const Oe=(0,_.default)(),ie=(0,s.useRef)(!1),Le=(0,s.useRef)(0),Be=(0,s.useRef)(null),Ue={x:0,y:0},ue=(0,s.useMemo)(()=>({right:xe?-xe.left:1/0,left:xe?-xe.right:-1/0,bottom:xe?-xe.top:-1/0,top:xe?-xe.bottom:1/0}),[xe]),pe=(0,s.useRef)(Ue),$e=(0,s.useRef)(Ue),Se=(0,s.useRef)(Ue),[Ve,He]=(0,s.useState)({isPanning:!1,position:Ue});(0,s.useEffect)(()=>{const rt=on=>{!ie.current&&Oe()&&(ie.current=!0,pe.current=nt(on),$e.current={...Se.current},He(ln=>({...ln,isPanning:!0})),_t())},pt=()=>{ie.current&&Oe()&&(ie.current=!1,He(on=>({...on,isPanning:!1})),tn())},It=on=>{rt(on),qt(on)},_t=()=>{document.addEventListener("mousemove",qt),document.addEventListener("mouseup",pt),document.addEventListener("touchmove",qt),document.addEventListener("touchend",pt)},tn=()=>{document.removeEventListener("mousemove",qt),document.removeEventListener("mouseup",pt),document.removeEventListener("touchmove",qt),document.removeEventListener("touchend",pt)},qt=on=>{cancelAnimationFrame(Le.current);const ln=nt(on);Le.current=requestAnimationFrame(()=>{if(Oe()&&Be.current){let Un=ln.x-pe.current.x,yt=ln.y-pe.current.y;Se.current={x:tt($e.current.x+Un/Ie,ue.left,ue.right),y:tt($e.current.y+yt/Ie,ue.top,ue.bottom)},He(ft=>({...ft,position:{...Se.current}}))}})},cn=Be.current;return cn&&(cn.addEventListener("mousedown",It),cn.addEventListener("touchstart",It)),()=>{cn&&(cn.removeEventListener("mousedown",It),cn.removeEventListener("touchstart",It))}},[Ie,ue,Oe]);const Ze=(0,Me.Z)(Te);(0,s.useEffect)(()=>{if(Te&&Ze?.x!==Te.x&&Ze?.y!==Te.y){const rt={x:tt(Te.x,ue.left,ue.right),y:tt(Te.y,ue.top,ue.bottom)};He({position:rt,isPanning:!1}),Se.current=rt,$e.current=rt}},[Te,Ze,ue,Se,$e]);let Qe=Ve.position;return Te&&Ze?.x!==Te.x&&Ze?.y!==Te.y&&(Qe=Te),{state:{...Ve,position:{x:tt(Qe.x,ue.left,ue.right),y:tt(Qe.y,ue.top,ue.bottom)}},ref:Be}}function tt(Ie,xe,Te){return Math.min(Math.max(Ie,xe??-1/0),Te??1/0)}function nt(Ie){return Ie instanceof TouchEvent?{x:Ie.changedTouches[0].clientX,y:Ie.changedTouches[0].clientY}:Ie instanceof MouseEvent?{x:Ie.clientX,y:Ie.clientY}:{x:0,y:0}}const Pt={stepDown:Ie=>Ie/1.5,stepUp:Ie=>Ie*1.5,min:.13,max:2.25};function xt({stepUp:Ie,stepDown:xe,min:Te,max:Oe}=Pt){const ie=(0,s.useRef)(null),[Le,Be]=(0,s.useState)(1),Ue=(0,s.useCallback)(()=>{Le<(Oe??1/0)&&Be(Ie(Le))},[Le,Ie,Oe]),ue=(0,s.useCallback)(()=>{Le>(Te??-1/0)&&Be(xe(Le))},[Le,xe,Te]),pe=(0,s.useCallback)(function($e){if($e.ctrlKey||$e.metaKey){if($e.preventDefault(),Be(Math.min(Math.max(Te??-1/0,Le+Math.min($e.deltaY,2)*-.01),Oe??1/0)),$e.deltaY<0){const Se=Le+Math.max($e.deltaY,-4)*-.015;Be(Math.max(Te??-1/0,Se))}else if($e.deltaY>0){const Se=Le+Math.min($e.deltaY,4)*-.015;Be(Math.min(Oe??1/0,Se))}}},[Te,Oe,Le]);return(0,s.useEffect)(()=>{if(!ie.current)return;const $e=ie.current;return $e.addEventListener("wheel",pe,{passive:!1}),()=>{$e&&$e.removeEventListener("wheel",pe)}},[pe]),{onStepUp:Ue,onStepDown:ue,scale:Math.max(Math.min(Le,Oe??1/0),Te??-1/0),isMax:Le>=(Oe??1/0),isMin:Le<=(Te??-1/0),ref:ie}}const bt=Ie=>({wrapper:(0,t.css)` label: wrapper; height: 100%; width: 100%; overflow: hidden; position: relative; `,svg:(0,t.css)` label: svg; height: 100%; width: 100%; overflow: visible; font-size: 10px; cursor: move; `,svgPanning:(0,t.css)` label: svgPanning; user-select: none; `,noDataMsg:(0,t.css)` height: 100%; width: 100%; display: grid; place-items: center; font-size: ${Ie.typography.h4.fontSize}; color: ${Ie.colors.text.secondary}; `,mainGroup:(0,t.css)` label: mainGroup; will-change: transform; `,viewControls:(0,t.css)` label: viewControls; position: absolute; left: 2px; bottom: 3px; right: 0; display: flex; align-items: flex-end; justify-content: space-between; pointer-events: none; `,legend:(0,t.css)` label: legend; background: ${Ie.colors.background.secondary}; box-shadow: ${Ie.shadows.z1}; padding-bottom: 5px; margin-right: 10px; `,viewControlsWrapper:(0,t.css)` margin-left: auto; `,alert:(0,t.css)` label: alert; padding: 5px 8px; font-size: 10px; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); border-radius: ${Ie.shape.borderRadius()}; align-items: center; position: absolute; top: 0; right: 0; background: ${Ie.colors.warning.main}; color: ${Ie.colors.warning.contrastText}; `,loadingWrapper:(0,t.css)` label: loadingWrapper; height: 100%; display: flex; align-items: center; justify-content: center; `}),Rt=200;function ct({getLinks:Ie,dataFrames:xe,nodeLimit:Te}){const Oe=Te||Rt,{edges:ie,nodes:Le}=(0,ae.Y)(xe),[Be,{width:Ue,height:ue}]=(0,r.Z)(),[pe,$e]=(0,s.useState)(oe),Se=Le[0],Ve=ie[0],He=(0,s.useMemo)(()=>(0,u.HB)(Se,Ve),[Ve,Se]),{nodeHover:Ze,setNodeHover:Qe,clearNodeHover:rt,edgeHover:pt,setEdgeHover:It,clearEdgeHover:_t}=ze(),[tn,qt]=(0,s.useState)([]);(0,s.useEffect)(()=>{let na=[];Ze?na=(0,u.uX)(He.nodes,He.edges,Ze):pt&&(na=(0,u.MP)(He.nodes,He.edges,pt)),qt(na)},[Ze,pt,He]);const[cn,on]=(0,s.useState)(),ln=(0,s.useCallback)((na,xa)=>on(xa.node.id),[on]),{nodes:Un,edges:yt,markers:ft,bounds:Tt,hiddenNodesCount:Bt,loading:Nt}=q(He.nodes,He.edges,pe,Oe,Ue,cn),Ft=be(pe,Un,cn),{panRef:Gt,zoomRef:dn,onStepUp:sn,onStepDown:Bn,isPanning:wt,position:Vt,scale:Ht,isMaxZoom:Xt,isMinZoom:mn}=Ae(Tt,Ft),{onEdgeOpen:pn,onNodeOpen:Pn,MenuComponent:zn}=ye(Ie,Se,Ve,pe,$e,on),Hn=(0,g.wW)(bt),Ea=(0,s.useCallback)(na=>{Be(na),dn.current=na},[Be,dn]),aa=Ke(cn);return s.createElement("div",{ref:Ea,className:Hn.wrapper},Nt?s.createElement("div",{className:Hn.loadingWrapper},"Computing layout\xA0",s.createElement(d.$,null)):null,xe.length&&He.nodes.length?s.createElement("svg",{ref:Gt,viewBox:`${-(Ue/2)} ${-(ue/2)} ${Ue} ${ue}`,className:i()(Hn.svg,wt&&Hn.svgPanning)},s.createElement("g",{className:Hn.mainGroup,style:{transform:`scale(${Ht}) translate(${Math.floor(Vt.x)}px, ${Math.floor(Vt.y)}px)`}},s.createElement(m,null),!pe.gridLayout&&s.createElement(Ee,{edges:yt,nodeHoveringId:Ze,edgeHoveringId:pt,onClick:pn,onMouseEnter:It,onMouseLeave:_t}),s.createElement(it,{nodes:Un,onMouseEnter:Qe,onMouseLeave:rt,onClick:Pn,hoveringIds:tn||[aa]}),s.createElement(me,{markers:ft||[],onClick:ln}),!pe.gridLayout&&s.createElement(Ce,{edges:yt,nodeHoveringId:Ze,edgeHoveringId:pt}))):s.createElement("div",{className:Hn.noDataMsg},"No data"),s.createElement("div",{className:Hn.viewControls},Un.length?s.createElement("div",{className:Hn.legend},s.createElement(a,{sortable:pe.gridLayout,nodes:Un,sort:pe.sort,onSort:na=>{$e({...pe,sort:na})}})):null,s.createElement("div",{className:Hn.viewControlsWrapper},s.createElement(H,{config:pe,onConfigChange:na=>{na.gridLayout!==pe.gridLayout&&on(void 0),$e(na)},onMinus:Bn,onPlus:sn,scale:Ht,disableZoomIn:Xt,disableZoomOut:mn}))),Bt>0&&s.createElement("div",{className:Hn.alert,"aria-label":"Nodes hidden warning"},s.createElement(l.J,{size:"sm",name:"info-circle"})," ",Bt," nodes are hidden for performance reasons."),zn)}const it=(0,s.memo)(function(xe){return s.createElement(s.Fragment,null,xe.nodes.map(Te=>s.createElement(B,{key:Te.id,node:Te,onMouseEnter:xe.onMouseEnter,onMouseLeave:xe.onMouseLeave,onClick:xe.onClick,hovering:!xe.hoveringIds||xe.hoveringIds.length===0?"default":xe.hoveringIds?.includes(Te.id)?"active":"inactive"})))}),me=(0,s.memo)(function(xe){return s.createElement(s.Fragment,null,xe.markers.map(Te=>s.createElement(M,{key:"marker-"+Te.node.id,marker:Te,onClick:xe.onClick})))}),Ee=(0,s.memo)(function(xe){return s.createElement(s.Fragment,null,xe.edges.map(Te=>s.createElement(o,{key:Te.id,edge:Te,hovering:Te.source.id===xe.nodeHoveringId||Te.target.id===xe.nodeHoveringId||xe.edgeHoveringId===Te.id,onClick:xe.onClick,onMouseEnter:xe.onMouseEnter,onMouseLeave:xe.onMouseLeave})))}),Ce=(0,s.memo)(function(xe){return s.createElement(s.Fragment,null,xe.edges.map((Te,Oe)=>{const ie=Te.source.id===xe.nodeHoveringId||Te.target.id===xe.nodeHoveringId||xe.edgeHoveringId===Te.id,Le=Te.mainStat||Te.secondaryStat;return ie&&Le&&s.createElement(p,{key:Te.id,edge:Te})}))});function Ae(Ie,xe){const{scale:Te,onStepDown:Oe,onStepUp:ie,ref:Le,isMax:Be,isMin:Ue}=xt(),{state:ue,ref:pe}=Ye({scale:Te,bounds:Ie,focus:xe}),{position:$e,isPanning:Se}=ue;return{zoomRef:Le,panRef:pe,position:$e,isPanning:Se,scale:Te,onStepDown:Oe,onStepUp:ie,isMaxZoom:Be,isMinZoom:Ue}}function ze(){const[Ie,xe]=(0,s.useState)(void 0),Te=(0,s.useCallback)(()=>xe(void 0),[xe]),[Oe,ie]=(0,s.useState)(void 0),Le=(0,s.useCallback)(()=>ie(void 0),[ie]);return{nodeHover:Ie,setNodeHover:xe,clearNodeHover:Te,edgeHover:Oe,setEdgeHover:ie,clearEdgeHover:Le}}},30097:(j,I,e)=>{"use strict";e.d(I,{Y:()=>i});var t=e(27702),n=e(11995);function i(s){return(0,t.useMemo)(()=>(0,n.E_)(s),[s])}},11995:(j,I,e)=>{"use strict";e.d(I,{E_:()=>x,Ee:()=>b,Ew:()=>h,F:()=>g,HB:()=>u,MP:()=>T,Tz:()=>P,dM:()=>r,lr:()=>d,uX:()=>S});var t=e(31832),n=e(12503),i=e(29241),s=e(93666);function r(O,B){const A=O.x2-O.x1,V=O.y2-O.y1,W=Math.sqrt(A*A+V*V),w=Math.max((W-B)/W,0),N=A*w,F=V*w,k=A-N,H=V-F,R=O.x1+k/2,_=O.y1+H/2;return{x1:R,y1:_,x2:R+N,y2:_+F}}function g(O){const B={...O,fields:O.fields.map(V=>({...V,name:V.name.toLowerCase()}))},A=new t.N(B);return{id:A.getFieldByName(n.z.id.toLowerCase()),title:A.getFieldByName(n.z.title.toLowerCase()),subTitle:A.getFieldByName(n.z.subTitle.toLowerCase()),mainStat:A.getFieldByName(n.z.mainStat.toLowerCase()),secondaryStat:A.getFieldByName(n.z.secondaryStat.toLowerCase()),arc:l(O,n.z.arc),details:l(O,n.z.detail),color:A.getFieldByName(n.z.color),icon:A.getFieldByName(n.z.icon)}}function d(O){const B={...O,fields:O.fields.map(V=>({...V,name:V.name.toLowerCase()}))},A=new t.N(B);return{id:A.getFieldByName(n.z.id.toLowerCase()),source:A.getFieldByName(n.z.source.toLowerCase()),target:A.getFieldByName(n.z.target.toLowerCase()),mainStat:A.getFieldByName(n.z.mainStat.toLowerCase()),secondaryStat:A.getFieldByName(n.z.secondaryStat.toLowerCase()),details:l(O,n.z.detail.toLowerCase())}}function l(O,B){return O.fields.filter(A=>A.name.match(new RegExp("^"+B)))}function u(O,B){if(!(B||O))return{nodes:[],edges:[]};if(O){const A=g(O);if(!A.id)throw new Error("id field is required for nodes data frame.");const V={};for(let w=0;w<A.id.values.length;w++){const N=A.id.values[w];V[N]=E(N,A,w)}let W=B?o(B,d(B)):[];for(const w of W)V[w.target].incoming++;return{nodes:Object.values(V),edges:W,legend:A.arc.map(w=>({color:w.config.color?.fixedColor??"",name:w.config.displayName||w.name}))}}else{B=B;const A={},V=d(B);let W=o(B,V);for(let N=0;N<W.length;N++){const F=W[N],{source:k,target:H}=p(V,N);A[H.id]=A[H.id]||H,A[k.id]=A[k.id]||k,m(V.mainStat)&&(A[H.id].mainStatNumeric=(A[H.id].mainStatNumeric??0)+V.mainStat.values[N]),m(V.secondaryStat)&&(A[H.id].secondaryStatNumeric=(A[H.id].secondaryStatNumeric??0)+V.secondaryStat.values[N]),A[F.target].incoming++}return{nodes:c(A,V),edges:W}}}function o(O,B){if(!B.id)throw new Error("id field is required for edges data frame.");return B.id.values.map((A,V)=>{const W=B.target?.values[V],w=B.source?.values[V];return{id:A,dataFrameRowIndex:V,source:w,target:W,mainStat:B.mainStat?h(B.mainStat.config,B.mainStat.values[V]):"",secondaryStat:B.secondaryStat?h(B.secondaryStat.config,B.secondaryStat.values[V]):""}})}function m(O){return O&&O.type===i.fS.number}function c(O,B){const A=[],V=[],W=m(B.secondaryStat)?{...B.secondaryStat,values:A}:void 0,w=m(B.mainStat)?{...B.mainStat,values:V}:void 0;return Object.values(O).map((N,F)=>{if(w||W){const k={...N};return w&&(k.mainStat=w,V.push(N.mainStatNumeric),k.dataFrameRowIndex=F),W&&(k.secondaryStat=W,A.push(N.secondaryStatNumeric),k.dataFrameRowIndex=F),k}return N})}function p(O,B){const A=O.target?.values[B],V=O.source?.values[B];return{target:f(A,B),source:f(V,B)}}function f(O,B){return{id:O,title:O,subTitle:"",dataFrameRowIndex:B,incoming:0,arcSections:[]}}function E(O,B,A){return{id:O,title:B.title?.values[A]||"",subTitle:B.subTitle?.values[A]||"",dataFrameRowIndex:A,incoming:0,mainStat:B.mainStat,secondaryStat:B.secondaryStat,arcSections:B.arc,color:B.color,icon:B.icon?.values[A]||""}}function h(O,B){if(typeof B=="string")return B;{const A=O.decimals||2;return Number.isFinite(B)?B.toFixed(A)+(O.unit?" "+O.unit:""):""}}function y(O){const B=D();for(let A=0;A<O;A++)B.add(v(A));return B}function v(O){return{id:O.toString(),title:`service:${O}`,subtitle:"service",arc__success:.5,arc__errors:.5,mainstat:.1,secondarystat:2,color:.5,icon:"database"}}function D(){const O={[NodeGraphDataFrameFieldNames.id]:{values:[],type:FieldType.string},[NodeGraphDataFrameFieldNames.title]:{values:[],type:FieldType.string},[NodeGraphDataFrameFieldNames.subTitle]:{values:[],type:FieldType.string},[NodeGraphDataFrameFieldNames.mainStat]:{values:[],type:FieldType.number},[NodeGraphDataFrameFieldNames.secondaryStat]:{values:[],type:FieldType.number},[NodeGraphDataFrameFieldNames.arc+"success"]:{values:[],type:FieldType.number,config:{color:{fixedColor:"green"}}},[NodeGraphDataFrameFieldNames.arc+"errors"]:{values:[],type:FieldType.number,config:{color:{fixedColor:"red"}}},[NodeGraphDataFrameFieldNames.color]:{values:[],type:FieldType.number,config:{color:{mode:"continuous-GrYlRd"}}},[NodeGraphDataFrameFieldNames.icon]:{values:[],type:FieldType.string}};return new MutableDataFrame({name:"nodes",fields:Object.keys(O).map(B=>({...O[B],name:B}))})}function a(O){const B=C();for(const A of O)B.add({id:A.source+"--"+A.target,...A});return B}function C(){const O={[NodeGraphDataFrameFieldNames.id]:{values:[],type:FieldType.string},[NodeGraphDataFrameFieldNames.source]:{values:[],type:FieldType.string},[NodeGraphDataFrameFieldNames.target]:{values:[],type:FieldType.string},[NodeGraphDataFrameFieldNames.mainStat]:{values:[],type:FieldType.number},[NodeGraphDataFrameFieldNames.secondaryStat]:{values:[],type:FieldType.number}};return new MutableDataFrame({name:"edges",fields:Object.keys(O).map(B=>({...O[B],name:B}))})}function P(O){if(O.length===0)return{top:0,right:0,bottom:0,left:0,center:{x:0,y:0}};const B=O.reduce((W,w)=>(w.x>W.right&&(W.right=w.x),w.x<W.left&&(W.left=w.x),w.y>W.bottom&&(W.bottom=w.y),w.y<W.top&&(W.top=w.y),W),{top:1/0,right:-1/0,bottom:-1/0,left:1/0}),A=B.top+(B.bottom-B.top)/2,V=B.left+(B.right-B.left)/2;return{...B,center:{x:V,y:A}}}function b(O,B){let A=O.filter(V=>!!(V.meta?.preferredVisualisationType==="nodeGraph"||V.name==="nodes"||V.name==="edges"||V.refId==="nodes"||V.refId==="edges"||new t.N(V).getFieldByName(n.z.id)));return B&&(A=M(A,B)),A}const M=(O,B)=>O.map(A=>{if(new t.N(A).getFieldByName(n.z.source.toLowerCase())){if(B?.edges?.mainStatUnit){const W=A.fields.find(w=>w.name.toLowerCase()===n.z.mainStat);W&&(W.config={...W.config,unit:B.edges.mainStatUnit})}if(B?.edges?.secondaryStatUnit){const W=A.fields.find(w=>w.name.toLowerCase()===n.z.secondaryStat);W&&(W.config={...W.config,unit:B.edges.secondaryStatUnit})}}else{if(B?.nodes?.mainStatUnit){const W=A.fields.find(w=>w.name.toLowerCase()===n.z.mainStat);W&&(W.config={...W.config,unit:B.nodes.mainStatUnit})}if(B?.nodes?.secondaryStatUnit){const W=A.fields.find(w=>w.name.toLowerCase()===n.z.secondaryStat);W&&(W.config={...W.config,unit:B.nodes.secondaryStatUnit})}if(B?.nodes?.arcs?.length)for(const W of B.nodes.arcs){const w=A.fields.find(N=>N.name.toLowerCase()===W.field);w&&W.color&&(w.config={...w.config,color:{fixedColor:W.color,mode:s.S.Fixed}})}}return A}),T=(O,B,A)=>{const V=B.find(W=>W.id===A);return V?[...new Set(O.filter(W=>V.source===W.id||V.target===W.id).map(W=>W.id))]:[]},S=(O,B,A)=>{const V=O.find(W=>W.id===A);if(V){const W=B.filter(w=>w.source===V.id||w.target===V.id);return[...new Set(W.flatMap(w=>O.filter(N=>w.source===N.id||w.target===N.id).map(N=>N.id)))]}return[]},x=O=>O.reduce((B,A)=>(A.fields.filter(W=>W.name==="source").length?B.edges.push(A):B.nodes.push(A),B),{edges:[],nodes:[]})},14035:(j,I,e)=>{"use strict";e.d(I,{h:()=>d,j:()=>g});var t=e(41199),n=e(66656),i=e(75578),s=e(95676),r=e(64167);function g(l,u=!0){const o=["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:o,defaultValue:!1}),l.addNumberInput({path:"reduceOptions.limit",name:"Limit",description:"Max number of rows to display",category:o,settings:{placeholder:"25",integer:!0,min:1,max:5e3},showIf:m=>m.reduceOptions.values===!0}),l.addCustomEditor({id:"reduceOptions.calcs",path:"reduceOptions.calcs",name:"Calculation",description:"Choose a reducer function / calculation",category:o,editor:t.S.get("stats-picker").editor,defaultValue:[n.gz.lastNotNull],showIf:m=>m.reduceOptions.values===!1}),u&&l.addSelect({path:"reduceOptions.fields",name:"Fields",description:"Select the fields that should be included in the panel",category:o,settings:{allowCustomValue:!0,options:[],getOptions:async m=>{const c=[{value:"",label:"Numeric Fields"},{value:"/.*/",label:"All Fields"}];if(m&&m.data)for(const p of m.data)for(const f of p.fields){const E=(0,i.CZ)(f,p,m.data),h=`/^${(0,s.GE)(E)}$/`;c.push({value:h,label:E})}return Promise.resolve(c)}},defaultValue:""})}function d(l,u){l.addRadio({path:"orientation",name:"Orientation",description:"Layout orientation",category:u,settings:{options:[{value:r.wm.Auto,label:"Auto"},{value:r.wm.Horizontal,label:"Horizontal"},{value:r.wm.Vertical,label:"Vertical"}]},defaultValue:r.wm.Auto})}},24830:(j,I,e)=>{"use strict";e.r(I),e.d(I,{plugin:()=>C});var t=e(97585),n=e(64167),i=e(77148),s=e(50250),r=e(93666);const g=(P,b,M)=>{const T=(0,s.ZH)(P,b,M);if(M.angular&&(b==="singlestat"||b==="grafana-singlestat-panel")){const S=M.angular;if(T.graphMode=n.IG.None,S.sparkline&&S.sparkline.show&&(T.graphMode=n.IG.Area),S.colorBackground)T.colorMode=n.pc.Background;else if(S.colorValue)T.colorMode=n.pc.Value;else if(T.colorMode=n.pc.None,S.sparkline?.lineColor&&T.graphMode===n.IG.Area){const x=P.fieldConfig??{};x.defaults.color={mode:r.S.Fixed,fixedColor:S.sparkline.lineColor},P.fieldConfig=x}S.valueName==="name"&&(T.textMode=n.jG.Name)}return T};var d=e(89949),l=e(27702),u=e(29241),o=e(91466),m=e(21708),c=e(50323),p=e(50741),f=e(44201),E=e(12308);class h extends l.PureComponent{constructor(){super(...arguments),this.renderComponent=(b,M)=>{const{timeRange:T,options:S}=this.props,{value:x,alignmentFactors:O,width:B,height:A,count:V,orientation:W}=b,{openMenu:w,targetClassName:N}=M;let F=x.sparkline;return F&&(F.timeRange=T),l.createElement(c.w6,{value:x.display,count:V,sparkline:F,colorMode:S.colorMode,graphMode:S.graphMode,justifyMode:S.justifyMode,textMode:this.getTextMode(),alignmentFactors:O,parentOrientation:W,text:S.text,width:B,height:A,theme:E.config.theme2,onClick:w,className:N})},this.renderValue=b=>{const{value:M}=b,{getLinks:T,hasLinks:S}=M;return S&&T?l.createElement(p.V,{links:T},x=>this.renderComponent(b,x)):this.renderComponent(b,{})},this.getValues=()=>{const{data:b,options:M,replaceVariables:T,fieldConfig:S,timeZone:x}=this.props;let O;for(let B of b.series)for(let A of B.fields){let{config:V}=A;if(A.type===u.fS.number){if(A.state?.range)continue;!O&&(!(0,d.isNumber)(V.min)||!(0,d.isNumber)(V.max))&&(O=(0,m.Xu)(b.series));const W=V.min??O.min,w=V.max??O.max;A.state=A.state??{},A.state.range={min:W,max:w,delta:w-W}}}return(0,o.nG)({fieldConfig:S,reduceOptions:M.reduceOptions,replaceVariables:T,theme:E.config.theme2,data:b.series,sparkline:M.graphMode!==n.IG.None,timeZone:x})}}getTextMode(){const{options:b,fieldConfig:M,title:T}=this.props;return b.textMode===n.jG.Auto&&(M.defaults.displayName||!T)?n.jG.ValueAndName:b.textMode}render(){const{height:b,options:M,width:T,data:S,renderCounter:x}=this.props;return l.createElement(f.Q,{getValues:this.getValues,getAlignmentFactors:o.sg,renderValue:this.renderValue,width:T,height:b,source:S,itemSpacing:3,renderCounter:x,autoGrid:!0,orientation:M.orientation})}}var y=e(14035);const v={colorMode:n.pc.Value,graphMode:n.IG.Area,justifyMode:n.ap.Auto,textMode:n.jG.Auto};var D=e(7641);class a{getSuggestionsForData(b){const{dataSummary:M}=b;if(!M.hasData)return;const T=b.getListAppender({name:D.y.Stat,pluginId:"stat",options:{},fieldConfig:{defaults:{unit:"short",custom:{}},overrides:[]},cardOptions:{previewModifier:S=>{S.options.reduceOptions.values&&(S.options.reduceOptions.limit=1)}}});M.hasStringField&&M.hasNumberField&&M.frameCount===1&&M.rowCountTotal<10&&(T.append({name:D.y.Stat,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"}}}),T.append({name:D.y.StatColoredBackground,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"},colorMode:n.pc.Background}})),M.stringFieldCount===1&&M.frameCount===1&&M.rowCountTotal<10&&M.fieldCount===1&&T.append({name:D.y.Stat,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"},colorMode:n.pc.None}}),M.hasNumberField&&M.hasTimeField&&(T.append({options:{reduceOptions:{values:!1,calcs:["lastNotNull"]}}}),T.append({name:D.y.StatColoredBackground,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},graphMode:n.IG.None,colorMode:n.pc.Background}}))}}const C=new t.c(h).useFieldConfig().setPanelOptions(P=>{const b=["Stat styles"];(0,y.j)(P),(0,y.h)(P,b),i.Z(P),P.addSelect({path:"textMode",name:"Text mode",description:"Control if name and value is displayed or just name",category:b,settings:{options:[{value:n.jG.Auto,label:"Auto"},{value:n.jG.Value,label:"Value"},{value:n.jG.ValueAndName,label:"Value and name"},{value:n.jG.Name,label:"Name"},{value:n.jG.None,label:"None"}]},defaultValue:v.textMode}),P.addSelect({path:"colorMode",name:"Color mode",defaultValue:n.pc.Value,category:b,settings:{options:[{value:n.pc.None,label:"None"},{value:n.pc.Value,label:"Value"},{value:n.pc.Background,label:"Background Gradient"},{value:n.pc.BackgroundSolid,label:"Background Solid"}]}}).addRadio({path:"graphMode",name:"Graph mode",description:"Stat panel graph / sparkline mode",category:b,defaultValue:v.graphMode,settings:{options:[{value:n.IG.None,label:"None"},{value:n.IG.Area,label:"Area"}]}}).addRadio({path:"justifyMode",name:"Text alignment",defaultValue:v.justifyMode,category:b,settings:{options:[{value:n.ap.Auto,label:"Auto"},{value:n.ap.Center,label:"Center"}]}})}).setNoPadding().setPanelChangeHandler(g).setSuggestionsSupplier(new a).setMigrationHandler(s.rD)},49183:(j,I,e)=>{"use strict";e.d(I,{M:()=>g});var t=e(27702),n=e(64022),i=e(40705),s=e(7632);const r=[{label:"Never",value:!1},{label:"Threshold",value:36e5}],g=({value:d,onChange:l,item:u})=>{const o=typeof d=="number";return r[1].value=o?d:36e5,t.createElement(n.Lh,null,t.createElement(i.S,{value:d,options:r,onChange:l}),o&&t.createElement(s.C,{value:d,onChange:l,inputPrefix:s.Z.GreaterThan,isTime:u.settings.isTime}))}},25236:(j,I,e)=>{"use strict";e.d(I,{j:()=>u});var t=e(27702),n=e(64022),i=e(40705),s=e(28580),r=e(67437);const g=[{label:"Solid",value:"solid"},{label:"Dash",value:"dash"},{label:"Dots",value:"dot"}],d=["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(m=>({label:m,value:m})),l=["0, 10","0, 20","0, 30","0, 40","0, 3, 3"].map(m=>({label:m,value:m})),u=({value:m,onChange:c})=>{const p=(0,t.useMemo)(()=>m?.fill==="dash"?d:l,[m]),f=(0,t.useMemo)(()=>{if(!m?.dash?.length)return p[0];const E=m.dash?.join(", "),h=p.find(y=>y.value===E);return h||{label:E,value:E}},[m,p]);return t.createElement(n.Lh,null,t.createElement(i.S,{value:m?.fill||"solid",options:g,onChange:E=>{let h;E==="dot"?h=o(l[0].value):E==="dash"&&(h=o(d[0].value)),c({...m,fill:E,dash:h})}}),m?.fill&&m?.fill!=="solid"&&t.createElement(t.Fragment,null,t.createElement(s.Ph,{allowCustomValue:!0,options:p,value:f,width:20,onChange:E=>{c({...m,dash:o(E.value??"")})},formatCreateLabel:E=>`Segments: ${o(E).join(", ")}`}),t.createElement("div",null,"\xA0",t.createElement("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"},t.createElement(r.h,{name:"question-circle",tooltip:"Help"})))))};function o(m){const c=[];for(const p of m.split(/(?:,| )+/)){const f=Number.parseInt(p,10);isNaN(f)||c.push(f)}return c}},7632:(j,I,e)=>{"use strict";e.d(I,{C:()=>r,Z:()=>s});var t=e(27702),n=e(76305),i=e(1128),s=(g=>(g.LessThan="lessthan",g.GreaterThan="greaterthan",g))(s||{});const r=({value:g,onChange:d,inputPrefix:l,isTime:u})=>{let o=n.secondsToHms(g/1e3);u||(o="10");const m=E=>{let h=!1;if(E)try{u&&n.isValidTimeSpan(E)?h=n.intervalToMs(E):h=Number(E)}catch(y){console.warn("ERROR",y)}d(h)},c=E=>{E.key==="Enter"&&m(E.currentTarget.value)},p=E=>{m(E.currentTarget.value)},f=l==="greaterthan"?t.createElement("div",null,">"):l==="lessthan"?t.createElement("div",null,"<"):null;return t.createElement(i.I,{autoFocus:!1,placeholder:"never",width:10,defaultValue:o,onKeyDown:c,onBlur:p,prefix:f,spellCheck:!1})}},95668:(j,I,e)=>{"use strict";e.d(I,{c:()=>g});var t=e(27702),n=e(64022),i=e(40705),s=e(7632);const r=[{label:"Never",value:!1},{label:"Always",value:!0},{label:"Threshold",value:36e5}],g=({value:d,onChange:l,item:u})=>{const o=typeof d=="number";return r[2].value=o?d:36e5,t.createElement(n.Lh,null,t.createElement(i.S,{value:d,options:r,onChange:l}),o&&t.createElement(s.C,{value:d,onChange:l,inputPrefix:s.Z.LessThan,isTime:u.settings.isTime}))}},62575:(j,I,e)=>{"use strict";e.d(I,{F:()=>i});var t=e(27702),n=e(28580);const i=({item:s,value:r,onChange:g,id:d})=>{const l=(0,t.useCallback)(u=>{g({mode:u.value})},[g]);return t.createElement(n.Ph,{inputId:d,value:r.mode,options:s.settings.options,onChange:l})}},2643:(j,I,e)=>{"use strict";e.d(I,{F:()=>h,r:()=>f});var t=e(25587),n=e(93666),i=e(29241),s=e(27001),r=e(64167),g=e(55219),d=e(8658),l=e(53387),u=e(56617),o=e(49183),m=e(25236),c=e(95668),p=e(62575);const f={drawStyle:r.l8.Line,lineInterpolation:r.KC.Linear,lineWidth:1,fillOpacity:0,gradientMode:r.FI.None,barAlignment:r.pu.Center,stacking:{mode:r.o0.None,group:"A"},axisGridShow:!0,axisCenteredZero:!1},E=["Graph styles"];function h(y,v=!0){return{standardOptions:{[t.qb.Color]:{settings:{byValueSupport:!0,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:n.S.PaletteClassic}}},useCustomConfig:D=>{D.addRadio({path:"drawStyle",name:"Style",category:E,defaultValue:y.drawStyle,settings:{options:g.q.drawStyle}}).addRadio({path:"lineInterpolation",name:"Line interpolation",category:E,defaultValue:y.lineInterpolation,settings:{options:g.q.lineInterpolation},showIf:a=>a.drawStyle===r.l8.Line}).addRadio({path:"barAlignment",name:"Bar alignment",category:E,defaultValue:y.barAlignment,settings:{options:g.q.barAlignment},showIf:a=>a.drawStyle===r.l8.Bars}).addSliderInput({path:"lineWidth",name:"Line width",category:E,defaultValue:y.lineWidth,settings:{min:0,max:10,step:1,ariaLabelForHandle:"Line width"},showIf:a=>a.drawStyle!==r.l8.Points}).addSliderInput({path:"fillOpacity",name:"Fill opacity",category:E,defaultValue:y.fillOpacity,settings:{min:0,max:100,step:1,ariaLabelForHandle:"Fill opacity"},showIf:a=>a.drawStyle!==r.l8.Points}).addRadio({path:"gradientMode",name:"Gradient mode",category:E,defaultValue:g.q.fillGradient[0].value,settings:{options:g.q.fillGradient},showIf:a=>a.drawStyle!==r.l8.Points}).addFieldNamePicker({path:"fillBelowTo",name:"Fill below to",category:E,hideFromDefaults:!0,settings:{filter:a=>a.type===i.fS.number}}).addCustomEditor({id:"lineStyle",path:"lineStyle",name:"Line style",category:E,showIf:a=>a.drawStyle===r.l8.Line,editor:m.j,override:m.j,process:s.kG,shouldApply:a=>a.type===i.fS.number}).addCustomEditor({id:"spanNulls",path:"spanNulls",name:"Connect null values",category:E,defaultValue:!1,editor:c.c,override:c.c,showIf:a=>a.drawStyle===r.l8.Line,shouldApply:a=>a.type!==i.fS.time,process:s.kG,settings:{isTime:v}}).addCustomEditor({id:"insertNulls",path:"insertNulls",name:"Disconnect values",category:E,defaultValue:!1,editor:o.M,override:o.M,showIf:a=>a.drawStyle===r.l8.Line,shouldApply:a=>a.type!==i.fS.time,process:s.kG,settings:{isTime:v}}).addRadio({path:"showPoints",name:"Show points",category:E,defaultValue:g.q.showPoints[0].value,settings:{options:g.q.showPoints},showIf:a=>a.drawStyle!==r.l8.Points}).addSliderInput({path:"pointSize",name:"Point size",category:E,defaultValue:5,settings:{min:1,max:40,step:1,ariaLabelForHandle:"Point size"},showIf:a=>a.showPoints!==r.Jp.Never||a.drawStyle===r.l8.Points}),d.V(D,y.stacking,E),D.addSelect({category:E,name:"Transform",path:"transform",settings:{options:[{label:"Constant",value:r.pR.Constant,description:"The first value will be shown as a constant line"},{label:"Negative Y",value:r.pR.NegativeY,description:"Flip the results to negative values on the y axis"}],isClearable:!0},hideFromDefaults:!0}),l.r(D,y),u.B(D),D.addCustomEditor({id:"thresholdsStyle",path:"thresholdsStyle",name:"Show thresholds",category:["Thresholds"],defaultValue:{mode:r.i3.Off},settings:{options:g.q.thresholdsDisplayModes},editor:p.F,override:p.F,process:s.kG,shouldApply:()=>!0})}}}},44548:()=>{"use strict";let j=window.matchMedia;window.matchMedia=I=>{let e=j(I);return e.addEventListener||(e.addEventListener=(t,n)=>{e.addListener(n)},e.removeEventListener=(t,n)=>{e.removeListener(n)}),e}},84749:(j,I,e)=>{"use strict";e.d(I,{PQ:()=>i,WI:()=>r,h:()=>n,y0:()=>s});var t=e(1941);let n;function i(g){n=g}function s(){return!n||!n.getState?{templating:{...t.qM,lastKey:"key"}}:n.getState()}function r(g){if(!(!n||!n.getState))return n.dispatch(g)}},43533:(j,I,e)=>{"use strict";e.d(I,{B5:()=>t.B,BL:()=>u,V5:()=>i,bf:()=>s,eL:()=>m,hw:()=>n,n8:()=>r,pC:()=>d,vT:()=>o});var t=e(50686),n=(c=>(c[c.Admin=4]="Admin",c[c.Editor=2]="Editor",c[c.Member=0]="Member",c[c.Viewer=1]="Viewer",c))(n||{}),i=(c=>(c[c.View=1]="View",c[c.Edit=2]="Edit",c[c.Admin=4]="Admin",c))(i||{}),s=(c=>(c.View="View",c.Edit="Edit",c.Admin="Admin",c))(s||{}),r=(c=>(c.Folder="dash-folder",c.Dashboard="dash-db",c.AlertFolder="dash-folder-alerting",c))(r||{}),g=(c=>(c[c.Query=1]="Query",c[c.Admin=2]="Admin",c))(g||{}),d=(c=>(c.Team="Team",c.User="User",c.Viewer="Viewer",c.Editor="Editor",c))(d||{});const l=[{value:1,label:"Query",description:"Can query data source."}],u=[{value:"Team",label:"Team"},{value:"User",label:"User"},{value:"Viewer",label:"Everyone With Viewer Role"},{value:"Editor",label:"Everyone With Editor Role"}],o=[{value:1,label:"View",description:"Can view dashboards."},{value:2,label:"Edit",description:"Can add, edit and delete dashboards."},{value:4,label:"Admin",description:"Can add/remove permissions and can add, edit and delete dashboards."}],m=[{value:0,label:"Member",description:"Is team member"},{value:4,label:"Admin",description:"Can add/remove permissions, members and delete team."}]},26938:()=>{"use strict"},72495:()=>{"use strict"},23006:()=>{"use strict"},84396:()=>{"use strict"},43620:(j,I,e)=>{"use strict";e.d(I,{Dn:()=>P,Eb:()=>D,GL:()=>d,GT:()=>p,Im:()=>h,Jd:()=>M,OW:()=>b,QI:()=>v,Qt:()=>y,RB:()=>S,VJ:()=>C,Wj:()=>o,Xw:()=>u,Yr:()=>O,_B:()=>m,_z:()=>f,hS:()=>c,le:()=>a,nq:()=>r,p8:()=>E,pO:()=>l,xF:()=>x,xt:()=>g,z:()=>T});var t=e(74817),n=e(96509);const i=(0,t.X)("ds-request-response"),s=(0,t.X)("ds-request-error"),r=(0,t.X)("template-variable-value-updated"),g=(0,t.X)("graph-click"),d=(0,t.X)("threshold-changed");class l extends n.m{}l.type="panel-queries-changed";class u extends n.m{}u.type="panel-transformations-changed";class o extends n.m{}o.type="panels-options-changed";class m extends n.m{}m.type="dashboard-panels-changed";class c extends n.m{}c.type="dashboard-meta-changed";class p extends n.m{}p.type="panel-directive-ready";class f extends n.m{}f.type="render";class E extends n.R{}E.type="zoom-out";var h=(B=>(B[B.Left=-1]="Left",B[B.Right=1]="Right",B))(h||{});class y extends n.R{}y.type="shift-time";class v extends n.R{}v.type="absolute-time";class D extends n.R{}D.type="remove-panel";class a extends n.R{}a.type="show-modal";class C extends n.R{}C.type="show-confirm-modal";class P extends n.R{}P.type="show-react-modal";class b extends n.m{}b.type="hide-modal";class M extends n.m{}M.type="dashboard-saved";class T extends n.R{}T.type="annotation-query-started";class S extends n.R{}S.type="annotation-query-finished";class x extends n.R{}x.type="panel-edit-started";class O extends n.R{}O.type="panel-edit-finished"},21784:(j,I,e)=>{"use strict";e.d(I,{f0:()=>t,zN:()=>i,zQ:()=>n});const t=["lines","bars","points","stacked_lines","stacked_bars"];var n=(s=>(s.table="table",s.raw="raw",s))(n||{});const i=["table","raw"]},45151:()=>{"use strict"},18771:(j,I,e)=>{"use strict";e.d(I,{AccessControlAction:()=>P,AppNotificationSeverity:()=>f,AppNotificationTimeout:()=>E,CoreEvents:()=>b,DashboardInitPhase:()=>r,DashboardRoutes:()=>s,EXPLORE_GRAPH_STYLES:()=>y.f0,KioskMode:()=>g,OrgRole:()=>d.B5,PermissionLevelString:()=>d.bf,SearchQueryType:()=>d.n8,ServiceAccountStateFilter:()=>o,TABLE_RESULTS_STYLE:()=>y.zQ,TeamPermissionLevel:()=>d.hw,addListener:()=>v.NH,createAsyncThunk:()=>v.hg,teamsPermissionLevels:()=>d.eL,timeoutMap:()=>h,useDispatch:()=>v.I0,useSelector:()=>v.v9});var t=e(26938),n=e(73371),i=e(45151),s=(M=>(M.Home="home-dashboard",M.New="new-dashboard",M.Normal="normal-dashboard",M.Path="path-dashboard",M.Scripted="scripted-dashboard",M.Public="public-dashboard",M.Embedded="embedded-dashboard",M))(s||{}),r=(M=>(M.NotStarted="Not started",M.Fetching="Fetching",M.Services="Services",M.Failed="Failed",M.Completed="Completed",M))(r||{}),g=(M=>(M.TV="tv",M.Full="full",M))(g||{}),d=e(43533),l=e(72495),u=e(40133),o=(M=>(M.All="All",M.WithExpiredTokens="WithExpiredTokens",M.Disabled="Disabled",M))(o||{}),m=e(84396),c=e(57597),p=e(73738),f=(M=>(M.Success="success",M.Warning="warning",M.Error="error",M.Info="info",M))(f||{}),E=(M=>(M[M.Success=3e3]="Success",M[M.Warning=5e3]="Warning",M[M.Error=7e3]="Error",M))(E||{});const h={success:3e3,warning:5e3,error:7e3,info:3e3};var y=e(21784),v=e(29891),D=e(76622),a=e(23006),C=e(73866),P=(M=>(M.UsersRead="users:read",M.UsersWrite="users:write",M.UsersAuthTokenList="users.authtoken:read",M.UsersAuthTokenUpdate="users.authtoken:write",M.UsersPasswordUpdate="users.password:write",M.UsersDelete="users:delete",M.UsersCreate="users:create",M.UsersEnable="users:enable",M.UsersDisable="users:disable",M.UsersPermissionsUpdate="users.permissions:write",M.UsersLogout="users:logout",M.UsersQuotasList="users.quotas:read",M.UsersQuotasUpdate="users.quotas:write",M.ServiceAccountsRead="serviceaccounts:read",M.ServiceAccountsCreate="serviceaccounts:create",M.ServiceAccountsWrite="serviceaccounts:write",M.ServiceAccountsDelete="serviceaccounts:delete",M.ServiceAccountsPermissionsRead="serviceaccounts.permissions:read",M.ServiceAccountsPermissionsWrite="serviceaccounts.permissions:write",M.OrgsRead="orgs:read",M.OrgsPreferencesRead="orgs.preferences:read",M.OrgsWrite="orgs:write",M.OrgsPreferencesWrite="orgs.preferences:write",M.OrgsCreate="orgs:create",M.OrgsDelete="orgs:delete",M.OrgUsersRead="org.users:read",M.OrgUsersAdd="org.users:add",M.OrgUsersRemove="org.users:remove",M.OrgUsersWrite="org.users:write",M.LDAPUsersRead="ldap.user:read",M.LDAPUsersSync="ldap.user:sync",M.LDAPStatusRead="ldap.status:read",M.DataSourcesExplore="datasources:explore",M.DataSourcesRead="datasources:read",M.DataSourcesCreate="datasources:create",M.DataSourcesWrite="datasources:write",M.DataSourcesDelete="datasources:delete",M.DataSourcesPermissionsRead="datasources.permissions:read",M.DataSourcesCachingRead="datasources.caching:read",M.DataSourcesInsightsRead="datasources.insights:read",M.ActionServerStatsRead="server.stats:read",M.ActionTeamsCreate="teams:create",M.ActionTeamsDelete="teams:delete",M.ActionTeamsRead="teams:read",M.ActionTeamsWrite="teams:write",M.ActionTeamsPermissionsRead="teams.permissions:read",M.ActionTeamsPermissionsWrite="teams.permissions:write",M.ActionRolesList="roles:read",M.ActionTeamsRolesList="teams.roles:read",M.ActionTeamsRolesAdd="teams.roles:add",M.ActionTeamsRolesRemove="teams.roles:remove",M.ActionUserRolesList="users.roles:read",M.ActionUserRolesAdd="users.roles:add",M.ActionUserRolesRemove="users.roles:remove",M.DashboardsRead="dashboards:read",M.DashboardsWrite="dashboards:write",M.DashboardsDelete="dashboards:delete",M.DashboardsCreate="dashboards:create",M.DashboardsPermissionsRead="dashboards.permissions:read",M.DashboardsPermissionsWrite="dashboards.permissions:write",M.DashboardsPublicWrite="dashboards.public:write",M.FoldersRead="folders:read",M.FoldersWrite="folders:write",M.FoldersDelete="folders:delete",M.FoldersCreate="folders:create",M.FoldersPermissionsRead="folders.permissions:read",M.FoldersPermissionsWrite="folders.permissions:write",M.ActionSupportBundlesCreate="support.bundles:create",M.ActionSupportBundlesRead="support.bundles:read",M.ActionSupportBundlesDelete="support.bundles:delete",M.AlertingRuleCreate="alert.rules:create",M.AlertingRuleRead="alert.rules:read",M.AlertingRuleUpdate="alert.rules:write",M.AlertingRuleDelete="alert.rules:delete",M.AlertingInstanceCreate="alert.instances:create",M.AlertingInstanceUpdate="alert.instances:write",M.AlertingInstanceRead="alert.instances:read",M.AlertingNotificationsRead="alert.notifications:read",M.AlertingNotificationsWrite="alert.notifications:write",M.AlertingRuleExternalWrite="alert.rules.external:write",M.AlertingRuleExternalRead="alert.rules.external:read",M.AlertingInstancesExternalWrite="alert.instances.external:write",M.AlertingInstancesExternalRead="alert.instances.external:read",M.AlertingNotificationsExternalWrite="alert.notifications.external:write",M.AlertingNotificationsExternalRead="alert.notifications.external:read",M.AlertingProvisioningRead="alert.provisioning:read",M.AlertingProvisioningWrite="alert.provisioning:write",M.ActionAPIKeysRead="apikeys:read",M.ActionAPIKeysCreate="apikeys:create",M.ActionAPIKeysDelete="apikeys:delete",M.PluginsInstall="plugins:install",M.PluginsWrite="plugins:write",M.SettingsRead="settings:read",M.SettingsWrite="settings:write",M))(P||{}),b=e(43620)},76622:()=>{"use strict"},73371:()=>{"use strict"},73738:()=>{"use strict"},57597:()=>{"use strict"},73866:()=>{"use strict"},29891:(j,I,e)=>{"use strict";e.d(I,{I0:()=>i,NH:()=>g,hg:()=>r,v9:()=>s});var t=e(34099),n=e(27173);const i=n.useDispatch,s=n.useSelector,r=(d,l,u)=>(0,t.hg)(d,l,u),g=t.NH},7641:(j,I,e)=>{"use strict";e.d(I,{y:()=>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.StatColoredBackground="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))(t||{})},18447:(j,I,e)=>{"use strict";e.d(I,{ED:()=>g,I9:()=>i,T8:()=>l,Yb:()=>s,bj:()=>n,g0:()=>u,pz:()=>d,x_:()=>t});var t=(o=>(o.Firing="firing",o.Inactive="inactive",o.Pending="pending",o))(t||{}),n=(o=>(o.Normal="Normal",o.Alerting="Alerting",o.Pending="Pending",o.NoData="NoData",o.Error="Error",o))(n||{});function i(o){return Object.values(t).includes(o)}function s(o){return Object.values(n).some(m=>m===o)}function r(o){return o!==null&&typeof o<"u"&&!Object.values(t).includes(o)}function g(o){return r(o)?o.split(" ")[0]:o}var d=(o=>(o.Alerting="alerting",o.Recording="recording",o))(d||{}),l=(o=>(o.Cortex="Cortex",o.Mimir="Mimir",o.Prometheus="Prometheus",o.Thanos="Thanos",o))(l||{}),u=(o=>(o.Alerting="Alerting",o.NoData="NoData",o.KeepLastState="KeepLastState",o.OK="OK",o.Error="Error",o))(u||{})},68093:(j,I,e)=>{"use strict";e.d(I,{P:()=>s,j:()=>n});var t=e(18447);function n(r,g){return(0,t.ED)(r.state)===g}var i=(r=>(r.Firing="firing",r))(i||{}),s=(r=>(r.Alerting="alerting",r.Pending="pending",r.Normal="inactive",r.NoData="nodata",r.Error="error",r))(s||{})},40133:()=>{"use strict"},23932:j=>{const I=" ";function e(s){let r="";return s&&Object.keys(s).forEach(function(g){r+=g+":"+s[g]+";"}),r}function t(s){function r(d){return'class="'+d+'"'}function g(d){return'style="'+e(s["."+d])+'"'}return s?g:r}function n(s){return s===null?"null":Array.isArray(s)?"array":typeof s=="string"&&/^https?:/.test(s)?"link":typeof s=="object"&&typeof s.toISOString=="function"?"date":typeof s}function i(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}j.exports=function(s,r){let g="";const d=t(r);let l=function(o,m,c,p){if(!o.length)return m+" "+c;let f=m+` `;return g+=I,o.forEach(function(E,h){f+=g+p(E)+(h<o.length-1?",":"")+` `}),g=g.slice(0,-I.length),f+g+c};function u(o){if(o===void 0)return"";switch(n(o)){case"boolean":return"<span "+d("json-markup-bool")+">"+o+"</span>";case"number":return"<span "+d("json-markup-number")+">"+o+"</span>";case"date":return'<span class="json-markup-string">"'+i(o.toISOString())+'"</span>';case"null":return"<span "+d("json-markup-null")+">null</span>";case"string":return"<span "+d("json-markup-string")+'>"'+i(o.replace(/\n/g,` `+g))+'"</span>';case"link":return"<span "+d("json-markup-string")+'>"<a href="'+encodeURI(o)+'">'+i(o)+'</a>"</span>';case"array":return l(o,"[","]",u);case"object":const m=Object.keys(o).filter(function(c){return o[c]!==void 0});return l(m,"{","}",function(c){return"<span "+d("json-markup-key")+'>"'+i(c)+'":</span> '+u(o[c])})}return""}return"<div "+d("json-markup")+">"+u(s)+"</div>"}},26189:()=>{(function(j){var I={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(g){if(!g)n.x=-1;else{var d=t.p2c(g);n.x=Math.max(0,Math.min(d.left,t.width())),n.y=Math.max(0,Math.min(d.top,t.height()))}t.triggerRedrawOverlay()},t.clearCrosshair=t.setCrosshair,t.lockCrosshair=function(g){g&&t.setCrosshair(g),n.locked=!0},t.unlockCrosshair=function(){n.locked=!1};function i(r){n.locked||n.x!=-1&&(n.x=-1,t.triggerRedrawOverlay())}function s(r){if(!n.locked){if(t.getSelection&&t.getSelection()){n.x=-1;return}var g=t.offset();n.x=Math.max(0,Math.min(r.pageX-g.left,t.width())),n.y=Math.max(0,Math.min(r.pageY-g.top,t.height())),t.triggerRedrawOverlay()}}t.hooks.bindEvents.push(function(r,g){r.getOptions().crosshair.mode&&(g.mouseout(i),g.mousemove(s))}),t.hooks.drawOverlay.push(function(r,g){var d=r.getOptions().crosshair;if(d.mode){var l=r.getPlotOffset();if(g.save(),g.translate(l.left,l.top),n.x!=-1){var u=r.getOptions().crosshair.lineWidth%2?.5:0;if(g.strokeStyle=d.color,g.lineWidth=d.lineWidth,g.lineJoin="round",g.beginPath(),d.mode.indexOf("x")!=-1){var o=Math.floor(n.x)+u;g.moveTo(o,0),g.lineTo(o,r.height())}if(d.mode.indexOf("y")!=-1){var m=Math.floor(n.y)+u;g.moveTo(0,m),g.lineTo(r.width(),m)}g.stroke()}g.restore()}}),t.hooks.shutdown.push(function(r,g){g.unbind("mouseout",i),g.unbind("mousemove",s)})}j.plot.plugins.push({init:e,options:I,name:"crosshair",version:"1.0"})})(jQuery)},47825:()=>{(function(j){function I(e){e.hooks.processDatapoints.push(function(t,n,i){n.dashes.show&&t.hooks.draw.push(function(s,r){var g=s.getPlotOffset(),d=n.xaxis,l=n.yaxis;function u(p,f){var E=i.points,h=i.pointsize,y=null,v=null,D=0,a=!0,C,P;n.dashes.dashLength[0]?(C=n.dashes.dashLength[0],n.dashes.dashLength[1]?P=n.dashes.dashLength[1]:P=C):P=C=n.dashes.dashLength,r.beginPath();for(var b=h;b<E.length;b+=h){let N=function(F){var k=Math.sqrt(Math.pow(A-O,2)+Math.pow(V-B,2));if(k<=F)return{deltaX:A-O,deltaY:V-B,distance:k,remainder:F-k};var H=A>O?1:-1,R=V>B?1:-1;return{deltaX:H*Math.sqrt(Math.pow(F,2)/(1+Math.pow((V-B)/(A-O),2))),deltaY:R*Math.sqrt(Math.pow(F,2)-Math.pow(F,2)/(1+Math.pow((V-B)/(A-O),2))),distance:F,remainder:0}};var w=N,M=E[b-h],T=E[b-h+1],S=E[b],x=E[b+1];if(!(M==null||S==null)){if(T<=x&&T<l.min){if(x<l.min)continue;M=(l.min-T)/(x-T)*(S-M)+M,T=l.min}else if(x<=T&&x<l.min){if(T<l.min)continue;S=(l.min-T)/(x-T)*(S-M)+M,x=l.min}if(T>=x&&T>l.max){if(x>l.max)continue;M=(l.max-T)/(x-T)*(S-M)+M,T=l.max}else if(x>=T&&x>l.max){if(T>l.max)continue;S=(l.max-T)/(x-T)*(S-M)+M,x=l.max}if(M<=S&&M<d.min){if(S<d.min)continue;T=(d.min-M)/(S-M)*(x-T)+T,M=d.min}else if(S<=M&&S<d.min){if(M<d.min)continue;x=(d.min-M)/(S-M)*(x-T)+T,S=d.min}if(M>=S&&M>d.max){if(S>d.max)continue;T=(d.max-M)/(S-M)*(x-T)+T,M=d.max}else if(S>=M&&S>d.max){if(M>d.max)continue;x=(d.max-M)/(S-M)*(x-T)+T,S=d.max}(M!=y||T!=v)&&r.moveTo(d.p2c(M)+p,l.p2c(T)+f);var O=d.p2c(M)+p,B=l.p2c(T)+f,A=d.p2c(S)+p,V=l.p2c(x)+f,W;do W=N(D>0?D:a?C:P),(W.deltaX!=0||W.deltaY!=0)&&(a?r.lineTo(O+W.deltaX,B+W.deltaY):r.moveTo(O+W.deltaX,B+W.deltaY)),a=!a,D=W.remainder,O+=W.deltaX,B+=W.deltaY;while(W.distance>0);y=S,v=x}}r.stroke()}r.save(),r.translate(g.left,g.top),r.lineJoin="round";var o=n.dashes.lineWidth,m=n.shadowSize;if(o>0&&m>0){r.lineWidth=m,r.strokeStyle="rgba(0,0,0,0.1)";var c=Math.PI/18;u(Math.sin(c)*(o/2+m/2),Math.cos(c)*(o/2+m/2)),r.lineWidth=m/2,u(Math.sin(c)*(o/2+m/4),Math.cos(c)*(o/2+m/4))}r.lineWidth=o,r.strokeStyle=n.color,o>0&&u(0,0),r.restore()})})}j.plot.plugins.push({init:I,options:{series:{dashes:{show:!1,lineWidth:2,dashLength:10}}},name:"dashes",version:"0.1"})})(jQuery)},28844:()=>{(function(j){"use strict";var I={series:{fillBelowTo:null}};function e(t){function n(r,g){var d;for(d=0;d<g.length;++d)if(g[d].id===r.fillBelowTo)return g[d];return null}function i(r,g,d,l,u,o,m,c){var p,f,E,h,y,v;return p=d-r,f=l-g,E=m-u,h=c-o,y=(-f*(r-u)+p*(g-o))/(-E*f+p*h),v=(E*(g-o)-h*(r-u))/(-E*f+p*h),y>=0&&y<=1&&v>=0&&v<=1?[r+v*p,g+v*f]:null}function s(r,g,d){if(d.fillBelowTo===null)return;var l,u,o,m,c,p,f;function E(P,b){g.beginPath(),g.moveTo(d.xaxis.p2c(P)+p.left,d.yaxis.p2c(b)+p.top)}function h(){g.closePath(),g.fill()}function y(){if(o.length/u!==c.length/m)return console.error("Refusing to graph inconsistent number of points"),!1;var P;for(P=0;P<o.length/u;P++)if(o[P*u]!==null&&c[P*m]!==null&&o[P*u]!==c[P*m])return console.error("Refusing to graph points without matching value"),!1;return!0}function v(P,b){console.assert(b>P,"expects the end index to be greater than the start index");var M=P===0||o[P-1]===null||c[P-1]===null,T=!1,S,x;for(S=P;S<b;S++)if(o[S*u+1]===null||c[S*u+1]===null)T=!1,M=!0;else if(o[S*u+1]===c[S*m+1])T=!0,M=!1;else if(o[S*u+1]>c[S*m+1]){M?E(o[S*u],o[S*u+1]):T?E(o[(S-1)*u],o[(S-1)*u+1]):(x=D(S),E(x[0],x[1])),C(S,b);return}else M=!1,T=!1}function D(P){console.assert(P>0,"expects the second point in the series line segment");var b,M;for(b=1;b<c.length/m;b++)if(M=i(o[(P-1)*u],o[(P-1)*u+1],o[P*u],o[P*u+1],c[(b-1)*m],c[(b-1)*m+1],c[b*m],c[b*m+1]),M!==null)return M;console.error("intersectionPoint() should only be called when an intersection happens")}function a(P,b){console.assert(P>=b,"the start should be the rightmost point, and the end should be the leftmost (excluding the equal or intersecting point)");var M;for(M=P;M>=b;M--)g.lineTo(l.xaxis.p2c(c[M*m])+p.left,l.yaxis.p2c(c[M*m+1])+p.top);h()}function C(P,b){console.assert(P<=b,"the start should be the rightmost point, and the end should be the leftmost (excluding the equal or intersecting point)");var M,T;for(M=P;M<b;M++)if(o[M*u+1]===null&&M>P){a(M-1,P),v(M,b);return}else if(o[M*u+1]===c[M*m+1]){a(M,P),v(M,b);return}else if(o[M*u+1]<c[M*m+1]){T=D(M),g.lineTo(d.xaxis.p2c(T[0])+p.left,d.yaxis.p2c(T[1])+p.top),a(M,P),v(M,b);return}else g.lineTo(d.xaxis.p2c(o[M*u])+p.left,d.yaxis.p2c(o[M*u+1])+p.top);a(b,P)}l=n(d,r.getData()),l&&(u=d.datapoints.pointsize,o=d.datapoints.points,m=l.datapoints.pointsize,c=l.datapoints.points,p=r.getPlotOffset(),y()&&(f=j.color.parse(d.color),f.a=.4,f.normalize(),g.fillStyle=f.toString(),v(0,o.length/u)))}t.hooks.drawSeries.push(s)}j.plot.plugins.push({init:e,options:I,name:"fillbelow",version:"0.1.0"})})(jQuery)},7540:()=>{/*! * jquery.flot.gauge v1.1.0 * * * Flot plugin for rendering gauge charts. * * Copyright (c) 2015 @toyoty99. * Licensed under the MIT license. */(function(j){var I=function(){var d,l,u,o,m,c,p=function(P,b){d=b,l=P.getPlaceholder(),u=P.getOptions(),o=u.series.gauges,m=P.getData(),c=e(o.debug)};p.prototype.calculateLayout=function(){var P=l.width(),b=l.height(),M=Math.min(m.length,o.layout.columns),T=Math.ceil(m.length/M),S=o.layout.margin,x=o.layout.hMargin,O=o.layout.vMargin,B=(P-S*2-x*(M-1))/M,A=(b-S*2-O*(T-1))/T;if(o.layout.square){var V=Math.min(B,A);B=V,A=V}f(o,B);var W=o.cell.margin,w=0,N=0;o.label.show&&(w=o.label.margin,N=o.label.font.size);var F=0,k=0;o.value.show&&(F=o.value.margin,k=o.value.font.size);var H=0;o.threshold.show&&(H=o.threshold.width);var R=0,_=0;o.threshold.label.show&&(R=o.threshold.label.margin,_=o.threshold.label.font.size);for(var G=B/2-W-H-R*2-_,Y=o.gauge.startAngle,X=o.gauge.endAngle,Q=(X-Y)/100,se=-1,Z=Y;Z<X;Z+=Q)se=Math.max(se,Math.sin(i(Z)));se=Math.max(se,Math.sin(i(X)));var le=(A-W*2-w*2-N)/(1+se);le*se<F+k/2&&(le=A-W*2-w*2-N-F-k/2);var oe=le-R*2-_-H,q=Math.min(G,oe),ne=o.gauge.width;ne>=q&&(ne=Math.max(3,q/3));var ge=R*2+_+H+q,ae=Math.max(ge*(1+se),ge+F+k/2);return{canvasWidth:P,canvasHeight:b,margin:S,hMargin:x,vMargin:O,columns:M,rows:T,cellWidth:B,cellHeight:A,cellMargin:W,labelMargin:w,labelFontSize:N,valueMargin:F,valueFontSize:k,width:ne,radius:q,thresholdWidth:H,thresholdLabelMargin:R,thresholdLabelFontSize:_,gaugeOuterHeight:ae}};function f(P,b){P.gauge.width==="auto"&&(P.gauge.width=Math.max(5,b/8)),P.label.margin==="auto"&&(P.label.margin=Math.max(1,b/20)),P.label.font.size==="auto"&&(P.label.font.size=Math.max(5,b/8)),P.value.margin==="auto"&&(P.value.margin=Math.max(1,b/30)),P.value.font.size==="auto"&&(P.value.font.size=Math.max(5,b/9)),P.threshold.width==="auto"&&(P.threshold.width=Math.max(3,b/100)),P.threshold.label.margin==="auto"&&(P.threshold.label.margin=Math.max(3,b/40)),P.threshold.label.font.size==="auto"&&(P.threshold.label.font.size=Math.max(5,b/15))}p.prototype.calculateAutoValues=f,p.prototype.calculateCellLayout=function(P,b,M){var T=t(b.columns,M),S=n(b.columns,M),x=b.margin+(b.cellWidth+b.hMargin)*T,O=b.margin+(b.cellHeight+b.vMargin)*S,B=x+b.cellWidth/2,A=O+b.cellMargin+b.labelMargin*2+b.labelFontSize+b.thresholdWidth+b.thresholdLabelFontSize+b.thresholdLabelMargin*2+b.radius,V=b.cellHeight-b.cellMargin*2-b.labelMargin*2-b.labelFontSize-b.gaugeOuterHeight,W=0;return P.cell.vAlign==="middle"?W=V/2:P.cell.vAlign==="bottom"&&(W=V),A+=W,{col:T,row:S,x,y:O,offsetY:W,cellWidth:b.cellWidth,cellHeight:b.cellHeight,cellMargin:b.cellMargin,cx:B,cy:A}},p.prototype.drawBackground=function(P){o.frame.show&&(d.save(),d.strokeStyle=u.grid.borderColor,d.lineWidth=u.grid.borderWidth,d.strokeRect(0,0,P.canvasWidth,P.canvasHeight),u.grid.backgroundColor&&(d.fillStyle=u.grid.backgroundColor,d.fillRect(0,0,P.canvasWidth,P.canvasHeight)),d.restore())},p.prototype.drawCellBackground=function(P,b){d.save(),P.cell.border&&P.cell.border.show&&P.cell.border.color&&P.cell.border.width&&(d.strokeStyle=P.cell.border.color,d.lineWidth=P.cell.border.width,d.strokeRect(b.x,b.y,b.cellWidth,b.cellHeight)),P.cell.background&&P.cell.background.color&&(d.fillStyle=P.cell.background.color,d.fillRect(b.x,b.y,b.cellWidth,b.cellHeight)),d.restore()},p.prototype.drawGauge=function(P,b,M,T,S){var x=P.gauge.shadow.show?P.gauge.shadow.blur:0,O=y(P,S),B=E(P,b,S);D(M.cx,M.cy,b.radius,b.width,i(P.gauge.startAngle),i(P.gauge.endAngle),P.gauge.border.color,P.gauge.border.width,P.gauge.background.color,x),D(M.cx,M.cy,b.radius-1,b.width-2,i(B.a1),i(B.a2),O,1,O,x),P.gauge.neutralValue!=null&&h(P,b,M,O)};function E(P,b,M){let T={};var S=P.gauge.neutralValue;return S!=null?M<S?(T.a1=v(P,b,M),T.a2=v(P,b,S)):(T.a1=v(P,b,S),T.a2=v(P,b,M)):(T.a1=P.gauge.startAngle,T.a2=v(P,b,M)),T}function h(P,b,M,T){var S=(P.gauge.max-P.gauge.min)/600;s(d,M.cx,M.cy,b.radius-2,b.width-4,i(v(P,b,P.gauge.neutralValue-S)),i(v(P,b,P.gauge.neutralValue+S)),T,2,P.gauge.background.color)}function y(P,b){for(var M,T=0;T<P.threshold.values.length;T++){var S=P.threshold.values[T];if(M=S.color,b<S.value)break}return M}function v(P,b,M){var T=P.gauge.startAngle+(P.gauge.endAngle-P.gauge.startAngle)*((M-P.gauge.min)/(P.gauge.max-P.gauge.min));return T<P.gauge.startAngle?T=P.gauge.startAngle:T>P.gauge.endAngle&&(T=P.gauge.endAngle),T}p.prototype.drawThreshold=function(P,b,M){for(var T=P.gauge.startAngle,S=0;S<P.threshold.values.length;S++){var x=P.threshold.values[S];c1=x.color,a2=v(P,b,x.value),s(d,M.cx,M.cy,b.radius+b.thresholdWidth,b.thresholdWidth-2,i(T),i(a2),c1,1,c1),T=a2}};function D(P,b,M,T,S,x,O,B,A,V){S!==x&&(d.save(),s(d,P,b,M,T,S,x,O,B,A),V&&(s(d,P,b,M,T,S,x),d.clip(),d.shadowOffsetX=0,d.shadowOffsetY=0,d.shadowBlur=10,d.shadowColor="gray",s(d,P,b,M+1,T+2,S,x,O,1)),d.restore())}p.prototype.drawLable=function(P,b,M,T,S){C(M.cx,M.y+M.cellMargin+b.labelMargin+M.offsetY,"flotGaugeLabel"+T,P.label.formatter?P.label.formatter(S.label,S.data[0][1]):text,P.label)},p.prototype.drawValue=function(P,b,M,T,S){C(M.cx,M.cy-P.value.font.size/2,"flotGaugeValue"+T,P.value.formatter?P.value.formatter(S.label,S.data[0][1]):text,P.value)},p.prototype.drawThresholdValues=function(P,b,M,T){a(P,b,M,"Min"+T,P.gauge.min,P.gauge.startAngle),a(P,b,M,"Max"+T,P.gauge.max,P.gauge.endAngle);for(var S=0;S<P.threshold.values.length;S++){var x=P.threshold.values[S];if(x.value>P.gauge.min&&x.value<P.gauge.max){var O=v(P,b,x.value);a(P,b,M,T+"_"+S,x.value,O)}}var B=P.gauge.neutralValue;B!=null&&B>P.gauge.min&&B<P.gauge.max&&a(P,b,M,"Neutral"+T,B,v(P,b,B))};function a(P,b,M,T,S,x){C(M.cx+(b.thresholdLabelMargin+b.thresholdLabelFontSize/2+b.radius)*Math.cos(i(x)),M.cy+(b.thresholdLabelMargin+b.thresholdLabelFontSize/2+b.radius)*Math.sin(i(x)),"flotGaugeThresholdValue"+T,P.threshold.label.formatter?P.threshold.label.formatter(S):S,P.threshold.label,x)}function C(P,b,M,T,S,x){var O=j(l).find("#"+M),B=O.length;B||(O=j("<span></span>"),O.attr("id",M),O.attr("class","flot-temp-elem"),l.append(O)),O.css("position","absolute"),O.css("top",b+"px"),O.css("white-space","nowrap"),S.font.size&&O.css("font-size",S.font.size+"px"),S.font.family&&O.css("font-family",S.font.family),S.color&&O.css("color",S.color),S.background.color&&O.css("background-color",S.background.color),S.background.opacity&&O.css("opacity",S.background.opacity),O.text(T),O.css("left",P+"px"),O.css("left",parseInt(O.css("left"))-O.width()/2+"px"),!B&&x&&(O.css("top",parseInt(O.css("top"))-O.height()/2+"px"),O.css("transform","rotate("+(180*x+90)+"deg)"))}return p}();function e(d){return typeof Logger<"u"?new Logger(d):null}function t(d,l){return l%d}function n(d,l){return Math.floor(l/d)}function i(d){return d*Math.PI}function s(d,l,u,o,m,c,p,f,E,h){if(c!==p){var y=!1;d.save(),d.beginPath(),d.arc(l,u,o,c,p,y),d.lineTo(l+(o-m)*Math.cos(p),u+(o-m)*Math.sin(p)),d.arc(l,u,o-m,p,c,!y),d.closePath(),E&&(d.lineWidth=E),f&&(d.strokeStyle=f,d.stroke()),h&&(d.fillStyle=h,d.fill()),d.restore()}}function r(d){d.hooks.processOptions.push(function(l,u){var o=e(u.series.gauges.debug);u.series.gauges.show&&(u.grid.show=!1,u.legend.show=!1);var m=u.series.gauges.threshold.values;m.sort(function(c,p){return c.value<p.value?-1:c.value>p.value?1:0})}),d.hooks.draw.push(function(l,u){var o=l.getOptions(),m=o.series.gauges,c=e(m.debug);if(m.show){var p=l.getData();if(!(!p||!p.length)){var f=new I(l,u),E=f.calculateLayout();m.debug.layout,f.drawBackground(E);for(var h=0;h<p.length;h++){var y=p[h],v=j.extend({},m,y.gauges);y.gauges&&f.calculateAutoValues(v,E.cellWidth);var D=f.calculateCellLayout(v,E,h);f.drawCellBackground(v,D),v.debug.layout,v.label.show&&f.drawLable(v,E,D,h,y),f.drawGauge(v,E,D,y.label,y.data[0][1]),v.threshold.show&&f.drawThreshold(v,E,D),v.threshold.label.show&&f.drawThresholdValues(v,E,D,h),v.value.show&&f.drawValue(v,E,D,h,y)}}}})}var g={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(d,l){return d}},value:{show:!0,margin:"auto",background:{color:null,opacity:0},font:{size:"auto",family:"sans-serif"},color:null,formatter:function(d,l){return parseInt(l)}},threshold:{show:!0,width:"auto",label:{show:!0,margin:"auto",background:{color:null,opacity:0},font:{size:"auto",family:",sans-serif"},color:null,formatter:function(d){return d}},values:[]}}}};j.plot.plugins.push({init:r,options:g,name:"gauge",version:"1.1.0"})})(jQuery)},89377:()=>{(function(j){j.color={},j.color.make=function(e,t,n,i){var s={};return s.r=e||0,s.g=t||0,s.b=n||0,s.a=i??1,s.add=function(r,g){for(var d=0;d<r.length;++d)s[r.charAt(d)]+=g;return s.normalize()},s.scale=function(r,g){for(var d=0;d<r.length;++d)s[r.charAt(d)]*=g;return s.normalize()},s.toString=function(){return s.a>=1?"rgb("+[s.r,s.g,s.b].join(",")+")":"rgba("+[s.r,s.g,s.b,s.a].join(",")+")"},s.normalize=function(){function r(g,d,l){return d<g?g:d>l?l:d}return s.r=r(0,parseInt(s.r),255),s.g=r(0,parseInt(s.g),255),s.b=r(0,parseInt(s.b),255),s.a=r(0,s.a,1),s},s.clone=function(){return j.color.make(s.r,s.b,s.g,s.a)},s.normalize()},j.color.extract=function(e,t){var n;do{if(n=e.css(t).toLowerCase(),n!=""&&n!="transparent")break;e=e.parent()}while(e.length&&!j.nodeName(e.get(0),"body"));return n=="rgba(0, 0, 0, 0)"&&(n="transparent"),j.color.parse(n)},j.color.parse=function(e){var t,n=j.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 i=j.trim(e).toLowerCase();return i=="transparent"?n(255,255,255,0):(t=I[i]||[0,0,0],n(t[0],t[1],t[2]))};var I={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(j){var I=Object.prototype.hasOwnProperty;j.fn.detach||(j.fn.detach=function(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})});function e(i,s){var r=s.children("."+i)[0];if(r==null&&(r=document.createElement("canvas"),r.className=i,j(r).css({direction:"ltr",position:"absolute",left:0,top:0}).appendTo(s),!r.getContext))if(window.G_vmlCanvasManager)r=window.G_vmlCanvasManager.initElement(r);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=r;var g=this.context=r.getContext("2d"),d=window.devicePixelRatio||1,l=g.webkitBackingStorePixelRatio||g.mozBackingStorePixelRatio||g.msBackingStorePixelRatio||g.oBackingStorePixelRatio||g.backingStorePixelRatio||1;this.pixelRatio=d/l,this.resize(s.width(),s.height()),this.textContainer=null,this.text={},this._textCache={},this._textSizeCache=window.flotTextSizeCache=window.flotTextSizeCache||{}}e.prototype.resize=function(i,s){if(i<=0||s<=0)throw new Error("Invalid dimensions for plot, width = "+i+", height = "+s);var r=this.element,g=this.context,d=this.pixelRatio;this.width!=i&&(r.width=i*d,r.style.width=i+"px",this.width=i),this.height!=s&&(r.height=s*d,r.style.height=s+"px",this.height=s),g.restore(),g.save(),g.scale(d,d)},e.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},e.prototype.render=function(){var i=this._textCache;for(var s in i)if(I.call(i,s)){var r=this.getTextLayer(s),g=i[s];r.hide();for(var d in g)if(I.call(g,d)){var l=g[d];for(var u in l)if(I.call(l,u)){for(var o=l[u].positions,m=0,c;c=o[m];m++)c.active?c.rendered||(r.append(c.element),c.rendered=!0):(o.splice(m--,1),c.rendered&&c.element.detach());o.length==0&&delete l[u]}}r.show()}},e.prototype.getTextLayer=function(i){var s=this.text[i];return s==null&&(this.textContainer==null&&(this.textContainer=j("<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)),s=this.text[i]=j("<div></div>").addClass(i).css({position:"absolute",top:0,left:0,bottom:0,right:0}).appendTo(this.textContainer)),s},e.prototype.getTextInfo=function(i,s,r,g,d){var l,u,o,m;if(s=""+s,typeof r=="object"?l=r.style+" "+r.variant+" "+r.weight+" "+r.size+"px/"+r.lineHeight+"px "+r.family:l=r,u=this._textCache[i],u==null&&(u=this._textCache[i]={}),o=u[l],o==null&&(o=u[l]={}),m=o[s],m==null){var c=j("<div></div>").html(s).css({position:"absolute","max-width":d,top:-9999}).appendTo(this.getTextLayer(i));typeof r=="object"?c.css({font:l,color:r.color}):typeof r=="string"&&c.addClass(r),m=o[s]={element:c,positions:[]};var p=this._textSizeCache[s];p?(m.width=p.width,m.height=p.height):(m.width=c.outerWidth(!0),m.height=c.outerHeight(!0),this._textSizeCache[s]={width:m.width,height:m.height}),c.detach()}return m},e.prototype.addText=function(i,s,r,g,d,l,u,o,m){var c=this.getTextInfo(i,g,d,l,u),p=c.positions;o=="center"?s-=c.width/2:o=="right"&&(s-=c.width),m=="middle"?r-=c.height/2:m=="bottom"&&(r-=c.height);for(var f=0,E;E=p[f];f++)if(E.x==s&&E.y==r){E.active=!0;return}E={active:!0,rendered:!1,element:p.length?c.element.clone():c.element,x:s,y:r},p.push(E),E.element.css({top:Math.round(r),left:Math.round(s),"text-align":o})},e.prototype.removeText=function(i,s,r,g,d,l){if(g==null){var u=this._textCache[i];if(u!=null){for(var o in u)if(I.call(u,o)){var m=u[o];for(var c in m)if(I.call(m,c))for(var p=m[c].positions,f=0,E;E=p[f];f++)E.active=!1}}}else for(var p=this.getTextInfo(i,g,d,l).positions,f=0,E;E=p[f];f++)E.x==s&&E.y==r&&(E.active=!1)};function t(i,s,r,g){var d=[],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:{}},u=null,o=null,m=null,c=null,p=null,f=[],E=[],h={left:0,right:0,top:0,bottom:0},y=0,v=0,D={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],processRange:[],drawBackground:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},a=this;a.setData=M,a.setupGrid=Y,a.draw=oe,a.getPlaceholder=function(){return i},a.getCanvas=function(){return u.element},a.getPlotOffset=function(){return h},a.width=function(){return y},a.height=function(){return v},a.offset=function(){var me=m.offset();return me.left+=h.left,me.top+=h.top,me},a.getData=function(){return d},a.getAxes=function(){var me={},Ee;return j.each(f.concat(E),function(Ce,Ae){Ae&&(me[Ae.direction+(Ae.n!=1?Ae.n:"")+"axis"]=Ae)}),me},a.getXAxes=function(){return f},a.getYAxes=function(){return E},a.c2p=O,a.p2c=B,a.getOptions=function(){return l},a.highlight=Pt,a.unhighlight=xt,a.triggerRedrawOverlay=tt,a.pointOffset=function(me){return{left:parseInt(f[S(me,"x")-1].p2c(+me.x)+h.left,10),top:parseInt(E[S(me,"y")-1].p2c(+me.y)+h.top,10)}},a.shutdown=F,a.destroy=function(){F(),i.removeData("plot").empty(),d=[],l=null,u=null,o=null,m=null,c=null,p=null,f=[],E=[],D=null,we=[],a=null},a.resize=function(){var me=i.width(),Ee=i.height();u.resize(me,Ee),o.resize(me,Ee)},a.hooks=D,P(a),b(r),w(),M(s),Y(),oe(),N();function C(me,Ee){Ee=[a].concat(Ee);for(var Ce=0;Ce<me.length;++Ce)me[Ce].apply(this,Ee)}function P(){for(var me={Canvas:e},Ee=0;Ee<g.length;++Ee){var Ce=g[Ee];Ce.init(a,me),Ce.options&&j.extend(!0,l,Ce.options)}}function b(me){j.extend(!0,l,me),me&&me.colors&&(l.colors=me.colors),l.xaxis.color==null&&(l.xaxis.color=j.color.parse(l.grid.color).scale("a",.22).toString()),l.yaxis.color==null&&(l.yaxis.color=j.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=j.color.parse(l.grid.color).scale("a",.22).toString());var Ee,Ce,Ae,ze=i.css("font-size"),Ie=ze?+ze.replace("px",""):13,xe={style:i.css("font-style"),size:Math.round(.8*Ie),variant:i.css("font-variant"),weight:i.css("font-weight"),family:i.css("font-family")};for(Ae=l.xaxes.length||1,Ee=0;Ee<Ae;++Ee)Ce=l.xaxes[Ee],Ce&&!Ce.tickColor&&(Ce.tickColor=Ce.color),Ce=j.extend(!0,{},l.xaxis,Ce),l.xaxes[Ee]=Ce,Ce.font&&(Ce.font=j.extend({},xe,Ce.font),Ce.font.color||(Ce.font.color=Ce.color),Ce.font.lineHeight||(Ce.font.lineHeight=Math.round(Ce.font.size*1.15)));for(Ae=l.yaxes.length||1,Ee=0;Ee<Ae;++Ee)Ce=l.yaxes[Ee],Ce&&!Ce.tickColor&&(Ce.tickColor=Ce.color),Ce=j.extend(!0,{},l.yaxis,Ce),l.yaxes[Ee]=Ce,Ce.font&&(Ce.font=j.extend({},xe,Ce.font),Ce.font.color||(Ce.font.color=Ce.color),Ce.font.lineHeight||(Ce.font.lineHeight=Math.round(Ce.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]=j.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]=j.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&&j.extend(!0,l.series.lines,l.lines),l.points&&j.extend(!0,l.series.points,l.points),l.bars&&j.extend(!0,l.series.bars,l.bars),l.shadowSize!=null&&(l.series.shadowSize=l.shadowSize),l.highlightColor!=null&&(l.series.highlightColor=l.highlightColor),Ee=0;Ee<l.xaxes.length;++Ee)A(f,Ee+1).options=l.xaxes[Ee];for(Ee=0;Ee<l.yaxes.length;++Ee)A(E,Ee+1).options=l.yaxes[Ee];for(var Te in D)l.hooks[Te]&&l.hooks[Te].length&&(D[Te]=D[Te].concat(l.hooks[Te]));C(D.processOptions,[l])}function M(me){d=T(me),V(),W()}function T(me){for(var Ee=[],Ce=0;Ce<me.length;++Ce){var Ae=j.extend(!0,{},l.series);me[Ce].data!=null?(Ae.data=me[Ce].data,delete me[Ce].data,j.extend(!0,Ae,me[Ce]),me[Ce].data=Ae.data):Ae.data=me[Ce],Ee.push(Ae)}return Ee}function S(me,Ee){var Ce=me[Ee+"axis"];return typeof Ce=="object"&&(Ce=Ce.n),typeof Ce!="number"&&(Ce=1),Ce}function x(){return j.grep(f.concat(E),function(me){return me})}function O(me){var Ee={},Ce,Ae;for(Ce=0;Ce<f.length;++Ce)Ae=f[Ce],Ae&&(Ee["x"+Ae.n]=Ae.c2p(me.left));for(Ce=0;Ce<E.length;++Ce)Ae=E[Ce],Ae&&(Ee["y"+Ae.n]=Ae.c2p(me.top));return Ee.x1!==void 0&&(Ee.x=Ee.x1),Ee.y1!==void 0&&(Ee.y=Ee.y1),Ee}function B(me){var Ee={},Ce,Ae,ze;for(Ce=0;Ce<f.length;++Ce)if(Ae=f[Ce],Ae&&Ae.used&&(ze="x"+Ae.n,me[ze]==null&&Ae.n==1&&(ze="x"),me[ze]!=null)){Ee.left=Ae.p2c(me[ze]);break}for(Ce=0;Ce<E.length;++Ce)if(Ae=E[Ce],Ae&&Ae.used&&(ze="y"+Ae.n,me[ze]==null&&Ae.n==1&&(ze="y"),me[ze]!=null)){Ee.top=Ae.p2c(me[ze]);break}return Ee}function A(me,Ee){return me[Ee-1]||(me[Ee-1]={n:Ee,direction:me==f?"x":"y",options:j.extend(!0,{},me==f?l.xaxis:l.yaxis)}),me[Ee-1]}function V(){var me=d.length,Ee=-1,Ce;for(Ce=0;Ce<d.length;++Ce){var Ae=d[Ce].color;Ae!=null&&(me--,typeof Ae=="number"&&Ae>Ee&&(Ee=Ae))}me<=Ee&&(me=Ee+1);var ze,Ie=[],xe=l.colors,Te=xe.length,Oe=0;for(Ce=0;Ce<me;Ce++)ze=j.color.parse(xe[Ce%Te]||"#666"),Ce%Te==0&&Ce&&(Oe>=0?Oe<.5?Oe=-Oe-.2:Oe=0:Oe=-Oe),Ie[Ce]=ze.scale("rgb",1+Oe);var ie=0,Le;for(Ce=0;Ce<d.length;++Ce){if(Le=d[Ce],Le.color==null?(Le.color=Ie[ie].toString(),++ie):typeof Le.color=="number"&&(Le.color=Ie[Le.color].toString()),Le.lines.show==null){var Be,Ue=!0;for(Be in Le)if(Le[Be]&&Le[Be].show){Ue=!1;break}Ue&&(Le.lines.show=!0)}Le.lines.zero==null&&(Le.lines.zero=!!Le.lines.fill),Le.xaxis=A(f,S(Le,"x")),Le.yaxis=A(E,S(Le,"y"))}}function W(){var me=Number.POSITIVE_INFINITY,Ee=Number.NEGATIVE_INFINITY,Ce=Number.MAX_VALUE,Ae,ze,Ie,xe,Te,Oe,ie,Le,Be,Ue,ue,pe,$e,Se,Ve,He;function Ze(on,ln,Un){ln<on.datamin&&ln!=-Ce&&(on.datamin=ln),Un>on.datamax&&Un!=Ce&&(on.datamax=Un)}for(j.each(x(),function(on,ln){ln.datamin=me,ln.datamax=Ee,ln.used=!1}),Ae=0;Ae<d.length;++Ae)Oe=d[Ae],Oe.datapoints={points:[]},C(D.processRawData,[Oe,Oe.data,Oe.datapoints]);for(Ae=0;Ae<d.length;++Ae){if(Oe=d[Ae],Ve=Oe.data,He=Oe.datapoints.format,!He){if(He=[],He.push({x:!0,number:!0,required:!0}),He.push({y:!0,number:!0,required:!0}),Oe.stack||Oe.bars.show||Oe.lines.show&&Oe.lines.fill){var Qe=!!(Oe.bars.show&&Oe.bars.zero||Oe.lines.show&&Oe.lines.zero);He.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:Qe}),Oe.bars.horizontal&&(delete He[He.length-1].y,He[He.length-1].x=!0)}Oe.datapoints.format=He}if(Oe.datapoints.pointsize==null){Oe.datapoints.pointsize=He.length,Le=Oe.datapoints.pointsize,ie=Oe.datapoints.points;var rt=Oe.lines.show&&Oe.lines.steps;for(Oe.xaxis.used=Oe.yaxis.used=!0,ze=Ie=0;ze<Ve.length;++ze,Ie+=Le){Se=Ve[ze];var pt=Se==null;if(!pt)for(xe=0;xe<Le;++xe)pe=Se[xe],$e=He[xe],$e&&($e.number&&pe!=null&&(pe=+pe,isNaN(pe)?pe=null:pe==1/0?pe=Ce:pe==-1/0&&(pe=-Ce)),pe==null&&($e.required&&(pt=!0),$e.defaultValue!=null&&(pe=$e.defaultValue))),ie[Ie+xe]=pe;if(pt)for(xe=0;xe<Le;++xe)pe=ie[Ie+xe],pe!=null&&($e=He[xe],$e.autoscale!==!1&&($e.x&&Ze(Oe.xaxis,pe,pe),$e.y&&Ze(Oe.yaxis,pe,pe))),ie[Ie+xe]=null;if(rt&&Ie>0&&(!pt||ie[Ie-Le]!=null)){for(xe=0;xe<Le;++xe)ie[Ie+Le+xe]=ie[Ie+xe];ie[Ie+1]=ie[Ie-Le+1]||0,pt&&(ie[Ie]=Se[0]),Ie+=Le}}}}for(Ae=0;Ae<d.length;++Ae){if(Oe=d[Ae],ie=Oe.datapoints.points,Le=Oe.datapoints.pointsize,Oe.transform==="negative-Y")for(ze=0;ze<ie.length;ze+=Le)ie[ze]!=null&&(pe=ie[ze+1],ie[ze+1]=-pe);C(D.processDatapoints,[Oe,Oe.datapoints])}for(Ae=0;Ae<d.length;++Ae){Oe=d[Ae],ie=Oe.datapoints.points,Le=Oe.datapoints.pointsize,He=Oe.datapoints.format;var It=me,_t=me,tn=Ee,qt=Ee;for(ze=0;ze<ie.length;ze+=Le)if(ie[ze]!=null)for(xe=0;xe<Le;++xe)pe=ie[ze+xe],$e=He[xe],!(!$e||$e.autoscale===!1||pe==Ce||pe==-Ce)&&($e.x&&(pe<It&&(It=pe),pe>tn&&(tn=pe)),$e.y&&(pe<_t&&(_t=pe),pe>qt&&(qt=pe)));if(Oe.bars.show){var cn;switch(Oe.bars.align){case"left":cn=0;break;case"right":cn=-Oe.bars.barWidth;break;default:cn=-Oe.bars.barWidth/2}Oe.bars.horizontal?(_t+=cn,qt+=cn+Oe.bars.barWidth):(It+=cn,tn+=cn+Oe.bars.barWidth)}Ze(Oe.xaxis,It,tn),Ze(Oe.yaxis,_t,qt)}j.each(x(),function(on,ln){ln.datamin==me&&(ln.datamin=null),ln.datamax==Ee&&(ln.datamax=null)})}function w(){i.find(".flot-temp-elem").remove(),i.css("position")=="static"&&i.css("position","relative"),u=new e("flot-base",i),o=new e("flot-overlay",i),c=u.context,p=o.context,m=j(o.element).unbind();var me=i.data("plot");me&&(me.shutdown(),o.clear()),i.data("plot",a)}function N(){l.grid.hoverable&&(m.mousemove(qe),m.bind("mouseleave",st),j(document).bind("touchend",be)),l.grid.clickable&&m.click(Me),C(D.bindEvents,[m])}function F(){_e&&clearTimeout(_e),m.unbind("mousemove",qe),m.unbind("mouseleave",st),m.unbind("click",Me),j(document).unbind("touchend",be),C(D.shutdown,[m])}function k(me){function Ee(xe){return xe}var Ce,Ae,ze=me.options.transform||Ee,Ie=me.options.inverseTransform;me.direction=="x"?(Ce=me.scale=y/Math.abs(ze(me.max)-ze(me.min)),Ae=Math.min(ze(me.max),ze(me.min))):(Ce=me.scale=v/Math.abs(ze(me.max)-ze(me.min)),Ce=-Ce,Ae=Math.max(ze(me.max),ze(me.min))),ze==Ee?me.p2c=function(xe){return(xe-Ae)*Ce}:me.p2c=function(xe){return(ze(xe)-Ae)*Ce},Ie?me.c2p=function(xe){return Ie(Ae+xe/Ce)}:me.c2p=function(xe){return Ae+xe/Ce}}function H(me){for(var Ee=me.options,Ce=me.ticks||[],Ae=Ee.labelWidth||0,ze=Ee.labelHeight||0,Ie=Ae||(me.direction=="x"?Math.floor(u.width/(Ce.length||1)):null),xe=me.direction+"Axis "+me.direction+me.n+"Axis",Te="flot-"+me.direction+"-axis flot-"+me.direction+me.n+"-axis "+xe,Oe=Ee.font||"flot-tick-label tickLabel",ie=0;ie<Ce.length;++ie){var Le=Ce[ie];if(Le.label){var Be=u.getTextInfo(Te,Le.label,Oe,null,Ie);Ae=Math.max(Ae,Be.width+1),ze=Math.max(ze,Be.height)}}me.labelWidth=Ee.labelWidth||Ae,me.labelHeight=Ee.labelHeight||ze}function R(me){var Ee=me.labelWidth,Ce=me.labelHeight,Ae=me.options.position,ze=me.direction==="x",Ie=me.options.tickLength,xe=l.grid.axisMargin,Te=l.grid.labelMargin,Oe=l.grid.eventSectionHeight,ie=!0,Le=!0,Be=!0,Ue=!1;j.each(ze?f:E,function(ue,pe){pe&&(pe.show||pe.reserveSpace)&&(pe===me?Ue=!0:pe.options.position===Ae&&(Ue?Le=!1:ie=!1),Ue||(Be=!1))}),Le&&(xe=0),Ie==null&&(Ie=Be?"full":5),isNaN(+Ie)||(Te+=+Ie),ze?(Ce+=Te,Ce+=Oe,Ae=="bottom"?(h.bottom+=Ce+xe,me.box={top:u.height-h.bottom,height:Ce}):(me.box={top:h.top+xe,height:Ce},h.top+=Ce+xe)):(Ee+=Te,Ae=="left"?(me.box={left:h.left+xe,width:Ee},h.left+=Ee+xe):(h.right+=Ee+xe,me.box={left:u.width-h.right,width:Ee})),me.position=Ae,me.tickLength=Ie,me.box.padding=Te,me.box.eventSectionPadding=Oe,me.innermost=ie}function _(me){me.direction=="x"?(me.box.left=h.left-me.labelWidth/2,me.box.width=u.width-h.left-h.right+me.labelWidth):(me.box.top=h.top-me.labelHeight/2,me.box.height=u.height-h.bottom-h.top+me.labelHeight)}function G(){var me=l.grid.minBorderMargin,Ee,Ce;if(me==null)for(me=0,Ce=0;Ce<d.length;++Ce)me=Math.max(me,2*(d[Ce].points.radius+d[Ce].points.lineWidth/2));var Ae={left:me,right:me,top:me,bottom:me};j.each(x(),function(ze,Ie){Ie.reserveSpace&&Ie.ticks&&Ie.ticks.length&&(Ie.direction==="x"?(Ae.left=Math.max(Ae.left,Ie.labelWidth/2),Ae.right=Math.max(Ae.right,Ie.labelWidth/2)):(Ae.bottom=Math.max(Ae.bottom,Ie.labelHeight/2),Ae.top=Math.max(Ae.top,Ie.labelHeight/2)))}),h.left=Math.ceil(Math.max(Ae.left,h.left)),h.right=Math.ceil(Math.max(Ae.right,h.right)),h.top=Math.ceil(Math.max(Ae.top,h.top)),h.bottom=Math.ceil(Math.max(Ae.bottom,h.bottom))}function Y(){var me,Ee=x(),Ce=l.grid.show;for(var Ae in h){var ze=l.grid.margin||0;h[Ae]=typeof ze=="number"?ze:ze[Ae]||0}C(D.processOffset,[h]);for(var Ae in h)typeof l.grid.borderWidth=="object"?h[Ae]+=Ce?l.grid.borderWidth[Ae]:0:h[Ae]+=Ce?l.grid.borderWidth:0;if(j.each(Ee,function(Te,Oe){var ie=Oe.options;Oe.show=ie.show==null?Oe.used:ie.show,Oe.reserveSpace=ie.reserveSpace==null?Oe.show:ie.reserveSpace,X(Oe)}),C(D.processRange,[]),Ce){for(var Ie=j.grep(Ee,function(Te){return Te.show||Te.reserveSpace}),xe=!1,me=0;me<2&&(j.each(Ie,function(Oe,ie){se(ie),Z(ie),xe=le(ie,ie.ticks)||xe,H(ie)}),xe&&D.processRange.length>0);me++)C(D.processRange,[]),xe=!1;for(me=Ie.length-1;me>=0;--me)R(Ie[me]);G(),j.each(Ie,function(Te,Oe){_(Oe)})}y=u.width-h.left-h.right,v=u.height-h.bottom-h.top,j.each(Ee,function(Te,Oe){k(Oe)}),Ce&&ae(),et()}function X(me){var Ee=me.options,Ce=+(Ee.min!=null?Ee.min:me.datamin),Ae=+(Ee.max!=null?Ee.max:me.datamax),ze=Ae-Ce;if(ze==0){var Ie=.25,xe=Math.abs(Ae==0?1:Ae*Ie);Ee.min==null&&(Ce-=xe),(Ee.max==null||Ee.min!=null)&&(Ae+=xe)}else{var Te=Ee.autoscaleMargin;Te!=null&&(Ee.min==null&&(Ce-=ze*Te,Ce<0&&me.datamin!=null&&me.datamin>=0&&(Ce=0)),Ee.max==null&&(Ae+=ze*Te,Ae>0&&me.datamax!=null&&me.datamax<=0&&(Ae=0)))}me.min=Ce,me.max=Ae}function Q(me){if(me=Math.abs(String(me).replace(".","")),me==0)return 0;for(;me!=0&&me%10==0;)me/=10;return Math.floor(Math.log(me)/Math.LN10)+1}function se(me){var Ee=me.options,Ce;typeof Ee.ticks=="number"&&Ee.ticks>0?Ce=Ee.ticks:Ce=.3*Math.sqrt(me.direction=="x"?u.width:u.height);var Ae=(me.max-me.min)/Ce,ze=-Math.floor(Math.log(Ae)/Math.LN10),Ie=Ee.tickDecimals;Ie!=null&&ze>Ie&&(ze=Ie);var xe=Math.pow(10,-ze),Te=Ae/xe,Oe;if(Te<1.5?Oe=1:Te<3?(Oe=2,Te>2.25&&(Ie==null||ze+1<=Ie)&&(Oe=2.5,++ze)):Te<7.5?Oe=5:Oe=10,Oe*=xe,Ee.minTickSize!=null&&Oe<Ee.minTickSize&&(Oe=Ee.minTickSize),me.delta=Ae,me.tickDecimals=Math.max(0,Ie??ze),me.tickSize=Ee.tickSize||Oe,Ee.mode=="time"&&!me.tickGenerator)throw new Error("Time mode requires the flot.time plugin.");if(me.tickGenerator||(me.tickGenerator=function(ue){var pe=[],$e=n(ue.min,ue.tickSize),Se=0,Ve=Number.NaN,He;do He=Ve,Ve=$e+Se*ue.tickSize,pe.push(Ve),++Se;while(Ve<ue.max&&Ve!=He);return pe},me.tickFormatter=function(ue,pe){var $e=pe.tickDecimals?Math.pow(10,pe.tickDecimals):1,Se=""+Math.round(ue*$e)/$e;if(pe.tickDecimals!=null){var Ve=Se.indexOf("."),He=Ve==-1?0:Se.length-Ve-1;if(He<pe.tickDecimals)return(He?Se:Se+".")+(""+$e).substr(1,pe.tickDecimals-He)}return Se}),j.isFunction(Ee.tickFormatter)&&(me.tickFormatter=function(ue,pe){return""+Ee.tickFormatter(ue,pe)}),Ee.alignTicksWithAxis!=null){var ie=(me.direction=="x"?f:E)[Ee.alignTicksWithAxis-1];if(ie&&ie.used&&ie!=me){var Le=me.tickGenerator(me);if(Le.length>0&&(Ee.min==null&&(me.min=Math.min(me.min,Le[0])),Ee.max==null&&Le.length>1&&(me.max=Math.max(me.max,Le[Le.length-1]))),me.tickGenerator=function(ue){var pe=[],$e,Se;for(Se=0;Se<ie.ticks.length;++Se)$e=(ie.ticks[Se].v-ie.min)/(ie.max-ie.min),$e=ue.min+$e*(ue.max-ue.min),pe.push($e);return pe},!me.mode&&Ee.tickDecimals==null){var Be=Math.max(0,-Math.floor(Math.log(me.delta)/Math.LN10)+1),Ue=me.tickGenerator(me);Ue.length>1&&/\..*0$/.test((Ue[1]-Ue[0]).toFixed(Be))||(me.tickDecimals=Be)}}}}function Z(me){var Ee=me.options.ticks,Ce=[];Ee==null||typeof Ee=="number"&&Ee>0?Ce=me.tickGenerator(me):Ee&&(j.isFunction(Ee)?Ce=Ee(me):Ce=Ee);var Ae,ze;for(me.ticks=[],Ae=0;Ae<Ce.length;++Ae){var Ie=null,xe=Ce[Ae];typeof xe=="object"?(ze=+xe[0],xe.length>1&&(Ie=xe[1])):ze=+xe,Ie==null&&(Ie=me.tickFormatter(ze,me)),isNaN(ze)||me.ticks.push({v:ze,label:Ie})}}function le(me,Ee){var Ce=!1;return me.options.autoscaleMargin&&Ee.length>0&&(me.options.min==null&&(me.min=Math.min(me.min,Ee[0].v),Ce=!0),me.options.max==null&&Ee.length>1&&(me.max=Math.max(me.max,Ee[Ee.length-1].v),Ce=!0)),Ce}function oe(){u.clear(),C(D.drawBackground,[c]);var me=l.grid;me.show&&me.backgroundColor&&ne(),me.show&&!me.aboveData&&ge();for(var Ee=0;Ee<d.length;++Ee)C(D.drawSeries,[c,d[Ee]]),De(d[Ee]);C(D.draw,[c]),me.show&&me.aboveData&&ge(),u.render(),tt()}function q(me,Ee){for(var Ce,Ae,ze,Ie,xe=x(),Te=0;Te<xe.length;++Te)if(Ce=xe[Te],Ce.direction==Ee&&(Ie=Ee+Ce.n+"axis",!me[Ie]&&Ce.n==1&&(Ie=Ee+"axis"),me[Ie])){Ae=me[Ie].from,ze=me[Ie].to;break}if(me[Ie]||(Ce=Ee=="x"?f[0]:E[0],Ae=me[Ee+"1"],ze=me[Ee+"2"]),Ae!=null&&ze!=null&&Ae>ze){var Oe=Ae;Ae=ze,ze=Oe}return{from:Ae,to:ze,axis:Ce}}function ne(){c.save(),c.translate(h.left,h.top),c.fillStyle=it(l.grid.backgroundColor,v,0,"rgba(255, 255, 255, 0)"),c.fillRect(0,0,y,v),c.restore()}function ge(){var me,Ee,Ce,Ae;c.save(),c.translate(h.left,h.top);var ze=l.grid.markings;if(ze)for(j.isFunction(ze)&&(Ee=a.getAxes(),Ee.xmin=Ee.xaxis.min,Ee.xmax=Ee.xaxis.max,Ee.ymin=Ee.yaxis.min,Ee.ymax=Ee.yaxis.max,ze=ze(Ee)),me=0;me<ze.length;++me){var Ie=ze[me],xe=q(Ie,"x"),Te=q(Ie,"y");if(xe.from==null&&(xe.from=xe.axis.min),xe.to==null&&(xe.to=xe.axis.max),Te.from==null&&(Te.from=Te.axis.min),Te.to==null&&(Te.to=Te.axis.max),!(xe.to<xe.axis.min||xe.from>xe.axis.max||Te.to<Te.axis.min||Te.from>Te.axis.max)){xe.from=Math.max(xe.from,xe.axis.min),xe.to=Math.min(xe.to,xe.axis.max),Te.from=Math.max(Te.from,Te.axis.min),Te.to=Math.min(Te.to,Te.axis.max);var Oe=xe.from===xe.to,ie=Te.from===Te.to;if(!(Oe&&ie))if(xe.from=Math.floor(xe.axis.p2c(xe.from)),xe.to=Math.floor(xe.axis.p2c(xe.to)),Te.from=Math.floor(Te.axis.p2c(Te.from)),Te.to=Math.floor(Te.axis.p2c(Te.to)),Oe||ie){var Le=Ie.lineWidth||l.grid.markingsLineWidth,Be=Le%2?.5:0;c.beginPath(),c.strokeStyle=Ie.color||l.grid.markingsColor,c.lineWidth=Le,Oe?(c.moveTo(xe.to+Be,Te.from),c.lineTo(xe.to+Be,Te.to)):(c.moveTo(xe.from,Te.to+Be),c.lineTo(xe.to,Te.to+Be)),c.stroke()}else c.fillStyle=Ie.color||l.grid.markingsColor,c.fillRect(xe.from,Te.to,xe.to-xe.from,Te.from-Te.to)}}Ee=x(),Ce=l.grid.borderWidth;for(var Ue=0;Ue<Ee.length;++Ue){var ue=Ee[Ue],pe=ue.box,$e=ue.tickLength,Se,Ve,He,Ze;if(!(!ue.show||ue.ticks.length==0)){for(c.lineWidth=1,ue.direction=="x"?(Se=0,$e=="full"?Ve=ue.position=="top"?0:v:Ve=pe.top-h.top+(ue.position=="top"?pe.height:0)):(Ve=0,$e=="full"?Se=ue.position=="left"?0:y:Se=pe.left-h.left+(ue.position=="left"?pe.width:0)),ue.innermost||(c.strokeStyle=ue.options.color,c.beginPath(),He=Ze=0,ue.direction=="x"?He=y+1:Ze=v+1,c.lineWidth==1&&(ue.direction=="x"?Ve=Math.floor(Ve)+.5:Se=Math.floor(Se)+.5),c.moveTo(Se,Ve),c.lineTo(Se+He,Ve+Ze),c.stroke()),c.strokeStyle=ue.options.tickColor,c.beginPath(),me=0;me<ue.ticks.length;++me){var Qe=ue.ticks[me].v;He=Ze=0,!(isNaN(Qe)||Qe<ue.min||Qe>ue.max||$e=="full"&&(typeof Ce=="object"&&Ce[ue.position]>0||Ce>0)&&(Qe==ue.min||Qe==ue.max))&&(ue.direction=="x"?(Se=ue.p2c(Qe),Ze=$e=="full"?-v:$e,ue.position=="top"&&(Ze=-Ze)):(Ve=ue.p2c(Qe),He=$e=="full"?-y:$e,ue.position=="left"&&(He=-He)),c.lineWidth==1&&(ue.direction=="x"?Se=Math.floor(Se)+.5:Ve=Math.floor(Ve)+.5),c.moveTo(Se,Ve),c.lineTo(Se+He,Ve+Ze))}c.stroke()}}Ce&&(Ae=l.grid.borderColor,typeof Ce=="object"||typeof Ae=="object"?(typeof Ce!="object"&&(Ce={top:Ce,right:Ce,bottom:Ce,left:Ce}),typeof Ae!="object"&&(Ae={top:Ae,right:Ae,bottom:Ae,left:Ae}),Ce.top>0&&(c.strokeStyle=Ae.top,c.lineWidth=Ce.top,c.beginPath(),c.moveTo(0-Ce.left,0-Ce.top/2),c.lineTo(y,0-Ce.top/2),c.stroke()),Ce.right>0&&(c.strokeStyle=Ae.right,c.lineWidth=Ce.right,c.beginPath(),c.moveTo(y+Ce.right/2,0-Ce.top),c.lineTo(y+Ce.right/2,v),c.stroke()),Ce.bottom>0&&(c.strokeStyle=Ae.bottom,c.lineWidth=Ce.bottom,c.beginPath(),c.moveTo(y+Ce.right,v+Ce.bottom/2),c.lineTo(0,v+Ce.bottom/2),c.stroke()),Ce.left>0&&(c.strokeStyle=Ae.left,c.lineWidth=Ce.left,c.beginPath(),c.moveTo(0-Ce.left/2,v+Ce.bottom),c.lineTo(0-Ce.left/2,0),c.stroke())):(c.lineWidth=Ce,c.strokeStyle=l.grid.borderColor,c.strokeRect(-Ce/2,-Ce/2,y+Ce,v+Ce))),c.restore()}function ae(){j.each(x(),function(me,Ee){var Ce=Ee.box,Ae=Ee.direction+"Axis "+Ee.direction+Ee.n+"Axis",ze="flot-"+Ee.direction+"-axis flot-"+Ee.direction+Ee.n+"-axis "+Ae,Ie=Ee.options.font||"flot-tick-label tickLabel",xe,Te,Oe,ie,Le;if(u.removeText(ze),!(!Ee.show||Ee.ticks.length==0))for(var Be=0;Be<Ee.ticks.length;++Be)xe=Ee.ticks[Be],!(!xe.label||xe.v<Ee.min||xe.v>Ee.max)&&(Ee.direction=="x"?(ie="center",Te=h.left+Ee.p2c(xe.v),Ee.position=="bottom"?Oe=Ce.top+Ce.padding+Ce.eventSectionPadding:(Oe=Ce.top+Ce.height-Ce.padding,Le="bottom")):(Le="middle",Oe=h.top+Ee.p2c(xe.v),Ee.position=="left"?(Te=Ce.left+Ce.width-Ce.padding,ie="right"):Te=Ce.left+Ce.padding),u.addText(ze,Te,Oe,xe.label,Ie,null,null,ie,Le))})}function re(me){for(var Ee=[],Ce=null,Ae=null,ze=me.datapoints,Ie=[],xe=0;xe<ze.pointsize-2;xe++)Ie.push(0);for(var Te=0;Te<ze.points.length;Te+=ze.pointsize){var Oe=ze.points[Te],ie=ze.points[Te+1];Te===ze.points.length-ze.pointsize?Ae=null:Ae=ze.points[Te+ze.pointsize],Oe!==null&&ie!==null&&Ce===null&&Ae===null&&(Ee.push(Oe),Ee.push(ie),Ee.push.apply(Ee,Ie)),Ce=Oe}var Le=ze.points;ze.points=Ee,me.points.radius=me.lines.lineWidth/2,ye(me),ze.points=Le}function De(me){me.lines.show&&(he(me),!me.points.show&&!me.bars.show&&re(me)),me.bars.show&&We(me),me.points.show&&ye(me)}function he(me){function Ee(Te,Oe,ie,Le,Be){var Ue=Te.points,ue=Te.pointsize,pe=null,$e=null;c.beginPath();for(var Se=ue;Se<Ue.length;Se+=ue){var Ve=Ue[Se-ue],He=Ue[Se-ue+1],Ze=Ue[Se],Qe=Ue[Se+1];if(!(Ve==null||Ze==null)){if(He<=Qe&&He<Be.min){if(Qe<Be.min)continue;Ve=(Be.min-He)/(Qe-He)*(Ze-Ve)+Ve,He=Be.min}else if(Qe<=He&&Qe<Be.min){if(He<Be.min)continue;Ze=(Be.min-He)/(Qe-He)*(Ze-Ve)+Ve,Qe=Be.min}if(He>=Qe&&He>Be.max){if(Qe>Be.max)continue;Ve=(Be.max-He)/(Qe-He)*(Ze-Ve)+Ve,He=Be.max}else if(Qe>=He&&Qe>Be.max){if(He>Be.max)continue;Ze=(Be.max-He)/(Qe-He)*(Ze-Ve)+Ve,Qe=Be.max}if(Ve<=Ze&&Ve<Le.min){if(Ze<Le.min)continue;He=(Le.min-Ve)/(Ze-Ve)*(Qe-He)+He,Ve=Le.min}else if(Ze<=Ve&&Ze<Le.min){if(Ve<Le.min)continue;Qe=(Le.min-Ve)/(Ze-Ve)*(Qe-He)+He,Ze=Le.min}if(Ve>=Ze&&Ve>Le.max){if(Ze>Le.max)continue;He=(Le.max-Ve)/(Ze-Ve)*(Qe-He)+He,Ve=Le.max}else if(Ze>=Ve&&Ze>Le.max){if(Ve>Le.max)continue;Qe=(Le.max-Ve)/(Ze-Ve)*(Qe-He)+He,Ze=Le.max}(Ve!=pe||He!=$e)&&c.moveTo(Le.p2c(Ve)+Oe,Be.p2c(He)+ie),pe=Ze,$e=Qe,c.lineTo(Le.p2c(Ze)+Oe,Be.p2c(Qe)+ie)}}c.stroke()}function Ce(Te,Oe,ie){for(var Le=Te.points,Be=Te.pointsize,Ue=Math.min(Math.max(0,ie.min),ie.max),ue=0,pe,$e=!1,Se=1,Ve=0,He=0;!(Be>0&&ue>Le.length+Be);){ue+=Be;var Ze=Le[ue-Be],Qe=Le[ue-Be+Se],rt=Le[ue],pt=Le[ue+Se];if($e){if(Be>0&&Ze!=null&&rt==null){He=ue,Be=-Be,Se=2;continue}if(Be<0&&ue==Ve+Be){c.fill(),$e=!1,Be=-Be,Se=1,ue=Ve=He+Be;continue}}if(!(Ze==null||rt==null)){if(Ze<=rt&&Ze<Oe.min){if(rt<Oe.min)continue;Qe=(Oe.min-Ze)/(rt-Ze)*(pt-Qe)+Qe,Ze=Oe.min}else if(rt<=Ze&&rt<Oe.min){if(Ze<Oe.min)continue;pt=(Oe.min-Ze)/(rt-Ze)*(pt-Qe)+Qe,rt=Oe.min}if(Ze>=rt&&Ze>Oe.max){if(rt>Oe.max)continue;Qe=(Oe.max-Ze)/(rt-Ze)*(pt-Qe)+Qe,Ze=Oe.max}else if(rt>=Ze&&rt>Oe.max){if(Ze>Oe.max)continue;pt=(Oe.max-Ze)/(rt-Ze)*(pt-Qe)+Qe,rt=Oe.max}if($e||(c.beginPath(),c.moveTo(Oe.p2c(Ze),ie.p2c(Ue)),$e=!0),Qe>=ie.max&&pt>=ie.max){c.lineTo(Oe.p2c(Ze),ie.p2c(ie.max)),c.lineTo(Oe.p2c(rt),ie.p2c(ie.max));continue}else if(Qe<=ie.min&&pt<=ie.min){c.lineTo(Oe.p2c(Ze),ie.p2c(ie.min)),c.lineTo(Oe.p2c(rt),ie.p2c(ie.min));continue}var It=Ze,_t=rt;Qe<=pt&&Qe<ie.min&&pt>=ie.min?(Ze=(ie.min-Qe)/(pt-Qe)*(rt-Ze)+Ze,Qe=ie.min):pt<=Qe&&pt<ie.min&&Qe>=ie.min&&(rt=(ie.min-Qe)/(pt-Qe)*(rt-Ze)+Ze,pt=ie.min),Qe>=pt&&Qe>ie.max&&pt<=ie.max?(Ze=(ie.max-Qe)/(pt-Qe)*(rt-Ze)+Ze,Qe=ie.max):pt>=Qe&&pt>ie.max&&Qe<=ie.max&&(rt=(ie.max-Qe)/(pt-Qe)*(rt-Ze)+Ze,pt=ie.max),Ze!=It&&c.lineTo(Oe.p2c(It),ie.p2c(Qe)),c.lineTo(Oe.p2c(Ze),ie.p2c(Qe)),c.lineTo(Oe.p2c(rt),ie.p2c(pt)),rt!=_t&&(c.lineTo(Oe.p2c(rt),ie.p2c(pt)),c.lineTo(Oe.p2c(_t),ie.p2c(pt)))}}}c.save(),c.translate(h.left,h.top),c.lineJoin="round";var Ae=me.lines.lineWidth,ze=me.shadowSize;if(Ae>0&&ze>0){c.lineWidth=ze,c.strokeStyle="rgba(0,0,0,0.1)";var Ie=Math.PI/18;Ee(me.datapoints,Math.sin(Ie)*(Ae/2+ze/2),Math.cos(Ie)*(Ae/2+ze/2),me.xaxis,me.yaxis),c.lineWidth=ze/2,Ee(me.datapoints,Math.sin(Ie)*(Ae/2+ze/4),Math.cos(Ie)*(Ae/2+ze/4),me.xaxis,me.yaxis)}c.lineWidth=Ae,c.strokeStyle=me.color;var xe=ke(me.lines,me.color,0,v);xe&&(c.fillStyle=xe,Ce(me.datapoints,me.xaxis,me.yaxis)),Ae>0&&Ee(me.datapoints,0,0,me.xaxis,me.yaxis),c.restore()}function ye(me){function Ee(Te,Oe,ie,Le,Be,Ue,ue,pe){for(var $e=Te.points,Se=Te.pointsize,Ve=0;Ve<$e.length;Ve+=Se){var He=$e[Ve],Ze=$e[Ve+1];He==null||He<Ue.min||He>Ue.max||Ze<ue.min||Ze>ue.max||(c.beginPath(),He=Ue.p2c(He),Ze=ue.p2c(Ze)+Le,pe=="circle"?c.arc(He,Ze,Oe,0,Be?Math.PI:Math.PI*2,!1):pe(c,He,Ze,Oe,Be),c.closePath(),ie&&(c.fillStyle=ie,c.fill()),c.stroke())}}c.save(),c.translate(h.left,h.top);var Ce=me.points.lineWidth,Ae=me.shadowSize,ze=me.points.radius,Ie=me.points.symbol;if(Ce==0&&(Ce=1e-4),Ce>0&&Ae>0){var xe=Ae/2;c.lineWidth=xe,c.strokeStyle="rgba(0,0,0,0.1)",Ee(me.datapoints,ze,null,xe+xe/2,!0,me.xaxis,me.yaxis,Ie),c.strokeStyle="rgba(0,0,0,0.2)",Ee(me.datapoints,ze,null,xe/2,!0,me.xaxis,me.yaxis,Ie)}c.lineWidth=Ce,c.strokeStyle=me.color,Ee(me.datapoints,ze,ke(me.points,me.color),0,!1,me.xaxis,me.yaxis,Ie),c.restore()}function ce(me,Ee,Ce,Ae,ze,Ie,xe,Te,Oe,ie,Le){var Be,Ue,ue,pe,$e,Se,Ve,He,Ze;ie?(He=Se=Ve=!0,$e=!1,Be=Ce,Ue=me,pe=Ee+Ae,ue=Ee+ze,Ue<Be&&(Ze=Ue,Ue=Be,Be=Ze,$e=!0,Se=!1)):($e=Se=Ve=!0,He=!1,Be=me+Ae,Ue=me+ze,ue=Ce,pe=Ee,pe<ue&&(Ze=pe,pe=ue,ue=Ze,He=!0,Ve=!1)),!(Ue<xe.min||Be>xe.max||pe<Te.min||ue>Te.max)&&(Be<xe.min&&(Be=xe.min,$e=!1),Ue>xe.max&&(Ue=xe.max,Se=!1),ue<Te.min&&(ue=Te.min,He=!1),pe>Te.max&&(pe=Te.max,Ve=!1),Be=xe.p2c(Be),ue=Te.p2c(ue),Ue=xe.p2c(Ue),pe=Te.p2c(pe),Ie&&(Oe.fillStyle=Ie(ue,pe),Oe.fillRect(Be,pe,Ue-Be,ue-pe)),Le>0&&($e||Se||Ve||He)&&(Oe.beginPath(),Oe.moveTo(Be,ue),$e?Oe.lineTo(Be,pe):Oe.moveTo(Be,pe),Ve?Oe.lineTo(Ue,pe):Oe.moveTo(Ue,pe),Se?Oe.lineTo(Ue,ue):Oe.moveTo(Ue,ue),He?Oe.lineTo(Be,ue):Oe.moveTo(Be,ue),Oe.stroke()))}function We(me){function Ee(ze,Ie,xe,Te,Oe,ie){for(var Le=ze.points,Be=ze.pointsize,Ue=0;Ue<Le.length;Ue+=Be)Le[Ue]!=null&&ce(Le[Ue],Le[Ue+1],Le[Ue+2],Ie,xe,Te,Oe,ie,c,me.bars.horizontal,me.bars.lineWidth)}c.save(),c.translate(h.left,h.top),c.lineWidth=me.bars.lineWidth,c.strokeStyle=me.color;var Ce;switch(me.bars.align){case"left":Ce=0;break;case"right":Ce=-me.bars.barWidth;break;default:Ce=-me.bars.barWidth/2}var Ae=me.bars.fill?function(ze,Ie){return ke(me.bars,me.color,ze,Ie)}:null;Ee(me.datapoints,Ce,Ce+me.bars.barWidth,Ae,me.xaxis,me.yaxis),c.restore()}function ke(me,Ee,Ce,Ae){var ze=me.fill;if(!ze)return null;if(me.fillColor)return it(me.fillColor,Ce,Ae,Ee);var Ie=j.color.parse(Ee);return Ie.a=typeof ze=="number"?ze:.4,Ie.normalize(),Ie.toString()}function et(){if(l.legend.container!=null?j.find(l.legend.container).html(""):i.find(".legend").remove(),!!l.legend.show){for(var me=[],Ee=[],Ce=!1,Ae=l.legend.labelFormatter,ze,Ie,xe=0;xe<d.length;++xe)ze=d[xe],ze.label&&(Ie=Ae?Ae(ze.label,ze):ze.label,Ie&&Ee.push({label:Ie,color:ze.color}));if(l.legend.sorted)if(j.isFunction(l.legend.sorted))Ee.sort(l.legend.sorted);else if(l.legend.sorted=="reverse")Ee.reverse();else{var Te=l.legend.sorted!="descending";Ee.sort(function(Se,Ve){return Se.label==Ve.label?0:Se.label<Ve.label!=Te?1:-1})}for(var xe=0;xe<Ee.length;++xe){var Oe=Ee[xe];xe%l.legend.noColumns==0&&(Ce&&me.push("</tr>"),me.push("<tr>"),Ce=!0),me.push('<td class="legendColorBox"><div style="border:1px solid '+l.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+Oe.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+Oe.label+"</td>")}if(Ce&&me.push("</tr>"),me.length!=0){var ie='<table style="font-size:smaller;color:'+l.grid.color+'">'+me.join("")+"</table>";if(l.legend.container!=null)j(l.legend.container).html(ie);else{var Le="",Be=l.legend.position,Ue=l.legend.margin;Ue[0]==null&&(Ue=[Ue,Ue]),Be.charAt(0)=="n"?Le+="top:"+(Ue[1]+h.top)+"px;":Be.charAt(0)=="s"&&(Le+="bottom:"+(Ue[1]+h.bottom)+"px;"),Be.charAt(1)=="e"?Le+="right:"+(Ue[0]+h.right)+"px;":Be.charAt(1)=="w"&&(Le+="left:"+(Ue[0]+h.left)+"px;");var ue=j('<div class="legend">'+ie.replace('style="','style="position:absolute;'+Le+";")+"</div>").appendTo(i);if(l.legend.backgroundOpacity!=0){var pe=l.legend.backgroundColor;pe==null&&(pe=l.grid.backgroundColor,pe&&typeof pe=="string"?pe=j.color.parse(pe):pe=j.color.extract(ue,"background-color"),pe.a=1,pe=pe.toString());var $e=ue.children();j('<div style="position:absolute;width:'+$e.width()+"px;height:"+$e.height()+"px;"+Le+"background-color:"+pe+';"> </div>').prependTo(ue).css("opacity",l.legend.backgroundOpacity)}}}}}var we=[],_e=null;function Ge(me,Ee,Ce){var Ae=l.grid.mouseActiveRadius,ze=Ae*Ae+1,Ie=null,xe=!1,Te,Oe,ie;for(Te=d.length-1;Te>=0;--Te)if(Ce(d[Te])){var Le=d[Te],Be=Le.xaxis,Ue=Le.yaxis,ue=Le.datapoints.points,pe=Be.c2p(me),$e=Ue.c2p(Ee),Se=Ae/Be.scale,Ve=Ae/Ue.scale;if(ie=Le.datapoints.pointsize,Be.options.inverseTransform&&(Se=Number.MAX_VALUE),Ue.options.inverseTransform&&(Ve=Number.MAX_VALUE),Le.lines.show||Le.points.show)for(Oe=0;Oe<ue.length;Oe+=ie){var He=ue[Oe],Ze=ue[Oe+1];if(He!=null&&!(He-pe>Se||He-pe<-Se||Ze-$e>Ve||Ze-$e<-Ve)){var Qe=Math.abs(Be.p2c(He)-me),rt=Math.abs(Ue.p2c(Ze)-Ee),pt=Qe*Qe+rt*rt;pt<ze&&(ze=pt,Ie=[Te,Oe/ie])}}if(Le.bars.show&&!Ie){var It,_t;switch(Le.bars.align){case"left":It=0;break;case"right":It=-Le.bars.barWidth;break;default:It=-Le.bars.barWidth/2}for(_t=It+Le.bars.barWidth,Oe=0;Oe<ue.length;Oe+=ie){var He=ue[Oe],Ze=ue[Oe+1],tn=ue[Oe+2];He!=null&&(d[Te].bars.horizontal?pe<=Math.max(tn,He)&&pe>=Math.min(tn,He)&&$e>=Ze+It&&$e<=Ze+_t:pe>=He+It&&pe<=He+_t&&$e>=Math.min(tn,Ze)&&$e<=Math.max(tn,Ze))&&(Ie=[Te,Oe/ie])}}}return Ie?(Te=Ie[0],Oe=Ie[1],ie=d[Te].datapoints.pointsize,{datapoint:d[Te].datapoints.points.slice(Oe*ie,(Oe+1)*ie),dataIndex:Oe,series:d[Te],seriesIndex:Te}):null}function qe(me){l.grid.hoverable&&Ye("plothover",me,function(Ee){return Ee.hoverable!=!1})}function st(me){l.grid.hoverable&&Ye("plothover",me,function(Ee){return!1})}function Me(me){a.isSelecting||Ye("plotclick",me,function(Ee){return Ee.clickable!=!1})}function be(me){if(me.cancelable){if(!m.is(me.target)&&m.has(me.target).length===0){Ye("plotleave",me,function(Ee){});return}qe(Ke(me)),me.preventDefault()}}function Ke(me){if(!me||!me.originalEvent||me.pageX&&me.pageY)return me;var Ee=me.originalEvent;if(Ee.changedTouches.length===0)return me;var Ce=Ee.changedTouches[0];return me.pageX=Ce.pageX,me.pageY=Ce.pageY,me}function Ye(me,Ee,Ce){var Ae=m.offset(),ze=Ee.pageX-Ae.left-h.left,Ie=Ee.pageY-Ae.top-h.top,xe=O({left:ze,top:Ie});xe.pageX=Ee.pageX,xe.pageY=Ee.pageY,xe.ctrlKey=Ee.ctrlKey,xe.metaKey=Ee.metaKey;var Te=Ge(ze,Ie,Ce);if(Te&&(Te.pageX=parseInt(Te.series.xaxis.p2c(Te.datapoint[0])+Ae.left+h.left,10),Te.pageY=parseInt(Te.series.yaxis.p2c(Te.datapoint[1])+Ae.top+h.top,10)),l.grid.autoHighlight){for(var Oe=0;Oe<we.length;++Oe){var ie=we[Oe];ie.auto==me&&!(Te&&ie.series==Te.series&&ie.point[0]==Te.datapoint[0]&&ie.point[1]==Te.datapoint[1])&&xt(ie.series,ie.point)}Te&&Pt(Te.series,Te.datapoint,me)}i.trigger(me,[xe,Te])}function tt(){var me=l.interaction.redrawOverlayInterval;if(me==-1){nt();return}_e||(_e=setTimeout(nt,me))}function nt(){_e=null,p.save(),o.clear(),p.translate(h.left,h.top);var me,Ee;for(me=0;me<we.length;++me)Ee=we[me],Ee.series.bars.show?ct(Ee.series,Ee.point):Rt(Ee.series,Ee.point);p.restore(),C(D.drawOverlay,[p])}function Pt(me,Ee,Ce){if(typeof me=="number"&&(me=d[me]),typeof Ee=="number"){var Ae=me.datapoints.pointsize;Ee=me.datapoints.points.slice(Ae*Ee,Ae*(Ee+1))}var ze=bt(me,Ee);ze==-1?(we.push({series:me,point:Ee,auto:Ce}),tt()):Ce||(we[ze].auto=!1)}function xt(me,Ee){if(me==null&&Ee==null){we=[],tt();return}if(typeof me=="number"&&(me=d[me]),typeof Ee=="number"){var Ce=me.datapoints.pointsize;Ee=me.datapoints.points.slice(Ce*Ee,Ce*(Ee+1))}var Ae=bt(me,Ee);Ae!=-1&&(we.splice(Ae,1),tt())}function bt(me,Ee){for(var Ce=0;Ce<we.length;++Ce){var Ae=we[Ce];if(Ae.series==me&&Ae.point[0]==Ee[0]&&Ae.point[1]==Ee[1])return Ce}return-1}function Rt(me,Ee){var Ce=Ee[0],Ae=Ee[1],ze=me.xaxis,Ie=me.yaxis,xe=typeof me.highlightColor=="string"?me.highlightColor:j.color.parse(me.color).scale("a",.5).toString();if(!(Ce<ze.min||Ce>ze.max||Ae<Ie.min||Ae>Ie.max)){var Te=me.points.radius+me.points.lineWidth/2;p.lineWidth=Te,p.strokeStyle=xe;var Oe=1.5*Te;Ce=ze.p2c(Ce),Ae=Ie.p2c(Ae),p.beginPath(),me.points.symbol=="circle"?p.arc(Ce,Ae,Oe,0,2*Math.PI,!1):me.points.symbol(p,Ce,Ae,Oe,!1),p.closePath(),p.stroke()}}function ct(me,Ee){var Ce=typeof me.highlightColor=="string"?me.highlightColor:j.color.parse(me.color).scale("a",.5).toString(),Ae=Ce,ze;switch(me.bars.align){case"left":ze=0;break;case"right":ze=-me.bars.barWidth;break;default:ze=-me.bars.barWidth/2}p.lineWidth=me.bars.lineWidth,p.strokeStyle=Ce,ce(Ee[0],Ee[1],Ee[2]||0,ze,ze+me.bars.barWidth,function(){return Ae},me.xaxis,me.yaxis,p,me.bars.horizontal,me.bars.lineWidth)}function it(me,Ee,Ce,Ae){if(typeof me=="string")return me;for(var ze=c.createLinearGradient(0,Ce,0,Ee),Ie=0,xe=me.colors.length;Ie<xe;++Ie){var Te=me.colors[Ie];if(typeof Te!="string"){var Oe=j.color.parse(Ae);Te.brightness!=null&&(Oe=Oe.scale("rgb",Te.brightness)),Te.opacity!=null&&(Oe.a*=Te.opacity),Te=Oe.toString()}ze.addColorStop(Ie/(xe-1),Te)}return ze}}j.plot=function(i,s,r){var g=new t(j(i),s,r,j.plot.plugins);return g},j.plot.version="0.8.3",j.plot.plugins=[],j.fn.plot=function(i,s){return this.each(function(){j.plot(this,i,s)})};function n(i,s){return s*Math.floor(i/s)}}(jQuery)},4027:()=>{(function(j){function I(e){var t={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},n={},i=null;function s(h){t.active&&(m(h),e.getPlaceholder().trigger("plotselecting",[d()]))}function r(h){h.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}),o(t.first,h),t.active=!0,i=function(y){g(y)},j(document).one("mouseup",i))}function g(h){return i=null,document.onselectstart!==void 0&&(document.onselectstart=n.onselectstart),document.ondrag!==void 0&&(document.ondrag=n.ondrag),t.active=!1,m(h),E()?l(h):(e.getPlaceholder().trigger("plotunselected",[]),e.getPlaceholder().trigger("plotselecting",[null])),setTimeout(function(){e.isSelecting=!1},10),!1}function d(){if(!E()||!t.show)return null;var h={},y=t.first,v=t.second,D=e.getAxes(),a=!0;return j.each(D,function(C,P){P.used&&(anyUsed=!1)}),j.each(D,function(C,P){if(P.used||a){var b=P.c2p(y[P.direction]),M=P.c2p(v[P.direction]);h[C]={from:Math.min(b,M),to:Math.max(b,M)}}}),h}function l(h){var y=d();y.ctrlKey=h.ctrlKey,y.metaKey=h.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 u(h,y,v){return y<h?h:y>v?v:y}function o(h,y){var v=e.getOptions(),D=e.getPlaceholder().offset(),a=e.getPlotOffset();h.x=u(0,y.pageX-D.left-a.left,e.width()),h.y=u(0,y.pageY-D.top-a.top,e.height()),v.selection.mode=="y"&&(h.x=h==t.first?0:e.width()),v.selection.mode=="x"&&(h.y=h==t.first?0:e.height())}function m(h){h.pageX!=null&&(o(t.second,h),E()?(e.isSelecting=!0,t.show=!0,e.triggerRedrawOverlay()):c(!0))}function c(h){t.show&&(t.show=!1,e.triggerRedrawOverlay(),h||e.getPlaceholder().trigger("plotunselected",[]))}function p(h,y){var v,D,a,C,P=e.getAxes();for(var b in P)if(v=P[b],v.direction==y&&(C=y+v.n+"axis",!h[C]&&v.n==1&&(C=y+"axis"),h[C])){D=h[C].from,a=h[C].to;break}if(h[C]||(v=y=="x"?e.getXAxes()[0]:e.getYAxes()[0],D=h[y+"1"],a=h[y+"2"]),D!=null&&a!=null&&D>a){var M=D;D=a,a=M}return{from:D,to:a,axis:v}}function f(h,y){var v,D,a=e.getOptions();a.selection.mode=="y"?(t.first.x=0,t.second.x=e.width()):(D=p(h,"x"),t.first.x=D.axis.p2c(D.from),t.second.x=D.axis.p2c(D.to)),a.selection.mode=="x"?(t.first.y=0,t.second.y=e.height()):(D=p(h,"y"),t.first.y=D.axis.p2c(D.from),t.second.y=D.axis.p2c(D.to)),t.show=!0,e.triggerRedrawOverlay(),!y&&E()&&l()}function E(){var h=e.getOptions().selection.minSize;return Math.abs(t.second.x-t.first.x)>=h&&Math.abs(t.second.y-t.first.y)>=h}e.clearSelection=c,e.setSelection=f,e.getSelection=d,e.hooks.bindEvents.push(function(h,y){var v=h.getOptions();v.selection.mode!=null&&(y.mousemove(s),y.mousedown(r))}),e.hooks.drawOverlay.push(function(h,y){if(t.show&&E()){var v=h.getPlotOffset(),D=h.getOptions();y.save(),y.translate(v.left,v.top);var a=j.color.parse(D.selection.color);y.strokeStyle=a.scale("a",.8).toString(),y.lineWidth=1,y.lineJoin=D.selection.shape,y.fillStyle=a.scale("a",.4).toString();var C=Math.min(t.first.x,t.second.x)+.5,P=Math.min(t.first.y,t.second.y)+.5,b=Math.abs(t.second.x-t.first.x)-1,M=Math.abs(t.second.y-t.first.y)-1;y.fillRect(C,P,b,M),y.strokeRect(C,P,b,M),y.restore()}}),e.hooks.shutdown.push(function(h,y){y.unbind("mousemove",s),y.unbind("mousedown",r),i&&(j(document).unbind("mouseup",i),document.onselectstart!==void 0&&(document.onselectstart=n.onselectstart),document.ondrag!==void 0&&(document.ondrag=n.ondrag))})}j.plot.plugins.push({init:I,options:{selection:{mode:null,color:"#e8cfac",shape:"round",minSize:5}},name:"selection",version:"1.1"})})(jQuery)},65103:()=>{(function(j){var I={series:{stack:null}};function e(t){function n(s,r){for(var g=null,d=0;d<r.length&&s!=r[d];++d)r[d].stack==s.stack&&(g=r[d]);return g}function i(s,r,g){if(!(r.stack==null||r.stack===!1)){var d=n(r,s.getData());if(d){for(var l=g.pointsize,u=g.points,o=d.datapoints.pointsize,m=d.datapoints.points,c=[],p,f,E,h,y,v,D=r.lines.show,a=r.bars.horizontal,C=l>2&&(a?g.format[2].x:g.format[2].y),P=D&&r.lines.steps,b=a?1:0,M=a?0:1,T=0,S=0,x,O;!(T>=u.length&&S>=m.length);){if(x=c.length,T<u.length&&u[T]==null){for(O=0;O<l;++O)c.push(u[T+O]);T+=l}else if(T>=u.length){for(O=0;O<l;++O)c.push(m[S+O]);C&&(c[x+2]=m[S+M]),S+=o}else if(S>=m.length){for(O=0;O<l;++O)c.push(u[T+O]);T+=l}else if(S<m.length&&m[S]==null)S+=o;else{if(p=u[T+b],f=u[T+M],h=m[S+b],y=m[S+M],v=0,p==h){for(O=0;O<l;++O)c.push(u[T+O]);c[x+M]+=y,v=y,T+=l,S+=o}else if(p>h){if(T==0){for(O=0;O<l;++O)c.push(m[S+O]);v=y}if(T>0&&u[T-l]!=null){for(E=0,c.push(h),c.push(E+y),O=2;O<l;++O)c.push(u[T+O]);v=y}S+=o}else{for(O=0;O<l;++O)c.push(u[T+O]);S>0&&m[S-o]!=null&&(v=0),c[x+M]+=v,T+=l}fromgap=!1,x!=c.length&&C&&(c[x+2]=v)}if(P&&x!=c.length&&x>0&&c[x]!=null&&c[x]!=c[x-l]&&c[x+1]!=c[x-l+1]){for(O=0;O<l;++O)c[x+l+O]=c[x+O];c[x+1]=c[x-l+1]}}g.points=c}}}t.hooks.processDatapoints.push(i)}j.plot.plugins.push({init:e,options:I,name:"stack",version:"1.2"})})(jQuery)},85095:()=>{(function(j){var I={series:{stackpercent:null}};function e(t){var n={},i=!1,s={};function r(l,u,o,m){if(i||(i=!0,s=g(l.getData())),u.stackpercent==!0){var c=o.length;u.percents=[];var p=0,f=1;u.bars&&u.bars.horizontal&&u.bars.horizontal===!0&&(p=1,f=0);for(var E=0;E<c;E++){var h=s[o[E][p]+""];h>0?u.percents.push(o[E][f]*100/h):u.percents.push(0)}}}function g(l){var u=l.length,o={};if(u>0){for(var m=0;m<u;m++)if(l[m].stackpercent){var c=0,p=1;l[m].bars&&l[m].bars.horizontal&&l[m].bars.horizontal===!0&&(c=1,p=0);for(var f=l[m].data.length,E=0;E<f;E++){var h=0;l[m].data[E][1]!=null&&(h=l[m].data[E][p]),o[l[m].data[E][c]+""]?o[l[m].data[E][c]+""]+=h:o[l[m].data[E][c]+""]=h}}}return o}function d(l,u,o){if(u.stackpercent){i||(s=g(l.getData()));var m=[],c=0,p=1;u.bars&&u.bars.horizontal&&u.bars.horizontal===!0&&(c=1,p=0);for(var f=0;f<o.points.length;f+=3)n[o.points[f+c]]||(n[o.points[f+c]]=0),m[f+c]=o.points[f+c],m[f+p]=o.points[f+p]+n[o.points[f+c]],m[f+2]=n[o.points[f+c]],n[o.points[f+c]]+=o.points[f+p],s[m[f+c]+""]>0?(m[f+p]=m[f+p]*100/s[m[f+c]+""],m[f+2]=m[f+2]*100/s[m[f+c]+""]):(m[f+p]=0,m[f+2]=0);o.points=m}}t.hooks.processRawData.push(r),t.hooks.processDatapoints.push(d)}j.plot.plugins.push({init:e,options:I,name:"stackpercent",version:"0.1"})})(jQuery)},59554:()=>{(function(j){var I={xaxis:{timezone:null,timeformat:null,twelveHourClock:!1,monthNames:null}};function e(u,o){return o*Math.floor(u/o)}function t(u,o,m,c){if(typeof u.strftime=="function")return u.strftime(o);var p=function(C,P){return C=""+C,P=""+(P??"0"),C.length==1?P+C:C},f=[],E=!1,h=u.getHours(),y=h<12;m==null&&(m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),c==null&&(c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);var v;h>12?v=h-12:h==0?v=12:v=h;for(var D=0;D<o.length;++D){var a=o.charAt(D);if(E){switch(a){case"a":a=""+c[u.getDay()];break;case"b":a=""+m[u.getMonth()];break;case"d":a=p(u.getDate(),"");break;case"e":a=p(u.getDate()," ");break;case"h":case"H":a=p(h);break;case"I":a=p(v);break;case"l":a=p(v," ");break;case"m":a=p(u.getMonth()+1,"");break;case"M":a=p(u.getMinutes());break;case"q":a=""+(Math.floor(u.getMonth()/3)+1);break;case"S":a=p(u.getSeconds());break;case"y":a=p(u.getFullYear()%100);break;case"Y":a=""+u.getFullYear();break;case"p":a=y?"am":"pm";break;case"P":a=y?"AM":"PM";break;case"w":a=""+u.getDay();break}f.push(a),E=!1}else a=="%"?E=!0:f.push(a)}return f.join("")}function n(u){function o(f,E,h,y){f[E]=function(){return h[y].apply(h,arguments)}}var m={date:u};u.strftime!=null&&o(m,"strftime",u,"strftime"),o(m,"getTime",u,"getTime"),o(m,"setTime",u,"setTime");for(var c=["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds"],p=0;p<c.length;p++)o(m,"get"+c[p],u,"getUTC"+c[p]),o(m,"set"+c[p],u,"setUTC"+c[p]);return m}function i(u,o){if(o.timezone=="browser")return new Date(u);if(!o.timezone||o.timezone=="utc")return n(new Date(u));if(typeof timezoneJS<"u"&&typeof timezoneJS.Date<"u"){var m=new timezoneJS.Date;return m.setTimezone(o.timezone),m.setTime(u),m}else return n(new Date(u))}var s={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},r=[[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"]],g=r.concat([[3,"month"],[6,"month"],[1,"year"]]),d=r.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);function l(u){u.hooks.processOptions.push(function(o,m){j.each(o.getAxes(),function(c,p){var f=p.options;f.mode=="time"&&(p.tickGenerator=function(E){var h=[],y=i(E.min,f),v=0,D=f.tickSize&&f.tickSize[1]==="quarter"||f.minTickSize&&f.minTickSize[1]==="quarter"?d:g;f.minTickSize!=null&&(typeof f.tickSize=="number"?v=f.tickSize:v=f.minTickSize[0]*s[f.minTickSize[1]]);for(var a=0;a<D.length-1&&!(E.delta<(D[a][0]*s[D[a][1]]+D[a+1][0]*s[D[a+1][1]])/2&&D[a][0]*s[D[a][1]]>=v);++a);var C=D[a][0],P=D[a][1];if(P=="year"){if(f.minTickSize!=null&&f.minTickSize[1]=="year")C=Math.floor(f.minTickSize[0]);else{var b=Math.pow(10,Math.floor(Math.log(E.delta/s.year)/Math.LN10)),M=E.delta/s.year/b;M<1.5?C=1:M<3?C=2:M<7.5?C=5:C=10,C*=b}C<1&&(C=1)}E.tickSize=f.tickSize||[C,P];var T=E.tickSize[0];P=E.tickSize[1];var S=T*s[P];P=="second"?y.setSeconds(e(y.getSeconds(),T)):P=="minute"?y.setMinutes(e(y.getMinutes(),T)):P=="hour"?y.setHours(e(y.getHours(),T)):P=="month"?y.setMonth(e(y.getMonth(),T)):P=="quarter"?y.setMonth(3*e(y.getMonth()/3,T)):P=="year"&&y.setFullYear(e(y.getFullYear(),T)),y.setMilliseconds(0),S>=s.minute&&y.setSeconds(0),S>=s.hour&&y.setMinutes(0),S>=s.day&&y.setHours(0),S>=s.day*4&&y.setDate(1),S>=s.month*2&&y.setMonth(e(y.getMonth(),3)),S>=s.quarter*2&&y.setMonth(e(y.getMonth(),6)),S>=s.year&&y.setMonth(0);var x=0,O=Number.NaN,B;do if(B=O,O=y.getTime(),h.push(O),P=="month"||P=="quarter")if(T<1){y.setDate(1);var A=y.getTime();y.setMonth(y.getMonth()+(P=="quarter"?3:1));var V=y.getTime();y.setTime(O+x*s.hour+(V-A)*T),x=y.getHours(),y.setHours(0)}else y.setMonth(y.getMonth()+T*(P=="quarter"?3:1));else P=="year"?y.setFullYear(y.getFullYear()+T):y.setTime(O+S);while(O<E.max&&O!=B);return h},p.tickFormatter=function(E,h){var y=i(E,h.options);if(f.timeformat!=null)return t(y,f.timeformat,f.monthNames,f.dayNames);var v=h.options.tickSize&&h.options.tickSize[1]=="quarter"||h.options.minTickSize&&h.options.minTickSize[1]=="quarter",D=h.tickSize[0]*s[h.tickSize[1]],a=h.max-h.min,C=f.twelveHourClock?" %p":"",P=f.twelveHourClock?"%I":"%H",b;D<s.minute?b=P+":%M:%S"+C:D<s.day?a<2*s.day?b=P+":%M"+C:b="%b %d "+P+":%M"+C:D<s.month?b="%b %d":v&&D<s.quarter||!v&&D<s.year?a<s.year?b="%b":b="%b %Y":v&&D<s.year?a<s.year?b="Q%q":b="Q%q %Y":b="%Y";var M=t(y,b,f.monthNames,f.dayNames);return M})})})}j.plot.plugins.push({init:l,options:I,name:"time",version:"1.0"}),j.plot.formatDate=t})(jQuery)}}]); //# sourceMappingURL=226.da3f7c34e888f96ba08d.js.map